Changeset 3999 for extensions/event_cats/admin/evntcats_admin.php
- Timestamp:
- Oct 9, 2009, 8:23:38 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/event_cats/admin/evntcats_admin.php
r3985 r3999 60 60 $my_base_url = get_admin_plugin_menu_link(__FILE__); 61 61 62 $template->assign( 'EVNTCATS_VERSION', EVNTCATS_INFO_VERSION);62 $template->assign('EVNTCATS_VERSION', EVNTCATS_INFO_VERSION); 63 63 $me = get_plugin_data($plugin_id); 64 64 $template->clear_assign('ec_infos'); … … 71 71 // | Tabsheet 72 72 // +-----------------------------------------------------------------------+ 73 if (!isset($_GET['tab'])) 74 $page['tab'] = 'autolog'; 75 else 76 $page['tab'] = $_GET['tab']; 73 $page['tab'] = (!mysql_fetch_row(pwg_query(' 74 SELECT * FROM `'.EVNTCATS_TABLE.'` 75 WHERE `code` IS NOT NULL 76 '))) ? 'autolog_new' : 'autolog_entries'; 77 if (isset($_POST['ec_act1']) and 78 ($_POST['ec_act1'] == 'autolog_new' or $_POST['ec_act1'] == 'duplicate_entry')) 79 $page['tab'] = 'autolog_new'; 80 else if (isset($_GET['tab'])) switch ($_GET['tab']) { 81 case 'autolog_new': 82 case 'duplication': 83 case 'config': 84 $page['tab'] = $_GET['tab']; 85 } 77 86 78 87 $tabsheet = new tabsheet(); 79 $tabsheet->add('autolog', 80 l10n('ec_tab_autoid'), 81 $my_base_url.'&tab=autolog'); 88 $tabsheet->add('autolog_entries', 89 l10n('ec_tab_autoid_entries'), 90 $my_base_url.'&tab=autolog_entries'); 91 $tabsheet->add('autolog_new', 92 l10n('ec_tab_autoid_new'), 93 $my_base_url.'&tab=autolog_new'); 94 $tabsheet->add('duplication', 95 l10n('ec_tab_duplication'), 96 $my_base_url.'&tab=duplication'); 82 97 $tabsheet->add('config', 83 98 l10n('ec_tab_config'), … … 91 106 $template->assign('EVNTCATS_URLS', array ( 92 107 'ROOT' => EVNTCATS_PATH, 93 'DISABLE' => PHPWG_ROOT_PATH.94 'admin.php?page=plugin§ion=event_cats%2Fadmin%2Fevntcats_admin.php&disable=',95 'DELETE' => PHPWG_ROOT_PATH.96 'admin.php?page=plugin§ion=event_cats%2Fadmin%2Fevntcats_admin.php&delete='97 108 )); 98 109 99 110 /****************************************************************************/ 100 111 101 $code_list = array(); 102 build_ec_lists(); // in evntcats_funcs.php 103 104 if (isset($_GET['delete'])) { 105 if (array_key_exists($_GET['delete'],$ec_lists['ec_table'])) { 106 $t = $ec_lists['ec_table'][$_GET['delete']]['code']; 107 $q = pwg_query(' 108 DELETE FROM '.EVNTCATS_TABLE.' 109 WHERE id = '.$_GET['delete'] 110 ); 111 if ($q = 1) { 112 $page['infos']['infos'] = l10n('ec_entry_del_ok_pre').$t. 113 l10n('ec_entry_del_ok_end'); 114 } 115 else { 116 $page['errors'][] = l10n('ec_entry_del_nok_pre').$t. 117 l10n('ec_entry_del_nok_end'); 118 } 119 build_ec_table(); 120 } 121 } 122 123 if (isset($_GET['disable'])) { 124 if (array_key_exists($_GET['disable'],$ec_lists['ec_table'])) { 125 $t = $ec_lists['ec_table'][$_GET['disable']]['code']; 126 $q = pwg_query(' 127 UPDATE '.EVNTCATS_TABLE.' 128 SET action = \'ec_outdated\' 129 WHERE id = '.$_GET['disable'] 130 ); 131 if ($q = 1) { 132 $page['infos']['infos'] = l10n('ec_entry_dis_ok_pre1').$t. 133 l10n('ec_entry_dis_ok_end1'); 134 if (isset($_GET['add_p'])) { 135 if (array_key_exists($_GET['add_p'],$ec_lists['add_pages'])) { 136 $q = pwg_query(' 137 UPDATE '.EVNTCATS_TABLE.' 138 SET arg1 = '.$_GET['add_p'].' 139 WHERE id = '.$_GET['disable'] 140 ); 141 if ($q = 1) { 142 $page['infos']['infos'].= 143 l10n('ec_entry_dis_ok_pre2'). 144 $_GET['add_p']. 145 l10n('ec_entry_dis_ok_mid2'). 146 $ec_lists['add_pages'][$_GET['add_p']]. 147 l10n('ec_entry_dis_ok_end2'); 148 } 149 else { 150 $page['errors'][] = 151 l10n('ec_entry_dis_nok_pre2'). 152 $t. 153 l10n('ec_entry_dis_nok_mid2'). 154 $_GET['add_p']. 155 l10n('ec_entry_dis_nok_end2'); 156 } 157 } 158 } 159 else { 160 $q = pwg_query(' 161 UPDATE '.EVNTCATS_TABLE.' 162 SET arg1 = NULL 163 WHERE id = '.$_GET['disable'] 164 ); 165 if ($q != 1) { 166 $page['errors'][] = 167 l10n('ec_entry_dis_nok_pre3'). 168 $t. 169 l10n('ec_entry_dis_nok_end3'); 170 } 171 } 172 } 173 else { 174 $page['errors'][] = l10n('ec_entry_dis_nok_pre1').$t. 175 l10n('ec_entry_dis_nok_end1'); 176 } 177 build_ec_table(); 178 } 179 } 180 181 if (isset($_GET[''])) { 182 } 183 184 if (isset($_GET[''])) { 185 } 186 187 if (isset($_GET[''])) { 188 } 189 190 if (isset($_GET[''])) { 191 } 192 193 /**************************************************************** 194 * Construction of array var to be transmitted to tpl file, * 195 * containing all infos to be displayed in the code array table. * 196 ****************************************************************/ 197 198 $span_err_pre = '<span style = "color: red; font-weight: bold;">'; 199 $span_err_end = '</span>'; 200 201 foreach ($ec_lists['ec_table'] as $ec_entry) { 202 203 $a = NULL; 204 $dspl = ''; 205 $url_end = ''; 206 $i = intval($ec_entry['id']); 207 $arg1 = $ec_entry['arg1']; 208 $arg1_int = intval($arg1); 209 $arg2 = $ec_entry['arg2']; 210 $arg2_int = intval($arg2); 211 $log_OK = is_in($ec_entry['action'], 'ec_ok'); 212 213 // No specific need for "code" displaying 214 215 // "username" displaying 216 $username = ($log_OK) ? 217 $ec_lists['user_ids'][intval($ec_entry['user_id'])] : ''; 218 219 // No specific need for "action" displaying 220 221 // "displayed page" : # of the AP, or of the category... 222 switch ($ec_entry['action']) { 223 224 case 'ec_ok_f_pb' : 225 case 'ec_ok_f_pb_img_pb' : 226 $page['errors'][$ec_entry['code']] = 227 $ec_entry['code'].' : '.l10n('ec_forced_pb'); 228 case 'ec_ok' : 229 case 'ec_ok_img_pb' : 230 $a = 0; 231 if (!empty($ec_entry['arg1'])) $a++; 232 if (!empty($ec_entry['arg2'])) $a+= 2; 233 switch ($a) { 234 case 0: // Home 235 $dspl = l10n('ec_dspl_ok_home'); 236 break; 237 case 1: // Category 238 case 3: // Image 239 $url_end = '&cat='.$arg1; 240 $dspl = 241 l10n('ec_dspl_ok_cat_pre'). 242 $arg1. 243 l10n('ec_dspl_ok_cat_mid'). 244 $ec_lists['categories'][$arg1_int]. 245 l10n('ec_dspl_ok_cat_end') 246 ; 247 if (is_in($ec_entry['action'], '_img_pb')) { 248 $url_end.= '&img='.$arg2; 249 $page['errors'][] = 250 $ec_entry['code'].' : '.l10n('ec_image_miss'); 251 $dspl.= 252 '<br>'.$span_err_pre. 253 l10n('ec_dspl_nok_img2_pre'). 254 $arg2. 255 l10n('ec_dspl_nok_img2_mid'). 256 $arg1. 257 l10n('ec_dspl_nok_img2_end'). 258 $span_err_end 259 ; 260 } 261 elseif ($a == 3) { // Image 262 $url_end.= '&img='.$arg2; 263 $t = mysql_fetch_row(pwg_query(' 264 SELECT `name`, `file` 265 FROM `'.IMAGES_TABLE.'` 266 WHERE `id` = "'.$arg2.'" 267 ')); 268 $dspl.= 269 '<br>'. 270 l10n('ec_dspl_ok_img2_pre'). 271 $arg2. 272 l10n('ec_dspl_ok_img2_mid1'). 273 $t[0]. 274 l10n('ec_dspl_ok_img2_mid2'). 275 $t[1]. 276 l10n('ec_dspl_ok_img2_end') 277 ; 278 } 279 break; 280 case 2: // Additional Page 281 $url_end = '&ap='.$arg2; 282 $dspl = ($ec_ap_ok) ? 283 l10n('ec_dspl_ok_ap_pre'). 284 $arg2. 285 l10n('ec_dspl_ok_ap_mid'). 286 $ec_lists['add_pages'][$arg2_int]. 287 l10n('ec_dspl_ok_ap_end') 288 : 289 l10n('ec_dspl_ok_home') 290 ; 291 break; 292 } 293 break; 294 295 case 'ec_nok' : 296 if (empty($ec_entry['arg2'])) { 297 $dspl = l10n('ec_dspl_nok_acc_denied'); 298 } 299 else { 300 $dspl = ($ec_ap_ok) ? 301 l10n('ec_dspl_ok_ap_pre'). 302 $arg2. 303 l10n('ec_dspl_ok_ap_mid'). 304 $ec_lists['add_pages'][$arg2_int]. 305 l10n('ec_dspl_ok_ap_end') 306 : 307 l10n('ec_dspl_nok_acc_denied') 308 ; 309 } 310 break; 311 312 case 'ec_ok_f_pb_ap_pb' : 313 $page['errors'][$ec_entry['code']] = 314 $ec_entry['code'].' : '.l10n('ec_forced_pb'); 315 case 'ec_nok_ap_pb' : // No need to check here if Additional Pages is 316 case 'ec_ok_ap_pb' : // active : we can arrive here only when it is. 317 $page['errors'][] = 318 $ec_entry['code'].' : '.l10n('ec_add_page_miss'); 319 if (is_in($ec_entry['action'], 'ec_ok')) { 320 $url_end = '&ap='.$arg2; 321 $dspl = l10n('ec_dspl_ok_home'); 322 } 323 else { 324 $dspl = l10n('ec_dspl_nok_acc_denied'); 325 } 326 $dspl.= 327 $span_err_pre. 328 l10n('ec_dspl_nok_ap_pre'). 329 $arg2. 330 l10n('ec_dspl_nok_ap_end'). 331 $span_err_end 332 ; 333 break; 334 335 case 'ec_ok_f_pb_cat_pb' : 336 $page['errors'][$ec_entry['code']] = 337 $ec_entry['code'].' : '.l10n('ec_forced_pb'); 338 case 'ec_ok_cat_pb' : 339 $url_end = '&cat='.$arg1; 340 $page['errors'][] = 341 $ec_entry['code'].' : '.l10n('ec_category_miss'); 342 $dspl = 343 l10n('ec_dspl_nok_home'). 344 $span_err_pre. 345 l10n('ec_dspl_nok_img1_pre'). 346 $arg1. 347 l10n('ec_dspl_nok_img1_end'). 348 $span_err_end 349 ; 350 break; 351 352 case 'ec_nok_action_pb' : 353 $page['errors'][$ec_entry['code']] = 354 $ec_entry['code'].' : '.l10n('ec_action_pb'); 355 $username = 356 $span_err_pre. 357 l10n('ec_dspl_nok_actn'). 358 $span_err_end 359 ; 360 $dspl = l10n('ec_dspl_ok_home'); 361 break; 362 363 case 'ec_nok_userid_pb' : 364 $page['errors'][$ec_entry['code']] = 365 $ec_entry['code'].' : '.l10n('ec_username_pb'); 366 $username = 367 $span_err_pre. 368 l10n('ec_dspl_usr_pb'). 369 $span_err_end 370 ; 371 $dspl = l10n('ec_dspl_ok_home'); 372 break; 373 374 case 'ec_nok_userid_miss' : 375 $page['errors'][$ec_entry['code']] = 376 $ec_entry['code'].' : '.l10n('ec_username_miss'); 377 $username = 378 $span_err_pre. 379 l10n('ec_dspl_nok_usr_pre'). 380 $ec_entry['user_id']. 381 l10n('ec_dspl_nok_usr_end'). 382 $span_err_end 383 ; 384 $dspl = l10n('ec_dspl_ok_home'); 385 break; 386 } 387 388 // construction of $code_URL 389 $code_URL = 390 ROOT_URL. 391 'index.php?autolog='. 392 $ec_entry['code']. 393 $url_end 394 ; 395 396 $code_list[$i] = array( 397 'id' => $i, 398 'Code' => (isset($page['errors'][$ec_entry['code']])) ? 399 $span_err_pre.$ec_entry['code'].$span_err_end : $ec_entry['code'], 400 'Username' => $username, 401 'Action' => (is_in($ec_entry['action'], 'ec_nok_')) ? 402 $span_err_pre.$ec_entry['action'].$span_err_end : $ec_entry['action'], 403 'Arg1' => $dspl, 404 'Forced' => $ec_entry['forced'], 405 'code_URL' => $code_URL, 406 'log_OK' => $log_OK, 407 'f_pb' => is_in($ec_entry['action'], '_f_pb'), 408 ); 409 } 112 include(EVNTCATS_PATH.'admin/'.$page['tab'].'.inc.php'); 410 113 411 114 /* … … 418 121 $template->assign('ec_howto', (count($page['errors']) == 0 and count($page['infos']) == 0)); 419 122 420 $template->assign('ec_ap_ok',$ec_ap_ok);421 $template->assign('code_list',$code_list);422 123 $template->assign('ec_lists',$ec_lists); 423 124 $template->assign('EVNTCATS_PATH',EVNTCATS_PATH); … … 430 131 $template->assign('test3tpl',str_from_var($code_list)); 431 132 432 $template->set_filenames(array('evntcats_admin_content' => dirname(__FILE__).' /evntcats_admin.tpl'));133 $template->set_filenames(array('evntcats_admin_content' => dirname(__FILE__).'template/'.$page['tab'].'.tpl')); 433 134 $template->assign_var_from_handle('ADMIN_CONTENT','evntcats_admin_content'); 434 135 ?>
Note: See TracChangeset
for help on using the changeset viewer.