From c1cc0a746d2455732468830ab06259f91f0c2a52 2017-06-20 23:31:39 From: DarkMorford Date: 2017-06-20 23:31:39 Subject: [PATCH] Merge branch 'master' into tinymce --- diff --git a/CalendarPopup.js b/CalendarPopup.js index acb306e..0b7a890 100644 --- a/CalendarPopup.js +++ b/CalendarPopup.js @@ -11,7 +11,7 @@ // use. That means, you can include it in your product, or your web // site, or any other form where the code is actually being used. You // may not put the plain javascript up on your site for download or -// include it in your javascript libraries for download. +// include it in your javascript libraries for download. // If you wish to share this code with others, please just point them // to the URL instead. // Please DO NOT link directly to my .js files from your site. Copy @@ -21,7 +21,7 @@ /* SOURCE FILE: AnchorPosition.js */ -/* +/* AnchorPosition.js Author: Matt Kruse Last modified: 10/11/02 @@ -30,7 +30,7 @@ DESCRIPTION: These functions find the position of an tag in a document, so other elements can be positioned relative to it. COMPATABILITY: Netscape 4.x,6.x,Mozilla, IE 5.x,6.x on Windows. Some small -positioning errors - usually with Window positioning - occur on the +positioning errors - usually with Window positioning - occur on the Macintosh platform. FUNCTIONS: @@ -44,16 +44,16 @@ getAnchorWindowPosition(anchorname) NOTES: -1) For popping up separate browser windows, use getAnchorWindowPosition. +1) For popping up separate browser windows, use getAnchorWindowPosition. Otherwise, use getAnchorPosition -2) Your anchor tag MUST contain both NAME and ID attributes which are the +2) Your anchor tag MUST contain both NAME and ID attributes which are the same. For example: -3) There must be at least a space between for IE5.5 to see the +3) There must be at least a space between for IE5.5 to see the anchor tag correctly. Do not do with no space. -*/ +*/ // getAnchorPosition(anchorname) // This function returns an object having .x and .y properties which are the coordinates @@ -139,7 +139,7 @@ function AnchorPosition_getPageOffsetLeft (el) { } function AnchorPosition_getWindowOffsetLeft (el) { return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft; - } + } function AnchorPosition_getPageOffsetTop (el) { var ot=el.offsetTop; while((el=el.offsetParent) != null) { ot += el.offsetTop; } @@ -156,14 +156,14 @@ function AnchorPosition_getWindowOffsetTop (el) { // May 17, 2003: Fixed bug in parseDate() for dates <1970 // March 11, 2003: Added parseDate() function // March 11, 2003: Added "NNN" formatting option. Doesn't match up -// perfectly with SimpleDateFormat formats, but +// perfectly with SimpleDateFormat formats, but // backwards-compatability was required. // ------------------------------------------------------------------ -// These functions use the same 'format' strings as the +// These functions use the same 'format' strings as the // java.text.SimpleDateFormat class, with minor exceptions. // The format string consists of the following abbreviations: -// +// // Field | Full Form | Short Form // -------------+--------------------+----------------------- // Year | yyyy (4 digits) | yy (2 digits), y (2 or 4 digits) @@ -286,7 +286,7 @@ function formatDate(date,format) { } return result; } - + // ------------------------------------------------------------------ // Utility functions for parsing in getDateFromFormat() // ------------------------------------------------------------------ @@ -305,12 +305,12 @@ function _getInt(str,i,minlength,maxlength) { } return null; } - + // ------------------------------------------------------------------ // getDateFromFormat( date_string , format_string ) // // This function takes a date string and a format string. It matches -// If the date string matches the format string, it returns the +// If the date string matches the format string, it returns the // getTime() of the date. If it does not match, it returns 0. // ------------------------------------------------------------------ function getDateFromFormat(val,format) { @@ -330,7 +330,7 @@ function getDateFromFormat(val,format) { var mm=now.getMinutes(); var ss=now.getSeconds(); var ampm=""; - + while (i_format < format.length) { // Get next token from format string c=format.charAt(i_format); @@ -469,7 +469,7 @@ function parseDate(val) { /* SOURCE FILE: PopupWindow.js */ -/* +/* PopupWindow.js Author: Matt Kruse Last modified: 02/16/04 @@ -479,20 +479,20 @@ in a certain place. The window can either be a DIV or a separate browser window. COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small -positioning errors - usually with Window positioning - occur on the -Macintosh platform. Due to bugs in Netscape 4.x, populating the popup +positioning errors - usually with Window positioning - occur on the +Macintosh platform. Due to bugs in Netscape 4.x, populating the popup window with
- + Create(); */ ?> - - - + + + @@ -163,7 +163,7 @@ tinyMCE.init({

- +

diff --git a/post-scratchpad.php b/post-scratchpad.php index e340b89..051ba49 100644 --- a/post-scratchpad.php +++ b/post-scratchpad.php @@ -6,7 +6,7 @@ auth_redirect(); // Require logged in user to access this page. check_nonce('new-scratchpad'); -$mtdb->query( sprintf( 'INSERT INTO scratchpad (contributor, message) VALUES (%d, "%s")', (int)$currentuser->id, mysql_real_escape_string($_REQUEST['message'])) ); +$mtdb->query( sprintf( 'INSERT INTO scratchpad (contributor, message) VALUES (%d, "%s")', (int)$currentuser->id, mysqli_real_escape_string($mtdb->link, $_REQUEST['message'])) ); adminlog("User posted to scratchpad.", MTS_SCRATCH, MTA_INSERT); _redirect( ADMIN_PATH . '/index.php' ); diff --git a/post-twitter.php b/post-twitter.php index 8fd01fe..6393c58 100644 --- a/post-twitter.php +++ b/post-twitter.php @@ -8,7 +8,7 @@ auth_redirect(); // Require logged in user to access this page. if('post_twitter' == $_REQUEST['action']) { check_nonce('new-twitter'); - + $postmessage = ''; if(!empty($_REQUEST['stdmessage']) ) $postmessage = trim($_REQUEST['stdmessage']); if( strlen($_REQUEST['message']) ) $postmessage = trim($_REQUEST['message']); @@ -20,13 +20,13 @@ if('post_twitter' == $_REQUEST['action']) if('' == $postmessage) _redirect( ADMIN_PATH . '/post-twitter.php?tweet=missing'); $username = sanitize_username($_REQUEST['twitter_user']); - $postasuser = $mtdb->getOne( sprintf('SELECT username FROM twitter_user WHERE username="%s"', mysql_real_escape_string($username))); + $postasuser = $mtdb->getOne( sprintf('SELECT username FROM twitter_user WHERE username="%s"', mysqli_real_escape_string($mtdb->link, $username))); if( in_array('twitter', $_REQUEST['service']) ) $rc = twitterpost( numeric_entities(utfentities($postmessage)), $postasuser ); if( in_array('rss', $_REQUEST['service']) ) $rc = rsspost( numeric_entities(utfentities($postmessage)), SITE_HOST.SITE_PATH ); - + if($rc) _redirect( ADMIN_PATH . '/post-twitter.php?tweet=success'); _redirect( ADMIN_PATH . '/post-twitter.php?tweet=fail'); @@ -41,7 +41,7 @@ if( isset($_REQUEST['tweet']) && 'fail' == $_REQUEST['tweet'] ) if( isset($_REQUEST['tweet']) && 'missing' == $_REQUEST['tweet'] ) $error.='Oops~ Looks like you forgot to enter a message.'; - + $statuses = $mtdb->getAll('SELECT id, position, message FROM twitter_status ORDER BY position, id'); $twitter_users = $mtdb->getAll('SELECT id, username, oauth_token, oauth_token_secret, oauth_access_token FROM twitter_user ORDER BY username'); @@ -98,7 +98,7 @@ adminmenu(); var charactersremaining = document.getElementById('charactersremaining'); charactersremaining.innerHTML = 140 - status.value.length } ---> +--> diff --git a/swap-comics.php b/swap-comics.php index 06e0496..64c698d 100644 --- a/swap-comics.php +++ b/swap-comics.php @@ -7,7 +7,7 @@ auth_redirect(); // Require logged in user to access this page. if($_POST) { check_nonce('swap-strip'); - + if(!is_numeric($_POST['comic_a']) || !is_numeric($_POST['comic_b'])) mtdie('This tool only works on numeric strip numbers.'); @@ -16,11 +16,11 @@ if($_POST) $f = fopen(SITE_PATH_ABS.'/'.SITE_STRIP.'/'.SITE_STRIP_LOCK, 'w'); flock($f, LOCK_EX); - + swap_strips( $a, $b ); - + close($f); - + $info.='

Strips $a and $b swapped successfully.

'; adminlog("Strips $a and $b have been swapped.", MTS_STRIP, MTA_MODIFY); } @@ -48,7 +48,7 @@ adminmenu('swap-comics.php'); - +

diff --git a/twitter-scheduled.php b/twitter-scheduled.php index 5faa8c2..e57d984 100644 --- a/twitter-scheduled.php +++ b/twitter-scheduled.php @@ -37,7 +37,9 @@ foreach($tweets as $t) adminlog("Error $ret_code posting scheduled tweet ".$t->id . ' with return value ' . $ret, MTS_TWITTER, MTA_ADD); $t->status = 'error'; } - + // Unlock tweet, update db. - $mtdb->query("UPDATE twitter_post SET status = '".mysql_real_escape_string($t->status)."' WHERE status = 'locked' AND id = ".(int)$t->id, false); + $mtdb->query("UPDATE twitter_post SET status = '".mysqli_real_escape_string($mtdb->link, $t->status)."' WHERE status = 'locked' AND id = ".(int)$t->id, false); } + +?> diff --git a/user-edit.php b/user-edit.php index 6f87eb4..d2c15b4 100644 --- a/user-edit.php +++ b/user-edit.php @@ -12,10 +12,10 @@ if( isset($_POST['edit']) ) { $username = sanitize_username( $_POST['user_login'] ); if( $username != $_POST['user_login'] || strlen($_POST['user_login']) < 1 ) mtdie( 'The specified username is not valid. Must be composed of a-z _ - @ .', 'Invalid Username' ); - + copy(RANTIMG.'default', RANTIMG.$username.'.png'); - - $mtdb->query( 'INSERT INTO contributor (name, default_image) VALUES ("' . mysql_real_escape_string($username) . '", "'.$username.'.png")' ); + + $mtdb->query( 'INSERT INTO contributor (name, default_image) VALUES ("' . mysqli_real_escape_string($mtdb->link, $username) . '", "'.$username.'.png")' ); $user = get_userdatabylogin( $username ); $userid = $user->id; $info.='

User Account Created

'; @@ -25,19 +25,19 @@ if( isset($_POST['edit']) ) { $userid = (int) $_POST['edit']; $user_old = $user = get_userdatabyid( $userid ); } - + $user->nameplate = $_POST['nickname']; $user->default_image = $user_old->default_image; $user->default_link = $_POST['rant-link']; $user->email = $_POST['email']; - + if( !empty($_POST['password_new1']) && !empty($_POST['password_new2']) ) { - + if( $_POST['password_new1'] !== $_POST['password_new2'] ) { $error.='

New passwords do not match.

'; } else { /* password change */ - if( ! $mtdb->getOne( 'SELECT id FROM contributor WHERE id = "' . (int)$user->id . '" AND (password = SHA1("' . mysql_real_escape_string($_POST['password_old']) . '") OR password = "")' )) { + if( ! $mtdb->getOne( 'SELECT id FROM contributor WHERE id = "' . (int)$user->id . '" AND (password = SHA1("' . mysqli_real_escape_string($mtdb->link, $_POST['password_old']) . '") OR password = "")' )) { $error.='

Specified password is incorrect.

'; } else { /* Password match */ @@ -50,13 +50,13 @@ if( isset($_POST['edit']) ) { function handle_upload( &$user ) { global $info,$error; - + if( !$_FILES['rant_image'] ) return; - + if( '' == $_FILES['rant_image']['name'] ) return; if( UPLOAD_ERR_NO_FILE == $_FILES['rant_image']['error'] ) return; if( 0 == $_FILES['rant_image']['size'] ) return; - + $info.='

Tried to upload an image.

'; // Uploading new rant image $imagedata = getimagesize($_FILES['rant_image']['tmp_name']); @@ -68,7 +68,7 @@ if( isset($_POST['edit']) ) { $error.='

Image wrong height: '.$imagedata[1].'

'; return; } - + switch( $_FILES['rant_image']['type'] ) { case 'image/jpeg': case 'image/jpg': $ext = 'jpg'; break; @@ -80,7 +80,7 @@ if( isset($_POST['edit']) ) { $error.='

Unknown image extension. Upload refused.

'; return; } - + $destination_path = $user->name.'.'.$ext; if( !is_uploaded_file( $_FILES['rant_image']['tmp_name'] )) { $error.='

Something went wrong while retrieving the uploaded image.

'; @@ -103,8 +103,8 @@ if( isset($_POST['edit']) ) { } else { $userid = (int) $_GET['edit']; $user = get_userdatabyid( $userid ); -} - +} + if( !$user ) $error.='

The specified user does not exist.

'; adminhead('Edit User Profile'); diff --git a/users.php b/users.php index e9f2a32..26c5d62 100644 --- a/users.php +++ b/users.php @@ -54,13 +54,13 @@ $users = $mtdb->getAll("SELECT id,name,email,nameplate FROM contributor");

Create New Contributor

- +
Username
- +