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').''; } } 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"; } echo self::jsCommon(). $head; # --BEHAVIOR-- adminPageHTMLHead $core->callBehavior('adminPageHTMLHead'); echo "\n". ''."\n". '

'.DC_VENDOR_NAME.'

'."\n"; echo '
'. '
'. $blog_box. ''.__('Go to site').' '. '
'. '
'. '
'. ' '.__('User:').' '.$core->auth->userID().''. ' - '.__('Logout').' '. '
'. '
'; 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 '
'.__('Errors:').''. $core->error->toHTML(). '
'; } } public static function close() { $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 ''; } 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) { 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'). '\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() { $tb = new dcToolBar($GLOBALS['core']); // Add xhtml toolbar $tb->addFormatter('xhtml'); $tb->addSettings('xhtml',array( 'mode' => 'textareas', 'relative_urls' => 'false', 'theme' => 'advanced', 'skin' => 'dotclear', 'theme_advanced_toolbar_location' => 'top', 'theme_advanced_toolbar_align' => 'left', 'theme_advanced_statusbar_location' => 'bottom', 'theme_advanced_resizing' => 'true', 'theme_advanced_resize_horizontal' => 'false', 'theme_advanced_blockformats' => 'p,pre,h1,h2,h3,h4', 'convert_newlines_to_brs' => 'true', 'paste_auto_cleanup_on_paste' => 'true', 'formats' => '{underline: {inline: "ins"},strikethrough: {inline: "del"},inlinecode: {inline: "code"},quote: {inline: "q"}}' )); $tb->addPlugins('xhtml',array( 'fullscreen' => true, 'paste' => true, 'searchreplace' => true, 'dcControls' => true )); $tb->addButtons('xhtml',array( 1 => array( 'justifyleft', 'justifycenter', 'justifyright', 'separator', 'bold', 'italic', 'underline', 'strikethrough', 'inlinecode', 'quote', 'sub', 'sup', 'separator', 'blockquote', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'undo', 'redo', 'separator', 'fullscreen', 'separator', 'code' ), 2 => array( 'formatselect', 'removeformat', 'cleanup', 'separator', 'pastetext', 'pasteword', 'separator', 'search', 'replace' ), 3 => array( 'link', 'unlink', 'separator', 'media', 'webmedia', 'separator', 'hr', 'charmap', 'visualchars' ) )); // Add wiki toolbar $tb->addFormatter('wiki'); $tb->addSettings('wiki',array( 'mode' => 'none', 'relative_urls' => 'false', 'theme' => 'advanced', 'skin' => 'dotclear', 'theme_advanced_toolbar_location' => 'top', 'theme_advanced_toolbar_align' => 'left', 'theme_advanced_statusbar_location' => 'bottom', 'theme_advanced_resizing' => 'true', 'theme_advanced_resize_horizontal' => 'false', 'theme_advanced_path' => 'false', 'theme_advanced_blockformats' => 'p,pre,h1,h2,h3,h4', 'entity_encoding' => 'raw', 'remove_linebreaks' => 'false', 'inline_styles' => 'false', 'convert_fonts_to_spans' => 'false', 'paste_auto_cleanup_on_paste' => 'true', 'force_br_newlines' => 'true', 'force_p_newlines' => 'false', 'forced_root_block' => '', 'formats' => '{underline: {inline: "ins"},strikethrough: {inline: "del"},inlinecode: {inline: "code"},quote: {inline: "q"}}' )); $tb->addPlugins('wiki',array( 'fullscreen' => true, 'paste' => true, 'searchreplace' => true, 'dcControls' => true )); $tb->addButtons('wiki',array( 1 => array( 'formatselect', 'bold', 'italic', 'underline', 'strikethrough', 'quote', 'inlinecode', 'separator', 'blockquote', 'bullist', 'numlist', 'separator', 'link', 'unlink', 'separator', 'search', 'replace', 'separator', 'undo', 'redo', 'separator', 'fullscreen', 'separator', 'code' ) )); $tb->addI18n('common',array( 'edit_confirm' => __('Do you want to use the WYSIWYG mode for this textarea?'), 'apply' => __('Apply'), 'insert' => __('Insert'), 'update' => __('Update'), 'cancel' => __('Cancel'), 'close' => __('Close'), 'browse' => __('Browse'), 'class_name' => __('Class'), 'not_set' => __('-- Not set --'), 'clipboard_msg' => __('Copy/Cut/Paste is not available in Mozilla and Firefox. Do you want more information about this issue?'), 'clipboard_no_support' => __('Currently not supported by your browser, use keyboard shortcuts instead.'), 'popup_blocked' => __('Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.'), 'invalid_data' => __('{#field} is invalid'), 'invalid_data_number' => __('{#field} must be a number'), 'invalid_data_min' => __('{#field} must be a number greater than {#min}'), 'invalid_data_size' => __('{#field} must be a number or percentage'), 'more_colors' => __('More colors') )); $tb->addI18n('advanced',array( 'style_select' => __('Styles'), 'font_size' => __('Font size'), 'fontdefault' => __('Font family'), 'block' => __('Format'), 'paragraph' => __('Paragraph'), 'div' => __('Div'), 'address' => __('Address'), 'pre' => __('Preformatted'), 'h1' => __('Heading 1'), 'h2' => __('Heading 2'), 'h3' => __('Heading 3'), 'h4' => __('Heading 4'), 'h5' => __('Heading 5'), 'h6' => __('Heading 6'), 'blockquote' => __('Blockquote'), 'code' => __('Code'), 'samp' => __('Code sample'), 'dt' => __('Definition term '), 'dd' => __('Definition description'), 'bold_desc' => __('Bold (Ctrl+B)'), 'italic_desc' => __('Italic (Ctrl+I)'), 'underline_desc' => __('Underline (Ctrl+U)'), 'striketrough_desc' => __('Strikethrough'), 'justifyleft_desc' => __('Align left'), 'justifycenter_desc' => __('Align center'), 'justifyright_desc' => __('Align right'), 'justifyfull_desc' => __('Align full'), 'bullist_desc' => __('Unordered list'), 'numlist_desc' => __('Ordered list'), 'outdent_desc' => __('Outdent'), 'indent_desc' => __('Indent'), 'undo_desc' => __('Undo (Ctrl+Z)'), 'redo_desc' => __('Redo (Ctrl+Y)'), 'link_desc' => __('Insert/edit link'), 'unlink_desc' => __('Unlink'), 'image_desc' => __('Insert/edit image'), 'cleanup_desc' => __('Cleanup messy code'), 'code_desc' => __('Edit HTML Source'), 'sub_desc' => __('Subscript'), 'sup_desc' => __('Superscript'), 'hr_desc' => __('Insert horizontal ruler'), 'removeformat_desc' => __('Remove formatting'), 'custom1_desc' => __('Your custom description here'), 'forecolor_desc' => __('Select text color'), 'backcolor_desc' => __('Select background color'), 'charmap_desc' => __('Insert custom character'), 'visualaid_desc' => __('Toggle guidelines/invisible elements'), 'anchor_desc' => __('Insert/edit anchor'), 'cut_desc' => __('Cut'), 'copy_desc' => __('Copy'), 'paste_desc' => __('Paste'), 'image_props_desc' => __('Image properties'), 'newdocument_desc' => __('New document'), 'help_desc' => __('Help'), 'blockquote_desc' => __('Blockquote'), 'clipboard_msg' => __('Copy/Cut/Paste is not available in Mozilla and Firefox.\r\nDo you want more information about this issue?'), 'path' => __('Path'), 'newdocument' => __('Are you sure you want clear all contents?'), 'toolbar_focus' => __('Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X'), 'more_colors' => __('More colors'), 'shortcuts_desc' => __('Accessibility Help'), 'help_shortcut' => __('. Press ALT F10 for toolbar. Press ALT 0 for help.'), 'rich_text_area' => __('Rich Text Area'), 'toolbar' => __('Toolbar') )); $tb->addI18n('advanced_dlg',array( 'about_title' => __('About TinyMCE'), 'about_general' => __('About'), 'about_help' => __('Help'), 'about_license' => __('License'), 'about_plugins' => __('Plugins'), 'about_plugin' => __('Plugin'), 'about_author' => __('Author'), 'about_version' => __('Version'), 'about_loaded' => __('Loaded plugins'), 'anchor_title' => __('Insert/edit anchor'), 'anchor_name' => __('Anchor name'), 'anchor_invalid' => __('Please specify a valid anchor name.'), 'code_title' => __('HTML Source Editor'), 'code_wordwrap' => __('Word wrap'), 'charmap_title' => __('Select custom character'), 'accessibility_help' => __('Accessibility Help'), 'accessibility_usage_title' => __('General Usage') )); $tb->addI18n('paste',array( 'paste_text_desc' => __('Paste as Plain Text'), 'paste_word_desc' => __('Paste from Word'), 'selectall_desc' => __('Select All'), 'plaintext_mode_sticky' => __('Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode.'), 'plaintext_mode' => __('Paste is now in plain text mode. Click again to toggle back to regular paste mode.') )); $tb->addI18n('paste_dlg',array( 'text_title' => __('Use CTRL+V on your keyboard to paste the text into the window.'), 'text_linebreaks' => __('Keep linebreaks'), 'word_title' => __('Use CTRL+V on your keyboard to paste the text into the window.') )); $tb->addI18n('fullscreen',array('desc' => __('Toggle fullscreen mode'))); $tb->addI18n('aria',array('rich_text_area' => __('Rich Text Area'))); $tb->addI18n('dcControls',array( 'inlinecode_desc' => __('Code'), 'quote_desc' => __('Quote'), 'link_desc' => __('Link'), 'media_desc' => __('Add media from media manager'), 'webmedia_desc' => __('Add media from web') )); $res = ''. ''. '\n"; return $res; } public static function jsCandyUpload($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/jquery/jquery.candyUpload.js'). '\n"; } public static function jsToolMan() { return self::jsLoad('js/tool-man/core.js'). self::jsLoad('js/tool-man/events.js'). self::jsLoad('js/tool-man/css.js'). self::jsLoad('js/tool-man/coordinates.js'). self::jsLoad('js/tool-man/drag.js'). self::jsLoad('js/tool-man/dragsort.js'). self::jsLoad('js/dragsort-tablerows.js'); } public static function jsMetaEditor() { return self::jsLoad('js/meta-editor.js'); } public static function jsOEmbed() { return self::jsLoad('js/jquery/jquery.oembed.js'); } } ?>