| 1 | <?php | 
|---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- | 
|---|
| 3 | # | 
|---|
| 4 | # This file is part of Dotclear 2. | 
|---|
| 5 | # | 
|---|
| 6 | # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear | 
|---|
| 7 | # Licensed under the GPL version 2.0 license. | 
|---|
| 8 | # See LICENSE file or | 
|---|
| 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html | 
|---|
| 10 | # | 
|---|
| 11 | # -- END LICENSE BLOCK ----------------------------------------- | 
|---|
| 12 | if (!defined('DC_RC_PATH')) { return; } | 
|---|
| 13 |  | 
|---|
| 14 | define('DC_AUTH_PAGE','auth.php'); | 
|---|
| 15 |  | 
|---|
| 16 | class dcPage | 
|---|
| 17 | { | 
|---|
| 18 |      private static $loaded_js=array(); | 
|---|
| 19 |  | 
|---|
| 20 |      # Auth check | 
|---|
| 21 |      public static function check($permissions) | 
|---|
| 22 |      { | 
|---|
| 23 |           global $core; | 
|---|
| 24 |  | 
|---|
| 25 |           if ($core->blog && $core->auth->check($permissions,$core->blog->id)) | 
|---|
| 26 |           { | 
|---|
| 27 |                return; | 
|---|
| 28 |           } | 
|---|
| 29 |  | 
|---|
| 30 |           if (session_id()) { | 
|---|
| 31 |                $core->session->destroy(); | 
|---|
| 32 |           } | 
|---|
| 33 |           http::redirect(DC_AUTH_PAGE); | 
|---|
| 34 |      } | 
|---|
| 35 |  | 
|---|
| 36 |      # Check super admin | 
|---|
| 37 |      public static function checkSuper() | 
|---|
| 38 |      { | 
|---|
| 39 |           global $core; | 
|---|
| 40 |  | 
|---|
| 41 |           if (!$core->auth->isSuperAdmin()) | 
|---|
| 42 |           { | 
|---|
| 43 |                if (session_id()) { | 
|---|
| 44 |                     $core->session->destroy(); | 
|---|
| 45 |                } | 
|---|
| 46 |                http::redirect(DC_AUTH_PAGE); | 
|---|
| 47 |           } | 
|---|
| 48 |      } | 
|---|
| 49 |  | 
|---|
| 50 |      # Top of admin page | 
|---|
| 51 |      public static function open($title='',$head='',$breadcrumb='') | 
|---|
| 52 |      { | 
|---|
| 53 |           global $core; | 
|---|
| 54 |  | 
|---|
| 55 |           # List of user's blogs | 
|---|
| 56 |           if ($core->auth->getBlogCount() == 1 || $core->auth->getBlogCount() > 20) | 
|---|
| 57 |           { | 
|---|
| 58 |                $blog_box = | 
|---|
| 59 |                '<p>'.__('Blog:').' <strong title="'.html::escapeHTML($core->blog->url).'">'. | 
|---|
| 60 |                html::escapeHTML($core->blog->name).'</strong>'; | 
|---|
| 61 |  | 
|---|
| 62 |                if ($core->auth->getBlogCount() > 20) { | 
|---|
| 63 |                     $blog_box .= ' - <a href="blogs.php">'.__('Change blog').'</a>'; | 
|---|
| 64 |                } | 
|---|
| 65 |                $blog_box .= '</p>'; | 
|---|
| 66 |           } | 
|---|
| 67 |           else | 
|---|
| 68 |           { | 
|---|
| 69 |                $rs_blogs = $core->getBlogs(array('order'=>'LOWER(blog_name)','limit'=>20)); | 
|---|
| 70 |                $blogs = array(); | 
|---|
| 71 |                while ($rs_blogs->fetch()) { | 
|---|
| 72 |                     $blogs[html::escapeHTML($rs_blogs->blog_name.' - '.$rs_blogs->blog_url)] = $rs_blogs->blog_id; | 
|---|
| 73 |                } | 
|---|
| 74 |                $blog_box = | 
|---|
| 75 |                '<p><label for="switchblog" class="classic">'. | 
|---|
| 76 |                __('Blogs:').'</label> '. | 
|---|
| 77 |                $core->formNonce(). | 
|---|
| 78 |                form::combo('switchblog',$blogs,$core->blog->id). | 
|---|
| 79 |                '<input type="submit" value="'.__('ok').'" class="hidden-if-js" /></p>'; | 
|---|
| 80 |           } | 
|---|
| 81 |  | 
|---|
| 82 |           $safe_mode = isset($_SESSION['sess_safe_mode']) && $_SESSION['sess_safe_mode']; | 
|---|
| 83 |  | 
|---|
| 84 |           # Display | 
|---|
| 85 |           header('Content-Type: text/html; charset=UTF-8'); | 
|---|
| 86 |           echo | 
|---|
| 87 |           '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '. | 
|---|
| 88 |           ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n". | 
|---|
| 89 |           '<html xmlns="http://www.w3.org/1999/xhtml" '. | 
|---|
| 90 |           'xml:lang="'.$core->auth->getInfo('user_lang').'" '. | 
|---|
| 91 |           'lang="'.$core->auth->getInfo('user_lang').'">'."\n". | 
|---|
| 92 |           "<head>\n". | 
|---|
| 93 |           '  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'."\n". | 
|---|
| 94 |           '  <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n". | 
|---|
| 95 |           '  <meta name="GOOGLEBOT" content="NOSNIPPET" />'."\n". | 
|---|
| 96 |           '  <meta name="viewport" content="width=device-width, initial-scale=1.0" />'."\n". | 
|---|
| 97 |           '  <title>'.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.'</title>'."\n". | 
|---|
| 98 |  | 
|---|
| 99 |  | 
|---|
| 100 |           self::jsLoadIE7(). | 
|---|
| 101 |           '  <link rel="stylesheet" href="style/default.css" type="text/css" media="screen" />'."\n"; | 
|---|
| 102 |           if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') { | 
|---|
| 103 |                echo | 
|---|
| 104 |                '  <link rel="stylesheet" href="style/default-rtl.css" type="text/css" media="screen" />'."\n"; | 
|---|
| 105 |           } | 
|---|
| 106 |  | 
|---|
| 107 |           $core->auth->user_prefs->addWorkspace('interface'); | 
|---|
| 108 |           $user_ui_hide_std_favicon = $core->auth->user_prefs->interface->hide_std_favicon; | 
|---|
| 109 |           if (!$user_ui_hide_std_favicon) { | 
|---|
| 110 |                echo  | 
|---|
| 111 |                '<link rel="icon" type="image/png" href="images/favicon96-login.png" />'. | 
|---|
| 112 |                '<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />'; | 
|---|
| 113 |           } | 
|---|
| 114 |           echo | 
|---|
| 115 |           self::jsCommon(). | 
|---|
| 116 |           self::jsToggles(). | 
|---|
| 117 |           $head; | 
|---|
| 118 |  | 
|---|
| 119 |           # --BEHAVIOR-- adminPageHTMLHead | 
|---|
| 120 |           $core->callBehavior('adminPageHTMLHead'); | 
|---|
| 121 |  | 
|---|
| 122 |           echo | 
|---|
| 123 |           "</head>\n". | 
|---|
| 124 |           '<body id="dotclear-admin'. | 
|---|
| 125 |           ($safe_mode ? ' safe-mode' : '').'" class="no-js">'."\n". | 
|---|
| 126 |  | 
|---|
| 127 |           '<ul id="prelude">'. | 
|---|
| 128 |           '<li><a href="#content">'.__('Go to the content').'</a></li>'. | 
|---|
| 129 |           '<li><a href="#main-menu">'.__('Go to the menu').'</a></li>'. | 
|---|
| 130 |           '<li><a href="#qx">'.__('Go to search').'</a></li>'. | 
|---|
| 131 |           '</ul>'."\n". | 
|---|
| 132 |           '<div id="header">'. | 
|---|
| 133 |           '<h1><a href="index.php"><span class="hidden">'.DC_VENDOR_NAME.'</span></a></h1>'."\n"; | 
|---|
| 134 |  | 
|---|
| 135 |           echo | 
|---|
| 136 |           '<form action="index.php" method="post" id="top-info-blog">'. | 
|---|
| 137 |           $blog_box. | 
|---|
| 138 |           '<p><a href="'.$core->blog->url.'" onclick="window.open(this.href);return false;" title="'.__('Go to site'). | 
|---|
| 139 |           ' ('.__('new window').')'.'">'.__('Go to site').'<img src="images/outgoing.png" alt="" /></a>'. | 
|---|
| 140 |           '</p></form>'. | 
|---|
| 141 |           '<ul id="top-info-user">'. | 
|---|
| 142 |           '<li><a class="'.(preg_match('/index.php$/',$_SERVER['REQUEST_URI']) ? ' active' : '').'" href="index.php">'.__('My dashboard').'</a></li>'. | 
|---|
| 143 |           '<li><a class="smallscreen'.(preg_match('/preferences.php(\?.*)?$/',$_SERVER['REQUEST_URI']) ? ' active' : ''). | 
|---|
| 144 |           '" href="preferences.php">'.__('My preferences').'</a></li>'. | 
|---|
| 145 |           '<li><a href="index.php?logout=1" class="logout"><span class="nomobile">'.sprintf(__('Logout %s'),$core->auth->userID()). | 
|---|
| 146 |           '</span><img src="images/logout.png" alt="" /></a></li>'. | 
|---|
| 147 |           '</ul>'. | 
|---|
| 148 |           '</div>'; // end header | 
|---|
| 149 |  | 
|---|
| 150 |           echo | 
|---|
| 151 |           '<div id="wrapper" class="clearfix">'."\n". | 
|---|
| 152 |           '<div class="hidden-if-no-js collapser-box"><a href="#" id="collapser">'. | 
|---|
| 153 |           '<img class="collapse-mm" src="images/collapser-hide.png" alt="'.__('Hide main menu').'" />'. | 
|---|
| 154 |           '<img class="expand-mm" src="images/collapser-show.png" alt="'.__('Show main menu').'" />'. | 
|---|
| 155 |           '</a></div>'. | 
|---|
| 156 |           '<div id="main">'."\n". | 
|---|
| 157 |           '<div id="content" class="clearfix">'."\n"; | 
|---|
| 158 |  | 
|---|
| 159 |           # Safe mode | 
|---|
| 160 |           if ($safe_mode) | 
|---|
| 161 |           { | 
|---|
| 162 |                echo | 
|---|
| 163 |                '<div class="warning"><h3>'.__('Safe mode').'</h3>'. | 
|---|
| 164 |                '<p>'.__('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').'</p>'. | 
|---|
| 165 |                '</div>'; | 
|---|
| 166 |           } | 
|---|
| 167 |  | 
|---|
| 168 |           // Display breadcrumb (if given) before any error message | 
|---|
| 169 |           echo $breadcrumb; | 
|---|
| 170 |  | 
|---|
| 171 |           if ($core->error->flag()) { | 
|---|
| 172 |                echo | 
|---|
| 173 |                '<div class="error"><p><strong>'.(count($core->error->getErrors()) > 1 ? __('Errors:') : __('Error:')).'</strong></p>'. | 
|---|
| 174 |                $core->error->toHTML(). | 
|---|
| 175 |                '</div>'; | 
|---|
| 176 |           } | 
|---|
| 177 |      } | 
|---|
| 178 |  | 
|---|
| 179 |      public static function close() | 
|---|
| 180 |      { | 
|---|
| 181 |           global $core; | 
|---|
| 182 |  | 
|---|
| 183 |           if (!$GLOBALS['__resources']['ctxhelp']) { | 
|---|
| 184 |                echo | 
|---|
| 185 |                '<p id="help-button"><a href="help.php" onclick="window.open(this.href);return false;" title="'. | 
|---|
| 186 |                __('Global help').' ('.__('new window').')">'.__('Global help').'</a></p>'; | 
|---|
| 187 |           } | 
|---|
| 188 |  | 
|---|
| 189 |           $menu =& $GLOBALS['_menu']; | 
|---|
| 190 |  | 
|---|
| 191 |           echo | 
|---|
| 192 |           "</div>\n".         // End of #content | 
|---|
| 193 |           "</div>\n".         // End of #main | 
|---|
| 194 |  | 
|---|
| 195 |           '<div id="main-menu">'."\n". | 
|---|
| 196 |  | 
|---|
| 197 |           '<form id="search-menu" action="search.php" method="get">'. | 
|---|
| 198 |           '<p><label for="qx" class="hidden">'.__('Search:').' </label>'.form::field('qx',30,255,''). | 
|---|
| 199 |           '<input type="submit" value="'.__('OK').'" /></p>'. | 
|---|
| 200 |           '</form>'; | 
|---|
| 201 |  | 
|---|
| 202 |           foreach ($menu as $k => $v) { | 
|---|
| 203 |                echo $menu[$k]->draw(); | 
|---|
| 204 |           } | 
|---|
| 205 |  | 
|---|
| 206 |           $text = sprintf(__('Thank you for using %s.'),'Dotclear '.DC_VERSION); | 
|---|
| 207 |  | 
|---|
| 208 |           # --BEHAVIOR-- adminPageFooter | 
|---|
| 209 |           $textAlt = $core->callBehavior('adminPageFooter',$core,$text); | 
|---|
| 210 |           if ($textAlt != '') { | 
|---|
| 211 |                $text = $textAlt; | 
|---|
| 212 |           } | 
|---|
| 213 |           $text = html::escapeHTML($text); | 
|---|
| 214 |  | 
|---|
| 215 |           echo | 
|---|
| 216 |           '</div>'."\n".      // End of #main-menu | 
|---|
| 217 |           "</div>\n";         // End of #wrapper | 
|---|
| 218 |  | 
|---|
| 219 |           echo | 
|---|
| 220 |           '<div id="footer">'. | 
|---|
| 221 |           '<a href="http://dotclear.org/" title="'.$text.'"><img src="style/dc_logos/w-dotclear90.png" alt="'.$text.'" /></a></div>'."\n". | 
|---|
| 222 |           '<!-- '."\n". | 
|---|
| 223 | '                  .'."\n". | 
|---|
| 224 | '               ,;:\'`\'::'."\n". | 
|---|
| 225 | '            __||'."\n". | 
|---|
| 226 | '      _____/LLLL\_'."\n". | 
|---|
| 227 | '      \__________"|'."\n". | 
|---|
| 228 | '    ~^~^~^~^~^~^~^~^~^~'."\n". | 
|---|
| 229 | ' -->'."\n"; | 
|---|
| 230 |  | 
|---|
| 231 |           if (defined('DC_DEV') && DC_DEV === true) { | 
|---|
| 232 |                echo self::debugInfo(); | 
|---|
| 233 |           } | 
|---|
| 234 |  | 
|---|
| 235 |           echo | 
|---|
| 236 |           '</body></html>'; | 
|---|
| 237 |      } | 
|---|
| 238 |  | 
|---|
| 239 |      public static function openPopup($title='',$head='',$breadcrumb='') | 
|---|
| 240 |      { | 
|---|
| 241 |           global $core; | 
|---|
| 242 |  | 
|---|
| 243 |           # Display | 
|---|
| 244 |           header('Content-Type: text/html; charset=UTF-8'); | 
|---|
| 245 |           echo | 
|---|
| 246 |           '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '. | 
|---|
| 247 |           ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n". | 
|---|
| 248 |           '<html xmlns="http://www.w3.org/1999/xhtml" '. | 
|---|
| 249 |           'xml:lang="'.$core->auth->getInfo('user_lang').'" '. | 
|---|
| 250 |           'lang="'.$core->auth->getInfo('user_lang').'">'."\n". | 
|---|
| 251 |           '<meta name="viewport" content="width=device-width, initial-scale=1.0" />'."\n". | 
|---|
| 252 |           "<head>\n". | 
|---|
| 253 |           '  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'."\n". | 
|---|
| 254 |           '  <title>'.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.'</title>'."\n". | 
|---|
| 255 |  | 
|---|
| 256 |           '  <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n". | 
|---|
| 257 |           '  <meta name="GOOGLEBOT" content="NOSNIPPET" />'."\n". | 
|---|
| 258 |  | 
|---|
| 259 |           self::jsLoadIE7(). | 
|---|
| 260 |           '    <link rel="stylesheet" href="style/default.css" type="text/css" media="screen" />'."\n"; | 
|---|
| 261 |           if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') { | 
|---|
| 262 |                echo | 
|---|
| 263 |                '    <link rel="stylesheet" href="style/default-rtl.css" type="text/css" media="screen" />'."\n"; | 
|---|
| 264 |           } | 
|---|
| 265 |  | 
|---|
| 266 |           echo | 
|---|
| 267 |           self::jsCommon(). | 
|---|
| 268 |           self::jsToggles(). | 
|---|
| 269 |           $head; | 
|---|
| 270 |  | 
|---|
| 271 |           # --BEHAVIOR-- adminPageHTMLHead | 
|---|
| 272 |           $core->callBehavior('adminPageHTMLHead'); | 
|---|
| 273 |  | 
|---|
| 274 |           echo | 
|---|
| 275 |           "</head>\n". | 
|---|
| 276 |           '<body id="dotclear-admin" class="popup">'."\n". | 
|---|
| 277 |  | 
|---|
| 278 |           '<h1>'.DC_VENDOR_NAME.'</h1>'."\n"; | 
|---|
| 279 |  | 
|---|
| 280 |           echo | 
|---|
| 281 |           '<div id="wrapper">'."\n". | 
|---|
| 282 |           '<div id="main">'."\n". | 
|---|
| 283 |           '<div id="content">'."\n"; | 
|---|
| 284 |  | 
|---|
| 285 |           // display breadcrumb if given | 
|---|
| 286 |           echo $breadcrumb; | 
|---|
| 287 |  | 
|---|
| 288 |           if ($core->error->flag()) { | 
|---|
| 289 |                echo | 
|---|
| 290 |                '<div class="error"><strong>'.__('Errors:').'</strong>'. | 
|---|
| 291 |                $core->error->toHTML(). | 
|---|
| 292 |                '</div>'; | 
|---|
| 293 |           } | 
|---|
| 294 |      } | 
|---|
| 295 |  | 
|---|
| 296 |      public static function closePopup() | 
|---|
| 297 |      { | 
|---|
| 298 |           echo | 
|---|
| 299 |           "</div>\n".         // End of #content | 
|---|
| 300 |           "</div>\n".         // End of #main | 
|---|
| 301 |           "</div>\n".         // End of #wrapper | 
|---|
| 302 |           '<div id="footer"><p> </p></div>'."\n". | 
|---|
| 303 |           '</body></html>'; | 
|---|
| 304 |      } | 
|---|
| 305 |  | 
|---|
| 306 |      public static function breadcrumb($elements=null,$with_home_link=true,$echo=false) | 
|---|
| 307 |      { | 
|---|
| 308 |           // First item of array elements should be blog's name, System or Plugins | 
|---|
| 309 |           $res = '<h2>'.($with_home_link ? | 
|---|
| 310 |                '<a class="go_home" href="index.php"><img src="style/dashboard.png" alt="'.__('Go to dashboard').'" /></a>' : | 
|---|
| 311 |                '<img src="style/dashboard-alt.png" alt="" />'); | 
|---|
| 312 |           $index = 0; | 
|---|
| 313 |           foreach ($elements as $element => $url) { | 
|---|
| 314 |                $res .= ($with_home_link ? ($index == 1 ? ' : ' : ' › ') : ($index == 0 ? ' ' : ' › ')). | 
|---|
| 315 |                     ($url ? '<a href="'.$url.'">' : '').$element.($url ? '</a>' : ''); | 
|---|
| 316 |                $index++; | 
|---|
| 317 |           } | 
|---|
| 318 |           $res .= '</h2>'; | 
|---|
| 319 |           if ($echo) { | 
|---|
| 320 |                echo $res; | 
|---|
| 321 |           } | 
|---|
| 322 |           return $res; | 
|---|
| 323 |      } | 
|---|
| 324 |  | 
|---|
| 325 |      public static function message($msg,$timestamp=true,$div=false,$echo=true,$class='message') | 
|---|
| 326 |      { | 
|---|
| 327 |           global $core; | 
|---|
| 328 |  | 
|---|
| 329 |           $res = ''; | 
|---|
| 330 |           if ($msg != '') { | 
|---|
| 331 |                $res = ($div ? '<div class="'.$class.'">' : '').'<p'.($div ? '' : ' class="'.$class.'"').'>'. | 
|---|
| 332 |                ($timestamp ? dt::str(__('%H:%M:%S:'),null,$core->auth->getInfo('user_tz')).' ' : '').$msg. | 
|---|
| 333 |                '</p>'.($div ? '</div>' : ''); | 
|---|
| 334 |                if ($echo) { | 
|---|
| 335 |                     echo $res; | 
|---|
| 336 |                } | 
|---|
| 337 |           } | 
|---|
| 338 |           return $res; | 
|---|
| 339 |      } | 
|---|
| 340 |  | 
|---|
| 341 |      public static function success($msg,$timestamp=true,$div=false,$echo=true) | 
|---|
| 342 |      { | 
|---|
| 343 |           return self::message($msg,$timestamp,$div,$echo,"success"); | 
|---|
| 344 |      } | 
|---|
| 345 |  | 
|---|
| 346 |      public static function warning($msg,$timestamp=true,$div=false,$echo=true) | 
|---|
| 347 |      { | 
|---|
| 348 |           return self::message($msg,$timestamp,$div,$echo,"warning-msg"); | 
|---|
| 349 |      } | 
|---|
| 350 |  | 
|---|
| 351 |      private static function debugInfo() | 
|---|
| 352 |      { | 
|---|
| 353 |           $global_vars = implode(', ',array_keys($GLOBALS)); | 
|---|
| 354 |  | 
|---|
| 355 |           $res = | 
|---|
| 356 |           '<div id="debug"><div>'. | 
|---|
| 357 |           '<p>memory usage: '.memory_get_usage().' ('.files::size(memory_get_usage()).')</p>'; | 
|---|
| 358 |  | 
|---|
| 359 |           if (function_exists('xdebug_get_profiler_filename')) | 
|---|
| 360 |           { | 
|---|
| 361 |                $res .= '<p>Elapsed time: '.xdebug_time_index().' seconds</p>'; | 
|---|
| 362 |  | 
|---|
| 363 |                $prof_file = xdebug_get_profiler_filename(); | 
|---|
| 364 |                if ($prof_file) { | 
|---|
| 365 |                     $res .= '<p>Profiler file : '.xdebug_get_profiler_filename().'</p>'; | 
|---|
| 366 |                } else { | 
|---|
| 367 |                     $prof_url = http::getSelfURI(); | 
|---|
| 368 |                     $prof_url .= (strpos($prof_url,'?') === false) ? '?' : '&'; | 
|---|
| 369 |                     $prof_url .= 'XDEBUG_PROFILE'; | 
|---|
| 370 |                     $res .= '<p><a href="'.html::escapeURL($prof_url).'">Trigger profiler</a></p>'; | 
|---|
| 371 |                } | 
|---|
| 372 |  | 
|---|
| 373 |                /* xdebug configuration: | 
|---|
| 374 |                zend_extension = /.../xdebug.so | 
|---|
| 375 |                xdebug.auto_trace = On | 
|---|
| 376 |                xdebug.trace_format = 0 | 
|---|
| 377 |                xdebug.trace_options = 1 | 
|---|
| 378 |                xdebug.show_mem_delta = On | 
|---|
| 379 |                xdebug.profiler_enable = 0 | 
|---|
| 380 |                xdebug.profiler_enable_trigger = 1 | 
|---|
| 381 |                xdebug.profiler_output_dir = /tmp | 
|---|
| 382 |                xdebug.profiler_append = 0 | 
|---|
| 383 |                xdebug.profiler_output_name = timestamp | 
|---|
| 384 |                */ | 
|---|
| 385 |           } | 
|---|
| 386 |  | 
|---|
| 387 |           $res .= | 
|---|
| 388 |           '<p>Global vars: '.$global_vars.'</p>'. | 
|---|
| 389 |           '</div></div>'; | 
|---|
| 390 |  | 
|---|
| 391 |           return $res; | 
|---|
| 392 |      } | 
|---|
| 393 |  | 
|---|
| 394 |      public static function help($page,$index='') | 
|---|
| 395 |      { | 
|---|
| 396 |           # Deprecated but we keep this for plugins. | 
|---|
| 397 |      } | 
|---|
| 398 |  | 
|---|
| 399 |      public static function helpBlock() | 
|---|
| 400 |      { | 
|---|
| 401 |           $args = func_get_args(); | 
|---|
| 402 |  | 
|---|
| 403 |           $args = new ArrayObject($args); | 
|---|
| 404 |  | 
|---|
| 405 |           # --BEHAVIOR-- adminPageHelpBlock | 
|---|
| 406 |           $GLOBALS['core']->callBehavior('adminPageHelpBlock',$args); | 
|---|
| 407 |  | 
|---|
| 408 |           if (empty($args)) { | 
|---|
| 409 |                return; | 
|---|
| 410 |           }; | 
|---|
| 411 |  | 
|---|
| 412 |           global $__resources; | 
|---|
| 413 |           if (empty($__resources['help'])) { | 
|---|
| 414 |                return; | 
|---|
| 415 |           } | 
|---|
| 416 |  | 
|---|
| 417 |           $content = ''; | 
|---|
| 418 |           foreach ($args as $v) | 
|---|
| 419 |           { | 
|---|
| 420 |                if (is_object($v) && isset($v->content)) { | 
|---|
| 421 |                     $content .= $v->content; | 
|---|
| 422 |                     continue; | 
|---|
| 423 |                } | 
|---|
| 424 |  | 
|---|
| 425 |                if (!isset($__resources['help'][$v])) { | 
|---|
| 426 |                     continue; | 
|---|
| 427 |                } | 
|---|
| 428 |                $f = $__resources['help'][$v]; | 
|---|
| 429 |                if (!file_exists($f) || !is_readable($f)) { | 
|---|
| 430 |                     continue; | 
|---|
| 431 |                } | 
|---|
| 432 |  | 
|---|
| 433 |                $fc = file_get_contents($f); | 
|---|
| 434 |                if (preg_match('|<body[^>]*?>(.*?)</body>|ms',$fc,$matches)) { | 
|---|
| 435 |                     $content .= $matches[1]; | 
|---|
| 436 |                } else { | 
|---|
| 437 |                     $content .= $fc; | 
|---|
| 438 |                } | 
|---|
| 439 |           } | 
|---|
| 440 |  | 
|---|
| 441 |           if (trim($content) == '') { | 
|---|
| 442 |                return; | 
|---|
| 443 |           } | 
|---|
| 444 |  | 
|---|
| 445 |           // Set contextual help global flag | 
|---|
| 446 |           $GLOBALS['__resources']['ctxhelp'] = true; | 
|---|
| 447 |  | 
|---|
| 448 |           echo | 
|---|
| 449 |           '<div id="help"><hr /><div class="help-content clear"><h3>'.__('Help about this page').'</h3>'. | 
|---|
| 450 |           $content. | 
|---|
| 451 |           '</div>'. | 
|---|
| 452 |           '<div id="helplink"><hr />'. | 
|---|
| 453 |           '<p>'. | 
|---|
| 454 |           sprintf(__('See also %s'),sprintf('<a href="help.php">%s</a>',__('the global help'))). | 
|---|
| 455 |           '.</p>'. | 
|---|
| 456 |           '</div></div>'; | 
|---|
| 457 |      } | 
|---|
| 458 |  | 
|---|
| 459 |      public static function jsLoad($src) | 
|---|
| 460 |      { | 
|---|
| 461 |           $escaped_src = html::escapeHTML($src); | 
|---|
| 462 |           if (!isset(self::$loaded_js[$escaped_src])) { | 
|---|
| 463 |                self::$loaded_js[$escaped_src]=true; | 
|---|
| 464 |                return '<script type="text/javascript" src="'.$escaped_src.'"></script>'."\n"; | 
|---|
| 465 |           } | 
|---|
| 466 |      } | 
|---|
| 467 |  | 
|---|
| 468 |      public static function jsVar($n,$v) | 
|---|
| 469 |      { | 
|---|
| 470 |           return $n." = '".html::escapeJS($v)."';\n"; | 
|---|
| 471 |      } | 
|---|
| 472 |  | 
|---|
| 473 |      public static function jsToggles() | 
|---|
| 474 |      { | 
|---|
| 475 |           if($GLOBALS['core']->auth->user_prefs->toggles) { | 
|---|
| 476 |                $unfolded_sections = explode(',',$GLOBALS['core']->auth->user_prefs->toggles->unfolded_sections); | 
|---|
| 477 |                foreach ($unfolded_sections as $k=>&$v) { | 
|---|
| 478 |                     if ($v == '') { | 
|---|
| 479 |                          unset($unfolded_sections[$k]); | 
|---|
| 480 |                     } else { | 
|---|
| 481 |                          $v = "'".html::escapeJS($v)."':true"; | 
|---|
| 482 |                     } | 
|---|
| 483 |                } | 
|---|
| 484 |           } else { | 
|---|
| 485 |                $unfolded_sections=array(); | 
|---|
| 486 |           } | 
|---|
| 487 |           return '<script type="text/javascript">'."\n". | 
|---|
| 488 |                          "//<![CDATA[\n". | 
|---|
| 489 |                          'dotclear.unfolded_sections = {'.join(",",$unfolded_sections)."};\n". | 
|---|
| 490 |                          "\n//]]>\n". | 
|---|
| 491 |                     "</script>\n"; | 
|---|
| 492 |      } | 
|---|
| 493 |       | 
|---|
| 494 |      public static function jsCommon() | 
|---|
| 495 |      { | 
|---|
| 496 |           $mute_or_no = ''; | 
|---|
| 497 |           if (empty($GLOBALS['core']->blog) || $GLOBALS['core']->blog->settings->system->jquery_migrate_mute) { | 
|---|
| 498 |                $mute_or_no .= | 
|---|
| 499 |                     '<script type="text/javascript">'."\n". | 
|---|
| 500 |                     "//<![CDATA[\n". | 
|---|
| 501 |                     'jQuery.migrateMute = true;'. | 
|---|
| 502 |                     "\n//]]>\n". | 
|---|
| 503 |                     "</script>\n"; | 
|---|
| 504 |           } | 
|---|
| 505 |  | 
|---|
| 506 |           return | 
|---|
| 507 |           self::jsLoad('js/jquery/jquery.js'). | 
|---|
| 508 |           $mute_or_no. | 
|---|
| 509 |           self::jsLoad('js/jquery/jquery-migrate-1.2.1.js'). | 
|---|
| 510 |           self::jsLoad('js/jquery/jquery.biscuit.js'). | 
|---|
| 511 |           self::jsLoad('js/jquery/jquery.bgFade.js'). | 
|---|
| 512 |           self::jsLoad('js/common.js'). | 
|---|
| 513 |           self::jsLoad('js/prelude.js'). | 
|---|
| 514 |  | 
|---|
| 515 |           '<script type="text/javascript">'."\n". | 
|---|
| 516 |           "//<![CDATA[\n". | 
|---|
| 517 |           self::jsVar('dotclear.nonce',$GLOBALS['core']->getNonce()). | 
|---|
| 518 |           self::jsVar('dotclear.img_plus_src','images/expand.png'). | 
|---|
| 519 |           self::jsVar('dotclear.img_plus_alt',__('uncover')). | 
|---|
| 520 |           self::jsVar('dotclear.img_minus_src','images/hide.png'). | 
|---|
| 521 |           self::jsVar('dotclear.img_minus_alt',__('hide')). | 
|---|
| 522 |           self::jsVar('dotclear.img_menu_on','images/menu_on.png'). | 
|---|
| 523 |           self::jsVar('dotclear.img_menu_off','images/menu_off.png'). | 
|---|
| 524 |  | 
|---|
| 525 |           self::jsVar('dotclear.msg.help', | 
|---|
| 526 |                __('Need help?')). | 
|---|
| 527 |           self::jsVar('dotclear.msg.help_hide', | 
|---|
| 528 |                __('Hide')). | 
|---|
| 529 |           self::jsVar('dotclear.msg.to_select', | 
|---|
| 530 |                __('Select:')). | 
|---|
| 531 |           self::jsVar('dotclear.msg.no_selection', | 
|---|
| 532 |                __('no selection')). | 
|---|
| 533 |           self::jsVar('dotclear.msg.select_all', | 
|---|
| 534 |                __('select all')). | 
|---|
| 535 |           self::jsVar('dotclear.msg.invert_sel', | 
|---|
| 536 |                __('Invert selection')). | 
|---|
| 537 |           self::jsVar('dotclear.msg.website', | 
|---|
| 538 |                __('Web site:')). | 
|---|
| 539 |           self::jsVar('dotclear.msg.email', | 
|---|
| 540 |                __('Email:')). | 
|---|
| 541 |           self::jsVar('dotclear.msg.ip_address', | 
|---|
| 542 |                __('IP address:')). | 
|---|
| 543 |           self::jsVar('dotclear.msg.error', | 
|---|
| 544 |                __('Error:')). | 
|---|
| 545 |           self::jsVar('dotclear.msg.entry_created', | 
|---|
| 546 |                __('Entry has been successfully created.')). | 
|---|
| 547 |           self::jsVar('dotclear.msg.edit_entry', | 
|---|
| 548 |                __('Edit entry')). | 
|---|
| 549 |           self::jsVar('dotclear.msg.view_entry', | 
|---|
| 550 |                __('view entry')). | 
|---|
| 551 |           self::jsVar('dotclear.msg.confirm_delete_posts', | 
|---|
| 552 |                __("Are you sure you want to delete selected entries (%s)?")). | 
|---|
| 553 |           self::jsVar('dotclear.msg.confirm_delete_categories', | 
|---|
| 554 |                __("Are you sure you want to delete selected categories (%s)?")). | 
|---|
| 555 |           self::jsVar('dotclear.msg.confirm_delete_post', | 
|---|
| 556 |                __("Are you sure you want to delete this entry?")). | 
|---|
| 557 |           self::jsVar('dotclear.msg.click_to_unlock', | 
|---|
| 558 |                __("Click here to unlock the field")). | 
|---|
| 559 |           self::jsVar('dotclear.msg.confirm_spam_delete', | 
|---|
| 560 |                __('Are you sure you want to delete all spams?')). | 
|---|
| 561 |           self::jsVar('dotclear.msg.confirm_delete_comments', | 
|---|
| 562 |                __('Are you sure you want to delete selected comments (%s)?')). | 
|---|
| 563 |           self::jsVar('dotclear.msg.confirm_delete_comment', | 
|---|
| 564 |                __('Are you sure you want to delete this comment?')). | 
|---|
| 565 |           self::jsVar('dotclear.msg.cannot_delete_users', | 
|---|
| 566 |                __('Users with posts cannot be deleted.')). | 
|---|
| 567 |           self::jsVar('dotclear.msg.confirm_delete_user', | 
|---|
| 568 |                __('Are you sure you want to delete selected users (%s)?')). | 
|---|
| 569 |           self::jsVar('dotclear.msg.confirm_delete_category', | 
|---|
| 570 |                __('Are you sure you want to delete category "%s"?')). | 
|---|
| 571 |           self::jsVar('dotclear.msg.confirm_reorder_categories', | 
|---|
| 572 |                __('Are you sure you want to reorder all categories?')). | 
|---|
| 573 |           self::jsVar('dotclear.msg.confirm_delete_media', | 
|---|
| 574 |                __('Are you sure you want to remove media "%s"?')). | 
|---|
| 575 |           self::jsVar('dotclear.msg.confirm_extract_current', | 
|---|
| 576 |                __('Are you sure you want to extract archive in current directory?')). | 
|---|
| 577 |           self::jsVar('dotclear.msg.confirm_remove_attachment', | 
|---|
| 578 |                __('Are you sure you want to remove attachment "%s"?')). | 
|---|
| 579 |           self::jsVar('dotclear.msg.confirm_delete_lang', | 
|---|
| 580 |                __('Are you sure you want to delete "%s" language?')). | 
|---|
| 581 |           self::jsVar('dotclear.msg.confirm_delete_plugin', | 
|---|
| 582 |                __('Are you sure you want to delete "%s" plugin?')). | 
|---|
| 583 |           self::jsVar('dotclear.msg.use_this_theme', | 
|---|
| 584 |                __('Use this theme')). | 
|---|
| 585 |           self::jsVar('dotclear.msg.remove_this_theme', | 
|---|
| 586 |                __('Remove this theme')). | 
|---|
| 587 |           self::jsVar('dotclear.msg.confirm_delete_theme', | 
|---|
| 588 |                __('Are you sure you want to delete "%s" theme?')). | 
|---|
| 589 |           self::jsVar('dotclear.msg.confirm_delete_backup', | 
|---|
| 590 |                __('Are you sure you want to delete this backup?')). | 
|---|
| 591 |           self::jsVar('dotclear.msg.zip_file_content', | 
|---|
| 592 |                __('Zip file content')). | 
|---|
| 593 |           self::jsVar('dotclear.msg.xhtml_validator', | 
|---|
| 594 |                __('XHTML markup validator')). | 
|---|
| 595 |           self::jsVar('dotclear.msg.xhtml_valid', | 
|---|
| 596 |                __('XHTML content is valid.')). | 
|---|
| 597 |           self::jsVar('dotclear.msg.xhtml_not_valid', | 
|---|
| 598 |                __('There are XHTML markup errors.')). | 
|---|
| 599 |           self::jsVar('dotclear.msg.warning_validate_no_save_content', | 
|---|
| 600 |                __('Attention: an audit of a content not yet registered.')). | 
|---|
| 601 |           self::jsVar('dotclear.msg.confirm_change_post_format', | 
|---|
| 602 |                __('You have unsaved changes. Switch post format will loose these changes. Proceed anyway?')). | 
|---|
| 603 |           self::jsVar('dotclear.msg.confirm_change_post_format_noconvert', | 
|---|
| 604 |                __("Warning: post format change will not convert existing content. You will need to apply new format by yourself. Proceed anyway?")). | 
|---|
| 605 |           self::jsVar('dotclear.msg.load_enhanced_uploader', | 
|---|
| 606 |                __('Loading enhanced uploader, please wait.')). | 
|---|
| 607 |  | 
|---|
| 608 |           self::jsVar('dotclear.msg.module_author', | 
|---|
| 609 |                __('Author:')). | 
|---|
| 610 |           self::jsVar('dotclear.msg.module_details', | 
|---|
| 611 |                __('Details')). | 
|---|
| 612 |           self::jsVar('dotclear.msg.module_support', | 
|---|
| 613 |                __('Support')). | 
|---|
| 614 |           self::jsVar('dotclear.msg.module_help', | 
|---|
| 615 |                __('Help:')). | 
|---|
| 616 |           self::jsVar('dotclear.msg.module_section', | 
|---|
| 617 |                __('Section:')). | 
|---|
| 618 |           self::jsVar('dotclear.msg.module_tags', | 
|---|
| 619 |                __('Tags:')). | 
|---|
| 620 |                "\n//]]>\n". | 
|---|
| 621 |           "</script>\n"; | 
|---|
| 622 |      } | 
|---|
| 623 |  | 
|---|
| 624 |      public static function jsLoadIE7() | 
|---|
| 625 |      { | 
|---|
| 626 |           return | 
|---|
| 627 |           '<!--[if lt IE 9]>'."\n". | 
|---|
| 628 |           self::jsLoad('js/ie7/IE9.js'). | 
|---|
| 629 |           '<link rel="stylesheet" type="text/css" href="style/iesucks.css" />'."\n". | 
|---|
| 630 |           '<![endif]-->'."\n"; | 
|---|
| 631 |      } | 
|---|
| 632 |  | 
|---|
| 633 |      public static function jsConfirmClose() | 
|---|
| 634 |      { | 
|---|
| 635 |           $args = func_get_args(); | 
|---|
| 636 |           if (count($args) > 0) { | 
|---|
| 637 |                foreach ($args as $k => $v) { | 
|---|
| 638 |                     $args[$k] = "'".html::escapeJS($v)."'"; | 
|---|
| 639 |                } | 
|---|
| 640 |                $args = implode(',',$args); | 
|---|
| 641 |           } else { | 
|---|
| 642 |                $args = ''; | 
|---|
| 643 |           } | 
|---|
| 644 |  | 
|---|
| 645 |           return | 
|---|
| 646 |           self::jsLoad('js/confirm-close.js'). | 
|---|
| 647 |           '<script type="text/javascript">'."\n". | 
|---|
| 648 |           "//<![CDATA[\n". | 
|---|
| 649 |           "confirmClosePage = new confirmClose(".$args."); ". | 
|---|
| 650 |           "confirmClose.prototype.prompt = '".html::escapeJS(__('You have unsaved changes.'))."'; ". | 
|---|
| 651 |           "\n//]]>\n". | 
|---|
| 652 |           "</script>\n"; | 
|---|
| 653 |      } | 
|---|
| 654 |  | 
|---|
| 655 |      public static function jsPageTabs($default=null) | 
|---|
| 656 |      { | 
|---|
| 657 |           if ($default) { | 
|---|
| 658 |                $default = "'".html::escapeJS($default)."'"; | 
|---|
| 659 |           } | 
|---|
| 660 |            | 
|---|
| 661 |           return | 
|---|
| 662 |           self::jsLoad('js/jquery/jquery.pageTabs.js'). | 
|---|
| 663 |           '<script type="text/javascript">'."\n". | 
|---|
| 664 |           "//<![CDATA[\n". | 
|---|
| 665 |           '$(function() {'."\n". | 
|---|
| 666 |           '$.pageTabs('.$default.');'."\n". | 
|---|
| 667 |           '});'. | 
|---|
| 668 |           "\n//]]>\n". | 
|---|
| 669 |           "</script>\n". | 
|---|
| 670 |           '<!--[if lt IE 8]>'."\n". | 
|---|
| 671 |           self::jsLoad('js/ie7/ie7-hashchange.js'). | 
|---|
| 672 |           '<script type="text/javascript">'."\n". | 
|---|
| 673 |           "//<![CDATA[\n". | 
|---|
| 674 |           '$(window).hashchange();'. | 
|---|
| 675 |           "\n//]]>\n". | 
|---|
| 676 |           "</script>\n". | 
|---|
| 677 |           '<![endif]-->'."\n"; | 
|---|
| 678 |      } | 
|---|
| 679 |  | 
|---|
| 680 | public static function jsModal() | 
|---|
| 681 | { | 
|---|
| 682 |      return | 
|---|
| 683 |      '<link rel="stylesheet" type="text/css" href="style/modal/modal.css" />'."\n". | 
|---|
| 684 |      self::jsLoad('js/jquery/jquery.modal.js'). | 
|---|
| 685 |      '<script type="text/javascript">'."\n". | 
|---|
| 686 |      "//<![CDATA[\n". | 
|---|
| 687 |      self::jsVar('$.modal.prototype.params.loader_img','style/modal/loader.gif'). | 
|---|
| 688 |      self::jsVar('$.modal.prototype.params.close_img','style/modal/close.png'). | 
|---|
| 689 |      "\n//]]>\n". | 
|---|
| 690 |      "</script>\n"; | 
|---|
| 691 | } | 
|---|
| 692 |  | 
|---|
| 693 | public static function jsColorPicker() | 
|---|
| 694 | { | 
|---|
| 695 |      return | 
|---|
| 696 |      '<link rel="stylesheet" type="text/css" href="style/farbtastic/farbtastic.css" />'."\n". | 
|---|
| 697 |      self::jsLoad('js/jquery/jquery.farbtastic.js'). | 
|---|
| 698 |      self::jsLoad('js/color-picker.js'); | 
|---|
| 699 | } | 
|---|
| 700 |  | 
|---|
| 701 | public static function jsDatePicker() | 
|---|
| 702 | { | 
|---|
| 703 |      return | 
|---|
| 704 |      '<link rel="stylesheet" type="text/css" href="style/date-picker.css" />'."\n". | 
|---|
| 705 |      self::jsLoad('js/date-picker.js'). | 
|---|
| 706 |      '<script type="text/javascript">'."\n". | 
|---|
| 707 |      "//<![CDATA[\n". | 
|---|
| 708 |  | 
|---|
| 709 |      "datePicker.prototype.months[0] = '".html::escapeJS(__('January'))."'; ". | 
|---|
| 710 |      "datePicker.prototype.months[1] = '".html::escapeJS(__('February'))."'; ". | 
|---|
| 711 |      "datePicker.prototype.months[2] = '".html::escapeJS(__('March'))."'; ". | 
|---|
| 712 |      "datePicker.prototype.months[3] = '".html::escapeJS(__('April'))."'; ". | 
|---|
| 713 |      "datePicker.prototype.months[4] = '".html::escapeJS(__('May'))."'; ". | 
|---|
| 714 |      "datePicker.prototype.months[5] = '".html::escapeJS(__('June'))."'; ". | 
|---|
| 715 |      "datePicker.prototype.months[6] = '".html::escapeJS(__('July'))."'; ". | 
|---|
| 716 |      "datePicker.prototype.months[7] = '".html::escapeJS(__('August'))."'; ". | 
|---|
| 717 |      "datePicker.prototype.months[8] = '".html::escapeJS(__('September'))."'; ". | 
|---|
| 718 |      "datePicker.prototype.months[9] = '".html::escapeJS(__('October'))."'; ". | 
|---|
| 719 |      "datePicker.prototype.months[10] = '".html::escapeJS(__('November'))."'; ". | 
|---|
| 720 |      "datePicker.prototype.months[11] = '".html::escapeJS(__('December'))."'; ". | 
|---|
| 721 |  | 
|---|
| 722 |      "datePicker.prototype.days[0] = '".html::escapeJS(__('Monday'))."'; ". | 
|---|
| 723 |      "datePicker.prototype.days[1] = '".html::escapeJS(__('Tuesday'))."'; ". | 
|---|
| 724 |      "datePicker.prototype.days[2] = '".html::escapeJS(__('Wednesday'))."'; ". | 
|---|
| 725 |      "datePicker.prototype.days[3] = '".html::escapeJS(__('Thursday'))."'; ". | 
|---|
| 726 |      "datePicker.prototype.days[4] = '".html::escapeJS(__('Friday'))."'; ". | 
|---|
| 727 |      "datePicker.prototype.days[5] = '".html::escapeJS(__('Saturday'))."'; ". | 
|---|
| 728 |      "datePicker.prototype.days[6] = '".html::escapeJS(__('Sunday'))."'; ". | 
|---|
| 729 |  | 
|---|
| 730 |      "datePicker.prototype.img_src = 'images/date-picker.png'; ". | 
|---|
| 731 |  | 
|---|
| 732 |      "datePicker.prototype.close_msg = '".html::escapeJS(__('close'))."'; ". | 
|---|
| 733 |      "datePicker.prototype.now_msg = '".html::escapeJS(__('now'))."'; ". | 
|---|
| 734 |  | 
|---|
| 735 |      "\n//]]>\n". | 
|---|
| 736 |      "</script>\n"; | 
|---|
| 737 | } | 
|---|
| 738 |  | 
|---|
| 739 | public static function jsToolBar() | 
|---|
| 740 | { | 
|---|
| 741 |      $res = | 
|---|
| 742 |      '<link rel="stylesheet" type="text/css" href="style/jsToolBar/jsToolBar.css" />'. | 
|---|
| 743 |      '<script type="text/javascript" src="js/jsToolBar/jsToolBar.js"></script>'; | 
|---|
| 744 |  | 
|---|
| 745 |      if (isset($GLOBALS['core']->auth) && $GLOBALS['core']->auth->getOption('enable_wysiwyg')) { | 
|---|
| 746 |           $res .= '<script type="text/javascript" src="js/jsToolBar/jsToolBar.wysiwyg.js"></script>'; | 
|---|
| 747 |      } | 
|---|
| 748 |  | 
|---|
| 749 |      $res .= | 
|---|
| 750 |      '<script type="text/javascript" src="js/jsToolBar/jsToolBar.dotclear.js"></script>'. | 
|---|
| 751 |      '<script type="text/javascript">'."\n". | 
|---|
| 752 |      "//<![CDATA[\n". | 
|---|
| 753 |      "jsToolBar.prototype.dialog_url = 'popup.php'; ". | 
|---|
| 754 |      "jsToolBar.prototype.iframe_css = '". | 
|---|
| 755 |      'body{'. | 
|---|
| 756 |      'font: 12px "DejaVu Sans","Lucida Grande","Lucida Sans Unicode",Arial,sans-serif;'. | 
|---|
| 757 |      'color : #000;'. | 
|---|
| 758 |      'background: #f9f9f9;'. | 
|---|
| 759 |      'margin: 0;'. | 
|---|
| 760 |      'padding : 2px;'. | 
|---|
| 761 |      'border: none;'. | 
|---|
| 762 |      (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl' ? 'direction:rtl;' : ''). | 
|---|
| 763 |      '}'. | 
|---|
| 764 |      'pre, code, kbd, samp {'. | 
|---|
| 765 |      'font-family:"Courier New",Courier,monospace;'. | 
|---|
| 766 |      'font-size : 1.1em;'. | 
|---|
| 767 |      '}'. | 
|---|
| 768 |      'code {'. | 
|---|
| 769 |      'color : #666;'. | 
|---|
| 770 |      'font-weight : bold;'. | 
|---|
| 771 |      '}'. | 
|---|
| 772 |      'body > p:first-child {'. | 
|---|
| 773 |      'margin-top: 0;'. | 
|---|
| 774 |      '}'. | 
|---|
| 775 |      "'; ". | 
|---|
| 776 |      "jsToolBar.prototype.base_url = '".html::escapeJS($GLOBALS['core']->blog->host)."'; ". | 
|---|
| 777 |      "jsToolBar.prototype.switcher_visual_title = '".html::escapeJS(__('visual'))."'; ". | 
|---|
| 778 |      "jsToolBar.prototype.switcher_source_title = '".html::escapeJS(__('source'))."'; ". | 
|---|
| 779 |      "jsToolBar.prototype.legend_msg = '". | 
|---|
| 780 |      html::escapeJS(__('You can use the following shortcuts to format your text.'))."'; ". | 
|---|
| 781 |      "jsToolBar.prototype.elements.blocks.options.none = '".html::escapeJS(__('-- none --'))."'; ". | 
|---|
| 782 |      "jsToolBar.prototype.elements.blocks.options.nonebis = '".html::escapeJS(__('-- block format --'))."'; ". | 
|---|
| 783 |      "jsToolBar.prototype.elements.blocks.options.p = '".html::escapeJS(__('Paragraph'))."'; ". | 
|---|
| 784 |      "jsToolBar.prototype.elements.blocks.options.h1 = '".html::escapeJS(__('Level 1 header'))."'; ". | 
|---|
| 785 |      "jsToolBar.prototype.elements.blocks.options.h2 = '".html::escapeJS(__('Level 2 header'))."'; ". | 
|---|
| 786 |      "jsToolBar.prototype.elements.blocks.options.h3 = '".html::escapeJS(__('Level 3 header'))."'; ". | 
|---|
| 787 |      "jsToolBar.prototype.elements.blocks.options.h4 = '".html::escapeJS(__('Level 4 header'))."'; ". | 
|---|
| 788 |      "jsToolBar.prototype.elements.blocks.options.h5 = '".html::escapeJS(__('Level 5 header'))."'; ". | 
|---|
| 789 |      "jsToolBar.prototype.elements.blocks.options.h6 = '".html::escapeJS(__('Level 6 header'))."'; ". | 
|---|
| 790 |      "jsToolBar.prototype.elements.strong.title = '".html::escapeJS(__('Strong emphasis'))."'; ". | 
|---|
| 791 |      "jsToolBar.prototype.elements.em.title = '".html::escapeJS(__('Emphasis'))."'; ". | 
|---|
| 792 |      "jsToolBar.prototype.elements.ins.title = '".html::escapeJS(__('Inserted'))."'; ". | 
|---|
| 793 |      "jsToolBar.prototype.elements.del.title = '".html::escapeJS(__('Deleted'))."'; ". | 
|---|
| 794 |      "jsToolBar.prototype.elements.quote.title = '".html::escapeJS(__('Inline quote'))."'; ". | 
|---|
| 795 |      "jsToolBar.prototype.elements.code.title = '".html::escapeJS(__('Code'))."'; ". | 
|---|
| 796 |      "jsToolBar.prototype.elements.br.title = '".html::escapeJS(__('Line break'))."'; ". | 
|---|
| 797 |      "jsToolBar.prototype.elements.blockquote.title = '".html::escapeJS(__('Blockquote'))."'; ". | 
|---|
| 798 |      "jsToolBar.prototype.elements.pre.title = '".html::escapeJS(__('Preformated text'))."'; ". | 
|---|
| 799 |      "jsToolBar.prototype.elements.ul.title = '".html::escapeJS(__('Unordered list'))."'; ". | 
|---|
| 800 |      "jsToolBar.prototype.elements.ol.title = '".html::escapeJS(__('Ordered list'))."'; ". | 
|---|
| 801 |  | 
|---|
| 802 |      "jsToolBar.prototype.elements.link.title = '".html::escapeJS(__('Link'))."'; ". | 
|---|
| 803 |      "jsToolBar.prototype.elements.link.href_prompt = '".html::escapeJS(__('URL?'))."'; ". | 
|---|
| 804 |      "jsToolBar.prototype.elements.link.hreflang_prompt = '".html::escapeJS(__('Language?'))."'; ". | 
|---|
| 805 |  | 
|---|
| 806 |      "jsToolBar.prototype.elements.img.title = '".html::escapeJS(__('External image'))."'; ". | 
|---|
| 807 |      "jsToolBar.prototype.elements.img.src_prompt = '".html::escapeJS(__('URL?'))."'; ". | 
|---|
| 808 |  | 
|---|
| 809 |      "jsToolBar.prototype.elements.img_select.title = '".html::escapeJS(__('Media chooser'))."'; ". | 
|---|
| 810 |      "jsToolBar.prototype.elements.post_link.title = '".html::escapeJS(__('Link to an entry'))."'; "; | 
|---|
| 811 |  | 
|---|
| 812 |      if (!$GLOBALS['core']->auth->check('media,media_admin',$GLOBALS['core']->blog->id)) { | 
|---|
| 813 |           $res .= "jsToolBar.prototype.elements.img_select.disabled = true;\n"; | 
|---|
| 814 |      } | 
|---|
| 815 |  | 
|---|
| 816 |      $res .= | 
|---|
| 817 |      "\n//]]>\n". | 
|---|
| 818 |      "</script>\n"; | 
|---|
| 819 |  | 
|---|
| 820 |      return $res; | 
|---|
| 821 | } | 
|---|
| 822 |  | 
|---|
| 823 | public static function jsUpload($params=array(),$base_url=null) | 
|---|
| 824 | { | 
|---|
| 825 |      if (!$base_url) { | 
|---|
| 826 |           $base_url = path::clean(dirname(preg_replace('/(\?.*$)?/','',$_SERVER['REQUEST_URI']))).'/'; | 
|---|
| 827 |      } | 
|---|
| 828 |  | 
|---|
| 829 |      $params = array_merge($params,array( | 
|---|
| 830 |           'sess_id='.session_id(), | 
|---|
| 831 |           'sess_uid='.$_SESSION['sess_browser_uid'], | 
|---|
| 832 |           'xd_check='.$GLOBALS['core']->getNonce() | 
|---|
| 833 |           )); | 
|---|
| 834 |  | 
|---|
| 835 |      return | 
|---|
| 836 |      '<script type="text/javascript">'."\n". | 
|---|
| 837 |      "//<![CDATA[\n". | 
|---|
| 838 |      "dotclear.jsUpload = {};\n". | 
|---|
| 839 |      "dotclear.jsUpload.msg = {};\n". | 
|---|
| 840 |      self::jsVar('dotclear.msg.enhanced_uploader_activate',__('Temporarily activate enhanced uploader')). | 
|---|
| 841 |      self::jsVar('dotclear.msg.enhanced_uploader_disable',__('Temporarily disable enhanced uploader')). | 
|---|
| 842 |      self::jsVar('dotclear.jsUpload.msg.limit_exceeded',__('Limit exceeded.')). | 
|---|
| 843 |      self::jsVar('dotclear.jsUpload.msg.size_limit_exceeded',__('File size exceeds allowed limit.')). | 
|---|
| 844 |      self::jsVar('dotclear.jsUpload.msg.canceled',__('Canceled.')). | 
|---|
| 845 |      self::jsVar('dotclear.jsUpload.msg.http_error',__('HTTP Error:')). | 
|---|
| 846 |      self::jsVar('dotclear.jsUpload.msg.error',__('Error:')). | 
|---|
| 847 |      self::jsVar('dotclear.jsUpload.msg.choose_file',__('Choose file')). | 
|---|
| 848 |      self::jsVar('dotclear.jsUpload.msg.choose_files',__('Choose files')). | 
|---|
| 849 |      self::jsVar('dotclear.jsUpload.msg.cancel',__('Cancel')). | 
|---|
| 850 |      self::jsVar('dotclear.jsUpload.msg.clean',__('Clean')). | 
|---|
| 851 |      self::jsVar('dotclear.jsUpload.msg.upload',__('Upload')). | 
|---|
| 852 |      self::jsVar('dotclear.jsUpload.msg.send',__('Send')). | 
|---|
| 853 |      self::jsVar('dotclear.jsUpload.msg.file_successfully_uploaded',__('File successfully uploaded.')). | 
|---|
| 854 |      self::jsVar('dotclear.jsUpload.msg.no_file_in_queue',__('No file in queue.')). | 
|---|
| 855 |      self::jsVar('dotclear.jsUpload.msg.file_in_queue',__('1 file in queue.')). | 
|---|
| 856 |      self::jsVar('dotclear.jsUpload.msg.files_in_queue',__('%d files in queue.')). | 
|---|
| 857 |      self::jsVar('dotclear.jsUpload.msg.queue_error',__('Queue error:')). | 
|---|
| 858 |      self::jsVar('dotclear.jsUpload.base_url',$base_url). | 
|---|
| 859 |      "\n//]]>\n". | 
|---|
| 860 |      "</script>\n". | 
|---|
| 861 |  | 
|---|
| 862 |      self::jsLoad('js/jsUpload/vendor/jquery.ui.widget.js'). | 
|---|
| 863 |      self::jsLoad('js/jsUpload/tmpl.js'). | 
|---|
| 864 |      self::jsLoad('js/jsUpload/template-upload.js'). | 
|---|
| 865 |      self::jsLoad('js/jsUpload/template-download.js'). | 
|---|
| 866 |      self::jsLoad('js/jsUpload/load-image.js'). | 
|---|
| 867 |      self::jsLoad('js/jsUpload/jquery.iframe-transport.js'). | 
|---|
| 868 |      self::jsLoad('js/jsUpload/jquery.fileupload.js'). | 
|---|
| 869 |      self::jsLoad('js/jsUpload/jquery.fileupload-process.js'). | 
|---|
| 870 |      self::jsLoad('js/jsUpload/jquery.fileupload-resize.js'). | 
|---|
| 871 |      self::jsLoad('js/jsUpload/jquery.fileupload-ui.js'); | 
|---|
| 872 | } | 
|---|
| 873 |  | 
|---|
| 874 | public static function jsToolMan() | 
|---|
| 875 | { | 
|---|
| 876 |      return | 
|---|
| 877 |      '<script type="text/javascript" src="js/tool-man/core.js"></script>'. | 
|---|
| 878 |      '<script type="text/javascript" src="js/tool-man/events.js"></script>'. | 
|---|
| 879 |      '<script type="text/javascript" src="js/tool-man/css.js"></script>'. | 
|---|
| 880 |      '<script type="text/javascript" src="js/tool-man/coordinates.js"></script>'. | 
|---|
| 881 |      '<script type="text/javascript" src="js/tool-man/drag.js"></script>'. | 
|---|
| 882 |      '<script type="text/javascript" src="js/tool-man/dragsort.js"></script>'. | 
|---|
| 883 |      '<script type="text/javascript" src="js/dragsort-tablerows.js"></script>'; | 
|---|
| 884 | } | 
|---|
| 885 |  | 
|---|
| 886 | public static function jsMetaEditor() | 
|---|
| 887 | { | 
|---|
| 888 |      return | 
|---|
| 889 |      '<script type="text/javascript" src="js/meta-editor.js"></script>'; | 
|---|
| 890 | } | 
|---|
| 891 | } | 
|---|
| 892 | ?> | 
|---|