منتدى استراحات زايد

منتدى استراحات زايد (http://vb.ma7room.com/index.php)
-   منتدى أخبار المواقع والمنتديات العربية والأجنبية (http://vb.ma7room.com/forumdisplay.php?f=183)
-   -   [ مشكله ] : أرجوا الحل لملف class_core.php (http://vb.ma7room.com/showthread.php?t=1477805)

محروم.كوم 05-09-2014 04:50 PM

[ مشكله ] : أرجوا الحل لملف class_core.php
 
السلام عليكم ورحمة الله وبركاته
لو سمحتم إخوتي المنتدى متوقف بسبب اميلات الخطأ التى تصل
فارجوا الحل





Database error in vBulletin :

mysql_connect() [function.mysql-connect]: Access denied for user 'elhayah1_forum'@'localhost' (using password: YES)
/home/elhayah1/public_html/vb/includes/class_core.php on line 311


وهذا ملف class_core.php

رمز PHP:
superglobal_lookup AS $arrayname)
{
$registry->superglobal_size["$arrayname"] = sizeof($GLOBALS["$arrayname"]);

foreach (
array_keys($GLOBALS["$arrayname"]) AS $varname)
{
// make sure we dont unset any global arrays like _SERVER
if (!in_array($varname, $this->superglobal_lookup))
{
unset(
$GLOBALS["$varname"]);
}
}
}
}
else
{
foreach (
$this->superglobal_lookup AS $arrayname)
{
$registry->superglobal_size["$arrayname"] = sizeof($GLOBALS["$arrayname"]);
}
}

// deal with cookies that may conflict with _GET and _POST data, and create our own _REQUEST with no _COOKIE input
foreach (array_keys($_COOKIE) AS $varname)
{
unset(
$_REQUEST["$varname"]);
if (isset(
$_POST["$varname"]))
{
$_REQUEST["$varname"] =& $_POST["$varname"];
}
else if (isset(
$_GET["$varname"]))
{
$_REQUEST["$varname"] =& $_GET["$varname"];
}
}

// fetch client IP address
$registry->ipaddress = $this->fetch_ip();
define('IPADDRESS', $registry->ipaddress);

// attempt to fetch IP address from behind proxies - useful, but don't rely on it...
$registry->alt_ip = $this->fetch_alt_ip();
define('ALT_IP', $registry->alt_ip);

// defines if the current page was visited via SSL or not
define('REQ_PROTOCOL', (($_SERVER['HTTPS'] == 'on' OR $_SERVER['HTTPS'] == '1') ? 'https' : 'http'));

// fetch complete url of current page
$registry->scriptpath = $this->fetch_scriptpath();
define('SCRIPTPATH', $registry->scriptpath);

// fetch url of current page without the variable string
$quest_pos = strpos($registry->scriptpath, '?');
if (
$quest_pos !== false)
{
$registry->script = substr($registry->scriptpath, 0, $quest_pos);
}
else
{
$registry->script = $registry->scriptpath;
}
define('SCRIPT', $registry->script);

// fetch url of current page for Who's Online
$registry->wolpath = $this->fetch_wolpath();
define('WOLPATH', $registry->wolpath);

// define session constants
define('SESSION_HOST', substr($registry->ipaddress, 0, 15));

// define some useful contants related to environment
define('USER_AGENT', $_SERVER['HTTP_USER_AGENT']);
define('REFERRER', $_SERVER['HTTP_REFERER']);
}

/**
* Makes data in an array safe to use
*
* @param array The source array containing the data to be cleaned
* @param array Array of variable names and types we want to extract from the source array
*
* @return array
*/
function &clean_array(&$source, $variables)
{
$return = array();

foreach (
$variables AS $varname => $vartype)
{
$return["$varname"] =& $this->clean($source["$varname"], $vartype, isset($source["$varname"]));
}

return
$return;
}

/**
* Makes GPC variables safe to use
*
* @param string Either, g, p, c, r or f (corresponding to get, post, cookie, request and files)
* @param array Array of variable names and types we want to extract from the source array
*
* @return array
*/
function clean_array_gpc($source, $variables)
{
$sg =& $GLOBALS[$this->superglobal_lookup["$source"]];

foreach (
$variables AS $varname => $vartype)
{
// clean a variable only once unless its a different type
if (!isset($this->cleaned_vars["$varname"]) OR $this->cleaned_vars["$varname"] != $vartype)
{
$this->registry->GPC_exists["$varname"] = isset($sg["$varname"]);
$this->registry->GPC["$varname"] =& $this->clean(
$sg["$varname"],
$vartype,
isset(
$sg["$varname"])
);
$this->cleaned_vars["$varname"] = $vartype;
}
}
}

/**
* Makes a single GPC variable safe to use and returns it
*
* @param array The source array containing the data to be cleaned
* @param string The name of the variable in which we are interested
* @param integer The type of the variable in which we are interested
*
* @return mixed
*/
function &clean_gpc($source, $varname, $vartype = TYPE_NOCLEAN)
{
// clean a variable only once unless its a different type
if (!isset($this->cleaned_vars["$varname"]) OR $this->cleaned_vars["$varname"] != $vartype)
{
$sg =& $GLOBALS[$this->superglobal_lookup["$source"]];

$this->registry->GPC_exists["$varname"] = isset($sg["$varname"]);
$this->registry->GPC["$varname"] =& $this->clean(
$sg["$varname"],
$vartype,
isset(
$sg["$varname"])
);
$this->cleaned_vars["$varname"] = $vartype;
}

return
$this->registry->GPC["$varname"];
}

/**
* Makes a single variable safe to use and returns it
*
* @param mixed The variable to be cleaned
* @param integer The type of the variable in which we are interested
* @param boolean Whether or not the variable to be cleaned actually is set
*
* @return mixed The cleaned value
*/
function &clean(&$var, $vartype = TYPE_NOCLEAN, $exists = true)
{
if (
$exists)
{
if (
$vartype do_clean($var, $vartype);
}
else if (
is_array($var))
{
if (
$vartype >= TYPE_CONVERT_KEYS)
{
$var = array_keys($var);
$vartype -= TYPE_CONVERT_KEYS;
}
else
{
$vartype -= TYPE_CONVERT_SINGLE;
}

foreach (
array_keys($var) AS $key)
{
$this->do_clean($var["$key"], $vartype);
}
}
else
{
$var = array();
}
return
$var;
}
else
{
if (
$vartype registry =& $registry;
$db =& $this->registry->db;
$gotsession = false;

if (!
defined('SESSION_IDHASH'))
{
define('SESSION_IDHASH', md5($_SERVER['HTTP_USER_AGENT'] . $this->fetch_substr_ip($registry->alt_ip))); // this should *never* change during a session
}

// sessionhash specified, so see if it already exists
if ($sessionhash AND !defined('SKIP_SESSIONCREATE'))
{
if (
$session = $db->query_first_slave("
SELECT *
FROM "
. TABLE_PREFIX . "session
WHERE sessionhash = '"
. $db->escape_string($sessionhash) . "'
AND lastactivity > "
. (TIMENOW - $registry->options['cookietimeout']) . "
AND idhash = '"
. $this->registry->db->escape_string(SESSION_IDHASH) . "'
"
) AND $this->fetch_substr_ip($session['host']) == $this->fetch_substr_ip(SESSION_HOST))
{
$gotsession = true;
$this->vars =& $session;
$this->created = false;

// found a session - get the userinfo
if ($session['userid'] != 0)
{
$useroptions = (defined('IN_CONTROL_PANEL') ? 16 : 0) + (defined('AVATAR_ON_NAVBAR') ? 2 : 0);
$userinfo = fetch_userinfo($session['userid'], $useroptions, (!empty($languageid) ? $languageid : $session['languageid']));
$this->userinfo =& $userinfo;
}
}
}

// or maybe we can use a cookie..
if (($gotsession == false OR empty($session['userid'])) AND $userid AND $password AND !defined('SKIP_SESSIONCREATE'))
{
$useroptions = (defined('IN_CONTROL_PANEL') ? FETCH_USERINFO_ADMIN : 0) + (defined('AVATAR_ON_NAVBAR') ? FETCH_USERINFO_AVATAR : 0);
$userinfo = fetch_userinfo($userid, $useroptions, $languageid);

if (
md5($userinfo['password'] . COOKIE_SALT) == $password)
{
$gotsession = true;

// combination is valid
if (!empty($session['sessionhash']))
{
// old session still exists; kill it
$db->shutdown_query("
DELETE FROM "
. TABLE_PREFIX . "session
WHERE sessionhash = '"
. $this->registry->db->escape_string($session['sessionhash']). "'
"
);
}

$this->vars = $this->fetch_session($userinfo['userid']);
$this->created = true;

$this->userinfo =& $userinfo;
}
}

// at this point, we're a guest, so lets try to *find* a session
// you can prevent this check from being run by passing in a userid with no password
if ($gotsession == false AND $userid == 0 AND !defined('SKIP_SESSIONCREATE'))
{
if (
$session = $db->query_first_slave("
SELECT *
FROM "
. TABLE_PREFIX . "session
WHERE userid = 0
AND host = '"
. $this->registry->db->escape_string(SESSION_HOST) . "'
AND idhash = '"
. $this->registry->db->escape_string(SESSION_IDHASH) . "'
LIMIT 1
"
))
{
$gotsession = true;

$this->vars =& $session;
$this->created = false;
}
}

// well, nothing worked, time to create a new session
if ($gotsession == false)
{
$gotsession = true;

$this->vars = $this->fetch_session(0);
$this->created = true;
}

$this->vars['dbsessionhash'] = $this->vars['sessionhash'];

$this->set('styleid', $styleid);
$this->set('languageid', $languageid);
if (
$this->created == false)
{
$this->set('useragent', USER_AGENT);
$this->set('lastactivity', TIMENOW);
if (!
defined('LOCATION_BYPASS'))
{
$this->set('location', WOLPATH);
}
$this->set('bypass', SESSION_BYPASS);
}
}

/**
* Saves the session into the database by inserting it or updating an existing one.
*/
function save()
{
if (
defined('SKIP_SESSIONCREATE'))
{
return;
}

$cleaned = $this->build_query_array();

// since the sessionhash can be blanked out, lets make sure we pull from "dbsessionhash"
$cleaned['sessionhash'] = "'" . $this->registry->db->escape_string($this->vars['dbsessionhash']) . "'";

if (
$this->created == true)
{
/*insert query*/
$this->registry->db->query_write("
INSERT IGNORE INTO "
. TABLE_PREFIX . "session
("
. implode(', ', array_keys($cleaned)) . ")
VALUES
("
. implode(', ', $cleaned) . ")
"
);
}
else
{
// update query

unset($this->changes['sessionhash']); // the sessionhash is not updateable
$update = array();
foreach (
$cleaned AS $key => $value)
{
if (!empty(
$this->changes["$key"]))
{
$update[] = "$key = $value";
}
}

if (
sizeof($update) > 0)
{
// note that $cleaned['sessionhash'] has been escaped as necessary above!
$this->registry->db->query_write("
UPDATE "
. TABLE_PREFIX . "session
SET "
. implode(', ', $update) . "
WHERE sessionhash =
$cleaned[sessionhash]
"
);
}
}

$this->changes = array();
}

/**
* Builds an array that can be used to build a query to insert/update the session
*
* @return array Array of column name => prepared value
*/
function build_query_array()
{
$return = array();
foreach (
$this->db_fields AS $fieldname => $cleantype)
{
switch (
$cleantype)
{
case
TYPE_INT:
$cleaned = intval($this->vars["$fieldname"]);
break;
case
TYPE_STR:
default:
$cleaned = "'" . $this->registry->db->escape_string($this->vars["$fieldname"]) . "'";
}
$return["$fieldname"] = $cleaned;
}

return
$return;
}

/**
* Sets a session variable and updates the change list.
*
* @param string Name of session variable to update
* @param string Value to update it with
*/
function set($key, $value)
{
if (!isset(
$this->vars["$key"]) OR $this->vars["$key"] != $value)
{
$this->vars["$key"] = $value;
$this->changes["$key"] = true;
}
}

/**
* Sets the session visibility (whether session info shows up in a URL). Updates are put in the $vars member.
*
* @param bool Whether the session elements should be visible.
*/
function set_session_visibility($invisible)
{
$this->visible = !$invisible;

if (
$invisible)
{
$this->vars['sessionhash'] = '';
$this->vars['sessionurl'] = '';
$this->vars['sessionurl_q'] = '';
$this->vars['sessionurl_js'] = '';
}
else
{
$this->vars['sessionurl'] = 's=' . $this->vars['dbsessionhash'] . '&';
$this->vars['sessionurl_q'] = '?s=' . $this->vars['dbsessionhash'];
$this->vars['sessionurl_js'] = 's=' . $this->vars['dbsessionhash'] . '&';
}
}

/**
* Fetches a valid sessionhash value, not necessarily the one tied to this session.
*
* @return string 32-character sessionhash
*/
function fetch_sessionhash()
{
return
md5(uniqid(microtime(), true));
}

/**
* Returns the IP address with the specified number of octets removed
*
* @param string IP address
*
* @return string truncated IP address
*/
function fetch_substr_ip($ip, $length = null)
{
if (
$length === null OR $length > 3)
{
$length = $this->registry->options['ipcheck'];
}
return
implode('.', array_slice(explode('.', $ip), 0, 4 - $length));
}

/**
* Fetches a default session. Used when creating a new session.
*
* @param integer User ID the session should be for
*
* @return array Array of session variables
*/
function fetch_session($userid = 0)
{
$sessionhash = $this->fetch_sessionhash();
if (!
defined('SKIP_SESSIONCREATE'))
{
vbsetcookie('sessionhash', $sessionhash, false, false, true);
}

return array(
'sessionhash' => $sessionhash,
'dbsessionhash' => $sessionhash,
'userid' => intval($userid),
'host' => SESSION_HOST,
'idhash' => SESSION_IDHASH,
'lastactivity' => TIMENOW,
'location' => defined('LOCATION_BYPASS') ? '' : WOLPATH,
'styleid' => 0,
'languageid' => 0,
'loggedin' => intval($userid) ? 1 : 0,
'inforum' => 0,
'inthread' => 0,
'incalendar' => 0,
'badlocation' => 0,
'profileupdate' => 0,
'useragent' => USER_AGENT,
'bypass' => SESSION_BYPASS
);

}

/**
* Returns appropriate user info for the owner of this session.
*
* @return array Array of user information.
*/
function &fetch_userinfo()
{
if (
$this->userinfo)
{
// we already calculated this
return $this->userinfo;
}
else if (
$this->vars['userid'] AND !defined('SKIP_USERINFO'))
{
// user is logged in
$useroptions = (defined('IN_CONTROL_PANEL') ? FETCH_USERINFO_ADMIN : 0) + (defined('AVATAR_ON_NAVBAR') ? FETCH_USERINFO_AVATAR : 0);
$this->userinfo = fetch_userinfo($this->vars['userid'], $useroptions, $this->vars['languageid']);
return
$this->userinfo;
}
else
{
// guest setup
$this->userinfo = array(
'userid' => 0,
'usergroupid' => 1,
'username' => (!empty($_REQUEST['username']) ? htmlspecialchars_uni($_REQUEST['username']) : ''),
'password' => '',
'email' => '',
'styleid' => $this->vars['styleid'],
'languageid' => $this->vars['languageid'],
'lastactivity' => $this->vars['lastactivity'],
'daysprune' => 0,
'timezoneoffset' => $this->registry->options['timeoffset'],
'dstonoff' => $this->registry->options['dstonoff'],
'showsignatures' => 1,
'showavatars' => 1,
'showimages' => 1,
'showusercss' => 1,
'dstauto' => 0,
'maxposts' => -1,
'startofweek' => 1,
'threadedmode' => $this->registry->options['threadedmode'],
'securitytoken' => 'guest',
'securitytoken_raw' => 'guest'
);

$this->userinfo['options'] =
$this->registry->bf_misc_useroptions['showsignatures'] | $this->registry->bf_misc_useroptions['showavatars'] |
$this->registry->bf_misc_useroptions['showimages'] | $this->registry->bf_misc_useroptions['dstauto'] |
$this->registry->bf_misc_useroptions['showusercss'];

if (!
defined('SKIP_USERINFO'))
{
// get default language
$phraseinfo = $this->registry->db->query_first_slave("
SELECT languageid"
. fetch_language_fields_sql(0) . "
FROM "
. TABLE_PREFIX . "language
WHERE languageid = "
. (!empty($this->vars['languageid']) ? $this->vars['languageid'] : intval($this->registry->options['languageid'])) . "
"
);
if (empty(
$phraseinfo))
{
// can't phrase this since we can't find the language
trigger_error('The requested language does not exist, reset via tools.php.', E_USER_ERROR);
}
foreach(
$phraseinfo AS $_arrykey => $_arryval)
{
$this->userinfo["$_arrykey"] = $_arryval;
}
unset(
$phraseinfo);
}

return
$this->userinfo;
}
}

/**
* Updates the last visit and last activity times for guests and registered users (differently).
* Last visit is set to the last activity time (before it's updated) only when a certain
* time has lapsed. Last activity is always set to the specified time.
*
* @param integer Time stamp for last visit time (guest only)
* @param integer Time stamp for last activity time (guest only)
*/
function do_lastvisit_update($lastvisit = 0, $lastactivity = 0)
{
// update last visit/activity stuff
if ($this->vars['userid'] == 0)
{
// guest -- emulate last visit/activity for registered users by cookies
if ($lastvisit)
{
// we've been here before
$this->userinfo['lastvisit'] = intval($lastvisit);
$this->userinfo['lastactivity'] = ($lastvisit ? intval($lastvisit) : TIMENOW);

// here's the emulation
if (TIMENOW - $this->userinfo['lastactivity'] > $this->registry->options['cookietimeout'])
{
$this->userinfo['lastvisit'] = $this->userinfo['lastactivity'];

vbsetcookie('lastvisit', $this->userinfo['lastactivity']);
}
}
else
{
// first visit!
$this->userinfo['lastactivity'] = TIMENOW;
$this->userinfo['lastvisit'] = TIMENOW;

vbsetcookie('lastvisit', TIMENOW);
}
vbsetcookie('lastactivity', $lastactivity);
}
else
{
// registered user
if (!SESSION_BYPASS)
{
if (
TIMENOW - $this->userinfo['lastactivity'] > $this->registry->options['cookietimeout'])
{
// see if session has 'expired' and if new post indicators need resetting
$this->registry->db->shutdown_query("
UPDATE "
. TABLE_PREFIX . "user
SET
lastvisit = lastactivity,
lastactivity = "
. TIMENOW . "
WHERE userid = "
. $this->userinfo['userid'] . "
"
, 'lastvisit');

$this->userinfo['lastvisit'] = $this->userinfo['lastactivity'];
}
else
{
// if this line is removed (say to be replaced by a cron job, you will need to change all of the 'online'
// status indicators as they use $userinfo['lastactivity'] to determine if a user is online which relies
// on this to be updated in real time.
$this->registry->db->shutdown_query("
UPDATE "
. TABLE_PREFIX . "user
SET lastactivity = "
. TIMENOW . "
WHERE userid = "
. $this->userinfo['userid'] . "
"
, 'lastvisit');
}
}
}
}
}

/**
* Class to handle shutdown
*
* @package vBulletin
* @version $Revision: 31739 $
* @author Scott
* @date $Date: 2009-08-10 12:40:27 -0500 (Mon, 10 Aug 2009) $
*/
class vB_Shutdown
{
var
$shutdown = array();

/**
* Constructor. Empty.
*/
function vB_Shutdown()
{
}

/**
* Singleton emulation - use this function to instantiate the class
*
* @return vB_Shutdown
*/
function &init()
{
static
$instance;

if (!
$instance)
{
$instance = new vB_Shutdown();
// we register this but it might not be used
if (phpversion() shutdown))
{
$obj->shutdown[] = $function;
}
}

// only called when an object is destroyed, so $this is appropriate
function __destruct()
{
if (!empty(
$this->shutdown))
{
foreach (
$this->shutdown AS $key => $funcname)
{
$funcname();
unset(
$this->shutdown[$key]);
}
}
}
}

// ################################################## ###########################
// misc functions

// ################################################## ###########################
/**
* Feeds database connection errors into the halt() method of the vB_Database class.
*
* @param integer Error number
* @param string PHP error text string
* @param strig File that contained the error
* @param integer Line in the file that contained the error
*/
function catch_db_error($errno, $errstr, $errfile, $errline)
{
global
$db;
static
$failures;

if (
strstr($errstr, 'Lost connection') AND $failures halt("$errstr\r\n$errfile on line $errline");
}
else
{
vb_error_handler($errno, $errstr, $errfile, $errline);
}
}

// ################################################## ###########################
/**
* Removes the full path from being disclosed on any errors
*
* @param integer Error number
* @param string PHP error text string
* @param strig File that contained the error
* @param integer Line in the file that contained the error
*/
function vb_error_handler($errno, $errstr, $errfile, $errline)
{
global
$vbulletin;

switch (
$errno)
{
case
E_WARNING:
case
E_USER_WARNING:
/* Don't log warnings due to to the false bug reports about valid warnings that we suppress, but still appear in the log
require_once(DIR . '/includes/functions_log_error.php');
$message = "Warning: $errstr in $errfile on line $errline";
log_vbulletin_error($message, 'php');
*/

if (!error_reporting() OR !ini_get('display_errors'))
{
return;
}
$errfile = str_replace(DIR, '[path]', $errfile);
$errstr = str_replace(DIR, '[path]', $errstr);
echo
"Warning: $errstr in $errfile on line $errline";
break;

case
E_USER_ERROR:
require_once(
DIR . '/includes/functions_log_error.php');
$message = "Fatal error: $errstr in $errfile on line $errline";
log_vbulletin_error($message, 'php');

if (!
headers_sent())
{
if (
SAPI_NAME == 'cgi' OR SAPI_NAME == 'cgi-fcgi')
{
header('Status: 500 Internal Server Error');
}
else
{
header('HTTP/1.1 500 Internal Server Error');
}
}

if (
error_reporting() OR ini_get('display_errors'))
{
$errfile = str_replace(DIR, '[path]', $errfile);
$errstr = str_replace(DIR, '[path]', $errstr);
echo
"Fatal error: $errstr in $errfile on line $errline";
if (
function_exists('debug_print_backtrace') AND ($vbulletin->userinfo['usergroupid'] == 6 OR ($vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions)))
{
// This is needed so IE doesn't show the pretty error messages
echo str_repeat(' ', 512);
debug_print_backtrace();
}
}
exit;
break;
}
}

// ################################################## ###########################
/**
* Unicode-safe version of htmlspecialchars()
*
* @param string Text to be made html-safe
*
* @return string
*/
function htmlspecialchars_uni($text, $entities = true)
{
return
str_replace(
// replace special html characters
array('', '"'),
array(
'<', '>', '&quot;'),
preg_replace(
// translates all non-unicode entities
'/&(?!' . ($entities ? '#[0-9]+|shy' : '(#[0-9]+|[a-z]+)') . ';)/si',
'&',
$text
)
);
}

/*================================================= =====================*\
|| ################################################## ##################
|| # CVS: $RCSfile$ - $Revision: 31739 $
|| ################################################## ##################
\*================================================ ======================*/
?>



في انتظاركم وجزاكم الله كل الخير


الساعة الآن 10:55 AM

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.5.2 TranZ By Almuhajir


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227