diff --git a/delete-comic.php b/delete-comic.php index 0f1bff7..89493f9 100644 --- a/delete-comic.php +++ b/delete-comic.php @@ -9,7 +9,7 @@ check_nonce('delete-strip-'.(int)$_REQUEST['strip_id']); if(!deletestrip( $_REQUEST['strip_id'] )) { - adminlog("Error deleting strip $_REQUEST[strip_id]:".mysqli_error(), MTS_STRIP, MTA_DELETE, E_ERROR); + adminlog("Error deleting strip $_REQUEST[strip_id]:".$dbConnection->errorCode(), MTS_STRIP, MTA_DELETE, E_ERROR); mtdie('Error deleting the specified strip.','SQL Error'); } diff --git a/delete-page.php b/delete-page.php index d535cbf..b3fa09d 100644 --- a/delete-page.php +++ b/delete-page.php @@ -9,7 +9,7 @@ check_nonce('delete-page-'.$_REQUEST['page_name']); if(!deletepage( $_REQUEST['page_name'] )) { - adminlog("Error deleting page $_REQUEST[page_name]: ".mysqli_error(), MTS_PAGE, MTA_DELETE, E_ERROR); + adminlog("Error deleting page $_REQUEST[page_name]: ".$dbConnection->errorCode(), MTS_PAGE, MTA_DELETE, E_ERROR); mtdie('Error deleting the specified page.','SQL Error'); } diff --git a/delete-rant.php b/delete-rant.php index 122d598..e368f05 100644 --- a/delete-rant.php +++ b/delete-rant.php @@ -9,7 +9,7 @@ check_nonce('delete-rant-'.(int)$_REQUEST['rant_id']); if(!deleterant( $_REQUEST['rant_id'] )) { - adminlog("Error deleting rant $_REQUEST[rant_id]: ".mysqli_error(), MTS_RANT, MTA_DELETE, E_ERROR); + adminlog("Error deleting rant $_REQUEST[rant_id]: ".$dbConnection->errorCode(), MTS_RANT, MTA_DELETE, E_ERROR); mtdie('Error deleting the specified rant.','SQL Error'); } diff --git a/edit-comic.php b/edit-comic.php index 28d170b..c6c36f2 100644 --- a/edit-comic.php +++ b/edit-comic.php @@ -53,8 +53,8 @@ if( $_POST ) { // Insert new strip into the database, get a real $strip->id if(!insertstrip( $strip )) { - adminlog("Error on insertion of new strip: ".mysqli_error(), MTS_STRIP, MTA_ADD, E_ERROR); - mtdie('Error on insertion of new strip: '.mysqli_error(), 'SQL Error'); + adminlog("Error on insertion of new strip: ".$dbConnection->errorCode(), MTS_STRIP, MTA_ADD, E_ERROR); + mtdie('Error on insertion of new strip: '.$dbConnection->errorCode(), 'SQL Error'); } // Store the uploaded file to xxxx-0.ext @@ -99,7 +99,7 @@ if( $_POST ) { if(!updatestrip( $strip ) ) { adminlog("Failed to update strip ".$strip->id.".", MTS_STRIP, MTA_UPDATE); - mtdie('Error updating strip: ' . mysqli_error(), 'SQL Error'); + mtdie('Error updating strip: ' . $dbConnection->errorCode(), 'SQL Error'); } if( is_valid_upload('comicFile') ) { // If uploading, store the uploaded file to xxxx-n.ext diff --git a/edit-rant.php b/edit-rant.php index f262891..1608307 100644 --- a/edit-rant.php +++ b/edit-rant.php @@ -62,7 +62,7 @@ if( $_POST ) { $rant->id = insertrant($rant); if( $rant->id === false ) { - adminlog("Error on rant insertion: ".mysqli_error(), MTS_RANT, MTA_INSERT, E_ERROR); + adminlog("Error on rant insertion: ".$dbConnection->errorCode(), MTS_RANT, MTA_INSERT, E_ERROR); mtdie('There was an error inserting the rant into the database.', 'SQL Error'); } diff --git a/fredart_parse.php b/fredart_parse.php index c90c692..011aeee 100644 --- a/fredart_parse.php +++ b/fredart_parse.php @@ -24,12 +24,8 @@ for ($count = 0; $count < 5; $count++) { $entry = $feed->getEntryByOffset($count); - $link = mysqli_real_escape_string($mtdb->link, $entry->link); - $title = mysqli_real_escape_string($mtdb->link, $entry->title); - $date = $entry->pubdate; - $mtdb->query("INSERT INTO fredart (pubdate, title, link) - VALUES (FROM_UNIXTIME($date), '$title', '$link')", false); + $dbConnection->executeUpdate('INSERT INTO fredart (pubdate, title, link) VALUES (FROM_UNIXTIME(?), ?, ?)', array($entry->pubdate, $entry->title, $entry->link)); } header('Content-Type: text/xml'); diff --git a/include/admin.inc.php b/include/admin.inc.php index aa2b6a2..b14ad0d 100644 --- a/include/admin.inc.php +++ b/include/admin.inc.php @@ -6,7 +6,6 @@ require(__DIR__ . '/../vendor/autoload.php'); // Core lib require_once('html.php'); -require_once('mysql.php'); require_once('cookies.php'); require_once('functions.php'); require_once('error.php'); @@ -42,9 +41,6 @@ $dbParams = array( $dbConnection = \Doctrine\DBAL\DriverManager::getConnection($dbParams, $dbConfig); $dbConnection->setFetchMode(PDO::FETCH_OBJ); -$mtdb = new MysqlStore(); -$mtdb->connect( DB_SERVER, DB_WRITE_USER, DB_WRITE_PASS, DB_NAME ); - /* TODO: Move these definitions to LocalSettings.php */ if ( !defined('RANTIMG') ) define('RANTIMG', '../rantimgs/'); diff --git a/include/twitter.php b/include/twitter.php index 6404edf..8774d6c 100644 --- a/include/twitter.php +++ b/include/twitter.php @@ -53,7 +53,7 @@ function twitterpost($message, $user=TWITTER_USER, $password=TWITTER_PASS) function setOAuthTokens($userid,$oauth_token,$oauth_token_secret, $username) { - global $mtdb; + global $dbConnection; $id = (int)$userid; if ($dbConnection->executeUpdate('UPDATE twitter_user SET oauth_token = ?, oauth_token_secret = ?, username = ? WHERE id = ?', array($oauth_token, $oauth_token_secret, $username, $id))) return true; diff --git a/index.php b/index.php index dc40a9a..5b3e96c 100644 --- a/index.php +++ b/index.php @@ -46,7 +46,7 @@ adminmenu();