PageRenderTime 42ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/e107_plugins/download/handlers/adminDownload_class.php

https://github.com/CasperGemini/e107
PHP | 2205 lines | 32 code | 38 blank | 2135 comment | 4 complexity | df1862f896611f82b866b3129d5a19ba MD5 | raw file
Possible License(s): GPL-2.0

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /*
  3. * e107 website system
  4. *
  5. * Copyright (C) 2008-2009 e107 Inc (e107.org)
  6. * Released under the terms and conditions of the
  7. * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
  8. *
  9. *
  10. *
  11. * $Source: /cvs_backup/e107_0.8/e107_plugins/download/handlers/adminDownload_class.php,v $
  12. * $Revision$
  13. * $Date$
  14. * $Author$
  15. */
  16. if (!e107::isInstalled('download')) { exit(); }
  17. require_once(e_PLUGIN.'download/handlers/download_class.php');
  18. require_once(e_HANDLER.'upload_handler.php');
  19. require_once(e_HANDLER.'xml_class.php');
  20. class adminDownload extends download
  21. {
  22. var $searchField;
  23. var $advancedSearchFields;
  24. var $userclassOptions;
  25. function adminDownload()
  26. {
  27. global $pref;
  28. parent::download();
  29. $this->userclassOptions = 'blank,nobody,guest,public,main,admin,member,classes';
  30. // Save basic search string
  31. if (isset($_POST['download-search-text']))
  32. {
  33. $this->searchField = $_POST['download-search-text'];
  34. }
  35. // Save advanced search criteria
  36. if (isset($_POST['download_advanced_search_submit']))
  37. {
  38. $this->advancedSearchFields = $_POST['download_advanced_search'];
  39. }
  40. }
  41. /*
  42. function show_filter_form($action, $subAction, $id, $from, $amount)
  43. {
  44. global $e107, $mySQLdefaultdb, $pref, $user_pref;
  45. $frm = new e_form();
  46. $filterColumns = ($user_pref['admin_download_disp'] ? $user_pref['admin_download_disp'] : array("download_name","download_class"));
  47. // $url = $e107->url->getUrl('forum', 'thread', array('func' => 'view', 'id' => 123));
  48. $url = "admin_download.php";
  49. // Search field
  50. $text .= "
  51. <script type='text/javascript'>
  52. </script>
  53. <form method='post' action='".e_SELF."' class='e-show-if-js e-filter-form' id='jstarget-downloads-list'>
  54. <div id='download_search'>
  55. <fieldset>
  56. <legend class='e-hideme'>".DOWLAN_194."</legend>
  57. <table class='adminlist'>
  58. <tr>
  59. <td>".DOWLAN_198." ".$frm->text('download-search-text', $this->searchField, 50, array('size'=>50, 'class' => 'someclass'))."&nbsp;<a href='#download_search#download_advanced_search' class='e-swapit'>Switch to Advanced-Search</a></td>
  60. </tr>
  61. </table>
  62. ";
  63. // Filter should use ajax to filter the results automatically after typing.
  64. // $text .= "
  65. // <div class='buttons-bar center'>
  66. // <button type='submit' class='update' name='download_search_submit' value='no-value'><span>".DOWLAN_51."</span></button>
  67. // <br/>
  68. // </div>";
  69. $text.= "
  70. </fieldset>
  71. </div>
  72. </form>
  73. ";
  74. // Advanced search fields
  75. $text .= "
  76. <form method='post' action='".e_SELF."'>
  77. <div id='download_advanced_search' class='e-hideme'>
  78. <fieldset>
  79. <legend class='e-hideme'>".DOWLAN_183."</legend>
  80. <table class='adminform'>
  81. <colgroup>
  82. <col style='width:15%;'/>
  83. <col style='width:35%;'/>
  84. <col style='width:15%;'/>
  85. <col style='width:35%;'/>
  86. </colgroup>
  87. <tr>
  88. <td>".DOWLAN_12."</td>
  89. <td><input class='tbox' type='text' name='download_advanced_search[name]' size='30' value='{$this->advancedSearchFields['name']}' maxlength='50'/></td>
  90. <td>".DOWLAN_18."</td>
  91. <td><input class='tbox' type='text' name='download_advanced_search[description]' size='50' value='{$this->advancedSearchFields['description']}' maxlength='50'/></td>
  92. </tr>
  93. <tr>
  94. <td>".DOWLAN_11."</td>
  95. <td>".$this->getCategorySelectList($this->advancedSearchFields['category'], true, false, '&nbsp;', 'download_advanced_search[category]');
  96. $text .= " </td>
  97. <td>".DOWLAN_149."</td>
  98. <td><input class='tbox' type='text' name='download_advanced_search[url]' size='50' value='{$this->advancedSearchFields['url']}' maxlength='50'/></td>
  99. </tr>
  100. <tr>
  101. <td>".DOWLAN_182."</td>
  102. <td>
  103. ";
  104. $text .= $this->_getConditionList('download_advanced_search[date_condition]', $this->advancedSearchFields['date_condition']);
  105. //TODO $text .= $frm->datepicker('download_advanced_search[date]', $this->advancedSearchFields['date']);
  106. $text .= "//TODO";
  107. $text .= "
  108. </td>
  109. <td>".DOWLAN_21."</td>
  110. <td>
  111. <select name='download_advanced_search[status]' class='tbox'>";
  112. $text .= $this->_getStatusList('download_advanced_search[status]', $this->advancedSearchFields['status']);
  113. $text .= " </select>
  114. </td>
  115. </tr>
  116. <tr>
  117. <td>".DOWLAN_66."</td>
  118. <td>
  119. ";
  120. $text .= $this->_getConditionList('download_advanced_search[filesize_condition]', $this->advancedSearchFields['filesize_condition']);
  121. $text .= "
  122. <input class='tbox' type='text' name='download_advanced_search[filesize]' size='10' value='{$this->advancedSearchFields['filesize']}'/>
  123. <select name='download_advanced_search[filesize_units]' class='tbox'>
  124. <option value='1' ".($this->advancedSearchFields['filesize_units'] == '' ? " selected='selected' " : "")." >b</option>
  125. <option value='1024' ".($this->advancedSearchFields['filesize_units'] == '1024' ? " selected='selected' " : "")." >Kb</option>
  126. <option value='1048576' ".($this->advancedSearchFields['filesize_units'] == '1048576' ? " selected='selected' " : "")." >Mb</option>
  127. </select>
  128. </td>
  129. <td>".DOWLAN_43."</td>
  130. <td>".$frm->uc_select('download_advanced_search[visible]', $this->advancedSearchFields['visible'], $this->userclassOptions)."</td>
  131. </tr>
  132. <tr>
  133. <td>".DOWLAN_29."</td>
  134. <td>
  135. ";
  136. $text .= $this->_getConditionList('download_advanced_search[requested_condition]', $this->advancedSearchFields['requested_condition']);
  137. $text .= " <input class='tbox' type='text' name='download_advanced_search[requested]' size='6' value='{$this->advancedSearchFields['requested']}' maxlength='6'/> times
  138. </td>
  139. <td>".DOWLAN_113."</td>
  140. <td>
  141. ";
  142. $text .= $frm->uc_select('download_advanced_search[class]', $this->advancedSearchFields['class'], $this->userclassOptions);
  143. $text .= "
  144. </td>
  145. </tr>
  146. <tr>
  147. <td>".DOWLAN_15."</td>
  148. <td><input class='tbox' type='text' name='download_advanced_search[author]' size='30' value='{$this->advancedSearchFields['author']}' maxlength='50'/></td>
  149. <td>".DOWLAN_16."</td>
  150. <td><input class='tbox' type='text' name='download_advanced_search[author_email]' size='30' value='{$this->advancedSearchFields['author']}' maxlength='50'/></td>
  151. </tr>
  152. <tr>
  153. <td>".DOWLAN_17."</td>
  154. <td><input class='tbox' type='text' name='download_advanced_search[author_website]' size='30' value='{$this->advancedSearchFields['author']}' maxlength='50'/></td>
  155. <td>&nbsp;</td>
  156. <td>&nbsp;</td>
  157. </tr>
  158. </table>
  159. <div class='buttons-bar center'>
  160. <span class='e-show-if-js f-left'><a href='#download_advanced_search#download_search' class='e-swapit'>Simple search</a></span>
  161. <button type='submit' class='update' name='download_advanced_search_submit' value='no-value'><span>".DOWLAN_51."</span></button>
  162. </div>
  163. </fieldset>
  164. </div>
  165. </form>";
  166. return $text;
  167. }
  168. */
  169. /*
  170. function show_existing_items($action, $subAction, $id, $from, $amount)
  171. {
  172. global $sql, $rs, $ns, $tp, $mySQLdefaultdb, $pref, $user_pref;
  173. $frm = new e_form();
  174. $sortorder = $subAction ? $subAction : $pref['download_order'];
  175. $sortdirection = $id=="asc" ? "asc" : "desc";
  176. $amount = 10;
  177. if(!$sortorder)
  178. {
  179. $sortorder = "download_id";
  180. }
  181. $sort_link = $sortdirection == 'asc' ? 'desc' : 'asc';
  182. $columnInfo = array(
  183. "checkboxes" => array("title" => "", "forced"=> TRUE, "width" => "3%", "thclass" => "center first", "toggle" => "dl_selected"),
  184. "download_id" => array("title"=>DOWLAN_67, "type"=>"", "width"=>"auto", "thclass"=>"", "forced"=>true),
  185. "download_name" => array("title"=>DOWLAN_12, "type"=>"", "width"=>"auto", "thclass"=>""),
  186. "download_url" => array("title"=>DOWLAN_13, "type"=>"", "width"=>"auto", "thclass"=>""),
  187. "download_author" => array("title"=>DOWLAN_15, "type"=>"", "width"=>"auto", "thclass"=>""),
  188. "download_author_email" => array("title"=>DOWLAN_16, "type"=>"", "width"=>"auto", "thclass"=>""),
  189. "download_author_website" => array("title"=>DOWLAN_17, "type"=>"", "width"=>"auto", "thclass"=>""),
  190. "download_description" => array("title"=>DOWLAN_18, "type"=>"", "width"=>"auto", "thclass"=>""),
  191. "download_filesize" => array("title"=>DOWLAN_66, "type"=>"", "width"=>"auto", "thclass"=>"right"),
  192. "download_requested" => array("title"=>DOWLAN_29, "type"=>"", "width"=>"auto", "thclass"=>"center"),
  193. "download_category" => array("title"=>DOWLAN_11, "type"=>"", "width"=>"auto", "thclass"=>""),
  194. "download_active" => array("title"=>DOWLAN_21, "type"=>"", "width"=>"auto", "thclass"=>"center"),
  195. "download_datestamp" => array("title"=>DOWLAN_182, "type"=>"", "width"=>"auto", "thclass"=>""),
  196. "download_thumb" => array("title"=>DOWLAN_20, "type"=>"", "width"=>"auto", "thclass"=>"center"),
  197. "download_image" => array("title"=>DOWLAN_19, "type"=>"", "width"=>"auto", "thclass"=>""),
  198. "download_comment" => array("title"=>DOWLAN_102, "type"=>"", "width"=>"auto", "thclass"=>"center"),
  199. "download_class" => array("title"=>DOWLAN_113, "type"=>"", "width"=>"auto", "thclass"=>""),
  200. "download_mirror" => array("title"=>DOWLAN_128, "type"=>"", "width"=>"auto", "thclass"=>""),
  201. "download_mirror_type" => array("title"=>DOWLAN_195, "type"=>"", "width"=>"auto", "thclass"=>""),
  202. "download_visible" => array("title"=>DOWLAN_43, "type"=>"", "width"=>"auto", "thclass"=>""),
  203. "options" => array("title"=>LAN_OPTIONS, "width"=>"10%", "thclass"=>"center last", "forced"=>true)
  204. );
  205. $filterColumns = ($user_pref['admin_download_disp']) ? $user_pref['admin_download_disp'] : array("download_name","download_class");
  206. $query = "SELECT d.*, dc.* FROM `#download` AS d LEFT JOIN `#download_category` AS dc ON dc. download_category_id=d.download_category";
  207. if ($this->searchField) {
  208. $where = array();
  209. array_push($where, "download_name REGEXP('".$this->searchField."')");
  210. array_push($where, "download_description REGEXP('".$this->searchField."')");
  211. array_push($where, "download_author REGEXP('".$this->searchField."')");
  212. array_push($where, "download_author_email REGEXP('".$this->searchField."')");
  213. array_push($where, "download_author_website REGEXP('".$this->searchField."')");
  214. $where = " WHERE ".implode(" OR ", $where);
  215. $query .= "$where ORDER BY {$sortorder} {$sortdirection}";
  216. }
  217. else if ($this->advancedSearchFields) {
  218. $where = array();
  219. if (strlen($this->advancedSearchFields['name']) > 0) {
  220. array_push($where, "download_name REGEXP('".$this->advancedSearchFields['name']."')");
  221. }
  222. if (strlen($this->advancedSearchFields['url']) > 0) {
  223. array_push($where, "download_url REGEXP('".$this->advancedSearchFields['url']."')");
  224. }
  225. if (strlen($this->advancedSearchFields['author']) > 0) {
  226. array_push($where, "download_author REGEXP('".$this->advancedSearchFields['author']."')");
  227. }
  228. if (strlen($this->advancedSearchFields['description']) > 0) {
  229. array_push($where, "download_description REGEXP('".$this->advancedSearchFields['description']."')");
  230. }
  231. if (strlen($this->advancedSearchFields['category']) != 0) {
  232. array_push($where, "download_category=".$this->advancedSearchFields['category']);
  233. }
  234. if (strlen($this->advancedSearchFields['filesize']) > 0) {
  235. array_push($where, "download_filesize".$this->advancedSearchFields['filesize_condition'].($this->advancedSearchFields['filesize']*$this->advancedSearchFields['filesize_units']));
  236. }
  237. if ($this->advancedSearchFields['status'] != 99) {
  238. array_push($where, "download_active=".$this->advancedSearchFields['status']);
  239. }
  240. if (strlen($this->advancedSearchFields['date']) > 0) {
  241. switch ($this->advancedSearchFields['date_condition']) {
  242. case "<=" :
  243. {
  244. array_push($where, "download_datestamp".$this->advancedSearchFields['date_condition'].($this->advancedSearchFields['date']+86400));
  245. break;
  246. }
  247. case "=" :
  248. {
  249. array_push($where, "(download_datestamp>=".$this->advancedSearchFields['date']." AND download_datestamp<=".($this->advancedSearchFields['date']+86399).")");
  250. break;
  251. }
  252. case ">=" :
  253. {
  254. array_push($where, "download_datestamp".$this->advancedSearchFields['date_condition'].$this->advancedSearchFields['date']);
  255. break;
  256. }
  257. }
  258. }
  259. if (strlen($this->advancedSearchFields['requested']) > 0) {
  260. array_push($where, "download_requested".$this->advancedSearchFields['requested_condition'].$this->advancedSearchFields['requested']);
  261. }
  262. if ($this->advancedSearchFields['visible']) {
  263. array_push($where, "download_visible=".$this->advancedSearchFields['visible']);
  264. }
  265. if ($this->advancedSearchFields['class']) {
  266. array_push($where, "download_class=".$this->advancedSearchFields['class']);
  267. }
  268. $where = (count($where) > 0 ? " WHERE ".implode(" AND ", $where) : "");
  269. $query .= "$where ORDER BY {$sortorder} {$sortdirection}";
  270. }
  271. else
  272. {
  273. $query .= " ORDER BY ".($subAction ? $subAction : $sortorder)." ".($id ? $id : $sortdirection)." LIMIT $from, $amount";
  274. }
  275. $text .= "<fieldset id='downloads-list'><legend class='e-hideme'>".DOWLAN_7."</legend>";
  276. if ($dl_count = $sql->db_Select_gen($query))
  277. {
  278. $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform")."
  279. <table class='adminlist'>
  280. ".$frm->colGroup($columnInfo,$filterColumns)
  281. .$frm->thead($columnInfo,$filterColumns,"main.[FIELD].[ASC].[FROM]")."
  282. <tbody>
  283. ";
  284. $rowStyle = "even";
  285. while ($row = $sql->db_Fetch())
  286. {
  287. $mirror = strlen($row['download_mirror']) > 0;
  288. $text .= "<tr>\n
  289. <td class='center'>".$frm->checkbox("dl_selected[".$row["download_id"]."]", $row['download_id'])."</td>
  290. <td>".$row['download_id']."</td>\n";
  291. // Display Chosen options
  292. foreach($filterColumns as $disp)
  293. {
  294. switch ($disp)
  295. {
  296. case "download_name" :
  297. $text .= "<td>";
  298. $text .= "<a href='".e_PLUGIN."download/download.php?view.".$row['download_id']."'>".$tp->toHTML($row['download_name'])."</a>";
  299. break;
  300. case "download_category" :
  301. $text .= "<td>";
  302. $text .= $tp->toHTML($row['download_category_name']);
  303. break;
  304. case "download_datestamp" :
  305. global $gen;
  306. $text .= "<td>";
  307. $text .= ($row[$disp]) ? $gen->convert_date($row[$disp],'short') : "";
  308. break;
  309. case "download_class" :
  310. case "download_visible" :
  311. $text .= "<td>";
  312. $text .= r_userclass_name($row[$disp])."&nbsp;";
  313. break;
  314. case "download_filesize" :
  315. $text .= "<td class='right'>";
  316. //$text .= ($row[$disp]) ? $this->e107->parseMemorySize(($row[$disp])) : "";
  317. $text .= ($row[$disp]) ? (intval($row[$disp])) : "";
  318. break;
  319. case "download_thumb" :
  320. $text .= "<td>";
  321. $text .= ($row[$disp]) ? "<img src='".e_FILE."downloadthumbs/".$row[$disp]."' alt=''/>" : "";
  322. break;
  323. case "download_image" :
  324. $text .= "<td>";
  325. $text .= "<a rel='external' href='".e_FILE."downloadimages/".$row[$disp]."' >".$row[$disp]."</a>";
  326. break;
  327. case "download_description" :
  328. $text .= "<td>";
  329. $text .= $tp->toHTML($row[$disp],TRUE);
  330. break;
  331. case "download_active" :
  332. $text .= "<td class='center'>";
  333. if ($row[$disp]== 1)
  334. {
  335. $text .= "<img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_123."' alt='' style='cursor:help'/>";
  336. }
  337. elseif ($row[$disp]== 2)
  338. {
  339. $text .= "<img src='".ADMIN_WAR/NING_ICON_PATH."' title='".DOWLAN_124."' alt='' style='cursor:help'/>";
  340. }
  341. else
  342. {
  343. $text .= "<img src='".ADMIN_FALSE_ICON_PATH."' title='".DOWLAN_122."' alt='' style='cursor:help'/>";
  344. }
  345. break;
  346. case "download_comment" :
  347. $text .= "<td class='center'>";
  348. $text .= ($row[$disp]) ? ADMIN_TRUE_ICON : "";
  349. break;
  350. case "download_mirror" :
  351. $text .= "<td>";
  352. $mirrorArray = $this->makeMirrorArray($row[$disp], TRUE);
  353. foreach($mirrorArray as $mirror) {
  354. $title = DOWLAN_66." ".$mirror['filesize']."; ".DOWLAN_29." ".$mirror['requests'];
  355. $text .= "<div><img src='".ADMIN_INFO_IC/ON_PATH."' title='".$title."' alt='' style='cursor:help'/> ";
  356. $text .= $tp->toHTML($mirror['url']).'</div>';
  357. }
  358. break;
  359. case "download_mirror_type" :
  360. $text .= "<td class='center'>";
  361. if ($mirror)
  362. {
  363. switch ($row[$disp])
  364. {
  365. case 1:
  366. $text .= DOWLAN_196;
  367. break;
  368. default:
  369. $text .= DOWLAN_197;
  370. }
  371. }
  372. break;
  373. case "download_requested" :
  374. case "download_active" :
  375. case "download_thumb" :
  376. case "download_comment" :
  377. $text .= "<td class='center'>";
  378. $text .= $tp->toHTML($row[$disp]);
  379. break;
  380. default :
  381. $text .= "<td>";
  382. $text .= $tp->toHTML($row[$disp]);
  383. }
  384. $text .= "</td>";
  385. }
  386. $text .= "
  387. <td class='center'>
  388. <a href='".e_SELF."?create.edit.".$row['download_id']."'>".ADMIN_EDIT_ICON."</a>
  389. <input type='image' title='".LAN_DELETE."' name='delete[main_".$row['download_id']."]' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".$tp->toJS(DOWLAN_33." [ID: ".$row['download_id']." ]")."') \"/>
  390. </td>
  391. </tr>";
  392. }
  393. $text .= "</tbody></table>";
  394. // $text .= "";
  395. }
  396. else
  397. { // 'No downloads yet'
  398. $text .= "<div style='text-align:center'>".DOWLAN_6."</div>";
  399. }
  400. // Next-Previous.
  401. $downloads = $sql->db_Count("download");
  402. if ($downloads > $amount && !$this->searchFields && !$this->advancedSearchFields)
  403. {
  404. $parms = "{$downloads},{$amount},{$from},".e_SELF."?".(e_QUERY ? "$action.$subAction.$id." : "main.{$sortorder}.{$sortdirection}.")."[FROM]";
  405. $text .= "<div class='buttons-bar center nextprev'>".$this->batch_options().
  406. $tp->parseTemplate("{NEXTPREV={$parms}}")."</div>";
  407. }
  408. $text .= "</form></fieldset>";
  409. return $text;
  410. }
  411. */
  412. // ---------------------------------------------------------------------------
  413. /*
  414. function batch_options()
  415. {
  416. $frm = new e_form();
  417. $classes = get_userclass_list();
  418. return $frm->batchoptions(
  419. array('delete_selected'=>LAN_DELETE),
  420. array(
  421. 'userclass' =>array('Assign userclass...',$classes),
  422. 'visibility'=>array('Assign Visibility..',$classes)
  423. )
  424. );
  425. }
  426. function _observe_processBatch()
  427. {
  428. list($type,$tmp,$uclass) = explode("_",$_POST['execute_batch']);
  429. $method = "batch_".$type;
  430. if ((method_exists($this,$method) || $type='visibility') && isset ($_POST['dl_selected']))
  431. {
  432. if($type=='userclass' || $type=='visibility')
  433. {
  434. $mode = ($type=='userclass') ? 'download_class' : 'download_visible';
  435. $this->batch_userclass($_POST['dl_selected'],$uclass,$mode);
  436. }
  437. else
  438. {
  439. $this->$method($_POST['dl_selected']);
  440. }
  441. }
  442. }
  443. function batch_userclass($download_ids,$uclass,$mode='download_class')
  444. {
  445. $emessage = &eMessage::getInstance();
  446. if(e107::getDb() -> db_Update("download", $mode." ='{$uclass}' WHERE download_id IN (".implode(",",$download_ids).") "))
  447. {
  448. $emessage->add("It Worked", E_MESSAGE_SUCCESS);
  449. }
  450. else
  451. {
  452. $emessage->add("It Failed", E_MESSAGE_ERROR);
  453. }
  454. }*/
  455. // Given the string which is stored in the DB, turns it into an array of mirror entries
  456. // If $byID is true, the array index is the mirror ID. Otherwise its a simple array
  457. /*
  458. function makeMirrorArray($source, $byID = FALSE)
  459. {
  460. $ret = array();
  461. if ($source)
  462. {
  463. $mirrorTArray = explode(chr(1), $source);
  464. $count = 0;
  465. foreach($mirrorTArray as $mirror)
  466. {
  467. if ($mirror)
  468. {
  469. list($mid, $murl, $mreq, $msize) = explode(",", $mirror);
  470. $ret[$byID ? $mid : $count] = array('id' => $mid, 'url' => $murl, 'requests' => $mreq, 'filesize' => $msize);
  471. $count++;
  472. }
  473. }
  474. }
  475. return $ret;
  476. }
  477. */
  478. /*
  479. // Turn the array into a string which can be stored in the DB
  480. function compressMirrorArray($source)
  481. {
  482. if (!is_array($source) || !count($source)) return '';
  483. $inter = array();
  484. foreach ($source as $s)
  485. {
  486. $inter[] = $s['id'].','.$s['url'].','.$s['requests'].','.$s['filesize'];
  487. }
  488. return implode(chr(1),$inter);
  489. }*/
  490. /*
  491. function create_download($subAction='', $id='')
  492. {
  493. global $download, $e107, $cal, $tp, $sql, $fl, $rs, $ns, $file_array, $image_array, $thumb_array;
  494. require_once(e_PLUGIN.'download/download_shortcodes.php');
  495. require_once(e_HANDLER."form_handler.php");
  496. if ($file_array = $fl->get_files(e_DOWNLOAD, "","standard",5))
  497. {
  498. sort($file_array);
  499. }
  500. if ($public_array = $fl->get_files(e_UPLOAD))
  501. {
  502. foreach($public_array as $key=>$val)
  503. {
  504. $file_array[] = str_replace(e_UPLOAD,"",$val);
  505. }
  506. }
  507. */
  508. /* if ($sql->db_Select("rbinary")) //TODO Remove me.
  509. {
  510. while ($row = $sql->db_Fetch())
  511. {
  512. extract($row);
  513. $file_array[] = "Binary ".$binary_id."/".$binary_name;
  514. }
  515. }
  516. */
  517. /*
  518. if ($image_array = $fl->get_files(e_FILE.'downloadimages/', '\.gif$|\.jpg$|\.png$|\.GIF$|\.JPG$|\.PNG$','standard',2))
  519. {
  520. sort($image_array);
  521. }
  522. if ($thumb_array = $fl->get_files(e_FILE.'downloadthumbs/', '\.gif$|\.jpg$|\.png$|\.GIF$|\.JPG$|\.PNG$','standard',2))
  523. {
  524. sort($thumb_array);
  525. }
  526. $frm = new e_form();
  527. $mirrorArray = array();
  528. $download_status[0] = DOWLAN_122;
  529. $download_status[1] = DOWLAN_123;
  530. $download_status[2] = DOWLAN_124;
  531. if (!$sql->db_Select("download_category"))
  532. {
  533. $ns->tablerender(ADLAN_24, "<div style='text-align:center'>".DOWLAN_5."</div>");
  534. return;
  535. }
  536. $download_active = 1;
  537. if ($_GET['action'] == "edit" && !$_POST['submit'])
  538. {
  539. if ($sql->db_Select("download", "*", "download_id=".intval($_GET['id'])))
  540. {
  541. $row = $sql->db_Fetch();
  542. extract($row);
  543. $mirrorArray = $this->makeMirrorArray($row['download_mirror']);
  544. }
  545. }
  546. if ($subAction == "dlm" && !$_POST['submit'])
  547. {
  548. require_once(e_PLUGIN.'download/download_shortcodes.php');
  549. if ($sql->db_Select("upload", "*", "upload_id=".$id))
  550. {
  551. $row = $sql->db_Fetch();
  552. $download_category = $row['upload_category'];
  553. $download_name = $row['upload_name'].($row['upload_version'] ? " v" . $row['upload_version'] : "");
  554. $download_url = $row['upload_file'];
  555. $download_author_email = $row['upload_email'];
  556. $download_author_website = $row['upload_website'];
  557. $download_description = $row['upload_description'];
  558. $download_image = $row['upload_ss'];
  559. $download_filesize = $row['upload_filesize'];
  560. $image_array[] = array("path" => "", "fname" => $row['upload_ss']);
  561. $download_author = substr($row['upload_poster'], (strpos($row['upload_poster'], ".")+1));
  562. }
  563. }
  564. $text = "
  565. <div class='admintabs' id='tab-container'>
  566. <ul class='e-taXXbs' e-hideme' id='core-download-tabs'>
  567. <li id='tab-general'><a href='#download-create'>".DOWLAN_175."</a></li>
  568. <li id='tab-external'><a href='#download-edit-external'>".DOWLAN_176."</a></li>
  569. <li id='tab-mirror'><a href='#download-edit-mirror'>".DOWLAN_128."</a></li>
  570. </ul>
  571. <div>
  572. <form method='post' action='".e_SELF."?".e_QUERY."' id='myform'>
  573. <fieldset id='download-create'>
  574. <table style='".ADMIN_WIDTH."' class='adminlist'>
  575. <tr>
  576. <td style='width:20%;'>".DOWLAN_13."</td>
  577. <td style='width:80%'>
  578. <div>".DOWLAN_131."&nbsp;&nbsp;
  579. <select name='download_url' class='tbox'>
  580. <option value=''>&nbsp;</option>
  581. ";
  582. $counter = 0;
  583. while (isset($file_array[$counter]))
  584. {
  585. $fpath = str_replace(e_DOWNLOAD,"",$file_array[$counter]['path']).$file_array[$counter]['fname'];
  586. $selected = '';
  587. if (stristr($fpath, $download_url) !== FALSE)
  588. {
  589. $selected = " selected='selected'";
  590. $found = 1;
  591. }
  592. $text .= "<option value='".$fpath."' $selected>".$fpath."</option>\n";
  593. $counter++;
  594. }
  595. if (preg_match("/http:|https:|ftp:/", $download_url))
  596. {
  597. $download_url_external = $download_url;
  598. $download_url = '';
  599. }
  600. $etext = " - (".DOWLAN_68.")";
  601. if (file_exists(e_UPLOAD.$download_url))
  602. {
  603. $etext = "";
  604. }
  605. if (!$found && $download_url)
  606. {
  607. $text .= "<option value='".$download_url."' selected='selected'>".$download_url.$etext."</option>\n";
  608. }
  609. $text .= " </select>
  610. </div>
  611. </td>
  612. </tr>
  613. </table>
  614. </fieldset>
  615. <fieldset id='download-edit-external'>
  616. <table style='".ADMIN_WIDTH."' class='adminlist'>
  617. <tr>
  618. <td style='width:20%;'>".DOWLAN_149."</td>
  619. <td style='width:80%;'>
  620. <input class='tbox' type='text' name='download_url_external' size='70' value='{$download_url_external}' maxlength='255'/>
  621. </td>
  622. </tr>
  623. <tr>
  624. <td>".DOWLAN_66."</td>
  625. <td>
  626. <input class='tbox' type='text' name='download_filesize_external' size='8' value='{$download_filesize}' maxlength='10'/>
  627. </td>
  628. </tr>
  629. </table>
  630. </fieldset>
  631. <fieldset id='download-edit-mirror'>
  632. <table style='".ADMIN_WIDTH."' class='adminlist'>
  633. <tr>
  634. <td style='width:20%'><span title='".DOWLAN_129."' style='cursor:help'>".DOWLAN_128."</span></td>
  635. <td style='width:80%'>";
  636. // See if any mirrors to display
  637. if (!$sql -> db_Select("download_mirror"))
  638. { // No mirrors defined here
  639. $text .= DOWLAN_144."</td></tr>";
  640. }
  641. else
  642. {
  643. $text .= DOWLAN_132."<div id='mirrorsection'>";
  644. $mirrorList = $sql -> db_getList(); // Get the list of possible mirrors
  645. $m_count = (count($mirrorArray) ? count($mirrorArray) : 1); // Count of mirrors actually in use (or count of 1 if none defined yet)
  646. for($count = 1; $count <= $m_count; $count++)
  647. {
  648. $opt = ($count==1) ? "id='mirror'" : "";
  649. $text .="
  650. <div {$opt}>
  651. <select name='download_mirror_name[]' class='tbox'>
  652. <option value=''>&nbsp;</option>";
  653. foreach ($mirrorList as $mirror)
  654. {
  655. extract($mirror);
  656. $text .= "<option value='{$mirror_id}'".($mirror_id == $mirrorArray[($count-1)]['id'] ? " selected='selected'" : "").">{$mirror_name}</option>\n";
  657. }
  658. $text .= "</select>
  659. <input class='tbox' type='text' name='download_mirror[]' style='width: 60%;' value=\"".$mirrorArray[($count-1)]['url']."\" maxlength='200'/>
  660. <input class='tbox' type='text' name='download_mirror_size[]' style='width: 15%;' value=\"".$mirrorArray[($count-1)]['filesize']."\" maxlength='10'/>";
  661. if (DOWNLOAD_DEBUG)
  662. {
  663. if ($id)
  664. {
  665. $text .= '('.$mirrorArray[($count-1)]['requests'].')';
  666. }
  667. else
  668. {
  669. $text .= "<input class='tbox' type='text' name='download_mirror_requests[]' style='width: 10%;' value=\"".$mirrorArray[($count-1)]['requests']."\" maxlength='10'/>";
  670. }
  671. }
  672. $text .= " </div>";
  673. }
  674. $text .=" </div>
  675. <input class='btn button' type='button' name='addoption' value='".DOWLAN_130."' onclick=\"duplicateHTML('mirror','mirrorsection')\"/>
  676. </td>
  677. </tr>
  678. <tr>
  679. <td style='width:20%' ><span style='cursor:help' title='".DOWLAN_154."'>".DOWLAN_155."</span></td>
  680. <td style='width:80%'>
  681. <input type='radio' name='download_mirror_type' value='1'".($download_mirror_type ? " checked='checked'" : "")."/> ".DOWLAN_156."<br/>
  682. <input type='radio' name='download_mirror_type' value='0'".(!$download_mirror_type ? " checked='checked'" : "")."/> ".DOWLAN_157."
  683. </td>
  684. </tr>";
  685. } // End of mirror-related stuff
  686. $download_author = $subAction != "edit" && $download_author == "" ? USERNAME : $download_author;//TODO what if editing an no author specified
  687. $download_author_email = $subAction != "edit" && $download_author_email == "" ? USEREMAIL : $download_author_email;
  688. $text .= "
  689. </table>
  690. </fieldset>
  691. <fieldset id='download-edit-therest'>
  692. <table style='".ADMIN_WIDTH."' class='adminlist'>
  693. <tr>
  694. <td style='width:20%'>".DOWLAN_11."</td>
  695. <td style='width:80%'>";
  696. $text .= $this->getCategorySelectList($download_category);
  697. $text .= " </td>
  698. </tr>
  699. <tr>
  700. <td style='width:20%;'>".DOWLAN_12."</td>
  701. <td style='width:80%'>
  702. <input class='tbox' type='text' name='download_name' size='60' value=\"".$tp->toForm($download_name)."\" maxlength='200'/>
  703. </td>
  704. </tr>
  705. <tr>
  706. <td style='width:20%'>".DOWLAN_15."</td>
  707. <td style='width:80%'>
  708. <input class='tbox' type='text' name='download_author' size='60' value='$download_author' maxlength='100'/>
  709. </td>
  710. </tr>
  711. <tr>
  712. <td style='width:20%'>".DOWLAN_16."</td>
  713. <td style='width:80%'>
  714. <input class='tbox' type='text' name='download_author_email' size='60' value='$download_author_email' maxlength='100'/>
  715. </td>
  716. </tr>
  717. <tr>
  718. <td style='width:20%'>".DOWLAN_17."</td>
  719. <td style='width:80%'>
  720. <input class='tbox' type='text' name='download_author_website' size='60' value='$download_author_website' maxlength='100'/>
  721. </td>
  722. </tr>
  723. <tr>
  724. <td style='width:20%'>".DOWLAN_18."</td>
  725. <td style='width:80%'>
  726. ";
  727. $text .= $frm->bbarea('download_description',$download_description);
  728. $text .= " </td>
  729. </tr>
  730. <tr>
  731. <td>
  732. Activation between
  733. </td>
  734. <td>
  735. // TODO
  736. </td>
  737. </tr>
  738. <tr>
  739. <td style='width:20%'>".DOWLAN_19."</td>
  740. <td style='width:80%'>
  741. <select name='download_image' class='tbox'>
  742. <option value=''>&nbsp;</option>";
  743. foreach($image_array as $img)
  744. {
  745. $fpath = str_replace(e_FILE."downloadimages/","",$img['path'].$img['fname']);
  746. $sel = ($download_image == $fpath) ? " selected='selected'" : "";
  747. $text .= "<option value='".$fpath."' $sel>".$fpath."</option>\n";
  748. }
  749. $text .= " </select>";
  750. if ($subAction == "dlm" && $download_image)
  751. {
  752. $text .= "
  753. <input type='hidden' name='move_image' value='1'/>\n";
  754. }
  755. $text .= " </td>
  756. </tr>
  757. <tr>
  758. <td style='width:20%'>".DOWLAN_20."</td>
  759. <td style='width:80%'>
  760. <select name='download_thumb' class='tbox'>
  761. <option value=''>&nbsp;</option>";
  762. foreach($thumb_array as $thm){
  763. $tpath = str_replace(e_FILE."downloadthumbs/","",$thm['path'].$thm['fname']);
  764. $sel = ($download_thumb == $tpath) ? " selected='selected'" : "";
  765. $text .= "<option value='".$tpath."' $sel>".$tpath."</option>\n";
  766. }
  767. $text .= " </select>
  768. </td>
  769. </tr>
  770. <tr>
  771. <td style='width:20%'>".LAN_DATESTAMP."</td>
  772. <td style='width:80%'>";
  773. if (!$download_datestamp){
  774. $download_datestamp = time();
  775. }
  776. $cal_options['showsTime'] = false;
  777. $cal_options['showOthers'] = false;
  778. $cal_options['weekNumbers'] = false;
  779. $cal_options['ifFormat'] = "%d/%m/%Y %H:%M:%S";
  780. $cal_options['timeFormat'] = "24";
  781. $cal_attrib['class'] = "tbox";
  782. $cal_attrib['size'] = "22";
  783. $cal_attrib['name'] = "download_datestamp";
  784. $cal_attrib['value'] = date("d/m/Y H:i:s", $download_datestamp);
  785. $text .= $cal->make_input_field($cal_options, $cal_attrib);
  786. $update_checked = ($_POST['update_datestamp']) ? "checked='checked'" : "";
  787. $text .= " &nbsp;&nbsp;<span><input type='checkbox' value='1' name='update_datestamp' $update_checked/>".DOWLAN_148."</span>
  788. </td>
  789. </tr>
  790. <tr>
  791. <td style='width:20%'>".DOWLAN_21."</td>
  792. <td style='width:80%'>
  793. <select name='download_active' class='tbox'>";
  794. foreach($download_status as $key => $val){
  795. $sel = ($download_active == $key) ? " selected = 'selected' " : "";
  796. $text .= "<option value='{$key}' {$sel}>{$val}</option>\n";
  797. }
  798. $text .= " </select>
  799. </td>
  800. </tr>
  801. <tr>
  802. <td style='width:20%'>".DOWLAN_102."</td>
  803. <td style='width:80%'>";
  804. if ($download_comment == "0") {
  805. $text .= LAN_YES.": <input type='radio' name='download_comment' value='1'/>
  806. ".LAN_NO.": <input type='radio' name='download_comment' value='0' checked='checked'/>";
  807. } else {
  808. $text .= LAN_YES.": <input type='radio' name='download_comment' value='1' checked='checked'/>
  809. ".LAN_NO.": <input type='radio' name='download_comment' value='0'/>";
  810. }
  811. $text .= " </td>
  812. </tr>
  813. <tr>
  814. <td style='width:20%'>".DOWLAN_145."</td>
  815. <td style='width:80%'>".r_userclass('download_visible', $download_visible, 'off', 'public, nobody, member, admin, classes, language')."</td>
  816. </tr>
  817. <tr>
  818. <td style='width:20%'>".DOWLAN_106."</td>
  819. <td style='width:80%'>".r_userclass('download_class', $download_class, 'off', 'public, nobody, member, admin, classes, language')."</td>
  820. </tr>";
  821. if ($subAction == "dlm") {
  822. $text .= "
  823. <tr>
  824. <td style='width:30%'>".DOWLAN_153."</td>
  825. <td style='width:70%'>
  826. <select name='move_file' class='tbox'>
  827. <option value=''>".LAN_NO."</option>";
  828. $dl_dirlist = $fl->get_dirs(e_DOWNLOAD);
  829. if ($dl_dirlist){
  830. sort($dl_dirlist);
  831. $text .= "<option value='".e_DOWNLOAD."'>/</option>\n";
  832. foreach($dl_dirlist as $dirs)
  833. {
  834. $text .= "<option value='". e_DOWNLOAD.$dirs."/'>".$dirs."/</option>\n";
  835. }
  836. }
  837. else
  838. {
  839. $text .= "<option value='".e_DOWNLOAD."'>".LAN_YES."</option>\n";
  840. }
  841. $text .= " </select>
  842. </td>
  843. </tr>
  844. <tr>
  845. <td style='width:30%'>".DOWLAN_103."</td>
  846. <td style='width:70%'>
  847. <input type='checkbox' name='remove_upload' value='1'/>
  848. <input type='hidden' name='remove_id' value='$id'/>
  849. </td>
  850. </tr>";
  851. }
  852. //triggerHook
  853. $data = array('method'=>'form', 'table'=>'download', 'id'=>$id, 'plugin'=>'download', 'function'=>'create_download');
  854. $hooks = $e107->e_event->triggerHook($data);
  855. $text .= " <tr style=''>
  856. <td colspan='2' style='text-align:center'>";
  857. if ($id && $subAction == "edit") {
  858. $text .= "<input class='btn button' type='submit' name='submit_download' value='".DOWLAN_24."'/> ";
  859. } else {
  860. $text .= "<input class='btn button' type='submit' name='submit_download' value='".DOWLAN_25."'/>";
  861. }
  862. $text .= "
  863. </td>
  864. </tr>
  865. </table>
  866. </fieldset>
  867. </form>
  868. </div>
  869. </div>";
  870. $ns->tablerender(ADLAN_24, $text);
  871. }
  872. */
  873. // -----------------------------------------------------------------------------
  874. /*
  875. function show_message($message) {
  876. global $ns;
  877. $ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
  878. }
  879. */
  880. // -----------------------------------------------------------------------------
  881. /* // Actually save a new or edited download to the DB
  882. function submit_download($subAction, $id)
  883. {
  884. global $e107, $tp, $sql, $DOWNLOADS_DIRECTORY, $e_event;
  885. $dlInfo = array();
  886. $dlMirrors = array();
  887. if ($subAction == 'edit')
  888. {
  889. if ($_POST['download_url_external'] == '')
  890. {
  891. $_POST['download_filesize_external'] = FALSE;
  892. }
  893. }
  894. if ($_POST['download_url_external'] && $_POST['download_url'] == '')
  895. {
  896. $dlInfo['download_url'] = $tp->toDB($_POST['download_url_external']);
  897. $filesize = intval($_POST['download_filesize_external']);
  898. }
  899. else
  900. {
  901. $dlInfo['download_url'] = $tp->toDB($_POST['download_url']);
  902. if ($_POST['download_filesize_external'])
  903. {
  904. $filesize = intval($_POST['download_filesize_external']);
  905. }
  906. else
  907. {
  908. if (strpos($DOWNLOADS_DIRECTORY, "/") === 0 || strpos($DOWNLOADS_DIRECTORY, ":") >= 1)
  909. {
  910. $filesize = filesize($DOWNLOADS_DIRECTORY.$dlInfo['download_url']);
  911. }
  912. else
  913. {
  914. $filesize = filesize(e_BASE.$DOWNLOADS_DIRECTORY.$dlInfo['download_url']);
  915. }
  916. }
  917. }
  918. if (!$filesize)
  919. {
  920. if ($sql->db_Select("upload", "upload_filesize", "upload_file='{$dlInfo['download_url']}'"))
  921. {
  922. $row = $sql->db_Fetch();
  923. $filesize = $row['upload_filesize'];
  924. }
  925. }
  926. $dlInfo['download_filesize'] = $filesize;
  927. // ---- Move Images and Files ------------
  928. if ($_POST['move_image'])
  929. {
  930. if ($_POST['download_thumb'])
  931. {
  932. $oldname = e_UPLOAD.$_POST['download_thumb'];
  933. $newname = e_FILE."downloadthumbs/".$_POST['download_thumb'];
  934. if (!$this -> move_file($oldname,$newname))
  935. {
  936. return;
  937. }
  938. }
  939. if ($_POST['download_image'])
  940. {
  941. $oldname = e_UPLOAD.$_POST['download_image'];
  942. $newname = e_FILE."downloadimages/".$_POST['download_image'];
  943. if (!$this -> move_file($oldname,$newname))
  944. {
  945. return;
  946. }
  947. }
  948. }
  949. if ($_POST['move_file'] && $_POST['download_url'])
  950. {
  951. $oldname = e_UPLOAD.$_POST['download_url'];
  952. $newname = $_POST['move_file'].$_POST['download_url'];
  953. if (!$this -> move_file($oldname,$newname))
  954. {
  955. return;
  956. }
  957. $dlInfo['download_url'] = str_replace(e_DOWNLOAD,"",$newname);
  958. }
  959. // ------------------------------------------
  960. $dlInfo['download_description'] = $tp->toDB($_POST['download_description']);
  961. $dlInfo['download_name'] = $tp->toDB($_POST['download_name']);
  962. $dlInfo['download_author'] = $tp->toDB($_POST['download_author']);
  963. $dlInfo['download_author_email'] = $tp->toDB($_POST['download_author_email']);
  964. $dlInfo['download_author_website'] = $tp->toDB($_POST['download_author_website']);
  965. $dlInfo['download_category'] = intval($_POST['download_category']);
  966. $dlInfo['download_active'] = intval($_POST['download_active']);
  967. $dlInfo['download_thumb'] = $tp->toDB($_POST['download_thumb']);
  968. $dlInfo['download_image'] = $tp->toDB($_POST['download_image']);
  969. $dlInfo['download_comment'] = $tp->toDB($_POST['download_comment']);
  970. $dlInfo['download_class'] = intval($_POST['download_class']);
  971. $dlInfo['download_visible'] =intval($_POST['download_visible']);
  972. if (preg_match("#(.*?)/(.*?)/(.*?) (.*?):(.*?):(.*?)$#", $_POST['download_datestamp'], $matches))
  973. {
  974. $dlInfo['download_datestamp'] = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]);
  975. }
  976. else
  977. {
  978. $dlInfo['download_datestamp'] = time();
  979. }
  980. if ($_POST['update_datestamp'])
  981. {
  982. $dlInfo['download_datestamp'] = time();
  983. }
  984. $mirrorStr = "";
  985. $mirrorFlag = FALSE;
  986. // See if any mirrors defined
  987. // Need to check all the possible mirror names - might have deleted the first one if we're in edit mode
  988. foreach ($_POST['download_mirror_name'] as $mn)
  989. {
  990. if ($mn)
  991. {
  992. $mirrorFlag = TRUE;
  993. break;
  994. }
  995. }
  996. if ($mirrorFlag)
  997. {
  998. $mirrors = count($_POST['download_mirror_name']);
  999. $mirrorArray = array();
  1000. $newMirrorArray = array();
  1001. if ($id && $sql->db_Select('download','download_mirror', 'download_id = '.$id)) // Get existing download stats
  1002. {
  1003. if ($row = $sql->db_Fetch())
  1004. {
  1005. $mirrorArray = $this->makeMirrorArray($row['download_mirror'], TRUE);
  1006. }
  1007. }
  1008. for($a=0; $a<$mirrors; $a++)
  1009. {
  1010. $mid = trim($_POST['download_mirror_name'][$a]);
  1011. $murl = trim($_POST['download_mirror'][$a]);
  1012. $msize = trim($_POST['download_mirror_size'][$a]);
  1013. if ($mid && $murl)
  1014. {
  1015. $newMirrorArray[$mid] = array('id' => $mid, 'url' => $murl, 'requests' => 0, 'filesize' => $msize);
  1016. if (DOWNLOAD_DEBUG && !$id)
  1017. {
  1018. $newMirrorArray[$mid]['requests'] = intval($_POST['download_mirror_requests'][$a]);
  1019. }
  1020. }
  1021. }
  1022. // Now copy across any existing usage figures
  1023. foreach ($newMirrorArray as $k => $m)
  1024. {
  1025. if (isset($mirrorArray[$k]))
  1026. {
  1027. $newMirrorArray[$k]['requests'] = $mirrorArray[$k]['requests'];
  1028. }
  1029. }
  1030. $mirrorStr = $this->compressMirrorArray($newMirrorArray);
  1031. }
  1032. $dlMirrors['download_mirror']=$mirrorStr;
  1033. $dlMirrors['download_mirror_type']=intval($_POST['download_mirror_type']);
  1034. if ($id)
  1035. { // Its an edit
  1036. // Process triggers before calling admin_update so trigger messages can be shown
  1037. $data = array('method'=>'update', 'table'=>'download', 'id'=>$id, 'plugin'=>'download', 'function'=>'update_download');
  1038. $hooks = $e107->e_event->triggerHook($data);
  1039. require_once(e_HANDLER."message_handler.php");
  1040. $emessage = &eMessage::getInstance();
  1041. $emessage->add($hooks, E_MESSAGE_SUCCESS);
  1042. admin_update($sql->db_UpdateArray('download',array_merge($dlInfo,$dlMirrors),'WHERE download_id='.intval($id)), 'update', DOWLAN_2." (<a href='".e_PLUGIN."download/download.php?view.".$id."'>".$_POST['download_name']."</a>)");
  1043. $dlInfo['download_id'] = $id;
  1044. $this->downloadLog('DOWNL_06',$dlInfo,$dlMirrors);
  1045. $dlInfo['download_datestamp'] = $time; // This is what 0.7 did, regardless of settings
  1046. unset($dlInfo['download_class']); // Also replicating 0.7
  1047. $e_event->trigger('dlupdate', $dlInfo);
  1048. }
  1049. else
  1050. {
  1051. if ($download_id = $sql->db_Insert('download',array_merge($dlInfo,$dlMirrors)))
  1052. {
  1053. // Process triggers before calling admin_update so trigger messages can be shown
  1054. $data = array('method'=>'create', 'table'=>'download', 'id'=>$download_i…

Large files files are truncated, but you can click here to view the full file