function process() { global $plugin_protected; global $INPUT; $count_enabled = $count_disabled = 0; $this->enabled = $INPUT->arr('enabled'); foreach ($this->manager->plugin_list as $plugin) { if (in_array($plugin, $plugin_protected)) { continue; } $new = in_array($plugin, $this->enabled); $old = !plugin_isdisabled($plugin); if ($new != $old) { switch ($new) { // enable plugin case true: if (plugin_enable($plugin)) { msg(sprintf($this->lang['enabled'], $plugin), 1); $count_enabled++; } else { msg(sprintf($this->lang['notenabled'], $plugin), -1); } break; case false: if (plugin_disable($plugin)) { msg(sprintf($this->lang['disabled'], $plugin), 1); $count_disabled++; } else { msg(sprintf($this->lang['notdisabled'], $plugin), -1); } break; } } } // refresh plugins, including expiring any dokuwiki cache(s) if ($count_enabled || $count_disabled) { $this->refresh(); } }
function document_start() { if (!defined('RECURSIVE_MELLEL')) { define('RECURSIVE_MELLEL', TRUE); if (!defined('DEBUG')) { define('DEBUG', TRUE); } set_time_limit(60 * 5); if (isset($_REQUEST['list'])) { $dirs = glob('/var/www/kolchose.org/inge/wiki/data/pages/*'); echo '<h1>No files</h1>'; foreach ($dirs as $dir) { if (is_file($dir)) { $new_dir = $dir; // $new_dir = str_replace('/var/www/kolchose.org/inge/wiki/data/pages/', '', $new_dir); // $new_dir = str_replace('.txt', '', $new_dir); $new_dirs[] = $new_dir; } else { echo $dir . '<br />'; } } unset($dirs); echo '<h1>Formatation ok?</h1>'; // $test_file = $new_dirs[1]; // // echo $test_file.'<br />'; #var_dump( #self::render(file_get_contents($test_file), 'mellelexport'); #); $i = 0; foreach ($new_dirs as $file) { echo $file . '<br />'; self::render(file_get_contents($file), 'mellelexport'); ob_flush(); $i++; if ($i > 50) { exit; } } exit; } } plugin_disable('highlight'); if (in_array('highlight', plugin_list())) { die('ERROR: highlight loaded 1'); } global $ID; parent::document_start(); // If older or equal to 2007-06-26, we need to disable caching $dw_version = preg_replace('/[^\\d]/', '', getversion()); if (version_compare($dw_version, "20070626", "<=")) { $this->info["cache"] = false; } $contentType = class_exists('ZipArchive') ? 'application/zip' : 'text/xml'; $contentFileName = class_exists('ZipArchive') ? noNS($ID) . '.mellel' : 'main.xml'; // TODO configuration if (class_exists('ZipArchive') and true) { $contentFileName = date('Y-m-d_') . $contentFileName; } // send the content type header, new method after 2007-06-26 (handles caching) if (!DEBUG) { if (version_compare($dw_version, "20070626")) { // store the content type headers in metadata $headers = array('Content-Type' => $contentType, 'Content-Disposition' => 'attachment; filename="' . $contentFileName . '";'); p_set_metadata($ID, array('format' => array('mellelexport' => $headers))); } else { // older method header('Content-Type: ' . $contentType); header('Content-Disposition: attachment; filename="' . $contentFileName . '";'); } } else { header('Content-Type: text/html; charset=utf-8'); echo '<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>'; #<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> echo '<table>'; echo '<tr><th></th><th>Tag<br />(Wiki)</th><th></th><th>Type</th><th></th><th>Args</th><th>Output<br />(Mellel)</th></tr>'; } }
/** * \brief This is where the magic for * Authentication happens. */ function PostInitialize() { global $SysConf; /* if Site Minder enabled core-auth will be disabled*/ if (siteminder_check() != -1) { return 0; } if (!$this->session->isStarted()) { $this->session->setName('Login'); $this->session->start(); } if (array_key_exists('selectMemberGroup', $_POST)) { $selectedGroupId = intval($_POST['selectMemberGroup']); $this->userDao->setDefaultGroupMembership(intval($_SESSION[Auth::USER_ID]), $selectedGroupId); $_SESSION[Auth::GROUP_ID] = $selectedGroupId; $this->session->set(Auth::GROUP_ID, $selectedGroupId); $SysConf['auth'][Auth::GROUP_ID] = $selectedGroupId; } if (array_key_exists(Auth::USER_ID, $_SESSION)) { $SysConf['auth'][Auth::USER_ID] = $_SESSION[Auth::USER_ID]; } if (array_key_exists(Auth::GROUP_ID, $_SESSION)) { $SysConf['auth'][Auth::GROUP_ID] = $_SESSION[Auth::GROUP_ID]; } $Now = time(); if (!empty($_SESSION['time'])) { /* Logins older than 60 secs/min * 480 min = 8 hr are auto-logout */ if (@$_SESSION['time'] + 60 * 480 < $Now) { $this->updateSession(""); } } $_SESSION['time'] = $Now; if (empty($_SESSION['ip'])) { $_SESSION['ip'] = $this->getIP(); } else { if (@$_SESSION['checkip'] == 1 && @$_SESSION['ip'] != $this->getIP()) { /* Sessions are not transferable. */ $this->updateSession(""); $_SESSION['ip'] = $this->getIP(); } } if (@$_SESSION[Auth::USER_NAME]) { /* Recheck the user in case he is suddenly blocked or changed. */ if (empty($_SESSION['time_check'])) { $_SESSION['time_check'] = time() + 480 * 60; } if (time() >= @$_SESSION['time_check']) { $row = $this->userDao->getUserAndDefaultGroupByUserName(@$_SESSION[Auth::USER_NAME]); /* Check for instant logouts */ if (empty($row['user_pass'])) { $row = ""; } $this->updateSession($row); } } else { $this->updateSession(""); } /* Disable all plugins with >= level access */ plugin_disable($_SESSION[Auth::USER_LEVEL]); $this->State = PLUGIN_STATE_READY; }
public function testNoSqlPlugin() { $helper = new helper_plugin_data(); plugin_disable('sqlite'); $this->assertFalse($helper->_getDB()); }
/** * \brief This is where the magic for * Authentication happens. */ function PostInitialize() { global $PG_CONN; global $SysConf; if (siteminder_check() == -1) { return; } $UID = siteminder_check(); global $container; /** @var Session $session */ $session = $container->get('session'); $session->setName('Login'); $session->start(); if (array_key_exists(Auth::USER_ID, $_SESSION)) { $SysConf['auth'][Auth::USER_ID] = $_SESSION[Auth::USER_ID]; } $Now = time(); if (!empty($_SESSION['time'])) { /* Logins older than 60 secs/min * 480 min = 8 hr are auto-logout */ if (@$_SESSION['time'] + 60 * 480 < $Now) { $_SESSION['User'] = NULL; $_SESSION[Auth::USER_ID] = NULL; $_SESSION[Auth::USER_LEVEL] = NULL; $SysConf['auth'][Auth::USER_ID] = NULL; $_SESSION['UserEmail'] = NULL; $_SESSION['Folder'] = NULL; $_SESSION['UiPref'] = NULL; /* TODO: need to clear SiteMinder session */ } } /* check db connection */ if (!$PG_CONN) { DBconnect(); if (!$PG_CONN) { echo "NO DB connection"; } } /* Enable or disable plugins based on login status */ $Level = PLUGIN_DB_NONE; if (@$_SESSION['User']) { //TODO: also need to check SiteMinder session /* If you are logged in, then the default level is "Download". */ if ("X" . $_SESSION[Auth::USER_LEVEL] == "X") { $Level = PLUGIN_DB_WRITE; } else { $Level = $_SESSION[Auth::USER_LEVEL]; } /* Recheck the user in case he is suddenly blocked or changed. */ if (empty($_SESSION['time_check'])) { $_SESSION['time_check'] = time() + 480 * 60; } if (time() >= @$_SESSION['time_check']) { $sql = "SELECT * FROM users WHERE user_pk='" . @$_SESSION['UserId'] . "';"; $result = pg_query($PG_CONN, $sql); DBCheckResult($result, $sql, __FILE__, __LINE__); $R = pg_fetch_assoc($result); pg_free_result($result); $_SESSION['User'] = $R['user_name']; $_SESSION['Folder'] = $R['root_folder_fk']; $_SESSION[Auth::USER_LEVEL] = $R['user_perm']; $_SESSION['UserEmail'] = $R['user_email']; $_SESSION['UserEnote'] = $R['email_notify']; if (empty($R['ui_preference'])) { $_SESSION['UiPref'] = 'simple'; } else { $_SESSION['UiPref'] = $R['ui_preference']; } $Level = $_SESSION[Auth::USER_LEVEL]; } } else { $this->CheckUser($UID); $Level = $_SESSION[Auth::USER_LEVEL]; } /* Disable all plugins with >= $Level access */ plugin_disable($Level); $this->State = PLUGIN_STATE_READY; }
/** * \brief This is where the magic for * Authentication happens. */ function PostInitialize() { global $Plugins; global $PG_CONN; global $SysConf; if (empty($PG_CONN)) { return 0; } /* if Site Minder enabled core-auth will be disabled*/ if (siteminder_check() != -1) { return 0; } session_name("Login"); $mysess = session_id(); if (empty($mysess)) { session_start(); } if (array_key_exists('UserId', $_SESSION)) { $SysConf['auth']['UserId'] = $_SESSION['UserId']; } $Now = time(); if (!empty($_SESSION['time'])) { /* Logins older than 60 secs/min * 480 min = 8 hr are auto-logout */ if (@$_SESSION['time'] + 60 * 480 < $Now) { $this->UpdateSess(""); } } $_SESSION['time'] = $Now; if (empty($_SESSION['ip'])) { $_SESSION['ip'] = $this->GetIP(); } else { if (@$_SESSION['checkip'] == 1 && @$_SESSION['ip'] != $this->GetIP()) { /* Sessions are not transferable. */ $this->UpdateSess(""); $_SESSION['ip'] = $this->GetIP(); } } /* Enable or disable plugins based on login status */ $Level = PLUGIN_DB_NONE; if (@$_SESSION['User']) { /* If you are logged in, then the default level is "Download". */ if ("X" . $_SESSION['UserLevel'] == "X") { $Level = PLUGIN_DB_WRITE; } else { $Level = @$_SESSION['UserLevel']; } /* Recheck the user in case he is suddenly blocked or changed. */ if (empty($_SESSION['time_check'])) { $_SESSION['time_check'] = time() + 480 * 60; } if (time() >= @$_SESSION['time_check']) { $sql = "SELECT * FROM users WHERE user_pk='" . @$_SESSION['UserId'] . "';"; $result = pg_query($PG_CONN, $sql); DBCheckResult($result, $sql, __FILE__, __LINE__); $R = pg_fetch_assoc($result); pg_free_result($result); $this->UpdateSess($R); /* Check for instant logouts */ if (empty($R['user_pass'])) { $this->UpdateSess(""); } } } else { $this->UpdateSess(""); } /* Disable all plugins with >= level access */ plugin_disable($_SESSION['UserLevel']); $this->State = PLUGIN_STATE_READY; }