当前位置: 首页>>代码示例>>PHP>>正文


PHP ilUtil::escapeShellArg方法代码示例

本文整理汇总了PHP中ilUtil::escapeShellArg方法的典型用法代码示例。如果您正苦于以下问题:PHP ilUtil::escapeShellArg方法的具体用法?PHP ilUtil::escapeShellArg怎么用?PHP ilUtil::escapeShellArg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ilUtil的用法示例。


在下文中一共展示了ilUtil::escapeShellArg方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderImages

 /**
  * Renders the specified object into images.
  * The images do not need to be of the preview image size.
  * 
  * @param ilObjFile $obj The object to create images from.
  * @return array An array of ilRenderedImage containing the absolute file paths to the images.
  */
 protected function renderImages($obj)
 {
     $numOfPreviews = $this->getMaximumNumberOfPreviews();
     // get file path
     $filepath = $obj->getFile();
     $inputFile = $this->prepareFileForExec($filepath);
     // create a temporary file name and remove its extension
     $output = str_replace(".tmp", "", ilUtil::ilTempnam());
     // use '#' instead of '%' as it gets replaced by 'escapeShellArg' on windows!
     $outputFile = $output . "_#02d.png";
     // create images with ghostscript (we use PNG here as it has better transparency quality)
     // gswin32c -dBATCH -dNOPAUSE -dSAFER -dFirstPage=1 -dLastPage=5 -sDEVICE=pngalpha -dEPSCrop -r72 -o $outputFile $inputFile
     // gswin32c -dBATCH -dNOPAUSE -dSAFER -dFirstPage=1 -dLastPage=5 -sDEVICE=jpeg -dJPEGQ=90 -r72 -o $outputFile $inputFile
     $args = sprintf("-dBATCH -dNOPAUSE -dSAFER -dFirstPage=1 -dLastPage=%d -sDEVICE=pngalpha -dEPSCrop -r72 -o %s %s", $numOfPreviews, str_replace("#", "%", ilUtil::escapeShellArg($outputFile)), ilUtil::escapeShellArg($inputFile));
     ilUtil::execQuoted(PATH_TO_GHOSTSCRIPT, $args);
     // was a temporary file created? then delete it
     if ($filepath != $inputFile) {
         @unlink($inputFile);
     }
     // check each file and add it
     $images = array();
     $outputFile = str_replace("#", "%", $outputFile);
     for ($i = 1; $i <= $numOfPreviews; $i++) {
         $imagePath = sprintf($outputFile, $i);
         if (!file_exists($imagePath)) {
             break;
         }
         $images[] = new ilRenderedImage($imagePath);
     }
     return $images;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:38,代码来源:class.ilGhostscriptRenderer.php

示例2: validateXML

 function validateXML($file)
 {
     exec(ilUtil::getJavaPath() . " -jar " . ilUtil::escapeShellArg(ILIAS_ABSOLUTE_PATH . "/Modules/ScormAicc/validation/vali.jar") . " " . ilUtil::escapeShellArg($file) . " 2>&1", $error);
     if (count($error) != 0) {
         $this->summary[] = "";
         $this->summary[] = "<b>File: {$file}</b>";
         foreach ($error as $line) {
             $this->summary[] = $line;
             //echo "<br><b>".$line."</b>";
         }
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:12,代码来源:class.ilObjSCORMValidator.php

示例3: downloadAllDeliveredFiles

 /**
  * Download all submitted files of an assignment (all user)
  *
  * @param	$members		array of user names, key is user id
  */
 function downloadAllDeliveredFiles($a_eph_id, $a_ass_id, $members)
 {
     global $lng, $ilObjDataCache, $ilias;
     include_once "./Services/Utilities/classes/class.ilUtil.php";
     include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilFSStorageEphorus.php";
     $storage = new ilFSStorageEphorus($a_eph_id, $a_ass_id);
     $storage->create();
     ksort($members);
     //$savepath = $this->getEphorusPath() . "/" . $this->obj_id . "/";
     $savepath = $storage->getAbsoluteSubmissionPath();
     $cdir = getcwd();
     // important check: if the directory does not exist
     // ILIAS stays in the current directory (echoing only a warning)
     // and the zip command below archives the whole ILIAS directory
     // (including the data directory) and sends a mega file to the user :-o
     if (!is_dir($savepath)) {
         return;
     }
     // Safe mode fix
     //		chdir($this->getEphorusPath());
     chdir($storage->getTempPath());
     $zip = PATH_TO_ZIP;
     // check first, if we have enough free disk space to copy all files to temporary directory
     $tmpdir = ilUtil::ilTempnam();
     ilUtil::makeDir($tmpdir);
     chdir($tmpdir);
     $dirsize = 0;
     foreach ($members as $id => $object) {
         $directory = $savepath . DIRECTORY_SEPARATOR . $id;
         $dirsize += ilUtil::dirsize($directory);
     }
     if ($dirsize > disk_free_space($tmpdir)) {
         return -1;
     }
     // copy all member directories to the temporary folder
     // switch from id to member name and append the login if the member name is double
     // ensure that no illegal filenames will be created
     // remove timestamp from filename
     $cache = array();
     foreach ($members as $id => $user) {
         $sourcedir = $savepath . DIRECTORY_SEPARATOR . $id;
         if (!is_dir($sourcedir)) {
             continue;
         }
         $userName = ilObjUser::_lookupName($id);
         $directory = ilUtil::getASCIIFilename(trim($userName["lastname"]) . "_" . trim($userName["firstname"]));
         if (array_key_exists($directory, $cache)) {
             // first try is to append the login;
             $directory = ilUtil::getASCIIFilename($directory . "_" . trim(ilObjUser::_lookupLogin($id)));
             if (array_key_exists($directory, $cache)) {
                 // second and secure: append the user id as well.
                 $directory .= "_" . $id;
             }
         }
         $cache[$directory] = $directory;
         ilUtil::makeDir($directory);
         $sourcefiles = scandir($sourcedir);
         foreach ($sourcefiles as $sourcefile) {
             if ($sourcefile == "." || $sourcefile == "..") {
                 continue;
             }
             $targetfile = trim(basename($sourcefile));
             $pos = strpos($targetfile, "_");
             if ($pos === false) {
             } else {
                 $targetfile = substr($targetfile, $pos + 1);
             }
             $targetfile = $directory . DIRECTORY_SEPARATOR . $targetfile;
             $sourcefile = $sourcedir . DIRECTORY_SEPARATOR . $sourcefile;
             if (!copy($sourcefile, $targetfile)) {
                 //echo 'Could not copy '.$sourcefile.' to '.$targetfile;
                 $ilias->raiseError('Could not copy ' . basename($sourcefile) . " to '" . $targetfile . "'.", $ilias->error_obj->MESSAGE);
             } else {
                 // preserve time stamp
                 touch($targetfile, filectime($sourcefile));
             }
         }
     }
     $tmpfile = ilUtil::ilTempnam();
     $tmpzipfile = $tmpfile . ".zip";
     // Safe mode fix
     $zipcmd = $zip . " -r " . ilUtil::escapeShellArg($tmpzipfile) . " .";
     exec($zipcmd);
     ilUtil::delDir($tmpdir);
     $assTitle = ilEphAssignment::lookupTitle($a_ass_id);
     chdir($cdir);
     ilUtil::deliverFile($tmpzipfile, (strlen($assTitle) == 0 ? strtolower($lng->txt("rep_robj_xeph_ephorus_assignment")) : $assTitle) . ".zip", "", false, true);
 }
开发者ID:jmcgettrick,项目名称:ilias-ephorus,代码行数:93,代码来源:class.ilEphAssignment.php

示例4: uploadImage

 /**
  * Upload new image file
  * 
  * @param array $a_upload
  * @return bool
  */
 function uploadImage(array $a_upload)
 {
     if (!$this->id) {
         return false;
     }
     $this->deleteImage();
     // #10074
     $clean_name = preg_replace("/[^a-zA-Z0-9\\_\\.\\-]/", "", $a_upload["name"]);
     $path = $this->initStorage($this->id);
     $original = "org_" . $this->id . "_" . $clean_name;
     $thumb = "thb_" . $this->id . "_" . $clean_name;
     $processed = $this->id . "_" . $clean_name;
     if (@move_uploaded_file($a_upload["tmp_name"], $path . $original)) {
         chmod($path . $original, 0770);
         $blga_set = new ilSetting("blga");
         $dimensions = $blga_set->get("banner_width") . "x" . $blga_set->get("banner_height");
         // take quality 100 to avoid jpeg artefacts when uploading jpeg files
         // taking only frame [0] to avoid problems with animated gifs
         $original_file = ilUtil::escapeShellArg($path . $original);
         $thumb_file = ilUtil::escapeShellArg($path . $thumb);
         $processed_file = ilUtil::escapeShellArg($path . $processed);
         ilUtil::execConvert($original_file . "[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
         ilUtil::execConvert($original_file . "[0] -geometry " . $dimensions . "! -quality 100 JPEG:" . $processed_file);
         $this->setImage($processed);
         return true;
     }
     return false;
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:34,代码来源:class.ilObjBlog.php

示例5: generatePreviewPic

 /**
  * Upload video preview picture
  *
  * @param
  * @return
  */
 function generatePreviewPic($a_width, $a_height)
 {
     $item = $this->getMediaItem("Standard");
     if ($item->getLocationType() == "LocalFile" && is_int(strpos($item->getFormat(), "image/"))) {
         $dir = ilObjMediaObject::_getDirectory($this->getId());
         $file = $dir . "/" . $item->getLocation();
         if (is_file($file)) {
             if (ilUtil::isConvertVersionAtLeast("6.3.8-3")) {
                 ilUtil::execConvert(ilUtil::escapeShellArg($file) . "[0] -geometry " . $a_width . "x" . $a_height . "^ -gravity center -extent " . $a_width . "x" . $a_height . " PNG:" . $dir . "/mob_vpreview.png");
             } else {
                 ilUtil::convertImage($file, $dir . "/mob_vpreview.png", "PNG", $a_width . "x" . $a_height);
             }
         }
     }
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:21,代码来源:class.ilObjMediaObject.php

示例6: unzip

 /**
  * unzip file
  *
  * @param	string	$a_file		full path/filename
  * @param	boolean	$overwrite	pass true to overwrite existing files
  */
 function unzip($a_file, $overwrite = false)
 {
     //global $ilias;
     $pathinfo = pathinfo($a_file);
     $dir = $pathinfo["dirname"];
     $file = $pathinfo["basename"];
     // unzip
     $cdir = getcwd();
     chdir($dir);
     $unzip = $this->ini->readVariable("tools", "unzip");
     $unzipcmd = $unzip . " -Z -1 " . ilUtil::escapeShellArg($file);
     exec($unzipcmd, $arr);
     $zdirs = array();
     foreach ($arr as $line) {
         if (is_int(strpos($line, "/"))) {
             $zdir = substr($line, 0, strrpos($line, "/"));
             $nr = substr_count($zdir, "/");
             //echo $zdir." ".$nr."<br>";
             while ($zdir != "") {
                 $nr = substr_count($zdir, "/");
                 $zdirs[$zdir] = $nr;
                 // collect directories
                 //echo $dir." ".$nr."<br>";
                 $zdir = substr($zdir, 0, strrpos($zdir, "/"));
             }
         }
     }
     asort($zdirs);
     foreach ($zdirs as $zdir => $nr) {
         ilUtil::createDirectory($zdir);
     }
     // real unzip
     if ($overvwrite) {
         $unzipcmd = $unzip . " " . ilUtil::escapeShellArg($file);
     } else {
         $unzipcmd = $unzip . " -o " . ilUtil::escapeShellArg($file);
     }
     exec($unzipcmd);
     chdir($cdir);
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:46,代码来源:class.ilSetup.php

示例7: uploadImage

 /**
  * Upload new image file
  * 
  * @param array $a_upload
  * @return bool
  */
 function uploadImage(array $a_upload, $a_clone = false)
 {
     if (!$this->id) {
         return false;
     }
     $this->deleteImage();
     // #10074
     $clean_name = preg_replace("/[^a-zA-Z0-9\\_\\.\\-]/", "", $a_upload["name"]);
     $path = $this->initStorage($this->id);
     $original = "org_" . $this->id . "_" . $clean_name;
     $thumb = "thb_" . $this->id . "_" . $clean_name;
     $processed = $this->id . "_" . $clean_name;
     $success = false;
     if (!$a_clone) {
         $success = @move_uploaded_file($a_upload["tmp_name"], $path . $original);
     } else {
         $success = @copy($a_upload["tmp_name"], $path . $original);
     }
     if ($success) {
         chmod($path . $original, 0770);
         // take quality 100 to avoid jpeg artefacts when uploading jpeg files
         // taking only frame [0] to avoid problems with animated gifs
         $original_file = ilUtil::escapeShellArg($path . $original);
         $thumb_file = ilUtil::escapeShellArg($path . $thumb);
         $processed_file = ilUtil::escapeShellArg($path . $processed);
         ilUtil::execConvert($original_file . "[0] -geometry \"100x100>\" -quality 100 PNG:" . $thumb_file);
         ilUtil::execConvert($original_file . "[0] -geometry \"" . self::getImageSize() . ">\" -quality 100 PNG:" . $processed_file);
         $this->setImage($processed);
         return true;
     }
     return false;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:38,代码来源:class.ilObjPoll.php

示例8: newModuleVersionUpload

 function newModuleVersionUpload()
 {
     global $_FILES, $rbacsystem;
     $unzip = PATH_TO_UNZIP;
     $tocheck = "imsmanifest.xml";
     include_once 'Services/FileSystem/classes/class.ilUploadFiles.php';
     // check create permission before because the uploaded file will be copied
     if (!$rbacsystem->checkAccess("write", $_GET["ref_id"])) {
         $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->WARNING);
     } elseif ($_FILES["scormfile"]["name"]) {
         // check if file was uploaded
         $source = $_FILES["scormfile"]["tmp_name"];
         if ($source == 'none' || !$source) {
             ilUtil::sendInfo($this->lng->txt("upload_error_file_not_found"), true);
             $this->newModuleVersion();
             return;
         }
     } elseif ($_POST["uploaded_file"]) {
         // check if the file is in the ftp directory and readable
         if (!ilUploadFiles::_checkUploadFile($_POST["uploaded_file"])) {
             $this->ilias->raiseError($this->lng->txt("upload_error_file_not_found"), $this->ilias->error_obj->MESSAGE);
         }
         // copy the uploaded file to the client web dir to analyze the imsmanifest
         // the copy will be moved to the lm directory or deleted
         $source = CLIENT_WEB_DIR . "/" . $_POST["uploaded_file"];
         ilUploadFiles::_copyUploadFile($_POST["uploaded_file"], $source);
         $source_is_copy = true;
     } else {
         ilUtil::sendInfo($this->lng->txt("upload_error_file_not_found"), true);
         $this->newModuleVersion();
         return;
     }
     // fim.
     //unzip the imsmanifest-file from new uploaded file
     $pathinfo = pathinfo($source);
     $dir = $pathinfo["dirname"];
     $file = $pathinfo["basename"];
     $cdir = getcwd();
     chdir($dir);
     //we need more flexible unzip here than ILIAS standard classes allow
     $unzipcmd = $unzip . " -o " . ilUtil::escapeShellArg($source) . " " . $tocheck;
     exec($unzipcmd);
     chdir($cdir);
     $tmp_file = $dir . "/" . $tocheck . "." . $_GET["ref_id"];
     rename($dir . "/" . $tocheck, $tmp_file);
     $new_manifest = file_get_contents($tmp_file);
     //remove temp file
     unlink($tmp_file);
     //get old manifest file
     $old_manifest = file_get_contents($this->object->getDataDirectory() . "/" . $tocheck);
     //reload fixed version of file
     $check = '/xmlns="http:\\/\\/www.imsglobal.org\\/xsd\\/imscp_v1p1"/';
     $replace = "xmlns=\"http://www.imsproject.org/xsd/imscp_rootv1p1p2\"";
     $reload_manifest = preg_replace($check, $replace, $new_manifest);
     //do testing for converted versions as well as earlier ILIAS version messed up utf8 conversion
     if (strcmp($new_manifest, $old_manifest) == 0 || strcmp(utf8_encode($new_manifest), $old_manifest) == 0 || strcmp($reload_manifest, $old_manifest) == 0 || strcmp(utf8_encode($reload_manifest), $old_manifest) == 0) {
         //get exisiting module version
         $module_version = $this->object->getModuleVersion();
         if ($_FILES["scormfile"]["name"]) {
             //build targetdir in lm_data
             $file_path = $this->object->getDataDirectory() . "/" . $_FILES["scormfile"]["name"] . "." . $module_version;
             //move to data directory and add subfix for versioning
             ilUtil::moveUploadedFile($_FILES["scormfile"]["tmp_name"], $_FILES["scormfile"]["name"], $file_path);
         } else {
             //build targetdir in lm_data
             $file_path = $this->object->getDataDirectory() . "/" . $_POST["uploaded_file"] . "." . $module_version;
             // move the already copied file to the lm_data directory
             rename($source, $file_path);
         }
         //unzip and replace old extracted files
         ilUtil::unzip($file_path, true);
         ilUtil::renameExecutables($this->object->getDataDirectory());
         //(security)
         //increase module version
         $this->object->setModuleVersion($module_version + 1);
         $this->object->update();
         //redirect to properties and display success
         ilUtil::sendInfo($this->lng->txt("cont_new_module_added"), true);
         ilUtil::redirect("ilias.php?baseClass=ilSAHSEditGUI&ref_id=" . $_GET["ref_id"]);
         exit;
     } else {
         if ($source_is_copy) {
             unlink($source);
         }
         ilUtil::sendInfo($this->lng->txt("cont_invalid_new_module"), true);
         $this->newModuleVersion();
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:88,代码来源:class.ilObjSCORMLearningModuleGUI.php

示例9: uploadUserPicture

 /**
  * Upload user image
  */
 function uploadUserPicture()
 {
     global $ilUser;
     if ($this->workWithUserSetting("upload")) {
         if (!$this->form->hasFileUpload("userfile")) {
             if ($this->form->getItemByPostVar("userfile")->getDeletionFlag()) {
                 $ilUser->removeUserPicture();
             }
             return;
         } else {
             $webspace_dir = ilUtil::getWebspaceDir();
             $image_dir = $webspace_dir . "/usr_images";
             $store_file = "usr_" . $ilUser->getID() . "." . "jpg";
             // store filename
             $ilUser->setPref("profile_image", $store_file);
             $ilUser->update();
             // move uploaded file
             $uploaded_file = $this->form->moveFileUpload($image_dir, "userfile", "upload_" . $ilUser->getId() . "pic");
             if (!$uploaded_file) {
                 ilUtil::sendFailure($this->lng->txt("upload_error", true));
                 $this->ctrl->redirect($this, "showProfile");
             }
             chmod($uploaded_file, 0770);
             // take quality 100 to avoid jpeg artefacts when uploading jpeg files
             // taking only frame [0] to avoid problems with animated gifs
             $show_file = "{$image_dir}/usr_" . $ilUser->getId() . ".jpg";
             $thumb_file = "{$image_dir}/usr_" . $ilUser->getId() . "_small.jpg";
             $xthumb_file = "{$image_dir}/usr_" . $ilUser->getId() . "_xsmall.jpg";
             $xxthumb_file = "{$image_dir}/usr_" . $ilUser->getId() . "_xxsmall.jpg";
             $uploaded_file = ilUtil::escapeShellArg($uploaded_file);
             $show_file = ilUtil::escapeShellArg($show_file);
             $thumb_file = ilUtil::escapeShellArg($thumb_file);
             $xthumb_file = ilUtil::escapeShellArg($xthumb_file);
             $xxthumb_file = ilUtil::escapeShellArg($xxthumb_file);
             if (ilUtil::isConvertVersionAtLeast("6.3.8-3")) {
                 ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200^ -gravity center -extent 200x200 -quality 100 JPEG:" . $show_file);
                 ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100^ -gravity center -extent 100x100 -quality 100 JPEG:" . $thumb_file);
                 ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75^ -gravity center -extent 75x75 -quality 100 JPEG:" . $xthumb_file);
                 ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30^ -gravity center -extent 30x30 -quality 100 JPEG:" . $xxthumb_file);
             } else {
                 ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200 -quality 100 JPEG:" . $show_file);
                 ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
                 ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75 -quality 100 JPEG:" . $xthumb_file);
                 ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30 -quality 100 JPEG:" . $xxthumb_file);
             }
         }
     }
     //		$this->saveProfile();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:52,代码来源:class.ilPersonalProfileGUI.php

示例10: htmlfile2pdf

 /**
  *	produce pdf out of html with htmldoc
  *   @param  html    String  HTML-Data given to create pdf-file
  *   @param  pdf_file    String  Filename to save pdf in
  * @static
  */
 public static function htmlfile2pdf($html_file, $pdf_file)
 {
     $htmldoc_path = PATH_TO_HTMLDOC;
     $htmldoc = "--no-toc ";
     $htmldoc .= "--no-jpeg ";
     $htmldoc .= "--webpage ";
     $htmldoc .= "--outfile " . ilUtil::escapeShellArg($pdf_file) . " ";
     $htmldoc .= "--bodyfont Arial ";
     $htmldoc .= "--charset iso-8859-15 ";
     $htmldoc .= "--color ";
     $htmldoc .= "--size A4  ";
     // --landscape
     $htmldoc .= "--format pdf ";
     $htmldoc .= "--footer ... ";
     $htmldoc .= "--header ... ";
     $htmldoc .= "--left 60 ";
     // $htmldoc .= "--right 200 ";
     $htmldoc .= $html_file;
     ilUtil::execQuoted($htmldoc_path, $htmldoc);
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:26,代码来源:class.ilUtil.php

示例11: extractImage

 /**
  * Extract image from video file
  *
  * @param string $a_file source file (full path included)
  * @param string $a_target_dir target directory (no trailing "/")
  * @param string $a_target_filename target file name (no path!)
  *
  * @return string new file (full path)
  */
 static function extractImage($a_file, $a_target_filename, $a_target_dir = "", $a_sec = 1)
 {
     //echo "-$a_file-$a_target_filename-$a_target_dir-$a_sec-<br>";
     $spi = pathinfo($a_file);
     // use source directory if no target directory is passed
     $target_dir = $a_target_dir != "" ? $a_target_dir : $spi['dirname'];
     $target_file = $target_dir . "/" . $a_target_filename;
     $sec = (int) $a_sec;
     $cmd = "-y -i " . ilUtil::escapeShellArg($a_file) . " -r 1 -f image2 -vframes 1 -ss " . $sec . " " . ilUtil::escapeShellArg($target_file);
     //echo "-$cmd-"; exit;
     $ret = self::exec($cmd . " 2>&1");
     self::$last_return = $ret;
     if (is_file($target_file)) {
         return $target_file;
     } else {
         include_once "./Services/MediaObjects/exceptions/class.ilFFmpegException.php";
         throw new ilFFmpegException("It was not possible to extract an image from " . basename($a_file) . ".");
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:28,代码来源:class.ilFFmpeg.php

示例12: saveIcons

 /**
  * save container icons
  */
 function saveIcons($a_big_icon, $a_small_icon, $a_tiny_icon)
 {
     global $ilDB;
     $this->createContainerDirectory();
     $cont_dir = $this->getContainerDirectory();
     // save big icon
     $big_geom = $this->ilias->getSetting("custom_icon_big_width") . "x" . $this->ilias->getSetting("custom_icon_big_height");
     $big_file_name = $cont_dir . "/icon_big.png";
     if (is_file($a_big_icon)) {
         $a_big_icon = ilUtil::escapeShellArg($a_big_icon);
         $big_file_name = ilUtil::escapeShellArg($big_file_name);
         ilUtil::execConvert($a_big_icon . "[0] -geometry " . $big_geom . " PNG:" . $big_file_name);
     }
     if (is_file($cont_dir . "/icon_big.png")) {
         ilContainer::_writeContainerSetting($this->getId(), "icon_big", 1);
     } else {
         ilContainer::_writeContainerSetting($this->getId(), "icon_big", 0);
     }
     // save small icon
     $small_geom = $this->ilias->getSetting("custom_icon_small_width") . "x" . $this->ilias->getSetting("custom_icon_small_height");
     $small_file_name = $cont_dir . "/icon_small.png";
     if (is_file($a_small_icon)) {
         $a_small_icon = ilUtil::escapeShellArg($a_small_icon);
         $small_file_name = ilUtil::escapeShellArg($small_file_name);
         ilUtil::execConvert($a_small_icon . "[0] -geometry " . $small_geom . " PNG:" . $small_file_name);
     }
     if (is_file($cont_dir . "/icon_small.png")) {
         ilContainer::_writeContainerSetting($this->getId(), "icon_small", 1);
     } else {
         ilContainer::_writeContainerSetting($this->getId(), "icon_small", 0);
     }
     // save tiny icon
     $tiny_geom = $this->ilias->getSetting("custom_icon_tiny_width") . "x" . $this->ilias->getSetting("custom_icon_tiny_height");
     $tiny_file_name = $cont_dir . "/icon_tiny.png";
     if (is_file($a_tiny_icon)) {
         $a_tiny_icon = ilUtil::escapeShellArg($a_tiny_icon);
         $tiny_file_name = ilUtil::escapeShellArg($tiny_file_name);
         ilUtil::execConvert($a_tiny_icon . "[0] -geometry " . $tiny_geom . " PNG:" . $tiny_file_name);
     }
     if (is_file($cont_dir . "/icon_tiny.png")) {
         ilContainer::_writeContainerSetting($this->getId(), "icon_tiny", 1);
     } else {
         ilContainer::_writeContainerSetting($this->getId(), "icon_tiny", 0);
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:48,代码来源:class.ilContainer.php

示例13: createPreviewImage

 /**
  * Creates a preview image path from the specified source image.
  * 
  * @param string $src_img_path The source image path.
  * @param string $dest_img_path The destination image path.
  * @return bool true, if the preview was created; otherwise, false.
  */
 private function createPreviewImage($src_img_path, $dest_img_path)
 {
     // create resize argument
     $imgSize = $this->getImageSize();
     $resizeArg = $imgSize . "x" . $imgSize . (ilUtil::isWindows() ? "^" : "\\") . ">";
     // cmd: convert $src_img_path -background white -flatten -resize 280x280 -quality 85 -sharpen 0x0.5 $dest_img_path
     $args = sprintf("%s -background white -flatten -resize %s -quality %d -sharpen 0x0.5 %s", ilUtil::escapeShellArg($src_img_path), $resizeArg, $this->getImageQuality(), ilUtil::escapeShellArg($dest_img_path));
     ilUtil::execConvert($args);
     return is_file($dest_img_path);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:17,代码来源:class.ilPreviewRenderer.php

示例14: getXMLZip

 function getXMLZip()
 {
     global $ilias;
     $zip = PATH_TO_ZIP;
     exec($zip . ' ' . ilUtil::escapeShellArg($this->getDirectory() . '/' . $this->getFileName()) . " " . ilUtil::escapeShellArg($this->getDirectory() . '/' . '1.zip'));
     return $this->getDirectory() . '/1.zip';
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:7,代码来源:class.ilObjFile.php

示例15: uploadUserPictureObject

 /**
  * upload user image
  *
  * (original method by ratana ty)
  */
 function uploadUserPictureObject()
 {
     global $ilUser, $rbacsystem;
     // User folder
     if ($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read', $this->usrf_ref_id)) {
         $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
     }
     // if called from local administration $this->usrf_ref_id is category id
     // Todo: this has to be fixed. Do not mix user folder id and category id
     if ($this->usrf_ref_id != USER_FOLDER_ID) {
         // check if user is assigned to category
         if (!$rbacsystem->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
             $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
         }
     }
     $userfile_input = $this->form_gui->getItemByPostVar("userfile");
     if ($_FILES["userfile"]["tmp_name"] == "") {
         if ($userfile_input->getDeletionFlag()) {
             $this->object->removeUserPicture();
         }
         return;
     }
     if ($_FILES["userfile"]["size"] == 0) {
         ilUtil::sendFailure($this->lng->txt("msg_no_file"));
     } else {
         $webspace_dir = ilUtil::getWebspaceDir();
         $image_dir = $webspace_dir . "/usr_images";
         $store_file = "usr_" . $this->object->getId() . "." . "jpg";
         // store filename
         $this->object->setPref("profile_image", $store_file);
         $this->object->update();
         // move uploaded file
         $uploaded_file = $image_dir . "/upload_" . $this->object->getId() . "pic";
         if (!ilUtil::moveUploadedFile($_FILES["userfile"]["tmp_name"], $_FILES["userfile"]["name"], $uploaded_file, false)) {
             ilUtil::sendFailure($this->lng->txt("upload_error", true));
             $this->ctrl->redirect($this, "showProfile");
         }
         chmod($uploaded_file, 0770);
         // take quality 100 to avoid jpeg artefacts when uploading jpeg files
         // taking only frame [0] to avoid problems with animated gifs
         $show_file = "{$image_dir}/usr_" . $this->object->getId() . ".jpg";
         $thumb_file = "{$image_dir}/usr_" . $this->object->getId() . "_small.jpg";
         $xthumb_file = "{$image_dir}/usr_" . $this->object->getId() . "_xsmall.jpg";
         $xxthumb_file = "{$image_dir}/usr_" . $this->object->getId() . "_xxsmall.jpg";
         $uploaded_file = ilUtil::escapeShellArg($uploaded_file);
         $show_file = ilUtil::escapeShellArg($show_file);
         $thumb_file = ilUtil::escapeShellArg($thumb_file);
         $xthumb_file = ilUtil::escapeShellArg($xthumb_file);
         $xxthumb_file = ilUtil::escapeShellArg($xxthumb_file);
         if (ilUtil::isConvertVersionAtLeast("6.3.8-3")) {
             ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200^ -gravity center -extent 200x200 -quality 100 JPEG:" . $show_file);
             ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100^ -gravity center -extent 100x100 -quality 100 JPEG:" . $thumb_file);
             ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75^ -gravity center -extent 75x75 -quality 100 JPEG:" . $xthumb_file);
             ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30^ -gravity center -extent 30x30 -quality 100 JPEG:" . $xxthumb_file);
         } else {
             ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200 -quality 100 JPEG:" . $show_file);
             ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
             ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75 -quality 100 JPEG:" . $xthumb_file);
             ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30 -quality 100 JPEG:" . $xxthumb_file);
         }
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:67,代码来源:class.ilObjUserGUI.php


注:本文中的ilUtil::escapeShellArg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。