Source for file admin.php
Documentation is available at admin.php
require_once 'createlu.php';
require_once 'liveuser_rights.php';
require_once 'HTML/Template/IT.php';
if (!$usr->isLoggedIn () || !$usr->checkRight (EDITNEWS)) {
echo 'Sorry but you cannot access this page';
echo 'You are trying to modify a news but do not have the right to do so !';
insertNews($db, $title, $newscontent, $usr->getProperty ('perm_user_id'));
updateNewsContent($db, $id, $title, $newscontent, $usr->getProperty ('perm_user_id'));
$tpl = new HTML_Template_IT ('./');
$tpl->loadTemplatefile ('admin.tpl');
// assign the content to the vars
$tpl->setVariable ('USER', $usr->getProperty ('handle'));
$tpl->setVariable ('NEWS', $news);
* @param object &$db a reference to a db connection object
* @param string $category news category
DATE_FORMAT(news_date, '%D %b %Y at %H:%I:%S') AS date,
news_category = ". $db->quote ($category, 'text');
$news = $db->queryAll ($query, null , MDB2_FETCHMODE_ASSOC , true );
if (PEAR ::isError ($news)) {
die ($news->getMessage () . ' ' . $news->getUserinfo ());
$tpl = new HTML_Template_IT ('./');
$tpl->loadTemplatefile ('news_list.tpl', false , false );
$tpl->setVariable ('CATEGORY', ucfirst($category));
foreach ($news as $id => $name) {
foreach ($name as $cell) {
// Assign data to the inner block
$tpl->setCurrentBlock ('cell');
$tpl->setVariable ("ID", $id);
$tpl->setVariable ("DATA", nl2br($cell));
$tpl->parseCurrentBlock ('cell');
// Assign data and the inner block to the
$tpl->setCurrentBlock ('row');
$tpl->parseCurrentBlock ('row');
* @param object &$db a reference to a db connection object
* @param string $content the new content
* @return string content as a string
DATE_FORMAT(news_date, '%D %b %Y at %H:%I:%S') AS date,
$news = $db->queryRow ( $query );
if (PEAR ::isError ($news)) {
die ($news->getMessage () . ' ' . $news->getUserinfo ());
$tpl = new HTML_Template_IT ('./');
$tpl->loadTemplatefile ('news_edit.tpl', false , false );
$tpl->setVariable ('ID', $news['id']);
$tpl->setVariable ('TITLE', $news['title']);
$tpl->setVariable ('DATE', $news['date']);
$tpl->setVariable ('CONTENT', $news['content']);
* @param object &$db a reference to a db connection object
* @param string $content the new content
news_content = ' . $db->quote ($content, 'text') . ',
news_title = ' . $db->quote ($title, 'text') . '
news_id = "' . $id . '"';
* Insert news in database
* @param object &$db a reference to a db connection object
* @param string $title news title
* @param string $content the new content
function insertNews(&$db, $title, $content, $user)
news_title, news_content)
("' . $db->nextId ('news') . '", "' . date('Y-m-d H:i:s') . '",
' . $db->quote ($title, 'text') . ', ' . $db->quote ($content, 'text') . ')';
Documentation generated on Mon, 11 Mar 2019 15:40:12 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|