Example #1
0
}
if (empty($to_date_month)) {
    $to_date_month = date('m');
}
if (empty($to_date_year)) {
    $to_date_year = date('Y');
}
$files_arch = array();
// check for bad _GET and _POST
$user_post_query = cute_query_string($QUERY_STRING, array("archives", "start_from", "archive", "subaction", "id", "cnshow", "ucat", "dosearch", "story", "title", "user", "from_date_day", "from_date_month", "from_date_year", "to_date_day", "to_date_month", "to_date_year"), "post");
$date_from = mktime(0, 0, 0, intval($from_date_month), intval($from_date_day), intval($from_date_year));
$date_to = mktime(0, 0, 0, intval($to_date_month), intval($to_date_day), intval($to_date_year));
if (empty($search_form_hide) || isset($search_form_hide) && empty($dosearch)) {
    // Make parameters -----------------------------------------------------------------------------------------------------
    list($day_from, $month_from, $year_from) = make_postponed_date($date_from);
    list($day_to, $month_to, $year_to) = make_postponed_date($date_to);
    $selected_search_arch = empty($archives) ? false : "checked='checked'";
    $story = htmlspecialchars(urldecode($story));
    $title = htmlspecialchars(urldecode($title));
    $author = htmlspecialchars(urldecode($author));
    $hide = ($title or $author or !empty($archives)) ? false : true;
    echo proc_tpl('search');
}
// Do Search -------------------------------------------------------------------------------------------------------
if ($dosearch == "yes") {
    $mc_start = microtime(true);
    // In active news anyway
    $listing = array(time() => '/cdata/news.txt');
    // Also, search in archive if present (sort it)
    if (!empty($archives)) {
        $dir = read_dir(SERVDIR . '/cdata/archives');
Example #2
0
        foreach ($cat_lines as $single_line) {
            $cat_arr = explode("|", $single_line);
            $_cat_html .= '<option ' . ($category == $cat_arr[0] ? ' selected ' : '') . ' value="' . $cat_arr[0] . '">' . $cat_arr[1] . '</option>';
        }
        // new style
        $i = 0;
        foreach ($cat_lines as $single_line) {
            $i++;
            $cat_arr = explode("|", $single_line);
            $cat_id = $cat_arr[0];
            $cat_name = $cat_arr[1];
            $_multi_cat_html .= "<td style='font-size:10px;' valign=top><label for='cat" . $cat_id . "'><input " . ($category == $cat_id ? " checked " : '') . " style='background-color:transparent;border:0px;' type=checkbox name='category[]' id='cat" . $cat_id . "' value='" . $cat_id . "'>" . $cat_name . "</label></td>";
            if ($i % 4 == 0) {
                $_multi_cat_html .= '<tr>';
            }
        }
    }
    // ON/OFF CKEditor
    $tpl = $use_wysiwyg ? 'index_cke' : 'index';
    list($_dateD, $_dateM, $_dateY, $_dateH, $_dateI) = make_postponed_date();
    // Add hooks for modify ckeditor
    $CKEDITOR_Settings = hook('CKEDITOR_Settings', false);
    $CKEDITOR_SetsName = hook('CKEDITOR_SetsName', 'settings');
    // Edit news not replace fields
    $title = htmlspecialchars($_POST['title']);
    $short_story = htmlspecialchars($_POST['short_story']);
    $full_story = htmlspecialchars($_POST['full_story']);
    $UseAvatar = $config_use_avatar == 'yes' ? 1 : 0;
    echo proc_tpl('addnews/' . $tpl, array('member_db8' => $member_db[UDB_AVATAR], 'cat_html' => $_cat_html, 'multi_cat_html' => $_multi_cat_html, 'insertsmiles' => insertSmilies($short_story_id, 4, true, $use_wysiwyg), 'insertsmiles_full' => insertSmilies($full_story_id, 4, true, $use_wysiwyg), 'dated' => $_dateD, 'datem' => $_dateM, 'datey' => $_dateY, 'dateh' => $_dateH, 'datei' => $_dateI));
    echofooter();
}
Example #3
0
function dashboard_archives()
{
    list($req_archive_id, $arch_action, $last_only, $period) = GET('archive_id, arch_action, last_only, period');
    // Do make archive
    if (request_type('POST')) {
        cn_dsi_check();
        // Archives actions
        if ($req_archive_id) {
            // Delete
            if ($arch_action == 'rm') {
                db_archive_meta_update($req_archive_id, 0, 0, 0);
                $req_archive_id = 0;
                cn_throw_message("Archive deleted", 'e');
            } elseif ($arch_action == 'extr') {
                if (!db_extract_archive($req_archive_id)) {
                    cn_throw_message("Archive not extracted correctly", 'e');
                } else {
                    $req_archive_id = 0;
                    cn_throw_message("Archive extracted");
                }
            } else {
                cn_throw_message('@SYSINFO: Unrecognized request', 'e');
            }
        } else {
            if ($last_only) {
                $date_f = ctime() - $period * 3600 * 24;
                $date_t = ctime();
            } else {
                list($_fd, $_fm, $_fy) = GET('from_date_day, from_date_month, from_date_year', 'POST');
                list($_td, $_tm, $_ty) = GET('to_date_day, to_date_month, to_date_year', 'POST');
                $date_f = mktime(0, 0, 0, intval($_fm), intval($_fd), intval($_fy));
                $date_t = mktime(23, 59, 59, intval($_tm), intval($_td), intval($_ty));
            }
            $cc = db_make_archive($date_f, $date_t);
            if ($cc) {
                cn_throw_message(i18n('Archive created (%1 articles)', $cc));
            } else {
                cn_throw_message('There is nothing to archive', 'e');
            }
        }
    }
    // --- archives
    $arch_list = db_get_archives();
    // ---- fetch active ---
    $ids = db_index_load();
    ksort($ids);
    reset($ids);
    $st = key($ids);
    end($ids);
    $ed = key($ids);
    list($f_date_d, $f_date_m, $f_date_y) = make_postponed_date($st);
    list($t_date_d, $t_date_m, $t_date_y) = make_postponed_date($ed);
    cn_assign('arch_list, archive_id', $arch_list, $req_archive_id);
    cn_assign('f_date_d, f_date_m, f_date_y, t_date_d, t_date_m, t_date_y', $f_date_d, $f_date_m, $f_date_y, $t_date_d, $t_date_m, $t_date_y);
    echoheader('-@dashboard/style.css', 'Arhives');
    echo exec_tpl('dashboard/archives');
    echofooter();
}
Example #4
0
$form = str_replace('{php_self}', PHP_SELF, $form);
// Basic Input Box
$form = str_replace('{search_basic}', '<input type="hidden" name="template" value="' . cn_htmlspecialchars(REQ('template')) . '" /><input type="hidden" name="dosearch" value="yes" /><input class="cn_search_basic" type="text" name="search" value="' . cn_htmlspecialchars($search) . '" />', $form);
$form = str_replace('{author}', '<input class="cn_author" type="text" name="user" value="' . cn_htmlspecialchars($user) . '" />', $form);
$form = str_replace('{in_archives}', '<input class="cn_in_archives" type="checkbox" name="archives" value="Y" ' . ($archives ? 'checked' : '') . ' />', $form);
// Make submit button
$form = preg_replace('/\\[submit\\](.*?)\\[\\/submit\\]/', '<input class="cn_submit" type="submit" value="\\1" />', $form);
// Hidden fields placeholder [hid=name] --> input:hidden
if (preg_match_all('/\\[hid=(.*?)\\]/i', $form, $c, PREG_SET_ORDER)) {
    foreach ($c as $v) {
        $form = str_replace($v[0], '<input type="hidden" name="' . $v[1] . '" value="' . REQ($v[1]) . '" />', $form);
    }
}
// Date selection
list($_df, $_mf, $_yf) = make_postponed_date($date_from);
list($_dt, $_mt, $_yt) = make_postponed_date($date_to);
$_ds = array('{select=year:from}' => array('from_date_year', $_yf), '{select=mon:from}' => array('from_date_month', $_mf), '{select=day:from}' => array('from_date_day', $_df), '{select=year:to}' => array('to_date_year', $_yt), '{select=mon:to}' => array('to_date_month', $_mt), '{select=day:to}' => array('to_date_day', $_dt));
foreach ($_ds as $id => $opt) {
    $form = str_replace($id, '<select name="' . $opt[0] . '" class="cn_' . $opt[0] . '">' . $opt[1] . '</select>', $form);
}
echo $form;
// ---------------------------------------------------------------------------------------------------------------------
if ($dosearch) {
    $mc_start = microtime(true);
    // Remove parameters for go to news from searchbox
    $_static_qr = 'dosearch,archives,search,from_date_year,from_date_month,from_date_day,to_date_year,to_date_month,to_date_day,search_st,number,archive,template';
    $st = -1;
    $_next_link = FALSE;
    $_number = $number;
    $archive_id = 0;
    // get archive list
Example #5
0
<?php

// initialize
list($preview_html, $preview_html_full, $vTitle, $vPage, $categories, $vCategory, $gstamp, $archive_id) = _GL('preview_html, preview_html_full, vTitle, vPage, categories, vCategory, gstamp, archive_id');
list($vShort, $EDITMODE, $vFull, $is_active_html, $vUseHtml, $is_draft, $vConcat, $vTags) = _GL('vShort, EDITMODE, vFull, is_active_html, vUseHtml, is_draft, vConcat, vTags');
list($_dateD, $_dateM, $_dateY, $_dateH, $_dateI, $_dateS) = make_postponed_date($gstamp);
list($morefields) = _GL('morefields');
list($id) = GET('id', "GETPOST");
// CKEDITOR INITIALIZE BLOCK
$CKEDITOR_Active = getoption('use_wysiwyg');
// DRAFT
if (test('Bd')) {
    $is_draft = TRUE;
}
// MESSAGES BLOCK
cn_snippet_messages();
if ($preview_html) {
    ?>

        <div style="margin: 10px 0 30px 0;">
            <div style="border: 1px dashed gray; float: left; width: 50%;">
                <div style="background: #eeeeee; border-bottom: 1px solid #cccccc; margin: 0; padding: 4px; text-align: center;"><b>PREVIEW ACTIVE NEWS ENTRY</b></div>
                <div style="border:4px solid #f0f0a0;"><?php 
    echo $preview_html;
    ?>
</div> </div>
            <div style="clear:left;"></div>
            <div style="height: 8px"></div>
        </div>

        <?php