public function ToString()
    {
        $String = '';
        ob_start();
        ?>
      <div class="Box">
         <h4><?php 
        echo T('In this Discussion');
        ?>
</h4>
         <ul class="PanelInfo">
         <?php 
        foreach ($this->_UserData->Result() as $User) {
            ?>
            <li>
               <strong><?php 
            echo UserAnchor($User, 'UserLink');
            ?>
</strong>
               <?php 
            echo Gdn_Format::Date($User->DateLastActive);
            ?>
            </li>
            <?php 
        }
        ?>
         </ul>
      </div>
      <?php 
        $String = ob_get_contents();
        @ob_end_clean();
        return $String;
    }
 public function SettingsController_Sitemaps_Create($Sender)
 {
     $Sender->Permission('Garden.Settings.Manage');
     $Sender->SetData('Title', T('Sitemap Settings'));
     $Sender->AddSideMenu();
     $Sender->Render('Settings', '', 'plugins/Sitemaps');
 }
 /**
  * Display the embedded forum.
  * 
  * @since 2.0.18
  * @access public
  */
 public function Index()
 {
     $this->AddSideMenu('dashboard/embed');
     $this->Title('Embed Vanilla');
     $this->Form = new Gdn_Form();
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
     $ConfigurationModel->SetField(array('Garden.TrustedDomains'));
     $this->Form->SetModel($ConfigurationModel);
     if ($this->Form->AuthenticatedPostBack() === FALSE) {
         // Format trusted domains as a string
         $TrustedDomains = GetValue('Garden.TrustedDomains', $ConfigurationModel->Data);
         if (is_array($TrustedDomains)) {
             $TrustedDomains = implode("\n", $TrustedDomains);
         }
         $ConfigurationModel->Data['Garden.TrustedDomains'] = $TrustedDomains;
         // Apply the config settings to the form.
         $this->Form->SetData($ConfigurationModel->Data);
     } else {
         // Format the trusted domains as an array based on newlines & spaces
         $TrustedDomains = $this->Form->GetValue('Garden.TrustedDomains');
         $TrustedDomains = explode(' ', str_replace("\n", ' ', $TrustedDomains));
         $TrustedDomains = array_unique(array_map('trim', $TrustedDomains));
         $this->Form->SetFormValue('Garden.TrustedDomains', $TrustedDomains);
         if ($this->Form->Save() !== FALSE) {
             $this->InformMessage(T("Your settings have been saved."));
         }
         // Reformat array as string so it displays properly in the form
         $this->Form->SetFormValue('Garden.TrustedDomains', implode("\n", $TrustedDomains));
     }
     $this->Render();
 }
 public function ToString()
 {
     if ($this->_UserData->NumRows() == 0) {
         return '';
     }
     $String = '';
     ob_start();
     ?>
   <div class="Box">
      <?php 
     echo panelHeading(T('In this Discussion'));
     ?>
      <ul class="PanelInfo">
         <?php 
     foreach ($this->_UserData->Result() as $User) {
         ?>
            <li>
               <?php 
         echo Anchor(Wrap(Wrap(Gdn_Format::Date($User->DateLastActive, 'html')), 'span', array('class' => 'Aside')) . ' ' . Wrap(Wrap(GetValue('Name', $User), 'span', array('class' => 'Username')), 'span'), UserUrl($User));
         ?>
            </li>
         <?php 
     }
     ?>
      </ul>
   </div>
   <?php 
     $String = ob_get_contents();
     @ob_end_clean();
     return $String;
 }
 public function index($currency = '')
 {
     $data['result'] = get_result('currency');
     $data['currency'] = $currency;
     $this->assign($data);
     $this->display(T('Common@Widget/Currency/index'));
 }
Example #6
0
function user($attr = null, $value = null)
{
    if (!isset($_SESSION['login_user'])) {
        return false;
    }
    if ($attr == 'local_map' && !isset($_SESSION['login_user']['local_map'])) {
        $_SESSION['login_user']['local_map'] = T('local_map')->with('admin_id', user('id'))->select();
    }
    if ($attr === null) {
        return true;
    }
    if ($value === null) {
        // read user info
        if ($attr == 'type_label') {
            switch ($_SESSION['login_user']['type']) {
                case 'ngo':
                    return '公益组织';
                    break;
                case 'ind':
                    return '公益人';
                    break;
                case 'csr':
                    return '企业';
                    break;
                case 'fund':
                    return '基金会';
                    break;
            }
        }
        return $_SESSION['login_user'][$attr];
    } else {
        //write user info
        $_SESSION['login_user'][$attr] = $value;
    }
}
 /**
  * Settings page.
  */
 public function PluginController_ShareThis_Create($Sender)
 {
     $Sender->Permission('Garden.Settings.Manage');
     $Sender->Title('ShareThis');
     $Sender->AddSideMenu('plugin/sharethis');
     $Sender->Form = new Gdn_Form();
     $PublisherNumber = C('Plugin.ShareThis.PublisherNumber', 'Publisher Number');
     $ViaHandle = C('Plugin.ShareThis.ViaHandle', '');
     $CopyNShare = C('Plugin.ShareThis.CopyNShare', false);
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
     $ConfigArray = array('Plugin.ShareThis.PublisherNumber', 'Plugin.ShareThis.ViaHandle', 'Plugin.ShareThis.CopyNShare');
     if ($Sender->Form->AuthenticatedPostBack() === FALSE) {
         $ConfigArray['Plugin.ShareThis.PublisherNumber'] = $PublisherNumber;
         $ConfigArray['Plugin.ShareThis.ViaHandle'] = $ViaHandle;
         $ConfigArray['Plugin.ShareThis.CopyNShare'] = $CopyNShare;
     }
     $ConfigurationModel->SetField($ConfigArray);
     $Sender->Form->SetModel($ConfigurationModel);
     // If seeing the form for the first time...
     if ($Sender->Form->AuthenticatedPostBack() === FALSE) {
         // Apply the config settings to the form.
         $Sender->Form->SetData($ConfigurationModel->Data);
     } else {
         // Define some validation rules for the fields being saved
         $ConfigurationModel->Validation->ApplyRule('Plugin.ShareThis.PublisherNumber', 'Required');
         if ($Sender->Form->Save() !== FALSE) {
             $Sender->InformMessage(T("Your changes have been saved."));
         }
     }
     $Sender->Render('sharethis', '', 'plugins/ShareThis');
 }
   /**
    * Check a password against a stored password.
    *
    * The stored password can be plain, a md5 hash or a phpass hash.
    * If the password wasn't a phppass hash, the Weak property is set to True.
    *
    * @param string $Password
    * @param string $StoredHash
    * @param string $Method
    * @param string $Username
    * @return boolean
    */
   function CheckPassword($Password, $StoredHash, $Method = FALSE, $Username = NULL) {
      $Result = FALSE;
		switch(strtolower($Method)) {
         case 'django':
            $Result = $this->CheckDjango($Password, $StoredHash);
            break;
         case 'phpbb':
            require_once(PATH_LIBRARY.'/vendors/phpbb/phpbbhash.php');
            $Result = phpbb_check_hash($Password, $StoredHash);
            break;
         case 'reset':
            throw new Gdn_UserException(sprintf(T('You need to reset your password.', 'You need to reset your password. This is most likely because an administrator recently changed your account information. Click <a href="%s">here</a> to reset your password.'), Url('entry/passwordrequest')));
            break;
         case 'smf':
            $Result = (sha1(strtolower($Username).$Password) == $StoredHash);
            break;
			case 'vbulletin':
            // assume vbulletin's password hash has a fixed length of 32, the salt length will vary between version 3 and 4
            $SaltLength = strlen($StoredHash) - 32;
            $Salt = trim(substr($StoredHash, -$SaltLength, $SaltLength));
            $VbStoredHash = substr($StoredHash, 0, strlen($StoredHash) - $SaltLength);
            
				$VbHash = md5(md5($Password).$Salt);
				$Result = $VbHash == $VbStoredHash;
				break;
			case 'vanilla':
			default:
				$Result = $this->CheckVanilla($Password, $StoredHash);
		}
		
		return $Result;
   }
Example #9
0
 /**
  * @brief 执行登录逻辑
  *
  * @return 
  */
 public function actionLogin()
 {
     // 如果用户已经登录
     if ($this->isLogin()) {
         return $this->showJSON(true);
     }
     $form = $this->form('post');
     $username = trim($form['username']);
     $password = $form['password'];
     if (!$username || !$password) {
         return $this->showJSON('请填写用户名和密码');
     }
     // 验证用户一卡通和密码是否匹配
     if (!$this->verify($username, $password)) {
         return $this->showJSON('卡号密码不匹配');
     }
     // 以一卡通号获取gapper用户信息
     try {
         $info = self::getRPC()->gapper->user->getUserByIdentity(self::$identitySource, $username);
     } catch (\Exception $e) {
     }
     if ($info['id']) {
         // 用户已经存在,正常登录
         $result = \Gini\Gapper\Client::loginByUserName($info['username']);
         if ($result) {
             return $this->showJSON(true);
         }
         return $this->showJSON(T('Login failed! Please try again.'));
     }
 }
 function savepsw()
 {
     $objData = array('psw' => $this->_post('psw', ''));
     //内容规则检查
     T('content/validate');
     $validate = array(array('psw', 'min_length', '密码长度必须大于4位', 4));
     if (!validate::check($validate, $objData)) {
         $this->JsonReturn(validate::getError());
     }
     if ($objData['psw'] != $this->_post('repsw')) {
         $this->JsonReturn('两次密码不一致,请检查');
     }
     if ($objData['psw']) {
         $psw = D('admin')->setUserPassword($objData['psw']);
         if ($psw != steadmin::$adminInfo['psw']) {
             D('steadmin')->update(array('psw' => $psw), array('user_id' => steadmin::$adminInfo['user_id']));
             D('steadmin')->setUserLogin(array('user_id' => steadmin::$adminInfo['user_id'], 'psw' => $psw), 0, false);
             //===记录操作日志====
             parent::saveSySLog(2, array(), 0, array('user_id' => steadmin::$adminInfo['user_id']), '修改密码-编辑');
             //===记录操作日志====
             $this->JsonReturn('操作成功', null, 1);
         }
     }
     $this->JsonReturn('密码未变更', null, 0);
 }
 /**
  * 模板显示 调用内置的模板引擎显示方法,
  * @access protected
  * @param string $templateFile 指定要调用的模板文件
  * @return void
  */
 protected function display($template)
 {
     $file = T('Addons://' . parse_name($_GET['_addons'], 1) . '@./' . ucfirst($_GET['_controller']) . '/' . $_GET['_action']);
     define('IS_ADDON', true);
     parent::display($file);
     // 重要:要避免陷入$this->display()循环
 }
 public function render($uid = 0, $page = 1, $tab = null, $count = 10)
 {
     !$uid && ($uid = is_login());
     //查询条件
     $map['uid'] = $uid;
     $NewsModel = new NewsModel();
     /* 获取当前分类下资讯列表 */
     if ($uid != is_login()) {
         $map['status'] = 1;
         $map['dead_line'] = array('gt', time());
     }
     list($list, $totalCount) = $NewsModel->getListByPage($map, $page, 'update_time desc', '*', $count);
     foreach ($list as &$val) {
         if ($val['status'] == 1) {
             $val['audit_status'] = '<span style="color: green;">审核通过</span>';
         } elseif ($val['status'] == 2) {
             $val['audit_status'] = '<span style="color:#4D9EFF;">待审核</span>';
         } elseif ($val['status'] == -1) {
             $val['audit_status'] = '<span style="color: #b5b5b5;">审核失败</span>';
         }
     }
     unset($val);
     /* 模板赋值并渲染模板 */
     $this->assign('news_list', $list);
     $this->assign('totalCount', $totalCount);
     $this->display(T('News@Widget/ucenterblock'));
 }
 public function index($product_id, $Month = '', $moudel = '')
 {
     if (!$product_id) {
         $product_id = 0;
     }
     $map['product_id'] = $product_id;
     $result = get_result('product_price', $map);
     if ($Month) {
         $Montht = $Month;
     } else {
         $Montht = date('Y-m-d');
     }
     $Monthts = date('t', strtotime($Montht));
     foreach ($result as $k => $row) {
         $data[] = array('id' => $row['id'], 'title' => $row['type1_price'], 'start' => date('Y-m-d', $row['day']), 'name' => date('Y-m-d H:i', $row['day']), 'textColor' => '#0FDECF');
     }
     for ($im = 1; $im <= $Monthts; $im++) {
         $map['day'] = strtotime(date('Y-m-d', $row['day']));
         $description_info = get_info('product_description', $map);
         if ($description_info) {
             $data[] = array('id' => $description_info['id'], 'title' => $row['type1_price'], 'start' => date('Y-m-d', $description_info['day']), 'name' => date('Y-m-d H:i', $description_info['day']), 'textColor' => '#0FDECF');
         } else {
             $data[] = array('id' => '0', 'title' => '设定价格', 'start' => date('Y-m', strtotime($Montht)) . "-" . $im, 'name' => date('Y-m', strtotime($Montht)) . "-" . $im, 'textColor' => '#0FDECF');
         }
     }
     $datas['data'] = json_encode($data);
     $this->assign($map);
     $this->assign($datas);
     $this->display(T('Common@Widget/ProductPrice/index'));
 }
 public function lineAction()
 {
     header("Content-Type:text/html; charset=UTF-8");
     $res = $this->achievementAction(10000);
     $rebate = D('Rebate');
     $key = 1;
     $res = $rebate->init($key);
     $Page = new \Think\Page(count($res), 10);
     // 实例化分页类 传入总记录数和每页显示的
     $Page->setConfig('theme', '%FIRST% %UP_PAGE% %HEADER% %DOWN_PAGE% %END%');
     $Page->setConfig('header', '<span class="rows">共 %TOTAL_ROW% 个返点</span>%LINK_PAGE%<span class="currentrows">当前第 %NOW_PAGE% 页</span>');
     $show = $Page->show();
     // 分页显示输出
     $this->assign('page', $show);
     // 赋值分页输出
     foreach ($res as $key => $value) {
         $res[$key]['actionUrl']['edit'] = U('Rebate/Edit/line?id=' . $value['id']);
         $res[$key]['actionUrl']['delete'] = U('Rebate/Delete/line?id=' . $value['id']);
     }
     $this->assign('rebate', $res);
     $this->assign('urlAdd', U('Rebate/Add/line'));
     $TPL = T('Rebate@Index/index');
     $this->assign('YZRight', $this->fetch($TPl));
     $this->display(YZ_TEMPLATE);
 }
Example #15
0
 private function reward()
 {
     //$event_arr = array('login_everyday','post_comment','been_comment','post_share','post_video','forward_share','been_like','been_like_album','add_like','add_like_album','email_active','create_avatar');
     $this->ajax_check_login();
     $ptx_event_log = spClass('ptx_event_log');
     $start_time = time() - 5 * 24 * 3600;
     $ptx_event_log->clean_log($this->current_user['user_id'], $start_time);
     $conditions['to_user_id'] = $this->current_user['user_id'];
     $conditions['event_type'] = 'reward';
     $conditions['is_read'] = '0';
     $conditions['event_code'] = array('login_everyday', 'post_comment', 'post_share', 'post_video', 'forward_share', 'add_like', 'add_like_album', 'email_active', 'create_avatar');
     $logs = $ptx_event_log->search_no_page($conditions);
     $credit_strategy = $this->settings['credit_strategy'];
     $messages = array();
     foreach ($logs as $log) {
         $msg = T($log['event_code']) . ' ';
         for ($i = 1; $i <= 3; $i++) {
             if ($ext_credits = $credit_strategy[$log['event_code'] . '_credits_' . $i]) {
                 $msg .= T("ext_credits_{$i}") . ' +' . $ext_credits . ' ';
             }
         }
         $messages[] = $msg;
     }
     $conditions_update['to_user_id'] = $this->current_user['user_id'];
     $conditions_update['event_type'] = 'reward';
     $conditions_update['is_read'] = '0';
     $ptx_event_log->update($conditions_update, array('is_read' => 1));
     $this->ajax_success_response($messages, 'tip');
 }
Example #16
0
 /**
  * Class constructor. Defines the related database table name.
  */
 public function __construct()
 {
     $dbUser = c('VWP.Database.User', c('Database.User'));
     $dbPassword = c('VWP.Database.Password', $dbUser === c('Database.User') ? c('Database.Password') : '');
     $dbName = c('VWP.Database.Name', c('Database.Name'));
     $dbPrefix = c('VWP.Database.Prefix', 'wp_');
     $this->Database = new Gdn_Database(array('Engine' => 'MySQL', 'Host' => c('Database.Host'), 'User' => $dbUser, 'Password' => $dbPassword, 'Name' => $dbName, 'DatabasePrefix' => $dbPrefix));
     // Check if a database connection could be made
     try {
         $this->Database->connection();
     } catch (Exception $e) {
         // The VWP database connection settings are not correct
         throw new Gdn_ErrorException(T('VWP: A database connection could not be made.' . ' Make sure the VWP database settings are correct.'));
         return;
     }
     $this->SQL = $this->Database->SQL();
     $this->Validation = new Gdn_Validation();
     $this->Name = 'posts';
     $this->PrimaryKey = 'ID';
     // Check if valid WordPress database
     if (!in_array('wp_options', $this->SQL->fetchTables(true))) {
         // The table is not a valid WordPress database
         throw new Gdn_ErrorException(T('VWP: A database connection was made successfully,' . ' but the database is not a valid WordPress database'));
     }
 }
Example #17
0
 function __template_TranslateError($param)
 {
     if (!is_array($param) || !isset($param['error'])) {
         return "";
     }
     switch ($param['error']) {
         case $this->ERROR_OK:
             return "";
             break;
         case $this->ERROR_NOT_LOGIN:
             return T('ERROR_NOT_LOGIN');
             break;
         case $this->ERROR_LOGIN_FAILURE:
             return T('ERROR_LOGIN_FAILURE');
             break;
         case $this->ERROR_DEVICE_NOT_BIND:
             return T('ERROR_DEVICE_NOT_BIND');
             break;
         case $this->ERROR_DEVICE_ILEGAL:
             return T('ERROR_DEVICE_ILEGAL');
             break;
         case $this->ERROR_DEVICE_BIND_OTHER:
             return T('ERROR_DEVICE_BIND_OTHER');
             break;
         default:
             return "";
             break;
     }
 }
Example #18
0
 public function edit()
 {
     if (IS_POST) {
         $arr = I('post.');
         if (!$arr['msg']) {
             $this->error('内容不能为空');
         }
         $arr['status'] = 1;
         $arr['uid'] = 0;
         $arr['type'] = 1;
         $arr['create_time'] = time();
         $message = array('title' => $arr['msg'], 'description' => $arr['msg']);
         $push = A('Addons://Baidupush/push');
         $push->__construct('', '', 1);
         $push->pushMessage_all($message);
         $push->__construct('', '', 2);
         $push->pushMessage_all($message);
         $res = M('baidu_msg')->add($arr);
         if ($res) {
             $this->success('推送成功', addons_url("Baidupush://Baidu/lists"));
         } else {
             $this->error('推送失败');
         }
     } else {
         $this->display(T('Addons://Baidupush@Baidu/edit'));
     }
 }
Example #19
0
 public function Base_GetAppSettingsMenuItems_Handler(&$Sender)
 {
     $Menu =& $Sender->EventArguments['SideMenu'];
     $Menu->AddItem('Dashboard', T('Dashboard'));
     $Menu->AddLink('Dashboard', T('Dashboard'), '/dashboard/settings', 'Garden.Settings.Manage');
     $Menu->AddItem('Appearance', T('Appearance'));
     $Menu->AddLink('Appearance', T('Banner'), '/dashboard/settings/banner', 'Garden.Settings.Manage');
     $Menu->AddLink('Appearance', T('Themes'), '/dashboard/settings/themes', 'Garden.Themes.Manage');
     if ($ThemeOptionsName = C('Garden.ThemeOptions.Name')) {
         $Menu->AddLink('Appearance', T('Theme Options'), '/dashboard/settings/themeoptions', 'Garden.Themes.Manage');
     }
     $Menu->AddLink('Appearance', T('Messages'), '/dashboard/message', 'Garden.Messages.Manage');
     $Menu->AddItem('Users', T('Users'));
     $Menu->AddLink('Users', T('Users'), '/dashboard/user', array('Garden.Users.Add', 'Garden.Users.Edit', 'Garden.Users.Delete'));
     $Menu->AddLink('Users', T('Roles & Permissions'), 'dashboard/role', 'Garden.Roles.Manage');
     if (C('Garden.Registration.Manage', TRUE)) {
         $Menu->AddLink('Users', T('Registration'), 'dashboard/settings/registration', 'Garden.Registration.Manage');
     }
     if (C('Garden.Registration.Method') == 'Approval') {
         $Menu->AddLink('Users', T('Applicants'), 'dashboard/user/applicants', 'Garden.Applicants.Manage');
     }
     $Menu->AddItem('Forum', T('Forum Settings'));
     $Menu->AddItem('Add-ons', T('Add-ons'));
     $Menu->AddLink('Add-ons', T('Plugins'), 'dashboard/settings/plugins', 'Garden.Plugins.Manage');
     $Menu->AddLink('Add-ons', T('Applications'), 'dashboard/settings/applications', 'Garden.Applications.Manage');
     $Menu->AddItem('Site Settings', T('Settings'));
     $Menu->AddLink('Site Settings', T('Outgoing Email'), 'dashboard/settings/email', 'Garden.Settings.Manage');
     $Menu->AddLink('Site Settings', T('Routes'), 'dashboard/routes', 'Garden.Routes.Manage');
     $Menu->AddLink('Site Settings', T('Import'), 'dashboard/import', 'Garden.Import');
 }
 public function navigation()
 {
     if (IS_POST) {
         $one = $_POST['nav'][1];
         if (count($one) > 0) {
             D()->execute('TRUNCATE TABLE ' . C('DB_PREFIX') . 'mob_channel');
             for ($i = 0; $i < count(reset($one)); $i++) {
                 $data[$i] = array('pid' => 0, 'title' => op_t($one['title'][$i]), 'url' => op_t($one['url'][$i]), 'sort' => intval($one['sort'][$i]), 'target' => intval($one['target'][$i]), 'color' => op_t($one['color'][$i]), 'band_text' => op_t($one['band_text'][$i]), 'band_color' => op_t($one['band_color'][$i]), 'icon' => op_t($one['icon'][$i]), 'status' => 1);
                 $pid[$i] = M('MobChannel')->add($data[$i]);
             }
             $two = $_POST['nav'][2];
             for ($j = 0; $j < count(reset($two)); $j++) {
                 $data_two[$j] = array('pid' => $pid[$two['pid'][$j]], 'title' => op_t($two['title'][$j]), 'url' => op_t($two['url'][$j]), 'sort' => intval($two['sort'][$j]), 'target' => intval($two['target'][$j]), 'color' => op_t($two['color'][$j]), 'band_text' => op_t($two['band_text'][$j]), 'band_color' => op_t($two['band_color'][$j]), 'icon' => op_t($two['icon'][$j]), 'status' => 1);
                 $res[$j] = M('MobChannel')->add($data_two[$j]);
             }
             S('common_nav', null);
             $this->success('修改成功');
         }
         $this->error('导航至少存在一个。');
     } else {
         /* 获取频道列表 */
         $map = array('status' => array('gt', -1), 'pid' => 0);
         $list = M('MobChannel')->where($map)->order('sort asc,id asc')->select();
         foreach ($list as $k => &$v) {
             $v['module_name'] = explode('/', $v['url']);
             $v['module_name'] = $v['module_name'][1];
         }
         unset($k, $v);
         //  dump($list);exit;
         $this->assign('module', $this->getMobModules());
         $this->assign('list', $list);
         $this->meta_title = '导航管理';
         $this->display(T('Application://Mob@Mob/navigation'));
     }
 }
Example #21
0
 /**
  *
  */
 public function init()
 {
     $id = intval($GLOBALS['id']);
     $siteid = intval($GLOBALS['siteid']);
     $res = $this->db->get_one('copyfrom', array('fromid' => $id));
     $siteconfigs = $this->siteconfigs;
     $seo_title = $siteconfigs['sitename'];
     $seo_keywords = $siteconfigs['seo_keywords'];
     $seo_description = $siteconfigs['seo_description'];
     $categorys = get_cache('category', 'content');
     $cids = array();
     foreach ($categorys as $cid => $r) {
         if ($r['siteid'] == $siteid) {
             $cids[] = $cid;
         }
     }
     if (!empty($cids)) {
         $cids = implode(',', $cids);
         $where = "`copyfrom`='" . $res['fromid'] . "' AND `status`=9 AND `cid` IN ({$cids})";
         $rs = $this->db->get_list('content_share', array('copyfrom' => $id), '*', 0, 20, 0, 'id DESC');
     } else {
         MSG('参数错误');
     }
     $rs = $this->db->get_list('content_share', $where, '*', 0, 100, 0, 'id DESC');
     include T('content', 'copyfrom', TPLID);
 }
Example #22
0
 public function main()
 {
     if (!A()->isAdmin()) {
         return R('/');
     }
     return T()->newevent(['formAction' => U('/create/')]);
 }
Example #23
0
/**
 * Writes the search box to the page.
 *
 * @param array The parameters passed into the function. This currently takes no parameters.
 * @param Smarty The smarty object rendering the template.
 * @return The url.
 */
function smarty_function_searchbox($Params, &$Smarty)
{
    $Form = Gdn::Factory('Form');
    $Form->InputPrefix = '';
    $Result = $Form->Open(array('action' => Url('/search'), 'method' => 'get')) . $Form->TextBox('Search', array('placeholder' => T('Search'))) . $Form->Button('Go', array('Name' => '')) . $Form->Close();
    return $Result;
}
Example #24
0
 /**
  * Construct and process the settings form for this skin, and return the path to the view that should be 
  * rendered.
  * 
  * @param ETController $sender The page controller.
  * @return string The path to the settings view to render.
  */
 public function settings($sender)
 {
     // Set up the settings form.
     $form = ETFactory::make("form");
     $form->action = URL("admin/plugins");
     $form->setValue("server", C("plugin.SMTP.server"));
     $form->setValue("username", C("plugin.SMTP.username"));
     $form->setValue("password", C("plugin.SMTP.password"));
     $form->setValue("port", C("plugin.SMTP.port"));
     $form->setValue("auth", C("plugin.SMTP.auth"));
     // If the form was submitted...
     if ($form->validPostBack("save")) {
         // Construct an array of config options to write.
         $config = array();
         $config["plugin.SMTP.server"] = $form->getValue("server");
         $config["plugin.SMTP.username"] = $form->getValue("username");
         $config["plugin.SMTP.password"] = $form->getValue("password");
         $config["plugin.SMTP.port"] = $form->getValue("port");
         $config["plugin.SMTP.auth"] = $form->getValue("auth");
         if (!$form->errorCount()) {
             // Write the config file.
             ET::writeConfig($config);
             $sender->message(T("message.changesSaved"), "success");
             $sender->redirect(URL("admin/plugins"));
         }
     }
     $sender->data("smtpSettingsForm", $form);
     return $this->getView("settings");
 }
 public function __construct(&$Sender = '')
 {
     $Session = Gdn::Session();
     if (property_exists($Sender, 'Conversation')) {
         $this->Conversation = $Sender->Conversation;
     }
     $this->Form = Gdn::Factory('Form', 'AddPeople');
     // $this->Form->Action = $Sender->SelfUrl;
     // If the form was posted back, check for people to add to the conversation
     if ($this->Form->AuthenticatedPostBack()) {
         $NewRecipientUserIDs = array();
         $NewRecipients = explode(',', $this->Form->GetFormValue('AddPeople', ''));
         $UserModel = Gdn::Factory("UserModel");
         foreach ($NewRecipients as $Name) {
             if (trim($Name) != '') {
                 $User = $UserModel->GetByUsername(trim($Name));
                 if (is_object($User)) {
                     $NewRecipientUserIDs[] = $User->UserID;
                 }
             }
         }
         $Sender->ConversationModel->AddUserToConversation($this->Conversation->ConversationID, $NewRecipientUserIDs);
         // if ($Sender->DeliveryType() == DELIVERY_TYPE_ALL)
         //    Redirect('/messages/'.$this->Conversation->ConversationID);
         $Sender->StatusMessage = T('Your changes were saved.');
         $Sender->RedirectUrl = Url('/messages/' . $this->Conversation->ConversationID);
     }
     $this->_ApplicationFolder = $Sender->Application;
     $this->_ThemeFolder = $Sender->Theme;
 }
 function edit()
 {
     $cateMap['token'] = $map['token'] = get_token();
     $map['id'] = $id = I('id');
     $model = $this->getModel('wish_card_content');
     if (IS_POST) {
         $Model = D(parse_name(get_table_name($model['id']), 1));
         //读分类名称
         $cate_data['id'] = $_POST['content_cate_id'];
         $_POST['content_cate'] = M('WishCardContentCate')->where($cate_data)->getField('content_cate_name');
         // 获取模型的字段信息
         $Model = $this->checkAttr($Model, $model['id']);
         if ($Model->create() && $Model->save()) {
             $this->_saveKeyword($model, $id);
         }
         // 清空缓存
         method_exists($Model, 'clear') && $Model->clear($id, 'edit');
         $this->success('保存' . $model['title'] . '成功!', U('lists?model=' . $model['name']));
     } else {
         $cate = D('WishCardContentCate')->where($cateMap)->select();
         $data = D('WishCardContent')->find($id);
         for ($i = 0; $i < count($cate); $i++) {
             if ($cate[$i]['id'] == $data['content_cate_id']) {
                 $cate[$i]['checked'] = true;
             }
         }
         $this->assign('content_cate', $cate);
         $this->assign('data', $data);
         //dump($cate);
         $this->display(T('Addons://WishCard@WishCard/editWishContent'));
     }
 }
 /**
  * 登陆后回调地址
  */
 public function callback()
 {
     $code = I('get.code');
     $type = I('get.type');
     $sns = \ThinkOauth::getInstance($type);
     //腾讯微博需传递的额外参数
     $extend = null;
     if ($type == 'tencent') {
         $extend = array('openid' => I('get.openid'), 'openkey' => I('get.openkey'));
     }
     $token = $sns->getAccessToken($code, $extend);
     //获取第三方Token
     $user_sns_info = \ThinkOauthInfo::$type($token);
     //获取第三方传递回来的用户信息
     $user_sync_info = D('Addons://SyncLogin/SyncLogin')->getUserByOpenidAndType($token['openid'], $type);
     //根据openid等参数查找同步登录表中的用户信息
     $user_sys_info = D('User')->find($user_sync_info['uid']);
     //根据UID查找系统用户中是否有此用户
     if ($user_sync_info['uid'] && $user_sys_info['id'] && $user_sync_info['uid'] == $user_sys_info['id']) {
         //曾经绑定过
         D('Addons://SyncLogin/SyncLogin')->updateTokenByTokenAndType($token, $type);
         D('User')->autoLogin($user_sys_info);
         redirect('http://' . $_SERVER['HTTP_HOST'] . __ROOT__);
     } else {
         //没绑定过,去注册页面
         session('token', $token);
         session('user_sns_info', $user_sns_info);
         $this->assign('user_sns_info', $user_sns_info);
         $this->assign('meta_title', "登陆");
         $this->display(T('Addons://SyncLogin@./default/reg'));
     }
 }
 public function render($attributes = array())
 {
     $attributes['id'] = $attributes['id'] ? $attributes['id'] : $attributes['name'];
     $config = $attributes['config'];
     $class = $attributes['class'];
     $value = $attributes['value'];
     $name = $attributes['name'];
     $width = $attributes['width'] ? $attributes['width'] : 100;
     $height = $attributes['height'] ? $attributes['height'] : 100;
     $isLoadScript = $attributes['isLoadScript'] ? 1 : 0;
     //$filetype = $this->rules['filetype'];
     $config = $config['config'];
     $attributes['config'] = array('text' => L('_FILE_SELECT_'));
     $files_ids = explode(',', $value);
     if ($files_ids) {
         foreach ($files_ids as $v) {
             $files[] = M('File')->find($v);
         }
         unset($v);
     }
     $this->assign('isLoadScript', $isLoadScript);
     $this->assign('files', $files);
     $this->assign($attributes);
     $this->display(T('Application://Common@Widget/uploadmultifile'));
 }
 public function IndexAction()
 {
     $intro = M('config');
     $map1[name] = "SYSTEM_FIRST_HEAVY";
     $map2[name] = "SYSTEM_FIRST_COST";
     $map3[name] = "SYSTEM_CONTINUE_HEAVY";
     $map4[name] = "SYSYEM_CONTINUE_COST";
     $map5[name] = "SYSTEM_PACKAGE_HEAVY";
     $map6[name] = "SYSTEM_FREIGHT_EXPLAIN";
     $firstHeavy = $intro->where($map1)->find();
     $firstCost = $intro->where($map2)->find();
     $continueHeavy = $intro->where($map3)->find();
     $continueCost = $intro->where($map4)->find();
     $packageHeavy = $intro->where($map5)->find();
     $freightExplain = $intro->where($map6)->find();
     $this->assign('firstHeavy', $firstHeavy);
     $this->assign('firstCost', $firstCost);
     $this->assign('continueHeavy', $continueHeavy);
     $this->assign('continueCost', $continueCost);
     $this->assign('packageHeavy', $packageHeavy);
     $this->assign('freightExplain', $freightExplain);
     $this->assign('urlUpdate', U('Update'));
     $TPL = T('Introduction@Weight/index');
     $this->assign('YZRight', $this->fetch($TPl));
     $this->display(YZ_TEMPLATE);
 }
 public function ToString()
 {
     $HasPermission = Gdn::Session()->CheckPermission('Vanilla.Discussions.Add', TRUE, 'Category', 'any');
     if ($HasPermission) {
         echo Anchor(T('Ask a Question'), '/post/discussion?Type=Question', 'Button BigButton NewQuestion');
     }
 }