Esempio n. 1
0
/**
 * 系统邮件发送函数
 * @param string $to 接收邮件者邮箱
 * @param string $name 接收邮件者名称
 * @param string $subject 邮件主题
 * @param string $body 邮件内容
 * @param string $attachment 附件列表
 * @茉莉清茶 57143976@qq.com
 */
function send_mail($to = '', $subject = '', $body = '', $name = '', $attachment = null)
{
    if (is_sae()) {
        return sae_mail($to, $subject, $body, $name);
    } else {
        return send_mail_local($to, $subject, $body, $name, $attachment);
    }
}
Esempio n. 2
0
/**
 * Created by PhpStorm.
 * User: caipeichao
 * Date: 14-3-10
 * Time: PM7:40
 */
function getImageUrlByPath($path, $size)
{
    //TODO 重新开启缩略
    $thumb = getThumbImage($path, $size, $size);
    // $thumb['src']=$path;
    $thumb = $thumb['src'];
    if (!is_sae()) {
        $thumb = getRootUrl() . $thumb;
    }
    return $thumb;
}
Esempio n. 3
0
/**
 * 系统邮件发送函数
 * @param string $to 接收邮件者邮箱
 * @param string $name 接收邮件者名称
 * @param string $subject 邮件主题
 * @param string $body 邮件内容
 * @param string $attachment 附件列表
 * @茉莉清茶 57143976@qq.com
 */
function send_mail($to = '', $subject = '', $body = '', $name = '', $attachment = null)
{
    $host = C('MAIL_SMTP_HOST');
    $user = C('MAIL_SMTP_USER');
    $pass = C('MAIL_SMTP_PASS');
    if (empty($host) || empty($user) || empty($pass)) {
        return '管理员还未配置邮件信息,请联系管理员配置';
    }
    if (is_sae()) {
        return sae_mail($to, $subject, $body, $name);
    } else {
        return send_mail_local($to, $subject, $body, $name, $attachment);
    }
}
Esempio n. 4
0
/**
 * 系统邮件发送函数
 * @param string $to 接收邮件者邮箱
 * @param string $name 接收邮件者名称
 * @param string $subject 邮件主题
 * @param string $body 邮件内容
 * @param string $attachment 附件列表
 * @茉莉清茶 57143976@qq.com
 */
function send_mail($to = '', $subject = '', $body = '', $name = '', $attachment = null)
{
    $host = C('MAIL_SMTP_HOST');
    $user = C('MAIL_SMTP_USER');
    $pass = C('MAIL_SMTP_PASS');
    if (empty($host) || empty($user) || empty($pass)) {
        return L('_THE_ADMINISTRATOR_HAS_NOT_YET_CONFIGURED_THE_MESSAGE_INFORMATION_PLEASE_CONTACT_THE_ADMINISTRATOR_CONFIGURATION_');
    }
    if (is_sae()) {
        return sae_mail($to, $subject, $body, $name);
    } else {
        return send_mail_local($to, $subject, $body, $name, $attachment);
    }
}
Esempio n. 5
0
 public function complete()
 {
     //更新缓存
     define('PLATFORM', is_sae() ? 'sae' : 'default');
     define('DILICMS_SHARED_PATH', BASEPATH . '../shared/');
     $this->load->add_package_path(DILICMS_SHARED_PATH);
     $this->load->library('platform', array('type' => PLATFORM, 'storage' => 'public'));
     $this->load->library('settings');
     $this->load->helper('common');
     $this->load->database();
     $this->load->model('cache_mdl');
     $this->cache_mdl->update_model_cache();
     $this->cache_mdl->update_category_cache();
     $this->cache_mdl->update_menu_cache();
     $this->cache_mdl->update_role_cache();
     $this->cache_mdl->update_site_cache();
     $this->cache_mdl->update_backend_cache();
     $this->cache_mdl->update_plugin_cache();
     $this->cache_mdl->update_fieldtypes_cache();
     //创建安装锁定文件
     if (is_sae()) {
         $this->platform->file_write('install.lock', 'Welcome to DiliCMS!');
     } else {
         $this->platform->file_write(DILICMS_SHARED_PATH . 'settings/install.lock', 'Welcome to DiliCMS!');
     }
 }
Esempio n. 6
0
 /**
  * 将头像保存到本地
  * @param $url
  * @param $oid
  * @param $uid
  * autor:xjw129xjt
  */
 protected function saveAvatar($url, $oid, $uid, $type)
 {
     if (is_sae()) {
         $s = new \SaeStorage();
         $img = file_get_contents($url);
         //括号中的为远程图片地址
         $url_sae = $s->write(C('UPLOAD_SAE_CONFIG.domain'), '/Avatar/' . $type . 'Avatar/' . $oid . '.jpg', $img);
         $data['path'] = $url_sae;
     } else {
         mkdir('./Uploads/Avatar/' . $type . 'Avatar', 0777, true);
         $img = file_get_contents($url);
         $filename = './Uploads/Avatar/' . $type . 'Avatar/' . $oid . '.jpg';
         file_put_contents($filename, $img);
         $data['path'] = $type . 'Avatar/' . $oid . '.jpg';
     }
     $data['uid'] = $uid;
     $data['create_time'] = time();
     $data['status'] = 1;
     $data['is_temp'] = 0;
     D('avatar')->add($data);
 }
Esempio n. 7
0
 public function getAvatarPath($uid, $avatarSize)
 {
     $model = D('Addons://Avatar/Avatar');
     $avatar = $model->getAvatar($uid);
     if ($avatar) {
         if (is_sae()) {
             $avatar_path = $avatar;
         } else {
             $avatar_path = "/Uploads/Avatar/{$avatar}";
         }
         return getImageUrlByPath($avatar_path, $avatarSize);
     } else {
         //如果没有头像,返回默认头像
         if ($avatarSize != 0) {
             return getRootUrl() . "Addons/Avatar/default_" . $avatarSize . "_" . $avatarSize . ".png";
         } else {
             return getRootUrl() . "Addons/Avatar/default.png";
         }
     }
 }
Esempio n. 8
0
function fixAttachUrl($url)
{
    if (!is_sae()) {
        return getRootUrl() . substr($url, 1);
    } else {
        return $url;
    }
}
Esempio n. 9
0
File: thumb.php Progetto: yaomoo/bbs
function fixAttachUrl($url)
{
    if (!is_sae()) {
        return str_replace('//', '/', getRootUrl() . substr($url, 1));
        //防止双斜杠的出现
    } else {
        return $url;
    }
}
Esempio n. 10
0
<blockquote>
  <p>DiliCMS 目前支持普通环境以及SAE(新浪云平台).</p>
</blockquote>
<?php 
if (!is_sae()) {
    ?>
    <div class="alert">
        当前运行环境为: <strong>普通环境</strong> 
    </div>
    <?php 
    if (!$is_config_ok) {
        ?>
    <div class="alert alert-error">
        shared/config/platform.php <strong>未正确配置</strong>,请先正确配置shared/config/platform.php。<br />
        shared/config/platform.php必须可读且type的值必须为default.
    </div>
    <?php 
    } else {
        ?>
    <div class="alert">
        shared/config/platform.php <strong>配置正确</strong>
    </div>
    <?php 
    }
} else {
    ?>
    <div class="alert">
        当前运行环境为: <strong>SAE</strong>, 需要开启以下环境: 
        <ul>
            <li>Memcache</li>
            <li>MySQL</li>
Esempio n. 11
0
 /**
  * saveAvatar  保存头像到本地
  * @param $url
  * @param $oid
  * @param $uid
  * @param $type
  * @author:xjw129xjt(肖骏涛) xjt@ourstu.com
  */
 private function saveAvatar($url, $uid)
 {
     if (is_sae()) {
         // todo 兼容sae
     } else {
         mkdir('./Uploads/Avatar/' . $uid, 0777, true);
         $img = file_get_contents($url);
         $filename = './Uploads/Avatar/' . $uid . '/crop.jpg';
         file_put_contents($filename, $img);
         $data['path'] = '/' . $uid . '/crop.jpg';
     }
     $data['uid'] = $uid;
     $data['create_time'] = time();
     $data['status'] = 1;
     $data['is_temp'] = 0;
     D('avatar')->add($data);
 }
Esempio n. 12
0
 function is_installed()
 {
     if (is_sae()) {
         $s = new SaeStorage();
         return $s->fileExists('public', 'install.lock');
     } else {
         return @file_exists(BASEPATH . '../shared/settings/install.lock');
     }
 }