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


PHP t3lib_div::fixPermissions方法代码示例

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


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

示例1: createAutoloadRegistryForExtension

 /**
  * Build the autoload registry for a given extension and place it ext_autoload.php.
  *
  * @param	string	$extensionName	Name of the extension
  * @param	string	$extensionPath	full path of the extension
  * @return	string	HTML string which should be outputted
  */
 public function createAutoloadRegistryForExtension($extensionName, $extensionPath)
 {
     $classNameToFileMapping = array();
     $globalPrefixes = array();
     $globalPrefixes[] = '$extensionPath = t3lib_extMgm::extPath(\'' . $extensionName . '\');';
     $this->buildAutoloadRegistryForSinglePath($classNameToFileMapping, $extensionPath, '.*tslib.*', '$extensionPath . \'|\'');
     // Processes special 'classes/' or 'Classes/' folder and use a shorter notation for that:
     // (files will be overridden in the class name to file mapping)
     $extensionClassesDirectory = $this->getExtensionClassesDirectory($extensionPath);
     if ($extensionClassesDirectory !== FALSE) {
         $globalPrefixes[] = '$extensionClassesPath = $extensionPath . \'' . $extensionClassesDirectory . '\';';
         $this->buildAutoloadRegistryForSinglePath($classNameToFileMapping, $extensionPath . $extensionClassesDirectory, '.*tslib.*', '$extensionClassesPath . \'|\'');
     }
     $extensionPrefix = $this->getExtensionPrefix($extensionName);
     $errors = array();
     foreach ($classNameToFileMapping as $className => $fileName) {
         if ($this->isValidClassNamePrefix($className, $extensionPrefix) === FALSE) {
             $errors[] = $className . ' does not start with Tx_' . $extensionPrefix . ', tx_' . $extensionPrefix . ' or user_' . $extensionPrefix . ' and is not added to the autoloader registry.';
             unset($classNameToFileMapping[$className]);
         }
     }
     $autoloadFileString = $this->generateAutoloadPHPFileDataForExtension($classNameToFileMapping, $globalPrefixes);
     if (@file_put_contents($extensionPath . 'ext_autoload.php', $autoloadFileString)) {
         t3lib_div::fixPermissions($extensionPath . 'ext_autoload.php');
         $errors[] = 'Wrote the following data: <pre>' . htmlspecialchars($autoloadFileString) . '</pre>';
     } else {
         $errors[] = '<b>' . $extensionPath . 'ext_autoload.php could not be written!</b>';
     }
     return implode('<br />', $errors);
 }
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:37,代码来源:class.tx_extdeveval_buildautoloadregistry.php

示例2: moveUploadedFiles

 /**
  * Moves uploaded files from temporary upload folder to a specified new folder.
  * This enables you to move the files from a successful submission to another folder and clean the files in temporary upload folder from time to time.
  *
  * TypoScript example:
  *
  * 1. Set the temporary upload folder
  * <code>
  * plugin.Tx_Formhandler.settings.files.tmpUploadFolder = uploads/formhandler/tmp
  * </code>
  *
  * 2. Set the folder to move the files to after submission
  * <code>
  * plugin.Tx_Formhandler.settings.finishers.1.class = Tx_Formhandler_Finisher_StoreUploadedFiles
  * plugin.Tx_Formhandler.settings.finishers.1.config.finishedUploadFolder = uploads/formhandler/finishedFiles/
  * plugin.Tx_Formhandler.settings.finishers.1.config.renameScheme = [filename]_[md5]_[time]
  * </code>
  *
  * @return void
  */
 protected function moveUploadedFiles()
 {
     $newFolder = $this->settings['finishedUploadFolder'];
     $newFolder = Tx_Formhandler_StaticFuncs::sanitizePath($newFolder);
     $uploadPath = Tx_Formhandler_StaticFuncs::getDocumentRoot() . $newFolder;
     $sessionFiles = Tx_Formhandler_Globals::$session->get('files');
     if (is_array($sessionFiles) && !empty($sessionFiles) && strlen($newFolder) > 0) {
         foreach ($sessionFiles as $field => $files) {
             $this->gp[$field] = array();
             foreach ($files as $key => $file) {
                 if ($file['uploaded_path'] != $uploadPath) {
                     $newFilename = $this->getNewFilename($file['uploaded_name']);
                     Tx_Formhandler_StaticFuncs::debugMessage('copy_file', array($file['uploaded_path'] . $file['uploaded_name'], $uploadPath . $newFilename));
                     copy($file['uploaded_path'] . $file['uploaded_name'], $uploadPath . $newFilename);
                     t3lib_div::fixPermissions($uploadPath . $newFilename);
                     unlink($file['uploaded_path'] . $file['uploaded_name']);
                     $sessionFiles[$field][$key]['uploaded_path'] = $uploadPath;
                     $sessionFiles[$field][$key]['uploaded_name'] = $newFilename;
                     $sessionFiles[$field][$key]['uploaded_folder'] = $newFolder;
                     $sessionFiles[$field][$key]['uploaded_url'] = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $newFolder . $newFilename;
                     if (!is_array($this->gp[$field])) {
                         $this->gp[$field] = array();
                     }
                     array_push($this->gp[$field], $newFilename);
                 }
             }
         }
         Tx_Formhandler_Globals::$session->set('files', $sessionFiles);
     }
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:50,代码来源:Tx_Formhandler_Finisher_StoreUploadedFiles.php

示例3: generateConfiguration

 /**
  * Generates configuration. Locks configuration file for exclusive access to avoid collisions. Will not be stabe on Windows.
  *
  * @return	void
  */
 public function generateConfiguration()
 {
     $fileName = PATH_site . TX_REALURL_AUTOCONF_FILE;
     $lockObject = t3lib_div::makeInstance('t3lib_lock', $fileName, $GLOBALS['TYPO3_CONF_VARS']['SYS']['lockingMode']);
     /** @var t3lib_lock $lockObject */
     $lockObject->setEnableLogging(FALSE);
     $lockObject->acquire();
     $fd = @fopen($fileName, 'a+');
     if ($fd) {
         // Check size
         fseek($fd, 0, SEEK_END);
         if (ftell($fd) == 0) {
             $this->doGenerateConfiguration($fd);
         }
         fclose($fd);
         t3lib_div::fixPermissions($fileName);
     }
     $lockObject->release();
 }
开发者ID:woehrlag,项目名称:new.woehrl.de,代码行数:24,代码来源:class.tx_realurl_autoconfgen.php

示例4: main

 /**
  * Create the thumbnail
  * Will exit before return if all is well.
  *
  * @return	void
  */
 function main()
 {
     global $TYPO3_CONF_VARS;
     // If file exists, we make a thumbsnail of the file.
     if ($this->input && file_exists($this->input)) {
         // Check file extension:
         $reg = array();
         if (preg_match('/(.*)\\.([^\\.]*$)/', $this->input, $reg)) {
             $ext = strtolower($reg[2]);
             $ext = $ext == 'jpeg' ? 'jpg' : $ext;
             if ($ext == 'ttf') {
                 $this->fontGif($this->input);
                 // Make font preview... (will not return)
             } elseif (!t3lib_div::inList($this->imageList, $ext)) {
                 $this->errorGif('Not imagefile!', $ext, basename($this->input));
             }
         } else {
             $this->errorGif('Not imagefile!', 'No ext!', basename($this->input));
         }
         // ... so we passed the extension test meaning that we are going to make a thumbnail here:
         if (!$this->size) {
             $this->size = $this->sizeDefault;
         }
         // default
         // I added extra check, so that the size input option could not be fooled to pass other values. That means the value is exploded, evaluated to an integer and the imploded to [value]x[value]. Furthermore you can specify: size=340 and it'll be translated to 340x340.
         $sizeParts = explode('x', $this->size . 'x' . $this->size);
         // explodes the input size (and if no "x" is found this will add size again so it is the same for both dimensions)
         $sizeParts = array(t3lib_div::intInRange($sizeParts[0], 1, 1000), t3lib_div::intInRange($sizeParts[1], 1, 1000));
         // Cleaning it up, only two parameters now.
         $this->size = implode('x', $sizeParts);
         // Imploding the cleaned size-value back to the internal variable
         $sizeMax = max($sizeParts);
         // Getting max value
         // Init
         $outpath = PATH_site . $this->outdir;
         // Should be - ? 'png' : 'gif' - , but doesn't work (ImageMagick prob.?)
         // René: png work for me
         $thmMode = t3lib_div::intInRange($TYPO3_CONF_VARS['GFX']['thumbnails_png'], 0);
         $outext = $ext != 'jpg' || $thmMode & 2 ? $thmMode & 1 ? 'png' : 'gif' : 'jpg';
         $outfile = 'tmb_' . substr(md5($this->input . $this->mtime . $this->size), 0, 10) . '.' . $outext;
         $this->output = $outpath . $outfile;
         if ($TYPO3_CONF_VARS['GFX']['im']) {
             // If thumbnail does not exist, we generate it
             if (!file_exists($this->output)) {
                 $parameters = '-sample ' . $this->size . ' ' . $this->wrapFileName($this->input) . '[0] ' . $this->wrapFileName($this->output);
                 $cmd = t3lib_div::imageMagickCommand('convert', $parameters);
                 t3lib_utility_Command::exec($cmd);
                 if (!file_exists($this->output)) {
                     $this->errorGif('No thumb', 'generated!', basename($this->input));
                 } else {
                     t3lib_div::fixPermissions($this->output);
                 }
             }
             // The thumbnail is read and output to the browser
             if ($fd = @fopen($this->output, 'rb')) {
                 header('Content-type: image/' . $outext);
                 fpassthru($fd);
                 fclose($fd);
             } else {
                 $this->errorGif('Read problem!', '', $this->output);
             }
         } else {
             exit;
         }
     } else {
         $this->errorGif('No valid', 'inputfile!', basename($this->input));
     }
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:74,代码来源:thumbs.php

示例5: renderTxdamAttribute

 /**
  * Rendering the "txdam" custom attribute on img tag, called from TypoScript
  *
  * @param	string		Content input. Not used, ignore.
  * @param	array		TypoScript configuration
  * @return	string		Unmodified content input
  * @access private
  */
 function renderTxdamAttribute($content, $conf)
 {
     global $TYPO3_CONF_VARS;
     $mediaId = isset($this->cObj->parameters['txdam']) ? $this->cObj->parameters['txdam'] : 0;
     if ($mediaId) {
         if (!is_object($media = tx_dam::media_getByUid($mediaId))) {
             $GLOBALS['TT']->setTSlogMessage("tx_dam_tsfeimgtag->renderTxdamAttribute(): File id '" . $mediaId . "' was not found, so '" . $content . "' was not updated.", 1);
             return $content;
         }
         $metaInfo = $media->getMetaArray();
         $magicPathPrefix = $TYPO3_CONF_VARS['BE']['RTE_imageStorageDir'] . 'RTEmagicC_';
         if (t3lib_div::isFirstPartOfStr($this->cObj->parameters['src'], $magicPathPrefix)) {
             // Process magic image
             $pI = pathinfo(substr($this->cObj->parameters['src'], strlen($magicPathPrefix)));
             $fileName = preg_replace('/_[0-9][0-9]' . preg_quote('.') . '/', '.', substr($pI['basename'], 0, -strlen('.' . $pI['extension'])));
             if ($fileName != $metaInfo['file_name']) {
                 // Substitute magic image
                 $imgObj = t3lib_div::makeInstance('t3lib_stdGraphic');
                 $imgObj->init();
                 $imgObj->mayScaleUp = 0;
                 $imgObj->tempPath = PATH_site . $imgObj->tempPath;
                 $imgInfo = $imgObj->getImageDimensions(PATH_site . $metaInfo['file_path'] . $metaInfo['file_name']);
                 if (is_array($imgInfo) && count($imgInfo) == 4 && $TYPO3_CONF_VARS['BE']['RTE_imageStorageDir']) {
                     // Create or update the reference and magic images
                     $fileInfo = pathinfo($imgInfo[3]);
                     $fileFunc = t3lib_div::makeInstance('t3lib_basicFileFunctions');
                     // Construct a name based on the mediaId and on the width and height of the magic image
                     $basename = $fileFunc->cleanFileName('RTEmagicP_' . $fileInfo['filename'] . '_txdam' . $this->cObj->parameters['txdam'] . '_' . substr(md5($this->cObj->parameters['width'] . 'x' . $this->cObj->parameters['height']), 0, $fileFunc->uniquePrecision) . '.' . $fileInfo['extension']);
                     $destPath = PATH_site . $TYPO3_CONF_VARS['BE']['RTE_imageStorageDir'];
                     if (@is_dir($destPath)) {
                         // Do not check file uniqueness in order to avoid creating a new one on every rendering
                         $destName = $fileFunc->getUniqueName($basename, $destPath, 1);
                         if (!@is_file($destName)) {
                             @copy($imgInfo[3], $destName);
                             t3lib_div::fixPermissions($destName);
                         }
                         $magicImageInfo = $imgObj->imageMagickConvert($destName, 'WEB', $this->cObj->parameters['width'] . 'm', $this->cObj->parameters['height'] . 'm');
                         if ($magicImageInfo[3]) {
                             $fileInfo = pathinfo($magicImageInfo[3]);
                             $mainBase = 'RTEmagicC_' . substr(basename($destName), 10) . '.' . $fileInfo['extension'];
                             $destName = $fileFunc->getUniqueName($mainBase, $destPath, 1);
                             if (!@is_file($destName)) {
                                 @copy($magicImageInfo[3], $destName);
                                 t3lib_div::fixPermissions($destName);
                             }
                             $destName = dirname($destName) . '/' . rawurlencode(basename($destName));
                             $this->cObj->parameters['src'] = substr($destName, strlen(PATH_site));
                         }
                     }
                 }
             }
         } else {
             // Substitute plain image, if needed
             if ($this->cObj->parameters['src'] != $metaInfo['file_path'] . $metaInfo['file_name']) {
                 $this->cObj->parameters['src'] = $metaInfo['file_path'] . $metaInfo['file_name'];
             }
         }
     }
     $parametersForAttributes = $this->cObj->parameters;
     unset($parametersForAttributes['txdam']);
     unset($parametersForAttributes['allParams']);
     $content = '<img ' . t3lib_div::implodeAttributes($parametersForAttributes, TRUE, TRUE) . ' />';
     return $content;
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:72,代码来源:class.tx_dam_tsfeimgtag.php

示例6: main

    /**
     * Generate the main settings formular:
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $LANG, $BACK_PATH, $TBE_MODULES;
        // file creation / delete
        if ($this->isAdmin) {
            if ($this->installToolFileKeep) {
                $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileHasKeep'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::WARNING);
                $this->content .= $flashMessage->render();
            }
            if (t3lib_div::_POST('deleteInstallToolEnableFile')) {
                unlink(PATH_typo3conf . 'ENABLE_INSTALL_TOOL');
                $this->setInstallToolFileExists();
                if ($this->getInstallToolFileExists()) {
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileDelete_failed'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::ERROR);
                } else {
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileDelete_ok'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::OK);
                }
                $this->content .= $flashMessage->render();
            }
            if (t3lib_div::_POST('createInstallToolEnableFile')) {
                touch(PATH_typo3conf . 'ENABLE_INSTALL_TOOL');
                t3lib_div::fixPermissions(PATH_typo3conf . 'ENABLE_INSTALL_TOOL');
                $this->setInstallToolFileExists();
                if ($this->getInstallToolFileExists()) {
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileCreate_ok'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::OK);
                } else {
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileCreate_failed'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::ERROR);
                }
                $this->content .= $flashMessage->render();
            }
        }
        if ($this->languageUpdate) {
            $this->doc->JScodeArray['languageUpdate'] .= '
				if (top.refreshMenu) {
					top.refreshMenu();
				} else {
					top.TYPO3ModuleMenu.refreshMenu();
				}
			';
        }
        if ($this->pagetreeNeedsRefresh) {
            t3lib_BEfunc::setUpdateSignal('updatePageTree');
        }
        // Start page:
        $this->doc->loadJavascriptLib('md5.js');
        // use a wrapper div
        $this->content .= '<div id="user-setup-wrapper">';
        // Load available backend modules
        $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
        $this->loadModules->observeWorkspaces = true;
        $this->loadModules->load($TBE_MODULES);
        $this->content .= $this->doc->header($LANG->getLL('UserSettings') . ' - ' . $BE_USER->user['realName'] . ' [' . $BE_USER->user['username'] . ']');
        // show if setup was saved
        if ($this->setupIsUpdated && !$this->tempDataIsCleared && !$this->settingsAreResetToDefault) {
            $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('setupWasUpdated'), $LANG->getLL('UserSettings'));
            $this->content .= $flashMessage->render();
        }
        // Show if temporary data was cleared
        if ($this->tempDataIsCleared) {
            $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('tempDataClearedFlashMessage'), $LANG->getLL('tempDataCleared'));
            $this->content .= $flashMessage->render();
        }
        // Show if temporary data was cleared
        if ($this->settingsAreResetToDefault) {
            $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('settingsAreReset'), $LANG->getLL('resetConfiguration'));
            $this->content .= $flashMessage->render();
        }
        // If password is updated, output whether it failed or was OK.
        if ($this->passwordIsSubmitted) {
            if ($this->passwordIsUpdated) {
                $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('newPassword_ok'), $LANG->getLL('newPassword'));
            } else {
                $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('newPassword_failed'), $LANG->getLL('newPassword'), t3lib_FlashMessage::ERROR);
            }
            $this->content .= $flashMessage->render();
        }
        // render the menu items
        $menuItems = $this->renderUserSetup();
        $this->content .= $this->doc->spacer(20) . $this->doc->getDynTabMenu($menuItems, 'user-setup', FALSE, FALSE, 0, 1, FALSE, 1, $this->dividers2tabs);
        $formToken = $this->formProtection->generateToken('BE user setup', 'edit');
        // Submit and reset buttons
        $this->content .= $this->doc->spacer(20);
        $this->content .= $this->doc->section('', t3lib_BEfunc::cshItem('_MOD_user_setup', 'reset', $BACK_PATH) . '
			<input type="hidden" name="simUser" value="' . $this->simUser . '" />
			<input type="hidden" name="formToken" value="' . $formToken . '" />
			<input type="submit" name="data[save]" value="' . $LANG->getLL('save') . '" />
			<input type="button" value="' . $LANG->getLL('resetConfiguration') . '" onclick="if(confirm(\'' . $LANG->getLL('setToStandardQuestion') . '\')) {document.getElementById(\'setValuesToDefault\').value=1;this.form.submit();}" />
			<input type="button" value="' . $LANG->getLL('clearSessionVars') . '"  onclick="if(confirm(\'' . $LANG->getLL('clearSessionVarsQuestion') . '\')){document.getElementById(\'clearSessionVars\').value=1;this.form.submit();}" />
			<input type="hidden" name="data[setValuesToDefault]" value="0" id="setValuesToDefault" />
			<input type="hidden" name="data[clearSessionVars]" value="0" id="clearSessionVars" />');
        // Notice
        $this->content .= $this->doc->spacer(30);
        $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('activateChanges'), '', t3lib_FlashMessage::INFO);
        $this->content .= $flashMessage->render();
        // end of wrapper div
//.........这里部分代码省略.........
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:101,代码来源:index.php

示例7: send

 /**
  * Outputs the mail to a text file according to RFC 4155.
  *
  * @param Swift_Mime_Message $message The message to send
  * @param string[] &$failedRecipients To collect failures by-reference, nothing will fail in our debugging case
  * @return int
  * @throws Exception
  */
 public function send(Swift_Mime_Message $message, &$failedRecipients = null)
 {
     $message->generateId();
     // Create a mbox-like header
     $mboxFrom = $this->getReversePath($message);
     $mboxDate = strftime('%c', $message->getDate());
     $messageStr = sprintf('From %s  %s', $mboxFrom, $mboxDate) . LF;
     // Add the complete mail inclusive headers
     $messageStr .= $message->toString();
     $messageStr .= LF . LF;
     // Write the mbox file
     $file = @fopen($this->debugFile, 'a');
     if (!$file) {
         throw new Exception(sprintf('Could not write to file "%s" when sending an email to debug transport', $this->debugFile), 1291064151);
     }
     flock($file, LOCK_EX);
     @fwrite($file, $messageStr);
     flock($file, LOCK_UN);
     @fclose($file);
     t3lib_div::fixPermissions($this->debugFile);
     // Return every receipient as "delivered"
     $count = count((array) $message->getTo()) + count((array) $message->getCc()) + count((array) $message->getBcc());
     return $count;
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:32,代码来源:class.t3lib_mail_mboxtransport.php

示例8: acquire

 /**
  * Acquire a lock and return when successful. If the lock is already open, the client will be
  *
  * It is important to know that the lock will be acquired in any case, even if the request was blocked first. Therefore, the lock needs to be released in every situation.
  *
  * @return	boolean		Returns true if lock could be acquired without waiting, false otherwise.
  */
 public function acquire()
 {
     $noWait = TRUE;
     // Default is TRUE, which means continue without caring for other clients. In the case of TYPO3s cache management, this has no negative effect except some resource overhead.
     $isAcquired = TRUE;
     switch ($this->method) {
         case 'simple':
             if (is_file($this->resource)) {
                 $this->sysLog('Waiting for a different process to release the lock');
                 $maxExecutionTime = ini_get('max_execution_time');
                 $maxAge = time() - ($maxExecutionTime ? $maxExecutionTime : 120);
                 if (@filectime($this->resource) < $maxAge) {
                     @unlink($this->resource);
                     $this->sysLog('Unlink stale lockfile');
                 }
             }
             $isAcquired = FALSE;
             for ($i = 0; $i < $this->loops; $i++) {
                 $filepointer = @fopen($this->resource, 'x');
                 if ($filepointer !== FALSE) {
                     fclose($filepointer);
                     $this->sysLog('Lock aquired');
                     $noWait = $i === 0;
                     $isAcquired = TRUE;
                     break;
                 }
                 usleep($this->step * 1000);
             }
             if (!$isAcquired) {
                 throw new Exception('Lock file could not be created');
             }
             t3lib_div::fixPermissions($this->resource);
             break;
         case 'flock':
             if (($this->filepointer = fopen($this->resource, 'w+')) == FALSE) {
                 throw new Exception('Lock file could not be opened');
             }
             if (flock($this->filepointer, LOCK_EX | LOCK_NB) == TRUE) {
                 // Lock without blocking
                 $noWait = TRUE;
             } elseif (flock($this->filepointer, LOCK_EX) == TRUE) {
                 // Lock with blocking (waiting for similar locks to become released)
                 $noWait = FALSE;
             } else {
                 throw new Exception('Could not lock file "' . $this->resource . '"');
             }
             break;
         case 'semaphore':
             if (sem_acquire($this->resource)) {
                 // Unfortunately it seems not possible to find out if the request was blocked, so we return FALSE in any case to make sure the operation is tried again.
                 $noWait = FALSE;
             }
             break;
         case 'disable':
             $noWait = FALSE;
             $isAcquired = FALSE;
             break;
     }
     $this->isAcquired = $isAcquired;
     return $noWait;
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:68,代码来源:class.t3lib_lock.php

示例9: fixPermissions

 /**
  * Sets the file system mode and group ownership of a file or a folder.
  *
  * @param string $path Path of file or folder, must not be escaped. Path can be absolute or relative
  * @param bool $recursive If set, also fixes permissions of files and folders in the folder (if $path is a folder)
  * @return mixed TRUE on success, FALSE on error, always TRUE on Windows OS
  */
 public function fixPermissions($path, $recursive = FALSE)
 {
     return t3lib_div::fixPermissions($path, $recursive);
 }
开发者ID:blumenbach,项目名称:bb-online.neu,代码行数:11,代码来源:class.tx_realurl_apiwrapper_4x.php

示例10: importExtFromRep


//.........这里部分代码省略.........
                     $fetchData[0]['EM_CONF']['constraints'] = $this->xmlhandler->extensionsXML[$extKey]['versions'][$version]['dependencies'];
                 }
                 $EM_CONF = $this->fixEMCONF($fetchData[0]['EM_CONF']);
                 if (!$EM_CONF['lockType'] || !strcmp($EM_CONF['lockType'], $loc)) {
                     // check dependencies, act accordingly if ext is loaded
                     list($instExtInfo, ) = $this->getInstalledExtensions();
                     $depStatus = $this->checkDependencies($extKey, $EM_CONF, $instExtInfo);
                     if (t3lib_extMgm::isLoaded($extKey) && !$depStatus['returnCode']) {
                         $this->content .= $depStatus['html'];
                         if ($uploadedTempFile) {
                             $this->content .= '<input type="hidden" name="CMD[alreadyUploaded]" value="' . $uploadedTempFile . '" />';
                         }
                     } else {
                         $res = $this->clearAndMakeExtensionDir($fetchData[0], $loc, $dontDelete);
                         if (is_array($res)) {
                             $extDirPath = trim($res[0]);
                             if ($extDirPath && @is_dir($extDirPath) && substr($extDirPath, -1) == '/') {
                                 $emConfFile = $this->construct_ext_emconf_file($extKey, $EM_CONF);
                                 $dirs = $this->extractDirsFromFileList(array_keys($fetchData[0]['FILES']));
                                 $res = $this->createDirsInPath($dirs, $extDirPath);
                                 if (!$res) {
                                     $writeFiles = $fetchData[0]['FILES'];
                                     $writeFiles['ext_emconf.php']['content'] = $emConfFile;
                                     $writeFiles['ext_emconf.php']['content_md5'] = md5($emConfFile);
                                     // Write files:
                                     foreach ($writeFiles as $theFile => $fileData) {
                                         t3lib_div::writeFile($extDirPath . $theFile, $fileData['content']);
                                         if (!@is_file($extDirPath . $theFile)) {
                                             $content .= sprintf($GLOBALS['LANG']->getLL('ext_import_file_not_created'), $extDirPath . $theFile) . '<br />';
                                         } elseif (md5(t3lib_div::getUrl($extDirPath . $theFile)) != $fileData['content_md5']) {
                                             $content .= sprintf($GLOBALS['LANG']->getLL('ext_import_file_corrupted'), $extDirPath . $theFile) . '<br />';
                                         }
                                     }
                                     t3lib_div::fixPermissions($extDirPath, TRUE);
                                     // No content, no errors. Create success output here:
                                     if (!$content) {
                                         $messageContent = sprintf($GLOBALS['LANG']->getLL('ext_import_success_folder'), $extDirPath) . '<br />';
                                         $uploadSucceed = true;
                                         // Fix TYPO3_MOD_PATH for backend modules in extension:
                                         $modules = t3lib_div::trimExplode(',', $EM_CONF['module'], 1);
                                         if (count($modules)) {
                                             foreach ($modules as $mD) {
                                                 $confFileName = $extDirPath . $mD . '/conf.php';
                                                 if (@is_file($confFileName)) {
                                                     $messageContent .= $this->writeTYPO3_MOD_PATH($confFileName, $loc, $extKey . '/' . $mD . '/') . '<br />';
                                                 } else {
                                                     $messageContent .= sprintf($GLOBALS['LANG']->getLL('ext_import_no_conf_file'), $confFileName) . '<br />';
                                                 }
                                             }
                                         }
                                         // NOTICE: I used two hours trying to find out why a script, ext_emconf.php, written twice and in between included by PHP did not update correct the second time. Probably something with PHP-A cache and mtime-stamps.
                                         // But this order of the code works.... (using the empty Array with type, EMCONF and files hereunder).
                                         // Writing to ext_emconf.php:
                                         $sEMD5A = $this->serverExtensionMD5Array($extKey, array('type' => $loc, 'EM_CONF' => array(), 'files' => array()));
                                         $EM_CONF['_md5_values_when_last_written'] = serialize($sEMD5A);
                                         $emConfFile = $this->construct_ext_emconf_file($extKey, $EM_CONF);
                                         t3lib_div::writeFile($extDirPath . 'ext_emconf.php', $emConfFile);
                                         $messageContent .= 'ext_emconf.php: ' . $extDirPath . 'ext_emconf.php<br />';
                                         $messageContent .= $GLOBALS['LANG']->getLL('ext_import_ext_type') . ' ';
                                         $messageContent .= $this->typeLabels[$loc] . '<br />';
                                         $messageContent .= '<br />';
                                         // Remove cache files:
                                         $updateContent = '';
                                         if (t3lib_extMgm::isLoaded($extKey)) {
                                             if ($this->removeCacheFiles()) {
                                                 $messageContent .= $GLOBALS['LANG']->getLL('ext_import_cache_files_removed') . '<br />';
开发者ID:zsolt-molnar,项目名称:TYPO3-4.5-trunk,代码行数:67,代码来源:class.em_index.php

示例11: installExtension

 /**
  * Installs an extension.
  *
  * @param  $fetchData
  * @param  $loc
  * @param  $version
  * @param  $uploadedTempFile
  * @param  $dontDelete
  * @return mixed|string
  */
 public function installExtension($fetchData, $loc, $version, $uploadedTempFile, $dontDelete)
 {
     $xmlHandler =& $this->parentObject->xmlHandler;
     $extensionList =& $this->parentObject->extensionList;
     $extensionDetails =& $this->parentObject->extensionDetails;
     $content = '';
     if (tx_em_Tools::importAsType($loc)) {
         if (is_array($fetchData)) {
             // There was some data successfully transferred
             if ($fetchData[0]['extKey'] && is_array($fetchData[0]['FILES'])) {
                 $extKey = $fetchData[0]['extKey'];
                 if (!isset($fetchData[0]['EM_CONF']['constraints'])) {
                     $fetchData[0]['EM_CONF']['constraints'] = $xmlHandler->extensionsXML[$extKey]['versions'][$version]['dependencies'];
                 }
                 $EM_CONF = tx_em_Tools::fixEMCONF($fetchData[0]['EM_CONF']);
                 if (!$EM_CONF['lockType'] || !strcmp($EM_CONF['lockType'], $loc)) {
                     // check dependencies, act accordingly if ext is loaded
                     list($instExtInfo, ) = $extensionList->getInstalledExtensions();
                     $depStatus = $this->checkDependencies($extKey, $EM_CONF, $instExtInfo);
                     if (t3lib_extMgm::isLoaded($extKey) && !$depStatus['returnCode']) {
                         $content .= $depStatus['html'];
                         if ($uploadedTempFile) {
                             $content .= '<input type="hidden" name="CMD[alreadyUploaded]" value="' . $uploadedTempFile . '" />';
                         }
                     } else {
                         $res = $this->clearAndMakeExtensionDir($fetchData[0], $loc, $dontDelete);
                         if (is_array($res)) {
                             $extDirPath = trim($res[0]);
                             if ($extDirPath && @is_dir($extDirPath) && substr($extDirPath, -1) == '/') {
                                 $emConfFile = $extensionDetails->construct_ext_emconf_file($extKey, $EM_CONF);
                                 $dirs = tx_em_Tools::extractDirsFromFileList(array_keys($fetchData[0]['FILES']));
                                 $res = tx_em_Tools::createDirsInPath($dirs, $extDirPath);
                                 if (!$res) {
                                     $writeFiles = $fetchData[0]['FILES'];
                                     $writeFiles['ext_emconf.php']['content'] = $emConfFile;
                                     $writeFiles['ext_emconf.php']['content_md5'] = md5($emConfFile);
                                     // Write files:
                                     foreach ($writeFiles as $theFile => $fileData) {
                                         t3lib_div::writeFile($extDirPath . $theFile, $fileData['content']);
                                         if (!@is_file($extDirPath . $theFile)) {
                                             if (!$this->silentMode) {
                                                 $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf($GLOBALS['LANG']->getLL('ext_import_file_not_created'), $extDirPath . $theFile), '', t3lib_FlashMessage::ERROR);
                                                 $content .= $flashMessage->render();
                                             } else {
                                                 if (!$this->silentMode) {
                                                     $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf($GLOBALS['LANG']->getLL('ext_import_file_not_created'), $extDirPath . $theFile), '', t3lib_FlashMessage::ERROR);
                                                     $content .= $flashMessage->render();
                                                 } else {
                                                     $content .= sprintf($GLOBALS['LANG']->getLL('ext_import_file_not_created'), $extDirPath . $theFile) . '<br />';
                                                 }
                                             }
                                         } elseif (md5(t3lib_div::getUrl($extDirPath . $theFile)) != $fileData['content_md5']) {
                                             $content .= sprintf($GLOBALS['LANG']->getLL('ext_import_file_corrupted'), $extDirPath . $theFile) . '<br />';
                                         }
                                     }
                                     t3lib_div::fixPermissions($extDirPath, TRUE);
                                     // No content, no errors. Create success output here:
                                     if (!$content) {
                                         $messageContent = sprintf($GLOBALS['LANG']->getLL('ext_import_success_folder'), $extDirPath) . '<br />';
                                         $uploadSucceed = true;
                                         // Fix TYPO3_MOD_PATH for backend modules in extension:
                                         $modules = t3lib_div::trimExplode(',', $EM_CONF['module'], 1);
                                         if (count($modules)) {
                                             foreach ($modules as $mD) {
                                                 $confFileName = $extDirPath . $mD . '/conf.php';
                                                 if (@is_file($confFileName)) {
                                                     $messageContent .= tx_em_Tools::writeTYPO3_MOD_PATH($confFileName, $loc, $extKey . '/' . $mD . '/') . '<br />';
                                                 } else {
                                                     $messageContent .= sprintf($GLOBALS['LANG']->getLL('ext_import_no_conf_file'), $confFileName) . '<br />';
                                                 }
                                             }
                                         }
                                         // NOTICE: I used two hours trying to find out why a script, ext_emconf.php, written twice and in between included by PHP did not update correct the second time. Probably something with PHP-A cache and mtime-stamps.
                                         // But this order of the code works.... (using the empty Array with type, EMCONF and files hereunder).
                                         // Writing to ext_emconf.php:
                                         $sEMD5A = $extensionDetails->serverExtensionMD5array($extKey, array('type' => $loc, 'EM_CONF' => array(), 'files' => array()));
                                         $EM_CONF['_md5_values_when_last_written'] = serialize($sEMD5A);
                                         $emConfFile = $extensionDetails->construct_ext_emconf_file($extKey, $EM_CONF);
                                         t3lib_div::writeFile($extDirPath . 'ext_emconf.php', $emConfFile);
                                         $messageContent .= 'ext_emconf.php: ' . $extDirPath . 'ext_emconf.php<br />';
                                         $messageContent .= $GLOBALS['LANG']->getLL('ext_import_ext_type') . ' ';
                                         $messageContent .= $this->api->typeLabels[$loc] . '<br />';
                                         $messageContent .= '<br />';
                                         // Remove cache files:
                                         $updateContent = '';
                                         if (t3lib_extMgm::isLoaded($extKey)) {
                                             if (t3lib_extMgm::removeCacheFiles()) {
                                                 $messageContent .= $GLOBALS['LANG']->getLL('ext_import_cache_files_removed') . '<br />';
                                             }
                                             list($new_list) = $this->parentObject->extensionList->getInstalledExtensions();
//.........这里部分代码省略.........
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:101,代码来源:class.tx_em_install.php

示例12: translationHandling


//.........这里部分代码省略.........
                    echo '</tr>';
                    $counter++;
                }
                echo '</table>
					<script type="text/javascript">
						document.getElementById("progress-message").firstChild.data="' . $GLOBALS['LANG']->getLL('translation_check_done') . '";
					</script>
				';
                echo $contentParts[1] . $this->parentObject->doc->endPage();
                exit;
            } elseif (t3lib_div::_GET('l10n') == 'update') {
                $loadedExtensions = array_keys($TYPO3_LOADED_EXT);
                $loadedExtensions = array_diff($loadedExtensions, array('_CACHEFILE'));
                // Override content output - we now do that ourselves:
                $this->parentObject->content .= $this->parentObject->doc->section($GLOBALS['LANG']->getLL('translation_status'), $content, 0, 1);
                // Setting up the buttons and markers for docheader
                $content = $this->parentObject->doc->startPage('Extension Manager');
                $content .= $this->parentObject->doc->moduleBody($this->parentObject->pageinfo, $docHeaderButtons, $markers);
                $contentParts = explode('###CONTENT###', $content);
                echo $contentParts[0] . $this->parentObject->content;
                $this->parentObject->doPrintContent = FALSE;
                flush();
                echo '
				<br />
				<br />
				<p id="progress-message">
					' . $GLOBALS['LANG']->getLL('translation_update_status') . '
				</p>
				<br />
				<div style="width:100%; height:20px; border: 1px solid black;">
					<div id="progress-bar" style="float: left; width: 0%; height: 20px; background-color:green;">&nbsp;</div>
					<div id="transparent-bar" style="float: left; width: 100%; height: 20px; background-color:' . $this->parentObject->doc->bgColor2 . ';">&nbsp;</div>
				</div>
				<br />
				<br /><p>' . $GLOBALS['LANG']->getLL('translation_table_update') . '<br />
				<em>' . $GLOBALS['LANG']->getLL('translation_full_check_update') . '</em></p><br />
				<table border="0" cellpadding="2" cellspacing="2">
					<tr class="t3-row-header"><td>' . $GLOBALS['LANG']->getLL('translation_extension_key') . '</td>
				';
                foreach ($selectedLanguages as $lang) {
                    echo '<td>' . $LANG->getLL('lang_' . $lang, 1) . '</td>';
                }
                echo '</tr>';
                $counter = 1;
                foreach ($loadedExtensions as $extKey) {
                    $percentDone = intval($counter / count($loadedExtensions) * 100);
                    echo '
					<script type="text/javascript">
						document.getElementById("progress-bar").style.width = "' . $percentDone . '%";
						document.getElementById("transparent-bar").style.width = "' . (100 - $percentDone) . '%";
						document.getElementById("progress-message").firstChild.data="' . sprintf($GLOBALS['LANG']->getLL('translation_updating_extension'), $extKey) . '";
					</script>
					';
                    flush();
                    $translationStatusArr = $this->parentObject->terConnection->fetchTranslationStatus($extKey, $mirrorURL);
                    echo '<tr class="bgColor4"><td>' . $extKey . '</td>';
                    if (is_array($translationStatusArr)) {
                        foreach ($selectedLanguages as $lang) {
                            // remote unknown -> no l10n available
                            if (!isset($translationStatusArr[$lang])) {
                                echo '<td title="' . $GLOBALS['LANG']->getLL('translation_no_translation') . '">' . $GLOBALS['LANG']->getLL('translation_n_a') . '</td>';
                                continue;
                            }
                            // determine local md5 from zip
                            if (is_file(PATH_site . 'typo3temp/' . $extKey . '-l10n-' . $lang . '.zip')) {
                                $localmd5 = md5_file(PATH_site . 'typo3temp/' . $extKey . '-l10n-' . $lang . '.zip');
                            } else {
                                $localmd5 = 'zzz';
                            }
                            // local!=remote or not installed -> needs update
                            if ($localmd5 != $translationStatusArr[$lang]['md5']) {
                                $ret = $this->updateTranslation($extKey, $lang, $mirrorURL);
                                if ($ret === true) {
                                    echo '<td title="' . $GLOBALS['LANG']->getLL('translation_has_been_updated') . '" style="background-color:#69a550">' . $GLOBALS['LANG']->getLL('translation_status_update') . '</td>';
                                } else {
                                    echo '<td title="' . htmlspecialchars($ret) . '" style="background-color:#cb3352">' . $GLOBALS['LANG']->getLL('translation_status_error') . '</td>';
                                }
                                continue;
                            }
                            echo '<td title="' . $GLOBALS['LANG']->getLL('translation_is_ok') . '" style="background-color:#69a550">' . $GLOBALS['LANG']->getLL('translation_status_ok') . '</td>';
                        }
                    } else {
                        echo '<td colspan="' . count($selectedLanguages) . '" title="' . $GLOBALS['LANG']->getLL('translation_problems') . '">' . $GLOBALS['LANG']->getLL('translation_status_could_not_fetch') . '</td>';
                    }
                    echo '</tr>';
                    $counter++;
                }
                echo '</table>
					<script type="text/javascript">
						document.getElementById("progress-message").firstChild.data="' . $GLOBALS['LANG']->getLL('translation_update_done') . '";
					</script>
				';
                // Fix permissions on unzipped language xml files in the entire l10n folder and all subfolders
                t3lib_div::fixPermissions(PATH_typo3conf . 'l10n', TRUE);
                echo $contentParts[1] . $this->parentObject->doc->endPage();
                exit;
            }
            $this->parentObject->content .= $this->parentObject->doc->section($GLOBALS['LANG']->getLL('translation_status'), $content, 0, 1);
        }
    }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:101,代码来源:class.tx_em_translations.php

示例13: insertMagicImage

 /**
  * Insert a magic image
  *
  * @param	string		$filepath: the path to the image file
  * @param	array		$imgInfo: a 4-elements information array about the file
  * @param	string		$altText: text for the alt attribute of the image
  * @param	string		$titleText: text for the title attribute of the image
  * @param	string		$additionalParams: text representing more HTML attributes to be added on the img tag
  * @return	void
  */
 public function insertMagicImage($filepath, $imgInfo, $altText = '', $titleText = '', $additionalParams = '')
 {
     if (is_array($imgInfo) && count($imgInfo) == 4) {
         if ($this->RTEImageStorageDir) {
             $fI = pathinfo($imgInfo[3]);
             $fileFunc = t3lib_div::makeInstance('t3lib_basicFileFunctions');
             $basename = $fileFunc->cleanFileName('RTEmagicP_' . $fI['basename']);
             $destPath = PATH_site . $this->RTEImageStorageDir;
             if (@is_dir($destPath)) {
                 $destName = $fileFunc->getUniqueName($basename, $destPath);
                 @copy($imgInfo[3], $destName);
                 t3lib_div::fixPermissions($destName);
                 $cWidth = t3lib_div::intInRange(t3lib_div::_GP('cWidth'), 0, $this->magicMaxWidth);
                 $cHeight = t3lib_div::intInRange(t3lib_div::_GP('cHeight'), 0, $this->magicMaxHeight);
                 if (!$cWidth) {
                     $cWidth = $this->magicMaxWidth;
                 }
                 if (!$cHeight) {
                     $cHeight = $this->magicMaxHeight;
                 }
                 $imgI = $this->imgObj->imageMagickConvert($filepath, 'WEB', $cWidth . 'm', $cHeight . 'm');
                 // ($imagefile,$newExt,$w,$h,$params,$frame,$options,$mustCreate=0)
                 if ($imgI[3]) {
                     $fI = pathinfo($imgI[3]);
                     $mainBase = 'RTEmagicC_' . substr(basename($destName), 10) . '.' . $fI['extension'];
                     $destName = $fileFunc->getUniqueName($mainBase, $destPath);
                     @copy($imgI[3], $destName);
                     t3lib_div::fixPermissions($destName);
                     $destName = dirname($destName) . '/' . rawurlencode(basename($destName));
                     $iurl = $this->siteURL . substr($destName, strlen(PATH_site));
                     $this->imageInsertJS($iurl, $imgI[0], $imgI[1], $altText, $titleText, $additionalParams);
                 } else {
                     t3lib_div::sysLog('Attempt at creating a magic image failed due to error converting image: "' . $filepath . '".', $this->extKey . '/tx_rtehtmlarea_select_image', t3lib_div::SYSLOG_SEVERITY_ERROR);
                 }
             } else {
                 t3lib_div::sysLog('Attempt at creating a magic image failed due to incorrect destination path: "' . $destPath . '".', $this->extKey . '/tx_rtehtmlarea_select_image', t3lib_div::SYSLOG_SEVERITY_ERROR);
             }
         } else {
             t3lib_div::sysLog('Attempt at creating a magic image failed due to absent RTE_imageStorageDir', $this->extKey . '/tx_rtehtmlarea_select_image', t3lib_div::SYSLOG_SEVERITY_ERROR);
         }
     } else {
         t3lib_div::sysLog('Attempt at creating a magic image failed due to missing image file info.', $this->extKey . '/tx_rtehtmlarea_select_image', t3lib_div::SYSLOG_SEVERITY_ERROR);
     }
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:54,代码来源:class.tx_rtehtmlarea_select_image.php

示例14: imageInsert

 /**
  * [Describe function...]
  *
  * @return	[type]		...
  */
 function imageInsert()
 {
     global $TCA, $TYPO3_CONF_VARS;
     if (t3lib_div::_GP('insertImage')) {
         $filepath = t3lib_div::_GP('insertImage');
         $imgObj = t3lib_div::makeInstance('t3lib_stdGraphic');
         $imgObj->init();
         $imgObj->mayScaleUp = 0;
         $imgObj->tempPath = PATH_site . $imgObj->tempPath;
         $imgInfo = $imgObj->getImageDimensions($filepath);
         $imgMetaData = tx_dam::meta_getDataForFile($filepath, 'uid,pid,alt_text,hpixels,vpixels,' . $this->imgTitleDAMColumn . ',' . $TCA['tx_dam']['ctrl']['languageField']);
         $imgMetaData = $this->getRecordOverlay('tx_dam', $imgMetaData, $this->sys_language_content);
         switch ($this->act) {
             case 'magic':
                 if (is_array($imgInfo) && count($imgInfo) == 4 && $this->rteImageStorageDir() && is_array($imgMetaData)) {
                     $fI = pathinfo($imgInfo[3]);
                     $fileFunc = t3lib_div::makeInstance('t3lib_basicFileFunctions');
                     $basename = $fileFunc->cleanFileName('RTEmagicP_' . $fI['basename']);
                     $destPath = PATH_site . $this->rteImageStorageDir();
                     if (@is_dir($destPath)) {
                         $destName = $fileFunc->getUniqueName($basename, $destPath);
                         @copy($imgInfo[3], $destName);
                         t3lib_div::fixPermissions($destName);
                         $cWidth = t3lib_div::intInRange(t3lib_div::_GP('cWidth'), 0, $this->magicMaxWidth);
                         $cHeight = t3lib_div::intInRange(t3lib_div::_GP('cHeight'), 0, $this->magicMaxHeight);
                         if (!$cWidth) {
                             $cWidth = $this->magicMaxWidth;
                         }
                         if (!$cHeight) {
                             $cHeight = $this->magicMaxHeight;
                         }
                         $imgI = $imgObj->imageMagickConvert($filepath, 'WEB', $cWidth . 'm', $cHeight . 'm');
                         // ($imagefile,$newExt,$w,$h,$params,$frame,$options,$mustCreate=0)
                         if ($imgI[3]) {
                             $fI = pathinfo($imgI[3]);
                             $mainBase = 'RTEmagicC_' . substr(basename($destName), 10) . '.' . $fI['extension'];
                             $destName = $fileFunc->getUniqueName($mainBase, $destPath);
                             @copy($imgI[3], $destName);
                             t3lib_div::fixPermissions($destName);
                             $iurl = $this->siteUrl . substr($destName, strlen(PATH_site));
                             $this->imageInsertJS($iurl, $imgI[0], $imgI[1], $imgMetaData['alt_text'], $imgMetaData[$this->imgTitleDAMColumn], substr($imgInfo[3], strlen(PATH_site)));
                         }
                     }
                 }
                 exit;
                 break;
             case 'plain':
                 if (is_array($imgInfo) && count($imgInfo) == 4 && is_array($imgMetaData)) {
                     $iurl = $this->siteUrl . substr($imgInfo[3], strlen(PATH_site));
                     $this->imageInsertJS($iurl, $imgMetaData['hpixels'], $imgMetaData['vpixels'], $imgMetaData['alt_text'], $imgMetaData[$this->imgTitleDAMColumn], substr($imgInfo[3], strlen(PATH_site)));
                 }
                 exit;
                 break;
         }
     }
 }
开发者ID:zsolt-molnar,项目名称:TYPO3-4.5-trunk,代码行数:61,代码来源:class.tx_rtehtmlarea_dam_browse_media.php

示例15: moduleContent


//.........这里部分代码省略.........
                $content .= '</form>';
                $content .= $this->pObj->getFormTag();
                if (is_file($path . $filename) and is_readable($path . $filename)) {
                    $content .= '<br /><strong>Overwrite existing default indexer setup to this folder:</strong><br />' . htmlspecialchars($this->pObj->path) . '<br />';
                    $content .= '<br /><input type="submit" name="indexSave" value="Overwrite" />';
                } else {
                    $content .= '<br /><strong>Save default indexer setup for this folder:</strong><br />' . htmlspecialchars($this->pObj->path) . '<br />';
                    $content .= '<br /><input type="submit" name="indexSave" value="Save" />';
                }
                $content .= '<input type="hidden" name="setuptype" value="folder">';
                $content .= $this->pObj->doc->spacer(10);
                if (t3lib_extMgm::isLoaded('dam_cron')) {
                    $content .= $this->pObj->doc->section('CRON', '', 0, 1);
                    $path = $this->cronUploadsFolder;
                    $filename = $this->makeSetupfilenameForPath($this->pObj->path);
                    $content .= '</form>';
                    $content .= $this->pObj->getFormTag();
                    $content .= '<input type="hidden" name="setuptype" value="cron">';
                    $content .= '<br /><strong>Save setup as cron indexer setup:</strong><br />' . htmlspecialchars($path) . '<br />
								<input type="text" size="25" maxlength="25" name="filename" value="' . htmlspecialchars($filename) . '"> .xml';
                    $content .= '<br /><input type="submit" name="indexSave" value="Save" />';
                    $files = t3lib_div::getFilesInDir($path, 'xml', 0, 1);
                    $out = '';
                    foreach ($files as $file) {
                        $out .= htmlspecialchars($file) . '<br />';
                    }
                    if ($out) {
                        $content .= '<br /><br /><strong>Existing cron setups:</strong><div style="border-top:1px solid grey;border-bottom:1px solid grey;">' . $out . '</div><br />';
                    }
                }
                $extraSetup = '';
                $this->index->setPath($this->pObj->path);
                $this->index->setOptionsFromRules();
                $this->index->setPID($this->pObj->defaultPid);
                $this->index->enableMetaCollect(TRUE);
                $setup = $this->index->serializeSetup($extraSetup, false);
                $content .= $this->pObj->doc->section('Set Options', t3lib_div::view_array($setup), 0, 1);
                $content .= '<br /><textarea style="width:100%" rows="15">' . htmlspecialchars(str_replace('{', "{\n", $this->index->serializeSetup($extraSetup))) . '</textarea>';
                break;
            case 'indexSave':
                $content .= $this->pObj->getPathInfoHeaderBar($this->pObj->pathInfo, FALSE, $this->cmdIcons);
                $content .= $this->pObj->doc->spacer(10);
                $content .= '<div style="width:100%;text-align:right;">' . $this->pObj->btn_back() . '</div>';
                if (t3lib_div::_GP('setuptype') === 'folder') {
                    $path = tx_dam::path_makeAbsolute($this->pObj->path);
                    $filename = $path . '.indexing.setup.xml';
                } else {
                    $path = $this->cronUploadsFolder;
                    $filename = t3lib_div::_GP('filename');
                    $filename = $filename ? $filename : $this->makeSetupfilenameForPath($this->pObj->path);
                    $filename = $path . $filename . '.xml';
                }
                $this->index->setPath($this->pObj->path);
                $this->index->setOptionsFromRules();
                $this->index->setPID($this->pObj->defaultPid);
                $this->index->enableMetaCollect(TRUE);
                $setup = $this->index->serializeSetup($extraSetup);
                if ($handle = fopen($filename, 'wb')) {
                    if (fwrite($handle, $setup)) {
                        $content .= 'Setup written to file<br />' . htmlspecialchars($filename);
                    } else {
                        $content .= 'Can\'t write to file ' . htmlspecialchars($filename);
                    }
                    fclose($handle);
                    t3lib_div::fixPermissions($filename);
                } else {
                    $content .= 'Can\'t open file ' . htmlspecialchars($filename);
                }
                break;
            case 'cron_info':
                $content .= $this->pObj->getHeaderBar('', implode('&nbsp;', $this->cmdIcons));
                $content .= $this->pObj->doc->spacer(10);
                $files = t3lib_div::getFilesInDir($this->cronUploadsFolder, 'xml', 1, 1);
                $out = '';
                foreach ($files as $file) {
                    if ($file == $filename) {
                        $out .= '<strong>' . htmlspecialchars($file) . '</strong><br />';
                    } else {
                        $out .= htmlspecialchars($file) . '<br />';
                    }
                }
                $filename = $filename ? $filename : $file;
                if ($out) {
                    $content .= '<br /><br /><strong>Existing setups:</strong><div style="border-top:1px solid grey;border-bottom:1px solid grey;">' . $out . '</div><br />';
                } else {
                    $content .= '<br /><br /><strong>No setups available.</strong><br />';
                }
                if ($out) {
                    $cronscript = t3lib_extMgm::extPath('dam_cron') . 'cron/dam_indexer.php';
                    $content .= '<br /><strong>Call indexer script example:</strong><br />';
                    $content .= '<span style="font-family: monaco,courier,monospace;">/usr/bin/php ' . htmlspecialchars($cronscript) . ' --setup=' . htmlspecialchars($filename) . '</span>';
                }
                break;
            case 'doIndexing':
                break;
            default:
                $content .= parent::moduleContent($header, $description, $lastStep);
        }
        return $content;
    }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:101,代码来源:class.tx_dam_tools_indexsetup.php


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