function showMaint() { $mes = e107::getMessage(); $mes->addInfo("Deprecated Area - please use filter instead under 'Manage' "); global $pref; $ns = e107::getRender(); $sql = e107::getDb(); $frm = e107::getForm(); $tp = e107::getParser(); if (isset($_POST['dl_maint'])) { switch ($_POST['dl_maint']) { case 'duplicates': $title = DOWLAN_166; $query = 'SELECT GROUP_CONCAT(d.download_id SEPARATOR ",") as gc, d.download_id, d.download_name, d.download_url, dc.download_category_name FROM #download as d LEFT JOIN #download_category AS dc ON dc.download_category_id=d.download_category GROUP BY d.download_url HAVING COUNT(d.download_id) > 1 '; $text = ""; $count = $sql->gen($query); $foundSome = false; if ($count) { $currentURL = ""; while ($row = $sql->fetch()) { if (!$foundSome) { // $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform"); $text .= '<form method="post" action="' . e_SELF . '?' . e_QUERY . '" id="myform"> <table class="table adminform">'; $text .= '<tr>'; $text .= '<th>' . DOWLAN_13 . '</th>'; $text .= '<th>' . LAN_ID . '</th>'; $text .= '<th>' . DOWLAN_27 . '</th>'; $text .= '<th>' . DOWLAN_11 . '</th>'; $text .= '<th>' . LAN_OPTIONS . '</th>'; $text .= '</tr>'; $foundSome = true; } $query = "SELECT d.*, dc.* FROM `#download` AS d\n\t\t LEFT JOIN `#download_category` AS dc ON dc.download_category_id=d.download_category\n\t\t WHERE download_id IN (" . $row['gc'] . ")\n\t\t ORDER BY download_id ASC"; $count = $sql2->gen($query); while ($row = $sql2->fetch()) { $text .= '<tr>'; if ($currentURL != $row['download_url']) { $text .= '<td>' . $tp->toHTML($row['download_url']) . '</td>'; $currentURL = $row['download_url']; } else { $text .= '<td>*</td>'; } $text .= '<td>' . $row['download_id'] . '</td>'; $text .= "<td><a href='" . e_PLUGIN . "download/download.php?view." . $row['download_id'] . "'>" . $e107->tp->toHTML($row['download_name']) . '</a></td>'; $text .= '<td>' . $tp->toHTML($row['download_category_name']) . '</td>'; $text .= '<td> <a href="' . e_SELF . '?create.edit.' . $row["download_id"] . '.maint.duplicates">' . ADMIN_EDIT_ICON . '</a> <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"] . ' ]') . '") \'/> </td>'; $text .= '</tr>'; } } } if ($foundSome) { $text .= '</table></form>'; } else { e107::getMessage()->addInfo(DOWLAN_172); } break; case 'orphans': $title = DOWLAN_167; $text = ""; require_once e_HANDLER . "file_class.php"; $efile = new e_file(); $files = $efile->get_files(e_DOWNLOAD); $foundSome = false; foreach ($files as $file) { if (0 == $sql->db_Count('download', '(*)', " WHERE download_url='" . $file['fname'] . "'")) { if (!$foundSome) { // $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform"); $text .= '<form method="post" action="' . e_SELF . '?' . e_QUERY . '" id="myform"> <table class="table adminform">'; $text .= '<tr>'; $text .= '<th>' . DOWLAN_13 . '</th>'; $text .= '<th>' . DOWLAN_182 . '</th>'; $text .= '<th>' . DOWLAN_66 . '</th>'; $text .= '<th>' . LAN_OPTIONS . '</th>'; $text .= '</tr>'; $foundSome = true; } $filesize = is_readable(e_DOWNLOAD . $row['download_url']) ? $e107->parseMemorySize(filesize(e_DOWNLOAD . $file['fname'])) : DOWLAN_181; $filets = is_readable(e_DOWNLOAD . $row['download_url']) ? $gen->convert_date(filectime(e_DOWNLOAD . $file['fname']), "long") : DOWLAN_181; $text .= '<tr>'; $text .= '<td>' . $tp->toHTML($file['fname']) . '</td>'; $text .= '<td>' . $filets . '</td>'; $text .= '<td>' . $filesize . '</td>'; //TODO $text .= '<td> //TODO <a href="'.e_SELF.'?create.add.'. urlencode($file["fname"]).'">'.E_16_CREATE.'</a> //TODO <input type="image" title="'.LAN_DELETE.'" name="delete[main_'.$file["fname"].']" src="'.ADMIN_DELETE_ICON_PATH.'" onclick=\'return jsconfirm("'.$tp->toJS(DOWLAN_173.' [ '.$file["fname"].' ]').'") \'/> //TODO </td>'; $text .= '</tr>'; } } if ($foundSome) { $text .= '</table></form>'; } else { e107::getMessage()->addInfo(DOWLAN_174); } break; case 'missing': $title = DOWLAN_168; $text = ""; $query = "SELECT d.*, dc.* FROM `#download` AS d LEFT JOIN `#download_category` AS dc ON dc.download_category_id=d.download_category"; $count = $sql->gen($query); $foundSome = false; if ($count) { while ($row = $sql->fetch()) { if (!is_readable(e_DOWNLOAD . $row['download_url'])) { if (!$foundSome) { // $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform"); $text .= '<form method="post" action="' . e_SELF . '?' . e_QUERY . '" id="myform"> <table class="adminlist">'; $text .= '<tr>'; $text .= '<th>' . LAN_ID . '</th>'; $text .= '<th>' . DOWLAN_27 . '</th>'; $text .= '<th>' . DOWLAN_11 . '</th>'; $text .= '<th>' . DOWLAN_13 . '</th>'; $text .= '<th>' . LAN_OPTIONS . '</th>'; $text .= '</tr>'; $foundSome = true; } $text .= '<tr>'; $text .= '<td>' . $row['download_id'] . '</td>'; $text .= "<td><a href='" . e_PLUGIN . "download/download.php?view." . $row['download_id'] . "'>" . $tp->toHTML($row['download_name']) . '</a></td>'; $text .= '<td>' . $tp->toHTML($row['download_category_name']) . '</td>'; $text .= '<td>' . $tp->toHTML($row['download_url']) . '</td>'; $text .= '<td> <a href="' . e_SELF . '?create.edit.' . $row["download_id"] . '.maint.missing">' . ADMIN_EDIT_ICON . '</a> <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"] . ' ]') . '") \'/> </td>'; $text .= '</tr>'; } } } if ($foundSome) { $text .= '</table></form>'; } else { e107::getMessage()->addInfo(DOWLAN_172); // $text = DOWLAN_172; } break; case 'inactive': $title = DOWLAN_169; $text = ""; $query = "SELECT d.*, dc.* FROM `#download` AS d LEFT JOIN `#download_category` AS dc ON dc.download_category_id=d.download_category WHERE download_active=0"; $count = $sql->gen($query); $foundSome = false; if ($count) { while ($row = $sql->fetch()) { if (!$foundSome) { // $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform"); $text .= '<form method="post" action="' . e_SELF . '?' . e_QUERY . '" id="myform"> <table class="table adminform">'; $text .= '<tr>'; $text .= '<th>' . LAN_ID . '</th>'; $text .= '<th>' . DOWLAN_27 . '</th>'; $text .= '<th>' . DOWLAN_11 . '</th>'; $text .= '<th>' . DOWLAN_13 . '</th>'; $text .= '<th>' . LAN_OPTIONS . '</th>'; $text .= '</tr>'; $foundSome = true; } $text .= '<tr>'; $text .= '<td>' . $row['download_id'] . '</td>'; $text .= "<td><a href='" . e_PLUGIN . "download/download.php?view." . $row['download_id'] . "'>" . $e107->tp->toHTML($row['download_name']) . '</a></td>'; $text .= '<td>' . $e107->tp->toHTML($row['download_category_name']) . '</td>'; if (strlen($row['download_url']) > 0) { $text .= '<td>' . $row['download_url'] . '</td>'; } else { $mirrorArray = download::makeMirrorArray($row['download_mirror'], TRUE); $text .= '<td>'; foreach ($mirrorArray as $mirror) { $text .= $mirror['url'] . '<br/>'; } $text .= '</td>'; } $text .= '<td> <a href="' . e_SELF . '?create.edit.' . $row["download_id"] . '.maint.inactive">' . ADMIN_EDIT_ICON . '</a> <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"] . ' ]') . '") \'/> </td>'; $text .= '</tr>'; } } if ($foundSome) { $text .= '</table></form>'; } else { e107::getMessage()->addInfo(DOWLAN_172); // $text = DOWLAN_172; } break; case 'nocategory': $title = DOWLAN_178; $text = ""; $query = "SELECT * FROM `#download` WHERE download_category=0"; $count = $sql->gen($query); $foundSome = false; if ($count) { while ($row = $sql->fetch()) { if (!$foundSome) { // $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform"); $text .= ' <form method="post" action="' . e_SELF . '?' . e_QUERY . '" id="myform"> <table class="table adminlist">'; $text .= '<tr>'; $text .= '<th>' . LAN_ID . '</th>'; $text .= '<th>' . DOWLAN_27 . '</th>'; $text .= '<th>' . DOWLAN_13 . '</th>'; $text .= '<th>' . LAN_OPTIONS . '</th>'; $text .= '</tr>'; $foundSome = true; } $text .= '<tr>'; $text .= '<td>' . $row['download_id'] . '</td>'; $text .= "<td><a href='" . e_PLUGIN . "download/download.php?view." . $row['download_id'] . "'>" . $e107->tp->toHTML($row['download_name']) . '</a></td>'; if (strlen($row['download_url']) > 0) { $text .= '<td>' . $e107->tp->toHTML($row['download_url']) . '</td>'; } else { $mirrorArray = download::makeMirrorArray($row['download_mirror'], TRUE); $text .= '<td>'; foreach ($mirrorArray as $mirror) { $text .= $mirror['url'] . '<br/>'; } $text .= '</td>'; } $text .= '<td> <a href="' . e_SELF . '?create.edit.' . $row["download_id"] . '.maint.nocategory">' . ADMIN_EDIT_ICON . '</a> <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"] . ' ]') . '") \'/> </td>'; $text .= '</tr>'; } } if ($foundSome) { $text .= '</table></form>'; } else { e107::getMessage()->addInfo(DOWLAN_172); // $text = DOWLAN_172; } break; case 'filesize': $title = DOWLAN_66; $text = ""; $query = "SELECT d.*, dc.* FROM `#download` AS d LEFT JOIN `#download_category` AS dc ON dc.download_category_id=d.download_category WHERE d.download_url<>''"; $count = $sql->gen($query); $foundSome = false; if ($count) { while ($row = $sql->fetch()) { if (is_readable(e_DOWNLOAD . $row['download_url'])) { $filesize = filesize(e_DOWNLOAD . $row['download_url']); if ($filesize != $row['download_filesize']) { if (!$foundSome) { // $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform"); $text .= '<form method="post" action="' . e_SELF . '?' . e_QUERY . '" id="myform"> <table class="table adminlist">'; $text .= '<tr>'; $text .= '<th>' . LAN_ID . '</th>'; $text .= '<th>' . DOWLAN_27 . '</th>'; $text .= '<th>' . DOWLAN_11 . '</th>'; $text .= '<th>' . DOWLAN_13 . '</th>'; $text .= '<th>' . DOWLAN_180 . '</th>'; $text .= '<th>' . LAN_OPTIONS . '</th>'; $text .= '</tr>'; $foundSome = true; } $text .= '<tr>'; $text .= '<td>' . $row['download_id'] . '</td>'; $text .= "<td><a href='" . e_PLUGIN . "download/download.php?view." . $row['download_id'] . "'>" . $e107->tp->toHTML($row['download_name']) . '</a></td>'; $text .= '<td>' . $e107->tp->toHTML($row['download_category_name']) . '</td>'; $text .= '<td>' . $e107->tp->toHTML($row['download_url']) . '</td>'; $text .= '<td>' . $row['download_filesize'] . ' / '; $text .= $filesize; $text .= '</td>'; $text .= '<td> <a href="' . e_SELF . '?create.edit.' . $row["download_id"] . '.maint.filesize">' . ADMIN_EDIT_ICON . '</a> <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"] . ' ]') . '") \'/> </td>'; $text .= '</tr>'; } } } } if ($foundSome) { $text .= '</table></form>'; } else { e107::getMessage()->addInfo(DOWLAN_172); // $text = DOWLAN_172; } break; case 'log': $text = "log - view manage download history log"; header('location: ' . e_ADMIN . 'admin_log.php?downlog'); exit; break; } } else { $title = DOWLAN_193; $text = DOWLAN_179; $eform = new e_form(); $text = "\n\t\t \t<form method='post' action='" . e_SELF . "?" . e_QUERY . "' id='core-db-main-form'>\n\t\t \t\t<fieldset id='core-db-plugin-scan'>\n\t\t \t\t<legend class='e-hideme'>" . DOWLAN_10 . "</legend>\n\t\t \t\t\t<table class='table adminform'>\n\t\t \t\t\t<colgroup span='2'>\n\t\t \t\t\t\t<col style='width: 40%'></col>\n\t\t \t\t\t\t<col style='width: 60%'></col>\n\t\t \t\t\t</colgroup>\n\t\t \t\t\t<tbody>\n\t\t \t\t\t\t<tr>\n\t\t \t\t\t\t\t<td>" . DOWLAN_166 . "</td>\n\t\t \t\t\t\t\t<td>\n\t\t \t\t\t\t\t\t" . $eform->radio('dl_maint', 'duplicates') . $eform->label(DOWLAN_185, 'dl_maint', 'duplicates') . "\n\t\t \t\t\t\t\t</td>\n\t\t \t\t\t\t</tr>\n\t\t \t\t\t\t<tr>\n\t\t \t\t\t\t\t<td>" . DOWLAN_167 . "</td>\n\t\t \t\t\t\t\t<td>\n\t\t \t\t\t\t\t\t" . $eform->radio('dl_maint', 'orphans') . $eform->label(DOWLAN_186, 'dl_maint', 'orphans') . "\n\t\t \t\t\t\t\t</td>\n\t\t \t\t\t\t</tr>\n\t\t \t\t\t\t<tr>\n\t\t \t\t\t\t\t<td>" . DOWLAN_168 . "</td>\n\t\t \t\t\t\t\t<td>\n\t\t \t\t\t\t\t\t" . $eform->radio('dl_maint', 'missing') . $eform->label(DOWLAN_187, 'dl_maint', 'missing') . "\n\t\t \t\t\t\t\t</td>\n\t\t \t\t\t\t</tr>\n\t\t \t\t\t\t<tr>\n\t\t \t\t\t\t\t<td>" . DOWLAN_169 . "</td>\n\t\t \t\t\t\t\t<td>\n\t\t \t\t\t\t\t\t" . $eform->radio('dl_maint', 'inactive') . $eform->label(DOWLAN_188, 'dl_maint', 'inactive') . "\n\t\t \t\t\t\t\t</td>\n\t\t \t\t\t\t</tr>\n\t\t \t\t\t\t<tr>\n\t\t \t\t\t\t\t<td>" . DOWLAN_178 . "</td>\n\t\t \t\t\t\t\t<td>\n\t\t \t\t\t\t\t\t" . $eform->radio('dl_maint', 'nocategory') . $eform->label(DOWLAN_189, 'dl_maint', 'nocategory') . "\n\t\t \t\t\t\t\t</td>\n\t\t \t\t\t\t</tr>\n\t\t \t\t\t\t<tr>\n\t\t \t\t\t\t\t<td>" . DOWLAN_66 . "</td>\n\t\t \t\t\t\t\t<td>\n\t\t \t\t\t\t\t\t" . $eform->radio('dl_maint', 'filesize') . $eform->label(DOWLAN_190, 'dl_maint', 'filesize') . "\n\t\t \t\t\t\t\t</td>\n\t\t \t\t\t\t</tr>\n\t\t \t\t\t\t<tr>\n\t\t \t\t\t\t\t<td>" . DOWLAN_171 . "</td>\n\t\t \t\t\t\t\t<td>\n\t\t \t\t\t\t\t\t" . $eform->radio('dl_maint', 'log') . $eform->label(DOWLAN_191, 'dl_maint', 'log') . "\n\t\t \t\t\t\t\t</td>\n\t\t \t\t\t\t</tr>\n\t\t\n\t\t \t\t\t\t</tbody>\n\t\t \t\t\t</table>\n\t\t \t\t\t<div class='buttons-bar center'>\n\t\t \t\t\t\t" . $eform->admin_button('trigger_db_execute', DOWLAN_192, 'execute') . "\n\t\t \t\t\t</div>\n\t\t \t\t</fieldset>\n\t\t \t</form>\n\t\t \t"; } echo $text; // $ns->tablerender(DOWLAN_165.$title, $text); }
$i++; } $c++; } unset($for_var); $text .= "\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tlogin_field.value = \"\";\n\t\t\t\t\t\t\t\t\tpassword_field.value = \"\";\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</script>\n\t\t"; } else { $text .= "\n\t\t\t\t\t\t\t<input class='tbox' type='text' size='30' maxlength='100' name='client_name' value='' />\n\t\t\t\t\t\t\t<div class='field-help'>" . BNRLAN_29 . "</div>\n\t\t"; } $text .= "\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . BNRLAN_30 . "</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<input class='tbox input-text' type='text' size='30' maxlength='20' id='clientlogin' name='client_login' value='" . $_POST['client_login'] . "' />\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . BNRLAN_31 . "</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<input class='tbox input-text' type='text' size='30' maxlength='50' id='clientpassword' name='client_password' value='" . $_POST['client_password'] . "' />\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . BNRLAN_32 . "</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<div class='field-spacer'>\n\t\t\t\t\t\t\t\t<button class='action' type='button' value='no-value' onclick='e107Helper.toggle(\"banner-repo\")'><span>" . BNRLAN_43 . "</span></button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class='e-hideme' id='banner-repo'>\n\t"; $c = 0; while ($images[$c]) { $image = $images[$c]['path'] . $images[$c]['fname']; $fileext1 = substr(strrchr($image, "."), 1); $fileext2 = substr(strrchr($image, "."), 0); $text .= "\n\t\t\t\t\t\t\t\t<div class='field-spacer'>\n\t\t\t\t\t\t\t\t\t" . $frm->radio('banner_image', $images[$c]['fname'], basename($image) == $_POST['banner_image']) . "\n\t\t"; if ($fileext1 == 'swf') { //FIXME - swfObject $text .= "\n\t\t\t\t\t\t\t\t\t<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='468' height='60'>\n\t\t\t\t\t\t\t\t\t\t<param name='movie' value='" . e_IMAGE . "banners/" . $images[$c]['fname'] . "'>\n\t\t\t\t\t\t\t\t\t\t<param name='quality' value='high'><param name='SCALE' value='noborder'>\n\t\t\t\t\t\t\t\t\t\t<embed src='" . e_IMAGE . "banners/" . $images[$c]['fname'] . "' width='468' height='60' scale='noborder' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'></embed>\n\t\t\t\t\t\t\t\t\t</object>\n\t\t\t"; } else { if ($fileext1 == "php" || $fileext1 == "html" || $fileext1 == "js") { $text .= $frm->label(BNRLAN_46 . ": " . $images[$c]['fname'], 'banner_image', $images[$c]['fname']); } else { $text .= $frm->label("<img src='{$image}' alt='' />", 'banner_image', $images[$c]['fname']); } } $text .= "\n\t\t\t\t\t\t\t\t</div>\n\t\t"; $c++; } $text .= "\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . BNRLAN_33 . "</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<input class='tbox input-text' type='text' size='50' maxlength='150' name='click_url' value='" . $_POST['click_url'] . "' />\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . BNRLAN_34 . "</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<input class='tbox input-text' type='text' size='10' maxlength='10' name='impressions_purchased' value='" . $_POST['impressions_purchased'] . "' />\n\t\t\t\t\t\t\t<div class='field-help'>0 = " . BNRLAN_35 . "</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td>" . BNRLAN_36 . "</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<select name='startday' class='tbox'>\n\t\t\t\t\t\t\t<option value='0'> </option>\n\t"; for ($a = 1; $a <= 31; $a++) {