Beispiel #1
0
    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);
    }