⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updateget.php

📁 一款基于PHP的网络日记程序。WikyBlog支持:多用户的 BLOG
💻 PHP
字号:
<?phpdefined('WikyBlog') or die("Not an entry point...");if( $_SESSION['userlevel'] !== 4){	global $page;	$page->contentA['Admin Only'] = 'You must be an administrator to access this page.';	return;}function checkLocallyUpdated(){	global $lang,$wbConfig,$wbTablePrefix,$wbTables;		echo '<h2>'.$lang['locally_modified'].'</h2>';		if(isset($_SESSION['dontUpdate'])){		unset($_SESSION['dontUpdate']);	}		$helpTable = ' `'.$wbTablePrefix.'help` ';	$query =  'SELECT lang, title, modified, summary FROM '.$helpTable.' LEFT JOIN '.$wbTables['all_files'];	$query .= ' ON '.$wbTables['all_files'].'.`file_id` = '.$helpTable.'.`file_id` ';	$query .= 'WHERE ( ISNULL(summary) OR (LOCATE("remote update",summary) = 0) ) ORDER BY lang';	$result = wbDB::runQuery($query);	$num = mysql_num_rows($result);		if( $num === 0){		echo '<p>';		echo $lang['NONE_MODIFIED_LOCALLY'].'</p>';		return;	}		echo '<p>';	echo $lang['LOCALLY_MODIFIED'];	echo '</p>';		echo '<table border="0" cellpadding="3" width="100%">';	echo '<tr><th>'.$lang['dont_update'].'</th><th>'.$lang['language'].'</th><th>'.$lang['title'].'</th><th>'.$lang['modified'].'</th><th>'.$lang['edit_summary'].'</th></tr>';	while($row = mysql_fetch_assoc($result)){		echo '<tr><td>';		echo '<input type="checkbox" value="'.htmlspecialchars($row['lang'].'/'.$row['title']).'" name="files[]" />';		echo '</td><td>';		echo $row['lang'];		echo '</td><td>';		echo $row['title'];		echo '</td><td>';		echo dbFromDate($row['modified'],1);		echo '</td><td>';		echo $row['summary'];		echo '</td></tr>';	}	echo '</table>';		return;	}function updateGetDate(){	global $rootDir,$wbConfig,$wbTablePrefix,$wbTables;	$helpTable = ' `'.$wbTablePrefix.'help` ';	$query =  'SELECT max(modified) as modified FROM '.$helpTable.' LEFT JOIN '.$wbTables['all_files'];	$query .= ' ON '.$wbTables['all_files'].'.`file_id` = '.$helpTable.'.`file_id` ';	$query .= ' WHERE (LOCATE("remote update",summary) = 1)';		$result = wbDB::runQuery($query);	$num = mysql_num_rows($result);	if($num === 1){		$row = mysql_fetch_array($result);		$_SESSION['remoteUpdate']['lastupdated'] = dbFromDate($row['modified'],'unix');		return;	}	$testFile = $rootDir.'/include/lang/en/wikyblog/_notes.txt';	if( is_file($testFile) ){		$_SESSION['remoteUpdate']['lastupdated'] = filectime($testFile); //this refers to "change" which is diff from modified..?		//$_SESSION['remoteUpdate']['lastupdated'] = filemtime($testFile);	}}function updateSetServer(){	global $softwareServer;	global $softwareMirrors,$lang;	echo $lang['CHOOSE_SERVER'];	echo ' <table border="0" cellpadding="3" cellspacing="4" width="100%">';	echo ' <tr><th>'.$lang['select'].'</th><th>'.$lang['server_address'].'</th><th>'.$lang['description'].'</th></tr>';	$i = 0;	foreach($softwareMirrors as $url => $description){		echo '<tr>';		$test = gethostbyname($url);		if($test !== $url){			$i++;			echo '<td>';			if( $i===1){				echo '<input type="radio" name="host" value="'.htmlspecialchars($url).'" checked="checked" />';			}else{				echo '<input type="radio" name="host" value="'.htmlspecialchars($url).'" />';			}			echo '</td><td>';			echo 'http://'.$url;			echo '</td><td>';			echo $description;			echo '</td>';		}		echo '</tr>';	}	echo '</table>';	if($i === 0){		ECHO $lang['NO_REMOTE_SERVER'];		return;	}	updateGetDate();		if( !empty($_SESSION['remoteUpdate']['lastupdated']) ){		echo '<h2>'.$lang['last_update'].'</h2>';		echo $lang['LAST_UPDATE_ON'];		$format = "l, F j, Y";		echo date($format,$_SESSION['remoteUpdate']['lastupdated']);	}		checkLocallyUpdated();		echo '<br/><input type="submit" name="submit" value="'.$lang['continue'].'" />';}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////		Modified From toolOptions.php//class remoteUpdate{	var $currentTag;	var $currentId;	var $currentContent;	function remoteUpdate(){		global $page,$dbObject,$softwareServer,$lang, $wbConfig;		echo '<h2>'.$lang['updating_files'].'</h2>';				//Session Vars		if( isset($_POST['host']) ){			$_SESSION['remoteUpdate']['host'] = 'http://'.$_POST['host'];		}		if( empty($_SESSION['remoteUpdate']['host']) ){			echo $lang['SELECT_SERVER'];			echo '<input type="submit" name="submit" value="'.$lang['back'].'" />';			return;		}		if( !isset($_SESSION['remoteUpdate']['count']) ){			$_SESSION['remoteUpdate']['count'] = 0;		}		//Remote Url to Request		$file = $_SESSION['remoteUpdate']['host'].'/index.php/special/main/sendupdate?raw=1&v=2';		$file .= '&offset='.$_SESSION['remoteUpdate']['count'];				if( isset($_SESSION['remoteUpdate']['lastupdated']) ){			$file .= '&m='.$_SESSION['remoteUpdate']['lastupdated'];			$file .= '&t='.time();		}		if( isset($_SESSION['dontUpdate']) && is_array($_SESSION['dontUpdate']) ){			foreach($_SESSION['dontUpdate'] as $x){				$file .= '&f[]='.rawurlencode($x);			}		}						//Get the remote file		//echo '<h3>'.$file.'</h3>';		$rawContent = file_get_contents($file);		parse_str($rawContent,$array);		if( isset($array['error']) ){			echo $lang['UPDATE_SOFTWARE'];			return;		}					//echo showArray($array);				$_SESSION['remoteUpdate']['rowsFound'] = (int)$array['rowsFound'];		unset($array['rowsFound']);				//Batch		includeFile('tool/BatchObject.php');		includeFile('tool/SavePage.php');		if( !batchSetObject('help') ){			trigger_error('Error setting batch object');			return;		}				$_POST['summary'] = $lang['remote_update_from'].$softwareServer;		foreach($array as $num => $values){			$values['owner'] = $GLOBALS['wbAdminUser'];			//echo '<hr/>'. showArray($values);			//batchSetCase($values);			batchSetCase($values,'save');			$_SESSION['remoteUpdate']['count']++;		}				if( empty($_SESSION['remoteUpdate']['rowsFound']) ){			echo '<p>'.$lang['ALL_FILES_DONE'].'</p>';			$this->finish();			echo '<input type="submit" name="submit" value="'.$lang['start_over'].'" /> ';			return;		}		echo '<p>';		echo wbLang::text('NUM_FILES_DONE',$_SESSION['remoteUpdate']['count'],$_SESSION['remoteUpdate']['rowsFound']);		echo '</p>';		if( $_SESSION['remoteUpdate']['count'] === $_SESSION['remoteUpdate']['rowsFound'] ){			$this->finish();		}else{			echo '<input type="submit" name="submit" value="'.$lang['continue'].'" /> ';		}				echo '<input type="submit" name="submit" value="'.$lang['start_over'].'" /> ';	}	function finish(){		global $lang;		echo '<p>'.$lang['REMOTE_UPDATE_DONE'].'</p>';		unset($_SESSION['remoteUpdate']);		unset($_SESSION['dontUpdate']);	}}//		End Class//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////			FLOW CONTROL//global $pageOwner,$dbInfo,$dbObject,$lang,$wbConfig;global $serverName3,$softwareServer,$softwareMirrors;$page->formAction = $dbObject->links['Remote Update'] = '/Admin/'.$pageOwner['username'].'/remoteupdate';$dbObject->links['?'] = 'Admin';$page->displayTitle = $lang['remote_update'];///	URL_FOPEN	if( (int)ini_get('allow_url_fopen') !==1){		echo $lang['PHP_CONFIG_URL_FOPEN'];		return;	}///	$softwareMirrors	//	$softwareMirrors[] = '/home/wikyblog/public_html/include';	$softwareMirrors = array();	$softwareMirrors['wikyblog.loc']	= 'Used for development and normally won\'t be shown.';	$softwareMirrors['wikyblog2']	= 'Used for development and normally won\'t be shown.';	$softwareMirrors[$softwareServer] = $lang['DEFAULT_SERVER'];///	User Agent	$userAgent = ini_get('user_agent');	if(!empty($userAgent) ){		$userAgent = ' :: '.$userAgent;	}	ini_set('user_agent','WikyBlog Software @ '.$serverName3.$userAgent);/// Exclude Files	if( isset($_POST['files']) && is_array($_POST['files']) ){		foreach($_POST['files'] as $file){			$_SESSION['dontUpdate'][] = str_replace('wikyblog/','',wbStrtolower($file));		}	}	$which = '';	if( isset($_POST['submit']) ){		$which = $_POST['submit'];	}	switch($which){		case $lang['continue']:			$test = new remoteUpdate();		break;		case $lang['start_over']:		default:			$_SESSION['remoteUpdate']['count'] = 0;			echo $lang['REMOTE_UPDATE_INTRO'];			updateSetServer();		break;	}	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -