function VeriWord() { // Get Font-Files $handle = opendir($this->dir_font); $pre = 'captcha_'; while ($file = readdir($handle)) { if ($file != "." && $file != ".." && !is_dir($this->dir_font . $file)) { $nfo = pathinfo($this->dir_font . $file); $prefix = substr($nfo['basename'], 0, strlen($pre)); if ($nfo['extension'] == 'ttf' && $prefix == $pre) { $this->fonts[] = $nfo['basename']; } } } // Get Noise-Files $handle = opendir($this->dir_noise); while ($file = readdir($handle)) { if ($file != "." && $file != ".." && !is_dir($this->dir_noise . $file)) { $nfo = pathinfo($this->dir_noise . $file); if ($nfo['extension'] == 'jpg' || $nfo['extension'] == 'jpeg') { $this->noises[] = $nfo['basename']; } } } ImageTypes(); $lang = new lang(); $lang->group("thumbnail.class"); $this->lang = $lang->return_array(); if (function_exists('imagejpeg') && IMG_JPEG) { define('IMAGEJPEG', true); } else { define('IMAGEJPEG', false); } if (function_exists('imagegif') && IMG_GIF) { define('IMAGEGIF', true); } else { define('IMAGEGIF', false); } if (function_exists('imagepng') && IMG_PNG) { define('IMAGEPNG', true); } else { define('IMAGEPNG', false); } srand((double) microtime() * time()); mt_srand((double) microtime() * 1000000); }
function thumbnail() { ImageTypes(); $lang = new lang(); $lang->group("thumbnail.class"); $this->lang = $lang->return_array(); $this->path = ''; $this->mime = array(); if (function_exists('imagejpeg') && IMG_JPEG) { define('IMAGEJPEG', true); } else { define('IMAGEJPEG', false); } if (function_exists('imagegif') && IMG_GIF) { define('IMAGEGIF', true); } else { define('IMAGEGIF', false); } if (function_exists('imagepng') && IMG_PNG) { define('IMAGEPNG', true); } else { define('IMAGEPNG', false); } }
/** * Gets the correct error message. * * Methoed tries to use $lang-Object. If not available, hardcoded english phrases will be used. * * @return string error message */ function get_error() { if ($this->error == null) { return false; } $lang = new lang(); $lang->group("classes"); switch ($this->error) { case UPLOAD_ERR_FILE_INDEX: $message = $lang->phrase('upload_error_noupload'); break; case UPLOAD_ERR_FILE_SIZE: $lang->assign('mfs', formatFilesize($this->max_filesize)); $message = $lang->phrase('upload_error_maxfilesize'); break; case UPLOAD_ERR_IMAGE_WIDTH: case UPLOAD_ERR_IMAGE_HEIGHT: $lang->assign('mih', $this->max_image_height > 0 ? numbers($this->max_image_height) : $lang->phrase('upload_unspecified')); $lang->assign('miw', $this->max_image_width > 0 ? numbers($this->max_image_width) : $lang->phrase('upload_unspecified')); $message = $lang->phrase('upload_error_maximagesize'); break; case UPLOAD_ERR_FILE_TYPE: $lang->assign('aft', implode(', ', $this->file_types)); $message = $lang->phrase('upload_error_wrongfiletype'); break; case UPLOAD_ERR_COPY: $message = $lang->phrase('upload_error_noaccess'); break; case UPLOAD_ERR_FILE_EXISTS: $message = $lang->phrase('upload_error_fileexists'); break; default: $message = $lang->phrase('upload_error_default'); } if (!empty($this->file['name'])) { return "{$this->file['name']}: {$message}"; } else { return $message; } }