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


PHP addTrailingSlash函数代码示例

本文整理汇总了PHP中addTrailingSlash函数的典型用法代码示例。如果您正苦于以下问题:PHP addTrailingSlash函数的具体用法?PHP addTrailingSlash怎么用?PHP addTrailingSlash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: __construct

    /**
     * constructor
     *
     */
    function __construct()
    {
    	//check if the session folder read and writable
    		$dir = new file();
	        if(!file_exists(CONFIG_SYS_DIR_SESSION_PATH))
	        {
	           if(!$dir->mkdir(CONFIG_SYS_DIR_SESSION_PATH))
	           {
	              die('Unable to create session folder.');
	           }
	        }
    		if(!$dir->isReadable(CONFIG_SYS_DIR_SESSION_PATH))
    		{
    			die('Permission denied: ' . CONFIG_SYS_DIR_SESSION_PATH . " is not readable.");
    		}    		
    		if(!$dir->isWritable(CONFIG_SYS_DIR_SESSION_PATH))
    		{
    			die('Permission denied: ' . CONFIG_SYS_DIR_SESSION_PATH . " is not writable.");
    		}
    	$this->dir = backslashToSlash(addTrailingSlash(CONFIG_SYS_DIR_SESSION_PATH));
        $this->lifeTime = get_cfg_var("session.gc_maxlifetime");  
        $this->gcCounterFile = $this->dir . $this->gcCounterFileName; 
        $this->gcLogFile = $this->dir  . $this->gcLogFileName;
       	$this->sessionDir = backslashToSlash($this->dir.session_id().DIRECTORY_SEPARATOR);
        $this->init();    	
    }
开发者ID:hungnv0789,项目名称:vhtm,代码行数:30,代码来源:class.session.php

示例2: doSearch

 /**
  * get the file according to the search keywords
  *
  */
 function doSearch($baseFolderPath = null)
 {
     $baseFolderPath = addTrailingSlash(backslashToSlash(is_null($baseFolderPath) ? $this->rootFolder : $baseFolderPath));
     $dirHandler = @opendir($baseFolderPath);
     if ($dirHandler) {
         while (false !== ($file = readdir($dirHandler))) {
             if ($file != '.' && $file != '..') {
                 $path = $baseFolderPath . $file;
                 if (is_file($path)) {
                     $isValid = true;
                     $fileTime = @filemtime($path);
                     $fileSize = @filesize($path);
                     if ($this->searchkeywords['name'] !== '' && @eregi($this->searchkeywords['name'], $file) === false) {
                         $isValid = false;
                     }
                     if ($this->searchkeywords['mtime_from'] != '' && $fileTime < @strtotime($this->searchkeywords['mtime_from'])) {
                         $isValid = false;
                     }
                     if ($this->searchkeywords['mtime_to'] != '' && $fileTime > @strtotime($this->searchkeywords['mtime_to'])) {
                         $isValid = false;
                     }
                     if ($this->searchkeywords['size_from'] != '' && $fileSize < @strtotime($this->searchkeywords['size_from'])) {
                         $isValid = false;
                     }
                     if ($this->searchkeywords['size_to'] != '' && $fileSize > @strtotime($this->searchkeywords['size_to'])) {
                         $isValid = false;
                     }
                     if ($isValid && isListingDocument($path)) {
                         $finalPath = $path;
                         $objFile = new file($finalPath);
                         $tem = $objFile->getFileInfo();
                         $obj = new manager($finalPath, false);
                         $obj->setSessionAction($this->sessionAction);
                         $selectedDocuments = $this->sessionAction->get();
                         $fileType = $obj->getFileType($finalPath);
                         foreach ($fileType as $k => $v) {
                             $tem[$k] = $v;
                         }
                         $tem['path'] = backslashToSlash($finalPath);
                         $tem['type'] = is_dir($finalPath) ? 'folder' : 'file';
                         /*$tem['size'] = transformFileSize($tem['size']);
                         		$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
                         		$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);*/
                         $tem['flag'] = array_search($tem['path'], $selectedDocuments) !== false ? $this->sessionAction->getAction() == "copy" ? 'copyFlag' : 'cutFlag' : 'noFlag';
                         $tem['url'] = getFileUrl($tem['path']);
                         $this->rootFolderInfo['file']++;
                         $manager = null;
                         $this->files[] = $tem;
                         $tem = null;
                     }
                 } elseif (is_dir($path) && $this->searchkeywords['recursive']) {
                     $this->doSearch($path);
                     // For Chamilo this line replaces $this->Search($baseFolderPath); to run the search recursively from the root directory
                 }
             }
         }
     }
 }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:62,代码来源:class.search.php

示例3: uniqid

 $history->add($sessionImageInfo);
 if (CONFIG_SYS_DEMO_ENABLE) {
     //demo only
     if (isset($originalSessionImageInfo) && sizeof($originalSessionImageInfo)) {
         $imagePath = $sessionDir . $originalSessionImageInfo['info']['name'];
     } else {
         $imagePath = $sessionDir . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
     }
 } else {
     if ($isSaveAsRequest) {
         //save as request
         //check save to folder if exists
         if (isset($_POST['save_to']) && strlen($_POST['save_to'])) {
             $imagePath = $originalImage;
         } else {
             $imagePath = addTrailingSlash(backslashToSlash($_POST['save_to'])) . $_POST['new_name'] . "." . getFileExt($_POST['path']);
         }
         if (!file_exists($_POST['save_to']) || !is_dir($_POST['save_to'])) {
             $error = IMG_SAVE_AS_FOLDER_NOT_FOUND;
         } elseif (file_exists($imagePath)) {
             $error = IMG_SAVE_AS_NEW_IMAGE_EXISTS;
         } elseif (!preg_match("/^[a-zA-Z0-9_\\- ]+\$/", $_POST['new_name'])) {
             $error = IMG_SAVE_AS_ERR_NAME_INVALID;
         }
     } else {
         //save request
         $imagePath = $originalImage;
     }
 }
 if ($image->saveImage($imagePath)) {
     if (CONFIG_SYS_DEMO_ENABLE) {
开发者ID:naneri,项目名称:Osclass,代码行数:31,代码来源:ajax_image_save.php

示例4: delete

 function delete($file, $recursive = false, $type = false)
 {
     $file = $this->fixPath($file);
     if ('f' === $type || $this->isFile($file)) {
         return $this->link->delete($file);
     }
     if (!$recursive) {
         return $this->link->rmdir($file);
     }
     //At this point its a folder, and we're in recursive mode
     $file = addTrailingSlash($file);
     $filelist = $this->dirlist($file, true);
     $retval = true;
     if (is_array($filelist)) {
         //false if no files, So check first.
         foreach ($filelist as $filename => $fileinfo) {
             if (!$this->delete($file . $filename, $recursive, $fileinfo['type'])) {
                 $retval = false;
             }
         }
     }
     if ($this->exists($file) && !$this->link->rmdir($file)) {
         $retval = false;
     }
     return $retval;
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:26,代码来源:fileSystemSFTPExt.php

示例5: getThumbURL

 public static function getThumbURL($phpThumbParams, $onpub_dir_phpthumb = '')
 {
     global $PHPTHUMB_CONFIG;
     $vendor_dir = addTrailingSlash(dirname(dirname(dirname(__DIR__))));
     $phpthumb_config_file = $vendor_dir . 'james-heinrich/phpthumb/phpThumb.config.php';
     if (!$onpub_dir_phpthumb) {
         $onpub_dir_phpthumb = '../vendor/james-heinrich/phpthumb/';
     }
     if (file_exists($phpthumb_config_file)) {
         require_once $phpthumb_config_file;
         if (isset($PHPTHUMB_CONFIG['high_security_enabled']) && $PHPTHUMB_CONFIG['high_security_enabled']) {
             return $onpub_dir_phpthumb . 'phpThumb.php?' . $phpThumbParams . '&hash=' . md5($phpThumbParams . $PHPTHUMB_CONFIG['high_security_password']);
         }
     }
     return $onpub_dir_phpthumb . 'phpThumb.php?' . $phpThumbParams;
 }
开发者ID:onpubcom,项目名称:onpubapi,代码行数:16,代码来源:OnpubImages.php

示例6: getFileList

 /**
  * get the list of files and folders under this current fold
  *	@return array
  */
 function getFileList()
 {
     $outputs = array();
     $files = array();
     $folders = array();
     $tem = array();
     $dirHandler = @opendir($this->currentFolderPath);
     if ($dirHandler) {
         while (false !== ($file = readdir($dirHandler))) {
             if ($file != '.' && $file != '..') {
                 $flag = $this->flags['no'];
                 if ($this->sessionAction->getFolder() == $this->currentFolderPath) {
                     //check if any flag associated with this folder or file
                     $folder = addTrailingSlash(backslashToSlash($this->currentFolderPath));
                     if (in_array($folder . $file, $this->sessionAction->get())) {
                         if ($this->sessionAction->getAction() == "copy") {
                             $flag = $this->flags['copy'];
                         } else {
                             $flag = $this->flags['cut'];
                         }
                     }
                 }
                 $path = $this->currentFolderPath . $file;
                 if (is_dir($path) && isListingDocument($path)) {
                     $this->currentFolderInfo['subdir']++;
                     if (!$this->calculateSubdir) {
                     } else {
                         $folder = $this->getFolderInfo($path);
                         $folder['flag'] = $flag;
                         $folders[$file] = $folder;
                         $outputs[$file] = $folders[$file];
                     }
                 } elseif (is_file($path) && isListingDocument($path)) {
                     $obj = new file($path);
                     $tem = $obj->getFileInfo();
                     if (sizeof($tem)) {
                         $fileType = $this->getFileType($file);
                         foreach ($fileType as $k => $v) {
                             $tem[$k] = $v;
                         }
                         $this->currentFolderInfo['size'] += $tem['size'];
                         $this->currentFolderInfo['file']++;
                         $tem['path'] = backslashToSlash($path);
                         $tem['type'] = "file";
                         $tem['flag'] = $flag;
                         $files[$file] = $tem;
                         $outputs[$file] = $tem;
                         $tem = array();
                         $obj->close();
                     }
                 }
             }
         }
         if ($this->forceFolderOnTop) {
             uksort($folders, "strnatcasecmp");
             uksort($files, "strnatcasecmp");
             $outputs = array();
             foreach ($folders as $v) {
                 $outputs[] = $v;
             }
             foreach ($files as $v) {
                 $outputs[] = $v;
             }
         } else {
             uksort($outputs, "strnatcasecmp");
         }
         @closedir($dirHandler);
     } else {
         trigger_error('Unable to locate the folder ' . $this->currentFolderPath, E_NOTICE);
     }
     return $outputs;
 }
开发者ID:hungnv0789,项目名称:vhtm,代码行数:76,代码来源:class.manager.php

示例7: elseif

} elseif (empty($_POST['new_folder'])) {
    $error = ERR_FOLDER_NAME_EMPTY;
} elseif (!preg_match("/^[a-zA-Z0-9_\\- ]+\$/", $_POST['new_folder'])) {
    $error = ERR_FOLDER_FORMAT;
} else {
    if (empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath'])) {
        $error = ERR_FOLDER_PATH_NOT_ALLOWED;
    } elseif (file_exists(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder'])) {
        $error = ERR_FOLDER_EXISTS;
    } else {
        include_once CLASS_FILE;
        $file = new file();
        if ($file->mkdir(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder'], 0775)) {
            include_once CLASS_MANAGER;
            $manager = new manager(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder'], false);
            $pathInfo = $manager->getFolderInfo(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder']);
            foreach ($pathInfo as $k => $v) {
                switch ($k) {
                    case "ctime":
                    case "mtime":
                    case "atime":
                        $v = date(DATE_TIME_FORMAT, $v);
                        break;
                    case 'name':
                        $info .= sprintf(", %s:'%s'", 'short_name', shortenFileName($v));
                        break;
                    case 'cssClass':
                        $v = 'folderEmpty';
                        break;
                }
                $info .= sprintf(", %s:'%s'", $k, $v);
开发者ID:bachnx92,项目名称:vemaybay,代码行数:31,代码来源:ajax_create_folder.php

示例8: makeFilelink

/**
 * Make a link to an entry, using the settings for how they should be formed.
 *
 * @param mixed $data
 * @param string $weblog
 * @param string $anchor
 * @param string $parameter
 * @param boolean $para_weblog
 */
function makeFilelink($data = "", $weblog = "", $anchor = "comm", $parameter = "", $para_weblog = false)
{
    global $PIVOTX;
    // Set the weblog, if it isn't set already.
    if ($weblog == "") {
        $weblog = $PIVOTX['weblogs']->getCurrent();
    }
    // Set $entry (and $code)
    if (empty($data)) {
        // Using current entry - the db object must exist and be set
        $template_vars = $PIVOTX['template']->get_template_vars();
        $uid = $template_vars['uid'];
    } elseif (is_array($data)) {
        // Using passed/inputed entry
        $entry = $data;
        $uid = $entry['uid'];
    } elseif (is_numeric($data)) {
        $uid = $data;
        // Using the entry with the given $code
        // If it's not the current one, we need to load it
        if (!isset($PIVOTX['db']) || $uid != $PIVOTX['db']->entry['uid']) {
            $fl_db = new db(FALSE);
            $fl_db->read_entry($uid);
            $entry = $fl_db->entry;
        } else {
            $entry = $PIVOTX['db']->entry;
        }
    } else {
        debug('Entry code must be an integer/numeric - no output.');
        return;
    }
    $site_url = getDefault($PIVOTX['weblogs']->get($weblog, 'site_url'), $PIVOTX['paths']['site_url']);
    $site_url = addTrailingSlash($site_url);
    switch ($PIVOTX['config']->get('mod_rewrite')) {
        // Mod rewrite disabled..
        case "0":
        case "":
            $filelink = sprintf("%s?e=%s%s", $site_url, $uid, $parameter);
            break;
            // archive/2005/04/20/title_of_entry
        // archive/2005/04/20/title_of_entry
        case "1":
            $name = $entry['uri'];
            $archiveprefix = makeURI(getDefault($PIVOTX['config']->get('localised_archive_prefix'), "archive"));
            list($yr, $mo, $da, $ho, $mi) = preg_split("/[ :-]/", $entry['date']);
            $filelink = $site_url . "{$archiveprefix}/{$yr}/{$mo}/{$da}/{$name}";
            break;
            // archive/2005-04-20/title_of_entry
        // archive/2005-04-20/title_of_entry
        case "2":
            $name = $entry['uri'];
            $archiveprefix = makeURI(getDefault($PIVOTX['config']->get('localised_archive_prefix'), "archive"));
            list($yr, $mo, $da, $ho, $mi) = preg_split("/[ :-]/", $entry['date']);
            $filelink = $site_url . "{$archiveprefix}/{$yr}-{$mo}-{$da}/{$name}";
            break;
            // entry/1234
        // entry/1234
        case "3":
            $entryprefix = makeURI(getDefault($PIVOTX['config']->get('localised_entry_prefix'), "entry"));
            $filelink = $site_url . "{$entryprefix}/{$uid}";
            break;
            // entry/1234/title_of_entry
        // entry/1234/title_of_entry
        case "4":
            $name = $entry['uri'];
            $entryprefix = makeURI(getDefault($PIVOTX['config']->get('localised_entry_prefix'), "entry"));
            $filelink = $site_url . "{$entryprefix}/{$uid}/{$name}";
            break;
            // 2005/04/20/title_of_entry
        // 2005/04/20/title_of_entry
        case "5":
            $name = $entry['uri'];
            list($yr, $mo, $da, $ho, $mi) = preg_split("/[ :-]/", $entry['date']);
            $filelink = $site_url . "{$yr}/{$mo}/{$da}/{$name}";
            break;
            // 2005-04-20/title_of_entry
        // 2005-04-20/title_of_entry
        case "6":
            $name = $entry['uri'];
            list($yr, $mo, $da, $ho, $mi) = preg_split("/[ :-]/", $entry['date']);
            $filelink = $site_url . "{$yr}-{$mo}-{$da}/{$name}";
            break;
    }
    // Add a weblog parameter if asked for, or if multiple weblogs
    if ($para_weblog || paraWeblogNeeded($weblog)) {
        if ($PIVOTX['config']->get('mod_rewrite')) {
            // we treat it as an extra 'folder'
            $filelink .= "/" . para_weblog($weblog);
        } else {
            $filelink .= "&amp;w=" . para_weblog($weblog);
        }
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:pivotx-sqlite,代码行数:101,代码来源:module_parser.php

示例9: getParentFolderPath

  /**
   * get the parent path of the specified path
   *
   * @param string $path
   * @return string 
   */
  function getParentFolderPath($path)
  {
  	$realPath = addTrailingSlash(backslashToSlash(getRealPath($path)));
  	$parentRealPath =  addTrailingSlash(backslashToSlash(dirname($realPath)));
  	$differentPath = addTrailingSlash(substr($realPath, strlen($parentRealPath)));
  	$parentPath = substr($path, 0, strlen(addTrailingSlash(backslashToSlash($path))) - strlen($differentPath));
/*  	echo $realPath . "<br>";
  	echo $parentRealPath . "<br>";
  	echo $differentPath . "<br>";
  	echo $parentPath . "<br>";*/
  	if(isUnderRoot($parentPath))
  	{
  		return $parentPath;
  	}else 
  	{
  		return CONFIG_SYS_DEFAULT_PATH;
  	}
  }
开发者ID:Ting-Article,项目名称:Interview,代码行数:24,代码来源:function.base.php

示例10: isDir

 function isDir($path)
 {
     $cwd = $this->cwd();
     $result = @ftp_chdir($this->link, addTrailingSlash($path));
     if ($result && $path == $this->cwd() || $this->cwd() != $cwd) {
         @ftp_chdir($this->link, $cwd);
         return true;
     }
     return false;
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:10,代码来源:fileSystemFTPExt.php

示例11: getFullPath

 public function getFullPath()
 {
     return addTrailingSlash($this->website->imagesDirectory) . $this->fileName;
 }
开发者ID:onpubcom,项目名称:onpubapi,代码行数:4,代码来源:OnpubImage.php

示例12: display


//.........这里部分代码省略.........
         en('<h3 class="onpub-field-header">Name</h3><p><input type="text" maxlength="255" size="40" name="name" value=""> <img src="' . ONPUBGUI_IMAGE_DIRECTORY . 'exclamation.png" align="top" alt="Required field" title="Required field"></p>');
     } else {
         en('<h3 class="onpub-field-header">Name</h3><p><input type="text" maxlength="255" size="40" name="name" value="' . htmlentities($this->osection->name) . '"></p>');
     }
     en('</div>');
     en('<div class="yui3-u-1-2">');
     if ($this->visible !== NULL) {
         en('<h3 class="onpub-field-header">Visibility</h3>');
         en('<p><input type="checkbox" id="id_visible" name="visible" value="1" checked="checked"> <label for="id_visible">De-select to hide this section from the Frontend.</label></p>');
     } else {
         en('<h3 class="onpub-field-header">Visibility</h3>');
         en('<p><input type="checkbox" id="id_visible" name="visible" value="1"> <label for="id_visible">Select to show this section on the Frontend.</label></p>');
     }
     en('</div>');
     en('</div>');
     en('<div class="yui3-g">');
     en('<div class="yui3-u-1-2">');
     if ($this->osection->parentID) {
         $sectionIDs = array($this->osection->parentID);
     } else {
         $sectionIDs = array();
     }
     $widget = new OnpubWidgetSections();
     $widget->sectionIDs = $sectionIDs;
     $widget->websites = array($website);
     $widget->osections = $osections;
     $widget->heading = "Parent Section";
     $widget->multiple = FALSE;
     $widget->fieldName = "parentID";
     $widget->osection = $this->osection;
     $widget->display();
     en('</div>');
     en('<div class="yui3-u-1-2">');
     en('<h3 class="onpub-field-header">Website</h3><p><a href="index.php?onpub=EditWebsite&amp;websiteID=' . $website->ID . '" title="Edit">' . $website->name . '</a></p>');
     en('</div>');
     en('</div>');
     en('<div class="yui3-g">');
     en('<div class="yui3-u-1-2">');
     if ($numOfArticles) {
         $widget = new OnpubWidgetArticles($this->pdo, $this->osection);
         $widget->display();
     } else {
         en('<h3 class="onpub-field-header">Visible Articles</h3><p>');
         en('There are 0 articles in the database. <a href="index.php?onpub=NewArticle">New Article</a>.</p>');
     }
     en('</div>');
     en('<div class="yui3-u-1-2">');
     $widget = new OnpubWidgetImages("Image", $this->osection->imageID, $images);
     $widget->display();
     en('</div>');
     en('</div>');
     if ($this->osection->url) {
         $go = ' <a href="' . $this->osection->url . '" target="_blank"><img src="' . ONPUBGUI_IMAGE_DIRECTORY . 'world_go.png" border="0" align="top" alt="Go" title="Go" width="16" height="16"></a>';
     } else {
         $go = '';
     }
     en('<div class="yui3-g">');
     en('<div class="yui3-u-1-2">');
     en('<h3 class="onpub-field-header">Static Link</h3><p><small>The Frontend will link this section to the path or URL entered below.<br>Leave blank to use auto-generated Frontend URLs.</small><br><input type="text" maxlength="255" size="40" name="url" value="' . htmlentities($this->osection->url) . '">' . $go . '</p>');
     en('</div>');
     en('<div class="yui3-u-1-2">');
     if (sizeof($wsmaps)) {
         $websitesMap = array();
         foreach ($websites as $website) {
             $websitesMap["{$website->ID}"] = $website;
         }
         $urlLabel = sizeof($wsmaps) > 1 ? 'URLs' : 'URL';
         en('<h3 class="onpub-field-header">Frontend ' . $urlLabel . '</h3>');
         en('<p>');
         en('<small>This section is displayed by the Frontend at the ' . $urlLabel . ' listed below.</small><br>');
         for ($i = 0; $i < sizeof($wsmaps); $i++) {
             $wsmap = $wsmaps[$i];
             $website = $websitesMap["{$wsmap->websiteID}"];
             $frontendURL = addTrailingSlash($website->url) . 'index.php?s=' . $wsmap->sectionID;
             en('&bull; <a href="' . $frontendURL . '" target="_blank">' . $frontendURL . '</a>');
             if ($i + 1 != sizeof($wsmaps)) {
                 en('<br>');
             }
         }
         en('</p>');
     }
     en('</div>');
     en('</div>');
     en('<div class="yui3-g">');
     en('<div class="yui3-u-1-2">');
     en('<h3 class="onpub-field-header">Created</h3><p>' . $this->osection->getCreated()->format('M j, Y g:i:s A') . '</p>');
     en('</div>');
     en('<div class="yui3-u-1-2">');
     en('<h3 class="onpub-field-header">Modified</h3><p>' . $this->osection->getModified()->format('M j, Y g:i:s A') . '</p>');
     en('</div>');
     en('</div>');
     en('<input type="submit" value="Save" id="selectAll"> <input type="button" value="Delete" id="deleteSection">');
     en('<input type="hidden" name="onpub" value="EditSectionProcess">');
     en('<input type="hidden" name="sectionID" value="' . $this->osection->ID . '">');
     en('<input type="hidden" name="websiteID" value="' . $this->osection->websiteID . '">');
     en('</div>');
     en('</form>');
     $widget = new OnpubWidgetFooter();
     $widget->display();
 }
开发者ID:onpubcom,项目名称:onpub,代码行数:101,代码来源:OnpubEditSection.php

示例13: getFileList

 /**
  * get the list of files and folders under this current fold
  * 	@return array
  */
 function getFileList()
 {
     $outputs = array();
     $files = array();
     $folders = array();
     $tem = array();
     $to_group_id = api_get_group_id();
     global $is_user_in_group;
     $dirHandler = @opendir($this->getCurrentFolderPath());
     if ($dirHandler) {
         while (false !== ($file = readdir($dirHandler))) {
             if ($file != '.' && $file != '..') {
                 $flag = $this->flags['no'];
                 if ($this->sessionAction->getFolder() == $this->getCurrentFolderPath()) {
                     //check if any flag associated with this folder or file
                     $folder = addTrailingSlash(backslashToSlash($this->getCurrentFolderPath()));
                     if (in_array($folder . $file, $this->sessionAction->get())) {
                         if ($this->sessionAction->getAction() == "copy") {
                             $flag = $this->flags['copy'];
                         } else {
                             $flag = $this->flags['cut'];
                         }
                     }
                 }
                 $path = $this->getCurrentFolderPath() . $file;
                 if (is_dir($path) && isListingDocument($path)) {
                     $this->currentFolderInfo['subdir']++;
                     //fix count left folders for Chamilo
                     $deleted_by_Chamilo_folder = '_DELETED_';
                     $css_folder_Chamilo = 'css';
                     $hotpotatoes_folder_Chamilo = 'HotPotatoes_files';
                     $chat_files_Chamilo = 'chat_files';
                     $certificates_Chamilo = 'certificates';
                     //show group's directory only if I'm member. Or if I'm a teacher.
                     //@todo: check groups not necessary because the student dont have access to main folder documents (only to document/group or document/shared_folder).
                     //Teachers can access to all groups ?
                     $group_folder = '_groupdocs';
                     $hide_doc_group = false;
                     if (preg_match("/{$group_folder}/", $path)) {
                         $hide_doc_group = true;
                         if ($is_user_in_group || $to_group_id != 0 && api_is_allowed_to_edit()) {
                             $hide_doc_group = false;
                         }
                     }
                     if (preg_match("/{$deleted_by_Chamilo_folder}/", $path) || preg_match("/{$css_folder_Chamilo}/", $path) || preg_match("/{$hotpotatoes_folder_Chamilo}/", $path) || preg_match("/{$chat_files_Chamilo}/", $path) || preg_match("/{$certificates_Chamilo}/", $path) || $hide_doc_group || $file[0] == '.') {
                         $this->currentFolderInfo['subdir'] = $this->currentFolderInfo['subdir'] - 1;
                     }
                     //end fix for Chamilo
                     if (!$this->calculateSubdir) {
                     } else {
                         $folder = $this->getFolderInfo($path);
                         $folder['flag'] = $flag;
                         $folders[$file] = $folder;
                         $outputs[$file] = $folders[$file];
                     }
                 } elseif (is_file($path) && isListingDocument($path)) {
                     $obj = new file($path);
                     $tem = $obj->getFileInfo();
                     if (sizeof($tem)) {
                         $fileType = $this->getFileType($file);
                         foreach ($fileType as $k => $v) {
                             $tem[$k] = $v;
                         }
                         $this->currentFolderInfo['size'] += $tem['size'];
                         $this->currentFolderInfo['file']++;
                         //fix count left files for Chamilo
                         $deleted_by_Chamilo_file = ' DELETED ';
                         // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php
                         if (preg_match("/{$deleted_by_Chamilo_file}/", $tem['name']) || $tem['name'][0] == '.') {
                             $this->currentFolderInfo['file'] = $this->currentFolderInfo['file'] - 1;
                         }
                         ///end fix for Chamilo
                         //Try a course file
                         $tem['path'] = backslashToSlash($path);
                         $pos = strpos($this->getCurrentFolderPath(), 'courses/');
                         if ($pos === false) {
                             //try my_files
                             $pos = strpos($this->getCurrentFolderPath(), 'main/');
                             $tem['public_path'] = api_get_path(WEB_PATH) . substr($this->getCurrentFolderPath(), $pos, strlen($this->getCurrentFolderPath())) . $file;
                         } else {
                             $tem['public_path'] = api_get_path(WEB_PATH) . substr($this->getCurrentFolderPath(), $pos, strlen($this->getCurrentFolderPath())) . $file;
                         }
                         $tem['type'] = "file";
                         $tem['flag'] = $flag;
                         $files[$file] = $tem;
                         $outputs[$file] = $tem;
                         $tem = array();
                         $obj->close();
                     }
                 }
             }
         }
         if ($this->forceFolderOnTop) {
             uksort($folders, "strnatcasecmp");
             uksort($files, "strnatcasecmp");
             $outputs = array();
//.........这里部分代码省略.........
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:101,代码来源:class.manager.php

示例14: _getLink

 /**
  * Calculates the link for a given weblog
  *
  * @param string $value
  * @param string $weblogname
  */
 function _getLink($weblogname, $value)
 {
     global $PIVOTX;
     $link = trim($value);
     if ($link == '') {
         if ($PIVOTX['config']->get('mod_rewrite') == 0) {
             $link = $PIVOTX['paths']['site_url'] . '?w=' . $weblogname;
         } else {
             $prefix = getDefault($PIVOTX['config']->get('localised_weblog_prefix'), "weblog");
             $link = $PIVOTX['paths']['site_url'] . $prefix . "/" . $weblogname;
         }
     } else {
         $ext = getExtension(basename($link));
         if ($ext == '') {
             $link = addTrailingSlash($link);
         }
     }
     return $link;
 }
开发者ID:laiello,项目名称:pivotx-sqlite,代码行数:25,代码来源:objects.php

示例15: autoCompleteFindFiles

 /**
  * Helper function for autoComplete()
  *
  * @param string $path
  * @param string $additional_path
  * @param string $match
  * @return array
  */
 protected static function autoCompleteFindFiles($path, $additional_path, $match)
 {
     $allowed = array("gif", "jpg", "jpeg", "png", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "pdf", "flv", "avi", "mp3");
     $path = addTrailingSlash($path);
     $files = array();
     $dir = dir($path);
     while (false !== ($entry = $dir->read())) {
         $entries[] = $entry;
     }
     $dir->close();
     foreach ($entries as $entry) {
         $fullname = $path . $entry;
         if ($entry != '.' && $entry != '..' && is_dir($fullname)) {
             // Recursively parse the folder below it.
             $files = array_merge($files, self::autoCompleteFindFiles($fullname, $additional_path . $entry . "/", $match));
         } else {
             if (is_file($fullname) && strpos($fullname, $match) !== false && in_array(strtolower(getExtension($entry)), $allowed) && strpos($fullname, ".thumb.") === false) {
                 // Add the file to our array of matches.
                 $files[] = $additional_path . $entry;
             }
         }
     }
     return $files;
 }
开发者ID:laiello,项目名称:pivotx-sqlite,代码行数:32,代码来源:ajaxhelper.php


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