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