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


PHP nggAdmin::chmod方法代码示例

本文整理汇总了PHP中nggAdmin::chmod方法的典型用法代码示例。如果您正苦于以下问题:PHP nggAdmin::chmod方法的具体用法?PHP nggAdmin::chmod怎么用?PHP nggAdmin::chmod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nggAdmin的用法示例。


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

示例1: swfupload_image

 /**
  * Upload function will be called via the Flash uploader
  * 
  * @class nggAdmin
  * @param integer $galleryID
  * @return string $result
  */
 function swfupload_image($galleryID = 0)
 {
     global $wpdb;
     if ($galleryID == 0) {
         return __('No gallery selected !', 'nggallery');
     }
     // WPMU action
     if (nggWPMU::check_quota()) {
         return '0';
     }
     // Check the upload
     if (!isset($_FILES['Filedata']) || !is_uploaded_file($_FILES['Filedata']['tmp_name']) || $_FILES['Filedata']['error'] != 0) {
         return __('Invalid upload. Error Code : ', 'nggallery') . $_FILES['Filedata']['error'];
     }
     // get the filename and extension
     $temp_file = $_FILES['Filedata']['tmp_name'];
     $filepart = nggGallery::fileinfo($_FILES['Filedata']['name']);
     $filename = $filepart['basename'];
     // check for allowed extension
     $ext = array('jpg', 'png', 'gif');
     if (!in_array($filepart['extension'], $ext)) {
         return $_FILES[$key]['name'] . __('is no valid image file!', 'nggallery');
     }
     // get the path to the gallery
     $gallerypath = $wpdb->get_var("SELECT path FROM {$wpdb->nggallery} WHERE gid = '{$galleryID}' ");
     if (!$gallerypath) {
         @unlink($temp_file);
         return __('Failure in database, no gallery path set !', 'nggallery');
     }
     // read list of images
     $imageslist = nggAdmin::scandir(WINABSPATH . $gallerypath);
     // check if this filename already exist
     $i = 0;
     while (in_array($filename, $imageslist)) {
         $filename = $filepart['filename'] . '_' . $i++ . '.' . $filepart['extension'];
     }
     $dest_file = WINABSPATH . $gallerypath . '/' . $filename;
     // save temp file to gallery
     if (!@move_uploaded_file($_FILES["Filedata"]['tmp_name'], $dest_file)) {
         nggAdmin::check_safemode(WINABSPATH . $gallerypath);
         return __('Error, the file could not be moved to : ', 'nggallery') . $dest_file;
     }
     if (!nggAdmin::chmod($dest_file)) {
         return __('Error, the file permissions could not be set', 'nggallery');
     }
     return '0';
 }
开发者ID:ahsaeldin,项目名称:projects,代码行数:54,代码来源:functions.php

示例2: swfupload_image

 /**
  * Upload function will be called via the Flash uploader
  *
  * @class nggAdmin
  * @param integer $galleryID
  * @return string $result
  */
 static function swfupload_image($galleryID = 0)
 {
     global $nggdb;
     if ($galleryID == 0) {
         return __('No gallery selected !', 'nggallery');
     }
     // WPMU action
     if (nggWPMU::check_quota()) {
         return '0';
     }
     // Check the upload
     if (!isset($_FILES['Filedata']) || !is_uploaded_file($_FILES['Filedata']['tmp_name']) || $_FILES['Filedata']['error'] != 0) {
         return __('Invalid upload. Error Code : ', 'nggallery') . $_FILES['Filedata']['error'];
     }
     // get the filename and extension
     $temp_file = $_FILES['Filedata']['tmp_name'];
     $filepart = nggGallery::fileinfo($_FILES['Filedata']['name']);
     $filename = $filepart['basename'];
     // check for allowed extension
     $ext = apply_filters('ngg_allowed_file_types', array('jpeg', 'jpg', 'png', 'gif'));
     if (!in_array(strtolower($filepart['extension']), $ext)) {
         return esc_html($_FILES[$key]['name']) . __('is no valid image file!', 'nggallery');
     }
     // get the path to the gallery
     $gallery = $nggdb->find_gallery((int) $galleryID);
     if (empty($gallery->path)) {
         @unlink($temp_file);
         return __('Failure in database, no gallery path set !', 'nggallery');
     }
     // read list of images
     $imageslist = nggAdmin::scandir(WINABSPATH . $gallery->path);
     // check if this filename already exist
     $i = 0;
     while (in_array($filename, $imageslist)) {
         $filename = $filepart['filename'] . '_' . $i++ . '.' . $filepart['extension'];
     }
     $dest_file = WINABSPATH . $gallery->path . '/' . $filename;
     // save temp file to gallery
     if (!@move_uploaded_file($_FILES["Filedata"]['tmp_name'], $dest_file)) {
         nggAdmin::check_safemode(WINABSPATH . $gallery->path);
         return __('Error, the file could not be moved to : ', 'nggallery') . esc_html($dest_file);
     }
     if (!nggAdmin::chmod($dest_file)) {
         return __('Error, the file permissions could not be set', 'nggallery');
     }
     return '0';
 }
开发者ID:jeanpage,项目名称:ca_learn,代码行数:54,代码来源:functions.php


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