diff options
| author | lsces <lester@lsces.co.uk> | 2025-08-29 13:32:48 +0100 |
|---|---|---|
| committer | lsces <lester@lsces.co.uk> | 2025-08-29 13:32:48 +0100 |
| commit | 2b142f64b1f556fd7d49c871d1a48f9bd31b9698 (patch) | |
| tree | 19d2120e58aba52e0a24de96762b65027ec5803e /admin | |
| parent | f617a4aa0b104fe77ce14dbc04da1a72fd068eb3 (diff) | |
| download | kernel-2b142f64b1f556fd7d49c871d1a48f9bd31b9698.tar.gz kernel-2b142f64b1f556fd7d49c871d1a48f9bd31b9698.tar.bz2 kernel-2b142f64b1f556fd7d49c871d1a48f9bd31b9698.zip | |
Admin functions changes to cover uninitialized variables and style changes for PHP8.4
Diffstat (limited to 'admin')
| -rwxr-xr-x[-rw-r--r--] | admin/admin_features_inc.php | 91 | ||||
| -rwxr-xr-x[-rw-r--r--] | admin/admin_notifications.php | 41 | ||||
| -rwxr-xr-x[-rw-r--r--] | admin/admin_packages_inc.php | 12 | ||||
| -rwxr-xr-x[-rw-r--r--] | admin/admin_server_inc.php | 13 | ||||
| -rwxr-xr-x[-rw-r--r--] | admin/admin_system.php | 135 | ||||
| -rwxr-xr-x[-rw-r--r--] | admin/apc.php | 1545 | ||||
| -rwxr-xr-x[-rw-r--r--] | admin/backup.php | 19 | ||||
| -rwxr-xr-x[-rw-r--r--] | admin/browscap.ini | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | admin/db_performance.php | 13 | ||||
| -rwxr-xr-x[-rw-r--r--] | admin/index.php | 22 | ||||
| -rwxr-xr-x[-rw-r--r--] | admin/list_cache.php | 10 | ||||
| -rwxr-xr-x[-rw-r--r--] | admin/mime.types | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | admin/phpinfo.php | 3 | ||||
| -rwxr-xr-x[-rw-r--r--] | admin/remote_backup.php | 8 | ||||
| -rwxr-xr-x[-rw-r--r--] | admin/schema_inc.php | 116 | ||||
| -rwxr-xr-x[-rw-r--r--] | admin/sitemaps.php | 9 |
16 files changed, 1000 insertions, 1037 deletions
diff --git a/admin/admin_features_inc.php b/admin/admin_features_inc.php index ea13fc1..6ebadc3 100644..100755 --- a/admin/admin_features_inc.php +++ b/admin/admin_features_inc.php @@ -1,89 +1,93 @@ <?php // $Header$ -$formBit = array( - 'pretty_urls' => array( +$formBit = [ + 'pretty_urls' => [ 'label' => 'Use Pretty URLs', 'note' => 'In addition to making the URL easier to read and remember it enhances search engine results. Using this feature requires Apache <a href="http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html">mod_rewrite</a> support in the web server (usually installed by default), Depending on the Web server configuration, it may be necessary to modify the default .htaccess files when using this feature.', 'page' => 'PrettyUrls', - ), - 'pretty_urls_extended' => array( + ], + 'pretty_urls_extended' => [ 'label' => 'Use Extended Pretty URLs', 'note' => 'In addition to making the URL easier to read and remember it enhances search engine results. Using this feature requires Apache <a href="http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html">mod_rewrite</a> support in the web server (usually installed by default), This extended version adds a /view tag to the URLs to make them unambigious for rewrites. It will be necessary to modify the default .htaccess files when using this feature.', 'page' => 'FeaturePrettyUrlsExtended', - ), -); + ], +]; $gBitSmarty->assign( 'formBit',$formBit ); -$formHelp = array( - 'site_edit_help' => array( +$formHelp = [ + 'site_edit_help' => [ 'label' => 'Input Help', 'note' => 'Displays <strong>extensive</strong> (about 50kb) help regarding the syntax of available format plugins (e.g., Tikiwiki and HTML), and of available Data Plugins (e.g., attachment, include, table of contents). Explanations and examples are shown near any suitable entry form.', - ), - 'site_form_help' => array( + 'page' => '', + ], + 'site_form_help' => [ 'label' => 'Help Notes', 'note' => 'Show inline help notes in forms such as the one you are reading now.', - ), - 'site_help_popup' => array( + 'page' => '', + ], + 'site_help_popup' => [ 'label' => 'Popup for Help Notes', 'note' => 'This will place a clickable icon after form elements for the extended help information.', - ), - 'site_online_help' => array( + 'page' => '', + ], + 'site_online_help' => [ 'label' => 'Online Help Links', 'note' => 'Display links to relevant online help pages found on www.bitweaver.org.', - ), -); + 'page' => '', + ], +]; $gBitSmarty->assign( 'formHelp',$formHelp ); -$extendedHeader = array( - 'site_header_extended_nav' => array( +$extendedHeader = [ + 'site_header_extended_nav' => [ 'label' => 'Enable Header Navigation', 'note' => 'This feature will add a number of useful links to the <head> section. These will help improve accessibility on this site.', 'type' => 'checkbox', - ), - 'site_header_help' => array( + ], + 'site_header_help' => [ 'label' => 'Help Link', 'note' => 'Enter the URL of where you want the help link to point to.', 'type' => 'text', - ), - 'site_header_index' => array( + ], + 'site_header_index' => [ 'label' => 'Site Index', 'note' => 'This URL should point to a site index of your website.', 'type' => 'text', - ), - 'site_header_contents' => array( + ], + 'site_header_contents' => [ 'label' => 'Site Contents', 'note' => 'This URL should point to a site map of your website.', 'type' => 'text', - ), - 'site_header_copyright' => array( + ], + 'site_header_copyright' => [ 'label' => 'Site Copyright', 'note' => 'This link should point to a page with copyright information.', 'type' => 'text', - ), - 'site_header_glossary' => array( + ], + 'site_header_glossary' => [ 'label' => 'Site Glossary', 'note' => 'This link should point to a page with a glossary of terms.', 'type' => 'text', - ), -); + ], +]; $gBitSmarty->assign( 'extendedHeader',$extendedHeader ); -$formMisc = array( - 'site_direct_pagination' => array( +$formMisc = [ + 'site_direct_pagination' => [ 'label' => 'Use direct pagination links', 'note' => 'Use direct pagination links instead of the small pagination box. Links are cleverly generated depending on the number of pages available.', - ), - 'site_output_obzip' => array( + ], + 'site_output_obzip' => [ 'label' => 'Use gzipped output', 'note' => 'Send gzip compressed data via PHP\'s output compression to browsers that support it. This feature will reduce download times and bandwidth consumption. Use it only if your server has no such mechanism enabled already (e.g., Apache\'s output compression).', - ), + ], // want to remove this setting. we use addHit() which is clever - 'users_count_admin_pageviews' => array( + 'users_count_admin_pageviews' => [ 'label' => 'Count admin pageviews', 'note' => '', - ), -); + ], +]; $gBitSmarty->assign( 'formMisc',$formMisc ); if( !empty( $_REQUEST['change_prefs'] ) ) { @@ -96,10 +100,10 @@ if( !empty( $_REQUEST['change_prefs'] ) ) { } } - $simpleValues = array( + $simpleValues = [ "max_records", "site_url_index", - ); + ]; foreach( $simpleValues as $svitem ) { simple_set_value( $svitem, KERNEL_PKG_NAME ); @@ -112,7 +116,7 @@ if( !empty( $_REQUEST['change_prefs'] ) ) { $_REQUEST["bit_index"] = $_REQUEST["site_url_index"]; } - $refValue = array( + $refValue = [ "site_long_date_format", "site_long_time_format", "site_short_date_format", @@ -120,7 +124,7 @@ if( !empty( $_REQUEST['change_prefs'] ) ) { "site_long_datetime_format", "site_short_datetime_format", "bit_index" - ); + ]; foreach( $refValue as $britem ) { byref_set_value( $britem, "", KERNEL_PKG_NAME ); @@ -128,8 +132,7 @@ if( !empty( $_REQUEST['change_prefs'] ) ) { } if ( defined( 'ROLE_MODEL' ) ) { - $gBitSmarty->assign( "role_model", TRUE ); + $gBitSmarty->assign( "role_model", true ); } $gBitSystem->setHelpInfo('Features','Settings','Help with the features settings'); -?> diff --git a/admin/admin_notifications.php b/admin/admin_notifications.php index 7fd7a31..51cc7d7 100644..100755 --- a/admin/admin_notifications.php +++ b/admin/admin_notifications.php @@ -7,9 +7,9 @@ // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details. // Initialization -require_once( '../../kernel/includes/setup_inc.php' ); +require_once '../../kernel/includes/setup_inc.php'; -include_once( KERNEL_PKG_INCLUDE_PATH.'notification_lib.php' ); +include_once KERNEL_PKG_INCLUDE_PATH.'notification_lib.php'; // Check for admin permission $gBitSystem->verifyPermission( 'p_admin' ); @@ -17,7 +17,7 @@ $gBitSystem->verifyPermission( 'p_admin' ); if (isset($_REQUEST["add"])) { if (isset($_REQUEST["email"]) && !empty($_REQUEST["email"])) - $notificationlib->add_mail_event($_REQUEST["event"], '*', $_REQUEST["email"]); + $notificationlib->add_mail_event($_REQUEST["event"], ['*'], $_REQUEST["email"]); } if (isset($_REQUEST["removeevent"])) { @@ -25,34 +25,21 @@ if (isset($_REQUEST["removeevent"])) { $notificationlib->remove_mail_event($_REQUEST["removeevent"], $_REQUEST["object"], $_REQUEST["email"]); } -if ( empty( $_REQUEST["sort_mode"] ) ) { - $sort_mode = 'event_asc'; -} else { - $sort_mode = $_REQUEST["sort_mode"]; -} - -if (!isset($_REQUEST["offset"])) { - $offset = 0; -} else { - $offset = $_REQUEST["offset"]; -} +$sort_mode = $_REQUEST["sort_mode"] ?? 'event_asc'; +$offset = $_REQUEST["offset"] ?? 0; -$gBitSmarty->assignByRef('offset', $offset); +$gBitSmarty->assign('offset', $offset); -if (isset($_REQUEST["find"])) { - $find = $_REQUEST["find"]; -} else { - $find = ''; -} +$find = $_REQUEST["find"] = ''; $gBitSmarty->assign('find', $find); -$gBitSmarty->assignByRef('sort_mode', $sort_mode); +$gBitSmarty->assign('sort_mode', $sort_mode); $channels = $notificationlib->list_mail_events($offset, $max_records, $sort_mode, $find); $cant_pages = ceil($channels["cant"] / $max_records); -$gBitSmarty->assignByRef('cant_pages', $cant_pages); -$gBitSmarty->assign('actual_page', 1 + ($offset / $max_records)); +$gBitSmarty->assign('cant_pages', $cant_pages); +$gBitSmarty->assign('actual_page', 1 + $offset / $max_records); if ($channels["cant"] > ($offset + $max_records)) { $gBitSmarty->assign('next_offset', $offset + $max_records); @@ -67,15 +54,13 @@ if ($offset > 0) { $gBitSmarty->assign('prev_offset', -1); } -$gBitSmarty->assignByRef('channels', $channels["data"]); +$gBitSmarty->assign('channels', $channels["data"]); -$gBitSmarty->assignByRef('events', $gBitSystem->mNotifyEvents); +$gBitSmarty->assign('events', $gBitSystem->mNotifyEvents); $admin_mail=$admin_mail=$gBitUser->mInfo['email']; $cuser_mail=$gBitUser->mInfo['email']; $gBitSmarty->assign('admin_mail', $admin_mail); $gBitSmarty->assign('cuser_mail', $cuser_mail); // Display the template -$gBitSystem->display( 'bitpackage:kernel/admin_notifications.tpl', NULL, array( 'display_mode' => 'admin' )); - -?> +$gBitSystem->display( 'bitpackage:kernel/admin_notifications.tpl', null, array( 'display_mode' => 'admin' )); diff --git a/admin/admin_packages_inc.php b/admin/admin_packages_inc.php index c37f88d..11faa4c 100644..100755 --- a/admin/admin_packages_inc.php +++ b/admin/admin_packages_inc.php @@ -11,14 +11,14 @@ $fPackage = &$_REQUEST['fPackage']; // emulate register_globals # rescan to include all packages, installed and not installed $gBitSystem->scanPackages( - 'bit_setup_inc.php', TRUE, 'all', TRUE, TRUE + 'bit_setup_inc.php', true, 'all', true, true ); // make a copy of mPackages - expensive, but this is low use code if( !empty( $_REQUEST['features'] ) ) { $pkgArray = $gBitSystem->mPackages; - foreach( array_keys( $pkgArray ) as $pkgKey ) { + foreach( array_keys( $pkgArray ) as $pkgKey ) { $pkg = $pkgArray[$pkgKey]; if( !empty( $pkg['name'] )) { $pkgName = strtolower( $pkg['name'] ); @@ -41,10 +41,10 @@ if( !empty( $_REQUEST['features'] ) ) { global $gBitInstaller; $gBitInstaller = &$gBitSystem; $gBitInstaller->verifyInstalledPackages(); -$gBitSmarty->assign( 'requirements', $gBitInstaller->calculateRequirements( TRUE ) ); -$gBitSmarty->assign( 'requirementsMap', $gBitInstaller->drawRequirementsGraph( TRUE, 'cmapx' )); +$gBitSmarty->assign( 'requirements', $gBitInstaller->calculateRequirements( true ) ); +$gBitSmarty->assign( 'requirementsMap', $gBitInstaller->drawRequirementsGraph( true, 'cmapx' )); -$upgradable = array(); +$upgradable = []; foreach( $gBitSystem->mPackages as $name => &$pkg ) { if( $gBitSystem->isPackageInstalled( $name ) && !empty( $pkg['info']['upgrade'] )) { // If no tables then just do a quiet 'auto-upgrade' of version number @@ -60,8 +60,8 @@ foreach( $gBitSystem->mPackages as $name => &$pkg ) { } } } + $gBitSmarty->assign( 'upgradable', $upgradable ); // So packages will be listed in alphabetical order ksort( $gBitSystem->mPackages ); -?> diff --git a/admin/admin_server_inc.php b/admin/admin_server_inc.php index dfb588e..98630cd 100644..100755 --- a/admin/admin_server_inc.php +++ b/admin/admin_server_inc.php @@ -56,9 +56,9 @@ if( $processForm ) { $keywords = str_split( $_REQUEST['site_keywords'], 250 ); // we need to make sure we remove all settings for site_keywords first in case the new value is considerably shorter than the previous one - $gBitSystem->storeConfig( 'site_keywords_1', NULL ); - $gBitSystem->storeConfig( 'site_keywords_2', NULL ); - $gBitSystem->storeConfig( 'site_keywords_3', NULL ); + $gBitSystem->storeConfig( 'site_keywords_1', null ); + $gBitSystem->storeConfig( 'site_keywords_2', null ); + $gBitSystem->storeConfig( 'site_keywords_3', null ); foreach( $keywords as $key => $chunk ) { $gBitSystem->storeConfig( "site_keywords".( !empty( $key ) ? '_'.$key : '' ), $chunk, KERNEL_PKG_NAME ); @@ -76,12 +76,11 @@ if( $processForm ) { // Special handling for site_temp_dir, which has a default value if( isset( $_REQUEST["site_temp_dir"] ) && $_REQUEST["site_temp_dir"] != TEMP_PKG_PATH ) { $gBitSystem->storeConfig( "site_temp_dir", $_REQUEST["site_temp_dir"], KERNEL_PKG_NAME ); - $gBitSmarty->assignByRef( "site_temp_dir", $_REQUEST["site_temp_dir"] ); + $gBitSmarty->assign( "site_temp_dir", $_REQUEST["site_temp_dir"] ); } // Special handling for centralissed_upload_dir, which has a default value - $centralDir = ( !empty( $_REQUEST["site_upload_dir"] ) ? $_REQUEST["site_upload_dir"] : NULL ); + $centralDir = !empty( $_REQUEST["site_upload_dir"] ) ? $_REQUEST["site_upload_dir"] : null; $gBitSystem->storeConfig( "site_upload_dir", $centralDir , KERNEL_PKG_NAME ); - $gBitSmarty->assignByRef( "site_upload_dir", $centralDir ); + $gBitSmarty->assign( "site_upload_dir", $centralDir ); } -?> diff --git a/admin/admin_system.php b/admin/admin_system.php index f3a2d0f..e474581 100644..100755 --- a/admin/admin_system.php +++ b/admin/admin_system.php @@ -5,59 +5,62 @@ // All Rights Reserved. See below for details and a complete list of authors. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details. -require_once( '../../kernel/includes/setup_inc.php' ); +namespace Bitweaver\Liberty; +require_once '../../kernel/includes/setup_inc.php'; +use Bitweaver\KernelTools; +use Bitweaver\Nexus\Nexus; $gBitSystem->verifyPermission( 'p_admin' ); -$feedback = array(); +$feedback = []; -$diskUsage = array( - 'templates_c' => array( +$diskUsage = [ + 'templates_c' => [ 'path' => TEMP_PKG_PATH.'templates_c', - 'title' => tra( 'Templates' ), - ), - 'lang' => array( + 'title' => KernelTools::tra( 'Templates' ), + ], + 'lang' => [ 'path' => TEMP_PKG_PATH.'lang', - 'title' => tra( 'Language Files' ), - ), - 'shoutbox' => array( + 'title' => KernelTools::tra( 'Language Files' ), + ], + 'shoutbox' => [ 'path' => TEMP_PKG_PATH.'shoutbox', - 'title' => tra( 'Shoutbox' ), - ), - 'modules' => array( + 'title' => KernelTools::tra( 'Shoutbox' ), + ], + 'modules' => [ 'path' => TEMP_PKG_PATH.'modules/cache', - 'title' => tra( 'Modules' ), + 'title' => KernelTools::tra( 'Modules' ), 'subdir' => $bitdomain, - ), - 'cache' => array( + ], + 'cache' => [ 'path' => TEMP_PKG_PATH.'cache', - 'title' => tra( 'System Cache' ), + 'title' => KernelTools::tra( 'System Cache' ), 'subdir' => $bitdomain, - ), - 'icons' => array( + ], + 'icons' => [ 'path' => TEMP_PKG_PATH.'themes/biticon', - 'title' => tra( 'Icons' ), - ), - 'liberty_cache' => array( + 'title' => KernelTools::tra( 'Icons' ), + ], + 'liberty_cache' => [ 'path' => TEMP_PKG_PATH.'liberty/cache', - 'title' => tra( 'Liberty Cache' ), - ), - 'format_help' => array( + 'title' => KernelTools::tra( 'Liberty Cache' ), + ], + 'format_help' => [ 'path' => TEMP_PKG_PATH.'liberty/help', - 'title' => tra( 'Format Help' ), - ), - 'nexus' => array( + 'title' => KernelTools::tra( 'Format Help' ), + ], + 'nexus' => [ 'path' => TEMP_PKG_PATH.'nexus', - 'title' => tra( 'Nexus Menus' ), - ), - 'rss' => array( + 'title' => KernelTools::tra( 'Nexus Menus' ), + ], + 'rss' => [ 'path' => TEMP_PKG_PATH.'rss', - 'title' => tra( 'RSS Feed Cache' ), - ), - 'javascript' => array( + 'title' => KernelTools::tra( 'RSS Feed Cache' ), + ], + 'javascript' => [ 'path' => STORAGE_PKG_PATH.'themes', - 'title' => tra( 'Javascript and CSS files' ), - ), -); + 'title' => KernelTools::tra( 'Javascript and CSS files' ), + ], +]; /* make sure we only display paths that exist foreach( $diskUsage as $key => $item ) { @@ -67,7 +70,7 @@ foreach( $diskUsage as $key => $item ) { }*/ if( !empty( $_GET['pruned'] )) { - $feedback['success'] = tra( 'The cache was successfully cleared.' ); + $feedback['success'] = KernelTools::tra( 'The cache was successfully cleared.' ); } if( !empty( $_GET['prune'] ) ) { @@ -75,10 +78,10 @@ if( !empty( $_GET['prune'] ) ) { if( $_GET['prune'] == $key || $_GET['prune'] == 'all' ) { $dir = $item['path'].( !empty( $item['subdir'] ) ? '/'.$item['subdir'] : '' ); if( is_dir( $dir ) && strpos( $item['path'], BIT_ROOT_PATH ) === 0 ) { - if( unlink_r( $dir )) { - $reload = TRUE; + if( KernelTools::unlink_r( $dir )) { + $reload = true; } else { - $feedback['error'] = tra( 'There was a problem clearing out the cache.' ); + $feedback['error'] = KernelTools::tra( 'There was a problem clearing out the cache.' ); } } } @@ -86,14 +89,13 @@ if( !empty( $_GET['prune'] ) ) { // nexus needs to rewrite the cache right away to avoid errors if( $gBitSystem->isPackageActive( 'nexus' ) && ( $_GET['prune'] == 'all' || $_GET['prune'] == 'nexus' )) { - require_once( NEXUS_PKG_CLASS_PATH.'Nexus.php' ); $nexus = new Nexus(); $nexus->rewriteMenuCache(); } // depending on what we've just nuked, we need to reload the page if( !empty( $reload )) { - bit_redirect( KERNEL_PKG_URL."admin/admin_system.php?pruned=1" ); + KernelTools::bit_redirect( KERNEL_PKG_URL."admin/admin_system.php?pruned=1" ); } } @@ -107,43 +109,41 @@ foreach( $diskUsage as $key => $item ) { $gBitSmarty->assign( 'diskUsage', $diskUsage ); -$languages = array(); +$languages = []; $languages = $gBitLanguage->listLanguages(); ksort( $languages ); -$templates = array(); +$templates = []; $langdir = TEMP_PKG_PATH."templates_c/".$gBitSystem->getConfig('style')."/"; foreach( array_keys( $languages ) as $clang ) { - if( is_dir( $langdir.$clang ) ) { - $templates[$clang] = array( + $templates[$clang] = is_dir( $langdir.$clang ) + ? [ 'path' => TEMP_PKG_PATH."templates_c/".$gBitSystem->getConfig( 'style' )."/", 'title' => $languages[$clang]['full_name'], 'du' => du( $langdir.$clang ), - ); - } else { - $templates[$clang] = array( + ] + : [ 'path' => TEMP_PKG_PATH."templates_c/".$gBitSystem->getConfig( 'style' )."/", 'title' => $languages[$clang]['full_name'], - 'du' => array( + 'du' => [ "count" => 0, "size" => 0, - ), - ); - } + ], + ]; } $gBitSmarty->assign( 'templates', $templates ); $gBitSmarty->assign( 'feedback', $feedback ); -$gBitSystem->display( 'bitpackage:kernel/admin_system.tpl', tra( "System Cache" ) , array( 'display_mode' => 'admin' )); +$gBitSystem->display( 'bitpackage:kernel/admin_system.tpl', KernelTools::tra( "System Cache" ) , [ 'display_mode' => 'admin' ] ); // {{{ Functions /** * du * - * @param array $pPath + * @param string $pPath * @access public - * @return boolean TRUE on success, FALSE on failure - $this->mErrors will contain reason for failure + * @return array */ function du( $pPath ) { $size = $count = 0; @@ -155,7 +155,7 @@ function du( $pPath ) { } $all = opendir( $pPath ); - while( FALSE !== ( $file = readdir( $all ) ) ) { + while( false !== ( $file = readdir( $all ) ) ) { if( $file <> ".." and $file <> "." and $file <> "CVS" ) { if( is_file( $pPath.'/'.$file ) ) { $size += filesize( $pPath.'/'.$file ); @@ -180,21 +180,21 @@ function du( $pPath ) { /** * cache_templates * - * @param array $pPath - * @param array $pOldLang - * @param array $pNewLang + * @param string $pPath + * @param string $pOldLang + * @param string $pNewLang * @access public - * @return boolean TRUE on success, FALSE on failure - $this->mErrors will contain reason for failure + * @return bool true on success, false on failure - $this->mErrors will contain reason for failure */ function cache_templates( $pPath, $pOldLang, $pNewLang ) { global $gBitLanguage, $gBitSmarty; if( !$pPath or !is_dir( $pPath ) ) { - return 0; + return false; } if( $dir = opendir( $pPath ) ) { - while( FALSE !== ( $file = readdir( $dir ) ) ) { + while( false !== ( $file = readdir( $dir ) ) ) { $a = explode( ".", $file ); $ext = strtolower( end( $a ) ); if( substr( $file, 0, 1 ) == "." or $file == 'CVS' ) { @@ -203,7 +203,7 @@ function cache_templates( $pPath, $pOldLang, $pNewLang ) { if( is_dir( $pPath."/".$file ) ) { cache_templates( $pPath."/".$file, $pOldLang, $pNewLang ); - } else { +/* } else { if( $ext == "tpl" ) { $file = str_replace( '//', '/', $pPath."/".$file ); $gBitLanguage->setLanguage( $pNewLang ); @@ -215,11 +215,10 @@ function cache_templates( $pPath, $pOldLang, $pNewLang ) { $gBitSmarty->_compile_resource( $file, $comppath ); } } +*/ } } closedir( $dir ); } + return true; } -// }}} -// vim: set fdm=marker : -?> diff --git a/admin/apc.php b/admin/apc.php index e0accd6..b416a04 100644..100755 --- a/admin/apc.php +++ b/admin/apc.php @@ -22,6 +22,8 @@ */ +$VERSION='$Id$'; + require_once( '../../kernel/includes/setup_inc.php' ); global $gBitUser; @@ -33,24 +35,24 @@ if (file_exists("apc.conf.php")) include("apc.conf.php"); ////////// BEGIN OF DEFAULT CONFIG AREA /////////////////////////////////////////////////////////// -defaults('USE_AUTHENTICATION',0); // Use (internal) authentication - best choice if - // no other authentication is available - // If set to 0: - // There will be no further authentication. You - // will have to handle this by yourself! - // If set to 1: - // You need to change ADMIN_PASSWORD to make - // this work! -defaults('ADMIN_USERNAME','apc'); // Admin Username -defaults('ADMIN_PASSWORD','password'); // Admin Password - CHANGE THIS TO ENABLE!!! +defaults('USE_AUTHENTICATION',0); // Use (internal) authentication - best choice if + // no other authentication is available + // If set to 0: + // There will be no further authentication. You + // will have to handle this by yourself! + // If set to 1: + // You need to change ADMIN_PASSWORD to make + // this work! +defaults('ADMIN_USERNAME','apc'); // Admin Username +defaults('ADMIN_PASSWORD','password'); // Admin Password - CHANGE THIS TO ENABLE!!! // (beckerr) I'm using a clear text password here, because I've no good idea how to let // users generate a md5 or crypt password in a easy way to fill it in above -//defaults('DATE_FORMAT', "d.m.Y H:i:s"); // German -defaults('DATE_FORMAT', 'Y/m/d H:i:s'); // US +//defaults('DATE_FORMAT', "d.m.Y H:i:s"); // German +defaults('DATE_FORMAT', 'Y/m/d H:i:s'); // US -defaults('GRAPH_SIZE',200); // Image size +defaults('GRAPH_SIZE',200); // Image size //defaults('PROXY', 'tcp://127.0.0.1:8080'); @@ -59,7 +61,7 @@ defaults('GRAPH_SIZE',200); // Image size // "define if not defined" function defaults($d,$v) { - if (!defined($d)) define($d,$v); // or just @define(...) + if (!defined($d)) define($d,$v); // or just @define(...) } // rewrite $PHP_SELF to block XSS attacks @@ -69,7 +71,7 @@ $time = time(); $host = php_uname('n'); if($host) { $host = '('.$host.')'; } if (isset($_SERVER['SERVER_ADDR'])) { - $host .= ' ('.$_SERVER['SERVER_ADDR'].')'; + $host .= ' ('.$_SERVER['SERVER_ADDR'].')'; } // operation constants @@ -79,117 +81,116 @@ define('OB_VERSION_CHECK',3); // check validity of input variables $vardom=array( - 'OB' => '/^\d+$/', // operational mode switch - 'CC' => '/^[01]$/', // clear cache requested - 'DU' => '/^.*$/', // Delete User Key - 'SH' => '/^[a-z0-9]+$/', // shared object description + 'OB' => '/^\d+$/', // operational mode switch + 'CC' => '/^[01]$/', // clear cache requested + 'DU' => '/^.*$/', // Delete User Key + 'SH' => '/^[a-z0-9]+$/', // shared object description - 'IMG' => '/^[123]$/', // image to generate - 'LO' => '/^1$/', // login requested + 'IMG' => '/^[123]$/', // image to generate + 'LO' => '/^1$/', // login requested - 'COUNT' => '/^\d+$/', // number of line displayed in list - 'SCOPE' => '/^[AD]$/', // list view scope - 'SORT1' => '/^[AHSMCDTZ]$/', // first sort key - 'SORT2' => '/^[DA]$/', // second sort key - 'AGGR' => '/^\d+$/', // aggregation by dir level - 'SEARCH' => '/^.*$/' // search regex + 'COUNT' => '/^\d+$/', // number of line displayed in list + 'SCOPE' => '/^[AD]$/', // list view scope + 'SORT1' => '/^[AHSMCDTZ]$/', // first sort key + 'SORT2' => '/^[DA]$/', // second sort key + 'AGGR' => '/^\d+$/', // aggregation by dir level + 'SEARCH' => '~^[a-zA-Z0-9/_.-]*$~' // aggregation by dir level ); // cache scope $scope_list=array( - 'A' => 'cache_list', - 'D' => 'deleted_list' + 'A' => 'cache_list', + 'D' => 'deleted_list' ); // handle POST and GET requests if (empty($_REQUEST)) { - if (!empty($_GET) && !empty($_POST)) { - $_REQUEST = array_merge($_GET, $_POST); - } else if (!empty($_GET)) { - $_REQUEST = $_GET; - } else if (!empty($_POST)) { - $_REQUEST = $_POST; - } else { - $_REQUEST = array(); - } + if (!empty($_GET) && !empty($_POST)) { + $_REQUEST = array_merge($_GET, $_POST); + } else if (!empty($_GET)) { + $_REQUEST = $_GET; + } else if (!empty($_POST)) { + $_REQUEST = $_POST; + } else { + $_REQUEST = []; + } } // check parameter syntax foreach($vardom as $var => $dom) { - if (!isset($_REQUEST[$var])) { - $MYREQUEST[$var]=null; - } else if (!is_array($_REQUEST[$var]) && preg_match($dom.'D',$_REQUEST[$var])) { - $MYREQUEST[$var]=$_REQUEST[$var]; - } else { - $MYREQUEST[$var]=$_REQUEST[$var]=null; - } + if (!isset($_REQUEST[$var])) { + $MYREQUEST[$var]=null; + } else if (!is_array($_REQUEST[$var]) && preg_match($dom.'D',$_REQUEST[$var])) { + $MYREQUEST[$var]=$_REQUEST[$var]; + } else { + $MYREQUEST[$var]=$_REQUEST[$var]=null; + } } -// check parameter semantics +// check parameter sematics if (empty($MYREQUEST['SCOPE'])) $MYREQUEST['SCOPE']="A"; if (empty($MYREQUEST['SORT1'])) $MYREQUEST['SORT1']="H"; if (empty($MYREQUEST['SORT2'])) $MYREQUEST['SORT2']="D"; -if (empty($MYREQUEST['OB'])) $MYREQUEST['OB']=OB_HOST_STATS; +if (empty($MYREQUEST['OB'])) $MYREQUEST['OB']=OB_HOST_STATS; if (!isset($MYREQUEST['COUNT'])) $MYREQUEST['COUNT']=20; if (!isset($scope_list[$MYREQUEST['SCOPE']])) $MYREQUEST['SCOPE']='A'; $MY_SELF= - "$PHP_SELF". - "?SCOPE=".$MYREQUEST['SCOPE']. - "&SORT1=".$MYREQUEST['SORT1']. - "&SORT2=".$MYREQUEST['SORT2']. - "&COUNT=".$MYREQUEST['COUNT']; + "$PHP_SELF". + "?SCOPE=".$MYREQUEST['SCOPE']. + "&SORT1=".$MYREQUEST['SORT1']. + "&SORT2=".$MYREQUEST['SORT2']. + "&COUNT=".$MYREQUEST['COUNT']; $MY_SELF_WO_SORT= - "$PHP_SELF". - "?SCOPE=".$MYREQUEST['SCOPE']. - "&COUNT=".$MYREQUEST['COUNT']; + "$PHP_SELF". + "?SCOPE=".$MYREQUEST['SCOPE']. + "&COUNT=".$MYREQUEST['COUNT']; // authentication needed? // if (!USE_AUTHENTICATION) { - $AUTHENTICATED=1; + $AUTHENTICATED=1; } else { - $AUTHENTICATED=0; - if (ADMIN_PASSWORD!='password' && ($MYREQUEST['LO'] == 1 || isset($_SERVER['PHP_AUTH_USER']))) { + $AUTHENTICATED=0; + if (ADMIN_PASSWORD!='password' && ($MYREQUEST['LO'] == 1 || isset($_SERVER['PHP_AUTH_USER']))) { - if (!isset($_SERVER['PHP_AUTH_USER']) || - !isset($_SERVER['PHP_AUTH_PW']) || - $_SERVER['PHP_AUTH_USER'] != ADMIN_USERNAME || - $_SERVER['PHP_AUTH_PW'] != ADMIN_PASSWORD) { - Header("WWW-Authenticate: Basic realm=\"APC Login\""); - Header("HTTP/1.0 401 Unauthorized"); + if (!isset($_SERVER['PHP_AUTH_USER']) || + !isset($_SERVER['PHP_AUTH_PW']) || + $_SERVER['PHP_AUTH_USER'] != ADMIN_USERNAME || + $_SERVER['PHP_AUTH_PW'] != ADMIN_PASSWORD) { + Header("WWW-Authenticate: Basic realm=\"APC Login\""); + Header("HTTP/1.0 401 Unauthorized"); - echo <<<EOB - <html><body> - <h1>Rejected!</h1> - <big>Wrong Username or Password!</big><br/> <br/> - <big><a href='$PHP_SELF?OB={$MYREQUEST['OB']}'>Continue...</a></big> - </body></html> + echo <<<EOB + <html><body> + <h1>Rejected!</h1> + <big>Wrong Username or Password!</big><br/> <br/> + <big><a href='$PHP_SELF?OB={$MYREQUEST['OB']}'>Continue...</a></big> + </body></html> EOB; - exit; + exit; - } else { - $AUTHENTICATED=1; - } - } + } else { + $AUTHENTICATED=1; + } + } } // clear cache if ($AUTHENTICATED && isset($MYREQUEST['CC']) && $MYREQUEST['CC']) { - apcu_clear_cache(); + apcu_clear_cache(); } if ($AUTHENTICATED && !empty($MYREQUEST['DU'])) { - apcu_delete($MYREQUEST['DU']); + apcu_delete($MYREQUEST['DU']); } if(!function_exists('apcu_cache_info')) { - echo "No cache info available. APC does not appear to be running."; + echo "No cache info available. APC does not appear to be running."; exit; } -$limited = $MYREQUEST['OB'] != OB_USER_CACHE; -$cache = apcu_cache_info($limited); +$cache = apcu_cache_info(); $mem=apcu_sma_info(); @@ -224,291 +225,286 @@ function duration($ts) { // create graphics // function graphics_avail() { - return extension_loaded('gd'); + return extension_loaded('gd'); } if (isset($MYREQUEST['IMG'])) { - if (!graphics_avail()) { - exit(0); - } + if (!graphics_avail()) { + exit(0); + } - function fill_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1,$color2,$text='',$placeindex=0) { - $r=$diameter/2; - $w=deg2rad(round(360+$start+($end-$start)/2)%360); + function fill_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1,$color2,$text='',$placeindex=0) { + $r=$diameter/2; + $w=deg2rad((360+$start+($end-$start)/2)%360); - if (function_exists("imagefilledarc")) { - // exists only if GD 2.0.1 is available - imagefilledarc($im, $centerX+1, $centerY+1, $diameter, $diameter, round($start), round($end), $color1, IMG_ARC_PIE); - imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, round($start), round($end), $color2, IMG_ARC_PIE); - imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, round($start), round($end), $color1, IMG_ARC_NOFILL|IMG_ARC_EDGED); - } else { - imagearc($im, $centerX, $centerY, $diameter, $diameter, round($start), round($end), $color2); - imageline($im, $centerX, $centerY, $centerX + round(cos(deg2rad($start)) * $r), $centerY + round(sin(deg2rad($start)) * $r), $color2); - imageline($im, $centerX, $centerY, $centerX + round(cos(deg2rad($start+1)) * $r), $centerY + round(sin(deg2rad($start)) * $r), $color2); - imageline($im, $centerX, $centerY, $centerX + round(cos(deg2rad($end-1)) * $r), $centerY + round(sin(deg2rad($end)) * $r), $color2); - imageline($im, $centerX, $centerY, $centerX + round(cos(deg2rad($end)) * $r), $centerY + round(sin(deg2rad($end)) * $r), $color2); - imagefill($im,$centerX + round($r*cos($w)/2), $centerY + round($r*sin($w)/2), $color2); - } - if ($text) { - if ($placeindex>0) { - imageline($im,$centerX + round($r*cos($w)/2), $centerY + round($r*sin($w)/2),$diameter, $placeindex*12,$color1); - imagestring($im,4,$diameter, $placeindex*12,$text,$color1); - } else { - imagestring($im,4,$centerX + round($r*cos($w)/2), $centerY + round($r*sin($w)/2),$text,$color1); - } - } - } + if (function_exists("imagefilledarc")) { + // exists only if GD 2.0.1 is avaliable + imagefilledarc($im, $centerX+1, $centerY+1, $diameter, $diameter, $start, $end, $color1, IMG_ARC_PIE); + imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2, IMG_ARC_PIE); + imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color1, IMG_ARC_NOFILL|IMG_ARC_EDGED); + } else { + imagearc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2); + imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2); + imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start+1)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2); + imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end-1)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2); + imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2); + imagefill($im,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2, $color2); + } + if ($text) { + if ($placeindex>0) { + imageline($im,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$diameter, $placeindex*12,$color1); + imagestring($im,4,$diameter, $placeindex*12,$text,$color1); - function text_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1,$text,$placeindex=0) { - $r=$diameter/2; - $w=deg2rad((360+round($start)+round(($end-$start)/2))%360); + } else { + imagestring($im,4,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$text,$color1); + } + } + } - if ($placeindex>0) { - imageline($im,$centerX + round($r*cos($w)/2), $centerY + round($r*sin($w)/2),$diameter, $placeindex*12,$color1); - imagestring($im,4,$diameter, $placeindex*12,$text,$color1); + function text_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1,$text,$placeindex=0) { + $r=$diameter/2; + $w=deg2rad((360+$start+($end-$start)/2)%360); - } else { - imagestring($im,4,$centerX + round($r*cos($w)/2), $centerY + round($r*sin($w)/2),$text,$color1); - } - } + if ($placeindex>0) { + imageline($im,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$diameter, $placeindex*12,$color1); + imagestring($im,4,$diameter, $placeindex*12,$text,$color1); - function fill_box($im, $x, $y, $w, $h, $color1, $color2,$text='',$placeindex='') { - global $col_black; - - $x = round($x); - $y = round($y); - $w = round($w); - $h = round($h); + } else { + imagestring($im,4,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$text,$color1); + } + } - $x1=$x+$w-1; - $y1=$y+$h-1; + function fill_box($im, $x, $y, $w, $h, $color1, $color2,$text='',$placeindex='') { + global $col_black; + $x1=$x+$w-1; + $y1=$y+$h-1; - imagerectangle($im, $x, $y1, $x1+1, $y+1, $col_black); - if($y1>$y) imagefilledrectangle($im, $x, $y, $x1, $y1, $color2); - else imagefilledrectangle($im, $x, $y1, $x1, $y, $color2); - imagerectangle($im, $x, $y1, $x1, $y, $color1); - if ($text) { - if ($placeindex>0) { + imagerectangle($im, $x, $y1, $x1+1, $y+1, $col_black); + if($y1>$y) imagefilledrectangle($im, $x, $y, $x1, $y1, $color2); + else imagefilledrectangle($im, $x, $y1, $x1, $y, $color2); + imagerectangle($im, $x, $y1, $x1, $y, $color1); + if ($text) { + if ($placeindex>0) { - if ($placeindex<16) - { - $px=5; - $py=$placeindex*12+6; - imagefilledrectangle($im, $px+90, $py+3, $px+90-4, $py-3, $color2); - imageline($im,$x,$y+round($h/2),$px+90,$py,$color2); - imagestring($im,2,$px,$py-6,$text,$color1); + if ($placeindex<16) + { + $px=5; + $py=$placeindex*12+6; + imagefilledrectangle($im, $px+90, $py+3, $px+90-4, $py-3, $color2); + imageline($im,$x,$y+$h/2,$px+90,$py,$color2); + imagestring($im,2,$px,$py-6,$text,$color1); - } else { - if ($placeindex<31) { - $px=$x+40*2; - $py=($placeindex-15)*12+6; - } else { - $px=$x+40*2+100*intval(($placeindex-15)/15); - $py=($placeindex%15)*12+6; - } - imagefilledrectangle($im, $px, $py+3, $px-4, $py-3, $color2); - imageline($im,$x+$w,$y+round($h/2),$px,$py,$color2); - imagestring($im,2,$px+2,$py-6,$text,$color1); - } - } else { - imagestring($im,4,$x+5,$y1-16,$text,$color1); - } - } - } + } else { + if ($placeindex<31) { + $px=$x+40*2; + $py=($placeindex-15)*12+6; + } else { + $px=$x+40*2+100*intval(($placeindex-15)/15); + $py=($placeindex%15)*12+6; + } + imagefilledrectangle($im, $px, $py+3, $px-4, $py-3, $color2); + imageline($im,$x+$w,$y+$h/2,$px,$py,$color2); + imagestring($im,2,$px+2,$py-6,$text,$color1); + } + } else { + imagestring($im,4,$x+5,$y1-16,$text,$color1); + } + } + } - $size = GRAPH_SIZE; // image size - if ($MYREQUEST['IMG']==3) - $image = imagecreate(2*$size+150, $size+10); - else - $image = imagecreate($size+50, $size+10); + $size = GRAPH_SIZE; // image size + if ($MYREQUEST['IMG']==3) + $image = imagecreate(2*$size+150, $size+10); + else + $image = imagecreate($size+50, $size+10); - $col_white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); - $col_red = imagecolorallocate($image, 0xD0, 0x60, 0x30); - $col_green = imagecolorallocate($image, 0x60, 0xF0, 0x60); - $col_black = imagecolorallocate($image, 0, 0, 0); - imagecolortransparent($image,$col_white); + $col_white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); + $col_red = imagecolorallocate($image, 0xD0, 0x60, 0x30); + $col_green = imagecolorallocate($image, 0x60, 0xF0, 0x60); + $col_black = imagecolorallocate($image, 0, 0, 0); + imagecolortransparent($image,$col_white); - switch ($MYREQUEST['IMG']) { + switch ($MYREQUEST['IMG']) { - case 1: - $s=$mem['num_seg']*$mem['seg_size']; - $a=$mem['avail_mem']; - $x=$y=$size/2; - $fuzz = 0.000001; + case 1: + $s=$mem['num_seg']*$mem['seg_size']; + $a=$mem['avail_mem']; + $x=$y=$size/2; + $fuzz = 0.000001; - // This block of code creates the pie chart. It is a lot more complex than you - // would expect because we try to visualize any memory fragmentation as well. - $angle_from = 0; - $string_placement=array(); - for($i=0; $i<$mem['num_seg']; $i++) { - $ptr = 0; - $free = $mem['block_lists'][$i]; - uasort($free, 'block_sort'); - foreach($free as $block) { - if($block['offset']!=$ptr) { // Used block - $angle_to = $angle_from+($block['offset']-$ptr)/$s; - if(($angle_to+$fuzz)>1) $angle_to = 1; - if( ($angle_to*360) - ($angle_from*360) >= 1) { - fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_red); - if (($angle_to-$angle_from)>0.05) { - array_push($string_placement, array($angle_from,$angle_to)); - } - } - $angle_from = $angle_to; - } - $angle_to = $angle_from+($block['size'])/$s; - if(($angle_to+$fuzz)>1) $angle_to = 1; - if( ($angle_to*360) - ($angle_from*360) >= 1) { - fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_green); - if (($angle_to-$angle_from)>0.05) { - array_push($string_placement, array($angle_from,$angle_to)); - } - } - $angle_from = $angle_to; - $ptr = $block['offset']+$block['size']; - } - if ($ptr < $mem['seg_size']) { // memory at the end - $angle_to = $angle_from + ($mem['seg_size'] - $ptr)/$s; - if(($angle_to+$fuzz)>1) $angle_to = 1; - fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_red); - if (($angle_to-$angle_from)>0.05) { - array_push($string_placement, array($angle_from,$angle_to)); - } - } - } - foreach ($string_placement as $angle) { - text_arc($image,$x,$y,$size,$angle[0]*360,$angle[1]*360,$col_black,bsize($s*($angle[1]-$angle[0]))); - } - break; + // This block of code creates the pie chart. It is a lot more complex than you + // would expect because we try to visualize any memory fragmentation as well. + $angle_from = 0; + $string_placement=[]; + for($i=0; $i<$mem['num_seg']; $i++) { + $ptr = 0; + $free = $mem['block_lists'][$i]; + uasort($free, 'block_sort'); + foreach($free as $block) { + if($block['offset']!=$ptr) { // Used block + $angle_to = $angle_from+($block['offset']-$ptr)/$s; + if(($angle_to+$fuzz)>1) $angle_to = 1; + if( ($angle_to*360) - ($angle_from*360) >= 1) { + fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_red); + if (($angle_to-$angle_from)>0.05) { + array_push($string_placement, array($angle_from,$angle_to)); + } + } + $angle_from = $angle_to; + } + $angle_to = $angle_from+($block['size'])/$s; + if(($angle_to+$fuzz)>1) $angle_to = 1; + if( ($angle_to*360) - ($angle_from*360) >= 1) { + fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_green); + if (($angle_to-$angle_from)>0.05) { + array_push($string_placement, array($angle_from,$angle_to)); + } + } + $angle_from = $angle_to; + $ptr = $block['offset']+$block['size']; + } + if ($ptr < $mem['seg_size']) { // memory at the end + $angle_to = $angle_from + ($mem['seg_size'] - $ptr)/$s; + if(($angle_to+$fuzz)>1) $angle_to = 1; + fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_red); + if (($angle_to-$angle_from)>0.05) { + array_push($string_placement, array($angle_from,$angle_to)); + } + } + } + foreach ($string_placement as $angle) { + text_arc($image,$x,$y,$size,$angle[0]*360,$angle[1]*360,$col_black,bsize($s*($angle[1]-$angle[0]))); + } + break; - case 2: - $s=$cache['num_hits']+$cache['num_misses']; - $a=$cache['num_hits']; + case 2: + $s=$cache['num_hits']+$cache['num_misses']; + $a=$cache['num_hits']; - fill_box($image, 30,$size,50,$s ? (-$a*($size-21)/$s) : 0,$col_black,$col_green,sprintf("%.1f%%",$s ? $cache['num_hits']*100/$s : 0)); - fill_box($image,130,$size,50,$s ? -max(4,($s-$a)*($size-21)/$s) : 0,$col_black,$col_red,sprintf("%.1f%%",$s ? $cache['num_misses']*100/$s : 0)); - break; + fill_box($image, 30,$size,50,$s ? (-$a*($size-21)/$s) : 0,$col_black,$col_green,sprintf("%.1f%%",$s ? $cache['num_hits']*100/$s : 0)); + fill_box($image,130,$size,50,$s ? -max(4,($s-$a)*($size-21)/$s) : 0,$col_black,$col_red,sprintf("%.1f%%",$s ? $cache['num_misses']*100/$s : 0)); + break; - case 3: - $s=$mem['num_seg']*$mem['seg_size']; - $a=$mem['avail_mem']; - $x=130; - $y=1; - $j=1; + case 3: + $s=$mem['num_seg']*$mem['seg_size']; + $a=$mem['avail_mem']; + $x=130; + $y=1; + $j=1; - // This block of code creates the bar chart. It is a lot more complex than you - // would expect because we try to visualize any memory fragmentation as well. - for($i=0; $i<$mem['num_seg']; $i++) { - $ptr = 0; - $free = $mem['block_lists'][$i]; - uasort($free, 'block_sort'); - foreach($free as $block) { - if($block['offset']!=$ptr) { // Used block - $h=(GRAPH_SIZE-5)*($block['offset']-$ptr)/$s; - if ($h>0) { + // This block of code creates the bar chart. It is a lot more complex than you + // would expect because we try to visualize any memory fragmentation as well. + for($i=0; $i<$mem['num_seg']; $i++) { + $ptr = 0; + $free = $mem['block_lists'][$i]; + uasort($free, 'block_sort'); + foreach($free as $block) { + if($block['offset']!=$ptr) { // Used block + $h=(GRAPH_SIZE-5)*($block['offset']-$ptr)/$s; + if ($h>0) { $j++; - if($j<75) fill_box($image,$x,$y,50,$h,$col_black,$col_red,bsize($block['offset']-$ptr),$j); + if($j<75) fill_box($image,$x,$y,50,$h,$col_black,$col_red,bsize($block['offset']-$ptr),$j); else fill_box($image,$x,$y,50,$h,$col_black,$col_red); } - $y+=$h; - } - $h=(GRAPH_SIZE-5)*($block['size'])/$s; - if ($h>0) { + $y+=$h; + } + $h=(GRAPH_SIZE-5)*($block['size'])/$s; + if ($h>0) { $j++; - if($j<75) fill_box($image,$x,$y,50,$h,$col_black,$col_green,bsize($block['size']),$j); - else fill_box($image,$x,$y,50,$h,$col_black,$col_green); + if($j<75) fill_box($image,$x,$y,50,$h,$col_black,$col_green,bsize($block['size']),$j); + else fill_box($image,$x,$y,50,$h,$col_black,$col_green); } - $y+=$h; - $ptr = $block['offset']+$block['size']; - } - if ($ptr < $mem['seg_size']) { // memory at the end - $h = (GRAPH_SIZE-5) * ($mem['seg_size'] - $ptr) / $s; - if ($h > 0) { - fill_box($image,$x,$y,50,$h,$col_black,$col_red,bsize($mem['seg_size']-$ptr),$j++); - } - } - } - break; + $y+=$h; + $ptr = $block['offset']+$block['size']; + } + if ($ptr < $mem['seg_size']) { // memory at the end + $h = (GRAPH_SIZE-5) * ($mem['seg_size'] - $ptr) / $s; + if ($h > 0) { + fill_box($image,$x,$y,50,$h,$col_black,$col_red,bsize($mem['seg_size']-$ptr),$j++); + } + } + } + break; - case 4: - $s=$cache['num_hits']+$cache['num_misses']; - $a=$cache['num_hits']; + case 4: + $s=$cache['num_hits']+$cache['num_misses']; + $a=$cache['num_hits']; - fill_box($image, 30,$size,50,$s ? -$a*($size-21)/$s : 0,$col_black,$col_green,sprintf("%.1f%%", $s ? $cache['num_hits']*100/$s : 0)); - fill_box($image,130,$size,50,$s ? -max(4,($s-$a)*($size-21)/$s) : 0,$col_black,$col_red,sprintf("%.1f%%", $s ? $cache['num_misses']*100/$s : 0)); - break; - } + fill_box($image, 30,$size,50,$s ? -$a*($size-21)/$s : 0,$col_black,$col_green,sprintf("%.1f%%", $s ? $cache['num_hits']*100/$s : 0)); + fill_box($image,130,$size,50,$s ? -max(4,($s-$a)*($size-21)/$s) : 0,$col_black,$col_red,sprintf("%.1f%%", $s ? $cache['num_misses']*100/$s : 0)); + break; + } - header("Content-type: image/png"); - imagepng($image); - exit; + header("Content-type: image/png"); + imagepng($image); + exit; } // pretty printer for byte values // function bsize($s) { - foreach (array('','K','M','G') as $i => $k) { - if ($s < 1024) break; - $s/=1024; - } - return sprintf("%5.1f %sBytes",$s,$k); + foreach (array('','K','M','G') as $i => $k) { + if ($s < 1024) break; + $s/=1024; + } + return sprintf("%5.1f %sBytes",$s,$k); } // sortable table header in "scripts for this host" view function sortheader($key,$name,$extra='') { - global $MYREQUEST, $MY_SELF_WO_SORT; + global $MYREQUEST, $MY_SELF_WO_SORT; - if ($MYREQUEST['SORT1']==$key) { - $MYREQUEST['SORT2'] = $MYREQUEST['SORT2']=='A' ? 'D' : 'A'; - } - return "<a class=sortable href=\"$MY_SELF_WO_SORT$extra&SORT1=$key&SORT2=".$MYREQUEST['SORT2']."\">$name</a>"; + if ($MYREQUEST['SORT1']==$key) { + $MYREQUEST['SORT2'] = $MYREQUEST['SORT2']=='A' ? 'D' : 'A'; + } + return "<a class=sortable href=\"$MY_SELF_WO_SORT$extra&SORT1=$key&SORT2=".$MYREQUEST['SORT2']."\">$name</a>"; } // create menu entry function menu_entry($ob,$title) { - global $MYREQUEST,$MY_SELF; - if ($MYREQUEST['OB']!=$ob) { - return "<li><a href=\"$MY_SELF&OB=$ob\">$title</a></li>"; - } else if (empty($MYREQUEST['SH'])) { - return "<li><span class=active>$title</span></li>"; - } else { - return "<li><a class=\"child_active\" href=\"$MY_SELF&OB=$ob\">$title</a></li>"; - } + global $MYREQUEST,$MY_SELF; + if ($MYREQUEST['OB']!=$ob) { + return "<li><a href=\"$MY_SELF&OB=$ob\">$title</a></li>"; + } else if (empty($MYREQUEST['SH'])) { + return "<li><span class=active>$title</span></li>"; + } else { + return "<li><a class=\"child_active\" href=\"$MY_SELF&OB=$ob\">$title</a></li>"; + } } function put_login_link($s="Login") { - global $MY_SELF,$MYREQUEST,$AUTHENTICATED; - // needs ADMIN_PASSWORD to be changed! - // - if (!USE_AUTHENTICATION) { - return; - } else if (ADMIN_PASSWORD=='password') - { - print <<<EOB - <a href="#" onClick="javascript:alert('You need to set a password at the top of apc.php before this will work!');return false";>$s</a> + global $MY_SELF,$MYREQUEST,$AUTHENTICATED; + // needs ADMIN_PASSWORD to be changed! + // + if (!USE_AUTHENTICATION) { + return; + } else if (ADMIN_PASSWORD=='password') + { + print <<<EOB + <a href="#" onClick="javascript:alert('You need to set a password at the top of apc.php before this will work!');return false";>$s</a> EOB; - } else if ($AUTHENTICATED) { - print <<<EOB - '{$_SERVER['PHP_AUTH_USER']}' logged in! + } else if ($AUTHENTICATED) { + print <<<EOB + '{$_SERVER['PHP_AUTH_USER']}' logged in! EOB; - } else{ - print <<<EOB - <a href="$MY_SELF&LO=1&OB={$MYREQUEST['OB']}">$s</a> + } else{ + print <<<EOB + <a href="$MY_SELF&LO=1&OB={$MYREQUEST['OB']}">$s</a> EOB; - } + } } function block_sort($array1, $array2) { - if ($array1['offset'] > $array2['offset']) { - return 1; - } else { - return -1; - } + if ($array1['offset'] > $array2['offset']) { + return 1; + } else { + return -1; + } } @@ -528,143 +524,141 @@ body,p,td,th,input,submit { font-size:0.8em;font-family:arial,helvetica,sans-ser td { vertical-align:top } a { color:black; font-weight:none; text-decoration:none; } a:hover { text-decoration:underline; } -a.entry-info:hover { text-decoration:none; } div.content { padding:1em 1em 1em 1em; position:absolute; width:97%; z-index:100; } div.head div.login { - position:absolute; - right: 1em; - top: 1.2em; - color:white; - width:6em; - } + position:absolute; + right: 1em; + top: 1.2em; + color:white; + width:6em; + } div.head div.login a { - position:absolute; - right: 0em; - background:rgb(119,123,180); - border:solid rgb(102,102,153) 2px; - color:white; - font-weight:bold; - padding:0.1em 0.5em 0.1em 0.5em; - text-decoration:none; - } + position:absolute; + right: 0em; + background:rgb(119,123,180); + border:solid rgb(102,102,153) 2px; + color:white; + font-weight:bold; + padding:0.1em 0.5em 0.1em 0.5em; + text-decoration:none; + } div.head div.login a:hover { - background:rgb(193,193,244); - } + background:rgb(193,193,244); + } h1.apc { background:rgb(153,153,204); margin:0; padding:0.5em 1em 0.5em 1em; } * html h1.apc { margin-bottom:-7px; } h1.apc a:hover { text-decoration:none; color:rgb(90,90,90); } h1.apc div.logo span.logo { - background:rgb(119,123,180); - color:black; - border-right: solid black 1px; - border-bottom: solid black 1px; - font-style:italic; - font-size:1em; - padding-left:1.2em; - padding-right:1.2em; - text-align:right; - } + background:rgb(119,123,180); + color:black; + border-right: solid black 1px; + border-bottom: solid black 1px; + font-style:italic; + font-size:1em; + padding-left:1.2em; + padding-right:1.2em; + text-align:right; + } h1.apc div.logo span.name { color:white; font-size:0.7em; padding:0 0.8em 0 2em; } h1.apc div.nameinfo { color:white; display:inline; font-size:0.4em; margin-left: 3em; } h1.apc div.copy { color:black; font-size:0.4em; position:absolute; right:1em; } hr.apc { - background:white; - border-bottom:solid rgb(102,102,153) 1px; - border-style:none; - border-top:solid rgb(102,102,153) 10px; - height:12px; - margin:0; - margin-top:1px; - padding:0; + background:white; + border-bottom:solid rgb(102,102,153) 1px; + border-style:none; + border-top:solid rgb(102,102,153) 10px; + height:12px; + margin:0; + margin-top:1px; + padding:0; } ol,menu { margin:1em 0 0 0; padding:0.2em; margin-left:1em;} ol.menu li { display:inline; margin-right:0.7em; list-style:none; font-size:85%} ol.menu a { - background:rgb(153,153,204); - border:solid rgb(102,102,153) 2px; - color:white; - font-weight:bold; - margin-right:0em; - padding:0.1em 0.5em 0.1em 0.5em; - text-decoration:none; - margin-left: 5px; - } + background:rgb(153,153,204); + border:solid rgb(102,102,153) 2px; + color:white; + font-weight:bold; + margin-right:0em; + padding:0.1em 0.5em 0.1em 0.5em; + text-decoration:none; + margin-left: 5px; + } ol.menu a.child_active { - background:rgb(153,153,204); - border:solid rgb(102,102,153) 2px; - color:white; - font-weight:bold; - margin-right:0em; - padding:0.1em 0.5em 0.1em 0.5em; - text-decoration:none; - border-left: solid black 5px; - margin-left: 0px; - } + background:rgb(153,153,204); + border:solid rgb(102,102,153) 2px; + color:white; + font-weight:bold; + margin-right:0em; + padding:0.1em 0.5em 0.1em 0.5em; + text-decoration:none; + border-left: solid black 5px; + margin-left: 0px; + } ol.menu span.active { - background:rgb(153,153,204); - border:solid rgb(102,102,153) 2px; - color:black; - font-weight:bold; - margin-right:0em; - padding:0.1em 0.5em 0.1em 0.5em; - text-decoration:none; - border-left: solid black 5px; - } + background:rgb(153,153,204); + border:solid rgb(102,102,153) 2px; + color:black; + font-weight:bold; + margin-right:0em; + padding:0.1em 0.5em 0.1em 0.5em; + text-decoration:none; + border-left: solid black 5px; + } ol.menu span.inactive { - background:rgb(193,193,244); - border:solid rgb(182,182,233) 2px; - color:white; - font-weight:bold; - margin-right:0em; - padding:0.1em 0.5em 0.1em 0.5em; - text-decoration:none; - margin-left: 5px; - } + background:rgb(193,193,244); + border:solid rgb(182,182,233) 2px; + color:white; + font-weight:bold; + margin-right:0em; + padding:0.1em 0.5em 0.1em 0.5em; + text-decoration:none; + margin-left: 5px; + } ol.menu a:hover { - background:rgb(193,193,244); - text-decoration:none; - } + background:rgb(193,193,244); + text-decoration:none; + } div.info { - background:rgb(204,204,204); - border:solid rgb(204,204,204) 1px; - margin-bottom:1em; - } + background:rgb(204,204,204); + border:solid rgb(204,204,204) 1px; + margin-bottom:1em; + } div.info h2 { - background:rgb(204,204,204); - color:black; - font-size:1em; - margin:0; - padding:0.1em 1em 0.1em 1em; - } + background:rgb(204,204,204); + color:black; + font-size:1em; + margin:0; + padding:0.1em 1em 0.1em 1em; + } div.info table { - border:solid rgb(204,204,204) 1px; - border-spacing:0; - width:100%; - } + border:solid rgb(204,204,204) 1px; + border-spacing:0; + width:100%; + } div.info table th { - background:rgb(204,204,204); - color:white; - margin:0; - padding:0.1em 1em 0.1em 1em; - } + background:rgb(204,204,204); + color:white; + margin:0; + padding:0.1em 1em 0.1em 1em; + } div.info table th a.sortable { color:black; } -div.info table tr.sticky { position: sticky; top: 0; } div.info table tr.tr-0 { background:rgb(238,238,238); } div.info table tr.tr-1 { background:rgb(221,221,221); } div.info table td { padding:0.3em 1em 0.3em 1em; } div.info table td.td-0 { border-right:solid rgb(102,102,153) 1px; white-space:nowrap; } div.info table td.td-n { border-right:solid rgb(102,102,153) 1px; } div.info table td h3 { - color:black; - font-size:1.1em; - margin-left:-0.3em; - } + color:black; + font-size:1.1em; + margin-left:-0.3em; + } div.graph { margin-bottom:1em } div.graph h2 { background:rgb(204,204,204);; color:black; font-size:1em; margin:0; padding:0.1em 1em 0.1em 1em; } @@ -685,72 +679,72 @@ div.sorting { margin:1.5em 0em 1.5em 2em } .failed { color:rgb(200,0,0); font-weight:bold} span.box { - border: black solid 1px; - border-right:solid black 2px; - border-bottom:solid black 2px; - padding:0 0.5em 0 0.5em; - margin-right:1em; + border: black solid 1px; + border-right:solid black 2px; + border-bottom:solid black 2px; + padding:0 0.5em 0 0.5em; + margin-right:1em; } span.green { background:#60F060; padding:0 0.5em 0 0.5em} span.red { background:#D06030; padding:0 0.5em 0 0.5em } div.authneeded { - background:rgb(238,238,238); - border:solid rgb(204,204,204) 1px; - color:rgb(200,0,0); - font-size:1.2em; - font-weight:bold; - padding:2em; - text-align:center; - } + background:rgb(238,238,238); + border:solid rgb(204,204,204) 1px; + color:rgb(200,0,0); + font-size:1.2em; + font-weight:bold; + padding:2em; + text-align:center; + } input { - background:rgb(153,153,204); - border:solid rgb(102,102,153) 2px; - color:white; - font-weight:bold; - margin-right:1em; - padding:0.1em 0.5em 0.1em 0.5em; - } + background:rgb(153,153,204); + border:solid rgb(102,102,153) 2px; + color:white; + font-weight:bold; + margin-right:1em; + padding:0.1em 0.5em 0.1em 0.5em; + } //--> </style> </head> <body> <div class="head"> - <h1 class="apc"> - <div class="logo"><span class="logo"><a href="https://pecl.php.net/package/APCu">APCu</a></span></div> - <div class="nameinfo">User Cache</div> - </h1> - <div class="login"> - <?php put_login_link(); ?> - </div> - <hr class="apc"> + <h1 class="apc"> + <div class="logo"><span class="logo"><a href="http://pecl.php.net/package/APCu">APCu</a></span></div> + <div class="nameinfo">User Cache</div> + </h1> + <div class="login"> + <?php put_login_link(); ?> + </div> + <hr class="apc"> </div> <?php // Display main Menu echo <<<EOB - <ol class=menu> - <li><a href="$MY_SELF&OB={$MYREQUEST['OB']}&SH={$MYREQUEST['SH']}">Refresh Data</a></li> + <ol class=menu> + <li><a href="$MY_SELF&OB={$MYREQUEST['OB']}&SH={$MYREQUEST['SH']}">Refresh Data</a></li> EOB; echo - menu_entry(OB_HOST_STATS,'View Host Stats'), - menu_entry(OB_USER_CACHE,'User Cache Entries'), - menu_entry(OB_VERSION_CHECK,'Version Check'); + menu_entry(OB_HOST_STATS,'View Host Stats'), + menu_entry(OB_USER_CACHE,'User Cache Entries'), + menu_entry(OB_VERSION_CHECK,'Version Check'); if ($AUTHENTICATED) { - echo <<<EOB - <li><a class="aright" href="$MY_SELF&CC=1&OB={$MYREQUEST['OB']}" onClick="javascript:return confirm('Are you sure?');">Clear Cache</a></li> + echo <<<EOB + <li><a class="aright" href="$MY_SELF&CC=1&OB={$MYREQUEST['OB']}" onClick="javascript:return confirm('Are you sure?');">Clear Cache</a></li> EOB; } echo <<<EOB - </ol> + </ol> EOB; // CONTENT echo <<<EOB - <div class=content> + <div class=content> EOB; // MAIN SWITCH STATEMENT @@ -760,411 +754,404 @@ switch ($MYREQUEST['OB']) { // Host Stats // ----------------------------------------------- case OB_HOST_STATS: - $mem_size = $mem['num_seg']*$mem['seg_size']; - $mem_avail= $mem['avail_mem']; - $mem_used = $mem_size-$mem_avail; - $seg_size = bsize($mem['seg_size']); - $elapsed = max($time-$cache['start_time'], 1); - $req_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits']+$cache['num_misses'])/$elapsed) : 0); - $hit_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits'])/$elapsed) : 0); - $miss_rate_user = sprintf("%.2f", $cache['num_misses'] ? (($cache['num_misses'])/$elapsed) : 0); - $insert_rate_user = sprintf("%.2f", $cache['num_inserts'] ? (($cache['num_inserts'])/$elapsed) : 0); - $apcversion = phpversion('apcu'); - $phpversion = phpversion(); - $number_vars = $cache['num_entries']; + $mem_size = $mem['num_seg']*$mem['seg_size']; + $mem_avail= $mem['avail_mem']; + $mem_used = $mem_size-$mem_avail; + $seg_size = bsize($mem['seg_size']); + if ( $time-$cache['start_time'] > 0 ) { + $req_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits']+$cache['num_misses'])/($time-$cache['start_time'])) : 0); + $hit_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits'])/($time-$cache['start_time'])) : 0); + $miss_rate_user = sprintf("%.2f", $cache['num_misses'] ? (($cache['num_misses'])/($time-$cache['start_time'])) : 0); + $insert_rate_user = sprintf("%.2f", $cache['num_inserts'] ? (($cache['num_inserts'])/($time-$cache['start_time'])) : 0); + } else { + $req_rate_user = 0; + $hit_rate_user = 0; + $miss_rate_user = 0; + $insert_rate_user = 0; + } + $apcversion = phpversion('apcu'); + $phpversion = phpversion(); + $number_vars = $cache['num_entries']; $size_vars = bsize($cache['mem_size']); - $num_hits_and_misses = $cache['num_hits'] + $cache['num_misses']; - $num_hits_and_misses = 0 >= $num_hits_and_misses ? 1 : $num_hits_and_misses; - $i=0; - echo <<< EOB - <div class="info div1"><h2>General Cache Information</h2> - <table cellspacing=0><tbody> - <tr class=tr-0><td class=td-0>APCu Version</td><td>$apcversion</td></tr> - <tr class=tr-1><td class=td-0>PHP Version</td><td>$phpversion</td></tr> + $i=0; + echo <<< EOB + <div class="info div1"><h2>General Cache Information</h2> + <table cellspacing=0><tbody> + <tr class=tr-0><td class=td-0>APCu Version</td><td>$apcversion</td></tr> + <tr class=tr-1><td class=td-0>PHP Version</td><td>$phpversion</td></tr> EOB; - if(!empty($_SERVER['SERVER_NAME'])) - echo "<tr class=tr-0><td class=td-0>APCu Host</td><td>{$_SERVER['SERVER_NAME']} $host</td></tr>\n"; - if(!empty($_SERVER['SERVER_SOFTWARE'])) - echo "<tr class=tr-1><td class=td-0>Server Software</td><td>{$_SERVER['SERVER_SOFTWARE']}</td></tr>\n"; + if(!empty($_SERVER['SERVER_NAME'])) + echo "<tr class=tr-0><td class=td-0>APCu Host</td><td>{$_SERVER['SERVER_NAME']} $host</td></tr>\n"; + if(!empty($_SERVER['SERVER_SOFTWARE'])) + echo "<tr class=tr-1><td class=td-0>Server Software</td><td>{$_SERVER['SERVER_SOFTWARE']}</td></tr>\n"; - echo <<<EOB - <tr class=tr-0><td class=td-0>Shared Memory</td><td>{$mem['num_seg']} Segment(s) with $seg_size + echo <<<EOB + <tr class=tr-0><td class=td-0>Shared Memory</td><td>{$mem['num_seg']} Segment(s) with $seg_size <br/> ({$cache['memory_type']} memory) </td></tr> EOB; - echo '<tr class=tr-1><td class=td-0>Start Time</td><td>',date(DATE_FORMAT,$cache['start_time']),'</td></tr>'; - echo '<tr class=tr-0><td class=td-0>Uptime</td><td>',duration($cache['start_time']),'</td></tr>'; - echo <<<EOB - </tbody></table> - </div> + echo '<tr class=tr-1><td class=td-0>Start Time</td><td>',date(DATE_FORMAT,$cache['start_time']),'</td></tr>'; + echo '<tr class=tr-0><td class=td-0>Uptime</td><td>',duration($cache['start_time']),'</td></tr>'; + echo <<<EOB + </tbody></table> + </div> - <div class="info div1"><h2>Cache Information</h2> - <table cellspacing=0> - <tbody> - <tr class=tr-0><td class=td-0>Cached Variables</td><td>$number_vars ($size_vars)</td></tr> - <tr class=tr-1><td class=td-0>Hits</td><td>{$cache['num_hits']}</td></tr> - <tr class=tr-0><td class=td-0>Misses</td><td>{$cache['num_misses']}</td></tr> - <tr class=tr-1><td class=td-0>Request Rate (hits, misses)</td><td>$req_rate_user cache requests/second</td></tr> - <tr class=tr-0><td class=td-0>Hit Rate</td><td>$hit_rate_user cache requests/second</td></tr> - <tr class=tr-1><td class=td-0>Miss Rate</td><td>$miss_rate_user cache requests/second</td></tr> - <tr class=tr-0><td class=td-0>Insert Rate</td><td>$insert_rate_user cache requests/second</td></tr> - <tr class=tr-1><td class=td-0>Cache full count</td><td>{$cache['expunges']}</td></tr> - </tbody> - </table> - </div> + <div class="info div1"><h2>Cache Information</h2> + <table cellspacing=0> + <tbody> + <tr class=tr-0><td class=td-0>Cached Variables</td><td>$number_vars ($size_vars)</td></tr> + <tr class=tr-1><td class=td-0>Hits</td><td>{$cache['num_hits']}</td></tr> + <tr class=tr-0><td class=td-0>Misses</td><td>{$cache['num_misses']}</td></tr> + <tr class=tr-1><td class=td-0>Request Rate (hits, misses)</td><td>$req_rate_user cache requests/second</td></tr> + <tr class=tr-0><td class=td-0>Hit Rate</td><td>$hit_rate_user cache requests/second</td></tr> + <tr class=tr-1><td class=td-0>Miss Rate</td><td>$miss_rate_user cache requests/second</td></tr> + <tr class=tr-0><td class=td-0>Insert Rate</td><td>$insert_rate_user cache requests/second</td></tr> + <tr class=tr-1><td class=td-0>Cache full count</td><td>{$cache['expunges']}</td></tr> + </tbody> + </table> + </div> - <div class="info div2"><h2>Runtime Settings</h2><table cellspacing=0><tbody> + <div class="info div2"><h2>Runtime Settings</h2><table cellspacing=0><tbody> EOB; - $j = 0; - foreach (ini_get_all('apcu') as $k => $v) { - echo "<tr class=tr-$j><td class=td-0>",$k,"</td><td>",str_replace(',',',<br />',$v['local_value'] ?? ''),"</td></tr>\n"; - $j = 1 - $j; - } + $j = 0; + foreach (ini_get_all('apcu') as $k => $v) { + echo "<tr class=tr-$j><td class=td-0>",$k,"</td><td>",str_replace(',',',<br />',$v['local_value'] ?? ''),"</td></tr>\n"; + $j = 1 - $j; + } - if($mem['num_seg']>1 || $mem['num_seg']==1 && count($mem['block_lists'][0])>1) - $mem_note = "Memory Usage<br /><font size=-2>(multiple slices indicate fragments)</font>"; - else - $mem_note = "Memory Usage"; + if($mem['num_seg']>1 || $mem['num_seg']==1 && count($mem['block_lists'][0])>1) + $mem_note = "Memory Usage<br /><font size=-2>(multiple slices indicate fragments)</font>"; + else + $mem_note = "Memory Usage"; - echo <<< EOB - </tbody></table> - </div> + echo <<< EOB + </tbody></table> + </div> - <div class="graph div3"><h2>Host Status Diagrams</h2> - <table cellspacing=0><tbody> + <div class="graph div3"><h2>Host Status Diagrams</h2> + <table cellspacing=0><tbody> EOB; - $size='width='.(GRAPH_SIZE+50).' height='.(GRAPH_SIZE+10); + $size='width='.(GRAPH_SIZE+50).' height='.(GRAPH_SIZE+10); echo <<<EOB - <tr> - <td class=td-0>$mem_note</td> - <td class=td-1>Hits & Misses</td> - </tr> + <tr> + <td class=td-0>$mem_note</td> + <td class=td-1>Hits & Misses</td> + </tr> EOB; - echo - graphics_avail() ? - '<tr>'. - "<td class=td-0><img alt=\"\" $size src=\"$PHP_SELF?IMG=1&$time\"></td>". - "<td class=td-1><img alt=\"\" $size src=\"$PHP_SELF?IMG=2&$time\"></td></tr>\n" - : "", - '<tr>', - '<td class=td-0><span class="green box"> </span>Free: ',bsize($mem_avail).sprintf(" (%.1f%%)",$mem_avail*100/$mem_size),"</td>\n", - '<td class=td-1><span class="green box"> </span>Hits: ',$cache['num_hits'].@sprintf(" (%.1f%%)",$cache['num_hits']*100/$num_hits_and_misses),"</td>\n", - '</tr>', - '<tr>', - '<td class=td-0><span class="red box"> </span>Used: ',bsize($mem_used).sprintf(" (%.1f%%)",$mem_used *100/$mem_size),"</td>\n", - '<td class=td-1><span class="red box"> </span>Misses: ',$cache['num_misses'].@sprintf(" (%.1f%%)",$cache['num_misses']*100/$num_hits_and_misses),"</td>\n"; - echo <<< EOB - </tr> - </tbody></table> + echo + graphics_avail() ? + '<tr>'. + "<td class=td-0><img alt=\"\" $size src=\"$PHP_SELF?IMG=1&$time\"></td>". + "<td class=td-1><img alt=\"\" $size src=\"$PHP_SELF?IMG=2&$time\"></td></tr>\n" + : "", + '<tr>', + '<td class=td-0><span class="green box"> </span>Free: ',bsize($mem_avail).sprintf(" (%.1f%%)",$mem_avail*100/$mem_size),"</td>\n", + '<td class=td-1><span class="green box"> </span>Hits: ',$cache['num_hits'].@sprintf(" (%.1f%%)",$cache['num_hits']*100/($cache['num_hits']+$cache['num_misses'])),"</td>\n", + '</tr>', + '<tr>', + '<td class=td-0><span class="red box"> </span>Used: ',bsize($mem_used).sprintf(" (%.1f%%)",$mem_used *100/$mem_size),"</td>\n", + '<td class=td-1><span class="red box"> </span>Misses: ',$cache['num_misses'].@sprintf(" (%.1f%%)",$cache['num_misses']*100/($cache['num_hits']+$cache['num_misses'])),"</td>\n"; + echo <<< EOB + </tr> + </tbody></table> - <br/> - <h2>Detailed Memory Usage and Fragmentation</h2> - <table cellspacing=0><tbody> - <tr> - <td class=td-0 colspan=2><br/> + <br/> + <h2>Detailed Memory Usage and Fragmentation</h2> + <table cellspacing=0><tbody> + <tr> + <td class=td-0 colspan=2><br/> EOB; - // Fragementation: (freeseg - 1) / total_seg - $nseg = $freeseg = $fragsize = $freetotal = 0; - for($i=0; $i<$mem['num_seg']; $i++) { - $ptr = 0; - foreach($mem['block_lists'][$i] as $block) { - if ($block['offset'] != $ptr) { - ++$nseg; - } - $ptr = $block['offset'] + $block['size']; - /* Only consider blocks <5M for the fragmentation % */ - if($block['size']<(5*1024*1024)) $fragsize+=$block['size']; - $freetotal+=$block['size']; - } - $freeseg += count($mem['block_lists'][$i]); - } + // Fragementation: (freeseg - 1) / total_seg + $nseg = $freeseg = $fragsize = $freetotal = 0; + for($i=0; $i<$mem['num_seg']; $i++) { + $ptr = 0; + foreach($mem['block_lists'][$i] as $block) { + if ($block['offset'] != $ptr) { + ++$nseg; + } + $ptr = $block['offset'] + $block['size']; + /* Only consider blocks <5M for the fragmentation % */ + if($block['size']<(5*1024*1024)) $fragsize+=$block['size']; + $freetotal+=$block['size']; + } + $freeseg += count($mem['block_lists'][$i]); + } - if ($freeseg > 1) { - $frag = sprintf("%.2f%% (%s out of %s in %d fragments)", ($fragsize/$freetotal)*100,bsize($fragsize),bsize($freetotal),$freeseg); - } else { - $frag = "0%"; - } + if ($freeseg > 1) { + $frag = sprintf("%.2f%% (%s out of %s in %d fragments)", ($fragsize/$freetotal)*100,bsize($fragsize),bsize($freetotal),$freeseg); + } else { + $frag = "0%"; + } - if (graphics_avail()) { - $size='width='.(2*GRAPH_SIZE+150).' height='.(GRAPH_SIZE+10); - echo <<<EOB - <img alt="" $size src="$PHP_SELF?IMG=3&$time"> + if (graphics_avail()) { + $size='width='.(2*GRAPH_SIZE+150).' height='.(GRAPH_SIZE+10); + echo <<<EOB + <img alt="" $size src="$PHP_SELF?IMG=3&$time"> EOB; - } - echo <<<EOB - </br>Fragmentation: $frag - </td> - </tr> + } + echo <<<EOB + </br>Fragmentation: $frag + </td> + </tr> EOB; if(isset($mem['adist'])) { - foreach($mem['adist'] as $i=>$v) { - $cur = pow(2,$i); $nxt = pow(2,$i+1)-1; - if($i==0) $range = "1"; - else $range = "$cur - $nxt"; - echo "<tr><th align=right>$range</th><td align=right>$v</td></tr>\n"; - } + foreach($mem['adist'] as $i=>$v) { + $cur = pow(2,$i); $nxt = pow(2,$i+1)-1; + if($i==0) $range = "1"; + else $range = "$cur - $nxt"; + echo "<tr><th align=right>$range</th><td align=right>$v</td></tr>\n"; + } } echo <<<EOB - </tbody></table> - </div> + </tbody></table> + </div> EOB; - break; + break; // ----------------------------------------------- // User Cache Entries // ----------------------------------------------- case OB_USER_CACHE: - if (!$AUTHENTICATED) { - echo '<div class="error">You need to login to see the user values here!<br/> <br/>'; - put_login_link("Login now!"); - echo '</div>'; - break; - } - $fieldname='info'; - $fieldheading='User Entry Label'; - $fieldkey='info'; + if (!$AUTHENTICATED) { + echo '<div class="error">You need to login to see the user values here!<br/> <br/>'; + put_login_link("Login now!"); + echo '</div>'; + break; + } + $fieldname='info'; + $fieldheading='User Entry Label'; + $fieldkey='info'; - $cols=6; - echo <<<EOB - <div class=sorting><form>Scope: - <input type=hidden name=OB value={$MYREQUEST['OB']}> - <select name=SCOPE> + $cols=6; + echo <<<EOB + <div class=sorting><form>Scope: + <input type=hidden name=OB value={$MYREQUEST['OB']}> + <select name=SCOPE> EOB; - echo - "<option value=A",$MYREQUEST['SCOPE']=='A' ? " selected":"",">Active</option>", - "<option value=D",$MYREQUEST['SCOPE']=='D' ? " selected":"",">Deleted</option>", - "</select>", - ", Sorting:<select name=SORT1>", - "<option value=H",$MYREQUEST['SORT1']=='H' ? " selected":"",">Hits</option>", - "<option value=Z",$MYREQUEST['SORT1']=='Z' ? " selected":"",">Size</option>", - "<option value=S",$MYREQUEST['SORT1']=='S' ? " selected":"",">$fieldheading</option>", - "<option value=A",$MYREQUEST['SORT1']=='A' ? " selected":"",">Last accessed</option>", - "<option value=M",$MYREQUEST['SORT1']=='M' ? " selected":"",">Last modified</option>", - "<option value=C",$MYREQUEST['SORT1']=='C' ? " selected":"",">Created at</option>", - "<option value=D",$MYREQUEST['SORT1']=='D' ? " selected":"",">Deleted at</option>"; - if($fieldname=='info') echo - "<option value=T",$MYREQUEST['SORT1']=='T' ? " selected":"",">Timeout</option>"; - echo - '</select>', - '<select name=SORT2>', - '<option value=D',$MYREQUEST['SORT2']=='D' ? ' selected':'','>DESC</option>', - '<option value=A',$MYREQUEST['SORT2']=='A' ? ' selected':'','>ASC</option>', - '</select>', - '<select name=COUNT onChange="form.submit()">', - '<option value=10 ',$MYREQUEST['COUNT']=='10' ? ' selected':'','>Top 10</option>', - '<option value=20 ',$MYREQUEST['COUNT']=='20' ? ' selected':'','>Top 20</option>', - '<option value=50 ',$MYREQUEST['COUNT']=='50' ? ' selected':'','>Top 50</option>', - '<option value=100',$MYREQUEST['COUNT']=='100'? ' selected':'','>Top 100</option>', - '<option value=150',$MYREQUEST['COUNT']=='150'? ' selected':'','>Top 150</option>', - '<option value=200',$MYREQUEST['COUNT']=='200'? ' selected':'','>Top 200</option>', - '<option value=500',$MYREQUEST['COUNT']=='500'? ' selected':'','>Top 500</option>', - '<option value=0 ',$MYREQUEST['COUNT']=='0' ? ' selected':'','>All</option>', - '</select>', - ' Search: <input name=SEARCH value="',isset($MYREQUEST['SEARCH']) ? htmlspecialchars($MYREQUEST['SEARCH']) : '','" type=text size=25/>', - ' <input type=submit value="GO!">', - '</form></div>'; + echo + "<option value=A",$MYREQUEST['SCOPE']=='A' ? " selected":"",">Active</option>", + "<option value=D",$MYREQUEST['SCOPE']=='D' ? " selected":"",">Deleted</option>", + "</select>", + ", Sorting:<select name=SORT1>", + "<option value=H",$MYREQUEST['SORT1']=='H' ? " selected":"",">Hits</option>", + "<option value=Z",$MYREQUEST['SORT1']=='Z' ? " selected":"",">Size</option>", + "<option value=S",$MYREQUEST['SORT1']=='S' ? " selected":"",">$fieldheading</option>", + "<option value=A",$MYREQUEST['SORT1']=='A' ? " selected":"",">Last accessed</option>", + "<option value=M",$MYREQUEST['SORT1']=='M' ? " selected":"",">Last modified</option>", + "<option value=C",$MYREQUEST['SORT1']=='C' ? " selected":"",">Created at</option>", + "<option value=D",$MYREQUEST['SORT1']=='D' ? " selected":"",">Deleted at</option>"; + if($fieldname=='info') echo + "<option value=D",$MYREQUEST['SORT1']=='T' ? " selected":"",">Timeout</option>"; + echo + '</select>', + '<select name=SORT2>', + '<option value=D',$MYREQUEST['SORT2']=='D' ? ' selected':'','>DESC</option>', + '<option value=A',$MYREQUEST['SORT2']=='A' ? ' selected':'','>ASC</option>', + '</select>', + '<select name=COUNT onChange="form.submit()">', + '<option value=10 ',$MYREQUEST['COUNT']=='10' ? ' selected':'','>Top 10</option>', + '<option value=20 ',$MYREQUEST['COUNT']=='20' ? ' selected':'','>Top 20</option>', + '<option value=50 ',$MYREQUEST['COUNT']=='50' ? ' selected':'','>Top 50</option>', + '<option value=100',$MYREQUEST['COUNT']=='100'? ' selected':'','>Top 100</option>', + '<option value=150',$MYREQUEST['COUNT']=='150'? ' selected':'','>Top 150</option>', + '<option value=200',$MYREQUEST['COUNT']=='200'? ' selected':'','>Top 200</option>', + '<option value=500',$MYREQUEST['COUNT']=='500'? ' selected':'','>Top 500</option>', + '<option value=0 ',$MYREQUEST['COUNT']=='0' ? ' selected':'','>All</option>', + '</select>', + ' Search: <input name=SEARCH value="',$MYREQUEST['SEARCH'],'" type=text size=25/>', + ' <input type=submit value="GO!">', + '</form></div>'; - if (isset($MYREQUEST['SEARCH'])) { - // Don't use preg_quote because we want the user to be able to specify a - // regular expression subpattern. - $MYREQUEST['SEARCH_REGEX'] = '/'.str_replace('/', '\\/', $MYREQUEST['SEARCH']).'/i'; - if (preg_match($MYREQUEST['SEARCH_REGEX'], 'test') === false) { - echo '<div class="error">Error: enter a valid regular expression as a search query.</div>'; - break; - } - } + if (isset($MYREQUEST['SEARCH'])) { + // Don't use preg_quote because we want the user to be able to specify a + // regular expression subpattern. + $MYREQUEST['SEARCH'] = '/'.str_replace('/', '\\/', $MYREQUEST['SEARCH']).'/i'; + if (preg_match($MYREQUEST['SEARCH'], 'test') === false) { + echo '<div class="error">Error: enter a valid regular expression as a search query.</div>'; + break; + } + } - echo - '<div class="info"><table cellspacing=0><tbody>', - '<tr class="sticky">', - '<th>',sortheader('S',$fieldheading, "&OB=".$MYREQUEST['OB']),'</th>', - '<th>',sortheader('H','Hits', "&OB=".$MYREQUEST['OB']),'</th>', - '<th>',sortheader('Z','Size', "&OB=".$MYREQUEST['OB']),'</th>', - '<th>',sortheader('A','Last accessed',"&OB=".$MYREQUEST['OB']),'</th>', - '<th>',sortheader('M','Last modified',"&OB=".$MYREQUEST['OB']),'</th>', - '<th>',sortheader('C','Created at', "&OB=".$MYREQUEST['OB']),'</th>'; + echo + '<div class="info"><table cellspacing=0><tbody>', + '<tr>', + '<th>',sortheader('S',$fieldheading, "&OB=".$MYREQUEST['OB']),'</th>', + '<th>',sortheader('H','Hits', "&OB=".$MYREQUEST['OB']),'</th>', + '<th>',sortheader('Z','Size', "&OB=".$MYREQUEST['OB']),'</th>', + '<th>',sortheader('A','Last accessed',"&OB=".$MYREQUEST['OB']),'</th>', + '<th>',sortheader('M','Last modified',"&OB=".$MYREQUEST['OB']),'</th>', + '<th>',sortheader('C','Created at', "&OB=".$MYREQUEST['OB']),'</th>'; - if($fieldname=='info') { - $cols+=2; - echo '<th>',sortheader('T','Timeout',"&OB=".$MYREQUEST['OB']),'</th>'; - } - echo '<th>',sortheader('D','Deleted at',"&OB=".$MYREQUEST['OB']),'</th></tr>'; + if($fieldname=='info') { + $cols+=2; + echo '<th>',sortheader('T','Timeout',"&OB=".$MYREQUEST['OB']),'</th>'; + } + echo '<th>',sortheader('D','Deleted at',"&OB=".$MYREQUEST['OB']),'</th></tr>'; - // builds list with alpha numeric sortable keys - // - $list = array(); + // builds list with alpha numeric sortable keys + // + $list = []; - foreach($cache[$scope_list[$MYREQUEST['SCOPE']]] as $i => $entry) { - switch($MYREQUEST['SORT1']) { - case 'A': $k=sprintf('%015d-',$entry['access_time']); break; - case 'H': $k=sprintf('%015d-',$entry['num_hits']); break; - case 'Z': $k=sprintf('%015d-',$entry['mem_size']); break; - case 'M': $k=sprintf('%015d-',$entry['mtime']); break; - case 'C': $k=sprintf('%015d-',$entry['creation_time']); break; - case 'T': $k=sprintf('%015d-',$entry['ttl']); break; - case 'D': $k=sprintf('%015d-',$entry['deletion_time']); break; - case 'S': $k=$entry["info"]; break; - } - if (!$AUTHENTICATED) { - // hide all path entries if not logged in - $list[$k.$entry[$fieldname]]=preg_replace('/^.*(\\/|\\\\)/','*hidden*/',$entry); - } else { - $list[$k.$entry[$fieldname]]=$entry; - } - } + foreach($cache[$scope_list[$MYREQUEST['SCOPE']]] as $i => $entry) { + switch($MYREQUEST['SORT1']) { + case 'A': $k=sprintf('%015d-',$entry['access_time']); break; + case 'H': $k=sprintf('%015d-',$entry['num_hits']); break; + case 'Z': $k=sprintf('%015d-',$entry['mem_size']); break; + case 'M': $k=sprintf('%015d-',$entry['mtime']); break; + case 'C': $k=sprintf('%015d-',$entry['creation_time']); break; + case 'T': $k=sprintf('%015d-',$entry['ttl']); break; + case 'D': $k=sprintf('%015d-',$entry['deletion_time']); break; + case 'S': $k=$entry["info"]; break; + } + if (!$AUTHENTICATED) { + // hide all path entries if not logged in + $list[$k.$entry[$fieldname]]=preg_replace('/^.*(\\/|\\\\)/','*hidden*/',$entry); + } else { + $list[$k.$entry[$fieldname]]=$entry; + } + } + + if ($list) { + // sort list + // + switch ($MYREQUEST['SORT2']) { + case "A": krsort($list); break; + case "D": ksort($list); break; + } - if ($list) { - // sort list - // - switch ($MYREQUEST['SORT2']) { - case "A": krsort($list); break; - case "D": ksort($list); break; + // output list + $i=0; + foreach($list as $k => $entry) { + if(!$MYREQUEST['SEARCH'] || preg_match($MYREQUEST['SEARCH'], $entry[$fieldname]) != 0) { + $sh=md5($entry["info"]); + $field_value = htmlentities(strip_tags($entry[$fieldname],''), ENT_QUOTES, 'UTF-8'); + echo + '<tr id="key-'. $sh .'" class=tr-',$i%2,'>', + "<td class=td-0><a href=\"$MY_SELF&OB=",$MYREQUEST['OB'],"&SH=",$sh,"#key-". $sh ."\">",$field_value,'</a></td>', + '<td class="td-n center">',$entry['num_hits'],'</td>', + '<td class="td-n right">',$entry['mem_size'],'</td>', + '<td class="td-n center">',date(DATE_FORMAT,$entry['access_time']),'</td>', + '<td class="td-n center">',date(DATE_FORMAT,$entry['mtime']),'</td>', + '<td class="td-n center">',date(DATE_FORMAT,$entry['creation_time']),'</td>'; + + if($fieldname=='info') { + if($entry['ttl']) + echo '<td class="td-n center">'.$entry['ttl'].' seconds</td>'; + else + echo '<td class="td-n center">None</td>'; } + if ($entry['deletion_time']) { - // output list - $i=0; - foreach($list as $k => $entry) { - if(empty($MYREQUEST['SEARCH_REGEX']) || preg_match($MYREQUEST['SEARCH_REGEX'], $entry[$fieldname]) != 0) { - $sh=md5($entry["info"]); - $field_value = htmlentities(strip_tags($entry[$fieldname],''), ENT_QUOTES, 'UTF-8'); - if ($sh == $MYREQUEST["SH"]) { - $shstr = ""; - } else { - $shstr = "&SH=" . $sh; - } - $href = "$MY_SELF&OB=" . $MYREQUEST['OB'] . (!empty($MYREQUEST['SEARCH']) ? "&SEARCH=" . urlencode($MYREQUEST['SEARCH']) : '') . $shstr . "#key-" . $sh; - echo - '<tr id="key-'. $sh .'" class=tr-',$i%2,'>', - "<td class=td-0><a href=\"$href\">",$field_value,'</a></td>', - '<td class="td-n center">',$entry['num_hits'],'</td>', - '<td class="td-n right">',$entry['mem_size'],'</td>', - '<td class="td-n center">',date(DATE_FORMAT,$entry['access_time']),'</td>', - '<td class="td-n center">',date(DATE_FORMAT,$entry['mtime']),'</td>', - '<td class="td-n center">',date(DATE_FORMAT,$entry['creation_time']),'</td>'; + echo '<td class="td-last center">', date(DATE_FORMAT,$entry['deletion_time']), '</td>'; + } else if ($MYREQUEST['OB'] == OB_USER_CACHE) { - if($fieldname=='info') { - if($entry['ttl']) { - echo '<td class="td-n center">'.$entry['ttl'].' seconds</td>'; - } else { - echo '<td class="td-n center">None</td>'; - } - } - if ($entry['deletion_time']) { - echo '<td class="td-last center">', date(DATE_FORMAT,$entry['deletion_time']), '</td>'; - } else if ($MYREQUEST['OB'] == OB_USER_CACHE) { - echo '<td class="td-last center">'; - echo '[<a href="', $MY_SELF, '&OB=', $MYREQUEST['OB'], - '&DU=', urlencode($entry[$fieldkey]), - isset($MYREQUEST['SEARCH']) ? '&SEARCH=' . htmlspecialchars(urlencode($MYREQUEST['SEARCH'])) : '', - '">Delete Now</a>]'; - echo '</td>'; - } else { - echo '<td class="td-last center"> </td>'; - } - echo '</tr>'; - if ($sh == $MYREQUEST["SH"]) { - echo '<tr>'; - echo '<td colspan="7"><a class="entry-info" href="'.$href.'"><pre>'.htmlentities(print_r(apcu_fetch($entry['info']), 1)).'</pre></a></td>'; - echo '</tr>'; - } - $i++; - if ($i == $MYREQUEST['COUNT']) { - break; - } - } + echo '<td class="td-last center">'; + echo '[<a href="', $MY_SELF, '&OB=', $MYREQUEST['OB'], '&DU=', urlencode($entry[$fieldkey]), '">Delete Now</a>]'; + echo '</td>'; + } else { + echo '<td class="td-last center"> </td>'; } + echo '</tr>'; + if ($sh == $MYREQUEST["SH"]) { + echo '<tr>'; + echo '<td colspan="7"><pre>'.htmlentities(print_r(apcu_fetch($entry['info']), 1)).'</pre></td>'; + echo '</tr>'; + } + $i++; + if ($i == $MYREQUEST['COUNT']) + break; + } + } - } else { - echo '<tr class=tr-0><td class="center" colspan=',$cols,'><i>No data</i></td></tr>'; - } - echo <<< EOB - </tbody></table> + } else { + echo '<tr class=tr-0><td class="center" colspan=',$cols,'><i>No data</i></td></tr>'; + } + echo <<< EOB + </tbody></table> EOB; - if ($list && $i < count($list)) { - echo "<a href=\"$MY_SELF&OB=",$MYREQUEST['OB'],"&COUNT=0\"><i>",count($list)-$i,' more available...</i></a>'; - } + if ($list && $i < count($list)) { + echo "<a href=\"$MY_SELF&OB=",$MYREQUEST['OB'],"&COUNT=0\"><i>",count($list)-$i,' more available...</i></a>'; + } - echo <<< EOB - </div> + echo <<< EOB + </div> EOB; - break; + break; // ----------------------------------------------- // Version check // ----------------------------------------------- case OB_VERSION_CHECK: - echo <<<EOB - <div class="info"><h2>APCu Version Information</h2> - <table cellspacing=0><tbody> - <tr> - <th></th> - </tr> + echo <<<EOB + <div class="info"><h2>APCu Version Information</h2> + <table cellspacing=0><tbody> + <tr> + <th></th> + </tr> EOB; - if (defined('PROXY')) { - $ctxt = stream_context_create( array( 'http' => array( 'proxy' => PROXY, 'request_fulluri' => true ) ) ); - $rss = @file_get_contents("https://pecl.php.net/feeds/pkg_apcu.rss", false, $ctxt); - } else { - $rss = @file_get_contents("https://pecl.php.net/feeds/pkg_apcu.rss"); - } - if (!$rss) { - echo '<tr class="td-last center"><td>Unable to fetch version information.</td></tr>'; - } else { - $apcversion = phpversion('apcu'); + if (defined('PROXY')) { + $ctxt = stream_context_create( array( 'http' => array( 'proxy' => PROXY, 'request_fulluri' => True ) ) ); + $rss = @file_get_contents("http://pecl.php.net/feeds/pkg_apcu.rss", False, $ctxt); + } else { + $rss = @file_get_contents("http://pecl.php.net/feeds/pkg_apcu.rss"); + } + if (!$rss) { + echo '<tr class="td-last center"><td>Unable to fetch version information.</td></tr>'; + } else { + $apcversion = phpversion('apcu'); - if( preg_match('!<title>APCu ([0-9.]+)</title>!', $rss, $match) ) { - echo '<tr class="tr-0 center"><td>'; - if (version_compare($apcversion, $match[1], '>=')) { - echo '<div class="ok">You are running the latest version of APCu ('.$apcversion.')</div>'; - $i = 3; - } else { - echo '<div class="failed">You are running an older version of APCu ('.$apcversion.'), - newer version '.$match[1].' is available at <a href="https://pecl.php.net/package/APCu/'.$match[1].'"> - https://pecl.php.net/package/APCu/'.$match[1].'</a> - </div>'; - $i = -1; - } - echo '</td></tr>'; + preg_match('!<title>APCu ([0-9.]+)</title>!', $rss, $match); + echo '<tr class="tr-0 center"><td>'; + if (version_compare($apcversion, $match[1], '>=')) { + echo '<div class="ok">You are running the latest version of APCu ('.$apcversion.')</div>'; + $i = 3; + } else { + echo '<div class="failed">You are running an older version of APCu ('.$apcversion.'), + newer version '.$match[1].' is available at <a href="http://pecl.php.net/package/APCu/'.$match[1].'"> + http://pecl.php.net/package/APCu/'.$match[1].'</a> + </div>'; + $i = -1; } - echo '<tr class="tr-0"><td><h3>Change Log:</h3><br/>'; + echo '</td></tr>'; + echo '<tr class="tr-0"><td><h3>Change Log:</h3><br/>'; - preg_match_all('!<(title|description)>([^<]+)</\\1>!', $rss, $match); - $changelog = $match[2]; + preg_match_all('!<(title|description)>([^<]+)</\\1>!', $rss, $match); + next($match[2]); next($match[2]); - for ($j = 2; $j + 1 < count($changelog); $j += 2) { - $v = $changelog[$j]; - list(, $ver) = explode(' ', $v, 2); - if ($i < 0 && version_compare($apcversion, $ver, '>=')) { - break; - } else if (!$i--) { - break; - } - $changes = $changelog[$j + 1]; - echo "<b><a href=\"https://pecl.php.net/package/APCu/$ver\">".htmlspecialchars($v, ENT_QUOTES, 'UTF-8')."</a></b><br><blockquote>"; - echo nl2br(htmlspecialchars($changes, ENT_QUOTES, 'UTF-8'))."</blockquote>"; - } - echo '</td></tr>'; - } - echo <<< EOB - </tbody></table> - </div> + foreach ($match[2] as $v) { + list(,$ver) = explode(' ', $v, 2); + if ($i < 0 && version_compare($apcversion, $ver, '>=')) { + break; + } else if (!$i--) { + break; + } + echo "<b><a href=\"http://pecl.php.net/package/APCu/$ver\">".htmlspecialchars($v, ENT_QUOTES, 'UTF-8')."</a></b><br><blockquote>"; + echo nl2br(htmlspecialchars(current($match[2]), ENT_QUOTES, 'UTF-8'))."</blockquote>"; + next($match[2]); + } + echo '</td></tr>'; + } + echo <<< EOB + </tbody></table> + </div> EOB; - break; + break; } - echo <<< EOB - </div> +echo <<< EOB + </div> EOB; ?> -<!-- <?php echo "\nBased on APCGUI By R.Becker\n"?> --> +<!-- <?php echo "\nBased on APCGUI By R.Becker\n$VERSION\n"?> --> </body> </html> diff --git a/admin/backup.php b/admin/backup.php index daf0756..2db3548 100644..100755 --- a/admin/backup.php +++ b/admin/backup.php @@ -7,8 +7,9 @@ // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details. // Initialization -require_once( '../../kernel/includes/setup_inc.php' ); -require_once ( KERNEL_PKG_INCLUDE_PATH.'backups_lib.php' ); +namespace Bitweaver; +require_once '../../kernel/includes/setup_inc.php'; +require_once KERNEL_PKG_INCLUDE_PATH.'backups_lib.php'; // Check for admin permission $gBitSystem->verifyPermission( 'p_admin' ); @@ -16,7 +17,7 @@ $gBitSystem->verifyPermission( 'p_admin' ); global $gBitDbType; $backupPath = STORAGE_PKG_PATH."backups/$bitdomain"; -mkdir_p( $backupPath ); +KernelTools::mkdir_p( $backupPath ); if (isset($_REQUEST["generate"])) { @@ -63,9 +64,9 @@ if (isset($_REQUEST["upload"])) { fclose ($fw); unlink ($_FILES['userfile1']['tmp_name']); } else { - $gBitSmarty->assign('msg', tra("Upload failed")); + $gBitSmarty->assign('msg', KernelTools::tra("Upload failed")); - $gBitSystem->display( 'error.tpl' , NULL, array( 'display_mode' => 'admin' )); + $gBitSystem->display( 'error.tpl' , null, [ 'display_mode' => 'admin' ] ); die; } } @@ -73,7 +74,7 @@ if (isset($_REQUEST["upload"])) { // Get all the files listed in the backups directory // And put them in an array with the filemtime of // each file activated -$backups = array(); +$backups = []; $h = opendir( $backupPath.$bitdomain ); while ($file = readdir($h)) { @@ -87,10 +88,8 @@ while ($file = readdir($h)) { } closedir ($h); -$gBitSmarty->assignByRef('backups', $backups); +$gBitSmarty->assign('backups', $backups); $gBitSmarty->assign('bitdomain', $bitdomain); -$gBitSystem->display( 'bitpackage:kernel/backup.tpl', tra( 'Backups') , array( 'display_mode' => 'admin' )); - -?> +$gBitSystem->display( 'bitpackage:kernel/backup.tpl', KernelTools::tra( 'Backups') , array( 'display_mode' => 'admin' )); diff --git a/admin/browscap.ini b/admin/browscap.ini index 7e64caa..7e64caa 100644..100755 --- a/admin/browscap.ini +++ b/admin/browscap.ini diff --git a/admin/db_performance.php b/admin/db_performance.php index dd5070d..26f2088 100644..100755 --- a/admin/db_performance.php +++ b/admin/db_performance.php @@ -1,10 +1,10 @@ <?php - - require_once( '../../kernel/includes/setup_inc.php' ); +namespace Bitweaver; + require_once '../../kernel/includes/setup_inc.php'; if (!$gBitUser->isAdmin()) { - $gBitSmarty->assign('msg', tra("You dont have permission to use this feature")); - $gBitSystem->display( 'error.tpl' , NULL, array( 'display_mode' => 'admin' )); + $gBitSmarty->assign('msg', KernelTools::tra("You dont have permission to use this feature")); + $gBitSystem->display( 'error.tpl' , null, [ 'display_mode' => 'admin' ] ); die; } @@ -19,7 +19,7 @@ ?> <p style="color:red;">To activate database performance, please add to you config/kernel/config_inc.php:<br> -<code>define( 'DB_PERFORMANCE_STATS', TRUE ); </code> +<code>define( 'DB_PERFORMANCE_STATS', true ); </code> <?php } @@ -28,6 +28,5 @@ For more information, see the <a href="http://phplens.com/lens/adodb/docs-perf.h </p> <?php - $perf = NewPerfMonitor( $gBitSystem->mDb->mDb ); + $perf = \NewPerfMonitor( $gBitSystem->mDb->mDb ); $perf->UI($pollsecs=5); -?> diff --git a/admin/index.php b/admin/index.php index eadae59..367a62f 100644..100755 --- a/admin/index.php +++ b/admin/index.php @@ -8,9 +8,9 @@ // Initialization global $gForceAdodb; -$gForceAdodb = TRUE; -require_once( '../../kernel/includes/setup_inc.php' ); -require_once( KERNEL_PKG_INCLUDE_PATH.'simple_form_functions_lib.php' ); +$gForceAdodb = true; +require_once '../../kernel/includes/setup_inc.php'; +require_once KERNEL_PKG_INCLUDE_PATH.'simple_form_functions_lib.php'; //make an alias in case anyone decides to verifyInstalledPackages $gBitInstaller = &$gBitSystem; @@ -20,7 +20,7 @@ if( !empty( $_REQUEST["page"] )) { // only admins may use this page $gBitSystem->verifyPermission( 'p_'.$page.'_admin' ); - + if( preg_match( '/\.php/', $page )) { $adminPage = $page; } else { @@ -61,17 +61,17 @@ if( !empty( $_REQUEST["page"] )) { $gBitSmarty->assign( 'adminFile', $adminFile ); $gBitSmarty->assign( 'page', $page ); $gBitSystem->setBrowserTitle( preg_replace( '/_/', ' ', $page )." Settings" ); - - include_once ( $adminPage ); + + include_once $adminPage; // Spiderr - a bit hackish, but need to force preferences refresh $gBitSystem->loadConfig(); } else { - $adminTemplates = array(); + $adminTemplates = []; // deal with package sorting for a unified layout $packages = array_keys( $gBitSystem->mPackages ); asort( $packages ); - $packages = array_unique( array_merge( array( 'kernel', 'liberty', 'users', 'themes' ), $packages )); + $packages = array_unique( array_merge( [ 'kernel', 'liberty', 'users', 'themes' ], $packages )); foreach( $packages as $package ) { if( $gBitUser->hasPermission( 'p_'.$package.'_admin' ) ) { $lowerPackage = strtolower( $package ); @@ -84,17 +84,15 @@ if( !empty( $_REQUEST["page"] )) { if( !empty( $adminTemplates ) ) { $gBitSystem->setBrowserTitle( 'Administration' ); - $gBitSmarty->assignByRef( 'adminTemplates', $adminTemplates ); + $gBitSmarty->assign( 'adminTemplates', $adminTemplates ); } else { $gBitSystem->verifyPermission( 'p_admin' ); } } - if( !empty( $_REQUEST['version_check'] ) && $gBitUser->isAdmin() ) { $gBitSmarty->assign( 'version_info', $gBitSystem->checkBitVersion() ); } // Display the template -$gBitSystem->display( 'bitpackage:kernel/admin.tpl' , NULL, array( 'display_mode' => 'admin' )); -?> +$gBitSystem->display( 'bitpackage:kernel/admin.tpl' , null, [ 'display_mode' => 'admin' ]); diff --git a/admin/list_cache.php b/admin/list_cache.php index 246beb8..3794e9e 100644..100755 --- a/admin/list_cache.php +++ b/admin/list_cache.php @@ -29,7 +29,7 @@ if ( empty( $_REQUEST["sort_mode"] ) ) { $sort_mode = $_REQUEST["sort_mode"]; } -$gBitSmarty->assignByRef('sort_mode', $sort_mode); +$gBitSmarty->assign('sort_mode', $sort_mode); // If offset is set use it if not then use offset =0 // use the max_records php variable to set the limit @@ -40,7 +40,7 @@ if (!isset($_REQUEST["offset"])) { $offset = $_REQUEST["offset"]; } -$gBitSmarty->assignByRef('offset', $offset); +$gBitSmarty->assign('offset', $offset); if (!isset($_REQUEST["find"])) { $find = ''; @@ -55,7 +55,7 @@ $listpages = $gBitSystem->list_cache($offset, $max_records, $sort_mode, $find); // If there're more records then assign next_offset $cant_pages = ceil($listpages["cant"] / $max_records); -$gBitSmarty->assignByRef('cant_pages', $cant_pages); +$gBitSmarty->assign('cant_pages', $cant_pages); $gBitSmarty->assign('actual_page', 1 + ($offset / $max_records)); if ($listpages["cant"] > ($offset + $max_records)) { @@ -71,11 +71,11 @@ if ($offset > 0) { $gBitSmarty->assign('prev_offset', -1); } -$gBitSmarty->assignByRef('listpages', $listpages["data"]); +$gBitSmarty->assign('listpages', $listpages["data"]); //print_r($listpages["data"]); // Display the template -$gBitSystem->display( 'bitpackage:kernel/list_cache.tpl', NULL, array( 'display_mode' => 'list' )); +$gBitSystem->display( 'bitpackage:kernel/list_cache.tpl', null, array( 'display_mode' => 'list' )); ?> diff --git a/admin/mime.types b/admin/mime.types index fef6fb6..fef6fb6 100644..100755 --- a/admin/mime.types +++ b/admin/mime.types diff --git a/admin/phpinfo.php b/admin/phpinfo.php index bbc8ed7..89d9060 100644..100755 --- a/admin/phpinfo.php +++ b/admin/phpinfo.php @@ -7,7 +7,6 @@ // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details. // Initialization -require_once( '../../kernel/includes/setup_inc.php' ); +require_once '../../kernel/includes/setup_inc.php'; $gBitSystem->verifyPermission( 'p_admin' ); phpinfo(); -?> diff --git a/admin/remote_backup.php b/admin/remote_backup.php index a235b82..d33f896 100644..100755 --- a/admin/remote_backup.php +++ b/admin/remote_backup.php @@ -10,10 +10,10 @@ // http://localhost/tiki/kernel/remote_backup.php?generate=1&my_word=ThisIsMySecretBackupWord" // PLEASE UNCOMMENT THIS LINE TO ACTIVATE REMOTE BACKUPS (DISABLED IN THE DISTRIBUTION) -die; +// die; -require_once( '../../kernel/includes/setup_inc.php' ); -include_once('lib/backups/backupslib.php'); +require_once '../../kernel/includes/setup_inc.php'; +include_once 'lib/backups/backupslib.php'; if(isset($_REQUEST["generate"])) { if(isset($_REQUEST["my_word"]) && $_REQUEST["my_word"] == "YOUR PASSWORD FOR BACKUPS HERE" ) { @@ -24,5 +24,3 @@ if(isset($_REQUEST["generate"])) { } die; - -?> diff --git a/admin/schema_inc.php b/admin/schema_inc.php index 6d03c41..b6acc58 100644..100755 --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -1,9 +1,9 @@ <?php -$tables = array( +$tables = [ 'adodb_logsql' => " - created T NOT NULL, + created T NOT null, sql0 C(250) NOTNULL, sql1 X NOTNULL, params X NOTNULL, @@ -12,7 +12,7 @@ $tables = array( ", 'kernel_config' => " - config_name C(64) PRIMARY, + config_name C(40) PRIMARY, package C(100), config_value C(250) ", @@ -30,87 +30,85 @@ $tables = array( session_data X not null ", -); +]; global $gBitInstaller; foreach( array_keys( $tables ) AS $tableName ) { - $gBitInstaller->registerSchemaTable( KERNEL_PKG_NAME, $tableName, $tables[$tableName], TRUE ); + $gBitInstaller->registerSchemaTable( KERNEL_PKG_NAME, $tableName, $tables[$tableName], true ); } -$gBitInstaller->registerPackageInfo( KERNEL_PKG_NAME, array( +$gBitInstaller->registerPackageInfo( KERNEL_PKG_NAME, [ 'description' => "This is the heart of the application. Without this --> nothing.", 'license' => '<a href="http://www.gnu.org/licenses/licenses.html#LGPL">LGPL</a>', -)); +] ); // Default Preferences -$gBitInstaller->registerPreferences( KERNEL_PKG_NAME, array( - array( KERNEL_PKG_NAME, 'site_online_help' , 'y' ), - array( KERNEL_PKG_NAME, 'site_edit_help' , 'y' ), - array( KERNEL_PKG_NAME, 'site_form_help' , 'y' ), - array( KERNEL_PKG_NAME, 'site_short_date_format' , '%d %b %Y' ), - array( KERNEL_PKG_NAME, 'site_short_time_format' , '%H:%M %Z' ), - array( KERNEL_PKG_NAME, 'site_upload_dir' , 'storage' ), - array( KERNEL_PKG_NAME, 'site_closed_msg' , 'Site is closed for maintainance; please come back later.' ), - array( KERNEL_PKG_NAME, 'site_http_port' , '80' ), - array( KERNEL_PKG_NAME, 'site_http_prefix' , '/' ), - array( KERNEL_PKG_NAME, 'site_https_port' , '443' ), - array( KERNEL_PKG_NAME, 'site_https_prefix' , '/' ), - array( KERNEL_PKG_NAME, 'users_count_admin_pageviews' , 'y' ), - array( KERNEL_PKG_NAME, 'site_display_utc' , 'UTC' ), - array( KERNEL_PKG_NAME, 'site_long_date_format' , '%A %d of %B, %Y' ), - array( KERNEL_PKG_NAME, 'site_long_time_format' , '%H:%M:%S %Z' ), - array( KERNEL_PKG_NAME, 'site_top_column' , 'y' ), - array( KERNEL_PKG_NAME, 'site_right_column' , 'y' ), - array( KERNEL_PKG_NAME, 'site_left_column' , 'y' ), - array( KERNEL_PKG_NAME, 'site_bottom_column' , 'y' ), - array( KERNEL_PKG_NAME, 'site_display_reltime' , 'y' ), - array( KERNEL_PKG_NAME, 'max_records' , '10' ), - array( KERNEL_PKG_NAME, 'language' , 'en' ), - array( KERNEL_PKG_NAME, 'site_sender_email' , '' ), - array( KERNEL_PKG_NAME, 'site_url_index' , '' ), -)); +$gBitInstaller->registerPreferences( KERNEL_PKG_NAME, [ + [ KERNEL_PKG_NAME, 'site_online_help' , 'y' ], + [ KERNEL_PKG_NAME, 'site_edit_help' , 'y' ], + [ KERNEL_PKG_NAME, 'site_form_help' , 'y' ], + [ KERNEL_PKG_NAME, 'site_short_date_format' , '%d %b %Y' ], + [ KERNEL_PKG_NAME, 'site_short_time_format' , '%H:%M %Z' ], + [ KERNEL_PKG_NAME, 'site_upload_dir' , 'storage' ], + [ KERNEL_PKG_NAME, 'site_closed_msg' , 'Site is closed for maintainance; please come back later.' ], + [ KERNEL_PKG_NAME, 'site_http_port' , '80' ], + [ KERNEL_PKG_NAME, 'site_http_prefix' , '/' ], + [ KERNEL_PKG_NAME, 'site_https_port' , '443' ], + [ KERNEL_PKG_NAME, 'site_https_prefix' , '/' ], + [ KERNEL_PKG_NAME, 'users_count_admin_pageviews' , 'y' ], + [ KERNEL_PKG_NAME, 'site_display_utc' , 'UTC' ], + [ KERNEL_PKG_NAME, 'site_long_date_format' , '%A %d of %B, %Y' ], + [ KERNEL_PKG_NAME, 'site_long_time_format' , '%H:%M:%S %Z' ], + [ KERNEL_PKG_NAME, 'site_top_column' , 'y' ], + [ KERNEL_PKG_NAME, 'site_right_column' , 'y' ], + [ KERNEL_PKG_NAME, 'site_left_column' , 'y' ], + [ KERNEL_PKG_NAME, 'site_bottom_column' , 'y' ], + [ KERNEL_PKG_NAME, 'site_display_reltime' , 'y' ], + [ KERNEL_PKG_NAME, 'max_records' , '10' ], + [ KERNEL_PKG_NAME, 'language' , 'en' ], + [ KERNEL_PKG_NAME, 'site_sender_email' , '' ], + [ KERNEL_PKG_NAME, 'site_url_index' , '' ], +] ); -$moduleHash = array( - array( - 'title' => NULL, +$moduleHash = [ + [ + 'title' => null, 'pos' => 5, 'layout_area' => 't', 'module_rsrc' => 'bitpackage:kernel/mod_site_title.tpl', - ), - array( - 'title' => NULL, + ], + [ + 'title' => null, 'pos' => 10, 'layout_area' => 't', 'module_rsrc' => 'bitpackage:kernel/mod_top_menu.tpl', - ), - array( - 'title' => NULL, + ], + [ + 'title' => null, 'pos' => 5, 'layout_area' => 'r', 'module_rsrc' => 'bitpackage:kernel/mod_package_menu.tpl', - ), - array( - 'title' => NULL, + ], + [ + 'title' => null, 'pos' => 5, 'layout_area' => 'b', 'module_rsrc' => 'bitpackage:kernel/mod_bottom_bar.tpl', - ), -); + ], +]; $gBitInstaller->registerModules( $moduleHash ); // ### Default UserPermissions -$gBitInstaller->registerUserPermissions( KERNEL_PKG_NAME, array( - array( 'p_admin' , 'Can manage users groups and permissions and all aspects of site management' , 'admin' , KERNEL_PKG_NAME ), - array( 'p_access_closed_site' , 'Can access site when closed' , 'admin' , KERNEL_PKG_NAME ) -)); +$gBitInstaller->registerUserPermissions( KERNEL_PKG_NAME, [ + [ 'p_admin' , 'Can manage users groups and permissions and all aspects of site management' , 'admin' , KERNEL_PKG_NAME ], + [ 'p_access_closed_site' , 'Can access site when closed' , 'admin' , KERNEL_PKG_NAME ] +] ); // Package requirements -$gBitInstaller->registerRequirements( KERNEL_PKG_NAME, array( - 'liberty' => array( 'min' => '2.1.0' ), - 'users' => array( 'min' => '2.1.0' ), - 'themes' => array( 'min' => '2.0.0' ), - 'languages' => array( 'min' => '2.0.0' ), -)); - -?> +$gBitInstaller->registerRequirements( KERNEL_PKG_NAME, [ + 'liberty' => [ 'min' => '5.0.0' ], + 'users' => [ 'min' => '5.0.0' ], + 'themes' => [ 'min' => '5.0.0' ], + 'languages' => [ 'min' => '5.0.0' ], +] ); diff --git a/admin/sitemaps.php b/admin/sitemaps.php index 4be74f3..d785f7d 100644..100755 --- a/admin/sitemaps.php +++ b/admin/sitemaps.php @@ -10,9 +10,9 @@ // Initialization -require_once( '../../kernel/includes/setup_inc.php' ); +require_once '../../kernel/includes/setup_inc.php'; -include_once( KERNEL_PKG_INCLUDE_PATH.'notification_lib.php' ); +include_once KERNEL_PKG_INCLUDE_PATH.'notification_lib.php'; // Check for admin permission $gBitSystem->verifyPermission( 'p_admin' ); @@ -26,8 +26,7 @@ foreach( $gBitSystem->mPackages as $packageName => $package ) { } } -$gBitSmarty->assignByRef( 'gSiteMapHash', $gSiteMapHash ); +$gBitSmarty->assign( 'gSiteMapHash', $gSiteMapHash ); // Display the template -$gBitSystem->display( 'bitpackage:kernel/admin_sitemaps.tpl', NULL, array( 'display_mode' => 'admin' )); - +$gBitSystem->display( 'bitpackage:kernel/admin_sitemaps.tpl', null, [ 'display_mode' => 'admin' ] ); |
