function com_install() { $file = new JFile(); $basePath = 'libraries' . DS . 'solr' . DS; $basePathClient = $basePath . 'client.php'; $basePathQuery = $basePath . 'query.php'; $dest = JPATH_LIBRARIES . DS . 'solr' . DS; $file->copy($basePathClient, $dest); $file->copy($basePathQuery, $dest); }
function com_install() { $db = JFactory::getDBO(); // Install System plugin $src = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_noixacl' . DS . 'plugins' . DS . 'system' . DS; $dest = JPATH_ROOT . DS . 'plugins' . DS . 'system' . DS; $res = JFile::copy($src . 'noixacl.php', $dest . 'noixacl.php'); $res = $res && JFile::copy($src . 'noixacl.xml', $dest . 'noixacl.xml'); $db->setQuery("INSERT INTO #__plugins\r\n\t (id, name, element, folder, access, ordering, published, iscore, client_id, checked_out, checked_out_time, params)\r\n\t VALUES ('', 'noixACL - System Plugin 2.0.10', 'noixacl', 'system', 0, 0, 1, 0, 0, 0, '0000-00-00 00:00:00', '')"); $res = $res && $db->query(); if (!$res) { JError::raiseWarning(100, JText::_('NoixACL System plugin not installed. Please install it manually from the following folder') . ': ' . $src); } else { JFolder::delete($src); } // Install User plugin $src = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_noixacl' . DS . 'plugins' . DS . 'user' . DS; $dest = JPATH_ROOT . DS . 'plugins' . DS . 'user' . DS; $res = JFile::copy($src . 'noixacl.php', $dest . 'noixacl.php'); $res = $res && JFile::copy($src . 'noixacl.xml', $dest . 'noixacl.xml'); $db->setQuery("INSERT INTO #__plugins\r\n\t (id, name, element, folder, access, ordering, published, iscore, client_id, checked_out, checked_out_time, params)\r\n\t VALUES ('', 'noixACL - User Plugin 2.0.10', 'noixacl', 'user', 0, 0, 1, 0, 0, 0, '0000-00-00 00:00:00', '')"); $res = $res && $db->query(); if (!$res) { JError::raiseWarning(100, JText::_('NoixACL User plugin not installed. Please install it manually from the following folder') . ': ' . $src); } else { JFolder::delete($src); } }
function defaultTpl($tpl = null) { JToolBarHelper::title(JText::_('STOP WORDS'), 'tag.png'); $canDo = UsersHelper::getActions(); if ($canDo->get('core.create')) { JToolBarHelper::apply(); JToolBarHelper::spacer(); JToolBarHelper::save(); JToolBarHelper::spacer(); JToolBarHelper::custom('restore', 'default', '', JText::_('RESTORE DEFAULT'), false); JToolBarHelper::spacer(); } JToolBarHelper::back(JText::_('CEDTAG_CONTROL_PANEL'), 'index.php?option=com_cedtag'); $lang = strval(JFactory::getLanguage()->getDefault()); $file = JPATH_ADMINISTRATOR . '/components/com_cedtag/stopwords/stopwords_' . $lang . '.php'; if (!is_file($file)) { JFile::copy(JPATH_ADMINISTRATOR . '/components/com_cedtag/stopwords/stopwords_en-GB-default.php', $file); } $isWritable = is_writable($file); $FileContent = trim(file_get_contents($file)); $this->assign('isWritable', $isWritable); $this->assignRef('FileName', $file); $this->assignRef('FileContent', $FileContent); parent::display($tpl); }
public function install() { // Request forgeries check JRequest::checkToken() or die('Invalid Token'); $file = JRequest::getVar('rule', '', 'FILES'); $app = JFactory::getApplication(); $files = array(); // @task: If there's no tmp_name in the $file, we assume that the data sent is corrupted. if (!isset($file['tmp_name'])) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_INVALID_RULE_FILE'), DISCUSS_QUEUE_ERROR); $app->redirect('index.php?option=com_easydiscuss&view=rules&layout=install'); $app->close(); } // There are various MIME type for compressed file. So let's check the file extension instead. if ($file['name'] && JFile::getExt($file['name']) == 'xml') { $files = array($file['tmp_name']); } else { $jConfig = DiscussHelper::getJConfig(); $path = rtrim($jConfig->get('tmp_path'), '/') . '/' . $file['name']; // @rule: Copy zip file to temporary location if (!JFile::copy($file['tmp_name'], $path)) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_INVALID_RULE_FILE'), DISCUSS_QUEUE_ERROR); $app->redirect('index.php?option=com_easydiscuss&view=rules&layout=install'); $app->close(); } jimport('joomla.filesystem.archive'); $tmp = md5(DiscussHelper::getDate()->toMysQL()); $dest = rtrim($jConfig->get('tmp_path'), '/') . '/' . $tmp; if (!JArchive::extract($path, $dest)) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_INVALID_RULE_FILE'), DISCUSS_QUEUE_ERROR); $app->redirect('index.php?option=com_easydiscuss&view=rules&layout=install'); $app->close(); } $files = JFolder::files($dest, '.', true, true); if (empty($files)) { // Try to do a level deeper in case the zip is on the outer. $folder = JFolder::folders($dest); if (!empty($folder)) { $files = JFolder::files($dest . '/' . $folder[0], true); $dest = $dest . '/' . $folder[0]; } } if (empty($files)) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_INVALID_RULE_FILE'), DISCUSS_QUEUE_ERROR); $app->redirect('index.php?option=com_easydiscuss&view=rules&layout=install'); $app->close(); } } if (empty($files)) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_RULE_INSTALL_FAILED'), DISCUSS_QUEUE_ERROR); $app->redirect('index.php?option=com_easydiscuss&view=rules&layout=install'); $app->close(); } foreach ($files as $file) { $this->installXML($file); } DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_RULE_INSTALL_SUCCESS'), DISCUSS_QUEUE_SUCCESS); $app->redirect('index.php?option=com_easydiscuss&view=rules&layout=install'); $app->close(); }
/** * Function to install an AUP rule * * @param object $parent - the parent installer object * @param string $pluginName - the plugin name * * @return boolean */ public static function install($parent, $pluginName) { $status = false; if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler/library/cb/cb.installer.php')) { global $_CB_framework; require_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php'; require_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.class.php'; require_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/comprofiler.class.php'; require_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/library/cb/cb.installer.php'; $cbInstaller = new cbInstallerPlugin(); if ($cbInstaller->install($parent->getParent()->getPath('source') . '/components/com_comprofiler/plugin/user/' . $pluginName . '/')) { $path = $parent->getParent()->getPath('source') . '/components/com_comprofiler/plugin/user/' . $pluginName . '/administrator/language'; if (JFolder::exists($path)) { $languages = JFolder::folders($path); foreach ($languages as $language) { if (JFolder::exists(JPATH_ROOT . '/administrator/language/' . $language)) { if (file_exists($path . '/' . $language . '/' . $language . '.plg_' . $pluginName . '.ini')) { JFile::copy($path . '/' . $language . '/' . $language . '.plg_' . $pluginName . '.ini', JPATH_ROOT . '/administrator/language/' . $language . '/' . $language . '.plg_' . $pluginName . '.ini'); } elseif (file_exists($path . '/' . $language . '/' . $language . '.plg_' . str_replace('plug_', '', $pluginName) . '.ini')) { JFile::copy($path . '/' . $language . '/' . $language . '.plg_' . str_replace('plug_', '', $pluginName) . '.ini', JPATH_ROOT . '/administrator/language/' . $language . '/' . $language . '.plg_' . str_replace('plug_', '', $pluginName) . '.ini'); } } } } $status = true; } } return $status; }
/** * 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'); } }
protected function initFile() { $logFilenameBase = str_replace('.php', '', $this->path); $logFile = $logFilenameBase . '.php'; if (JFile::exists($logFile)) { if (@filesize($logFile) > 1048756) { $altLog = $logFilenameBase . '-' . time() . '.php'; JFile::copy($logFile, $altLog); JFile::delete($logFile); } } // If the file doesn't already exist we need to create it and generate the file header. if (!is_file($this->path)) { // Make sure the folder exists in which to create the log file. JFolder::create(dirname($this->path)); // Build the log file header. $head = $this->generateFileHeader(); } else { $head = false; } // Open the file for writing (append mode). if (!($this->file = fopen($this->path, 'a'))) { throw new RuntimeException('Cannot open file for writing log'); } if ($head) { if (!fwrite($this->file, $head)) { throw new RuntimeException('Cannot fput file for log'); } } }
/** * Helper task for installing CB plugin later * * @throws Exception - if CB not found * * @return void */ public function installPlugin() { JLoader::import("joomla.filesystem.file"); JLoader::import("joomla.filesystem.folder"); if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler/library/cb/cb.installer.php')) { global $_CB_framework; require_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php'; require_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.class.php'; require_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/comprofiler.class.php'; require_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/library/cb/cb.installer.php'; $plugin = "plug_cmc"; $cbInstaller = new cbInstallerPlugin(); if ($cbInstaller->install(JPATH_ROOT . '/components/com_comprofiler/plugin/user/' . $plugin . '/')) { $langPath = JPATH_ROOT . '/components/com_comprofiler/plugin/user/' . $plugin . '/administrator/language'; $cbNames = explode('_', $plugin); if (JFolder::exists($langPath)) { $languages = JFolder::folders($langPath); foreach ($languages as $language) { if (JFolder::exists(JPATH_ROOT . '/administrator/language/' . $language)) { JFile::copy($langPath . '/' . $language . '/' . $language . '.plg_' . $cbNames[1] . '.ini', JPATH_ROOT . '/administrator/language/' . $language . '/' . $language . '.plg_' . $cbNames[1] . '.ini'); } } } } else { throw new Exception("CB plugin installation failed"); } } else { throw new Exception("CB Framework not found", 404); } $msg = JText::_('COM_CMC_CB_PLUGIN_INSTALLED_SUCCESSFULLY'); $this->setRedirect('index.php?option=com_cmc&view=lists', $msg); }
/** * Performs the copy procedure of each file without of the install pachages * * @return void * * @since 0.10.1 */ public function runningcopy() { $temp_unpack_path = JFactory::getApplication()->getUserState('com_playjoomupdate.unpackage.name', null); $options['format'] = '{DATE}\\t{TIME}\\t{LEVEL}\\t{CODE}\\t{MESSAGE}'; $options['text_file'] = 'playjoom_update.php'; JLog::addLogger($options, JLog::INFO, array('Update', 'databasequery', 'jerror')); // Send the appropriate error code response. JResponse::clearHeaders(); JResponse::setHeader('Content-Type', 'application/json; charset=utf-8'); JResponse::sendHeaders(); $total = $_GET['total']; $one_procent = 1 / ($total / 100); $curr_index = number_format($_GET['total'] * $_GET['status'] / 100, 0, '', ''); $filespath_from_cache = explode('*|*', JFactory::getApplication()->getUserState('com_playjoomupdate.filespaths.array')); $php_array['status'] = $_GET['status'] + $one_procent; if (isset($filespath_from_cache[$curr_index])) { //Copy file $src = $filespath_from_cache[$curr_index]; $dest = str_replace($temp_unpack_path, JPATH_ROOT, $filespath_from_cache[$curr_index]); JFile::copy($src, $dest); } // Bei 100% ist Schluss ;) if ($php_array['status'] > 100) { $php_array['status'] = 100; } if ($php_array['status'] != 100 && isset($filespath_from_cache[$curr_index])) { $php_array['message'] = JText::_('COM_PLAYJOOMUPDATE_INSTALLING_EXTENSIONS_CURRENT_STATUS') . ' ' . ($curr_index + 1) . ' / ' . $total . ' - ' . round($php_array['status'], 1) . '%'; $php_array['message_path'] = JText::_('COM_PLAYJOOMUPDATE_COPY_FILE_TO_PATH_STATUS') . ' ' . $dest; } else { $php_array['message'] = JText::_('COM_PLAYJOOMUPDATE_COPY_FILES_DONE'); } // Output as PHP arrays as JSON Objekt echo json_encode($php_array); }
function _InstallCBPlugin($plugintitle, $tabtitle, $pluginname, $folder, $class) { $database = JFactory::getDBO(); jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); $query = "SELECT id FROM #__comprofiler_plugin where element='{$pluginname}'"; $database->setQuery($query); $plugid = $database->loadResult(); if (!$plugid) { $query = "INSERT INTO #__comprofiler_plugin set\r\n \t\t\t`name`='{$plugintitle}',\r\n \t\t\t`element`='{$pluginname}',\r\n \t\t\t`type`='user',\r\n \t\t\t`folder`='{$folder}',\r\n \t\t\t`ordering`=99,\r\n \t\t\t`published`=1,\r\n \t\t\t`iscore`=0\r\n \t\t"; $database->setQuery($query); $database->query(); $plugid = $database->insertid(); } $query = "SELECT count(*) FROM #__comprofiler_tabs where pluginid='{$plugid}'"; $database->setQuery($query); $tabs = $database->loadResult(); if (!$tabs) { $query = "INSERT INTO #__comprofiler_tabs set\r\n \t\t`title`='{$tabtitle}',\r\n \t\t`ordering`=999,\r\n \t\t`enabled`=1,\r\n \t\t`pluginclass`='{$class}',\r\n \t\t`pluginid`='{$plugid}',\r\n \t\t`fields`=0,\r\n \t\t`displaytype`='tab',\r\n \t\t`position`='cb_tabmain'\r\n\r\n \t"; $database->setQuery($query); $database->query(); } $pluginfolder = JPATH_ROOT . DS . 'components' . DS . 'com_comprofiler' . DS . 'plugin' . DS . 'user' . DS . $folder; $pluginfile_source = JPATH_ROOT . DS . "components" . DS . APP_EXTENSION . DS . "installer" . DS . "cb_plug" . DS . "{$pluginname}"; if (!JFolder::exists($pluginfolder)) { JFolder::create($pluginfolder); } JFile::copy($pluginfile_source . '.php', $pluginfolder . DS . "{$pluginname}.php"); JFile::copy($pluginfile_source . '.xml', $pluginfolder . DS . "{$pluginname}.xml"); return $plugintitle; }
/** * Perform the action. * * @param EcrProjectZiper $ziper * * @return \EcrProjectAction */ public function run(EcrProjectZiper $ziper) { $project = EcrProjectHelper::getProject(); $updateserver = new EcrProjectUpdateserver($project); $fileList = $ziper->getCreatedFiles(); if (0 == count($fileList)) { return $this->abort('ERROR: No files to transfer', $ziper); } $path = ECRPATH_UPDATESERVER . '/' . $project->comName . '/' . $this->releaseState; $urlPath = ECRPATH_UPDATESERVER_URL . '/' . $project->comName . '/' . $this->releaseState; $urls = array(); /* @ var EcrProjectZiperCreatedfile $f */ foreach ($fileList as $f) { $dest = $path . '/' . $f->name; if (false == JFile::copy($f->path, $dest)) { return $this->abort(sprintf('ERROR: Can not copy the file %s to %s', $f->path, $dest), $ziper); } $ziper->logger->log(sprintf('The file<br />%s<br />has been copied to<br />%s', $f->path, $dest)); $alternate = $f->alternateDownload; $urls[] = $alternate ?: $urlPath . '/' . $f->name; } $release = new EcrProjectUpdateserverRelease(); $release->state = $this->releaseState; $release->downloads = $urls; $release->description = 'Bescreibung...'; $updateserver->addRelease($release); return $this; }
/** * Uploads the given file to a temporary location on the site. * * @since 1.0 * @access public * @param string * @return string The path to the uploaded item. */ public function upload($file, $hash, $userId) { // Check if file exists on the server if (!isset($file['tmp_name']) || empty($file)) { $this->setError(JText::_('COM_EASYSOCIAL_UPLOADER_FILE_NOT_FOUND')); return false; } // Lets figure out the storage path. $config = FD::config(); // Test if the folder exists for this upload type. $path = JPATH_ROOT . '/' . FD::cleanPath($config->get('uploader.storage.container')); if (!FD::makeFolder($path)) { $this->setError(JText::sprintf('COM_EASYSOCIAL_UPLOADER_UNABLE_TO_CREATE_DESTINATION_FOLDER', $path)); return false; } // Let's finalize the storage path. $storage = $path . '/' . $userId; if (!FD::makeFolder($storage)) { $this->setError(JText::sprintf('COM_EASYSOCIAL_UPLOADER_UNABLE_TO_CREATE_DESTINATION_FOLDER', $storage)); return false; } // Once the script reaches here, we assume everything is good now. // Copy the files over. jimport('joomla.filesystem.file'); $absolutePath = $storage . '/' . $hash; if (!JFile::copy($file['tmp_name'], $absolutePath)) { $this->setError(JText::sprintf('COM_EASYSOCIAL_UPLOADER_UNABLE_TO_COPY_TO_DESTINATION_FOLDER', $absolutePath)); return false; } return $absolutePath; }
/** * method to install custom mail scripts * * @return void */ private function installCustomMail($parent) { foreach ($this->mailScripts as $mailScript) { $source = 'html/emails/' . $mailScript . '.modified.php'; $src = __DIR__ . '/' . $source; if (!JFile::exists($src)) { echo '<span style="color:red;"><hr />'; echo 'Customised email file not available: ' . $source . '<br />'; echo 'Check customisation instructions in: plugins/hikashop/html/emails<br />'; echo '</span>'; continue; } $target = 'media/com_hikashop/mail/' . $mailScript . '.modified.php'; $dest = JPATH_ROOT . '/' . $target; if (JFile::exists($dest)) { if ($this->compareCustomMail($dest, $src)) { continue; } echo '<span style="color:red;"><hr />'; echo 'Modified email file already exists: ' . $target . '<br />'; echo 'Check customisation instructions in: plugins/hikashop/bf_item_delivery_date/html/emails<br />'; echo '</span>'; continue; } JFile::copy($src, $dest); } }
/** * Wordbridge entry view display method * @return void **/ function display($tpl = null) { $app = JFactory::getApplication(); $menu = $app->getMenu(); $item = $menu->getActive(); if (!$item) { $item = $menu->getItem(JRequest::getInt('Itemid')); } $params = $item->params; $this->assignRef('params', $params); $postid = JRequest::getInt('p', 0); $blogInfo = WordbridgeHelper::getBlogByName($params->get('wordbridge_blog_name')); $this->assignRef('blogTitle', $blogInfo['description']); $model = $this->getModel(); $entry = $model->getEntry($postid, $blogInfo['uuid']); $baseUrl = $item->link . '&Itemid=' . $item->id; $this->assignRef('blogLink', $baseUrl); // Determine if we'll convert links $convertLinks = $params->get('wordbridge_convert_links', 'no') == 'yes' ? true : false; $this->assignRef('convertLinks', $convertLinks); $this->assignRef('content', $entry['content']); $this->assignRef('title', $entry['title']); $this->assignRef('slug', $entry['slug']); $this->assignRef('categories', $entry['categories']); $this->assignRef('postid', $entry['postid']); $this->assignRef('date', $entry['date']); // Allow JComments to be added to blog entries $jcomments = false; $jcommentsPath = JPATH_SITE . DS . 'components' . DS . 'com_jcomments' . DS; $jcommentFile = $jcommentsPath . 'jcomments.php'; if ($params->get('wordbridge_show_jcomments') == 'yes' && file_exists($jcommentFile)) { $jbase = JPATH_SITE . DS . 'components' . DS; $jPlgSrc = $jbase . 'com_wordbridge' . DS . 'assets' . DS . 'com_wordbridge.plugin.php'; $jPlgDst = $jbase . 'com_jcomments' . DS . 'plugins' . DS . 'com_wordbridge.plugin.php'; // Check to see if the integration is installed $copyRes = true; if (!file_exists($jPlgDst) || filemtime($jPlgSrc) > filemtime($jPlgDst)) { // Copy the wordbridge plugin over to jcomments $copyRes = JFile::copy($jPlgSrc, $jPlgDst); } // Only set up JComments if the wordbridge plugin is // installed OK if ($copyRes) { require_once $jcommentFile; $jid = $item->id * 10000000 + $entry['postid']; $jcomments = JComments::showComments($jid, 'com_wordbridge', $entry['title']); } } $this->assignRef('jcomments', $jcomments); $document = JFactory::getDocument(); // Set the title to place above the blog $blog_title = $params->get('page_heading'); if (!$blog_title) { $blog_title = $document->getTitle(); } $this->assignRef('blog_title', $blog_title); // Set the page title $document->setTitle($document->getTitle() . ' - ' . $entry['title']); parent::display($tpl); }
/** * Method is responsible to create a folder in the site. * * @access public * @param null */ public function createFolder() { $ajax = EasyBlogHelper::getHelper('Ajax'); // This is the relative path to the items that needs to be deleted. $path = JRequest::getVar('path'); // This let's us know the type of folder we should lookup to $place = JRequest::getString('place'); // @task: Create the media object. $media = new EasyBlogMediaManager(); $absolutePath = EasyBlogMediaManager::getAbsolutePath($path, $place); if (JFolder::exists($absolutePath)) { return $ajax->fail(JText::_('COM_EASYBLOG_FOLDER_EXISTS')); } // @task: Let's create the folder JFolder::create($absolutePath); // @task: Let's copy a standard index.html to prevent any directory browsing here. $source = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'index.html'; $destination = $absolutePath . DIRECTORY_SEPARATOR . 'index.html'; JFile::copy($source, $destination); // @task: Get the absolute URI to the destination item. $uri = EasyBlogMediaManager::getAbsoluteURI($path, $place); // @task: Try to get the relative path of the "path" . Since the last fragment is always the folder that we're trying to create. $relative = dirname($path); $obj = $media->getItem($absolutePath, $uri, $relative, false, $place)->toArray(); $ajax->success($obj); }
function postflight($type, $parent, $results) { // Install content elements files $destinationDir = JPATH_SITE . '/administrator/components/com_falang/contentelements/'; $sourceDir = JPATH_SITE . '/administrator/components/com_solidres/falang/'; if (JFolder::exists($destinationDir)) { $files = JFolder::files($sourceDir); if (!empty($files)) { foreach ($files as $file) { JFile::copy($sourceDir . $file, $destinationDir . $file); } } } echo ' <style> .solidres-installation-result { margin: 15px 0; } .solidres-installation-result .solidres-ext { padding: 8px; border-left: 3px solid #63B75D; background: #EEE; margin: 0 0 2px 0; } .solidres-installation-result label { font-weight: bold; margin-bottom: 0; display: inline-block; } .solidres-installation-result ul { margin: 20px 0 20px 10px; } .solidres-installation-result ul li { list-style: none; } </style> '; echo '<div class="row-fluid solidres-installation-result"> <div class="span6"> <img src="' . JUri::root() . '/media/com_solidres/assets/images/logo_black.png" width="250" height="52" alt="Solidres\'s logo"/> <ul> <li><label>Homepage:</label><a href="http://solidres.com" target="_blank">http://solidres.com</a></li> <li><label>Documentation:</label><a href="http://solidres.com/documentation" target="_blank">http://solidres.com/documentation</a></li> <li><label>Community forum:</label><a href="http://solidres.com/forum" target="_blank">http://solidres.com/forum</a></li> </ul> <p><a href="' . JUri::root() . '/administrator/index.php?option=com_solidres" class="btn btn-primary"><i class="icon-out "></i> Go to Solidres now</a></p> </div> <div class="span6">'; foreach ($results as $result) { echo '<div class="solidres-ext ' . ($result['result'] == true ? 'ok' : 'not-ok') . '">'; echo '<label>' . $result['name'] . '</label>'; echo ' has been ' . ($type == 'install' ? 'installed' : 'upgraded'); echo ($result['result'] == true ? ' successfully' : ' failed') . '</div>'; } echo ' </div> </div>'; }
private function replaceManifestFile($parent) { $installer = $parent->getParent(); $manifestFile = preg_replace('/^\\_{1}/', '', basename($installer->getPath('manifest'))); $filesFolder = dirname(__FILE__) . '/' . $this->filesFolder . '/'; JFile::delete($filesFolder . $manifestFile); JFile::copy($filesFolder . '../' . $manifestFile, $filesFolder . $manifestFile); }
/** * Copy Simple File Manager files in a new folder. * * @param string $source * Path of the uploaded file on the server * @return copied file path (in case of success) or false (in case of error) */ public static function copyFile($source) { jimport('joomla.filesystem.file'); $fileName = pathinfo($source, PATHINFO_BASENAME); $destFolder = JPATH_COMPONENT_ADMINISTRATOR . DIRECTORY_SEPARATOR . "uploads" . DIRECTORY_SEPARATOR . uniqid("", true) . DIRECTORY_SEPARATOR; mkdir($destFolder); return JFile::copy($source, $destFolder . $fileName) ? $destFolder . $fileName : false; }
protected function copyAjaxCallback() { $source = dirname(__FILE__) . '/warp-ajax.php'; $target = JPATH_ROOT . '/administrator/templates/system/warp-ajax.php'; if (!file_exists($target) || md5_file($source) != md5_file($target)) { JFile::copy($source, $target); } }
public static function copyFile($src, $dst) { if (JCOMMENTS_JVERSION == '1.0') { return @copy($src, $dst); } else { jimport('joomla.filesystem.file'); return JFile::copy($src, $dst); } }
public function upload( $fileItem, $fileName = '', $storagePath = '', $published = 1 ) { // $fileItem['name'] = filename // $fileItem['type'] = mime // $fileItem['tmp_name'] = temporary source // $fileItem['size'] = size if( empty( $fileItem ) ) { return false; } // store record first $uploadtable = Komento::getTable( 'uploads' ); $now = Komento::getDate()->toMySQL(); $uploadtable->created = $now; $profile = Komento::getProfile(); $uploadtable->created_by = $profile->id; $uploadtable->published = $published; $uploadtable->mime = $fileItem['type']; $uploadtable->size = $fileItem['size']; if( $fileName == '' ) { $fileName = $fileItem['name']; } $uploadtable->filename = $fileName; if( $storagePath == '' ) { $config = Komento::getConfig(); $storagePath = $config->get( 'upload_path' ); } $uploadtable->path = $storagePath; if( !$uploadtable->upload() ) { return false; } $source = $fileItem['tmp_name']; $destination = $uploadtable->getFilePath(); jimport( 'joomla.filesystem.file' ); if( !JFile::copy( $source , $destination ) ) { $uploadtable->rollback(); return false; } return $uploadtable->id; }
/** * Load config. * * @return Registry Config registry object. */ public function loadConfig() { $file = WINDWALKER . '/config.json'; if (!is_file($file)) { \JFile::copy(WINDWALKER . '/config.dist.json', $file); } $config = new Registry(); return $config->loadFile($file, 'json'); }
function copyAECfiles() { $miFilename = JPATH_ROOT . DS . 'components' . DS . 'com_acctexp' . DS . 'micro_integration' . DS . 'mi_jomsocialjspt.php'; $sourceMIFilename = JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_xipt' . DS . 'hacks' . DS . 'mi_jomsocialjspt.php'; if (JFile::exists($miFilename)) { return JFile::copy($sourceMIFilename, $miFilename); } return true; }
public function zipLiveTemplate(&$model) { jimport('joomla.filesystem.archive'); jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); $item =& $model->getItem(); $item->name = strtolower($item->name); //Create TempFolders if (JFolder::exists($model->getTempPath(true))) { JFolder::delete($model->getTempPath(true)); } JFolder::create($model->getTempPath()); //Copy the template if (JFolder::exists(JPATH_SITE . DS . 'templates' . DS . $item->name)) { JFolder::copy(JPATH_SITE . DS . 'templates' . DS . $item->name, $model->getTempPath(), '', true); } elseif (JFolder::exists(JPATH_ADMINISTRATOR . DS . 'templates' . DS . $item->name)) { JFolder::copy(JPATH_ADMINISTRATOR . DS . 'templates' . DS . $item->name, $model->getTempPath(), '', true); } else { JFolder::delete($model->getTempPath()); return -2; } //Create Language Folders if (!JFolder::exists($model->getTempPath() . DS . 'language')) { JFolder::create($model->getTempPath() . DS . 'language'); } //Find Language Files $langs_site = JLanguage::getKnownLanguages(JPATH_SITE); $langs_admin = JLanguage::getKnownLanguages(JPATH_ADMINISTRATOR); $langfiles_site = array(); $langfiles_admin = array(); foreach ($langs_site as $lang) { $langfiles_site = array_merge(JFolder::files(JPATH_SITE . DS . 'language' . DS . $lang['tag'], $item->name, true, true), $langfiles_site); } foreach ($langs_admin as $lang) { $langfiles_admin = array_merge(JFolder::files(JPATH_ADMINISTRATOR . DS . 'language' . DS . $lang['tag'], $item->name, true, true), $langfiles_admin); } //Copy Language Files if (count($langfiles_site)) { foreach ($langfiles_site as $file) { JFile::copy($file, $model->getTempPath() . DS . 'language' . DS . JFile::getName($file)); } } if (count($langfiles_admin)) { foreach ($langfiles_admin as $file) { JFile::copy($file, $model->getTempPath() . DS . 'language' . DS . JFile::getName($file)); } } $model->readinFiles(); $model->buildArchiveContent(); //create archive $model->createArchive(); //delete tmp folder if (JFolder::exists(JPATH_SITE . DS . 'tmp' . DS . 'jctmp')) { JFolder::delete(JPATH_SITE . DS . 'tmp' . DS . 'jctmp'); } }
private function updateManifest($parent) { jimport('joomla.filesystem.file'); $installer = $parent->getParent(); $manifestFile = basename($installer->getPath('manifest')); $cleanManifestFile = preg_replace('/^\\_+/i', '', $manifestFile); $dir = dirname(__FILE__) . '/install/'; JFile::delete($dir . $cleanManifestFile); JFile::copy($dir . '../' . $cleanManifestFile, $dir . $cleanManifestFile); }
/** * Import the sample content * * @return $this */ public function convert() { $tables = array(array('name' => 'attachments', 'options' => array('name' => 'ccb_attachments'), 'query' => KFactory::tmp('lib.koowa.database.query')->select(array('tbl.id', 'tbl.post_id AS post', 'tbl.real_name AS name', 'post.post_user AS joomla_user_id', 'tbl.ccb_name AS file'))->join('left', 'ccb_posts AS post', 'tbl.post_id = post.id')), array('name' => 'forums', 'options' => array('name' => 'ccb_category'), 'query' => KFactory::tmp('lib.koowa.database.query')->select(array('(id + (SELECT MAX(id) FROM #__ccb_forums)) AS id', 'cat_name AS title', "'/' AS path"))), array('name' => 'forums', 'options' => array('name' => 'ccb_forums'), 'query' => KFactory::tmp('lib.koowa.database.query')->select(array('id', 'forum_name AS title', 'forum_desc AS description', 'topic_count AS topics', 'post_count AS posts', 'last_post_id', 'published AS enabled', 'locked', "CONCAT('/', (cat_id + (SELECT MAX(id) FROM #__ccb_forums)), '/') AS path"))), array('name' => 'posts', 'options' => array('name' => 'ccb_posts'), 'query' => KFactory::tmp('lib.koowa.database.query')->select(array('*', 'topic_id AS ninjaboard_topic_id', 'post_subject AS subject', 'post_text AS text', 'post_user AS created_by', 'FROM_UNIXTIME(post_time) AS created_on', 'ip AS user_ip', 'modified_by', 'FROM_UNIXTIME(modified_time) AS mofidied_on', 'modified_reason AS edit_reason'))), array('name' => 'topics', 'options' => array('name' => 'ccb_topics'), 'query' => KFactory::tmp('lib.koowa.database.query')->select(array('*', 'reply_count AS replies', 'topic_type AS topic_type_id', 'start_post_id AS first_post_id'))), array('name' => 'people', 'options' => array('name' => 'ccb_users'), 'query' => KFactory::tmp('lib.koowa.database.query')->select(array('user_id AS id', 'signature', 'post_count AS posts', 'avatar')))); //This returns false if the import is big enough to be done in steps. //So we need to stop the importing in this step, in order for it to initiate if ($this->importData($tables, 'ccboard') === false) { return $this; } //Convert html 2 bbcode where needed if (isset($this->data['posts'])) { foreach ($this->data['posts'] as $id => $post) { if (!isset($this->data['posts'][$id]['text'])) { continue; } $this->data['posts'][$id]['text'] = html2bbcode($post['text']); } } //Move over file attachments if (isset($this->data['attachments'])) { foreach ($this->data['attachments'] as $id => $attachment) { $from = JPATH_ROOT . '/components/com_ccboard/assets/uploads/' . $attachment['file']; $file = JPATH_ROOT . '/media/com_ninjaboard/attachments/' . $attachment['file']; //Don't do anything if avatar don't exist if (!JFile::exists($from)) { continue; } JFile::copy($from, $file); } } //Move over avatars if (isset($this->data['people'])) { foreach ($this->data['people'] as $id => $person) { if (!$person['avatar']) { continue; } $from = JPATH_ROOT . '/components/com_ccboard/assets/avatar/' . $person['avatar']; $file = basename($from); $avatar = '/media/com_ninjaboard/images/avatars/' . $person['id'] . '/' . $file; //Don't do anything if avatar don't exist if (!JFile::exists($from)) { continue; } JFile::copy($from, JPATH_ROOT . $avatar); $this->data['people'][$id]['avatar'] = $avatar; } } //Clear cache folder so that avatars and attachments cache are cleared //@TODO this should only run once $cache = JPATH_ROOT . '/cache/com_ninjaboard/'; if (JFolder::exists($cache)) { JFolder::delete($cache); } parent::convert(); return $this; }
/** * Constructor. * * @param EcrProjectBase $project * * @throws DomainException */ public function __construct(EcrProjectBase $project) { $this->project = $project; $comParams = JComponentHelper::getComponent('com_easycreator')->params; $this->localPath = $comParams->get('local_updateserver_dir'); $this->serverUrl = $comParams->get('updateserver_url'); $this->serverTitle = $comParams->get('updateserver_title'); $this->releaseUrl = $comParams->get('updateserver_release_url') ?: $this->serverUrl; $this->developmentUrl = $comParams->get('updateserver_development_url') ?: $this->serverUrl; //-- Check the base directory if (false == JFolder::exists(ECRPATH_UPDATESERVER)) { if (false == JFolder::copy(JPATH_COMPONENT_ADMINISTRATOR . '/data/updateserver', ECRPATH_UPDATESERVER)) { throw new DomainException(sprintf('%s - Can not create the update server directory: %s', __METHOD__, ECRPATH_UPDATESERVER)); } EcrHtml::message(sprintf(jgettext('The update server directory has been created in: %s'), ECRPATH_UPDATESERVER)); } //-- Check the extension directory $base = ECRPATH_UPDATESERVER . '/' . $this->project->comName; if (false == JFolder::exists($base)) { if (false == JFolder::create($base)) { throw new DomainException(sprintf('%s - Can not create the extension update server directory: %s', __METHOD__, $base)); } EcrHtml::message(sprintf(jgettext('The update server extension directory has been created in: %s'), $base)); JFolder::create($base . '/release'); JFolder::create($base . '/development'); JFile::copy(ECRPATH_UPDATESERVER . '/index.html', $base . '/index.html'); JFile::copy(ECRPATH_UPDATESERVER . '/template_extension.html', $base . '/template.html'); JFile::copy(ECRPATH_UPDATESERVER . '/updateserver.css', $base . '/updateserver.css'); JFile::copy(ECRPATH_UPDATESERVER . '/favicon.ico', $base . '/favicon.ico'); /* @var SimpleXMLElement $xml */ $xml = EcrProjectHelper::getXML('<updates/>', false); $xml->addChild('name', $this->project->name); $buffer = $xml->asFormattedXML(); //-- @todo: The file name "extension.xml" is the J! default - customize. JFile::write($base . '/extension.xml', $buffer); JFile::write($base . '/development.xml', $buffer); $feed = new EcrProjectFeed(); $feed->title = $this->serverTitle . ' - ' . $this->project->name . ' - Release Feed'; $feed->link = $this->releaseUrl . '/release-feed.xml'; $feed->id = $feed->link; $feed->author = 'XX-Author'; $feed->updated = date(DATE_ATOM); $buffer = $feed->printPretty(); JFile::write($base . '/release-feed.xml', $buffer); $feed->title = $this->serverTitle . ' - ' . $this->project->name . ' - Development Feed'; $feed->link = $this->developmentUrl . '/development-feed.xml'; $feed->id = $feed->link; $buffer = $feed->printPretty(); JFile::write($base . '/development-feed.xml', $buffer); //-- Copy the Joomla! manifest JFile::copy($this->project->getJoomlaManifestPath() . '/' . $this->project->getJoomlaManifestName(), $base . '/manifest.xml'); $this->update(); } }
/** * Copy the bootstrap.php for UnitTests to the Joomla! root. * * @return void */ public function copy_bootstrap() { if (JFile::copy(JPATH_COMPONENT . DS . 'helpers' . DS . 'bootstrap.php', JPATH_ROOT . DS . 'bootstrap.php')) { EcrHtml::message(jgettext('The file bootstrap.php has been copied to your Joomla root')); } else { EcrHtml::message(sprintf(jgettext('Can not copy file %s'), 'bootstrap.php'), 'error'); } JFactory::getApplication()->input->set('view', 'codeeye'); JFactory::getApplication()->input->set('task', 'phpunit'); parent::display(); }
/** * Import the sample content * * @return $this */ public function convert() { $tables = array(array('name' => 'attachments', 'options' => array('name' => 'ninjaboard_attachments_backups', 'identity_column' => 'id'), 'query' => KFactory::tmp('lib.koowa.database.query')->select(array('id', 'id_user AS joomla_user_id', 'id_post AS post', 'file_name AS name', 'file_name AS file'))), array('name' => 'forums', 'options' => array('name' => 'ninjaboard_categories_backups', 'identity_column' => 'id'), 'query' => KFactory::tmp('lib.koowa.database.query')->select(array('(id + (SELECT MAX(id) FROM #__ninjaboard_forums_backups)) AS id', '(SELECT SUM(posts) FROM #__ninjaboard_forums_backups) AS posts', '(SELECT SUM(topics) FROM #__ninjaboard_forums_backups) AS topics', '(SELECT MAX(id_last_post) FROM #__ninjaboard_forums_backups) AS last_post_id', 'name AS title', 'published AS enabled', 'ordering', "'/' AS path"))), array('name' => 'forums', 'options' => array('name' => 'ninjaboard_forums_backups', 'identity_column' => 'id'), 'query' => KFactory::tmp('lib.koowa.database.query')->select(array('id', 'description', 'locked', 'ordering', 'topics', 'posts', 'id_last_post AS last_post_id', 'name AS title', 'state AS enabled', "CONCAT('/', (id_cat + (SELECT MAX(id) FROM #__ninjaboard_forums_backups)), '/') AS path"))), array('name' => 'usergroups', 'options' => array('name' => 'ninjaboard_groups_backups', 'identity_column' => 'id'), 'query' => KFactory::tmp('lib.koowa.database.query')->select(array('id', 'name AS title'))), $this->buildAclQueryColumn('FORUM', 3, 4), $this->buildAclQueryColumn('TOPIC', 3, 2, '>'), $this->buildAclQueryColumn('POST', 3, 2, '>'), $this->buildAclQueryColumn('ATTACHMENT', 3, 2, '>'), $this->buildAclQueryColumn('TOPIC', 1, 3, '<'), $this->buildAclQueryColumn('POST', 1, 3, '<'), $this->buildAclQueryColumn('ATTACHMENT', 1, 3, '<'), $this->buildAclQueryColumn('FORUM', 1, 4, '<'), array('name' => 'posts', 'options' => array('name' => 'ninjaboard_posts_backups', 'identity_column' => 'id'), 'query' => KFactory::tmp('lib.koowa.database.query')->select(array('*', 'date_post AS created_on', 'date_last_edit AS modified_on', 'id_edit_by AS modified_by', 'ip_poster AS user_ip', 'id_topic AS ninjaboard_topic_id', 'id_user AS created_by', 'IFNULL(guest.guest_name, tbl.guest_name) AS guest_name'))->join('left', 'ninjaboard_posts_guests_backups AS guest', 'guest.id_post = tbl.id')), array('name' => 'topics', 'options' => array('name' => 'ninjaboard_topics_backups', 'identity_column' => 'id'), 'query' => KFactory::tmp('lib.koowa.database.query')->select(array('*', 'id_forum AS forum_id', 'views AS hits', 'type AS topic_type_id', 'id_first_post AS first_post_id', 'id_last_post AS last_post_id'))), array('name' => 'people', 'options' => array('name' => 'ninjaboard_users_backups', 'identity_column' => 'id'), 'query' => KFactory::tmp('lib.koowa.database.query')->select(array('*', 'avatar_file AS avatar')))); //This returns false if the import is big enough to be done in steps. //So we need to stop the importing in this step, in order for it to initiate if ($this->importData($tables, 'ninjaboard_legacy') === false) { return $this; } //Move over file attachments if (isset($this->data['attachments'])) { foreach ($this->data['attachments'] as $id => $attachment) { $from = JPATH_ROOT . '/components/com_ninjaboard/attachments/' . $attachment['file']; $file = JPATH_ROOT . '/media/com_ninjaboard/attachments/' . $attachment['file']; //Don't do anything if avatar don't exist if (!JFile::exists($from)) { continue; } JFile::copy($from, $file); } } //Move over avatars if (isset($this->data['people'])) { $path = 'media/ninjaboard/avatars'; $query = KFactory::tmp('lib.koowa.database.query')->select('avatar_settings')->from('ninjaboard_configs_backups')->order('default_config'); $avatar_settings = KFactory::get('lib.koowa.database.adapter.mysqli')->select($query, KDatabase::FETCH_FIELD); if ($avatar_settings) { foreach (explode("\n", $avatar_settings) as $avatar_setting) { $parts = explode('=', $avatar_setting); if ($parts[0] == 'avatar_path') { $path = $parts[1]; } } } foreach ($this->data['people'] as $id => $person) { $from = JPATH_ROOT . '/' . $path . '/' . $person['avatar']; $file = basename($from); $avatar = '/media/com_ninjaboard/images/avatars/' . $person['id'] . '/' . $file; //Don't do anything if avatar don't exist if (!JFile::exists($from)) { continue; } JFile::copy($from, JPATH_ROOT . $avatar); $this->data['people'][$id]['avatar'] = $avatar; } } //Clear cache folder so that avatars and attachments cache are cleared //@TODO this should only run once $cache = JPATH_ROOT . '/cache/com_ninjaboard/'; if (JFolder::exists($cache)) { JFolder::delete($cache); } parent::convert(); return $this; }
public function install($parent) { // add apple-touch images if not already present $sPath = $parent->getParent()->getPath('source') . '/images/'; foreach ($this->touchImages as $img) { if (!JFile::exists(JPATH_ROOT . '/images/' . $img)) { JFile::copy($sPath . $img, JPATH_ROOT . '/images/' . $img); } } return true; }