| 29 |
* @param int 0 = no style, 1 = tabbed |
* @param int 0 = no style, 1 = tabbed |
| 30 |
*/ |
*/ |
| 31 |
function mosLoadAdminModules( $position='left', $style=0 ) { |
function mosLoadAdminModules( $position='left', $style=0 ) { |
| 32 |
global $database, $acl, $my; |
global $database, $my, $acl; |
| 33 |
|
|
| 34 |
$cache =& mosCache::getCache( 'com_content' ); |
$cache =& mosCache::getCache( 'com_content' ); |
| 35 |
|
|
| 46 |
echo "MA ".$database->stderr(true); |
echo "MA ".$database->stderr(true); |
| 47 |
return; |
return; |
| 48 |
} |
} |
| 49 |
|
if (!$modules) $modules = array(); |
| 50 |
|
|
| 51 |
switch ($style) { |
switch ($style) { |
| 52 |
case 0: |
case 0: |
| 68 |
foreach ($modules as $module) { |
foreach ($modules as $module) { |
| 69 |
$params =& new mosParameters( $module->params ); |
$params =& new mosParameters( $module->params ); |
| 70 |
$editAllComponents = $acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'components', 'all' ); |
$editAllComponents = $acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'components', 'all' ); |
| 71 |
|
// $authoriser = new mosAuthoriser($database); |
| 72 |
|
// $editAllComponents = $authoriser->checkPermission('mosUser', $my->id, 'edit', 'editAllComponents', 0); |
| 73 |
// special handling for components module |
// special handling for components module |
| 74 |
if ( $module->module != 'mod_components' || ( $module->module == 'mod_components' && $editAllComponents ) ) { |
if ( $module->module != 'mod_components' || ( $module->module == 'mod_components' && $editAllComponents ) ) { |
| 75 |
$tabs->startTab( $module->title, 'module' . $module->id ); |
$tabs->startTab( $module->title, 'module' . $module->id ); |
| 104 |
*/ |
*/ |
| 105 |
function mosLoadAdminModule( $name, $params=NULL ) { |
function mosLoadAdminModule( $name, $params=NULL ) { |
| 106 |
global $mosConfig_absolute_path, $mosConfig_live_site; |
global $mosConfig_absolute_path, $mosConfig_live_site; |
| 107 |
global $database, $acl, $my, $mainframe, $option; |
global $database, $my, $mainframe, $option, $acl; |
| 108 |
|
|
| 109 |
$task = mosGetParam( $_REQUEST, 'task', '' ); |
$task = mosGetParam( $_REQUEST, 'task', '' ); |
| 110 |
// legacy support for $act |
// legacy support for $act |
| 275 |
return $ret; |
return $ret; |
| 276 |
} |
} |
| 277 |
|
|
| 278 |
|
function &checkAdminSession (&$database) { |
| 279 |
|
// restore some session variables |
| 280 |
|
$my = new mosUser( $database ); |
| 281 |
|
$my->id = mosGetParam( $_SESSION, 'session_user_id', '' ); |
| 282 |
|
$my->username = mosGetParam( $_SESSION, 'session_username', '' ); |
| 283 |
|
$my->usertype = mosGetParam( $_SESSION, 'session_usertype', '' ); |
| 284 |
|
$my->gid = mosGetParam( $_SESSION, 'session_gid', '' ); |
| 285 |
|
|
| 286 |
|
$session_id = mosGetParam( $_SESSION, 'session_id', '' ); |
| 287 |
|
$logintime = mosGetParam( $_SESSION, 'session_logintime', '' ); |
| 288 |
|
|
| 289 |
|
// check against db record of session |
| 290 |
|
if ($session_id == md5( $my->id.$my->username.$my->usertype.$logintime )) { |
| 291 |
|
$database->setQuery( "SELECT * FROM #__session" |
| 292 |
|
. "\nWHERE session_id='$session_id'" |
| 293 |
|
. " AND username = '" . $database->getEscaped( $my->username ) . "'" |
| 294 |
|
. " AND userid = " . intval( $my->id ) |
| 295 |
|
); |
| 296 |
|
if (!$result = $database->query()) { |
| 297 |
|
echo $database->stderr(); |
| 298 |
|
} |
| 299 |
|
if ($database->getNumRows( $result ) <> 1) $my = null; |
| 300 |
|
} |
| 301 |
|
else $my = null; |
| 302 |
|
|
| 303 |
|
if ($my) { |
| 304 |
|
// update session timestamp |
| 305 |
|
$current_time = time(); |
| 306 |
|
$database->setQuery("UPDATE #__session SET time='$current_time' WHERE session_id='$session_id'"); |
| 307 |
|
$database->query(); |
| 308 |
|
// timeout old sessions |
| 309 |
|
$past = time()-1800; |
| 310 |
|
$database->setQuery( "DELETE FROM #__session WHERE time < '$past'" ); |
| 311 |
|
$database->query(); |
| 312 |
|
} |
| 313 |
|
return $my; |
| 314 |
|
} |
| 315 |
|
|
| 316 |
?> |
?> |