function search_content_handler(&$sm) { $um =& $sm->get_url_manager(); if ($um->isset_param('search_do_advanced')) { require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Articles.class.php'; $params = Articles_list::get_search_params_from_url($sm); unset($params['pg']); if ($um->isset_param('search_archive')) { $params['search_archive'] = 1; } $params['search_do_advanced'] = true; $params = strtr(rtrim(base64_encode(serialize($params)), '='), '+/', '-_'); //$params = rtrim($params, '='); if ($um->isset_param('search_archive')) { header('Location:' . make_proxied_url('archive/index.html?search_options=' . $params)); } else { header('Location:' . make_proxied_url('index.html?search_options=' . $params)); } exit; } $template = $sm->get_template(); $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl'); $content_template = new template($sm, $template); $content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'system/advanced_search.tpl'); $template->assign('PAGE_CONTENT', $content_template->get_output()); }
function login_content_handler(&$sm) { $template = $sm->get_template(); $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl'); $um = $sm->get_url_manager(); $dm = $sm->get_dump_manager(); $dm->restore_dump(md5(make_proxied_url('login.html'))); if (defined('VIVVO_ABSOLUTE_URL')) { $index_url = VIVVO_ABSOLUTE_URL; } else { $index_url = make_absolute_url(''); } $action = $sm->action_status; $template->assign('DUMP_MESSAGES', $dm->_dump_pool); if ($action) { if ($um->get_param('action') == 'login' && $um->get_param('cmd') == 'login') { header('Location: ' . $index_url); exit; } elseif ($um->get_param('action') == 'login' && $um->get_param('cmd') == 'register' or $um->get_param('action') == 'login' && $um->get_param('cmd') == 'confirm') { $template->assign('REGISTRATION', strval('1')); } elseif ($um->get_param('action') == 'login' && $um->get_param('cmd') == 'changePassword') { $template->assign('REGISTRATION', strval('0')); } else { $template->assign('REGISTRATION', strval('0')); } } elseif ($um->isset_param('action') && $action === false) { $in_user = $um->get_param_regexp('/^USER_/'); $current_user = new Users($sm, $in_user); $template->assign('user', $current_user); } else { $template->assign('REGISTRATION', strval('0')); } $content_template = new template($sm, $template); if ($um->get_param('activation_key')) { $content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'system/change_password.tpl'); $content_template->assign('key', htmlspecialchars($um->get_param('activation_key'))); } else { $content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'system/register.tpl'); } $template->assign('PAGE_CONTENT', $content_template->get_output()); }
function format_article_url1($article) { if ($article->sefriendly != '') { $href = $article->id . '-' . urlencode($article->sefriendly); } else { $title = make_sefriendly($article->title); if ($title != '') { $href = $article->id . '-' . $title; } else { $href = $article->id; } } $sm = $article->_site_manager; $cat = $sm->get_categories(); if ($cat->list[$article->category_id]) { $breadcrumbs = $cat->list[$article->category_id]->get_breadcrumb_href(); } if ($breadcrumbs) { return make_proxied_url($breadcrumbs . $href . '.html'); } return 'index.php?news=' . $article->get_id(); }
function format_href($sm, $id, $category_id, $sefriendly) { if ($sefriendly != '') { $href = $sefriendly; } else { $href = $id; } $cat = $sm->get_categories(); if ($cat->list[$category_id]) { $breadcrumbs = $cat->list[$category_id]->get_breadcrumb_href(); } if ($breadcrumbs) { return make_proxied_url($breadcrumbs . $href . '.html'); } return 'index.php?news=' . $id; }
function format_href(&$sm, $id, $pg = 1, $type = 'html') { return make_proxied_url($sm->get_categories()->list[$id]->get_breadcrumb_href() . "index.{$pg}.{$type}"); }
/** * Gets href */ public function get_href() { return make_proxied_url(urlencode($this->url)) . '/'; }
function format_href($sm, $id, $name) { if (strlen($this->group_url)) { return make_proxied_url($this->group_url . urlencode($this->sefriendly)); } return make_proxied_url('tag/' . urlencode($this->sefriendly)); }
function format_href($sm, $id, $name) { if ($this->tags_group_id > 0) { $group = urlencode($this->get_group()->get_url()); $name = urlencode($this->sefriendly); } elseif (strlen($this->group_url)) { $group = $group_url; $name = urlencode($this->sefriendly); } else { $group = 'tag'; $name = urlencode($this->sefriendly); } return make_proxied_url($group . '/' . $name); }
function format_href($sm = null, $id, $username) { return make_proxied_url('author/' . $username . '/'); }
function format_href($sm, $id, $sefriendly) { if ($sefriendly != '') { return make_proxied_url($sefriendly . '.html'); } else { return make_proxied_url('404.html'); } }
/** * Makes absolute URL out of relative one * * @param string $url * @param bool $prepend_proxy * @return string */ function make_absolute_url($url, $prepend_proxy = true) { if ($prepend_proxy) { $url = make_proxied_url($url); } if (!preg_match('/^[^:\\/\\.\\?]+:/', $url)) { $url = VIVVO_URL . $url; } return $url; }
function switch_format($format, $url) { if (defined('VIVVO_PROXY_URL_OVERWRITE')) { $proxy = VIVVO_PROXY_URL_OVERWRITE; } elseif (defined('VIVVO_PROXY_URL')) { $proxy = VIVVO_PROXY_URL; } else { $proxy = ''; } if ($proxy and substr($url, 0, $start = strlen($proxy)) == $proxy or substr($url, 0, $start = strlen(VIVVO_URL)) == VIVVO_URL) { $url = substr($url, $start); } if (substr($url, -5) == '.html') { $url = preg_replace('/\\.html$/', '.' . $format, $url); if (substr($url, 0, 5) != 'feed/') { $url = 'feed/' . $url; } } elseif (strpos($url, '?') !== false) { $url = preg_replace('/[\\?&]output_type=[^&]*/', '', $url) . '&output_type=' . $format; } else { if (substr($url, 0, 5) != 'feed/') { $url = 'feed/' . $url; } $url .= 'index.' . $format; } return make_proxied_url($url); }
function format_article_url2($article) { return make_proxied_url('permalink/' . $article->id . '.html'); }
function generate_output($params) { $this->set_template($params); $sm = vivvo_lite_site::get_instance(); $um = $sm->get_url_manager(); $lang = vivvo_lang::get_instance(); if (!isset($params['search_by_year']) && !$um->isset_param('search_by_year')) { $year = date('Y', VIVVO_START_TIME); $params['search_by_year'] = $year; } else { if (isset($params['search_by_year'])) { $year = (int) $params['search_by_year']; } else { $year = (int) $um->get_param('search_by_year'); $params['search_by_year'] = $year; } } if (!isset($params['search_by_month']) && !$um->isset_param('search_by_month')) { $month = date('n', VIVVO_START_TIME); $params['search_by_month'] = $month; } else { if (isset($params['search_by_month'])) { $month = (int) $params['search_by_month']; } else { $month = (int) $um->get_param('search_by_month'); $params['search_by_month'] = $month; } } //Articles per day if ($month > 0 && $year > 1900) { if (!isset($params['search_do_advanced'])) { $params['search_status'] = -1; } require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Articles.class.php'; $article_params = Articles_list::get_search_params(null, $params); $article_list = new Articles_list(); $article_list->search($article_params['search_options'], '', 'ascending', 0, 0, false); $article_list->_query->_fields = array(); $article_list->_query->add_fields('DAYOFMONTH( created ) AS day'); $article_list->_query->add_fields('count( * ) AS count'); $article_list->_query->add_group_by('TO_DAYS( created )'); $query = $article_list->_query->get_query(); $num_of_days = date('t', mktime(0, 0, 0, $month, 1, $year)); $day_of_week = date('w', mktime(0, 0, 0, $month, 1, $year)); $prev_month = $month - 1; if ($prev_month == 0) { $prev_month = 12; $prev_year = $year - 1; } else { $prev_year = $year; } $next_month = $month + 1; if ($next_month == 13) { $next_month = 1; $next_year = $year + 1; } else { $next_year = $year; } $prev_num_of_days = date('t', mktime(0, 0, 0, $prev_month, 1, $prev_year)); if ($day_of_week != 0) { for ($i = 1 - $day_of_week; $i <= 0; $i++) { $this->data[$i] = array(); $this->data[$i]['label'] = ''; $this->data[$i]['count'] = 0; $this->data[$i]['url'] = ''; } } for ($i = 1; $i <= $num_of_days; $i++) { $this->data[$i] = array(); $this->data[$i]['label'] = $i; $this->data[$i]['count'] = 0; $this->data[$i]['url'] = ''; } $next_day_of_week = date('w', mktime(0, 0, 0, $month, $num_of_days, $year)); if ($next_day_of_week != 6) { for ($i = $num_of_days + 1; $i < $num_of_days + 6 - $next_day_of_week + 1; $i++) { $this->data[$i] = array(); $this->data[$i]['label'] = ''; $this->data[$i]['count'] = 0; $this->data[$i]['url'] = ''; } } $count_sum = 0; $res = $sm->get_db()->query($query); if (!is_a($res, 'mdb2_error')) { while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) { if ($row['count'] > 0) { $count_sum += $row['count']; $this->data[$row['day']]['count'] += $row['count']; if (isset($params['search_status']) && $params['search_status'] == -1) { $this->data[$row['day']]['url'] = make_proxied_url('archive/' . $year . '/' . $month . '/' . $row['day']); } else { $day_params = $article_params; $day_params['search_do_advanced'] = true; $day_params['search_by_day'] = $row['day']; $search_option = base64_encode(serialize($day_params)); $this->data[$row['day']]['url'] = make_absolute_url('index.php?search_options=' . $search_option); } } } } $res->free(); } if ($count_sum) { $month_params = $article_params; if (isset($params['search_status']) && $params['search_status'] == -1) { $this->_template->assign('month_url', make_proxied_url('archive/' . $year . '/' . $month . '/')); } else { $month_params['search_do_advanced'] = true; $search_option = base64_encode(serialize($month_params)); $this->_template->assign('month_url', make_absolute_url('index.php?search_options=' . $search_option)); } } $this->_template->assign('count_list', $this->data); $this->_template->assign('year', $year); $this->_template->assign('month', strval($lang->get_value('LNG_MONTH_' . $month))); $this->_template->assign('prev_year', intval($year - 1)); $this->_template->assign('prev_month_year', $prev_year); $this->_template->assign('prev_month', $prev_month); $this->_template->assign('next_year', intval($year + 1)); $this->_template->assign('next_month_year', $next_year); $this->_template->assign('next_month', $next_month); }