Changeset 3915:a57821ba9ef1 for inc/admin
- Timestamp:
- 11/05/18 16:40:40 (7 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/lib.dc.page.php
r3913 r3915 24 24 "static" => "static-msg"]; 25 25 26 private static function getCore() 27 { 28 return $GLOBALS['core']; 29 } 30 26 31 # Auth check 27 32 public static function check($permissions) 28 33 { 29 global $core;34 $core = self::getCore(); 30 35 31 36 if ($core->blog && $core->auth->check($permissions, $core->blog->id)) { … … 42 47 public static function checkSuper() 43 48 { 44 global $core;49 $core = self::getCore(); 45 50 46 51 if (!$core->auth->isSuperAdmin()) { … … 55 60 public static function open($title = '', $head = '', $breadcrumb = '', $options = []) 56 61 { 57 global $core; 62 $core = self::getCore(); 63 $js = []; 58 64 59 65 # List of user's blogs … … 170 176 171 177 if ($core->auth->user_prefs->interface->darkmode) { 172 echo self::jsVars(['dotclear_darkMode' => 1]);178 $js['darkMode'] = 1; 173 179 echo self::cssLoad('style/default-dark.css'); 174 180 } else { 175 echo self::jsVars(['dotclear_darkMode' => 0]);181 $js['darkMode'] = 0; 176 182 echo self::cssLoad('style/default.css'); 177 183 } … … 186 192 '<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />' . "\n"; 187 193 } 188 189 194 if ($core->auth->user_prefs->interface->htmlfontsize) { 190 echo 191 '<script type="text/javascript">' . "\n" . 192 self::jsVar('dotclear_htmlFontSize', $core->auth->user_prefs->interface->htmlfontsize) . "\n" . 193 "</script>\n"; 194 } 195 $js['htmlFontSize'] = $core->auth->user_prefs->interface->htmlfontsize; 196 } 197 $js['hideMoreInfo'] = (boolean) $core->auth->user_prefs->interface->hidemoreinfo; 198 $js['showAjaxLoader'] = (boolean) $core->auth->user_prefs->interface->showajaxloader; 199 200 $core->auth->user_prefs->addWorkspace('accessibility'); 201 $js['noDragDrop'] = (boolean) $core->auth->user_prefs->accessibility->nodragdrop; 202 203 // Set some JSON data 204 echo dcUtils::jsJson('dotclear_init', $js); 195 205 196 206 echo … … 198 208 self::jsToggles() . 199 209 $head; 200 201 $core->auth->user_prefs->addWorkspace('accessibility');202 echo203 '<script type="text/javascript">' . "\n" .204 'dotclear.noDragDrop = '.($core->auth->user_prefs->accessibility->nodragdrop ? 'true' : 'false').';' . "\n" .205 "</script>\n";206 207 if ($core->auth->user_prefs->interface->hidemoreinfo) {208 echo209 '<script type="text/javascript">' . "\n" .210 'dotclear.hideMoreInfo = true;' . "\n" .211 "</script>\n";212 }213 if ($core->auth->user_prefs->interface->showajaxloader) {214 echo215 '<script type="text/javascript">' . "\n" .216 'dotclear.showAjaxLoader = true;' . "\n" .217 "</script>\n";218 }219 210 220 211 # --BEHAVIOR-- adminPageHTMLHead … … 276 267 public static function notices() 277 268 { 278 global $core;269 $core = self::getCore(); 279 270 static $error_displayed = false; 280 271 … … 350 341 protected static function getNotification($n) 351 342 { 352 global $core;343 $core = self::getCore(); 353 344 354 345 $tag = (isset($n['divtag']) && $n['divtag']) ? 'div' : 'p'; … … 363 354 public static function close() 364 355 { 365 global $core;356 $core = self::getCore(); 366 357 367 358 if (!$GLOBALS['__resources']['ctxhelp']) { … … 436 427 public static function openPopup($title = '', $head = '', $breadcrumb = '') 437 428 { 438 global $core; 429 $core = self::getCore(); 430 $js = []; 439 431 440 432 # Display … … 460 452 461 453 if ($core->auth->user_prefs->interface->darkmode) { 462 echo self::jsVars(['dotclear_darkMode' => 1]);454 $js['darkMode'] = 1; 463 455 echo self::cssLoad('style/default-dark.css'); 464 456 } else { 465 echo self::jsVars(['dotclear_darkMode' => 0]);457 $js['darkMode'] = 0; 466 458 echo self::cssLoad('style/default.css'); 467 459 } … … 472 464 $core->auth->user_prefs->addWorkspace('interface'); 473 465 if ($core->auth->user_prefs->interface->htmlfontsize) { 474 echo 475 '<script type="text/javascript">' . "\n" . 476 self::jsVar('dotclear_htmlFontSize', $core->auth->user_prefs->interface->htmlfontsize) . "\n" . 477 "</script>\n"; 478 } 466 $js['htmlFontSize'] = $core->auth->user_prefs->interface->htmlfontsize; 467 } 468 $js['hideMoreInfo'] = (boolean) $core->auth->user_prefs->interface->hidemoreinfo; 469 $js['showAjaxLoader'] = (boolean) $core->auth->user_prefs->interface->showajaxloader; 470 471 $core->auth->user_prefs->addWorkspace('accessibility'); 472 $js['noDragDrop'] = (boolean) $core->auth->user_prefs->accessibility->nodragdrop; 473 474 // Set JSON data 475 echo dcUtils::jsJson('dotclear_init', $js); 479 476 480 477 echo … … 483 480 $head; 484 481 485 $core->auth->user_prefs->addWorkspace('accessibility');486 echo487 '<script type="text/javascript">' . "\n" .488 'dotclear.noDragDrop = '.($core->auth->user_prefs->accessibility->nodragdrop ? 'true' : 'false').';' . "\n" .489 "</script>\n";490 491 if ($core->auth->user_prefs->interface->hidemoreinfo) {492 echo493 '<script type="text/javascript">' . "\n" .494 'dotclear.hideMoreInfo = true;' . "\n" .495 "</script>\n";496 }497 if ($core->auth->user_prefs->interface->showajaxloader) {498 echo499 '<script type="text/javascript">' . "\n" .500 'dotclear.showAjaxLoader = true;' . "\n" .501 "</script>\n";502 }503 504 482 # --BEHAVIOR-- adminPageHTMLHead 505 483 $core->callBehavior('adminPageHTMLHead'); … … 539 517 public static function breadcrumb($elements = null, $options = []) 540 518 { 541 global $core;519 $core = self::getCore(); 542 520 543 521 $with_home_link = isset($options['home_link']) ? $options['home_link'] : true; … … 566 544 public static function message($msg, $timestamp = true, $div = false, $echo = true, $class = 'message') 567 545 { 568 global $core;546 $core = self::getCore(); 569 547 570 548 $res = ''; … … 639 617 public static function helpBlock(...$params) 640 618 { 641 global $core;619 $core = self::getCore(); 642 620 643 621 if ($core->auth->user_prefs->interface->hidehelpbutton) { … … 648 626 649 627 # --BEHAVIOR-- adminPageHelpBlock 650 $ GLOBALS['core']->callBehavior('adminPageHelpBlock', $args);628 $core->callBehavior('adminPageHelpBlock', $args); 651 629 652 630 if (empty($args)) { … … 750 728 public static function jsUtil() 751 729 { 752 return self::jsLoad($GLOBALS['core']->blog->getPF('util.js')); 730 $core = self::getCore(); 731 return self::jsLoad($core->blog->getPF('util.js')); 753 732 } 754 733 755 734 public static function jsToggles() 756 735 { 757 if ($GLOBALS['core']->auth->user_prefs->toggles) { 758 $unfolded_sections = explode(',', $GLOBALS['core']->auth->user_prefs->toggles->unfolded_sections); 736 $core = self::getCore(); 737 738 if ($core->auth->user_prefs->toggles) { 739 $unfolded_sections = explode(',', $core->auth->user_prefs->toggles->unfolded_sections); 759 740 foreach ($unfolded_sections as $k => &$v) { 760 741 if ($v == '') { … … 774 755 public static function jsCommon() 775 756 { 757 $core = self::getCore(); 758 776 759 $mute_or_no = ''; 777 if (empty($ GLOBALS['core']->blog) || $GLOBALS['core']->blog->settings->system->jquery_migrate_mute) {760 if (empty($core->blog) || $core->blog->settings->system->jquery_migrate_mute) { 778 761 $mute_or_no .= 779 762 '<script type="text/javascript">' . "\n" . … … 794 777 'jsToolBar = {}, jsToolBar.prototype = { elements : {} };' . "\n" . 795 778 796 self::jsVar('dotclear.nonce', $ GLOBALS['core']->getNonce()) .779 self::jsVar('dotclear.nonce', $core->getNonce()) . 797 780 798 781 self::jsVar('dotclear.img_plus_src', 'images/expand.png') . … … 1029 1012 public static function jsUpload($params = [], $base_url = null) 1030 1013 { 1014 $core = self::getCore(); 1015 1031 1016 if (!$base_url) { 1032 1017 $base_url = path::clean(dirname(preg_replace('/(\?.*$)?/', '', $_SERVER['REQUEST_URI']))) . '/'; … … 1036 1021 'sess_id=' . session_id(), 1037 1022 'sess_uid=' . $_SESSION['sess_browser_uid'], 1038 'xd_check=' . $ GLOBALS['core']->getNonce()1023 'xd_check=' . $core->getNonce() 1039 1024 ]); 1040 1025 … … 1156 1141 public static function getPF($file) 1157 1142 { 1158 return $GLOBALS['core']->adminurl->get('load.plugin.file', ['pf' => $file]); 1143 $core = self::getCore(); 1144 return $core->adminurl->get('load.plugin.file', ['pf' => $file]); 1159 1145 } 1160 1146 1161 1147 public static function getVF($file) 1162 1148 { 1163 return $GLOBALS['core']->adminurl->get('load.var.file', ['vf' => $file]); 1149 $core = self::getCore(); 1150 return $core->adminurl->get('load.var.file', ['vf' => $file]); 1164 1151 } 1165 1152
Note: See TracChangeset
for help on using the changeset viewer.