/** * プライベートメッセージチェックバリデータクラス * Filterとして行うべきだが、実装していないためValidatorとして実装 * * @param mixed $attributes チェックする値(配列の場合あり) * @param string $errStr エラー文字列 * @param array $params (使用しない) * @return string エラー文字列(エラーの場合) * @access public */ function validate($attributes, $errStr, $params) { $container =& DIContainerFactory::getContainer(); $session =& $container->getComponent('Session'); $user_id = $session->getParameter('_user_id'); if (empty($user_id)) { return; } $modulesView =& $container->getComponent('modulesView'); $pm_module = $modulesView->getModuleByDirname('pm'); if (!isset($pm_module['module_id'])) { return; } if ($session->getParameter('_user_auth_id') < _AUTH_GENERAL) { return; } $authoritiesView =& $container->getComponent('authoritiesView'); $_role_auth_id = $session->getParameter('_role_auth_id'); $where_params = array('{modules}.module_id' => $pm_module['module_id']); $authorities = $authoritiesView->getAuthoritiesModulesLinkByAuthorityId($_role_auth_id, $where_params); if ($authorities === false || !isset($authorities[0]) || $authorities[0]['authority_id'] === null) { return; } $renderer =& SmartyTemplate::getInstance(); $renderer->assign('_pm_use_flag', _ON); $commonMain =& $container->getComponent('commonMain'); $request =& $container->getComponent('Request'); require_once WEBAPP_DIR . '/modules/pm/config/define.inc.php'; $pmView =& $commonMain->registerClass(WEBAPP_DIR . '/modules/pm/components/View.class.php', 'Pm_Components_View', 'pmView'); $request->setParameter('filter', PM_FILTER_UNREAD); $new_message_count = $pmView->getMessageCount(); $request->setParameter('filter', ''); $renderer->assign('_pm_new_message_count', $new_message_count); return; }
/** * コンストラクター * * @access public */ function Login_Components_View() { $log =& LogFactory::getLog(); $log->trace("component login View のコンストラクタが実行されました", "loginView#Login_View"); $this->_container =& DIContainerFactory::getContainer(); $this->_config =& $this->_container->getComponent("configView"); $renderer =& SmartyTemplate::getInstance(); $renderer->assign('autoregist_use', $this->getAutoregistUse()); $renderer->assign('autoregist_disclaimer', $this->getDisclaimer()); }
/** * コンストラクター * * @access public */ function Pages_Components_Compmain() { $this->_container =& DIContainerFactory::getContainer(); $this->_session =& $this->_container->getComponent("Session"); $this->_renderer =& SmartyTemplate::getInstance(); $this->_lang = $this->_session->getParameter("_lang"); $this->_response =& $this->_container->getComponent("Response"); $this->_request =& $this->_container->getComponent("Request"); $this->_getdata =& $this->_container->getComponent("GetData"); $this->_common =& $this->_container->getComponent("commonMain"); }
/** * execute実行 * * @access public */ function execute() { $config = $this->configView->getConfigByCatid(_SYS_CONF_MODID, _ENTER_EXIT_CONF_CATID); if ($config === false) { return 'error'; } //$config_sitename = $configView->getConfigByConfname(_SYS_CONF_MODID, "sitename"); //if($config_sitename === false) return 'error'; //$sitename = $config_sitename['conf_value']; $meta =& $this->session->getParameter("_meta"); //自動的に退会させる $params = array("user_id" => $this->user_id, "_header" => "0", "_output" => "0"); $html = $this->preexecuteMain->preExecute("user_action_admin_delete", $params); $error_prefix = ERROR_MESSAGE_PREFIX; if (strlen($html) != strlen($error_prefix) && preg_match("/^" . $error_prefix . "/i", $html)) { // エラー return 'error'; } // ---------------------------------------------------------------------- // --- 管理者へのメール通知処理 --- // ---------------------------------------------------------------------- if ($config['withdraw_membership_send_admin']['conf_value'] == _ON) { // 管理者取得 $users = $this->usersView->getSendMailUsers(null, _AUTH_ADMIN, "text"); $this->mailMain->setToUsers($users); $subject = str_replace("{X-SITE_NAME}", $meta['sitename'], $config['mail_withdraw_membership_subject']['conf_value']); $subject = str_replace("{X-HANDLE}", $this->session->getParameter("_handle"), $subject); $body = str_replace("{X-SITE_NAME}", htmlspecialchars($meta['sitename']), $config['mail_withdraw_membership_body']['conf_value']); $body = str_replace("{X-HANDLE}", htmlspecialchars($this->session->getParameter("_handle")), $body); $this->mailMain->setSubject($subject); $this->mailMain->setBody($body); //$tags["X-SITE_NAME"] = $meta['sitename']; //$this->mailMain->assign($tags); $this->mailMain->send(); } // // リダイレクト // $this->redirect_url = BASE_URL . INDEX_FILE_NAME; $renderer =& SmartyTemplate::getInstance(); $renderer->assign('header_field', $this->configView->getMetaHeader()); $this->redirect_message = USERINF_MES_WITHDRAW_REDIRECT; $this->session->close(); return 'success'; }
/** * パスワード紛失、メール送信処理 * * @access public */ function execute() { $config = $this->configView->getConfigByCatid(_SYS_CONF_MODID, _ENTER_EXIT_CONF_CATID); $userInfo = LOGIN_HANDLE . _SEPARATOR2 . $this->user['handle'] . "\n" . LOGIN_NAME . _SEPARATOR2 . $this->user['login_id'] . "\n"; if ($this->code_date == null) { $new_code_date = substr($this->user['password'], 0, 10); $mail_get_password_subject = $config['mail_get_password_subject']['conf_value']; $mail_get_password_body = $config['mail_get_password_body']['conf_value']; $mail_get_password_body .= "<br /><br />"; $mail_get_password_body .= htmlspecialchars($userInfo) . '<br />' . BASE_URL . INDEX_FILE_NAME . '?action=login_action_main_forgetpass' . '&email=' . $this->send_email . '&code_date=' . $new_code_date . '&_header=' . _OFF . '<br />'; $this->mailMain->setSubject($mail_get_password_subject); $this->mailMain->setBody($mail_get_password_body); } else { // 新規パスワード発行処理 $newpass = $this->makePassword(); $this->redirect_url = BASE_URL . INDEX_FILE_NAME; $this->redirect_message = LOGIN_MES_NEW_PASS; $mail_new_password_subject = $config['mail_new_password_subject']['conf_value']; $mail_new_password_body = $config['mail_new_password_body']['conf_value']; $mail_new_password_body .= "<br /><br />"; $userInfo .= LOGIN_PASSWORD . _SEPARATOR2 . $newpass . "\n"; $mail_new_password_body .= htmlspecialchars($userInfo) . '<br />' . '<br />' . $this->redirect_url . '<br />'; $this->mailMain->setSubject($mail_new_password_subject); $this->mailMain->setBody($mail_new_password_body); // パスワード変更日時更新 $params = array("password" => md5($newpass), "password_regist_time" => timezone_date()); $where_params = array("user_id" => $this->user['user_id']); $result = $this->usersAction->updUsers($params, $where_params); if ($result === false) { return 'error'; } } $this->user['email'] = $this->send_email; $this->user['type'] = "text"; // Text固定(html or text) $this->mailMain->addToUser($this->user); $this->mailMain->send(); if ($this->code_date != null) { $renderer =& SmartyTemplate::getInstance(); $renderer->assign('header_field', $this->configView->getMetaHeader()); return 'success_new_pass'; } return 'success'; }
/** * 言語モジュールのチェック * Filterとして行うべきだが、実装していないためValidatorとして実装 * * @param mixed $attributes チェックする値(配列の場合あり) * @param string $errStr エラー文字列 * @param array $params (使用しない) * @return string エラー文字列(エラーの場合) * @access public */ function validate($attributes, $errStr, $params) { $container =& DIContainerFactory::getContainer(); $renderer =& SmartyTemplate::getInstance(); $modulesView =& $container->getComponent("modulesView"); $module = $modulesView->getModuleByDirname("language"); if (!isset($module['module_id'])) { return; } $renderer->assign('_language_install_flag', _ON); $languagesView =& $container->getComponent("languagesView"); $languages =& $languagesView->getLanguagesList(); if ($languages === false) { return $errStr; } $request =& $container->getComponent("Request"); $request->setParameter('languages', $languages); return; }
/** * addHeaderメソッドよりaddした文字列を削除するメソッド * @param string $value head以下に追加する文字列から指定したもののみ削除 * @access public */ function delHeader($value = null) { $renderer =& SmartyTemplate::getInstance(); $add_header_fields = $renderer->get_template_vars('add_header_fields'); if (is_null($value)) { $add_header_fields = null; } else { if (isset($add_header_fields[$value])) { unset($add_header_fields[$value]); } } $renderer->assign('add_header_fields', $add_header_fields); }
function execute() { //ヘッダー表示:非表示 $header = $this->request->getParameter("_header"); if (!isset($header)) { //default:ヘッダーを表示する $header = 1; } //出力用バッファをクリア(消去)し、出力のバッファリングをオフ //$ob_buffer = ob_get_contents(); //ob_end_clean(); $this->_renderer =& SmartyTemplate::getInstance(); $main_blocks =& $this->getData->getParameter("blocks"); if ($main_blocks[$this->block_id]['action_name'] != "pages_view_grouping") { //エラー exit; } if ($header) { //ヘッダー読み込み $headerInc = new Headerinc_View_Main(); } $pages_obj = $this->getData->getParameter("pages"); //main_action_nameをassign $this->_renderer->assign('main_action_name', $this->session->getParameter('main_action_name')); //$this->_renderer->assign('main_block_id',null); //$this->_renderer->assign('main_block_id',$this->block_id); $page_id = $main_blocks[$this->block_id]['page_id']; $css = array(); $js = array(); $block_objs = array(); $block_objs_id = array(); $_theme_list = $this->session->getParameter("_theme_list"); if ($this->blocktheme_name != null) { if ($this->blocktheme_name == "_auto") { $this->blocktheme_name = $_theme_list[$pages_obj[$page_id]['display_position']]; } $main_blocks[$this->block_id]['theme_name'] = $this->blocktheme_name; } else { if ($main_blocks[$this->block_id]['theme_name'] == "") { $main_blocks[$this->block_id]['theme_name'] = $_theme_list[$pages_obj[$page_id]['display_position']]; } } $themeStrList = explode("_", $main_blocks[$this->block_id]['theme_name']); if (count($themeStrList) == 1) { $themeDir = "/themes/" . $main_blocks[$this->block_id]['theme_name'] . "/templates"; } else { $bufthemeStr = array_shift($themeStrList); $themeDir = "/themes/" . $bufthemeStr . "/templates/" . implode("/", $themeStrList); } $all_headerinc_arr = array("css" => array("blocks:style.css" . $main_blocks[$this->block_id]['theme_name'] => BASE_URL . "/" . $themeDir . "/style.css")); //------------------------------------------------- //ブロック情報取得 //------------------------------------------------- $blocks = $this->blocksView->getBlockByPageId($page_id); //$page_obj = $this->pagesView->getPageById($page_id); $main_thread_num = $main_blocks[$this->block_id]['thread_num']; $include_dir_name_arr = array(); $include_dir_name_css_arr = array(); $include_block_id_css_arr = array(); if (is_array($blocks)) { $count = 0; //parent_id取得 //if($main_blocks[$this->block_id]['parent_id'] == 0) $parent_id = $main_blocks[$this->block_id]['block_id']; //else // $parent_id = $main_blocks[$this->block_id]['parent_id']; $parent_arr = array($main_blocks[$this->block_id]['block_id']); //modulesオブジェクト取得 $moduleidList = array(); foreach ($blocks as $block) { $moduleidList[$block['module_id']] = $block['module_id']; } //$modules_obj = null; $func = array($this, 'fetchcallback'); list($modules_obj, $include_dir_name_arr) = $this->modulesView->getModulesById($moduleidList, $func); $this->getData->setParameter("modules", $modules_obj); foreach ($blocks as $block) { if ($block['url'] == "" || $block['url'] == null || $block['url'] == BASE_URL) { $mysite = true; $blocks[$count]['full_path'] = BASE_URL . INDEX_FILE_NAME . "?action=" . $block['action_name'] . "&block_id=" . $block['block_id'] . "&page_id=" . $block['page_id']; //絶対座標に変換 //$blocks[$count]['full_path'] = BASE_URL.INDEX_FILE_NAME."?action=".$block['action_name'].$block['parameters']."&block_id=".$block['block_id']."&page_id=".$block['page_id']; //絶対座標に変換 } else { $mysite = false; $blocks[$count]['full_path'] = $block['url'] . "?action=" . $block['action_name'] . "&block_id=" . $block['block_id'] . "&page_id=" . $block['page_id']; //絶対座標に変換 //$blocks[$count]['full_path'] = $block['url']."?action=".$block['action_name'].$block['parameters']."&block_id=".$block['block_id']."&page_id=".$block['page_id']; //絶対座標に変換 } //グループ化したブロックの子供ならばデータ取得 if ($block['block_id'] == $this->block_id) { $blocks[$count]['theme_name'] = $main_blocks[$this->block_id]['theme_name']; $block_objs[$pages_obj[$page_id]['display_position']][$block['parent_id']][$block['col_num']][$block['row_num']] = $blocks[$count]; $block_objs_id[$block['block_id']] =& $blocks[$count]; //$this->getData->setParameter("blocks",$block_objs_id); } else { if (in_array($block['parent_id'], $parent_arr)) { $block_objs[$pages_obj[$page_id]['display_position']][$block['parent_id']][$block['col_num']][$block['row_num']] = $blocks[$count]; $block_objs_id[$block['block_id']] =& $blocks[$count]; $this->getData->setParameter("blocks", $block_objs_id); if ($block['action_name'] != "pages_view_grouping") { //既に読み込んでいる場合、スキップ if ($header && !isset($headerinc_buf[$block['url'] . ":" . $block['action_name'] . ":" . $block['theme_name'] . ":" . $block['temp_name']])) { if ($mysite) { //自サイト //include_header読み込み $headerInc->setParams($block['action_name'], $block['block_id'], $block['theme_name'], $block['temp_name']); $res = $headerInc->execute(); if ($res) { $this->pagesCompmain->setHeaderArray($res, $block, $all_headerinc_arr); } } else { //他サイト $header_url = $block['url'] . "?action=headerinc_view_main&action_name=" . $block['action_name'] . $block['parameters'] . "&theme_name=" . $block['theme_name'] . "&temp_name=" . $block['temp_name'] . "&print_flag=1"; //TODO:他サイトの場合、キャッシュをもたせるようなしくみが必要 //また無駄なフィルターをチェックしないようにする? $res = $this->requestMain->getResponseHtml($header_url); $this->pagesCompmain->setHeaderArray($res, $block, $all_headerinc_arr); } $headerinc_buf[$block['url'] . ":" . $block['action_name'] . ":" . $block['theme_name'] . ":" . $block['temp_name']] = true; } //権限設定 //$this->session->setParameter("_auth_id",$pages_obj[$block['page_id']]['authority_id']); //$this->session->setParameter("_hierarchy", intval($pages_obj[$block['page_id']]['hierarchy'])); //ob_start(); if ($mysite) { //parametersの配列分解 $parameters = split("&", $block['parameters']); $params_sub = array(); foreach ($parameters as $parameter) { $paramArray = split('=', $parameter); if ($paramArray[0] != "") { $params_sub[$paramArray[0]] = $paramArray[1]; } } $params = array("action" => $block['action_name'], "theme_name" => $block['theme_name'], "temp_name" => $block['temp_name'], "page_id" => $page_id, "module_id" => $block['module_id'], "block_id" => $block['block_id'], "_header" => "0", "_output" => "0"); $params = array_merge($params, $params_sub); if ($block['shortcut_flag']) { $buf_id = $params['block_id']; $params['block_id'] = $params['_ref_block_id']; $params['_ref_block_id'] = $buf_id; } $this->commonMain->getTopId($block['block_id'], $block['module_id']); $this->preexecute->preExecute($block['action_name'], $params); $html[$block['block_id']] = $this->response->getResult(); } else { //TODO:他サイトの場合、キャッシュをもたせるようなしくみが必要 $html[$block['block_id']] = $this->requestMain->getResponseHtml($blocks[$count]['full_path']); } } else { $parent_arr[] = $block['block_id']; } } } $include_dir_name_css_arr[$block['theme_name']] = $block['theme_name']; $include_block_id_css_arr[] = $block['block_id']; $count++; } } else { //エラー exit; } //ページタイトルをセッションに代入 $this->session->setParameter("_page_title", $main_blocks[$this->block_id]['block_name']); //------------------------------------------------- // コンテンツ //------------------------------------------------- if (is_array($block_objs)) { $template_dir = WEBAPP_DIR . "/templates/" . "main/"; $this->_renderer->setTemplateDir($template_dir); //キャッシュ処理をしない //$caching = $this->_renderer->getCaching(); //$this->_renderer->setCaching(0); $main_result = $this->pagesCompmain->setPageFetch($block_objs, $pages_obj, $html, $template_dir, $pages_obj[$page_id]['display_position'], $main_blocks[$this->block_id]['parent_id'], $main_blocks[$this->block_id]['thread_num'], true); //キャッシュ処理を元に戻す //$this->_renderer->setCaching($caching); if (!$header) { $script_str =& $this->getData->getParameter("script_str"); $main_result = $main_result . "<script class=\"nc_script\" type=\"text/javascript\">" . $script_str . "</script>"; } } //------------------------------------------------- // ヘッダー //------------------------------------------------- if ($header) { $this->pagesCompmain->showHeader($pages_obj[$page_id], $include_dir_name_arr, $all_headerinc_arr, $include_dir_name_css_arr, $include_block_id_css_arr); } if (isset($main_result)) { print $main_result; if ($header) { print "<input type=\"hidden\" id=\"_grouping_thread_num\" value=\"" . ($main_blocks[$this->block_id]['thread_num'] + 1) . "\"/>"; print "<input type=\"hidden\" id=\"_grouping_parent_id\" value=\"" . $main_blocks[$this->block_id]['block_id'] . "\"/>"; } } //------------------------------------------------- // フッター //------------------------------------------------- if ($header) { $this->pagesCompmain->showFooter($pages_obj[$page_id], $include_dir_name_arr); } return 'success'; }
function execute() { //出力用バッファをクリア(消去)し、出力のバッファリングをオフ //$ob_buffer = ob_get_contents(); //ob_end_clean(); $container =& DIContainerFactory::getContainer(); $request =& $container->getComponent("Request"); $renderer =& SmartyTemplate::getInstance(); $script_str =& $this->getdata->getParameter("script_str"); $script_str .= "controlCls.controlInit();"; $this->getdata->setParameter("script_str", $script_str); $this->current_page_id = intval($this->current_page_id); if ($this->session->getParameter("_permalink_flag") && $this->current_page_id > 0) { $result = $this->db->selectExecute("pages", array("page_id" => $this->current_page_id), null, 1, 0); if (isset($result[0]) && $result[0]['permalink'] != "") { $edit_end_url = BASE_URL . '/' . $result[0]['permalink']; if ($result[0]['permalink'] != "") { $edit_end_url .= '/'; } } else { $edit_end_url = BASE_URL . '/'; } } else { $edit_end_url = BASE_URL; if ($this->current_page_id > 0) { $edit_end_url .= "/?page_id=" . $this->current_page_id; } } $renderer->assign('edit_end_url', $edit_end_url); //$session =& $container->getComponent("Session"); $this->_lang = $this->session->getParameter("_lang"); //$_user_id = $session->getParameter("_user_id"); //$_site_id = $session->getParameter("_site_id"); //$main_cache_id = "main_control_panel"; //$user_main_cache_id = "control_panel" . md5($session->getID()). "_" .$_user_id . "_" . $_site_id; $token =& $container->getComponent("Token"); if (is_object($token)) { $renderer->setToken($token); } //$session =& $container->getComponent("Session"); $this->session->setParameter("_page_title", CONTROL_TITLE); //if (is_object($this->session)) { // $renderer->setSession($this->session); //} $url = BASE_URL . INDEX_FILE_NAME . "?action=control_view_main"; //URL-Assign $renderer->assign('url', $url); //header表示-------------------------------------------------- // // ヘッダー、META情報取得 // $config =& $container->getComponent("configView"); $themeStr = "default"; //コントロールjs //$meta['script_header'] .= "<script type=\"text/javascript\" src=\"./js/control/control.js\"></script>"; // //データ取得 // $modules_obj =& $this->modules->getModulesByRoleAuthorityId($this->session->getParameter("_role_auth_id")); //$modules_obj =& $this->modules->getModulesBySystemflag(1); $headerInc = new Headerinc_View_Main(); $all_headerinc_arr = array(); $include_dir_name_arr = array(); foreach ($modules_obj as $key => $module_obj) { $pathList = explode("_", $module_obj['action_name']); $modules_obj[$key]['dir_name'] = $pathList[0]; //include_header読み込み $headerInc->setParams($module_obj['action_name'], null, $module_obj['theme_name'], $module_obj['temp_name']); $res = $headerInc->execute(); if ($res) { $this->_setHeaderArray($res, $all_headerinc_arr, $module_obj); } //iconセット //なければnoimageを表示 $image_path = HTDOCS_DIR . "/images/" . $pathList[0] . "/" . $modules_obj[$key]['module_icon']; if (file_exists($image_path)) { $modules_obj[$key]['icon_path'] = $pathList[0] . "/" . $modules_obj[$key]['module_icon']; } else { $modules_obj[$key]['icon_path'] = "common/noimage.gif"; } $include_dir_name_arr[] = $pathList[0]; } $renderer->assign('modules_obj', $modules_obj); $meta = $config->getMetaHeader(null, $include_dir_name_arr, true); //コントロールCSS ////$meta['css_header'] .= "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"./css/control/style.css\" />"; //if(isset($all_headerinc_arr['js'])) { // foreach($all_headerinc_arr['js'] as $value) { // if($value) { // $meta['script_header'] .= "<script type=\"text/javascript\" src=\"".$value."\"></script>"; // } // } //} if (isset($all_headerinc_arr['css'])) { foreach ($all_headerinc_arr['css'] as $key => $value) { if ($value) { $meta['css_header'][$value] = $value; } } } // モジュールのJavascriptインクルード $meta['template_header'] = ""; if (isset($all_headerinc_arr['template'])) { foreach ($all_headerinc_arr['template'] as $value) { if ($value) { $meta['template_header'] .= $value; } } } $renderer->assign('header_field', $meta); $template_dir = WEBAPP_DIR . "/templates/" . "main/"; $template_name = "header.html"; //キャッシュ処理をしない $caching = $renderer->getCaching(); $renderer->setCaching(0); //template_dirセット $renderer->setTemplateDir($template_dir); $result = $renderer->fetch($template_name, "control_header", "/templates/" . "main/"); print $result; flush(); //キャッシュ処理を元に戻す $renderer->setCaching($caching); //$token =& $container->getComponent("Token"); //$timeout_time = $this->session->getParameter('_session_gc_maxlifetime')*60; //$footer_field['script_footer'] .= "commonCls.commonInit('"._SESSION_TIMEOUT_ALERT."',".$timeout_time.");"; //$footer_field['script_footer'] .= "loginCls['_0'] = new clsLogin(\"_0\");"; flush(); //header終了---------------------------------------------------- //if($ob_buffer) { // print $ob_buffer; // flush(); //} //debug if ($renderer->debugging) { $template_dir = BASE_DIR . "/"; $template_debug = "webapp/templates/main/debug.html"; //キャッシュ処理をしない $caching = $renderer->getCaching(); $renderer->setCaching(0); //template_dirセット $renderer->setTemplateDir($template_dir); //Debug部分 print $renderer->fetch($template_debug, "control_debug", "/templates/" . "main/"); flush(); //キャッシュ処理を元に戻す $renderer->setCaching($caching); } // //cache_idセット // $common =& $container->getComponent("commonMain"); $cache_id = $common->getCacheid(); $template_dir = MODULE_DIR . "/control/templates/default/"; //default固定 $template_name = "control.html"; //キャッシュ処理をしない $caching = $renderer->getCaching(); $renderer->setCaching(0); //template_dirセット $renderer->setTemplateDir($template_dir); $result = $renderer->fetch($template_name, $cache_id, "/control/templates/default/"); print $result; flush(); //キャッシュ処理を元に戻す $renderer->setCaching($caching); //footer表示-------------------------------------------------- //$footer_field['template_footer'] = ""; $renderer->assign('footer_field', $config->terminateFooter($include_dir_name_arr, true)); $template_dir = WEBAPP_DIR . "/templates/" . "main/"; $template_name = "footer.html"; //キャッシュ処理をしない $caching = $renderer->getCaching(); $renderer->setCaching(0); //template_dirセット $renderer->setTemplateDir($template_dir); $result = $renderer->fetch($template_name, "control_footer", "/templates/" . "main/"); print $result; //キャッシュ処理を元に戻す $renderer->setCaching($caching); //footer終了---------------------------------------------------- return 'success'; }
/** * ポストフィルタ * Viewの処理を実行 * @access private */ function _postfilter() { $renderer =& SmartyTemplate::getInstance(); $nouse = $this->getAttribute("define:nouse"); if (isset($nouse) && $nouse == 1) { return; } //ブロック情報読み込み $block_id = intval($this->_request->getParameter("block_id")); //アクション名よりテンプレートパスを取得 $action_name = $this->_actionChain->getCurActionName(); $pathList = explode("_", $action_name); // // リクエスト値を取得 // $action = $this->_request->getParameter(ACTION_KEY) ? $this->_request->getParameter(ACTION_KEY) : DEFAULT_ACTION; // //cache_idセット // $common =& $this->_container->getComponent("commonMain"); $cache_id = $common->getCacheid(); $view = $this->_response->getView(); $result = ""; $header = _OFF; $action_flag = false; $attachment = $this->getAttribute("define:attachment"); if (!isset($attachment)) { //default:ファイル添付していない $attachment = _OFF; } // // 印刷アイコンをつけるかどうか // $print_html = ""; $print = $this->getAttribute("define:print"); if (isset($print)) { $printList = explode(",", $print); $print_len = count($printList); if ($print_len == 1) { $print = intval($printList[0]); } else { $print = _OFF; for ($i = 1; $i < $print_len; $i++) { if ($view == $printList[$i]) { $print = intval($printList[0]); break; } } } if ($print == _ON) { $_themes_images_path = get_themes_image("print.gif"); $print_html = "<div class=\"align-right print_preview_none\">" . "<a class=\"link\" href=\"#\" onclick=\"commonCls.print(Element.getParentElement(this, 2)); return false;\">" . "<img title=\"" . _PRINT_ICON . "\" alt=\"" . _PRINT_ICON . "\" src=\"" . $_themes_images_path . "\"/>" . "</a>" . "</div>"; } } //if ($view != "" && $attachment == 0) { if ($view != "" && gettype($view) == "string") { $template = $this->getAttribute($view); if ($template == "") { if ($view == USE_CACHE) { //キャッシュを使用するため、ファイル名が未指定 } elseif ($view == TOKEN_ERROR_TYPE || $view == VALIDATE_ERROR_TYPE || $view == VALIDATE_ERROR_NONEREDIRECT_TYPE || $view == UPLOAD_ERROR_TYPE) { //Error_default $template = "main:error.html"; } else { $this->_log->error(sprintf("テンプレートファイルの取得に失敗しました(%s)", $view), "{$this->_className}#_postfilter"); exit; } } if (strncmp("location_script:", $template, 16) == 0) { //if (preg_match("/^(location_script:)/", $template)) { //もし、パラメータに_redirect_urlがあれば //優先的に_redirect_urlへリダイレクト $redirect_url = $this->_request->getParameter("_redirect_url"); if ($redirect_url) { $sub_url = preg_replace("/&/i", '&', htmlspecialchars($redirect_url, ENT_QUOTES)); } else { $sub_url = preg_replace("/location_script:/", "", $template); } $sub_url = trim($sub_url); if (preg_match("/^" . preg_quote(BASE_URL, '/') . "/i", $sub_url)) { $sub_url = preg_replace("/^" . preg_quote(BASE_URL, '/') . "/i", "", $sub_url); $sub_url_strlen = strlen($sub_url); if (substr($sub_url, 0, 1) == "/") { // 最初の「/」を除去 $sub_url = substr($sub_url, 1, $sub_url_strlen - 1); } $base_url = BASE_URL . "/"; } else { if (preg_match("/^" . preg_quote("http", '/') . "/i", $sub_url)) { $base_url = ""; } else { $base_url = BASE_URL . "/"; } } // SSLログインの場合、HTTPSからHTTPに戻す // TODO:ログイン先もSSLで表示するページならば、HTTPSで表示。現状。未対応 //if($url == "") $url = "?action=".DEFAULT_ACTION; $sub_url = urlencode($sub_url); $sub_url = str_replace(array("%3d", "%3D", "%26", "%2F", "%2f", "%3f", "%3F", "%23"), array("=", "=", "&", "/", "/", "?", "?", "#"), $sub_url); $url = $base_url . $sub_url; $this->_response->setRedirectScript($url); } else { if (strncmp("location:", $template, 9) == 0) { //} else if (preg_match("/^(location:)/", $template)) { //もし、パラメータに_redirect_urlがあれば //優先的に_redirect_urlへリダイレクト $redirect_url = $this->_request->getParameter("_redirect_url"); if ($redirect_url) { $url = preg_replace("/&/i", '&', htmlspecialchars($redirect_url, ENT_QUOTES)); } else { $url = preg_replace("/location:/", "", $template); } $url = trim($url); if ($url == "") { $url = "?action=" . DEFAULT_ACTION; } $this->_response->setRedirect($url); } else { if (strncmp("action:", $template, 7) == 0) { //} else if (preg_match("/^(action:)/", $template)) { $actionList = preg_replace("/action:/", "", $template); $not_remove_requests = explode(",", $actionList); $action = trim(array_shift($not_remove_requests)); if (count($not_remove_requests) > 0) { // 削除しないで残しておくパラメータの指定あり。 // それ以外は削除(block_id, page_id,module_id,action以外) $request_params = array(); foreach ($not_remove_requests as $not_remove_request) { $request_params[$not_remove_request] = $this->_request->getParameter($not_remove_request); } $this->_request->removeParameters(); $this->_request->setParameters($request_params); } $this->_actionChain->add($action); $action_flag = true; } else { //$renderer =& SmartyTemplate::getInstance(); // // define情報読み込み // $theme = $this->getAttribute("define:theme"); if (!isset($theme) || $this->_request->getMethod() == "POST" && ($template == "main:error.html" || $template == "main:key_error.html")) { //default:テーマを表示しない $theme = 0; } else { $themeList = explode(",", $theme); $theme_len = count($themeList); if ($theme_len == 1) { $theme = intval($themeList[0]); } else { //default:テーマを表示しない $theme = 0; for ($i = 1; $i < $theme_len; $i++) { if ($view == $themeList[$i]) { $theme = intval($themeList[0]); break; } } } } // // 主担かどうかセット // $auth_id = $this->_session->getParameter("_auth_id"); if ($auth_id >= _AUTH_CHIEF) { $chief_flag = _ON; } else { $chief_flag = _OFF; } if ($theme == 1) { $header_type = $this->getAttribute("define:header_type"); //header_typeの値は、main、editのいずれかが入り //ブロックヘッダーのボタンの種別を指定する(編集ボタンか、編集終了ボタンか) //設定されていなければ、フォルダ構成より自動判断。 if (!isset($header_type) && ($header_type != "main" && $header_type != "edit")) { $header_type = null; } if ($header_type == null && count($pathList) >= 3) { //自動判断 switch ($pathList[2]) { case "edit": $header_type = "edit"; break; default: $header_type = "main"; } } else { if ($header_type == null) { $header_type = "main"; } } $renderer->assign('header_type', $header_type); if ($chief_flag) { $renderer->assign('dblclick_edit', _DBLCLICK_EDIT); $renderer->assign('draganddrop_move', _DRAGANDDROP_MOVE); } else { $renderer->assign('dblclick_edit', ''); $renderer->assign('draganddrop_move', ''); } } // //ヘッダー表示・非表示 // $header = $this->_request->getParameter("_header"); if (!isset($header)) { //default:ヘッダーを表示する if (substr($template, -4, 4) == ".xml") { $header = _OFF; } else { $header = _ON; } } // //javascriptを読み込むかどうか // $noscript = $this->_request->getParameter("_noscript"); if (!isset($noscript)) { //default:javascriptを読み込む $noscript = _OFF; } //TODO:パラメータ「_theme」廃止 //ブロックテーマ表示:非表示 //$theme = $this->_request->getParameter("_theme"); //if(!isset($theme)) { // //default:ヘッダーを表示する // $theme = 1; //} // //共通Assign処理 // //TODO:後に第2引数を無くす $id = $this->_session->getParameter("_id"); $themeStr = ""; $tempStr = ""; $retAssign = $common->viewAssign($renderer, $this->_log); if (is_array($retAssign)) { list($page_id, $themeStr, $tempStr, $min_width_size, $url_htmlspecialchars) = $retAssign; if ($header && $block_id == 0 && $themeStr == "") { $themeStr = "default"; } $renderer->assign('_url', $url_htmlspecialchars); if ($action_name != DEFAULT_ACTION && $header == _ON) { //ヘッダー表示ありの場合、リクエストパラメータのpage_idをセット $req_page_id = $this->_request->getParameter("page_id"); if ($req_page_id) { $page_id = $req_page_id; } } } //close_popup_confirm //close_popup_func $close_popup_func = $this->getAttribute("define:close_popup_func"); if (isset($close_popup_func)) { //閉じる場合の関数定義 $renderer->assign('_close_popup_func', $close_popup_func); } else { $close_popup_confirm = $this->getAttribute("define:close_popup_confirm"); if (isset($close_popup_confirm)) { //閉じる場合、確認メッセージ) $renderer->assign('_close_popup_confirm', $close_popup_confirm); } } //theme_name $theme_name = $this->getAttribute("define:theme_name"); if (isset($theme_name)) { $themenameList = explode(",", $theme_name); $theme_len = count($themenameList); if ($theme_len == 1) { $themeStr = $themenameList[0]; } else { //default:テーマを表示しない for ($i = 1; $i < $theme_len; $i++) { if ($view == $themenameList[$i]) { $themeStr = $themenameList[0]; break; } } } //$themeStr = $theme_name; } if ($this->_session->getParameter("_system_flag") == _OFF && ($themeStr == "system" || $this->_request->getParameter("theme_name") == "system")) { $min_width_size = 0; } $def_min_width_size = $this->getAttribute("define:min_width_size"); if (isset($def_min_width_size)) { //ポップアップサイズ指定用 $min_width_size = intval($def_min_width_size); } if (!$header) { //ヘッダーなしで、リクエストパラメータtheme_name指定あり $reqest_theme_name = $this->_request->getParameter("theme_name"); if ($reqest_theme_name == "none") { $themeStr = ""; $theme = _OFF; } else { if ($reqest_theme_name && $themeStr != "system") { $themeStr = $reqest_theme_name; } } } if ($themeStr != "") { $themeStr = basename($themeStr); list($block_color, $themeDir, $themeCssPath) = $common->themeAssign($renderer, $block_id, $themeStr); } $action_obj =& $this->_actionChain->getCurAction(); $error_template_flag = false; if (strncmp("main:", $template, 5) == 0) { //if (preg_match("/main:/", $template)) { //main:ならば、mainのテンプレートを使用する $template = preg_replace("/main:/", "", $template); $sub_main_template_dir = "/templates/" . "main/"; $main_template_dir = WEBAPP_DIR . $sub_main_template_dir; //$main_flag = true; if ($this->_request->getMethod() == "POST" && ($template == "error.html" || $template == "key_error.html")) { $error_template_flag = true; } } else { if (strncmp("common:", $template, 7) == 0) { //} else if (preg_match("/common:/", $template)) { //common:ならば、モジュールの共通テンプレート $template = preg_replace("/common:/", "", $template); $sub_main_template_dir = "/" . $pathList[0] . "/templates/"; $main_template_dir = MODULE_DIR . $sub_main_template_dir; } else { if ($tempStr != "") { $sub_main_template_dir = "/" . $pathList[0] . "/templates/" . $tempStr . "/"; //$main_template_dir = MODULE_DIR . "/" . $pathList[0]. "/templates/".$tempStr."/"; } else { $sub_main_template_dir = "/" . $pathList[0] . "/templates/default/"; //default固定とする //$sub_main_template_dir = "/" . $pathList[0]. "/templates/"; //$main_template_dir = MODULE_DIR . "/" . $pathList[0]. "/templates/"; } $main_template_dir = MODULE_DIR . $sub_main_template_dir; //$main_flag = false; } } if (!is_dir($main_template_dir)) { $sub_main_template_dir = "/" . $pathList[0] . "/templates/default/"; $main_template_dir = MODULE_DIR . $sub_main_template_dir; //$main_template_dir = MODULE_DIR . "/" . $pathList[0]. "/templates/default/"; } //強制的に外枠なしに設定するパラメータ //TODO:廃止 //if (preg_match("/noneouter:/", $template)) { // $template = preg_replace("/noneouter:/", "", $template); // $theme = 0; //} $script_str =& $this->_getdata->getParameter("script_str"); $script_str_all =& $this->_getdata->getParameter("script_str_all"); $renderer->setAction($action_obj); $errorList =& $this->_actionChain->getCurErrorList(); $renderer->setErrorList($errorList); $token =& $this->_container->getComponent("Token"); //if (is_object($token)) { // $renderer->setToken($token); //} //if (is_object($this->_session)) { // $renderer->setSession($this->_session); //} $renderer->setScriptName($_SERVER['SCRIPT_NAME']); //main_action_nameをassign $main_action_name = $this->_session->getParameter('_main_action_name'); $renderer->assign('main_action_name', $main_action_name); //$renderer->assign('main_block_id',$this->_session->getParameter('main_block_id')); //template_dirセット $renderer->setTemplateDir($main_template_dir); //if($main_flag) { // //mainのテンプレートを使用する場合、キャッシュを使用しない // //キャッシュ処理をしない // $caching = $renderer->getCaching(); // $renderer->setCaching(false); //} $result = $print_html . $renderer->fetch($template, $cache_id, $sub_main_template_dir); if ($theme && strncmp(ERROR_MESSAGE_PREFIX, $result, strlen(ERROR_MESSAGE_PREFIX)) == 0) { //if ($theme && preg_match("/^".ERROR_MESSAGE_PREFIX."/", $result)) { $result = preg_replace("/^" . ERROR_MESSAGE_PREFIX . "/", "", $result); } //Scriptを保管 if ($noscript == _OFF && _SCRIPT_OUTPUT_POS == "footer") { //if($header || $main_action_name == DEFAULT_ACTION) { $footer_module_script = ""; $re_script = '/<script class=([\'"]?)nc_script.*\\1(.*)>(.*)<\\/script>/isU'; $matches = array(); preg_match_all($re_script, $result, $matches); if (isset($matches[0])) { $result = preg_replace($re_script, "", $result); $script_result = ""; $script_result_all = ""; $match_count = 0; foreach ($matches[3] as $match) { if ($match == "" && strtolower($matches[2][$match_count]) != ' type="text/javascript"') { $script_result_all .= '<script class="nc_script" ' . $matches[2][$match_count] . '></script>'; } else { $script_result .= $match; } $match_count++; } //if(!isset($footer_field['script_footer'])) $footer_field['script_footer'] = ""; $script_str .= $script_result; $script_str_all .= $script_result_all; //if($header) { // $this->_response->setScript($script_result); //} else { // $footer_module_script = $script_result; //} } } //if($main_flag) { // //mainのテンプレートを使用する場合、キャッシュを使用しない // //キャッシュ処理を元に戻す // $renderer->setCaching($caching); //} // // コンテンツがfetchされていない場合、レスポンスクラスからコンテンツ取得 // ob_get_contentsより取得し連結 // //$ob_buffer = ob_get_contents(); //$result = $ob_buffer . $result; //@ob_end_clean(); //ブロックテーマを追加 if ($theme && ($block_id != 0 || isset($themeDir))) { //ヘッダーメニュー $headerMenuLists = null; if ($this->_filterChain->hasFilterByName("HeaderMenu")) { $headerMenu =& $this->_filterChain->getFilterByName("HeaderMenu"); if ($headerMenu) { $headerMenuLists = $headerMenu->getMenu(); $headerMenu->clear(); } } $renderer->assign("headermenu", $headerMenuLists); //block.html固定 $template_block = "block.html"; $layoutmode = ""; //if (!@file_exists(MODULE_DIR . $themeDir . $template_block)) { //レイアウトモードをセッションより取得 //$pages = $this->_getdata->getParameter("pages"); $_layoutmode_centercolumn = $this->_session->getParameter("_layoutmode_centercolumn"); $layoutmode = isset($_layoutmode_centercolumn) ? $_layoutmode_centercolumn : $this->_session->getParameter("_layoutmode"); $_layoutmode_onetime = $this->_request->getParameter("_layoutmode_onetime"); if (isset($_layoutmode_onetime) && $chief_flag) { $layoutmode = $_layoutmode_onetime; } //} //template_dirセット if (!isset($themeDir)) { $common->redirectHeader("", 2, sprintf(_ACCESS_FAILURE, CURRENT_URL)); exit; } $renderer->setTemplateDir(STYLE_DIR . $themeDir); //content情報assign $renderer->assign('content_field', $result); //キャッシュ処理をしない $caching = $renderer->getCaching(); $renderer->setCaching(0); $result = $renderer->fetch($template_block, $cache_id . "block_theme=" . $themeStr . "_" . $layoutmode, $themeDir); //$result = $renderer->fetch($template_block, "block_theme_".$themeStr."_".$layoutmode,$themeDir); //header_btn $heder_btn = ""; if ($layoutmode == "on" && $themeStr != "system") { $template_block_dir = "/templates/default/"; //TODO:default固定 $template_block = "header.html"; $renderer->setTemplateDir(STYLE_DIR . $template_block_dir); $heder_btn = $renderer->fetch($template_block, $cache_id, $template_block_dir); } //キャッシュ処理を元に戻す $renderer->setCaching($caching); // //パラメータのstyle属性付与 // //TODO:セキュリティ上(うまく動作するかも含めて)問題にならないか後にチェック。 //$style = htmlspecialchars($this->_request->getParameter("style"), ENT_QUOTES); //if($style != "") { // //styleパラメータは、&style=visibility:hidden;width:100px;のように指定すること // $style = " style=\"".$style."\""; //} // // Blockテーマヘッダー情報を追加 // id=_$block_id class=ThemeName // DIVタグにするとモジュールのみの表示した場合に全画面表示(Width:100%)で表示されるため、tableタグを現状用いる //$block_theme_header = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"_" . $url . "\" class=\"module_box " . $themeStr . "\"".$style."><tr><td>"; if ($min_width_size == 0) { if ($themeStr != "system") { $table_min_width_size = "100%"; } else { $table_min_width_size = "auto"; } } else { $table_min_width_size = $min_width_size . "px"; } $top_class_name = "blockstyle" . $id . " module_box"; if ($action_name == "pages_action_grouping") { $top_class_name .= " module_grouping_box"; } $block_theme_header = "<table id=\"" . $id . "\" class=\"" . $top_class_name . " " . htmlspecialchars($themeStr, ENT_QUOTES) . "\" style=\"width:" . $table_min_width_size . "\"><tr><td>"; $block_theme_header .= $heder_btn; //$block_theme_header .= "<div style=\"width:" . $div_min_width_size . "\" >"; //$block_theme_header .= "<div>"; if (is_object($token) && $token->getValue() != '') { $block_theme_header .= "<input type=\"hidden\" id=\"_token" . $id . "\" class=\"_token\" value=\"" . $token->getValue() . "\"/>"; } //if($block_id != 0) { // $block_theme_header .= "<input type=\"hidden\" class=\"_block_id\" value=\"".$block_id."\"/>"; // $block_theme_header .= "<input type=\"hidden\" class=\"_page_id\" value=\"".$block_obj['page_id']."\"/>"; //} else { // $block_theme_header .= "<input type=\"hidden\" class=\"_module_id\" value=\"".$module_id."\"/>"; //} $block_theme_header .= "<input type=\"hidden\" id=\"_url" . $id . "\" class=\"_url\" value=\"" . $url_htmlspecialchars . "\"/>"; //透過Gif挿入:min-width指定(IEが未対応のため画像とする:2006/02/02 By Ryuji Masukawa) $block_theme_footer = ""; if ($min_width_size != 0) { $block_theme_header .= "<img alt=\"\" src=\"" . get_image_url() . "/images/common/blank.gif\" style=\"height:0px;width:" . $min_width_size . "px;\" />"; } //$block_theme_footer .= "</div>"; $block_theme_header .= "<a id=\"_href" . $id . "\" name=\"" . $id . "\"></a>"; $block_theme_footer .= "</td></tr></table>"; //ページに表示してある場合、モジュールInit(イベントを付与) //TODO:移動する権限があるかどうかのチェックが必要。左カラム等はとくに考える必要性あり。 //if(!$header) { // メニューの場合、主担でなくても編集ボタンをクリックさせるため、対応 $edit_btn_flag = $chief_flag == true || isset($action_obj->headerbtn_edit) && $action_obj->headerbtn_edit == true ? _ON : _OFF; $script_str = "commonCls.moduleInit(\"" . $id . "\"," . $edit_btn_flag . ");" . $script_str; //$block_theme_footer .= "<script type=\"text/javascript\">commonCls.moduleInit(\""."_" . $url."\");</script>"; //} $result = $block_theme_header . $result . $block_theme_footer; } else { if ($theme && $block_id == 0 && !isset($themeDir) || $this->_request->getParameter("active_center") != "" && $this->_session->getParameter("_main_action_name") == DEFAULT_ACTION) { // ブロックセンター表示 $block_theme_header = "<div id=\"" . $id . "\">"; if (is_object($token)) { $block_theme_header .= "<input type=\"hidden\" id=\"_token" . $id . "\" class=\"_token\" value=\"" . $token->getValue() . "\"/>"; } $block_theme_header .= "<input type=\"hidden\" id=\"_url" . $id . "\" class=\"_url\" value=\"" . $url_htmlspecialchars . "\"/>"; $block_theme_header .= "<a id=\"_href" . $id . "\" name=\"" . $id . "\"></a>"; $block_theme_footer = "</div>"; $result = $block_theme_header . $result . $block_theme_footer; } else { if (is_object($token) && $token->inbuild() && $token->getValue() != "") { // Tokenがbuildされていれば、書き換える $script_str .= "commonCls.setToken('_token" . $id . "','" . $token->getValue() . "');"; } } } //初期化 //$script_string = ""; if ($header) { //$themeCommonStr = "default"; // // configクラスを取得 // $config =& $this->_container->getComponent("configView"); // // ヘッダー、META情報取得 // if (isset($page_id)) { $meta = $config->getMetaHeader($page_id, array($pathList[0])); } else { $meta = $config->getMetaHeader(null, array($pathList[0])); } //$meta['css_header'] .= "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"./css/common/".$themeCommonStr."/style.css\" />"; if ($themeStr != "" && $themeStr != "system") { $meta['css_header']["/" . $themeCssPath . "/style.css"] = "/" . $themeCssPath . "/style.css"; // custum css $meta['css_header'][$themeStr] = $themeStr; $meta['css_header_block_id'][$themeStr] = $block_id; } $timeout_time = $this->_session->getParameter('_session_gc_maxlifetime') * 60; if ($this->_session->getParameter("_user_id") != "0" && defined("_SESSION_TIMEOUT_ALERT")) { // 現状、ログインしたもののみcommonInitを行う $script_str .= "commonCls.commonInit('" . _SESSION_TIMEOUT_ALERT . "'," . $timeout_time . ");"; } if (isset($block_color)) { $css_header_str = $this->_getheaderInc($block_color, $tempStr); $meta['css_header'][$css_header_str] = $css_header_str; ////$meta['css_header'] .= $this->_getheaderInc($block_color, $tempStr, $header); } //meta情報assign $renderer->assign('header_field', $meta); //キャッシュ処理をしない $caching = $renderer->getCaching(); $renderer->setCaching(0); $template_dir = WEBAPP_DIR . "/templates/" . "main/"; $template_header = "header.html"; //template_dirセット $renderer->setTemplateDir($template_dir); $result_header = $renderer->fetch($template_header, $cache_id, "/templates/" . "main/"); //print $result; //flush(); //footer表示-------------------------------------------------- $template_dir = WEBAPP_DIR . "/templates/" . "main/"; $template_footer = "footer.html"; $moduleNmaes = array($pathList[0]); if ($action_name == 'pages_view_closesite') { $moduleNmaes[] = 'login'; } $footer_arr = $config->terminateFooter($moduleNmaes); $renderer->assign('footer_field', $footer_arr); //template_dirセット $renderer->setTemplateDir($template_dir); $result_footer = $renderer->fetch($template_footer, $cache_id, "/templates/" . "main/"); //キャッシュ処理を元に戻す $renderer->setCaching($caching); } else { if (!$error_template_flag && $main_action_name != "pages_view_grouping" && $main_action_name != DEFAULT_ACTION && $script_str != '' && $noscript != _ON && substr($template, -4, 4) != ".xml") { if (!isset($block_color)) { $block_color = "default"; } $css_script_dir_name = $this->_getheaderInc($block_color, $tempStr); if ($css_script_dir_name != "") { $css_script = "commonCls.addCommonLink(\"" . $css_script_dir_name . "\");"; } else { $css_script = ""; } $result = $result . "<script class=\"nc_script\" type=\"text/javascript\">" . $css_script . "</script>" . $script_str_all . "<script class=\"nc_script\" type=\"text/javascript\">" . $script_str . "</script>"; //} else if($script_result_all != "") { // add_script_footerをterminateFooterでセットするように修正 // $renderer->assign('add_script_footer', $script_result_all); } } //javascriptからheaderの項目を追加しても、 //jsファイルのインクルードがうまく動作しない //今後、jsファイルのインクルードが正常に動くようにブラウザが対応した場合、 //以下の処理を使用可能 /******* else if($this->_session->getParameter('main_action_name') != DEFAULT_ACTION){ //ページ表示処理から呼ばれていないならば //ページ・ブロックのCSS、JSファイルをヘッダーにインクルード list($css_str, $js_str) = $this->_getheaderInc($themeDir, $tempStr, true); $script_string = "<script type=\"text/javascript\">" . $css_str . $js_str . "</script>"; } *****/ //scriptタグ追加 //$result .= $footer_module_script; //$result = $script_string . $result; //$renderer->clearAction(); //$renderer->clearErrorList(); //$renderer->clearToken(); //$renderer->clearScriptName(); //$renderer->clear_assign('lang'); //$renderer->clear_assign('conf'); } } } } // //debug // if (isset($renderer) && $renderer->debugging && $main_action_name == $action_name) { $template_dir = BASE_DIR . "/"; $template_debug = "webapp/templates/main/debug.html"; //キャッシュ処理をしない $caching = $renderer->getCaching(); $renderer->setCaching(0); //template_dirセット $renderer->setTemplateDir($template_dir); //Debug部分 $result = $result . $renderer->fetch($template_debug, "debug", SMARTY_DIR); //キャッシュ処理を元に戻す $renderer->setCaching($caching); } // //attachment // if ($attachment) { if ($this->_filterChain->hasFilterByName("FileUpload")) { $fileUpload =& $this->_container->getComponent("FileUpload"); //$count = $fileUpload->count(); $download_action_name = $fileUpload->getDownLoadactionName(); $uploadId = $fileUpload->getUploadid(); $extension = $fileUpload->getExtension(); $insert_time = $fileUpload->getInserttime(); $originalNames = $fileUpload->getOriginalName(); $mimeType = $fileUpload->getMimeType(); $file_size = $fileUpload->getFilesize(); $errormes = $fileUpload->getErrorMes(); $filelist = array(); foreach ($originalNames as $i => $originalName) { //for ($i = 0; $i < $count; $i++) { //$test = $originalName[$i]; $filelist[$i] = array('upload_id' => isset($uploadId[$i]) ? $uploadId[$i] : '', 'file_name' => isset($originalName) ? $originalName : '', 'action_name' => $download_action_name, 'file_size' => isset($file_size[$i]) ? $file_size[$i] : '', 'mimetype' => isset($mimeType[$i]) ? $mimeType[$i] : '', 'extension' => isset($extension[$i]) ? $extension[$i] : '', 'insert_time' => isset($insert_time[$i]) ? $insert_time[$i] : '', 'error_mes' => isset($errormes[$i]) ? $errormes[$i] : ''); } //mb_convert_encoding($filename, "UTF-8") $template_dir = WEBAPP_DIR . "/templates/" . "main/"; $template_attachment = "attachment_result.html"; //キャッシュ処理をしない $caching = $renderer->getCaching(); $renderer->setCaching(0); //template_dirセット $renderer->setTemplateDir($template_dir); $renderer->assign("_attachment_list", $filelist); $renderer->assign("_attachment_result", $result); //<div class='test_class_name'>ファイルのアップロードがすべて終了しました</div> $errorList =& $this->_actionChain->getCurErrorList(); $renderer->setErrorList($errorList); //attachment部分 $result = $renderer->fetch($template_attachment, "attachment_result", "/templates/" . "main/"); //$test .= " ".var_dump($renderer->get_template_vars("_attachment_list"))." KOKO "; //$result = $test.$result; $renderer->clear_assign("_attachment_list"); $renderer->clear_assign("_attachment_callback"); $renderer->clear_assign("_attachment_result"); //キャッシュ処理を元に戻す $renderer->setCaching($caching); } } // コンテンツがfetchされていない場合、レスポンスクラスからコンテンツ取得 // ob_get_contentsより取得し連結 $result = ob_get_contents() . $result; if ($result != "") { $this->_response->setResult($result); } else { $this->_response->setResult(null); } //_outputは、pages_view_main等を呼び出した場合にprintさせないように制御するためのパラメータ $output = $this->_request->getParameter("_output"); if (isset($output) && $output == _OFF) { return; } if (isset($template) && substr($template, -4, 4) == ".xml") { // xml用のヘッダを設定 $this->_response->setContentType("text/xml"); } $contentDisposition = $this->_response->getContentDisposition(); $contentType = $this->_response->getContentType(); $result = $this->_response->getResult(); $redirect = $this->_response->getRedirect(); $redirect_script = $this->_response->getRedirectScript(); $script = $this->_response->getScript(); @ob_end_clean(); if ($redirect) { header("Location: {$redirect}"); return; } else { if ($redirect_script) { // SSLのログインアクションの場合は、parent.location.hrefを更新 if (!preg_match("/^http/i", $redirect_script)) { $redirect_script = BASE_URL . "/" . $redirect_script; } if ($action_name == "login_action_main_init") { print "<script class=\"nc_script\" type=\"text/javascript\">" . "top.location.href = '{$redirect_script}';" . "</script>"; } else { print "<script class=\"nc_script\" type=\"text/javascript\">" . "location.href = '{$redirect_script}';" . "</script>"; } //flush(); return; } else { if ($result != "") { if ($contentDisposition != "") { header("Content-disposition: {$contentDisposition}"); } if ($contentType != "") { header("Content-type: {$contentType}"); } } } } // debugがonの場合、register_shutdown_functionでログを出力する可能性があるため // (gzipしたものと、していないものを出力される) // debug中は、gzipしないで出力する if ($action == $action_name) { if (extension_loaded('zlib') && $this->_session->getParameter("_gzip_compression") && ($this->_session->getParameter("_php_debug") == _OFF && $this->_session->getParameter("_sql_debug") == _OFF)) { ob_start('ob_gzhandler'); } else { ob_start(); } } if ($header) { //header表示-------------------------------------------------- print $result_header; //flush(); print $result; //flush(); print $script; //flush(); //footer表示-------------------------------------------------- print $result_footer; //flush(); } else { print $result; } //action:指定ではなければflushする //if(!$action_flag) { if ($action == $action_name) { ob_end_flush(); //flush(); } }
<?php session_name('nessquik'); session_start(); // Used for including files if (!defined("_ABSPATH")) { define("_ABSPATH", dirname(dirname(__FILE__))); } require_once _ABSPATH . '/confs/config-inc.php'; require_once _ABSPATH . '/lib/Smarty.php'; require_once _ABSPATH . '/lib/functions.php'; require_once _ABSPATH . '/lib/Help.php'; $db = nessquikDB::getInstance(); $sa = resultsDB::getInstance(); $_hlp = Help::getInstance(); $tpl = SmartyTemplate::getInstance(); $tpl->template_dir = _ABSPATH . '/templates/'; $tpl->compile_dir = _ABSPATH . '/templates_c/'; if ($_POST) { $action = import_var('action', 'P'); } else { $action = import_var('action', 'G'); switch ($action) { case "make_report": continue; default: exit; } } switch ($action) { case "show_help_categories":
function execute() { $renderer =& SmartyTemplate::getInstance(); $this->theme_name = $this->theme_name == "" ? "system" : $this->theme_name; if ($this->action_name != "") { $curPath = MODULE_DIR; $pathList = explode("_", $this->action_name); //$count = count($pathList); $now_count = 1; $css = array(); $js = array(); $themeStrList = explode("_", $this->theme_name); if (count($themeStrList) == 1) { $themeDir = "themes/" . $this->theme_name . "/css"; } else { $bufthemeStr = array_shift($themeStrList); $themeDir = "themes/" . $bufthemeStr . "/css/" . implode("/", $themeStrList); } $css["blocks:style.css" . $this->theme_name] = $themeDir . "/style.css"; foreach ($pathList as $path) { //$curPath .= "${path}/"; $curPath .= "/" . $path; $include = $this->_getConfig($curPath, $now_count == count($pathList)); if ($include) { foreach ($include as $key => $value) { //1つにjsファイルを結合したため、コメント //jsファイルを画面毎で分けると //画面遷移時のインクルードがうまく動作しない //今後、jsファイルのインクルードが正常に動くようにブラウザが対応した場合、 //以下の処理を使用可能 /* if($key == "js" || preg_match("/_js/", $key)) { $include_files = $value; $include_pathList = explode(",", $include_files); foreach($include_pathList as $include_file){ if($include_file != "") { if(!isset($js[$include_file.":".$this->temp_name])) { $pathList = explode(":", $include_file); $file_path = "js/".$pathList[0] . "/" . $pathList[1]; //if (@file_exists(HTDOCS_DIR."/".$file_path)) { $js[$include_file.":".$this->temp_name] = BASE_URL."/".$file_path; //} } } } } */ //if($key == "css" || preg_match("/_css/", $key)) { $include_files = $value; $include_pathList = explode(",", $include_files); foreach ($include_pathList as $include_file) { if ($include_file != "") { if (!isset($css[$include_file . ":" . $this->temp_name])) { $pathList = explode(":", $include_file); $file_path = $pathList[0] . "/" . $pathList[1]; //if (@file_exists(HTDOCS_DIR."/".$file_path)) { $css[$include_file . ":" . $this->temp_name] = $file_path; //} } } } //} } } /**** //key:js,css固定 if($include) { if(isset($include["js"])) { $include_files = $include["js"]; $include_pathList = explode(",", $include_files); foreach($include_pathList as $include_file){ if($include_file != "") { if(!isset($js[$include_file.":".$this->temp_name])) { $pathList = explode(":", $include_file); $file_path = "js/".$pathList[0] . "/" . $pathList[1]; //if (@file_exists(HTDOCS_DIR."/".$file_path)) { $js[$include_file.":".$this->temp_name] = BASE_URL."/".$file_path; //} } } } } if(isset($include["css"])) { $include_files = $include["css"]; $include_pathList = explode(",", $include_files); foreach($include_pathList as $include_file){ if($include_file != "") { if(!isset($css[$include_file.":".$this->temp_name])) { $pathList = explode(":", $include_file); $file_path = "css/".$pathList[0] . "/" . $pathList[1]; //if (@file_exists(HTDOCS_DIR."/".$file_path)) { $css[$include_file.":".$this->temp_name] = BASE_URL."/".$file_path; //} } } } } } ***/ $now_count++; } $headerinc_arr = serialize(array("css" => $css)); //$headerinc_arr = serialize(array("js" => $js, "css" => $css)); $renderer->assign('headerinc_arr', $headerinc_arr); //キャッシュ処理をしない $caching = $renderer->getCaching(); $renderer->setCaching(0); $template_dir = MODULE_DIR . "/headerinc/templates/"; $template = "headerinc.html"; //template_dirセット $renderer->setTemplateDir($template_dir); $result = $renderer->fetch($template, null, "/headerinc/templates/"); //キャッシュ処理を元に戻す $renderer->setCaching($caching); if ($this->print_flag) { print $result; } else { return $result; } } return 'success'; }
/** * Actionを実行 * * @return string 実行したActionの返却値 **/ function execute() { $log =& LogFactory::getLog(); if ($this->getSize() < 1) { $log->error("Actionが追加されていません", "ActionChain#execute"); return false; } $name = $this->getCurActionName(); $action =& $this->getCurAction(); if (!is_object($action)) { $log->error("Actionの取得に失敗しました({$name})", "ActionChain#execute"); return false; } // //cache_idセット // $container =& DIContainerFactory::getContainer(); $common =& $container->getComponent("commonMain"); $cache_id = $common->getCacheid(); $renderer =& SmartyTemplate::getInstance(); //$renderer->is_cached(null,$cache_id,null); if ($name == DEFAULT_ACTION || $name == "control_view_main" || !$renderer->is_cached(null, $cache_id, null)) { return $action->execute(); } else { return USE_CACHE; } }
function smartyTemplateCacheHandler($action, &$smarty_obj, &$cache_content, $tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null) { $use_gzip = false; $container =& DIContainerFactory::getContainer(); $session =& $container->getComponent("Session"); $request =& $container->getComponent("Request"); $filterChain =& $container->getComponent("FilterChain"); //if(preg_match("/^pages_/",$action_name)) { // $cache_key = "page_id=".$request->getParameter("page_id"); //} else if(preg_match("/^control_/",$action_name)) { // $cache_key = ""; //} else { // $cache_key = "block_id=".$request->getParameter("block_id"); //} if (!isset($session)) { return false; } //DBオブジェクト取得 $db =& $container->getComponent("DbObject"); if (!is_object($db)) { return false; } $adodb =& $db->getAdoDbObject(); if (!isset($adodb)) { return false; } $time = timezone_date(); //TODO:$parameters等に「,」が含まれている場合、動作がおかしくなる可能性あり //要検証 $cache_id_arr = explode(",", $cache_id); if (count($cache_id_arr) >= 8) { $block_id = $cache_id_arr[0]; $page_id = $cache_id_arr[1]; $_user_id = $cache_id_arr[2]; $_auth_id = $cache_id_arr[3]; $_user_auth_id = $cache_id_arr[4]; $lang_dirname = $cache_id_arr[5]; $md_session_id = $cache_id_arr[6]; $action_name = $cache_id_arr[7]; $parameters = $cache_id_arr[8]; } else { $block_id = $request->getParameter("block_id"); $page_id = $request->getParameter("page_id"); $_user_id = $session->getParameter("_user_id"); $_auth_id = $session->getParameter("_auth_id"); $_user_auth_id = $session->getParameter("_user_auth_id"); if ($_user_auth_id == null) { $_user_auth_id = _AUTH_GUEST; } $md_session_id = $session->getID(); //md5($session->getID()); $actionChain =& $container->getComponent("ActionChain"); $action_name = $actionChain->getCurActionName(); $lang_dirname = $session->getParameter("_lang"); $parameters = $request->getStrParameters(); //TODO:tokenのパラメータを削除しているが、最後にtokenがない場合消えないので、要チェック $parameters = preg_replace("/&_token=.*\$/", "&", $parameters); } $_mobile_flag = $session->getParameter("_mobile_flag"); $_ssl_flag = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ? _ON : _OFF; $_meta = $session->getParameter("_meta"); if (isset($_meta["permalink"])) { $permalink = "&permalink=" . $_meta["permalink"]; } else { $permalink = ""; } //$actionChain =& $container->getComponent("ActionChain"); //$action_name = $actionChain->getCurActionName(); //$pathList = explode("_", $action_name); //$dir_name = $pathList[0]; //TODO:一定時間経過したキャッシュを削除するしくみを後に追加しなければならない→一定時間はシステム管理等にもたす $cache = null; if ($filterChain->hasFilterByName("Cache")) { $cache =& $filterChain->getFilterByName("Cache"); } //キャッシュフィルターがない場合、キャッシュを使用しない if (!is_object($cache)) { return false; } //if() //nocache $cache_arr = null; $allcache_flag = false; $cache_expire = $cache->getCacheExpire(); $cache_expire_time = date("YmdHis", timezone_date(null, true, "U") + $cache_expire * 60); switch ($action) { case 'read': case 'write': $cache_arr =& $cache->getReadCache(); case 'clear': if (!is_array($cache_arr)) { $cache_arr =& $cache->getClearCache(); } $count = 0; $or_where_str = ""; if ($action != "clear" && $tpl_file) { $where_str = "WHERE tpl_file=? AND compile_id=? "; $params = array("tpl_file" => $tpl_file, "compile_id" => $compile_id); } else { $where_str = "WHERE 1=1 "; $params = array(); } if ($action == "read") { $where_str .= "AND expire_time >=? "; $params["expire_time"] = $time; } if ($action != "clear") { $where_str .= "AND _mobile_flag=? "; $params['_mobile_flag'] = $_mobile_flag; // _mobile_flag追加 $where_str .= "AND _ssl_flag=? "; $params['_ssl_flag'] = $_ssl_flag; // _ssl_flag追加 } $or_params = array(); if (is_array($cache_arr)) { foreach ($cache_arr as $value) { $value = trim($value); $parameters_flag = false; switch ($value) { case "nocache": //キャッシュを使用しない、作成もしない return false; case "tpl_file": $where_value = $tpl_file; break; case "compile_id": $where_value = $compile_id; break; case "page_id": $where_value = $page_id; $value = "page_id"; break; case "_main_page_id": $page_id = $session->getParameter("_main_page_id"); $where_value = $page_id; $value = "page_id"; break; case "_main_room_id": $page_id = $session->getParameter("_main_room_id"); $where_value = $page_id; $value = "page_id"; //page_idの削除 $parameters = preg_replace("/&page_id=[0-9]+/", "&page_id=", $parameters); $permalink = ""; break; case "block_id": $where_value = $block_id; break; case "session_id": $where_value = $md_session_id; break; case "_user_id": $where_value = $_user_id; break; case "_auth_id": $where_value = $_auth_id; break; case "_user_auth_id": $where_value = $_user_auth_id; break; case "action_name": $where_value = $action_name; break; case "module_dir": $pathList = explode("_", $action_name); $where_value = $pathList[0]; break; case "lang_dirname": $where_value = $lang_dirname; break; case "parameters": $where_value = $parameters . $permalink; break; case "allcache": if ($action == "clear") { $allcache_flag = true; } break; case "_myportal_room_id": //researchmapのみ(clearのみ) $_self_my_page = $session->getParameter("_self_my_page"); if (!empty($_self_my_page)) { $page_id = $_self_my_page["room_id"]; } $where_value = $page_id; $value = "page_id"; //page_idの削除 $parameters = preg_replace("/&page_id=[0-9]+/", "&page_id=", $parameters); $permalink = ""; break; default: if ($action != "clear") { continue; } else { //module_id or module_dir or action_name $parameters_flag = true; $where_value = "?action=" . $value . "%"; } } if ($value == "module_dir") { $where_str .= "AND "; $params += array($value => $where_value . "_%"); $where_str .= "action_name LIKE ? "; } elseif (!$parameters_flag) { //if($where_str == "") // $where_str = "WHERE "; //else $where_str .= "AND "; $params += array($value => $where_value); $where_str .= $value . "= ? "; } else { $or_params += array($value => $where_value); if ($or_where_str != "") { $or_where_str .= " OR "; } $or_where_str .= "parameters" . " LIKE ?"; } $count++; } } if ($where_str == "" && $or_where_str != "") { $where_str = "WHERE " . $or_where_str; } else { if ($or_where_str != "") { $where_str = $where_str . " AND (" . $or_where_str . ")"; } } $params = array_merge($params, $or_params); break; } switch ($action) { case 'read': // キャッシュをデータベースから読み込む $result = $db->execute("SELECT cache_content FROM {smarty_cache} " . $where_str, $params, null, null, false); if (!isset($result[0])) { return false; } if ($use_gzip && function_exists("gzuncompress")) { $cache_content = gzuncompress($result[0][0]); } else { $cache_content = $result[0][0]; } $return = $cache_content; break; case 'write': // キャッシュをデータベースに保存する $result = $db->execute("SELECT cache_content FROM {smarty_cache} " . $where_str, $params, null, null, false); if ($use_gzip && function_exists("gzcompress")) { // 記憶効率のために内容を圧縮する $contents = gzcompress($cache_content); } else { $contents = $cache_content; } if (!isset($result[0])) { //INSERT /// キャッシュIDを作成 //$CacheID = md5($tpl_file.$cache_id.$compile_id); //$CacheID = $db->GenID('smarty_cache_cache_id_seq'); $params = array("tpl_file" => $tpl_file, "compile_id" => $compile_id, "block_id" => $block_id, "page_id" => $page_id, "_user_id" => $_user_id, "_auth_id" => $_auth_id, "_user_auth_id" => $_user_auth_id, "_mobile_flag" => $_mobile_flag, "_ssl_flag" => $_ssl_flag, "lang_dirname" => $lang_dirname, "session_id" => $md_session_id, "action_name" => $action_name, "parameters" => $parameters . $permalink, "cache_content" => $contents, "expire_time" => $cache_expire_time, "insert_time" => $time, "update_time" => $time); $result = $db->insertExecute("smarty_cache", $params, false); } else { //UPDATE $params_upd = array("upd_tpl_file" => $tpl_file, "upd_compile_id" => $compile_id, "upd_block_id" => $block_id, "upd_page_id" => $page_id, "upd_user_id" => $_user_id, "upd_auth_id" => $_auth_id, "upd_user_auth_id" => $_user_auth_id, "upd_mobile_flag" => $_mobile_flag, "upd_ssl_flag" => $_ssl_flag, "upd_lang_dirname" => $lang_dirname, "upd_session_id" => $md_session_id, "upd_action_name" => $action_name, "upd_parameters" => $parameters . $permalink, "upd_cache_content" => $contents, "upd_expire_time" => $cache_expire_time, "upd_update_time" => $time); $params = array_merge($params_upd, $params); $sql = "UPDATE {smarty_cache} SET " . "tpl_file=?," . "compile_id=?," . "block_id=?," . "page_id=?," . "_user_id=?," . "_auth_id=?," . "_user_auth_id=?," . "_mobile_flag=?," . "_ssl_flag=?," . "lang_dirname=?," . "session_id=?," . "action_name=?," . "parameters=?," . "cache_content=?," . "expire_time=?," . "update_time=? " . $where_str; $result = $db->execute($sql, $params); } if (!$result) { return false; //$smarty_obj->_trigger_error_msg("cache_handler: query failed."); } $return = $result; break; case 'clear': // キャッシュ情報を破棄する //if(empty($cache_id) && empty($compile_id) && empty($tpl_file)) { if ($allcache_flag) { // 全てのキャッシュを破棄する $result = $db->execute("DELETE FROM {smarty_cache}"); } else { $renderer =& SmartyTemplate::getInstance(); if ($renderer->cache_lifetime != -1 && rand(1, 10) == 1) { //10回に一度の確立で古いキャッシュの削除処理を動かす $time = date("YmdHis", timezone_date(null, true, "U") - $renderer->cache_lifetime); $result = $db->execute("DELETE FROM {smarty_cache} " . $where_str . " OR update_time <'" . $time . "' ", $params); } else { $result = $db->execute("DELETE FROM {smarty_cache} " . $where_str, $params); } } if (!$result) { return false; //$smarty_obj->_trigger_error_msg("cache_handler: query failed."); } $return = $result; break; default: // エラー・未知の動作 //$smarty_obj->_trigger_error_msg("cache_handler: unknown action \"$action\""); $return = false; break; } return $return; }
/** * ValidatorのListを生成 * * @param array $params Validateする条件が入った配列 * @access private **/ function _buildValidatorList($params) { $log =& LogFactory::getLog(); $renderer =& SmartyTemplate::getInstance(); $lang = $renderer->get_template_vars("lang"); $conf = $renderer->get_template_vars("conf"); foreach ($params as $key => $value) { $key = preg_replace("/\\s+/", "", $key); $value = preg_replace('/\\s*,\\s*/', ",", trim($value)); if ($key == "" || $value == "") { $log->error("Validatorの指定が不正です", "ValidatorManager#_buildValidatorList"); continue; } // // $key は attribute.name:group のパターン // 又は、attribute.module_name.name:group のパターン // $keyArray = explode(".", $key); $keyCount = count($keyArray); if ($keyCount == 1) { $keyArray[1] = $keyArray[0]; $keyArray[0] = ""; $keyCount = 2; } if ($keyCount != 2 && $keyCount != 3) { //attribute.name or attribute.module_name.name break; } //key配列でValidateするかどうか $keyarray = 0; for ($i = 0; $i < $keyCount; $i++) { if ($i == 0) { if (preg_match("/^key:/", $keyArray[$i])) { $keyArray[$i] = preg_replace("/^key:/", "", $keyArray[$i]); //key配列でValidate $keyarray = 1; } $attribute = $keyArray[$i]; // 属性の名前 $module_name = ""; } else { if ($i == $keyCount - 1) { if (preg_match("/:/", $keyArray[$i])) { $keySubArray = explode(":", $keyArray[$i]); $name = $keySubArray[0]; // Validatorの名前 $group = $keySubArray[1]; // ValidateGroupの名前 } else { $name = $keyArray[$i]; // Validatorの名前 $group = ""; } } else { //$module_name = strtolower($keyArray[$i]); // モジュールの名前 $module_name = $keyArray[$i]; } } } //$name = strtolower($name); // // $value は stopper,....(validateParams):errStrDef,....(Params)のパターン // errStr = sprintf(constant(errStrDef),Params1,Params2....)となる // $valueArray = explode(":", $value); if (count($valueArray) != 2) { break; } $valueSubArray = explode(",", $valueArray[0]); $valueMesArray = explode(",", $valueArray[1]); if (count($valueSubArray) < 1 || $valueMesArray < 1) { break; } $stopper = $valueSubArray[0]; // ストッパーかどうか? vsprintf if (is_object($renderer) && preg_match("/^lang./", $valueMesArray[0])) { $errKey = preg_replace("/^lang./", "", $valueMesArray[0]); if (isset($lang[$errKey])) { $errStr =& $lang[$errKey]; // エラー文字列 } else { $errStr = "Undefined"; } } elseif (is_object($renderer) && preg_match("/^conf./", $valueMesArray[0])) { $errKey = preg_replace("/^conf./", "", $valueMesArray[0]); if (isset($conf[$errKey])) { $errStr =& $conf[$errKey]; // エラー文字列 } else { $errStr = "Undefined"; } } else { if (defined($valueMesArray[0])) { $errStr = constant($valueMesArray[0]); } else { $errStr = $valueMesArray[0]; // エラー文字列 } } if (count($valueMesArray) > 1) { $printParams = array(); $printParams = array_slice($valueMesArray, 1); $count = 0; foreach ($printParams as $subValue) { if (is_object($renderer) && preg_match("/^lang./", $subValue)) { $subValue = preg_replace("/^lang./", "", $subValue); if (isset($lang[$subValue])) { $printParams[$count] =& $lang[$subValue]; } else { $printParams[$count] = "Undefined"; } } elseif (is_object($renderer) && preg_match("/^conf./", $subValue)) { $subValue = preg_replace("/^conf./", "", $subValue); if (isset($conf[$subValue])) { $printParams[$count] =& $conf[$subValue]; } else { $printParams[$count] = "Undefined"; } } else { if (defined($subValue)) { $printParams[$count] = constant($subValue); // エラー文字列 } else { $printParams[$count] = $subValue; // エラー文字列 } } $count++; } $errStrPrint = vsprintf($errStr, $printParams); } else { $errStrPrint = $errStr; } //パラメーターをSmartyの定義に変換 $validateParams = array(); if (count($valueArray) > 1) { $validateParams = array_slice($valueSubArray, 1); foreach (array_keys($validateParams) as $i) { if (is_object($renderer) && preg_match("/^lang./", $validateParams[$i])) { $errKey = preg_replace("/^lang./", "", $validateParams[$i]); if (isset($lang[$errKey])) { $validateParams[$i] =& $lang[$errKey]; // パラメータ文字列 } else { $validateParams[$i] = "Undefined"; } } elseif (is_object($renderer) && preg_match("/^conf./", $validateParams[$i])) { $errKey = preg_replace("/^conf./", "", $validateParams[$i]); if (isset($conf[$errKey])) { $validateParams[$i] =& $conf[$errKey]; // パラメータ文字列 } else { // 定義されていない $validateParams[$i] = "Undefined"; } } else { if (defined($validateParams[$i])) { $validateParams[$i] = constant($validateParams[$i]); // エラー文字列 } } } } // // 必須項目は無条件ストッパーになる // if ($name == "required") { $this->_required[$attribute] = true; $stopper = true; } // // ValidateRuleの組み立て // $name_sub = $module_name != "" ? $module_name . "." . $name : $name; $validateRule = array('attribute' => $attribute, 'name' => $name_sub, 'keyarray' => $keyarray, 'stopper' => $stopper, 'errStr' => $errStrPrint, 'params' => $validateParams); if ($group) { $this->_list[$group][$attribute][] = $validateRule; } else { $this->_list[$attribute][] = $validateRule; } // // Validatorのファイルがあるかをチェック // if ($module_name == "") { $className = "Validator_" . ucfirst($name); $filename = VALIDATOR_DIR . "/{$className}.class.php"; } else { $className = "Validator_" . ucfirst($name); $filename = MODULE_DIR . "/{$module_name}" . VALIDATOR_DIR_NAME . "/{$className}.class.php"; $module_name = ucfirst($module_name); $className = "{$module_name}_" . $className; } if (!@(include_once $filename) or !class_exists($className)) { $log->error("存在していないValidatorが指定されています({$name}:{$className}:{$filename})", "ValidatorManager#_buildValidatorList"); return false; } // // 既に同名のValidatorが追加されていたら何もしない // if (isset($this->_validators[$name_sub]) && is_object($this->_validators[$name_sub])) { continue; } // // オブジェクトの生成に失敗していたらエラー // $validator =& new $className(); if (!is_object($validator)) { $log->error("Convererの生成に失敗しました({$name})", "ValidatorManager#_buildValidatorList"); return false; } $this->_validators[$name_sub] =& $validator; } }
/** * ポストフィルタ * キャッシュを削除する * @access private */ function _postfilter() { $attributes = $this->getAttributes(); if (isset($attributes["clear_cache" . $this->attributes_postfix])) { $this->_clear_cache = explode(",", $attributes["clear_cache" . $this->attributes_postfix]); $renderer =& SmartyTemplate::getInstance(); //if(isset($this->_clear_cache['allcache'])) { $renderer->clear_cache(); //} else { // $renderer->clear_cache("clear"); //} } }
/** * Check if the version of nessquik is up-to-date * * Since a lot is likely to change between nessquik * versions, I'm including this method here so that * the system can be checked for a particular configuration * that is specific to an install of nessquik and if * that configuration does not exist, an error message * will be displayed notifying the user that they * are using a new version of nessquik with an old version * of the database */ public function check_version() { $success = false; $db = nessquikDB::getInstance(); $tpl = SmartyTemplate::getInstance(); $sql = array('tables' => "SHOW TABLES FROM " . _DBUSE); $stmt1 = $db->prepare($sql['tables']); $stmt1->execute(); if ($stmt1->num_rows() == 0) { $tpl->assign("SUCCESS", "noper"); $tpl->assign("MESSAGE", "It seems you haven't created your database yet. Use the setup file to do this.<p>"); $tpl->assign("RETURN_LINK", ""); $tpl->display("actions_done.tpl"); exit; } while ($row = $stmt1->fetch_row()) { $table = $row[0]; if ($table == "division_group_list") { $success = true; break; } } if (!$success) { $tpl->assign("SUCCESS", "noper"); $tpl->assign("MESSAGE", "You're trying to use the nessquik 2.5 code base with a nessquik 2.0 database.<p>" . "This isn't going to work. Please run the upgrade scripts before continuing."); $tpl->assign("RETURN_LINK", ""); $tpl->display("actions_done.tpl"); exit; } }
function execute() { //出力用バッファをクリア(消去)し、出力のバッファリングをオフ //$ob_buffer = ob_get_contents(); //ob_end_clean(); $this->_renderer =& SmartyTemplate::getInstance(); $errorList =& $this->actionChain->getCurErrorList(); //$_user_id = $this->session->getParameter("_user_id"); //$_site_id = $this->session->getParameter("_site_id"); $pages_obj = $this->getData->getParameter("pages"); $buf_layoutmode = $this->session->getParameter("_layoutmode"); $this->session->setParameter("_layoutmodePage", $buf_layoutmode); $css = array(); $js = array(); $block_objs = array(); $headerInc = new Headerinc_View_Main(); //$pages_obj[$this->page_id] =& $this->pages->getPageById($this->page_id); //TODO:未使用? $this->_space_type = $pages_obj[$this->page_id]['space_type']; $this->_renderer->assign('align', $pages_obj[$this->page_id]['align']); $this->_renderer->assign('leftmargin', $pages_obj[$this->page_id]['leftmargin']); $this->_renderer->assign('rightmargin', $pages_obj[$this->page_id]['rightmargin']); $this->_renderer->assign('topmargin', $pages_obj[$this->page_id]['topmargin']); $this->_renderer->assign('bottommargin', $pages_obj[$this->page_id]['bottommargin']); $headercolumn_page_id = $this->session->getParameter('_headercolumn_page_id'); $leftcolumn_page_id = $this->session->getParameter('_leftcolumn_page_id'); $rightcolumn_page_id = $this->session->getParameter('_rightcolumn_page_id'); //メイン表示位置設定 if ($leftcolumn_page_id == $this->page_id) { $main_display_position = _DISPLAY_POSITION_LEFT; } else { if ($rightcolumn_page_id == $this->page_id) { $main_display_position = _DISPLAY_POSITION_RIGHT; } else { if ($headercolumn_page_id == $this->page_id) { $main_display_position = _DISPLAY_POSITION_HEADER; } else { $main_display_position = _DISPLAY_POSITION_CENTER; } } } // // active_centerがある場合、センターカラムに$this->active_centerのアクションを実行したものを // 表示する // $active_center_action = null; if ($this->active_center != null) { $active_center_action = $this->active_center; } if ($active_center_action != null) { //センターブロックに表示 $active_block_error_flag = false; if ($this->active_block_id != null) { $ret = $this->blocksView->getBlockById($this->active_block_id); if (isset($ret['block_id'])) { $center_auth_id = $this->authCheck->getPageAuthId($this->session->getParameter("_user_id"), $ret['page_id']); if ($center_auth_id != _AUTH_OTHER) { $center_block = $ret; $center_block['prefix_id_name'] = "active_center"; } } } if (!isset($center_block)) { $center_block = array(); $centerPathList = explode("_", $active_center_action); $centerModule = $this->modulesView->getModuleByDirname($centerPathList[0]); if ($centerModule === false || !isset($centerModule['module_id'])) { header("Content-type: text/html;charset=" . _CHARSET . ";"); echo _INVALID_INPUT; return 'error'; } $center_block['block_id'] = 0; $center_block['page_id'] = $this->page_id; $center_block['module_id'] = $centerModule['module_id']; $center_block['theme_name'] = $centerModule['theme_name']; $center_block['temp_name'] = $centerModule['temp_name']; $center_block['url'] = ""; $center_block['action_name'] = $active_center_action; $center_block['prefix_id_name'] = "active_center"; $this->request->setParameter("prefix_id_name", $center_block['prefix_id_name']); } //else { // $active_block_error_flag = true; //} if ($center_block !== false && isset($center_block['block_id'])) { $params = array("action" => $active_center_action, "temp_name" => $center_block['temp_name'], "page_id" => $center_block['page_id'], "block_id" => $center_block['block_id'], "module_id" => $center_block['module_id'], "prefix_id_name" => $center_block['prefix_id_name'], "theme_name" => "none", "_header" => "0", "_output" => "0"); } else { $active_block_error_flag = true; } if (!$active_block_error_flag) { ob_start(); $this->commonMain->getTopId($center_block['block_id'], $center_block['module_id'], $center_block['prefix_id_name']); $html_center = $this->preexecute->preExecute($active_center_action, $params, true); $this->request->removeParameters(array("prefix_id_name")); //$html_center = $this->response->getResult(); $this->_renderer->assign('content_center_field', $html_center); //include_header読み込み $headerInc->setParams($active_center_action, $center_block['block_id'], $center_block['theme_name'], $center_block['temp_name']); $res = $headerInc->execute(); if ($res) { $center_block['action_name'] = $active_center_action; $this->pagesCompmain->setHeaderArray($res, $center_block, $all_headerinc_arr); } $headerinc_buf[$center_block['url'] . ":" . $center_block['action_name'] . ":" . $center_block['theme_name'] . ":" . $center_block['temp_name']] = true; } else { $active_center_action = null; } } //ブロック情報取得 if ($active_center_action == null) { $page_id_arr = array($this->page_id, $leftcolumn_page_id, $rightcolumn_page_id, $headercolumn_page_id); } else { $page_id_arr = array($leftcolumn_page_id, $rightcolumn_page_id, $headercolumn_page_id); } $blocks = $this->blocksView->getBlockByPageId($page_id_arr); //$auth_id = $this->session->getParameter("_auth_id"); //$active_center_actionをassign $this->_renderer->assign('active_center_action', $active_center_action); //main_action_nameをassign $this->_renderer->assign('main_action_name', "pages_view_main"); //main_display_positionをassign $this->_renderer->assign('main_display_position', $main_display_position); //add_blockしたブロックID取得 $_editing_block_id = $this->session->getParameter("_editing_block_id"); // ページテーマ---------------------------------------------------- $page_theme_render = ""; $leftcolumn_flag = $pages_obj[$this->page_id]['leftcolumn_flag']; $rightcolumn_flag = $pages_obj[$this->page_id]['rightcolumn_flag']; $header_flag = $pages_obj[$this->page_id]['header_flag']; $footer_flag = $pages_obj[$this->page_id]['footer_flag']; $theme_name = $pages_obj[$this->page_id]['theme_name']; $temp_name = $pages_obj[$this->page_id]['temp_name']; $this->_renderer->assign('page_id', intval($this->page_id)); $this->_renderer->assign('leftcolumn_flag', intval($leftcolumn_flag)); $this->_renderer->assign('rightcolumn_flag', intval($rightcolumn_flag)); $this->_renderer->assign('header_flag', intval($header_flag)); $this->_renderer->assign('footer_flag', intval($footer_flag)); $this->_renderer->assign('theme_name', $theme_name); $this->_renderer->assign('body_style', $pages_obj[$this->page_id]['body_style']); $this->_renderer->assign('header_style', $pages_obj[$this->page_id]['header_style']); $this->_renderer->assign('footer_style', $pages_obj[$this->page_id]['footer_style']); $this->_renderer->assign('leftcolumn_style', $pages_obj[$this->page_id]['leftcolumn_style']); $this->_renderer->assign('centercolumn_style', $pages_obj[$this->page_id]['centercolumn_style']); $this->_renderer->assign('rightcolumn_style', $pages_obj[$this->page_id]['rightcolumn_style']); if ($this->session->getParameter("_auth_id") >= _AUTH_CHIEF) { $pagestyle_list = $this->session->getParameter("pagestyle_list"); if (isset($pagestyle_list[$this->page_id]) && $this->pagestyle_x && $this->pagestyle_y) { $this->pagestyle_x = intval($this->pagestyle_x); $this->pagestyle_y = intval($this->pagestyle_y); $template_dir = $template_dir = MODULE_DIR . "/pages/templates/"; $this->_renderer->setTemplateDir($template_dir); //キャッシュ処理をしない $caching = $this->_renderer->getCaching(); $this->_renderer->setCaching(0); $template_name = "pagestyle_script.html"; $this->_renderer->assign('pagestyle_x', $this->pagestyle_x); $this->_renderer->assign('pagestyle_y', $this->pagestyle_y); if ($this->active_tab == null) { $this->active_tab = 0; } $this->_renderer->assign('active_tab', $this->active_tab); $page_theme_render = $this->_renderer->fetch($template_name); //キャッシュ処理を元に戻す $this->_renderer->setCaching($caching); } } $layoutmode = $this->session->getParameter("_layoutmode"); $this->session->setParameter("_layoutmode_centercolumn", $layoutmode); $this->_renderer->assign('layoutmode', $layoutmode); //ページテーマに対応したブロックテーマ読み込み $theme_list = $this->session->getParameter("_theme_list"); if ($this->session->getParameter("_user_id") == 0) { //ログイン前 // 自動登録 $autoregist_use = $this->configView->getConfigByConfname(_SYS_CONF_MODID, 'autoregist_use'); $this->_renderer->assign('autoregist_use', $autoregist_use['conf_value']); $config =& $this->getData->getParameter("config"); $this->_renderer->assign('use_ssl', $config[_SYS_CONF_MODID]['use_ssl']['conf_value']); } // メイン---------------------------------------------------- $include_dir_name_css_arr = array(); $include_block_id_css_arr = array(); if (is_array($blocks)) { $lang = $this->_renderer->get_template_vars("lang"); $conf = $this->_renderer->get_template_vars("conf"); //module_obj取得 $moduleidList = array(); foreach ($blocks as $block) { $moduleidList[$block['module_id']] = $block['module_id']; } //$modules_obj = null; $func = array($this, 'fetchcallback'); list($modules_obj, $include_dir_name_arr) = $this->modulesView->getModulesById($moduleidList, $func); $this->getData->setParameter("modules", $modules_obj); $default_entry_page_id = 0; $count = 0; $active_action_err_flag = true; foreach ($blocks as $block) { if ($default_entry_page_id != $block['page_id']) { //カラムがかわったら if ($this->session->getParameter("_default_entry_auth_group")) { if (isset($pages_obj[$block['page_id']]['page_id']) && $pages_obj[$block['page_id']]['space_type'] == _SPACE_TYPE_GROUP && $pages_obj[$block['page_id']]['private_flag'] == _OFF) { $this->session->setParameter("_default_entry_auth", $this->session->getParameter("_default_entry_auth_group")); $this->session->setParameter("_default_entry_hierarchy", $this->session->getParameter("_default_entry_hierarchy_group")); } else { if ($pages_obj[$block['page_id']]['private_flag'] == _ON) { $this->session->setParameter("_default_entry_auth", $this->session->getParameter("_default_entry_auth_private")); $this->session->setParameter("_default_entry_hierarchy", $this->session->getParameter("_default_entry_hierarchy_private")); } else { $this->session->setParameter("_default_entry_auth", $this->session->getParameter("_default_entry_auth_public")); $this->session->setParameter("_default_entry_hierarchy", $this->session->getParameter("_default_entry_hierarchy_public")); } } } else { $this->session->setParameter("_default_entry_auth", _AUTH_GUEST); $this->session->setParameter("_default_entry_hierarchy", _HIERARCHY_GUEST); } $default_entry_page_id = $block['page_id']; } if ($pages_obj[$block['page_id']]['display_position'] == _DISPLAY_POSITION_HEADER && !$header_flag || $pages_obj[$block['page_id']]['display_position'] == _DISPLAY_POSITION_LEFT && !$leftcolumn_flag || $pages_obj[$block['page_id']]['display_position'] == _DISPLAY_POSITION_RIGHT && !$rightcolumn_flag) { $count++; continue; } if ($this->session->getParameter("_user_id") == 0) { //ログイン前 $pages_obj[$block['page_id']]['authority_id'] == _AUTH_OTHER; } else { if ($pages_obj[$block['page_id']]['authority_id'] == null) { $pages_obj[$block['page_id']]['authority_id'] = $this->session->getParameter("_default_entry_auth"); } $this->session->setParameter("_auth_id", intval($pages_obj[$block['page_id']]['authority_id'])); $this->session->setParameter("_hierarchy", intval($pages_obj[$block['page_id']]['hierarchy'])); } if (!isset($block['theme_name']) || $block['theme_name'] == "" || $this->session->getParameter("_change_blocktheme") == _OFF) { //block_theme=任意(ページテーマにあわせる) //ブロックテーマの変更を許さない場合等 $block['theme_name'] = $theme_list[$pages_obj[$block['page_id']]['display_position']]; $blocks[$count]['theme_name'] = $block['theme_name']; } $include_block_id_css_arr[] = $block['block_id']; $include_dir_name_css_arr[$block['theme_name']] = $block['theme_name']; //Active Action指定 //検索結果等のリンク先で使用 $active_action_flag = false; if ($block['action_name'] != "pages_view_grouping" && $this->active_action != null && $this->block_id == $block['block_id']) { $pathList = explode("_", $block['action_name']); $pathActiveList = explode("_", $this->active_action); $active_action_err_flag = false; if ($pathList[0] == $pathActiveList[0]) { $block['action_name'] = $this->active_action; $active_action_flag = true; $action_name = $block['action_name']; $pathList = $pathActiveList; } else { // エラー $errorList->add(get_class($this), _INVALID_INPUT . "_" . $pathList[0] . "_" . $pathActiveList[0]); break; } } else { $action_name = $block['action_name']; $pathList = explode("_", $action_name); } $this->session->setParameter("_shortcut_flag", intval($block['shortcut_flag'])); //add_blockかどうか //$layoutmode == "on"でなくても編集できるブロックがある if ($_editing_block_id != null && $block['block_id'] == $_editing_block_id && isset($modules_obj[$pathList[0]]['edit_action_name']) && $modules_obj[$pathList[0]]['edit_action_name'] != "") { $blocks[$count]['action_name'] = $modules_obj[$pathList[0]]['edit_action_name']; $block['action_name'] = $modules_obj[$pathList[0]]['edit_action_name']; $action_name = $block['action_name']; $pathList = explode("_", $action_name); } if ($block['url'] == "" || $block['url'] == null || $block['url'] == BASE_URL) { $mysite = true; } else { $mysite = false; } //既に読み込んでいる場合、スキップ if (!isset($headerinc_buf[$block['url'] . ":" . $block['action_name'] . ":" . $block['theme_name'] . ":" . $block['temp_name']])) { if ($mysite) { //自サイト //include_header読み込み $headerInc->setParams($block['action_name'], $block['block_id'], $block['theme_name'], $block['temp_name']); $res = $headerInc->execute(); if ($res) { $this->pagesCompmain->setHeaderArray($res, $block, $all_headerinc_arr); } } else { //他サイト $header_url = $block['url'] . "?action=headerinc_view_main&action_name=" . $block['action_name'] . $block['parameters'] . "&theme_name=" . $block['theme_name'] . "&temp_name=" . $block['temp_name'] . "&print_flag=1"; //TODO:他サイトの場合、キャッシュをもたせるようなしくみが必要 //また無駄なフィルターをチェックしないようにする? $res = $this->requestMain->getResponseHtml($header_url); $this->pagesCompmain->setHeaderArray($res, $block, $all_headerinc_arr); } $headerinc_buf[$block['url'] . ":" . $block['action_name'] . ":" . $block['theme_name'] . ":" . $block['temp_name']] = true; } if ($mysite) { // //自サイト // //if($block['shortcut_flag']) { // $blocks[$count]['full_path'] = BASE_URL.INDEX_FILE_NAME."?action=".$block['action_name'].$block['parameters']."&ref_block_id=".$block['block_id']; //絶対座標に変換 //} else $blocks[$count]['full_path'] = BASE_URL . INDEX_FILE_NAME . "?action=" . $block['action_name'] . "&block_id=" . $block['block_id'] . "&page_id=" . $block['page_id']; //絶対座標に変換 //$active_block_objs[] = $block; //$this->preexecute->preExecute($action_name, array("action" =>$action_name, "theme_name" =>$block['theme_name'], "temp_name" =>$block['temp_name'], "block_id" =>$block['block_id'],"_header" =>"0","style" =>"display:none;")); } else { $blocks[$count]['full_path'] = $block['url'] . "?action=" . $block['action_name'] . "&block_id=" . $block['block_id'] . "&page_id=" . $block['page_id']; //絶対座標に変換 } //if(!isset($pages_obj[$block['page_id']])) { // //ショートカットが貼り付けてある // $buf_pages = $pages->getPageById($page_id_arr); // //データセット // $this->getData->setParameter("pages",$block['page_id']); // $pages_obj[$block['page_id']] = $buf_pages; //} $block_objs[$pages_obj[$block['page_id']]['display_position']][$block['parent_id']][$block['col_num']][$block['row_num']] = $blocks[$count]; $block_objs_id[$block['block_id']] =& $blocks[$count]; $this->getData->setParameter("blocks", $block_objs_id); //権限設定 //$this->session->setParameter("_auth_id",$pages_obj[$block['page_id']]['authority_id']); if ($block['action_name'] != "pages_view_grouping") { //ob_start(); if ($mysite) { //parametersの配列分解 $params_sub = array(); $params = array("action" => $block['action_name'], "theme_name" => $block['theme_name'], "temp_name" => $block['temp_name'], "page_id" => $block['page_id'], "room_id" => $pages_obj[$block['page_id']]['room_id'], "block_id" => $block['block_id'], "module_id" => $block['module_id'], "_restful_permalink" => $this->request->getParameter("_restful_permalink"), "_layoutmode" => $layoutmode, "_header" => "0", "_output" => "0"); if (isset($block['parameters']) && $block['parameters'] != "") { $parameters = split("&", $block['parameters']); foreach ($parameters as $parameter) { $paramArray = split('=', $parameter); if ($paramArray[0] != "") { $params_sub[$paramArray[0]] = $paramArray[1]; } } $params = array_merge($params, $params_sub); } //TODO:現状、使用していないためコメント _ref_block_idをセット //if($block['shortcut_flag']) { // $buf_id = $params['block_id']; // $params['block_id'] = $params['_ref_block_id']; // $params['_ref_block_id'] = $buf_id; //} $this->commonMain->getTopId($block['block_id'], $block['module_id']); if ($active_action_flag) { $html[$block['block_id']] = $this->preexecute->preExecute($block['action_name'], $params, true); } else { $html[$block['block_id']] = $this->preexecute->preExecute($block['action_name'], $params); } //$block_objs[$block['thread_num']][$block['parent_id']][$block['col_num']][$block['row_num']][$block['block_id']] = $this->response->getResult(); //$html[$block['block_id']] = $this->response->getResult(); } else { //TODO:他サイトの場合、キャッシュをもたせるようなしくみが必要 //$block_objs[$block['thread_num']][$block['parent_id']][$block['col_num']][$block['row_num']][$block['block_id']] = $this->requestMain->getResponseHtml($block_obj[$count]['full_path']); $html[$block['block_id']] = $this->requestMain->getResponseHtml($blocks[$count]['full_path']); } } $count++; } if ($this->active_action != null && $active_action_err_flag == true) { // active_actionの指定があるが、それに対応したブロックなし $pathActiveList = explode("_", $this->active_action); $errorList->add(get_class($this), sprintf(_ACCESS_FAILURE_DELETE_BLOCK, $this->modulesView->loadModuleName($pathActiveList[0]), CURRENT_URL)); } if ($errorList->isExists()) { $this->commonMain->redirectHeader(); } $this->_renderer->clearAction(); $this->_renderer->clearErrorList(); $this->_renderer->clearToken(); $this->_renderer->clearScriptName(); $this->_renderer->clear_assign('lang'); $this->_renderer->clear_assign('conf'); $this->_renderer->assign("lang", $lang); $this->_renderer->assign("conf", $conf); } if ($this->pagesCompmain->setLoginHtml()) { $include_dir_name_arr[] = 'login'; } if ($_editing_block_id != null) { $this->session->removeParameter("_editing_block_id"); } //------------------------------------------------- // ヘッダー //------------------------------------------------- //TODO:configにもたすようにする可能性あり //$leftcolumn_flag = $pages_obj[$leftcolumn_page_id]['leftcolumn_flag']; //$rightcolumn_flag = $pages_obj[$rightcolumn_page_id]['rightcolumn_flag']; //pagetheme //if(file_exists(MODULE_DIR."/pages/templates/".$pages_obj[$this->page_id]['theme_name']."/header.html")) { // $this->_renderer->assign('pagetheme_name',$pages_obj[$this->page_id]['theme_name']); //} else { // $this->_renderer->assign('pagetheme_name',"default"); //} //setting.gif /* $this->_renderer->assign('_theme_name', $pages_obj[$this->page_id]['theme_name']); $theme_arr = explode("_", $pages_obj[$this->page_id]['theme_name']); if(count($theme_arr) == 1) { $this->_renderer->assign('_theme_first_name', $pages_obj[$this->page_id]['theme_name']); $this->_renderer->assign('_theme_second_name', "default"); } else { $this->_renderer->assign('_theme_first_name', $theme_arr[0]); $this->_renderer->assign('_theme_second_name', $theme_arr[1]); } */ //if(file_exists(HTDOCS_DIR."/themes/images/".$pages_obj[$this->page_id]['theme_name']."/setting.gif")) { // $this->_renderer->assign('imagetheme_name',$pages_obj[$this->page_id]['theme_name']); //} else { // $this->_renderer->assign('imagetheme_name',"default"); //} $this->_renderer->assign('temp_name', $pages_obj[$this->page_id]['temp_name']); //$this->pagesCompmain->showHeader($pages_obj[$this->page_id],$all_headerinc_arr, $include_dir_name_css_arr, $include_block_id_css_arr, true); //if($ob_buffer) { // print $ob_buffer; // flush(); //} //------------------------------------------------- // コンテンツ //------------------------------------------------- if (is_array($block_objs)) { $template_dir = WEBAPP_DIR . "/templates/" . "main/"; //$template_dir = $template_dir = MODULE_DIR . "/pages/templates/".$pages_obj[$this->page_id]['temp_name']."/"; $this->_renderer->setTemplateDir($template_dir); //キャッシュ処理をしない $caching = $this->_renderer->getCaching(); $this->_renderer->setCaching(0); $this->_renderer->assign('centercolumn_page_id', $this->page_id); if ($header_flag) { //header $this->_renderer->assign('content_header_field', $this->pagesCompmain->setPageFetch($block_objs, $pages_obj, $html, $template_dir, _DISPLAY_POSITION_HEADER, 0, 0)); } if ($leftcolumn_flag) { $this->_renderer->assign('content_left_field', $this->pagesCompmain->setPageFetch($block_objs, $pages_obj, $html, $template_dir, _DISPLAY_POSITION_LEFT, 0, 0)); } if ($active_center_action == null) { $this->_renderer->assign('content_center_field', $this->pagesCompmain->setPageFetch($block_objs, $pages_obj, $html, $template_dir, _DISPLAY_POSITION_CENTER, 0, 0)); } if ($rightcolumn_flag) { $this->_renderer->assign('content_right_field', $this->pagesCompmain->setPageFetch($block_objs, $pages_obj, $html, $template_dir, _DISPLAY_POSITION_RIGHT, 0, 0)); } //モジュール追加ボックス if ($layoutmode == "on") { $self_toppublic_field =& $this->modulesView->getModulesByUsed(_SELF_TOPPUBLIC_ID); if ($header_flag) { $this->_renderer->assign('addblock_header_field', $self_toppublic_field); } if ($leftcolumn_flag) { $this->_renderer->assign('addblock_left_field', $self_toppublic_field); } //$this->_renderer->assign('addblock_left_field',$this->modulesView->getModulesByUsed($this->page_id,$this->_space_type)); if ($pages_obj[$this->page_id]['private_flag'] == _ON) { //プライベートスペース $_role_auth_id = $this->session->getParameter("_role_auth_id"); $this->_renderer->assign('addblock_center_field', $this->modulesView->getAuthoritiesModulesByUsed($_role_auth_id)); } else { //グループスペース $room_id = $pages_obj[$this->page_id]['room_id']; $this->_renderer->assign('addblock_center_field', $this->modulesView->getModulesByUsed($room_id)); } if ($rightcolumn_flag) { $this->_renderer->assign('addblock_right_field', $self_toppublic_field); } //$this->_renderer->assign('addblock_right_field',$this->modulesView->getModulesByUsed($this->page_id,$this->_space_type)); } //$template_dir = $template_dir = MODULE_DIR . "/pages/templates/".$pages_obj[$this->page_id]['temp_name']."/"; $template_dir = MODULE_DIR . "/pages/templates/" . $temp_name . "/"; $this->_renderer->setTemplateDir($template_dir); $template_name = "page.html"; //$this->_renderer->assign('current_url',BASE_URL.INDEX_FILE_NAME."?action=pages_view_main&page_id=".$this->page_id); $main_result = $this->_renderer->fetch($template_name, null, "/pages/templates/" . $pages_obj[$this->page_id]['temp_name'] . "/"); //キャッシュ処理を元に戻す $this->_renderer->setCaching($caching); //print $main_result; } if ($active_center_action != null) { $pathList = explode("_", $active_center_action); $include_dir_name_arr[] = $pathList[0]; } $this->pagesCompmain->showHeader($pages_obj[$this->page_id], $include_dir_name_arr, $all_headerinc_arr, $include_dir_name_css_arr, $include_block_id_css_arr, true); if (isset($main_result)) { print $main_result; } //------------------------------------------------- // フッター //------------------------------------------------- $this->pagesCompmain->showFooter($pages_obj[$this->page_id], $include_dir_name_arr); if ($buf_layoutmode == "on" || $buf_layoutmode == "off") { $this->session->setParameter("_layoutmode", $buf_layoutmode); } // footer_終了---------------------------------------------------- if ($page_theme_render != "") { print $page_theme_render; } return 'success'; }
/** * グルーピング処理 * * @access public */ function execute() { //表示カウント++ $this->pagesAction->updShowCount($this->page_id); // //グルーピングブロック新規登録 // $blocks_obj =& $this->getData->getParameter("blocks"); $insert_block_obj = $blocks_obj[$this->block_id]; $time = timezone_date(); $site_id = $this->session->getParameter("_site_id"); $user_id = $this->session->getParameter("_user_id"); $user_name = $this->session->getParameter("_handle"); $insert_block_obj['site_id'] = $site_id; $insert_block_obj['insert_time'] = $time; $insert_block_obj['insert_user_id'] = $user_id; $insert_block_obj['insert_user_name'] = $user_name; $insert_block_obj['update_time'] = $time; $insert_block_obj['update_user_id'] = $user_id; $insert_block_obj['update_user_name'] = $user_name; array_shift($insert_block_obj); $insert_block_obj['block_name'] = PAGES_GROUPING_DEFAULT_BLOCK_NAME; $insert_block_obj['action_name'] = "pages_view_grouping"; $insert_block_obj['module_id'] = 0; $insert_block_obj['theme_name'] = "noneframe"; //noneframe固定 $insert_block_obj['temp_name'] = ""; //なし固定 $insert_block_obj['min_width_size'] = 0; $insert_block_obj['topmargin'] = 0; $insert_block_obj['rightmargin'] = 0; $insert_block_obj['leftmargin'] = 0; $insert_block_obj['bottommargin'] = 0; $ins_block_id = $this->blocksAction->insBlock($insert_block_obj, false); if (!$ins_block_id) { return 'error'; } $cellLists = explode(":", $this->grouping_list); $col_num = 1; $row_num = 1; //$dec_col_num = 1; //$dec_row_num = 1; $block_children_arr = array(); foreach ($cellLists as $cellList) { $rowLists = explode(",", $cellList); foreach ($rowLists as $rowList) { $block_id = $rowList; $block_obj =& $this->blocksView->getBlockById($block_id); ////$block_obj =& $blocks_obj[$block_id]; //$block_obj =& $this->blocksView->getBlockById($block_id); //ブロックが存在しないならばエラー if (!$block_obj && !is_array($block_obj)) { $errorList =& $this->actionChain->getCurErrorList(); $errorList->add("block_id" . $block_id, PAGES_NOEXISTS_BLOCK); return 'error'; } //グルーピング先ならば、前詰めする必要がないため処理しない if ($this->block_id != $block_obj['block_id']) { //前詰め処理(移動元) $params = array("update_time" => $time, "update_user_id" => $user_id, "update_user_name" => $user_name, "page_id" => $block_obj['page_id'], "block_id" => $block_obj['block_id'], "parent_id" => $block_obj['parent_id'], "col_num" => $block_obj['col_num'], "row_num" => $block_obj['row_num']); $result = $this->blocksAction->decrementRowNum($params); if (!$result) { return 'error'; } //$dec_row_num--; $params_row_count = array("page_id" => $block_obj['page_id'], "parent_id" => $block_obj['parent_id'], "col_num" => $block_obj['col_num']); $count_row_num = $this->blocksView->getCountRownumByColnum($params_row_count); if ($count_row_num == 1) { //移動前の列が1つしかなかったので //列-- $params = array("update_time" => $time, "update_user_id" => $user_id, "update_user_name" => $user_name, "page_id" => $block_obj['page_id'], "block_id" => $block_obj['block_id'], "parent_id" => $block_obj['parent_id'], "col_num" => $block_obj['col_num']); $result = $this->blocksAction->decrementColNum($params); if (!$result) { return 'error'; } //$dec_col_num--; } } $block_obj['col_num'] = $col_num; $block_obj['row_num'] = $row_num; $block_obj['thread_num'] = intval($block_obj['thread_num']) + 1; $block_obj['parent_id'] = $ins_block_id; $root_id = $block_obj['root_id']; if ($insert_block_obj['parent_id'] == 0) { $block_obj['root_id'] = $ins_block_id; } $result = $this->blocksAction->updBlock($block_obj, array("block_id" => $block_obj['block_id']), false); if (!$result) { return 'error'; } //グループ化しているブロックならば,そのグループの子供を求める if ($block_obj['action_name'] == "pages_view_grouping") { if ($root_id == 0) { $root_id = $block_obj['block_id']; } $block_obj_children = $this->blocksView->getBlockByRootId($root_id); $parent_id_arr = array($block_obj['block_id']); $buf_block_children_arr = array(); foreach ($block_obj_children as $block_obj_child) { if (in_array($block_obj_child['parent_id'], $parent_id_arr)) { $parent_id_arr[] = $block_obj_child['block_id']; $buf_block_children_arr[] = $block_obj_child; } } $block_children_arr[$block_obj['block_id']] = $buf_block_children_arr; } $row_num++; //$dec_row_num++; } $col_num++; //$dec_col_num++; $row_num = 1; //$dec_row_num = 1; } //子ブロックがあればthread_num,root_id更新 //但し、root_idは、トップエレメントが登録された場合にのみ更新 if (isset($block_children_arr)) { foreach ($block_children_arr as $key_block_id => $block_obj_children) { foreach ($block_obj_children as $block_obj_child) { if ($key_block_id == $block_obj_child['block_id'] || $ins_block_id == $block_obj_child['block_id']) { continue; } $block_obj_child['thread_num'] = intval($block_obj_child['thread_num']) + 1; if ($insert_block_obj['parent_id'] == 0) { $block_obj_child['root_id'] = $ins_block_id; } //もし、親IDが追加したブロックの親IDと等しいならば、 //親IDを追加ブロックIDに変更 if ($block_obj_child['parent_id'] == $insert_block_obj['parent_id']) { $block_obj_child['parent_id'] = $ins_block_id; } $result = $this->blocksAction->updBlock($block_obj_child, array("block_id" => $block_obj_child['block_id'])); if (!$result) { return 'error'; } } } } //空TD-column挿入 $renderer =& SmartyTemplate::getInstance(); $empty_columns[0] = ""; $renderer->assign('columns', $empty_columns); $renderer->assign('main_action_name', $this->session->getParameter('_main_action_name')); //$renderer->assign('main_block_id',null); $this->request->setParameter("block_id", $ins_block_id); $this->request->setParameter("page_id", $insert_block_obj['page_id']); $this->request->setParameter("action", "pages_view_grouping"); $this->commonMain->getTopId($ins_block_id); return 'success'; }
/** * execute実行 * * @access public */ function execute() { $return_str = $this->op == "none_redirect" ? $this->op : "success"; $this->redirect_url = BASE_URL . INDEX_FILE_NAME; $renderer =& SmartyTemplate::getInstance(); $renderer->assign('header_field', $this->configView->getMetaHeader()); $config = $this->configView->getConfigByCatid(_SYS_CONF_MODID, _ENTER_EXIT_CONF_CATID); if ($config['autoregist_use']['conf_value'] != _ON) { $this->redirect_message = LOGIN_ERR_AUTOREGIST_USE; return $return_str; } $user = $this->usersView->getUserById($this->user_id); if ($user === false) { // 会員が削除されている $this->redirect_message = LOGIN_ERR_NONE_EXISTS_USER; return $return_str; } if ($user['active_flag'] == _USER_ACTIVE_FLAG_ON || $user['active_flag'] == _USER_ACTIVE_FLAG_OFF) { //既に承認済 $this->redirect_message = LOGIN_MES_APPROVED; return $return_str; } if ($user['activate_key'] != "" && $user['activate_key'] != $this->activate_key) { $this->redirect_message = LOGIN_ERR_ACTIVATION; return $return_str; } if ($config['autoregist_approver']['conf_value'] == _AUTOREGIST_ADMIN && ($user['active_flag'] == _USER_ACTIVE_FLAG_PENDING || $this->op == "none_redirect")) { //管理者の承認が必要 // activate_key変更し、登録会員へメール送信 $activate_key = substr(md5(uniqid(mt_rand(), 1)), 0, LOGIN_ACTIVATE_KYE_LEN); $user_params = array("activate_key" => $activate_key, "active_flag" => _USER_ACTIVE_FLAG_MAILED); $where_params = array("user_id" => $this->user_id); $result = $this->usersAction->updUsers($user_params, $where_params); if ($result === false) { return 'error'; } // ---------------------------------------------------------------------- // --- メール送信処理 --- // ---------------------------------------------------------------------- $mail_autoregist_subject = $config['mail_approval_subject']['conf_value']; $mail_autoregist_body = $config['mail_approval_body']['conf_value']; $where_params = array("{users_items_link}.user_id" => $this->user_id, "(type='mobile_email' OR type='email')" => null); $items = $this->usersView->getItems($where_params); if ($items === false) { return 'error'; } if (!isset($items[0]['content'])) { $this->redirect_message = LOGIN_ERR_ACTIVATION; return $return_str; } $email_arr = array(); foreach ($items as $item) { $email_arr[] = $item['content']; } //$email = $items[0]['content']; // ユーザ自身の確認が必要 $mail_autoregist_body .= "<br />" . BASE_URL . INDEX_FILE_NAME . "?action=login_action_main_approver" . "&user_id=" . $this->user_id . "&activate_key=" . $activate_key . "&_header=" . _OFF . "<br />"; foreach ($email_arr as $email) { $user['email'] = $email; $user['type'] = "text"; // Text固定(html or text) $this->mailMain->addToUser($user); } $this->mailMain->setSubject($mail_autoregist_subject); $this->mailMain->setBody($mail_autoregist_body); $this->mailMain->send(); $this->redirect_message = LOGIN_MES_MAIL_ANNOUNCE; return $return_str; } else { //会員自身の確認が必要 //自動的にアカウントを有効にする if ($user['active_flag'] != _USER_ACTIVE_FLAG_MAILED && $user['active_flag'] != _USER_ACTIVE_FLAG_PENDING) { $this->redirect_message = LOGIN_ERR_ACTIVATION; return $return_str; } $user_params = array("activate_key" => "", "active_flag" => _USER_ACTIVE_FLAG_ON); $where_params = array("user_id" => $this->user_id); $result = $this->usersAction->updUsers($user_params, $where_params); if ($result === false) { return 'error'; } $this->redirect_message = LOGIN_MES_ACTIVATION; return $return_str; } }
/** * ポストフィルタ * Viewの処理を実行 * @access private */ function _postfilter() { $action = $this->_request->getParameter(ACTION_KEY) ? $this->_request->getParameter(ACTION_KEY) : DEFAULT_MOBILE_ACTION; $_smartphone_flag = $this->_session->getParameter('_smartphone_flag'); $renderer =& SmartyTemplate::getInstance(); $action_name = $this->_actionChain->getCurActionName(); $pathList = explode("_", $action_name); $common =& $this->_container->getComponent("commonMain"); $view = $this->_response->getView(); $token =& $this->_container->getComponent("Token"); if (is_object($token)) { $renderer->setToken($token); } $id = $this->_session->getParameter("_id"); $theme = $this->getAttribute("define:theme", _OFF); $themeList = explode(",", $theme); $template = $this->getAttribute($view); if ($template == "") { if ($view == USE_CACHE) { //キャッシュを使用するため、ファイル名が未指定 } elseif ($view == TOKEN_ERROR_TYPE || $view == VALIDATE_ERROR_TYPE || $view == UPLOAD_ERROR_TYPE) { $template = $this->getAttribute("error", "main:mobile_error.html"); $theme = _ON; $themeList = explode(",", $theme); } else { $this->_log->error(sprintf("テンプレートファイルの取得に失敗しました(%s)", $view), "{$this->_className}#_postfilter"); exit; } } $_reader_flag = $this->_session->getParameter("_reader_flag"); if ($_reader_flag == _OFF) { $session_param = "&" . session_name() . "=" . session_id(); $form_session = "<input type=\"hidden\" name=\"" . session_name() . "\" value=\"" . session_id() . "\">"; } else { $session_param = ""; $form_session = ""; } if (preg_match("/^(action:)/", $template)) { $actionList = preg_replace("/action:/", "", $template); $actionList = explode(",", $actionList); $action = trim(array_shift($actionList)); $this->_actionChain->add($action); } elseif (preg_match("/^(location:)/", $template)) { $action_obj =& $this->_actionChain->getCurAction(); $toArray = get_object_vars($action_obj); $pattern = array("/location:/", "/{session_param}/", "/{DEFAULT_ACTION}/", "/{DEFAULT_MOBILE_ACTION}/"); $replace = array("", $session_param, DEFAULT_ACTION, DEFAULT_MOBILE_ACTION); foreach ($toArray as $key => $obj) { $type = strtolower(gettype($obj)); if ($type != "string" && $type != "integer") { continue; } $pattern[] = "/{" . $key . "}/"; $replace[] = $obj; } $parameter = preg_replace($pattern, $replace, $template); $mobile_modules = $this->_getdata->getParameter("mobile_modules"); $url = BASE_URL . INDEX_FILE_NAME . "?" . ACTION_KEY . "=" . (!empty($parameter) ? $parameter : DEFAULT_ACTION); if ($action_name == "login_action_main_init") { $mobile_redirect_url = $this->_session->getParameter("_mobile_redirect_url"); if ($mobile_redirect_url != "") { $this->_session->removeParameter("_mobile_redirect_url"); $url = BASE_URL . INDEX_FILE_NAME . "?" . substr($mobile_redirect_url, 1) . $session_param; } } header('Location: ' . $url); return; } else { $themeStr = ""; $tempStr = ""; $retAssign = $common->viewAssign($renderer); if (is_array($retAssign)) { list($page_id, $themeStr, $tempStr, $min_width_size, $url_htmlspecialchars) = $retAssign; } $mobile_modules = $this->_getdata->getParameter("mobile_modules"); if ($action == DEFAULT_MOBILE_ACTION) { $current_dir_name = $this->_session->getParameter("_mobile_default_module"); } else { $current_dir_name = $pathList[0]; } $module_name = ""; if (isset($mobile_modules[_DISPLAY_POSITION_HEADER]) && isset($mobile_modules[_DISPLAY_POSITION_HEADER][$current_dir_name])) { $module_name = $mobile_modules[_DISPLAY_POSITION_HEADER][$current_dir_name]["module_name"]; } if (isset($mobile_modules[_DISPLAY_POSITION_CENTER]) && isset($mobile_modules[_DISPLAY_POSITION_CENTER][$current_dir_name])) { $module_name = $mobile_modules[_DISPLAY_POSITION_CENTER][$current_dir_name]["module_name"]; } $action_obj =& $this->_actionChain->getCurAction(); $renderer->setAction($action_obj); $errorList =& $this->_actionChain->getCurErrorList(); $renderer->setErrorList($errorList); $renderer->setScriptName($_SERVER['SCRIPT_NAME']); $config =& $this->_container->getComponent("configView"); $meta = $config->getMetaHeader(); $renderer->assign('header_field', $meta); $main_action_name = $this->_session->getParameter('_main_action_name'); $renderer->assign('main_action_name', $main_action_name); $renderer->assign('session_param', $session_param); if (is_object($token) && $token->getValue() != '') { $token_param = "<input type=\"hidden\" name=\"_token\" value=\"" . $token->getValue() . "\">"; $renderer->assign('token_form', $token_param); } $renderer->assign('session_form', $form_session); $renderer->assign('current_module_name', $module_name); $block_id = intval($this->_request->getParameter("block_id")); $page_id = $this->_session->getParameter("_mobile_page_id"); $room_id = $this->_session->getParameter("_mobile_room_id"); $renderer->assign('block_id', $block_id); $renderer->assign('page_id', $page_id); $renderer->assign('room_id', $room_id); $lang = $renderer->get_template_vars("lang"); $conf = $renderer->get_template_vars("conf"); // add by AllCreator $modulesView =& $this->_container->getComponent("modulesView"); $mobile_obj = $modulesView->getModuleByDirname("mobile"); $mobile_config = $config->getConfig($mobile_obj["module_id"], false); $renderer->assign('color_back', $mobile_config['mobile_color_back']['conf_value']); $renderer->assign('color_text', $mobile_config['mobile_color_text']['conf_value']); $renderer->assign('color_link', $mobile_config['mobile_color_link']['conf_value']); $renderer->assign('color_vlink', $mobile_config['mobile_color_vlink']['conf_value']); $renderer->assign('smartphone_theme_color', $mobile_config['mobile_smt_theme_color']['conf_value']); if (preg_match("/^(main:mobile_dialog.html)/", $template)) { $method = $this->getAttribute("method", "post"); $renderer->assign('method', $method); $regist_action = $this->getAttribute("regist_action", ""); $renderer->assign('regist_action', $regist_action); $cancel_action = $this->getAttribute("cancel_action", ""); $renderer->assign('cancel_action', $cancel_action); $messages = $this->getAttribute('message', ""); $messages = explode(",", $messages); $confirm_message = $messages[0]; if (preg_match("/^define:/", $confirm_message)) { $confirm_message = preg_replace("/^define:/", "", $confirm_message); $confirm_message = defined($confirm_message) ? constant($confirm_message) : $confirm_message; } elseif (preg_match("/^lang./", $confirm_message)) { $confirm_message = preg_replace("/^lang./", "", $confirm_message); $confirm_message = isset($lang[$confirm_message]) ? $lang[$confirm_message] : $confirm_message; } elseif (preg_match("/^conf./", $confirm_message)) { $confirm_message = preg_replace("/^conf./", "", $confirm_message); $confirm_message = isset($conf[$confirm_message]) ? $conf[$confirm_message] : $confirm_message; } else { $confirm_message = isset($toArray[$confirm_message]) ? $toArray[$confirm_message] : $confirm_message; } if (count($messages) > 1) { $messages = array_slice($messages, 1); foreach ($messages as $i => $message) { if (preg_match("/^define:/", $message)) { $message = preg_replace("/^define:/", "", $message); $message = defined($message) ? constant($message) : $message; } elseif (preg_match("/^lang./", $message)) { $message = preg_replace("/^lang./", "", $message); $message = isset($lang[$message]) ? $lang[$message] : $message; } elseif (preg_match("/^conf./", $message)) { $message = preg_replace("/^conf./", "", $message); $message = isset($conf[$message]) ? $conf[$message] : $message; } else { $message = isset($toArray[$message]) ? $toArray[$message] : $message; } $messages[$i] = $message; } $confirm_message = vsprintf($confirm_message, $messages); } $patterns = array("/\\\\n/s"); $replacements = array("<br>"); $confirm_message = preg_replace($patterns, $replacements, $confirm_message); $renderer->assign('message', $confirm_message); $request_params = $this->_request->getParameters(); $params = array(); foreach ($request_params as $key => $val) { if ($key == "action") { continue; } if (is_object($val) || is_array($val)) { continue; } if (preg_match("/^_/", $val)) { continue; } if (preg_match("/^" . session_name() . "/", $key)) { continue; } $params[$key] = $val; } $renderer->assign('params', $params); $themeList[0] = _ON; } if ($themeList[0] == _ON) { $templateList = explode(",", $template); $result = ""; foreach ($templateList as $i => $template) { if (preg_match("/^(error_location:)/", $template)) { $action_obj =& $this->_actionChain->getCurAction(); $toArray = get_object_vars($action_obj); $pattern = array("/error_location:/", "/{session_param}/", "/{DEFAULT_ACTION}/", "/{DEFAULT_MOBILE_ACTION}/"); $replace = array("", $session_param, DEFAULT_ACTION, DEFAULT_MOBILE_ACTION); foreach ($toArray as $key => $obj) { $type = strtolower(gettype($obj)); if ($type != "string" && $type != "integer") { continue; } $pattern[] = "/{" . $key . "}/"; $replace[] = $obj; } $parameter = preg_replace($pattern, $replace, $template); $renderer->assign('error_location', BASE_URL . INDEX_FILE_NAME . "?" . ACTION_KEY . "=" . (!empty($parameter) ? $parameter : DEFAULT_MOBILE_ACTION)); if (count($templateList) == 1) { $template = "main:mobile_error.html"; } else { continue; } } $result .= $this->_mobileFetch($renderer, $template, $pathList[0]); } if ($result != "") { $this->_response->setResult($result); } else { $this->_response->setResult(null); } //_outputは、pages_view_main等を呼び出した場合にprintさせないように制御するためのパラメータ $output = $this->_request->getParameter("_output"); if (isset($output) && $output == _OFF) { return; } //キャッシュ処理をしない $caching = $renderer->getCaching(); $renderer->setCaching(0); if (!empty($mobile_modules)) { $renderer->assign('header_modules', $mobile_modules[_DISPLAY_POSITION_HEADER]); } $renderer->assign('current_dir_name', $current_dir_name); $renderer->assign('contents', $result); $template_dir = WEBAPP_DIR . "/templates/" . "main/"; $template_name = "mobile.html"; $renderer->assign('session_param', $session_param); //template_dirセット $renderer->setTemplateDir($template_dir); $result = $renderer->fetch($template_name, "mobile_template", "/templates/" . "main/"); $convertHtml =& $common->registerClass(WEBAPP_DIR . '/components/convert/Html.class.php', "Convert_Html", "convertHtml"); if ($_smartphone_flag == _ON) { $convert_sjis_flag = false; } else { $convert_sjis_flag = true; } $result = $convertHtml->convertMobileHtml($result, $convert_sjis_flag); print $result; flush(); } } }
/** * 言語セット情報をクリア * * @access public **/ function clear() { $this->_lang = array(); //Smartyインスタンス取得 $renderer =& SmartyTemplate::getInstance(); $renderer->clear_assign("lang"); }
/** * プレフィルタ * 初期処理を行う * @access private */ function _prefilter() { // NetCommonsバージョンファイル読み込み if (@file_exists(WEBAPP_DIR . "/config/version.php")) { include_once WEBAPP_DIR . "/config/version.php"; } $page_id = $this->_request->getParameter("page_id"); $block_id = $this->_request->getParameter("block_id"); $_redirect_url = $this->_request->getParameter("_redirect_url"); $action_name = $this->_request->getParameter(ACTION_KEY); $attributes = $this->getAttributes(); if (!$action_name) { $action_name = DEFAULT_ACTION; $this->_request->setParameter(ACTION_KEY, DEFAULT_ACTION); } // http -> https if ($action_name == DEFAULT_ACTION && (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on') && preg_match("/^https:\\/\\//i", BASE_URL)) { $url = 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; header('Location: ' . $url); exit; } // //block_id page_id設定 // if ($page_id == null) { $page_id = 0; $this->_request->setParameter("page_id", 0); } if ($block_id == null || $block_id < 0) { $block_id = 0; $this->_request->setParameter("block_id", 0); } if ($_redirect_url) { $_redirect_url = str_replace("@@", "#", $_redirect_url); $_redirect_url = str_replace("@", "&", $_redirect_url); $_redirect_url = str_replace("?_sub_action=", "?action=", $_redirect_url); $this->_request->setParameter("_redirect_url", $_redirect_url); } // ---------------------------------------------- // --- getDataクラス取得 --- // ---------------------------------------------- //$getdata =& new GetData; //$this->_container->register($getdata, "GetData"); $getdata =& $this->_container->getComponent("GetData"); // ---------------------------------------------- // --- configデータ取得 --- // ---------------------------------------------- $config =& $this->_container->getComponent("configView"); $config_obj =& $config->getConfig(_SYS_CONF_MODID); // // _PAGESTYLE_CONF_CATID,_SECURITY_CONF_CATIDのみ保存 // $buf_config = $config_obj; //unset($buf_config[_GENERAL_CONF_CATID]); unset($buf_config[_SERVER_CONF_CATID]); unset($buf_config[_MAIL_CONF_CATID]); unset($buf_config[_META_CONF_CATID]); unset($buf_config[_ENTER_EXIT_CONF_CATID]); unset($buf_config[_DEBUG_CONF_CATID]); //if(isset($buf_config[_SECURITY_CONF_CATID]['security_level']) && // $buf_config[_SECURITY_CONF_CATID]['security_level']['conf_value'] == _SECURITY_LEVEL_NONE) { // // チェックしない場合、セキュリティ項目unset // unset($buf_config[_SECURITY_CONF_CATID]); //} $getdata->setParameter("config", $buf_config); // ------------------------------------------------------------------------------------------ // --- Session情報 --- // --- configデータよりSession情報を登録するため、Filter.Sessionではsession_start()しない --- // ------------------------------------------------------------------------------------------ if ($config_obj[_SERVER_CONF_CATID]['use_mysession']['conf_value'] && $config_obj[_SERVER_CONF_CATID]['session_name']['conf_value'] != '') { $this->_session->setName($config_obj[_SERVER_CONF_CATID]['session_name']['conf_value']); } //1.1と同様の処理:後に削除 //$sslpost_name = $this->_request->getParameter($config_obj[_GENERAL_CONF_CATID]['sslpost_name']['conf_value']); //if ($config_obj[_GENERAL_CONF_CATID]['use_ssl']['conf_value'] && // isset($sslpost_name) && $sslpost_name != '') { // session_id($sslpost_name); //} else if ($config_obj[_SERVER_CONF_CATID]['use_mysession']['conf_value'] && // $config_obj[_SERVER_CONF_CATID]['session_name']['conf_value'] != '') { // if (isset($_COOKIE[$config_obj[_SERVER_CONF_CATID]['session_name']['conf_value']])) { // session_id($_COOKIE[$config_obj[_SERVER_CONF_CATID]['session_name']['conf_value']]); // } else { // // no custom session cookie set, destroy session if any // $this->_session->close(); // } //} //if(isset($config_obj[_GENERAL_CONF_CATID]['session_gc_maxlifetime']['conf_value'])){ ini_set('session.gc_maxlifetime', $config_obj[_GENERAL_CONF_CATID]['session_gc_maxlifetime']['conf_value'] * 60); //} //------------------------------------------------------------------------------- // ---Cookieパラメータセット --- //------------------------------------------------------------------------------- $path = $config_obj[_SERVER_CONF_CATID]['cookie_path']['conf_value']; if ($path == "") { $path = "/"; $pathList = explode("_", $action_name); if (!(isset($pathList[0]) && $pathList[0] == "install")) { $path = strstr(preg_replace("/^(http:\\/\\/|https:\\/\\/)/i", "", BASE_URL), "/"); if ($path === false) { $path = '/'; } else { $buf_path = preg_replace('/^' . preg_quote($_SERVER['DOCUMENT_ROOT'], '/') . '/i', "", BASE_DIR); if ($buf_path != BASE_DIR && $buf_path != "") { if (strstr($path, $buf_path)) { $path = substr($buf_path, 0, 1) == '/' ? $buf_path : "/" . $buf_path; } } } } //$path = strstr(preg_replace("/^(http:\/\/|https:\/\/)/i","", BASE_URL), "/"); } $domain = $config_obj[_SERVER_CONF_CATID]['cookie_domain']['conf_value']; $secure = intval($config_obj[_SERVER_CONF_CATID]['cookie_secure']['conf_value']); session_set_cookie_params(0, $path, $domain, $secure); //session_set_cookie_params($config_obj[_GENERAL_CONF_CATID]['session_gc_maxlifetime']['conf_value'] * 60, $path, $domain, $secure); //ini_set("session.cookie_path", $path); //ini_set("session.cookie_domain", $domain); //ini_set("session.cookie_secure", $secure); //ini_set("session.cookie_lifetime", $config_obj[_GENERAL_CONF_CATID]['session_gc_maxlifetime']['conf_value'] * 60); //setcookie($this->_session->getName(), $this->_session->getID(), time()+($config_obj[_GENERAL_CONF_CATID]['session_gc_maxlifetime']['conf_value'] * 60)); // ---------------------------------------------- // --- セッションスタート --- // ---------------------------------------------- if (Net_UserAgent_Mobile::isMobile()) { ini_set('session.use_only_cookies', _OFF); } if (isset($attributes["regenerate_flag"]) && $attributes["regenerate_flag"] == _OFF) { $this->_session->start(_OFF); } else { $this->_session->start(intval($config_obj[_SERVER_CONF_CATID]['session_regenerate']['conf_value'])); } $user_id = $this->_session->getParameter("_user_id"); if (!isset($user_id)) { $user_id = "0"; $this->_session->setParameter("_user_id", "0"); $this->_session->setParameter("_handle", ''); } // ---------------------------------------------- // --- 固定リンク --- // ---------------------------------------------- if (isset($config_obj[_SERVER_CONF_CATID]['use_permalink']['conf_value']) && $config_obj[_SERVER_CONF_CATID]['use_permalink']['conf_value'] == _ON) { $this->_session->setParameter("_permalink_flag", _ON); } else { $this->_session->setParameter("_permalink_flag", _OFF); } // 言語セット $_lang = $this->_request->getParameter('lang'); if (!empty($_lang)) { $languages = $this->_languagesView->getLanguages(array("lang_dirname" => $_lang)); if (!isset($languages[0])) { $_lang = null; } else { $this->_session->setParameter('_lang', $_lang); } } if (empty($_lang)) { $_lang = $this->_session->getParameter('_lang'); if (empty($_lang)) { //システム管理のシステム標準使用言語の「自動」で選択している場合、自動で判断する。 if (empty($config_obj[_GENERAL_CONF_CATID]['language']['conf_value'])) { $this->_session->setParameter('_lang', $this->_getAcceptLang()); } else { $this->_session->setParameter('_lang', $config_obj[_GENERAL_CONF_CATID]['language']['conf_value']); } } } if ($action_name == "pages_view_main") { $header_menu_flag = _ON; if (isset($config_obj[_PAGESTYLE_CONF_CATID]['header_menu_flag']['conf_value'])) { $header_menu_flag = $config_obj[_PAGESTYLE_CONF_CATID]['header_menu_flag']['conf_value']; } $this->_session->setParameter("_header_menu_flag", $header_menu_flag); } // ---------------------------------------------- // --- 自動ログイン設定 --- // ---------------------------------------------- $autologin_login_cookie_name = $config_obj[_GENERAL_CONF_CATID]['autologin_login_cookie_name']['conf_value']; $autologin_pass_cookie_name = $config_obj[_GENERAL_CONF_CATID]['autologin_pass_cookie_name']['conf_value']; if (($user_id == "0" || $user_id == null) && $autologin_login_cookie_name != "" && $autologin_pass_cookie_name != "") { $login_id = isset($_COOKIE[$autologin_login_cookie_name]) ? $_COOKIE[$autologin_login_cookie_name] : null; //TODO:stripslashesする必要があるかも $pass = isset($_COOKIE[$autologin_pass_cookie_name]) ? $_COOKIE[$autologin_pass_cookie_name] : null; //TODO:stripslashesする必要があるかも if (empty($login_id) || empty($pass) || is_numeric($pass)) { $html = "error"; } else { if ($config_obj[_GENERAL_CONF_CATID]['autologin_use']['conf_value'] == _AUTOLOGIN_OK) { $params = array("action" => "login_action_main_init", "login_id" => $login_id, "password" => $pass, "md5" => "1", "_header" => "0", "_output" => "0"); if ($config_obj[_GENERAL_CONF_CATID]['autologin_use']['conf_value'] == _AUTOLOGIN_OK) { $params['rememberme'] = _OFF; } $preexecuteMain =& $this->_container->getComponent("preexecuteMain"); $html = $preexecuteMain->preExecute("login_action_main_init", $params, true); $user_id = $this->_session->getParameter("_user_id"); } else { $html = "error"; } //$usersView =& $this->_container->getComponent("usersView"); //$user =& $usersView->getUsers(array("login_id" => $login_id,"password" => $pass)); } //$cookie_path = '/' ; if ($html == "error") { if ($config_obj[_GENERAL_CONF_CATID]['autologin_use']['conf_value'] == _AUTOLOGIN_NO) { setcookie($autologin_login_cookie_name, '', time() - 3600, $path, $domain, $secure); } setcookie($autologin_pass_cookie_name, '', time() - 3600, $path, $domain, $secure); } } $user_auth_id = $this->_session->getParameter("_user_auth_id"); if ($user_auth_id == _AUTH_OTHER || $user_auth_id == null) { //ログイン前 $this->_session->setParameter("_allow_attachment_flag", _ALLOW_ATTACHMENT_NO); $this->_session->setParameter("_allow_htmltag_flag", _ALLOW_ATTACHMENT_NO); $this->_session->setParameter("_allow_video_flag", _OFF); $this->_session->setParameter("_allow_layout_flag", _OFF); $this->_session->setParameter("_private_max_size", -1); } // セッション情報をクッキーに保存する //if ($user_id > 0 && $config_obj[_SERVER_CONF_CATID]['use_mysession']['conf_value'] && // $config_obj[_SERVER_CONF_CATID]['session_name']['conf_value'] != '') { // setcookie($config_obj[_SERVER_CONF_CATID]['session_name']['conf_value'], session_id(), time()+(60 * $config_obj[_GENERAL_CONF_CATID]['session_gc_maxlifetime']['conf_value']), '/', '', 0); //} // // config設定 // if ($action_name == "encryption_view_publickey" || $action_name == "headerinc_view_main") { //公開鍵取得アクション,またはヘッダー取得処理なのでチェックしない return; /* } else if($_redirect_url && !preg_match("{^".BASE_URL."}", $_redirect_url)) { // // 他サーバ // // TODO:他サーバ処理は現状、未実装のためコメント // 他サーバからの場合、DBの値に関わらずDEBUGはOFF if (isset($attributes["debug"])) { $this->_session->setParameter("_php_debug",0); $this->_session->setParameter("_sql_debug",0); $this->_session->setParameter("_smarty_debug",0); $this->_session->setParameter("_maple_debug",0); $this->_session->setParameter("_trace_log_level",LEVEL_TRACE); } //データセット //$getdata->setParameter("mysite",false); */ } else { // // 自サーバ // // // ---------------------------------------------- // ---デバッグ関連 --- // ---------------------------------------------- if (isset($attributes["debug"])) { // DBから取得 foreach ($config_obj[_DEBUG_CONF_CATID] as $conf_rec) { switch ($conf_rec["conf_name"]) { case "php_debug": $php_debug = $conf_rec["conf_value"]; break; case "sql_debug": $sql_debug = $conf_rec["conf_value"]; break; case "smarty_debug": $smarty_debug = $conf_rec["conf_value"]; break; case "maple_debug": $maple_debug = $conf_rec["conf_value"]; break; case "trace_log_level": $trace_log_level = $conf_rec["conf_value"]; break; case "use_db_debug": $use_db_debug = $conf_rec["conf_value"]; break; } } if ($use_db_debug) { $this->_session->setParameter("_php_debug", $php_debug); if ($php_debug && version_compare(phpversion(), '5.3.0', '>=')) { error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT); } elseif ($php_debug) { error_reporting(E_ALL); } else { error_reporting(0); } $this->_session->setParameter("_sql_debug", $sql_debug); $this->_session->setParameter("_smarty_debug", $smarty_debug); $this->_session->setParameter("_maple_debug", $maple_debug); $this->_session->setParameter("_trace_log_level", $trace_log_level); $this->_session->setParameter("_use_db_debug", $use_db_debug); } } //データセット //$getdata->setParameter("mysite",true); } //debugモード if (isset($attributes["debug"])) { $sql_debug = $this->_session->getParameter("_sql_debug"); $db =& $this->_container->getComponent("DbObject"); $db->setDebugMode($sql_debug); } // ---------------------------------------------- // ---タイムゾーン --- // ---------------------------------------------- if (isset($config_obj[_GENERAL_CONF_CATID]['server_TZ'])) { $this->_session->setParameter("_server_TZ", $config_obj[_GENERAL_CONF_CATID]['server_TZ']['conf_value']); } else { // 日本時間 $this->_session->setParameter("_server_TZ", 9); } if (isset($config_obj[_GENERAL_CONF_CATID]['default_TZ'])) { $this->_session->setParameter("_default_TZ", $config_obj[_GENERAL_CONF_CATID]['default_TZ']['conf_value']); } else { // 日本時間 $this->_session->setParameter("_default_TZ", 9); } if ($user_id == "0" || $user_id == null) { $this->_session->setParameter("_timezone_offset", $this->_session->getParameter("_default_TZ")); } // main_action_name $this->_session->setParameter('_main_action_name', $action_name); $this->_session->setParameter('_session_gc_maxlifetime', $config_obj[_GENERAL_CONF_CATID]['session_gc_maxlifetime']['conf_value']); // ---------------------------------------------- // ---metaタグ設定 --- // ---------------------------------------------- $sitename = $config->getConfigByConfname(_SYS_CONF_MODID, 'sitename'); $language = $this->_languagesView->getLanguages(array("lang_dirname" => $this->_session->getParameter('_lang'))); $meta = array('sitename' => $sitename['conf_value'], 'meta_language' => $language[0]['language'], 'meta_robots' => $config_obj[_META_CONF_CATID]['meta_robots']['conf_value'], 'meta_keywords' => $config_obj[_META_CONF_CATID]['meta_keywords']['conf_value'], 'meta_description' => $config_obj[_META_CONF_CATID]['meta_description']['conf_value'], 'meta_rating' => $config_obj[_META_CONF_CATID]['meta_rating']['conf_value'], 'meta_author' => $config_obj[_META_CONF_CATID]['meta_author']['conf_value'], 'meta_copyright' => $config_obj[_META_CONF_CATID]['meta_copyright']['conf_value'], 'meta_footer' => $config_obj[_META_CONF_CATID]['meta_footer']['conf_value']); // // footer初期化 // $footer_field = array('template_footer' => "", 'script_footer' => ""); // データセット $this->_session->setParameter("_meta", $meta); // プライベートスペースを公開するかどうか $this->_session->setParameter("_open_private_space", $config_obj[_GENERAL_CONF_CATID]['open_private_space']['conf_value']); // デフォルト参加ロール権限 $_default_entry_role_auth_public = $config_obj[_GENERAL_CONF_CATID]['default_entry_role_auth_public']['conf_value']; $_default_entry_role_auth_group = $config_obj[_GENERAL_CONF_CATID]['default_entry_role_auth_group']['conf_value']; //プライベートスペースを公開した場合、使用 if ($config_obj[_GENERAL_CONF_CATID]['open_private_space']['conf_value'] != _OFF) { $_default_entry_role_auth_private = $config_obj[_GENERAL_CONF_CATID]['default_entry_role_auth_private']['conf_value']; } else { $_default_entry_role_auth_private = _ROLE_AUTH_OTHER; } // // デフォルトで参加する場合のベース権限と権限の階層をセッションにセット // // システム管理のデフォルトで参加するルームでのロール権限の設定を一般、あるいはゲストのみとしてdefine値をセット // システム管理でモデレータのロール権限を設定させる場合、authoritiesテーブルからuser_authority_id,hierarchyを // 取得しなければならない(実行時間の節約のため行わない)。 // if ($_default_entry_role_auth_public == _ROLE_AUTH_GENERAL) { $this->_session->setParameter("_default_entry_auth_public", _AUTH_GENERAL); $this->_session->setParameter("_default_entry_hierarchy_public", _HIERARCHY_GENERAL); } else { $this->_session->setParameter("_default_entry_auth_public", _AUTH_GUEST); $this->_session->setParameter("_default_entry_hierarchy_public", _HIERARCHY_GUEST); } if ($_default_entry_role_auth_group == _ROLE_AUTH_GENERAL) { $this->_session->setParameter("_default_entry_auth_group", _AUTH_GENERAL); $this->_session->setParameter("_default_entry_hierarchy_group", _HIERARCHY_GENERAL); } else { $this->_session->setParameter("_default_entry_auth_group", _AUTH_GUEST); $this->_session->setParameter("_default_entry_hierarchy_group", _HIERARCHY_GUEST); } if ($_default_entry_role_auth_private == _ROLE_AUTH_GENERAL) { $this->_session->setParameter("_default_entry_auth_private", _AUTH_GENERAL); $this->_session->setParameter("_default_entry_hierarchy_private", _HIERARCHY_GENERAL); } else { if ($_default_entry_role_auth_private == _ROLE_AUTH_OTHER) { $this->_session->setParameter("_default_entry_auth_private", _AUTH_OTHER); $this->_session->setParameter("_default_entry_hierarchy_private", _HIERARCHY_OTHER); } else { $this->_session->setParameter("_default_entry_auth_private", _AUTH_GUEST); $this->_session->setParameter("_default_entry_hierarchy_private", _HIERARCHY_GUEST); } } /* $this->_session->setParameter("_default_entry_auth_public", $config_obj[_GENERAL_CONF_CATID]['default_entry_auth_public']['conf_value']); $this->_session->setParameter("_default_entry_auth_group", $config_obj[_GENERAL_CONF_CATID]['default_entry_auth_group']['conf_value']); //プライベートスペースを公開した場合、使用 if($config_obj[_GENERAL_CONF_CATID]['open_private_space']['conf_value'] != _OFF) { $this->_session->setParameter("_default_entry_auth_private", $config_obj[_GENERAL_CONF_CATID]['default_entry_auth_private']['conf_value']); } else { $this->_session->setParameter("_default_entry_auth_private", _ROLE_AUTH_OTHER); } */ // gzip_compression $this->_session->setParameter("_gzip_compression", $config_obj[_DEBUG_CONF_CATID]['gzip_compression']['conf_value']); // ---------------------------------------------- // ---Smarty関連設定 --- // ---------------------------------------------- $renderer =& SmartyTemplate::getInstance(); if (array_key_exists('smarty_caching', $config_obj[_GENERAL_CONF_CATID])) { if ($config_obj[_GENERAL_CONF_CATID]['smarty_caching']['conf_value'] == "true") { $smarty_caching = 2; } else { $smarty_caching = 0; } $renderer->setCaching($smarty_caching); } if (array_key_exists('smarty_force_compile', $config_obj[_GENERAL_CONF_CATID])) { if ($config_obj[_GENERAL_CONF_CATID]['smarty_force_compile']['conf_value'] == "true") { $smarty_force_compile = true; } else { $smarty_force_compile = false; } $renderer->setCompile($smarty_force_compile); } if (array_key_exists('smarty_lifetime', $config_obj[_GENERAL_CONF_CATID])) { $renderer->setCacheLifetime(intval($config_obj[_GENERAL_CONF_CATID]['smarty_lifetime']['conf_value'])); } // ---------------------------------------------- // ---メモリ最大サイズ設定 --- // ---------------------------------------------- ini_set('memory_limit', $config_obj[_SERVER_CONF_CATID]['memory_limit']['conf_value']); // ---------------------------------------------- // ---改行コードの判別有無の設定 --- // ---------------------------------------------- ini_set('auto_detect_line_endings', _ON); //UTF-8 // 直接指定:safariが文字化けするため $this->_response->setContentType("text/html; charset=utf-8"); // ---------------------------------------------- // ---サイトIDセット --- // ---------------------------------------------- $_site_id = $this->_session->getParameter("_site_id"); if (!isset($_site_id) || $_site_id == 0) { $sitesView =& $this->_container->getComponent("sitesView"); $site = $sitesView->getSelfSite(); if (isset($site['site_id'])) { $this->_session->setParameter("_site_id", $site['site_id']); } } // ---------------------------------------------- // ---サイトClose --- // ---------------------------------------------- $this->_session->setParameter("_closesite", _OFF); if ($config_obj[_GENERAL_CONF_CATID]['closesite']['conf_value'] == _ON) { $this->_session->setParameter("_closesite", _ON); $_lang = $this->_session->getParameter("_lang"); if ($user_id != "0" && $user_auth_id != _AUTH_ADMIN) { // 強制ログアウト $this->_session->close(); $user_id = "0"; } if ($user_id == "0") { $this->_session->setParameter("_lang", $_lang); $allow_action_name_arr = explode("|", _CLOSESITE_ALLOW_ACTION); if (!in_array($action_name, $allow_action_name_arr)) { // サイト閉鎖画面表示 $preexecute =& $this->_container->getComponent("preexecuteMain", array(), false, $this->_className); $preexecute->preExecute("pages_view_closesite"); exit; } } } }
/** * テーマ毎のモジュール別アイコン取得処理 * ./themes/".$theme_first_name."/images/icons/".$images_dir."/".$file_name * @param string $file_name * @return string $file_path * @access public */ function get_modules_image($file_name) { $renderer =& SmartyTemplate::getInstance(); $container =& DIContainerFactory::getContainer(); $actionChain =& $container->getComponent("ActionChain"); $action_name = $actionChain->getCurActionName(); $pathList = explode("_", $action_name); $_icon_color = $renderer->get_template_vars("_icon_color"); $file_path = "/images/" . $pathList[0] . "/"; if ($_icon_color != "" && file_exists(HTDOCS_DIR . "/images/" . $pathList[0] . "/" . $_icon_color . "/" . $file_name)) { $file_path .= $_icon_color . "/" . $file_name; } else { if (file_exists(HTDOCS_DIR . "/images/" . $pathList[0] . "/" . "default/" . $file_name)) { $file_path .= "default/" . $file_name; } else { $file_path .= $file_name; } } if (CORE_BASE_URL == BASE_URL && isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') { $file_path = BASE_URL_HTTPS . $file_path; } else { $file_path = CORE_BASE_URL . $file_path; } return $file_path; }