Ejemplo n.º 1
0
/*
 * @since : 2009
 * @author : Arslan Hassan
 */
/* Assigning page and subpage */
if (!defined('MAIN_PAGE')) {
    define('MAIN_PAGE', 'Global Announcement');
}
if (!defined('SUB_PAGE')) {
    define('SUB_PAGE', 'Edit Announcement');
}
require_once '../includes/admin_config.php';
$userquery->admin_login_check();
$userquery->login_check('admin_access');
$pages->page_redir();
if (isset($_POST['update'])) {
    $text = mysql_clean($_POST['text']);
    update_announcement($text);
    $msg = e("Announcement has been updated", 'm');
}
global $db;
$ann_array = $db->_select('SELECT * FROM ' . tbl("global_announcement"));
if (is_array($ann_array)) {
    assign('an', $ann_array[0]['announcement']);
} else {
    assign('an', '');
}
subtitle("Annoucment Manager");
template_files('edit_announcemnent.html');
display_it();
Ejemplo n.º 2
0
    if (get_opendb_config_var('widgets', 'enable_javascript_validation') !== FALSE) {
        $onclick_event = "if(!checkForm(this.form)){return false;}else{this.form.submit();}";
    } else {
        $onclick_event = "this.form.submit();";
    }
    $buffer .= "<input type=\"button\" class=\"button\" onclick=\"{$onclick_event}\" value=\"Save\">";
    $buffer .= "\n</form>";
    return $buffer;
}
if (strlen($HTTP_VARS['op']) == 0) {
    $HTTP_VARS['op'] = 'list';
}
if ($HTTP_VARS['op'] == 'update') {
    //update an existing announcement
    if (strlen($HTTP_VARS['title']) > 0 && strlen($HTTP_VARS['content']) > 0 && is_numeric($HTTP_VARS['display_days'])) {
        if (!update_announcement($HTTP_VARS['announcement_id'], $HTTP_VARS['title'], $HTTP_VARS['content'], $HTTP_VARS['display_days'], $HTTP_VARS['closed_ind'])) {
            $errors[] = array('error' => 'Announcement not updated', 'detail' => db_error());
        }
        $HTTP_VARS['op'] = 'list';
    } else {
        $errors[] = array('error' => 'Title, Content and Display Days are required');
        $HTTP_VARS['op'] = 'edit';
    }
} else {
    if ($HTTP_VARS['op'] == 'insert') {
        //insert new announcement
        if (strlen($HTTP_VARS['title']) > 0 && strlen($HTTP_VARS['content']) > 0 && is_numeric($HTTP_VARS['display_days'])) {
            if (!insert_announcement($HTTP_VARS['title'], $HTTP_VARS['content'], $HTTP_VARS['display_days'])) {
                $errors[] = array('error' => 'Announcement not added', 'detail' => db_error());
            }
            $HTTP_VARS['op'] = 'list';