Esempio n. 1
0
 function initMemberHandler()
 {
     $this->MemberHandler = jclass('member');
     $member = $this->MemberHandler->init();
     Obj::register("MemberHandler", $this->MemberHandler);
     return $member;
 }
Esempio n. 2
0
 function MasterObject(&$config)
 {
     if (!$config['widget_enable']) {
         $msg = 'Widget功能没有启用';
         if (get_param('in_ajax')) {
             widget_error($msg);
         } else {
             exit($msg);
         }
     }
     $this->Config = $config;
     $this->Get =& $_GET;
     $this->Post =& $_POST;
     $this->Module = get_param('mod');
     $this->Code = get_param('code');
     $this->DatabaseHandler =& Obj::registry('DatabaseHandler');
     $this->MemberHandler = jclass('member');
     $this->MemberHandler->init();
     if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) {
         widget_error($this->MemberHandler->GetError(), 203);
     }
     Obj::register("MemberHandler", $this->MemberHandler);
     define("FORMHASH", substr(md5(substr(time(), 0, -4) . $this->Config['auth_key']), 0, 16));
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         if ($this->Post["FORMHASH"] != FORMHASH) {
         }
     }
 }
Esempio n. 3
0
 function MasterObject(&$config, $auto_run = false)
 {
     if (!$config['wap']) {
         include ROOT_PATH . 'wap/include/error_wap.php';
         exit;
     }
     $this->Config = $config;
     require_once ROOT_PATH . 'wap/include/func/wap_global.func.php';
     $this->Get =& $_GET;
     $this->Post =& $_POST;
     $this->Module = get_param('mod');
     $this->Code = get_param('code');
     $this->DatabaseHandler =& Obj::registry('DatabaseHandler');
     $this->MemberHandler = jclass('member');
     $this->MemberHandler->init();
     if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) {
         $member_error = $this->MemberHandler->GetError();
         $member_error = array_iconv($this->Config['charset'], 'utf-8', $member_error);
         $this->Messager($member_error, null);
     }
     if (!in_array($this->Module, array('member', 'login', 'other'))) {
         $visit_rets = $this->MemberHandler->visit();
         if ($visit_rets['error']) {
             $this->Messager(null, 'index.php?mod=login&referer=' . urlencode('index.php?' . $_SERVER['QUERY_STRING']));
         }
     }
     $this->Title = $this->MemberHandler->CurrentAction['name'];
     Obj::register("MemberHandler", $this->MemberHandler);
     if ($this->auto_run || $auto_run) {
         $this->auto_run();
     }
 }
Esempio n. 4
0
function _send_mail($to, $subject, $message, $nickname = '', $email = '', $attachments = array(), $priority = 3, $html = true, $smtp_config = array())
{
    $sys_config = jconf::get();
    if (!($nickname && $email)) {
        $nickname = $sys_config['site_name'];
        $email = $sys_config['site_admin_email'];
    }
    $smtp_config = $smtp_config ? $smtp_config : jconf::get('smtp');
    if ($smtp_config['enable'] && is_array($smtp_config['smtp']) && count($smtp_config['smtp'])) {
        $k = array_rand($smtp_config['smtp']);
        $smtp = $smtp_config['smtp'][$k];
        if (is_array($smtp) && count($smtp)) {
            if ($nickname && $email) {
                $smtp['email_from'] = "{$nickname} <{$email}>";
            }
            return _send_mail_by_smtp($to, $subject, $message, $smtp, $html);
        } else {
            jlog('SMTP', '$smtp is empty', 0);
        }
    } else {
        $charset = $sys_config['charset'];
        $jishigou_mail = jclass('jishigou/mail');
        if (is_array($attachments) and count($attachments) >= 1) {
            $boundary = "----_NextPart_" . md5(uniqid(time())) . "_000";
            $jishigou_mail->SetHeader('Content-Type: multipart/mixed;boundary="' . $boundary . '"');
            $body = "--" . $boundary . "" . NEW_LINE . "";
            $body .= "Content-Type: text/" . ($html ? 'html' : 'plain') . "; charset=\"" . $sys_config['charset'] . "\"" . NEW_LINE . "";
            $body .= "Content-Transfer-Encoding: base64" . NEW_LINE . "" . NEW_LINE . "";
            $body .= chunk_split(base64_encode($message)) . "" . NEW_LINE . "";
            foreach ($attachments as $attachment) {
                $body .= "--" . $boundary . "" . NEW_LINE . "";
                $body .= "Content-Type: application/octet-stream;" . NEW_LINE . "\t\tname=\"{$attachment['name']}\"" . NEW_LINE . "";
                $body .= "Content-Transfer-Encoding: base64" . NEW_LINE . "";
                $body .= "Content-Disposition: attachment;" . NEW_LINE . "\t\tFileName=\"{$attachment['name']}\"" . NEW_LINE . "" . NEW_LINE . "";
                $body .= chunk_split(base64_encode(file_get_contents($attachment['path']))) . "" . NEW_LINE . "";
            }
            $message = $body;
        } else {
            $jishigou_mail->SetHeader('Content-Type: text/' . ($html ? 'html' : 'plain') . '; charset=' . $sys_config['charset']);
            $jishigou_mail->SetHeader('Content-Transfer-Encoding: base64');
            $message = chunk_split(base64_encode(str_replace("\r\n.", " \r\n..", str_replace("\n", "\r\n", str_replace("\r", "\n", str_replace("\r\n", "\n", str_replace("\n\r", "\r", $message)))))));
        }
        $subject = '=?' . $charset . '?B?' . base64_encode(str_replace("\r", '', str_replace("\n", '', $subject))) . '?=';
        $nickname = '=?' . $charset . '?B?' . base64_encode($nickname) . "?=";
        $jishigou_mail->SetSenderName($nickname);
        $jishigou_mail->SetSenderMail($email);
        $jishigou_mail->SetSendMailFrom($email);
        $jishigou_mail->SetUseHtml($html);
        $jishigou_mail->SetHeader("Return-Path: {$email}");
        $jishigou_mail->SetHeader("MIME-Version: 1.0");
        $jishigou_mail->SetHeader("X-Priority: {$priority}");
        $jishigou_mail->SetHeader("Sender: {$email}");
        $jishigou_mail->SetRecipient($to);
        $jishigou_mail->SetSubject($subject);
        $jishigou_mail->SetMessage($message);
        return $jishigou_mail->doSend();
    }
}
Esempio n. 5
0
 function cache_db()
 {
     global $_J;
     $this->num = max(16, (int) $_J['config']['cache_table_num']);
     $this->prefix = 'cache_db_';
     if ($_J['config']['memory_enable'] && $_J['config']['cache_db_to_memory']) {
         $this->memory = jclass('memory');
     }
 }
Esempio n. 6
0
 function DoSave()
 {
     $msg = array('1' => "修改成功。", '0' => "修改失败!", '-1' => "您的系统<font color='red'>不支持</font>该功能,请检查您服务器是否安装和配置了<font color='red'>php_ldap.dll</font>模块!", '-2' => "<font color='red'>无法连接域服务器</font>,请检查您填写的服务器地址或端口是否正确!", '-3' => "您没有填写<font color='red'>AD域服务器地址</font>,请返回重新填写!", '-4' => "您没有填写<font color='red'>您的域帐号或填写错误</font>,请返回重新填写!");
     $return = 0;
     if (@is_file(ROOT_PATH . 'include/class/ldap.class.php')) {
         $return = jclass('ldap')->adsave($this->Post['ldap_email'], $this->Post['ldap_enable'], $this->Post['ldap_host'], $this->Post['ldap_port']);
     }
     $this->Messager($msg[$return], '', 5);
 }
Esempio n. 7
0
 function member()
 {
     $nickname = $this->Post['nickname'];
     $username = $this->Post['username'];
     $password = $this->Post['password'];
     $email = $this->Post['email'];
     $row1 = DB::fetch_first("select `uid`, `username`, `nickname` from " . DB::table('members') . " where `username`='{$username}' limit 1");
     if (!$row1) {
         if ($email = '') {
             $email = $username . "@b56.cn";
         }
         jclass('passport')->register2($nickname, $password, $email, $username);
     }
 }
Esempio n. 8
0
function kaixin_oauth($access_token = null, $refresh_token = null)
{
    $kaixin_oauth = null;
    $sys_config = kaixin_enable();
    if ($sys_config) {
        $client_id = $sys_config['kaixin']['client_id'];
        $client_secret = $sys_config['kaixin']['client_secret'];
        $kaixin_oauth = jclass('jishigou_oauth2_client');
        $kaixin_oauth->init($client_id, $client_secret, $access_token, $refresh_token);
        $kaixin_oauth->host = 'https:/' . '/api.kaixin001.com/';
        $kaixin_oauth->access_token_url = 'https:/' . '/api.kaixin001.com/oauth2/access_token';
        $kaixin_oauth->authorize_url = 'https:/' . '/api.kaixin001.com/oauth2/authorize';
    }
    return $kaixin_oauth;
}
Esempio n. 9
0
function renren_oauth($access_token = null, $refresh_token = null)
{
    $renren_oauth = null;
    $sys_config = renren_enable();
    if ($sys_config) {
        $client_id = $sys_config['renren']['client_id'];
        $client_secret = $sys_config['renren']['client_secret'];
        $renren_oauth = jclass('jishigou_oauth2_client');
        $renren_oauth->init($client_id, $client_secret, $access_token, $refresh_token);
        $renren_oauth->host = 'https:/' . '/graph.renren.com/';
        $renren_oauth->access_token_url = 'https:/' . '/graph.renren.com/oauth/token';
        $renren_oauth->authorize_url = 'https:/' . '/graph.renren.com/oauth/authorize';
    }
    return $renren_oauth;
}
Esempio n. 10
0
function qqwb_bind_info($uid = 0)
{
    $ret = array();
    $uid = max(0, (int) ($uid ? $uid : MEMBER_ID));
    if ($uid > 0) {
        if (false === ($ret = jclass('misc')->account_bind_info($uid, 'qqwb'))) {
            $ret = DB::fetch_first("select * from " . TABLE_PREFIX . "qqwb_bind_info where `uid`='{$uid}'");
            jclass('misc')->update_account_bind_info($uid, 'qqwb', $ret);
        }
    }
    if (false === $ret[0]) {
        return array();
    } else {
        return $ret;
    }
}
Esempio n. 11
0
 function cache_file()
 {
     global $_J;
     $this->prefix = 'cache_file_';
     if (defined('TEMPLATE_ROOT_PATH')) {
         $root_path = TEMPLATE_ROOT_PATH;
         $this->prefix .= basename(TEMPLATE_ROOT_PATH) . '_';
     } else {
         $root_path = ROOT_PATH;
     }
     $this->path = $root_path . 'data/cache/cache_file/';
     if ($_J['config']['memory_enable'] && $_J['config']['cache_file_to_memory']) {
         $this->memory = jclass('memory');
     }
     if (!$this->memory) {
         $this->io = jio();
     }
 }
Esempio n. 12
0
 function Thumb($source, $target, $thumbwidth, $thumbheight, $thumbtype = 1, $nosuffix = 0)
 {
     $return = $this->init('thumb', $source, $target, $nosuffix);
     if ($return <= 0) {
         return $this->returncode($return);
     }
     if ($this->imginfo['animated']) {
         jclass('jishigou/io')->CopyFile($source, $target);
     }
     $this->param['thumbwidth'] = $thumbwidth;
     $this->param['thumbheight'] = $thumbheight;
     $this->param['thumbtype'] = $thumbtype;
     if ($thumbwidth < 100 && $thumbheight < 100) {
         $this->param['thumbquality'] = 100;
     }
     $return = !$this->libmethod ? $this->Thumb_GD() : $this->Thumb_IM();
     $return = !$nosuffix ? $return : 0;
     return $this->sleep($return);
 }
Esempio n. 13
0
 function init($config = array())
 {
     $this->config = $config ? $config : jconf::get('memory');
     $this->prefix = empty($config['prefix']) ? substr(md5(getenv('HTTP_HOST') ? getenv('HTTP_HOST') : $_SERVER['HTTP_HOST']), -6) . '_' : $config['prefix'];
     foreach ($this->extension as $type => $enable) {
         $_conf = $this->config[$type];
         if ($enable && $_conf['enable'] && !is_object($this->memory)) {
             $this->memory = jclass("memory/{$type}");
             $_enable = $this->memory->init($_conf);
             if (!$_enable) {
                 $this->memory = null;
             } else {
                 $this->type = $type;
                 $this->enable = true;
                 break;
             }
         }
     }
 }
Esempio n. 14
0
 public function do_modify()
 {
     $data = jget('data');
     $catid = (int) jget('catid');
     if ($data['name']) {
         $data['catname'] = $data['name'];
     } else {
         $this->Messager('名字必须填写');
         return;
     }
     if ($data['template'] && !preg_match("/^[a-z]+[a-z0-9_]*[a-z0-9]+\$/i", $data['template'])) {
         $this->Messager("模板文件名称不合法");
     }
     if ($data['template'] && !jclass('jishigou/template')->exists('cms/' . $data['template'])) {
         $this->Messager("模板文件 cms/" . $data['template'] . ".html 不存在");
     }
     $data['parentid'] = $data['parent_id'];
     unset($data['parent_id']);
     $data['managename'] = explode('|', $data['managename']);
     $r = jlogic('cms')->modify_category($data, $catid);
     if ($r) {
         $this->Messager('成功!', 'admin.php?mod=cms');
     } else {
         $this->Messager('失败!');
     }
 }
Esempio n. 15
0
 function authCallBack()
 {
     if (!XWB_plugin::pCfg('is_account_binding')) {
         XWB_plugin::showError('新浪微博绑定功能已经关闭!');
     }
     //--------------------------------------------------------------------
     $sess = XWB_plugin::getUser();
     $waiting_site_bind = $sess->getInfo('waiting_site_bind');
     if (empty($waiting_site_bind)) {
         //XWB_plugin::deny();
         $siteUrl = XWB_plugin::siteUrl(0);
         XWB_plugin::redirect($siteUrl, 3);
     }
     //--------------------------------------------------------------------
     $wbApi = XWB_plugin::getWB();
     $db = XWB_plugin::getDB();
     $last_key = $wbApi->getAccessToken(XWB_plugin::V('r:oauth_verifier'));
     $sess->setOAuthKey(array(), true);
     //		print_r($last_key);
     if (!isset($last_key['oauth_token']) || !isset($last_key['oauth_token_secret'])) {
         $api_error_origin = isset($last_key['error']) ? $last_key['error'] : 'UNKNOWN ERROR. MAYBE SERVER CAN NOT CONNECT TO SINA API SERVER';
         $api_error = isset($last_key['error_CN']) && !empty($last_key['error_CN']) && 'null' != $last_key['error_CN'] ? $last_key['error_CN'] : '';
         XWB_plugin::LOG("[WEIBO CLASS]\t[ERROR]\t#{$wbApi->req_error_count}\t{$api_error}\t{$wbApi->last_req_url}\tERROR ARRAY:\r\n" . print_r($last_key, 1));
         XWB_plugin::showError("服务器获取Access Token失败;请稍候再试。<br />错误原因:{$api_error}[{$api_error_origin}]");
     }
     $sess->setOAuthKey($last_key, true);
     $wbApi->setConfig();
     $uInfo = $wbApi->verifyCredentials();
     $sess->setInfo('sina_uid', $uInfo['id']);
     $sess->setInfo('sina_name', $uInfo['screen_name']);
     //print_r($uInfo);
     //--------------------------------------------------------------------
     /// 此帐号是否已经在当前站点中绑定
     $sinaHasBinded = false;
     if (defined('XWB_S_UID') && XWB_S_UID > 0) {
         $bInfo = $db->fetch_first("SELECT * FROM " . XWB_S_TBPRE . "xwb_bind_info WHERE sina_uid='" . $uInfo['id'] . "' OR uid='" . XWB_S_UID . "'");
     } else {
         $bInfo = $db->fetch_first("SELECT * FROM " . XWB_S_TBPRE . "xwb_bind_info WHERE sina_uid='" . $uInfo['id'] . "'");
     }
     if (!empty($bInfo) && is_array($bInfo)) {
         $sinaHasBinded = true;
         //核查存储的access token是否有更新,有更新则进行自动更新
         if ($bInfo['token'] != $last_key['oauth_token'] || $bInfo['tsecret'] != $last_key['oauth_token_secret']) {
             $db->query("UPDATE " . XWB_S_TBPRE . "xwb_bind_info SET token='" . (string) $last_key['oauth_token'] . "', tsecret='" . (string) $last_key['oauth_token_secret'] . "' WHERE sina_uid='" . $uInfo['id'] . "'");
         }
     }
     //--------------------------------------------------------------------
     /// 决定在首页中显示什么浮层
     $tipsType = '';
     //xwb_tips_type
     //已在论坛登录
     if (defined('XWB_S_UID') && XWB_S_UID) {
         if ($sinaHasBinded) {
             $tipsType = 'hasBinded';
             $sess->clearToken();
         } else {
             $inData = array();
             $inData['uid'] = XWB_S_UID;
             $inData['sina_uid'] = $uInfo['id'];
             $inData['token'] = $last_key['oauth_token'];
             $inData['tsecret'] = $last_key['oauth_token_secret'];
             $inData['profile'] = '[]';
             $sqlF = array();
             $sqlV = array();
             foreach ($inData as $k => $v) {
                 $sqlF[] = "`" . $k . "`";
                 $sqlV[] = "'" . mysql_real_escape_string($v) . "'";
             }
             $sql = "REPLACE INTO " . XWB_S_TBPRE . "xwb_bind_info  (" . implode(",", $sqlF) . ") VALUES (" . implode(",", $sqlV) . ") ;";
             $rst = $db->query($sql, 'UNBUFFERED');
             jclass('misc')->update_account_bind_info(XWB_S_UID, '', '', 1);
             if (!$rst) {
                 echo "DB ERROR";
                 exit;
                 return false;
             }
             $tipsType = 'bind';
             //正向绑定统计上报
             $sess->appendStat('bind', array('uid' => $uInfo['id'], 'type' => 1));
         }
     } else {
         //从 wb 登录后 检查用户是否绑定,如果绑定了 则在附属站点自
         if ($sinaHasBinded) {
             require_once XWB_P_ROOT . '/lib/xwbSite.inc.php';
             $result = xwb_setSiteUserLogin((int) $bInfo['uid']);
             if (!$result) {
                 $db->query("DELETE FROM " . XWB_S_TBPRE . "xwb_bind_info WHERE sina_uid='" . $uInfo['id'] . "'");
                 $tipsType = 'siteuserNotExist';
             } else {
                 $tipsType = 'autoLogin';
             }
         } else {
             //已登录WB,没有附属站点的帐号 引导注册
             $sess->setInfo('waiting_site_reg', '1');
             $tipsType = 'reg';
         }
     }
     //--------------------------------------------------------------------
     //bind的页面需要跳转,故需要使用cookies记录
     if ($tipsType == 'bind') {
         setcookie('xwb_tips_type', $tipsType, 0);
     }
     //$sess->setInfo('xwb_tips_type', $tipsType);
     $sess->setInfo('waiting_site_bind', 0);
     //使用sina微博帐号登录成功(不管是否绑定)统计上报
     $sess->appendStat('login', array('uid' => $uInfo['id']));
     //所有跟站点相关的对接,必须放到_showBinging
     $this->_showBinging($tipsType);
 }
Esempio n. 16
0
 function attachs_list($num = 10, $where = '')
 {
     $total_attach = DB::result_first("SELECT count(*) FROM " . DB::table('topic_attach') . " WHERE tid>0 {$where}");
     $page_arr = page($total_attach, $num, 'index.php?mod=attach', array('return' => 'array'));
     $limit_sql = $page_arr['limit'];
     $attachs = array();
     $query = DB::query("SELECT * FROM " . DB::table('topic_attach') . " WHERE tid>0 {$where} ORDER BY id DESC {$limit_sql}");
     $candown = jclass('member')->HasPermission('uploadattach', 'down');
     $canviewtype = array('doc', 'ppt', 'pdf', 'xls', 'txt', 'docx', 'xlsx', 'pptx');
     while ($value = DB::fetch($query)) {
         $value['manage'] = jallow($value[uid]) ? true : false;
         $value['filesize'] = $value['filesize'] > 1024 * 1024 ? round($value['filesize'] / (1024 * 1024), 2) . 'MB' : ($value['filesize'] == 0 ? '未知' : round($value['filesize'] / 1024, 1) . 'KB');
         $value['dateline'] = my_date_format2($value['dateline']);
         $value['img'] = 'images/filetype/' . $value['filetype'] . '.gif';
         $value['url'] = ($value['site_url'] ? $value['site_url'] : $GLOBALS['_J']['site_url']) . '/' . str_replace('./', '', $value['file']);
         $value['onlineview'] = $candown && in_array($value['filetype'], $canviewtype) && $value['score'] == 0 ? $value['url'] : '';
         $attachs[$value['id']] = $value;
     }
     $return = array('list' => $attachs);
     $return['page'] = $page_arr ? $page_arr : $pagenum;
     return $return;
 }
Esempio n. 17
0
 function Seccode()
 {
     $seccode = mkseccode();
     jsg_setcookie('seccode', authcode($seccode, 'ENCODE'));
     $s = jclass('jishigou/seccode');
     $s->code = $seccode;
     $s->datapath = ROOT_PATH . "images/seccode/";
     $s->display();
     exit;
 }
 /**
  * 设置发帖同步
  */
 function bindTopic()
 {
     if (XWB_S_UID < 1 || !XWB_plugin::pCfg('is_account_binding')) {
         XWB_plugin::showError('新浪微博绑定功能已经关闭!');
     }
     $setting = XWB_plugin::V('p:setting');
     $tojishigou = XWB_plugin::V('p:tojishigou');
     $reply_tojishigou = XWB_plugin::V('p:reply_tojishigou');
     $profile = XWB_plugin::O('xwbUserProfile');
     $profile->set(array('bind_setting' => (int) $setting, 'synctopic_tojishigou' => (int) $tojishigou, 'syncreply_tojishigou' => (int) $reply_tojishigou));
     //XWB_plugin::redirect('xwbSiteInterface.bind',2);
     jclass('misc')->update_account_bind_info(XWB_S_UID, '', '', 1);
     echo '<script>parent.tips();</script>';
 }
Esempio n. 19
0
 function checkFollow($uid)
 {
     if ($uid == MEMBER_ID) {
         return 401;
     } else {
         $member = $this->TopicLogic->GetMember($uid);
         if (empty($member)) {
             return 300;
         }
     }
     $isBlackList = $this->check($uid);
     if ($isBlackList) {
         return -1;
     }
     if (($follow_info = jclass('buddy_follow')->row(MEMBER_ID, $uid)) && ($fans_info = jclass('buddy_follow')->row($uid, MEMBER_ID))) {
         return 2;
     } else {
         if ($follow_info) {
             return 1;
         }
     }
     return 0;
 }
Esempio n. 20
0
 * This is NOT a freeware, use is subject to license terms
 *
 * @copyright Copyright (C) 2005 - 2099 Cenwor Inc.
 * @license http://www.cenwor.com
 * @link http://www.jishigou.net
 * @author 狐狸<*****@*****.**>
 * @version $Id: rewrite.php 3831 2013-06-07 08:18:28Z wuliyong $
 */
if (!defined('IN_JISHIGOU')) {
    exit('invalid request');
}
$_rewrite = jconf::get('rewrite');
if ($_rewrite['mode']) {
    global $jishigou_rewrite;
    if (is_null($jishigou_rewrite)) {
        $jishigou_rewrite = jclass('jishigou/rewrite');
        if ($_rewrite['abs_path']) {
            $jishigou_rewrite->absPath = $_rewrite['abs_path'];
        }
        if ($_rewrite['gateway']) {
            $jishigou_rewrite->gateway = $_rewrite['gateway'];
        }
        if ($_rewrite['extention']) {
            $jishigou_rewrite->extention = $_rewrite['extention'];
        }
        if ($_rewrite['arg_separator']) {
            $jishigou_rewrite->argSeparator = $_rewrite['arg_separator'];
        }
        if ($_rewrite['var_separator']) {
            $jishigou_rewrite->varSeparator = $_rewrite['var_separator'];
        }
Esempio n. 21
0
 function Register()
 {
     if (MEMBER_ID > 0 && false == $this->IsAdmin) {
         $this->Messager('您已经是注册用户,无需再注册!', -1);
     }
     $regstatus = jsg_member_register_check_status();
     if ($regstatus['error']) {
         $this->Messager($regstatus['error'], null);
     }
     $inviter_member = array();
     $action = "index.php?mod=member&code=doregister";
     $check_result = jsg_member_register_check_invite($this->Code);
     if ($regstatus['invite_enable'] && !$regstatus['normal_enable']) {
         if (!$this->Code) {
             $this->Messager("本站目前需要有邀请链接才能注册。" . jsg_member_third_party_reg_msg(), null);
         }
         if (!$check_result) {
             $this->Messager("对不起,您访问的邀请链接不正确或者因邀请数已满而失效,请重新与邀请人索取链接。", null);
         }
     }
     if ($check_result['uid'] > 0) {
         $inviter_member = jsg_member_info($check_result['uid']);
     }
     $action .= "&invite_code=" . urlencode($this->Code);
     $referer = jget('referer');
     if (jsg_getcookie('referer') == '') {
         jsg_setcookie('referer', $referer);
     }
     $noemail = 0;
     if ($this->_sms_register()) {
         $noemail = jconf::get('sms', 'register_verify', 'noemail');
     }
     $email = '';
     $_email = get_param('email');
     if (false != jclass('passport')->_is_email($_email)) {
         $email = $_email;
     }
     $this->Title = "注册新用户";
     include template('register/register_member');
 }
Esempio n. 22
0
 function DoModifyQQWB()
 {
     $check_result = $this->_qqwbCheckEnv();
     if ($check_result) {
         jconf::update('qqwb_enable', 0);
         $this->Messager($check_result, null);
     }
     $qqwb_default = jconf::get('qqwb');
     $qqwb = $_POST['qqwb'];
     $qqwb['enable'] = $qqwb['enable'] ? 1 : 0;
     if (!preg_match('~^[a-z0-9]+$~i', $qqwb['app_key'] . $qqwb['app_secret'])) {
         $this->Messager("请填写正确的 APP KEY 和 APP SECRET", null);
     }
     if ($qqwb['enable'] != $this->Config['qqwb_enable']) {
         jconf::update('qqwb_enable', $qqwb['enable']);
     }
     if ($qqwb != $qqwb_default) {
         jconf::set('qqwb', $qqwb);
         if ($qqwb['enable'] && $qqwb['app_key'] != $qqwb_default['app_key']) {
             DB::query('TRUNCATE TABLE ' . DB::table('qqwb_bind_info'));
             jclass('misc')->update_account_bind_info(0, '', '', 1);
         }
     }
     $this->Messager("配置修改成功");
 }
Esempio n. 23
0
 function Modify_User_Signature()
 {
     $uid = (int) $this->Post['uid'];
     if ($uid < 1) {
         showjsmessage("请先登录或者注册一个帐号");
     }
     if (jdisallow($uid)) {
         json_error("您无权修改此用户签名");
     }
     $rets = jclass('misc')->sign_modify($uid, $this->Post['signature']);
     if (is_array($rets) && $rets['error']) {
         json_error($rets['msg']);
     } else {
         json_result($rets);
     }
 }
Esempio n. 24
0
 function MasterObject(&$config)
 {
     require_once ROOT_PATH . 'mobile/include/func/mobile.func.php';
     $config['client_type'] = '';
     $user_agent = $_SERVER['HTTP_USER_AGENT'];
     if (empty($user_agent)) {
         exit('Access Denied');
     }
     $pc_browser = false;
     if (preg_match("/android/i", $user_agent)) {
         $config['client_type'] = "android";
     } else {
         if (preg_match("/iphone/i", $user_agent)) {
             $config['client_type'] = "iphone";
         } else {
             $pc_browser = true;
         }
     }
     $config['is_mobile_client'] = false;
     if (isset($_GET['JSG_SESSION']) && isset($_GET['iv']) && isset($_GET['app_key']) && isset($_GET['app_secret']) && isset($_GET['bt'])) {
         $config['is_mobile_client'] = true;
         define("IS_MOBILE_CLIENT", true);
     }
     define("CLIENT_TYPE", $config['client_type']);
     $config['sys_version'] = sys_version();
     $config['sys_published'] = SYS_PUBLISHED;
     if (!$config['mobile_url']) {
         $config['mobile_url'] = $config['site_url'] . "/mobile";
     }
     if (!$config['topic_length']) {
         $config['topic_length'] = 140;
     }
     $this->Config = $config;
     $this->Config = array_merge($this->Config, Mobile::config());
     define("CHARSET", $this->Config['charset']);
     Obj::register('config', $this->Config);
     $this->Get =& $_GET;
     $this->Post =& $_POST;
     $this->Module = trim($this->Post['mod'] ? $this->Post['mod'] : $this->Get['mod']);
     $this->Code = trim($this->Post['code'] ? $this->Post['code'] : $this->Get['code']);
     $this->DatabaseHandler =& Obj::registry('DatabaseHandler');
     $uid = 0;
     $password = '';
     $authcode = '';
     $implicit_pass = true;
     if (!empty($this->Get['JSG_SESSION']) && $config['is_mobile_client']) {
         $authcode = $this->Get['JSG_SESSION'];
         $authcode = rawurldecode($authcode);
         $implicit_pass = false;
     } else {
         $authcode = jsg_getcookie('auth');
     }
     if (!empty($authcode)) {
         list($password, $uid) = explode("\t", authcode($authcode, 'DECODE'));
     }
     $this->MemberHandler = jclass('member');
     $MemberFields = $this->MemberHandler->FetchMember($uid, $password);
     if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) {
         Mobile::show_message(411);
         exit;
     }
     if (!in_array($this->Module, array('member', 'login', 'wechat'))) {
         $visit_rets = $this->MemberHandler->visit();
         if ($visit_rets['error']) {
             Mobile::show_message(411);
             exit;
         }
     }
     $this->Title = $this->MemberHandler->CurrentAction['name'];
     Obj::register("MemberHandler", $this->MemberHandler);
     $rets = jsg_member_login_extract();
     if ($rets) {
         if (MEMBER_ID < 1) {
             $func = $rets['login_direct'];
         } else {
             $func = $rets['logout_direct'];
         }
         if ($func && function_exists($func)) {
             $ret = $func();
         }
     }
     if (MEMBER_ID > 0) {
         jsg_member_login_set_status($MemberFields);
     }
     if ($this->Config['extcredits_enable']) {
         if (MEMBER_ID > 0 && jsg_getcookie('login_credits') + 3600 < time()) {
             update_credits_by_action('login', MEMBER_ID);
             jsg_setcookie('login_credits', time(), 3600);
         }
     }
 }
Esempio n. 25
0
 function Download()
 {
     global $_J;
     $attach_config = jconf::get('attach');
     $uid = MEMBER_ID;
     if ($uid < 1) {
         $this->Messager("请先<a href='index.php?mod=login'>点此登录</a>或者<a href='index.php?mod=member'>点此注册</a>一个帐号", 'index.php?mod=login');
     }
     $candown = jclass('member')->HasPermission('uploadattach', 'down');
     if (!$candown) {
         $this->Messager("您没有下载附件的权限", null);
     }
     $readmod = 2;
     $downfile = get_param('downfile');
     if (!$downfile) {
         $this->Messager("您的下载链接地址错误", null);
     }
     @(list($dasize, $daid, $datime, $dadown) = explode('|', base64_decode($downfile)));
     $daid = (int) $daid;
     if ($daid <= 0) {
         $this->Messager("您的下载链接地址错误", null);
     }
     $down_attach_file = $this->AttachLogic->get_down_info($daid);
     if (empty($down_attach_file)) {
         $this->Messager("您的下载链接地址错误", null);
     }
     if ($dadown != $down_attach_file['download']) {
         defined('NEDU_MOYO') || $this->Messager("您的下载链接地址已经过期或失效!或您使用的是<font class='R'>360浏览器</font>,因其系统缺陷,请更换其它浏览器进行下载!", null);
     }
     $MIMETypes = array('doc' => 'application/msword', 'ppt' => 'application/vnd.ms-powerpoint', 'pdf' => 'application/pdf', 'xls' => 'application/vnd.ms-excel', 'txt' => 'text/plain', 'rar' => 'application/octet-stream', 'zip' => 'application/zip', 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation');
     $de_attach_file_type = explode('|', $this->Config['attach_file_type']);
     foreach ($de_attach_file_type as $val) {
         if (!isset($MIMETypes[$val])) {
             $MIMETypes[$val] = 'application/octet-stream';
         }
     }
     if (!isset($MIMETypes[$down_attach_file['filetype']])) {
         $this->Messager("您只能下载(" . strtoupper(str_replace('|', ',', $this->Config['attach_file_type'])) . ")类型的文件", null);
     }
     if (!$down_attach_file['file'] || empty($down_attach_file['site_url']) && !(file_exists($down_attach_file['file']) && is_readable($down_attach_file['file']))) {
         $this->Messager("在服务器上找不到您要下载的文件,或文件不可读,或被删除,或数据错误,请联系网站管理员", null);
     }
     $auid = $down_attach_file['uid'];
     $score = $down_attach_file['score'];
     $this->AttachLogic->mod_download_num($daid);
     if ($score > 0) {
         if (!in_array($_J['member']['role_id'], explode(',', $attach_config['no_score_user']))) {
             update_credits_by_action('attach_down', $uid, 1, -$score);
         }
         if ($auid != $uid) {
             update_credits_by_action('down_my_attach', $auid, 1, $score);
         }
     }
     if ($down_attach_file['site_url']) {
         $ftptype = getftptype($down_attach_file['site_url']);
         if ($ftptype == 'Aliyun') {
             $ftpkey = getftpkey($down_attach_file['site_url']);
             $ftps = jconf::get('ftp');
             if ($ftps[$ftpkey]['type'] == 'Aliyun') {
                 define('ALI_LOG', FALSE);
                 define('ALI_DISPLAY_LOG', FALSE);
                 define('ALI_LANG', 'zh');
                 define('OSS_ACCESS_ID', $ftps[$ftpkey]['username']);
                 define('OSS_ACCESS_KEY', $ftps[$ftpkey]['password']);
                 define('OSS_BUCKET', $ftps[$ftpkey]['attachdir']);
                 define('OSS_HOST_NAME', $ftps[$ftpkey]['host']);
                 define('OSS_HOST_PORT', $ftps[$ftpkey]['port']);
                 define('OSS_SIGN_TIMEOUT', $ftps[$ftpkey]['timeout']);
                 define('OSS_ENABLED', $ftps[$ftpkey]['on']);
                 $oss = jclass('jishigou/oss');
                 $file = str_replace('./', '', $down_attach_file['file']);
                 $filename = urlencode(array_iconv($this->Config['charset'], 'UTF-8', $down_attach_file['name']));
                 $res = $oss->sign_url($file . '?response-content-disposition=attachment; filename=' . $filename, str_replace('http:/' . '/', '', $down_attach_file['site_url']));
                 $res = str_replace("?OSSAccessKeyId", "&OSSAccessKeyId", $res);
                 $res = str_replace("%3F", "?", $res);
                 $res = str_replace("disposition%3Dattachment", "disposition=attachment", $res);
                 header('location:' . $res);
             }
         } else {
             $fileurl = $down_attach_file['site_url'] . '/' . str_replace('./', '', $down_attach_file['file']);
             $this->Messager("文件存储在外部地址或FTP空间,正在跳转,请稍侯......", $fileurl);
         }
     } else {
         $fileType = $MIMETypes[$down_attach_file['filetype']];
         $down_attach_file['name'] = '"' . (strtolower(str_replace('-', '', $this->Config['charset'])) == 'utf8' && strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE') ? urlencode($down_attach_file['name']) : $down_attach_file['name']) . '"';
         ob_end_clean();
         ob_start();
         header('Cache-control: max-age=31536000');
         header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT');
         header('Content-Encoding: none');
         header('Content-type: ' . $fileType);
         header('Content-Disposition: attachment; filename=' . $down_attach_file['name']);
         header('Content-Length: ' . filesize($down_attach_file['file']));
         if ($readmod == 1 || $readmod == 3) {
             if ($fp = @fopen($down_attach_file['file'], 'rb')) {
                 @fseek($fp, 0);
                 if (function_exists('fpassthru') && $readmod == 3) {
                     @fpassthru($fp);
                 } else {
                     echo @fread($fp, filesize($down_attach_file['file']));
                 }
             }
             @fclose($fp);
         } else {
             @readfile($down_attach_file['file']);
         }
         @flush();
         @ob_flush();
     }
 }
Esempio n. 26
0
 private function _init_user($init_user = 0)
 {
     if (($this->init_user || $init_user) && !isset($this->var['object_user'])) {
         $this->var['object_user'] = jclass('member');
         $this->var['object_user']->init();
         Obj::register('MemberHandler', $this->var['object_user']);
     }
 }
Esempio n. 27
0
 function getAttach($param)
 {
     $qid = $param['qid'];
     $attach_list = array();
     $recd = array();
     $sql = " SELECT ta.*,m.nickname FROM " . DB::table('topic_attach') . " ta\r\n\t\t\t\t LEFT JOIN " . DB::table('members') . " m ON m.uid = ta.uid\r\n\t\t\t\t WHERE ta.itemid='{$qid}' AND ta.item='qun'\r\n\t\t\t\t ORDER BY ta.id DESC ";
     $query = DB::query($sql);
     $count = 0;
     $candown = jclass('member')->HasPermission('uploadattach', 'down');
     $canviewtype = array('doc', 'ppt', 'pdf', 'xls', 'txt', 'docx', 'xlsx', 'pptx');
     while ($rsdb = DB::fetch($query)) {
         $count++;
         $rsdb['filetype'] = 'images/filetype/' . $rsdb['filetype'] . '.gif';
         $rsdb['dateline'] = my_date_format($rsdb['dateline']);
         $rsdb['size'] = $rsdb['filesize'] > 1024 * 1024 ? round($rsdb['filesize'] / (1024 * 1024), 2) . 'MB' : round($rsdb['filesize'] / 1024, 1) . 'KB';
         $rsdb['url'] = ($rsdb['site_url'] ? $rsdb['site_url'] : $GLOBALS['_J']['site_url']) . '/' . str_replace('./', '', $rsdb['file']);
         $rsdb['onlineview'] = $candown && in_array($rsdb['filetype'], $canviewtype) && $rsdb['score'] == 0 ? $rsdb['url'] : '';
         $attach_list[] = $rsdb;
     }
     $return['attach_list'] = $attach_list;
     $return['count'] = $count;
     return $return;
 }
Esempio n. 28
0
 static function &object()
 {
     static $db = null;
     if (empty($db)) {
         $db =& Obj::registry('DatabaseHandler');
         if (empty($db)) {
             include ROOT_PATH . 'setting/settings.php';
             $db = jclass('jishigou/mysql');
             $db->do_connect($config['db_host'], $config['db_port'], $config['db_user'], $config['db_pass'], $config['charset'], $config['db_name'], isset($config['db_persist']) ? $config['db_persist'] : $config['db_pconnect']);
             Obj::register('DatabaseHandler', $db);
         }
     }
     return $db;
 }
Esempio n. 29
0
 function _update($uid = 0)
 {
     $uid = $uid > 0 ? $uid : MEMBER_ID;
     jclass('misc')->update_account_bind_info($uid, '', '', 1);
 }
Esempio n. 30
0
 function _checktemplate($template = array())
 {
     if ($template && is_array($template)) {
         foreach ($template as $key => $val) {
             if ($val && !preg_match("/^[a-z]+[a-z0-9_]*[a-z0-9]+\$/i", $val)) {
                 $this->Messager("模板文件名称[" . $val . "]不合法");
             }
             if ($val && !jclass('jishigou/template')->exists('channel/' . $val)) {
                 $this->Messager("模板文件 channel/" . $val . ".html 不存在");
             }
         }
     }
 }