示例#1
0
# copyright Copyright (C) 2014 admiror-design-studio.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.admiror-design-studio.com/joomla-extensions
# Technical Support:  Forum - http://www.vasiljevski.com/forum/index.php
# Version: 5.0.0
-------------------------------------------------------------------------*/
/** ensure this file is being included by a parent file */
defined('_JEXEC') or die('Restricted access');
require_once JPATH_SITE . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'content' . DIRECTORY_SEPARATOR . 'admirorgallery' . DIRECTORY_SEPARATOR . 'admirorgallery' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'agHelper.php';
$ag_itemURL = $this->ag_init_itemURL;
$ag_folderName = dirname($ag_itemURL);
$ag_fileName = basename($ag_itemURL);
$AG_imgInfo = agHelper::ag_imageInfo(JPATH_SITE . $ag_itemURL);
require_once JPATH_SITE . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'content' . DIRECTORY_SEPARATOR . 'admirorgallery' . DIRECTORY_SEPARATOR . 'admirorgallery' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'agHelper.php';
$thumbsFolderPhysicalPath = JPATH_SITE . DIRECTORY_SEPARATOR . 'administrator' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_admirorgallery' . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'thumbs';
agHelper::ag_sureRemoveDir($thumbsFolderPhysicalPath, true);
if (!JFolder::create($thumbsFolderPhysicalPath, 0755)) {
    JFactory::getApplication()->enqueueMessage(JText::_("AG_CANNOT_CREATE_FOLDER") . " " . $newFolderName, 'error');
}
$ag_hasXML = "";
$ag_hasThumb = "";
// Set Possible Description File Apsolute Path // Instant patch for upper and lower case...
$ag_pathWithStripExt = JPATH_SITE . $ag_folderName . '/' . JFile::stripExt(basename($ag_itemURL));
$ag_imgXML_path = $ag_pathWithStripExt . ".XML";
if (JFIle::exists($ag_pathWithStripExt . ".xml")) {
    $ag_imgXML_path = $ag_pathWithStripExt . ".xml";
}
if (file_exists(JPATH_SITE . "/plugins/content/admirorgallery/admirorgallery/thumbs/" . basename($ag_folderName) . "/" . basename($ag_fileName))) {
    $ag_hasThumb = '<img src="' . JURI::root() . 'administrator/components/com_admirorgallery/templates/' . $this->ag_template_id . '/images/icon-hasThumb.png" class="ag_hasThumb" />';
}
if (file_exists($ag_imgXML_path)) {
示例#2
0
 /**
  * Removes dir or file
  * @param <type> $dir
  * @param <type> $DeleteMe
  * @return <type>
  */
 public static function ag_sureRemoveDir($dir, $DeleteMe)
 {
     if (!($dh = @opendir($dir))) {
         return;
     }
     while (false !== ($obj = readdir($dh))) {
         if ($obj == '.' || $obj == '..') {
             continue;
         }
         if (!@unlink($dir . '/' . $obj)) {
             agHelper::ag_sureRemoveDir($dir . '/' . $obj, true);
         }
     }
     closedir($dh);
     if ($DeleteMe) {
         @rmdir($dir);
     }
 }