Author: dgoette
Date: Sun Nov 23 08:54:05 2008
New Revision: 37591
URL:
http://svn.reactos.org/svn/reactos?rev=37591&view=rev
Log:
* fix bug in language detection
* let the user decide which language he want to set instead of preselecting by browser
preferences
* minor fixes
* fix the famous metadata bug
Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/CMSWebsiteSaveEntry.class.…
branches/danny-web/reactos.org/htdocs/roscms/lib/Editor_Website.class.php
branches/danny-web/reactos.org/htdocs/roscms/lib/HTML_User_ProfileEdit.clas…
branches/danny-web/reactos.org/htdocs/roscms/lib/Language.class.php
branches/danny-web/reactos.org/htdocs/roscms/lib/Subsystem_Bugzilla.class.p…
Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/CMSWebsiteSaveEntry.class.…
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
==============================================================================
---
branches/danny-web/reactos.org/htdocs/roscms/lib/CMSWebsiteSaveEntry.class.…
[iso-8859-1] (original)
+++
branches/danny-web/reactos.org/htdocs/roscms/lib/CMSWebsiteSaveEntry.class.…
[iso-8859-1] Sun Nov 23 08:54:05 2008
@@ -98,6 +98,19 @@
$stmt->execute();
$rev_id = $stmt->fetchColumn();
+ // get stable entry
+ $stmt=DBConnection::getInstance()->prepare("SELECT r.rev_id, r.data_id FROM
data_tag a JOIN data_revision r ON (r.data_id = a.data_id AND r.rev_id = a.data_rev_id)
JOIN data_tag_name n ON a.tag_name_id = n.tn_id JOIN data_tag_value v ON a.tag_value_id =
v.tv_id WHERE r.data_id = :data_id AND r.rev_language = :lang AND r.rev_id = a.data_rev_id
AND a.tag_usrid = '-1' AND n.tn_name = 'status' AND v.tv_value =
'stable' ORDER BY r.rev_id DESC LIMIT 1");
+ $stmt->bindParam('data_id',$_GET['d_id'],PDO::PARAM_INT);
+ $stmt->bindParam('lang',$_GET['d_r_lang'],PDO::PARAM_STR);
+ $stmt->execute();
+ $stable = $stmt->fetchOnce(PDO::FETCH_ASSOC);
+ if ($stable !== false) {
+
+ // transfer from stable entry
+ Tag::copyFromData($stable['data_id'], $stable['rev_id'],
$_GET['d_id'], $rev_id, false);
+ Tag::deleteByName($_GET['d_id'], $rev_id, 'status', -1);
+ }
+
// tag the revision as new or draft
if ($type == 'submit') {
Tag::add($_GET['d_id'], $rev_id, 'status', 'new', -1);
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]
Sun Nov 23 08:54:05 2008
@@ -221,7 +221,7 @@
if (Data::copy($revision['data_id'], $revision['rev_id'], 1 /*
copy mode */, $RosCMS_GET_d_r_lang)) {
$stmt=DBConnection::getInstance()->prepare("SELECT data_id, rev_id,
rev_language FROM data_revision WHERE data_id = :data_id AND rev_usrid = :user_id AND
rev_version = 0 AND rev_language = :lang AND rev_date = :date ORDER BY rev_id DESC LIMIT
1");
$stmt->bindParam('data_id',$revision['data_id'],PDO::PARAM_STR);
- $stmt->bindParam('user_id',$thisuser->id(),PDO::PARAM_INT);
+
$stmt->bindParam('user_id',ThisUser::getInstance()->id(),PDO::PARAM_INT);
$stmt->bindParam('lang',$_GET['d_r_lang'],PDO::PARAM_STR);
$stmt->bindParam('date',date('Y-m-d'),PDO::PARAM_STR);
$stmt->execute();
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] Sun Nov 23 08:54:05 2008
@@ -87,7 +87,7 @@
<div class="corner4">
<div style="text-align:center; padding: 4px;
">');
- $stmt=DBConnection::getInstance()->prepare("SELECT user_id, user_name,
user_fullname, user_email, user_email_activation, user_website, user_country,
user_timezone, user_occupation, user_setting_multisession, user_setting_browseragent,
user_setting_ipaddress, user_setting_timeout FROM users WHERE user_id = :user_id LIMIT
1");
+ $stmt=DBConnection::getInstance()->prepare("SELECT user_id, user_name,
user_fullname, user_email, user_email_activation, user_website, user_country,
user_language, user_timezone, user_occupation, user_setting_multisession,
user_setting_browseragent, user_setting_ipaddress, user_setting_timeout FROM users WHERE
user_id = :user_id LIMIT 1");
$stmt->bindParam('user_id',ThisUser::getInstance()->id(),PDO::PARAM_INT);
$stmt->execute();
$profile = $stmt->fetchOnce();
@@ -137,9 +137,6 @@
if (($activation_code == '' || strlen($activation_code) <= 6) &&
isset($_POST['registerpost']) && ($safepwd === true || $safepwd ===
'') && (isset($_POST['userpwd1']) &&
($_POST['userpwd1'] == "" || (strlen($_POST['userpwd1']) >=
$rdf_register_user_pwd_min && strlen($_POST['userpwd1']) <
$rdf_register_user_pwd_max))) && isset($_POST['useremail']) &&
EMail::isValid($_POST['useremail']) && !$existemail) {
- // user language (browser settings)
- $userlang = Language::checkStatic($_SERVER["HTTP_ACCEPT_LANGUAGE"]);
-
// email address activation code
$s = '';
for ($n=0; $n<20; $n++) {
@@ -173,7 +170,7 @@
$stmt=DBConnection::getInstance()->prepare("UPDATE users SET
user_timestamp_touch2 = NOW( ) , user_fullname = :fullname, user_website = :website,
user_language = :language, user_country = :country, user_timezone = :timezone,
user_occupation = :occupation, user_setting_multisession = :setting_multisession,
user_setting_browseragent = :setting_browser, user_setting_ipaddress = :setting_ip,
user_setting_timeout = :setting_timeout WHERE user_id = :user_id LIMIT 1");
$stmt->bindParam('fullname',htmlspecialchars($_POST['userfullname']),PDO::PARAM_STR);
$stmt->bindParam('website',$_POST['userwebsite'],PDO::PARAM_STR);
- $stmt->bindParam('language',$userlang,PDO::PARAM_STR);
+
$stmt->bindParam('language',Language::checkStatic($_POST['language']),PDO::PARAM_STR);
$stmt->bindParam('country',$_POST['country'],PDO::PARAM_STR);
$stmt->bindParam('timezone',$_POST['tzone'],PDO::PARAM_STR);
$stmt->bindParam('occupation',$_POST['useroccupation'],PDO::PARAM_STR);
@@ -286,6 +283,27 @@
<div class="login-form">
<label for="userfullname">First and Last Name *</label>
<input name="userfullname" type="text"
class="input" tabindex="5" id="userfullname"
value="'.(isset($_POST['userfullname']) ? $_POST['userfullname']
: $profile['user_fullname']).'" size="50"
maxlength="50" />
+ </div>
+
+ <div class="login-form">
+ <label for="language"'.(isset($_POST['registerpost'])
&& $_POST['language'] == '' ? '
style="color:red;"' : '').'>Language</label>
+ <select id="language" name="language"
tabindex="6">
+ <option value="">Select One</option>');
+
+ $stmt=DBConnection::getInstance()->prepare("SELECT lang_id, lang_name,
lang_name_org FROM languages ORDER BY lang_name ASC");
+ $stmt->execute();
+ while ($language = $stmt->fetch(PDO::FETCH_ASSOC)) {
+ echo '<option
value="'.$language['lang_id'].'"';
+
+ if ((isset($_POST['language']) && $_POST['language'] ==
$country['lang_id']) || (empty($_POST['language']) &&
$language['lang_id'] == $profile['user_language'])) {
+ echo ' selected="selected"';
+ }
+
+ echo '>'.$language['lang_name'].'
('.$language['lang_name_org'].')</option>';
+ }
+
+ echo_strip('
+ </select>
</div>
<div class="login-form">
Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/Language.class.php
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
==============================================================================
---
branches/danny-web/reactos.org/htdocs/roscms/lib/Language.class.php [iso-8859-1]
(original)
+++
branches/danny-web/reactos.org/htdocs/roscms/lib/Language.class.php [iso-8859-1] Sun
Nov 23 08:54:05 2008
@@ -25,8 +25,6 @@
public static function checkStatic( $lang_code )
{
global $roscms_standard_language;
-
- $lang_code = substr($lang_code, 0, 2);
switch ($lang_code) {
case 'ar':
@@ -58,7 +56,7 @@
case 'uk':
case 'vi':
case 'zh':
- $ret = $lang_code;
+ return $lang_code;
break;
case '*':
default:
Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/Subsystem_Bugzilla.class.p…
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
==============================================================================
---
branches/danny-web/reactos.org/htdocs/roscms/lib/Subsystem_Bugzilla.class.p…
[iso-8859-1] (original)
+++
branches/danny-web/reactos.org/htdocs/roscms/lib/Subsystem_Bugzilla.class.p…
[iso-8859-1] Sun Nov 23 08:54:05 2008
@@ -171,7 +171,7 @@
}
}
- foreach ($global_events as $event) {
+ foreach ($this->global_events as $event) {
$stmt=DBConnection::getInstance()->prepare("INSERT INTO
".self::DB_NAME.".email_setting (user_id, relationship, event) VALUES
(LAST_INSERT_ID(), :relation, :event)");
$stmt->bindValue('relation',self::REL_ANY,PDO::PARAM_INT);
$stmt->bindParam('event',$event,PDO::PARAM_INT);