Changeset 29429 for extensions/meta/initadmin.php
- Timestamp:
- Sep 8, 2014, 7:24:59 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/meta/initadmin.php
r22769 r29429 1 1 <?php 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 2 3 if (!defined('PHPWG_ROOT_PATH')) 4 die('Hacking attempt!'); 3 5 4 6 5 7 //Add link menu 6 8 add_event_handler('get_admin_plugin_menu_links', 'meta_admin_menu'); 7 function meta_admin_menu($menu) 8 {9 load_language('plugin.lang', meta_PATH);10 array_push($menu, array(11 12 'URL' => get_admin_plugin_menu_link(meta_PATH . 'admin/admin.php')));13 return $menu;9 10 function meta_admin_menu($menu) { 11 load_language('plugin.lang', meta_PATH); 12 array_push($menu, array( 13 'NAME' => l10n('Manage tag Metadata'), 14 'URL' => get_admin_plugin_menu_link(meta_PATH . 'admin/admin.php'))); 15 return $menu; 14 16 } 15 17 18 //add prefiltre photo 19 add_event_handler('loc_begin_admin', 'metaPadminf', 55); 20 add_event_handler('loc_begin_admin_page', 'metaPadminA', 55); 16 21 17 //add prefiltre photo 18 add_event_handler('loc_begin_admin', 'metaPadminf',55); 19 add_event_handler('loc_begin_admin_page', 'metaPadminA',55); 22 function metaPadminf() { 23 global $template; 24 $template->set_prefilter('picture_modify', 'metaPadminfT'); 25 } 20 26 21 function metaPadminf() 22 { 23 global $template; 24 $template->set_prefilter('picture_modify', 'metaPadminfT'); 25 } 27 function metaPadminfT($content, &$smarty) { 28 $search = '#</form>#'; 26 29 27 function metaPadminfT($content, &$smarty) 28 { 29 $search = '#</form>#'; 30 31 $replacement = ' 30 $replacement = ' 32 31 <div> 33 32 <fieldset> … … 48 47 </form>'; 49 48 50 return preg_replace($search, $replacement, $content); 51 } 52 53 function metaPadminA() 54 { 55 load_language('plugin.lang', meta_PATH); 56 if (isset($_GET['image_id'])) 57 { 58 global $template, $prefixeTable; 59 $query = ' 49 return preg_replace($search, $replacement, $content); 50 } 51 52 function metaPadminA() { 53 load_language('plugin.lang', meta_PATH); 54 if (isset($_GET['image_id'])) { 55 global $template, $prefixeTable; 56 $query = ' 60 57 select id,metaKeyimg,metadesimg 61 58 FROM ' . meta_img_TABLE . ' 62 WHERE id = ' .$_GET['image_id'].'59 WHERE id = ' . $_GET['image_id'] . ' 63 60 ;'; 64 $result = pwg_query($query); 65 $row = pwg_db_fetch_assoc($result); 66 $chvalimg=$row['metaKeyimg']; 67 $chvalimgdes=$row['metadesimg']; 68 69 $template->assign( 70 array( 71 'metaCONTENT' => $chvalimg, 72 'metaCONTENT2' => $chvalimgdes, 73 )); 74 } 75 76 if (isset($_POST['submetaphoto'])) 77 { 78 $query = ' 61 $result = pwg_query($query); 62 $row = pwg_db_fetch_assoc($result); 63 $chvalimg = $row['metaKeyimg']; 64 $chvalimgdes = $row['metadesimg']; 65 66 $template->assign( 67 array( 68 'metaCONTENT' => $chvalimg, 69 'metaCONTENT2' => $chvalimgdes, 70 )); 71 } 72 73 if (isset($_POST['submetaphoto'])) { 74 $query = ' 79 75 DELETE 80 76 FROM ' . meta_img_TABLE . ' 81 WHERE id = ' .$_GET['image_id'].'77 WHERE id = ' . $_GET['image_id'] . ' 82 78 ;'; 83 $result = pwg_query($query);84 85 INSERT INTO ' . $prefixeTable . 'meta_img(id,metaKeyimg,metadesimg)VALUES (' .$_GET['image_id'].',"'.$_POST['insermetaKP'].'","'.$_POST['insermetaDP'].'");';86 pwg_query($q);87 88 $template->assign(89 array(90 'metaCONTENT' => $_POST['insermetaKP'],91 'metaCONTENT2' => $_POST['insermetaDP'],92 ));93 }94 95 79 $result = pwg_query($query); 80 $q = ' 81 INSERT INTO ' . $prefixeTable . 'meta_img(id,metaKeyimg,metadesimg)VALUES (' . $_GET['image_id'] . ',"' . $_POST['insermetaKP'] . '","' . $_POST['insermetaDP'] . '");'; 82 pwg_query($q); 83 84 $template->assign( 85 array( 86 'metaCONTENT' => $_POST['insermetaKP'], 87 'metaCONTENT2' => $_POST['insermetaDP'], 88 )); 89 } 90 } 91 96 92 //add prefiltre album 97 93 add_event_handler('loc_end_cat_modify', 'metaAadminf'); 98 94 add_event_handler('loc_end_cat_modify', 'metaAadminA'); 99 95 100 function metaAadminf() 101 { 102 global $template; 103 $template->set_prefilter('album_properties', 'metaAadminfT'); 104 } 96 function metaAadminf() { 97 global $template; 98 $template->set_prefilter('album_properties', 'metaAadminfT'); 99 } 105 100 106 function metaAadminfT($content, &$smarty) 107 { 108 $search = '#</form>#'; 109 110 $replacement = ' 101 function metaAadminfT($content, &$smarty) { 102 $search = '#</form>#'; 103 104 $replacement = ' 111 105 <div> 112 106 … … 129 123 '; 130 124 131 return preg_replace($search, $replacement, $content);132 125 return preg_replace($search, $replacement, $content); 126 } 133 127 134 function metaAadminA() 135 { 136 load_language('plugin.lang', meta_PATH); 137 if (isset($_GET['cat_id'])) 138 { 139 global $template, $prefixeTable; 140 $query = ' 128 function metaAadminA() { 129 load_language('plugin.lang', meta_PATH); 130 if (isset($_GET['cat_id'])) { 131 global $template, $prefixeTable; 132 $query = ' 141 133 select id,metaKeycat,metadescat 142 134 FROM ' . meta_cat_TABLE . ' 143 WHERE id = ' .$_GET['cat_id'].'135 WHERE id = ' . $_GET['cat_id'] . ' 144 136 ;'; 145 $result = pwg_query($query); 146 $row = pwg_db_fetch_assoc($result); 147 $chvalcat=$row['metaKeycat']; 148 $chvalcatdes=$row['metadescat']; 149 150 $template->assign( 151 array( 152 'metaCONTENT' => $chvalcat, 153 'metaCONTENT2' => $chvalcatdes, 154 )); 155 } 156 157 if (isset($_POST['submetaalbum'])) 158 { 159 $query = ' 137 $result = pwg_query($query); 138 $row = pwg_db_fetch_assoc($result); 139 $chvalcat = $row['metaKeycat']; 140 $chvalcatdes = $row['metadescat']; 141 142 $template->assign( 143 array( 144 'metaCONTENT' => $chvalcat, 145 'metaCONTENT2' => $chvalcatdes, 146 )); 147 } 148 149 if (isset($_POST['submetaalbum'])) { 150 $query = ' 160 151 DELETE 161 152 FROM ' . meta_cat_TABLE . ' 162 WHERE id = ' .$_GET['cat_id'].'153 WHERE id = ' . $_GET['cat_id'] . ' 163 154 ;'; 164 $result = pwg_query($query);165 166 INSERT INTO ' . $prefixeTable . 'meta_cat(id,metaKeycat,metadescat)VALUES (' .$_GET['cat_id'].',"'.$_POST['insermetaKA'].'","'.$_POST['insermetaDA'].'");';167 pwg_query($q);155 $result = pwg_query($query); 156 $q = ' 157 INSERT INTO ' . $prefixeTable . 'meta_cat(id,metaKeycat,metadescat)VALUES (' . $_GET['cat_id'] . ',"' . $_POST['insermetaKA'] . '","' . $_POST['insermetaDA'] . '");'; 158 pwg_query($q); 168 159 169 $template->assign(170 array(171 'metaCONTENT' => $_POST['insermetaKA'],172 173 ));174 }175 160 $template->assign( 161 array( 162 'metaCONTENT' => $_POST['insermetaKA'], 163 'metaCONTENT2' => $_POST['insermetaDA'], 164 )); 165 } 166 } 176 167 177 168 ?>
Note: See TracChangeset
for help on using the changeset viewer.