Changeset 9745 for extensions/ContestResults/main.inc.php
- Timestamp:
- Mar 17, 2011, 8:25:13 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ContestResults/main.inc.php
r9572 r9745 2 2 /* 3 3 Plugin Name: ContestResults 4 Version: 1.3 4 Version: 1.3.b 5 5 Description: Add contests management pages 6 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=439 … … 11 11 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 12 12 13 global $prefixeTable, $conf ;13 global $prefixeTable, $conf, $pwg_loaded_plugins; 14 14 15 15 // +-----------------------------------------------------------------------+ … … 17 17 // +-----------------------------------------------------------------------+ 18 18 define('CR_NAME' , 'Contest Results'); 19 define('CR_VERSION', '1.3 ');19 define('CR_VERSION', '1.3.b'); 20 20 define('CR_DIR' , basename(dirname(__FILE__))); 21 21 define('CR_PATH' , PHPWG_PLUGINS_PATH . CR_DIR . '/'); 22 22 define('CR_TABLE_1' , $prefixeTable . 'contests'); 23 23 define('CR_TABLE_2' , $prefixeTable . 'contests_results'); 24 define('CR_ADMIN', PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CR_DIR . '/admin/admin.php');24 define('CR_ADMIN', get_root_url().'admin.php?page=plugin-' . CR_DIR); 25 25 define('CR_PUBLIC', make_index_url(array('section' => 'contests')) . '/'); 26 27 $ED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';")); 28 define('CR_ED_STATE', $ED['state']); 26 define('CR_ED_STATE', isset($pwg_loaded_plugins['ExtendedDescription']) ? 'active' : 'unactive'); 29 27 30 28 … … 32 30 // Triggers 33 31 // +-----------------------------------------------------------------------+ 34 add_event_handler('get_admin_plugin_menu_links', 'CR_admin_menu'); // Lien d'administration 35 add_event_handler('loc_end_section_init', 'CR_section_init'); // Paramètre URL 36 add_event_handler('loc_end_index', 'CR_index'); // Contenu du la page 37 add_event_handler('loc_end_picture', 'CR_comment_picture', 10); // Commentaire sur la page image 32 add_event_handler('loading_lang', 'CR_load_lang'); // Chargement des fichiers de langue 33 add_event_handler('get_admin_plugin_menu_links', 'CR_admin_menu'); // Lien d'administration 34 add_event_handler('loc_end_section_init', 'CR_section_init'); // Paramètre URL 35 add_event_handler('loc_end_index', 'CR_index'); // Contenu du la page 36 add_event_handler('loc_end_picture', 'CR_comment_picture', 10); // Commentaire sur la page image 37 add_event_handler('get_stuffs_modules', 'CR_register_stuffs_module'); // Ajoute un module pour PWG Stuffs 38 38 if(CR_ED_STATE == 'active') add_event_handler('render_CR_content', 'get_user_language_desc'); // Textes multilangues 39 39 … … 43 43 // +-----------------------------------------------------------------------+ 44 44 include(CR_PATH . 'include/functions.php'); 45 $conf['ContestResults'] = unserialize($conf['ContestResults']); 46 45 47 // Gestion du menu 46 48 include(CR_PATH . 'include/cr_menubar.php'); 49 50 // Chargement des fichiers de langue et de la config 51 function CR_load_lang() { 52 load_language('plugin.lang', CR_PATH); 53 } 47 54 48 55 // Lien d'administration … … 59 66 global $tokens, $page, $conf; 60 67 61 load_language('plugin.lang', CR_PATH);62 63 68 if ($tokens[0] == 'contests') { // on est dans la section concours 64 69 $page['section'] = 'contests'; … … 67 72 if (isset($tokens[1]) AND !empty($tokens[1])) { // on est sur la page d'un concours 68 73 $tokens[1] = explode('-', $tokens[1]); 74 69 75 if (preg_match('#^([0-9]*)$#', $tokens[1][0])) { // is_int ne marche pas parce que le chiffre est stocké en (string) 70 76 $page['contest'] = $tokens[1][0]; 71 $page['title'] .= $conf['level_separator'] . trigger_event('render_CR_content', get_contest_name($page['contest'])); 77 78 if ($contest_name = get_contest_name($page['contest'])) { // vérifie si le concours existe 79 $page['title'] .= $conf['level_separator'] . trigger_event('render_CR_content', $contest_name); 80 } else { 81 page_not_found(l10n('CR_notavailable')); 82 } 72 83 } 73 84 } … … 88 99 } 89 100 101 // Ajoute un module pour PWG Stuffs 102 function CR_register_stuffs_module($modules) { 103 array_push($modules, array( 104 'path' => CR_PATH . '/stuffs_module', 105 'name' => CR_NAME, 106 'description' => l10n('CR_stuffs_desc'), 107 )); 108 109 return $modules; 110 } 111 90 112 // Ajoute le commentaire sur la page image 91 113 function CR_comment_picture() {
Note: See TracChangeset
for help on using the changeset viewer.