Esempio n. 1
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;
 }