Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
diff -ru wwwcheck-0.4/index.php wwwcheck-0.41/index.php
--- wwwcheck-0.4/index.php 2005-03-03 14:54:48.000000000 +0900
+++ wwwcheck-0.41/index.php 2005-07-09 11:36:26.000000000 +0900
@@ -45,16 +45,14 @@
// measures against CSRF
if ( $post->get() ) {
$uniq_id = $post->get( 'uniq_id', '' );
- $result = Command::is_csrf( $uniq_id );
+ $result = Command::isCsrf( $uniq_id );
if ( $result ) {
Command::redirect();
exit;
}
}
else {
- $uniq_id = Command::createUniqID();
- $conf->set( 'uniq_id', $uniq_id );
- $conf->save();
+ Command::createUniqID();
}
switch ( $mode ) {
diff -ru wwwcheck-0.4/init.inc.php wwwcheck-0.41/init.inc.php
--- wwwcheck-0.4/init.inc.php 2005-03-20 01:38:02.000000000 +0900
+++ wwwcheck-0.41/init.inc.php 2005-07-17 00:32:14.000000000 +0900
@@ -1,10 +1,11 @@
addHeaders( $headers );
@@ -86,7 +86,7 @@
return $this->status;
}
- function getSubObject( $uri, $proxy )
+ function &getSubObject( $uri, $proxy )
{
$dir = dirname( __FILE__ ) . '/net/';
$arr = @parse_url( $uri );
diff -ru wwwcheck-0.4/lib/command.inc.php wwwcheck-0.41/lib/command.inc.php
--- wwwcheck-0.4/lib/command.inc.php 2005-03-03 13:54:06.000000000 +0900
+++ wwwcheck-0.41/lib/command.inc.php 2005-07-09 11:36:59.000000000 +0900
@@ -52,7 +52,7 @@
return array( 'INFO_CHANGE_SETTING', $arr['to_uri'] );
}
- function checkSite( $uri )
+ function &checkSite( $uri )
{
$conf =& Config::getInstance();
@@ -99,7 +99,30 @@
function createUniqID()
{
- return md5( uniqid( TOOL_NAME ) );
+ // TTL(time to live) 1800 sec.
+ $ttl = 1800;
+
+ $conf =& Config::getInstance();
+ $curr = time();
+ $ids = $conf->get( 'uniq_ids', array() );
+ foreach ( $ids as $id => $time ) {
+ if ( $time < $curr - $ttl ) {
+ unset( $ids[$id] );
+ }
+ else {
+ $uniq_id = $id;
+ }
+ }
+ if ( count( $ids ) < 2 ) {
+ if ( ! $ids || ( $curr - (int)( $ttl / 2 ) ) >= max( $ids ) ) {
+ $uniq_id = md5( uniqid( TOOL_NAME ) );
+ $ids[$uniq_id] = time();
+ }
+ }
+ $conf->set( 'uniq_id', $uniq_id );
+ $conf->set( 'uniq_ids', $ids );
+ $conf->save();
+ return $uniq_id;
}
function deleteItem( $uri )
@@ -221,11 +244,12 @@
return '';
}
- function is_csrf( $uniq_id )
+ function isCsrf( $uniq_id )
{
+ $ttl = 1800;
$conf =& Config::getInstance();
- $id = $conf->get( 'uniq_id' );
- if ( $uniq_id === $id ) {
+ $ids = $conf->get( 'uniq_ids' );
+ if ( isset( $ids[$uniq_id] ) && $ids[$uniq_id] > time() - $ttl ) {
return FALSE;
}
return TRUE;
diff -ru wwwcheck-0.4/lib/filters.inc.php wwwcheck-0.41/lib/filters.inc.php
--- wwwcheck-0.4/lib/filters.inc.php 2005-02-26 23:08:20.000000000 +0900
+++ wwwcheck-0.41/lib/filters.inc.php 2005-07-16 23:06:21.000000000 +0900
@@ -63,7 +63,7 @@
foreach ( $this->patterns as $patterns ) {
if ( preg_match( $patterns['domain'], $uri ) ) {
- $html =& preg_replace( $patterns['pattern'], '', $html );
+ $html = preg_replace( $patterns['pattern'], '', $html );
}
}
return $html;
diff -ru wwwcheck-0.4/update.php wwwcheck-0.41/update.php
--- wwwcheck-0.4/update.php 2005-02-26 23:08:20.000000000 +0900
+++ wwwcheck-0.41/update.php 2005-07-09 11:34:43.000000000 +0900
@@ -35,7 +35,7 @@
exit;
}
// POST only and not CSRF
- if ( ! isset( $_POST['update'] ) || ! isset( $_POST['uniq_id'] ) || Command::is_csrf( $_POST['uniq_id'] ) ) {
+ if ( ! isset( $_POST['update'] ) || ! isset( $_POST['uniq_id'] ) || Command::isCsrf( $_POST['uniq_id'] ) ) {
Command::redirect();
exit;
}
@@ -84,7 +84,7 @@
$count = 0;
$pids = array();
-$process = 7;
+$process = 6;
if ( extension_loaded( 'pcntl' ) && ( $sapi === 'cli' || $sapi === 'cgi' ) ) {
diff -ru wwwcheck-0.4/view/view_config.tpl.php wwwcheck-0.41/view/view_config.tpl.php
--- wwwcheck-0.4/view/view_config.tpl.php 2005-03-03 13:57:12.000000000 +0900
+++ wwwcheck-0.41/view/view_config.tpl.php 2005-07-16 23:06:21.000000000 +0900
@@ -10,10 +10,12 @@
$serv =& Request::getInstance( '_SERVER' );
-$top_page = $serv->get( 'PHP_SELF' );
-$filter_page = $top_page . '?mode=filter';
-$status_page = $top_page . '?mode=status';
-$config_page = $top_page . '?mode=config';
+$self = $serv->get( 'PHP_SELF' );
+
+$top_page = $self;
+$filter_page = $self . '?mode=filter';
+$status_page = $self . '?mode=status';
+$config_page = $self . '?mode=config';
$self = $config_page;
$user = $conf->isAuth() ? htmlspecialchars( $conf->get( 'user' ) ) : '';
diff -ru wwwcheck-0.4/view/view_status.tpl.php wwwcheck-0.41/view/view_status.tpl.php
--- wwwcheck-0.4/view/view_status.tpl.php 2005-03-03 13:57:12.000000000 +0900
+++ wwwcheck-0.41/view/view_status.tpl.php 2005-07-16 23:06:21.000000000 +0900
@@ -3,11 +3,13 @@
$conf =& Config::getInstance();
$cate =& Category::getInstance();
$get =& Request::getInstance( '_GET' );
+$self = $serv->get( 'PHP_SELF' );
-$top_page = $serv->get( 'PHP_SELF' );
-$filter_page = $top_page . '?mode=filter';
-$config_page = $top_page . '?mode=config';
-$setting_page = $top_page . '?mode=setting&uri=';
+$top_page = $self;
+$filter_page = $self . '?mode=filter';
+$status_page = $self . '?mode=status';
+$config_page = $self . '?mode=config';
+$setting_page = $self . '?mode=setting&uri=';
$self = $config_page;
$last = $conf->get( 'last-modified' ) ? date( "Y/m/d H:i:s", $conf->get( 'last-modified' ) ) : '';