public function index() { $db = new LinksModel(); $rs = $db->where("pass_flag=1 and wapUrl<>''")->select(); $this->assign('rs', $rs); $this->display("WapAdmin:link"); }
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>"; }
public function link() { $db = new LinksModel(); $rs = $db->where("pass_flag=1 ")->select(); $this->assign('rs', $rs); $this->display("Index:link"); //dump($rs); }
public function index() { $links = LinksModel::getAllGroupsAndLinks(); global $Smarty; $this->addCSSFiles('links.css'); return $this->renderPage(array('title' => $Smarty->_config[0]['vars']['linksTitle'], 'content_title' => $Smarty->_config[0]['vars']['linksContentTitle'], 'links' => $links), $this->_template); }
public function save() { //引入input类,过滤用户输入 import("ORG.Util.Input"); $db = new LinksModel(); //接收处理传递到的数据 $data = array('worlds' => str_replace('\\', '', str_replace(""", '', $_POST['linkWorlds'])), 'www_url' => $_POST['wwwUrl'], 'wap_url' => $_POST['wapUrl'], 'email' => $_POST['email'], 'date' => date("Y-m-d H:i:s"), 'sort' => 1 + $db->max('sort')); //错误判读 if ($data['worlds'] == '' or $data['www_url'] == '' or $data['email'] == '') { $this->ajaxReturn(0, '请将表单填写完整后提交,如果你禁用了javascript,请开启!', 0); } elseif (!$db->add($data)) { $this->ajaxReturn(0, '(⊙o⊙)…服务器开小差了。', 0); } else { $this->ajaxReturn(1, '添加成功!审核通过后会将此链接显示在首页.', 1); } }
function load() { parent::load(); if (!$this->data['active_plus_account']) { exit(0); return null; } if ($this->isPost()) { $this->playerLinks = array(); $i = 0; $c = sizeof($_POST['nr']); while ($i < $c) { $name = trim($_POST['linkname'][$i]); $url = trim($_POST['linkurl'][$i]); if ($url == '' || $name == '' || $_POST['nr'][$i] == '' || !is_numeric($_POST['nr'][$i])) { continue; } $selfTarget = TRUE; if (substr($url, strlen($url) - 1) == '*') { $url = substr($url, 0, strlen($url) - 1); $selfTarget = FALSE; } if (isset($this->playerLinks[$_POST['nr'][$i]])) { ++$_POST['nr'][$i]; } $this->playerLinks[$_POST['nr'][$i]] = array('linkName' => $name, 'linkHref' => $url, 'linkSelfTarget' => $selfTarget); ++$i; } ksort($this->playerLinks); $links = ''; foreach ($this->playerLinks as $link) { if ($links != '') { $links .= ' '; } $links .= $link['linkName'] . ' ' . $link['linkHref'] . ' ' . ($link['linkSelfTarget'] ? '?' : '*'); } $m = new LinksModel(); $m->changePlayerLinks($this->player->playerId, $links); $m->dispose(); } }
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>"; }
/** * Generate the module */ protected function compile() { $this->Template->empty = $GLOBALS['TL_LANG']['MSC']['emptyLinks']; $intTotal = \LinksModel::countPublishedByPids($this->links_categories); if ($intTotal < 1) { return; } $objLinks = \LinksModel::findPublishedByPids($this->links_categories); // No items found if ($objLinks !== null) { $this->Template->links = $this->parseLinks($objLinks); } }
public function index() { $links = LinksModel::getAllGroupsAndLinks(); $this->addCSSFiles('links.css'); return $this->renderPage(array('title' => 'Links', 'content_title' => 'Links', 'links' => $links), $this->_template); }
protected function _edi() { //dump($_POST); import('ORG.Util.Input'); $map['id'] = $_POST['id']; $data = array('worlds' => str_replace('\\', '', str_replace(""", '', $_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'); }