/** * module_object(authority_module_link_object)の一覧を取得する * @return array module_object(authority_module_link_object) * @access public */ function setAuthoritiesModules(&$result, $func_params) { $role_authority_id = intval($func_params[0]); $enroll_modules = $this->session->getParameter(array("authority", $this->request->getParameter("role_authority_id"), "enroll_modules")); $data = array("not_enroll_id" => array(), "not_enroll_name" => array(), "enroll_id" => array(), "enroll_name" => array()); while ($obj = $result->fetchRow()) { $pathList = explode("_", $obj["action_name"]); if (isset($enroll_modules)) { // セッションからセット if (in_array($obj["module_id"], $enroll_modules)) { $data["enroll_id"][] = $obj["module_id"]; $data["enroll_name"][] = $this->modulesView->loadModuleName($pathList[0]); } else { $data["not_enroll_id"][] = $obj["module_id"]; $data["not_enroll_name"][] = $this->modulesView->loadModuleName($pathList[0]); } } else { if (isset($obj["authority_id"]) || $role_authority_id == 0) { $data["enroll_id"][] = $obj["module_id"]; $data["enroll_name"][] = $this->modulesView->loadModuleName($pathList[0]); } else { $data["not_enroll_id"][] = $obj["module_id"]; $data["not_enroll_name"][] = $this->modulesView->loadModuleName($pathList[0]); } } } return $data; }
/** * ログイン画面用のHTMLをテンプレートにアサインする * * @return boolean true:アサインした、false:アサインしてない * @access public */ function setLoginHtml() { $userId = $this->_session->getParameter('_user_id'); if (!empty($userId)) { return false; } $this->_common->getTopId('0', '0', ''); $preexecute =& $this->_container->getComponent('preexecuteMain'); $params = array('action' => 'login_view_main_init', '_header' => _OFF, '_output' => _OFF); $loginHtml = $preexecute->preExecute('login_view_main_init', $params); $this->_renderer->assign('loginHtml', $loginHtml); return true; }
/** * モジュール毎のキャッシュクリア処理 * * @access public */ function clearCacheByDirname($dirname) { // ---------------------------------------------- // --- キャッシュクリア --- // ---------------------------------------------- if ($dirname == "pages" || $dirname == "control") { $temp_name = ""; } else { $modulesView =& $this->_container->getComponent("modulesView"); $module =& $modulesView->getModuleByDirname($dirname); $temp_name = isset($module['temp_name']) ? $module['temp_name'] . '/' : ""; } if ($this->_filterChain->hasFilterByName("Cache")) { $renderer = new SmartyTemplate(); //$renderer =& SmartyTemplate::getInstance(); //$session =& $this->_container->getComponent("Session"); //if (is_object($session)) { // $renderer->setSession($session); //} if (is_object($renderer)) { //DirName以下のコンパイルディレクトリの中身を全て破棄する $path = "/" . $dirname . "/templates/"; $base_temp_name = $path . $temp_name; $renderer->clear_compiled_tpl(null, $path); $this->_clearCompiledTpl($path, $base_temp_name, $renderer); $cache =& $this->_filterChain->getFilterByName("Cache"); $clear_cache = $cache->getClearCache(); //値を保存 $cache->setClearCache(array($dirname, DEFAULT_ACTION, "control_view_main")); //キャッシュクリア $renderer->clear_cache(); $cache->setClearCache($clear_cache); //元に戻す return true; } } return false; }
/** * テーマの一覧を取得する * @param string current_theme_name * @param string theme_kind block or page * @return array * @access public */ function getThemeList($current_theme_name, $theme_kind = 'block') { $container =& DIContainerFactory::getContainer(); $commonMain =& $container->getComponent("commonMain"); $fileView =& $commonMain->registerClass(WEBAPP_DIR . '/components/file/View.class.php', "File_View", "fileView"); // ブロックカテゴリ一覧取得 $categories_list = parse_ini_file(STYLE_DIR . "/config/" . _CATEGORY_INIFILE, true); $category_list = $categories_list[$theme_kind]; $lang = $this->_session->getParameter("_lang"); $theme_list = array(); //$theme_customlist = array(); if (file_exists(STYLE_DIR . "/language/" . $lang . "/" . _CATEGORY_INIFILE)) { //カテゴリ言語定義ファイルがあるならば、上書き $categories_list = parse_ini_file(STYLE_DIR . "/language/" . $lang . "/" . _CATEGORY_INIFILE, true); $lang_category_list = $categories_list[$theme_kind]; foreach ($lang_category_list as $key => $category_name) { if (isset($category_list[$key])) { $category_list[$key] = $category_name; $theme_list[$key] = array(); } } } $background_list = ""; if (file_exists(STYLE_DIR . "/language/" . $lang . "/" . _BACKGROUND_INIFILE)) { //背景言語定義ファイル $background_list = parse_ini_file(STYLE_DIR . "/language/" . $lang . "/" . _BACKGROUND_INIFILE, true); } $act_category = ""; $themes_arr = $fileView->getCurrentDir(STYLE_DIR . "/themes/"); foreach ($themes_arr as $theme_name) { //参加カテゴリiniファイル読み込み $themeconf_list = null; $themeStrList = explode("_", $theme_name); if (count($themeStrList) == 1) { $themeCssPath = "/themes/" . $theme_name . "/config"; if (file_exists(STYLE_DIR . $themeCssPath . "/" . _THEME_INIFILE)) { $themeconf_list = parse_ini_file(STYLE_DIR . $themeCssPath . "/" . _THEME_INIFILE, true); } } else { $bufthemeStr = array_shift($themeStrList); $themeCssPath = "/themes/" . $bufthemeStr . "/config/"; if (file_exists(STYLE_DIR . $themeCssPath . implode("/", $themeStrList) . "/" . _THEME_INIFILE)) { $themeconf_list = parse_ini_file(STYLE_DIR . $themeCssPath . implode("/", $themeStrList) . "/" . _THEME_INIFILE, true); } else { if (file_exists(STYLE_DIR . $themeCssPath . "/" . _THEME_INIFILE)) { $themeconf_list = parse_ini_file(STYLE_DIR . $themeCssPath . "/" . _THEME_INIFILE, true); } } } if (file_exists(STYLE_DIR . "/themes/" . $themeStrList[0] . "/language/" . $lang . "/" . _BACKGROUND_INIFILE)) { //背景言語定義ファイル $background_list = array_merge($background_list, parse_ini_file(STYLE_DIR . "/themes/" . $themeStrList[0] . "/language/" . $lang . "/" . _BACKGROUND_INIFILE, true)); } if ($themeconf_list != null) { //参加カテゴリ if (isset($themeconf_list['category'][$theme_kind])) { $category_name = $themeconf_list['category'][$theme_kind]; $theme_lang_path = STYLE_DIR . "/themes/" . $theme_name . "/language/" . $lang . "/" . _THEME_INIFILE; $theme_lang = ""; if (file_exists($theme_lang_path)) { $theme_lang_list = parse_ini_file($theme_lang_path, true); if (isset($theme_lang_list[$theme_kind])) { $theme_lang = $theme_lang_list[$theme_kind]; } } $theme_templates_path = STYLE_DIR . "/themes/" . $theme_name . "/templates/"; $child_themes_arr = $fileView->getCurrentDir($theme_templates_path); if (!isset($child_themes_arr[0])) { if (file_exists($theme_templates_path . "block.html")) { //templates直下のblock.html if (isset($theme_lang['default'])) { $theme_list[$category_name][$theme_name] = $theme_lang['default']; } else { $theme_list[$category_name][$theme_name] = $theme_name; } //if(file_exists(STYLE_DIR."/themes/".$theme_name."/config/".$theme_kind."_custom.ini")) { // $theme_customlist[$theme_name] = _ON; //} if (file_exists(STYLE_DIR . "/themes/" . $theme_name . "/images/" . ucfirst($theme_kind) . "Thumbnail.gif")) { $image_path[$theme_name] = get_image_url() . "/themes/" . $theme_name . "/images/" . ucfirst($theme_kind) . "Thumbnail.gif"; } else { if (file_exists(STYLE_DIR . "/themes/" . $theme_name . "/images/Thumbnail.gif")) { $image_path[$theme_name] = get_image_url() . "/themes/" . $theme_name . "/images/Thumbnail.gif"; } else { $image_path[$theme_name] = get_image_url() . "/themes/images/NoThumbnail.gif"; } } if (isset($current_theme_name)) { if ($current_theme_name == $theme_name) { $act_category = $category_name; } } } } else { if (in_array("default", $child_themes_arr)) { //defaultがあれば、先に表示 $theme_list[$category_name][$theme_name . "_default"] = null; } foreach ($child_themes_arr as $sub_name) { if (isset($theme_lang[$sub_name])) { $theme_list[$category_name][$theme_name . "_" . $sub_name] = $theme_lang[$sub_name]; } else { $theme_list[$category_name][$theme_name . "_" . $sub_name] = $theme_name . "_" . $sub_name; } //if(file_exists(STYLE_DIR."/themes/".$theme_name."/config/".$sub_name."/".$theme_kind."_custom.ini")) { // $theme_customlist[$theme_name."_".$sub_name] = _ON; //} if (file_exists(STYLE_DIR . "/themes/" . $theme_name . "/images/" . $sub_name . "/" . ucfirst($theme_kind) . "Thumbnail.gif")) { $image_path[$theme_name . "_" . $sub_name] = get_image_url() . "/themes/" . $theme_name . "/images/" . $sub_name . "/" . ucfirst($theme_kind) . "Thumbnail.gif"; } else { if (file_exists(STYLE_DIR . "/themes/" . $theme_name . "/images/" . $sub_name . "/Thumbnail.gif")) { $image_path[$theme_name . "_" . $sub_name] = get_image_url() . "/themes/" . $theme_name . "/images/" . $sub_name . "/Thumbnail.gif"; } else { if (file_exists(STYLE_DIR . "/themes/" . $theme_name . "/images/" . ucfirst($theme_kind) . "Thumbnail.gif")) { $image_path[$theme_name . "_" . $sub_name] = get_image_url() . "/themes/" . $theme_name . "/images/" . ucfirst($theme_kind) . "Thumbnail.gif"; } else { if (file_exists(STYLE_DIR . "/themes/" . $theme_name . "/images/Thumbnail.gif")) { $image_path[$theme_name . "_" . $sub_name] = get_image_url() . "/themes/" . $theme_name . "/images/Thumbnail.gif"; } else { $image_path[$theme_name . "_" . $sub_name] = get_image_url() . "/themes/images/NoThumbnail.gif"; } } } } if (isset($current_theme_name)) { if ($current_theme_name == $theme_name . "_" . $sub_name) { $act_category = $category_name; } } } } } } } return array($category_list, $background_list, $theme_list, $image_path, $act_category); }
/** * アップロードしたupload_idのコピー * WYSIWYG用 * @param array $upload_id_arr * @param int $room_id コピーするルームID * @param array $uploads_where_params アップロードテーブル追加条件指定 * room_id、module_idは必ずチェックし、そのWysiwyg上でuploadsされたものが正しい * かどうかをチェックする。 * その他、条件を追加したければ、このパラメータより追加(マージ) * * ※厳密にいえば、room_id、module_idだけのチェックでは、お知らせを同じルーム内に2つあり、 * 1つ目のお知らせからアップロードし、2つ目にそのパスをコピーした段階で * 2つ目のお知らせを移動してしまうと、1つ目のお知らせから画像が消えてしまうため * 問題となる。しかし、現状、そのuploadしたファイルが、そのWYSIWYG内で本当に * アップロードしたかどうかを知る術がないため、対応しない。 * * @return array $new_upload_id_arr * @access public */ function copyWysiwygUploads(&$upload_id_arr, $room_id, $uploads_where_params = array()) { $container =& DIContainerFactory::getContainer(); $request =& $container->getComponent("Request"); $session =& $container->getComponent("Session"); if (count($upload_id_arr) > 0) { // TODO:アップロードされているファイルの数が1000000件?以上に拡大した場合、 // SQL文の長さ制限(16M?)を越える可能性あり。 // 現状、対処しない。 $module_id = $request->getParameter("module_id"); if (!isset($module_id)) { $actionChain =& $container->getComponent("ActionChain"); $modulesView =& $container->getComponent("modulesView"); $curAction = $actionChain->getCurActionName(); $pathList = explode("_", $curAction); $module = $modulesView->getModuleByDirname($pathList[0]); if (isset($module['module_id'])) { $module_id = $module['module_id']; } } $where_params = array("upload_id IN ('" . implode("','", $upload_id_arr) . "') " => null, "room_id" => $request->getParameter("room_id"), "module_id" => $module_id); if (count($uploads_where_params) > 0) { $where_params = array_merge($where_params, $uploads_where_params); } $uploads = $this->_db->selectExecute("uploads", $where_params); if ($uploads === false) { return false; } if (!isset($uploads[0])) { return array(); } $uploadsAction =& $this->_container->getComponent("uploadsAction"); $fileAction =& $this->_container->getComponent("fileAction"); $buf_new_upload_id_arr = array(); foreach ($uploads as $upload) { $upload_id = $upload["upload_id"]; $upload['room_id'] = intval($room_id); $old_name = $upload['physical_file_name']; $upload['physical_file_name'] = ''; $upload['sess_id'] = ''; $upload['update_user_id'] = $session->getParameter("_user_id"); $upload['update_user_name'] = $session->getParameter("_handle"); $result = $uploadsAction->insUploads($upload); if ($result === false) { return false; } $new_name = $result . "." . $upload['extension']; if (file_exists(FILEUPLOADS_DIR . $upload['file_path'] . $old_name)) { $fileAction->copyFile(FILEUPLOADS_DIR . $upload['file_path'] . $old_name, FILEUPLOADS_DIR . $upload['file_path'] . $new_name); } $buf_new_upload_id_arr[$upload_id] = $result; } // 同じupload_idを考慮するため、$upload_id_arrに再セット $count = 0; $new_upload_id_arr = array(); $buf_upload_id_arr = array(); foreach ($upload_id_arr as $upload_id) { if (!isset($buf_upload_id_arr[$upload_id])) { $buf_upload_id_arr[$upload_id] = $buf_new_upload_id_arr[$upload_id]; } $new_upload_id_arr[$count] = $buf_upload_id_arr[$upload_id]; $count++; } } return $new_upload_id_arr; }
/** * 権限チェックを行う * @param action_name * @param page_id * @param block_id * @return boolean * @access public **/ function AuthCheck($action_name, $page_id, $block_id) { if ($action_name != "") { $pathList = explode("_", $action_name); } else { // エラー return false; } //TODO:他サイト間通信で使用予定。現在、未使用。 //$_redirect_url = $this->request->getParameter("_redirect_url"); //$_req_sig = $this->request->getParameter("_sig"); //$_req_ts = $this->request->getParameter("_ts"); //$_req_user_id = $this->request->getParameter("_user_id"); //$_req_auth_id = $this->request->getParameter("_auth_id"); //$_req_token = $this->request->getParameter("_token"); //システム系の画面かいなか $system_flag = $this->session->getParameter("_system_flag"); // //携帯チェック // $mobile_flag = $this->session->getParameter("_mobile_flag"); $isMobileAction = $pathList[0] == 'common' && $pathList[1] == 'mobile'; $isMobileAction = $isMobileAction || $pathList[2] == 'mobile'; if ($isMobileAction && empty($mobile_flag)) { return false; } $isSystemException = $pathList[0] == 'userinf'; if (!$isSystemException && $mobile_flag == _ON && $system_flag == _ON) { return false; } // // active_flagチェック // $user_id = $this->session->getParameter("_user_id"); if ($user_id !== "0") { $users =& $this->getdata->getParameter("users"); if (!isset($users[$user_id])) { $users[$user_id] = $this->usersView->getUserById($user_id); if ($users[$user_id] === false || !isset($users[$user_id]['user_id'])) { // 強制ログアウト $this->session->close(); return false; } $this->getdata->setParameter("users", $users); } if ($users[$user_id]['active_flag'] != _USER_ACTIVE_FLAG_ON) { // 強制ログアウト $this->session->close(); return false; } if ($users[$user_id]['system_flag'] == _ON) { $this->session->setParameter("_system_user_id", $user_id); } } $_system_user_id = $this->session->getParameter("_system_user_id"); if (!isset($_system_user_id)) { $where_params = array("{users}.active_flag" => _USER_ACTIVE_FLAG_ON, "{users}.system_flag" => _ON); $sys_users = $this->usersView->getUsers($where_params); if ($sys_users === false || !isset($sys_users[0]['user_id'])) { return false; } if (isset($sys_users[0]['user_id'])) { $this->session->setParameter("_system_user_id", $sys_users[0]['user_id']); } } if ($action_name == "control_view_main") { return true; } // リクエストパラメータにblock_idがなければ、 // ショートカットとして評価 $shortcut_flag = _ON; if ($block_id != 0) { $blocks = $this->getdata->getParameter("blocks"); if (isset($blocks[$block_id]['action_name'])) { $pathListBlockobj = explode("_", $blocks[$block_id]['action_name']); //アクションとブロックオブジェクトのアクションが異なる //但し、ダイアログ、ページ表示アクションの場合はチェックしない if ($pathList[0] != $pathListBlockobj[0] && $pathList[0] != "comp" && $pathList[0] != "dialog" && $pathList[0] != "pages") { //エラー return false; } // block_idがあれば、block_idからpage_idをセット(blocksテーブル優先) $page_id = $blocks[$block_id]['page_id']; $shortcut_flag = $blocks[$block_id]['shortcut_flag']; } } if ($block_id == 0 && $pathList[0] == "login") { //ログイン $auth_id = _AUTH_GUEST; $hierarchy = 0; } else { if ($system_flag == _ON) { $auth_id = $this->getPageAuthId($user_id); } else { $auth_id = $this->getPageAuthId($user_id, $page_id); } $hierarchy = $this->getPageHierarchy($user_id, $page_id); } $this->session->setParameter("_auth_id", $auth_id); $this->session->setParameter("_hierarchy", $hierarchy); $pages = $this->getdata->getParameter("pages"); $room_id = isset($pages[$page_id]['room_id']) ? $pages[$page_id]['room_id'] : 0; $space_type = isset($pages[$page_id]['space_type']) ? $pages[$page_id]['space_type'] : _SPACE_TYPE_GROUP; //TODO:現状、未仕様 //if($_redirect_url && $_req_sig && $_req_user_id && $_req_auth_id && $_req_ts && $_req_token) { // // 他サーバショートカット // //exit; //} // // 自サイト // if ($auth_id == _AUTH_OTHER) { return false; } //if($auth_id ==_AUTH_OTHER && $user_id === "0") { // 管理系ならば、コントロールパネルに遷移 // それ以外、pages_view_mainに遷移 /* if($system_flag) { $redirect_url = "?_sub_action=control_view_main"; $current_page_id = $this->request->getParameter("current_page_id"); if($current_page_id != null && $current_page_id != 0) { $redirect_url .= "@current_page_id=". $current_page_id; } } else { $redirect_url = "?_sub_action=" . DEFAULT_ACTION; $page_id = $this->request->getParameter("page_id"); if($page_id != null && $page_id != 0) { $redirect_url .= "@page_id=". $page_id; } } */ //ログイン画面表示 //print "<script type=\"text/javascript\"> // location.href = '".BASE_URL.INDEX_FILE_NAME."?action=login_view_main_init&error_mes="._ON."&_redirect_url=".$redirect_url."'; // </script>"; //ログインしていない //$url = htmlspecialchars(str_replace("?action=","?_sub_action=",str_replace("&","@",BASE_URL.INDEX_FILE_NAME.$this->request->getStrParameters(false))), ENT_QUOTES); //ログイン画面表示 //print "<script type=\"text/javascript\"> // location.href = '".BASE_URL.INDEX_FILE_NAME."?action=login_view_main_init&error_mes="._ON."&_redirect_url=".str_replace("?action=","?_sub_action=",str_replace("&","@",$url))."'; // </script>"; //エラー //return false; //} else if($auth_id ==_AUTH_OTHER) { // return false; //} // // room_idの値をActionに移す // //$buf_room_id = $this->request->getParameter("room_id"); //if(!isset($buf_room_id)) { $this->request->setParameter("room_id", $room_id); //} if ($system_flag == _OFF) { //------------------------------------------------------------------------ // XXXX_XXXX_Edit_XXXX_・・・のアクションは、権限が主担以上の場合だけ許す // block_idがパラメータにあり、ショートカットのブロックならばXXXX_XXXX_Edit_Init_・・・のアクションは許さない // 基本的にmaple.iniでValidateDefのauthcheck,moduleShortcutを行わない仕様とする //------------------------------------------------------------------------ if (is_array($pathList) && isset($pathList[2])) { if ($pathList[0] == "menu") { if ($user_id === "0" && $pathList[2] == "edit") { return false; } } else { if ($pathList[2] == "edit" && $auth_id < _AUTH_CHIEF) { return false; } //XXX_View(Action)_XXXX_Init_・・・ならばショートカットは許さない if ($pathList[2] == "edit" && isset($pathList[3]) && $pathList[3] == "init" && $shortcut_flag == _ON) { return false; } } } } // //レイアウトモード // $_layoutmode = $this->request->getParameter("_layoutmode"); //on or off $_layoutmode_onetime = $this->request->getParameter("_layoutmode_onetime"); if ($auth_id >= _AUTH_CHIEF) { if ($_layoutmode == "on" || $_layoutmode == "off") { $this->session->setParameter("_layoutmode", $_layoutmode); } //$buf_layoutmode = $this->session->getParameter("_layoutmode"); //if(($buf_layoutmode != "on" && $buf_layoutmode != "off")) { // $this->session->setParameter("_layoutmode","off"); //} if (isset($_layoutmode_onetime)) { if ($_layoutmode_onetime != "on" && $_layoutmode_onetime != "off") { $this->request->setParameter("_layoutmode_onetime", "off"); } } } else { $this->session->setParameter("_layoutmode", "off"); if (isset($_layoutmode_onetime)) { $this->request->setParameter("_layoutmode_onetime", "off"); } } // //ショートカットフラグ // $this->session->setParameter("_shortcut_flag", $shortcut_flag); // // センターカラムに拡大表示しているかどうか // $_show_main_flag = $this->request->getParameter("_show_main_flag"); if ($_show_main_flag == _ON) { $this->session->setParameter("_show_main_flag", _ON); } else { $this->session->setParameter("_show_main_flag", _OFF); } return true; }
/** * SQLファイル実行 * param string $file_name * param string $type * * @access public */ function executeSqlFile($file_name, $type = "default") { $res_arr = array(); $result = false; $_lang = $this->_session->getParameter("_lang"); $base_dir = $this->_session->getParameter("base_dir"); $sitename = addslashes($this->_session->getParameter("sitename")); $modulesView =& $this->_container->getComponent("modulesView"); //$modules[$dir_name], $self_site_id, $private_room_name, $admin_user_id $self_site_id = $this->_session->getParameter("install_self_site_id"); $admin_user_id = $this->_session->getParameter("install_user_id"); $admin_login_id = $this->_session->getParameter("install_login_id"); $admin_handle = addslashes($this->_session->getParameter("install_handle")); $permalink = preg_replace(_PERMALINK_PROHIBITION, _PERMALINK_PROHIBITION_REPLACE, $admin_handle); $this->getSessionDb($database, $dbhost, $dbusername, $dbpass, $dbname, $dbprefix, $dbpersist, $dsn); // // DB接続 // //include_once $base_dir.'/maple/nccore/db/DbObjectAdodb.class.php'; include_once BASE_DIR . '/maple/nccore/db/DbObjectAdodb.class.php'; $dbObject = new DbObjectAdodb(); $dbObject->setPrefix($dbprefix); $dbObject->setDsn($dsn); $conn_result = @$dbObject->connect(); if ($conn_result == false) { // DB接続失敗 $res_arr[] = INSTALL_IMG_NO . sprintf(INSTALL_DBCHECK_NOT_CONNECT, $dbname); return array($result, $res_arr); } // $modules[$dir_name] $modules = $dbObject->execute("SELECT {modules}.* FROM {modules}", array(), null, null, true, array($this, "_fetchcallbackModules"), array($modulesView)); if ($modules === false) { // とりあえずDB接続失敗のエラーメッセージとする $res_arr[] = INSTALL_IMG_NO . sprintf(INSTALL_DBCHECK_NOT_CONNECT, $dbname); return array($result, $res_arr); } $databaseSqlutility =& $this->_container->getComponent("databaseSqlutility"); $config_db_kind = $database; $lang_file_path = $base_dir . '/webapp/modules/install/language/' . $_lang . '/' . $file_name; if (!@file_exists($lang_file_path)) { $_lang = "english"; $lang_file_path = $base_dir . '/webapp/modules/install/language/' . $_lang . '/' . $file_name; } include_once $lang_file_path; if (defined(strtoupper("INSTALL_CONF_ADD_PRIVATE_SPACE_NAME_" . $_lang))) { $private_room_name = str_replace("{X-HANDLE}", $admin_handle, constant(strtoupper('INSTALL_CONF_ADD_PRIVATE_SPACE_NAME_' . $_lang))); $this->_session->setParameter("install_private_room_name", $private_room_name); } else { $private_room_name = $this->_session->getParameter("install_private_room_name"); } $file_path = $base_dir . '/webapp/modules/install/sql/' . $database . '/' . $type . "/" . $file_name; if (!@file_exists($file_path) && $database == "mysqli") { $database = "mysql"; $file_path = $base_dir . '/webapp/modules/install/sql/' . $database . '/' . $type . "/" . $file_name; } $data = ""; include_once $file_path; if ($file_name == INSTALL_CONFIG_DATA_FILENAME) { $config_lang_sql = ''; $languages = array('japanese', 'english', 'chinese'); $items = explode(',', _MULTI_LANG_CONFIG_ITEMS); foreach ($languages as $lang_dirname) { include_once $base_dir . '/webapp/modules/install/language/' . $lang_dirname . '/' . $file_name; foreach ($items as $item) { if ($item == 'sitename') { $conf_value = $sitename; } else { if ($item == 'from') { $conf_value = 'netcommons'; } else { $conf_value = constant(strtoupper('INSTALL_CONF_' . $item . '_' . $lang_dirname)); } } $config_lang_sql .= "INSERT INTO `config_language` (`conf_name`, `lang_dirname`, `conf_value`) VALUES ('" . $item . "', '" . $lang_dirname . "', '" . $conf_value . "');"; } } $data .= $config_lang_sql; } $databaseSqlutility->splitMySqlFile($pieces, $data); $result = true; $config_success_count = 0; $config_failed_count = 0; $adodb =& $dbObject->getAdoDbObject(); $savetable_name = ""; foreach ($pieces as $piece) { // SQLユーティリティクラスにてテーブル名にプレフィックスをつける // 配列としてリターンされ、 // [0] プレフィックスをつけたクエリ // [4] プレフィックスをつけないテーブル名 // が格納されている $prefixed_query = $databaseSqlutility->prefixQuery($piece, $dbObject->getPrefix()); //$prefixed_query_result = true; if (!$prefixed_query) { //$prefixed_query_result = false; $result = false; $res_arr[] = INSTALL_IMG_NO . sprintf(INSTALL_INSERT_DATA_FAILED_INSERT, 1, "Unknown Table"); continue; } if ($savetable_name != $prefixed_query[4]) { // テーブルが変わった if ($savetable_name != "") { // メッセージ if ($config_success_count > 0) { // 成功 $res_arr[] = INSTALL_IMG_YES . sprintf(INSTALL_INSERT_DATA_SUCCESS_INSERT, $config_success_count, $savetable_name); } if ($config_failed_count > 0) { $result = false; $res_arr[] = INSTALL_IMG_NO . sprintf(INSTALL_INSERT_DATA_FAILED_INSERT, $config_failed_count, $savetable_name); } $config_success_count = 0; $config_failed_count = 0; } $savetable_name = $prefixed_query[4]; } // 実行 //$dbObject->executeはprefixの変換処理があるため使用しない if (!$adodb->Execute($prefixed_query[0])) { $config_failed_count++; $result = false; //continue; } else { // 成功 $config_success_count++; } } if ($savetable_name != "") { // メッセージ if ($config_success_count > 0) { // 成功 $res_arr[] = INSTALL_IMG_YES . sprintf(INSTALL_INSERT_DATA_SUCCESS_INSERT, $config_success_count, $savetable_name); } if ($config_failed_count > 0) { $result = false; $res_arr[] = INSTALL_IMG_NO . sprintf(INSTALL_INSERT_DATA_FAILED_INSERT, $config_failed_count, $savetable_name); } //$config_success_count = 0; //$config_failed_count = 0; } return array($result, $res_arr); }