/** * Produce virtualXML compliant content given a module object.\n * @param ModuleObject $oModule the module object * @return string **/ function toDoc(&$oModule) { $error = $oModule->getError(); $message = $oModule->getMessage(); $redirect_url = $oModule->get('redirect_url'); $request_uri = Context::get('xeRequestURI'); $request_url = Context::get('xeVirtualRequestUrl'); if (substr($request_url, -1) != '/') { $request_url .= '/'; } if ($error === 0) { if ($message != 'success') { $output->message = $message; } if ($redirect_url) { $output->url = $redirect_url; } else { $output->url = $request_uri; } } else { if ($message != 'fail') { $output->message = $message; } } $html = '<script type="text/javascript">' . "\n"; if ($output->message) { $html .= 'alert("' . $output->message . '");' . "\n"; } if ($output->url) { $url = preg_replace('/#(.+)$/i', '', $output->url); $html .= 'self.location.href = "' . $request_url . 'common/tpl/redirect.html?redirect_url=' . urlencode($url) . '";' . "\n"; } $html .= '</script>' . "\n"; return $html; }
/** * Produce JSON compliant content given a module object.\n * @param ModuleObject $oModule the module object * @return string */ function toDoc(&$oModule) { $variables = $oModule->getVariables(); $variables['error'] = $oModule->getError(); $variables['message'] = $oModule->getMessage(); return json_encode($variables); }
/** * Produce JSON compliant content given a module object.\n * @param ModuleObject $oModule the module object * @return string */ public function toDoc($oModule) { $variables = $oModule->getVariables(); $variables['error'] = $oModule->getError(); $variables['message'] = $oModule->getMessage(); self::_convertCompat($variables, Context::getRequestMethod()); return json_encode($variables); }
/** * Produce JSON compliant content given a module object.\n * @param ModuleObject $oModule the module object * @return string */ function toDoc(&$oModule) { $variables = $oModule->getVariables(); $variables['error'] = $oModule->getError(); $variables['message'] = $oModule->getMessage(); $json = str_replace(array("\r\n", "\n", "\t"), array('\\n', '\\n', '\\t'), json_encode2($variables)); return $json; }
/** * Produce XML compliant content given a module object.\n * @param ModuleObject $oModule the module object * @return string */ function toDoc(&$oModule) { $variables = $oModule->getVariables(); $xmlDoc = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<response>\n"; $xmlDoc .= sprintf("<error>%s</error>\n", $oModule->getError()); $xmlDoc .= sprintf("<message>%s</message>\n", str_replace(array('<', '>', '&'), array('<', '>', '&'), $oModule->getMessage())); $xmlDoc .= $this->_makeXmlDoc($variables); $xmlDoc .= "</response>"; return $xmlDoc; }
/** * Produce JSCallback compliant content given a module object.\n * @param ModuleObject $oModule the module object * @return string */ function toDoc(&$oModule) { $variables = $oModule->getVariables(); $variables['error'] = $oModule->getError(); $variables['message'] = $oModule->getMessage(); return sprintf('<script type="text/javascript"> //<![CDATA[ %s(%s); //]]> </script>', Context::getJSCallbackFunc(), json_encode($variables)); }
/** * Saves a Module object instance in the session. * * @param ModuleObject $module Module object to be stored. * @since 5.1 * @return void */ public function save(ModuleObject $module) { if (!$this->id) { $this->start(); } $sess_dir = $this->context->getHome() . 'sessions'; if (!file_exists($sess_dir)) { mkdir($sess_dir); } file_put_contents($sess_dir . '/sess_' . $this->id . '.ser', $module->serialize()); }
/** * Produce JSCallback compliant content given a module object.\n * @param ModuleObject $oModule the module object * @return string */ function toDoc(&$oModule) { $variables = $oModule->getVariables(); $variables['error'] = $oModule->getError(); $variables['message'] = $oModule->getMessage(); $json = str_replace(array("\r\n", "\n", "\t"), array('\\n', '\\n', '\\t'), json_encode2($variables)); return sprintf('<script type="text/javascript"> //<![CDATA[ %s(%s); //]]> </script>', Context::getJSCallbackFunc(), $json); }
/** * Produce JSON compliant content given a module object.\n * @param ModuleObject $oModule the module object * @return string */ public function toDoc($oModule) { $variables = $oModule->getVariables(); $variables['error'] = $oModule->getError(); $variables['message'] = $oModule->getMessage(); $temp = array(); foreach ($variables as $key => $value) { if (self::_isNumericArray($value)) { $temp[$key] = array_values($value); } else { $temp[$key] = $value; } } return json_encode($temp); }
/** * Calls the Module::moduleIntrospect method if it exists. * * A class can be documented as describer here: * http://xmlrpc-epi.sourceforge.net/specs/rfc.system.describeMethods.php * * @since 5.1 * @param array $userData * @return mixed */ private function introspectionGateway($userData) { if (method_exists($this->module, 'moduleIntrospect')) { return $this->module->moduleIntrospect(); } return false; }
protected function setAttributes() { if (empty($this->attachmentModule)) { $module = ModuleObject::getModule($this->_data['module']); if ($module->isLoaded()) { $this->setModule($module->name); if (!empty($this->_data['data_model'])) { $this->setModel($this->_data['data_model']); // TODO: If data model is ModuleObject or ModuleComponent, // Check if the module/component is in SystemAttachments // using entity_id and data_model } if (empty($this->_data['entity_id']) && $this->attachmentModel == 'moduleobject') { $this->_data['entity_id'] = $module->{$module->idField}; } if (empty($this->attachmentController)) { $this->setController($this->name); } // Need a better way of linking controller->model // perhaps should do it in module_components? if (empty($this->attachmentModel)) { $this->setModel(str_replace('scontroller', '', $controller->name)); } } } $this->getEntityId(); }
protected function loadModule($_module) { $module = ModuleObject::getModule($_module); if ($module->isLoaded()) { $this->prefs[$_module] = $module->settings; } }
static function getComponentId($_module_name, $_component_name) { $module = ModuleObject::getModule($_module_name); $modulecomponent = DataObjectFactory::Factory(__CLASS__); $modulecomponent->loadBy(array('name', 'module_id'), array($_component_name, $module->id)); return $modulecomponent->id; }
public function __destruct() { try { Session::getObject()->update(); } catch (QueryException $e) { Database::getObject()->getDebug()->add($e); throw $e; } parent::__destruct(); }
/** * Produce virtualXML compliant content given a module object.\n * @param ModuleObject $oModule the module object * @return string */ function toDoc(&$oModule) { $error = $oModule->getError(); $message = $oModule->getMessage(); $redirect_url = $oModule->get('redirect_url'); $request_uri = Context::get('xeRequestURI'); $request_url = Context::get('xeVirtualRequestUrl'); $output = new stdClass(); if (substr_compare($request_url, '/', -1) !== 0) { $request_url .= '/'; } if ($error === 0) { if ($message != 'success') { $output->message = $message; } if ($redirect_url) { $output->url = $redirect_url; } else { $output->url = $request_uri; } } else { if ($message != 'fail') { $output->message = $message; } } $html = array(); $html[] = '<script type="text/javascript">'; $html[] = '//<![CDATA['; if ($output->message) { $html[] = 'alert("' . $output->message . '");'; } if ($output->url) { $url = preg_replace('/#(.+)$/i', '', $output->url); $html[] = 'self.location.href = "' . $request_url . 'common/tpl/redirect.html?redirect_url=' . urlencode($url) . '";'; } $html[] = '//]]>'; $html[] = '</script>'; return join(PHP_EOL, $html); }
/** * Produce virtualXML compliant content given a module object.\n * @param ModuleObject $oModule the module object * @return string */ function toDoc(&$oModule) { $error = $oModule->getError(); $message = $oModule->getMessage(); $redirect_url = $oModule->get('redirect_url'); $request_uri = Context::get('xeRequestURI'); $request_url = Context::getRequestUri(); $output = new stdClass(); if (substr_compare($request_url, '/', -1) !== 0) { $request_url .= '/'; } if ($error === 0) { if ($redirect_url) { $output->url = $redirect_url; } else { $output->url = $request_uri; } } else { $output->message = $message; } $html = array(); $html[] = '<html>'; $html[] = '<head>'; $html[] = '<script>'; if ($output->message) { $html[] = 'alert(' . json_encode($output->message) . ');'; } if ($output->url) { $output->url = preg_replace('/#(.+)$/', '', $output->url); $html[] = 'if (opener) {'; $html[] = ' opener.location.href = ' . json_encode($output->url) . ';'; $html[] = '} else {'; $html[] = ' parent.location.href = ' . json_encode($output->url) . ';'; $html[] = '}'; } $html[] = '</script>'; $html[] = '</head><body></body></html>'; return join(PHP_EOL, $html); }
/** * Object constructor. * * @param ModuleConfig $config Module configuration object. * @since 5.1 */ public function __construct(\Innomatic\Module\ModuleConfig $config) { parent::__construct($config); // Data Access object /* $dasn = $this->config->getDASN(); if (!$dasn instanceof \Innomatic\Dataaccess\DataAccessSourceName) { throw new ModuleException('Missing DASN for persistent Module'); } $this->dataAccess = \Innomatic\Dataaccess\DataAccessFactory::getDataAccess($dasn); */ $this->dataAccess = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDataAccess(); // Data Access Object object $this->dataAccessObject = new \Innomatic\Module\Persist\ModuleAccessObject($this->dataAccess); $this->dataAccessObject->setValueObject($this->valueObject); $this->dataAccessObject->setConfig($this->config); }
function ModuleObject($config) { $this->MasterObject($config); include_once(LIB_PATH.'io.han.php'); self::$err_noData_help = <<<HELP 抱歉,当前无法连接到升级服务器!<br/> --------------------------<br/> <font id="update_server_test">正在重新检查...</font> <br/> --------------------------<br/> 如果有疑问,您可以联系在线客服QQ:<a href="#" onclick="javascript:window.open('http://bizapp.qq.com/webc.htm?new=0&sid=800058566&o=tttuangou.net&q=7', '_blank', 'height=544, width=644,toolbar=no,scrollbars=no,menubar=no,status=no');return false;">800058566</a><br/> (需要提供相应服务器权限) <script type="text/javascript">jQuery(document).ready(function(){jQuery.get('index.php?mod=apiz&code=update&op=ServerTest'+jQuery.rnd.stamp(), function(data){jQuery('#update_server_test').html(data)})});</script> HELP; $helpLinker = ihelper('tg.upgrade.error.format'); self::$err_Format_help = <<<HELP 抱歉,当前升级人数太多,请稍候进行尝试! <a href="{$helpLinker}" target="_blank">查看帮助</a> HELP; Load::moduleCode($this);$this->Execute(); }
/** * Produce HTML compliant content given a module object.\n * @param ModuleObject $oModule the module object * @return string compiled template string */ function toDoc(&$oModule) { $oTemplate = TemplateHandler::getInstance(); // compile module tpl // deprecated themes skin $template_path = $oModule->getTemplatePath(); if (!is_dir($template_path)) { if ($oModule->module_info->module == $oModule->module) { $skin = $oModule->origin_module_info->skin; } else { $skin = $oModule->module_config->skin; } if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false) { if ($skin && is_string($skin)) { $theme_skin = explode('|@|', $skin); $template_path = $oModule->getTemplatePath(); if (count($theme_skin) == 2) { $theme_path = sprintf('./themes/%s', $theme_skin[0]); // FIXME $theme_path $theme_path $theme_path ?? if (substr($theme_path, 0, strlen($theme_path)) != $theme_path) { $template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]); } } } else { $template_path = $oModule->getTemplatePath(); } } else { $template_path = $oModule->getTemplatePath(); } } $tpl_file = $oModule->getTemplateFile(); $output = $oTemplate->compile($template_path, $tpl_file); // add .x div for adminitration pages if (Context::getResponseMethod() == 'HTML') { if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0 && Context::get('act') != 'dispPageAdminContentModify' && Context::get('act') != 'dispPageAdminMobileContentModify') { $output = '<div class="x">' . $output . '</div>'; } if (Context::get('layout') != 'none') { if (__DEBUG__ == 3) { $start = getMicroTime(); } Context::set('content', $output, false); $layout_path = $oModule->getLayoutPath(); $layout_file = $oModule->getLayoutFile(); $edited_layout_file = $oModule->getEditedLayoutFile(); // get the layout information currently requested $oLayoutModel = getModel('layout'); $layout_info = Context::get('layout_info'); $layout_srl = $layout_info->layout_srl; // compile if connected to the layout if ($layout_srl > 0) { // handle separately if the layout is faceoff if ($layout_info && $layout_info->type == 'faceoff') { $oLayoutModel->doActivateFaceOff($layout_info); Context::set('layout_info', $layout_info); } // search if the changes CSS exists in the admin layout edit window $edited_layout_css = $oLayoutModel->getUserLayoutCss($layout_srl); if (FileHandler::exists($edited_layout_css)) { Context::loadFile(array($edited_layout_css, 'all', '', 100)); } } if (!$layout_path) { $layout_path = './common/tpl'; } if (!$layout_file) { $layout_file = 'default_layout'; } $output = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file); // if popup_layout, remove admin bar. $realLayoutPath = FileHandler::getRealPath($layout_path); if (substr_compare($realLayoutPath, '/', -1) !== 0) { $realLayoutPath .= '/'; } $pathInfo = pathinfo($layout_file); $onlyLayoutFile = $pathInfo['filename']; if ($realLayoutPath === _XE_PATH_ . 'common/tpl/' && $onlyLayoutFile === 'popup_layout') { Context::set('admin_bar', 'false'); } // DISABLE ADMIN BAR Context::set('admin_bar', 'false'); if (__DEBUG__ == 3) { $GLOBALS['__layout_compile_elapsed__'] = getMicroTime() - $start; } if (stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && (Context::get('_use_ssl') == 'optional' || Context::get('_use_ssl') == 'always')) { Context::addHtmlFooter('<iframe id="xeTmpIframe" name="xeTmpIframe" style="width:1px;height:1px;position:absolute;top:-2px;left:-2px;"></iframe>'); } } } return $output; }
/** * Single Sign On (SSO) * * @return bool True : Module handling is necessary in the control path of current request , False : Otherwise */ function checkSSO() { // pass if it's not GET request or XE is not yet installed if ($this->db_info->use_sso != 'Y' || isCrawler()) { return TRUE; } $checkActList = array('rss' => 1, 'atom' => 1); if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) { return TRUE; } // pass if default URL is not set $default_url = trim($this->db_info->default_url); if (!$default_url) { return TRUE; } if (substr_compare($default_url, '/', -1) !== 0) { $default_url .= '/'; } // for sites recieving SSO valdiation if ($default_url == self::getRequestUri()) { if (self::get('default_url')) { $url = base64_decode(self::get('default_url')); $url_info = parse_url($url); $oModuleModel = getModel('module'); $site_info = $oModuleModel->getSiteInfoByDomain($url_info['host']); if (!$site_info->site_srl) { $oModuleObject = new ModuleObject(); $oModuleObject->stop('msg_invalid_request'); return false; } $url_info['query'] .= ($url_info['query'] ? '&' : '') . 'SSOID=' . session_id(); $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']); header('location:' . $redirect_url); return FALSE; } // for sites requesting SSO validation } else { // result handling : set session_name() if ($session_name = self::get('SSOID')) { setcookie(session_name(), $session_name); $url = preg_replace('/([\\?\\&])$/', '', str_replace('SSOID=' . $session_name, '', self::getRequestUrl())); header('location:' . $url); return FALSE; // send SSO request } else { if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) { setcookie('sso', md5(self::getRequestUri()), 0, '/'); $url = sprintf("%s?default_url=%s", $default_url, base64_encode(self::getRequestUrl())); header('location:' . $url); return FALSE; } } } return TRUE; }
private function buildDirTree($mydatapath, $module_id, $type = '', $parent_name = '') { if (file_exists(FILE_ROOT . $mydatapath)) { $files = array(); $mydata = dir(FILE_ROOT . $mydatapath); while (($current = $mydata->read()) !== false) { if (substr($current, 0, 1) != '.' && $current != 'CVS') { if (is_dir($mydatapath . $current)) { $module = new ModuleObject(); $module->loadBy('name', $current); if (!$module->isLoaded()) { if ($type != 'T') { $current_type = isset($this->components[$current]) ? $this->components[$current] : $type; } else { $current_type = $type; } $files[$current] = $this->buildDirTree($mydatapath . $current . DIRECTORY_SEPARATOR, $module_id, $current_type, $current); } } elseif (is_file($mydatapath . $current)) { if ($type == 'C') { $name = strtolower(str_replace('.php', '', $current)); } else { // ATTN: switch (get_file_extension($current)) { if (substr($current, -4) == '.css') { $type = 'S'; } if (substr($current, -3) == '.js') { $type = 'J'; } if (substr($current, -4) == '.yml') { $type = 'Y'; } if (empty($type) && substr($current, -4) == '.php') { $type = 'M'; } $name = strtolower(substr_replace($current, '', strrpos($current, '.'))); } $component = new ModuleComponent(); $component->loadBy(array('name', 'type', 'module_id'), array($name, $type, $module_id)); $component->addField('register', new DataField('register', false)); if (!$component->isLoaded()) { $component->name = $name; $component->type = $type; $component->module_id = $module_id; } else { $component->register = true; } if ($type == 'T') { $component->controller = $parent_name; } else { $component->controller = null; } $component->location = str_replace(FILE_ROOT, '', $mydatapath . $current); $files[$component->name] = $component; } } } ksort($files); $mydata->close(); return $files; } else { return FALSE; } }
public function get_modules_list() { $module_object = new ModuleObject(); return $module_object->getAll(); }