Source for file news_new.php
Documentation is available at news_new.php
// $Id: news_new.php,v 1.10 2004/06/19 18:04:47 arnaud Exp $
// If the user hasn't the right to write news -> access denied.
$tpl->loadTemplatefile ('news_notallowed.tpl.php');
include_once 'finish.inc.php';
$tpl->loadTemplatefile ('news_new.tpl.php');
$news = isset ($_POST['news']) ? $_POST['news'] : '';
$valid_to = isset ($_POST['valid_to']) ? (int) $_POST['valid_to'] : '';
$group = isset ($_POST['group_id']) ? (int) $_POST['group_id'] : '';
// If $news is not empty, we have something to work.
if (!ereg('^[1-9][0-9]?$', $valid_to)) {
$tpl->setVariable ('script_msg', '<p style="color: red;">Only numbers between 1 and 99 are allowed here.</p>');
} elseif (!$LU->checkRightLevel (RIGHT_NEWS_NEW, $LU->getProperty ('permUserId'), $group)) {
$tpl->setVariable ('script_msg', '<p style="color: red;">You don\'t have the right to post news for this group.</p>');
// Form seems to be correct. Write data into the db.
' . $db->quoteSmart ( date('Y.m.d H:i:s', time()+60*60*24*7* $valid_to) ) . ',
' . $db->quoteSmart ( $LU->getProperty ('permUserId') ) . ',
$tpl->setVariable ('script_msg', '<p><b>News has been added.</b></p>');
$tpl->setVariable ('form_action', 'news_new.php');
$tpl->setVariable ('message', $news);
$tpl->setVariable ('valid', $valid_to);
$tpl->setVariable ('valid', '2');
// If the user is member in more than one group, show them.
if (count($LU->getProperty ('groupIds')) > 1 ) {
$res = $db->query ('SELECT
description AS group_comment
AND section_id IN (' . implode(', ', $LU->getProperty ('groupIds')) . ')
while ($row = $res->fetchRow ()) {
$tpl->setCurrentBlock ('choose_group');
$tpl->setVariable (array ('value' => $row['group_id'],
'label' => $row['group_comment']));
if ($group == $row['group_id']) {
$tpl->setVariable ('selected', 'selected');
$tpl->parseCurrentBlock ();
$tpl->setCurrentBlock ('set_group');
$tpl->setVariable ('group_id', current($LU->getProperty ('groupIds')));
$tpl->parseCurrentBlock ();
include_once 'finish.inc.php';
Documentation generated on Mon, 11 Mar 2019 13:56:20 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|