Changeset 19795 for branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Bloc.php
- Timestamp:
- 2010/12/30 18:50:01 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Bloc.php
r19768 r19795 80 80 $bloc_id = $_REQUEST['bloc_id']; 81 81 } else { 82 $bloc_id = 1;82 $bloc_id = null; 83 83 } 84 84 $this->bloc_id = $bloc_id; … … 93 93 94 94 $this->objLayout = new SC_Helper_PageLayout_Ex(); 95 $package_path = $this->objLayout->getTemplatePath($device_type_id) ;95 $package_path = $this->objLayout->getTemplatePath($device_type_id) . BLOC_DIR; 96 96 97 97 // ブロック一覧を取得 … … 103 103 array($bloc_id, $device_type_id)); 104 104 105 $ arrBlocData[0]['tpl_path'] = $this->objLayout->getTemplatePath($device_type_id) . $arrBlocData[0]['tpl_path'];105 $tplPath = $package_path . $arrBlocData[0]['filename'] . '.tpl'; 106 106 107 107 // テンプレートファイルの読み込み 108 $arrBlocData[0]['tpl_data'] = file_get_contents($ arrBlocData[0]['tpl_path']);108 $arrBlocData[0]['tpl_data'] = file_get_contents($tplPath); 109 109 $this->arrBlocData = $arrBlocData[0]; 110 110 } … … 124 124 // ディレクトリの作成 125 125 SC_Utils::sfMakeDir($prev_path); 126 $fp = fopen($prev_path,"w"); 127 fwrite($fp, $_POST['bloc_html']); // FIXME いきなり POST はちょっと... 128 fclose($fp); 126 $res = file_put_contents($new_bloc_path, $_POST['bloc_html']); 127 if ($res === false) { 128 SC_Utils_Ex::sfDispException(); 129 } 129 130 130 131 // プレビューデータ表示 … … 147 148 148 149 // 旧ファイルの削除 149 $old_bloc_path = $package_path . $arrBlocData[0]['tpl_path']; 150 if (file_exists($old_bloc_path)) { 151 unlink($old_bloc_path); 150 if (file_exists($tplPath)) { 151 unlink($tplPath); 152 152 } 153 153 154 154 // ファイル作成 155 $new_bloc_path = $package_path . BLOC_DIR .$_POST['filename'] . ".tpl";155 $new_bloc_path = $package_path . $_POST['filename'] . ".tpl"; 156 156 // ディレクトリの作成 157 157 SC_Utils::sfMakeDir($new_bloc_path); 158 $fp = fopen($new_bloc_path,"w"); 159 fwrite($fp, $_POST['bloc_html']); // FIXME いきなり POST はちょっと... 160 fclose($fp); 158 $res = file_put_contents($new_bloc_path, $_POST['bloc_html']); 159 if ($res === false) { 160 SC_Utils_Ex::sfDispException(); 161 } 161 162 162 163 $arrBlocData = $this->lfGetBlocData("filename = ? AND device_type_id = ?", … … 198 199 199 200 // ファイルの削除 200 $del_file = $package_path . BLOC_DIR . $arrBlocData[0]['filename']. '.tpl'; 201 if(file_exists($del_file)){ 202 unlink($del_file); 201 if (file_exists($tplPath)) { 202 unlink($tplPath); 203 203 } 204 204 } … … 254 254 // 更新データ生成 255 255 $arrUpdData = array("bloc_name" => $arrData['bloc_name'], 256 "tpl_path" => BLOC_DIR .$arrData['filename'] . '.tpl',256 "tpl_path" => $arrData['filename'] . '.tpl', 257 257 "filename" => $arrData['filename']); 258 258
Note: See TracChangeset
for help on using the changeset viewer.