]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #116 from fabrixxm/admin
authorFriendika <info@friendika.com>
Thu, 16 Jun 2011 22:27:12 +0000 (15:27 -0700)
committerFriendika <info@friendika.com>
Thu, 16 Jun 2011 22:27:12 +0000 (15:27 -0700)
Admin pages

1  2 
addon/sniper/sniper.php
boot.php
include/main.js
view/theme/duepuntozero/style.css
view/theme/loozah/style.css

diff --combined addon/sniper/sniper.php
index 8d31e9cd1fe7ca9fbe3b5f53a876655cbdb9c584,bb4eace304bd3c062e939616c24af12ebd8ff77c..d431a246663c999046a5483014134d56241567d3
@@@ -1,11 -1,11 +1,17 @@@
  <?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');
  }
@@@ -34,4 -34,4 +40,4 @@@ $o .= <<< EO
  EOT;
  
  return $o;
- }
+ }
diff --combined boot.php
index 49247eb23fff4634679cd22fc7b17858d7941172,ff4224cfc7ced4c7bac414f8e0b4b1c1200b6302..1c4fc6300069aef5aa3cc18ca1810e91af1b8109
+++ b/boot.php
@@@ -4,7 -4,7 +4,7 @@@ set_time_limit(0)
  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      );
  
@@@ -453,6 -453,37 +453,37 @@@ function system_unavailable() 
        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.
@@@ -538,16 -569,7 +569,7 @@@ function check_config(&$a) 
        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);
                        }
                }
        }
@@@ -2767,7 -2779,7 +2779,7 @@@ function unamp($s) 
  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');
@@@ -2816,3 -2828,55 +2828,55 @@@ function is_site_admin() 
        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;
+ }}
diff --combined include/main.js
index 18cb553286dfd7238e9d9ac3179d9679edf3f19f,1a377a1a4315b447bf50411e29aa61e03895b23c..3cc6079778812cc69564a6dc9f9e29b00390ebfe
        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;
+ };
index 3bf78346f1d30454acee138873116d6d97b2bd8c,4aad4339fe59de973109cdb33a3ebdb0618a773d..2c3700c4364eb67f3d388cad564b2882ffe96c1b
@@@ -2228,29 -2228,10 +2228,29 @@@ a.mail-list-link 
        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;
index c07ef045a43b60a08d7ed4d1ba24035329eff271,947b76fec02bbaa548e9993f845a5f78cdad897e..9ab3bb6bccb914e1b626ce1ef84139e8b7825ba8
@@@ -2428,42 -2428,15 +2428,42 @@@ a.mail-list-link 
        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;