Exemple #1
1
 * @link      http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 * @package   Zend_ProgressBar
 */
use Zend\Loader\StandardAutoloader;
use Zend\ProgressBar\Adapter\JsPull;
use Zend\ProgressBar\ProgressBar;
/**
 * This sample file demonstrates a simple use case of a jspull-driven progressbar
 */
if (isset($_GET['uploadId'])) {
    require_once dirname(dirname(dirname(__DIR__))) . '/library/Zend/Loader/StandardAutoloader.php';
    $loader = new StandardAutoloader(array('autoregister_zf' => true));
    $loader->register();
    $data = uploadprogress_get_info($_GET['uploadId']);
    $bytesTotal = $data === null ? 0 : $data['bytes_total'];
    $bytesUploaded = $data === null ? 0 : $data['bytes_uploaded'];
    $adapter = new JsPull();
    $progressBar = new ProgressBar($adapter, 0, $bytesTotal, 'uploadProgress');
    if ($bytesTotal === $bytesUploaded) {
        $progressBar->finish();
    } else {
        $progressBar->update($bytesUploaded);
    }
}
?>
<html>
<head>
    <title>Zend_ProgressBar Upload Demo</title>
    <style type="text/css">
/**
 * Returns upload status.
 *
 * This is implementation for uploadprogress extension.
 */
function PMA_getUploadStatus($id)
{
    global $SESSION_KEY;
    global $ID_KEY;
    if (trim($id) == "") {
        return;
    }
    if (!array_key_exists($id, $_SESSION[$SESSION_KEY])) {
        $_SESSION[$SESSION_KEY][$id] = array('id' => $id, 'finished' => false, 'percent' => 0, 'total' => 0, 'complete' => 0, 'plugin' => $ID_KEY);
    }
    $ret = $_SESSION[$SESSION_KEY][$id];
    if (!PMA_import_uploadprogressCheck() || $ret['finished']) {
        return $ret;
    }
    $status = uploadprogress_get_info($id);
    if ($status) {
        if ($status['bytes_uploaded'] == $status['bytes_total']) {
            $ret['finished'] = true;
        } else {
            $ret['finished'] = false;
        }
        $ret['total'] = $status['bytes_total'];
        $ret['complete'] = $status['bytes_uploaded'];
        if ($ret['total'] > 0) {
            $ret['percent'] = $ret['complete'] / $ret['total'] * 100;
        }
    } else {
        $ret = array('id' => $id, 'finished' => true, 'percent' => 100, 'total' => $ret['total'], 'complete' => $ret['total'], 'plugin' => $ID_KEY);
    }
    $_SESSION[$SESSION_KEY][$id] = $ret;
    return $ret;
}
Exemple #3
0
 public function executeFileuploadstatus($request)
 {
     $fileid = $request->getParameter('fileid');
     if (function_exists("uploadprogress_get_info")) {
         $info = uploadprogress_get_info($fileid);
     } else {
         $info = false;
     }
     $result = json_encode($info);
     $this->getResponse()->addCacheControlHttpHeader('no-cache');
     $this->getResponse()->setHttpHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT');
     $this->getResponse()->setHttpHeader('Content-type', 'application/json');
     $this->getResponse()->setHttpHeader("X-JSON", $result);
     return sfView::HEADER_ONLY;
 }
/**
 * This function updates the progress bar
 * @param div_id where the progress bar is displayed
 * @param upload_id the identifier given in the field UPLOAD_IDENTIFIER
 */
function updateProgress($div_id, $upload_id, $waitAfterupload = false)
{
    $objResponse = new XajaxResponse();
    $ul_info = uploadprogress_get_info($upload_id);
    $percent = intval($ul_info['bytes_uploaded'] * 100 / $ul_info['bytes_total']);
    if ($waitAfterupload && $ul_info['est_sec'] < 2) {
        $percent = 100;
        $objResponse->addAssign($div_id . '_label', 'innerHTML', get_lang('UploadFile') . ' : ' . $percent . ' %');
        $objResponse->addAssign($div_id . '_waiter_frame', 'innerHTML', '<img src="' . api_get_path(WEB_CODE_PATH) . 'img/progress_bar.gif" />');
        $objResponse->addScript('clearInterval("myUpload.__progress_bar_interval")');
    }
    $objResponse->addAssign($div_id . '_label', 'innerHTML', get_lang('UploadFile') . ' : ' . $percent . ' %');
    $objResponse->addAssign($div_id . '_filled', 'style.width', $percent . '%');
    return $objResponse;
}
Exemple #5
0
 function get()
 {
     $this->sessionState(0);
     // turn off the session..
     header("Cache-Control: no-cache, must-revalidate");
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     if (!function_exists('uploadprogress_get_info')) {
         $this->jok(false);
     }
     if (!empty($_GET['id'])) {
         // var_dump(uploadprogress_get_info($_GET['id']));
         $ret = uploadprogress_get_info($_GET['id']);
         $this->jok($ret);
     }
     $this->jerr("no data");
 }
Exemple #6
0
 function compose($o)
 {
     if ($this->get->id) {
         $this->expires = 'onmaxage';
         Patchwork::setPrivate();
         if (function_exists('upload_progress_meter_get_info')) {
             $o = (object) @upload_progress_meter_get_info($this->get->id);
         } else {
             if (function_exists('uploadprogress_get_info')) {
                 $o = (object) @uploadprogress_get_info($this->get->id);
             }
         }
     } else {
         $this->maxage = -1;
     }
     return $o;
 }
 /**
  * @param  string $id
  * @return array|bool
  * @throws Exception\PhpEnvironmentException
  */
 protected function getUploadProgress($id)
 {
     if (!$this->isUploadProgressAvailable()) {
         throw new Exception\PhpEnvironmentException('UploadProgress extension is not installed');
     }
     $uploadInfo = uploadprogress_get_info($id);
     if (!is_array($uploadInfo)) {
         return false;
     }
     $status = array('total' => 0, 'current' => 0, 'rate' => 0, 'message' => '', 'done' => false);
     $status = $uploadInfo + $status;
     $status['total'] = $status['bytes_total'];
     $status['current'] = $status['bytes_uploaded'];
     $status['rate'] = $status['speed_average'];
     if ($status['total'] == $status['current']) {
         $status['done'] = true;
     }
     return $status;
 }
 /**
  * Returns the progress status for a file upload process.
  *
  * @param string $key
  *   The unique key for this upload process.
  *
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  *   A JsonResponse object.
  */
 public function progress($key)
 {
     $progress = array('message' => t('Starting upload...'), 'percentage' => -1);
     $implementation = file_progress_implementation();
     if ($implementation == 'uploadprogress') {
         $status = uploadprogress_get_info($key);
         if (isset($status['bytes_uploaded']) && !empty($status['bytes_total'])) {
             $progress['message'] = t('Uploading... (@current of @total)', array('@current' => format_size($status['bytes_uploaded']), '@total' => format_size($status['bytes_total'])));
             $progress['percentage'] = round(100 * $status['bytes_uploaded'] / $status['bytes_total']);
         }
     } elseif ($implementation == 'apc') {
         $status = apc_fetch('upload_' . $key);
         if (isset($status['current']) && !empty($status['total'])) {
             $progress['message'] = t('Uploading... (@current of @total)', array('@current' => format_size($status['current']), '@total' => format_size($status['total'])));
             $progress['percentage'] = round(100 * $status['current'] / $status['total']);
         }
     }
     return new JsonResponse($progress);
 }
 /**
  * Get the status of all uploads passed in
  */
 function getStatus($ids)
 {
     $ret = array();
     foreach ($ids as $id => $upId) {
         $ret[$id] = new stdClass();
         if (!function_exists('uploadprogress_get_info')) {
             $ret[$id]->message = "Uppladdning YYpågår";
             $ret[$id]->percent = "10";
             $ret[$id]->noStatus = true;
             return $ret;
         }
         $tmp = uploadprogress_get_info($upId);
         if (!is_array($tmp)) {
             sleep(1);
             $tmp = uploadprogress_get_info($upId);
             if (!is_array($tmp)) {
                 $ret[$id]->message = "Uppladdning klar";
                 $ret[$id]->percent = "100";
                 return $ret;
             }
         }
         if ($tmp['bytes_total'] < 1) {
             $percent = 100;
         } else {
             $percent = round($tmp['bytes_uploaded'] / $tmp['bytes_total'] * 100, 2);
         }
         if ($percent == 100) {
             $ret[$id]->message = "Klar!";
         }
         $eta = sprintf("%02d:%02d", $tmp['est_sec'] / 60, $tmp['est_sec'] % 60);
         $speed = $this->_formatBytes($tmp['speed_average']);
         $current = $this->_formatBytes($tmp['bytes_uploaded']);
         $total = $this->_formatBytes($tmp['bytes_total']);
         $ret[$id]->message = "{$eta} kvar (@ {$speed}/sec)\t{$current}/{$total} ({$percent}%)";
         $ret[$id]->percent = $percent;
     }
     return $ret;
 }
<?php

//single upload progress meter
//http://www.ultramegatech.com/blog/2010/10/create-an-upload-progress-bar-with-php-and-jquery/
include '../../include/db.php';
// Fetch the upload progress data
$status = uploadprogress_get_info(getval('uid', 'test'));
if ($status) {
    // Calculate the current percentage
    echo round($status['bytes_uploaded'] / $status['bytes_total'] * 100);
} else {
    // If there is no data, assume it's done
    echo 100;
}
Exemple #11
0
  +----------------------------------------------------------------------+
  | Copyright (c) 2006-2008 The PHP Group                                |
  +----------------------------------------------------------------------+
  | This source file is subject to version 3.01 of the PHP license,      |
  | that is bundled with this package in the file LICENSE, and is        |
  | available through the world-wide-web at the following url:           |
  | http://www.php.net/license/3_01.txt.                                 |
  | If you did not receive a copy of the PHP license and are unable to   |
  | obtain it through the world-wide-web, please send a note to          |
  | license@php.net so we can mail you a copy immediately.               |
  +----------------------------------------------------------------------+
  | Author: Christian Stocker (chregu@php.net)                           |
  +----------------------------------------------------------------------+
*/
if (function_exists("uploadprogress_get_info")) {
    $info = uploadprogress_get_info($_GET['ID']);
} else {
    $info = false;
}
?>
<html>
<head>
<script type="text/javascript">
<?php 
if ($info !== null) {
    print "parent.UP.updateInfo(" . $info['bytes_uploaded'] . "," . $info['bytes_total'] . "," . $info['est_sec'] . ")";
} else {
    print "parent.UP.updateInfo()";
}
?>
</script>
Exemple #12
0
 function estado($id)
 {
     // Buscamos la extensión uploadprogress
     if (!function_exists('uploadprogress_get_info')) {
         echo "noimplementado";
     } else {
         if (!isset($id)) {
             echo "nulo";
         }
         $info = uploadprogress_get_info($id);
         if ($info == NULL) {
             echo "nulo";
         } else {
             $enviados = $info['bytes_uploaded'];
             $total = $info['bytes_total'];
             $porcentaje = round($enviados / $total, 2) * 100;
             $velocidad = $this->manejoauxiliar->velocidad_envio($info['speed_last']);
             $estimado = $this->manejoauxiliar->intervalo_tiempo($info['est_sec']);
             print $porcentaje . ";" . $velocidad . ";" . $estimado;
         }
     }
 }
Exemple #13
0
 /**
  * Never call this method if you don't know what you're doing
  */
 public function executeExternalCommands()
 {
     if (isset($_REQUEST['_p4a_session_browser'])) {
         if (!empty($_REQUEST['_p4a_session_browser']) and isset($this->objects[$_REQUEST['_p4a_session_browser']])) {
             $obj =& $this->objects[$_REQUEST['_p4a_session_browser']];
         } else {
             $obj =& $this;
         }
         $vars = get_object_vars($obj);
         ksort($vars);
         $name = $obj->getName();
         if (empty($name)) {
             $name = "P4A main object";
         }
         $name .= ' (' . get_class($obj) . ')';
         echo "<h1>{$name}</h1>";
         echo "<table border='1'>";
         echo "<tr><th>key</th><th>value</th></tr>";
         foreach ($vars as $k => $v) {
             $v = _P4A_Debug_Print_Variable($v);
             echo "<tr><td valign='top'>{$k}</td><td>{$v}</td></tr>";
         }
         echo "</table>";
         die;
     } elseif (isset($_REQUEST['_rte_file_manager']) and isset($_REQUEST['_object_id']) and isset($this->objects[$_REQUEST['_object_id']])) {
         require P4A_THEME_DIR . '/widgets/rich_textarea/filemanager/connectors/php/connector.php';
         die;
     } elseif (isset($_REQUEST['_upload_path'])) {
         $path = P4A_UPLOADS_PATH;
         if (isset($_REQUEST['_object_id']) and isset($this->objects[$_REQUEST['_object_id']])) {
             $object =& $this->objects[$_REQUEST['_object_id']];
             if ($object instanceof P4A_Field) {
                 $path .= '/' . $object->getUploadSubpath();
             }
         }
         echo preg_replace(array("~/+~", "~/\$~"), array('/', ''), $path);
         die;
     } elseif (isset($_REQUEST['_p4a_autocomplete'])) {
         if (isset($_REQUEST['_object']) and isset($_REQUEST['term']) and isset($this->objects[$_REQUEST['_object']])) {
             $object =& $this->objects[$_REQUEST['_object']];
             $db = P4A_DB::singleton($object->data_field->getDSN());
             $data =& $object->data;
             $old_where = $data->getWhere();
             $description_field = $object->getSourceDescriptionField();
             if ($object->isActionTriggered('onautocomplete')) {
                 $this->actionHandler('onautocomplete', $data, $_REQUEST['term']);
             } else {
                 $q = $db->quote($_REQUEST['term'], false);
                 $where = $db->getCaseInsensitiveLikeSQL($description_field, "%{$q}%");
                 if ($old_where) {
                     $where = "({$old_where}) AND ({$where})";
                 }
                 $data->setWhere($where);
             }
             $all = $data->getAll();
             $data->setWhere($old_where);
             $new_data = array();
             $tmp = array();
             foreach ($all as $row) {
                 $tmp[$row[$description_field]] = $row[$description_field];
             }
             ksort($tmp);
             foreach ($tmp as $k => $v) {
                 $new_data[] = array("id" => $k, "label" => htmlspecialchars($k), "value" => $k);
             }
             require_once "Zend/Json.php";
             echo Zend_Json::encode($new_data);
         }
         die;
     } elseif (isset($_REQUEST['_p4a_date_format'])) {
         echo $this->i18n->format($_REQUEST['_p4a_date_format'], 'date', null, false);
         die;
     } elseif (isset($_REQUEST['_p4a_time_format'])) {
         echo $this->i18n->format($_REQUEST['_p4a_time_format'], 'time', null, false);
         die;
     } elseif (isset($_REQUEST['_p4a_datetime_format'])) {
         echo $this->i18n->format($_REQUEST['_p4a_datetime_format'], 'datetime', null, false);
         die;
     } elseif (isset($_REQUEST['_p4a_image_thumbnail'])) {
         $image_data = explode('&', $_REQUEST['_p4a_image_thumbnail']);
         $thumb = new P4A_Thumbnail_Generator();
         $thumb->setCacheDir(P4A_UPLOADS_TMP_DIR)->setFilename(P4A_Strip_Double_Slashes(P4A_UPLOADS_DIR . $image_data[0]))->setMaxWidth($image_data[1])->setMaxHeight($image_data[1])->processFile()->outputThumbnail();
         die;
     } elseif (isset($_REQUEST['_p4a_download_file'])) {
         $file = realpath(P4A_UPLOADS_DIR . '/' . $_REQUEST['_p4a_download_file']);
         if (P4A_OS == "linux") {
             if (strpos($file, realpath(P4A_UPLOADS_DIR)) !== 0) {
                 die;
             }
         } else {
             if (stripos($file, realpath(P4A_UPLOADS_DIR)) !== 0) {
                 die;
             }
         }
         if ($file !== false and file_exists($file)) {
             $name = basename($file);
             $name = preg_replace("/^_p4a_.*?_/", "", $name);
             $gmdate = gmdate("D, d M Y H:i:s");
             header("Content-Type: text/html; charset=UTF-8");
             header("Cache-Control: no-store, no-cache, must-revalidate");
             header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
             header("Pragma: no-cache");
             header("Last-Modified: {$gmdate} GMT");
             header("Content-type: application/octet-stream");
             header("Content-Disposition: attachment; filename=\"{$name}\"");
             header("Content-Length: " . filesize($file));
             $fp = fopen($file, "rb");
             fpassthru($fp);
             fclose($fp);
             if (strpos($file, realpath(P4A_UPLOADS_TMP_DIR) . DIRECTORY_SEPARATOR . '_p4a_') === 0) {
                 unlink($file);
             }
         }
         die;
     } elseif (isset($_REQUEST['_p4a_upload_progress']) and P4A_UPLOAD_PROGRESS) {
         $upload_info = uploadprogress_get_info($_REQUEST['_p4a_upload_progress']);
         if (is_array($upload_info)) {
             $percentage = round($upload_info["bytes_uploaded"] / $upload_info["bytes_total"] * 100) . "%";
             $speed = round($upload_info["speed_average"] / 1024) . "KB/s";
             echo "{$percentage} - {$speed}";
         }
         die;
     }
 }
<?php

header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
if (@$_GET['id']) {
    echo json_encode(uploadprogress_get_info($_REQUEST['id']));
    exit;
}
if (@$_POST['UPLOAD_IDENTIFIER']) {
    exit;
}
$uuid = uniqid();
?>
<script type="text/javascript" src="tpl/stdstyle/js/jquery.js"></script>
<script type="text/javascript" src="tpl/stdstyle/js/jquery.progressbar.min.js"></script>
<script type="text/javascript">
    var progress_key = '<?php 
echo $uuid;
?>
';

    $(document).ready(function () {
        $("#pb1").progressBar();
        $("#pb2").progressBar({barImage: 'tpl/stdstyle/images/progressbar/progressbg_yellow.gif'});
        $("#pb3").progressBar({barImage: 'tpl/stdstyle/images/progressbar/progressbg_green.gif', showText: false});
        $("#pb4").progressBar(65, {showText: false, barImage: 'tpl/stdstyle/images/progressbar/progressbg_red.gif'});
        $(".pb5").progressBar({max: 2000, textFormat: 'fraction', callback: function (data) {
                if (data.running_value == data.value) {
                    alert("Callback example: Target reached!");
                }
            }});
Exemple #15
0
<?php

$data = null;
if (isset($_GET['upload_key'])) {
    $data = uploadprogress_get_info($_GET['upload_key']);
    if (!$data) {
        sleep(1);
        $data = uploadprogress_get_info($_GET['upload_key']);
    }
}
echo json_encode($data);
Exemple #16
0
 function getProgress($uploadId)
 {
     $progress = uploadprogress_get_info($uploadId);
     return !is_array($progress) ? null : array('total' => $progress['bytes_total'], 'current' => $progress['bytes_uploaded']);
 }
Exemple #17
0
<?php

/*
  This file is part of the Filebin package.
  Copyright (c) 2003-2009, Stephen Olesen
  All rights reserved.
  More information is available at http://filebin.ca/
*/
require "filebin.inc.php";
if (!isset($_GET["dl"])) {
    exit;
}
$p = uploadprogress_get_info($_GET["dl"]);
if (empty($p)) {
    header("Content-Type: text/javascript");
    $sth = getDB()->prepare("SELECT error,error_message FROM upload_tracking WHERE upload_id=? ORDER BY created DESC LIMIT 1");
    $sth->execute(array($_GET["dl"]));
    $row = $sth->fetch(PDO::FETCH_ASSOC);
    $sth = null;
    if ($row['error']) {
        print 'location.href = "http://filebin.ca/error.php?id=' . $_GET['dl'] . '";';
        exit;
    }
    $f = new File();
    $f->byUploadID($_GET["dl"]);
    if ($f->valid) {
        print 'location.href = "http://filebin.ca/complete.php?id=' . $_GET['dl'] . '";';
    } else {
        print 'if(canForward || requestCount++ > 7) { location.href = "http://filebin.ca/complete.php?id=' . $_GET['dl'] . '"; }';
    }
    exit;
Exemple #18
0
<?php

header("Pramga: no-cache");
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Thur, 25 May 1988 14:00:00 GMT");
$status = false;
// APC upload progress is enabled:
if ((bool) ini_get('apc.rfc1867')) {
    $status = apc_fetch(ini_get('apc.rfc1867_prefix') . $_GET['for']);
    $status = array('bytes_uploaded' => (int) $status['current'], 'bytes_total' => (int) $status['total']);
} else {
    if (function_exists('uploadprogress_get_info')) {
        $status = uploadprogress_get_info($_GET['for']);
        $status = array('bytes_uploaded' => (int) $status['bytes_uploaded'], 'bytes_total' => (int) $status['bytes_total']);
    }
}
$status['bytes_uploaded'] = max($status['bytes_uploaded'], 0);
$status['bytes_total'] = max($status['bytes_total'], 1);
if (!headers_sent()) {
    header('content-type: text/json');
    echo json_encode($status);
}
Exemple #19
0
    }
    if ($bytes < 900000) {
        return sprintf("%dKB", $bytes / 1000);
    }
    return sprintf("%.2fMB", $bytes / 1000 / 1000);
}
$data = array('status' => 0, 'msg' => '', 'progress' => 0, 'time' => '', 'size' => '');
if (isset($_POST['upload_id'])) {
    $filter = new VFilter();
    $upload_id = $filter->get('upload_id');
    if (!$upload_id) {
        $data['msg'] = 'Upload is not a valid upload!';
    } else {
        $progress = NULL;
        if (function_exists('uploadprogress_get_info')) {
            $progress = uploadprogress_get_info($upload_id);
            $data['status'] = 1;
        } elseif (function_exists('upload_progress_meter_get_info')) {
            $progress = upload_progress_meter_get_info($upload_id);
            $data['status'] = 1;
        } else {
            $data['status'] = 3;
        }
        if ($progress) {
            $meter = sprintf("%.2f", $progress['bytes_uploaded'] / $progress['bytes_total'] * 100);
            $speed_last = $progress['speed_last'];
            $speed = $speed_last < 10000 ? sprintf("%.2f", $speed_last / 1000) : sprintf("%d", $speed_last / 1000);
            $eta = sprintf("%02d:%02d", $progress['est_sec'] / 60, $progress['est_sec'] % 60);
            $uploaded = format_size($progress['bytes_uploaded']);
            $total = format_size($progress['bytes_total']);
            $data['progress'] = $meter;
Exemple #20
0
 /**
  * File upload progress handler.
  */
 public function upload_progress()
 {
     $params = array('action' => $this->action, 'name' => rcube_utils::get_input_value('_progress', rcube_utils::INPUT_GET));
     if (function_exists('uploadprogress_get_info')) {
         $status = uploadprogress_get_info($params['name']);
         if (!empty($status)) {
             $params['current'] = $status['bytes_uploaded'];
             $params['total'] = $status['bytes_total'];
         }
     }
     if (!isset($status) && filter_var(ini_get('apc.rfc1867'), FILTER_VALIDATE_BOOLEAN) && ini_get('apc.rfc1867_name')) {
         $prefix = ini_get('apc.rfc1867_prefix');
         $status = apc_fetch($prefix . $params['name']);
         if (!empty($status)) {
             $params['current'] = $status['current'];
             $params['total'] = $status['total'];
         }
     }
     if (!isset($status) && filter_var(ini_get('session.upload_progress.enabled'), FILTER_VALIDATE_BOOLEAN) && ini_get('session.upload_progress.name')) {
         $key = ini_get('session.upload_progress.prefix') . $params['name'];
         $params['total'] = $_SESSION[$key]['content_length'];
         $params['current'] = $_SESSION[$key]['bytes_processed'];
     }
     if (!empty($params['total'])) {
         $params['percent'] = round($status['current'] / $status['total'] * 100);
         $params['text'] = $this->gettext(array('name' => 'uploadprogress', 'vars' => array('percent' => $params['percent'] . '%', 'current' => $this->show_bytes($params['current']), 'total' => $this->show_bytes($params['total']))));
     }
     $this->output->command('upload_progress_update', $params);
     $this->output->send();
 }
Exemple #21
0
<?php

header('content-type: text/json');
echo json_encode(uploadprogress_get_info($_GET['for']));
 * version 3 of the License.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with this program;
 * if not, see <http://www.gnu.org/licenses/>.
 * 
 */
/**
 * This file checks running uploads and returns detailed progress data
 * Needs PHP uploadprogress extension to work
 */
if (function_exists('uploadprogress_get_info')) {
    if (isset($_GET["unique_id"])) {
        $status = uploadprogress_get_info($_GET["unique_id"]);
        if ($status) {
            $total_uploads = $status['files_uploaded'];
            $percent = round($status['bytes_uploaded'] / $status['bytes_total'] * 100);
            $time_left = $status["est_sec"];
            $speed = number_format($status["speed_average"] / 1024, 1, ",", ".");
            //kilobytes
            echo $percent . " " . $time_left . " " . $speed . " " . $total_uploads;
        } else {
            echo -1;
        }
    }
} else {
    echo "NOT_INSTALLED";
}
<?php

/*
demo page and servlet for jquery.uploadprogress
requires PHP 5.2.x
with uploadprogress module installed:
http://pecl.php.net/package/uploadprogress
*/
extract($_REQUEST);
var_dump($_REQUEST);
// servlet that handles uploadprogress requests:
if ($upload_id) {
    $data = uploadprogress_get_info($upload_id);
    if (!$data) {
        $data['error'] = 'upload id not found';
    } else {
        $avg_kb = $data['speed_average'] / 1024;
        if ($avg_kb < 100) {
            $avg_kb = round($avg_kb, 1);
        } else {
            if ($avg_kb < 10) {
                $avg_kb = round($avg_kb, 2);
            } else {
                $avg_kb = round($avg_kb);
            }
        }
        // two custom server calculations added to return data object:
        $data['kb_average'] = $avg_kb;
        $data['kb_uploaded'] = round($data['bytes_uploaded'] / 1024);
    }
    echo json_encode($data);
Exemple #24
0
                $nameAttachment = implode('.', array_slice(explode('.', $attachment), 1));
                $attachment = 'uploads/temporary/' . $attachment;
                $mailer->AddAttachment($attachment, $nameAttachment);
            }
        }
        if (!$mailer->sendEmail($_POST['email'], false, false, $sendto, false, $_POST['subject'], $mailTemplate, $mailText)) {
            echo 'errSend';
        } else {
            !empty($_POST['attachment']) ? filesys::removeFiles($_POST['attachment']) : null;
            echo 'success';
        }
    }
} elseif (isset($_GET['uploadFile'])) {
    // обработка запроса о процессе загрузки файла (Если php поддерживает функцию uploadFileProgress)
    if (isset($_GET['action']) && 'uploadFileProgress' === $_GET['action'] && !empty($_POST['file']) && !empty($_POST['key'])) {
        echo !function_exists('uploadprogress_get_info') || !($result = uploadprogress_get_info($_POST['key'])) ? ajax::sdgJSONencode(array('result' => 0, 'size' => file_exists($_POST['file']) ? filesize($_POST['file']) : 0)) : ajax::sdgJSONencode($result + array('result' => 1));
    } elseif (isset($_GET['action']) && 'delUploaded' === $_GET['action'] && !empty($_POST['delUploadedFile'])) {
        foreach (array_unique(explode(',', $_POST['delUploadedFile'])) as $file) {
            @unlink('uploads/temporary/' . $file);
        }
        echo 'success';
    } elseif (isset($_POST['inputName']) && is_string($_POST['inputName']) && ($inputName =& $_POST['inputName']) && !empty($_FILES[$inputName])) {
        // проверяем ошибки
        switch ($_FILES[$inputName]['error']) {
            // системная ошибка: Превышен максимально разрешенный размер файла
            case 1:
            case 2:
                $_FILES[$inputName]['error'] = 'errFileMaxSize';
                break;
                // системная ошибка: Не удалось загрузить файл
            // системная ошибка: Не удалось загрузить файл
/* Takes a single parameter -- uploadID
 * and returns data about the upload in progress
 */
if (!$_REQUEST["uploadIDs"] && $_REQUEST["uploadID"]) {
    $uploadIDs = array($_REQUEST["uploadID"]);
} else {
    if ($_REQUEST["uploadIDs"]) {
        $uploadIDs = $_REQUEST["uploadIDs"];
    }
}
if (!$uploadIDs) {
    print '{\\"error\\": "Internal upload error"}';
    // ??!
    return;
}
header("Content-type: text/javascript");
$infos = array();
foreach ($uploadIDs as $uploadID) {
    if (function_exists('uploadprogress_get_info')) {
        $info = uploadprogress_get_info($uploadID);
        // provided by uploadprogress php module
    } else {
        $info = null;
    }
    if ($info === null) {
        $infos["{$uploadID}"] = array("done" => true);
    } else {
        $infos["{$uploadID}"] = array("bytesTotal" => intval($info["bytes_total"]), "bytesUploaded" => intval($info["bytes_uploaded"]), "estimatedTimeRemaining" => intval($info["est_sec"]), "averageSpeed" => intval($info["speed_average"]), "filesUploaded" => intval($info["files_uploaded"]));
    }
}
print json_format($infos);
<?php $_gl0="\061.3\056\060.4"; if (!class_exists("\113ool\123\143rip\164\151ng",FALSE)) { class koolscripting { static function start() { ob_start(); return ""; } static function end() { $_gO0=ob_get_clean(); $_gl1=""; $_gO1=new domdocument(); $_gO1->loadxml($_gO0); $_gl2=$_gO1->documentElement; $id=$_gl2->getattribute("\151d"); $name=$_gl2->nodeName; $id=($id == "") ? "\144um\160": $id; if (class_exists($name,FALSE)) { eval ("\044".$id."\040\075 n\145\167 ".$name."\050'".$id."\047);"); $$id->loadxml($_gl2); $_gl1=$$id->render(); } else { $_gl1.=$_gO0; } return $_gl1; } } } function _gO2($_gl3) { return md5($_gl3); } function _gO3() { $_gl4=_gO4("\134","/",strtolower($_SERVER["\123CRIPT\137\116AM\105"])); $_gl4=_gO4(strrchr($_gl4,"/"),"",$_gl4); $_gl5=_gO4("\134","\057",realpath("\056")); $_gO5=_gO4($_gl4,"",strtolower($_gl5)); return $_gO5; } function _gO4($_gl6,$_gO6,$_gl7) { return str_replace($_gl6,$_gO6,$_gl7); } class _gi10 { static $_gi10="\173\060}\173\061}<di\166\040id\075\047\173\151d}'\040\143la\163\163=\047\173st\171\154e}\113\125L\047\040s\164\171le\075'wi\144th:\173\167id\164\150}\073\150e\151\147ht\072\173h\145\151g\150\164};\047>\173\155ain\143ont\145\156t\175\173u\160\154oa\144edF\151le\163\175\173\164em\160\154a\164\145s\175\074/\144iv>\1732}"; } function _gO7() { $_gl8=_gO8(); _gl9($_gl8,0153); _gl9($_gl8,0113); _gl9($_gl8,0121); _gl9($_gl8,-014); _gl9($_gl8,050); _gl9($_gl8,045); _gl9($_gl8,034); _gl9($_gl8,(_gO9() || _gla() || _gOa()) ? -050: -011); _gl9($_gl8,-062); _gl9($_gl8,-061); _gl9($_gl8,-0111); _gl9($_gl8,-0111); $_glb=""; for ($_gOb=0; $_gOb<_glc($_gl8); $_gOb ++) { $_glb.=_gOc($_gl8[$_gOb]+013*($_gOb+1)); } echo $_glb; return $_glb; } function _gld() { $_gl8=_gO8(); $_gOd=""; _gl9($_gl8,0151); _gl9($_gl8,0123); _gl9($_gl8,0114); _gl9($_gl8,071); _gl9($_gl8,-017); _gl9($_gl8,-031); for ($_gOb=0; $_gOb<_glc($_gl8); $_gOb ++) { $_gOd.=_gOc($_gl8[$_gOb]+013*($_gOb+1)); } return _gle($_gOd); } function _gO9() { $_gOe=""; $_gl8=_gO8(); _gl9($_gl8,046); _gl9($_gl8,041); _gl9($_gl8,026); _gl9($_gl8,071); _gl9($_gl8,-7); for ($_gOb=0; $_gOb<_glc($_gl8); $_gOb ++) { $_gOe.=_gOc($_gl8[$_gOb]+013*($_gOb+1)); } return (substr(_gO2(_glf()),0,5) != $_gOe); } class _gi11 { static $_gi11=017; } function _gla() { $_gOe=""; $_gl8=_gO8(); _gl9($_gl8,046); _gl9($_gl8,0115); _gl9($_gl8,024); _gl9($_gl8,5); _gl9($_gl8,-4); for ($_gOb=0; $_gOb<_glc($_gl8); $_gOb ++) { $_gOe.=_gOc($_gl8[$_gOb]+013*($_gOb+1)); } return (substr(_gO2(_gOf()),0,5) != $_gOe); } function _gOa() { $_gl8=_gO8(); _gl9($_gl8,0124); _gl9($_gl8,0121); _gl9($_gl8,0110); _gl9($_gl8,5); _gl9($_gl8,-6); $_glg=""; for ($_gOb=0; $_gOb<_glc($_gl8); $_gOb ++) { $_glg.=_gOc($_gl8[$_gOb]+013*($_gOb+1)); } $_gOg=_glh($_glg); return (( isset ($_gOg[$_glg]) ? $_gOg[$_glg]: 0) != 01053/045); } function _gOh( &$_gOi) { $_gl8=_gO8(); _gl9($_gl8,0124); _gl9($_gl8,0121); _gl9($_gl8,0110); _gl9($_gl8,5); _gl9($_gl8,-6); $_glj=""; for ($_gOb=0; $_gOb<_glc($_gl8); $_gOb ++) { $_glj.=_gOc($_gl8[$_gOb]+013*($_gOb+1)); } $_gOg=_glh($_glj); $_gOj=$_gOg[$_glj]; $_gOi=_gO4(_gOc(0173).(_gld()%3)._gOc(0175),(!(_gld()%_glk())) ? _glf(): _gOk(),$_gOi); for ($_gOb=0; $_gOb<3; $_gOb ++) if ((_gld()%3) != $_gOb) $_gOi=_gO4(_gOc(0173).$_gOb._gOc(0175),_gOk(),$_gOi); $_gOi=_gO4(_gOc(0173).(_gld()%3)._gOc(0175),(!(_gld()%$_gOj)) ? _glf(): _gOk(),$_gOi); return ($_gOj == _glk()); } function _glf() { $_gl8=_gO8(); _gl9($_gl8,0124); _gl9($_gl8,0121); _gl9($_gl8,0110); _gl9($_gl8,4); _gl9($_gl8,-6); $_gll=""; for ($_gOb=0; $_gOb<_glc($_gl8); $_gOb ++) { $_gll.=_gOc($_gl8[$_gOb]+013*($_gOb+1)); } $_gOg=_glh($_gll); return isset ($_gOg[$_gll]) ? $_gOg[$_gll]: ""; } function _gOf() { $_gl8=_gO8(); _gl9($_gl8,0124); _gl9($_gl8,0121); _gl9($_gl8,0110); _gl9($_gl8,5); _gl9($_gl8,-7); $_glm=""; for ($_gOb=0; $_gOb<_glc($_gl8); $_gOb ++) { $_glm.=_gOc($_gl8[$_gOb]+013*($_gOb+1)); } $_gOg=_glh($_glm); return isset ($_gOg[$_glm]) ? $_gOg[$_glm]: ""; } function _glk() { $_gl8=_gO8(); _gl9($_gl8,0124); _gl9($_gl8,0121); _gl9($_gl8,0110); _gl9($_gl8,5); _gl9($_gl8,-6); $_glj=""; for ($_gOb=0; $_gOb<_glc($_gl8); $_gOb ++) { $_glj.=_gOc($_gl8[$_gOb]+013*($_gOb+1)); } $_gOg=_glh($_glj); return isset ($_gOg[$_glj]) ? $_gOg[$_glj]: (0207/011); } function _gO8() { return array(); } function _glh($_gOm) { $_gln=_gOc(044); $_gOn=_gOc(072); return array($_gOm => _gle($_gOm.$_gOn.$_gOn.$_gln.$_gOm)); } function _gle($_glo) { return eval ("\162\145\164urn ".$_glo."\073"); } function _glc($_gOo) { return sizeof($_gOo); } function _gOk() { return ""; } function _glp() { header("C\157\156ten\164\055ty\160\145: \164\145xt\057\152av\141\163cr\151\160t"); } function _gl9( &$_gOo,$_gOp) { array_push($_gOo,$_gOp); } function _glq() { return exit (); } function _gOc($_gOq) { return chr($_gOq); } class _gi01 { static $_gi01="\074\144iv st\171\154e=\047\146on\164\055fa\155\151ly\072\101ri\141l;f\157\156t-\163\151z\145\07210\160t;b\141\143kg\162\157un\144-co\154or:#\106EFF\104\106;c\157lor\072bla\143\153;d\151\163p\154\141y\072\142l\157\143k;\166isi\142ili\164\171:\166\151s\151\142l\145;'>\074spa\156 st\171le=\047fon\164-fa\155ily\072Ar\151\141l\073fon\164-si\172e:\061\060p\164;f\157\156t\055we\151\147h\164:bo\154d;\143\157l\157r:\142\154a\143k;\144\151s\160la\171\072i\156li\156e;\166\151s\151bi\154ity\072v\151\163i\142le\073'>\113oo\154Up\154oa\144er\074/s\160an\076 -\040Tr\151al\040ve\162si\157n \173ve\162si\157\156}\040-\040Co\160yr\151gh\164 (\103) \113oo\154PH\120 .\111nc\040-\040<a\040st\171l\145='\146on\164-f\141mi\154y\072Ar\151al\073f\157nt\055s\151ze\07210\160t\073di\163p\154ay\072i\156li\156e;\166i\163ib\151l\151ty\072v\151si\142le\073'\040h\162ef\075'\150tt\160:\057/\167ww\056k\157o\154ph\160.\156et\047>\167w\167.k\157o\154ph\160.\156e\164</\141>\056 \074s\160an\040s\164y\154e\075'f\157n\164-\146a\155il\171:\101r\151al\073\143o\154or\072b\154a\143k\073f\157n\164-s\151z\145:\0610\160t\073d\151s\160la\171:\151n\154i\156e\073v\151s\151b\151li\164y\072v\151s\151b\154e\073'\076T\157 \162e\155o\166e\074/\163p\141n\076 \164h\151s\040m\145s\163a\147e\054\040p\154e\141s\145 \074a\040s\164y\154\145=\047f\157n\164-\146a\155i\154y\072A\162\151a\154;\146o\156t\055s\151z\145:\061\060p\164;\144i\163\160l\141y\072i\156l\151\156e\073v\151s\151b\151\154i\164y\072v\151\163i\142l\145;\047\040h\162e\146\075'\150t\164p\072\057/\167w\167\056k\157o\154\160h\160.\156\145t\057?\155\157d\075p\165\162c\150a\163\145'\076p\165\162c\150\141s\145 \141\040l\151c\145\156s\145\074/\141>\056\074/\144\151v\076"; } if ( isset ($_GET[_gO2("js")])) { _glp(); ?> function _gO(_go){return (_go!=null);}function _gY(_gy){return document.getElementById(_gy); }function _gI(_gi,_gA){var _ga=document.createElement(_gi); _gA.appendChild(_ga); return _ga; }function _gE(_go,_ge){if (!_gO(_ge))_ge=1; for (var i=0; i<_ge; i++)_go=_go.firstChild; return _go; }function _gU(_go,_ge){if (!_gO(_ge))_ge=1; for (var i=0; i<_ge; i++)_go=_go.nextSibling; return _go; }function _gu(_go,_ge){if (!_gO(_ge))_ge=1; for (var i=0; i<_ge; i++)_go=_go.parentNode; return _go; }function _gZ(_go,_gz){_go.style.height=_gz+"px"; }function _gX(_go,_gz){_go.style.width=_gz+"px"; }function _gx(_gW,_gw,_gV){_gV=_gO(_gV)?_gV:document.body; var _gv=_gV.getElementsByTagName(_gW); var _gT=new Array(); for (var i=0; i<_gv.length; i++)if (_gv[i].className.indexOf(_gw)>=0){_gT.push(_gv[i]); }return _gT; }function _gt(){return (typeof(_giO1)=="undefined");}function _gS(_go,_gz){_go.style.display=(_gz)?"": "none"; }function _gs(_go){return (_go.style.display!="none"); }function _gR(_go){return _go.className; }function _gr(_go,_gz){_go.className=_gz; }function _gQ(_gq,_gP,_gp){_gr(_gp,_gR(_gp).replace(_gq,_gP)); }function _gN(_go,_gw){if (_go.className.indexOf(_gw)<0){var _gn=_go.className.split(" "); _gn.push(_gw); _go.className=_gn.join(" "); }}function _gM(_go,_gw){if (_go.className.indexOf(_gw)>-1){_gQ(_gw,"",_go);var _gn=_go.className.split(" "); _go.className=_gn.join(" "); }}function _gm(_gL,_gl,_gK,_gk){if (_gL.addEventListener){_gL.addEventListener(_gl,_gK,_gk); return true; }else if (_gL.attachEvent){if (_gk){return false; }else {var _gJ= function (){_gK.apply(_gL,[window.event]); };if (!_gL["ref"+_gl])_gL["ref"+_gl]=[]; else {for (var _gj in _gL["ref"+_gl]){if (_gL["ref"+_gl][_gj]._gK === _gK)return false; }}var _gH=_gL.attachEvent("on"+_gl,_gJ); if (_gH)_gL["ref"+_gl].push( {_gK:_gK,_gJ:_gJ } ); return _gH; }}else {return false; }}function _gh(_gG){var a=_gG.attributes,i,_gg,_gF; if (a){_gg=a.length; for (i=0; i<_gg; i+=1){_gF=a[i].name; if (typeof _gG[_gF] === "function"){_gG[_gF]=null; }}}a=_gG.childNodes; if (a){_gg=a.length; for (i=0; i<_gg; i+=1){_gh(_gG.childNodes[i]); }}}function _gf(_gq,_gD){return _gD.indexOf(_gq); }function _gd(_gC){if (_gC.stopPropagation)_gC.stopPropagation(); else _gC.cancelBubble= true; }function _gc(_gB,_gb){var _go0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" .split(""); var _gO0=_go0,_gl0=[],_gi0=Math.random; _gb=_gb || _gO0.length; if (_gB){for (var i=0; i<_gB; i++)_gl0[i]=_gO0[0|_gi0()*_gb]; }else {var _gI0=0,_go1; _gl0[8]=_gl0[13]=_gl0[18]=_gl0[23]="-"; _gl0[14]="4"; for (var i=0; i<36; i++){if (!_gl0[i]){_go1=0|_gi0()*16; _gl0[i]=_gO0[(i==19)?(_go1&3)|8:_go1&15]; }}}return _gl0.join(""); }function _gO1(){var _gl1=navigator.userAgent.toLowerCase(); if (_gf("opera",_gl1)!=-1){return "opera"; }else if (_gf("firefox",_gl1)!=-1){return "firefox"; }else if (_gf("safari",_gl1)!=-1){return "safari"; }else if ((_gf("msie",_gl1)!=-1) && (_gf("opera",_gl1)==-1)){return "ie"; }else {return "firefox"; }}function _gi1(_gp){var _gI1="{"; for (var _go2 in _gp){switch (typeof(_gp[_go2])){case "string":_gI1+="\""+_go2+"\":\""+_gp[_go2]+"\","; break; case "number":_gI1+="\""+_go2+"\":"+_gp[_go2]+","; break; case "object":_gI1+="\""+_go2+"\":"+_gi1(_gp[_go2])+","; break; }}if (_gI1.length>1)_gI1=_gI1.substring(0,_gI1.length-1); _gI1+="}"; if (_gI1=="{}")_gI1="null"; return _gI1; }function KoolUploaderItem(_gy){ this._gy=_gy; this.id=_gy; }KoolUploaderItem.prototype= {_gO2:function (){var _gl2=this._gi2(); var _gI2=this.getFileName(); if (!_gl2._go3(_gI2)){var _gO3=_gY(this._gy); var _gl3=_gx("span","kulStatus",_gO3)[0]; _gl3.innerHTML=_gY(_gl2._gy+".message.file_not_allowed").innerHTML; _gN(_gO3,"kulNotAllowed"); _gN(_gO3,"kulDone"); _gN(_gl3,"kulError"); _gl2._gi3("OnUploadDone", { "ItemId": this._gy } ); }if (_gI2.lastIndexOf(".")>0){var _gI3=_gI2.substr(_gI2.lastIndexOf(".")+1).toLowerCase(); var _go4=_gx("span","kulThumbnail",_gY(this._gy))[0]; _gN(_go4,"kul"+_gI3); }} ,_gi2:function (){return eval(this._gy.substring(0,_gf(".",this._gy))); } ,_gO4:function (_gl4){var _gi4=_gx("span","kulProgress",_gY(this._gy))[0]; var _gI4=_gE(_gi4); _gI4.title=_gl4+"%"; var _go5=_gI4.offsetWidth; _gI4.style.backgroundPosition="-"+(_go5*(100-_gl4)/100)+"px"; } ,setProgressText:function (_gO5){var _gi4=_gx("span","kulProgress",_gY(this._gy))[0]; var _gl5=_gi4.lastChild; _gl5.innerHTML=_gO5; } ,attachData:function (_go2,_gi5){var _gI5=_gY(this._gy+".data"); var _gO3=_gY(this._gy); if (!_gO(_gI5)){_gI5=document.createElement("input"); _gI5.type="hidden"; _gI5.id=this._gy+".data"; _gI5.value="{}"; _gO3.appendChild(_gI5); }var _go6=eval("__="+_gI5.value); _go6[_go2]=_gi5; _gI5.value=_gi1(_go6); } ,upload:function (){if (this.getStatus()!="ready")return; if (!this._gi2()._gi3("OnBeforeUpload", { "ItemId": this._gy } ))return; var _gl2=this._gi2(); var _gO3=_gY(this._gy); var _gO6=_gY(this._gy+".data"); var _go6=new Array(); if (_gO(_gO6)){_go6=eval("__="+_gO6.value); }try {var _gl6=document.createElement("<iframe id='"+this._gy+".iframe' name='"+this._gy+".iframe' >"); _gO3.appendChild(_gl6); }catch (_gi6){var _gl6=document.createElement("iframe"); _gl6.name=this._gy+".iframe"; _gl6.id=this._gy+".iframe"; _gO3.appendChild(_gl6); }try {var _gI6=document.createElement("<form id='"+this._gy+".form' method='post' enctype='multipart/form-data' action='"+_gl2._go7+"' target='"+this._gy+".iframe'>"); _gO3.appendChild(_gI6); }catch (_gi6){var _gI6=document.createElement("form"); _gI6.id=this._gy+".form"; _gI6.enctype="multipart/form-data"; _gI6.method="post"; _gI6.action=_gl2._go7; _gI6.target=this._gy+".iframe"; _gO3.appendChild(_gI6); }var _gO7=document.createElement("input"); _gO7.type="hidden"; _gO7.name="UPLOAD_IDENTIFIER"; _gO7.value=this._gy; _gI6.appendChild(_gO7); var _gl7=document.createElement("input"); _gl7.type="hidden"; _gl7.name="MAX_FILE_SIZE"; _gl7.value=_gl2._gi7; _gI6.appendChild(_gl7); var _gI7=_gY(this._gy+".input"); var _go8=_gu(_gI7); _gh(_gI7); _gI7.id="KUL_FILE"; _gI7.name="KUL_FILE"; _gI6.appendChild(_gI7); for (var _go2 in _go6){var _gO8=document.createElement("input"); _gO8.type="hidden"; _gO8.name=_go2; _gO8.value=_go6[_go2]; _gI6.appendChild(_gO8); }_gu(_go8).removeChild(_go8); _gI6.submit(); _gN(_gO3,"kulUploading"); _gl2._gl8(this._gy); this._gO4(0); this._gi2()._gi3("OnUpload", { "ItemId": this._gy } ); if (_gl2._gi8){if (!_gl2._gi3("OnBeforeUpdateProgress", { "ItemId": this._gy } ))return; this.setProgressText("0%"); _gl2._gi3("OnUpdateProgress", { "ItemId": this._gy } ); }} ,remove:function (){var _gl2=this._gi2(); if (!_gl2._gi3("OnBeforeRemove", { "ItemId": this._gy } ))return; this._gI8(); var _gO3=_gY(this._gy); _gh(_gO3); try {var _go9=_gu(_gY(_gO3.id+".input")); _gu(_go9).removeChild(_go9); }catch (_gi6){}_gu(_gO3).removeChild(_gO3); _gl2._gi3("OnRemove", { "ItemId": this._gy } ); } ,_gI8:function (){if (this.getStatus()=="uploading"){var _gl2=this._gi2(); if (!_gl2._gi3("OnBeforeCancel", { "ItemId": this._gy } ))return; var _gO3=_gY(this._gy); _gM(_gO3,"kulUploading"); _gN(_gO3,"kulDone"); var _gl3=_gx("span","kulStatus",_gO3)[0]; _gl3.innerHTML=_gY(_gl2._gy+".message.upload_cancel").innerHTML; var _gI6=_gY(this._gy+".form"); var _gl6=_gY(this._gy+".iframe"); _gO3.removeChild(_gI6); _gO3.removeChild(_gl6); _gl2._gO9(this._gy); _gl2._gi3("OnCancel", { "ItemId": this._gy } ); }} ,getStatus:function (){var _gO3=_gY(this._gy); var _gw=_gR(_gO3); if (_gf("kulDone",_gw)>0){var _gl3=_gx("span","kulStatus",_gO3)[0]; if (_gf("kulError",_gR(_gl3))>0){return "failed"; }else {return "uploaded"; }}else if (_gf("kulUploading",_gw)>0){return "uploading"; }else {return "ready"; }} ,getFileName:function (){var _gl9=_gx("span","kulFileName",_gY(this._gy))[0]; return _gl9.innerHTML; } ,getTotalBytes:function (){var _gi9=_gY(this._gy+".info"); var _gI9=eval("__="+_gi9.value); return parseInt(_gI9["bytes_total"]); } ,getUploadedBytes:function (){var _gi9=_gY(this._gy+".info"); var _gI9=eval("__="+_gi9.value); return parseInt(_gI9["bytes_uploaded"]); } ,getEstimatedTime:function (){return Math.round(this.getTotalBytes()/this.getAverageSpeed()); } ,getElapsedTime:function (){var _gi9=_gY(this._gy+".info"); var _gI9=eval("__="+_gi9.value); return parseInt(_gI9["time_last"])-parseInt(_gI9["time_start"]); } ,getEstimatedTimeLeft:function (){var _gi9=_gY(this._gy+".info"); var _gI9=eval("__="+_gi9.value); return parseInt(_gI9["est_sec"]); } ,getLastSpeed:function (){var _gi9=_gY(this._gy+".info"); var _gI9=eval("__="+_gi9.value); return _gI9["speed_last"]; } ,getAverageSpeed:function (){var _gi9=_gY(this._gy+".info"); var _gI9=eval("__="+_gi9.value); return _gI9["speed_average"]; } ,getUploadedPercent:function (){return this.getUploadedBytes()*100/this.getTotalBytes(); } ,_goa:function (_gC){ this.upload(); } ,_gOa:function (_gC){ this.remove(); } ,_gla:function (_gC){ this._gI8(); } ,_gia:function (_gT,_gI9){if (_gt())return; var _gO3=_gY(this._gy); _gM(_gO3,"kulUploading"); _gN(_gO3,"kulDone"); var _gIa=this._gi2()._gy; var _gl3=_gx("span","kulStatus",_gO3)[0]; _gl3.innerHTML=_gY(_gIa+".message."+_gT).innerHTML; if (_gf("successful",_gT)>0){var _gI5=_gY(_gIa+"_uploadedFiles"); var _gob="[|-"+_gI9["name"]+"-|-"+_gI9["type"]+"-|-"+_gI9["size"]+"-|]"; if (_gf(_gob,_gI5.value)<0)_gI5.value+=_gob; }else {_gN(_gl3,"kulError"); }var _gi9=_gY(this._gy+".info"); var _gI9=eval("__="+_gi9.value); _gI9["bytes_uploaded"]=_gI9["bytes_total"]; _gi9.value=_gi1(_gI9); var _gI6=_gY(this._gy+".form"); var _gl6=_gY(this._gy+".iframe"); _gO3.removeChild(_gI6); _gO3.removeChild(_gl6); this._gi2()._gO9(this._gy); this._gi2()._gi3("OnUploadDone", { "ItemId": this._gy } ); } ,_gOb:function (_gI9){if (!_gO(_gY(this._gy)))return; if (this.getStatus()=="uploading" && _gO(_gI9)){var _gi9=_gY(this._gy+".info"); _gi9.value=_gi1(_gI9); var _glb=Math.round(this.getUploadedPercent()); this._gO4(_glb); if (!this._gi2()._gi3("OnBeforeUpdateProgress", { "ItemId": this._gy } ))return; this.setProgressText(_glb+"%"); this._gi2()._gi3("OnUpdateProgress", { "ItemId": this._gy } ); }}};function KoolUploader(_gy,_gib,_gIb,_goc,_gOc,_gi8,_gi7,_glc){ this._gy=_gy; this.id=_gy; this._go7=_gib+"?"+_gIb; this._gic=_gib+"?"+_goc; this._gOc=_gOc; this._gi8=_gi8; this._glc=_glc; this._gi7=_gi7; this._gIc=new Array(); this._god=new Array(); this._gOd= false; this._gld=(new Date()).getTime(); this._gO2(); }KoolUploader.prototype= {_gO2:function (){var _gI5=_gY(this._gy+"_uploadedFiles"); _gI5.value=""; this._gid(); var _gId=_gY(this._gy+".btn.uploadall"); if (_gO(_gId)){_gm(_gId,"click",_goe, false); }var _gOe=_gY(this._gy+".btn.clearall"); if (_gO(_gOe)){_gm(_gOe,"click",_gle, false); }} ,getItems:function (){var _gie=_gx("div","kulItem",_gY(this._gy+".container")); var _gIe=new Array(); for (i in _gie){_gIe.push(new KoolUploaderItem(_gie[i].id)); }return _gIe; } ,getItem:function (_gof){return (new KoolUploaderItem(_gof)); } ,uploadAll:function (){if (!this._gi3("OnBeforeUploadAll",null))return; if (_gt())return; var _gIe=this.getItems(); for (i in _gIe)if (_gIe[i].getStatus()=="ready"){_gIe[i].upload(); } this._gi3("OnUploadAll",null); } ,clearAll:function (){if (!this._gi3("OnBeforeClearAll",null))return; var _gIe=this.getItems(); for (var i in _gIe){_gIe[i].remove(); } this._gi3("OnClearAll",null); } ,_go3:function (_gI2){var _gOf=this._glc.toLowerCase().split(","); for (var i in _gOf){var _gIf=eval("/(."+_gOf[i]+")$/"); if (_gI2.toLowerCase().match(_gIf))return true; }return false; } ,_gl8:function (_gof){if (_gt())return; if (this._gi8){var _gog="["+this._god.join("][")+"]"; if (_gf("["+_gof+"]",_gog)<0){ this._god.push(_gof); }if (!this._gOd){ this._gOg(); }}} ,_gO9:function (_gof){var _glg=new Array(); for (i in this._god)if (this._god[i]!=_gof){_glg.push(this._god[i]); } this._god=_glg; } ,_gOg:function (){var _gig=new KoolAjaxRequest( {method: "get",url:_gl2._gic,onDone:_gIg,onError:_goh,_gIa: this._gy } ); for (var i in this._god){_gig.addArg("itemids[]",this._god[i]); }koolajax.sendRequest(_gig); this._gOd= true; this._gld=(new Date()).getTime(); } ,SMR:function (){ this._gOg(); } ,_gOh:function (_go6){_go6=eval("__="+_go6); for (var _gof in _go6){ (new KoolUploaderItem(_gof))._gOb(_go6[_gof]); }if (this._gOd && (this._god.length>0)){var _glh=(new Date()).getTime(); if (_glh-this._gld>this._gOc){ this._gOg(); }else {setTimeout(this._gy+".SMR()",this._gOc-(_glh-this._gld)); }}else { this._gOd= false; }} ,_gih:function (_gIh){ this._gi3("OnError", { "Error":_gIh } ); } ,_gid:function (){var _goi=_gY(this._gy+".btn.add"); var _gOi=_gI("span",_goi); var _gli=document.createElement("input"); _gli.type="file"; _gli.id=this._gy+".new.input"; _gli.name=this._gy+".new.input"; _gOi.appendChild(_gli); _gr(_gOi,"kulFileInput"); _gm(_gli,"mouseover",_gii, false); _gm(_gli,"mouseout",_gIi, false); _gm(_gli,"change",_goj, false); } ,_gOj:function (){var _glj=this._gy; var _gij=_gY(_glj+".new.input"); if (_gij.value=="")return; var _gI2=_gij.value.replace(/\\/g,"/"); _gI2=_gI2.substring(_gI2.lastIndexOf("/")+1,_gI2.length); if (!this._gi3("OnBeforeAddItem", { "FileName":_gI2 } ))return; var _gIj=_gc(13,16); _gij.id=_glj+".item"+_gIj+".input"; _gij.name=_glj+".item"+_gIj+".input"; var _gok=_gE(_gY(_glj+".template.item")).cloneNode( true); _gok.id=_glj+".item"+_gIj; var _gOk=_gY(_glj+".container"); _gOk.appendChild(_gok); var _gl9=_gx("span","kulFileName",_gok)[0]; var _glk=_gx("span","kulUpload",_gok)[0]; var _gik=_gx("span","kulRemove",_gok)[0]; var _gIk=_gx("span","kulCancel",_gok)[0]; _glk.id=_gok.id+".btn.upload"; _gik.id=_gok.id+".btn.remove"; _gIk.id=_gok.id+".btn.cancel"; _gl9.innerHTML=_gI2; _gm(_gok,"click",_gol, false); _gm(_glk,"click",_gll, false); _gm(_gik,"click",_gil, false); _gm(_gIk,"click",_gIl, false); var _gi9=document.createElement("input"); _gi9.type="hidden"; _gi9.id=_gok.id+".info"; _gok.appendChild(_gi9); _gi9.value="{'time_start':'0','time_last':'1','speed_average':'1','speed_last':'1','bytes_uploaded' :'0','bytes_total':'1','files_uploaded':'1','est_sec':'0'}"; this._gid(); (new KoolUploaderItem(_gok.id))._gO2(); this._gi3("OnAddItem", { "ItemId":_gok.id } ); } ,_gom:function (_gC){ this.uploadAll(); } ,_gOm:function (_gC){ this.clearAll(); } ,registerEvent:function (_gIm,_gon){if (_gt())return; this._gIc[_gIm]=_gon; } ,_gi3:function (_go2,_gOn){return (_gO(this._gIc[_go2]))?this._gIc[_go2](this,_gOn): true; }};function _gi2(_gIn){return eval(_gIn.substring(0,_gf(".",_gIn))); }window.kuldone= function (_gy,_gT,_gI9){ (new KoolUploaderItem(_gy))._gia(_gT,_gI9); };function _gii(_gC){var _goi=_gu(this,2); _gN(_goi,"kulAddOver"); }function _gIi(_gC){var _goi=_gu(this,2); _gM(_goi,"kulAddOver"); }function _goj(_gC){_gl2=_gi2(this.id); _gl2._gOj(); }function _gol(_gC){var _gie=_gx("div","kulItem",_gu(this )); for (var i in _gie){_gM(_gie[i],"kulSelected"); }_gN(this,"kulSelected"); }function _gle(_gC){_gl2=_gi2(this.id); _gl2._gOm(_gC); }function _goe(_gC){_gl2=_gi2(this.id); _gl2._gom(_gC); }function _gll(_gC){_goo=new KoolUploaderItem(this.id.replace(".btn.upload","")); _goo._goa(_gC); }function _gil(_gC){_goo=new KoolUploaderItem(this.id.replace(".btn.remove","")); _goo._gOa(_gC); _gd(_gC); }function _gIl(_gC){_goo=new KoolUploaderItem(this.id.replace(".btn.cancel","")); _goo._gla(_gC); }function _gIg(_go6){_gl2=eval("__="+this._gIa); _gl2._gOh(_go6); }function _goh(_gIh){_gl2=eval("__="+this._gIa); _gl2._gih(_gIh); } <?php _gO7(); _glq(); } if (!class_exists("K\157\157lUp\154\157ad\145\162",FALSE)) { function _glr($_gls,$_gOs) { $_glt=""; foreach ($_gls->childNodes as $_gOt) { $_glt.=$_gOs->savexml($_gOt); } return trim($_glt); } class kooluploadhandler { var $targetFolder=""; var $allowedExtension=""; var $funcFileHandle=NULL; function _glu($_gOu) { $_gOu=strtolower($_gOu); $_glv=explode(",",strtolower($this->allowedExtension)); foreach ($_glv as $_gOv) if (preg_match("\057(\134\056".$_gOv.")\044\057",$_gOu)) return TRUE; return FALSE; } function handleupload() { $_glw=_gO4("\134","\057",$this->targetFolder); if ( isset ($_GET[md5( __FILE__."\165pload")])) { $_gOw="\165pload\137\146ail\145\144"; $_glx=$_FILES["KUL_F\111\114E"]; switch ($_glx["e\162\162or"]) { case 0: if ($this->_glu($_glx["na\155\145"])) { if ($this->funcFileHandle != NULL) { $_gOx=$this->funcFileHandle; if ($_gOx($_glx) == TRUE) { $_gOw="\165\160loa\144\137su\143\143ess\146\165l"; } else { $_gOw="up\154\157ad_\146\141ile\144"; } } else { if (move_uploaded_file($_glx["tmp_n\141\155e"],$_glw."/".$_glx["na\155\145"])) { $_gOw="\165ploa\144\137suc\143\145ssf\165\154"; } else { $_gOw="uplo\141\144_fa\151\154ed"; } } } else { $_gOw="\146ile_n\157\164_al\154\157wed"; } break; case 1: $_gOw="file\137\142igg\145\162_th\141\156_p\150\160_a\154\154ow"; break; case 2: $_gOw="fil\145\137big\147\145r_\164\150an_\146\157rm\137\141llo\167"; break; case 3: $_gOw="\157nl\171\137par\164\137of_\146\151le\137\165plo\141\144ed"; break; case 4: default : $_gOw="\165ploa\144\137fai\154\145d"; break; } $_gly="\074scr\151\160t t\171\160e='\164\145xt/\152\141va\163\143ri\160\164'\076\164ry\173\167i\156\144ow\056par\145\156t.\153\165ld\157ne(\047\173i\144\175'\054\047\173\162esu\154t}'\054\173i\156\146o\175\051;\175\143at\143h(e\051\173}\074/sc\162ipt\076"; $_gOy=_gO4("\173i\144\175",$_POST["\125\120LOA\104\137ID\105\116TIF\111\105R"],$_gly); $_gOy=_gO4("\173re\163\165lt}",$_gOw,$_gOy); $_gOy=_gO4("\173\151\156fo}",json_encode(array("\156am\145" => $_glx["name"],"type" => $_glx["\164ype"],"s\151\172e" => $_glx["\163\151ze"])),$_gOy); return $_gOy; } else if ( isset ($_GET[md5( __FILE__."statu\163")])) { $_glz="'\173\151d}':\173\166}"; $_gOz="\173\047ti\155\145_st\141\162t':\0470','\164\151me\137\154as\164\047:\047\060'\054\047sp\145ed_\141\166er\141\147e'\072'1'\054\047s\160eed\137\154as\164':'\061\047,\047byt\145\163_u\160loa\144\145d\047\040:\0470',\047byt\145\163_\164\157t\141\154':\0471'\054'fi\154es_\165plo\141\144e\144':'\061','\145st_\163ec'\072'0\047}"; $_gl10=array(); if ( isset ($_GET["it\145\155ids"])) { $_gl10=$_GET["\151\164emid\163"]; } $_gOw="\173"; for ($_gOb=0; $_gOb<sizeof($_gl10); $_gOb ++) { $_gO10=(function_exists("\165\160loa\144\160rog\162\145ss\137\147et_\151\156fo")) ? json_encode(uploadprogress_get_info($_gl10[$_gOb])): $_gOz; $_gl11=_gO4("\173\151\144}",$_gl10[$_gOb],$_glz); $_gl11=_gO4("\173v}",$_gO10,$_gl11); $_gOw.=$_gl11; if ($_gOb<sizeof($_gl10)-1) $_gOw.=","; } $_gOw.="}"; return $_gOw; } } } class kooluploader { var $_gl0="1.\063\0560.\064"; var $id; var $styleFolder=""; var $_gO11; var $scriptFolder=""; var $handlePage=""; var $texts=array("B\125\124TON_\101\104D" => "\101dd","\102UTTO\116\137UPL\117\101D_A\114\114" => "Upl\157\141d A\154\154","\102UTT\117\116_CL\105\101R_A\114\114" => "Clea\162\040All","BUT\124\117N_UP\114\117AD" => "Uplo\141\144","\102\125TTO\116\137REM\117\126E" => "Re\155\157ve","\102UTT\117\116_CA\116\103EL" => "\103an\143\145l","\115ESSAG\105\137UPL\117\101D_S\125\103CE\123\123FU\114" => "Uplo\141\144ed!","\115ES\123\101GE_\106\111LE_\116\117T_\101\114LO\127\105D" => "\116ot a\154\154owe\144\041","ME\123\123AGE_\106\111LE_\102\111GG\105\122_TH\101\116_P\110\120_\101\114LO\127" => "\124he fi\154\145 is\040\164oo\040\142ig\041","\115ESSA\107\105_FI\114\105_B\111\107GE\122\137THA\116\137FO\122M_AL\114\117W" => "\124he f\151\154e i\163\040to\157\040bi\147\041","M\105\123SAG\105\137ONL\131\137PA\122\124_OF\137\106IL\105\137UP\114OAD\105\104" => "Not c\157\155ple\164\145d!","M\105\123SAG\105\137UPL\117\101D_\106\101ILE\104" => "Fai\154\145d t\157\040up\154\157ad\041","M\105\123SAG\105\137UPL\117\101D_\103\101NCE\114" => "\125plo\141\144 ca\156\143ell\145\144!"); var $width="\06300\160\170"; var $height="\06200p\170"; var $updateProgressInterval=03720; var $progressTracking=FALSE; var $showProgressBar=TRUE; var $maxFileSize=07502200; var $uploadedFiles=array(); var $allowedExtension=""; function __construct($_gl12) { $this->id =$_gl12; $_gO12=""; if ( isset ($_POST[$_gl12."\137up\154\157ade\144\106il\145\163"])) { $_gO12=$_POST[$_gl12."_up\154\157ade\144\106ile\163"]; } else if ( isset ($_GET[$_gl12.".\165\160load\145\144Fi\154\145s"])) { $_gO12=$_GET[$_gl12."_upl\157\141ded\106\151le\163"]; } $_gO12=trim(trim($_gO12,"\133|-"),"-|]"); if (strlen($_gO12)>0) { $_gl13=explode("\055|]\133\174-",$_gO12); foreach ($_gl13 as $_gO13) { $_gl14=explode("-|-",$_gO13); $_gO14=array("na\155\145" => $_gl14[0],"\164ype" => $_gl14[1],"size" => $_gl14[2]); array_push($this->uploadedFiles ,$_gO14); } } } function loadxml($_gl15) { if (gettype($_gl15) == "\163\164rin\147") { $_gO15=new domdocument(); $_gO15->loadxml($_gl15); $_gl15=$_gO15->documentElement; } $_gl12=$_gl15->getattribute("i\144"); if ($_gl12 != "") $this->id =$_gl12; $_gl16=$_gl15->getattribute("sty\154\145Fol\144\145r"); if ($_gl16 != "") $this->styleFolder =$_gl16; } function render() { $_gO16="\n<!--K\157\157lU\160\154oad\145\162 v\145\162sio\156\040".$this->_gl0." -\040\167ww\056\153oo\154\160hp.\156\145t \055\055>\n"; $_gO16.=$this->registercss(); $_gO16.=$this->renderuploader(); $_gl17= isset ($_POST["\137\137ko\157\154aja\170"]) || isset ($_GET["__\153\157ola\152\141x"]); $_gO16.=($_gl17) ? "": $this->registerscript(); $_gO16.="\074scr\151\160t t\171\160e='\164\145xt\057\152av\141\163cr\151\160t\047\076"; $_gO16.=$this->startupscript(); $_gO16.="<\057scrip\164\076"; return $_gO16; } function renderuploader() { $this->_gO17(); $tpl_main="\173con\164\141ine\162\175\173\142\164nA\144\144}\173\142tnC\154\145ar\101\154l\175\173bt\156\125pl\157adA\154\154}"; $tpl_item="\173btn\125\160lo\141\144}\173\142\164nR\145\155ov\145\175\173\164\150um\142nail\175\173fi\154enam\145}\173\160\162og\162\145s\163\175\173\163tat\165\163}"; $tpl_btnAdd="\173bt\156\143ont\145\156t}"; $tpl_btnUploadAll="\173b\164\156con\164\145nt}"; $tpl_btnClearAll="\173\142\164nco\156\164ent\175"; $tpl_btnUpload="\173\142\164nco\156\164ent\175"; $tpl_btnRemove="\173b\164\156con\164\145nt}"; $_gl18="\173btn\143\157nt\145\156t}"; include "styl\145\163"."\057".$this->_gO11."/".$this->_gO11."\056tpl"; $_gO18="\074div\040\151d='\173\151d}'\040clas\163\075'k\165\154Te\155\160la\164e' s\164\171le\075'di\163\160la\171\072n\157\156e;\047>\173\143ont\145\156t}\074/di\166\076"; $_gl19="<di\166\040id\075\047\173\151\144}.\143\157nt\141\151ne\162\047 c\154ass=\047kulC\157ntai\156\145r\047\076<\057\144i\166\076"; $_gO19="\074div c\154\141ss\075\047ku\154\111te\155\047>\173\164pl_\151\164e\155\175</\144\151v>"; $_gl1a="<span\040\143las\163\075'k\165\154Te\170\164'>\173\164ext\175\074/\163\160an\076"; $_gO1a="\074in\160ut t\171\160e='\150\151dd\145\156' \151\144='\173\151d}\137\165pl\157\141de\144\106i\154\145s'\040name\075'\173\151\144}\137\165p\154\157ad\145\144F\151\154es\047 />"; $_gl1b="\074span \151\144='\173\151d}.b\164\156.a\144\144' \143\154as\163\075'\153\165lA\144\144'>\074a c\154\141ss\075'kul\101'>\173\164pl_\142tnA\144\144}<\057a><\057spa\156\076"; $_gO1b="<s\160\141n c\154\141ss=\047\153ul\106\151le\047\076<\151\156pu\164\040i\144\075'\173\151d}\047\040t\171\160e=\047fil\145\047 \057></\163\160an\076"; $_gl1c="\074span \151\144='\173\151d}.b\164\156.u\160\154oa\144\141ll\047 cla\163s='k\165\154Up\154oadA\154l'>\074\141 c\154\141s\163\075'\153\165l\101\047>\173\164pl\137\142tn\125plo\141\144A\154\154}<\057a><\057spa\156>"; $_gO1c="\074s\160\141n i\144\075'\173\151d}.b\164\156.c\154\145ara\154\154'\040\143la\163\163='\153ulCl\145arA\154\154'>\074a cl\141ss=\047\153u\154\101'>\173\164p\154\137bt\156Cle\141\162Al\154}</\141\076<\057spa\156\076"; $_gl1d="<sp\141\156 cl\141\163s='\153\165lU\160\154oad\047><a \143\154as\163\075'\153\165lA\047>\173\164\160l_\142\164n\125\160lo\141\144}\074\057a\076\074/\163\160an\076"; $_gO1d="<\163\160an \143\154as\163\075'k\165\154Re\155\157ve\047\076<\141\040c\154\141ss\075\047k\165\154A'\076\173t\160\154_b\164nRe\155\157v\145\175</\141></\163\160an\076"; $_gl1e="\074span\040\143la\163\163='k\165\154Ca\156\143el'\076<a c\154\141ss\075'ku\154\101'>\173\164pl\137\142t\156\103an\143\145l}\074/a>\074/sp\141\156>"; $_gO1e="\074sp\141\156 cl\141\163s=\047\153ul\106\151le\116\141me'\076 </\163\160an\076"; $_gl1f="\074\163pan\040\143la\163\163='\153\165lPr\157\147re\163\163'>\074img \163\162c\075\047\173\163tyl\145\106ol\144er}/\160rog\162\145s\163\142ar\056gif\047\040c\154\141s\163\075'k\165lBa\162\040\173\141lt\142\141r}\047 \173\163tyl\145} a\154t='\047/><\163\160a\156 cl\141ss=\047kul\124ext\047> \074\057s\160an>\074/sp\141n>"; $_gO1f="\074spa\156\040cl\141\163s=\047\153ul\123\164at\165\163'> \074/sp\141\156>"; $_gl1g="<sp\141\156 cla\163\163='\153\165lTh\165\155bn\141\151l'\076\040<\057span\076"; $_gO1g=_gO4("\173id}",$this->id.".me\163\163age\056\165pl\157\141d_\163\165cce\163\163fu\154",$_gO18); $_gO1g=_gO4("\173\143onten\164\175",$this->texts["MESSA\107\105_UP\114\117AD_\123\125CC\105\123SF\125\114"],$_gO1g); $_gl1h=_gO4("\173\151d}",$this->id."\056me\163\163age\056\165pl\157\141d_\146\141ile\144",$_gO18); $_gl1h=_gO4("\173\143onten\164\175",$this->texts["MES\123\101GE_\125\120LOA\104\137FA\111\114ED"],$_gl1h); $_gO1h=_gO4("\173\151d}",$this->id."\056messa\147\145.f\151\154e_n\157\164_al\154\157we\144",$_gO18); $_gO1h=_gO4("\173conte\156\164}",$this->texts["MESS\101\107E_FI\114\105_N\117\124_AL\114\117WE\104"],$_gO1h); $_gl1i=_gO4("\173i\144\175",$this->id."\056messa\147\145.fi\154\145_bi\147\147er\137\164ha\156\137ph\160\137al\154\157w",$_gO18); $_gl1i=_gO4("\173\143onte\156\164}",$this->texts["\115\105SSA\107\105_F\111\114E_B\111\107GE\122\137TH\101\116_P\110\120_A\114LOW"],$_gl1i); $_gO1i=_gO4("\173\151d}",$this->id."\056mess\141\147e.f\151\154e_b\151\147ge\162\137tha\156\137fo\162m_a\154\154ow",$_gO18); $_gO1i=_gO4("\173cont\145\156t}",$this->texts["MES\123\101GE_F\111\114E_\102\111GG\105\122_TH\101\116_F\117\122M\137\101LL\117\127"],$_gO1i); $_gl1j=_gO4("\173id}",$this->id."\056mes\163\141ge.\157\156ly_\160\141rt\137\157f_f\151\154e_\165ploa\144ed",$_gO18); $_gl1j=_gO4("\173\143\157nt\145\156t}",$this->texts["\115ES\123\101GE_\117\116LY_\120\101RT\137\117F_F\111\114E_\125PLO\101\104ED"],$_gl1j); $_gO1j=_gO4("\173id\175",$this->id."\056me\163\163age\056\165pl\157\141d_c\141\156ce\154",$_gO18); $_gO1j=_gO4("\173cont\145\156t}",$this->texts["\115ESSAG\105\137UPL\117\101D_C\101\116CE\114"],$_gO1j); $_gl1k=_gO4("\173id}",$this->id."\056templ\141\164e.i\164\145m",$_gO18); $_gl1k=_gO4("\173\143\157nte\156\164}",$_gO19,$_gl1k); $_gl1k=_gO4("\173\164pl_i\164\145m}",$tpl_item,$_gl1k); $_gO1k=_gO4("\173\164\160l_\142\164nRe\155\157ve}",$tpl_btnRemove,$_gO1d); $_gO1k=_gO4("\173btnc\157\156te\156\164}",$this->texts["\102UTTON\137\122EMO\126\105"],$_gO1k); $_gl1l=_gO4("\173tpl\137\142tnU\160\154oad\175",$tpl_btnUpload,$_gl1d); $_gl1l=_gO4("\173btnc\157\156ten\164\175",$this->texts["B\125\124TON\137\125PLO\101\104"],$_gl1l); $_gO1l=_gO4("\173tpl_b\164\156Can\143\145l}",$tpl_btnUpload,$_gl1e); $_gO1l=_gO4("\173\142tnc\157\156ten\164\175",$this->texts["BUTT\117\116_CAN\103\105L"],$_gO1l); $_gl1k=_gO4("\173\142tnUp\154\157ad}",$_gl1l,$_gl1k); $_gl1k=_gO4("\173bt\156\122emo\166\145}",$_gO1k,$_gl1k); $_gl1k=_gO4("\173\142tnCan\143\145l}",$_gO1l,$_gl1k); $_gl1k=_gO4("\173\146\151len\141\155e}",$_gO1e,$_gl1k); $_gl1k=_gO4("\173\163\164atu\163\175",$_gO1f,$_gl1k); $_gl1k=_gO4("\173\164humb\156\141il}",$_gl1g,$_gl1k); $_gl1m=_gO4("\173\163tyl\145\106old\145\162}",$this->styleFolder ,$_gl1f); $_gl1m=_gO4("\173\141\154tbar\175",($this->progressTracking) ? (function_exists("uplo\141\144pro\147\162ess\137\147et\137\151nfo") ? "": "\153ulAl\164\102ar"): "\153\165lA\154\164Bar",$_gl1m); $_gl1m=_gO4("\173\163\164yle\175",($this->showProgressBar) ? "": "sty\154\145='d\151\163pla\171\072no\156\145;'",$_gl1m); $_gl1k=_gO4("\173\160rogre\163\163}",$_gl1m,$_gl1k); $_gO1m=_gO4("\173id}",$this->id ,$_gl1b); $_gO1m=_gO4("\173tpl\137\142tnA\144\144}",$tpl_btnAdd,$_gO1m); $_gO1m=_gO4("\173btnco\156\164en\164\175",$this->texts["\102\125TTO\116\137ADD"],$_gO1m); $_gl1n=_gO4("\173\151d}",$this->id ,$_gl1c); $_gl1n=_gO4("\173\164pl_bt\156\125plo\141\144Al\154\175",$tpl_btnUploadAll,$_gl1n); $_gl1n=_gO4("\173btn\143\157nte\156\164}",$this->texts["\102UTTO\116\137UPL\117\101D_A\114\114"],$_gl1n); $_gO1n=_gO4("\173i\144\175",$this->id ,$_gO1c); $_gO1n=_gO4("\173\164\160l_b\164\156Cle\141\162Al\154\175",$tpl_btnClearAll,$_gO1n); $_gO1n=_gO4("\173\142tncon\164\145nt}",$this->texts["\102\125TTO\116\137CLE\101\122_A\114\114"],$_gO1n); $_gl1o=_gO4("\173\151\144}",$this->id ,$_gl19); $_gO1o=_gO4("\173\143\157ntai\156\145r}",$_gl1o,$tpl_main); $_gO1o=_gO4("\173btnA\144\144}",$_gO1m,$_gO1o); $_gO1o=_gO4("\173btn\125\160loa\144\101ll}",$_gl1n,$_gO1o); $_gO1o=_gO4("\173b\164\156Cle\141\162All\175",$_gO1n,$_gO1o); $_gOi=_gO4("\173i\144\175",$this->id ,_gOf()); $_gOi=_gO4("\173\163tyl\145\175",$this->_gO11 ,$_gOi); $_gOi=_gO4("\173\167idth\175",$this->width ,$_gOi); $_gOi=_gO4("\173\150\145igh\164\175",$this->height ,$_gOi); if (_gOh($_gOi)) { $_gOi=_gO4("\173\164emp\154\141tes\175",$_gO1g.$_gO1h.$_gl1h.$_gl1k.$_gl1i.$_gO1i.$_gl1j.$_gO1j,$_gOi); } $_gOi=_gO4("\173\166ersi\157\156}",$this->_gl0 ,$_gOi); $_gOi=_gO4("\173\155\141inc\157\156ten\164\175",$_gO1o,$_gOi); $_gOi=_gO4("\173\165pload\145\144Fil\145\163}",_gO4("\173\151\144}",$this->id ,$_gO1a),$_gOi); return $_gOi; } function _gO17() { $this->styleFolder =_gO4("\134","\057",$this->styleFolder); $_gl16=trim($this->styleFolder ,"/"); $_gl1p=strrpos($_gl16,"/"); $this->_gO11 =substr($_gl16,($_gl1p ? $_gl1p: -1)+1); } function registercss() { $this->_gO17(); $_gO1p="\074scr\151\160t t\171\160e='\164\145xt\057\152av\141\163cr\151\160t\047\076i\146\040(d\157\143u\155\145nt\056getE\154emen\164ByI\144('_\137\173st\171\154e\175\113UL\047)==\156\165l\154\051\173\166ar \137hea\144\040=\040doc\165men\164\056g\145tEl\145\155e\156tsB\171Tag\116\141m\145\050'\150ead\047)[\060\135;\166ar \137lin\153 = \144oc\165\155e\156\164.\143rea\164eE\154\145m\145nt(\047li\156k')\073 _\154ink\056id\040= \047__\173\163t\171le\175\113U\114';\137lin\153.r\145l=\047st\171\154e\163he\145t'\073 _\154in\153.h\162ef=\047\173\163ty\154ep\141th\175/\173\163t\171\154e\175/\173\163t\171le\175.c\163s'\073_h\145ad\056a\160\160e\156dC\150i\154d(\137li\156k)\073}<\057s\143ri\160t>"; $_gO16=_gO4("\173sty\154\145}",$this->_gO11 ,$_gO1p); $_gO16=_gO4("\173\163\164yle\160\141th\175",$this->_gl1q(),$_gO16); return $_gO16; } function registerscript() { $this->_gO17(); $_gO1p="\074\163cr\151\160t t\171\160e='\164\145xt\057\152av\141\163cr\151\160t\047\076if\050typ\145\157f \137\154i\142\113UL\075='un\144efi\156ed'\051\173do\143u\155\145n\164\056wr\151te(\165\156e\163\143ap\145(\042\0453Cs\143rip\164 ty\160\145=\047tex\164\057j\141vas\143rip\164' s\162c='\173\163r\143\175'\0453E \0453C\057\163c\162ipt\0453E\042));\137lib\113UL\0751;}"; $_gO1p.="i\146\050ty\160\145of \173\163ty\154\145}KU\114\111ni\164\075='\165nde\146\151ne\144\047)\173\144oc\165\155en\164\056w\162\151te\050une\163cape\050\042\045\063C\163\143ri\160t t\171\160e=\047tex\164/ja\166\141s\143\162ip\164' s\162c='\173sty\154\145p\141\164h\175/\173\163tyl\145\175/\173\163t\171le}\056js'\0453E\040\0453\103/s\143\162i\160\164%\063E\042\051);\175</s\143ri\160\164>"; $_gO16=_gO4("\173src}",$this->_gO1q()."?".md5("j\163"),$_gO1p); $_gO16=_gO4("\173sty\154\145}",$this->_gO11 ,$_gO16); $_gO16=_gO4("\173\163\164yle\160\141th\175",$this->_gl1q(),$_gO16); return $_gO16; } function startupscript() { $this->_gO17(); $_gl1r="i\146\050ty\160\145of\040\173st\171\154e}\113\125LI\156\151t!\075'un\144\145fi\156\145d'\051\173\173\163ty\154\145}K\125LIni\164('\173\151d}\047);}\040\166a\162\040\173\151d}=\156ew \113\157o\154\125pl\157ade\162('\173\151d}\047\054'\173han\144\154e\120\141g\145}'\054\047\173\165pl\157ad}\047,'\173\163t\141\164u\163}',\173int\145rv\141\154}\054\173p\162og\162\145s\163Tra\143ki\156\147}\054\173\155\141x\106il\145\123i\172e}\054'\173\141ll\157we\144\105x\164en\163io\156\175'\051;"; $_gO16=_gO4("\173id\175",$this->id ,$_gl1r); $_gO16=_gO4("\173\163tyl\145\175",$this->_gO11 ,$_gO16); $_gO16=_gO4("\173h\141\156dle\120\141ge}",$this->handlePage ,$_gO16); $_gO16=_gO4("\173uploa\144\175",md5( __FILE__."u\160\154oad"),$_gO16); $_gO16=_gO4("\173\163tatus\175",md5( __FILE__."\163tatu\163"),$_gO16); $_gO16=_gO4("\173i\156\164erv\141\154}",$this->updateProgressInterval ,$_gO16); $_gO16=_gO4("\173\160\162ogre\163\163Tr\141\143kin\147\175",($this->progressTracking) ? (function_exists("upl\157\141dpr\157\147re\163\163_ge\164\137in\146\157") ? "1": "0"): "\060",$_gO16); $_gO16=_gO4("\173\155axF\151\154eSi\172\145}",$this->maxFileSize ,$_gO16); $_gO16=_gO4("\173\141\154low\145\144Ext\145\156si\157\156}",$this->allowedExtension ,$_gO16); return $_gO16; } function _gO1q() { if ($this->scriptFolder == "") { $_gO5=_gO3(); $_glx=substr(_gO4("\134","/",__FILE__),strlen($_gO5)); return $_glx; } else { $_glx=_gO4("\134","/",__FILE__); $_glx=$this->scriptFolder.substr($_glx,strrpos($_glx,"\057")); return $_glx; } } function _gl1q() { $_gO1r=$this->_gO1q(); $_gl1s=_gO4(strrchr($_gO1r,"/"),"",$_gO1r)."/sty\154\145s"; return $_gl1s; } } } ?>
Exemple #27
0
 /**
  * File upload progress handler.
  */
 public function upload_progress()
 {
     $params = array('action' => $this->action, 'name' => rcube_utils::get_input_value('_progress', rcube_utils::INPUT_GET));
     if (function_exists('uploadprogress_get_info')) {
         $status = uploadprogress_get_info($params['name']);
         if (!empty($status)) {
             $params['current'] = $status['bytes_uploaded'];
             $params['total'] = $status['bytes_total'];
         }
     }
     if (!isset($status) && filter_var(ini_get('apc.rfc1867'), FILTER_VALIDATE_BOOLEAN) && ini_get('apc.rfc1867_name')) {
         $prefix = ini_get('apc.rfc1867_prefix');
         $status = apc_fetch($prefix . $params['name']);
         if (!empty($status)) {
             $params['current'] = $status['current'];
             $params['total'] = $status['total'];
         }
     }
     if (!isset($status) && filter_var(ini_get('session.upload_progress.enabled'), FILTER_VALIDATE_BOOLEAN) && ini_get('session.upload_progress.name')) {
         $key = ini_get('session.upload_progress.prefix') . $params['name'];
         $params['total'] = $_SESSION[$key]['content_length'];
         $params['current'] = $_SESSION[$key]['bytes_processed'];
     }
     if (!empty($params['total'])) {
         $total = $this->show_bytes($params['total'], $unit);
         switch ($unit) {
             case 'GB':
                 $gb = $params['current'] / 1073741824;
                 $current = sprintf($gb >= 10 ? "%d" : "%.1f", $gb);
                 break;
             case 'MB':
                 $mb = $params['current'] / 1048576;
                 $current = sprintf($mb >= 10 ? "%d" : "%.1f", $mb);
                 break;
             case 'KB':
                 $current = round($params['current'] / 1024);
                 break;
             case 'B':
             default:
                 $current = $params['current'];
                 break;
         }
         $params['percent'] = round($params['current'] / $params['total'] * 100);
         $params['text'] = $this->gettext(array('name' => 'uploadprogress', 'vars' => array('percent' => $params['percent'] . '%', 'current' => $current, 'total' => $total)));
     }
     $this->output->command('upload_progress_update', $params);
     $this->output->send();
 }
Exemple #28
0
/* DISABLE_PHP_LINT_CHECKING */
##|+PRIV
##|*IDENT=page-upload_progress
##|*NAME=System: Firmware: Manual Update page (progress bar)
##|*DESCR=Allow access to the 'System: Firmware: Manual Update: Progress bar' page.
##|*MATCH=upload_progress*
##|-PRIV
include "guiconfig.inc";
// sanitize the ID value
$id = $_SESSION['uploadid'];
if (!$id) {
    echo gettext("Sorry, we could not find an uploadid code.");
    exit;
}
// retrieve the upload data from APC
$info = uploadprogress_get_info($id);
// false is returned if the data isn't found
if (!$info) {
    echo <<<EOF
\t<html>
\t\t<meta http-equiv="Refresh" CONTENT="1; url=upload_progress.php?uploadid={$id}">
\t\t<body>
\t\t\t<?php printf(gettext("Could not locate progress %s.  Trying again..."),{$id});?>
\t\t</body>
\t</html>
EOF;
    exit;
}
if ($info['bytes_uploaded'] >= $info['bytes_total']) {
    echo <<<EOF1
\t<html>
Exemple #29
-1
 function get_progress($key)
 {
     if (function_exists('uploadprogress_get_info')) {
         echo json_encode(uploadprogress_get_info($key));
     }
 }
Exemple #30
-1
 function PostMessage(&$form, $message, &$processed)
 {
     switch ($message['Event']) {
         case 'load':
             $more = 0;
             $id = $_REQUEST['UPLOAD_IDENTIFIER'];
             if ($this->started) {
                 $progress = uploadprogress_get_info($id);
                 if (isset($progress)) {
                     $more = 1;
                 } else {
                     $this->uploaded = $this->total;
                 }
             } else {
                 if ($this->start_time == 0) {
                     $this->uploaded = $this->total = $this->remaining = $this->average_speed = $this->current_speed = 0;
                     $this->last_feedback = '';
                     $this->start_time = time();
                 }
                 $progress = uploadprogress_get_info($id);
                 if (isset($progress)) {
                     $this->started = 1;
                     $more = 1;
                 } elseif (time() - $this->start_time < $this->wait_time) {
                     $more = 1;
                 }
             }
             $message['Actions'] = array();
             if (strlen($this->feedback_element)) {
                 if (isset($progress)) {
                     $this->uploaded = $progress['bytes_uploaded'];
                     $this->total = $progress['bytes_total'];
                     $this->remaining = $progress['est_sec'];
                     $this->average_speed = $progress['speed_average'];
                     $this->current_speed = $progress['speed_last'];
                 }
                 $feedback = $this->total ? str_replace('{PROGRESS}', intval($this->uploaded * 100.0 / $this->total), str_replace('{ACCURATE_PROGRESS}', $this->uploaded * 100.0 / $this->total, str_replace('{UPLOADED}', $this->FormatNumber($this->uploaded), str_replace('{TOTAL}', $this->FormatNumber($this->total), str_replace('{REMAINING}', $this->FormatTime($this->remaining), str_replace('{AVERAGE_SPEED}', $this->FormatNumber($this->average_speed), str_replace('{CURRENT_SPEED}', $this->FormatNumber($this->current_speed), $this->feedback_format))))))) : '';
                 if (strcmp($this->last_feedback, $feedback)) {
                     $message['Actions'][] = array('Action' => 'ReplaceContent', 'Container' => $this->feedback_element, 'Content' => $feedback);
                     $this->last_feedback = $feedback;
                 }
             }
             if ($more) {
                 $message['Actions'][] = array('Action' => 'Wait', 'Time' => 1);
             }
             $message['More'] = $more;
             break;
     }
     return $form->ReplyMessage($message, $processed);
 }