示例#1
0
文件: RenderInfo.php 项目: deale/dt
 public function renderInfo($block = 'general', $itype = self::INFO_VIEW)
 {
     $show = '';
     $a_return = [];
     $sesinfo = \Components\Session::getSession('info');
     if ($block == 'general' and $sesinfo) {
         foreach ($sesinfo as $key => $arr) {
             self::$_infoBlock[$block][$key] = array_unique(array_merge(isset(self::$_infoBlock[$block][$key]) ? self::$_infoBlock[$block][$key] : [], $arr));
         }
         \Components\Session::unsetSession('info');
     }
     if (isset(self::$_infoBlock[$block])) {
         foreach ((array) self::$_infoBlock[$block] as $type => $value) {
             foreach (array_unique(self::$_infoBlock[$block][$type]) as $info) {
                 //$text = ( ( $info[0] == '_' ) ? \Components\Translate\Translate::t( $info ) : $info );
                 $text = \Components\Translate\Translate::t($info);
                 if ($itype == self::INFO_RETURN) {
                     $a_return[$block] = $text;
                 } else {
                     ob_start();
                     $box_name = 'Infobox';
                     include $this->getBoxPath($box_name);
                     $show .= ob_get_clean();
                 }
             }
             unset(self::$_infoBlock[$block][$type]);
         }
     }
     if ($itype == self::INFO_RETURN) {
         return $a_return;
     } else {
         echo $show;
     }
 }
示例#2
0
文件: User.php 项目: deale/dt
 protected function prepareUser()
 {
     if (!($id = \Components\Session::getSession('user_id'))) {
         exit(header('Location: /account/authorize'));
     }
     $user = new \App\Models\User();
     $this->user = $user->initRel(['country', 'group'])->findByPk($id)->getValuesAllField();
     $this->setVar('user', $this->user);
 }
示例#3
0
 protected function setSuccessAndRedirect($info, $redirect)
 {
     $sesinfo = \Components\Session::getSession('info');
     $sesinfo['success'][] = $info;
     \Components\Session::setSession('info', $sesinfo);
     exit(header('Location: ' . $redirect));
 }