Bug fix: correct get title function (missing ) )

git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@189 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
mensonge 2008-12-03 11:11:08 +00:00
parent 61daf84631
commit 9723a57f4c
5 changed files with 33 additions and 5 deletions

View file

@ -45,6 +45,7 @@ if ( !$currentUser->isAdmin() ) {
}
@list($url, $action, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL;
if ( $action
&& strpos($_SERVER['HTTP_REFERER'], ROOT.'admin.php') === 0 // Prevent CSRF attacks
@ -61,7 +62,10 @@ if ( $action
$bookmarkservice->deleteBookmarksForUser($uId);
$tplVars['msg'] = sprintf(T_('%s and all his bookmarks and tags were deleted.'), $user);
}
}
break;
case 'checkUrl' :
$tplVars['msg'] = checkUrl('http://fr3.php.net/manual/fr/function.get-headers.php')?"no pb": "ouille";
break;
default:
// DO NOTHING

View file

@ -43,7 +43,7 @@ function getTitle($url) {
$encoding = strtoupper($matches[1][0]);
// Convert to UTF-8 from the original encoding
if (function_exists("mb_convert_encoding") {
if (function_exists("mb_convert_encoding")) {
$title = @mb_convert_encoding($title, 'UTF-8', $encoding);
}

View file

@ -95,6 +95,19 @@ function shortenString($string, $maxSize=75) {
return $output;
}
/* Check online if a url is a valid page (Not a 404 error for example) */
function checkUrl($url) {
$h = @get_headers($url);
//look if the page doesn't return a void or 40X or 50X HTTP code error
if(is_array($h) && strpos($h[0], '40') === false && strpos($h[0], '50') === false) {
return true;
} else {
return false;
}
}
function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '', $db = NULL) {
if(defined('HAS_DIED'))
die(T_('message_die() was called multiple times.'));

View file

@ -1,4 +1,11 @@
<?php require_once('../header.inc.php');?>
<?php
if($GLOBALS['enableGoogleCustomSearch']==false) {
echo "Google Custom Search disabled. You can enable it into the config.inc.php file.";
die;
}
require_once('../header.inc.php');
?>
<!--?xml version="1.0" encoding="UTF-8" ?-->
<GoogleCustomizations>

View file

@ -23,8 +23,12 @@ foreach($users as $user) {
}
echo '</li>'."\n";
}
}
?>
<h3><?php echo T_('Check consistancy')?></h3>
<a href="<?php echo createURL('admin','checkUrl/') ?>"> <?php echo T_('Check all urls') ?></a>
<?php
$this->includeTemplate('sidebar.tpl');
$this->includeTemplate($GLOBALS['bottom_include']);