コード例 #1
0
ファイル: note.php プロジェクト: ablozhou/hairnet
 function sendone($appid, $noteid = 0, $note = '')
 {
     $return = FALSE;
     $app = $this->apps[$appid];
     if ($noteid) {
         $note = $this->_get_note_by_id($noteid);
     }
     $this->base->load('misc');
     $url = $this->get_url_code($note['operation'], $note['getdata'], $appid);
     $getcontent = trim(uc_fopen2($url, 500000, $note['postdata'], '', 1, $app['ip'], UC_NOTE_TIMEOUT));
     $returnsucceed = $getcontent != '' && $getcontent != '-1';
     $closedsqladd = $this->_close_note($note, $this->apps, $returnsucceed) ? ",closed='1'" : '';
     //
     if ($returnsucceed) {
         if ($this->operations[$note['operation']][2]) {
             $this->base->load($this->operations[$note['operation']][2]);
             $func = $this->operations[$note['operation']][3];
             $_ENV[$this->operations[$note['operation']][2]]->{$func}($appid, $getcontent);
         }
         $this->db->query("UPDATE " . UC_DBTABLEPRE . "notelist SET app{$appid}='1', totalnum=totalnum+1, succeednum=succeednum+1, dateline='{$this->base->time}' {$closedsqladd} WHERE noteid='{$note['noteid']}'", 'SILENT');
         $return = TRUE;
     } else {
         $this->db->query("UPDATE " . UC_DBTABLEPRE . "notelist SET app{$appid} = app{$appid}-'1', totalnum=totalnum+1, dateline='{$this->base->time}' {$closedsqladd} WHERE noteid='{$note['noteid']}'", 'SILENT');
         $return = FALSE;
     }
     return $return;
 }
コード例 #2
0
ファイル: ucenter.class.php プロジェクト: eappl/prototype
 function connect($url, $password, $ip = '')
 {
     $ucapi = preg_replace("/\\/\$/", '', trim($url));
     $ucip = trim($ip);
     if (!$ucip) {
         $temp = @parse_url($ucapi);
         $ucip = gethostbyname($temp['host']);
         if (ip2long($ucip) == -1 || ip2long($ucip) === FALSE) {
             $ucip = '';
         }
     }
     $ucinfo = uc_fopen2($ucapi . '/index.php?m=app&a=ucinfo&a=ucinfo', 500, '', '', 1, $ucip);
     list($status, $ucversion, $ucrelease, $uccharset, $ucdbcharset, $apptypes) = explode('|', $ucinfo);
     if ($status != 'UC_STATUS_OK') {
         exit('连接失败,请检查URL和密码是否正确!');
     }
     $postdata = "m=app&a=add&ucfounder=&ucfounderpw=" . urlencode($password) . "&apptype=" . urlencode('OTHER') . "&appname=" . urlencode($this->base->setting['site_name']) . "&appurl=" . urlencode(SITE_URL) . "&appip=&appcharset=" . TIPASK_CHARSET . '&appdbcharset=' . DB_CHARSET;
     $s = uc_fopen2($ucapi . '/index.php', 500, $postdata, '', 1, $ucip);
     if (empty($s)) {
         exit('不能连接到UCenter服务端!');
     } elseif ($s == '-1') {
         exit('UCenter密码错误!');
     } else {
         $ucs = explode('|', $s);
         if (empty($ucs[0]) || empty($ucs[1])) {
             exit('网络连接超时,不能返回数据,请稍后重试!');
         }
     }
     $ucdata = "<?php\ndefine('UC_OPEN','1');\ndefine('UC_CONNECT', 'uc_api_post');\ndefine('UC_DBHOST', '{$ucs['2']}');\ndefine('UC_DBUSER', '{$ucs['4']}');\ndefine('UC_DBPW', '{$ucs['5']}');\ndefine('UC_DBNAME', '{$ucs['3']}');\ndefine('UC_DBCHARSET', '{$ucs['6']}');\ndefine('UC_DBTABLEPRE', '{$ucs['7']}');\ndefine('UC_KEY', '{$ucs['0']}');\ndefine('UC_API', '{$ucapi}');\ndefine('UC_CHARSET', '{$ucs['8']}');\ndefine('UC_IP', '{$ucip}');\ndefine('UC_APPID', '{$ucs['1']}');\n?>";
     $bytes = writetofile(TIPASK_ROOT . '/data/ucconfig.inc.php', $ucdata);
     return 0 != $bytes;
 }
コード例 #3
0
ファイル: spacecp_space.php プロジェクト: lemonstory/bbs
function my_userapp_update($uId, $appId, $privacy = null, $allowProfileLink = null)
{
    global $my_register_url, $_G;
    $mySiteId = $_G['setting']['my_siteid'];
    $mySiteKey = $_G['setting']['my_sitekey'];
    if (!$_G['setting']['my_app_status']) {
        $res = array('errCode' => 121, 'errMessage' => 'Manyou Service Disabled', 'result' => '');
        return $res;
    }
    $data = array();
    if ($privacy !== null) {
        switch ($privacy) {
            case 1:
                $data['privacy'] = 'friends';
                break;
            case 3:
                $data['privacy'] = 'me';
                break;
            case 5:
                $data['privacy'] = 'none';
                break;
            case 0:
            default:
                $data['privacy'] = 'public';
        }
    }
    if ($allowProfileLink !== null) {
        $data['allowProfileLink'] = $allowProfileLink ? true : false;
    }
    if (!$data) {
        return array('errCode' => 5, 'errMessage' => 'Post Data Cann\'t Be Empty!');
    }
    $data = serialize($data);
    $key = "{$mySiteId}|{$mySiteKey}|{$uId}|{$appId}|{$data}";
    $key = md5($key);
    $data = urlencode($data);
    $postString = sprintf('action=%s&key=%s&mySiteId=%d&uId=%d&appId=%d&data=%s', 'userappUpdate', $key, $mySiteId, $uId, $appId, $data);
    loaducenter();
    $url = 'http://api.manyou.com/uchome.php';
    $response = uc_fopen2($url, 0, $postString, '', false, $_G['setting']['my_ip']);
    $res = unserialize($response);
    if (!$response) {
        $res['errCode'] = 111;
        $res['errMessage'] = 'Empty Response';
        $res['result'] = $response;
    } elseif (!$res) {
        $res['errCode'] = 110;
        $res['errMessage'] = 'Error Response';
        $res['result'] = $response;
    }
    return $res;
}
コード例 #4
0
function my_site_close($mySiteId, $mySiteKey)
{
    $key = $mySiteId . $mySiteKey;
    $key = md5($key);
    $postString = sprintf('action=%s&key=%s&mySiteId=%d', 'siteClose', $key, $mySiteId);
    $response = uc_fopen2($_MY_GLOBAL['my_register_url'], 0, $postString, '', false, '');
    $res = unserialize($response);
    if (!$response) {
        $res['errCode'] = 111;
        $res['errMessage'] = 'Empty Response';
        $res['result'] = $response;
    } elseif (!$res) {
        $res['errCode'] = 110;
        $res['errMessage'] = 'Error Response';
        $res['result'] = $response;
    }
    return $res['result'];
}
コード例 #5
0
ファイル: client.php プロジェクト: noikiy/MyShop
function uc_api_post($module, $action, $arg = array())
{
    $s = $sep = '';
    foreach ($arg as $k => $v) {
        if (is_array($v)) {
            $s2 = $sep2 = '';
            foreach ($v as $k2 => $v2) {
                $s2 .= "{$sep2}{$k}[{$k2}]=" . urlencode(uc_stripslashes($v2));
                $sep2 = '&';
            }
            $s .= $sep . $s2;
        } else {
            $s .= "{$sep}{$k}=" . urlencode(uc_stripslashes($v));
        }
        $sep = '&';
    }
    $postdata = uc_api_requestdata($module, $action, $s);
    return uc_fopen2(UC_API . '/index.php', 500000, $postdata, '', TRUE, UC_IP, 20);
}
コード例 #6
0
function uc_check_avatar($uid, $size = 'middle', $type = 'virtual')
{
    $url = UC_API . "/avatar.php?uid={$uid}&size={$size}&type={$type}&check_file_exists=1";
    $res = uc_fopen2($url, 500000, '', '', TRUE, UC_IP, 20);
    if ($res == 1) {
        return 1;
    } else {
        return 0;
    }
}
コード例 #7
0
ファイル: index.php プロジェクト: BGCX262/zyyhong-svn-to-git
	} elseif(strexists($apptypes, 'uchome')) {
		show_msg('已经安装过一个UCenter Home产品,如果想继续安装,请先到 UCenter 应用管理中删除已有的UCenter Home!');
	}
	$tagtemplates = 'apptagtemplates[template]='.urlencode('<a href="{url}" target="_blank">{subject}</a>').'&'.
		'apptagtemplates[fields][subject]='.urlencode('日志标题').'&'.
		'apptagtemplates[fields][uid]='.urlencode('用户 ID').'&'.
		'apptagtemplates[fields][username]='.urlencode('用户名').'&'.
		'apptagtemplates[fields][dateline]='.urlencode('日期').'&'.
		'apptagtemplates[fields][spaceurl]='.urlencode('空间地址').'&'.
		'apptagtemplates[fields][url]='.urlencode('日志地址');

	$uri = $_SERVER['REQUEST_URI']?$_SERVER['REQUEST_URI']:($_SERVER['PHP_SELF']?$_SERVER['PHP_SELF']:$_SERVER['SCRIPT_NAME']);
	$app_url = strtolower(substr($_SERVER['SERVER_PROTOCOL'], 0, strpos($_SERVER['SERVER_PROTOCOL'], '/'))).'://'.$_SERVER['HTTP_HOST'].preg_replace("/\/*install$/i", '', substr($uri, 0, strrpos($uri, '/install')));

	$postdata = "m=app&a=add&ucfounder=&ucfounderpw=".urlencode($_POST['ucfounderpw'])."&apptype=".urlencode('UCHOME')."&appname=".urlencode('个人家园')."&appurl=".urlencode($app_url)."&appip=&appcharset=".$_SC['charset'].'&appdbcharset='.$_SC['dbcharset'].'&release='.UC_CLIENT_RELEASE.'&'.$tagtemplates;
	$s = uc_fopen2($ucapi.'/index.php', 500, $postdata, '', 1, $ucip);
	if(empty($s)) {
		show_msg('UCenter用户中心无法连接');
	} elseif($s == '-1') {
		show_msg('UCenter管理员帐号密码不正确');
	} else {
		$ucs = explode('|', $s);
		if(empty($ucs[0]) || empty($ucs[1])) {
			show_msg('UCenter返回的数据出现问题,请参考:<br />'.shtmlspecialchars($s));
		} else {

			//处理成功
			$apphidden = '';
			//验证是否可以直接联接MySQL
			$link = mysql_connect($ucs[2], $ucs[4], $ucs[5], 1);
			$connect = $link && mysql_select_db($ucs[3], $link) ? 'mysql' : '';
コード例 #8
0
function my_site_restore($op)
{
    $url = 'http://api.manyou.com/uchome.php';
    global $_SITE_CONFIG;
    $siteUrl = getmyopurl() . '/';
    $postString = sprintf('action=%s&siteUrl=%s&op=%s', 'webmaster', $siteUrl, $op);
    $response = uc_fopen2($url, 0, $postString, '', false, $_SITE_CONFIG['my_ip']);
    $res = unserialize($response);
    if (!$response) {
        $res['errCode'] = 111;
        $res['errMessage'] = 'Empty Response';
        $res['result'] = $response;
    } elseif (!$res) {
        $res['errCode'] = 110;
        $res['errMessage'] = 'Error Response';
        $res['result'] = $response;
    }
    if ($res['errCode']) {
        return $res;
    }
    // lock file
    $fp = fopen(SITE_ROOT . '/data/thinksns_myop_utility.lock', 'w');
    if ($fp === false) {
        my_show_message(sprintf('请确保 <strong>%s/data/thinksns_myop_utility.lock</strong> 文件可写!', SITE_ROOT));
    }
    fclose($fp);
    return $res['result'];
}
コード例 #9
0
function my_site_close($mySiteId, $mySiteKey)
{
    global $my_register_url, $_SCONFIG;
    $key = $mySiteId . $mySiteKey;
    $key = md5($key);
    $postString = sprintf('action=%s&key=%s&mySiteId=%d', 'siteClose', $key, $mySiteId);
    include_once S_ROOT . './uc_client/client.php';
    $response = uc_fopen2($my_register_url, 0, $postString, '', false, $_SCONFIG['my_ip']);
    $res = unserialize($response);
    if (!$response) {
        $res['errCode'] = 111;
        $res['errMessage'] = 'Empty Response';
        $res['result'] = $response;
    } elseif (!$res) {
        $res['errCode'] = 110;
        $res['errMessage'] = 'Error Response';
        $res['result'] = $response;
    }
    return $res['result'];
}