示例#1
0
 public function testNewsIndex()
 {
     /* Assertions:
      * Site has at least one news page (required for tests).
      * All pages return 200 (public) or 403 (login required).
      * At least one news page is public (required for tests).
      */
     $newsPages = Typeframe::Registry()->applicationUrls('News');
     $this->assertTrue(count($newsPages), "No news pages to test.");
     foreach ($newsPages as $page) {
         $this->get($page);
         if (Typeframe::Allow($page)) {
             $validResponse = 200;
             $this->availablePage = $page;
         } else {
             $validResponse = 403;
         }
         $this->assertTrue($this->responseCode() == $validResponse, "{$page} returned {$this->responseCode()} (expected {$validResponse})");
     }
     $this->assertTrue(count($newsPages) == 0 || $this->availablePage, "No public news pages available for tests.");
 }
示例#2
0
<?php

if (Typeframe::Allow(TYPEF_WEB_DIR . '/admin/seo-head')) {
    $inserts = $pm->getVariable('inserts');
    if (!is_array($inserts)) {
        $inserts = array();
    }
    $seo = array();
    $seo[] = array('name' => 'seo_head_title', 'label' => 'Page Title', 'type' => 'text');
    $seo[] = array('name' => 'seo_head_description', 'label' => 'Meta Description', 'type' => 'text');
    $seo[] = array('name' => 'seo_head_keywords', 'label' => 'Meta Keywords', 'type' => 'text');
    $pm->setVariable('inserts', array_mergs($seo, $inserts));
}
示例#3
0
 public function __construct($id = null)
 {
     $this->_tablename = '#__download';
     $this->_pks = array('fileid');
     $this->_aicolumn = 'fileid';
     $this->_isent = true;
     $this->_entpropagation = DAO::ENTPROPAGATION_PROPAGATE;
     $this->_datecreatedcolumn = 'datecreated';
     $this->_datemodifiedcolumn = 'datemodified';
     $this->_includeForeign('Download_Category', 'categoryid', 'categoryid', false, 'category');
     $this->_includeForeign('Download_Tag', 'fileid', 'fileid', true, 'tags');
     if ($id) {
         $this->set('fileid', (int) $id);
         $this->load();
     } else {
         // so _select is accessible
         $this->_copySelect();
         // sort articles by publication date
         $this->_select->order('filetitle');
         // limit to 'published' if non-admin
         if (!Typeframe::Allow(TYPEF_WEB_DIR . '/admin/downloads')) {
             $this->_select->where('status = ?', self::STATUS_PUBLISHED);
         }
     }
 }
示例#4
0
文件: users.php 项目: ssrsfs/blg
<?php

if (Typeframe::Allow(TYPEF_WEB_DIR . '/admin/users')) {
    // get number of users online
    $users = new Model_User();
    $users->where('DATE_ADD(lastrequest, INTERVAL 30 MINUTE) > NOW()');
    $data = $pm->data();
    $data['admin_users'] = array();
    $data['admin_users']['online'] = $users;
    $pm->addLoop('admin_panels', array('name' => 'Users', 'template' => '/admin/users/panel.inc.html'));
}
示例#5
0
文件: news.php 项目: ssrsfs/blg
<?php

if (Typeframe::Allow(TYPEF_WEB_DIR . '/admin/news') || Typeframe::Allow(TYPEF_WEB_DIR . '/admin/pages')) {
    $pages = new Model_Page();
    $pages->where('application IN ?', array('News', 'News RSS'));
    foreach ($pages->getAll() as $page) {
        $pm->addLoop('admin_pages', $page);
    }
}
if (Typeframe::Allow(TYPEF_WEB_DIR . '/admin/news')) {
    $admin_news = array();
    $articles = new Model_News_Article();
    $admin_news['totalarticles'] = $articles->getTotal();
    $articles = new Model_News_Article();
    $articles->where('status = ?', 'draft');
    $admin_news['totaldrafts'] = $articles->getTotal();
    $pm->setVariable('admin_news', $admin_news);
    $pm->addLoop('admin_panels', array('name' => 'News', 'template' => '/admin/news/panel.inc.html'));
}
示例#6
0
文件: config.php 项目: ssrsfs/blg
<?php

if (Typeframe::Allow(TYPEF_WEB_DIR . '/admin/config')) {
    $admin_config = array();
    foreach (Typeframe::Registry()->configs() as $config) {
        $admin_configs[] = array('name' => $config->name());
    }
    $pm->setVariable('admin_configs', $admin_configs);
    $pm->sortLoop('admin_configs', 'name');
}