Exemplo n.º 1
0
 public function index()
 {
     $db = new LinksModel();
     $rs = $db->where("pass_flag=1 and wapUrl<>''")->select();
     $this->assign('rs', $rs);
     $this->display("WapAdmin:link");
 }
Exemplo n.º 2
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>";
 }
Exemplo n.º 3
0
 public function index()
 {
     $db = new LinksModel();
     //绑定所取得的数据
     $this->assign('rs', $rs = $db->where('pass_flag=1')->order('sort asc,date asc')->select());
     $this->display("Index:link");
     //dump($rs);
 }
Exemplo n.º 4
0
 public function link()
 {
     $db = new LinksModel();
     $rs = $db->where("pass_flag=1 ")->select();
     $this->assign('rs', $rs);
     $this->display("Index:link");
     //dump($rs);
 }
Exemplo n.º 5
0
 function render($data)
 {
     $db = new WidgetModel();
     $rs = $db->where("name='link'")->find();
     if ($rs['switch'] != 1) {
         return false;
     }
     $db = new LinksModel();
     $rs = $db->where("pass_flag=1")->limit(5)->select();
     //dump($rs);
     if ($rs === null || $rs === false) {
         return false;
         exit;
     }
     echo "<h2>友情链接</h2>";
     echo "<ul>";
     foreach ($rs as $rs) {
         echo "<li><a href='" . $rs['www_url'] . "'>" . $rs['worlds'] . "</a></li>";
     }
     echo "</ul>";
 }
Exemplo n.º 6
0
 protected function _edi()
 {
     //dump($_POST);
     import('ORG.Util.Input');
     $map['id'] = $_POST['id'];
     $data = array('worlds' => str_replace('\\', '', str_replace("&quot;", '', $_POST['worlds'])), 'www_url' => $_POST['www_url'], 'wap_url' => $_POST['wap_url'], 'email' => $_POST['email'], 'sort' => $_POST['sort']);
     $db = new LinksModel();
     if (!$db->autoCheckToken($_POST)) {
         $this->error('非法提交!');
     }
     $db->where($map)->save($data);
     $this->redirect('Link/index');
 }