Changeset 7560
- Timestamp:
- Nov 1, 2010, 10:51:58 PM (13 years ago)
- Location:
- extensions/lmt
- Files:
-
- 5 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/lmt/admin/plugin_admin.php
r5548 r7560 14 14 if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } 15 15 16 include(LMT_PATH."lmt_aip.class.inc.php");16 global $prefixeTable; 17 17 18 global $prefixeTable;19 18 20 19 load_language('plugin.lang', LMT_PATH); … … 22 21 $main_plugin_object = get_plugin_data($plugin_id); 23 22 24 $plugin_aip = new LMT_AIP($prefixeTable, $main_plugin_object->getFileLocation()); 23 24 if(CommonPlugin::checkGPCRelease(LMT_GPC_NEEDED)) 25 { 26 $config=Array(); 27 GPCCore::loadConfig('lmt', $config); 28 29 30 if($config['installed']!=LMT_VERSION2) 31 { 32 /* the plugin was updated without being deactivated 33 * deactivate + activate the plugin to process the database upgrade 34 */ 35 include(LMT_PATH."lmt_install.class.inc.php"); 36 $obj=new LMT_Install($prefixeTable, dirname(__FILE__)); 37 $obj->deactivate(); 38 $obj->activate(); 39 $template->delete_compiled_templates(); 40 //$config['newInstall']='n'; 41 } 42 43 include(LMT_PATH."lmt_aip.class.inc.php"); 44 $plugin_aip = new LMT_AIP($prefixeTable, $main_plugin_object->getFileLocation()); 45 } 46 else 47 { 48 /* 49 * plugin was upgraded, but GPC was not 50 * display a page to inform user to upgrade GPC 51 */ 52 include(LMT_PATH."lmt_aip_release.class.inc.php"); 53 $plugin_aip = new LMT_AIPRelease($prefixeTable, $main_plugin_object->getFileLocation()); 54 } 55 56 57 58 25 59 $plugin_aip->manage(); 60 26 61 ?> -
extensions/lmt/admin/plugin_admin_list.tpl
r6701 r7560 3 3 function loadpage(pagenum) 4 4 { 5 $("#list").html("< br><img src='./plugins/GrumPluginClasses/icons/processing.gif'>");5 $("#list").html("<div style='margin:20px auto;text-align:center;'><img src='./plugins/GrumPluginClasses/icons/processing.gif'></div>"); 6 6 7 7 $.ajax( 8 8 { 9 9 type: "POST", 10 data s:10 data: 11 11 { 12 ajaxfct:'admin.img.list', 13 numPage:pagenum, 12 14 filter:$("#filter").val() 13 15 }, 14 url: "{/literal}{$datas.LMT_AJAX_URL_LIST}{literal}" +pagenum,16 url: "{/literal}{$datas.LMT_AJAX_URL_LIST}{literal}", 15 17 async: true, 16 18 success: function(msg) -
extensions/lmt/admin/plugin_admin_manage.tpl
r6701 r7560 10 10 function loadpage(pagenum) 11 11 { 12 $("#list").html("< br><img src='./plugins/GrumPluginClasses/icons/processing.gif'>");12 $("#list").html("<div style='margin:20px auto;text-align:center;'><img src='./plugins/GrumPluginClasses/icons/processing.gif'></div>"); 13 13 14 14 $.ajax( 15 15 { 16 16 type: "POST", 17 url: "{/literal}{$datas.LMT_AJAX_URL_LIST}{literal}"+pagenum, 17 data: 18 { 19 ajaxfct:'admin.manage.list', 20 numPage:pagenum 21 }, 22 url: "{/literal}{$datas.LMT_AJAX_URL_LIST}{literal}", 18 23 async: true, 19 24 success: function (msg) -
extensions/lmt/admin/plugin_admin_manageaut.tpl
r3396 r7560 4 4 5 5 function init() { 6 $("tr").filter(".TableRow ").bind("mouseover",6 $("tr").filter(".TableRow_{/literal}{$themeconf.name}{literal}").bind("mouseover", 7 7 function (event) { 8 8 {/literal} … … 16 16 {literal} 17 17 $("#iexample").attr("innerHTML", txt); 18 } 18 } 19 19 ); 20 20 21 $("tr").filter(".TableRow ").bind("mouseout",21 $("tr").filter(".TableRow_{/literal}{$themeconf.name}{literal}").bind("mouseout", 22 22 function (event) { 23 23 // $("#iexample").attr("innerHTML", ""); 24 } 24 } 25 25 ); 26 26 } … … 52 52 </tr> 53 53 {foreach from=$datas.author_list key=name item=data} 54 <tr class="TableRow ">54 <tr class="TableRow_{$themeconf.name}"> 55 55 <td>{$data.id}</td> 56 56 <td>{$data.text1}</td> -
extensions/lmt/language/de_DE/plugin.lang.php
r5872 r7560 156 156 157 157 158 /* 159 * need to be translated 160 * 161 * thanks ! :-) 162 */ 163 164 // 1.2.0 165 $lang['To install this plugin, you need to install Grum Plugin Classes %s before'] = 'To install this plugin, you need to install Grum Plugin Classes %s before'; 166 167 // 1.3.0 168 $lang['lmt_add_licence_type'] = "Add a licence type"; 169 $lang['lmt_choose_licence_type'] = "Choose licence type"; 170 $lang['lmt_search'] = "Search"; 171 $lang['lmt_search_by_licence'] = "Search photos under licence"; 172 $lang['lmt_licence_type']="Licence type"; 173 $lang['lmt_ok']="Ok"; 174 $lang['lmt_search_pictures_with_licence_1']="Search photos under licence:"; 175 $lang['lmt_search_pictures_with_licence_n']="Search photos under one of theses licences:"; 176 $lang['lmt_error_num_items']="At least, one licence must be selected"; 177 178 179 158 180 ?> -
extensions/lmt/language/en_UK/plugin.lang.php
r6701 r7560 1 1 <?php 2 3 /* -----------------------------------------------------------------------------4 This file was created by 'Translator r2.0.0-beta' plugin5 6 **** Export informations7 Export date : 2009-04-30 22:59:498 Number of items : 1499 Number exported : 14910 Exported by : grum11 12 **** File informations13 Language : English [ISO en_UK]14 Charset : utf-815 Type : plugin16 Name (Release) : lmt (2.0.0-beta)17 18 **** Export options19 Items exported : "ok"20 Translator export : NO21 ----------------------------------------------------------------------------- */22 23 2 24 3 $lang['example'] = 'Display sample'; … … 176 155 $lang["lmt_cfg_warning_target"] = "Force the page openning in a new window"; 177 156 157 // 1.2.0 158 $lang['To install this plugin, you need to install Grum Plugin Classes %s before'] = 'To install this plugin, you need to install Grum Plugin Classes %s before'; 159 160 // 1.3.0 161 $lang['lmt_add_licence_type'] = "Add a licence type"; 162 $lang['lmt_choose_licence_type'] = "Choose licence type"; 163 $lang['lmt_search'] = "Search"; 164 $lang['lmt_search_by_licence'] = "Search photos under licence"; 165 $lang['lmt_licence_type']="Licence type"; 166 $lang['lmt_ok']="Ok"; 167 $lang['lmt_search_pictures_with_licence_1']="Search photos under licence:"; 168 $lang['lmt_search_pictures_with_licence_n']="Search photos under one of theses licences:"; 169 $lang['lmt_error_num_items']="At least, one licence must be selected"; 178 170 179 171 ?> -
extensions/lmt/language/es_ES/plugin.lang.php
r6701 r7560 182 182 $lang["lmt_cfg_warning_target"] = "Forzar la apertura en una nueva ventana" 183 183 184 184 /* 185 * need to be translated 186 * 187 * thanks ! :-) 188 */ 189 190 // 1.2.0 191 $lang['To install this plugin, you need to install Grum Plugin Classes %s before'] = 'To install this plugin, you need to install Grum Plugin Classes %s before'; 192 193 // 1.3.0 194 $lang['lmt_add_licence_type'] = "Add a licence type"; 195 $lang['lmt_choose_licence_type'] = "Choose licence type"; 196 $lang['lmt_search'] = "Search"; 197 $lang['lmt_search_by_licence'] = "Search photos under licence"; 198 $lang['lmt_licence_type']="Licence type"; 199 $lang['lmt_ok']="Ok"; 200 $lang['lmt_search_pictures_with_licence_1']="Search photos under licence:"; 201 $lang['lmt_search_pictures_with_licence_n']="Search photos under one of theses licences:"; 202 $lang['lmt_error_num_items']="At least, one licence must be selected"; 185 203 186 204 ?> -
extensions/lmt/language/fr_FR/plugin.lang.php
r5548 r7560 186 186 187 187 188 // 1.3.0 189 $lang['lmt_add_licence_type'] = "Ajouter un type de licence"; 190 $lang['lmt_choose_licence_type'] = "Sélectionner le type de licence"; 191 $lang['lmt_search'] = "Rechercher"; 192 $lang['lmt_search_by_licence'] = "Rechercher des photos en fonction de leur licence"; 193 $lang['lmt_licence_type']="Type de licence"; 194 $lang['lmt_ok']="Ok"; 195 $lang['lmt_search_pictures_with_licence_1']="Rechercher les photos sous licence :"; 196 $lang['lmt_search_pictures_with_licence_n']="Rechercher les photos sous l'une des licences suivantes :"; 197 $lang['lmt_error_num_items']="Au moins une licence doit être sélectionnée"; 198 188 199 ?> -
extensions/lmt/lmt_aip.class.inc.php
r6703 r7560 17 17 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTranslate.class.inc.php'); 18 18 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php'); 19 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php'); 19 20 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/genericjs.class.inc.php'); 20 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCPagesNavigation.class.inc.php');21 21 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 22 22 23 23 class LMT_AIP extends LMT_root 24 24 { 25 protected $google_translate;26 25 protected $tabsheet; 27 26 … … 42 41 l10n('lmt_manageaut'), 43 42 $this->getAdminLink()."&f_tabsheet=manageaut"); 43 $this->tabsheet->add('search', 44 l10n('lmt_search'), 45 $this->getAdminLink()."&f_tabsheet=search"); 44 46 $this->tabsheet->add('config', 45 47 l10n('lmt_config'), … … 48 50 l10n('lmt_help'), 49 51 $this->getAdminLink()."&f_tabsheet=help"); 50 51 52 // don't create the google_translate object everytime, otherwise google's js53 // code is always included in the header even if translation functionalities54 // aren't needed55 // translation is needed only if we are in a ajax request56 /*if((isset($_POST['fmypolls_gomodify_translation'])||isset($_POST['fmypolls_goadd_translation'])))57 {58 $this->google_translate = new GPCTranslate();59 }60 */61 52 } 62 53 63 54 public function __destruct() 64 55 { 65 unset($this->google_translate);66 56 unset($this->tabsheet); 67 57 parent::__destruct(); … … 74 64 { 75 65 parent::initEvents(); 66 67 if(isset($_REQUEST['f_tabsheet']) and $_REQUEST['f_tabsheet']=='search') 68 { 69 // load request builder JS only on the search page 70 GPCRequestBuilder::loadJSandCSS(); 71 } 72 76 73 add_event_handler('loc_end_page_header', array(&$this->css, 'applyCSS')); 77 74 add_event_handler('loc_end_page_header', array(&$this->css_icn, 'applyCSS')); 75 76 GPCCss::applyGpcCss(); 78 77 } 79 78 … … 84 83 { 85 84 global $template; 86 87 $this->return_ajax_content();88 85 89 86 $template->set_filename('plugin_admin_content', dirname(__FILE__)."/admin/lmt_admin.tpl"); … … 108 105 $this->display_managedoc_page(); 109 106 break; 107 case 'search': 108 $this->displaySearch(); 109 break; 110 110 case 'help': 111 111 $this->display_help_page(); … … 127 127 $template->assign('plugin', $template_plugin); 128 128 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 129 }130 131 132 /*133 return ajax content134 */135 protected function return_ajax_content()136 {137 global $ajax, $template;138 139 if(isset($_REQUEST['ajaxfct']))140 {141 //$this->debug("AJAXFCT:".$_REQUEST['ajaxfct']);142 $result="<p class='errors'>An error has occured</p>";143 switch($_REQUEST['ajaxfct'])144 {145 case 'img_list':146 $result=$this->ajax_img_list($_REQUEST['numpage']);147 break;148 case 'manage_list':149 $result=$this->ajax_manage_list($_REQUEST['numpage']);150 break;151 }152 GPCAjax::returnResult($result);153 }154 129 } 155 130 … … 233 208 234 209 $datas=array( 235 "LMT_AJAX_URL_LIST" => $this->getAdminLink( ).'&ajaxfct=img_list&numpage='210 "LMT_AJAX_URL_LIST" => $this->getAdminLink('ajax') 236 211 ); 237 212 238 213 $filter_list_selected = ''; 239 $filter_list_values = array_slice( $this->licences,0,count($this->licences)-1);214 $filter_list_values = array_slice(LMT_root::$licences,0,count(LMT_root::$licences)-1); 240 215 $filter_list_labels = array(); 241 216 foreach($filter_list_values as $key=>$val) … … 369 344 370 345 $datas=array( 371 "LMT_AJAX_URL_LIST" => $this->getAdminLink( ).'&ajaxfct=manage_list&numpage='346 "LMT_AJAX_URL_LIST" => $this->getAdminLink('ajax') 372 347 ); 373 348 … … 395 370 396 371 $licences_list_values = array(); 397 $licences_list_values = $this->licences;372 $licences_list_values = self::$licences; 398 373 $licences_list_labels = array(); 399 374 foreach($licences_list_values as $key=>$val) … … 459 434 460 435 $datas['lmt_redirect_urls']=array(); 461 $lmt_licence_default_values = array_slice( $this->licences,0,count($this->licences)-1);436 $lmt_licence_default_values = array_slice(self::$licences,0,count(self::$licences)-1); 462 437 $lmt_licence_default_labels = array(); 463 438 … … 540 515 541 516 517 /** 518 * display the search page 519 * 520 */ 521 protected function displaySearch() 522 { 523 global $template; 524 525 $template->set_filename('body_page', 526 dirname($this->getFileLocation()).'/admin/lmt_search.tpl'); 527 528 $template->assign('lmt_search_page', GPCRequestBuilder::displaySearchPage($this->getPluginName())); 529 530 $template->assign_var_from_handle('LMT_BODY_PAGE', 'body_page'); 531 } 532 533 542 534 543 535 /* … … 555 547 $_REQUEST['id']=""; 556 548 } 557 558 549 559 550 /* ------------------------------------------------------------------------ … … 780 771 dirname($this->getFileLocation()).'/admin/lmt_js.tpl'); 781 772 782 $lmt_licence_default_values=array_slice( $this->licences,0,count($this->licences)-1);773 $lmt_licence_default_values=array_slice(self::$licences,0,count(self::$licences)-1); 783 774 $datas['shortlicencetext']=array(); 784 775 foreach($lmt_licence_default_values as $key=>$val) … … 795 786 } 796 787 797 protected function make_image_data($tmp, $imageId)798 {799 $tmp2=array();800 foreach($tmp['id'] as $key=>$val)801 {802 $tmp2[]=array(803 'id' => $tmp['id'][$key],804 'name' => $tmp['name'][$key],805 'type' => $tmp['type'][$key],806 'plinks' => $tmp['plinks'][$key],807 'link'=> make_picture_url(808 array(809 'image_id' => $imageId,810 'category' => array811 (812 'id' => $tmp['id'][$key],813 'name' => $tmp['name'][$key],814 'permalink' => $tmp['plinks'][$key]815 )816 )817 )818 );819 }820 return($tmp2);821 }822 788 823 789 /* --------------------------------------------------------------------------- … … 826 792 827 793 828 829 830 831 /* ---------------------------------------------------------------------------832 ajax functions833 --------------------------------------------------------------------------- */834 835 protected function ajax_img_list($pagenum)836 {837 global $conf;838 839 $local_tpl = new Template(LMT_PATH."admin/", "");840 $local_tpl->set_filename('body_page',841 dirname($this->getFileLocation()).'/admin/plugin_admin_listitems.tpl');842 843 if(!isset($_REQUEST['filter']) ||844 !($_REQUEST['filter']=="BY" ||845 $_REQUEST['filter']=="BY-SA" ||846 $_REQUEST['filter']=="BY-ND" ||847 $_REQUEST['filter']=="BY-NC-ND" ||848 $_REQUEST['filter']=="BY-NC-SA" ||849 $_REQUEST['filter']=="BY-NC" ||850 $_REQUEST['filter']=="CRIGHT" ||851 $_REQUEST['filter']=="CLEFT"852 ))853 {854 $_REQUEST['filter']='';855 }856 857 $img_ids=array();858 $img_liste = array();859 $sql="SELECT SQL_CALC_FOUND_ROWS lmti.*, img.file, img.path, img.tn_ext,860 GROUP_CONCAT(cat.id) AS catid,861 GROUP_CONCAT(CASE WHEN cat.name IS NULL THEN '' ELSE cat.name END SEPARATOR '@sep@') AS catname,862 GROUP_CONCAT(CASE WHEN cat.permalink IS NULL THEN '' ELSE cat.permalink END SEPARATOR '@sep@') AS catpermalink,863 GROUP_CONCAT(CASE WHEN cat.dir IS NULL THEN 'V' ELSE 'P' END) AS cattype,864 lmtla.text1, lmtla.text2865 FROM ".$this->tables["images"]." lmti866 LEFT OUTER JOIN ".$this->tables["licence_author"]." lmtla ON lmtla.id = lmti.author_id,867 ".IMAGES_TABLE." img868 LEFT OUTER JOIN ".IMAGE_CATEGORY_TABLE." imgcat ON img.id = imgcat.image_id869 LEFT OUTER JOIN ".CATEGORIES_TABLE." cat ON imgcat.category_id = cat.id870 WHERE lmti.image_id = img.id ";871 if($_REQUEST['filter']!="")872 {873 $sql.=" AND lmti.licence_type='".$_REQUEST['filter']."'";874 }875 876 $sql.=" GROUP BY lmti.image_id ORDER BY cat.id, img.id ";877 878 if($this->config['lmt_list_maxitems']>0)879 {880 $refdbt = ($pagenum-1)*$this->config['lmt_list_maxitems'];881 $sql.=" LIMIT ".$refdbt.", ".$this->config['lmt_list_maxitems'];882 }883 884 $result=pwg_query($sql);885 if($result)886 {887 while($row = pwg_db_fetch_assoc($result))888 {889 $filenfo = pathinfo($row['path']);890 preg_match("/(.*)\./i", $filenfo["basename"], $tmp);891 $filenfo['filename'] = $tmp[1];892 893 $tmp=array(894 'id'=>explode(',',$row['catid']),895 'name'=>explode('@sep@',$row['catname']),896 'type'=>explode(',',$row['cattype']),897 'plinks'=>explode('@sep@',$row['catpermalink']),898 'link'=>array()899 );900 $tmpcat=$this->make_image_data($tmp, $row['image_id']);901 902 $img_ids[]=$row['image_id'];903 $img_liste[]=array(904 'id' => $row['image_id'],905 'licence' => ($row['licence_type']=="CRIGHT")?l10n("lmt_lbl_cc_s-".strtolower($row['licence_type'])):"",906 'licencei' => LMT_PATH."img/".strtolower($row['licence_type'])."_80x15.png",907 'aut_text1' => $row['text1'],908 'aut_text2' => $row['text2'],909 'file' => $row['file'],910 'cat' => $tmpcat,911 'thumb' => $filenfo["dirname"]."/thumbnail/".$conf["prefix_thumbnail"].$filenfo["filename"].".".$row["tn_ext"]912 );913 }914 }915 916 $sql="select FOUND_ROWS()";917 $result=pwg_query($sql);918 $nb=pwg_db_fetch_row($result);919 920 $GPCPagesNavigation = new GPCPagesNavigation();921 $GPCPagesNavigation->setNbItems($nb[0]);922 $GPCPagesNavigation->setNbItemsPerPage($this->config['lmt_list_maxitems']);923 $GPCPagesNavigation->setCurrentPage($pagenum);924 $GPCPagesNavigation->setOptions(array(925 "text_prev" => l10n("lmt_nav_prev"),926 "text_next" => l10n("lmt_nav_next"),927 "text_first" => l10n("lmt_nav_first"),928 "text_last" => l10n("lmt_nav_last")929 ));930 $navbar=$GPCPagesNavigation->makeNavigation("loadpage");931 if($navbar!="")932 {933 $navbar=", ".$navbar;934 }935 936 $local_tpl->assign('imgliste', $img_liste);937 return($nb[0]." ".l10n("lmt_lst_nb_photos").$navbar."#".$local_tpl->parse('body_page', true));938 }939 940 protected function ajax_manage_list($pagenum)941 {942 global $conf, $user;943 944 $local_tpl = new Template(LMT_PATH."admin/", "");945 $local_tpl->set_filename('body_page',946 dirname($this->getFileLocation()).'/admin/plugin_admin_manageitems.tpl');947 948 if(!isset($_REQUEST['select']))949 {950 $_REQUEST['select']="caddie";951 }952 953 $img_liste = array();954 $sql="SELECT SQL_CALC_FOUND_ROWS img.id as image_id, img.file, img.path, img.tn_ext,955 GROUP_CONCAT(cat.id) AS catid,956 GROUP_CONCAT(CASE WHEN cat.name IS NULL THEN '' ELSE cat.name END SEPARATOR '@sep@') AS catname,957 GROUP_CONCAT(CASE WHEN cat.permalink IS NULL THEN '' ELSE cat.permalink END SEPARATOR '@sep@') AS catpermalink,958 GROUP_CONCAT(CASE WHEN cat.dir IS NULL THEN 'V' ELSE 'P' END) AS cattype,959 lmti.licence_type, lmtla.text1, lmtla.text2960 FROM ".CADDIE_TABLE." caddie,961 (".IMAGES_TABLE." img962 LEFT OUTER JOIN ".IMAGE_CATEGORY_TABLE." imgcat ON img.id = imgcat.image_id963 LEFT OUTER JOIN ".CATEGORIES_TABLE." cat ON imgcat.category_id = cat.id)964 LEFT OUTER JOIN ".$this->tables["images"]." AS lmti ON img.id = lmti.image_id965 LEFT OUTER JOIN ".$this->tables["licence_author"]." lmtla ON lmtla.id = lmti.author_id966 WHERE img.id = caddie.element_id967 AND caddie.user_id = '".$user['id']."'968 GROUP BY img.id969 ORDER BY cat.id, img.id ";970 971 if($this->config['lmt_list_maxitems']>0)972 {973 $refdbt = ($pagenum-1)*$this->config['lmt_list_maxitems'];974 $sql.=" LIMIT ".$refdbt.", ".$this->config['lmt_list_maxitems'];975 }976 977 $result=pwg_query($sql);978 979 if($result)980 {981 while($row = pwg_db_fetch_assoc($result))982 {983 $filenfo = pathinfo($row['path']);984 preg_match("/(.*)\./i", $filenfo["basename"], $tmp);985 $filenfo['filename'] = $tmp[1];986 987 $tmp=array(988 'id'=>explode(',',$row['catid']),989 'name'=>explode('@sep@',$row['catname']),990 'type'=>explode(',',$row['cattype']),991 'plinks'=>explode('@sep@',$row['catpermalink']),992 'link'=>array()993 );994 $tmpcat=$this->make_image_data($tmp, $row['image_id']);995 996 $img_liste[]=array(997 'id' => $row['image_id'],998 'licence' => ($row['licence_type']=="")?"DEFAULT":$row['licence_type'],999 'licencei' => ($row['licence_type']=="")?"":LMT_PATH."img/".strtolower($row['licence_type'])."_80x15.png",1000 'aut_text1' => $row['text1'],1001 'aut_text2' => $row['text2'],1002 'file' => $row['file'],1003 'cat' => $tmpcat,1004 'thumb' => $filenfo["dirname"]."/thumbnail/".$conf["prefix_thumbnail"].$filenfo["filename"].".".$row["tn_ext"]1005 );1006 }1007 }1008 1009 $sql="select FOUND_ROWS()";1010 $result=pwg_query($sql);1011 $nb=pwg_db_fetch_row($result);1012 1013 $GPCPagesNavigation = new GPCPagesNavigation();1014 $GPCPagesNavigation->setNbItems($nb[0]);1015 $GPCPagesNavigation->setNbItemsPerPage($this->config['lmt_list_maxitems']);1016 $GPCPagesNavigation->setCurrentPage($pagenum);1017 $GPCPagesNavigation->setOptions(array(1018 "text_prev" => l10n("lmt_nav_prev"),1019 "text_next" => l10n("lmt_nav_next"),1020 "text_first" => l10n("lmt_nav_first"),1021 "text_last" => l10n("lmt_nav_last")1022 ));1023 $navbar=$GPCPagesNavigation->makeNavigation("loadpage");1024 if($navbar!="")1025 {1026 $navbar=", ".$navbar;1027 }1028 1029 $local_tpl->assign('imgliste', $img_liste);1030 return($nb[0]." ".l10n("lmt_lst_nb_photos").$navbar."#".$local_tpl->parse('body_page', true));1031 }1032 1033 794 } //class 1034 795 -
extensions/lmt/lmt_install.class.inc.php
r5548 r7560 28 28 parent::__construct($prefixeTable, $filelocation); 29 29 $this->tablef= new GPCTables($this->tables); 30 $this->exportfile=dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles().'.sql';31 30 } 32 31 … … 71 70 ); 72 71 73 //if present, try to import backup 74 //if backup file 75 $import=$this->tablef->import($this->exportfile); 76 if($import['errors']<0) 77 { 78 $result=$this->tablef->create($tables_def); 79 return($result); 80 } 81 else 82 { 83 return(true); 84 } 72 $result=$this->tablef->create($tables_def); 73 GPCCore::register($this->getPluginName(), LMT_VERSION, LMT_GPC_NEEDED); 74 75 return($result); 85 76 } 86 87 77 88 78 /* … … 91 81 public function uninstall() 92 82 { 93 $this->tablef->export($this->exportfile);94 83 $this->deleteConfig(); 95 84 $this->tablef->drop(); 85 GPCCore::unregister($this->getPluginName()); 96 86 return(''); 97 87 } … … 105 95 $this->config['installed']=LMT_VERSION2; 106 96 $this->saveConfig(); 97 98 GPCCore::register($this->getPluginName(), LMT_VERSION, LMT_GPC_NEEDED); 99 GPCRequestBuilder::register($this->getPluginName(), dirname($this->getFileLocation()).'/lmt_rb_callback.class.inc.php'); 107 100 return(''); 108 101 } … … 110 103 public function deactivate() 111 104 { 105 GPCRequestBuilder::unregister($this->getPluginName()); 112 106 } 113 114 107 } //class 115 108 -
extensions/lmt/lmt_pip.class.inc.php
r6701 r7560 17 17 //include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCPublicIntegration.class.inc.php'); 18 18 19 load_language('plugin.lang', LMT_PATH); 20 19 21 class LMT_PIP extends LMT_root 20 22 { … … 27 29 28 30 $this->initEvents(); 29 $this->load_lang();30 31 } 31 32 … … 36 37 } 37 38 38 /* 39 load language file 40 */ 41 public function load_lang() 42 { 43 global $lang; 44 45 load_language('plugin.lang', LMT_PATH); 46 47 // ajax is managed here ; this permit to use user&language properties inside 48 // ajax content 49 //$this->return_ajax_content(); 50 } 51 52 /* 53 initialize events call for the plugin 54 */ 39 /** 40 * initialize events call for the plugin 41 */ 55 42 public function initEvents() 56 43 { 57 44 parent::initEvents(); 58 /* 59 add_event_handler('blockmanager_apply', array(&$this, 'blockmanager_apply') ); 60 add_event_handler('loading_lang', array(&$this, 'load_lang')); 61 */ 45 62 46 if($this->config['lmt_licence_activated']=='y') 63 47 { 64 48 add_event_handler('loc_end_page_header', array(&$this->css_icn, 'applyCSS')); 65 add_event_handler('loc_end_picture', array(&$this, 'manage _licence_element'));49 add_event_handler('loc_end_picture', array(&$this, 'manageLicenceElement')); 66 50 67 51 if($this->config['lmt_warning_visible']=='y') 68 52 { 69 add_event_handler('loc_end_page_tail', array(&$this, 'manage _warning_text'));53 add_event_handler('loc_end_page_tail', array(&$this, 'manageWarningText')); 70 54 } 71 55 } … … 77 61 FUNCTIONS TO MANAGE LMT DISPLAY 78 62 ------------------------------------------------------------------------- */ 79 public function manage _licence_element()63 public function manageLicenceElement() 80 64 { 81 65 global $template, $page, $user; 82 66 83 $licence=$this->get _image_licence($page['image_id']);67 $licence=$this->getImageLicence($page['image_id']); 84 68 if($licence['licence']=="") 85 69 { … … 148 132 } 149 133 150 public function manage _warning_text()134 public function manageWarningText() 151 135 { 152 136 global $template, $user; … … 198 182 199 183 200 /* ---------------------------------------------------------------------------201 ajax functions202 --------------------------------------------------------------------------- */203 204 184 } //class 205 185 -
extensions/lmt/lmt_root.class.inc.php
r5548 r7560 13 13 14 14 --------------------------------------------------------------------------- */ 15 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); 16 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCss.class.inc.php'); 17 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCAjax.class.inc.php'); 18 19 class LMT_root extends CommonPlugin 20 { 21 protected $css; //the css object 22 protected $css_icn; //the css object 23 24 protected $licences=array('BY', 'BY-ND', 'BY-NC', 'BY-NC-ND', 'BY-NC-SA', 'BY-SA', 'CRIGHT', 'CLEFT', 'DEFAULT'); 25 26 public function __construct($prefixeTable, $filelocation) 27 { 28 $this->setPluginName('LMT'); 29 $this->setPluginNameFiles("lmt"); 30 parent::__construct($prefixeTable, $filelocation); 31 $this->section_name=$this->getPluginNameFiles(); 32 33 $this->setTablesList(array('images', 'licence_author')); 34 35 36 $this->css = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles().".css"); 37 $this->css_icn = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles()."_icn.css"); 38 } 39 40 public function __destruct() 41 { 42 unset($this->css); 43 unset($this->css_icn); 44 unset($this->licences); 45 parent::__destruct(); 46 } 47 48 public function initEvents() 49 { 50 add_event_handler('blockmanager_register_blocks', array(&$this, 'register_blocks') ); 51 } 52 53 /* 54 menu block management 55 */ 56 public function register_blocks() 57 { 58 } 59 60 61 62 /* 63 surchage of CommonPlugin->saveConfig function 64 */ 65 public function saveConfig() 66 { 67 if(parent::saveConfig()) 15 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); 16 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCss.class.inc.php'); 17 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCAjax.class.inc.php'); 18 19 class LMT_root extends CommonPlugin 20 { 21 protected $css; //the css object 22 protected $css_icn; //the css object 23 24 static public $licences=array('BY', 'BY-ND', 'BY-NC', 'BY-NC-ND', 'BY-NC-SA', 'BY-SA', 'CRIGHT', 'CLEFT', 'DEFAULT'); 25 26 /** 27 * constructor 28 */ 29 public function __construct($prefixeTable, $filelocation) 30 { 31 $this->setPluginName('LMT'); 32 $this->setPluginNameFiles("lmt"); 33 parent::__construct($prefixeTable, $filelocation); 34 $this->section_name=$this->getPluginNameFiles(); 35 36 $this->setTablesList(array('images', 'licence_author')); 37 38 $this->css = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles().".css"); 39 $this->css_icn = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles()."_icn.css"); 40 } 41 42 /** 43 * destructor 44 */ 45 public function __destruct() 46 { 47 unset($this->css); 48 unset($this->css_icn); 49 parent::__destruct(); 50 } 51 52 public function initEvents() 53 { 54 add_event_handler('blockmanager_register_blocks', array(&$this, 'register_blocks') ); 55 } 56 57 /** 58 * menu block management 59 */ 60 public function register_blocks() 61 { 62 } 63 64 65 /** 66 * initialize default values for config var 67 */ 68 public function initConfig() 69 { 70 //global $user; 71 $this->config=array( 72 'lmt_list_maxheight' => '650', 73 'lmt_list_maxitems' => '0', /* limit number of item displayed ; 0 : no limit */ 74 'lmt_licence_default' => 'BY', 75 'lmt_licence_default_author' => 0, 76 'lmt_licence_activated' => 'n', 77 'lmt_licence_visible' => 'n', /* y:always visible, n:only if needed */ 78 'lmt_licence_logo' => '80x15', /* 80x15, 88x31, text */ 79 'lmt_warning_visible' => 'y', /* y: display a text at the bottom of each page */ 80 'lmt_warning_texts' => array(), /* text displayed - multi lang */ 81 'lmt_redirect_activated' => 'y', /* y: the text is an url to a warning page */ 82 'lmt_redirect_open_target' => 'n', /* y: url are openned in a new page/tab */ 83 'lmt_redirect_url-by' => array(), 84 'lmt_redirect_url-by-nd' => array(), 85 'lmt_redirect_url-by-nc' => array(), 86 'lmt_redirect_url-by-nc-nd' => array(), 87 'lmt_redirect_url-by-nc-sa' => array(), 88 'lmt_redirect_url-by-sa' => array(), 89 'lmt_redirect_url-cright' => array(), 90 'lmt_redirect_url-cleft' => array(), 91 ); 92 93 $languages=get_languages(); 94 foreach($languages as $key => $val) 95 { 96 $lang=substr($key,0,2)."/"; 97 if($lang=="en/") { $lang=""; } 98 $this->config['lmt_warning_texts'][$key]=''; 99 $this->config['lmt_redirect_url-by'][$key]='http://creativecommons.org/licenses/by/2.0/'.$lang; 100 $this->config['lmt_redirect_url-by-nd'][$key]='http://creativecommons.org/licenses/by-nd/2.0/'.$lang; 101 $this->config['lmt_redirect_url-by-nc'][$key]='http://creativecommons.org/licenses/by-nc/2.0/'.$lang; 102 $this->config['lmt_redirect_url-by-nc-nd'][$key]='http://creativecommons.org/licenses/by-nc-nd/2.0/'.$lang; 103 $this->config['lmt_redirect_url-by-nc-sa'][$key]='http://creativecommons.org/licenses/by-nc-sa/2.0/'.$lang; 104 $this->config['lmt_redirect_url-by-sa'][$key]='http://creativecommons.org/licenses/by-sa/2.0/'.$lang; 105 $this->config['lmt_redirect_url-cright'][$key]=''; 106 $this->config['lmt_redirect_url-cleft'][$key]=''; 107 } 108 } 109 110 /** 111 * returns the admin page link 112 */ 113 public function getAdminLink($mode='') 114 { 115 if($mode=='ajax') 116 { 117 return('plugins/'.basename(dirname($this->getFileLocation())).'/lmt_ajax.php'); 118 } 119 else 120 { 121 return(parent::getAdminLink()); 122 } 123 } 124 125 126 /** 127 * return the licence type for an image 128 * 129 * returned array 130 * 'default' => 'y' => if no licence for the picture, return de default 131 * licence 132 * 'n' => if no licence for the picture, return empty values 133 * 'licence' => the licence type 134 * 'aut_text1' => author, text 1 135 * 'aut_text2' => author, text 2 136 * 137 * @param Integer $image_id : the image id 138 * @return Array 139 */ 140 public function getImageLicence($image_id) 141 { 142 143 $return=array( 144 "default" => "", 145 "licence" => "", 146 "aut_text1" => "", 147 "aut_text2" => "" 148 ); 149 $sql="SELECT lmti.licence_type, lmta.text1, lmta.text2 150 FROM ".$this->tables['images']." lmti 151 LEFT OUTER JOIN ".$this->tables['licence_author']." lmta ON lmti.author_id = lmta.id 152 WHERE lmti.image_id = '".$image_id."'"; 153 $result=pwg_query($sql); 154 if($result) 155 { 156 while($row=pwg_db_fetch_assoc($result)) 68 157 { 69 $this->css->makeCSS($this->generate_CSS()); 70 $this->css_icn->makeCSS($this->generate_CSS2()); 71 return(true); 158 $return=array( 159 "defaut" => "n", 160 "licence" => $row['licence_type'], 161 "aut_text1" => $row['text1'], 162 "aut_text2" => $row['text2'] 163 ); 72 164 } 73 return(false); 74 } 75 76 /* 77 surchage of CommonPlugin->saveConfig function 78 */ 79 public function loadConfig() 80 { 81 parent::loadConfig(); 82 if(!$this->css->fileExists()) 83 { 84 $this->css->makeCSS($this->generate_CSS()); 85 } 86 if(!$this->css_icn->fileExists()) 87 { 88 $this->css_icn->makeCSS($this->generate_CSS2()); 89 } 90 } 91 92 /* 93 intialize default values 94 */ 95 public function initConfig() 96 { 97 //global $user; 98 $this->config=array( 99 'lmt_mouseovercolor' => '303030', /**/ 100 'lmt_list_maxheight' => '650', 101 'lmt_list_maxitems' => '0', /* limit number of item displayed ; 0 : no limit */ 102 'lmt_licence_default' => 'BY', 103 'lmt_licence_default_author' => 0, 104 'lmt_licence_activated' => 'n', 105 'lmt_licence_visible' => 'n', /* y:always visible, n:only if needed */ 106 'lmt_licence_logo' => '80x15', /* 80x15, 88x31, text */ 107 'lmt_warning_visible' => 'y', /* y: display a text at the bottom of each page */ 108 'lmt_warning_texts' => array(), /* text displayed - multi lang */ 109 'lmt_redirect_activated' => 'y', /* y: the text is an url to a warning page */ 110 'lmt_redirect_open_target' => 'n', /* y: url are openned in a new page/tab */ 111 'lmt_redirect_url-by' => array(), 112 'lmt_redirect_url-by-nd' => array(), 113 'lmt_redirect_url-by-nc' => array(), 114 'lmt_redirect_url-by-nc-nd' => array(), 115 'lmt_redirect_url-by-nc-sa' => array(), 116 'lmt_redirect_url-by-sa' => array(), 117 'lmt_redirect_url-cright' => array(), 118 'lmt_redirect_url-cleft' => array(), 119 ); 120 121 $languages=get_languages(); 122 foreach($languages as $key => $val) 123 { 124 $lang=substr($key,0,2)."/"; 125 if($lang=="en/") { $lang=""; } 126 $this->config['lmt_warning_texts'][$key]=''; 127 $this->config['lmt_redirect_url-by'][$key]='http://creativecommons.org/licenses/by/2.0/'.$lang; 128 $this->config['lmt_redirect_url-by-nd'][$key]='http://creativecommons.org/licenses/by-nd/2.0/'.$lang; 129 $this->config['lmt_redirect_url-by-nc'][$key]='http://creativecommons.org/licenses/by-nc/2.0/'.$lang; 130 $this->config['lmt_redirect_url-by-nc-nd'][$key]='http://creativecommons.org/licenses/by-nc-nd/2.0/'.$lang; 131 $this->config['lmt_redirect_url-by-nc-sa'][$key]='http://creativecommons.org/licenses/by-nc-sa/2.0/'.$lang; 132 $this->config['lmt_redirect_url-by-sa'][$key]='http://creativecommons.org/licenses/by-sa/2.0/'.$lang; 133 $this->config['lmt_redirect_url-cright'][$key]=''; 134 $this->config['lmt_redirect_url-cleft'][$key]=''; 135 } 136 137 } 138 139 /* 140 generate the css code 141 */ 142 protected function generate_CSS() 143 { 144 $text = " 145 .TableRow:hover 146 { 147 background-color:#".$this->config['lmt_mouseovercolor']."; 148 } 149 150 .formtable 151 { 152 text-align:justify; 153 display:block; 154 margin-top:0px; 155 margin-bottom:0px; 156 width:100%; 157 } 158 159 .formtable tr { 160 vertical-align:top; 161 } 162 163 .littlefont { font-size:90%; } 164 table.littlefont th { text-align:center; padding:3px;padding-left:9px;padding-right:9px; } 165 table.littlefont td { text-align:left; padding:0px;padding-left:3px;padding-right:3px; } 166 167 .lmt_page 168 { 169 text-align:justify; 170 margin:8px; 171 } 172 173 .lmt { 174 text-align:justify; 175 } 176 177 #list { 178 width:100%; 179 overflow-y:scroll; 180 min-height:250px; 181 max-height:650px; 182 } 183 184 #ullist li { 185 width:300px; 186 display:block; 187 float:left; 188 text-align:left; 189 } 190 191 #ullist label { 192 float:left; 193 } 194 195 #ullist li table { 196 margin:0px; 197 text-align:left; 198 width:300px; 199 font-size:80%; 200 } 201 202 #ullist li tr { 203 vertical-align:top; 204 } 205 206 .content ul.thumbnails span.extendwrap1 { 207 margin:0px; 208 cursor:pointer; 209 } 210 211 .is_on, .is_off { 212 z-index:20; 213 width:12px; 214 height:12px; 215 display:block; 216 cursor:pointer; 217 } 218 219 .is_on { 220 background:url(./img/cb_on.png); 221 } 222 .is_off { 223 background:url(./img/cb_off.png); 224 } 225 226 .icnhelp { 227 weight:bold; 228 text-decoration:none; 229 cursor:help; 230 } 231 232 .hinthlp { 233 position:absolute; 234 max-width:400px; 235 border:1px solid #000000; 236 background:#ffffa0; 237 color:#000000; 238 top:0px; 239 left:-450px; 240 padding:2px; 241 text-align:justify; 242 } 243 244 "; 245 return($text); 246 } 247 248 /* 249 generate the css code 250 */ 251 protected function generate_CSS2() 252 { 253 $text = " 254 .logo80x15 { 255 position:relative; 256 top:4px; 257 margin-right:4px; 258 border:0px none; 259 } 260 261 .logo88x31 { 262 position:relative; 263 margin-right:4px; 264 border:0px none; 265 } 266 267 #theImage img.logo80x15, #theImage img.logo88x31 { 268 border:0px none; 269 padding:0px; 270 } 271 272 .licencetag { 273 display:block; 274 padding-top:10px; 275 font-size:80%; 276 } 277 "; 278 return($text); 279 } 280 281 282 283 284 /* ------------------------------------------------------------------------- 285 return the licence type for an image 286 $default = 'y' => if no licence for the picture, return de default licence 287 'n' => if no licence for the picture, return empty values 288 ------------------------------------------------------------------------- */ 289 public function get_image_licence($image_id) 290 { 291 165 } 166 167 if(($return["licence"]=="")&&($this->config["lmt_licence_visible"]=="y")) 168 { 292 169 $return=array( 293 "defau lt" => "",294 "licence" => "",170 "defaut" => "y", 171 "licence" => $this->config["lmt_licence_default"], 295 172 "aut_text1" => "", 296 173 "aut_text2" => "" 297 174 ); 298 $sql="SELECT lmti.licence_type, lmta.text1, lmta.text2 299 FROM ".$this->tables['images']." lmti 300 LEFT OUTER JOIN ".$this->tables['licence_author']." lmta ON lmti.author_id = lmta.id 301 WHERE lmti.image_id = '".$image_id."'"; 175 176 $sql="SELECT * FROM ".$this->tables['licence_author']." 177 WHERE id = '".$this->config["lmt_licence_default_author"]."'"; 302 178 $result=pwg_query($sql); 303 179 if($result) … … 305 181 while($row=pwg_db_fetch_assoc($result)) 306 182 { 307 $return=array( 308 "defaut" => "n", 309 "licence" => $row['licence_type'], 310 "aut_text1" => $row['text1'], 311 "aut_text2" => $row['text2'] 312 ); 183 $return["aut_text1"]=$row['text1']; 184 $return["aut_text2"]=$row['text2']; 313 185 } 314 186 } 315 316 if(($return["licence"]=="")&&($this->config["lmt_licence_visible"]=="y")) 187 } 188 189 return($return); 190 } 191 192 193 /** 194 * returns an array of image id with the asked licence type 195 * if $licence = "" => return all picture with a specific licences 196 * 197 * @param String $licence : licence to be filtered 198 * @return Array 199 */ 200 public function getImagesLicences($licence) 201 { 202 $sql="".$this->tables['lmt']; 203 204 $result=pwg_query($sql.$sql_where.$sql_order); 205 if($result) 206 { 207 $returned=array(); 208 while($row=pwg_db_fetch_assoc($result)) 317 209 { 318 $return=array( 319 "defaut" => "y", 320 "licence" => $this->config["lmt_licence_default"], 321 "aut_text1" => "", 322 "aut_text2" => "" 210 array_push($returned, $row); 211 } 212 return($returned); 213 } 214 return(false); 215 } 216 217 218 protected function displayResult($action_msg, $result) 219 { 220 global $page; 221 222 if($result) 223 { 224 array_push($page['infos'], $action_msg); 225 } 226 else 227 { 228 array_push($page['errors'], $action_msg); 229 } 230 } 231 232 233 /** 234 * build image url (for a given category) 235 * 236 * 237 */ 238 protected function makeImageDatas($tmp, $imageId) 239 { 240 $tmp2=array(); 241 foreach($tmp['id'] as $key=>$val) 242 { 243 $tmp2[]=array( 244 'id' => $tmp['id'][$key], 245 'name' => $tmp['name'][$key], 246 'type' => $tmp['type'][$key], 247 'plinks' => $tmp['plinks'][$key], 248 'link'=> make_picture_url( 249 array( 250 'image_id' => $imageId, 251 'category' => array 252 ( 253 'id' => $tmp['id'][$key], 254 'name' => $tmp['name'][$key], 255 'permalink' => $tmp['plinks'][$key] 256 ) 257 ) 258 ) 259 ); 260 } 261 return($tmp2); 262 } 263 264 } //class 265 266 267 268 269 class LMT_functions 270 { 271 static private $tables = Array(); 272 static private $config = Array(); 273 274 /** 275 * initialise the class 276 * 277 * @param String $prefixeTable : the piwigo prefixe used on tables name 278 * @param String $pluginNameFile : the plugin name used for tables name 279 */ 280 static public function init($prefixeTable) 281 { 282 GPCCore::loadConfig(LMT_root::$pluginNameFile, self::$config); 283 $list=LMT_root::$pluginTables; 284 285 for($i=0;$i<count($list);$i++) 286 { 287 self::$tables[$list[$i]]=$prefixeTable.LMT_root::$pluginNameFile.'_'.$list[$i]; 288 } 289 } 290 291 292 /** 293 * return all HTML&JS code necessary to display a dialogbox to choose 294 * geographic area 295 */ 296 static public function dialogBoxLMT() 297 { 298 global $template; 299 300 $template->set_filename('lmt_choose', 301 dirname(__FILE__).'/templates/lmt_dialog_licence_choose.tpl'); 302 303 $datas=Array( 304 'licencesList' => array() 305 ); 306 307 foreach(LMT_root::$licences as $licence) 308 { 309 if($licence!='DEFAULT') 310 { 311 $datas['licencesList'][]=array( 312 'value' => $licence, 313 'name' => l10n('lmt_lbl_cc_s-'.strtolower($licence)) 323 314 ); 324 325 $sql="SELECT * FROM ".$this->tables['licence_author']."326 WHERE id = '".$this->config["lmt_licence_default_author"]."'";327 $result=pwg_query($sql);328 if($result)329 {330 while($row=pwg_db_fetch_assoc($result))331 {332 $return["aut_text1"]=$row['text1'];333 $return["aut_text2"]=$row['text2'];334 }335 }336 315 } 337 338 return($return); 339 } 340 341 342 /* ------------------------------------------------------------------------- 343 returns an array of image id with the licence type 344 if $licence = "" => return all picture with a specific licences 345 ------------------------------------------------------------------------- */ 346 public function get_images_licences($licence) 347 { 348 $sql="".$this->tables['lmt']; 349 350 $result=pwg_query($sql.$sql_where.$sql_order); 351 if($result) 352 { 353 $returned=array(); 354 while($row=pwg_db_fetch_assoc($result)) 355 { 356 array_push($returned, $row); 357 } 358 return($returned); 359 } 360 return(false); 361 } 362 363 protected function displayResult($action_msg, $result) 364 { 365 global $page; 366 367 if($result) 368 { 369 array_push($page['infos'], $action_msg); 370 } 371 else 372 { 373 array_push($page['errors'], $action_msg); 374 } 375 } 376 377 378 /* --------------------------------------------------------------------------- 379 ajax functions 380 --------------------------------------------------------------------------- */ 381 382 383 } //class 316 } 317 318 $template->assign('datas', $datas); 319 320 return($template->parse('lmt_choose', true)); 321 } 322 } //GMaps_functions 323 324 384 325 385 326 ?> -
extensions/lmt/lmt_version.inc.php
r6701 r7560 15 15 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 16 16 17 define('LMT_VERSION', '1.2.3'); 18 define('LMT_VERSION2', '01.02.03'); 17 define('LMT_VERSION', '1.3.0'); 18 define('LMT_VERSION2', '01.03.00'); 19 define('LMT_GPC_NEEDED', '3.3.3'); 19 20 ?> -
extensions/lmt/main.inc.php
r6703 r7560 2 2 /* 3 3 Plugin Name: LMT 4 Version: 1. 2.34 Version: 1.3.0 5 5 Description: Appliquer une licence sur ses photos / Apply a licence on photos 6 6 Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=282 … … 108 108 { 109 109 //LMT public interface loaded and active only if in public page 110 include_once("lmt_pip.class.inc.php"); 111 $obj=new LMT_PIP($prefixeTable, __FILE__); 110 if(CommonPlugin::checkGPCRelease(LMT_GPC_NEEDED)) 111 { 112 //LMT public interface loaded and active only if in public page 113 include_once("lmt_pip.class.inc.php"); 114 $obj=new LMT_PIP($prefixeTable, __FILE__); 115 } 112 116 } 113 117 -
extensions/lmt/maintain.inc.php
r5548 r7560 14 14 if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } 15 15 16 include_once('lmt_version.inc.php'); // => Don't forget to update this file !! 17 16 18 if(!defined('LMT_DIR')) define('LMT_DIR' , basename(dirname(__FILE__))); 17 19 if(!defined('LMT_PATH')) define('LMT_PATH' , PHPWG_PLUGINS_PATH . LMT_DIR . '/'); … … 20 22 //ini_set('display_errors', true); 21 23 22 global $gpc _installed, $gpcNeeded, $lang; //needed for plugin manager compatibility24 global $gpcInstalled, $lang; //needed for plugin manager compatibility 23 25 24 26 /* ----------------------------------------------------------------------------- 25 LMT needs the Grum Plugin Classe 27 LMT needs the Grum Plugin Classes 26 28 ----------------------------------------------------------------------------- */ 27 $gpc_installed=false; 28 $gpcNeeded="3.0.0"; 29 $gpcInstalled=false; 29 30 if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php')) 30 31 { 31 32 @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); 32 // need GPC release greater or equal than 3.0.033 if(CommonPlugin::checkGPCRelease( 3,0,0))33 // need GPC release greater or equal than ... 34 if(CommonPlugin::checkGPCRelease(LMT_GPC_NEEDED)) 34 35 { 35 36 @include_once('lmt_install.class.inc.php'); 36 $gpc _installed=true;37 $gpcInstalled=true; 37 38 } 38 39 } 40 39 41 40 42 function gpcMsgError(&$errors) … … 61 63 function plugin_install($plugin_id, $plugin_version, &$errors) 62 64 { 63 global $prefixeTable, $gpc_installed, $gpcNeeded; 65 global $prefixeTable, $gpcInstalled; 66 if(!$gpcInstalled) 67 { 68 gpcMsgError($errors, 'gpc'); 69 return(false); 70 } 64 71 65 if($gpc_installed) 72 $obj = new LMT_Install($prefixeTable, __FILE__); 73 $result=$obj->install(); 74 } 75 76 77 78 function plugin_activate($plugin_id, $plugin_version, &$errors) 79 { 80 global $prefixeTable, $gpcInstalled; 81 82 if($gpcInstalled) 66 83 { 67 84 $obj = new LMT_Install($prefixeTable, __FILE__); 68 $result=$obj->install(); 69 if(!$result) 70 { 71 array_push($errors, "error"); 72 } 73 GPCCore::register($obj->getPluginName(), LMT_VERSION, $gpcNeeded); 74 } 75 else 76 { 77 gpcMsgError($errors); 85 $result=$obj->activate(); 78 86 } 79 87 } 80 88 81 function plugin_activate($plugin_id, $plugin_version, &$errors)82 {83 global $prefixeTable, $gpc_installed;84 85 if($gpc_installed)86 {87 $obj = new LMT_Install($prefixeTable, __FILE__);88 $result=$obj->activate();89 if($result===false or $result!='')90 {91 if(is_string($result))92 {93 array_push($errors, $result);94 }95 else96 {97 array_push($errors, "");98 }99 }100 }101 else102 {103 gpcMsgError($errors);104 }105 }106 89 107 90 function plugin_deactivate($plugin_id) 108 91 { 109 /* global $prefixeTable; 110 $obj = new install_mypolls($prefixeTable, __FILE__); 111 $obj->deactivate(); */ 92 global $prefixeTable, $gpcInstalled; 93 94 if($gpcInstalled) 95 { 96 $obj=new LMT_Install($prefixeTable, __FILE__); 97 $obj->deactivate(); 98 } 112 99 } 113 100 114 101 function plugin_uninstall($plugin_id) 115 102 { 116 global $prefixeTable, $gpc _installed;103 global $prefixeTable, $gpcInstalled; 117 104 118 if($gpc _installed)105 if($gpcInstalled) 119 106 { 120 107 $obj = new LMT_Install($prefixeTable, __FILE__); 121 108 $obj->uninstall(); 122 GPCCore::unregister($obj->getPluginName());123 }124 else125 {126 gpcMsgError($errors);127 109 } 128 110 }
Note: See TracChangeset
for help on using the changeset viewer.