Changeset 2683:fb8aa74332f1 for inc
- Timestamp:
- 03/13/14 11:42:57 (11 years ago)
- Branch:
- twig
- Parents:
- 2656:95fe4eacc716 (diff), 2682:cac55fdd7178 (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:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.core.php
r2650 r2683 4 4 # This file is part of Dotclear 2. 5 5 # 6 # Copyright (c) 2003-201 3Olivier Meunier & Association Dotclear6 # Copyright (c) 2003-2014 Olivier Meunier & Association Dotclear 7 7 # Licensed under the GPL version 2.0 license. 8 8 # See LICENSE file or … … 102 102 103 103 $this->log = new dcLog($this); 104 105 $this->addFormater('xhtml', create_function('$s','return $s;'));106 $this->addFormater('wiki', array($this,'wikiTransform'));107 $this->loadTemplateEnvironment();108 104 } 109 105 … … 248 244 //@} 249 245 250 251 246 /// @name Text Formatters methods 252 247 //@{ … … 255 250 transform text. The function must be a valid callback and takes one 256 251 argument: the string to transform. It returns the transformed string. 252 253 @param editor_id <b>string</b> Editor id (dcLegacyEditor, dcCKEditor, ...) 254 @param name <b>string</b> Formater name 255 @param func <b>callback</b> Function to use, must be a valid and callable callback 256 */ 257 public function addEditorFormater($editor_id,$name,$func) 258 { 259 if (is_callable($func)) { 260 $this->formaters[$editor_id][$name] = $func; 261 } 262 } 263 264 /// @name Text Formatters methods 265 //@{ 266 /** 267 Adds a new text formater which will call the function <var>$func</var> to 268 transform text. The function must be a valid callback and takes one 269 argument: the string to transform. It returns the transformed string. 257 270 258 271 @param name <b>string</b> Formater name … … 261 274 public function addFormater($name,$func) 262 275 { 263 if (is_callable($func)) { 264 $this->formaters[$name] = $func; 265 } 266 } 267 268 /** 269 Returns formaters list. 270 276 $this->addEditorFormater('dcLegacyEditor',$name,$func); 277 } 278 279 /** 280 Returns editors list 281 282 @return <b>array</b> An array of editors values. 283 */ 284 public function getEditors() 285 { 286 $editors = array(); 287 288 foreach (array_keys($this->formaters) as $editor_id) { 289 $editors[$editor_id] = $this->plugins->moduleInfo($editor_id,'name'); 290 } 291 292 return $editors; 293 } 294 295 /** 296 Returns formaters list by editor 297 298 @param editor_id <b>string</b> Editor id (dcLegacyEditor, dcCKEditor, ...) 271 299 @return <b>array</b> An array of formaters names in values. 272 */ 273 public function getFormaters() 274 { 275 return array_keys($this->formaters); 300 301 /** 302 if @param editor_id is empty: 303 return all formaters sorted by actives editors 304 305 if @param editor_id is not empty 306 return formaters for an editor if editor is active 307 return empty() array if editor is not active. 308 It can happens when a user choose an editor and admin deactivate that editor later 309 */ 310 public function getFormaters($editor_id='') 311 { 312 $formaters_list = array(); 313 314 if (!empty($editor_id)) { 315 if (isset($this->formaters[$editor_id])) { 316 $formaters_list = array_keys($this->formaters[$editor_id]); 317 } 318 } else { 319 foreach ($this->formaters as $editor => $formaters) { 320 $formaters_list[$editor] = array_keys($formaters); 321 } 322 } 323 324 return $formaters_list; 276 325 } 277 326 … … 280 329 transformed using that formater. 281 330 331 @param editor_id <b>string</b> Editor id (dcLegacyEditor, dcCKEditor, ...) 282 332 @param name <b>string</b> Formater name 283 333 @param str <b>string</b> String to transform 284 334 @return <b>string</b> String transformed 285 335 */ 336 public function callEditorFormater($editor_id,$name,$str) 337 { 338 if (isset($this->formaters[$editor_id]) && isset($this->formaters[$editor_id][$name])) { 339 return call_user_func($this->formaters[$editor_id][$name],$str); 340 } 341 342 return $str; 343 } 344 //@} 345 346 /** 347 If <var>$name</var> is a valid formater, it returns <var>$str</var> 348 transformed using that formater. 349 350 @param name <b>string</b> Formater name 351 @param str <b>string</b> String to transform 352 @return <b>string</b> String transformed 353 */ 286 354 public function callFormater($name,$str) 287 355 { 288 if (isset($this->formaters[$name])) { 289 return call_user_func($this->formaters[$name],$str); 290 } 291 292 return $str; 356 return $this->callEditorFormater('dcLegacyEditor',$name,$str); 293 357 } 294 358 //@} 295 359 296 360 297 361 /// @name Behaviors methods -
inc/core/class.dc.core.php
r2682 r2683 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 */ … … 869 905 } 870 906 //@} 871 907 872 908 /// @name Blog management methods 873 909 //@{ 874 910 /** 875 911 Returns all blog permissions (users) as an array which looks like: 876 912 877 913 - [user_id] 878 914 - [name] => User name … … 881 917 - [super] => (true|false) super admin 882 918 - [p] 883 - [permission] => true919 - [permission] => true 884 920 - ... 885 921 886 922 @param id <b>string</b> Blog ID 887 923 @param with_super <b>boolean</b> Includes super admins in result … … 896 932 'JOIN '.$this->prefix.'permissions P ON U.user_id = P.user_id '. 897 933 "WHERE blog_id = '".$this->con->escape($id)."' "; 898 934 899 935 if ($with_super) { 900 936 $strReq .= … … 905 941 'WHERE user_super = 1 '; 906 942 } 907 943 908 944 $rs = $this->con->select($strReq); 909 945 910 946 $res = array(); 911 947 912 948 while ($rs->fetch()) 913 949 { … … 921 957 ); 922 958 } 923 959 924 960 return $res; 925 961 } 926 962 927 963 /** 928 964 Returns a blog of given ID. 929 965 930 966 @param id <b>string</b> Blog ID 931 967 @return <b>record</b> … … 934 970 { 935 971 $blog = $this->getBlogs(array('blog_id'=>$id)); 936 972 937 973 if ($blog->isEmpty()) { 938 974 return false; 939 975 } 940 976 941 977 return $blog; 942 978 } 943 979 944 980 /** 945 981 Returns a record of blogs. <b>$params</b> is an array with the following 946 982 optionnal parameters: 947 983 948 984 - <var>blog_id</var>: Blog ID 949 985 - <var>q</var>: Search string on blog_id, blog_name and blog_url 950 986 - <var>limit</var>: limit results 951 987 952 988 @param params <b>array</b> Parameters 953 989 @param count_only <b>boolean</b> Count only results … … 958 994 $join = ''; // %1$s 959 995 $where = ''; // %2$s 960 996 961 997 if ($count_only) 962 998 { … … 976 1012 'WHERE NULL IS NULL '. 977 1013 '%2$s '; 978 1014 979 1015 if (!empty($params['order'])) { 980 1016 $strReq .= 'ORDER BY '.$this->con->escape($params['order']).' '; … … 982 1018 $strReq .= 'ORDER BY B.blog_id ASC '; 983 1019 } 984 1020 985 1021 if (!empty($params['limit'])) { 986 1022 $strReq .= $this->con->limit($params['limit']); 987 1023 } 988 1024 } 989 1025 990 1026 if ($this->auth->userID() && !$this->auth->isSuperAdmin()) 991 1027 { … … 998 1034 $where = 'AND blog_status IN (1,0) '; 999 1035 } 1000 1036 1001 1037 if (!empty($params['blog_id'])) { 1002 1038 $where .= "AND B.blog_id = '".$this->con->escape($params['blog_id'])."' "; 1003 1039 } 1004 1040 1005 1041 if (!empty($params['q'])) { 1006 1042 $params['q'] = strtolower(str_replace('*','%',$params['q'])); … … 1012 1048 ') '; 1013 1049 } 1014 1050 1015 1051 $strReq = sprintf($strReq,$join,$where); 1016 1052 return $this->con->select($strReq); 1017 1053 } 1018 1054 1019 1055 /** 1020 1056 Creates a new blog. 1021 1057 1022 1058 @param cur <b>cursor</b> Blog cursor 1023 1059 */ … … 1027 1063 throw new Exception(__('You are not an administrator')); 1028 1064 } 1029 1065 1030 1066 $this->getBlogCursor($cur); 1031 1067 1032 1068 $cur->blog_creadt = date('Y-m-d H:i:s'); 1033 1069 $cur->blog_upddt = date('Y-m-d H:i:s'); 1034 1070 $cur->blog_uid = md5(uniqid()); 1035 1071 1036 1072 $cur->insert(); 1037 1073 } 1038 1074 1039 1075 /** 1040 1076 Updates a given blog. 1041 1077 1042 1078 @param id <b>string</b> Blog ID 1043 1079 @param cur <b>cursor</b> Blog cursor … … 1046 1082 { 1047 1083 $this->getBlogCursor($cur); 1048 1084 1049 1085 $cur->blog_upddt = date('Y-m-d H:i:s'); 1050 1086 1051 1087 $cur->update("WHERE blog_id = '".$this->con->escape($id)."'"); 1052 1088 } 1053 1089 1054 1090 private function getBlogCursor($cur) 1055 1091 { … … 1057 1093 && !preg_match('/^[A-Za-z0-9._-]{2,}$/',$cur->blog_id)) || 1058 1094 (!$cur->blog_id)) { 1059 throw new Exception(__('Blog ID must contain at least 2 characters using letters, numbers or symbols.')); 1060 } 1061 1095 throw new Exception(__('Blog ID must contain at least 2 characters using letters, numbers or symbols.')); 1096 } 1097 1062 1098 if (($cur->blog_name !== null && $cur->blog_name == '') || 1063 1099 (!$cur->blog_name)) { 1064 1100 throw new Exception(__('No blog name')); 1065 1101 } 1066 1102 1067 1103 if (($cur->blog_url !== null && $cur->blog_url == '') || 1068 1104 (!$cur->blog_url)) { 1069 1105 throw new Exception(__('No blog URL')); 1070 1106 } 1071 1107 1072 1108 if ($cur->blog_desc !== null) { 1073 1109 $cur->blog_desc = html::clean($cur->blog_desc); 1074 1110 } 1075 1111 } 1076 1112 1077 1113 /** 1078 1114 Removes a given blog. 1079 1115 @warning This will remove everything related to the blog (posts, 1080 1116 categories, comments, links...) 1081 1117 1082 1118 @param id <b>string</b> Blog ID 1083 1119 */ … … 1087 1123 throw new Exception(__('You are not an administrator')); 1088 1124 } 1089 1125 1090 1126 $strReq = 'DELETE FROM '.$this->prefix.'blog '. 1091 1127 "WHERE blog_id = '".$this->con->escape($id)."' "; 1092 1128 1093 1129 $this->con->execute($strReq); 1094 1130 } 1095 1131 1096 1132 /** 1097 1133 Checks if a blog exist. 1098 1134 1099 1135 @param id <b>string</b> Blog ID 1100 1136 @return <b>boolean</b> … … 1105 1141 'FROM '.$this->prefix.'blog '. 1106 1142 "WHERE blog_id = '".$this->con->escape($id)."' "; 1107 1143 1108 1144 $rs = $this->con->select($strReq); 1109 1145 1110 1146 return !$rs->isEmpty(); 1111 1147 } 1112 1148 1113 1149 /** 1114 1150 Count posts on a blog 1115 1151 1116 1152 @param id <b>string</b> Blog ID 1117 1153 @param type <b>string</b> Post type … … 1123 1159 'FROM '.$this->prefix.'post '. 1124 1160 "WHERE blog_id = '".$this->con->escape($id)."' "; 1125 1161 1126 1162 if ($type) { 1127 1163 $strReq .= "AND post_type = '".$this->con->escape($type)."' "; 1128 1164 } 1129 1165 1130 1166 return $this->con->select($strReq)->f(0); 1131 1167 } 1132 1168 //@} 1133 1169 1134 1170 /// @name HTML Filter methods 1135 1171 //@{ … … 1138 1174 tidy extension is present). If <b>enable_html_filter</b> blog setting is 1139 1175 false, returns not filtered string. 1140 1176 1141 1177 @param str <b>string</b> String to filter 1142 1178 @return <b>string</b> Filtered string. … … 1147 1183 return $str; 1148 1184 } 1149 1185 1150 1186 $filter = new htmlFilter; 1151 1187 $str = trim($filter->apply($str)); … … 1153 1189 } 1154 1190 //@} 1155 1191 1156 1192 /// @name wiki2xhtml methods 1157 1193 //@{ … … 1160 1196 $this->wiki2xhtml = new wiki2xhtml; 1161 1197 } 1162 1198 1163 1199 /** 1164 1200 Returns a transformed string with wiki2xhtml. 1165 1201 1166 1202 @param str <b>string</b> String to transform 1167 1203 @return <b>string</b> Transformed string … … 1174 1210 return $this->wiki2xhtml->transform($str); 1175 1211 } 1176 1212 1177 1213 /** 1178 1214 Inits <var>wiki2xhtml</var> property for blog post. … … 1181 1217 { 1182 1218 $this->initWiki(); 1183 1219 1184 1220 $this->wiki2xhtml->setOpts(array( 1185 1221 'active_title' => 1, … … 1213 1249 'note_str' => '<div class="footnotes"><h4>Notes</h4>%s</div>' 1214 1250 )); 1215 1251 1216 1252 $this->wiki2xhtml->registerFunction('url:post',array($this,'wikiPostLink')); 1217 1253 1218 1254 # --BEHAVIOR-- coreWikiPostInit 1219 1255 $this->callBehavior('coreInitWikiPost',$this->wiki2xhtml); 1220 1256 } 1221 1257 1222 1258 /** 1223 1259 Inits <var>wiki2xhtml</var> property for simple blog comment (basic syntax). … … 1226 1262 { 1227 1263 $this->initWiki(); 1228 1264 1229 1265 $this->wiki2xhtml->setOpts(array( 1230 1266 'active_title' => 0, … … 1255 1291 'active_fr_syntax' => 0 1256 1292 )); 1257 1293 1258 1294 # --BEHAVIOR-- coreInitWikiSimpleComment 1259 1295 $this->callBehavior('coreInitWikiSimpleComment',$this->wiki2xhtml); 1260 1296 } 1261 1297 1262 1298 /** 1263 1299 Inits <var>wiki2xhtml</var> property for blog comment. … … 1266 1302 { 1267 1303 $this->initWiki(); 1268 1304 1269 1305 $this->wiki2xhtml->setOpts(array( 1270 1306 'active_title' => 0, … … 1295 1331 'active_fr_syntax' => 0 1296 1332 )); 1297 1333 1298 1334 # --BEHAVIOR-- coreInitWikiComment 1299 1335 $this->callBehavior('coreInitWikiComment',$this->wiki2xhtml); 1300 1336 } 1301 1337 1302 1338 public function wikiPostLink($url,$content) 1303 1339 { 1304 if (!($this->blog instanceof dcBlog)) { 1340 if (!($this->blog instanceof dcBlog)) { 1305 1341 return array(); 1306 1342 } 1307 1343 1308 1344 $post_id = abs((integer) substr($url,5)); 1309 1345 if (!$post_id) { 1310 1346 return array(); 1311 1347 } 1312 1348 1313 1349 $post = $this->blog->getPosts(array('post_id'=>$post_id)); 1314 1350 if ($post->isEmpty()) { 1315 1351 return array(); 1316 1352 } 1317 1353 1318 1354 $res = array('url' => $post->getURL()); 1319 1355 $post_title = $post->post_title; 1320 1356 1321 1357 if ($content != $url) { 1322 1358 $res['title'] = html::escapeHTML($post->post_title); 1323 1359 } 1324 1360 1325 1361 if ($content == '' || $content == $url) { 1326 1362 $res['content'] = html::escapeHTML($post->post_title); 1327 1363 } 1328 1364 1329 1365 if ($post->post_lang) { 1330 1366 $res['lang'] = $post->post_lang; 1331 1367 } 1332 1368 1333 1369 return $res; 1334 1370 } 1335 1371 //@} 1336 1372 1337 1373 /// @name Maintenance methods 1338 1374 //@{ … … 1340 1376 Creates default settings for active blog. Optionnal parameter 1341 1377 <var>defaults</var> replaces default params while needed. 1342 1378 1343 1379 @param defaults <b>array</b> Default parameters 1344 1380 */ … … 1425 1461 ); 1426 1462 } 1427 1463 1428 1464 $settings = new dcSettings($this,null); 1429 1465 $settings->addNamespace('system'); 1430 1466 1431 1467 foreach ($defaults as $v) { 1432 1468 $settings->system->put($v[0],$v[2],$v[1],$v[3],false,true); 1433 1469 } 1434 1470 } 1435 1471 1436 1472 /** 1437 1473 Recreates entries search engine index. 1438 1474 1439 1475 @param start <b>integer</b> Start entry index 1440 1476 @param limit <b>integer</b> Number of entry to index 1441 1477 1442 1478 @return <b>integer</b> <var>$start</var> and <var>$limit</var> sum 1443 1479 */ … … 1448 1484 $rs = $this->con->select($strReq); 1449 1485 $count = $rs->f(0); 1450 1486 1451 1487 $strReq = 'SELECT post_id, post_title, post_excerpt_xhtml, post_content_xhtml '. 1452 1488 'FROM '.$this->prefix.'post '; 1453 1489 1454 1490 if ($start !== null && $limit !== null) { 1455 1491 $strReq .= $this->con->limit($start,$limit); 1456 1492 } 1457 1493 1458 1494 $rs = $this->con->select($strReq,true); 1459 1495 1460 1496 $cur = $this->con->openCursor($this->prefix.'post'); 1461 1497 1462 1498 while ($rs->fetch()) 1463 1499 { 1464 1500 $words = $rs->post_title.' '. $rs->post_excerpt_xhtml.' '. 1465 1501 $rs->post_content_xhtml; 1466 1502 1467 1503 $cur->post_words = implode(' ',text::splitWords($words)); 1468 1504 $cur->update('WHERE post_id = '.(integer) $rs->post_id); 1469 1505 $cur->clean(); 1470 1506 } 1471 1507 1472 1508 if ($start+$limit > $count) { 1473 1509 return null; … … 1475 1511 return $start+$limit; 1476 1512 } 1477 1513 1478 1514 /** 1479 1515 Recreates comments search engine index. 1480 1516 1481 1517 @param start <b>integer</b> Start comment index 1482 1518 @param limit <b>integer</b> Number of comments to index 1483 1519 1484 1520 @return <b>integer</b> <var>$start</var> and <var>$limit</var> sum 1485 1521 */ … … 1490 1526 $rs = $this->con->select($strReq); 1491 1527 $count = $rs->f(0); 1492 1528 1493 1529 $strReq = 'SELECT comment_id, comment_content '. 1494 1530 'FROM '.$this->prefix.'comment '; 1495 1531 1496 1532 if ($start !== null && $limit !== null) { 1497 1533 $strReq .= $this->con->limit($start,$limit); 1498 1534 } 1499 1535 1500 1536 $rs = $this->con->select($strReq); 1501 1537 1502 1538 $cur = $this->con->openCursor($this->prefix.'comment'); 1503 1539 1504 1540 while ($rs->fetch()) 1505 1541 { … … 1508 1544 $cur->clean(); 1509 1545 } 1510 1546 1511 1547 if ($start+$limit > $count) { 1512 1548 return null; … … 1514 1550 return $start+$limit; 1515 1551 } 1516 1552 1517 1553 /** 1518 1554 Reinits nb_comment and nb_trackback in post table. … … 1520 1556 public function countAllComments() 1521 1557 { 1522 1558 1523 1559 $updCommentReq = 'UPDATE '.$this->prefix.'post P '. 1524 1560 'SET nb_comment = ('. … … 1536 1572 $this->con->execute($updTrackbackReq); 1537 1573 } 1538 1574 1539 1575 /** 1540 1576 Empty templates cache directory … … 1549 1585 /** 1550 1586 Return elapsed time since script has been started 1551 @param 1552 1553 @return <b>float</b> 1587 @param $mtime <b>float</b> timestamp (microtime format) to evaluate delta from 1588 current time is taken if null 1589 @return <b>float</b> elapsed time 1554 1590 */ 1555 1591 public function getElapsedTime ($mtime=null) { -
inc/prepend.php
r2654 r2683 73 73 $__autoload['adminModulesList'] = dirname(__FILE__).'/admin/lib.moduleslist.php'; 74 74 $__autoload['adminThemesList'] = dirname(__FILE__).'/admin/lib.moduleslist.php'; 75 $__autoload['dcThemeConfig'] = dirname(__FILE__).'/admin/lib.themeconfig.php'; 75 76 76 77 $__autoload['dcTemplate'] = dirname(__FILE__).'/public/class.dc.template.php'; -
inc/prepend.php
r2657 r2683 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'] = dirname(__FILE__).'/public/class.dc.template.php'; 76 $__autoload['context'] = dirname(__FILE__).'/public/lib.tpl.context.php'; 77 $__autoload['dcUrlHandlers'] = dirname(__FILE__).'/public/lib.urlhandlers.php'; 78 $__autoload['dcPostsActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcactionposts.php'; 79 $__autoload['dcCommentsActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcactioncomments.php'; 80 $__autoload['dcActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcaction.php'; 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'; 80 $__autoload['dcPostsActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcactionposts.php'; 81 $__autoload['dcCommentsActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcactioncomments.php'; 82 $__autoload['dcActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcaction.php'; 83 $__autoload['dcForm'] = dirname(__FILE__).'/admin/class.dc.form.php'; 84 $__autoload['dcFormExtension'] = dirname(__FILE__).'/admin/class.dc.form.php'; 85 $__autoload['dcTabExtension'] = dirname(__FILE__).'/admin/class.dc.tab.php'; 86 $__autoload['dcItemList'] = dirname(__FILE__).'/admin/class.dc.list.php'; 87 $__autoload['dcListFetcher'] = dirname(__FILE__).'/admin/class.dc.list.php'; 88 89 foreach (array('dcFilterSet', 'dcFilter','dcFilterCombo','dcFilterText','dcFilterBoolean') as $c) { 90 $__autoload[$c] = dirname(__FILE__).'/admin/class.dc.filter.php'; 91 } 81 92 82 93 # Clearbricks extensions 83 94 html::$absolute_regs[] = '/(<param\s+name="movie"\s+value=")(.*?)(")/msu'; 84 95 html::$absolute_regs[] = '/(<param\s+name="FlashVars"\s+value=".*?(?:mp3|flv)=)(.*?)(&|")/msu'; 96 97 if (@is_dir('/usr/lib/twig')) { 98 define('TWIG_PATH','/usr/lib/Twig'); 99 } elseif (is_dir(dirname(__FILE__).'/../vendor/twig/twig/lib/Twig')) { 100 define('TWIG_PATH',dirname(__FILE__).'/../vendor/twig/twig/lib/Twig'); 101 } elseif (isset($_SERVER['TWIG_PATH']) && is_dir($_SERVER['TWIG_PATH'])) { 102 define('TWIG_PATH',$_SERVER['TWIG_PATH']); 103 } 104 105 if (!defined('TWIG_PATH') || !is_dir(TWIG_PATH)) { 106 exit('No Twig path defined'); 107 } 108 require TWIG_PATH.'/Autoloader.php'; 109 Twig_Autoloader::register(); 110 85 111 /* ------------------------------------------------------------------------------------------- */ 86 112 … … 139 165 # Constants 140 166 define('DC_ROOT',path::real(dirname(__FILE__).'/..')); 141 define('DC_VERSION','2. 7-dev');167 define('DC_VERSION','2.99-dev'); 142 168 define('DC_DIGESTS',dirname(__FILE__).'/digests'); 143 169 define('DC_L10N_ROOT',dirname(__FILE__).'/../locales');
Note: See TracChangeset
for help on using the changeset viewer.