<?php include 'header.php'; xoops_load('mylinksUtility', $xoopsModule->getVar('dirname')); $lid = mylinksUtility::mylinks_cleanVars($_GET, 'lid', 0, 'int', array('min' => 0)); $cid = mylinksUtility::mylinks_cleanVars($_GET, 'cid', 0, 'int', array('min' => 0)); if (empty($lid) || empty($cid)) { redirect_header('index.php', 3, _MD_MYLINKS_IDERROR); } /* $lid = isset($_GET['lid']) ? intval($_GET['lid']) : 0; $cid = isset($_GET['cid']) ? intval($_GET['cid']) : 0; if ( empty($lid) ) { die("No lid!"); } elseif ( empty($cid) ) { die("No cid!"); } */ $result = $xoopsDB->query("SELECT l.lid, l.cid, l.title, l.url FROM " . $xoopsDB->prefix("mylinks_links") . " l, " . $xoopsDB->prefix("mylinks_text") . " t where l.lid={$lid} AND l.lid=t.lid AND status>0"); if (!$result) { redirect_header('index.php', 3, _MD_MYLINKS_NORECORDFOUND); exit; } list($lid, $cid, $ltitle, $url) = $xoopsDB->fetchRow($result); //bookmark func switch ($mylinks_can_bookmark) { case _MD_MYLINKS_MEMBERONLY: $can_bookmark = $xoopsUser ? _MD_MYLINKS_ALLOW : _MD_MYLINKS_DISALLOW; break; case _MD_MYLINKS_ALLOW: $can_bookmark = _MD_MYLINKS_ALLOW;
$myCatTree = new XoopsObjectTree($catObjs, 'cid', 'pid'); xoops_load('mylinksUtility', $xoopsModule->getVar('dirname')); $cid = mylinksUtility::mylinks_cleanVars($_GET, 'cid', 0, 'int', array('min' => 0)); $catid = $cid; $xoopsOption['template_main'] = 'mylinks_viewcat.html'; include XOOPS_ROOT_PATH . '/header.php'; //wanikoo $xoTheme->addStylesheet('browse.php?' . mylinksGetStylePath('mylinks.css', 'include')); $xoTheme->addScript('browse.php?' . mylinksGetStylePath('mylinks.js', 'include')); // $xoopsTpl->assign('show_nav', false); //set to not show nav bar $show = mylinksUtility::mylinks_cleanVars($_GET, 'show', $xoopsModuleConfig['perpage'], 'int'); $min = mylinksUtility::mylinks_cleanVars($_GET, 'min', 0, 'int'); $max = !isset($max) ? $min + $show : $max; $orderby = mylinksUtility::mylinks_cleanVars($_GET, 'orderby', 'title ASC', 'string'); // list //TODO: need to sanitize $_GET['list'] if (!isset($_GET['list'])) { //wanikoo $catObj = $mylinksCatHandler->get($cid); $imgurl = ''; if (is_object($catObj) && !empty($catObj)) { $thisCatTitle = $myts->htmlSpecialChars($catObj->getVar('title')); if ($catObj->getVar('imgurl') && $catObj->getVar('imgurl') != "http://") { $imgurl = $myts->htmlSpecialChars($catObj->getVar('imgurl')); } } else { $thisCatTitle = ''; } $thisPageTitle = $thisCatTitle;
function approve() { global $xoopsDB, $myts, $eh, $xoopsModule; $lid = mylinksUtility::mylinks_cleanVars($_POST, 'lid', 0, 'int', array('min' => 0)); $cid = mylinksUtility::mylinks_cleanVars($_POST, 'cid', 0, 'int', array('min' => 0)); $title = mylinksUtility::mylinks_cleanVars($_POST, 'title', '', 'string'); $url = mylinksUtility::mylinks_cleanVars($_POST, 'url', '', 'string'); $logourl = mylinksUtility::mylinks_cleanVars($_POST, 'logourl', '', 'string'); $description = mylinksUtility::mylinks_cleanVars($_POST, 'description', '', 'string'); $url = $myts->addSlashes($url); $logourl = $myts->addSlashes($logourl); $title = $myts->addSlashes($title); $description = $myts->addSlashes($description); $query = "UPDATE " . $xoopsDB->prefix("mylinks_links") . " set cid='{$cid}', title='{$title}', url='{$url}', logourl='{$logourl}', status='1', date=" . time() . " WHERE lid='{$lid}'"; $xoopsDB->query($query) or $eh->show('0013'); $query = "UPDATE " . $xoopsDB->prefix("mylinks_text") . " SET description='{$description}' WHERE lid='{$lid}'"; $xoopsDB->query($query) or $eh->show('0013'); $tags = array(); $tags['LINK_NAME'] = $title; $tags['LINK_URL'] = XOOPS_URL . "/modules/" . $xoopsModule->getVar('dirname') . "/singlelink.php?cid={$cid}&lid={$lid}"; $mylinksCatHandler =& xoops_getmodulehandler('category', $xoopsModule->getVar('dirname')); $catObj = $mylinksCatHandler->get($cid); /* $sql = "SELECT title FROM " . $xoopsDB->prefix("mylinks_cat") . " WHERE cid=" . $cid; $result = $xoopsDB->query($sql); $row = $xoopsDB->fetchArray($result); $tags['CATEGORY_NAME'] = $row['title']; */ if ($catObj) { $tags['CATEGORY_NAME'] = $catObj->getVar('title'); $tags['CATEGORY_URL'] = XOOPS_URL . "/modules/" . $xoopsModule->getVar('dirname') . "/viewcat.php?cid={$cid}"; $notification_handler =& xoops_gethandler('notification'); $notification_handler->triggerEvent('global', 0, 'new_link', $tags); $notification_handler->triggerEvent('category', $cid, 'new_link', $tags); $notification_handler->triggerEvent('link', $lid, 'approve', $tags); redirect_header('index.php', 2, _MD_MYLINKS_NEWLINKADDED); } else { redirect_header('index.php', 2, _MD_MYLINKS_DBNOTUPDATED); } }
// original comment or credit authors. // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // include 'header.php'; $myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object xoops_load('mylinksUtility', $xoopsModule->getVar('dirname')); $lid = mylinksUtility::mylinks_cleanVars($_REQUEST, 'lid', 0, 'int', array('min' => 0)); if (!empty($_POST['submit'])) { $sender = empty($xoopsUser) ? 0 : $xoopsUser->getVar('uid'); $ip = getenv("REMOTE_ADDR"); if ($sender != 0) { // Check if REG user is trying to report twice. $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("mylinks_broken") . " WHERE lid='{$lid}' AND sender='{$sender}'"); list($count) = $xoopsDB->fetchRow($result); if ($count > 0) { redirect_header('index.php', 2, _MD_MYLINKS_ALREADYREPORTED); exit; } } else { // Check if the sender is trying to report it more than once. $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("mylinks_broken") . " WHERE lid='{$lid}' AND ip='{$ip}'"); list($count) = $xoopsDB->fetchRow($result);