$form .= "<form action='#' method='post'>\n {$lang->main_msg} :<br/> <textarea name='msg'>" . htmlentities($set->sinfo->main_msg, ENT_QUOTES) . "</textarea><br/>\n {$lang->password} ({$lang->keep_blank}):<br/> <input type='password' name='pass'><br/>\n <br/>\n <input type='submit' value='{$lang->save}'>\n </form><br/> \n » <a href='?act=editset&sphp=1'>{$lang->edit} settings.php</a>"; $plugins->run_hook("admin_actions_editset_end"); } } //delete if ($_GET['act'] == 'delete') { $file = $db->get_row("SELECT * FROM `" . MAI_PREFIX . "files` WHERE `id`='{$fid}'"); if (!$file) { header("Location: {$set->url}"); exit; } $plugins->run_hook("admin_actions_delete_top"); if ($file->size > 0) { $links[] = mai_img("arr.gif") . " <a href='{$set->url}/data/file/{$file->id}/" . mai_converturl($file->name) . ".html'>{$file->name} </a>"; } else { $links[] = mai_img("arr.gif") . " <a href='{$set->url}/data/{$file->id}/" . mai_converturl($file->name) . ".html'>{$file->name} </a>"; } $links[] = mai_img("arr.gif") . " {$lang->delete} "; if ($_POST['yes']) { if (is_dir(".." . $file->path)) { deleteAll(".." . $file->path); $db->query("DELETE FROM `" . MAI_PREFIX . "files` WHERE `path` LIKE '{$file->path}%'"); $plugins->run_hook("admin_actions_delete_a"); } else { @unlink(".." . $file->path); $db->query("DELETE FROM `" . MAI_PREFIX . "files` WHERE `id`='{$file->id}'"); $plugins->run_hook("admin_actions_delete_b"); } $form = "<div class='green'>{$lang->data_gone}</div>"; } else { $form .= "<form action='#' method='post'>\n\t\t{$lang->are_you_sure} <br/>\n\t\t\t<input type='submit' name='yes' value='{$lang->yes}'> <a href='{$set->url}'> {$lang->no} </a>\n\t\t</form>";
} } if ($file->icon != '') { $icon = "/thumb.php?ext&w=128&src=" . urlencode($file->icon); } $plugins->run_hook("file_mid"); $show_icon = "<img src='{$set->url}" . $icon . "' width='128'>"; $download = "<a href='?download'><div class='download'> {$lang->download} {$ext->extension} </div></a>"; if ($ext->extension == 'jar') { $download .= "<a href='?download&jad'><div class='download'> {$lang->download} JAD</div></a>"; } foreach (explode('/', substr($file->path, 7)) as $dr) { if (trim($dr != "")) { $_dr .= "/" . $dr; $id = $db->get_row("SELECT `id`,`name` FROM `" . MAI_PREFIX . "files` WHERE `path` = '/files" . $db->escape($_dr) . "'"); $links[] = mai_img("arr.gif") . " <a href='{$set->url}/data/" . ($file->id == $id->id ? "file/" : "") . $id->id . "/" . mai_converturl($id->name) . ".html'>{$id->name}</a>"; } } if (is_admin()) { $_admin = "<div class='content'><a href='{$set->url}/admincp/actions.php?act=edit&id={$file->id}'>{$lang->edit}</a> |\n\t\t<a href='{$set->url}/admincp/actions.php?act=delete&id={$file->id}'>{$lang->delete}</a></div>"; } include "header.php"; $tpl->grab("file.tpl", 'file'); $tpl->assign('name', $name); $tpl->assign('description', $description); $tpl->assign('size', $size); $tpl->assign('dloads', $dloads); $tpl->assign('views', $views); $tpl->assign('show_icon', $show_icon); $tpl->assign('time', $time); $tpl->assign('download', $download);
} else { $new_text = ''; } if (is_dir("." . $d->path)) { if ($d->isdir == 0) { // since 1.0.6 a folder is no longer defined as size = 0 // this is just a fix for users who upgrade, a clean install should never get here $db->query("UPDATE `" . MAI_PREFIX . "files` SET `isdir` = '1' WHERE `id` = '{$d->id}'"); } $count = $db->count("SELECT `id` FROM `" . MAI_PREFIX . "files` WHERE `path` LIKE '" . $d->path . "%' AND `isdir` = '0'"); $plugins->run_hook("index_folders"); $folders .= "<div class='content" . (++$j % 2 == 0 ? "2" : "") . "'>\n\t\t\t<a href='{$set->url}/data/{$d->id}/" . mai_converturl($d->name) . ".html'> <table><tr><td>\n\t\t\t" . ($d->icon != '' ? "<img src='{$set->url}/thumb.php?ext&w=45&src=" . urlencode($d->icon) . "' alt='.'>" : "<img src='{$set->url}/thumb.php?w=45&src=" . base64_encode("/" . MAI_TPL . "style/images/folder.png") . "' alt='.'/>") . "\n\t\t\t</td><td> {$d->name} {$new_text} <br/> {$count} {$lang->files} </td></tr></table></a>" . sprintf($_admin, $d->id) . " </div>"; $plugins->run_hook("index_folders_end"); } else { $plugins->run_hook("index_files_top"); $files .= "<div class='content" . (++$i % 2 == 0 ? "2" : "") . "'>\n\t\t\t<a href='{$set->url}/data/file/{$d->id}/" . mai_converturl($d->name) . ".html'><table><tr><td>"; // icon if ($d->icon == '') { $ext = (object) pathinfo($d->path); $ext->extension = strtolower($ext->extension); if (in_array($ext->extension, array('png', 'jpg', 'jpeg', 'gif', 'jar'))) { if ($ext->extension == 'jar') { $icon = "/icon.php?s=" . base64_encode($d->path); } else { $icon = "/thumb.php?w=45&src=" . base64_encode($d->path); } } else { $all_icons = str_replace(".png", "", array_map("basename", glob(MAI_TPL . "style/png/*.png"))); if (!in_array($ext->extension, $all_icons)) { $icon = "/" . MAI_TPL . "style/png/file.png"; } else {