aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-02-15 00:32:19 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-02-15 00:32:19 +0000
commit1854075a62c6ca0422040b4e5ebf89088b0d02b2 (patch)
tree4c725cb4ef2b6eab95c0db23cfedcfb3c1406be4
parent99e87e1869e49c67bea2b779283def0e98f39bca (diff)
added wiki - part 1
-rw-r--r--h-source/Application/Controllers/BaseController.php8
-rw-r--r--h-source/Application/Controllers/GenericController.php21
-rw-r--r--h-source/Application/Controllers/UsersController.php32
-rw-r--r--h-source/Application/Controllers/WikiController.php475
-rw-r--r--h-source/Application/Include/languages.php18
-rw-r--r--h-source/Application/Include/myFunctions.php48
-rw-r--r--h-source/Application/Models/GenericModel.php (renamed from h-source/Application/Models/BaseModel.php)14
-rw-r--r--h-source/Application/Models/HardwareModel.php2
-rw-r--r--h-source/Application/Models/NotebooksModel.php2
-rw-r--r--h-source/Application/Models/PrintersModel.php2
-rw-r--r--h-source/Application/Models/ScannersModel.php2
-rw-r--r--h-source/Application/Models/SoundcardsModel.php2
-rw-r--r--h-source/Application/Models/ThreegcardsModel.php2
-rw-r--r--h-source/Application/Models/VideocardsModel.php2
-rw-r--r--h-source/Application/Models/WebcamsModel.php2
-rw-r--r--h-source/Application/Models/WifiModel.php2
-rw-r--r--h-source/Application/Models/WikiModel.php228
-rw-r--r--h-source/Application/Models/WikirevisionsModel.php45
-rw-r--r--h-source/Application/Models/WikitalkModel.php50
-rw-r--r--h-source/Application/Views/Issues/view.php2
-rw-r--r--h-source/Application/Views/Issues/viewall.php2
-rw-r--r--h-source/Application/Views/Wiki/climb.php50
-rw-r--r--h-source/Application/Views/Wiki/differences.php61
-rw-r--r--h-source/Application/Views/Wiki/form.php96
-rw-r--r--h-source/Application/Views/Wiki/history.php70
-rw-r--r--h-source/Application/Views/Wiki/not_found.php34
-rw-r--r--h-source/Application/Views/Wiki/page.php102
-rw-r--r--h-source/Application/Views/Wiki/talk.php122
-rw-r--r--h-source/Application/Views/right.php6
-rw-r--r--h-source/Application/Views/talk.php4
-rw-r--r--h-source/Config/Route.php8
-rw-r--r--h-source/Public/Css/main.css18
-rw-r--r--h-source/tables.sql44
33 files changed, 1520 insertions, 56 deletions
diff --git a/h-source/Application/Controllers/BaseController.php b/h-source/Application/Controllers/BaseController.php
index 7d03735..0f7c532 100644
--- a/h-source/Application/Controllers/BaseController.php
+++ b/h-source/Application/Controllers/BaseController.php
@@ -27,7 +27,7 @@ class BaseController extends Controller
protected $ismoderator = false;
protected $querySanitized = true;
protected $token = 'token';
-
+
protected $_topMenuClasses = array(
"home" => null,
"hardware" => null,
@@ -82,9 +82,11 @@ class BaseController extends Controller
$data['tm'] = $this->_topMenuClasses;
-// print_r($this->_queryString);
$this->_queryString = $this->sanitizeQueryString($this->_queryString);
-
+
+ $data['querySanitized'] = $this->querySanitized;
+ $data['queryString'] = Url::createUrl($this->_queryString);
+
$this->append($data);
}
diff --git a/h-source/Application/Controllers/GenericController.php b/h-source/Application/Controllers/GenericController.php
index 49685f3..884f915 100644
--- a/h-source/Application/Controllers/GenericController.php
+++ b/h-source/Application/Controllers/GenericController.php
@@ -117,7 +117,7 @@ class GenericController extends BaseController
}
else
{
- $this->redirect('users/login/'.$this->lang.'/'.$this->controller.'/catalogue',0);
+ $this->redirect("users/login/".$this->lang."?redirect=".$this->controller."/catalogue/".$this->lang,0);
}
}
@@ -252,7 +252,7 @@ class GenericController extends BaseController
}
else
{
- $this->redirect('users/login/'.$this->lang.'/'.$this->controller.'/view/'.$clean['id_hard'],0);
+ $this->redirect("users/login/".$this->lang."?redirect=".$this->controller."/view/".$this->lang."/".$clean['id_hard'],0);
}
}
else
@@ -468,6 +468,7 @@ class GenericController extends BaseController
$data['ne_name'] = null;
$data['tree'] = null;
$data['isDeleted'] = 'no';
+ $data['title'] = 'revision - '.Website::$generalName;
if (count($data['table']) > 0)
{
@@ -476,8 +477,6 @@ class GenericController extends BaseController
$data['name'] = encodeUrl($data['ne_name']);
$data['tree'] = $this->getSpecHardLink() . " &raquo; " . $this->getViewLink($data['id_hard'],$data['ne_name'])." &raquo; " . $this->getHistoryLink($data['id_hard']) . " &raquo; <span class='last_tree_element'>revision</span>";
- $data['title'] = 'revision - '.Website::$generalName;
-
$data['updated_by'] = $data['table'][0]['revisions']['updated_by'];
$data['update_date'] = $data['table'][0]['revisions']['update_date'];
}
@@ -611,7 +610,7 @@ class GenericController extends BaseController
}
else
{
- $this->redirect('users/login/'.$this->lang.'/'.$this->controller.'/view/'.$clean['id_hard'],0);
+ $this->redirect("users/login/".$this->lang."?redirect=".$this->controller."/view/".$this->lang."/".$clean['id_hard'],0);
}
}
}
@@ -675,4 +674,16 @@ class GenericController extends BaseController
return "<a href='".$this->baseUrl.'/'.$this->controller.'/catalogue/'.$this->lang.$this->viewStatus."'>".$this->controller."</a>";
}
+ protected function goToLoginForm()
+ {
+ if ($this->querySanitized)
+ {
+ $this->redirect("users/login/".$this->lang."?redirect=".$this->controller."/".$this->action.Url::createUrl($this->_queryString));
+ }
+ else
+ {
+ $this->redirect("users/login/".$this->lang."?redirect=home/index".Url::createUrl($this->_queryString));
+ }
+ }
+
} \ No newline at end of file
diff --git a/h-source/Application/Controllers/UsersController.php b/h-source/Application/Controllers/UsersController.php
index 1249647..7f42a2a 100644
--- a/h-source/Application/Controllers/UsersController.php
+++ b/h-source/Application/Controllers/UsersController.php
@@ -42,28 +42,20 @@ class UsersController extends BaseController
$this->append($data);
}
- public function login($lang = 'en', $type = null,$the_action = null,$the_id = null)
+ public function login($lang = 'en')
{
$data = array();
if ( strcmp($this->_updating,'no') === 0 )
{
$data['flag'] = isset($type) ? 'setted' : null;
- $html['type'] = in_array($type,Hardware::$controllers) ? sanitizeAll($type) : 'notebooks';
- $html['the_action'] = sanitizeAlphanum($the_action);
- $html['the_id'] = (int)$the_id;
$html['lang'] = Lang::sanitize($lang);
$data['title'] = 'Login - '.Website::$generalName;
+
+ $redirect = $this->request->get('redirect','','sanitizeAll');
- if (isset($type))
- {
- $data['action'] = Url::getRoot("users/login/".$html['lang']."/".$html['type']."/".$html['the_action']."/".$html['the_id']);
- }
- else
- {
- $data['action'] = Url::getRoot("users/login/".$html['lang']);
- }
+ $data['action'] = Url::getRoot("users/login/".$this->lang."?redirect=$redirect");
$data['notice'] = null;
@@ -82,11 +74,9 @@ class UsersController extends BaseController
$this->redirect('home/index/'.Lang::$current,3,'You are already logged...');
break;
case 'accepted':
- if (isset($type))
+ if (strcmp($redirect,'') !== 0)
{
- $address = strcmp($html['the_action'],'view') === 0 ? $html['type']."/view/".$html['lang']."/".$html['the_id'] : $html['type']."/catalogue/".$html['lang'];
-
- $this->redirect($address,0);
+ $this->redirect($redirect,0);
}
else
{
@@ -117,7 +107,15 @@ class UsersController extends BaseController
}
else if ($res === 'was-logged')
{
- $this->redirect('home/index/'.Lang::$current,0);
+ $redirect = $this->request->get('redirect','','sanitizeAll');
+ if (strcmp($redirect,'') !== 0)
+ {
+ $this->redirect($redirect,0);
+ }
+ else
+ {
+ $this->redirect('home/index/'.Lang::$current,0);
+ }
}
else if ($res === 'error')
{
diff --git a/h-source/Application/Controllers/WikiController.php b/h-source/Application/Controllers/WikiController.php
new file mode 100644
index 0000000..33647ef
--- /dev/null
+++ b/h-source/Application/Controllers/WikiController.php
@@ -0,0 +1,475 @@
+<?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 WikiController extends BaseController
+{
+
+ public function __construct($model, $controller, $queryString) {
+ parent::__construct($model, $controller, $queryString);
+
+ $this->model('UsersModel');
+ $this->model('WikiModel');
+ $this->model('WikirevisionsModel');
+ $this->model('WikitalkModel');
+
+ $this->m['WikiModel']->id_user = (int)$this->s['registered']->status['id_user'];
+ }
+
+ public function insert($lang = 'en')
+ {
+ $this->shift(1);
+
+ $data['title'] = 'insert a wiki page - '.Website::$generalName;
+
+ $this->m['WikiModel']->setFields('title,page','sanitizeAll');
+
+ $data['notice'] = null;
+
+ $this->s['registered']->checkStatus();
+
+ if ($this->s['registered']->status['status'] === 'logged')
+ {
+ 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']))
+ {
+ //insert the new wiki page
+ $this->m['WikiModel']->updateTable('insert');
+
+ $this->viewRedirect($this->m['WikiModel']->lastTitleClean);
+ }
+
+ $data['notice'] = $this->m['WikiModel']->notice;
+
+ $data['submitName'] = "insertAction";
+ $data['hiddenInput'] = null;
+
+ $data['values'] = $this->m['WikiModel']->getFormValues('insert','sanitizeHtml');
+ $this->append($data);
+
+ $this->load('form');
+ $this->load('bottom_left');
+ $this->right();
+ }
+ else
+ {
+ $this->redirect("users/login/".$this->lang."?redirect=".$this->controller."/insert/".$this->lang,0);
+ }
+ }
+
+ public function update($lang = 'en')
+ {
+ $this->shift(1);
+
+ $data['title'] = 'update a wiki page - '.Website::$generalName;
+
+ $this->m['WikiModel']->setFields('title,page','sanitizeAll');
+
+ $data['notice'] = null;
+ $this->s['registered']->checkStatus();
+
+ if (isset($_POST['id_wiki']))
+ {
+ //get the id
+ $clean['id_wiki'] = (int)$_POST['id_wiki'];
+ $title = $this->m['WikiModel']->getTheModelName($clean['id_wiki']);
+
+ if ($this->s['registered']->status['status'] === 'logged')
+ {
+
+ if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
+
+ $deleted = $this->m['WikiModel']->select("wiki.deleted")->where(array("id_wiki"=>$clean['id_wiki']))->limit(1)->toList('wiki.deleted')->send();
+
+ if (strcmp($deleted[0],'no') === 0)
+ {
+ $data['tree_name'] = $title;
+
+ if (isset($_POST['updateAction']))
+ {
+ //carry out the update database action
+ $this->m['WikiModel']->updateTable('update');
+
+ $this->viewRedirect($this->m['WikiModel']->lastTitleClean);
+ }
+
+ $data['notice'] = $this->m['WikiModel']->notice;
+
+ $data['id_wiki'] = $clean['id_wiki'];
+ $data['submitName'] = "updateAction";
+
+ $data['values'] = $this->m['WikiModel']->getFormValues('update','sanitizeHtml');
+ $data['hiddenInput'] = "<input type='hidden' name='id_wiki' value='".$clean['id_wiki']."'>\n";
+
+ $this->append($data);
+
+ $this->load('form');
+ $this->load('bottom_left');
+ $this->right();
+ }
+ else
+ {
+ $this->redirect($this->controller.'/page/'.$this->lang,2,'deleted..');
+ }
+ }
+ else
+ {
+ $this->redirect("users/login/".$this->lang."?redirect=".$this->controller."/page/".$this->lang."/".encodeUrl($title),0);
+ }
+ }
+ else
+ {
+ $this->redirect($this->controller.'/page/'.$this->lang);
+ }
+ }
+
+ protected function viewRedirect($titleClean)
+ {
+ if ($this->m['WikiModel']->queryResult)
+ {
+ $this->redirect($this->controller.'/page/'.$this->lang.'/'.$titleClean);
+ }
+ }
+
+ public function page($lang = 'en', $title_clean = null)
+ {
+ $this->shift(2);
+
+ $data['title'] = 'main page - '.Website::$generalName;
+ $clean['title_clean'] = sanitizeAll($title_clean);
+
+ $data['isDeleted'] = 'no';
+
+ $res = $this->m['WikiModel']->select()->where(array('title_clean'=>$clean['title_clean']))->send();
+
+ if ( count($res) > 0 )
+ {
+ $data['table'] = $res;
+ $data['tree_name'] = $res[0]['wiki']['title'];
+ $data['title'] = $res[0]['wiki']['title'] . ' - ' . Website::$generalName;
+ $data['isDeleted'] = $res[0]['wiki']['deleted'];
+
+ if ( count($res) < 2 )
+ {
+ $data['talk_number'] = $this->m['WikitalkModel']->select('count(*) as numb,id_wiki')->where(array('id_wiki'=>$res[0]['wiki']['id_wiki'],'deleted'=>'no'))->rowNumber();
+
+ $viewFile = 'page';
+ $data['id_wiki'] = $res[0]['wiki']['id_wiki'];
+ }
+ else
+ {
+ $viewFile = 'select';
+ }
+ }
+ else
+ {
+ $viewFile = 'not_found';
+ }
+
+ $this->append($data);
+
+ $this->load($viewFile);
+ $this->load('bottom_left');
+ $this->right();
+ }
+
+ public function history($lang = 'en', $id = 0)
+ {
+ $argKeys = array(
+ 'page:forceNat' => 1,
+ );
+
+ $this->setArgKeys($argKeys);
+ $this->shift(2);
+
+ $clean['id'] = (int)$id;
+ $data['id'] = $clean['id'];
+ $data['tree_name'] = $this->m['WikiModel']->getTheModelName($clean['id']);
+
+ $data['title'] = 'history - '.Website::$generalName;
+
+ //get the first revision
+ $res = $this->m['WikirevisionsModel']->db->select('revisions','id_rev','id_wiki='.$clean['id'],null,'id_rev',1);
+ if (count($res) > 0)
+ {
+ $data['firstRev'] = $res[0]['wiki_revisions']['id_rev'];
+ }
+
+ $res1 = $this->m['WikiModel']->db->select('wiki','update_date,created_by','id_wiki='.$clean['id']);
+
+ $this->m['WikirevisionsModel']->setWhereQueryClause(array('id_wiki' => $clean['id']));
+
+ //load the Pages helper
+ $this->helper('Pages',$this->controller.'/history/'.$this->lang.'/'.$clean['id'],'page');
+ //get the number of records
+ $recordNumber = $this->m['WikirevisionsModel']->rowNumber();
+ $page = $this->viewArgs['page'];
+ //set the limit clause
+ $this->m['WikirevisionsModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,20);
+ $res2 = $this->m['WikirevisionsModel']->getFields('update_date,created_by,id_rev');
+
+ $data['pageList'] = $this->h['Pages']->render($page-3,7);
+
+ $data['rev1'] = $res1;
+ $data['rev2'] = $res2;
+
+ $this->append($data);
+ $this->load('history');
+ $this->load('bottom_left');
+ $this->right();
+ }
+
+ public function revision($lang = 'en', $id_rev = 0)
+ {
+ $argKeys = array(
+ 'page:forceNat' => 1,
+ );
+
+ $this->setArgKeys($argKeys);
+ $this->shift(2);
+
+ $clean['id_rev'] = (int)$id_rev;
+
+ $this->m['WikirevisionsModel']->setWhereQueryClause(array("id_rev" => $clean['id_rev']));
+ $data['table'] = $this->m['WikirevisionsModel']->getAll();
+
+ $data['id_wiki'] = 0;
+ $data['created_by'] = null;
+ $data['update_date'] = null;
+ $data['tree_name'] = null;
+ $data['tree'] = null;
+ $data['tree'] = null;
+ $data['title'] = 'revision - '.Website::$generalName;
+ $data['isDeleted'] = 'no';
+
+ if (count($data['table']) > 0)
+ {
+ $data['id_wiki'] = (int)$data['table'][0]['wiki_revisions']['id_wiki'];
+ $data['tree_name'] = $this->m['WikiModel']->getTheModelName($data['id_wiki']);
+ $data['tree'] = $this->getSpecPageLink() . " &raquo; " . $this->getViewLink($data['tree_name'])." &raquo; " . $this->getHistoryLink($data['id_wiki']) . " &raquo; ".gtext('Revision');
+
+ $data['created_by'] = $data['table'][0]['wiki_revisions']['created_by'];
+ $data['update_date'] = $data['table'][0]['wiki_revisions']['update_date'];
+ }
+
+ $this->append($data);
+ $this->load('page');
+ $this->load('bottom_left');
+ $this->right();
+ }
+
+ public function differences($lang = 'en', $id_wiki = 0, $id_rev = 0)
+ {
+ $this->shift(3);
+
+ $data['title'] = 'differences - '.Website::$generalName;
+
+ $clean['id_wiki'] = (int)$id_wiki;
+ $clean['id_rev'] = (int)$id_rev;
+
+ $data['id_wiki'] = $clean['id_wiki'];
+ $tree_name = $this->m['WikiModel']->getTheModelName((int)$data['id_wiki']);
+ $data['tree_name'] = $tree_name;
+ $data['tree'] = $this->getSpecPageLink() . " &raquo; " . $this->getViewLink($data['tree_name'])." &raquo; " . $this->getHistoryLink($data['id_wiki']) . " &raquo; ".gtext('Differences');
+
+ $data['showDiff'] = false;
+
+ $diffArray = array();
+
+ if (strcmp($clean['id_wiki'],0) !== 0 and strcmp($clean['id_rev'],0) !== 0)
+ {
+ $this->m['WikirevisionsModel']->where(array('id_wiki' => $clean['id_wiki'],'id_rev' => '<='.$clean['id_rev']));
+ $this->m['WikirevisionsModel']->limit = 2;
+ $res = $this->m['WikirevisionsModel']->getAll();
+ if (count($res) > 1)
+ {
+ $newArray = $res[0]['wiki_revisions'];
+ $oldArray = $res[1]['wiki_revisions'];
+
+ $data['update_new'] = $newArray['update_date'];
+ $data['update_old'] = $oldArray['update_date'];
+ $data['created_by'] = $newArray['created_by'];
+
+ $diffArray = $this->m['WikiModel']->getDiffArray($oldArray, $newArray);
+
+ $data['showDiff'] = true;
+ }
+ }
+ else if (strcmp($clean['id_wiki'],0) !== 0 and strcmp($clean['id_rev'],0) === 0)
+ {
+ $this->m['WikiModel']->where(array('id_wiki' => $clean['id_wiki']));
+ $lastRes = $this->m['WikiModel']->getAll();
+
+ if (count($lastRes) > 0)
+ {
+ $this->m['WikirevisionsModel']->setWhereQueryClause(array('id_wiki' => $clean['id_wiki']));
+ $this->m['WikirevisionsModel']->limit = 1;
+ $revRes = $this->m['WikirevisionsModel']->getAll();
+
+ if (count($revRes) > 0)
+ {
+ $newArray = $lastRes[0]['wiki'];
+ $oldArray = $revRes[0]['wiki_revisions'];
+
+ $data['update_new'] = $newArray['update_date'];
+ $data['update_old'] = $oldArray['update_date'];
+ $data['created_by'] = $newArray['created_by'];
+
+ $diffArray = $this->m['WikiModel']->getDiffArray($oldArray, $newArray);
+
+ $data['showDiff'] = true;
+ }
+ }
+
+ }
+
+ $data['fieldsWithBreaks'] = $this->m['WikiModel']->fieldsWithBreaks;
+ $data['diffArray'] = $diffArray;
+
+ $this->append($data);
+ $this->load('differences');
+ $this->load('bottom_left');
+ $this->right();
+ }
+
+ public function climb($lang = 'en', $id_rev = 0)
+ {
+ $this->shift(2);
+
+ $this->m['WikiModel']->setFields('title,page','sanitizeAll');
+
+ $data['title'] = 'make current - '.Website::$generalName;
+
+ $clean['id_rev'] = (int)$id_rev;
+ $clean['id_wiki'] = (int)$this->m['WikirevisionsModel']->getIdPage($clean['id_rev']);
+
+ if ($clean['id_wiki'] !== 0)
+ {
+ $deleted = $this->m['WikiModel']->select("wiki.deleted")->where(array("id_wiki"=>$clean['id_wiki']))->limit(1)->toList('wiki.deleted')->send();
+
+ $data['isDeleted'] = $deleted[0];
+
+ $data['id_rev'] = $clean['id_rev'];
+ $data['id_wiki'] = $clean['id_wiki'];
+ $data['tree_name'] = $this->m['WikiModel']->getTheModelName($clean['id_wiki']);
+ $data['name'] = $data['tree_name'];
+ $data['tree'] = $this->getSpecPageLink() . " &raquo; " . $this->getViewLink($data['tree_name'])." &raquo; " . $this->getHistoryLink($clean['id_wiki']) . " &raquo; " . gtext('Make current');
+
+ $data['notice'] = null;
+ $this->s['registered']->checkStatus();
+
+ if ($this->s['registered']->status['status'] === 'logged')
+ {
+
+ 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['confirmAction']))
+ {
+ if (strcmp($deleted[0],'no') === 0)
+ {
+ $this->m['WikiModel']->makeCurrent($clean['id_rev']);
+
+ $this->viewRedirect($this->m['WikiModel']->lastTitleClean);
+
+ $data['notice'] = $this->m['WikiModel']->notice;
+ }
+ else
+ {
+ $this->redirect($this->controller.'/page/'.$this->lang,2,'deleted..');
+ }
+ }
+
+ $this->append($data);
+ $this->load('climb');
+ $this->load('bottom_left');
+ $this->right();
+ }
+ else
+ {
+ $this->redirect("users/login/".$this->lang."?redirect=".$this->controller."/page/".$this->lang."/".encodeUrl($data['tree_name']),0);
+ }
+ }
+ }
+
+ public function talk($lang = 'en', $id_wiki = 0)
+ {
+ $this->shift(2);
+
+ $this->m['WikitalkModel']->setFields('title,message','sanitizeAll');
+
+ $data['title'] = 'talk - '.Website::$generalName;
+
+ $clean['id_wiki'] = (int)$id_wiki;
+ $data['id_wiki'] = $clean['id_wiki'];
+ $data['tree_name'] = $this->m['WikiModel']->getTheModelName($clean['id_wiki']);
+ $data['tree'] = $this->getSpecPageLink() . " &raquo; " . $this->getViewLink($data['tree_name'])." &raquo; ".gtext('Talk');
+
+ if (isset($_POST['insertAction']))
+ {
+ if ($this->s['registered']->status['status'] === 'logged')
+ {
+ if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
+
+ $this->m['WikitalkModel']->values['created_by'] = $this->s['registered']->status['id_user'];
+ $this->m['WikitalkModel']->values['id_wiki'] = $clean['id_wiki'];
+
+ $this->m['WikitalkModel']->updateTable('insert');
+
+ if ($this->m['WikitalkModel']->queryResult)
+ {
+ header('Refresh: 0;url=http://'.DOMAIN_NAME.$_SERVER['REQUEST_URI']);
+ exit;
+ }
+ }
+ }
+
+ $data['table'] = $this->m['WikitalkModel']->select()->where(array('id_wiki'=>$clean['id_wiki']))->orderBy('id_talk')->send();
+
+ $data['values'] = $this->m['WikitalkModel']->getFormValues('insert','sanitizeHtml');
+ $data['notice'] = $this->m['WikitalkModel']->notice;
+
+// javascript for moderator
+// $data['md_javascript'] = "moderator_dialog(\"hide\",\"talk\");moderator_dialog(\"show\",\"talk\");";
+// $data['go_to'] = $this->currPage."/".$this->lang."/".$clean['id_wiki'];
+
+ $this->append($data);
+ $this->load('talk');
+ $this->right();
+// $this->loadViewAll('talk,moderator_dialog');
+ }
+
+ protected function getViewLink($ne_name)
+ {
+ return "<a href='".$this->baseUrl.'/'.$this->controller.'/page/'.$this->lang.'/'.encodeUrl($ne_name)."'>".$ne_name."</a>";
+ }
+
+ protected function getHistoryLink($id)
+ {
+ return "<a href='".$this->baseUrl.'/'.$this->controller.'/history/'.$this->lang.'/'.$id."'>".gtext('History')."</a>";
+ }
+
+ protected function getSpecPageLink()
+ {
+ return "<a href='".$this->baseUrl.'/'.$this->controller.'/page/'.$this->lang."'>".$this->controller."</a>";
+ }
+
+} \ No newline at end of file
diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php
index 9b0d9ab..4bfb7fe 100644
--- a/h-source/Application/Include/languages.php
+++ b/h-source/Application/Include/languages.php
@@ -175,6 +175,24 @@ class Lang
"at" => "alle ore",
"last modifications" => "ultime modifiche",
"watch all modifications" => "guarda tutte le modifiche",
+ "title" => "titolo",
+ "text of the wiki page" => "testo della pagina",
+ "the wiki page has not been found" => "la pagina della wiki non è stata trovata",
+ "Page not-found" => "Pagina non trovata",
+ "Insert" => "Inserisci",
+ "Update" => "Modifica",
+ "History" => "History",
+ "Revision" => "Revisione",
+ "Differences" => "Differenze",
+ "Insert a new wiki page" => "Inserisci una nuova pagina nella wiki",
+ "Edit the wiki page" => "Modifica la pagina della wiki",
+ "Make current" => "Rendi revisione corrente",
+ "I want to make this revision the current revision" => "Voglio che questa revisione diventi quella corrente",
+ "Confirm" => "Conferma",
+ "Make this revision the current revision of the page" => "Rendi questa revisione la revisione corrente della pagina",
+ "This wiki page has been hidden" => "Questa pagina della wiki è stata nascosta",
+ "Talk" => "Discussione",
+ "Talk page of the wiki page" => "Pagina di discussione della pagina della wiki"
),
'es' => array
(
diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php
index daefb59..0f87893 100644
--- a/h-source/Application/Include/myFunctions.php
+++ b/h-source/Application/Include/myFunctions.php
@@ -29,12 +29,39 @@ function encodeUrl($url)
$url = str_replace(')','-',$url);
$url = str_replace('/','-',$url);
$url = str_replace('@','-at-',$url);
- $url = urlencode($url);
-// $url = html_entity_decode($url, ENT_QUOTES);
-// $url = xml_encode($url);
- return $url;
+
+ $temp = null;
+ for ($i=0;$i<strlen($url); $i++)
+ {
+ if (strcmp($url[$i],' ') === 0)
+ {
+ $temp .= '-';
+ }
+ else
+ {
+ if (preg_match('/^[a-zA-Z0-9\-]$/',$url[$i])) $temp .= $url[$i];
+ }
+ }
+
+ $temp = urlencode($temp);
+ return $temp;
}
+// function encodeUrl($url)
+// {
+// $url = str_replace(' ','-',$url);
+// $url = str_replace('[','-',$url);
+// $url = str_replace(']','-',$url);
+// $url = str_replace('(','-',$url);
+// $url = str_replace(')','-',$url);
+// $url = str_replace('/','-',$url);
+// $url = str_replace('@','-at-',$url);
+// $url = urlencode($url);
+// // $url = html_entity_decode($url, ENT_QUOTES);
+// // $url = xml_encode($url);
+// return $url;
+// }
+
function smartDate($uglyDate = null, $lang = 'en')
{
@@ -472,4 +499,17 @@ function getUrlsFromIdHard($id_hard)
return array('urlView'=>$urlView,'urlTalk'=>$urlTalk,'modelName'=>$deviceName);
+}
+
+function getDiffArray($associativeArray, $oldArray, $newArray)
+{
+ $diffArray = array();
+ foreach ($associativeArray as $field => $label)
+ {
+ if (array_key_exists($field,$oldArray) and array_key_exists($field,$newArray))
+ {
+ $diffArray[$label] = htmlDiff($oldArray[$field], $newArray[$field]);
+ }
+ }
+ return $diffArray;
} \ No newline at end of file
diff --git a/h-source/Application/Models/BaseModel.php b/h-source/Application/Models/GenericModel.php
index ce613c5..0ccd332 100644
--- a/h-source/Application/Models/BaseModel.php
+++ b/h-source/Application/Models/GenericModel.php
@@ -20,7 +20,7 @@
if (!defined('EG')) die('Direct access not allowed!');
-class BaseModel extends Model_Tree {
+class GenericModel extends Model_Tree {
public $type = ''; //device type
public $diffFields = array();
@@ -54,16 +54,6 @@ class BaseModel extends Model_Tree {
public function getDiffArray($oldArray, $newArray)
{
- $diffArray = array();
- foreach ($this->diffFields as $field => $label)
- {
- if (array_key_exists($field,$oldArray) and array_key_exists($field,$newArray))
- {
-// echo htmlDiff($oldArray[$field], $newArray[$field]);
-// echo $oldArray[$field].$newArray[$field];
- $diffArray[$label] = htmlDiff($oldArray[$field], $newArray[$field]);
- }
- }
- return $diffArray;
+ return getDiffArray($this->diffFields, $oldArray, $newArray);
}
} \ No newline at end of file
diff --git a/h-source/Application/Models/HardwareModel.php b/h-source/Application/Models/HardwareModel.php
index 10f899e..17565ff 100644
--- a/h-source/Application/Models/HardwareModel.php
+++ b/h-source/Application/Models/HardwareModel.php
@@ -157,7 +157,7 @@ class HardwareModel extends Model_Map {
{
//get the values of the revision
$revisions->setWhereQueryClause(array('id_rev'=>$clean['id_rev']));
- $newStruct = $revisions->getFields($this->fields.',created_by,updated_by,update_date,type,id_hard');
+ $newStruct = $revisions->getFields($this->fields.',created_by,updated_by,update_date,type');
if (count($newStruct > 0))
{
diff --git a/h-source/Application/Models/NotebooksModel.php b/h-source/Application/Models/NotebooksModel.php
index a8fcdf2..c8d5993 100644
--- a/h-source/Application/Models/NotebooksModel.php
+++ b/h-source/Application/Models/NotebooksModel.php
@@ -20,7 +20,7 @@
if (!defined('EG')) die('Direct access not allowed!');
-class NotebooksModel extends BaseModel {
+class NotebooksModel extends GenericModel {
public $type = 'notebook'; //device type
diff --git a/h-source/Application/Models/PrintersModel.php b/h-source/Application/Models/PrintersModel.php
index af86980..f69d543 100644
--- a/h-source/Application/Models/PrintersModel.php
+++ b/h-source/Application/Models/PrintersModel.php
@@ -20,7 +20,7 @@
if (!defined('EG')) die('Direct access not allowed!');
-class PrintersModel extends BaseModel
+class PrintersModel extends GenericModel
{
public $type = 'printer'; //device type
diff --git a/h-source/Application/Models/ScannersModel.php b/h-source/Application/Models/ScannersModel.php
index 87807b3..f30b505 100644
--- a/h-source/Application/Models/ScannersModel.php
+++ b/h-source/Application/Models/ScannersModel.php
@@ -20,7 +20,7 @@
if (!defined('EG')) die('Direct access not allowed!');
-class ScannersModel extends BaseModel
+class ScannersModel extends GenericModel
{
public $type = 'scanner'; //device type
diff --git a/h-source/Application/Models/SoundcardsModel.php b/h-source/Application/Models/SoundcardsModel.php
index cea12be..f872427 100644
--- a/h-source/Application/Models/SoundcardsModel.php
+++ b/h-source/Application/Models/SoundcardsModel.php
@@ -20,7 +20,7 @@
if (!defined('EG')) die('Direct access not allowed!');
-class SoundcardsModel extends BaseModel
+class SoundcardsModel extends GenericModel
{
public $type = 'soundcard'; //device type
diff --git a/h-source/Application/Models/ThreegcardsModel.php b/h-source/Application/Models/ThreegcardsModel.php
index 85dcd3e..6bde5c8 100644
--- a/h-source/Application/Models/ThreegcardsModel.php
+++ b/h-source/Application/Models/ThreegcardsModel.php
@@ -20,7 +20,7 @@
if (!defined('EG')) die('Direct access not allowed!');
-class ThreegcardsModel extends BaseModel
+class ThreegcardsModel extends GenericModel
{
public $type = '3G-card'; //device type
diff --git a/h-source/Application/Models/VideocardsModel.php b/h-source/Application/Models/VideocardsModel.php
index bfcaa25..472931e 100644
--- a/h-source/Application/Models/VideocardsModel.php
+++ b/h-source/Application/Models/VideocardsModel.php
@@ -20,7 +20,7 @@
if (!defined('EG')) die('Direct access not allowed!');
-class VideocardsModel extends BaseModel
+class VideocardsModel extends GenericModel
{
public $type = 'videocard'; //device type
diff --git a/h-source/Application/Models/WebcamsModel.php b/h-source/Application/Models/WebcamsModel.php
index 567bd2f..c5634ac 100644
--- a/h-source/Application/Models/WebcamsModel.php
+++ b/h-source/Application/Models/WebcamsModel.php
@@ -20,7 +20,7 @@
if (!defined('EG')) die('Direct access not allowed!');
-class WebcamsModel extends BaseModel
+class WebcamsModel extends GenericModel
{
public $type = 'webcam'; //device type
diff --git a/h-source/Application/Models/WifiModel.php b/h-source/Application/Models/WifiModel.php
index 7be244b..729101a 100644
--- a/h-source/Application/Models/WifiModel.php
+++ b/h-source/Application/Models/WifiModel.php
@@ -20,7 +20,7 @@
if (!defined('EG')) die('Direct access not allowed!');
-class WifiModel extends BaseModel
+class WifiModel extends GenericModel
{
public $type = 'wifi'; //device type
diff --git a/h-source/Application/Models/WikiModel.php b/h-source/Application/Models/WikiModel.php
new file mode 100644
index 0000000..1372a04
--- /dev/null
+++ b/h-source/Application/Models/WikiModel.php
@@ -0,0 +1,228 @@
+<?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 WikiModel extends Model_Map {
+
+ public $id_user = 0;
+ public $lastId = 0; //the id of the last record inserted
+ public $lastTitle = null; //the title of the last page inserted
+ public $lastTitleClean = null; //the cleaned title of the last page inserted
+
+ public $diffFields = array();
+ public $fieldsWithBreaks = array();
+
+ public function __construct() {
+ $this->_tables='wiki,regusers,wiki_users';
+ $this->_idFields='id_wiki,id_user';
+ $this->_where=array(
+ 'username' => 'regusers',
+ 'id_user' => 'regusers',
+ 'has_confirmed' => 'regusers',
+ 'deleted' => 'regusers'
+ );
+
+ $this->printAssError = "no";
+
+ $this->diffFields = array(
+ 'title' => gtext("title"),
+ 'page' => gtext('wiki page'),
+ );
+
+ $this->fieldsWithBreaks = array(gtext('wiki page'));
+
+ $this->strongConditions['insert'] = array(
+ "checkLength|99" => 'title',
+ "+checkLength|5000" => 'page',
+ );
+
+ $this->strongConditions['update'] = array(
+ "checkLength|99" => 'title',
+ "+checkLength|5000" => 'page',
+ );
+
+ parent::__construct();
+ }
+
+ public function insert()
+ {
+ $this->values['created_by'] = (int)$this->id_user;
+ $this->values['update_date'] = date('Y-m-d H:i:s');
+
+ //random ID
+ $randomId = md5(uniqid(mt_rand(),true));
+ $this->values["title_clean"] = $randomId;
+
+ parent::insert();
+
+ //associate the user to the record
+ if ($this->queryResult)
+ {
+ $resId = $this->select()->where(array('title_clean'=>$randomId))->send();
+ $clean['id'] = $resId[0]['wiki']['id_wiki'];
+ $this->lastId = $clean['id'];
+ $this->lastTitle = $resId[0]['wiki']['title'];
+ $this->lastTitleClean = encodeUrl($resId[0]['wiki']['title']);
+ $this->db->update('wiki','title_clean',array($this->lastTitleClean),'id_wiki='.$clean['id']);
+
+ //update the history table
+ $this->updateHistory('insert');
+
+ $this->associate($clean['id']);
+ }
+
+ }
+
+ public function update($id)
+ {
+ $clean['id'] = (int)$id;
+
+ $this->values['update_date'] = date('Y-m-d H:i:s');
+ $this->values['title_clean'] = encodeUrl($this->values['title']);
+
+ //save the old fields in the revisions table
+ $this->setWhereQueryClause(array('id_wiki' => $clean['id']));
+ $oldStruct = $this->getFields($this->fields.',title_clean,created_by,update_date,id_wiki');
+
+ if (count($oldStruct > 0))
+ {
+ $oldValues = $oldStruct[0]['wiki'];
+
+ $revisions = new WikirevisionsModel();
+ $revisions->values = $oldValues;
+ if ($revisions->insert())
+ {
+ parent::update($clean['id']);
+ if ($this->queryResult)
+ {
+ $this->lastId = $clean['id'];
+ $this->lastTitle = $this->values['title'];
+ $this->lastTitleClean = $this->values['title_clean'];
+
+ //update the history table
+ $this->updateHistory('update');
+
+ if (!$this->checkAssociation($clean['id'],(int)$this->id_user))
+ {
+ $this->associate($clean['id']);
+ }
+ }
+ }
+ }
+ }
+
+ public function makeCurrent($id_rev)
+ {
+ $clean['id_rev'] = (int)$id_rev;
+
+ $revisions = new WikirevisionsModel();
+
+ $clean['id_wiki'] = (int)$revisions->getIdPage($clean['id_rev']);
+
+ //save the old fields in the revisions table
+ $this->where(array('id_wiki'=>$clean['id_wiki']));
+ $oldStruct = $this->getFields($this->fields.',title_clean,created_by,update_date,id_wiki');
+
+ if (count($oldStruct > 0))
+ {
+ //get the values of the revision
+ $revisions->where(array('id_rev'=>$clean['id_rev']));
+ $newStruct = $revisions->getFields($this->fields.',title_clean,created_by,update_date');
+
+ if (count($newStruct > 0))
+ {
+ $revisions->values = $oldStruct[0]['wiki'];
+
+ $this->values = $newStruct[0]['wiki_revisions'];
+ $this->values['created_by'] = (int)$this->id_user;
+ $this->values['update_date'] = date('Y-m-d H:i:s');
+
+ if ($revisions->insert())
+ {
+ if (parent::update($clean['id_wiki']))
+ {
+ $this->lastId = $clean['id_wiki'];
+ $this->lastTitle = $this->values['title'];
+ $this->lastTitleClean = $this->values['title_clean'];
+
+ //update the history table
+ $this->updateHistory('update');
+
+ if (!$this->checkAssociation($clean['id_wiki'],(int)$this->id_user))
+ {
+ $this->associate($clean['id_wiki']);
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ public function associate($id_record)
+ {
+ return parent::associate((int)$id_record,(int)$this->id_user);
+ }
+
+ //get the model name
+ public function getTheModelName($id)
+ {
+ $clean['id'] = (int)$id;
+ $this->setWhereQueryClause(array('id_wiki' => $clean['id']));
+ $res = $this->getFields('title');
+ $name = count($res) > 0 ? $res[0]['wiki']['title'] : '';
+ return $name;
+ }
+
+ //save in the history all the action carried out by users
+ protected function updateHistory($action)
+ {
+ $translations = array(
+ 'insert' => 'inserted',
+ 'update' => 'updated',
+ );
+
+ $allowedActions = array('insert','update');
+
+ if (in_array($action,$allowedActions))
+ {
+ $users = new UsersModel();
+
+ $clean['user'] = sanitizeAll($users->getUser($this->id_user));
+
+ $history = new HistoryModel();
+ $history->values = array(
+ 'created_by' => $this->id_user,
+ 'type' => 'wiki',
+ 'action' => $action,
+ 'id' => $this->lastId,
+ 'message' => 'The wiki page having id='.$this->lastId.' has been '.$translations[$action].' by the user ' . $clean['user'] . ' (id_user='.$this->id_user.') ',
+ 'gr' => 'registered',
+ );
+ $history->insert();
+ }
+ }
+
+ public function getDiffArray($oldArray, $newArray)
+ {
+ return getDiffArray($this->diffFields, $oldArray, $newArray);
+ }
+} \ No newline at end of file
diff --git a/h-source/Application/Models/WikirevisionsModel.php b/h-source/Application/Models/WikirevisionsModel.php
new file mode 100644
index 0000000..fdf5558
--- /dev/null
+++ b/h-source/Application/Models/WikirevisionsModel.php
@@ -0,0 +1,45 @@
+<?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 WikirevisionsModel extends Model_Tree {
+
+ public $id_user = 0;
+
+ public function __construct() {
+ $this->_tables='wiki_revisions';
+ $this->_idFields='id_rev';
+
+ $this->orderBy = 'id_rev desc';
+
+ parent::__construct();
+ }
+
+ public function getIdPage($id_rev = 0)
+ {
+ $clean['id_rev'] = (int)$id_rev;
+
+ $res = $this->db->select('wiki_revisions','id_wiki','id_rev='.$clean['id_rev']);
+
+ return (count($res) > 0) ? $res[0]['wiki_revisions']['id_wiki'] : 0;
+ }
+
+} \ No newline at end of file
diff --git a/h-source/Application/Models/WikitalkModel.php b/h-source/Application/Models/WikitalkModel.php
new file mode 100644
index 0000000..2de10ba
--- /dev/null
+++ b/h-source/Application/Models/WikitalkModel.php
@@ -0,0 +1,50 @@
+<?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 WikitalkModel extends Model_Tree
+{
+
+ public function __construct() {
+ $this->_tables = 'wiki_talk';
+ $this->_idFields = 'id_talk';
+
+ $this->orderBy = 'talk.id_talk';
+
+ $this->strongConditions['insert'] = array(
+ "checkLength|99" => 'title',
+ "+checkLength|5000" => 'message',
+ );
+
+ parent::__construct();
+ }
+
+ public $formStruct = array(
+ 'entries' => array(
+ 'title' => array(),
+ 'message' => array('type'=>'Textarea'),
+ 'id_talk' => array(
+ 'type' => 'Hidden'
+ )
+ ),
+ );
+
+} \ No newline at end of file
diff --git a/h-source/Application/Views/Issues/view.php b/h-source/Application/Views/Issues/view.php
index d5e536e..0af4780 100644
--- a/h-source/Application/Views/Issues/view.php
+++ b/h-source/Application/Views/Issues/view.php
@@ -223,7 +223,7 @@
<?php } else { ?>
<div class="talk_login_notice">
- <a name="form"><?php echo gtext("You have to");?> <a href="<?php echo $this->baseUrl."/users/login/$lang";?>">login</a> <?php echo gtext("in order to submit a message to this issue");?></a>
+ <a name="form"><?php echo gtext("You have to");?> <a href="<?php echo $this->baseUrl."/users/login/$lang?redirect=".$this->controller."/".$this->action.$queryString;?>">login</a> <?php echo gtext("in order to submit a message to this issue");?></a>
</div>
<?php } ?>
diff --git a/h-source/Application/Views/Issues/viewall.php b/h-source/Application/Views/Issues/viewall.php
index b47294f..0374fc7 100644
--- a/h-source/Application/Views/Issues/viewall.php
+++ b/h-source/Application/Views/Issues/viewall.php
@@ -110,7 +110,7 @@
<?php } else { ?>
<div class="talk_login_notice">
- <a name="form"><?php echo gtext("You have to");?> <a href="<?php echo $this->baseUrl."/users/login/$lang";?>">login</a> <?php echo gtext("in order to submit an issue");?></a>
+ <a name="form"><?php echo gtext("You have to");?> <a href="<?php echo $this->baseUrl."/users/login/$lang?redirect=".$this->controller."/".$this->action.$queryString;?>">login</a> <?php echo gtext("in order to submit an issue");?></a>
</div>
<?php } ?>
diff --git a/h-source/Application/Views/Wiki/climb.php b/h-source/Application/Views/Wiki/climb.php
new file mode 100644
index 0000000..bd502d1
--- /dev/null
+++ b/h-source/Application/Views/Wiki/climb.php
@@ -0,0 +1,50 @@
+<?php if (!defined('EG')) die('Direct access not allowed!'); ?>
+
+<?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/>.
+?>
+ <div id="left">
+
+ <div class="position_tree_box">
+ <a href="<?php echo $this->baseUrl."/home/index/$lang";?>">Home</a> &raquo; <?php echo $tree;?>
+ </div>
+
+ <div class="notebook_view_title">
+ <?php echo gtext('Make this revision the current revision of the page'); ?> <b><?php echo $tree_name;?></b>
+ </div>
+
+ <div class="notebook_insert_link">
+ <a title="Back to the history of the page <?php echo $tree_name;?>" href="<?php echo $this->baseUrl."/".$this->controller."/history/$lang/".$id_wiki.$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a>
+ </div>
+
+ <div class="wiki_external_box">
+
+ <?php echo $notice;?>
+
+ <div class="climb_form_ext_box">
+
+ <?php if (strcmp($isDeleted,'no') === 0 ) { ?>
+ <form action="<?php echo $this->currPage."/$lang/$id_rev"; ?>" method="POST">
+ <?php echo gtext('I want to make this revision the current revision');?>: <input type="submit" name="confirmAction" value="<?php echo gtext('Confirm');?>">
+ </form>
+ <?php } ?>
+
+ </div>
+
+ </div> \ No newline at end of file
diff --git a/h-source/Application/Views/Wiki/differences.php b/h-source/Application/Views/Wiki/differences.php
new file mode 100644
index 0000000..1709cbf
--- /dev/null
+++ b/h-source/Application/Views/Wiki/differences.php
@@ -0,0 +1,61 @@
+<?php if (!defined('EG')) die('Direct access not allowed!'); ?>
+
+<?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/>.
+?>
+
+ <div id="left">
+
+ <div class="position_tree_box">
+ <a href="<?php echo $this->baseUrl."/home/index/$lang";?>">Home</a> &raquo; <?php echo $tree;?>
+ </div>
+
+ <?php if ($showDiff === true) { ?>
+ <div class="notebook_view_title">
+ Differences between the revision of <b><?php echo smartDate($update_new);?></b>, created by <b><?php echo getLinkToUser($u->getUser($created_by));?></b>, and the revision of <b><?php echo smartDate($update_old);?></b>
+ </div>
+ <?php } ?>
+
+ <div class="notebook_insert_link">
+ <a title="Back to the history of the page <?php echo $tree_name;?>" href="<?php echo $this->baseUrl."/".$this->controller."/history/$lang/".$id_wiki.$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a>
+ </div>
+
+ <div class="wiki_external_box">
+
+ <div class="diff_color_notice">
+ <b>Notice</b>: the text in <del>red</del> has been deleted from the previous revision, the text in <ins>green</ins> has been added in this revision and the text in <span class="gray_text_notice">gray</span> has not been changed.
+ </div>
+
+ <?php foreach ($diffArray as $label => $text) { ?>
+
+ <div class="diff_ext_box">
+
+ <div class="diff_item_label">
+ <?php echo gtext("differences in the entry");?>: <b><?php echo $label;?></b>
+ </div>
+
+ <div class="diff_item_text">
+ <?php echo in_array($label,$fieldsWithBreaks) ? nl2br($text) : $text;?>
+ </div>
+
+ </div>
+
+ <?php } ?>
+
+ </div>
diff --git a/h-source/Application/Views/Wiki/form.php b/h-source/Application/Views/Wiki/form.php
new file mode 100644
index 0000000..0a448dd
--- /dev/null
+++ b/h-source/Application/Views/Wiki/form.php
@@ -0,0 +1,96 @@
+<?php if (!defined('EG')) die('Direct access not allowed!'); ?>
+
+<?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/>.
+?>
+
+ <script>
+
+ $(document).ready(function() {
+
+ $("#bb_code").markItUp(mySettings);
+
+ });
+
+ </script>
+
+ <div id="left">
+
+ <?php if ( strcmp($this->action,'insert') === 0 ) { ?>
+
+ <div class="position_tree_box">
+ <a href="<?php echo $this->baseUrl."/home/index/$lang";?>">Home</a> &raquo; <a href="<?php echo $this->baseUrl."/wiki/page/$lang";?>">Wiki</a> &raquo; <?php echo gtext('Insert'); ?>
+ </div>
+
+ <div class="notebook_view_title">
+ <?php echo gtext('Insert a new wiki page'); ?>
+ </div>
+
+ <div class="notebook_insert_link">
+ <a title="Back to the wiki main page" href="<?php echo $this->baseUrl."/".$this->controller."/page/$lang/";?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a>
+ </div>
+
+ <?php } else if ( strcmp($this->action,'update') === 0 ) { ?>
+
+ <div class="position_tree_box">
+ <a href="<?php echo $this->baseUrl."/home/index/$lang";?>">Home</a> &raquo; <a href="<?php echo $this->baseUrl."/wiki/page/$lang";?>">Wiki</a> &raquo; <a href="<?php echo $this->baseUrl."/wiki/page/$lang/".encodeUrl($tree_name);?>"><?php echo $tree_name;?></a> &raquo; <?php echo gtext('Update'); ?>
+ </div>
+
+ <div class="notebook_view_title">
+ <?php echo gtext('Edit the wiki page'); ?> <b><?php echo $tree_name;?></b>
+ </div>
+
+ <div class="notebook_insert_link">
+ <a title="Back to the page <?php echo $tree_name;?>" href="<?php echo $this->baseUrl."/".$this->controller."/page/$lang/".encodeUrl($tree_name);?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a>
+ </div>
+
+ <?php } ?>
+
+ <div class="top_licence_notice">
+ <div><b>License Informations:</b></div>
+ Any text submitted by you will be put in the Public Domain (see the <a href="http://creativecommons.org/publicdomain/zero/1.0/">CC0 page</a> for detailed information).
+ </div>
+
+ <?php echo $notice;?>
+
+ <div class="notebooks_insert_form">
+
+ <form action="<?php echo $this->baseUrl."/".$this->controller."/".$this->action."/$lang";?>" method="POST">
+
+ <div class="edit_form">
+
+ <div class="form_entry">
+ <div class="entry_label"><?php echo gtext("title");?>:</div>
+ <?php echo Html_Form::input('title',$values['title'],'input_entry');?>
+ </div>
+
+ <div class="form_entry">
+ <div class="entry_label"><?php echo gtext("text of the wiki page");?>:<br /><a href="<?php echo $this->baseUrl."/help/index/$lang#wiki-syntax";?>"><?php echo gtext("discover all the wiki tags");?></a></div>
+ <?php echo Html_Form::textarea('page',$values['page'],'textarea_entry','bb_code');?>
+ </div>
+
+ <?php echo $hiddenInput;?>
+
+ <input type="submit" name="<?php echo $submitName;?>" value="Save">
+
+ </div>
+
+ </form>
+ </div>
+
diff --git a/h-source/Application/Views/Wiki/history.php b/h-source/Application/Views/Wiki/history.php
new file mode 100644
index 0000000..b979063
--- /dev/null
+++ b/h-source/Application/Views/Wiki/history.php
@@ -0,0 +1,70 @@
+<?php if (!defined('EG')) die('Direct access not allowed!'); ?>
+
+<?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/>.
+?>
+
+ <div id="left">
+
+ <div class="position_tree_box">
+ <a href="<?php echo $this->baseUrl."/home/index/$lang";?>">Home</a> &raquo; <a href="<?php echo $this->baseUrl."/wiki/page/$lang";?>">Wiki</a> &raquo; <a href="<?php echo $this->baseUrl."/wiki/page/$lang/".encodeUrl($tree_name);?>"><?php echo $tree_name;?></a> &raquo; <?php echo gtext('History');?>
+ </div>
+
+ <div class="notebook_view_title">
+ History of the wiki page <b><?php echo $tree_name;?></b>
+ </div>
+
+ <div class="notebook_insert_link">
+ <a title="Back to the page <?php echo $tree_name;?>" href="<?php echo $this->baseUrl."/".$this->controller."/page/$lang/".encodeUrl($tree_name);?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a>
+ </div>
+
+ <div class="wiki_external_box">
+
+ <ul class="page_history">
+
+ <?php if ($this->viewArgs['page'] === 1) { ?>
+ <?php foreach ($rev1 as $rev) { ?>
+ <li class="page_history_current_item"><b><?php echo gtext("Current revision");?>:</b> <?php echo smartDate($rev['wiki']['update_date']);?> by <?php echo getLinkToUser($u->getUser($rev['wiki']['created_by']));?> (<a href="<?php echo $this->baseUrl."/".$this->controller."/differences/$lang/$id/0".$this->viewStatus;?>">diff</a>)</li>
+ <?php } ?>
+ <?php } ?>
+
+ <?php foreach ($rev2 as $rev) { ?>
+ <li class="page_history_item">
+
+ <a href="<?php echo $this->baseUrl."/".$this->controller."/revision/$lang/".$rev['wiki_revisions']['id_rev'].$this->viewStatus;?>"><?php echo smartDate($rev['wiki_revisions']['update_date']);?></a> by <?php echo getLinkToUser($u->getUser($rev['wiki_revisions']['created_by']));?>
+
+ <?php if (strcmp($rev['wiki_revisions']['id_rev'],$firstRev) !== 0) {?>
+ (<a href="<?php echo $this->baseUrl."/".$this->controller."/differences/$lang/$id/".$rev['wiki_revisions']['id_rev'].$this->viewStatus;?>">diff</a>)
+ <?php } ?>
+
+ <?php if ($islogged === 'yes') { ?>
+ (<a href="<?php echo $this->baseUrl.'/'.$this->controller.'/climb/'.$lang.'/'.$rev['wiki_revisions']['id_rev'].$this->viewStatus;?>"><?php echo gtext('Make current'); ?></a>)
+ <?php } ?>
+
+ </li>
+ <?php } ?>
+
+ </ul>
+
+ </div>
+
+ <div class="history_page_list">
+ <?php echo gtext("page list");?>: <?php echo $pageList;?>
+ </div>
+
diff --git a/h-source/Application/Views/Wiki/not_found.php b/h-source/Application/Views/Wiki/not_found.php
new file mode 100644
index 0000000..dc95c21
--- /dev/null
+++ b/h-source/Application/Views/Wiki/not_found.php
@@ -0,0 +1,34 @@
+<?php if (!defined('EG')) die('Direct access not allowed!'); ?>
+
+<?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/>.
+?>
+
+ <div id="left">
+
+ <div class="position_tree_box">
+ <a href="<?php echo $this->baseUrl."/home/index/$lang";?>">Home</a> &raquo; <a href="<?php echo $this->baseUrl."/wiki/page/$lang";?>">Wiki</a> &raquo; <?php echo gtext('Page not-found'); ?>
+ </div>
+
+ <div class="wiki_external_box">
+ <div>
+ <?php echo gtext('the wiki page has not been found');?>
+ </div>
+ </div>
+
diff --git a/h-source/Application/Views/Wiki/page.php b/h-source/Application/Views/Wiki/page.php
new file mode 100644
index 0000000..92e3c9b
--- /dev/null
+++ b/h-source/Application/Views/Wiki/page.php
@@ -0,0 +1,102 @@
+<?php if (!defined('EG')) die('Direct access not allowed!'); ?>
+
+<?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/>.
+?>
+
+ <div id="left">
+
+ <?php $tableName = strcmp($this->action,'page') === 0 ? 'wiki' : 'wiki_revisions'; ?>
+
+ <?php if ( strcmp($this->action,'page') === 0 ) { ?>
+
+ <div class="position_tree_box">
+ <a href="<?php echo $this->baseUrl."/home/index/$lang";?>">Home</a> &raquo; <a href="<?php echo $this->baseUrl."/wiki/page/$lang";?>">Wiki</a> &raquo; <?php echo $tree_name;?>
+ </div>
+
+ <div class="notebook_insert_link">
+ <div class="view_page_history_button">
+ <a title="talk page" href="<?php echo $this->baseUrl."/".$this->controller."/talk/$lang/$id_wiki";?>"><img class="top_left_note_image" src="<?php echo $this->baseUrl;?>/Public/Img/talk-60.png"></a>
+ </div>
+
+ <div class="view_page_history_button">
+ <a title="history page" href="<?php echo $this->baseUrl."/".$this->controller."/history/$lang/$id_wiki";?>"><img class="top_left_note_image" src="<?php echo $this->baseUrl;?>/Public/Img/history-60.png"></a>
+ </div>
+
+ <?php if (strcmp($isDeleted,'no') === 0) { ?>
+ <div class="view_page_update_button">
+ <form action="<?php echo $this->baseUrl."/".$this->controller."/update/$lang";?>" method="POST">
+ <input title="edit page" class="update_submit_class" type="image" src="<?php echo $this->baseUrl;?>/Public/Img/edit-60.png" value="xedit">
+ <input type="hidden" name="id_wiki" value="<?php echo $id_wiki;?>">
+ </form>
+ </div>
+ <?php } ?>
+ </div>
+
+ <div class="talk_numb_ext">
+ <a href="<?php echo $this->baseUrl."/".$this->controller."/talk/$lang/$id_wiki";?>">talk messages: <?php echo $talk_number;?></a>
+ </div>
+
+ <?php } else if ( strcmp($this->action,'revision') === 0 ) { ?>
+
+ <div class="position_tree_box">
+ <a href="<?php echo $this->baseUrl."/home/index/$lang";?>">Home</a> &raquo; <?php echo $tree; ?>
+ </div>
+
+ <div class="notebook_view_title">
+ Revision of the wiki page <b><?php echo $tree_name;?></b>
+ </div>
+
+ <div class="notebook_insert_link">
+ <a title="Back to the history of the page <?php echo $tree_name;?>" href="<?php echo $this->baseUrl."/".$this->controller."/history/$lang/".$id_wiki.$this->viewStatus;?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a>
+ </div>
+
+ <?php } ?>
+
+ <div class="wiki_external_box">
+
+ <?php if ( strcmp($isDeleted,'yes') === 0 ) { ?>
+
+ <div class="revision_alert">
+ <?php echo gtext('This wiki page has been hidden'); ?>
+ </div>
+
+ <?php } ?>
+
+ <?php if ( strcmp($isDeleted,'no') === 0 or $ismoderator) { ?>
+
+ <!--if revision-->
+ <?php if (strcmp($this->action,'revision') === 0) { ?>
+ <div class="revision_alert">
+ This is an old revision of this page, as edited by <b><?php echo getLinkToUser($u->getUser($created_by));?></b> at <b><?php echo smartDate($update_date); ?></b>. It may differ significantly from the <a href="<?php echo $this->baseUrl."/wiki/page/$lang/".encodeUrl($tree_name);?>">current revision</a>.
+ </div>
+ <?php } ?>
+
+ <?php foreach ($table as $page) { ?>
+ <div class="wiki_page_title">
+ <?php echo $page[$tableName]['title']?>
+ </div>
+ <div class="wiki_page_content">
+ <?php echo decodeWikiText($page[$tableName]['page'])?>
+ </div>
+ <?php } ?>
+
+ <? } ?>
+
+ </div>
diff --git a/h-source/Application/Views/Wiki/talk.php b/h-source/Application/Views/Wiki/talk.php
new file mode 100644
index 0000000..67ecbeb
--- /dev/null
+++ b/h-source/Application/Views/Wiki/talk.php
@@ -0,0 +1,122 @@
+<?php if (!defined('EG')) die('Direct access not allowed!'); ?>
+
+<?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/>.
+?>
+
+ <script>
+
+ $(document).ready(function() {
+
+ $("#bb_code").markItUp(mySettings);
+
+ });
+
+ </script>
+
+ <div id="left">
+
+ <div class="position_tree_box">
+ <a href="<?php echo $this->baseUrl."/home/index/$lang";?>">Home</a> &raquo; <?php echo $tree; ?>
+ </div>
+
+ <div class="notebook_view_title">
+ <?php echo gtext('Talk page of the wiki page'); ?> <b><?php echo $tree_name;?></b>
+ </div>
+
+ <div class="notebook_insert_link">
+ <a title="Back to the page <?php echo $tree_name;?>" href="<?php echo $this->baseUrl."/".$this->controller."/page/$lang/".encodeUrl($tree_name);?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a>
+ </div>
+
+ <div class="wiki_external_box">
+
+ <?php foreach ($table as $message) { ?>
+
+ <?php if (strcmp($message['wiki_talk']['deleted'],'no') === 0) { ?>
+
+ <a name="wiki-talk-<?php echo $message['wiki_talk']['id_talk'];?>"></a>
+ <div class="talk_message_item">
+
+ <div class="talk_message_item_title_date">
+
+ <div class="talk_message_item_title">
+ <?php echo $message['wiki_talk']['title'];?>
+ </div>
+
+ <div class="talk_message_item_date">
+ by <?php echo getLinkToUser($u->getUser($message['wiki_talk']['created_by']));?>, <?php echo smartDate($message['wiki_talk']['creation_date']);?>
+ </div>
+ </div>
+
+ <div class="talk_message_item_content">
+ <?php echo decodeWikiText($message['wiki_talk']['message']);?>
+ </div>
+
+ </div>
+
+ <?php } else { ?>
+
+
+
+ <?php } ?>
+
+ <?php } ?>
+ </div>
+
+ <?php if ($islogged === 'yes') { ?>
+
+ <div class="talk_form_external_box">
+ <div class="talk_login_notice">
+ <a name="form">Add a message</a>
+ </div>
+
+ <?php echo $notice;?>
+
+ <div class="notebooks_insert_form">
+ <form action="<?php echo $this->baseUrl."/".$this->controller."/talk/$lang/$id_wiki";?>#form" method="POST">
+
+ <div class="edit_form">
+
+ <div class="form_entry">
+ <div class="entry_label">Title:</div>
+ <?php echo Html_Form::input('title',$values['title'],'talk_input_entry');?>
+ </div>
+
+ <div class="form_entry">
+ <div class="entry_label">Message:</div>
+ <?php echo Html_Form::textarea('message',$values['message'],'talk_textarea_entry','bb_code');?>
+ </div>
+
+ <input type="submit" name="insertAction" value="Save">
+
+ </div>
+
+ </form>
+ </div>
+ </div>
+
+ <?php } else { ?>
+
+ <div class="talk_login_notice">
+ <a name="form"><?php echo gtext("You have to");?> <a href="<?php echo $this->baseUrl."/users/login/$lang?redirect=".$this->controller."/".$this->action.$queryString;?>">login</a> <?php echo gtext("in order to add a message");?></a>
+ </div>
+
+ <?php } ?>
+
+ </div> \ No newline at end of file
diff --git a/h-source/Application/Views/right.php b/h-source/Application/Views/right.php
index bc97fba..b931151 100644
--- a/h-source/Application/Views/right.php
+++ b/h-source/Application/Views/right.php
@@ -30,10 +30,12 @@
<div class="login_table_box">
+ <?php $currPos = $querySanitized ? $this->controller."/".$this->action : 'home/index'; ?>
+
<?php if ($islogged === 'yes') { ?>
<div class="login_box_logged">
<div class="who_you_are_and_logout">
- <?php echo gtext("Hello");?> <b><?php echo $username; ?></b> (<a href="<?php echo $this->baseUrl."/users/logout/".Lang::$current;?>">logout</a>)
+ <?php echo gtext("Hello");?> <b><?php echo $username; ?></b> (<a href="<?php echo $this->baseUrl."/users/logout/$lang?redirect=".$currPos.$queryString;?>">logout</a>)
</div>
<div class="your_panel_link">
<?php echo gtext("Your");?> <a href="<?php echo $this->baseUrl."/my/home/$lang";?>"><?php echo gtext("control panel");?></a>
@@ -45,7 +47,7 @@
Login form:
</div>
<!--login form-->
- <form action="<?php echo $this->baseUrl."/users/login/$lang";?>" method="POST">
+ <form action="<?php echo $this->baseUrl."/users/login/$lang?redirect=".$currPos.$queryString;?>" method="POST">
<div class="login_right_box">
<div class="login_right_item">
diff --git a/h-source/Application/Views/talk.php b/h-source/Application/Views/talk.php
index 11f6bbc..a5de7d9 100644
--- a/h-source/Application/Views/talk.php
+++ b/h-source/Application/Views/talk.php
@@ -45,7 +45,7 @@
<?php } ?>
<div class="talk_message_item_title">
- <?php echo eg_strtoupper($message['talk']['title']);?>
+ <?php echo $message['talk']['title'];?>
</div>
<div class="talk_message_item_date">
@@ -140,7 +140,7 @@
<?php } else { ?>
<div class="talk_login_notice">
- <a name="form"><?php echo gtext("You have to");?> <a href="<?php echo $this->baseUrl."/users/login/$lang/".$this->controller."/view/$id_hard";?>">login</a> <?php echo gtext("in order to add a message");?></a>
+ <a name="form"><?php echo gtext("You have to");?> <a href="<?php echo $this->baseUrl."/users/login/$lang?redirect=".$this->controller."/".$this->action.$queryString;?>">login</a> <?php echo gtext("in order to add a message");?></a>
</div>
<?php } ?> \ No newline at end of file
diff --git a/h-source/Config/Route.php b/h-source/Config/Route.php
index 98bb7c9..7aaf55b 100644
--- a/h-source/Config/Route.php
+++ b/h-source/Config/Route.php
@@ -135,6 +135,14 @@ class Route
'webcams,climb',
'webcams,talk',
'last,modifications',
+ 'wiki,insert',
+ 'wiki,update',
+ 'wiki,page',
+ 'wiki,history',
+ 'wiki,revision',
+ 'wiki,differences',
+ 'wiki,climb',
+ 'wiki,talk',
);
//it can be 'yes' or 'no'
diff --git a/h-source/Public/Css/main.css b/h-source/Public/Css/main.css
index e3960ba..3eed9d2 100644
--- a/h-source/Public/Css/main.css
+++ b/h-source/Public/Css/main.css
@@ -1658,4 +1658,22 @@ td.text_item_date
{
margin-left:10px;
font:normal 14px/1 sans-serif;
+}
+
+.wiki_external_box
+{
+ margin:4em 10px;
+ clear:both;
+ clear:right;
+}
+.wiki_page_title
+{
+ font:bold 16px/1 sans-serif,arial;
+ margin:20px 0px;
+ padding-bottom:4px;
+ border-bottom:1px solid #000;
+}
+.wiki_page_content
+{
+ margin:2em 0px;
} \ No newline at end of file
diff --git a/h-source/tables.sql b/h-source/tables.sql
index a447d71..3a50a1a 100644
--- a/h-source/tables.sql
+++ b/h-source/tables.sql
@@ -231,3 +231,47 @@ create table history (
);
insert into reggroups (name) values ('moderator');
+
+
+create table wiki (
+ id_wiki INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ created_by int not null,
+ creation_date timestamp default CURRENT_TIMESTAMP,
+ update_date datetime not null,
+ title varchar(100) CHARACTER SET utf8 not null,
+ title_clean varchar(100) CHARACTER SET utf8 not null,
+ page text CHARACTER SET utf8 not null,
+ deleted char(3) not null default 'no',
+ is_main char(3) not null default 'no'
+)engine=innodb;
+
+create table wiki_revisions (
+ id_rev INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ created_by int not null,
+ creation_date timestamp default CURRENT_TIMESTAMP,
+ update_date datetime not null,
+ title varchar(100) CHARACTER SET utf8 not null,
+ title_clean varchar(100) CHARACTER SET utf8 not null,
+ page text CHARACTER SET utf8 not null,
+ id_wiki INT UNSIGNED NOT NULL
+)engine=innodb;
+
+create table wiki_users (
+ id_user int(11) UNSIGNED not null,
+ id_wiki int(11) UNSIGNED not null,
+ index wiki_indx(id_wiki),
+ index user_indx(id_user),
+ foreign key wiki_fky(id_wiki) references wiki (id_wiki),
+ foreign key user_fky(id_user) references regusers (id_user),
+ unique (id_user,id_wiki)
+)engine=innodb;
+
+create table wiki_talk (
+ id_talk INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ created_by int not null,
+ creation_date timestamp default CURRENT_TIMESTAMP,
+ title varchar(100) CHARACTER SET utf8 not null,
+ message text CHARACTER SET utf8 not null,
+ id_wiki INT UNSIGNED NOT NULL,
+ deleted char(4) not null default 'no'
+)engine=innodb; \ No newline at end of file