function get_new_articles(&$template_default, $max_cnt_links = 0, $cat = '', $dbcon = null) { // find all new articles $max_cnt_links = intval($max_cnt_links); $limit = empty($max_cnt_links) ? '' : ' LIMIT ' . $max_cnt_links; $cat = trim($cat); $cat = is_intval($cat, false) ? 'article_cid=' . intval($cat) . ' AND ' : ''; $sql = 'SELECT article_id, article_title, article_cid, article_alias, article_redirect, article_morelink, '; switch (empty($template_default["sort_by"]) ? '' : strtolower($template_default["sort_by"])) { case 'cdate': //use real creation date $sql .= "article_created AS article_date "; $sorting = 'article_created'; break; case 'ldate': //use live/start date $sql .= "UNIX_TIMESTAMP(article_begin) AS article_date "; $sorting = 'article_begin'; break; case 'kdate': //use kill/end date $sql .= "UNIX_TIMESTAMP(article_end) AS article_date "; $sorting = 'article_end'; break; default: $sql .= "UNIX_TIMESTAMP(article_tstamp) AS article_date "; $sorting = 'article_tstamp'; } $sql .= "FROM " . DB_PREPEND . "phpwcms_article WHERE " . $cat; // VISIBLE_MODE: 0 = frontend (all) mode, 1 = article user mode, 2 = admin user mode switch (VISIBLE_MODE) { case 0: $sql .= "article_aktiv=1 AND "; break; case 1: $sql .= "(article_aktiv=1 OR article_uid=" . $_SESSION["wcs_user_id"] . ") AND "; break; //case 2: admin mode no additional neccessary } $sql .= 'article_deleted=0 '; if (!PREVIEW_MODE) { $sql .= 'AND article_begin < NOW() AND article_end > NOW() '; } $sql .= "ORDER BY " . $sorting . " DESC" . $limit; // new articles list $new_links = ""; $target = $template_default["link_target"] ? ' target="' . $template_default["link_target"] . '"' : ''; $result = _dbQuery($sql); $count = 0; foreach ($result as $row) { if (empty($row['article_redirect'])) { if (empty($row['article_morelink'])) { continue; } $article_link = 'index.php?' . setGetArticleAid($row) . '"' . $target; } else { $redirect = get_redirect_link($row['article_redirect'], ' ', ''); $article_link = $redirect['link'] . '"' . $redirect['target']; } $count++; if ($template_default["link_length"] && strlen($row['article_title']) > $template_default["link_length"]) { $article_title = substr($row['article_title'], 0, $template_default["link_length"]) . $template_default["cut_title_add"]; } else { $article_title = $row['article_title']; } $article_title = html_specialchars($article_title); if (trim($template_default["date_format"])) { $article_title = $template_default["date_before"] . html_specialchars(international_date_format($template_default["date_language"], $template_default["date_format"], $row['article_date'])) . $template_default["date_after"] . $article_title; } $new_links .= $template_default["link_before"]; $new_links .= $template_default["link_symbol"]; $new_links .= '<a href="' . $article_link . '>' . $article_title . '</a>'; $new_links .= $template_default["link_after"]; } //enclose whole if ($new_links) { $new_links = $template_default["before"] . $new_links . $template_default["after"]; } return $new_links; }
$content["all"] = preg_replace_callback('/\\{NAV_LIST_CURRENT:(\\d+):(.*?):(.*?)\\}/', 'css_level_list_current_callback', $content["all"]); // Table based navigation, outdated if (strpos($content["all"], '{NAV_TABLE') !== false) { $content["all"] = str_replace('{NAV_TABLE_SIMPLE}', nav_table_simple_struct($content["struct"], $content["cat_id"]), $content["all"]); $content["all"] = str_replace('{NAV_TABLE_COLUMN}', '{NAV_TABLE_COLUMN:0}', $content["all"]); $content["all"] = preg_replace_callback('/\\{NAV_TABLE_COLUMN:(\\d+)\\}/', 'nav_table_struct_callback', $content["all"]); } } $content["all"] = html_parser_deprecated($content["all"]); } // date replacement if (strpos($content["all"], '{DATE_') !== false) { $content["all"] = str_replace('{DATE_LONG}', international_date_format($template_default["date"]["language"], $template_default["date"]["long"]), $content["all"]); $content["all"] = str_replace('{DATE_MEDIUM}', international_date_format($template_default["date"]["language"], $template_default["date"]["medium"]), $content["all"]); $content["all"] = str_replace('{DATE_SHORT}', international_date_format($template_default["date"]["language"], $template_default["date"]["short"]), $content["all"]); $content["all"] = str_replace('{DATE_ARTICLE}', international_date_format($template_default["date"]["language"], $template_default["date"]["article"], $content["article_date"]), $content["all"]); } // time replacement if (strpos($content["all"], '{TIME_') !== false) { $content["all"] = str_replace('{TIME_LONG}', date($template_default["time"]["long"]), $content["all"]); $content["all"] = str_replace('{TIME_SHORT}', date($template_default["time"]["short"]), $content["all"]); $content["all"] = str_replace('{TIME_ARTICLE}', date($template_default["time"]["short"], $content["article_date"]), $content["all"]); } // replace custom search form input field and action with right target if (strpos($content["all"], '###search_input_') !== false) { $content["all"] = str_replace('###search_input_field###', 'search_input_field', $content["all"]); $content["all"] = str_replace('###search_input_value###', empty($content["search_word"]) ? '' : $content["search_word"], $content["all"]); // create serahc form action if (strpos($content["all"], '###search_input_action:') !== false) { $content["all"] = preg_replace_callback('/###search_input_action:(\\d+)###/', 'get_search_action', $content["all"]); }
function CP_CreateDate($text, &$data) { $change_date = strtotime($data['acontent_created']); return str_replace('{CPDATE}', international_date_format('DE', 'd.m.Y', $change_date), $text); }