示例#1
0
文件: mysql.php 项目: Zunair/xataface
 /**
  * Escapes a string according to the current DBMS's standards
  *
  * @param string $str  the string to be escaped
  *
  * @return string  the escaped string
  *
  * @see DB_common::quoteSmart()
  * @since Method available since Release 1.6.0
  */
 function escapeSimple($str)
 {
     if (function_exists('xf_db_real_escape_string')) {
         return @xf_db_real_escape_string($str, $this->connection);
     } else {
         return @xf_db_escape_string($str);
     }
 }
示例#2
0
 //$phpThumb->setParameter('fltr', 'gam|1.2');
 // set options (see phpThumb.config.php)
 // here you must preface each option with "config_"
 $phpThumb->setParameter('config_output_format', 'jpeg');
 $phpThumb->setParameter('config_imagemagick_path', '/usr/local/bin/convert');
 //$phpThumb->setParameter('config_allow_src_above_docroot', true); // needed if you're working outside DOCUMENT_ROOT, in a temp dir for example
 // generate & output thumbnail
 $output_filename = './thumbnails/' . basename($_FILES['userfile']['name']) . '_' . $thumbnail_width . '.' . $phpThumb->config_output_format;
 if ($phpThumb->GenerateThumbnail()) {
     // this line is VERY important, do not remove it!
     $output_size_x = ImageSX($phpThumb->gdimg_output);
     $output_size_y = ImageSY($phpThumb->gdimg_output);
     if ($output_filename || $capture_raw_data) {
         if ($capture_raw_data && $phpThumb->RenderOutput()) {
             // RenderOutput renders the thumbnail data to $phpThumb->outputImageData, not to a file or the browser
             xf_db_query("INSERT INTO `table` (`thumbnail`) VALUES ('" . xf_db_escape_string($phpThumb->outputImageData) . "') WHERE (`id` = '" . $id . "')");
         } elseif ($phpThumb->RenderToFile($output_filename)) {
             // do something on success
             echo 'Successfully rendered:<br><img src="' . $output_filename . '">';
         } else {
             // do something with debug/error messages
             echo 'Failed (size=' . $thumbnail_width . '):<pre>' . implode("\n\n", $phpThumb->debugmessages) . '</pre>';
         }
     } else {
         $phpThumb->OutputThumbnail();
     }
 } else {
     // do something with debug/error messages
     echo 'Failed (size=' . $thumbnail_width . ').<br>';
     echo '<div style="background-color:#FFEEDD; font-weight: bold; padding: 10px;">' . $phpThumb->fatalerror . '</div>';
     echo '<form><textarea rows="10" cols="60" wrap="off">' . htmlentities(implode("\n* ", $phpThumb->debugmessages)) . '</textarea></form><hr>';