コード例 #1
0
ファイル: Profile.php プロジェクト: kemosabhay/Lightning
 public function get()
 {
     // Load mailing list preferences.
     $all_lists = Subscription::getLists();
     $mailing_lists = Subscription::getUserLists(ClientUser::getInstance()->id);
     Template::getInstance()->set('all_lists', $all_lists);
     Template::getInstance()->set('mailing_lists', $mailing_lists);
 }
コード例 #2
0
 /**
  * Show the main page.
  */
 public function get()
 {
     $template = Template::getInstance();
     $template->set('admin_stats', false);
     $db = Database::getInstance();
     $template->set('roles', $db->selectAll(array('from' => 'role')));
     $template->set('permissions', $db->selectAll(array('from' => 'permission')));
 }
コード例 #3
0
ファイル: Send.php プロジェクト: kemosabhay/Lightning
 /**
  * The main page with options to send emails or tests.
  */
 public function get()
 {
     $message_id = Request::get('id', 'int');
     if (!$message_id || !($message = Database::getInstance()->selectRow('message', array('message_id' => $message_id)))) {
         Messenger::error('Message not found.');
         return;
     }
     $template = Template::getInstance();
     $template->set('content', 'mailing_send');
     $template->set('message', $message);
     JS::set('message_id', $message['message_id']);
     JS::addSessionToken();
 }
コード例 #4
0
ファイル: ListUsers.php プロジェクト: kemosabhay/Lightning
 public function __construct()
 {
     ClientUser::requireAdmin();
     $list_id = Request::get('list', 'int');
     if ($list_id === 0) {
         Template::getInstance()->set('title', 'Users not on any mailing list.');
         $this->accessTableCondition = array('message_list_id' => array('IS NULL'));
     } elseif ($list_id > 0) {
         $list = Database::getInstance()->selectField('name', 'message_list', array('message_list_id' => $list_id));
         Template::getInstance()->set('title', "Users on list {$list}.");
         $this->accessTableCondition = array('message_list_id' => $list_id);
     } else {
         Template::getInstance()->set('title', 'All users on all lists.');
     }
     parent::__construct();
 }
コード例 #5
0
ファイル: Facebook.php プロジェクト: kemosabhay/Lightning
 /**
  * Render the like and share links.
  */
 public static function renderLinks()
 {
     $settings = Configuration::get('social.facebook');
     if (!empty($settings['share']) || !empty($settings['like'])) {
         JS::startup("!function(d, s, id) {\n  var js, fjs = d.getElementsByTagName(s)[0];\n  if (d.getElementById(id)) return;\n  js = d.createElement(s); js.id = id;\n  js.src = '//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3';\n  fjs.parentNode.insertBefore(js, fjs);\n}(document, 'script', 'facebook-jssdk');");
         Template::getInstance()->addFooter('<div id="fb-root"></div>');
         $output = '';
         if (!empty($settings['share'])) {
             $output .= '<div class="fb-share-button" data-layout="button"></div>';
         }
         if (!empty($settings['like']) && !empty($settings['page'])) {
             $output .= '<div class="fb-like" data-href="https://facebook.com/' . $settings['page'] . '" data-layout="button" data-action="like" data-show-faces="false" data-share="false"></div>';
         }
         return $output;
     }
 }
コード例 #6
0
ファイル: Page.php プロジェクト: kemosabhay/Lightning
    /**
     * Prepare the output and tell the template to render.
     */
    public function output() {
        // Send globals to the template.
        $template = Template::getInstance();

        if (!empty($this->page)) {
            $template->set('content', $this->page);
        }

        $template->set('google_analytics_id', Configuration::get('google_analytics_id'));

        // TODO: These should be called directly from the template.
        $template->set('errors', Messenger::getErrors());
        $template->set('messages', Messenger::getMessages());

        $template->set('site_name', Configuration::get('site.name'));
        $template->set('blog', Blog::getInstance());
        JS::set('active_nav', $this->nav);
        $template->render($this->template);
    }
コード例 #7
0
 public function get()
 {
     ClientUser::requireAdmin();
     $template = Template::getInstance();
     $config_files = Config::getConfigurations();
     $config_data = array();
     foreach ($config_files as $source => $file) {
         $config_data[$source] = Config::getConfigurationData($file);
     }
     foreach ($config_data as $source => &$config) {
         array_walk_recursive($config, function (&$val) use($source) {
             if (!is_array($val)) {
                 $val = array('#source' => array($source), '#value' => array($val));
             }
         });
     }
     $config_data = call_user_func_array('array_merge_recursive', $config_data);
     $output = '<ul>' . $this->processSettingsForm($config_data) . '</ul>';
     $template->set('rendered_content', $output);
 }
コード例 #8
0
ファイル: OptIn.php プロジェクト: kemosabhay/Lightning
 public function get()
 {
     Template::getInstance()->set('content', 'landing');
 }
コード例 #9
0
ファイル: User.php プロジェクト: kemosabhay/Lightning
 /**
  * @todo this method needs to be updated.
  */
 public function postChangePass()
 {
     $template = Template::getInstance();
     $user = ClientUser::getInstance();
     $template->set('content', 'user_reset');
     if ($_POST['new_pass'] == $_POST['new_pass_conf']) {
         if (isset($_POST['new_pass'])) {
             if ($user->change_temp_pass($_POST['email'], $_POST['new_pass'], $_POST['code'])) {
                 $template->set("password_changed", true);
             }
         } else {
             $template->set("change_password", true);
         }
     } else {
         Messenger::error('Your password is not secure. Please pick a more secure password.');
         $template->set("change_password", true);
     }
 }
コード例 #10
0
ファイル: Page.php プロジェクト: kemosabhay/Lightning
 public function getNew()
 {
     // Prepare the template for a new page.
     $template = Template::getInstance();
     $template->set('action', 'new');
     $this->new = true;
     // Prepare the form.
     $this->get();
 }
コード例 #11
0
ファイル: Output.php プロジェクト: kemosabhay/Lightning
 public static function notFound() {
     Messenger::error('Not Found');
     header('HTTP/1.0 404 NOT FOUND');
     if(static::isJSONRequest()) {
         static::json(static::ERROR);
     } else {
         Template::getInstance()->render('');
     }
     exit;
 }
コード例 #12
0
ファイル: Table.php プロジェクト: kemosabhay/Lightning
 public function execute()
 {
     // Setup the template.
     $template = Template::getInstance();
     $template->set('table', $this);
     $template->set('content', 'table');
     // Call the appropriate execution handler.
     parent::execute();
 }
コード例 #13
0
ファイル: Base.php プロジェクト: kemosabhay/Lightning
 public function get()
 {
     Template::getInstance()->set('chart', $this);
 }
コード例 #14
0
ファイル: Blog.php プロジェクト: kemosabhay/Lightning
 public function get()
 {
     $blog_id = Request::get('id', 'int') | Request::get('blog_id', 'int');
     $path = explode('/', Request::getLocation());
     $blog = BlogModel::getInstance();
     if (preg_match('/.*\\.htm/', $path[0])) {
         $blog->loadContentByURL($path[0]);
     } elseif ($blog_id) {
         $blog->loadContentById($blog_id);
     } elseif (array_shift($path) == 'blog') {
         if (!empty($path)) {
             $blog->page = is_numeric($path[count($path) - 1]) ? $path[count($path) - 1] : 1;
             if ($path[0] == 'category') {
                 // Load category roll
                 $blog->loadList($blog->page, 'category', $path[1]);
             } elseif ($path[0] == 'author') {
                 // Load an author roll.
                 $blog->loadList($blog->page, 'author', $path[1]);
             } elseif (!empty($blog->page)) {
                 $blog->loadList();
             } else {
                 // Try to load a specific blog.
                 $blog->loadContentByURL($path[0]);
             }
         }
     }
     if (empty($blog->posts)) {
         // Fall back, load blogroll
         $blog->loadList(1);
     }
     $template = Template::getInstance();
     if (count($blog->posts) == 1) {
         $template->set('page_section', 'blog');
     } else {
         // If there is more than one, we show a list with short bodies.
         $blog->shorten_body = true;
     }
     if (count($blog->posts) == 1) {
         foreach (array('title', 'keywords', 'description', 'author') as $meta_data) {
             switch ($meta_data) {
                 case 'title':
                     $value = $blog->posts[0]['title'] . ' | ' . Configuration::get('meta_data.title') . ' | ' . Scrub::toHTML($blog->body($blog->posts[0]['author_name'], true));
                     break;
                 case 'description':
                     $value = Scrub::toHTML($blog->body($blog->posts[0]['body'], true));
                     break;
                 case 'author':
                     $value = Scrub::toHTML($blog->body($blog->posts[0]['author_name'], true));
                     break;
                 default:
                     $value = Scrub::toHTML($blog->body($blog->posts[0][$meta_data], true));
             }
             $template->set('page_' . $meta_data, $value);
         }
     }
     //meta facebook image
     if (count($blog->posts) == 1 && !empty($blog->posts[0]['header_image'])) {
         $template->set('og_image', Configuration::get('web_root') . $blog->posts[0]['header_image']);
     } elseif ($default_image = Configuration::get('blog.default_image')) {
         $template->set('og_image', Configuration::get('web_root') . $default_image);
     }
 }