mirror of
https://github.com/e107inc/e107.git
synced 2025-04-20 20:51:53 +02:00
More work on eUrl
This commit is contained in:
parent
52e6697bae
commit
b7f0185feb
144
class2.php
144
class2.php
@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/class2.php,v $
|
||||
| $Revision: 1.72 $
|
||||
| $Date: 2008-11-24 20:18:59 $
|
||||
| $Author: secretr $
|
||||
| $Revision: 1.73 $
|
||||
| $Date: 2008-11-25 16:26:02 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
//
|
||||
@ -277,17 +277,20 @@ define("MPREFIX", $mySQLprefix);
|
||||
|
||||
e107_require_once(e_HANDLER."mysql_class.php");
|
||||
|
||||
$sql =& new db;
|
||||
$e107->sql =& new db;
|
||||
$sql = &$e107->sql;
|
||||
|
||||
$sql->db_SetErrorReporting(FALSE);
|
||||
|
||||
$sql->db_Mark_Time('Start: SQL Connect');
|
||||
$merror=$sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
|
||||
$sql2 =& new db; // create after the initial connection.
|
||||
$sql2 =& new db; // create after the initial connection.
|
||||
$sql->db_Mark_Time('Start: Prefs, misc tables');
|
||||
|
||||
|
||||
require_once(e_HANDLER.'admin_log_class.php');
|
||||
$admin_log = new e_admin_log();
|
||||
$e107->admin_log =& new e_admin_log;
|
||||
$admin_log = &$e107->admin_log;
|
||||
|
||||
if ($merror === "e1") {
|
||||
message_handler("CRITICAL_ERROR", 6, ": generic, ", "class2.php");
|
||||
@ -437,7 +440,7 @@ if ($pref['user_tracking'] == "session")
|
||||
$_SESSION['challenge'] = sha1(time().session_id()); // Create a unique challenge string for CHAP login
|
||||
}
|
||||
$ubrowser = md5('E107'.$_SERVER['HTTP_USER_AGENT']);
|
||||
if (!isset($_SESSION['ubrowser']))
|
||||
if (!isset($_SESSION['ubrowser']))
|
||||
{
|
||||
$_SESSION['ubrowser'] = $ubrowser;
|
||||
}
|
||||
@ -563,14 +566,16 @@ e107_include_once(e_LANGUAGEDIR.e_LANGUAGE."/".e_LANGUAGE."_custom.php");
|
||||
|
||||
$tp->initCharset(); // Now we know the site CHARSET, define how to handle utf-8 as necessary
|
||||
|
||||
|
||||
if($pref['sitelanguage'] != e_LANGUAGE && isset($pref['multilanguage']) && $pref['multilanguage'] && !$pref['multilanguage_subdomain']){
|
||||
if($pref['sitelanguage'] != e_LANGUAGE && isset($pref['multilanguage']) && $pref['multilanguage'] && !$pref['multilanguage_subdomain'])
|
||||
{
|
||||
list($clc) = explode("_",CORE_LC);
|
||||
define("e_LAN", strtolower($clc));
|
||||
define("e_LANQRY", "[".e_LAN."]");
|
||||
unset($clc);
|
||||
}else{
|
||||
define("e_LAN", FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
define("e_LAN", FALSE);
|
||||
define("e_LANQRY", FALSE);
|
||||
}
|
||||
$sql->db_Mark_Time('(Start: Pref/multilang done)');
|
||||
@ -581,13 +586,16 @@ $sql->db_Mark_Time('(Start: Pref/multilang done)');
|
||||
$sql -> db_Mark_Time('Start: Misc resources. Online user tracking, cache');
|
||||
|
||||
// cache class
|
||||
$e107cache = new ecache;
|
||||
$e107->ecache = new ecache;
|
||||
$e107cache = &$e107->ecache;
|
||||
|
||||
e107_require_once(e_HANDLER."override_class.php");
|
||||
$override=new override;
|
||||
$e107->override = new override;
|
||||
$override = &$e107->override;
|
||||
|
||||
e107_require_once(e_HANDLER."event_class.php");
|
||||
$e_event=new e107_event;
|
||||
$e107->e_event = new e107_event;
|
||||
$e_event = &$e107->e_event;
|
||||
|
||||
if (isset($pref['notify']) && $pref['notify'] == true) {
|
||||
e107_require_once(e_HANDLER.'notify_class.php');
|
||||
@ -725,13 +733,15 @@ if (!class_exists('e107_table')) {
|
||||
}
|
||||
//#############################################################
|
||||
|
||||
$ns=new e107table;
|
||||
|
||||
$e107->ns = new e107table;
|
||||
$ns = &$e107->ns;
|
||||
|
||||
$e107->ban();
|
||||
|
||||
if(varset($pref['force_userupdate']) && USER && !isset($_E107['no_forceuserupdate']))
|
||||
{
|
||||
if(force_userupdate())
|
||||
if(force_userupdate())
|
||||
{
|
||||
header("Location: ".e_BASE."usersettings.php?update");
|
||||
exit();
|
||||
@ -784,14 +794,14 @@ if ($pref['maintainance_flag'] && ADMIN == FALSE && strpos(e_SELF, "admin.php")
|
||||
|
||||
$sql->db_Mark_Time('(Start: Login/logout/ban/tz)');
|
||||
|
||||
if (isset($_POST['userlogin']) || isset($_POST['userlogin_x']))
|
||||
if (isset($_POST['userlogin']) || isset($_POST['userlogin_x']))
|
||||
{
|
||||
e107_require_once(e_HANDLER."login.php");
|
||||
$usr = new userlogin($_POST['username'], $_POST['userpass'], $_POST['autologin'],varset($_POST['hashchallenge'],''));
|
||||
}
|
||||
|
||||
if ((e_QUERY == 'logout') || (($pref['user_tracking'] == "session") && isset($_SESSION['ubrowser']) && ($_SESSION['ubrowser'] != $ubrowser)))
|
||||
//if (e_QUERY == 'logout')
|
||||
//if (e_QUERY == 'logout')
|
||||
{
|
||||
if (USER)
|
||||
{
|
||||
@ -885,15 +895,15 @@ $sql->db_Mark_Time('(Start: Find/Load Theme)');
|
||||
//----------------------------
|
||||
// The following files are assumed to use admin theme:
|
||||
// 1. Any file in the admin directory (check for non-plugin added to avoid mismatches)
|
||||
// 2. any plugin file starting with 'admin_'
|
||||
// 3. any plugin file in a folder called admin/
|
||||
// 2. any plugin file starting with 'admin_'
|
||||
// 3. any plugin file in a folder called admin/
|
||||
// 4. any file that specifies $eplug_admin = TRUE;
|
||||
//
|
||||
// e_SELF has the full HTML path
|
||||
$inAdminDir = FALSE;
|
||||
$isPluginDir = strpos(e_SELF,'/'.$PLUGINS_DIRECTORY) !== FALSE; // True if we're in a plugin
|
||||
$e107Path = str_replace($e107->base_path, "", e_SELF); // Knock off the initial bits
|
||||
if (
|
||||
if (
|
||||
(!$isPluginDir && strpos($e107Path, $ADMIN_DIRECTORY) === 0 ) // Core admin directory
|
||||
|| ($isPluginDir && (strpos(e_PAGE,"admin_") === 0 || strpos($e107Path, "admin/") !== FALSE)) // Plugin admin file or directory
|
||||
|| (varsettrue($eplug_admin)) // Admin forced
|
||||
@ -907,17 +917,17 @@ if(!defined("THEME"))
|
||||
{
|
||||
if ($inAdminDir && varsettrue($pref['admintheme'])&& (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE))
|
||||
{
|
||||
/* if (strpos(e_SELF, "newspost.php") !== FALSE)
|
||||
/* if (strpos(e_SELF, "newspost.php") !== FALSE)
|
||||
{
|
||||
define("MAINTHEME", e_THEME.$pref['sitetheme']."/"); MAINTHEME no longer used in core distribution
|
||||
} */
|
||||
checkvalidtheme($pref['admintheme']);
|
||||
}
|
||||
elseif (USERTHEME !== FALSE && USERTHEME != "USERTHEME")
|
||||
}
|
||||
elseif (USERTHEME !== FALSE && USERTHEME != "USERTHEME")
|
||||
{
|
||||
checkvalidtheme(USERTHEME);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
checkvalidtheme($pref['sitetheme']);
|
||||
}
|
||||
@ -930,16 +940,16 @@ if(!defined("THEME"))
|
||||
// here we USE the theme
|
||||
if ($inAdminDir)
|
||||
{
|
||||
if (file_exists(THEME.'admin_theme.php'))
|
||||
if (file_exists(THEME.'admin_theme.php'))
|
||||
{
|
||||
require_once(THEME.'admin_theme.php');
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once(THEME."theme.php");
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once(THEME."theme.php");
|
||||
}
|
||||
@ -959,8 +969,8 @@ if ($inAdminDir)
|
||||
{
|
||||
e107_include_once(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_".e_PAGE);
|
||||
e107_include_once(e_LANGUAGEDIR."English/admin/lan_".e_PAGE);
|
||||
}
|
||||
elseif (!in_array("lan_".e_PAGE,$exclude_lan) && !$isPluginDir)
|
||||
}
|
||||
elseif (!in_array("lan_".e_PAGE,$exclude_lan) && !$isPluginDir)
|
||||
{
|
||||
e107_include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_".e_PAGE);
|
||||
e107_include_once(e_LANGUAGEDIR."English/lan_".e_PAGE);
|
||||
@ -982,7 +992,7 @@ if ($pref['anon_post'] ? define("ANON", TRUE) : define("ANON", FALSE));
|
||||
|
||||
if (Empty($pref['newsposts']) ? define("ITEMVIEW", 15) : define("ITEMVIEW", $pref['newsposts']));
|
||||
|
||||
if ($pref['antiflood1'] == 1)
|
||||
if ($pref['antiflood1'] == 1)
|
||||
{
|
||||
define('FLOODPROTECT', TRUE);
|
||||
define('FLOODTIMEOUT', max(varset($pref['antiflood_timeout'],10),3));
|
||||
@ -1068,7 +1078,7 @@ function check_class($var, $userclass = USERCLASS_LIST, $uid = 0)
|
||||
|
||||
$lans = explode(",", e_LANLIST);
|
||||
$varList = explode(",", trim($var));
|
||||
|
||||
|
||||
rsort($varList); // check the language first.(ie. numbers come last)
|
||||
foreach($varList as $v)
|
||||
{
|
||||
@ -1182,19 +1192,20 @@ function get_user_data($uid, $extra = "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//===========================================================
|
||||
// Now look up the 'inherited' user classes
|
||||
global $e_userclass;
|
||||
if (!isset($e_userclass) && !is_object($e_userclass))
|
||||
if (!isset($e_userclass) && !is_object($e_userclass))
|
||||
{
|
||||
require_once(e_HANDLER."userclass_class.php");
|
||||
$e_userclass = new user_class;
|
||||
$e107->e_userclass = new user_class;
|
||||
$e_userclass = &$e107->e_userclass;
|
||||
}
|
||||
$var['user_class'] = $e_userclass->get_all_user_classes($var['user_class']);
|
||||
|
||||
|
||||
//===========================================================
|
||||
|
||||
|
||||
cachevars("userdata_{$uid}", $var);
|
||||
return $var;
|
||||
}
|
||||
@ -1204,9 +1215,9 @@ function get_user_data($uid, $extra = "")
|
||||
function save_prefs($table = 'core', $uid = USERID, $row_val = '')
|
||||
{
|
||||
global $pref, $user_pref, $tp, $PrefCache, $sql, $eArrayStorage;
|
||||
if ($table == 'core')
|
||||
if ($table == 'core')
|
||||
{
|
||||
if ($row_val == '')
|
||||
if ($row_val == '')
|
||||
{ // Save old version as a backup first
|
||||
$sql->db_Select_gen("REPLACE INTO `#core` (e107_name,e107_value) values ('SitePrefs_Backup', '".addslashes($PrefCache)."') ");
|
||||
|
||||
@ -1225,7 +1236,7 @@ function save_prefs($table = 'core', $uid = USERID, $row_val = '')
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$_user_pref = $tp -> toDB($user_pref);
|
||||
$tmp=addslashes(serialize($_user_pref));
|
||||
@ -1317,7 +1328,7 @@ function init_session() {
|
||||
list($uid, $upw)= explode(".", $cli_log);
|
||||
}
|
||||
|
||||
if (empty($uid) || empty($upw))
|
||||
if (empty($uid) || empty($upw))
|
||||
{
|
||||
cookie(e_COOKIE, "", (time() - 2592000));
|
||||
$_SESSION[e_COOKIE] = "";
|
||||
@ -1363,18 +1374,18 @@ function init_session() {
|
||||
$currentUser['user_realname'] = $result['user_login']; // Used by force_userupdate
|
||||
define("USERLV", $result['user_lastvisit']);
|
||||
|
||||
if ($result['user_ban'] == 1)
|
||||
{
|
||||
if ($result['user_ban'] == 1)
|
||||
{
|
||||
if (isset($pref['ban_messages']))
|
||||
{
|
||||
echo $tp->toHTML(varsettrue($pref['ban_messages'][6])); // Show message if one set
|
||||
}
|
||||
exit;
|
||||
exit;
|
||||
}
|
||||
|
||||
$user_pref = ($result['user_prefs']) ? unserialize($result['user_prefs']) : '';
|
||||
|
||||
if (isset($_POST['settheme']))
|
||||
if (isset($_POST['settheme']))
|
||||
{
|
||||
$user_pref['sitetheme'] = ($pref['sitetheme'] == $_POST['sitetheme'] ? "" : $_POST['sitetheme']);
|
||||
save_prefs("user");
|
||||
@ -1382,7 +1393,7 @@ function init_session() {
|
||||
|
||||
define("USERTHEME", (isset($user_pref['sitetheme']) && file_exists(e_THEME.$user_pref['sitetheme']."/theme.php") ? $user_pref['sitetheme'] : FALSE));
|
||||
global $ADMIN_DIRECTORY, $PLUGINS_DIRECTORY;
|
||||
if ($result['user_admin'])
|
||||
if ($result['user_admin'])
|
||||
{
|
||||
define("ADMIN", TRUE);
|
||||
define("ADMINID", $result['user_id']);
|
||||
@ -1390,13 +1401,13 @@ function init_session() {
|
||||
define("ADMINPERMS", $result['user_perms']);
|
||||
define("ADMINEMAIL", $result['user_email']);
|
||||
define("ADMINPWCHANGE", $result['user_pwchange']);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
define("ADMIN", FALSE);
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
define("USER", FALSE);
|
||||
define('USERID', 0);
|
||||
@ -1418,7 +1429,8 @@ $sql->db_Mark_Time('Start: Go online');
|
||||
if(!isset($_E107['no_online']) && varset($pref['track_online']))
|
||||
{
|
||||
e107_require_once(e_HANDLER."online_class.php");
|
||||
$e_online = new e_online();
|
||||
$e107->e_online = new e_online;
|
||||
$e_online = &$e107->e_online;
|
||||
$e_online->online($pref['track_online'], $pref['flood_protect']);
|
||||
}
|
||||
|
||||
@ -1533,9 +1545,9 @@ function class_list($uid = '')
|
||||
{
|
||||
$clist = explode(',', $class_list);
|
||||
}
|
||||
|
||||
|
||||
$clist[] = e_UC_MEMBER;
|
||||
|
||||
|
||||
if ($admin_status == true)
|
||||
{
|
||||
$clist[] = e_UC_ADMIN;
|
||||
@ -1550,10 +1562,10 @@ function class_list($uid = '')
|
||||
{
|
||||
$clist[] = e_UC_GUEST;
|
||||
}
|
||||
|
||||
|
||||
$clist[] = e_UC_READONLY;
|
||||
$clist[] = e_UC_PUBLIC;
|
||||
|
||||
|
||||
return implode(',', $clist);
|
||||
}
|
||||
|
||||
@ -1586,9 +1598,9 @@ function e107_require($fname) {
|
||||
|
||||
|
||||
|
||||
function include_lan($path, $force = false)
|
||||
function include_lan($path, $force = false)
|
||||
{
|
||||
if (!is_readable($path))
|
||||
if (!is_readable($path))
|
||||
{
|
||||
$path = str_replace(e_LANGUAGE, 'English', $path);
|
||||
}
|
||||
@ -1607,12 +1619,12 @@ function include_lan_admin($path)
|
||||
|
||||
|
||||
|
||||
if(!function_exists("print_a"))
|
||||
if(!function_exists("print_a"))
|
||||
{
|
||||
function print_a($var, $return = false)
|
||||
function print_a($var, $return = false)
|
||||
{
|
||||
$charset = "utf-8";
|
||||
if(defined("CHARSET"))
|
||||
if(defined("CHARSET"))
|
||||
{
|
||||
$charset = CHARSET;
|
||||
}
|
||||
@ -1620,8 +1632,8 @@ if(!function_exists("print_a"))
|
||||
{
|
||||
echo '<pre>'.htmlspecialchars(print_r($var, true), ENT_QUOTES, $charset).'</pre>';
|
||||
return true;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
return '<pre>'.htmlspecialchars(print_r($var, true), ENT_QUOTES, $charset).'</pre>';
|
||||
}
|
||||
@ -1631,7 +1643,7 @@ if(!function_exists("print_a"))
|
||||
|
||||
// Check that all required user fields (including extended fields) are valid.
|
||||
// Return TRUE if update required
|
||||
function force_userupdate()
|
||||
function force_userupdate()
|
||||
{
|
||||
global $sql,$pref,$currentUser;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// $Id: url.sc,v 1.2 2008-11-24 18:18:47 mcfly_e107 Exp $
|
||||
// $Id: url.sc,v 1.3 2008-11-25 16:26:02 mcfly_e107 Exp $
|
||||
$e107 = e107::getInstance();
|
||||
list($part, $section, $type, $parms) = explode('::', $parm, 4);
|
||||
list($section, $type, $parms) = explode('|', $parm, 3);
|
||||
if(strpos($parms, '=') !== false)
|
||||
{
|
||||
parse_str($parms, $p);
|
||||
@ -9,9 +9,4 @@ else
|
||||
{
|
||||
$p[$parms] = 1;
|
||||
}
|
||||
$e107->url->core = ($part == 'core');
|
||||
if($e107->url->createURL($section, $type, $p))
|
||||
{
|
||||
return $e107->url->link;
|
||||
}
|
||||
return 'Failed';
|
||||
return $e107->url->getURL($section, $type, $p);
|
||||
|
@ -1,66 +1,101 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| ©Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/e107Url.php,v $
|
||||
| $Revision: 1.1 $
|
||||
| $Date: 2008-11-24 18:06:03 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
class eURL
|
||||
{
|
||||
|
||||
var $core = false;
|
||||
var $link = '';
|
||||
|
||||
function createURL($section, $urlType, $urlItems)
|
||||
{
|
||||
if(!is_array($urlItems))
|
||||
{
|
||||
$urlItems = array($urlItems => 1);
|
||||
}
|
||||
$functionName = 'url_'.$section.'_'.$urlType;
|
||||
if(!function_exists($functionName))
|
||||
{
|
||||
$fileName = ($this->core ? e_FILE."url/custom/base/{$section}/{$urlType}.php" : e_FILE."url/custom/plugins/{$section}/{$urlType}.php");
|
||||
if(is_readable($fileName))
|
||||
{
|
||||
include_once($fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
$fileName = ($this->core ? e_FILE."url/base/{$section}/{$urlType}.php" : e_PLUGIN."{$section}/url/{$urlType}.php");
|
||||
if(is_readable($fileName))
|
||||
{
|
||||
include_once($fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(!function_exists($functionName))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if($this->link = call_user_func($functionName, $urlItems))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| ©Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/e107Url.php,v $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2008-11-25 16:26:02 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
class eURL
|
||||
{
|
||||
|
||||
var $_link_handlers = array();
|
||||
|
||||
/**
|
||||
* Get plugin url
|
||||
*
|
||||
* @param string $section
|
||||
* @param string $urlType
|
||||
* @param string|array $urlItems
|
||||
* @return string URL
|
||||
*/
|
||||
function getUrl($section, $urlType, $urlItems = array())
|
||||
{
|
||||
if (!is_array($urlItems))
|
||||
{
|
||||
$urlItems = array($urlItems => 1);
|
||||
}
|
||||
|
||||
$handlerId = $section . '/' . $urlType;
|
||||
if (!isset($this->_link_handlers[$handlerId]))
|
||||
{
|
||||
$this->_link_handlers[$handlerId] = $this->_initHandler($section, $urlType);
|
||||
}
|
||||
|
||||
return (string )call_user_func($this->_link_handlers[$handlerId], $urlItems);
|
||||
}
|
||||
|
||||
function _initHandler($section, $urlType)
|
||||
{
|
||||
$handlerId = $section . '/' . $urlType;
|
||||
$handler = 'url_' . $section . '_' . $urlType;
|
||||
$core = false;
|
||||
if (strpos($section, ':') !== false)
|
||||
{
|
||||
list($tmp, $section) = explode(':', $section, 2);
|
||||
$core = ($tmp === 'core');
|
||||
}
|
||||
|
||||
// Check to see if custom code is active and exists
|
||||
if (varsettrue($pref['url_config'][$section]))
|
||||
{
|
||||
$fileName = ($core ? e_FILE."url/custom/base/{$handlerId}.php" : e_FILE."url/custom/plugins/{$handlerId}.php");
|
||||
if (is_readable($fileName))
|
||||
{
|
||||
include_once ($fileName);
|
||||
}
|
||||
if (function_exists($handler))
|
||||
{
|
||||
return $handler;
|
||||
}
|
||||
}
|
||||
$fileName = ($core ? e_FILE."url/base/{$handlerId}.php" : e_PLUGIN."{$section}/url/{$urlType}.php");
|
||||
if (is_readable($fileName))
|
||||
{
|
||||
include_once ($fileName);
|
||||
}
|
||||
return $handler;
|
||||
}
|
||||
|
||||
/*
|
||||
Preparing for PHP5
|
||||
Exmample future calls (after stopping PHP4 support):
|
||||
$e107->url->getForum('post', array('edit' => 10));
|
||||
$e107->url->getCoreUser('user', array('id' => 10));
|
||||
|
||||
function __call($method, $arguments) {
|
||||
if (strpos($method, "getCore") === 0)
|
||||
{
|
||||
$section = strtolower(substr($method, 7));
|
||||
return $this->getCoreUrl($section, varset($arguments[0]), varset($arguments[1]));
|
||||
}
|
||||
elseif (strpos($method, "get") === 0)
|
||||
{
|
||||
$section = strtolower(substr($method, 3));
|
||||
return $this->getUrl($section, varset($arguments[0]), varset($arguments[1]));
|
||||
}
|
||||
return '';
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/e107_class.php,v $
|
||||
| $Revision: 1.24 $
|
||||
| $Date: 2008-11-25 14:36:33 $
|
||||
| $Revision: 1.25 $
|
||||
| $Date: 2008-11-25 16:26:02 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -42,16 +42,15 @@ class e107
|
||||
* @param string $e107_root_path
|
||||
* @return e107
|
||||
*/
|
||||
function e107($e107_paths, $e107_root_path)
|
||||
function e107()
|
||||
{
|
||||
if(defined('e107_php4_check') && constant('e107_php4_check'))
|
||||
{
|
||||
echo ('Fatal error! You are not allowed to direct instantinate an object for singleton class! Please use e107::getInstance()');
|
||||
exit();
|
||||
}
|
||||
$this->_init($e107_paths, $e107_root_path);
|
||||
echo ('Fatal error! You are not allowed to direct instantinate an object for singleton class! Please use e107::getInstance()');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _init($e107_paths, $e107_root_path)
|
||||
{
|
||||
$this->e107_dirs = $e107_paths;
|
||||
@ -67,7 +66,7 @@ class e107
|
||||
function &getInstance()
|
||||
{
|
||||
static $instance = array();//it's array because of an odd PHP 4 bug
|
||||
|
||||
|
||||
if(!$instance)
|
||||
{
|
||||
$instance[0] = new e107();
|
||||
@ -228,7 +227,7 @@ class e107
|
||||
* Check if current user is banned
|
||||
*
|
||||
*/
|
||||
function ban()
|
||||
function ban()
|
||||
{
|
||||
global $sql, $e107, $tp, $pref;
|
||||
$ban_count = $sql->db_Count("banlist");
|
||||
@ -297,7 +296,7 @@ class e107
|
||||
// $admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","Whitelist hit",$query,FALSE,LOG_TO_ROLLING);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
// Found banlist entry in table here
|
||||
if (($row['banlist_banexpires'] > 0) && ($row['banlist_banexpires'] < time()))
|
||||
{ // Ban has expired - delete from DB
|
||||
@ -322,11 +321,11 @@ class e107
|
||||
}
|
||||
$admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,'BAN_03','LAN_AUDIT_LOG_003',$query,FALSE,LOG_TO_ROLLING);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
// $admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","No ban found",$query,FALSE,LOG_TO_ROLLING);
|
||||
return TRUE; // Email address OK
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Add an entry to the banlist. $bantype = 1 for manual, 2 for flooding, 4 for multiple logins
|
||||
// Returns TRUE if ban accepted.
|
||||
@ -340,7 +339,7 @@ class e107
|
||||
if (!$ban_ip) return FALSE;
|
||||
// See if the address is in the whitelist
|
||||
if ($sql->db_Select('banlist','*','`banlist_bantype` >= '.BAN_TYPE_WHITELIST))
|
||||
{ // Got a whitelist entry for this
|
||||
{ // Got a whitelist entry for this
|
||||
$admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"BANLIST_11",'LAN_AL_BANLIST_11',$ban_ip,FALSE,LOG_TO_ROLLING);
|
||||
return FALSE;
|
||||
}
|
||||
@ -362,14 +361,14 @@ class e107
|
||||
* @return string
|
||||
* returns the address in internal 'normalised' IPV6 format - so most code should continue to work provided the DB Field is big enougn
|
||||
*/
|
||||
function getip()
|
||||
function getip()
|
||||
{
|
||||
if(!$this->_ip_cache)
|
||||
{
|
||||
if (getenv('HTTP_X_FORWARDED_FOR'))
|
||||
if (getenv('HTTP_X_FORWARDED_FOR'))
|
||||
{
|
||||
$ip=$_SERVER['REMOTE_ADDR'];
|
||||
if (preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", getenv('HTTP_X_FORWARDED_FOR'), $ip3))
|
||||
if (preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", getenv('HTTP_X_FORWARDED_FOR'), $ip3))
|
||||
{
|
||||
$ip2 = array('#^0\..*#',
|
||||
'#^127\..*#', // Local loopbacks
|
||||
@ -381,12 +380,12 @@ class e107
|
||||
);
|
||||
$ip = preg_replace($ip2, $ip, $ip3[1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
if ($ip == "")
|
||||
if ($ip == "")
|
||||
{
|
||||
$ip = "x.x.x.x";
|
||||
}
|
||||
@ -395,7 +394,7 @@ class e107
|
||||
return $this->_ip_cache;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Encode an IP address to internal representation. Returns string if successful; FALSE on error
|
||||
// Default separates fields with ':'; set $div='' to produce a 32-char packed hex string
|
||||
function ipEncode($ip, $div=':')
|
||||
@ -419,7 +418,7 @@ class e107
|
||||
{
|
||||
$ret .= $divider.'0000'; // Always put in one set of zeros for the blank
|
||||
$divider = $div;
|
||||
if ($s > 0)
|
||||
if ($s > 0)
|
||||
{
|
||||
$ret .= str_repeat($div.'0000',$s);
|
||||
$s = 0;
|
||||
@ -441,8 +440,8 @@ class e107
|
||||
}
|
||||
return FALSE; // Unknown
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Takes an encoded IP address - returns a displayable one
|
||||
// Set $IP4Legacy TRUE to display 'old' (IPv4) addresses in the familiar dotted format, FALSE to display in standard IPV6 format
|
||||
// Should handle most things that can be thrown at it.
|
||||
@ -521,9 +520,9 @@ class e107
|
||||
return 'unknown';
|
||||
}
|
||||
|
||||
function get_host_name($ip_address)
|
||||
function get_host_name($ip_address)
|
||||
{
|
||||
if(!$this->_host_name_cache[$ip_address])
|
||||
if(!$this->_host_name_cache[$ip_address])
|
||||
{
|
||||
$this->_host_name_cache[$ip_address] = gethostbyaddr($ip_address);
|
||||
}
|
||||
@ -533,7 +532,7 @@ class e107
|
||||
|
||||
// Return a memory value formatted helpfully
|
||||
// $dp overrides the number of decimal places displayed - realistically, only 0..3 are sensible
|
||||
function parseMemorySize($size, $dp = 2)
|
||||
function parseMemorySize($size, $dp = 2)
|
||||
{
|
||||
if (!$size) { $size = 0; }
|
||||
if ($size < 4096)
|
||||
@ -561,8 +560,8 @@ class e107
|
||||
}
|
||||
return (number_format($size, $dp).$memunit);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the current memory usage of the code
|
||||
*
|
||||
@ -576,8 +575,8 @@ class e107
|
||||
// With PHP>=5.2.0, can show peak usage as well
|
||||
if (function_exists("memory_get_peak_usage")) $ret .= '/'.$this->parseMemorySize(memory_get_peak_usage(TRUE));
|
||||
return $ret;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
return ('Unknown');
|
||||
}
|
||||
|
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/pm/pm_shortcodes.php,v $
|
||||
| $Revision: 1.6 $
|
||||
| $Date: 2008-11-24 18:06:03 $
|
||||
| $Revision: 1.7 $
|
||||
| $Date: 2008-11-25 16:26:02 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -297,7 +297,7 @@ SC_END
|
||||
SC_BEGIN PM_DELETE
|
||||
global $pm_info;
|
||||
if($parm != "")
|
||||
{
|
||||
{
|
||||
$extra = '.'.$parm;
|
||||
}
|
||||
else
|
||||
@ -350,14 +350,13 @@ if($pm_info['pm_to'] == USERID)
|
||||
SC_END
|
||||
|
||||
SC_BEGIN SEND_PM_LINK
|
||||
$e107 = e107::getInstance();
|
||||
$pm_outbox = pm_getInfo('outbox');
|
||||
if($pm_outbox['outbox']['filled'] < 100)
|
||||
{
|
||||
$e107->url->core = false;
|
||||
if($e107->url->createUrl('pm','main','send'))
|
||||
$e107 = e107::getInstance();
|
||||
if($link = $e107->url->getUrl('pm','main','send'))
|
||||
{
|
||||
return "<a href='{$e107->url->link}'>".PM_SEND_LINK."</a>";
|
||||
return "<a href='{$link}'>".PM_SEND_LINK."</a>";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
|
@ -11,13 +11,12 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/pm/private_msg_menu.php,v $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2008-11-24 18:06:03 $
|
||||
| $Revision: 1.5 $
|
||||
| $Date: 2008-11-25 16:26:02 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
global $sysprefs, $pref, $pm_prefs;
|
||||
if(!isset($pm_prefs['perpage']))
|
||||
{
|
||||
@ -31,6 +30,7 @@ define("PM_OUTBOX_ICON", "<img src='".e_PLUGIN_ABS."pm/images/mail_send.png' sty
|
||||
define("PM_SEND_LINK", LAN_PM_35);
|
||||
define("NEWPM_ANIMATION", "<img src='".e_PLUGIN_ABS."pm/images/newpm.gif' alt='' style='border:0' />");
|
||||
|
||||
|
||||
$sc_style['SEND_PM_LINK']['pre'] = "<br /><br />[ ";
|
||||
$sc_style['SEND_PM_LINK']['post'] = " ]";
|
||||
|
||||
@ -47,19 +47,20 @@ $sc_style['NEWPM_ANIMATE']['post'] = "</a>";
|
||||
if(!isset($pm_menu_template))
|
||||
{
|
||||
$pm_menu_template = "
|
||||
<a href='{URL=plugin::pm::main::box=inbox}'>".PM_INBOX_ICON."</a>
|
||||
<a href='{URL=plugin::pm::main::box=inbox}'>".LAN_PM_25."</a>
|
||||
<a href='{URL=pm|main|box=inbox}'>".PM_INBOX_ICON."</a>
|
||||
<a href='{URL=pm|main|box=inbox}'>".LAN_PM_25."</a>
|
||||
{NEWPM_ANIMATE}
|
||||
<br />
|
||||
{INBOX_TOTAL} ".LAN_PM_36.", {INBOX_UNREAD} ".LAN_PM_37." {INBOX_FILLED}
|
||||
<br />
|
||||
<a href='{URL=plugin::pm::main::box=outbox}'>".PM_OUTBOX_ICON."</a>
|
||||
<a href='{URL=plugin::pm::main::box=outbox}'>".LAN_PM_26."</a><br />
|
||||
<a href='{URL=pm|main|box=outbox}'>".PM_OUTBOX_ICON."</a>
|
||||
<a href='{URL=pm|main|box=outbox}'>".LAN_PM_26."</a><br />
|
||||
{OUTBOX_TOTAL} ".LAN_PM_36.", {OUTBOX_UNREAD} ".LAN_PM_37." {OUTBOX_FILLED}
|
||||
{SEND_PM_LINK}
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
if(check_class($pm_prefs['pm_class']))
|
||||
{
|
||||
global $tp, $pm_inbox;
|
||||
|
@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
function url_pm_main($parms)
|
||||
{
|
||||
if(isset($parms['box']))
|
||||
{
|
||||
return e_PLUGIN_ABS."pm/pm.php?{$parms['box']}";
|
||||
}
|
||||
|
||||
if(isset($parms['send']))
|
||||
{
|
||||
return e_PLUGIN_ABS."pm/pm.php?send";
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
// $Id: main.php,v 1.2 2008-11-25 16:26:03 mcfly_e107 Exp $
|
||||
function url_pm_main($parms)
|
||||
{
|
||||
if(isset($parms['box']))
|
||||
{
|
||||
return e_PLUGIN_ABS."pm/pm.php?{$parms['box']}";
|
||||
}
|
||||
|
||||
if(isset($parms['send']))
|
||||
{
|
||||
return e_PLUGIN_ABS."pm/pm.php?send";
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user