<?php
+ /**
+ * Name: Sniper App
+ * Description: Example of flash game application
+ * Version: 1.0
+ * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
+ */
+/**
+ * Demo plugin for adding various types of Flash games to Friendika.
+ * In this case we're using "Hot Shot Sniper" by FlashGames247
+ */
+
+
function sniper_install() {
register_hook('app_menu', 'addon/sniper/sniper.php', 'sniper_app_menu');
}
EOT;
return $o;
- }
+ }
ini_set('pcre.backtrack_limit', 250000);
-define ( 'FRIENDIKA_VERSION', '2.2.1010' );
+define ( 'FRIENDIKA_VERSION', '2.2.1012' );
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
define ( 'DB_UPDATE_VERSION', 1063 );
killme();
}}
+
+ // install and uninstall plugin
+ if (! function_exists('uninstall_plugin')){
+ function uninstall_plugin($plugin){
+ logger("Addons: uninstalling " . $plugin);
+ q("DELETE FROM `addon` WHERE `name` = '%s' LIMIT 1",
+ dbesc($plugin)
+ );
+
+ @include_once('addon/' . $plugin . '/' . $plugin . '.php');
+ if(function_exists($plugin . '_uninstall')) {
+ $func = $plugin . '_uninstall';
+ $func();
+ }
+ }}
+
+ if (! function_exists('install_plugin')){
+ function install_plugin($plugin){
+ logger("Addons: installing " . $plugin);
+ $t = filemtime('addon/' . $plugin . '/' . $plugin . '.php');
+ @include_once('addon/' . $plugin . '/' . $plugin . '.php');
+ if(function_exists($plugin . '_install')) {
+ $func = $plugin . '_install';
+ $func();
+ $r = q("INSERT INTO `addon` (`name`, `installed`, `timestamp`) VALUES ( '%s', 1, %d ) ",
+ dbesc($plugin),
+ intval($t)
+ );
+ }
+ }}
+
// Primarily involved with database upgrade, but also sets the
// base url for use in cmdline programs which don't have
// $_SERVER variables, and synchronising the state of installed plugins.
if(count($installed)) {
foreach($installed as $i) {
if(! in_array($i['name'],$plugins_arr)) {
- logger("Addons: uninstalling " . $i['name']);
- q("DELETE FROM `addon` WHERE `id` = %d LIMIT 1",
- intval($i['id'])
- );
-
- @include_once('addon/' . $i['name'] . '/' . $i['name'] . '.php');
- if(function_exists($i['name'] . '_uninstall')) {
- $func = $i['name'] . '_uninstall';
- $func();
- }
+ uninstall_plugin($i['name']);
}
else
$installed_arr[] = $i['name'];
if(count($plugins_arr)) {
foreach($plugins_arr as $p) {
if(! in_array($p,$installed_arr)) {
- logger("Addons: installing " . $p);
- $t = filemtime('addon/' . $p . '/' . $p . '.php');
- @include_once('addon/' . $p . '/' . $p . '.php');
- if(function_exists($p . '_install')) {
- $func = $p . '_install';
- $func();
- $r = q("INSERT INTO `addon` (`name`, `installed`, `timestamp`) VALUES ( '%s', 1, %d ) ",
- dbesc($p),
- intval($t)
- );
- }
+ install_plugin($p);
}
}
}
if(! function_exists('lang_selector')) {
function lang_selector() {
global $lang;
- $o .= '<div id="lang-select-icon" class="icon language" title="' . t('Select an alternate language') . '" onclick="openClose(\'language-selector\');" ></div>';
+ $o = '<div id="lang-select-icon" class="icon language" title="' . t('Select an alternate language') . '" onclick="openClose(\'language-selector\');" ></div>';
$o .= '<div id="language-selector" style="display: none;" >';
$o .= '<form action="" method="post" ><select name="system_language" onchange="this.form.submit();" >';
$langs = glob('view/*/strings.php');
return false;
}}
+ /*
+ * parse plugin comment in search of plugin infos.
+ * like
+ *
+ * * Name: Plugin
+ * * Description: A plugin which plugs in
+ * * Version: 1.2.3
+ * * Author: John <profile url>
+ * * Author: Jane <email>
+ * *
+ */
+
+ if (! function_exists('get_plugin_info')){
+ function get_plugin_info($plugin){
+ if (!is_file("addon/$plugin/$plugin.php")) return false;
+
+ $f = file_get_contents("addon/$plugin/$plugin.php");
+ $r = preg_match("|/\*.*\*/|msU", $f, $m);
+
+ $info=Array(
+ 'name' => $plugin,
+ 'description' => "",
+ 'author' => array(),
+ 'version' => ""
+ );
+
+ if ($r){
+ $ll = explode("\n", $m[0]);
+ foreach( $ll as $l ) {
+ $l = trim($l,"\t\n\r */");
+ if ($l!=""){
+ list($k,$v) = array_map("trim", explode(":",$l,2));
+ $k= strtolower($k);
+ if ($k=="author"){
+ $r=preg_match("|([^<]+)<([^>]+)>|", $v, $m);
+ if ($r) {
+ $info['author'][] = array('name'=>$m[1], 'link'=>$m[2]);
+ } else {
+ $info['author'][] = array('name'=>$v);
+ }
+ } else {
+ if (array_key_exists($k,$info)){
+ $info[$k]=$v;
+ }
+ }
+
+ }
+ }
+
+ }
+ return $info;
+ }}
var langSelect = false;
var commentBusy = false;
- $(document).ready(function() {
+ $(function() {
$.ajaxSetup({cache: false});
msie = $.browser.msie ;
+
+
+ /* nav update event */
+ $('nav').bind('nav-update', function(e,data){;
+ var net = $(data).find('net').text();
+ if(net == 0) { net = ''; $('#net-update').hide() } else { $('#net-update').show() }
+ $('#net-update').html(net);
+ var home = $(data).find('home').text();
+ if(home == 0) { home = ''; $('#home-update').hide() } else { $('#home-update').show() }
+ $('#home-update').html(home);
+ var mail = $(data).find('mail').text();
+ if(mail == 0) { mail = ''; $('#mail-update').hide() } else { $('#mail-update').show() }
+ $('#mail-update').html(mail);
+ var intro = $(data).find('intro').text();
+ var register = $(data).find('register').text();
+ if(intro == 0) { intro = ''; }
+ if(register != 0 && intro != '') { intro = intro+'/'+register; }
+ if(register != 0 && intro == '') { intro = '0/'+register; }
+ if (intro == '') { $('#notify-update').hide() } else { $('#notify-update').show() }
+ $('#notify-update').html(intro);
+ });
+
+
NavUpdate();
// Allow folks to stop the ajax page updates with the pause/break key
$(document).keypress(function(event) {
$('#pause').html('');
}
}
-// // F8 - show/hide language selector
-// if(event.keyCode == '119') {
-// if(langSelect) {
-// langSelect = false;
-// $('#language-selector').hide();
-// }
-// else {
-// langSelect = true;
-// $('#language-selector').show();
-// }
-// }
-//
-// this is shift-home on FF, but $ on IE, disabling until I figure out why the diff.
-// update: incompatible usage of onKeyDown vs onKeyPress
-// if(event.keyCode == '36' && event.shiftKey == true) {
-// if(homebase !== undefined) {
-// event.preventDefault();
-// document.location = homebase;
-// }
-// }
});
});
if(! stopped) {
$.get("ping",function(data) {
$(data).find('result').each(function() {
- var net = $(this).find('net').text();
- if(net == 0) { net = ''; $('#net-update').hide() } else { $('#net-update').show() }
- $('#net-update').html(net);
- var home = $(this).find('home').text();
- if(home == 0) { home = ''; $('#home-update').hide() } else { $('#home-update').show() }
- $('#home-update').html(home);
- var mail = $(this).find('mail').text();
- if(mail == 0) { mail = ''; $('#mail-update').hide() } else { $('#mail-update').show() }
- $('#mail-update').html(mail);
- var intro = $(this).find('intro').text();
- var register = $(this).find('register').text();
- if(intro == 0) { intro = ''; }
- if(register != 0 && intro != '') { intro = intro+'/'+register; }
- if(register != 0 && intro == '') { intro = '0/'+register; }
- if (intro == '') { $('#notify-update').hide() } else { $('#notify-update').show() }
- $('#notify-update').html(intro);
-
+ // send nav-update event
+ $('nav').trigger('nav-update', this);
});
}) ;
}
});
}
+ /**
+ * sprintf in javascript
+ * "{0} and {1}".format('zero','uno');
+ **/
+ String.prototype.format = function() {
+ var formatted = this;
+ for (var i = 0; i < arguments.length; i++) {
+ var regexp = new RegExp('\\{'+i+'\\}', 'gi');
+ formatted = formatted.replace(regexp, arguments[i]);
+ }
+ return formatted;
+ };
font-size: 20px;
}
+.vevent {
+ border: 1px solid #CCCCCC;
+}
+.vevent .event-description, .vevent .event-location {
+ margin-left: 10px;
+ margin-right: 10px;
+}
+.vevent .event-start {
+ margin-left: 10px;
+ margin-right: 10px;
+}
+
#new-event-link {
margin-bottom: 10px;
}
+.edit-event-link, .plink-event-link {
+ float: left;
+ margin-top: 4px;
+ margin-right: 4px;
+ margin-bottom: 15px;
+}
+
.event-description:before {
content: url('../../../images/calendar.png');
margin-right: 15px;
float: right;
}
+.event-list-date {
+ margin-bottom: 10px;
+}
+
.prevcal, .nextcal {
float: left;
margin-left: 32px;
font-family: Courier, monospace;
}
.today {
+ font-weight: bold;
color: #FF0000;
}
margin-top: 10px;
}
+.item-select {
+ opacity: 0.3;
+ filter:alpha(opacity=30);
+ float: right;
+ margin-right: 10px;
+}
+.item-select:hover {
+ opacity: 1;
+ filter:alpha(opacity=100);
+}
+#item-delete-selected {
+ margin-top: 30px;
+}
+
+#item-delete-selected-end {
+ clear: both;
+}
+#item-delete-selected-icon, #item-delete-selected-desc {
+ float: left;
+ margin-right: 5px;
+}
+#item-delete-selected-desc:hover {
+ text-decoration: underline;
+}
#lang-select-icon {
cursor: pointer;
filter:alpha(opacity=100);
}
+ /**
+ * ADMIN
+ */
+ #pending-update {
+ float:right;
+ color: #ffffff;
+ font-weight: bold;
+ background-color: #FF0000;
+ padding: 0em 0.3em;
+
+ }
+ #adminpage dl {
+ clear: left;
+ margin-bottom: 2px;
+ padding-bottom: 2px;
+ border-bottom: 1px solid black;
+ }
+ #adminpage dt {
+ width: 200px;
+ float: left;
+ font-weight: bold;
+ }
+ #adminpage dd {
+ margin-left: 200px;
+ }
+
+ #adminpage .field {
+ clear: left;
+ margin-bottom: 5px;
+ padding-bottom: 5px;
+ }
+
+ #adminpage .field label {
+ float: left;
+ width: 200px;
+ font-weight: bold;
+ }
+
+ #adminpage .field input,
+ #adminpage .field textarea {
+ width: 400px;
+ }
+ #adminpage .field textarea { height: 100px; }
+ #adminpage .field_help {
+ display: block;
+ margin-left: 200px;
+ color: #666666;
+
+ }
+ #adminpage h3 {
+ border-bottom: 1px solid #cccccc;
+ }
+
+ #adminpage .submit {
+ clear:left;
+ text-align: right;
+ }
+
+ #adminpage #pluginslist {
+ margin: 0px; padding: 0px;
+ }
+ #adminpage .plugin {
+ list-style: none;
+ display: block;
+ border: 1px solid #888888;
+ padding: 1em;
+ margin-bottom: 5px;
+ clear: left;
+ }
+ #adminpage .plugin .desc { margin-left: 2.5em;}
+ #adminpage .toggleplugin {
+ float:left;
+ margin-right: 1em;
+ }
+
+ #adminpage table {width:100%; border-bottom: 1p solid #000000; margin: 5px 0px;}
+ #adminpage table th { text-align: left;}
+ #adminpage td .icon { float: left;}
+ #adminpage table#users img { width: 16px; height: 16px; }
+ #adminpage table tr:hover { background-color: #bbc7d7; }
+ #adminpage .selectall { text-align: right; }
/**
* ICONS
*/
.language { background-position: -96px -32px; }
.prev { background-position: -112px -32px; }
.next { background-position: -128px -32px; }
+ .on { background-position: -144px -32px; }
+
+ .off { background-position: 0px -48px; }
+ .icon.dim { opacity: 0.3;filter:alpha(opacity=30); }
.attachtype {
display: block; width: 20px; height: 23px;
font-size: 20px;
}
+
+.vevent {
+ border: 1px solid #CCCCCC;
+}
+.vevent .event-description, .vevent .event-location {
+ margin-left: 10px;
+ margin-right: 10px;
+}
+.vevent .event-start {
+ margin-left: 10px;
+ margin-right: 10px;
+}
+
+
#new-event-link {
margin-bottom: 10px;
}
+
+.edit-event-link, .plink-event-link {
+ float: left;
+ margin-top: 4px;
+ margin-right: 4px;
+ margin-bottom: 15px;
+}
+
+
.event-description:before {
content: url('../../../images/calendar.png');
margin-right: 15px;
}
+.event-list-date {
+ margin-bottom: 10px;
+}
+
.event-start, .event-end {
margin-left: 10px;
width: 330px;
font-family: Courier, monospace;
}
.today {
+ font-weight: bold;
color: #FF0000;
}
}
+.item-select {
+ opacity: 0.3;
+ filter:alpha(opacity=30);
+ float: right;
+ margin-right: 10px;
+
+}
+.item-select:hover {
+ opacity: 1;
+ filter:alpha(opacity=100);
+}
+
+#item-delete-selected {
+ margin-top: 30px;
+}
+
+#item-delete-selected-end {
+ clear: both;
+}
+#item-delete-selected-icon, #item-delete-selected-desc {
+ float: left;
+ margin-right: 5px;
+}
+#item-delete-selected-desc:hover {
+ text-decoration: underline;
+}
+
#lang-select-icon {
cursor: pointer;
position: absolute;
top: 0px;
}
+ /**
+ * ADMIN
+ */
+
+ #adminpage dl {
+ clear: left;
+ margin-bottom: 2px;
+ padding-bottom: 2px;
+ border-bottom: 1px solid black;
+ }
+ #adminpage dt {
+ width: 200px;
+ float: left;
+ font-weight: bold;
+ }
+ #adminpage dd {
+ margin-left: 200px;
+ }
+
+ #adminpage .field {
+ clear: left;
+ margin-bottom: 5px;
+ padding-bottom: 5px;
+ }
+
+ #adminpage .field label {
+ float: left;
+ width: 200px;
+ font-weight: bold;
+ }
+
+ #adminpage .field input,
+ #adminpage .field textarea {
+ width: 400px;
+ }
+ #adminpage .field textarea { height: 100px; }
+ #adminpage .field_help {
+ display: block;
+ margin-left: 200px;
+ color: #666666;
+
+ }
+
+ #adminpage h3 {
+ border-bottom: 1px solid #cccccc;
+ }
+
+ #adminpage .submit {
+ clear:left;
+ }
+
+ #adminpage #pluginslist {
+ margin: 0px; padding: 0px;
+ }
+ #adminpage .plugin {
+ list-style: none;
+ display: block;
+ border: 1px solid #888888;
+ padding: 1em;
+ margin-bottom: 5px;
+ clear: left;
+ }
+ #adminpage .plugin .toggle {
+ float:left;
+ margin-right: 1em;
+ }
+
+ #adminpage table {width:100%; border-bottom: 1p solid #000000; margin: 5px 0px;}
+ #adminpage table th { text-align: left;}
+ #adminpage td .icon { float: left;}
+ #adminpage table#users img { width: 16px; height: 16px; }
+ #adminpage table tr:hover { background-color: #bbc7d7; }
+ #adminpage .selectall { text-align: right; }
/**
* ICONS
*/
.language { background-position: -96px -32px; }
.prev { background-position: -112px -32px; }
.next { background-position: -128px -32px; }
+ .on { background-position: -144px -32px; }
+
+ .off { background-position: 0px -48px; }
+
+ .icon.dim { opacity: 0.3;filter:alpha(opacity=30); }
.attachtype {
display: block; width: 20px; height: 23px;