mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +02:00
Global pointers clean-up (& headers)
This commit is contained in:
@@ -2,14 +2,10 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
@@ -28,6 +24,7 @@ class e_ranks
|
|||||||
|
|
||||||
|
|
||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
|
$sql = e107::getDb();
|
||||||
//Check to see if we can get it from cache
|
//Check to see if we can get it from cache
|
||||||
if($force == false && ($ranks = $e107->ecache->retrieve_sys('nomd5_user_ranks')))
|
if($force == false && ($ranks = $e107->ecache->retrieve_sys('nomd5_user_ranks')))
|
||||||
{
|
{
|
||||||
@@ -37,10 +34,10 @@ class e_ranks
|
|||||||
{
|
{
|
||||||
//force is true, or cache doesn't exist, or system cache disabled, let's get it from table
|
//force is true, or cache doesn't exist, or system cache disabled, let's get it from table
|
||||||
$this->ranks = array();
|
$this->ranks = array();
|
||||||
if($e107->sql->db_Select('generic', '*', "gen_type = 'user_rank_data' ORDER BY gen_intdata ASC"))
|
if($sql->select('generic', '*', "gen_type = 'user_rank_data' ORDER BY gen_intdata ASC"))
|
||||||
{
|
{
|
||||||
$i=0;
|
$i=0;
|
||||||
while($row = $e107->sql->db_Fetch())
|
while($row = $sql->fetch())
|
||||||
{
|
{
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
$tmp['name'] = $row['gen_ip'];
|
$tmp['name'] = $row['gen_ip'];
|
||||||
|
@@ -2,15 +2,12 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
* Forum upgrade routines
|
* Forum upgrade routines
|
||||||
*
|
*
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -31,6 +28,7 @@ $timestart = microtime();
|
|||||||
|
|
||||||
$f = new forumUpgrade;
|
$f = new forumUpgrade;
|
||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
|
$sql = e107::getDb();
|
||||||
|
|
||||||
$upgradeNeeded = $f->checkUpdateNeeded();
|
$upgradeNeeded = $f->checkUpdateNeeded();
|
||||||
$upgradeNeeded = true;
|
$upgradeNeeded = true;
|
||||||
@@ -112,7 +110,7 @@ function step1()
|
|||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
$e107->ns->tablerender('Step 1: Attachment directory permissions', $mes->render(). $text);
|
e107::getRender()->tablerender('Step 1: Attachment directory permissions', $mes->render(). $text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,7 +346,7 @@ function step4()
|
|||||||
$tmp['track_userid'] = $userId;
|
$tmp['track_userid'] = $userId;
|
||||||
$tmp['track_thread'] = $threadId;
|
$tmp['track_thread'] = $threadId;
|
||||||
|
|
||||||
$e107->sql->db_Insert('forum_track', $tmp);
|
e107::getDb()->insert('forum_track', $tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -613,7 +611,7 @@ function step8()
|
|||||||
<input class='btn button' type='submit' name='calculate_lastpost' value='Proceed with lastpost calculation' />
|
<input class='btn button' type='submit' name='calculate_lastpost' value='Proceed with lastpost calculation' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
e107::getRender()->tablerender($stepCaption, $text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -632,12 +630,13 @@ function step8()
|
|||||||
<input class='btn button' type='submit' name='nextStep[9]' value='Proceed to step 9' />
|
<input class='btn button' type='submit' name='nextStep[9]' value='Proceed to step 9' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
e107::getRender()->tablerender($stepCaption, $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
function step9()
|
function step9()
|
||||||
{
|
{
|
||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
|
$sql = e107::getDb();
|
||||||
$stepCaption = 'Step 9: Migrate poll information';
|
$stepCaption = 'Step 9: Migrate poll information';
|
||||||
if(!isset($_POST['migrate_polls']))
|
if(!isset($_POST['migrate_polls']))
|
||||||
{
|
{
|
||||||
@@ -648,7 +647,7 @@ function step9()
|
|||||||
<input class='btn button' type='submit' name='migrate_polls' value='Proceed with poll migration' />
|
<input class='btn button' type='submit' name='migrate_polls' value='Proceed with poll migration' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
e107::getRender()->tablerender($stepCaption, $text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -657,17 +656,17 @@ function step9()
|
|||||||
LEFT JOIN `#forum_thread` AS t ON t.thread_id = p.poll_datestamp
|
LEFT JOIN `#forum_thread` AS t ON t.thread_id = p.poll_datestamp
|
||||||
WHERE t.thread_id IS NOT NULL
|
WHERE t.thread_id IS NOT NULL
|
||||||
";
|
";
|
||||||
if($e107->sql->db_Select_gen($qry))
|
if($sql->gen($qry))
|
||||||
{
|
{
|
||||||
while($row = $e107->sql->db_Fetch(MYSQL_ASSOC))
|
while($row = $sql->fetch(MYSQL_ASSOC))
|
||||||
{
|
{
|
||||||
$threadList[] = $row['thread_id'];
|
$threadList[] = $row['thread_id'];
|
||||||
}
|
}
|
||||||
foreach($threadList as $threadId)
|
foreach($threadList as $threadId)
|
||||||
{
|
{
|
||||||
if($e107->sql->db_Select('forum_thread', 'thread_options', 'thread_id = '.$threadId, 'default'))
|
if($sql->select('forum_thread', 'thread_options', 'thread_id = '.$threadId, 'default'))
|
||||||
{
|
{
|
||||||
$row = $e107->sql->db_Fetch(MYSQL_ASSOC);
|
$row = $sql->fetch(MYSQL_ASSOC);
|
||||||
if($row['thread_options'])
|
if($row['thread_options'])
|
||||||
{
|
{
|
||||||
$opts = unserialize($row['thread_options']);
|
$opts = unserialize($row['thread_options']);
|
||||||
@@ -681,7 +680,7 @@ function step9()
|
|||||||
$tmp['thread_options'] = serialize($opts);
|
$tmp['thread_options'] = serialize($opts);
|
||||||
$tmp['WHERE'] = 'thread_id = '.$threadId;
|
$tmp['WHERE'] = 'thread_id = '.$threadId;
|
||||||
// $tmp['_FIELD_TYPES']['thread_options'] = 'escape';
|
// $tmp['_FIELD_TYPES']['thread_options'] = 'escape';
|
||||||
$e107->sql->db_Update('forum_thread', $tmp);
|
$sql->update('forum_thread', $tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -697,7 +696,7 @@ function step9()
|
|||||||
<input class='btn button' type='submit' name='nextStep[10]' value='Proceed to step 10' />
|
<input class='btn button' type='submit' name='nextStep[10]' value='Proceed to step 10' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
e107::getRender()->tablerender($stepCaption, $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
function step10()
|
function step10()
|
||||||
@@ -927,12 +926,13 @@ function step10()
|
|||||||
<input class='btn button' type='submit' name='nextStep[11]' value='Proceed to step 11' />
|
<input class='btn button' type='submit' name='nextStep[11]' value='Proceed to step 11' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
$ns->tablerender($stepCaption, $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
function step11()
|
function step11()
|
||||||
{
|
{
|
||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
|
$ns = e107::getRender();
|
||||||
$stepCaption = 'Step 11: Delete old attachments';
|
$stepCaption = 'Step 11: Delete old attachments';
|
||||||
if(!isset($_POST['delete_orphans']))
|
if(!isset($_POST['delete_orphans']))
|
||||||
{
|
{
|
||||||
@@ -946,7 +946,7 @@ function step11()
|
|||||||
<input class='btn button' type='submit' name='delete_orphans' value='Proceed with attachment deletion' />
|
<input class='btn button' type='submit' name='delete_orphans' value='Proceed with attachment deletion' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
e107::getRender()->tablerender($stepCaption, $text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -988,7 +988,7 @@ function step11()
|
|||||||
<input class='btn button' type='submit' name='nextStep[12]' value='Proceed to step 12' />
|
<input class='btn button' type='submit' name='nextStep[12]' value='Proceed to step 12' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
$ns->tablerender($stepCaption, $text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$text = "There were {$numFiles} orphaned files found<br /><br />";
|
$text = "There were {$numFiles} orphaned files found<br /><br />";
|
||||||
@@ -1012,7 +1012,7 @@ function step11()
|
|||||||
<input class='btn button' type='submit' name='delete_orphans' value='Delete files' />
|
<input class='btn button' type='submit' name='delete_orphans' value='Delete files' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
$ns->tablerender($stepCaption, $text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1024,7 +1024,7 @@ function step11()
|
|||||||
<input class='btn button' type='submit' name='nextStep[12]' value='Proceed to step 12' />
|
<input class='btn button' type='submit' name='nextStep[12]' value='Proceed to step 12' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
$ns->tablerender($stepCaption, $text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1139,16 +1139,17 @@ class forumUpgrade
|
|||||||
|
|
||||||
function getUpdateInfo()
|
function getUpdateInfo()
|
||||||
{
|
{
|
||||||
|
$sql = e107::getDb();
|
||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
if($e107->sql->db_Select('generic', '*', "gen_type = 'forumUpgrade'"))
|
if($select('generic', '*', "gen_type = 'forumUpgrade'"))
|
||||||
{
|
{
|
||||||
$row = $e107->sql->db_Fetch(MYSQL_ASSOC);
|
$row = $sql->fetch(MYSQL_ASSOC);
|
||||||
$this->updateInfo = unserialize($row['gen_chardata']);
|
$this->updateInfo = unserialize($row['gen_chardata']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$qry = "INSERT INTO `#generic` (gen_type) VALUES ('forumUpgrade')";
|
$qry = "INSERT INTO `#generic` (gen_type) VALUES ('forumUpgrade')";
|
||||||
$e107->sql->db_Select_gen($qry);
|
$sql->gen($qry);
|
||||||
$this->updateInfo = array();
|
$this->updateInfo = array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1158,7 +1159,7 @@ class forumUpgrade
|
|||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
$info = mysql_real_escape_string(serialize($this->updateInfo));
|
$info = mysql_real_escape_string(serialize($this->updateInfo));
|
||||||
$qry = "UPDATE `#generic` Set gen_chardata = '{$info}' WHERE gen_type = 'forumUpgrade'";
|
$qry = "UPDATE `#generic` Set gen_chardata = '{$info}' WHERE gen_type = 'forumUpgrade'";
|
||||||
$e107->sql->db_Select_gen($qry);
|
e107::getDb()->gen($qry);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setNewVersion()
|
function setNewVersion()
|
||||||
@@ -1178,9 +1179,9 @@ class forumUpgrade
|
|||||||
global $forum;
|
global $forum;
|
||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
$threadId = (int)$threadId;
|
$threadId = (int)$threadId;
|
||||||
if($e107->sql->db_Select('forum_t', '*', "thread_parent = {$threadId} OR thread_id = {$threadId}", 'default'))
|
if(e107::getDb()->select('forum_t', '*', "thread_parent = {$threadId} OR thread_id = {$threadId}", 'default'))
|
||||||
{
|
{
|
||||||
$threadData = $e107->sql->db_getList();
|
$threadData = e107::getDb()->db_getList();
|
||||||
foreach($threadData as $post)
|
foreach($threadData as $post)
|
||||||
{
|
{
|
||||||
if($post['thread_parent'] == 0)
|
if($post['thread_parent'] == 0)
|
||||||
@@ -1226,7 +1227,7 @@ class forumUpgrade
|
|||||||
// $thread['_FIELD_TYPES'] = $forum->fieldTypes['forum_thread'];
|
// $thread['_FIELD_TYPES'] = $forum->fieldTypes['forum_thread'];
|
||||||
// $thread['_FIELD_TYPES']['thread_name'] = 'escape'; //use escape to prevent double entities
|
// $thread['_FIELD_TYPES']['thread_name'] = 'escape'; //use escape to prevent double entities
|
||||||
|
|
||||||
$result = $e107->sql->db_Insert('forum_thread', $thread);
|
$result = e107::getDb()->insert('forum_thread', $thread);
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
// return $e107->sql->db_Insert('forum_thread', $thread);
|
// return $e107->sql->db_Insert('forum_thread', $thread);
|
||||||
@@ -1254,7 +1255,7 @@ class forumUpgrade
|
|||||||
// $newPost['_FIELD_TYPES']['post_entry'] = 'escape'; //use escape to prevent double entities
|
// $newPost['_FIELD_TYPES']['post_entry'] = 'escape'; //use escape to prevent double entities
|
||||||
// print_a($newPost);
|
// print_a($newPost);
|
||||||
// exit;
|
// exit;
|
||||||
$result =$e107->sql->db_Insert('forum_post', $newPost);
|
$result = e107::getDb()->insert('forum_post', $newPost);
|
||||||
// exit;
|
// exit;
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user