Merge 1307 with CustIS 1297
parent
53a4eaace3
commit
ddfb4be960
|
@ -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]}});
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -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");
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
113
fof-db.php
113
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 <a href=\"install.php\"><code>install.php</code></a> to create or upgrade your installation?\n$error";
|
||||
die(str_replace("\n", "<br>", $error));
|
||||
$error = "SQL error. Have you run <a href=\"install.php\"><code>install.php</code></a> to create or upgrade your installation?\n<pre>$error</pre>";
|
||||
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);
|
||||
}
|
||||
|
|
59
fof-main.php
59
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 '<font color="green"><b>Subscribed.</b></font><!-- '.$feed['feed_id'].' --><br>';
|
||||
}
|
||||
|
||||
$rss = fof_parse($url);
|
||||
$rss = fof_parse($url, $user_id);
|
||||
|
||||
if (isset($rss->error))
|
||||
{
|
||||
return "Error: <B>" . $rss->error . "</b> <a href=\"http://feedvalidator.org/check?url=$url\">try to validate it?</a><br>";
|
||||
return "Error: <b>" . $rss->error . "</b><br />";
|
||||
}
|
||||
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: <b>" . $rss->error() . "</b> <a href=\"http://feedvalidator.org/check?url=$url\">try to validate it?</a>");
|
||||
return array(0, "Error: <b>" . $rss->error() . "</b>");
|
||||
}
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
$fof_no_login = 1;
|
||||
include_once("fof-main.php");
|
||||
|
||||
$sudo_id = $_GET['id'];
|
||||
if ($sudo_id)
|
||||
{
|
||||
$user_id = fof_cache_get("sudo-$sudo_id");
|
||||
fof_cache_unset("sudo-$sudo_id");
|
||||
}
|
||||
|
||||
if ($user_id)
|
||||
$user = fof_db_get_user(NULL, $user_id);
|
||||
|
||||
if ($user)
|
||||
{
|
||||
$prefs = unserialize($user['user_prefs']);
|
||||
$globalauth = $prefs['globalauth'];
|
||||
if (!$globalauth)
|
||||
$globalauth = array('user_name' => $user['user_name']);
|
||||
}
|
||||
else
|
||||
$globalauth = array('error' => "FOF_SUDO authorization error: session id $sudo_id is unknown");
|
||||
|
||||
print json_encode($globalauth);
|
|
@ -1,41 +1,138 @@
|
|||
<?php
|
||||
|
||||
/* Bug 52453 */
|
||||
/* Авторегистрация пользователей из CustIS багзиллы */
|
||||
/* (зачёркнуто) Bug 52453 - Авторегистрация пользователей из CustIS багзиллы */
|
||||
/* Bug 63447 - Single Sign-On по багзилле */
|
||||
|
||||
require_once 'sha256.inc';
|
||||
require_once 'urandom.inc';
|
||||
|
||||
/* Багзильное хеширование пароля */
|
||||
function bz_crypt($password, $salt)
|
||||
function fof_require_user_hook()
|
||||
{
|
||||
$algorithm = '';
|
||||
if (preg_match('/{([^}]+)}$/', $salt, $m))
|
||||
$algorithm = $m[1];
|
||||
|
||||
if (!$algorithm)
|
||||
return crypt($password, $salt);
|
||||
elseif (strtolower($algorithm) == 'sha-256')
|
||||
/* CustIS Bug 63447 - Single Sign-On по багзилле */
|
||||
if (defined('FOF_GLOBALAUTH_URL') &&
|
||||
!$_COOKIE['logged_out'])
|
||||
{
|
||||
$salt = substr($salt, 0, 8);
|
||||
return $salt . substr(base64_encode(pack('H*',sha256($password . $salt))), 0, -1) . '{' . $algorithm . '}';
|
||||
try
|
||||
{
|
||||
$data = globalauth(FOF_GLOBALAUTH_URL);
|
||||
foreach ($data['user_email_aliases'] as $email)
|
||||
if ($user = fof_db_get_user($email))
|
||||
break;
|
||||
if (!$user)
|
||||
{
|
||||
/* регистрируем нового пользователя без пароля */
|
||||
fof_db_add_user($data['user_email'], NULL);
|
||||
$user = fof_db_get_user($data['user_email']);
|
||||
if (!$user)
|
||||
die("database error");
|
||||
$adddefault = true;
|
||||
}
|
||||
/* обновляем данные пользователя, если только что приняли авторизацию */
|
||||
if ($_REQUEST['ga_id'])
|
||||
{
|
||||
$prefs = unserialize($user['user_prefs']);
|
||||
if (!$prefs)
|
||||
$prefs = array();
|
||||
$prefs['globalauth'] = $data;
|
||||
$user['user_prefs'] = serialize($prefs);
|
||||
$user['user_name'] = $data['user_email'];
|
||||
fof_update_user($user);
|
||||
if ($adddefault)
|
||||
fof_add_default_feeds_for_external($user);
|
||||
header("Location: ".globalauth_clean_uri());
|
||||
exit;
|
||||
}
|
||||
fof_set_current_user($user);
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
fof_log("Global auth: $e");
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
/* а если мы здесь, значит, и глобальная авторизация тоже не удалась */
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Внешняя аутентификация */
|
||||
function fof_authenticate_external($login, $password)
|
||||
// обработка запросов к глобальной авторизации (клиентская сторона)
|
||||
function globalauth_handle()
|
||||
{
|
||||
if (defined('FOF_EXTERN_DB_DBNAME') &&
|
||||
($extdb = mysql_pconnect(FOF_EXTERN_DB_HOST, FOF_EXTERN_DB_USER, FOF_EXTERN_DB_PASS)) &&
|
||||
mysql_select_db(FOF_EXTERN_DB_DBNAME, $extdb))
|
||||
$cookiename = 'globalauth';
|
||||
$id = $_REQUEST['ga_id'];
|
||||
if (!$id)
|
||||
$id = $_COOKIE[$cookiename];
|
||||
if ($id)
|
||||
{
|
||||
mysql_query("SET NAMES ".FOF_DB_CHARSET, $extdb);
|
||||
if (($r = mysql_query("SELECT cryptpassword FROM profiles WHERE login_name='".mysql_real_escape_string($login)."' AND disabledtext=''", $extdb)) &&
|
||||
($r = mysql_fetch_row($r)) &&
|
||||
(bz_crypt($password, $r[0]) == $r[0]))
|
||||
return true;
|
||||
// получение данных авторизации от сервера
|
||||
$key = $_REQUEST['ga_key'];
|
||||
if ($key && $_REQUEST['ga_client'] && $key == fof_cache_get("ga-key-$id"))
|
||||
{
|
||||
fof_cache_unset("ga-key-$id");
|
||||
if ($_REQUEST['ga_nologin'])
|
||||
$d = 'nologin';
|
||||
else
|
||||
$d = $_REQUEST['ga_data'];
|
||||
if ($d)
|
||||
{
|
||||
fof_cache_set("ga-data-$id", $d);
|
||||
print "1";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
// возвращаем данные для дальнейших действий
|
||||
elseif (!$key && ($d = fof_cache_get("ga-data-$id")))
|
||||
{
|
||||
if ($_COOKIE[$cookiename] != $id)
|
||||
setcookie($cookiename, $id, -1);
|
||||
if ($d && $d != 'nologin')
|
||||
$d = (array)@json_decode(utf8_decode($d));
|
||||
return $d;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function globalauth_clean_uri($params = array())
|
||||
{
|
||||
$p = $_GET+$_POST;
|
||||
unset($p['ga_id']);
|
||||
unset($p['ga_client']);
|
||||
unset($p['ga_key']);
|
||||
unset($p['ga_data']);
|
||||
unset($p['ga_nologin']);
|
||||
unset($p['ga_res']);
|
||||
$params += $p;
|
||||
return 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . '?' . http_build_query($params);
|
||||
}
|
||||
|
||||
// глобальная авторизация
|
||||
// если она что-то возвращает, а не падает на хрен и не делает exit, то это данные авторизации :)
|
||||
// ещё она может бросить Exception с каким-нибудь текстом
|
||||
function globalauth($url, $require = true)
|
||||
{
|
||||
if ($authdata = globalauth_handle())
|
||||
return $authdata;
|
||||
if (!$url)
|
||||
throw new Exception(__FUNCTION__.": globalauth_url is unset");
|
||||
$id = unpack('H*', urandom(16));
|
||||
$id = $id[1];
|
||||
$key = unpack('H*', urandom(16));
|
||||
$key = $key[1];
|
||||
$url .= (strpos($url, '?') !== false ? '&' : '?');
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_URL, $url."ga_id=$id&ga_key=$key");
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
$content = curl_exec($curl);
|
||||
$r = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||
curl_close($curl);
|
||||
if ($content)
|
||||
{
|
||||
$return = globalauth_clean_uri(array('ga_client' => 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');
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
12
login.php
12
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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; }
|
||||
}
|
|
@ -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: <select name="order"><option value=desc>new to old</optio
|
|||
Number of items in paged displays: <input type="string" name="howmany" value="<?php echo $prefs->get('howmany') ?>"><br><br>
|
||||
Display custom feed favicons? <input type="checkbox" name="favicons" <?php if($prefs->get('favicons')) echo "checked=true"; ?> ><br><br>
|
||||
Use keyboard shortcuts? <input type="checkbox" name="keyboard" <?php if($prefs->get('keyboard')) echo "checked=true";?> ><br><br>
|
||||
Time offset in hours: <input size=3 type=string name=tzoffset value="<?php echo $prefs->get('tzoffset')?>"> (UTC time: <?php echo gmdate("Y-n-d g:ia") ?>, local time: <?php echo gmdate("Y-n-d g:ia", time() + $prefs->get("tzoffset")*60*60) ?>)<br><br>
|
||||
Time offset in hours: <input size=3 type=string name=tzoffset value="<?php echo $prefs->get('tzoffset')?>"> <input type="checkbox" name="dst" <?php if($prefs->get('dst')) echo "checked=true";?> /> use <a href="http://en.wikipedia.org/wiki/Daylight_saving_time">DST</a> (UTC time: <?php echo gmdate("Y-n-d g:ia") ?>, local time: <?php echo gmdate("Y-n-d g:ia", time() + ($prefs->get("tzoffset") + ($prefs->get('dst') ? date('I') : 0))*60*60) ?>)<br><br>
|
||||
<table border=0 cellspacing=0 cellpadding=2><tr><td>New password:</td><td><input type=password name=password> (leave blank to not change)</td></tr>
|
||||
<tr><td>Repeat new password:</td><td><input type=password name=password2></td></tr></table>
|
||||
<br>
|
||||
|
|
17
sha256.inc
17
sha256.inc
|
@ -410,4 +410,21 @@ if (!function_exists('hash'))
|
|||
}
|
||||
}
|
||||
|
||||
/* Bugzilla password hashing */
|
||||
function bz_crypt($password, $salt)
|
||||
{
|
||||
$algorithm = '';
|
||||
if (preg_match('/{([^}]+)}$/', $salt, $m))
|
||||
$algorithm = $m[1];
|
||||
|
||||
if (!$algorithm)
|
||||
return crypt($password, $salt);
|
||||
elseif (strtolower($algorithm) == 'sha-256')
|
||||
{
|
||||
$salt = substr($salt, 0, 8);
|
||||
return $salt . substr(base64_encode(pack('H*',sha256($password . $salt))), 0, -1) . '{' . $algorithm . '}';
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
--- simplepie.inc.o 2010-03-03 16:25:08.982938422 +0300
|
||||
+++ simplepie.inc 2010-03-03 16:26:19.678998009 +0300
|
||||
@@ -43,6 +43,10 @@
|
||||
* @todo phpDoc comments
|
||||
*/
|
||||
|
||||
+/* added by FoF (vitalif@yourcmc.ru) to enable environment proxy settings support */
|
||||
+/* fucking cURL doesn't support this by default */
|
||||
+require_once(dirname(dirname(__FILE__)).'/curl-env-proxy.php');
|
||||
+
|
||||
/**
|
||||
* SimplePie Name
|
||||
*/
|
||||
@@ -446,7 +450,7 @@ class SimplePie
|
||||
* @see SimplePie::set_timeout()
|
||||
* @access private
|
||||
*/
|
||||
- var $timeout = 10;
|
||||
+ var $timeout = 60;
|
||||
|
||||
/**
|
||||
* @var bool Forces fsockopen() to be used for remote files instead
|
||||
@@ -708,7 +712,7 @@ class SimplePie
|
||||
* @see SimplePie::strip_htmltags()
|
||||
* @access private
|
||||
*/
|
||||
- var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style');
|
||||
+ var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'font', 'form', 'frame', 'frameset', 'html', 'input', 'marquee', 'meta', 'noscript', 'script', 'style');
|
||||
|
||||
/**
|
||||
* The SimplePie class contains feed level data and options
|
||||
@@ -1662,6 +1666,12 @@ class SimplePie
|
||||
$locate =& new $this->locator_class($file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds, $this->content_type_sniffer_class);
|
||||
if (!$locate->is_feed($file))
|
||||
{
|
||||
+ if ($file->status_code == 401)
|
||||
+ {
|
||||
+ $this->error = "HTTP 401 Unauthorized. Retry with correct login/password";
|
||||
+ SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
|
||||
+ return false;
|
||||
+ }
|
||||
// We need to unset this so that if SimplePie::set_file() has been called that object is untouched
|
||||
unset($file);
|
||||
if ($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds))
|
||||
@@ -7676,6 +7686,13 @@ class SimplePie_File
|
||||
{
|
||||
curl_setopt($fp, CURLOPT_ENCODING, '');
|
||||
}
|
||||
+ if (preg_match('#^([a-z0-9_]+://)(?:([^/]*:[^/]*)@)([^/@]+([/\?].*)?$)#is', $url, $m))
|
||||
+ {
|
||||
+ $headers2[] = "Authorization: Basic ".base64_encode(urldecode($m[2]));
|
||||
+ }
|
||||
+ // added by FoF (vitalif@yourcmc.ru) to enable environment proxy settings support
|
||||
+ // fucking cURL doesn't support this by default
|
||||
+ curl_set_env_proxy($fp, $url);
|
||||
curl_setopt($fp, CURLOPT_URL, $url);
|
||||
curl_setopt($fp, CURLOPT_HEADER, 1);
|
||||
curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1);
|
||||
@@ -7690,6 +7707,10 @@ class SimplePie_File
|
||||
curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects);
|
||||
}
|
||||
|
||||
+ // added by FoF to enable https and digest authentication
|
||||
+ curl_setopt($fp, CURLOPT_SSL_VERIFYPEER, false);
|
||||
+ curl_setopt($fp, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
|
||||
+
|
||||
$this->headers = curl_exec($fp);
|
||||
if (curl_errno($fp) === 23 || curl_errno($fp) === 61)
|
||||
{
|
||||
@@ -14654,7 +14675,7 @@ class SimplePie_Sanitize
|
||||
// Options
|
||||
var $remove_div = true;
|
||||
var $image_handler = '';
|
||||
- var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style');
|
||||
+ var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'font', 'form', 'frame', 'frameset', 'html', 'input', 'marquee', 'meta', 'noscript', 'script', 'style');
|
||||
var $encode_instead_of_strip = false;
|
||||
var $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc');
|
||||
var $strip_comments = false;
|
||||
@@ -14743,7 +14764,7 @@ class SimplePie_Sanitize
|
||||
}
|
||||
}
|
||||
|
||||
- function strip_htmltags($tags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'))
|
||||
+ function strip_htmltags($tags = array('base', 'blink', 'body', 'doctype', 'font', 'form', 'frame', 'frameset', 'html', 'input', 'marquee', 'meta', 'noscript', 'script', 'style'))
|
||||
{
|
||||
if ($tags)
|
||||
{
|
|
@ -714,6 +714,12 @@ class SimplePie
|
|||
*/
|
||||
var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'font', 'form', 'frame', 'frameset', 'html', 'input', 'marquee', 'meta', 'noscript', 'script', 'style');
|
||||
|
||||
/**
|
||||
* @var array Additional HTTP headers to retrieve feed
|
||||
* @access public
|
||||
*/
|
||||
var $headers = array();
|
||||
|
||||
/**
|
||||
* The SimplePie class contains feed level data and options
|
||||
*
|
||||
|
@ -738,7 +744,7 @@ class SimplePie
|
|||
function SimplePie($feed_url = null, $cache_location = null, $cache_duration = null)
|
||||
{
|
||||
// Other objects, instances created here so we can set options on them
|
||||
$this->sanitize =& new SimplePie_Sanitize;
|
||||
$this->sanitize = new SimplePie_Sanitize;
|
||||
|
||||
// Set options if they're passed to the constructor
|
||||
if ($cache_location !== null)
|
||||
|
@ -1108,7 +1114,7 @@ class SimplePie
|
|||
{
|
||||
if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Sanitize'))
|
||||
{
|
||||
$this->sanitize =& new $class;
|
||||
$this->sanitize = new $class;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1537,6 +1543,7 @@ class SimplePie
|
|||
|
||||
if ($this->feed_url !== null || $this->raw_data !== null)
|
||||
{
|
||||
$headers = $this->headers;
|
||||
$this->data = array();
|
||||
$this->multifeed_objects = array();
|
||||
$cache = false;
|
||||
|
@ -1593,7 +1600,6 @@ class SimplePie
|
|||
// If we have last-modified and/or etag set
|
||||
if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag']))
|
||||
{
|
||||
$headers = array();
|
||||
if (isset($this->data['headers']['last-modified']))
|
||||
{
|
||||
$headers['if-modified-since'] = $this->data['headers']['last-modified'];
|
||||
|
@ -1602,7 +1608,7 @@ class SimplePie
|
|||
{
|
||||
$headers['if-none-match'] = '"' . $this->data['headers']['etag'] . '"';
|
||||
}
|
||||
$file =& new $this->file_class($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen);
|
||||
$file = new $this->file_class($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen);
|
||||
if ($file->success)
|
||||
{
|
||||
if ($file->status_code === 304)
|
||||
|
@ -1643,7 +1649,7 @@ class SimplePie
|
|||
}
|
||||
else
|
||||
{
|
||||
$file =& new $this->file_class($this->feed_url, $this->timeout, 5, null, $this->useragent, $this->force_fsockopen);
|
||||
$file = new $this->file_class($this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen);
|
||||
}
|
||||
}
|
||||
// If the file connection has an error, set SimplePie::error to that and quit
|
||||
|
@ -1663,7 +1669,8 @@ class SimplePie
|
|||
if (!$this->force_feed)
|
||||
{
|
||||
// Check if the supplied URL is a feed, if it isn't, look for it.
|
||||
$locate =& new $this->locator_class($file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds, $this->content_type_sniffer_class);
|
||||
$locate = new $this->locator_class($file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds, $this->content_type_sniffer_class);
|
||||
$locate->headers = $headers;
|
||||
if (!$locate->is_feed($file))
|
||||
{
|
||||
if ($file->status_code == 401)
|
||||
|
@ -1699,7 +1706,7 @@ class SimplePie
|
|||
|
||||
$headers = $file->headers;
|
||||
$data = $file->body;
|
||||
$sniffer =& new $this->content_type_sniffer_class($file);
|
||||
$sniffer = new $this->content_type_sniffer_class($file);
|
||||
$sniffed = $sniffer->get_type();
|
||||
}
|
||||
else
|
||||
|
@ -1769,7 +1776,7 @@ class SimplePie
|
|||
if ($utf8_data = SimplePie_Misc::change_encoding($data, $encoding, 'UTF-8'))
|
||||
{
|
||||
// Create new parser
|
||||
$parser =& new $this->parser_class();
|
||||
$parser = new $this->parser_class();
|
||||
|
||||
// If it's parsed fine
|
||||
if ($parser->parse($utf8_data, 'UTF-8'))
|
||||
|
@ -1980,11 +1987,11 @@ class SimplePie
|
|||
}
|
||||
else
|
||||
{
|
||||
$file =& new $this->file_class($favicon, $this->timeout / 10, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen);
|
||||
$file = new $this->file_class($favicon, $this->timeout / 10, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen);
|
||||
|
||||
if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0)
|
||||
{
|
||||
$sniffer =& new $this->content_type_sniffer_class($file);
|
||||
$sniffer = new $this->content_type_sniffer_class($file);
|
||||
if (substr($sniffer->get_type(), 0, 6) === 'image/')
|
||||
{
|
||||
if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
|
||||
|
@ -2383,7 +2390,7 @@ class SimplePie
|
|||
{
|
||||
$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$categories[] =& new $this->category_class($term, $scheme, $label);
|
||||
$categories[] = new $this->category_class($term, $scheme, $label);
|
||||
}
|
||||
foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
|
||||
{
|
||||
|
@ -2398,15 +2405,15 @@ class SimplePie
|
|||
{
|
||||
$scheme = null;
|
||||
}
|
||||
$categories[] =& new $this->category_class($term, $scheme, null);
|
||||
$categories[] = new $this->category_class($term, $scheme, null);
|
||||
}
|
||||
foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
|
||||
{
|
||||
$categories[] =& new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
$categories[] = new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
}
|
||||
foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
|
||||
{
|
||||
$categories[] =& new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
$categories[] = new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
}
|
||||
|
||||
if (!empty($categories))
|
||||
|
@ -2454,7 +2461,7 @@ class SimplePie
|
|||
}
|
||||
if ($name !== null || $email !== null || $uri !== null)
|
||||
{
|
||||
$authors[] =& new $this->author_class($name, $uri, $email);
|
||||
$authors[] = new $this->author_class($name, $uri, $email);
|
||||
}
|
||||
}
|
||||
if ($author = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
|
||||
|
@ -2476,20 +2483,20 @@ class SimplePie
|
|||
}
|
||||
if ($name !== null || $email !== null || $url !== null)
|
||||
{
|
||||
$authors[] =& new $this->author_class($name, $url, $email);
|
||||
$authors[] = new $this->author_class($name, $url, $email);
|
||||
}
|
||||
}
|
||||
foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
|
||||
{
|
||||
$authors[] =& new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
$authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
}
|
||||
foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
|
||||
{
|
||||
$authors[] =& new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
$authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
}
|
||||
foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
|
||||
{
|
||||
$authors[] =& new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
$authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
}
|
||||
|
||||
if (!empty($authors))
|
||||
|
@ -2537,7 +2544,7 @@ class SimplePie
|
|||
}
|
||||
if ($name !== null || $email !== null || $uri !== null)
|
||||
{
|
||||
$contributors[] =& new $this->author_class($name, $uri, $email);
|
||||
$contributors[] = new $this->author_class($name, $uri, $email);
|
||||
}
|
||||
}
|
||||
foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
|
||||
|
@ -2559,7 +2566,7 @@ class SimplePie
|
|||
}
|
||||
if ($name !== null || $email !== null || $url !== null)
|
||||
{
|
||||
$contributors[] =& new $this->author_class($name, $url, $email);
|
||||
$contributors[] = new $this->author_class($name, $url, $email);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2972,7 +2979,7 @@ class SimplePie
|
|||
$keys = array_keys($items);
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
$this->data['items'][] =& new $this->item_class($this, $items[$key]);
|
||||
$this->data['items'][] = new $this->item_class($this, $items[$key]);
|
||||
}
|
||||
}
|
||||
if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry'))
|
||||
|
@ -2980,7 +2987,7 @@ class SimplePie
|
|||
$keys = array_keys($items);
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
$this->data['items'][] =& new $this->item_class($this, $items[$key]);
|
||||
$this->data['items'][] = new $this->item_class($this, $items[$key]);
|
||||
}
|
||||
}
|
||||
if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item'))
|
||||
|
@ -2988,7 +2995,7 @@ class SimplePie
|
|||
$keys = array_keys($items);
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
$this->data['items'][] =& new $this->item_class($this, $items[$key]);
|
||||
$this->data['items'][] = new $this->item_class($this, $items[$key]);
|
||||
}
|
||||
}
|
||||
if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item'))
|
||||
|
@ -2996,7 +3003,7 @@ class SimplePie
|
|||
$keys = array_keys($items);
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
$this->data['items'][] =& new $this->item_class($this, $items[$key]);
|
||||
$this->data['items'][] = new $this->item_class($this, $items[$key]);
|
||||
}
|
||||
}
|
||||
if ($items = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'item'))
|
||||
|
@ -3004,7 +3011,7 @@ class SimplePie
|
|||
$keys = array_keys($items);
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
$this->data['items'][] =& new $this->item_class($this, $items[$key]);
|
||||
$this->data['items'][] = new $this->item_class($this, $items[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3355,7 +3362,7 @@ class SimplePie_Item
|
|||
{
|
||||
$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$categories[] =& new $this->feed->category_class($term, $scheme, $label);
|
||||
$categories[] = new $this->feed->category_class($term, $scheme, $label);
|
||||
}
|
||||
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
|
||||
{
|
||||
|
@ -3370,15 +3377,15 @@ class SimplePie_Item
|
|||
{
|
||||
$scheme = null;
|
||||
}
|
||||
$categories[] =& new $this->feed->category_class($term, $scheme, null);
|
||||
$categories[] = new $this->feed->category_class($term, $scheme, null);
|
||||
}
|
||||
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
|
||||
{
|
||||
$categories[] =& new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
$categories[] = new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
}
|
||||
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
|
||||
{
|
||||
$categories[] =& new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
$categories[] = new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
}
|
||||
|
||||
if (!empty($categories))
|
||||
|
@ -3439,7 +3446,7 @@ class SimplePie_Item
|
|||
}
|
||||
if ($name !== null || $email !== null || $uri !== null)
|
||||
{
|
||||
$contributors[] =& new $this->feed->author_class($name, $uri, $email);
|
||||
$contributors[] = new $this->feed->author_class($name, $uri, $email);
|
||||
}
|
||||
}
|
||||
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
|
||||
|
@ -3461,7 +3468,7 @@ class SimplePie_Item
|
|||
}
|
||||
if ($name !== null || $email !== null || $url !== null)
|
||||
{
|
||||
$contributors[] =& new $this->feed->author_class($name, $url, $email);
|
||||
$contributors[] = new $this->feed->author_class($name, $url, $email);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3497,7 +3504,7 @@ class SimplePie_Item
|
|||
}
|
||||
if ($name !== null || $email !== null || $uri !== null)
|
||||
{
|
||||
$authors[] =& new $this->feed->author_class($name, $uri, $email);
|
||||
$authors[] = new $this->feed->author_class($name, $uri, $email);
|
||||
}
|
||||
}
|
||||
if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
|
||||
|
@ -3519,24 +3526,24 @@ class SimplePie_Item
|
|||
}
|
||||
if ($name !== null || $email !== null || $url !== null)
|
||||
{
|
||||
$authors[] =& new $this->feed->author_class($name, $url, $email);
|
||||
$authors[] = new $this->feed->author_class($name, $url, $email);
|
||||
}
|
||||
}
|
||||
if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'author'))
|
||||
{
|
||||
$authors[] =& new $this->feed->author_class(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
|
||||
$authors[] = new $this->feed->author_class(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
|
||||
}
|
||||
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
|
||||
{
|
||||
$authors[] =& new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
$authors[] = new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
}
|
||||
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
|
||||
{
|
||||
$authors[] =& new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
$authors[] = new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
}
|
||||
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
|
||||
{
|
||||
$authors[] =& new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
$authors[] = new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
}
|
||||
|
||||
if (!empty($authors))
|
||||
|
@ -3846,7 +3853,7 @@ class SimplePie_Item
|
|||
{
|
||||
$caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$captions_parent[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
|
||||
$captions_parent[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
|
||||
}
|
||||
}
|
||||
elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text'))
|
||||
|
@ -3878,7 +3885,7 @@ class SimplePie_Item
|
|||
{
|
||||
$caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$captions_parent[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
|
||||
$captions_parent[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
|
||||
}
|
||||
}
|
||||
if (is_array($captions_parent))
|
||||
|
@ -3908,7 +3915,7 @@ class SimplePie_Item
|
|||
{
|
||||
$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$categories_parent[] =& new $this->feed->category_class($term, $scheme, $label);
|
||||
$categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
|
||||
}
|
||||
foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category)
|
||||
{
|
||||
|
@ -3931,7 +3938,7 @@ class SimplePie_Item
|
|||
{
|
||||
$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$categories_parent[] =& new $this->feed->category_class($term, $scheme, $label);
|
||||
$categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
|
||||
}
|
||||
foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'category') as $category)
|
||||
{
|
||||
|
@ -3942,7 +3949,7 @@ class SimplePie_Item
|
|||
{
|
||||
$label = $this->sanitize($category['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$categories_parent[] =& new $this->feed->category_class($term, $scheme, $label);
|
||||
$categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
|
||||
|
||||
if (isset($category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category']))
|
||||
{
|
||||
|
@ -3952,7 +3959,7 @@ class SimplePie_Item
|
|||
{
|
||||
$label = $this->sanitize($subcategory['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$categories_parent[] =& new $this->feed->category_class($term, $scheme, $label);
|
||||
$categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3974,7 +3981,7 @@ class SimplePie_Item
|
|||
{
|
||||
$copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$copyrights_parent =& new $this->feed->copyright_class($copyright_url, $copyright_label);
|
||||
$copyrights_parent = new $this->feed->copyright_class($copyright_url, $copyright_label);
|
||||
}
|
||||
elseif ($copyright = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright'))
|
||||
{
|
||||
|
@ -3988,7 +3995,7 @@ class SimplePie_Item
|
|||
{
|
||||
$copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$copyrights_parent =& new $this->feed->copyright_class($copyright_url, $copyright_label);
|
||||
$copyrights_parent = new $this->feed->copyright_class($copyright_url, $copyright_label);
|
||||
}
|
||||
|
||||
// CREDITS
|
||||
|
@ -4015,7 +4022,7 @@ class SimplePie_Item
|
|||
{
|
||||
$credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$credits_parent[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
|
||||
$credits_parent[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
|
||||
}
|
||||
}
|
||||
elseif ($credits = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit'))
|
||||
|
@ -4041,7 +4048,7 @@ class SimplePie_Item
|
|||
{
|
||||
$credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$credits_parent[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
|
||||
$credits_parent[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
|
||||
}
|
||||
}
|
||||
if (is_array($credits_parent))
|
||||
|
@ -4230,7 +4237,7 @@ class SimplePie_Item
|
|||
{
|
||||
$rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
|
||||
$ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value);
|
||||
}
|
||||
}
|
||||
elseif ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
|
||||
|
@ -4243,7 +4250,7 @@ class SimplePie_Item
|
|||
{
|
||||
$rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
|
||||
$ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value);
|
||||
}
|
||||
}
|
||||
elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating'))
|
||||
|
@ -4264,7 +4271,7 @@ class SimplePie_Item
|
|||
{
|
||||
$rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
|
||||
$ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value);
|
||||
}
|
||||
}
|
||||
elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
|
||||
|
@ -4277,7 +4284,7 @@ class SimplePie_Item
|
|||
{
|
||||
$rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
|
||||
$ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value);
|
||||
}
|
||||
}
|
||||
if (is_array($ratings_parent))
|
||||
|
@ -4305,7 +4312,7 @@ class SimplePie_Item
|
|||
{
|
||||
$restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
|
||||
$restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
|
||||
}
|
||||
}
|
||||
elseif ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
|
||||
|
@ -4319,7 +4326,7 @@ class SimplePie_Item
|
|||
{
|
||||
$restriction_relationship = 'deny';
|
||||
}
|
||||
$restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
|
||||
$restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
|
||||
}
|
||||
}
|
||||
elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction'))
|
||||
|
@ -4341,7 +4348,7 @@ class SimplePie_Item
|
|||
{
|
||||
$restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
|
||||
$restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
|
||||
}
|
||||
}
|
||||
elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
|
||||
|
@ -4355,7 +4362,7 @@ class SimplePie_Item
|
|||
{
|
||||
$restriction_relationship = 'deny';
|
||||
}
|
||||
$restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
|
||||
$restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
|
||||
}
|
||||
}
|
||||
if (is_array($restrictions_parent))
|
||||
|
@ -4559,7 +4566,7 @@ class SimplePie_Item
|
|||
{
|
||||
$caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$captions[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
|
||||
$captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
|
||||
}
|
||||
if (is_array($captions))
|
||||
{
|
||||
|
@ -4595,7 +4602,7 @@ class SimplePie_Item
|
|||
{
|
||||
$caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$captions[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
|
||||
$captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
|
||||
}
|
||||
if (is_array($captions))
|
||||
{
|
||||
|
@ -4631,7 +4638,7 @@ class SimplePie_Item
|
|||
{
|
||||
$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$categories[] =& new $this->feed->category_class($term, $scheme, $label);
|
||||
$categories[] = new $this->feed->category_class($term, $scheme, $label);
|
||||
}
|
||||
}
|
||||
if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
|
||||
|
@ -4657,7 +4664,7 @@ class SimplePie_Item
|
|||
{
|
||||
$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$categories[] =& new $this->feed->category_class($term, $scheme, $label);
|
||||
$categories[] = new $this->feed->category_class($term, $scheme, $label);
|
||||
}
|
||||
}
|
||||
if (is_array($categories) && is_array($categories_parent))
|
||||
|
@ -4686,7 +4693,7 @@ class SimplePie_Item
|
|||
{
|
||||
$copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$copyrights =& new $this->feed->copyright_class($copyright_url, $copyright_label);
|
||||
$copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label);
|
||||
}
|
||||
elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
|
||||
{
|
||||
|
@ -4700,7 +4707,7 @@ class SimplePie_Item
|
|||
{
|
||||
$copyright_label = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$copyrights =& new $this->feed->copyright_class($copyright_url, $copyright_label);
|
||||
$copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4731,7 +4738,7 @@ class SimplePie_Item
|
|||
{
|
||||
$credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$credits[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
|
||||
$credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
|
||||
}
|
||||
if (is_array($credits))
|
||||
{
|
||||
|
@ -4761,7 +4768,7 @@ class SimplePie_Item
|
|||
{
|
||||
$credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$credits[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
|
||||
$credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
|
||||
}
|
||||
if (is_array($credits))
|
||||
{
|
||||
|
@ -4914,7 +4921,7 @@ class SimplePie_Item
|
|||
{
|
||||
$rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$ratings[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
|
||||
$ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
|
||||
}
|
||||
if (is_array($ratings))
|
||||
{
|
||||
|
@ -4939,7 +4946,7 @@ class SimplePie_Item
|
|||
{
|
||||
$rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$ratings[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
|
||||
$ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
|
||||
}
|
||||
if (is_array($ratings))
|
||||
{
|
||||
|
@ -4971,7 +4978,7 @@ class SimplePie_Item
|
|||
{
|
||||
$restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$restrictions[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
|
||||
$restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
|
||||
}
|
||||
if (is_array($restrictions))
|
||||
{
|
||||
|
@ -4997,7 +5004,7 @@ class SimplePie_Item
|
|||
{
|
||||
$restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$restrictions[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
|
||||
$restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
|
||||
}
|
||||
if (is_array($restrictions))
|
||||
{
|
||||
|
@ -5051,7 +5058,7 @@ class SimplePie_Item
|
|||
$title = $title_parent;
|
||||
}
|
||||
|
||||
$this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width);
|
||||
$this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5180,7 +5187,7 @@ class SimplePie_Item
|
|||
{
|
||||
$caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$captions[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
|
||||
$captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
|
||||
}
|
||||
if (is_array($captions))
|
||||
{
|
||||
|
@ -5216,7 +5223,7 @@ class SimplePie_Item
|
|||
{
|
||||
$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$categories[] =& new $this->feed->category_class($term, $scheme, $label);
|
||||
$categories[] = new $this->feed->category_class($term, $scheme, $label);
|
||||
}
|
||||
}
|
||||
if (is_array($categories) && is_array($categories_parent))
|
||||
|
@ -5249,7 +5256,7 @@ class SimplePie_Item
|
|||
{
|
||||
$copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$copyrights =& new $this->feed->copyright_class($copyright_url, $copyright_label);
|
||||
$copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5280,7 +5287,7 @@ class SimplePie_Item
|
|||
{
|
||||
$credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$credits[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
|
||||
$credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
|
||||
}
|
||||
if (is_array($credits))
|
||||
{
|
||||
|
@ -5384,7 +5391,7 @@ class SimplePie_Item
|
|||
{
|
||||
$rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$ratings[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
|
||||
$ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
|
||||
}
|
||||
if (is_array($ratings))
|
||||
{
|
||||
|
@ -5416,7 +5423,7 @@ class SimplePie_Item
|
|||
{
|
||||
$restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$restrictions[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
|
||||
$restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
|
||||
}
|
||||
if (is_array($restrictions))
|
||||
{
|
||||
|
@ -5455,7 +5462,7 @@ class SimplePie_Item
|
|||
$title = $title_parent;
|
||||
}
|
||||
|
||||
$this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width);
|
||||
$this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5491,7 +5498,7 @@ class SimplePie_Item
|
|||
}
|
||||
|
||||
// Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
|
||||
$this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
|
||||
$this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5526,7 +5533,7 @@ class SimplePie_Item
|
|||
}
|
||||
|
||||
// Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
|
||||
$this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
|
||||
$this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5561,14 +5568,14 @@ class SimplePie_Item
|
|||
}
|
||||
|
||||
// Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
|
||||
$this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
|
||||
$this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof($this->data['enclosures']) === 0 && ($url || $type || $length || $bitrate || $captions_parent || $categories_parent || $channels || $copyrights_parent || $credits_parent || $description_parent || $duration_parent || $expression || $framerate || $hashes_parent || $height || $keywords_parent || $lang || $medium || $player_parent || $ratings_parent || $restrictions_parent || $samplingrate || $thumbnails_parent || $title_parent || $width))
|
||||
{
|
||||
// Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
|
||||
$this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
|
||||
$this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
|
||||
}
|
||||
|
||||
$this->data['enclosures'] = array_values(SimplePie_Misc::array_unique($this->data['enclosures']));
|
||||
|
@ -5845,7 +5852,7 @@ class SimplePie_Source
|
|||
{
|
||||
$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$categories[] =& new $this->item->feed->category_class($term, $scheme, $label);
|
||||
$categories[] = new $this->item->feed->category_class($term, $scheme, $label);
|
||||
}
|
||||
foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
|
||||
{
|
||||
|
@ -5860,15 +5867,15 @@ class SimplePie_Source
|
|||
{
|
||||
$scheme = null;
|
||||
}
|
||||
$categories[] =& new $this->item->feed->category_class($term, $scheme, null);
|
||||
$categories[] = new $this->item->feed->category_class($term, $scheme, null);
|
||||
}
|
||||
foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
|
||||
{
|
||||
$categories[] =& new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
$categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
}
|
||||
foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
|
||||
{
|
||||
$categories[] =& new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
$categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
}
|
||||
|
||||
if (!empty($categories))
|
||||
|
@ -5916,7 +5923,7 @@ class SimplePie_Source
|
|||
}
|
||||
if ($name !== null || $email !== null || $uri !== null)
|
||||
{
|
||||
$authors[] =& new $this->item->feed->author_class($name, $uri, $email);
|
||||
$authors[] = new $this->item->feed->author_class($name, $uri, $email);
|
||||
}
|
||||
}
|
||||
if ($author = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
|
||||
|
@ -5938,20 +5945,20 @@ class SimplePie_Source
|
|||
}
|
||||
if ($name !== null || $email !== null || $url !== null)
|
||||
{
|
||||
$authors[] =& new $this->item->feed->author_class($name, $url, $email);
|
||||
$authors[] = new $this->item->feed->author_class($name, $url, $email);
|
||||
}
|
||||
}
|
||||
foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
|
||||
{
|
||||
$authors[] =& new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
$authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
}
|
||||
foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
|
||||
{
|
||||
$authors[] =& new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
$authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
}
|
||||
foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
|
||||
{
|
||||
$authors[] =& new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
$authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
|
||||
}
|
||||
|
||||
if (!empty($authors))
|
||||
|
@ -5999,7 +6006,7 @@ class SimplePie_Source
|
|||
}
|
||||
if ($name !== null || $email !== null || $uri !== null)
|
||||
{
|
||||
$contributors[] =& new $this->item->feed->author_class($name, $uri, $email);
|
||||
$contributors[] = new $this->item->feed->author_class($name, $uri, $email);
|
||||
}
|
||||
}
|
||||
foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
|
||||
|
@ -6021,7 +6028,7 @@ class SimplePie_Source
|
|||
}
|
||||
if ($name !== null || $email !== null || $url !== null)
|
||||
{
|
||||
$contributors[] =& new $this->item->feed->author_class($name, $url, $email);
|
||||
$contributors[] = new $this->item->feed->author_class($name, $url, $email);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6458,7 +6465,7 @@ class SimplePie_Enclosure
|
|||
$this->width = $width;
|
||||
if (class_exists('idna_convert'))
|
||||
{
|
||||
$idn =& new idna_convert;
|
||||
$idn = new idna_convert;
|
||||
$parsed = SimplePie_Misc::parse_url($link);
|
||||
$this->link = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
|
||||
}
|
||||
|
@ -7637,6 +7644,15 @@ class SimplePie_Restriction
|
|||
}
|
||||
}
|
||||
|
||||
class SimplePie_Callback
|
||||
{
|
||||
var $callable;
|
||||
function __construct($callable)
|
||||
{
|
||||
$this->callable = $callable;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Move to properly supporting RFC2616 (HTTP/1.1)
|
||||
*/
|
||||
|
@ -7656,7 +7672,7 @@ class SimplePie_File
|
|||
{
|
||||
if (class_exists('idna_convert'))
|
||||
{
|
||||
$idn =& new idna_convert;
|
||||
$idn = new idna_convert;
|
||||
$parsed = SimplePie_Misc::parse_url($url);
|
||||
$url = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
|
||||
}
|
||||
|
@ -7680,6 +7696,8 @@ class SimplePie_File
|
|||
$headers2 = array();
|
||||
foreach ($headers as $key => $value)
|
||||
{
|
||||
if (is_object($value) && $value instanceof SimplePie_Callback)
|
||||
$value = call_user_func($value->callable, $url);
|
||||
$headers2[] = "$key: $value";
|
||||
}
|
||||
if (version_compare(SimplePie_Misc::get_curl_version(), '7.10.5', '>='))
|
||||
|
@ -7728,7 +7746,7 @@ class SimplePie_File
|
|||
curl_close($fp);
|
||||
$this->headers = explode("\r\n\r\n", $this->headers, $info['redirect_count'] + 1);
|
||||
$this->headers = array_pop($this->headers);
|
||||
$parser =& new SimplePie_HTTP_Parser($this->headers);
|
||||
$parser = new SimplePie_HTTP_Parser($this->headers);
|
||||
if ($parser->parse())
|
||||
{
|
||||
$this->headers = $parser->headers;
|
||||
|
@ -7809,7 +7827,7 @@ class SimplePie_File
|
|||
}
|
||||
if (!$info['timed_out'])
|
||||
{
|
||||
$parser =& new SimplePie_HTTP_Parser($this->headers);
|
||||
$parser = new SimplePie_HTTP_Parser($this->headers);
|
||||
if ($parser->parse())
|
||||
{
|
||||
$this->headers = $parser->headers;
|
||||
|
@ -7828,7 +7846,7 @@ class SimplePie_File
|
|||
{
|
||||
case 'gzip':
|
||||
case 'x-gzip':
|
||||
$decoder =& new SimplePie_gzdecode($this->body);
|
||||
$decoder = new SimplePie_gzdecode($this->body);
|
||||
if (!$decoder->parse())
|
||||
{
|
||||
$this->error = 'Unable to decode HTTP "gzip" stream';
|
||||
|
@ -8640,7 +8658,7 @@ class SimplePie_Cache
|
|||
*/
|
||||
function create($location, $filename, $extension)
|
||||
{
|
||||
$location_iri =& new SimplePie_IRI($location);
|
||||
$location_iri = new SimplePie_IRI($location);
|
||||
switch ($location_iri->get_scheme())
|
||||
{
|
||||
case 'mysql':
|
||||
|
@ -9337,7 +9355,7 @@ class SimplePie_Misc
|
|||
|
||||
function parse_url($url)
|
||||
{
|
||||
$iri =& new SimplePie_IRI($url);
|
||||
$iri = new SimplePie_IRI($url);
|
||||
return array(
|
||||
'scheme' => (string) $iri->get_scheme(),
|
||||
'authority' => (string) $iri->get_authority(),
|
||||
|
@ -9349,7 +9367,7 @@ class SimplePie_Misc
|
|||
|
||||
function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '')
|
||||
{
|
||||
$iri =& new SimplePie_IRI('');
|
||||
$iri = new SimplePie_IRI('');
|
||||
$iri->set_scheme($scheme);
|
||||
$iri->set_authority($authority);
|
||||
$iri->set_path($path);
|
||||
|
@ -9360,7 +9378,7 @@ class SimplePie_Misc
|
|||
|
||||
function normalize_url($url)
|
||||
{
|
||||
$iri =& new SimplePie_IRI($url);
|
||||
$iri = new SimplePie_IRI($url);
|
||||
return $iri->get_iri();
|
||||
}
|
||||
|
||||
|
@ -10880,7 +10898,7 @@ class SimplePie_Misc
|
|||
*/
|
||||
function entities_decode($data)
|
||||
{
|
||||
$decoder =& new SimplePie_Decode_HTML_Entities($data);
|
||||
$decoder = new SimplePie_Decode_HTML_Entities($data);
|
||||
return $decoder->parse();
|
||||
}
|
||||
|
||||
|
@ -11276,7 +11294,7 @@ class SimplePie_Misc
|
|||
{
|
||||
if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E"))
|
||||
{
|
||||
$parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'));
|
||||
$parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'));
|
||||
if ($parser->parse())
|
||||
{
|
||||
$encoding[] = $parser->encoding;
|
||||
|
@ -11289,7 +11307,7 @@ class SimplePie_Misc
|
|||
{
|
||||
if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00"))
|
||||
{
|
||||
$parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'));
|
||||
$parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'));
|
||||
if ($parser->parse())
|
||||
{
|
||||
$encoding[] = $parser->encoding;
|
||||
|
@ -11302,7 +11320,7 @@ class SimplePie_Misc
|
|||
{
|
||||
if ($pos = strpos($data, "\x00\x3F\x00\x3E"))
|
||||
{
|
||||
$parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'));
|
||||
$parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'));
|
||||
if ($parser->parse())
|
||||
{
|
||||
$encoding[] = $parser->encoding;
|
||||
|
@ -11315,7 +11333,7 @@ class SimplePie_Misc
|
|||
{
|
||||
if ($pos = strpos($data, "\x3F\x00\x3E\x00"))
|
||||
{
|
||||
$parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'));
|
||||
$parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'));
|
||||
if ($parser->parse())
|
||||
{
|
||||
$encoding[] = $parser->encoding;
|
||||
|
@ -11328,7 +11346,7 @@ class SimplePie_Misc
|
|||
{
|
||||
if ($pos = strpos($data, "\x3F\x3E"))
|
||||
{
|
||||
$parser =& new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
|
||||
$parser = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
|
||||
if ($parser->parse())
|
||||
{
|
||||
$encoding[] = $parser->encoding;
|
||||
|
@ -11703,7 +11721,7 @@ class SimplePie_IRI
|
|||
$relative = (string) $relative;
|
||||
if ($relative !== '')
|
||||
{
|
||||
$relative =& new SimplePie_IRI($relative);
|
||||
$relative = new SimplePie_IRI($relative);
|
||||
if ($relative->get_scheme() !== null)
|
||||
{
|
||||
$target = $relative;
|
||||
|
@ -11717,7 +11735,7 @@ class SimplePie_IRI
|
|||
}
|
||||
else
|
||||
{
|
||||
$target =& new SimplePie_IRI('');
|
||||
$target = new SimplePie_IRI('');
|
||||
$target->set_scheme($base->get_scheme());
|
||||
$target->set_userinfo($base->get_userinfo());
|
||||
$target->set_host($base->get_host());
|
||||
|
@ -11779,11 +11797,7 @@ class SimplePie_IRI
|
|||
*/
|
||||
function parse_iri($iri)
|
||||
{
|
||||
preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $iri, $match);
|
||||
for ($i = count($match); $i <= 9; $i++)
|
||||
{
|
||||
$match[$i] = '';
|
||||
}
|
||||
preg_match('/^(([^:\/?#]+):)?(\/\/(\/*[^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $iri, $match);
|
||||
return array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
|
||||
}
|
||||
|
||||
|
@ -12066,7 +12080,7 @@ class SimplePie_IRI
|
|||
}
|
||||
else
|
||||
{
|
||||
$this->host = $this->replace_invalid_with_pct_encoding($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=', SIMPLEPIE_LOWERCASE);
|
||||
$this->host = $this->replace_invalid_with_pct_encoding($host, '\/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=', SIMPLEPIE_LOWERCASE);
|
||||
$this->valid[__FUNCTION__] = true;
|
||||
return true;
|
||||
}
|
||||
|
@ -13069,7 +13083,7 @@ class SimplePie_Parse_Date
|
|||
static $object;
|
||||
if (!$object)
|
||||
{
|
||||
$object =& new SimplePie_Parse_Date;
|
||||
$object = new SimplePie_Parse_Date;
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
|
@ -14084,6 +14098,7 @@ class SimplePie_Locator
|
|||
var $checked_feeds = 0;
|
||||
var $max_checked_feeds = 10;
|
||||
var $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer';
|
||||
var $headers = array();
|
||||
|
||||
function SimplePie_Locator(&$file, $timeout = 10, $useragent = null, $file_class = 'SimplePie_File', $max_checked_feeds = 10, $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer')
|
||||
{
|
||||
|
@ -14104,7 +14119,7 @@ class SimplePie_Locator
|
|||
|
||||
if ($this->file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
|
||||
{
|
||||
$sniffer =& new $this->content_type_sniffer_class($this->file);
|
||||
$sniffer = new $this->content_type_sniffer_class($this->file);
|
||||
if ($sniffer->get_type() !== 'text/html')
|
||||
{
|
||||
return null;
|
||||
|
@ -14150,7 +14165,7 @@ class SimplePie_Locator
|
|||
{
|
||||
if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
|
||||
{
|
||||
$sniffer =& new $this->content_type_sniffer_class($file);
|
||||
$sniffer = new $this->content_type_sniffer_class($file);
|
||||
$sniffed = $sniffer->get_type();
|
||||
if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml')))
|
||||
{
|
||||
|
@ -14214,7 +14229,7 @@ class SimplePie_Locator
|
|||
if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !empty($link['attribs']['type']['data']) && in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml'))) && !isset($feeds[$href]))
|
||||
{
|
||||
$this->checked_feeds++;
|
||||
$feed =& new $this->file_class($href, $this->timeout, 5, null, $this->useragent);
|
||||
$feed = new $this->file_class($href, $this->timeout, 5, $this->headers, $this->useragent);
|
||||
if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
|
||||
{
|
||||
$feeds[$href] = $feed;
|
||||
|
@ -14286,7 +14301,7 @@ class SimplePie_Locator
|
|||
if (in_array(strtolower(strrchr($value, '.')), array('.rss', '.rdf', '.atom', '.xml')))
|
||||
{
|
||||
$this->checked_feeds++;
|
||||
$feed =& new $this->file_class($value, $this->timeout, 5, null, $this->useragent);
|
||||
$feed = new $this->file_class($value, $this->timeout, 5, $this->headers, $this->useragent);
|
||||
if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
|
||||
{
|
||||
return $feed;
|
||||
|
@ -14311,7 +14326,7 @@ class SimplePie_Locator
|
|||
if (preg_match('/(rss|rdf|atom|xml)/i', $value))
|
||||
{
|
||||
$this->checked_feeds++;
|
||||
$feed =& new $this->file_class($value, $this->timeout, 5, null, $this->useragent);
|
||||
$feed = new $this->file_class($value, $this->timeout, 5, $this->headers, $this->useragent);
|
||||
if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
|
||||
{
|
||||
return $feed;
|
||||
|
@ -14385,7 +14400,7 @@ class SimplePie_Parser
|
|||
|
||||
if (substr($data, 0, 5) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false)
|
||||
{
|
||||
$declaration =& new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
|
||||
$declaration = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
|
||||
if ($declaration->parse())
|
||||
{
|
||||
$data = substr($data, $pos + 2);
|
||||
|
@ -14435,7 +14450,7 @@ class SimplePie_Parser
|
|||
else
|
||||
{
|
||||
libxml_clear_errors();
|
||||
$xml =& new XMLReader();
|
||||
$xml = new XMLReader();
|
||||
$xml->xml($data);
|
||||
while (@$xml->read())
|
||||
{
|
||||
|
@ -14921,7 +14936,7 @@ class SimplePie_Sanitize
|
|||
}
|
||||
else
|
||||
{
|
||||
$file =& new $this->file_class($img['attribs']['src']['data'], $this->timeout, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen);
|
||||
$file = new $this->file_class($img['attribs']['src']['data'], $this->timeout, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen);
|
||||
$headers = $file->headers;
|
||||
|
||||
if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)))
|
File diff suppressed because it is too large
Load Diff
|
@ -57,4 +57,3 @@ fof_db_optimize();
|
|||
fof_log("=== update complete ===", "update");
|
||||
|
||||
ob_end_clean();
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
function urandom($nbytes = 16)
|
||||
{
|
||||
$pr_bits = NULL;
|
||||
// Unix/Linux platform?
|
||||
$fp = @fopen('/dev/urandom', 'rb');
|
||||
if ($fp !== FALSE)
|
||||
{
|
||||
$pr_bits = @fread($fp, $nbytes);
|
||||
@fclose($fp);
|
||||
}
|
||||
// MS-Windows platform?
|
||||
elseif (@class_exists('COM'))
|
||||
{
|
||||
// http://msdn.microsoft.com/en-us/library/aa388176(VS.85).aspx
|
||||
try
|
||||
{
|
||||
$CAPI_Util = new COM('CAPICOM.Utilities.1');
|
||||
$pr_bits = $CAPI_Util->GetRandom($nbytes,0);
|
||||
// if we ask for binary data PHP munges it, so we
|
||||
// request base64 return value.
|
||||
$pr_bits = base64_decode($pr_bits);
|
||||
}
|
||||
catch (Exception $ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
return $pr_bits;
|
||||
}
|
Loading…
Reference in New Issue