Source for file news_new.php
Documentation is available at news_new.php
// $Id: news_new.php 302732 2010-08-24 01:05:43Z clockwerx $
// If the user hasn't the right to write news -> access denied.
$tpl->loadTemplatefile ('news_notallowed.tpl.php', false , false );
include_once 'finish.inc.php';
$tpl->loadTemplatefile ('news_new.tpl.php');
$valid_to = array_key_exists('valid_to', $_POST) ? (int) $_POST['valid_to'] : '';
// If $news is not empty, we have something to work.
$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 ('perm_user_id'), $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.
$result = $db->query ('INSERT INTO
' . $db->nextId ('news') . ',
' . $db->quote ( date('Y.m.d H:i:s', time()+60*60*24*7* $valid_to), 'timestamp' ) . ',
' . $db->quote ( $LU->getProperty ('perm_user_id'), 'integer' ) . ',
$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 ('group_ids')) > 1 ) {
$res = $db->query ('SELECT
description AS group_comment
AND section_id IN (' . implode(', ', $LU->getProperty ('group_ids')) . ')
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 ('group_ids')));
$tpl->parseCurrentBlock ();
include_once 'finish.inc.php';
Documentation generated on Mon, 11 Mar 2019 15:40:13 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|