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

PHP file_ext函数代码示例

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

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



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

示例1: importCartshop

 static function importCartshop($tmp_file, $file, &$out)
 {
     global $CONFIG, $ST;
     $dir = 'shared/php/';
     include "{$dir}PHPExcel.php";
     include "{$dir}PHPExcel/IOFactory.php";
     PHPExcel_Settings::setLocale('ru');
     if (file_ext($file) == 'xlsx') {
         $objReader = new PHPExcel_Reader_Excel2007();
     } elseif (file_ext($file) == 'xls') {
         $objReader = new PHPExcel_Reader_Excel5();
     }
     $objReader->setReadDataOnly(true);
     $objPHPExcel = $objReader->load($tmp_file);
     /*$objPHPExcel->setActiveSheetIndex(0);
     
     		$objWorksheet = $objPHPExcel->getActiveSheet();
     		
     		$keys=array();
     		$keys_flg=array('category_id'=>'id',
     			'parent_id'=>'parentid',
     			'name'=>'name',
     			'description'=>'description',
     			'image_name'=>'img',
     			'sort_order'=>'main_sort',
     		);
     		
     		
     		$out=array();
     		foreach ($objWorksheet->getRowIterator() as $row) {
     			$data=array();
     			$field=array();	
     			$field_ext=array();	
     			$cellIterator = $row->getCellIterator();
     			$cellIterator->setIterateOnlyExistingCells(false); 
     			
     			$fld_flg=false;//Строка поля
     			$no_user_itm='';
     						
     
     			foreach ($cellIterator as $cell) {  
     				$val=trim(u2w($cell->getValue()));
     
     				if(!$fld_flg && $val=='category_id'){
     					$fld_flg=true;
     				}
     				if($fld_flg){//Грузим поля
     					if(isset($keys_flg[$val])){
     						$keys[$cell->getColumn()]=$keys_flg[$val];
     					}
     //					print_r($keys);
     					continue;
     				}
     
     				
     			  	if($keys && isset($keys[$cell->getColumn()])){
     			  		if(is_integer($keys[$cell->getColumn()])){				  		
     				  		$field["{$keys[$cell->getColumn()]}"]=$val;
     
     			  		}else{
     			  			$field_ext["{$keys[$cell->getColumn()]}"]=$val;
     			  		}
     				  		
     			  	}
     			}
     			if(!$keys){
     				continue;
     			}
     
     			if(!empty($field_ext['id'])){
     				if($field_ext['img']){
     					if($img=@file_get_contents('http://www.farmcosmetica.ru/image/'.$field_ext['img'])){
     						$img_name=preg_replace('|^data/|','',$field_ext['img']);
     						$img_name=str_replace('/','_',$img_name);
     						$img_name="storage/catalog/".$img_name;
     						if(!file_exists($img_name)){
     							file_put_contents($img_name,$img);
     						}
     						$field_ext['img']="/".$img_name;
     					}else{
     						$field_ext['img']="";
     					}
     				}
     					
     				$rs=$ST->select("SELECT * FROM sc_shop_catalog WHERE id={$field_ext['id']}");
     				if($rs->next()){
     					$ST->update('sc_shop_catalog',$field_ext,"id={$field_ext['id']}");
     				}else{
     					$ST->insert('sc_shop_catalog',$field_ext);
     				}
     				$out[$field_ext['id']]=$field_ext;
     			}
     		}
     		*/
     $objPHPExcel->setActiveSheetIndex(1);
     $objWorksheet = $objPHPExcel->getActiveSheet();
     $keys = array();
     $keys_flg = array('product_id' => 'id', 'categories' => 'categories', 'name' => 'name', 'quantity' => 'in_stock', 'image_name' => 'img', 'additional image names' => 'img_add', 'price' => 'price', 'date_added' => 'insert_time', 'date_modified' => 'update_time', 'viewed' => 'views', 'description' => 'html');
     $out = array();
     foreach ($objWorksheet->getRowIterator() as $row) {
//.........这里部分代码省略.........
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:101,代码来源:LibCatsrv.class.php


示例2: file_down

function file_down($file, $filename = '', $data = '')
{
    if (!$data && !is_file($file)) {
        exit;
    }
    $filename = $filename ? $filename : basename($file);
    $filetype = file_ext($filename);
    $filesize = $data ? strlen($data) : filesize($file);
    ob_end_clean();
    @set_time_limit(0);
    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
    } else {
        header('Pragma: no-cache');
    }
    header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
    header('Content-Encoding: none');
    header('Content-Length: ' . $filesize);
    header('Content-Disposition: attachment; filename=' . $filename);
    header('Content-Type: ' . $filetype);
    if ($data) {
        echo $data;
    } else {
        readfile($file);
    }
    exit;
}
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:28,代码来源:file.func.php


示例3: pass

 function pass($post)
 {
     global $DT_TIME, $MOD;
     if (!is_array($post)) {
         return false;
     }
     if (!$post['catid']) {
         return $this->_(lang('message->pass_catid'));
     }
     if (strlen($post['title']) < 3) {
         return $this->_(lang('message->pass_title'));
     }
     if (!$post['fileurl']) {
         return $this->_(lang('message->pass_down_fileurl'));
     }
     $ext = file_ext($post['fileurl']);
     if (in_array($ext, array('php', 'sql')) || strpos($post['fileurl'], '..') !== false) {
         return $this->_(lang('message->pass_down_badurl'));
     }
     if (!$post['filesize']) {
         return $this->_(lang('message->pass_down_filesize'));
     }
     if (DT_MAX_LEN && strlen($post['content']) > DT_MAX_LEN) {
         return $this->_(lang('message->pass_max'));
     }
     return true;
 }
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:27,代码来源:down.class.php


示例4: NTConfigloaded

function NTConfigloaded()
{
    $tmp_file = $_FILES['fichier']['tmp_name'];
    $content_dir = dirname(__FILE__) . "/ressources/conf/upload";
    if (!is_dir($content_dir)) {
        mkdir($content_dir);
    }
    if (!is_uploaded_file($tmp_file)) {
        up_iframe('{error_unable_to_upload_file}');
        exit;
    }
    $type_file = $_FILES['fichier']['type'];
    if (!strstr($type_file, 'application/octet-stream')) {
        up_iframe('{error_file_extension_not_match} :' . $type_file . ' did not match application/octet-stream');
        exit;
    }
    $name_file = $_FILES['fichier']['name'];
    $ext = file_ext($name_file);
    if (!strstr($ext, 'pol')) {
        up_iframe('{error_file_extension_not_match} :.' . $ext . ' did not match .pol');
        exit;
    }
    if (file_exists($content_dir . "/" . $name_file)) {
        @unlink($content_dir . "/" . $name_file);
    }
    if (!move_uploaded_file($tmp_file, $content_dir . "/NTconfig.pol")) {
        up_iframe("{error_unable_to_move_file} : {$content_dir}/NTconfig.pol");
        exit;
    }
    $_GET["moved_file"] = $content_dir . "/" . $name_file;
    $res = "{success}";
    $sock = new sockets();
    $sock->getfile("PushNTconfig:{$content_dir}/NTconfig.pol");
    up_iframe($res);
}
开发者ID:brucewu16899,项目名称:artica,代码行数:35,代码来源:NTconfig.pol.php


示例5: f_img_resize

function f_img_resize($path, $w, $h, $watermark = null)
{
    if (!$path) {
        return;
    }
    //Image::configure(array('driver' => 'gd'));
    $path_0 = $path;
    if (!file_exists(WEB . $path_0)) {
        return;
    }
    $path = str_replace('/upload/', '/upload/thum/', $path);
    $new = file_dir($path);
    $ext = file_ext($path);
    $new = $new . '/' . file_name($path) . "_{$w_}{$h}" . '.' . $ext;
    if (file_exists(WEB . $new)) {
        return $new;
    }
    echo WEB . $path_0;
    $img = Image::make(WEB . $path_0);
    $img->resize($w, $h);
    if (!is_dir(WEB . file_dir($new))) {
        mkdir(WEB . $new, 0777, true);
    }
    if ($watermark) {
        $img->insert(WEB . $watermark);
    }
    $img->save(WEB . $new);
    return $new;
}
开发者ID:sunkangtaichi,项目名称:PHPAPPLISTION_START,代码行数:29,代码来源:function.php


示例6: remote

 function remote($file, $savepath, $savename = '')
 {
     global $DT, $_userid;
     $this->file = $file;
     $this->userid = $_userid;
     $this->ext = file_ext($file);
     in_array($this->ext, array('jpg', 'jpeg', 'gif', 'png', 'bmp')) or $this->ext = 'jpg';
     $this->maxsize = $DT['uploadsize'] ? $DT['uploadsize'] * 1024 : 2048 * 1024;
     $this->savepath = $savepath;
     $this->savename = $savename;
 }
开发者ID:hcd2008,项目名称:destoon,代码行数:11,代码来源:remote.class.php


示例7: actUpload

 function actUpload()
 {
     global $get;
     if (isset($_FILES['upload'])) {
         $name = md5_file($_FILES['upload']['tmp_name']) . '.' . file_ext($_FILES['upload']['name']);
         $path = '/storage/temp/' . $name;
         move_uploaded_file($_FILES['upload']['tmp_name'], ROOT . $path);
         $img = scaleImg($path, $get->get('size'));
         if ($get->get('resize') == 'true') {
             $path = scaleImg($path, $get->get('size'));
         }
     }
     echo printJSONP(array('msg' => 'Сохранено', 'path' => $path, 'img' => $img), $get->get('cb'));
     exit;
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:15,代码来源:AdminFaq.class.php


示例8: http_upload

 function http_upload($file)
 {
     $ext = file_ext($file);
     $size = dround(filesize($file) / 1024);
     if ($size < 1) {
         return array('', 'invalid media file');
     }
     if ($ext == 'mp3' || $ext == 'amr') {
         if ($size > 256) {
             return array('', 'media file too large');
         }
         $type = 'voice';
     } else {
         if ($ext == 'mp4') {
             if ($size > 1024) {
                 return array('', 'media file too large');
             }
             $type = 'video';
         } else {
             if ($ext == 'jpg') {
                 if ($size > 128) {
                     return array('', 'media file too large');
                 }
                 $type = 'image';
             } else {
                 return array('', 'invalid media type');
             }
         }
     }
     $par = array();
     $par['access_token'] = $this->access_token;
     $par['type'] = $type;
     $par['media'] = '@' . $file;
     #$par = 'access_token='.$this->access_token.'&type='.$type.'&media=@'.$file;
     $cur = curl_init('http://file.api.weixin.qq.com/cgi-bin/media/upload');
     curl_setopt($cur, CURLOPT_POST, 1);
     curl_setopt($cur, CURLOPT_POSTFIELDS, $par);
     curl_setopt($cur, CURLOPT_FOLLOWLOCATION, 1);
     curl_setopt($cur, CURLOPT_HEADER, 0);
     curl_setopt($cur, CURLOPT_SSL_VERIFYPEER, 0);
     curl_setopt($cur, CURLOPT_RETURNTRANSFER, 1);
     #curl_setopt($cur, CURLOPT_HTTPHEADER, array('Expect: '));
     $rec = curl_exec($cur);
     curl_close($cur);
     $arr = json_decode($rec, true);
     return isset($arr['media_id']) ? array($arr['media_id'], $type) : array('', $arr['errmsg']);
 }
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:47,代码来源:init.inc.php


示例9: upload

 function upload($_file, $savepath, $savename = '', $fileformat = '')
 {
     global $DT, $_userid;
     foreach ($_file as $file) {
         $this->file = $file['tmp_name'];
         $this->file_name = $file['name'];
         $this->file_size = $file['size'];
         $this->file_type = $file['type'];
         $this->file_error = $file['error'];
     }
     $this->userid = $_userid;
     $this->ext = file_ext($this->file_name);
     $this->fileformat = $fileformat ? $fileformat : $DT['uploadtype'];
     $this->maxsize = $DT['uploadsize'] ? $DT['uploadsize'] * 1024 : 2048 * 1024;
     $this->savepath = $savepath;
     $this->savename = $savename;
 }
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:17,代码来源:upload.class.php


示例10: actUpload

 function actUpload()
 {
     global $get;
     $num = '';
     if (isset($_FILES['upload']) && $_FILES['upload']['name']) {
         $name = md5_file($_FILES['upload']['tmp_name']) . '.' . file_ext($_FILES['upload']['name']);
         $path = '/storage/temp/' . $name;
         move_uploaded_file($_FILES['upload']['tmp_name'], ROOT . $path);
     }
     if (isset($_FILES['upload1']) && $_FILES['upload1']['name']) {
         $num = '1';
         $name = md5_file($_FILES['upload1']['tmp_name']) . '.' . file_ext($_FILES['upload1']['name']);
         $path = '/storage/temp/' . $name;
         move_uploaded_file($_FILES['upload1']['tmp_name'], ROOT . $path);
     }
     echo printJSONP(array('msg' => 'Сохранено', 'path' => $path, 'num' => $num), $get->get('cb'));
     exit;
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:18,代码来源:AdminPartners.class.php


示例11: _xhUpload

 /**
  * xheditor专用上传
  * @param string|array $files
  * @param array $config  上传配置
  * @param string $type  上传文件类型
  */
 private function _xhUpload($files, $config = array(), $type = '')
 {
     $msg = null;
     $error = null;
     //上传配置
     $config = array_merge(C('FILE_UPLOAD_CONFIG'), $config);
     //HTML5上传
     if (isset($_SERVER['HTTP_CONTENT_DISPOSITION']) && preg_match('/attachment;\\s+name="(.+?)";\\s+filename="(.+?)"/i', $_SERVER['HTTP_CONTENT_DISPOSITION'], $info)) {
         $localName = urldecode($info[2]);
         $ext = file_ext($localName);
         if (!in_array($ext, $config['exts'])) {
             $error = '上传文件后缀不允许';
         } else {
             $filename = UPLOAD_PATH . date('Y/m/d/') . uniqid() . '.' . $ext;
             $res = file_write($filename, file_get_contents("php://input"));
             if ($res) {
                 $msg = array('url' => file_path2url($filename), 'localname' => $localName);
             } else {
                 $error = '上传失败';
             }
         }
     } else {
         $upload = new Upload($config);
         $res = $upload->upload($files);
         if ($res) {
             $localName = $res['filedata']['name'];
             $filename = UPLOAD_PATH . $res['filedata']['savepath'] . $res['filedata']['savename'];
             $msg = array('url' => file_path2url($filename), 'localname' => $res['filedata']['name']);
         } else {
             $error = $upload->getError();
         }
     }
     //针对xheditor不同上传类型返回不同结果
     if ($msg) {
         switch ($type) {
             case 'link':
                 //附件类型,在URL中直接显示文件名称
                 $msg['url'] .= '||' . $localName;
                 break;
         }
     }
     //返回上传结果
     $this->ajaxReturn(json_encode(array('err' => $error, 'msg' => $msg)), 'eval');
 }
开发者ID:huangkaijin,项目名称:clyy,代码行数:50,代码来源:UploadController.class.php


示例12: create_plugin

function create_plugin($plugin_id, $url = "", $name = "")
{
    $perfix_path = "plugins/{$name}/";
    echo "<div id='plugin_{$plugin_id}'>";
    /*,$css="",$js="",$call=""
    	if(!is_null($css) && ''!=$css)echo "<link href='$perfix_path$css' rel='stylesheet' type='text/css'>";
    	if(!is_null($js)&& ''!=$js) echo "<script type='text/javascript' src='$perfix_path$js'></script>";
    	if(!is_null($call)&& ''!=$call) echo "<script type='text/javascript'>$call</script>";
    	*/
    if (!is_null($url) && '' != $url) {
        if ("php" == substr(file_ext($url), 0, 3)) {
            //echo ("http://".$_SERVER["HTTP_HOST"]getRootUrl().$url);
            include_safe("{$perfix_path}" . $url);
        } else {
            include_once "{$perfix_path}" . $url;
        }
    }
    echo "</div>";
}
开发者ID:omusico,项目名称:Social,代码行数:19,代码来源:fplugin.php


示例13: actSave

 function actSave()
 {
     global $post;
     $id = $post->getInt('u_id');
     $data = array('login' => $post->get('login'), 'status' => $post->get('status'), 'name' => $post->get('name'), 'company' => $post->get('company'), 'phone' => $post->get('phone'), 'city' => $post->get('city'), 'address' => $post->get('address'), 'mail' => $post->get('mail'), 'avat' => $post->get('avat'), 'balance' => $post->getFloat('balance'), 'discount' => $post->getFloat('discount'), 'hide' => 0, 'type' => $post->get('type'));
     $password = $post->remove('password');
     $avat_path = $post->remove('avat_path');
     $msg = 'Сохранено';
     $img_out = "";
     if (!empty($_FILES['upload']['name']) && isImg($_FILES['upload']['name'])) {
         $img = $this->cfg('AVATAR_PATH') . '/' . md5($_FILES['upload']['tmp_name']) . "." . file_ext($_FILES['upload']['name']);
         move_uploaded_file($_FILES['upload']['tmp_name'], ROOT . $img);
         $data['avat'] = $img;
         $img_out = scaleImg($img, 'w200');
     }
     if ($post->getInt('clear')) {
         $data['avat'] = '';
     }
     $err = array();
     $rs = DB::select("SELECT * FROM sc_users WHERE login='" . SQL::slashes($post->get('login')) . "' AND u_id<>{$id}");
     if ($rs->next()) {
         $err['login'] = 'Пользователь существует';
     }
     if (!$err) {
         if ($id === 0) {
             $data[] = "password=MD5('" . trim($password) . "')";
             $id = DB::insert('sc_users', $data, 'u_id');
         } else {
             if (trim($password)) {
                 $data[] = "password=MD5('" . trim($password) . "')";
             }
             DB::update('sc_users', $data, 'u_id=' . $id);
         }
         echo printJSONP(array('msg' => $msg, 'u_id' => $id, 'img' => $img_out));
         exit;
     } else {
         echo printJSONP(array('err' => $err));
         exit;
     }
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:40,代码来源:Users.class.php


示例14: file_upload

function file_upload($name, $up_dir = null, $access = '', $filename = null)
{
    if (empty($up_dir)) {
        $up_dir = UPLOAD_DIR . "/" . date('Y') . date("m") . "/" . date("d");
    }
    $path = WEBPATH . $up_dir;
    if (!file_exists($path)) {
        mkdir($path, 0777, true);
    }
    $mime = $_FILES[$name]['type'];
    $filetype = file_gettype($mime);
    if ($filetype == 'bin') {
        $filetype = file_ext($_FILES[$name]['name']);
    }
    if ($filetype == false) {
        echo "File Type Error!";
        return false;
    } elseif (!empty($access)) {
        $access_type = explode(',', $access);
        if (!in_array($filetype, $access_type)) {
            echo "File Type '{$filetype}' not allow upload!";
            return false;
        }
    }
    if ($filename == null) {
        $filename = substr(time(), 6, -1) . rand(100000, 999999);
    }
    $filename .= "." . $filetype;
    if (move_uploaded_file($_FILES[$name]['tmp_name'], $path . "/" . $filename)) {
        return "{$up_dir}/{$filename}";
    } else {
        echo "Error! debug:\n";
        print_r($_FILES[$name]);
        return false;
    }
}
开发者ID:zzzzzmh,项目名称:KeywordFilteringService,代码行数:36,代码来源:file.php


示例15: actSave

 function actSave()
 {
     global $ST, $get, $post;
     $id = $post->getInt('id');
     $data = array('content' => $post->get('content'), 'description' => $post->get('description'), 'title' => $post->get('title'), 'author' => $post->get('author'), 'date' => dte($post->get('date'), 'Y-m-d'), 'state' => $post->get('state'), 'category' => $post->getInt('category'), 'position' => $post->getInt('position'), 'gallery' => $post->getInt('gallery'), 'type' => $this->getType());
     $img_out = "";
     if (!empty($_FILES['upload']['name']) && isImg($_FILES['upload']['name'])) {
         $img = $this->cfg('NEWS_IMAGE_PATH') . '/' . md5($_FILES['upload']['tmp_name']) . "." . file_ext($_FILES['upload']['name']);
         move_uploaded_file($_FILES['upload']['tmp_name'], ROOT . $img);
         $data['img'] = $img;
         $img_out = scaleImg($img, 'w200');
     }
     if ($post->getInt('clear')) {
         $data['img'] = '';
     }
     if ($id) {
         $ST->update('sc_news', $data, "id=" . $id);
     } else {
         $id = $ST->insert('sc_news', $data);
     }
     $ST->delete('sc_relation', "parent={$id} AND type='public'");
     foreach ($post->getArray('public_rel') as $v) {
         $ST->insert('sc_relation', array('parent' => $id, 'type' => 'public', 'child' => $v));
     }
     $msg = "Сохранено";
     if (true) {
         $content = '';
         $content .= '<small>' . date('d.m.Y') . '</small> ';
         $content .= '<strong>' . $post->getHtml('title') . '</strong><br />';
         $content .= '<span>' . $post->getHtml('description') . '</span><br />';
         $content .= '<a href="http://' . $this->cfg('SITE') . '/' . $post->get('type') . '/' . $id . '/">подробнее...</a>';
         if ($post->exists('save_and_send')) {
             $mail = new Mail();
             $mail->setFromMail(array($this->cfg('SITE'), $this->cfg('mail')));
             $key = 'http://' . $this->cfg('SITE') . '/cabinet/unsubscribe/?key=' . md5($this->getUser('mail') . $this->getType() . 'unsubscribe') . '&type=' . $this->getType() . '&mail=' . $this->getUser('mail');
             $key = '<a href="' . $key . '">' . $key . '</a>';
             $mail->setTemplate('letter_' . $this->getType(), array('FROM_SITE' => $this->cfg('SITE'), 'CONTENT' => $content, 'BODY' => $post->get('content'), 'TITLE' => $post->get('title')));
             $mail->xsend($this->getUser('mail'), array('UNSUBSCRIBE' => $key));
         } elseif ($post->exists('save_and_send_all')) {
             $q = "SELECT distinct mail,id FROM sc_subscribe WHERE type LIKE '%" . $this->getType() . "%' \r\n\t\t\t\tAND NOT EXISTS(SELECT mailid FROM sc_news_sendlog WHERE id=mailid AND newsid={$id}){$this->getMailFilter()}";
             if ($post->getInt('pack')) {
                 $q .= " LIMIT {$post->getInt('pack')}";
             }
             $rs = $ST->select($q);
             $mail = new Mail();
             //				$mail->setFromMail($this->getConfig('mail'));
             $mail->setFromMail(array($this->cfg('SITE'), $this->cfg('mail')));
             $mail->setTemplate('letter_' . $this->getType(), array('FROM_SITE' => $this->cfg('SITE'), 'CONTENT' => $content, 'BODY' => $post->get('content'), 'TITLE' => $post->get('title')));
             $n = 0;
             while ($rs->next()) {
                 if (check_mail($m = trim($rs->get('mail')))) {
                     $key = 'http://' . $this->cfg('SITE') . '/cabinet/unsubscribe/?key=' . md5($rs->get('mail') . $this->getType() . 'unsubscribe') . '&type=' . $this->getType() . '&mail=' . $rs->get('mail');
                     $key = '<a href="' . $key . '">' . $key . '</a>';
                     $mail->xsend($m, array('UNSUBSCRIBE' => $key));
                     $ST->insert('sc_news_sendlog', array('mailid' => $rs->get('id'), 'newsid' => $id));
                     $n++;
                 } else {
                     $ST->delete('sc_subscribe', "mail='" . SQL::slashes($rs->get('mail')) . "'");
                 }
             }
             $msg .= " отправлено {$n}";
         }
     }
     echo printJSONP(array('msg' => $msg, 'id' => $id, 'img' => $img_out));
     exit;
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:66,代码来源:AdminArticle.class.php


示例16: isset

$banner3 = isset($HOME['banner3']) ? $HOME['banner3'] : '';
$banner4 = isset($HOME['banner4']) ? $HOME['banner4'] : '';
$banner5 = isset($HOME['banner5']) ? $HOME['banner5'] : '';
if ($bannert == 2) {
    if ($banner1) {
        if (!$banner2) {
            $bannert = 0;
            $banner = $banner1;
        }
    } else {
        $bannert = 0;
    }
} else {
    if ($bannert == 1) {
        if ($bannerf) {
            if (preg_match("/^(jpg|jpeg|gif|png|bmp)\$/i", file_ext($bannerf))) {
                $bannert = 0;
                $banner = $bannert;
            }
        } else {
            $bannert = 0;
        }
    }
}
$bannerw = isset($HOME['bannerw']) && $HOME['bannerw'] ? intval($HOME['bannerw']) : 960;
$bannerh = isset($HOME['bannerh']) && $HOME['bannerh'] ? intval($HOME['bannerh']) : 200;
$could_comment = $MOD['comment'];
$homeurl = $MOD['homeurl'];
if ($domain) {
    $could_comment = false;
}
开发者ID:hcd2008,项目名称:destoon,代码行数:31,代码来源:init.inc.php


示例17: dalert

                 }
             }
             if ($htm) {
                 dalert('', '', 'parent.Upsuccess("' . $htm . '");');
             } else {
                 dalert('系统未在压缩包内找到HTM文件');
             }
         } else {
             dalert('解压缩失败,请检查目录权限');
         }
     } else {
         dalert($upload->errmsg);
     }
     break;
 case 'read':
     if ($word && in_array(file_ext($word), array('htm', 'html'))) {
         $data = file_get(DT_ROOT . '/file/temp/' . $word);
         if ($data) {
             if ($charset) {
                 $data = convert($data, $charset, DT_CHARSET);
             }
             if (preg_match("/<body[^>]*>([\\s\\S]+)<\\/body>/i", $data, $m)) {
                 $data = trim($m[1]);
             }
             $data = str_replace('<![if !vml]>', '', $data);
             $data = str_replace('<![endif]>', '', $data);
             $data = str_replace('<o:p>', '', $data);
             $data = str_replace('</o:p>', '', $data);
             $data = preg_replace("/ v:shapes=\"[^\"]*\">/i", ">", $data);
             if ($wd_class) {
                 $data = preg_replace("/[\\s]?class=[\\'|\"]?[^>]*[\\'|\"]?/i", '', $data);
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:word.inc.php


示例18: Configloaded

function Configloaded()
{
    if (!is_file('/usr/bin/unzip')) {
        up_iframe("ERROR: unable to stat \"/usr/bin/unzip\", please advise your Administrator");
        exit;
    }
    $tmp_file = $_FILES['fichier']['tmp_name'];
    $content_dir = dirname(__FILE__) . "/ressources/conf/upload";
    if (!is_dir($content_dir)) {
        mkdir($content_dir);
    }
    if (!is_uploaded_file($tmp_file)) {
        up_iframe('{error_unable_to_upload_file}');
        exit;
    }
    $type_file = $_FILES['fichier']['type'];
    if (!strstr($type_file, 'application/octet-stream')) {
        if (!strstr($type_file, 'application/zip')) {
            up_iframe('{error_file_extension_not_match} :' . $type_file . ' did not match application/zip');
            exit;
        }
    }
    $name_file = $_FILES['fichier']['name'];
    $ext = file_ext($name_file);
    if (!strstr($ext, 'zip')) {
        up_iframe('{error_file_extension_not_match} :.' . $ext . ' did not match .zip');
        exit;
    }
    if (file_exists($content_dir . "/" . $name_file)) {
        @unlink($content_dir . "/" . $name_file);
    }
    $script_file = $content_dir . "/" . $name_file;
    if (!move_uploaded_file($tmp_file, $script_file)) {
        up_iframe("{error_unable_to_move_file} : {$tmp_file}");
        exit;
    }
    shell_exec("/usr/bin/unzip -j -o {$script_file} -d {$content_dir}/ >{$content_dir}/unzip.txt 2>&1");
    $output = explode("\n", @file_get_contents("{$content_dir}/unzip.txt"));
    $export = implode("<br>", $output);
    $handle = opendir($content_dir);
    $f = false;
    while (false !== ($file = readdir($handle))) {
        if (preg_match("#(.+?).ovpn\$#", $file)) {
            $export = $export . implode("<br>", import_ovpn("{$content_dir}/{$file}"));
            $f = true;
        }
    }
    if (!$f) {
        $res[] = "unable to find ovpn file...";
    }
    if (is_array($res)) {
        $export = $export . implode("<br>", $res);
    }
    $export = str_replace("{$content_dir}/", "", $export);
    up_iframe($export);
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:56,代码来源:openvpn.servers-connect.php


示例19: _e

?>
</th>
					<th><?php 
_e('Select', 'wp-dbmanager');
?>
</th>
				</tr>
			</thead>
			<?php 
$no = 0;
$totalsize = 0;
if (!is_emtpy_folder($backup['path'])) {
    if ($handle = opendir($backup['path'])) {
        $database_files = array();
        while (false !== ($file = readdir($handle))) {
            if ($file != '.' && $file != '..' && $file != '.htaccess' && (file_ext($file) == 'sql' || file_ext($file) == 'gz')) {
                $database_files[] = $file;
            }
        }
        closedir($handle);
        sort($database_files);
        for ($i = sizeof($database_files) - 1; $i > -1; $i--) {
            if ($no % 2 == 0) {
                $style = '';
            } else {
                $style = ' class="alternate"';
            }
            $no++;
            $database_text = substr($database_files[$i], 13);
            $date_text = mysql2date(sprintf(__('%s @ %s', 'wp-dbmanager'), get_option('date_format'), get_option('time_format')), gmdate('Y-m-d H:i:s', substr($database_files[$i], 0, 10)));
            $size_text = filesize($backup['path'] . '/' . $database_files[$i]);
开发者ID:aim-web-projects,项目名称:ueno-chuoh,代码行数:31,代码来源:database-manage.php


示例20: check_backup_files

function check_backup_files()
{
    $backup_options = get_option('dbmanager_options');
    $database_files = array();
    if (!is_emtpy_folder($backup_options['path'])) {
        if ($handle = opendir($backup_options['path'])) {
            while (false !== ($file = readdir($handle))) {
                if ($file != '.' && $file != '..' && (file_ext($file) == 'sql' || file_ext($file) == 'gz')) {
                    $database_files[] = $file;
                }
            }
            closedir($handle);
            sort($database_files);
        }
    }
    if (sizeof($database_files) >= $backup_options['max_backup']) {
        @unlink($backup_options['path'] . '/' . $database_files[0]);
    }
}
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:19,代码来源:wp-dbmanager.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP file_extension函数代码示例发布时间:2022-05-15
下一篇:
PHP file_exists_incpath函数代码示例发布时间: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