コード例 #1
0
ファイル: prefs.php プロジェクト: hurcane/tiki-azure
function initialize_prefs()
{
    global $prefs, $user_overrider_prefs, $in_installer, $section, $systemConfiguration;
    if (defined('TIKI_IN_INSTALLER') || defined('TIKI_IN_TEST')) {
        $prefs = get_default_prefs();
        return;
    }
    $cachelib = TikiLib::lib('cache');
    if ($cachelib->isCached('global_preferences')) {
        $prefs = $cachelib->getSerialized('global_preferences');
    } else {
        $defaults = get_default_prefs();
        // Find which preferences need to be serialized/unserialized, based on the default
        //  values (those with arrays as values) and preferences with special serializations
        $serializedPreferences = array();
        global $prefslib;
        require_once 'lib/prefslib.php';
        foreach ($defaults as $preference => $value) {
            if (is_array($value) || in_array($preference, array('category_defaults', 'memcache_servers'))) {
                $serializedPreferences[] = $preference;
            }
        }
        $tikilib = TikiLib::lib("tiki");
        if (method_exists($tikilib, "getModifiedPreferences")) {
            $modified = TikiLib::lib("tiki")->getModifiedPreferences();
        } else {
            $modified = array();
        }
        // Unserialize serialized preferences
        foreach ($serializedPreferences as $serializedPreference) {
            if (isset($modified[$serializedPreference]) && !is_array($modified[$serializedPreference])) {
                $modified[$serializedPreference] = unserialize($modified[$serializedPreference]);
            }
        }
        // Keep some useful sites values available before overriding with user prefs
        // (they could be used in templates, so we need to set them even for Anonymous)
        foreach ($user_overrider_prefs as $uop) {
            if (isset($modified[$uop])) {
                $modified['site_' . $uop] = $modified[$uop];
            } elseif (isset($defaults[$uop])) {
                $modified['site_' . $uop] = $defaults[$uop];
            }
        }
        $prefs = $modified + $defaults;
        $cachelib->cacheItem('global_preferences', serialize($prefs));
    }
    if ($prefs['feature_perspective'] == 'y') {
        if (!isset($section) || $section != 'admin') {
            global $perspectivelib;
            require_once 'lib/perspectivelib.php';
            if ($persp = $perspectivelib->get_current_perspective($prefs)) {
                $perspectivePreferences = $perspectivelib->get_preferences($persp);
                $prefs = $perspectivePreferences + $prefs;
            }
        }
    }
    // Override preferences with system-configured preferences.
    $prefs = $systemConfiguration->preference->toArray() + $prefs;
}
コード例 #2
0
ファイル: update_routines.php プロジェクト: hgz5w/e107
function update_core_prefs($type = '')
{
    global $e107info;
    // $pref,  $pref must be kept as global
    $pref = e107::getConfig('core', true, true)->getPref();
    $admin_log = e107::getAdminLog();
    $do_save = FALSE;
    $should = get_default_prefs();
    $just_check = $type == 'do' ? FALSE : TRUE;
    // TRUE if we're just seeing if an update is needed
    foreach ($should as $k => $v) {
        if ($k && !array_key_exists($k, $pref)) {
            if ($just_check) {
                return update_needed('Missing pref: ' . $k);
            }
            $pref[$k] = $v;
            $admin_log->logMessage($k . ' => ' . $v, E_MESSAGE_NODISPLAY, E_MESSAGE_INFO);
            $do_save = TRUE;
        }
    }
    if ($do_save) {
        //save_prefs();
        e107::getConfig('core')->setPref($pref)->save();
        $admin_log->logMessage(LAN_UPDATE_14 . $e107info['e107_version'], E_MESSAGE_NODISPLAY, E_MESSAGE_INFO);
        $admin_log->flushMessages('UPDATE_03', E_LOG_INFORMATIVE);
        //e107::getLog()->add('UPDATE_03',LAN_UPDATE_14.$e107info['e107_version'].'[!br!]'.implode(', ',$accum),E_LOG_INFORMATIVE,'');	// Log result of actual update
    }
    return $just_check;
}
コード例 #3
0
ファイル: tikilib.php プロジェクト: rjsmelo/tiki
 /**
  * @return array
  */
 function getModifiedPreferences()
 {
     $defaults = get_default_prefs();
     $modified = array();
     $results = $this->table('tiki_preferences')->fetchAll(array('name', 'value'), array());
     foreach ($results as $result) {
         $name = $result['name'];
         $value = $result['value'];
         $strDef = "";
         if (isset($defaults[$name]) && is_array($defaults[$name])) {
             $strDef = implode(" ", $defaults[$name]);
         } else {
             $strDef = isset($defaults[$name]) ? $defaults[$name] : "";
         }
         if (empty($strDef) || $strDef != (string) $value) {
             $modified[$name] = $value;
         }
     }
     return $modified;
 }
コード例 #4
0
ファイル: ks_prefreport.php プロジェクト: hurcane/tiki-azure
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id: ks_prefreport.php 44444 2013-01-05 21:24:24Z changi67 $
// outputs the prefreport as a pipe delimited file
// Usage: From the command line:
// php doc/devtools/prefreport.php
// resulting file can be found at dump/prefreport.txt
//
// also check out  doc/devtools/securitycheck.php to see in which files are
// used each pref (and permission name too)
//
$ourFileName = "dump/prefreport.txt";
require_once 'tiki-setup.php';
require_once 'lib/prefslib.php';
$defaultValues = get_default_prefs();
$fields = array('preference' => '', 'name' => '', 'description' => '', 'default' => '', 'help' => '', 'hard_to_search' => false, 'duplicate_name' => 0, 'duplicate_description' => 0, 'word_count' => 0, 'filter' => '', 'locations' => '', 'dependencies' => '', 'type' => '', 'options' => '', 'admin' => '', 'module' => '', 'view' => '', 'permission' => '', 'plugin' => '', 'extensions' => '', 'tags' => '', 'parameters' => '', 'detail' => '', 'warning' => '', 'hint' => '', 'shorthint' => '', 'perspective' => '', 'separator' => '');
$stopWords = array('', 'in', 'and', 'a', 'to', 'be', 'of', 'on', 'the', 'for', 'as', 'it', 'or', 'with', 'by', 'is', 'an');
$data = array();
error_reporting(E_ALL);
ini_set('display_errors', 'on');
$data = collect_raw_data($fields);
remove_fake_descriptions($data);
set_default_values($data, $defaultValues);
collect_locations($data);
$index = array('name' => index_data($data, 'name'), 'description' => index_data($data, 'description'));
update_search_flag($data, $index, $stopWords);
$ourFileHandle = fopen($ourFileName, 'w+') or die("can't open file");
// Output results
fputcsv($ourFileHandle, array_keys($fields), '|');
foreach ($data as $values) {
コード例 #5
0
ファイル: prefslib.php プロジェクト: ameoba32/tiki
 function getModifiedPrefsForExport($added = false)
 {
     $tikilib = TikiLib::lib('tiki');
     $prefs = $tikilib->getModifiedPreferences();
     $defaults = get_default_prefs();
     $modified = array();
     foreach ($prefs as $pref => $value) {
         if ($added && !isset($defaults[$pref]) || isset($defaults[$pref]) && $value !== $defaults[$pref]) {
             if (!in_array($pref, $this->system_modified) && !in_array($pref, $this->system_info)) {
                 // prefs modified by the system and with system info etc
                 $preferenceInformation = $this->getPreference($pref);
                 $modified[$pref] = array('current' => array('serial' => $value, 'expanded' => $preferenceInformation['value']));
                 if (isset($defaults[$pref])) {
                     $modified[$pref]['default'] = $defaults[$pref];
                 }
             }
         }
     }
     ksort($modified);
     return $modified;
 }
コード例 #6
0
ファイル: data.php プロジェクト: bgarrels/textpattern
 function txp_prefs_table()
 {
     $table = new txp_prefs_table();
     # Default to messy URLs if we know clean ones won't work
     $permlink_mode = 'section_id_title';
     if (is_callable('apache_get_modules')) {
         $modules = apache_get_modules();
         if (!in_array('mod_rewrite', $modules)) {
             $permlink_mode = 'messy';
         }
     } else {
         $server_software = @$_SERVER['SERVER_SOFTWARE'] || @$_SERVER['HTTP_HOST'] ? @$_SERVER['SERVER_SOFTWARE'] ? @$_SERVER['SERVER_SOFTWARE'] : $_SERVER['HTTP_HOST'] : '';
         if (!stristr($server_software, 'Apache')) {
             $permlink_mode = 'messy';
         }
     }
     $setup_comment_invite = addslashes(gTxt('setup_comment_invite') == 'setup_comment_invite' ? 'Comment' : gTxt('setup_comment_invite'));
     require_once txpath . '/lib/txplib_prefs.php';
     $prefs = get_default_prefs();
     $prefs['blog_uid'] = md5(uniqid(rand(), true));
     /*		echo '<pre>';
     		echo var_dump($prefs);
     		echo '</pre>';*/
     $preferences = array();
     # public prefs:
     $preferences[] = array('name' => 'sitename', 'val' => gTxt('my_site'), 'type' => 0, 'event' => 'publish', 'html' => 'text_input', 'position' => 10);
     $preferences[] = array('name' => 'siteurl', 'val' => 'comment.local', 'type' => 0, 'event' => 'publish', 'html' => 'text_input', 'position' => 20);
     $preferences[] = array('name' => 'site_slogan', 'val' => gTxt('my_slogan'), 'type' => 0, 'event' => 'publish', 'html' => 'text_input', 'position' => 30);
     $preferences[] = array('name' => 'is_dst', 'val' => '0', 'type' => 0, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 60);
     $preferences[] = array('name' => 'dateformat', 'val' => 'since', 'type' => 0, 'event' => 'publish', 'html' => 'dateformats', 'position' => 70);
     $preferences[] = array('name' => 'archive_dateformat', 'val' => '%b %d, %I:%M %p', 'type' => 0, 'event' => 'publish', 'html' => 'dateformats', 'position' => 80);
     $preferences[] = array('name' => 'permlink_mode', 'val' => $permlink_mode, 'type' => 0, 'event' => 'publish', 'html' => 'permlinkmodes', 'position' => 90);
     $preferences[] = array('name' => 'logging', 'val' => 'all', 'type' => 0, 'event' => 'publish', 'html' => 'logging', 'position' => 100);
     $preferences[] = array('name' => 'use_textile', 'val' => '2', 'type' => 0, 'event' => 'publish', 'html' => 'pref_text', 'position' => 110);
     $preferences[] = array('name' => 'use_comments', 'val' => '1', 'type' => 0, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 120);
     $preferences[] = array('name' => 'production_status', 'val' => 'testing', 'type' => 0, 'event' => 'publish', 'html' => 'prod_levels', 'position' => 210);
     # public comments prefs:
     $preferences[] = array('name' => 'comments_moderate', 'val' => '1', 'type' => 0, 'event' => 'comments', 'html' => 'yesnoradio', 'position' => 130);
     $preferences[] = array('name' => 'comments_on_default', 'val' => '0', 'type' => 0, 'event' => 'comments', 'html' => 'yesnoradio', 'position' => 140);
     $preferences[] = array('name' => 'comments_are_ol', 'val' => '1', 'type' => 0, 'event' => 'comments', 'html' => 'yesnoradio', 'position' => 150);
     $preferences[] = array('name' => 'comments_sendmail', 'val' => '0', 'type' => 0, 'event' => 'comments', 'html' => 'yesnoradio', 'position' => 160);
     $preferences[] = array('name' => 'comments_disallow_images', 'val' => '0', 'type' => 0, 'event' => 'comments', 'html' => 'yesnoradio', 'position' => 170);
     $preferences[] = array('name' => 'comments_default_invite', 'val' => $setup_comment_invite, 'type' => 0, 'event' => 'comments', 'html' => 'text_input', 'position' => 180);
     $preferences[] = array('name' => 'comments_dateformat', 'val' => '%b %d, %I:%M %p', 'type' => 0, 'event' => 'comments', 'html' => 'dateformats', 'position' => 190);
     $preferences[] = array('name' => 'comments_mode', 'val' => '0', 'type' => 0, 'event' => 'comments', 'html' => 'commentmode', 'position' => 200);
     $preferences[] = array('name' => 'comments_disabled_after', 'val' => '42', 'type' => 0, 'event' => 'comments', 'html' => 'weeks', 'position' => 210);
     $preferences[] = array('name' => 'comments_auto_append', 'val' => '1', 'type' => 0, 'event' => 'comments', 'html' => 'yesnoradio', 'position' => 211);
     # admin prefs:
     $preferences[] = array('name' => 'ping_weblogsdotcom', 'val' => '0', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'rss_how_many', 'val' => '5', 'type' => 1, 'event' => 'admin', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'send_lastmod', 'val' => '0', 'type' => 1, 'event' => 'admin', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'img_dir', 'val' => 'images', 'type' => 1, 'event' => 'admin', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'file_max_upload_size', 'val' => '2000000', 'type' => 1, 'event' => 'admin', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'tempdir', 'val' => find_temp_dir(), 'type' => 1, 'event' => 'admin', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'file_base_path', 'val' => dirname(txpath) . DS . 'files', 'type' => 1, 'event' => 'admin', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'edit_raw_css_by_default', 'val' => '1', 'type' => 1, 'event' => 'css', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'allow_page_php_scripting', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'allow_article_php_scripting', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'allow_raw_php_scripting', 'val' => '0', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'textile_links', 'val' => '0', 'type' => 1, 'event' => 'link', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'show_comment_count_in_feed', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'syndicate_body_or_excerpt', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'include_email_atom', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'comment_means_site_updated', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'never_display_email', 'val' => '0', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'comments_require_name', 'val' => '1', 'type' => 1, 'event' => 'comments', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'comments_require_email', 'val' => '1', 'type' => 1, 'event' => 'comments', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'articles_use_excerpts', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'allow_form_override', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'attach_titles_to_permalinks', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'permalink_title_format', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'expire_logs_after', 'val' => '7', 'type' => 1, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'use_plugins', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'custom_1_set', 'val' => 'custom1', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 1);
     $preferences[] = array('name' => 'custom_2_set', 'val' => 'custom2', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 2);
     $preferences[] = array('name' => 'custom_3_set', 'val' => '', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 3);
     $preferences[] = array('name' => 'custom_4_set', 'val' => '', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 4);
     $preferences[] = array('name' => 'custom_5_set', 'val' => '', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 5);
     $preferences[] = array('name' => 'custom_6_set', 'val' => '', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 6);
     $preferences[] = array('name' => 'custom_7_set', 'val' => '', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 7);
     $preferences[] = array('name' => 'custom_8_set', 'val' => '', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 8);
     $preferences[] = array('name' => 'custom_9_set', 'val' => '', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 9);
     $preferences[] = array('name' => 'custom_10_set', 'val' => '', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 10);
     $preferences[] = array('name' => 'ping_textpattern_com', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'use_dns', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'admin_side_plugins', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'comment_nofollow', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'use_mail_on_feeds_id', 'val' => '0', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'max_url_len', 'val' => '200', 'type' => 1, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'spam_blacklists', 'val' => 'sbl.spamhaus.org', 'type' => 1, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'override_emailcharset', 'val' => '0', 'type' => 1, 'event' => 'admin', 'html' => 'yesnoradio', 'position' => 21);
     # hidden prefs:
     $preferences[] = array('name' => 'prefs_id', 'val' => '1', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'use_categories', 'val' => '1', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'use_sections', 'val' => '1', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'language', 'val' => 'en-gb', 'type' => 2, 'event' => 'publish', 'html' => 'languages', 'position' => 40);
     $preferences[] = array('name' => 'url_mode', 'val' => '1', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'timeoffset', 'val' => '0', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'lastmod', 'val' => '2005-07-23 16:24:10', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'file_list_pageby', 'val' => '25', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'path_to_site', 'val' => '', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'article_list_pageby', 'val' => '25', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'link_list_pageby', 'val' => '25', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'image_list_pageby', 'val' => '25', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'log_list_pageby', 'val' => '25', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'comment_list_pageby', 'val' => '25', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'locale', 'val' => 'en_GB.UTF-8', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'blog_uid', 'val' => $prefs['blog_uid'], 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'blog_mail_uid', 'val' => $_POST['email'], 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'blog_time_uid', 'val' => '2005', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'show_article_category_count', 'val' => '1', 'type' => 2, 'event' => 'category', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'dbupdatetime', 'val' => '1122194504', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'version', 'val' => '1.0rc4', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     foreach ($preferences as $preference) {
         if (!$table->row(array('name' => $preference['name']))) {
             $table->insert($preference);
         }
     }
 }
コード例 #7
0
ファイル: txplib_prefs.php プロジェクト: bgarrels/textpattern
function get_prefs()
{
    return array_merge(get_default_prefs(), get_db_prefs(), get_local_prefs());
}
コード例 #8
0
ファイル: tikilib.php プロジェクト: railfuture/tiki-website
	function getModifiedPreferences()
	{
		$defaults = get_default_prefs();
		$modified = array();

		$results = $this->table('tiki_preferences')->fetchAll(array('name', 'value'), array());

		foreach ( $results as $result ) {
			$name = $result['name'];
			$value = $result['value'];

			if ( !isset($defaults[$name]) || (string) $defaults[$name] != (string) $value )
				$modified[$name] = $value;
		}
		return $modified;
	}