Changeset 53
- Timestamp:
- Jan 26, 2006 8:19:32 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/App.inc.php
r52 r53 162 162 function setParam($param=null) 163 163 { 164 if (!isset($this) || !is_a($this, 'App') ) {164 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { 165 165 $this =& App::getInstance(); 166 166 } … … 181 181 function &getParam($param=null) 182 182 { 183 if (!isset($this) || !is_a($this, 'App') ) {183 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { 184 184 $this =& App::getInstance(); 185 185 } … … 356 356 function raiseMsg($message, $type=MSG_NOTICE, $file=null, $line=null) 357 357 { 358 if (!isset($this) || !is_a($this, 'App') ) {358 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { 359 359 $this =& App::getInstance(); 360 360 } … … 391 391 function getRaisedMessages() 392 392 { 393 if (!isset($this) || !is_a($this, 'App') ) {393 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { 394 394 $this =& App::getInstance(); 395 395 } … … 415 415 function clearRaisedMessages() 416 416 { 417 if (!isset($this) || !is_a($this, 'App') ) {417 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { 418 418 $this =& App::getInstance(); 419 419 } … … 435 435 function printRaisedMessages() 436 436 { 437 if (!isset($this) || !is_a($this, 'App') ) {437 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { 438 438 $this =& App::getInstance(); 439 439 } … … 493 493 static $previous_events = array(); 494 494 495 if (!isset($this) || !is_a($this, 'App') ) {495 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { 496 496 $this =& App::getInstance(); 497 497 } … … 537 537 'type' => $this->logPriorityToString($priority), 538 538 'file:line' => "$file : $line", 539 'url' => (isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : ''), 539 540 'message' => $message 540 541 ); … … 611 612 function carryQuery($query_key) 612 613 { 613 if (!isset($this) || !is_a($this, 'App') ) {614 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { 614 615 $this =& App::getInstance(); 615 616 } … … 643 644 function url($url, $carry_args=null, $always_include_sid=false) 644 645 { 645 if (!isset($this) || !is_a($this, 'App') ) {646 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { 646 647 $this =& App::getInstance(); 647 648 } … … 738 739 function oHREF($url, $carry_args=null, $always_include_sid=false) 739 740 { 740 if (!isset($this) || !is_a($this, 'App') ) {741 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { 741 742 $this =& App::getInstance(); 742 743 } … … 762 763 function printHiddenSession($carry_args=null) 763 764 { 764 if (!isset($this) || !is_a($this, 'App') ) {765 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { 765 766 $this =& App::getInstance(); 766 767 } … … 824 825 function dieURL($url, $carry_args=null, $always_include_sid=false) 825 826 { 826 if (!isset($this) || !is_a($this, 'App') ) {827 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { 827 828 $this =& App::getInstance(); 828 829 } … … 863 864 function dieBoomerangURL($id=null, $carry_args=null) 864 865 { 865 if (!isset($this) || !is_a($this, 'App') ) {866 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { 866 867 $this =& App::getInstance(); 867 868 } … … 908 909 function setBoomerangURL($url=null, $id=null) 909 910 { 910 if (!isset($this) || !is_a($this, 'App') ) {911 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { 911 912 $this =& App::getInstance(); 912 913 } … … 949 950 function getBoomerangURL($id=null) 950 951 { 951 if (!isset($this) || !is_a($this, 'App') ) {952 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { 952 953 $this =& App::getInstance(); 953 954 } … … 977 978 function deleteBoomerangURL($id=null) 978 979 { 979 if (!isset($this) || !is_a($this, 'App') ) {980 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { 980 981 $this =& App::getInstance(); 981 982 } … … 1002 1003 function validBoomerangURL($id=null, $use_nonspecificboomerang=false) 1003 1004 { 1004 if (!isset($this) || !is_a($this, 'App') ) {1005 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { 1005 1006 $this =& App::getInstance(); 1006 1007 } … … 1030 1031 1031 1032 if ('' == $url) { 1032 $this->logMsg(sprintf('validBoomerangURL(%s) not valid, empty!', $id), LOG_ NOTICE, __FILE__, __LINE__);1033 $this->logMsg(sprintf('validBoomerangURL(%s) not valid, empty!', $id), LOG_DEBUG, __FILE__, __LINE__); 1033 1034 return false; 1034 1035 } 1035 1036 if ($url == absoluteMe()) { 1036 1037 // The URL we are directing to is the current page. 1037 $this->logMsg(sprintf('validBoomerangURL(%s) not valid, same as absoluteMe: %s', $id, $url), LOG_ NOTICE, __FILE__, __LINE__);1038 $this->logMsg(sprintf('validBoomerangURL(%s) not valid, same as absoluteMe: %s', $id, $url), LOG_DEBUG, __FILE__, __LINE__); 1038 1039 return false; 1039 1040 } 1040 1041 if ($boomerang_time >= (time() - 2)) { 1041 1042 // Last boomerang direction was more than 2 seconds ago. 1042 $this->logMsg(sprintf('validBoomerangURL(%s) not valid, boomerang_time too short: %s', $id, time() - $boomerang_time), LOG_ NOTICE, __FILE__, __LINE__);1043 $this->logMsg(sprintf('validBoomerangURL(%s) not valid, boomerang_time too short: %s', $id, time() - $boomerang_time), LOG_DEBUG, __FILE__, __LINE__); 1043 1044 return false; 1044 1045 } … … 1054 1055 function sslOn() 1055 1056 { 1056 if (!isset($this) || !is_a($this, 'App') ) {1057 if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) { 1057 1058 $this =& App::getInstance(); 1058 1059 } … … 1065 1066 } 1066 1067 1067 if (' on' != getenv('HTTPS') && $this->getParam('ssl_enabled') && in_array('mod_ssl', $modules)) {1068 if ('' == getenv('HTTPS') && $this->getParam('ssl_enabled') && in_array('mod_ssl', $modules)) { 1068 1069 $this->raiseMsg(sprintf(_("Secure SSL connection made to %s"), $this->getParam('ssl_domain')), MSG_NOTICE, __FILE__, __LINE__); 1069 1070 // Always append session because some browsers do not send cookie when crossing to SSL URL. … … 1079 1080 function sslOff() 1080 1081 { 1081 if (' on' == getenv('HTTPS')) {1082 if ('' != getenv('HTTPS')) { 1082 1083 $this->dieURL('http://' . getenv('HTTP_HOST') . getenv('REQUEST_URI'), null, true); 1083 1084 } -
trunk/lib/Captcha.inc.php
r52 r53 8 8 * @author Quinn Comendant <quinn@strangecode.com> 9 9 * @version 1.0 10 ------------------------------------------------------------------------------------- 11 // Example. 12 13 // Instantiate new Captcha. This automatically generates a new 4-digit captcha number. 14 $captcha = new Captcha(); 15 16 <!-- HTML form for captcha --> 17 <label for="sc-captcha"><?php echo _("Reverse Turing Test") ?></label> 18 <p class="help"><?php echo _("Please type the following number to prove you are a human. This is a measure to prevent spam robots from submitting this form.") ?></p> 19 <pre style="font-size: 0.5em;"><?php $captcha->printAsciiNumber() ?></pre> 20 <?php $captcha->printForm() ?> 21 ------------------------------------------------------------------------------------- 10 22 */ 11 23 class Captcha { 12 24 13 25 var $secret_key = 'some random seed text for the md5'; 26 var $random_number; 14 27 var $ascii_numbers = array( 15 28 array( … … 95 108 ) 96 109 ); 110 111 /** 112 * Constructor. Initialized new random number. 113 * 114 * @access public 115 * @author Quinn Comendant <quinn@strangecode.com> 116 * @since 20 Jan 2006 13:08:22 117 */ 118 function Captcha() 119 { 120 $this->random_number = $this->_getRandomNumber(); 121 } 97 122 98 123 /** … … 129 154 130 155 /** 156 * Prints the captcha ASCII numbers. 157 * 158 * @access public 159 * @author Quinn Comendant <quinn@strangecode.com> 160 * @since 07 Dec 2005 22:09:04 161 */ 162 function printAsciiNumber() 163 { 164 $ascii = $this->getAsciiNumber($this->random_number); 165 ?><pre name="sc-captcha" id="sc-captcha"><?php echo $ascii ?></pre><?php 166 } 167 168 /** 131 169 * Prints a form to enter captcha, including the required hidden hash form. 132 170 * … … 137 175 function printForm() 138 176 { 139 $number = $this->_getRandomNumber(); 140 $hash = $this->_getMD5key($number); 141 $ascii = $this->getAsciiNumber($number); 177 $hash = $this->_getMD5key($this->random_number); 142 178 ?> 143 <label for="sc-captcha"><?php echo _("Reverse Turing Test") ?></label> 144 <p class="help"><?php echo _("Please type the following number to prove you are a human. This is a measure to prevent spam robots from submitting this form.") ?></p> 145 <pre style="font-size: 0.5em;"><?php echo $ascii ?></pre> 146 <input name="sc-captcha" id="sc-captcha" type="text" /> 147 <input name="sc-captcha-hash" type="hidden" value="<?php echo $hash ?>" /> 179 <input name="sc-captcha-input" id="sc-captcha-input" type="text" /> 180 <input name="sc-captcha-hash" id="sc-captcha-hash" type="hidden" value="<?php echo $hash ?>" /> 148 181 <?php 149 182 } … … 160 193 function valid() 161 194 { 162 $number = getFormData('sc-captcha ');195 $number = getFormData('sc-captcha-input'); 163 196 $hash = getFormData('sc-captcha-hash'); 164 197 -
trunk/lib/DB.inc.php
r52 r53 85 85 function setParam($params) 86 86 { 87 if (!isset($this) || !is_a($this, 'DB') ) {87 if (!isset($this) || !is_a($this, 'DB') && !is_subclass_of($this, 'DB')) { 88 88 $this =& DB::getInstance(); 89 89 } … … 108 108 function getParam($param) 109 109 { 110 if (!isset($this) || !is_a($this, 'DB') ) {110 if (!isset($this) || !is_a($this, 'DB') && !is_subclass_of($this, 'DB')) { 111 111 $this =& DB::getInstance(); 112 112 } … … 129 129 function connect() 130 130 { 131 if (!isset($this) || !is_a($this, 'DB') ) {131 if (!isset($this) || !is_a($this, 'DB') && !is_subclass_of($this, 'DB')) { 132 132 $this =& DB::getInstance(); 133 133 } … … 142 142 // Select database 143 143 mysql_select_db($this->getParam('db_name'), $this->dbh); 144 } else { 145 App::logMsg(sprintf('mysql_connect failed.', null), LOG_ERR, __FILE__, __LINE__); 144 146 } 145 147 … … 183 185 function close() 184 186 { 185 if (!isset($this) || !is_a($this, 'DB') ) {187 if (!isset($this) || !is_a($this, 'DB') && !is_subclass_of($this, 'DB')) { 186 188 $this =& DB::getInstance(); 187 189 } … … 204 206 function getDBH() 205 207 { 206 if (!isset($this) || !is_a($this, 'DB') ) {208 if (!isset($this) || !is_a($this, 'DB') && !is_subclass_of($this, 'DB')) { 207 209 $this =& DB::getInstance(); 208 210 } … … 239 241 static $_query_count = 0; 240 242 241 if (!isset($this) || !is_a($this, 'DB') ) {243 if (!isset($this) || !is_a($this, 'DB') && !is_subclass_of($this, 'DB')) { 242 244 $this =& DB::getInstance(); 243 245 } … … 285 287 function tableExists($table, $use_cached_results=true) 286 288 { 287 if (!isset($this) || !is_a($this, 'DB') ) {289 if (!isset($this) || !is_a($this, 'DB') && !is_subclass_of($this, 'DB')) { 288 290 $this =& DB::getInstance(); 289 291 } … … 319 321 function columnExists($table, $columns, $strict=true, $use_cached_results=true) 320 322 { 321 if (!isset($this) || !is_a($this, 'DB') ) {323 if (!isset($this) || !is_a($this, 'DB') && !is_subclass_of($this, 'DB')) { 322 324 $this =& DB::getInstance(); 323 325 } -
trunk/lib/Email.inc.php
r52 r53 280 280 // Ensure message was successfully accepted for delivery. 281 281 if (!mail($final_to, $this->_params['subject'], $final_body, $final_headers, $envelope_sender_header)) { 282 App::logMsg(sprintf('Email failure with parameters: %s, %s, %s, %s', $this->_params['to'], $this->_params['subject'], str_replace("\r\n", ' ', $final_headers), $envelope_sender_header), LOG_NOTICE, __FILE__, __LINE__);282 App::logMsg(sprintf('Email failure with parameters: %s, %s, %s, %s', $this->_params['to'], $this->_params['subject'], str_replace("\r\n", ', ', $final_headers), $envelope_sender_header), LOG_NOTICE, __FILE__, __LINE__); 283 283 return false; 284 284 } -
trunk/lib/PageNumbers.inc.php
r52 r53 248 248 $page_numbers = array(); 249 249 250 for ($i = 1; $i < $this->total_pages; $i++) {250 for ($i = 1; $i <= $this->total_pages; $i++) { 251 251 $page_numbers[] = array( 252 252 'number' => $i, -
trunk/lib/SessionCache.inc.php
r52 r53 44 44 function setParam($params) 45 45 { 46 if (!isset($this) || !is_a($this, 'SessionCache') ) {46 if (!isset($this) || !is_a($this, 'SessionCache') && !is_subclass_of($this, 'SessionCache')) { 47 47 $this =& SessionCache::getInstance(); 48 48 } … … 65 65 function getParam($param) 66 66 { 67 if (!isset($this) || !is_a($this, 'SessionCache') ) {67 if (!isset($this) || !is_a($this, 'SessionCache') && !is_subclass_of($this, 'SessionCache')) { 68 68 $this =& SessionCache::getInstance(); 69 69 } … … 95 95 function putCache($var, $var_id, $force_it_in=false) 96 96 { 97 if (!isset($this) || !is_a($this, 'SessionCache') ) {97 if (!isset($this) || !is_a($this, 'SessionCache') && !is_subclass_of($this, 'SessionCache')) { 98 98 $this =& SessionCache::getInstance(); 99 99 } … … 149 149 function getCache($var_id) 150 150 { 151 if (!isset($this) || !is_a($this, 'SessionCache') ) {151 if (!isset($this) || !is_a($this, 'SessionCache') && !is_subclass_of($this, 'SessionCache')) { 152 152 $this =& SessionCache::getInstance(); 153 153 } … … 179 179 function isCached($var_id) 180 180 { 181 if (!isset($this) || !is_a($this, 'SessionCache') ) {181 if (!isset($this) || !is_a($this, 'SessionCache') && !is_subclass_of($this, 'SessionCache')) { 182 182 $this =& SessionCache::getInstance(); 183 183 } -
trunk/lib/TemplateGlue.inc.php
r52 r53 235 235 // in the array keys. 236 236 $ps_value_count = array_count_values($preselected); 237 if ( $ps_value_count['on'] == sizeof($preselected)) {237 if (isset($ps_value_count['on']) && $ps_value_count['on'] == sizeof($preselected)) { 238 238 $preselected = array_keys($preselected); 239 239 } … … 270 270 } 271 271 // Print a cell with basic named checkboxes. 272 ?><td><input type="radio" name="<?php echo $db_col; ?>" id="<?php echo $db_col ; ?>" value="<?php echo $v ?>"<?php echo $checked; ?> /><label for="<?php echo $db_col?>"><?php echo oTxt($v); ?></label></td>272 ?><td><input type="radio" name="<?php echo $db_col; ?>" id="<?php echo $db_col . '-' . $v; ?>" value="<?php echo $v ?>"<?php echo $checked; ?> /><label class="sc-label-secondary" for="<?php echo $db_col . '-' . $v ?>"><?php echo oTxt($v); ?></label></td> 273 273 <?php 274 274 } -
trunk/lib/Utilities.inc.php
r52 r53 200 200 * @return string Encoded email. 201 201 */ 202 function encodeEmail($email, $at=' -at-', $dot='-dot-')202 function encodeEmail($email, $at=' at ', $dot=' dot ') 203 203 { 204 204 $search = array('/@/', '/\./'); -
trunk/services/lock.php
r52 r53 15 15 $boom_url = strpos(getFormData('boomerang'), '/') !== false ? getFormData('boomerang') : $_SERVER['HTTP_REFERER']; 16 16 App::setBoomerangURL($boom_url, 'lock'); 17 App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'cancel-lock'); 17 if (isset($_SERVER['HTTP_REFERER'])) { 18 App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'cancel-lock'); 19 } 18 20 } 19 21 -
trunk/tests/run_tests.sh
r52 r53 7 7 for foo in *Test.php; 8 8 do 9 php $foo;9 /usr/local/bin/php $foo; 10 10 done;
Note: See TracChangeset
for help on using the changeset viewer.