Ejemplo n.º 1
0
 public function __construct($request, $response, $params = NULL)
 {
     parent::__construct($request, $response, $params);
     if (!$this->user->hasLogin()) {
         $this->response->redirect($this->some->___loginUrl() . '?redir=' . $this->request->getRequestUrl());
     }
     /** 初始化皮肤路径 */
     $this->_themeDir = rtrim($this->options->themeFile($this->options->theme), '/') . '/';
 }
Ejemplo n.º 2
0
 public function post()
 {
     $rssfile = array("http://news.ifeng.com/rss/index.xml", "http://news.ifeng.com/mil/rss/index.xml", "http://news.ifeng.com/history/rss/index.xml", "http://news.ifeng.com/rss/mainland.xml", "http://news.ifeng.com/rss/taiwan.xml", "http://news.ifeng.com/rss/world.xml", "http://news.ifeng.com/rss/society.xml", "http://news.ifeng.com/rss/photo.xml", "http://news.ifeng.com/sports/rss/index.xml");
     $rssfile = $rssfile[rand(0, count($rssfile) - 1)];
     $xml = simplexml_load_file($rssfile);
     $postObj = new Widget_Abstract_Contents($this->request, $this->response);
     $insertId = array();
     $posts = array();
     foreach ($xml->channel->item as $item) {
         $post = array();
         $post['title'] = (string) $item->title[0];
         $post['text'] = (string) $item->description[0];
         $posts[] = $post;
     }
     if (!empty($posts)) {
         foreach ($posts as $post) {
             $insertId[] = $postObj->insert($post);
         }
     }
     include_once 'views/post.php';
 }
Ejemplo n.º 3
0
 /**
  * 如果这里没有重载, 每次都会被默认执行
  *
  * @access public
  * @param boolen $run 是否执行
  * @return void
  */
 public function execute($run = false)
 {
     if ($run) {
         parent::execute();
     }
     $this->_wpOptions = array('software_name' => array('desc' => _t('软件名称'), 'readonly' => true, 'value' => $this->options->software), 'software_version' => array('desc' => _t('软件版本'), 'readonly' => true, 'value' => $this->options->version), 'blog_url' => array('desc' => _t('博客地址'), 'readonly' => true, 'option' => 'siteUrl'), 'time_zone' => array('desc' => _t('时区'), 'readonly' => false, 'option' => 'timezone'), 'blog_title' => array('desc' => _t('博客标题'), 'readonly' => false, 'option' => 'title'), 'blog_tagline' => array('desc' => _t('博客关键字'), 'readonly' => false, 'option' => 'description'), 'date_format' => array('desc' => _t('日期格式'), 'readonly' => false, 'option' => 'postDateFormat'), 'time_format' => array('desc' => _t('时间格式'), 'readonly' => false, 'option' => 'postDateFormat'), 'users_can_register' => array('desc' => _t('是否允许注册'), 'readonly' => false, 'option' => 'allowRegister'));
 }
Ejemplo n.º 4
0
 /**
  * 输出文章内容
  *
  * @access public
  * @param string $more 文章截取后缀
  * @return void
  */
 public function content($more = NULL)
 {
     parent::content($this->is('single') ? false : $more);
 }
Ejemplo n.º 5
0
 /**
  * 输出文章发布日期
  *
  * @access public
  * @param string $format 日期格式
  * @return void
  */
 public function date($format = NULL)
 {
     if (isset($this->created)) {
         parent::date($format);
     } else {
         echo date($format, $this->options->gmtTime + $this->options->timezone - $this->options->serverTimezone);
     }
 }
Ejemplo n.º 6
0
 /**
  * 显示主题发布界面
  * @see Widget_Abstract::render()
  */
 public function render()
 {
     if ($this->request->isPost()) {
         $this->doPublish();
         /** 设置提示信息 */
         $this->widget('Widget_Notice')->set('post' == $this->type ? _t('文章 "<a href="%s">%s</a>" 已经发布', $this->permalink, $this->title) : _t('文章 "%s" 等待审核', $this->title), 'success');
         $this->response->goBack();
     } else {
         $this->_metaTitle = '创作新主题';
         $this->setCurrentTag();
     }
     parent::render('publish.php');
 }