private function onEnable($enum) { if (false !== ($error = GWF_Form::validateCSRF_WeakS())) { return GWF_HTML::error('', $error); } if ($this->mod->isCoreModule()) { return $this->module->error('err_disable_core_module'); } if (false === $this->mod->saveOption(GWF_Module::ENABLED, $enum === 'enabled')) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if (false === GWF_ModuleLoader::reinstallHTAccess()) { return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__)); } return $this->module->message('msg_module_' . $enum, array($this->mod->display('module_name'))); }
private static function upgradeModuleStep(GWF_Module $module, $version) { GWF_Log::logInstall(sprintf('Upgrading module %s to v%.02f.', $module->getName(), $version)); $name = $module->getName(); $vstr = str_replace('.', '_', sprintf('%.02f', $version)); $path = sprintf('%smodule/%s/Upgrade_%s_%s.php', GWF_CORE_PATH, $name, $name, $vstr); if (Common::isFile($path)) { require_once $path; $func = sprintf('Upgrade_%s_%s', $name, $vstr); if (!function_exists($func)) { return GWF_HTML::err('ERR_METHOD_MISSING', array($func, $module->display('module_name'))); } $result = call_user_func($func, $module); if ($result === true || $result === '' || $result === NULL) { } else { return $result; } } if (false === $module->saveVar('module_version', $version)) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } $msg = sprintf('Upgraded module %s to version %.02f.', $module->getName(), $version); GWF_Log::logInstall($msg); echo GWF_HTML::message('GWF', $msg); return ''; }
public function formReInstall(GWF_Module $mod) { $data = array('modulename' => array(GWF_Form::HIDDEN, $mod->display('module_name')), 'install' => array(GWF_Form::SUBMIT, $this->module->lang('btn_install'), $this->module->lang('th_install')), 'resetvars2' => array(GWF_Form::SUBMIT, $this->module->lang('btn_defaults'), $this->module->lang('th_reset')), 'reinstall2' => array(GWF_Form::SUBMIT, $this->module->lang('btn_reinstall'), $this->module->lang('th_reinstall')), 'delete2' => array(GWF_Form::SUBMIT, $this->module->lang('btn_delete'), $this->module->lang('th_delete'))); return new GWF_Form($this, $data); }