diff options
Diffstat (limited to 'h-source/Application')
-rw-r--r-- | h-source/Application/Controllers/BaseController.php | 8 | ||||
-rw-r--r-- | h-source/Application/Controllers/UsersController.php | 11 | ||||
-rw-r--r-- | h-source/Application/Include/myFunctions.php | 3 | ||||
-rw-r--r-- | h-source/Application/Views/info.php | 30 |
4 files changed, 52 insertions, 0 deletions
diff --git a/h-source/Application/Controllers/BaseController.php b/h-source/Application/Controllers/BaseController.php index 5340954..697b79b 100644 --- a/h-source/Application/Controllers/BaseController.php +++ b/h-source/Application/Controllers/BaseController.php @@ -24,6 +24,7 @@ class BaseController extends Controller { protected $lang; + protected $islogged = 'no'; protected $ismoderator = false; protected $isadmin = false; protected $querySanitized = true; @@ -57,6 +58,7 @@ class BaseController extends Controller $this->s['registered']->checkStatus(); $data['username'] = null; + $data['user_groups'] = null; $data['islogged'] = 'no'; $data['token'] = 'token'; $data['ismoderator'] = false; @@ -65,7 +67,13 @@ class BaseController extends Controller if ($this->s['registered']->status['status'] === 'logged') { $data['username'] = $this->s['registered']->status['user']; + $groups = $this->s['registered']->status['groups']; + $groups[] = 'registered'; + $data['user_groups'] = implode(',',$groups); + $data['islogged'] = 'yes'; + $this->islogged = $data['islogged']; + $data['token'] = $this->s['registered']->status['token']; $this->token = $data['token']; diff --git a/h-source/Application/Controllers/UsersController.php b/h-source/Application/Controllers/UsersController.php index c46da88..b55a461 100644 --- a/h-source/Application/Controllers/UsersController.php +++ b/h-source/Application/Controllers/UsersController.php @@ -117,6 +117,17 @@ class UsersController extends BaseController $this->append($data); $this->load('logout'); } + + public function info($lang = 'en') + { + $this->s['registered']->checkStatus(); + + $data['user_status'] = strcmp($this->islogged,'yes') === 0 ? 'logged' : 'not-logged'; + + $this->append($data); + $this->clean(); + $this->load('info'); + } public function add($lang = 'en') { diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php index 4d01851..70c0b4f 100644 --- a/h-source/Application/Include/myFunctions.php +++ b/h-source/Application/Include/myFunctions.php @@ -173,6 +173,9 @@ function htmlDiff($old, $new) $old = str_replace("\r\n"," \r\n ",$old); $new = str_replace("\r\n"," \r\n ",$new); + $old = str_replace("\n"," \n ",$old); + $new = str_replace("\n"," \n ",$new); + $ret = null; $diff = diff(removeEmptyStrings(explode(' ', $old)),removeEmptyStrings(explode(' ', $new))); foreach($diff as $k) diff --git a/h-source/Application/Views/info.php b/h-source/Application/Views/info.php new file mode 100644 index 0000000..00d2927 --- /dev/null +++ b/h-source/Application/Views/info.php @@ -0,0 +1,30 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> +<?php echo "<?xml version='1.0' encoding='UTF-8'?>\n";?> +<user_info> + <status><?php echo $user_status;?></status> + <info> + <username><?php echo $username;?></username> + <token><?php echo $token;?></token> + <groups><?php echo $user_groups;?></groups> + </info> +</user_info> + +<?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/>. +?>
\ No newline at end of file |