Author: dgoette
Date: Wed Nov 19 07:07:44 2008
New Revision: 37455
URL:
http://svn.reactos.org/svn/reactos?rev=37455&view=rev
Log:
* preview function can now be used to *preview* pages
* fixed some bugs
Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/Editor_Website.class.php
branches/danny-web/reactos.org/htdocs/roscms/lib/Export_HTML.class.php
branches/danny-web/reactos.org/htdocs/roscms/lib/Export_Page.class.php
branches/danny-web/reactos.org/htdocs/roscms/lib/Export_QuickInfo.class.php
branches/danny-web/reactos.org/htdocs/roscms/lib/HTML_User_ProfileEdit.clas…
Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/Editor_Website.class.php
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
==============================================================================
---
branches/danny-web/reactos.org/htdocs/roscms/lib/Editor_Website.class.php [iso-8859-1]
(original)
+++
branches/danny-web/reactos.org/htdocs/roscms/lib/Editor_Website.class.php [iso-8859-1]
Wed Nov 19 07:07:44 2008
@@ -322,8 +322,6 @@
echo '<span id="elmcount"
class="'.$text_num.'"> </span>';
}
- echo '</form>';
-
if (Security::hasRight($this->data_id, 'write')) {
echo_strip('
<button type="button" id="bsavedraft"
onclick="'."edit_form_submit_draft(".$this->data_id.",".$this->rev_id.")".'">Save
as Draft</button>
@@ -409,8 +407,11 @@
}
echo_strip('
- <span id="mefasi"> </span>
- </div></div>
+ </form>
+ <span
id="mefasi"> </span>
+ </div>
+ </div>
+ </div>
<div id="frmdiff"
style="display:none;"></div>');
}
@@ -577,7 +578,7 @@
echo_strip('
</span>
<span style="white-space: nowrap;">type: <span
class="frmeditheader">'.$revision['data_type'].'</span></span>
- <span style="white-space: nowrap;">version: <span
id="mefrverid"
class="frmeditheader">'.$revision['rev_version'].'</span></span>
+ <span style="white-space: nowrap;">version: <span
id="mefrverid"
class="frmeditheader">'.$revision['rev_version'].'</span></span>
<span style="white-space: nowrap;">language: <span
id="mefrlang"
class="frmeditheader">'.$revision['rev_language'].'</span></span>
<span style="white-space: nowrap;">user: <span
id="mefrusrid"
class="frmeditheader">'.$revision['user_name'].'</span></span>
');
Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/Export_HTML.class.php
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
==============================================================================
---
branches/danny-web/reactos.org/htdocs/roscms/lib/Export_HTML.class.php [iso-8859-1]
(original)
+++
branches/danny-web/reactos.org/htdocs/roscms/lib/Export_HTML.class.php [iso-8859-1]
Wed Nov 19 07:07:44 2008
@@ -289,101 +289,133 @@
*/
public function processTextByName( $page_name, $lang = '', $dynamic_num = 0,
$output_type = '' )
{
+ global $roscms_standard_language;
+
+ // use class vars instead of give them every method as param
+ $this->page_name = $page_name;
+ $this->lang = $lang;
+ $this->dynamic_num = intval($dynamic_num);
+ $this->output_type = $output_type;
+
+ //
+ if ($dynamic_num > 0) {
+ $stmt=DBConnection::getInstance()->prepare("SELECT r.rev_id, r.rev_language
FROM data_ d JOIN data_revision r ON r.data_id = d.data_id JOIN data_tag t ON
t.data_rev_id=r.rev_id JOIN data_tag_name n ON t.tag_name_id=n.tn_id JOIN data_tag_value v
ON t.tag_value_id=v.tv_id WHERE data_name = :name AND data_type = 'page' AND
r.rev_version > 0 AND (r.rev_language = :lang_one OR r.rev_language = :lang_two) AND
n.tn_name = 'number' AND t.tag_usrid = '-1' AND v.tv_value = :dynamic_num
ORDER BY r.rev_version DESC LIMIT 2");
+ $stmt->bindParam('dynamic_num',$dynamic_num,PDO::PARAM_INT);
+ }
+ else {
+ $stmt=DBConnection::getInstance()->prepare("SELECT r.rev_id, r.rev_language
FROM data_ d JOIN data_revision r ON r.data_id = d.data_id WHERE data_name = :name AND
data_type = 'page' AND r.rev_version > 0 AND (r.rev_language = :lang_one OR
r.rev_language = :lang_two) ORDER BY r.rev_version DESC LIMIT 2");
+ }
+ $stmt->bindParam('name',$page_name,PDO::PARAM_STR);
+ $stmt->bindParam('lang_one',$lang,PDO::PARAM_STR);
+ $stmt->bindParam('lang_two',$roscms_standard_language,PDO::PARAM_STR);
+ $stmt->execute();
+ $results=$stmt->fetchAll(PDO::FETCH_ASSOC);
+ $page = @$results[0];
+
+ // try to get the dataset with rev_language == $lang, to boost the translated
content
+ if( count($results) == 2 && $page['rev_language'] ==
$roscms_standard_language ) {
+ $page = $results[1];
+ }
+
+ $this->processText($page['rev_id'], $output_type);
+ }
+
+
+ /**
+ * processes the content
+ * need to call this in object context
+ *
+ * @return content
+ * @access public
+ */
+ public function processText( $rev_id, $output_type = '' )
+ {
global $roscms_intern_account_id;
global $roscms_standard_language_full;
global $roscms_intern_webserver_pages;
global $roscms_intern_webserver_roscms;
global $roscms_standard_language;
- // use class vars instead of give them every method as param
- $this->page_name = $page_name;
- $this->lang = $lang;
- $this->dynamic_num = intval($dynamic_num);
- $this->output_type = $output_type;
-
// try to force unlimited script runtime
@set_time_limit(0);
- //
- $stmt=DBConnection::getInstance()->prepare("SELECT r.rev_id, r.rev_version,
r.rev_usrid, r.rev_datetime, r.rev_date, r.rev_time, r.rev_language FROM data_ d JOIN
data_revision r ON r.data_id = d.data_id WHERE data_name = :name AND data_type =
'page' AND r.rev_version > 0 AND (r.rev_language = :lang_one OR r.rev_language
= :lang_two) ORDER BY r.rev_version DESC LIMIT 2");
- $stmt->bindParam('name',$this->page_name,PDO::PARAM_STR);
- $stmt->bindParam('lang_one',$this->lang,PDO::PARAM_STR);
- $stmt->bindParam('lang_two',$roscms_standard_language,PDO::PARAM_STR);
- $stmt->execute();
- $results=$stmt->fetchAll(PDO::FETCH_ASSOC);
- $page = @$results[0];
-
- // try to get the dataset with rev_language == $lang, to boost the translated
content
- if( count($results) == 2 && $page['rev_language'] ==
$roscms_standard_language ) {
- $page = $results[1];
- }
-
- // replace first dynamic and then static tags
- if ($page['rev_id'] > 0) {
-
- // get content and replace with other contents
- $content = Data::getText($page['rev_id'], 'content');
- $content = preg_replace_callback('/(\[#templ_[^][#[:space:]]+\])/',
array($this,'insertTemplate'), $content);
- $content = preg_replace_callback('/(\[#cont_[^][#[:space:]]+\])/',
array($this,'insertContent'), $content);
- $content = preg_replace_callback('/(\[#inc_[^][#[:space:]]+\])/',
array($this,'insertScript'), $content);
- $content = preg_replace_callback('/(\[#link_[^][#[:space:]]+\])/',
array($this,'insertHyperlink'), $content);
-
- // website url
- $content = str_replace('[#roscms_path_homepage]',
$roscms_intern_webserver_pages, $content);
-
- // replace roscms constants dependent from dynamic number
- if ($this->dynamic_num > 0) {
- $content = str_replace('[#roscms_filename]',
$this->page_name.'_'.$this->dynamic_num.'.html', $content);
- $content = str_replace('[#roscms_pagename]',
$this->page_name.'_'.$this->dynamic_num, $content);
- $content = str_replace('[#roscms_pagetitle]',
ucfirst(get_stext($page['rev_id'], 'title')).'
#'.$this->dynamic_num, $content);
- }
- // take care of dynamic number independent entries
- else {
- $content = str_replace('[#roscms_filename]',
$this->page_name.'.html', $content);
- $content = str_replace('[#roscms_pagename]', $this->page_name,
$content);
- $content = str_replace('[#roscms_pagetitle]',
ucfirst(Data::getSText($page['rev_id'], 'title')), $content);
- }
-
- // replace current language stuff
- $stmt=DBConnection::getInstance()->prepare("SELECT lang_name FROM
languages WHERE lang_id = :lang LIMIT 1");
- $stmt->bindParam('lang',$this->lang);
- $stmt->execute();
- $content = str_replace('[#roscms_language]', $stmt->fetchColumn(),
$content);
- $content = str_replace('[#roscms_language_short]', $this->lang,
$content);
-
- // @REMOVEME if it is no more present in Database
- $content = str_replace('[#roscms_format]', 'html', $content);
-
- // replace date and time
- $content = str_replace('[#roscms_date]', date('Y-m-d'),
$content);
- $localtime = localtime(time() , 1);
- $content = str_replace('[#roscms_time]', sprintf('%02d:%02d',
$localtime['tm_hour'],$localtime['tm_min']), $content);
-
- // replace with user_name
- // @FIXME broken logic, or one link too much, which should be removed from
Database
- $stmt=DBConnection::getInstance()->prepare("SELECT user_name FROM users
WHERE user_id = :user_id LIMIT 1");
- $stmt->bindParam('user_id',$roscms_intern_account_id);
- $stmt->execute();
- $user_name = $stmt->fetchColumn();
- $content = str_replace('[#roscms_user]', $user_name, $content); //
account that generate
- $content = str_replace("[#roscms_inc_author]", $user_name, $content);
// account that changed the include text
-
- // page version
- $content = str_replace('[#roscms_page_version]',
$page['rev_version'], $content);
-
- // page edit link
- $content = str_replace('[#roscms_page_edit]',
$roscms_intern_webserver_roscms.'?page=data_out&d_f=page&d_u=show&d_val='.$this->page_name.'&d_val2='.$this->lang.'&d_val3='.$this->dynamic_num.'&d_val4=edit',
$content);
-
- // translation info
- if ($this->lang == $roscms_standard_language) {
- $content = str_replace('[#roscms_trans]', '<p><a
href="'.$roscms_intern_webserver_roscms.'?page=data_out&d_f=page&d_u=show&d_val='.$this->page_name.'&d_val2='.$this->lang.'&d_val3='.$this->dynamic_num.'&d_val4=edit"
style="font-size:10px !important;">Edit page content</a> (RosCMS
translator account membership required, visit the <a
href="'.$roscms_intern_webserver_pages.'forum/"
style="font-size:10px !important;">website forum</a> for
help)</p><br />', $content);
- }
- else {
- $content = str_replace('[#roscms_trans]', '<p><em>If
the translation of the <a
href="'.$roscms_intern_webserver_pages.'?page='.$this->page_name.'&lang='.$roscms_standard_language.'"
style="font-size:10px !important;">'.$roscms_standard_language_full.'
language</a> of this page appears to be outdated or incorrect, please check-out the
<a
href="'.$roscms_intern_webserver_pages.'?page='.$this->page_name.'&lang='.$roscms_standard_language.'"
style="font-size:10px
!important;">'.$roscms_standard_language_full.'</a> page and <a
href="'.$roscms_intern_webserver_pages.'forum/viewforum.php?f=18"
style="font-size:10px !important;">report</a> or <a
href="'.$roscms_intern_webserver_roscms.'?page=data_out&d_f=page&d_u=show&d_val='.$this->page_name.'&d_val2='.$this->lang.'&d_val3='.$this->dynamic_num.'&d_val4=edit"
style="font-size:10px !important;">update the
content</a>.</em></p><br />', $content);
- }
-
- return $content;
- }
+ $stmt=DBConnection::getInstance()->prepare("SELECT d.data_name, d.data_id,
r.rev_id, r.rev_version, r.rev_usrid, r.rev_datetime, r.rev_date, r.rev_time,
r.rev_language FROM data_ d JOIN data_revision r ON r.data_id = d.data_id WHERE r.rev_id =
:rev_id ORDER BY r.rev_version DESC LIMIT 2");
+ $stmt->bindParam('rev_id',$rev_id,PDO::PARAM_INT);
+ $stmt->execute();
+ $page=$stmt->fetch(PDO::FETCH_ASSOC);
+
+ if ($page['rev_id'] === false) {
+ return; // nothing found
+ }
+
+ $this->page_name = $page['data_name'];
+ $this->lang = $page['rev_language'];
+ $this->dynamic_num = Tag::getValueByUser($page['data_id'],
$page['rev_id'], 'number', -1);
+ $this->output_type = $output_type;
+ // replace dynamic tags first and then static
+
+ // get content and replace with other contents
+ $content = Data::getText($page['rev_id'], 'content');
+ $content = preg_replace_callback('/(\[#templ_[^][#[:space:]]+\])/',
array($this,'insertTemplate'), $content);
+ $content = preg_replace_callback('/(\[#cont_[^][#[:space:]]+\])/',
array($this,'insertContent'), $content);
+ $content = preg_replace_callback('/(\[#inc_[^][#[:space:]]+\])/',
array($this,'insertScript'), $content);
+ $content = preg_replace_callback('/(\[#link_[^][#[:space:]]+\])/',
array($this,'insertHyperlink'), $content);
+
+ // website url
+ $content = str_replace('[#roscms_path_homepage]',
$roscms_intern_webserver_pages, $content);
+
+ // replace roscms constants dependent from dynamic number
+ if ($this->dynamic_num > 0) {
+ $content = str_replace('[#roscms_filename]',
$this->page_name.'_'.$this->dynamic_num.'.html', $content);
+ $content = str_replace('[#roscms_pagename]',
$this->page_name.'_'.$this->dynamic_num, $content);
+ $content = str_replace('[#roscms_pagetitle]',
ucfirst(Data::getSText($page['rev_id'], 'title')).'
#'.$this->dynamic_num, $content);
+ }
+ // take care of dynamic number independent entries
+ else {
+ $content = str_replace('[#roscms_filename]',
$this->page_name.'.html', $content);
+ $content = str_replace('[#roscms_pagename]', $this->page_name,
$content);
+ $content = str_replace('[#roscms_pagetitle]',
ucfirst(Data::getSText($page['rev_id'], 'title')), $content);
+ }
+
+ // replace current language stuff
+ $stmt=DBConnection::getInstance()->prepare("SELECT lang_name FROM languages
WHERE lang_id = :lang LIMIT 1");
+ $stmt->bindParam('lang',$this->lang);
+ $stmt->execute();
+ $content = str_replace('[#roscms_language]', $stmt->fetchColumn(),
$content);
+ $content = str_replace('[#roscms_language_short]', $this->lang, $content);
+
+ // @REMOVEME if it is no more present in Database
+ $content = str_replace('[#roscms_format]', 'html', $content);
+
+ // replace date and time
+ $content = str_replace('[#roscms_date]', date('Y-m-d'), $content);
+ $localtime = localtime(time() , 1);
+ $content = str_replace('[#roscms_time]', sprintf('%02d:%02d',
$localtime['tm_hour'],$localtime['tm_min']), $content);
+
+ // replace with user_name
+ // @FIXME broken logic, or one link too much, which should be removed from Database
+ $stmt=DBConnection::getInstance()->prepare("SELECT user_name FROM users WHERE
user_id = :user_id LIMIT 1");
+ $stmt->bindParam('user_id',$roscms_intern_account_id);
+ $stmt->execute();
+ $user_name = $stmt->fetchColumn();
+ $content = str_replace('[#roscms_user]', $user_name, $content); // account
that generate
+ $content = str_replace("[#roscms_inc_author]", $user_name, $content); //
account that changed the include text
+
+ // page version
+ $content = str_replace('[#roscms_page_version]',
$page['rev_version'], $content);
+
+ // page edit link
+ $content = str_replace('[#roscms_page_edit]',
$roscms_intern_webserver_roscms.'?page=data_out&d_f=page&d_u=show&d_val='.$this->page_name.'&d_val2='.$this->lang.'&d_val3='.$this->dynamic_num.'&d_val4=edit',
$content);
+
+ // translation info
+ if ($this->lang == $roscms_standard_language) {
+ $content = str_replace('[#roscms_trans]', '<p><a
href="'.$roscms_intern_webserver_roscms.'?page=data_out&d_f=page&d_u=show&d_val='.$this->page_name.'&d_val2='.$this->lang.'&d_val3='.$this->dynamic_num.'&d_val4=edit"
style="font-size:10px !important;">Edit page content</a> (RosCMS
translator account membership required, visit the <a
href="'.$roscms_intern_webserver_pages.'forum/"
style="font-size:10px !important;">website forum</a> for
help)</p><br />', $content);
+ }
+ else {
+ $content = str_replace('[#roscms_trans]', '<p><em>If the
translation of the <a
href="'.$roscms_intern_webserver_pages.'?page='.$this->page_name.'&lang='.$roscms_standard_language.'"
style="font-size:10px !important;">'.$roscms_standard_language_full.'
language</a> of this page appears to be outdated or incorrect, please check-out the
<a
href="'.$roscms_intern_webserver_pages.'?page='.$this->page_name.'&lang='.$roscms_standard_language.'"
style="font-size:10px
!important;">'.$roscms_standard_language_full.'</a> page and <a
href="'.$roscms_intern_webserver_pages.'forum/viewforum.php?f=18"
style="font-size:10px !important;">report</a> or <a
href="'.$roscms_intern_webserver_roscms.'?page=data_out&d_f=page&d_u=show&d_val='.$this->page_name.'&d_val2='.$this->lang.'&d_val3='.$this->dynamic_num.'&d_val4=edit"
style="font-size:10px !important;">update the
content</a>.</em></p><br />', $content);
+ }
+
+ return $content;
} // end of member function generate_content
Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/Export_Page.class.php
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
==============================================================================
---
branches/danny-web/reactos.org/htdocs/roscms/lib/Export_Page.class.php [iso-8859-1]
(original)
+++
branches/danny-web/reactos.org/htdocs/roscms/lib/Export_Page.class.php [iso-8859-1]
Wed Nov 19 07:07:44 2008
@@ -51,10 +51,12 @@
*/
public function page( )
{
- parent::__construct();
+ global $RosCMS_GET_d_value, $RosCMS_GET_d_value2,$RosCMS_GET_d_value3;
+ global $RosCMS_GET_d_r_lang;
+ global $roscms_standard_language;
- $export_html = new Export_HTML();
-
+ $dynamic_num = $RosCMS_GET_d_value3;
+
switch (@$_GET['d_u']) {
case 'output':
// @TODO
@@ -63,7 +65,7 @@
case 'show':
default:
if (empty($_GET['d_r_id']) || strpos($_GET['d_r_id'],
'tr') >= 0) {
- // translation mode (contains "tr")
+ // translation mode (contains "tr")
$RosCMS_GET_d_value2 = $RosCMS_GET_d_r_lang;
}
@@ -71,11 +73,11 @@
$RosCMS_GET_d_value = str_replace('tr', '',
$RosCMS_GET_d_value);
if ( is_numeric($RosCMS_GET_d_value) ) {
- $stmt=DBConnection::getInstance()->prepare("SELECT d.data_name,
r.rev_id, d.data_id, r.rev_language FROM data_ d, data_revision r WHERE r.data_id =
d.data_id AND r.rev_id = ".DBConnection::getInstance()->quote()." ORDER BY
r.rev_version DESC LIMIT 1");
+ $stmt=DBConnection::getInstance()->prepare("SELECT d.data_name,
r.rev_id, d.data_id, r.rev_language FROM data_ d, data_revision r WHERE r.data_id =
d.data_id AND r.rev_id = :rev_id ORDER BY r.rev_version DESC LIMIT 1");
$stmt->bindParam('rev_id',$RosCMS_GET_d_value,PDO::PARAM_INT);
}
else {
- $stmt=DBConnection::getInstance()->prepare("SELECT d.data_name, r.rev_id,
d.data_id, r.rev_language FROM data_ d, data_revision r WHERE r.data_id = d.data_id AND
d.data_name = :data_name AND (r.rev_language = lang_one OR r.rev_language = :lang_two)
ORDER BY r.rev_version DESC LIMIT 1");
+ $stmt=DBConnection::getInstance()->prepare("SELECT d.data_name,
r.rev_id, d.data_id, r.rev_language FROM data_ d JOIN data_revision r ON r.data_id =
d.data_id WHERE d.data_name = :data_name AND (r.rev_language = lang_one OR r.rev_language
= :lang_two) ORDER BY r.rev_version DESC LIMIT 1");
$stmt->bindParam('data_name',$RosCMS_GET_d_value,PDO::PARAM_STR);
$stmt->bindParam('lang_one',$RosCMS_GET_d_value2,PDO::PARAM_STR);
$stmt->bindParam('lang_two',$roscms_standard_language,PDO::PARAM_STR);
@@ -83,14 +85,14 @@
$stmt->execute();
$revision = $stmt->fetchOnce();
- if ($RosCMS_GET_d_value3 == '') {
- $tmp_nbr = Tag::getValue($revision['data_id'],
$revision['rev_id'], 'number');
+ if ($dynamic_num == '') {
+ $dynamic_num = Tag::getValueByUser($revision['data_id'],
$revision['rev_id'], 'number', -1);
}
- else {
- $tmp_nbr = $RosCMS_GET_d_value3;
- }
- Log::writeGenerateLow('preview page: generate_page('.$tmp_name.',
'.$tmp_lang.', '.$tmp_nbr.', '.$_GET['d_u'].')');
- echo $export_html->processTextByName($revision['data_name'],
$RosCMS_GET_d_value2, $tmp_nbr, $_GET['d_u']);
+
+ Log::writeGenerateLow('preview page:
generate_page('.$revision['data_name'].',
'.$revision['rev_language'].', '.$dynamic_num.',
'.$_GET['d_u'].')');
+
+ $export_html = new Export_HTML();
+ echo $export_html->processText($revision['rev_id'],
$_GET['d_u']);
break;
}
}
Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/Export_QuickInfo.class.php
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
==============================================================================
---
branches/danny-web/reactos.org/htdocs/roscms/lib/Export_QuickInfo.class.php
[iso-8859-1] (original)
+++
branches/danny-web/reactos.org/htdocs/roscms/lib/Export_QuickInfo.class.php
[iso-8859-1] Wed Nov 19 07:07:44 2008
@@ -26,7 +26,9 @@
{
- public function __construct(){
+ public function __construct()
+ {
+ parent::__construct();
// check if everything was given, we need to get the quick info
if (!isset($_GET['d_id']) || !isset($_GET['d_r_id'])) {
Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/HTML_User_ProfileEdit.clas…
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
==============================================================================
---
branches/danny-web/reactos.org/htdocs/roscms/lib/HTML_User_ProfileEdit.clas…
[iso-8859-1] (original)
+++
branches/danny-web/reactos.org/htdocs/roscms/lib/HTML_User_ProfileEdit.clas…
[iso-8859-1] Wed Nov 19 07:07:44 2008
@@ -53,6 +53,7 @@
global $rdf_name;
global $rdf_register_user_pwd_min;
global $rdf_register_user_pwd_max;
+ global $rdf_register_user_name_max;
global $roscms_intern_webserver_pages;
$activation_code = $rdf_uri_3;
@@ -237,8 +238,7 @@
<br />
<span style="color:#817A71;">You cannot change your
username.</span>
</div>
-v>
-
+
<div class="login-form">
<label for="userpwd3"'.((isset($_POST['registerpost'])
&& isset($_POST['userpwd3']) && $_POST['userpwd3'] !=
'') ? ' style="color:red;"' : '').'>Current
Password *</label>
<input name="userpwd3" type="password"
class="input" tabindex="1" id="userpwd3" size="50"
maxlength="50" />