[ Index ] |
|
Code source de e107 0.7.8 |
1 <?php 2 /* 3 + ----------------------------------------------------------------------------+ 4 | e107 website system 5 | 6 | ©Steve Dunstan 2001-2002 7 | http://e107.org 8 | jalist@e107.org 9 | 10 | Released under the terms and conditions of the 11 | GNU General Public License (http://gnu.org). 12 | 13 | $Source: /cvsroot/e107/e107_0.7/e107_handlers/plugin_class.php,v $ 14 | $Revision: 1.58 $ 15 | $Date: 2007/02/14 21:17:34 $ 16 | $Author: e107steved $ 17 +----------------------------------------------------------------------------+ 18 */ 19 20 if (!defined('e107_INIT')) { exit; } 21 22 class e107plugin 23 { 24 var $plugin_addons = array("e_rss", "e_notify", "e_linkgen", "e_list", "e_bb", "e_meta", "e_emailprint", "e_frontpage", "e_latest", "e_status", "e_search", "e_sc", "e_module", "e_comment", "e_sql"); 25 26 // List of all plugin variables which need to be checked - install required if one or more set and non-empty 27 var $all_eplug_install_variables = array( 28 'eplug_link_url', 29 'eplug_link', 30 'eplug_prefs', 31 'eplug_array_pref', // missing previously 32 'eplug_table_names', 33 'eplug_user_prefs', 34 'eplug_sc', 35 'eplug_userclass', 36 'eplug_module', 37 'eplug_bb', 38 'eplug_latest', 39 'eplug_status' //, 40 // 'eplug_comment_ids', // Not sure about this one 41 // 'eplug_menu_name', // ...or this one 42 // 'eplug_conffile' // ...or this one 43 ); 44 45 // List of all plugin variables involved in an update (not used ATM, but worth 'documenting') 46 var $all_eplug_update_variables = array ( 47 'upgrade_alter_tables', 48 'upgrade_add_eplug_sc', 49 'upgrade_remove_eplug_sc', 50 'upgrade_add_eplug_bb', 51 'upgrade_remove_eplug_bb', 52 'upgrade_add_prefs', 53 'upgrade_remove_prefs', 54 'upgrade_add_user_prefs', 55 'upgrade_remove_user_prefs', 56 'upgrade_add_array_pref', // missing 57 'upgrade_remove_array_pref' // missing 58 ); 59 60 /** 61 * Returns an array containing details of all plugins in the plugin table - should noramlly use e107plugin::update_plugins_table() first to make sure the table is up to date. 62 * @return array plugin details 63 */ 64 function getall($flag) 65 { 66 global $sql; 67 if ($sql->db_Select("plugin","*","plugin_installflag = '".intval($flag)."' ORDER BY plugin_path ASC")) 68 { 69 $ret = $sql->db_getList(); 70 } 71 return ($ret) ? $ret : FALSE; 72 } 73 74 75 /** 76 * Check for new plugins, create entry in plugin table and remove deleted plugins 77 */ 78 function update_plugins_table() 79 { 80 global $sql, $sql2, $mySQLprefix, $menu_pref, $tp; 81 82 require_once(e_HANDLER.'file_class.php'); 83 84 $fl = new e_file; 85 $pluginList = $fl->get_files(e_PLUGIN, "^plugin\.php$", "standard", 1); 86 87 // Get rid of any variables previously defined which may occur in plugin.php 88 foreach($pluginList as $p) 89 { 90 $defined_vars = array_keys(get_defined_vars()); 91 foreach($defined_vars as $varname) 92 { 93 if ((substr($varname, 0, 6) == 'eplug_') || (substr($varname, 0, 8) == 'upgrade_')) 94 { 95 unset($$varname); 96 } 97 } 98 99 // We have to include here to set the variables, otherwise we only get uninstalled plugins 100 // Would be nice to eval() the file contents to pick up errors better, but too many path issues 101 include("{$p['path']}{$p['fname']}"); 102 $plugin_path = substr(str_replace(e_PLUGIN,"",$p['path']),0,-1); 103 104 // scan for addons. 105 $eplug_addons = $this->getAddons($plugin_path); 106 // $eplug_addons = $this->getAddons($plugin_path,'check'); // Checks opening/closing tags on addon files 107 108 // See whether the plugin needs installation - it does if one or more variables defined 109 $no_install_needed = 1; 110 foreach ($this->all_eplug_install_variables as $check_var) 111 { 112 if (isset($$check_var) && ($$check_var)) { $no_install_needed = 0; } 113 } 114 115 if ($plugin_path == $eplug_folder) 116 { 117 if($sql->db_Select("plugin", "plugin_id, plugin_version, plugin_installflag", "plugin_path = '$plugin_path'")) 118 { // Update the addons needed by the plugin 119 $ep_row = $sql->db_Fetch(); 120 $ep_update = ''; 121 // If plugin not installed, and version number of files changed, update version as well 122 if (($ep_row['plugin_installflag'] == 0) && ($ep_row['plugin_version'] != $eplug_version)) $ep_update = ", plugin_version = '{$eplug_version}' "; 123 $sql->db_Update("plugin", "plugin_addons = '{$eplug_addons}'{$ep_update} WHERE plugin_path = '$plugin_path'"); 124 unset($ep_row, $ep_update); 125 } 126 127 if ((!$sql->db_Select("plugin", "plugin_id", "plugin_path = '".$tp -> toDB($eplug_folder, true)."'")) && $eplug_name) 128 { // New plugin - not in table yet, so add it. If no install needed, mark it as 'installed' 129 $sql->db_Insert("plugin", "0, '".$tp -> toDB($eplug_name, true)."', '".$tp -> toDB($eplug_version, true)."', '".$tp -> toDB($eplug_folder, true)."', {$no_install_needed}, '{$eplug_addons}' "); 130 } 131 } 132 else 133 { // May be useful that we ignore what will usually be copies/backups of plugins - but don't normally say anything 134 // echo "Plugin copied to wrong directory. Is in: {$plugin_path} Should be: {$eplug_folder}<br /><br />"; 135 } 136 } 137 138 $sql->db_Select("plugin"); 139 while ($row = $sql->db_fetch()) 140 { // Check for the actual plugin.php file - that's really the criterion for a 'proper' plugin 141 if (!file_exists(e_PLUGIN.$row['plugin_path'].'/plugin.php')) 142 { 143 // echo "Deleting: ".e_PLUGIN.$row['plugin_path'].'/plugin.php'."<br />"; 144 $sql2->db_Delete('plugin', "plugin_path = '{$row['plugin_path']}'"); 145 } 146 } 147 } 148 149 /** 150 * Returns deatils of a plugin from the plugin table from it's ID 151 * 152 * @param int $id 153 * @return array plugin info 154 */ 155 function getinfo($id) { 156 global $sql; 157 $id = intval($id); 158 if ($sql->db_Select('plugin', '*', "plugin_id = {$id}")) { 159 return $sql->db_Fetch(); 160 } 161 } 162 163 function manage_userclass($action, $class_name, $class_description) { 164 global $sql, $tp; 165 $class_name = $tp -> toDB($class_name, true); 166 $class_description = $tp -> toDB($class_description, true); 167 if ($action == 'add') { 168 $i = 1; 169 while ($sql->db_Select('userclass_classes', '*', "userclass_id='{$i}' ") && $i < e_UC_READONLY) { 170 $i++; 171 } 172 if ($i < e_UC_READONLY) { 173 return $sql->db_Insert('userclass_classes', "{$i},'".strip_tags(strtoupper($class_name))."', '{$class_description}' ,".e_UC_PUBLIC); 174 } else { 175 return FALSE; 176 } 177 } 178 if ($action == 'remove') { 179 if ($sql->db_Select('userclass_classes', 'userclass_id', "userclass_name = '{$class_name}'")) { 180 $row = $sql->db_Fetch(); 181 $class_id = $row['userclass_id']; 182 if ($sql->db_Delete('userclass_classes', "userclass_id = '{$class_id}'")) { 183 if ($sql->db_Select('user', 'user_id, user_class', "user_class REGEXP('^{$class_id}\.') OR user_class REGEXP('\.{$class_id}\.') OR user_class REGEXP('\.{$class_id}$')")) { 184 $sql2 = new db; 185 while ($row = $sql->db_Fetch()) { 186 $classes = explode(".", $row['user_class']); 187 unset($classes[$class_id]); 188 foreach($classes as $k => $v) { 189 if ($v = '') { 190 unset($classes[$k]); 191 } 192 } 193 $newclass = '.'.implode('.', $classes).'.'; 194 $sql2->db_Update('user', "user_class = '{$newclass}' WHERE user_id = '{$row['user_id']}"); 195 } 196 } 197 } 198 } 199 } 200 } 201 202 function manage_link($action, $link_url, $link_name,$link_class=0) { 203 global $sql, $tp; 204 $link_url = $tp -> toDB($link_url, true); 205 $link_name = $tp -> toDB($link_name, true); 206 if ($action == 'add') { 207 $path = str_replace("../", "", $link_url); 208 $link_t = $sql->db_Count('links'); 209 if (!$sql->db_Count('links', '(*)', "link_name = '{$link_name}'")) { 210 return $sql->db_Insert('links', "0, '{$link_name}', '{$path}', '', '', '1', '".($link_t + 1)."', '0', '0', '{$link_class}' "); 211 } else { 212 return FALSE; 213 } 214 } 215 if ($action == 'remove') { 216 if ($sql->db_Select('links', 'link_order', "link_name = '{$link_name}'")) { 217 $row = $sql->db_Fetch(); 218 $sql->db_Update('links', "link_order = link_order - 1 WHERE link_order > {$row['link_order']}"); 219 return $sql->db_Delete('links', "link_name = '{$link_name}'"); 220 } 221 } 222 } 223 224 function manage_prefs($action, $var) { 225 global $pref; 226 if (is_array($var)) { 227 if ($action == 'add') { 228 foreach($var as $k => $v) { 229 $pref[$k] = $v; 230 } 231 } 232 if ($action == 'remove') { 233 foreach($var as $k => $v) { 234 unset($pref[$k]); 235 } 236 } 237 save_prefs(); 238 } 239 } 240 241 242 function manage_comments($action,$comment_id){ 243 global $sql, $tp; 244 if($action == 'remove'){ 245 foreach($comment_id as $com){ 246 $tmp[] = "comment_type='".$tp -> toDB($com, true)."'"; 247 } 248 $qry = implode(" OR ",$tmp); 249 return $sql->db_Delete('comments',$qry); 250 } 251 } 252 253 254 function manage_tables($action, $var) { 255 global $sql; 256 if ($action == 'add') { 257 if (is_array($var)) { 258 foreach($var as $tab) { 259 if (!$sql->db_Query($tab)) { 260 return FALSE; 261 } 262 } 263 return TRUE; 264 } 265 return TRUE; 266 } 267 if ($action == 'upgrade') { 268 if (is_array($var)) { 269 foreach($var as $tab) { 270 if (!$sql->db_Query_all($tab)) { 271 return FALSE; 272 } 273 } 274 return TRUE; 275 } 276 return TRUE; 277 } 278 if ($action == 'remove') { 279 if (is_array($var)) { 280 foreach($var as $tab) { 281 $qry = 'DROP TABLE '.MPREFIX.$tab; 282 if (!$sql->db_Query_all($qry)) { 283 return $tab; 284 } 285 } 286 return TRUE; 287 } 288 return TRUE; 289 } 290 } 291 292 function manage_plugin_prefs($action, $prefname, $plugin_folder, $varArray = '') 293 { // 294 global $pref; 295 if ($prefname == 'plug_sc' || $prefname == 'plug_bb') { 296 foreach($varArray as $code) { 297 $prefvals[] = "$code:$plugin_folder"; 298 } 299 } else { 300 $prefvals[] = $varArray; 301 // $prefvals[] = $plugin_folder; 302 } 303 $curvals = explode(',', $pref[$prefname]); 304 305 if ($action == 'add') 306 { 307 $newvals = array_merge($curvals, $prefvals); 308 } 309 if ($action == 'remove') 310 { 311 foreach($prefvals as $v) 312 { 313 if (($i = array_search($v, $curvals)) !== FALSE) 314 { 315 unset($curvals[$i]); 316 } 317 } 318 $newvals = $curvals; 319 } 320 $newvals = array_unique($newvals); 321 $pref[$prefname] = implode(',', $newvals); 322 323 if(substr($pref[$prefname], 0, 1) == ",") 324 { 325 $pref[$prefname] = substr($pref[$prefname], 1); 326 } 327 save_prefs(); 328 } 329 330 331 332 333 334 335 function manage_search($action, $eplug_folder) { 336 global $sql, $sysprefs; 337 $search_prefs = $sysprefs -> getArray('search_prefs'); 338 $default = file_exists(e_PLUGIN.$eplug_folder.'/e_search.php') ? TRUE : FALSE; 339 $comments = file_exists(e_PLUGIN.$eplug_folder.'/search/search_comments.php') ? TRUE : FALSE; 340 if ($action == 'add'){ 341 $install_default = $default ? TRUE : FALSE; 342 $install_comments = $comments ? TRUE : FALSE; 343 } else if ($action == 'remove'){ 344 $uninstall_default = isset($search_prefs['plug_handlers'][$eplug_folder]) ? TRUE : FALSE; 345 $uninstall_comments = isset($search_prefs['comments_handlers'][$eplug_folder]) ? TRUE : FALSE; 346 } else if ($action == 'upgrade'){ 347 if (isset($search_prefs['plug_handlers'][$eplug_folder])) { 348 $uninstall_default = $default ? FALSE : TRUE; 349 } else { 350 $install_default = $default ? TRUE : FALSE; 351 } 352 if (isset($search_prefs['comments_handlers'][$eplug_folder])) { 353 $uninstall_comments = $comments ? FALSE : TRUE; 354 } else { 355 $install_comments = $comments ? TRUE : FALSE; 356 } 357 } 358 if ($install_default) { 359 $search_prefs['plug_handlers'][$eplug_folder] = array('class' => 0, 'pre_title' => 1, 'pre_title_alt' => '', 'chars' => 150, 'results' => 10); 360 } else if ($uninstall_default) { 361 unset($search_prefs['plug_handlers'][$eplug_folder]); 362 } 363 if ($install_comments) { 364 require_once(e_PLUGIN.$eplug_folder.'/search/search_comments.php'); 365 $search_prefs['comments_handlers'][$eplug_folder] = array('id' => $comments_type_id, 'class' => 0, 'dir' => $eplug_folder); 366 } else if ($uninstall_comments) { 367 unset($search_prefs['comments_handlers'][$eplug_folder]); 368 } 369 $tmp = addslashes(serialize($search_prefs)); 370 $sql->db_Update("core", "e107_value = '{$tmp}' WHERE e107_name = 'search_prefs' "); 371 } 372 373 function manage_notify($action, $eplug_folder) { 374 global $sql, $sysprefs, $eArrayStorage, $tp; 375 $notify_prefs = $sysprefs -> get('notify_prefs'); 376 $notify_prefs = $eArrayStorage -> ReadArray($notify_prefs); 377 $e_notify = file_exists(e_PLUGIN.$eplug_folder.'/e_notify.php') ? TRUE : FALSE; 378 if ($action == 'add'){ 379 $install_notify = $e_notify ? TRUE : FALSE; 380 } else if ($action == 'remove'){ 381 $uninstall_notify = isset($notify_prefs['plugins'][$eplug_folder]) ? TRUE : FALSE; 382 } else if ($action == 'upgrade'){ 383 if (isset($notify_prefs['plugins'][$eplug_folder])) { 384 $uninstall_notify = $e_notify ? FALSE : TRUE; 385 } else { 386 $install_notify = $e_notify ? TRUE : FALSE; 387 } 388 } 389 if ($install_notify) { 390 $notify_prefs['plugins'][$eplug_folder] = TRUE; 391 require_once(e_PLUGIN.$eplug_folder.'/e_notify.php'); 392 foreach ($config_events as $event_id => $event_text) { 393 $notify_prefs['event'][$event_id] = array('type' => 'off', 'class' => '254', 'email' => ''); 394 } 395 } else if ($uninstall_notify) { 396 unset($notify_prefs['plugins'][$eplug_folder]); 397 require_once(e_PLUGIN.$eplug_folder.'/e_notify.php'); 398 foreach ($config_events as $event_id => $event_text) { 399 unset($notify_prefs['event'][$event_id]); 400 } 401 } 402 $s_prefs = $tp -> toDB($notify_prefs); 403 $s_prefs = $eArrayStorage -> WriteArray($s_prefs); 404 $sql -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'"); 405 } 406 407 /** 408 * Installs a plugin by ID 409 * 410 * @param int $id 411 */ 412 function install_plugin($id) { 413 global $sql, $ns, $sysprefs,$mySQLprefix, $tp; 414 415 // install plugin ... 416 $plug = $this->getinfo($id); 417 418 if ($plug['plugin_installflag'] == FALSE) { 419 include_once(e_PLUGIN.$plug['plugin_path'].'/plugin.php'); 420 421 $func = $eplug_folder.'_install'; 422 if (function_exists($func)) { 423 $text .= call_user_func($func); 424 } 425 426 if (is_array($eplug_tables)) { 427 $result = $this->manage_tables('add', $eplug_tables); 428 if ($result === TRUE) { 429 $text .= EPL_ADLAN_19.'<br />'; 430 //success 431 } else { 432 $text .= EPL_ADLAN_18.'<br />'; 433 //fail 434 } 435 } 436 437 438 439 if (is_array($eplug_prefs)) { 440 $this->manage_prefs('add', $eplug_prefs); 441 $text .= EPL_ADLAN_8.'<br />'; 442 } 443 444 445 446 if (is_array($eplug_array_pref)){ 447 foreach($eplug_array_pref as $key => $val){ 448 $this->manage_plugin_prefs('add', $key, $eplug_folder, $val); 449 } 450 } 451 452 if (is_array($eplug_sc)) { 453 $this->manage_plugin_prefs('add', 'plug_sc', $eplug_folder, $eplug_sc); 454 } 455 456 if (is_array($eplug_bb)) { 457 $this->manage_plugin_prefs('add', 'plug_bb', $eplug_folder, $eplug_bb); 458 } 459 460 if (is_array($eplug_user_prefs)) { 461 $sql->db_Select("core", " e107_value", " e107_name = 'user_entended'"); 462 $row = $sql->db_Fetch(); 463 $user_entended = unserialize($row[0]); 464 while (list($e_user_pref, $default_value) = each($eplug_user_prefs)) { 465 $user_entended[] = $e_user_pref; 466 $user_pref['$e_user_pref'] = $default_value; 467 } 468 save_prefs("user"); 469 $tmp = addslashes(serialize($user_entended)); 470 if ($sql->db_Select("core", "e107_value", " e107_name = 'user_entended'")) { 471 $sql->db_Update("core", "e107_value = '{$tmp}' WHERE e107_name = 'user_entended' "); 472 } else { 473 $sql->db_Insert("core", "'user_entended', '{$tmp}' "); 474 } 475 $text .= EPL_ADLAN_8."<br />"; 476 } 477 478 if ($eplug_link === TRUE && $eplug_link_url != '' && $eplug_link_name != '') { 479 $plug_perm['everyone'] = e_UC_PUBLIC; 480 $plug_perm['guest'] = e_UC_GUEST; 481 $plug_perm['member'] = e_UC_MEMBER; 482 $plug_perm['admin'] = e_UC_ADMIN; 483 $plug_perm['nobody'] = e_UC_NOBODY; 484 $eplug_link_perms = strtolower($eplug_link_perms); 485 $linkperm = ($plug_perm[$eplug_link_perms]) ? $plug_perm[$eplug_link_perms] : e_UC_PUBLIC; 486 $this->manage_link('add', $eplug_link_url, $eplug_link_name,$linkperm); 487 } 488 489 if ($eplug_userclass) { 490 $this->manage_userclass('add', $eplug_userclass, $eplug_userclass_description); 491 } 492 493 $this -> manage_search('add', $eplug_folder); 494 495 $this -> manage_notify('add', $eplug_folder); 496 497 $eplug_addons = $this->getAddons($eplug_folder); 498 499 $sql->db_Update('plugin', "plugin_installflag = 1, plugin_addons = '{$eplug_addons}' WHERE plugin_id = '".intval($id)."'"); 500 if($rssmess){ $text .= $rssmess; } 501 $text .= (isset($eplug_done) ? "<br />{$eplug_done}" : "<br />".LAN_INSTALL_SUCCESSFUL); 502 } else { 503 $text = EPL_ADLAN_21; 504 } 505 if($eplug_conffile){ $text .= " <a href='".e_PLUGIN."$eplug_folder/$eplug_conffile'>[".LAN_CONFIGURE."]</a>"; } 506 $ns->tablerender(EPL_ADLAN_33, $text); 507 } 508 509 510 511 function save_addon_prefs(){ // scan the plugin table and create path-array-prefs for each addon. 512 global $sql,$pref; 513 $query = "SELECT * FROM #plugin WHERE plugin_installflag = 1 AND plugin_addons !='' ORDER BY plugin_path ASC"; 514 515 // clear all addon prefs before re-creation. 516 unset($pref['shortcode_list'],$pref['bbcode_list'],$pref['e_sql_list']); 517 foreach($this->plugin_addons as $plg) 518 { 519 unset($pref[$plg."_list"]); 520 } 521 522 if ($sql -> db_Select_gen($query)) 523 { 524 while($row = $sql-> db_Fetch()) 525 { 526 $tmp = explode(",",$row['plugin_addons']); 527 $path = $row['plugin_path']; 528 529 foreach($this->plugin_addons as $val) 530 { 531 if(in_array($val,$tmp)) 532 { 533 $pref[$val."_list"][$path] = $path; 534 } 535 } 536 // search for .bb and .sc files. 537 $sc_array = array(); 538 $bb_array = array(); 539 $sql_array = array(); 540 541 foreach($tmp as $adds) 542 { 543 if(substr($adds,-3) == ".sc") 544 { 545 $sc_name = substr($adds, 0,-3); // remove the .sc 546 $sc_array[$sc_name] = "0"; // default userclass. 547 } 548 549 if(substr($adds,-3) == ".bb") 550 { 551 $bb_name = substr($adds, 0,-3); // remove the .bb 552 $bb_array[$bb_name] = "0"; // default userclass. 553 } 554 555 if(substr($adds,-4) == "_sql") 556 { 557 $pref['e_sql_list'][$path] = $adds; 558 } 559 } 560 561 // Build Bbcode list 562 if(count($bb_array) > 0) 563 { 564 ksort($bb_array); 565 $pref['bbcode_list'][$path] = $bb_array; 566 567 } 568 else 569 { 570 unset($pref['bbcode_list'][$path]); 571 } 572 573 // Build shortcode list 574 if(count($sc_array) > 0){ 575 ksort($sc_array); 576 $pref['shortcode_list'][$path] = $sc_array; 577 } 578 else 579 { 580 unset($pref['shortcode_list'][$path]); 581 } 582 583 } 584 } 585 586 save_prefs(); 587 return; 588 589 } 590 591 // return a list of available plugin addons for the specified plugin. e_xxx etc. 592 // $debug = TRUE - prints diagnostics 593 // $debug = 'check' - checks each file found for php tags - prints 'pass' or 'fail' 594 function getAddons($plugin_path,$debug=FALSE) 595 { 596 global $fl; 597 $p_addons = array(); 598 foreach($this->plugin_addons as $e_xxx) 599 { 600 if(is_readable(e_PLUGIN.$plugin_path."/".$e_xxx.".php")) 601 { 602 $passfail = ''; 603 if ($debug == 'check') 604 { 605 $file_text = file_get_contents(e_PLUGIN.$plugin_path."/".$e_xxx.".php"); 606 if ((substr($file_text,0,5) != '<'.'?php') || (substr($file_text,-2,2) !='?>')) $passfail = '<b>fail</b>'; else $passfail = 'pass'; 607 echo $plugin_path."/".$e_xxx.".php - ".$passfail."<br />"; 608 } 609 $p_addons[] = $e_xxx; 610 } 611 } 612 613 if(!is_object($fl)){ 614 require_once(e_HANDLER.'file_class.php'); 615 $fl = new e_file; 616 } 617 618 // Grab List of Shortcodes & BBcodes 619 $shortcodeList = $fl->get_files(e_PLUGIN.$plugin_path, ".sc$", "standard", 1); 620 $bbcodeList = $fl->get_files(e_PLUGIN.$plugin_path, ".bb$", "standard", 1); 621 $sqlList = $fl->get_files(e_PLUGIN.$plugin_path, "_sql.php$", "standard", 1); 622 623 // Search Shortcodes 624 foreach($shortcodeList as $sc) 625 { 626 if(is_readable(e_PLUGIN.$plugin_path."/".$sc['fname'])) 627 { 628 $p_addons[] = $sc['fname']; 629 } 630 } 631 632 // Search Bbcodes. 633 foreach($bbcodeList as $bb) 634 { 635 if(is_readable(e_PLUGIN.$plugin_path."/".$bb['fname'])) 636 { 637 $p_addons[] = $bb['fname']; 638 } 639 } 640 641 // Search _sql files. 642 foreach($sqlList as $esql) 643 { 644 if(is_readable(e_PLUGIN.$plugin_path."/".$esql['fname'])) 645 { 646 $p_addons[] = str_replace(".php","",$esql['fname']); 647 } 648 } 649 650 651 if($debug==TRUE) 652 { 653 echo $plugin_path." = ".implode(",",$p_addons)."<br />"; 654 } 655 656 return implode(",",$p_addons); 657 } 658 659 function checkAddon($plugin_path,$e_xxx) 660 { // Return 0 = OK, 1 = Fail, 2 = inaccessible 661 if(is_readable(e_PLUGIN.$plugin_path."/".$e_xxx.".php")) 662 { 663 $file_text = file_get_contents(e_PLUGIN.$plugin_path."/".$e_xxx.".php"); 664 if ((substr($file_text,0,5) != '<'.'?php') || (substr($file_text,-2,2) !='?>')) return 1; 665 return 0; 666 } 667 return 2; 668 } 669 } 670 671 ?>
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 |