New Feature: admin can check urls validity
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@190 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
parent
9723a57f4c
commit
b818ffae24
3 changed files with 50 additions and 4 deletions
13
admin.php
13
admin.php
|
@ -32,7 +32,9 @@ $currentUser = $userservice->getCurrentObjectUser();
|
|||
// Header variables
|
||||
$tplVars['subtitle'] = T_('Manage users');
|
||||
$tplVars['loadjs'] = true;
|
||||
$tplVars['sidebar_blocks'] = array('users' );
|
||||
$tplVars['sidebar_blocks'] = array('users' );
|
||||
$tplVars['error'] = '';
|
||||
$tplVars['msg'] = '';
|
||||
|
||||
if ( !$userservice->isLoggedOn() ) {
|
||||
header('Location: '. createURL('login', ''));
|
||||
|
@ -65,14 +67,19 @@ if ( $action
|
|||
}
|
||||
break;
|
||||
case 'checkUrl' :
|
||||
$tplVars['msg'] = checkUrl('http://fr3.php.net/manual/fr/function.get-headers.php')?"no pb": "ouille";
|
||||
$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, NULL, NULL, getSortOrder());
|
||||
foreach($bookmarks['bookmarks'] as $bookmark) {
|
||||
if(!checkUrl($bookmark['bAddress'])) {
|
||||
$tplVars['error'].= T_('Problem with ').$bookmark['bAddress'].' ('. $bookmark['username'] .')<br/>';
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// DO NOTHING
|
||||
}
|
||||
}
|
||||
|
||||
$templatename = 'userlist.tpl';
|
||||
$templatename = 'admin.tpl';
|
||||
$users =& $userservice->getObjectUsers();
|
||||
|
||||
if ( !is_array($users) ) {
|
||||
|
|
39
templates/admin.tpl.php
Normal file
39
templates/admin.tpl.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
/* Service creation: only useful services are created */
|
||||
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
||||
|
||||
$currentObjectUser = $userservice->getCurrentObjectUser();
|
||||
|
||||
$this->includeTemplate($GLOBALS['top_include']);
|
||||
|
||||
echo '<h3>'.T_('Users management').'</h3>';
|
||||
|
||||
echo '<ol id="bookmarks">';
|
||||
|
||||
foreach($users as $user) {
|
||||
echo '<li class="xfolkentry">'."\n";
|
||||
|
||||
echo '<div class="link">';
|
||||
echo '<a href="'.createURL('profile', $user->getUsername()).'">'.$user->getUsername().'</a>';
|
||||
echo '</div>';
|
||||
|
||||
if($user->getUsername() != $currentObjectUser->getUsername()) {
|
||||
echo '<div class="meta">';
|
||||
echo '<a href="'.createURL('admin','delete/'.$user->getUsername()).'" onclick="return confirm(\''.T_('Are you sure?').'\');">'.T_('Delete').'</a>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</li>'."\n";
|
||||
}
|
||||
echo '</ol>';
|
||||
?>
|
||||
<h3><?php echo T_('Other actions')?></h3>
|
||||
<p>
|
||||
<a href="<?php echo createURL('admin','checkUrl/') ?>"> <?php echo T_('Check all urls (May take some times)') ?></a>
|
||||
</p>
|
||||
<?php
|
||||
$this->includeTemplate('sidebar.tpl');
|
||||
$this->includeTemplate($GLOBALS['bottom_include']);
|
||||
|
||||
?>
|
|
@ -47,7 +47,7 @@ if(!isset($_GET['popup'])) {
|
|||
if (isset($subtitle)) {
|
||||
echo '<h2>'. $subtitle ."</h2>\n";
|
||||
}
|
||||
if (isset($error) && $msg!='') {
|
||||
if (isset($error) && $error!='') {
|
||||
echo '<p class="error">'. $error ."</p>\n";
|
||||
}
|
||||
if (isset($msg) && $msg!='') {
|
||||
|
|
Loading…
Reference in a new issue