Squash some bugs.
Squash some bugs.

File last commit:

089a8bc9edcb
b9ac5124675f
Show More
pages.php
84 lines | 2.0 KiB | text/x-php | PhpLexer
Add most necessary files for admin interface.
r1 <?php
Update pages and rants to use DBAL.
r27 class Page
{
public $url_name;
public $status;
public $title;
public $body;
public $style;
Add most necessary files for admin interface.
r1 }
Update pages and rants to use DBAL.
r27 function savepage($page)
{
if ($page->url_name)
Add most necessary files for admin interface.
r1 return updatepage($page);
else
return insertpage($page);
}
Update pages and rants to use DBAL.
r27 function insertpage($page)
{
if ( !$page->url_name ) return false;
global $dbConnection;
$sql = 'INSERT INTO static_page (url_name, status, title, body, style) VALUES (:slug, :status, :title, :body, :style)';
$stmt = $dbConnection->prepare($sql);
$stmt->bindValue('slug', $page->url_name);
$stmt->bindValue('status', $page->status);
$stmt->bindValue('title', trim($page->title));
$stmt->bindValue('body', trim($page->body));
$stmt->bindValue('style', trim($page->style));
adminlog("Page '" . $page->url_name . "' has been added.", MTS_PAGE, MTA_ADD);
return $stmt->execute();
Update include/*.php to use mysqli_* functions.
r4 }
Add most necessary files for admin interface.
r1
Update pages and rants to use DBAL.
r27 function updatepage($page)
{
Add most necessary files for admin interface.
r1 if ( !$page->url_name ) return false;
Update pages and rants to use DBAL.
r27 global $dbConnection;
$sql = 'UPDATE static_page SET url_name = :slug, status = :status, title = :title, body = :body, style = :style WHERE url_name = :slug';
$stmt = $dbConnection->prepare($sql);
$stmt->bindValue('slug', $page->url_name);
$stmt->bindValue('status', $page->status);
$stmt->bindValue('title', trim($page->title));
$stmt->bindValue('body', trim($page->body));
$stmt->bindValue('style', trim($page->style));
adminlog("Page '" . $page->url_name . "' has been updated.", MTS_PAGE, MTA_MODIFY);
return $stmt->execute();
Add most necessary files for admin interface.
r1 }
Update pages and rants to use DBAL.
r27 function deletepage($url_name)
{
Add most necessary files for admin interface.
r1 if ( !$url_name ) return false;
Update pages and rants to use DBAL.
r27 global $dbConnection;
$sql = 'DELETE FROM static_page WHERE url_name = :slug';
$stmt = $dbConnection->prepare($sql);
$stmt->bindValue('slug', $url_name);
adminlog("Page '" . $page->url_name . "' has been deleted.", MTS_PAGE, MTA_DELETE);
return $stmt->execute();
Add most necessary files for admin interface.
r1 }
Update pages and rants to use DBAL.
r27 function getpage($url_name)
{
if ( !$url_name ) return false;
global $dbConnection;
$sql = 'SELECT url_name, status, title, body, style FROM static_page WHERE url_name = :slug';
$stmt = $dbConnection->prepare($sql);
$stmt->bindValue('slug', $url_name);
$stmt->execute();
return $stmt->fetch();
Add most necessary files for admin interface.
r1 }
?>