/** * Human recognition using PukiWiki Auth methods * * PukiWiki API Extension * * @access public * @static * @param boolean $is_human Tell this is a human (Use true to store into session) * @param boolean $use_session Use Session log * @param int $use_rolelevel accepts users whose role levels are stronger than this * @return boolean * @uses sonots::is_admin * @uses auth::check_role (PukiWiki Plus! lib/auth.php) if available * @version $Id: v 1.0 2008-06-05 11:14:46 sonots $ */ function is_human($is_human = false, $use_session = false, $use_rolelevel = 0) { if (!$is_human) { if ($use_session) { session_start(); $is_human = isset($_SESSION['pkwk_is_human']) && $_SESSION['pkwk_is_human']; } } if (!$is_human) { if (ROLE_GUEST < $use_rolelevel && $use_rolelevel <= ROLE_ENROLLEE) { if (is_callable(array('auth', 'check_role'))) { // Plus! $is_human = !auth::check_role('role_enrollee'); } else { // In PukiWiki Official, enrollees are all auth_users (ROLE_AUTH && BasicAuth in Plus!) $is_human = isset($_SERVER['PHP_AUTH_USER']); } } } if (!$is_human) { if (ROLE_GUEST < $use_rolelevel && $use_rolelevel <= ROLE_ADM_CONTENTS) { $is_human = sonots::is_admin(null, $use_session, true); // In PukiWiki Official, username 'admin' is the Admin } } if ($use_session) { session_start(); $_SESSION['pkwk_is_human'] = $is_human; } else { global $vars; $vars['pkwk_is_human'] = $is_human; } return $is_human; }
/** * Action Plugin Main Function */ function action() { set_time_limit(0); global $vars; if (sonots::is_admin($vars['pass'], $this->conf['use_session'], $this->conf['use_authlog']) && $vars['pcmd'] == 'clean') { $html = $this->clean_cache(); } else { $basehref = get_script_uri() . '?cmd=contentsx&pcmd=clean'; $html = sonots::display_password_form($basehref); } return array('msg' => 'Clean Contentsx Caches', 'body' => $html); }
/** * Action Plugin Main Funtion */ function action() { global $vars; if (sonots::is_admin($vars['pass'], $this->conf['use_session'], $this->conf['use_authlog'])) { $body = $this->clean_cache(); } else { $action = get_script_uri() . '?cmd=' . $this->plugin . '&pcmd=clean'; $body = sonots::display_password_form($action); } return array('msg' => 'Clean Tag Caches', 'body' => $body); }