source: temp/test-xoops.ec-cube.net/html/modules/mylinks/modlink.php @ 665

Revision 665, 6.5 KB checked in by uehara, 20 years ago (diff)
Line 
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
28include "header.php";
29$myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object
30include_once XOOPS_ROOT_PATH."/class/xoopstree.php";
31include_once XOOPS_ROOT_PATH."/class/module.errorhandler.php";
32$mytree = new XoopsTree($xoopsDB->prefix("mylinks_cat"),"cid","pid");
33
34if (!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    $developer = $_POST["developer"];
58    $release_date = $_POST["release_date"];
59    $development_time = $_POST["development_time"];
60    $site_status = $_POST["site_status"];
61    $customize_flag = $_POST["customize_flag"];
62   
63    $url = $myts->makeTboxData4Save($_POST["url"]);
64    $logourl = $myts->makeTboxData4Save($_POST["logourl"]);
65    //$cid = intval($_POST["cid"]);
66$cid=1;
67    $title = $myts->makeTboxData4Save($_POST["title"]);
68    $description = $myts->makeTareaData4Save($_POST["description"]);
69    $newid = $xoopsDB->genId($xoopsDB->prefix("mylinks_mod")."_requestid_seq");
70    $sql = sprintf("INSERT INTO %s (requestid, lid, cid, title, url, logourl, description, modifysubmitter, developer, release_date, development_time, site_status, customize_flag) VALUES (%u, %u, %u, '%s', '%s', '%s', '%s', %u,  '%s', '%s', '%s', %u, %u)", $xoopsDB->prefix("mylinks_mod"), $newid, $lid, $cid, $title, $url, $logourl, $description, $user,  $developer, $release_date, $development_time, $site_status, $customize_flag);
71    $xoopsDB->query($sql) or $eh->show("0013");
72    $tags = array();
73    $tags['MODIFYREPORTS_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php?op=listModReq';
74    $notification_handler =& xoops_gethandler('notification');
75    $notification_handler->triggerEvent('global', 0, 'link_modify', $tags);
76    redirect_header("index.php",2,_MD_THANKSFORINFO);
77    exit();
78} else {
79    $lid = intval($_GET['lid']);
80    if (empty($xoopsUser)) {
81        redirect_header(XOOPS_URL."/user.php",2,_MD_MUSTREGFIRST);
82        exit();
83    }
84    $xoopsOption['template_main'] = 'mylinks_modlink.html';
85    include XOOPS_ROOT_PATH."/header.php";
86    $result = $xoopsDB->query("select cid, title, url, logourl, developer, release_date, development_time, site_status, customize_flag from ".$xoopsDB->prefix("mylinks_links")." where lid=$lid and status>0");
87    $xoopsTpl->assign('lang_requestmod', _MD_REQUESTMOD);
88    list($cid, $title, $url, $logourl, $developer, $release_date, $development_time, $site_status, $customize_flag) = $xoopsDB->fetchRow($result);
89    $result2 = $xoopsDB->query("SELECT description FROM ".$xoopsDB->prefix("mylinks_text")." WHERE lid=$lid");
90    list($description)=$xoopsDB->fetchRow($result2);
91    $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, 'developer' => $developer, 'release_date' => $release_date, 'development_time' => $development_time, 'site_status' => $site_status, 'customize_flag' => $customize_flag));
92    $xoopsTpl->assign('lang_linkid', _MD_LINKID);
93    $xoopsTpl->assign('lang_sitetitle', _MD_SITETITLE);
94    $xoopsTpl->assign('lang_siteurl', _MD_SITEURL);
95    $xoopsTpl->assign('lang_category', _MD_CATEGORYC);
96    ob_start();
97    $mytree->makeMySelBox("title", "title", $cid);
98    $selbox = ob_get_contents();
99    ob_end_clean();
100    $xoopsTpl->assign('category_selbox', $selbox);
101    $xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC);
102    $xoopsTpl->assign('lang_sendrequest', _MD_SENDREQUEST);
103    $xoopsTpl->assign('lang_cancel', _CANCEL);
104    $xoopsTpl->assign('lang_developer', _MD_DEVELOPER);
105    $xoopsTpl->assign('lang_release_date', _MD_RELEASE_DATE);
106    $xoopsTpl->assign('lang_development_time', _MD_DEVELOPMENT_TIME);
107    $xoopsTpl->assign('lang_site_status', _MD_SITE_STATUS);
108    $xoopsTpl->assign('lang_customize', _MD_CUSTOMIZE);
109    $xoopsTpl->assign('lang_new_open', _MD_NEW_OPEN);
110    $xoopsTpl->assign('lang_renewal', _MD_RENEWAL);
111    $xoopsTpl->assign('lang_on', _MD_ON);
112    $xoopsTpl->assign('lang_off', _MD_OFF);
113    $xoopsTpl->assign('lang_caution_title', _POST_CAUTION_TITLE);
114    $xoopsTpl->assign('lang_caution_body', _POST_CAUTION_BODY);
115    include XOOPS_ROOT_PATH.'/footer.php';
116}
117?>
Note: See TracBrowser for help on using the repository browser.