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
strip.php
130 lines | 4.2 KiB | text/x-php | PhpLexer
Add most necessary files for admin interface.
r1 <?php
// Book: The offset from 0 at the beginning of time
// Page: The offset from 0 at the beginning of the volume
class Strip {
var $id, $old_id, $published, $media, $type, $title, $book, $page;
}
// old_id is used to detect alterations to the strip id in forms. Not saved in database.
// media is imagetype
// Strip id is automatically incremented
function insertstrip(&$strip) {
global $mtdb;
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 $strip->book = ($strip->book == '') ? 'NULL' : (int)$strip->book;
Update include/*.php to use mysqli_* functions.
r4 $strip->page = ($strip->page == '') ? 'NULL' : (int)$strip->page;
Add most necessary files for admin interface.
r1 $mtdb->query('START TRANSACTION');
$newid = $mtdb->getOne('SELECT MAX(id) FROM strip') + 1;
$sql = 'INSERT INTO strip ( id, published, media, type, title, book, page ) VALUES ('
. $newid
. ', FROM_UNIXTIME(' . (int)$strip->published
. '), '. (int)$strip->media
. ', ' . (int)$strip->type
Update include/*.php to use mysqli_* functions.
r4 . ', "' . mysqli_real_escape_string( $mtdb->link, trim($strip->title) )
Add most necessary files for admin interface.
r1 . '", '. $strip->book
. ', ' . $strip->page
. ')';
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 $r = $mtdb->query( $sql );
if( !$r ) {
$mtdb->query('ROLLBACK');
return false;
}
$mtdb->query('COMMIT');
adminlog("Comic ".$newid." posted.", MTS_STRIP, MTA_ADD);
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 $strip->id = $newid;
if( $strip->id == 0 ) return false;
return true;
Update include/*.php to use mysqli_* functions.
r4 }
Add most necessary files for admin interface.
r1
function updatestrip(&$strip) {
global $mtdb;
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 $strip->book = ($strip->book === '') ? 'NULL' : (int)$strip->book;
$strip->page = ($strip->page === '') ? 'NULL' : (int)$strip->page;
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 $mtdb->query('START TRANSACTION');
$sql = 'UPDATE strip SET
published = FROM_UNIXTIME(' . (int)$strip->published .')
, media = '. (int)$strip->media .'
, type = ' . (int)$strip->type .'
Update include/*.php to use mysqli_* functions.
r4 , title = "' . mysqli_real_escape_string( $mtdb->link, trim($strip->title) ) .'"
Add most necessary files for admin interface.
r1 , book = ' . (int)$strip->book .'
, page = ' . (int)$strip->page .'
WHERE id = ' . (int)$strip->id;
$mtdb->query( $sql );
$mtdb->query('COMMIT');
adminlog("Comic ".$strip->id." modified.", MTS_STRIP, MTA_MODIFY);
return true;
Update include/*.php to use mysqli_* functions.
r4 }
Add most necessary files for admin interface.
r1
// Delete destination strip from DB and FS, and Update/Rename the source strip into place. Destructive Move!
function move_strip($from_id, $to_id)
{
global $mtdb;
$from_id = (int) $from_id;
$to_id = (int) $to_id;
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 // Ensure our source exists
$num_strips = $mtdb->getOne( "SELECT COUNT(*) FROM strip WHERE id = $from_id" );
if($num_strips < 1)
mtdie("Cannot move strip number $from_id, because it cannot be found in database.");
// Ready the destination
deletestrip( $to_id );
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 // Update database
$mtdb->query( "UPDATE strip SET id = $to_id WHERE id = $from_id" );
$strip = $mtdb->getRow( "SELECT strip.id, extension FROM strip, media_t WHERE media_t.id = strip.media AND strip.id = $to_id" );
// Update filesystem
foreach(glob(sprintf(SITE_PATH_ABS.'/'.SITE_STRIP.'/%04d.*', $from_id)) as $item) {
preg_match('/\.(\w{3})$/', $item, $match) or die("Invalid filename: $item");
rename($item, sprintf(SITE_PATH_ABS.'/'.SITE_STRIP.'/%04d.%s', $to_id, $match[1]));
}
}
// Classic swap function, using strip 0 as temporary storage. Can cause concurrency issues. FLOCK!
function swap_strips( $from_id, $to_id ) {
move_strip($from_id, 0);
move_strip($to_id, $from_id);
move_strip(0, $from_id );
adminlog("Comics ".$from_id." and ".$to_id." swapped.", MTS_STRIP, MTA_MODIFY);
}
function deletestrip($id) {
$id = (int)$id;
if ( !$id ) return false;
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 global $mtdb;
$r = $mtdb->query( 'DELETE FROM strip WHERE id=' . $id );
foreach(glob(sprintf(SITE_PATH_ABS.'/'.SITE_STRIP.'/%04d*.*', $id)) as $item)
unlink($item);
foreach(glob(sprintf(SITE_PATH_ABS.'/'.SITE_STRIP.'/restricted/%04d*.*', $id)) as $item)
unlink($item);
adminlog("Comic ".$id." deleted.", MTS_STRIP, MTA_DELETE);
return $r;
}
function getstrip($id) {
global $mtdb;
return $mtdb->getRow( 'SELECT id, UNIX_TIMESTAMP(published) as published, type, media, title, book, page FROM strip WHERE id=' . (int)$id);
}
function get_stripimage_filename( $strip ) {
global $mtdb;
$ext = $mtdb->getOne( 'SELECT extension FROM media_t WHERE id=' . (int)$strip->media ); // filename extension
return sprintf( '%s/%04d.%s', SITE_STRIP, $strip->id, $ext );
}
function get_stripid_by_rantid($rantid) {
global $mtdb;
return $mtdb->getOne('SELECT MAX(strip.id) FROM strip,rant WHERE strip.published<=rant.published AND rant.id=' . (int)$rantid);
}
?>