Esempio n. 1
0
function module_pref_prefs($link)
{
    global $access_level_names;
    $subop = $_REQUEST["subop"];
    $prefs_blacklist = array("HIDE_FEEDLIST", "SYNC_COUNTERS", "ENABLE_LABELS", "ENABLE_SEARCH_TOOLBAR", "HIDE_READ_FEEDS");
    $profile_blacklist = array("ALLOW_DUPLICATE_POSTS", "PURGE_OLD_DAYS", "PURGE_UNREAD_ARTICLES", "DIGEST_ENABLE", "DIGEST_CATCHUP", "BLACKLISTED_TAGS", "ENABLE_FEED_ICONS", "ENABLE_API_ACCESS", "UPDATE_POST_ON_CHECKSUM_CHANGE", "DEFAULT_UPDATE_INTERVAL", "MARK_UNREAD_ON_UPDATE");
    if (FORCE_ARTICLE_PURGE != 0) {
        array_push($prefs_blacklist, "PURGE_OLD_DAYS");
        array_push($prefs_blacklist, "PURGE_UNREAD_ARTICLES");
    }
    if ($subop == "change-password") {
        $old_pw = $_POST["OLD_PASSWORD"];
        $new_pw = $_POST["NEW_PASSWORD"];
        $con_pw = $_POST["CONFIRM_PASSWORD"];
        if ($old_pw == "") {
            print "ERROR: " . __("Old password cannot be blank.");
            return;
        }
        if ($new_pw == "") {
            print "ERROR: " . __("New password cannot be blank.");
            return;
        }
        if ($new_pw != $con_pw) {
            print "ERROR: " . __("Entered passwords do not match.");
            return;
        }
        $old_pw_hash1 = encrypt_password($_POST["OLD_PASSWORD"]);
        $old_pw_hash2 = encrypt_password($_POST["OLD_PASSWORD"], $_SESSION["name"]);
        $new_pw_hash = encrypt_password($_POST["NEW_PASSWORD"], $_SESSION["name"]);
        $active_uid = $_SESSION["uid"];
        if ($old_pw && $new_pw) {
            $login = db_escape_string($_SERVER['PHP_AUTH_USER']);
            $result = db_query($link, "SELECT id FROM ttrss_users WHERE \n\t\t\t\t\tid = '{$active_uid}' AND (pwd_hash = '{$old_pw_hash1}' OR \n\t\t\t\t\t\tpwd_hash = '{$old_pw_hash2}')");
            if (db_num_rows($result) == 1) {
                db_query($link, "UPDATE ttrss_users SET pwd_hash = '{$new_pw_hash}' \n\t\t\t\t\t\tWHERE id = '{$active_uid}'");
                $_SESSION["pwd_hash"] = $new_pw_hash;
                print __("Password has been changed.");
            } else {
                print "ERROR: " . __('Old password is incorrect.');
            }
        }
        return;
    } else {
        if ($subop == "save-config") {
            #			$_SESSION["prefs_op_result"] = "save-config";
            $_SESSION["prefs_cache"] = false;
            //			print_r($_POST);
            $orig_theme = get_pref($link, "_THEME_ID");
            foreach (array_keys($_POST) as $pref_name) {
                $pref_name = db_escape_string($pref_name);
                $value = db_escape_string($_POST[$pref_name]);
                set_pref($link, $pref_name, $value);
            }
            if ($orig_theme != get_pref($link, "_THEME_ID")) {
                print "PREFS_THEME_CHANGED";
            } else {
                print __("The configuration was saved.");
            }
            return;
        } else {
            if ($subop == "getHelp") {
                $pref_name = db_escape_string($_REQUEST["pn"]);
                $result = db_query($link, "SELECT help_text FROM ttrss_prefs\n\t\t\t\tWHERE pref_name = '{$pref_name}'");
                if (db_num_rows($result) > 0) {
                    $help_text = db_fetch_result($result, 0, "help_text");
                    print $help_text;
                } else {
                    printf(__("Unknown option: %s"), $pref_name);
                }
            } else {
                if ($subop == "change-email") {
                    $email = db_escape_string($_POST["email"]);
                    $active_uid = $_SESSION["uid"];
                    db_query($link, "UPDATE ttrss_users SET email = '{$email}' \n\t\t\t\tWHERE id = '{$active_uid}'");
                    print __("E-mail has been changed.");
                    return;
                } else {
                    if ($subop == "reset-config") {
                        $_SESSION["prefs_op_result"] = "reset-to-defaults";
                        if ($_SESSION["profile"]) {
                            $profile_qpart = "profile = '" . $_SESSION["profile"] . "'";
                        } else {
                            $profile_qpart = "profile IS NULL";
                        }
                        db_query($link, "DELETE FROM ttrss_user_prefs \n\t\t\t\tWHERE {$profile_qpart} AND owner_uid = " . $_SESSION["uid"]);
                        initialize_user_prefs($link, $_SESSION["uid"], $_SESSION["profile"]);
                        print "PREFS_THEME_CHANGED";
                        //			print __("The configuration was reset to defaults.");
                        return;
                    } else {
                        set_pref($link, "_PREFS_ACTIVE_TAB", "genConfig");
                        if ($_SESSION["profile"]) {
                            print_notice("Some preferences are only available in default profile.");
                        }
                        if (!SINGLE_USER_MODE) {
                            $result = db_query($link, "SELECT id FROM ttrss_users\n\t\t\t\t\tWHERE id = " . $_SESSION["uid"] . " AND pwd_hash \n\t\t\t\t\t= 'SHA1:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8'");
                            if (db_num_rows($result) != 0) {
                                print format_warning(__("Your password is at default value, \n\t\t\t\t\t\tplease change it."), "default_pass_warning");
                            }
                            /*				if ($_SESSION["pwd_change_result"] == "failed") {
                            					print format_warning("Could not change the password.");
                            				}
                            
                            				if ($_SESSION["pwd_change_result"] == "ok") {
                            					print format_notice("Password was changed.");
                            				}
                            
                            				$_SESSION["pwd_change_result"] = ""; */
                            /*				if ($_SESSION["prefs_op_result"] == "reset-to-defaults") {
                            					print format_notice(__("The configuration was reset to defaults."));
                            } */
                            #				if ($_SESSION["prefs_op_result"] == "save-config") {
                            #					print format_notice(__("The configuration was saved."));
                            #				}
                            $_SESSION["prefs_op_result"] = "";
                            print "<form onsubmit='return false' id='change_email_form'>";
                            print "<table width=\"100%\" class=\"prefPrefsList\">";
                            print "<tr><td colspan='3'><h3>" . __("Personal data") . "</h3></tr></td>";
                            $result = db_query($link, "SELECT email,access_level FROM ttrss_users\n\t\t\t\t\tWHERE id = " . $_SESSION["uid"]);
                            $email = db_fetch_result($result, 0, "email");
                            print "<tr><td width=\"40%\">" . __('E-mail') . "</td>";
                            print "<td class=\"prefValue\"><input class=\"editbox\" name=\"email\" \n\t\t\t\t\tonfocus=\"javascript:disableHotkeys();\" \n\t\t\t\t\tonblur=\"javascript:enableHotkeys();\"\n\t\t\t\t\tonkeypress=\"return filterCR(event, changeUserEmail)\"\n\t\t\t\t\tvalue=\"{$email}\"></td></tr>";
                            if (!SINGLE_USER_MODE) {
                                $access_level = db_fetch_result($result, 0, "access_level");
                                print "<tr><td width=\"40%\">" . __('Access level') . "</td>";
                                print "<td>" . $access_level_names[$access_level] . "</td></tr>";
                            }
                            print "</table>";
                            print "<input type=\"hidden\" name=\"op\" value=\"pref-prefs\">";
                            print "<input type=\"hidden\" name=\"subop\" value=\"change-email\">";
                            print "</form>";
                            print "<p><button onclick=\"return changeUserEmail()\">" . __("Change e-mail") . "</button>";
                            print "<form onsubmit=\"return false\" \n\t\t\t\t\tname=\"change_pass_form\" id=\"change_pass_form\">";
                            print "<table width=\"100%\" class=\"prefPrefsList\">";
                            print "<tr><td colspan='3'><h3>" . __("Authentication") . "</h3></tr></td>";
                            print "<tr><td width=\"40%\">" . __("Old password") . "</td>";
                            print "<td class=\"prefValue\"><input class=\"editbox\" type=\"password\"\n\t\t\t\t\tonfocus=\"javascript:disableHotkeys();\" \n\t\t\t\t\tonblur=\"javascript:enableHotkeys();\"\n\t\t\t\t\tonkeypress=\"return filterCR(event, changeUserPassword)\"\n\t\t\t\t\tname=\"OLD_PASSWORD\"></td></tr>";
                            print "<tr><td width=\"40%\">" . __("New password") . "</td>";
                            print "<td class=\"prefValue\"><input class=\"editbox\" type=\"password\"\n\t\t\t\t\tonfocus=\"javascript:disableHotkeys();\" \n\t\t\t\t\tonblur=\"javascript:enableHotkeys();\"\n\t\t\t\t\tonkeypress=\"return filterCR(event, changeUserPassword)\"\n\t\t\t\t\tname=\"NEW_PASSWORD\"></td></tr>";
                            print "<tr><td width=\"40%\">" . __("Confirm password") . "</td>";
                            print "<td class=\"prefValue\"><input class=\"editbox\" type=\"password\"\n\t\t\t\t\tonfocus=\"javascript:disableHotkeys();\" \n\t\t\t\t\tonblur=\"javascript:enableHotkeys();\"\n\t\t\t\t\tonkeypress=\"return filterCR(event, changeUserPassword)\"\n\t\t\t\t\tname=\"CONFIRM_PASSWORD\"></td></tr>";
                            print "</table>";
                            print "<input type=\"hidden\" name=\"op\" value=\"pref-prefs\">";
                            print "<input type=\"hidden\" name=\"subop\" value=\"change-password\">";
                            print "</form>";
                            print "<p><button\tonclick=\"return changeUserPassword()\">" . __("Change password") . "</button>";
                        }
                        if ($_SESSION["profile"]) {
                            initialize_user_prefs($link, $_SESSION["uid"], $_SESSION["profile"]);
                            $profile_qpart = "profile = '" . $_SESSION["profile"] . "'";
                        } else {
                            initialize_user_prefs($link, $_SESSION["uid"]);
                            $profile_qpart = "profile IS NULL";
                        }
                        $result = db_query($link, "SELECT \n\t\t\t\tttrss_user_prefs.pref_name,short_desc,help_text,value,type_name,\n\t\t\t\tsection_name,def_value,section_id\n\t\t\t\tFROM ttrss_prefs,ttrss_prefs_types,ttrss_prefs_sections,ttrss_user_prefs\n\t\t\t\tWHERE type_id = ttrss_prefs_types.id AND \n\t\t\t\t\t{$profile_qpart} AND\n\t\t\t\t\tsection_id = ttrss_prefs_sections.id AND\n\t\t\t\t\tttrss_user_prefs.pref_name = ttrss_prefs.pref_name AND\n\t\t\t\t\tshort_desc != '' AND\n\t\t\t\t\towner_uid = " . $_SESSION["uid"] . "\n\t\t\t\tORDER BY section_id,short_desc");
                        print "<form onsubmit='return false' action=\"backend.php\" \n\t\t\t\tmethod=\"POST\" id=\"pref_prefs_form\">";
                        $lnum = 0;
                        $active_section = "";
                        while ($line = db_fetch_assoc($result)) {
                            if (in_array($line["pref_name"], $prefs_blacklist)) {
                                continue;
                            }
                            if ($_SESSION["profile"] && in_array($line["pref_name"], $profile_blacklist)) {
                                continue;
                            }
                            if ($active_section != $line["section_name"]) {
                                if ($active_section != "") {
                                    print "</table>";
                                }
                                print "<p><table width=\"100%\" class=\"prefPrefsList\">";
                                $active_section = $line["section_name"];
                                print "<tr><td colspan=\"3\"><h3>" . __($active_section) . "</h3></td></tr>";
                                if ($line["section_id"] == 2) {
                                    print "<tr><td width=\"40%\">" . __("Select theme") . "</td>";
                                    $user_theme = get_pref($link, "_THEME_ID");
                                    $themes = get_all_themes();
                                    print "<td><select name=\"_THEME_ID\">";
                                    print "<option value=''>" . __('Default') . "</option>";
                                    print "<option disabled>--------</option>";
                                    foreach ($themes as $t) {
                                        $base = $t['base'];
                                        $name = $t['name'];
                                        if ($base == $user_theme) {
                                            $selected = "selected=\"1\"";
                                        } else {
                                            $selected = "";
                                        }
                                        print "<option {$selected} value='{$base}'>{$name}</option>";
                                    }
                                    print "</select></td></tr>";
                                }
                                //					print "<tr class=\"title\">
                                //						<td width=\"25%\">Option</td><td>Value</td></tr>";
                                $lnum = 0;
                            }
                            //				$class = ($lnum % 2) ? "even" : "odd";
                            print "<tr>";
                            $type_name = $line["type_name"];
                            $pref_name = $line["pref_name"];
                            $value = $line["value"];
                            $def_value = $line["def_value"];
                            $help_text = $line["help_text"];
                            print "<td width=\"40%\" class=\"prefName\" id=\"{$pref_name}\">" . __($line["short_desc"]);
                            if ($help_text) {
                                print "<div class=\"prefHelp\">" . __($help_text) . "</div>";
                            }
                            print "</td>";
                            print "<td class=\"prefValue\">";
                            if ($pref_name == "DEFAULT_UPDATE_INTERVAL") {
                                global $update_intervals_nodefault;
                                print_select_hash($pref_name, $value, $update_intervals_nodefault);
                            } else {
                                if ($type_name == "bool") {
                                    //					print_select($pref_name, $value, array("true", "false"));
                                    if ($value == "true") {
                                        $value = __("Yes");
                                    } else {
                                        $value = __("No");
                                    }
                                    print_radio($pref_name, $value, __("Yes"), array(__("Yes"), __("No")));
                                } else {
                                    print "<input class=\"editbox\"\n\t\t\t\t\t\tonfocus=\"javascript:disableHotkeys();\" \n\t\t\t\t\t\tonblur=\"javascript:enableHotkeys();\"  \n\t\t\t\t\t\tname=\"{$pref_name}\" value=\"{$value}\">";
                                }
                            }
                            print "</td>";
                            print "</tr>";
                            $lnum++;
                        }
                        print "</table>";
                        print "<input type=\"hidden\" name=\"op\" value=\"pref-prefs\">";
                        print "<p><button onclick=\"return validatePrefsSave()\">" . __('Save configuration') . "</button> ";
                        print "<button onclick=\"return editProfiles()\">" . __('Manage profiles') . "</button> ";
                        print "<button onclick=\"return validatePrefsReset()\">" . __('Reset to defaults') . "</button></p>";
                        print "</form>";
                    }
                }
            }
        }
    }
}
Esempio n. 2
0
 private function set_theme()
 {
     $theme = in_array($_POST['theme'], get_all_themes()) ? $_POST['theme'] : 'simple';
     $this->_model->query(sprintf(parse_tbprefix("UPDATE <sysvar> SET varvalue='%s' WHERE varname='theme'"), $theme));
 }
Esempio n. 3
0
 public function actionControl_panel()
 {
     global $gd_exist, $zip_support;
     is_admin();
     $current_tab = 'overview';
     $tabs_array = array('overview', 'siteset', 'message', 'ban_ip');
     $tabs_name_array = array(t('ACP_OVERVIEW'), t('ACP_CONFSET'), t('ACP_MANAGE_POST'), t('ACP_MANAGE_IP'));
     if (isset($_GET['subtab'])) {
         if (in_array($_GET['subtab'], $tabs_array)) {
             $current_tab = $_GET['subtab'];
         }
     }
     $themes = get_all_themes();
     $data = get_all_data(TRUE, false, TRUE, TRUE, false);
     $reply_data = $this->_model->queryAll(parse_tbprefix("SELECT * FROM <reply>"));
     $ban_ip_info = $this->_model->queryAll(parse_tbprefix("SELECT * FROM <badip>"));
     $nums = count($data);
     $reply_num = count($reply_data);
     if ($gd_exist) {
         $gd_info = gd_version();
         $gd_version = $gd_info ? $gd_info : '<font color="red">' . t('UNKNOWN') . '</font>';
     } else {
         $gd_version = '<font color="red">GD' . t('NOT_SUPPORT') . '</font>';
     }
     $register_globals = ini_get("register_globals") ? 'On' : 'Off';
     $magic_quotes_gpc = ini_get("magic_quotes_gpc") ? 'On' : 'Off';
     $languages = get_all_langs();
     $timezone_array = get_all_timezone();
     $this->render('admin', array('tabs_array' => $tabs_array, 'current_tab' => $current_tab, 'tabs_name_array' => $tabs_name_array, 'nums' => $nums, 'reply_num' => $reply_num, 'gd_version' => $gd_version, 'register_globals' => $register_globals, 'magic_quotes_gpc' => $magic_quotes_gpc, 'zip_support' => $zip_support, 'themes' => $themes, 'timezone_array' => $timezone_array, 'languages' => $languages, 'data' => $data, 'ban_ip_info' => $ban_ip_info));
 }
Esempio n. 4
0
 *
 */
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configsite/siteoptions');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'siteoptions');
require dirname(dirname(dirname(__FILE__))) . '/init.php';
require_once 'pieforms/pieform.php';
require_once 'searchlib.php';
require_once 'antispam.php';
require_once get_config('libroot') . 'activity.php';
define('TITLE', get_string('siteoptions', 'admin'));
$langoptions = get_languages();
$themeoptions = get_all_themes();
unset($themeoptions['custom']);
// Only available for institution configurable themes
$yesno = array(true => get_string('yes'), false => get_string('no'));
$searchpluginoptions = get_search_plugins();
$countries = getoptions_country();
$notificationelements = get_notification_settings_elements(null, true);
$spamtraps = available_spam_traps();
$siteoptionform = array('name' => 'siteoptions', 'jsform' => true, 'renderer' => 'div', 'plugintype' => 'core', 'pluginname' => 'admin', 'jssuccesscallback' => 'checkReload', 'elements' => array('sitesettings' => array('iconclass' => 'globe', 'type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('sitesettingslegend', 'admin'), 'elements' => array('sitename' => array('type' => 'text', 'title' => get_string('sitename', 'admin'), 'description' => get_string('sitenamedescription', 'admin'), 'defaultvalue' => get_config('sitename'), 'help' => true, 'disabled' => in_array('sitename', $OVERRIDDEN)), 'lang' => array('type' => 'select', 'title' => get_string('language', 'admin'), 'description' => get_string('sitelanguagedescription', 'admin'), 'defaultvalue' => get_config('lang'), 'collapseifoneoption' => true, 'options' => $langoptions, 'help' => true, 'disabled' => in_array('lang', $OVERRIDDEN)), 'country' => array('type' => 'select', 'title' => get_string('country', 'admin'), 'description' => get_string('sitecountrydescription', 'admin'), 'defaultvalue' => get_config('country'), 'options' => array('' => get_string('nocountryselected')) + $countries, 'help' => true, 'disabled' => in_array('country', $OVERRIDDEN)), 'theme' => array('type' => 'select', 'title' => get_string('theme'), 'description' => get_string('sitethemedescription', 'admin'), 'defaultvalue' => get_config('theme'), 'collapseifoneoption' => true, 'options' => $themeoptions, 'help' => true, 'disabled' => in_array('theme', $OVERRIDDEN)), 'dropdownmenu' => array('type' => 'switchbox', 'title' => get_string('dropdownmenu', 'admin'), 'description' => get_string('dropdownmenudescription1', 'admin'), 'defaultvalue' => get_config('dropdownmenu'), 'disabled' => in_array('dropdownmenu', $OVERRIDDEN)), 'homepageinfo' => array('type' => 'switchbox', 'title' => get_string('homepageinfo1', 'admin'), 'description' => get_string('homepageinfodescription2', 'admin'), 'defaultvalue' => get_config('homepageinfo'), 'disabled' => in_array('homepageinfo', $OVERRIDDEN)), 'registration_sendweeklyupdates' => array('type' => 'switchbox', 'title' => get_string('sendweeklyupdates', 'admin'), 'description' => get_string('sendweeklyupdatesdescription1', 'admin'), 'defaultvalue' => get_config('registration_sendweeklyupdates'), 'help' => true, 'disabled' => in_array('registration_sendweeklyupdates', $OVERRIDDEN)))), 'usersettings' => array('iconclass' => 'user', 'type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('usersettingslegend', 'admin'), 'elements' => array('userscanchooseviewthemes' => array('type' => 'switchbox', 'title' => get_string('userscanchooseviewthemes', 'admin'), 'description' => get_string('userscanchooseviewthemesdescription1', 'admin'), 'defaultvalue' => get_config('userscanchooseviewthemes'), 'disabled' => in_array('userscanchooseviewthemes', $OVERRIDDEN)), 'remoteavatars' => array('type' => 'switchbox', 'title' => get_string('remoteavatars', 'admin'), 'description' => get_string('remoteavatarsdescription1', 'admin'), 'defaultvalue' => get_config('remoteavatars'), 'help' => true, 'disabled' => in_array('remoteavatars', $OVERRIDDEN)), 'userscanhiderealnames' => array('type' => 'switchbox', 'title' => get_string('userscanhiderealnames', 'admin'), 'description' => get_string('userscanhiderealnamesdescription1', 'admin'), 'defaultvalue' => get_config('userscanhiderealnames'), 'disabled' => in_array('userscanhiderealnames', $OVERRIDDEN)), 'nousernames' => array('type' => 'switchbox', 'title' => get_string('nousernames', 'admin'), 'description' => get_string('nousernamesdescription1', 'admin'), 'defaultvalue' => get_config('nousernames'), 'disabled' => in_array('nousernames', $OVERRIDDEN)), 'searchuserspublic' => array('type' => 'switchbox', 'title' => get_string('searchuserspublic', 'admin'), 'description' => get_string('searchuserspublicdescription', 'admin'), 'defaultvalue' => get_config('searchuserspublic'), 'disabled' => in_array('searchuserspublic', $OVERRIDDEN)), 'anonymouscomments' => array('type' => 'switchbox', 'title' => get_string('anonymouscomments', 'admin'), 'description' => get_string('anonymouscommentsdescription1', 'admin'), 'defaultvalue' => get_config('anonymouscomments'), 'disabled' => in_array('anonymouscomments', $OVERRIDDEN)), 'loggedinprofileviewaccess' => array('type' => 'switchbox', 'title' => get_string('loggedinprofileviewaccess1', 'admin'), 'description' => get_string('loggedinprofileviewaccessdescription1', 'admin'), 'defaultvalue' => get_config('loggedinprofileviewaccess'), 'disabled' => in_array('loggedinprofileviewaccess', $OVERRIDDEN), 'help' => true), 'staffreports' => array('type' => 'switchbox', 'title' => get_string('staffuserreports', 'admin'), 'description' => get_string('staffuserreportsdescription1', 'admin'), 'defaultvalue' => get_config('staffreports'), 'disabled' => in_array('staffreports', $OVERRIDDEN)), 'staffstats' => array('type' => 'switchbox', 'title' => get_string('staffuserstats', 'admin'), 'description' => get_string('staffuserstatsdescription1', 'admin'), 'defaultvalue' => get_config('staffstats'), 'disabled' => in_array('staffstats', $OVERRIDDEN)), 'userscandisabledevicedetection' => array('type' => 'switchbox', 'title' => get_string('userscandisabledevicedetection', 'admin'), 'description' => get_string('userscandisabledevicedetectiondescription1', 'admin'), 'defaultvalue' => get_config('userscandisabledevicedetection'), 'disabled' => in_array('userscandisabledevicedetection', $OVERRIDDEN)), 'masqueradingreasonrequired' => array('type' => 'switchbox', 'title' => get_string('masqueradingreasonrequired', 'admin'), 'description' => get_string('masqueradingreasonrequireddescription3', 'admin'), 'defaultvalue' => get_config('masqueradingreasonrequired'), 'disabled' => in_array('masqueradingreasonrequired', $OVERRIDDEN)), 'masqueradingnotified' => array('type' => 'switchbox', 'title' => get_string('masqueradingnotified', 'admin'), 'description' => get_string('masqueradingnotifielddescription', 'admin'), 'defaultvalue' => get_config('masqueradingnotified'), 'disabled' => in_array('masqueradingnotified', $OVERRIDDEN)), 'showprogressbar' => array('type' => 'switchbox', 'title' => get_string('showprogressbar', 'admin'), 'description' => get_string('showprogressbardescription1', 'admin'), 'defaultvalue' => get_config('showprogressbar'), 'disabled' => in_array('showprogressbar', $OVERRIDDEN)), 'exporttoqueue' => array('type' => 'switchbox', 'title' => get_string('exporttoqueue', 'admin'), 'description' => get_string('exporttoqueuedescription2', 'admin'), 'defaultvalue' => get_config('exporttoqueue'), 'disabled' => in_array('exporttoqueue', $OVERRIDDEN)), 'defaultmultipleblogs' => array('type' => 'switchbox', 'title' => get_string('defaultmultipleblogs', 'admin'), 'description' => get_string('defaultmultipleblogsdescription1', 'admin'), 'defaultvalue' => get_config('defaultmultipleblogs'), 'disabled' => in_array('defaultmultipleblogs', $OVERRIDDEN)))), 'searchsettings' => array('iconclass' => 'search', 'type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('searchsettingslegend', 'admin'), 'elements' => array('searchplugin' => array('type' => 'select', 'title' => get_string('searchplugin', 'admin'), 'description' => get_string('searchplugindescription', 'admin'), 'defaultvalue' => get_config('searchplugin'), 'collapseifoneoption' => true, 'options' => $searchpluginoptions, 'help' => true, 'disabled' => in_array('searchplugin', $OVERRIDDEN)))), 'groupsettings' => array('iconclass' => 'users', 'type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('groupsettingslegend', 'admin'), 'elements' => array('creategroups' => array('type' => 'select', 'title' => get_string('whocancreategroups', 'admin'), 'description' => get_string('whocancreategroupsdescription', 'admin'), 'defaultvalue' => get_config('creategroups'), 'options' => array('admins' => get_string('adminsonly', 'admin'), 'staff' => get_string('adminsandstaffonly', 'admin'), 'all' => get_string('Everyone', 'admin')), 'disabled' => in_array('creategroups', $OVERRIDDEN)), 'createpublicgroups' => array('type' => 'select', 'title' => get_string('whocancreatepublicgroups', 'admin'), 'description' => get_string('whocancreatepublicgroupsdescription', 'admin'), 'defaultvalue' => get_config('createpublicgroups'), 'options' => array('admins' => get_string('adminsonly', 'admin'), 'all' => get_string('Everyone', 'admin')), 'help' => true, 'disabled' => in_array('createpublicgroups', $OVERRIDDEN)), 'allowgroupcategories' => array('type' => 'switchbox', 'title' => get_string('allowgroupcategories', 'admin'), 'description' => get_string('allowgroupcategoriesdescription1', 'admin'), 'defaultvalue' => get_config('allowgroupcategories'), 'disabled' => in_array('allowgroupcategories', $OVERRIDDEN)))), 'institutionsettings' => array('iconclass' => 'university', 'type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('institutionsettingslegend', 'admin'), 'elements' => array('requireregistrationconfirm' => array('type' => 'switchbox', 'title' => get_string('requireregistrationconfirm', 'admin'), 'description' => get_string('requireregistrationconfirmdescription1', 'admin'), 'defaultvalue' => get_config('requireregistrationconfirm')), 'usersallowedmultipleinstitutions' => array('type' => 'switchbox', 'title' => get_string('usersallowedmultipleinstitutions', 'admin'), 'description' => get_string('usersallowedmultipleinstitutionsdescription1', 'admin'), 'defaultvalue' => get_config('usersallowedmultipleinstitutions'), 'help' => true, 'disabled' => in_array('usersallowedmultipleinstitutions', $OVERRIDDEN)), 'institutionexpirynotification' => array('type' => 'expiry', 'title' => get_string('institutionexpirynotification', 'admin'), 'description' => get_string('institutionexpirynotificationdescriptioninfo', 'admin'), 'defaultvalue' => get_config('institutionexpirynotification'), 'help' => true, 'disabled' => in_array('institutionexpirynotification', $OVERRIDDEN), 'class' => 'double'), 'institutionautosuspend' => array('type' => 'switchbox', 'title' => get_string('institutionautosuspend', 'admin'), 'description' => get_string('institutionautosuspenddescription1', 'admin'), 'defaultvalue' => get_config('institutionautosuspend'), 'help' => true, 'disabled' => in_array('institutionautosuspend', $OVERRIDDEN)))), 'accountsettings' => array('iconclass' => 'clock-o', 'type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('accountsettingslegend', 'admin'), 'elements' => array('sessionlifetime' => array('type' => 'text', 'size' => 4, 'title' => get_string('sessionlifetime', 'admin'), 'description' => get_string('sessionlifetimedescription', 'admin'), 'defaultvalue' => get_config('session_timeout') / 60, 'rules' => array('integer' => true, 'minvalue' => 1, 'maxvalue' => 10000000), 'help' => true, 'disabled' => in_array('session_timeout', $OVERRIDDEN)), 'defaultregistrationexpirylifetime' => array('type' => 'expiry', 'title' => get_string('defaultregistrationexpirylifetime', 'admin'), 'description' => get_string('defaultregistrationexpirylifetimedescription', 'admin'), 'defaultvalue' => get_config('defaultregistrationexpirylifetime'), 'help' => false, 'disabled' => in_array('defaultregistrationexpirylifetime', $OVERRIDDEN), 'class' => 'double'), 'defaultaccountlifetime' => array('type' => 'expiry', 'title' => get_string('defaultaccountlifetime', 'admin'), 'description' => get_string('defaultaccountlifetimedescription', 'admin'), 'defaultvalue' => get_config('defaultaccountlifetime'), 'help' => true, 'disabled' => in_array('defaultaccountlifetime', $OVERRIDDEN), 'class' => 'double'), 'defaultaccountlifetimeupdate' => array('type' => 'radio', 'title' => get_string('defaultaccountlifetimeupdate', 'admin'), 'description' => get_string('defaultaccountlifetimeupdatedescription', 'admin'), 'defaultvalue' => get_config('defaultaccountlifetimeupdate'), 'separator' => '<br>', 'options' => array('none' => get_string('defaultaccountlifetimeupdatenone', 'admin'), 'some' => get_string('defaultaccountlifetimeupdatesome', 'admin'), 'all' => get_string('defaultaccountlifetimeupdateall', 'admin')), 'help' => true), 'defaultaccountinactiveexpire' => array('type' => 'expiry', 'title' => get_string('defaultaccountinactiveexpire', 'admin'), 'description' => get_string('defaultaccountinactiveexpiredescription', 'admin'), 'defaultvalue' => get_config('defaultaccountinactiveexpire'), 'help' => true, 'disabled' => in_array('defaultaccountinactiveexpire', $OVERRIDDEN), 'class' => 'double'), 'defaultaccountinactivewarn' => array('type' => 'expiry', 'title' => get_string('defaultaccountinactivewarn', 'admin'), 'description' => get_string('defaultaccountinactivewarndescription', 'admin'), 'defaultvalue' => get_config('defaultaccountinactivewarn'), 'help' => true, 'disabled' => in_array('defaultaccountinactivewarn', $OVERRIDDEN), 'class' => 'double'))), 'securitysettings' => array('iconclass' => 'lock', 'type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('securitysettingslegend', 'admin'), 'elements' => array('viruschecking' => array('type' => 'switchbox', 'title' => get_string('viruschecking', 'admin'), 'description' => get_string('viruscheckingdescription1', 'admin'), 'defaultvalue' => get_config('viruschecking'), 'help' => true, 'disabled' => in_array('viruschecking', $OVERRIDDEN)), 'pathtoclam' => array('type' => 'html', 'title' => get_string('pathtoclam', 'admin'), 'description' => get_string('pathtoclamdescription', 'admin'), 'value' => get_config('pathtoclam') ? get_config('pathtoclam') : get_string('pathtoclamnotset', 'admin'), 'help' => true), 'antispam' => array('type' => 'select', 'title' => get_string('antispam', 'admin'), 'description' => get_string('antispamdescription', 'admin'), 'defaultvalue' => get_config('antispam'), 'options' => $spamtraps, 'help' => true, 'disabled' => in_array('antispam', $OVERRIDDEN)), 'spamhaus' => array('type' => 'switchbox', 'title' => get_string('spamhaus1', 'admin'), 'description' => get_string('spamhausdescription1', 'admin'), 'defaultvalue' => get_config('spamhaus'), 'help' => true, 'disabled' => in_array('spamhaus', $OVERRIDDEN)), 'surbl' => array('type' => 'switchbox', 'title' => get_string('surbl1', 'admin'), 'description' => get_string('surbldescription1', 'admin'), 'defaultvalue' => get_config('surbl'), 'help' => true, 'disabled' => in_array('surbl', $OVERRIDDEN)), 'disableexternalresources' => array('type' => 'switchbox', 'title' => get_string('disableexternalresources', 'admin'), 'description' => get_string('disableexternalresourcesdescription1', 'admin'), 'defaultvalue' => get_config('disableexternalresources'), 'help' => true, 'disabled' => in_array('disableexternalresources', $OVERRIDDEN)), 'recaptchaonregisterform' => array('type' => 'switchbox', 'title' => get_string('recaptchaonregisterform', 'admin'), 'description' => get_string('recaptchaonregisterformdesc1', 'admin'), 'defaultvalue' => get_config('recaptchaonregisterform', 'admin'), 'help' => true, 'disabled' => in_array('recaptchaonregisterform', $OVERRIDDEN)), 'recaptchapublickey' => array('type' => 'text', 'title' => get_string('recaptchapublickey1', 'admin'), 'description' => get_string('recaptchapublickeydesc1', 'admin'), 'defaultvalue' => get_config('recaptchapublickey'), 'disabled' => in_array('recaptchapublickey', $OVERRIDDEN)), 'recaptchaprivatekey' => array('type' => 'text', 'title' => get_string('recaptchaprivatekey1', 'admin'), 'description' => get_string('recaptchaprivatekeydesc1', 'admin'), 'defaultvalue' => get_config('recaptchaprivatekey'), 'disabled' => in_array('recaptchaprivatekey', $OVERRIDDEN)))), 'proxysettings' => array('iconclass' => 'exchange', 'type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('proxysettings', 'admin'), 'elements' => array('proxyaddress' => array('type' => 'text', 'title' => get_string('proxyaddress', 'admin'), 'description' => get_string('proxyaddressdescription', 'admin'), 'defaultvalue' => get_config('proxyaddress'), 'disabled' => in_array('proxyaddress', $OVERRIDDEN)), 'proxyauthmodel' => array('type' => 'select', 'title' => get_string('proxyauthmodel', 'admin'), 'description' => get_string('proxyauthmodeldescription', 'admin'), 'defaultvalue' => get_config('proxyauthmodel'), 'options' => array('' => get_string('none', 'admin'), 'basic' => get_string('proxyauthmodelbasic', 'admin')), 'disabled' => in_array('proxyauthmodel', $OVERRIDDEN)), 'proxyauthcredentials' => array('type' => 'text', 'title' => get_string('proxyauthcredentials', 'admin'), 'description' => get_string('proxyauthcredentialsdescription', 'admin'), 'defaultvalue' => get_config('proxyauthcredentials'), 'disabled' => in_array('proxyauthcredentials', $OVERRIDDEN)))), 'emailsettings' => array('iconclass' => 'envelope', 'type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('emailsettings', 'admin'), 'elements' => array('smtphosts' => array('type' => 'text', 'title' => get_string('emailsmtphosts', 'admin'), 'description' => get_string('emailsmtphostsdescription', 'admin'), 'defaultvalue' => get_config('smtphosts'), 'disabled' => in_array('smtphosts', $OVERRIDDEN), 'help' => true), 'smtpport' => array('type' => 'text', 'title' => get_string('emailsmtpport', 'admin'), 'description' => get_string('emailsmtpportdescription', 'admin'), 'defaultvalue' => get_config('smtpport'), 'disabled' => in_array('smtpport', $OVERRIDDEN), 'help' => true), 'smtpuser' => array('type' => 'text', 'title' => get_string('emailsmtpuser', 'admin'), 'description' => get_string('emailsmtpuserdescription', 'admin'), 'defaultvalue' => get_config('smtpuser'), 'disabled' => in_array('smtpuser', $OVERRIDDEN)), 'smtppass' => array('type' => 'text', 'title' => get_string('emailsmtppass', 'admin'), 'defaultvalue' => get_config('smtppass'), 'disabled' => in_array('smtppass', $OVERRIDDEN)), 'smtpsecure' => array('type' => 'select', 'title' => get_string('emailsmtpsecure', 'admin'), 'description' => get_string('emailsmtpsecuredescription', 'admin'), 'defaultvalue' => get_config('smtpsecure'), 'disabled' => in_array('smtpsecure', $OVERRIDDEN), 'options' => array('' => get_string('none', 'admin'), 'ssl' => get_string('emailsmtpsecuressl', 'admin'), 'tls' => get_string('emailsmtpsecuretls', 'admin')), 'help' => true), 'noreplyaddress' => array('type' => 'text', 'title' => get_string('emailnoreplyaddress', 'admin'), 'description' => get_string('emailnoreplyaddressdescription', 'admin'), 'defaultvalue' => get_config('noreplyaddress'), 'disabled' => in_array('noreplyaddress', $OVERRIDDEN), 'help' => true))), 'notificationsettings' => array('iconclass' => 'bell', 'type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('notificationsettings', 'admin'), 'elements' => array_merge(array('activitydescription' => array('type' => 'html', 'class' => 'description', 'value' => get_string('notificationsettingsdescription', 'admin'))), $notificationelements)), 'generalsettings' => array('iconclass' => 'cog', 'type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('generalsettingslegend', 'admin'), 'elements' => array('allowpublicviews' => array('type' => 'switchbox', 'title' => get_string('allowpublicviews', 'admin'), 'description' => get_string('allowpublicviewsdescription1', 'admin'), 'defaultvalue' => get_config('allowpublicviews'), 'help' => true, 'disabled' => in_array('allowpublicviews', $OVERRIDDEN)), 'allowpublicprofiles' => array('type' => 'switchbox', 'title' => get_string('allowpublicprofiles', 'admin'), 'description' => get_string('allowpublicprofilesdescription1', 'admin'), 'defaultvalue' => get_config('allowpublicprofiles'), 'help' => true, 'disabled' => in_array('allowpublicprofiles', $OVERRIDDEN) || get_config('allowpublicviews')), 'allowanonymouspages' => array('type' => 'switchbox', 'title' => get_string('allowanonymouspages', 'admin'), 'description' => get_string('allowanonymouspagesdescription1', 'admin'), 'defaultvalue' => get_config('allowanonymouspages'), 'help' => true, 'disabled' => in_array('allowanonymouspages', $OVERRIDDEN)), 'generatesitemap' => array('type' => 'switchbox', 'title' => get_string('generatesitemap1', 'admin'), 'description' => get_string('generatesitemapdescription', 'admin'), 'defaultvalue' => get_config('generatesitemap'), 'help' => true, 'disabled' => in_array('generatesitemap', $OVERRIDDEN) || !get_config('allowpublicviews')), 'showselfsearchsideblock' => array('type' => 'switchbox', 'title' => get_string('showselfsearchsideblock1', 'admin'), 'description' => get_string('showselfsearchsideblockdescription1', 'admin'), 'defaultvalue' => get_config('showselfsearchsideblock'), 'disabled' => in_array('showselfsearchsideblock', $OVERRIDDEN)), 'showtagssideblock' => array('type' => 'switchbox', 'title' => get_string('showtagssideblock1', 'admin'), 'description' => get_string('showtagssideblockdescription2', 'admin'), 'defaultvalue' => get_config('showtagssideblock'), 'disabled' => in_array('showtagssideblock', $OVERRIDDEN)), 'tagssideblockmaxtags' => array('type' => 'text', 'size' => 4, 'title' => get_string('tagssideblockmaxtags', 'admin'), 'description' => get_string('tagssideblockmaxtagsdescription', 'admin'), 'defaultvalue' => get_config('tagssideblockmaxtags'), 'rules' => array('integer' => true, 'minvalue' => 0, 'maxvalue' => 1000), 'disabled' => in_array('tagssideblockmaxtags', $OVERRIDDEN)), 'viewmicroheaders' => array('type' => 'switchbox', 'title' => get_string('smallviewheaders', 'admin'), 'description' => get_string('smallviewheadersdescription1', 'admin'), 'defaultvalue' => get_config('viewmicroheaders'), 'disabled' => in_array('viewmicroheaders', $OVERRIDDEN)), 'showonlineuserssideblock' => array('type' => 'switchbox', 'title' => get_string('showonlineuserssideblock', 'admin'), 'description' => get_string('showonlineuserssideblockdescriptionmessage1', 'admin'), 'defaultvalue' => get_config('showonlineuserssideblock'), 'disabled' => in_array('showonlineuserssideblock', $OVERRIDDEN)), 'onlineuserssideblockmaxusers' => array('type' => 'text', 'size' => 4, 'title' => get_string('onlineuserssideblockmaxusers', 'admin'), 'description' => get_string('onlineuserssideblockmaxusersdescription', 'admin'), 'defaultvalue' => get_config('onlineuserssideblockmaxusers'), 'rules' => array('integer' => true, 'minvalue' => 0, 'maxvalue' => 100), 'disabled' => in_array('onlineuserssideblockmaxusers', $OVERRIDDEN)), 'registerterms' => array('type' => 'switchbox', 'title' => get_string('registerterms', 'admin'), 'description' => get_string('registertermsdescription', 'admin'), 'defaultvalue' => get_config('registerterms'), 'disabled' => in_array('registerterms', $OVERRIDDEN)), 'licensemetadata' => array('type' => 'switchbox', 'title' => get_string('licensemetadata', 'admin'), 'description' => get_string('licensemetadatadescription', 'admin'), 'defaultvalue' => get_config('licensemetadata'), 'help' => true, 'disabled' => in_array('licensemetadata', $OVERRIDDEN)), 'licenseallowcustom' => array('type' => 'switchbox', 'title' => get_string('licenseallowcustom1', 'admin'), 'description' => get_string('licenseallowcustomdescription', 'admin'), 'defaultvalue' => get_config('licenseallowcustom'), 'disabled' => in_array('licenseallowcustom', $OVERRIDDEN)), 'allowmobileuploads' => array('type' => 'switchbox', 'title' => get_string('allowmobileuploads1', 'admin'), 'description' => get_string('allowmobileuploadsdescription1', 'admin'), 'defaultvalue' => get_config('allowmobileuploads'), 'disabled' => in_array('allowmobileuploads', $OVERRIDDEN)), 'wysiwyg' => array('type' => 'select', 'title' => get_string('wysiwyg', 'admin'), 'description' => get_string('wysiwygdescription', 'admin'), 'defaultvalue' => get_config('wysiwyg'), 'options' => array('' => get_string('wysiwyguserdefined', 'admin'), 'disable' => get_string('disable'), 'enable' => get_string('enable')), 'help' => true, 'disabled' => in_array('wysiwyg', $OVERRIDDEN)), 'mathjax' => array('type' => 'switchbox', 'title' => get_string('mathjax', 'admin'), 'description' => get_string('mathjaxdescription', 'admin'), 'defaultvalue' => get_config('mathjax'), 'help' => true, 'disabled' => in_array('mathjax', $OVERRIDDEN)), 'sitefilesaccess' => array('type' => 'switchbox', 'title' => get_string('sitefilesaccess', 'admin'), 'description' => get_string('sitefilesaccessdescription1', 'admin'), 'defaultvalue' => get_config('sitefilesaccess'), 'disabled' => in_array('sitefilesaccess', $OVERRIDDEN)), 'watchlistnotification_delay' => array('type' => 'text', 'title' => get_string('watchlistdelaytitle', 'admin'), 'description' => get_string('watchlistdelaydescription', 'admin'), 'defaultvalue' => get_config('watchlistnotification_delay'), 'disabled' => in_array('watchlistnotification_delay', $OVERRIDDEN)))), 'loggingsettings' => array('iconclass' => 'exclamation-triangle', 'class' => 'last mbxl', 'type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('loggingsettingslegend', 'admin'), 'elements' => array('eventloglevel' => array('type' => 'select', 'title' => get_string('eventloglevel', 'admin'), 'description' => get_string('eventlogleveldescription', 'admin'), 'defaultvalue' => get_config('eventloglevel'), 'options' => array('none' => get_string('eventloglevelnone', 'admin'), 'masq' => get_string('eventloglevelmasq', 'admin'), 'all' => get_string('eventloglevelall', 'admin')), 'help' => true, 'disabled' => in_array('eventloglevel', $OVERRIDDEN)), 'eventlogexpiry' => array('type' => 'expiry', 'title' => get_string('eventlogexpiry', 'admin'), 'description' => get_string('eventlogexpirydescription', 'admin'), 'defaultvalue' => get_config('eventlogexpiry'), 'help' => false, 'disabled' => in_array('eventlogexpiry', $OVERRIDDEN), 'class' => 'double')))));
$siteoptionform['elements']['submit'] = array('type' => 'button', 'usebuttontag' => true, 'class' => 'btn-success', 'value' => get_string('updatesiteoptions', 'admin'));
$siteoptionform = pieform($siteoptionform);
function siteoptions_fail(Pieform $form, $field)
{
    $form->reply(PIEFORM_ERR, array('message' => get_string('setsiteoptionsfailed', 'admin', get_string($field, 'admin')), 'goto' => '/admin/site/options.php'));
}
function siteoptions_submit(Pieform $form, $values)
Esempio n. 5
0
  $jsonString = urldecode($_REQUEST['json_request']);
  $jsonString = str_replace("\\", "", $jsonString);
  $data = json_decode($jsonString, true);

  if(count($data) == 0) {
    die(json_encode(set_error_arr("Invalid request")));
  }

  require_once('ml_header.php');

  switch ($data['action']) {
    case 'getAllThemesList':
      get_all_themes_list();
      break;
    case 'getAllThemes':
      get_all_themes();
      break;
    case 'getThemeInfo':
      get_theme_info();
      break;
    case 'saveThemeInfo':
      save_theme_info();
      break;
    case 'deleteTheme':
      delete_theme();
      break;
    case 'getAllCategoriesList':
      get_all_categories_list();
      break;
    case 'getCategoryInfo':
      get_category_info();
Esempio n. 6
0
/**
 * Checks if theme still exists and if not resets it to default option
 *
 * @param $theme         string  Name of theme
 * @param $institution   string  Name of Institution
 *
 * @return  bool       True if theme exists
 */
function validate_theme($theme, $institution = null)
{
    global $SESSION;
    if ($institution) {
        $themeoptions = get_institution_themes($institution);
    } else {
        $themeoptions = get_all_themes();
    }
    if (!array_key_exists($theme, $themeoptions)) {
        if ($institution) {
            set_config_institution($institution, 'theme', null);
        } else {
            set_config('theme', 'default');
        }
        $SESSION->add_info_msg(get_string('thememissing', 'admin', $theme));
        return false;
    }
    return true;
}
Esempio n. 7
0
 function index()
 {
     global $access_level_names;
     $prefs_blacklist = array("HIDE_READ_FEEDS", "FEEDS_SORT_BY_UNREAD", "STRIP_UNSAFE_TAGS");
     $profile_blacklist = array("ALLOW_DUPLICATE_POSTS", "PURGE_OLD_DAYS", "PURGE_UNREAD_ARTICLES", "DIGEST_ENABLE", "DIGEST_CATCHUP", "BLACKLISTED_TAGS", "ENABLE_API_ACCESS", "UPDATE_POST_ON_CHECKSUM_CHANGE", "DEFAULT_UPDATE_INTERVAL", "USER_TIMEZONE", "SORT_HEADLINES_BY_FEED_DATE", "SSL_CERT_SERIAL", "DIGEST_PREFERRED_TIME");
     $_SESSION["prefs_op_result"] = "";
     print "<div dojoType=\"dijit.layout.AccordionContainer\" region=\"center\">";
     print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Personal data / Authentication') . "\">";
     print "<form dojoType=\"dijit.form.Form\" id=\"changeUserdataForm\">";
     print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">\n\t\tevt.preventDefault();\n\t\tif (this.validate()) {\n\t\t\tnotify_progress('Saving data...', true);\n\n\t\t\tnew Ajax.Request('backend.php', {\n\t\t\t\tparameters: dojo.objectToQuery(this.getValues()),\n\t\t\t\tonComplete: function(transport) {\n\t\t\t\t\tnotify_callback2(transport);\n\t\t\t} });\n\n\t\t}\n\t\t</script>";
     print "<table width=\"100%\" class=\"prefPrefsList\">";
     $result = db_query($this->link, "SELECT email,full_name,\n\t\t\taccess_level FROM ttrss_users\n\t\t\tWHERE id = " . $_SESSION["uid"]);
     $email = htmlspecialchars(db_fetch_result($result, 0, "email"));
     $full_name = htmlspecialchars(db_fetch_result($result, 0, "full_name"));
     print "<tr><td width=\"40%\">" . __('Full name') . "</td>";
     print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" name=\"full_name\" required=\"1\"\n\t\t\tvalue=\"{$full_name}\"></td></tr>";
     print "<tr><td width=\"40%\">" . __('E-mail') . "</td>";
     print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" name=\"email\" required=\"1\" value=\"{$email}\"></td></tr>";
     if (!SINGLE_USER_MODE && !(ALLOW_REMOTE_USER_AUTH && AUTO_LOGIN)) {
         $access_level = db_fetch_result($result, 0, "access_level");
         print "<tr><td width=\"40%\">" . __('Access level') . "</td>";
         print "<td>" . $access_level_names[$access_level] . "</td></tr>";
     }
     print "</table>";
     print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-prefs\">";
     print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"changeemail\">";
     print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">" . __("Save data") . "</button>";
     print "</form>";
     if (!SINGLE_USER_MODE && !(ALLOW_REMOTE_USER_AUTH && AUTO_LOGIN)) {
         $result = db_query($this->link, "SELECT id FROM ttrss_users\n\t\t\t\tWHERE id = " . $_SESSION["uid"] . " AND pwd_hash\n\t\t\t\t= 'SHA1:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8'");
         if (db_num_rows($result) != 0) {
             print format_warning(__("Your password is at default value, please change it."), "default_pass_warning");
         }
         print "<form dojoType=\"dijit.form.Form\">";
         print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">\n\t\t\tevt.preventDefault();\n\t\t\tif (this.validate()) {\n\t\t\t\tnotify_progress('Changing password...', true);\n\n\t\t\t\tnew Ajax.Request('backend.php', {\n\t\t\t\t\tparameters: dojo.objectToQuery(this.getValues()),\n\t\t\t\t\tonComplete: function(transport) {\n\t\t\t\t\t\tnotify('');\n\t\t\t\t\t\tif (transport.responseText.indexOf('ERROR: ') == 0) {\n\t\t\t\t\t\t\tnotify_error(transport.responseText.replace('ERROR: ', ''));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnotify_info(transport.responseText);\n\t\t\t\t\t\t\tvar warn = \$('default_pass_warning');\n\t\t\t\t\t\t\tif (warn) Element.hide(warn);\n\t\t\t\t\t\t}\n\t\t\t\t}});\n\t\t\t\tthis.reset();\n\t\t\t}\n\t\t\t</script>";
         print "<table width=\"100%\" class=\"prefPrefsList\">";
         print "<tr><td width=\"40%\">" . __("Old password") . "</td>";
         print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" type=\"password\" required=\"1\" name=\"old_password\"></td></tr>";
         print "<tr><td width=\"40%\">" . __("New password") . "</td>";
         print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" type=\"password\" required=\"1\"\n\t\t\t\tname=\"new_password\"></td></tr>";
         print "<tr><td width=\"40%\">" . __("Confirm password") . "</td>";
         print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" type=\"password\" required=\"1\" name=\"confirm_password\"></td></tr>";
         print "</table>";
         print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-prefs\">";
         print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"changepassword\">";
         print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">" . __("Change password") . "</button>";
         print "</form>";
     }
     print "</div>";
     #pane
     print "<div dojoType=\"dijit.layout.AccordionPane\" selected=\"true\" title=\"" . __('Preferences') . "\">";
     print "<form dojoType=\"dijit.form.Form\" id=\"changeSettingsForm\">";
     print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">\n\t\tevt.preventDefault();\n\t\tif (this.validate()) {\n\t\t\tconsole.log(dojo.objectToQuery(this.getValues()));\n\n\t\t\tnew Ajax.Request('backend.php', {\n\t\t\t\tparameters: dojo.objectToQuery(this.getValues()),\n\t\t\t\tonComplete: function(transport) {\n\t\t\t\t\tvar msg = transport.responseText;\n\t\t\t\t\tif (msg.match('PREFS_THEME_CHANGED')) {\n\t\t\t\t\t\twindow.location.reload();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnotify_info(msg);\n\t\t\t\t\t}\n\t\t\t} });\n\t\t}\n\t\t</script>";
     print '<div dojoType="dijit.layout.BorderContainer" gutters="false">';
     print '<div dojoType="dijit.layout.ContentPane" region="center" style="overflow-y : auto">';
     if ($_SESSION["profile"]) {
         print_notice("Some preferences are only available in default profile.");
     }
     if ($_SESSION["profile"]) {
         initialize_user_prefs($this->link, $_SESSION["uid"], $_SESSION["profile"]);
         $profile_qpart = "profile = '" . $_SESSION["profile"] . "'";
     } else {
         initialize_user_prefs($this->link, $_SESSION["uid"]);
         $profile_qpart = "profile IS NULL";
     }
     $result = db_query($this->link, "SELECT DISTINCT\n\t\t\tttrss_user_prefs.pref_name,short_desc,help_text,value,type_name,\n\t\t\tsection_name,def_value,section_id\n\t\t\tFROM ttrss_prefs,ttrss_prefs_types,ttrss_prefs_sections,ttrss_user_prefs\n\t\t\tWHERE type_id = ttrss_prefs_types.id AND\n\t\t\t\t{$profile_qpart} AND\n\t\t\t\tsection_id = ttrss_prefs_sections.id AND\n\t\t\t\tttrss_user_prefs.pref_name = ttrss_prefs.pref_name AND\n\t\t\t\tshort_desc != '' AND\n\t\t\t\towner_uid = " . $_SESSION["uid"] . "\n\t\t\tORDER BY section_id,short_desc");
     $lnum = 0;
     $active_section = "";
     while ($line = db_fetch_assoc($result)) {
         if (in_array($line["pref_name"], $prefs_blacklist)) {
             continue;
         }
         if ($_SESSION["profile"] && in_array($line["pref_name"], $profile_blacklist)) {
             continue;
         }
         if ($active_section != $line["section_name"]) {
             if ($active_section != "") {
                 print "</table>";
             }
             print "<table width=\"100%\" class=\"prefPrefsList\">";
             $active_section = $line["section_name"];
             print "<tr><td colspan=\"3\"><h3>" . __($active_section) . "</h3></td></tr>";
             if ($line["section_id"] == 2) {
                 print "<tr><td width=\"40%\">" . __("Select theme") . "</td>";
                 $user_theme = get_pref($this->link, "_THEME_ID");
                 $themes = get_all_themes();
                 print "<td><select name=\"_THEME_ID\" dojoType=\"dijit.form.Select\">";
                 print "<option value='Default'>" . __('Default') . "</option>";
                 print "<option value='----------------' disabled=\"1\">--------</option>";
                 foreach ($themes as $t) {
                     $base = $t['base'];
                     $name = $t['name'];
                     if ($base == $user_theme) {
                         $selected = "selected=\"1\"";
                     } else {
                         $selected = "";
                     }
                     print "<option {$selected} value='{$base}'>{$name}</option>";
                 }
                 print "</select></td></tr>";
             }
             $lnum = 0;
         }
         print "<tr>";
         $type_name = $line["type_name"];
         $pref_name = $line["pref_name"];
         $value = $line["value"];
         $def_value = $line["def_value"];
         $help_text = $line["help_text"];
         print "<td width=\"40%\" class=\"prefName\" id=\"{$pref_name}\">" . __($line["short_desc"]);
         if ($help_text) {
             print "<div class=\"prefHelp\">" . __($help_text) . "</div>";
         }
         print "</td>";
         print "<td class=\"prefValue\">";
         if ($pref_name == "USER_TIMEZONE") {
             $timezones = explode("\n", file_get_contents("lib/timezones.txt"));
             print_select($pref_name, $value, $timezones, 'dojoType="dijit.form.FilteringSelect"');
         } else {
             if ($pref_name == "USER_STYLESHEET") {
                 print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\t\tonclick=\"customizeCSS()\">" . __('Customize') . "</button>";
             } else {
                 if ($pref_name == "DEFAULT_ARTICLE_LIMIT") {
                     $limits = array(15, 30, 45, 60);
                     print_select($pref_name, $value, $limits, 'dojoType="dijit.form.Select"');
                 } else {
                     if ($pref_name == "DEFAULT_UPDATE_INTERVAL") {
                         global $update_intervals_nodefault;
                         print_select_hash($pref_name, $value, $update_intervals_nodefault, 'dojoType="dijit.form.Select"');
                     } else {
                         if ($type_name == "bool") {
                             if ($value == "true") {
                                 $value = __("Yes");
                             } else {
                                 $value = __("No");
                             }
                             if ($pref_name == "PURGE_UNREAD_ARTICLES" && FORCE_ARTICLE_PURGE != 0) {
                                 $disabled = "disabled=\"1\"";
                                 $value = __("Yes");
                             } else {
                                 $disabled = "";
                             }
                             print_radio($pref_name, $value, __("Yes"), array(__("Yes"), __("No")), $disabled);
                         } else {
                             if (array_search($pref_name, array('FRESH_ARTICLE_MAX_AGE', 'DEFAULT_ARTICLE_LIMIT', 'PURGE_OLD_DAYS', 'LONG_DATE_FORMAT', 'SHORT_DATE_FORMAT')) !== false) {
                                 $regexp = $type_name == 'integer' ? 'regexp="^\\d*$"' : '';
                                 if ($pref_name == "PURGE_OLD_DAYS" && FORCE_ARTICLE_PURGE != 0) {
                                     $disabled = "disabled=\"1\"";
                                     $value = FORCE_ARTICLE_PURGE;
                                 } else {
                                     $disabled = "";
                                 }
                                 print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\t\t\trequired=\"1\" {$regexp} {$disabled}\n\t\t\t\t\tname=\"{$pref_name}\" value=\"{$value}\">";
                             } else {
                                 if ($pref_name == "SSL_CERT_SERIAL") {
                                     print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\t\t\tid=\"SSL_CERT_SERIAL\" readonly=\"1\"\n\t\t\t\t\tname=\"{$pref_name}\" value=\"{$value}\">";
                                     $cert_serial = htmlspecialchars(get_ssl_certificate_id());
                                     $has_serial = $cert_serial ? "false" : "true";
                                     print " <button dojoType=\"dijit.form.Button\" disabled=\"{$has_serial}\"\n\t\t\t\t\tonclick=\"insertSSLserial('{$cert_serial}')\">" . __('Register') . "</button>";
                                     print " <button dojoType=\"dijit.form.Button\"\n\t\t\t\t\tonclick=\"insertSSLserial('')\">" . __('Clear') . "</button>";
                                 } else {
                                     if ($pref_name == 'DIGEST_PREFERRED_TIME') {
                                         print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\t\t\tid=\"{$pref_name}\" regexp=\"[012]?\\d:\\d\\d\" placeHolder=\"12:00\"\n\t\t\t\t\tname=\"{$pref_name}\" value=\"{$value}\"><div class=\"insensitive\">" . T_sprintf("Current server time: %s (UTC)", date("H:i")) . "</div>";
                                     } else {
                                         $regexp = $type_name == 'integer' ? 'regexp="^\\d*$"' : '';
                                         print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\t\t\t{$regexp}\n\t\t\t\t\tname=\"{$pref_name}\" value=\"{$value}\">";
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         print "</td>";
         print "</tr>";
         $lnum++;
     }
     print "</table>";
     print '</div>';
     # inside pane
     print '<div dojoType="dijit.layout.ContentPane" region="bottom">';
     print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-prefs\">";
     print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"saveconfig\">";
     print "<button dojoType=\"dijit.form.Button\" type=\"submit\">" . __('Save configuration') . "</button> ";
     print "<button dojoType=\"dijit.form.Button\" onclick=\"return editProfiles()\">" . __('Manage profiles') . "</button> ";
     print "<button dojoType=\"dijit.form.Button\" onclick=\"return validatePrefsReset()\">" . __('Reset to defaults') . "</button>";
     print '</div>';
     # inner pane
     print '</div>';
     # border container
     print "</form>";
     print "</div>";
     #pane
     print "</div>";
     #container
 }
Esempio n. 8
0
function print_theme_select($link)
{
    $user_theme = get_pref($link, "USER_THEME");
    $themes = get_all_themes();
    print "<select name=\"theme\">";
    print "<option value=''>" . __('Default') . "</option>";
    print "<option disabled>--------</option>";
    foreach ($themes as $t) {
        $base = $t['base'];
        $name = $t['name'];
        if ($base == $user_theme) {
            $selected = "selected=\"1\"";
        } else {
            $selected = "";
        }
        print "<option {$selected} value='{$base}'>{$name}</option>";
    }
    print "</select>";
}