本文整理汇总了PHP中jpimport函数的典型用法代码示例。如果您正苦于以下问题:PHP jpimport函数的具体用法?PHP jpimport怎么用?PHP jpimport使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了jpimport函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logName
/**
* Calculates the absolute path to the log file
*/
function logName()
{
if (!class_exists('JoomlapackModelLog')) {
jpimport('models.log', true);
}
return JoomlapackModelLog::getLogFilename();
}
示例2: getDirectory
/**
* Returns the contents of a directory and their exclusion status
* @param $root string Start from this folder
* @return array Directories and their status
*/
function getDirectory($root)
{
// If there's no root directory specified, use the site's root
$root = is_null($root) ? JPATH_SITE : $root;
// Initialize filter list
$this->init();
// Initialize directories array
$arDirs = array();
// Get subfolders
jpimport('classes.engine.lister.default');
$FS = new JoomlapackListerAbstraction();
$allFilesAndDirs = $FS->getDirContents($root);
if (!($allFilesAndDirs === false)) {
foreach ($allFilesAndDirs as $fileName) {
if (is_dir($fileName)) {
$fileName = basename($fileName);
if (JoomlapackAbstraction::TranslateWinPath($root) == JoomlapackAbstraction::TranslateWinPath(JPATH_SITE) && ($fileName == "." || $fileName == "..")) {
} else {
if ($this->_folderFilters == "") {
$arDirs[$fileName] = false;
} else {
$arDirs[$fileName] = in_array(JoomlapackAbstraction::TranslateWinPath($root . DS . $fileName), $this->_folderFilters);
}
}
}
// if
}
// foreach
}
// if
ksort($arDirs);
return $arDirs;
}
示例3: selectAlgorithm
/**
* Selects the algorithm to use based on the domain name
*
* @param string $domain The domain to return algorithm for
* @return string The algorithm to use
*/
function selectAlgorithm($domain)
{
if (!class_exists('JoomlapackModelregistry')) {
jpimport('models.registry', true);
}
$registry =& JoomlapackModelRegistry::getInstance();
switch ($domain) {
case "installer":
switch ($registry->get('BackupType')) {
case 'full':
return 'smart';
break;
default:
return '(null)';
break;
}
break;
case "PackDB":
return $registry->get('dbAlgorithm');
break;
case "Packing":
switch ($registry->get('BackupType')) {
case 'full':
return $registry->get('packAlgorithm');
break;
default:
return '(null)';
break;
}
break;
default:
return "(null)";
break;
}
}
示例4: display
function display()
{
$task = JRequest::getCmd('task', 'default');
switch ($task) {
case 'showcomment':
JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('BUADMIN') . '</small></small>');
JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option') . '&view=buadmin');
JoomlapackHelperUtils::addLiveHelp('buadmin');
$document =& JFactory::getDocument();
$document->addStyleSheet(JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css');
jpimport('models.statistics', true);
$model =& JoomlapackModelStatistics::getInstance('Statistics', 'JoomlapackModel');
$model->setId(JRequest::getInt('id'));
$record =& $model->getStatistic();
$this->assignRef('record', $record);
JRequest::setVar('tpl', 'comment');
break;
case 'restore':
JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('BUADMIN') . '</small></small>');
JRequest::setVar('tpl', 'restore');
$this->assign('password', JRequest::getVar('password'));
$this->assign('link', JRequest::getVar('linktarget'));
break;
default:
$registry =& JoomlapackModelRegistry::getInstance();
$easy = $registry->get('easymode', false);
if (!$easy) {
JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('BUADMIN') . '</small></small>');
} else {
JToolBarHelper::title(JText::_('JOOMLAPACKEASY') . ': <small><small>' . JText::_('BUADMIN') . '</small></small>');
}
JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option'));
JToolBarHelper::spacer();
JToolBarHelper::deleteList();
JToolBarHelper::custom('deletefiles', 'delete.png', 'delete_f2.png', JText::_('STATS_LABEL_DELETEFILES'), true);
JToolBarHelper::save('download', JText::_('STATS_LOG_DOWNLOAD'));
if (!$easy) {
JToolBarHelper::editList('showcomment', JText::_('STATS_LOG_VIEWCOMMENT'));
if (JPSPECIALEDITION) {
JToolBarHelper::publish('restore', JText::_('STATS_LOG_RESTORE'));
}
}
JToolBarHelper::spacer();
if (!$easy) {
JoomlapackHelperUtils::addLiveHelp('buadmin');
} else {
JoomlapackHelperUtils::addLiveHelp('buadmineasy');
}
$document =& JFactory::getDocument();
$document->addStyleSheet(JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css');
jpimport('models.statistics', true);
$model =& JoomlapackModelStatistics::getInstance('Statistics', 'JoomlapackModel');
$list =& $model->getStatisticsListWithMeta();
$this->assignRef('list', $list);
$this->assignRef('pagination', $model->getPagination());
$this->assign('easy', $easy);
break;
}
parent::display(JRequest::getVar('tpl'));
}
示例5: display
function display()
{
// Decide what to do; delegate data loading to private methods
$task = JRequest::getCmd('task', 'display');
$layout = JRequest::getCmd('layout', 'default');
JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('CRONMAN') . '</small></small>');
switch ($layout) {
case 'default_edit':
// Get the CRON configuration definition
if ($task == 'add') {
$definition = null;
$registry =& JoomlapackModelRegistry::getInstance();
$secret = $registry->get('secret_key');
$this->assign('secret', $secret);
} else {
$id = JRequest::getInt('id', 0);
$model =& $this->getModel('cronman');
$definition = $model->getConfiguration($id);
}
$this->assign('definition', $definition);
// Get some lists and pass them on
$model =& $this->getModel('cronman');
$postops = $model->getPostOpList();
$this->assign('postops', $postops);
// Add the buttons
JToolBarHelper::save();
JToolBarHelper::apply();
JToolBarHelper::cancel();
break;
case 'default':
default:
$this->_default();
break;
}
// Load the util helper
$this->loadHelper('utils');
// Add a spacer, a help button and show the template
JToolBarHelper::spacer();
JoomlapackHelperUtils::addLiveHelp('profiles');
// Load a list of profiles
$model =& $this->getModel('cronman');
jpimport('models.profiles', true);
$profilesmodel = new JoomlapackModelProfiles();
$profiles_objects = $profilesmodel->getProfilesList(true);
$profiles = array();
foreach ($profiles_objects as $profile) {
$id = $profile->id;
$profiles[(string) $id] = $profile->description;
}
unset($profiles_objects);
unset($profilesmodel);
$this->assign('profiles', $profiles);
// Add JoomlaPack CSS
$document =& JFactory::getDocument();
$document->addStyleSheet(JURI::base() . '/components/com_joomlapack/assets/css/joomlapack.css');
// Show the view
parent::display();
}
示例6: addWarning
function addWarning($warning)
{
jpimport('core.cube');
jpimport('helpers.backup', true);
$cube =& JoomlapackCUBE::getInstance();
$cube->addWarning($warning);
$cube->save();
return;
}
示例7: renderFormattedLog
function renderFormattedLog()
{
// -- Get the log's file name
// Make sure the model is loaded
if (!class_exists('JoomlapackModelLog')) {
jpimport('models.log', true);
}
// Get log's file name
$model = new JoomlapackModelLog();
$logName = $model->getLogFilename();
// Load JFile class
jimport('joomla.filesystem.file');
if (!JFile::exists($logName)) {
// Oops! The log doesn't exist!
echo '<p>' . JText::_('LOG_ERROR_LOGFILENOTEXISTS') . '</p>';
return;
} else {
// Allright, let's load and render it
$fp = fopen($logName, "rt");
if ($fp === FALSE) {
// Oops! The log isn't readable?!
echo '<p>' . JText::_('LOG_ERROR_UNREADABLE') . '</p>';
return;
}
while (!feof($fp)) {
$line = fgets($fp);
if (!$line) {
return;
}
$exploded = explode("|", $line, 3);
unset($line);
switch (trim($exploded[0])) {
case "ERROR":
$fmtString = "<span style=\"color: red; font-weight: bold;\">[";
break;
case "WARNING":
$fmtString = "<span style=\"color: #D8AD00; font-weight: bold;\">[";
break;
case "INFO":
$fmtString = "<span style=\"color: black;\">[";
break;
case "DEBUG":
$fmtString = "<span style=\"color: #666666; font-size: small;\">[";
break;
default:
$fmtString = "<span style=\"font-size: small;\">[";
break;
}
$fmtString .= $exploded[1] . "] " . htmlspecialchars($exploded[2]) . "</span><br/>\n";
unset($exploded);
echo $fmtString;
unset($fmtString);
ob_flush();
}
}
}
示例8: echoHTML
function echoHTML()
{
jpimport('classes.engine.lister.default');
$lister = new JoomlapackListerAbstraction();
echo "<h2>Default method</h2>";
$data = $lister->getDirContents('/');
$this->do_dump($data);
echo "<h2>glob</h2>";
$data = $lister->_getDirContents_glob('/');
$this->do_dump($data);
}
示例9: display
function display()
{
$task = JRequest::getCmd('task', 'default');
$act = JRequest::getCmd('act', 'start');
// Set the toolbar title
JToolBarHelper::title(JText::_('JOOMLAPACK') . ':: <small><small>' . JText::_('BACKUP') . '</small></small>');
// Load the util helper
$this->loadHelper('utils');
switch ($task) {
case 'backup':
if (!class_exists('JoomlapackModelRegistry')) {
jpimport('models.registry', true);
}
$registry =& JoomlapackModelRegistry::getInstance();
$this->assign('backupMethod', $registry->get('backupMethod'));
break;
case 'error':
$this->assign('errormessage', JRequest::getString('message'));
JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option'));
break;
case 'finised':
JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option'));
JToolBarHelper::spacer();
JoomlapackHelperUtils::addLiveHelp('backup');
break;
default:
// Add some buttons
JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option'));
JToolBarHelper::spacer();
JoomlapackHelperUtils::addLiveHelp('backup');
// Load model
$model =& $this->getModel('backup');
// Load the Status Helper
jpimport('helpers.status', true);
$helper =& JoomlapackHelperStatus::getInstance();
// Pass on data
$this->assign('haserrors', !$helper->status);
$this->assign('hasquirks', $helper->hasQuirks());
$this->assign('quirks', $helper->getQuirksCell(!$helper->status));
$this->assign('description', $model->getDescription());
$this->assign('comment', $model->getComment());
$this->assign('profile', $model->getProfileID());
$this->assign('profilelist', $model->getProfilesList());
break;
}
$css = JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css';
$document =& JFactory::getDocument();
$document->addStyleSheet($css);
parent::display(JRequest::getCmd('tpl', null));
}
示例10: testFTPConnection
function testFTPConnection($host, $port, $user, $pass, $initdir, $usessl, $passive)
{
jpimport('abstract.enginearchiver');
jpimport('engine.packer.directftp');
jpimport('core.utility.logger');
$config = array('host' => $host, 'port' => $port, 'user' => $user, 'pass' => $pass, 'initdir' => $initdir, 'usessl' => $usessl, 'passive' => $passive);
$test = new JoomlapackPackerDirectftp();
$test->initialize('', '', $config);
$errors = $test->getError();
if (empty($errors)) {
return true;
} else {
return $errors;
}
}
示例11: getLogFilename
function getLogFilename()
{
// Make sure the registry model is loaded
if (!class_exists('JoomlapackModelRegistry')) {
jpimport('models.registry', true);
}
// Get output directory
$registry =& JoomlapackModelRegistry::getInstance();
$outdir = $registry->get('OutputDirectory');
// Get log's file name
$logName = $outdir . DS . 'joomlapack.log';
// Tidy up the path to the file
jimport('joomla.filesystem.file');
return $logName;
}
示例12: _checkPermissions
/**
* Check that the user has sufficient permissions, or die in error
*
*/
function _checkPermissions()
{
jpimport('models.registry', true);
$registry =& JoomlapackModelRegistry::getInstance();
// Is frontend backup enabled?
$febEnabled = $registry->get('enableFrontend');
if (!$febEnabled) {
die('403 ' . JText::_('ERROR_NOT_ENABLED'));
}
// Is the key good?
$key = JRequest::getVar('key');
$validKey = $registry->get('secretWord');
if ($key != $validKey) {
die('403 ' . JText::_('ERROR_INVALID_KEY'));
}
}
示例13: _processCUBE
function _processCUBE()
{
jpimport('core.cube');
$cube =& JoomlapackCUBE::getInstance();
$array = $cube->getCUBEArray();
if ($array['Error'] != '') {
$action = 'error';
$message = $array['Error'];
} elseif ($array['HasRun'] == 1) {
$action = 'finished';
$message = '';
} else {
$action = 'step';
$message = '';
}
return array($action, $message);
}
示例14: echoHTML
function echoHTML()
{
jpimport('helpers.lang');
$errorStack = array();
// Initialize an errors stack
// Cleanup locks
jpimport('classes.core.cube');
JoomlapackCUBE::cleanup();
// Test for the existence of a default temporary folder
if (!is_dir(JPATH_COMPONENT_ADMINISTRATOR . DS . 'backup')) {
// Temp dir doesn't exist; try to create one
if (!@mkdir(JPATH_COMPONENT_ADMINISTRATOR . DS . 'backup')) {
$errorStack[] = JoomlapackLangManager::_('UNLOCK_CANTCREATEDIR');
} else {
// Try creating a deafult .htaccess
$htaccess = <<<END
Deny from all
END;
$fp = @fopen(JPATH_COMPONENT_ADMINISTRATOR . DS . 'backup' . DS . '.htaccess');
if ($fp === false) {
$errorStack[] = JoomlapackLangManager::_('UNLOCK_CANTCREATEHTACCESS');
} else {
@fputs($fp, $htaccess);
@fclose($fp);
}
}
}
// Get some more HTML fragments
echo JoomlapackCommonHTML::getAdminHeadingHTML(JoomlapackLangManager::_('CPANEL_UNLOCK'));
?>
<p>
<?php
if (count($errorStack) == 0) {
echo JoomlapackLangManager::_('UNLOCK_DONE');
} else {
foreach ($errorStack as $error) {
echo "<p class=\"error\">{$error}</p>";
}
}
?>
</p>
<?php
}
示例15: getDirectory
/**
* Gets the contents of a directory and flags excluded files
*
* @param string $root The directory to scan
* @return array An associative array of associative arrays (use the code, Luke!)
*/
function getDirectory($root)
{
// If there's no root directory specified, use the site's root
$root = is_null($root) ? JPATH_SITE : $root;
$isSiteRoot = JoomlapackAbstraction::TranslateWinPath($root) == JoomlapackAbstraction::TranslateWinPath(JPATH_SITE);
// Initialize filter list
$this->init();
// Initialize the two arrays to be returned
$arDirs = array();
$arFiles = array();
// Get directory's contents
jpimport('classes.engine.lister.default');
$FS = new JoomlapackListerAbstraction();
$allFilesAndDirs = $FS->getDirContents($root);
if (!($allFilesAndDirs === false)) {
foreach ($allFilesAndDirs as $fileName) {
//$fileName = basename($fileName);
if (is_dir($fileName)) {
$fileName = basename($fileName);
if ($isSiteRoot && ($fileName == '.' || $fileName == '..') || $fileName == '.') {
// Don't include . and .. for site's root, or . for all dirs
} else {
if ($fileName != '.') {
$arDirs[] = $fileName;
}
}
} elseif (is_file($fileName)) {
$fileName = basename($fileName);
$excluded = is_array($this->_singleFileFilters) ? in_array(JoomlapackAbstraction::TranslateWinPath($root . DS . $fileName), $this->_singleFileFilters) : false;
$arFiles[$fileName] = $excluded;
}
}
}
sort($arDirs);
$ret['folders'] = $arDirs;
unset($arDirs);
$ret['files'] = $arFiles;
unset($arFiles);
return $ret;
}