Changeset 4078 for extensions
- Timestamp:
- Oct 21, 2009, 4:00:39 PM (15 years ago)
- Location:
- extensions/adult_content
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/adult_content/class.inc.php
r3494 r4078 46 46 $menu->register_block(new RegisteredBlock('mbAdultContent', 'Adult Content', 'AC')); 47 47 } 48 48 function ac_lien_menu($menu) 49 { 50 array_push($menu, array('NAME' => 'Adult Content', 51 'URL' => get_admin_plugin_menu_link(get_root_url().'plugins/'.$this->plugin_name.'/admin/admin.php'))); 52 return $menu; 53 } 54 function get_template($file) 55 { 56 global $user, $template; 57 58 $dir = $this->plugin_path.'template/'; 59 $theme_file = $dir.$user['template'].'/'.$user['theme'].'/'.$file; 60 $template_file = $dir.$user['template'].'/'.$file; 61 62 if (file_exists($theme_file)) 63 { 64 return $theme_file; 65 } 66 elseif (file_exists($template_file)) 67 { 68 return $template_file; 69 } 70 else 71 { 72 return $dir.'yoga/'.$file; 73 } 74 } 75 76 function set_block_on_index () 77 { 78 global $page, $template; 79 80 if (isset($page['section']) and $page['section'] == 'categories') 81 { 82 $template->set_filename('ac_block', realpath($this->get_template('block.tpl') ) ); 83 $begin = 'PLUGIN_INDEX_CONTENT_BEFORE'; 84 $end = 'PLUGIN_INDEX_CONTENT_AFTER'; 85 $template->concat($begin, $template->parse('ac_block', true)); 86 } 87 } 49 88 function placer_identification($menu_ref_arr) 50 89 { … … 74 113 if (($block = $menu->get_block( 'mbAdultContent' )) != null) { 75 114 $block->set_title(l10n('ac_title_menu')); 76 $block->template = $this-> plugin_path.'template/'.$user['template'].'/opened.tpl';115 $block->template = $this->get_template('opened.tpl'); 77 116 } 78 117 } … … 82 121 if (($block = $menu->get_block( 'mbAdultContent' )) != null) { 83 122 $block->set_title(l10n('ac_title_fermer')); 84 $block->template = $this-> plugin_path.'template/'.$user['template'].'/closed.tpl';123 $block->template = $this->get_template('closed.tpl'); 85 124 } 86 125 … … 93 132 if (($block = $menu->get_block( 'mbAdultContent' )) != null) { 94 133 $block->set_title(l10n('ac_title_fermer')); 95 $block->template = $this-> plugin_path.'template/'.$user['template'].'/closed.tpl';134 $block->template = $this->get_template('closed.tpl'); 96 135 } 97 136 } … … 101 140 if (($block = $menu->get_block( 'mbAdultContent' )) != null) { 102 141 $block->set_title(l10n('ac_title_menu')); 103 $block->template = $this-> plugin_path.'template/'.$user['template'].'/opened.tpl';142 $block->template = $this->get_template('opened.tpl'); 104 143 } 105 144 … … 117 156 if (($block = $menu->get_block( 'mbAdultContent' )) != null) { 118 157 $block->set_title(l10n('ac_title_menu')); 119 $block->template = $this-> plugin_path.'template/'.$user['template'].'/msg.tpl';158 $block->template = $this->get_template('msg.tpl'); 120 159 } 121 160 … … 133 172 if (($block = $menu->get_block( 'mbAdultContent' )) != null) { 134 173 $block->set_title(l10n('ac_title_menu')); 135 $block->template = $this-> plugin_path.'template/'.$user['template'].'/msg.tpl';174 $block->template = $this->get_template('msg.tpl'); 136 175 } 137 176 -
extensions/adult_content/main.inc.php
r3654 r4078 17 17 define('AC_NAME', basename(dirname(__FILE__)) ); 18 18 19 global $prefixeTable; 20 define('AC_CONF' , $prefixeTable . 'ac_config'); 21 19 22 include_once(dirname(__FILE__).'/class.inc.php'); 20 21 add_event_handler('register_user', array(&$adult_content, 'on_register') ); 22 23 // Ajout une entrée dans le menubar 24 add_event_handler('blockmanager_register_blocks', array(&$adult_content, 'register_ac_menubar_blocks')); 25 add_event_handler('blockmanager_apply', array(&$adult_content, 'placer_identification')); 23 add_event_handler('get_admin_plugin_menu_links', array(&$adult_content, 'ac_lien_menu') ); 24 add_event_handler('register_user', array(&$adult_content, 'on_register') ); 25 // Ajout une entrée dans le menubar 26 add_event_handler('blockmanager_register_blocks', array(&$adult_content, 'register_ac_menubar_blocks')); 27 add_event_handler('blockmanager_apply', array(&$adult_content, 'placer_identification')); 28 //block on index 29 add_event_handler('loc_begin_index', array(&$adult_content, 'set_block_on_index')); 26 30 27 31 28 32 add_event_handler('loc_end_picture', 'comment_manage'); 33 function comment_manage() 34 { 35 global $user, $template; 36 if ( ($user['username']=='18' or $user['username']=='16') and !$conf['comments_forall'] ) 37 { 38 $template->clear_assign('comment_add'); 39 } 40 } 29 41 $adult_content = new Adultcontent($plugin_name, $plugin_path); 30 42 set_plugin_data($adult_content->plugin_name, $adult_content);
Note: See TracChangeset
for help on using the changeset viewer.