Пример #1
0
function getEntry($num)
{
    global $r;
    if (!file_exists("data/" . int_esc($num) . "/entry")) {
        return "";
    }
    $entry = file("data/" . int_esc($num) . "/entry");
    $textile = new Textile();
    $body = join("\n", array_slice($entry, 2));
    $size = split("\\.", $entry[0]);
    return "<a href='{$r}/?e={$num}'>#{$num}</a> <a href='{$entry['0']}'>{$entry['1']} [" . size_readable($size[2]) . "]</a> <br />\n\tDescription:\n\t" . $textile->TextileRestricted($body) . "\n\t<p class='entrylinks'><a href='{$r}/?e={$num}'>Comments[" . getCommentsNum($num) . "] »</a> </p>\n\t";
}
 /**
  * Constructor. Checks if the file has been uploaded
  *
  * The constructor takes $_FILES['form_field'] array as argument
  * where form_field is the form field name
  *
  * The constructor will check if the file has been uploaded in its temporary location, and
  * accordingly will set {@link uploaded} (and {@link error} is an error occurred)
  *
  * If the file has been uploaded, the constructor will populate all the variables holding the upload
  * information (none of the processing class variables are used here).
  * You can have access to information about the file (name, size, MIME type...).
  *
  *
  * Alternatively, you can set the first argument to be a local filename (string)
  * This allows processing of a local file, as if the file was uploaded
  *
  * The optional second argument allows you to set the language for the error messages
  *
  * @access private
  * @param  array  $file $_FILES['form_field']
  *    or   string $file Local filename
  * @param  string $lang Optional language code
  */
 function upload($file, $lang = 'en_GB')
 {
     $this->version = '0.33dev';
     $this->file_src_name = '';
     $this->file_src_name_body = '';
     $this->file_src_name_ext = '';
     $this->file_src_mime = '';
     $this->file_src_size = '';
     $this->file_src_error = '';
     $this->file_src_pathname = '';
     $this->file_src_temp = '';
     $this->file_dst_path = '';
     $this->file_dst_name = '';
     $this->file_dst_name_body = '';
     $this->file_dst_name_ext = '';
     $this->file_dst_pathname = '';
     $this->image_src_x = null;
     $this->image_src_y = null;
     $this->image_src_bits = null;
     $this->image_src_type = null;
     $this->image_src_pixels = null;
     $this->image_dst_x = 0;
     $this->image_dst_y = 0;
     $this->image_dst_type = '';
     $this->uploaded = true;
     $this->no_upload_check = false;
     $this->processed = true;
     $this->error = '';
     $this->log = '';
     $this->allowed = array();
     $this->forbidden = array();
     $this->file_is_image = false;
     $this->init();
     $info = null;
     $mime_from_browser = null;
     // sets default language
     $this->translation = array();
     $this->translation['file_error'] = 'File error. Please try again.';
     $this->translation['local_file_missing'] = 'Local file doesn\'t exist.';
     $this->translation['local_file_not_readable'] = 'Local file is not readable.';
     $this->translation['uploaded_too_big_ini'] = 'File upload error (the uploaded file exceeds %s - the upload_max_filesize server directive set in php.ini).';
     $this->translation['uploaded_too_big_html'] = 'File upload error (the uploaded file exceeds %s - the MAX_FILE_SIZE directive that was specified in the upload form).';
     $this->translation['uploaded_partial'] = 'File upload error (the uploaded file was only partially uploaded).';
     $this->translation['uploaded_missing'] = 'File upload error (no file was uploaded).';
     $this->translation['uploaded_no_tmp_dir'] = 'File upload error (missing a temporary folder).';
     $this->translation['uploaded_cant_write'] = 'File upload error (failed to write file to disk).';
     $this->translation['uploaded_err_extension'] = 'File upload error (extension not allowed for upload).';
     $this->translation['uploaded_unknown'] = 'File upload error (unknown error code).';
     $this->translation['try_again'] = 'File upload error. Please try again.';
     $this->translation['file_too_big'] = 'File too big (%s).';
     $this->translation['no_mime'] = 'MIME type can\'t be detected.';
     $this->translation['incorrect_file'] = 'Incorrect type of file.';
     $this->translation['image_too_wide'] = 'Image too wide (<= %s).';
     $this->translation['image_too_narrow'] = 'Image too narrow (>= %s).';
     $this->translation['image_too_high'] = 'Image too high (<= %s).';
     $this->translation['image_too_short'] = 'Image too short (>= %s).';
     $this->translation['ratio_too_high'] = 'Image ratio too high (image too wide) (<= %s).';
     $this->translation['ratio_too_low'] = 'Image ratio too low (image too high) (>= %s).';
     $this->translation['too_many_pixels'] = 'Image has too many pixels (<= %s).';
     $this->translation['not_enough_pixels'] = 'Image has not enough pixels (>= %s).';
     $this->translation['file_not_uploaded'] = 'File not uploaded. Can\'t carry on a process.';
     $this->translation['already_exists'] = '%s already exists. Please change the file name.';
     $this->translation['temp_file_missing'] = 'No correct temp source file. Can\'t carry on a process.';
     $this->translation['source_missing'] = 'No correct uploaded source file. Can\'t carry on a process.';
     $this->translation['destination_dir'] = 'Destination directory can\'t be created. Can\'t carry on a process.';
     $this->translation['destination_dir_missing'] = 'Destination directory doesn\'t exist. Can\'t carry on a process.';
     $this->translation['destination_path_not_dir'] = 'Destination path is not a directory. Can\'t carry on a process.';
     $this->translation['destination_dir_write'] = 'Destination directory can\'t be made writeable. Can\'t carry on a process.';
     $this->translation['destination_path_write'] = 'Destination path is not a writeable. Can\'t carry on a process.';
     $this->translation['temp_file'] = 'Can\'t create the temporary file. Can\'t carry on a process.';
     $this->translation['source_not_readable'] = 'Source file is not readable. Can\'t carry on a process.';
     $this->translation['no_create_support'] = 'No create from %s support.';
     $this->translation['create_error'] = 'Error in creating %s image from source.';
     $this->translation['source_invalid'] = 'Can\'t read image source. Not an image?';
     $this->translation['gd_missing'] = 'GD doesn\'t seem to be present.';
     $this->translation['watermark_no_create_support'] = 'No create from %s support, can\'t read watermark.';
     $this->translation['watermark_create_error'] = 'No %s read support, can\'t create watermark.';
     $this->translation['watermark_invalid'] = 'Unknown image format, can\'t read watermark.';
     $this->translation['file_create'] = 'No %s create support.';
     $this->translation['no_conversion_type'] = 'No conversion type defined.';
     $this->translation['copy_failed'] = 'Error copying file on the server. copy() failed.';
     $this->translation['reading_failed'] = 'Error reading the file.';
     // determines the language
     $this->lang = $lang;
     if ($this->lang != 'en_GB' && file_exists(dirname(__FILE__) . '/lang') && file_exists(dirname(__FILE__) . '/lang/class.upload.' . $lang . '.php')) {
         $translation = null;
         include dirname(__FILE__) . '/lang/class.upload.' . $lang . '.php';
         if (is_array($translation)) {
             $this->translation = array_merge($this->translation, $translation);
         } else {
             $this->lang = 'en_GB';
         }
     }
     // determines the supported MIME types, and matching image format
     $this->image_supported = array();
     if ($this->gdversion()) {
         if (imagetypes() & IMG_GIF) {
             $this->image_supported['image/gif'] = 'gif';
         }
         if (imagetypes() & IMG_JPG) {
             $this->image_supported['image/jpg'] = 'jpg';
             $this->image_supported['image/jpeg'] = 'jpg';
             $this->image_supported['image/pjpeg'] = 'jpg';
         }
         if (imagetypes() & IMG_PNG) {
             $this->image_supported['image/png'] = 'png';
             $this->image_supported['image/x-png'] = 'png';
         }
         if (imagetypes() & IMG_WBMP) {
             $this->image_supported['image/bmp'] = 'bmp';
             $this->image_supported['image/x-ms-bmp'] = 'bmp';
             $this->image_supported['image/x-windows-bmp'] = 'bmp';
         }
     }
     // display some system information
     if (empty($this->log)) {
         $this->log .= '<b>system information</b><br />';
         if (function_exists('ini_get_all')) {
             $inis = ini_get_all();
             $open_basedir = array_key_exists('open_basedir', $inis) && array_key_exists('local_value', $inis['open_basedir']) && !empty($inis['open_basedir']['local_value']) ? $inis['open_basedir']['local_value'] : false;
         } else {
             $open_basedir = false;
         }
         $gd = $this->gdversion() ? $this->gdversion(true) : 'GD not present';
         $supported = trim((in_array('png', $this->image_supported) ? 'png' : '') . ' ' . (in_array('jpg', $this->image_supported) ? 'jpg' : '') . ' ' . (in_array('gif', $this->image_supported) ? 'gif' : '') . ' ' . (in_array('bmp', $this->image_supported) ? 'bmp' : ''));
         $this->log .= '-&nbsp;class version           : ' . $this->version . '<br />';
         $this->log .= '-&nbsp;operating system        : ' . PHP_OS . '<br />';
         $this->log .= '-&nbsp;PHP version             : ' . PHP_VERSION . '<br />';
         $this->log .= '-&nbsp;GD version              : ' . $gd . '<br />';
         $this->log .= '-&nbsp;supported image types   : ' . (!empty($supported) ? $supported : 'none') . '<br />';
         $this->log .= '-&nbsp;open_basedir            : ' . (!empty($open_basedir) ? $open_basedir : 'no restriction') . '<br />';
         $this->log .= '-&nbsp;upload_max_filesize     : ' . $this->file_max_size_raw . ' (' . $this->file_max_size . ' bytes)<br />';
         $this->log .= '-&nbsp;language                : ' . $this->lang . '<br />';
     }
     if (!$file) {
         $this->uploaded = false;
         $this->error = $this->translate('file_error');
     }
     // check if we sent a local filename or a PHP stream rather than a $_FILE element
     if (!is_array($file)) {
         if (empty($file)) {
             $this->uploaded = false;
             $this->error = $this->translate('file_error');
         } else {
             if (substr($file, 0, 4) == 'php:') {
                 // this is a local filename, i.e.not uploaded
                 $file = preg_replace('/^php:(.*)/i', '$1', $file);
                 if (!$file) {
                     $file = $_SERVER['HTTP_X_FILE_NAME'];
                 }
                 if (!$file) {
                     $file = 'unknown';
                 }
                 $this->log .= '<b>' . $this->translate("source is a PHP stream") . ' ' . $file . '</b><br />';
                 $this->no_upload_check = TRUE;
                 $this->log .= '- this is a PHP stream, requires a temp file ... ';
                 $hash = $this->temp_dir() . md5($file . rand(1, 1000));
                 if (file_put_contents($hash, file_get_contents('php://input'))) {
                     $this->file_src_pathname = $hash;
                     $this->log .= ' file created<br />';
                     $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;temp file is: ' . $this->file_src_pathname . '<br />';
                 } else {
                     $this->log .= ' failed<br />';
                     $this->uploaded = false;
                     $this->error = $this->translate('temp_file');
                 }
                 if ($this->uploaded) {
                     $this->file_src_name = $file;
                     $this->log .= '- local file OK<br />';
                     preg_match('/\\.([^\\.]*$)/', $this->file_src_name, $extension);
                     if (is_array($extension) && sizeof($extension) > 0) {
                         $this->file_src_name_ext = strtolower($extension[1]);
                         $this->file_src_name_body = substr($this->file_src_name, 0, strlen($this->file_src_name) - strlen($this->file_src_name_ext) - 1);
                     } else {
                         $this->file_src_name_ext = '';
                         $this->file_src_name_body = $this->file_src_name;
                     }
                     $this->file_src_size = file_exists($this->file_src_pathname) ? filesize($this->file_src_pathname) : 0;
                 }
                 $this->file_src_error = 0;
             } else {
                 // this is a local filename, i.e.not uploaded
                 $this->log .= '<b>' . $this->translate("source is a local file") . ' ' . $file . '</b><br />';
                 $this->no_upload_check = TRUE;
                 if ($this->uploaded && !file_exists($file)) {
                     $this->uploaded = false;
                     $this->error = $this->translate('local_file_missing');
                 }
                 if ($this->uploaded && !is_readable($file)) {
                     $this->uploaded = false;
                     $this->error = $this->translate('local_file_not_readable');
                 }
                 if ($this->uploaded) {
                     $this->file_src_pathname = $file;
                     $this->file_src_name = basename($file);
                     $this->log .= '- local file name OK<br />';
                     preg_match('/\\.([^\\.]*$)/', $this->file_src_name, $extension);
                     if (is_array($extension) && sizeof($extension) > 0) {
                         $this->file_src_name_ext = strtolower($extension[1]);
                         $this->file_src_name_body = substr($this->file_src_name, 0, strlen($this->file_src_name) - strlen($this->file_src_name_ext) - 1);
                     } else {
                         $this->file_src_name_ext = '';
                         $this->file_src_name_body = $this->file_src_name;
                     }
                     $this->file_src_size = file_exists($this->file_src_pathname) ? filesize($this->file_src_pathname) : 0;
                 }
                 $this->file_src_error = 0;
             }
         }
     } else {
         // this is an element from $_FILE, i.e. an uploaded file
         $this->log .= '<b>source is an uploaded file</b><br />';
         if ($this->uploaded) {
             $this->file_src_error = trim($file['error']);
             switch ($this->file_src_error) {
                 case UPLOAD_ERR_OK:
                     // all is OK
                     $this->log .= '- upload OK<br />';
                     break;
                 case UPLOAD_ERR_INI_SIZE:
                     $this->uploaded = false;
                     $this->error = sprintf($this->translate('uploaded_too_big_ini'), size_readable(sprintf("%u", $this->file_max_size)));
                     break;
                 case UPLOAD_ERR_FORM_SIZE:
                     $this->uploaded = false;
                     $this->error = sprintf($this->translate('uploaded_too_big_html'), size_readable(sprintf("%u", $this->file_max_size)));
                     break;
                 case UPLOAD_ERR_PARTIAL:
                     $this->uploaded = false;
                     $this->error = $this->translate('uploaded_partial');
                     break;
                 case UPLOAD_ERR_NO_FILE:
                     $this->uploaded = false;
                     $this->error = $this->translate('uploaded_missing');
                     break;
                 case @UPLOAD_ERR_NO_TMP_DIR:
                     $this->uploaded = false;
                     $this->error = $this->translate('uploaded_no_tmp_dir');
                     break;
                 case @UPLOAD_ERR_CANT_WRITE:
                     $this->uploaded = false;
                     $this->error = $this->translate('uploaded_cant_write');
                     break;
                 case @UPLOAD_ERR_EXTENSION:
                     $this->uploaded = false;
                     $this->error = $this->translate('uploaded_err_extension');
                     break;
                 default:
                     $this->uploaded = false;
                     $this->error = $this->translate('uploaded_unknown') . ' (' . $this->file_src_error . ')';
             }
         }
         if ($this->uploaded) {
             $this->file_src_pathname = $file['tmp_name'];
             $this->file_src_name = $file['name'];
             if ($this->file_src_name == '') {
                 $this->uploaded = false;
                 $this->error = $this->translate('try_again');
             }
         }
         if ($this->uploaded) {
             $this->log .= '- file name OK<br />';
             preg_match('/\\.([^\\.]*$)/', $this->file_src_name, $extension);
             if (is_array($extension) && sizeof($extension) > 0) {
                 $this->file_src_name_ext = strtolower($extension[1]);
                 $this->file_src_name_body = substr($this->file_src_name, 0, strlen($this->file_src_name) - strlen($this->file_src_name_ext) - 1);
             } else {
                 $this->file_src_name_ext = '';
                 $this->file_src_name_body = $this->file_src_name;
             }
             $this->file_src_size = $file['size'];
             $mime_from_browser = $file['type'];
         }
     }
     if ($this->uploaded) {
         $this->log .= '<b>determining MIME type</b><br />';
         $this->file_src_mime = null;
         // checks MIME type with Fileinfo PECL extension
         if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === FALSE) {
             if ($this->mime_fileinfo) {
                 $this->log .= '- Checking MIME type with Fileinfo PECL extension<br />';
                 if (function_exists('finfo_open')) {
                     $path = null;
                     if ($this->mime_fileinfo !== '') {
                         if ($this->mime_fileinfo === true) {
                             if (getenv('MAGIC') === FALSE) {
                                 if (substr(PHP_OS, 0, 3) == 'WIN') {
                                     $path = realpath(ini_get('extension_dir') . '/../') . 'extras/magic';
                                     $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;MAGIC path defaults to ' . $path . '<br />';
                                 }
                             } else {
                                 $path = getenv('MAGIC');
                                 $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;MAGIC path is set to ' . $path . ' from MAGIC variable<br />';
                             }
                         } else {
                             $path = $this->mime_fileinfo;
                             $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;MAGIC path is set to ' . $path . '<br />';
                         }
                     }
                     if ($path) {
                         $f = @finfo_open(FILEINFO_MIME, $path);
                     } else {
                         $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;MAGIC path will not be used<br />';
                         $f = @finfo_open(FILEINFO_MIME);
                     }
                     if (is_resource($f)) {
                         $mime = finfo_file($f, realpath($this->file_src_pathname));
                         finfo_close($f);
                         $this->file_src_mime = $mime;
                         $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;MIME type detected as ' . $this->file_src_mime . ' by Fileinfo PECL extension<br />';
                         if (preg_match("/^([\\.\\-\\w]+)\\/([\\.\\-\\w]+)(.*)\$/i", $this->file_src_mime)) {
                             $this->file_src_mime = preg_replace("/^([\\.\\-\\w]+)\\/([\\.\\-\\w]+)(.*)\$/i", '$1/$2', $this->file_src_mime);
                             $this->log .= '-&nbsp;MIME validated as ' . $this->file_src_mime . '<br />';
                         } else {
                             $this->file_src_mime = null;
                         }
                     } else {
                         $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;Fileinfo PECL extension failed (finfo_open)<br />';
                     }
                 } elseif (@class_exists('finfo')) {
                     $f = new finfo(FILEINFO_MIME);
                     if ($f) {
                         $this->file_src_mime = $f->file(realpath($this->file_src_pathname));
                         $this->log .= '- MIME type detected as ' . $this->file_src_mime . ' by Fileinfo PECL extension<br />';
                         if (preg_match("/^([\\.\\-\\w]+)\\/([\\.\\-\\w]+)(.*)\$/i", $this->file_src_mime)) {
                             $this->file_src_mime = preg_replace("/^([\\.\\-\\w]+)\\/([\\.\\-\\w]+)(.*)\$/i", '$1/$2', $this->file_src_mime);
                             $this->log .= '-&nbsp;MIME validated as ' . $this->file_src_mime . '<br />';
                         } else {
                             $this->file_src_mime = null;
                         }
                     } else {
                         $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;Fileinfo PECL extension failed (finfo)<br />';
                     }
                 } else {
                     $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;Fileinfo PECL extension not available<br />';
                 }
             } else {
                 $this->log .= '- Fileinfo PECL extension deactivated<br />';
             }
         }
         // checks MIME type with shell if unix access is authorized
         if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === FALSE) {
             if ($this->mime_file) {
                 $this->log .= '- Checking MIME type with UNIX file() command<br />';
                 if (substr(PHP_OS, 0, 3) != 'WIN') {
                     if (function_exists('exec') && function_exists('escapeshellarg') && !extension_loaded('suhosin')) {
                         if (strlen($mime = @exec("file -bi " . escapeshellarg($this->file_src_pathname))) != 0) {
                             $this->file_src_mime = trim($mime);
                             $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;MIME type detected as ' . $this->file_src_mime . ' by UNIX file() command<br />';
                             if (preg_match("/^([\\.\\-\\w]+)\\/([\\.\\-\\w]+)(.*)\$/i", $this->file_src_mime)) {
                                 $this->file_src_mime = preg_replace("/^([\\.\\-\\w]+)\\/([\\.\\-\\w]+)(.*)\$/i", '$1/$2', $this->file_src_mime);
                                 $this->log .= '-&nbsp;MIME validated as ' . $this->file_src_mime . '<br />';
                             } else {
                                 $this->file_src_mime = null;
                             }
                         } else {
                             $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;UNIX file() command failed<br />';
                         }
                     } else {
                         $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;PHP exec() function is disabled<br />';
                     }
                 } else {
                     $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;UNIX file() command not available<br />';
                 }
             } else {
                 $this->log .= '- UNIX file() command is deactivated<br />';
             }
         }
         // checks MIME type with mime_magic
         if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === FALSE) {
             if ($this->mime_magic) {
                 $this->log .= '- Checking MIME type with mime.magic file (mime_content_type())<br />';
                 if (function_exists('mime_content_type')) {
                     $this->file_src_mime = mime_content_type($this->file_src_pathname);
                     $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;MIME type detected as ' . $this->file_src_mime . ' by mime_content_type()<br />';
                     if (preg_match("/^([\\.\\-\\w]+)\\/([\\.\\-\\w]+)(.*)\$/i", $this->file_src_mime)) {
                         $this->file_src_mime = preg_replace("/^([\\.\\-\\w]+)\\/([\\.\\-\\w]+)(.*)\$/i", '$1/$2', $this->file_src_mime);
                         $this->log .= '-&nbsp;MIME validated as ' . $this->file_src_mime . '<br />';
                     } else {
                         $this->file_src_mime = null;
                     }
                 } else {
                     $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;mime_content_type() is not available<br />';
                 }
             } else {
                 $this->log .= '- mime.magic file (mime_content_type()) is deactivated<br />';
             }
         }
         // checks MIME type with getimagesize()
         if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === FALSE) {
             if ($this->mime_getimagesize) {
                 $this->log .= '- Checking MIME type with getimagesize()<br />';
                 $info = getimagesize($this->file_src_pathname);
                 if (is_array($info) && array_key_exists('mime', $info)) {
                     $this->file_src_mime = trim($info['mime']);
                     if (empty($this->file_src_mime)) {
                         $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;MIME empty, guessing from type<br />';
                         $mime = is_array($info) && array_key_exists(2, $info) ? $info[2] : null;
                         // 1 = GIF, 2 = JPG, 3 = PNG
                         $this->file_src_mime = $mime == IMAGETYPE_GIF ? 'image/gif' : ($mime == IMAGETYPE_JPEG ? 'image/jpeg' : ($mime == IMAGETYPE_PNG ? 'image/png' : ($mime == IMAGETYPE_BMP ? 'image/bmp' : null)));
                     }
                     $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;MIME type detected as ' . $this->file_src_mime . ' by PHP getimagesize() function<br />';
                     if (preg_match("/^([\\.\\-\\w]+)\\/([\\.\\-\\w]+)(.*)\$/i", $this->file_src_mime)) {
                         $this->file_src_mime = preg_replace("/^([\\.\\-\\w]+)\\/([\\.\\-\\w]+)(.*)\$/i", '$1/$2', $this->file_src_mime);
                         $this->log .= '-&nbsp;MIME validated as ' . $this->file_src_mime . '<br />';
                     } else {
                         $this->file_src_mime = null;
                     }
                 } else {
                     $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;getimagesize() failed<br />';
                 }
             } else {
                 $this->log .= '- getimagesize() is deactivated<br />';
             }
         }
         // default to MIME from browser (or Flash)
         if (!empty($mime_from_browser) && !$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime)) {
             $this->file_src_mime = $mime_from_browser;
             $this->log .= '- MIME type detected as ' . $this->file_src_mime . ' by browser<br />';
             if (preg_match("/^([\\.\\-\\w]+)\\/([\\.\\-\\w]+)(.*)\$/i", $this->file_src_mime)) {
                 $this->file_src_mime = preg_replace("/^([\\.\\-\\w]+)\\/([\\.\\-\\w]+)(.*)\$/i", '$1/$2', $this->file_src_mime);
                 $this->log .= '-&nbsp;MIME validated as ' . $this->file_src_mime . '<br />';
             } else {
                 $this->file_src_mime = null;
             }
         }
         // we need to work some magic if we upload via Flash
         if ($this->file_src_mime == 'application/octet-stream' || !$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === FALSE) {
             if ($this->file_src_mime == 'application/octet-stream') {
                 $this->log .= '- Flash may be rewriting MIME as application/octet-stream<br />';
             }
             $this->log .= '- Try to guess MIME type from file extension (' . $this->file_src_name_ext . '): ';
             if (array_key_exists($this->file_src_name_ext, $this->mime_types)) {
                 $this->file_src_mime = $this->mime_types[$this->file_src_name_ext];
             }
             if ($this->file_src_mime == 'application/octet-stream') {
                 $this->log .= 'doesn\'t look like anything known<br />';
             } else {
                 $this->log .= 'MIME type set to ' . $this->file_src_mime . '<br />';
             }
         }
         if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === FALSE) {
             $this->log .= '- MIME type couldn\'t be detected! (' . (string) $this->file_src_mime . ')<br />';
         }
         // determine whether the file is an image
         if ($this->file_src_mime && is_string($this->file_src_mime) && !empty($this->file_src_mime) && array_key_exists($this->file_src_mime, $this->image_supported)) {
             $this->file_is_image = true;
             $this->image_src_type = $this->image_supported[$this->file_src_mime];
         }
         // if the file is an image, we gather some useful data
         if ($this->file_is_image) {
             if ($h = fopen($this->file_src_pathname, 'r')) {
                 fclose($h);
                 $info = getimagesize($this->file_src_pathname);
                 if (is_array($info)) {
                     $this->image_src_x = $info[0];
                     $this->image_src_y = $info[1];
                     $this->image_dst_x = $this->image_src_x;
                     $this->image_dst_y = $this->image_src_y;
                     $this->image_src_pixels = $this->image_src_x * $this->image_src_y;
                     $this->image_src_bits = array_key_exists('bits', $info) ? $info['bits'] : null;
                 } else {
                     $this->file_is_image = false;
                     $this->uploaded = false;
                     $this->log .= '- can\'t retrieve image information, image may have been tampered with<br />';
                     $this->error = $this->translate('source_invalid');
                 }
             } else {
                 $this->log .= '- can\'t read source file directly. open_basedir restriction in place?<br />';
             }
         }
         $this->log .= '<b>source variables</b><br />';
         $this->log .= '- You can use all these before calling process()<br />';
         $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;file_src_name         : ' . $this->file_src_name . '<br />';
         $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;file_src_name_body    : ' . $this->file_src_name_body . '<br />';
         $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;file_src_name_ext     : ' . $this->file_src_name_ext . '<br />';
         $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;file_src_pathname     : ' . $this->file_src_pathname . '<br />';
         $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;file_src_mime         : ' . $this->file_src_mime . '<br />';
         $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;file_src_size         : ' . $this->file_src_size . ' (max= ' . $this->file_max_size . ')<br />';
         $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;file_src_error        : ' . $this->file_src_error . '<br />';
         if ($this->file_is_image) {
             $this->log .= '- source file is an image<br />';
             $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;image_src_x           : ' . $this->image_src_x . '<br />';
             $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;image_src_y           : ' . $this->image_src_y . '<br />';
             $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;image_src_pixels      : ' . $this->image_src_pixels . '<br />';
             $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;image_src_type        : ' . $this->image_src_type . '<br />';
             $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;image_src_bits        : ' . $this->image_src_bits . '<br />';
         }
     }
 }
Пример #3
0
    } else {
        $maxyears = date("Y") - $minyear['year'];
    }
    for ($years = 0; $years <= $maxyears; $years++) {
        $overview['year'] = date("Y") - $years;
        $overview['type'] = $lng['traffic']['customer'];
        $domain_list = '';
        $totals = array('jan' => 0, 'feb' => 0, 'mar' => 0, 'apr' => 0, 'may' => 0, 'jun' => 0, 'jul' => 0, 'aug' => 0, 'sep' => 0, 'oct' => 0, 'nov' => 0, 'dec' => 0);
        $customer_name_list_stmt = Database::prepare("\n\t\t\tSELECT `customerid`,`company`,`name`,`firstname`\n\t\t\tFROM `" . TABLE_PANEL_CUSTOMERS . "`\n\t\t\tWHERE `deactivated`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :id") . "\n\t\t\tORDER BY name");
        Database::pexecute($customer_name_list_stmt, array('id' => $userinfo['adminid']));
        while ($customer_name = $customer_name_list_stmt->fetch(PDO::FETCH_ASSOC)) {
            $virtual_host = array('name' => $customer_name['company'] == '' ? $customer_name['name'] . ", " . $customer_name['firstname'] : $customer_name['company'], 'customerid' => $customer_name['customerid'], 'jan' => '-', 'feb' => '-', 'mar' => '-', 'apr' => '-', 'may' => '-', 'jun' => '-', 'jul' => '-', 'aug' => '-', 'sep' => '-', 'oct' => '-', 'nov' => '-', 'dec' => '-');
            $traffic_list_stmt = Database::prepare("\n\t\t\t\tSELECT month, SUM(http+ftp_up+ftp_down+mail)*1024 AS traffic\n\t\t\t\tFROM `" . TABLE_PANEL_TRAFFIC . "`\n\t\t\t\tWHERE year = :year AND `customerid` = :id\n\t\t\t\tGROUP BY month ORDER BY month");
            Database::pexecute($traffic_list_stmt, array('year' => date("Y") - $years, 'id' => $customer_name['customerid']));
            while ($traffic_month = $traffic_list_stmt->fetch(PDO::FETCH_ASSOC)) {
                $virtual_host[$months[(int) $traffic_month['month']]] = size_readable($traffic_month['traffic'], 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
                $totals[$months[(int) $traffic_month['month']]] += $traffic_month['traffic'];
            }
            eval("\$domain_list .= sprintf(\"%s\", \"" . getTemplate("traffic/index_table_row") . "\");");
        }
        // sum up totals
        $virtual_host = array('name' => $lng['traffic']['months']['total']);
        foreach ($totals as $month => $bytes) {
            $virtual_host[$month] = $bytes == 0 ? '-' : size_readable($bytes, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
        }
        $customerview = 0;
        eval("\$total_list = sprintf(\"%s\", \"" . getTemplate("traffic/index_table_row") . "\");");
        eval("\$stats_tables .= sprintf(\"%s\", \"" . getTemplate("traffic/index_table") . "\");");
    }
    eval("echo \"" . getTemplate("traffic/index") . "\";");
}
Пример #4
0
    if (!isset($minyear['year']) || $minyear['year'] == 0) {
        $maxyears = 0;
    } else {
        $maxyears = date("Y") - $minyear['year'];
    }
    for ($years = 0; $years <= $maxyears; $years++) {
        $overview['year'] = date("Y") - $years;
        $overview['type'] = $lng['traffic']['customer'];
        $domain_list = '';
        $customer_name_list = $db->query("SELECT `customerid`,`company`,`name`,`firstname` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `deactivated`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = '" . (int) $userinfo['adminid'] . "' ") . " ORDER BY name");
        $totals = array('jan' => 0, 'feb' => 0, 'mar' => 0, 'apr' => 0, 'may' => 0, 'jun' => 0, 'jul' => 0, 'aug' => 0, 'sep' => 0, 'oct' => 0, 'nov' => 0, 'dec' => 0);
        while ($customer_name = $db->fetch_array($customer_name_list)) {
            $virtual_host = array('name' => $customer_name['company'] == '' ? $customer_name['name'] . ", " . $customer_name['firstname'] : $customer_name['company'], 'customerid' => $customer_name['customerid'], 'jan' => '-', 'feb' => '-', 'mar' => '-', 'apr' => '-', 'may' => '-', 'jun' => '-', 'jul' => '-', 'aug' => '-', 'sep' => '-', 'oct' => '-', 'nov' => '-', 'dec' => '-');
            $traffic_list = $db->query("SELECT month, SUM(http+ftp_up+ftp_down+mail)*1024 AS traffic FROM `" . TABLE_PANEL_TRAFFIC . "` WHERE year = " . (date("Y") - $years) . " AND `customerid` = '" . $customer_name['customerid'] . "' GROUP BY month ORDER BY month");
            while ($traffic_month = $db->fetch_array($traffic_list)) {
                $virtual_host[$months[(int) $traffic_month['month']]] = size_readable($traffic_month['traffic'], 'GiB', 'bi', '%01.3f %s');
                $totals[$months[(int) $traffic_month['month']]] += $traffic_month['traffic'];
            }
            eval("\$domain_list .= sprintf(\"%s\", \"" . getTemplate("traffic/index_table_row") . "\");");
        }
        // sum up totals
        $virtual_host = array('name' => $lng['traffic']['months']['total']);
        foreach ($totals as $month => $bytes) {
            $virtual_host[$month] = $bytes == 0 ? '-' : size_readable($bytes, 'GiB', 'bi', '%01.3f %s');
        }
        $customerview = 0;
        eval("\$total_list = sprintf(\"%s\", \"" . getTemplate("traffic/index_table_row") . "\");");
        eval("\$stats_tables .= sprintf(\"%s\", \"" . getTemplate("traffic/index_table") . "\");");
    }
    eval("echo \"" . getTemplate("traffic/index") . "\";");
}
Пример #5
0
										<div class="progress" style="height:15px;margin-bottom:0px;">
											<div class="progress-bar progress-bar-<?php 
    echo $info->status->memory->level;
    ?>
" style="width: <?php 
    echo $info->status->memory->progress;
    ?>
%;"></div>
										</div>
									</td>
									<td>
										<?php 
    echo size_readable($info->status->disk->used);
    ?>
 / <?php 
    echo size_readable($info->status->disk->total);
    ?>
<br />
										<div class="progress" style="height:15px;margin-bottom:0px;">
											<div class="progress-bar progress-bar-<?php 
    echo $info->status->disk->level;
    ?>
" style="width: <?php 
    echo $info->status->disk->progress;
    ?>
%;"></div>
										</div>
									</td>
									<td>
										<span class="label label-success"><?php 
    echo $info->status->load[0];
Пример #6
0
                 $row['email'] = $idna_convert->decode($row['email']);
                 $row['email_full'] = $idna_convert->decode($row['email_full']);
                 $row['destination'] = explode(' ', $row['destination']);
                 uasort($row['destination'], 'strcasecmp');
                 while (list($dest_id, $destination) = each($row['destination'])) {
                     $row['destination'][$dest_id] = $idna_convert->decode($row['destination'][$dest_id]);
                     if ($row['destination'][$dest_id] == $row['email_full']) {
                         unset($row['destination'][$dest_id]);
                     }
                 }
                 $destinations_count = count($row['destination']);
                 $row['destination'] = implode(', ', $row['destination']);
                 if (strlen($row['destination']) > 35) {
                     $row['destination'] = substr($row['destination'], 0, 32) . '... (' . $destinations_count . ')';
                 }
                 $row['mboxsize'] = size_readable($row['mboxsize'], 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
                 $row = htmlentities_array($row);
                 eval("\$accounts.=\"" . getTemplate("email/emails_email") . "\";");
                 $count++;
             }
             $i++;
         }
     }
     $emaildomains_count_stmt = Database::prepare("SELECT COUNT(`id`) AS `count` FROM `" . TABLE_PANEL_DOMAINS . "`\n\t\t\tWHERE `customerid`= :customerid\n\t\t\tAND `isemaildomain`='1' ORDER BY `domain` ASC");
     Database::pexecute($emaildomains_count_stmt, array("customerid" => $userinfo['customerid']));
     $emaildomains_count = $emaildomains_count_stmt->fetch(PDO::FETCH_ASSOC);
     $emaildomains_count = $emaildomains_count['count'];
     eval("echo \"" . getTemplate("email/emails") . "\";");
 } elseif ($action == 'delete' && $id != 0) {
     $stmt = Database::prepare("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid`, `popaccountid` FROM `" . TABLE_MAIL_VIRTUAL . "`\n\t\t\tWHERE `customerid`= :customerid\n\t\t\tAND `id`= :id");
     $result = Database::pexecute_first($stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
Пример #7
0
 /**
  * Format the changes
  *
  * @param changes: array of changes
  * @param $field_perm an array with the permission associated to each field. false to no check perms
  * @param string $artifact_href The direct link to the artifact
  * @param $visible_change only needed when using permissions. Returns true if there is any change
  * that the user has permission to see
  *
  * @return string
  */
 function formatChangesHTML($changes, $field_perm, $artifact_href, &$visible_change)
 {
     global $art_field_fact, $Language;
     $group_id = $this->ArtifactType->getGroupID();
     $visible_change = false;
     $out = '';
     $out_com = '';
     $out_ch = '';
     reset($changes);
     $fmt = "%20s | %-25s | %s" . $GLOBALS['sys_lf'];
     $hp = $this->getHTMLPurifier();
     $out .= '<h2>' . $Language->getText('tracker_include_artifact', 'mail_latest_modifications') . '</h2>';
     $out .= '
         <div class="tracker_artifact_followup_header">
             <div class="tracker_artifact_followup_title">
                 <span class="tracker_artifact_followup_title_user">';
     if ($this->hasFieldPermission($field_perm, 'assigned_to') || $this->hasFieldPermission($field_perm, 'multi_assigned_to') || !isset($field_perm['assigned_to']) && !isset($field_perm['multi_assigned_to'])) {
         $user = UserManager::instance()->getCurrentUser();
         if ($user->isLoggedIn()) {
             $out .= '<a href="mailto:' . $hp->purify($user->getEmail()) . '">' . $hp->purify($user->getRealName()) . ' (' . $hp->purify($user->getUserName()) . ')</a>';
         } else {
             $out = $Language->getText('tracker_include_artifact', 'anon_user');
         }
     }
     $timezone = '';
     if ($user->getId() != 0) {
         $timezone = ' (' . $user->getTimezone() . ')';
     }
     $out .= '
                 </span>
             </div>
             <div class="tracker_artifact_followup_date">' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), $_SERVER['REQUEST_TIME']) . $timezone . '</div>
         </div>
         <div class="tracker_artifact_followup_avatar">
             ' . $user->fetchHtmlAvatar() . '
         </div>
         <div class="tracker_artifact_followup_content">
             <div class="tracker_artifact_followup_comment">';
     //Process special cases first: follow-up comment
     if (!empty($changes['comment'])) {
         $visible_change = true;
         if (!empty($changes['comment']['type']) && $changes['comment']['type'] != $Language->getText('global', 'none')) {
             $out_com .= "<strong>[" . $changes['comment']['type'] . "]</strong><br />";
         }
         $out_com .= '<div class="tracker_artifact_followup_comment_body">';
         $out_com .= $this->formatFollowUp($group_id, $changes['comment']['format'], $changes['comment']['add'], self::OUTPUT_BROWSER);
         $out_com .= '</div>';
         unset($changes['comment']);
     }
     //Process special cases first: file attachment
     if (!empty($changes['attach'])) {
         $visible_change = true;
         $out_ch .= '<tr>';
         $out_ch .= '<td valign="top"><strong>' . $Language->getText('tracker_include_artifact', 'add_attachment') . '</strong></td>';
         $out_ch .= '<td valign="top"><a href="' . $changes['attach']['href'] . '">' . $hp->purify($changes['attach']['name']) . '</a> (' . size_readable($changes['attach']['size']) . ')</td>';
         $out_ch .= '</tr>';
         unset($changes['attach']);
     }
     // All the rest of the fields now
     reset($changes);
     foreach ($changes as $field_name => $h) {
         // If both removed and added items are empty skip - Sanity check
         if ((!empty($h['del']) || !empty($h['add'])) && $this->hasFieldPermission($field_perm, $field_name)) {
             $visible_change = true;
             $label = $field_name;
             $field = $art_field_fact->getFieldFromName($field_name);
             if ($field) {
                 $label = $field->getLabel();
                 if (isset($h['del'])) {
                     $h['del'] = SimpleSanitizer::unsanitize(util_unconvert_htmlspecialchars($h['del']));
                 }
                 if (isset($h['add'])) {
                     $h['add'] = SimpleSanitizer::unsanitize(util_unconvert_htmlspecialchars($h['add']));
                 }
             }
             $out_ch .= '<tr>';
             $out_ch .= '  <td valign="top" nowrap="nowrap"><ul style="margin:0; padding:0; margin-left:1.5em; "><li><strong>' . $hp->purify(SimpleSanitizer::unsanitize($label)) . ':&nbsp;</strong></li></ul></td>';
             $out_ch .= '  <td valign="top">';
             if ($field && ($field->getDisplayType() == 'TA' || $field->getDisplayType() == 'TF')) {
                 $before = explode("\n", $h['del']);
                 $after = explode("\n", $h['add']);
                 $callback = array(Codendi_HTMLPurifier::instance(), 'purify');
                 $d = new Codendi_Diff(array_map($callback, $before, array_fill(0, count($before), CODENDI_PURIFIER_CONVERT_HTML)), array_map($callback, $after, array_fill(0, count($after), CODENDI_PURIFIER_CONVERT_HTML)));
                 $f = new Codendi_HtmlUnifiedDiffFormatter(2);
                 $diff = $f->format($d);
                 if ($diff) {
                     $out_ch .= '<div class="diff">' . $diff . '</div>';
                 }
             } else {
                 $before = '<del>' . $hp->purify($h['del']) . '</del>';
                 $after = '<ins>' . $hp->purify($h['add']) . '</ins>';
                 if ($field && $field->getDisplayType() == 'MB') {
                     if (strlen($before) != 11) {
                         //'<del></del>' => empty
                         $out_ch .= $before;
                     }
                     if (strlen($before) != 11 && strlen($after) != 11) {
                         //'<ins></ins>' => empty
                         $out_ch .= ' &plusmn; ';
                     }
                     if (strlen($after) != 11) {
                         //'<ins></ins>' => empty
                         $out_ch .= $after;
                     }
                 } else {
                     $out_ch .= $before;
                     $out_ch .= ' &rarr; ';
                     $out_ch .= $after;
                 }
             }
             $out_ch .= '</td>';
             $out_ch .= '</tr>';
         }
     }
     if ($out_ch) {
         $out_ch = '<div class="tracker_artifact_followup_comment_changes">' . $Language->getText('tracker_include_artifact', 'mail_changes') . '<table cellpadding="0" border="0" cellspacing="0" class="artifact_changes">' . $out_ch . '</table>
             </div>';
     }
     $out .= $out_com . $out_ch;
     $out .= '
             </div>
         </div>
         <div style="clear:both;"></div>';
     $out .= $this->fetchHtmlAnswerButton($artifact_href);
     return $out;
 }
 function before_soapCall(&$loaded_params)
 {
     $this->soapCommand = 'addUploadedFile';
     if (!$loaded_params['others']['uploaded_file'] && !$loaded_params['others']['local_file']) {
         exit_error("You must specify a file name with either the --local_file or --uploaded_file parameter, depending the way you want to add the file.");
     } else {
         if (!$loaded_params['others']['local_file']) {
             // we will test if the file is present in the incoming directory
             $uploaded_files = $GLOBALS['soap']->call("getUploadedFiles", array('group_id' => $loaded_params['soap']['group_id']));
             if (!in_array($loaded_params['others']['uploaded_file'], $uploaded_files)) {
                 exit_error("File '" . $loaded_params['others']['uploaded_file'] . "' not found in incoming directory.");
             }
             $loaded_params['soap']['filename'] = $loaded_params['others']['uploaded_file'];
         } else {
             $localFileLocation = $loaded_params['others']['local_file'];
             if (!file_exists($localFileLocation)) {
                 exit_error("File '" . $localFileLocation . "' doesn't exist");
             } else {
                 if (!is_readable($localFileLocation)) {
                     exit_error("Could not open '" . $localFileLocation . "' for reading");
                 } else {
                     // TODO : use PHP_BigFile
                     //$path = PHP_BigFile::stream(realpath($localFileLocation));
                     $path = realpath($localFileLocation);
                     $GLOBALS['LOG']->add('Calculating md5 checksum of the file ...');
                     $loaded_params['soap']['reference_md5'] = PHP_BigFile::getMd5Sum($path);
                     $GLOBALS['LOG']->add('Md5 checksum calculated.');
                     $offset = 0;
                     $chunkSize = $GLOBALS['soap']->getFileChunkSize();
                     $startTime = microtime(true);
                     $totalTran = 0;
                     $i = 0;
                     /* During this loop the file in construction in the incoming directory
                      * may be corrupted by concurrent access, such as releasing it
                      * or use of addFileChunk again with the same filename.
                      * This corruption will be automatically detected at the end of upload
                      * when comparing the md5 sums and file will not be released.
                      */
                     do {
                         $offset = $i * $chunkSize;
                         $contents = file_get_contents($path, false, NULL, $offset, $chunkSize);
                         $cLength = strlen($contents);
                         $contents = base64_encode($contents);
                         if ($i == 0) {
                             $firstChunk = true;
                         } else {
                             $firstChunk = false;
                         }
                         $addedSize = $GLOBALS['soap']->call("addFileChunk", array('filename' => basename($path), 'contents' => $contents, 'first_chunk' => $firstChunk));
                         if ($addedSize == $cLength) {
                             $totalTran += $cLength;
                             $i++;
                         } else {
                             exit_error("Upload of the file failed");
                         }
                     } while ($cLength >= $chunkSize);
                     $endTime = microtime(true);
                     $transRate = $totalTran / ($endTime - $startTime);
                     $GLOBALS['LOG']->add('Transfer rate: ' . size_readable($transRate, null, 'bi', '%.2f %s/s'));
                     $loaded_params['soap']['filename'] = basename($loaded_params['others']['local_file']);
                     $loaded_params['soap']['is_upload'] = true;
                 }
             }
         }
         // sort the parameters in the right order
         uksort($loaded_params['soap'], array($this, "sort_parameters"));
     }
 }
Пример #9
0
    }
    $zipu = opendir($yu);
    #open directory
    while (false !== ($zyu = readdir($zipu))) {
        #					if (!eregi("\.html",$zyu) && !eregi("error",$zyu) && $zyu!='.' && $zyu!='..' && !is_dir($yu."/".$zyu))
        if (!preg_match("/(\\.html|error)\$/i", $zyu) && !preg_match("/^[\\.]/", $zyu) && !is_dir($yu . "/" . $zyu)) {
            $ziparrayu[] = $zyu;
        }
    }
    closedir($zipu);
    if ($ziparrayu) {
        sort($ziparrayu);
        echo "\n<table BORDER=1 CELLSPACING=0 CELLPADDING=0 class=table>";
        echo "\n<tr>\n<td valign=top align=center nowrap=\"nowrap\"><font size=4 color=blue><b>" . A_CHAT_LOGS_27 . " " . A_CHAT_LOGS_12 . "</b></font></td></tr>\n<tr>\n<td valign=top align=left nowrap=\"nowrap\">";
        $zipu_size = 0;
        foreach ($ziparrayu as $zyu) {
            $yu_time = strftime(L_SHORT_DATETIME, filemtime($yu . "/" . $zyu));
            if (strstr($L, "chinese") || strstr($L, "korean") || strstr($L, "japanese")) {
                $yu_time = str_replace(" ", "", $yu_time);
            }
            echo "\n<li><a href=\"{$pstr}&fdel=" . $yu . "/" . $zyu . "\" onclick=\"return confirm('" . sprintf(A_CHAT_LOGS_14 . A_CHAT_LOGS_12 . A_CHAT_LOGS_19, $zyu) . "')\" title='" . A_CHAT_LOGS_29 . " " . A_CHAT_LOGS_12 . "'><font size=-2 color=red><b>x</b></font></a>&nbsp;<a href={$yu}/{$zyu} title='" . sprintf(A_CHAT_LOGS_28, $zyu) . " " . A_CHAT_LOGS_12 . "'>{$zyu}</a>&nbsp;(" . size_readable(filesize($yu . "/" . $zyu)) . " / " . $yu_time . ")";
            #print name of each file found
            $zipu_size = $zipu_size + filesize($yu . "/" . $zyu);
        }
        echo "\n</td>\n</tr>\n<td valign=top nowrap=\"nowrap\" class=\"notify\"><li>" . sprintf(A_CHAT_LOGS_31, " = ", size_readable($zipu_size, '%01.2f %s')) . "</td>\n</tr>\n</table>\n<br />\n";
    }
    unset($ziparrayu);
    $totalu_size = $totalu_size + $zipu_size;
    echo "\n<table BORDER=1 CELLSPACING=0 CELLPADDING=0 class=table>\n<tr>\n<td valign=top align=center nowrap=\"nowrap\" class=\"notify\" colspan=7>" . sprintf(A_CHAT_LOGS_31, A_CHAT_LOGS_12 . " = ", size_readable($totalu_size, '%01.2f %s')) . "</td>\n</tr>\n</table>\n<br />\n";
    echo "\n<P ALIGN=right><A HREF=#full>" . A_CHAT_LOGS_20 . "</A>\n<br />\n<A HREF=#home>" . A_CHAT_LOGS_21 . "</A></P><CENTER>";
}
Пример #10
0
             $tplFolger->assign('cur-dir', implode('/', $aTmp));
         } else {
             $tplFolger->assign('cur-dir', implode('/', $aCurPath) . '/' . $v);
         }
         $tplFolger->assign('v', $v);
         $tplDir->assign('Folger', $tplFolger);
         $tplFolger->reset();
     } elseif (is_file($sCurDir . '/' . $v)) {
         $tplFile = $tplDir->fetchBlock('File');
         $tplFile->assign('v', $v);
         $rImg = imagecreatefromjpeg($sCurDir . '/' . $v);
         $nWidth = imagesx($rImg);
         $nHeight = imagesy($rImg);
         $tplFile->assign('_name', $v);
         $tplFile->assign('_resolution', $nWidth . '*' . $nHeight);
         $tplFile->assign('_size', size_readable(filesize($sCurDir . '/' . $v)));
         $tplFile->assign('file', '/userfiles/' . $_GET['cur-dir'] . '/' . $v);
         $tplDir->assign('File', $tplFile);
         $tplFile->reset();
     }
     if ($v == '..') {
         $tplDir->assign('Del', '');
     } else {
         $tplDel = $tplDir->fetchBlock('Del');
         $tplDel->assign('path', implode('/', $aCurPath) . '/' . $v);
         $tplDir->assign('Del', $tplDel);
         $tplDel->reset();
     }
     $tpl->assign('dir', $tplDir);
     $tplDir->reset();
 }
Пример #11
0
        $handle->dir_auto_chmod = true;
        $handle->dir_chmod = 0777;
        $handle->mime_check = true;
        $handle->mime_magic_check = true;
        $handle->no_script = false;
        $handle->allowed = array('image/*');
        $handle->image_convert = 'gif';
        #		$handle->image_bevel = 3;
        #		$handle->image_frame = 1;
        #		$handle->image_frame_colors = array('#999999',  '#FF0000', '#666666', '#333333', '#000000');
        $handle->Process("./images/avatars/uploaded/");
        // we check if everything went OK
        if ($handle->processed) {
            $avatar = C_AVA_RELPATH . "uploaded/" . $handle->file_dst_name;
            unset($url);
            $avamsgupload = "<P class=\"success\">" . sprintf(L_UPLOAD_SUCCESS, $handle->file_src_name . " (" . size_readable($handle->file_src_size) . ")", $handle->file_dst_name . " (" . size_readable(sprintf("%u", filesize($handle->file_dst_pathname))) . ")") . "</P>";
        } else {
            $avamsgupload = "<P class=\"error\">" . $handle->error . "</P>";
        }
    } else {
        // if we're here, the upload file failed for some reasons
        // i.e. the server didn't receive the file
        $avamsgupload = "<P class=\"error\">" . $handle->error . "</P>";
    }
    // we delete the temporary files
    $handle->Clean();
}
$DbAva = new DB();
// it's a URL string, perhaps.
// parse a avatar image from input url
if (isset($url)) {
 function soapCall($soap_params, $use_extra_params = true)
 {
     // Prepare SOAP parameters
     $callParams = $soap_params;
     unset($callParams['remote_name']);
     unset($callParams['output']);
     $callParams['chunk_offset'] = 0;
     $callParams['chunk_size'] = $GLOBALS['soap']->getFileChunkSize();
     $startTime = microtime(true);
     $totalTran = 0;
     $i = 0;
     do {
         $callParams['chunk_offset'] = $i * $GLOBALS['soap']->getFileChunkSize();
         $content = base64_decode($GLOBALS['soap']->call($this->soapCommand, $callParams, $use_extra_params));
         if ($i == 0) {
             $this->manageOutput($soap_params, $output, $fd);
         }
         $cLength = strlen($content);
         if ($output !== false) {
             $written = fwrite($fd, $content);
             if ($written != $cLength) {
                 throw new Exception('Received ' . $cLength . ' of data but only ' . $written . ' written on Disk');
             }
         } else {
             echo $content;
         }
         $totalTran += $cLength;
         $i++;
     } while ($cLength >= $GLOBALS['soap']->getFileChunkSize());
     $endTime = microtime(true);
     $transRate = $totalTran / ($endTime - $startTime);
     $GLOBALS['LOG']->add('Transfer rate: ' . size_readable($transRate, null, 'bi', '%.2f %s/s'));
     // Finish!
     if ($output !== false) {
         fclose($fd);
         unset($callParams['chunk_offset']);
         unset($callParams['chunk_size']);
         //Check the md5sum
         $localChecksum = PHP_BigFile::getMd5Sum($output);
         $remoteChecksum = $GLOBALS['soap']->call('getDocmanFileMD5sum', $callParams, $use_extra_params);
         if ($localChecksum == $remoteChecksum) {
             echo "File retrieved successfully.\n";
         } else {
             exit_error("Local and remote checksums are not the same. Try to download it again.\n");
         }
     }
 }
Пример #13
0
    function display()
    {
        global $mainframe, $database, $jTips, $jLang, $jLicence, $mosConfig_absolute_path, $mosConfig_live_site, $database;
        jTipsLogger::_log('Loading dashboard', 'INFO');
        jTipsCommonHTML::loadOverlib();
        $option = jTipsGetParam($_REQUEST, 'option', 'com_jtips');
        if (isJoomla15()) {
            JToolbarHelper::title($jLang['_ADMIN_DASH_CPANEL'], 'frontpage');
        } else {
            ?>
			<table class="adminheading" border="0" width="100%">
			<tr>
				<th class="cpanel" align="left"><?php 
            echo $jLang['_ADMIN_DASH_CPANEL'];
            ?>
</th>
				<td align="right"><a href="http://www.jtips.com.au" target="_blank" title="jTips Home"><img src="<?php 
            echo $mosConfig_live_site;
            ?>
/components/com_jtips/images/license_logo.png" alt="" border="0" /></a></td>
			</tr>
			</table>
		<?php 
        }
        ?>
		<table class="adminform">
		<tr>
		<td width="55%" valign="top">
		<?php 
        jTipsLogger::_log('Building dashboard icons', 'INFO');
        foreach ($this->menu as $item) {
            if (isset($item['url']) and !empty($item['url'])) {
                $link = $item['url'];
                $extra = "target='_blank'";
            } else {
                $link = "index2.php?option={$option}&amp;task=" . $item['task'];
                $extra = "";
            }
            ?>
		<div id="cpanel" style="float:left;">
			<div class="icon">
				<a href="<?php 
            echo $link;
            ?>
" <?php 
            echo $extra;
            ?>
>
				<img src="components/com_jtips/images/<?php 
            echo $item['image'];
            ?>
"  alt="<?php 
            echo $jLang[$item['alt']];
            ?>
" align="middle" border="0" /><span><?php 
            echo $jLang[$item['link']];
            ?>
</span></a>
			</div>
		</div>
		<?php 
        }
        ?>
</td>
<td width="45%" valign="top">
	<div style="width: 100%;">
	<?php 
        $tabs = new jTipsTabs(1);
        $tabs->startPane('dashpanel');
        $tabs->startTab($jLang['_ADMIN_DASH_TAB_SUMMARY'], 'summary');
        $center = "style='text-align:center;'";
        ?>
	&nbsp;
	<table class='adminlist'>
	<thead>
	<tr>
		<th><?php 
        echo $jLang['_COM_DASH_SEASON'];
        ?>
</th>
		<th <?php 
        echo $center;
        ?>
><?php 
        echo $jLang['_COM_DASH_CURR_ROUND'];
        ?>
</th>
		<th <?php 
        echo $center;
        ?>
><?php 
        echo $jLang['_ADMIN_DASH_TOTAL_USERS'];
        ?>
</th>
		<th <?php 
        echo $center;
        ?>
><?php 
        echo $jLang['_ADMIN_DASH_PENDING_TIPS'];
        ?>
</th>
		<th <?php 
        echo $center;
        ?>
><?php 
        echo $jLang['_ADMIN_DASH_PENDING_PAYMENT'];
        ?>
</th>
	</tr>
	</thead>
	<tbody>
	<?php 
        jTipsLogger::_log('Loading season data', 'INFO');
        $total_user_count = 0;
        foreach ($this->jSeasons as $jSeason) {
            if (TimeDate::toDatabaseDate($jSeason->end_time) > gmdate('Y-m-d')) {
                $round_id = $jSeason->getCurrentRound();
                $jRound = new jRound($database);
                if ($round_id) {
                    $jRound->load($round_id);
                }
                $jTipsUsers = $jSeason->getUsers();
                $total_users = 0;
                $no_tips = 0;
                $has_paid = 0;
                $no_tips_overlib = "";
                foreach ($jTipsUsers as $jTipsUser) {
                    $total_users++;
                    if (!$jTipsUser->hasTipped($jRound->id)) {
                        $no_tips++;
                        if ($no_tips < 10) {
                            $no_tips_overlib .= "<br />" . htmlentities($jTipsUser->getName());
                        } else {
                            if ($no_tips == 10) {
                                $no_tips_overlib .= "<br />...more";
                            }
                        }
                    }
                    if ($jTipsUser->paid == 1) {
                        $has_paid++;
                    }
                }
                if ($jTips['Payments'] != 0) {
                    $pending_payment = $total_users - $has_paid;
                } else {
                    $pending_payment = "N/A";
                }
                $no_tips_overlib = substr($no_tips_overlib, 6);
                if ($no_tips > 0) {
                    $no_tips_overlib_call = jTipsToolTip($no_tips_overlib, "Users Missing Tips");
                } else {
                    $no_tips_overlib_call = '';
                }
                ?>
			<tr>
				<td><?php 
                echo $jSeason->name;
                ?>
</td>
				<td <?php 
                echo $center;
                ?>
><?php 
                echo $jRound->round;
                ?>
</td>
				<td <?php 
                echo $center;
                ?>
><?php 
                echo $total_users;
                ?>
</td>
				<td <?php 
                echo $center;
                ?>
><?php 
                echo $no_tips . "&nbsp;" . $no_tips_overlib_call;
                ?>
</td>
				<td <?php 
                echo $center;
                ?>
><?php 
                echo $pending_payment;
                ?>
</td>
			</tr>
			<?php 
                $total_user_count += $total_users;
            }
        }
        ?>
	</tbody>
	</table>
	<?php 
        $tabs->endTab();
        $tabs->startTab($jLang['_ADMIN_DASH_TAB_UPDATED'], 'update');
        $filesWritable = filesWritable();
        ?>
	&nbsp;
	<table class="adminlist" width="100%">
		<thead>
		<tr>
			<th <?php 
        echo $center;
        ?>
><?php 
        echo $jLang['_ADMIN_DASH_UPG_THISVERSION'];
        ?>
</th>
			<th <?php 
        echo $center;
        ?>
><?php 
        echo $jLang['_ADMIN_DASH_UPG_LATESTVERSION'];
        ?>
</th>
			<th <?php 
        echo $center;
        ?>
><?php 
        echo $jLang['_ADMIN_DASH_UPG_UPGRADE'];
        ?>
</th>
			<th <?php 
        echo $center;
        ?>
><?php 
        echo $jLang['_ADMIN_DASH_UPG_FILE_CHECK'];
        ?>
</th>
		</tr>
		</thead>
		<tbody>
		<tr>
			<td <?php 
        echo $center;
        ?>
><?php 
        echo getFullVersion();
        ?>
</td>
			<!-- td <?php 
        echo $center;
        ?>
 id="latest_version"><input type="button" onclick="liveCheckLatestVersion('latest_version');" class="button" value="Check Now" <?php 
        if (!$filesWritable) {
            echo "disabled";
        }
        ?>
 /></td -->
			<td <?php 
        echo $center;
        ?>
>N/A</td>
			<!-- td <?php 
        echo $center;
        ?>
><span id="liveupdatespan"><?php 
        echo getUpdateButton('', '');
        ?>
</span></td -->
			<td <?php 
        echo $center;
        ?>
>N/A</td>
			<td <?php 
        echo $center;
        ?>
>
			<?php 
        if ($filesWritable) {
            $tip = $jLang['_ADMIN_DASH_UPG_FILE_CHECK_OK'];
            $tipTitle = $jLang['_ADMIN_DASH_UPG_FILE_CHECK_OK_TITLE'];
            $img = 'checkin.png';
            echo jTipsToolTip($tip, $tipTitle, '', $img);
        } else {
            $tip = $jLang['_ADMIN_DASH_UPG_FILE_CHECK_FAIL'];
            $tipTitle = $jLang['_ADMIN_DASH_UPG_FILE_CHECK_FAIL_TITLE'];
            $img = 'warning.png';
            ?>
				<a href=>
				<?php 
            echo jTipsToolTip($tip, $tipTitle, '', $img, '', "index2.php?option=com_jtips&amp;module=Upgrade&amp;task=list");
            ?>
				</a>
				<?php 
        }
        ?>
			</td>
		</tr>
		<?php 
        if (needsUpgrade()) {
            ?>
		<tr>
			<td colspan="4" id="upgrade_area" <?php 
            echo $center;
            ?>
>
				<input type="button" class="button" name="upgrade" value="<?php 
            echo $jLang['_ADMIN_UPGRADE_BUTTON'];
            ?>
" onclick="doUpgrade(this);" />
			</td>
		</tr>
		<?php 
        }
        ?>
		</tbody>
		<thead>
		<tr>
			<th <?php 
        echo $center;
        ?>
><?php 
        echo $jLang['_ADMIN_DASH_LAST_VALIDATED'];
        ?>
</th>
			<th <?php 
        echo $center;
        ?>
><?php 
        echo $jLang['_ADMIN_DASH_VALIDATION'];
        ?>
</th>
			<th <?php 
        echo $center;
        ?>
><?php 
        echo $jLang['_ADMIN_DASH_EXPIRY_DATE'];
        ?>
</th>
			<th <?php 
        echo $center;
        ?>
><?php 
        echo $jLang['_ADMIN_LICENSE_USER_COUNT'];
        ?>
</th>
		</tr>
		</thead>
		<tbody>
		<tr>
			<td <?php 
        echo $center;
        ?>
><?php 
        $validation_date = $jLicence->getValidationDate();
        if ($validation_date == -1) {
            echo $jLang['_ADMIN_DASH_LIC_EXPIRED'];
        } else {
            echo $validation_date;
        }
        ?>
			</td>
			<td <?php 
        echo $center;
        ?>
><a href="index2.php?option=com_jtips&amp;task=Validate&amp;module=Dashboard"><?php 
        echo $jLang['_ADMIN_DASH_REVALIDATE'];
        ?>
</a></td>
			<td <?php 
        echo $center;
        ?>
><?php 
        echo TimeDate::toDisplayDate($jLicence->licence['license_expiry']);
        ?>
&nbsp;</td>
			<td <?php 
        echo $center;
        ?>
><?php 
        echo $jLicence->getActiveUserCount();
        ?>
 / <?php 
        echo $jLicence->getLicensedUsers();
        ?>
</td>
		</tr>
		</tbody>
		<thead>
		<tr>
			<th <?php 
        echo $center;
        ?>
 colspan="4"><?php 
        echo $jLang['_ADMIN_DASH_LOGGING'];
        ?>
</th>
		</tr>
		</thead>
		<tbody>
		<tr>
			<td nowrap><?php 
        echo $jLang['_ADMIN_DASH_FILE_SIZE'];
        ?>
: <?php 
        echo size_readable(filesize($mosConfig_absolute_path . '/components/com_jtips/jtips.log'));
        ?>
</td>
			<td <?php 
        echo $center;
        ?>
><a href="index2.php?option=com_jtips&amp;task=DownloadLog&amp;module=Dashboard"><?php 
        echo $jLang['_ADMIN_DASH_DOWNLOAD'];
        ?>
</a></td>
			<td <?php 
        echo $center;
        ?>
><a href="index2.php?option=com_jtips&amp;task=PurgeLog&amp;module=Dashboard"><?php 
        echo $jLang['_ADMIN_DASH_PURGE'];
        ?>
</a></td>
			<td>&nbsp;</td>
		</tr>
		</tbody>
		<tfoot>
		<tr>
			<td colspan="4"><small><em><?php 
        echo $jLang['_ADMIN_DASH_LOG_ROTATED'];
        ?>
</em></small></td>
		</tr>
		</tfoot>
	</table>
	<?php 
        $tabs->endTab();
        $tabs->startTab($jLang['_ADMIN_DASH_TAB_ABOUT'], 'about');
        ?>
	<div style="text-align:center;"><img src="components/com_jtips/images/logo.png" border="0" />
	<h1><?php 
        echo getFullVersion();
        ?>
</h1></div>
	<p><?php 
        echo $jLang['_ADMIN_DASH_ABOUT_UPDATES'];
        ?>
 <a href="http://www.jtips.com.au/" target="_blank">http://www.jtips.com.au</a></p>
	<p><?php 
        echo $jLang['_ADMIN_DASH_ABOUT_SALES'];
        ?>
 <a href="mailto:sales@jtips.com.au?subject=jTips Enquiry">sales@jtips.com.au</a></p>
	<p><?php 
        echo $jLang['_ADMIN_DASH_ABOUT_SUPPORT'];
        ?>
 <a href="http://www.jtips.com.au" target="_blank">jTips.com.au</a></p>
	<p><?php 
        echo $jLang['_ADMIN_DASH_ABOUT_REBUILD'];
        ?>
 <a href="#" onclick="sendRebuildRequest('rebuildProgress');">&raquo; <?php 
        echo $jLang['_COMMON_CLICK_HERE'];
        ?>
 &laquo;</a>&nbsp;&nbsp;&nbsp;<span id="rebuildProgress"></span></p>
	<?php 
        $tabs->endTab();
        $tabs->startTab($jLang['_ADMIN_DASH_TAB_CREDITS'], 'credits');
        ?>
	&nbsp;
	<p><strong><?php 
        echo $jLang['_ADMIN_DASH_CREDITS'];
        ?>
:</strong></p>
	<table class="adminlist" width="100%">
		<thead>
		<tr>
			<th><?php 
        echo $jLang['_ADMIN_DASH_CREDITS_PACKAGE'];
        ?>
</th>
			<th><?php 
        echo $jLang['_ADMIN_DASH_CREDITS_HOMEPAGE'];
        ?>
</th>
		</tr>
		</thead>
		<tbody>
		<tr>
			<td>mootools</td>
			<td><a href="http://mootools.net/" target="_blank">http://mootools.net</a></td>
		</tr>
		<tr>
			<td>tnimg</td>
			<td><a href="http://vagh.armdex.com/tnimg" target="_blank">http://vagh.armdex.com/tnimg</a></td>
		</tr>
		<tr>
			<td>cURL</td>
			<td><a href="http://www.phpclasses.org/browse/package/1988.html" target="_blank">http://www.phpclasses.org</a></td>
		</tr>
		<tr>
			<td>dUnzip2</td>
			<td><a href="http://www.phpclasses.org/browse/package/2495.html" target="_blank">http://www.phpclasses.org</a></td>
		</tr>
		<tr>
			<td>MOOdalBox</td>
			<td><a href="http://www.e-magine.ro/web-dev-and-design/36/moodalbox/" target="_blank">http://www.e-magine.ro</a></td>
		</tr>
		<tr>
			<td>Silk Icons</td>
			<td><a href="http://www.famfamfam.com/lab/icons/silk/" target="_blank">http://www.famfamfam.com</a></td>
		</tr>
		<tr>
			<td>datejs</td>
			<td><a href="http://www.datejs.com/" target="_blank">http://www.datejs.com</a></td>
		</tr>
		<tr>
			<td>strftime in javascript</td>
			<td><a href="http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html" target="_blank">http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html</a></td>
		</tr>
		<tr>
			<td>Editor Area</td>
			<td><a href="http://www.cdolivet.net/editarea/" target="_blank">http://www.cdolivet.net/editarea</a></td>
		</tr>
		<tr>
			<td>GNOME Icons</td>
			<td><a href="http://commons.wikimedia.org/wiki/GNOME_Desktop_icons" target="_blank">http://commons.wikimedia.org/wiki/GNOME_Desktop_icons</a></td>
		</tr>
		</tbody>
	</table>
	<?php 
        $tabs->endTab();
        $tabs->startTab($jLang['_ADMIN_DASH_TAB_HELP'], 'help');
        ?>
	&nbsp;
	<h2><?php 
        echo $jLang['_ADMIN_DASH_HELP'];
        ?>
</h2>
	<p><?php 
        echo $jLang['_ADMIN_DASH_HELP_INTRO'];
        ?>
 <a href="http://www.jtips.com.au" target="_blank">www.jtips.com.au</a></p>
	<ul>
		<li><?php 
        echo $jLang['_ADMIN_DASH_HELP_GETTING_STARTED'];
        ?>
</li>
		<li><?php 
        echo $jLang['_ADMIN_DASH_HELP_GUIDES'];
        ?>
</li>
		<li><?php 
        echo $jLang['_ADMIN_DASH_HELP_TRICKS'];
        ?>
</li>
	</ul>
	<p>Do you have an invalid license key? Please contact jTips Support
		at <a href="mailto:support@jtips.com.au">support@jtips.com.au</a> and confirm your license key
		is valid for the domain <strong><?php 
        echo $_SERVER['SERVER_NAME'];
        ?>
</strong>.</p>
	<?php 
        $tabs->endTab();
        $tabs->endPane();
        ?>
	</div>
	</td>
	</tr>
	</table>
	<?php 
    }
Пример #14
0
        <tbody>
        <?php 
//create list of file names
$files = array();
foreach (new DirectoryIterator($save_dir) as $fileinfo) {
    if (!is_dir($save_dir . $fileinfo)) {
        $files[$fileinfo->getMTime()] = $fileinfo->getFilename();
    }
}
krsort($files);
$dirArray = array_values($files);
//loop through the array of files
for ($index = 0; $index < count($dirArray); $index++) {
    $file_name = $dirArray[$index];
    $file_path = str_replace(" ", "%20", $save_dir . $dirArray[$index]);
    $file_size = size_readable(filesize($save_dir . $dirArray[$index]));
    $file_modtime = strftime('%c', filemtime($save_dir . $dirArray[$index]));
    $file_new = $index === 0 && $action_save && $scanner_ok && time() - filemtime($save_dir . $dirArray[$index]) <= 60;
    if (!$do_file_timezone) {
        $file_modtime = str_replace(array(' CET', ' CEST'), '', $file_modtime);
    }
    //file type and category
    $file_extention = findexts($dirArray[$index]);
    $file_category = '';
    switch ($file_extention) {
        case "bmp":
            $file_extention = $lang[$lang_id][47];
            $file_category = "image";
            break;
        case "jpg":
        case "jpeg":
Пример #15
0
        if ($_POST['simple']) {
            redir("{$r}/{$nImgPrefix}/{$uplImage}");
        } elseif ($useHtaccess) {
            redir("{$r}/i/{$uplImage}");
        } else {
            redir("{$r}/{$nImgPrefix}/html/{$uplImage}.html");
        }
    }
} elseif (isset($_FILES['file']) && $filesEnabled) {
    $uplFile = nFileHandleUpload($_FILES['file']);
    $about = preg_replace("/^.*:([^:]+)\$/", "\$1", exec("file --mime {$nFilePrefix}/{$uplFile}"));
    if (!$uplFile) {
        err_inf("Something is wrong. " . $_FILES['image']['error']);
    } else {
        $fullname = split('/', $uplFile);
        file_put_contents("{$nFilePrefix}/html/{$uplFile}.html", "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\t<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='ru' lang='ru'>\n\t<head>\n\t<title>{$fullname['1']}</title>\n\t<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />\n\t<link rel='icon' type='image/png' href='{$r}/favicon.png' />\n\t<link rel='STYLESHEET' href='{$r}/css.css' type= 'text/css' />\n\t</head>\n\t<body><p>\n\t{$fullname['1']}, {$about}, " . size_readable(filesize("{$nFilePrefix}/{$uplFile}"), null, '%d %s') . "\n\t<br />\n\t<a href='http://{$siteroot}{$r}/{$nFilePrefix}/{$uplFile}'>Download</a></p>\n\t<form action='{$r}/' method='post' enctype='multipart/form-data'>\n\t<input type='hidden' name='MAX_FILE_SIZE' value='{$filelimit}' />\n\t<input type='file' size='50' name='file' /> <br />\n\t<input type='submit' value='Dump another one!' />\n\t<a href='{$r}/'>NBL file dumping facility</a> | <small><a href='{$r}/?delete={$nFilePrefix}/{$uplFile}'>Delete this file</a></small> </body></html>");
        chmod("{$nFilePrefix}/html/{$uplFile}.html", 0755) or $fail = 1;
        if ($_POST['simple']) {
            redir("{$r}/{$nFilePrefix}/{$uplFile}");
        } elseif ($useHtaccess) {
            redir("{$r}/f/{$uplFile}");
        } else {
            redir("{$r}/{$nFilePrefix}/html/{$uplFile}.html");
        }
    }
}
// uploading form
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='ru' lang='ru'>\n<head>\n<title>NBL file dumping facility</title>\n<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />\n<link rel='icon' type='image/png' href='{$r}/favicon.png' />\n<link rel='STYLESHEET' href='{$r}/css.css' type= 'text/css' />\n</head>\n<body><div class='content'>\n";
inf_err();
if ($imagingEnabled) {
    echo "\n<h2> Dump a picture </h2>\n\t<form action='{$r}/' method='post' enctype='multipart/form-data'>\n\t<input type='hidden' name='MAX_FILE_SIZE' value='{$imglimit}' />\n\t<input type='file' size='50' name='image' /> <br />\n\t<input type='submit' value='Dump!' />\n</form>";
Пример #16
0
                     }
                 }
             } elseif (mysql_field_name($result, $i) == 'toim_tuoteno_tunnus') {
                 $query = "SELECT tt.toim_tuoteno\n                      FROM tuotteen_toimittajat AS tt\n                      WHERE tt.yhtio = '{$kukarow['yhtio']}'\n                      AND tt.tunnus  = '{$trow[$i]}'";
                 $toim_tuoteno_chk_res = pupe_query($query);
                 $toim_tuoteno_chk_row = mysql_fetch_assoc($toim_tuoteno_chk_res);
                 echo $toim_tuoteno_chk_row['toim_tuoteno'];
             } else {
                 echo $trow[1];
             }
             echo "</a></td>";
         } else {
             if (mysql_field_type($result, $i) == 'real' or mysql_field_type($result, $i) == 'int') {
                 echo "<td style='text-align:right'>{$fontlisa1} {$trow[$i]} {$fontlisa2}</td>";
             } elseif (mysql_field_name($result, $i) == 'koko') {
                 echo "<td>{$fontlisa1} " . size_readable($trow[$i]) . " {$fontlisa2}</td>";
             } else {
                 if (!function_exists("ps_callback")) {
                     function ps_callback($matches)
                     {
                         return tv1dateconv($matches[0]);
                     }
                 }
                 $trow[$i] = preg_replace_callback("/[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}/", "ps_callback", $trow[$i]);
                 echo "<td>{$fontlisa1} {$trow[$i]} {$fontlisa2}</td>";
             }
         }
     }
 }
 if ($from == "" and ($toim == "asiakasalennus" or $toim == "asiakashinta" or $toim == "hinnasto" or $toim == "puun_alkio") and $oikeurow['paivitys'] == 1) {
     echo "<td><input type = 'checkbox' name = 'poista_check[]' value = '{$trow['0']}'></td>";
Пример #17
0
        $traffic_complete['http'] += $http;
        $traffic_complete['ftp'] += $ftp_up + $ftp_down;
        $traffic_complete['mail'] += $mail;
        $traf['month'] = $row['month'];
        $traf['year'] = $row['year'];
        $traf['monthname'] = $lng['traffic']['months'][intval($row['month'])] . " " . $row['year'];
        $traf['byte'] = $http + $ftp_up + $ftp_down + $mail;
        if (extension_loaded('bcmath')) {
            $traf['ftptext'] = bcdiv($ftp_up, 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . bcdiv($ftp_down, 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)";
            $traf['httptext'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)";
            $traf['mailtext'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)";
            $traf['ftp'] = bcdiv($ftp_up + $ftp_down, 1024, Settings::Get('panel.decimal_places'));
            $traf['http'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places'));
            $traf['mail'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places'));
            $traf['byte'] = bcdiv($traf['byte'], 1024 * 1024, Settings::Get('panel.decimal_places'));
        } else {
            $traf['ftptext'] = round($ftp_up / 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . round($ftp_down / 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)";
            $traf['httptext'] = round($http / 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)";
            $traf['mailtext'] = round($mail / 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)";
            $traf['ftp'] = round(($ftp_up + $ftp_down) / 1024, Settings::Get('panel.decimal_places'));
            $traf['http'] = round($http / 1024, Settings::Get('panel.decimal_places'));
            $traf['mail'] = round($mail / 1024, Settings::Get('panel.decimal_places'));
            $traf['byte'] = round($traf['byte'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
        }
        eval("\$traffic.=\"" . getTemplate('traffic/traffic_traffic') . "\";");
    }
    $traffic_complete['http'] = size_readable($traffic_complete['http'] * 1024, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
    $traffic_complete['ftp'] = size_readable($traffic_complete['ftp'] * 1024, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
    $traffic_complete['mail'] = size_readable($traffic_complete['mail'] * 1024, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
    eval("echo \"" . getTemplate('traffic/traffic') . "\";");
}
 function soapCall($soap_params, $use_extra_params = true)
 {
     // Prepare SOAP parameters
     $callParams = $soap_params;
     unset($callParams['remote_name']);
     unset($callParams['output']);
     $callParams['offset'] = 0;
     $callParams['chunk_size'] = $GLOBALS['soap']->getFileChunkSize();
     $startTime = microtime(true);
     $totalTran = 0;
     $i = 0;
     do {
         $callParams['offset'] = $i * $GLOBALS['soap']->getFileChunkSize();
         $content = base64_decode($GLOBALS['soap']->call($this->soapCommand, $callParams, $use_extra_params));
         if ($i == 0) {
             $this->manageOutput($soap_params, $output, $fd);
         }
         $cLength = strlen($content);
         if ($output !== false) {
             $written = fwrite($fd, $content);
             if ($written != $cLength) {
                 throw new Exception('Received ' . $cLength . ' of data but only ' . $written . ' written on Disk');
             }
         } else {
             echo $content;
         }
         $totalTran += $cLength;
         $i++;
     } while ($cLength >= $GLOBALS['soap']->getFileChunkSize());
     $endTime = microtime(true);
     $GLOBALS['LOG']->add('File download completed');
     $transRate = $totalTran / ($endTime - $startTime);
     $GLOBALS['LOG']->add('Transfer rate: ' . size_readable($transRate, null, 'bi', '%.2f %s/s'));
     if ($output !== false) {
         fclose($fd);
         unset($callParams['offset']);
         unset($callParams['chunk_size']);
         $fileInfo = $GLOBALS['soap']->call('getFileInfo', $callParams, $use_extra_params);
         if ($fileInfo->computed_md5) {
             $GLOBALS['LOG']->add('Compute downloaded file\'s md5 sum');
             $localChecksum = PHP_BigFile::getMd5Sum($output);
             if ($localChecksum != $fileInfo->computed_md5) {
                 exit_error("File transfer faild: md5 checksum locally computed doesn't match remote one ({$fileInfo->computed_md5})");
             } else {
                 echo "File retrieved successfully (md5 checksum verified).\n";
             }
         } else {
             echo "File retrieved successfully.\n";
         }
     }
 }
Пример #19
0
            #open directory
            while (false !== ($dyu = readdir($dayu))) {
                #				if (!eregi("\.html",$dyu) && !eregi("_vti_conf",$dyu) && !eregi("error",$dyu) && $dyu!=='.' && $dyu!=='..')
                if (!preg_match("/(\\.html|_vti_conf|_vti_cnf|_vti_cnf|error)\$/i", $dyu) && !preg_match("/^[\\.]/", $dyu)) {
                    $dayarrayu[] = $dyu;
                }
            }
            closedir($dayu);
            if ($dayarrayu) {
                sort($dayarrayu);
                $j = 1;
                foreach ($dayarrayu as $dyu) {
                    #					if (eregi(".\htm",$dyu)) $dyhtmu=str_replace(".htm","",$dyu);
                    #					else $dyhtmu=str_replace(".php","",$dyu);
                    $dyhtmu = str_replace($yeardiru . $monthdiru, "", preg_replace("/(\\.htm|\\.php)\$/i", "", $dyu));
                    echo "<li><a href={$du}/{$dyu}?L={$L} onMouseOver=\"window.status='" . sprintf(A_CHAT_LOGS_16, $dyhtmu . " " . $MONTHU) . "'; return true;\" title='" . sprintf(A_CHAT_LOGS_16, $dyhtmu . " " . $MONTHU) . "'>{$dyhtmu}</a> (" . size_readable(filesize($du . "/" . $dyu)) . ")<br />\n";
                    #print name of each file found
                    if ($j % 5 == 0) {
                        echo "<td valign=top align=left nowrap=\"nowrap\">";
                    }
                    $j++;
                }
            }
            unset($dayarrayu);
            echo "</tr>";
        }
        echo "</td></tr></table><br />";
    }
    ?>
<P align="right"><div align="right"><span dir="LTR" style="font-weight: 600; color:#FFD700; font-size: 7pt">
&copy; 2005-<?php 
Пример #20
0
function show_main_page()
{
    if (isset($_SESSION['FILE_category_added'])) {
        alert($_SESSION['FILE_category_added'], 1);
        unset($_SESSION['FILE_category_added']);
    }
    if (isset($_SESSION['FILE_category_edited'])) {
        alert($_SESSION['FILE_category_edited'], 1);
        unset($_SESSION['FILE_category_edited']);
    }
    if (isset($_SESSION['FILE_category_deleted'])) {
        alert($_SESSION['FILE_category_deleted'], 1);
        unset($_SESSION['FILE_category_deleted']);
    }
    if (isset($_SESSION['FILE_added'])) {
        alert($_SESSION['FILE_added'], 1);
        unset($_SESSION['FILE_added']);
    }
    if (isset($_SESSION['FILE_edited'])) {
        alert($_SESSION['FILE_edited'], 1);
        unset($_SESSION['FILE_edited']);
    }
    if (isset($_SESSION['FILE_deleted'])) {
        alert($_SESSION['FILE_deleted'], 1);
        unset($_SESSION['FILE_deleted']);
    }
    $total_space = dirsize('../.content/uploads');
    page_header('File List');
    echo <<<HEREDOC
      <h1>File List</h1>
      <span class="b">Total Space Used:&nbsp;&nbsp;</span>{$total_space}
\t  
\t  <br /> <br />
\t  <div style='font-weight:bold'>2010-2013 files have been archived to <a href='https://www.dropbox.com/sh/6wo6f5i8il42m1c/RxpAYq6Pb1'>the Dropbox</a>.</div>
      
      <br /><br />
      <a href="Edit_File_Category?Add">+ Add a Category</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="Edit_File?Add">+ Upload a File</a><br />
      <br />

HEREDOC;
    $query = 'SELECT files.*, file_categories.name AS category_name, file_categories.category_id FROM files' . ' RIGHT JOIN file_categories ON files.category=file_categories.category_id ' . ' WHERE ( files.category <> 2 && files.category <> 5 && files.category <> 8 && files.category <> 9 ) ' . ' ORDER BY category_name, category_id, order_num';
    $result = DB::queryRaw($query);
    $row = mysqli_fetch_assoc($result);
    //foreach($result as $file)
    //	file['filename'];
    //	file[''];
    $current_category = -1;
    $has_files = false;
    while ($row) {
        $filename = $row['filename'];
        if (file_exists('../.content/uploads/' . $filename)) {
            $file_size = filesize('../.content/uploads/' . $filename);
            if ($file_size === false) {
                $file_size = '?';
            } else {
                $file_size = size_readable($file_size);
            }
        } else {
            $file_size = 'File does not exist.';
        }
        $visibility = $row['permissions'];
        if ($visibility == 'P') {
            $visibility = 'Public';
        } else {
            if ($visibility == 'M') {
                $visibility = 'Member';
            } else {
                $visibility = 'Admin';
            }
        }
        if ($row['category_id'] != $current_category) {
            if ($current_category != -1) {
                if ($has_files) {
                    echo "      </table><br /><br />\n";
                } else {
                    echo "        &nbsp;&nbsp;&nbsp;No Files<br /><br />\n";
                }
            }
            $current_category = $row['category_id'];
            $has_files = false;
            echo <<<HEREDOC

      <h4>{$row['category_name']}&nbsp;&nbsp;<span class="small">(<a href="Edit_File_Category?ID={$row['category_id']}">Edit</a>)</span></h4>

HEREDOC;
            if ($filename != '') {
                echo <<<HEREDOC
      <table class="contrasting">
        <tr>
          <th>&nbsp;&nbsp;&nbsp;&nbsp;</th>
          <th>&nbsp;&nbsp;&nbsp;&nbsp;</th>
          <th>File Name</th>
          <th>Size</th>
          <th>Visibility</th>
          <th></th>
        </tr>

HEREDOC;
            }
        }
        if ($filename != '') {
            $up = <<<HEREDOC
            <td class="text-centered"><a href="Edit_File?Up&amp;ID={$row['file_id']}&amp;xsrf_token={$_SESSION['xsrf_token']}" class="nounderline">&uarr;</a></td>

HEREDOC;
            $down = <<<HEREDOC
            <td class="text-centered"><a href="Edit_File?Down&amp;ID={$row['file_id']}&amp;xsrf_token={$_SESSION['xsrf_token']}" class="nounderline">&darr;</a></td>

HEREDOC;
            if (!$has_files) {
                $up = '<td></td>';
            }
            $has_files = true;
            $file_id = $row['file_id'];
            $name = $row['name'];
            $row = mysqli_fetch_assoc($result);
            if ($row['category'] != $current_category) {
                $down = "<td></td>";
            }
            echo <<<HEREDOC
        <tr>{$up}{$down}
          <td><a href="../Download?ID={$file_id}">{$name}</a></td>
          <td>{$file_size}</td>
          <td>{$visibility}</td>
          <td><a href="Edit_File?ID={$file_id}">Edit</a></td>
        </tr>

HEREDOC;
        } else {
            $row = mysqli_fetch_assoc($result);
        }
    }
    if ($current_category != '') {
        if ($has_files) {
            echo "      </table><br /><br />\n";
        } else {
            echo "        &nbsp;&nbsp;&nbsp;No Files<br /><br />\n";
        }
    }
    $query = 'SELECT * FROM files WHERE category="0" ORDER BY order_num';
    $result = DB::queryRaw($query);
    $row = mysqli_fetch_assoc($result);
    if (mysqli_num_rows($result) > 0) {
        $first = true;
        echo <<<HEREDOC
      <br /><br />
      <h4>Miscellaneous</h4>
      <table class="contrasting">
        <tr>
          <th>&nbsp;&nbsp;&nbsp;&nbsp;</th>
          <th>&nbsp;&nbsp;&nbsp;&nbsp;</th>
          <th>File Name</th>
          <th>Size</th>
          <th>Visibility</th>
          <th></th>
        </tr>

HEREDOC;
        while ($row) {
            $up = <<<HEREDOC
            <td class="text-centered"><a href="Edit_File?Up&amp;ID={$row['file_id']}&amp;xsrf_token={$_SESSION['xsrf_token']}" class="nounderline">&uarr;</a></td>

HEREDOC;
            $down = <<<HEREDOC
            <td class="text-centered"><a href="Edit_File?Down&amp;ID={$row['file_id']}&amp;xsrf_token={$_SESSION['xsrf_token']}" class="nounderline">&darr;</a></td>

HEREDOC;
            if ($first) {
                $up = '<td></td>';
            }
            $first = false;
            $file_id = $row['file_id'];
            $name = $row['name'];
            $filename = $row['filename'];
            if (file_exists('../.content/uploads/' . $filename)) {
                $file_size = filesize('../.content/uploads/' . $filename);
                if ($file_size === false) {
                    $file_size = '?';
                } else {
                    $file_size = size_readable($file_size);
                }
            } else {
                $file_size = 'File does not exist.';
            }
            $visibility = $row['permissions'];
            if ($visibility == 'P') {
                $visibility = 'Public';
            } else {
                if ($visibility == 'M') {
                    $visibility = 'Member';
                } else {
                    $visibility = 'Admin';
                }
            }
            $row = mysqli_fetch_assoc($result);
            if (!$row) {
                $down = "<td></td>";
            }
            echo <<<HEREDOC
        <tr>{$up}{$down}
          <td><a href="../Download?ID={$file_id}">{$name}</a></td>
          <td>{$file_size}</td>
          <td>{$visibility}</td>
          <td><a href="Edit_File?ID={$file_id}">Edit</a></td>
        </tr>

HEREDOC;
        }
        echo "      </table>\n";
    }
}
Пример #21
0
    // Number of files
    $files = get_record_sql('SELECT COUNT(ident) AS numfiles,SUM(size) AS totalsize FROM ' . $CFG->prefix . 'files');
    $files_7days = get_record_sql('SELECT COUNT(ident) AS numfiles, SUM(size) AS totalsize FROM ' . $CFG->prefix . 'files WHERE time_uploaded > ?', array(time() - 86400 * 7));
    $run_result .= templates_draw(array('context' => 'adminTable', 'name' => "<h3>" . __gettext("File statistics") . "</h3> ", 'column1' => "<h4>" . __gettext("All-time:") . "</h4> <p>" . sprintf(__gettext("%u files (%s)"), $files->numfiles, size_readable($files->totalsize)) . "</p><h4>" . __gettext("Last 7 days:") . "</h4><p>" . sprintf(__gettext("%u files (%s)"), $files_7days->numfiles, size_readable($files_7days->totalsize)) . "</p>", 'column2' => "&nbsp;"));
    // DB size
    $totaldbsize = 0;
    if ($CFG->dbtype == 'mysql') {
        if ($dbsize = get_records_sql('SHOW TABLE STATUS')) {
            foreach ($dbsize as $atable) {
                // filter on prefix if we have it.
                if (!empty($CFG->prefix) && strpos($atable->Name, $CFG->prefix) !== 0) {
                    continue;
                }
                $totaldbsize += intval($atable->Data_length) + intval($atable->Index_length);
            }
            $run_result .= templates_draw(array('context' => 'adminTable', 'name' => "<h3>" . __gettext("Database statistics") . "</h3> ", 'column1' => "<h4>" . __gettext("Total database size:") . "</h4> <p>" . size_readable($totaldbsize) . "</p>", 'column2' => "&nbsp;"));
        }
    }
    // Users online right now
    $run_result .= "<h2>" . __gettext("Users online now") . "</h2>";
    $run_result .= "<p>" . __gettext("The following users have an active session and have performed an action within the past 10 minutes.") . "</p>";
    if ($users = get_records_select('users', "code != ? AND last_action > ?", array('', time() - 600), 'username ASC')) {
        $run_result .= templates_draw(array('context' => 'adminTable', 'name' => "<h3>" . __gettext("Username") . "</h3>", 'column1' => "<h3>" . __gettext("Full name") . "</h3>", 'column2' => "<h3>" . __gettext("Email address") . "</h3>"));
        foreach ($users as $user) {
            $run_result .= run("admin:users:panel", $user);
        }
    } else {
        $users = array();
    }
    $run_result .= "<p>" . sprintf(__gettext("%u users in total."), sizeof($users)) . "</p>";
}
foreach ($log_files as $log_file) {
    if (!file_exists(LOG_DIR . $log_file . '.log')) {
        continue;
    }
    $file_size = filesize(LOG_DIR . $log_file . '.log');
    echo "\t\t\t\t" . '<fieldset>' . "\n";
    echo "\t\t\t\t\t" . '<legend>' . ucwords($log_file) . ' Log</legend>' . "\n";
    echo "\t\t\t\t\t" . '<div class="infldset">' . "\n";
    echo "\t\t\t\t\t\t" . '<p>Allows viewing of the latest ' . $log_file . ' log from the server.</p>' . "\n";
    echo "\t\t\t\t\t\t" . '<p>Note: <i>This is reset when the server is started.</i></p>' . "\n";
    echo "\t\t\t\t\t\t" . '<div style="text-align:center">' . "\n";
    if ($file_size < 1048576) {
        echo '<textarea style="width:100%;height:200px" readonly="readonly">' . "\n";
        echo htmlspecialchars(trim(file_get_contents(LOG_DIR . $log_file . '.log'))) . "\n";
        echo '</textarea>' . "\n";
    } else {
        echo "\t\t\t\t\t\t\t" . '<p>Log omitted because over 1Mb (filesize: ' . size_readable($file_size) . '), <a href="admin_rscd_logs.php?action=download&log=' . $log_file . '">click here to download</a>.</p>' . "\n";
    }
    echo "\t\t\t\t\t\t" . '</div>' . "\n";
    echo "\t\t\t\t\t" . '</div>' . "\n";
    echo "\t\t\t\t" . '</fieldset>' . "\n";
    echo "\t\t\t\t" . '<br />' . "\n";
}
?>
			</div>
		</div>
	</div>
	<div class="clearer"></div>
</div>
<?php 
require PUN_ROOT . 'footer.php';