function upload_artica_perform() { usleep(300); writelogs("upload_form_perform() -> OK {$_GET['qqfile']}", __FUNCTION__, __FILE__, __LINE__); $sock = new sockets(); $sock->getFrameWork("services.php?lighttpd-own=yes"); if (isset($_GET['qqfile'])) { $fileName = $_GET['qqfile']; if (function_exists("apache_request_headers")) { $headers = apache_request_headers(); if ((int) $headers['Content-Length'] == 0) { writelogs("content length is zero", __FUNCTION__, __FILE__, __LINE__); die('{error: "content length is zero"}'); } } else { writelogs("apache_request_headers() no such function", __FUNCTION__, __FILE__, __LINE__); } } elseif (isset($_FILES['qqfile'])) { $fileName = basename($_FILES['qqfile']['name']); writelogs("_FILES['qqfile']['name'] = {$fileName}", __FUNCTION__, __FILE__, __LINE__); if ($_FILES['qqfile']['size'] == 0) { writelogs("file size is zero", __FUNCTION__, __FILE__, __LINE__); die('{error: "file size is zero"}'); } } else { writelogs("file not passed", __FUNCTION__, __FILE__, __LINE__); die('{error: "file not passed"}'); } writelogs("upload_form_perform() -> OK {$_GET['qqfile']}", __FUNCTION__, __FILE__, __LINE__); if (count($_GET)) { $datas = json_encode(array_merge($_GET, array('fileName' => $fileName))); writelogs($datas, __FUNCTION__, __FILE__, __LINE__); } else { writelogs("query params not passed", __FUNCTION__, __FILE__, __LINE__); die('{error: "query params not passed"}'); } writelogs("upload_form_perform() -> OK {$_GET['qqfile']} upload_max_filesize=" . ini_get('upload_max_filesize') . " post_max_size:" . ini_get('post_max_size'), __FUNCTION__, __FILE__, __LINE__); include_once dirname(__FILE__) . "/ressources/class.file.upload.inc"; $allowedExtensions = array(); $sizeLimit = qqFileUploader::toBytes(ini_get('upload_max_filesize')); $sizeLimit2 = qqFileUploader::toBytes(ini_get('post_max_size')); if ($sizeLimit2 < $sizeLimit) { $sizeLimit = $sizeLimit2; } $content_dir = dirname(__FILE__) . "/ressources/conf/upload/"; $uploader = new qqFileUploader($allowedExtensions, $sizeLimit); $result = $uploader->handleUpload($content_dir); writelogs("upload_form_perform() -> OK", __FUNCTION__, __FILE__, __LINE__); if (is_file("{$content_dir}{$fileName}")) { writelogs("upload_form_perform() -> {$content_dir}{$fileName} OK", __FUNCTION__, __FILE__, __LINE__); $sock = new sockets(); echo htmlspecialchars(json_encode(array('success' => true)), ENT_NOQUOTES); return; } echo htmlspecialchars(json_encode($result), ENT_NOQUOTES); return; }
function upload_form_perform() { usleep(300); writelogs("upload_form_perform() -> OK {$_GET['qqfile']}", __FUNCTION__, __FILE__, __LINE__); $sock = new sockets(); $sock->getFrameWork("services.php?lighttpd-own=yes"); if (isset($_GET['qqfile'])) { $fileName = $_GET['qqfile']; if (function_exists("apache_request_headers")) { $headers = apache_request_headers(); if ((int) $headers['Content-Length'] == 0) { writelogs("content length is zero", __FUNCTION__, __FILE__, __LINE__); die('{error: "content length is zero"}'); } } else { writelogs("apache_request_headers() no such function", __FUNCTION__, __FILE__, __LINE__); } } elseif (isset($_FILES['qqfile'])) { $fileName = basename($_FILES['qqfile']['name']); writelogs("_FILES['qqfile']['name'] = {$fileName}", __FUNCTION__, __FILE__, __LINE__); if ($_FILES['qqfile']['size'] == 0) { writelogs("file size is zero", __FUNCTION__, __FILE__, __LINE__); die('{error: "file size is zero"}'); } } else { writelogs("file not passed", __FUNCTION__, __FILE__, __LINE__); die('{error: "file not passed"}'); } writelogs("upload_form_perform() -> OK {$_GET['qqfile']}", __FUNCTION__, __FILE__, __LINE__); if (count($_GET)) { $datas = json_encode(array_merge($_GET, array('fileName' => $fileName))); writelogs($datas, __FUNCTION__, __FILE__, __LINE__); } else { writelogs("query params not passed", __FUNCTION__, __FILE__, __LINE__); die('{error: "query params not passed"}'); } writelogs("upload_form_perform() -> OK {$_GET['qqfile']} upload_max_filesize=" . ini_get('upload_max_filesize') . " post_max_size:" . ini_get('post_max_size'), __FUNCTION__, __FILE__, __LINE__); include_once dirname(__FILE__) . "/ressources/class.file.upload.inc"; $allowedExtensions = array(); $sizeLimit = qqFileUploader::toBytes(ini_get('upload_max_filesize')); $sizeLimit2 = qqFileUploader::toBytes(ini_get('post_max_size')); if ($sizeLimit2 < $sizeLimit) { $sizeLimit = $sizeLimit2; } $content_dir = dirname(__FILE__) . "/ressources/conf/upload/"; $uploader = new qqFileUploader($allowedExtensions, $sizeLimit); $result = $uploader->handleUpload($content_dir); writelogs("upload_form_perform() -> OK {$resultTXT}", __FUNCTION__, __FILE__, __LINE__); $TargetpathUploaded = base64_decode($_GET["TargetpathUploaded"]); if (!is_file("{$content_dir}{$fileName}")) { die("{error: \"{$content_dir}{$fileName} no such file \"}"); } $user = new user($_SESSION["uid"]); $jpegPhoto_datas = file_get_contents("{$content_dir}{$fileName}"); $user->add_user(); writelogs("PHOTO: Edit: " . strlen($jpegPhoto_datas) . " bytes", __FUNCTION__, __FILE__, __LINE__); if (!$user->SaveUserPhoto($jpegPhoto_datas)) { die("{error: \"{$user->ldap_error}\"}"); } if (is_file($user->thumbnail_path)) { unlink($user->thumbnail_path); } $user->draw_jpeg_photos("{$content_dir}{$fileName}"); echo htmlspecialchars(json_encode($result), ENT_NOQUOTES); return; }
// ELIS-4982 -- If FTP is enabled, check that the port is set correctly if ($config->file_transfer_method == ELIS_FILES_XFER_FTP) { // Attempt to make a connection to the FTP server $uri = parse_url($config->server_host); if (ftp_connect($uri['host'], $config->ftp_port, 5) === false) { return array('error' => get_string('errorftpinvalidport', 'repository_elisfiles', $uri['host'].':'.$config->ftp_port)); } } // Unknown error occurred return array('error' => get_string('errorupload', 'repository_elisfiles')); } } } // list of valid extensions, ex. array("jpeg", "xml", "bmp") $allowedExtensions = array(); // leave empty to allow all for now // set max file size in bytes to match system setting $sizeLimit = qqFileUploader::toBytes(ini_get('upload_max_filesize')); $uploader = new qqFileUploader($allowedExtensions, $sizeLimit); $result = $uploader->handleUpload($CFG->dataroot.'/temp/'); // to pass data through iframe you will need to encode all html tags echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
function upload_form_perform() { usleep(300); writelogs("upload_form_perform() -> OK {$_GET['qqfile']}", __FUNCTION__, __FILE__, __LINE__); $sock = new sockets(); $sock->getFrameWork("services.php?lighttpd-own=yes"); if (isset($_GET['qqfile'])) { $fileName = $_GET['qqfile']; if (function_exists("apache_request_headers")) { $headers = apache_request_headers(); if ((int) $headers['Content-Length'] == 0) { writelogs("content length is zero", __FUNCTION__, __FILE__, __LINE__); die('{error: "content length is zero"}'); } } else { writelogs("apache_request_headers() no such function", __FUNCTION__, __FILE__, __LINE__); } } elseif (isset($_FILES['qqfile'])) { $fileName = basename($_FILES['qqfile']['name']); writelogs("_FILES['qqfile']['name'] = {$fileName}", __FUNCTION__, __FILE__, __LINE__); if ($_FILES['qqfile']['size'] == 0) { writelogs("file size is zero", __FUNCTION__, __FILE__, __LINE__); die('{error: "file size is zero"}'); } } else { writelogs("file not passed", __FUNCTION__, __FILE__, __LINE__); die('{error: "file not passed"}'); } writelogs("upload_form_perform() -> OK {$_GET['qqfile']}", __FUNCTION__, __FILE__, __LINE__); if (count($_GET)) { $datas = json_encode(array_merge($_GET, array('fileName' => $fileName))); writelogs($datas, __FUNCTION__, __FILE__, __LINE__); } else { writelogs("query params not passed", __FUNCTION__, __FILE__, __LINE__); die('{error: "query params not passed"}'); } writelogs("upload_form_perform() -> OK {$_GET['qqfile']} upload_max_filesize=" . ini_get('upload_max_filesize') . " post_max_size:" . ini_get('post_max_size'), __FUNCTION__, __FILE__, __LINE__); include_once dirname(__FILE__) . "/ressources/class.file.upload.inc"; $allowedExtensions = array(); $sizeLimit = qqFileUploader::toBytes(ini_get('upload_max_filesize')); $sizeLimit2 = qqFileUploader::toBytes(ini_get('post_max_size')); if ($sizeLimit2 < $sizeLimit) { $sizeLimit = $sizeLimit2; } $content_dir = dirname(__FILE__) . "/ressources/conf/upload/"; $uploader = new qqFileUploader($allowedExtensions, $sizeLimit); $result = $uploader->handleUpload($content_dir); writelogs("upload_form_perform() -> OK {$resultTXT}", __FUNCTION__, __FILE__, __LINE__); $servername = $_GET["servername"]; $TargetpathUploaded = base64_decode($_GET["TargetpathUploaded"]); if (!is_file("{$content_dir}{$fileName}")) { die("{error: \"{$content_dir}{$fileName} no such file \"}"); } include_once dirname(__FILE__) . '/ressources/class.images.inc'; $base = "ressources/profiles/icons"; $uid = time(); $jpeg_filename = "{$content_dir}{$fileName}"; $jpegPhoto_datas = file_get_contents("{$content_dir}{$fileName}"); $image = new images($jpeg_filename); $jpeg_dimensions = @getimagesize($jpeg_filename); $img_type = array(1 => "gif", 2 => 'jpg', 3 => 'png', 4 => 'swf', 5 => 'psd', 6 => 'bmp', 7 => 'tiff', 8 => 'tiff', 9 => 'jpc', 10 => 'jp2', 11 => 'jpx'); $extension = "{$img_type[$jpeg_dimensions[2]]}"; $thumbnail_path = "{$base}/background-{$servername}.{$extension}"; if (!$image->thumbnail(393, 125, $thumbnail_path)) { die("{error: \"Create image error\"}"); } $tpl = new templates(); $thumbnail_data = @file_get_contents($thumbnail_path); $q = new mysql(); if (!$q->TABLE_EXISTS("freeweb_slashsquid", "artica_backup")) { $q->BuildTables(); } $sql = "SELECT servername FROM freeweb_slashsquid WHERE servername='{$servername}'"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); if ($ligne["servername"] != null) { $sql = "UPDATE freeweb_slashsquid SET logoname='" . basename($thumbnail_path) . "',\n\t\tlogoimg='" . mysql_escape_string2($thumbnail_data) . "' WHERE servername='{$servername}'"; } else { $sql = "INSERT INTO freeweb_slashsquid (logoname,logoimg,servername) \n\t\tVALUES ('" . basename($thumbnail_path) . "','" . mysql_escape_string2($thumbnail_data) . "','{$servername}')"; } $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { die("{error: \"" . $tpl->javascript_parse_text("{$q->mysql_error}") . "\"}"); } echo htmlspecialchars(json_encode($result), ENT_NOQUOTES); return; }
function upload_form_perform() { usleep(300); writelogs("upload_form_perform() -> OK {$_GET['qqfile']}", __FUNCTION__, __FILE__, __LINE__); $sock = new sockets(); $sock->getFrameWork("services.php?lighttpd-own=yes"); if (isset($_GET['qqfile'])) { $fileName = $_GET['qqfile']; if (function_exists("apache_request_headers")) { $headers = apache_request_headers(); if ((int) $headers['Content-Length'] == 0) { writelogs("content length is zero", __FUNCTION__, __FILE__, __LINE__); die('{error: "content length is zero"}'); } } else { writelogs("apache_request_headers() no such function", __FUNCTION__, __FILE__, __LINE__); } } elseif (isset($_FILES['qqfile'])) { $fileName = basename($_FILES['qqfile']['name']); writelogs("_FILES['qqfile']['name'] = {$fileName}", __FUNCTION__, __FILE__, __LINE__); if ($_FILES['qqfile']['size'] == 0) { writelogs("file size is zero", __FUNCTION__, __FILE__, __LINE__); die('{error: "file size is zero"}'); } } else { writelogs("file not passed", __FUNCTION__, __FILE__, __LINE__); die('{error: "file not passed"}'); } writelogs("upload_form_perform() -> OK {$_GET['qqfile']}", __FUNCTION__, __FILE__, __LINE__); if (count($_GET)) { $datas = json_encode(array_merge($_GET, array('fileName' => $fileName))); writelogs($datas, __FUNCTION__, __FILE__, __LINE__); } else { writelogs("query params not passed", __FUNCTION__, __FILE__, __LINE__); die('{error: "query params not passed"}'); } writelogs("upload_form_perform() -> OK {$_GET['qqfile']} upload_max_filesize=" . ini_get('upload_max_filesize') . " post_max_size:" . ini_get('post_max_size'), __FUNCTION__, __FILE__, __LINE__); include_once dirname(__FILE__) . "/ressources/class.file.upload.inc"; $allowedExtensions = array(); $sizeLimit = qqFileUploader::toBytes(ini_get('upload_max_filesize')); $sizeLimit2 = qqFileUploader::toBytes(ini_get('post_max_size')); if ($sizeLimit2 < $sizeLimit) { $sizeLimit = $sizeLimit2; } $content_dir = dirname(__FILE__) . "/ressources/conf/upload/"; $uploader = new qqFileUploader($allowedExtensions, $sizeLimit); $result = $uploader->handleUpload($content_dir); writelogs("upload_form_perform() -> OK {$resultTXT}", __FUNCTION__, __FILE__, __LINE__); $TargetpathUploaded = base64_decode($_GET["TargetpathUploaded"]); if (!is_file("{$content_dir}{$fileName}")) { die("{error: \"{$content_dir}{$fileName} no such file \"}"); } include_once dirname(__FILE__) . '/ressources/class.images.inc'; $uid = $_SESSION["uid"]; $base = "ressources/profiles/icons"; $user = new user($_SESSION["uid"]); $jpeg_filename = "{$content_dir}{$fileName}"; $jpegPhoto_datas = file_get_contents("{$content_dir}{$fileName}"); $image = new images($jpeg_filename); $jpeg_dimensions = @getimagesize($jpeg_filename); $img_type = array(1 => "gif", 2 => 'jpg', 3 => 'png', 4 => 'swf', 5 => 'psd', 6 => 'bmp', 7 => 'tiff', 8 => 'tiff', 9 => 'jpc', 10 => 'jp2', 11 => 'jpx'); $extension = "{$img_type[$jpeg_dimensions[2]]}"; $thumbnail_path = "{$base}/background-{$uid}.{$extension}"; if (!$image->thumbnail(851, 315, $thumbnail_path)) { die("{error: \"Create image error\"}"); } @file_put_contents("{$base}/background-{$uid}.loc", $thumbnail_path); echo htmlspecialchars(json_encode($result), ENT_NOQUOTES); return; }