Example #1
0
 function UcApp()
 {
     parent::__construct();
     $this->appdir = ROOT_PATH . '/';
     $this->user_mod =& m('member');
 }
Example #2
0
 static function searchPartial($qp, $num, $noCache = false)
 {
     global $wgMemc;
     $howto = strtolower(wfMsg('howto', ''));
     $qp = trim(preg_replace('@(^' . preg_quote($howto) . '|howto)@i', '', strtolower($qp)));
     $cachekey = wfMemcKey('searchpartial', $qp);
     if (!$noCache) {
         $res = $wgMemc->get($cachekey);
     }
     if (is_array($res)) {
         $cached_num = $res['num'];
         if ($cached_num >= $num) {
             unset($res['num']);
             $time += microtime(true);
             return array_slice($res, 0, $num);
         }
     }
     $res = ApiApp::websolrSearch($qp, "json", $num);
     $res = json_decode($res, true);
     $res = $res['response']['docs'];
     // add num to results for use in caching only
     $res['num'] = $num;
     $wgMemc->set($cachekey, $res, 3600);
     unset($res['num']);
     return $res;
 }
Example #3
0
<?php

define('APP_NAME', 'api');
define('PI_ROOT', dirname(dirname(dirname(__FILE__))) . '/pi/');
define('APP_ROOT', dirname(dirname(__FILE__)) . '/');
define('LOG_PATH', dirname(dirname(dirname(__FILE__))) . '/logs');
define('COM_ROOT', APP_ROOT . 'com/');
define("__PI_EN_DEBUG", 1);
include PI_ROOT . 'Api.php';
//api项目需要的框架配置
Pi::set('global.logFile', 'api');
Pi::set('env', 'dev');
// dev test pre online
$app = new ApiApp($argv);
$app->run();
Example #4
0
/**
@fn callSvc($ac?, $urlParam?, $postParam?, $cleanCall?=false, $hideResult?=false)

直接调用接口,返回数据。如果出错,将调用$GLOBALS['errorFn'] (缺省为errQuit).

@param $cleanCall Boolean. 如果为true, 则不使用现有的$_GET, $_POST等变量中的值。
@param $hideResult Boolean. 如果为true, 不输出结果。
*/
function callSvc($ac = null, $urlParam = null, $postParam = null, $cleanCall = false, $hideResult = false)
{
    global $DBH;
    // 避免api->exec完成后关闭数据库连接
    $bak = [$_GET, $_POST, $_REQUEST, ApiFw_::$SOLO, $DBH];
    if ($cleanCall) {
        $_GET = [];
        $_POST = [];
        $_REQUEST = [];
    }
    if ($ac) {
        $_GET["_ac"] = $ac;
    }
    if ($urlParam) {
        foreach ($urlParam as $k => $v) {
            setParam($k, $v);
        }
    }
    if ($postParam) {
        foreach ($postParam as $k => $v) {
            $_POST[$k] = $v;
        }
    }
    if ($hideResult) {
        ApiFw_::$SOLO = false;
    }
    $api = new ApiApp();
    $ret = $api->exec();
    global $X_RET_STR;
    $X_RET_STR = null;
    list($_GET, $_POST, $_REQUEST, ApiFw_::$SOLO, $DBH) = $bak;
    return $ret;
}
Example #5
0
function load_apiApp($appName, $mysql, $texts)
{
    $apiApp = new ApiApp();
    $apiApp->setTexts($texts);
    $projectDao = new ProjectDao($mysql);
    $apiApp->setProjectDao($projectDao);
    $clientDao = new ClientDao($mysql);
    $apiApp->setClientDao($clientDao);
    $getResponseDao = new GetresponseDao($mysql);
    $apiApp->setGetResponseDao($getResponseDao);
    $eventDao = new EventDao($mysql);
    $apiApp->setEventDao($eventDao);
    $partnerDao = new PartnerDao($mysql);
    $apiApp->setPartnerDao($partnerDao);
    $stageDao = new StageDao($mysql);
    $apiApp->setStageDao($stageDao);
    global $mailPatterns;
    $apiApp->setMailPatterns($mailPatterns);
    global $config_partnerURL;
    $apiApp->setPartnerUrl($config_partnerURL);
    global $config_adminUrl;
    $apiApp->setAdminUrl($config_adminUrl);
    $emailLogDao = new Email_logDao($mysql);
    $apiApp->setEmailLogDao($emailLogDao);
    $userDao = new UserDao($mysql);
    $apiApp->setUserDao($userDao);
    global $config_URL;
    $apiApp->setSystemUrl($config_URL);
    global $config_projectURL;
    $apiApp->setProjectUrl($config_projectURL);
    $eventHistoryDao = new EventHistoryDao($mysql);
    $apiApp->setEventHistoryDao($eventHistoryDao);
    $clientPeriodicalDao = new ClientPeriodicalDao($mysql);
    $apiApp->setClientPeriodicalDao($clientPeriodicalDao);
    return $apiApp;
}