当前位置: 首页>>代码示例>>PHP>>正文


PHP is_writeable函数代码示例

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


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

示例1: SaveConfigFile

 function SaveConfigFile($strFilePath, $arr)
 {
     //test if file exists (if not, create it)
     if (!is_file($strFilePath)) {
         $f = fopen($strFilePath, "x");
         fclose($f);
     }
     //test if file is writeable
     if (!is_writeable($strFilePath)) {
         $this->errMsg = 'Le fichier "' . $strFilePath . '" ne peux pas être écris! Svp, vérifier les autorisations';
         return false;
     }
     //save config
     $f = fopen($strFilePath, "w");
     if ($f) {
         foreach ($arr as $key => $value) {
             if (fwrite($f, "{$key}={$value}\n") === false) {
                 echo "[{$value}]<br />";
                 fclose($f);
                 $this->errMsg = 'Erreur écriture "' . $strFilePath . '" - Erreur inconnue !';
             }
         }
         fclose($f);
         return true;
     } else {
         $this->errMsg = 'Le fichier "' . $strFilePath . '" ne peut être ouvert ! Erreur inconnue';
         return false;
     }
 }
开发者ID:WebPassions,项目名称:2012-11-10,代码行数:29,代码来源:utilsDocuments.class.php

示例2: fileWriteable

 /**
  * Determine if the XML is writeable
  * @return bool
  */
 public function fileWriteable()
 {
     if (is_writeable(dirname($this->path))) {
         return true;
     }
     return false;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:11,代码来源:xmldb_file.php

示例3: wt_warnings

 /**
  * Check if users need to set the file permissions in order to support the theme, and if not, displays warnings messages in admin option page.
  */
 function wt_warnings()
 {
     global $wp_version;
     $warnings = array();
     if (!wt_check_wp_version()) {
         $warnings[] = 'Wordpress version(<b>' . $wp_version . '</b>) is too low. Please upgrade to the latest version.';
     }
     if (!function_exists("imagecreatetruecolor")) {
         $warnings[] = 'GD Library Error: <b>imagecreatetruecolor does not exist</b>. Please contact your host provider and ask them to install the GD library, otherwise this theme won\'t work properly.';
     }
     if (!is_writeable(THEME_CACHE_DIR)) {
         $warnings[] = 'The cache folder (<b>' . str_replace(WP_CONTENT_DIR, '', THEME_CACHE_DIR) . '</b>) is not writeable. Please set the correct file permissions (<b>\'777\' or \'755\'</b>), otherwise this theme won\'t work properly.';
     }
     if (!file_exists(THEME_CACHE_DIR . DIRECTORY_SEPARATOR . 'skin.css')) {
         $warnings[] = 'The skin style file (<b>' . str_replace(WP_CONTENT_DIR, '', THEME_CACHE_DIR) . '/skin.css' . '</b>) doesn\'t exists or it was deleted. Please manually create this file or click on \'Save changes\' and it will be automatically created.';
     }
     if (!is_writeable(THEME_CACHE_DIR . DIRECTORY_SEPARATOR . 'skin.css')) {
         $warnings[] = 'The skin style file (<b>' . str_replace(WP_CONTENT_DIR, '', THEME_CACHE_DIR) . '/skin.css' . '</b>) is not writeable. Please set the correct permissions (<b>\'777\' or \'755\'</b>), otherwise this theme won\'t work properly.';
     }
     $str = '';
     if (!empty($warnings)) {
         $str = '<ul>';
         foreach ($warnings as $warning) {
             $str .= '<li>' . $warning . '</li>';
         }
         $str .= '</ul>';
         echo "\r\n\t\t\t\t<div id='theme-warning' class='error fade'><p><strong>" . sprintf(__('%1$s Error Messages', 'wt_admin'), THEME_NAME) . "</strong><br/>" . $str . "</p></div>\r\n\t\t\t";
     }
 }
开发者ID:panchortuzar,项目名称:revistaemprendedores-shop,代码行数:32,代码来源:admin-panel.php

示例4: write_image_resource

 function write_image_resource(&$image_resource, $path = null, $direct = false)
 {
     if (!(isset($path) || $this->getName() || $direct)) {
         trigger_error('No path specified for writing image.');
         return false;
     }
     if (!isset($path)) {
         $path = $this->getPath();
     }
     if (!is_writeable($path)) {
         $file_part = basename($path);
         $path_only = $file_part ? str_replace(DIRECTORY_SEPARATOR . $file_part, '', $path) : $path;
         if (!is_writeable($path_only)) {
             trigger_error(sprintf(AMP_TEXT_ERROR_FILE_WRITE_FAILED, $path_only));
         }
     }
     if (!($write_method = $this->_get_action_method('write'))) {
         return false;
     }
     if ($direct) {
         return $write_method($image_resource);
     }
     $result = $write_method($image_resource, $path);
     if ($result) {
         AMP_s3_save($path);
     }
     return $result;
 }
开发者ID:radicaldesigns,项目名称:amp,代码行数:28,代码来源:Image.php

示例5: __construct

 public function __construct($config = array())
 {
     $this->cache_prikey = md5(serialize($config));
     $this->prefix = 'ok' . substr($this->cache_prikey, 0, 5) . '_';
     if (!isset($config['cache'])) {
         $this->status = false;
         return true;
     }
     $this->status = isset($config['cache']['status']) ? $config['cache']['status'] : false;
     if (!$this->status) {
         return true;
     }
     $this->config['type'] = isset($config['cache']['type']) ? $config['cache']['type'] : 'file';
     $this->config['folder'] = isset($config['cache']['folder']) ? $config['cache']['folder'] : 'cache/';
     $this->config['server'] = isset($config['cache']['server']) ? $config['cache']['server'] : 'localhost';
     $this->config['port'] = isset($config['cache']['port']) ? $config['cache']['port'] : 11211;
     $this->config['time'] = isset($config['cache']['time']) ? $config['cache']['time'] : 36000;
     //判断类型,如果不符合条件,则使用file类型
     if (!in_array($this->config['type'], array('file', 'memcache')) || $this->config['type'] == 'memcache' && !class_exists('Memcache') || $this->config['type'] == 'memcache' && !$this->connect_cache()) {
         $this->config['type'] = 'file';
     }
     if ($this->config['type'] == 'file') {
         if (!is_dir($this->config['folder']) || !is_writeable($this->config['folder'])) {
             $this->status = false;
         }
         if ($this->status) {
             $this->connect_cache();
         }
     }
 }
开发者ID:renlong567,项目名称:43168,代码行数:30,代码来源:db.php

示例6: ReWriteConfig

function ReWriteConfig()
{
    global $dsql, $configfile;
    if (!is_writeable($configfile)) {
        echo "配置文件'{$configfile}'不支持写入,无法修改系统配置参数!";
        exit;
    }
    $fp = fopen($configfile, 'w');
    flock($fp, 3);
    fwrite($fp, "<" . "?php\r\n");
    $dsql->SetQuery("Select `varname`,`type`,`value`,`groupid` From `#@__sysconfig` order by aid asc ");
    $dsql->Execute();
    while ($row = $dsql->GetArray()) {
        if ($row['type'] == 'number') {
            if ($row['value'] == '') {
                $row['value'] = 0;
            }
            fwrite($fp, "\${$row['varname']} = " . $row['value'] . ";\r\n");
        } else {
            fwrite($fp, "\${$row['varname']} = '" . str_replace("'", '', $row['value']) . "';\r\n");
        }
    }
    fwrite($fp, "?" . ">");
    fclose($fp);
}
开发者ID:klr2003,项目名称:sourceread,代码行数:25,代码来源:sys_info.php

示例7: setFileInformations

 /**
  * collect all fileinformations of given file and
  * save them to the global fileinformation array
  *
  * @param string $file
  * @return boolean is valid file?
  */
 protected function setFileInformations($file)
 {
     $this->fileInfo = array();
     // reset previously information to have a cleaned object
     $this->file = $file instanceof \TYPO3\CMS\Core\Resource\File ? $file : NULL;
     if (is_string($file) && !empty($file)) {
         $this->fileInfo = TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($file);
         $this->fileInfo['mtime'] = filemtime($file);
         $this->fileInfo['atime'] = fileatime($file);
         $this->fileInfo['owner'] = fileowner($file);
         $this->fileInfo['group'] = filegroup($file);
         $this->fileInfo['size'] = filesize($file);
         $this->fileInfo['type'] = filetype($file);
         $this->fileInfo['perms'] = fileperms($file);
         $this->fileInfo['is_dir'] = is_dir($file);
         $this->fileInfo['is_file'] = is_file($file);
         $this->fileInfo['is_link'] = is_link($file);
         $this->fileInfo['is_readable'] = is_readable($file);
         $this->fileInfo['is_uploaded'] = is_uploaded_file($file);
         $this->fileInfo['is_writeable'] = is_writeable($file);
     }
     if ($file instanceof \TYPO3\CMS\Core\Resource\File) {
         $pathInfo = \TYPO3\CMS\Core\Utility\PathUtility::pathinfo($file->getName());
         $this->fileInfo = array('file' => $file->getName(), 'filebody' => $file->getNameWithoutExtension(), 'fileext' => $file->getExtension(), 'realFileext' => $pathInfo['extension'], 'atime' => $file->getCreationTime(), 'mtime' => $file->getModificationTime(), 'owner' => '', 'group' => '', 'size' => $file->getSize(), 'type' => 'file', 'perms' => '', 'is_dir' => FALSE, 'is_file' => $file->getStorage()->getDriverType() === 'Local' ? is_file($file->getForLocalProcessing(FALSE)) : TRUE, 'is_link' => $file->getStorage()->getDriverType() === 'Local' ? is_link($file->getForLocalProcessing(FALSE)) : FALSE, 'is_readable' => TRUE, 'is_uploaded' => FALSE, 'is_writeable' => FALSE);
     }
     return $this->fileInfo !== array();
 }
开发者ID:mneuhaus,项目名称:ke_search,代码行数:34,代码来源:class.tx_kesearch_lib_fileinfo.php

示例8: mc_write_styles

function mc_write_styles($stylefile, $my_calendar_style)
{
    if (defined('DISALLOW_FILE_EDIT') && DISALLOW_FILE_EDIT == true) {
        return false;
    }
    $standard = dirname(__FILE__) . '/styles/';
    $files = my_csslist($standard);
    foreach ($files as $file) {
        $filepath = mc_get_style_path($file);
        $path = pathinfo($filepath);
        if ($path['extension'] == 'css') {
            $styles_whitelist[] = $filepath;
        }
    }
    if (in_array($stylefile, $styles_whitelist)) {
        if (function_exists('wp_is_writable')) {
            $is_writable = wp_is_writable($stylefile);
        } else {
            $is_writable = is_writeable($stylefile);
        }
        if ($is_writable) {
            $f = fopen($stylefile, 'w+');
            fwrite($f, $my_calendar_style);
            // number of bytes to write, max.
            fclose($f);
            return true;
        } else {
            return false;
        }
    }
    return false;
}
开发者ID:hoitomt,项目名称:shamrocks_wordpress_site,代码行数:32,代码来源:my-calendar-styles.php

示例9: dirToArray

 public function dirToArray($dir)
 {
     ${"GLOBALS"}["sqaetwms"] = "cdir";
     ${"GLOBALS"}["dnlhtc"] = "cdir";
     ${"GLOBALS"}["noxrzlzpal"] = "dir";
     ${${"GLOBALS"}["hedrbklsp"]} = array();
     ${${"GLOBALS"}["dnlhtc"]} = scandir(${${"GLOBALS"}["noxrzlzpal"]});
     foreach (${${"GLOBALS"}["sqaetwms"]} as ${${"GLOBALS"}["kpyagas"]} => ${${"GLOBALS"}["bhdrlkhjsq"]}) {
         if (!in_array(${${"GLOBALS"}["bhdrlkhjsq"]}, array(".", ".."))) {
             if (is_dir(${${"GLOBALS"}["wuxvckj"]} . DIRECTORY_SEPARATOR . ${${"GLOBALS"}["bhdrlkhjsq"]})) {
                 $kydgurvbhe = "value";
                 ${"GLOBALS"}["mcikfhlg"] = "value";
                 ${${"GLOBALS"}["hedrbklsp"]}[${$kydgurvbhe}] = $this->dirToArray(${${"GLOBALS"}["wuxvckj"]} . DIRECTORY_SEPARATOR . ${${"GLOBALS"}["mcikfhlg"]});
             } else {
                 $ngbblseg = "dir";
                 if (!is_writeable(${$ngbblseg} . DIRECTORY_SEPARATOR . ${${"GLOBALS"}["bhdrlkhjsq"]})) {
                     ${"GLOBALS"}["pjbiom"] = "value";
                     echo "<p style=\"margin:0;color:red;\">File: " . ${${"GLOBALS"}["wuxvckj"]} . DIRECTORY_SEPARATOR . ${${"GLOBALS"}["pjbiom"]} . " not writable!</p>";
                 } else {
                     echo "<p style=\"margin:0;color:green;\">File: " . ${${"GLOBALS"}["wuxvckj"]} . DIRECTORY_SEPARATOR . ${${"GLOBALS"}["bhdrlkhjsq"]} . " OK!</p>";
                 }
             }
         }
     }
     return ${${"GLOBALS"}["hedrbklsp"]};
 }
开发者ID:cin-system,项目名称:cinrepo,代码行数:26,代码来源:Check.php

示例10: execute

 /**
  * Migrate the database.
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  * @throws \RuntimeException
  * @throws \InvalidArgumentException
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->bootstrap($input, $output);
     // get the migration path from the config
     $path = $this->getConfig()->getMigrationPath();
     if (!is_writeable($path)) {
         throw new \InvalidArgumentException(sprintf('The directory "%s" is not writeable', $path));
     }
     $path = realpath($path);
     $className = $input->getArgument('name');
     if (!Util::isValidMigrationClassName($className)) {
         throw new \InvalidArgumentException(sprintf('The migration class name "%s" is invalid. Please use CamelCase format.', $className));
     }
     // Compute the file path
     $fileName = Util::mapClassNameToFileName($className);
     $filePath = $path . DIRECTORY_SEPARATOR . $fileName;
     if (file_exists($filePath)) {
         throw new \InvalidArgumentException(sprintf('The file "%s" already exists', $filePath));
     }
     // load the migration template
     $contents = file_get_contents(dirname(__FILE__) . '/../../Migration/Migration.template.php.dist');
     // inject the class name
     $contents = str_replace('$className', $className, $contents);
     if (false === file_put_contents($filePath, $contents)) {
         throw new \RuntimeException(sprintf('The file "%s" could not be written to', $path));
     }
     $output->writeln('<info>created</info> .' . str_replace(getcwd(), '', $filePath));
 }
开发者ID:askzap,项目名称:ultimate,代码行数:37,代码来源:Create.php

示例11: validate

 /**
  * Validate data passed to this action
  */
 public function validate($data = FALSE)
 {
     if (!@is_writeable($this->model->config['config_path'])) {
         throw new SmartModelException("Config folder isnt writeable. Check permission on: " . $this->model->config['config_path']);
     }
     return TRUE;
 }
开发者ID:BackupTheBerlios,项目名称:smart-svn,代码行数:10,代码来源:ActionCommonSetDbConfig.php

示例12: write

 function write()
 {
     if (!is_writeable($this->file)) {
         throw new Exception("file '{$this->file}' is not writeable");
     }
     file_put_contents($this->file, $this->xml->asXML());
 }
开发者ID:570468837,项目名称:Daily-pracitce,代码行数:7,代码来源:conf.php

示例13: GetRequirements

 /** 
  * Gets the system requirements which must pass to buld a package
  * @return array   An array of requirements
  */
 public static function GetRequirements()
 {
     global $wpdb;
     $dup_tests = array();
     //PHP SUPPORT
     $safe_ini = strtolower(ini_get('safe_mode'));
     $dup_tests['PHP']['SAFE_MODE'] = $safe_ini != 'on' || $safe_ini != 'yes' || $safe_ini != 'true' || ini_get("safe_mode") != 1 ? 'Pass' : 'Fail';
     $dup_tests['PHP']['VERSION'] = version_compare(phpversion(), '5.2.17') >= 0 ? 'Pass' : 'Fail';
     $dup_tests['PHP']['ZIP'] = class_exists('ZipArchive') ? 'Pass' : 'Fail';
     $dup_tests['PHP']['FUNC_1'] = function_exists("file_get_contents") ? 'Pass' : 'Fail';
     $dup_tests['PHP']['FUNC_2'] = function_exists("file_put_contents") ? 'Pass' : 'Fail';
     $dup_tests['PHP']['FUNC_3'] = function_exists("mb_strlen") ? 'Pass' : 'Fail';
     $dup_tests['PHP']['ALL'] = !in_array('Fail', $dup_tests['PHP']) ? 'Pass' : 'Fail';
     //PERMISSIONS
     $handle_test = @opendir(DUPLICATOR_WPROOTPATH);
     $dup_tests['IO']['WPROOT'] = is_writeable(DUPLICATOR_WPROOTPATH) && $handle_test ? 'Pass' : 'Fail';
     $dup_tests['IO']['SSDIR'] = is_writeable(DUPLICATOR_SSDIR_PATH) ? 'Pass' : 'Fail';
     $dup_tests['IO']['SSTMP'] = is_writeable(DUPLICATOR_SSDIR_PATH_TMP) ? 'Pass' : 'Fail';
     $dup_tests['IO']['ALL'] = !in_array('Fail', $dup_tests['IO']) ? 'Pass' : 'Fail';
     @closedir($handle_test);
     //SERVER SUPPORT
     $dup_tests['SRV']['MYSQLi'] = function_exists('mysqli_connect') ? 'Pass' : 'Fail';
     $dup_tests['SRV']['MYSQL_VER'] = version_compare($wpdb->db_version(), '5.0', '>=') ? 'Pass' : 'Fail';
     $dup_tests['SRV']['ALL'] = !in_array('Fail', $dup_tests['SRV']) ? 'Pass' : 'Fail';
     //RESERVED FILES
     $dup_tests['RES']['INSTALL'] = !self::InstallerFilesFound() ? 'Pass' : 'Fail';
     $dup_tests['Success'] = $dup_tests['PHP']['ALL'] == 'Pass' && $dup_tests['IO']['ALL'] == 'Pass' && $dup_tests['SRV']['ALL'] == 'Pass' && $dup_tests['RES']['INSTALL'] == 'Pass';
     return $dup_tests;
 }
开发者ID:DylanGroenewoud,项目名称:PVNG,代码行数:33,代码来源:server.php

示例14: buildXml

 /**
  * handle request and build XML
  * @access protected
  *
  */
 protected function buildXml()
 {
     $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FOLDER_CREATE)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     $_resourceTypeConfig = $this->_currentFolder->getResourceTypeConfig();
     $sNewFolderName = isset($_GET["NewFolderName"]) ? $_GET["NewFolderName"] : "";
     $sNewFolderName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($sNewFolderName);
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($sNewFolderName) || $_resourceTypeConfig->checkIsHiddenFolder($sNewFolderName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     $sServerDir = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $sNewFolderName);
     if (!is_writeable($this->_currentFolder->getServerPath())) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     }
     $bCreated = false;
     if (file_exists($sServerDir)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ALREADY_EXIST);
     }
     if ($perms = $_config->getChmodFolders()) {
         $oldUmask = umask(0);
         $bCreated = @mkdir($sServerDir, $perms);
         umask($oldUmask);
     } else {
         $bCreated = @mkdir($sServerDir);
     }
     if (!$bCreated) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     } else {
         $oNewFolderNode = new Ckfinder_Connector_Utils_XmlNode("NewFolder");
         $this->_connectorNode->addChild($oNewFolderNode);
         $oNewFolderNode->addAttribute("name", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($sNewFolderName));
     }
 }
开发者ID:vcgato29,项目名称:poff,代码行数:40,代码来源:CreateFolder.php

示例15: setRobots

 /**
  * Set robots.
  *
  * @access public
  * @return void
  */
 public function setRobots()
 {
     $robotsFile = $this->app->getWwwRoot() . 'robots.txt';
     $writeable = (file_exists($robotsFile) and is_writeable($robotsFile) or is_writeable(dirname($robotsFile)));
     if (!empty($_POST)) {
         if (!$writeable) {
             $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->site->robotsUnwriteable, $robotsFile)));
         }
         if (!$this->post->robots) {
             $this->send(array('result' => 'fail', 'message' => array('robots' => sprintf($this->lang->error->notempty, $this->lang->site->robots))));
         }
         $result = file_put_contents($robotsFile, $this->post->robots);
         if (!$result) {
             $this->send(array('result' => 'fail', 'message' => $this->lang->fail));
         }
         $this->send(array('result' => 'success', 'message' => $this->lang->setSuccess, 'locate' => inlink('setrobots')));
     }
     $this->view->robots = '';
     if (file_exists($robotsFile)) {
         $this->view->robots = file_get_contents($robotsFile);
     }
     $this->view->robotsFile = $robotsFile;
     $this->view->writeable = $writeable;
     $this->view->title = $this->lang->site->setBasic;
     $this->display();
 }
开发者ID:eric0614,项目名称:chanzhieps,代码行数:32,代码来源:control.php


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