aboutsummaryrefslogtreecommitdiff
path: root/h-source
diff options
context:
space:
mode:
Diffstat (limited to 'h-source')
-rw-r--r--h-source/Application/Controllers/HistoryController.php25
-rw-r--r--h-source/Application/Controllers/LastController.php91
-rw-r--r--h-source/Application/Controllers/ModeratorsController.php68
-rw-r--r--h-source/Application/Controllers/MyController.php2
-rw-r--r--h-source/Application/Include/languages.php10
-rw-r--r--h-source/Application/Include/myFunctions.php33
-rw-r--r--h-source/Application/Views/Last/modactions.php (renamed from h-source/Application/Views/Moderators/index.php)8
-rw-r--r--h-source/Application/Views/Meet/meet.php2
-rw-r--r--h-source/Application/Views/My/panel.php14
-rw-r--r--h-source/Config/Route.php3
-rw-r--r--h-source/Public/Css/main.css14
11 files changed, 153 insertions, 117 deletions
diff --git a/h-source/Application/Controllers/HistoryController.php b/h-source/Application/Controllers/HistoryController.php
index ac1ab1a..e44ce79 100644
--- a/h-source/Application/Controllers/HistoryController.php
+++ b/h-source/Application/Controllers/HistoryController.php
@@ -23,6 +23,29 @@ if (!defined('EG')) die('Direct access not allowed!');
class HistoryController extends BaseController
{
+ public static $typeTable = array(
+ 'message' => 'message',
+ 'talk' => 'talk',
+ 'user' => 'user',
+ 'issue' => 'issue',
+ 'wiki_talk' => 'wiki talk',
+ 'page' => 'wiki page',
+ 'page_del' => 'wiki page',
+ );
+
+ public static $actionTable = array(
+ 'hide' => 'hide',
+ 'show' => 'show',
+ 'block' => 'block',
+ 'unblock' => 'unblock',
+ 'open' => 'open',
+ 'close' => 'close',
+ 'pageblock' => 'block',
+ 'pageunblock' => 'unblock',
+ 'pagehide' => 'hide',
+ 'pageshow' => 'show',
+ );
+
protected $strings = array(
'hide' => array(
@@ -157,7 +180,7 @@ class HistoryController extends BaseController
'id_name' => 'id_user',
'field_name' => 'blocked',
'actions' => array('block','unblock'),
- 'group' => 'moderator',
+ 'group' => 'admin',
),
diff --git a/h-source/Application/Controllers/LastController.php b/h-source/Application/Controllers/LastController.php
index 6fe66a2..2050ea7 100644
--- a/h-source/Application/Controllers/LastController.php
+++ b/h-source/Application/Controllers/LastController.php
@@ -34,32 +34,89 @@ class LastController extends BaseController
$this->setArgKeys(array('page:forceNat'=>1));
}
-
- public function modifications($lang = 'en')
+
+ protected function last($lang = 'en',$action = 'modifications')
{
- $this->shift(1);
-
- $whereClauseArray = array(
- 'gr' => 'registered',
- 'type' => 'hardware',
- );
-
- $this->helper('Pages','last/modifications/'.$this->lang,'page');
-
+ switch ($action)
+ {
+ case 'modifications':
+ $data['title'] = 'last modifications - '.Website::$generalName;
+
+ $whereClauseArray = array(
+ 'gr' => 'registered',
+ 'type' => 'hardware',
+ );
+
+ $viewFile = 'modifications';
+
+ break;
+ case 'modactions':
+ $data['title'] = 'last moderations - '.Website::$generalName;
+ $data['viewTitle'] = 'List of actions carried out by moderators';
+ $data['user_status'] = 'MODERATOR';
+
+ $whereClauseArray = array(
+ 'gr' => 'moderator',
+ );
+
+ $viewFile = 'modactions';
+
+ break;
+ case 'adminactions':
+ $data['title'] = 'last admin actions - '.Website::$generalName;
+ $data['viewTitle'] = 'List of actions carried out by administrators';
+ $data['user_status'] = 'ADMINISTRATOR';
+
+ $whereClauseArray = array(
+ 'gr' => 'admin',
+ );
+
+ $viewFile = 'modactions';
+
+ break;
+ }
+
+ $this->helper('Pages','last/'.$this->action.'/'.$this->lang,'page');
+
$this->m['HistoryModel']->clear()->select()->where($whereClauseArray)->orderBy('id_history desc');
-
+
$recordNumber = $this->m['HistoryModel']->rowNumber();
$page = $this->viewArgs['page'];
-
+
$this->m['HistoryModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,30);
-
+
$data['table'] = $this->m['HistoryModel']->send();
-
+
$data['pageList'] = $this->h['Pages']->render($page-5,11);
-
+
$this->append($data);
- $this->load('modifications');
+ $this->load($viewFile);
$this->right();
}
+ public function modifications($lang = 'en')
+ {
+ $this->shift(1);
+
+ $this->last($lang = 'en','modifications');
+ }
+
+ public function modactions($lang = 'en')
+ {
+ $this->shift(1);
+
+ $this->s['registered']->check('moderator');
+
+ $this->last($lang = 'en','modactions');
+ }
+
+ public function adminactions($lang = 'en')
+ {
+ $this->shift(1);
+
+ $this->s['registered']->check('admin');
+
+ $this->last($lang = 'en','adminactions');
+ }
+
} \ No newline at end of file
diff --git a/h-source/Application/Controllers/ModeratorsController.php b/h-source/Application/Controllers/ModeratorsController.php
deleted file mode 100644
index 2f4123f..0000000
--- a/h-source/Application/Controllers/ModeratorsController.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-// h-source, a web software to build a community of people that want to share their hardware information.
-// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
-//
-// This file is part of h-source
-//
-// h-source is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// h-source is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class ModeratorsController extends BaseController
-{
-
- public function __construct($model, $controller, $queryString)
- {
- parent::__construct($model, $controller, $queryString);
-
- $this->model('HistoryModel');
-
- $this->modelName = 'HistoryModel';
-
- $data['title'] = 'moderators page - '.Website::$generalName;
- $this->append($data);
-
- $this->setArgKeys(array('page:forceNat'=>1));
- }
-
- public function actions($lang = 'en')
- {
- $this->shift(1);
-
- $this->s['registered']->check('moderator');
-
- $whereClauseArray = array(
- 'gr' => 'moderator',
- );
-
- $this->helper('Pages','moderators/actions/'.$this->lang,'page');
-
- $this->m['HistoryModel']->clear()->select()->where($whereClauseArray)->orderBy('id_history desc');
-
- $recordNumber = $this->m['HistoryModel']->rowNumber();
- $page = $this->viewArgs['page'];
-
- $this->m['HistoryModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,30);
-
- $data['table'] = $this->m['HistoryModel']->send();
-
- $data['pageList'] = $this->h['Pages']->render($page-4,8);
-
- $this->append($data);
- $this->load('index');
- $this->right();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Controllers/MyController.php b/h-source/Application/Controllers/MyController.php
index d1e346c..69b8da7 100644
--- a/h-source/Application/Controllers/MyController.php
+++ b/h-source/Application/Controllers/MyController.php
@@ -50,7 +50,7 @@ class MyController extends BaseController
$clean['id_user'] = (int)$this->s['registered']->status['id_user'];
$data['username'] = $this->m['UsersModel']->getUser($clean['id_user']);
- $data['isBlocked'] = $this->m['UsersModel']->isBlocked($clean['id_user']);
+ $data['userBlocked'] = $this->m['UsersModel']->isBlocked($clean['id_user']);
$this->append($data);
$this->load('panel');
diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php
index d8e6502..ee4fdcc 100644
--- a/h-source/Application/Include/languages.php
+++ b/h-source/Application/Include/languages.php
@@ -127,8 +127,7 @@ class Lang
"confirm the password" => "conferma la password",
"write the code above" => "scrivi il codice mostrato sopra",
"write your username" => "scrivi il tuo username",
- "watch all the" => "guarda tutte le",
- "actions carried out by moderators" => "azioni compiute dai moderatori",
+ "Watch all the actions carried out by moderators" => "Guarda tutte le azioni compiute dai moderatori",
"meet" => "conosci",
"Public profile of" => "Profilo pubblico di",
"See all the contributions of" => "Guarda tutti i contributi di ",
@@ -212,6 +211,7 @@ class Lang
"delete the wiki page" => "cancella la pagina",
"list of blocked pages" => "lista delle pagine bloccate",
"special pages" => "pagine speciali",
+ "Watch all the actions carried out by administrators" => "Guarda tutte le azioni compiute dagli amministratori"
),
'es' => array
(
@@ -307,8 +307,7 @@ class Lang
"confirm the password" => "confirme la contraseña",
"write the code above" => "escriba el código mostrado superior",
"write your username" => "escriba su nombre de usuario",
- "watch all the" => "ver todas las",
- "actions carried out by moderators" => "acciones efectuadas por los moderadores",
+ "Watch all the actions carried out by moderators" => "Ver todas las acciones efectuadas por los moderadores",
"meet" => "conoce",
"Public profile of" => "Perfil público de",
"See all the contributions of" => "Ver todas las contribuciones de",
@@ -489,8 +488,7 @@ class Lang
"confirm the password" => "confirmez le mot de passe",
"write the code above" => "écrivez le code si-dessous",
"write your username" => "écrivez votre nom d'utilisateur",
- "watch all the" => "regardez toutes les",
- "actions carried out by moderators" => "actions prises par les modérateurs",
+ "Watch all the actions carried out by moderators" => "Regardez toutes les actions prises par les modérateurs",
"meet" => "rencontrer",
"Public profile of" => "Profil public de",
"See all the contributions of" => "Voir toute les distributions de",
diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php
index 9e05ed2..ddbc16f 100644
--- a/h-source/Application/Include/myFunctions.php
+++ b/h-source/Application/Include/myFunctions.php
@@ -484,7 +484,7 @@ function getHardwareInfoFromTalkId($id = 0)
$clean['id'] = (int)$id;
$talk = new TalkModel();
$res = $talk->select('hardware.type,hardware.id_hard')->from('hardware inner join talk')->using('id_hard')->where(array('id_talk'=>$clean['id']))->send();
- return $res[0]['hardware'];
+ return count($res) > 0 ? $res[0]['hardware'] : null;
}
//get the wiki page info from the talk id
@@ -493,7 +493,7 @@ function getWikiPageInfoFromTalkId($id = 0)
$clean['id'] = (int)$id;
$talk = new WikitalkModel();
$res = $talk->select('wiki.id_wiki')->from('wiki inner join wiki_talk')->using('id_wiki')->where(array('id_talk'=>$clean['id']))->send();
- return $res[0]['wiki']['id_wiki'];
+ return count($res) > 0 ? $res[0]['wiki']['id_wiki'] : '';
}
//get the issue info from the message id
@@ -502,7 +502,16 @@ function getIssueNumberFromMessageId($id = 0)
$clean['id'] = (int)$id;
$mess = new MessagesModel();
$res = $mess->select('issues.id_issue')->from('issues inner join messages')->using('id_issue')->where(array('id_mes'=>$clean['id']))->toList('issues.id_issue')->send();
- return $res[0];
+ return count($res) > 0 ? $res[0] : '';
+}
+
+//get thw wiki name from the id
+function getWikiNameFromId($id = 0)
+{
+ $clean['id'] = (int)$id;
+ $wiki = new WikiModel();
+ $name = $wiki->getTheModelName($clean['id']);
+ return $name;
}
//return the URL to the moderated object page
@@ -517,8 +526,15 @@ function goToModeratedItem( $row = array() )
break;
case 'talk':
$hardInfo = getHardwareInfoFromTalkId($row['id']);
- $controller = Hardware::$typeToController[$hardInfo['type']];
- $url = $controller.'/talk/'.Lang::$current.'/'.$hardInfo['id_hard'].'#talk-'.$row['id'];
+ if (isset($hardInfo))
+ {
+ $controller = Hardware::$typeToController[$hardInfo['type']];
+ $url = $controller.'/talk/'.Lang::$current.'/'.$hardInfo['id_hard'].'#talk-'.$row['id'];
+ }
+ else
+ {
+ $url = 'last/modactions/'.Lang::$current;
+ }
break;
case 'user':
$url = 'meet/user/'.Lang::$current.'/'.getUserName($row['id']);
@@ -529,7 +545,12 @@ function goToModeratedItem( $row = array() )
case 'wiki_talk':
$url = 'wiki/talk/'.Lang::$current.'/'.getWikiPageInfoFromTalkId($row['id']).'#wiki-talk-'.$row['id'];
break;
-
+ case 'page':
+ $url = 'wiki/page/'.Lang::$current.'/'.encodeUrl(getWikiNameFromId($row['id']));
+ break;
+ case 'page_del':
+ $url = 'wiki/page/'.Lang::$current.'/'.encodeUrl(getWikiNameFromId($row['id']));
+ break;
}
return 'http://'.DOMAIN_NAME.'/'.$url;
}
diff --git a/h-source/Application/Views/Moderators/index.php b/h-source/Application/Views/Last/modactions.php
index dabbf56..fe50223 100644
--- a/h-source/Application/Views/Moderators/index.php
+++ b/h-source/Application/Views/Last/modactions.php
@@ -27,13 +27,13 @@
</div>
<div class="contrib_explain_box">
- List of actions carried out by moderators
+ <?php echo $viewTitle; ?>
</div>
<table class="listTable">
<tr class="listHead">
<td class="simpleText">ACTION ID</td>
- <td class="simpleText">MODERATOR</td>
+ <td class="simpleText"><?php echo $user_status;?></td>
<td class="simpleText">ACTION</td>
<td class="simpleText">TYPE</td>
<td class="simpleText">OBJECT ID</td>
@@ -49,10 +49,10 @@
<span class='textItem'><?php echo $u->getUser($row['history']['created_by']);?></span>
</td>
<td class="simpleText">
- <span class='textItem'><?php echo $row['history']['action'];?></span>
+ <span class='textItem'><?php echo HistoryController::$actionTable[$row['history']['action']];?></span>
</td>
<td class="simpleText">
- <span class='textItem'><?php echo $row['history']['type'];?></span>
+ <span class='textItem'><?php echo HistoryController::$typeTable[$row['history']['type']];?></span>
</td>
<td class="simpleText">
<span class='textItem'><?php echo $row['history']['id'];?></span>
diff --git a/h-source/Application/Views/Meet/meet.php b/h-source/Application/Views/Meet/meet.php
index e52ef2a..f0e31b3 100644
--- a/h-source/Application/Views/Meet/meet.php
+++ b/h-source/Application/Views/Meet/meet.php
@@ -26,7 +26,7 @@
<a href="<?php echo $this->baseUrl."/home/index/$lang";?>">Home</a> &raquo; <?php echo gtext("meet");?> <b><?php echo $meet_username;?></b>
</div>
- <?php if ($ismoderator) { ?>
+ <?php if ($isadmin) { ?>
<div class="moderator_box">
<?php if ($isBlocked) { ?>
This user has been blocked
diff --git a/h-source/Application/Views/My/panel.php b/h-source/Application/Views/My/panel.php
index 30e4d24..babf409 100644
--- a/h-source/Application/Views/My/panel.php
+++ b/h-source/Application/Views/My/panel.php
@@ -26,19 +26,19 @@
<a href="<?php echo $this->baseUrl."/home/index/$lang";?>">Home</a> &raquo; <?php echo gtext("control panel");?>
</div>
- <?php if ($isBlocked) { ?>
+ <?php if ($userBlocked) { ?>
<div class="moderator_box">
Your account has been blocked by a moderator of the website. You can neither insert/modify devices nor submit new issues or messages until some other moderator un-block your account.
</div>
<?php } ?>
- <?php if ($ismoderator) { ?>
- <div class="moderator_panel_link">
- <?php echo gtext("watch all the");?> <a href="<?php echo Url::getRoot('moderators/actions/'.$lang);?>"><?php echo gtext("actions carried out by moderators");?></a>
- </div>
- <?php } ?>
-
<ul class='panelApplicationList'>
+ <?php if ($isadmin) { ?>
+ <li><a href="<?php echo Url::getRoot('last/adminactions/'.$lang);?>"><?php echo gtext("Watch all the actions carried out by administrators");?></a></li>
+ <?php } ?>
+ <?php if ($ismoderator) { ?>
+ <li><a href="<?php echo Url::getRoot('last/modactions/'.$lang);?>"><?php echo gtext("Watch all the actions carried out by moderators");?></a></li>
+ <?php } ?>
<li><a href="<?php echo Url::getRoot('meet/user/'.$lang.'/'.$username);?>"><?php echo gtext("Watch your public profile");?></a></li>
<li><a href="<?php echo Url::getRoot('my/profile/'.$lang.'/'.$token);?>"><?php echo gtext("Edit your profile");?></a></li>
<li><a href="<?php echo Url::getRoot('my/email/'.$lang.'/'.$token);?>"><?php echo gtext("Change your e-mail address");?></a></li>
diff --git a/h-source/Config/Route.php b/h-source/Config/Route.php
index c5c4493..6f25cfa 100644
--- a/h-source/Config/Route.php
+++ b/h-source/Config/Route.php
@@ -120,7 +120,6 @@ class Route
'threegcards,differences',
'threegcards,climb',
'threegcards,talk',
- 'moderators,actions',
'soundcards,catalogue',
'soundcards,view',
'soundcards,history',
@@ -140,6 +139,8 @@ class Route
'webcams,climb',
'webcams,talk',
'last,modifications',
+ 'last,modactions',
+ 'last,adminactions',
'wiki,insert',
'wiki,update',
'wiki,page',
diff --git a/h-source/Public/Css/main.css b/h-source/Public/Css/main.css
index 77de30d..f37daf9 100644
--- a/h-source/Public/Css/main.css
+++ b/h-source/Public/Css/main.css
@@ -850,7 +850,7 @@ ins
.panelApplicationList li
{
display:block;
- width:250px;
+ width:450px;
height:30px;
margin:5px;
padding-top:9px;
@@ -1538,14 +1538,18 @@ td.text_item_date
{
width:25%;
}
-.moderator_panel_link
+.moderator_panel_link, .admin_panel_link
{
margin:5px;
padding:10px;
- border:1px solid #ED9F4A;
- background:#F6EA99;
+/* border:1px solid #ED9F4A; */
+/* background:#F6EA99; */
+}
+.admin_panel_link
+{
+/* border:1px solid #DA70D6; */
+/* background:#F6EA99; */
}
-
.noscript_notice
{
margin:10px 5px;