Configure the new TinyMCE to have almost the same buttons as the old one.
Configure the new TinyMCE to have almost the same buttons as the old one.

File last commit:

2f20c7105050
3cf3f8fd35f8
Show More
rants.php
119 lines | 4.1 KiB | text/x-php | PhpLexer
Add most necessary files for admin interface.
r1 <?php
class Rant {
var $id, $published, $status, $side, $author, $title, $body, $link, $imagetype, $imagetext;
}
function saverant($rant) {
if($rant->id)
return updaterant($rant);
else
return insertrant($rant);
}
function insertrant($rant) {
global $mtdb;
$sql = 'INSERT INTO rant ( published, status, side, author, title, body, link, imagetype, imagetext ) VALUES ( FROM_UNIXTIME('
. (int)$rant->published
Update include/*.php to use mysqli_* functions.
r4 . '), "' . mysqli_real_escape_string($mtdb->link, $rant->status)
. '", "' . mysqli_real_escape_string($mtdb->link, $rant->side)
Add most necessary files for admin interface.
r1 . '", "' . (int)$rant->author
Update include/*.php to use mysqli_* functions.
r4 . '", "' . mysqli_real_escape_string( $mtdb->link, trim( $rant->title) )
. '", "' . mysqli_real_escape_string( $mtdb->link, trim( $rant->body ) )
. '", "' . mysqli_real_escape_string( $mtdb->link, trim( $rant->link ) )
. '", ' . mysqli_real_escape_string($mtdb->link, $rant->imagetype)
. ', "' . mysqli_real_escape_string( $mtdb->link, trim( $rant->imagetext ) )
Add most necessary files for admin interface.
r1 . '")';
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 if( $mtdb->query( $sql ) ) {
//logthis( 'Saved changes to rant ' . $rant->id );
Update include/*.php to use mysqli_* functions.
r4 $rant->id = mysqli_insert_id( $mtdb->link );
Add most necessary files for admin interface.
r1 adminlog("Rant ".$rant->id." saved.", MTS_RANT, MTA_ADD);
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 if($rant->status == "published")
{
$poster = get_userdatabyid($rant->author);
adminlog("Rant ".$rant->id." published.", MTS_RANT, MTA_ADD);
twitterpost("New rant posted by ".$poster->name.": ".SITE_HOST.SITE_PATH."/rant/".$rant->id);
if($rant->author === 1) {
tumblrpost($rant->title, $rant->body);
}
}
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 return $rant->id;
}
return false;
Update include/*.php to use mysqli_* functions.
r4 }
Add most necessary files for admin interface.
r1
function updaterant($rant) {
if ( !(int)$rant->id ) return false;
global $mtdb;
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 #first, check if it's published already
$qr = $mtdb->query("SELECT status FROM rant WHERE id = ".$rant->id);
Update include/*.php to use mysqli_* functions.
r4 $row = mysqli_fetch_row($qr);
Add most necessary files for admin interface.
r1 $status = $row[0];
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 adminlog("Rant ".$rant->id." updated.", MTS_RANT, MTA_UPDATE);
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 $sql = 'UPDATE rant SET published=FROM_UNIXTIME(' . (int)$rant->published
Update include/*.php to use mysqli_* functions.
r4 . '), status = "' . mysqli_real_escape_string($mtdb->link, $rant->status)
. '", side = "' . mysqli_real_escape_string($mtdb->link, $rant->side)
Add most necessary files for admin interface.
r1 . '", author = ' . (int)$rant->author
Update include/*.php to use mysqli_* functions.
r4 . ', title = "' . mysqli_real_escape_string( $mtdb->link, trim($rant->title) )
. '", body = "' . mysqli_real_escape_string( $mtdb->link, trim($rant->body ) )
. '", link = "' . mysqli_real_escape_string( $mtdb->link, trim($rant->link ) )
Add most necessary files for admin interface.
r1 . '", imagetype = ' . (int)$rant->imagetype
Update include/*.php to use mysqli_* functions.
r4 . ', imagetext = "' . mysqli_real_escape_string( $mtdb->link, trim($rant->imagetext) )
Add most necessary files for admin interface.
r1 . '" WHERE id=' . (int)$rant->id;
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 if($status == "draft" && $rant->status == "published")
{
$poster = get_userdatabyid($rant->author);
adminlog("Rant ".$rant->id." published.", MTS_RANT, MTA_UPDATE);
twitterpost("New rant posted by ".$poster->name.": ".SITE_HOST.SITE_PATH."/rant/".$rant->id);
if($rant->author === 1) {
tumblrpost($rant->title, $rant->body);
}
}
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 return $mtdb->query( $sql );
}
function deleterant($rantid) {
if ( !(int)$rantid ) return false;
global $mtdb;
adminlog("Rant ".$rantid." deleted.", MTS_RANT, MTA_DELETE);
return $mtdb->query( 'DELETE FROM rant WHERE id=' . $rantid );
}
function deleteattachment($id)
{
global $mtdb;
$file = SITE_PATH_ABS.'/'.get_rantattachment_filename($id);
unlink( $file ) or adminlog("Could not delete $file", MTS_RANT, MTA_DELETE, E_USER_WARNING);
$mtdb->query( 'DELETE FROM rant_attachment WHERE id = ' . $id );
adminlog("Deleted attachment $id", MTS_RANT, MTA_DELETE);
}
function getrant($id) {
global $mtdb;
return $mtdb->getRow( 'SELECT id, UNIX_TIMESTAMP(published) as published, status, side, author, title, body, link, imagetype, imagetext FROM rant WHERE id = '. (int)$id );
}
function get_rantimage_filename( $rant ) {
global $mtdb;
$ext = $mtdb->getOne( 'SELECT extension FROM media_t WHERE id=' . (int)$rant->imagetype ); // filename extension
return sprintf( '%s/%04d.%s',SITE_RANT, (int)$rant->id, $ext );
}
function get_rantattachment_filename( $id ) {
global $mtdb;
$ext = $mtdb->getOne( 'SELECT extension FROM media_t JOIN rant_attachment ra ON ra.media = media_t.id WHERE ra.id=' . (int)$id ); // filename extension
return sprintf( '%s/%d.%s',SITE_RANT_ATTACHMENT, (int)$id, $ext );
}
?>