Commit 14e476b6 authored by Anthony.Suerte's avatar Anthony.Suerte

Advertisement Page Fix [Added Validation and File Deletion]

parent e63e05c0
...@@ -554,6 +554,9 @@ ...@@ -554,6 +554,9 @@
<E_ERROR_UPLOAD_ADMIN_FAILED> <E_ERROR_UPLOAD_ADMIN_FAILED>
アップロード失敗。 もう一度お試しください。 アップロード失敗。 もう一度お試しください。
</E_ERROR_UPLOAD_ADMIN_FAILED> </E_ERROR_UPLOAD_ADMIN_FAILED>
<E_ERROR_UPLOAD_ADMIN_INVALID>
無効なアップロードファイル
</E_ERROR_UPLOAD_ADMIN_INVALID>
<E_ERROR_NO_PAGE_ACCESS> <E_ERROR_NO_PAGE_ACCESS>
あなたは次のページにアクセスするための権限を持っていません。 あなたは次のページにアクセスするための権限を持っていません。
</E_ERROR_NO_PAGE_ACCESS> </E_ERROR_NO_PAGE_ACCESS>
......
...@@ -556,6 +556,9 @@ ...@@ -556,6 +556,9 @@
<E_ERROR_UPLOAD_ADMIN_FAILED> <E_ERROR_UPLOAD_ADMIN_FAILED>
Failed to upload file. Please Try Again Failed to upload file. Please Try Again
</E_ERROR_UPLOAD_ADMIN_FAILED> </E_ERROR_UPLOAD_ADMIN_FAILED>
<E_ERROR_UPLOAD_ADMIN_INVALID>
Uploaded file is invalid.
</E_ERROR_UPLOAD_ADMIN_INVALID>
<E_ERROR_NAME_REQUIRED> <E_ERROR_NAME_REQUIRED>
Name is a mandatory field. Name is a mandatory field.
</E_ERROR_NAME_REQUIRED> </E_ERROR_NAME_REQUIRED>
......
...@@ -22,34 +22,34 @@ class LogicAdvertisements extends AdvertisementModelClass { ...@@ -22,34 +22,34 @@ class LogicAdvertisements extends AdvertisementModelClass {
* @return : TRUE:ロジック成功、FALSE:ロジック失敗 * @return : TRUE:ロジック成功、FALSE:ロジック失敗
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
function logic() { function logic() {
try { try {
// 初期データ処理 $this -> init();
if($this -> init()){
$this -> lists();
}elseif($this -> getType() == TYPE_IMAGE_MANAGER_UPLOAD_COMPLETE){ switch($this -> getType()){
if($this -> checkChiket()) { case TYPE_IMAGE_MANAGER_UPLOAD_COMPLETE:
$this -> popUpSessionMessage(INFO, 'I_COMPLATE_SAVE', array()); $this -> insertNewAd();
}
$this -> insertActivity();
$this -> loadImageAds();
$this -> listsImages(); $this -> listsImages();
}elseif($this -> getType() == TYPE_IMAGE_MANAGER || $this -> getType() == TYPE_SEARCH){ break;
case TYPE_IMAGE_MANAGER:
case TYPE_SEARCH:
$this -> listsImages(); $this -> listsImages();
}elseif($this -> getType() == TYPE_IMAGE_MANAGER_DETAIL){ break;
case TYPE_IMAGE_MANAGER_DETAIL:
$this -> selectAdDetails(); $this -> selectAdDetails();
}elseif($this -> getType() == TYPE_UPDATE){ break;
case TYPE_UPDATE:
$this -> insertActivity(); $this -> insertActivity();
$this -> update(); $this -> update();
}elseif($this -> getType() == TYPE_DELETE){ break;
case TYPE_DELETE:
$this -> insertActivity(); $this -> insertActivity();
$this -> deleteAd(); $this -> deleteAd();
$this -> listsImages(); $this -> listsImages();
}else{ break;
default:
$this -> lists(); $this -> lists();
break;
} }
} catch (Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
...@@ -61,15 +61,19 @@ class LogicAdvertisements extends AdvertisementModelClass { ...@@ -61,15 +61,19 @@ class LogicAdvertisements extends AdvertisementModelClass {
* @return : なし * @return : なし
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
function lists() { function lists() {
//set variables
//$where = null;
$where = $this -> getWhere(); $where = $this -> getWhere();
//$this -> getWhere();
$this -> setResult($this -> accessSelect('LIST_CLICKED_ADS', $where)); $this -> setResult($this -> accessSelect('LIST_CLICKED_ADS', $where));
} }
function insertNewAd(){
if($this -> loadImageAds()){
$this -> insertActivity();
$this -> accessModify('INSERT_ADS', $this -> getImageAdRegistData());
$this -> popUpSessionMessage(INFO, 'I_COMPLATE_SAVE', array());
}else{
$this -> popUpSessionMessage(ERROR, 'E_ERROR_UPLOAD_ADMIN_INVALID', array());
}
}
function listsImages() { function listsImages() {
$this -> setImages($this -> accessSelect('LIST_IMAGES', $this -> getWhereAds())); $this -> setImages($this -> accessSelect('LIST_IMAGES', $this -> getWhereAds()));
...@@ -89,7 +93,15 @@ class LogicAdvertisements extends AdvertisementModelClass { ...@@ -89,7 +93,15 @@ class LogicAdvertisements extends AdvertisementModelClass {
} }
function deleteAd(){ function deleteAd(){
$this -> accessModify('DELETE_AD_FILE', $this -> getDeleteData(), false); $deleteData = $this -> getDeleteData();
$adDetails = $this -> getRowData($this -> accessSelect('SELECT_AD_DETAILS', $deleteData));
$toDelete = SYSTEM_DOCUMENT_ADS."/{$adDetails["file_name"]}";
if(@file_exists($toDelete))
unlink($toDelete);
$this -> accessModify('DELETE_AD_FILE', $deleteData, false);
} }
function insertActivity(){ function insertActivity(){
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment