Ejemplo n.º 1
0
 public static function getAppOutPut($collect)
 {
     $data = array();
     $sign = ACloudSysCoreCommon::getSiteSign();
     $data['src'] = $collect->getSrc();
     $data['url'] = ACloudSysCoreCommon::getGlobal('g_siteurl', $_SERVER['SERVER_NAME']);
     $data['sn'] = ACloudSysCoreCommon::getSiteUnique();
     $data['fid'] = $collect->getFid();
     $data['uid'] = $collect->getUid();
     $data['tid'] = $collect->getTid();
     $data[$sign] = ACloudVerCoreApp::getSyncData($sign);
     $data['charset'] = ACloudSysCoreCommon::getGlobal('g_charset', 'gbk');
     $data['username'] = $collect->getUsername();
     $data['title'] = $collect->getTitle();
     $data['_ua'] = ACloudSysCoreCommon::getSiteUserAgent();
     $data['_shr'] = base64_encode(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');
     $data['_sqs'] = base64_encode(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '');
     $data['_ssn'] = base64_encode(isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : '');
     $data['_t'] = ACloudSysCoreCommon::getGlobal('timestamp') + 86400;
     $data['_v'] = rand(1000, 9999);
     require_once Wind::getRealPath("ACLOUD:system.core.ACloudSysCoreHttp");
     $url = sprintf("http://%s/?%s", ACloudSysCoreDefine::ACLOUD_HOST_APP, ACloudSysCoreHttp::httpBuildQuery($data));
     $output = "<script type=\"text/javascript\">(function(d,t){var url=\"{$url}\";var g=d.createElement(t);g.async=1;g.src=url;d.body.insertBefore(g,d.body.firstChild);}(document,\"script\"));</script>";
     return $output;
 }
 public function __construct()
 {
     $daoObject = ACloudSysCoreCommon::getGlobal(ACloudSysCoreDefine::ACLOUD_OBJECT_DAO);
     $daoObject->getDB();
     list($currentUid) = ACloudSysCoreS::gp('current_uid');
     ACloudSysCoreCommon::setGlobal('customized_current_uid', $currentUid);
 }
Ejemplo n.º 3
0
 public static function sendPost($data)
 {
     require_once Wind::getRealPath("ACLOUD:system.core.ACloudSysCoreHttpclient");
     $data = self::httpBuildQuery($data);
     $result = ACloudSysCoreHttpclient::post(self::getCloudApi(), $data);
     return ACloudSysCoreCommon::jsonDecode($result);
 }
 public function resetConfig()
 {
     ACloudSysCoreCommon::loadSystemClass('extras', 'config.dao')->deleteAll();
     ACloudSysCoreCommon::loadSystemClass('apps', 'config.dao')->deleteAll();
     ACloudSysCoreCommon::loadSystemClass('app.configs', 'config.dao')->deleteAll();
     return true;
 }
Ejemplo n.º 5
0
 public function buildResponse($errorCode, $responseData = array())
 {
     $response = ACloudSysCoreCommon::loadSystemClass('response');
     $response->setErrorCode($errorCode);
     $response->setResponseData($responseData);
     return $response->getOutputData();
 }
Ejemplo n.º 6
0
 private function buildForumData($data)
 {
     list($result, $siteUrl) = array(array(), ACloudSysCoreCommon::getGlobal('g_siteurl', $_SERVER['SERVER_NAME']));
     foreach ($data as $value) {
         $value['forumurl'] = 'http://' . $siteUrl . '/index.php?m=bbs&c=thread&fid=' . $value['fid'];
         $result[$value['fid']] = $value;
     }
     return $result;
 }
Ejemplo n.º 7
0
 public function checkAction()
 {
     require_once Wind::getRealPath('ACLOUD:aCloud');
     ACloudSysCoreCommon::setGlobal('g_siteurl', PUBLIC_URL);
     ACloudSysCoreCommon::setGlobal('g_sitename', 'phpwind');
     ACloudSysCoreCommon::setGlobal('g_charset', Wind::getApp()->getResponse()->getCharset());
     list($this->BenchService, $operate) = array(ACloudSysCoreCommon::loadSystemClass('administor', 'bench.service'), strtolower($this->getInput("operate")));
     return $operate == 'reset' ? $this->reset() : $this->checkEnvironment();
 }
 public function get($apiSetting, $request)
 {
     $sql = ACloudSysCoreCommon::loadSystemClass('sqlbuilder')->buildSelectSql($apiSetting, $request);
     if (!$sql) {
         return array(4006, array());
     }
     $data = ACloudSysCoreCommon::loadSystemClass('generaldata', 'config.service')->executeSql($sql);
     return $data === false ? array(4007, array()) : array(0, $data);
 }
Ejemplo n.º 9
0
 public static function createSignWithOAuth($data)
 {
     $keysService = ACloudSysCoreCommon::loadSystemClass('keys', 'config.service');
     $key1 = $keysService->getKey1(1);
     if (!$key1 || strlen($key1) != 128 || !is_array($data) || count($data) < 4) {
         return '';
     }
     require_once Wind::getRealPath('ACLOUD:.system.core.ACloudSysCoreOauth');
     return ACloudSysCoreOauth::createHttpSign(ACloudSysCoreOauth::createHttpQuery($data) . $key1);
 }
Ejemplo n.º 10
0
 public function get()
 {
     $data = Wekit::C('site');
     $_extrasService = ACloudSysCoreCommon::loadSystemClass('extras', 'config.service');
     $result = array();
     $result['ifopen'] = $data['visit.state'];
     $result['sitename'] = $data['info.name'];
     $result['siteurl'] = $data['info.url'];
     $result['charset'] = ACloudSysCoreDefine::ACLOUD_APPLY_CHARSET ? ACloudSysCoreDefine::ACLOUD_APPLY_CHARSET : $_extrasService->getExtra('ac_apply_charset');
     $result['cookie_prefix'] = $data['cookie.pre'];
     return $this->buildResponse(0, array('siteinfo' => $result));
 }
Ejemplo n.º 11
0
 public function createSign($params)
 {
     if (empty($params) || !is_array($params)) {
         return '';
     }
     $keysService = ACloudSysCoreCommon::loadSystemClass('keys', 'config.service');
     $key1 = $keysService->getKey1(1);
     if (!$key1 || strlen($key1) != 128) {
         return '';
     }
     ksort($params);
     return md5($this->createHttpQuery($params) . $key1);
 }
 private function buildPostParams($method, $data)
 {
     $params = array();
     $params['method'] = $method;
     $params['version'] = ACLOUD_V;
     $params['siteurl'] = ACloudSysCoreCommon::getGlobal('g_siteurl');
     $params['sitename'] = ACloudSysCoreCommon::getGlobal('g_sitename');
     $params['charset'] = ACloudSysCoreCommon::getGlobal('g_charset');
     $params['ip'] = ACloudSysCoreCommon::getIp();
     $params['ua'] = $_SERVER['HTTP_USER_AGENT'];
     $params['posttime'] = time();
     return $params;
 }
 public function ipControl($ips = array())
 {
     return true;
     $ip = ACloudSysCoreCommon::getIp();
     if ($this->spiderControl() || !$ip) {
         return false;
     }
     list($ip1, $ip2, $ip3) = explode(".", $ip);
     $envService = ACloudSysCoreCommon::loadSystemClass('env', 'open.service');
     if (!in_array($ip1 . "." . $ip2 . "." . $ip3 . ".x", $envService->getIpLists())) {
         return false;
     }
     return true;
 }
 public function checkSecretKey($data)
 {
     if (!ACloudSysCoreS::isArray($data) || !isset($data['plaintext']) || !$data['plaintext'] || !isset($data['ciphertext']) || !$data['ciphertext']) {
         return array(false, 'apply_checkkey_invalid_params');
     }
     $keysService = ACloudSysCoreCommon::loadSystemClass('keys', 'config.service');
     $key6 = $keysService->getKey6(2);
     if (!$key6 || strlen($key6) != 128) {
         return array(false, 'apply_checkkey_invalid_key6');
     }
     unset($data['a']);
     unset($data['m']);
     unset($data['c']);
     if (!ACloudSysCoreVerify::verifyWithOAuth($data, $key6)) {
         return array(false, 'apply_checkkey_wrong_sign');
     }
     if (!ACloudSysCoreVerify::verifyWithAES($data['ciphertext'], $data['plaintext'])) {
         return array(false, 'apply_checkkey_fail');
     }
     return array(true, 'apply_checkkey_success');
 }
Ejemplo n.º 15
0
 public function getDB()
 {
     return ACloudSysCoreCommon::getGlobal(ACloudSysCoreDefine::ACLOUD_OBJECT_DAO)->getDB();
 }
Ejemplo n.º 16
0
 private function getKeysService()
 {
     return ACloudSysCoreCommon::loadSystemClass('keys', 'config.service');
 }
 private function operateAddLog($tableName, $fields)
 {
     list($type, $insertId) = array(ACloudVerDataFlowAggregate::getTypeByTableName($tableName), $fields['insertid']);
     if (is_null($type) || !$insertId) {
         return false;
     }
     $sign = ACloudSysCoreCommon::getSiteSign();
     return setcookie('_ac_' . $sign, intval($type), time() + 3600);
 }
 private function getKeysDao()
 {
     return ACloudSysCoreCommon::loadSystemClass('keys', 'config.dao');
 }
Ejemplo n.º 19
0
 public static function collectSql($queryString, $params)
 {
     return ACloudSysCoreCommon::loadSystemClass('aggregate', 'dataflow.service')->collectSQL($queryString, $params);
 }
Ejemplo n.º 20
0
 /**
  * 获取线上应用基本信息,包括应用中心提交应用填写的描述、logo等
  *
  * @return PwError|array  
  */
 public function getOnlineInfo()
 {
     $url = PwApplicationHelper::acloudUrl(array('a' => 'forward', 'do' => 'getAppById', 'appid' => $this->_appId));
     $data = PwApplicationHelper::requestAcloudData($url);
     if ($data['code'] !== '0') {
         return new PwError('APPCENTER:install.fail', array('{{error}}' => $data['msg']));
     }
     $manifest = array('application' => array('name' => $data['info']['app_name'], 'version' => $data['info']['version'], 'pw-version' => $data['info']['bbs_version'], 'description' => trim($data['info']['description'], '\'"'), 'logo' => $data['info']['icon'], 'author-name' => trim($data['info']['app_author'], '\'"'), 'website' => $data['info']['author_url'], 'charset' => ACloudSysCoreCommon::getGlobal('g_charset')));
     return $manifest;
 }
 private function getDataByPrimaryKeyRange($tableSetting, $start, $end)
 {
     $generalDataService = ACloudSysCoreCommon::loadSystemClass('generaldata', 'config.service');
     $dataSql = sprintf('SELECT * FROM %s WHERE %s >= %s AND %s <= %s', ACloudSysCoreS::sqlMetadata($tableSetting['name']), ACloudSysCoreS::sqlMetadata($tableSetting['primary_key']), ACloudSysCoreS::sqlEscape($start), ACloudSysCoreS::sqlMetadata($tableSetting['primary_key']), ACloudSysCoreS::sqlEscape($end));
     return $generalDataService->executeSql($dataSql);
 }
Ejemplo n.º 22
0
 public function getUsersByRange($startId, $endId)
 {
     list($startId, $endId) = array(intval($startId), intval($endId));
     if ($startId < 0 || $startId > $endId || $endId < 1) {
         return array();
     }
     $result = $members = array();
     $sql = sprintf("SELECT u.* FROM %s u WHERE u.uid >= %s AND u.uid <= %s", ACloudSysCoreS::sqlMetadata('{{user}}'), ACloudSysCoreS::sqlEscape($startId), ACloudSysCoreS::sqlEscape($endId));
     $query = Wind::getComponent('db')->query($sql);
     $result = $query->fetchAll('uid', PDO::FETCH_ASSOC);
     if (!ACloudSysCoreS::isArray($result)) {
         return array();
     }
     $query = Wind::getComponent('db')->query(sprintf("SELECT ud.* FROM %s ud WHERE ud.uid >= %s AND ud.uid <= %s", ACloudSysCoreS::sqlMetadata('{{user_data}}'), ACloudSysCoreS::sqlEscape($startId), ACloudSysCoreS::sqlEscape($endId)));
     $userData = $query->fetchAll('uid', PDO::FETCH_ASSOC);
     $query = Wind::getComponent('db')->query(sprintf("SELECT ui.* FROM %s ui WHERE ui.uid >= %s AND ui.uid <= %s", ACloudSysCoreS::sqlMetadata('{{user_info}}'), ACloudSysCoreS::sqlEscape($startId), ACloudSysCoreS::sqlEscape($endId)));
     $userInfo = $query->fetchAll('uid', PDO::FETCH_ASSOC);
     foreach ($result as $key => $value) {
         $result[$key] = array_merge($value, $userData[$value['uid']], $userInfo[$value['uid']]);
     }
     $siteUrl = ACloudSysCoreCommon::getGlobal('g_siteurl', $_SERVER['SERVER_NAME']);
     foreach ($result as $member) {
         $member['memberurl'] = 'http://' . $siteUrl . '/index.php?m=space&uid=' . $member['uid'];
         $member['icon'] = Pw::getAvatar($member['uid']);
         $members[$member['uid']] = $member;
     }
     return $this->filterMemberFields($members);
 }
 public function getRequestArgumentValue($param, $request)
 {
     $charset = ACloudSysCoreCommon::getGlobal('g_charset');
     return isset($request[$param]) ? ACloudSysCoreCommon::convert($request[$param], $charset, 'UTF-8') : null;
 }
 private function getTableSettingsDao()
 {
     return ACloudSysCoreCommon::loadSystemClass('table.settings', 'config.dao');
 }
Ejemplo n.º 25
0
 public function proxyAction()
 {
     print_r($this->getProxyIframe(ACloudSysCoreCommon::getGlobal('g_charset', Wekit::app()->charset)));
     exit;
 }
Ejemplo n.º 26
0
 public function getOutputData()
 {
     $format = ACloudSysCoreCommon::getGlobal('acloud_api_output_format');
     list($data, $charset) = array(array('code' => $this->getErrorCode(), 'info' => $this->getResponseData()), ACloudSysCoreCommon::getGlobal('g_charset'));
     return ACloudSysCoreCommon::loadSystemClass('format')->format($data, $format, $charset);
 }
 public function getApplySubmitUrl()
 {
     $params = array();
     $params['timestamp'] = time();
     $params['rand'] = ACloudSysCoreCommon::randCode(32);
     $params['ua'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'default';
     $params['ip'] = ACloudSysCoreCommon::getIp();
     return sprintf('http://%s/?c=apply&%s', ACloudSysCoreDefine::ACLOUD_HOST_API, http_build_query($params));
 }
 private function getSqlLogDao()
 {
     return ACloudSysCoreCommon::loadSystemClass('sql.log', 'config.dao');
 }
Ejemplo n.º 29
0
 private function storage_getAttaches()
 {
     list($directory) = ACloudSysCoreS::gp(array('dir'));
     $dataFlowService = ACloudSysCoreCommon::loadSystemClass('crawler', 'dataflow.service');
     return $dataFlowService->getAttachesForStorage($directory);
 }
 private function getAppConfigsDao()
 {
     return ACloudSysCoreCommon::loadSystemClass('app.configs', 'config.dao');
 }