return;
}
- $module_class = "auth_" . $_SESSION["auth_module"];
- $authenticator = new $module_class($this->link);
+ global $pluginhost;
+ $authenticator = $pluginhost->get_plugin($_SESSION["auth_module"]);
if (method_exists($authenticator, "change_password")) {
print $authenticator->change_password($_SESSION["uid"], $old_pw, $new_pw);
$_SESSION["prefs_cache"] = false;
- $orig_theme = get_pref($this->link, "_THEME_ID");
-
foreach (array_keys($_POST) as $pref_name) {
$pref_name = db_escape_string($pref_name);
}
- if ($orig_theme != get_pref($this->link, "_THEME_ID")) {
- print "PREFS_THEME_CHANGED";
- } else {
- print __("The configuration was saved.");
- }
+ print __("The configuration was saved.");
}
function getHelp() {
print "</form>";
- if ($_SESSION["auth_module"]) {
- $module_class = "auth_" . $_SESSION["auth_module"];
- $authenticator = new $module_class($this->link);
+ if ($_SESSION["auth_module"]) {
+ global $pluginhost;
+
+ $authenticator = $pluginhost->get_plugin($_SESSION["auth_module"]);
+
} else {
$authenticator = false;
}
print "</form>";
- if ($_SESSION["auth_module"] == "internal") {
+ if ($_SESSION["auth_module"] == "auth_internal") {
print "<h2>" . __("One time passwords / Authenticator") . "</h2>";
}
}
+ global $pluginhost;
+ $pluginhost->run_hooks($pluginhost::HOOK_PREFS_TAB_SECTION,
+ "hook_prefs_tab_section", "prefPrefsAuth");
+
print "</div>"; #pane
print "<div dojoType=\"dijit.layout.AccordionPane\" selected=\"true\" title=\"".__('Preferences')."\">";
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 "</table>";
+ global $pluginhost;
+ $pluginhost->run_hooks($pluginhost::HOOK_PREFS_TAB_SECTION,
+ "hook_prefs_tab_section", "prefPrefsPrefsInside");
+
print '</div>'; # inside pane
print '<div dojoType="dijit.layout.ContentPane" region="bottom">';
<label for='prefs_show_advanced'>" .
__("Show additional preferences") . "</label>";
+ global $pluginhost;
+ $pluginhost->run_hooks($pluginhost::HOOK_PREFS_TAB_SECTION,
+ "hook_prefs_tab_section", "prefPrefsPrefsOutside");
+
print "</form>";
print '</div>'; # inner pane
print '</div>'; # border container
$system_enabled = array_map("trim", explode(",", PLUGINS));
$user_enabled = array_map("trim", explode(",", get_pref($this->link, "_ENABLED_PLUGINS")));
- $tmppluginhost = new PluginHost($link);
- $tmppluginhost->load_all($tmppluginhost::KIND_ALL);
+ $tmppluginhost = new PluginHost($this->link);
+ $tmppluginhost->load_all($tmppluginhost::KIND_ALL, $_SESSION["uid"]);
+ $tmppluginhost->load_data(true);
foreach ($tmppluginhost->get_plugins() as $name => $plugin) {
$about = $plugin->about();
print "<td>" . htmlspecialchars(sprintf("%.2f", $about[0])) . "</td>";
print "<td>" . htmlspecialchars($about[2]) . "</td>";
+ if (count($tmppluginhost->get_all($plugin)) > 0) {
+ if (in_array($name, $system_enabled)) {
+ print "<td><a href='#' onclick=\"clearPluginData('$name')\"
+ class='visibleLink'>".__("Clear data")."</a></td>";
+ }
+ }
+
print "</tr>";
}
print "<td>" . htmlspecialchars(sprintf("%.2f", $about[0])) . "</td>";
print "<td>" . htmlspecialchars($about[2]) . "</td>";
+ if (count($tmppluginhost->get_all($plugin)) > 0) {
+ if (in_array($name, $system_enabled) || in_array($name, $user_enabled)) {
+ print "<td><a href='#' onclick=\"clearPluginData('$name')\" class='visibleLink'>".__("Clear data")."</a></td>";
+ }
+ }
+
print "</tr>";
function otpenable() {
$password = db_escape_string($_REQUEST["password"]);
-
- $module_class = "auth_" . $_SESSION["auth_module"];
- $authenticator = new $module_class($this->link);
$enable_otp = $_REQUEST["enable_otp"] == "on";
+ global $pluginhost;
+ $authenticator = $pluginhost->get_plugin($_SESSION["auth_module"]);
+
if ($authenticator->check_password($_SESSION["uid"], $password)) {
if ($enable_otp) {
function otpdisable() {
$password = db_escape_string($_REQUEST["password"]);
- $module_class = "auth_" . $_SESSION["auth_module"];
- $authenticator = new $module_class($this->link);
+ global $pluginhost;
+ $authenticator = $pluginhost->get_plugin($_SESSION["auth_module"]);
if ($authenticator->check_password($_SESSION["uid"], $password)) {
set_pref($this->link, "_ENABLED_PLUGINS", $plugins);
}
+
+ function clearplugindata() {
+ $name = db_escape_string($_REQUEST["name"]);
+
+ global $pluginhost;
+ $pluginhost->clear_data($pluginhost->get_plugin($name));
+ }
}
?>