Changeset 84
- Timestamp:
- Apr 8, 2006 3:15:27 AM (18 years ago)
- Location:
- trunk/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/App.inc.php
r83 r84 343 343 344 344 /** 345 * Add a message to the s tring globalmessage, which is printed in the header.345 * Add a message to the session, which is printed in the header. 346 346 * Just a simple way to print messages to the user. 347 347 * … … 856 856 } 857 857 858 /** 859 * Redirects a user by calling the App::dieURL(). It will use: 860 * 1. the stored boomerang URL, it it exists 861 * 2. the referring URL, it it exists. 862 * 3. an empty string, which will force App::dieURL to use the default URL. 863 */ 864 function dieBoomerangURL($id=null, $carry_args=null) 858 /* 859 * Redirects a user by calling App::dieURL(). It will use: 860 * 1. the stored boomerang URL, it it exists 861 * 2. a specified $default_url, it it exists 862 * 3. the referring URL, it it exists. 863 * 4. redirect_home_url configuration variable. 864 * 865 * @access public 866 * @param string $id Identifier for this script. 867 * @param mixed $carry_args Additional arguments to carry in the URL automatically (see App::oHREF()). 868 * @param string $default_url A default URL if there is not a valid specified boomerang URL. 869 * @return bool False if the session is not running. No return otherwise. 870 * @author Quinn Comendant <quinn@strangecode.com> 871 * @since 31 Mar 2006 19:17:00 872 */ 873 function dieBoomerangURL($id=null, $carry_args=null, $default_url=null) 865 874 { 866 875 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { … … 883 892 // Delete stored boomerang. 884 893 $this->deleteBoomerangURL($id); 894 } else if (isset($default_url)) { 895 $url = $default_url; 896 } 885 897 } else if (!refererIsMe()) { 886 898 // Ensure that the redirecting page is not also the referrer. … … 893 905 } 894 906 895 896 // A redirection will never happen immediatly twice. 907 // A redirection will never happen immediately twice. 897 908 // Set the time so ensure this doesn't happen. 898 909 $_SESSION[$this->app]['boomerang']['time'] = time(); … … 916 927 return false; 917 928 } 918 // A redirection will never happen immediat ly after setting the boomerangURL.929 // A redirection will never happen immediately after setting the boomerangURL. 919 930 // Set the time so ensure this doesn't happen. See App::validBoomerangURL for more. 920 931 -
trunk/lib/NodeHeirarchy.inc.php
r83 r84 342 342 * @return string The parents as an array of serialized node identifiers. 343 343 */ 344 function getParents($child_type=null, $child_id=null )344 function getParents($child_type=null, $child_id=null, $type_constraint=null, $order='') 345 345 { 346 346 if (!isset($child_type) || !isset($child_id)) { … … 352 352 return false; 353 353 } 354 } 355 356 $in_clause = ''; 357 if (isset($type_constraint)) { 358 if (!is_array($type_constraint)) { 359 $type_constraint = array($type_constraint); 360 } 361 $in_clause = "AND parent_type IN ('" . join("','", array_map('addslashes', $type_constraint)) . "')"; 354 362 } 355 363 … … 359 367 WHERE child_type = '" . addslashes($child_type) . "' 360 368 AND child_id = '" . addslashes($child_id) . "' 369 $in_clause 370 " . addslashes($order) . " 361 371 "); 362 372 -
trunk/lib/Utilities.inc.php
r83 r84 192 192 193 193 /** 194 * Encodes an email into a user (at) domain (dot) comformat.194 * Encodes an email into a "user at domain dot com" format. 195 195 * 196 196 * @access public … … 205 205 $replace = array($at, $dot); 206 206 return preg_replace($search, $replace, $email); 207 } 208 209 /** 210 * Turns "a really long string" into "a rea...string" 211 * 212 * @access public 213 * @param string $str Input string 214 * @param int $len Maximum string length. 215 * @param string $where Where to cut the string. One of: 'start', 'middle', or 'end'. 216 * @return string Truncated output string 217 * @author Quinn Comendant <quinn@strangecode.com> 218 * @since 29 Mar 2006 13:48:49 219 */ 220 function truncate($str, $len, $where='middle') 221 { 222 $part1 = floor(($len - 3) / 2); 223 $part2 = ceil(($len - 3) / 2); 224 switch ($where) { 225 case 'start' : 226 return preg_replace(array(sprintf('/^.{4,}(.{%s})$/', $part1 + $part2), '/\s*\.{3,}\s*/'), array('...$1', '...'), $str); 227 break; 228 default : 229 case 'middle' : 230 return preg_replace(array(sprintf('/^(.{%s}).{4,}(.{%s})$/', $part1, $part2), '/\s*\.{3,}\s*/'), array('$1...$2', '...'), $str); 231 break; 232 case 'end' : 233 return preg_replace(array(sprintf('/^(.{%s}).{4,}$/', $part1 + $part2), '/\s*\.{3,}\s*/'), array('$1...', '...'), $str); 234 break; 235 } 207 236 } 208 237
Note: See TracChangeset
for help on using the changeset viewer.