• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP mosPathName函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中mosPathName函数的典型用法代码示例。如果您正苦于以下问题:PHP mosPathName函数的具体用法?PHP mosPathName怎么用?PHP mosPathName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了mosPathName函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: showInstalledModules

/**
* @param string The URL option
*/
function showInstalledModules($_option)
{
    global $database, $mosConfig_absolute_path, $adminLanguage;
    $filter = mosGetParam($_POST, 'filter', '');
    $select[] = mosHTML::makeOption('', $adminLanguage->A_COMP_MOD_ALL);
    $select[] = mosHTML::makeOption('0', $adminLanguage->A_MENU_SITE_MOD);
    $select[] = mosHTML::makeOption('1', $adminLanguage->A_INSTALL_MOD_ADMIN_MOD);
    $lists['filter'] = mosHTML::selectList($select, 'filter', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $filter);
    if ($filter == NULL) {
        $and = '';
    } else {
        if (!$filter) {
            $and = "\n AND client_id = '0'";
        } else {
            if ($filter) {
                $and = "\n AND client_id = '1'";
            }
        }
    }
    $database->setQuery("SELECT id, module, client_id" . "\n FROM #__modules" . "\n WHERE module LIKE 'mod_%' AND iscore='0'" . $and . "\n GROUP BY module, client_id" . "\n ORDER BY client_id, module");
    $rows = $database->loadObjectList();
    $id = 0;
    foreach ($rows as $row) {
        // path to module directory
        if ($row->client_id == "1") {
            $moduleBaseDir = mosPathName(mosPathName($mosConfig_absolute_path) . "administrator/modules");
        } else {
            $moduleBaseDir = mosPathName(mosPathName($mosConfig_absolute_path) . "modules");
        }
        // xml file for module
        $xmlfile = $moduleBaseDir . "/" . $row->module . ".xml";
        $xmlDoc =& new DOMIT_Lite_Document();
        $xmlDoc->resolveErrors(true);
        if (!$xmlDoc->loadXML($xmlfile, false, true)) {
            continue;
        }
        $element =& $xmlDoc->documentElement;
        if ($element->getTagName() != 'mosinstall') {
            continue;
        }
        if ($element->getAttribute("type") != "module") {
            continue;
        }
        $element =& $xmlDoc->getElementsByPath('creationDate', 1);
        $row->creationdate = $element ? $element->getText() : '';
        $element =& $xmlDoc->getElementsByPath('author', 1);
        $row->author = $element ? $element->getText() : '';
        $element =& $xmlDoc->getElementsByPath('copyright', 1);
        $row->copyright = $element ? $element->getText() : '';
        $element =& $xmlDoc->getElementsByPath('authorEmail', 1);
        $row->authorEmail = $element ? $element->getText() : '';
        $element =& $xmlDoc->getElementsByPath('authorUrl', 1);
        $row->authorUrl = $element ? $element->getText() : '';
        $element =& $xmlDoc->getElementsByPath('version', 1);
        $row->version = $element ? $element->getText() : '';
        $rows[$id] = $row;
        $id++;
    }
    HTML_module::showInstalledModules($rows, $_option, $id, $xmlfile, $lists);
}
开发者ID:cwcw,项目名称:cms,代码行数:63,代码来源:module.php


示例2: showInstalledComponents

/**
* @param string The URL option
*/
function showInstalledComponents($option)
{
    global $database, $mosConfig_absolute_path;
    $database->setQuery("SELECT *" . "\n FROM #__components" . "\n WHERE parent = 0 AND iscore = 0" . "\n ORDER BY name");
    $rows = $database->loadObjectList();
    // Read the component dir to find components
    $componentBaseDir = mosPathName($mosConfig_absolute_path . '/administrator/components');
    $componentDirs = mosReadDirectory($componentBaseDir);
    $n = count($rows);
    for ($i = 0; $i < $n; $i++) {
        $row =& $rows[$i];
        $dirName = mosPathName($componentBaseDir . $row->option);
        $xmlFilesInDir = mosReadDirectory($dirName, '.xml$');
        foreach ($xmlFilesInDir as $xmlfile) {
            // Read the file to see if it's a valid component XML file
            $parser =& new mosXMLDescription($dirName . $xmlfile);
            if ($parser->getType() != 'component') {
                continue;
            }
            $row->creationdate = $parser->getCreationDate('component');
            $row->author = $parser->getAuthor('component');
            $row->copyright = $parser->getCopyright('component');
            $row->authorEmail = $parser->getAuthorEmail('component');
            $row->authorUrl = $parser->getAuthorUrl('component');
            $row->version = $parser->getVersion('component');
            $row->mosname = strtolower(str_replace(" ", "_", $row->name));
        }
    }
    HTML_component::showInstalledComponents($rows, $option);
}
开发者ID:jwest00724,项目名称:mambo,代码行数:33,代码来源:component.php


示例3: mosReadDirectory

 function mosReadDirectory($path, $filter = '.', $recurse = false, $fullpath = false)
 {
     $arr = array();
     if (!@is_dir($path)) {
         return $arr;
     }
     $handle = opendir($path);
     while ($file = readdir($handle)) {
         $dir = mosPathName($path . '/' . $file, false);
         $isDir = is_dir($dir);
         if ($file != "." && $file != "..") {
             if (preg_match("/{$filter}/", $file)) {
                 if ($fullpath) {
                     $arr[] = trim(mosPathName($path . '/' . $file, false));
                 } else {
                     $arr[] = trim($file);
                 }
             }
             if ($recurse && $isDir) {
                 $arr2 = mosReadDirectory($dir, $filter, $recurse, $fullpath);
                 $arr = array_merge($arr, $arr2);
             }
         }
     }
     closedir($handle);
     asort($arr);
     return $arr;
 }
开发者ID:janssit,项目名称:www.ondernemenddiest.be,代码行数:28,代码来源:DOCMAN_compat15.class.php


示例4: extractBackupArchive

/**
* jlms_zip_operation.php
* (c) JoomaLMS eLearning Software http://www.joomlalms.com/
**/
function extractBackupArchive($archivename, $extractdir)
{
    $base_Dir = mosPathName(JPATH_SITE . '/media');
    $archivename = mosPathName($archivename, false);
    if (preg_match('/\\.zip$/i', $archivename)) {
        require_once _JOOMLMS_FRONT_HOME . "/includes/libraries/lms.lib.zip.php";
        $backupfile = new PclZip($archivename);
        $ret = $backupfile->extract(PCLZIP_OPT_PATH, $extractdir);
    }
    return true;
}
开发者ID:parkmi,项目名称:dolschool14,代码行数:15,代码来源:jlms_zip_operation.php


示例5: uninstall

 /**
  * Custom install method
  * @param int The id of the module
  * @param string The URL option
  * @param int The client id
  */
 function uninstall($id, $option, $client = 0)
 {
     global $database, $mosConfig_absolute_path;
     // Delete directories
     $path = $mosConfig_absolute_path . ($client == 'admin' ? '/administrator' : '') . '/templates/' . $id;
     $id = str_replace('..', '', $id);
     if (trim(id)) {
         if (is_dir($path)) {
             return deldir(mosPathName($path));
         } else {
             HTML_installer::showInstallMessage('Directory does not exist, cannot remove files', 'Uninstall -  error', $this->returnTo($option, 'template', $client));
         }
     } else {
         HTML_installer::showInstallMessage('Template id is empty, cannot remove files', 'Uninstall -  error', $this->returnTo($option, 'template', $client));
         exit;
     }
 }
开发者ID:cwcw,项目名称:cms,代码行数:23,代码来源:template.class.php


示例6: showInstalledComponents

/**
* @param string The URL option
*/
function showInstalledComponents($option)
{
    global $database, $mosConfig_absolute_path;
    $database->setQuery("SELECT *" . "\n FROM #__components" . "\n WHERE parent = 0 AND iscore = 0" . "\n ORDER BY name");
    $rows = $database->loadObjectList();
    // Read the component dir to find components
    $componentBaseDir = mosPathName($mosConfig_absolute_path . '/administrator/components');
    $componentDirs = mosReadDirectory($componentBaseDir);
    $id = 0;
    foreach ($rows as $row) {
        $dirName = $componentBaseDir . $row->option;
        $xmlFilesInDir = mosReadDirectory($dirName, '.xml');
        foreach ($xmlFilesInDir as $xmlfile) {
            // Read the file to see if it's a valid component XML file
            $xmlDoc =& new DOMIT_Lite_Document();
            $xmlDoc->resolveErrors(true);
            if (!$xmlDoc->loadXML($dirName . '/' . $xmlfile, false, true)) {
                continue;
            }
            $element =& $xmlDoc->documentElement;
            if ($element->getTagName() != 'mosinstall') {
                continue;
            }
            if ($element->getAttribute("type") != "component") {
                continue;
            }
            $element =& $xmlDoc->getElementsByPath('creationDate', 1);
            $row->creationdate = $element ? $element->getText() : 'Unknown';
            $element =& $xmlDoc->getElementsByPath('author', 1);
            $row->author = $element ? $element->getText() : 'Unknown';
            $element =& $xmlDoc->getElementsByPath('copyright', 1);
            $row->copyright = $element ? $element->getText() : '';
            $element =& $xmlDoc->getElementsByPath('authorEmail', 1);
            $row->authorEmail = $element ? $element->getText() : '';
            $element =& $xmlDoc->getElementsByPath('authorUrl', 1);
            $row->authorUrl = $element ? $element->getText() : '';
            $element =& $xmlDoc->getElementsByPath('version', 1);
            $row->version = $element ? $element->getText() : '';
            $row->mosname = strtolower(str_replace(" ", "_", $row->name));
            $rows[$id] = $row;
        }
        $id++;
    }
    HTML_component::showInstalledComponents($rows, $option);
}
开发者ID:cwcw,项目名称:cms,代码行数:48,代码来源:component.php


示例7: deldir

 function deldir($dir)
 {
     $current_dir = opendir($dir);
     $old_umask = umask(0);
     while ($entryname = readdir($current_dir)) {
         if ($entryname != '.' and $entryname != '..') {
             if (is_dir($dir . $entryname)) {
                 deldir(mosPathName($dir . $entryname));
             } else {
                 @chmod($dir . $entryname, 0777);
                 unlink($dir . $entryname);
             }
         }
     }
     umask($old_umask);
     closedir($current_dir);
     return rmdir($dir);
 }
开发者ID:parkmi,项目名称:dolschool14,代码行数:18,代码来源:jlms_dir_operation.php


示例8: showInstalledMambots

function showInstalledMambots($_option)
{
    global $database, $mosConfig_absolute_path;
    $query = "SELECT id, name, folder, element, client_id" . "\n FROM #__mambots" . "\n WHERE iscore = 0" . "\n ORDER BY folder, name";
    $database->setQuery($query);
    $rows = $database->loadObjectList();
    // path to mambot directory
    $mambotBaseDir = mosPathName(mosPathName($mosConfig_absolute_path) . "mambots");
    $id = 0;
    $n = count($rows);
    for ($i = 0; $i < $n; $i++) {
        $row =& $rows[$i];
        // xml file for module
        $xmlfile = $mambotBaseDir . "/" . $row->folder . '/' . $row->element . ".xml";
        if (file_exists($xmlfile)) {
            $xmlDoc = new DOMIT_Lite_Document();
            $xmlDoc->resolveErrors(true);
            if (!$xmlDoc->loadXML($xmlfile, false, true)) {
                continue;
            }
            $root =& $xmlDoc->documentElement;
            if ($root->getTagName() != 'mosinstall') {
                continue;
            }
            if ($root->getAttribute("type") != "mambot") {
                continue;
            }
            $element =& $root->getElementsByPath('creationDate', 1);
            $row->creationdate = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('author', 1);
            $row->author = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('copyright', 1);
            $row->copyright = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('authorEmail', 1);
            $row->authorEmail = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('authorUrl', 1);
            $row->authorUrl = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('version', 1);
            $row->version = $element ? $element->getText() : '';
        }
    }
    HTML_mambot::showInstalledMambots($rows, $_option, $id, $xmlfile);
}
开发者ID:jwest00724,项目名称:Joomla-1.0,代码行数:43,代码来源:mambot.php


示例9: install

 /**
  * Custom install method
  * @param boolean True if installing from directory
  */
 function install($p_fromdir = null)
 {
     global $mosConfig_absolute_path, $database;
     if (!$this->preInstallCheck($p_fromdir, 'language')) {
         return false;
     }
     $xml = $this->xmlDoc();
     // Set some vars
     $e =& $xml->getElementsByPath('name', 1);
     $this->elementName($e->getText());
     $this->elementDir(mosPathName($mosConfig_absolute_path . "/language/"));
     // Find files to copy
     if ($this->parseFiles('files', 'language') === false) {
         return false;
     }
     if ($e =& $xml->getElementsByPath('description', 1)) {
         $this->setError(0, $this->elementName() . '<p>' . $e->getText() . '</p>');
     }
     return $this->copySetupFile('front');
 }
开发者ID:cwcw,项目名称:cms,代码行数:24,代码来源:language.class.php


示例10: getBasePath

 /**
  * Gets the base path for the client
  * @param mixed A client identifier
  * @param boolean True (default) to add traling slash
  */
 function getBasePath($client = 0, $addTrailingSlash = true)
 {
     switch ($client) {
         case '0':
         case 'site':
         case 'front':
         default:
             return mosPathName(JPATH_SITE, $addTrailingSlash);
             break;
         case '2':
         case 'installation':
             return mosPathName(JPATH_INSTALLATION, $addTrailingSlash);
             break;
         case '1':
         case 'admin':
         case 'administrator':
             return mosPathName(JPATH_ADMINISTRATOR, $addTrailingSlash);
             break;
     }
 }
开发者ID:Fellah,项目名称:govnobaki,代码行数:25,代码来源:mainframe.php


示例11: uploadFile

function uploadFile($filename, $userfile_name, &$msg)
{
    global $mosConfig_absolute_path;
    $baseDir = mosPathName($mosConfig_absolute_path . '/media');
    if (file_exists($baseDir)) {
        if (is_writable($baseDir)) {
            if (move_uploaded_file($filename, $baseDir . $userfile_name)) {
                if (mosChmod($baseDir . $userfile_name)) {
                    return true;
                } else {
                    $msg = 'Failed to change the permissions of the uploaded file.';
                }
            } else {
                $msg = 'Failed to move uploaded file to <code>/media</code> directory.';
            }
        } else {
            $msg = 'Upload failed as <code>/media</code> directory is not writable.';
        }
    } else {
        $msg = 'Upload failed as <code>/media</code> directory does not exist.';
    }
    return false;
}
开发者ID:parkmi,项目名称:dolschool14,代码行数:23,代码来源:jlms_file_upload.php


示例12: extractArchive

 /**
  * Extracts the package archive file
  * @return boolean True on success, False on error
  */
 function extractArchive($filename)
 {
     $mosConfig_absolute_path = mamboCore::get('mosConfig_absolute_path');
     $base_Dir = mosPathName($mosConfig_absolute_path . '/media');
     $this->archiveName = $base_Dir . $filename;
     $tmpdir = uniqid('install_');
     $this->extractDir = $this->cleanDir = mosPathName($base_Dir . uniqid('install_'));
     if (eregi('.zip$', $filename)) {
         // Extract functions
         require_once $mosConfig_absolute_path . '/administrator/includes/pcl/pclzip.lib.php';
         require_once $mosConfig_absolute_path . '/administrator/includes/pcl/pclerror.lib.php';
         //require_once( $mosConfig_absolute_path . '/administrator/includes/pcl/pcltrace.lib.php' );
         //require_once( $mosConfig_absolute_path . '/administrator/includes/pcl/pcltar.lib.php' );
         $zipfile = new PclZip($this->archiveName);
         $ret = $zipfile->extract(PCLZIP_OPT_PATH, $this->extractDir);
         if ($ret == 0) {
             $this->errors->addErrorDetails(sprintf(T_('Installer unrecoverable ZIP error %s in %s'), $zipfile->errorName(true), $this->archiveName), _MOS_ERROR_FATAL);
             return false;
         }
     } else {
         require_once $mosConfig_absolute_path . '/includes/Archive/Tar.php';
         $archive =& new Archive_Tar($this->archiveName);
         $archive->setErrorHandling(PEAR_ERROR_PRINT);
         if (!$archive->extractModify($this->extractDir, '')) {
             $this->errors->addErrorDetails(sprintf(T_('Installer unrecoverable TAR error in %s'), $this->archiveName), _MOS_ERROR_FATAL);
             return false;
         }
     }
     // Try to find the correct install dir. in case that the package have subdirs
     // Save the install dir for later cleanup
     $dir =& new mosDirectory($this->extractDir);
     $singledir = $dir->soleDir();
     if ($singledir) {
         $this->extractDir = mosPathName($this->extractDir . $singledir);
     }
     return true;
 }
开发者ID:jwest00724,项目名称:mambo,代码行数:41,代码来源:installer.class.php


示例13: viewTemplates

/**
* Compiles a list of installed, version 4.5+ templates
*
* Based on xml files found.  If no xml file found the template
* is ignored
*/
function viewTemplates($option, $client)
{
    global $database, $mainframe;
    global $mosConfig_absolute_path, $mosConfig_list_limit;
    $limit = $mainframe->getUserStateFromRequest('viewlistlimit', 'limit', $mosConfig_list_limit);
    $limitstart = $mainframe->getUserStateFromRequest("view{$option}limitstart", 'limitstart', 0);
    if ($client == 'admin') {
        $templateBaseDir = mosPathName($mosConfig_absolute_path . '/administrator/templates');
    } else {
        $templateBaseDir = mosPathName($mosConfig_absolute_path . '/templates');
    }
    $rows = array();
    // Read the template dir to find templates
    $templateDirs = mosReadDirectory($templateBaseDir);
    $id = intval($client == 'admin');
    if ($client == 'admin') {
        $database->setQuery("SELECT template FROM #__templates_menu WHERE client_id='1' AND menuid='0'");
    } else {
        $database->setQuery("SELECT template FROM #__templates_menu WHERE client_id='0' AND menuid='0'");
    }
    $cur_template = $database->loadResult();
    $rowid = 0;
    // Check that the directory contains an xml file
    foreach ($templateDirs as $templateDir) {
        $dirName = mosPathName($templateBaseDir . $templateDir);
        $xmlFilesInDir = mosReadDirectory($dirName, '.xml$');
        foreach ($xmlFilesInDir as $xmlfile) {
            // Read the file to see if it's a valid template XML file
            $parser =& new mosXMLDescription($dirName . $xmlfile);
            if ($parser->getType() != 'template') {
                continue;
            }
            $row = new StdClass();
            $row->id = $rowid;
            $row->directory = $templateDir;
            $row->creationdate = $parser->getCreationDate('template');
            $row->name = $parser->getName('template');
            $row->author = $parser->getAuthor('template');
            $row->copyright = $parser->getCopyright('template');
            $row->authorEmail = $parser->getAuthorEmail('template');
            $row->authorUrl = $parser->getAuthorUrl('template');
            $row->version = $parser->getVersion('template');
            /*
            			$element = &$xmlDoc->getElementsByPath('name', 1 );
            			$row->name = $element->getText();
            
            			$element = &$xmlDoc->getElementsByPath('creationDate', 1);
            			$row->creationdate = $element ? $element->getText() : 'Unknown';
            
            			$element = &$xmlDoc->getElementsByPath('author', 1);
            			$row->author = $element ? $element->getText() : 'Unknown';
            
            			$element = &$xmlDoc->getElementsByPath('copyright', 1);
            			$row->copyright = $element ? $element->getText() : '';
            
            			$element = &$xmlDoc->getElementsByPath('authorEmail', 1);
            			$row->authorEmail = $element ? $element->getText() : '';
            
            			$element = &$xmlDoc->getElementsByPath('authorUrl', 1);
            			$row->authorUrl = $element ? $element->getText() : '';
            
            			$element = &$xmlDoc->getElementsByPath('version', 1);
            			$row->version = $element ? $element->getText() : '';
            */
            // Get info from db
            if ($cur_template == $templateDir) {
                $row->published = 1;
            } else {
                $row->published = 0;
            }
            $row->checked_out = 0;
            $row->mosname = strtolower(str_replace(' ', '_', $row->name));
            // check if template is assigned
            $database->setQuery("SELECT count(*) FROM #__templates_menu WHERE client_id='0' AND template='{$row->directory}' AND menuid<>'0'");
            $row->assigned = $database->loadResult() ? 1 : 0;
            $rows[] = $row;
            $rowid++;
        }
    }
    require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php';
    $pageNav = new mosPageNav(count($rows), $limitstart, $limit);
    $rows = array_slice($rows, $pageNav->limitstart, $pageNav->limit);
    HTML_templates::showTemplates($rows, $pageNav, $option, $client);
}
开发者ID:jwest00724,项目名称:mambo,代码行数:90,代码来源:admin.templates.php


示例14: uninstall

 /**
  * Custom install method
  * @param int The id of the module
  * @param string The URL option
  * @param int The client id
  */
 function uninstall($id, $option, $client = 0)
 {
     global $database, $mosConfig_absolute_path;
     $id = intval($id);
     $database->setQuery("SELECT name, folder, element, iscore FROM #__mambots WHERE id = '{$id}'");
     $row = null;
     $database->loadObject($row);
     if ($database->getErrorNum()) {
         HTML_installer::showInstallMessage($database->stderr(), 'Uninstall -  error', $installer->returnTo($option, 'mambot', $client));
         exit;
     }
     if (trim($row->folder) == '') {
         HTML_installer::showInstallMessage('Folder field empty, cannot remove files', 'Uninstall -  error', $installer->returnTo($option, 'mambot', $client));
         exit;
     }
     $basepath = $mosConfig_absolute_path . '/mambots/' . $row->folder . '/';
     $xmlfile = $basepath . $row->element . '.xml';
     // see if there is an xml install file, must be same name as element
     if (file_exists($xmlfile)) {
         $this->i_xmldoc =& new DOMIT_Lite_Document();
         $this->i_xmldoc->resolveErrors(true);
         if ($this->i_xmldoc->loadXML($xmlfile, false, true)) {
             $mosinstall =& $this->i_xmldoc->documentElement;
             // get the files element
             $files_element =& $mosinstall->getElementsByPath('files', 1);
             if (!is_null($files_element)) {
                 $files = $files_element->childNodes;
                 foreach ($files as $file) {
                     // delete the files
                     $filename = $file->getText();
                     if (file_exists($basepath . $filename)) {
                         $parts = pathinfo($filename);
                         $subpath = $parts['dirname'];
                         if ($subpath != '' && $subpath != '.' && $subpath != '..') {
                             echo '<br />Deleting: ' . $basepath . $subpath;
                             $result = deldir(mosPathName($basepath . $subpath . '/'));
                         } else {
                             echo '<br />Deleting: ' . $basepath . $filename;
                             $result = unlink(mosPathName($basepath . $filename, false));
                         }
                         echo intval($result);
                     }
                 }
                 // remove XML file from front
                 echo "Deleting XML File: {$xmlfile}";
                 @unlink(mosPathName($xmlfile, false));
                 // define folders that should not be removed
                 $sysFolders = array('content', 'search');
                 if (!in_array($row->folder, $sysFolders)) {
                     // delete the non-system folders if empty
                     if (count(mosReadDirectory($basepath)) < 1) {
                         deldir($basepath);
                     }
                 }
             }
         }
     }
     if ($row->iscore) {
         HTML_installer::showInstallMessage($row->name . ' is a core element, and cannot be uninstalled.<br />You need to unpublish it if you don\'t want to use it', 'Uninstall -  error', $this->returnTo($option, 'mambot', $client));
         exit;
     }
     $database->setQuery("DELETE FROM #__mambots WHERE id = '{$id}'");
     if (!$database->query()) {
         $msg = $database->stderr;
         die($msg);
     }
     return true;
 }
开发者ID:cwcw,项目名称:cms,代码行数:74,代码来源:mambot.class.php


示例15: validatePath

 function validatePath($path)
 {
     if ($path) {
         $path = mosPathName($path);
         if (!is_dir($path)) {
             $path = dirname($path);
         }
         if (@substr($path, -1) != "/") {
             $path = $path . "/";
         }
         $handle = @opendir($path);
         if ($handle) {
             closedir($handle);
         } else {
             $path = false;
         }
     } else {
         $path = false;
     }
     if (!$path) {
         $this->_err = _DML_DIRPROBLEM2 . ": {$path}";
     }
     return $path;
 }
开发者ID:RangerWalt,项目名称:ecci,代码行数:24,代码来源:DOCMAN_file.class.php


示例16: component_uninstall

/**
 * Component uninstall method
 * @param int The id of the module
 * @param string The URL option
 * @param int The client id
 */
function component_uninstall($cid, $option, $client = 0)
{
    $database =& mamboDatabase::getInstance();
    $sql = "SELECT * FROM #__components WHERE id={$cid}";
    $database->setQuery($sql);
    if (!$database->loadObject($row)) {
        $message = new mosError($database->stderr(true), _MOS_ERROR_FATAL);
        HTML_installer::showInstallMessage($message, T_('Uninstall -  error'), "index2.php?option={$option}&element=component");
        exit;
    }
    if ($row->iscore) {
        $message = new mosError(sprintf(T_('Component %s is a core component, and can not be uninstalled.<br />You need to unpublish it if you don\'t want to use it'), $row->name), _MOS_ERROR_FATAL);
        HTML_installer::showInstallMessage($message, 'Uninstall -  error', "index2.php?option={$option}&element=component");
        exit;
    }
    // Try to find the XML file
    $here = mosPathName(mamboCore::get('mosConfig_absolute_path') . '/administrator/components/' . $row->option);
    $filesindir = mosReadDirectory($here, '.xml$');
    if (count($filesindir) > 0) {
        $allerrors = new mosErrorSet();
        foreach ($filesindir as $file) {
            $parser =& new mosUninstallXML($here . $file);
            $parser->uninstall();
            $allerrors->mergeAnother($parser->errors);
        }
        $ret = $allerrors->getMaxLevel() < _MOS_ERROR_FATAL;
        HTML_installer::showInstallMessage($allerrors->getErrors(), T_('Uninstall component - ') . ($ret ? T_('Success') : T_('Error')), returnTo($option, 'component', $client));
    } else {
        $com_name = $row->option;
        $dir = new mosDirectory(mosPathName(mamboCore::get('mosConfig_absolute_path') . '/components/' . $com_name));
        $dir->deleteAll();
        $dir = new mosDirectory(mosPathName(mamboCore::get('mosConfig_absolute_path') . '/administrator/components/' . $com_name));
        $dir->deleteAll();
        $sql = "DELETE FROM #__components WHERE `option`='{$com_name}'";
        $database->setQuery($sql);
        $database->query();
        $message = new mosError(T_('Uninstaller could not find XML file, but cleaned database'), _MOS_ERROR_WARN);
        HTML_installer::showInstallMessage($message, T_('Uninstall ') . T_('component - ') . T_('Success'), returnTo($option, 'component', $client));
    }
    exit;
}
开发者ID:jwest00724,项目名称:mambo,代码行数:47,代码来源:admin.installer.php


示例17: copyFiles

 /**
  * @param string Source directory
  * @param string Destination directory
  * @param array array with filenames
  * @return boolean True on success, False on error
  */
 function copyFiles($p_sourcedir, $p_destdir, $p_files)
 {
     if (is_array($p_files) && count($p_files) > 0) {
         foreach ($p_files as $_file) {
             $filesource = mosPathName($p_sourcedir) . $_file;
             $filedest = mosPathName($p_destdir) . $_file;
             if ($this->isWindows()) {
                 $filesource = str_replace('/', '\\', $filesource);
                 $filedest = str_replace('/', '\\', $filedest);
             } else {
                 $filesource = str_replace('\\', '/', $filesource);
                 $filedest = str_replace('\\', '/', $filedest);
             }
             if (!file_exists($filesource)) {
                 $this->setError(1, "File {$filesource} does not exist!");
                 return false;
             } else {
                 if (file_exists($filedest)) {
                     $this->setError(1, "There is already a file called {$filedest} - Are you trying to install the same CMT twice?");
                     return false;
                 } else {
                     if (!(copy($filesource, $filedest) && chmod($filedest, 0777))) {
                         $this->setError(1, "Failed to copy file: {$filesource} to {$filedest}");
                         return false;
                     }
                 }
             }
         }
     } else {
         return false;
     }
     return count($p_files);
 }
开发者ID:cwcw,项目名称:cms,代码行数:39,代码来源:installer.class.php


示例18: uninstall

 /**
  * Custom install method
  * @param int The id of the module
  * @param string The URL option
  * @param int The client id
  */
 function uninstall($id, $option, $client = 0)
 {
     global $database, $mosConfig_absolute_path;
     josSpoofCheck(null, null, 'request');
     // Delete directories
     $path = $mosConfig_absolute_path . ($client == 'admin' ? '/administrator' : '') . '/templates/' . $id;
     $id = str_replace('..', '', $id);
     if (trim($id)) {
         if (is_dir($path)) {
             return deldir(mosPathName($path));
         } else {
             HTML_installer::showInstallMessage('O diretório não existe, não é possível remover arquivos', 'Desinstalar -  erro', $this->returnTo($option, 'template', $client));
         }
     } else {
         HTML_installer::showInstallMessage('ID de Tema está vazio, não é possível remover arquivos', 'Desinstalar -  erro', $this->returnTo($option, 'template', $client));
         exit;
     }
 }
开发者ID:patricmutwiri,项目名称:joomlaclube,代码行数:24,代码来源:template.class.php


示例19: uploadFile

/**
* @param string The name of the php (temporary) uploaded file
* @param string The name of the file to put in the temp directory
* @param string The message to return
*/
function uploadFile($filename, $userfile_name, &$msg)
{
    josSpoofCheck();
    global $mosConfig_absolute_path;
    $baseDir = mosPathName($mosConfig_absolute_path . '/media');
    if (file_exists($baseDir)) {
        if (is_writable($baseDir)) {
            if (move_uploaded_file($filename, $baseDir . $userfile_name)) {
                if (mosChmod($baseDir . $userfile_name)) {
                    return true;
                } else {
                    $msg = 'Falha ao alterar as permissões do arquivo enviado.';
                }
            } else {
                $msg = 'Falha ao mover o arquivo enviado para o diretório <code>/media</code>.';
            }
        } else {
            $msg = 'Falha no envio pois o diretório <code>/media</code> não tem permissão. É necessário atribuir permissões de escrita.';
        }
    } else {
        $msg = 'Falha no envio pois o diretório <code>/media</code> não existe.';
    }
    return false;
}
开发者ID:patricmutwiri,项目名称:joomlaclube,代码行数:29,代码来源:admin.installer.php


示例20: uninstall

 /**
  * Custom install method
  * @param int The id of the module
  * @param string The URL option
  * @param int The client id
  */
 function uninstall($id, $option, $client = 0)
 {
     global $database, $mosConfig_absolute_path;
     josSpoofCheck();
     $id = intval($id);
     $query = "SELECT module, iscore, client_id" . "\n FROM #__modules WHERE id = " . (int) $id;
     $database->setQuery($query);
     $row = null;
     $database->loadObject($row);
     if ($row->iscore) {
         HTML_installer::showInstallMessage($row->title . 'é um elemento do sistema e não pode ser desinstalado.<br />Caso não o pretenda continuar a utilizar será necessário retirar de publicação', 'Desinstalar -  erro', $this->returnTo($option, 'module', $row->client_id ? '' : 'admin'));
         exit;
     }
     $query = "SELECT id" . "\n FROM #__modules" . "\n WHERE module = " . $database->Quote($row->module) . " AND client_id = " . (int) $row->client_id;
     $database->setQuery($query);
     $modules = $database->loadResultArray();
     if (count($modules)) {
         mosArrayToInts($modules);
         $modID = 'moduleid=' . implode(' OR moduleid=', $modules);
         $query = "DELETE FROM #__modules_menu" . "\n WHERE ( {$modID} )";
         $database->setQuery($query);
         if (!$database->query()) {
             $msg = $database->stderr;
             die($msg);
         }
         $query = "DELETE FROM #__modules" . "\n WHERE module = " . $database->Quote($row->module) . " AND client_id = " . (int) $row->client_id;
         $database->setQuery($query);
         if (!$database->query()) {
             $msg = $database->stderr;
             die($msg);
         }
         if (!$row->client_id) {
             $basepath = $mosConfig_absolute_path . '/modules/';
         } else {
             $basepath = $mosConfig_absolute_path . '/administrator/modules/';
         }
         $xmlfile = $basepath . $row->module . '.xml';
         // see if there is an xml install file, must be same name as element
         if (file_exists($xmlfile)) {
             $this->i_xmldoc = new DOMIT_Lite_Document();
             $this->i_xmldoc->resolveErrors(true);
             if ($this->i_xmldoc->loadXML($xmlfile, false, true)) {
                 $mosinstall =& $this->i_xmldoc->documentElement;
                 // get the files element
                 $files_element =& $mosinstall->getElementsByPath('files', 1);
                 if (!is_null($files_element)) {
                     $files = $files_element->childNodes;
                     foreach ($files as $file) {
                         // delete the files
                         $filename = $file->getText();
                         if (file_exists($basepath . $filename)) {
                             $parts = pathinfo($filename);
                             $subpath = $parts['dirname'];
                             if ($subpath != '' && $subpath != '.' && $subpath != '..') {
                                 echo '<br />Deletado: ' . $basepath . $subpath;
                                 $result = deldir(mosPathName($basepath . $subpath . '/'));
                             } else {
                                 echo '<br />Deletado: ' . $basepath . $filename;
                                 $result = unlink(mosPathName($basepath . $filename, false));
                             }
                             echo intval($result);
                         }
                     }
                     // remove XML file from front
                     echo "Deletando arquivo XML: {$xmlfile}";
                     @unlink(mosPathName($xmlfile, false));
                     return true;
                 }
             }
         }
     }
 }
开发者ID:patricmutwiri,项目名称:joomlaclube,代码行数:78,代码来源:module.class.php



注:本文中的mosPathName函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP mosReadDirectory函数代码示例发布时间:2022-05-15
下一篇:
PHP mosNotAuth函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap