function com_uninstall() { require_once JPATH_ROOT . '/components/com_community/defines.community.php'; $asset = JTable::getInstance('Asset'); if ($asset->loadByName('com_community')) { $asset->delete(); } $db = JFactory::getDBO(); // Remove jomsocialuser plugin during uninstall to prevent error // during login/logout of Joomla. $query = 'DELETE FROM ' . $db->quoteName(PLUGIN_TABLE_NAME) . ' ' . 'WHERE ' . $db->quoteName('element') . '=' . $db->quote('jomsocialuser') . ' AND ' . $db->quoteName('folder') . '=' . $db->quote('user'); $db->setQuery($query); $db->query(); $pluginPath = JPATH_ROOT . '/plugins/user/jomsocialuser/'; if (JFile::exists($pluginPath . 'jomsocialuser.php')) { JFile::delete($pluginPath . 'jomsocialuser.php'); } if (JFile::exists($pluginPath . 'jomsocialuser.xml')) { JFile::delete($pluginPath . 'jomsocialuser.xml'); } removeBackupTemplate('blueface'); removeBackupTemplate('bubble'); removeBackupTemplate('blackout'); return true; }
private function deleteHelpManifest($parent) { jimport('joomla.filesystem.file'); $installer = $parent->getParent(); $manifestFile = basename($installer->getPath('manifest')); JFile::delete(JPATH_ROOT . '/modules/mod_ariextmenu/' . $manifestFile); }
public function setImage($path, $type = 'thumb') { CError::assert($path, '', '!empty', __FILE__, __LINE__); $db = $this->getDBO(); // Fix the back quotes $path = CString::str_ireplace('\\', '/', $path); $type = JString::strtolower($type); // Test if the record exists. $oldFile = $this->{$type}; if ($db->getErrorNum()) { JError::raiseError(500, $db->stderr()); } if ($oldFile) { // File exists, try to remove old files first. $oldFile = CString::str_ireplace('/', '/', $oldFile); // If old file is default_thumb or default, we should not remove it. // // Need proper way to test it if (!JString::stristr($oldFile, 'group.jpg') && !JString::stristr($oldFile, 'group_thumb.jpg') && !JString::stristr($oldFile, 'default.jpg') && !JString::stristr($oldFile, 'default_thumb.jpg')) { jimport('joomla.filesystem.file'); JFile::delete($oldFile); } } $this->{$type} = $path; $this->store(); }
/** * Clear cache * @param $group */ public function clear($group) { $file = JPATH_SITE . '/cache/jbzoo/' . $group; if (JFile::exists($file)) { JFile::delete($file); } }
private function _removeObsoleteFilesAndFolders($icagendaRemoveFiles) { // Remove files jimport('joomla.filesystem.file'); if (!empty($icagendaRemoveFiles['files'])) { foreach ($icagendaRemoveFiles['files'] as $file) { $f = JPATH_ROOT . '/' . $file; if (!JFile::exists($f)) { continue; } JFile::delete($f); } } // Remove folders jimport('joomla.filesystem.file'); if (!empty($icagendaRemoveFiles['folders'])) { foreach ($icagendaRemoveFiles['folders'] as $folder) { $f = JPATH_ROOT . '/' . $folder; if (!JFolder::exists($f)) { continue; } JFolder::delete($f); } } }
public function display($tpl = null) { $model = $this->getModel(); $xmlContent = $model->backupAssets(); $sqlContent = $model->backupSql(); $version = JFactory::getDate()->toUnix(); $xmlFilePath = JFactory::getConfig()->get('tmp_path') . '/' . 'xml-' . $version . '.xml'; $sqlFilePath = JFactory::getConfig()->get('tmp_path') . '/' . 'sql-' . $version . '.sql'; JFile::write($xmlFilePath, $xmlContent); JFile::write($sqlFilePath, $sqlContent); $fileDownloadName = 'solidres' . $version . '.zip'; SRFactory::get('solidres.utilities.ziparchive')->zipFiles(array($xmlFilePath, $sqlFilePath), JFactory::getConfig()->get('tmp_path') . '/' . $fileDownloadName); JFile::delete($xmlFilePath); JFile::delete($sqlFilePath); //make file to download header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename="' . $fileDownloadName); header("Content-Transfer-Encoding: binary"); header('Accept-Ranges: bytes'); header("Cache-control: private"); header('Pragma: private'); header("Expires: " . JFactory::getDate()->toSql()); header("Content-Length: " . filesize(JFactory::getConfig()->get('tmp_path') . '/' . $fileDownloadName)); ob_clean(); flush(); readfile(JFactory::getConfig()->get('tmp_path') . '/' . $fileDownloadName); JFile::delete(JFactory::getConfig()->get('tmp_path') . '/' . $fileDownloadName); }
function __construct($parent) { if ($parent->API->get('recompile_css', 0) == 1) { // remove old Template CSS files jimport('joomla.filesystem.file'); JFile::delete($parent->API->URLtemplatepath() . '/css/global.css'); JFile::delete($parent->API->URLtemplatepath() . '/css/default.css'); JFile::delete($parent->API->URLtemplatepath() . '/css/print.css'); JFile::delete($parent->API->URLtemplatepath() . '/css/mail.css'); JFile::delete($parent->API->URLtemplatepath() . '/css/error.css'); JFile::delete($parent->API->URLtemplatepath() . '/css/offline.css'); JFile::delete($parent->API->URLtemplatepath() . '/css/override.css'); // generate new Template CSS files try { // normal Template code $less = new DSCTemplateHelperLessc(); $less->checkedCompile($parent->API->URLtemplatepath() . '/less/global.less', $parent->API->URLtemplatepath() . '/css/global.css'); $less->checkedCompile($parent->API->URLtemplatepath() . '/less/default.less', $parent->API->URLtemplatepath() . '/css/default.css'); $less->checkedCompile($parent->API->URLtemplatepath() . '/less/print.less', $parent->API->URLtemplatepath() . '/css/print.css'); $less->checkedCompile($parent->API->URLtemplatepath() . '/less/mail.less', $parent->API->URLtemplatepath() . '/css/mail.css'); // additional Template code $less->checkedCompile($parent->API->URLtemplatepath() . '/less/error.less', $parent->API->URLtemplatepath() . '/css/error.css'); $less->checkedCompile($parent->API->URLtemplatepath() . '/less/offline.less', $parent->API->URLtemplatepath() . '/css/offline.css'); $less->checkedCompile($parent->API->URLtemplatepath() . '/less/override.less', $parent->API->URLtemplatepath() . '/css/override.css'); } catch (exception $ex) { exit('LESS Parser fatal error:<br />' . $ex->getMessage()); } } }
/** * Execute the application. * * @throws Exception * * @return void */ public function doExecute() { jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); $this->out(); $this->out('EasyCreator BuildHelper'); $this->out('======================='); $this->out(); $dir = $this->input->get('dir', false, 'string'); $ecrBase = $dir . '/admin'; $this->out('Base: ' . $ecrBase); $folders = array('data/builds', 'data/deploy', 'data/exports', 'data/logs', 'data/results', 'data/projects', 'data/sync', 'tests'); $cntAll = 0; foreach ($folders as $folder) { $cnt = 0; if (false == JFolder::exists($ecrBase . '/' . $folder)) { continue; } $files = JFolder::files($ecrBase . '/' . $folder, '.', true, true, array('readme.md')); foreach ($files as $file) { if (false == JFile::delete($file)) { throw new Exception('Can not delete file: ' . $file, 2); } $cnt++; } $cntAll += $cnt; $this->out(sprintf('%4d EasyCreator files have been deleted in %s', $cnt, $folder)); } $this->out(sprintf('%4d files total', $cntAll)); }
/** * Method to run after installing the component */ function postflight($type, $parent) { //Restore the modified language strings by merging to language files $registry = new JRegistry(); foreach (self::$languageFiles as $languageFile) { $backupFile = JPATH_ROOT . '/language/en-GB/bak.' . $languageFile; $currentFile = JPATH_ROOT . '/language/en-GB/' . $languageFile; if (JFile::exists($currentFile) && JFile::exists($backupFile)) { $registry->loadFile($currentFile, 'INI'); $currentItems = $registry->toArray(); $registry->loadFile($backupFile, 'INI'); $backupItems = $registry->toArray(); $items = array_merge($currentItems, $backupItems); $content = ""; foreach ($items as $key => $value) { $content .= "{$key}=\"{$value}\"\n"; } JFile::write($currentFile, $content); } } // Restore custom modified css file if (JFile::exists(JPATH_ROOT . '/components/com_osmembership/assets/css/bak.custom.css')) { JFile::copy(JPATH_ROOT . '/components/com_osmembership/assets/css/bak.custom.css', JPATH_ROOT . '/components/com_osmembership/assets/css/custom.css'); JFile::delete(JPATH_ROOT . '/components/com_osmembership/assets/css/bak.custom.css'); } }
public function uninstall($adapter) { jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); // Delete plugin files $folder = JPATH_PLUGINS . '/system/' . $this->_ext; if (JFolder::exists($folder)) { JFolder::delete($folder); } // Delete plugin language files $lang_folder = JPATH_ADMINISTRATOR . '/language'; $languages = JFolder::folders($lang_folder); foreach ($languages as $lang) { $file = $lang_folder . '/' . $lang . '/' . $lang . '.plg_system_' . $this->_ext . '.ini'; if (JFile::exists($file)) { JFile::delete($file); } $file = $lang_folder . '/' . $lang . '/' . $lang . '.plg_system_' . $this->_ext . '.sys.ini'; if (JFile::exists($file)) { JFile::delete($file); } } $db = JFactory::getDbo(); $query = $db->getQuery(true)->delete('#__extensions')->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))->where($db->quoteName('element') . ' = ' . $db->quote($this->_ext)); $db->setQuery($query); $db->execute(); }
function delete_anunt($id, $uid) { $db = JFactory::getDbo(); jimport('joomla.filesystem.file'); $query = "SELECT * FROM #__sa_poze WHERE `id_anunt` = '" . $id . "'"; $db->setQuery($query); $pics = $db->loadObjectList(); $path = JPATH_ROOT . DS . 'components' . DS . 'com_sauto' . DS . 'assets' . DS . 'users' . DS . $uid . DS; foreach ($pics as $p) { echo '>>>> ' . $p->poza . '<br />'; //delete fisier $path_delete = $path . $p->poza; JFile::delete($path_delete); //delete from db $query = "DELETE FROM #__sa_poze WHERE `id` = '" . $p->id . "'"; $db->setQuery($query); $db->query(); } //delete anunt $query = "DELETE FROM #__sa_anunturi WHERE `id` = '" . $id . "'"; $db->setQuery($query); $db->query(); $app =& JFactory::getApplication(); $link_ok = JRoute::_('index.php?option=com_sauto&view=my_request'); $app->redirect($link_ok, JText::_('SAUTO_ANUNT_STERS_CU_SUCCES')); }
/** * Support Zip files for image galleries * @see TiendaFile::upload() */ function upload() { if ($result = parent::upload()) { // Check if it's a supported archive $allowed_archives = array('zip', 'tar', 'tgz', 'gz', 'gzip', 'tbz2', 'bz2', 'bzip2'); if (in_array(strtolower($this->getExtension()), $allowed_archives)) { $dir = $this->getDirectory(); jimport('joomla.filesystem.archive'); JArchive::extract($this->full_path, $dir); JFile::delete($this->full_path); $this->is_archive = true; $files = JFolder::files($dir); // Thumbnails support if (count($files)) { // Name correction foreach ($files as &$file) { $file = new TiendaImage($dir . '/' . $file); } $this->archive_files = $files; $this->physicalname = $files[0]->getPhysicalname(); } } } return $result; }
/** * Delete the files, and removes them from filesystem table, marks them in the log as 'deleted' * Note that processed items are removed from buffer * @return int|boolean number of deleted files, FALSE on error */ function delete() { $count = 0; if (!empty($this->_deleteLogs)) { list($files, $ids) = $this->_getFilesAndIds($this->_deleteLogs); foreach ($files as $file) { if (JFile::exists($file)) { if (!JFile::delete($file)) { $this->setError(JText::_('Cannot delete file') . ': ' . $file); $this->_deleteLogs = array(); return false; } $count++; } } if (count($ids)) { $this->setLogStatus($ids, 'deleted'); } $this->removeFromFilesystemTable($files); $this->setLogStatus($ids, 'deleted'); } // Empty the buffer $this->_deleteLogs = array(); return true; }
public function __construct($config = array()) { parent::__construct($config); // make sure ZOO exist jimport('joomla.filesystem.file'); if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_zoo/config.php') || !JComponentHelper::getComponent('com_zoo', true)->enabled) { return; } // load zoo require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php'; $this->app = App::getInstance('zoo'); // Load from cache require_once JPATH_ADMINISTRATOR . '/components/com_zlmanager/helpers/cparams.php'; require_once JPATH_ADMINISTRATOR . '/components/com_zlmanager/helpers/download.php'; $username = ZLManagerHelperCparams::getParam('username', ''); $password = ZLManagerHelperCparams::getParam('password', ''); $key = md5($username . ':' . $password); $cache = $this->getCache($key); if (!$cache || !($json = $cache->get('json'))) { $url = 'https://www.zoolanders.com/index.php?option=com_zoo&controller=zooextensions&task=getList&format=raw&username='******'&password='******'/tmp/zlmanager.json'; ZLManagerDownloadHelper::download($url, $file); $json = JFile::read($file); JFile::delete($file); if ($cache) { $cache->set('json', $json)->save(); } } $this->_json = json_decode($json); $this->setState('limit', 50); }
public function delete() { /* * получаем имя файла из записи по ID * удаляем файл * выполняем родительский метод */ $cid = JFactory::getApplication()->input->get('cid', array(), 'array'); if (is_array($cid) && count($cid) > 0) { $arFilesToDelete = array(); foreach ($cid as $id) { $db = JFactory::getDBO(); $q = "SELECT `id`, `filename` FROM #__downfiles WHERE id = {$id}"; $res = $db->setQuery($q); $data_row = $res->loadAssoc(); $arFilesToDelete[] = $data_row["filename"]; } jimport('joomla.filesystem.file'); foreach ($arFilesToDelete as $fname) { JFile::delete(JPATH_ROOT . '/' . $fname); } } else { JLog::add(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), JLog::WARNING, 'jerror'); } parent::delete(); }
public function map(&$file, $index, &$contents) { // Store the file to a temporary location $file['tmp_name'] = $this->tmp . '/' . md5($file['name']); JFile::write($file['tmp_name'], $file['data']); // Load up media manager now $mm = EB::mediamanager(); $result = $mm->upload($file, 'user:'******'name']; $url = $this->absoluteUrl . '/' . $file['name']; // Get the properties from media manager result if (is_object($result) && property_exists($result, 'title')) { $title = $result->title; $url = $result->url; } // Once the attachment is already uploaded, we want to delete the temporary file now JFile::delete($file['tmp_name']); // Check if a file id is provided in the email if (isset($file['id']) && !empty($file['id'])) { $fileId = $file['id']; $fileId = str_replace('<', '', $fileId); $fileId = str_replace('>', '', $fileId); $patterns = array('/<div><img[^>]*src="[A-Za-z0-9:^>]*' . $fileId . '"[^>]*\\/><\\/div>/si', '/<img[^>]*src="[A-Za-z0-9:^>]*' . $fileId . '"[^>]*\\/>/si'); $replace = array('', ''); $contents = preg_replace($patterns, $replace, $contents); } // Now we need to insert the pdf links into the content $template = EB::template(); $template->set('title', $title); $template->set('url', $url); $output = $template->output('site/mailpublishing/template.pdf'); $contents .= $output; }
/** * Pre-processor for $table->delete($pk) * * @param mixed $pk An optional primary key value to delete. If not set the instance property value is used. * * @return void * * @since 3.1.2 * @throws UnexpectedValueException */ public function onAfterDelete($pk) { $params = JComponentHelper::getParams('com_gamification'); /** @var $params Joomla\Registry\Registry */ $filesystemHelper = new Prism\Filesystem\Helper($params); $mediaFolder = $filesystemHelper->getMediaFolder(); if ($this->table->get('image') !== null and $this->table->get('image') !== '') { $file = JPath::clean(JPATH_ROOT . DIRECTORY_SEPARATOR . $mediaFolder . DIRECTORY_SEPARATOR . $this->table->get('image')); if (JFile::exists($file)) { JFile::delete($file); } } if ($this->table->get('image_small') !== null and $this->table->get('image_small') !== '') { $file = JPath::clean(JPATH_ROOT . DIRECTORY_SEPARATOR . $mediaFolder . DIRECTORY_SEPARATOR . $this->table->get('image_small')); if (JFile::exists($file)) { JFile::delete($file); } } if ($this->table->get('image_square') !== null and $this->table->get('image_square') !== '') { $file = JPath::clean(JPATH_ROOT . DIRECTORY_SEPARATOR . $mediaFolder . DIRECTORY_SEPARATOR . $this->table->get('image_square')); if (JFile::exists($file)) { JFile::delete($file); } } }
function __construct($parent) { if ($parent->API->get('recompile_css', 0) == 1) { // remove old Template CSS files jimport('joomla.filesystem.file'); JFile::delete($parent->API->URLtemplatepath() . DS . 'css' . DS . 'template.css'); JFile::delete($parent->API->URLtemplatepath() . DS . 'css' . DS . 'override.css'); JFile::delete($parent->API->URLtemplatepath() . DS . 'css' . DS . 'error.css'); JFile::delete($parent->API->URLtemplatepath() . DS . 'css' . DS . 'print.css'); JFile::delete($parent->API->URLtemplatepath() . DS . 'css' . DS . 'mail.css'); // generate new Template CSS files try { // normal Template code lessc::ccompile($parent->API->URLtemplatepath() . DS . 'less' . DS . 'main.less', $parent->API->URLtemplatepath() . DS . 'css' . DS . 'template.css'); lessc::ccompile($parent->API->URLtemplatepath() . DS . 'less' . DS . 'print.less', $parent->API->URLtemplatepath() . DS . 'css' . DS . 'print.css'); lessc::ccompile($parent->API->URLtemplatepath() . DS . 'less' . DS . 'mail.less', $parent->API->URLtemplatepath() . DS . 'css' . DS . 'mail.css'); // additional Template code lessc::ccompile($parent->API->URLtemplatepath() . DS . 'less' . DS . 'error.less', $parent->API->URLtemplatepath() . DS . 'css' . DS . 'error.css'); lessc::ccompile($parent->API->URLtemplatepath() . DS . 'less' . DS . 'offline.less', $parent->API->URLtemplatepath() . DS . 'css' . DS . 'offline.css'); lessc::ccompile($parent->API->URLtemplatepath() . DS . 'less' . DS . 'override.less', $parent->API->URLtemplatepath() . DS . 'css' . DS . 'override.css'); } catch (exception $ex) { exit('LESS Parser fatal error:<br />' . $ex->getMessage()); } } }
/** * Method to perform sanity checks on the JTable instance properties to ensure * they are safe to store in the database. Child classes should override this * method to make sure the data they are storing in the database is safe and * as expected before storage. * * @return boolean True if the instance is sane and able to be stored in the database. * * @link http://docs.joomla.org/JTable/check * @since 11.1 */ public function check() { $input = JFactory::getApplication()->input; $file = $input->files->get('jform', '', 'ARRAY'); $post = $input->post->get('jform', '', 'ARRAY'); $bookId = $post['book_id']; $file = $file['audio_upload']; if (empty($file['error'])) { // Make the filename safe $audioFile = JFile::makeSafe($file['name']); $fileExt = explode('.', $audioFile); if (isset($audioFile)) { $filepath = JPath::clean(JPATH_SITE . '/media/englishconcept/media/audio/' . strtolower(md5($bookId . $file['name'])) . '.' . $fileExt[1]); $objectFile = new JObject($file); $objectFile->filepath = $filepath; if (JFile::exists($objectFile->filepath)) { JFile::delete($objectFile->filepath); } if (!JFile::upload($objectFile->tmp_name, $objectFile->filepath)) { return false; } } } return true; }
public function load($config) { JLoader::import('joomla.registry.registry'); JLoader::import('joomla.filesystem.file'); if (array_key_exists('path', $config)) { $path = $config['path']; } else { $path = JPATH_CACHE; } $extname = $config['extensionName']; $filename = "{$path}/{$extname}.updates.php"; // Kill old files $filenameKill = "{$path}/{$extname}.updates.ini"; if (JFile::exists($filenameKill)) { JFile::delete($filenameKill); } $this->filename = $filename; $this->extname = $extname; $this->registry = new JRegistry('update'); if (JFile::exists($this->filename)) { // Workaround for broken JRegistryFormatPHP API... @(include_once $this->filename); $className = 'LiveUpdate' . ucwords($extname) . 'Cache'; if (class_exists($className)) { $object = new $className(); $this->registry->loadObject($object); } } }
public function uninstall($parent) { // Remove all Nucleus files manually as file installer only uninstalls files. $manifest = $parent->getManifest(); // Loop through all elements and get list of files and folders foreach ($manifest->fileset->files as $eFiles) { $target = (string) $eFiles->attributes()->target; $targetFolder = empty($target) ? JPATH_ROOT : JPATH_ROOT . '/' . $target; // Check if all children exists if (count($eFiles->children()) > 0) { // Loop through all filenames elements foreach ($eFiles->children() as $eFileName) { if ($eFileName->getName() == 'folder') { $folder = $targetFolder . '/' . $eFileName; $files = JFolder::files($folder, '.', false, true); foreach ($files as $name) { JFile::delete($name); } $subFolders = JFolder::folders($folder, '.', false, true); foreach ($subFolders as $name) { JFolder::delete($name); } } } } } return true; }
function delete($oid = null) { jimport('joomla.filesystem.file'); if ($oid) { $this->load($oid); } $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('picture'); $query->from('#__bid_pictures'); $query->where('auction_id = ' . $db->quote($this->id)); $db->setQuery($query); $images = $db->loadObjectList(); if (count($images)) { foreach ($images as $image) { if (JFile::exists(AUCTION_PICTURES_PATH . DS . $image->picture)) { JFile::delete(AUCTION_PICTURES_PATH . DS . $image->picture); JFile::delete(AUCTION_PICTURES_PATH . DS . "middle_" . $image->picture); JFile::delete(AUCTION_PICTURES_PATH . DS . "resize_" . $image->picture); } } } //all the records dependent on auctions will be deleted through foreign keys return parent::delete(); }
/** * Pre-processor for $table->delete($pk) * * @param mixed $pk An optional primary key value to delete. If not set the instance property value is used. * * @return void * * @since 3.1.2 * @throws UnexpectedValueException */ public function onBeforeDelete($pk) { $userId = CrowdfundingHelper::getUserIdByRewardId($this->table->id); $imagesFolder = CrowdfundingHelper::getImagesFolder($userId); // Remove image. if (!empty($this->table->image)) { $fileSource = $imagesFolder . DIRECTORY_SEPARATOR . $this->table->image; if (JFile::exists($fileSource)) { JFile::delete($fileSource); } } // Remove thumbnail. if (!empty($this->table->image_thumb)) { $fileSource = $imagesFolder . DIRECTORY_SEPARATOR . $this->table->image_thumb; if (JFile::exists($fileSource)) { JFile::delete($fileSource); } } // Remove square image. if (!empty($this->table->image_square)) { $fileSource = $imagesFolder . DIRECTORY_SEPARATOR . $this->table->image_square; if (JFile::exists($fileSource)) { JFile::delete($fileSource); } } }
function com_uninstall() { require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'defines.community.php'; //for Joomla 1.6, in xml file, community has been renamed to JomSocial during installing plugins if (JVERSION >= '1.6') { $asset = JTable::getInstance('Asset'); if ($asset->loadByName('com_community')) { $asset->delete(); } } $db =& JFactory::getDBO(); //remove jomsocialuser plugin during uninstall to prevent error during login/logout of joomla. $query = 'DELETE FROM ' . $db->nameQuote(PLUGIN_TABLE_NAME) . ' ' . 'WHERE ' . $db->nameQuote('element') . '=' . $db->quote('jomsocialuser') . ' AND ' . $db->nameQuote('folder') . '=' . $db->quote('user'); $db->setQuery($query); $db->query(); if (JVERSION >= '1.6') { $plugin_path = JPATH_ROOT . DS . 'plugins' . DS . 'user' . DS . 'jomsocialuser'; } else { $plugin_path = JPATH_ROOT . DS . 'plugins' . DS . 'user'; } if (JFile::exists($plugin_path . DS . 'jomsocialuser.php')) { JFile::delete($plugin_path . DS . 'jomsocialuser.php'); } if (JFile::exists($plugin_path . DS . 'jomsocialuser.xml')) { JFile::delete($plugin_path . DS . 'jomsocialuser.xml'); } removeBackupTemplate('blueface'); removeBackupTemplate('bubble'); removeBackupTemplate('blackout'); return true; }
function ja_sys_get_temp_dir() { // Try to get from environment variable if (defined('JPATH_ROOT') && JFolder::exists(JPATH_ROOT . DS . 'tmp' . DS)) { return JPATH_ROOT . DS . 'tmp' . DS; } elseif (!empty($_ENV['TMPDIR'])) { return realpath($_ENV['TMPDIR']); } elseif (!empty($_ENV['TEMP'])) { return realpath($_ENV['TEMP']); } elseif (!empty($_ENV['TMP'])) { return realpath($_ENV['TMP']); } elseif (function_exists('sys_get_temp_dir')) { return sys_get_temp_dir(); } else { // Try to use system's temporary directory // as random name shouldn't exist //thanhnv: dont use function jaTempnam //because it maybe a reason for endless loop call //if this function and jaTempnam return false too $temp_file = tempnam(md5(uniqid(rand(), TRUE)), ''); if ($temp_file) { $temp_dir = realpath(dirname($temp_file)); JFile::delete($temp_file); return $temp_dir; } else { return null; } } }
/** * Remove an extra image from database and file system. * * <code> * $imageId = 1; * $imagesFolder = "/.../folder"; * * $image = new CrowdFundingImageRemoverExtra(JFactory::getDbo(), $image, $imagesFolder); * $image->remove(); * </code> */ public function remove() { // Get the image $query = $this->db->getQuery(true); $query->select("a.image, a.thumb")->from($this->db->quoteName("#__crowdf_images", "a"))->where("a.id = " . (int) $this->imageId); $this->db->setQuery($query); $row = $this->db->loadObject(); if (!empty($row)) { // Remove the image from the filesystem $file = JPath::clean($this->imagesFolder . DIRECTORY_SEPARATOR . $row->image); if (JFile::exists($file)) { JFile::delete($file); } // Remove the thumbnail from the filesystem $file = JPath::clean($this->imagesFolder . DIRECTORY_SEPARATOR . $row->thumb); if (JFile::exists($file)) { JFile::delete($file); } // Delete the record $query = $this->db->getQuery(true); $query->delete($this->db->quoteName("#__crowdf_images"))->where($this->db->quoteName("id") . " = " . (int) $this->imageId); $this->db->setQuery($query); $this->db->execute(); } }
function com_uninstall() { jimport('joomla.filesystem.file'); jimport('joomla.version'); $version = new JVersion(); if (version_compare($version->getShortVersion(), '1.6', '>=')) { $db = JFactory::getDBO(); $db->setQuery("Delete From #__menu Where `link` Like 'index.php?option=com_breezingforms&act=%'"); $db->query(); $db->setQuery("Delete From #__menu Where `alias` Like 'BreezingForms' And `path` Like 'breezingforms'"); $db->query(); } if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'breezingforms' . DS . 'facileforms.config.php')) { JFile::delete(JPATH_SITE . DS . 'media' . DS . 'breezingforms' . DS . 'facileforms.config.php'); } if (JFile::exists(JPATH_SITE . "/components/com_sh404sef/sef_ext/com_breezingforms.php")) { JFile::delete(JPATH_SITE . "/components/com_sh404sef/sef_ext/com_breezingforms.php"); } if (JFile::exists(JPATH_SITE . '/ff_secimage.php')) { JFile::delete(JPATH_SITE . '/ff_secimage.php'); } if (JFile::exists(JPATH_SITE . '/templates/system/ff_secimage.php')) { JFile::delete(JPATH_SITE . '/templates/system/ff_secimage.php'); } if (JFile::exists(JPATH_SITE . "/administrator/components/com_joomfish/contentelements/breezingforms_elements.xml")) { JFile::delete(JPATH_SITE . "/administrator/components/com_joomfish/contentelements/breezingforms_elements.xml"); } if (JFile::exists(JPATH_SITE . "/administrator/components/com_joomfish/contentelements/translationFformFilter.php")) { JFile::delete(JPATH_SITE . "/administrator/components/com_joomfish/contentelements/translationFformFilter.php"); } if (JFile::exists(JPATH_SITE . "/administrator/components/com_joomfish/contentelements/translationFformoptions_emptyFilter.php")) { JFile::delete(JPATH_SITE . "/administrator/components/com_joomfish/contentelements/translationFformoptions_emptyFilter.php"); } }
function _owner($getgroup = false) { static $owner = false; static $group = false; if ($getgroup === false && !empty($owner)) { return $owner; } if ($getgroup === true && !empty($group)) { return $group; } jimport('joomla.user.helper'); $tmp = md5(JUserHelper::genRandomPassword(16)); $dir = self::tmpdir(); if ($dir) { $test = $dir . DS . $tmp; // Create the test file JFile::write($test, ''); // Test ownership $owner = fileowner($test); $group = filegroup($test); // Delete the test file JFile::delete($test); } return $getgroup ? $group : $owner; }
public function postflight($type, $parent) { $db = JFactory::getDBO(); $db->setQuery("UPDATE #__extensions SET enabled = 0 WHERE client_id = 1 AND element = " . $db->Quote($parent->get('element'))); $db->query(); $status = new stdClass(); $status->plugins = array(); $src = $parent->getParent()->getPath('source'); $manifest = $parent->getParent()->manifest; $plugins = $manifest->xpath('plugins/plugin'); foreach ($plugins as $plugin) { $name = (string) $plugin->attributes()->plugin; $group = (string) $plugin->attributes()->group; $path = $src . '/plugins/' . $group . '/' . $name; $installer = new JInstaller(); $result = $installer->install($path); if ($result) { if (JFile::exists(JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.xml')) { JFile::delete(JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.xml'); } JFile::move(JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.j25.xml', JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.xml'); } $query = "UPDATE #__extensions SET enabled=1, ordering=99 WHERE type='plugin' AND element=" . $db->Quote($name) . " AND folder=" . $db->Quote($group); $db->setQuery($query); $db->query(); $status->plugins[] = array('name' => $name, 'group' => $group, 'result' => $result); } $this->installationResults($status); }
function parseOnce($path, $force = 'false') { if ($force == 'true') { JFile::delete($path . DS . 'css' . DS . 'template.css'); JFile::delete($path . DS . 'css' . DS . 'override.css'); JFile::delete($path . DS . 'css' . DS . 'error.css'); JFile::delete($path . DS . 'css' . DS . 'print.css'); JFile::delete($path . DS . 'css' . DS . 'mail.css'); // generate new Template CSS files try { // normal Template code lessc::ccompile($path . DS . 'less' . DS . 'main.less', $path . DS . 'css' . DS . 'template.css'); lessc::ccompile($path . DS . 'less' . DS . 'print.less', $path . DS . 'css' . DS . 'print.css'); lessc::ccompile($path . DS . 'less' . DS . 'mail.less', $path . DS . 'css' . DS . 'mail.css'); // additional Template code lessc::ccompile($path . DS . 'less' . DS . 'error.less', $path . DS . 'css' . DS . 'error.css'); lessc::ccompile($path . DS . 'less' . DS . 'offline.less', $path . DS . 'css' . DS . 'offline.css'); lessc::ccompile($path . DS . 'less' . DS . 'override.less', $path . DS . 'css' . DS . 'override.css'); $result = true; } catch (exception $ex) { $result = $ex->getMessage(); return $result; } return $result; } }