Changeset 4174
- Timestamp:
- Nov 2, 2009, 11:31:49 PM (14 years ago)
- Location:
- extensions/meta
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/meta/admin/admin.php
r3978 r4174 1 1 <?php 2 3 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 3 global $template, $conf, $user; … … 13 12 14 13 //-------------------------------------------------------- sections definitions 14 15 //Gestion MAJ 16 $majm='meta 2.0.5'; 17 $query = ' 18 select param,value 19 FROM ' . CONFIG_TABLE . ' 20 WHERE param = \''.$majm.'\' 21 ;'; 22 $result = pwg_query($query); 23 24 $row = mysql_fetch_array($result); 25 $majparam=$row['param']; 26 $majvalue=$row['value']; 27 28 if (!$majvalue==1 and !is_adviser()) 29 { 30 $maj = 'maj'; 31 $template->assign( 32 $maj, 33 array( 34 'meta'=>l10n('meta_name'), 35 )); 36 if (isset($_POST['maj']) and !is_adviser()) 37 { 38 global $prefixeTable; 39 if (!defined('meta_img_TABLE')) define('meta_img_TABLE', $prefixeTable.'meta_img'); 40 $query = "CREATE TABLE IF NOT EXISTS ". meta_img_TABLE ." ( 41 id SMALLINT( 5 ) UNSIGNED NOT NULL , 42 metaKeyimg VARCHAR( 255 ) NOT NULL , 43 PRIMARY KEY (id))DEFAULT CHARSET=utf8;"; 44 $result = pwg_query($query); 45 46 if (!defined('meta_cat_TABLE')) define('meta_cat_TABLE', $prefixeTable.'meta_cat'); 47 $query = "CREATE TABLE IF NOT EXISTS ". meta_cat_TABLE ." ( 48 id SMALLINT( 5 ) UNSIGNED NOT NULL , 49 metaKeycat VARCHAR( 255 ) NOT NULL , 50 PRIMARY KEY (id))DEFAULT CHARSET=utf8;"; 51 $result = pwg_query($query); 52 53 $query = ' 54 select id 55 FROM ' . CATEGORIES_TABLE . ' 56 ORDER BY id DESC;'; 57 $result = pwg_query($query); 58 $row = mysql_fetch_array($result); 59 60 $comp=$row['id']+1; 61 $i=1; 62 63 while($i < $comp) 64 { 65 $query = ' 66 select id,metaKeywords 67 FROM ' . CATEGORIES_TABLE . ' 68 WHERE id = \''.$i.'\''; 69 $result = pwg_query($query); 70 $row = mysql_fetch_array($result); 71 72 if(!$row['id']==0 and !$row['metaKeywords']==0) 73 { 74 $query = ' 75 INSERT INTO ' . $prefixeTable . 'meta_cat(id,metaKeycat)VALUES ('.$row['id'].',"'.$row['metaKeywords'].'");'; 76 $result = pwg_query($query); 77 } 78 ++$i; 79 } 80 81 $query = ' ALTER TABLE '. CATEGORIES_TABLE .' DROP COLUMN `metaKeywords`'; 82 pwg_query($query); 83 84 $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("'.$majm.'",1,"MAJ meta");'; 85 pwg_query($query); 86 array_push($page['infos'], l10n('meta_majt')); 87 $majvalue==1; 88 $maj =0; 89 } 90 } 91 else{ 92 15 93 // Gestion des onglets 16 94 if (!isset($_GET['tab'])) … … 26 104 l10n('meta_onglet_categorie'), 27 105 $my_base_url.'&tab=categorie'); 106 $tabsheet->add('image', 107 l10n('meta_onglet_image'), 108 $my_base_url.'&tab=image'); 28 109 $tabsheet->add('description', 29 110 l10n('meta_onglet_description'), … … 105 186 106 187 break; 188 107 189 // Onglet gestion des meta categorie 108 190 case 'categorie': … … 142 224 $lire=$_POST['metacat']; 143 225 $query = ' 144 select id,name ,metaKeywords226 select id,name 145 227 FROM ' . CATEGORIES_TABLE . ' 146 228 WHERE id = \''.$lire.'\' … … 151 233 $idcat=$row['id']; 152 234 $chnamecat=$row['name']; 153 $chvalcat=$row['metaKeywords']; 235 236 $query = ' 237 select id,metaKeycat 238 FROM ' . meta_cat_TABLE . ' 239 WHERE id = \''.$lire.'\' 240 ;'; 241 $result = pwg_query($query); 242 $row = mysql_fetch_array($result); 243 $idmetaKeycat=$row['id']; 244 $chvalcat=$row['metaKeycat']; 154 245 155 246 $selected3 = 0; … … 169 260 { 170 261 $query = ' 171 UPDATE ' . CATEGORIES_TABLE . ' 172 SET metaKeywords= \''.$_POST['inser'].'\'262 DELETE 263 FROM ' . meta_cat_TABLE . ' 173 264 WHERE id = \''.$_POST['invisible'].'\' 174 ;'; 175 $result = pwg_query($query); 265 ;'; 266 $result = pwg_query($query); 267 $q = ' 268 INSERT INTO ' . $prefixeTable . 'meta_cat(id,metaKeycat)VALUES ('.$_POST['invisible'].',"'.$_POST['inser'].'");'; 269 pwg_query($q); 176 270 } 177 271 178 272 break; 273 274 // Onglet gestion des meta keywords images 275 case 'image': 276 277 //charge la liste des images 278 $groups = array(); 279 $query = ' 280 select id,name 281 FROM ' . IMAGES_TABLE . ' 282 ORDER BY id ASC;'; 283 $result = pwg_query($query); 284 285 while ($row = mysql_fetch_array($result)) 286 { 287 $groups[$row['id']] = $row['id'].' : '.$row['name']; 288 } 289 290 $selected = 0; 291 $options[] = l10n('meta_selecti3'); 292 $options['a'] = '----------------------'; 293 294 foreach($groups as $listid => $listid2) 295 { 296 $options[$listid] = $listid2; 297 } 298 $template->assign( 299 'gestionC', 300 array( 301 'OPTIONS' => $options, 302 'SELECTED' => $selected 303 )); 304 305 //edit de la meta l'image 306 if (isset($_POST['submitchoiximg'])and is_numeric($_POST['metaimg']) and (!$_POST['metaimg'])==0 and !is_adviser()) 307 { 308 $lire=$_POST['metaimg']; 309 $query = ' 310 select id,name 311 FROM ' . IMAGES_TABLE . ' 312 WHERE id = \''.$lire.'\' 313 ;'; 314 $result = pwg_query($query); 315 316 $row = mysql_fetch_array($result); 317 $idimg=$row['id']; 318 $chnameimg=$row['name']; 319 320 $query = ' 321 select id,metaKeyimg 322 FROM ' . meta_img_TABLE . ' 323 WHERE id = \''.$lire.'\' 324 ;'; 325 $result = pwg_query($query); 326 $row = mysql_fetch_array($result); 327 $idmetaKeyimg=$row['id']; 328 $chvalimg=$row['metaKeyimg']; 329 330 $selected3 = 0; 331 332 $template->assign( 333 'img_edit', 334 array( 335 'VALUE' => $idimg, 336 'VALUEN' => $chnameimg, 337 'CONTENT' => $chvalimg, 338 'SELECTED' => $selected3 339 )); 340 } 341 342 //insértion de meta img dans la table img 343 if (isset($_POST['submitinsimg']) and !is_adviser()) 344 { 345 $query = ' 346 DELETE 347 FROM ' . meta_img_TABLE . ' 348 WHERE id = \''.$_POST['invisible'].'\' 349 ;'; 350 $result = pwg_query($query); 351 $q = ' 352 INSERT INTO ' . $prefixeTable . 'meta_img(id,metaKeyimg)VALUES ('.$_POST['invisible'].',"'.$_POST['inser'].'");'; 353 pwg_query($q); 354 } 355 356 break; 357 179 358 // Onglet description 180 359 case 'description': … … 187 366 )); 188 367 break; 368 189 369 } 190 370 } 191 371 $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); 192 372 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); -
extensions/meta/admin/admin.tpl
r3978 r4174 2 2 <h2>meta</h2> 3 3 </div> 4 4 {if isset ($maj)} 5 <form method="post" > 6 <div style="text-align:center;"> 7 <input class="submit" name="maj" type="submit" value="{'meta_maj'|@translate}" {$TAG_INPUT_ENABLED} /> 8 </div> 9 </form> 10 {/if} 5 11 {if isset ($gestionA)} 6 12 <h3>{'meta_desh3'|@translate}</h3> … … 70 76 {/if} 71 77 {/if} 72 78 {if isset ($gestionC)} 79 <h3>{'meta_img'|@translate}</h3> 80 <div> 81 <form method="post" > 82 <fieldset> 83 <legend>{'meta_selectimg'|@translate}</legend> 84 {'meta_listimg'|@translate} 85 {html_options name="metaimg" options=$gestionC.OPTIONS selected=$gestionC.SELECTED} 86 <br> 87 <br> 88 <div style="text-align:center;"> 89 <input class="submit" name="submitchoiximg" type="submit" value="{'meta_choiximg'|@translate}" {$TAG_INPUT_ENABLED} /> 90 </div> 91 </fieldset> 92 </form> 93 </div> 94 {if isset ($img_edit)} 95 <div> 96 <form method="post" > 97 <fieldset> 98 <legend>{'meta_compimg'|@translate}</legend> 99 <input type="hidden" name="invisible" value="{$img_edit.VALUE}"> 100 id : {$img_edit.VALUE} -> {$img_edit.VALUEN} <input type="text" name="inser" value="{$img_edit.CONTENT}" size="110" maxlenght="110"> 101 <br> 102 <br> 103 <div style="text-align:center;"> 104 <input class="submit" name="submitinsimg" type="submit" value="{'meta_inscat'|@translate}" {$TAG_INPUT_ENABLED} /> 105 </div> 106 </fieldset> 107 </form> 108 </div> 109 {/if} 110 {/if} 73 111 {if isset ($description)} 74 112 <div class="comment"> … … 89 127 </div> 90 128 {/if} 129 {if isset ($MAJ)} 130 <div class="comment"> 131 <div style="text-align:center;"> 132 <input class="submit" name="submitMAJ" type="submit" value="{'meta_onglet_maj'|@translate}" {$TAG_INPUT_ENABLED} /> 133 </div> 134 </div> 135 {/if} -
extensions/meta/language/en_UK/plugin.lang.php
r3978 r4174 16 16 //onglet description categorie 17 17 $lang['meta_onglet_categorie'] = 'Categorie\'s Metadata'; 18 $lang['meta_cath3'] = 'Add meta keywords to thecategories';19 $lang['meta_select3'] = 'Select thecategory';20 $lang['meta_selectcat'] = 'Select the name of thecategory to be edit';18 $lang['meta_cath3'] = 'Add meta keywords to categories'; 19 $lang['meta_select3'] = 'Select category'; 20 $lang['meta_selectcat'] = 'Select name of category to be edit'; 21 21 $lang['meta_listcat'] = 'List categories :'; 22 $lang['meta_choixcat'] = 'Edit the category';23 $lang['meta_compcat'] = 'Keywords of thecategory to be completed';22 $lang['meta_choixcat'] = 'Edit categorie\'s Metadata'; 23 $lang['meta_compcat'] = 'Keywords of category to be completed'; 24 24 $lang['meta_inscat'] = 'Insert Keywords into the base '; 25 26 //onglet image 27 $lang['meta_onglet_image'] = 'Picture\'s Metadata'; 28 $lang['meta_img'] = 'Add meta keywords to picture'; 29 $lang['meta_selectimg'] = 'Select name of picture to be edit'; 30 $lang['meta_listimg'] = 'List Picture'; 31 $lang['meta_choiximg'] = 'Edit Picture\'s Metadata'; 32 $lang['meta_selecti3'] = 'Select Picture'; 33 $lang['meta_compimg'] = 'Keywords of picture to be completed'; 25 34 26 35 //onglet description … … 45 54 '; 46 55 47 56 //upgrade 57 $lang['meta_maj'] = 'Upgrade'; 58 $lang['meta_majt'] = 'Upgrade Complete<br>Please click on the menu meta to return to management plugin'; 48 59 49 60 -
extensions/meta/language/fr_FR/plugin.lang.php
r3978 r4174 14 14 $lang['meta_insmeta'] = 'inserer la metadonnée dans la table'; 15 15 16 //onglet descriptioncategorie16 //onglet categorie 17 17 $lang['meta_onglet_categorie'] = 'Metadonnée des Catégories'; 18 18 $lang['meta_cath3'] = 'Ajouter des meta keywords aux catégories'; 19 19 $lang['meta_select3'] = 'Sélectionnez la catégorie'; 20 $lang['meta_selectcat'] = 'Sélectionnez le nom de la catégorie à éditer';20 $lang['meta_selectcat'] = 'Sélectionnez le nom de la catégorie pour la méta keywords à éditer'; 21 21 $lang['meta_listcat'] = 'Liste des catégories :'; 22 $lang['meta_choixcat'] = 'Éditer la catégorie';22 $lang['meta_choixcat'] = 'Éditer la Metadonnée de la catégorie'; 23 23 $lang['meta_compcat'] = 'Mots clés de la catégorie à complèter'; 24 24 $lang['meta_inscat'] = 'Insérer les Mots clés dans la base'; 25 26 //onglet image 27 $lang['meta_onglet_image'] = 'Metadonnée des images'; 28 $lang['meta_img'] = 'Ajouter des meta keywords aux images'; 29 $lang['meta_selectimg'] = 'Sélectionnez le nom de l\'image pour la méta keywords à éditer'; 30 $lang['meta_listimg'] = 'Liste des images'; 31 $lang['meta_choiximg'] = 'Éditer la Metadonnée de l\'image'; 32 $lang['meta_selecti3'] = 'Sélectionnez l\'image'; 33 $lang['meta_compimg'] = 'Mots clés de l\'image à complèter'; 25 34 26 35 //onglet description … … 45 54 '; 46 55 56 //upgrade 57 $lang['meta_maj'] = 'Mise à jour'; 58 $lang['meta_majt'] = 'Mise à jour terminée<br> Faites un clic sur le menu meta pour revenir à la gestion du plugin'; 47 59 48 60 -
extensions/meta/main.inc.php
r3978 r4174 2 2 /* 3 3 Plugin Name: meta 4 Version: 2.0. 0.c4 Version: 2.0.5 5 5 Description: Allows to add metadata 6 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=220 … … 16 16 define('meta_PATH' , PHPWG_PLUGINS_PATH . meta_DIR . '/'); 17 17 define('meta_TABLE' , $prefixeTable . 'meta'); 18 define('meta_img_TABLE' , $prefixeTable . 'meta_img'); 19 define('meta_cat_TABLE' , $prefixeTable . 'meta_cat'); 18 20 19 21 add_event_handler('get_admin_plugin_menu_links', 'meta_admin_menu'); … … 82 84 83 85 //meta categories 84 if ( !empty($page['category'][' name']) )86 if ( !empty($page['category']['id']) ) 85 87 { 86 $page['category']['info'] = get_cat_info($page['category']['id']);87 $page['category']['name'] = $page['category']['info']['name'];88 88 89 89 $query = ' 90 select id, name,metakeywords,comment91 FROM ' . CATEGORIES_TABLE . '90 select id,metaKeycat 91 FROM ' . meta_cat_TABLE . ' 92 92 WHERE id = \''.$page['category']['id'].'\' 93 93 ;'; 94 94 $result = pwg_query($query); 95 95 $row = mysql_fetch_array($result); 96 if (!empty($row['meta keywords']))96 if (!empty($row['metaKeycat'])) 97 97 { 98 $template->append('related_tags', array('name' => $row['metakeywords'])); 98 $template->append('related_tags', array('name' => $row['metaKeycat'])); 99 } 100 } 101 102 103 //meta images 104 if ( !empty($page['image_id']) ) 105 { 106 $query = ' 107 select id,metaKeyimg 108 FROM ' . meta_img_TABLE . ' 109 WHERE id = \''.$page['image_id'].'\' 110 ;'; 111 $result = pwg_query($query); 112 $row = mysql_fetch_array($result); 113 if (!empty($row['metaKeyimg'])) 114 { 115 $template->append('related_tags', array('name' => $row['metaKeyimg'])); 99 116 } 100 117 } 101 118 } 102 103 119 104 120 add_event_handler('loc_after_page_header', 'set_meta_back'); -
extensions/meta/maintain.inc.php
r3978 r4174 2 2 3 3 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 5 $majm='meta 2.0.5'; 4 6 5 7 function plugin_install() … … 27 29 pwg_query($q); 28 30 29 31 $q = ' 30 32 INSERT INTO ' . $prefixeTable . 'meta(id,metaname,metaval,metatype)VALUES (4,"robots","follow","name");'; 31 33 pwg_query($q); 32 34 33 $q = ' 34 ALTER TABLE '. CATEGORIES_TABLE.' ADD COLUMN `metaKeywords` VARCHAR( 255 )'; 35 pwg_query($q); 35 if (!defined('meta_img_TABLE')) define('meta_img_TABLE', $prefixeTable.'meta_img'); 36 $query = "CREATE TABLE IF NOT EXISTS ". meta_img_TABLE ." ( 37 id SMALLINT( 5 ) UNSIGNED NOT NULL , 38 metaKeyimg VARCHAR( 255 ) NOT NULL , 39 PRIMARY KEY (id))DEFAULT CHARSET=utf8;"; 40 $result = pwg_query($query); 41 42 if (!defined('meta_cat_TABLE')) define('meta_cat_TABLE', $prefixeTable.'meta_cat'); 43 $query = "CREATE TABLE IF NOT EXISTS ". meta_cat_TABLE ." ( 44 id SMALLINT( 5 ) UNSIGNED NOT NULL , 45 metaKeycat VARCHAR( 255 ) NOT NULL , 46 PRIMARY KEY (id))DEFAULT CHARSET=utf8;"; 47 $result = pwg_query($query); 36 48 49 $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("'.$majm.'",1,"MAJ meta");'; 50 pwg_query($query); 37 51 } 38 52 … … 44 58 pwg_query($q); 45 59 46 $q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param=" meta" LIMIT 1;';60 $q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="'.$majm.'" LIMIT 1;'; 47 61 pwg_query($q); 48 62 49 $q = ' ALTER TABLE '. CATEGORIES_TABLE .' DROP COLUMN `metaKeywords`'; 50 pwg_query( $q ); 63 $q = 'DROP TABLE ' . $prefixeTable . 'meta_img;'; 64 pwg_query($q); 65 66 $q = 'DROP TABLE ' . $prefixeTable . 'meta_cat;'; 67 pwg_query($q); 51 68 } 52 69
Note: See TracChangeset
for help on using the changeset viewer.