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


PHP Folder::protect方法代码示例

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


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

示例1: protectFolder

    /**
     * Return a checkbox to delete session data
     *
     * @param DataContainer $dc
     *
     * @return string
     */
    public function protectFolder(DataContainer $dc)
    {
        $count = 0;
        $strPath = $dc->id;
        // Check whether the temporary name has been replaced already (see #6432)
        if (Input::post('name') && ($strNewPath = str_replace('__new__', Input::post('name'), $strPath, $count)) && $count > 0 && is_dir(TL_ROOT . '/' . $strNewPath)) {
            $strPath = $strNewPath;
        }
        // Only show for folders (see #5660)
        if (!is_dir(TL_ROOT . '/' . $strPath)) {
            return '';
        }
        $blnProtected = file_exists(TL_ROOT . '/' . $strPath . '/.htaccess');
        // Protect or unprotect the folder
        if (Input::post('FORM_SUBMIT') == 'tl_files') {
            if (Input::post('protected')) {
                if (!$blnProtected) {
                    $blnProtected = true;
                    $objFolder = new Folder($strPath);
                    $objFolder->protect();
                }
            } else {
                if ($blnProtected) {
                    $blnProtected = false;
                    $objFolder = new Folder($strPath);
                    $objFolder->unprotect();
                }
            }
        }
        // Show a note for non-Apache servers
        if (strpos(Environment::get('serverSoftware'), 'Apache') === false) {
            Message::addInfo($GLOBALS['TL_LANG']['tl_files']['htaccessInfo']);
        }
        return '
<div class="' . $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['eval']['tl_class'] . ' cbx">
  <div id="ctrl_' . $dc->field . '" class="tl_checkbox_single_container">
    <input type="hidden" name="' . $dc->inputName . '" value=""><input type="checkbox" name="' . $dc->inputName . '" id="opt_' . $dc->field . '_0" class="tl_checkbox" value="1"' . ($blnProtected ? ' checked="checked"' : '') . ' onfocus="Backend.getScrollOffset()"> <label for="opt_' . $dc->field . '_0">' . $GLOBALS['TL_LANG']['tl_files']['protected'][0] . '</label>
  </div>' . (Config::get('showHelp') ? '
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_files']['protected'][1] . '</p>' : '') . '
</div>';
    }
开发者ID:rheintechnology,项目名称:core,代码行数:48,代码来源:tl_files.php

示例2: protect

 /**
  * Protect a folder
  */
 public function protect()
 {
     if (!is_dir(TL_ROOT . '/' . $this->intId)) {
         $this->log('Resource "' . $this->intId . '" is not a directory', __METHOD__, TL_ERROR);
         $this->redirect('contao/main.php?act=error');
     }
     // Remove the protection
     if (file_exists(TL_ROOT . '/' . $this->intId . '/.htaccess')) {
         $objFolder = new \Folder($this->intId);
         $objFolder->unprotect();
         $this->log('The protection from folder "' . $this->intId . '" has been removed', __METHOD__, TL_FILES);
         $this->redirect($this->getReferer());
     } else {
         $objFolder = new \Folder($this->intId);
         $objFolder->protect();
         $this->log('Folder "' . $this->intId . '" has been protected', __METHOD__, TL_FILES);
         $this->redirect($this->getReferer());
     }
 }
开发者ID:eknoes,项目名称:core,代码行数:22,代码来源:DC_Folder.php

示例3: checkSyncCtoFolders

 /**
  * Create syncCto folders if not exists
  */
 public function checkSyncCtoFolders()
 {
     $objFile = new Folder($this->objSyncCtoHelper->standardizePath($GLOBALS['SYC_PATH']['tmp']));
     $objFile = new Folder($this->objSyncCtoHelper->standardizePath($GLOBALS['SYC_PATH']['db']));
     $objFile->protect();
     $objFile = new Folder($this->objSyncCtoHelper->standardizePath($GLOBALS['SYC_PATH']['file']));
     $objFile->protect();
 }
开发者ID:menatwork,项目名称:synccto,代码行数:11,代码来源:SyncCtoFiles.php

示例4: protectFolder

    /**
     * Return a checkbox to delete session data
     *
     * @param DataContainer $dc
     *
     * @return string
     */
    public function protectFolder(DataContainer $dc)
    {
        $count = 0;
        $strPath = $dc->id;
        // Check whether the temporary name has been replaced already (see #6432)
        if (Input::post('name') && ($strNewPath = str_replace('__new__', Input::post('name'), $strPath, $count)) && $count > 0 && is_dir(TL_ROOT . '/' . $strNewPath)) {
            $strPath = $strNewPath;
        }
        // Only show for folders (see #5660)
        if (!is_dir(TL_ROOT . '/' . $strPath)) {
            return '';
        }
        $blnPublic = file_exists(TL_ROOT . '/' . $strPath . '/.public');
        // Protect or unprotect the folder
        if (Input::post('FORM_SUBMIT') == 'tl_files') {
            if (Input::post($dc->inputName)) {
                if (!$blnPublic) {
                    $blnPublic = true;
                    $objFolder = new Folder($strPath);
                    $objFolder->unprotect();
                    $this->import('Automator');
                    $this->Automator->generateSymlinks();
                }
            } else {
                if ($blnPublic) {
                    $blnPublic = false;
                    $objFolder = new Folder($strPath);
                    $objFolder->protect();
                    $this->import('Automator');
                    $this->Automator->generateSymlinks();
                }
            }
        }
        $class = $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['eval']['tl_class'] . ' cbx"';
        if (Input::get('act') == 'editAll' || Input::get('act') == 'overrideAll') {
            $class = str_replace(array('w50', 'clr', 'wizard', 'long', 'm12', 'cbx'), '', $class);
        }
        return '
<div class="' . $class . '">
  <div id="ctrl_' . $dc->field . '" class="tl_checkbox_single_container">
    <input type="hidden" name="' . $dc->inputName . '" value=""><input type="checkbox" name="' . $dc->inputName . '" id="opt_' . $dc->field . '_0" class="tl_checkbox" value="1"' . ($blnPublic ? ' checked="checked"' : '') . ' onfocus="Backend.getScrollOffset()"> <label for="opt_' . $dc->field . '_0">' . $GLOBALS['TL_LANG']['tl_files']['protected'][0] . '</label>
  </div>' . (Config::get('showHelp') ? '
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_files']['protected'][1] . '</p>' : '') . '
</div>';
    }
开发者ID:contao,项目名称:core-bundle,代码行数:52,代码来源:tl_files.php

示例5: purgeTempFolder

 /**
  * Purge the temporary directory
  */
 public function purgeTempFolder()
 {
     $arrTmp = scan(TL_ROOT . '/system/tmp', true);
     // Remove files
     if (is_array($arrTmp)) {
         foreach ($arrTmp as $strFile) {
             if ($strFile != '.htaccess' && !is_dir(TL_ROOT . '/system/tmp/' . $strFile)) {
                 @unlink(TL_ROOT . '/system/tmp/' . $strFile);
             }
         }
     }
     // Check for .htaccess
     if (!file_exists(TL_ROOT . '/system/tmp/.htaccess')) {
         $objFolder = new Folder('system/tmp');
         $objFolder->protect();
     }
     // Add log entry
     $this->log('Purged the temporary directory', 'Automator purgeTempFolder()', TL_CRON);
 }
开发者ID:jens-wetzel,项目名称:use2,代码行数:22,代码来源:Automator.php


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