public function _MyInit() { $this->baseDir = substr(C("WEB_ROOT"), 0, strlen(C("WEB_ROOT")) - 1); //不带最后的"/" $currentDir = isset($_REQUEST['newpath']) ? $_REQUEST['newpath'] : cookie("cpath"); //用cookie保存当前目录,以支持ajax等不带目录参数的操作 if (empty($currentDir)) { $currentDir = "/"; } //根目录"/" if (substr($currentDir, strlen($currentDir) - 1, 1) != "/") { $currentDir .= "/"; } //如果文件夹的传入没有加最后的"/"则自动加上 $this->currentdir = $currentDir; //当前打开的目录 cookie("cpath", $this->currentdir, 36000); $this->inpath = $this->baseDir . $currentDir; //新目录/无新目录里默认打开baseDir if (!is_dir($this->inpath)) { $this->inpath = $this->baseDir; //避免文件夹被删除后cpath没更新而导致出错 } if ($this->currentdir == "/") { $this->updir = "/"; //上级目录 } else { $d = explode("/", $this->currentdir); $len = count($d); unset($d[$len - 1], $d[$len - 2]); //删除最后一层目录 $this->updir = implode("/", $d) . "/"; //上级目录 } import('ORG.Util.File'); FileManagement::currentDir($this->currentdir); //初始化位置信息//都是带最后一个"/"的 }
function getAttachmentUrl($apli, $post_id, $att_id, $att_path, $att_type, $att_size, $att_inline = 0, $compteur, $visible = 0, $Mmod) { global $icon_dir, $img_dir, $forum; global $mimetype_default, $mime_dspfmt, $mime_renderers; global $DOCUMENTROOT; load_mimetypes(); $att_name = substr(strstr(basename($att_path), '.'), 1); $att_name = substr(strstr(basename($att_name), '.'), 1); $att_path = $DOCUMENTROOT . $att_path; if (!is_file($att_path)) { return ' <span class="text-danger" style="font-size: .65rem;">' . upload_translate("Fichier non trouvÈ") . ' : ' . $att_name . '</span>'; } if ($att_inline) { if (isset($mime_dspfmt[$att_type])) { $display_mode = $mime_dspfmt[$att_type]; } else { $display_mode = $mime_dspfmt[$mimetype_default]; } } else { $display_mode = ATT_DSP_LINK; } if ($Mmod) { global $userdata; $marqueurM = "&Mmod=" . substr($userdata[2], 8, 6); } else { $marqueurM = ""; } $att_url = "getfile.php?att_id={$att_id}&apli={$apli}" . $marqueurM . "&att_name=" . rawurlencode($att_name); if ($visible != 1) { $visible_wrn = ' <span class="text-danger" style="font-size: .65rem;">' . upload_translate("Fichier non visible") . '</span>'; } switch ($display_mode) { case ATT_DSP_IMG: // display as an embedded image $size = @getImageSize("{$att_path}"); // $img_size = verifsize( $size ); $img_size = 'style="max-width: 100%; height:auto;"'; $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_IMG]); eval("\$ret=stripSlashes(\"{$text}\");"); break; case ATT_DSP_PLAINTEXT: // display as embedded text, PRE-formatted $att_contents = str_replace("\\", "\\\\", htmlSpecialChars(join('', file($att_path)), ENT_COMPAT | ENT_HTML401, cur_charset)); $att_contents = word_wrap($att_contents); $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_PLAINTEXT]); eval("\$ret=\"{$text}\";"); break; case ATT_DSP_HTML: // display as embedded HTML text //au choix la source ou la page $att_contents = word_wrap(nl2br(scr_html(join("", file($att_path))))); //$att_contents = removeHack (join ("", file ($att_path))); $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_HTML]); eval("\$ret=stripSlashes(\"{$text}\");"); break; case ATT_DSP_SWF: // Embedded Macromedia Shockwave Flash $size = @getImageSize("{$att_path}"); $img_size = verifsize($size); $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_SWF]); eval("\$ret=stripSlashes(\"{$text}\");"); break; default: // display as link $Fichier = new FileManagement(); // essai class PHP7 // $Fichier = new File(""); // $att_size = $Fichier->Pretty_Size($att_size); $att_size = $Fichier->file_size_format($att_size, 1); $att_icon = att_icon($att_name); $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_LINK]); eval("\$ret=stripSlashes(\"{$text}\");"); break; } return $ret; }
/*--------------------- function _getformzip() 处理从ZIP中解压的图片 ---------------------*/ if ($formzip == 1) { include_once DEDEINC . "/zip.class.php"; include_once DEDEADMIN . "/file_class.php"; $zipfile = $cfg_basedir . str_replace($cfg_mainsite, '', $zipfile); $tmpzipdir = DEDEDATA . '/ziptmp/' . cn_substr(md5(ExecTime()), 16); $ntime = time(); if (file_exists($zipfile)) { @mkdir($tmpzipdir, $GLOBALS['cfg_dir_purview']); @chmod($tmpzipdir, $GLOBALS['cfg_dir_purview']); $z = new zip(); $z->ExtractAll($zipfile, $tmpzipdir); $fm = new FileManagement(); $imgs = array(); $fm->GetMatchFiles($tmpzipdir, "jpg|png|gif", $imgs); $i = 0; foreach ($imgs as $imgold) { $i++; $savepath = $cfg_image_dir . "/" . MyDate("Y-m", $ntime); CreateDir($savepath); $iurl = $savepath . "/" . MyDate("d", $ntime) . dd2char(MyDate("His", $ntime) . '-' . $adminid . "-{$i}" . mt_rand(1000, 9999)); $iurl = $iurl . substr($imgold, -4, 4); $imgfile = $cfg_basedir . $iurl; copy($imgold, $imgfile); unlink($imgold); if (is_file($imgfile)) { $litpicname = $pagestyle > 2 ? GetImageMapDD($iurl, $cfg_ddimg_width) : $iurl; //指定了提取第一张为缩略图的情况强制使用第一张缩略图
require dirname(__FILE__) . "/config.php"; CheckPurview('plus_文件管理器'); require DEDEINC . "/oxwindow.class.php"; require_once DEDEADMIN . '/file_class.php'; $activepath = str_replace("..", "", $activepath); $activepath = preg_replace("#^\\/{1,}#", "/", $activepath); if ($activepath == "/") { $activepath = ""; } if ($activepath == "") { $inpath = $cfg_basedir; } else { $inpath = $cfg_basedir . $activepath; } //文件管理器交互与逻辑控制文件 $fmm = new FileManagement(); $fmm->Init(); /*--------------- function __rename(); ----------------*/ if ($fmdo == "rename") { $fmm->RenameFile($oldfilename, $newfilename); } else { if ($fmdo == "newdir") { $fmm->NewDir($newpath); } else { if ($fmdo == "move") { $fmm->MoveFile($filename, $newpath); } else { if ($fmdo == "del") { $fmm->DeleteFile($filename);
function listdownloads($dcategory, $sortby, $sortorder) { global $perpage, $page, $download_cat, $user; global $NPDS_Prefix; if ($dcategory == "") { $dcategory = addslashes($download_cat); } if (!$sortby) { $sortby = "dfilename"; } if ($sortorder != "ASC" && $sortorder != "DESC") { $sortorder = "ASC"; } echo '<p class="lead">'; echo translate("Display filtered with") . " <i>"; if ($dcategory == translate("All")) { echo translate("All"); } else { echo aff_langue(stripslashes($dcategory)); } echo "</i> " . translate("sorted by") . " "; // Shiney SQL Injection 11/2011 $sortby2 = ""; if ($sortby == 'dfilename') { $sortby2 = translate("Name") . ""; } if ($sortby == 'dfilesize') { $sortby2 = translate("File Size") . ""; } if ($sortby == 'dcategory') { $sortby2 = translate("Category") . ""; } if ($sortby == 'ddate') { $sortby2 = translate("Creation Date") . ""; } if ($sortby == 'dver') { $sortby2 = translate("Version") . ""; } if ($sortby == 'dcounter') { $sortby2 = translate("Downloads") . ""; } // Shiney SQL Injection 11/2011 if ($sortby2 == '') { $sortby = 'dfilename'; } echo ' ' . translate("of") . ' <i>' . $sortby2 . '</i> </p>'; echo '<table class="table table-hover" id ="lst_downlo" data-toggle="table" data-striped="true" data-search="true" data-show-toggle="true" data-mobile-responsive="true" data-icons-prefix="fa" data-icons="icons">'; sortlinks($dcategory, $sortby); echo '<tbody>'; if ($dcategory == translate("All")) { $sql = "SELECT COUNT(*) FROM " . $NPDS_Prefix . "downloads"; } else { $sql = "SELECT COUNT(*) FROM " . $NPDS_Prefix . "downloads WHERE dcategory='" . addslashes($dcategory) . "'"; } $result = sql_query($sql); list($total) = sql_fetch_row($result); if ($total > $perpage) { $pages = ceil($total / $perpage); if ($page > $pages) { $page = $pages; } if (!$page) { $page = 1; } $offset = ($page - 1) * $perpage; } else { $offset = 0; $pages = 1; $page = 1; } settype($offset, "integer"); settype($perpage, "integer"); if ($dcategory == translate("All")) { $sql = "SELECT * FROM " . $NPDS_Prefix . "downloads ORDER BY {$sortby} {$sortorder} LIMIT {$offset},{$perpage}"; } else { $sql = "SELECT * FROM " . $NPDS_Prefix . "downloads WHERE dcategory='" . addslashes($dcategory) . "' ORDER BY {$sortby} {$sortorder} LIMIT {$offset},{$perpage}"; } $result = sql_query($sql); while (list($did, $dcounter, $durl, $dfilename, $dfilesize, $ddate, $dweb, $duser, $dver, $dcat, $ddescription, $dperm) = sql_fetch_row($result)) { $Fichier = new File($durl); // keep for extension $FichX = new FileManagement(); // essai class $okfile = autorisation($dperm); echo ' <tr> <td class="text-xs-center">'; if ($okfile == true) { echo popuploader($did, $ddescription, $dcounter, $dfilename, true); } else { echo popuploader($did, $ddescription, $dcounter, $dfilename, false); echo '<span class="text-warning">' . translate("Private") . '</span>'; } echo "</td><td class=\"text-xs-center\"><img src=\"" . $Fichier->Affiche_Extention() . "\" alt=\"" . $Fichier->Affiche_Extention() . "\" border=\"0\" /></td>\n <td>"; if ($okfile == true) { echo "<a href=\"download.php?op=mydown&did={$did}\" target=\"_blank\">{$dfilename}</a>"; } else { echo '...'; } echo '</td> <td>'; if ($dfilesize != 0) { // echo $Fichier->Pretty_Size($dfilesize); echo $FichX->file_size_auto($durl, 2); } else { // echo $Fichier->Affiche_Size(); echo $FichX->file_size_auto($durl, 2); } echo '</td> <td>' . aff_langue(stripslashes($dcat)) . '</td> <td>' . convertdate($ddate) . '</td> <td class="text-xs-center">' . $dver . '</td> <td class="text-xs-center">' . wrh($dcounter) . '</td> <td>'; if ($okfile == true and $user) { echo "<a href=\"download.php?op=broken&did={$did}\" title=\"" . translate("Report Broken Link") . "\"><i class=\"fa fa-lg fa-chain-broken\"></i></a>"; } echo ' </td> </tr>'; } echo ' </tbody> </table>'; $dcategory = StripSlashes($dcategory); echo '<ul class="pagination pagination-sm">'; if ($pages > 1) { $pcnt = 1; if ($page > 1) { echo ' <li class="page-item"> <a class="page-link" href="download.php?dcategory=' . $dcategory . '&sortby=' . $sortby . '&sortorder=' . $sortorder . '&page=' . ($page - 1) . '" aria-label="Previous" title="' . translate("Previous Page") . '"> <span aria-hidden="true">«</span> <span class="sr-only">Previous</span> </a> </li>'; } while ($pcnt < $page) { echo "<li class=\"page-item\"><a class=\"page-link\" href=\"download.php?dcategory={$dcategory}&sortby={$sortby}&sortorder={$sortorder}&page={$pcnt}\">{$pcnt}</a></li>"; $pcnt++; } echo '<li class="page-item active"><a class="page-link" href="#">' . $page . '</a></li>'; $pcnt++; while ($pcnt <= $pages) { echo "<li class=\"page-item\"><a class=\"page-link\" href=\"download.php?dcategory={$dcategory}&sortby={$sortby}&sortorder={$sortorder}&page={$pcnt}\">{$pcnt}</a></li>"; $pcnt++; } if ($page < $pages) { echo "<li class=\"page-item\">\n <a class=\"page-link\" href=\"download.php?dcategory={$dcategory}&sortby={$sortby}&sortorder={$sortorder}&page=" . ($page + 1) . "\" aria-label=\"Next\" title=\"" . translate("Next Page") . "\">\n <span aria-hidden=\"true\">»</span>\n <span class=\"sr-only\">Next</span>\n </a>\n </li>\n"; } } echo '</ul>'; }
$vizut = '<th>' . upload_translate("Visible") . '</th>'; } $att_table = ' <table class="table table-striped table-hover" border="0"> <thead> <tr> <th> </th> <th data-sortable="true">' . upload_translate("Fichier") . '</th> <th data-sortable="true">' . upload_translate("Type") . '</th> <th data-sortable="true">' . upload_translate("Taille") . '</th> <th data-sortable="true">' . upload_translate("Affichage intégré") . '</th> ' . $vizut . ' </tr> </thead> <tbody>'; $Fichier = new FileManagement(); // essai class PHP7 for ($i = 0; $i < $att_count; $i++) { $id = $att[$i]['att_id']; $tsz += $att[$i]['att_size']; $sz = $Fichier->file_size_format($att[$i]['att_size'], 2); if (getAttDisplayMode($att[$i]['att_type'], 'A') == ATT_DSP_LINK) { // This mime-type can't be displayed inline echo '<input type="hidden" name="inline_att[' . $id . ']" value="0" />'; $inline_box = '--'; } else { $inline_box = getListBox("inline_att[{$id}]", $inline_list, $att[$i]["inline"]); } if ($Mmod) { $visu = "<td align=\"center\">" . getCheckBox("visible_att[]", $id, $att[$i]["visible"] == 1 ? $id : -1, "") . "</td>"; $visible_list .= $id . ',';
if($formzip==1) { include_once(DEDEADMIN."/../include/zip.lib.php"); include_once(DEDEADMIN."/file_class.php"); $zipfile = $cfg_basedir.str_replace($cfg_mainsite,'',$zipfile); $tmpzipdir = DEDEADMIN.'/module/ziptmp/'.cn_substr(md5(ExecTime()),16); $ntime = time(); if(file_exists($zipfile)) { @mkdir($tmpzipdir,$GLOBALS['cfg_dir_purview']); @chmod($tmpzipdir,$GLOBALS['cfg_dir_purview']); $z = new zip(); $z->ExtractAll($zipfile,$tmpzipdir); $fm = new FileManagement(); $imgs = array(); $fm->GetMatchFiles($tmpzipdir,"jpg|png|gif",$imgs); $i = 0; foreach($imgs as $imgold) { $i++; $savepath = $cfg_image_dir."/".strftime("%Y-%m",$ntime); CreateDir($savepath); $iurl = $savepath."/".strftime("%d",$ntime).dd2char(strftime("%H%M%S",$ntime).'-'.$adminID."-{$i}".mt_rand(1000,9999)); $iurl = $iurl.substr($imgold,-4,4); $imgfile = $cfg_basedir.$iurl; copy($imgold,$imgfile); unlink($imgold); if(is_file($imgfile))
function DownloadAdmin() { global $hlpfile, $NPDS_Prefix, $f_meta_nom, $f_titre, $adminimg; include "header.php"; include_once "lib/togglediv.class.php"; GraphicAdmin($hlpfile); adminhead($f_meta_nom, $f_titre, $adminimg); echo "<form action=\"admin.php\" method=\"post\">"; $resultX = sql_query("SELECT DISTINCT dcategory FROM " . $NPDS_Prefix . "downloads ORDER BY dcategory"); $num_row = sql_num_rows($resultX); $toggle = new ToggleDiv($num_row); echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"header\">\n"; echo adm_translate("Téléchargements"); echo "</td><td class=\"ongl\">" . $toggle->All() . "</td>"; echo "</td></tr></table>"; while (list($dcategory) = sql_fetch_row($resultX)) { echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\">"; echo "<tr><td class=\"ongl\">"; echo $toggle->Img(); echo adm_translate("Catégorie") . " : " . aff_langue(stripslashes($dcategory)); echo $toggle->Begin(); echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\">\n <tr>\n <td class=\"ongl\">" . adm_translate("ID") . "</td>\n <td class=\"ongl\">" . adm_translate("Compt.") . "</td>\n <td class=\"ongl\">Typ.</td>\n <td class=\"ongl\">" . adm_translate("URL") . "</td>\n <td class=\"ongl\">" . adm_translate("Nom de fichier") . "</td>\n <td class=\"ongl\" align=\"center\">" . adm_translate("Ver.") . "</td>\n <td class=\"ongl\" align=\"center\">" . adm_translate("Taille de fichier") . "</td>\n <td class=\"ongl\" align=\"center\">" . adm_translate("Date") . "</td>\n <td class=\"ongl\" align=\"center\">" . adm_translate("Fonctions") . "</td>\n </tr>"; $result = sql_query("SELECT did, dcounter, durl, dfilename, dfilesize, ddate, dver, perms FROM " . $NPDS_Prefix . "downloads WHERE dcategory='" . addslashes($dcategory) . "' ORDER BY did ASC"); while (list($did, $dcounter, $durl, $dfilename, $dfilesize, $ddate, $dver, $dperm) = sql_fetch_row($result)) { $rowcolor = tablos(); echo "<tr {$rowcolor}>\n <td align=\"center\">{$did}</td>\n <td align=\"center\">{$dcounter}</td>"; if ($dperm == 0) { $dperm = "Al"; } if ($dperm >= 1) { $dperm = "Mb"; } if ($dperm == -127) { $dperm = "Ad"; } if ($dperm == -1) { $dperm = "An"; } echo "<td align=\"left\">{$dperm}</td>\n <td><a href=\"{$durl}\" class=\"noir\">" . adm_translate("Téléchargements") . "</a></td>\n <td>{$dfilename}</td>\n <td align=\"center\"> {$dver}</td>\n <td align=\"center\">"; //$Fichier = new File($durl); $Fichier = new FileManagement(); // essai class if ($dfilesize != 0) { //echo $Fichier->Pretty_Size($dfilesize); echo $Fichier->file_size_auto($durl, 2); } else { //echo $Fichier->Affiche_Size(); echo $Fichier->file_size_auto($durl, 2); } echo "</td>\n <td align=\"center\">{$ddate}</td>\n <td align=\"center\"><a href=\"admin.php?op=DownloadEdit&did={$did}\" class=\"noir\">" . adm_translate("Editer") . "</a> |\n <a href=\"admin.php?op=DownloadDel&did={$did}&ok=0\" class=\"rouge\">" . adm_translate("Effacer") . "</a></td>\n </tr>"; } echo "</table>"; echo $toggle->End(); echo "</td></tr></table>"; } echo ' </form>'; echo ' <h3>' . adm_translate("Ajouter un Téléchargement") . '</h3> <form action="admin.php" method="post" name="adminForm"> <div class="form-group row"> <label class="form-control-label col-sm-4" for="durl">' . adm_translate("Télécharger URL") . '</label> <div class="col-sm-8"> <input class="form-control" type="url" id="durl" name="durl" maxlength="255" required="required" /> <a href="javascript:void(0);" onclick="window.open(\'admin.php?op=FileManagerDisplay\', \'wdir\', \'width=650, height=450, menubar=no, location=no, directories=no, status=no, copyhistory=no, toolbar=no, scrollbars=yes, resizable=yes\');"> <span class="">[' . adm_translate("Parcourir") . ']</span></a> <span class="help-block text-xs-right"><span id="countcar_durl"></span></span> </div> </div> <div class="form-group row"> <label class="form-control-label col-sm-4" for="dcounter">' . adm_translate("Compteur") . '</label> <div class="col-sm-8"> <input class="form-control" type="number" name="dcounter" maxlength="30" /> </div> </div> <div class="form-group row"> <label class="form-control-label col-sm-4" for="dfilename">' . adm_translate("Nom de fichier") . '</label> <div class="col-sm-8"> <input class="form-control" type="text" id="dfilename" name="dfilename" maxlength="255" /> <span class="help-block text-xs-right"><span id="countcar_dfilename"></span></span> </div> </div> <div class="form-group row"> <label class="form-control-label col-sm-4" for="dver">' . adm_translate("Version") . '</label> <div class="col-sm-8"> <input class="form-control" type="text" name="dver" maxlength="6" /> </div> </div> <div class="form-group row"> <label class="form-control-label col-sm-4" for="dfilesize">' . adm_translate("Taille de fichier") . ' (bytes)</label> <div class="col-sm-8"> <input class="form-control" type="text" name="dfilesize" maxlength="31" /> </div> </div> <div class="form-group row"> <label class="form-control-label col-sm-4" for="dweb">' . adm_translate("Propriétaire de la page Web") . '</label> <div class="col-sm-8"> <input class="form-control" type="text" id="dweb" name="dweb" maxlength="255" /> <span class="help-block text-xs-right"><span id="countcar_dweb"></span></span> </div> </div> <div class="form-group row"> <label class="form-control-label col-sm-4" for="duser">' . adm_translate("Propriétaire") . '</label> <div class="col-sm-8"> <input class="form-control" type="text" id="duser" name="duser" maxlength="30" /> <span class="help-block text-xs-right"><span id="countcar_duser"></span></span> </div> </div> <div class="form-group row"> <label class="form-control-label col-sm-4" for="dcategory">' . adm_translate("Catégorie") . '</label> <div class="col-sm-8"> <input class="form-control" type="text" id="dcategory" name="dcategory" maxlength="250" /> <span class="help-block text-xs-right"><span id="countcar_dcategory"></span></span> <select class="c-select form-control" name="sdcategory">'; $result = sql_query("SELECT DISTINCT dcategory FROM " . $NPDS_Prefix . "downloads ORDER BY dcategory"); while (list($dcategory) = sql_fetch_row($result)) { $dcategory = stripslashes($dcategory); echo ' <option ' . $sel . ' value="' . $dcategory . '">' . aff_langue($dcategory) . '</option>'; } echo ' </select> </div> </div> <div class="form-group row"> <label class="form-control-label col-sm-12" for="xtext">' . adm_translate("Description") . '</label> <div class="col-sm-12"> <textarea class="tin form-control" name="xtext" rows="20" ></textarea> </div> </div>'; echo aff_editeur('xtext', ''); echo ' <fieldset> <legend>' . adm_translate("Droits") . '</legend>'; droits(''); echo '</fieldset> <input type="hidden" name="op" value="DownloadAdd" /> <div class="form-group row"> <input class="btn btn-primary" type="submit" value="' . adm_translate("Ajouter") . '" /> </div> </form> <script type="text/javascript"> //<![CDATA[ $(document).ready(function() { inpandfieldlen("durl",255); inpandfieldlen("dfilename",255); inpandfieldlen("dver",6); inpandfieldlen("dfilesize",31); inpandfieldlen("dweb",255); inpandfieldlen("duser",30); inpandfieldlen("dcategory",250); }); //]]> </script>'; adminfoot('fv', '', '', ''); // include("footer.php"); }
function DownloadAdmin() { global $hlpfile, $NPDS_Prefix, $f_meta_nom, $f_titre, $adminimg; include "header.php"; GraphicAdmin($hlpfile); adminhead($f_meta_nom, $f_titre, $adminimg); $resultX = sql_query("SELECT DISTINCT dcategory FROM " . $NPDS_Prefix . "downloads ORDER BY dcategory"); $num_row = sql_num_rows($resultX); echo ' <hr /> <h3>' . adm_translate("Catégories") . '</h3>'; $pseudocatid = ''; while (list($dcategory) = sql_fetch_row($resultX)) { $pseudocatid++; echo ' <h4><a class="tog" id="show_cat_' . $pseudocatid . '" title="Déplier la liste"><i id="i_cat_' . $pseudocatid . '" class="fa fa-caret-down fa-lg"></i></a> ' . aff_langue(stripslashes($dcategory)) . '</h4>'; echo ' <div id="cat_' . $pseudocatid . '" style="display:none;"> <table data-toggle="table" data-striped="true" data-search="true" data-show-toggle="true" data-show-columns="true" data-mobile-responsive="true" data-icons-prefix="fa" data-icons="icons"> <thead> <tr> <th data-sortable="true" data-halign="center" data-align="right">' . adm_translate("ID") . '</th> <th data-sortable="true" data-halign="center" data-align="right">' . adm_translate("Compt.") . '</th> <th data-sortable="true" data-halign="center" data-align="center">Typ.</th> <th data-halign="center" data-align="right">' . adm_translate("URL") . '</th> <th data-sortable="true" data-halign="center" >' . adm_translate("Nom de fichier") . '</th> <th data-halign="center" >' . adm_translate("Ver.") . '</th> <th data-halign="center" data-align="right">' . adm_translate("Taille de fichier") . '</th> <th data-halign="center" >' . adm_translate("Date") . '</th> <th data-halign="center" data-align="right">' . adm_translate("Fonctions") . '</th> </tr> </thead> <tbody>'; $result = sql_query("SELECT did, dcounter, durl, dfilename, dfilesize, ddate, dver, perms FROM " . $NPDS_Prefix . "downloads WHERE dcategory='" . addslashes($dcategory) . "' ORDER BY did ASC"); while (list($did, $dcounter, $durl, $dfilename, $dfilesize, $ddate, $dver, $dperm) = sql_fetch_row($result)) { echo ' <tr> <td>' . $did . '</td> <td>' . $dcounter . '</td>'; if ($dperm == 0) { $dperm = 'Al'; } if ($dperm >= 1) { $dperm = 'Mb'; } if ($dperm == -127) { $dperm = 'Ad'; } if ($dperm == -1) { $dperm = 'An'; } echo ' <td>' . $dperm . '</td> <td><a href="' . $durl . '" title="' . adm_translate("Téléchargements") . '" data-toggle="tooltip"><i class="fa fa-download fa-2x"></i></a></td> <td>' . $dfilename . '</td> <td>' . $dver . '</td> <td>'; $Fichier = new FileManagement(); if ($dfilesize != 0) { echo $Fichier->file_size_auto($durl, 2); } else { echo $Fichier->file_size_auto($durl, 2); } echo '</td> <td>' . $ddate . '</td> <td> <a href="admin.php?op=DownloadEdit&did=' . $did . '" title="' . adm_translate("Editer") . '" data-toggle="tooltip"><i class="fa fa-edit fa-lg"></i></a> <a href="admin.php?op=DownloadDel&did=' . $did . '&ok=0" title="' . adm_translate("Effacer") . '" data-toggle="tooltip"><i class="fa fa-trash-o fa-lg text-danger"></i></a> </td> </tr>'; } echo ' </tbody> </table> </div>'; echo ' <script type="text/javascript"> //<![CDATA[ $( document ).ready(function() { tog("cat_' . $pseudocatid . '","show_cat_' . $pseudocatid . '","hide_cat_' . $pseudocatid . '"); }) //]]> </script>'; } echo ' <hr /> <h3>' . adm_translate("Ajouter un Téléchargement") . '</h3> <form action="admin.php" method="post" name="adminForm"> <div class="form-group row"> <label class="form-control-label col-sm-4" for="durl">' . adm_translate("Télécharger URL") . '</label> <div class="col-sm-8"> <input class="form-control" type="text" id="durl" name="durl" maxlength="255" required="required" /> <a href="javascript:void(0);" onclick="window.open(\'admin.php?op=FileManagerDisplay\', \'wdir\', \'width=650, height=450, menubar=no, location=no, directories=no, status=no, copyhistory=no, toolbar=no, scrollbars=yes, resizable=yes\');"> <span class="">[' . adm_translate("Parcourir") . ']</span></a> <span class="help-block text-xs-right"><span id="countcar_durl"></span></span> </div> </div> <div class="form-group row"> <label class="form-control-label col-sm-4" for="dcounter">' . adm_translate("Compteur") . '</label> <div class="col-sm-8"> <input class="form-control" type="number" name="dcounter" maxlength="30" /> </div> </div> <div class="form-group row"> <label class="form-control-label col-sm-4" for="dfilename">' . adm_translate("Nom de fichier") . '</label> <div class="col-sm-8"> <input class="form-control" type="text" id="dfilename" name="dfilename" maxlength="255" required="required" /> <span class="help-block text-xs-right"><span id="countcar_dfilename"></span></span> </div> </div> <div class="form-group row"> <label class="form-control-label col-sm-4" for="dver">' . adm_translate("Version") . '</label> <div class="col-sm-8"> <input class="form-control" type="text" name="dver" id="dver" maxlength="6" /> <span class="help-block text-xs-right"><span id="countcar_dver"></span></span> </div> </div> <div class="form-group row"> <label class="form-control-label col-sm-4" for="dfilesize">' . adm_translate("Taille de fichier") . ' (bytes)</label> <div class="col-sm-8"> <input class="form-control" type="text" name="dfilesize" maxlength="31" /> </div> </div> <div class="form-group row"> <label class="form-control-label col-sm-4" for="dweb">' . adm_translate("Propriétaire de la page Web") . '</label> <div class="col-sm-8"> <input class="form-control" type="text" id="dweb" name="dweb" maxlength="255" /> <span class="help-block text-xs-right"><span id="countcar_dweb"></span></span> </div> </div> <div class="form-group row"> <label class="form-control-label col-sm-4" for="duser">' . adm_translate("Propriétaire") . '</label> <div class="col-sm-8"> <input class="form-control" type="text" id="duser" name="duser" maxlength="30" /> <span class="help-block text-xs-right"><span id="countcar_duser"></span></span> </div> </div> <div class="form-group row"> <label class="form-control-label col-sm-4" for="dcategory">' . adm_translate("Catégorie") . '</label> <div class="col-sm-8"> <input class="form-control" type="text" id="dcategory" name="dcategory" maxlength="250" /> <span class="help-block text-xs-right"><span id="countcar_dcategory"></span></span> <select class="custom-select form-control" name="sdcategory">'; $result = sql_query("SELECT DISTINCT dcategory FROM " . $NPDS_Prefix . "downloads ORDER BY dcategory"); while (list($dcategory) = sql_fetch_row($result)) { $dcategory = stripslashes($dcategory); echo ' <option ' . $sel . ' value="' . $dcategory . '">' . aff_langue($dcategory) . '</option>'; } echo ' </select> </div> </div> <div class="form-group row"> <label class="form-control-label col-sm-12" for="xtext">' . adm_translate("Description") . '</label> <div class="col-sm-12"> <textarea class="tin form-control" name="xtext" rows="20" ></textarea> </div> </div> ' . aff_editeur('xtext', '') . ' <fieldset> <legend>' . adm_translate("Droits") . '</legend>'; droits(''); echo ' </fieldset> <input type="hidden" name="op" value="DownloadAdd" /> <div class="form-group row"> <div class="col-sm-12"> <input class="btn btn-primary" type="submit" value="' . adm_translate("Ajouter") . '" /> </div> </div> </form> <script type="text/javascript"> //<![CDATA[ $(document).ready(function() { inpandfieldlen("durl",255); inpandfieldlen("dfilename",255); inpandfieldlen("dver",6); inpandfieldlen("dfilesize",31); inpandfieldlen("dweb",255); inpandfieldlen("duser",30); inpandfieldlen("dcategory",250); }); //]]> </script>'; adminfoot('fv', '', '', ''); }
public function newdir() { if ($_REQUEST['newdir']) { $newdir = $_REQUEST['newdir'] ? $_REQUEST['newdir'] : ''; if (substr($newdir, 0, 1) == "/") { $newdir = substr($newdir, 1, strlen($newdir)); } //在传入前去掉前置的"/"; $result = FileManagement::NewDir($newdir); if ($result == 1) { $this->success("文件夹新建成功"); } else { $this->error("文件夹新建失败"); } } else { $this->display(); } }