1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-28 08:39:57 +02:00

Issue #4283 - Update deprecated sql method usage. Removed old code.

This commit is contained in:
Cameron
2020-12-17 05:52:54 -08:00
parent 8c0e2c0392
commit 42f0e902d4
42 changed files with 76 additions and 3627 deletions

View File

@@ -119,7 +119,7 @@ function show_admins()
$sql->db_Select("user", "*", "user_admin='1'");
$sql->select("user", "*", "user_admin='1'");
$text = "
<form action='".e_SELF."' method='post' id='del_administrator'>

View File

@@ -166,8 +166,7 @@ else
$cookieval = $row['user_id'].".".md5($row['user_password']);
// $sql->db_Select("user", "*", "user_name='".$tp -> toDB($_POST['authname'])."'");
// list($user_id, $user_name, $userpass) = $sql->db_Fetch();
// Calculate class membership - needed for a couple of things
// Problem is that USERCLASS_LIST just contains 'guest' and 'everyone' at this point

View File

@@ -1137,7 +1137,7 @@ if ($writeBanFile)
// Edit modes - get existing entry
if ($action == 'edit' || $action == 'whedit')
{
$sql->db_Select('banlist', '*', "banlist_ip='{$sub_action}'");
$sql->select('banlist', '*', "banlist_ip='{$sub_action}'");
$row = $sql->fetch();
extract($row); //FIXME - kill extract()
}
@@ -1695,7 +1695,7 @@ switch ($action)
$filter = ($action == 'white') ? 'banlist_bantype='.eIPHandler::BAN_TYPE_WHITELIST : 'banlist_bantype!='.eIPHandler::BAN_TYPE_WHITELIST;
if(!$ban_total = $sql->db_Select("banlist", "*", $filter." ORDER BY banlist_ip"))
if(!$ban_total = $sql->select("banlist", "*", $filter." ORDER BY banlist_ip"))
{
//$text .= "<div class='center'>".$no_values[$action]."</div>";
$mes->addInfo($no_values[$action]);

View File

@@ -348,55 +348,3 @@ e107::getAdminUI()->runPage();
require_once(e_ADMIN."footer.php");
exit;
/*
if (e_QUERY)
{
$temp = explode("-", e_QUERY);
$action = $temp[0];
$id = intval($temp[1]);
$item = $temp[2];
$c_item = $temp[3];
if ($sql->select('comments','*', 'comment_id='.$id))
{
$comment = $sql->db_Fetch();
if ($action == "block")
{
$sql->db_Update("comments", "comment_blocked='1' WHERE comment_id=".$id);
}
if ($action == "unblock")
{
$sql->db_Update("comments", "comment_blocked='0' WHERE comment_id=".$id);
}
if ($action == "delete")
{
$sql->db_Delete("comments", "comment_id=".$id);
switch ($comment['comment_type'])
{
case '0' :
case 'news' : // Need to update count in news record as well
$sql2->db_Update('news', 'news_comment_total = CAST(GREATEST(CAST(news_comment_total AS SIGNED) - 1, 0) AS UNSIGNED) WHERE news_id='.$comment['comment_item_id']);
break;
}
}
if (!$e107cache->clear($item))
{
$tmp = explode("?", $item);
$item = $tmp[0]."?news.".$c_item;
$e107cache->clear($item);
}
}
}
else
{
// $cm= new comment_manager;
// $cm->commentList();
}
// echo "<script type='text/javascript'>window.history.go(-1);</script>\n";
*/
?>

View File

@@ -359,7 +359,7 @@ class media_form_ui extends e_admin_form_ui
/*$sql = e107::getDb();
// $sql->gen("SELECT media_cat_title, media_title_nick FROM #core_media as m LEFT JOIN #core_media_cat as c ON m.media_category = c.media_cat_owner GROUP BY m.media_category");
$sql->gen("SELECT media_cat_title, media_cat_owner FROM #core_media_cat");
while($row = $sql->db_Fetch())
while($row = $sql->fetch())
{
$cat = $row['media_cat_owner'];
$this->cats[$cat] = $row['media_cat_title'];
@@ -2769,9 +2769,9 @@ class media_admin_ui extends e_admin_ui
$image_pre = '';
$disabled = false;
/*
if ($sql->db_Select("user", "*", "user_image='-upload-".$tp->toDB($image_name)."' OR user_sess='".$tp->toDB($image_name)."'"))
if ($sql->select("user", "*", "user_image='-upload-".$tp->toDB($image_name)."' OR user_sess='".$tp->toDB($image_name)."'"))
{
$row = $sql->db_Fetch();
$row = $sql->fetch();
if($row['user_image'] == '-upload-'.$image_name) $image_pre = '-upload-';
$users .= "<a href='".$e107->url->create('user/profile/view', 'name='.$row['user_name'].'&id='.$row['user_id'])."'>{$row['user_name']}</a> <span class='smalltext'>(".($row['user_sess'] == $image_name ? IMALAN_24 : IMALAN_23).")</span>";
}
@@ -3422,7 +3422,7 @@ class media_admin_ui extends e_admin_ui
/*
if(file_exists($newpath) || $sql->db_Select("core_media","media_url = '".$tp->createConstants($newpath,'rel')."' LIMIT 1") )
if(file_exists($newpath) || $sql->select("core_media","media_url = '".$tp->createConstants($newpath,'rel')."' LIMIT 1") )
{
$mes->addWarning($newpath." already exists and was renamed during import.");
$file = $f['pathinfo']['filename']."_.".$f['pathinfo']['extension'];

View File

@@ -25,88 +25,4 @@ e107::getMessage()->addWarning("This area is no longer in use and will be remove
$ns->tablerender("Received Messages", $mes->render());
/*
$messageTypes = array("Broken Download", "Dev Team Message");
$queryString = "";
foreach($messageTypes as $types) {
$queryString .= " gen_type='$types' OR";
}
$queryString = substr($queryString, 0, -3);
if(isset($_POST['delete_message']))
{
if(preg_match("/\s[0-9]+/si", $_POST['delete_message'], $match))
{
$id = $match[0];
$sql->db_Delete("generic", "gen_id=$id");
$message = MESSLAN_3;
}
}
if(isset($_POST['delete_all']) && isset($_POST['deleteconfirm']))
{
$sql->db_Delete("generic", $queryString);
$message = MESSLAN_6;
}
if (isset($message)) {
$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
}
if($amount = $sql -> db_Select("generic", "*", $queryString))
{
$text = "<table style='width: 98%;' class='fborder'>\n<form method='post' action='".e_SELF."'>\n";
$messages = $sql -> db_getList();
foreach($messages as $message)
{
extract($message);
$sql -> db_Select("user", "user_name", "user_id=$gen_user_id");
$user = $sql -> db_Fetch();
$user = "<a href='".e_BASE."user.php?id.$gen_user_id'>".$user['user_name']."</a>";
switch($gen_type)
{
case "Broken Download":
$link = "<a href='".e_BASE."download.php?view.$gen_intdata' rel='external' title='".MESSLAN_11."'>$gen_ip</a>";
$link .= " [<a href='".e_ADMIN."download.php?create.edit.".$gen_intdata."'>".LAN_EDIT."</a>]";
break;
case "Dev Team Message":
$link = "";
break;
}
$text .= "<tr>
<td style='width: 100%;' class='forumheader3'><b>".MESSLAN_8."</b>: $gen_type<br />
<b>".MESSLAN_9."</b>: ".$gen->convert_date($gen_datestamp, 'long')."<br />
<b>".MESSLAN_10."</b>: $user<br />
<b>".MESSLAN_13."</b>: $link ".
($gen_chardata ? "<br /><b>".MESSLAN_12."</b>: $gen_chardata" : "")."<br /><input class='btn btn-default btn-secondary button' type='submit' name='delete_message' value='".MESSLAN_2." $gen_id' />
</td>\n</tr>\n";
}
$text .= "
<tr>
<td><br /><input class='btn btn-default btn-secondary button' type='submit' name='delete_all' value='".MESSLAN_4."' />
<input type='checkbox' name='deleteconfirm' value='1' /> ".MESSLAN_5."
</td>
</tr>
</form></table>";
}
else
{
$text = MESSLAN_7;
}
$ns->tablerender(MESSLAN_1, $text);
*/
require_once("footer.php");

View File

@@ -76,20 +76,7 @@ $dont_check_update = false;
if (!$dont_check_update)
{
/*
if ($sql->db_Select('plugin', 'plugin_id, plugin_version, plugin_path', 'plugin_installflag=1'))
{
while ($row = $sql->db_Fetch())
{ // Mark plugins for update which have a specific update file, or a plugin.php file to check
if(is_readable(e_PLUGIN.$row['plugin_path'].'/'.$row['plugin_path'].'_update_check.php') || is_readable(e_PLUGIN.$row['plugin_path'].'/plugin.php') || is_readable(e_PLUGIN.$row['plugin_path'].'/'.$row['plugin_path'].'_setup.php'))
{
$dbupdateplugs[$row['plugin_path']] = $row['plugin_version'];
//TODO - Add support for {plugins}_setup.php upgrade check and routine.
}
}
}
*/
if($dbupdateplugs = e107::getConfig('core')->get('plug_installed'))
{
// Read in each update file - this will add an entry to the $dbupdatep array if a potential update exists
@@ -1898,9 +1885,9 @@ function core_media_import($cat,$epath)
'media_type' => $f['mime']
);
if(!$sql->db_Select('core_media','media_url',"media_url = '".$fullpath."' LIMIT 1"))
if(!$sql->select('core_media','media_url',"media_url = '".$fullpath."' LIMIT 1"))
{
if($sql->db_Insert("core_media",$insert))
if($sql->insert("core_media",$insert))
{
$mes->add("Importing Media: ".$f['fname'], E_MESSAGE_SUCCESS);
}

View File

@@ -602,12 +602,12 @@ if (isset($_POST['optionsubmit']))
$temp['upload_maxfilesize'] = $_POST['upload_maxfilesize'];
$temp['upload_class'] = $_POST['upload_class'];
$temp['upload_enabled'] = (FILE_UPLOADS ? $_POST['upload_enabled'] : 0);
if ($temp['upload_enabled'] && !$sql->db_Select("links", "*", "link_url='upload.php' "))
if ($temp['upload_enabled'] && !$sql->select("links", "*", "link_url='upload.php' "))
{
$sql->db_Insert("links", "0, '".LAN_UPLOAD."', 'upload.php', '', '', 1,0,0,0,0");
}
if (!$temp['upload_enabled'] && $sql->db_Select("links", "*", "link_url='upload.php' "))
if (!$temp['upload_enabled'] && $sql->select("links", "*", "link_url='upload.php' "))
{
$sql->db_Delete("links", "link_url='upload.php' ");
}
@@ -798,8 +798,8 @@ switch ($action)
break;
case 'view' :
$sql->db_Select('upload', '*', "upload_id='{$id}'");
$row = $sql->db_Fetch();
$sql->select('upload', '*', "upload_id='{$id}'");
$row = $sql->fetch();
extract($row);
@@ -913,7 +913,7 @@ switch ($action)
$text .= "<tr><td class='forumheader3' style='text-align:center' colspan='6'>";
if (!$active_uploads = $sql->db_Select("upload", "*", "upload_active=0 ORDER BY upload_id ASC"))
if (!$active_uploads = $sql->select("upload", "*", "upload_active=0 ORDER BY upload_id ASC"))
{
$text .= UPLLAN_19.".\n</td>\n</tr>";
}

View File

@@ -2236,10 +2236,10 @@ class users_admin_ui extends e_admin_ui
{
$usr_email = trim($result[0]);
}
if ($sql->db_Select('user','user_id, user_name, user_email',"user_email='".$usr_email."' "))
if ($sql->select('user','user_id, user_name, user_email',"user_email='".$usr_email."' "))
{
$row = $sql->fetch();
if ($sql->db_Update('user',"`user_email`='' WHERE `user_id` = '".$row['user_id']."' ") !== false)
if ($sql->update('user',"`user_email`='' WHERE `user_id` = '".$row['user_id']."' ") !== false)
{
// echo "Deleting user email {$row['user_email']} for user {$row['user_name']}, id={$row['user_id']}<br />";
$dodel = true;
@@ -2375,7 +2375,7 @@ class users_admin_ui extends e_admin_ui
// $bantype = 2;
// $ins = " AND user_join < ".strtotime("-30 days");
// }
// if ($sql->db_Select("user","user_id, user_name","user_ban= {$bantype}".$ins))
// if ($sql->select("user","user_id, user_name","user_ban= {$bantype}".$ins))
// {
// $uList = $sql->db_getList();
// foreach ($uList as $u)