Changeset 2973
- Timestamp:
- 01/12/09 00:42:11 (6 months ago)
- Location:
- trunk/htdocs/system/classes
- Files:
-
- 87 modified
-
acl.php (modified) (2 diffs)
-
actionhandler.php (modified) (2 diffs)
-
adminhandler.php (modified) (1 diff)
-
ajaxhandler.php (modified) (1 diff)
-
apccache.php (modified) (1 diff)
-
atomhandler.php (modified) (1 diff)
-
bitmask.php (modified) (1 diff)
-
cache.php (modified) (2 diffs)
-
colorutils.php (modified) (1 diff)
-
comment.php (modified) (3 diffs)
-
commentinfo.php (modified) (1 diff)
-
comments.php (modified) (11 diffs)
-
controller.php (modified) (3 diffs)
-
cronjob.php (modified) (9 diffs)
-
crontab.php (modified) (1 diff)
-
curlrequestprocessor.php (modified) (2 diffs)
-
databaseconnection.php (modified) (14 diffs)
-
db.php (modified) (2 diffs)
-
error.php (modified) (3 diffs)
-
eventlog.php (modified) (6 diffs)
-
feedbackhandler.php (modified) (1 diff)
-
filecache.php (modified) (5 diffs)
-
format.php (modified) (2 diffs)
-
formui.php (modified) (8 diffs)
-
habaridatetime.php (modified) (1 diff)
-
habarilocale.php (modified) (3 diffs)
-
hiengine.php (modified) (1 diff)
-
htmltokenizer.php (modified) (3 diffs)
-
htmltokenset.php (modified) (1 diff)
-
importer.php (modified) (2 diffs)
-
infoobject.php (modified) (2 diffs)
-
inforecords.php (modified) (15 diffs)
-
inputfilter.php (modified) (4 diffs)
-
installhandler.php (modified) (14 diffs)
-
iscontent.php (modified) (2 diffs)
-
logentry.php (modified) (6 diffs)
-
media.php (modified) (3 diffs)
-
mediaasset.php (modified) (2 diffs)
-
mediasilo.php (modified) (2 diffs)
-
modules.php (modified) (2 diffs)
-
multibyte.php (modified) (11 diffs)
-
options.php (modified) (3 diffs)
-
pluggable.php (modified) (2 diffs)
-
plugin.php (modified) (2 diffs)
-
plugins.php (modified) (5 diffs)
-
post.php (modified) (16 diffs)
-
postinfo.php (modified) (1 diff)
-
posts.php (modified) (23 diffs)
-
queryprofile.php (modified) (1 diff)
-
queryrecord.php (modified) (10 diffs)
-
rawphpengine.php (modified) (3 diffs)
-
remoterequest.php (modified) (7 diffs)
-
rewriterule.php (modified) (6 diffs)
-
rewriterules.php (modified) (2 diffs)
-
rpcclient.php (modified) (3 diffs)
-
session.php (modified) (2 diffs)
-
singleton.php (modified) (3 diffs)
-
site.php (modified) (2 diffs)
-
smartyengine.php (modified) (3 diffs)
-
socketrequestprocessor.php (modified) (7 diffs)
-
stack.php (modified) (4 diffs)
-
superglobal.php (modified) (4 diffs)
-
tag.php (modified) (8 diffs)
-
tags.php (modified) (5 diffs)
-
templateengine.php (modified) (1 diff)
-
theme.php (modified) (22 diffs)
-
themes.php (modified) (1 diff)
-
update.php (modified) (2 diffs)
-
url.php (modified) (3 diffs)
-
urlproperties.php (modified) (1 diff)
-
user.php (modified) (2 diffs)
-
usergroup.php (modified) (22 diffs)
-
usergroups.php (modified) (4 diffs)
-
userhandler.php (modified) (3 diffs)
-
userinfo.php (modified) (1 diff)
-
users.php (modified) (7 diffs)
-
userthemehandler.php (modified) (1 diff)
-
utils.php (modified) (2 diffs)
-
uuid.php (modified) (4 diffs)
-
version.php (modified) (2 diffs)
-
xmlrpcbinary.php (modified) (2 diffs)
-
xmlrpcclient.php (modified) (7 diffs)
-
xmlrpcdate.php (modified) (3 diffs)
-
xmlrpcexception.php (modified) (6 diffs)
-
xmlrpcserver.php (modified) (5 diffs)
-
xmlrpcstruct.php (modified) (7 diffs)
-
xmlrpcutils.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/htdocs/system/classes/acl.php
r2864 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** … … 12 16 * grants that permission. 13 17 * 14 * @package Habari15 18 **/ 16 17 19 class ACL { 18 20 /** -
trunk/htdocs/system/classes/actionhandler.php
r2873 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** … … 5 9 * extend this class for the Controller to call their actions. 6 10 * 7 * @package Habari8 11 */ 9 12 class ActionHandler -
trunk/htdocs/system/classes/adminhandler.php
r2968 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 6 2 7 /** 3 8 * Habari AdminHandler Class 4 9 * Backbone of the admin area, handles requests and functionality. 5 10 * 6 * @package Habari7 11 * @todo Clean this mess up 8 12 */ 9 10 13 class AdminHandler extends ActionHandler 11 14 { -
trunk/htdocs/system/classes/ajaxhandler.php
r2862 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** 4 8 * Handles Ajax requests, sending them to plugin sinks. 5 9 * 6 * @package Habari7 10 */ 8 9 11 class AjaxHandler extends ActionHandler 10 12 { -
trunk/htdocs/system/classes/apccache.php
r2592 r2973 1 1 <?php 2 3 2 /** 4 3 * @package Habari 5 4 * 5 */ 6 7 /** 8 * 6 9 * Contains the APCCache class 7 10 */ 8 9 11 class APCCache extends Cache 10 12 { -
trunk/htdocs/system/classes/atomhandler.php
r2948 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 6 2 7 /** 3 8 * Habari AtomHandler class 4 9 * Produces Atom feeds and accepts Atom Publishing Protocol input 5 10 * 6 * @package Habari7 11 * @todo Apply system error handling 8 12 */ 9 10 13 class AtomHandler extends ActionHandler 11 14 { -
trunk/htdocs/system/classes/bitmask.php
r2864 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 6 2 7 /** 3 8 * Class to wrap around bitmap field functionality -
trunk/htdocs/system/classes/cache.php
r2078 r2973 3 3 * @package Habari 4 4 * 5 * Contains the abstract Cache class.6 5 */ 7 6 … … 9 8 * Habari Cache Class 10 9 * 11 * Base class for caching computationally expensive or bandwidth intensive data10 * Base abstract class for caching computationally expensive or bandwidth intensive data 12 11 */ 13 12 abstract class Cache -
trunk/htdocs/system/classes/colorutils.php
r2592 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** -
trunk/htdocs/system/classes/comment.php
r2862 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** 4 8 * Habari CommentRecord Class 5 *6 * @package Habari7 9 * 8 10 * Includes an instance of the CommentInfo class; for holding inforecords about the comment … … 302 304 { 303 305 if ( is_numeric( $value ) ) { 304 $this->newfields['status'] = $value;306 $this->newfields['status'] = $value; 305 307 } 306 308 else { … … 310 312 case "approve": 311 313 case "ham": 312 $this->newfields['status'] = self::STATUS_APPROVED;314 $this->newfields['status'] = self::STATUS_APPROVED; 313 315 break; 314 316 case "unapproved": 315 317 case "unapprove": 316 $this->newfields['status'] = self::STATUS_UNAPPROVED;318 $this->newfields['status'] = self::STATUS_UNAPPROVED; 317 319 break; 318 320 case "spam": 319 $this->newfields['status'] = self::STATUS_SPAM;321 $this->newfields['status'] = self::STATUS_SPAM; 320 322 break; 321 323 case "deleted": 322 $this->newfields['status'] = self::STATUS_DELETED;324 $this->newfields['status'] = self::STATUS_DELETED; 323 325 break; 324 326 } -
trunk/htdocs/system/classes/commentinfo.php
r1283 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 7 /** 8 * Comment metadata 9 */ 3 10 class CommentInfo extends InfoRecords { 4 11 -
trunk/htdocs/system/classes/comments.php
r2826 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 6 2 7 /** 3 8 * Habari Comments Class 4 9 * 5 * @package Habari6 10 */ 7 8 11 class Comments extends ArrayObject 9 12 { … … 93 96 } 94 97 else { 95 $where[] = "type= ?";96 $params[] = Comment::type( $paramset['type'] );98 $where[] = "type= ?"; 99 $params[] = Comment::type( $paramset['type'] ); 97 100 } 98 101 } … … 119 122 /* do searching */ 120 123 if ( isset( $paramset['post_author'] ) ) { 121 $joins['posts'] = ' INNER JOIN {posts} ON {comments}.post_id = {posts}.id';124 $joins['posts'] = ' INNER JOIN {posts} ON {comments}.post_id = {posts}.id'; 122 125 if ( is_array( $paramset['post_author'] ) ) { 123 126 $where[] = "{posts}.user_id IN (" . implode( ',', array_fill( 0, count( $paramset['post_author'] ), '?' ) ) . ")"; … … 133 136 // Support 'criteria_fields' => 'author,ip' rather than 'criteria_fields' => array( 'author', 'ip' ) 134 137 if ( !is_array( $paramset['criteria_fields'] ) && is_string( $paramset['criteria_fields'] ) ) { 135 $paramset['criteria_fields'] = explode( ',', $paramset['criteria_fields'] );138 $paramset['criteria_fields'] = explode( ',', $paramset['criteria_fields'] ); 136 139 } 137 140 } … … 169 172 $params[] = $startDate->sql; 170 173 $params[] = $startDate->modify( '+1 day' )->sql; 171 //$params[] = date( 'Y-m-d H:i:s', mktime( 0, 0, 0, $paramset['month'], $paramset['day'], $paramset['year'] ) );172 //$params[] = date( 'Y-m-d H:i:s', mktime( 23, 59, 59, $paramset['month'], $paramset['day'], $paramset['year'] ) );174 //$params[] = date( 'Y-m-d H:i:s', mktime( 0, 0, 0, $paramset['month'], $paramset['day'], $paramset['year'] ) ); 175 //$params[] = date( 'Y-m-d H:i:s', mktime( 23, 59, 59, $paramset['month'], $paramset['day'], $paramset['year'] ) ); 173 176 } 174 177 elseif ( isset( $paramset['month'] ) ) { … … 178 181 $params[] = $startDate->sql; 179 182 $params[] = $startDate->modify( '+1 month' )->sql; 180 //$params[] = date( 'Y-m-d H:i:s', mktime( 0, 0, 0, $paramset['month'], 1, $paramset['year'] ) );181 //$params[] = date( 'Y-m-d H:i:s', mktime( 23, 59, 59, $paramset['month'] + 1, 0, $paramset['year'] ) );183 //$params[] = date( 'Y-m-d H:i:s', mktime( 0, 0, 0, $paramset['month'], 1, $paramset['year'] ) ); 184 //$params[] = date( 'Y-m-d H:i:s', mktime( 23, 59, 59, $paramset['month'] + 1, 0, $paramset['year'] ) ); 182 185 } 183 186 elseif ( isset( $paramset['year'] ) ) { … … 187 190 $params[] = $startDate->sql; 188 191 $params[] = $startDate->modify( '+1 year' )->sql; 189 //$params[] = date( 'Y-m-d H:i:s', mktime( 0, 0, 0, 1, 1, $paramset['year'] ) );190 //$params[] = date( 'Y-m-d H:i:s', mktime( 0, 0, -1, 1, 1, $paramset['year'] + 1 ) );192 //$params[] = date( 'Y-m-d H:i:s', mktime( 0, 0, 0, 1, 1, $paramset['year'] ) ); 193 //$params[] = date( 'Y-m-d H:i:s', mktime( 0, 0, -1, 1, 1, $paramset['year'] + 1 ) ); 191 194 } 192 195 … … 561 564 $params = array( 'email' => $email, 'count' => 'email'); 562 565 if ( FALSE !== $status ) { 563 $params['status'] = $status;566 $params['status'] = $status; 564 567 } 565 568 return self::get( $params ); … … 577 580 $params = array( 'url' => $url, 'count' => 'url'); 578 581 if ( FALSE !== $status ) { 579 $params['status'] = $status;582 $params['status'] = $status; 580 583 } 581 584 return self::get( $params ); … … 608 611 $params = array( 'post_slug' => $slug, 'count' => 'id'); 609 612 if ( FALSE !== $status ) { 610 $params['status'] = $status;613 $params['status'] = $status; 611 614 } 612 615 return self::get( $params ); … … 624 627 $params = array( 'post_id' => $id, 'count' => 'id' ); 625 628 if ( FALSE !== $status ) { 626 $params['status'] = $status;629 $params['status'] = $status; 627 630 } 628 631 return self::get( $params ); -
trunk/htdocs/system/classes/controller.php
r2851 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 6 2 7 /** 3 8 * Class which handles incoming requests and drives the … … 5 10 * a view. 6 11 * 7 * @package Habari8 12 */ 9 13 class Controller extends Singleton { … … 135 139 $controller->handler = new $matched_rule->handler(); 136 140 /* Insert the regexed submatches as the named parameters */ 137 $controller->handler->handler_vars['entire_match'] = $matched_rule->entire_match; // The entire matched string is returned at index 0141 $controller->handler->handler_vars['entire_match'] = $matched_rule->entire_match; // The entire matched string is returned at index 0 138 142 foreach ($matched_rule->named_arg_values as $named_arg_key=>$named_arg_value) { 139 $controller->handler->handler_vars[$named_arg_key] = $named_arg_value;143 $controller->handler->handler_vars[$named_arg_key] = $named_arg_value; 140 144 } 141 145 -
trunk/htdocs/system/classes/cronjob.php
r2606 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** 4 8 * CronJob is a single cron task 5 9 * 6 * @package Habari7 *8 10 * @property string $name The name of the cron job. 9 11 * @property mixed $callback The callback function or plugin action for the cron job to execute. … … 27 29 /** 28 30 * The internally stored execution time of this cronjob. (unix timestamp) 29 * 31 * 30 32 * @var int 31 33 */ … … 35 37 /** 36 38 * Returns the defined database columns for a cronjob. 37 * 39 * 38 40 * @return array Array of default columns in the crontab table 39 41 */ … … 58 60 /** 59 61 * Constructor for the CronJob class. 60 * 62 * 61 63 * @see QueryRecord::__construct() 62 64 * @param array $paramarray an associative array or querystring of initial field values … … 135 137 * Magic property setter to set the cronjob properties. 136 138 * Serializes the callback if needed. 137 * 139 * 138 140 * @see QueryRecord::__set() 139 141 * @param string $name The name of the property to set. … … 164 166 * Magic property getter to get the cronjob properties. 165 167 * Unserializes the callback if called. 166 * 168 * 167 169 * @see QueryRecord::__get() 168 170 * @param string $name The name of the property to get. … … 182 184 /** 183 185 * Saves a new cron job to the crontab table. 184 * 186 * 185 187 * @see QueryRecord::insertRecord() 186 188 * @return CronJob The newly inserted cron job, or false if failed. … … 193 195 /** 194 196 * Updates an existing cron job to the crontab table. 195 * 197 * 196 198 * @see QueryRecord::updateRecord() 197 199 * @return CronJob The updated cron job, or false if failed. … … 204 206 /** 205 207 * Deletes an existing cron job. 206 * 208 * 207 209 * @see QueryRecord::deleteRecord() 208 210 * @return bool If the delete was successful -
trunk/htdocs/system/classes/crontab.php
r2915 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** 4 8 * Static class to build and read cron entries 5 9 * 6 * @package Habari7 10 */ 8 9 11 class CronTab extends ActionHandler 10 12 { -
trunk/htdocs/system/classes/curlrequestprocessor.php
r2592 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** … … 33 37 $merged_headers = array(); 34 38 foreach ( $headers as $k => $v ) { 35 $merged_headers[] = $k . ': ' . $v;39 $merged_headers[] = $k . ': ' . $v; 36 40 } 37 41 -
trunk/htdocs/system/classes/databaseconnection.php
r2807 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** 4 8 * Habari DatabaseConnection Class 5 9 * 6 * @package Habari10 * Actual database connection. 7 11 */ 8 9 10 12 class DatabaseConnection 11 13 { 12 14 private $fetch_mode = PDO::FETCH_CLASS; // PDO Fetch mode 13 private $fetch_class_name = 'QueryRecord'; // The default class name for fetching classes14 private $driver; // PDO driver name15 private $fetch_class_name = 'QueryRecord'; // The default class name for fetching classes 16 private $driver; // PDO driver name 15 17 private $keep_profile = DEBUG; // keep profiling and timing information? 16 protected $pdo = NULL; // handle to the PDO interface18 protected $pdo = NULL; // handle to the PDO interface 17 19 private $pdo_statement = NULL; // handle for a PDOStatement 18 private $pdo_transaction = FALSE; // handle for transaction status20 private $pdo_transaction = FALSE; // handle for transaction status 19 21 20 22 /** … … 57 59 private $sql_tables_repl = array(); 58 60 private $errors = array(); // an array of errors related to queries 59 private $profiles = array(); // an array of query profiles60 61 protected $prefix = ''; // class protected storage of the database table prefix, defaults to ''61 private $profiles = array(); // an array of query profiles 62 63 protected $prefix = ''; // class protected storage of the database table prefix, defaults to '' 62 64 private $current_table; 63 65 … … 85 87 if ( isset ( $GLOBALS['db_connection']['prefix'] ) ) { 86 88 $prefix = $GLOBALS['db_connection']['prefix']; 87 } else if ( isset( $_POST['table_prefix'] ) ) { 89 } 90 else if ( isset( $_POST['table_prefix'] ) ) { 88 91 $prefix = $_POST['table_prefix']; 89 } else { 92 } 93 else { 90 94 $prefix = $this->prefix; 91 95 } … … 94 98 // build the mapping with prefixes 95 99 foreach ( $this->tables as $t ) { 96 $this->sql_tables[$t] = $prefix . $t;97 $this->sql_tables_repl[$t] = '{' . $t . '}';100 $this->sql_tables[$t] = $prefix . $t; 101 $this->sql_tables_repl[$t] = '{' . $t . '}'; 98 102 } 99 103 } … … 172 176 public function register_table( $name ) 173 177 { 174 $this->tables[] = $name;178 $this->tables[] = $name; 175 179 $this->load_tables(); 176 180 } … … 272 276 if ( $this->keep_profile ) { 273 277 $profile->stop(); 274 $this->profiles[] = $profile;278 $this->profiles[] = $profile; 275 279 } 276 280 return true; … … 327 331 if ( $this->keep_profile ) { 328 332 $profile->stop(); 329 $this->profiles[] = $profile;333 $this->profiles[] = $profile; 330 334 } 331 335 return true; … … 389 393 $backtrace = array(); 390 394 foreach($backtrace1 as $trace) { 391 $backtrace[] = array_intersect_key( $trace, array('file'=>1, 'line'=>1, 'function'=>1, 'class'=>1) );392 } 393 $this->errors[] = array_merge($error, array('backtrace'=> $backtrace)) ;395 $backtrace[] = array_intersect_key( $trace, array('file'=>1, 'line'=>1, 'function'=>1, 'class'=>1) ); 396 } 397 $this->errors[] = array_merge($error, array('backtrace'=> $backtrace)) ; 394 398 } 395 399 … … 562 566 $query.= $comma . $field; 563 567 $comma = ', '; 564 $values[] = $value;568 $values[] = $value; 565 569 } 566 570 $query.= ' ) VALUES ( ' . trim( str_repeat( '?,', count( $fieldvalues ) ), ',' ) . ' );'; … … 586 590 foreach( $keyfieldvalues as $keyfield => $keyvalue ) { 587 591 $qry.= " AND {$keyfield}= ? "; 588 $values[] = $keyvalue;592 $values[] = $keyvalue; 589 593 } 590 594 $result = $this->get_row( $qry, $values ); … … 610 614 foreach( $keyfields as $keyfield => $keyvalue ) { 611 615 if( is_numeric( $keyfield ) ) { 612 $keyfieldvalues[$keyvalue] = $fieldvalues[$keyvalue];616 $keyfieldvalues[$keyvalue] = $fieldvalues[$keyvalue]; 613 617 } 614 618 else { 615 $keyfieldvalues[$keyfield] = $keyvalue;619 $keyfieldvalues[$keyfield] = $keyvalue; 616 620 } 617 621 } … … 622 626 foreach( $fieldvalues as $fieldname => $fieldvalue ) { 623 627 $qry.= $comma . " {$fieldname}= ?"; 624 $values[] = $fieldvalue;628 $values[] = $fieldvalue; 625 629 $comma = ' ,'; 626 630 } … … 629 633 foreach( $keyfields as $keyfield => $keyvalue ) { 630 634 $qry.= "AND {$keyfield}= ? "; 631 $values[] = $keyvalue;635 $values[] = $keyvalue; 632 636 } 633 637 return $this->query( $qry, $values ); … … 653 657 foreach ( $keyfields as $keyfield => $keyvalue ) { 654 658 $qry.= "AND {$keyfield}= ? "; 655 $values[] = $keyvalue;659 $values[] = $keyvalue; 656 660 } 657 661 -
trunk/htdocs/system/classes/db.php
r2592 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** 4 8 * Habari DB Class 5 9 * 6 * @package Habari 10 * Singleton class for database connection and manipulation 11 * 7 12 */ 8 9 13 class DB extends Singleton 10 14 { … … 378 382 379 383 /** 380 * Automatic dat base diffing function, used for determining required database upgrades.384 * Automatic database diffing function, used for determining required database upgrades. 381 385 * 382 386 * @param queries array of create table and insert statements which constitute a fresh install -
trunk/htdocs/system/classes/error.php
r2734 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** 4 8 * Contains error-related functions and Habari's error handler. 5 9 * 6 * @package Habari7 10 **/ 8 11 class Error extends Exception … … 168 171 169 172 if ( strpos( $a['file'], HABARI_PATH ) === 0 ) { 170 $a['file'] = substr( $a['file'], strlen( HABARI_PATH ) + 1 );173 $a['file'] = substr( $a['file'], strlen( HABARI_PATH ) + 1 ); 171 174 } 172 175 … … 174 177 $args = array(); 175 178 foreach ( $a['args'] as $arg ) { 176 $args[] = htmlentities( str_replace(179 $args[] = htmlentities( str_replace( 177 180 array( "\n", "\r" ), 178 181 array( "\n ", '' ), -
trunk/htdocs/system/classes/eventlog.php
r2935 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 6 2 7 /** 3 8 * Habari EventLog class 4 9 * 5 * @package Habari6 10 * @todo Apply system error handling 7 11 */ 8 9 12 class EventLog extends ArrayObject 10 13 { … … 161 164 $join = ''; 162 165 if ( isset( $paramarray['where'] ) && is_string( $paramarray['where'] ) ) { 163 $wheres[] = $paramarray['where'];166 $wheres[] = $paramarray['where']; 164 167 } 165 168 else { … … 170 173 171 174 if ( isset( $paramset['id'] ) && is_numeric( $paramset['id'] ) ) { 172 $where[] = "id= ?";173 $params[] = $paramset['id'];175 $where[] = "id= ?"; 176 $params[] = $paramset['id']; 174 177 } 175 178 if ( isset( $paramset['user_id'] ) ) { 176 $where[] = "user_id= ?";177 $params[] = $paramset['user_id'];179 $where[] = "user_id= ?"; 180 $params[] = $paramset['user_id']; 178 181 } 179 182 if ( isset( $paramset['severity'] ) && ( 'any' != LogEntry::severity_name( $paramset['severity'] ) ) ) { 180 $where[] = "severity_id= ?";181 $params[] = LogEntry::severity( $paramset['severity'] );183 $where[] = "severity_id= ?"; 184 $params[] = LogEntry::severity( $paramset['severity'] ); 182 185 } 183 186 if ( isset( $paramset['type_id'] ) ) { … … 185 188 $types = array_filter( $paramset['type_id'], 'is_numeric' ); 186 189 if ( count( $types ) ) { 187 $where[] = 'type_id IN (' . implode( ',', $types ) . ')';190 $where[] = 'type_id IN (' . implode( ',', $types ) . ')'; 188 191 } 189 192 } 190 193 else { 191 $where[] = 'type_id = ?';192 $params[] = $paramset['type_id'];194 $where[] = 'type_id = ?'; 195 $params[] = $paramset['type_id']; 193 196 } 194 197 } 195 198 if ( isset( $paramset['ip'] ) ) { 196 $where[] = 'ip = ?';197 $params[] = $paramset['ip'];199 $where[] = 'ip = ?'; 200 $params[] = $paramset['ip']; 198 201 } 199 202 … … 202 205 preg_match_all( '/(?<=")(\\w[^"]*)(?=")|(\\w+)/', $paramset['criteria'], $matches ); 203 206 foreach ( $matches[0] as $word ) { 204 $where[] .= "(message LIKE CONCAT('%',?,'%'))";205 $params[] = $word;207 $where[] .= "(message LIKE CONCAT('%',?,'%'))"; 208 $params[] = $word; 206 209 } 207 210 } … … 217 220 */ 218 221 if ( isset( $paramset['day'] ) ) { 219 $where[] = 'timestamp BETWEEN ? AND ?';222 $where[] = 'timestamp BETWEEN ? AND ?'; 220 223 $startDate = sprintf( '%d-%02d-%02d', $paramset['year'], $paramset['month'], $paramset['day'] ); 221 224 $startDate = HabariDateTime::date_create( $startDate ); 222 $params[] = $startDate->sql;223 $params[] = $startDate->modify( '+1 day' )->sql;224 //$params[] = date( 'Y-m-d H:i:s', mktime( 0, 0, 0, $paramset['month'], $paramset['day'], $paramset['year'] ) );225 //$params[] = date( 'Y-m-d H:i:s', mktime( 23, 59, 59, $paramset['month'], $paramset['day'], $paramset['year'] ) );225 $params[] = $startDate->sql; 226 $params[] = $startDate->modify( '+1 day' )->sql; 227 //$params[] = date( 'Y-m-d H:i:s', mktime( 0, 0, 0, $paramset['month'], $paramset['day'], $paramset['year'] ) ); 228 //$params[] = date( 'Y-m-d H:i:s', mktime( 23, 59, 59, $paramset['month'], $paramset['day'], $paramset['year'] ) ); 226 229 } 227 230 elseif ( isset( $paramset['month'] ) ) { 228 $where[] = 'timestamp BETWEEN ? AND ?';231 $where[] = 'timestamp BETWEEN ? AND ?'; 229 232 $startDate = sprintf( '%d-%02d-%02d', $paramset['year'], $paramset['month'], 1 ); 230 233 $startDate = HabariDateTime::date_create( $startDate ); 231 $params[] = $startDate->sql;232 $params[] = $startDate->modify( '+1 month' )->sql;233 //$params[] = date( 'Y-m-d H:i:s', mktime( 0, 0, 0, $paramset['month'], 1, $paramset['year'] ) );234 //$params[] = date( 'Y-m-d H:i:s', mktime( 23, 59, 59, $paramset['month'] + 1, 0, $paramset['year'] ) );234 $params[] = $startDate->sql; 235 $params[] = $startDate->modify( '+1 month' )->sql; 236 //$params[] = date( 'Y-m-d H:i:s', mktime( 0, 0, 0, $paramset['month'], 1, $paramset['year'] ) ); 237 //$params[] = date( 'Y-m-d H:i:s', mktime( 23, 59, 59, $paramset['month'] + 1, 0, $paramset['year'] ) ); 235 238 } 236 239 elseif ( isset( $paramset['year'] ) ) { 237 $where[] = 'timestamp BETWEEN ? AND ?';240 $where[] = 'timestamp BETWEEN ? AND ?'; 238 241 $startDate = sprintf( '%d-%02d-%02d', $paramset['year'], 1, 1 ); 239 242 $startDate = HabariDateTime::date_create( $startDate ); 240 $params[] = $startDate->sql;241 $params[] = $startDate->modify( '+1 year' )->sql;242 //$params[] = date( 'Y-m-d H:i:s', mktime( 0, 0, 0, 1, 1, $paramset['year'] ) );243 //$params[] = date( 'Y-m-d H:i:s', mktime( 0, 0, -1, 1, 1, $paramset['year'] + 1 ) );244 } 245 246 $wheres[] = ' (' . implode( ' AND ', $where ) . ') ';243 $params[] = $startDate->sql; 244 $params[] = $startDate->modify( '+1 year' )->sql; 245 //$params[] = date( 'Y-m-d H:i:s', mktime( 0, 0, 0, 1, 1, $paramset['year'] ) ); 246 //$params[] = date( 'Y-m-d H:i:s', mktime( 0, 0, -1, 1, 1, $paramset['year'] + 1 ) ); 247 } 248 249 $wheres[] = ' (' . implode( ' AND ', $where ) . ') '; 247 250 } 248 251 } -
trunk/htdocs/system/classes/feedbackhandler.php
r2957 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 6 2 7 /** 3 8 * Habari FeedbackHandler Class 4 9 * Deals with feedback mechnisms: Commenting, Pingbacking, and the like. 5 10 * 6 * @package Habari7 11 */ 8 9 12 class FeedbackHandler extends ActionHandler 10 13 { -
trunk/htdocs/system/classes/filecache.php
r2592 r2973 1 1 <?php 2 3 2 /** 4 3 * @package Habari 5 4 * 5 */ 6 7 /** 6 8 * Contains the FileCache class 7 */ 8 9 /** 9 * 10 10 * Stores cache data in local files 11 11 */ … … 97 97 } 98 98 else { 99 $this->cache_data[$group] = array();99 $this->cache_data[$group] = array(); 100 100 } 101 101 } … … 119 119 if ( !isset( $this->cache_data[$group][$name] ) ) { 120 120 if ( isset( $this->cache_files[$ghash][$hash] ) && $this->cache_files[$ghash][$hash]['expires'] > time() && file_exists( $this->cache_files[$ghash][$hash]['file'] ) ) { 121 $this->cache_data[$group][$name] = unserialize( file_get_contents( $this->cache_files[$ghash][$hash]['file'] ) );121 $this->cache_data[$group][$name] = unserialize( file_get_contents( $this->cache_files[$ghash][$hash]['file'] ) ); 122 122 } 123 123 else { 124 $this->cache_data[$group][$name] = null;124 $this->cache_data[$group][$name] = null; 125 125 } 126 126 } … … 136 136 $ghash = $this->get_group_hash( $group ); 137 137 138 $this->cache_data[$group][$name] = $value;138 $this->cache_data[$group][$name] = $value; 139 139 140 140 file_put_contents( $this->cache_location . $ghash . $hash, serialize( $value ) ); 141 $this->cache_files[$ghash][$hash] = array( 'file' => $this->cache_location . $ghash . $hash, 'expires' => time() + $expiry, 'name' => $name );141 $this->cache_files[$ghash][$hash] = array( 'file' => $this->cache_location . $ghash . $hash, 'expires' => time() + $expiry, 'name' => $name ); 142 142 $this->clear_expired(); 143 143 file_put_contents( $this->index_file, serialize( $this->cache_files ) ); … … 226 226 { 227 227 foreach ( $this->cache_files as $ghash => $records ) { 228 $this->cache_files[$ghash] = array_filter( $records, array( $this, 'record_fresh' ) );228 $this->cache_files[$ghash] = array_filter( $records, array( $this, 'record_fresh' ) ); 229 229 } 230 230 } -
trunk/htdocs/system/classes/format.php
r2937 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 6 2 7 /** 3 8 * Habari Format Class 4 9 * 5 10 * Provides formatting functions for use in themes. Extendable. 6 * @package Habari11 * 7 12 */ 8 9 13 class Format 10 14 { … … 317 321 elseif( $word[0] == '<' ) { 318 322 // If the tag begins, push it on the stack 319 $stack[] = $word;320 $output .= $word;323 $stack[] = $word; 324 $output .= $word; 321 325 } 322 326 else { -
trunk/htdocs/system/classes/formui.php
r2907 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 6 2 7 /** 3 8 * FormUI Library - Create interfaces for plugins … … 9 14 * FormControl* Every control needs a FormControl* class, FormUI literally looks for example, FormControlCheckbox. 10 15 * 11 * @version $Id$ 12 * @package Habari 13 */ 14 16 */ 15 17 class FormContainer 16 18 { … … 58 60 if($control) { 59 61 $control->container = $this; 60 $this->controls[$name] = $control;62 $this->controls[$name] = $control; 61 63 } 62 64 return $control; … … 120 122 } 121 123 else { 122 $values[$control->name] = $control->value;124 $values[$control->name] = $control->value; 123 125 } 124 126 } … … 139 141 } 140 142 else { 141 $controls[$control->name] = $control;143 $controls[$control->name] = $control; 142 144 } 143 145 } … … 197 199 $validate = $control->validate(); 198 200 if(count($validate) != 0) { 199 $class[] = 'invalid';201 $class[] = 'invalid'; 200 202 $message = implode('<br>', (array) $validate); 201 203 } … … 361 363 foreach($this->controls as $control) { 362 364 if ($result = $control->validate()) { 363 $results[] = $result;365 $results[] = $result; 364 366 } 365 367 } … … 1059 1061 $index = $validator; 1060 1062 } 1061 $this->validators[$index] = $args;1063 $this->validators[$index] = $args; 1062 1064 return $this; 1063 1065 } -
trunk/htdocs/system/classes/habaridatetime.php
r2769 r2973 1 1 <?php 2 2 /** 3 * @package Habari 4 * 5 */ 6 7 /** 3 8 * HabariDateTime class to wrap dates in. 4 *5 * @package Habari6 9 * 7 10 * @property-read HabariDateTime $clone Returns a clonned object. -
trunk/htdocs/system/classes/habarilocale.php
r2969 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** … … 6 10 * Provides translation services. 7 11 * 8 * @package Habari9 12 */ 10 13 class HabariLocale … … 184 187 $transinfo = unpack( $lo, substr( $data, $header['transblock'] + $msgindex * 8, 8 ) ); 185 188 $transids = explode( "\0", substr( $data, $transinfo['offset'], $transinfo['length'] ) ); 186 self::$messages[$domain][$msgids[0]] = array(189 self::$messages[$domain][$msgids[0]] = array( 187 190 $msgids, 188 191 $transids, -
trunk/htdocs/system/classes/hiengine.php
r2917 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** 4 8 * 5 9 * Habari HiEngine class 6 * @package Habari7 10 * 8 11 * The HiEngine is a subclass of the RawPHPEngine class -
trunk/htdocs/system/classes/htmltokenizer.php
r2592 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** … … 88 92 private function node( $type, $name, $value, $attrs ) 89 93 { 90 $this->nodes[] = array(94 $this->nodes[] = array( 91 95 'type' => $type, 92 96 'name' => $name, … … 197 201 $this->dec(); 198 202 } 199 $attr[$name] = $value;203 $attr[$name] = $value; 200 204 $this->skip_whitespace(); 201 205 } -
trunk/htdocs/system/classes/htmltokenset.php
r2894 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** -
trunk/htdocs/system/classes/importer.php
r590 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** … … 5 9 * from other blogging tools. 6 10 * 7 * @package Habari8 * @version $Id$9 11 */ 10 12 interface importer -
trunk/htdocs/system/classes/infoobject.php
r2592 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 7 /** 8 * Object metadata 9 * 10 */ 3 11 class InfoObject extends InfoRecords { 4 12 5 function __construct ( $params ) 13 function __construct ( $params ) 6 14 { 7 15 // Don't call the parent constructor if this is read-only … … 9 17 $this->$key = $value; 10 18 } 11 } 19 } 12 20 } 13 21 ?> -
trunk/htdocs/system/classes/inforecords.php
r2592 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** … … 5 9 * 6 10 * Base class for managing metadata about various Habari objects 7 * 8 * @package Habari 11 * 9 12 */ 10 13 abstract class InfoRecords implements URLProperties 11 { 14 { 12 15 // the info array 13 16 protected $__inforecord_array = array(); … … 32 35 * @param string $table_name name of the table to insert info (use the DB::o()->table_name syntax) 33 36 * @param string $key_name name of the primary key (for example "post_id") 34 * @param mixed $key_value (optional) the master record key value (for example, info for post_id = 1 managed by setting this param to 1). Use 37 * @param mixed $key_value (optional) the master record key value (for example, info for post_id = 1 managed by setting this param to 1). Use 35 38 * set_key method if not set here. 36 39 **/ 37 public function __construct( $table_name, $key_name, $key_value = NULL ) 38 { 40 public function __construct( $table_name, $key_name, $key_value = NULL ) 41 { 39 42 $this->_table_name = $table_name; 40 43 $this->_key_name = $key_name; … … 48 51 * @return boolean TRUE if master record value has been set already, FALSE otherwise 49 52 **/ 50 public function is_key_set() 53 public function is_key_set() 51 54 { 52 55 return isset( $this->_key_value ); … … 83 86 return; 84 87 } 85 88 86 89 $result = DB::get_results( ' 87 90 SELECT name, value, type … … 92 95 93 96 foreach ( $result as $result_element ) { 94 // XXX is this logic right? 97 // XXX is this logic right? 95 98 if ( $result_element->type == 1 ) { 96 $this->__inforecord_array[$result_element->name] = array('value'=>unserialize($result_element->value));99 $this->__inforecord_array[$result_element->name] = array('value'=>unserialize($result_element->value)); 97 100 } 98 else { 99 $this->__inforecord_array[$result_element->name] = array('value'=>$result_element->value);101 else { 102 $this->__inforecord_array[$result_element->name] = array('value'=>$result_element->value); 100 103 } 101 104 } … … 109 112 * @return mixed Stored value for specified key 110 113 **/ 111 public function __get ( $name ) 114 public function __get ( $name ) 112 115 { 113 116 $this->_load(); … … 116 119 } 117 120 return $this->__inforecord_array[$name]['value']; 118 } 119 120 /** 121 * Update the info record. 121 } 122 123 /** 124 * Update the info record. 122 125 * The value will not be stored in the database until calling $this->commit(); 123 * 126 * 124 127 * @param string $name Name of the key to set 125 128 * @param mixed $value Value to set 126 **/ 127 public function __set( $name, $value ) 128 { 129 $this->_load(); 130 $this->__inforecord_array[$name] = array('changed'=>true, 'value'=>$value);129 **/ 130 public function __set( $name, $value ) 131 { 132 $this->_load(); 133 $this->__inforecord_array[$name] = array('changed'=>true, 'value'=>$value); 131 134 } 132 135 133 136 /** 134 137 * Test for the existence of specified info value 135 * 138 * 136 139 * @param string $name Name of the option to set 137 140 * @return boolean TRUE if the info option exists, FALSE in all other cases 138 **/ 141 **/ 139 142 public function __isset ( $name ) 140 143 { … … 145 148 /** 146 149 * Remove an info option; immediately unsets from the storage AND removes from database. Use with caution. 147 * 150 * 148 151 * @param string $name Name of the option to unset 149 152 * @return boolean TRUE if the option is successfully unset, FALSE otherwise 150 **/ 153 **/ 151 154 public function __unset( $name ) 152 155 { 153 156 $this->_load(); 154 if ( isset( $this->__inforecord_array[$name] ) ) { 157 if ( isset( $this->__inforecord_array[$name] ) ) { 155 158 DB::delete( $this->_table_name, array ( $this->_key_name => $this->_key_value, "name"=> $name ) ); 156 159 unset( $this->__inforecord_array[$name] ); 157 160 return true; 158 161 } 159 return false; 160 } 162 return false; 163 } 161 164 162 165 /** … … 174 177 175 178 /** 176 * Remove all info options. Primarily used when deleting the parent object. 179 * Remove all info options. Primarily used when deleting the parent object. 177 180 * I.E. when deleting a user, the delete method would call this. 178 * 181 * 179 182 * @return boolean TRUE if the options were successfully unset, FALSE otherwise 180 **/ 183 **/ 181 184 public function delete_all() 182 185 { … … 193 196 $result->out(); 194 197 return false; 195 } 198 } 196 199 $this->__inforecord_array = array(); 197 200 return true; … … 201 204 * Commit all of the changed info options to the database. 202 205 * If this function is not called, then the options will not be written. 203 * 206 * 204 207 * @param mixed $metadata_key (optional) Key to use when writing info data. 205 208 */ … … 209 212 $this->_key_value = $metadata_key; 210 213 } 211 // If the info is not already loaded, and the key value is empty, 214 // If the info is not already loaded, and the key value is empty, 212 215 // then we don't have enough info to do the commit 213 216 if ( !$this->_loaded && empty($this->_key_value) ) { … … 219 222 $value = $record['value']; 220 223 if ( is_array( $value ) || is_object( $value ) ) { 221 $result = DB::update( 222 $this->_table_name, 224 $result = DB::update( 225 $this->_table_name, 223 226 array( 224 $this->_key_name=>$this->_key_value, 225 'name'=>$name, 227 $this->_key_name=>$this->_key_value, 228 'name'=>$name, 226 229 'value'=>serialize($value), 227 230 'type'=>1 228 ), 231 ), 229 232 array('name'=>$name, $this->_key_name=>$this->_key_value) 230 ); 231 } 233 ); 234 } 232 235 else { 233 $result = DB::update( 234 $this->_table_name, 236 $result = DB::update( 237 $this->_table_name, 235 238 array( 236 $this->_key_name=>$this->_key_value, 237 'name'=>$name, 238 'value'=>$value, 239 $this->_key_name=>$this->_key_value, 240 'name'=>$name, 241 'value'=>$value, 239 242 'type'=>0 240 ), 241 array('name'=>$name, $this->_key_name=> $this->_key_value) 242 ); 243 ), 244 array('name'=>$name, $this->_key_name=> $this->_key_value) 245 ); 243 246 } 244 247 … … 246 249 $result->out(); 247 250 } 248 $this->__inforecord_array[$name] = array('value'=>$value); 251 $this->__inforecord_array[$name] = array('value'=>$value); 249 252 } 250 253 } -
trunk/htdocs/system/classes/inputfilter.php
r2934 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** 4 8 * Input filtering functions. 5 9 * 6 * @package Habari7 10 */ 8 11 class InputFilter … … 315 318 $matches = $matches[0]; 316 319 if ( ! isset( $matches['full_address'] ) ) 317 $matches['full_address'] = '';318 319 $r['is_error'] = FALSE;320 $r['is_relative'] = empty( $matches['full_address'] );321 $r['is_pseudo'] = ! array_key_exists( 'host', $matches );322 $r['pseudo_args'] = $r['is_pseudo'] ? $matches['full_address'] : '';320 $matches['full_address'] = ''; 321 322 $r['is_error'] = FALSE; 323 $r['is_relative'] = empty( $matches['full_address'] ); 324 $r['is_pseudo'] = ! array_key_exists( 'host', $matches ); 325 $r['pseudo_args'] = $r['is_pseudo'] ? $matches['full_address'] : ''; 323 326 324 327 foreach ( array( 'scheme', 'host', 'port', 'user', 'pass', 'path', 'query', 'fragment' ) as $k ) { 325 328 if ( array_key_exists( $k, $matches ) ) { 326 $r[$k] = $matches[$k];329 $r[$k] = $matches[$k]; 327 330 } 328 331 } … … 446 449 else { 447 450 // XXX use blog charset setting 448 $node['value'] = html_entity_decode( $node['value'], ENT_QUOTES, 'utf-8' );451 $node['value'] = html_entity_decode( $node['value'], ENT_QUOTES, 'utf-8' ); 449 452 } 450 453 break; … … 493 496 494 497 if ( $node != NULL ) { 495 $filtered[] = $node;498 $filtered[] = $node; 496 499 } 497 500 } -
trunk/htdocs/system/classes/installhandler.php
r2971 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 6 2 7 define('MIN_PHP_VERSION', '5.2.0'); 3 8 … … 36 41 */ 37 42 if ( ! $this->check_htaccess() ) { 38 $this->handler_vars['file_contents'] = implode( "\n", $this->htaccess() );43 $this->handler_vars['file_contents'] = implode( "\n", $this->htaccess() ); 39 44 $this->display('htaccess'); 40 45 } … … 87 92 // SQLite uses less info. 88 93 // we stick the path in db_host 89 $this->handler_vars['db_file'] = $remainder;94 $this->handler_vars['db_file'] = $remainder; 90 95 break; 91 96 case 'mysql': 92 97 list($host,$name)= explode(';', $remainder); 93 list($discard, $this->handler_vars['db_host']) = explode('=', $host);94 list($discard, $this->handler_vars['db_schema']) = explode('=', $name);98 list($discard, $this->handler_vars['db_host']) = explode('=', $host); 99 list($discard, $this->handler_vars['db_schema']) = explode('=', $name); 95 100 break; 96 101 case 'pgsql': 97 102 list($host,$name)= explode(' ', $remainder); 98 list($discard, $this->handler_vars['db_host']) = explode('=', $host);99 list($discard, $this->handler_vars['db_schema']) = explode('=', $name);103 list($discard, $this->handler_vars['db_host']) = explode('=', $host); 104 list($discard, $this->handler_vars['db_schema']) = explode('=', $name); 100 105 break; 101 106 } 102 $this->handler_vars['db_user'] = $db_connection['username'];103 $this->handler_vars['db_pass'] = $db_connection['password'];104 $this->handler_vars['table_prefix'] = $db_connection['prefix'];107 $this->handler_vars['db_user'] = $db_connection['username']; 108 $this->handler_vars['db_pass'] = $db_connection['password']; 109 $this->handler_vars['table_prefix'] = $db_connection['prefix']; 105 110 } 106 111 // if a $blog_data array exists in config.php, use it … … 109 114 if ( isset( $blog_data ) ) { 110 115 foreach ( $blog_data as $blog_datum => $value ) { 111 $this->handler_vars[$blog_datum] = $value;116 $this->handler_vars[$blog_datum] = $value; 112 117 } 113 118 } … … 130 135 $db_type = $this->handler_vars['db_type']; 131 136 if ( $db_type == 'mysql' || $db_type == 'pgsql' ) { 132 $this->handler_vars['db_host'] = $_POST["{$db_type}_db_host"];133 $this->handler_vars['db_user'] = $_POST["{$db_type}_db_user"];134 $this->handler_vars['db_pass'] = $_POST["{$db_type}_db_pass"];135 $this->handler_vars['db_schema'] = $_POST["{$db_type}_db_schema"];137 $this->handler_vars['db_host'] = $_POST["{$db_type}_db_host"]; 138 $this->handler_vars['db_user'] = $_POST["{$db_type}_db_user"]; 139 $this->handler_vars['db_pass'] = $_POST["{$db_type}_db_pass"]; 140 $this->handler_vars['db_schema'] = $_POST["{$db_type}_db_schema"]; 136 141 } 137 142 … … 192 197 $plugin = array(); 193 198 $plugin_id = Plugins::id_from_file( $file ); 194 $plugin['plugin_id'] = $plugin_id;195 $plugin['file'] = $file;199 $plugin['plugin_id'] = $plugin_id; 200 $plugin['file'] = $file; 196 201 197 202 $error = ''; 198 203 if ( Utils::php_check_file_syntax( $file, $error ) ) { 199 $plugin['debug'] = false;204 $plugin['debug'] = false; 200 205 // instantiate this plugin 201 206 // in order to get its info() … … 203 208 Plugins::get_plugin_classes(); 204 209 $pluginobj = Plugins::load( $file, false ); 205 $plugin['active'] = false;206 $plugin['verb'] = _t( 'Activate' );207 $plugin['actions'] = array();208 $plugin['info'] = $pluginobj->info;210 $plugin['active'] = false; 211 $plugin['verb'] = _t( 'Activate' ); 212 $plugin['actions'] = array(); 213 $plugin['info'] = $pluginobj->info; 209 214 $plugin['recommended'] = in_array( basename($file), $recommended_list ); 210 215 } 211 216 else { 212 $plugin['debug'] = true;213 $plugin['error'] = $error;214 $plugin['active'] = false;215 } 216 217 $plugins[$plugin_id] = $plugin;217 $plugin['debug'] = true; 218 $plugin['error'] = $error; 219 $plugin['active'] = false; 220 } 221 222 $plugins[$plugin_id] = $plugin; 218 223 } 219 224 … … 297 302 foreach ($required_extensions as $ext_name => $ext_url) { 298 303 if (!extension_loaded($ext_name)) { 299 $missing_extensions[$ext_name] = $ext_url;304 $missing_extensions[$ext_name] = $ext_url; 300 305 $requirements_met = false; 301 306 } … … 683 688 switch ($db_type) { 684 689 case 'mysql': 685 $queries[] = 'CREATE DATABASE ' . $db_schema . ';';686 $queries[] = 'GRANT ALL ON ' . $db_schema . '.* TO \'' . $db_user . '\'@\'' . $db_host . '\' ' .690 $queries[] = 'CREATE DATABASE ' . $db_schema . ';'; 691 $queries[] = 'GRANT ALL ON ' . $db_schema . '.* TO \'' . $db_user . '\'@\'' . $db_host . '\' ' . 687 692 'IDENTIFIED BY \'' . $db_pass . '\';'; 688 693 break; 689 694 case 'pgsql': 690 $queries[] = 'CREATE DATABASE ' . $db_schema . ';';691 $queries[] = 'GRANT ALL ON DATABASE ' . $db_schema . ' TO ' . $db_user . ';';695 $queries[] = 'CREATE DATABASE ' . $db_schema . ';'; 696 $queries[] = 'GRANT ALL ON DATABASE ' . $db_schema . ' TO ' . $db_user . ';'; 692 697 break; 693 698 default: … … 783 788 } 784 789 } 785 $this->handler_vars['config_file'] = Site::get_dir('config_file');786 $this->handler_vars['file_contents'] = htmlspecialchars($file_contents);790 $this->handler_vars['config_file'] = Site::get_dir('config_file'); 791 $this->handler_vars['file_contents'] = htmlspecialchars($file_contents); 787 792 $this->display('config'); 788 793 return false; … … 840 845 $rewrite_base = trim( dirname( $_SERVER['SCRIPT_NAME'] ), '/\\' ); 841 846 if ( $rewrite_base != '' ) { 842 $htaccess['rewrite_base'] = 'RewriteBase /' . $rewrite_base;847 $htaccess['rewrite_base'] = 'RewriteBase /' . $rewrite_base; 843 848 } 844 849 … … 907 912 if($rewritebase) { 908 913 $rewrite_base = trim( dirname( $_SERVER['SCRIPT_NAME'] ), '/\\' ); 909 $htaccess['rewrite_base'] = 'RewriteBase /' . $rewrite_base;914 $htaccess['rewrite_base'] = 'RewriteBase /' . $rewrite_base; 910 915 } 911 916 $file_contents = "\n" . implode( "\n", $htaccess ) . "\n"; … … 1112 1117 // skip the first tag text so we end up with something, presumably the first tag entered (it had the lowest ID in the db) 1113 1118 if ( !isset( $fix_tags[ $tag_row->tag_slug ] ) ) { 1114 $slug_to_id[ $tag_row->tag_slug ] = $tag_row->id; // collect the slug => id so we can rename with an absolute id later1115 $fix_tags[ $tag_row->tag_slug ] = array();1119 $slug_to_id[ $tag_row->tag_slug ] = $tag_row->id; // collect the slug => id so we can rename with an absolute id later 1120 $fix_tags[ $tag_row->tag_slug ] = array(); 1116 1121 } 1117 1122 else { 1118 $fix_tags[ $tag_row->tag_slug ][ $tag_row->id ] = $tag_row->tag_text;1123 $fix_tags[ $tag_row->tag_slug ][ $tag_row->id ] = $tag_row->tag_text; 1119 1124 } 1120 1125 … … 1204 1209 $index = array_search( $plugin, $activated ); 1205 1210 $plugin = str_replace( $base_path, '', $plugin ); 1206 $activated[$index] = $plugin;1211 $activated[$index] = $plugin; 1207 1212 } 1208 1213 Options::set( 'active_plugins', $activated ); -
trunk/htdocs/system/classes/iscontent.php
r1615 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** … … 8 12 * @copyright 2008 9 13 */ 10 11 14 interface IsContent 12 15 { 13 14 16 15 17 /** -
trunk/htdocs/system/classes/logentry.php
r2935 r2973 1 1 <?php 2 2 /** 3 * @package Habari 4 * 5 */ 6 7 /** 3 8 * Habari LogEntry class 4 * Represents a log entry5 9 * 6 * @package Habari 10 * Represents a log entry 11 * 7 12 * @todo Apply system error handling 8 13 */ 9 10 14 class LogEntry extends QueryRecord 11 15 { … … 60 64 parent::__construct( $paramarray ); 61 65 if ( !isset( $this->fields['module'] ) ) { 62 $this->fields['module'] = 'habari';66 $this->fields['module'] = 'habari'; 63 67 } 64 68 if ( !isset( $this->fields['type'] ) ) { 65 $this->fields['type'] = 'default';69 $this->fields['type'] = 'default'; 66 70 } 67 71 if ( !isset( $this->fields['severity'] ) ) { 68 $this->fields['severity'] = 'info';72 $this->fields['severity'] = 'info'; 69 73 } 70 74 if ( isset( $this->fields['timestamp'] ) ) { … … 86 90 $res = DB::get_results( 'SELECT id, module, type FROM {log_types}' ); 87 91 foreach ( $res as $x ) { 88 self::$types[ $x->module ][ $x->type ] = $x->id;92 self::$types[ $x->module ][ $x->type ] = $x->id; 89 93 } 90 94 } … … 102 106 continue; 103 107 } 104 $results[$id] = $name;108 $results[$id] = $name; 105 109 } 106 110 return $results; … … 116 120 $types = self::list_logentry_types( $refresh ); 117 121 foreach ( $types as $module => $types ) { 118 $modules[] = $module;122 $modules[] = $module; 119 123 } 120 124 } … … 218 222 $user = User::identify(); 219 223 if ( $user->loggedin ) { 220 $defaults['where'][] = array(224 $defaults['where'][] = array( 221 225 'user_id' => $user->id, 222 226 ); 223 227 } 224 228 foreach ( $defaults['where'] as $index => $where ) { 225 $defaults['where'][$index] = array_merge( $where, Utils::get_params( $paramarray ) );229 $defaults['where'][$index] = array_merge( $where, Utils::get_params( $paramarray ) ); 226 230 } 227 231 // Make sure we fetch only a single event. (LIMIT 1) 228 $defaults['limit'] = 1;232 $defaults['limit'] = 1; 229 233 230 234 return EventLog::get( $defaults ); -
trunk/htdocs/system/classes/media.php
r2137 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** … … 6 10 * @version $Id$ 7 11 * @copyright 2008 8 * @package Habari12 * 9 13 * @todo Handle all error conditions using exceptions 10 14 */ 11 12 15 class Media 13 16 { … … 32 35 { 33 36 $dirs[] = new MediaAsset($siloname, true, array(), $info['icon']); 34 } else { 37 } 38 else { 35 39 $dirs[] = new MediaAsset($siloname, true, array(), NULL); 36 40 } -
trunk/htdocs/system/classes/mediaasset.php
r2137 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** … … 5 9 * 6 10 */ 7 8 11 class MediaAsset 9 12 { -
trunk/htdocs/system/classes/mediasilo.php
r1281 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** … … 7 11 * @copyright 2007 8 12 */ 9 10 13 interface MediaSilo 11 14 { -
trunk/htdocs/system/classes/modules.php
r2630 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 6 2 7 /** 3 8 * Habari Modules Class 4 9 * 5 10 * Provides an interface for the code to access modules and module options 6 * @package Habari7 11 */ 8 9 12 class Modules 10 13 { … … 13 16 private static $status_data; 14 17 15 /**16 * static initializer to setup base vars.17 */18 /** 19 * static initializer to setup base vars. 20 */ 18 21 public static function __static() 19 22 { -
trunk/htdocs/system/classes/multibyte.php
r2450 r2973 1 1 <?php 2 /* 3 * @package Habari 4 * 5 */ 2 6 3 7 /* … … 8 12 * manipulations are done in UTF-8. Currently 9 13 * this class is a wrapper around mbstring functions. 10 * 11 * @package Habari 14 * 12 15 */ 13 16 class MultiByte … … 38 41 * function hab_encoding 39 42 * 40 * Sets and returns the internal encoding. 43 * Sets and returns the internal encoding. 41 44 * 42 45 * @param $use_enc string. The encoding to be used 43 ^46 * 44 47 * @return string. If $enc is null, returns the current 45 48 * encoding. If $enc is not null, returns the old encoding … … 50 53 return self::$hab_enc; 51 54 } 52 else {55 else { 53 56 $old_enc = self::$hab_enc; 54 57 self::$hab_enc = $use_enc; … … 62 65 * Sets and returns the multibyte library being used internally 63 66 * 64 * @param $int The new library to use. 67 * @param $int The new library to use. 65 68 * 66 69 * @return mixed If $new_library is null, returns the current library … … 89 92 * Converts a string's encoding to a new encoding 90 93 * 91 * @param $str string. The string who's encoding is being changed. 94 * @param $str string. The string who's encoding is being changed. 92 95 * @param $use_enc string. The encoding to convert to. If not set, 93 96 * the internal encoding will be used. 94 * @param $from_enc string. encoding before conversion. If not set, 97 * @param $from_enc string. encoding before conversion. If not set, 95 98 * encoding is detected automatically. 96 99 * … … 123 126 * Detects the encoding being used for a string 124 127 * 125 * @param $str string. The string who's encoding is being detected 128 * @param $str string. The string who's encoding is being detected 126 129 * 127 130 * @return mixed The source string's detected encoding, or boolean false. … … 158 161 * not set, the section of the string from $begin to the end of the string is 159 162 * returned. 160 * @param $use_enc string. The encoding to be used. If not set, 163 * @param $use_enc string. The encoding to be used. If not set, 161 164 * the internal encoding will be used. 162 165 * 163 166 * @return mixed The section of the source string requested in the encoding requested or false. 164 167 * If $len is not set, returns substring from $begin to end of string. 165 * 168 * 166 169 */ 167 170 public static function substr( $str, $begin, $len = null, $use_enc = null ) … … 190 193 * Gets the length of a string in characters 191 194 * 192 * @param $str string. The string who's length is being returned. 193 * @param $use_enc string. The encoding to be used. If not set, 194 * the internal encoding will be used. 195 * 196 * @return integer. The length in characters of the string, or the length in bytes if a valid 195 * @param $str string. The string who's length is being returned. 196 * @param $use_enc string. The encoding to be used. If not set, 197 * the internal encoding will be used. 198 * 199 * @return integer. The length in characters of the string, or the length in bytes if a valid 197 200 * multibyte library isn't loaded. 198 201 */ … … 225 228 * 226 229 * @param $str string. The string to lowercase 227 * @param $use_enc string. The encoding to be used. If not set, 230 * @param $use_enc string. The encoding to be used. If not set, 228 231 * the internal encoding will be used. 229 232 * … … 254 257 * 255 258 * @param $str string. The string to uppercase 256 * @param $use_enc string. The encoding to be used. If not set, 259 * @param $use_enc string. The encoding to be used. If not set, 257 260 * the internal encoding will be used. 258 261 * -
trunk/htdocs/system/classes/options.php
r2759 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** 4 8 * Habari Options Class 5 9 * 6 * @package Habari7 10 */ 8 11 class Options extends Singleton … … 130 133 foreach($results as $result) { 131 134 if ( $result->type == 1 ) { 132 $this->options[$result->name] = unserialize( $result->value );135 $this->options[$result->name] = unserialize( $result->value ); 133 136 } 134 137 else { 135 $this->options[$result->name] = $result->value;138 $this->options[$result->name] = $result->value; 136 139 } 137 140 } … … 149 152 } 150 153 $value = Plugins::filter( 'option_set_value', $value, $name, isset($this->options[$name]) ? $this->options[$name] : null ); 151 $this->options[$name] = $value;154 $this->options[$name] = $value; 152 155 153 156 if ( is_array( $value ) || is_object( $value ) ) { -
trunk/htdocs/system/classes/pluggable.php
r2968 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** … … 8 12 * @copyright 2008 9 13 */ 10 11 14 abstract class Pluggable 12 15 { -
trunk/htdocs/system/classes/plugin.php
r1297 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 6 2 7 /** 3 8 * Habari Plugin Class … … 7 12 * plugin actions are registered against the appropriate dispatcher 8 13 * 9 * @package Habari10 14 */ 11 12 15 abstract class Plugin extends Pluggable 13 16 { -
trunk/htdocs/system/classes/plugins.php
r2903 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 6 2 7 /** 3 8 * Habari Plugins Class 4 9 * 5 10 * Provides an interface for the code to access plugins 6 * @package Habari7 11 */ 8 9 12 class Plugins 10 13 { … … 227 230 if ( Site::CONFIG_LOCAL != Site::$config_type ) { 228 231 // include site-specific plugins 229 $plugindirs[] = Site::get_dir( 'config' ) . '/plugins/';232 $plugindirs[] = Site::get_dir( 'config' ) . '/plugins/'; 230 233 } 231 234 $dirs = array(); … … 288 291 // really can't find it 289 292 return false; 290 } else { 293 } 294 else { 291 295 return self::class_from_filename( $file, true ); 292 296 } … … 311 315 $plugin = new $class; 312 316 if($activate) { 313 self::$plugins[$plugin->plugin_id] = $plugin;317 self::$plugins[$plugin->plugin_id] = $plugin; 314 318 $plugin->load(); 315 319 } … … 470 474 if ( !Utils::php_check_file_syntax( $file, $error ) ) { 471 475 Session::error(sprintf( _t( 'Attempted to load the plugin file "%s", but it failed with syntax errors. <div class="reveal">%s</div>' ), basename( $file ), $error )); 472 $failed_plugins[] = $file;476 $failed_plugins[] = $file; 473 477 } 474 478 } -
trunk/htdocs/system/classes/post.php
r2963 r2973 1 1 <?php 2 3 2 /** 4 3 * @package Habari 4 * 5 */ 6 7 /** 5 8 * 6 9 * Includes an instance of the PostInfo class; for holding inforecords about a Post … … 41 44 return self::$post_type_list_active; 42 45 } 43 self::$post_type_list_active['any'] = 0;46 self::$post_type_list_active['any'] = 0; 44 47 $sql = 'SELECT * FROM ' . DB::table( 'posttype' ) . ' WHERE active = 1 ORDER BY id ASC'; 45 48 $results = DB::get_results( $sql ); 46 49 foreach ( $results as $result ) { 47 self::$post_type_list_active[$result->name] = $result->id;50 self::$post_type_list_active[$result->name] = $result->id; 48 51 } 49 52 return self::$post_type_list_active; … … 60 63 return self::$post_type_list_all; 61 64 } 62 self::$post_type_list_all['any'] = 0;65 self::$post_type_list_all['any'] = 0; 63 66 $sql = 'SELECT * FROM ' . DB::table( 'posttype' ) . ' ORDER BY id ASC'; 64 67 $results = DB::get_results( $sql ); 65 68 foreach ( $results as $result ) { 66 self::$post_type_list_all[$result->name] = array(69 self::$post_type_list_all[$result->name] = array( 67 70 'id' => $result->id, 68 71 'active' => $result->active … … 112 115 { 113 116 $statuses = array(); 114 $statuses['any'] = 0;117 $statuses['any'] = 0; 115 118 if ( $refresh || empty( self::$post_status_list ) ) { 116 119 $sql = 'SELECT * FROM ' . DB::table( 'poststatus' ) . ' ORDER BY id ASC'; … … 121 124 if ( $all instanceof Post ) { 122 125 if( ! $status->internal || $status->id == $all->status ) { 123 $statuses[$status->name] = $status->id;126 $statuses[$status->name] = $status->id; 124 127 } 125 128 } 126 129 elseif ( $all ) { 127 $statuses[$status->name] = $status->id;130 $statuses[$status->name] = $status->id; 128 131 } 129 132 elseif ( ! $status->internal ) { 130 $statuses[$status->name] = $status->id;133 $statuses[$status->name] = $status->id; 131 134 } 132 135 } … … 318 321 $user = User::identify(); 319 322 if ( $user->loggedin ) { 320 $defaults['where'][] = array(323 $defaults['where'][] = array( 321 324 'user_id' => $user->id, 322 325 ); 323 326 } 324 327 foreach ( $defaults['where'] as $index => $where ) { 325 $defaults['where'][$index] = array_merge( $where, Utils::get_params( $paramarray ) );328 $defaults['where'][$index] = array_merge( $where, Utils::get_params( $paramarray ) ); 326 329 } 327 330 // make sure we get at most one result 328 $defaults['limit'] = 1;331 $defaults['limit'] = 1; 329 332 330 333 return Posts::get( $defaults ); … … 388 391 } while ( $slugcount->ct != 0 ); 389 392 390 return $this->newfields['slug'] = $slug . $postfix;393 return $this->newfields['slug'] = $slug . $postfix; 391 394 } 392 395 … … 401 404 ) { 402 405 $result = 'tag:' . Site::get_url( 'hostname' ) . ',' . date( 'Y' ) . ':' . $this->setslug() . '/' . time(); 403 $this->newfields['guid'] = $result;406 $this->newfields['guid'] = $result; 404 407 } 405 408 return $this->newfields['guid']; … … 416 419 $statuses = Post::list_post_statuses(); 417 420 if ( is_numeric( $value ) && in_array( $value, $statuses ) ) { 418 return $this->newfields['status'] = $value;421 return $this->newfields['status'] = $value; 419 422 } 420 423 elseif ( array_key_exists( $value, $statuses ) ) { 421 return $this->newfields['status'] = Post::status( 'publish' );424 return $this->newfields['status'] = Post::status( 'publish' ); 422 425 } 423 426 … … 464 467 if ( ! in_array( $tag, array_keys( $clean_tags ) ) ) 465 468 if ( ! in_array( $slug = Utils::slugify( $tag ), array_values( $clean_tags ) ) ) 466 $clean_tags[$tag] = $slug;469 $clean_tags[$tag] = $slug; 467 470 468 471 if ( count( $this->tags ) == 0) { … … 487 490 * Add the ID to the list of Tag IDs to add to the tag2post table 488 491 */ 489 $tag_ids_to_post[] = $existing_tag->id;492 $tag_ids_to_post[] = $existing_tag->id; 490 493 /* 491 494 * We remove it from the clean_tags collection as we only … … 495 498 } 496 499 if ( in_array( $existing_tag->tag_slug, array_values( $clean_tags ) ) ) { 497 $tag_ids_to_post[] = $existing_tag->id;500 $tag_ids_to_post[] = $existing_tag->id; 498 501 foreach ( $clean_tags as $text=>$slug ) { 499 502 if ( $slug == $existing_tag->tag_slug ) { … … 520 523 521 524 if (FALSE !== ($insert = DB::query( $sql_tag_new, array( $new_tag_text, $new_tag_slug ) ) ) ) 522 $tag_ids_to_post[] = DB::last_insert_id();525 $tag_ids_to_post[] = DB::last_insert_id(); 523 526 $result&= $insert; 524 527 } … … 573 576 public function insert() 574 577 { 575 $this->newfields['updated'] = HabariDateTime::date_create();578 $this->newfields['updated'] = HabariDateTime::date_create(); 576 579 $this->newfields['modified'] = $this->newfields['updated']; 577 580 $this->setguid(); … … 592 595 593 596 $result = parent::insertRecord( DB::table( 'posts' ) ); 594 $this->newfields['id'] = DB::last_insert_id(); // Make sure the id is set in the post object to match the row id597 $this->newfields['id'] = DB::last_insert_id(); // Make sure the id is set in the post object to match the row id 595 598 $this->fields = array_merge( $this->fields, $this->newfields ); 596 599 $this->newfields = array(); … … 887 890 if ( $result ) { 888 891 foreach ( $result as $t ) { 889 $this->tags[$t->tag_slug] = $t->tag_text;892 $this->tags[$t->tag_slug] = $t->tag_text; 890 893 } 891 894 } -
trunk/htdocs/system/classes/postinfo.php
r1283 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 7 /** 8 * Post metadata 9 */ 3 10 class PostInfo extends InfoRecords { 4 11 5 function __construct ( $post_id ) 12 function __construct ( $post_id ) 6 13 { 7 14 parent::__construct ( DB::table('postinfo'), "post_id", $post_id ); // call parent with appropriate parameters 8 } 15 } 9 16 } 10 17 ?> -
trunk/htdocs/system/classes/posts.php
r2862 r2973 1 1 <?php 2 /** 3 * @package Habari 4 * 5 */ 2 6 3 7 /** 4 8 * Habari Posts Class 5 9 * 6 * @package Habari7 */8 9 /**10 10 * class Posts 11 11 * This class provides two key features. … … 87 87 // If the request as a textual WHERE clause, skip the processing of the $wheresets since it's empty 88 88 if ( isset( $paramarray['where'] ) && is_string( $paramarray['where'] ) ) { 89 $wheres[] = $paramarray['where'];89 $wheres[] = $paramarray['where']; 90 90 } 91 91 else { … … 99 99 if ( is_array( $paramset['id'] ) ) { 100 100 array_walk( $paramset['id'], create_function( '&$a,$b', '$a = intval($a);' ) ); 101 $where[] = "id IN (" . implode( ',', array_fill( 0, count( $paramset['id'] ), '?' ) ) . ")";101 $where[] = "id IN (" . implode( ',', array_fill( 0, count( $paramset['id'] ), '?' ) ) . ")"; 102 102 $params = array_merge( $params, $paramset['id'] ); 103 103 } 104 104 else { 105 $where[] = "id= ?";106 $params[] = (int) $paramset['id'];105 $where[] = "id= ?"; 106 $params[] = (int) $paramset['id']; 107 107 } 108 108 } … … 112 112 $paramset['status'] = array_diff( $paramset['status'], array( 'any' ) ); 113 113 array_walk( $paramset['status'], create_function( '&$a,$b', '$a = Post::status($a);' ) ); 114 $where[] = "status IN (" . implode( ',', array_fill( 0, count( $paramset['status'] ), '?' ) ) . ")";114 $where[] = "status IN (" . implode( ',', array_fill( 0, count( $paramset['status'] ), '?' ) ) . ")"; 115 115 $params = array_merge( $params, $paramset['status'] ); 116 116 } 117 117 else { 118 $where[] = "status= ?";119 $params[] = (int) Post::status( $paramset['status'] );118 $where[] = "status= ?"; 119 $params[] = (int) Post::status( $paramset['status'] ); 120 120 } 121 121 } … … 125 125 $paramset['content_type'] = array_diff( $paramset['content_type'], array( 'any' ) ); 126 126 array_walk( $paramset['content_type'], create_function( '&$a,$b', '$a = Post::type($a);' ) ); 127 $where[] = "content_type IN (" . implode( ',', array_fill( 0, count( $paramset['content_type'] ), '?' ) ) . ")";127 $where[] = "content_type IN (" . implode( ',', array_fill( 0, count( $paramset['content_type'] ), '?' ) ) . ")"; 128 128 $params = array_merge( $params, $paramset['content_type'] ); 129 129 } 130 130 else { 131 $where[] = "content_type= ?";132 $params[] = (int) Post::type( $paramset['content_type'] );131 $where[] = "content_type= ?"; 132 $params[] = (int) Post::type( $paramset['content_type'] ); 133 133 } 134 134 } 135 135 if ( isset( $paramset['slug'] ) ) { 136 136 if ( is_array( $paramset['slug'] ) ) { 137 $where[] = "slug IN (" . implode( ',', array_fill( 0, count( $paramset['slug'] ), '?' ) ) . ")";137 $where[] = "slug IN (" . implode( ',', array_fill( 0, count( $paramset['slug'] ), '?' ) ) . ")"; 138 138 $params = array_merge( $params, $paramset['slug'] ); 139 139 } 140 140 else { 141 $where[] = "slug= ?";142 $params[] = (string) $paramset['slug'];141 $where[] = "slug= ?"; 142 $params[] = (string) $paramset['slug']; 143 143 } 144 144 } … … 146 146 if ( is_array( $paramset['user_
