Changeset 44
- Timestamp:
- Dec 19, 2005 7:10:45 AM (18 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/module_maker/form_template.cli.php
r43 r44 34 34 35 35 $exclude = array('added_by_user_id', 'added_datetime', 'hit_count', 'modified_datetime', 'modified_by_user_id'); 36 $primary_key _field = '';36 $primary_key = '<##>'; 37 37 $output = array(); 38 38 … … 46 46 $type = preg_replace('/^(\w+).*$/', '\\1', $col[1]); 47 47 if ('PRI' == $col[3]) { 48 $primary_key _field= $field;48 $primary_key = $field; 49 49 } 50 50 … … 54 54 } 55 55 56 if (in_array($field, $exclude) || $primary_key _field== $field) {56 if (in_array($field, $exclude) || $primary_key == $field) { 57 57 // Don't add a field for this column. 58 58 continue; … … 87 87 <td> 88 88 <input type="file" name="$field" /> 89 <\x3fphp if ('' != \$upload->getFilenameGlob(getFormData('$primary_key _field') . '_*') && getFormData('op') == 'edit' || getFormData('op') == 'update') { \x3f>90 <div class="help"><\x3fphp printf(_("The current file <a href=\"%s/%2\\\$s\"><strong>%2\\\$s</strong></a> will be deleted if a new file is selected for upload."), '/_db_files/<##>', \$upload->getFilenameGlob(getFormData('$primary_key _field') . '_*')) \x3f></div>89 <\x3fphp if ('' != \$upload->getFilenameGlob(getFormData('$primary_key') . '_*') && getFormData('op') == 'edit' || getFormData('op') == 'update') { \x3f> 90 <div class="help"><\x3fphp printf(_("The current file <a href=\"%s/%2\\\$s\"><strong>%2\\\$s</strong></a> will be deleted if a new file is selected for upload."), '/_db_files/<##>', \$upload->getFilenameGlob(getFormData('$primary_key') . '_*')) \x3f></div> 91 91 <\x3fphp } \x3f> 92 92 <div class="help"><\x3fphp printf(_("File to upload must have one of the following file-name extensions: %s."), join(', ', \$upload->getParam('valid_file_extensions'))) \x3f></div> -
trunk/bin/module_maker/list_template.cli.php
r43 r44 45 45 $cols[] = $row; 46 46 } 47 48 $primary_key = '<##>'; 47 49 48 50 // Loop through columns -
trunk/bin/module_maker/sql.cli.php
r43 r44 52 52 53 53 $sort_columns = ''; 54 $primary_key = '<##>'; 54 55 55 56 // Loop through columns -
trunk/lib/App.inc.php
r43 r44 367 367 368 368 // Save message in session under unique key to avoid duplicate messages. 369 $_SESSION[$this->app]['messages'][md5($type . $message . $file . $line)] = array( 369 $msg_id = md5($type . $message . $file . $line); 370 $_SESSION[$this->app]['messages'][$msg_id] = array( 370 371 'type' => $type, 371 372 'message' => $message, 372 373 'file' => $file, 373 'line' => $line 374 'line' => $line, 375 'count' => (isset($_SESSION[$this->app]['messages'][$msg_id]['count']) ? (1 + $_SESSION[$this->app]['messages'][$msg_id]['count']) : 1) 374 376 ); 375 377 … … 425 427 426 428 /** 427 * Logs a message to a user defined log file. Additional actions to take for428 * different types of message types can be specified (ERROR, NOTICE, etc).429 * Logs messages to defined channels: file, email, sms, and screen. Repeated messages are 430 * not repeated but printed once with count. 429 431 * 430 432 * @access public 431 *432 433 * @param string $message The text description of the message. 433 434 * @param int $priority The type of message priority (in descending order): … … 445 446 function logMsg($message, $priority=LOG_INFO, $file=null, $line=null) 446 447 { 448 static $previous_events = array(); 449 447 450 if (!isset($this) || !is_a($this, 'App')) { 448 451 $this =& App::getInstance(); … … 466 469 setlocale(LC_TIME, 'C'); 467 470 471 // Strip HTML tags except any with more than 7 characters because that's probably not a HTML tag, e.g. <email@address.com>. 472 preg_match_all('/(<[^>\s]{7,})[^>]*>/', $message, $strip_tags_allow); 473 $message = strip_tags(preg_replace('/\s+/', ' ', $message), (!empty($strip_tags_allow[1]) ? join('> ', $strip_tags_allow[1]) . '>' : null)); 474 475 // Store this event under a unique key, counting each time it occurs so that it only gets reported a limited number of times. 476 $msg_id = md5($message . $priority . $file . $line); 477 if (isset($previous_events[$msg_id])) { 478 $previous_events[$msg_id]++; 479 if ($previous_events[$msg_id] == 2) { 480 $this->logMsg(sprintf('%s (Event repeated more than %s times)', $message, $previous_events[$msg_id]), $priority, $file, $line); 481 } 482 return false; 483 } else { 484 $previous_events[$msg_id] = 1; 485 } 486 468 487 // Data to be stored for a log event. 469 $event = array(); 470 $event['date'] = date('Y-m-d H:i:s'); 471 $event['remote ip'] = getRemoteAddr(); 472 if (substr(PHP_OS, 0, 3) != 'WIN') { 473 $event['pid'] = posix_getpid(); 474 } 475 $event['type'] = $this->logPriorityToString($priority); 476 $event['file:line'] = "$file : $line"; 477 preg_match_all('/(<[^>\s]{7,})[^>]*>/', $message, $strip_tags_allow); // <...> with lots of chars maybe we don't want stripped. 478 $event['message'] = strip_tags(preg_replace('/\s+/', ' ', $message), (!empty($strip_tags_allow[1]) ? join('> ', $strip_tags_allow[1]) . '>' : null)); 479 $event_str = '[' . join('] [', $event) . ']'; 488 $event = array( 489 'date' => date('Y-m-d H:i:s'), 490 'remote ip' => getRemoteAddr(), 491 'pid' => (substr(PHP_OS, 0, 3) != 'WIN' ? posix_getpid() : ''), 492 'type' => $this->logPriorityToString($priority), 493 'file:line' => "$file : $line", 494 'message' => $message 495 ); 480 496 481 497 // FILE ACTION 482 498 if ($this->getParam('log_file_priority') && $priority <= $this->getParam('log_file_priority')) { 499 $event_str = '[' . join('] [', $event) . ']'; 483 500 error_log($event_str . "\n", 3, $this->getParam('log_directory') . '/' . $this->getParam('log_filename')); 484 501 } -
trunk/lib/Nav.inc.php
r43 r44 261 261 * @access public 262 262 * 263 * @param mixed $page The URI of the page to query .263 * @param mixed $page The URI of the page to query, with PREG express markup, if needed. 264 264 * @param mixed $return The value to return if the current page matches the page queried. 265 265 * 266 * @return bool True on success, false on failure.266 * @return mixed The value set for $return, TRUE by default. 267 267 */ 268 268 function currentPage($page_uri, $return=true) 269 269 { 270 if (preg_match('/^' . preg_quote($page_uri, '/') . '/i', $_SERVER['PHP_SELF'])) { 270 $page_uri = str_replace('/', '\/', $page_uri); 271 if (preg_match('/^' . $page_uri . '/i', $_SERVER['PHP_SELF'])) { 271 272 return $return; 272 273 } -
trunk/lib/SessionCache.inc.php
r43 r44 100 100 101 101 if (!$this->getParam('enabled')) { 102 App::logMsg(sprintf('SessionCache not enabled, not saving data.', null), LOG_DEBUG, __FILE__, __LINE__); 102 103 return false; 103 104 } -
trunk/lib/SortOrder.inc.php
r43 r44 106 106 107 107 /** 108 * Set sort and order values. This is how you set new sort values after108 * Forcibly set sort and order values. This is how you set new sort values after 109 109 * already declaring a SortOrder object. This will ignore getFormData values. 110 110 * 111 * @param string $col The database column to sort by. 112 * @param string $col_name The human-readable title of the column. 113 * @param string $default_order The default order for this column (ASC, 111 * @param string $sort The sort by name. 112 * @param string $order The order direction (ASC, 114 113 * for example, for an alphabetical sort) 115 114 */ … … 144 143 145 144 if (!empty($this->_columns[strtolower($this->sort_by)][strtolower($this->order)])) { 146 return ' ORDER BY ' . addslashes($this->_columns[strtolower($this->sort_by)][strtolower($this->order)]);145 return sprintf(' ORDER BY %s ', addslashes($this->_columns[strtolower($this->sort_by)][strtolower($this->order)])); 147 146 } else { 148 147 App::logMsg(sprintf('Could not find SQL to sort by %s %s.', $this->sort_by, $this->order), LOG_WARNING, __FILE__, __LINE__);
Note: See TracChangeset
for help on using the changeset viewer.