public function initMapping()
 {
     require_once JPATH_COMPONENT . DS . 'models' . DS . 'config.php';
     $configModel = new ConfigModel();
     $this->ngramsLength = $configModel->loadConfigValue('constant', 'VALUES_MAPPING_NGRAMS_LENGTH');
     $this->finalArr = $this->mapValues($this->finalArr);
 }
Esempio n. 2
0
 public function render($data)
 {
     $db = new WidgetModel();
     $rs = $db->where("name='douban'")->find();
     if ($rs['switch'] != 1) {
         return false;
         exit;
     }
     $db = new ConfigModel();
     $rs = $db->where("k='douban_fm'")->find();
     if ($rs === null || $rs === false) {
         return false;
         exit;
     }
     $douban_fm = $rs['v'];
     $rs = $db->where("k='douban_show'")->find();
     if ($rs === null || $rs === false) {
         return false;
         exit;
     }
     $douban_show = $rs['v'];
     echo "<h2>我的豆瓣</h2>";
     echo "<ul>";
     echo $douban_fm == '' ? '' : "<li>{$douban_fm}</li>";
     echo "</ul>";
 }
Esempio n. 3
0
 function render($data)
 {
     $db = new ConfigModel();
     $rs = $db->where("k='widget_link'")->find();
     if ($rs['v'] != '1') {
         return false;
     }
     $db = new LinksModel();
     $all = $db->where("pass_flag=1")->select();
     //dump($all);
     if ($all === null || $all === false) {
         return false;
     }
     if (count($all) < 5) {
         echo "<h2>友情链接</h2>";
         echo "<ul>";
         foreach ($all as $all) {
             echo "<li><a href='" . $all['www_url'] . "' target='_blank'>" . $all['worlds'] . "</a></li>";
         }
         echo "</ul>";
         return;
     }
     //随即抽取5条记录
     $array = array_rand($all, 5);
     //dump($array);
     echo "<h2>友情链接</h2>";
     echo "<ul>";
     foreach ($array as $id) {
         echo "<li><a href='" . $all[$id]['www_url'] . "' target='_blank'>" . $all[$id]['worlds'] . "</a></li>";
     }
     echo "</ul>";
 }
Esempio n. 4
0
 public function render($data)
 {
     import("ORG.Util.Input");
     $db = new ConfigModel();
     $rs = $db->where("k='widget_develop'")->find();
     if ($rs['v'] != '1') {
         return false;
     }
     $limit = $_SESSION['user_login_flag'] === true ? 100 : 5;
     $db = new WorldsModel();
     $rs = $db->field('id,text')->limit($limit)->where("last_time<>''")->order('last_time desc')->select();
     if ($rs === null || $rs === false) {
         return false;
     }
     echo "<h2>站内动态</h2>";
     echo "<ul>";
     foreach ($rs as $rs) {
         $content = Input::truncate($rs['text'], 20);
         $link .= "[微博]:“";
         $link .= "<a href='";
         $link .= __APP__;
         $link .= "/Worlds/view/id/";
         $link .= $rs['id'];
         $link .= "'>";
         $link .= $content;
         $link .= "</a>";
         echo "<li>" . $link . "”有新回复</li>";
         unset($link);
     }
     echo "</ul>";
 }
Esempio n. 5
0
 protected function getConfig()
 {
     $db = new ConfigModel();
     $configList = $db->findAll();
     $config = $this->toSingle($configList);
     $this->c = $config;
     $this->assign('c', $config);
 }
Esempio n. 6
0
 public function index()
 {
     $db = new ConfigModel();
     $rs = $db->where("name='about'")->select();
     $this->assign('rs', $rs);
     $rs2 = $db->where("name='version'")->select();
     $this->assign('rs2', $rs2);
     $this->display("WapAdmin:about");
 }
Esempio n. 7
0
 /**
  * Formats currency for display, includes provided currency symbol or default
  * @param $value
  * @param $currency
  * @return string
  */
 public static function currencyFormat($currency, $value)
 {
     if ($currency == null) {
         $confMdl = new ConfigModel();
         $conf = $confMdl->get('general');
         $currency = $conf['curformat'];
     }
     return $currency . number_format($value, 2, ".", ",");
 }
Esempio n. 8
0
 /**
  *   Konstruktor
  */
 function __construct($dataArr, $finalArr)
 {
     parent::__construct($dataArr, $finalArr);
     require_once JPATH_COMPONENT . DS . 'models' . DS . 'config.php';
     $configModel = new ConfigModel();
     define('IGNORE_MERGE', $configModel->loadConfigValue('constant', 'OPTIMIZED_IGNORE_MERGE'));
     define('BOTTOM_MERGE_STEP', $configModel->loadConfigValue('constant', 'OPTIMIZED_BOTTOM_MERGE_STEP'));
     define('MAX_ARR_VALUES', $configModel->loadConfigValue('constant', 'OPTIMIZED_MAX_ARR_VALUES'));
 }
Esempio n. 9
0
 /**
  *  Výchozí inicializace - načtení potřebných tříd...
  */
 function __construct($updateMode = true)
 {
     require_once JPATH_COMPONENT . DS . 'models' . DS . 'expirience.php';
     $this->model = new ExpirienceModel();
     if ($updateMode) {
         require_once JPATH_COMPONENT . DS . 'models' . DS . 'config.php';
         $configModel = new ConfigModel();
         $this->autoPlusRatio = $configModel->loadConfigValue('constant', 'EXPIRIENCE_AUTO_RATIO');
         $this->userPlusRatio = $configModel->loadConfigValue('constant', 'EXPIRIENCE_USER_RATIO');
     }
 }
Esempio n. 10
0
 /**
  * Formats currency for display, includes provided currency symbol or default
  * @param $value
  * @return string
  */
 public function currencyFormat($value)
 {
     if ($this->currencyVals == null) {
         $confMdl = new ConfigModel();
         $conf = $confMdl->get('general');
         $this->currencyVals = explode('~', $conf['currencyformat']);
     }
     $formatted = number_format($value, $this->currencyVals[1], $this->currencyVals[2], $this->currencyVals[3]);
     if ($this->currencyVals[4] == 0) {
         return $this->currencyVals[0] . $formatted;
     } else {
         return $formatted . $this->currencyVals[0];
     }
 }
Esempio n. 11
0
 public function actionEdit()
 {
     $id = Yii::app()->request->getParam("id", '');
     $op = Yii::app()->request->getParam("op", '');
     if (!$id) {
         // ID不存在
         exit;
     }
     $adminModel = new AdminModel();
     $user = $adminModel->getById($id);
     $configModel = new ConfigModel();
     $hospitals = $configModel->getSetByType(Yii::app()->params['configType']['HOSPITAL']);
     $this->setPageTitle('编辑用户');
     $this->render('edit', array('user' => $user, 'hospitals' => $hospitals, 'op' => 'edit'));
 }
Esempio n. 12
0
 /**
  * @param string $themeName
  * @param string $lessFile
  * @return string
  */
 public function compileFile($themeName, $lessFile)
 {
     $model = Model::instance();
     $theme = $model->getTheme($themeName);
     $options = $theme->getOptionsAsArray();
     $configModel = ConfigModel::instance();
     $config = $configModel->getAllConfigValues($themeName);
     $less = "@import '{$lessFile}';";
     $less .= $this->generateLessVariables($options, $config);
     $css = '';
     try {
         require_once ipFile('Ip/Lib/less.php/Less.php');
         $themeDir = ipFile('Theme/' . $themeName . '/assets/');
         $ipContentDir = ipFile('Ip/Internal/Core/assets/ipContent/');
         // creating new context to pass theme assets directory dynamically to a static callback function
         $context = $this;
         $callback = function ($parseFile) use($context, $themeDir) {
             return $context->overrideImportDirectory($themeDir, $parseFile);
         };
         $parserOptions = array('import_callback' => $callback, 'cache_dir' => ipFile('file/tmp/less/'), 'relativeUrls' => false, 'sourceMap' => true);
         $parser = new \Less_Parser($parserOptions);
         $directories = array($themeDir => '', $ipContentDir => '');
         $parser->SetImportDirs($directories);
         $parser->parse($less);
         $css = $parser->getCss();
         $css = "/* Edit {$lessFile}, not this file. */" . "\n" . $css;
     } catch (\Exception $e) {
         ipLog()->error('Less compilation error: Theme - ' . $e->getMessage());
     }
     return $css;
 }
 public function GetConfig()
 {
     $dataset = parent::GetConfigProcess();
     foreach ($dataset as $var) {
         if ($var['cf_key'] == 'email_host') {
             $this->email_host = $var['cf_value'];
         } else {
             if ($var['cf_key'] == 'email_username') {
                 $this->email_username = $var['cf_value'];
             } else {
                 if ($var['cf_key'] == 'email_password') {
                     $this->email_password = $var['cf_value'];
                 } else {
                     if ($var['cf_key'] == 'email_port') {
                         $this->email_port = $var['cf_value'];
                     } else {
                         if ($var['cf_key'] == 'email_address') {
                             $this->email_address = $var['cf_value'];
                         } else {
                             if ($var['cf_key'] == 'email_name') {
                                 $this->email_name = $var['cf_value'];
                             } else {
                                 if ($var['cf_key'] == 'facebook_app_id') {
                                     $this->facebook_app_id = $var['cf_value'];
                                 } else {
                                     if ($var['cf_key'] == 'facebook_app_secret') {
                                         $this->facebook_app_secret = $var['cf_value'];
                                     } else {
                                         if ($var['cf_key'] == 'meta_title') {
                                             $this->meta_title = $var['cf_value'];
                                         } else {
                                             if ($var['cf_key'] == 'meta_description') {
                                                 $this->meta_description = $var['cf_value'];
                                             } else {
                                                 if ($var['cf_key'] == 'meta_sitename') {
                                                     $this->meta_sitename = $var['cf_value'];
                                                 } else {
                                                     if ($var['cf_key'] == 'meta_author') {
                                                         $this->meta_author = $var['cf_value'];
                                                     } else {
                                                         if ($var['cf_key'] == 'meta_keyword') {
                                                             $this->meta_keyword = $var['cf_value'];
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $this->facebook_status = $this->FacebookEnable();
     $this->email_status = $this->EmailEnable();
 }
Esempio n. 14
0
 public function render($data)
 {
     $db = new ConfigModel();
     $rs = $db->where("k='widget_douban'")->find();
     if ($rs['v'] != 1) {
         return;
     }
     $db = new ConfigModel();
     $rs = $db->where("k='douban_show'")->find();
     $douban_show = $rs['v'];
     if ($douban_show == '') {
         return;
     }
     echo "<h2>我的豆瓣</h2>";
     echo "<ul>";
     echo "<li>{$douban_show}</li>";
     echo "</ul>";
 }
Esempio n. 15
0
 /**
  * @param string $name
  * @param string $default
  * @param string $themeName
  * @return string
  */
 public function getThemeOption($name, $default = null, $themeName = null)
 {
     if (!$themeName) {
         $themeName = ipConfig()->theme();
     }
     $configModel = ConfigModel::instance();
     $value = $configModel->getConfigValue($themeName, $name, $default);
     return $value;
 }
Esempio n. 16
0
 /**
  *  Výchozí inicializace - načtení potřebných tříd...
  */
 function __construct()
 {
     require_once JPATH_COMPONENT . DS . 'library' . DS . 'StringClass.php';
     require_once JPATH_COMPONENT . DS . 'library' . DS . 'NumericClass.php';
     require_once JPATH_COMPONENT . DS . 'library' . DS . 'ExpirienceClass.php';
     require_once JPATH_COMPONENT . DS . 'models' . DS . 'config.php';
     $configModel = new ConfigModel();
     $constants = $configModel->loadConfigs('matchRate');
     if (count($constants) > 0) {
         foreach ($constants as $constant) {
             define($constant->name, $constant->value);
         }
     }
     $this->expClass = new ExpirienceClass(false);
     $this->xgramLength = $configModel->loadConfigValue('constant', 'COLUMN_XGRAM_LENGTH');
     $this->minusInf = $configModel->loadConfigValue('constant', 'MINUS_INFINITE');
     $this->plusInf = $configModel->loadConfigValue('constant', 'PLUS_INFINITE');
 }
Esempio n. 17
0
 public function actionIndex()
 {
     $this->currentMenu = '1000';
     // 获取病历总条数
     // 限制医院权限
     $mHospital = $this->_userInfo['hospital'];
     $shareModel = new ShareModel();
     $shareSet = $shareModel->getTargetSetByCode($mHospital);
     if ($shareSet) {
         $inArray = array_keys($shareSet);
     }
     $hospitalModel = new ConfigModel();
     $allHos = $hospitalModel->getSetByType(Yii::app()->params['configType']['HOSPITAL']);
     $hospitals = $allHos;
     //查询
     $c = new CDbCriteria();
     if ($this->_userInfo['role'] > 0) {
         $c->addInCondition('HOSPITAL', $inArray);
         $hospitals = array();
         foreach ($inArray as $value) {
             $hospitals[$value] = $allHos[$value];
         }
     }
     $hospitalModel = new ConfigModel();
     $hospitals = $hospitalModel->getSetByType(Yii::app()->params['configType']['HOSPITAL']);
     $jcxxModel = new JcxxModel();
     //总数
     $total = $jcxxModel->count($c);
     $totals = $jcxxModel->getPatientGroupTotal();
     $data = array();
     if ($totals) {
         foreach ($totals as $value) {
             $item = array();
             $item['value'] = $value['total'];
             $item['label'] = $hospitals[$value['hospital']];
             $item['color'] = '#F7464A';
             $item['highlight'] = '#FF5A5E';
             $data[] = $item;
         }
     }
     $this->render('index', array('userinfo' => $this->_userInfo, 'total' => $total, 'data' => json_encode($data), 'hospitals' => $hospitals));
 }
Esempio n. 18
0
 function detail($album_id)
 {
     $detail = M('photo_album')->find(intval($album_id));
     if ($detail) {
         $detail['type_name'] = ConfigModel::album_types($detail['type'], true);
         if (empty($detail['type_name'])) {
             $detail['type_name'] = '其它';
         }
     }
     return $detail;
 }
Esempio n. 19
0
 public function save()
 {
     //dump($_POST);exit;
     if ($_POST['about'] == '' and $_POST['about_text'] == '') {
         $this->error('签名或者内容不能为空!');
     }
     $db = new ConfigModel();
     import('ORG.Util.Input');
     if (!$db->autoCheckToken($_POST)) {
         $this->error('非法提交!');
     }
     unset($_POST['Submit']);
     unset($_POST['__hash__']);
     foreach ($_POST as $k => $v) {
         $map['k'] = $k;
         $data['v'] = str_replace('\\', '', str_replace("&quot;", '', $v));
         $db->where($map)->save($data);
         unset($map);
         unset($data);
     }
     $this->redirect('About/index');
 }
Esempio n. 20
0
 public function callback()
 {
     $c = $this->getConfig();
     include_once 'Public/Oauth/sinaWeiboOauth.php';
     $o = new WeiboOAuth($c['WB_AKEY'], $c['WB_SKEY'], $_SESSION['keys']['oauth_token'], $_SESSION['keys']['oauth_token_secret']);
     $last_key = $o->getAccessToken($_REQUEST['oauth_verifier']);
     //dump($last_key);
     $db = new ConfigModel();
     $data['k'] = 'sina_oauth_token';
     $data['v'] = $last_key['oauth_token'];
     $db->where("k='sina_oauth_token'")->save($data);
     unset($data);
     $data['k'] = 'sina_oauth_secret';
     $data['v'] = $last_key['oauth_token_secret'];
     $db->where("k='sina_oauth_secret'")->save($data);
     if (!empty($last_key['user_id'])) {
         $this->assign('jumpUrl', "__APP__");
         $this->success('恭喜你,验证通过!');
     } else {
         $this->assign('jumpUrl', "__APP__");
         $this->error('验证失败,请检查用户名或者密码是否正确。并返回重新验证!');
     }
 }
Esempio n. 21
0
 public static function ipBeforeController()
 {
     $configModel = ConfigModel::instance();
     if ($configModel->isInPreviewState()) {
         ipAddJsVariable('ipRepositoryUrl', ipFileUrl('file/repository/'));
         static::initConfig();
     }
     $lessCompiler = LessCompiler::instance();
     if (ipConfig()->isDevelopmentEnvironment()) {
         if ($lessCompiler->shouldRebuild(ipConfig()->theme())) {
             $lessCompiler->rebuild(ipConfig()->theme());
         }
     }
 }
Esempio n. 22
0
 public function contactMail()
 {
     // V�rifie l'adresse mail
     if (!filter_var($_POST['sMail'], FILTER_VALIDATE_EMAIL)) {
         return 1;
     }
     // V�rifie le t�l�phone
     $sTel = StrModel::is_NumPortable($_POST['sMobile']);
     if (!$sTel) {
         return 2;
     }
     if (!StrModel::strMinLen($_POST['sNom'], 2)) {
         return 3;
     }
     // Vérifie le nom
     if (!StrModel::strMinLen($_POST['sPrenom'], 2)) {
         return 4;
     }
     // Vérifie le prénom
     if (!StrModel::strMinLen($_POST['sMessage'], 30)) {
         return 5;
     }
     // Vérifie le message
     // r�cup�ration du mail � contacter
     if ($_POST['sContact'] == 'commercial') {
         $sMail = ConfigModel::get(4, 0);
         $sLogCat = 2;
     } else {
         $sMail = ConfigModel::get(3, 0);
         $sLogCat = 1;
     }
     // Formatage du nom / prénom
     $_POST['sNom'] = strtoupper($_POST['sNom']);
     $_POST['sPrenom'] = ucfirst(strtolower($_POST['sPrenom']));
     $sWho = $_POST['sCivilite'] . ' ' . $_POST['sNom'] . ' ' . $_POST['sPrenom'];
     // Log l'action
     LogModel::logThis($sLogCat, array($sMail, $_POST['sMail'], $sWho, $_POST['sLogin'], $sTel, $_POST['sMotif'], $_POST['sMessage']));
     // Construit le mail
     $aMessage = array('Envoyé depuis le formulaire de contact [ ' . $_POST['sContact'] . ' ]', '', 'Date: ' . date('d-m-Y - H:i'), 'Éméteur: ' . $sWho, 'Login: '******'sLogin'], 'Mobile: ' . $sTel, 'Mail: ' . $_POST['sMail'], 'Motif: ' . $_POST['sMotif'], '', 'Message:', '', $_POST['sMessage']);
     // Envoie le mail
     if (!$this->sendMail($sWho, $_POST['sMail'], $_POST['sContact'], 'Support ' . $_POST['sContact'], $aMessage)) {
         return 6;
     } else {
         return 7;
     }
 }
Esempio n. 23
0
 public function index()
 {
     $vars = $_REQUEST;
     if (!isset($vars['original'])) {
         $vars['original'] = -1;
     }
     $size = 16;
     $total = PhotoAModel::visiable($vars, true);
     $Page = new Newpage($total, $size);
     $photos = PhotoAModel::visiable($vars, false, $Page->limit);
     foreach ($photos as &$row) {
         $row['user'] = model('User')->formatForApi($row, $row['userId']);
     }
     //$this->ajaxReturn($photos);
     $this->assign('photos', $photos);
     $this->assign('album_types', ConfigModel::album_types());
     $this->assign($vars);
     $this->assign('page', $Page->getPage());
     $this->display();
 }
Esempio n. 24
0
<div style="padding: 10px;">
    <?php 
if ($package) {
    ?>
        <div class="padB10">
            <div class="padL10 padT10 fontB">
                <?php 
    echo $package->name;
    ?>
            </div>
            <div class="padT10 padL10">
                <?php 
    if ($this->isPromotion) {
        $model = ConfigModel::model()->findByPk(1);
        echo $model->value;
    } else {
        echo $package->description;
    }
    ?>
            </div>
        </div>
        <div>
            <?php 
    $form = $this->beginWidget('CActiveForm', array('action' => Yii::app()->baseUrl . '/account/doRegister', 'id' => 'subscribe-form', 'enableAjaxValidation' => false));
    ?>
            <?php 
    echo CHtml::hiddenField('phoneNumber', '');
    ?>
            <?php 
    echo CHtml::hiddenField('id', $package->id);
    ?>
Esempio n. 25
0
 protected function getConfig($condition)
 {
     $db = new ConfigModel();
     if ($condition == '') {
         $configList = $db->where("r=1")->select();
     } elseif ($condition == 'all') {
         $configList = $db->findAll();
     } else {
         $configList = $db->where("k='{$condition}'")->select();
     }
     foreach ($configList as $item) {
         $config[$item['k']] = $item['v'];
     }
     return $config;
 }
Esempio n. 26
0
		// As above, the exec line will trigger this catch if this check is not in place, giving false positives in the results.
		if(strrpos($m, '_') + 1 != strlen($m)){
			$matches[] = $m;

			// If this match contains _N_, then also add _0_ for 0 results and _1_ for 1 result.
			if(substr_count($m, '_N_') === 1){
				$matches[] = str_replace('_N_', '_0_', $m);
				$matches[] = str_replace('_N_', '_1_', $m);
			}
		}
	}
}

// Pull all the configuration options for this component
// These get transposed to STRING_CONFIG_config_name_blah
$configs = ConfigModel::Find(['component = ' . $configKey]);
foreach($configs as $c){
	/** @var ConfigModel $c */
	$key = \Core\i18n\I18NLoader::KeyifyString($c->get('key'));
	$matches[] = 'STRING_CONFIG_' . $key;
	$matches[] = 'MESSAGE_CONFIG_' . $key;
}

// Give me permissions!
if($comp){
	foreach($comp->getPermissions() as $key => $p){
		$key = \Core\i18n\I18NLoader::KeyifyString($key);
		$matches[] = 'STRING_PERMISSION_' . $key;
		//$matches[] = 'MESSAGE_CONFIG_' . $key;
	}
}
Esempio n. 27
0
 /**
  * Put a setting value, using section name, key, value
  * @param $name
  * @param $key
  * @param $value
  * @return bool|mixed
  */
 public static function putValue($name, $key, $value)
 {
     $configMdl = new ConfigModel();
     $data = $configMdl->get($name);
     if ($data === false) {
         return false;
     }
     if (!($result = json_decode($data[0]['data']))) {
         return false;
     }
     $result->{$key} = $value;
     if ($configMdl->edit($name, json_encode($result)) === false) {
         return false;
     }
     return true;
 }
Esempio n. 28
0
<div style="padding: 0px 5px;">
    <div class="fontB">
        <?php 
echo Yii::t('chachawap', 'Đăng ký Gói cước iMuzik3G');
?>
    </div>
    <div class="padT10 padL5">
        <?php 
$flag = false;
if (!empty($userObj)) {
    $isKM10days = false;
    if (time() > strtotime('2013-04-15') && time() < strtotime('2013-12-31 23:59:59') && Yii::app()->user->getState('msisdn')) {
        $isKM10days = WapUserTransactionModel::checkTrial10Days(Formatter::formatPhone(Yii::app()->user->getState('msisdn')));
    }
    if ($isKM10days && $userObj->status == 1) {
        $model = ConfigModel::getConfig('SUCCESS_10DAYS_TRIAL');
        $date_free = date('d/m/Y', time() + 24 * 3600 * 10);
        echo Yii::t('wap', $model, array('{DATE}' => $date_free));
    } else {
        echo Yii::t('wap', 'Chúc mừng Quý khách đã đăng ký thành công dịch vụ Imuzik 3G. Phí thuê bao 10.000đ/tháng, miễn phí data, miễn phí tải nhạc và video không giới hạn. Trân trọng cảm ơn!');
    }
} else {
    if (!empty($result) && $result->errorCode != 0) {
        echo $msg = Yii::t('wap', Yii::app()->params['subscribe'][$result->message]);
    } else {
        $flag = true;
        if ($isKm) {
            echo "Quý khách được khuyến mại 10 ngày dùng thử miễn phí dịch vụ Imuzik3G, miễn phí cước data (3G/GPRS), miễn phí nghe, tải nhạc chất lượng cao không giới hạn số lượng.";
        } else {
            echo $package->description;
        }
Esempio n. 29
0
 protected function save()
 {
     //dump($_POST);exit;
     $db = new ConfigModel();
     if (!$db->autoCheckToken($_POST)) {
         $this->error('非法提交!');
     }
     unset($_POST['Submit']);
     unset($_POST['__hash__']);
     foreach ($_POST as $k => $v) {
         $map['k'] = $k;
         $data['v'] = str_replace('\\', '', str_replace("&quot;", '', $v));
         $db->where($map)->save($data);
         unset($map);
         unset($data);
     }
     //$this->redirect('Setting/index');
 }
Esempio n. 30
0
 /**
  * 获取数据
  * @param $channel
  */
 private function retrieveData($channel = null)
 {
     $ret = array('channel' => $channel, 'time' => $this->timestamp);
     // Load config
     $config = new ConfigModel();
     $ret['config'] = $config->getConfig($this->lang);
     unset($config);
     // Load levels
     $level = new LevelModel();
     $levels = array();
     foreach ($level->getAllLevels() as $level) {
         $levels[$level->level] = array('min' => $level->min_exp, 'max' => $level->max_exp);
     }
     $ret['config']->levels = (object) $levels;
     unset($level, $levels);
     // Load Store Data
     $store = new StoreModel($this->lang);
     $ret['config']->store = $store->getData();
     unset($store);
     $ret['data'] = new stdClass();
     $ret['data']->state = 'ok';
     $ret['data']->call_id = isset($this->input->call_id) ? substr($this->input->call_id, 4) : microtime();
     $ret['data']->data_hash = md5(rand(100, 10000));
     Session::instance()->set('data_hash', $ret['data']->data_hash);
     $ret['data']->swf_version = isset($this->input->swf_version) ? $this->input->swf_version : 85;
     $ret['data']->map = array();
     $ret['data']->storage = array();
     $ret['data']->gifts = array();
     $ret['data']->neighbors = array();
     $ret['data']->all_neighbors = array();
     // Check User wether inited.
     $user = new UserModel();
     $userinfo = $user->getUserById($this->uid);
     if ($userinfo) {
         $diff_time = $this->timestamp - strtotime($userinfo->logintime);
         // 用户每天登陆的奖励
         if ($diff_time > self::EVERY_DAY_LOGIN_DIFF_TIME) {
             // 更新用户的钱
             $this->debugMsg("diff_time=" . $diff_time);
             $userinfo->lottery_coins = self::EVERY_DAY_LOGIN_IN_AWARD;
             $updateData = array('coins' => $userinfo->coins + self::EVERY_DAY_LOGIN_IN_AWARD, 'logintime' => date('Y-m-d H:i:s'));
             $user->updateUser($this->uid, $updateData);
             //更新用户的金币
         } else {
             $updateData = array('logintime' => date('Y-m-d H:i:s'));
             $user->updateUser($this->uid, $updateData);
             //更新用户的logintime
         }
         // Load User Maps
         $ret['data']->map = $this->getUserMaps($this->uid);
         // Load User storage
         $storage = new StorageModel();
         $ret['data']->storage = (object) $storage->getUserStoragesByUid($this->uid);
         unset($storage);
         // Load User Gifts
         $gift = new GiftsModel();
         $gifts_list = $gift->getNewGiftByUidForRetrieve($this->uid);
         $gifts_list_re = array();
         foreach ($gifts_list as $k => $v) {
             $gifts_list_re[$v->itemid] = $v->qty;
         }
         $this->debugMsg($gifts_list);
         $ret['data']->gifts = (object) $gifts_list_re;
         $this->debugMsg($gift->getLastQuery());
         unset($gift);
         // Load User Neighbors
         $ret['data']->all_neighbors[] = $this->syncUserNeighbors($this->input->fids);
         $neighbor = new NeighborsModel();
         $ret['data']->neighbors = $neighbor->getNeighborsByUid($this->uid);
         unset($neighbor);
         $ret['data']->show_tutorial = 1;
         //TODO
         $ret['data']->items = array();
         $ret['data']->coins = $userinfo->coins;
         $ret['data']->level = $userinfo->level;
         $ret['data']->experience = $userinfo->experience;
         $ret['data']->size_x = $userinfo->size_x;
         $ret['data']->size_y = $userinfo->size_x;
         $ret['data']->reward_points = $userinfo->reward_points;
         $ret['data']->op = $userinfo->op;
         $ret['data']->top_map_size = $userinfo->top_map_size;
         $ret['data']->max_work_area_size = $userinfo->max_work_area_size;
         $ret['data']->work_area_size = $userinfo->work_area_size;
         $ret['data']->lottery_coins = $userinfo->lottery_coins;
         $ret['data']->feed_data = false;
         $ret['data']->news = false;
         $ret['data']->show_gifts_page = false;
         $ret['data']->stories = array();
         $ret['data']->items_received = array();
         $ret['data']->ask_for_materials = array();
         $ret['data']->ask_for_help = array();
         $ret['data']->friend_helped = false;
         $ret['data']->gifts_received = array();
     } else {
         $data = array('uid' => $this->uid, 'email' => '', 'level' => 1, 'experience' => 0, 'coins' => self::INIT_COINS, 'op' => 0, 'reward_points' => self::INIT_RC, 'logintime' => date('Y-m-d H:i:s'), 'loginip' => '', 'status' => 1);
         $user->add($data);
         $ret['data']->show_tutorial = 0;
         //TODO
         $ret['data']->coins = self::INIT_COINS;
         $ret['data']->items = array();
         $ret['data']->level = 1;
         $ret['data']->experience = 0;
         $ret['data']->size_x = 60;
         $ret['data']->size_y = 60;
         $ret['data']->reward_points = self::INIT_RC;
         $ret['data']->op = 0;
         $ret['data']->top_map_size = 0;
         $ret['data']->max_work_area_size = 1;
         $ret['data']->work_area_size = 1;
         $ret['data']->lottery_coins = 0;
         $ret['data']->feed_data = false;
         $ret['data']->news = false;
         $ret['data']->show_gifts_page = false;
         $ret['data']->stories = array();
         $ret['data']->items_received = array();
         $ret['data']->ask_for_materials = array();
         $ret['data']->ask_for_help = array();
         $ret['data']->friend_helped = false;
         $ret['data']->gifts_received = array();
         $ret['data']->storage = (object) array(15 => '5', 16 => '5');
         // 将平台好友导入为邻居
         $ret['data']->all_neighbors[] = $this->syncUserNeighbors($this->input->fids, true);
         $neighbor = new NeighborsModel();
         $ret['data']->neighbors = $neighbor->getNeighborsByUid($this->uid);
         unset($neighbor);
         //
         $mapData = $this->initUserMapData();
         $ret['data']->map = $mapData;
     }
     unset($model);
     if ($this->debug) {
         $ret['demsg'] = $this->demsg;
     }
     return $ret;
 }