Example #1
0
 function index()
 {
     // Articles
     $articles = $this->article_model->get_list(array('order_by' => 'updated DESC'));
     // Last 5 articles
     $last_articles = array();
     $max = count($articles) > 4 ? 5 : count($articles);
     if (!empty($articles)) {
         for ($i = 0; $i < $max; $i++) {
             $last_articles[] = $articles[$i];
         }
     }
     // Get all contexts : links between pages and articles
     $page_article = $this->article_model->get_all_context();
     // Get pages
     $pages = $this->page_model->get_lang_list(false, Settings::get_lang('default'));
     // Add page name to each context & feed the linked articles array
     $linked_articles = array();
     foreach ($page_article as &$pa) {
         if (array_search($pa['id_article'], $linked_articles) === FALSE) {
             $linked_articles[] = $pa['id_article'];
         }
         $page = array_values(array_filter($pages, create_function('$row', 'return $row["id_page"] == "' . $pa['id_page'] . '";')));
         $pa['page'] = !empty($page) ? $page[0] : array();
     }
     // Orphan articles
     $orphan_articles = array();
     foreach ($articles as $article) {
         if (array_search($article['id_article'], $linked_articles) === FALSE) {
             $orphan_articles[] = $article;
         }
     }
     // Orphan pages
     $orphan_pages = $this->page_model->get_lang_list(array('id_menu' => '0', 'order_by' => 'name ASC'), Settings::get_lang('default'));
     // Last connected users
     //		$users = array_filter($this->connect->model->get_users(array('limit'=>'10', 'level > ' => '999'), array($this, '_filter_users'));
     $users = $this->connect->model->get_users(array('limit' => '10', 'order_by' => 'last_visit DESC', 'last_visit <>' => ''));
     $last_registered_users = $this->connect->model->get_users(array('limit' => '10', 'order_by' => 'join_date DESC'));
     // Updates on last articles
     foreach ($last_articles as &$article) {
         // User name update
         foreach ($users as $user) {
             if ($user['username'] == $article['updater']) {
                 $article['updater'] = $user['screen_name'];
             }
             if ($user['username'] == $article['author']) {
                 $article['author'] = $user['screen_name'];
             }
         }
         // Article's pages...
         $article['pages'] = array_values(array_filter($page_article, create_function('$row', 'return $row["id_article"] == "' . $article['id_article'] . '";')));
     }
     // Updates on orphan pages
     foreach ($orphan_pages as &$page) {
         // User name update
         foreach ($users as $user) {
             if ($user['username'] == $page['updater']) {
                 $page['updater'] = $user['screen_name'];
             }
             if ($user['username'] == $page['author']) {
                 $page['author'] = $user['screen_name'];
             }
         }
     }
     // Updates on orphan articles
     foreach ($orphan_articles as &$article) {
         // User name update
         foreach ($users as $user) {
             if ($user['username'] == $article['updater']) {
                 $article['updater'] = $user['screen_name'];
             }
             if ($user['username'] == $article['author']) {
                 $article['author'] = $user['screen_name'];
             }
         }
     }
     // Flags
     $settings = Settings::get_settings();
     $flags = array();
     foreach ($settings as $key => $setting) {
         if (strpos($key, 'flag') !== FALSE && $setting != '') {
             $flags[substr($key, -1)] = $setting;
         }
     }
     // Modules
     $modules = array();
     include APPPATH . 'config/modules.php';
     $config_files = glob(MODPATH . '*/config.xml');
     // Module data to put to template
     $moddata = array();
     // Get all modules from folders
     if (!empty($config_files)) {
         foreach ($config_files as $file) {
             $xml = simplexml_load_file($file);
             // Module folder
             preg_match('/\\/([^\\/]*)\\/config.xml$/i', $file, $matches);
             $folder = $matches[1];
             $uri = (string) $xml->uri_segment;
             // Only add
             // - installed modules (in $module var of config/modules.php)
             // - module with admin part
             if (in_array($folder, $modules) && $xml->has_admin == 'true') {
                 // Store data
                 $moddata[$uri] = array('name' => (string) $xml->name, 'uri_segment' => (string) $xml->uri_segment, 'description' => (string) $xml->description, 'folder' => $folder, 'file' => $file, 'access_group' => (string) $xml->access_group);
                 // Get the user segment
                 foreach ($modules as $segment => $f) {
                     if ($f == $folder) {
                         $moddata[$uri]['uri_segment'] = $segment;
                     }
                 }
             }
         }
     }
     // Put installed module list to template
     $this->template['modules'] = $moddata;
     $this->template['flags'] = $flags;
     $this->template['last_articles'] = $last_articles;
     $this->template['orphan_pages'] = $orphan_pages;
     $this->template['orphan_articles'] = $orphan_articles;
     $this->template['users'] = $users;
     $this->template['last_registered_users'] = $last_registered_users;
     $this->output('dashboard');
 }
Example #2
0
 public function get_todos()
 {
     $settings = Settings::get_settings();
     log_message('app', print_r($settings, TRUE));
 }
$freeform_user_settings = array('pp_limit_value' => _("Post-processing projects limit, -1 means unlimited"));
$username = array_get($_POST, 'username', array_get($_GET, 'username', NULL));
$action = get_enumerated_param($_POST, 'action', NULL, array('update'), TRUE);
$title = _("Manage Site Access Privileges");
output_header($title);
echo "<h1>{$title}</h1>\n";
echo "<p>" . _("This page allows you to grant or revoke various site access permissions for a user and adjust some limits. Round accesses are managed from the user's statistics page.") . "</p>";
show_username_form($username);
if ($username) {
    try {
        $user = new User($username);
    } catch (NonexistentUserException $exception) {
        echo "<p class='error'>" . _("Invalid username") . "</p>";
        exit;
    }
    $user_settings =& Settings::get_settings($username);
    echo "<hr>";
    echo "<h2>{$username} ({$user->real_name})</h2>";
    if ($action == "update") {
        update_settings($username, $user_settings);
    } else {
        show_toggles_form($username, $user_settings);
    }
}
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
function show_username_form($username)
{
    echo "<form method='GET'>\n";
    echo "<p>" . _("Username") . ": ";
    echo "<input name='username' type='text' value='{$username}' size='20'>\n";
    echo "</p>";
function get_access_mode($username)
{
    $userSettings =& Settings::get_settings($username);
    return $userSettings->get_value("remote_file_manager");
}
Example #5
0
 function index()
 {
     // Articles
     $articles = $this->article_model->get_lang_list(array('order_by' => 'updated DESC'), Settings::get_lang('default'));
     // Last 10 articles
     $last_articles = array();
     $max = count($articles) > 9 ? 10 : count($articles);
     $count = 0;
     if (!empty($articles)) {
         foreach ($articles as $article) {
             if (Authority::can('access', 'backend/menu/' . $article['id_menu'], NULL, TRUE) && Authority::can('access', 'backend/page/' . $article['id_page'], NULL, TRUE) && Authority::can('access', 'backend/article/' . $article['id_article'], NULL, TRUE)) {
                 $last_articles[] = $article;
                 $count++;
                 if ($count == $max) {
                     break;
                 }
             }
         }
     }
     // Orphan articles
     $orphan_articles = array();
     foreach ($articles as $article) {
         if (!$article['id_page']) {
             $orphan_articles[] = $article;
         }
     }
     // Orphan pages
     $orphan_pages = $this->page_model->get_lang_list(array('id_menu' => '0', 'order_by' => 'name ASC'), Settings::get_lang('default'));
     // Last connected /registered users
     $logged_user_role = User()->get_role();
     $users = $this->user_model->get_list_with_role(array('limit' => '10', 'order_by' => 'last_visit DESC', 'last_visit <>' => ''));
     $last_registered_users = $this->user_model->get_list_with_role(array('limit' => '10', 'order_by' => 'join_date DESC'));
     // Updates on last articles
     foreach ($last_articles as &$article) {
         // User name update
         foreach ($users as $user) {
             if ($user['username'] == $article['updater']) {
                 $article['updater'] = $user['screen_name'];
             }
             if ($user['username'] == $article['author']) {
                 $article['author'] = $user['screen_name'];
             }
         }
         $pages = $this->page_model->get_parent_array($article['id_page'], array(), Settings::get_lang('default'));
         $breadcrumb = array();
         foreach ($pages as $page) {
             $breadcrumb[] = !empty($page['title']) ? $page['title'] : $page['name'];
         }
         $article['breadcrumb'] = implode(' > ', $breadcrumb);
     }
     // Updates on orphan pages
     foreach ($orphan_pages as &$page) {
         // User name update
         foreach ($users as $user) {
             if ($user['username'] == $page['updater']) {
                 $page['updater'] = $user['screen_name'];
             }
             if ($user['username'] == $page['author']) {
                 $page['author'] = $user['screen_name'];
             }
         }
     }
     // Updates on orphan articles
     foreach ($orphan_articles as &$article) {
         // User name update
         foreach ($users as $user) {
             if ($user['username'] == $article['updater']) {
                 $article['updater'] = $user['screen_name'];
             }
             if ($user['username'] == $article['author']) {
                 $article['author'] = $user['screen_name'];
             }
         }
     }
     // Flags
     $settings = Settings::get_settings();
     $flags = array();
     foreach ($settings as $key => $setting) {
         if (strpos($key, 'flag') !== FALSE && $setting != '') {
             $flags[substr($key, -1)] = $setting;
         }
     }
     // Put installed module list to template
     $installed_modules = Modules()->get_installed_modules();
     $modules = array();
     foreach ($installed_modules as $module) {
         if ($module['has_admin'] && Authority::can('access', 'module/' . $module['key'])) {
             $modules[] = $module;
         }
     }
     $this->template['modules'] = $modules;
     $this->template['flags'] = $flags;
     $this->template['last_articles'] = $last_articles;
     $this->template['orphan_pages'] = $orphan_pages;
     $this->template['orphan_articles'] = $orphan_articles;
     $this->template['users'] = $users;
     $this->template['last_registered_users'] = $last_registered_users;
     $this->output('desktop/dashboard');
 }
Example #6
0
/**
 * Ionize Content Management system
 * Javascript Settings Class
 *
 * Put in the Settings object all Ionize Settings
 * so they will be available to javascript
 *
 * @package		Ionize
 * @author		Partikule
 * @copyright	Copyright (c) 2013, Partikule
 * @category	Javascript
 * @since		Version 1.0
 * @link		http://www.partikule.net
 *
 */
$settings = json_encode(Settings::get_settings());
?>
var Settings = {
	'setting' : JSON.decode(<?php 
echo json_encode($settings);
?>
, true)
}
Object.append(Settings, {
	get: function(key)
	{
		return this.setting[key];
	}
});