| 1 | <?php |
|---|
| 2 | // $Id: modlink.php,v 1.3 2005/09/04 20:46:10 onokazu Exp $ |
|---|
| 3 | // ------------------------------------------------------------------------ // |
|---|
| 4 | // XOOPS - PHP Content Management System // |
|---|
| 5 | // Copyright (c) 2000 XOOPS.org // |
|---|
| 6 | // <http://www.xoops.org/> // |
|---|
| 7 | // ------------------------------------------------------------------------ // |
|---|
| 8 | // This program is free software; you can redistribute it and/or modify // |
|---|
| 9 | // it under the terms of the GNU General Public License as published by // |
|---|
| 10 | // the Free Software Foundation; either version 2 of the License, or // |
|---|
| 11 | // (at your option) any later version. // |
|---|
| 12 | // // |
|---|
| 13 | // You may not change or alter any portion of this comment or credits // |
|---|
| 14 | // of supporting developers from this source code or any supporting // |
|---|
| 15 | // source code which is considered copyrighted (c) material of the // |
|---|
| 16 | // original comment or credit authors. // |
|---|
| 17 | // // |
|---|
| 18 | // This program is distributed in the hope that it will be useful, // |
|---|
| 19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|---|
| 20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|---|
| 21 | // GNU General Public License for more details. // |
|---|
| 22 | // // |
|---|
| 23 | // You should have received a copy of the GNU General Public License // |
|---|
| 24 | // along with this program; if not, write to the Free Software // |
|---|
| 25 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
|---|
| 26 | // ------------------------------------------------------------------------ // |
|---|
| 27 | |
|---|
| 28 | include "header.php"; |
|---|
| 29 | $myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object |
|---|
| 30 | include_once XOOPS_ROOT_PATH."/class/xoopstree.php"; |
|---|
| 31 | include_once XOOPS_ROOT_PATH."/class/module.errorhandler.php"; |
|---|
| 32 | $mytree = new XoopsTree($xoopsDB->prefix("mylinks_cat"),"cid","pid"); |
|---|
| 33 | |
|---|
| 34 | if (!empty($_POST['submit'])) { |
|---|
| 35 | $eh = new ErrorHandler; //ErrorHandler object |
|---|
| 36 | if (empty($xoopsUser)) { |
|---|
| 37 | redirect_header(XOOPS_URL."/user.php",2,_MD_MUSTREGFIRST); |
|---|
| 38 | exit(); |
|---|
| 39 | } else { |
|---|
| 40 | $user = $xoopsUser->getVar('uid'); |
|---|
| 41 | } |
|---|
| 42 | $lid = intval($_POST["lid"]); |
|---|
| 43 | |
|---|
| 44 | // Check if Title exist |
|---|
| 45 | if ($_POST["title"]=="") { |
|---|
| 46 | $eh->show("1001"); |
|---|
| 47 | } |
|---|
| 48 | // Check if URL exist |
|---|
| 49 | if ($_POST["url"]=="") { |
|---|
| 50 | $eh->show("1016"); |
|---|
| 51 | } |
|---|
| 52 | // Check if Description exist |
|---|
| 53 | if ($_POST['description']=="") { |
|---|
| 54 | $eh->show("1008"); |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | $url = $myts->makeTboxData4Save($_POST["url"]); |
|---|
| 58 | $logourl = $myts->makeTboxData4Save($_POST["logourl"]); |
|---|
| 59 | $cid = intval($_POST["cid"]); |
|---|
| 60 | $title = $myts->makeTboxData4Save($_POST["title"]); |
|---|
| 61 | $description = $myts->makeTareaData4Save($_POST["description"]); |
|---|
| 62 | $newid = $xoopsDB->genId($xoopsDB->prefix("mylinks_mod")."_requestid_seq"); |
|---|
| 63 | $sql = sprintf("INSERT INTO %s (requestid, lid, cid, title, url, logourl, description, modifysubmitter) VALUES (%u, %u, %u, '%s', '%s', '%s', '%s', %u)", $xoopsDB->prefix("mylinks_mod"), $newid, $lid, $cid, $title, $url, $logourl, $description, $user); |
|---|
| 64 | $xoopsDB->query($sql) or $eh->show("0013"); |
|---|
| 65 | $tags = array(); |
|---|
| 66 | $tags['MODIFYREPORTS_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php?op=listModReq'; |
|---|
| 67 | $notification_handler =& xoops_gethandler('notification'); |
|---|
| 68 | $notification_handler->triggerEvent('global', 0, 'link_modify', $tags); |
|---|
| 69 | redirect_header("index.php",2,_MD_THANKSFORINFO); |
|---|
| 70 | exit(); |
|---|
| 71 | } else { |
|---|
| 72 | $lid = intval($_GET['lid']); |
|---|
| 73 | if (empty($xoopsUser)) { |
|---|
| 74 | redirect_header(XOOPS_URL."/user.php",2,_MD_MUSTREGFIRST); |
|---|
| 75 | exit(); |
|---|
| 76 | } |
|---|
| 77 | $xoopsOption['template_main'] = 'mylinks_modlink.html'; |
|---|
| 78 | include XOOPS_ROOT_PATH."/header.php"; |
|---|
| 79 | $result = $xoopsDB->query("select cid, title, url, logourl from ".$xoopsDB->prefix("mylinks_links")." where lid=$lid and status>0"); |
|---|
| 80 | $xoopsTpl->assign('lang_requestmod', _MD_REQUESTMOD); |
|---|
| 81 | list($cid, $title, $url, $logourl) = $xoopsDB->fetchRow($result); |
|---|
| 82 | $result2 = $xoopsDB->query("SELECT description FROM ".$xoopsDB->prefix("mylinks_text")." WHERE lid=$lid"); |
|---|
| 83 | list($description)=$xoopsDB->fetchRow($result2); |
|---|
| 84 | $xoopsTpl->assign('link', array('id' => $lid, 'rating' => number_format($rating, 2), 'title' => $myts->htmlSpecialChars($title), 'url' => $myts->htmlSpecialChars($url), '$logourl' => $myts->htmlSpecialChars($logourl), 'updated' => formatTimestamp($time,"m"), 'description' => $myts->htmlSpecialChars($description), 'adminlink' => $adminlink, 'hits' => $hits, 'votes' => $votestring)); |
|---|
| 85 | $xoopsTpl->assign('lang_linkid', _MD_LINKID); |
|---|
| 86 | $xoopsTpl->assign('lang_sitetitle', _MD_SITETITLE); |
|---|
| 87 | $xoopsTpl->assign('lang_siteurl', _MD_SITEURL); |
|---|
| 88 | $xoopsTpl->assign('lang_category', _MD_CATEGORYC); |
|---|
| 89 | ob_start(); |
|---|
| 90 | $mytree->makeMySelBox("title", "title", $cid); |
|---|
| 91 | $selbox = ob_get_contents(); |
|---|
| 92 | ob_end_clean(); |
|---|
| 93 | $xoopsTpl->assign('category_selbox', $selbox); |
|---|
| 94 | $xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC); |
|---|
| 95 | $xoopsTpl->assign('lang_sendrequest', _MD_SENDREQUEST); |
|---|
| 96 | $xoopsTpl->assign('lang_cancel', _CANCEL); |
|---|
| 97 | $xoopsTpl->assign('lang_developer', _MD_DEVELOPER); |
|---|
| 98 | $xoopsTpl->assign('lang_release_date', _MD_RELEASE_DATE); |
|---|
| 99 | $xoopsTpl->assign('lang_development_time', _MD_DEVELOPMENT_TIME); |
|---|
| 100 | $xoopsTpl->assign('lang_site_status', _MD_SITE_STATUS); |
|---|
| 101 | $xoopsTpl->assign('lang_customize', _MD_CUSTOMIZE); |
|---|
| 102 | $xoopsTpl->assign('lang_new_open', _MD_NEW_OPEN); |
|---|
| 103 | $xoopsTpl->assign('lang_renewal', _MD_RENEWAL); |
|---|
| 104 | $xoopsTpl->assign('lang_on', _MD_ON); |
|---|
| 105 | $xoopsTpl->assign('lang_off', _MD_OFF); |
|---|
| 106 | $xoopsTpl->assign('lang_caution_title', _POST_CAUTION_TITLE); |
|---|
| 107 | $xoopsTpl->assign('lang_caution_body', _POST_CAUTION_BODY); |
|---|
| 108 | include XOOPS_ROOT_PATH.'/footer.php'; |
|---|
| 109 | } |
|---|
| 110 | ?> |
|---|