Server : nginx/1.22.1
System : Linux iZwz9daxib3w3i063fw434Z 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64
User : www ( 1000)
PHP Version : 5.6.40
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Directory :  /www/wwwroot/www.jkmold.com/phpcms/libs/functions/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : /www/wwwroot/www.jkmold.com/phpcms/libs/functions/extention.func.php
<?php
/**
 *  extention.func.php 用户自定义函数库
 *
 * @copyright			(C) 2005-2010 PHPCMS
 * @license				http://www.phpcms.cn/license/
 * @lastmodify			2010-10-27
 */
 function yr_rep($data,$rep_old=array('\r\n','<br/>','<br />','_'),$rep_news=array('','','')){
	return str_replace($rep_old,$rep_news,$data);
 }
 /*  $url='http://www.sctled.com/d/file/banner/2017-07-25/6406e10d7c41caf165cc79b90ff9cdf2.jpg';
	$this->dows($url ,$filename='yiran'); */
 	function dows($file_url='',$filename='yiran'){
			if(!$file_url){
				die('文件不存在');
				
			}
			$file_name=$filename.get_ext($file_url ); //这里重命名
			header("Content-type: application/octet-stream");
			header('Content-Disposition: attachment; filename='.$file_name); 
			ob_end_clean();
			readfile($file_url);
	}
	
	function get_ext($file){
		$filename=basename($file);
		return '.'.substr(strrchr($filename, '.'), 1);
	}
  function LL($lang='zh-cn',$file= 'yiran') {
	  $path=PC_PATH.'languages'.DIRECTORY_SEPARATOR .'lang'.DIRECTORY_SEPARATOR . $lang . DIRECTORY_SEPARATOR . $file .'.lang.php';
	  if(file_exists($path)){
		$langs=  require $path;
	  }else{
		  $langs=array();
	  }
		
	return $langs;
       
}
function yr_send_email($toemail, $subject, $message, $from='',$cfg = array(),$fujian=array(), $sitename=''){
	
			require PC_PATH. 'libs/PHPMailer/PHPMailerAutoload.php';
			
			// 实例化PHPMailer核心类
			$mail = new PHPMailer();
			// 是否启用smtp的debug进行调试 开发环境建议开启 生产环境注释掉即可 默认关闭debug调试模式
			$mail->SMTPDebug = 0;
			// 使用smtp鉴权方式发送邮件
			$mail->isSMTP();
			// smtp需要鉴权 这个必须是true
			$mail->SMTPAuth = true;
			// 链接qq域名邮箱的服务器地址
			$mail->Host = $cfg['host'];//'smtp.btlpcb.com';
			// 设置使用ssl加密方式登录鉴权
			$mail->SMTPSecure = 'ssl';
			// 设置ssl连接smtp服务器的远程服务器端口号
			$mail->Port =empty($cfg['port'])?465:$cfg['port'];// 465;
			// 设置发送的邮件的编码
			$mail->CharSet = 'UTF-8';
			// 设置发件人昵称 显示在收件人邮件的发件人邮箱地址前的发件人姓名
			$mail->FromName = empty($sitename)?$subject:$sitename;
			// smtp登录的账号 QQ邮箱即可
			$mail->Username =$cfg['username'];// 'sales@btlpcb.com';
			// smtp登录的密码 使用生成的授权码
			$mail->Password = $cfg['password'];// 
			// 设置发件人邮箱地址 同登录账号
			$mail->From = empty($from)?$cfg['username']:$from;
			// 邮件正文是否为html编码 注意此处是一个方法
			if(!empty($fujian)){
						$mail->AddAttachment($fujian['fileurl'],$fujian['filename']); // 添加附件,并指定名称
					}
			$mail->isHTML(true);
			// 设置收件人邮箱地址
			$mail->addAddress($toemail);

			// 添加该邮件的主题
			$mail->Subject =$subject;
			// 添加邮件正文
			$mail->Body = $message;

			// 发送邮件 返回状态
			$status = $mail->send();
			if($status){
				return true;
				
			}else{
				
				return false;
			}
	
}
function img_crop($oldimg,$catname,$w,$h,$type,$alpha){
	
	$new_path='./uploadfile/thumb/'.$catname;
	if (!is_dir($path)){  
	mkdir(iconv("UTF-8", "GBK", $new_path),0777,true); 
	}
	if(empty($oldimg)){
		
		$oldimg='./statics/images/nopic.gif';
	}
	$filename= substr($oldimg ,strrpos($oldimg ,'/')+1 );
	$new_img_file='thum_'.$w.'_'.$h.'_'.$filename;
	
	$new_path_filename=$new_path.'/'.$new_img_file;
	if( !is_file($new_path_filename)){
		require_once  PC_PATH. 'libs/classes/yr_image.class.php';
		
		$ImageCrop=new yr_image($oldimg,$new_path_filename);
		//return $ImageCrop;
		$ImageCrop->Crop($w,$h,$type);
		 if($alpha==0){
			$ImageCrop->SaveImage();
			 
		 }else{
			$ImageCrop->SaveAlpha();//将补白变成透明像素保存 
			 
		 }
		 
		$ImageCrop->destory();
	}
	return $new_path_filename;
	
}
function img_yr($oldimg,$catname='products',$w=370,$h=240,$type=2,$alpha=0){
	
	return img_crop($oldimg,$catname,$w,$h,$type,$alpha);
}
?>