public static function init($config = array()) { //-- todo : load log handler here // load system config sys::import('webi.config'); wbConfig::init(); // load variables handler, server/request/response utilities sys::import('webi.server'); sys::import('webi.nusoap'); // load template, page handler sys::import('webi.template'); sys::import('webi.htmlElementWidget'); wbPage::init(); // load database sys::import('webi.db'); $dbConnParams = array('name' => wbConfig::get('DB.name'), 'user' => wbConfig::get('DB.user'), 'password' => wbConfig::get('DB.password'), 'host' => wbConfig::get('DB.host'), 'type' => wbConfig::get('DB.type')); wbDB::init($dbConnParams); // load session handler sys::import('webi.sessions'); wbSession::init(); //-- todo : load language system // load utilities function sys::import('webi.utils'); // load module handler sys::import('webi.modules'); sys::import('webi.crud.AbstractTable'); //-- todo : load users and security system sys::import('webi.users'); wbUser::init(); sys::import('webi.security'); return true; }
public static function main() { if (!wbUser::isLoggedIn()) { $redirecturl = wbModule::url('bds', 'bds', 'main'); wbResponse::Redirect(wbModule::url('base', 'base', 'loginform', array('redirecturl' => urlencode($redirecturl)))); } $loadjsmod = wbRequest::getVarClean('loadjsmod', 'str', ''); wbPage::setPage('jspage'); $userInfo = wbUser::getSession(); $role = ''; if (isset($userInfo['roles'][0]['role_name'])) { $role = strtolower($userInfo['roles'][0]['role_name']); } $script = <<<HEREDOC Webi.ROUTE_URL = "ws.php?type=json&module=bds"; var _UNAME = "{$userInfo['user_name']}"; var _RNAME = "{$userInfo['user_realname']}"; var _GNAME = "{$role}"; HEREDOC; wbPage::addScriptCode($script); wbPage::addScript('modules/bds/views/script/properties.js'); wbPage::addScript('modules/bds/views/script/GridPanel.js'); wbPage::addScript('modules/bds/views/script/FormPanel.js'); wbPage::addScript('modules/bds/views/script/ModulePanel.js'); wbPage::addScript('modules/base/views/script/roles-jsloader.php'); wbPage::addScript('modules/bds/views/script/jsloader.php'); return array('loadjsmod' => $loadjsmod); }
function wbMain() { wbCore::init(); list($module, $class, $method) = wbRequest::getController(); // theme override $theme = wbRequest::getVarClean('theme'); if (!empty($theme)) { wbPage::setTheme($theme); } $page = wbRequest::getVarClean('page'); if (!empty($page)) { wbPage::setPage($page); } ob_start(); $modView = wbModule::getView($module, $class, $method); if (ob_get_length() > 0) { $rawOutput = ob_get_contents(); $modView = 'The following lines were printed in raw mode by module, however this should not happen. The module is probably directly calling functions like echo, print, or printf. Please modify the module to exclude direct output. The module is violating Webi architecture principles.<br /><br />' . $rawOutput . '<br /><br />This is the real module output:<br /><br />' . $modView; } ob_end_clean(); wbPage::render($modView); }
public static function menuNodes() { wbPage::setPage('blank'); $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => ''); /*try{ $ws_client = self::getNusoap(); $params = array('search' => '', 'getParams' => json_encode($_GET), 'controller' => json_encode(array('module' => 'bds','class' => 'p_app_menu', 'method' => 'menunodes', 'type' => 'json' )), 'postParams' => json_encode($_POST), 'jsonItems' => '', 'start' => $start, 'limit' => $limit); $ws_data = self::getResultData($ws_client, $params); $data['menu'] = $ws_data ['data']; $data['total'] = $ws_data ['total']; $data['message'] = $ws_data ['message']; $data['success'] = $ws_data ['success']; }catch (Exception $e) { $data['message'] = $e->getMessage(); } return $data;*/ return array(); }
public static function showException($e) { if (ob_get_level() > 0) { ob_end_clean(); } $file = self::stripFilePath($e->getFile()); $error = $e->getCode() . " (" . get_class($e) . ")"; $message = $e->getMessage(); $line = $e->getLine(); $backtrace = "<p>" . str_replace("\n", "<br/>", $e->getTraceAsString()) . "</p>"; ob_start(); include 'themes/' . wbPage::getThemeName() . '/templates/exception-error.php'; $errorMsg = ob_get_contents(); ob_end_clean(); wbPage::render($errorMsg); }
public static function lupa_password() { wbPage::setPage('default'); try { $ws_client = self::getNusoap(); $params = array('search' => '', 'getParams' => json_encode($_GET), 'controller' => json_encode(array('module' => 'bds', 'class' => 'helper', 'method' => 'read_pertanyaan', 'type' => 'json')), 'postParams' => json_encode($_POST), 'jsonItems' => '', 'start' => $start, 'limit' => $limit); $ws_data = self::getResultData($ws_client, $params); $data['items'] = $ws_data['data']; $data['total'] = $ws_data['total']; $data['message'] = $ws_data['message']; $data['success'] = $ws_data['success']; } catch (Exception $e) { $data['message'] = $e->getMessage(); } $listPertanyaan = $data['items']; $email = wbRequest::getVarClean('email', 'str', ''); $npwpd = wbRequest::getVarClean('npwpd', 'str', ''); $user_name = wbRequest::getVarClean('user_name', 'str', ''); $question = wbRequest::getVarClean('question', 'str', ''); $answer = wbRequest::getVarClean('answer', 'str', ''); $errorMsg = wbRequest::getVarClean('errorMsg', 'str', ''); return array('pertanyaan' => $listPertanyaan, 'email' => $email, 'npwpd' => $npwpd, 'user_name' => $user_name, 'question' => $question, 'answer' => $answer, 'errorMsg' => $errorMsg); }
public static function setContent($content) { self::$content = $content; }
public function transaction_info() { wbPage::setPage('blank'); return array(); }