diff --git a/css_packed.js b/css_packed.js
deleted file mode 100644
index 5f864a5..0000000
--- a/css_packed.js
+++ /dev/null
@@ -1 +0,0 @@
-var CSS=new Class({local:{self:'CSS',limited:['dpi','border-radius'],_rule:''},options:{rules:{}},xhtml:{_style:null},initialize:function(a){this.local=$merge(this.local,this.options,a,this.xhtml)},destroy:function(){if(this.local._style)this.local._style.destroy()},refresh:function(){var c='';Hash.each(this.local.rules,function(a,b){this.local._rule='';Hash.each(a,this._glue,this);c+=(this.local._rule==''?'':b+'\n{\n'+this.local._rule+'}\n')},this);this.destroy();this.local._style=new Element('style').set('type','text/css').inject(document.head);switch(Browser.Engine.name){case'trident':this.local._style.styleSheet.cssText=c;break;default:this.local._style.set('text',c);break}return this},_glue:function(a,b){if(this[Browser.Engine.name+'_'+b]){var c;if(c=this[Browser.Engine.name+'_'+b](a,b)){this.local._rule+='\t'+c[0]+':'+c[1]+';\n'}}else if(!this.local.limited.contains(b)){this.local._rule+='\t'+b+':'+a+';\n'}},add_prop:function(a,b,c){var d={};d[a]={};d[a][b]=c;return this.add_rules(d)},add_rule:function(a,b){var c={};c[a]=b;return this.add_rules(c)},add_rules:function(a){this.local.rules=$merge(this.local.rules,a);return this},remove_prop:function(a,b){delete this.local.rules[a][b];return this},remove_rule:function(a){delete this.local.rules[a];return this},remove_rules:function(a){if(a){a.each(this.remove_rule,this)}else{this.local.rules={}}return this},check_rule:function(a){return $defined(this.local.rules[a])}});CSS.implement({'trident_opacity':function(a,b){return['filter','alpha(opacity='+(a*100)+')']},'trident_dpi':function(a,b){if($defined(window.screen.deviceXDPI)){return['font-size',((96/window.screen.deviceXDPI)*a).round()+'%']}else{return['font-size',a+'%']}},'gecko_border-radius':function(a,b){return['-moz-'+b,a]},'webkit_border-radius':function(a,b){return['-webkit-'+b,a]}});
\ No newline at end of file
diff --git a/favicon.ico b/favicon.ico
new file mode 100644
index 0000000..4ba452c
Binary files /dev/null and b/favicon.ico differ
diff --git a/favicon.php b/favicon.php
index 17b440b..d7dedf5 100644
--- a/favicon.php
+++ b/favicon.php
@@ -11,7 +11,7 @@
* Distributed under the GPL - see LICENSE
*
*/
-require_once('simplepie/simplepie.inc');
+require_once('simplepie/simplepie.php');
if(file_exists("./cache/" . $_GET[i] . ".spi"))
{
@@ -21,4 +21,3 @@ else
{
header("Location: image/feed-icon.png");
}
-?>
diff --git a/fof-config-sample.php b/fof-config-sample.php
index fe7665b..234cb39 100644
--- a/fof-config-sample.php
+++ b/fof-config-sample.php
@@ -21,6 +21,8 @@ define('FOF_DB_PASS', "password");
define('FOF_DB_DBNAME', "database");
define('FOF_DB_CHARSET', "utf8");
+// URL to Global Auth server
+//define('FOF_GLOBALAUTH_URL', '');
// The rest you should not need to change
@@ -35,7 +37,6 @@ define('FOF_SUBSCRIPTION_TABLE', FOF_DB_PREFIX . "subscription");
define('FOF_TAG_TABLE', FOF_DB_PREFIX . "tag");
define('FOF_USER_TABLE', FOF_DB_PREFIX . "user");
-
// Find ourselves and the cache dir
if (!defined('DIR_SEP')) {
@@ -45,5 +46,3 @@ if (!defined('DIR_SEP')) {
if (!defined('FOF_DIR')) {
define('FOF_DIR', dirname(__FILE__) . DIR_SEP);
}
-
-?>
diff --git a/fof-db.php b/fof-db.php
index 7a86972..b98c923 100644
--- a/fof-db.php
+++ b/fof-db.php
@@ -4,12 +4,10 @@
*
* fof-db.php - (nearly) all of the DB specific code
*
- *
* Copyright (C) 2004-2007 Stephen Minutillo
* steve@minutillo.com - http://minutillo.com/steve/
*
* Distributed under the GPL - see LICENSE
- *
*/
$FOF_FEED_TABLE = FOF_FEED_TABLE;
@@ -60,7 +58,7 @@ function fof_db_query($sql, $live=0)
$result = mysql_query($sql, $fof_connection);
if(is_resource($result)) $num = mysql_num_rows($result);
- if($result) $affected = mysql_affected_rows();
+ if($result) $affected = mysql_affected_rows($fof_connection);
list($usec, $sec) = explode(" ", microtime());
$t2 = (float)$sec + (float)$usec;
@@ -74,8 +72,8 @@ function fof_db_query($sql, $live=0)
}
else
{
- if(mysql_errno())
- fof_die_mysql_error("Cannot run query '$sql': ".mysql_errno().": ".mysql_error());
+ if(mysql_errno($fof_connection))
+ fof_die_mysql_error("Cannot run query '$sql': ".mysql_errno($fof_connection).": ".mysql_error($fof_connection));
return $result;
}
}
@@ -88,8 +86,8 @@ function fof_die_mysql_error($error)
ob_end_clean();
$error .= "\n".$trace;
fof_log($error, 'error');
- $error = "SQL error. Have you run install.php
to create or upgrade your installation?\n$error";
- die(str_replace("\n", "
", $error));
+ $error = "SQL error. Have you run install.php
to create or upgrade your installation?\n
$error
";
+ die($error);
}
function fof_db_get_row($result)
@@ -338,6 +336,8 @@ function fof_db_get_items($user_id = 1, $feed = NULL, $what = "unread",
$user_id = intval($user_id);
$prefs = fof_prefs();
$offset = $prefs['tzoffset'];
+ if ($prefs['dst'])
+ $offset += date('I');
if (!is_null($when) && $when != "")
{
@@ -771,13 +771,33 @@ function fof_db_change_password($username, $password)
fof_safe_query("update $FOF_USER_TABLE set user_password_hash = '%s' where user_name = '%s'", $password_hash, $username);
}
-function fof_db_get_user_id($username)
+function fof_db_get_user($username, $userid = NULL)
{
global $FOF_USER_TABLE;
- $result = fof_safe_query("select user_id from $FOF_USER_TABLE where user_name = '%s'", $username);
+ if ($username === NULL)
+ $result = fof_safe_query("select * from $FOF_USER_TABLE where user_id = %d", $userid);
+ else
+ $result = fof_safe_query("select * from $FOF_USER_TABLE where user_name = '%s'", $username);
$row = mysql_fetch_array($result);
+ return $row;
+}
- return $row['user_id'];
+function fof_update_user($user)
+{
+ global $FOF_USER_TABLE;
+ if (!$user || !$user['user_id'])
+ return;
+ $values = array();
+ $query = "";
+ foreach (array('user_name', 'user_password_hash', 'user_level', 'user_prefs') as $k)
+ {
+ $query .= ($query ? ", " : "") . "`$k`='%s'";
+ $values[] = $user[$k];
+ }
+ $query = "UPDATE $FOF_USER_TABLE SET $query WHERE user_id='%s'";
+ $values[] = $user['user_id'];
+ array_unshift($values, $query);
+ call_user_func_array('fof_safe_query', $values);
}
function fof_db_delete_user($username)
@@ -799,9 +819,18 @@ function fof_db_save_prefs($user_id, $prefs)
fof_safe_query("update $FOF_USER_TABLE set user_prefs = '%s' where user_id = %d", $prefs, $user_id);
}
+function fof_set_current_user($row)
+{
+ global $fof_user_id, $fof_user_name, $fof_user_level;
+ $fof_user_name = $row['user_name'];
+ $fof_user_id = $row['user_id'];
+ $fof_user_level = $row['user_level'];
+ return true;
+}
+
function fof_db_authenticate($user_name, $user_password_hash)
{
- global $FOF_USER_TABLE, $FOF_ITEM_TABLE, $FOF_ITEM_TAG_TABLE, $fof_connection, $fof_user_id, $fof_user_name, $fof_user_level;
+ global $FOF_USER_TABLE, $FOF_ITEM_TABLE, $FOF_ITEM_TAG_TABLE;
$result = fof_safe_query("select * from $FOF_USER_TABLE where user_name = '%s' and user_password_hash = '%s'", $user_name, $user_password_hash);
@@ -810,9 +839,7 @@ function fof_db_authenticate($user_name, $user_password_hash)
$row = mysql_fetch_array($result);
- $fof_user_name = $row['user_name'];
- $fof_user_id = $row['user_id'];
- $fof_user_level = $row['user_level'];
+ fof_set_current_user($row);
return true;
}
@@ -859,7 +886,7 @@ function fof_db_get_top_readers($days, $count = NULL)
join $FOF_SUBSCRIPTION_TABLE s on s.user_id=u.user_id
join $FOF_ITEM_TABLE i on i.feed_id=s.feed_id
join $FOF_TAG_TABLE t on t.tag_name='unread'
- left join $FOF_ITEM_TAG_TABLE ti on ti.tag_id=t.tag_id and ti.item_id=i.item_id
+ left join $FOF_ITEM_TAG_TABLE ti on ti.tag_id=t.tag_id and ti.item_id=i.item_id and ti.user_id=u.user_id
where i.item_published > ".(time()-intval($days*86400))." and ti.tag_id is null
group by u.user_id order by posts desc
".(!is_null($count) ? "limit $count" : ""));
@@ -884,4 +911,58 @@ function fof_db_get_most_popular_feeds($count = NULL)
return $feeds;
}
-?>
+function fof_db_get_feed_single_user($id)
+{
+ global $FOF_SUBSCRIPTION_TABLE;
+ $result = fof_safe_query("SELECT user_id, COUNT(user_id) FROM $FOF_SUBSCRIPTION_TABLE WHERE feed_id=%d GROUP BY feed_id", $id);
+ $row = mysql_fetch_row($result);
+ if (!$row || $row[1] > 1)
+ return NULL;
+ return $row[0];
+}
+
+function fof_cache_fn($key)
+{
+ if (preg_match('/[^a-z0-9_\-]/', $key))
+ $key = 'md5_'.md5($key);
+ return dirname(__FILE__).'/cache/'.$key;
+}
+
+function fof_cache_get($key)
+{
+ $file = fof_cache_fn($key);
+
+ $fp = @fopen($file, "rb");
+ if (!$fp)
+ return NULL;
+
+ $expire = intval(fgets($fp));
+ $value = fread($fp, 1048576);
+ fclose($fp);
+
+ if (time() > $expire)
+ {
+ fof_cache_unset($key);
+ return NULL;
+ }
+
+ return $value;
+}
+
+function fof_cache_set($key, $value, $ttl = 86400)
+{
+ $file = fof_cache_fn($key);
+ if ($fp = fopen($file, "wb"))
+ {
+ fwrite($fp, (time()+$ttl)."\n".$value);
+ fclose($fp);
+ return true;
+ }
+ return false;
+}
+
+function fof_cache_unset($key)
+{
+ $file = fof_cache_fn($key);
+ @unlink($file);
+}
diff --git a/fof-main.php b/fof-main.php
index f4ded74..a390ee1 100644
--- a/fof-main.php
+++ b/fof-main.php
@@ -23,6 +23,8 @@ if ( !file_exists( dirname(__FILE__) . '/fof-config.php') )
require_once("fof-config.php");
require_once("fof-db.php");
require_once("classes/fof-prefs.php");
+#if (file_exists(dirname(__FILE__).'/login-external.php'))
+# require_once(dirname(__FILE__).'/login-external.php');
fof_db_connect();
@@ -44,7 +46,7 @@ if(!$fof_installer)
ob_end_clean();
}
-require_once('simplepie/simplepie.inc');
+require_once('simplepie/simplepie.php');
function fof_set_content_type()
{
@@ -78,19 +80,18 @@ function fof_log($message, $topic="debug")
function require_user()
{
- if(!isset($_COOKIE["user_name"]) || !isset($_COOKIE["user_password_hash"]))
- {
- Header("Location: login.php");
- exit();
- }
-
+ // FIXME Пилять! Да это же по безопасности, как HTTP Basic авторизация! :-(
$user_name = $_COOKIE["user_name"];
$user_password_hash = $_COOKIE["user_password_hash"];
- if(!fof_authenticate($user_name, $user_password_hash))
+ if (!$user_name || !$user_password_hash || !fof_authenticate($user_name, $user_password_hash))
{
- Header("Location: login.php");
- exit();
+ if (function_exists('fof_require_user_hook') &&
+ !fof_require_user_hook())
+ {
+ header("Location: login.php");
+ exit;
+ }
}
}
@@ -110,6 +111,7 @@ function fof_logout()
{
setcookie ( "user_name", "", time() );
setcookie ( "user_password_hash", "", time() );
+ setcookie ( "logged_out", "1", time() + 300 );
}
function fof_current_user()
@@ -629,11 +631,11 @@ function fof_subscribe($user_id, $url, $unread="today")
return 'Subscribed.
';
}
- $rss = fof_parse($url);
+ $rss = fof_parse($url, $user_id);
if (isset($rss->error))
{
- return "Error: " . $rss->error . " try to validate it?
";
+ return "Error: " . $rss->error . "
";
}
else
{
@@ -708,12 +710,28 @@ function fof_mark_item_unread($feed_id, $id, $filtered = array())
fof_db_mark_item_unread($users, $id);
}
-function fof_parse($url)
+function fof_generate_sudo_id()
{
- $p =& FoF_Prefs::instance();
+ global $fof_sudo_id_user;
+ $sudo_id = unpack('H*', urandom(16));
+ $sudo_id = $sudo_id[1];
+ fof_cache_set("sudo-$sudo_id", $fof_sudo_id_user, 30);
+ return "fof_sudo_id=$sudo_id";
+}
+
+function fof_parse($url, $as_user = NULL)
+{
+ $p = FoF_Prefs::instance();
$admin_prefs = $p->admin_prefs;
$pie = new SimplePie();
+ /* Bug 63447 - Allow FoF to securely pass user authorization without verification */
+ if (!is_null($as_user) && strpos($url, "fof_sudo") !== false)
+ {
+ global $fof_sudo_id_user;
+ $fof_sudo_id_user = $as_user;
+ $pie->headers['Cookie'] = new SimplePie_Callback('fof_generate_sudo_id');
+ }
$pie->set_cache_duration($admin_prefs["manualtimeout"] * 60);
$pie->set_favicon_handler("favicon.php");
$pie->set_feed_url($url);
@@ -758,22 +776,25 @@ function rss_feed_title($rss)
return html_entity_decode(strip_tags($rss->get_title()), ENT_QUOTES);
}
-function fof_update_feed($id)
+function fof_update_feed($id, $as_user = NULL)
{
if(!$id) return 0;
+ if($as_user === NULL)
+ $as_user = fof_db_get_feed_single_user($id);
+
$feed = fof_db_get_feed_by_id($id);
$url = $feed['feed_url'];
fof_log("Updating $url");
fof_db_feed_mark_attempted_cache($id);
- $rss = fof_parse($feed['feed_url']);
+ $rss = fof_parse($feed['feed_url'], $as_user);
if ($rss->error())
{
fof_log("feed update failed: " . $rss->error(), "update");
- return array(0, "Error: " . $rss->error() . " try to validate it?");
+ return array(0, "Error: " . $rss->error() . "");
}
$sub = html_entity_decode($rss->subscribe_url(), ENT_QUOTES);
@@ -1082,6 +1103,8 @@ function fof_todays_date()
{
$prefs = fof_prefs();
$offset = $prefs['tzoffset'];
+ if ($prefs['dst'])
+ $offset += date('I');
return gmdate( "Y/m/d", time() + ($offset * 60 * 60) );
}
@@ -1126,5 +1149,3 @@ if(!function_exists('str_ireplace'))
return preg_replace("/".$search."/i", $replace, $subject);
}
}
-
-?>
diff --git a/fof-render.php b/fof-render.php
index ff2aeca..6d48579 100644
--- a/fof-render.php
+++ b/fof-render.php
@@ -61,6 +61,8 @@ function fof_render_item($item)
$prefs = fof_prefs();
$offset = $prefs['tzoffset'];
+ if ($prefs['dst'])
+ $offset += date('I');
$item_published = gmdate("Y-n-d g:ia", $item['item_published'] + $offset*60*60);
$item_cached = gmdate("Y-n-d g:ia", $item['item_cached'] + $offset*60*60);
diff --git a/fof-sudo.php b/fof-sudo.php
new file mode 100644
index 0000000..61093de
--- /dev/null
+++ b/fof-sudo.php
@@ -0,0 +1,26 @@
+ $user['user_name']);
+}
+else
+ $globalauth = array('error' => "FOF_SUDO authorization error: session id $sudo_id is unknown");
+
+print json_encode($globalauth);
diff --git a/login-external.php b/login-external.php
index a905ec4..f471d5f 100644
--- a/login-external.php
+++ b/login-external.php
@@ -1,41 +1,138 @@
1));
+ fof_cache_set("ga-key-$id", $key);
+ // Авторизуй меня, Большая Черепаха!!!
+ header("Location: ${url}ga_id=$id&ga_url=".urlencode($return).($require ? "" : "&ga_check=1"));
+ exit;
+ }
+ throw new Exception(__FUNCTION__.": error getting ${url}ga_id=$id&ga_key=$key: HTTP $r");
}
function fof_tag_subscribe($userid, $url, $tag)
@@ -46,24 +143,16 @@ function fof_tag_subscribe($userid, $url, $tag)
}
/* Добавление фидов для новых юзеров */
-function fof_add_default_feeds_for_external($login, $password)
+function fof_add_default_feeds_for_external($user)
{
- $fof_userid = fof_db_get_user_id($login);
+ $fof_userid = $user['id'];
+ $login = $user['user_name'];
+ $primary = explode('@', $login, 2);
+ $primary = $primary[0];
/* Активность по своим багам */
- fof_tag_subscribe($fof_userid, 'http://'.$login.':'.$password.'@bugs.office.custis.ru/bugs/rss-comments.cgi?ctype=rss&namedcmd=My%20Bugs', 'Me');
+ fof_tag_subscribe($fof_userid, 'http://bugs.office.custis.ru/bugs/rss-comments.cgi?ctype=rss&namedcmd=My%20Bugs&fof_sudo=1', 'Me');
/* Свои коммиты за сегодня */
- if (($extdb = mysql_pconnect(FOF_EXTERN_DB_HOST, FOF_EXTERN_DB_USER, FOF_EXTERN_DB_PASS)) &&
- mysql_select_db(FOF_EXTERN_DB_DBNAME, $extdb))
- {
- mysql_query("SET NAMES ".FOF_DB_CHARSET, $extdb);
- if (($r = mysql_query("SELECT e.address FROM emailin_aliases e, profiles p WHERE p.login_name='".mysql_real_escape_string($login)."' AND e.userid=p.userid AND e.isprimary=1", $extdb)) &&
- ($r = mysql_fetch_row($r)))
- {
- $primary = explode('@', $r[0], 2);
- $primary = preg_quote($primary[0]);
- fof_tag_subscribe($fof_userid, 'http://'.urlencode($primary).':'.urlencode($password).'@viewvc.office.custis.ru/viewvc.py/?view=query&who='.urlencode($primary).'&who_match=exact&querysort=date&date=week&limit_changes=100', 'Me');
- }
- }
+ fof_tag_subscribe($fof_userid, 'http://viewvc.office.custis.ru/viewvc.py/?view=query&who='.urlencode(preg_quote($primary)).'&who_match=exact&querysort=date&date=week&limit_changes=100&fof_sudo=1', 'Me');
/* IT_Crowd: Новости CustisWiki */
fof_tag_subscribe($fof_userid, 'http://wiki.office.custis.ru/wiki/rss/Новости_CustisWiki.rss', 'IT_Crowd');
/* IT_Crowd: Новости TechTools */
@@ -79,5 +168,3 @@ function fof_add_default_feeds_for_external($login, $password)
/* Ещё, наверное, сюда добавится "Блог Медведева" :) */
fof_tag_subscribe($fof_userid, 'http://wiki.office.custis.ru/wiki/index.php?title=%D0%91%D0%BB%D0%BE%D0%B3:%D0%92%D0%BE%D0%BB%D0%BE%D0%B4%D1%8F_%D0%A0%D0%B0%D1%85%D1%82%D0%B5%D0%B5%D0%BD%D0%BA%D0%BE&feed=rss', 'CustIS');
}
-
-?>
diff --git a/login.php b/login.php
index 3deec64..a8953ea 100644
--- a/login.php
+++ b/login.php
@@ -27,18 +27,6 @@ if(isset($_POST["user_name"]) && isset($_POST["user_password"]))
Header("Location: .");
exit();
}
- elseif (!fof_db_get_user_id($_POST['user_name']) &&
- function_exists('fof_authenticate_external') &&
- fof_authenticate_external($_POST['user_name'], $_POST['user_password']))
- {
- fof_db_add_user($_POST['user_name'], $_POST['user_password']);
- if (fof_authenticate($_POST['user_name'], md5($_POST['user_password'] . $_POST['user_name'])))
- {
- fof_add_default_feeds_for_external($_POST['user_name'], $_POST['user_password']);
- Header("Location: .");
- exit();
- }
- }
$failed = true;
}
diff --git a/mediatypechecker.js b/mediatypechecker.js
deleted file mode 100644
index 615f6d3..0000000
--- a/mediatypechecker.js
+++ /dev/null
@@ -1,212 +0,0 @@
-// mediatypechecker.js
-// CSS media types checking/detection script ver. 15-apr-2009 by Marcin Wiazowski (marcinwiazowski AT poczta DOT onet DOT pl)
-// http://cssmedia.pemor.pl/
-//
-// You may freely use this script for any purposes (incl. commercial) or distribute it if only you want.
-//
-// Usage examples:
-// IsMediaType('screen') - check if the current CSS medium is 'screen'
-// IsMediaType('screen, print') - check if the current CSS medium is 'screen' or 'print'
-//
-// This script does NOT disable the Opera's Small-Screen Rendering technology when asking about
-// the 'handheld' media type in the Opera's mobile browsers.
-//
-// Return values:
-// -1 - error (browser too old, IE having 30 or more style sheets)
-// 0 - tested media type(s) not active
-// 1 - tested media type(s) active
-//
-//
-// Tested both with HTML 4.01 Strict and XHTML 1.1 (with an "application/xhtml+xml" MIME type HTTP
-// header for all capable browsers - i.e. for all tested browsers except Internet Explorer and
-// Opera 7.2x):
-//
-// Tested and works (during page loading and when page is loaded) with:
-//
-// Internet Explorer (Trident): 5.01, 5.55, 6.0, 7.0, 8.0
-// Opera (Presto): 7.2, 7.22, 7.23, 7.5, 8.0, 8.5, 8.53, 9.0, 9.23, 9.24, 9.25, 9.26, 9.27, 9.5, 9.51, 9.52, 9.6, 9.61, 9.62, 9.63, 9.64, 10.0 alpha 1
-// Opera Mini (Presto): basic/advanced: 1.2.2960, 1.2.3214, 2.0.4062, 2.0.4509, 3.1.7196, 3.1.10423, advanced: 4.0.9751, 4.0.10406, 4.1.11313, 4.1.11355, 4.2.13212
-// Safari (AppleWebKit): 3.0, 3.0.4, 3.1, 3.1.1, 3.1.2, 3.2, 3.2.1, 4.0 public beta
-// Chrome (AppleWebKit/V8): 0.2.149.30, 0.3.154.9, 0.4.154.33, 1.0.154.36, 1.0.154.53, 2.0.169.1 beta
-// Konqueror (KHTML): 3.5.8, 3.5.9, 4.0.80, 4.1.0, 4.1.1, 4.1.2, 4.1.3, 4.1.80, 4.2.0, 4.2.1, 4.2.2
-// Firefox/IceWeasel (Gecko): 0.8, 0.9, 1.0, 1.0.4, 1.5, 1.5.0.12, 2.0.0.4, 2.0.0.14, 2.0.0.15, 2.0.0.18, 2.0.0.19, 2.0.0.20, 3.0, 3.0.4, 3.0.5, 3.0.8, 3.1 beta 3, 3.2 alpha 1 pre
-// Fennec (Gecko): 1.0 alpha 1
-// Camino (Gecko): 1.6.1, 1.6.5
-// Epiphany (Gecko): 2.14, 2.18, 2.2, 2.22
-// Flock (Gecko): 1.0.9, 1.1, 1.1.2, 1.2.1, 1.2.6, 2.0, 2.0.2
-// Galeon (Gecko): 1.3.20, 2.0.2, 2.0.4, 2.0.5, 2.0.6
-// K-Meleon (Gecko): 0.8, 0.8.2, 0.9, 1.0, 1.0.1, 1.0.2, 1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.1.6, 1.5.0, 1.5.1
-// Kazehakase (Gecko): 0.2.7, 0.4.2, 0.4.3, 0.5.4
-// Mozilla (Gecko): 1.7.8, 1.7.13
-// Netscape Navigator (Gecko): 7.1, 7.2, 8.0.2, 9.0.0.5, 9.0.0.6
-// SeaMonkey/IceApe (Gecko): 1.0.9, 1.1.5, 1.1.8, 1.1.9, 1.1.13, 2.0 alpha 2
-//
-// Tested and does NOT work (neither during page loading nor when page is loaded) with:
-//
-// Internet Explorer (Trident): 4.01-
-// Opera (Presto): 7.11 b-
-// Safari (AppleWebKit): 2.0.4-
-// K-Meleon (Gecko): 0.7 sp 1-
-// Netscape Navigator (Gecko): 7.0-
-
-function IsMediaType(mediatypes) {
-
- function createEl(name)
- {
- var element = null;
- if(document.createElementNS)
- element = document.createElementNS('http://www.w3.org/1999/xhtml', name);
- else
- element = document.createElement(name);
- return element;
- }
-
- function addCSSRule(id, selectorText, declarations, mediatypes)
- {
- // Dodajemy nowy arkusz styli
- var styleElement = createEl('style');
- if(!styleElement)
- return;
- styleElement.id = id;
- styleElement.type = 'text/css';
- styleElement.rel = 'stylesheet';
- if(mediatypes)
- styleElement.media = mediatypes;
- document.getElementsByTagName('head')[0].appendChild(styleElement);
-
- // Najpierw probujemy "appendChild", bo Safari i Konqueror obsluguje takze "document.styleSheets",
- // ale wtedy zle dziala
- var node = null;
- try { // Opera, Safari, Konqueror
- node = document.createTextNode(selectorText+' { '+declarations+' }');
- styleElement.appendChild(node);
-
- // Workaround dla Opery < 7.5
- if((window.opera) && (!window.opera.version)) { // "window.opera.version" wprowadzono w Operze 7.6
- styleElement.removeChild(node);
- styleElement.appendChild(node);
- }
- } catch(err) { // IE, Firefox
- if(node)
- delete node;
- if(document.styleSheets) {
- var styleSheet = document.styleSheets[document.styleSheets.length-1]; // Ostatnio dodany arkusz styli (za pomoca styleElement)
- if(styleSheet)
- if(styleSheet.insertRule)
- styleSheet.insertRule(selectorText+' { '+declarations+' }', styleSheet.cssRules.length);
- else if(styleSheet.addRule)
- styleSheet.addRule(selectorText, declarations);
- }
- }
- }
-
- function removeCSSRule(id)
- {
- var node = document.getElementById(id);
- document.getElementsByTagName('head')[0].removeChild(node);
- delete node;
- }
-
- function updateCSSRulesForKHTML()
- {
-// var ignoreMe = document.documentElement.offsetWidth; // Unstable in Konqueror 4.0.8
- try {
- var linkList = document.getElementsByTagName('link');
- var i;
-
- for(i = 0; i < linkList.length; i++) {
- linkList[i].orig_disabled = linkList[i].disabled;
- linkList[i].disabled = true;
- }
-
- for(i = 0; i < linkList.length; i++)
- linkList[i].disabled = linkList[i].orig_disabled;
- } catch(err) {}
- }
-
- try {
- // KB262161 - dotyczy IE 4.0 .. IE 8.0
- if(document.createStyleSheet) // IE
- if(document.styleSheets.length >= 30)
- return -1;
-
- addCSSRule('mediaInspector_rule1', '#mediaInspector', 'visibility: hidden; color: #000000;');
- addCSSRule('mediaInspector_rule2', '#mediaInspector', 'visibility: hidden; color: #FFFFFF;', mediatypes);
-
- // Element z id=mediaInspector musi byc widoczny (on ani zaden element nadrzedny nie moze
- // miec stylu "display: none" ani nie moze znajdowac sie w sekcji "head"), inaczej ustawianie
- // koloru nie bedzie zgodne ze standardem (i nie bedzie dzialac pod Safari ani Konquerorem);
- // wyjatek czynimy dla Opery < 9.5 ze wzgledu na wystepujacy w niej blad: jesli plik zostal
- // zaladowany przez protokol HTTP (ale nie FILE), to:
- //
- // (1) W Operze < 9.0 w przypadku uzycia podczas ladowania strony (ale nie po jej zaladowaniu)
- // wlasciwosci "currentStyle" na elemencie zawartym w sekcji "body" (ale nie "head"), po
- // odswiezeniu strony (F5) styl dla "body" z pliku CSS jest czasem losowo ignorowany
- // (inny workaround: zadeklarowac styl dla "body" w naglowku pliku HTML w tagu "style")
- // (2) W Operze < 9.5 w przypadku uzycia podczas ladowania strony (ale nie po jej zaladowaniu)
- // wlasciwosci "currentStyle" na elemencie zawartym w sekcji "body" (ale nie "head"), po
- // odswiezeniu strony (F5) styl dla "body" z pliku CSS jest czasem losowo ignorowany,
- // jesli w pliku CSS wystepuje rownoczesnie styl dla "*" (inny workaround: zamiast stylu
- // dla "*" uzywac stylu dla "body *")
- var node = null;
- var place = null;
-
- var buggy_opera = false;
- if(window.opera) {
- buggy_opera = true;
- if((window.opera.version) && (parseFloat(window.opera.version()) >= 9.5))
- buggy_opera = false;
- }
-
- if(buggy_opera) {
- place = document.getElementsByTagName('head')[0];
- if(place)
- node = createEl('link');
- } else {
- place = document.getElementsByTagName('body')[0]; // document.body nie dziala dla XHTML w Safari 3.0.4-
- if(place)
- node = createEl('div');
- }
- if(node) {
- node.id = 'mediaInspector';
- place.appendChild(node);
- }
-
- if(node) {
- // Dla Konquerora - umozliwia prawidlowe dzialanie getComputedStyle, zanim zaaplikowane
- // zostana wszystkie arkusze styli
- updateCSSRulesForKHTML();
-
- var color = null;
- try {
- var mediaInspector = node;
-
- color = mediaInspector.style['color'];
- if(!color) {
- if(mediaInspector.currentStyle)
- color = mediaInspector.currentStyle['color'];
- else if(window.getComputedStyle)
- color = window.getComputedStyle(mediaInspector, null).getPropertyValue('color');
- }
- } catch(err) {}
-
- place.removeChild(node);
- delete node;
- }
-
- removeCSSRule('mediaInspector_rule1');
- removeCSSRule('mediaInspector_rule2');
-
- if(!color)
- return -1;
-
- color = color.replace(/[\s\t ]/gi, '').toUpperCase(); // \s does not work in Konqueror 4.1.1 and 4.1.2,
- // so an additional space is needed
- if((color == '#FFFFFF') || (color == 'RGB(255,255,255)'))
- return 1;
- else if((color == '#000000') || (color == 'RGB(0,0,0)'))
- return 0;
- else
- return -1;
- } catch(err) { return -1; }
-}
\ No newline at end of file
diff --git a/prefs.php b/prefs.php
index 3dc7cc9..3f78087 100644
--- a/prefs.php
+++ b/prefs.php
@@ -109,6 +109,7 @@ if(isset($_POST['prefs']))
$prefs->set('favicons', isset($_POST['favicons']));
$prefs->set('keyboard', isset($_POST['keyboard']));
$prefs->set('tzoffset', intval($_POST['tzoffset']));
+ $prefs->set('dst', isset($_POST['dst']));
$prefs->set('howmany', intval($_POST['howmany']));
$prefs->set('order', $_POST['order']);
$prefs->set('sharing', $_POST['sharing']);
@@ -205,7 +206,7 @@ Default display order: