コード例 #1
0
ファイル: ImController.php プロジェクト: AxelPanda/ibos
 public function actionBindingUser()
 {
     if (EnvUtil::submitCheck("formhash")) {
         $map = filter_input(INPUT_POST, "map", FILTER_SANITIZE_STRING);
         if (!empty($map)) {
             UserBinding::model()->deleteAllByAttributes(array("app" => "bqq"));
             $maps = explode(",", $map);
             foreach ($maps as $relation) {
                 list($uid, $openId) = explode("=", $relation);
                 UserBinding::model()->add(array("uid" => $uid, "bindvalue" => $openId, "app" => "bqq"));
             }
             $this->ajaxReturn(array("isSuccess" => true));
         }
         $this->ajaxReturn(array("isSuccess" => false));
     } elseif (MessageUtil::getIsImOpen("qq")) {
         $imCfg = Ibos::app()->setting->get("setting/im/qq");
         $factory = new ICIMFactory();
         $adapter = $factory->createAdapter("ICIMQq", $imCfg);
         $api = $adapter->getApi();
         $rs = $api->getUserList(array("timestamp" => 0));
         $bqqUsers = array();
         if (substr($rs, 0, 5) !== "error") {
             $rsArr = json_decode($rs, true);
             if (isset($rsArr["ret"]) && $rsArr["ret"] == 0) {
                 $bqqUsers = $rsArr["data"]["items"];
             }
         }
         $data = array("ibosUsers" => UserUtil::loadUser(), "binds" => UserBinding::model()->fetchAllSortByPk("uid", "app = 'bqq'"), "bqqUsers" => $bqqUsers);
         $this->renderPartial("qqbinding", $data);
     }
 }
コード例 #2
0
ファイル: sso.php プロジェクト: AxelPanda/ibos
require_once $defines;
require_once $yii;
require_once $ibosApplication;
$ibos = Yii::createApplication("ICApplication", $config);
$im = Setting::model()->fetchSettingValueByKey("im");
$im = unserialize($im);
$imCfg = $im["qq"];
$cid = filter_input(INPUT_GET, "company_id", FILTER_SANITIZE_STRING);
$openId = filter_input(INPUT_GET, "open_id", FILTER_SANITIZE_STRING);
$hashskey = filter_input(INPUT_GET, "hashskey", FILTER_SANITIZE_STRING);
$hashkey = filter_input(INPUT_GET, "hashkey", FILTER_SANITIZE_STRING);
$returnurl = filter_input(INPUT_GET, "returnurl", FILTER_SANITIZE_STRING);
if (empty($openId) || empty($hashskey) || empty($cid)) {
    exit("参数错误");
}
$uid = UserBinding::model()->fetchUidByValue(StringUtil::filterCleanHtml($openId), "bqq");
if ($uid) {
    $checkCId = strcmp($imCfg["id"], $cid) == 0;
    $properties = array("company_id" => $cid, "company_token" => $imCfg["token"], "app_id" => $imCfg["appid"], "client_ip" => EnvUtil::getClientIp());
    $api = new BQQApi($properties);
    $status = $api->getVerifyStatus(array("open_id" => $openId, "hashskey" => $hashskey));
    if ($status["ret"] == 0) {
        $config = @(include PATH_ROOT . "/system/config/config.php");
        if (empty($config)) {
            throw new Exception(Ibos::Lang("Config not found", "error"));
        } else {
            define("IN_MOBILE", EnvUtil::checkInMobile());
            $global = array("clientip" => EnvUtil::getClientIp(), "config" => $config, "timestamp" => time());
            Ibos::app()->setting->copyFrom($global);
            handleloadsyscache();
            $saltkey = MainUtil::getCookie("saltkey");
コード例 #3
0
ファイル: ICIMQq.php プロジェクト: AxelPanda/ibos
 protected function getBindingUser($uids)
 {
     $result = array();
     foreach ($uids as $uid) {
         if (UserBinding::model()->getIsBinding($uid, "bqq")) {
             $result[] = $uid;
         }
     }
     return $result;
 }