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

Revision 652, 6.4 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    $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, developer, release_date, development_time, site_status, customize_flag from ".$xoopsDB->prefix("mylinks_links")." where lid=$lid and status>0");
80    $xoopsTpl->assign('lang_requestmod', _MD_REQUESTMOD);
81    list($cid, $title, $url, $logourl, $developer, $release_date, $development_time, $site_status, $customize_flag) = $xoopsDB->fetchRow($result);
82        switch($site_status) {
83        case 1:
84        $site_status = _MD_NEW_OPEN;
85        break;
86        case 2:
87        $site_status = _MD_RENEWAL;
88        break;
89        default:
90        $site_status = _MD_NEW_OPEN;
91    }
92
93    switch($customize_flag) {
94        case 1:
95        $customize = _MD_ON;
96        break;
97        case 2:
98        $customize = _MD_OFF;
99        break;
100        default:
101        $customize = _MD_OFF;
102    }   
103   
104   
105    $result2 = $xoopsDB->query("SELECT description FROM ".$xoopsDB->prefix("mylinks_text")." WHERE lid=$lid");
106    list($description)=$xoopsDB->fetchRow($result2);
107    $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));
108    $xoopsTpl->assign('lang_linkid', _MD_LINKID);
109    $xoopsTpl->assign('lang_sitetitle', _MD_SITETITLE);
110    $xoopsTpl->assign('lang_siteurl', _MD_SITEURL);
111    $xoopsTpl->assign('lang_category', _MD_CATEGORYC);
112    ob_start();
113    $mytree->makeMySelBox("title", "title", $cid);
114    $selbox = ob_get_contents();
115    ob_end_clean();
116    $xoopsTpl->assign('category_selbox', $selbox);
117    $xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC);
118    $xoopsTpl->assign('lang_sendrequest', _MD_SENDREQUEST);
119    $xoopsTpl->assign('lang_cancel', _CANCEL);
120    $xoopsTpl->assign('lang_developer', _MD_DEVELOPER);
121    $xoopsTpl->assign('lang_release_date', _MD_RELEASE_DATE);
122    $xoopsTpl->assign('lang_development_time', _MD_DEVELOPMENT_TIME);
123    $xoopsTpl->assign('lang_site_status', _MD_SITE_STATUS);
124    $xoopsTpl->assign('lang_customize', _MD_CUSTOMIZE);
125    $xoopsTpl->assign('lang_new_open', _MD_NEW_OPEN);
126    $xoopsTpl->assign('lang_renewal', _MD_RENEWAL);
127    $xoopsTpl->assign('lang_on', _MD_ON);
128    $xoopsTpl->assign('lang_off', _MD_OFF);
129    $xoopsTpl->assign('lang_caution_title', _POST_CAUTION_TITLE);
130    $xoopsTpl->assign('lang_caution_body', _POST_CAUTION_BODY);
131    include XOOPS_ROOT_PATH.'/footer.php';
132}
133?>
Note: See TracBrowser for help on using the repository browser.