aboutsummaryrefslogtreecommitdiff
path: root/h-source
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-06-22 14:51:14 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-06-22 14:51:14 +0000
commit34adb20d0ffe996bf454ade33ff02fef70968730 (patch)
tree2f095b0449a67150469b6baaaebbb67471126f63 /h-source
parentdcbc21e9680c54adc831b71cd1d22d3e680e03b0 (diff)
anonymous users can now insert devices, automatically set as hidden (to be approved)
Diffstat (limited to 'h-source')
-rw-r--r--h-source/Application/Controllers/GenericController.php18
-rw-r--r--h-source/Application/Models/HardwareModel.php15
-rwxr-xr-xh-source/Application/Models/UsersModel.php5
-rw-r--r--h-source/tables.sql2
4 files changed, 26 insertions, 14 deletions
diff --git a/h-source/Application/Controllers/GenericController.php b/h-source/Application/Controllers/GenericController.php
index eececc9..92831f7 100644
--- a/h-source/Application/Controllers/GenericController.php
+++ b/h-source/Application/Controllers/GenericController.php
@@ -73,11 +73,11 @@ class GenericController extends BaseController
$this->s['registered']->checkStatus();
- if ($this->s['registered']->status['status'] === 'logged')
- {
- if (!$this->s['registered']->checkCsrf($clean['token'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'wrong token..');
+// if ($this->s['registered']->status['status'] === 'logged')
+// {
+// 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['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
if (isset($_POST['insertAction']))
{
@@ -141,11 +141,11 @@ class GenericController extends BaseController
$this->clean();
$this->load('xml_response');
}
- }
- else
- {
- $this->redirect("users/login/".$this->lang."?redirect=".$this->controller."/catalogue/".$this->lang,0);
- }
+// }
+// else
+// {
+// $this->redirect("users/login/".$this->lang."?redirect=".$this->controller."/catalogue/".$this->lang,0);
+// }
}
public function del($lang = 'en', $token = '')
diff --git a/h-source/Application/Models/HardwareModel.php b/h-source/Application/Models/HardwareModel.php
index a3745cf..3badd71 100644
--- a/h-source/Application/Models/HardwareModel.php
+++ b/h-source/Application/Models/HardwareModel.php
@@ -82,13 +82,19 @@ class HardwareModel extends Model_Map {
$this->values['created_by'] = (int)$this->id_user;
$this->values['updated_by'] = (int)$this->id_user;
$this->values['update_date'] = date('Y-m-d H:i:s');
+
+ if ($this->values['created_by'] === 0)
+ {
+ $this->values['deleted'] = 'yes';
+ $this->values['approved'] = 'no';
+ }
//random ID
$randomId = md5(uniqid(mt_rand(),true));
$this->values["type"] = $randomId;
parent::insert();
-
+// echo $this->getQuery();
//associate the user to the record
if ($this->queryResult)
{
@@ -99,8 +105,11 @@ class HardwareModel extends Model_Map {
//update the history table
$this->updateHistory('insert');
-
- $this->associate($clean['id']);
+
+ if ($this->values['created_by'] !== 0)
+ {
+ $this->associate($clean['id']);
+ }
}
}
diff --git a/h-source/Application/Models/UsersModel.php b/h-source/Application/Models/UsersModel.php
index d4ef745..0d84bb4 100755
--- a/h-source/Application/Models/UsersModel.php
+++ b/h-source/Application/Models/UsersModel.php
@@ -88,7 +88,7 @@ class UsersModel extends Model_Map
}
else
{
- return "__";
+ return "<i>__anonymous__</i>";
}
}
}
@@ -97,7 +97,8 @@ class UsersModel extends Model_Map
{
if (strstr($user,'__'))
{
- return str_replace('__',null,$user);
+ return $user;
+// return str_replace('__',null,$user);
}
else
{
diff --git a/h-source/tables.sql b/h-source/tables.sql
index 08bdfa6..b6914c9 100644
--- a/h-source/tables.sql
+++ b/h-source/tables.sql
@@ -89,6 +89,7 @@ create table hardware (
comm_year char(15) not null,
ask_for_del char(4) not null default 'no',
deleted char(4) not null default 'no',
+ approved char(4) not null default 'yes',
pci_id char(10) not null,
driver varchar(50) not null,
interface char(15) not null default 'not-specified',
@@ -132,6 +133,7 @@ create table revisions (
fingerprint_works varchar(30) CHARACTER SET utf8 not null default 'not-specified',
architecture char(15) not null default 'not-specified',
other_names text CHARACTER SET utf8 not null,
+ approved char(4) not null default 'yes',
id_hard INT UNSIGNED NOT NULL
)engine=innodb;