本文整理汇总了PHP中return_bytes函数的典型用法代码示例。如果您正苦于以下问题:PHP return_bytes函数的具体用法?PHP return_bytes怎么用?PHP return_bytes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了return_bytes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hasMemoryForImage
function hasMemoryForImage($serverFilename)
{
// find out how much total memory this script can access
$memoryAvailable = return_bytes(@ini_get('memory_limit'));
// if memory is unlimited, it will return -1 and we don’t need to worry about it
if ($memoryAvailable == -1) {
return true;
}
// find out how much memory we are already using
$memoryUsed = memory_get_usage();
$imgsize = @getimagesize($serverFilename);
// find out how much memory this image needs for processing, probably only works for jpegs
// from comments on http://www.php.net/imagecreatefromjpeg
if (is_array($imgsize) && isset($imgsize['bits']) && isset($imgsize['channels'])) {
$memoryNeeded = round(($imgsize[0] * $imgsize[1] * $imgsize['bits'] * $imgsize['channels'] / 8 + Pow(2, 16)) * 1.65);
$memorySpare = $memoryAvailable - $memoryUsed - $memoryNeeded;
if ($memorySpare > 0) {
// we have enough memory to load this file
return true;
} else {
// not enough memory to load this file
$image_info = sprintf('%.2fKB, %d × %d %d bits %d channels', filesize($serverFilename) / 1024, $imgsize[0], $imgsize[1], $imgsize['bits'], $imgsize['channels']);
Log::addMediaLog('Cannot create thumbnail ' . $serverFilename . ' (' . $image_info . ') memory avail: ' . $memoryAvailable . ' used: ' . $memoryUsed . ' needed: ' . $memoryNeeded . ' spare: ' . $memorySpare);
return false;
}
} else {
// assume there is enough memory
// TODO find out how to check memory needs for gif and png
return true;
}
}
示例2: processData
public function processData(\IRequestObject $requestObject)
{
$params = $requestObject->getParams();
// $objectId = $params["messageObjectId"];
// $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId);
//var_dump($params);
$dialog = new \Widgets\Dialog();
$dialog->setTitle("Portfolio Importieren");
$dialog->setPositionX($this->params["mouseX"]);
$dialog->setPositionY($this->params["mouseY"]);
$ajaxUploader = new \Widgets\AjaxUploader();
$imgWidget = new \Widgets\RawHtml();
$imgWidget->setHtml("Um ein Portfolio zu importieren ziehen sie die Datei auf dieses Feld oder doppelklicken sie hier.<br>");
//$ajaxUploader->setPreview($imgWidget);
// }
$ajaxUploader->setSizeLimit(return_bytes(ini_get('post_max_size')));
$ajaxUploader->setNamespace("Portfolio");
$ajaxUploader->setCommand("UploadImport");
$ajaxUploader->setDestId($params["id"]);
$ajaxUploader->setMultiUpload(false);
// $ajaxUploader->setOnComplete("function(id, fileName, responseJSON){document.getElementById('uploaderArtefact').src = '" . PATH_URL . "download/document/' + responseJSON.oid; jQuery('#uploaderArtefact').addClass('saved')}");
$ajaxUploader->setOnComplete("function(id, fileName, responseJSON){location.reload();}");
$dialog->addWidget($ajaxUploader);
// $dialog->addWidget($raw);
$dialog->addWidget(new \Widgets\Clearer());
$this->dialog = $dialog;
}
示例3: _init_env
function _init_env()
{
error_reporting(E_ERROR);
if (PHP_VERSION < '5.3.0') {
set_magic_quotes_runtime(0);
}
/*vot*/
if (!defined('DISCUZ_ROOT')) {
/*vot*/
define('DISCUZ_ROOT', preg_replace("/^\\w\\:/i", '', str_replace("\\", '/', substr(dirname(__FILE__), 0, -12))));
/*vot*/
}
define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
define('ICONV_ENABLE', function_exists('iconv'));
define('MB_ENABLE', function_exists('mb_convert_encoding'));
define('EXT_OBGZIP', function_exists('ob_gzhandler'));
define('TIMESTAMP', time());
$this->timezone_set();
/*vot*/
if (!defined('DISCUZ_CORE_FUNCTION') && !@(include_once DISCUZ_ROOT . './source/function/function_core.php')) {
exit('function_core.php is missing');
}
if (function_exists('ini_get')) {
$memorylimit = @ini_get('memory_limit');
if ($memorylimit && return_bytes($memorylimit) < 33554432 && function_exists('ini_set')) {
ini_set('memory_limit', '128m');
}
}
define('IS_ROBOT', checkrobot());
foreach ($GLOBALS as $key => $value) {
if (!isset($this->superglobal[$key])) {
$GLOBALS[$key] = null;
unset($GLOBALS[$key]);
}
}
global $_G;
$_G = array('uid' => 0, 'username' => '', 'adminid' => 0, 'groupid' => 1, 'sid' => '', 'formhash' => '', 'timestamp' => TIMESTAMP, 'starttime' => dmicrotime(), 'clientip' => $this->_get_client_ip(), 'referer' => '', 'charset' => '', 'gzipcompress' => '', 'authkey' => '', 'timenow' => array(), 'PHP_SELF' => '', 'siteurl' => '', 'siteroot' => '', 'siteport' => '', 'config' => array(), 'setting' => array(), 'member' => array(), 'group' => array(), 'cookie' => array(), 'style' => array(), 'cache' => array(), 'session' => array(), 'lang' => array(), 'my_app' => array(), 'my_userapp' => array(), 'fid' => 0, 'tid' => 0, 'forum' => array(), 'thread' => array(), 'rssauth' => '', 'home' => array(), 'space' => array(), 'block' => array(), 'article' => array(), 'action' => array('action' => APPTYPEID, 'fid' => 0, 'tid' => 0), 'mobile' => '');
$_G['PHP_SELF'] = htmlspecialchars($this->_get_script_url());
$_G['basescript'] = CURSCRIPT;
$_G['basefilename'] = basename($_G['PHP_SELF']);
$sitepath = substr($_G['PHP_SELF'], 0, strrpos($_G['PHP_SELF'], '/'));
if (defined('IN_API')) {
$sitepath = preg_replace("/\\/api\\/?.*?\$/i", '', $sitepath);
} elseif (defined('IN_ARCHIVER')) {
$sitepath = preg_replace("/\\/archiver/i", '', $sitepath);
}
$_G['siteurl'] = htmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . $sitepath . '/');
$url = parse_url($_G['siteurl']);
$_G['siteroot'] = isset($url['path']) ? $url['path'] : '';
$_G['siteport'] = empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT'];
if (defined('SUB_DIR')) {
$_G['siteurl'] = str_replace(SUB_DIR, '/', $_G['siteurl']);
$_G['siteroot'] = str_replace(SUB_DIR, '/', $_G['siteroot']);
}
/*vot*/
$_G['siteurl'] = str_replace("\\", '/', $_G['siteurl']);
/*vot*/
$_G['siteroot'] = str_replace("\\", '/', $_G['siteroot']);
$this->var =& $_G;
}
示例4: ajaxResponse
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
{
// list of valid extensions, ex. array("jpeg", "xml", "bmp")
$allowedExtensions = array();
// max file size in bytes
$sizeLimit = return_bytes(ini_get('post_max_size'));
$destId = $_REQUEST["destid"];
$destObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $destId);
//remove old image
$oldImageId = $destObject->get_attribute("bid:portlet:msg:picture_id");
if ($oldImageId !== 0) {
$oldImage = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $oldImageId);
if ($oldImage instanceof \steam_document) {
$destObject->delete_attribute("bid:portlet:msg:picture_id");
$oldImage->delete();
}
}
// upload image
$envid = $destObject->get_environment()->get_id();
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit, $envid);
$result = $uploader->handleUpload(PATH_TEMP);
// set new image
$destObject->set_attribute("bid:portlet:msg:picture_id", $result["oid"]);
// to pass data through iframe you will need to encode all html tags
echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
die;
//$ajaxResponseObject->setStatus("ok");
//return $ajaxResponseObject;
}
示例5: js_drag_n_drop_handle
function js_drag_n_drop_handle($a)
{
$max_file_size = min(return_bytes(ini_get('upload_max_filesize')), return_bytes(ini_get('post_max_size')));
$sc = '
// upload next file
function uploadNext() {
if (list.length) {
document.getElementById(\'count\').classList.add(\'showed\');
var nextFile = list.shift();
if (nextFile.size >= ' . $max_file_size . ') {
var respdiv = document.getElementById(nextFile.locId);
respdiv.querySelector(\'.uploadstatus\').appendChild(document.createTextNode(\'File too big\'));
respdiv.classList.remove(\'pending\');
respdiv.classList.add(\'failure\');
uploadNext();
} else {
var respdiv = document.getElementById(nextFile.locId);
respdiv.querySelector(\'.uploadstatus\').textContent = \'Uploading\';
uploadFile(nextFile);
}
} else {
document.getElementById(\'count\').classList.remove(\'showed\');
nbDraged = false;
// reactivate the "required" attribute of file input
document.getElementById(\'fichier\').required = true;
}
}
';
if ($a == 1) {
$sc = "\n" . '<script type="text/javascript">' . "\n" . $sc . "\n" . '</script>' . "\n";
}
return $sc;
}
示例6: max_file_upload_in_bytes
function max_file_upload_in_bytes()
{
//select maximum upload size
$max_upload = return_bytes(ini_get('upload_max_filesize'));
//select post limit
$max_post = return_bytes(ini_get('post_max_size'));
//select memory limit
$memory_limit = return_bytes(ini_get('memory_limit'));
// return the smallest of them, this defines the real limit
return min($max_upload, $max_post, $memory_limit);
}
示例7: ajaxResponse
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
{
$ajaxResponseObject->setStatus("ok");
$ajaxUploader = new \Widgets\AjaxUploader();
$ajaxUploader->setSizeLimit(return_bytes(ini_get('post_max_size')));
$ajaxUploader->setBackend(PATH_URL . "portfolio/");
$ajaxUploader->setEnvId($this->id);
$ajaxUploader->setCommand("UploadImport");
$ajaxUploader->setNamespace("Portfolio");
$ajaxResponseObject->addWidget($ajaxUploader);
return $ajaxResponseObject;
}
示例8: _init_env
private function _init_env()
{
error_reporting(E_ERROR);
if (PHP_VERSION < '5.3.0') {
set_magic_quotes_runtime(0);
}
define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
define('ICONV_ENABLE', function_exists('iconv'));
define('MB_ENABLE', function_exists('mb_convert_encoding'));
define('EXT_OBGZIP', function_exists('ob_gzhandler'));
define('TIMESTAMP', time());
$this->timezone_set();
if (!defined('DZZ_CORE_FUNCTION') && !@(include DZZ_ROOT . './core/function/function_core.php')) {
exit('function_core.php is missing');
}
if (function_exists('ini_get')) {
$memorylimit = @ini_get('memory_limit');
if ($memorylimit && return_bytes($memorylimit) < 33554432 && function_exists('ini_set')) {
ini_set('memory_limit', '128m');
}
}
define('IS_ROBOT', checkrobot());
foreach ($GLOBALS as $key => $value) {
if (!isset($this->superglobal[$key])) {
$GLOBALS[$key] = null;
unset($GLOBALS[$key]);
}
}
global $_G;
$_G = array('uid' => 0, 'username' => '', 'adminid' => 0, 'groupid' => 1, 'sid' => '', 'formhash' => '', 'connectguest' => 0, 'timestamp' => TIMESTAMP, 'starttime' => microtime(true), 'clientip' => $this->_get_client_ip(), 'referer' => '', 'charset' => '', 'gzipcompress' => '', 'authkey' => '', 'timenow' => array(), 'PHP_SELF' => '', 'siteurl' => '', 'siteroot' => '', 'siteport' => '', 'config' => array(), 'setting' => array(), 'member' => array(), 'group' => array(), 'cookie' => array(), 'style' => array(), 'cache' => array(), 'session' => array(), 'lang' => array(), 'rssauth' => '');
$_G['PHP_SELF'] = dhtmlspecialchars($this->_get_script_url());
$_G['basescript'] = CURSCRIPT . 'php';
$_G['basefilename'] = basename($_G['PHP_SELF']);
$sitepath = substr($_G['PHP_SELF'], 0, strrpos($_G['PHP_SELF'], '/'));
if (defined('IN_API')) {
$sitepath = preg_replace("/\\/api\\/?.*?\$/i", '', $sitepath);
} elseif (defined('IN_ARCHIVER')) {
$sitepath = preg_replace("/\\/archiver/i", '', $sitepath);
}
$_G['isHTTPS'] = $_SERVER['HTTPS'] && strtolower($_SERVER['HTTPS']) != 'off' ? true : false;
$_G['siteurl'] = dhtmlspecialchars('http' . ($_G['isHTTPS'] ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $sitepath . '/');
$url = parse_url($_G['siteurl']);
$_G['siteroot'] = isset($url['path']) ? $url['path'] : '';
$_G['siteport'] = empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' || $_SERVER['SERVER_PORT'] == '443' ? '' : ':' . $_SERVER['SERVER_PORT'];
if (defined('SUB_DIR')) {
$_G['siteurl'] = str_replace(SUB_DIR, '/', $_G['siteurl']);
$_G['siteroot'] = str_replace(SUB_DIR, '/', $_G['siteroot']);
}
$_G['browser'] = helper_browser::getbrowser();
$_G['platform'] = helper_browser::getplatform();
$this->var =& $_G;
}
示例9: ajaxResponse
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
{
$allowedExtensions = array("zip");
$sizeLimit = return_bytes(ini_get('post_max_size'));
// $envid = $_REQUEST["envid"];
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit, $envid);
$result = $uploader->handleUpload(PATH_TEMP);
// to pass data through iframe you will need to encode all html tags
echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
die;
//$ajaxResponseObject->setStatus("ok");
//return $ajaxResponseObject;
}
示例10: ajaxResponse
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
{
$ajaxResponseObject->setStatus("ok");
$ajaxUploader = new \Widgets\AjaxUploader();
$ajaxUploader->setSizeLimit(return_bytes(ini_get('post_max_size')));
$ajaxUploader->setNamespace("Explorer");
$ajaxUploader->setDestId($this->id);
$rawHTML = new \Widgets\RawHtml();
$rawHTML->setHtml("<div style=\"float:right\"><a class=\"button pill negative\" onclick=\"closeDialog();return false;\" href=\"#\">Schließen</a></div>");
$ajaxResponseObject->addWidget($ajaxUploader);
$ajaxResponseObject->addWidget($rawHTML);
return $ajaxResponseObject;
}
示例11: processData
public function processData(\IRequestObject $requestObject)
{
$params = $requestObject->getParams();
$objectId = $params["messageObjectId"];
$object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId);
$oldImageId = $object->get_attribute("bid:portlet:msg:picture_id");
$dialog = new \Widgets\Dialog();
$dialog->setTitle("Meldungsbild bearbeiten");
$dialog->setPositionX($this->params["mouseX"]);
$dialog->setPositionY($this->params["mouseY"]);
//$dialog->setWidth(450);
$emptyImageUrl = PATH_URL . "portletMsg/asset/empty.jpg";
$ajaxUploader = new \Widgets\AjaxUploader();
if ($oldImageId !== 0) {
$imgWidget = new \Widgets\RawHtml();
$imgWidget->setHtml("Um ein Bild hochzuladen ziehen sie eine Datei auf dieses Feld oder doppelklicken sie hier.<br><img id=\"uploaderImage\" src=\"" . PATH_URL . "download/document/{$oldImageId}\"></img>");
$ajaxUploader->setPreview($imgWidget);
} else {
$imgWidget = new \Widgets\RawHtml();
$imgWidget->setHtml("Um ein Bild hochzuladen ziehen sie eine Datei auf dieses Feld oder doppelklicken sie hier.<br><img id=\"uploaderImage\" src=\"{$emptyImageUrl}\"></img>");
$ajaxUploader->setPreview($imgWidget);
}
$ajaxUploader->setSizeLimit(return_bytes(ini_get('post_max_size')));
$ajaxUploader->setNamespace("PortletMsg");
$ajaxUploader->setCommand("UploadImage");
$ajaxUploader->setDestId($object->get_id());
$ajaxUploader->setMultiUpload(false);
$ajaxUploader->setOnComplete("function(id, fileName, responseJSON){document.getElementById('uploaderImage').src = '" . PATH_URL . "download/document/' + responseJSON.oid; jQuery('#uploaderImage').addClass('saved')}");
$dialog->addWidget($ajaxUploader);
$raw = new \Widgets\RawHtml();
$raw->setHtml(<<<END
\t\t<a href="#" class="button pill negative" onclick="sendRequest('DeleteImage', {'id':{$object->get_id()}}, '', 'data', null, function() {document.getElementById('uploaderImage').src = '{$emptyImageUrl}'; jQuery('#uploaderImage').addClass('saved')}, 'PortletMsg');">Bild löschen</a>
END
);
$dialog->addWidget($raw);
$dialog->addWidget(new \Widgets\Clearer());
$radioButton = new \Widgets\RadioButton();
$radioButton->setLabel("Bildposition");
$radioButton->setOptions(array(array("name" => "links", "value" => "left"), array("name" => "nicht umfließend", "value" => "none"), array("name" => "rechts", "value" => "right")));
$radioButton->setData($object);
$radioButton->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:msg:picture_alignment"));
$dialog->addWidget($radioButton);
$dialog->addWidget(new \Widgets\Clearer());
$sizeInput = new \Widgets\TextInput();
$sizeInput->setLabel("Bildbreite");
$sizeInput->setData($object);
$sizeInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:msg:picture_width"));
$dialog->addWidget($sizeInput);
$this->dialog = $dialog;
}
示例12: _init_env
private function _init_env()
{
error_reporting(E_ERROR);
if (PHP_VERSION < '5.3.0') {
set_magic_quotes_runtime(0);
}
define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
define('ICONV_ENABLE', function_exists('iconv'));
define('MB_ENABLE', function_exists('mb_convert_encoding'));
define('EXT_OBGZIP', function_exists('ob_gzhandler'));
define('TIMESTAMP', time());
$this->timezone_set();
if (!defined('DISCUZ_CORE_FUNCTION') && !@(include DISCUZ_ROOT . './source/function/function_core.php')) {
exit('function_core.php is missing');
}
if (function_exists('ini_get')) {
$memorylimit = @ini_get('memory_limit');
if ($memorylimit && return_bytes($memorylimit) < 33554432 && function_exists('ini_set')) {
ini_set('memory_limit', '128m');
}
}
define('IS_ROBOT', checkrobot());
foreach ($GLOBALS as $key => $value) {
if (!isset($this->superglobal[$key])) {
$GLOBALS[$key] = null;
unset($GLOBALS[$key]);
}
}
global $_G;
$_G = array('uid' => 0, 'username' => '', 'adminid' => 0, 'groupid' => 1, 'sid' => '', 'formhash' => '', 'connectguest' => 0, 'timestamp' => TIMESTAMP, 'starttime' => microtime(true), 'clientip' => $this->_get_client_ip(), 'remoteport' => $_SERVER['REMOTE_PORT'], 'referer' => '', 'charset' => '', 'gzipcompress' => '', 'authkey' => '', 'timenow' => array(), 'widthauto' => 0, 'disabledwidthauto' => 0, 'PHP_SELF' => '', 'siteurl' => '', 'siteroot' => '', 'siteport' => '', 'pluginrunlist' => !defined('PLUGINRUNLIST') ? array() : explode(',', PLUGINRUNLIST), 'config' => array(), 'setting' => array(), 'member' => array(), 'group' => array(), 'cookie' => array(), 'style' => array(), 'cache' => array(), 'session' => array(), 'lang' => array(), 'my_app' => array(), 'my_userapp' => array(), 'fid' => 0, 'tid' => 0, 'forum' => array(), 'thread' => array(), 'rssauth' => '', 'home' => array(), 'space' => array(), 'block' => array(), 'article' => array(), 'action' => array('action' => APPTYPEID, 'fid' => 0, 'tid' => 0), 'mobile' => '', 'notice_structure' => array('mypost' => array('post', 'pcomment', 'activity', 'reward', 'goods', 'at'), 'interactive' => array('poke', 'friend', 'wall', 'comment', 'click', 'sharenotice'), 'system' => array('system', 'myapp', 'credit', 'group', 'verify', 'magic', 'task', 'show', 'group', 'pusearticle', 'mod_member', 'blog', 'article'), 'manage' => array('mod_member', 'report', 'pmreport'), 'app' => array()), 'mobiletpl' => array('1' => 'mobile', '2' => 'touch', '3' => 'wml', 'yes' => 'mobile'));
$_G['PHP_SELF'] = dhtmlspecialchars($this->_get_script_url());
$_G['basescript'] = CURSCRIPT;
$_G['basefilename'] = basename($_G['PHP_SELF']);
$sitepath = substr($_G['PHP_SELF'], 0, strrpos($_G['PHP_SELF'], '/'));
if (defined('IN_API')) {
$sitepath = preg_replace("/\\/api\\/?.*?\$/i", '', $sitepath);
} elseif (defined('IN_ARCHIVER')) {
$sitepath = preg_replace("/\\/archiver/i", '', $sitepath);
}
$_G['isHTTPS'] = $_SERVER['HTTPS'] && strtolower($_SERVER['HTTPS']) != 'off' ? true : false;
$_G['siteurl'] = dhtmlspecialchars('http' . ($_G['isHTTPS'] ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $sitepath . '/');
$url = parse_url($_G['siteurl']);
$_G['siteroot'] = isset($url['path']) ? $url['path'] : '';
$_G['siteport'] = empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' || $_SERVER['SERVER_PORT'] == '443' ? '' : ':' . $_SERVER['SERVER_PORT'];
if (defined('SUB_DIR')) {
$_G['siteurl'] = str_replace(SUB_DIR, '/', $_G['siteurl']);
$_G['siteroot'] = str_replace(SUB_DIR, '/', $_G['siteroot']);
}
$this->var =& $_G;
}
示例13: php_iniChecks
function php_iniChecks()
{
global $successful_Check;
$checks = array('display_errors' => false, 'expose_php' => false, 'allow_url_include' => false, 'allow_url_fopen' => false, 'sql.safe_mode' => true, 'post_max_size' => 1024, 'max_execution_time' => 30, 'max_input_time' => 30, 'memory_limit' => 40 * 1024 * 1024, 'register_globals' => false, 'session.cookie_httponly' => true, 'session.hash_function' => true);
foreach ($checks as $key => $value) {
if (is_bool($value) && (bool) ini_get($key) !== $value) {
$successful_Check = false;
echo "The directive " . $key . " is set to <b>" . ($value ? "false" : "true") . "</b>. You should set it to <b>" . ($value ? "true" : "false") . "</b>. <br />";
} elseif (is_int($value) && intval(return_bytes(ini_get($key))) > $value) {
$successful_Check = false;
echo "The directive " . $key . " is set to <b>" . intval(return_bytes(ini_get($key))) . "</b>. You should set it to <b>" . $value . "</b>. <br />";
}
}
}
示例14: __construct
function __construct($sUploadTypeNC = 'Common')
{
parent::__construct();
$this->sTempFilename = '';
$this->sUploadTypeNC = $sUploadTypeNC;
$this->sUploadTypeLC = strtolower($this->sUploadTypeNC);
$this->_iOwnerId = $this->_getAuthorId();
$this->_sJsPostObject = 'o' . $this->sUploadTypeNC . 'Upload';
$this->sSendFileInfoFormCaption = '';
$GLOBALS['oSysTemplate']->addJsTranslation(array('_bx_' . $this->sUploadTypeLC . 's_val_title_err', '_bx_' . $this->sUploadTypeLC . 's_val_descr_err'));
//--- Get Extras ---//
$this->_aExtras = array();
if (!empty($_POST)) {
$this->_aExtras = $this->_getExtraParams($_POST);
}
$this->iMaxFilesize = min(return_bytes(ini_get('upload_max_filesize')), return_bytes(ini_get('post_max_size')));
//max allowed from php.ini
}
示例15: ajaxResponse
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
{
// list of valid extensions, ex. array("jpeg", "xml", "bmp")
// var_dump($this->params);
// die;
$allowedExtensions = array();
// max file size in bytes
$sizeLimit = return_bytes(ini_get('post_max_size'));
$destId = $_REQUEST["destid"];
$destObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $destId);
$envid = $destObject->get_id();
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit, $envid);
$result = $uploader->handleUpload(PATH_TEMP);
// to pass data through iframe you will need to encode all html tags
echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
die;
//$ajaxResponseObject->setStatus("ok");
//return $ajaxResponseObject;
}