コード例 #1
0
ファイル: site.func.php プロジェクト: eeewq123/aaa
function _Syndi_getArticleNextPage($args)
{
    global $g5;
    $sql = "select count(*) as cnt from " . $g5['board_table'] . " b, " . $g5['group_table'] . " g where b.bo_table='" . mysql_real_escape_string($args->target_channel_id) . "' and b.bo_read_level=1 and b.bo_list_level=1 and g.gr_use_access=0 and g.gr_id = b.gr_id";
    if ($row['cnt'] == 0) {
        return false;
    }
    // get article list
    $where = " and wr_is_comment=0 ";
    if ($args->target_content_id) {
        $where .= ' and wr_id=' . mysql_real_escape_string($args->target_content_id);
    }
    if ($args->start_time) {
        $where .= ' and wr_datetime >= ' . _getTime($args->start_time);
    }
    if ($args->end_time) {
        $where .= ' and wr_datetime <= ' . _getTime($args->end_time);
    }
    $count_sql = "select count(*) as cnt from " . $g5['write_prefix'] . $args->target_channel_id . " where 1=1 " . $where;
    $result = sql_query($count_sql);
    $row = sql_fetch_array($result);
    sql_free_result($result);
    $total_count = $row['cnt'];
    $total_page = ceil($total_count / $args->max_entry);
    if ($args->page >= $total_page) {
        if ($args->all_channel) {
            $next_channel_id = _Syndi_getNextChannelId($args->target_channel_id);
            if (!$next_channel_id) {
                return false;
            }
            return array('page' => 1, 'channel_id' => $next_channel_id);
        } else {
            return false;
        }
    } else {
        return array('page' => $args->page + 1);
    }
}
コード例 #2
0
ファイル: news.inc.php プロジェクト: Ideenkarosell/phpwcms
 function getPostData()
 {
     $post = array();
     // do only when news ID is known
     if ($this->newsId == 0) {
         $post['cnt_created'] = now();
     }
     $post['cnt_pid'] = 0;
     $post['cnt_type'] = '';
     $post['cnt_module'] = 'news';
     $post['cnt_changed'] = time();
     $post['cnt_status'] = empty($_POST['cnt_status']) ? 0 : 1;
     $post['cnt_archive_status'] = empty($_POST['cnt_archive_status']) ? 0 : 1;
     $post['cnt_prio'] = empty($_POST['cnt_prio']) ? 0 : intval($_POST['cnt_prio']);
     $temp_time = isset($_POST['calendar_start_time']) ? _getTime($_POST['calendar_start_time']) : '';
     $temp_date = isset($_POST['calendar_start_date']) ? _getDate($_POST['calendar_start_date']) : '';
     $post['cnt_livedate'] = $temp_date . ' ' . $temp_time;
     $temp_time = isset($_POST['calendar_end_time']) ? _getTime($_POST['calendar_end_time']) : '';
     $temp_date = isset($_POST['calendar_end_date']) ? _getDate($_POST['calendar_end_date']) : '';
     $post['cnt_killdate'] = $temp_date . ' ' . $temp_time;
     $temp_time = isset($_POST['sort_time']) ? _getTime($_POST['sort_time']) : '';
     $temp_date = isset($_POST['sort_date']) ? _getDate($_POST['sort_date']) : '';
     $post['cnt_sort'] = intval(strtotime($temp_date . ' ' . $temp_time));
     $post['cnt_name'] = isset($_POST['cnt_name']) ? clean_slweg($_POST['cnt_name']) : '';
     $post['cnt_title'] = isset($_POST['cnt_title']) ? clean_slweg($_POST['cnt_title']) : '';
     if ($post['cnt_name'] == '' && $post['cnt_title'] != '') {
         $post['cnt_name'] = $post['cnt_title'];
     } elseif ($post['cnt_name'] != '' && $post['cnt_title'] == '') {
         $post['cnt_title'] = $post['cnt_name'];
     }
     $post['cnt_alias'] = isset($_POST['cnt_alias']) ? clean_slweg($_POST['cnt_alias']) : '';
     if (empty($this->phpwcms['allow_empty_alias']) && $post['cnt_alias'] == '') {
         $post['cnt_alias'] = empty($post['cnt_title']) ? $post['cnt_name'] : $post['cnt_title'];
     }
     $post['cnt_alias'] = proof_alias($this->newsId, $post['cnt_alias'], 'CONTENT');
     $post['cnt_subtitle'] = isset($_POST['cnt_subtitle']) ? clean_slweg($_POST['cnt_subtitle']) : '';
     $post['cnt_editor'] = isset($_POST['cnt_editor']) ? clean_slweg($_POST['cnt_editor']) : '';
     $post['cnt_place'] = isset($_POST['cnt_place']) ? clean_slweg($_POST['cnt_place']) : '';
     $post['cnt_teasertext'] = isset($_POST['cnt_teasertext']) ? clean_slweg($_POST['cnt_teasertext']) : '';
     $post['cnt_text'] = isset($_POST['cnt_text']) ? slweg($_POST['cnt_text']) : '';
     $category = isset($_POST['cnt_category']) ? decode_entities(clean_slweg($_POST['cnt_category'])) : '';
     $category = trim(trim(preg_replace('/\\s+/', ' ', $category), ','));
     $post['cnt_lang'] = isset($_POST['cnt_lang']) ? preg_replace('/[^a-z\\-]/', '', strtolower($_POST['cnt_lang'])) : '';
     $post['cnt_opengraph'] = empty($_POST['cnt_opengraph']) ? 0 : 1;
     $post['cnt_object'] = array('cnt_image' => array('id' => isset($_POST['cnt_image_id']) ? intval($_POST['cnt_image_id']) : '', 'name' => isset($_POST['cnt_image_name']) ? clean_slweg($_POST['cnt_image_name']) : '', 'zoom' => empty($_POST['cnt_image_zoom']) ? 0 : 1, 'lightbox' => empty($_POST['cnt_image_lightbox']) ? 0 : 1, 'caption' => isset($_POST['cnt_image_caption']) ? clean_slweg($_POST['cnt_image_caption']) : '', 'link' => isset($_POST['cnt_image_link']) ? clean_slweg($_POST['cnt_image_link']) : ''), 'cnt_files' => array('id' => isset($_POST['cnt_files']) && is_array($_POST['cnt_files']) && count($_POST['cnt_files']) ? $_POST['cnt_files'] : array(), 'caption' => isset($_POST['cnt_file_caption']) ? clean_slweg($_POST['cnt_file_caption'], 0, false) : '', 'gallery' => empty($_POST['cnt_file_gallery']) ? 0 : 1, 'gallery_download' => empty($_POST['cnt_file_gallery_download']) ? 0 : 1), 'cnt_link' => isset($_POST['cnt_link']) ? clean_slweg($_POST['cnt_link']) : '', 'cnt_linktext' => isset($_POST['cnt_linktext']) ? clean_slweg($_POST['cnt_linktext']) : '', 'cnt_category' => $category, 'cnt_readmore' => empty($_POST['cnt_readmore']) ? 0 : 1, 'cnt_textformat' => isset($_POST['cnt_textformat']) ? clean_slweg($_POST['cnt_textformat']) : 'plain', 'cnt_searchoff' => empty($_POST['cnt_searchoff']) ? 0 : 1);
     return $post;
 }