Esempio n. 1
0
 /**
  * Процессор:
  */
 public function process($template)
 {
     $session = Session::getInstance();
     $stats = Blog_BlogStatisticsModel::getGlobalStats();
     $links_on = $session->persistenceGet('show_links_panel', true);
     if ($links_on) {
         $filter = $session->persistenceGet('live_filter', true);
         $links = Blog_BlogOnlineModel::GetLinks($filter);
         $template->setParameter('online_links', array_slice($links, 0, 12));
         $template->setParameter('right_panel', $links_on);
     }
     $template->setParameter('global_unique', $stats['unique']);
     $template->setParameter('global_online', $stats['online']);
     $template->setParameter('global_posts', $stats['posts']);
     $template->setParameter('global_unique_posters', $stats['unique_posters']);
     $template->setParameter('global_speed', $stats['speed']);
     if ($session->persistenceGet('global_theme', false)) {
         return $template->render($this->viewParams, $session->persistenceGet('global_theme'));
     }
     parent::process($template);
 }
Esempio n. 2
0
 /**
  * Действие удаление ссылки из ротатора:
  */
 public function removeOnlineLinkAjaxAction(Application $application)
 {
     if (!Session::getInstance()->isAdminSession()) {
         return false;
     }
     $link = Blog_BlogOnlineModel::GetLink($_GET['id']);
     if ($link) {
         Blog_BlogOnlineModel::RemoveLink($_GET['id']);
         ControlModel::logModEvent(date("d-m-Y H:i:s") . ' ' . $_SESSION['auth']['name'] . '<br /> удалил ссылку ' . $link['link'] . '<br /><em>' . strip_tags($link['description']) . '</em>');
         JabberBot::send('-=$ /me (модлог) ' . $_SESSION['auth']['name'] . ' удалил ссылку ' . $link['link'] . ': ' . strip_tags($link['description']));
     }
     return true;
 }
Esempio n. 3
0
 /**
  * Переход по ссылке:
  */
 public function redirectAction(Application $application, Template $template)
 {
     Blog_BlogOnlineModel::Click($_GET['id']);
     $template->headerSeeOther($_GET['to']);
 }
Esempio n. 4
0
 /**
  * Управление каналами ротатора:
  */
 public function onlineChannelAction(Application $application, Template $template)
 {
     $template->setParameter('menu', 'posts');
     $template->setParameter('submenu', 'online_channel');
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $cats = array();
         $strings = explode("\n", $_POST['channels']);
         foreach ($strings as $str) {
             if (empty($str)) {
                 continue;
             }
             list($title, $regexp, $url) = explode(' :|: ', $str);
             $cats[] = array('title' => $title, 'regexp' => $regexp, 'url' => $url);
         }
         Blog_BlogOnlineModel::SetCategories($cats);
     }
     $cats = Blog_BlogOnlineModel::GetCategories();
     $result = '';
     foreach ($cats as $cat) {
         $result .= $cat['title'] . ' :|: ' . $cat['regexp'] . ' :|: ' . $cat['url'] . "\n";
     }
     $this['channels'] = $result;
     return true;
 }