| [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 | { | 
|---|
| [342] | 18 |      private static $loaded_js=array(); | 
|---|
 | 19 |  | 
|---|
| [0] | 20 |      # Auth check | 
|---|
 | 21 |      public static function check($permissions) | 
|---|
 | 22 |      { | 
|---|
 | 23 |           global $core; | 
|---|
| [1187] | 24 |  | 
|---|
| [0] | 25 |           if ($core->blog && $core->auth->check($permissions,$core->blog->id)) | 
|---|
 | 26 |           { | 
|---|
 | 27 |                return; | 
|---|
 | 28 |           } | 
|---|
| [1187] | 29 |  | 
|---|
| [0] | 30 |           if (session_id()) { | 
|---|
 | 31 |                $core->session->destroy(); | 
|---|
 | 32 |           } | 
|---|
 | 33 |           http::redirect(DC_AUTH_PAGE); | 
|---|
 | 34 |      } | 
|---|
| [1187] | 35 |  | 
|---|
| [0] | 36 |      # Check super admin | 
|---|
 | 37 |      public static function checkSuper() | 
|---|
 | 38 |      { | 
|---|
 | 39 |           global $core; | 
|---|
| [1187] | 40 |  | 
|---|
| [0] | 41 |           if (!$core->auth->isSuperAdmin()) | 
|---|
 | 42 |           { | 
|---|
 | 43 |                if (session_id()) { | 
|---|
 | 44 |                     $core->session->destroy(); | 
|---|
 | 45 |                } | 
|---|
 | 46 |                http::redirect(DC_AUTH_PAGE); | 
|---|
 | 47 |           } | 
|---|
 | 48 |      } | 
|---|
| [1187] | 49 |  | 
|---|
| [0] | 50 |      # Top of admin page | 
|---|
| [1358] | 51 |      public static function open($title='',$head='',$breadcrumb='') | 
|---|
| [0] | 52 |      { | 
|---|
 | 53 |           global $core; | 
|---|
| [1144] | 54 |  | 
|---|
| [0] | 55 |           # List of user's blogs | 
|---|
| [2159] | 56 |           if ($core->auth->getBlogCount() == 1 || $core->auth->getBlogCount() > 20) | 
|---|
| [0] | 57 |           { | 
|---|
 | 58 |                $blog_box = | 
|---|
| [999] | 59 |                '<p>'.__('Blog:').' <strong title="'.html::escapeHTML($core->blog->url).'">'. | 
|---|
| [0] | 60 |                html::escapeHTML($core->blog->name).'</strong>'; | 
|---|
| [1187] | 61 |  | 
|---|
| [2159] | 62 |                if ($core->auth->getBlogCount() > 20) { | 
|---|
| [0] | 63 |                     $blog_box .= ' - <a href="blogs.php">'.__('Change blog').'</a>'; | 
|---|
 | 64 |                } | 
|---|
| [999] | 65 |                $blog_box .= '</p>'; | 
|---|
| [0] | 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 = | 
|---|
| [2005] | 75 |                '<p><label for="switchblog" class="classic">'. | 
|---|
| [1309] | 76 |                __('Blogs:').'</label> '. | 
|---|
| [0] | 77 |                $core->formNonce(). | 
|---|
| [454] | 78 |                form::combo('switchblog',$blogs,$core->blog->id). | 
|---|
| [2005] | 79 |                '<input type="submit" value="'.__('ok').'" class="hidden-if-js" /></p>'; | 
|---|
| [0] | 80 |           } | 
|---|
| [1187] | 81 |  | 
|---|
| [36] | 82 |           $safe_mode = isset($_SESSION['sess_safe_mode']) && $_SESSION['sess_safe_mode']; | 
|---|
| [1187] | 83 |  | 
|---|
| [0] | 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". | 
|---|
| [1310] | 96 |           '  <meta name="viewport" content="width=device-width, initial-scale=1.0" />'."\n". | 
|---|
| [489] | 97 |           '  <title>'.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.'</title>'."\n". | 
|---|
| [1187] | 98 |  | 
|---|
 | 99 |  | 
|---|
| [0] | 100 |           self::jsLoadIE7(). | 
|---|
| [1586] | 101 |           '  <link rel="stylesheet" href="style/default.css" type="text/css" media="screen" />'."\n"; | 
|---|
| [0] | 102 |           if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') { | 
|---|
| [473] | 103 |                echo | 
|---|
| [1586] | 104 |                '  <link rel="stylesheet" href="style/default-rtl.css" type="text/css" media="screen" />'."\n"; | 
|---|
| [0] | 105 |           } | 
|---|
| [237] | 106 |  | 
|---|
| [244] | 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) { | 
|---|
| [2160] | 110 |                echo  | 
|---|
 | 111 |                '<link rel="icon" type="image/png" href="images/favicon96-login.png" />'. | 
|---|
| [2161] | 112 |                '<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />'; | 
|---|
| [244] | 113 |           } | 
|---|
| [0] | 114 |           echo | 
|---|
 | 115 |           self::jsCommon(). | 
|---|
| [1699] | 116 |           self::jsToggles(). | 
|---|
| [0] | 117 |           $head; | 
|---|
| [1187] | 118 |  | 
|---|
| [0] | 119 |           # --BEHAVIOR-- adminPageHTMLHead | 
|---|
 | 120 |           $core->callBehavior('adminPageHTMLHead'); | 
|---|
| [1187] | 121 |  | 
|---|
| [0] | 122 |           echo | 
|---|
 | 123 |           "</head>\n". | 
|---|
| [36] | 124 |           '<body id="dotclear-admin'. | 
|---|
| [1586] | 125 |           ($safe_mode ? ' safe-mode' : '').'" class="no-js">'."\n". | 
|---|
| [1187] | 126 |  | 
|---|
| [1590] | 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". | 
|---|
| [2005] | 132 |           '<div id="header">'. | 
|---|
 | 133 |           '<h1><a href="index.php"><span class="hidden">'.DC_VENDOR_NAME.'</span></a></h1>'."\n"; | 
|---|
| [1187] | 134 |  | 
|---|
| [0] | 135 |           echo | 
|---|
| [2005] | 136 |           '<form action="index.php" method="post" id="top-info-blog">'. | 
|---|
| [0] | 137 |           $blog_box. | 
|---|
| [2005] | 138 |           '<p><a href="'.$core->blog->url.'" onclick="window.open(this.href);return false;" title="'.__('Go to site'). | 
|---|
| [1947] | 139 |           ' ('.__('new window').')'.'">'.__('Go to site').'<img src="images/outgoing.png" alt="" /></a>'. | 
|---|
| [999] | 140 |           '</p></form>'. | 
|---|
| [2005] | 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>'. | 
|---|
| [2034] | 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>'. | 
|---|
| [2005] | 147 |           '</ul>'. | 
|---|
 | 148 |           '</div>'; // end header | 
|---|
| [1187] | 149 |  | 
|---|
| [0] | 150 |           echo | 
|---|
| [1741] | 151 |           '<div id="wrapper" class="clearfix">'."\n". | 
|---|
| [1946] | 152 |           '<div class="hidden-if-no-js collapser-box"><a href="#" id="collapser">'. | 
|---|
| [1867] | 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>'. | 
|---|
| [1946] | 156 |           '<div id="main">'."\n". | 
|---|
| [1741] | 157 |           '<div id="content" class="clearfix">'."\n"; | 
|---|
| [1187] | 158 |  | 
|---|
| [36] | 159 |           # Safe mode | 
|---|
 | 160 |           if ($safe_mode) | 
|---|
| [0] | 161 |           { | 
|---|
 | 162 |                echo | 
|---|
| [2043] | 163 |                '<div class="warning"><h3>'.__('Safe mode').'</h3>'. | 
|---|
| [37] | 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>'. | 
|---|
| [0] | 165 |                '</div>'; | 
|---|
 | 166 |           } | 
|---|
| [1187] | 167 |  | 
|---|
| [1355] | 168 |           // Display breadcrumb (if given) before any error message | 
|---|
| [1357] | 169 |           echo $breadcrumb; | 
|---|
| [1355] | 170 |  | 
|---|
| [0] | 171 |           if ($core->error->flag()) { | 
|---|
 | 172 |                echo | 
|---|
| [1384] | 173 |                '<div class="error"><p><strong>'.(count($core->error->getErrors()) > 1 ? __('Errors:') : __('Error:')).'</strong></p>'. | 
|---|
| [0] | 174 |                $core->error->toHTML(). | 
|---|
 | 175 |                '</div>'; | 
|---|
 | 176 |           } | 
|---|
 | 177 |      } | 
|---|
| [1187] | 178 |  | 
|---|
| [0] | 179 |      public static function close() | 
|---|
 | 180 |      { | 
|---|
| [942] | 181 |           global $core; | 
|---|
 | 182 |  | 
|---|
| [1933] | 183 |           if (!$GLOBALS['__resources']['ctxhelp']) { | 
|---|
 | 184 |                echo | 
|---|
| [2082] | 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>'; | 
|---|
| [1933] | 187 |           } | 
|---|
 | 188 |  | 
|---|
| [0] | 189 |           $menu =& $GLOBALS['_menu']; | 
|---|
| [1187] | 190 |  | 
|---|
| [0] | 191 |           echo | 
|---|
 | 192 |           "</div>\n".         // End of #content | 
|---|
 | 193 |           "</div>\n".         // End of #main | 
|---|
| [1187] | 194 |  | 
|---|
| [1311] | 195 |           '<div id="main-menu">'."\n". | 
|---|
 | 196 |  | 
|---|
 | 197 |           '<form id="search-menu" action="search.php" method="get">'. | 
|---|
| [1589] | 198 |           '<p><label for="qx" class="hidden">'.__('Search:').' </label>'.form::field('qx',30,255,''). | 
|---|
| [1311] | 199 |           '<input type="submit" value="'.__('OK').'" /></p>'. | 
|---|
 | 200 |           '</form>'; | 
|---|
| [1187] | 201 |  | 
|---|
| [0] | 202 |           foreach ($menu as $k => $v) { | 
|---|
 | 203 |                echo $menu[$k]->draw(); | 
|---|
 | 204 |           } | 
|---|
| [1187] | 205 |  | 
|---|
| [1140] | 206 |           $text = sprintf(__('Thank you for using %s.'),'Dotclear '.DC_VERSION); | 
|---|
| [942] | 207 |  | 
|---|
 | 208 |           # --BEHAVIOR-- adminPageFooter | 
|---|
| [946] | 209 |           $textAlt = $core->callBehavior('adminPageFooter',$core,$text); | 
|---|
| [1140] | 210 |           if ($textAlt != '') { | 
|---|
 | 211 |                $text = $textAlt; | 
|---|
 | 212 |           } | 
|---|
| [1142] | 213 |           $text = html::escapeHTML($text); | 
|---|
| [942] | 214 |  | 
|---|
| [0] | 215 |           echo | 
|---|
 | 216 |           '</div>'."\n".      // End of #main-menu | 
|---|
| [1946] | 217 |           "</div>\n";         // End of #wrapper | 
|---|
| [1861] | 218 |  | 
|---|
| [1946] | 219 |           echo | 
|---|
| [1793] | 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". | 
|---|
| [1599] | 222 |           '<!-- '."\n". | 
|---|
 | 223 | '                  .'."\n". | 
|---|
 | 224 | '               ,;:\'`\'::'."\n". | 
|---|
 | 225 | '            __||'."\n". | 
|---|
 | 226 | '      _____/LLLL\_'."\n". | 
|---|
 | 227 | '      \__________"|'."\n". | 
|---|
 | 228 | '    ~^~^~^~^~^~^~^~^~^~'."\n". | 
|---|
| [1946] | 229 | ' -->'."\n"; | 
|---|
| [1187] | 230 |  | 
|---|
| [0] | 231 |           if (defined('DC_DEV') && DC_DEV === true) { | 
|---|
 | 232 |                echo self::debugInfo(); | 
|---|
 | 233 |           } | 
|---|
| [1187] | 234 |  | 
|---|
| [0] | 235 |           echo | 
|---|
 | 236 |           '</body></html>'; | 
|---|
 | 237 |      } | 
|---|
| [1187] | 238 |  | 
|---|
| [1358] | 239 |      public static function openPopup($title='',$head='',$breadcrumb='') | 
|---|
| [0] | 240 |      { | 
|---|
 | 241 |           global $core; | 
|---|
| [1187] | 242 |  | 
|---|
| [0] | 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". | 
|---|
| [1311] | 251 |           '<meta name="viewport" content="width=device-width, initial-scale=1.0" />'."\n". | 
|---|
| [0] | 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". | 
|---|
| [1187] | 255 |  | 
|---|
| [0] | 256 |           '  <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n". | 
|---|
 | 257 |           '  <meta name="GOOGLEBOT" content="NOSNIPPET" />'."\n". | 
|---|
| [1187] | 258 |  | 
|---|
| [0] | 259 |           self::jsLoadIE7(). | 
|---|
| [1187] | 260 |           '    <link rel="stylesheet" href="style/default.css" type="text/css" media="screen" />'."\n"; | 
|---|
| [0] | 261 |           if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') { | 
|---|
| [473] | 262 |                echo | 
|---|
| [1187] | 263 |                '    <link rel="stylesheet" href="style/default-rtl.css" type="text/css" media="screen" />'."\n"; | 
|---|
| [0] | 264 |           } | 
|---|
| [1187] | 265 |  | 
|---|
| [0] | 266 |           echo | 
|---|
 | 267 |           self::jsCommon(). | 
|---|
| [1699] | 268 |           self::jsToggles(). | 
|---|
| [0] | 269 |           $head; | 
|---|
| [1187] | 270 |  | 
|---|
| [0] | 271 |           # --BEHAVIOR-- adminPageHTMLHead | 
|---|
 | 272 |           $core->callBehavior('adminPageHTMLHead'); | 
|---|
| [1187] | 273 |  | 
|---|
| [0] | 274 |           echo | 
|---|
 | 275 |           "</head>\n". | 
|---|
 | 276 |           '<body id="dotclear-admin" class="popup">'."\n". | 
|---|
| [1187] | 277 |  | 
|---|
| [2046] | 278 |           '<h1>'.DC_VENDOR_NAME.'</h1>'."\n"; | 
|---|
| [1187] | 279 |  | 
|---|
| [0] | 280 |           echo | 
|---|
 | 281 |           '<div id="wrapper">'."\n". | 
|---|
 | 282 |           '<div id="main">'."\n". | 
|---|
 | 283 |           '<div id="content">'."\n"; | 
|---|
| [1187] | 284 |  | 
|---|
| [1358] | 285 |           // display breadcrumb if given | 
|---|
 | 286 |           echo $breadcrumb; | 
|---|
 | 287 |  | 
|---|
| [0] | 288 |           if ($core->error->flag()) { | 
|---|
 | 289 |                echo | 
|---|
 | 290 |                '<div class="error"><strong>'.__('Errors:').'</strong>'. | 
|---|
 | 291 |                $core->error->toHTML(). | 
|---|
 | 292 |                '</div>'; | 
|---|
 | 293 |           } | 
|---|
 | 294 |      } | 
|---|
| [1187] | 295 |  | 
|---|
| [0] | 296 |      public static function closePopup() | 
|---|
 | 297 |      { | 
|---|
 | 298 |           echo | 
|---|
 | 299 |           "</div>\n".         // End of #content | 
|---|
 | 300 |           "</div>\n".         // End of #main | 
|---|
| [2046] | 301 |           "</div>\n".         // End of #wrapper | 
|---|
| [0] | 302 |           '<div id="footer"><p> </p></div>'."\n". | 
|---|
 | 303 |           '</body></html>'; | 
|---|
 | 304 |      } | 
|---|
| [907] | 305 |  | 
|---|
| [1358] | 306 |      public static function breadcrumb($elements=null,$with_home_link=true,$echo=false) | 
|---|
| [1328] | 307 |      { | 
|---|
 | 308 |           // First item of array elements should be blog's name, System or Plugins | 
|---|
| [1340] | 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="" />'); | 
|---|
| [1328] | 312 |           $index = 0; | 
|---|
 | 313 |           foreach ($elements as $element => $url) { | 
|---|
| [1358] | 314 |                $res .= ($with_home_link ? ($index == 1 ? ' : ' : ' › ') : ($index == 0 ? ' ' : ' › ')). | 
|---|
 | 315 |                     ($url ? '<a href="'.$url.'">' : '').$element.($url ? '</a>' : ''); | 
|---|
| [1328] | 316 |                $index++; | 
|---|
 | 317 |           } | 
|---|
 | 318 |           $res .= '</h2>'; | 
|---|
| [1334] | 319 |           if ($echo) { | 
|---|
 | 320 |                echo $res; | 
|---|
 | 321 |           } | 
|---|
| [1328] | 322 |           return $res; | 
|---|
 | 323 |      } | 
|---|
 | 324 |  | 
|---|
| [1548] | 325 |      public static function message($msg,$timestamp=true,$div=false,$echo=true,$class='message') | 
|---|
| [907] | 326 |      { | 
|---|
| [910] | 327 |           global $core; | 
|---|
| [1187] | 328 |  | 
|---|
| [907] | 329 |           $res = ''; | 
|---|
 | 330 |           if ($msg != '') { | 
|---|
| [1548] | 331 |                $res = ($div ? '<div class="'.$class.'">' : '').'<p'.($div ? '' : ' class="'.$class.'"').'>'. | 
|---|
| [1161] | 332 |                ($timestamp ? dt::str(__('%H:%M:%S:'),null,$core->auth->getInfo('user_tz')).' ' : '').$msg. | 
|---|
 | 333 |                '</p>'.($div ? '</div>' : ''); | 
|---|
| [907] | 334 |                if ($echo) { | 
|---|
 | 335 |                     echo $res; | 
|---|
 | 336 |                } | 
|---|
 | 337 |           } | 
|---|
 | 338 |           return $res; | 
|---|
 | 339 |      } | 
|---|
| [1187] | 340 |  | 
|---|
| [1548] | 341 |      public static function success($msg,$timestamp=true,$div=false,$echo=true) | 
|---|
 | 342 |      { | 
|---|
| [1927] | 343 |           return self::message($msg,$timestamp,$div,$echo,"success"); | 
|---|
| [1548] | 344 |      } | 
|---|
 | 345 |  | 
|---|
| [1725] | 346 |      public static function warning($msg,$timestamp=true,$div=false,$echo=true) | 
|---|
 | 347 |      { | 
|---|
| [1927] | 348 |           return self::message($msg,$timestamp,$div,$echo,"warning-msg"); | 
|---|
| [1725] | 349 |      } | 
|---|
 | 350 |  | 
|---|
| [0] | 351 |      private static function debugInfo() | 
|---|
 | 352 |      { | 
|---|
 | 353 |           $global_vars = implode(', ',array_keys($GLOBALS)); | 
|---|
| [1187] | 354 |  | 
|---|
| [0] | 355 |           $res = | 
|---|
 | 356 |           '<div id="debug"><div>'. | 
|---|
 | 357 |           '<p>memory usage: '.memory_get_usage().' ('.files::size(memory_get_usage()).')</p>'; | 
|---|
| [1187] | 358 |  | 
|---|
| [0] | 359 |           if (function_exists('xdebug_get_profiler_filename')) | 
|---|
 | 360 |           { | 
|---|
 | 361 |                $res .= '<p>Elapsed time: '.xdebug_time_index().' seconds</p>'; | 
|---|
| [1187] | 362 |  | 
|---|
| [0] | 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(); | 
|---|
| [321] | 368 |                     $prof_url .= (strpos($prof_url,'?') === false) ? '?' : '&'; | 
|---|
| [0] | 369 |                     $prof_url .= 'XDEBUG_PROFILE'; | 
|---|
| [321] | 370 |                     $res .= '<p><a href="'.html::escapeURL($prof_url).'">Trigger profiler</a></p>'; | 
|---|
| [0] | 371 |                } | 
|---|
| [1187] | 372 |  | 
|---|
| [0] | 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 |           } | 
|---|
| [1187] | 386 |  | 
|---|
| [0] | 387 |           $res .= | 
|---|
 | 388 |           '<p>Global vars: '.$global_vars.'</p>'. | 
|---|
 | 389 |           '</div></div>'; | 
|---|
| [1187] | 390 |  | 
|---|
| [0] | 391 |           return $res; | 
|---|
 | 392 |      } | 
|---|
| [1187] | 393 |  | 
|---|
| [0] | 394 |      public static function help($page,$index='') | 
|---|
 | 395 |      { | 
|---|
 | 396 |           # Deprecated but we keep this for plugins. | 
|---|
 | 397 |      } | 
|---|
| [1187] | 398 |  | 
|---|
| [0] | 399 |      public static function helpBlock() | 
|---|
 | 400 |      { | 
|---|
 | 401 |           $args = func_get_args(); | 
|---|
| [1458] | 402 |  | 
|---|
 | 403 |           $args = new ArrayObject($args); | 
|---|
 | 404 |  | 
|---|
 | 405 |           # --BEHAVIOR-- adminPageHelpBlock | 
|---|
 | 406 |           $GLOBALS['core']->callBehavior('adminPageHelpBlock',$args); | 
|---|
 | 407 |  | 
|---|
| [0] | 408 |           if (empty($args)) { | 
|---|
 | 409 |                return; | 
|---|
 | 410 |           }; | 
|---|
| [1187] | 411 |  | 
|---|
| [0] | 412 |           global $__resources; | 
|---|
 | 413 |           if (empty($__resources['help'])) { | 
|---|
 | 414 |                return; | 
|---|
 | 415 |           } | 
|---|
| [1187] | 416 |  | 
|---|
| [0] | 417 |           $content = ''; | 
|---|
 | 418 |           foreach ($args as $v) | 
|---|
 | 419 |           { | 
|---|
 | 420 |                if (is_object($v) && isset($v->content)) { | 
|---|
 | 421 |                     $content .= $v->content; | 
|---|
 | 422 |                     continue; | 
|---|
 | 423 |                } | 
|---|
| [1187] | 424 |  | 
|---|
| [0] | 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 |                } | 
|---|
| [1187] | 432 |  | 
|---|
| [0] | 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 |           } | 
|---|
| [1187] | 440 |  | 
|---|
| [0] | 441 |           if (trim($content) == '') { | 
|---|
 | 442 |                return; | 
|---|
 | 443 |           } | 
|---|
| [1187] | 444 |  | 
|---|
| [1933] | 445 |           // Set contextual help global flag | 
|---|
 | 446 |           $GLOBALS['__resources']['ctxhelp'] = true; | 
|---|
 | 447 |  | 
|---|
| [0] | 448 |           echo | 
|---|
| [1573] | 449 |           '<div id="help"><hr /><div class="help-content clear"><h3>'.__('Help about this page').'</h3>'. | 
|---|
| [0] | 450 |           $content. | 
|---|
| [494] | 451 |           '</div>'. | 
|---|
 | 452 |           '<div id="helplink"><hr />'. | 
|---|
 | 453 |           '<p>'. | 
|---|
 | 454 |           sprintf(__('See also %s'),sprintf('<a href="help.php">%s</a>',__('the global help'))). | 
|---|
| [2011] | 455 |           '.</p>'. | 
|---|
| [0] | 456 |           '</div></div>'; | 
|---|
 | 457 |      } | 
|---|
| [1187] | 458 |  | 
|---|
| [0] | 459 |      public static function jsLoad($src) | 
|---|
 | 460 |      { | 
|---|
| [342] | 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 |           } | 
|---|
| [0] | 466 |      } | 
|---|
| [1187] | 467 |  | 
|---|
| [0] | 468 |      public static function jsVar($n,$v) | 
|---|
 | 469 |      { | 
|---|
 | 470 |           return $n." = '".html::escapeJS($v)."';\n"; | 
|---|
 | 471 |      } | 
|---|
| [1187] | 472 |  | 
|---|
| [1699] | 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 |      } | 
|---|
| [0] | 493 |       | 
|---|
 | 494 |      public static function jsCommon() | 
|---|
 | 495 |      { | 
|---|
| [1771] | 496 |           $mute_or_no = ''; | 
|---|
| [1841] | 497 |           if (empty($GLOBALS['core']->blog) || $GLOBALS['core']->blog->settings->system->jquery_migrate_mute) { | 
|---|
| [1771] | 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 |  | 
|---|
| [0] | 506 |           return | 
|---|
 | 507 |           self::jsLoad('js/jquery/jquery.js'). | 
|---|
| [1771] | 508 |           $mute_or_no. | 
|---|
 | 509 |           self::jsLoad('js/jquery/jquery-migrate-1.2.1.js'). | 
|---|
| [0] | 510 |           self::jsLoad('js/jquery/jquery.biscuit.js'). | 
|---|
 | 511 |           self::jsLoad('js/jquery/jquery.bgFade.js'). | 
|---|
 | 512 |           self::jsLoad('js/common.js'). | 
|---|
| [447] | 513 |           self::jsLoad('js/prelude.js'). | 
|---|
| [1187] | 514 |  | 
|---|
| [0] | 515 |           '<script type="text/javascript">'."\n". | 
|---|
 | 516 |           "//<![CDATA[\n". | 
|---|
 | 517 |           self::jsVar('dotclear.nonce',$GLOBALS['core']->getNonce()). | 
|---|
| [1019] | 518 |           self::jsVar('dotclear.img_plus_src','images/expand.png'). | 
|---|
| [0] | 519 |           self::jsVar('dotclear.img_plus_alt',__('uncover')). | 
|---|
| [1019] | 520 |           self::jsVar('dotclear.img_minus_src','images/hide.png'). | 
|---|
| [0] | 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'). | 
|---|
| [1187] | 524 |  | 
|---|
| [0] | 525 |           self::jsVar('dotclear.msg.help', | 
|---|
| [1933] | 526 |                __('Need help?')). | 
|---|
| [1302] | 527 |           self::jsVar('dotclear.msg.help_hide', | 
|---|
 | 528 |                __('Hide')). | 
|---|
| [1556] | 529 |           self::jsVar('dotclear.msg.to_select', | 
|---|
 | 530 |                __('Select:')). | 
|---|
| [0] | 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', | 
|---|
| [1556] | 536 |                __('Invert selection')). | 
|---|
| [0] | 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)?")). | 
|---|
| [1525] | 553 |           self::jsVar('dotclear.msg.confirm_delete_categories', | 
|---|
 | 554 |                __("Are you sure you want to delete selected categories (%s)?")). | 
|---|
| [0] | 555 |           self::jsVar('dotclear.msg.confirm_delete_post', | 
|---|
 | 556 |                __("Are you sure you want to delete this entry?")). | 
|---|
| [1395] | 557 |           self::jsVar('dotclear.msg.click_to_unlock', | 
|---|
| [1450] | 558 |                __("Click here to unlock the field")). | 
|---|
| [1049] | 559 |           self::jsVar('dotclear.msg.confirm_spam_delete', | 
|---|
 | 560 |                __('Are you sure you want to delete all spams?')). | 
|---|
| [0] | 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?')). | 
|---|
| [1462] | 589 |           self::jsVar('dotclear.msg.confirm_delete_backup', | 
|---|
 | 590 |                __('Are you sure you want to delete this backup?')). | 
|---|
| [0] | 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.')). | 
|---|
| [1861] | 599 |           self::jsVar('dotclear.msg.warning_validate_no_save_content', | 
|---|
| [1832] | 600 |                __('Attention: an audit of a content not yet registered.')). | 
|---|
| [0] | 601 |           self::jsVar('dotclear.msg.confirm_change_post_format', | 
|---|
 | 602 |                __('You have unsaved changes. Switch post format will loose these changes. Proceed anyway?')). | 
|---|
| [1256] | 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?")). | 
|---|
| [224] | 605 |           self::jsVar('dotclear.msg.load_enhanced_uploader', | 
|---|
 | 606 |                __('Loading enhanced uploader, please wait.')). | 
|---|
| [2156] | 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', | 
|---|
| [2157] | 613 |                __('Support')). | 
|---|
| [2156] | 614 |           self::jsVar('dotclear.msg.module_help', | 
|---|
| [2157] | 615 |                __('Help:')). | 
|---|
| [2156] | 616 |           self::jsVar('dotclear.msg.module_section', | 
|---|
 | 617 |                __('Section:')). | 
|---|
 | 618 |           self::jsVar('dotclear.msg.module_tags', | 
|---|
 | 619 |                __('Tags:')). | 
|---|
| [1699] | 620 |                "\n//]]>\n". | 
|---|
| [0] | 621 |           "</script>\n"; | 
|---|
 | 622 |      } | 
|---|
| [1187] | 623 |  | 
|---|
| [0] | 624 |      public static function jsLoadIE7() | 
|---|
 | 625 |      { | 
|---|
 | 626 |           return | 
|---|
| [1456] | 627 |           '<!--[if lt IE 9]>'."\n". | 
|---|
 | 628 |           self::jsLoad('js/ie7/IE9.js'). | 
|---|
| [0] | 629 |           '<link rel="stylesheet" type="text/css" href="style/iesucks.css" />'."\n". | 
|---|
 | 630 |           '<![endif]-->'."\n"; | 
|---|
 | 631 |      } | 
|---|
| [1187] | 632 |  | 
|---|
| [0] | 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 |           } | 
|---|
| [1187] | 644 |  | 
|---|
| [0] | 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 |      } | 
|---|
| [1187] | 654 |  | 
|---|
| [0] | 655 |      public static function jsPageTabs($default=null) | 
|---|
 | 656 |      { | 
|---|
 | 657 |           if ($default) { | 
|---|
 | 658 |                $default = "'".html::escapeJS($default)."'"; | 
|---|
 | 659 |           } | 
|---|
| [2113] | 660 |            | 
|---|
| [0] | 661 |           return | 
|---|
 | 662 |           self::jsLoad('js/jquery/jquery.pageTabs.js'). | 
|---|
 | 663 |           '<script type="text/javascript">'."\n". | 
|---|
 | 664 |           "//<![CDATA[\n". | 
|---|
| [2010] | 665 |           '$(function() {'."\n". | 
|---|
| [2054] | 666 |           '$.pageTabs('.$default.');'."\n". | 
|---|
| [2113] | 667 |           '});'. | 
|---|
| [0] | 668 |           "\n//]]>\n". | 
|---|
| [2113] | 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"; | 
|---|
| [2010] | 678 |      } | 
|---|
| [1161] | 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". | 
|---|
| [1187] | 708 |  | 
|---|
| [1161] | 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'))."'; ". | 
|---|
| [1187] | 721 |  | 
|---|
| [1161] | 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'))."'; ". | 
|---|
| [1187] | 729 |  | 
|---|
| [1161] | 730 |      "datePicker.prototype.img_src = 'images/date-picker.png'; ". | 
|---|
| [1187] | 731 |  | 
|---|
| [1161] | 732 |      "datePicker.prototype.close_msg = '".html::escapeJS(__('close'))."'; ". | 
|---|
 | 733 |      "datePicker.prototype.now_msg = '".html::escapeJS(__('now'))."'; ". | 
|---|
| [1187] | 734 |  | 
|---|
| [1161] | 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>'; | 
|---|
| [1187] | 744 |  | 
|---|
| [1161] | 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>'; | 
|---|
| [0] | 747 |      } | 
|---|
| [1187] | 748 |  | 
|---|
| [1161] | 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'))."'; ". | 
|---|
| [1187] | 801 |  | 
|---|
| [1161] | 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?'))."'; ". | 
|---|
| [1187] | 805 |  | 
|---|
| [1161] | 806 |      "jsToolBar.prototype.elements.img.title = '".html::escapeJS(__('External image'))."'; ". | 
|---|
 | 807 |      "jsToolBar.prototype.elements.img.src_prompt = '".html::escapeJS(__('URL?'))."'; ". | 
|---|
| [1187] | 808 |  | 
|---|
| [1161] | 809 |      "jsToolBar.prototype.elements.img_select.title = '".html::escapeJS(__('Media chooser'))."'; ". | 
|---|
 | 810 |      "jsToolBar.prototype.elements.post_link.title = '".html::escapeJS(__('Link to an entry'))."'; "; | 
|---|
| [1187] | 811 |  | 
|---|
| [1161] | 812 |      if (!$GLOBALS['core']->auth->check('media,media_admin',$GLOBALS['core']->blog->id)) { | 
|---|
 | 813 |           $res .= "jsToolBar.prototype.elements.img_select.disabled = true;\n"; | 
|---|
| [0] | 814 |      } | 
|---|
| [1187] | 815 |  | 
|---|
| [1161] | 816 |      $res .= | 
|---|
 | 817 |      "\n//]]>\n". | 
|---|
 | 818 |      "</script>\n"; | 
|---|
| [1187] | 819 |  | 
|---|
| [1161] | 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']))).'/'; | 
|---|
| [0] | 827 |      } | 
|---|
| [1187] | 828 |  | 
|---|
| [1161] | 829 |      $params = array_merge($params,array( | 
|---|
 | 830 |           'sess_id='.session_id(), | 
|---|
 | 831 |           'sess_uid='.$_SESSION['sess_browser_uid'], | 
|---|
 | 832 |           'xd_check='.$GLOBALS['core']->getNonce() | 
|---|
| [0] | 833 |           )); | 
|---|
| [1187] | 834 |  | 
|---|
| [1161] | 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')). | 
|---|
| [1461] | 852 |      self::jsVar('dotclear.jsUpload.msg.send',__('Send')). | 
|---|
 | 853 |      self::jsVar('dotclear.jsUpload.msg.file_successfully_uploaded',__('File successfully uploaded.')). | 
|---|
| [1161] | 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". | 
|---|
| [1461] | 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'); | 
|---|
| [0] | 872 | } | 
|---|
| [1144] | 873 |  | 
|---|
| [1161] | 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 | } | 
|---|
| [1144] | 885 |  | 
|---|
| [1161] | 886 | public static function jsMetaEditor() | 
|---|
 | 887 | { | 
|---|
 | 888 |      return | 
|---|
 | 889 |      '<script type="text/javascript" src="js/meta-editor.js"></script>'; | 
|---|
 | 890 | } | 
|---|
| [489] | 891 | } | 
|---|
| [1187] | 892 | ?> | 
|---|