Trimming trailing blank space.
This commit is contained in:
parent
3d1217a1be
commit
7eb2bd9112
5 changed files with 37 additions and 37 deletions
|
@ -284,7 +284,7 @@ class Database {
|
|||
* (ie: True if beginTransaction() already called)
|
||||
*/
|
||||
public $transaction = false;
|
||||
|
||||
|
||||
/**
|
||||
* For now, only connect to the cache, as we will pretty much certainly
|
||||
* need it. There are some pages where all the data is in cache, so the
|
||||
|
@ -359,7 +359,7 @@ class Database {
|
|||
$this->transaction = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function commit() {
|
||||
if(!is_null($this->db)) {
|
||||
if ($this->transaction === true) {
|
||||
|
@ -417,7 +417,7 @@ class Database {
|
|||
}
|
||||
}
|
||||
$stmt->execute();
|
||||
}
|
||||
}
|
||||
else {
|
||||
$stmt->execute($args);
|
||||
}
|
||||
|
@ -494,13 +494,13 @@ class Database {
|
|||
if(is_null($this->engine)) $this->connect_engine();
|
||||
$this->execute($this->engine->create_table_sql($name, $data));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of tables present in the current database.
|
||||
*/
|
||||
public function count_tables() {
|
||||
if(is_null($this->db) || is_null($this->engine)) $this->connect_db();
|
||||
|
||||
|
||||
if($this->engine->name === "mysql") {
|
||||
return count(
|
||||
$this->get_all("SHOW TABLES")
|
||||
|
|
|
@ -146,7 +146,7 @@ class CommandEvent extends Event {
|
|||
$opts = array();
|
||||
$log_level = SCORE_LOG_WARNING;
|
||||
$arg_count = count($args);
|
||||
|
||||
|
||||
for($i=1; $i<$arg_count; $i++) {
|
||||
switch($args[$i]) {
|
||||
case '-u':
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<?php
|
||||
/**
|
||||
* \page eande Events and Extensions
|
||||
*
|
||||
*
|
||||
* An event is a little blob of data saying "something happened", possibly
|
||||
* "something happened, here's the specific data". Events are sent with the
|
||||
* send_event() function. Since events can store data, they can be used to
|
||||
* return data to the extension which sent them, for example:
|
||||
*
|
||||
*
|
||||
* \code
|
||||
* $tfe = new TextFormattingEvent($original_text);
|
||||
* send_event($tfe);
|
||||
* $formatted_text = $tfe->formatted;
|
||||
* \endcode
|
||||
*
|
||||
*
|
||||
* An extension is something which is capable of reacting to events.
|
||||
*
|
||||
*
|
||||
|
@ -25,7 +25,7 @@
|
|||
* $this->username = $username;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
*
|
||||
* public class Hello extends Extension {
|
||||
* public function onPageRequest(PageRequestEvent $event) { // Every time a page request is sent
|
||||
* global $user; // Look at the global "currently logged in user" object
|
||||
|
@ -149,13 +149,13 @@ abstract class DataHandlerExtension extends Extension {
|
|||
/* Check if we are replacing an image */
|
||||
if(array_key_exists('replace', $event->metadata) && isset($event->metadata['replace'])) {
|
||||
/* hax: This seems like such a dirty way to do this.. */
|
||||
|
||||
|
||||
/* Validate things */
|
||||
$image_id = int_escape($event->metadata['replace']);
|
||||
|
||||
|
||||
/* Check to make sure the image exists. */
|
||||
$existing = Image::by_id($image_id);
|
||||
|
||||
|
||||
if(is_null($existing)) {
|
||||
throw new UploadException("Image to replace does not exist!");
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ abstract class DataHandlerExtension extends Extension {
|
|||
// even more hax..
|
||||
$event->metadata['tags'] = $existing->get_tag_list();
|
||||
$image = $this->create_image_from_data(warehouse_path("images", $event->metadata['hash']), $event->metadata);
|
||||
|
||||
|
||||
if(is_null($image)) {
|
||||
throw new UploadException("Data handler failed to create image object from data");
|
||||
}
|
||||
|
@ -183,13 +183,13 @@ abstract class DataHandlerExtension extends Extension {
|
|||
$iae = new ImageAdditionEvent($image);
|
||||
send_event($iae);
|
||||
$event->image_id = $iae->image->id;
|
||||
|
||||
|
||||
// Rating Stuff.
|
||||
if(!empty($event->metadata['rating'])){
|
||||
$rating = $event->metadata['rating'];
|
||||
send_event(new RatingSetEvent($image, $rating));
|
||||
}
|
||||
|
||||
|
||||
// Locked Stuff.
|
||||
if(!empty($event->metadata['locked'])){
|
||||
$locked = $event->metadata['locked'];
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
|
||||
/**
|
||||
* \page search Shimmie2: Searching
|
||||
*
|
||||
*
|
||||
* The current search system is built of several search item -> image ID list
|
||||
* translators, eg:
|
||||
*
|
||||
*
|
||||
* \li the item "fred" will search the image_tags table to find image IDs with the fred tag
|
||||
* \li the item "size=640x480" will search the images table to find image IDs of 640x480 images
|
||||
*
|
||||
*
|
||||
* So the search "fred size=640x480" will calculate two lists and take the
|
||||
* intersection. (There are some optimisations in there making it more
|
||||
* complicated behind the scenes, but as long as you can turn a single word
|
||||
|
@ -144,7 +144,7 @@ class Image {
|
|||
/*
|
||||
* Image-related utility functions
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Count the number of image results for a given search
|
||||
*/
|
||||
|
@ -152,7 +152,7 @@ class Image {
|
|||
assert(is_array($tags));
|
||||
global $database;
|
||||
$tag_count = count($tags);
|
||||
|
||||
|
||||
if($tag_count === 0) {
|
||||
$total = $database->cache->get("image-count");
|
||||
if(!$total) {
|
||||
|
@ -312,9 +312,9 @@ class Image {
|
|||
*/
|
||||
public function get_thumb_link() {
|
||||
global $config;
|
||||
|
||||
|
||||
$image_tlink = $config->get_string('image_tlink'); // store a copy for speed.
|
||||
|
||||
|
||||
if( !empty($image_tlink) ) { /* empty is faster than strlen */
|
||||
if(!startsWith($image_tlink, "http://") && !startsWith($image_tlink, "/")) {
|
||||
$image_tlink = make_link($image_tlink);
|
||||
|
@ -339,7 +339,7 @@ class Image {
|
|||
global $config;
|
||||
$tt = $this->parse_link_template($config->get_string('image_tip'), "no_escape");
|
||||
|
||||
// Removes the size tag if the file is an mp3
|
||||
// Removes the size tag if the file is an mp3
|
||||
if($this->ext === 'mp3'){
|
||||
$iitip = $tt;
|
||||
$mp3tip = array("0x0");
|
||||
|
@ -546,7 +546,7 @@ class Image {
|
|||
@unlink($this->get_image_filename());
|
||||
@unlink($this->get_thumb_filename());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Someone please explain this
|
||||
*
|
||||
|
@ -830,7 +830,7 @@ class Image {
|
|||
$terms = Tag::resolve_aliases($terms);
|
||||
|
||||
reset($terms); // rewind to first element in array.
|
||||
|
||||
|
||||
// turn each term into a specific type of querylet
|
||||
foreach($terms as $term) {
|
||||
$negative = false;
|
||||
|
@ -866,7 +866,7 @@ class Image {
|
|||
//$terms["tag$tag_n"] = $tq->tag;
|
||||
$terms['tag'.$tag_n] = $tq->tag;
|
||||
$tag_n++;
|
||||
|
||||
|
||||
if($sign === "+") $positive_tag_count++;
|
||||
else $negative_tag_count++;
|
||||
}
|
||||
|
@ -920,7 +920,7 @@ class Image {
|
|||
else {
|
||||
$s_tag_array = array_map("sql_escape", $tag_search->variables);
|
||||
$s_tag_list = join(', ', $s_tag_array);
|
||||
|
||||
|
||||
$tag_id_array = array();
|
||||
$tags_ok = true;
|
||||
foreach($tag_search->variables as $tag) {
|
||||
|
@ -991,7 +991,7 @@ class Tag {
|
|||
*/
|
||||
public static function explode($tags, $tagme=true) {
|
||||
assert(is_string($tags) || is_array($tags));
|
||||
|
||||
|
||||
if(is_string($tags)) {
|
||||
$tags = explode(' ', trim($tags));
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ function bool_escape($input) {
|
|||
/*
|
||||
Sometimes, I don't like PHP -- this, is one of those times...
|
||||
"a boolean FALSE is not considered a valid boolean value by this function."
|
||||
Yay for Got'chas!
|
||||
Yay for Got'chas!
|
||||
http://php.net/manual/en/filter.filters.validate.php
|
||||
*/
|
||||
if (is_bool($input)) {
|
||||
|
@ -555,7 +555,7 @@ function getMimeType($file, $ext="", $list=false) {
|
|||
$type = trim(mime_content_type($file));
|
||||
|
||||
if ($type !== false && strlen($type) > 0) return $type;
|
||||
|
||||
|
||||
return 'application/octet-stream';
|
||||
}
|
||||
|
||||
|
@ -654,20 +654,20 @@ function get_memory_limit() {
|
|||
// thumbnail generation requires lots of memory
|
||||
$default_limit = 8*1024*1024; // 8 MB of memory is PHP's default.
|
||||
$shimmie_limit = parse_shorthand_int($config->get_int("thumb_mem_limit"));
|
||||
|
||||
|
||||
if($shimmie_limit < 3*1024*1024) {
|
||||
// we aren't going to fit, override
|
||||
$shimmie_limit = $default_limit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Get PHP's configured memory limit.
|
||||
Note that this is set to -1 for NO memory limit.
|
||||
|
||||
|
||||
http://ca2.php.net/manual/en/ini.core.php#ini.memory-limit
|
||||
*/
|
||||
$memory = parse_shorthand_int(ini_get("memory_limit"));
|
||||
|
||||
|
||||
if($memory == -1) {
|
||||
// No memory limit.
|
||||
// Return the larger of the set limits.
|
||||
|
@ -1214,7 +1214,7 @@ function get_debug_info() {
|
|||
$i_files = count(get_included_files());
|
||||
$hits = $database->cache->get_hits();
|
||||
$miss = $database->cache->get_misses();
|
||||
|
||||
|
||||
$debug = "<br>Took $time seconds and {$i_mem}MB of RAM";
|
||||
$debug .= "; Used $i_files files and $_execs queries";
|
||||
$debug .= "; Sent $_event_count events";
|
||||
|
@ -1435,7 +1435,7 @@ function _start_coverage() {
|
|||
|
||||
function _end_coverage() {
|
||||
if(function_exists("xdebug_get_code_coverage")) {
|
||||
// Absolute path is necessary because working directory
|
||||
// Absolute path is necessary because working directory
|
||||
// inside register_shutdown_function is unpredictable.
|
||||
$absolute_path = dirname(dirname(__FILE__)) . "/data/coverage";
|
||||
if(!file_exists($absolute_path)) mkdir($absolute_path);
|
||||
|
|
Reference in a new issue