Ignore:
Timestamp:
Dec 5, 2013, 8:36:36 PM (10 years ago)
Author:
mistic100
Message:

fix security problem, fix sql fatal error, try to fix display on smartpocket

Location:
extensions/AdminTools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/AdminTools/include/MultiView.class.php

    r25655 r25791  
    113113      );
    114114
    115     if ($this->is_admin)
     115    // inactive on ws.php to allow AJAX admin tasks
     116    if ($this->is_admin && script_basename() != 'ws')
    116117    {
    117118      if ($this->data['view_as'] == 0)
     
    201202  public function init()
    202203  {
    203     if (isset($_GET['ato_purge_template']))
    204     {
    205       global $template;
    206       $template->delete_compiled_templates();
    207       FileCombiner::clear_combined_files();
     204    if ($this->is_admin)
     205    {
     206      if (isset($_GET['ato_purge_template']))
     207      {
     208        global $template;
     209        $template->delete_compiled_templates();
     210        FileCombiner::clear_combined_files();
     211      }
    208212    }
    209213  }
  • extensions/AdminTools/include/events.inc.php

    r25675 r25791  
    88function admintools_add_public_controller()
    99{
    10   global $MultiView, $conf;
     10  global $MultiView, $conf, $template, $page, $user;
    1111
    1212  if (!$MultiView->is_admin())
     
    1414    return;
    1515  }
    16 
    17   global $template, $page, $user;
    1816
    1917  $url_root = get_root_url();
     
    9997
    10098    $tpl_vars['QUICK_EDIT'] = array(
    101       'img' =>                $picture['current']['derivatives']['square'],
     99      'img' =>                $picture['current']['derivatives']['square']->get_url(),
    102100      'name' =>               $picture['current']['name'],
    103101      'comment' =>            $picture['current']['comment'],
     
    132130    }
    133131
    134     $query = '
     132    $tpl_vars['QUICK_EDIT'] = array(
     133      'img' =>      null,
     134      'name' =>     $page['category']['name'],
     135      'comment' =>  $page['category']['comment'],
     136      );
     137
     138    if (!empty($page['category']['representative_picture_id']))
     139    {
     140      $query = '
    135141SELECT * FROM '.IMAGES_TABLE.'
    136142  WHERE id = '. $page['category']['representative_picture_id'] .'
    137143;';
    138     $image_infos = pwg_db_fetch_assoc(pwg_query($query));
    139 
    140     $tpl_vars['QUICK_EDIT'] = array(
    141       'img' =>      DerivativeImage::get_one(IMG_SQUARE, $image_infos),
    142       'name' =>     $page['category']['name'],
    143       'comment' =>  $page['category']['comment'],
    144       );
     144      $image_infos = pwg_db_fetch_assoc(pwg_query($query));
     145
     146      $tpl_vars['QUICK_EDIT']['img'] = DerivativeImage::get_one(IMG_SQUARE, $image_infos)->get_url();
     147    }
    145148  }
    146149
     
    201204function admintools_save_picture()
    202205{
    203   global $page, $conf;
     206  global $page, $conf, $MultiView;
     207
     208  if (!$MultiView->is_admin())
     209  {
     210    return;
     211  }
    204212
    205213  if (isset($_GET['delete']) and get_pwg_token()==@$_GET['pwg_token'])
     
    269277function admintools_save_category()
    270278{
    271   global $page, $conf;
     279  global $page, $conf, $MultiView;
     280
     281  if (!$MultiView->is_admin())
     282  {
     283    return;
     284  }
    272285 
    273286  if (@$_POST['action'] == 'quick_edit')
  • extensions/AdminTools/main.inc.php

    r25655 r25791  
    1010
    1111defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
     12
    1213
    1314// +-----------------------------------------------------------------------+
     
    3132add_event_handler('init', 'admintools_init');
    3233
    33 if (!defined('IN_ADMIN'))
    34 {
    35   add_event_handler('loc_after_page_header', 'admintools_add_public_controller');
    36   add_event_handler('loc_begin_picture', 'admintools_save_picture');
    37   add_event_handler('loc_begin_index', 'admintools_save_category');
    38 }
    39 
    4034add_event_handler('user_init', array(&$MultiView, 'user_init'));
    4135add_event_handler('init', array(&$MultiView, 'init'));
     
    4741function admintools_init()
    4842{
     43  global $MultiView;
     44 
     45  if (!defined('IN_ADMIN') && $MultiView->is_admin())
     46  {
     47    add_event_handler('loc_after_page_header', 'admintools_add_public_controller');
     48    add_event_handler('loc_begin_picture', 'admintools_save_picture');
     49    add_event_handler('loc_begin_index', 'admintools_save_category');
     50  }
     51 
     52  load_language('plugin.lang', ADMINTOOLS_PATH);
     53
    4954  // global $conf;
    5055
     
    5257  // $maintain = new AdminTools_maintain(ADMINTOOLS_ID);
    5358  // $maintain->autoUpdate(ADMINTOOLS_VERSION, 'install');
    54 
    55   load_language('plugin.lang', ADMINTOOLS_PATH);
    56 
     59 
    5760  // $conf['AdminTools'] = unserialize($conf['AdminTools']);
    5861}
  • extensions/AdminTools/template/public_controller.tpl

    r25675 r25791  
    102102    <form method="post" action="{$ato.U_SELF}">
    103103      <fieldset class="left">
    104         <img src="{$ato.QUICK_EDIT.img->get_url()}" width="100" height="100">
     104        <img src="{$ato.QUICK_EDIT.img}" width="100" height="100">
    105105        <input type="submit" value="{'Save'|translate}">
    106106        <a href="#" class="icon-ato-cancel close-edit">{'Cancel'|translate}</a>
     
    150150      $('body').animate({ldelim}'margin-top': operator+ato_height});
    151151     
    152       if ($('#the_page').css('position')=='absolute') {
    153         $('#the_page').animate({ldelim}'top': operator+ato_height});
     152      if ($('#the_page, [data-role="page"]').css('position')=='absolute') {
     153        $('#the_page, [data-role="page"]').animate({ldelim}'top': operator+ato_height});
    154154      }
    155155    }
     
    157157      $('body').css({ldelim}'margin-top': operator+ato_height});
    158158     
    159       if ($('#the_page').css('position')=='absolute') {
    160         $('#the_page').css({ldelim}'top': operator+ato_height});
     159      if ($('#the_page, [data-role="page"]').css('position')=='absolute') {
     160        $('#the_page, [data-role="page"]').css({ldelim}'top': operator+ato_height});
    161161      }
    162162    }
     
    168168      urlWS = '{$ROOT_URL}ws.php?format=json&method=';
    169169
    170   $('body').prepend($ato);
     170  $('body').prepend($ato); // ensure the bar is at the begining
     171 
     172  {if $themeconf.mobile}
     173    var $headerbar = $('div[data-role="header"] .title');
     174    if ($headerbar.length == 1) {
     175      $ato_closed.addClass('smartpocket');
     176      $ato_closed.find('a').attr({
     177        'data-iconpos':'notext',
     178        'data-role':'button'
     179      });
     180      $headerbar.prepend($ato_closed);   
     181    }
     182  {/if}
    171183
    172184  if (window.localStorage.ato_panel_open == null) {
     
    289301{if isset($ato.QUICK_EDIT)}
    290302  var $ato_edit = $('#ato_quick_edit');
    291 
    292   var bg_color = $('#the_page #content').css('background-color');
    293   if (!bg_color || bg_color=='transparent') {
    294     bg_color = $('body').css('background-color');
    295   }
    296   $ato_edit.css('background-color', bg_color);
     303 
     304 
     305  setTimeout(function() {
     306    var bg_color = 'white';
     307    var selectors = ['#the_page #content', '[data-role="page"]', 'body'];
     308   
     309    for (var i=0; i<selectors.length; i++) {
     310      var color = $(selectors[i]).css('background-color');
     311      console.log(selectors[i], color);
     312      if (color && color!='transparent') {
     313        bg_color = color;
     314        break;
     315      }
     316    }
     317
     318    $ato_edit.css('background-color', bg_color);
     319  }, 1000);
    297320
    298321  $ato_edit.find('.close-edit').on('click', function(e) {
  • extensions/AdminTools/template/style.css

    r25655 r25791  
    77#ato_header, #ato_header_closed {
    88  display:none;
     9}
     10#ato_header, #ato_header_closed:not(.smartpocket) {
    911  position:fixed;
    1012  top:0;
     
    2830  white-space:nowrap;
    2931}
    30   #ato_header_root li a, #ato_header_closed a {
     32  #ato_header_root li a, #ato_header_closed:not(.smartpocket) a {
    3133    display:inline-block;
    3234    padding:5px 10px;
     
    5456    border-right:1px solid #222;
    5557  }
    56   #ato_header_root>li a, #ato_header_closed a {
     58  #ato_header_root>li a, #ato_header_closed:not(.smartpocket) a {
    5759    color:#ddd;
    5860    text-shadow:1px 1px 0px #222;
     
    6264    text-shadow:none;
    6365  }
    64   #ato_header_root>li:not(.disabled):hover, #ato_header_closed:hover {
     66  #ato_header_root>li:not(.disabled):hover, #ato_header_closed:not(.smartpocket):hover {
    6567    background:#222;
    6668    background-image:linear-gradient(to bottom, #222, #353535);
     
    113115    }
    114116
    115 #ato_header_closed {
     117#ato_header_closed:not(.smartpocket) {
    116118  left:10px;
    117119  font-size:20px;
     
    121123  height:35px;
    122124}
    123   #ato_header_closed a {
     125  #ato_header_closed:not(.smartpocket) a {
    124126    padding:4px;
    125127  }
     128#ato_header_closed.smartpocket {
     129  float:left;
     130  margin-right:10px;
     131}
     132  #ato_header_closed.smartpocket .ui-btn-inner {
     133    display:none;
     134  }
     135
    126136#ato_header_root a.close-panel {
    127137  padding:6px 1px 4px 5px;
Note: See TracChangeset for help on using the changeset viewer.