示例#1
0
文件: script.php 项目: bellodox/jsolr
 /**
  * Removes redundant files and directories from previous versions that no
  * longer apply to the new version.
  */
 private function removeRedundantFiles($oldPath, $newPath, $exclude = array())
 {
     foreach (JFolder::files($oldPath, '.', true, true, $exclude) as $file) {
         if (JFile::exists($file)) {
             if (!JFile::exists(str_replace($oldPath, $newPath, $file))) {
                 Jfile::delete($file);
             }
         }
     }
     foreach (JFolder::folders($oldPath, '.', true, true, $exclude) as $folder) {
         if (JFolder::exists($folder)) {
             if (!JFolder::exists(str_replace($oldPath, $newPath, $folder))) {
                 JFolder::delete($folder);
             }
         }
     }
 }
示例#2
0
 public static function getTweets($username = '******', $consumerkey = '', $consumersecret = '', $accesstoken = '', $accesstokensecret = '', $count = 5, $ignore_replies = false, $include_rts = false)
 {
     $cache_path = JPATH_CACHE . '/com_sppagebuilder/addons/tweet';
     $cache_file = $cache_path . '/cache.txt';
     $cachetime = 60 * 15;
     $tweets = '';
     //Create cache folder if not exists
     if (!JFolder::exists($cache_path)) {
         JFolder::create($cache_path);
     }
     $cache_file_created = Jfile::exists($cache_file) ? filemtime($cache_file) : 0;
     if (time() - $cachetime < $cache_file_created) {
         $tweets = json_decode(JFile::read($cache_file));
     } else {
         $connection = new TwitterOAuth($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
         if ($connection) {
             $get_tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=" . $username . "&count=" . $count . "&include_rts=" . $include_rts . "&exclude_replies=" . $ignore_replies);
             $tweets = json_encode($get_tweets);
             JFile::write($cache_file, $tweets);
             $tweets = $get_tweets;
         }
     }
     return $tweets;
 }
示例#3
0
文件: vmcrypt.php 项目: lenard112/cms
    private static function _checkCreateKeyFile($date)
    {
        vmSetStartTime('check');
        static $existingKeys = false;
        $keyPath = self::_getEncryptSafepath();
        if (!$existingKeys) {
            $dir = opendir($keyPath);
            if (is_resource($dir)) {
                $existingKeys = array();
                while (false !== ($file = readdir($dir))) {
                    if ($file != '.' && $file != '..') {
                        if (!is_dir($keyPath . DS . $file)) {
                            $ext = Jfile::getExt($file);
                            if ($ext == 'ini' and file_exists($keyPath . DS . $file)) {
                                $content = parse_ini_file($keyPath . DS . $file);
                                if ($content and is_array($content) and isset($content['unixtime'])) {
                                    $key = $content['unixtime'];
                                    unset($content['unixtime']);
                                    $existingKeys[$key] = $content;
                                    //vmdebug('Reading '.$keyPath .DS. $file,$content);
                                }
                            } else {
                                vmdebug('Resource says there is file, but does not exists? ' . $keyPath . DS . $file);
                            }
                        } else {
                            //vmdebug('Directory in they keyfolder?  '.$keyPath .DS. $file);
                        }
                    } else {
                        //vmdebug('Directory in the keyfolder '.$keyPath .DS. $file);
                    }
                }
            } else {
                static $warn = false;
                if (!$warn) {
                    vmWarn('Key folder in safepath unaccessible ' . $keyPath);
                }
                $warn = true;
            }
        }
        if ($existingKeys and is_array($existingKeys) and count($existingKeys) > 0) {
            ksort($existingKeys);
            if (!empty($date)) {
                $key = '';
                foreach ($existingKeys as $unixDate => $values) {
                    if ($unixDate - 30 >= $date) {
                        vmdebug('$unixDate ' . $unixDate . ' >= $date ' . $date);
                        continue;
                    }
                    vmdebug('$unixDate < $date');
                    //$usedKey = $values;
                    $key = $values['key'];
                }
                vmdebug('Use key file ', $key);
                //include($keyPath .DS. $usedKey.'.php');
            } else {
                $usedKey = end($existingKeys);
                $key = $usedKey['key'];
            }
            vmTime('my time', 'check');
            return $key;
        } else {
            $usedKey = date("ymd");
            $filename = $keyPath . DS . $usedKey . '.ini';
            if (!JFile::exists($filename)) {
                if (JVM_VERSION < 3) {
                    $token = JUtility::getHash(JUserHelper::genRandomPassword());
                } else {
                    $token = JApplication::getHash(JUserHelper::genRandomPassword());
                }
                $salt = JUserHelper::getSalt('crypt-md5');
                $hashedToken = md5($token . $salt);
                $key = base64_encode($hashedToken);
                //$options = array('costs'=>VmConfig::get('cryptCost',8));
                /*if(!function_exists('password_hash')){
                					require(JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'password_compat.php');
                				}
                
                				if(function_exists('password_hash')){
                					$key = password_hash($key, PASSWORD_BCRYPT, $options);
                				}*/
                $date = JFactory::getDate();
                $today = $date->toUnix();
                //$key = pack('H*',$key);
                $content = ';<?php die(); */
						[keys]
						key = "' . $key . '"
						unixtime = "' . $today . '"
						date = "' . date("Y-m-d H:i:s") . '"
						; */ ?>';
                $result = JFile::write($filename, $content);
                vmTime('my time', 'check');
                return $key;
            }
        }
        vmTime('my time', 'check');
        //return pack('H*',$key);
    }
示例#4
0
 /**
  * 
  * Uploads a file if the upload is used
  * copy the file to the tmp directory if a local file is used
  * unpack a packed file is used
  */
 function upload()
 {
     $mainframe = JFactory::getApplication();
     jimport('joomla.filesystem.file');
     //Retrieve file details from uploaded file, sent from upload form:
     $uploaded_file = JRequest::getVar('uploaded_file', null, 'files', 'array');
     //do we use an existing file on server or an uploades file?
     if (empty($uploaded_file['name'])) {
         $existing_file = JRequest::getVar('existing_file', null, 'post', 'string');
         $existing_file_name = JFile::makeSafe(Jfile::getname(Jfile::stripExt($existing_file)));
         $existing_file_extension = JFile::makeSafe(JFile::getExt($existing_file));
         $existing_file_folder_name = JFolder::makeSafe(strstr($existing_file, $existing_file_name, true));
         // $mainframe->getCfg('tmp_path') . DS . JFile::makeSafe(JFile::getName($existing_file));
         $tempfile = tempnam($mainframe->getCfg('tmp_path'), $existing_file_name);
         $fDestName = $tempfile . "." . $existing_file_extension;
         //we don't need the file itseld, we just need the name
         unlink($tempfile);
         JFile::copy(JPATH_ROOT . $existing_file_folder_name . $existing_file_name . "." . $existing_file_extension, $fDestName);
     } else {
         $fDestName = $mainframe->getCfg('tmp_path') . DS . JFile::makeSafe($uploaded_file['name']);
         $fNameTmp = $uploaded_file['tmp_name'];
         if (!JFile::upload($fNameTmp, $fDestName)) {
             //Display the back button:
             JToolBarHelper::back();
             $this->setError('The file could not be uploaded.');
         }
     }
     if (count($this->getErrors() == 0)) {
         $returnURL = JURI::base() . 'index.php?option=com_k2import&task=selectcategory&file=' . JFile::getName($fDestName);
         if (strtolower(JFile::getExt($fDestName)) != 'csv') {
             //we will try to use the file as archive
             jimport('joomla.filesystem.archive');
             $import_tmp_dir = $mainframe->getCfg('tmp_path') . DS . 'k2_import';
             if (JArchive::extract($fDestName, $import_tmp_dir)) {
                 $csv_files = JFolder::files($import_tmp_dir, '.csv');
                 foreach ($csv_files as $csv_file) {
                     if (!JFile::move($csv_file, JFile::makeSafe($csv_file), $import_tmp_dir)) {
                         $this->setError('The file ' . $csv_file . ' could not be renamed.');
                         return false;
                     }
                 }
                 $this->setRedirect($returnURL . '&modus=archive', 'The file was successful uploaded and extracted');
             } else {
                 JToolBarHelper::back();
                 $this->setError('The file could not be extracted.');
             }
         } else {
             $this->setRedirect($returnURL, 'The file was successful uploaded');
         }
     }
 }
示例#5
0
 private static function _checkCreateKeyFile($date)
 {
     jimport('joomla.filesystem.file');
     vmSetStartTime('check');
     static $existingKeys = false;
     $keyPath = self::_getEncryptSafepath();
     if (!$existingKeys) {
         $dir = opendir($keyPath);
         if (is_resource($dir)) {
             $existingKeys = array();
             while (false !== ($file = readdir($dir))) {
                 if ($file != '.' && $file != '..') {
                     if (!is_dir($keyPath . DS . $file)) {
                         $ext = Jfile::getExt($file);
                         if ($ext == 'ini' and file_exists($keyPath . DS . $file)) {
                             $content = parse_ini_file($keyPath . DS . $file);
                             if ($content and is_array($content) and isset($content['unixtime'])) {
                                 $key = $content['unixtime'];
                                 unset($content['unixtime']);
                                 $existingKeys[$key] = $content;
                                 //vmdebug('Reading '.$keyPath .DS. $file,$content);
                             }
                         } else {
                             //vmdebug('Resource says there is file, but does not exists? '.$keyPath .DS. $file);
                         }
                     } else {
                         //vmdebug('Directory in they keyfolder?  '.$keyPath .DS. $file);
                     }
                 } else {
                     //vmdebug('Directory in the keyfolder '.$keyPath .DS. $file);
                 }
             }
         } else {
             static $warn = false;
             if (!$warn) {
                 vmWarn('Key folder in safepath unaccessible ' . $keyPath);
             }
             $warn = true;
         }
     }
     if ($existingKeys and is_array($existingKeys) and count($existingKeys) > 0) {
         ksort($existingKeys);
         if (!empty($date)) {
             $key = '';
             foreach ($existingKeys as $unixDate => $values) {
                 if ($unixDate - 30 >= $date) {
                     vmdebug('$unixDate ' . $unixDate . ' >= $date ' . $date);
                     continue;
                 }
                 vmdebug('$unixDate < $date ' . $date);
                 $key = $values['key'];
                 $usedKey = $values;
             }
             if (!isset($usedKey['b64']) or $usedKey['b64']) {
                 vmdebug('Doing base64_decode ', $usedKey);
                 $key = base64_decode($key);
             }
         } else {
             $usedKey = end($existingKeys);
             $key = $usedKey['key'];
             //No key means, we wanna encrypt something, when it has not the new attribute,
             //it is an old key and must be replaced
             $ksize = tsmConfig::get('keysize', 24);
             if (empty($key) or !isset($usedKey['b64']) or !isset($usedKey['size']) or $usedKey['size'] != $ksize) {
                 $key = self::_createKeyFile($keyPath, $ksize);
                 $existingKeys[$key['unixtime']] = $key;
                 return $key['key'];
             }
         }
         //vmdebug('Length of key',strlen($key));
         //vmTime('my time','check');
         return $key;
     } else {
         $key = self::_createKeyFile($keyPath, tsmConfig::get('keysize', 24));
         $existingKeys[$key['unixtime']] = $key;
         return $key['key'];
     }
 }
示例#6
0
 public function easyblog()
 {
     $helperFile = JPATH_ROOT . '/components/com_easyblog/helpers/helper.php';
     if (!Jfile::exists($helperFile)) {
         return JText::_('COM_EASYDISCUSS_EASYBLOG_DOES_NOT_EXIST');
     }
     require_once $blogHelper;
 }
示例#7
0
 /**
  * Copy the article with extrafields
  *
  * @access	public
  * @since	1.5
  */
 public function copyArticle($article, $oldid)
 {
     $app = JFactory::getApplication();
     //COPY AND SAVE LIKE COPY
     $newid = $article->id;
     if (!empty($oldid)) {
         $db =& JFactory::getDBO();
         //COPY __fieldsattach_values VALUES TABLE
         $query = 'SELECT * FROM #__fieldsattach_values as a  WHERE a.articleid = ' . $oldid;
         //Log
         plgSystemfieldsattachment::writeLog("function copyArticle log1: " . $query);
         $db->setQuery($query);
         $results = $db->loadObjectList();
         if ($results) {
             foreach ($results as $result) {
                 $query = 'SELECT * FROM #__fieldsattach_values as a  WHERE a.articleid = ' . $newid . ' AND a.fieldsid=' . $result->fieldsid;
                 $db->setQuery($query);
                 $obj = $db->loadObject();
                 if (!empty($obj)) {
                     //update
                     //$query = 'UPDATE  #__fieldsattach_values SET value="'.$result->valor.'" WHERE id='.$result->id ;
                     //$db->setQuery($query);
                     //echo "<br>".$query;
                     //$db->query();
                 } else {
                     //insert
                     $query = 'INSERT INTO #__fieldsattach_values(articleid,fieldsid,value) VALUES (' . $newid . ',\'' . $result->fieldsid . '\',\'' . $result->value . '\' )     ';
                     $db->setQuery($query);
                     $db->query();
                 }
             }
         }
         //COPY  fieldsattach_images GALLERIES-----------------------------
         $query = 'SELECT * FROM #__fieldsattach_images as a  WHERE a.articleid = ' . $oldid;
         $db->setQuery($query);
         $results = $db->loadObjectList();
         if (count($results) > 0) {
             foreach ($results as $result) {
                 //JError::raiseWarning( 100, "QUERY1.2: ".  $result->fieldsattachid  );
                 if (isset($result->fieldsattachid)) {
                     $query = 'SELECT * FROM #__fieldsattach_images as a  WHERE a.articleid = ' . $newid . ' AND a.fieldsattachid=' . $result->fieldsattachid;
                     $db->setQuery($query);
                     $obj = $db->loadObject();
                     if ($obj) {
                         //update
                         $query = 'UPDATE  #__fieldsattach_images SET image1="' . $result->title . '", image1="' . $result->image1 . '", image2="' . $result->image2 . '", image3="' . $result->image3 . '", description="' . $result->description . '", ordering="' . $result->ordering . '", published="' . $result->published . '"  WHERE id=' . $result->id;
                         $db->setQuery($query);
                         $db->query();
                     } else {
                         //insert
                         $query = 'INSERT INTO #__fieldsattach_images(articleid,fieldsattachid,title,  image1, image2, image3, description, ordering, published) VALUES (' . $newid . ',\'' . $result->fieldsattachid . '\',\'' . $result->title . '\',\'' . $result->image1 . '\',\'' . $result->image2 . '\',\'' . $result->image3 . '\',\'' . $result->description . '\',\'' . $result->ordering . '\',\'' . $result->published . '\' )     ';
                         $db->setQuery($query);
                         $db->query();
                     }
                 }
             }
         }
         //copy documents and images
         $sitepath = JPATH_BASE;
         $sitepath = str_replace("administrator", "", $sitepath);
         $sitepath = JPATH_SITE;
         //COPY  FOLDER -----------------------------
         $path = '..' . DS . 'images' . DS . 'documents';
         if (JRequest::getVar('option') == 'com_categories' && JRequest::getVar('layout') == "edit" && JRequest::getVar('extension') == "com_content") {
             $path = '..' . DS . 'images' . DS . 'documentscategories';
         }
         $path = str_replace("../", DS, $path);
         $source = $sitepath . $path . DS . $oldid . DS;
         $dest = $sitepath . $path . DS . $newid . DS;
         //JFolder::copy($source, $dest);
         if (!JFolder::exists($dest)) {
             JFolder::create($dest);
         }
         $files = JFolder::files($source);
         foreach ($files as $file) {
             if (Jfile::copy($source . $file, $dest . $file)) {
                 $app->enqueueMessage(JTEXT::_("Copy file ok:") . $file);
             } else {
                 JError::raiseWarning(100, "Cannot copy the file: " . $source . $file . " to " . $dest . $file);
             }
         }
     }
     //$app->enqueueMessage( JText::_("EXTRA FIELDS ADDED"), 'info'   )   ;
     //END COPY AND SAVE============================================================================
 }
示例#8
0
 /**
  * Create the list of all modules published as Object
  *
  * $file string the image path
  * $x integer the new image width
  * $y integer the new image height
  *
  * @return Boolean True on Success
  */
 static function resizeImage($file, $x, $y = '', $thumbpath = 'th', $thumbsuffix = '_th')
 {
     if (!$file) {
         return;
     }
     $params = self::$slideshowparams;
     if (!$params->get('autocreatethumbs', '1')) {
         return;
     }
     $thumbext = explode(".", $file);
     $thumbext = end($thumbext);
     $thumbfile = str_replace(JFile::getName($file), $thumbpath . "/" . JFile::getName($file), $file);
     $thumbfile = str_replace("." . $thumbext, $thumbsuffix . "." . $thumbext, $thumbfile);
     $filetmp = JPATH_ROOT . '/' . $file;
     $filetmp = str_replace("%20", " ", $filetmp);
     if (!Jfile::exists($filetmp)) {
         return;
     }
     $size = getimagesize($filetmp);
     if ($size[0] > $size[1]) {
         $y = $x * $size[1] / $size[0];
     } else {
         //			$tmpx = $x;
         //			$x = $y;
         //			$y = $tmpx * $size[0] / $size[1];
         $x = $y * $size[0] / $size[1];
     }
     if ($size) {
         if (JFile::exists($thumbfile)) {
             return $thumbfile;
             // $thumbsize = getimagesize(JPATH_ROOT . '/' . $thumbfile);
             // if ($thumbsize[0] == $x || $thumbsuffix == '') {
             // return $thumbfile;
             // }
         }
         $thumbfolder = str_replace(JFile::getName($file), $thumbpath . "/", $filetmp);
         if (!JFolder::exists($thumbfolder)) {
             JFolder::create($thumbfolder);
             JFile::copy(JPATH_ROOT . '/modules/mod_slideshowck/index.html', $thumbfolder . 'index.html');
         }
         if ($size['mime'] == 'image/jpeg') {
             $img_big = imagecreatefromjpeg($filetmp);
             # On ouvre l'image d'origine
             $img_new = imagecreate($x, $y);
             # création de la miniature
             $img_mini = imagecreatetruecolor($x, $y) or $img_mini = imagecreate($x, $y);
             // copie de l'image, avec le redimensionnement.
             imagecopyresized($img_mini, $img_big, 0, 0, 0, 0, $x, $y, $size[0], $size[1]);
             imagejpeg($img_mini, JPATH_ROOT . '/' . $thumbfile);
         } elseif ($size['mime'] == 'image/png') {
             $img_big = imagecreatefrompng($filetmp);
             # On ouvre l'image d'origine
             $img_new = imagecreate($x, $y);
             # création de la miniature
             $img_mini = imagecreatetruecolor($x, $y) or $img_mini = imagecreate($x, $y);
             // copie de l'image, avec le redimensionnement.
             imagecopyresized($img_mini, $img_big, 0, 0, 0, 0, $x, $y, $size[0], $size[1]);
             imagepng($img_mini, JPATH_ROOT . '/' . $thumbfile);
         } elseif ($size['mime'] == 'image/gif') {
             $img_big = imagecreatefromgif($filetmp);
             # On ouvre l'image d'origine
             $img_new = imagecreate($x, $y);
             # création de la miniature
             $img_mini = imagecreatetruecolor($x, $y) or $img_mini = imagecreate($x, $y);
             // copie de l'image, avec le redimensionnement.
             imagecopyresized($img_mini, $img_big, 0, 0, 0, 0, $x, $y, $size[0], $size[1]);
             imagegif($img_mini, JPATH_ROOT . '/' . $thumbfile);
         }
         //echo 'Image redimensionnée !';
     }
     return $thumbfile;
 }
示例#9
0
文件: core.php 项目: pguilford/vcomcc
 public function compileLessFile($file, $outputDir = 'css', $cssFile = NULL)
 {
     //import joomla filesystem classes
     jimport('joomla.filesystem.folder');
     //Template less path
     $tmplPath = $this->templatePath . '/less/';
     $inputFile = $tmplPath . $file;
     //if less file is missing eject
     if (!file_exists($inputFile)) {
         echo JText::_('LESS_ERROR_LESS_FILE_MISSING') . "<br/>";
         return;
     }
     //If output dir is set to null set output dir to default css folder
     if ($outputDir == NULL) {
         $outputDir = 'css';
     }
     //define output path
     $outputPath = $this->templatePath . '/' . $outputDir;
     //Create output directory if not exist
     if (!@JFolder::exists($outputPath)) {
         @JFolder::create($outputPath);
     }
     if ($cssFile == NULL) {
         $outputFile = substr($file, 0, strpos($file, '.')) . '.css';
     } else {
         $outputFile = $cssFile;
     }
     $outputFilePath = $outputPath . '/' . $outputFile;
     // load the cache
     $cacheFile = md5($file) . ".cache";
     $cacheFilePath = JPATH_CACHE . '/expose';
     if (!@JFolder::exists($cacheFilePath)) {
         @JFolder::create($cacheFilePath);
     }
     $cacheFilePath = $cacheFilePath . '/' . $cacheFile;
     $runcompile = $this->get('less-enabled', 0);
     //If less is turned OFF and appropriate css file is missing we'll compile the LESS once
     if (!$this->get('less-enabled', 0) and !file_exists($outputFilePath)) {
         //remove the cache file first for re-compiling
         if (@JFile::exists($cacheFilePath)) {
             @Jfile::delete($cacheFilePath);
         }
         $runcompile = TRUE;
     }
     if ($runcompile) {
         //create less instance
         $less = new lessc();
         //compress the output
         if ($this->get('less-compression', 'compressed')) {
             $compress = $this->get('less-compression', 'compressed');
         } else {
             $compress = 'compressed';
         }
         $less->setFormatter($compress);
         if (file_exists($cacheFilePath)) {
             $cache = unserialize(file_get_contents($cacheFilePath));
         } else {
             $cache = $inputFile;
         }
         // create a new cache object, and compile
         try {
             $newCache = $less->cachedCompile($cache);
             if (!is_array($cache) || $newCache["updated"] > $cache["updated"]) {
                 file_put_contents($cacheFilePath, serialize($newCache));
                 file_put_contents($outputFilePath, $newCache['compiled']);
             }
         } catch (Exception $ex) {
             echo "LESS ERROR : " . $ex->getMessage();
         }
     }
     return $outputFile;
 }
示例#10
0
 function patchForum($undo = false, $patch_full)
 {
     global $mainframe;
     jimport('joomla.filesystem.file');
     $patch_status = "";
     $success = true;
     $phpbb3_path = $this->getForumPath();
     $advsrch_file = JPATH_SITE . DS . $phpbb3_path . DS . "styles" . DS . "prosilver" . DS . "template" . DS . "search_body.html";
     $advsrch_data = JFile::read($advsrch_file);
     $old_advsrch = "<form method=\"get\"";
     $new_advsrch = "<form method=\"post\"";
     if ($undo) {
         $advsrch_data = str_replace($new_advsrch, $old_advsrch, $advsrch_data);
         $patch_status = "PATCH_SMALL_UNINSTALLED";
     } else {
         $advsrch_data = str_replace($old_advsrch, $new_advsrch, $advsrch_data);
         $patch_status = "PATCH_SMALL_INSTALLED";
     }
     if (!Jfile::write($advsrch_file, $advsrch_data)) {
         $mainframe->enqueueMessage(sprintf(JText::_('CANNOT_WRITE'), $advsrch_file), "error");
         $success = false;
     } else {
         $success = true;
     }
     if ($patch_full == 1) {
         $functions_file = JPATH_SITE . DS . $phpbb3_path . DS . "includes" . DS . "functions.php";
         $functions_data = JFile::read($functions_file);
         $funcsadmin_file = JPATH_SITE . DS . $phpbb3_path . DS . "includes" . DS . "functions_admin.php";
         $funcsadmin_data = JFile::read($funcsadmin_file);
         $old_return = "return \$phpbb_root_path . str_replace('&', '&amp;', \$redirect);";
         $new_return = "return str_replace('&', '&amp;', \$redirect);";
         $old_funcsadmin = "\$matches = array();";
         $new_funcsadmin = "\$matches = array();\r\n//patch for bridged mode only\r\nif (PHPBB_EMBEDDED===true) {\r\n\t\$rootdir = str_replace(PHPBB_ROOT_PATH,\"../\".PHPBB_BASE_PATH.\"/\", \$rootdir );\r\n}";
         if ($undo) {
             $functions_data = str_replace($new_return, $old_return, $functions_data);
             $funcsadmin_data = str_replace($new_funcsadmin, $old_funcsadmin, $funcsadmin_data);
             $patch_status = "PATCH_UNINSTALLED";
         } else {
             $functions_data = str_replace($old_return, $new_return, $functions_data);
             $funcsadmin_data = str_replace($old_funcsadmin, $new_funcsadmin, $funcsadmin_data);
             $patch_status = "PATCH_INSTALLED";
         }
         if (!Jfile::write($functions_file, $functions_data)) {
             $mainframe->enqueueMessage(sprintf(JText::_('CANNOT_WRITE'), $functions_file), "error");
             $success = false;
         } else {
             $success = true;
         }
         if (!Jfile::write($funcsadmin_file, $funcsadmin_data)) {
             $mainframe->enqueueMessage(sprintf(JText::_('CANNOT_WRITE'), $funcsadmin_file), "error");
             $success = false;
         } else {
             $success = true;
         }
     }
     if ($success) {
         $mainframe->enqueueMessage(JText::_($patch_status));
     }
 }
示例#11
0
        /**
	* Save alls fields of article
	*
	* @access	public
	* @since	1.5
	*/
	public function onContentAfterSave($context, &$article, $isNew)
	{  
            
            $app = JFactory::getApplication();
            $user =& JFactory::getUser();
            $option = JRequest::getVar("option","");
            $layout = JRequest::getVar('layout',"");
            $extension = JRequest::getVar('extension',"");
            $view= JRequest::getVar('view',"");

            $sitepath = JPATH_BASE ;
            $sitepath = str_replace ("administrator", "", $sitepath); 
            $sitepath = JPATH_SITE;
             $fontend = false;
             if( $option=='com_content' && $user->get('id')>0 &&  $view == 'form' &&  $layout == 'edit'  ) $fontend = true;
             if(JRequest::getVar("a_id")>0) $fontend = true;

             //CATEGORIES ==============================================================
              if (($option=='com_categories' && $layout=="edit" && $extension=="com_content"  ))
                 {
                     $backendcategory = true;
                     $backend=true;
                     
                     $this->onContentAfterSaveCategories($context, $article, $isNew);
                     $this->createDirectory($article->id); 
                 }

             //Crear directorio ==============================================================
             if (($option=='com_content' && $view=="article"   )||($fontend))
             {
                 $this->createDirectory($article->id); 
             }
 
             //============================================================================
            //COPY AND SAVE LIKE COPY
            if( (JRequest::getVar("id") != $article->id && (!empty( $article->id))   && ($article->id>0) && (JRequest::getVar("id")>0))  ){
                $oldid = JRequest::getVar("id")  ; 
                $newid = $article->id;
                
                $db	= & JFactory::getDBO();
                //COPY __fieldsattach_values VALUES TABLE
                $query = 'SELECT * FROM #__fieldsattach_values as a  WHERE a.articleid = '. $oldid ;
                $db->setQuery( $query );
                $results= $db->loadObjectList();
                if($results){
                    foreach ($results as $result)
                    {
                        $query = 'SELECT * FROM #__fieldsattach_values as a  WHERE a.articleid = '. $newid.' AND a.fieldsid='.$result->fieldsid ;
                        $db->setQuery( $query );
                        $obj= $db->loadObject();
                        if($obj)
                        {
                            //update
                             $query = 'UPDATE  #__fieldsattach_values SET value="'.$result->valor.'" WHERE id='.$result->id ;
                             $db->setQuery($query);
                             $db->query();
							 
                            
                        }else{
                            //insert
                             $query = 'INSERT INTO #__fieldsattach_values(articleid,fieldsid,value) VALUES ('.$newid.',\''.  $result->fieldsid .'\',\''.$result->value.'\' )     ';
                             $db->setQuery($query);
                             $db->query();
                        }
                        
                    }
                }
 

                //COPY  fieldsattach_images GALLERIES-----------------------------
                $query = 'SELECT * FROM #__fieldsattach_images as a  WHERE a.articleid = '. $oldid ;
                $db->setQuery( $query );
                $results= $db->loadObjectList();
                if($results){
                    foreach ($results as $result)
                    {
                        $query = 'SELECT * FROM #__fieldsattach_images as a  WHERE a.articleid = '. $newid.' AND a.fieldsattachid='.$result->fieldsid ;
                        $db->setQuery( $query );
                        $obj= $db->loadObject();
                        if($obj)
                        {
                            //update
                             $query = 'UPDATE  #__fieldsattach_images SET image1="'.$result->title.'", image1="'.$result->image1.'", image2="'.$result->image2.'", image3="'.$result->image3.'", description="'.$result->description.'", ordering="'.$result->ordering.'", published="'.$result->published.'"  WHERE id='.$result->id ;
                             $db->setQuery($query);
                             $db->query();

                        }else{
                            //insert
                            $query = 'INSERT INTO #__fieldsattach_images(articleid,fieldsattachid,title,  image1, image2, image3, description, ordering, published) VALUES ('.$newid.',\''.  $result->fieldsattachid .'\',\''.$result->title.'\',\''.$result->image1.'\',\''.$result->image2.'\',\''.$result->image3.'\',\''.$result->description.'\',\''.$result->ordering.'\',\''.$result->published.'\' )     ';
                            $db->setQuery($query);
                             $db->query();
                        }
                    }
                }

                
                if(!$fontend){
                    //COPY  FOLDER -----------------------------
                    $app = JFactory::getApplication();
                    $path = $this->path;
                    $path = str_replace ("../", DS, $path);
                    $source = $sitepath . $path .DS.  $oldid.DS;
                    $dest = $sitepath.  $path .DS.  $newid.DS;
                    //JFolder::copy($source, $dest);
                    if(!JFolder::exists($dest))
                    {
                        JFolder::create($dest);
                    }
                     
                    $files =  JFolder::files($source);

                    foreach ($files as $file)
                    { 
                        if(Jfile::copy($source.$file, $dest.$file)) $app->enqueueMessage( JTEXT::_("Copy file ok:") . $file )   ;
                        else JError::raiseWarning( 100, "Cannot copy the file: ".  $source.$file." to ".$dest.$file );
                    }
                }

            }
            //END COPY AND SAVE============================================================================

            //Ver categorias del artículo ==============================================================
            //$idscat = $this->recursivecat($article->catid);
            /*fieldsattachHelper::recursivecat($article->catid, & $idscat);
            

            $query = 'SELECT a.id, a.type, b.recursive, b.catid FROM #__fieldsattach as a INNER JOIN #__fieldsattach_groups as b ON a.groupid = b.id WHERE b.catid IN ('. $idscat .') AND a.published=1 AND b.published = 1 ORDER BY a.ordering, a.title';
            $db->setQuery( $query );
            $nameslst = $db->loadObjectList();  

            //***********************************************************************************************
            //Mirar cual de los grupos es RECURSIVO  ****************  ****************  ****************
            //***********************************************************************************************
            $cont = 0;
            foreach ($nameslst as $field)
            {
                //JError::raiseWarning( 100, $field->catid ." !=".$article->catid  );
                if( $field->catid != $article->catid )
                {
                    //Mirar si recursivamente si
                    if(!$field->recursive)
                        {
                            //echo "ELIMINO DE LA LISTA " ;
                            unset($nameslst[$cont]);
                        }
                }
                $cont++;
            } 
             */
            
            if (($option=='com_content' && $layout=="edit" ) || $fontend)
                 {
            $db	= & JFactory::getDBO();
            $nameslst = fieldsattachHelper::getfields($article->id);
            
            

           // JError::raiseWarning( 100, "NUMEROOO: ". count($nameslst) ." - ".$article->catid );
            //***********************************************************************************************
            //create array of fields  ****************  ****************  ****************
            //***********************************************************************************************
            $fields_tmp0 = fieldsattachHelper::getfieldsForAll($article->id);
            $nameslst = array_merge($fields_tmp0, $nameslst );

            $fields_tmp2 = fieldsattachHelper::getfieldsForArticlesid($article->id, $nameslst);

            $nameslst = array_merge( $nameslst, $fields_tmp2 );
            
            //Si existen fields relacionados se mira uno a uno si tiene valores
            //JError::raiseWarning( 100, count($nameslst)  );
            if(count($nameslst)>0){
                foreach($nameslst as $obj)
                {
                    $query = 'SELECT a.id, b.required ,b.title, b.extras FROM #__fieldsattach_values as a INNER JOIN #__fieldsattach as b ON a.fieldsid = b.id WHERE a.articleid='.$article->id .' AND a.fieldsid ='. $obj->id ;
                    //echo $query;
                    
                    $db->setQuery($query);
                    $valueslst = $db->loadObject();
                    if(count($valueslst)==0)
                        {
                            //INSERT 
                           // $valor = JRequest::getVar("field_". $obj->id, '', 'post', null, JREQUEST_ALLOWHTML);
                            $valor = $_POST["field_". $obj->id]; 
                            if(is_array($valor))
                            {
                                $valortxt="";
                                for($i = 0; $i < count($valor); $i++ )
                                {

                                      $valortxt .=  $valor[$i].", ";
                                }
                                $valor = $valortxt;
                            }
                            
                            //remove vbad characters
                            $valor = preg_replace('/[^(\x20-\x7F)]*/','', $valor);
                            
                            //INSERT 
                            $query = 'INSERT INTO #__fieldsattach_values(articleid,fieldsid,value) VALUES ('.$article->id.',\''.  $obj->id .'\',\''.$valor.'\' )     ';
                            $db->setQuery($query);
                            $db->query();

                            //Select last id ----------------------------------
                            $query = 'SELECT  id  FROM #__fieldsattach_values AS a WHERE  a.articleid='.$article->id.' AND a.fieldsid='.$obj->id;
                            //echo $query;
                            $db->setQuery( $query );
                            $result = $db->loadObject();
                            $valueslst->id = $result->id; 
                            
                        }
                        else{
                            //UPDATE 
                            //$valor = JRequest::getVar("field_". $obj->id, '', 'post', null, JREQUEST_ALLOWHTML); 
                             $valor = $_POST["field_". $obj->id]; 
                             
                            if(is_array($valor))
                            { 
                                $valortxt="";
                                for($i = 0; $i < count($valor); $i++ )
                                { 
                                      $valortxt .=  $valor[$i].", ";
                                }
                                $valor = $valortxt;
                            }
                            
                            //remove vbad characters
                            //$valor = preg_replace('/[^(\x20-\x7F)]*/','', $valor);
                            
                            //$valor = str_replace('"','&quot;', $valor );
                            //$valor = htmlspecialchars($valor);
                            //Remove BAD characters ****
                            $valor = preg_replace('/border="*"*/','', $valor);
                            
                            $valor = htmlspecialchars($valor);
                            
                            $query = 'UPDATE  #__fieldsattach_values SET value="'.$valor.'" WHERE id='.$valueslst->id .' AND articleid='.$article->id ;
                            $db->setQuery($query);
                            //JError::raiseWarning( 100, $query  );
                            $db->query(); 
							
							 
						    
                        }

                        //Acción PLUGIN ========================================================
                        JPluginHelper::importPlugin('fieldsattachment'); // very important 
                        $query = 'SELECT *  FROM #__extensions as a WHERE a.element="'.$obj->type.'"  AND a.enabled= 1';
                        // JError::raiseWarning( 100, $obj->type." --- ". $query   );
                        $db->setQuery( $query );
                        $results = $db->loadObject();
                        if(!empty($results)){
                            
                            $function  = "plgfieldsattachment_".$obj->type."::action( ".$article->id.",".$obj->id.",".$valueslst->id.");";
                            //  JError::raiseWarning( 100,   $function   );
                            eval($function);
                        }
                }
                } 
            }

	    return true;
        }
示例#12
0
 /**
  * Copy the article with extrafields
  *
  * @access   public
  * @since    1.5
  */
 public function copyArticle($article, $oldid)
 {
     //JError::raiseWarning( 100, "Copy article ".$article->id . " old: ".$oldid );
     $app = JFactory::getApplication();
     //COPY AND SAVE LIKE COPY
     $newid = $article->id;
     if (!empty($oldid)) {
         $db = JFactory::getDBO();
         //COPY __fieldsattach_values VALUES TABLE
         //$query = 'INSERT INTO #__fieldsattach_values (articleid, fieldsid, value) SELECT ' . $newid . ', fieldsid, value FROM #__fieldsattach_values WHERE articleid = '. $oldid;
         //$db->setQuery( $query );
         //$db->query();
         //Log
         //plgSystemfieldsattachment::writeLog("function copyArticle log1: ".$query);
         $query = 'INSERT into #__fieldsattach_images (articleid, fieldsattachid, title,  image1, image2, image3, description, ordering, published)' . ' SELECT ' . $newid . ', fieldsattachid, title,  image1, image2, image3, description, ordering, published FROM #__fieldsattach_images WHERE articleid = ' . $oldid;
         $db->setQuery($query);
         $db->query();
         //copy documents and images
         $sitepath = JPATH_SITE;
         //COPY  FOLDER IMG-----------------------------
         $path = '/images/documents';
         if (JRequest::getVar('option') == 'com_categories' && JRequest::getVar('layout') == "edit" && JRequest::getVar('extension') == "com_content") {
             $path = '/images/documentscategories';
         }
         $source = $sitepath . $path . '/' . $oldid . '/';
         $dest = $sitepath . $path . '/' . $newid . '/';
         // progress only if source dir exists
         if (JFolder::exists($source)) {
             if (!JFolder::exists($dest)) {
                 JFolder::create($dest);
             }
             $files = JFolder::files($source);
             foreach ($files as $file) {
                 if (Jfile::copy($source . $file, $dest . $file)) {
                     $app->enqueueMessage(JTEXT::_("Copy file ok:") . $file);
                 } else {
                     JError::raiseWarning(100, "Cannot copy the file: " . $source . $file . " to " . $dest . $file);
                 }
             }
         }
     }
 }
示例#13
0
 /**
  *     *
  * @param string $path
  * @return bool
  */
 public static function writable($path)
 {
     return Jfile::isWritable($path);
 }
示例#14
0
 /**
  * Processing File(s)
  * @param array $options		The configuration array for the component
  * @param string $task  		a specific task (overrides $options)
  * @param mixed $file  		a specific filename or array of filenames to process (overrides $options)
  * @param string $redirect_task	the task to use when redirecting (blank means no redirection)
  * @param boolean $report	whether or not to report processing success/failure
  */
 function multitask($task = null, $file = null, $redirect_task = 'language_files', $report = true)
 {
     global $option;
     // variables
     $options = Language_manager::getOptions();
     //$task = strtolower( is_null($task) ? $this->_task : $task );
     // validate the task
     if ($task == 'cancel') {
         $task = 'checkin';
         $redirect_task = 'language_files';
         $report = false;
     }
     // validate the filename
     // 1: use a specific file or files
     // 2: use the client_lang
     // 3: check that we have at least one file
     if ($file) {
         $options['cid'] = is_array($file) ? $file : array($file);
     } else {
         if (empty($options['cid'][0]) && $task != 'checkin') {
             echo "<script> alert('" . JText::_('Please make a selection from the list to') . ' ' . JText::_(str_replace('xml', '', $task)) . "'); window.history.go(-1);</script>\n";
             exit;
         }
     }
     // initialise file classes
     jimport('joomla.filesystem.file');
     // initialise checkout file content
     if ($task == 'checkout') {
         $user =& JFactory::getUser();
         $chk_file_content = time() . '#' . $user->get('id', '0') . '#' . $user->get('name', '[ Unknown User ]');
     }
     // initialise variables
     global $mainframe;
     $file_list = array();
     $nofile_list = array();
     $inifile_list = array();
     $last = '';
     // process each passed file name (always the 'real' filename)
     foreach ($options['cid'] as $file) {
         // validate the filename language prefix
         if (preg_match('/^[a-z]{2,3}-[A-Z]{2}[.].*/', $file)) {
             // get the language and language path
             $lang = substr($file, 0, $options['langLen']);
             $langPath = JLanguage::getLanguagePath($options['basePath'], $lang);
             // ensure that XML files are only affected by XML tasks
             if (substr($file, -4) == '.xml' && substr($task, -3) != 'xml') {
                 // continue without error warning
                 continue;
             }
             // get file path-names
             $chk_file = 'chk.' . $file;
             $pub_file = $file;
             $unpub_file = 'xx.' . $file;
             // check for an unpublished file
             if (JFile::exists($langPath . DS . $unpub_file)) {
                 $file = $unpub_file;
             } else {
                 if (!JFile::exists($langPath . DS . $file)) {
                     // error and continue
                     $nofile_list[$file] = $file;
                     continue;
                 }
             }
             // cancel/checkin a file
             // checkout a file
             // delete a file
             // delete an XML file
             // publish a file
             // unpublish a file
             // otherwise break because the task isn't recognised
             if ($task == 'checkin' && JFile::exists($langPath . DS . $chk_file)) {
                 $do = JFile::delete($langPath . DS . $chk_file);
             } else {
                 if ($task == 'checkout') {
                     $do = Jfile::write($langPath . DS . $chk_file, $chk_file_content);
                 } else {
                     if ($task == 'remove') {
                         $do = JFile::delete($langPath . DS . $file);
                     } else {
                         if ($task == 'publish') {
                             $do = JFile::move($file, $pub_file, $langPath);
                         } else {
                             if ($task == 'unpublish') {
                                 $do = JFile::move($file, $unpub_file, $langPath);
                             } else {
                                 break;
                             }
                         }
                     }
                 }
             }
             // build an array of things to hide form the filename
             $filename_hide = array();
             // add the function to the file list on success
             if ($do) {
                 $file_list[$file] = str_replace('xx.' . $lang, $lang, substr($file, 0, -4));
             }
         }
     }
     if ($report) {
         // report processing success
         if (count($file_list)) {
             $mainframe->enqueueMessage(sprintf(JText::_($task . ' success'), count($file_list), implode(', ', $file_list)));
         }
         // report existing ini files
         if (count($inifile_list)) {
             $mainframe->enqueueMessage(sprintf(JText::_($task . ' inifile'), count($inifile_list), implode(', ', $inifile_list)));
         }
     }
     // redirect
     if ($redirect_task) {
         $mainframe->redirect('index.php?option=' . $option . '&client_lang=' . $options['client_lang'] . '&task=' . $redirect_task);
     }
 }
示例#15
0
 /**
  * Clean up unwanted stuff.
  *
  * @throws EcrExceptionZiper
  * @return EcrProjectZiper
  */
 private function cleanProject()
 {
     $this->logger->log('Starting CleanUp');
     $folders = JFolder::folders($this->temp_dir, '.', true, true);
     $files = JFolder::files($this->temp_dir, '.', true, true);
     $stdHtmlPath = ECRPATH_EXTENSIONTEMPLATES . DS . 'std' . DS . 'std_index.html';
     $cntIndex = 0;
     $cntAautoCode = 0;
     if ($this->preset->createIndexhtml) {
         foreach ($folders as $folder) {
             if (false == Jfile::exists($folder . DS . 'index.html')) {
                 JFile::copy($stdHtmlPath, $folder . DS . 'index.html');
                 $cntIndex++;
             }
         }
         $this->logger->log(sprintf('%s index.html files created', $cntIndex));
     }
     if ($this->preset->removeAutocode) {
         /**
          * @todo remove AutoCode
          */
     }
     //-- If we are building a "package package", override the preset settings from the package
     //-- with the setting from the request.
     if ($this->preset->includeEcrProjectfile && true == $this->buildopts['include_ecr_projectfile']) {
         $src = ECRPATH_SCRIPTS . DS . $this->project->getEcrXmlFileName();
         if (JFolder::exists($this->temp_dir . DS . 'admin')) {
             $dst = $this->temp_dir . DS . 'admin' . DS . 'easycreator.xml';
         } else {
             if (JFolder::exists($this->temp_dir . DS . 'site')) {
                 $dst = $this->temp_dir . DS . 'site' . DS . 'easycreator.xml';
             } else {
                 $s = JFile::getName($src);
                 if (substr($s, 0, 3) == 'pkg') {
                     //-- EasyCreator project file for packages goes to packageroot..
                     $dst = $this->temp_dir . DS . 'easycreator.xml';
                 } else {
                     throw new EcrExceptionZiper(__METHOD__ . ' - Neither admin or site dir found - Failed to copy EasyCreator project xml');
                 }
             }
         }
         if (false == JFile::copy($src, $dst)) {
             throw new EcrExceptionZiper(sprintf('%s - %s &rArr; %s Failed to copy EasyCreator project xml', __METHOD__, $src, $dst));
         }
         $this->logger->log('EasyCreator project xml copied');
     }
     //-- Look for unwanted files
     $unwanted = array('Thumbs.db');
     foreach ($files as $file) {
         foreach ($unwanted as $item) {
             //-- Simple check if the full path contains an 'unwanted' string
             if (strpos($file, $item)) {
                 $this->logger->log('Removing unwanted ' . $item . ' at ' . $file);
                 if (false == JFile::delete($file)) {
                     $this->logger->log('Unable to remove ' . $file, 'ERROR');
                 }
             }
         }
     }
     //-- Clean up language version files
     $paths = array('admin/language', 'site/language');
     $cnt = 0;
     foreach ($paths as $path) {
         if (false == JFolder::exists($this->temp_dir . '/' . $path)) {
             continue;
         }
         $files = JFolder::files($this->temp_dir . '/' . $path, '.', true, true);
         foreach ($files as $file) {
             if ('ini' != JFile::getExt($file) && 'html' != JFile::getExt($file)) {
                 if (false == JFile::delete($file)) {
                     throw new EcrExceptionZiper(__METHOD__ . ' - Can not delete language version file: ' . $file);
                 }
                 $cnt++;
             }
         }
     }
     $this->logger->log(sprintf('%d language version files deleted', $cnt));
     return $this;
 }
示例#16
0
    public function getPrettyPhoto($type, $source, $width = 50, $height = 50, $option = 'smart', $quality = 90, $theme = 'facebook', $padding = 10, $opacity = '0.8', $title = false, $speed = 'normal', $user = false, $apikey = false, $setid = false, $number = false, $extlink)
    {
        // Import libraries
        jimport('joomla.filesystem.file');
        jimport('joomla.filesystem.folder');
        //define variables
        $show_title = $title === false ? false : true;
        $html = '';
        switch ($type) {
            case 'popup':
                if (Jfile::exists($source) === false) {
                    return;
                }
                $html .= '<script type="text/javascript" charset="utf-8">
				(function($) {
				$(document).ready(function(){
				$("a[rel^=\'prettyPhoto\']").prettyPhoto({
				animation_speed: "' . $speed . '",
				slideshow: false, 
				autoplay_slideshow: false,
				opacity: "' . $opacity . '", 
				show_title: "' . $show_title . '",
				allow_resize: true,
				default_width: 500,
				default_height: 350,
				counter_separator_label: "/", 
				theme: "' . $theme . '",
				hideflash: false, 
				wmode: "opaque", 
				autoplay: true,
				modal: false,
				overlay_gallery: true,
				keyboard_shortcuts: true
				});
				})})(jQuery);</script>';
                $resized = resizeImageHelper::getResizedImage($source, $width, $height, $option, $quality);
                $html .= '<a href="' . $source . '" rel="prettyPhoto" title="' . $title . '"><img src="' . $resized . '" class="thumbnail" alt="' . $title . '" border="0" title="' . $title . '"></a>';
                break;
            case "iframe":
                //if (Jfile::exists($source)===false){return;}
                //if (Jfile::exists($source)===false){return;}
                //define variables
                $show_title = $title === false ? false : true;
                $extlink = 'http://' . str_replace('http://', '', trim($extlink));
                $html .= '<script type="text/javascript" charset="utf-8">
				(function($) {
				$(document).ready(function(){
				$("a[rel^=\'prettyPhoto[iframes]\']").prettyPhoto({
				animation_speed: "' . $speed . '",
				slideshow: false, 
				autoplay_slideshow: false,
				opacity: "' . $opacity . '", 
				show_title: "' . $show_title . '",
				allow_resize: true,
				default_width: 500,
				default_height: 350,
				counter_separator_label: "/", 
				theme: "' . $theme . '",
				hideflash: false, 
				wmode: "opaque", 
				autoplay: true,
				modal: false,
				overlay_gallery: true,
				keyboard_shortcuts: true
				});
				})})(jQuery);</script>';
                $resized = resizeImageHelper::getResizedImage($source, $width, $height, $option, $quality);
                $html .= '<a href="' . $extlink . '?iframe=true&width=100%&height=100%" rel="prettyPhoto[iframes]" title="' . $title . '"><img src="' . $resized . '" class="thumbnail" alt="' . $title . '" border="0" title="' . $title . '"></a>';
                break;
            case "inline":
                $html .= '<script type="text/javascript" charset="utf-8">
				(function($) {
				$(document).ready(function(){
				$("a[rel^=\'prettyPhoto[inline]\']").prettyPhoto({
				animation_speed: "' . $speed . '",
				slideshow: false, 
				autoplay_slideshow: false,
				opacity: "' . $opacity . '", 
				show_title: "' . $show_title . '",
				allow_resize: true,
				default_width: 500,
				default_height: 350,
				counter_separator_label: "/", 
				theme: "' . $theme . '",
				hideflash: false, 
				wmode: "opaque", 
				autoplay: true,
				modal: false,
				overlay_gallery: true,
				keyboard_shortcuts: true
				});
				})})(jQuery);</script>';
                $html .= '<div class="pp_inline clearfix">{content}</div>';
                $html .= '<a href="#inline-1" rel="prettyPhoto" ><img src="/wp-content/themes/NMFE/images/thumbnails/earth-logo.jpg" alt="" width="50" /></a>
		<div id="inline-1" class="hide">
			<p>This is inline content opened in prettyPhoto.</p>
			<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p></div>
		</div>';
                break;
            case "quicktime":
                $html .= '<script type="text/javascript" charset="utf-8">
				(function($) {
				$(document).ready(function(){
				$("a[rel^=\'prettyPhoto\']").prettyPhoto({
				animation_speed: "' . $speed . '",
				slideshow: false, 
				autoplay_slideshow: false,
				opacity: "' . $opacity . '", 
				show_title: "' . $show_title . '",
				allow_resize: true,
				default_width: 500,
				default_height: 350,
				counter_separator_label: "/", 
				theme: "' . $theme . '",
				hideflash: false, 
				wmode: "opaque", 
				autoplay: true,
				modal: false,
				overlay_gallery: true,
				keyboard_shortcuts: true
				});
				})})(jQuery);</script>';
                $html .= '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>';
                break;
            case "flash":
                $html .= '<script type="text/javascript" charset="utf-8">
				(function($) {
				$(document).ready(function(){
				$("a[rel^=\'prettyPhoto\']").prettyPhoto({
				animation_speed: "' . $speed . '",
				slideshow: false, 
				autoplay_slideshow: false,
				opacity: "' . $opacity . '", 
				show_title: "' . $show_title . '",
				allow_resize: true,
				default_width: 500,
				default_height: 350,
				counter_separator_label: "/", 
				theme: "' . $theme . '",
				hideflash: false, 
				wmode: "opaque", 
				autoplay: true,
				modal: false,
				overlay_gallery: true,
				keyboard_shortcuts: true
				});
				})})(jQuery);</script>';
                $html .= '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>';
                break;
            case "flickr":
                $html .= '<script type="text/javascript" charset="utf-8">
				(function($) {
				$(document).ready(function(){
				$("a[rel^=\'prettyPhoto\']").prettyPhoto({
				animation_speed: "' . $speed . '",
				slideshow: false, 
				autoplay_slideshow: false,
				opacity: "' . $opacity . '", 
				show_title: "' . $show_title . '",
				allow_resize: true,
				default_width: 500,
				default_height: 350,
				counter_separator_label: "/", 
				theme: "' . $theme . '",
				hideflash: false, 
				wmode: "opaque", 
				autoplay: true,
				modal: false,
				overlay_gallery: true,
				keyboard_shortcuts: true
				});
				})})(jQuery);</script>';
                break;
            case "picasa":
                $html .= '<script type="text/javascript" charset="utf-8">
				(function($) {
				$(document).ready(function(){
				$("a[rel^=\'prettyPhoto\']").prettyPhoto({
				animation_speed: "' . $speed . '",
				slideshow: false, 
				autoplay_slideshow: false,
				opacity: "' . $opacity . '", 
				show_title: "' . $show_title . '",
				allow_resize: true,
				default_width: 500,
				default_height: 350,
				counter_separator_label: "/", 
				theme: "' . $theme . '",
				hideflash: false, 
				wmode: "opaque", 
				autoplay: true,
				modal: false,
				overlay_gallery: true,
				keyboard_shortcuts: true
				});
				})})(jQuery);</script>';
                break;
            case "gallery":
                if (Jfolder::exists($source) === false) {
                    return;
                }
                $html .= '<script type="text/javascript" charset="utf-8">
				(function($) {
				$(document).ready(function(){
				$("a[rel^=\'prettyPhoto\']").prettyPhoto({
				animation_speed: "' . $speed . '",
				slideshow: false, 
				autoplay_slideshow: false,
				opacity: "' . $opacity . '", 
				show_title: "' . $show_title . '",
				allow_resize: true,
				default_width: 500,
				default_height: 350,
				counter_separator_label: "/", 
				theme: "' . $theme . '",
				hideflash: false, 
				wmode: "opaque", 
				autoplay: true,
				modal: false,
				overlay_gallery: true,
				keyboard_shortcuts: true
				});
				})})(jQuery);</script>';
                $html .= '<div class="pp_gallery">
									<a href="#" class="pp_arrow_previous">Previous</a>
									<ul>
										{gallery}
									</ul>
									<a href="#" class="pp_arrow_next">Next</a>
								</div>';
                break;
            case "slideshow":
                if (Jfolder::exists($source) === false) {
                    return;
                }
                $html .= '<script type="text/javascript" charset="utf-8">
				(function($) {
				$(document).ready(function(){
				$("a[rel^=\'prettyPhoto\']").prettyPhoto({
				animation_speed: "' . $speed . '",
				slideshow: false, 
				autoplay_slideshow: false,
				opacity: "' . $opacity . '", 
				show_title: "' . $show_title . '",
				allow_resize: true,
				default_width: 500,
				default_height: 350,
				counter_separator_label: "/", 
				theme: "' . $theme . '",
				hideflash: false, 
				wmode: "opaque", 
				autoplay: true,
				modal: false,
				overlay_gallery: true,
				keyboard_shortcuts: true
				});
				})})(jQuery);</script>';
                $html .= '<div class="pp_pic_holder">
							<div class="ppt">&nbsp;</div>
							<div class="pp_top">
								<div class="pp_left"></div>
								<div class="pp_middle"></div>
								<div class="pp_right"></div>
							</div>
							<div class="pp_content_container">
								<div class="pp_left">
								<div class="pp_right">
									<div class="pp_content">
										<div class="pp_loaderIcon"></div>
										<div class="pp_fade">
											<a href="#" class="pp_expand" title="Expand the image">Expand</a>
											<div class="pp_hoverContainer">
												<a class="pp_next" href="#">next</a>
												<a class="pp_previous" href="#">previous</a>
											</div>
											<div id="pp_full_res"></div>
											<div class="pp_details clearfix">
												<p class="pp_description"></p>
												<a class="pp_close" href="#">Close</a>
												<div class="pp_nav">
													<a href="#" class="pp_arrow_previous">Previous</a>
													<p class="currentTextHolder">0/0</p>
													<a href="#" class="pp_arrow_next">Next</a>
												</div>
											</div>
										</div>
									</div>
								</div>
								</div>
							</div>
							<div class="pp_bottom">
								<div class="pp_left"></div>
								<div class="pp_middle"></div>
								<div class="pp_right"></div>
							</div>
						</div>
						<div class="pp_overlay"></div>';
                break;
        }
        return $html;
    }
* @package CQI - Custom Quick Icons 2.1.0
* @author michael (mic) pagler
* @copyright (C) 2006/7/8 mic [ http://ww.joomx.com ]
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
// load the component language file
$language =& JFactory::getLanguage();
$language->load('com_customquickicons');
$database =& JFactory::getDBO();
$dir = JPATH_ADMINISTRATOR . DS . 'modules' . DS;
$msg = '';
// delete module files
JFile::delete($dir . 'mod_customquickicons' . DS . 'mod_customquickicons.php');
Jfile::delete($dir . 'mod_customquickicons' . DS . 'mod_customquickicons.xml');
JFolder::delete($dir . 'mod_customquickicons');
// delete db.entry
$query = 'DELETE FROM #__modules' . ' WHERE module = \'mod_customquickicons\'';
$database->setQuery($query);
$database->query();
// set original module active (if not deleted)
$query = 'SELECT id' . ' FROM #__modules' . ' WHERE module = \'mod_quickicon\'';
$database->setQuery($query);
$id = $database->loadResult();
if ($id) {
    $query = 'UPDATE #__modules' . ' SET published = \'1\'' . ' WHERE id = ' . $id . ' LIMIT 1';
    $database->setQuery($query);
    if ($database->query()) {
        $msg .= JTEXT::_('Original module activated');
    }