| [ Index ] |
|
Code source de e107 0.7.8 |
1 <?php 2 /* 3 +---------------------------------------------------------------+ 4 | e107 website system 5 | /admin/review.php 6 | 7 | ©Steve Dunstan 2001-2002 8 | http://e107.org 9 | jalist@e107.org 10 | 11 | Released under the terms and conditions of the 12 | GNU General Public License (http://gnu.org). 13 | 14 | $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/handlers/content_class.php,v $ 15 | $Revision: 1.110 $ 16 | $Date: 2007/01/17 14:04:06 $ 17 | $Author: lisa_ $ 18 +---------------------------------------------------------------+ 19 */ 20 21 if (!defined('e107_INIT')) { exit; } 22 23 global $plugindir, $plugintable, $datequery; 24 $plugindir = e_PLUGIN."content/"; 25 $plugintable = "pcontent"; //name of the table used in this plugin (never remove this, as it's being used throughout the plugin !!) 26 $datequery = " AND content_datestamp < ".time()." AND (content_enddate=0 || content_enddate>".time().") "; 27 28 require_once ($plugindir."handlers/content_defines.php"); 29 30 if(!is_object($sql)){ $sql = new db; } 31 32 class content{ 33 34 function ContentDefaultPrefs(){ 35 global $tp; 36 37 //ADMIN CREATE FORM 38 $content_pref['content_admin_subheading'] = "1"; //should subheading be available 39 $content_pref['content_admin_summary'] = "1"; //should summary be available 40 $content_pref['content_admin_startdate'] = "1"; //should start date be available 41 $content_pref['content_admin_enddate'] = "1"; //should end date be available 42 $content_pref['content_admin_icon'] = "0"; //should icon be available to add when creating an item 43 $content_pref['content_admin_attach'] = "0"; //should file be available to add when creating an item 44 $content_pref['content_admin_images'] = "0"; //should image be available to add when creating an item 45 $content_pref['content_admin_comment'] = "1"; //should comment be available to add when creating an item 46 $content_pref['content_admin_rating'] = "1"; //should rating be available to add when creating an item 47 $content_pref['content_admin_score'] = "1"; //should score be available to add when creating an item 48 $content_pref['content_admin_pe'] = "1"; //should printemailicons be available to add when creating an item 49 $content_pref['content_admin_visibility'] = "1"; //should visibility be available to add when creating an item 50 $content_pref['content_admin_meta'] = "0"; //should metatags be available to add when creating an item 51 $content_pref['content_admin_custom_number'] = "0"; //how many customtags should be available to add when creating an item 52 $content_pref['content_admin_images_number'] = "0"; //how many images should be available to add when creating an item 53 $content_pref['content_admin_files_number'] = "0"; //how many files should be available to add when creating an item 54 $content_pref['content_admin_layout'] = "0"; //should the option for choosing a layout template be shown 55 $content_pref['content_admin_customtags'] = "0"; //should options for adding additional data be shown 56 $content_pref['content_admin_presettags'] = "0"; //should preset data tags be shown 57 58 //ADMIN CREATE CATEGORY FORM 59 $content_pref['content_admincat_subheading'] = '1'; //should subheading be available 60 $content_pref['content_admincat_startdate'] = '1'; //should startdate be available 61 $content_pref['content_admincat_enddate'] = '1'; //should enddate be available 62 $content_pref['content_admincat_uploadicon'] = '1'; //should uploadicon be available 63 $content_pref['content_admincat_selecticon'] = '1'; //should selecticon be available 64 $content_pref['content_admincat_comment'] = '1'; //should comment be available 65 $content_pref['content_admincat_rating'] = '1'; //should rating be available 66 $content_pref['content_admincat_pe'] = '1'; //should print email icons be available 67 $content_pref['content_admincat_visibility'] = '1'; //should visibility be available 68 69 //SUBMIT FORM 70 $content_pref['content_submit'] = "0"; //should users be able to submit an item 71 $content_pref['content_submit_class'] = "0"; //define which userclass is able to submit an item 72 $content_pref['content_submit_directpost'] ="0"; //should submission be direclty posted as an item, or have them validated by admins 73 $content_pref['content_submit_subheading'] = '1'; //should subheading be available 74 $content_pref['content_submit_summary'] = '1'; //should summary be available 75 $content_pref['content_submit_startdate'] = '1'; //should startdate be available 76 $content_pref['content_submit_enddate'] = '1'; //should enddate be available 77 $content_pref['content_submit_icon'] = "0"; //should icon be available to add when submitting an item 78 $content_pref['content_submit_attach'] = "0"; //should file be available to add when submitting an item 79 $content_pref['content_submit_images'] = "0"; //should image be available to add when submitting an item 80 $content_pref['content_submit_comment'] = "0"; //should comment be available to add when submitting an item 81 $content_pref['content_submit_rating'] = "0"; //should rating be available to add when submitting an item 82 $content_pref['content_submit_score'] = "0"; //should score be available to add when submitting an item 83 $content_pref['content_submit_pe'] = "0"; //should printemailicons be available to add when submitting an item 84 $content_pref['content_submit_visibility'] = "0"; //should visibility be available to add when submitting an item 85 $content_pref['content_submit_meta'] = "0"; //should metatags be available to add when submitting an item 86 $content_pref['content_submit_custom_number'] = "0"; //how many customtags should be available to add when submitting an item 87 $content_pref['content_submit_images_number'] = "0"; //how many images should be available to add when submitting an item 88 $content_pref['content_submit_files_number'] = "0"; //how many files should be available to add when submitting an item 89 $content_pref['content_submit_layout'] = "0"; //should the option for choosing a layout template be shown 90 $content_pref['content_submit_customtags'] = "0"; //should options for adding additional data be shown 91 $content_pref['content_submit_presettags'] = "0"; //should preset data tags be shown 92 93 //PATH THEME CSS 94 $content_pref['content_cat_icon_path_large'] = "{e_PLUGIN}content/images/cat/48/"; //default path to large categry icons 95 $content_pref['content_cat_icon_path_small'] = "{e_PLUGIN}content/images/cat/16/"; //default path to small category icons 96 97 $content_pref['content_icon_path'] = "{e_PLUGIN}content/images/icon/"; //default path to item icons 98 $content_pref['content_icon_path_tmp'] = "{e_PLUGIN}content/images/icon/tmp/"; //default tmp path to item icons 99 100 $content_pref['content_image_path'] = "{e_PLUGIN}content/images/image/"; //default path to item images 101 $content_pref['content_image_path_tmp'] = "{e_PLUGIN}content/images/image/tmp/"; //default tmp path to item images 102 103 $content_pref['content_file_path'] = "{e_PLUGIN}content/images/file/"; //default path to item file attachments 104 $content_pref['content_file_path_tmp'] = "{e_PLUGIN}content/images/file/tmp/"; //default tmp path to item file attachments 105 106 $content_pref['content_theme'] = "{e_PLUGIN}content/templates/default/"; //choose theme for main parent 107 $content_pref['content_layout'] = "content_content_template.php"; //choose default layout scheme 108 109 //GENERAL 110 $content_pref['content_log'] = "0"; //activate log 111 $content_pref['content_blank_icon'] = "0"; //use blank icon if no icon present 112 $content_pref['content_blank_caticon'] = "0"; //use blank caticon if no caticon present 113 $content_pref['content_breadcrumb_catall'] = "0"; //show breadcrumb on all categories page 114 $content_pref['content_breadcrumb_cat'] = "0"; //show breadcrumb on single category page 115 $content_pref['content_breadcrumb_authorall'] = "0"; //show breadcrumb on all author page 116 $content_pref['content_breadcrumb_author'] = "0"; //show breadcrumb on single author page 117 $content_pref['content_breadcrumb_recent'] = "0"; //show breadcrumb on recent page 118 $content_pref['content_breadcrumb_item'] = "0"; //show breadcrumb on content item page 119 $content_pref['content_breadcrumb_top'] = "0"; //show breadcrumb on top rated page 120 $content_pref['content_breadcrumb_archive'] = "0"; //show breadcrumb on archive page 121 $content_pref['content_breadcrumb_seperator{$id}'] = ">"; //seperator character between breadcrumb 122 $content_pref['content_breadcrumb_rendertype'] = "2"; //how to render the breadcrumb 123 $content_pref['content_navigator_catall'] = "0"; //show navigator on all categories page 124 $content_pref['content_navigator_cat'] = "0"; //show navigator on single category page 125 $content_pref['content_navigator_authorall'] = "0"; //show navigator on all author page 126 $content_pref['content_navigator_author'] = "0"; //show navigator on single author page 127 $content_pref['content_navigator_recent'] = "0"; //show navigator on recent page 128 $content_pref['content_navigator_item'] = "0"; //show navigator on content item page 129 $content_pref['content_navigator_top'] = "0"; //show navigator on top rated page 130 $content_pref['content_navigator_archive'] = "0"; //show navigator on archive page 131 $content_pref['content_search_catall'] = "0"; //show search keyword on all categories page 132 $content_pref['content_search_cat'] = "0"; //show search keyword on single category page 133 $content_pref['content_search_authorall'] = "0"; //show search keyword on all author page 134 $content_pref['content_search_author'] = "0"; //show search keyword on single author page 135 $content_pref['content_search_recent'] = "0"; //show search keyword on recent page 136 $content_pref['content_search_item'] = "0"; //show search keyword on content item page 137 $content_pref['content_search_top'] = "0"; //show search keyword on top rated page 138 $content_pref['content_search_archive'] = "0"; //show search keyword on archive page 139 $content_pref['content_ordering_catall'] = "0"; //show ordering on all categories page 140 $content_pref['content_ordering_cat'] = "0"; //show ordering on single category page 141 $content_pref['content_ordering_authorall'] = "0"; //show ordering on all author page 142 $content_pref['content_ordering_author'] = "0"; //show ordering on single author page 143 $content_pref['content_ordering_recent'] = "0"; //show ordering on recent page 144 $content_pref['content_ordering_item'] = "0"; //show ordering on content item page 145 $content_pref['content_ordering_top'] = "0"; //show ordering on top rated page 146 $content_pref['content_ordering_archive'] = "0"; //show ordering on archive page 147 $content_pref['content_searchmenu_rendertype'] = "1"; //rendertype for searchmenu (1=echo, 2=in separate menu) 148 $content_pref['content_nextprev'] = "1"; //use nextprev buttons 149 $content_pref['content_nextprev_number'] = "10"; //how many items on a page 150 $content_pref['content_defaultorder'] = "orderddate"; //default sort and order method 151 //upload icon/image size handling 152 $content_pref['content_upload_image_size'] = "500"; //resize size of uploaded image 153 $content_pref['content_upload_image_size_thumb'] = "100"; //resize size of created thumb on uploaded image 154 $content_pref['content_upload_icon_size'] = "100"; //resize size of uploaded icon 155 156 //CONTENT ITEM PREVIEW 157 $content_pref['content_list_icon'] = "0"; //show icon 158 $content_pref['content_list_subheading'] = "1"; //show subheading 159 $content_pref['content_list_summary'] = "1"; //show summary 160 $content_pref['content_list_text'] = "0"; //show (part of) text 161 $content_pref['content_list_date'] = "0"; //show date 162 $content_pref['content_list_authorname'] = "0"; //show authorname 163 $content_pref['content_list_authorprofile'] = "0"; //show link to author profile 164 $content_pref['content_list_authoremail'] = "0"; //show authoremail 165 $content_pref['content_list_authoricon'] = "0"; //show link to author list 166 $content_pref['content_list_rating'] = "1"; //show rating system 167 $content_pref['content_list_peicon'] = "1"; //show printemailicons 168 $content_pref['content_list_parent'] = "0"; //show parent cat 169 $content_pref['content_list_refer'] = "0"; //show refer count 170 $content_pref['content_list_subheading_char'] = "100"; //how many subheading characters 171 $content_pref['content_list_subheading_post'] = "[...]"; //use a postfix for too long subheadings 172 $content_pref['content_list_summary_char'] = "100"; //how many summary characters 173 $content_pref['content_list_summary_post'] = "[...]"; //use a postfix for too long summary 174 $content_pref['content_list_text_char'] = "60"; //how many text words 175 $content_pref['content_list_text_post'] = CONTENT_LAN_16; //use a postfix for too long text 176 $content_pref['content_list_text_link'] = "1"; //show link to content item on postfix 177 $content_pref['content_list_authoremail_nonmember'] = "0"; //show email non member author 178 $content_pref['content_list_peicon_all'] = "0"; //override printemail icons 179 $content_pref['content_list_rating_all'] = "0"; //override rating system 180 $content_pref['content_list_editicon'] = "0"; //show link to admin edit item 181 $content_pref['content_list_datestyle'] = "%d %b %Y"; //choose datestyle for given date 182 $content_pref['content_list_caption'] = CONTENT_LAN_23; //caption for recent list 183 $content_pref['content_list_caption_append_name'] = '1'; //append category heading to caption 184 185 //CATEGORY PAGES 186 //sections of content category in 'view all categories page' 187 $content_pref['content_catall_icon'] = "1"; //show icon 188 $content_pref['content_catall_subheading'] = "1"; //show subheading 189 $content_pref['content_catall_text'] = "0"; //show text 190 $content_pref['content_catall_date'] = "0"; //show date 191 $content_pref['content_catall_rating'] = "1"; //show rating 192 $content_pref['content_catall_authorname'] = "0"; //show author name 193 $content_pref['content_catall_authoremail'] = "0"; //show author email 194 $content_pref['content_catall_authorprofile'] = "0"; //show link to author profile 195 $content_pref['content_catall_authoricon'] = "0"; //show link to author list 196 $content_pref['content_catall_peicon'] = "1"; //show pe icons 197 $content_pref['content_catall_comment'] = "1"; //show amount of comments 198 $content_pref['content_catall_amount'] = "0"; //show amount of items 199 $content_pref['content_catall_text_char'] = "65"; //define amount of words of text to display 200 $content_pref['content_catall_text_post'] = CONTENT_LAN_16; //define postfix is text is too long 201 $content_pref['content_catall_text_link'] = "1"; //define if link to category should be added on postfix 202 $content_pref['content_catall_caption'] = CONTENT_LAN_25; //caption for all categories page 203 //sections of content category in 'view category' page 204 $content_pref['content_cat_icon'] = "1"; //show icon 205 $content_pref['content_cat_subheading'] = "1"; //show subheading 206 $content_pref['content_cat_text'] = "0"; //show text 207 $content_pref['content_cat_date'] = "0"; //show date 208 $content_pref['content_cat_authorname'] = "0"; //show author name 209 $content_pref['content_cat_authoremail'] = "0"; //show author email 210 $content_pref['content_cat_authorprofile'] = "0"; //show link to author profile 211 $content_pref['content_cat_authoricon'] = "0"; //show link to author list 212 $content_pref['content_cat_rating'] = "1"; //show rating 213 $content_pref['content_cat_peicon'] = "1"; //show pe icons 214 $content_pref['content_cat_comment'] = "1"; //show amount of comments 215 $content_pref['content_cat_amount'] = "1"; //show amount of items 216 $content_pref['content_cat_caption'] = CONTENT_LAN_26; //caption for single category page 217 $content_pref['content_cat_caption_append_name'] = '1'; //append category heading to caption 218 $content_pref['content_cat_sub_caption'] = CONTENT_LAN_28; //caption for subcategories 219 $content_pref['content_cat_item_caption'] = CONTENT_LAN_31; //caption for items in category 220 221 //sections of subcategories in 'view category page' 222 $content_pref['content_catsub_icon'] = "1"; //show icon 223 $content_pref['content_catsub_subheading'] = "1"; //show subheading 224 $content_pref['content_catsub_amount'] = "1"; //show amount of items 225 $content_pref['content_cat_showparent'] = "1"; //show parent item in category page 226 $content_pref['content_cat_showparentsub'] = "1"; //show subcategories in category page 227 $content_pref['content_cat_listtype'] = "0"; //also show items from subategories 228 $content_pref['content_cat_menuorder'] = "1"; //order of parent and child items 229 $content_pref['content_cat_rendertype'] = "2"; //render method of the menus 230 $content_pref['content_cat_text_char'] = "65"; //define amount of words of text to display 231 $content_pref['content_cat_text_post'] = CONTENT_LAN_16; //define postfix is text is too long 232 $content_pref['content_cat_text_link'] = "1"; //define if link to category should be added on postfix 233 $content_pref['content_cat_authoremail_nonmember'] = "0"; //define if the email of a non-member will be displayed 234 $content_pref['content_cat_peicon_all'] = "0"; //override printemail icons 235 $content_pref['content_cat_rating_all'] = "0"; //override rating system 236 237 //CONTENT PAGE 238 $content_pref['content_content_icon'] = "0"; //show icon 239 $content_pref['content_content_subheading'] = "1"; //show subheading 240 $content_pref['content_content_summary'] = "1"; //show summary 241 $content_pref['content_content_date'] = "0"; //show date 242 $content_pref['content_content_authorname'] = "1"; //show authorname 243 $content_pref['content_content_authorprofile'] = "0"; //show link to author profile 244 $content_pref['content_content_authoremail'] = "0"; //show suthoremail 245 $content_pref['content_content_authoricon'] = "0"; //show link to author list 246 $content_pref['content_content_parent'] = "0"; //show parent category 247 $content_pref['content_content_rating'] = "1"; //show rating system 248 $content_pref['content_content_peicon'] = "1"; //show printemailicons 249 $content_pref['content_content_refer'] = "0"; //show refer count 250 $content_pref['content_content_comment'] = "0"; //show amount of comments 251 $content_pref['content_content_authoremail_nonmember'] = "0"; //show email non member 252 $content_pref['content_content_peicon_all'] = "0"; //override printemail icons 253 $content_pref['content_content_rating_all'] = "0"; //override rating system 254 $content_pref['content_content_comment_all'] = "0"; //override comment system 255 $content_pref['content_content_editicon'] = "0"; //show link in content page to admin edit item 256 $content_pref['content_content_customtags'] = "0"; //should additional data be shown 257 $content_pref['content_content_presettags'] = "0"; //should preset data tags be shown 258 $content_pref['content_content_attach'] = "0"; //show attachments 259 $content_pref['content_content_images'] = "0"; //show images 260 $content_pref['content_content_pagenames_rendertype'] = "0"; //rendertype for articleindex on multipage content items 261 $content_pref['content_content_multipage_preset'] = "0"; //render custom/preset in multipage item first/last page 262 263 //AUTHOR PAGE 264 $content_pref['content_author_lastitem'] = "0"; //show last item reference 265 $content_pref['content_author_amount'] = "1"; //show amount of items from this author 266 $content_pref['content_author_nextprev'] = "1"; //use next prev buttons 267 $content_pref['content_author_nextprev_number'] = "20"; //amount of items per page 268 $content_pref['content_author_index_caption'] = CONTENT_LAN_32; //caption for author index page 269 $content_pref['content_author_caption'] = CONTENT_LAN_32; //caption for single author page 270 $content_pref['content_author_caption_append_name'] = '1'; //append author name to caption 271 272 //ARCHIVE PAGE 273 $content_pref['content_archive_nextprev'] = "1"; //archive : choose to show next/prev links 274 $content_pref['content_archive_nextprev_number'] = "30"; //archive : choose amount to use in next/prev 275 $content_pref['content_archive_letterindex'] = "0"; //archive : letter index 276 $content_pref['content_archive_datestyle'] = "%d %b %Y"; //archive : choose datestyle for given date 277 $content_pref['content_archive_date'] = "1"; //archive : section: show date 278 $content_pref['content_archive_authorname'] = "0"; //archive : section: show authorname 279 $content_pref['content_archive_authorprofile'] = "0"; //archive : section: show link to author profile 280 $content_pref['content_archive_authoricon'] = "0"; //archive : section: show link to author list 281 $content_pref['content_archive_authoremail'] = "0"; //archive : section: show author email 282 $content_pref['content_archive_authoremail_nonmember'] = "0"; //archive : show link to email of non-member author 283 $content_pref['content_archive_caption'] = CONTENT_LAN_84; //caption for archive page 284 285 //TOP RATED PAGE 286 $content_pref['content_top_icon'] = "0"; //top : section: show icon 287 $content_pref['content_top_authorname'] = "0"; //top : section: show authorname 288 $content_pref['content_top_authorprofile'] = "0"; //top : section: show link to author profile 289 $content_pref['content_top_authoricon'] = "0"; //top : section: show link to author list 290 $content_pref['content_top_authoremail'] = "0"; //top : section: show author email 291 $content_pref['content_top_authoremail_nonmember'] = "0"; //top : show link to email of non-member author 292 $content_pref['content_top_icon_width'] = ''; //use this size for icon 293 $content_pref['content_top_caption'] = CONTENT_LAN_38; //caption for top rated page 294 $content_pref['content_top_caption_append_name'] = '1'; //append category heading to caption 295 296 //TOP SCORE PAGE 297 $content_pref['content_score_icon'] = "0"; //score : section: show icon 298 $content_pref['content_score_authorname'] = "0"; //score : section: show authorname 299 $content_pref['content_score_authorprofile'] = "0"; //score : section: show link to author profile 300 $content_pref['content_score_authoricon'] = "0"; //score : section: show link to author list 301 $content_pref['content_score_authoremail'] = "0"; //score : section: show author email 302 $content_pref['content_score_authoremail_nonmember'] = "0"; //score : show link to email of non-member author 303 $content_pref['content_score_icon_width'] = ''; //use this size for icon 304 $content_pref['content_score_caption'] = CONTENT_LAN_87; //caption for top score page 305 $content_pref['content_score_caption_append_name'] = '1'; //append category heading to caption 306 307 //MENU OPTIONS 308 $content_pref['content_menu_caption'] = CONTENT_MENU_LAN_0; //caption of menu 309 $content_pref['content_menu_search'] = "0"; //show search keyword 310 $content_pref['content_menu_sort'] = "0"; //show sorting methods 311 $content_pref['content_menu_links'] = "1"; //show content links 312 $content_pref['content_menu_links_dropdown'] = "0"; //rendertype of content links (in dropdown or as normal links) 313 $content_pref['content_menu_links_icon'] = "0"; //define icon for content links (only with normallinks) 314 $content_pref['content_menu_links_caption'] = CONTENT_MENU_LAN_4; //define caption for link list (only is normallinks is selected) 315 $content_pref['content_menu_viewallcat'] = "1"; //menu: view link to all categories 316 $content_pref['content_menu_viewallauthor'] = "1"; //menu: view link to all authors 317 $content_pref['content_menu_viewallitems'] = "1"; //menu: view link to all items (archive) 318 $content_pref['content_menu_viewtoprated'] = "0"; //menu: view link to top rated items 319 $content_pref['content_menu_viewtopscore'] = "0"; //menu: view link to top score items 320 $content_pref['content_menu_viewrecent'] = "1"; //menu: view link to recent items 321 $content_pref['content_menu_viewsubmit'] = "0"; //view link to submit content item (only if it is allowed) 322 $content_pref['content_menu_viewicon'] = "0"; //choose icon to display for links 323 $content_pref['content_menu_cat'] = "1"; //view categories 324 $content_pref['content_menu_cat_main'] = "1"; //show main parent in the category list 325 $content_pref['content_menu_cat_number'] = "1"; //show number of items in category 326 $content_pref['content_menu_cat_icon'] = "0"; //choose icon to display for categories 327 $content_pref['content_menu_cat_icon_default'] = "0"; //choose default icon is no icon present (only if category_icon is selected) 328 $content_pref['content_menu_cat_caption'] = CONTENT_MENU_LAN_3; //define caption for category list 329 $content_pref['content_menu_cat_dropdown'] = "0"; //rendertype of categories (in dropdown or as normal links) 330 $content_pref['content_menu_recent'] = "1"; //view recent list 331 $content_pref['content_menu_recent_caption'] = CONTENT_MENU_LAN_2; //caption of recent list 332 $content_pref['content_menu_recent_number'] = "5"; //number of recent items to show 333 $content_pref['content_menu_recent_date'] = "0"; //show date in recent list 334 $content_pref['content_menu_recent_datestyle'] = "%d %b %Y"; //choose datestyle for given date 335 $content_pref['content_menu_recent_author'] = "0"; //show author in recent list 336 $content_pref['content_menu_recent_subheading'] = "0"; //show subheading in recent list 337 $content_pref['content_menu_recent_subheading_char'] = "80"; //number of characters of subheading to show 338 $content_pref['content_menu_recent_subheading_post'] = "[...]"; //postfix for too long subheadings 339 $content_pref['content_menu_recent_icon'] = "0"; //choose icon to display for recent items 340 $content_pref['content_menu_recent_icon_width'] = "50"; //specify width of icon (only if content_icon is set) 341 342 $content_pref['content_inherit'] = '0'; //inherit options from default preferences 343 344 //CONTENT MANAGER 345 $content_pref['content_manager_approve'] = '0'; //class for managers who can approve submitted items 346 $content_pref['content_manager_personal'] = '0'; //class for managers who can manage personal items 347 $content_pref['content_manager_category'] = '0'; //class for managers who can manage all items in a category 348 349 //PAGE RESTRICTION (NOT YET IN USE) 350 $content_pref['content_restrict_managecontent'] = '0'; 351 $content_pref['content_restrict_createcontent'] = '0'; 352 $content_pref['content_restrict_managecat'] = '0'; 353 $content_pref['content_restrict_createcat'] = '0'; 354 $content_pref['content_restrict_order'] = '0'; 355 $content_pref['content_restrict_options'] = '0'; 356 $content_pref['content_restrict_adminmanager'] = '0'; 357 $content_pref['content_restrict_restrict'] = '0'; 358 $content_pref['content_restrict_recent'] = '0'; 359 $content_pref['content_restrict_allcat'] = '0'; 360 $content_pref['content_restrict_onecat'] = '0'; 361 $content_pref['content_restrict_contentitem'] = '0'; 362 $content_pref['content_restrict_author'] = '0'; 363 $content_pref['content_restrict_archive'] = '0'; 364 $content_pref['content_restrict_toprated'] = '0'; 365 $content_pref['content_restrict_topscore'] = '0'; 366 $content_pref['content_restrict_submit'] = '0'; 367 $content_pref['content_restrict_frontmanager'] = '0'; 368 369 return $content_pref; 370 } 371 372 373 374 function getContentPref($id="") { 375 global $sql, $plugintable, $qs, $tp, $eArrayStorage; 376 377 $plugintable = "pcontent"; 378 379 //echo "get content pref : ".$id."<br />"; 380 381 if($id && $id!="0"){ //if $id; use prefs from content table 382 $id = intval($id); 383 $num_rows = $sql -> db_Select($plugintable, "content_pref", "content_id='$id' "); 384 $row = $sql -> db_Fetch(); 385 if (empty($row['content_pref'])) { 386 //if no prefs present yet, get them from core (default preferences) 387 $num_rows = $sql -> db_Select("core", "*", "e107_name='$plugintable' "); 388 //if those are not present, insert the default ones given in this file 389 if ($num_rows == 0) { 390 $content_pref = $this -> ContentDefaultPrefs(); 391 $tmp = $eArrayStorage->WriteArray($content_pref); 392 $sql -> db_Insert("core", "'$plugintable', '{$tmp}' "); 393 $sql -> db_Select("core", "*", "e107_name='$plugintable' "); 394 } 395 $row = $sql -> db_Fetch(); 396 $content_pref = $eArrayStorage->ReadArray($row['e107_value']); 397 398 //create array of custom preset tags 399 foreach($content_pref['content_custom_preset_key'] as $ck => $cv){ 400 if(!empty($cv)){ 401 $string[] = $cv; 402 } 403 } 404 if($string){ 405 $content_pref['content_custom_preset_key'] = $string; 406 }else{ 407 unset($content_pref['content_custom_preset_key']); 408 } 409 410 //finally we can store the new default prefs into the db 411 $tmp1 = $eArrayStorage->WriteArray($content_pref); 412 $sql -> db_Update($plugintable, "content_pref='{$tmp1}' WHERE content_id='$id' "); 413 $sql -> db_Select($plugintable, "content_pref", "content_id='$id' "); 414 $row = $sql -> db_Fetch(); 415 } 416 $content_pref = $eArrayStorage->ReadArray($row['content_pref']); 417 418 if(e_PAGE == "admin_content_config.php" && isset($qs[0]) && $qs[0] == 'option'){ 419 }else{ 420 //check inheritance, if set, get core prefs (default prefs) 421 if(isset($content_pref['content_inherit']) && $content_pref['content_inherit']!=''){ 422 $sql -> db_Select("core", "*", "e107_name='$plugintable' "); 423 $row = $sql -> db_Fetch(); 424 $content_pref = $eArrayStorage->ReadArray($row['e107_value']); 425 } 426 } 427 428 }else{ //if not $id; use prefs from default core table 429 $num_rows = $sql -> db_Select("core", "*", "e107_name='$plugintable' "); 430 if ($num_rows == 0) { 431 $content_pref = $this -> ContentDefaultPrefs(); 432 $tmp = $eArrayStorage->WriteArray($content_pref); 433 $sql -> db_Insert("core", "'$plugintable', '{$tmp}' "); 434 $sql -> db_Select("core", "*", "e107_name='$plugintable' "); 435 } 436 $row = $sql -> db_Fetch(); 437 $content_pref = $eArrayStorage->ReadArray($row['e107_value']); 438 } 439 return $content_pref; 440 } 441 442 //admin 443 function UpdateContentPref($id){ 444 global $qs, $plugintable, $sql, $tp, $eArrayStorage; 445 446 if(!is_object($sql)){ $sql = new db; } 447 448 //echo "update content pref : ".$id."<br />"; 449 450 //insert default preferences into core 451 if($id == "0"){ 452 $num_rows = $sql -> db_Select("core", "*", "e107_name='$plugintable' "); 453 if ($num_rows == 0) { 454 $sql -> db_Insert("core", "'$plugintable', '' "); 455 }else{ 456 $row = $sql -> db_Fetch(); 457 } 458 459 //insert category preferences into plugintable 460 }else{ 461 $sql -> db_Select($plugintable, "content_pref", "content_id='".intval($id)."' "); 462 $row = $sql -> db_Fetch(); 463 $current = $eArrayStorage->ReadArray($row['content_pref']); 464 foreach($current as $k => $v){ 465 if(isset($qs[0]) && $qs[0] == 'option' ){ 466 if( strpos($k, "content_manager_") === 0 || strpos($k, "content_restrict_") === 0 ){ 467 $content_pref[$k] = $tp->toDB($v); 468 } 469 }elseif(isset($qs[0]) && ($qs[0] == 'manager' || $qs[0] == 'restrict')){ 470 if( strpos($k, "content_") === 0 ){ 471 $content_pref[$k] = $tp->toDB($v); 472 } 473 } 474 } 475 } 476 477 //create array of custom preset tags 478 foreach($_POST['content_custom_preset_key'] as $ck => $cv){ 479 if(!empty($cv)){ 480 $string[] = $cv; 481 } 482 } 483 $_POST['content_custom_preset_key'] = $string; 484 485 //echo "<pre>"; print_r($_POST); echo "</pre>"; 486 487 foreach($_POST as $k => $v){ 488 if(strpos($k, "content_") === 0){ 489 $content_pref[$k] = $tp->toDB($v); 490 } 491 } 492 493 //create new array of preferences 494 $tmp = $eArrayStorage->WriteArray($content_pref); 495 if($id == "0"){ 496 $sql -> db_Update("core", "e107_value = '{$tmp}' WHERE e107_name = '$plugintable' "); 497 }else{ 498 $sql -> db_Update($plugintable, "content_pref='{$tmp}' WHERE content_id='".intval($id)."' "); 499 } 500 501 return $content_pref; 502 } 503 504 function CONTENTREGEXP($var){ 505 return "(^|,)(".str_replace(",", "|", $var).")(,|$)"; 506 } 507 508 function getCategoryTree($id, $parent, $classcheck=TRUE){ 509 //id : content_parent of an item 510 global $plugintable, $datequery; 511 global $agc; 512 513 if($parent){ 514 $agc = ""; 515 $qrygc = " content_id = '".intval($parent)."' "; 516 }else{ 517 $qrygc = " content_parent = '0' "; 518 } 519 if($id){ 520 $qrygc = " content_parent = '0.".intval($id)."' "; 521 } 522 523 if($classcheck == TRUE){ 524 $qrygc .= " AND content_class REGEXP '".e_CLASS_REGEXP."' "; 525 } 526 527 $datequery = " AND content_datestamp < ".time()." AND (content_enddate=0 || content_enddate>".time().") "; 528 529 $sqlgetcat = new db; 530 if($sqlgetcat -> db_Select($plugintable, "content_id, content_heading, content_parent", " ".$qrygc." ".$datequery." " )){ 531 while($row = $sqlgetcat -> db_Fetch()){ 532 if($agc){ 533 if($row['content_parent'] != "0"){ 534 if(array_key_exists(substr($row['content_parent'],2), $agc)){ 535 if(is_array($agc[substr($row['content_parent'],2)])){ 536 $agc[$row['content_id']] = array_merge_recursive($agc[substr($row['content_parent'],2)], array($row['content_id'], $row['content_heading'])); 537 }else{ 538 $agc[$row['content_id']] = array($agc[substr($row['content_parent'],2)], array($row['content_id'], $row['content_heading'])); 539 } 540 541 }else{ 542 $agc[$row['content_id']] = array($row['content_id'], $row['content_heading']); 543 } 544 }else{ 545 $agc[$row['content_id']] = array($row['content_id'], $row['content_heading']); 546 } 547 }else{ 548 $agc[$row['content_id']] = array($row['content_id'], $row['content_heading']); 549 } 550 $this -> getCategoryTree($row['content_id'], "", $classcheck); 551 } 552 } 553 return $agc; 554 } 555 556 557 558 function getCrumbItem($id, $arr){ 559 //$id : content_parent of item 560 //$arr : array of all categories 561 $crumb = ""; 562 if(is_array($arr)){ 563 if(array_key_exists($id, $arr)){ 564 for($i=0;$i<count($arr[$id]);$i++){ 565 $crumb .= "<a href='".e_SELF."?cat.".$arr[$id][$i]."'>".$arr[$id][$i+1]."</a> > "; 566 $i++; 567 } 568 $crumb = substr($crumb,0,-3); 569 } 570 } 571 return $crumb; 572 } 573 574 function ShowNextPrev($mode='', $from='0', $number, $total){ 575 global $content_pref, $qs, $tp, $plugindir, $content_shortcodes, $CONTENT_NEXTPREV; 576 577 if($total<=$number){ 578 return; 579 } 580 581 $modepref = ($mode ? "content_{$mode}_nextprev" : "content_nextprev"); 582 if(isset($content_pref[$modepref]) && $content_pref[$modepref]){ 583 $np_querystring = e_SELF."?[FROM]".(isset($qs[0]) ? ".".$qs[0] : "").(isset($qs[1]) ? ".".$qs[1] : "").(isset($qs[2]) ? ".".$qs[2] : "").(isset($qs[3]) ? ".".$qs[3] : "").(isset($qs[4]) ? ".".$qs[4] : ""); 584 $parms = $total.",".$number.",".$from.",".$np_querystring.""; 585 586 $CONTENT_NEXTPREV = $tp->parseTemplate("{NEXTPREV={$parms}}"); 587 588 if(!isset($CONTENT_NP_TABLE)){ 589 if(!$content_pref["content_theme"]){ 590 require_once($plugindir."templates/default/content_np_template.php"); 591 }else{ 592 if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_np_template.php")){ 593 require_once($tp->replaceConstants($content_pref["content_theme"])."content_np_template.php"); 594 }else{ 595 require_once($plugindir."templates/default/content_np_template.php"); 596 } 597 } 598 } 599 echo $tp -> parseTemplate($CONTENT_NP_TABLE, FALSE, $content_shortcodes); 600 } 601 } 602 603 function getCrumbPage($mode, $arr, $parent){ 604 global $qs, $ns, $content_pref, $plugintable; 605 606 if(isset($content_pref["content_breadcrumb_{$mode}"]) && $content_pref["content_breadcrumb_{$mode}"]){ 607 $crumb = ''; 608 if(array_key_exists($parent, $arr)){ 609 $sep = (isset($content_pref["content_breadcrumb_seperator"]) ? $content_pref["content_breadcrumb_seperator"] : ">"); 610 if($content_pref["content_breadcrumb_base"] && isset($content_pref["content_breadcrumb_base"])){ 611 $crumb .= "<a href='".e_BASE."'>".CONTENT_LAN_58."</a> ".$sep." "; 612 } 613 if($content_pref["content_breadcrumb_self"] && isset($content_pref["content_breadcrumb_self"])){ 614 $crumb .= "<a href='".e_SELF."'>".CONTENT_LAN_59."</a> ".$sep." "; 615 } 616 for($i=0;$i<count($arr[$parent]);$i++){ 617 $crumb .= "<a href='".e_SELF."?cat.".$arr[$parent][$i]."'>".$arr[$parent][$i+1]."</a> ".$sep." "; 618 $i++; 619 } 620 } 621 if($qs[0] == "recent"){ 622 $crumb .= "<a href='".e_SELF."?recent.".$arr[$parent][0]."'>".CONTENT_LAN_60."</a>"; 623 } 624 if($qs[0] == "author"){ 625 $crumb .= "<a href='".e_SELF."?author.list.".$arr[$parent][0]."'>".CONTENT_LAN_85."</a>"; 626 if(is_numeric($qs[1])){ 627 global $sql; 628 $sql->db_Select($plugintable, "content_author","content_id='".intval($qs[1])."'"); 629 $row=$sql->db_Fetch(); 630 $au = $this->getAuthor($row['content_author']); 631 $crumb .= " ".$sep." <a href='".e_SELF."?author.".$qs[1]."'>".$au[1]."</a>"; 632 } 633 } 634 if($qs[0] == "list"){ 635 $crumb .= "<a href='".e_SELF."?list.".$arr[$parent][0]."'>".CONTENT_LAN_13."</a>"; 636 } 637 if($qs[0] == "top"){ 638 $crumb .= "<a href='".e_SELF."?top.".$arr[$parent][0]."'>".CONTENT_LAN_8."</a>"; 639 } 640 if($qs[0] == "score"){ 641 $crumb .= "<a href='".e_SELF."?score.".$arr[$parent][0]."'>".CONTENT_LAN_12."</a>"; 642 } 643 if($qs[0] == "content"){ 644 global $row; 645 $crumb .= $row['content_heading']; 646 } 647 $crumb = trim($crumb); 648 if(substr($crumb,-strlen(trim($sep))) == trim($sep)){ 649 $crumb = substr($crumb,0,-strlen(trim($sep))); 650 } 651 652 $crumb = "<div class='breadcrumb'>".$crumb."</div>"; 653 if(isset($content_pref["content_breadcrumb_rendertype"]) && $content_pref["content_breadcrumb_rendertype"] == "1"){ 654 echo $crumb; 655 return ""; 656 }elseif(isset($content_pref["content_breadcrumb_rendertype"]) && $content_pref["content_breadcrumb_rendertype"] == "2"){ 657 $ns -> tablerender(CONTENT_LAN_24, $crumb); 658 return ""; 659 }else{ 660 return $crumb; 661 } 662 }else{ 663 return ""; 664 } 665 } 666 667 668 669 function countCatItems($id){ 670 global $sqlcountitemsincat, $plugintable, $datequery; 671 //$id : category content_id 672 673 if(!is_object($sqlcountitemsincat)){ $sqlcountitemsincat = new db; } 674 $n = $sqlcountitemsincat -> db_Count($plugintable, "(*)", "WHERE content_class REGEXP '".e_CLASS_REGEXP."' AND content_parent='".intval($id)."' AND content_refer != 'sa' ".$datequery." "); 675 676 return $n; 677 } 678 679 680 function getCategoryHeading($id){ 681 global $plugintable, $sql; 682 $qry = " 683 SELECT c.*, p.* 684 FROM #pcontent as c 685 LEFT JOIN #pcontent as p ON p.content_id = c.content_parent 686 WHERE c.content_id = '".intval($id)."' "; 687 $sql -> db_Select_gen($qry); 688 $row2 = $sql -> db_Fetch(); 689 return $row2['content_heading']; 690 } 691 function getPageHeading($id){ 692 global $plugintable, $sql; 693 $sql -> db_Select($plugintable, "content_heading", "content_id='".intval($id)."' "); 694 $row2 = $sql -> db_Fetch(); 695 return $row2['content_heading']; 696 } 697 function setPageTitle(){ 698 global $plugintable, $sql, $qs; 699 700 //content page 701 if(e_PAGE == "content.php"){ 702 //main parent overview 703 if(!e_QUERY){ 704 $page = CONTENT_PAGETITLE_LAN_0; 705 }else{ 706 $sql -> db_Select($plugintable, "content_heading", "content_id = '".intval($qs[1])."' "); 707 $row = $sql -> db_Fetch(); 708 709 $page = CONTENT_PAGETITLE_LAN_0; 710 711 //recent of parent='2' 712 if($qs[0] == "recent" && is_numeric($qs[1]) && !isset($qs[2])){ 713 $page .= " / ".$row['content_heading']." / ".CONTENT_PAGETITLE_LAN_2; 714 715 //item 716 }elseif($qs[0] == "content" && isset($qs[1]) && is_numeric($qs[1]) ){ 717 $page .= " / ".$this -> getCategoryHeading($qs[1])." / ".$this -> getPageHeading($qs[1]); 718 719 //all categories of parent='2' 720 }elseif($qs[0] == "cat" && $qs[1] == "list" && is_numeric($qs[2])){ 721 $page .= " / ".$this -> getPageHeading($qs[2])." / ".CONTENT_PAGETITLE_LAN_13; 722 723 //category of parent='2' and content_id='5' 724 }elseif($qs[0] == "cat" && is_numeric($qs[1]) && (!isset($qs[2]) || isset($qs[2]) && $qs[2]=='view') ){ 725 $page .= " / ".CONTENT_PAGETITLE_LAN_3." / ".$row['content_heading']; 726 727 //top rated of parent='2' 728 }elseif($qs[0] == "top" && is_numeric($qs[1]) && !isset($qs[2])){ 729 $page .= " / ".$this -> getPageHeading($qs[1])." / ".CONTENT_PAGETITLE_LAN_4; 730 731 //top score of parent='2' 732 }elseif($qs[0] == "score" && is_numeric($qs[1]) && !isset($qs[2])){ 733 $page .= " / ".$this -> getPageHeading($qs[1])." / ".CONTENT_PAGETITLE_LAN_15; 734 735 //authorlist of parent='2' 736 }elseif($qs[0] == "author" && $qs[1] == "list" && is_numeric($qs[2])){ 737 $page .= " / ".$this -> getPageHeading($qs[2])." / ".CONTENT_PAGETITLE_LAN_14; 738 739 //authorlist of parent='2' and content_id='5' 740 }elseif($qs[0] == "author" && is_numeric($qs[1]) && !isset($qs[2])){ 741 $sql -> db_Select($plugintable, "content_author", "content_id='".intval($qs[1])."' "); 742 $row2 = $sql -> db_Fetch(); 743 $authordetails = $this -> getAuthor($row2['content_author']); 744 $page .= " / ".CONTENT_PAGETITLE_LAN_5." / ".$authordetails[1]; 745 746 //archive of parent='2' 747 }elseif($qs[0] == "list" && is_numeric($qs[1]) && !isset($qs[2])){ 748 $page .= " / ".CONTENT_PAGETITLE_LAN_6; 749 } 750 } 751 752 }elseif(e_PAGE == "content_submit.php"){ 753 //submit page : view categories 754 if(!e_QUERY){ 755 $page = CONTENT_PAGETITLE_LAN_0." / ".CONTENT_PAGETITLE_LAN_7; 756 }else{ 757 $page = CONTENT_PAGETITLE_LAN_0; 758 759 //submit page : submit item 760 if($qs[0] == "content" && $qs[1] == "submit" && is_numeric($qs[2]) ){ 761 $page = " / ".CONTENT_PAGETITLE_LAN_8; 762 } 763 } 764 765 }elseif(e_PAGE == "content_manager.php"){ 766 //manager page : view categories 767 if(!e_QUERY){ 768 $page = CONTENT_PAGETITLE_LAN_0." / ".CONTENT_PAGETITLE_LAN_9; 769 }else{ 770 $page = CONTENT_PAGETITLE_LAN_0." / ".CONTENT_PAGETITLE_LAN_9; 771 772 //manager page : view items 773 if($qs[0] == "content" && is_numeric($qs[1]) ){ 774 $page .= " / ".CONTENT_PAGETITLE_LAN_10; 775 776 //manager page : edit item 777 }elseif($qs[0] == "content" && $qs[1] == "edit" && is_numeric($qs[2]) ){ 778 $page .= " / ".CONTENT_PAGETITLE_LAN_11; 779 780 //manager page : create new item 781 }elseif($qs[0] == "content" && $qs[1] == "create" && is_numeric($qs[2]) ){ 782 $page .= " / ".CONTENT_PAGETITLE_LAN_12; 783 } 784 } 785 } 786 define("e_PAGETITLE", $page); 787 788 } 789 790 791 792 function getAuthor($content_author) { 793 global $sql, $plugintable, $datequery; 794 795 if(is_numeric($content_author)){ 796 if(!$sql -> db_Select("user", "user_id, user_name, user_email", "user_id=$content_author")){ 797 $author_id = "0"; 798 $author_name = ""; 799 $author_email = ""; 800 }else{ 801 list($author_id, $author_name, $author_email) = $sql -> db_Fetch(); 802 } 803 $getauthor = array($author_id, $author_name, $author_email, $content_author); 804 }else{ 805 $tmp = explode("^", $content_author); 806 if(isset($tmp[0]) && is_numeric($tmp[0]) ){ 807 $author_id = $tmp[0]; 808 $author_name = (isset($tmp[1]) ? $tmp[1] : ""); 809 $author_email = (isset($tmp[2]) ? $tmp[2] : ""); 810 }else{ 811 $author_id = "0"; 812 $author_name = $tmp[0]; 813 $author_email = (isset($tmp[1]) ? $tmp[1] : ""); 814 } 815 $getauthor = array($author_id, $author_name, $author_email, $content_author); 816 } 817 return $getauthor; 818 } 819 820 821 822 function getMainParent($id){ 823 global $sql, $plugintable; 824 825 $category_total = $sql -> db_Select($plugintable, "content_id, content_parent", "content_id='".intval($id)."' "); 826 $row = $sql -> db_Fetch(); 827 if($row['content_parent'] == 0){ 828 $mainparent = $row['content_id']; 829 }else{ 830 if(strpos($row['content_parent'], ".")){ 831 $newid = substr($row['content_parent'],2); 832 }else{ 833 $newid = $row['content_parent']; 834 } 835 $mainparent = $this -> getMainParent( $newid ); 836 } 837 return ($mainparent ? $mainparent : "0"); 838 } 839 840 841 842 //$mode : managecontent, createcontent, category 843 function ShowOption($currentparent="", $mode=''){ 844 global $qs, $sql, $rs, $plugintable, $tp, $content_pref, $stylespacer; 845 846 if( ($mode=='managecontent' || $mode=='createcontent') && $currentparent == "submit"){ 847 $mainparent = $this -> getMainParent( intval($qs[2]) ); 848 $catarray = $this -> getCategoryTree("", intval($mainparent), FALSE); 849 }else{ 850 $catarray = $this -> getCategoryTree("", "", FALSE); 851 } 852 $array = array_keys($catarray); 853 854 $string = ""; 855 foreach($array as $catid){ 856 $category_total = $sql -> db_Select($plugintable, "content_id, content_heading, content_parent", "content_id='".intval($catid)."' "); 857 $row = $sql -> db_Fetch(); 858 859 $pre = ""; 860 //sub level 861 if($row['content_parent'] != "0"){ 862 for($b=0;$b<(count($catarray[$catid])/2)-1;$b++){ 863 $pre .= " "; 864 } 865 } 866 if($row['content_parent'] == 0){ 867 $name = $row['content_heading']; 868 $js = "style='font-weight:bold;'"; 869 }else{ 870 $js = ""; 871 $name = $pre.$row['content_heading']; 872 } 873 874 if($mode=='managecontent'){ 875 $checkid = ($currentparent ? $currentparent : ""); 876 if($qs[0] == 'content' && ($qs[1]=='create' || $qs[1]=='submit') ){ 877 $value = e_SELF."?content.".$qs[1].".".$catid; 878 }else{ 879 $value = e_SELF."?content.".$catid; 880 } 881 }elseif($mode=='createcontent'){ 882 if($qs[1] == "create" || $qs[1] == "submit"){ 883 $checkid = (isset($qs[2]) && is_numeric($qs[2]) ? $qs[2] : ""); 884 $value = $catid; 885 }else{ 886 $checkid = ($currentparent ? $currentparent : ""); 887 $value = $qs[2].".".$catid; 888 } 889 }elseif($mode=='category'){ 890 if($qs[1] == "create"){ 891 $checkid = (isset($qs[2]) && is_numeric($qs[2]) ? $qs[2] : ""); 892 $value = e_SELF."?cat.create.".$catid; 893 }elseif($qs[1] == "edit"){ 894 $checkid = ($currentparent ? $currentparent : ""); 895 $value = e_SELF."?cat.edit.".$qs[2].".".$catid; 896 } 897 } 898 $sel = ($catid == $checkid ? "1" : "0"); 899 $string .= $rs -> form_option($name, $sel, $value, $js); 900 } 901 902 if($mode=='managecontent'){ 903 $selectjs = " onchange=\" if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; } \""; 904 $text = $rs -> form_select_open("parent1", $selectjs); 905 $text .= $rs -> form_option(CONTENT_ADMIN_MAIN_LAN_28, "0", "none"); 906 $text .= $string; 907 $text .= $rs -> form_select_close(); 908 909 }elseif($mode=='createcontent'){ 910 $redirecturl = e_SELF."?content.".$qs[1]."."; 911 $selectjs = " onchange=\" if(this.options[this.selectedIndex].value != 'none'){ return document.location='".$redirecturl."'+this.options[this.selectedIndex].value; } \""; 912 $text = $rs -> form_select_open("parent1", $selectjs); 913 $text .= $rs -> form_option(CONTENT_ADMIN_MAIN_LAN_28, "0", "none"); 914 $text .= $string; 915 $text .= $rs -> form_select_close(); 916 917 }elseif($mode=='category'){ 918 $selectjs = " onchange=\" if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; } \""; 919 $text = $rs -> form_select_open("parent1", $selectjs); 920 if($qs[1] == "create"){ 921 $text .= $rs -> form_option(CONTENT_ADMIN_MAIN_LAN_29." ", (isset($qs[2]) ? "0" : "1"), e_SELF."?cat.create", "style='font-weight:bold;'"); 922 }else{ 923 $text .= $rs -> form_option(CONTENT_ADMIN_MAIN_LAN_29." ", (isset($qs[2]) ? "0" : "1"), e_SELF."?cat.edit.".$qs[2].".0", "style='font-weight:bold;'"); 924 } 925 $text .= $string; 926 $text .= $rs -> form_select_close(); 927 } 928 return $text; 929 } 930 931 932 933 function getOrder(){ 934 global $qs, $content_pref; 935 936 if(isset($qs[0]) && substr($qs[0],0,5) == "order"){ 937 $orderstring = $qs[0]; 938 }elseif(isset($qs[1]) && substr($qs[1],0,5) == "order"){ 939 $orderstring = $qs[1]; 940 }elseif(isset($qs[2]) && substr($qs[2],0,5) == "order"){ 941 $orderstring = $qs[2]; 942 }elseif(isset($qs[3]) && substr($qs[3],0,5) == "order"){ 943 $orderstring = $qs[3]; 944 }else{ 945 $orderstring = ($content_pref["content_defaultorder"] ? $content_pref["content_defaultorder"] : "orderddate" ); 946 } 947 948 if(substr($orderstring,6) == "heading"){ 949 $orderby = "content_heading"; 950 $orderby2 = ""; 951 }elseif(substr($orderstring,6) == "date"){ 952 $orderby = "content_datestamp"; 953 $orderby2 = ", content_heading ASC"; 954 }elseif(substr($orderstring,6) == "parent"){ 955 $orderby = "content_parent"; 956 $orderby2 = ", content_heading ASC"; 957 }elseif(substr($orderstring,6) == "refer"){ 958 $orderby = "content_refer"; 959 $orderby2 = ", content_heading ASC"; 960 }elseif(substr($orderstring,6) == "author"){ 961 962 }elseif(substr($orderstring,6) == "order"){ 963 if($qs[0] == "cat"){ 964 $orderby = "SUBSTRING_INDEX(content_order, '.', 1)+0"; 965 }elseif($qs[0] != "cat"){ 966 $orderby = "SUBSTRING_INDEX(content_order, '.', -1)+0"; 967 } 968 $orderby2 = ", content_heading ASC"; 969 }else{ 970 $orderstring = "orderddate"; 971 $orderby = "content_datestamp"; 972 $orderby2 = ", content_heading ASC"; 973 } 974 $order = " ORDER BY ".$orderby." ".(substr($orderstring,5,1) == "a" ? "ASC" : "DESC")." ".$orderby2." "; 975 return $order; 976 } 977 978 979 980 function getIcon($mode, $icon, $path="", $linkid="", $width="", $blank=""){ 981 global $content_cat_icon_path_small, $content_cat_icon_path_large, $content_icon_path, $content_pref; 982 983 $blank = (!$blank ? "0" : $blank); 984 $border = "border:0;"; 985 $hrefpre = ($linkid ? "<a href='".e_SELF."?".$linkid."'>" : ""); 986 $hrefpost = ($linkid ? "</a>" : ""); 987 988 if($mode == "item"){ 989 $path = (!$path ? $content_icon_path : $path); 990 $width = ($width ? "width:".$width."px;" : ""); 991 //$border = "border:1px solid #000;"; 992 $border = ''; 993 $icon = ($icon ? $path.$icon : ($blank ? $content_icon_path."blank.gif" : "")); 994 995 }elseif($mode == "catsmall"){ 996 $path = (!$path ? $content_cat_icon_path_small : $path); 997 $icon = ($icon ? $path.$icon : ""); 998 999 }elseif($mode == "catlarge"){ 1000 $path = (!$path ? $content_cat_icon_path_large : $path); 1001 $icon = ($icon ? $path.$icon : ""); 1002 }else{ 1003 $path = (!$path ? $content_icon_path : $path); 1004 $hrefpre = ""; 1005 $hrefpost = ""; 1006 $width = ""; 1007 $icon = ($icon ? $path.$icon : ($blank ? $content_icon_path."blank.gif" : "")); 1008 } 1009 1010 if($icon && file_exists($icon)){ 1011 $iconstring = $hrefpre."<img src='".$icon."' alt='' style='".$width." ".$border."' />".$hrefpost; 1012 }else{ 1013 $iconstring = ""; 1014 if($blank){ 1015 if(file_exists($content_icon_path."blank.gif")){ 1016 if($mode == "catsmall"){ 1017 $width = ($width ? "width:".$width."px;" : "width:16px;"); 1018 }elseif($mode == "catlarge"){ 1019 $width = ($width ? "width:".$width."px;" : "width:48px;"); 1020 } 1021 $iconstring = $hrefpre."<img src='".$content_icon_path."blank.gif' alt='' style='".$width." ".$border."' />".$hrefpost; 1022 } 1023 } 1024 } 1025 return $iconstring; 1026 } 1027 1028 function prepareAuthor($mode, $author, $id){ 1029 global $aa, $content_pref; 1030 if($mode == ''){return;} 1031 1032 $authorinfo = ""; 1033 if( (isset($content_pref["content_{$mode}_authorname"]) && $content_pref["content_{$mode}_authorname"]) || (isset($content_pref["content_{$mode}_authoremail"]) && $content_pref["content_{$mode}_authoremail"]) || (isset($content_pref["content_{$mode}_authoricon"]) && $content_pref["content_{$mode}_authoricon"]) || (isset($content_pref["content_{$mode}_authorprofile"]) && $content_pref["content_{$mode}_authorprofile"]) ){ 1034 $authordetails = $this -> getAuthor($author); 1035 if(isset($content_pref["content_{$mode}_authorname"]) && $content_pref["content_{$mode}_authorname"]){ 1036 if(isset($content_pref["content_{$mode}_authoremail"]) && $authordetails[2]){ 1037 if($authordetails[0] == "0"){ 1038 if(isset($content_pref["content_{$mode}_authoremail_nonmember"]) && $content_pref["content_{$mode}_authoremail_nonmember"] && strpos($authordetails[2], "@") ){ 1039 //$authorinfo = "<a href='mailto:".$authordetails[2]."'>".$authordetails[1]."</a>"; 1040 1041 $authorinfo = preg_replace("#([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"\\1\"+\"@\"+\"\\2\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"\\1\"+\"@\"+\"\\2\"; return true;' onmouseout='window.status=\"\";return true;'>".$authordetails[1]."</a>", $authordetails[2]); 1042 }else{ 1043 $authorinfo = $authordetails[1]; 1044 } 1045 }else{ 1046 //$authorinfo = "<a href='mailto:".$authordetails[2]."'>".$authordetails[1]."</a>"; 1047 1048 $authorinfo = preg_replace("#([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"\\1\"+\"@\"+\"\\2\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"\\1\"+\"@\"+\"\\2\"; return true;' onmouseout='window.status=\"\";return true;'>".$authordetails[1]."</a>", $authordetails[2]); 1049 } 1050 }else{ 1051 $authorinfo = $authordetails[1]; 1052 } 1053 if(USER && is_numeric($authordetails[0]) && $authordetails[0] != "0" && isset($content_pref["content_{$mode}_authorprofile"]) && $content_pref["content_{$mode}_authorprofile"]){ 1054 $authorinfo .= " <a href='".e_BASE."user.php?id.".$authordetails[0]."' title='".CONTENT_LAN_40."'>".CONTENT_ICON_USER."</a>"; 1055 } 1056 } 1057 if(isset($content_pref["content_{$mode}_authoricon"]) && $content_pref["content_{$mode}_authoricon"]){ 1058 $authorinfo .= " <a href='".e_SELF."?author.".$id."' title='".CONTENT_LAN_39."'>".CONTENT_ICON_AUTHORLIST."</a>"; 1059 } 1060 } 1061 return $authorinfo; 1062 } 1063 1064 1065 //admin 1066 function popupHelp($text, $image="", $width="320", $title=""){ 1067 //$image : full path to the image you want to show on screen (uses a default doc image) 1068 //$width : the width of the popup (uses a default width of 500) 1069 //$title : the window title of the popup (uses a default title of ...) 1070 //$text : the help text to show into the popup 1071 1072 if(!$image || !file_exists($image)){ 1073 $image = e_IMAGE."admin_images/docs_16.png"; 1074 } 1075 if(!$width){ $width = "320"; } 1076 if(!$title){ $title = "content management help area"; } 1077 1078 $popup = "<a href=\"javascript:openHelpPopup(".$width.",'".$title."','".$text."')\" style='cursor:pointer;' onmouseover=\"window.status='click for help on this page'; return true;\" onmouseout=\"window.status=''; return true;\" ><img src='".$image."' style='border:0;' alt='' /></a>"; 1079 1080 return $popup; 1081 } 1082 1083 1084 1085 //search by keyword 1086 function showOptionsSearch($mode, $searchtypeid=""){ 1087 global $plugindir, $plugintable, $qs, $rs; 1088 1089 if(!is_object($rs)){ 1090 require_once(e_HANDLER."form_handler.php"); 1091 $rs = new form; 1092 } 1093 if(!isset($searchtypeid)){ 1094 $searchtypeid = (is_numeric($qs[1]) ? $qs[1] : $qs[2]); 1095 } 1096 1097 if($mode == "menu"){ 1098 $CONTENT_SEARCH_TABLE_KEYWORD = $rs -> form_open("post", $plugindir."content.php?recent.$searchtypeid", "contentsearchmenu_{$mode}", "", "enctype='multipart/form-data'")."<div><input class='tbox' size='20' type='text' id='searchfieldmenu_{$mode}' name='searchfieldmenu_{$mode}' value='".(isset($_POST['searchfieldmenu_{$mode}']) ? $_POST['searchfieldmenu_{$mode}'] : CONTENT_LAN_18)."' maxlength='100' onfocus=\"document.forms['contentsearchmenu_{$mode}'].searchfieldmenu_$mode.value='';\" /> <input class='button' type='submit' name='searchsubmit' value='".CONTENT_LAN_19."' /></div>".$rs -> form_close(); 1099 }else{ 1100 $searchfieldname = "searchfield_{$mode}"; 1101 $CONTENT_SEARCH_TABLE_KEYWORD = $rs -> form_open("post", $plugindir."content.php?recent.$searchtypeid", "contentsearch_{$mode}", "", "enctype='multipart/form-data'")."<div> 1102 <input class='tbox' size='27' type='text' id='$searchfieldname' name='$searchfieldname' value='".(isset($_POST[$searchfieldname]) ? $_POST[$searchfieldname] : CONTENT_LAN_18)."' maxlength='100' onfocus=\"document.forms['contentsearch_{$mode}'].$searchfieldname.value='';\" /> 1103 <input class='button' type='submit' name='searchsubmit' value='".CONTENT_LAN_19."' /></div> 1104 ".$rs -> form_close(); 1105 } 1106 return $CONTENT_SEARCH_TABLE_KEYWORD; 1107 } 1108 1109 1110 1111 //redirection links in dropdown 1112 function showOptionsSelect($mode, $searchtypeid=""){ 1113 global $plugindir, $plugintable, $rs, $qs, $content_pref; 1114 1115 if(!is_object($rs)){ 1116 require_once(e_HANDLER."form_handler.php"); 1117 $rs = new form; 1118 } 1119 if(!isset($searchtypeid)){ 1120 $searchtypeid = (is_numeric($qs[1]) ? $qs[1] : $qs[2]); 1121 } 1122 $catarray = ""; 1123 $mainparent = $this -> getMainParent( $searchtypeid ); 1124 $content_pref = $this -> getContentPref($mainparent); 1125 $parent = $this -> getCategoryTree("", $mainparent, TRUE); 1126 $parent = array_merge_recursive($parent); 1127 for($a=0;$a<count($parent);$a++){ 1128 for($b=0;$b<count($parent[$a]);$b++){ 1129 $newparent[$parent[$a][$b]] = $parent[$a][$b+1]; 1130 $b++; 1131 } 1132 } 1133 if($newparent){ 1134 $emptystring = CONTENT_LAN_14; 1135 $catarray = $rs -> form_option($emptystring, "0", "none"); 1136 } 1137 foreach($newparent as $key => $value){ 1138 $n = ""; 1139 if($mode == "page" || ($mode == "menu" && isset($content_pref["content_menu_cat_number"])) ){ 1140 $n = $this -> countCatItems($key); 1141 $n = " (".$n." ".($n == "1" ? CONTENT_LAN_53 : CONTENT_LAN_54).")"; 1142 } 1143 if( ($content_pref["content_menu_cat_main"] && $key == $mainparent) || $key != $mainparent ){ 1144 $value = (strlen($value) > 25 ? substr($value,0,25)."..." : $value); 1145 $catarray .= $rs -> form_option($value.$n, 0, $plugindir."content.php?cat.".$key); 1146 } 1147 } 1148 1149 if($mode == "page" || ($mode == "menu" && ($content_pref["content_menu_links"] && $content_pref["content_menu_links_dropdown"]) || ($content_pref["content_menu_cat"] && $content_pref["content_menu_cat_dropdown"]) ) ){ 1150 if($mode == "menu"){ $style = "style='width:100%;' "; }else{ $style = ""; } 1151 $CONTENT_SEARCH_TABLE_SELECT = " 1152 ".$rs -> form_open("post", $plugindir."content.php".(e_QUERY ? "?".e_QUERY : ""), "contentredirect".$mode, "", "enctype='multipart/form-data'")." 1153 <div><select id='{$mode}value' name='{$mode}value' class='tbox' $style onchange=\"if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; }\">"; 1154 1155 if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_links"] && $content_pref["content_menu_links_dropdown"]) ){ 1156 $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_56, 1, "none").$rs -> form_option(" ", "0", "none"); 1157 1158 if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewallcat"])){ 1159 $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_6, 0, $plugindir."content.php?cat.list.".$mainparent); 1160 } 1161 if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewallauthor"])){ 1162 $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_7, 0, $plugindir."content.php?author.list.".$mainparent); 1163 } 1164 if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewallitems"])){ 1165 $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_83, 0, $plugindir."content.php?list.".$mainparent); 1166 } 1167 if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewtoprated"])){ 1168 $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_8, 0, $plugindir."content.php?top.".$mainparent); 1169 } 1170 if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewtopscore"])){ 1171 $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_12, 0, $plugindir."content.php?score.".$mainparent); 1172 } 1173 if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewrecent"])){ 1174 $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_61, 0, $plugindir."content.php?recent.".$mainparent); 1175 } 1176 if( ($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewsubmit"]) && $content_pref["content_submit"] && check_class($content_pref["content_submit_class"]) ) ){ 1177 $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_75, 0, $plugindir."content_submit.php"); 1178 } 1179 $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(" ", "0", "none"); 1180 } 1181 if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_cat"] && $content_pref["content_menu_cat_dropdown"])){ 1182 $CONTENT_SEARCH_TABLE_SELECT .= $catarray; 1183 } 1184 $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_select_close()."</div>".$rs -> form_close(); 1185 } 1186 return $CONTENT_SEARCH_TABLE_SELECT; 1187 } 1188 1189 1190 1191 //ordering in dropdown 1192 function showOptionsOrder($mode, $ordertypeid=""){ 1193 global $plugindir, $rs, $qs; 1194 1195 if(!is_object($rs)){ 1196 require_once(e_HANDLER."form_handler.php"); 1197 $rs = new form; 1198 } 1199 if(!isset($ordertypeid)){ 1200 $ordertypeid = (is_numeric($qs[1]) ? $qs[1] : $qs[2]); 1201 } 1202 1203 $text = ""; 1204 if(strpos(e_SELF, 'content.php') !== FALSE){ 1205 if(e_QUERY){ 1206 $check = ""; 1207 for($i=0;$i<count($qs);$i++){ 1208 if($qs[$i] && substr($qs[$i],0,5) == "order"){ 1209 $check = $qs[$i]; 1210 break; 1211 } 1212 } 1213 $baseurl = $plugindir."content.php"; 1214 $qry = (isset($qs[0]) && substr($qs[0],0,5) != "order" ? $qs[0] : "").(isset($qs[1]) && substr($qs[1],0,5) != "order" ? ".".$qs[1] : "").(isset($qs[2]) && substr($qs[2],0,5) != "order" ? ".".$qs[2] : "").(isset($qs[3]) && substr($qs[3],0,5) != "order" ? ".".$qs[3] : ""); 1215 $text = $rs -> form_open("post", $baseurl."?$qs[0].$ordertypeid", "contentsearchorder{$mode}", "", "enctype='multipart/form-data'"); 1216 $text .= "<div><select id='ordervalue{$mode}' name='ordervalue{$mode}' class='tbox' onchange=\"if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; }\">"; 1217 $text .= $rs -> form_option(CONTENT_ORDER_LAN_0, 1, "none"); 1218 1219 if($qs[0] == "author" && $qs[1] == "list"){ 1220 $text .= $rs -> form_option(CONTENT_ORDER_LAN_11, ($check == "orderaauthor" ? "1" : "0"), $baseurl."?".$qry.".orderaauthor" ); 1221 $text .= $rs -> form_option(CONTENT_ORDER_LAN_12, ($check == "orderdauthor" ? "1" : "0"), $baseurl."?".$qry.".orderdauthor" ); 1222 }else{ 1223 $text .= $rs -> form_option(CONTENT_ORDER_LAN_1, ($check == "orderaheading" ? "1" : "0"), $baseurl."?".$qry.".orderaheading" ); 1224 $text .= $rs -> form_option(CONTENT_ORDER_LAN_2, ($check == "orderdheading" ? "1" : "0"), $baseurl."?".$qry.".orderdheading" ); 1225 $text .= $rs -> form_option(CONTENT_ORDER_LAN_3, ($check == "orderadate" ? "1" : "0"), $baseurl."?".$qry.".orderadate" ); 1226 $text .= $rs -> form_option(CONTENT_ORDER_LAN_4, ($check == "orderddate" ? "1" : "0"), $baseurl."?".$qry.".orderddate" ); 1227 $text .= $rs -> form_option(CONTENT_ORDER_LAN_5, ($check == "orderarefer" ? "1" : "0"), $baseurl."?".$qry.".orderarefer" ); 1228 $text .= $rs -> form_option(CONTENT_ORDER_LAN_6, ($check == "orderdrefer" ? "1" : "0"), $baseurl."?".$qry.".orderdrefer" ); 1229 $text .= $rs -> form_option(CONTENT_ORDER_LAN_7, ($check == "orderaparent" ? "1" : "0"), $baseurl."?".$qry.".orderaparent" ); 1230 $text .= $rs -> form_option(CONTENT_ORDER_LAN_8, ($check == "orderdparent" ? "1" : "0"), $baseurl."?".$qry.".orderdparent" ); 1231 $text .= $rs -> form_option(CONTENT_ORDER_LAN_9, ($check == "orderaorder" ? "1" : "0"), $baseurl."?".$qry.".orderaorder" ); 1232 $text .= $rs -> form_option(CONTENT_ORDER_LAN_10, ($check == "orderdorder" ? "1" : "0"), $baseurl."?".$qry.".orderdorder" ); 1233 } 1234 $text .= $rs -> form_select_close(); 1235 $text .= "</div>"; 1236 $text .= $rs -> form_close(); 1237 } 1238 } 1239 return $text; 1240 } 1241 1242 1243 1244 function CreateParentMenu($parentid){ 1245 global $plugintable, $plugindir, $tp, $datequery; 1246 1247 if(!is_object($sqlcreatemenu)){ $sqlcreatemenu = new db; } 1248 if(!$sqlcreatemenu -> db_Select($plugintable, "*", "content_id='".intval($parentid)."' ")){ 1249 return FALSE; 1250 }else{ 1251 $row = $sqlcreatemenu -> db_Fetch(); 1252 } 1253 1254 $content_path_menu = $plugindir."menus/"; 1255 if(!is_writable($content_path_menu)){ 1256 echo "<b>".CONTENT_ADMIN_ITEM_LAN_22." ".$content_path_menu." ".CONTENT_ADMIN_ITEM_LAN_23."</b><br />"; 1257 return FALSE; 1258 } 1259 1260 $menufile = "content_".$row['content_heading']; 1261 $menuname = $row['content_heading']; 1262 1263 $data = chr(60)."?php\n". chr(47)."*\n+---------------------------------------------------------------+\n| e107 website system\n| ".e_PLUGIN."content/menus/".$menufile."_menu.php\n|\n| ©Steve Dunstan 2001-2002\n| http://e107.org\n| jalist@e107.org\n|\n| Released under the terms and conditions of the\n| GNU General Public License (http://gnu.org).\n+---------------------------------------------------------------+\n\nThis file has been generated by ".e_PLUGIN."content/handlers/content_class.php.\n\n*". chr(47)."\n\n"; 1264 $data .= "\n"; 1265 $data .= "unset(\$text);\n"; 1266 $data .= "\$text = \"\";\n"; 1267 $data .= "\$menutypeid = \"$parentid\";\n"; 1268 $data .= "\$menuname = \"$menuname\";\n"; 1269 $data .= "\n"; 1270 $data .= "\$plugindir = e_PLUGIN.'content/';\n"; 1271 $data .= "\$plugintable = \"pcontent\"; //name of the table used in this plugin (never remove this, as it's being used throughout the plugin !!)\n"; 1272 $data .= "\$datequery = \" AND content_datestamp < \".time().\" AND (content_enddate=0 || content_enddate>\".time().\") \";\n"; 1273 $data .= "\n"; 1274 $data .= "require_once(e_PLUGIN.'content/handlers/content_class.php');\n"; 1275 $data .= "\$aa = new content;\n"; 1276 $data .= "require_once(e_HANDLER.'form_handler.php');\n"; 1277 $data .= "\$rs = new form;\n"; 1278 $data .= "\$gen = new convert;\n"; 1279 $data .= "global \$tp;\n"; 1280 $data .= "\n"; 1281 $data .= "\$lan_file = e_PLUGIN.'content/languages/'.e_LANGUAGE.'/lan_content.php';\n"; 1282 $data .= "include_once(file_exists(\$lan_file) ? \$lan_file : e_PLUGIN.'content/languages/English/lan_content.php');\n"; 1283 $data .= "\n"; 1284 $data .= "\$bullet = (defined('BULLET') ? \"<img src='\".THEME_ABS.\"images/\".BULLET.\"' alt='' style='border:0;vertical-align: middle;' />\" : \"<img src='\".THEME_ABS.\"images/bullet2.gif' alt='bullet' style='border:0;vertical-align: middle;' />\");\n"; 1285 $data .= "\n"; 1286 $data .= "\$content_pref = \$aa -> getContentPref(\$menutypeid);\n"; 1287 $data .= "\$content_icon_path = \$tp -> replaceConstants(\$content_pref[\"content_icon_path\"]);\n"; 1288 $data .= "\$content_cat_icon_path_small = \$tp -> replaceConstants(\$content_pref[\"content_cat_icon_path_small\"]);\n"; 1289 $data .= "\n"; 1290 $data .= " \$break = FALSE;\n"; 1291 $data .= "//##### SEARCH SELECT ORDER --------------------------------------------------\n"; 1292 $data .= "//show search box\n"; 1293 $data .= "if(\$content_pref[\"content_menu_search\"]){\n"; 1294 $data .= " \$text .= \$aa -> showOptionsSearch(\"menu\", \$menutypeid);\n"; 1295 $data .= " \$break = TRUE;\n"; 1296 $data .= "}\n"; 1297 $data .= "//show select box (with either links to other content pages, to categories, to both, or don't show at all)\n"; 1298 $data .= "if( (\$content_pref[\"content_menu_links\"] && \$content_pref[\"content_menu_links_dropdown\"]) || (\$content_pref[\"content_menu_cat\"] && \$content_pref[\"content_menu_cat_dropdown\"]) ){\n"; 1299 $data .= " \$text .= \$aa -> showOptionsSelect(\"menu\", \$menutypeid);\n"; 1300 $data .= " \$break = TRUE;\n"; 1301 $data .= "}\n"; 1302 $data .= "//show order box\n"; 1303 $data .= "if(\$content_pref[\"content_menu_sort\"]){\n"; 1304 $data .= " \$text .= \$aa -> showOptionsOrder(\"menu\", \$menutypeid);\n"; 1305 $data .= " \$break = TRUE;\n"; 1306 $data .= "}\n"; 1307 $data .= "\n"; 1308 $data .= "//show links list if chosen so\n"; 1309 $data .= "if(\$content_pref[\"content_menu_links\"] && !\$content_pref[\"content_menu_links_dropdown\"]){\n"; 1310 $data .= " if(\$break === TRUE){\n"; 1311 $data .= " \$text .= \"<br />\";\n"; 1312 $data .= " }\n"; 1313 $data .= " \$text .= (\$content_pref[\"content_menu_links_caption\"] != \"\" ? \$content_pref[\"content_menu_links_caption\"] : CONTENT_MENU_LAN_4).\"<br />\";\n"; 1314 $data .= "\n"; 1315 $data .= " //define icon\n"; 1316 $data .= " if(\$content_pref[\"content_menu_links_icon\"] == \"0\"){ \$linksicon = \"\";\n"; 1317 $data .= " }elseif(\$content_pref[\"content_menu_links_icon\"] == \"1\"){ \$linksicon = \$bullet;\n"; 1318 $data .= " }elseif(\$content_pref[\"content_menu_links_icon\"] == \"2\"){ \$linksicon = \"·\";\n"; 1319 $data .= " }elseif(\$content_pref[\"content_menu_links_icon\"] == \"3\"){ \$linksicon = \"º\";\n"; 1320 $data .= " }elseif(\$content_pref[\"content_menu_links_icon\"] == \"4\"){ \$linksicon = \"»\";\n"; 1321 $data .= " }\n"; 1322 $data .= "\n"; 1323 $data .= " if(\$content_pref[\"content_menu_viewallcat\"]){\n"; 1324 $data .= " \$text .= \$linksicon.\" <a href='\".\$plugindir.\"content.php?cat.list.\".\$menutypeid.\"'>\".CONTENT_LAN_6.\"</a><br />\";\n"; 1325 $data .= " }\n"; 1326 $data .= " if(\$content_pref[\"content_menu_viewallauthor\"]){\n"; 1327 $data .= " \$text .= \$linksicon.\" <a href='\".\$plugindir.\"content.php?author.list.\".\$menutypeid.\"'>\".CONTENT_LAN_7.\"</a><br />\";\n"; 1328 $data .= " }\n"; 1329 $data .= " if(\$content_pref[\"content_menu_viewallitems\"]){\n"; 1330 $data .= " \$text .= \$linksicon.\" <a href='\".\$plugindir.\"content.php?list.\".\$menutypeid.\"'>\".CONTENT_LAN_83.\"</a><br />\";\n"; 1331 $data .= " }\n"; 1332 $data .= " if(\$content_pref[\"content_menu_viewtoprated\"]){\n"; 1333 $data .= " \$text .= \$linksicon.\" <a href='\".\$plugindir.\"content.php?top.\".\$menutypeid.\"'>\".CONTENT_LAN_8.\"</a><br />\";\n"; 1334 $data .= " }\n"; 1335 $data .= " if(\$content_pref[\"content_menu_viewtopscore\"]){\n"; 1336 $data .= " \$text .= \$linksicon.\" <a href='\".\$plugindir.\"content.php?score.\".\$menutypeid.\"'>\".CONTENT_LAN_12.\"</a><br />\";\n"; 1337 $data .= " }\n"; 1338 $data .= " if(\$content_pref[\"content_menu_viewrecent\"]){\n"; 1339 $data .= " \$text .= \$linksicon.\" <a href='\".\$plugindir.\"content.php?recent.\".\$menutypeid.\"'>\".CONTENT_LAN_61.\"</a><br />\";\n"; 1340 $data .= " }\n"; 1341 $data .= " if( \$content_pref[\"content_menu_viewsubmit\"] && \$content_pref[\"content_submit\"] && check_class(\$content_pref[\"content_submit_class\"]) ){\n"; 1342 $data .= " \$text .= \$linksicon.\" <a href='\".\$plugindir.\"content_submit.php'>\".CONTENT_LAN_75.\"</a><br />\";\n"; 1343 $data .= " }\n"; 1344 $data .= " \$text .= \"<br />\";\n"; 1345 $data .= "}\n"; 1346 $data .= "\n"; 1347 $data .= "//get category array\n"; 1348 $data .= "\$array = \$aa -> getCategoryTree(\"\", intval(\$menutypeid), TRUE);\n"; 1349 $data .= "\n"; 1350 $data .= "//##### CATEGORY LIST --------------------------------------------------\n"; 1351 $data .= "if(!\$content_pref[\"content_menu_cat_dropdown\"]){\n"; 1352 $data .= " if(\$content_pref[\"content_menu_cat\"]){\n"; 1353 $data .= " \$text .= (\$content_pref[\"content_menu_cat_caption\"] != \"\" ? \$content_pref[\"content_menu_cat_caption\"] : CONTENT_MENU_LAN_3).\"<br />\";\n"; 1354 $data .= "\n"; 1355 $data .= " \$newparent = \"\";\n"; 1356 $data .= " \$checkid = \"\";\n"; 1357 $data .= " \$newarray = array_merge_recursive(\$array);\n"; 1358 $data .= " for(\$a=0;\$a<count(\$newarray);\$a++){\n"; 1359 $data .= " for(\$b=0;\$b<count(\$newarray[\$a]);\$b++){\n"; 1360 $data .= " \$newparent[\$newarray[\$a][\$b]] = \$newarray[\$a][\$b+1];\n"; 1361 $data .= " if( (\$content_pref[\"content_menu_cat_main\"] && \$newarray[\$a][\$b] == \$menutypeid) || \$newarray[\$a][\$b] != \$menutypeid ){\n"; 1362 $data .= " \$checkid .= \" content_id = '\".\$newarray[\$a][\$b].\"' OR \";\n"; 1363 $data .= " }\n"; 1364 $data .= " \$b++;\n"; 1365 $data .= " }\n"; 1366 $data .= " }\n"; 1367 $data .= " \$checkid = substr(\$checkid,0,-3);\n"; 1368 $data .= " if(!is_object(\$sql)){ \$sql = new db; }\n"; 1369 1370 $data .= " if(\$sql -> db_Select(\$plugintable, \"*\", \" \".\$checkid.\" ORDER BY SUBSTRING_INDEX(content_order, '.', 1)+0 \")){\n"; 1371 $data .= " while(\$row = \$sql -> db_Fetch()){\n"; 1372 $data .= "\n"; 1373 $data .= " //define icon\n"; 1374 $data .= " \$ICON = \"\";\n"; 1375 $data .= " if(\$content_pref[\"content_menu_cat_icon\"] == \"0\"){ \$ICON = \"\";\n"; 1376 $data .= " }elseif(\$content_pref[\"content_menu_cat_icon\"] == \"1\"){ \$ICON = \$bullet;\n"; 1377 $data .= " }elseif(\$content_pref[\"content_menu_cat_icon\"] == \"2\"){ \$ICON = \"·\";\n"; 1378 $data .= " }elseif(\$content_pref[\"content_menu_cat_icon\"] == \"3\"){ \$ICON = \"º\";\n"; 1379 $data .= " }elseif(\$content_pref[\"content_menu_cat_icon\"] == \"4\"){ \$ICON = \"»\";\n"; 1380 $data .= " }elseif(\$content_pref[\"content_menu_cat_icon\"] == \"5\"){\n"; 1381 $data .= " if(\$row['content_icon'] != \"\" && file_exists(\$content_cat_icon_path_small.\$row['content_icon']) ){\n"; 1382 $data .= " \$ICON = \"<img src='\".\$content_cat_icon_path_small.\$row['content_icon'].\"' alt='' style='border:0;' />\";\n"; 1383 $data .= " }else{\n"; 1384 $data .= " //default category icon\n"; 1385 $data .= " if(\$content_pref[\"content_menu_cat_icon_default\"] == \"0\"){ \$ICON = \"\";\n"; 1386 $data .= " }elseif(\$content_pref[\"content_menu_cat_icon_default\"] == \"1\"){ \$ICON = \$bullet;\n"; 1387 $data .= " }elseif(\$content_pref[\"content_menu_cat_icon_default\"] == \"2\"){ \$ICON = \"·\";\n"; 1388 $data .= " }elseif(\$content_pref[\"content_menu_cat_icon_default\"] == \"3\"){ \$ICON = \"º\";\n"; 1389 $data .= " }elseif(\$content_pref[\"content_menu_cat_icon_default\"] == \"4\"){ \$ICON = \"»\";\n"; 1390 $data .= " }\n"; 1391 $data .= " }\n"; 1392 $data .= " }\n"; 1393 $data .= " //display category list\n"; 1394 $data .= " \$text .= \"<table style='width:100%; text-align:left; border:0;' cellpadding='0' cellspacing='0'>\";\n"; 1395 $data .= " \$text .= \"<tr>\";\n"; 1396 $data .= " \$text .= (\$ICON ? \"<td style='width:1%; white-space:nowrap; text-align:left; padding-right:5px;'><a href='\".e_PLUGIN.\"content/content.php?cat.\".\$row['content_id'].\"'>\".\$ICON.\"</a></td>\" : \"\");\n"; 1397 $data .= " \$text .= \"<td colspan='2'>\";\n"; 1398 $data .= " \$text .= \"<a href='\".e_PLUGIN.\"content/content.php?cat.\".\$row['content_id'].\"'>\".\$row['content_heading'].\"</a>\";\n"; 1399 $data .= " \$text .= (\$content_pref[\"content_menu_cat_number\"] ? \" <span class='smalltext'>(\".\$aa -> countCatItems(\$row['content_id']).\")</span>\" : \"\");\n"; 1400 $data .= " \$text .= \"</td>\";\n"; 1401 $data .= " \$text .= \"</tr>\";\n"; 1402 $data .= " \$text .= \"</table>\";\n"; 1403 $data .= " }\n"; 1404 $data .= " }\n"; 1405 $data .= " }\n"; 1406 $data .= "}\n"; 1407 $data .= "\n"; 1408 $data .= "//##### RECENT --------------------------------------------------\n"; 1409 $data .= "if(\$content_pref[\"content_menu_recent\"]){\n"; 1410 $data .= " \$text .= \"<br />\";\n"; 1411 $data .= "\n"; 1412 $data .= " //prepare query paramaters\n"; 1413 $data .= " \$validparent = implode(\",\", array_keys(\$array));\n"; 1414 $data .= " \$qry = \" content_parent REGEXP '\".\$aa -> CONTENTREGEXP(\$validparent).\"' \";\n"; 1415 $data .= "\n"; 1416 $data .= " \$sql1 = new db;\n"; 1417 $data .= " \$contenttotal = \$sql1 -> db_Count(\$plugintable, \"(*)\", \"WHERE content_refer != 'sa' AND \".\$qry.\" \".\$datequery.\" AND content_class REGEXP '\".e_CLASS_REGEXP.\"' \" );\n"; 1418 $data .= "\n"; 1419 $data .= " if(\$resultitem = \$sql1 -> db_Select(\$plugintable, \"*\", \"content_refer !='sa' AND \".\$qry.\" \".\$datequery.\" AND content_class REGEXP '\".e_CLASS_REGEXP.\"' ORDER BY content_datestamp DESC LIMIT 0,\".\$content_pref[\"content_menu_recent_number\"] )){\n"; 1420 $data .= "\n"; 1421 $data .= " \$text .= (\$content_pref[\"content_menu_recent_caption\"] != \"\" ? \$content_pref[\"content_menu_recent_caption\"] : CONTENT_MENU_LAN_2).\"<br />\";\n"; 1422 $data .= " while(\$row = \$sql1 -> db_Fetch()){\n"; 1423 $data .= "\n"; 1424 $data .= " \$ICON = \"\";\n"; 1425 $data .= " \$DATE = \"\";\n"; 1426 $data .= " \$AUTHOR = \"\";\n"; 1427 $data .= " \$SUBHEADING = \"\";\n"; 1428 $data .= "\n"; 1429 $data .= " if(\$content_pref[\"content_menu_recent_date\"]){\n"; 1430 $data .= " \$datestyle = (\$content_pref[\"content_archive_datestyle\"] ? \$content_pref[\"content_archive_datestyle\"] : \"%d %b %Y\");\n"; 1431 $data .= " \$DATE = strftime(\$datestyle, \$row['content_datestamp']);\n"; 1432 $data .= " }\n"; 1433 $data .= " if(\$content_pref[\"content_menu_recent_author\"]){\n"; 1434 $data .= " \$authordetails = \$aa -> getAuthor(\$row['content_author']);\n"; 1435 $data .= " \$AUTHOR = \$authordetails[1];\n"; 1436 $data .= " }\n"; 1437 $data .= "\n"; 1438 $data .= " //subheading\n"; 1439 $data .= " if(\$content_pref[\"content_menu_recent_subheading\"] && \$row['content_subheading']){\n"; 1440 $data .= " if(\$content_pref[\"content_menu_recent_subheading_char\"] && \$content_pref[\"content_menu_recent_subheading_char\"] != \"\" && \$content_pref[\"content_menu_recent_subheading_char\"] != \"0\"){\n"; 1441 $data .= " if(strlen(\$row['content_subheading']) > \$content_pref[\"content_menu_recent_subheading_char\"]) {\n"; 1442 $data .= " \$row['content_subheading'] = substr(\$row['content_subheading'], 0, \$content_pref[\"content_menu_recent_subheading_char\"]).\$content_pref[\"content_menu_recent_subheading_post\"];\n"; 1443 $data .= " }\n"; 1444 $data .= " }\n"; 1445 $data .= " \$SUBHEADING = \$row['content_subheading'];\n"; 1446 $data .= " }\n"; 1447 $data .= "\n"; 1448 $data .= " //define icon\n"; 1449 $data .= " \$recenticonwidth = \"\";\n"; 1450 $data .= " if(\$content_pref[\"content_menu_recent_icon\"] == \"0\"){ \$ICON = \"\";\n"; 1451 $data .= " }elseif(\$content_pref[\"content_menu_recent_icon\"] == \"1\"){ \$ICON = \$bullet;\n"; 1452 $data .= " }elseif(\$content_pref[\"content_menu_recent_icon\"] == \"2\"){ \$ICON = \"·\";\n"; 1453 $data .= " }elseif(\$content_pref[\"content_menu_recent_icon\"] == \"3\"){ \$ICON = \"º\";\n"; 1454 $data .= " }elseif(\$content_pref[\"content_menu_recent_icon\"] == \"4\"){ \$ICON = \"»\";\n"; 1455 $data .= " }elseif(\$content_pref[\"content_menu_recent_icon\"] == \"5\"){\n"; 1456 $data .= " if(\$content_pref[\"content_menu_recent_icon\"] == \"5\"){\n"; 1457 $data .= " if(\$content_pref[\"content_menu_recent_icon_width\"]){\n"; 1458 $data .= " \$recenticonwidth = \" width:\".\$content_pref[\"content_menu_recent_icon_width\"].\"px; \";\n"; 1459 $data .= " }else{\n"; 1460 $data .= " \$recenticonwidth = \" width:50px; \";\n"; 1461 $data .= " }\n"; 1462 $data .= " }\n"; 1463 $data .= " if(\$content_pref[\"content_menu_recent_icon\"] == \"5\" && \$row['content_icon'] != \"\" && file_exists(\$content_icon_path.\$row['content_icon'])){\n"; 1464 $data .= " \$ICON = \"<img src='\".\$content_icon_path.\$row['content_icon'].\"' alt='' style='\".\$recenticonwidth.\" border:0;' />\";\n"; 1465 $data .= " }\n"; 1466 $data .= " }\n"; 1467 $data .= "\n"; 1468 $data .= " //display recent list\n"; 1469 $data .= " \$text .= \"<table style='width:100%; text-align:left; border:0; margin-bottom:10px;' cellpadding='0' cellspacing='0'>\";\n"; 1470 $data .= " \$text .= \"<tr>\";\n"; 1471 $data .= " \$text .= (\$ICON ? \"<td style='width:1%; white-space:nowrap; vertical-align:top; padding-right:5px;'><a href='\".e_PLUGIN.\"content/content.php?content.\".\$row['content_id'].\"'>\".\$ICON.\"</a></td>\" : \"\");\n"; 1472 $data .= " \$text .= \"<td style='width:99%; vertical-align:top;'>\";\n"; 1473 $data .= " \$text .= \"<a href='\".e_PLUGIN.\"content/content.php?content.\".\$row['content_id'].\"'>\".\$row['content_heading'].\"</a><br />\";\n"; 1474 $data .= " \$text .= (\$DATE ? \$DATE.\"<br />\" : \"\" );\n"; 1475 $data .= " \$text .= (\$AUTHOR ? \$AUTHOR.\"<br />\" : \"\" );\n"; 1476 $data .= " \$text .= (\$SUBHEADING ? \$SUBHEADING.\"<br />\" : \"\" );\n"; 1477 $data .= " \$text .= \"</td>\";\n"; 1478 $data .= " \$text .= \"</tr>\";\n"; 1479 $data .= " \$text .= \"</table>\";\n"; 1480 $data .= " }\n"; 1481 $data .= " }\n"; 1482 $data .= "}\n"; 1483 $data .= "\n"; 1484 $data .= "if(!isset(\$text)){ \$text = CONTENT_MENU_LAN_1; }\n"; 1485 $data .= "\$caption = (\$content_pref[\"content_menu_caption\"] != \"\" ? \$content_pref[\"content_menu_caption\"] : CONTENT_MENU_LAN_0.\" \".\$menuname);\n"; 1486 $data .= "\$ns -> tablerender(\$caption, \$text, '$menufile');\n"; 1487 $data .= "\n"; 1488 $data .= "?".chr(62); 1489 1490 if(file_exists($plugindir."menus/".$menufile."_menu.php")){ 1491 $message = ""; 1492 }else{ 1493 $fp = @fopen($plugindir."menus/".$menufile."_menu.php", "w"); 1494 if (!@fwrite($fp, $data)) { 1495 $message = CONTENT_ADMIN_CAT_LAN_51; 1496 } else { 1497 fclose($fp); 1498 $message = CONTENT_ADMIN_CAT_LAN_50; 1499 } 1500 } 1501 return $message; 1502 } 1503 } //close class 1504 1505 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |