/** * Page のプロセス. * * @return void */ function process() { // ログインチェック SC_Utils::sfIsSuccess(new SC_Session()); $mode = isset($_GET['mode']) ? $_GET['mode'] : ''; switch ($mode) { case 'detail': $objForm = $this->initParam(); if ($objForm->checkError()) { SC_Utils::sfDispError(''); } $this->arrLogDetail = $this->getLogDetail($objForm->getValue('log_id')); if (count($this->arrLogDetail) == 0) { SC_Utils::sfDispError(''); } $this->tpl_mainpage = 'ownersstore/log_detail.tpl'; break; default: break; } $this->arrInstallLogs = $this->getLogs(); // ページ出力 $objView = new SC_AdminView(); $objView->assignObj($this); $objView->display(MAIN_FRAME); }
/** * Page のプロセス. * * @return void */ function process() { // ログインチェック $objSession = new SC_Session(); SC_Utils::sfIsSuccess($objSession); $this->now_template = $this->lfGetNowTemplate(); // uniqidをテンプレートへ埋め込み $this->uniqid = $objSession->getUniqId(); switch ($this->lfGetMode()) { // ダウンロードボタン押下時の処理 case 'download': break; // アップロードボタン押下時の処理 // アップロードボタン押下時の処理 case 'upload': // 画面遷移の正当性チェック if (!SC_Utils::sfIsValidTransition($objSession)) { SC_Utils::sfDispError(''); } // フォームパラメータ初期化 $objForm = $this->lfInitUpload(); // エラーチェック if ($arrErr = $this->lfValidateUpload($objForm)) { $this->arrErr = $arrErr; $this->arrForm = $objForm->getFormParamList(); break; } // アップロードファイル初期化 $objUpFile = $this->lfInitUploadFile($objForm); // 一時ファイルへ保存 $errMsg = $objUpFile->makeTempFile('template_file', false); // 書き込みエラーチェック if (isset($errMsg)) { $this->arrErr['template_file'] = $errMsg; $this->arrForm = $objForm->getFormParamList(); break; } $this->lfAddTemplates($objForm, $objUpFile); $this->tpl_onload = "alert('テンプレートファイルをアップロードしました。');"; break; // 初回表示 // 初回表示 default: break; } // 画面の表示 $objView = new SC_AdminView(); $objView->assignobj($this); $objView->display(MAIN_FRAME); }
/** * Page のプロセス. * * @return void */ function process() { // 認証可否の判定 $objSession = new SC_Session(); SC_Utils::sfIsSuccess($objSession); // uniqidをテンプレートへ埋め込み $this->uniqid = $objSession->getUniqId(); $objView = new SC_AdminView(); switch ($this->lfGetMode()) { // 登録ボタン押下時 case 'register': // 画面遷移の正当性チェック if (!SC_Utils::sfIsValidTransition($objSession)) { sfDispError(''); } // パラメータ検証 $objForm = $this->lfInitRegister(); if ($objForm->checkError()) { SC_Utils_Ex::sfDispError(''); } $template_code = $objForm->getValue('template_code'); $this->tpl_select = $template_code; if ($template_code == "") { $template_code = "default"; } // DBへ使用するテンプレートを登録 $this->lfRegisterTemplate($template_code); // XXX コンパイルファイルのクリア処理を行う $objView->_smarty->clear_compiled_tpl(); // common.cssの内容を更新 $this->lfChangeCommonCss($template_code); // テンプレートのコピー $this->lfCopyTemplate($template_code); // ブロック位置を更新 $this->lfChangeBloc($template_code); // 完了メッセージ $this->tpl_onload = "alert('登録が完了しました。');"; break; // 削除ボタン押下時 // 削除ボタン押下時 case 'delete': // 画面遷移の正当性チェック if (!SC_Utils::sfIsValidTransition($objSession)) { SC_Utils::sfDispError(''); } // パラメータ検証 $objForm = $this->lfInitDelete(); if ($objForm->checkError()) { SC_Utils::sfDispError(''); } //現在使用中のテンプレートとデフォルトのテンプレートは削除できないようにする $template_code = $objForm->getValue('template_code_temp'); if ($template_code == TEMPLATE_NAME || $template_code == DEFAULT_TEMPLATE_NAME) { $this->tpl_onload = "alert('選択中のテンプレートは削除出来ません');"; break; } $this->lfDeleteTemplate($template_code); break; // downloadボタン押下時 // downloadボタン押下時 case 'download': // 画面遷移の正当性チェック if (!SC_Utils::sfIsValidTransition($objSession)) { SC_Utils::sfDispError(''); } // パラメータ検証 $objForm = $this->lfInitDownload(); $template_code = $objForm->getValue('template_code_temp'); // ユーザデータの下のファイルも保存する。 $from_dir = USER_TEMPLATE_PATH . $template_code . "/"; $to_dir = SMARTY_TEMPLATES_DIR . $template_code . "/_packages/"; SC_Utils::sfMakeDir($to_dir); SC_Utils::sfCopyDir($from_dir, $to_dir); SC_Helper_FileManager::downloadArchiveFiles(SMARTY_TEMPLATES_DIR . $template_code); break; // プレビューボタン押下時 // プレビューボタン押下時 case 'preview': break; default: break; } // defaultパラメータのセット $this->templates = $this->lfGetAllTemplates(); $this->now_template = TEMPLATE_NAME; // 画面の表示 $objView->assignobj($this); $objView->display(MAIN_FRAME); }
/** * editアクションの実行 * メンバーデータの更新を行う. * * @param void * @return void */ function execEditMode() { if ($this->isValidToken() !== true) { SC_Utils::sfDispError(''); } $this->initNewMode("edit"); $arrErr = $this->validateEditMode(); if (count($arrErr) > 0) { // 入力された値を保持する $this->tpl_mode = $_POST['mode']; $this->tpl_member_id = $_POST['member_id']; $this->tpl_old_login_id = $_POST['old_login_id']; $this->arrForm = $this->objForm->getHashArray(); // パスワードは保持しない $this->arrForm['password'] = ''; // エラー情報をセットする $this->arrErr = $arrErr; // トランザクショントークンの取得 $this->transactionid = $this->getToken(); return; } $this->updateMemberData($_POST['member_id'], $this->objForm->getHashArray()); // 親ウィンドウを更新後、自ウィンドウを閉じる。 $url = URL_SYSTEM_TOP . "?pageno=" . $_POST['pageno']; $this->tpl_onload = "fnUpdateParent('" . $url . "'); window.close();"; }
/** * テキストファイルの文字エンコーディングを変換する. * * $filepath に存在するテキストファイルの文字エンコーディングを変換する. * 変換前の文字エンコーディングは, mb_detect_order で設定した順序で自動検出する. * 変換後は, 変換前のファイル名に「enc_」というプレフィクスを付与し, * $out_dir で指定したディレクトリへ出力する * * TODO $filepath のファイルがバイナリだった場合の扱い * TODO fwrite などでのエラーハンドリング * * @access public * @param string $filepath 変換するテキストファイルのパス * @param string $enc_type 変換後のファイルエンコーディングの種類を表す文字列 * @param string $out_dir 変換後のファイルを出力するディレクトリを表す文字列 * @return string 変換後のテキストファイルのパス */ function sfEncodeFile($filepath, $enc_type, $out_dir) { $ifp = fopen($filepath, "r"); // 正常にファイルオープンした場合 if ($ifp !== false) { $basename = basename($filepath); $outpath = $out_dir . "enc_" . $basename; $ofp = fopen($outpath, "w+"); while (!feof($ifp)) { $line = fgets($ifp); $line = mb_convert_encoding($line, $enc_type, "auto"); fwrite($ofp, $line); } fclose($ofp); fclose($ifp); } else { SC_Utils::sfDispError(''); exit; } return $outpath; }