aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Controllers/GenericController.php
diff options
context:
space:
mode:
Diffstat (limited to 'h-source/Application/Controllers/GenericController.php')
-rw-r--r--h-source/Application/Controllers/GenericController.php42
1 files changed, 24 insertions, 18 deletions
diff --git a/h-source/Application/Controllers/GenericController.php b/h-source/Application/Controllers/GenericController.php
index 9cbaeee..da2f87a 100644
--- a/h-source/Application/Controllers/GenericController.php
+++ b/h-source/Application/Controllers/GenericController.php
@@ -470,8 +470,10 @@ class GenericController extends BaseController
$data['ne_name'] = null;
$data['name'] = null;
$data['tree'] = null;
- $data['isDeleted'] = 'no';
+ $data['isDeleted'] = false;
+ $data['md_javascript'] = "moderator_dialog(\"devicehide\",\"device\");moderator_dialog(\"deviceshow\",\"device\");";
+
if ($this->mod->checkType($clean['id_hard']))
{
$this->mod->setWhereQueryClause(array("id_hard" => $clean['id_hard']));
@@ -486,9 +488,9 @@ class GenericController extends BaseController
$data['name'] = encodeUrl($data['ne_name']);
$data['title'] = $data['ne_name'].' - '.Website::$generalName;
$data['tree'] = $this->getSpecHardLink() . " &raquo; <span class='last_tree_element'>".$data['ne_name']."</span>";
- $data['isDeleted'] = $data['table'][0]['hardware']['deleted'];
+ $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id_hard']);
- if (strcmp($data['isDeleted'],'yes') === 0)
+ if ($data['isDeleted'])
{
$deletion = new DeletionModel();
$data['deletion'] = $deletion->select()->where(array('id_hard'=>$clean['id_hard']))->send();
@@ -527,6 +529,8 @@ class GenericController extends BaseController
$data['tree'] = $this->getSpecHardLink() . " &raquo; " . $this->getViewLink($clean['id'],$data['ne_name'])." &raquo; <span class='last_tree_element'>history</span>";
$data['title'] = 'history - '.Website::$generalName;
+
+ $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id']);
//get the first revision
$res = $this->m['RevisionsModel']->db->select('revisions','id_rev','id_hard='.$clean['id'],null,'id_rev',1);
@@ -572,7 +576,7 @@ class GenericController extends BaseController
$data['name'] = null;
$data['ne_name'] = null;
$data['tree'] = null;
- $data['isDeleted'] = 'no';
+ $data['isDeleted'] = false;
$data['title'] = 'revision - '.Website::$generalName;
if (count($data['table']) > 0)
@@ -584,6 +588,8 @@ class GenericController extends BaseController
$data['updated_by'] = $data['table'][0]['revisions']['updated_by'];
$data['update_date'] = $data['table'][0]['revisions']['update_date'];
+
+ $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($data['id_hard']);
}
$this->append($data);
@@ -603,7 +609,8 @@ class GenericController extends BaseController
$ne_name = $this->m['HardwareModel']->getTheModelName((int)$data['id_hard']);
$data['name'] = encodeUrl($ne_name);
$data['tree'] = $this->getSpecHardLink() . " &raquo; " . $this->getViewLink($data['id_hard'],$ne_name)." &raquo; " . $this->getHistoryLink($clean['id_hard']) . " &raquo; <span class='last_tree_element'>differences</span>";
-
+
+ $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id_hard']);
$data['showDiff'] = false;
$diffArray = array();
@@ -677,7 +684,7 @@ class GenericController extends BaseController
{
$deleted = $this->m['HardwareModel']->select("hardware.deleted")->where(array("id_hard"=>$clean['id_hard']))->limit(1)->toList('deleted')->send();
- $data['isDeleted'] = $deleted[0];
+ $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id_hard']);
$data['id_rev'] = $clean['id_rev'];
$data['id_hard'] = $clean['id_hard'];
@@ -693,21 +700,16 @@ class GenericController extends BaseController
if (!$this->s['registered']->checkCsrf($clean['token'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'wrong token..');
if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
+
+ if ($this->m['HardwareModel']->isDeleted($clean['id_hard'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'this device page has been deleted..');
if (isset($_POST['confirmAction']))
{
- if (strcmp($deleted[0],'no') === 0)
- {
- $this->m['HardwareModel']->makeCurrent($clean['id_rev']);
-
- $this->viewRedirect($this->m['HardwareModel']->lastId);
-
- $data['notice'] = $this->m['HardwareModel']->notice;
- }
- else
- {
- $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'deleted..');
- }
+ $this->m['HardwareModel']->makeCurrent($clean['id_rev']);
+
+ $this->viewRedirect($this->m['HardwareModel']->lastId);
+
+ $data['notice'] = $this->m['HardwareModel']->notice;
}
$this->append($data);
@@ -734,6 +736,8 @@ class GenericController extends BaseController
$data['ne_name'] = $this->m['HardwareModel']->getTheModelName($clean['id_hard']);
$data['name'] = encodeUrl($data['ne_name']);
$data['tree'] = $this->getSpecHardLink() . " &raquo; " . $this->getViewLink($clean['id_hard'],$data['ne_name'])." &raquo; <span class='last_tree_element'>talk</span>";
+
+ $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id_hard']);
if (isset($_POST['insertAction']))
{
@@ -742,6 +746,8 @@ class GenericController extends BaseController
if (!$this->s['registered']->checkCsrf($clean['token'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'wrong token..');
if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
+
+ if ($this->m['HardwareModel']->isDeleted($clean['id_hard'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'this device page has been deleted..');
$this->m['TalkModel']->values['created_by'] = $this->s['registered']->status['id_user'];
$this->m['TalkModel']->values['id_hard'] = $clean['id_hard'];