Ejemplo n.º 1
0
 /**
  *  加载缓存驱动
  * @param $cache_type 	缓存类型
  * @return object
  */
 public function load($cache_type)
 {
     $object = null;
     if (isset($cache_type)) {
         switch ($cache_type) {
             default:
             case 'zendfile':
                 $object = bpBase::loadSysClass('cache_zendfile');
                 break;
             case 'file':
                 $object = bpBase::loadSysClass('cache_file');
                 break;
             case 'memcache':
                 define('MEMCACHE_HOST', $this->cache_config['hostname']);
                 define('MEMCACHE_PORT', $this->cache_config['port']);
                 define('MEMCACHE_TIMEOUT', $this->cache_config['timeout']);
                 define('MEMCACHE_DEBUG', $this->cache_config['debug']);
                 $object = bpBase::loadSysClass('cache_memcache');
                 break;
             case 'apc':
                 $object = bpBase::loadSysClass('cache_apc');
                 break;
         }
     } else {
         $object = bpBase::loadSysClass('cache_zendfile');
     }
     return $object;
 }
Ejemplo n.º 2
0
 function __construct()
 {
     //$this->update_log_db = bpBase::loadModel('update_log_model');
     parent::__construct();
     $checkAccess = $this->exitWithoutAccess('system', 'manage');
     $this->dbConfig = array('default' => array('hostname' => DB_HOSTNAME, 'database' => DB_NAME, 'username' => DB_USER, 'password' => DB_PASSWORD, 'tablepre' => TABLE_PREFIX, 'charset' => DB_CHARSET, 'type' => 'mysql', 'debug' => DEBUG, 'pconnect' => 0, 'autoconnect' => 0));
     bpBase::loadSysClass('db_factory');
     $this->db = db_factory::get_instance($this->dbConfig)->get_database('default');
 }
Ejemplo n.º 3
0
 /**
  * 构造函数
  */
 public function __construct()
 {
     $route = bpBase::loadSysClass('route');
     if (!defined('ROUTE_MODEL')) {
         define('ROUTE_MODEL', $route->routeModel());
         define('ROUTE_CONTROL', $route->routeControl());
         define('ROUTE_ACTION', $route->routeAction());
     }
     $this->init();
     //执行计划任务
     if (loadConfig('system', 'cron')) {
         //$classRunObj=bpBase::loadAppClass('cronRun','cron',1);
         //$classRunObj->init();
     }
 }
Ejemplo n.º 4
0
 /**
  *  加载数据库驱动
  * @param $db_config_name 	数据库配置名称
  * @return object
  */
 public function connect($db_config_name)
 {
     $object = null;
     switch ($this->db_config[$db_config_name]['type']) {
         case 'mysql':
             bpBase::loadSysClass('mysql', '', 0);
             $object = new mysql();
             break;
         case 'mysqli':
             $object = bpBase::loadSysClass('mysqli');
             break;
         case 'access':
             $object = bpBase::loadSysClass('db_access');
             break;
         default:
             bpBase::load_sys_class('mysql', '', 0);
             $object = new mysql();
     }
     $object->open($this->db_config[$db_config_name]);
     return $object;
 }
Ejemplo n.º 5
0
 function vc()
 {
     $session_storage = getSessionStorageType();
     bpBase::loadSysClass($session_storage);
     $captcha = bpBase::loadSysClass('checkCode');
     //width
     if (isset($_GET['width']) && intval($_GET['width'])) {
         $captcha->width = intval($_GET['width']);
     }
     if ($captcha->width <= 0) {
         $captcha->width = 70;
     }
     //height
     if (isset($_GET['height']) && intval($_GET['height'])) {
         $captcha->height = intval($_GET['height']);
     }
     if ($captcha->height <= 0) {
         $captcha->height = 25;
     }
     //codeNum
     if (isset($_GET['codeNum']) && intval($_GET['codeNum'])) {
         $captcha->code_len = intval($_GET['codeNum']);
     }
     if ($captcha->codeNum > 8 || $captcha->codeNum < 2) {
         $captcha->codeNum = 4;
     }
     //backGround
     if (isset($_GET['backGround']) && trim(urldecode($_GET['backGround'])) && preg_match('/(^[a-z0-9]{6}$)/im', trim(urldecode($_GET['backGround'])))) {
         $captcha->backGround = '#' . trim(urldecode($_GET['backGround']));
     }
     //fontColor
     if (isset($_GET['fontColor']) && trim(urldecode($_GET['fontColor'])) && preg_match('/(^[a-z0-9]{6}$)/im', trim(urldecode($_GET['fontColor'])))) {
         $captcha->fontColor = '#' . trim(urldecode($_GET['fontColor']));
     }
     $captcha->showImg();
     $_SESSION['validCode'] = $captcha->getCaptcha();
 }
Ejemplo n.º 6
0
 public function action_picUpload()
 {
     if (!isset($_SESSION['canupload'])) {
         exit;
     }
     $error = 0;
     if (isset($_FILES['thumb'])) {
         $photo = $_FILES['thumb'];
         if (substr($photo['type'], 0, 5) == 'image') {
             switch ($photo['type']) {
                 case 'image/jpeg':
                 case 'image/jpg':
                 case 'image/pjpeg':
                     $ext = '.jpg';
                     break;
                 case 'image/gif':
                     $ext = '.gif';
                     break;
                 case 'image/png':
                 case 'image/x-png':
                     $ext = '.png';
                     break;
                 default:
                     $error = -1;
                     break;
             }
             if ($error == 0) {
                 $time = SYS_TIME;
                 $year = date('Y', $time);
                 $month = date('m', $time);
                 $day = date('d', $time);
                 $pathInfo = upFileFolders($time);
                 $dstFolder = $pathInfo['path'];
                 $dstFile = ABS_PATH . 'upload' . DIRECTORY_SEPARATOR . 'temp' . $ext;
                 //the size of file uploaded must under 1M
                 if ($photo['size'] > 2000000) {
                     $error = -2;
                     return $error;
                 }
             } else {
                 return $error;
             }
             //if no error
             if ($error == 0) {
                 $rand = randStr(4);
                 //delete primary files
                 if (file_exists($dstFolder . $time . $rand . $ext)) {
                     unlink($dstFolder . $time . $rand . $ext);
                 }
                 if ($ext != '.gif') {
                     //save the temporary file
                     move_uploaded_file($photo['tmp_name'], $dstFile);
                     $imgInfo = getimagesize($dstFile);
                     //generate new files
                     $imageWidth = intval($_POST['width']) != 0 ? intval($_POST['width']) : $imgInfo[0];
                     $imageHeight = intval($_POST['height']) != 0 ? intval($_POST['height']) : $imgInfo[1];
                     bpBase::loadSysClass('image');
                     image::zfResize($dstFile, $dstFolder . $time . $rand . '.jpg', $imageWidth, $imageHeight, 1 | 4, 2);
                     $ext = '.jpg';
                     //
                 } else {
                     move_uploaded_file($photo['tmp_name'], $dstFolder . $time . $rand . '.gif');
                 }
                 if (isset($_POST['channelid'])) {
                     //内容缩略图
                     $channelObj = bpBase::loadAppClass('channelObj', 'channel');
                     $thisChannel = $channelObj->getChannelByID($_POST['channelid']);
                     $articleObj = bpBase::loadAppClass('articleObj', 'article');
                     $articleObj->setOtherThumb($thisChannel, $dstFile, $dstFolder, $time . $rand, 'jpg');
                 }
                 if ($ext != '.gif') {
                     @unlink($dstFile);
                 }
                 $location = MAIN_URL_ROOT . '/upload/images/' . $year . '/' . $month . '/' . $day . '/' . $time . $rand . $ext;
                 $error = 0;
             }
         } else {
             $error = -1;
         }
     } else {
         $error = -1;
     }
     if ($error == 0) {
         echo $location;
     } else {
         $errors = array(-1 => '你上传的不是图片', -2 => '文件不能超过2M', -3 => '图片地址不正确');
         echo $errors[intval($error)];
     }
 }
Ejemplo n.º 7
0
<?php

bpBase::loadSysClass('model', '', 0);
class site_model extends model
{
    public function __construct()
    {
        $this->table_name = TABLE_PREFIX . 'moopha_site';
        parent::__construct();
    }
    function sites()
    {
        $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'site ORDER BY taxis ASC';
        $sites = $this->get_resultsBySql($sql);
        return $sites;
    }
    function getSiteByToken($token)
    {
        $cacheName = 'siteByToken' . $token;
        $cache = getCache($cacheName);
        if ($cache) {
            return unserialize($cache);
        } else {
            $site = $this->get_one(array('token' => $token));
            setCache($cacheName, serialize($site));
            return $site;
        }
    }
}
Ejemplo n.º 8
0
<?php

/**
 *  数据模型基类
 */
bpBase::loadSysClass('db_factory', '', 0);
class model
{
    //数据库配置
    protected $db_config = '';
    //调用数据库的配置项
    protected $db_setting = 'default';
    //数据库连接
    protected $db = '';
    //数据表名
    protected $table_name = '';
    //表前缀
    public $db_tablepre = '';
    public function __construct()
    {
        if (!isset($this->db_config[$this->db_setting])) {
            $this->db_setting = 'default';
        }
        //$this->table_name = $this->table_name;
        $this->db = db_factory::get_instance($this->db_config)->get_database($this->db_setting);
    }
    /**
     * 执行sql查询
     * @param $where 		查询条件[例`name`='$name']
     * @param $data 		需要查询的字段值[例`name`,`gender`,`birthday`]
     * @param $limit 		返回结果范围[例:10或10,10 默认为空]
Ejemplo n.º 9
0
<?php

$session_storage = getSessionStorageType();
bpBase::loadSysClass($session_storage);
bpBase::loadSysFunc('front');
class front
{
    public $uid;
    public $username;
    public $email;
    public $realname;
    public $mp;
    public $qq;
    public $credits;
    public $isAdmin;
    public static $user;
    //
    public static $smarty;
    public function __construct()
    {
        //smarty
        if (front::$smarty == '') {
            //smarty
            ini_set('include_path', ABS_PATH . 'library' . DIRECTORY_SEPARATOR . 'smarty' . PATH_SEPARATOR . ini_get('include_path'));
            require_once 'Smarty.class.php';
            //
            $smartyInstance = new smarty();
            if (!isset($_GET['preview']) || !intval($_GET['preview'])) {
                $smartyInstance->template_dir = ABS_PATH . 'smarty' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR;
            } else {
                $smartyInstance->template_dir = ABS_PATH . 'templates' . DIRECTORY_SEPARATOR;
Ejemplo n.º 10
0
 public function autophoto201307023_b()
 {
     $taskName = 'autophoto201307023_b';
     $thisTask = $this->update_log_db->get_one(array('file' => $taskName));
     $this->_executedCheck($taskName, $thisTask);
     //
     $autoclassification_db = bpBase::loadModel('autoclassification_model');
     $autos = $autoclassification_db->select('logo!=\'\' AND logo IS NOT NULL', '*', '', 'id ASC');
     $count = count($autos);
     $i = intval($_GET['i']);
     //
     if ($i < $count) {
         $step = 5;
         for ($j = 0; $j < $step; $j++) {
             $num = $i + $j;
             //
             $logoPathDir = ABS_PATH . 'autoPhotos' . DIRECTORY_SEPARATOR . 'logo' . DIRECTORY_SEPARATOR . $autos[$num]['id'] . DIRECTORY_SEPARATOR;
             bpBase::loadSysClass('image');
             @($imgInfo = getimagesize($logoPathDir . 'logo_s.jpg'));
             if ($imgInfo[0] > 100) {
                 @copy($logoPathDir . 'logo_s.jpg', $logoPathDir . 'logo_s.jpg.bak');
                 image::zfResize($logoPathDir . 'logo_s.jpg', $logoPathDir . 'logo_s.jpg', 80, 60, 1, 2, 0, 0, 0);
                 echo $autos[$num]['id'] . '<br>';
             }
         }
         $i = $i + $step;
         showMessage($thisTask['des'] . ':' . $i . '/' . $count, '?m=update&c=updateTask&a=' . $taskName . '&i=' . $i, 0);
     } else {
         $this->_finishTask($taskName);
     }
 }
Ejemplo n.º 11
0
 public function picUpload()
 {
     $result = array();
     if (count($_POST)) {
         $result['post'] = $_POST;
     }
     if (count($_FILES)) {
         $result['files'] = $_FILES;
     }
     // Validation
     $error = false;
     if (!isset($_FILES['Filedata']) || !is_uploaded_file($_FILES['Filedata']['tmp_name'])) {
         $error = 'Invalid Upload';
         exit;
     }
     // Processing start
     $photo = $_FILES['Filedata'];
     $time = SYS_TIME;
     $year = date('Y', $time);
     $month = date('m', $time);
     $day = date('d', $time);
     $pathInfo = upFileFolders($time);
     $dstFolder = $pathInfo['path'];
     $rand = randStr(4);
     $dstFile = $dstFolder . $time . $rand . $photo['name'];
     //the size of file uploaded must under 1M
     if ($photo['size'] > 3000000) {
         $error = '图片太大不能超过3M';
         exit;
     }
     //save the temporary file
     @move_uploaded_file($photo['tmp_name'], $dstFile);
     //
     //自动缩放
     $imgInfo = @getimagesize($dstFile);
     $maxPicWidth = intval(loadConfig('cmsContent', 'maxPicWidth'));
     $maxPicWidth = $maxPicWidth < 1 ? 500 : $maxPicWidth;
     if ($imgInfo[0] > $maxPicWidth) {
         $newWidth = $maxPicWidth;
         $newHeight = $imgInfo[1] * $newWidth / $imgInfo[0];
     } else {
         $newWidth = $imgInfo[0];
         $newHeight = $imgInfo[1];
     }
     bpBase::loadSysClass('image');
     bpBase::loadSysClass('watermark');
     image::zfResize($dstFile, $dstFolder . $time . $rand . '.jpg', $newWidth, $newHeight, 1, 2, 0, 0, 1);
     //delete the temporary file
     @unlink($dstFile);
     $location = CMS_DIR_PATH . $pathInfo['url'] . $time . $rand . '.jpg';
     //
     bpBase::loadSysClass('image');
     bpBase::loadSysClass('watermark');
     $wm = new watermark();
     $wm->wm($dstFolder . $time . $rand . '.jpg');
     //
     $filePath = $location;
     //processing end
     if ($error) {
         $return = array('status' => '0', 'error' => $error);
     } else {
         $return = array('status' => '1', 'name' => ABS_PATH . $filePath);
         // Our processing, we get a hash value from the file
         $return['hash'] = '';
         // ... and if available, we get image data
         if ($imgInfo) {
             $return['width'] = $newWidth;
             $return['height'] = $newHeight;
             $return['mime'] = $imgInfo['mime'];
             $return['url'] = $filePath;
             $return['randnum'] = rand(0, 999999);
         }
     }
     // Output
     if (isset($_REQUEST['response']) && $_REQUEST['response'] == 'xml') {
         // header('Content-type: text/xml');
         // Really dirty, use DOM and CDATA section!
         echo '<response>';
         foreach ($return as $key => $value) {
             echo "<{$key}><![CDATA[{$value}]]></{$key}>";
         }
         echo '</response>';
     } else {
         // header('Content-type: application/json');
         echo json_encode($return);
     }
 }
Ejemplo n.º 12
0
 public function autoSaveRemoteImage($str, $baseURI = '')
 {
     $str = stripslashes($str);
     $watermark = bpBase::loadSysCLass('watermark');
     $img_array = array();
     //$str = stripslashes($str);
     if (get_magic_quotes_gpc()) {
         $str = stripslashes($str);
     }
     preg_match_all('#src="(http://(((?!").)+).(jpg|gif|bmp|png))"#i', $str, $img_array);
     $img_array_urls = array_unique($img_array[1]);
     $dstFolder = ABS_PATH . 'upload' . DIRECTORY_SEPARATOR . 'images';
     @chmod($dstFolder, 0777);
     if ($baseURI) {
         $img_array_urls = $this->_expandlinks($img_array_urls, $baseURI);
         if ($img_array_urls) {
             exit;
         }
     }
     if ($img_array_urls) {
         $i = 0;
         $time = SYS_TIME;
         foreach ($img_array_urls as $k => $v) {
             if (!strpos($v, $_SERVER['HTTP_HOST'])) {
                 //不保存本站的
                 $filenames = explode('.', $v);
                 $filenamesCount = count($filenames);
                 //
                 $year = date('Y', $time);
                 $month = date('m', $time);
                 $pathInfo = upFileFolders($time);
                 $dstFolder = $pathInfo['path'];
                 $rand = randStr(4);
                 $filePath = $dstFolder . $time . $rand . '.' . $filenames[$filenamesCount - 1];
                 //
                 @httpCopy($v, $filePath, 5);
                 //自动缩放
                 $imgInfo = @getimagesize($filePath);
                 $maxPicWidth = intval(loadConfig('cmsContent', 'maxPicWidth'));
                 $maxPicWidth = $maxPicWidth < 1 ? 500 : $maxPicWidth;
                 if ($imgInfo[0] > $maxPicWidth) {
                     $newWidth = $maxPicWidth;
                     $newHeight = $imgInfo[1] * $newWidth / $imgInfo[0];
                     bpBase::loadSysClass('image');
                     image::zfResize($filePath, $filePath, $newWidth, $newHeight, 1, 2, 0, 0, 1);
                 }
                 //
                 if (file_exists($filePath)) {
                     $watermark->wm($filePath);
                     $str = str_replace($v, 'http://' . $_SERVER['HTTP_HOST'] . CMS_DIR_PATH . $pathInfo['url'] . $time . $rand . '.' . $filenames[$filenamesCount - 1], $str);
                 }
             }
             $i++;
         }
     }
     return $str;
 }
Ejemplo n.º 13
0
 function createIndexPage($siteid = 1)
 {
     $siteid = intval($siteid);
     if (!ABS_PATH . 'templatesCache' && !is_dir(ABS_PATH . 'templatesCache')) {
         mkdir(ABS_PATH . 'templatesCache', 777);
     }
     if ($siteid < 100) {
         //站点
         $template = $this->getDefaultTemplate($siteid, 1);
         //获取首页模板的数据库信息
         if (!$template) {
             showMessage('没有默认的模板,请在模板管理里面设置', '?m=template&c=m_template&a=templates&siteid=' . $siteid, 2000);
             exit;
         }
         //如果缓存不存在则分析模板
         if (!file_exists(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $template['id'] . '.parsed.tpl.php')) {
             $templateInfo = $this->getTemplateInfoByPath($template['path']);
             //parse first layer tags
             $this->addIDtoFirstLayerTagInTemplate($siteid, $template['id'], $templateInfo['absPath']);
         }
         $this->parseFirstLayerTag($template['id'], $siteid, 0, 0);
         //生成静态首页
         if (defined('NEW_INDEX') && NEW_INDEX && !loadConfig('index', 'notToHtml')) {
             $sitePage = bpBase::loadAppClass('sitePage', 'site');
             $sitePage->index(0);
         } else {
             if ((loadConfig('site', 'tohtml') || !loadConfig('index', 'notToHtml')) && $siteid == 1) {
                 $snoopy = bpBase::loadSysClass('Snoopy', '', 1);
                 if (!strpos(MAIN_URL_ROOT, 'localhost')) {
                     //echo 'st';
                     $snoopy->fetch('http://' . $_SERVER['HTTP_HOST'] . '/index.php');
                 } else {
                     $snoopyRt = $snoopy->fetch('http://127.0.0.1/index.php');
                 }
                 //file_put_contents(ABS_PATH.'/index.html',$snoopy->result);
             }
         }
         if (isah()) {
             $this->createSinglePage(193);
         }
         if ($siteid > 1) {
             //ah子站
             $site = bpBase::loadAppClass('siteObj', 'site');
             $thisSite = $site->getSiteByID($siteid);
             $child_siteMoudleClass = bpBase::loadAppClass('sitePage', 'site');
             $geo_db = bpBase::loadModel('geo_model');
             $thisGeo = $geo_db->get_one(array('geoindex' => $thisSite->siteindex));
             if ($thisGeo) {
                 $child_siteMoudleClass->childSiteIndex($thisGeo['id']);
             }
         }
     } else {
         //专题
         $special_db = bpBase::loadModel('special_model');
         $thisSpecial = $special_db->get_one(array('id' => $siteid));
         if (!$thisSpecial['templateid']) {
             showMessage('没有选择模板,请设置模板后再操作', '?m=special&c=m_special&a=specialSet&id=' . $siteid, 2000);
             exit;
         }
         $template_db = bpBase::loadModel('template_model');
         $template = $template_db->get_one(array('id' => $thisSpecial['templateid']));
         if (!$template) {
             showMessage('模板不存在,请在模板管理里面设置', '?m=template&c=m_template&a=templates&siteid=' . $siteid . '&type=5', 2000);
             exit;
         }
         //如果缓存不存在则分析模板
         //if (!file_exists(ABS_PATH.'templatesCache'.DIRECTORY_SEPARATOR.$template['id'].'.parsed.tpl.php')){
         $templateInfo = $this->getTemplateInfoByPath($template['path']);
         //parse first layer tags
         $this->addIDtoFirstLayerTagInTemplate($siteid, $template['id'], $templateInfo['absPath']);
         //}
         $this->parseFirstLayerTag($template['id'], $siteid, 0, 0);
         //更新专题url
         $specialConfig = loadConfig('special');
         $thisSpecial['urlformat'] = $thisSpecial['urlformat'] ? $thisSpecial['urlformat'] : $specialConfig['urlFormate'];
         $url = $this->specialPathReplace($thisSpecial['urlformat'], $thisSpecial['catid'], $thisSpecial);
         $special_db->update(array('url' => $url), array('id' => $siteid));
         delCache('c_special_' . $siteid);
     }
 }
Ejemplo n.º 14
0
 function _setFirstImageAsThumb($thisChannel, $contentStr, $imgNo = 1)
 {
     $thumbWidht = $thisChannel->thumbwidth;
     $thmbHeight = $thisChannel->thumbheight;
     if (!$thumbWidht || !$thmbHeight) {
         return '';
     }
     //get image url
     $contentStr = stripslashes($contentStr);
     @preg_match_all('#src="((((?!").)+).(jpg|bmp))"#i', $contentStr, $img_array);
     $img_array_urls = $img_array[1];
     if ($img_array_urls) {
         $imgNo = abs(intval($imgNo));
         $imgNo = $imgNo < 1 ? 1 : $imgNo;
         $imgUrl = $img_array_urls[$imgNo - 1];
         if (!strpos($imgUrl, 'ttp://')) {
             $imgUrl = MAIN_URL_ROOT . $imgUrl;
         }
         $time = SYS_TIME;
         $pathInfo = upFileFolders($time);
         $dstFolder = $pathInfo['path'];
         $rand = rand(0, 10000);
         $tempImgPath = ABS_PATH . 'upload' . DIRECTORY_SEPARATOR . 'temp.jpg';
         if (file_exists($tempImgPath)) {
             @unlink($tempImgPath);
         }
         @httpCopy($imgUrl, $tempImgPath);
         //new start,带水印的图片加缩略图需要裁切掉水印
         if (file_exists(ABS_PATH . 'constant' . DIRECTORY_SEPARATOR . 'watermark.config.php')) {
             @(include_once ABS_PATH . 'constant' . DIRECTORY_SEPARATOR . 'watermark.config.php');
             if (USE_WATERMARK) {
                 if (WATERMARK_TYPE != 'text') {
                     $oImgSize = getimagesize($tempImgPath);
                     //原图尺寸
                     //水印尺寸
                     $watermarkImageAttr = @getimagesize(ABS_PATH . 'editor' . DIRECTORY_SEPARATOR . 'ckfinder' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'watermark' . DIRECTORY_SEPARATOR . 'logo.png');
                     $width = $oImgSize[0];
                     $height = $oImgSize[1] - $watermarkImageAttr[1];
                     //新图高度为原图高度减水印高度
                     //
                     $firstImg = imagecreatefromjpeg($tempImgPath);
                     if (function_exists("imagecreatetruecolor")) {
                         //GD2.0.1
                         $dstScaleImg = imagecreatetruecolor($width, $height);
                     } else {
                         $dstScaleImg = imagecreate($width, $height);
                     }
                     imagecopy($dstScaleImg, $firstImg, 0, 0, 0, 0, $oImgSize[0], $oImgSize[1]);
                     //裁切
                     ImageJPEG($dstScaleImg, ABS_PATH . 'upload' . DIRECTORY_SEPARATOR . 'temp.jpg');
                     //保存图片
                     imagedestroy($dstScaleImg);
                     imagedestroy($firstImg);
                 }
             }
         }
         //new end,裁切水印end
         bpBase::loadSysClass('image');
         image::zfResize(ABS_PATH . 'upload' . DIRECTORY_SEPARATOR . 'temp.jpg', $dstFolder . $time . $rand . '.jpg', $thumbWidht, $thmbHeight, 1 | 4, 2);
         $this->_setThumb($thisChannel, ABS_PATH . 'upload' . DIRECTORY_SEPARATOR . 'temp.jpg', $dstFolder, $time . $rand, 'jpg');
         @unlink(ABS_PATH . 'upload' . DIRECTORY_SEPARATOR . 'temp.jpg');
         //
         $year = date('Y', $time);
         $month = date('m', $time);
         $day = date('d', $time);
         $url = $pathInfo['url'] . $time . $rand . '.jpg';
         //
         $location = 'http://' . $_SERVER['HTTP_HOST'] . CMS_DIR_PATH . $url;
         return $location;
     } else {
         return '';
     }
     //
 }
Ejemplo n.º 15
0
<?php

////script.php?oper=checkCode&width=70&height=25&codeNum=4&backGround=fff000&fontColor=f00000
$session_storage = getSessionStorageType();
bpBase::loadSysClass($session_storage);
$captcha = bpBase::loadSysClass('checkCode');
//width
if (isset($_GET['width']) && intval($_GET['width'])) {
    $captcha->width = intval($_GET['width']);
}
if ($captcha->width <= 0) {
    $captcha->width = 70;
}
//height
if (isset($_GET['height']) && intval($_GET['height'])) {
    $captcha->height = intval($_GET['height']);
}
if ($captcha->height <= 0) {
    $captcha->height = 25;
}
//codeNum
if (isset($_GET['codeNum']) && intval($_GET['codeNum'])) {
    $captcha->code_len = intval($_GET['codeNum']);
}
if ($captcha->codeNum > 8 || $captcha->codeNum < 2) {
    $captcha->codeNum = 4;
}
//backGround
if (isset($_GET['backGround']) && trim(urldecode($_GET['backGround'])) && preg_match('/(^[a-z0-9]{6}$)/im', trim(urldecode($_GET['backGround'])))) {
    $captcha->backGround = '#' . trim(urldecode($_GET['backGround']));
}