diff --git a/character-twitter.php b/character-twitter.php
index ed255a0..9aee60b 100644
--- a/character-twitter.php
+++ b/character-twitter.php
@@ -8,12 +8,12 @@ auth_redirect(); // Require logged in user to access this page.
if('post_twitter' == $_REQUEST['action'])
{
check_nonce('new-character-twitter');
-
+
#Fetch the password from the DB.
$acct = $mtdb->getRow(sprintf("SELECT username, password FROM twitter_user WHERE id = '%d'", $_REQUEST['twitter-account']));
-
+
$post_at = strtotime($_REQUEST['date18']);
-
+
if($post_at)
{
if($post_at <= strtotime('now'))
@@ -21,7 +21,7 @@ if('post_twitter' == $_REQUEST['action'])
#If we can post immediately, do so. Bypass the scheduler whenever possible.
#Treat a date/time in the past as immediate.
$ret = twitterpost($_REQUEST['message'], $acct->username, $acct->password);
-
+
if($ret)
{
$info.='Update posted to Twitter. View Twitter.';
@@ -37,9 +37,9 @@ if('post_twitter' == $_REQUEST['action'])
#No luck, gotta schedule.
$mtdb->query(
sprintf("INSERT INTO twitter_post (status, user, time, text)VALUES ('scheduled', '%d', FROM_UNIXTIME('%d'), '%s')",
- mysql_real_escape_string($_REQUEST['twitter-account']),
+ mysqli_real_escape_string($mtdb->link, $_REQUEST['twitter-account']),
$post_at,
- mysql_real_escape_string($_REQUEST['message'])
+ mysqli_real_escape_string($mtdb->link, $_REQUEST['message'])
)
);
$info .= "Your tweet for user " . htmlentities($acct->username) . " has been scheduled.";
@@ -119,4 +119,4 @@ At:
\ No newline at end of file
+?>
diff --git a/delete-comic.php b/delete-comic.php
index ad20caa..0f1bff7 100644
--- a/delete-comic.php
+++ b/delete-comic.php
@@ -9,11 +9,11 @@ check_nonce('delete-strip-'.(int)$_REQUEST['strip_id']);
if(!deletestrip( $_REQUEST['strip_id'] ))
{
- adminlog("Error deleting strip $_REQUEST[strip_id]:".mysql_error(), MTS_STRIP, MTA_DELETE, E_ERROR);
+ adminlog("Error deleting strip $_REQUEST[strip_id]:".mysqli_error(), MTS_STRIP, MTA_DELETE, E_ERROR);
mtdie('Error deleting the specified strip.','SQL Error');
}
adminlog("Strip $_REQUEST[strip_id] deleted.", MTS_STRIP, MTA_DELETE);
_redirect( ADMIN_PATH . '/manage-comics.php?deleted=success' );
-?>
\ No newline at end of file
+?>
diff --git a/delete-page.php b/delete-page.php
index 14bbf01..d535cbf 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]: ".mysql_error(), MTS_PAGE, MTA_DELETE, E_ERROR);
+ adminlog("Error deleting page $_REQUEST[page_name]: ".mysqli_error(), 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 9fdee71..122d598 100644
--- a/delete-rant.php
+++ b/delete-rant.php
@@ -9,9 +9,9 @@ check_nonce('delete-rant-'.(int)$_REQUEST['rant_id']);
if(!deleterant( $_REQUEST['rant_id'] ))
{
- adminlog("Error deleting rant $_REQUEST[rant_id]: ".mysql_error(), MTS_RANT, MTA_DELETE, E_ERROR);
+ adminlog("Error deleting rant $_REQUEST[rant_id]: ".mysqli_error(), MTS_RANT, MTA_DELETE, E_ERROR);
mtdie('Error deleting the specified rant.','SQL Error');
}
_redirect( ADMIN_PATH . '/manage-rants.php?deleted=success' );
-?>
\ No newline at end of file
+?>
diff --git a/edit-comic.php b/edit-comic.php
index 6d526fe..478b5ac 100644
--- a/edit-comic.php
+++ b/edit-comic.php
@@ -9,7 +9,7 @@ $strip->id = (int)$_REQUEST['strip_id'];
$strip = getstrip($strip->id);
if( $_POST ) {
-
+
// Form Elements
$strip->new_id = (int)$_POST['strip_new_id'] ? (int)$_POST['strip_new_id'] : $strip->id;
$strip->published = empty($_POST['strip_date']) ? time() : strtotime( $_POST['strip_date'] );
@@ -18,7 +18,7 @@ if( $_POST ) {
$strip->transcript_posted = $_POST['content'];
$strip->book = trim($_POST['book']);
$strip->page = trim($_POST['page']);
-
+
if( '' == $strip->title ) mtdie('Strips must be supplied with titles.');
$YESTERDAY = mktime(0,0,0, date('m'), date('d')-1, date('Y'));
@@ -37,26 +37,26 @@ if( $_POST ) {
adminlog("Image upload failed.", MTS_STRIP, MTA_ADD, E_WARNING);
mtdie('If you want to upload a new comic, you must provide said comic.','Strip upload failed.');
}
-
+
// get image type and target extension
$imagedata = getimagesize($_FILES['comicFile']['tmp_name']);
$strip->media = $imagedata[2];
$fileext = $mtdb->getOne( 'SELECT extension FROM media_t WHERE id = ' . (int)$strip->media );
-
+
if(strlen($fileext) < 3)
{
//bad image upload type
adminlog("Bad image type upload on new strip. Invalid media type.", MTS_STRIP, MTA_ADD, E_ERROR);
mtdie('Bad image type upload on new strip. Invalid media type.');
}
-
+
// Insert new strip into the database, get a real $strip->id
if(!insertstrip( $strip ))
{
- adminlog("Error on insertion of new strip: ".mysql_error(), MTS_STRIP, MTA_ADD, E_ERROR);
- mtdie('Error on insertion of new strip: '.mysql_error(), 'SQL Error');
+ 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');
}
-
+
// Store the uploaded file to xxxx-0.ext
$basefile = $strip->published <= time() ?
sprintf(SITE_PATH_ABS.'/'.SITE_STRIP.'/'.'%04d.%s', $strip->id, $fileext) :
@@ -73,11 +73,11 @@ if( $_POST ) {
$info.="
Comic posted!
";
break;
-
+
case 'edit_comic':
if( 0 >= $strip->new_id ) mtdie('Strip numbers must be numeric, greater than 0.');
if( 0 >= $strip->id ) mtdie('Existing strip number, in the form, was zero. This should never happen.');
-
+
// When updating, $strip->id is the old strip number. Update in place first. Possibly adjust strip number later.
check_nonce('save-strip-'.$strip->id);
@@ -87,26 +87,26 @@ if( $_POST ) {
$strip->media = $imagedata[2];
}
$fileext = $mtdb->getOne( 'SELECT extension FROM media_t WHERE id=' . (int)$strip->media );
-
+
if(strlen($fileext) < 3)
{
//bad image upload type
adminlog("Bad image type upload on strip ".$strip->id.". Invalid media type.", MTS_STRIP, MTA_UPDATE, E_ERROR);
mtdie('Bad image type upload on strip '.$strip->id.'. Invalid media type.');
}
-
+
// Update existing strip
if(!updatestrip( $strip ) )
{
adminlog("Failed to update strip ".$strip->id.".", MTS_STRIP, MTA_UPDATE);
- mtdie('Error updating strip: ' . mysql_error(), 'SQL Error');
+ mtdie('Error updating strip: ' . mysqli_error(), 'SQL Error');
}
-
+
if( is_valid_upload('comicFile') ) { // If uploading, store the uploaded file to xxxx-n.ext
$basefile = $strip->published <= time() ?
sprintf(SITE_PATH_ABS.'/'.SITE_STRIP.'/'.'%04d.%s', $strip->id, $fileext) :
sprintf(SITE_PATH_ABS.'/'.SITE_STRIP.'/restricted/'.'%04d.%s', $strip->id, $fileext);
-
+
if(!move_uploaded_file($_FILES['comicFile']['tmp_name'], $basefile))
{
adminlog("Filesystem error in saving image.", MTS_STRIP, MTA_UPDATE, E_ERROR);
@@ -120,7 +120,7 @@ if( $_POST ) {
if( $_POST['broadcast'] ) {
#Limit broadcast message to 60 characters. Compose it now.
$b_msg = 'Comic ' . $strip->id . ' updated: ' . substr(trim($_REQUEST['broadcast_message']), 0, 60) . ', ' . SITE_HOST . SITE_PATH . "/strip/" . $strip->id;
-
+
rsspost($b_msg, SITE_HOST.SITE_PATH.'/strip/'.$strip->id);
twitterpost($b_msg);
$info.="Update broadcasted with message '$b_msg'.
";
@@ -128,19 +128,19 @@ if( $_POST ) {
$info.="Changes saved. id."\">View on site.";
break;
-
+
default:
adminlog("User did something strange.", MTS_STRIP, MTA_MODIFY);
mtdie('You know, it would be really nice if you avoided nonsensical actions.');
}
-
+
$info = savetranscript($strip) . $info;
# If the strip number changed, swap strips sequentially to shuffle it into place
if( $strip->id != $strip->new_id ) {
$f = fopen(SITE_PATH_ABS.'/'.SITE_STRIP.'/'.SITE_STRIP_LOCK, 'w');
flock($f, LOCK_EX);
-
+
while( $strip->new_id < $strip->id ) { // Move this strip backward
swap_strips( $strip->id - 1, $strip->id );
$strip->id--;
@@ -255,4 +255,3 @@ if( file_exists( SITE_PATH_ABS.'/'.$file ) ){
-
diff --git a/edit-rant.php b/edit-rant.php
index ff7fff9..68289a7 100644
--- a/edit-rant.php
+++ b/edit-rant.php
@@ -26,10 +26,10 @@ if( $_POST ) {
}
$action = isset($_POST['publish']) ? 'post' : 'edit';
-
+
if( isset( $_POST['publish'] ) ) $rant->status = 'published'; // If [publish] button is used, ignore radio button
-
+
$source_rantimage_filename = $_FILES['ranterImage']['tmp_name'];
extract( pre_upload_rant_image( $source_rantimage_filename ) );
if( $upload_error ) $error.=$upload_error;
@@ -43,12 +43,12 @@ if( $_POST ) {
$source_rantattachment_filename[] = $_FILES['rant_attachment']['tmp_name'][$i];
}
}
-
+
switch( $_POST['action'] ) {
case 'new_rant':
-
+
check_nonce('new-rant');
-
+
if( ! $doing_upload ) {
// Use default rant image for this contributor.
$contributor = get_userdatabyid( $rant->author );
@@ -58,11 +58,11 @@ if( $_POST ) {
} else {
$rant->imagetype = $upload_imagetype;
}
-
+
$rant->id = insertrant($rant);
if( $rant->id === false )
{
- adminlog("Error on rant insertion: ".mysql_error(), MTS_RANT, MTA_INSERT, E_ERROR);
+ adminlog("Error on rant insertion: ".mysqli_error(), MTS_RANT, MTA_INSERT, E_ERROR);
mtdie('There was an error inserting the rant into the database.', 'SQL Error');
}
@@ -72,7 +72,7 @@ if( $_POST ) {
$upload_error = $upload_info = '';
extract( save_upload_rant_attachment($_FILES['rant_attachment']['tmp_name'][$i], $rant->id) );
- if( $upload_error ) $error.=$upload_error;
+ if( $upload_error ) $error.=$upload_error;
if( $upload_info ) {
$info .= $upload_info;
$rant->body = preg_replace('/(href|src)=\"([^\"]*?)\\{'.($i+1).'\\}(.*?)\"/', '\1="'.get_rantattachment_filename($rant_attachment_id).'"', $rant->body);
@@ -85,19 +85,19 @@ if( $_POST ) {
if( $doing_upload ) {
extract( save_upload_rant_image( $source_rantimage_filename, $rant ) );
if( $upload_info ) $info.=$upload_info;
- if( $upload_error ) $error.=$upload_error;
+ if( $upload_error ) $error.=$upload_error;
} elseif($rant->imagetype != 'NULL') {
extract( save_stock_rant_image( $source_rantimage_filename, $rant ) );
if( $upload_info ) $info.=$upload_info;
- if( $upload_error ) $error.=$upload_error;
+ if( $upload_error ) $error.=$upload_error;
}
-
+
break;
-
+
case 'saverant':
check_nonce('save-rant-' . $rant->id);
-
+
if( isset( $_POST['rant_reverttodefaultimage'] ) ) {
// Use default rant image for this contributor, copy it into place
$contributor = get_userdatabyid( $rant->author );
@@ -106,13 +106,13 @@ if( $_POST ) {
if($rant->imagetype != 'NULL')
extract( save_stock_rant_image( $contributor->default_image, $rant ) );
adminlog("Reverting to user's default rant image for rant ".$rant->id.".", MTS_RANT, MTA_UPDATE);
-
+
} elseif( $doing_upload ) {
$rant->imagetype = $upload_imagetype;
extract( save_upload_rant_image( $source_rantimage_filename, $rant ) );
adminlog("Uploading new rant image for rant ".$rant->id.".", MTS_RANT, MTA_UPDATE);
if( $upload_info ) $info.=$upload_info;
- if( $upload_error ) $error.=$upload_error;
+ if( $upload_error ) $error.=$upload_error;
}
foreach($_POST['delete_attachment'] as $attachment)
@@ -122,14 +122,14 @@ if( $_POST ) {
for($i = 0; $i < count($existing_attachments); $i++) {
$rant->body = preg_replace('/(href|src)=\"([^\"]*?)\\{'.($i+1).'\\}(.*?)\"/', '\1="'.get_rantattachment_filename($existing_attachments[$i]->id).'"', $rant->body);
}
-
+
for($j = $i; $j < count($source_rantattachment_filename) + $i; $j++) {
if('' == $source_rantattachment_filename[$j - $i]) continue;
-
+
$upload_error = $upload_info = '';
extract( save_upload_rant_attachment($_FILES['rant_attachment']['tmp_name'][$j - $i], $rant->id) );
- if( $upload_error ) $error.=$upload_error;
+ if( $upload_error ) $error.=$upload_error;
if( $upload_info ) {
$info .= $upload_info;
$rant->body = preg_replace('/(href|src)=\"([^\"]*?)\\{'.($i+1).'\\}(.*?)\"/', '\1="'.get_rantattachment_filename($rant_attachment_id).'"', $rant->body);
@@ -137,7 +137,7 @@ if( $_POST ) {
}
updaterant($rant);
-
+
if($rant->status != 'draft' && $_POST['broadcast'] &&
($rant->published <= mktime(0,0,0, date('m'), date('d')-1, date('Y'))))
{
@@ -216,7 +216,7 @@ tinyMCE.init({