Ignore:
Timestamp:
04/01/10 21:03:36 (10 years ago)
Author:
grum
Message:

Update the plugin for compatibility with Piwigo 2.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/AMenuManager/amm_aip.class.inc.php

    r5427 r5545  
    1919include_once(PHPWG_ROOT_PATH.'include/block.class.php'); 
    2020include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 
    21 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/ajax.class.inc.php'); 
    22 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/genericjs.class.inc.php'); 
    23 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/translate.class.inc.php'); 
     21include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCAjax.class.inc.php'); 
     22include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/genericjs.class.inc.php'); 
     23include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTranslate.class.inc.php'); 
    2424 
    2525class AMM_AIP extends AMM_root 
     
    2727  protected $google_translate; 
    2828  protected $tabsheet; 
    29   protected $ajax; 
    3029  protected $sectionsId=array('menu' => 'Menu', 'special' => 'Specials'); 
    3130 
     
    3635    parent::__construct($prefixeTable, $filelocation); 
    3736 
    38     $this->load_config(); 
    39     $this->init_events(); 
     37    $this->loadConfig(); 
     38    $this->initEvents(); 
    4039 
    4140    $this->tabsheet = new tabsheet(); 
    4241    $this->tabsheet->add('setmenu', 
    4342                          l10n('g002_setmenu'), 
    44                           $this->page_link.'&fAMM_tabsheet=setmenu'); 
     43                          $this->getAdminLink().'&fAMM_tabsheet=setmenu'); 
    4544    $this->tabsheet->add('links', 
    4645                          l10n('g002_addlinks'), 
    47                           $this->page_link.'&fAMM_tabsheet=links'); 
     46                          $this->getAdminLink().'&fAMM_tabsheet=links'); 
    4847    $this->tabsheet->add('randompict', 
    4948                          l10n('g002_randompict'), 
    50                           $this->page_link.'&fAMM_tabsheet=randompict'); 
     49                          $this->getAdminLink().'&fAMM_tabsheet=randompict'); 
    5150    $this->tabsheet->add('personnalblock', 
    5251                          l10n('g002_personnalblock'), 
    53                           $this->page_link.'&fAMM_tabsheet=personnalblock'); 
    54     $this->css = new css(dirname($this->filelocation).'/'.$this->plugin_name_files.".css"); 
    55     $this->ajax = new Ajax(); 
    56     $this->google_translate = new translate(); 
     52                          $this->getAdminLink().'&fAMM_tabsheet=personnalblock'); 
     53    $this->css = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles().".css"); 
     54    $this->google_translate = new GPCTranslate(); 
    5755  } 
    5856 
     
    8078    $template->assign($this->tabsheet->get_titlename(), "[".$selected_tab['caption']."]"); 
    8179 
    82     $template_plugin["AMM_VERSION"] = "<i>".$this->plugin_name."</i> ".l10n('g002_version').AMM_VERSION; 
     80    $template_plugin["AMM_VERSION"] = "<i>".$this->getPluginName()."</i> ".l10n('g002_version').AMM_VERSION; 
    8381    $template_plugin["AMM_PAGE"] = $_REQUEST['fAMM_tabsheet']; 
    8482    $template_plugin["PATH"] = AMM_PATH; 
     
    189187    initialize events call for the plugin 
    190188  */ 
    191   public function init_events() 
    192   { 
    193     add_event_handler('loc_end_page_header', array(&$this->css, 'apply_CSS')); 
     189  public function initEvents() 
     190  { 
     191    add_event_handler('loc_end_page_header', array(&$this->css, 'applyCSS')); 
    194192  } 
    195193 
     
    244242          break; 
    245243      } 
    246       //$template-> 
    247       $this->ajax->return_result($result); 
     244 
     245      GPCAjax::returnResult($result); 
    248246    } 
    249247  } 
     
    282280    global $template, $user; 
    283281    $template->set_filename('body_page', 
    284                             dirname($this->filelocation).'/admin/amm_linkslist.tpl'); 
     282                            dirname($this->getFileLocation()).'/admin/amm_linkslist.tpl'); 
    285283 
    286284    $tmp=$this->get_count_url(); 
     
    300298 
    301299    $template_datas=array( 
    302       'lnk_create' => $this->page_link.'&amp;fAMM_tabsheet=links&amp;action=create', 
    303       'lnk_config' => $this->page_link.'&amp;fAMM_tabsheet=links&amp;action=config', 
    304       'AMM_AJAX_URL_LIST' => $this->page_link."&ajaxfct=", 
     300      'lnk_create' => $this->getAdminLink().'&amp;fAMM_tabsheet=links&amp;action=create', 
     301      'lnk_config' => $this->getAdminLink().'&amp;fAMM_tabsheet=links&amp;action=config', 
     302      'AMM_AJAX_URL_LIST' => $this->getAdminLink()."&ajaxfct=", 
    305303      'nburl' => $tmp 
    306304    ); 
     
    317315    global $template, $user; 
    318316    $template->set_filename('body_page', 
    319                             dirname($this->filelocation).'/admin/amm_linksconfig.tpl'); 
     317                            dirname($this->getFileLocation()).'/admin/amm_linksconfig.tpl'); 
    320318 
    321319    $template_datas=array( 
    322       'lnk_list' => $this->page_link.'&amp;fAMM_tabsheet=links', 
    323       'AMM_AJAX_URL_LIST' => $this->page_link."&ajaxfct=", 
    324       'show_icons_selected' => $this->my_config['amm_links_show_icons'], 
     320      'lnk_list' => $this->getAdminLink().'&amp;fAMM_tabsheet=links', 
     321      'AMM_AJAX_URL_LIST' => $this->getAdminLink()."&ajaxfct=", 
     322      'show_icons_selected' => $this->config['amm_links_show_icons'], 
    325323      'lang_selected' => $user['language'], 
    326324      'fromlang' => substr($user['language'],0,2) 
     
    328326 
    329327    $template_datas['language_list'] = array(); 
    330     foreach($this->my_config['amm_links_title'] as $key => $val) 
     328    foreach($this->config['amm_links_title'] as $key => $val) 
    331329    { 
    332330      $template_datas['language_list'][] = array( 
     
    362360    global $template, $user; 
    363361    $template->set_filename('body_page', 
    364                             dirname($this->filelocation).'/admin/amm_linkslist_edit.tpl'); 
     362                            dirname($this->getFileLocation()).'/admin/amm_linkslist_edit.tpl'); 
    365363 
    366364    $extensions_list=array('jpg'=>0,'jpeg'=>0,'gif'=>0,'png'=>0); 
    367365    $template_icons_list=array(); 
    368     $directory=dir(dirname($this->filelocation).'/links_pictures/'); 
     366    $directory=dir(dirname($this->getFileLocation()).'/links_pictures/'); 
    369367    while($file=$directory->read()) 
    370368    { 
     
    403401    } 
    404402 
    405     $template_datas['lnk_list'] = $this->page_link.'&amp;fAMM_tabsheet=links'; 
     403    $template_datas['lnk_list'] = $this->getAdminLink().'&amp;fAMM_tabsheet=links'; 
    406404    $template_datas['icons_img'] = AMM_PATH."links_pictures/".$template_datas['icons_selected']; 
    407405    $template_datas['icons_values'] = array(); 
     
    455453  protected function action_links_modify_config() 
    456454  { 
    457     $this->my_config['amm_links_show_icons']=$_POST['famm_links_show_icons']; 
     455    $this->config['amm_links_show_icons']=$_POST['famm_links_show_icons']; 
    458456    $languages=get_languages(); 
    459457    foreach($languages as $key => $val) 
    460458    { 
    461       $this->my_config['amm_links_title'][$key]=base64_encode($_POST['famm_links_title_'.$key]); 
    462     } 
    463     $this->save_config(); 
     459      $this->config['amm_links_title'][$key]=base64_encode($_POST['famm_links_title_'.$key]); 
     460    } 
     461    $this->saveConfig(); 
    464462  } 
    465463 
     
    469467  protected function action_randompic_modify_config() 
    470468  { 
    471     $this->my_config['amm_randompicture_height']=$_POST['famm_randompicture_height']; 
    472     $this->my_config['amm_randompicture_periodicchange']=$_POST['famm_randompicture_periodicchange']; 
    473     $this->my_config['amm_randompicture_showname']=$_POST['famm_randompicture_showname']; 
    474     $this->my_config['amm_randompicture_showcomment']=$_POST['famm_randompicture_showcomment']; 
     469    $this->config['amm_randompicture_height']=$_POST['famm_randompicture_height']; 
     470    $this->config['amm_randompicture_periodicchange']=$_POST['famm_randompicture_periodicchange']; 
     471    $this->config['amm_randompicture_showname']=$_POST['famm_randompicture_showname']; 
     472    $this->config['amm_randompicture_showcomment']=$_POST['famm_randompicture_showcomment']; 
    475473    $languages=get_languages(); 
    476474    foreach($languages as $key => $val) 
    477475    { 
    478       $this->my_config['amm_randompicture_title'][$key]=base64_encode(stripslashes($_POST['famm_randompicture_title_'.$key])); 
    479     } 
    480     $this->save_config(); 
     476      $this->config['amm_randompicture_title'][$key]=base64_encode(stripslashes($_POST['famm_randompicture_title_'.$key])); 
     477    } 
     478    $this->saveConfig(); 
    481479  } 
    482480 
     
    489487  { 
    490488    global $template, $user, $page; 
    491     $template->set_filename('body_page', dirname($this->filelocation).'/admin/amm_sections.tpl'); 
     489    $template->set_filename('body_page', dirname($this->getFileLocation()).'/admin/amm_sections.tpl'); 
    492490 
    493491    if(isset($_POST['fList']) && !$this->adviser_abort()) 
     
    503501        $properties=explode("#", $items[$i]); 
    504502        $properties[0]=explode(",", $properties[0]); 
    505         $this->my_config['amm_sections_items'][$properties[0][0]]['container']=$properties[0][1]; 
    506         $this->my_config['amm_sections_items'][$properties[0][0]]['order']=$properties[0][2]; 
    507         $this->my_config['amm_sections_items'][$properties[0][0]]['visibility']=$properties[1]; 
     503        $this->config['amm_sections_items'][$properties[0][0]]['container']=$properties[0][1]; 
     504        $this->config['amm_sections_items'][$properties[0][0]]['order']=$properties[0][2]; 
     505        $this->config['amm_sections_items'][$properties[0][0]]['visibility']=$properties[1]; 
    508506      } 
    509507      $this->sortSectionsItems(); 
    510       if($this->save_config()) 
     508      if($this->saveConfig()) 
    511509      { 
    512510        array_push($page['infos'], l10n('g002_config_saved')); 
     
    518516    } 
    519517 
    520     foreach($this->my_config['amm_sections_items'] as $key=>$val) 
    521     { 
    522       $this->my_config['amm_sections_items'][$key]['visibilityForm'] = $this->makeVisibility($val['visibility'], $key); 
     518    foreach($this->config['amm_sections_items'] as $key=>$val) 
     519    { 
     520      $this->config['amm_sections_items'][$key]['visibilityForm'] = $this->makeVisibility($val['visibility'], $key); 
    523521      $this->defaultMenus[$key]['visibilityForm'] = $this->makeVisibility("guest,generic,normal,webmaster,admin/", $key); 
    524522    } 
     
    526524    $this->sortSectionsItems(); 
    527525 
    528     $users=new users(""); 
    529     $groups=new groups(""); 
     526    $users=new GPCUsers(""); 
     527    $groups=new GPCGroups(""); 
    530528 
    531529 
     
    533531    $template->assign("sections", $this->sectionsId); 
    534532    $template->assign("defaultValues", $this->defaultMenus); 
    535     $template->assign("items", $this->my_config['amm_sections_items']); 
     533    $template->assign("items", $this->config['amm_sections_items']); 
    536534    $template->assign_var_from_handle('AMM_BODY_PAGE', 'body_page'); 
    537535  } 
     
    545543    global $template, $user; 
    546544    $template->set_filename('body_page', 
    547                             dirname($this->filelocation).'/admin/amm_randompicconfig.tpl'); 
     545                            dirname($this->getFileLocation()).'/admin/amm_randompicconfig.tpl'); 
    548546 
    549547    $template_datas=array( 
    550       'lnk_list' => $this->page_link.'&amp;fAMM_tabsheet=links', 
    551       'showname_selected' => $this->my_config['amm_randompicture_showname'], 
    552       'showcomment_selected' => $this->my_config['amm_randompicture_showcomment'], 
    553       'periodic_change' => $this->my_config['amm_randompicture_periodicchange'], 
    554       'height' => $this->my_config['amm_randompicture_height'], 
     548      'lnk_list' => $this->getAdminLink().'&amp;fAMM_tabsheet=links', 
     549      'showname_selected' => $this->config['amm_randompicture_showname'], 
     550      'showcomment_selected' => $this->config['amm_randompicture_showcomment'], 
     551      'periodic_change' => $this->config['amm_randompicture_periodicchange'], 
     552      'height' => $this->config['amm_randompicture_height'], 
    555553      'lang_selected' => $user['language'], 
    556554      'fromlang' => substr($user['language'],0,2) 
     
    558556 
    559557    $template_datas['language_list'] = array(); 
    560     foreach($this->my_config['amm_randompicture_title'] as $key => $val) 
     558    foreach($this->config['amm_randompicture_title'] as $key => $val) 
    561559    { 
    562560      $template_datas['language_list'][] = array( 
     
    603601    global $template, $user; 
    604602    $template->set_filename('body_page', 
    605                             dirname($this->filelocation).'/admin/amm_personalisedlist.tpl'); 
     603                            dirname($this->getFileLocation()).'/admin/amm_personalisedlist.tpl'); 
    606604 
    607605    $sql="SELECT COUNT(DISTINCT ID) as countid FROM ".$this->tables['personalised']; 
     
    632630 
    633631    $template_datas=array( 
    634       'lnk_create' => $this->page_link.'&amp;fAMM_tabsheet=personnalblock&amp;action=create', 
    635       'AMM_AJAX_URL_LIST' => $this->page_link."&ajaxfct=", 
     632      'lnk_create' => $this->getAdminLink().'&amp;fAMM_tabsheet=personnalblock&amp;action=create', 
     633      'AMM_AJAX_URL_LIST' => $this->getAdminLink()."&ajaxfct=", 
    636634      'nbsections' => $tmp 
    637635    ); 
     
    650648    global $template, $user; 
    651649    $template->set_filename('body_page', 
    652                             dirname($this->filelocation).'/admin/amm_personalisedlist_edit.tpl'); 
     650                            dirname($this->getFileLocation()).'/admin/amm_personalisedlist_edit.tpl'); 
    653651 
    654652    $template_datas=array(); 
     
    697695    $template_datas['lang_selected'] = $user['language']; 
    698696 
    699     $template_datas['personalised_list'] = $this->page_link.'&amp;fAMM_tabsheet=personnalblock'; 
     697    $template_datas['personalised_list'] = $this->getAdminLink().'&amp;fAMM_tabsheet=personnalblock'; 
    700698    $template_datas['yesno_values'] = array('y','n'); 
    701699    $template_datas['yesno_labels'][] = l10n('g002_yesno_y'); 
     
    754752    $local_tpl = new Template(AMM_PATH."admin/", ""); 
    755753    $local_tpl->set_filename('body_page', 
    756                   dirname($this->filelocation).'/admin/amm_sections_visibility.tpl'); 
     754                  dirname($this->getFileLocation()).'/admin/amm_sections_visibility.tpl'); 
    757755 
    758756 
    759757    $parameters=explode("/", $visibility); 
    760758 
    761     $users=new users(str_replace(",", "/", $parameters[0])); 
    762     $users->set_allowed('admin', true); 
    763     $groups=new groups(str_replace(",", "/", $parameters[1])); 
     759    $users=new GPCUsers(str_replace(",", "/", $parameters[0])); 
     760    $users->setAllowed('admin', true); 
     761    $groups=new GPCGroups(str_replace(",", "/", $parameters[1])); 
    764762 
    765763    $local_tpl->assign('name', $id); 
     
    780778    if(is_adviser()) 
    781779    { 
    782       $this->display_result(l10n("g002_adviser_not_allowed"), false); 
     780      $this->displayResult(l10n("g002_adviser_not_allowed"), false); 
    783781      return(true); 
    784782    } 
     
    940938    $local_tpl = new Template(AMM_PATH."admin/", ""); 
    941939    $local_tpl->set_filename('body_page', 
    942                   dirname($this->filelocation).'/admin/amm_linkslist_detail.tpl'); 
     940                  dirname($this->getFileLocation()).'/admin/amm_linkslist_detail.tpl'); 
    943941 
    944942    $template_datas['urls']=array(); 
     
    953951        'up' =>  ($i==0)?false:true, 
    954952        'down' =>  ($i<(count($urls)-1))?true:false, 
    955         'edit' => $this->page_link.'&amp;fAMM_tabsheet=links&amp;action=modify&amp;fItem='.$urls[$i]['id'], 
     953        'edit' => $this->getAdminLink().'&amp;fAMM_tabsheet=links&amp;action=modify&amp;fItem='.$urls[$i]['id'], 
    956954        'ID' => $urls[$i]['id'], 
    957955        'IDPREV' => ($i==0)?0:$urls[$i-1]['id'], 
     
    999997    $local_tpl = new Template(AMM_PATH."admin/", ""); 
    1000998    $local_tpl->set_filename('body_page', 
    1001                   dirname($this->filelocation).'/admin/amm_personalisedlist_detail.tpl'); 
     999                  dirname($this->getFileLocation()).'/admin/amm_personalisedlist_detail.tpl'); 
    10021000 
    10031001    $template_datas['sections']=array(); 
     
    10111009        $template_datas['sections'][]=array( 
    10121010          'title' => ($val['title']!='')?$val['title']:l10n('g002_notitle'), 
    1013           'edit' => $this->page_link.'&amp;fAMM_tabsheet=personnalblock&amp;action=modify&amp;fItem='.$val['id'], 
     1011          'edit' => $this->getAdminLink().'&amp;fAMM_tabsheet=personnalblock&amp;action=modify&amp;fItem='.$val['id'], 
    10141012          'ID' => $val['id'], 
    10151013          'visible' => l10n('g002_yesno_'.$val['visible']), 
Note: See TracChangeset for help on using the changeset viewer.