Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24017
Modified Files:
Tag: branch-smarty
NEWS serendipity_functions.inc.php serendipity_lang.inc.php
Log Message:
MFH
Index: NEWS
===================================================================
RCS file: /cvsroot/php-blog/serendipity/NEWS,v
retrieving revision 1.214.2.1
retrieving revision 1.214.2.2
diff -u -d -r1.214.2.1 -r1.214.2.2
--- NEWS 9 Sep 2004 15:14:59 -0000 1.214.2.1
+++ NEWS 14 Sep 2004 10:30:07 -0000 1.214.2.2
@@ -8,6 +8,8 @@
Version 0.7 ()
------------------------------------------------------------------------
+ * Added Norwegian translations, thanks to Jo Christian
+
* Fixed postgresql bug for viewing comment moderation panel
(garvinhicking)
Index: serendipity_lang.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_lang.inc.php,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -u -d -r1.16 -r1.16.2.1
--- serendipity_lang.inc.php 3 Aug 2004 10:38:44 -0000 1.16
+++ serendipity_lang.inc.php 14 Sep 2004 10:30:07 -0000 1.16.2.1
@@ -1,6 +1,6 @@
<?php # $Id$
-if (!defined('LANGUAGE_LIST')) define('LANGUAGE_LIST', 'en=>English,de=>German,da=>Danish,es=>Spanish,fr=>French,cs=>Czech (Win-1250),cz=>Czech (ISO-8859-2),nl=>Dutch,pt=>Portuguese Brazilian,bg=>Bulgarian');
+if (!defined('LANGUAGE_LIST')) define('LANGUAGE_LIST', 'en=>English,de=>German,da=>Danish,es=>Spanish,fr=>French,cs=>Czech (Win-1250),cz=>Czech (ISO-8859-2),nl=>Dutch,pt=>Portuguese Brazilian,bg=>Bulgarian,no=>Norwegian');
if (!defined('serendipity_LANG_LOADED') || serendipity_LANG_LOADED !== true) {
// Try and include preferred language from the configurated setting
@@ -11,7 +11,7 @@
// If no config file is loaded, language includes are not available.
// Now include one. Try to auto-guess the language by looking up the HTTP_ACCEPT_LANGUAGE.
$serendipty['autolang'] = 'en';
- $supported_languages = array('en', 'da', 'de', 'es', 'cs', 'cz', 'fr', 'nl', 'pt', 'bg');
+ $supported_languages = array('en', 'da', 'de', 'es', 'cs', 'cz', 'fr', 'nl', 'pt', 'bg', 'no');
$possible_languages = explode(',', (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : ''));
if (is_array($possible_languages)) {
foreach($possible_languages as $index => $lang) {
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.419.2.11
retrieving revision 1.419.2.12
diff -u -d -r1.419.2.11 -r1.419.2.12
--- serendipity_functions.inc.php 10 Sep 2004 22:20:24 -0000 1.419.2.11
+++ serendipity_functions.inc.php 14 Sep 2004 10:30:07 -0000 1.419.2.12
@@ -504,7 +504,7 @@
function serendipity_fetchCategoryRange($categoryid) {
global $serendipity;
- $res = serendipity_db_query("SELECT category_left, category_right FROM {$serendipity['dbPrefix']}category WHERE categoryid='{$categoryid}'");
+ $res = serendipity_db_query("SELECT category_left, category_right FROM {$serendipity['dbPrefix']}category WHERE categoryid='". (int)$categoryid ."'");
return array('category_left' => $res[0]['category_left'], 'category_right' => $res[0]['category_right']);
}
@@ -838,7 +838,7 @@
global $serendipity;
$right = $left + 1;
- $result = serendipity_db_query("SELECT categoryid FROM {$serendipity['dbPrefix']}category WHERE parentid='" . $parent . "'");
+ $result = serendipity_db_query("SELECT categoryid FROM {$serendipity['dbPrefix']}category WHERE parentid='" . (int)$parent . "'");
if ( is_array($result) ) {
foreach ( $result as $category ) {
$right = serendipity_rebuildCategoryTree($category['categoryid'], $right);
@@ -856,7 +856,7 @@
$where = '';
if (!empty($user)) {
- $where = 'WHERE authorid = ' . serendipity_db_escape_string($user);
+ $where = "WHERE authorid = '" . (int)$user ."'";
}
$querystring = "SELECT * FROM {$serendipity['dbPrefix']}authors $where ORDER BY username ASC";
@@ -1274,14 +1274,14 @@
if ($_SESSION['serendipityAuthedUser'] === true) {
$admin = '';
if ($_SESSION['serendipityUserlevel'] < USERLEVEL_CHIEF) {
- $admin = ' AND authorid = ' . $_SESSION['serendipityAuthorid'];
+ $admin = " AND authorid = " . (int)$_SESSION['serendipityAuthorid'] ."'";
}
- $query = "DELETE FROM {$serendipity['dbPrefix']}comments WHERE entry_id = $entry_id AND id = $id $admin";
+ $query = "DELETE FROM {$serendipity['dbPrefix']}comments WHERE entry_id = '". (int)$entry_id ."' AND id = '". (int)$id ."' $admin";
serendipity_db_query($query);
$affected = serendipity_db_affected_rows();
- $query = "UPDATE {$serendipity['dbPrefix']}entries SET $type = $type-1 WHERE id = $entry_id $admin";
+ $query = "UPDATE {$serendipity['dbPrefix']}entries SET $type = $type-1 WHERE id = '". (int)$entry_id ."' $admin";
serendipity_db_query($query);
return $affected;
} else {
@@ -1295,10 +1295,10 @@
if ($_SESSION['serendipityAuthedUser'] === true) {
$admin = '';
if ($_SESSION['serendipityUserlevel'] < USERLEVEL_CHIEF) {
- $admin = ' AND authorid = ' . $_SESSION['serendipityAuthorid'];
+ $admin = " AND authorid = '" . (int)$_SESSION['serendipityAuthorid'] ."'";
}
- $query = "UPDATE {$serendipity['dbPrefix']}entries SET allow_comments = '" . ($switch == 'disable' ? 'false' : 'true') . "' WHERE id = $entry_id $admin";
+ $query = "UPDATE {$serendipity['dbPrefix']}entries SET allow_comments = '" . ($switch == 'disable' ? 'false' : 'true') . "' WHERE id = '". (int)$entry_id ."' $admin";
serendipity_db_query($query);
header('Location: '. $_SERVER['HTTP_REFERER']);
} else {
@@ -1318,7 +1318,7 @@
}
if (!empty($id)) {
- $and .= ' AND co.entry_id=' . $id;
+ $and .= ' AND co.entry_id=' . (int)$id;
}
if (!$showAll) {
@@ -1371,7 +1371,7 @@
$and = "AND status = 'approved'";
}
- $query = "SELECT * FROM {$serendipity['dbPrefix']}comments WHERE entry_id=$id AND type = 'TRACKBACK' $and ORDER BY id";
+ $query = "SELECT * FROM {$serendipity['dbPrefix']}comments WHERE entry_id = '". (int)$id ."' AND type = 'TRACKBACK' $and ORDER BY id";
if (isset($limit)) {
$limit = serendipity_db_limit_sql($limit);
$query .= " $limit";
@@ -1528,7 +1528,7 @@
FROM {$serendipity['dbPrefix']}comments c
LEFT JOIN {$serendipity['dbPrefix']}entries e ON (e.id = c.entry_id)
LEFT JOIN {$serendipity['dbPrefix']}authors a ON (e.authorid = a.authorid)
- WHERE c.id = ". $cid ."
+ WHERE c.id = ". (int)$cid ."
". (($serendipity['serendipityUserlevel'] != USERLEVEL_ADMIN && $force !== true) ? 'AND e.authorid = '. $serendipity['authorId'] : '') ."
". (($force === true) ? "" : "AND status = 'pending'");
$rs = serendipity_db_query($sql, true);
@@ -1551,7 +1551,7 @@
$lm = (int)$rs['entry_last_modified'];
}
- $query = "UPDATE {$serendipity['dbPrefix']}entries SET $field=$field+1, last_modified=". $lm ." WHERE id='$entry_id'";
+ $query = "UPDATE {$serendipity['dbPrefix']}entries SET $field=$field+1, last_modified=". $lm ." WHERE id='". (int)$entry_id ."'";
serendipity_db_query($query);
if ($serendipity['allowSubscriptions']) {
@@ -1563,7 +1563,7 @@
function serendipity_saveComment($id, $commentInfo, $type = 'NORMAL') {
global $serendipity;
- $query = "SELECT allow_comments, moderate_comments, last_modified, timestamp FROM {$serendipity['dbPrefix']}entries WHERE id = '$id'";
+ $query = "SELECT allow_comments, moderate_comments, last_modified, timestamp FROM {$serendipity['dbPrefix']}entries WHERE id = '". (int)$id ."'";
$ca = serendipity_db_query($query, true);
serendipity_plugin_api::hook_event('frontend_saveComment', $ca, $commentInfo);
@@ -1593,7 +1593,7 @@
$query = "SELECT a.email, e.title, a.mail_comments, a.mail_trackbacks, e.moderate_comments
FROM {$serendipity['dbPrefix']}entries e, {$serendipity['dbPrefix']}authors a
- WHERE e.id = '$id'
+ WHERE e.id = '". (int)$id ."'
AND e.authorid = a.authorid";
$row = serendipity_db_query($query, true); // Get info on author/entry
@@ -1631,7 +1631,7 @@
$sql = "SELECT $pgsql_insert author, email, type
FROM {$serendipity['dbPrefix']}comments
- WHERE entry_id = $entry_id
+ WHERE entry_id = ". (int)$entry_id ."
AND email <> '$posterMail'
AND subscribed = 'true' $mysql_insert";
$subscribers = serendipity_db_query($sql);
@@ -1650,7 +1650,7 @@
$title,
$poster,
$entryURI,
- $serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . 'unsubscribe/' . urlencode($subscriber['email']) . '/' . $entry_id
+ $serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . 'unsubscribe/' . urlencode($subscriber['email']) . '/' . (int)$entry_id
);
} else {
$text = sprintf(
@@ -1661,7 +1661,7 @@
$title,
$poster,
$entryURI,
- $serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . 'unsubscribe/' . urlencode($subscriber['email']) . '/' . $entry_id
+ $serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . 'unsubscribe/' . urlencode($subscriber['email']) . '/' . (int)$entry_id
);
}
@@ -1673,7 +1673,7 @@
global $serendipity;
$sql = "UPDATE {$serendipity['dbPrefix']}comments
SET subscribed = 'false'
- WHERE entry_id = $entry_id
+ WHERE entry_id = '". (int)$entry_id ."'
AND email = '$email'";
serendipity_db_query($sql);
@@ -1744,7 +1744,7 @@
{
global $serendipity;
- $query = "SELECT name,link FROM {$serendipity['dbPrefix']}references WHERE entry_id='" . serendipity_db_escape_string($id) . "'";
+ $query = "SELECT name,link FROM {$serendipity['dbPrefix']}references WHERE entry_id='" . (int)$id . "'";
return serendipity_db_query($query);
}
@@ -1823,7 +1823,7 @@
// extract author information
if (empty($entry['email'])) {
- $query = "select email from {$serendipity['dbPrefix']}authors where username='{$entry['username']}'";
+ $query = "select email from {$serendipity['dbPrefix']}authors where username='". serendipity_db_escape_string($entry['username']) ."'";
$results = serendipity_db_query($query);
$entry['email'] = $results[0]['email'];
}
@@ -2280,7 +2280,7 @@
function serendipity_archiveURL($id, $title, $key = 'baseURL', $checkrewrite = true) {
global $serendipity;
- return $serendipity[$key] . ($checkrewrite && $serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . PATH_ARCHIVES . '/' . $id . '-' . serendipity_makeFilename($title) . '.html';
+ return $serendipity[$key] . ($checkrewrite && $serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . PATH_ARCHIVES . '/' . (int)$id . '-' . serendipity_makeFilename($title) . '.html';
}
/**
@@ -2321,7 +2321,7 @@
}
$query = "SELECT COUNT(id) FROM {$serendipity['dbPrefix']}references WHERE ";
- $query .= "entry_id=$tmpid AND link='" . serendipity_db_escape_string($locations[$i]) . "'";
+ $query .= "entry_id=". (int)$tmpid ." AND link='" . serendipity_db_escape_string($locations[$i]) . "'";
$row = serendipity_db_query($query, true, 'num');
if ($row[0] > 0) {
@@ -2478,7 +2478,7 @@
}
// Purge the daily/monthly entries so they can be rebuilt
- $result = serendipity_db_query("SELECT timestamp, authorid FROM {$serendipity['dbPrefix']}entries WHERE id=$id", true);
+ $result = serendipity_db_query("SELECT timestamp, authorid FROM {$serendipity['dbPrefix']}entries WHERE id=". (int)$id, true);
if ($serendipity['serendipityUserlevel'] < USERLEVEL_CHIEF && $result[1] != $serendipity['authorid']) {
// Only admins and chief users can delete entries which do not belong to the author
@@ -3070,7 +3070,7 @@
$url_parts['port'],
$url_parts['path'],
$url_parts['query'],
- ($entry_id != 0) ? "AND entry_id = '$entry_id'" : ''
+ ($entry_id != 0) ? "AND entry_id = '". (int)$entry_id ."'" : ''
)
);
@@ -3388,7 +3388,7 @@
// Replace default configuration directives with user-relevant data
$rows = serendipity_db_query("SELECT name,value
FROM {$serendipity['dbPrefix']}config
- WHERE authorid = $author");
+ WHERE authorid = '". (int)$author ."'");
} else {
// Only get default variables, user-independent (frontend)
$rows = serendipity_db_query("SELECT name,value
|