blog && $core->auth->check($permissions,$core->blog->id)) { return; } if (session_id()) { $core->session->destroy(); } http::redirect(DC_AUTH_PAGE); } # Check super admin public static function checkSuper() { global $core; if (!$core->auth->isSuperAdmin()) { if (session_id()) { $core->session->destroy(); } http::redirect(DC_AUTH_PAGE); } } # Top of admin page public static function open($title='', $head='') { global $core; # List of user's blogs if ($core->auth->blog_count == 1 || $core->auth->blog_count > 20) { $blog_box = '

'.__('Blog:').' '. html::escapeHTML($core->blog->name).''; if ($core->auth->blog_count > 20) { $blog_box .= ' - '.__('Change blog').''; } $blog_box .= '

'; } else { $rs_blogs = $core->getBlogs(array('order'=>'LOWER(blog_name)','limit'=>20)); $blogs = array(); while ($rs_blogs->fetch()) { $blogs[html::escapeHTML($rs_blogs->blog_name.' - '.$rs_blogs->blog_url)] = $rs_blogs->blog_id; } $blog_box = '

'. ''; } $safe_mode = isset($_SESSION['sess_safe_mode']) && $_SESSION['sess_safe_mode']; # Display header('Content-Type: text/html; charset=UTF-8'); echo ''."\n". ''."\n". "\n". ' '."\n". ' '.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.''."\n". ' '."\n". ' '."\n". self::jsLoadIE7(). ' '."\n"; if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') { echo ' '."\n"; } $core->auth->user_prefs->addWorkspace('interface'); $user_ui_hide_std_favicon = $core->auth->user_prefs->interface->hide_std_favicon; if (!$user_ui_hide_std_favicon) { echo ''; } echo self::jsCommon(). $head; # --BEHAVIOR-- adminPageHTMLHead $core->callBehavior('adminPageHTMLHead'); echo "\n". ''."\n". ''; echo '
'."\n". '
'."\n". '
'."\n"; # Safe mode if ($safe_mode) { echo '

'.__('Safe mode').'

'. '

'.__('You are in safe mode. All plugins have been temporarily disabled. Remind to log out then log in again normally to get back all functionalities').'

'. '
'; } if ($core->error->flag()) { echo '

'.(count($core->error->getErrors()) > 1 ? __('Errors:') : __('Error:')).'

'. $core->error->toHTML(). '
'; } } public static function close() { global $core; $menu =& $GLOBALS['_menu']; echo "
\n". // End of #content "
\n". // End of #main ''."\n". // End of #main-menu ''."\n". "
\n"; // End of #wrapper if (defined('DC_DEV') && DC_DEV === true) { echo self::debugInfo(); } echo ''; } public static function openPopup($title='', $head='') { global $core; # Display header('Content-Type: text/html; charset=UTF-8'); echo ''."\n". ''."\n". "\n". ' '."\n". ' '.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.''."\n". ' '."\n". ' '."\n". self::jsLoadIE7(). ' '."\n"; if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') { echo ' '."\n"; } echo self::jsCommon(). $head; # --BEHAVIOR-- adminPageHTMLHead $core->callBehavior('adminPageHTMLHead'); echo "\n". ''."\n". '

'.DC_VENDOR_NAME.'

'."\n"; echo '
'."\n". '
'."\n". '
'."\n"; if ($core->error->flag()) { echo '
'.__('Errors:').''. $core->error->toHTML(). '
'; } } public static function closePopup() { echo "
\n". // End of #content "
\n". // End of #main ''."\n". "
\n". // End of #wrapper ''; } public static function message($msg,$timestamp=true,$div=false,$echo=true) { global $core; $res = ''; if ($msg != '') { $res = ($div ? '
' : '').''. ($timestamp ? dt::str(__('%H:%M:%S:'),null,$core->auth->getInfo('user_tz')).' ' : '').$msg. '

'.($div ? '
' : ''); if ($echo) { echo $res; } } return $res; } private static function debugInfo() { $global_vars = implode(', ',array_keys($GLOBALS)); $res = '
'. '

memory usage: '.memory_get_usage().' ('.files::size(memory_get_usage()).')

'; if (function_exists('xdebug_get_profiler_filename')) { $res .= '

Elapsed time: '.xdebug_time_index().' seconds

'; $prof_file = xdebug_get_profiler_filename(); if ($prof_file) { $res .= '

Profiler file : '.xdebug_get_profiler_filename().'

'; } else { $prof_url = http::getSelfURI(); $prof_url .= (strpos($prof_url,'?') === false) ? '?' : '&'; $prof_url .= 'XDEBUG_PROFILE'; $res .= '

Trigger profiler

'; } /* xdebug configuration: zend_extension = /.../xdebug.so xdebug.auto_trace = On xdebug.trace_format = 0 xdebug.trace_options = 1 xdebug.show_mem_delta = On xdebug.profiler_enable = 0 xdebug.profiler_enable_trigger = 1 xdebug.profiler_output_dir = /tmp xdebug.profiler_append = 0 xdebug.profiler_output_name = timestamp */ } $res .= '

Global vars: '.$global_vars.'

'. '
'; return $res; } public static function help($page,$index='') { # Deprecated but we keep this for plugins. } public static function helpBlock() { $args = func_get_args(); if (empty($args)) { return; }; global $__resources; if (empty($__resources['help'])) { return; } $content = ''; foreach ($args as $v) { if (is_object($v) && isset($v->content)) { $content .= $v->content; continue; } if (!isset($__resources['help'][$v])) { continue; } $f = $__resources['help'][$v]; if (!file_exists($f) || !is_readable($f)) { continue; } $fc = file_get_contents($f); if (preg_match('|]*?>(.*?)|ms',$fc,$matches)) { $content .= $matches[1]; } else { $content .= $fc; } } if (trim($content) == '') { return; } echo '

'.__('Help').'

'. $content. '
'; } public static function jsLoad($src) { $escaped_src = html::escapeHTML($src); if (!isset(self::$loaded_js[$escaped_src])) { self::$loaded_js[$escaped_src]=true; return ''."\n"; } } public static function jsVar($n,$v) { return $n." = '".html::escapeJS($v)."';\n"; } public static function jsCommon() { return self::jsLoad('js/jquery/jquery.js'). self::jsLoad('js/jquery/jquery.biscuit.js'). self::jsLoad('js/jquery/jquery.bgFade.js'). self::jsLoad('js/common.js'). self::jsLoad('js/prelude.js'). '\n"; } public static function jsLoadIE7() { return ''."\n"; } public static function jsConfirmClose() { $args = func_get_args(); if (count($args) > 0) { foreach ($args as $k => $v) { $args[$k] = "'".html::escapeJS($v)."'"; } $args = implode(',',$args); } else { $args = ''; } return self::jsLoad('js/confirm-close.js'). '\n"; } public static function jsPageTabs($default=null) { if ($default) { $default = "'".html::escapeJS($default)."'"; } return self::jsLoad('js/jquery/jquery.pageTabs.js'). '\n"; } public static function jsModal() { return ''."\n". self::jsLoad('js/jquery/jquery.modal.js'). '\n"; } public static function jsColorPicker() { return ''."\n". self::jsLoad('js/jquery/jquery.farbtastic.js'). self::jsLoad('js/color-picker.js'); } public static function jsDatePicker() { return ''."\n". self::jsLoad('js/date-picker.js'). '\n"; } public static function jsToolBar() { $res = ''. ''; if (isset($GLOBALS['core']->auth) && $GLOBALS['core']->auth->getOption('enable_wysiwyg')) { $res .= ''; } $res .= ''. '\n"; return $res; } public static function jsUpload($params=array(),$base_url=null) { if (!$base_url) { $base_url = path::clean(dirname(preg_replace('/(\?.*$)?/','',$_SERVER['REQUEST_URI']))).'/'; } $params = array_merge($params,array( 'sess_id='.session_id(), 'sess_uid='.$_SESSION['sess_browser_uid'], 'xd_check='.$GLOBALS['core']->getNonce() )); return ''."\n". ' '. self::jsLoad('js/jsUpload/vendor/jquery.ui.widget.js'). self::jsLoad('js/jsUpload/tmpl.js'). self::jsLoad('js/jsUpload/load-image.js'). self::jsLoad('js/jsUpload/jquery.iframe-transport.js'). self::jsLoad('js/jsUpload/jquery.fileupload.js'). self::jsLoad('js/jsUpload/jquery.fileupload-process.js'). self::jsLoad('js/jsUpload/jquery.fileupload-resize.js'). self::jsLoad('js/jsUpload/jquery.fileupload-ui.js'). '\n"; } public static function jsToolMan() { return ''. ''. ''. ''. ''. ''. ''; } public static function jsMetaEditor() { return ''; } } ?>