Changeset 2715:a87ddf7dbfb5 for inc
- Timestamp:
- 05/20/14 08:39:33 (11 years ago)
- Branch:
- twig
- Parents:
- 2683:fb8aa74332f1 (diff), 2714:eed2e5727277 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- inc
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/prepend.php
r2613 r2715 4 4 # This file is part of Dotclear 2. 5 5 # 6 # Copyright (c) 2003-201 1Olivier Meunier & Association Dotclear6 # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear 7 7 # Licensed under the GPL version 2.0 license. 8 8 # See LICENSE file or … … 174 174 */ 175 175 } 176 177 $core->adminurl = new dcAdminURL($core); 178 179 $core->adminurl->register('admin.posts','posts.php'); 180 $core->adminurl->register('admin.post','post.php'); 181 $core->adminurl->register('admin.blog.theme','blog_theme.php'); 182 $core->adminurl->register('admin.blog.pref','blog_pref.php'); 183 $core->adminurl->register('admin.blogs','blogs.php'); 184 $core->adminurl->register('admin.categories','categories.php'); 185 $core->adminurl->register('admin.category','category.php'); 186 $core->adminurl->register('admin.comments','comments.php'); 187 $core->adminurl->register('admin.comments','comment.php'); 188 $core->adminurl->register('admin.help','help.php'); 189 $core->adminurl->register('admin.home','index.php'); 190 $core->adminurl->register('admin.langs','langs.php'); 191 $core->adminurl->register('admin.media','media.php'); 192 $core->adminurl->register('admin.media_item','media_item.php'); 193 $core->adminurl->register('admin.plugins','plugins.php'); 194 $core->adminurl->register('admin.plugin','plugin.php'); 195 $core->adminurl->register('admin.user.preferences','preferences.php'); 196 $core->adminurl->register('admin.user','user.php'); 197 $core->adminurl->register('admin.users','users.php'); 176 198 177 199 if ($core->auth->userID() && $core->blog !== null) -
inc/admin/prepend.php
r2708 r2715 24 24 function dc_load_locales() { 25 25 global $_lang, $core; 26 26 27 27 $_lang = $core->auth->getInfo('user_lang'); 28 28 $_lang = preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$_lang) ? $_lang : 'en'; 29 29 30 30 l10n::lang($_lang); 31 31 if (l10n::set(dirname(__FILE__).'/../../locales/'.$_lang.'/date') === false && $_lang != 'en') { … … 40 40 { 41 41 global $core; 42 42 43 43 $core->auth->user_prefs->addWorkspace('interface'); 44 44 $user_ui_iconset = @$core->auth->user_prefs->interface->iconset; 45 45 if (($user_ui_iconset) && ($img)) { 46 46 $icon = false; 47 if ((preg_match('/^images\/menu\/(.+)$/',$img,$m)) || 47 if ((preg_match('/^images\/menu\/(.+)$/',$img,$m)) || 48 48 (preg_match('/^index\.php\?pf=(.+)$/',$img,$m))) { 49 49 if ($m[1]) { … … 65 65 # We have session information in constants 66 66 $_COOKIE[DC_SESSION_NAME] = DC_AUTH_SESS_ID; 67 67 68 68 if (!$core->auth->checkSession(DC_AUTH_SESS_UID)) { 69 69 throw new Exception('Invalid session data.'); 70 70 } 71 71 72 72 # Check nonce from POST requests 73 73 if (!empty($_POST)) … … 77 77 } 78 78 } 79 79 80 80 if (empty($_SESSION['sess_blog_id'])) { 81 81 throw new Exception('Permission denied.'); 82 82 } 83 83 84 84 # Loading locales 85 85 dc_load_locales(); 86 86 87 87 $core->setBlog($_SESSION['sess_blog_id']); 88 88 if (!$core->blog->id) { … … 100 100 $p[3] = '/'; 101 101 call_user_func_array('setcookie',$p); 102 102 103 103 http::redirect('auth.php'); 104 104 } … … 108 108 ,20); 109 109 } 110 110 111 111 # Check nonce from POST requests 112 112 if (!empty($_POST)) … … 119 119 } 120 120 } 121 122 121 122 123 123 if (!empty($_REQUEST['switchblog']) 124 124 && $core->auth->getPermissions($_REQUEST['switchblog']) !== false) … … 131 131 unset($_SESSION['media_manager_page']); 132 132 } 133 133 134 134 # Removing switchblog from URL 135 135 $redir = $_SERVER['REQUEST_URI']; … … 139 139 exit; 140 140 } 141 141 142 142 # Check blog to use and log out if no result 143 143 if (isset($_SESSION['sess_blog_id'])) … … 154 154 } 155 155 } 156 156 157 157 # Loading locales 158 158 dc_load_locales(); 159 159 160 160 if (isset($_SESSION['sess_blog_id'])) { 161 161 $core->setBlog($_SESSION['sess_blog_id']); … … 165 165 } 166 166 167 /* 167 /* 168 168 # Check add to my fav fired 169 169 if (!empty($_REQUEST['add-favorite'])) { … … 206 206 } 207 207 unset($f); 208 208 209 209 if (($hfiles = @scandir($locales_root.$_lang.'/help')) !== false) 210 210 { … … 227 227 # [] : Title, URL, small icon, large icon, permissions, id, class 228 228 # NB : '*' in permissions means any, null means super admin only 229 230 229 230 231 231 # Menus creation 232 232 $_menu = new ArrayObject(); … … 246 246 } 247 247 248 248 249 249 # Set menu titles 250 250 251 251 $_menu['System']->title = __('System settings'); 252 252 $_menu['Blog']->title = __('Blog'); … … 278 278 preg_match('/post.php$/',$_SERVER['REQUEST_URI']), 279 279 $core->auth->check('usage,contentadmin',$core->blog->id)); 280 280 281 281 $_menu['System']->prependItem(__('Update'),'update.php','images/menu/update.png', 282 282 preg_match('/update.php(\?.*)?$/',$_SERVER['REQUEST_URI']), … … 301 301 } 302 302 303 # Add admin default templates path 304 $core->tpl->getLoader()->addPath(dirname(__FILE__).'/default-templates'); 305 # Set admin context 306 $_ctx = new dcAdminContext($core); 307 $core->tpl->addExtension($_ctx); 308 309 # --BEHAVIOR-- adminPrepend 310 $core->callBehavior('adminPrepend',$core,$_ctx); 311 ?> -
inc/core/class.dc.core.php
r2683 r2715 901 901 'edit_size' => 24, 902 902 'enable_wysiwyg' => true, 903 'editor' => 'dcLegacyEditor', 903 904 'post_format' => 'wiki' 904 905 ); -
inc/core/class.dc.core.php
r2706 r2715 39 39 public $rest; ///< <b>dcRestServer</b> dcRestServer object 40 40 public $log; ///< <b>dcLog</b> dcLog object 41 public $tpl; ///< <b>Twig_Environment</b> Twig_Environment object 41 42 public $stime; ///< <b>float</b> starting time 42 43 43 44 private $versions = null; 44 45 private $formaters = array(); 45 46 private $behaviors = array(); 46 47 private $post_types = array(); 47 48 48 49 /** 49 50 dcCore constructor inits everything related to Dotclear. It takes arguments 50 51 to init database connection. 51 52 52 53 @param driver <b>string</b> Database driver name 53 54 @param host <b>string</b> Database hostname … … 67 68 68 69 $this->con = dbLayer::init($driver,$host,$db,$user,$password,$persist); 69 70 70 71 # define weak_locks for mysql 71 72 if ($this->con instanceof mysqlConnection) { … … 74 75 mysqliConnection::$weak_locks = true; 75 76 } 76 77 77 78 # define searchpath for postgresql 78 79 if ($this->con instanceof pgsqlConnection) … … 86 87 } 87 88 } 88 89 89 90 $this->prefix = $prefix; 90 91 91 92 $this->error = new dcError(); 92 93 $this->auth = $this->authInstance(); 93 94 $this->session = new sessionDB($this->con,$this->prefix.'session',DC_SESSION_NAME,'',null,DC_ADMIN_SSL); 94 95 $this->url = new dcUrlHandlers(); 95 96 96 97 $this->plugins = new dcPlugins($this); 97 98 98 99 $this->rest = new dcRestServer($this); 99 100 100 101 $this->meta = new dcMeta($this); 101 102 102 103 $this->log = new dcLog($this); 103 104 } 104 105 105 106 private function authInstance() 106 107 { … … 112 113 $c = DC_AUTH_CLASS; 113 114 } 114 115 115 116 if (!class_exists($c)) { 116 117 throw new Exception('Authentication class '.$c.' does not exist.'); 117 118 } 118 119 119 120 if ($c != 'dcAuth' && !is_subclass_of($c,'dcAuth')) { 120 121 throw new Exception('Authentication class '.$c.' does not inherit dcAuth.'); 121 122 } 122 123 123 124 return new $c($this); 124 125 } 125 126 126 127 /** 128 Create template environment (Twig_Environment instance) 129 130 default-templates path must be added from admin|public/prepend.php with: 131 $core->tpl->getLoader()->addPath('PATH_TO/default-templates'); 132 Selected theme path must be added with: 133 $core->tpl->getLoader()->prependPath('PATH_TO/MY_THEME'); 134 */ 135 public function loadTemplateEnvironment() 136 { 137 $cache_dir = path::real(DC_TPL_CACHE.'/twtpl',false); 138 if (!is_dir($cache_dir)) { 139 try { 140 files::makeDir($cache_dir); 141 } catch (Exception $e) { 142 $cache_dir = false; 143 } 144 } 145 146 $this->tpl = new Twig_Environment( 147 new Twig_Loader_Filesystem(dirname(__FILE__).'/../swf'), 148 array( 149 'auto_reload' => true, 150 'autoescape' => false, 151 'base_template_class' => 'Twig_Template', 152 'cache' => $cache_dir, 153 'charset' => 'UTF-8', 154 'debug' => DC_DEBUG, 155 'optimizations' => -1, 156 'strict_variables' => 0 //DC_DEBUG // Please fix undefined variables! 157 ) 158 ); 159 $this->tpl->addExtension(new dcFormExtension($this)); 160 $this->tpl->addExtension(new dcTabExtension($this)); 161 } 162 127 163 /// @name Blog init methods 128 164 //@{ 129 165 /** 130 166 Sets a blog to use in <var>blog</var> property. 131 167 132 168 @param id <b>string</b> Blog ID 133 169 */ … … 136 172 $this->blog = new dcBlog($this, $id); 137 173 } 138 174 139 175 /** 140 176 Unsets <var>blog</var> property. … … 145 181 } 146 182 //@} 147 148 183 184 149 185 /// @name Blog status methods 150 186 //@{ 151 187 /** 152 188 Returns an array of available blog status codes and names. 153 189 154 190 @return <b>array</b> Simple array with codes in keys and names in value 155 191 */ … … 162 198 ); 163 199 } 164 200 165 201 /** 166 202 Returns a blog status name given to a code. This is intended to be 167 203 human-readable and will be translated, so never use it for tests. 168 204 If status code does not exist, returns <i>offline</i>. 169 205 170 206 @param s <b>integer</b> Status code 171 207 @return <b>string</b> Blog status name … … 180 216 } 181 217 //@} 182 218 183 219 /// @name Admin nonce secret methods 184 220 //@{ 185 221 186 222 public function getNonce() 187 223 { 188 224 return crypt::hmac(DC_MASTER_KEY,session_id()); 189 225 } 190 226 191 227 public function checkNonce($secret) 192 228 { … … 194 230 return false; 195 231 } 196 232 197 233 return $secret == crypt::hmac(DC_MASTER_KEY,session_id()); 198 234 } 199 235 200 236 public function formNonce() 201 237 { … … 203 239 return; 204 240 } 205 241 206 242 return form::hidden(array('xd_check'),$this->getNonce()); 207 243 } 208 244 //@} 209 245 210 246 /// @name Text Formatters methods 211 247 //@{ … … 225 261 } 226 262 } 227 263 228 264 /// @name Text Formatters methods 229 265 //@{ … … 232 268 transform text. The function must be a valid callback and takes one 233 269 argument: the string to transform. It returns the transformed string. 234 270 235 271 @param name <b>string</b> Formater name 236 272 @param func <b>callback</b> Function to use, must be a valid and callable callback … … 256 292 return $editors; 257 293 } 258 294 259 295 /** 260 296 Returns formaters list by editor 261 297 262 298 @param editor_id <b>string</b> Editor id (dcLegacyEditor, dcCKEditor, ...) 263 299 @return <b>array</b> An array of formaters names in values. … … 288 324 return $formaters_list; 289 325 } 290 326 291 327 /** 292 328 If <var>$name</var> is a valid formater, it returns <var>$str</var> 293 329 transformed using that formater. 294 330 295 331 @param editor_id <b>string</b> Editor id (dcLegacyEditor, dcCKEditor, ...) 296 332 @param name <b>string</b> Formater name … … 303 339 return call_user_func($this->formaters[$editor_id][$name],$str); 304 340 } 305 341 306 342 return $str; 307 343 } 308 344 //@} 309 345 310 346 /** 311 347 If <var>$name</var> is a valid formater, it returns <var>$str</var> … … 322 358 //@} 323 359 324 360 325 361 /// @name Behaviors methods 326 362 //@{ … … 328 364 Adds a new behavior to behaviors stack. <var>$func</var> must be a valid 329 365 and callable callback. 330 366 331 367 @param behavior <b>string</b> Behavior name 332 368 @param func <b>callback</b> Function to call … … 338 374 } 339 375 } 340 376 341 377 /** 342 378 Tests if a particular behavior exists in behaviors stack. 343 379 344 380 @param behavior <b>string</b> Behavior name 345 381 @return <b>boolean</b> … … 349 385 return isset($this->behaviors[$behavior]); 350 386 } 351 387 352 388 /** 353 389 Get behaviors stack (or part of). 354 390 355 391 @param behavior <b>string</b> Behavior name 356 392 @return <b>array</b> … … 359 395 { 360 396 if (empty($this->behaviors)) return null; 361 397 362 398 if ($behavior == '') { 363 399 return $this->behaviors; … … 365 401 return $this->behaviors[$behavior]; 366 402 } 367 403 368 404 return array(); 369 405 } 370 406 371 407 /** 372 408 Calls every function in behaviors stack for a given behavior and returns 373 409 concatened result of each function. 374 410 375 411 Every parameters added after <var>$behavior</var> will be pass to 376 412 behavior calls. 377 413 378 414 @param behavior <b>string</b> Behavior name 379 415 @return <b>string</b> Behavior concatened result … … 385 421 $args = func_get_args(); 386 422 array_shift($args); 387 423 388 424 $res = ''; 389 425 390 426 foreach ($this->behaviors[$behavior] as $f) { 391 427 $res .= call_user_func_array($f,$args); 392 428 } 393 429 394 430 return $res; 395 431 } 396 432 } 397 433 //@} 398 434 399 435 /// @name Post types URLs management 400 436 //@{ … … 404 440 $type = 'post'; 405 441 } 406 442 407 443 $url = sprintf($this->post_types[$type]['admin_url'],$post_id); 408 444 return $escaped ? html::escapeURL($url) : $url; 409 445 } 410 446 411 447 public function getPostPublicURL($type,$post_url,$escaped=true) 412 448 { … … 414 450 $type = 'post'; 415 451 } 416 452 417 453 $url = sprintf($this->post_types[$type]['public_url'],$post_url); 418 454 return $escaped ? html::escapeURL($url) : $url; 419 455 } 420 456 421 457 public function setPostType($type,$admin_url,$public_url,$label='') 422 458 { … … 427 463 ); 428 464 } 429 465 430 466 public function getPostTypes() 431 467 { … … 433 469 } 434 470 //@} 435 471 436 472 /// @name Versions management methods 437 473 //@{ 438 474 /** 439 475 Returns a given $module version. 440 476 441 477 @param module <b>string</b> Module name 442 478 @return <b>string</b> Module version … … 449 485 $strReq = 'SELECT module, version FROM '.$this->prefix.'version'; 450 486 $rs = $this->con->select($strReq); 451 487 452 488 while ($rs->fetch()) { 453 489 $this->versions[$rs->module] = $rs->version; 454 490 } 455 491 } 456 492 457 493 if (isset($this->versions[$module])) { 458 494 return $this->versions[$module]; … … 461 497 } 462 498 } 463 499 464 500 /** 465 501 Sets $version to given $module. 466 502 467 503 @param module <b>string</b> Module name 468 504 @param version <b>string</b> Module version … … 471 507 { 472 508 $cur_version = $this->getVersion($module); 473 509 474 510 $cur = $this->con->openCursor($this->prefix.'version'); 475 511 $cur->module = (string) $module; 476 512 $cur->version = (string) $version; 477 513 478 514 if ($cur_version === null) { 479 515 $cur->insert(); … … 481 517 $cur->update("WHERE module='".$this->con->escape($module)."'"); 482 518 } 483 519 484 520 $this->versions[$module] = $version; 485 521 } 486 522 487 523 /** 488 524 Removes given $module version entry. 489 525 490 526 @param module <b>string</b> Module name 491 527 */ … … 495 531 'DELETE FROM '.$this->prefix.'version '. 496 532 "WHERE module = '".$this->con->escape($module)."' "; 497 533 498 534 $this->con->execute($strReq); 499 535 500 536 if (is_array($this->versions)) { 501 537 unset($this->versions[$module]); 502 538 } 503 539 } 504 540 505 541 //@} 506 542 507 543 /// @name Users management methods 508 544 //@{ 509 545 /** 510 546 Returns a user by its ID. 511 547 512 548 @param id <b>string</b> User ID 513 549 @return <b>record</b> … … 516 552 { 517 553 $params['user_id'] = $id; 518 554 519 555 return $this->getUsers($params); 520 556 } 521 557 522 558 /** 523 559 Returns a users list. <b>$params</b> is an array with the following 524 560 optionnal parameters: 525 561 526 562 - <var>q</var>: search string (on user_id, user_name, user_firstname) 527 563 - <var>user_id</var>: user ID 528 564 - <var>order</var>: ORDER BY clause (default: user_id ASC) 529 565 - <var>limit</var>: LIMIT clause (should be an array ![limit,offset]) 530 566 531 567 @param params <b>array</b> Parameters 532 568 @param count_only <b>boolean</b> Only counts results … … 553 589 'WHERE NULL IS NULL '; 554 590 } 555 591 556 592 if (!empty($params['q'])) { 557 593 $q = $this->con->escape(str_replace('*','%',strtolower($params['q']))); … … 562 598 ') '; 563 599 } 564 600 565 601 if (!empty($params['user_id'])) { 566 602 $strReq .= "AND U.user_id = '".$this->con->escape($params['user_id'])."' "; 567 603 } 568 604 569 605 if (!$count_only) { 570 606 $strReq .= 'GROUP BY U.user_id,user_super,user_status,user_pwd,user_change_pwd,'. 571 607 'user_name,user_firstname,user_displayname,user_email,user_url,'. 572 608 'user_desc, user_lang,user_tz,user_post_status,user_options '; 573 609 574 610 if (!empty($params['order']) && !$count_only) { 575 611 $strReq .= 'ORDER BY '.$this->con->escape($params['order']).' '; … … 578 614 } 579 615 } 580 616 581 617 if (!$count_only && !empty($params['limit'])) { 582 618 $strReq .= $this->con->limit($params['limit']); 583 619 } 584 620 585 621 $rs = $this->con->select($strReq); 586 622 $rs->extend('rsExtUser'); 587 623 return $rs; 588 624 } 589 625 590 626 /** 591 627 Create a new user. Takes a cursor as input and returns the new user ID. 592 628 593 629 @param cur <b>cursor</b> User cursor 594 630 @return <b>string</b> … … 599 635 throw new Exception(__('You are not an administrator')); 600 636 } 601 637 602 638 if ($cur->user_id == '') { 603 639 throw new Exception(__('No user ID given')); 604 640 } 605 641 606 642 if ($cur->user_pwd == '') { 607 643 throw new Exception(__('No password given')); 608 644 } 609 645 610 646 $this->getUserCursor($cur); 611 647 612 648 if ($cur->user_creadt === null) { 613 649 $cur->user_creadt = date('Y-m-d H:i:s'); 614 650 } 615 651 616 652 $cur->insert(); 617 653 618 654 $this->auth->afterAddUser($cur); 619 655 620 656 return $cur->user_id; 621 657 } 622 658 623 659 /** 624 660 Updates an existing user. Returns the user ID. 625 661 626 662 @param id <b>string</b> User ID 627 663 @param cur <b>cursor</b> User cursor … … 631 667 { 632 668 $this->getUserCursor($cur); 633 669 634 670 if (($cur->user_id !== null || $id != $this->auth->userID()) && 635 671 !$this->auth->isSuperAdmin()) { 636 672 throw new Exception(__('You are not an administrator')); 637 673 } 638 674 639 675 $cur->update("WHERE user_id = '".$this->con->escape($id)."' "); 640 676 641 677 $this->auth->afterUpdUser($id,$cur); 642 678 643 679 if ($cur->user_id !== null) { 644 680 $id = $cur->user_id; 645 681 } 646 682 647 683 # Updating all user's blogs 648 684 $rs = $this->con->select( … … 650 686 "WHERE user_id = '".$this->con->escape($id)."' " 651 687 ); 652 688 653 689 while ($rs->fetch()) { 654 690 $b = new dcBlog($this,$rs->blog_id); … … 656 692 unset($b); 657 693 } 658 694 659 695 return $id; 660 696 } 661 697 662 698 /** 663 699 Deletes a user. 664 700 665 701 @param id <b>string</b> User ID 666 702 */ … … 670 706 throw new Exception(__('You are not an administrator')); 671 707 } 672 708 673 709 if ($id == $this->auth->userID()) { 674 710 return; 675 711 } 676 712 677 713 $rs = $this->getUser($id); 678 714 679 715 if ($rs->nb_post > 0) { 680 716 return; 681 717 } 682 718 683 719 $strReq = 'DELETE FROM '.$this->prefix.'user '. 684 720 "WHERE user_id = '".$this->con->escape($id)."' "; 685 721 686 722 $this->con->execute($strReq); 687 723 688 724 $this->auth->afterDelUser($id); 689 725 } 690 726 691 727 /** 692 728 Checks whether a user exists. 693 729 694 730 @param id <b>string</b> User ID 695 731 @return <b>boolean</b> … … 700 736 'FROM '.$this->prefix.'user '. 701 737 "WHERE user_id = '".$this->con->escape($id)."' "; 702 738 703 739 $rs = $this->con->select($strReq); 704 740 705 741 return !$rs->isEmpty(); 706 742 } 707 743 708 744 /** 709 745 Returns all user permissions as an array which looks like: 710 746 711 747 - [blog_id] 712 748 - [name] => Blog name 713 749 - [url] => Blog URL 714 750 - [p] 715 - [permission] => true751 - [permission] => true 716 752 - ... 717 753 718 754 @param id <b>string</b> User ID 719 755 @return <b>array</b> … … 725 761 'INNER JOIN '.$this->prefix.'blog B ON P.blog_id = B.blog_id '. 726 762 "WHERE user_id = '".$this->con->escape($id)."' "; 727 763 728 764 $rs = $this->con->select($strReq); 729 765 730 766 $res = array(); 731 767 732 768 while ($rs->fetch()) 733 769 { … … 738 774 ); 739 775 } 740 776 741 777 return $res; 742 778 } 743 779 744 780 /** 745 781 Sets user permissions. The <var>$perms</var> array looks like: 746 782 747 783 - [blog_id] => '|perm1|perm2|' 748 784 - ... 749 785 750 786 @param id <b>string</b> User ID 751 787 @param perms <b>array</b> Permissions array … … 756 792 throw new Exception(__('You are not an administrator')); 757 793 } 758 794 759 795 $strReq = 'DELETE FROM '.$this->prefix.'permissions '. 760 796 "WHERE user_id = '".$this->con->escape($id)."' "; 761 797 762 798 $this->con->execute($strReq); 763 799 764 800 foreach ($perms as $blog_id => $p) { 765 801 $this->setUserBlogPermissions($id, $blog_id, $p, false); 766 802 } 767 803 } 768 804 769 805 /** 770 806 Sets user permissions for a given blog. <var>$perms</var> is an array with 771 807 permissions in values 772 808 773 809 @param id <b>string</b> User ID 774 810 @param blog_id <b>string</b> Blog ID … … 781 817 throw new Exception(__('You are not an administrator')); 782 818 } 783 819 784 820 $no_perm = empty($perms); 785 821 786 822 $perms = '|'.implode('|',array_keys($perms)).'|'; 787 823 788 824 $cur = $this->con->openCursor($this->prefix.'permissions'); 789 825 790 826 $cur->user_id = (string) $id; 791 827 $cur->blog_id = (string) $blog_id; 792 828 $cur->permissions = $perms; 793 829 794 830 if ($delete_first || $no_perm) 795 831 { … … 797 833 "WHERE blog_id = '".$this->con->escape($blog_id)."' ". 798 834 "AND user_id = '".$this->con->escape($id)."' "; 799 835 800 836 $this->con->execute($strReq); 801 837 } 802 838 803 839 if (!$no_perm) { 804 840 $cur->insert(); 805 841 } 806 842 } 807 843 808 844 /** 809 845 Sets a user default blog. This blog will be selected when user log in. 810 846 811 847 @param id <b>string</b> User ID 812 848 @param blog_id <b>string</b> Blog ID … … 815 851 { 816 852 $cur = $this->con->openCursor($this->prefix.'user'); 817 853 818 854 $cur->user_default_blog = (string) $blog_id; 819 855 820 856 $cur->update("WHERE user_id = '".$this->con->escape($id)."'"); 821 857 } 822 858 823 859 private function getUserCursor($cur) 824 860 { … … 827 863 throw new Exception(__('User ID must contain at least 2 characters using letters, numbers or symbols.')); 828 864 } 829 865 830 866 if ($cur->user_url !== null && $cur->user_url != '') { 831 867 if (!preg_match('|^http(s?)://|',$cur->user_url)) { … … 833 869 } 834 870 } 835 871 836 872 if ($cur->isField('user_pwd')) { 837 873 if (strlen($cur->user_pwd) < 6) { … … 840 876 $cur->user_pwd = crypt::hmac(DC_MASTER_KEY,$cur->user_pwd); 841 877 } 842 878 843 879 if ($cur->user_lang !== null && !preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$cur->user_lang)) { 844 880 throw new Exception(__('Invalid user language code')); 845 881 } 846 882 847 883 if ($cur->user_upddt === null) { 848 884 $cur->user_upddt = date('Y-m-d H:i:s'); 849 885 } 850 886 851 887 if ($cur->user_options !== null) { 852 888 $cur->user_options = serialize((array) $cur->user_options); 853 889 } 854 890 } 855 891 856 892 /** 857 893 Returns user default settings in an associative array with setting names in 858 894 keys. 859 895 860 896 @return <b>array</b> 861 897 */ … … 870 906 } 871 907 //@} 872 908 873 909 /// @name Blog management methods 874 910 //@{ 875 911 /** 876 912 Returns all blog permissions (users) as an array which looks like: 877 913 878 914 - [user_id] 879 915 - [name] => User name … … 882 918 - [super] => (true|false) super admin 883 919 - [p] 884 - [permission] => true920 - [permission] => true 885 921 - ... 886 922 887 923 @param id <b>string</b> Blog ID 888 924 @param with_super <b>boolean</b> Includes super admins in result … … 897 933 'JOIN '.$this->prefix.'permissions P ON U.user_id = P.user_id '. 898 934 "WHERE blog_id = '".$this->con->escape($id)."' "; 899 935 900 936 if ($with_super) { 901 937 $strReq .= … … 906 942 'WHERE user_super = 1 '; 907 943 } 908 944 909 945 $rs = $this->con->select($strReq); 910 946 911 947 $res = array(); 912 948 913 949 while ($rs->fetch()) 914 950 { … … 922 958 ); 923 959 } 924 960 925 961 return $res; 926 962 } 927 963 928 964 /** 929 965 Returns a blog of given ID. 930 966 931 967 @param id <b>string</b> Blog ID 932 968 @return <b>record</b> … … 935 971 { 936 972 $blog = $this->getBlogs(array('blog_id'=>$id)); 937 973 938 974 if ($blog->isEmpty()) { 939 975 return false; 940 976 } 941 977 942 978 return $blog; 943 979 } 944 980 945 981 /** 946 982 Returns a record of blogs. <b>$params</b> is an array with the following 947 983 optionnal parameters: 948 984 949 985 - <var>blog_id</var>: Blog ID 950 986 - <var>q</var>: Search string on blog_id, blog_name and blog_url 951 987 - <var>limit</var>: limit results 952 988 953 989 @param params <b>array</b> Parameters 954 990 @param count_only <b>boolean</b> Count only results … … 959 995 $join = ''; // %1$s 960 996 $where = ''; // %2$s 961 997 962 998 if ($count_only) 963 999 { … … 977 1013 'WHERE NULL IS NULL '. 978 1014 '%2$s '; 979 1015 980 1016 if (!empty($params['order'])) { 981 1017 $strReq .= 'ORDER BY '.$this->con->escape($params['order']).' '; … … 983 1019 $strReq .= 'ORDER BY B.blog_id ASC '; 984 1020 } 985 1021 986 1022 if (!empty($params['limit'])) { 987 1023 $strReq .= $this->con->limit($params['limit']); 988 1024 } 989 1025 } 990 1026 991 1027 if ($this->auth->userID() && !$this->auth->isSuperAdmin()) 992 1028 { … … 999 1035 $where = 'AND blog_status IN (1,0) '; 1000 1036 } 1001 1037 1002 1038 if (!empty($params['blog_id'])) { 1003 1039 $where .= "AND B.blog_id = '".$this->con->escape($params['blog_id'])."' "; 1004 1040 } 1005 1041 1006 1042 if (!empty($params['q'])) { 1007 1043 $params['q'] = strtolower(str_replace('*','%',$params['q'])); … … 1013 1049 ') '; 1014 1050 } 1015 1051 1016 1052 $strReq = sprintf($strReq,$join,$where); 1017 1053 return $this->con->select($strReq); 1018 1054 } 1019 1055 1020 1056 /** 1021 1057 Creates a new blog. 1022 1058 1023 1059 @param cur <b>cursor</b> Blog cursor 1024 1060 */ … … 1028 1064 throw new Exception(__('You are not an administrator')); 1029 1065 } 1030 1066 1031 1067 $this->getBlogCursor($cur); 1032 1068 1033 1069 $cur->blog_creadt = date('Y-m-d H:i:s'); 1034 1070 $cur->blog_upddt = date('Y-m-d H:i:s'); 1035 1071 $cur->blog_uid = md5(uniqid()); 1036 1072 1037 1073 $cur->insert(); 1038 1074 } 1039 1075 1040 1076 /** 1041 1077 Updates a given blog. 1042 1078 1043 1079 @param id <b>string</b> Blog ID 1044 1080 @param cur <b>cursor</b> Blog cursor … … 1047 1083 { 1048 1084 $this->getBlogCursor($cur); 1049 1085 1050 1086 $cur->blog_upddt = date('Y-m-d H:i:s'); 1051 1087 1052 1088 $cur->update("WHERE blog_id = '".$this->con->escape($id)."'"); 1053 1089 } 1054 1090 1055 1091 private function getBlogCursor($cur) 1056 1092 { … … 1058 1094 && !preg_match('/^[A-Za-z0-9._-]{2,}$/',$cur->blog_id)) || 1059 1095 (!$cur->blog_id)) { 1060 throw new Exception(__('Blog ID must contain at least 2 characters using letters, numbers or symbols.')); 1061 } 1062 1096 throw new Exception(__('Blog ID must contain at least 2 characters using letters, numbers or symbols.')); 1097 } 1098 1063 1099 if (($cur->blog_name !== null && $cur->blog_name == '') || 1064 1100 (!$cur->blog_name)) { 1065 1101 throw new Exception(__('No blog name')); 1066 1102 } 1067 1103 1068 1104 if (($cur->blog_url !== null && $cur->blog_url == '') || 1069 1105 (!$cur->blog_url)) { 1070 1106 throw new Exception(__('No blog URL')); 1071 1107 } 1072 1108 1073 1109 if ($cur->blog_desc !== null) { 1074 1110 $cur->blog_desc = html::clean($cur->blog_desc); 1075 1111 } 1076 1112 } 1077 1113 1078 1114 /** 1079 1115 Removes a given blog. 1080 1116 @warning This will remove everything related to the blog (posts, 1081 1117 categories, comments, links...) 1082 1118 1083 1119 @param id <b>string</b> Blog ID 1084 1120 */ … … 1088 1124 throw new Exception(__('You are not an administrator')); 1089 1125 } 1090 1126 1091 1127 $strReq = 'DELETE FROM '.$this->prefix.'blog '. 1092 1128 "WHERE blog_id = '".$this->con->escape($id)."' "; 1093 1129 1094 1130 $this->con->execute($strReq); 1095 1131 } 1096 1132 1097 1133 /** 1098 1134 Checks if a blog exist. 1099 1135 1100 1136 @param id <b>string</b> Blog ID 1101 1137 @return <b>boolean</b> … … 1106 1142 'FROM '.$this->prefix.'blog '. 1107 1143 "WHERE blog_id = '".$this->con->escape($id)."' "; 1108 1144 1109 1145 $rs = $this->con->select($strReq); 1110 1146 1111 1147 return !$rs->isEmpty(); 1112 1148 } 1113 1149 1114 1150 /** 1115 1151 Count posts on a blog 1116 1152 1117 1153 @param id <b>string</b> Blog ID 1118 1154 @param type <b>string</b> Post type … … 1124 1160 'FROM '.$this->prefix.'post '. 1125 1161 "WHERE blog_id = '".$this->con->escape($id)."' "; 1126 1162 1127 1163 if ($type) { 1128 1164 $strReq .= "AND post_type = '".$this->con->escape($type)."' "; 1129 1165 } 1130 1166 1131 1167 return $this->con->select($strReq)->f(0); 1132 1168 } 1133 1169 //@} 1134 1170 1135 1171 /// @name HTML Filter methods 1136 1172 //@{ … … 1139 1175 tidy extension is present). If <b>enable_html_filter</b> blog setting is 1140 1176 false, returns not filtered string. 1141 1177 1142 1178 @param str <b>string</b> String to filter 1143 1179 @return <b>string</b> Filtered string. … … 1148 1184 return $str; 1149 1185 } 1150 1186 1151 1187 $filter = new htmlFilter; 1152 1188 $str = trim($filter->apply($str)); … … 1154 1190 } 1155 1191 //@} 1156 1192 1157 1193 /// @name wiki2xhtml methods 1158 1194 //@{ … … 1161 1197 $this->wiki2xhtml = new wiki2xhtml; 1162 1198 } 1163 1199 1164 1200 /** 1165 1201 Returns a transformed string with wiki2xhtml. 1166 1202 1167 1203 @param str <b>string</b> String to transform 1168 1204 @return <b>string</b> Transformed string … … 1175 1211 return $this->wiki2xhtml->transform($str); 1176 1212 } 1177 1213 1178 1214 /** 1179 1215 Inits <var>wiki2xhtml</var> property for blog post. … … 1182 1218 { 1183 1219 $this->initWiki(); 1184 1220 1185 1221 $this->wiki2xhtml->setOpts(array( 1186 1222 'active_title' => 1, … … 1214 1250 'note_str' => '<div class="footnotes"><h4>Notes</h4>%s</div>' 1215 1251 )); 1216 1252 1217 1253 $this->wiki2xhtml->registerFunction('url:post',array($this,'wikiPostLink')); 1218 1254 1219 1255 # --BEHAVIOR-- coreWikiPostInit 1220 1256 $this->callBehavior('coreInitWikiPost',$this->wiki2xhtml); 1221 1257 } 1222 1258 1223 1259 /** 1224 1260 Inits <var>wiki2xhtml</var> property for simple blog comment (basic syntax). … … 1227 1263 { 1228 1264 $this->initWiki(); 1229 1265 1230 1266 $this->wiki2xhtml->setOpts(array( 1231 1267 'active_title' => 0, … … 1256 1292 'active_fr_syntax' => 0 1257 1293 )); 1258 1294 1259 1295 # --BEHAVIOR-- coreInitWikiSimpleComment 1260 1296 $this->callBehavior('coreInitWikiSimpleComment',$this->wiki2xhtml); 1261 1297 } 1262 1298 1263 1299 /** 1264 1300 Inits <var>wiki2xhtml</var> property for blog comment. … … 1267 1303 { 1268 1304 $this->initWiki(); 1269 1305 1270 1306 $this->wiki2xhtml->setOpts(array( 1271 1307 'active_title' => 0, … … 1296 1332 'active_fr_syntax' => 0 1297 1333 )); 1298 1334 1299 1335 # --BEHAVIOR-- coreInitWikiComment 1300 1336 $this->callBehavior('coreInitWikiComment',$this->wiki2xhtml); 1301 1337 } 1302 1338 1303 1339 public function wikiPostLink($url,$content) 1304 1340 { 1305 if (!($this->blog instanceof dcBlog)) { 1341 if (!($this->blog instanceof dcBlog)) { 1306 1342 return array(); 1307 1343 } 1308 1344 1309 1345 $post_id = abs((integer) substr($url,5)); 1310 1346 if (!$post_id) { 1311 1347 return array(); 1312 1348 } 1313 1349 1314 1350 $post = $this->blog->getPosts(array('post_id'=>$post_id)); 1315 1351 if ($post->isEmpty()) { 1316 1352 return array(); 1317 1353 } 1318 1354 1319 1355 $res = array('url' => $post->getURL()); 1320 1356 $post_title = $post->post_title; 1321 1357 1322 1358 if ($content != $url) { 1323 1359 $res['title'] = html::escapeHTML($post->post_title); 1324 1360 } 1325 1361 1326 1362 if ($content == '' || $content == $url) { 1327 1363 $res['content'] = html::escapeHTML($post->post_title); 1328 1364 } 1329 1365 1330 1366 if ($post->post_lang) { 1331 1367 $res['lang'] = $post->post_lang; 1332 1368 } 1333 1369 1334 1370 return $res; 1335 1371 } 1336 1372 //@} 1337 1373 1338 1374 /// @name Maintenance methods 1339 1375 //@{ … … 1341 1377 Creates default settings for active blog. Optionnal parameter 1342 1378 <var>defaults</var> replaces default params while needed. 1343 1379 1344 1380 @param defaults <b>array</b> Default parameters 1345 1381 */ … … 1426 1462 ); 1427 1463 } 1428 1464 1429 1465 $settings = new dcSettings($this,null); 1430 1466 $settings->addNamespace('system'); 1431 1467 1432 1468 foreach ($defaults as $v) { 1433 1469 $settings->system->put($v[0],$v[2],$v[1],$v[3],false,true); 1434 1470 } 1435 1471 } 1436 1472 1437 1473 /** 1438 1474 Recreates entries search engine index. 1439 1475 1440 1476 @param start <b>integer</b> Start entry index 1441 1477 @param limit <b>integer</b> Number of entry to index 1442 1478 1443 1479 @return <b>integer</b> <var>$start</var> and <var>$limit</var> sum 1444 1480 */ … … 1449 1485 $rs = $this->con->select($strReq); 1450 1486 $count = $rs->f(0); 1451 1487 1452 1488 $strReq = 'SELECT post_id, post_title, post_excerpt_xhtml, post_content_xhtml '. 1453 1489 'FROM '.$this->prefix.'post '; 1454 1490 1455 1491 if ($start !== null && $limit !== null) { 1456 1492 $strReq .= $this->con->limit($start,$limit); 1457 1493 } 1458 1494 1459 1495 $rs = $this->con->select($strReq,true); 1460 1496 1461 1497 $cur = $this->con->openCursor($this->prefix.'post'); 1462 1498 1463 1499 while ($rs->fetch()) 1464 1500 { 1465 1501 $words = $rs->post_title.' '. $rs->post_excerpt_xhtml.' '. 1466 1502 $rs->post_content_xhtml; 1467 1503 1468 1504 $cur->post_words = implode(' ',text::splitWords($words)); 1469 1505 $cur->update('WHERE post_id = '.(integer) $rs->post_id); 1470 1506 $cur->clean(); 1471 1507 } 1472 1508 1473 1509 if ($start+$limit > $count) { 1474 1510 return null; … … 1476 1512 return $start+$limit; 1477 1513 } 1478 1514 1479 1515 /** 1480 1516 Recreates comments search engine index. 1481 1517 1482 1518 @param start <b>integer</b> Start comment index 1483 1519 @param limit <b>integer</b> Number of comments to index 1484 1520 1485 1521 @return <b>integer</b> <var>$start</var> and <var>$limit</var> sum 1486 1522 */ … … 1491 1527 $rs = $this->con->select($strReq); 1492 1528 $count = $rs->f(0); 1493 1529 1494 1530 $strReq = 'SELECT comment_id, comment_content '. 1495 1531 'FROM '.$this->prefix.'comment '; 1496 1532 1497 1533 if ($start !== null && $limit !== null) { 1498 1534 $strReq .= $this->con->limit($start,$limit); 1499 1535 } 1500 1536 1501 1537 $rs = $this->con->select($strReq); 1502 1538 1503 1539 $cur = $this->con->openCursor($this->prefix.'comment'); 1504 1540 1505 1541 while ($rs->fetch()) 1506 1542 { … … 1509 1545 $cur->clean(); 1510 1546 } 1511 1547 1512 1548 if ($start+$limit > $count) { 1513 1549 return null; … … 1515 1551 return $start+$limit; 1516 1552 } 1517 1553 1518 1554 /** 1519 1555 Reinits nb_comment and nb_trackback in post table. … … 1521 1557 public function countAllComments() 1522 1558 { 1523 1559 1524 1560 $updCommentReq = 'UPDATE '.$this->prefix.'post P '. 1525 1561 'SET nb_comment = ('. … … 1537 1573 $this->con->execute($updTrackbackReq); 1538 1574 } 1539 1575 1540 1576 /** 1541 1577 Empty templates cache directory … … 1550 1586 /** 1551 1587 Return elapsed time since script has been started 1552 @param 1553 1554 @return <b>float</b> 1588 @param $mtime <b>float</b> timestamp (microtime format) to evaluate delta from 1589 current time is taken if null 1590 @return <b>float</b> elapsed time 1555 1591 */ 1556 1592 public function getElapsedTime ($mtime=null) { -
inc/prepend.php
r2683 r2715 78 78 $__autoload['context'] = dirname(__FILE__).'/public/lib.tpl.context.php'; 79 79 $__autoload['dcUrlHandlers'] = dirname(__FILE__).'/public/lib.urlhandlers.php'; 80 $__autoload['dcAdminURL'] = dirname(__FILE__).'/admin/lib.dc.adminurl.php'; 80 81 $__autoload['dcPostsActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcactionposts.php'; 81 82 $__autoload['dcCommentsActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcactioncomments.php'; -
inc/prepend.php
r2711 r2715 15 15 16 16 /* ------------------------------------------------------------------------------------------- */ 17 # ClearBricks, DotClear classes auto-loader17 # ClearBricks, Twig, DotClear classes auto-loader 18 18 if (@is_dir('/usr/lib/clearbricks')) { 19 19 define('CLEARBRICKS_PATH','/usr/lib/clearbricks'); 20 } elseif (is_dir(dirname(__FILE__).'/ libs/clearbricks')) {21 define('CLEARBRICKS_PATH',dirname(__FILE__).'/ libs/clearbricks');20 } elseif (is_dir(dirname(__FILE__).'/../vendor/dotclear/clearbricks')) { 21 define('CLEARBRICKS_PATH',dirname(__FILE__).'/../vendor/dotclear/clearbricks'); 22 22 } elseif (isset($_SERVER['CLEARBRICKS_PATH']) && is_dir($_SERVER['CLEARBRICKS_PATH'])) { 23 23 define('CLEARBRICKS_PATH',$_SERVER['CLEARBRICKS_PATH']); … … 29 29 30 30 require CLEARBRICKS_PATH.'/_common.php'; 31 $__autoload['dcCore'] = dirname(__FILE__).'/core/class.dc.core.php'; 32 $__autoload['dcAuth'] = dirname(__FILE__).'/core/class.dc.auth.php'; 33 $__autoload['dcBlog'] = dirname(__FILE__).'/core/class.dc.blog.php'; 34 $__autoload['dcCategories'] = dirname(__FILE__).'/core/class.dc.categories.php'; 35 $__autoload['dcError'] = dirname(__FILE__).'/core/class.dc.error.php'; 36 $__autoload['dcMeta'] = dirname(__FILE__).'/core/class.dc.meta.php'; 37 $__autoload['dcMedia'] = dirname(__FILE__).'/core/class.dc.media.php'; 38 $__autoload['dcPostMedia'] = dirname(__FILE__).'/core/class.dc.postmedia.php'; 39 $__autoload['dcModules'] = dirname(__FILE__).'/core/class.dc.modules.php'; 40 $__autoload['dcPlugins'] = dirname(__FILE__).'/core/class.dc.plugins.php'; 41 $__autoload['dcThemes'] = dirname(__FILE__).'/core/class.dc.themes.php'; 42 $__autoload['dcRestServer'] = dirname(__FILE__).'/core/class.dc.rest.php'; 43 $__autoload['dcNamespace'] = dirname(__FILE__).'/core/class.dc.namespace.php'; 44 $__autoload['dcSettings'] = dirname(__FILE__).'/core/class.dc.settings.php'; 45 $__autoload['dcTrackback'] = dirname(__FILE__).'/core/class.dc.trackback.php'; 46 $__autoload['dcUpdate'] = dirname(__FILE__).'/core/class.dc.update.php'; 47 $__autoload['dcUtils'] = dirname(__FILE__).'/core/class.dc.utils.php'; 48 $__autoload['dcXmlRpc'] = dirname(__FILE__).'/core/class.dc.xmlrpc.php'; 49 $__autoload['dcLog'] = dirname(__FILE__).'/core/class.dc.log.php'; 50 $__autoload['dcWorkspace'] = dirname(__FILE__).'/core/class.dc.workspace.php'; 51 $__autoload['dcPrefs'] = dirname(__FILE__).'/core/class.dc.prefs.php'; 52 $__autoload['dcStore'] = dirname(__FILE__).'/core/class.dc.store.php'; 53 $__autoload['dcStoreReader'] = dirname(__FILE__).'/core/class.dc.store.reader.php'; 54 $__autoload['dcStoreParser'] = dirname(__FILE__).'/core/class.dc.store.parser.php'; 55 $__autoload['dcFavorites'] = dirname(__FILE__).'/admin/class.dc.favorites.php'; 56 57 $__autoload['rsExtPost'] = dirname(__FILE__).'/core/class.dc.rs.extensions.php'; 58 $__autoload['rsExtComment'] = dirname(__FILE__).'/core/class.dc.rs.extensions.php'; 59 $__autoload['rsExtDates'] = dirname(__FILE__).'/core/class.dc.rs.extensions.php'; 60 $__autoload['rsExtUser'] = dirname(__FILE__).'/core/class.dc.rs.extensions.php'; 61 62 $__autoload['dcMenu'] = dirname(__FILE__).'/admin/class.dc.menu.php'; 63 $__autoload['dcPage'] = dirname(__FILE__).'/admin/lib.dc.page.php'; 64 $__autoload['adminGenericList'] = dirname(__FILE__).'/admin/lib.pager.php'; 65 $__autoload['adminPostList'] = dirname(__FILE__).'/admin/lib.pager.php'; 66 $__autoload['adminPostMiniList'] = dirname(__FILE__).'/admin/lib.pager.php'; 67 $__autoload['adminCommentList'] = dirname(__FILE__).'/admin/lib.pager.php'; 68 $__autoload['adminUserList'] = dirname(__FILE__).'/admin/lib.pager.php'; 69 $__autoload['dcPager'] = dirname(__FILE__).'/admin/lib.pager.php'; 70 $__autoload['dcAdminCombos'] = dirname(__FILE__).'/admin/lib.admincombos.php'; 71 $__autoload['adminModulesList'] = dirname(__FILE__).'/admin/lib.moduleslist.php'; 72 $__autoload['adminThemesList'] = dirname(__FILE__).'/admin/lib.moduleslist.php'; 31 $__autoload['dcCore'] = dirname(__FILE__).'/core/class.dc.core.php'; 32 $__autoload['dcAuth'] = dirname(__FILE__).'/core/class.dc.auth.php'; 33 $__autoload['dcBlog'] = dirname(__FILE__).'/core/class.dc.blog.php'; 34 $__autoload['dcCategories'] = dirname(__FILE__).'/core/class.dc.categories.php'; 35 $__autoload['dcError'] = dirname(__FILE__).'/core/class.dc.error.php'; 36 $__autoload['dcMeta'] = dirname(__FILE__).'/core/class.dc.meta.php'; 37 $__autoload['dcMedia'] = dirname(__FILE__).'/core/class.dc.media.php'; 38 $__autoload['dcPostMedia'] = dirname(__FILE__).'/core/class.dc.postmedia.php'; 39 $__autoload['dcModules'] = dirname(__FILE__).'/core/class.dc.modules.php'; 40 $__autoload['dcPlugins'] = dirname(__FILE__).'/core/class.dc.plugins.php'; 41 $__autoload['dcThemes'] = dirname(__FILE__).'/core/class.dc.themes.php'; 42 $__autoload['dcRestServer'] = dirname(__FILE__).'/core/class.dc.rest.php'; 43 $__autoload['dcNamespace'] = dirname(__FILE__).'/core/class.dc.namespace.php'; 44 $__autoload['dcSettings'] = dirname(__FILE__).'/core/class.dc.settings.php'; 45 $__autoload['dcTrackback'] = dirname(__FILE__).'/core/class.dc.trackback.php'; 46 $__autoload['dcUpdate'] = dirname(__FILE__).'/core/class.dc.update.php'; 47 $__autoload['dcUtils'] = dirname(__FILE__).'/core/class.dc.utils.php'; 48 $__autoload['dcXmlRpc'] = dirname(__FILE__).'/core/class.dc.xmlrpc.php'; 49 $__autoload['dcLog'] = dirname(__FILE__).'/core/class.dc.log.php'; 50 $__autoload['dcWorkspace'] = dirname(__FILE__).'/core/class.dc.workspace.php'; 51 $__autoload['dcPrefs'] = dirname(__FILE__).'/core/class.dc.prefs.php'; 52 $__autoload['dcTwigPage'] = dirname(__FILE__).'/core/class.dc.twig.page.php'; 53 $__autoload['dcStore'] = dirname(__FILE__).'/core/class.dc.store.php'; 54 $__autoload['dcStoreReader'] = dirname(__FILE__).'/core/class.dc.store.reader.php'; 55 $__autoload['dcStoreParser'] = dirname(__FILE__).'/core/class.dc.store.parser.php'; 56 $__autoload['dcFavorites'] = dirname(__FILE__).'/admin/class.dc.favorites.php'; 57 58 $__autoload['rsExtPost'] = dirname(__FILE__).'/core/class.dc.rs.extensions.php'; 59 $__autoload['rsExtComment'] = dirname(__FILE__).'/core/class.dc.rs.extensions.php'; 60 $__autoload['rsExtDates'] = dirname(__FILE__).'/core/class.dc.rs.extensions.php'; 61 $__autoload['rsExtUser'] = dirname(__FILE__).'/core/class.dc.rs.extensions.php'; 62 63 $__autoload['dcAdminContext'] = dirname(__FILE__).'/admin/class.dc.admincontext.php'; 64 $__autoload['dcMenu'] = dirname(__FILE__).'/admin/class.dc.menu.php'; 65 $__autoload['dcPage'] = dirname(__FILE__).'/admin/lib.dc.page.php'; 66 $__autoload['adminGenericList'] = dirname(__FILE__).'/admin/lib.pager.php'; 67 $__autoload['adminPostList'] = dirname(__FILE__).'/admin/lib.pager.php'; 68 $__autoload['adminPostMiniList'] = dirname(__FILE__).'/admin/lib.pager.php'; 69 $__autoload['adminCommentList'] = dirname(__FILE__).'/admin/lib.pager.php'; 70 $__autoload['adminUserList'] = dirname(__FILE__).'/admin/lib.pager.php'; 71 $__autoload['dcPager'] = dirname(__FILE__).'/admin/lib.pager.php'; 72 $__autoload['dcAdminCombos'] = dirname(__FILE__).'/admin/lib.admincombos.php'; 73 $__autoload['adminModulesList'] = dirname(__FILE__).'/admin/lib.moduleslist.php'; 74 $__autoload['adminThemesList'] = dirname(__FILE__).'/admin/lib.moduleslist.php'; 73 75 $__autoload['dcThemeConfig'] = dirname(__FILE__).'/admin/lib.themeconfig.php'; 74 76 75 $__autoload['dcTemplate'] 76 $__autoload['context'] 77 $__autoload['dcUrlHandlers'] 77 $__autoload['dcTemplate'] = dirname(__FILE__).'/public/class.dc.template.php'; 78 $__autoload['context'] = dirname(__FILE__).'/public/lib.tpl.context.php'; 79 $__autoload['dcUrlHandlers'] = dirname(__FILE__).'/public/lib.urlhandlers.php'; 78 80 $__autoload['dcAdminURL'] = dirname(__FILE__).'/admin/lib.dc.adminurl.php'; 79 $__autoload['dcPostsActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcactionposts.php'; 80 $__autoload['dcCommentsActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcactioncomments.php'; 81 $__autoload['dcActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcaction.php'; 81 $__autoload['dcPostsActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcactionposts.php'; 82 $__autoload['dcCommentsActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcactioncomments.php'; 83 $__autoload['dcActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcaction.php'; 84 $__autoload['dcForm'] = dirname(__FILE__).'/admin/class.dc.form.php'; 85 $__autoload['dcFormExtension'] = dirname(__FILE__).'/admin/class.dc.form.php'; 86 $__autoload['dcTabExtension'] = dirname(__FILE__).'/admin/class.dc.tab.php'; 87 $__autoload['dcItemList'] = dirname(__FILE__).'/admin/class.dc.list.php'; 88 $__autoload['dcListFetcher'] = dirname(__FILE__).'/admin/class.dc.list.php'; 89 90 foreach (array('dcFilterSet', 'dcFilter','dcFilterCombo','dcFilterText','dcFilterBoolean') as $c) { 91 $__autoload[$c] = dirname(__FILE__).'/admin/class.dc.filter.php'; 92 } 82 93 83 94 # Clearbricks extensions 84 95 html::$absolute_regs[] = '/(<param\s+name="movie"\s+value=")(.*?)(")/msu'; 85 96 html::$absolute_regs[] = '/(<param\s+name="FlashVars"\s+value=".*?(?:mp3|flv)=)(.*?)(&|")/msu'; 97 98 if (@is_dir('/usr/lib/twig')) { 99 define('TWIG_PATH','/usr/lib/Twig'); 100 } elseif (is_dir(dirname(__FILE__).'/../vendor/twig/twig/lib/Twig')) { 101 define('TWIG_PATH',dirname(__FILE__).'/../vendor/twig/twig/lib/Twig'); 102 } elseif (isset($_SERVER['TWIG_PATH']) && is_dir($_SERVER['TWIG_PATH'])) { 103 define('TWIG_PATH',$_SERVER['TWIG_PATH']); 104 } 105 106 if (!defined('TWIG_PATH') || !is_dir(TWIG_PATH)) { 107 exit('No Twig path defined'); 108 } 109 require TWIG_PATH.'/Autoloader.php'; 110 Twig_Autoloader::register(); 111 86 112 /* ------------------------------------------------------------------------------------------- */ 87 113 … … 140 166 # Constants 141 167 define('DC_ROOT',path::real(dirname(__FILE__).'/..')); 142 define('DC_VERSION','2. 7-dev');168 define('DC_VERSION','2.99-dev'); 143 169 define('DC_DIGESTS',dirname(__FILE__).'/digests'); 144 170 define('DC_L10N_ROOT',dirname(__FILE__).'/../locales');
Note: See TracChangeset
for help on using the changeset viewer.