| 1 | <?php
|
|---|
| 2 | // $Id: index.php,v 1.17.2.2 2004/12/14 10:49:25 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 '../../../include/cp_header.php';
|
|---|
| 29 | if ( file_exists("../language/".$xoopsConfig['language']."/main.php") ) {
|
|---|
| 30 | include "../language/".$xoopsConfig['language']."/main.php";
|
|---|
| 31 | } else {
|
|---|
| 32 | include "../language/english/main.php";
|
|---|
| 33 | }
|
|---|
| 34 | include "../include/functions.php";
|
|---|
| 35 | include_once XOOPS_ROOT_PATH."/class/xoopstree.php";
|
|---|
| 36 | include_once XOOPS_ROOT_PATH."/class/xoopslists.php";
|
|---|
| 37 | include_once XOOPS_ROOT_PATH."/include/xoopscodes.php";
|
|---|
| 38 | include_once XOOPS_ROOT_PATH."/class/module.errorhandler.php";
|
|---|
| 39 | $myts =& MyTextSanitizer::getInstance();
|
|---|
| 40 | $eh = new ErrorHandler;
|
|---|
| 41 | $mytree = new XoopsTree($xoopsDB->prefix("mydownloads_cat"),"cid","pid");
|
|---|
| 42 |
|
|---|
| 43 | function mydownloads()
|
|---|
| 44 | {
|
|---|
| 45 | global $xoopsDB, $xoopsModule;
|
|---|
| 46 | xoops_cp_header();
|
|---|
| 47 | echo "<h4>"._MD_DLCONF."</h4>";
|
|---|
| 48 | echo"<table width='100%' border='0' cellspacing='1' class='outer'>"
|
|---|
| 49 | ."<tr class=\"odd\"><td>";
|
|---|
| 50 | // Temporarily 'homeless' downloads (to be revised in index.php breakup)
|
|---|
| 51 | $result = $xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("mydownloads_broken")."");
|
|---|
| 52 | list($totalbrokendownloads) = $xoopsDB->fetchRow($result);
|
|---|
| 53 | if($totalbrokendownloads>0){
|
|---|
| 54 | $totalbrokendownloads = "<span style='color: #ff0000; font-weight: bold'>$totalbrokendownloads</span>";
|
|---|
| 55 | }
|
|---|
| 56 | $result2 = $xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("mydownloads_mod")."");
|
|---|
| 57 | list($totalmodrequests) = $xoopsDB->fetchRow($result2);
|
|---|
| 58 | if($totalmodrequests>0){
|
|---|
| 59 | $totalmodrequests = "<span style='color: #ff0000; font-weight: bold'>$totalmodrequests</span>";
|
|---|
| 60 | }
|
|---|
| 61 | $result3 = $xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("mydownloads_downloads")." WHERE status=0");
|
|---|
| 62 | list($totalnewdownloads) = $xoopsDB->fetchRow($result3);
|
|---|
| 63 | if($totalnewdownloads>0){
|
|---|
| 64 | $totalnewdownloads = "<span style='color: #ff0000; font-weight: bold'>$totalnewdownloads</span>";
|
|---|
| 65 | }
|
|---|
| 66 | echo " - <a href='".XOOPS_URL."/modules/system/admin.php?fct=preferences&op=showmod&mod=".$xoopsModule->getVar('mid')."'>"._MD_GENERALSET."</a>";
|
|---|
| 67 | echo "<br /><br />";
|
|---|
| 68 | echo " - <a href=index.php?op=downloadsConfigMenu>"._MD_ADDMODDELETE."</a>";
|
|---|
| 69 | echo "<br /><br />";
|
|---|
| 70 | echo " - <a href=index.php?op=listNewDownloads>"._MD_DLSWAITING." ($totalnewdownloads)</a>";
|
|---|
| 71 | echo "<br /><br />";
|
|---|
| 72 | echo " - <a href=index.php?op=listBrokenDownloads>"._MD_BROKENREPORTS." ($totalbrokendownloads)</a>";
|
|---|
| 73 | echo "<br /><br />";
|
|---|
| 74 | echo " - <a href=index.php?op=listModReq>"._MD_MODREQUESTS." ($totalmodrequests)</a>";
|
|---|
| 75 | $result=$xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("mydownloads_downloads")." WHERE status>0");
|
|---|
| 76 | list($numrows) = $xoopsDB->fetchRow($result);
|
|---|
| 77 | echo "<br /><br /><div>";
|
|---|
| 78 | printf(_MD_THEREARE,$numrows); echo "</div>";
|
|---|
| 79 | echo"</td></tr></table>";
|
|---|
| 80 | xoops_cp_footer();
|
|---|
| 81 | }
|
|---|
| 82 |
|
|---|
| 83 | function listNewDownloads()
|
|---|
| 84 | {
|
|---|
| 85 | global $xoopsDB, $myts, $eh, $mytree;
|
|---|
| 86 | // List downloads waiting for validation
|
|---|
| 87 | $downimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/modules/mydownloads/images/shots/");
|
|---|
| 88 | $result = $xoopsDB->query("SELECT lid, cid, title, url, homepage, version, size, platform, logourl, submitter FROM ".$xoopsDB->prefix("mydownloads_downloads")." where status=0 ORDER BY date DESC");
|
|---|
| 89 | $numrows = $xoopsDB->getRowsNum($result);
|
|---|
| 90 | xoops_cp_header();
|
|---|
| 91 | echo "<h4>"._MD_DLCONF."</h4>";
|
|---|
| 92 | echo"<table width='100%' border='0' cellspacing='1' class='outer'>"
|
|---|
| 93 | ."<tr class=\"odd\"><td>";
|
|---|
| 94 | echo "<h4>"._MD_DLSWAITING." ($numrows)</h4><br />";
|
|---|
| 95 | if ($numrows>0) {
|
|---|
| 96 | while(list($lid, $cid, $title, $url, $homepage, $version, $size, $platform, $logourl, $uid) = $xoopsDB->fetchRow($result)) {
|
|---|
| 97 | $result2 = $xoopsDB->query("SELECT description FROM ".$xoopsDB->prefix("mydownloads_text")." WHERE lid=$lid");
|
|---|
| 98 | list($description) = $xoopsDB->fetchRow($result2);
|
|---|
| 99 | $title = $myts->makeTboxData4Edit($title);
|
|---|
| 100 | $url = $myts->makeTboxData4Edit($url);
|
|---|
| 101 | $homepage = $myts->makeTboxData4Edit($homepage);
|
|---|
| 102 | $version = $myts->makeTboxData4Edit($version);
|
|---|
| 103 | $size = $myts->makeTboxData4Edit($size);
|
|---|
| 104 | $platform = $myts->makeTboxData4Edit($platform);
|
|---|
| 105 | $description = $myts->makeTareaData4Edit($description);
|
|---|
| 106 | $submitter = XoopsUser::getUnameFromId($uid);
|
|---|
| 107 | echo "<form action=\"index.php\" method=post>\n";
|
|---|
| 108 | echo "<table width=\"80%\">";
|
|---|
| 109 | echo "<tr><td align=\"right\" nowrap>"._MD_SUBMITTER."</td><td>\n";
|
|---|
| 110 | echo "<a href=\"".XOOPS_URL."/userinfo.php?uid=".$uid."\">$submitter</a>";
|
|---|
| 111 | echo "</td></tr>\n";
|
|---|
| 112 | echo "<tr><td align=\"right\" nowrap>"._MD_FILETITLE."</td><td>";
|
|---|
| 113 | echo "<input type=\"text\" name=\"title\" size=\"50\" maxlength=\"100\" value=\"$title\">";
|
|---|
| 114 | echo "</td></tr><tr><td align=\"right\" nowrap>"._MD_DLURL."</td><td>";
|
|---|
| 115 | echo "<input type=\"text\" name=\"url\" size=\"50\" maxlength=\"250\" value=\"$url\">";
|
|---|
| 116 | echo " [ <a href=\"$url\">"._MD_DOWNLOAD."</a> ]";
|
|---|
| 117 | echo "</td></tr>";
|
|---|
| 118 | echo "<tr><td align=\"right\" nowrap>"._MD_CATEGORYC."</td><td>";
|
|---|
| 119 | $mytree->makeMySelBox("title", "title", $cid);
|
|---|
| 120 | echo "</td></tr>\n";
|
|---|
| 121 | echo "<tr><td align=\"right\" nowrap>"._MD_HOMEPAGEC."</td><td>\n";
|
|---|
| 122 | echo "<input type=\"text\" name=\"homepage\" size=\"50\" maxlength=\"100\" value=\"$homepage\"></td></tr>\n";
|
|---|
| 123 | echo "<tr><td align=\"right\">"._MD_VERSIONC."</td><td>\n";
|
|---|
| 124 | echo "<input type=\"text\" name=\"version\" size=\"10\" maxlength=\"10\" value=\"$version\"></td></tr>\n";
|
|---|
| 125 | echo "<tr><td align=\"right\">"._MD_FILESIZEC."</td><td>\n";
|
|---|
| 126 | echo "<input type=\"text\" name=\"size\" size=\"10\" maxlength=\"8\" value=\"$size\">"._MD_BYTES."</td></tr>\n";
|
|---|
| 127 | echo "<tr><td align=\"right\">"._MD_PLATFORMC."</td><td>\n";
|
|---|
| 128 | echo "<input type=\"text\" name=\"platform\" size=\"45\" maxlength=\"50\" value=\"$platform\"></td></tr>\n";
|
|---|
| 129 | echo "<tr><td align=\"right\" valign=\"top\" nowrap>"._MD_DESCRIPTIONC."</td><td>\n";
|
|---|
| 130 | echo "<textarea name=description cols=\"60\" rows=\"5\">$description</textarea>\n";
|
|---|
| 131 | echo "</td></tr>\n";
|
|---|
| 132 | echo "<tr><td align=\"right\" nowrap>"._MD_SHOTIMAGE."</td><td>\n";
|
|---|
| 133 | //echo "<input type=\"text\" name=\"logourl\" size=\"50\" maxlength=\"60\">\n";
|
|---|
| 134 | echo "<select size='1' name='logourl'>";
|
|---|
| 135 | echo "<option value=' '>------</option>";
|
|---|
| 136 | foreach($downimg_array as $image){
|
|---|
| 137 | echo "<option value='".$image."'>".$image."</option>";
|
|---|
| 138 | }
|
|---|
| 139 | echo "</select>";
|
|---|
| 140 | echo "</td></tr><tr><td></td><td>";
|
|---|
| 141 | $directory = XOOPS_URL."/modules/mydownloads/images/shots/";
|
|---|
| 142 | printf(_MD_MUSTBEVALID,$directory);
|
|---|
| 143 |
|
|---|
| 144 | echo "</table>\n";
|
|---|
| 145 | echo "<br /><input type=\"hidden\" name=\"op\" value=\"approve\"></input>";
|
|---|
| 146 | echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\"></input>";
|
|---|
| 147 | echo "<input type=\"submit\" value=\""._MD_APPROVE."\"></form>\n";
|
|---|
| 148 | echo myTextForm("index.php?op=delNewDownload&lid=$lid",_MD_DELETE);
|
|---|
| 149 | echo "<br /><br />";
|
|---|
| 150 | }
|
|---|
| 151 | }else{
|
|---|
| 152 | echo _MD_NOSUBMITTED;
|
|---|
| 153 | }
|
|---|
| 154 | echo"</td></tr></table>";
|
|---|
| 155 | xoops_cp_footer();
|
|---|
| 156 | }
|
|---|
| 157 |
|
|---|
| 158 |
|
|---|
| 159 | function downloadsConfigMenu()
|
|---|
| 160 | {
|
|---|
| 161 | global $xoopsDB, $myts, $eh, $mytree;
|
|---|
| 162 | // Add a New Main Category
|
|---|
| 163 | xoops_cp_header();
|
|---|
| 164 | $downimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/modules/mydownloads/images/shots/");
|
|---|
| 165 | echo "<h4>"._MD_DLCONF."</h4>";
|
|---|
| 166 | echo"<table width='100%' border='0' cellspacing='1' class='outer'>"
|
|---|
| 167 | ."<tr class=\"odd\"><td>";
|
|---|
| 168 | echo "<form method=post action=index.php>\n";
|
|---|
| 169 | echo "<h4>"._MD_ADDMAIN."</h4><br />"._MD_TITLEC."<input type=text name=title size=30 maxlength=50><br />";
|
|---|
| 170 | echo _MD_IMGURL."<br /><input type=\"text\" name=\"imgurl\" size=\"100\" maxlength=\"150\" value=\"http://\"><br /><br />";
|
|---|
| 171 | echo "<input type=hidden name=cid value=0>\n";
|
|---|
| 172 | echo "<input type=hidden name=op value=addCat>";
|
|---|
| 173 | echo "<input type=submit value="._MD_ADD."><br /></form>";
|
|---|
| 174 | echo"</td></tr></table>";
|
|---|
| 175 | echo "<br />";
|
|---|
| 176 | // Add a New Sub-Category
|
|---|
| 177 | $result=$xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("mydownloads_cat")."");
|
|---|
| 178 | list($numrows)=$xoopsDB->fetchRow($result);
|
|---|
| 179 | if($numrows>0) {
|
|---|
| 180 | echo"<table width='100%' border='0' cellspacing='1' class='outer'>"
|
|---|
| 181 | ."<tr class=\"odd\"><td>";
|
|---|
| 182 | echo "<form method=post action=index.php>";
|
|---|
| 183 | echo "<h4>"._MD_ADDSUB."</h4><br />"._MD_TITLEC."<input type=text name=title size=30 maxlength=50> "._MD_IN." ";
|
|---|
| 184 | $mytree->makeMySelBox("title", "title");
|
|---|
| 185 | # echo "<br />"._MD_IMGURL."<br /><input type=\"text\" name=\"imgurl\" size=\"100\" maxlength=\"150\">\n";
|
|---|
| 186 | echo "<input type=hidden name=op value=addCat><br /><br />";
|
|---|
| 187 | echo "<input type=submit value="._MD_ADD."><br /></form>";
|
|---|
| 188 | echo"</td></tr></table>";
|
|---|
| 189 | echo "<br />";
|
|---|
| 190 | // If there is a category, add a New Download
|
|---|
| 191 |
|
|---|
| 192 | echo"<table width='100%' border='0' cellspacing='1' class='outer'>"
|
|---|
| 193 | ."<tr class=\"odd\"><td>";
|
|---|
| 194 | echo "<form method=post action=index.php>\n";
|
|---|
| 195 | echo "<h4>"._MD_ADDNEWFILE."</h4><br />\n";
|
|---|
| 196 | echo "<table width=\"80%\"><tr>\n";
|
|---|
| 197 | echo "<td align=\"right\">"._MD_FILETITLE."</td><td>";
|
|---|
| 198 | echo "<input type=text name=title size=50 maxlength=100>";
|
|---|
| 199 | echo "</td></tr><tr><td align=\"right\" nowrap>"._MD_DLURL."</td><td>";
|
|---|
| 200 | echo "<input type=text name=url size=50 maxlength=250 value=\"http://\">";
|
|---|
| 201 | echo "</td></tr>";
|
|---|
| 202 | echo "<tr><td align=\"right\" nowrap>"._MD_CATEGORYC."</td><td>";
|
|---|
| 203 | $mytree->makeMySelBox("title", "title");
|
|---|
| 204 | echo "</td></tr><tr><td></td><td></td></tr>\n";
|
|---|
| 205 | echo "<tr><td align=\"right\" nowrap>"._MD_HOMEPAGEC."</td><td>\n";
|
|---|
| 206 | echo "<input type=text name=homepage size=50 maxlength=100 value=\"http://\" /></td></tr>\n";
|
|---|
| 207 | echo "<tr><td align=\"right\">"._MD_VERSIONC."</td><td>\n";
|
|---|
| 208 | echo "<input type=text name=version size=10 maxlength=10></td></tr>\n";
|
|---|
| 209 | echo "<tr><td align=\"right\">"._MD_FILESIZEC."</td><td>\n";
|
|---|
| 210 | echo "<input type=text name=size size=10 maxlength=100>"._MD_BYTES."</td></tr>\n";
|
|---|
| 211 | echo "<tr><td align=\"right\">"._MD_PLATFORMC."</td><td>\n";
|
|---|
| 212 | echo "<input type=text name=platform size=45 maxlength=60></td></tr>\n";
|
|---|
| 213 | echo "<tr><td align=\"right\" valign=\"top\" nowrap>"._MD_DESCRIPTIONC."</td><td>\n";
|
|---|
| 214 | xoopsCodeTarea("description",60,8);
|
|---|
| 215 | xoopsSmilies("description");
|
|---|
| 216 | //echo "<textarea name=description cols=60 rows=5></textarea>\n";
|
|---|
| 217 | echo "</td></tr>\n";
|
|---|
| 218 | echo "<tr><td align=\"right\"nowrap>"._MD_SHOTIMAGE."</td><td>\n";
|
|---|
| 219 | echo "<select size='1' name='logourl'>";
|
|---|
| 220 | echo "<option value=' '>------</option>";
|
|---|
| 221 | foreach($downimg_array as $image){
|
|---|
| 222 | echo "<option value='".$image."'>".$image."</option>";
|
|---|
| 223 | }
|
|---|
| 224 | echo "</select>";
|
|---|
| 225 | //echo "<input type=\"text\" name=\"logourl\" size=\"50\" maxlength=\"60\">";
|
|---|
| 226 |
|
|---|
| 227 | echo "</td></tr>\n";
|
|---|
| 228 | echo "<tr><td align=\"right\"></td><td>";
|
|---|
| 229 | $directory = XOOPS_URL."/modules/mydownloads/images/shots/";
|
|---|
| 230 | printf(_MD_MUSTBEVALID,$directory);
|
|---|
| 231 | echo "</td></tr>\n";
|
|---|
| 232 | echo "</table>\n<br />";
|
|---|
| 233 | echo "<input type=\"hidden\" name=\"op\" value=\"addDownload\"></input>";
|
|---|
| 234 | echo "<input type=\"submit\" class=\"button\" value=\""._MD_ADD."\"></input>\n";
|
|---|
| 235 | echo "</form>";
|
|---|
| 236 | echo"</td></tr></table>";
|
|---|
| 237 | echo "<br />";
|
|---|
| 238 |
|
|---|
| 239 | // Modify Category
|
|---|
| 240 | echo"<table width='100%' border='0' cellspacing='1' class='outer'>"
|
|---|
| 241 | ."<tr class=\"odd\"><td>";
|
|---|
| 242 | echo "<form method=post action=index.php><h4>"._MD_MODCAT."</h4><br />";
|
|---|
| 243 | echo _MD_CATEGORYC;
|
|---|
| 244 | $mytree->makeMySelBox("title", "title");
|
|---|
| 245 | echo "<br /><br />\n";
|
|---|
| 246 | echo "<input type=hidden name=op value=modCat>\n";
|
|---|
| 247 | echo "<input type=submit value="._MD_MODIFY.">\n";
|
|---|
| 248 | echo "</form>";
|
|---|
| 249 | echo"</td></tr></table>";
|
|---|
| 250 | echo "<br />";
|
|---|
| 251 | }
|
|---|
| 252 | // Modify Download
|
|---|
| 253 | $result2 = $xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("mydownloads_downloads")."");
|
|---|
| 254 | list($numrows2) = $xoopsDB->fetchRow($result2);
|
|---|
| 255 | if ($numrows2>0) {
|
|---|
| 256 | echo"<table width='100%' border='0' cellspacing='1' class='outer'>"
|
|---|
| 257 | ."<tr class=\"odd\"><td>";
|
|---|
| 258 | echo "<form method=get action=\"index.php\">\n";
|
|---|
| 259 | echo "<h4>"._MD_MODDL."</h4><br />\n";
|
|---|
| 260 | echo _MD_FILEID."<input type=text name=lid size=12 maxlength=11>\n";
|
|---|
| 261 | echo "<input type=hidden name=fct value=mydownloads>\n";
|
|---|
| 262 | echo "<input type=hidden name=op value=modDownload><br /><br />\n";
|
|---|
| 263 | echo "<input type=submit value="._MD_MODIFY."></form>\n";
|
|---|
| 264 | echo"</td></tr></table>";
|
|---|
| 265 | }
|
|---|
| 266 | xoops_cp_footer();
|
|---|
| 267 | }
|
|---|
| 268 |
|
|---|
| 269 | function modDownload()
|
|---|
| 270 | {
|
|---|
| 271 | global $xoopsDB, $HTTP_GET_VARS, $myts, $eh, $mytree;
|
|---|
| 272 | $downimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/modules/mydownloads/images/shots/");
|
|---|
| 273 | $lid = $HTTP_GET_VARS['lid'];
|
|---|
| 274 | xoops_cp_header();
|
|---|
| 275 | echo "<h4>"._MD_DLCONF."</h4>";
|
|---|
| 276 | echo"<table width='100%' border='0' cellspacing='1' class='outer'>"
|
|---|
| 277 | ."<tr class=\"odd\"><td>";
|
|---|
| 278 | $result = $xoopsDB->query("SELECT cid, title, url, homepage, version, size, platform, logourl FROM ".$xoopsDB->prefix("mydownloads_downloads")." WHERE lid=$lid") or $eh->show("0013");
|
|---|
| 279 | echo "<h4>"._MD_MODDL."</h4><br />";
|
|---|
| 280 | list($cid, $title, $url, $homepage, $version, $size, $platform, $logourl) = $xoopsDB->fetchRow($result);
|
|---|
| 281 | $title = $myts->makeTboxData4Edit($title);
|
|---|
| 282 | $url = $myts->makeTboxData4Edit($url);
|
|---|
| 283 | $homepage = $myts->makeTboxData4Edit($homepage);
|
|---|
| 284 | $version = $myts->makeTboxData4Edit($version);
|
|---|
| 285 | $size = $myts->makeTboxData4Edit($size);
|
|---|
| 286 | $platform = $myts->makeTboxData4Edit($platform);
|
|---|
| 287 | $logourl = $myts->makeTboxData4Edit($logourl);
|
|---|
| 288 | $result2 = $xoopsDB->query("SELECT description FROM ".$xoopsDB->prefix("mydownloads_text")." WHERE lid=$lid");
|
|---|
| 289 | list($description)=$xoopsDB->fetchRow($result2);
|
|---|
| 290 | $GLOBALS['description'] = $myts->makeTareaData4Edit($description);
|
|---|
| 291 | echo "<table>";
|
|---|
| 292 | echo "<form method=post action=index.php>";
|
|---|
| 293 | echo "<tr><td>"._MD_FILEID."</td><td><b>$lid</b></td></tr>";
|
|---|
| 294 | echo "<tr><td>"._MD_FILETITLE."</td><td><input type=text name=title value=\"$title\" size=50 maxlength=100></input></td></tr>\n";
|
|---|
| 295 | echo "<tr><td>"._MD_DLURL."</td><td><input type=text name=url value=\"$url\" size=50 maxlength=250></input></td></tr>\n";
|
|---|
| 296 | echo "<tr><td>"._MD_HOMEPAGEC."</td><td><input type=text name=homepage value=\"$homepage\" size=50 maxlength=100></input></td></tr>\n";
|
|---|
| 297 | echo "<tr><td>"._MD_VERSIONC."</td><td><input type=text name=version value=\"$version\" size=10 maxlength=10></input></td></tr>\n";
|
|---|
| 298 | echo "<tr><td>"._MD_FILESIZEC."</td><td><input type=text name=size value=\"$size\" size=10 maxlength=100></input>"._MD_BYTES."</td></tr>\n";
|
|---|
| 299 | echo "<tr><td>"._MD_PLATFORMC."</td><td><input type=text name=platform value=\"$platform\" size=45 maxlength=60></input></td></tr>\n";
|
|---|
| 300 | echo "<tr><td valign=\"top\">"._MD_DESCRIPTIONC."</td><td>";
|
|---|
| 301 | xoopsCodeTarea("description",60,8);
|
|---|
| 302 | xoopsSmilies("description");
|
|---|
| 303 | //echo "<textarea name=description cols=60 rows=5>$description</textarea>";
|
|---|
| 304 | echo "</td></tr>";
|
|---|
| 305 | echo "<tr><td>"._MD_CATEGORYC."</td><td>";
|
|---|
| 306 | $mytree->makeMySelBox("title", "title", $cid);
|
|---|
| 307 | echo "</td></tr>\n";
|
|---|
| 308 | echo "<tr><td>"._MD_SHOTIMAGE."</td><td>";
|
|---|
| 309 | //echo "<input type=text name=logourl value=\"$logourl\" size=\"50\" maxlength=\"60\"></input>";
|
|---|
| 310 | echo "<select size='1' name='logourl'>";
|
|---|
| 311 | echo "<option value=' '>------</option>";
|
|---|
| 312 | foreach($downimg_array as $image){
|
|---|
| 313 | if ( $image == $logourl ) {
|
|---|
| 314 | $opt_selected = "selected='selected'";
|
|---|
| 315 | }else{
|
|---|
| 316 | $opt_selected = "";
|
|---|
| 317 | }
|
|---|
| 318 | echo "<option value='".$image."' $opt_selected>".$image."</option>";
|
|---|
| 319 | }
|
|---|
| 320 | echo "</select>";
|
|---|
| 321 | echo "</td></tr>\n";
|
|---|
| 322 | echo "<tr><td></td><td>";
|
|---|
| 323 | $directory = XOOPS_URL."/modules/mydownloads/images/shots/";
|
|---|
| 324 | printf(_MD_MUSTBEVALID,$directory);
|
|---|
| 325 | echo "</td></tr>\n";
|
|---|
| 326 | echo "</table>";
|
|---|
| 327 | echo "<br /><br /><input type=hidden name=lid value=$lid></input>\n";
|
|---|
| 328 | echo "<input type=hidden name=op value=modDownloadS><input type=submit value="._MD_SUBMIT.">";
|
|---|
| 329 | echo "</form>\n";
|
|---|
| 330 | echo "<table><tr><td>\n";
|
|---|
| 331 | echo myTextForm("index.php?op=delDownload&lid=".$lid , _MD_DELETE);
|
|---|
| 332 | echo "</td><td>\n";
|
|---|
| 333 | echo myTextForm("index.php?op=downloadsConfigMenu", _MD_CANCEL);
|
|---|
| 334 | echo "</td></tr></table>\n";
|
|---|
| 335 | echo "<hr>";
|
|---|
| 336 |
|
|---|
| 337 | $result5=$xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("mydownloads_votedata")."");
|
|---|
| 338 | list($totalvotes) = $xoopsDB->getRowsNum($result5);
|
|---|
| 339 | echo "<table width=100%>\n";
|
|---|
| 340 | echo "<tr><td colspan=7><b>";
|
|---|
| 341 | printf(_MD_DLRATINGS,$totalvotes);
|
|---|
| 342 | echo "</b><br /><br /></td></tr>\n";
|
|---|
| 343 | // Show Registered Users Votes
|
|---|
| 344 | $result5=$xoopsDB->query("SELECT ratingid, ratinguser, rating, ratinghostname, ratingtimestamp FROM ".$xoopsDB->prefix("mydownloads_votedata")." WHERE lid = $lid AND ratinguser != 0 ORDER BY ratingtimestamp DESC");
|
|---|
| 345 | $votes = $xoopsDB->getRowsNum($result5);
|
|---|
| 346 | echo "<tr><td colspan=7><br /><br /><b>";
|
|---|
| 347 | printf(_MD_REGUSERVOTES,$votes);
|
|---|
| 348 | echo "</b><br /><br /></td></tr>\n";
|
|---|
| 349 | echo "<tr><td><b>" ._MD_USER." </b></td><td><b>" ._MD_IP." </b></td><td><b>" ._MD_RATING." </b></td><td><b>" ._MD_USERAVG." </b></td><td><b>" ._MD_TOTALRATE." </b></td><td><b>" ._MD_DATE." </b></td><td align=\"center\"><b>" ._MD_DELETE."</b></td></tr>\n";
|
|---|
| 350 | if ($votes == 0){
|
|---|
| 351 | echo "<tr><td align=\"center\" colspan=\"7\">" ._MD_NOREGVOTES."<br /></td></tr>\n";
|
|---|
| 352 | }
|
|---|
| 353 | $x=0;
|
|---|
| 354 | $colorswitch="dddddd";
|
|---|
| 355 | while(list($ratingid, $ratinguser, $rating, $ratinghostname, $ratingtimestamp)=$xoopsDB->fetchRow($result5)) {
|
|---|
| 356 | $formatted_date = formatTimestamp($ratingtimestamp);
|
|---|
| 357 | //Individual user information
|
|---|
| 358 | $result2=$xoopsDB->query("SELECT rating FROM ".$xoopsDB->prefix("mydownloads_votedata")." WHERE ratinguser = $ratinguser");
|
|---|
| 359 | $uservotes = $xoopsDB->getRowsNum($result2);
|
|---|
| 360 | $useravgrating = 0;
|
|---|
| 361 | while(list($rating2) = $xoopsDB->fetchRow($result2)){
|
|---|
| 362 | $useravgrating = $useravgrating + $rating2;
|
|---|
| 363 | }
|
|---|
| 364 | $useravgrating = $useravgrating / $uservotes;
|
|---|
| 365 | $useravgrating = number_format($useravgrating, 1);
|
|---|
| 366 | $ratinguname = XoopsUser::getUnameFromId($ratinguser);
|
|---|
| 367 | // echo "<tr><td bgcolor=\"$colorswitch\">$ratinguname</td><td bgcolor=\"$colorswitch\">$ratinghostname</td><td bgcolor=\"$colorswitch\">$rating</td><td bgcolor=\"$colorswitch\">$useravgrating</td><td bgcolor=\"$colorswitch\">$uservotes</td><td bgcolor=\"$colorswitch\">$formatted_date</td><td bgcolor=\"$colorswitch\" align=\"center\"><b><a href=index.php?op=delVote&lid=$lid&rid=$ratingid>X</a></b></td></tr>\n";
|
|---|
| 368 | // echo "<tr><td bgcolor=\"$colorswitch\">$ratinguname</td><td bgcolor=\"$colorswitch\">$ratinghostname</td><td bgcolor=\"$colorswitch\">$rating</td><td bgcolor=\"$colorswitch\">$useravgrating</td><td bgcolor=\"$colorswitch\">$uservotes</td><td bgcolor=\"$colorswitch\">$formatted_date</td><td bgcolor=\"$colorswitch\" align=\"center\">";
|
|---|
| 369 | echo "<tr><td bgcolor=\"$colorswitch\">$ratinguname</td><td bgcolor=\"$colorswitch\">$ratinghostname</td><td bgcolor=\"$colorswitch\">$rating</td><td bgcolor=\"$colorswitch\">$useravgrating</td><td bgcolor=\"$colorswitch\">$uservotes</td><td bgcolor=\"$colorswitch\">$formatted_date</td><td bgcolor=\"$colorswitch\" align=\"center\">";
|
|---|
| 370 | //echo "<table><tr><td>\n";
|
|---|
| 371 | echo myTextForm("index.php?op=delVote&lid=$lid&rid=$ratingid" , "X");
|
|---|
| 372 | // echo "</td></tr></table>\n";
|
|---|
| 373 | echo "</td></tr>\n";
|
|---|
| 374 |
|
|---|
| 375 | $x++;
|
|---|
| 376 | if ($colorswitch=="dddddd"){
|
|---|
| 377 | $colorswitch="ffffff";
|
|---|
| 378 | } else {
|
|---|
| 379 | $colorswitch="dddddd";
|
|---|
| 380 | }
|
|---|
| 381 | }
|
|---|
| 382 |
|
|---|
| 383 | // Show Unregistered Users Votes
|
|---|
| 384 | $result5=$xoopsDB->query("SELECT ratingid, rating, ratinghostname, ratingtimestamp FROM ".$xoopsDB->prefix("mydownloads_votedata")." WHERE lid = $lid AND ratinguser = 0 ORDER BY ratingtimestamp DESC");
|
|---|
| 385 | $votes = $xoopsDB->getRowsNum($result5);
|
|---|
| 386 | echo "<tr><td colspan=7><b><br /><br />";
|
|---|
| 387 | printf(_MD_ANONUSERVOTES,$votes);
|
|---|
| 388 | echo "</b><br /><br /></td></tr>\n";
|
|---|
| 389 | echo "<tr><td colspan=2><b>" ._MD_IP." </b></td><td colspan=3><b>" ._MD_RATING." </b></td><td><b>" ._MD_DATE." </b></b></td><td align=\"center\"><b>" ._MD_DELETE."</b></td><br /></tr>";
|
|---|
| 390 | if ($votes == 0) {
|
|---|
| 391 | echo "<tr><td colspan=\"7\" align=\"center\">" ._MD_NOUNREGVOTES."<br /></td></tr>";
|
|---|
| 392 | }
|
|---|
| 393 | $x=0;
|
|---|
| 394 | $colorswitch="dddddd";
|
|---|
| 395 | while(list($ratingid, $rating, $ratinghostname, $ratingtimestamp)=$xoopsDB->fetchRow($result5)) {
|
|---|
| 396 | $formatted_date = formatTimestamp($ratingtimestamp);
|
|---|
| 397 | // echo "<td colspan=\"2\" bgcolor=\"$colorswitch\">$ratinghostname</td><td colspan=\"3\" bgcolor=\"$colorswitch\">$rating</td><td bgcolor=\"$colorswitch\">$formatted_date</td><td bgcolor=\"$colorswitch\" aling=\"center\"><b><a href=index.php?op=delVote&lid=$lid&rid=$ratingid>X</a></b></td></tr>";
|
|---|
| 398 | echo "<td colspan=\"2\" bgcolor=\"$colorswitch\">$ratinghostname</td><td colspan=\"3\" bgcolor=\"$colorswitch\">$rating</td><td bgcolor=\"$colorswitch\">$formatted_date</td><td bgcolor=\"$colorswitch\" align=\"center\">";
|
|---|
| 399 | //echo "<table><tr><td>\n";
|
|---|
| 400 | //align=\"center\"
|
|---|
| 401 | echo myTextForm("index.php?op=delVote&lid=$lid&rid=$ratingid" , "X");
|
|---|
| 402 | //echo "</td></tr></table>\n";
|
|---|
| 403 |
|
|---|
| 404 | echo "</td></tr>";
|
|---|
| 405 |
|
|---|
| 406 | $x++;
|
|---|
| 407 | if ($colorswitch=="dddddd") {
|
|---|
| 408 | $colorswitch="ffffff";
|
|---|
| 409 | } else {
|
|---|
| 410 | $colorswitch="dddddd";
|
|---|
| 411 | }
|
|---|
| 412 | }
|
|---|
| 413 | echo "<tr><td colspan=\"6\"> <br /></td></tr>\n";
|
|---|
| 414 | echo "</table>\n";
|
|---|
| 415 | echo"</td></tr></table>";
|
|---|
| 416 | xoops_cp_footer();
|
|---|
| 417 | }
|
|---|
| 418 |
|
|---|
| 419 | function delVote()
|
|---|
| 420 | {
|
|---|
| 421 | global $xoopsDB, $HTTP_GET_VARS, $eh;
|
|---|
| 422 | $rid = $HTTP_GET_VARS['rid'];
|
|---|
| 423 | $lid = $HTTP_GET_VARS['lid'];
|
|---|
| 424 | $sql = sprintf("DELETE FROM %s WHERE ratingid = %u", $xoopsDB->prefix("mydownloads_votedata"), $rid);
|
|---|
| 425 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 426 | updaterating($lid);
|
|---|
| 427 | redirect_header("index.php",1,_MD_VOTEDELETED);
|
|---|
| 428 | }
|
|---|
| 429 |
|
|---|
| 430 | function listBrokenDownloads()
|
|---|
| 431 | {
|
|---|
| 432 | global $xoopsDB, $eh;
|
|---|
| 433 | $result = $xoopsDB->query("SELECT * FROM ".$xoopsDB->prefix("mydownloads_broken")." ORDER BY reportid");
|
|---|
| 434 | $totalbrokendownloads = $xoopsDB->getRowsNum($result);
|
|---|
| 435 | xoops_cp_header();
|
|---|
| 436 | echo "<h4>"._MD_DLCONF."</h4>";
|
|---|
| 437 | echo"<table width='100%' border='0' cellspacing='1' class='outer'>"
|
|---|
| 438 | ."<tr class=\"odd\"><td>";
|
|---|
| 439 | echo "<h4>"._MD_BROKENREPORTS." ($totalbrokendownloads)</h4><br />";
|
|---|
| 440 |
|
|---|
| 441 | if ($totalbrokendownloads==0) {
|
|---|
| 442 | echo _MD_NOBROKEN;
|
|---|
| 443 | } else {
|
|---|
| 444 | echo "<center>"._MD_IGNOREDESC."<br />"._MD_DELETEDESC."</center><br /><br /><br />";
|
|---|
| 445 | $colorswitch="#dddddd";
|
|---|
| 446 | echo "<table align=\"center\" width=\"90%\">";
|
|---|
| 447 | echo "
|
|---|
| 448 | <tr>
|
|---|
| 449 | <td><b>"._MD_FILETITLE."</b></td>
|
|---|
| 450 | <td><b>" ._MD_REPORTER."</b></td>
|
|---|
| 451 | <td><b>" ._MD_FILESUBMITTER."</b></td>
|
|---|
| 452 | <td><b>" ._MD_IGNORE."</b></td>
|
|---|
| 453 | <td><b>" ._EDIT."</b></td>
|
|---|
| 454 | <td><b>" ._MD_DELETE."</b></td>
|
|---|
| 455 | </tr>";
|
|---|
| 456 | while(list($reportid, $lid, $sender, $ip)=$xoopsDB->fetchRow($result)){
|
|---|
| 457 | $result2 = $xoopsDB->query("SELECT title, url, submitter FROM ".$xoopsDB->prefix("mydownloads_downloads")." WHERE lid=$lid");
|
|---|
| 458 | if ($sender != 0) {
|
|---|
| 459 | $result3 = $xoopsDB->query("SELECT uname, email FROM ".$xoopsDB->prefix("users")." WHERE uid=".$sender."");
|
|---|
| 460 | list($sendername, $email)=$xoopsDB->fetchRow($result3);
|
|---|
| 461 | }
|
|---|
| 462 | list($title, $url, $owner)=$xoopsDB->fetchRow($result2);
|
|---|
| 463 | $result4 = $xoopsDB->query("SELECT uname, email FROM ".$xoopsDB->prefix("users")." WHERE uid=".$owner."");
|
|---|
| 464 | list($ownername, $owneremail)=$xoopsDB->fetchRow($result4);
|
|---|
| 465 | echo "<tr><td bgcolor=$colorswitch><a href=$url target='_blank'>$title</a></td>";
|
|---|
| 466 | if ($email=="") {
|
|---|
| 467 | echo "<td bgcolor=$colorswitch>$sendername ($ip)";
|
|---|
| 468 | } else {
|
|---|
| 469 | echo "<td bgcolor=$colorswitch><a href=mailto:$email>$sendername</a> ($ip)";
|
|---|
| 470 | }
|
|---|
| 471 | echo "</td>";
|
|---|
| 472 | if ($owneremail=='') {
|
|---|
| 473 | echo "<td bgcolor=$colorswitch>$ownername";
|
|---|
| 474 | } else {
|
|---|
| 475 | echo "<td bgcolor=$colorswitch><a href=mailto:$owneremail>$ownername</a>";
|
|---|
| 476 | }
|
|---|
| 477 | echo "</td><td bgcolor='$colorswitch' align='center'>\n";
|
|---|
| 478 | echo myTextForm("index.php?op=ignoreBrokenDownloads&lid=$lid" , "X");
|
|---|
| 479 | echo "</td><td bgcolor='$colorswitch' align='center'>\n";
|
|---|
| 480 | echo myTextForm("index.php?op=modDownload&lid=$lid" , "X");
|
|---|
| 481 | echo "</td><td bgcolor='$colorswitch' align='center'>\n";
|
|---|
| 482 | echo myTextForm("index.php?op=delBrokenDownloads&lid=$lid" , "X");
|
|---|
| 483 | echo "</td></tr>\n";
|
|---|
| 484 | if ($colorswitch=="#dddddd") {
|
|---|
| 485 | $colorswitch="#ffffff";
|
|---|
| 486 | } else {
|
|---|
| 487 | $colorswitch="#dddddd";
|
|---|
| 488 | }
|
|---|
| 489 | }
|
|---|
| 490 | echo "</table>";
|
|---|
| 491 | }
|
|---|
| 492 | echo"</td></tr></table>";
|
|---|
| 493 | xoops_cp_footer();
|
|---|
| 494 | }
|
|---|
| 495 |
|
|---|
| 496 | function delBrokenDownloads()
|
|---|
| 497 | {
|
|---|
| 498 | global $xoopsDB, $HTTP_GET_VARS, $eh;
|
|---|
| 499 | $lid = $HTTP_GET_VARS['lid'];
|
|---|
| 500 | $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mydownloads_broken"), $lid);
|
|---|
| 501 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 502 | $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mydownloads_downloads"), $lid);
|
|---|
| 503 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 504 | redirect_header("index.php",1,_MD_FILEDELETED);
|
|---|
| 505 | }
|
|---|
| 506 |
|
|---|
| 507 | function ignoreBrokenDownloads()
|
|---|
| 508 | {
|
|---|
| 509 | global $xoopsDB, $HTTP_GET_VARS, $eh;
|
|---|
| 510 | $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mydownloads_broken"), $HTTP_GET_VARS['lid']);
|
|---|
| 511 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 512 | redirect_header("index.php",1,_MD_BROKENDELETED);
|
|---|
| 513 | }
|
|---|
| 514 |
|
|---|
| 515 | function listModReq()
|
|---|
| 516 | {
|
|---|
| 517 | global $xoopsDB, $myts, $eh, $mytree, $xoopsModuleConfig;
|
|---|
| 518 | $result = $xoopsDB->query("SELECT * FROM ".$xoopsDB->prefix("mydownloads_mod")." ORDER BY requestid");
|
|---|
| 519 | $totalmodrequests = $xoopsDB->getRowsNum($result);
|
|---|
| 520 | xoops_cp_header();
|
|---|
| 521 | echo "<h4>"._MD_DLCONF."</h4>";
|
|---|
| 522 | echo"<table width='100%' border='0' cellspacing='1' class='outer'>"
|
|---|
| 523 | ."<tr class=\"odd\"><td>";
|
|---|
| 524 | echo "<h4>"._MD_USERMODREQ." ($totalmodrequests)</h4><br />";
|
|---|
| 525 | if($totalmodrequests>0){
|
|---|
| 526 | echo "<table width=95%><tr><td>";
|
|---|
| 527 | $lookup_lid = array();
|
|---|
| 528 | while(list($requestid, $lid, $cid, $title, $url, $homepage, $version, $size, $platform, $logourl, $description, $modifysubmitter)=$xoopsDB->fetchRow($result)) {
|
|---|
| 529 | $lookup_lid[$requestid] = $lid;
|
|---|
| 530 | $result2 = $xoopsDB->query("SELECT cid, title, url, homepage, version, size, platform, logourl, submitter FROM ".$xoopsDB->prefix("mydownloads_downloads")." WHERE lid=$lid");
|
|---|
| 531 | list($origcid, $origtitle, $origurl, $orighomepage, $origversion, $origsize, $origplatform, $origlogourl, $owner)=$xoopsDB->fetchRow($result2);
|
|---|
| 532 | $result2 = $xoopsDB->query("SELECT description FROM ".$xoopsDB->prefix("mydownloads_text")." WHERE lid=$lid");
|
|---|
| 533 | list($origdescription) = $xoopsDB->fetchRow($result2);
|
|---|
| 534 | $result7 = $xoopsDB->query("SELECT uname, email FROM ".$xoopsDB->prefix("users")." WHERE uid=$modifysubmitter");
|
|---|
| 535 | $result8 = $xoopsDB->query("SELECT uname, email FROM ".$xoopsDB->prefix("users")." WHERE uid=$owner");
|
|---|
| 536 | $cidtitle=$mytree->getPathFromId($cid, "title");
|
|---|
| 537 | $origcidtitle=$mytree->getPathFromId($origcid, "title");
|
|---|
| 538 | list($submittername, $submitteremail)=$xoopsDB->fetchRow($result7);
|
|---|
| 539 | list($ownername, $owneremail)=$xoopsDB->fetchRow($result8);
|
|---|
| 540 | $title = $myts->makeTboxData4Show($title);
|
|---|
| 541 | $url = $myts->makeTboxData4Show($url);
|
|---|
| 542 | $homepage = $myts->makeTboxData4Show($homepage);
|
|---|
| 543 | $version = $myts->makeTboxData4Show($version);
|
|---|
| 544 | $size = $myts->makeTboxData4Show($size);
|
|---|
| 545 | $platform = $myts->makeTboxData4Show($platform);
|
|---|
| 546 |
|
|---|
| 547 | // use original image file to prevent users from changing screen shots file
|
|---|
| 548 | $origlogourl = $myts->makeTboxData4Edit($origlogourl);
|
|---|
| 549 | $logourl = $origlogourl;
|
|---|
| 550 | $description = $myts->makeTareaData4Show($description, 0);
|
|---|
| 551 | $origurl = $myts->makeTboxData4Show($origurl);
|
|---|
| 552 | $orighomepage = $myts->makeTboxData4Show($orighomepage);
|
|---|
| 553 | $origversion = $myts->makeTboxData4Show($origversion);
|
|---|
| 554 | $origsize = $myts->makeTboxData4Show($origsize);
|
|---|
| 555 | $origplatform = $myts->makeTboxData4Show($origplatform);
|
|---|
| 556 | $origdescription = $myts->makeTareaData4Show($origdescription, 0);
|
|---|
| 557 | if (empty($ownername)) {
|
|---|
| 558 | $ownername = "administration";
|
|---|
| 559 | }
|
|---|
| 560 | echo "<table border=1 bordercolor=black cellpadding=5 cellspacing=0 align=center width=450><tr><td>
|
|---|
| 561 | <table width=100% bgcolor=dddddd>
|
|---|
| 562 | <tr>
|
|---|
| 563 | <td valign=top width=45%><b>"._MD_ORIGINAL."</b></td>
|
|---|
| 564 | <td rowspan=14 valign=top align=left><br />"._MD_DESCRIPTIONC."<br />$origdescription</td>
|
|---|
| 565 | </tr>
|
|---|
| 566 | <tr><td valign=top width=45%><small>"._MD_FILETITLE." ".$origtitle."</small></td></tr>
|
|---|
| 567 | <tr><td valign=top width=45%><small>"._MD_DLURL." ".$origurl."</small></td></tr>
|
|---|
| 568 | <tr><td valign=top width=45%><small>"._MD_CATEGORYC." ".$origcidtitle."</small></td></tr>
|
|---|
| 569 | <tr><td valign=top width=45%><small>"._MD_HOMEPAGEC." ".$orighomepage."</small></td></tr>
|
|---|
| 570 | <tr><td valign=top width=45%><small>"._MD_VERSIONC." ".$origversion."</small></td></tr>
|
|---|
| 571 | <tr><td valign=top width=45%><small>"._MD_FILESIZEC." ".$origsize."</small></td></tr>
|
|---|
| 572 | <tr><td valign=top width=45%><small>"._MD_PLATFORMC." ".$origplatform."</small></td></tr>
|
|---|
| 573 | <tr><td valign=top width=45%><small>"._MD_SHOTIMAGE."</small> ";
|
|---|
| 574 | if ( $xoopsModuleConfig['useshots'] && !empty($origlogourl) ){
|
|---|
| 575 | echo "<img src=\"".XOOPS_URL."/modules/mydownloads/images/shots/".$origlogourl."\" width=\"".$xoopsModuleConfig['shotwidth']."\">";
|
|---|
| 576 | }else{
|
|---|
| 577 | echo " ";
|
|---|
| 578 | }
|
|---|
| 579 | echo "</td></tr>
|
|---|
| 580 | </table></td></tr><tr><td>
|
|---|
| 581 | <table width=100%>
|
|---|
| 582 | <tr>
|
|---|
| 583 | <td valign=top width=45%><b>"._MD_PROPOSED."</b></td>
|
|---|
| 584 | <td rowspan=14 valign=top align=left><br />"._MD_DESCRIPTIONC."<br />$description</td>
|
|---|
| 585 | </tr>
|
|---|
| 586 | <tr><td valign=top width=45%><small>"._MD_FILETITLE." ".$title."</small></td></tr>
|
|---|
| 587 | <tr><td valign=top width=45%><small>"._MD_DLURL." ".$url."</small></td></tr>
|
|---|
| 588 | <tr><td valign=top width=45%><small>"._MD_CATEGORYC." ".$cidtitle."</small></td></tr>
|
|---|
| 589 | <tr><td valign=top width=45%><small>"._MD_HOMEPAGEC." ".$homepage."</small></td></tr>
|
|---|
| 590 | <tr><td valign=top width=45%><small>"._MD_VERSIONC." ".$version."</small></td></tr>
|
|---|
| 591 | <tr><td valign=top width=45%><small>"._MD_FILESIZEC." ".$size."</small></td></tr>
|
|---|
| 592 | <tr><td valign=top width=45%><small>"._MD_PLATFORMC." ".$platform."</small></td></tr>
|
|---|
| 593 | <tr><td valign=top width=45%><small>"._MD_SHOTIMAGE."</small> ";
|
|---|
| 594 | if ( $xoopsModuleConfig['useshots'] && !empty($logourl) ){
|
|---|
| 595 | echo "<img src=\"".XOOPS_URL."/modules/mydownloads/images/shots/".$logourl."\" width=\"".$xoopsModuleConfig['shotwidth']."\">";
|
|---|
| 596 | } else {
|
|---|
| 597 | echo " ";
|
|---|
| 598 | }
|
|---|
| 599 | echo "</td></tr>
|
|---|
| 600 | </table></td></tr></table>
|
|---|
| 601 | <table align=center width=450>
|
|---|
| 602 | <tr>";
|
|---|
| 603 | if ( $submitteremail=="" ) {
|
|---|
| 604 | echo "<td align=left><small>"._MD_SUBMITTER." $submittername</small></td>";
|
|---|
| 605 | } else {
|
|---|
| 606 | echo "<td align=left><small>"._MD_SUBMITTER." <a href=mailto:$submitteremail>$submittername</a></small></td>";
|
|---|
| 607 | }
|
|---|
| 608 | if ($owneremail=="") {
|
|---|
| 609 | echo "<td align=center><small>"._MD_OWNER." $ownername</small></td>";
|
|---|
| 610 | } else {
|
|---|
| 611 | echo "<td align=center><small>"._MD_OWNER." <a href=mailto:$owneremail>$ownername</a></small></td>";
|
|---|
| 612 | }
|
|---|
| 613 | echo "<td align=right><small>\n";
|
|---|
| 614 | echo "<table><tr><td>\n";
|
|---|
| 615 | echo myTextForm("index.php?op=changeModReq&requestid=$requestid" , _MD_APPROVE);
|
|---|
| 616 | echo "</td><td>\n";
|
|---|
| 617 | echo myTextForm("index.php?op=modDownload&lid=$lookup_lid[$requestid]", _EDIT);
|
|---|
| 618 | echo "</td><td>\n";
|
|---|
| 619 | echo myTextForm("index.php?op=ignoreModReq&requestid=$requestid", _MD_IGNORE);
|
|---|
| 620 | echo "</td></tr></table>\n";
|
|---|
| 621 | echo "</small></td></tr>\n";
|
|---|
| 622 | echo "</table><br /><br />";
|
|---|
| 623 | }
|
|---|
| 624 | echo "</td></tr></table>";
|
|---|
| 625 | }else {
|
|---|
| 626 | echo _MD_NOMODREQ;
|
|---|
| 627 | }
|
|---|
| 628 | echo"</td></tr></table>";
|
|---|
| 629 | xoops_cp_footer();
|
|---|
| 630 | }
|
|---|
| 631 |
|
|---|
| 632 | function changeModReq()
|
|---|
| 633 | {
|
|---|
| 634 | global $xoopsDB, $HTTP_GET_VARS, $eh, $myts;
|
|---|
| 635 | $requestid = $HTTP_GET_VARS['requestid'];
|
|---|
| 636 | $query = "SELECT lid, cid, title, url, homepage, version, size, platform, logourl, description FROM ".$xoopsDB->prefix("mydownloads_mod")." WHERE requestid=$requestid";
|
|---|
| 637 | $result = $xoopsDB->query($query);
|
|---|
| 638 | while(list($lid, $cid, $title, $url, $homepage, $version, $size, $platform, $logourl, $description)=$xoopsDB->fetchRow($result)) {
|
|---|
| 639 | if (get_magic_quotes_runtime()) {
|
|---|
| 640 | $title = stripslashes($title);
|
|---|
| 641 | $url = stripslashes($url);
|
|---|
| 642 | $homepage = stripslashes($homepage);
|
|---|
| 643 | $logourl = stripslashes($logourl);
|
|---|
| 644 | $description = stripslashes($description);
|
|---|
| 645 | }
|
|---|
| 646 | $title = addslashes($title);
|
|---|
| 647 | $url = addslashes($url);
|
|---|
| 648 | $homepage = addslashes($homepage);
|
|---|
| 649 | $logourl = addslashes($logourl);
|
|---|
| 650 | $description = addslashes($description);
|
|---|
| 651 | $sql = sprintf("UPDATE %s SET cid = %u,title = '%s', url = '%s', homepage = '%s', version = '%s', size = %u, platform = '%s', logourl = '%s', status = %u, date = %u WHERE lid = %u", $xoopsDB->prefix("mydownloads_downloads"), $cid, $title, $url, $homepage, $version, $size, $platform, $logourl, 2, time(), $lid);
|
|---|
| 652 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 653 | $sql = sprintf("UPDATE %s SET description = '%s' WHERE lid = %u", $xoopsDB->prefix("mydownloads_text"), $description, $lid);
|
|---|
| 654 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 655 | $sql = sprintf("DELETE FROM %s WHERE requestid = %u", $xoopsDB->prefix("mydownloads_mod"), $requestid);
|
|---|
| 656 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 657 | }
|
|---|
| 658 | redirect_header("index.php",1,_MD_DBUPDATED);
|
|---|
| 659 | }
|
|---|
| 660 |
|
|---|
| 661 | function ignoreModReq()
|
|---|
| 662 | {
|
|---|
| 663 | global $xoopsDB, $HTTP_GET_VARS, $eh;
|
|---|
| 664 | $sql = sprintf("DELETE FROM %s WHERE requestid = %u", $xoopsDB->prefix("mydownloads_mod"), $HTTP_GET_VARS['requestid']);
|
|---|
| 665 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 666 | redirect_header("index.php",1,_MD_MODREQDELETED);
|
|---|
| 667 | }
|
|---|
| 668 |
|
|---|
| 669 | function modDownloadS()
|
|---|
| 670 | {
|
|---|
| 671 | global $xoopsDB, $HTTP_POST_VARS, $myts, $eh;
|
|---|
| 672 | $cid = $HTTP_POST_VARS["cid"];
|
|---|
| 673 | if (($HTTP_POST_VARS["url"]) || ($HTTP_POST_VARS["url"]!="")) {
|
|---|
| 674 | $url = $myts->makeTboxData4Save($HTTP_POST_VARS["url"]);
|
|---|
| 675 | }
|
|---|
| 676 | $logourl = $myts->makeTboxData4Save($HTTP_POST_VARS["logourl"]);
|
|---|
| 677 | $title = $myts->makeTboxData4Save($HTTP_POST_VARS["title"]);
|
|---|
| 678 | $homepage = $myts->makeTboxData4Save($HTTP_POST_VARS["homepage"]);
|
|---|
| 679 | $version = $myts->makeTboxData4Save($HTTP_POST_VARS["version"]);
|
|---|
| 680 | $size = $myts->makeTboxData4Save($HTTP_POST_VARS["size"]);
|
|---|
| 681 | $platform = $myts->makeTboxData4Save($HTTP_POST_VARS["platform"]);
|
|---|
| 682 | $description = $myts->makeTareaData4Save($HTTP_POST_VARS["description"]);
|
|---|
| 683 | $sql = sprintf("UPDATE %s SET cid = %u, title = '%s', url = '%s', homepage = '%s', version = '%s', size = %u, platform = '%s', logourl = '%s', status = %u, date = %u WHERE lid = %u", $xoopsDB->prefix("mydownloads_downloads"), $cid, $title, $url, $homepage, $version, $size, $platform, $logourl, 2, time(), $HTTP_POST_VARS['lid']);
|
|---|
| 684 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 685 | $sql = sprintf("UPDATE %s SET description = '%s' WHERE lid = %u", $xoopsDB->prefix("mydownloads_text"), $description, $HTTP_POST_VARS['lid']);
|
|---|
| 686 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 687 | redirect_header("index.php",1,_MD_DBUPDATED);
|
|---|
| 688 | }
|
|---|
| 689 |
|
|---|
| 690 | function delDownload()
|
|---|
| 691 | {
|
|---|
| 692 | global $xoopsDB, $HTTP_GET_VARS, $eh, $xoopsModule;
|
|---|
| 693 | $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mydownloads_downloads"), $HTTP_GET_VARS['lid']);
|
|---|
| 694 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 695 | $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mydownloads_text"), $HTTP_GET_VARS['lid']);
|
|---|
| 696 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 697 | $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mydownloads_votedata"), $HTTP_GET_VARS['lid']);
|
|---|
| 698 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 699 | // delete comments
|
|---|
| 700 | xoops_comment_delete($xoopsModule->getVar('mid'), $HTTP_GET_VARS['lid']);
|
|---|
| 701 | redirect_header("index.php",1,_MD_FILEDELETED);
|
|---|
| 702 | }
|
|---|
| 703 |
|
|---|
| 704 | function modCat()
|
|---|
| 705 | {
|
|---|
| 706 | global $xoopsDB, $HTTP_POST_VARS, $myts, $eh, $mytree;
|
|---|
| 707 | $cid = $HTTP_POST_VARS["cid"];
|
|---|
| 708 | xoops_cp_header();
|
|---|
| 709 | echo "<h4>"._MD_DLCONF."</h4>";
|
|---|
| 710 | echo"<table width='100%' border='0' cellspacing='1' class='outer'>"
|
|---|
| 711 | ."<tr class=\"odd\"><td>";
|
|---|
| 712 | echo "<h4>"._MD_MODCAT."</h4><br />";
|
|---|
| 713 | $result=$xoopsDB->query("SELECT pid, title, imgurl FROM ".$xoopsDB->prefix("mydownloads_cat")." WHERE cid=$cid");
|
|---|
| 714 | list($pid,$title,$imgurl) = $xoopsDB->fetchRow($result);
|
|---|
| 715 | $title = $myts->makeTboxData4Edit($title);
|
|---|
| 716 | $imgurl = $myts->makeTboxData4Edit($imgurl);
|
|---|
| 717 | echo "<form action=index.php method=post>"._MD_TITLEC."<input type=text name=title value=\"$title\" size=51 maxlength=50><br /><br />"._MD_IMGURLMAIN."<br /><input type=text name=imgurl value=\"$imgurl\" size=100 maxlength=150><br />
|
|---|
| 718 | <br />"._MD_PARENT." ";
|
|---|
| 719 | $mytree->makeMySelBox("title", "title", $pid, 1, "pid");
|
|---|
| 720 | echo "<input type='hidden' name='cid' value='$cid'>
|
|---|
| 721 | <input type=hidden name=op value=modCatS><br />
|
|---|
| 722 | <input type=submit value=\""._MD_SAVE."\">
|
|---|
| 723 | <input type=button value="._MD_DELETE." onClick=\"location='index.php?pid=$pid&cid=$cid&op=delCat'\">";
|
|---|
| 724 | echo " <input type=button value="._MD_CANCEL." onclick=\"javascript:history.go(-1)\" />";
|
|---|
| 725 | echo "</form>";
|
|---|
| 726 | echo"</td></tr></table>";
|
|---|
| 727 | xoops_cp_footer();
|
|---|
| 728 | }
|
|---|
| 729 |
|
|---|
| 730 | function modCatS()
|
|---|
| 731 | {
|
|---|
| 732 | global $xoopsDB, $HTTP_POST_VARS, $myts, $eh;
|
|---|
| 733 | $cid = $HTTP_POST_VARS['cid'];
|
|---|
| 734 | $sid = $HTTP_POST_VARS['pid'];
|
|---|
| 735 | $title = $myts->makeTboxData4Save($HTTP_POST_VARS['title']);
|
|---|
| 736 | if (empty($title)) {
|
|---|
| 737 | redirect_header("index.php", 2, _MD_ERRORTITLE);
|
|---|
| 738 | exit();
|
|---|
| 739 | }
|
|---|
| 740 | if (($HTTP_POST_VARS["imgurl"]) || ($HTTP_POST_VARS["imgurl"]!="")) {
|
|---|
| 741 | $imgurl = $myts->makeTboxData4Save($HTTP_POST_VARS["imgurl"]);
|
|---|
| 742 | }
|
|---|
| 743 | $sql = sprintf("UPDATE %s SET title = '%s', imgurl = '%s', pid = %u WHERE cid = %u", $xoopsDB->prefix("mydownloads_cat"), $title, $imgurl, $sid, $cid);
|
|---|
| 744 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 745 | redirect_header("index.php",1,_MD_DBUPDATED);
|
|---|
| 746 | }
|
|---|
| 747 |
|
|---|
| 748 | function delCat()
|
|---|
| 749 | {
|
|---|
| 750 | global $xoopsDB, $HTTP_GET_VARS, $HTTP_POST_VARS, $eh, $mytree, $xoopsModule;
|
|---|
| 751 | $cid = isset($HTTP_POST_VARS['cid']) ? intval($HTTP_POST_VARS['cid']) : intval($HTTP_GET_VARS['cid']);
|
|---|
| 752 | $ok = isset($HTTP_POST_VARS['ok']) ? intval($HTTP_POST_VARS['ok']) : 0;
|
|---|
| 753 | if ($ok == 1) {
|
|---|
| 754 | //get all subcategories under the specified category
|
|---|
| 755 | $arr=$mytree->getAllChildId($cid);
|
|---|
| 756 | $lcount = count($arr);
|
|---|
| 757 | for ($i = 0; $i < $lcount; $i++) {
|
|---|
| 758 | //get all downloads in each subcategory
|
|---|
| 759 | $result=$xoopsDB->query("SELECT lid FROM ".$xoopsDB->prefix("mydownloads_downloads")." WHERE cid=".$arr[$i]."") or $eh->show("0013");
|
|---|
| 760 | //now for each download, delete the text data and vote ata associated with the download
|
|---|
| 761 | while ( list($lid)=$xoopsDB->fetchRow($result) ) {
|
|---|
| 762 | $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mydownloads_text"), $lid);
|
|---|
| 763 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 764 | $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mydownloads_votedata"), $lid);
|
|---|
| 765 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 766 | $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mydownloads_downloads"), $lid);
|
|---|
| 767 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 768 | // delete comments
|
|---|
| 769 | xoops_comment_delete($xoopsModule->getVar('mid'), $lid);
|
|---|
| 770 | }
|
|---|
| 771 |
|
|---|
| 772 | //all downloads for each subcategory is deleted, now delete the subcategory data
|
|---|
| 773 | $sql = sprintf("DELETE FROM %s WHERE cid = %u", $xoopsDB->prefix("mydownloads_cat"), $arr[$i]);
|
|---|
| 774 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 775 | }
|
|---|
| 776 | //all subcategory and associated data are deleted, now delete category data and its associated data
|
|---|
| 777 | $result=$xoopsDB->query("SELECT lid FROM ".$xoopsDB->prefix("mydownloads_downloads")." WHERE cid=".$cid."") or $eh->show("0013");
|
|---|
| 778 | while(list($lid)=$xoopsDB->fetchRow($result)){
|
|---|
| 779 | $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mydownloads_downloads"), $lid);
|
|---|
| 780 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 781 | $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mydownloads_text"), $lid);
|
|---|
| 782 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 783 | // delete comments
|
|---|
| 784 | xoops_comment_delete($xoopsModule->getVar('mid'), $lid);
|
|---|
| 785 | $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mydownloads_votedata"), $lid);
|
|---|
| 786 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 787 | }
|
|---|
| 788 | $sql = sprintf("DELETE FROM %s WHERE cid = %u", $xoopsDB->prefix("mydownloads_cat"), $cid);
|
|---|
| 789 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 790 | redirect_header("index.php",1,_MD_CATDELETED);
|
|---|
| 791 | exit();
|
|---|
| 792 | } else {
|
|---|
| 793 | xoops_cp_header();
|
|---|
| 794 | echo "<h4>"._MD_DLCONF."</h4>";
|
|---|
| 795 | xoops_confirm(array('op' => 'delCat', 'cid' => $cid, 'ok' => 1), 'index.php', _MD_WARNING);
|
|---|
| 796 | xoops_cp_footer();
|
|---|
| 797 | }
|
|---|
| 798 | }
|
|---|
| 799 |
|
|---|
| 800 | function delNewDownload()
|
|---|
| 801 | {
|
|---|
| 802 | global $xoopsDB, $HTTP_GET_VARS, $eh, $xoopsModule;
|
|---|
| 803 | $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mydownloads_downloads"), $HTTP_GET_VARS['lid']);
|
|---|
| 804 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 805 | $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mydownloads_text"), $HTTP_GET_VARS['lid']);
|
|---|
| 806 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 807 | // delete comments
|
|---|
| 808 | xoops_comment_delete($xoopsModule->getVar('mid'), $HTTP_GET_VARS['lid']);
|
|---|
| 809 | redirect_header("index.php",1,_MD_FILEDELETED);
|
|---|
| 810 | }
|
|---|
| 811 |
|
|---|
| 812 | function addCat()
|
|---|
| 813 | {
|
|---|
| 814 | global $xoopsDB, $HTTP_POST_VARS, $myts, $eh;
|
|---|
| 815 | $pid = $HTTP_POST_VARS["cid"];
|
|---|
| 816 | $title = $myts->makeTboxData4Save($HTTP_POST_VARS["title"]);
|
|---|
| 817 | if (empty($title)) {
|
|---|
| 818 | redirect_header("index.php", 2, _MD_ERRORTITLE);
|
|---|
| 819 | }
|
|---|
| 820 | if (($HTTP_POST_VARS["imgurl"]) || ($HTTP_POST_VARS["imgurl"]!="")) {
|
|---|
| 821 | $imgurl = $myts->makeTboxData4Save($HTTP_POST_VARS["imgurl"]);
|
|---|
| 822 | }
|
|---|
| 823 | $newid = $xoopsDB->genId($xoopsDB->prefix("mydownloads_cat")."_cid_seq");
|
|---|
| 824 | $sql = sprintf("INSERT INTO %s (cid, pid, title, imgurl) VALUES (%u, %u, '%s', '%s')", $xoopsDB->prefix("mydownloads_cat"), $newid, $pid, $title, $imgurl);
|
|---|
| 825 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 826 | if ($newid == 0) {
|
|---|
| 827 | $newid = $xoopsDB->getInsertId();
|
|---|
| 828 | }
|
|---|
| 829 | // Notify of new category
|
|---|
| 830 | global $xoopsModule;
|
|---|
| 831 | $tags = array();
|
|---|
| 832 | $tags['CATEGORY_NAME'] = $title;
|
|---|
| 833 | $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $newid;
|
|---|
| 834 | $notification_handler =& xoops_gethandler('notification');
|
|---|
| 835 | $notification_handler->triggerEvent('global', 0, 'new_category', $tags);
|
|---|
| 836 | redirect_header("index.php",1,_MD_NEWCATADDED);
|
|---|
| 837 | }
|
|---|
| 838 |
|
|---|
| 839 | function addDownload()
|
|---|
| 840 | {
|
|---|
| 841 | global $xoopsDB, $xoopsUser, $xoopsModule, $HTTP_POST_VARS, $myts, $eh;
|
|---|
| 842 | $url = $myts->makeTboxData4Save(formatURL($HTTP_POST_VARS["url"]));
|
|---|
| 843 | $logourl = $myts->makeTboxData4Save($HTTP_POST_VARS["logourl"]);
|
|---|
| 844 | $title = $myts->makeTboxData4Save($HTTP_POST_VARS["title"]);
|
|---|
| 845 | $homepage = $myts->makeTboxData4Save(formatURL($HTTP_POST_VARS["homepage"]));
|
|---|
| 846 | $version = $myts->makeTboxData4Save($HTTP_POST_VARS["version"]);
|
|---|
| 847 | $size = $myts->makeTboxData4Save($HTTP_POST_VARS["size"]);
|
|---|
| 848 | $platform = $myts->makeTboxData4Save($HTTP_POST_VARS["platform"]);
|
|---|
| 849 | $description = $myts->makeTareaData4Save($HTTP_POST_VARS["description"]);
|
|---|
| 850 | $submitter = $xoopsUser->uid();
|
|---|
| 851 | $result = $xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("mydownloads_downloads")." WHERE url='$url'");
|
|---|
| 852 | list($numrows) = $xoopsDB->fetchRow($result);
|
|---|
| 853 | $error = 0;
|
|---|
| 854 | $errormsg = "";
|
|---|
| 855 | if ($numrows>0) {
|
|---|
| 856 | $errormsg .= "<h4 style='color: #ff0000'>";
|
|---|
| 857 | $errormsg .= _MD_ERROREXIST."</h4><br />";
|
|---|
| 858 | $error = 1;
|
|---|
| 859 | }
|
|---|
| 860 | // Check if Title exist
|
|---|
| 861 | if ($title=="") {
|
|---|
| 862 | $errormsg .= "<h4 style='color: #ff0000'>";
|
|---|
| 863 | $errormsg .= _MD_ERRORTITLE."</h4><br />";
|
|---|
| 864 | $error =1;
|
|---|
| 865 | }
|
|---|
| 866 | if( empty($size) || !is_numeric($size) ){
|
|---|
| 867 | $size = 0;
|
|---|
| 868 | }
|
|---|
| 869 | // Check if Description exist
|
|---|
| 870 | if ($description=="") {
|
|---|
| 871 | $errormsg .= "<h4 style='color: #ff0000'>";
|
|---|
| 872 | $errormsg .= _MD_ERRORDESC."</h4><br />";
|
|---|
| 873 | $error =1;
|
|---|
| 874 | }
|
|---|
| 875 | if($error == 1) {
|
|---|
| 876 | xoops_cp_header();
|
|---|
| 877 | echo $errormsg;
|
|---|
| 878 | xoops_cp_footer();
|
|---|
| 879 | exit();
|
|---|
| 880 | }
|
|---|
| 881 | if ( !empty($HTTP_POST_VARS['cid']) ) {
|
|---|
| 882 | $cid = $HTTP_POST_VARS['cid'];
|
|---|
| 883 | } else {
|
|---|
| 884 | $cid = 0;
|
|---|
| 885 | }
|
|---|
| 886 | $newid = $xoopsDB->genId($xoopsDB->prefix("mydownloads_downloads")."_lid_seq");
|
|---|
| 887 |
|
|---|
| 888 | $sql = sprintf("INSERT INTO %s (lid, cid, title, url, homepage, version, size, platform, logourl, submitter, status, date, hits, rating, votes, comments) VALUES (%u, %u, '%s', '%s', '%s', '%s', %u, '%s', '%s', %u, %u, %u, %u, %u, %u, %u)", $xoopsDB->prefix("mydownloads_downloads"), $newid, $cid, $title, $url, $homepage, $version, $size, $platform, $logourl, $submitter, 1, time(), 0, 0, 0, 0);
|
|---|
| 889 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 890 | if( $newid == 0 ) {
|
|---|
| 891 | $newid = $xoopsDB->getInsertId();
|
|---|
| 892 | }
|
|---|
| 893 | $sql = sprintf("INSERT INTO %s (lid, description) VALUES (%u, '%s')", $xoopsDB->prefix("mydownloads_text"), $newid, $description);
|
|---|
| 894 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 895 | $tags = array();
|
|---|
| 896 | $tags['FILE_NAME'] = $title;
|
|---|
| 897 | $tags['FILE_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlefile.php?cid=' . $cid . '&lid=' . $newid;
|
|---|
| 898 | $sql = "SELECT title FROM " . $xoopsDB->prefix("mydownloads_cat") . " WHERE cid=" . $cid;
|
|---|
| 899 | $result = $xoopsDB->query($sql);
|
|---|
| 900 | $row = $xoopsDB->fetchArray($result);
|
|---|
| 901 | $tags['CATEGORY_NAME'] = $row['title'];
|
|---|
| 902 | $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid;
|
|---|
| 903 | $notification_handler =& xoops_gethandler('notification');
|
|---|
| 904 | $notification_handler->triggerEvent('global', 0, 'new_file', $tags);
|
|---|
| 905 | $notification_handler->triggerEvent('category', $cid, 'new_file', $tags);
|
|---|
| 906 | redirect_header("index.php?op=downloadsConfigMenu",1,_MD_NEWDLADDED);
|
|---|
| 907 | }
|
|---|
| 908 |
|
|---|
| 909 | function approve()
|
|---|
| 910 | {
|
|---|
| 911 | global $xoopsConfig, $xoopsDB, $HTTP_POST_VARS, $myts, $eh;
|
|---|
| 912 | $lid = $HTTP_POST_VARS['lid'];
|
|---|
| 913 | $title = $HTTP_POST_VARS['title'];
|
|---|
| 914 | $cid = $HTTP_POST_VARS['cid'];
|
|---|
| 915 | if ( empty($cid) ) {
|
|---|
| 916 | $cid = 0;
|
|---|
| 917 | }
|
|---|
| 918 | $homepage = $HTTP_POST_VARS['homepage'];
|
|---|
| 919 | $version = $HTTP_POST_VARS['version'];
|
|---|
| 920 | $size = $HTTP_POST_VARS['size'];
|
|---|
| 921 | $platform = $HTTP_POST_VARS['platform'];
|
|---|
| 922 | $description = $HTTP_POST_VARS['description'];
|
|---|
| 923 | if (($HTTP_POST_VARS["url"]) || ($HTTP_POST_VARS["url"]!="")) {
|
|---|
| 924 | $url = $myts->makeTboxData4Save($HTTP_POST_VARS["url"]);
|
|---|
| 925 | }
|
|---|
| 926 | $logourl = $myts->makeTboxData4Save($HTTP_POST_VARS["logourl"]);
|
|---|
| 927 | $title = $myts->makeTboxData4Save($title);
|
|---|
| 928 | $homepage = $myts->makeTboxData4Save($homepage);
|
|---|
| 929 | $version = $myts->makeTboxData4Save($HTTP_POST_VARS["version"]);
|
|---|
| 930 | $size = $myts->makeTboxData4Save($HTTP_POST_VARS["size"]);
|
|---|
| 931 | $platform = $myts->makeTboxData4Save($HTTP_POST_VARS["platform"]);
|
|---|
| 932 | $description = $myts->makeTareaData4Save($description);
|
|---|
| 933 | $sql = sprintf("UPDATE %s SET cid = %u, title = '%s', url = '%s', homepage = '%s', version = '%s', size = %u, platform = '%s', logourl = '%s', status = %u, date = %u WHERE lid = %u", $xoopsDB->prefix("mydownloads_downloads"), $cid, $title, $url, $homepage, $version, $size, $platform, $logourl, 1, time(), $lid);
|
|---|
| 934 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 935 | $sql = sprintf("UPDATE %s SET description = '%s' WHERE lid = %u", $xoopsDB->prefix("mydownloads_text"), $description, $lid);
|
|---|
| 936 | $xoopsDB->query($sql) or $eh->show("0013");
|
|---|
| 937 | global $xoopsModule;
|
|---|
| 938 | $tags = array();
|
|---|
| 939 | $tags['FILE_NAME'] = $title;
|
|---|
| 940 | $tags['FILE_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlefile.php?cid=' . $cid . '&lid=' . $lid;
|
|---|
| 941 | $sql = "SELECT title FROM " . $xoopsDB->prefix('mydownloads_cat') . " WHERE cid=" . $cid;
|
|---|
| 942 | $result = $xoopsDB->query($sql);
|
|---|
| 943 | $row = $xoopsDB->fetchArray($result);
|
|---|
| 944 | $tags['CATEGORY_NAME'] = $row['title'];
|
|---|
| 945 | $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid;
|
|---|
| 946 | $notification_handler =& xoops_gethandler('notification');
|
|---|
| 947 | $notification_handler->triggerEvent('global', 0, 'new_file', $tags);
|
|---|
| 948 | $notification_handler->triggerEvent('category', $cid, 'new_file', $tags);
|
|---|
| 949 | $notification_handler->triggerEvent('file', $lid, 'approve', $tags);
|
|---|
| 950 | redirect_header("index.php",1,_MD_NEWDLADDED);
|
|---|
| 951 | }
|
|---|
| 952 | if(!isset($HTTP_POST_VARS['op'])) {
|
|---|
| 953 | $op = isset($HTTP_GET_VARS['op']) ? $HTTP_GET_VARS['op'] : 'main';
|
|---|
| 954 | } else {
|
|---|
| 955 | $op = $HTTP_POST_VARS['op'];
|
|---|
| 956 | }
|
|---|
| 957 | switch ($op) {
|
|---|
| 958 | case "delNewDownload":
|
|---|
| 959 | delNewDownload();
|
|---|
| 960 | break;
|
|---|
| 961 | case "approve":
|
|---|
| 962 | approve();
|
|---|
| 963 | break;
|
|---|
| 964 | case "addCat":
|
|---|
| 965 | addCat();
|
|---|
| 966 | break;
|
|---|
| 967 | case "addSubCat":
|
|---|
| 968 | addSubCat();
|
|---|
| 969 | break;
|
|---|
| 970 | case "addDownload":
|
|---|
| 971 | addDownload();
|
|---|
| 972 | break;
|
|---|
| 973 | case "listBrokenDownloads":
|
|---|
| 974 | listBrokenDownloads();
|
|---|
| 975 | break;
|
|---|
| 976 | case "delBrokenDownloads":
|
|---|
| 977 | delBrokenDownloads();
|
|---|
| 978 | break;
|
|---|
| 979 | case "ignoreBrokenDownloads":
|
|---|
| 980 | ignoreBrokenDownloads();
|
|---|
| 981 | break;
|
|---|
| 982 | case "listModReq":
|
|---|
| 983 | listModReq();
|
|---|
| 984 | break;
|
|---|
| 985 | case "changeModReq":
|
|---|
| 986 | changeModReq();
|
|---|
| 987 | break;
|
|---|
| 988 | case "ignoreModReq":
|
|---|
| 989 | ignoreModReq();
|
|---|
| 990 | break;
|
|---|
| 991 | case "delCat":
|
|---|
| 992 | delCat();
|
|---|
| 993 | break;
|
|---|
| 994 | case "modCat":
|
|---|
| 995 | modCat();
|
|---|
| 996 | break;
|
|---|
| 997 | case "modCatS":
|
|---|
| 998 | modCatS();
|
|---|
| 999 | break;
|
|---|
| 1000 | case "modDownload":
|
|---|
| 1001 | modDownload();
|
|---|
| 1002 | break;
|
|---|
| 1003 | case "modDownloadS":
|
|---|
| 1004 | modDownloadS();
|
|---|
| 1005 | break;
|
|---|
| 1006 | case "delDownload":
|
|---|
| 1007 | delDownload();
|
|---|
| 1008 | break;
|
|---|
| 1009 | case "delVote":
|
|---|
| 1010 | delVote();
|
|---|
| 1011 | break;
|
|---|
| 1012 | case "downloadsConfigMenu":
|
|---|
| 1013 | downloadsConfigMenu();
|
|---|
| 1014 | break;
|
|---|
| 1015 | case "listNewDownloads":
|
|---|
| 1016 | listNewDownloads();
|
|---|
| 1017 | break;
|
|---|
| 1018 | case 'main':
|
|---|
| 1019 | default:
|
|---|
| 1020 | mydownloads();
|
|---|
| 1021 | break;
|
|---|
| 1022 | }
|
|---|
| 1023 | ?>
|
|---|