本文整理汇总了PHP中JPath::canChmod方法的典型用法代码示例。如果您正苦于以下问题:PHP JPath::canChmod方法的具体用法?PHP JPath::canChmod怎么用?PHP JPath::canChmod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JPath
的用法示例。
在下文中一共展示了JPath::canChmod方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uploader
public static function uploader()
{
$params = modPwebcontactHelper::getParams();
// check if upload is enabled
if (!$params->get('show_upload', 0)) {
if (PWEBCONTACT_DEBUG) {
modPwebcontactHelper::setLog('Uploader disabled');
}
return array('status' => 402, 'files' => array());
}
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
$path = $params->get('upload_path');
if (!JFolder::exists($path)) {
JFolder::create($path, 0777);
}
if (!is_writable($path) and JPath::canChmod($path)) {
JPath::setPermissions($path, null, '0777');
}
if (!is_writable($path)) {
if (PWEBCONTACT_DEBUG) {
modPwebcontactHelper::setLog('Upload dir is not writable');
}
return array('status' => 403, 'files' => array());
}
// load uploader
$uploader = new modPWebContactUploader(array('upload_dir' => $params->get('upload_path'), 'upload_url' => $params->get('upload_url'), 'accept_file_types' => '/(\\.|\\/)(' . $params->get('upload_allowed_ext', '.+') . ')$/i', 'max_file_size' => (double) $params->get('upload_size_limit', 1) * 1024 * 1024, 'image_versions' => array(), 'delete_type' => 'POST'), false, array(1 => JText::_('MOD_PWEBCONTACT_UPLOAD_ERR_1'), 3 => JText::_('MOD_PWEBCONTACT_UPLOAD_ERR_3'), 4 => JText::_('MOD_PWEBCONTACT_UPLOAD_ERR_4'), 6 => JText::_('MOD_PWEBCONTACT_UPLOAD_ERR_6'), 7 => JText::_('MOD_PWEBCONTACT_UPLOAD_ERR_7'), 8 => JText::_('MOD_PWEBCONTACT_UPLOAD_ERR_8'), 'post_max_size' => JText::_('MOD_PWEBCONTACT_UPLOAD_ERR_1'), 'max_file_size' => JText::_('MOD_PWEBCONTACT_UPLOAD_SIZE_ERR'), 'accept_file_types' => JText::_('MOD_PWEBCONTACT_UPLOAD_TYPE_ERR')));
$response = $uploader->handleRequest();
if (PWEBCONTACT_DEBUG) {
modPwebcontactHelper::setLog('Uploader exit');
}
return $response;
}
示例2: isWritable
/**
* Determines if a given path is writable in the current environment
*
* @param string $path Path to check
*
* @return boolean True if writable
*
* @since 4.0
*/
public static function isWritable($path)
{
if (JFactory::getConfig()->get('config.ftp_enable')) {
return true;
} else {
while (!file_exists($path)) {
$path = dirname($path);
}
return is_writable($path) || JPath::isOwner($path) || JPath::canChmod($path);
}
}
示例3: onCheck
/**
* A JParameter object holding the parameters for the plugin
*
* @var A JParameter object
* @access public
* @since 1.5
*/
public function onCheck()
{
//Check System requirements for the editor
define('JCK_BASE', JPATH_CONFIGURATION . DS . 'plugins' . DS . 'editors' . DS . 'jckeditor');
if (!JFolder::exists(JCK_BASE)) {
return;
}
$perms = fileperms(JPATH_CONFIGURATION . DS . 'index.php');
$perms = decoct($perms & 0777);
$default_fperms = '0644';
$default_dperms = '0755';
if ($perms == 777 || $perms == 666) {
$default_fperms = '0666';
$default_dperms = '0777';
}
$fperms = JCK_BASE . DS . 'config.js';
if (!stristr(PHP_OS, 'WIN') && JPath::canChmod(JCK_BASE) && $perms != decoct(fileperms($fperms) & 0777)) {
$path = JCK_BASE . DS . 'plugins';
if (!JPath::setPermissions($path, $default_fperms, $default_dperms)) {
$this->app->enqueueMessage(JText::_('COM_JCKMAN_CPANEL_AUTO_CORRECTION_FAILED_INCORRECT_FILE_PERMISSION'), 'error');
}
}
$this->app->enqueueMessage(JText::_('COM_JCKMAN_CPANEL_SYSTEM_CHECKED_AND_UPDATED'));
}
示例4: is_writable
<table cellpadding="1">
<tr>
<td width="220">
<span class="componentheading">
<?php
echo _JOOMAP_CSS;
?>
:
<?php
echo is_writable($template_path) ? '<strong style="color:green;">' . _JOOMAP_CFG_WRITEABLE . '</strong>' : '<strong style="color:red;">' . _JOOMAP_CFG_UNWRITEABLE . '</strong>';
?>
</span>
</td>
<?php
if (JPath::canChmod($template_path) && is_writable($template_path)) {
?>
<td>
<input type="checkbox" id="disable_write" name="disable_write" value="1" />
<label for="disable_write"><?php
echo _JOOMAP_MSG_MAKE_UNWRITEABLE;
?>
</label>
</td>
<?php
} else {
?>
<td>
示例5: setFolderPermissions
/**
* Set default folder permissions
*
* @param string $path The full file path
* @param string $buffer The buffer to write
* @return boolean True on success
* @since 1.5
*/
function setFolderPermissions($folder, $options)
{
// Get the options as a JObject for easier handling.
$options = JArrayHelper::toObject($options, 'JObject');
// Initialise variables.
$ftpFlag = false;
$ftpRoot = $options->ftpRoot;
// Determine if the path is "chmodable".
if (!JPath::canChmod(JPath::clean(JPATH_SITE . DS . $folder))) {
$ftpFlag = true;
}
// Do NOT use ftp if it is not enabled
if (empty($options->ftpEnable)) {
$ftpFlag = false;
}
if ($ftpFlag == true) {
// Connect the FTP client
jimport('joomla.client.ftp');
$client =& JFTP::getInstance($options['ftpHost'], $options['ftpPort']);
$client->login($options['ftpUser'], $options['ftpPassword']);
//Translate path for the FTP account
$path = JPath::clean($ftpRoot . "/" . $folder);
/*
* chmod using ftp
*/
if (!$client->chmod($path, '0755')) {
$ret = false;
}
$client->quit();
$ret = true;
} else {
$path = JPath::clean(JPATH_SITE . DS . $folder);
if (!@chmod($path, octdec('0755'))) {
$ret = false;
} else {
$ret = true;
}
}
return $ret;
}
示例6: store
function store()
{
jimport('joomla.filesystem.folder');
$item = $this->getTable('adagencyConfig');
$imagepath = str_replace("/administrator", "", JPATH_BASE);
$imagepath = $imagepath . "/images/stories/";
$data = JRequest::get('post');
$newimgfolder = $data['imgfolder'];
$full_path = JFolder::makeSafe($imagepath . $newimgfolder);
if (!JFolder::exists($full_path)) {
JFolder::create($full_path);
// mkdir ( $imagepath . $newimgfolder );
}
if (JPath::canChmod($full_path)) {
JPath::setPermissions($full_path);
}
$data['payment'] = @serialize($data['payment']);
$show = '';
$mandatory = '';
$database = JFactory::getDBO();
if (isset($data['show'])) {
foreach ($data['show'] as $key => $value) {
if ($value == 1) {
$show .= $key . ';';
}
}
}
if (isset($data['mandatory'])) {
foreach ($data['mandatory'] as $key => $value) {
if ($value == 1) {
$mandatory .= $key . ';';
}
}
}
$data['params'] = @serialize($data['params']);
$data['show'] = $show;
$data['mandatory'] = $mandatory;
$data['txtafterreg'] = JRequest::getVar("txtafterreg", "", "post", "string", JREQUEST_ALLOWHTML);
$data['bodyafterreg'] = JRequest::getVar("bodyafterreg", "", "post", "string", JREQUEST_ALLOWHTML);
$data['bodyafterregaa'] = JRequest::getVar("bodyafterregaa", "", "post", "string", JREQUEST_ALLOWHTML);
$data['bodyactivation'] = JRequest::getVar("bodyactivation", "", "post", "string", JREQUEST_ALLOWHTML);
$data['bodyrep'] = JRequest::getVar("bodyrep", "", "post", "string", JREQUEST_ALLOWHTML);
$data['bodycmpappv'] = JRequest::getVar("bodycmpappv", "", "post", "string", JREQUEST_ALLOWHTML);
$data['bodycmpdis'] = JRequest::getVar("bodycmpdis", "", "post", "string", JREQUEST_ALLOWHTML);
$data['bodyadappv'] = JRequest::getVar("bodyadappv", "", "post", "string", JREQUEST_ALLOWHTML);
$data['bodyaddisap'] = JRequest::getVar("bodyaddisap", "", "post", "string", JREQUEST_ALLOWHTML);
$data['bodyadvdis'] = JRequest::getVar("bodyadvdis", "", "post", "string", JREQUEST_ALLOWHTML);
$data['bodynewad'] = JRequest::getVar("bodynewad", "", "post", "string", JREQUEST_ALLOWHTML);
$data['bodynewcmp'] = JRequest::getVar("bodynewcmp", "", "post", "string", JREQUEST_ALLOWHTML);
$data['bodycmpex'] = JRequest::getVar("bodycmpex", "", "post", "string", JREQUEST_ALLOWHTML);
$data['bodynewuser'] = JRequest::getVar("bodynewuser", "", "post", "string", JREQUEST_ALLOWHTML);
$data['overviewcontent'] = JRequest::getVar("overviewcontent", "", "post", "string", JREQUEST_ALLOWHTML);
$data['sbcmpexpadm'] = JRequest::getVar("sbcmpexpadm", "", "post", "string", JREQUEST_ALLOWHTML);
$data['bodycmpexpadm'] = JRequest::getVar("bodycmpexpadm", "", "post", "string", JREQUEST_ALLOWHTML);
$data['forcehttps'] = JRequest::getVar("forcehttps", "", "post", "string", JREQUEST_ALLOWHTML);
$data['sbadchanged'] = JRequest::getVar("sbadchanged", "", "post", "string", JREQUEST_ALLOWHTML);
$data['boadchanged'] = JRequest::getVar("boadchanged", "", "post", "string", JREQUEST_ALLOWHTML);
$data['txtafterreg'] = fk_slashes($data['txtafterreg']);
$data['bodyafterreg'] = fk_slashes($data['bodyafterreg']);
$data['bodyafterregaa'] = fk_slashes($data['bodyafterregaa']);
$data['bodyactivation'] = fk_slashes($data['bodyactivation']);
$data['bodyrep'] = fk_slashes($data['bodyrep']);
$data['bodycmpappv'] = fk_slashes($data['bodycmpappv']);
$data['bodycmpdis'] = fk_slashes($data['bodycmpdis']);
$data['bodyadappv'] = fk_slashes($data['bodyadappv']);
$data['bodyaddisap'] = fk_slashes($data['bodyaddisap']);
$data['bodyadvdis'] = fk_slashes($data['bodyadvdis']);
$data['bodynewad'] = fk_slashes($data['bodynewad']);
$data['bodynewcmp'] = fk_slashes($data['bodynewcmp']);
$data['bodycmpex'] = fk_slashes($data['bodycmpex']);
$data['bodynewuser'] = fk_slashes($data['bodynewuser']);
$data['overviewcontent'] = fk_slashes($data['overviewcontent']);
$data['sbcmpexpadm'] = fk_slashes($data['sbcmpexpadm']);
$data['bodycmpexpadm'] = fk_slashes($data['bodycmpexpadm']);
$data['txtafterreg'] = $this->addFullUrl($data['txtafterreg']);
$data['bodyafterreg'] = $this->addFullUrl($data['bodyafterreg']);
$data['bodyafterregaa'] = $this->addFullUrl($data['bodyafterregaa']);
$data['bodyactivation'] = $this->addFullUrl($data['bodyactivation']);
$data['bodyrep'] = $this->addFullUrl($data['bodyrep']);
$data['bodycmpappv'] = $this->addFullUrl($data['bodycmpappv']);
$data['bodycmpdis'] = $this->addFullUrl($data['bodycmpdis']);
$data['bodyadappv'] = $this->addFullUrl($data['bodyadappv']);
$data['bodyaddisap'] = $this->addFullUrl($data['bodyaddisap']);
$data['bodyadvdis'] = $this->addFullUrl($data['bodyadvdis']);
$data['bodynewad'] = $this->addFullUrl($data['bodynewad']);
$data['bodynewcmp'] = $this->addFullUrl($data['bodynewcmp']);
$data['bodycmpex'] = $this->addFullUrl($data['bodycmpex']);
$data['bodynewuser'] = $this->addFullUrl($data['bodynewuser']);
$data['overviewcontent'] = $this->addFullUrl($data['overviewcontent']);
$data['sbcmpexpadm'] = $this->addFullUrl($data['sbcmpexpadm']);
$data['bodycmpexpadm'] = $this->addFullUrl($data['bodycmpexpadm']);
/* Pictures in Emails */
$data['txtafterreg'] = $this->fixIMG($data['txtafterreg']);
$data['bodyafterreg'] = $this->fixIMG($data['bodyafterreg']);
$data['bodyafterregaa'] = $this->fixIMG($data['bodyafterregaa']);
$data['bodyactivation'] = $this->fixIMG($data['bodyactivation']);
$data['bodyrep'] = $this->fixIMG($data['bodyrep']);
$data['bodycmpappv'] = $this->fixIMG($data['bodycmpappv']);
$data['bodycmpdis'] = $this->fixIMG($data['bodycmpdis']);
$data['bodyadappv'] = $this->fixIMG($data['bodyadappv']);
//.........这里部分代码省略.........
示例7: getCacheThumbChmod
/**
* Method to check if the permissions of Phpthumb cache folder
*
* @access public
* @return boolean True on success
*/
function getCacheThumbChmod()
{
static $return;
if ($return === null) {
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.jpath');
$phpthumbcache = JPath::clean(JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'librairies' . DS . 'phpthumb' . DS . 'cache');
// CHECK phpThumb cache exists and create the folder
if (!JFolder::exists($phpthumbcache) && !JFolder::create($phpthumbcache)) {
JError::raiseWarning(100, 'Error: Unable to create phpThumb folder: ' . $phpthumbcache . ' image thumbnail will not work properly');
return true;
// Cancel task !! to allow user to continue
}
// CHECK phpThumb cache permissions
$return = preg_match('/rwxr.xr.x/i', JPath::getPermissions($phpthumbcache)) ? true : false;
// If permissions not good check if we can change them
if (!$return && !JPath::canChmod($phpthumbcache)) {
JError::raiseWarning(100, 'Error: Unable to change phpThumb folder permissions: ' . $phpthumbcache . ' there maybe a wrong owner of the folder. Correct permissions are important for proper thumbnails and for -security-');
return true;
// Cancel task !! to allow user to continue
}
}
return $return;
}
示例8: install
//.........这里部分代码省略.........
</tr>
<tr>
<td>Author:</td>
<td><a href="http://www.arkextensions.com" target="_blank">www.arkextensions.com</a></td>
</tr>
<tr>
<td>Copyright:</td>
<td>© WebxSolution Ltd, All rights reserved.</td>
</tr>
<tr>
<td>License:</td>
<td>GPLv2.0</td>
</tr>
<tr>
<td>More info:</td>
<td><a href="http://arkextensions.com/terms-of-use" target="_blank">http://arkextensions.com/terms-of-use</a></td>
</tr>
</table>';
$row->ordering = $row->getNextOrder("position='ark_cpanel'");
if (!$row->store()) {
$mainframe->enqueueMessage(JText::sprintf('COM_ARKEDITOR_CUSTOM_INSTALL', 'Ark Editor custom Module data!'));
}
$row->id = 0;
$row->title = 'Tip of the Day';
$row->module = 'mod_arktip';
$row->params = '{"moduleclass_sfx":"box-arktip","icon":"info-circle"}';
$row->ordering = $row->getNextOrder("position='ark_cpanel'");
if (!$row->store()) {
$mainframe->enqueueMessage(JText::sprintf('COM_ARKEDITOR_CUSTOM_INSTALL', 'Tip of the day data!'));
}
$row->id = 0;
$row->title = 'GO PRO!';
$row->module = 'mod_arkpro';
$row->params = '{"moduleclass_sfx":"box-arkpro","icon":"lightning"}';
$row->ordering = $row->getNextOrder("position='ark_cpanel'");
if (!$row->store()) {
$mainframe->enqueueMessage(JText::sprintf('COM_ARKEDITOR_CUSTOM_INSTALL', 'Pro Module data!'));
}
/*===========================================================> */
/*============================================> FOOTER MODULES */
/*===========================================================> */
$row = JTable::getInstance('module');
$row->module = '';
$row->position = 'ark_footer';
$row->published = 1;
$row->showtitle = 1;
$row->access = 1;
$row->client_id = 1;
$row->params = '{}';
/*$row->id = 0;
$row->title = 'Dashboard';
$row->module = 'mod_arkquickicon';
$row->ordering = $row->getNextOrder( "position='ark_footer'" );
if (!$row->store()) {
$mainframe->enqueueMessage( JText::sprintf('COM_ARKEDITOR_CUSTOM_INSTALL','Control Panel icon Module data!') );
}*/
jimport('joomla.filesystem.file');
//Check System requirements for the editor
define('ARKEDITOR_BASE', JPATH_CONFIGURATION . DS . 'plugins' . DS . 'editors' . DS . 'arkeditor/ckeditor');
if (!JFolder::exists(ARKEDITOR_BASE)) {
$mainframe->enqueueMessage(JText::_('COM_ARKEDITOR_CUSTOM_INSTALL_SYSTEM_DETECTED_EDITOR_NOT_INSTALLED'));
return;
}
$perms = fileperms(JPATH_CONFIGURATION . DS . 'index.php');
$perms = decoct($perms & 0777);
$default_fperms = '0644';
$default_dperms = '0755';
if ($perms == 777 || $perms == 666) {
$default_fperms = '0666';
$default_dperms = '0777';
}
$fperms = ARKEDITOR_BASE . DS . 'config.js';
if (!stristr(PHP_OS, 'WIN') && JPath::canChmod(ARKEDITOR_BASE) && $perms != decoct(fileperms($fperms) & 0777)) {
$path = ARKEDITOR_BASE . DS . 'plugins';
if (!JPath::setPermissions($path, $default_fperms, $default_dperms)) {
$mainframe->enqueueMessage(JText::_('COM_ARKEDITOR_CUSTOM_INSTALL_SYSTEM_DETECTED_INCORRECT_FILE_PERMISSONS_FOR_EDITOR'));
}
}
//for upgrade
$query = 'SELECT p.name FROM `#__ark_editor_plugins` p WHERE p.iscore = 0';
$db->setQuery($query);
$results = $db->loadObjectList();
if (!empty($results)) {
for ($i = 0; $i < count($results); $i++) {
if (JFolder::exists(JPATH_PLUGINS . DS . 'editors' . DS . 'arkeditor' . DS . 'plugins' . DS . $results[$i]->name) && !JFolder::exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_arkeditor' . DS . 'editor' . DS . 'plugins' . DS . $results[$i]->name)) {
$src = JPATH_PLUGINS . DS . 'editors' . DS . 'arkeditor' . DS . 'plugins' . DS . $results[$i]->name;
$dest = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_arkeditor' . DS . 'editor' . DS . 'plugins' . DS . $results[$i]->name;
if (!JFolder::copy($src, $dest)) {
$mainframe->enqueueMessage(JText::sprintf('COM_ARKEDITOR_CUSTOM_INSTALL_UNABLE_TO_MOVE_SPRINTF', 'base plugin .' . $results[$i]->name . ' to ARK backup folder!'));
}
}
}
//end for loop
}
//fix remove component install file from the editor's folder
$file = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_arkeditor' . DS . 'editor' . DS . 'com_arkeditor.xml';
if (JFile::exists($file)) {
JFile::delete($file);
}
}
示例9: mkdir
mkdir($mosConfig_absolute_path . '/images/jtips');
}
} else {
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.path');
if (!JFolder::exists($mosConfig_absolute_path . '/images/jtips')) {
JFolder::create($mosConfig_absolute_path . '/images/jtips');
}
//create empty img files and make writeable
JFile::write($mosConfig_absolute_path . '/images/jtips/' . $filename_100, '');
if (JPath::canChmod($mosConfig_absolute_path . '/images/jtips/' . $filename_100)) {
JPath::setPermissions($mosConfig_absolute_path . '/images/jtips/' . $filename_100, 666);
}
JFile::write($mosConfig_absolute_path . '/images/jtips/' . $filename_25, '');
if (JPath::canChmod($mosConfig_absolute_path . '/images/jtips/' . $filename_25)) {
JPath::setPermissions($mosConfig_absolute_path . '/images/jtips/' . $filename_25, 666);
}
}
/**
* This is the only part that requires actual apache access to the images directory
* Difficult to resize an image if apache cannot write the image anywhere
*/
$ti = new ThumbnailImage();
$ti->src_file = $_FILES['logo']['tmp_name'];
$ti->dest_type = THUMB_JPEG;
$ti->dest_file = $mosConfig_absolute_path . '/images/jtips/' . $filename_100;
$ti->max_width = 100;
$ti->max_height = 100;
$ti->Output();
$ti = null;
示例10: make_user_dir
function make_user_dir($base_dir)
{
if (!is_dir($base_dir)) {
if (!JFolder::create($base_dir, 0755)) {
JError::raiseWarning('SOME_ERROR_CODE', 'JFolder::create: ' . JText::_('KISS_GENERAL_ERROR_DIRNOTCREATED'), 'Path: ' . $base_dir);
} else {
// Try to adjust the file and folder rights
if (JPath::canChmod($base_dir)) {
JPath::setPermissions($base_dir, 0644, 0755);
} else {
JError::raiseWarning('SOME_ERROR_CODE', 'JFolder::create: ' . JText::_('KISS_GENERAL_ERROR_FOLDERPERMISSIONS'), 'Path: ' . $base_dir);
}
// End if JPath::canChmod ...
}
// End if(!JFolder::create ...)
}
// End if (!is_dir....)
}
示例11: changeChmod
function changeChmod()
{
//set core plugin permissons
// Try to recover from bad chmod settings
if (!defined('JFCK_BASE')) {
define('JFCK_BASE', $this->_path_root . 'plugins/editors/fckeditor/editor');
}
//file manager plugin
$dir = JFCK_BASE . '/filemanager';
$perms = fileperms($this->_path_root . 'index.php');
$perms = decoct($perms & 0777);
switch ($perms) {
case 666:
$perms = 777;
break;
case 644:
$perms = 755;
}
$default_fperms = '0644';
$default_dperms = '0755';
if (!stristr(PHP_OS, 'WIN') && file_exists($dir . '/connectors/php/connector.php') && JPath::canChmod($dir . '/connectors/php/connector.php') && $perms != decoct(fileperms($dir) & 0777)) {
$oldumask = umask(0);
if ($perms == 755) {
@chmod(JFCK_BASE, 0755);
@chmod($dir, 0755);
JPath::setPermissions($dir);
} else {
$default_fperms = '0666';
$default_dperms = '0777';
@chmod(JFCK_BASE, 0777);
@chmod($dir, 0777);
JPath::setPermissions($dir, '0666', '0777');
}
// About plugin
$dir = JFCK_BASE . '/dialog';
@chmod($dir, octdec($default_dperms));
@chmod($dir . '/fck_about.php', octdec($default_fperms));
//JPath::setPermissions($dir,$default_fperms, $default_dperms);
//JLink plugin
$dir = JFCK_BASE . '/plugins';
@chmod($dir, octdec($default_dperms));
@chmod($dir . '/jlink', octdec($default_dperms));
@chmod($dir . '/jlink/suggest.php', octdec($default_fperms));
@chmod($dir . '/jlink/suggest.class.php', octdec($default_fperms));
//SpellCheck plugin
$dir = JFCK_BASE . '/plugins/pspellcheck';
@chmod($dir, octdec($default_dperms));
@chmod($dir . '/spellcheck', octdec($default_dperms));
@chmod($dir . '/spellcheck/spellchecker.php', octdec($default_fperms));
umask($oldumask);
}
}
示例12: canChmod
/**
* Helper wrapper method for canChmod
*
* @param string $path Path to check.
*
* @return boolean True if path can have mode changed.
*
* @see JPath::canChmod()
* @since 3.4
*/
public function canChmod($path)
{
return JPath::canChmod($path);
}
示例13: setFolderPermissions
/**
* Set default folder permissions
*
* @param string $folder
* @param string $options
*
* @return boolean True on success
*
* @since 3.0
*/
public function setFolderPermissions($folder, $options)
{
// Get the options as a object for easier handling.
$options = JArrayHelper::toObject($options);
$ftpFlag = false;
$ftpRoot = $options->ftpRoot;
// Determine if the path is "chmodable".
if (!JPath::canChmod(JPath::clean(JPATH_SITE . '/' . $folder))) {
$ftpFlag = true;
}
// Do NOT use ftp if it is not enabled
if (empty($options->ftp_enable)) {
$ftpFlag = false;
}
if ($ftpFlag == true) {
// Connect the FTP client
$client = JClientFtp::getInstance($options['ftp_host'], $options['ftp_port']);
$client->login($options['ftp_user'], $options['ftp_pass']);
// Translate path for the FTP account
$path = JPath::clean($ftpRoot . "/" . $folder);
// Chmod using ftp
if (!$client->chmod($path, '0755')) {
$ret = false;
}
$client->quit();
$ret = true;
} else {
$path = JPath::clean(JPATH_SITE . '/' . $folder);
if (!@chmod($path, octdec('0755'))) {
$ret = false;
} else {
$ret = true;
}
}
return $ret;
}
示例14: finishExceptions
function finishExceptions()
{
if ($this->upgrade && !empty($this->no_overwrite) || !$this->upgrade) {
foreach ($this->no_overwrite as $restore) {
if (JPath::canChmod($restore['dest'])) {
JPath::setPermissions($restore['dest']);
}
}
if ($this->copyFiles($this->no_overwrite)) {
JFolder::delete($this->backup_dir);
}
}
}
示例15: install
//.........这里部分代码省略.........
$row->ordering = $row->getNextOrder("position='jck_cpanel'");
if (!$row->store()) {
$mainframe->enqueueMessage(JText::sprintf('COM_JCKMAN_CUSTOM_INSTALL', 'JCK PlugMan custom Module data!'));
}
jimport('joomla.filesystem.file');
$src = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jckman' . DS . 'editor' . DS . 'pluginoverrides.php';
$dest = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'jckeditor' . DS . 'includes' . DS . 'ckeditor' . DS . 'plugins' . DS . 'editor' . DS . 'pluginoverrides.php';
if (!JFile::copy($src, $dest)) {
$mainframe->enqueueMessage(JText::sprintf('COM_JCKMAN_CUSTOM_INSTALL_UNABLE_TO_MOVE_SPRINTF', 'pluginoverrides JCK plugin!'));
}
$src = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jckman' . DS . 'editor' . DS . 'languageoverrides.php';
$dest = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'jckeditor' . DS . 'includes' . DS . 'ckeditor' . DS . 'plugins' . DS . 'editor' . DS . 'languageoverrides.php';
if (!JFile::copy($src, $dest)) {
$mainframe->enqueueMessage(JText::sprintf('COM_JCKMAN_CUSTOM_INSTALL_UNABLE_TO_MOVE_SPRINTF', 'languageoverrides JCK plugin!'));
}
$src = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jckman' . DS . 'editor' . DS . 'acl.php';
$dest = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'jckeditor' . DS . 'includes' . DS . 'ckeditor' . DS . 'plugins' . DS . 'editor' . DS . 'acl.php';
if (!JFile::copy($src, $dest)) {
$mainframe->enqueueMessage(JText::sprintf('COM_JCKMAN_CUSTOM_INSTALL_UNABLE_TO_MOVE_SPRINTF', ' ACL JCK plugin!'));
}
$src = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jckman' . DS . 'editor' . DS . 'components.php';
$dest = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'jckeditor' . DS . 'includes' . DS . 'ckeditor' . DS . 'plugins' . DS . 'toolbar' . DS . 'components.php';
if (!JFile::copy($src, $dest)) {
$mainframe->enqueueMessage(JText::sprintf('COM_JCKMAN_CUSTOM_INSTALL_UNABLE_TO_MOVE_SPRINTF', 'JCK toolbar plugin!'));
}
$src = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jckman' . DS . 'editor' . DS . 'plugins.php';
$dest = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'jckeditor' . DS . 'includes' . DS . 'ckeditor' . DS . 'plugins.php';
if (!JFile::copy($src, $dest)) {
$mainframe->enqueueMessage(JText::sprintf('COM_JCKMAN_CUSTOM_INSTALL_UNABLE_TO_MOVE_SPRINTF', 'base plugins file to JCK library!'));
}
//$src = JPATH_ADMINISTRATOR.DS .'components' .DS. 'com_jckman' .DS. 'editor'.DS.'includes.php';
//$dest = JPATH_PLUGINS.DS.'editors'.DS.'jckeditor'.DS.'includes.php';
/*
if( !JFile::copy( $src, $dest) ){
$mainframe->enqueueMessage( JText::_('Unable to move updated includes file to JCK plugin!') );
}
*/
unset($row);
//Check System requirements for the editor
define('JCK_BASE', JPATH_CONFIGURATION . DS . 'plugins' . DS . 'editors' . DS . 'jckeditor');
if (!JFolder::exists(JCK_BASE)) {
$mainframe->enqueueMessage(JText::_('COM_JCKMAN_CUSTOM_INSTALL_SYSTEM_DETECTED_EDITOR_NOT_INSTALLED'));
return;
}
$perms = fileperms(JPATH_CONFIGURATION . DS . 'index.php');
$perms = decoct($perms & 0777);
$default_fperms = '0644';
$default_dperms = '0755';
if ($perms == 777 || $perms == 666) {
$default_fperms = '0666';
$default_dperms = '0777';
}
$fperms = JCK_BASE . DS . 'config.js';
if (!stristr(PHP_OS, 'WIN') && JPath::canChmod(JCK_BASE) && $perms != decoct(fileperms($fperms) & 0777)) {
$path = JCK_BASE . DS . 'plugins';
if (!JPath::setPermissions($path, $default_fperms, $default_dperms)) {
$mainframe->enqueueMessage(JText::_('COM_JCKMAN_CUSTOM_INSTALL_SYSTEM_DETECTED_INCORRECT_FILE_PERMISSONS_FOR_EDITOR'));
}
}
// clear explorer cache to avoid breaking the export feature (filename too long)
// This code is also run of install/upgrade of the jckexplorer plugin
$cache = JCK_BASE . '/plugins/jckexplorer/cache';
if (JFolder::exists($cache)) {
// Delete cache folders
foreach (JFolder::folders($cache) as $folder) {
JFolder::delete($cache . DS . $folder);
}
//end foreach
// Delete cache files
foreach (JFolder::files($cache) as $file) {
if ($file != 'index.html') {
JFile::delete($cache . DS . $file);
}
//end if
}
//end foreach
}
//end if
//for upgrade
$query = 'SELECT p.name FROM `#__jckplugins` p WHERE p.iscore = 0';
$db->setQuery($query);
$results = $db->loadObjectList();
if (!empty($results)) {
for ($i = 0; $i < count($results); $i++) {
if (JFolder::exists(JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'plugins' . DS . $results[$i]->name) && !JFolder::exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jckman' . DS . 'editor' . DS . 'plugins' . DS . $results[$i]->name)) {
$src = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'plugins' . DS . $results[$i]->name;
$dest = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jckman' . DS . 'editor' . DS . 'plugins' . DS . $results[$i]->name;
if (!JFolder::copy($src, $dest)) {
$mainframe->enqueueMessage(JText::sprintf('COM_JCKMAN_CUSTOM_INSTALL_UNABLE_TO_MOVE_SPRINTF', 'base plugin .' . $results[$i]->name . ' to JCK backup folder!'));
}
}
}
//end for loop
}
//fix remove component install file from the editor's folder
$file = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jckman' . DS . 'editor' . DS . 'com_jckman.xml';
if (JFile::exists($file)) {
JFile::delete($file);
}
}