codes****@googl*****
codes****@googl*****
2008年 9月 22日 (月) 15:50:24 JST
Author: tsuchi000 Date: Sun Sep 21 23:48:51 2008 New Revision: 684 Added: trunk/plugins/filemgmt/ trunk/plugins/filemgmt/admin/ trunk/plugins/filemgmt/admin/index.php trunk/plugins/filemgmt/admin/install.php trunk/plugins/filemgmt/config.php trunk/plugins/filemgmt/filemgmt.php trunk/plugins/filemgmt/functions.inc trunk/plugins/filemgmt/history trunk/plugins/filemgmt/language/ trunk/plugins/filemgmt/language/english.php trunk/plugins/filemgmt/language/japanese.php trunk/plugins/filemgmt/language/japanese_utf-8.php trunk/plugins/filemgmt/public_html/ trunk/plugins/filemgmt/public_html/brokenfile.php trunk/plugins/filemgmt/public_html/downloadhistory.php trunk/plugins/filemgmt/public_html/images/ trunk/plugins/filemgmt/public_html/images/Thumbs.db (contents, props changed) trunk/plugins/filemgmt/public_html/images/arrow.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/bul1a.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/bul42.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/button.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/counter.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/decs.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/delete.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/dl.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/dot1.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/down.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/download.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/editicon.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/filemgmt.jpg (contents, props changed) trunk/plugins/filemgmt/public_html/images/floder.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/home.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/newred.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/platform.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/pop.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/screenshoticon.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/size.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/speck.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/time.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/up.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/update.gif (contents, props changed) trunk/plugins/filemgmt/public_html/images/ver.gif (contents, props changed) trunk/plugins/filemgmt/public_html/include/ trunk/plugins/filemgmt/public_html/include/dlformat.php trunk/plugins/filemgmt/public_html/include/errorhandler.php trunk/plugins/filemgmt/public_html/include/functions.php trunk/plugins/filemgmt/public_html/include/header.php trunk/plugins/filemgmt/public_html/include/textsanitizer.php trunk/plugins/filemgmt/public_html/include/xoopstree.php trunk/plugins/filemgmt/public_html/index.php trunk/plugins/filemgmt/public_html/ratefile.php trunk/plugins/filemgmt/public_html/singlefile.php trunk/plugins/filemgmt/public_html/submit.php trunk/plugins/filemgmt/public_html/viewcat.php trunk/plugins/filemgmt/public_html/visit.php trunk/plugins/filemgmt/readme.htm trunk/plugins/filemgmt/sql/ trunk/plugins/filemgmt/sql/filemgmt_sql_install.php trunk/plugins/filemgmt/templates/ trunk/plugins/filemgmt/templates/admin.html trunk/plugins/filemgmt/templates/admin.txt trunk/plugins/filemgmt/templates/blank.html trunk/plugins/filemgmt/templates/filelisting.thtml trunk/plugins/filemgmt/templates/filelisting_category.thtml trunk/plugins/filemgmt/templates/filelisting_record.thtml trunk/plugins/filemgmt/templates/filelisting_subcategory.thtml trunk/plugins/filemgmt/templates/index.html trunk/plugins/filemgmt/templates/index.txt trunk/plugins/filemgmt/templates/install.thtml trunk/plugins/filemgmt/templates/install.txt trunk/plugins/filemgmt/templates/sortmenu.thtml trunk/plugins/filemgmt/update_20080917.html Log: filemgmt_1.5.3jp_1.5 追加 Added: trunk/plugins/filemgmt/admin/index.php ============================================================================== --- (empty file) +++ trunk/plugins/filemgmt/admin/index.php Sun Sep 21 23:48:51 2008 @@ -0,0 +1,1547 @@ +<?php + +/* Reminder: always indent with 4 spaces (no tabs). */ +// +-------------------------------------------------------------------------+ +// | File Management Plugin for Geeklog - by portalparts www.portalparts.com | +// | File: index.php | +// | Main admin script | +// +-------------------------------------------------------------------------+ +// | Filemgmt plugin - version 1.5 | +// | Date: Mar 18, 2006 | +// +-------------------------------------------------------------------------+ +// | Copyright (C) 2004 by Consult4Hire Inc. | +// | | +// | Author: | +// | Blaine Lang - blain****@porta***** | +// +-------------------------------------------------------------------------+ +// | | +// | This program is free software; you can redistribute it and/or | +// | modify it under the terms of the GNU General Public License | +// | as published by the Free Software Foundation; either version 2 | +// | of the License, or (at your option) any later version. | +// | | +// | This program is distributed in the hope that it will be useful, | +// | but WITHOUT ANY WARRANTY; without even the implied warranty of | +// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | +// | See the GNU General Public License for more details. | +// | | +// | You should have received a copy of the GNU General Public License | +// | along with this program; if not, write to the Free Software Foundation, | +// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | +// | | +// +-------------------------------------------------------------------------+ +// +//@@@@@20080917 CSRF checks + +require_once("../../../lib-common.php"); +include_once($_CONF[path_html]."filemgmt/include/header.php"); +include_once($_CONF[path_html]."filemgmt/include/functions.php"); +include_once($_CONF[path_html]."filemgmt/include/xoopstree.php"); +include_once($_CONF[path_html]."filemgmt/include/textsanitizer.php"); +include_once($_CONF[path_html]."filemgmt/include/errorhandler.php"); +include_once($_CONF[path]."system/classes/navbar.class.php"); + +$op = COM_applyFilter($_REQUEST['op']); +$display = ''; +if (!SEC_hasRights('filemgmt.edit')) { + if ($op != 'comment') { + $display .= COM_siteHeader('menu'); + $display .= COM_startBlock(_GL_ERRORNOACCESS); + $display .= _MD_USER." ".$_USER['username']. " " ._GL_NOUSERACCESS; + $display .= COM_endBlock(); + $display .= COM_siteFooter(); + echo $display; + exit; + } +} + +function filemgmt_navbar($selected='') { + global $_CONF,$LANG_FM02,$_FM_TABLES; + + $result = DB_query("SELECT COUNT(*) FROM {$_FM_TABLES['filemgmt_brokenlinks']}"); + list($totalbrokendownloads) = DB_fetchARRAY($result); + if($totalbrokendownloads > 0){ + $totalbrokendownloads = "<font color=\"#ff0000\"><b>$totalbrokendownloads</b></font>"; + } + $result = DB_query("SELECT COUNT(*) FROM {$_FM_TABLES['filemgmt_filedetail']} WHERE status=0"); + list($totalnewdownloads) = DB_fetchARRAY($result); + if($totalnewdownloads > 0){ + $totalnewdownloads = "<font color=\"#ff0000\"><b>$totalnewdownloads</b></font>"; + } + + $navbar = new navbar; + $navbar->add_menuitem($LANG_FM02['nav1'],$_CONF['site_admin_url'] .'/plugins/filemgmt/index.php?op=filemgmtConfigAdmin'); + $navbar->add_menuitem($LANG_FM02['nav2'],$_CONF['site_admin_url'] .'/plugins/filemgmt/index.php?op=categoryConfigAdmin'); + $navbar->add_menuitem($LANG_FM02['nav3'],$_CONF['site_admin_url'] .'/plugins/filemgmt/index.php?op=newfileConfigAdmin'); + $navbar->add_menuitem(sprintf($LANG_FM02['nav4'],$totalnewdownloads),$_CONF['site_admin_url'] .'/plugins/filemgmt/index.php?op=listNewDownloads'); + $navbar->add_menuitem(sprintf($LANG_FM02['nav5'],$totalbrokendownloads),$_CONF['site_admin_url'] .'/plugins/filemgmt/index.php?op=listBrokenDownloads'); + + if ($selected == $LANG_FM02['nav4']) { + $navbar->set_selected(sprintf($LANG_FM02['nav4'],$totalnewdownloads)); + } elseif ($selected == $LANG_FM02['nav5']) { + $navbar->set_selected(sprintf($LANG_FM02['nav5'],$totalbrokendownloads)); + } else { + $navbar->set_selected($selected); + } + + return $navbar->generate(); + +} + +$myts = new MyTextSanitizer; +$mytree = new XoopsTree($_DB_name,$_FM_TABLES['filemgmt_cat'],"cid","pid"); +$eh = new ErrorHandler; + +function mydownloads() { + global $_CONF,$LANG_FM02,$_FM_TABLES; + + $display = COM_siteHeader('menu'); + $display .= COM_startBlock("<b>"._MD_ADMINTITLE."</b>"); + + $display .= filemgmt_navbar(); + + $result = DB_query("SELECT COUNT(*) FROM {$_FM_TABLES['filemgmt_filedetail']} WHERE status > 0"); + list($numrows) = DB_fetchARRAY($result); + $display .= "<br><br><div style=\"text-align:center;padding:10px;\">"; + $display .= sprintf(_MD_THEREARE,$numrows); + $display .= "</div>"; + $display .= "<br>"; + $display .= COM_endBlock(); + $display .= COM_siteFooter(); + echo $display; +} + +function listNewDownloads(){ + global $_CONF,$_TABLES,$_FM_TABLES,$myts,$eh,$mytree,$filemgmt_FileStoreURL,$filemgmt_FileSnapURL,$LANG_FM02; + + // List downloads waiting for validation + $sql = "SELECT lid, cid, title, url, homepage, version, size, logourl, submitter, comments, platform "; + $sql .= "FROM {$_FM_TABLES['filemgmt_filedetail']} where status=0 ORDER BY date DESC"; + $result = DB_query($sql); + $numrows = DB_numROWS($result); + $display = COM_siteHeader('menu'); + $display .= COM_startBlock('<b>'._MD_ADMINTITLE.'</b>'); + $display .= filemgmt_navbar($LANG_FM02['nav4']); + + $i = 1; + if ($numrows > 0) { + $display .= '<table width="100%" border="0" class="plugin">'; + $display .= '<tr><td width="100%" class="pluginHeader" style="padding:5px;">' . _MD_DLSWAITING. " ($numrows)</td></tr>"; + while(list($lid, $cid, $title, $url, $homepage, $version, $size, $logourl, $submitter, $comments, $tmpnames) = DB_fetchARRAY($result)) { + $result2 = DB_query("SELECT description FROM {$_FM_TABLES['filemgmt_filedesc']} WHERE lid='$lid'"); + list($description) = DB_fetchARRAY($result2); + $title = $myts->makeTboxData4Edit($title); + $url = rawurldecode($myts->makeTboxData4Edit($url)); + $logourl = rawurldecode($myts->makeTboxData4Edit($logourl)); + $homepage = $myts->makeTboxData4Edit($homepage); + $version = $myts->makeTboxData4Edit($version); + $size = $myts->makeTboxData4Edit($size); + $description = $myts->makeTareaData4Edit($description); + $tmpfilenames = explode(";",$tmpnames); + $tempfileurl = $filemgmt_FileStoreURL . 'tmp/' .$tmpfilenames[0]; + if (isset($tmpfilenames[1]) and $tmpfilenames[1] != '') { + $tempsnapurl = $filemgmt_FileSnapURL . 'tmp/' .$tmpfilenames[1]; + } else { + $tempsnapurl = ''; + } + $display .= '<tr><td>'; + $display .= '<form action="index.php" method="post" enctype="multipart/form-data" style="margin:0px;">'; + $display .= '<table width="100%" border="0" class="plugin">'; + $display .= '<tr><td align="right" nowrap>'._MD_SUBMITTER.'</td><td>'; + $display .= '<a href="'. $_CONF['site_url'] . '/users.php?mode=profile&uid='. $submitter. '">'.COM_getDisplayName ($submitter).'</a>'; + $display .= '</td></tr>'; + $display .= '<tr><td align="right" nowrap>'._MD_FILETITLE.'</td><td>'; + $display .= '<input type="text" name="title" size="50" maxlength="100" value="'.$title.'">'; + $display .= '</td></tr><tr><td align="right" nowrap>'._MD_DLFILENAME.'</td><td>'; + $display .= '<input type="text" name="url" size="50" maxlength="250" value="'.$url.'">'; + $display .= '</td></tr>'; + $display .= '<tr><td align="right" nowrap>'._MD_CATEGORYC.'</td><td>'; + $display .= $mytree->makeMySelBox('title', 'title', $cid); + $display .= '</td></tr>'; + $display .= '<tr><td align="right" nowrap>'._MD_HOMEPAGEC.'</td><td>'; + $display .= '<input type="text" name="homepage" size="50" maxlength="100" value="'.$homepage.'"></td></tr>'; + $display .= '<tr><td align="right">'._MD_VERSIONC.'</td><td>'; + $display .= '<input type="text" name="version" size="10" maxlength="10" value="'.$version.'"></td></tr>'; + $display .= '<tr><td align="right">'._MD_FILESIZEC.'</td><td>'; + $display .= '<input type="text" name="size" size="10" maxlength="8" value="'.$size.'"> '._MD_BYTES.'</td></tr>'; + $display .= '<tr><td align="right" valign="top" nowrap>'._MD_DESCRIPTIONC.'</td><td>'; + $display .= '<textarea name=description cols="60" rows="5">'.$description.'</textarea>'; + $display .= '</td></tr>'; + $display .= '<tr><td align="right" nowrap>'._MD_SHOTIMAGE.'</td><td>'; + $display .= '<input type="text" name="logourl" size="50" maxlength="250" value="'.$logourl.'">'; + if ($tempsnapurl != '') { + $display .= '<span style="padding-left:20px;"><a href="' . $tempsnapurl . '">Preview</a></span>'; + } + $display .= '</td></tr>'; + $display .= '<tr><td></td><td>'; + $display .= '</td></tr><tr><td nowrap align="right">'._MD_COMMENTOPTION.'</td><td>'; + if ($comments) { + $display .= '<INPUT TYPE="RADIO" NAME="commentoption" VALUE="1" CHECKED> ' ._MD_YES.' </INPUT>'; + $display .= '<INPUT TYPE="RADIO" NAME="commentoption" VALUE="0" > ' ._MD_NO.' </INPUT>'; + } else { + $display .= '<INPUT TYPE="RADIO" NAME="commentoption" VALUE="1" > ' ._MD_YES.' </INPUT>'; + $display .= '<INPUT TYPE="RADIO" NAME="commentoption" VALUE="0" CHECKED> ' ._MD_NO.' </INPUT>'; + } + $display .= '</td></tr>'; + $display .= '<tr><td style="text-align:right;padding:10px;">'; + $display .= '<input type="submit" onClick=\'this.form.op.value="delNewDownload"\' value="Delete"></input>'; + $display .= '<input type="hidden" name="op" value=""></input>'; + $display .= '<input type="hidden" name="lid" value="'.$lid.'"></input>'; + $display .= '<span style="padding-left:10px;">'; + $display .= '<input type="submit" value="'._MD_APPROVE.'" onClick=\'this.form.op.value="approve"\'></input></span>'; + $display .= '</td><td style="padding:10px;">Download to preview: <a href="' . $tempfileurl . '">tempfile</a></td></tr>'; + if ($numrows > 1 and $i < $numrows ) { + $i++; + } + //@@@@@20080917add CSRF checks ----> + $display .= LB; + $display .= '<input type="hidden" name="'.CSRF_TOKEN.'" value="'.SEC_createToken().'"'.XHTML.'>'; + $display .= LB; + //@@@@@20080917add CSRF checks <---- + + $display .= '</table></form></td></tr>'; + } + $display .= '</table>'; + } else { + $display .= '<div style="padding:20px">' . _MD_NOSUBMITTED .'</div>'; + } + + $display .= COM_endBlock(); + $display .= COM_siteFooter(); + echo $display; +} + + +function categoryConfigAdmin(){ + global $_CONF, $_TABLES, $LANG_FM02, $_FM_TABLES, $myts, $eh, $mytree; + + $display = COM_siteHeader('menu'); + $display .= COM_startBlock("<b>"._MD_ADMINTITLE."</b>"); + $display .= filemgmt_navbar($LANG_FM02['nav2']); + $display .= '<table width="100%" cellpadding="0" cellspacing="0"><tr><td width="100%">'; + $display .= '<form action="index.php" method="post" enctype="multipart/form-data" style="margin:0px;">'; + $display .= '<table width="100%" border="0" class="plugin">'; + $display .= '<tr><td colspan="2" width="100%" class="pluginHeader" style="padding:5px;">' . _MD_ADDMAIN . '</td></tr>'; + $display .= '<tr><td>' . _MD_TITLEC. '</td><td><input type=text name=title size=30 maxlength=50></td></tr>'; + $display .= '<tr><td>' . _MD_CATSEC. '</td><td><select name="sel_access">'; + $display .= COM_optionList($_TABLES['groups'], "grp_id,grp_name") . '</select></td></tr>'; + $display .= '<tr><td>'. _MD_ADDCATEGORYSNAP . '<br><span style="text-size:-2">'. _MD_ADDIMAGENOTE .'</span></td>'; + $display .= '<td><input type="file" name="uploadfile" size="50" maxlength="200"></td></tr>'; + $display .= '<tr><td colspan="2" style="text-align:center;padding:10px;">'; + $display .= "<input type=hidden name=cid value=0>\n"; + $display .= "<input type=hidden name=op value=addCat>"; + //@@@@@20080917add CSRF checks ----> + $wk_token=SEC_createToken(); + $display .= LB; + $display .= '<input type="hidden" name="'.CSRF_TOKEN.'" value="'.$wk_token.'"'.XHTML.'>'; + $display .= LB; + //@@@@@20080917add CSRF checks <---- + + $display .= "<input type=submit value="._MD_ADD."></td></tr></table><br></form>"; + + // Add a New Sub-Category + $result = DB_query("SELECT COUNT(*) FROM {$_FM_TABLES['filemgmt_cat']}"); + $numrows = DB_numROWS($result); + if($numrows > 0) { + $display .= '</td></tr><tr><td>'; + $display .= '<form method="post" action="index.php" style="margin:0px;">'; + $display .= '<table width="100%" border="0" class="plugin">'; + $display .= '<tr><td colspan="2" width="100%" class="pluginHeader" style="padding:5px;">' . _MD_ADDSUB . '</td></tr>'; + + $display .= '<tr><td width="20%">'. _MD_TITLEC.'</td><td><input type="text" name="title" size="30" maxlength="50"> ' ._MD_IN. ' '; + $display .= $mytree->makeMySelBox('title', 'title') . '</td></tr>'; + $display .= '<tr><td colspan="2" style="text-align:center;padding:10px;">'; + $display .= '<input type="hidden" name="op" value="addCat">'; + //@@@@@20080917add CSRF checks ----> + $display .= LB; + $display .= '<input type="hidden" name="'.CSRF_TOKEN.'" value="'.$wk_token.'"'.XHTML.'>'; + $display .= LB; + //@@@@@20080917add CSRF checks <---- + + $display .= "<input type=submit value="._MD_ADD."></td></tr></table><br></form>"; + // Modify Category + $display .= '</td></tr><tr><td>'; + $display .= '<form method="post" action="index.php" style="margin:0px;">'; + $display .= '<table width="100%" border="0" class="plugin">'; + $display .= '<tr><td colspan="2" width="100%" class="pluginHeader" style="padding:5px;">' . _MD_MODCAT . '</td></tr>'; + $display .= '<tr><td width="20%">'. _MD_CATEGORYC .'</td><td>'; + $display .= $mytree->makeMySelBox('title', 'title') . '</td></tr>'; + $display .= '<tr><td colspan="2" style="text-align:center;padding:10px;">'; + $display .= '<input type="hidden" name="op" value="modCat">'; + //@@@@@20080917add CSRF checks ----> + $display .= LB; + $display .= '<input type="hidden" name="'.CSRF_TOKEN.'" value="'.$wk_token.'"'.XHTML.'>'; + $display .= LB; + //@@@@@20080917add CSRF checks <---- + + $display .= "<input type=submit value="._MD_MODIFY."></td></tr></table><br></form>"; + } + $display .= '</td></tr></table>'; + + $display .= COM_endBlock(); + $display .= COM_siteFooter(); + echo $display; + +} + +function newfileConfigAdmin(){ + global $_CONF,$myts,$eh,$mytree,$LANG_FM02; + + $display = COM_siteHeader('menu'); + $display .= COM_startBlock("<b>"._MD_ADMINTITLE."</b>"); + $display .= filemgmt_navbar($LANG_FM02['nav3']); + $display .= '<form method="POST" enctype="multipart/form-data" action="index.php" style="margin:0px;">'; + $display .= '<table width="100%" border="0" class="plugin">'; + $display .= '<tr><td colspan="2" width="100%" class="pluginHeader" style="padding:5px;">' . _MD_ADDNEWFILE . '</td></tr>'; + $display .= '<tr><td align="right">'._MD_FILETITLE.'</td><td>'; + $display .= '<input type="text" name="title" size="50" maxlength="100">'; + $display .= '</td></tr><tr><td align="right" nowrap>File:</td><td>'; + $display .= '<input type="file" name="newfile" size="50" maxlength="100">'; + $display .= '</td></tr>'; + $display .= '<tr><td align="right" nowrap>'._MD_CATEGORYC.'</td><td>'; + $display .= $mytree->makeMySelBox('title', 'title'); + $display .= '</td></tr><tr><td></td><td></td></tr>'; + $display .= '<tr><td align="right" nowrap>'._MD_HOMEPAGEC.'</td><td>'; + $display .= '<input type="text" name="homepage" size="50" maxlength="100"></td></tr>'; + $display .= '<tr><td align="right">'._MD_VERSIONC.'</td><td>'; + $display .= '<input type="text" name="version" size="10" maxlength="10"></td></tr>'; + $display .= '<tr><td align="right" valign="top" nowrap>'._MD_DESCRIPTIONC.'</td><td>'; + $display .= '<textarea name="description" cols="60" rows="5"></textarea>'; + $display .= '</td></tr>'; + $display .= '<tr><td align="right"nowrap>'._MD_SHOTIMAGE.'</td><td>'; + $display .= '<input type="file" name="newfileshot" size="50" maxlength="60"></td></tr>'; + $display .= '<tr><td align="right"></td><td>'; + $display .= '</td></tr><tr><td align="right">'._MD_COMMENTOPTION.'</td><td>'; + $display .= '<INPUT TYPE="RADIO" NAME="commentoption" VALUE="1" CHECKED> ' ._MD_YES.' </INPUT>'; + $display .= '<INPUT TYPE="RADIO" NAME="commentoption" VALUE="0" > ' ._MD_NO.' </INPUT>'; + $display .= '</td></tr>'; + $display .= '<tr><td colspan="2" style="text-align:center;padding:10px;">'; + $display .= '<input type="hidden" name="op" value="addDownload"></input>'; + $display .= '<input type="submit" class="button" value="'._MD_ADD.'"></input>'; + //@@@@@20080917add CSRF checks ----> + $display .= LB; + $display .= '<input type="hidden" name="'.CSRF_TOKEN.'" value="'.SEC_createToken().'"'.XHTML.'>'; + $display .= LB; + //@@@@@20080917add CSRF checks <---- + $display .= '</td></tr></table>'; + $display .= '</form>'; + $display .= COM_endBlock(); + $display .= COM_siteFooter(); + echo $display; + +} + +function modDownload() { + global $_CONF,$_FM_TABLES,$_USER,$myts,$eh,$mytree,$filemgmt_SnapStore,$filemgmt_FileSnapURL; + + $lid = $_GET['lid']; + $result = DB_query("SELECT cid, title, url, homepage, version, size, logourl, comments FROM {$_FM_TABLES['filemgmt_filedetail']} WHERE lid='$lid'"); + $nrows = DB_numROWS($result); + if ($nrows == 0) { + redirect_header("index.php",2,_MD_NOMATCH); + exit(); + } + + $display = COM_siteHeader('menu'); + $display .= COM_startBlock("<b>"._MD_ADMINTITLE."</b>"); + + $display .= '<form method=post enctype="multipart/form-data" action=index.php>'; + $display .= '<input type="hidden" name="op" value="modDownloadS">'; + $display .= '<input type="hidden" name="lid" value="'.$lid.'">'; + $display .= '<table width="100%" border="0" class="plugin">'; + + list($cid, $title, $url, $homepage, $version, $size, $logourl,$comments) = DB_fetchARRAY($result); + $title = $myts->makeTboxData4Edit($title); + $pathstring = "<a href=\"{$_CONF['site_url']}/filemgmt/index.php\">"._MD_MAIN."</a> : "; + $nicepath = $mytree->getNicePathFromId($cid, "title", "{$_CONF['site_url']}/filemgmt/viewcat.php?op="); + $pathstring .= $nicepath; + $pathstring .= "<a href=\"{$_CONF['site_url']}/filemgmt/index.php?id=$lid\">{$title}</a>"; + + $display .= '<tr><td colspan="3" width="100%" style="padding:5px;">' . $pathstring. '</td></tr>'; + $display .= '<tr><td colspan="3" width="100%" class="pluginHeader" style="padding:5px;">' . _MD_MODDL. '</td></tr>'; + + $url = rawurldecode($myts->makeTboxData4Edit($url)); + $homepage = $myts->makeTboxData4Edit($homepage); + $version = $myts->makeTboxData4Edit($version); + $size = $myts->makeTboxData4Edit($size); + $logourl = rawurldecode($myts->makeTboxData4Edit($logourl)); + $result2 = DB_query("SELECT description FROM {$_FM_TABLES['filemgmt_filedesc']} WHERE lid=$lid"); + list($description)=DB_fetchARRAY($result2); + $description = $myts->makeTareaData4Edit($description); + $display .= '<tr><td>'._MD_FILEID.'</td><td colspan="2"><b>'.$lid.'</b></td></tr>'; + $display .= '<tr><td>'._MD_FILETITLE.'</td><td colspan="2"><input type="text" name="title" value="'.$title.'" size="50" maxlength="200"></input></td></tr>' .LB; + $display .= '<tr><td>'._MD_DLFILENAME.'</td><td colspan="2"><input type="text" name="url" value="'.$url.'" size="50" maxlength="200"></input></td></tr>' .LB; + $display .= '<tr><td width="25%">'._MD_REPLFILENAME.'</td><td colspan="2"><input type="file" name="newfile" size="50" maxlength="200"></input></td></tr>' .LB; + $display .= '<tr><td>'._MD_HOMEPAGEC.'</td><td colspan="2"><input type="text" name="homepage" value="'.$homepage.'" size="50" maxlength="150"></input></td></tr>' .LB; + $display .= '<tr><td>'._MD_VERSIONC.'</td><td colspan="2"><input type="text" name="version" value="'.$version.'" size="10" maxlength="10"></input></td></tr>' .LB; + $display .= '<tr><td>'._MD_FILESIZEC.'</td><td colspan="2"><input type="text" name=size value="'.$size.'" size="10" maxlength="20"></input> '._MD_BYTES.'</td></tr>' .LB; + $display .= '<tr><td valign="top">'._MD_DESCRIPTIONC.'</td><td colspan="2"><textarea name="description" cols="55" rows="10">'.$description.'</textarea></td></tr>' .LB; + $display .= '<tr><td>'._MD_CATEGORYC.'</td><td colspan="2">'; + $display .= $mytree->makeMySelBox("title", "title", $cid,0,"cid"); + $display .= '</td></tr>' .LB; + + if (!empty($logourl) AND file_exists($filemgmt_SnapStore.$logourl)) { + $display .= '<tr><td>'._MD_SHOTIMAGE.'</td><td width="5%"><img src="' .$filemgmt_FileSnapURL.$logourl. '" width="80"></td>' .LB; + $display .= '<td width="35%"><input type="file" size="40" name="newfileshot"><br><br><input type="checkbox" name=deletesnap> Delete</td></tr>' .LB; + } else { + $display .= '<tr><td>'._MD_SHOTIMAGE.'</td>' .LB; + $display .= '<td colspan="2"><input type="file" size="40" name="newfileshot"></td></tr>' .LB; + } + + $display .= '<tr><td>'._MD_COMMENTOPTION.'</td><td colspan="2">'; + if ($comments) { + $display .= '<INPUT TYPE="RADIO" NAME="commentoption" VALUE="1" CHECKED> '._MD_YES.' </INPUT>'; + $display .= '<INPUT TYPE="RADIO" NAME="commentoption" VALUE="0" > '._MD_NO.' </INPUT>'; + } else { + $display .= '<INPUT TYPE="RADIO" NAME="commentoption" VALUE="1" > '._MD_YES.' </INPUT>'; + $display .= '<INPUT TYPE="RADIO" NAME="commentoption" VALUE="0" CHECKED> '._MD_NO.' </INPUT>'; + } + $display .= '</td></tr>' .LB; + $display .= '<tr><td colspan="3" style="text-align:center;padding:10px;">'; + $display .= '<input type="submit" value="'._MD_SUBMIT.'"><span style="padding-left:15px;padding-right:15px;">'; + $display .= '<input type="submit" value="'._MD_DELETE.'" onClick=\'if (confirm("Delete this file ?")) {this.form.op.value="delDownload";return true}; return false\'>'; + $display .= "</span><input type=button value="._MD_CANCEL." onclick=\"javascript:history.go(-1)\">"; + //@@@@@20080917add CSRF checks ----> + $wk_token=SEC_createToken(); + $display .= LB; + $display .= '<input type="hidden" name="'.CSRF_TOKEN.'" value="'.$wk_token.'"'.XHTML.'>'; + $display .= LB; + //@@@@@20080917add CSRF checks <---- + $display .= '</td></tr></table></form>' .LB; + + + /* Display File Voting Information */ + $result5 = DB_query("SELECT COUNT(*) FROM {$_FM_TABLES['filemgmt_votedata']}"); + list ($totalvotes) = DB_fetchARRAY($result5); + + $display .= '<form method="post" action="index.php">'; + $display .= '<input type="hidden" name="op" value="">'; + $display .= '<input type="hidden" name="rid" value="">'; + $display .= '<input type="hidden" name="lid" value="'.$lid.'">'; + $display .= '<table valign="top" width="100%" class="pluginSubTable">'; + $display .= '<tr><th colspan="7">'; + if ($totalvotes == '') + $totalvotes = 0; + $display .= sprintf(_MD_DLRATINGS,$totalvotes); + $display .= '</th></tr>'; + // Show Registered Users Votes + $result5 = DB_query("SELECT ratingid, ratinguser, rating, ratinghostname, ratingtimestamp FROM {$_FM_TABLES['filemgmt_votedata']} WHERE lid='$lid' AND ratinguser != 0 ORDER BY ratingtimestamp DESC"); + $votes = DB_numROWS($result5); + $display .= '<tr><td colspan="7">'; + $display .= sprintf(_MD_REGUSERVOTES,$votes); + $display .= '</td></tr>'; + $display .= '<tr><th>'._MD_USER.'</th><th>'._MD_IP.'</th><th>'._MD_RATING.'</th><th>'._MD_USERAVG.'</th><th>'._MD_TOTALRATE.'</th><th>'._MD_DATE.'</th><th align="center">'._MD_DELETE.'</th></tr>'; + if ($votes == 0){ + $display .= '<tr><td align="center" colspan="7">'._MD_NOREGVOTES.'<br></td></tr>'; + } + $x=0; + $cssid = 1; + while(list($ratingid, $ratinguser, $rating, $ratinghostname, $ratingtimestamp)=DB_fetchARRAY($result5)) { + $formatted_date = formatTimestamp($ratingtimestamp); + + //Individual user information + $result2 = DB_query("SELECT rating FROM {$_FM_TABLES['filemgmt_votedata']} WHERE ratinguser='$ratinguser'"); + $uservotes = DB_numROWS($result2); + $useravgrating = 0; + while(list($rating2) = DB_fetchARRAY($result2)){ + $useravgrating = $useravgrating + $rating2; + } + $useravgrating = $useravgrating / $uservotes; + $useravgrating = number_format($useravgrating, 1); + $ratinguname = $_USER['username']; + $display .= "<tr class=\"pluginRow{$cssid}\"><td>$ratinguname</td><td>$ratinghostname</td><td>$rating</td>"; + $display .= "<td>$useravgrating</td><td>$uservotes</td><td>$formatted_date</td><td style=\"text-align:right;padding-right:20px;\">"; + $display .= '<input type="image" src="'.$_CONF['site_url'].'/filemgmt/images/delete.gif" '; + $display .= 'onClick=\'if (confirm("Delete this record")) {this.form.op.value="delVote";this.form.lid.value="'.$lid.'";this.form.rid.value="'.$ratingid.'";return true};return false;\' value="Delete"></input>'; + $display .= "</td></tr>\n"; + $x++; + $cssid = ($cssid == 1) ? 2 : 1; + + } + //@@@@@20080917add CSRF checks ----> + $display .= LB; + $display .= '<input type="hidden" name="'.CSRF_TOKEN.'" value="'.$wk_token.'"'.XHTML.'>'; + $display .= LB; + //@@@@@20080917add CSRF checks <---- + + $display .= '</table></form>' .LB; + // Show Unregistered Users Votes + $result5 = DB_query("SELECT ratingid, rating, ratinghostname, ratingtimestamp FROM {$_FM_TABLES['filemgmt_votedata']} WHERE lid='$lid' AND ratinguser=0 ORDER BY ratingtimestamp DESC"); + $votes = DB_numROWS($result5); + $display .= '<form method="post" action="index.php" onSubmit="alert(this.form.op.value)">'; + $display .= '<input type="hidden" name="op" value="">'; + $display .= '<input type="hidden" name="rid" value="">'; + $display .= '<input type="hidden" name="lid" value="'.$lid.'">'; + $display .= '<table valign="top" width="100%" class="pluginSubTable">'; + $display .= '<tr><th colspan="7">'; + $display .= sprintf(_MD_ANONUSERVOTES,$votes); + $display .= '</th></tr>'; + $display .= '<tr><th colspan="2">'._MD_IP.'</th><th colspan="3">'._MD_RATING.'</th><th colspan="2">'._MD_DATE.'</th></tr>'; + if ($votes == 0) { + $display .= "<tr><td colspan=\"7\" align=\"center\">" ._MD_NOUNREGVOTES."<br></td></tr>"; + } + $x=0; + $cssid = 1; + while(list($ratingid, $rating, $ratinghostname, $ratingtimestamp)=DB_fetchARRAY($result5)) { + $formatted_date = formatTimestamp($ratingtimestamp); + $display .= "<tr class=\"pluginRow{$cssid}\" style=\"vertical-align:bottom;\"><td colspan=\"2\">$ratinghostname</td><td colspan=\"3\">$rating</td>"; + $display .= "<td>$formatted_date</td><td style=\"text-align:right;padding-right:20px;\">"; + $display .= '<input type="image" src="'.$_CONF['site_url'].'/filemgmt/images/delete.gif" '; + $display .= 'onClick=\'if (confirm("Delete this record")) {this.form.op.value="delVote";this.form.lid.value="'.$lid.'";this.form.rid.value="'.$ratingid.'";return true};return false;\' value="Delete"></input>'; + $display .= "</td></tr>"; + $x++; + $cssid = ($cssid == 1) ? 2 : 1; + } + $display .= "<tr><td colspan=\"6\"> <br></td></tr>\n"; + //@@@@@20080917add CSRF checks ----> + $display .= LB; + $display .= '<input type="hidden" name="'.CSRF_TOKEN.'" value="'.$wk_token.'"'.XHTML.'>'; + $display .= LB; + //@@@@@20080917add CSRF checks <---- + $display .= "</table></form>"; + $display .= CloseTable(); + $display .= "<br>"; + $display .= COM_endBlock(); + $display .= COM_siteFooter(); + echo $display; +} + +function listBrokenDownloads() { + global $_CONF,$_TABLES,$_FM_TABLES,$LANG_FM02,$myts,$eh; + + $result = DB_query("SELECT * FROM {$_FM_TABLES['filemgmt_brokenlinks']} ORDER BY reportid"); + $totalbrokendownloads = DB_numROWS($result); + + $display = COM_siteHeader('menu'); + $display .= COM_startBlock('<b>'._MD_ADMINTITLE.'</b>'); + $display .= filemgmt_navbar($LANG_FM02['nav5']); + + if ($totalbrokendownloads==0) { + $display .= _MD_NOBROKEN; + } else { + $display .= '<form method="post" action="index.php">'; + $display .= '<input type="hidden" name="op" value="">'; + $display .= '<input type="hidden" name="lid" value="">'; + $display .= '<table width="100%" border="0" class="plugin">'; + $display .= '<tr><td colspan="5" width="100%" class="pluginHeader" style="padding:5px;">' . _MD_BROKENREPORTS. " ($totalbrokendownloads)</td></tr>"; + $display .= '<tr><td colspan="5">' . _MD_IGNOREDESC . "<br>"._MD_DELETEDESC."</td></tr>"; + $display .= '<tr class="pluginHeader"><th>'._MD_FILETITLE.'</th><th>'._MD_REPORTER.'</th>'; + $display .= '<th>'._MD_FILESUBMITTER.'</th><th>'._MD_IGNORE.'</th><th>'._MD_DELETE.'</th></tr>'; + + $cssid = 1; + while(list($reportid, $lid, $sender, $ip) = DB_fetchARRAY($result)) { + $result2 = DB_query("SELECT title, url, submitter FROM {$_FM_TABLES['filemgmt_filedetail']} WHERE lid='$lid'"); + if ($sender != 0) { + $result3 = DB_query("SELECT username, email FROM {$_TABLES['users']} WHERE uid='$sender'"); + list($sendername, $email) = DB_fetchARRAY($result3); + } + list($title, $url, $owner) = DB_fetchARRAY($result2); + $result4 = DB_query("SELECT username, email FROM {$_TABLES['users']} WHERE uid='$owner'"); + list($ownername, $owneremail) = DB_fetchARRAY($result4); + $display .= '<tr class="pluginRow'.$cssid.'"><td><a href="'.$_CONF['site_url'].'/filemgmt/visit.php?lid='.$lid.'">'.$title.'</a></td>'; + + if ($email == '') { + $display .= "<td>$sendername ($ip)"; + } else { + $display .= "<td><a href=mailto:$email>$sendername</a> ($ip)"; + } + $display .= "</td>"; + if ($owneremail == '') { + $display .= "<td>$ownername"; + } else { + $display .= "<td><a href=mailto:$owneremail>$ownername</a>"; + } + $display .= "</td><td style='text-align:center'>"; + $display .= '<input type="image" src="'.$_CONF['site_url'].'/filemgmt/images/delete.gif" '; + $display .= 'onClick=\'if (confirm("Delete this broken file report?")) {this.form.op.value="ignoreBrokenDownloads";'; + $display .= 'this.form.lid.value="'.$lid.'";return true};return false;\'">'; + $display .= "</td>"; + $display .= "<td style='text-align:center'>"; + $display .= '<input type="image" src="'.$_CONF['site_url'].'/filemgmt/images/delete.gif" '; + $display .= 'onClick=\'if (confirm("Delete the file from your repository?")) {this.form.op.value="delBrokenDownloads";'; + $display .= 'this.form.lid.value="'.$lid.'";return true};return false;\'">'; + $display .= "</td></tr>\n"; + $cssid = ($cssid == 1) ? 2 : 1; + } + //@@@@@20080917add CSRF checks ----> + $wk_token=SEC_createToken(); + $display .= LB; + $display .= '<input type="hidden" name="'.CSRF_TOKEN.'" value="'.$wk_token.'"'.XHTML.'>'; + $display .= LB; + //@@@@@20080917add CSRF checks <---- + $display .= "</table>"; + } + $display .= CloseTable(); + $display .= COM_endBlock(); + $display .= COM_siteFooter(); + echo $display; +} + +function delBrokenDownloads() { + global $_FM_TABLES,$eh; + + $lid = $_POST['lid']; + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_brokenlinks']} WHERE lid='$lid'"); + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_filedetail']} WHERE lid='$lid'"); + redirect_header("index.php?op=listBrokenDownloads",1,_MD_FILEDELETED); + exit(); +} + +function ignoreBrokenDownloads() { + global $_FM_TABLES,$eh; + + $lid = $_POST['lid']; + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_brokenlinks']} WHERE lid='$lid'"); + redirect_header("index.php?op=listBrokenDownloads",1,_MD_BROKENDELETED); + exit(); +} + +function delVote() { + global $_CONF,$_FM_TABLES,$eh; + + $rid = $_POST['rid']; + $lid = $_POST['lid']; + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_votedata']} WHERE ratingid='$rid'"); + updaterating($lid); + redirect_header("{$_CONF['site_admin_url']}/plugins/filemgmt/index.php?lid=$lid&op=modDownload",2,_MD_VOTEDELETED); + exit(); +} + + +function modDownloadS() { + global $_CONF,$_FM_TABLES,$myts,$eh,$filemgmt_SnapStore,$filemgmt_FileStore; + + $cid = $_POST["cid"]; + if (($_POST["url"]) || ($_POST["url"]!="")) { + $url = rawurlencode($myts->makeTboxData4Save($_POST['url'])); + } + + $currentfile = DB_getITEM($_FM_TABLES['filemgmt_filedetail'], 'url', "lid='{$_POST['lid']}'"); + $currentfileFQN = $filemgmt_FileStore . $myts->makeTboxData4Save(rawurldecode($currentfile)); + $newfile = rawurlencode($myts->makeTboxData4Save($_FILES['newfile']['name'])); + COM_errorLOG("Currentfilename is:'$currentfile' and new file is:'$newfile'"); + if (($newfile != '' AND $currentfile != $newfile) OR ($newfile != '' and $currentfile == '')) { + COM_errorLOG("Download file has changed"); + if (uploadNewFile($_FILES["newfile"],$filemgmt_FileStore)) { + if (file_exists($currentfileFQN) && (!is_dir($currentfileFQN))) { + $err=@unlink ($currentfileFQN); + } + $url = rawurlencode($myts->makeTboxData4Save($_FILES['newfile']['name'])); + DB_query("UPDATE {$_FM_TABLES['filemgmt_filedetail']} SET url='$url' WHERE lid='{$_POST['lid']}'"); + } + } + + $currentsnapfile = DB_getITEM($_FM_TABLES['filemgmt_filedetail'], 'logourl', "lid='{$_POST['lid']}'"); + $currentSnapFQN = $filemgmt_SnapStore . $myts->makeTboxData4Save(rawurldecode($currentsnapfile)); + $newsnapfile = rawurlencode($myts->makeTboxData4Save($_FILES['newfileshot']['name'])); + if (($newsnapfile !="" AND $currentsnapfile != $newsnapfile) OR ($newsnapfile != '' and $currentsnapfile == '')) { + //COM_errorLOG("Snap file has changed"); + if (uploadNewFile($_FILES["newfileshot"],$filemgmt_SnapStore)) { + if (file_exists($currentSnapFQN) && (!is_dir($currentSnapFQN))) { + $err=@unlink ($currentSnapFQN); + } + $logourl = rawurlencode($myts->makeTboxData4Save($_FILES['newfileshot']['name'])); + DB_query("UPDATE {$_FM_TABLES['filemgmt_filedetail']} SET logourl='$logourl' WHERE lid='{$_POST['lid']}'"); + } + } elseif(isset($_POST['deletesnap'])) { + if (file_exists($currentSnapFQN) && (!is_dir($currentSnapFQN))) { + $err=@unlink ($currentSnapFQN); + DB_query("UPDATE {$_FM_TABLES['filemgmt_filedetail']} SET logourl='' WHERE lid='{$_POST['lid']}'"); + COM_errorLOG("Delete repository snapfile:$currentSnapFQN."); + } + } + + $title = $myts->makeTboxData4Save($_POST['title']); + $homepage = $myts->makeTboxData4Save($_POST['homepage']); + $version = $myts->makeTboxData4Save($_POST['version']); + $size = $myts->makeTboxData4Save($_POST['size']); + $description = $myts->makeTareaData4Save($_POST['description']); + $commentoption = $_POST['commentoption']; + DB_query("UPDATE {$_FM_TABLES['filemgmt_filedetail']} SET cid='$cid', title='$title', url='$url', homepage='$homepage', version='$version', size='$size', status=1, date=".time().", comments='$commentoption' WHERE lid='{$_POST['lid']}'"); + DB_query("UPDATE {$_FM_TABLES['filemgmt_filedesc']} SET description='$description' WHERE lid='{$_POST['lid']}'"); + redirect_header("{$_CONF['site_url']}/filemgmt/index.php",2,_MD_DBUPDATED); + exit(); +} + +function delDownload() { + global $_FM_TABLES,$_CONF,$myts,$filemgmt_FileStore,$filemgmt_SnapStore,$eh; + + $lid = $myts->makeTboxData4Save($_POST['lid']); + $name = $myts->makeTboxData4Save(rawurldecode($_POST['url'])); + $tmpurl = rawurlencode($_POST['url']); + $tmpfile = $filemgmt_FileStore . $name; + + $result = DB_query("SELECT COUNT(*) FROM {$_FM_TABLES['filemgmt_filedetail']} WHERE url='$tmpurl'"); + list($numrows) = DB_fetchARRAY($result); + $tmpsnap = DB_getItem($_FM_TABLES['filemgmt_filedetail'],'logourl',"lid='$lid'"); + $tmpsnap = $filemgmt_SnapStore . $tmpsnap; + + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_filedetail']} WHERE lid='$lid'"); + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_filedesc']} WHERE lid='$lid'"); + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_votedata']} WHERE lid='$lid'"); + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_brokenlinks']} WHERE lid='$lid'"); + + // Check for duplicate files of the same filename (actual filename in repository) + // We don't want to delete actual file if there are more then 1 record linking to it. + // Site may be allowing more then 1 file listing to duplicate files + if ($numrows > 1) { + redirect_header("{$_CONF['site_url']}/filemgmt/index.php",2,_MD_FILENOTDELETED); + exit(); + } else { + if ($tmpfile != "" && file_exists($tmpfile) && (!is_dir($tmpfile))) { + $err=@unlink ($tmpfile); + } + if ($tmpsnap != "" && file_exists($tmpsnap) && (!is_dir($tmpsnap))) { + $err=@unlink ($tmpsnap); + } + } + redirect_header("{$_CONF['site_url']}/filemgmt/index.php",2,_MD_FILEDELETED); + exit(); +} + +function modCat() { + global $_CONF,$_TABLES,$_FM_TABLES,$myts,$eh,$mytree,$LANG_FM02; + + $cid = $_POST["cid"]; + $display = COM_siteHeader('menu'); + $display .= COM_startBlock("<b>"._MD_ADMINTITLE."</b>"); + $display .= filemgmt_navbar($LANG_FM02['nav2']); + $display .= '<form action="index.php" method="post" enctype="multipart/form-data" style="margin:0px;">'; + $display .= '<input type="hidden" name="op" value="modCatS">'; + $display .= '<input type="hidden" name="cid" value="'.$cid.'">'; + $display .= '<table width="100%" border="0" class="plugin">'; + $display .= '<tr><td colspan="2" width="100%" class="pluginHeader" style="padding:5px;">' . _MD_MODCAT . '</td></tr>'; + + $result = DB_query("SELECT pid, title, imgurl, grp_access FROM {$_FM_TABLES['filemgmt_cat']} WHERE cid='$cid'"); + list($pid,$title,$imgurl,$grp_access) = DB_fetchARRAY($result); + $title = $myts->makeTboxData4Edit($title); + $imgurl = rawurldecode($myts->makeTboxData4Edit($imgurl)); + + $display .= '<form action="index.php" method="post" enctype="multipart/form-data">'; + $display .= '<tr><td>' . _MD_TITLEC. '</td><td><input type="text" name="title" value="'.$title.'" size="51" maxlength="50"></td></tr>'; + $display .= '<tr><td>' . _MD_CATSEC. '</td><td><select name="sel_access"><option value="0">Select Access</option>'; + $display .= COM_optionList($_TABLES['groups'], "grp_id,grp_name",$grp_access) . '</select></td></tr>'; + $display .= '<tr><td>' ._MD_IMGURLMAIN. '</td><td><input type="file" name="imgurl" value="'.$imgurl.'" size="50" maxlength="100"></td></tr>'; + $display .= '<tr><td>' . _MD_PARENT. '</td><td>'; + $display .= $mytree->makeMySelBox("title", "title", $pid, 1, "pid"); + $display .= '</td></tr>'; + $display .= '<tr><td colspan="2" style="text-align:center;padding:10px;">'; + $display .= '<input type="submit" value="'._MD_SAVE.'">'; + $display .= '<input type="submit" value="'._MD_DELETE.'" onClick=\'if (confirm("Delete this file ?")) {this.form.op.value="delCat";return true}; return false\'>'; + $display .= " <input type=button value="._MD_CANCEL." onclick=\"javascript:history.go(-1)\">"; + //@@@@@20080917add CSRF checks ----> + $display .= LB; + $display .= '<input type="hidden" name="'.CSRF_TOKEN.'" value="'.SEC_createToken().'"'.XHTML.'>'; + $display .= LB; + //@@@@@20080917add CSRF checks <---- + + $display .= '</td></tr></table>'; + $display .= "</form>"; + $display .= COM_endBlock(); + $display .= COM_siteFooter(); + echo $display; +} + + +function delNewDownload() { + global $_FM_TABLES,$filemgmt_FileStore,$filemgmt_SnapCat,$filemgmt_SnapStore,$myts,$eh; + + $lid = $_POST['lid']; + if (DB_count($_FM_TABLES['filemgmt_filedetail'],'lid',$lid) == 1) { + $tmpnames = explode(";",DB_getItem($_FM_TABLES['filemgmt_filedetail'],'platform',"lid='$lid'")); + $tmpfilename = $tmpnames[0]; + $tmpshotname = $tmpnames[1]; + $tmpfilename = $filemgmt_FileStore ."tmp/" . $tmpfilename; + $tmpshotname = $filemgmt_SnapStore ."tmp/" . $tmpshotname; + + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_filedetail']} WHERE lid='$lid'"); + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_filedesc']} WHERE lid='$lid'"); + if ($tmpfilename != '' && file_exists($tmpfilename) && (!is_dir($tmpfilename))) { + $err=@unlink ($tmpfilename); + //COM_errorLOG("Delete submitted file: ".$tmpfilename." Return status of unlink is: ".$err); + } + if ($tmpshotname != '' && file_exists($tmpshotname) && (!is_dir($tmpshotename))) { + $err=@unlink ($tmpshotname); + //COM_errorLOG("Delete submitted snapshot: ".$tmpshotname." Return status of unlink is: ".$err); + } + redirect_header("index.php?op=listNewDownloads",1,_MD_FILEDELETED); + } else { + redirect_header("index.php?op=listNewDownloads",1,_MD_ERRORNOFILE); + } + exit(); +} + + + +function modCatS() { + global $_CONF,$_FM_TABLES,$myts,$eh; + + $cid = $_POST['cid']; + $sid = $_POST['pid']; + $title = $myts->makeTboxData4Save($_POST['title']); + $title = str_replace('/','/',$title); + $grp_access = $_POST['sel_access']; + if ($grp_access < 1 ) { + $grp_access = 2; // All Users Group + } + if (($_POST["imgurl"]) || ($_POST["imgurl"]!="")) { + $imgurl = $myts->makeTboxData4Save($_POST["imgurl"]); + } + DB_query("UPDATE {$_FM_TABLES['filemgmt_cat']} SET title='$title', imgurl='$imgurl', pid='$sid', grp_access='$grp_access' where cid='$cid'"); + redirect_header("{$_CONF['site_admin_url']}/plugins/filemgmt/index.php",2,_MD_DBUPDATED); + exit(); +} + +function delCat() { + global $_CONF,$_FM_TABLES,$eh, $mytree,$filemgmt_FileStore,$filemgmt_SnapCat,$filemgmt_SnapStore; + + $cid = $_POST['cid']; + //get all subcategories under the specified category + $arr=$mytree->getAllChildId($cid); + for($i=0;$i<sizeof($arr);$i++){ + //get all downloads in each subcategory + $result = DB_query("SELECT lid,url,logourl FROM {$_FM_TABLES['filemgmt_filedetail']} WHERE cid='{$arr[$i]}'"); + //now for each download, delete the text data and votes associated with the download + while(list($lid,$url,$logourl)= DB_fetchARRAY($result)){ + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_filedesc']} WHERE lid='$lid'"); + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_votedata']} WHERE lid='$lid'"); + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_filedetail']} WHERE lid='$lid'"); + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_brokenlinks']} WHERE lid='$lid'"); + $name = rawurldecode($url); + $fullname = $filemgmt_FileStore . $name; + if ($fullname !="" && file_exists($fullname) && (!is_dir($fullname))) { + $err=@unlink($fullname); + } + $name = rawurldecode($logourl); + $fullname = $filemgmt_SnapStore . $name; + if ($fullname !="" && file_exists($fullname) && (!is_dir($fullname))) { + $err=@unlink($fullname); + } + } + //all downloads for each subcategory is deleted, now delete the subcategory data + $catimage = DB_getItem($_FM_TABLES['filemgmt_cat'],'imgurl', "cid='{$arr[$i]}'"); + $catimage_filename = $filemgmt_SnapCat . $catimage; + if ($catimage != '' && file_exists($catimage_filename) && (!is_dir($catimage_filename))) { + // Check that there is only one category using this image + if (DB_count($_FM_TABLES['filemgmt_cat'],'imgurl',$catimage) == 1) { + @unlink($catimage_filename); + } + } + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_cat']} WHERE cid='{$arr[$i]}'"); + } + //all subcategory and associated data are deleted, now delete category data and its associated data + $result = DB_query("SELECT lid,url,logourl FROM {$_FM_TABLES['filemgmt_filedetail']} WHERE cid='$cid'"); + while(list($lid,$url,$logourl)= DB_fetchARRAY($result)){ + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_filedetail']} WHERE lid='$lid'"); + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_filedesc']} WHERE lid='$lid'"); + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_brokenlinks']} WHERE lid='$lid'"); + + $name = rawurldecode($url); + $fullname = $filemgmt_FileStore . $name; + if ($fullname !="" && file_exists($fullname) && (!is_dir($fullname))) { + $err=@unlink($fullname); + } + $name = rawurldecode($logourl); + $fullname = $filemgmt_SnapStore . $name; + if ($fullname != '' && file_exists($fullname) && (!is_dir($fullname))) { + $err=@unlink($fullname); + } + } + $catimage = DB_getItem($_FM_TABLES['filemgmt_cat'],'imgurl', "cid='$cid'"); + $catimage_filename = $filemgmt_SnapCat . $catimage; + if ($catimage != '' && file_exists($catimage_filename) && (!is_dir($catimage_filename))) { + // Check that there is only one category using this image + if (DB_count($_FM_TABLES['filemgmt_cat'],'imgurl',$catimage) == 1) { + @unlink($catimage_filename); + } + } + DB_query("DELETE FROM {$_FM_TABLES['filemgmt_cat']} WHERE cid='$cid'"); + redirect_header("{$_CONF['site_admin_url']}/plugins/filemgmt/index.php?op=categoryConfigAdmin",2,_MD_CATDELETED); + exit(); + +} + +function addCat() { + global $_CONF, $_FM_TABLES, $filemgmt_SnapCat,$filemgmt_SnapCatURL,$myts,$eh; + + $pid = $_POST['cid']; + $title = $_POST['title']; + $title = str_replace('/','/',$title); + $grp_access = $_POST['sel_access']; + if ($grp_access < 2) { + $grp_access = 2; + } + if ($title != '') { + $title = $myts->makeTboxData4Save($title); + if ($_FILES["uploadfile"]["name"]!="") { + $name = $_FILES["uploadfile"]['name']; // this is the real name of your file + $tmp = $_FILES["uploadfile"]['tmp_name']; // temporary name of file in temporary directory on server + $imgurl = rawurlencode($myts->makeTboxData4Save($name)); + if (is_uploaded_file ($tmp)) { // is this temporary file really uploaded? + if(!file_exists($filemgmt_SnapCat.$name)) { // Check to see the file already exists + $target = $filemgmt_SnapCat.$name; + $returnMove = move_uploaded_file($tmp, $target); // move temporary file to your upload directory + } + } + } + DB_query("INSERT INTO {$_FM_TABLES['filemgmt_cat']} (pid, title, imgurl,grp_access) VALUES ('$pid', '$title', '$imgurl','$grp_access')"); + } + redirect_header("{$_CONF['site_admin_url']}/plugins/filemgmt/index.php?op=categoryConfigAdmin",2,_MD_NEWCATADDED); + exit(); +} + +function addDownload() { + global $_CONF,$_USER,$_FM_TABLES,$filemgmt_FileStoreURL,$filemgmt_FileSnapURL,$filemgmt_FileStore,$filemgmt_SnapStore; + global $myts,$eh; + + $filename = $myts->makeTboxData4Save($_FILES['newfile']['name']); + $url = $myts->makeTboxData4Save(rawurlencode($filename)); + $snapfilename = $myts->makeTboxData4Save($_FILES['newfileshot']['name']); + $logourl = $myts->makeTboxData4Save(rawurlencode($snapfilename)); + $title = $myts->makeTboxData4Save($_POST['title']); + $homepage = $myts->makeTboxData4Save($_POST['homepage']); + $version = $myts->makeTboxData4Save($_POST['version']); + $description = $myts->makeTareaData4Save($_POST['description']); + $commentoption = $_POST['commentoption']; + $submitter = $_USER['uid']; + $size = $myts->makeTboxData4Save(intval($_FILES['newfile']['size'])); + $result = DB_query("SELECT COUNT(*) FROM {$_FM_TABLES['filemgmt_filedetail']} WHERE url='$url'"); + list($numrows) = DB_fetchARRAY($result); + $errormsg = ""; + + // Check if Title blank + if ($title=="") { + $eh->show("1104"); + } + // Check if Description blank + if ($description=="") { + $eh->show("1105"); + } + // Check if a file was uploaded + if ($_FILES['newfile']['size'] == 0) { + $eh->show("1017"); + } + + if ( !empty($_POST['cid']) ) { + $cid = $_POST['cid']; + } else { + $cid = 0; + } + + if (uploadNewFile($_FILES["newfile"],$filemgmt_FileStore)) { + $AddNewFile = true; + } + if (uploadNewFile($_FILES["newfileshot"],$filemgmt_SnapStore)) { + $AddNewFile = true; + } + + if ($AddNewFile){ + DB_query("INSERT INTO {$_FM_TABLES['filemgmt_filedetail']} (cid, title, url, homepage, version, size, logourl, submitter, status, date, hits, rating, votes, comments) VALUES ('$cid', '$title', '$url', '$homepage', '$version', '$size', '$logourl', '$submitter', 1, ".time().", 0, 0, 0,'$commentoption')"); + $newid = DB_insertID(); + DB_query("INSERT INTO {$_FM_TABLES['filemgmt_filedesc']} (lid, description) VALUES ($newid, '$description')"); + if ($duplicatefile) { + redirect_header("{$_CONF['site_admin_url']}/plugins/filemgmt/index.php",2,_MD_NEWDLADDED_DUPFILE); + } elseif ($duplicatesnap) { + redirect_header("{$_CONF['site_admin_url']}/plugins/filemgmt/index.php",2,_MD_NEWDLADDED_DUPSNAP); + } else { + redirect_header("{$_CONF['site_admin_url']}/plugins/filemgmt/index.php",2,_MD_NEWDLADDED); + } + exit(); + + } else { + redirect_header("index.php",2,_MD_ERRUPLOAD.""); + exit(); + } + +} + + +function approve(){ + global $_FM_TABLES,$_TABLES,$_CONF,$myts,$eh,$filemgmt_FileStore,$filemgmt_SnapStore,$filemgmt_Emailoption,$filemgmtFilePermissions; + + $lid = $_POST['lid']; + $title = $_POST['title']; + $cid = $_POST['cid']; + if ( empty($cid) ) { + $cid = 0; + } + $homepage = $_POST['homepage']; + $version = $_POST['version']; + $size = $_POST['size']; + $description = $_POST['description']; + if (($_POST['url']) || ($_POST['url'] != '')) { + $name = $myts->makeTboxData4Save($_POST['url']); + $url = rawurlencode($name); + } + if (($_POST['logourl']) || ($_POST['logourl'] != '')) { + $shotname = $myts->makeTboxData4Save($_POST['logourl']); + $logourl = $myts->makeTboxData4Save(rawurlencode($_POST['logourl'])); + } + + $result = DB_query("SELECT COUNT(*) FROM {$_FM_TABLES['filemgmt_filedetail']} WHERE url='$url' and status=1"); + list($numrows) = DB_fetchARRAY($result); + + // Comment out this check if you want to allow duplicate filelistings for same file in the repository + // Check for duplicate files of the same filename (actual filename in repository) + if ($numrows>0) { + $eh->show("1108"); + } + + $title = $myts->makeTboxData4Save($title); + $homepage = $myts->makeTboxData4Save($homepage); + $version = $myts->makeTboxData4Save($_POST['version']); + $size = $myts->makeTboxData4Save($_POST['size']); + $description = $myts->makeTareaData4Save($description); + $commentoption = $_POST["commentoption"]; + + // Move file from tmp directory under the document filestore to the main file directory + // Now to extract the temporary names for both the file and optional thumbnail. I've used th platform field which I'm not using now for anything. + $tmpnames = explode(";",DB_getItem($_FM_TABLES['filemgmt_filedetail'],'platform',"lid='$lid'")); + $tmpfilename = $tmpnames[0]; + $tmpshotname = $tmpnames[1]; + $tmp = $filemgmt_FileStore ."tmp/" . $tmpfilename; + if (file_exists($tmp) && (!is_dir($tmp))) { // if this temporary file was really uploaded? + $newfile = $filemgmt_FileStore .$name; + COM_errorLOG("File move from ".$tmp. " to " .$newfile ); + $rename = @rename ($tmp,$newfile); + COM_errorLOG("Results of rename is: ".$rename); + $chown = @chmod ($newfile,$filemgmtFilePermissions); + if (!file_exists($newfile )) { + COM_errorLOG("Filemgmt upload approve error: New file does not exist after move of tmp file: '".$newfile ."'"); + $AddNewFile = false; // Set false again - in case it was set true above for actual file + $eh->show("1101"); + } else { + $AddNewFile = true; + } + } else { + COM_errorLOG("Filemgmt upload approve error: Temporary file does not exist: '".$tmp ."'"); + $eh->show("1101"); + } + + if ($tmpshotname !="") { + $tmp = $filemgmt_SnapStore ."tmp/" . $tmpshotname; + if (file_exists($tmp) && (!is_dir($tmp))) { // if this temporary Thumbnail was really uploaded? + $newfile = $filemgmt_SnapStore .$shotname; + $rename = @rename ($tmp,$newfile); + $chown = @chmod ($newfile,$filemgmtFilePermissions); + if (!file_exists($newfile )) { + COM_errorLOG("Filemgmt upload approve error: New file does not exist after move of tmp file: '".$newfile ."'"); + $AddNewFile = false; // Set false again - in case it was set true above for actual file + $eh->show("1101"); + } + } else { + COM_errorLOG("Filemgmt upload approve error: Temporary file does not exist: '".$tmp ."'"); + $eh->show("1101"); + } + } + if ($AddNewFile) { + DB_query("UPDATE {$_FM_TABLES['filemgmt_filedetail']} SET cid='$cid', title='$title', url='$url', homepage='$homepage', version='$version', size='$size', logourl='$logourl', status=1, date=".time() .", comments='$commentoption' where lid='$lid'"); + DB_query("UPDATE {$_FM_TABLES['filemgmt_filedesc']} SET description='$description' where lid='$lid'"); + + // Send a email to submitter notifying them that file was approved + if ($filemgmt_Emailoption) { + $result = DB_query("SELECT username, email FROM {$_TABLES['users']} a, {$_FM_TABLES['filemgmt_filedetail']} b WHERE a.uid=b.submitter and b.lid='$lid'"); + list ($submitter_name, $emailaddress) = DB_fetchARRAY($result); + $mailtext = sprintf(_MD_HELLO,$submitter_name); + $mailtext .= ",\n\n" ._MD_WEAPPROVED. " " .$title. " \n" ._MD_THANKSSUBMIT. "\n\n"; + $mailtext .= "{$_CONF["site_name"]}\n"; + $mailtext .= "{$_CONF['site_url']}\n"; + //COM_errorLOG("email: ".$emailaddress.", text: ".$mailtext); + if (function_exists(COM_mail) ) { + COM_mail($emailaddress,_MD_APPROVED,$mailtext); + } else { + mail($emailaddress ,"{$_CONF["site_name"]}: " . _MD_UPLOADAPPROVED ,$mailtext, "From: {$_CONF["site_name"]} <{$_CONF["site_mail"]}>\nReturn-Path: <{$_CONF["site_mail"]}>\nX-Mailer: GeekLog $VERSION" ); + } + } + } + redirect_header("{$_CONF['site_admin_url']}/plugins/filemgmt/index.php?op=listNewDownloads",2,_MD_NEWDLADDED); + exit(); +} + + +function filemgmtConfigAdmin() { + global $filemgmt_AllUserAccess, $filemgmt_AllowUserUploads,$LANG_FM02; + global $mydownloads_perpage, $mydownloads_popular, $mydownloads_newdownloads, $mydownloads_trimdesc, $mydownloads_dlreport; + global $mydownloads_selectpriv, $mydownloads_uploadselect, $mydownloads_publicpriv, $mydownloads_uploadpublic; + global $mydownloads_useshots, $mydownloads_shotwidth, $mydownloads_whatsnew, $filemgmt_Emailoption; + global $filemgmt_FileStoreURL,$filemgmt_FileSnapURL, $filemgmt_FileStore, $filemgmt_SnapStore, $filemgmt_SnapCat, $filemgmt_SnapCatURL; + + $display = COM_siteHeader('menu'); + $display .= COM_startBlock("<b>"._MD_ADMINTITLE."</b>"); + $display .= filemgmt_navbar($LANG_FM02['nav1']); + $display .= '<form action="index.php" method="post" style="margin:0px;">'; + $display .= '<table width="100%" border="0" class="plugin">'; + $display .= '<tr><td colspan="2" width="100%" class="pluginHeader" style="padding:5px;">' . _MD_GENERALSET . '</td></tr>'; + $display .= '<tr><td nowrap>' ._MD_DLSPERPAGE. '</td>'; + $display .= "<td> + <select name=xmydownloads_perpage> + <option value=$mydownloads_perpage selected>$mydownloads_perpage</option> + <option value=5>5</option> + <option value=10>10</option> + <option value=15>15</option> + <option value=20>20</option> + <option value=25>25</option> + <option value=30>30</option> + <option value=50>50</option> + </select> + </td></tr><tr><td nowrap> + "._MD_HITSPOP."</td><td> + <select name=xmydownloads_popular> + <option value=$mydownloads_popular selected>$mydownloads_popular</option> + <option value=5>5</option> + <option value=10>10</option> + <option value=20>20</option> + <option value=50>50</option> + <option value=100>100</option> + <option value=500>500</option> + <option value=1000>1000</option> + </select> + </td></tr><tr><td nowrap> + "._MD_DLSNEW."</td><td> + <select name=xmydownloads_newdownloads> + <option value=$mydownloads_newdownloads selected>$mydownloads_newdownloads</option> + <option value=10>10</option> + <option value=15>15</option> + <option value=20>20</option> + <option value=25>25</option> + <option value=30>30</option> + <option value=50>50</option> + </select><BR>"; + $display .= "</td></tr><tr><td nowrap>" . _MD_DLREPORT . " </td><td>"; + if ($mydownloads_dlreport==1) { + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_dlreport\" VALUE=\"1\" CHECKED> " ._MD_YES." </INPUT>"; + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_dlreport\" VALUE=\"0\" > " ._MD_NO." </INPUT>"; + } else { + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_dlreport\" VALUE=\"1\"> " ._MD_YES." </INPUT>"; + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_dlreport\" VALUE=\"0\" CHECKED> " ._MD_NO." </INPUT>"; + } + $display .= "</td></tr><tr><td nowrap>" . _MD_TRIMDESC . " </td><td>"; + if ($mydownloads_trimdesc==1) { + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_trimdesc\" VALUE=\"1\" CHECKED> " ._MD_YES." </INPUT>"; + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_trimdesc\" VALUE=\"0\" > " ._MD_NO." </INPUT>"; + } else { + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_trimdesc\" VALUE=\"1\"> " ._MD_YES." </INPUT>"; + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_trimdesc\" VALUE=\"0\" CHECKED> " ._MD_NO." </INPUT>"; + } + $display .= "</td></tr><tr><td nowrap>" . _MD_WHATSNEWDESC . " </td><td>"; + if ($mydownloads_whatsnew==1) { + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_whatsnew\" VALUE=\"1\" CHECKED> " ._MD_YES." </INPUT>"; + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_whatsnew\" VALUE=\"0\" > " ._MD_NO." </INPUT>"; + } else { + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_whatsnew\" VALUE=\"1\"> " ._MD_YES." </INPUT>"; + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_whatsnew\" VALUE=\"0\" CHECKED> " ._MD_NO." </INPUT>"; + } + $display .= "</td></tr><tr><td colspan=2><HR>"; + $display .= "</td></tr><tr><td nowrap>" . _MD_SELECTPRIV . " </td><td>"; + if ($mydownloads_selectpriv==1) { + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_selectpriv\" VALUE=\"1\" CHECKED> " ._MD_YES." </INPUT>"; + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_selectpriv\" VALUE=\"0\" > " ._MD_NO." </INPUT>"; + } else { + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_selectpriv\" VALUE=\"1\"> " ._MD_YES." </INPUT>"; + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_selectpriv\" VALUE=\"0\" CHECKED> " ._MD_NO." </INPUT>"; + } + $display .= "</td></tr><tr><td nowrap>" . _MD_UPLOADSELECT . " </td><td>"; + if ($mydownloads_uploadselect==1) { + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_uploadselect\" VALUE=\"1\" CHECKED> " ._MD_YES." </INPUT>"; + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_uploadselect\" VALUE=\"0\" > " ._MD_NO." </INPUT>"; + } else { + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_uploadselect\" VALUE=\"1\"> " ._MD_YES." </INPUT>"; + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_uploadselect\" VALUE=\"0\" CHECKED> " ._MD_NO." </INPUT>"; + } + $display .= "</td></tr><tr><td nowrap>" . _MD_ACCESSPRIV . " </td><td>"; + if ($mydownloads_publicpriv==1) { + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_publicpriv\" VALUE=\"1\" CHECKED> " ._MD_YES." </INPUT>"; + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_publicpriv\" VALUE=\"0\" > " ._MD_NO." </INPUT>"; + } else { + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_publicpriv\" VALUE=\"1\"> " ._MD_YES." </INPUT>"; + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_publicpriv\" VALUE=\"0\" CHECKED> " ._MD_NO." </INPUT>"; + } + $display .= "</td></tr><tr><td nowrap>" . _MD_UPLOADPUBLIC . " </td><td>"; + if ($mydownloads_uploadpublic==1) { + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_uploadpublic\" VALUE=\"1\" CHECKED> " ._MD_YES." </INPUT>"; + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_uploadpublic\" VALUE=\"0\" > " ._MD_NO." </INPUT>"; + } else { + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_uploadpublic\" VALUE=\"1\"> " ._MD_YES." </INPUT>"; + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_uploadpublic\" VALUE=\"0\" CHECKED> " ._MD_NO." </INPUT>"; + } + $display .= "</td></tr><tr><td colspan=2><HR>"; + $display .= "</td></tr><tr><td nowrap>" . _MD_USESHOTS . " </td><td>"; + if ($mydownloads_useshots==1) { + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_useshots\" VALUE=\"1\" CHECKED> " ._MD_YES." </INPUT>"; + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_useshots\" VALUE=\"0\" > " ._MD_NO." </INPUT>"; + } else { + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_useshots\" VALUE=\"1\"> " ._MD_YES." </INPUT>"; + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"xmydownloads_useshots\" VALUE=\"0\" CHECKED> " ._MD_NO." </INPUT>"; + } + $display .= "</td></tr>"; + $display .= "<tr><td nowrap>" . _MD_IMGWIDTH . " </td><td>"; + if($mydownloads_shotwidth!=""){ + $display .= "<INPUT TYPE=\"text\" size=\"10\" NAME=\"xmydownloads_shotwidth\" VALUE=\"$mydownloads_shotwidth\"></INPUT>"; + }else{ + $display .= "<INPUT TYPE=\"text\" size=\"10\" NAME=\"xmydownloads_shotwidth\" VALUE=\"140\"></INPUT>"; + } + + $display .= "</td></tr><tr><td nowrap>"._MD_EMAILOPTION."</td><td>"; + if ($filemgmt_Emailoption == true) { + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"my_emailoption\" VALUE=\"1\" CHECKED> " ._MD_YES." </INPUT>"; + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"my_emailoption\" VALUE=\"0\" > " ._MD_NO." </INPUT>"; + } else { + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"my_emailoption\" VALUE=\"1\"> " ._MD_YES." </INPUT>"; + $display .= "<INPUT TYPE=\"RADIO\" NAME=\"my_emailoption\" VALUE=\"0\" CHECKED> " ._MD_NO." </INPUT>"; + } + + $display .= "</td></tr><tr><td nowrap>Directory to store files: </td><td>"; + $display .= "<INPUT TYPE='text' size='60' maxlength='150' NAME='my_filestore' VALUE='$filemgmt_FileStore'></INPUT>"; + $display .= "</td></tr><tr><td nowrap>Directory to store file thumbnails: </td><td>"; + $display .= "<INPUT TYPE='text' size='60' maxlength='150' NAME='my_snapstore' VALUE='$filemgmt_SnapStore'></INPUT>"; + $display .= "</td></tr><tr><td nowrap>Directory to store category thumbnails: </td><td>"; + $display .= "<INPUT TYPE='text' size='60' maxlength='150' NAME='my_snapcat' VALUE='$filemgmt_SnapCat'></INPUT>"; + $display .= "</td></tr><tr><td nowrap>URL to files: </td><td>"; + $display .= "<INPUT TYPE='text' size='60' maxlength='150' NAME='my_filestoreurl' VALUE='$filemgmt_FileStoreURL'></INPUT>"; + $display .= "</td></tr><tr><td nowrap>URL to file thumbnails: </td><td>"; + $display .= "<INPUT TYPE='text' size='60' maxlength='150' NAME='my_filesnapurl' VALUE='$filemgmt_FileSnapURL'></INPUT>"; + $display .= "</td></tr><tr><td nowrap>URL to category thumbnails: </td><td>"; + $display .= "<INPUT TYPE='text' size='60' maxlength='150' NAME='my_snapcaturl' VALUE='$filemgmt_SnapCatURL'></INPUT>"; + $display .= "</td></tr>"; + $display .= '<tr><td colspan="2" style="padding:10px;text-align:center">'; + $display .= "<input type=\"hidden\" name=\"op\" value=\"filemgmtConfigChange\">"; + $display .= "<input type=\"submit\" value=\""._MD_SAVE."\">"; + $display .= " <input type=\"button\" value=\""._MD_CANCEL."\" onclick=\"javascript:history.go(-1)\">"; + //@@@@@20080917add CSRF checks ----> + $display .= LB; + $display .= '<input type="hidden" name="'.CSRF_TOKEN.'" value="'.SEC_createToken().'"'.XHTML.'>'; + $display .= LB; + //@@@@@20080917add CSRF checks <---- + + $display .= "</td></tr></table>"; + $display .= "</form>"; + $display .= COM_endBlock(); + $display .= COM_siteFooter(); + echo $display; +} + +function filemgmtConfigChange($op='') { + global $_TABLES, $_CONF; + global $filemgmt_AllUserAccess, $filemgmt_AllowUserUploads; + global $mydownloads_perpage, $mydownloads_popular, $mydownloads_newdownloads, $mydownloads_trimdesc, $mydownloads_dlreport; + global $mydownloads_selectpriv, $mydownloads_uploadselect, $mydownloads_publicpriv, $mydownloads_uploadpublic; + global $mydownloads_useshots, $mydownloads_shotwidth, $mydownloads_whatsnew, $filemgmt_Emailoption; + global $filemgmt_FileStoreURL,$filemgmt_FileSnapURL, $filemgmt_FileStore, $filemgmt_SnapStore, $filemgmt_SnapCat, $filemgmt_SnapCatURL; + + $configfile = $_CONF['path'] . 'plugins/filemgmt/filemgmt.php'; + + if ($op == 'init') { + $xmydownloads_popular = $mydownloads_popular; + $xmydownloads_newdownloads = $mydownloads_newdownloads; + $xmydownloads_perpage = $mydownloads_perpage; + $xmydownloads_dlreport = $mydownloads_dlreport; + $xmydownloads_trimdesc = $mydownloads_trimdesc; + $xmydownloads_selectpriv = $mydownloads_selectpriv; + $xmydownloads_publicpriv = $mydownloads_publicpriv; + $xmydownloads_uploadselect = $mydownloads_uploadselect; + $xmydownloads_uploadpublic = $mydownloads_uploadpublic; + $xmydownloads_useshots = $mydownloads_useshots; + $xmydownloads_shotwidth = $mydownloads_shotwidth; + $xmydownloads_whatsnew = $mydownloads_whatsnew; + $my_emailoption = $filemgmt_Emailoption; + $my_filestoreurl = $_CONF['site_url'] . '/filemgmt_data/files/'; + $my_filesnapurl = $_CONF['site_url'] . '/filemgmt_data/snaps/'; + $my_snapcaturl = $_CONF['site_url'] . '/filemgmt_data/category_snaps/'; + $my_filestore = $_CONF['path_html'] . 'filemgmt_data/files/'; + $my_snapstore = $_CONF['path_html'] . 'filemgmt_data/snaps/'; + $my_snapcat = $_CONF['path_html'] . 'filemgmt_data/category_snaps/'; + + } else { + $xmydownloads_popular = $_POST['xmydownloads_popular']; + $xmydownloads_newdownloads = $_POST['xmydownloads_newdownloads']; + $xmydownloads_perpage = $_POST['xmydownloads_perpage']; + $xmydownloads_dlreport = $_POST['xmydownloads_dlreport']; + $xmydownloads_trimdesc = $_POST['xmydownloads_trimdesc']; + $xmydownloads_selectpriv = $_POST['xmydownloads_selectpriv']; + $xmydownloads_publicpriv = $_POST['xmydownloads_publicpriv']; + $xmydownloads_uploadselect = $_POST['xmydownloads_uploadselect']; + $xmydownloads_uploadpublic = $_POST['xmydownloads_uploadpublic']; + $xmydownloads_useshots = $_POST['xmydownloads_useshots']; + $xmydownloads_shotwidth = $_POST['xmydownloads_shotwidth']; + $xmydownloads_whatsnew = $_POST['xmydownloads_whatsnew']; + $my_emailoption = $_POST['my_emailoption']; + $my_filestoreurl = $_POST['my_filestoreurl']; + $my_filesnapurl = $_POST['my_filesnapurl']; + $my_snapcaturl = $_POST['my_snapcaturl']; + $my_filestore = $_POST['my_filestore']; + $my_snapstore = $_POST['my_snapstore']; + $my_snapcat = $_POST['my_snapcat']; + } + + // Check to see if Access Priv or Upload priv have changed + // Will need to update the GL access table if they have + + $feature1_id = DB_getItem($_TABLES['features'], 'ft_id', "ft_name = 'filemgmt.user'"); + $feature2_id = DB_getItem($_TABLES['features'], 'ft_id', "ft_name = 'filemgmt.upload'"); + + if ($xmydownloads_selectpriv != $mydownloads_selectpriv ) { + // Note: assuming "Logged-in Users" group is 13 - always has been + $result = DB_query("SELECT COUNT(*) FROM {$_TABLES['access']} WHERE acc_ft_id = '$feature1_id' AND acc_grp_id = 13"); + list($nrows) = DB_fetchArray($result); + if ($xmydownloads_selectpriv == 1 && $nrows == 0) { // Enable and there is no record now + COM_errorLog('Granting Logged-In users access to filemgmt.user feature',1); + DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ('$feature1_id', 13)"); + } elseif ($xmydownloads_selectpriv == 0 && $nrows == 1) { // Disable and there is a record + COM_errorLog('Removing Logged-In users access with filemgmt.user feature',1); + DB_query("DELETE FROM {$_TABLES['access']} WHERE acc_grp_id = 13 AND acc_ft_id = '$feature1_id'"); + } + } + if ($xmydownloads_publicpriv != $mydownloads_publicpriv ) { + $result = DB_query("SELECT COUNT(*) FROM {$_TABLES['access']} WHERE acc_ft_id = '$feature1_id' AND acc_grp_id = 2"); + list($nrows) = DB_fetchArray($result); + if ($xmydownloads_publicpriv == 1 && $nrows == 0) { // Enable and there is no record now + COM_errorLog('Granting anonymous access to filemgmt.user feature',1); + DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ('$feature1_id', 2)"); + } elseif ($xmydownloads_publicpriv == 0 && $nrows == 1) { // Disable and there is a record + COM_errorLog('Removing anonymous access with filemgmt.user feature',1); + DB_query("DELETE FROM {$_TABLES['access']} WHERE acc_grp_id = 2 AND acc_ft_id = '$feature1_id'"); + } + } + if ($xmydownloads_uploadselect != $mydownloads_uploadselect ) { + // Note: assuming "Logged-in Users" group is 13 - always has been + $result = DB_query("SELECT COUNT(*) FROM {$_TABLES['access']} WHERE acc_ft_id = '$feature2_id' AND acc_grp_id = 13"); + list($nrows) = DB_fetchArray($result); + if ($xmydownloads_uploadselect == 1 && $nrows == 0) { // Enable and there is no record now + COM_errorLog('Granting Logged-In users upload privilage to filemgmt.user feature',1); + DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ('$feature2_id', 13)"); + } elseif ($xmydownloads_uploadselect == 0 && $nrows == 1) { // Disable and there is a record + COM_errorLog('Removing Logged-In users upload privilage with filemgmt.user feature',1); + DB_query("DELETE FROM {$_TABLES['access']} WHERE acc_grp_id = 13 AND acc_ft_id = '$feature2_id'"); + } + } + if ($xmydownloads_uploadpublic != $mydownloads_uploadpublic ) { + $result = DB_query("SELECT COUNT(*) FROM {$_TABLES['access']} WHERE acc_ft_id = '$feature2_id' AND acc_grp_id = 2"); + list($nrows) = DB_fetchArray($result); + if ($xmydownloads_uploadpublic == 1 && $nrows == 0) { // Enable and there is no record now + COM_errorLog('Granting anonymous upload privilage to filemgmt.user feature',1); + DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ('$feature2_id', 2)"); + } elseif ($xmydownloads_uploadpublic == 0 && $nrows == 1) { // Disable and there is a record + COM_errorLog('Removing anonymous upload privilage with filemgmt.user feature',1); + DB_query("DELETE FROM {$_TABLES['access']} WHERE acc_grp_id = 2 AND acc_ft_id = '$feature2_id'"); + } + } + + $file = fopen($configfile, "w"); + $content = ""; + $content .= "<?php\n"; + $content .= "\n"; + $content .= "\$mydownloads_popular = $xmydownloads_popular;\n"; + $content .= "\$mydownloads_newdownloads = $xmydownloads_newdownloads;\n"; + $content .= "\$mydownloads_perpage = $xmydownloads_perpage;\n"; + $content .= "\$mydownloads_trimdesc = $xmydownloads_trimdesc;\n"; + $content .= "\$mydownloads_whatsnew = $xmydownloads_whatsnew;\n"; + $content .= "\$mydownloads_dlreport = $xmydownloads_dlreport;\n"; + $content .= "\$mydownloads_selectpriv = $xmydownloads_selectpriv;\n"; + $content .= "\$mydownloads_publicpriv = $xmydownloads_publicpriv;\n"; + $content .= "\$mydownloads_uploadselect = $xmydownloads_uploadselect;\n"; + $content .= "\$mydownloads_uploadpublic = $xmydownloads_uploadpublic;\n"; + $content .= "\$mydownloads_useshots = $xmydownloads_useshots;\n"; + $content .= "\$mydownloads_shotwidth = $xmydownloads_shotwidth;\n"; + $content .= "\$filemgmt_Emailoption = $my_emailoption;\n"; + $content .= "\$filemgmt_FileStore = \"$my_filestore\";\n"; + $content .= "\$filemgmt_SnapStore = \"$my_snapstore\";\n"; + $content .= "\$filemgmt_SnapCat = \"$my_snapcat\";\n"; + $content .= "\$filemgmt_FileStoreURL = \"$my_filestoreurl\";\n"; + $content .= "\$filemgmt_FileSnapURL = \"$my_filesnapurl\";\n"; + $content .= "\$filemgmt_SnapCatURL = \"$my_snapcaturl\";\n"; + $content .= "\n"; + $content .= "?>\n"; + + fwrite($file, $content); + fclose($file); + +} + +function uploadNewFile($newfile,$directory) { + global $myts,$eh,$filemgmtDuplicatesAllowed,$filemgmtFilePermissions; + + if ($newfile["name"]!="") { + $name = $newfile['name']; // this is the real name of your file + $tmp = $newfile['tmp_name']; // temporary name of file in temporary directory on server + $name = $myts->makeTboxData4Save($name); + $logourl = rawurlencode($name); + COM_errorLOG("AddNewFileShot - Upload filename is " .$directory.$myts->makeTboxData4Save($name)); + if (is_uploaded_file ($tmp)) { // is this temporary file really uploaded? + $newfile = $directory.$name; + if(!file_exists($newfile)) { // Check to see the snapfile already exists + $returnMove = move_uploaded_file($tmp, $newfile); // move temp file to upload directory + if (!$returnMove) { + COM_errorLOG("Filemgmt File add by admin error: New file could not be created: ".$tmp." to ".$name); + $eh->show("1106"); + return false; + } else { + $chown =@chmod ($newfile,$filemgmtFilePermissions); + COM_errorLOG("File uploaded and moved ok"); + return true; + } + } else { + // Allow duplicate file names, user may want to have two filelisting to same file or has already copied the files manually + COM_errorLOG("Filemgmt - Warning: Added new filelisting for a file that already exists ". $directory.$name); + if (!$filemgmtDuplicatesAllowed) { + $eh->show("1108"); + return false; + } else { + return true; + } + } + } else { + COM_errorLOG("Filemgmt upload error: Temporary file does not exist: '".$tmp ."'"); + $eh->show("1107"); + return false; + } + } + return false; +} + + + +function filemgmt_comments($firstcomment) { + global $_USER,$_CONF; + + $comment_id = "filemgmt-".$_GET['lid']; + $file = $_GET['filename']; + if ($firstcomment) { + $story=$comment_id; + $pid=0; + $type="filemgmt"; + echo COM_refresh($_CONF['site_url'] . "/comment.php?sid=$story&pid=$pid&type=$type"); + } else { + $display = COM_siteHeader() . COM_userComments($comment_id,$file,'filemgmt','','nested'); + $display .= COM_siteFooter(); + } + echo $display; + exit(); + +} + +function filemgmt_error($errormsg) { + $display .= COM_startBlock("<b>"._MD_ADMINTITLE."</b>"); + $display .= $errormsg; + $display .= COM_endBlock(); + echo $display; + exit(); +} + + +// Check and see if the current config has values for the filemgmt repository set. +// If not - then initialize these variables and write the filemgmt.php - config file. +if ($filemgmt_FileStoreURL == '' OR $filemgmt_FileStore == '') { + // Set default values and write over the config file + filemgmtConfigChange('init'); + // Read in the new values + include ($_CONF['path'] .'plugins/filemgmt/filemgmt.php'); +} + +//@@@@@20080917add CSRF checks ----> +$op_ary[]="filemgmtConfigChange";//設定:変更を保存 +$op_ary[]="addCat";//カテゴリ:追加 +$op_ary[]="modCatS";//カテゴリ:変更を保存 +$op_ary[]="delCat";//カテゴリ:削除 +$op_ary[]="addDownload";//ファイルを追加:追加 +$op_ary[]= "approve";//ダウンロード:承認 +$op_ary[]= "delNewDownload";//ダウンロード:削除 +$op_ary[]= "ignoreBrokenDownloads";//破損ファイル:無視 +$op_ary[]= "delBrokenDownloads";//破損ファイル:承認 +$op_ary[]= "modDownloadS";//ダウンロード情報変更 :実行 +$op_ary[]= "delDownload";//ダウンロード情報変更 :削除 +$op_ary[]= "delVote";//ダウンロード評価:削除 + +//case "listBrokenDownloads"://破損ファイル +//case "modDownload"://ダウンロード情報変更 +//case "filemgmtConfigAdmin"://設定 +//case "categoryConfigAdmin"://カテゴリ +//case "newfileConfigAdmin"://ファイルを追加 +//case "listNewDownloads"://ダウンロード +//"modCat"://カテゴリ:編集 +//$op_ary[]= "comment"://** +//$op_ary[]= "addSubCat"://** + + +if (in_array($op, $op_ary)) { + if (!SEC_checkToken()){ + COM_accessLog("User {$_USER['username']} tried to illegally and failed CSRF checks. filemgmt $op"); + echo COM_refresh($_CONF['site_admin_url'].'/plugins.php'); + exit; + } +} +//@@@@@20080917add CSRF checks <---- + + +switch ($op) { + default: + mydownloads(); + break; + case "comment": + filemgmt_comments($firstcomment); + break; + case "delNewDownload": + delNewDownload(); + break; + case "addCat": + addCat(); + break; + case "addSubCat": + addSubCat(); + break; + case "addDownload": + addDownload(); + break; + case "listBrokenDownloads": + listBrokenDownloads(); + break; + case "delBrokenDownloads": + delBrokenDownloads(); + break; + case "ignoreBrokenDownloads": + ignoreBrokenDownloads(); + break; + case "approve": + approve(); + break; + case "delVote": + delVote(); + modDownload(); + break; + case "delCat": + delCat(); + break; + case "modCat": + modCat(); + break; + case "modCatS": + modCatS(); + break; + case "modDownload": + modDownload(); + break; + case "modDownloadS": + modDownloadS(); + break; + case "delDownload": + delDownload(); + break; + case "filemgmtConfigAdmin": + filemgmtConfigAdmin(); + break; + case "filemgmtConfigChange": + filemgmtConfigChange(); + redirect_header("{$_CONF['site_admin_url']}/plugins/filemgmt/index.php",2,_MD_CONFIGUPDATED); + exit(); + break; + case "categoryConfigAdmin": + categoryConfigAdmin(); + break; + case "newfileConfigAdmin": + newfileConfigAdmin(); + break; + case "listNewDownloads": + listNewDownloads(); + break; +} + +?> \ No newline at end of file Added: trunk/plugins/filemgmt/admin/install.php ============================================================================== --- (empty file) +++ trunk/plugins/filemgmt/admin/install.php Sun Sep 21 23:48:51 2008 @@ -0,0 +1,278 @@ +<?php + +// +---------------------------------------------------------------------------+ +// | Universal Plugin Install Script 1.4 for Geeklog - The Ultimate Weblog | +// +---------------------------------------------------------------------------+ +// | install.php | +// | | +// | This file installs the data structures for the FileManager plugin | +// | | +// | Install Script performs the following: | +// | 1) It creates the tables | +// | 2) It creates an admin security group for you plugin | +// | 3) It adds the security features and adds them to the admin group | +// | 4) It adds the plugin to the gl_plugins table | +// | 5) It adds any default data you have provided | +// +---------------------------------------------------------------------------+ +// | Copyright (C) 2002 by the following authors: | +// | | +// | Author: | +// | Blaine Lang (C) 2003 - blain****@porta***** | +// | Constructed with the Universal Plugin | +// | Copyright (C) 2002 by the following authors: | +// | Tom Willett - tomw****@pigst***** | +// | Blaine Lang - geekl****@langf***** | +// | The Universal Plugin is based on prior work by: | +// | Tony Bibbs - tony****@tonyb***** | +// +---------------------------------------------------------------------------+ +// | | +// | This program is free software; you can redistribute it and/or | +// | modify it under the terms of the GNU General Public License | +// | as published by the Free Software Foundation; either version 2 | +// | of the License, or (at your option) any later version. | +// | | +// | This program is distributed in the hope that it will be useful, | +// | but WITHOUT ANY WARRANTY; without even the implied warranty of | +// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | +// | GNU General Public License for more details. | +// | | +// | You should have received a copy of the GNU General Public License | +// | along with this program; if not, write to the Free Software Foundation, | +// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | +// | | +// +---------------------------------------------------------------------------+ +// +//@@@@@20080917 CSRF checks for $gl_version = '1.5' + +require_once('../../../lib-common.php'); +require_once($_CONF['path'] . 'plugins/filemgmt/config.php'); +require_once($_CONF['path'] . 'plugins/filemgmt/functions.inc'); + + +// +// Universal plugin install variables +// Change these to match your plugin +// + +$pi_name = 'filemgmt'; // Plugin name +$pi_version = $CONF_FM['version']; // Plugin Version +$gl_version = '1.5'; // GL Version plugin for @@@@@20080917 +$pi_url = 'http://www.portalparts.com'; // Plugin Homepage + + +// Default data +// Insert table name and sql to insert default data for your plugin. + +$DEFVALUES = array(); + + +$NEWFEATURE = array(); +$NEWFEATURE['filemgmt.user'] = "filemgmt Access"; +$NEWFEATURE['filemgmt.edit'] = "filemgmt Admin Rights"; +$NEWFEATURE['filemgmt.upload'] = "filemgmt File Upload Rights"; + + +/** +* Checks the requirements for this plugin and if it is compatible with this +* version of Geeklog. +* +* @return boolean true = proceed with install, false = not compatible +* +*/ +function plugin_compatible_with_this_geeklog_version () +{ + // Check for version 1.4+ + $gl_version = floatval (VERSION); + if ($gl_version >= 1.3) { + return true; + } else { + return false; + } +} + +// Only let Root users access this script +if (!SEC_inGroup('Root')) { + COM_errorLog("Someone has tried to illegally access the FileMgmt Pro install/uninstall page. User id: {$_USER['uid']}, Username: {$_USER['username']}, IP: $REMOTE_ADDR",1); + $display = COM_siteHeader(); + $display .= COM_startBlock($LANG_FM00['access_denied']); + $display .= $LANG_FM00['access_denied_msg']; + $display .= COM_endBlock(); + $display .= COM_siteFooter(true); + echo $display; + exit; +} + +/** +* Creates the datastructures for this plugin into the Geeklog database +* Note: Corresponding uninstall routine is in functions.inc +* @return boolean True if successful False otherwise +*/ + + +function plugin_install_now() +{ + global $pi_name, $pi_version, $gl_version, $pi_url, $NEWTABLE, $DEFVALUES, $NEWFEATURE; + global $_TABLES, $_CONF, $_FM_TABLES; + + COM_errorLog("Attempting to install the $pi_name Plugin",1); + $uninstall_plugin = 'plugin_uninstall_' . $pi_name; + + // Create the Plugins Tables + require_once($_CONF['path'] . 'plugins/filemgmt/sql/filemgmt_sql_install.php'); + for ($i = 1; $i <= count($_SQL); $i++) { + $progress .= "executing " . current($_SQL) . "<br>\n"; + COM_errorLOG("executing " . current($_SQL)); + DB_query(current($_SQL),'1'); + if (DB_error()) { + COM_errorLog("Error Creating $table table",1); + $uninstall_plugin ('DeletePlugin'); + return false; + exit; + } + next($_SQL); + } + COM_errorLog("Success - Created $table table",1); + + // Insert Default Data + + foreach ($DEFVALUES as $table => $sql) { + COM_errorLog("Inserting default data into $table table",1); + DB_query($sql,1); + if (DB_error()) { + COM_errorLog("Error inserting default data into $table table",1); + $uninstall_plugin (); + return false; + exit; + } + COM_errorLog("Success - inserting data into $table table",1); + } + + // Create the plugin admin security group + COM_errorLog("Attempting to create $pi_name admin group", 1); + DB_query("INSERT INTO {$_TABLES['groups']} (grp_name, grp_descr) " + . "VALUES ('$pi_name Admin', 'Users in this group can administer the $pi_name plugin')",1); + if (DB_error()) { + $uninstall_plugin (); + return false; + exit; + } + COM_errorLog('...success',1); + $group_id = DB_insertId(); + + // Save the grp id for later uninstall + COM_errorLog('About to save group_id to vars table for use during uninstall',1); + DB_query("INSERT INTO {$_TABLES['vars']} VALUES ('{$pi_name}_admingrp_id', $group_id)",1); + if (DB_error()) { + $uninstall_plugin (); + return false; + exit; + } + COM_errorLog('...success',1); + + // Add plugin Features + foreach ($NEWFEATURE as $feature => $desc) { + COM_errorLog("Adding $feature feature",1); + DB_query("INSERT INTO {$_TABLES['features']} (ft_name, ft_descr) " + . "VALUES ('$feature','$desc')",1); + if (DB_error()) { + COM_errorLog("Failure adding $feature feature",1); + $uninstall_plugin (); + return false; + exit; + } + $feat_id = DB_insertId(); + COM_errorLog("Success",1); + COM_errorLog("Adding $feature feature to admin group",1); + DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ($feat_id, $group_id)"); + if (DB_error()) { + COM_errorLog("Failure adding $feature feature to admin group",1); + $uninstall_plugin (); + return false; + exit; + } + COM_errorLog("Success",1); + } + + // OK, now give Root users access to this plugin now! NOTE: Root group should always be 1 + COM_errorLog("Attempting to give all users in Root group access to $pi_name admin group",1); + DB_query("INSERT INTO {$_TABLES['group_assignments']} VALUES ($group_id, NULL, 1)"); + if (DB_error()) { + $uninstall_plugin (); + return false; + exit; + } + + // Register the plugin with Geeklog + COM_errorLog("Registering $pi_name plugin with Geeklog", 1); + DB_delete($_TABLES['plugins'],'pi_name',$pi_name); + DB_query("INSERT INTO {$_TABLES['plugins']} (pi_name, pi_version, pi_gl_version, pi_homepage, pi_enabled) " + . "VALUES ('$pi_name', '$pi_version', '$gl_version', '$pi_url', 1)"); + + if (DB_error()) { + $uninstall_plugin (); + return false; + exit; + } + + + + COM_errorLog("Succesfully installed the $pi_name Plugin!",1); + return true; +} + + + +/* +* Main Function +*/ + +$display = ''; + +//@@@@@20080917add CSRF checks ----> +if (!SEC_checkToken()){ + COM_accessLog("User {$_USER['username']} tried to illegally and failed CSRF checks. filemgmt install"); + echo COM_refresh($_CONF['site_admin_url'].'/plugins.php'); + exit; +} +//@@@@@20080917add CSRF checks <---- + +if ($_REQUEST['action'] == 'uninstall') { + $uninstall_plugin = 'plugin_uninstall_' . $pi_name; + if ($uninstall_plugin ()) { + $display = COM_refresh ($_CONF['site_admin_url'] + . '/plugins.php?msg=45'); + } else { + $display = COM_refresh ($_CONF['site_admin_url'] + . '/plugins.php?msg=73'); + } + +} else if (DB_count ($_TABLES['plugins'], 'pi_name', $pi_name) == 0) { + // plugin not installed + if (plugin_compatible_with_this_geeklog_version ()) { + if (plugin_install_now ()) { + $display = COM_refresh ($_CONF['site_admin_url'] + . '/plugins.php?msg=44'); + } else { + $display = COM_refresh ($_CONF['site_admin_url'] + . '/plugins.php?msg=72'); + } + } else { + // plugin needs a newer version of Geeklog + $display .= COM_siteHeader ('menu', $LANG32[8]) + . COM_startBlock ($LANG32[8]) + . '<p>' . $LANG32[9] . '</p>' + . COM_endBlock () + . COM_siteFooter (); + } +} else { + // plugin already installed + $display .= COM_siteHeader ('menu', $LANG01[77]) + . COM_startBlock ($LANG32[6]) + . '<p>' . $LANG32[7] . '</p>' + . COM_endBlock () + . COM_siteFooter(); +} + +echo $display; + +?> \ No newline at end of file Added: trunk/plugins/filemgmt/config.php ============================================================================== --- (empty file) +++ trunk/plugins/filemgmt/config.php Sun Sep 21 23:48:51 2008 @@ -0,0 +1,99 @@ +<?php +// +-------------------------------------------------------------------------+ +// | File Management Plugin for Geeklog - by portalparts www.portalparts.com | +// +-------------------------------------------------------------------------+ +// | Filemgmt plugin - version 1.5 | +// | Date: Mar 18, 2006 | +// +-------------------------------------------------------------------------+ +// | Copyright (C) 2004 by Consult4Hire Inc. | +// | Author: | +// | Blaine Lang - blain****@porta***** | +// +-------------------------------------------------------------------------+ +// | This program is free software; you can redistribute it and/or | +// | modify it under the terms of the GNU General Public License | +// | as published by the Free Software Foundation; either version 2 | +// | of the License, or (at your option) any later version. | +// | | +// | This program is distributed in the hope that it will be useful, | +// | but WITHOUT ANY WARRANTY; without even the implied warranty of | +// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | +// | See the GNU General Public License for more details. | +// | | +// | You should have received a copy of the GNU General Public License | +// | along with this program; if not, write to the Free Software Foundation, | +// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | +// | | +// +-------------------------------------------------------------------------+ +// + +/* Include the Filemgmt Plugin configuration which defines Directories and URL's and options +This file is set via the Filemgmt Plugin Admin menu - Configuration settings. +The script reads and write to this file - thus needs to be a separate file. +*/ + +include ("filemgmt.php"); + +$CONF_FM['version'] = '1.5.3'; + + +$_FM_TABLES['filemgmt_cat'] = $_DB_table_prefix . 'filemgmt_category'; +$_FM_TABLES['filemgmt_filedetail'] = $_DB_table_prefix . 'filemgmt_filedetail'; +$_FM_TABLES['filemgmt_filedesc'] = $_DB_table_prefix . 'filemgmt_filedesc'; +$_FM_TABLES['filemgmt_brokenlinks'] = $_DB_table_prefix . 'filemgmt_broken'; +$_FM_TABLES['filemgmt_modreq'] = $_DB_table_prefix . 'filemgmt_mod'; +$_FM_TABLES['filemgmt_votedata'] = $_DB_table_prefix . 'filemgmt_votedata'; +$_FM_TABLES['filemgmt_history'] = $_DB_table_prefix . 'filemgmt_downloadhistory'; + +// Permissions that will be used for new files into the repository +$filemgmtFilePermissions = (int) 0755; + +// Number of days to show new files listing +$filemgmtWhatsNewPeriodDays = 14; +// String Length for Filename Titles in WhatsNewBlock +$filemgmtWhatsNewTitleLength = 20; +// Should the Whats New Block show new FileMgmt Comments +$filemgmt_showWhatsNewComments = true; + +/* Configuration for the auto-rename or reject logic when users are submitted files for approval */ +/* Map any extensions to a new extension or 'reject' if they should not be allowed */ +/* Any file type not listed will be uploaded using original file extension */ + +$_FMDOWNLOAD = array( + 'php' => 'phps', + 'pl' => 'txt', + 'cgi' => 'txt', + 'py' => 'txt', + 'sh' => 'txt', + 'exe' => 'reject' +); + +// glmenu only use - for glmenu generated menus + +$CONF_FILEMGMT['glmenutype'] = 'block'; // Set to block or header + +$_FMDOWNLOAD['inconlib'] = array( + php => "php.gif", + phps => "php.gif", + bmp => "bmp.gif", + gif => "gif.gif", + jpg => "jpg.gif", + html => "htm.gif", + htm => "htm.gif", + mov => "mov.gif", + mp3 => "mp3.gif", + pdf => "pdf.gif", + ppt => "ppt.gif", + tar => "zip.gif", + gz => "zip.gif", + zip => "zip.gif", + txt => "txt.gif", + doc => "doc.gif", + xls => "xls.gif", + mpp => "mpp.gif", + exe => "exe.gif", + swf => "swf.gif", + vsd => "visio.gif", + none => "file.gif" + ); + +?> \ No newline at end of file Added: trunk/plugins/filemgmt/filemgmt.php ============================================================================== --- (empty file) +++ trunk/plugins/filemgmt/filemgmt.php Sun Sep 21 23:48:51 2008 @@ -0,0 +1,23 @@ +<?php + +$mydownloads_popular = 20; +$mydownloads_newdownloads = 10; +$mydownloads_perpage = 5; +$mydownloads_trimdesc = 1; +$mydownloads_whatsnew = 1; +$mydownloads_dlreport = 1; +$mydownloads_selectpriv = 0; +$mydownloads_publicpriv = 1; +$mydownloads_uploadselect = 1; +$mydownloads_uploadpublic = 1; +$mydownloads_useshots = 1; +$mydownloads_shotwidth = 50; +$filemgmt_Emailoption = 1; +$filemgmt_FileStore = ""; +$filemgmt_SnapStore = ""; +$filemgmt_SnapCat = ""; +$filemgmt_FileStoreURL = ""; +$filemgmt_FileSnapURL = ""; +$filemgmt_SnapCatURL = ""; + +?> Added: trunk/plugins/filemgmt/functions.inc ============================================================================== --- (empty file) +++ trunk/plugins/filemgmt/functions.inc Sun Sep 21 23:48:51 2008 @@ -0,0 +1,885 @@ +<?php + +/* Reminder: always indent with 4 spaces (no tabs). */ +// +-------------------------------------------------------------------------+ +// | File Management Plugin for Geeklog - by portalparts www.portalparts.com | +// +-------------------------------------------------------------------------+ +// | Filemgmt plugin - version 1.5 | +// | Date: Mar 18, 2006 | +// +-------------------------------------------------------------------------+ +// | Copyright (C) 2004 by Consult4Hire Inc. | +// | Author: | +// | Blaine Lang - blain****@porta***** | +// +-------------------------------------------------------------------------+ +// | This program is free software; you can redistribute it and/or | +// | modify it under the terms of the GNU General Public License | +// | as published by the Free Software Foundation; either version 2 | +// | of the License, or (at your option) any later version. | +// | | +// | This program is distributed in the hope that it will be useful, | +// | but WITHOUT ANY WARRANTY; without even the implied warranty of | +// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | +// | See the GNU General Public License for more details. | +// | | +// | You should have received a copy of the GNU General Public License | +// | along with this program; if not, write to the Free Software Foundation, | +// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | +// | | +// +-------------------------------------------------------------------------+ +// +//@@@@@20080115,20060405,20060418 what's new mojigire + +$langfile = $_CONF['path'] . 'plugins/filemgmt/language/' . $_CONF['language'] . '.php'; +if (file_exists ($langfile)) { + include_once ($langfile); +} else { + include_once ($_CONF['path'] . 'plugins/filemgmt/language/english.php'); +} + +include($_CONF['path'] . 'plugins/filemgmt/config.php'); + + +/** +* Returns the items for this plugin that should appear on the main menu +* +* NOTE: this MUST return the url/value pairs in the following format +* $<arrayname>[<label>] = <url> +* +*/ +function plugin_getmenuitems_filemgmt() +{ + global $_CONF, $LANG_FILEMGMT; + $menuitems = array(); + $menuitems["{$LANG_FILEMGMT['downloads']}"] = $_CONF['site_url'] . "/filemgmt/index.php"; + return $menuitems; +} + + +/** +* Called by the plugin Editor to display the current plugin code version +* This may be different then the version installed and registered currently. +* If newer then you may want to run the update +*/ +function plugin_chkVersion_filemgmt() { + global $CONF_FM; + return $CONF_FM['version']; +} + + +/** +* Called by the plugin Editor to run the SQL Update for a plugin update +*/ +function plugin_upgrade_filemgmt() { + global $_TABLES,$_FM_TABLES,$CONF_FM; + + $cur_version = DB_getItem($_TABLES['plugins'],'pi_version', "pi_name='filemgmt'"); + $gl_version = floatval (VERSION); + if ($gl_version >= 1.3) { + if ($cur_version == '1.3') { + DB_query("ALTER TABLE {$_FM_TABLES['filemgmt_cat']} ADD `grp_access` mediumint(8) DEFAULT '2' NOT NULL AFTER imgurl"); + DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '{$CONF_FM['version']}' WHERE pi_name = 'filemgmt'"); + DB_query("UPDATE {$_TABLES['plugins']} SET pi_gl_version = '1.4' WHERE pi_name = 'filemgmt'"); + + // Update all the comment records + $result = DB_query("SELECT cid,sid FROM {$_TABLES['comments']} WHERE type='filemgmt'"); + while (list($cid,$sid) = DB_fetchArray($result)) { + if (strpos($sid,'fileid_') === FALSE) { + $sid = "fileid_{$sid}"; + DB_query("UPDATE {$_TABLES['comments']} SET sid='$sid' WHERE cid='$cid'"); + } + } + return true; + } elseif ($cur_version == '1.5') { + DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '{$CONF_FM['version']}' WHERE pi_name = 'filemgmt'"); + DB_query("UPDATE {$_TABLES['plugins']} SET pi_gl_version = '1.4' WHERE pi_name = 'filemgmt'"); + return true; + } elseif ($cur_version == '1.5.1') { + DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '{$CONF_FM['version']}' WHERE pi_name = 'filemgmt'"); + return true; + } elseif ($cur_version == '1.5.2') { + DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '{$CONF_FM['version']}' WHERE pi_name = 'filemgmt'"); + return true; + } else { + return 5; + } + + } else { + return 3; + } +} + + +/** + * Include if plugin will be supporting comments + * + * @author Blaine Lang blain****@porta***** + * @return boolean true indicates comments are suppported + */ +function plugin_commentsupport_filemgmt() +{ + // Filemgmt Module will use comments + return true; +} + + +/** + * Plugin function that is called after comment form is submitted. + * Needs to atleast save the comment and check return value. + * Add any additional logic your plugin may need to perform on comments. + * + * @author Blaine Lang blain****@porta***** + * @param string $title Comment title field in comment form + * @param string $comment comment text + * @param string $id Item id to which $cid belongs + * @param int $pid comment parent + * @param string $postmode 'html' or 'text' + * @return mixed HTML string (redirect?) for success or comment form if failure. + */ +function plugin_savecomment_filemgmt($title,$comment,$id,$pid,$postmode) { + global $_CONF,$_FM_TABLES, $LANG03, $_TABLES; + + $title = strip_tags ($title); + $pid = COM_applyFilter ($pid, true); + $postmode = COM_applyFilter ($postmode); + + $ret = CMT_saveComment ( $title, $comment, $id, $pid, 'filemgmt',$postmode); + + if ( $ret > 0 ) { // failure + return COM_siteHeader() + . CMT_commentform ($title, $comment, $id, $pid, + 'filemgmt', $LANG03[14], $postmode) + . COM_siteFooter(); + } else { // success + $comments = DB_count ($_TABLES['comments'], 'sid', $id); + DB_change($_FM_TABLES['filemgmt_filedetail'],'comments', $comments, 'lid',$id); + return (COM_refresh (COM_buildUrl ($_CONF['site_url'] + . "/filemgmt/index.php?id=$id")) ); + } +} + + +/** + * Plugin API to delete a comment + * + * @author Blaine Lang blain****@porta***** + * @param int $cid Comment to be deleted + * @param string $id Item id to which $cid belongs + * @return mixed false for failure, HTML string (redirect?) for success + */function plugin_deletecomment_filemgmt($cid,$id) { + global $_CONF,$_FM_TABLES, $_TABLES; + + if (SEC_hasRights("filemgmt.edit")) { + if (CMT_deleteComment($cid, $id, 'filemgmt') == 0) { + // Now redirect the program flow to the view of the file and its comments + return (COM_refresh($_CONF['site_url'] . "/filemgmt/index.php?id=$id")); + } else { + return false; + } + } else { + return false; + } +} + + +/** + * Plugin API to display a specific comment thread + * + * @author Blaine Lang blain****@porta***** + * @param string $id Unique idenifier for item comment belongs to + * @param int $commentid Comment id to display (possibly including sub-comments) + * @param string $title comment title + * @param string $order 'ASC' or 'DSC' or blank + * @param string $format 'threaded', 'nested', or 'flat' + * @param int $page Page number of comments to display + * @param boolean $view True to view comment (by cid), false to display (by $pid) + * @return mixed results of calling the CMT_userComments function + */ +function plugin_displaycomment_filemgmt($id,$commentid,$title,$order,$format,$page,$view) { + global $LANG_FILEMGMT, $_TABLES, $_FM_TABLES, $_CONF, $LANG01; + + $id = str_replace('fileid_','',$id); + /* Plugin specific code to display relevant content above the comment thread */ + /* Example: Display the file details */ + include($_CONF['path_html'] ."filemgmt/include/functions.php"); + include_once($_CONF[path_html]. "filemgmt/include/xoopstree.php"); + include_once($_CONF[path_html]. "filemgmt/include/textsanitizer.php"); + + $comments = true; // Checked in filemgmt code in dlformat.php + + $myts = new MyTextSanitizer; // MyTextSanitizer object + $mytree = new XoopsTree($_DB_name,$_FM_TABLES['filemgmt_cat'],"cid","pid"); + + $display = COM_startBlock("<b>". $LANG_FILEMGMT['plugin_name'] ."</b>"); + $fields = 'd.lid, d.cid, d.title, d.url, d.homepage, d.version, d.size, d.logourl,'; + $fields .= 'd.submitter, d.status, d.date, d.hits, d.rating, d.votes, t.description'; + + $sql = "SELECT $fields FROM {$_FM_TABLES['filemgmt_filedetail']} d, "; + $sql .= "{$_FM_TABLES['filemgmt_filedesc']} t "; + $sql .= "WHERE d.lid='$id' AND d.lid=t.lid AND status > 0"; + $result=DB_query($sql); + list($lid, $cid, $dtitle, $url, $homepage, $version, $size, $logourl, $submitter, $status, $time, $hits, $rating, $votes, $description)=DB_fetchARRAY($result); + + $p = new Template($_CONF['path'] . 'plugins/filemgmt/templates'); + $p->set_file (array ( + 'page' => 'filelisting.thtml', + 'records' => 'filelisting_record.thtml', + 'category' => 'filelisting_category.thtml')); + + $p->set_var ('layout_url', $_CONF['layout_url']); + $p->set_var ('site_url',$_CONF['site_url']); + + $pathstring = "<a href='index.php'>"._MD_MAIN."</a> : "; + $nicepath = $mytree->getNicePathFromId($cid, "title", "{$_CONF['site_url']}/filemgmt/viewcat.php?op="); + $pathstring .= $nicepath; + $p->set_var('category_path_link',$pathstring); + + $rating = number_format($rating, 2); + $dtitle = $myts->makeTboxData4Show($dtitle); + $url = $myts->makeTboxData4Show($url); + $homepage = $myts->makeTboxData4Show($homepage); + $version = $myts->makeTboxData4Show($version); + $size = $myts->makeTboxData4Show($size); + $platform = $myts->makeTboxData4Show($platform); + $logourl = $myts->makeTboxData4Show($logourl); + $datetime = formatTimestamp($time); + $description = $myts->makeTareaData4Show($description,0); //no html + $result2 = DB_query("SELECT username,fullname,photo FROM {$_TABLES['users']} WHERE uid = $submitter"); + list ($submitter_name,$submitter_fullname,$photo) = DB_fetchARRAY($result2); + $submitter_name = COM_getDisplayName ($submitter, $submitter_name, $submitter_fullname); + include($_CONF[path_html] ."/filemgmt/include/dlformat.php"); + $p->set_var('cssid',1); + $p->parse ('filelisting_records', 'records'); + $p->parse ('output', 'page'); + $display .= $p->finish ($p->get_var('output')); + + $display .= COM_endBlock(); + + /* Get formatted comment thread */ + if (SEC_hasRights('filemgmt.edit')) { + $delete_option = true; + } else { + $delete_option = false; + } + + if ($view == 1) { + $display .= CMT_userComments ("fileid_$id", $title, 'filemgmt',$order,$format,$commentid,$page,true,$delete_option); + } else { + $display .= CMT_userComments ("fileid_$id", $title, 'filemgmt',$order,$format,$commentid,$page,false,$delete_option); + } + + return $display; +} + + +function plugin_statssummary_filemgmt () +{ + global $_FM_TABLES, $LANG_FILEMGMT; + + $sql = "SELECT COUNT(*), SUM(hits) FROM {$_FM_TABLES['filemgmt_filedetail']} a "; + $sql .= "LEFT JOIN {$_FM_TABLES['filemgmt_cat']} b ON a.cid=b.cid "; + $sql .= filemgmt_buildAccessSql('WHERE'); + list($total_files,$total_downloads) = DB_fetchArray( DB_query($sql)); + + return array ($LANG_FILEMGMT['nofiles'], COM_numberFormat ($total_files) + . '(' . COM_numberFormat ($total_downloads) . ')'); +} + + +/** +* shows the statistics for the Filemgmot plugin on stats.php. If $showsitestats +* is 1 then we are to only print the overall stats in the 'site statistics box' +* otherwise we show the detailed stats for the photo album +* +* @showsitestats int Flag to let us know which stats to get +*/ +function plugin_showstats_filemgmt($showsitestats) +{ +global $LANG_FILEMGMT, $_FM_TABLES, $_CONF; + + $stat_templates = new Template($_CONF['path_layout'] . 'stats'); + $stat_templates->set_file(array('itemstats'=>'itemstatistics.thtml', + 'statrow'=>'singlestat.thtml')); + if ($showsitestats == 1) { + $sql = "SELECT COUNT(*), SUM(hits) FROM {$_FM_TABLES['filemgmt_filedetail']} a "; + $sql .= "LEFT JOIN {$_FM_TABLES['filemgmt_cat']} b ON a.cid=b.cid "; + $sql .= filemgmt_buildAccessSql('WHERE'); + list($total_files,$total_downloads) = DB_fetchArray( DB_query($sql)); + $retval = "<table border = '0' width='100%' cellspacing='0' cellpadding='0'>"; + $retval .= "<tr><td>" . $LANG_FILEMGMT['nofiles'] . "</td>"; + $retval .= "<td align='right'>" . $total_files . " (" .$total_downloads .") </td></tr></table>"; + } else { + $sql = "SELECT a.lid, a.title, hits from {$_FM_TABLES['filemgmt_filedetail']} a "; + $sql .= "LEFT JOIN {$_FM_TABLES['filemgmt_cat']} b ON a.cid=b.cid "; + $sql .= filemgmt_buildAccessSql('WHERE'); + $sql .= " AND hits > 0 ORDER BY hits desc LIMIT 10"; + $result = DB_query($sql); + $nrows = DB_numRows($result); + $retval .= COM_startBlock($LANG_FILEMGMT['StatsMsg1']); + if ($nrows > 0) { + $stat_templates->set_var('item_label',"Page Title"); + $stat_templates->set_var('stat_name',"Hits"); + for ($i = 0; $i < $nrows && $i < 10; $i++) { + list ($lid, $title,$hits) = DB_fetchARRAY($result); + $stat_templates->set_var('item_url', $_CONF[site_url]. "/filemgmt/index.php?id=".$lid); + $stat_templates->set_var('item_text', $title); + $stat_templates->set_var('item_stat', $hits); + $stat_templates->parse('stat_row','statrow',true); + } + $stat_templates->parse('output','itemstats'); + $retval .= $stat_templates->finish($stat_templates->get_var('output')); + } else { + $retval .= $LANG_FILEMGMT['StatsMsg2']; + } + $retval .= COM_endBlock(); + } + return $retval; +} + +/** +* Geeklog is asking us to provide any new items that show up in the type drop-down +* on search.php. Let's let users search the Filelistings in the Filemgmt Plugin +* +*/ + +function plugin_searchtypes_filemgmt() +{ + global $LANG_FILEMGMT; + + $tmp['filemgmt'] = $LANG_FILEMGMT['searchlabel']; + + return $tmp; +} + +/** +* this searches for files matching the user query and returns an array of +* for the header and table rows back to search.php where it will be formated and +* printed +* +* @query string Keywords user is looking for +* @datestart date/time Start date to get results for +* @dateend date/time End date to get results for +* @topic string The topic they were searching in +* @type string Type of items they are searching +* @author string Get all results by this author +* +*/ +function plugin_dopluginsearch_filemgmt($query, $datestart, $dateend, $topic, $type, $author) +{ + global $LANG_FILEMGMT, $_TABLES, $_FM_TABLES, $_CONF, $filemgmt_FileStoreURL; + + $query = addslashes($query); + if (empty($type)) { + $type = 'all'; + } + + // Bail if we aren't supppose to do our search + if ($type <> 'all' AND $type <> 'filemgmt') { + $plugin_results = new Plugin(); + $plugin_results->plugin_name = $LANG_FILEMGMT['plugin_name']; + $plugin_results->searchlabel = $LANG_FILEMGMT['searchlabel']; + return $plugin_results; + } + + // Build search SQL + $sql = "SELECT a.lid, a.lid, a.cid, a.title, url, submitter, comments, hits, UNIX_TIMESTAMP(date) as day, description "; + $sql .= "FROM {$_FM_TABLES['filemgmt_filedetail']} a "; + $sql .= "LEFT JOIN {$_FM_TABLES['filemgmt_cat']} b ON b.cid=a.cid "; + $sql .= "LEFT JOIN {$_FM_TABLES['filemgmt_filedesc']} c ON c.lid=a.lid "; + $sql .= filemgmt_buildAccessSql('WHERE'); + $sql .= " AND a.status > 0 "; + $sql .= "AND ((comments like '%$query%' OR comments like '$query%' OR comments like '%$query') "; + $sql .= "OR (a.title like '%$query%' OR a.title like '$query%' OR a.title like '%$query') "; + $sql .= "OR (c.description like '%$query%' OR c.description like '$query%' OR c.description like '%$query')) "; + + if (!empty($datestart) && !empty($dateend)) { + $delim = substr($datestart, 4, 1); + $DS = explode($delim,$datestart); + $DE = explode($delim,$dateend); + $startdate = mktime(0,0,0,$DS[1],$DS[2],$DS[0]); + $enddate = mktime(0,0,0,$DE[1],$DE[2],$DE[0]) + 3600; + $sql .= "AND (UNIX_TIMESTAMP(date) BETWEEN '$startdate' AND '$enddate') "; + } + + if (!empty($author)) { + $sql .= "AND (submitter = '$author') "; + } + $sql .= "ORDER BY date desc"; + + // Perform search + $result = DB_query($sql); + + // OK, now return coma delmited string of table header labels + // Need to use language variables + require_once($_CONF['path_system'] . 'classes/plugin.class.php'); + $plugin_results = new Plugin(); + $plugin_results->plugin_name = 'filemgmt'; + $plugin_results->searchlabel = $LANG_FILEMGMT['searchlabel_results']; + $plugin_results->addSearchHeading('Title'); + $plugin_results->addSearchHeading('Description'); + $plugin_results->addSearchHeading('Author'); + $plugin_results->addSearchHeading('Downloads'); + $plugin_results->num_searchresults = DB_numRows($result); + + // NOTE if any of your data items need to be links then add them here! + // make sure data elements are in an array and in the same order as your + // headings above! + + for ($i = 1; $i <= $plugin_results->num_searchresults; $i++) { + $A = DB_fetchArray($result); + $thetime = COM_getUserDateTimeFormat($A['day']); + $url = $_CONF[site_url]. "/filemgmt/index.php?id=".$A['lid']; + $row = array("<a href={$url}>{$A['title']}</a>", wordwrap($A['description'],70,"<br>"), COM_getDisplayName($A['submitter']), $A['hits']); + $plugin_results->addSearchResult($row); + } + + $plugin_results->num_itemssearched = DB_count($_FM_TABLES['filemgmt_filedetail']); + + return $plugin_results; +} + + + + +/** +* This will put an option for Filemgmt Admin in the command and control block on +* moderation.php +* +*/ +function plugin_cclabel_filemgmt() +{ + global $LANG_FILEMGMT, $_CONF; + if (SEC_hasRights('filemgmt.edit')) { + return array($LANG_FILEMGMT['plugin_name'],$_CONF['site_admin_url'] . '/plugins/filemgmt/index.php',$_CONF['site_url'] . '/filemgmt/images/filemgmt.jpg'); + } else { + return false; + } + +} + +/** +* Setup the user menu options for this plugin +* +*/ + +function plugin_getuseroption_filemgmt() { + global $_CONF, $_FM_TABLES, $LANG_FILEMGMT,$mydownloads_uploadselect; + if (SEC_hasRights('filemgmt.upload') OR $mydownloads_uploadselect == 1) { + return array($LANG_FILEMGMT['usermenu3'], $_CONF['site_url'] . '/filemgmt/submit.php'); + } else { + return false; + } +} + + +/** +* returns the administrative option for this plugin +* * +*/ + +function plugin_getadminoption_filemgmt() +{ + global $_CONF, $_FM_TABLES, $LANG_FILEMGMT; + if (SEC_hasRights('filemgmt.edit')) { + $result = DB_query("SELECT COUNT(*) FROM {$_FM_TABLES['filemgmt_filedetail']} WHERE status=0"); + list($submittedfiles) = DB_fetchARRAY($result); + return array($LANG_FILEMGMT['admin_menu'], $_CONF['site_admin_url'] . '/plugins/filemgmt/index.php', $submittedfiles); + } +} + + + +/** +* Removes the datastructures for this plugin from the Geeklog database +* This may get called by the install routine to undue anything created during the install. +* Added check to see that plugin is first disabled. +*/ +function plugin_uninstall_filemgmt($installCheck='') +{ + global $LANG_FM00, $LANG_FILEMGMT, $_TABLES,$_FM_TABLES; + + $pi_name='filemgmt'; + $FEATURES = array ('filemgmt.edit', 'filemgmt.user','filemgmt.upload'); + $TABLES = array ('filemgmt_cat','filemgmt_filedetail','filemgmt_filedesc','filemgmt_brokenlinks','filemgmt_votedata','filemgmt_history'); + + // Check and see if plugin is still enabled - if so display warning and exit + if ($installCheck != '' && DB_getItem($_TABLES['plugins'],'pi_enabled', 'pi_name = "' .$pi_name. '"')) { + COM_errorLog("Plugin is installed and enabled. Disable first if you want to de-install it",1); + $display = COM_siteHeader(); + $display .= COM_startBlock($LANG_FM00['warning']); + $display .= $LANG_FM00['enabled']; + $display .= COM_endBlock(); + $display .= COM_siteFooter(); + echo $display; + exit; + } + + // Ok to proceed and delete plugin - Unregister the plugin with Geeklog + COM_errorLog('Attempting to unregister the Forum plugin from Geeklog',1); + DB_query("DELETE FROM {$_TABLES['plugins']} WHERE pi_name = 'filemgmt'",1); + // Drop tables + foreach($TABLES as $table) { + $t = $_FM_TABLES["$table"]; + COM_errorLog("Removing Table $t",1); + DB_query("DROP TABLE $t",1); + } + + // Remove the Admin group definition for this plugin + $grp_id = DB_getItem($_TABLES['vars'], 'value', "name = '{$pi_name}_admingrp_id'"); + COM_errorLog("Removing $pi_name Admin Group", 1); + DB_query("DELETE FROM {$_TABLES['groups']} WHERE grp_id = $grp_id",1); + DB_query("DELETE FROM {$_TABLES['vars']} WHERE name = '{$pi_name}_admingrp_id'"); + COM_errorLog("Removing root users from Admin Group of $pi_name"); + DB_query("DELETE FROM {$_TABLES['group_assignments']} WHERE ug_main_grp_id = $grp_id",1); + + // Remove User group definition for this plugin + $grp_id = DB_getItem($_TABLES['vars'], 'value', "name = '{$pi_name}_usersgrp_id'"); + COM_errorLog("Removing $pi_name User Group", 1); + DB_query("DELETE FROM {$_TABLES['groups']} WHERE grp_id = $grp_id",1); + DB_query("DELETE FROM {$_TABLES['vars']} WHERE name = '{$pi_name}_usersgrp_id'"); + COM_errorLog("Removing root users from Users Group of $pi_name"); + DB_query("DELETE FROM {$_TABLES['group_assignments']} WHERE ug_main_grp_id = $grp_id",1); + + // Remove all the associated features - access rights. The feature ID's were stored in the vars table during install. + foreach ($FEATURES as $feature) { + COM_errorLog("Removing $feature feature and rights to it",1); + $feat_id = DB_getItem($_TABLES['features'], 'ft_id', "ft_name = '$feature'"); + COM_errorLog("DELETE FROM {$_TABLES['access']} WHERE acc_ft_id = $feat_id"); + DB_query("DELETE FROM {$_TABLES['access']} WHERE acc_ft_id = $feat_id",1); + DB_query("DELETE FROM {$_TABLES['features']} WHERE ft_id = $feat_id",1); + } + + DB_query("DELETE FROM {$_TABLES['comments']} WHERE type='filemgmt'"); + COM_errorLog("Removing all comments for plugin $pi_name"); + DB_query("DELETE FROM {$_TABLES['blocks']} WHERE phpblockfn='phpblock_NewDownloads'"); + COM_errorLog("Removing block definition for plugin $pi_name"); + + COM_errorLog('...success',1); + return true; +} + + +// Common function used to build group access SQL +function filemgmt_buildAccessSql($clause='AND') { + global $_TABLES,$_USER; + + if (DB_getItem($_TABLES['plugins'],'pi_version', "pi_name='filemgmt'") != 1.5) { + return ''; + } + + if (isset($_USER) AND $_USER['uid'] > 1) { + $uid = $_USER['uid']; + } else { + $uid = 1; + } + + $_GROUPS = SEC_getUserGroups($uid); + $groupsql = ''; + if (count($_GROUPS) == 1) { + $groupsql .= " $clause grp_access = '" . current($_GROUPS) ."'"; + } else { + $groupsql .= " $clause grp_access IN (" . implode(',',array_values($_GROUPS)) .")"; + } + return $groupsql; +} + +function plugin_getfeednames_filemgmt () +{ + global $_FM_TABLES; + + $feeds = array (); + $groupsql = filemgmt_buildAccessSql('WHERE'); + $result = DB_query ("SELECT cid,title FROM {$_FM_TABLES['filemgmt_cat']} $groupsql ORDER BY title ASC"); + $num = DB_numRows ($result); + + if ($num > 0) { + $feeds[] = array ('id' => '0', 'name' => 'all files'); + } + + for ($i = 0; $i < $num; $i++) { + $A = DB_fetchArray ($result); + $feeds[] = array ('id' => $A['cid'], 'name' => $A['title']); + } + + return $feeds; +} + +function filemgmt_buildSql ($topic, $limits) +{ + $where = ''; + if ($topic > 0) { + $where = 'cid=' . $topic; + } + + $limitsql = ''; + if (!empty ($limits)) { + if (substr ($limits, -1) == 'h') { // last xx hours + $limitsql = ''; + $hours = substr ($limits, 0, -1); + if (!empty ($where)) { + $where .= ' AND '; + } + $where .= "date >= DATE_SUB(NOW(),INTERVAL $hours HOUR)"; + } else { + $limitsql = ' LIMIT ' . $limits; + } + } + else + { + $limitsql = ' LIMIT 10'; + } + + if (!empty ($where)) { + $where = ' WHERE ' . $where; + } + + $sql = $where . $limitsql; + + return $sql; +} + +function plugin_getfeedcontent_filemgmt ($feed, &$link, &$update) +{ + global $_CONF, $_TABLES, $_FM_TABLES; + + $content = array (); + $lids = array (); + + $result = DB_query ("SELECT topic,limits FROM {$_TABLES['syndication']} WHERE fid = $feed"); + $F = DB_fetchArray ($result); + + $sql = "SELECT lid,title,submitter,date FROM {$_FM_TABLES['filemgmt_filedetail']}" . filemgmt_buildSql ($F['topic'], $F['limits']); + $result = DB_query ($sql); + $num = DB_numRows ($result); + for ($i = 0; $i < $num; $i++) { + $A = DB_fetchArray ($result); + $desc = DB_getItem ($_FM_TABLES['filemgmt_filedesc'], 'description', + "lid = {$A['lid']}"); + $filelink = $_CONF['site_url'] . '/filemgmt/index.php?id=' + . $A['lid']; + $content[] = array ('title' => $A['title'], + 'text' => $desc, + 'link' => $filelink, + 'uid' => $A['submitter'], + 'date' => $A['date'], + 'format' => 'text' + ); + $lids[] = $A['lid']; + } + + if ($F['topic'] == 0) { + $link = $_CONF['site_url'] . '/filemgmt/index.php'; + } else { + $link = $_CONF['site_url'] . '/filemgmt/viewcat.php?cid=' . $F['topic']; + } + $update = implode (',', $lids); + + return $content; +} + +function plugin_feedupdatecheck_filemgmt ($feed, $topic, $update_data, $limit) +{ + global $_FM_TABLES; + + $is_current = true; + + $sql = "SELECT lid FROM {$_FM_TABLES['filemgmt_filedetail']}" . filemgmt_buildSql ($topic, $limits); + $result = DB_query ($sql); + $num = DB_numRows ($result); + + $lids = array (); + for ($i = 0; $i < $num; $i++) { + $A = DB_fetchArray ($result); + $lids[] = $A['lid']; + } + $current = implode (',', $lids); + return ( $current != $update_data ) ? false : true; +} + +/** + * Whats New Block API Support + * Return the Headline and Byline for the new section in the Whatsnew Block +*/ +function plugin_whatsnewsupported_filemgmt() { + global $_CONF, $LANG_FM00,$mydownloads_whatsnew,$filemgmtWhatsNewPeriodDays; + if ($mydownloads_whatsnew == 1) { + return array( + $LANG_FM00['WhatsNewLabel'], + sprintf($LANG_FM00['WhatsNewPeriod'], $filemgmtWhatsNewPeriodDays) + ); + } else { + return false; + } +} + + +/** + * API function provides the content of our "What's New" feed +*/ +function plugin_getwhatsnew_filemgmt() { + global $_TABLES, $_FM_TABLES, $_CONF, $LANG_FILEMGMT, $LANG01; + global $filemgmtWhatsNewTitleLength,$filemgmtWhatsNewPeriodDays,$filemgmt_showWhatsNewComments; + + $items = array(); + if (SEC_hasRights('filemgmt.user') OR $mydownloads_publicpriv == 1) { + $sql = "SELECT a.lid, a.title FROM {$_FM_TABLES['filemgmt_filedetail']} a "; + $sql .= "LEFT JOIN {$_FM_TABLES['filemgmt_cat']} b ON a.cid=b.cid "; + $sql .= "WHERE date >= UNIX_TIMESTAMP( DATE_SUB(NOW(), INTERVAL $filemgmtWhatsNewPeriodDays DAY )) "; + $sql .= filemgmt_buildAccessSql(); + $sql .= "AND STATUS=1 ORDER BY date DESC LIMIT 15 "; + $result = DB_query( $sql ); + $nrows1 = DB_numRows( $result ); + if( $nrows1 == 0 ) { + $retval .= $LANG_FILEMGMT['no_new_files'] . '<br>' . LB; + } else { + for( $i = 0; $i < $nrows1; $i++ ) { + list($lid, $title) = DB_fetchArray( $result ); + $str = "<a href=\"{$_CONF['site_url']}/filemgmt/index.php?id=$lid\">"; + //@@@@@ 20080115 mystral_kk -----> + //$str .= stripslashes(substr($title,0,$filemgmtWhatsNewTitleLength)); + $str .= COM_truncate(stripslashes($title),$filemgmtWhatsNewTitleLength, '...'); + //@@@@@ 20080115 mystral_kk <----- + + $str .= '</a>'; + $items[] = $str; + } + } + if ($filemgmt_showWhatsNewComments) { + // Search for new comments + $sql = "SELECT a.lid,c.title FROM {$_FM_TABLES['filemgmt_filedetail']} a "; + $sql .= "LEFT JOIN {$_FM_TABLES['filemgmt_cat']} b ON a.cid=b.cid "; + $sql .= "LEFT JOIN {$_TABLES['comments']} c ON c.sid = concat('fileid_' ,a.lid )"; + $sql .= filemgmt_buildAccessSql('WHERE'); + $sql .= " AND c.date >= DATE_SUB(NOW(), INTERVAL $filemgmtWhatsNewPeriodDays DAY ) AND c.type='filemgmt' "; + $sql .= "GROUP BY c.sid ORDER BY c.date DESC LIMIT 15 "; + + $result = DB_query($sql); + $nrows2 = DB_numRows( $result ); + if( $nrows2 == 0 ) { + $retval .= $LANG_FILEMGMT['no_comments'] . '<br>' . LB; + } else { + for( $i = 0; $i < $nrows2; $i++ ) { + list($lid, $title) = DB_fetchArray( $result ); + $titleLength = $filemgmtWhatsNewTitleLength + 13; // Compensate for the added HTML + $title = "<b>C:</b> ".$title; + $str = "<a href=\"{$_CONF['site_url']}/filemgmt/index.php?id=$lid\">"; + //@@@@@ 2008/01/15 mystral_kk update-----> + //$str .= stripslashes(substr($title,0,$titleLength)); + $str .= COM_truncate(stripslashes($title),$titleLength, '...'); + //@@@@@ 2008/01/15 mystral_kk update<----- + + $str .= '</a>'; + $items[] = $str; + } + } + } + + if ($nrows1 == 0 and $nrows2 == 0) { + return $retval; + } else { + return $items; + } + } else { + return $items; + } +} + + + +/** +* Implements the [file:] autotag. +* +*/ +function plugin_autotags_filemgmt ($op, $content = '', $autotag = '') +{ + global $_CONF, $_FM_TABLES; + + if ($op == 'tagname' ) { + return 'file'; + } else if ($op == 'parse') { + $file_id = COM_applyFilter ($autotag['parm1']); + $url = COM_buildUrl ($_CONF['site_url'] . '/filemgmt/index.php?id=' + . $file_id); + if (empty ($autotag['parm2'])) { + $linktext = stripslashes (DB_getItem ($_FM_TABLES['filemgmt_filedetail'], + 'title', "lid = '$file_id'")); + } else { + $linktext = $autotag['parm2']; + } + $link = '<a href="' . $url . '">' . $linktext . '</a>'; + $content = str_replace ($autotag['tagstr'], $link, $content); + + return $content; + } +} + + + +/* GLMENU USE ONLY API FUNCTIONS */ + +/* Function can be used in a Menuitem of type "PHP Function" +* It will generate the menuitems and submenus for your filemgmt plugin +* Works with the function plugin_glMenuCreateMenus_filemgmt() +*/ +function glmenu_filemgmt() { + global $_CONF,$_FM_TABLES,$CONF_FILEMGMT; + $menu_location = $CONF_FILEMGMT['glmenutype']; + + $retval = ''; + $sql = "SELECT cid,pid,title FROM {$_FM_TABLES['filemgmt_cat']} WHERE pid = 0 "; + $sql .= filemgmt_buildAccessSql('AND') . ' ORDER BY cid'; + $q1 = DB_query($sql); + while (list($cid,$pid,$title) = DB_fetchArray($q1)) { + $retval .= 'aI("image='.$_CONF['layout_url'] .'/glmenu/images/folder.gif;text='.$title.';showmenu=filemgmt-'.$cid.';url='.$_CONF['site_url'].'/filemgmt/viewcat.php?cid='.$cid.';");'; + } + return $retval; +} + + + +/* GL-Menu API function to generate requires Milonic Javascript functions */ +function plugin_glMenuCreateMenus_filemgmt() { + global $_CONF,$_FM_TABLES,$CONF_GLMENU,$CONF_FILEMGMT,$_FMDOWNLOAD; + + /* Generate the JS Menu Functions that are needed for the Content Editor submenus */ + $menu_location = $CONF_FILEMGMT['glmenutype']; + $retval .= ''; + $groupsql = filemgmt_buildAccessSql('WHERE'); + $sql = "SELECT cid,pid,title FROM {$_FM_TABLES['filemgmt_cat']} $groupsql ORDER BY cid"; + $q1 = DB_query($sql); + while (list($cid,$pid,$title) = DB_fetchArray($q1)) { + $menudata = ''; + $retval .= ' with(milonic=new menuname("filemgmt-'.$cid.'")) {'; + if ($menu_location == 'block') { + $retval .= 'style='.$CONF_GLMENU['blockmenustyle'] .';'; + } else { + $retval .= 'style='.$CONF_GLMENU['headersubmenustyle'] .';'; + } + /* Find and sub categories - that will be submenus */ + $q2 = DB_query("SELECT cid,pid,title FROM {$_FM_TABLES['filemgmt_cat']} $groupsql AND pid='{$cid}' "); + while (list ($subcid,$subpid,$subtitle) = DB_fetchArray($q2)) { + $menudata .= 'aI("image='.$_CONF['layout_url'] .'/glmenu/images/folder.gif;text='.$subtitle.';showmenu=filemgmt-'.$subcid.';url='.$_CONF['site_url'].'/filemgmt/viewcat.php?cid='.$subcid.';");'; + } + /* Show any links for files that are in this category */ + $q3 = DB_query("SELECT lid,title,url FROM {$_FM_TABLES['filemgmt_filedetail']} WHERE cid='{$cid}'"); + while (list ($fileid,$filename,$url) = DB_fetchArray($q3)) { + $pos = strrpos($url,'.') + 1; + $ext = strtolower(substr($url, $pos)); + if (array_key_exists($ext, $_FMDOWNLOAD['inconlib'] )) { + $icon = "{$_CONF['layout_url']}/glmenu/images/{$_FMDOWNLOAD['inconlib'][$ext]}"; + } else { + $icon = "{$_CONF['layout_url']}/glmenu/images/{$_FMDOWNLOAD['inconlib']['none']}"; + } + $menudata .= 'aI("image='.$icon.';text='.$filename.';url='.$_CONF['site_url'].'/filemgmt/singlefile.php?lid='.$fileid.';");'; + } + if ($menudata != '') { + $retval .= $menudata; + } + + $retval .= '}'; + } + return $retval; + +} + + +?> \ No newline at end of file Added: trunk/plugins/filemgmt/history ============================================================================== --- (empty file) +++ trunk/plugins/filemgmt/history Sun Sep 21 23:48:51 2008 @@ -0,0 +1,20 @@ +/* History of Changes */ + +Oct 14/07 - Version 1.5.3 +- Fix for possible remote file include vulneribility +- Added ability to change the number of categories and subcategories to show +- Bug fixes in subcategory display and sortable headings + + +April 2/06 -Version 1.5.2 + - Bug Fix: Search function should not return file listing that have not been approved - pending moderation approval + - Bug Fix: Corrected autotag link feature + - Bug Fix: Wrong error code being passed to error handler if new file submission is a duplicate file + - If user has filemgmt.edit right, show the delete comment feature + - Added test for file id is not a new (un-approved) file in main index.php + - tweaked the errorhandler display + +Mar 26/06 - Change to index.php to support MySQL 5. Need () around multiple tables in FROM Clause + +Mar 25/06: Archive Version 1.51c distributed. + Change to viewcat.php - corrected bad link in google paging base_url link \ No newline at end of file Added: trunk/plugins/filemgmt/language/english.php ============================================================================== --- (empty file) +++ trunk/plugins/filemgmt/language/english.php Sun Sep 21 23:48:51 2008 @@ -0,0 +1,375 @@ +<?php + +############################################################################### +# lang.php +# This is the english language page for the Geeklog File Mgmt Page Plug-in! +# +# Copyright (C) 2002 Blaine Lang +# blain****@porta***** +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################### + + +// Language variables used by the Plug-in API + +$LANG_FM00 = array ( + 'access_denied' => 'Access Denied', + 'access_denied_msg' => 'Only Root Users have Access to this Page. Your user name and IP have been recorded.', + 'admin' => 'Plugin Admin', + 'install_header' => 'Install/Uninstall Plugin', + 'installed' => 'The Plugin and Block are now installed,<p><i>Enjoy,<br><a href="MAILTO:blain****@porta*****">Blaine</a></i>', + 'uninstalled' => 'The Plugin is Not Installed', + 'install_success' => 'Installation Successful<p><b>Next Steps</b>: + <ol><li>Use the Filemgmt Admin to complete the plugin configuration</ol> + <p>Review the <a href="%s">Install Notes</a> for more information.', + 'install_failed' => 'Installation Failed -- See your error log to find out why.', + 'uninstall_msg' => 'Plugin Successfully Uninstalled', + 'install' => 'Install', + 'uninstall' => 'UnInstall', + 'editor' => 'Plugin Editor', + 'warning' => 'De-Install Warning', + 'enabled' => '<p style="padding: 15px 0px 5px 25px;">Plugin is installed and enabled.<br>Disable first if you want to De-Install it.</p><div style="padding:5px 0px 5px 25px;"><a href="'.$_CONF['site_admin_url'].'/plugins.php">Plugin Editor</a></div', + 'WhatsNewLabel' => 'NEW FILES', + 'WhatsNewPeriod' => ' last %s days' +); + +// Admin Navbar +$LANG_FM02 = array( + 'nav1' => 'Settings', + 'nav2' => 'Categories', + 'nav3' => 'Add File', + 'nav4' => 'Downloads (%s)', + 'nav5' => 'Broken Files (%s)' +); + +$LANG_FILEMGMT = array( + 'newpage' => "New Page", + 'adminhome' => "Admin Home", + 'plugin_name' => "File Management", + 'searchlabel' => "File Listing", + 'searchlabel_results' => "File Listing Results", + 'downloads' => "My Downloads", + 'report' => "Top Downloads", + 'usermenu1' => "Downloads", + 'usermenu2' => " Top Rated", + 'usermenu3' => "Upload a file", + 'admin_menu' => "Filemgmt Admin", + 'writtenby' => "Written By", + 'date' => "Last Updated", + 'title' => "Title", + 'content' => "Content", + 'hits' => "Hits", + 'Filelisting' => "File Listing", + 'DownloadReport' => "Download History for single file", + 'StatsMsg1' => "Top Ten Accessed Files in Repository", + 'StatsMsg2' => "It appears there are no files defined for the filemgmt plugin on this site or no one has ever accessed them.", + 'usealtheader' => "Use Alt. Header", + 'url' => "URL", + 'edit' => "Edit", + 'lastupdated' => "Last Updated", + 'pageformat' => "Page Format", + 'leftrightblocks' => "Left & Right Blocks", + 'blankpage' => "Blank Page", + 'noblocks' => "No Blocks", + 'leftblocks' => "Left Blocks", + 'addtomenu' => 'Add To Menu', + 'label' => 'Label', + 'nofiles' => 'Number of files in our repository (Downloads)', + 'save' => 'save', + 'preview' => 'preview', + 'delete' => 'delete', + 'cancel' => 'cancel', + 'access_denied' => 'Access Denied', + 'invalid_install' => 'Someone has tried to illegally access the File Management install/uninstall page. User id: ', + 'start_install' => 'Attempting to install the Filemgmt Plugin', + 'start_dbcreate' => 'Attempting to create tables for Filemgmt plugin', + 'install_skip' => '... skipped as per filemgmt.cfg', + 'access_denied_msg' => 'You are illegally trying access the File Mgmt administration pages. Please note that all attempts to illegally access this page are logged', + 'installation_complete' => 'Installation Complete', + 'installation_complete_msg' => 'The data structures for the File Mgmt plugin for Geeklog have been successfully installed into your database! If you ever need to uninstall this plugin, please read the README document that came with this plugin.', + 'installation_failed' => 'Installation Failed', + 'installation_failed_msg' => 'The installation of the File Mgmt plugin failed. Please see your Geeklog error.log file for diagnostic information', + 'system_locked' => 'System Locked', + 'system_locked_msg' => 'The File Mgmt plugin has already been installed and is locked. If you are trying to uninstall this plugin, please read the README document that shipped with this plugin', + 'uninstall_complete' => 'Uninstall Complete', + 'uninstall_complete_msg' => 'The datastructures for the File Mgmt plugin have been successfully removed from your Geeklog database<br><br>You will need to manually remove all files in your file repository.', + 'uninstall_failed' => 'Uninstall Failed.', + 'uninstall_failed_msg' => 'The uninstall of the File Mgmt plugin failed. Please see your Geeklog error.log file for diagnostic information', + 'install_noop' => 'Plugin Install', + 'install_noop_msg' => 'The filemgmt plugin install executed but there was nothing to do.<br><br>Check your plugin install.cfg file.', + 'all_html_allowed' => 'All HTML is allowed', + 'no_new_files' => 'No new files', + 'no_comments' => 'No new comments', + 'more' => '<em>more ...</em>' +); + +$PLG_filemgmt_MESSAGE1 = 'Filemgmt Plugin Install Aborted<br>File: plugins/filemgmt/filemgmt.php is not writeable'; +$PLG_filemgmt_MESSAGE3 = 'This plugin requires Geeklog Version 1.4 or greater, upgrade aborted.'; +$PLG_filemgmt_MESSAGE4 = 'Plugin version 1.5 code not detected - upgrade aborted.'; +$PLG_filemgmt_MESSAGE5 = 'Filemgmt Plugin Upgrade Aborted<br>Current plugin version is not 1.3'; + + +// Language variables used by the plugin - general users access code. + +define("_MD_THANKSFORINFO","Thanks for the information. We'll look into your request shortly."); +define("_MD_BACKTOTOP","Back to Downloads Top"); +define("_MD_THANKSFORHELP","Thank you for helping to maintain this directory's integrity."); +define("_MD_FORSECURITY","For security reasons your user name and IP address will also be temporarily recorded."); + +define("_MD_SEARCHFOR","Search for"); +define("_MD_MATCH","Match"); +define("_MD_ALL","ALL"); +define("_MD_ANY","ANY"); +define("_MD_NAME","Name"); +define("_MD_DESCRIPTION","Description"); +define("_MD_SEARCH","Search"); + +define("_MD_MAIN","Main"); +define("_MD_SUBMITFILE","Submit File"); +define("_MD_POPULAR","Popular"); +define("_MD_NEW","New"); +define("_MD_TOPRATED","Top Rated"); + +define("_MD_NEWTHISWEEK","New this week"); +define("_MD_UPTHISWEEK","Updated this week"); + +define("_MD_POPULARITYLTOM","Popularity (Least to Most Hits)"); +define("_MD_POPULARITYMTOL","Popularity (Most to Least Hits)"); +define("_MD_TITLEATOZ","Title (A to Z)"); +define("_MD_TITLEZTOA","Title (Z to A)"); +define("_MD_DATEOLD","Date (Old Files Listed First)"); +define("_MD_DATENEW","Date (New Files Listed First)"); +define("_MD_RATINGLTOH","Rating (Lowest Score to Highest Score)"); +define("_MD_RATINGHTOL","Rating (Highest Score to Lowest Score)"); + +define("_MD_NOSHOTS","No Thumbnails Available"); +define("_MD_EDITTHISDL","Edit This Download"); + +define("_MD_LISTINGHEADING","<b>File Listing: There are %s files in our database</b>"); +define("_MD_LATESTLISTING","<b>Latest Listing:</b>"); +define("_MD_DESCRIPTIONC","Description:"); +define("_MD_EMAILC","Email: "); +define("_MD_CATEGORYC","Category: "); +define("_MD_LASTUPDATEC","Last Update: "); +define("_MD_DLNOW","Download Now!"); +define("_MD_VERSION","Ver"); +define("_MD_SUBMITDATE","Date"); +define("_MD_DLTIMES","Downloaded %s times"); +define("_MD_FILESIZE","File Size"); +define("_MD_SUPPORTEDPLAT","Supported Platforms"); +define("_MD_HOMEPAGE","Home Page"); +define("_MD_HITSC","Hits: "); +define("_MD_RATINGC","Rating: "); +define("_MD_ONEVOTE","1 vote"); +define("_MD_NUMVOTES","(%s)"); +define("_MD_NOPOST","N/A"); +define("_MD_NUMPOSTS","%s votes"); +define("_MD_COMMENTSC","Comments: "); +define ("_MD_ENTERCOMMENT", "Create first comment"); +define("_MD_RATETHISFILE","Rate this File"); +define("_MD_MODIFY","Modify"); +define("_MD_REPORTBROKEN","Report Broken File"); +define("_MD_TELLAFRIEND","Tell a Friend"); +define("_MD_VSCOMMENTS","View/Send Comments"); +define("_MD_EDIT","Edit"); + +define("_MD_THEREARE","There are %s files in our database"); +define("_MD_LATESTLIST","Latest Listings"); + +define("_MD_REQUESTMOD","Request Download Modification"); +define("_MD_FILE","File"); +define("_MD_FILEID","File ID: "); +define("_MD_FILETITLE","Title: "); +define("_MD_DLURL","Download URL: "); +define("_MD_HOMEPAGEC","Home Page: "); +define("_MD_VERSIONC","Version: "); +define("_MD_FILESIZEC","File Size: "); +define("_MD_NUMBYTES","%s bytes"); +define("_MD_PLATFORMC","Platform: "); +define("_MD_CONTACTEMAIL","Contact Email: "); +define("_MD_SHOTIMAGE","Thumbnail Img: "); +define("_MD_SENDREQUEST","Send Request"); + +define("_MD_VOTEAPPRE","Your vote is appreciated."); +define("_MD_THANKYOU","Thank you for taking the time to vote here at %s"); // %s is your site name +define("_MD_VOTEFROMYOU","Input from users such as yourself will help other visitors better decide which file to download."); +define("_MD_VOTEONCE","Please do not vote for the same resource more than once."); +define("_MD_RATINGSCALE","The scale is 1 - 10, with 1 being poor and 10 being excellent."); +define("_MD_BEOBJECTIVE","Please be objective, if everyone receives a 1 or a 10, the ratings aren't very useful."); +define("_MD_DONOTVOTE","Do not vote for your own resource."); +define("_MD_RATEIT","Rate It!"); + +define("_MD_INTFILEAT","Interesting Download File at %s"); // %s is your site name +define("_MD_INTFILEFOUND","Here is an interesting download file I have found at %s"); // %s is your site name + +define("_MD_RECEIVED","We received your download information. Thanks!"); +define("_MD_WHENAPPROVED","You'll receive an E-mail when it's approved."); +define("_MD_SUBMITONCE","Submit your file/script only once."); +define("_MD_APPROVED", "Your file has been approved"); +define("_MD_ALLPENDING","All file/script information are posted pending verification."); +define("_MD_DONTABUSE","Username and IP are recorded, so please don't abuse the system."); +define("_MD_TAKEDAYS","It may take several days for your file/script to be added to our database."); + +define("_MD_RANK","Rank"); +define("_MD_CATEGORY","Category"); +define("_MD_HITS","Hits"); +define("_MD_RATING","Rating"); +define("_MD_VOTE","Vote"); + +define("_MD_SEARCHRESULT4","Search results for <b>%s</b>:"); +define("_MD_MATCHESFOUND","%s matche(s) found."); +define("_MD_SORTBY","Sort by:"); +define("_MD_TITLE","Title"); +define("_MD_DATE","Date"); +define("_MD_POPULARITY","Popularity"); +define("_MD_CURSORTBY","Files currently sorted by: "); +define("_MD_FOUNDIN","Found in:"); +define("_MD_PREVIOUS","Previous"); +define("_MD_NEXT","Next"); +define("_MD_NOMATCH","No matches found to your query"); + +define("_MD_TOP10","%s Top 10"); // %s is a downloads category name +define("_MD_CATEGORIES","Categories"); + +define("_MD_SUBMIT","Submit"); +define("_MD_CANCEL","Cancel"); + +define("_MD_BYTES","Bytes"); +define("_MD_ALREADYREPORTED","You have already submitted a broken report for this resource."); +define("_MD_MUSTREGFIRST","Sorry, you don't have the permission to perform this action.<br>Please register or login first!"); +define("_MD_NORATING","No rating selected."); +define("_MD_CANTVOTEOWN","You cannot vote on the resource you submitted.<br>All votes are logged and reviewed."); + +// Language variables used by the plugin - Admin code. + +define("_MD_RATEFILETITLE","Record your file rating"); +define("_MD_ADMINTITLE","File Management Administration"); +define("_MD_UPLOADTITLE","File Management - Add new file"); +define("_MD_CATEGORYTITLE","File Listing - Category View"); +define("_MD_DLCONF","Downloads Configuration"); +define("_MD_GENERALSET","Configuration Settings"); +define("_MD_ADDMODFILENAME","Add new file"); +define ("_MD_ADDCATEGORYSNAP", "Optional Image: <small>(Top Level Categories only)</small>"); +define ("_MD_ADDIMAGENOTE", "(Image height will be resized to 50)"); +define("_MD_ADDMODCATEGORY","<b>Categories:</b> Add, Modify, and Delete Categories"); +define("_MD_DLSWAITING","Downloads Waiting for Validation"); +define("_MD_BROKENREPORTS","Broken File Reports"); +define("_MD_MODREQUESTS","Download Info Modification Requests"); +define("_MD_EMAILOPTION","Email submitter if file approved: "); +define("_MD_COMMENTOPTION","Enable comments:"); +define("_MD_SUBMITTER","Submitter: "); +define("_MD_DOWNLOAD","Download"); +define("_MD_FILELINK","File Link"); +define("_MD_SUBMITTEDBY","Submitted by: "); +define("_MD_APPROVE","Approve"); +define("_MD_DELETE","Delete"); +define("_MD_NOSUBMITTED","No New Submitted Downloads."); +define("_MD_ADDMAIN","Add MAIN Category"); +define("_MD_TITLEC","Title: "); +define("_MD_CATSEC", "Category Access: "); +define("_MD_IMGURL","<br>Image Filename <font size='-2'> (located in your filemgmt_data/category_snaps directory - Image height will be resized to 50)</font>"); +define("_MD_ADD","Add"); +define("_MD_ADDSUB","Add SUB-Category"); +define("_MD_IN","in"); +define("_MD_ADDNEWFILE","Add New File"); +define("_MD_MODCAT","Modify Category"); +define("_MD_MODDL","Modify Download Info"); +define("_MD_USER","User"); +define("_MD_IP","IP Address"); +define("_MD_USERAVG","User AVG Rating"); +define("_MD_TOTALRATE","Total Ratings"); +define("_MD_NOREGVOTES","No Registered User Votes"); +define("_MD_NOUNREGVOTES","No Unregistered User Votes"); +define("_MD_VOTEDELETED","Vote data deleted."); +define("_MD_NOBROKEN","No reported broken files."); +define("_MD_IGNOREDESC","Ignore (Ignores the report and only deletes this reported entry</b>)"); +define("_MD_DELETEDESC","Delete (Deletes <b>the reported file entry in the repository</b> but not the actual file)"); +define("_MD_REPORTER","Report Sender"); +define("_MD_FILESUBMITTER","File Submitter"); +define("_MD_IGNORE","Ignore"); +define("_MD_FILEDELETED","File Deleted."); +define("_MD_FILENOTDELETED","Record was removed but File was not Deleted.<p>More then 1 record pointing to same file."); +define("_MD_BROKENDELETED","Broken file report deleted."); +define("_MD_USERMODREQ","User Download Info Modification Requests"); +define("_MD_ORIGINAL","Original"); +define("_MD_PROPOSED","Proposed"); +define("_MD_OWNER","Owner: "); +define("_MD_NOMODREQ","No Download Modification Request."); +define("_MD_DBUPDATED","Database Updated Successfully!"); +define("_MD_MODREQDELETED","Modification Request Deleted."); +define("_MD_IMGURLMAIN","Image (Image height will be resized to 50): "); +define("_MD_PARENT","Parent Category:"); +define("_MD_SAVE","Save Changes"); +define("_MD_CATDELETED","Category Deleted."); +define("_MD_WARNING","WARNING: Are you sure you want to delete this Category and ALL its Files and Comments?"); +define("_MD_YES","Yes"); +define("_MD_NO","No"); +define("_MD_NEWCATADDED","New Category Added Successfully!"); +define("_MD_CONFIGUPDATED","New configuration saved"); +define("_MD_ERROREXIST","ERROR: The download info you provided is already in the database!"); +define("_MD_ERRORNOFILE","ERROR: File not found on record in the database!"); +define("_MD_ERRORTITLE","ERROR: You need to enter TITLE!"); +define("_MD_ERRORDESC","ERROR: You need to enter DESCRIPTION!"); +define("_MD_NEWDLADDED","New download added to the database."); +define("_MD_NEWDLADDED_DUPFILE","Warning: Duplicate File. New download added to the database."); +define("_MD_NEWDLADDED_DUPSNAP","Warning: Duplicate Snap. New download added to the database."); +define("_MD_HELLO","Hello %s"); +define("_MD_WEAPPROVED","We approved your download submission to our downloads section. The file name is: "); +define("_MD_THANKSSUBMIT","Thanks for your submission!"); +define("_MD_UPLOADAPPROVED","Your uploaded file was approved"); +define("_MD_DLSPERPAGE","Displayed Downloads per Page: "); +define("_MD_HITSPOP","Hits to be Popular: "); +define("_MD_DLSNEW","Number of Downloads as New on Top Page: "); +define("_MD_DLSSEARCH","Number of Downloads in Search Results: "); +define("_MD_TRIMDESC","Trim File Descriptions in Listing: "); +define("_MD_DLREPORT","Restrict access to Download report"); +define("_MD_WHATSNEWDESC","Enable WhatsNew Listing"); +define("_MD_SELECTPRIV","Restrict access to group 'Logged-In Users' only: "); +define("_MD_ACCESSPRIV","Enable Anonymous access: "); +define("_MD_UPLOADSELECT","Allow Logged-In uploads: "); +define("_MD_UPLOADPUBLIC","Allow Anonymous uploads: "); +define("_MD_USESHOTS","Display Category Images: "); +define("_MD_IMGWIDTH","Thumbnail Img Width: "); +define("_MD_MUSTBEVALID","Thumbnail image must be a valid image file under %s directory (ex. shot.gif). Leave it blank if no image file."); +define("_MD_REGUSERVOTES","Registered User Votes (total votes: %s)"); +define("_MD_ANONUSERVOTES","Anonymous User Votes (total votes: %s)"); +define("_MD_YOURFILEAT","Your file submitted at %s"); // this is an approved mail subject. %s is your site name +define("_MD_VISITAT","Visit our downloads section at %s"); +define("_MD_DLRATINGS","Download Rating (total votes: %s)"); +define("_MD_CONFUPDATED","Configuration Updated Successfully!"); +define("_MD_NOFILES","No Files Found"); + +// Additional Geeklog Defines +define("_MD_NOVOTE","Not rated yet"); +define("_IFNOTRELOAD","If the page does not automatically reload, please click <a href=%s>here</a>"); +define("_GL_ERRORNOACCESS","ERROR: No access to this Document Repository Section"); +define("_GL_ERRORNOUPLOAD","ERROR: You do not have upload privilages"); +define("_GL_ERRORNOADMIN","ERROR: This function is restricted"); +define("_GL_NOUSERACCESS","does not have access to the Document Repository"); +define("_MD_ERRUPLOAD","Filemgmt: Unable to upload - check permissions for the file store directories"); +define("_MD_DLFILENAME","Filename: "); +define("_MD_REPLFILENAME","Replacement File: "); +define("_MD_SCREENSHOT","Screenshot"); +define("_MD_SCREENSHOT_NA",' '); +define("_MD_COMMENTSWANTED","Comments are appreciated"); +define("_MD_CLICK2SEE","Click to see: "); +define("_MD_CLICK2DL","Click to download: "); +define("_MD_ORDERBY","Order By: "); +define("_MD_ORDERBY","Order By: "); +define("_MD_ORDERBY","Order By: "); + +?> \ No newline at end of file Added: trunk/plugins/filemgmt/language/japanese.php ============================================================================== --- (empty file) +++ trunk/plugins/filemgmt/language/japanese.php Sun Sep 21 23:48:51 2008 @@ -0,0 +1,379 @@ +<?php + +############################################################################### +# lang.php +# This is the english language page for the Geeklog File Mgmt Page Plug-in! +# +# Copyright (C) 2002 Blaine Lang +# blain****@porta***** +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################### +# Tranlated by mystral_kk 2006/03/23 +// �ǽ�������2006/04/18 for Ver1.5.2 +// Language variables used by the Plug-in API +# ����ϡ�Geeklog�ե��������ץ饰���������ܸ���ե�����Ǥ��� +# plugins/filemgmt/language/japanese.php +# �⤷��쥨���ɤμ��ब��euc�Ǥʤ����ϡ�euc���Ѵ����Ƥ�������� +# Last Update 2007/06/16 by Ivy (Geeklog Japanese) + +$LANG_FM00 = array ( + 'access_denied' => '������������', + 'access_denied_msg' => 'Root�桼�����������Υڡ����ˤϥ��������Ǥ��ޤ����ʤ���̾���IP�ϵ�Ͽ����ޤ�����', + 'admin' => '�ץ饰��������', + 'install_header' => '�ץ饰����Υ��ȡ���/���ȡ���', + 'installed' => '���Υץ饰����ȥ֥�å��ϥ��ȡ��뤵��Ƥ��ޤ���<p><i>�ڤ���Ǥ��������<br><a href="MAILTO:blain****@porta*****">Blaine</a></i>', + 'uninstalled' => '���Υץ饰����ϥ��ȡ��뤵��Ƥ��ޤ���', + 'install_success' => '���ȡ�������ޤ�����<p><b>���줫�餹�٤����ϡ�</b>: + <ol><li>�ե���������å����ơ��ץ饰����������Ԥ���</ol> + <p>�ܺپ���ϡ�<a href="%s">Install Notes</a>�ȡ�', + 'install_failed' => '���ȡ���˼��Ԥ��ޤ��������顼���Ƥ��������', + 'uninstall_msg' => '���Υץ饰����ϥ��ȡ��뤵��ޤ�����', + 'install' => '���ȡ���', + 'uninstall' => '���ȡ���', + 'editor' => '�ץ饰���ǥ���', + 'warning' => '���ȡ�����ηٹ�', + 'enabled' => '<p style="padding: 15px 0px 5px 25px;">���Υץ饰����ϥ��ȡ��뤵�졤ͭ��ˤʤäƤ��ޤ���<br>���ȡ��뤹����ˡ����Υץ饰�����̵��ˤ��Ƥ��������</p><div style="padding:5px 0px 5px 25px;"><a href="'.$_CONF['site_admin_url'].'/plugins.php">Plugin Editor</a></div', + 'WhatsNewLabel' => '����ե�����', + 'WhatsNewPeriod' => '(%s �����)' +); + +// Admin Navbar +$LANG_FM02 = array( + 'nav1' => '����', + 'nav2' => '���ƥ���', + 'nav3' => '�ե�������ɲ�', + 'nav4' => '�������� (%s)', + 'nav5' => '��»�ե����� (%s)' +); + +$LANG_FILEMGMT= array( + 'newpage' => "�����ڡ���", + 'adminhome' => "�����HOME", + 'plugin_name' => "�ե��������", + 'searchlabel' => "�ե�����ꥹ��", + 'searchlabel_results' => "�ե�����ꥹ�ȷ��", + 'downloads' => "��������", + 'report' => "�������ɲ���¿�����", + 'usermenu1' => "��������", + 'usermenu2' => " ���", + 'usermenu3' => "�ե����륢�åץ���", + 'admin_menu' => "�ե��������", + 'writtenby' => "���", + 'date' => "������", + 'title' => "�����ȥ�", + 'content' => "����", + 'hits' => "�������ɲ��", + 'Filelisting' => "�ե�����ꥹ��", + 'DownloadReport' => "�ե�������Υ�����������", + 'StatsMsg1' => "�������ɲ��ξ��10��", + 'StatsMsg2' => "���Υ����Ȥˤϥե��������ץ饰�����Ѥ����ե����뤬�ʤ��������ե�����˥������������ͤ����ʤ��褦�Ǥ���", + 'usealtheader' => "Alt. Header����Ѥ��Ƥ��������", + 'url' => "URL", + 'edit' => "�Խ�", + 'lastupdated' => "�ǿ��ե�����", + 'pageformat' => "�ڡ����ե����ޥå�", + 'leftrightblocks' => "�������֥�å�", + 'blankpage' => "����ڡ���", + 'noblocks' => "�֥�å��ʤ�", + 'leftblocks' => "���֥�å�", + 'addtomenu' => '��˥塼�ɲ�', + 'label' => '��٥�', + 'nofiles' => '�ե������ (��������)', + 'save' => '��¸', + 'preview' => '�ץ�ӥ塼', + 'delete' => '���', + 'cancel' => '�����', + 'access_denied' => '������������', + 'invalid_install' => '�ե��������ץ饰����Υ��ȡ���/���ȡ���ڡ���������˥����������褦�Ȥ����ͤ����ޤ����桼����ID: ', + 'start_install' => '�ե��������ץ饰����ȡ��뤷�褦�Ȥ��Ƥ��ޤ���', + 'start_dbcreate' => '�ե��������ץ饰�����Ѥ˥ơ��֥�������褦�Ȥ��Ƥ��ޤ���', + 'install_skip' => '... skipped as per filemgmt.cfg', + 'access_denied_msg' => '���ʤ��ϥե��������ץ饰�����admin�ڡ���������˥����������褦�Ȥ��Ƥ��ޤ��͡����Υڡ����ؤ�����ʥ�����������Ƶ�Ͽ����ޤ���', + 'installation_complete' => '���ȡ��봰λ', + 'installation_complete_msg' => 'Geeklog�ѥե��������ץ饰����Υǡ�����¤���ǡ����١����˥��ȡ��뤵��ޤ���������줳�Υץ饰����ȡ��뤹��ɬ�פ�����ʤ顤���Υץ饰������°��README���ɤߤ��������', + 'installation_failed' => '���ȡ��뼺��', + 'installation_failed_msg' => '�ե��������ץ饰����Υ��ȡ���˼��Ԥ��ޤ������������ˤ�error.log��������', + 'system_locked' => '�����ƥ�ϥ�å�����Ƥ��ޤ�', + 'system_locked_msg' => '�ե��������ץ饰����ϥ��ȡ��뤵�졤��å�����Ƥ��ޤ������ȡ��뤹��ʤ顤��°��README���ɤߤ��������', + 'uninstall_complete' => '���ȡ��봰λ', + 'uninstall_complete_msg' => '�ե��������ץ饰���ѤΥǡ�����¤�ϥǡ����١����������ޤ�������<br><br>�ե������֤���(repository)�ˤ���ե�����ϼ�ư�Ǻ���ɬ�פ�����ޤ���', + 'uninstall_failed' => '���ȡ���˼��Ԥ��ޤ�����', + 'uninstall_failed_msg' => '�ե��������ץ饰����Υ��ȡ���˼��Ԥ��ޤ������������ˤ�error.log��������', + 'install_noop' => '�ץ饰���ȡ���', + 'install_noop_msg' => '�ե��������ץ饰����Υ��ȡ��뤬�¹Ԥ���ޤ����������٤����Ȥ�����ޤ���Ǥ�����<br><br>�ץ饰���������ե�������ǧ���Ƥ��������', + 'all_html_allowed' => 'HTML����Ƶ�Ĥ���Ƥ��ޤ�', + 'no_new_files' => '-', + 'no_comments' => '-', + 'more' => '<em>[�ʸɽ��]</em>' +); + +$PLG_filemgmt_MESSAGE1 = '�ե��������ץ饰����Υ��ȡ�������Ǥ��ޤ�����<br>�ե�����: plugins/filemgmt/filemgmt.php �����߲ĤˤʤäƤ��ޤ���'; +$PLG_filemgmt_MESSAGE3 = '���Υץ饰����ˤ�Geeklog Version 1.4 �ʹߤ�ɬ�פǤ������åץ��졼�ɤ����Ǥ��ޤ�����'; +$PLG_filemgmt_MESSAGE4 = '���Υץ饰����� version 1.5 �ѤΥ����ɤФǤ��ޤ����åץ��졼�ɤ����Ǥ��ޤ�����'; +$PLG_filemgmt_MESSAGE5 = '�ե��������ץ饰����Υ��åץ��졼�ɤ����Ǥ��ޤ�����<br>���ߤΥץ饰����ΥС������� 1.3 �ǤϤ���ޤ���'; + + +// Language variables used by the plugin - general users access code. + +define("_MD_THANKSFORINFO","�������꤬�Ȥ��������ޤ��������Τ���ꥯ�����Ȥ�Ĵ�٤Ƥߤޤ���"); +define("_MD_BACKTOTOP","�������ɥȥåפ����"); +define("_MD_THANKSFORHELP","���Υǥ��쥯�ȥ�η�����ΰݻ�ˤ����Ϥ�����������꤬�Ȥ��������ޤ���"); +define("_MD_FORSECURITY","�������ƥ������ͳ�Ǥ��ʤ��Υ桼����̾��IP���ɥ쥹����Ū�˵�Ͽ����ޤ���"); + +define("_MD_SEARCHFOR","�����о�"); +define("_MD_MATCH","����"); +define("_MD_ALL","���"); +define("_MD_ANY","�ɤ줫1�ĤǤ�"); +define("_MD_NAME","̾�"); +define("_MD_DESCRIPTION","����"); +define("_MD_SEARCH","����"); + +define("_MD_MAIN","�ᥤ��"); +define("_MD_SUBMITFILE","�ե�������"); +define("_MD_POPULAR","���"); +define("_MD_NEW","New"); +define("_MD_TOPRATED","���"); + +define("_MD_NEWTHISWEEK","�����ο����ե�����"); +define("_MD_UPTHISWEEK","�����������줿�ե�����"); + +define("_MD_POPULARITYLTOM","�������ɲ�� (���ʤ���ν�)"); +define("_MD_POPULARITYMTOL","�������ɲ�� (¿����)"); +define("_MD_TITLEATOZ","�����ȥ�(A to Z)"); +define("_MD_TITLEZTOA","�����ȥ�(Z to A)"); +define("_MD_DATEOLD","����(�ս�)"); +define("_MD_DATENEW","����(�����)"); +define("_MD_RATINGLTOH","ɾ��(�㤤��)"); +define("_MD_RATINGHTOL","ɾ��(�⤤��)"); + +define("_MD_NOSHOTS","����͡������ʤ�"); +define("_MD_EDITTHISDL","�������ɥե������Խ�"); + +define("_MD_LISTINGHEADING","<b>�ե�����ꥹ��: %s �濫��ޤ���</b>"); +define("_MD_LATESTLISTING","<b>�ǿ��ꥹ��:</b>"); +define("_MD_DESCRIPTIONC","����:"); +define("_MD_EMAILC","Email: "); +define("_MD_CATEGORYC","���ƥ���: "); +define("_MD_LASTUPDATEC","�ǿ����åץǡ���: "); +define("_MD_DLNOW","�������ɤ��Ƥ��������"); +define("_MD_VERSION","�С������"); +define("_MD_SUBMITDATE","����"); +define("_MD_DLTIMES","�������� %s ��"); +define("_MD_FILESIZE","�ե����륵����"); +define("_MD_SUPPORTEDPLAT","���ݡ��Ȥ���Ƥ���ץ�åȥե�����"); +define("_MD_HOMEPAGE","�ۡ���ڡ���"); +define("_MD_HITSC","�������ɲ��: "); +define("_MD_RATINGC","ɾ��: "); +define("_MD_ONEVOTE","1 ��ɼ"); +define("_MD_NUMVOTES","(%s)"); +define("_MD_NOPOST","�ʤ�"); +define("_MD_NUMPOSTS","��ɼ��: %s"); +define("_MD_COMMENTSC","������: "); +define ("_MD_ENTERCOMMENT", "�����Ⱥ��"); +define("_MD_RATETHISFILE","���Υե������ɾ��"); +define("_MD_MODIFY","�Խ�"); +define("_MD_REPORTBROKEN","��»�ե�����"); +define("_MD_TELLAFRIEND","ͧ�ͤ˶�����"); +define("_MD_VSCOMMENTS","�����Ȥ�/���"); +define("_MD_EDIT","�Խ�"); + +define("_MD_THEREARE"," %s �ե����뤢��ޤ���"); +define("_MD_LATESTLIST","�ǿ��ꥹ��"); + +define("_MD_REQUESTMOD","�������ɥե������Խ�"); +define("_MD_FILE","�ե�����"); +define("_MD_FILEID","�ե�����ID: "); +define("_MD_FILETITLE","�����ȥ�: "); +define("_MD_DLURL","��������URL: "); +define("_MD_HOMEPAGEC","�ۡ���ڡ���: "); +define("_MD_VERSIONC","�С������: "); +define("_MD_FILESIZEC","�ե����륵����: "); +define("_MD_NUMBYTES","%s �Х���"); +define("_MD_PLATFORMC","�ץ�åȥե�����: "); +define("_MD_CONTACTEMAIL","Ϣ����E-mail: "); +define("_MD_SHOTIMAGE","����͡������: "); +define("_MD_SENDREQUEST","����"); + +define("_MD_VOTEAPPRE","��ɼ�˴��դ��ޤ���"); +define("_MD_THANKYOU","%s ����ɼ���Ƥ�����������꤬�Ȥ��������ޤ�����"); // %s is your site name +define("_MD_VOTEFROMYOU","���ʤ����Ȥ����Ϥ��Ƥ������С�¾��ˬ��Ԥ��������ɤ��٤��ե���������Τ���Ω��ޤ���"); +define("_MD_VOTEONCE","Ʊ���ե�����ˤ�1����ɼ�Ǥ��ޤ���"); +define("_MD_RATINGSCALE","ɾ����� 1 (�㤤)���� 10 (�⤤)�ޤǤǤ���"); +define("_MD_BEOBJECTIVE","�Ҵ�Ū�ˤ��ꤤ���ޤ������ 1 �� 10 ��ɾ�������ʤ��ʤ顤 ɾ��Ϥ��ޤ����Ω��ޤ���"); +define("_MD_DONOTVOTE","��ʬ���Ȥ������ե�����ˤ���ɼ�Ǥ��ޤ���"); +define("_MD_RATEIT","ɾ����Ƥ��������"); + +define("_MD_INTFILEAT","%s �Ǥ����ܥ�������"); // %s is your site name +define("_MD_INTFILEFOUND","%s �Ǹ��Ĥ������դ�����Ǥ���"); // %s is your site name + +define("_MD_RECEIVED","�������ɾ��������ޤ��������꤬�Ȥ��������ޤ���"); +define("_MD_WHENAPPROVED","��ǧ���줿���뤬�Ϥ��ޤ���"); +define("_MD_SUBMITONCE","���٤���¹Ԥ��Ƥ��������"); +define("_MD_APPROVED", "���ʤ��Υե�����Ͼ�ǧ����ޤ�����"); +define("_MD_ALLPENDING","���٤ƤΥե���������̤���ھ��֤Ǥ���"); +define("_MD_DONTABUSE","�桼����̾�� IP �ϵ�Ͽ����Ƥ��ޤ���"); +define("_MD_TAKEDAYS","�ե�����/������ץȤ��ǡ����١�������Ͽ�����ޤǿ�����礬����ޤ���"); + +define("_MD_RANK","���"); +define("_MD_CATEGORY","���ƥ���"); +define("_MD_HITS","�������ɲ��"); +define("_MD_RATING","ɾ��"); +define("_MD_VOTE","��ɼ"); + +define("_MD_SEARCHRESULT4","������ <b>%s</b>:"); +define("_MD_MATCHESFOUND","%s ����פ��ޤ�����"); +define("_MD_SORTBY","�����ȴ��:"); +define("_MD_TITLE","�����ȥ�"); +define("_MD_DATE","����"); +define("_MD_POPULARITY","�͵�"); +define("_MD_CURSORTBY","ɽ�������Ƚ�: "); +define("_MD_FOUNDIN","���Ĥ���ޤ���:"); +define("_MD_PREVIOUS","���"); +define("_MD_NEXT","����"); +define("_MD_NOMATCH","������˰��פ����ΤϤ���ޤ���"); + +define("_MD_TOP10","%s �ξ��10"); // %s is a downloads category name +define("_MD_CATEGORIES","���ƥ���"); + +define("_MD_SUBMIT","�¹�"); +define("_MD_CANCEL","�����"); + +define("_MD_BYTES","Bytes"); +define("_MD_ALREADYREPORTED","��»�ե�����˴ؤ����ݡ��Ȥ���Ф��ޤ�����"); +define("_MD_MUSTREGFIRST","���Υ���������¹Ԥ���ѡ��ߥå������ޤ���<br>��Ͽ���뤫�����Ƥ��������"); +define("_MD_NORATING","ɾ����ʤ���Ƥ��ޤ���"); +define("_MD_CANTVOTEOWN","��ʬ���Ȥ������ե�����ˤ���ɼ�Ǥ��ޤ���<br>��ɼ����Ƶ�Ͽ���졤��Ƥ����Ƥ��ޤ���"); + +// Language variables used by the plugin - Admin code. + +define("_MD_RATEFILETITLE","�ե�����ɾ���Ͽ���Ƥ��������"); +define("_MD_ADMINTITLE","�ե�����������ԥ�˥塼"); +define("_MD_UPLOADTITLE","�ե�������� - �ե�����Υ��åץ���"); +define("_MD_CATEGORYTITLE","�ꥹ�� - ���ƥ���"); +define("_MD_DLCONF","������������"); +define("_MD_GENERALSET","�ե������������"); +define("_MD_ADDMODFILENAME","�ե�����Υ��åץ���"); +define ("_MD_ADDCATEGORYSNAP", "����: <small>(���ץ���ȥåץ�٥륫�ƥ���Τ�)</small>"); +define ("_MD_ADDIMAGENOTE", "(����ι⤵��� 50)"); +define("_MD_ADDMODCATEGORY","<b>���ƥ���:</b> ���ƥ�����ɲ�/���/���"); +define("_MD_DLSWAITING","�������ɵ���Ԥ�"); +define("_MD_BROKENREPORTS","��»�ե������ݡ���"); +define("_MD_MODREQUESTS","�������ɾ������"); +define("_MD_EMAILOPTION","��ǧ���Υ��ȯ����: "); +define("_MD_COMMENTOPTION","�����ȵ��:"); +define("_MD_SUBMITTER","��: "); +define("_MD_DOWNLOAD","��������"); +define("_MD_FILELINK","�ʸɽ��"); +define("_MD_SUBMITTEDBY","�ե�������: "); +define("_MD_APPROVE","��ǧ"); +define("_MD_DELETE","���"); +define("_MD_NOSUBMITTED","���������줿�������ɥե�����Ϥ���ޤ���"); +define("_MD_ADDMAIN","�祫�ƥ����ɲ�"); +define("_MD_TITLEC","�����ȥ�: "); +define("_MD_CATSEC", "���ƥ���ؤΥ�������: "); +define("_MD_IMGURL","<br>����ե�����̾ <font size='-2'> (filemgmt_data/category_snaps�ˤ���ޤ� - ����ι⤵��� 50)</font>"); +define("_MD_ADD","�ɲ�"); +define("_MD_ADDSUB","���֥��ƥ����ɲ�"); +define("_MD_IN","in"); +define("_MD_ADDNEWFILE","�����ե����륢�åץ���"); +define("_MD_MODCAT","���ƥ��꽤�"); +define("_MD_MODDL","�������ɾ����ѹ�"); +define("_MD_USER","�桼����"); +define("_MD_IP","IP���ɥ쥹"); +define("_MD_USERAVG","�桼����ɾ���ʿ��"); +define("_MD_TOTALRATE","�ɾ��"); +define("_MD_NOREGVOTES","��Ͽ�Ѥߥ桼�����ˤ����ɼ�ʤ�"); +define("_MD_NOUNREGVOTES","̤��Ͽ�Ѥߥ桼�����ˤ����ɼ�ʤ�"); +define("_MD_VOTEDELETED","��ɼ�ǡ����Ϻ���Ƥ��ޤ���"); +define("_MD_NOBROKEN","��»�ե�����Ϥ���ޤ���"); +define("_MD_IGNOREDESC","̵��(��ݡ��Ȥ�̵�뤷�ơ���ݡ��ȤΤ��ä����ι��ܤ�������)"); +define("_MD_DELETEDESC","���(<b>��ݡ��ȤΤ��ä��������ɤΥǡ���</b>�����)"); +define("_MD_REPORTER","��ݡ�����м�"); +define("_MD_FILESUBMITTER","�ե�������"); +define("_MD_IGNORE","̵��"); +define("_MD_FILEDELETED","�ե�����Ϻ���ޤ�����"); +define("_MD_FILENOTDELETED","��Ͽ�Ϻ���ޤ��������ե�����Ϻ���ޤ���Ǥ�����<p>ʣ��ε�Ͽ��Ʊ���ե������ؤ��Ƥ��ޤ���</p>"); +define("_MD_BROKENDELETED","��»�ե�����Υ�ݡ��ȤϺ���ޤ�����"); +define("_MD_USERMODREQ","�桼�����ˤ��������ɾ������"); +define("_MD_ORIGINAL","���ꥸ�ʥ�"); +define("_MD_PROPOSED","���"); +define("_MD_OWNER","��ͭ��: "); +define("_MD_NOMODREQ","�������ɽ����Ϥ���ޤ���"); +define("_MD_DBUPDATED","�ǡ����١����Ϲ�������ޤ�����"); +define("_MD_MODREQDELETED","�����Ϻ���ޤ�����"); +define("_MD_IMGURLMAIN","����(����ι⤵��� 50): "); +define("_MD_PARENT","��̥��ƥ���:"); +define("_MD_SAVE","�ѹ�����¸"); +define("_MD_CATDELETED","���ƥ��꤬����ޤ�����"); +define("_MD_WARNING","�ٹ�: ���Υ��ƥ���ȥ��ƥ��������ե�����/�����Ȥ���ޤ�����"); +define("_MD_YES","Yes"); +define("_MD_NO","No"); +define("_MD_NEWCATADDED","���ƥ��꤬�������ɲä���ޤ�����"); +define("_MD_CONFIGUPDATED","���꤬��¸����ޤ�����"); +define("_MD_ERROREXIST","���顼: ���ʤ��������������ɾ���ϴ�˥ǡ����١�������Ͽ����Ƥ��ޤ���"); +define("_MD_ERRORNOFILE","���顼: �ե����뤬�ǡ����١����ε�Ͽ�ˤ���ޤ���"); +define("_MD_ERRORTITLE","���顼: �����ȥ�����Ϥ��Ƥ��������"); +define("_MD_ERRORDESC","���顼: ��������Ϥ��Ƥ��������"); +define("_MD_NEWDLADDED","�������ɥե����뤬�����˥ǡ����١������ɲä���ޤ�����"); +define("_MD_NEWDLADDED_DUPFILE","�ٹ�: �ե����뤬��ʣ���Ƥ��ޤ����������ɥե����뤬�����˥ǡ����١������ɲä���ޤ�����"); +define("_MD_NEWDLADDED_DUPSNAP","�ٹ�: ���ʥåפ���ʣ���Ƥ��ޤ����������ɥե����뤬�����˥ǡ����١������ɲä���ޤ�����"); +define("_MD_HELLO","����ˤ�ϡ�%s ����"); +define("_MD_WEAPPROVED","���Ƥ���������������ɥե�����Ͼ�ǧ����ޤ������ե�����̾: "); +define("_MD_THANKSSUBMIT","�����꤬�Ȥ��������ޤ�����"); +define("_MD_UPLOADAPPROVED","���ʤ������åץ��ɤ����ե�����Ͼ�ǧ����ޤ�����"); +define("_MD_DLSPERPAGE","1 �ڡ����������ɽ�����: "); +define("_MD_HITSPOP","�������ɷ���¿����ɽ�����: "); +define("_MD_DLSNEW","�����ڡ����� 1 �ڡ����������ɽ�����: "); +define("_MD_DLSSEARCH","��������Υ������ɥե������: "); +define("_MD_TRIMDESC","�ꥹ�ƥ���: "); +define("_MD_DLREPORT","����������¥������ɥ�ݡ���"); +define("_MD_WHATSNEWDESC","�����������ɽ��"); +define("_MD_SELECTPRIV","������桼�����Υ������ɤ���: "); +define("_MD_ACCESSPRIV","�����Ƥ��ʤ��桼�����Υ������ɤ���: "); +define("_MD_UPLOADSELECT","������桼�����Υ��åץ��ɤ���: "); +define("_MD_UPLOADPUBLIC","�����Ƥ��ʤ��桼�����Υ��åץ��ɤ���: "); +define("_MD_USESHOTS","���ƥ������ɽ��: "); +define("_MD_IMGWIDTH","������: "); +define("_MD_MUSTBEVALID","����͡������� %s �ǥ��쥯�ȥ����ͭ��ʲ���ե�����Ǥʤ���Фʤ�ޤ���(�� shot.gif)������ե����뤬�ʤ���ж���ˤ��Ƥ����Ƥ��������"); +define("_MD_REGUSERVOTES","��Ͽ�Ѥߥ桼�����ˤ����ɼ(��ɼ���: %s)"); +define("_MD_ANONUSERVOTES","̤��Ͽ�桼�����ˤ����ɼ(��ɼ���: %s)"); +define("_MD_YOURFILEAT","���ʤ��� %s �������ե�����"); // this is an approved mail subject. %s is your site name +define("_MD_VISITAT","%s �Υ������������������"); +define("_MD_DLRATINGS","��������ɾ��(��ɼ���: %s)"); +define("_MD_CONFUPDATED","���꤬��������ޤ�����"); +define("_MD_NOFILES","�ե����뤬����ޤ���"); + +// Additional Geeklog Defines +define("_MD_NOVOTE","�ޤ�ɾ�����Ƥ��ޤ���"); +define("_IFNOTRELOAD","�ڡ�������ưŪ�˥���ɤ���ʤ��ʤ顤<a href='%s'>����</a>��å����Ƥ��������"); +define("_GL_ERRORNOACCESS","���顼: �ɥ����������Υե������֤���˥��������Ǥ��ޤ���"); +define("_GL_ERRORNOUPLOAD","���顼: �ե�����åץ��ɤ��븢�¤�����ޤ���"); +define("_GL_ERRORNOADMIN","���顼: ���ε�ǽ����¤���Ƥ��ޤ���"); +define("_GL_NOUSERACCESS","�ɥ����������Υե������֤���˥��������Ǥ��ޤ���"); +define("_MD_ERRUPLOAD","�ե��������: ���åץ��ɤǤ��ޤ���Ǥ������ե��������¸����ǥ��쥯�ȥ�Υѡ��ߥå������ǧ���Ƥ��������"); +define("_MD_DLFILENAME","�ե�����̾: "); +define("_MD_REPLFILENAME","����ؤ��ѥե�����: "); +define("_MD_SCREENSHOT","�����"); +define("_MD_SCREENSHOT_NA"," "); +define("_MD_COMMENTSWANTED","�����ȴ���"); +define("_MD_CLICK2SEE","����å����Ƥ������: "); +define("_MD_CLICK2DL","����å����ơ��������ɤ��Ƥ������: "); +define("_MD_ORDERBY","������: "); +define("_MD_ORDERBY","������: "); +define("_MD_ORDERBY","������: "); + +?> \ No newline at end of file Added: trunk/plugins/filemgmt/language/japanese_utf-8.php ============================================================================== --- (empty file) +++ trunk/plugins/filemgmt/language/japanese_utf-8.php Sun Sep 21 23:48:51 2008 @@ -0,0 +1,379 @@ +<?php + +############################################################################### +# lang.php +# This is the english language page for the Geeklog File Mgmt Page Plug-in! +# +# Copyright (C) 2002 Blaine Lang +# blain****@porta***** +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################### +# Tranlated by mystral_kk 2006/03/23 +// 最終更新 2006/04/18 for Ver1.5.2 +// Language variables used by the Plug-in API +# これは、Geeklogファイル管理プラグイン用日本語言語ファイルです。 +# plugins/filemgmt/language/japanese_utf-8.php +# もし万一エンコードの種類が UTF-8でない場合は、utf-8に変換してください。 +# Last Update 2007/06/16 by Ivy (Geeklog Japanese) + +$LANG_FM00 = array ( + 'access_denied' => 'アクセス拒否', + 'access_denied_msg' => 'Rootユーザーしかこのページにはアクセスできませ ん。あなたの名前とIPは記録されました。', + 'admin' => 'プラグイン管理者', + 'install_header' => 'プラグインのインストール/アンインストール', + 'installed' => 'このプラグインとブロックはインストールされてい ます。<p><i>楽しんでください。<br><a href="MAILTO:blain****@porta*****">Blaine</a></i>', + 'uninstalled' => 'このプラグインはインストールされていません。', + 'install_success' => 'インストールに成功しました。<p><b>これからすべ き手順は,</b>: + <ol><li>ファイル管理をクリックして,プラグインの設定を行う。</ol> + <p>詳細情報は,<a href="%s">Install Notes</a>を参照。', + 'install_failed' => 'インストールに失敗しました。エラーログを見てく ださい。', + 'uninstall_msg' => 'このプラグインはアンインストールされました。', + 'install' => 'インストール', + 'uninstall' => 'アンインストール', + 'editor' => 'プラグインエディタ', + 'warning' => 'アンインストール前の警告', + 'enabled' => '<p style="padding: 15px 0px 5px 25px;">このプラ グインはインストールされ,有効になっています。<br>アンインストールする前 に,このプラグインを無効にしてください。</p><div style="padding:5px 0px 5px 25px;"><a href="'.$_CONF['site_admin_url'].'/plugins.php">Plugin Editor</a></div', + 'WhatsNewLabel' => '新着ファイル', + 'WhatsNewPeriod' => '(%s 日以内)' +); + +// Admin Navbar +$LANG_FM02 = array( + 'nav1' => '設定', + 'nav2' => 'カテゴリ', + 'nav3' => 'ファイルを追加', + 'nav4' => 'ダウンロード (%s)', + 'nav5' => '破損ファイル (%s)' +); + +$LANG_FILEMGMT= array( + 'newpage' => "新規ページ", + 'adminhome' => "管理者HOME", + 'plugin_name' => "ファイル管理", + 'searchlabel' => "ファイルリスト", + 'searchlabel_results' => "ファイルリスト結果", + 'downloads' => "ダウンロード", + 'report' => "ダウンロード回数の多いもの", + 'usermenu1' => "ダウンロード", + 'usermenu2' => " 上位", + 'usermenu3' => "ファイルアップロード", + 'admin_menu' => "ファイル管理", + 'writtenby' => "作者", + 'date' => "更新日", + 'title' => "タイトル", + 'content' => "内容", + 'hits' => "ダウンロード回数", + 'Filelisting' => "ファイルリスト", + 'DownloadReport' => "ファイル毎のダウンロード履歴", + 'StatsMsg1' => "ダウンロード回数の上位10位", + 'StatsMsg2' => "このサイトにはファイル管理プラグイン用の定義ファイルが ないか,定義ファイルにアクセスした人がいないようです。", + 'usealtheader' => "Alt. Headerを使用してください。", + 'url' => "URL", + 'edit' => "編集", + 'lastupdated' => "最新ファイル", + 'pageformat' => "ページフォーマット", + 'leftrightblocks' => "左・右ブロック", + 'blankpage' => "空白ページ", + 'noblocks' => "ブロックなし", + 'leftblocks' => "左ブロック", + 'addtomenu' => 'メニュー追加', + 'label' => 'ラベル', + 'nofiles' => 'ファイル数 (ダウンロード)', + 'save' => '保存', + 'preview' => 'プレビュー', + 'delete' => '削除', + 'cancel' => 'キャンセル', + 'access_denied' => 'アクセス拒否', + 'invalid_install' => 'ファイル管理プラグインのインストール/アンインス トールページに不正にアクセスしようとした人がいます。ユーザーID: ', + 'start_install' => 'ファイル管理プラグインをインストールしようとしてい ます。', + 'start_dbcreate' => 'ファイル管理プラグイン用にテーブルを作成しようとし ています。', + 'install_skip' => '... skipped as per filemgmt.cfg', + 'access_denied_msg' => 'あなたはファイル管理プラグインのadminページに不 正にアクセスしようとしていますね。このページへの不正なアクセスは全て記録され ます。', + 'installation_complete' => 'インストール完了', + 'installation_complete_msg' => 'Geeklog用ファイル管理プラグインのデータ 構造がデータベースにインストールされました! 万一このプラグインをアンインス トールする必要があるなら,このプラグイン付属のREADMEをお読みください。', + 'installation_failed' => 'インストール失敗', + 'installation_failed_msg' => 'ファイル管理プラグインのインストールに失 敗しました。原因究明にはerror.logをごらんください。', + 'system_locked' => 'システムはロックされています', + 'system_locked_msg' => 'ファイル管理プラグインはインストールされ,ロッ クされています。アンインストールするなら,付属のREADMEをお読みください。', + 'uninstall_complete' => 'アンインストール完了', + 'uninstall_complete_msg' => 'ファイル管理プラグ引用のデータ構造はデータ ベースから削除されました。。<br><br>ファイル置き場(repository)にあるファイル は手動で削除する必要があります。', + 'uninstall_failed' => 'アンインストールに失敗しました。', + 'uninstall_failed_msg' => 'ファイル管理プラグインのアンインストールに失 敗しました。原因究明にはerror.logをごらんください。', + 'install_noop' => 'プラグインインストール', + 'install_noop_msg' => 'ファイル管理プラグインのインストールが実行されま したが,すべきことがありませんでした。<br><br>プラグインの設定ファイルを確認 してください。', + 'all_html_allowed' => 'HTMLは全て許可されています', + 'no_new_files' => '-', + 'no_comments' => '-', + 'more' => '<em>[全文表示]</em>' +); + +$PLG_filemgmt_MESSAGE1 = 'ファイル管理プラグインのインストールを中断しまし た。<br>ファイル: plugins/filemgmt/filemgmt.php が書き込み可になっていませ ん。'; +$PLG_filemgmt_MESSAGE3 = 'このプラグインにはGeeklog Version 1.4 以降が必要 です。アップグレードを中断しました。'; +$PLG_filemgmt_MESSAGE4 = 'このプラグインの version 1.5 用のコードを検出でき ません。アップグレードを中断しました。'; +$PLG_filemgmt_MESSAGE5 = 'ファイル管理プラグインのアップグレードを中断しま した。<br>現在のプラグインのバージョンは 1.3 ではありません。'; + + +// Language variables used by the plugin - general users access code. + +define("_MD_THANKSFORINFO","情報提供ありがとうございました。そのうちリクエ ストを調べてみます。"); +define("_MD_BACKTOTOP","ダウンロードトップへ戻る"); +define("_MD_THANKSFORHELP","このディレクトリの健全さの維持にご協力いただ き,ありがとうございます。"); +define("_MD_FORSECURITY","セキュリティ上の理由であなたのユーザー名とIPアド レスも一時的に記録されます。"); + +define("_MD_SEARCHFOR","検索対象"); +define("_MD_MATCH","一致"); +define("_MD_ALL","全部"); +define("_MD_ANY","どれか1つでも"); +define("_MD_NAME","名前"); +define("_MD_DESCRIPTION","説明"); +define("_MD_SEARCH","検索"); + +define("_MD_MAIN","メイン"); +define("_MD_SUBMITFILE","ファイル提供"); +define("_MD_POPULAR","回数"); +define("_MD_NEW","New"); +define("_MD_TOPRATED","上位"); + +define("_MD_NEWTHISWEEK","今週の新規ファイル"); +define("_MD_UPTHISWEEK","今週更新されたファイル"); + +define("_MD_POPULARITYLTOM","ダウンロード回数 (少ないもの順)"); +define("_MD_POPULARITYMTOL","ダウンロード回数 (多い順)"); +define("_MD_TITLEATOZ","タイトル(A to Z)"); +define("_MD_TITLEZTOA","タイトル(Z to A)"); +define("_MD_DATEOLD","日付(逆順)"); +define("_MD_DATENEW","日付(新着順)"); +define("_MD_RATINGLTOH","評価(低い順)"); +define("_MD_RATINGHTOL","評価(高い順)"); + +define("_MD_NOSHOTS","サムネール画像なし"); +define("_MD_EDITTHISDL","ダウンロードファイル編集"); + +define("_MD_LISTINGHEADING","<b>ファイルリスト: %s 件あります。</b>"); +define("_MD_LATESTLISTING","<b>最新リスト:</b>"); +define("_MD_DESCRIPTIONC","説明:"); +define("_MD_EMAILC","Email: "); +define("_MD_CATEGORYC","カテゴリ: "); +define("_MD_LASTUPDATEC","最新アップデート: "); +define("_MD_DLNOW","ダウンロードしてください!"); +define("_MD_VERSION","バージョン"); +define("_MD_SUBMITDATE","日付"); +define("_MD_DLTIMES","ダウンロード %s 回"); +define("_MD_FILESIZE","ファイルサイズ"); +define("_MD_SUPPORTEDPLAT","サポートされているプラットフォーム"); +define("_MD_HOMEPAGE","ホームページ"); +define("_MD_HITSC","ダウンロード回数: "); +define("_MD_RATINGC","評価: "); +define("_MD_ONEVOTE","1 投票"); +define("_MD_NUMVOTES","(%s)"); +define("_MD_NOPOST","なし"); +define("_MD_NUMPOSTS","投票数: %s"); +define("_MD_COMMENTSC","コメント: "); +define ("_MD_ENTERCOMMENT", "コメント作成"); +define("_MD_RATETHISFILE","このファイルを評価"); +define("_MD_MODIFY","編集"); +define("_MD_REPORTBROKEN","破損ファイル"); +define("_MD_TELLAFRIEND","友人に教える"); +define("_MD_VSCOMMENTS","コメントを見る/送る"); +define("_MD_EDIT","編集"); + +define("_MD_THEREARE"," %s ファイルあります。"); +define("_MD_LATESTLIST","最新リスト"); + +define("_MD_REQUESTMOD","ダウンロードファイル編集"); +define("_MD_FILE","ファイル"); +define("_MD_FILEID","ファイルID: "); +define("_MD_FILETITLE","タイトル: "); +define("_MD_DLURL","ダウンロードURL: "); +define("_MD_HOMEPAGEC","ホームページ: "); +define("_MD_VERSIONC","バージョン: "); +define("_MD_FILESIZEC","ファイルサイズ: "); +define("_MD_NUMBYTES","%s バイト"); +define("_MD_PLATFORMC","プラットフォーム: "); +define("_MD_CONTACTEMAIL","連絡先E-mail: "); +define("_MD_SHOTIMAGE","サムネール画像: "); +define("_MD_SENDREQUEST","送信要求"); + +define("_MD_VOTEAPPRE","投票に感謝します。"); +define("_MD_THANKYOU","%s で投票していただき,ありがとうございました。"); // %s is your site name +define("_MD_VOTEFROMYOU","あなた自身が入力してくだされば,他の訪問者がダウ ンロードすべきファイルを決めるのに役立ちます。"); +define("_MD_VOTEONCE","同じファイルには1回しか投票できません。"); +define("_MD_RATINGSCALE","評価基準は 1 (低い)から 10 (高い)までです。"); +define("_MD_BEOBJECTIVE","客観的にお願いします。全員が 1 か 10 の評価しか受 けないなら,評価はあまり役に立ちません。"); +define("_MD_DONOTVOTE","自分自身が提供したファイルには投票できません。"); +define("_MD_RATEIT","評価してください。"); + +define("_MD_INTFILEAT","%s での注目ダウンロード"); // %s is your site name +define("_MD_INTFILEFOUND","%s で見つけた面白いふぁいるです。"); // %s is your site name + +define("_MD_RECEIVED","ダウンロード情報をいただきました。ありがとうございま す。"); +define("_MD_WHENAPPROVED","承認されたらメールが届きます。"); +define("_MD_SUBMITONCE","一度だけ実行してください。"); +define("_MD_APPROVED", "あなたのファイルは承認されました。"); +define("_MD_ALLPENDING","すべてのファイル情報は未検証状態です。"); +define("_MD_DONTABUSE","ユーザー名と IP は記録されています。"); +define("_MD_TAKEDAYS","ファイル/スクリプトがデータベースに登録されるまで数 日かかる場合があります。"); + +define("_MD_RANK","ランク"); +define("_MD_CATEGORY","カテゴリ"); +define("_MD_HITS","ダウンロード回数"); +define("_MD_RATING","評価"); +define("_MD_VOTE","投票"); + +define("_MD_SEARCHRESULT4","検索結果 <b>%s</b>:"); +define("_MD_MATCHESFOUND","%s 件一致しました。"); +define("_MD_SORTBY","ソート基準:"); +define("_MD_TITLE","タイトル"); +define("_MD_DATE","日付"); +define("_MD_POPULARITY","人気"); +define("_MD_CURSORTBY","表示ソート順: "); +define("_MD_FOUNDIN","見つかりました:"); +define("_MD_PREVIOUS","前へ"); +define("_MD_NEXT","次へ"); +define("_MD_NOMATCH","検索条件に一致するものはありません。"); + +define("_MD_TOP10","%s の上位10"); // %s is a downloads category name +define("_MD_CATEGORIES","カテゴリ"); + +define("_MD_SUBMIT","実行"); +define("_MD_CANCEL","キャンセル"); + +define("_MD_BYTES","Bytes"); +define("_MD_ALREADYREPORTED","破損ファイルに関するレポートを提出しまし た。"); +define("_MD_MUSTREGFIRST","このアクションを実行するパーミッションがありませ ん。<br>登録するかログインしてください。"); +define("_MD_NORATING","評価がなされていません。"); +define("_MD_CANTVOTEOWN","自分自身が提供したファイルには投票できません。 <br>投票は全て記録され,検討されています。"); + +// Language variables used by the plugin - Admin code. + +define("_MD_RATEFILETITLE","ファイル評価を記録してください。"); +define("_MD_ADMINTITLE","ファイル管理 管理者メニュー"); +define("_MD_UPLOADTITLE","ファイル管理 - ファイルのアップロード"); +define("_MD_CATEGORYTITLE","リスト - カテゴリ"); +define("_MD_DLCONF","ダウンロード設定"); +define("_MD_GENERALSET","ファイル管理設定"); +define("_MD_ADDMODFILENAME","ファイルのアップロード"); +define ("_MD_ADDCATEGORYSNAP", "画像: <small>(オプション,トップレベルカテ ゴリのみ)</small>"); +define ("_MD_ADDIMAGENOTE", "(画像の高さ制限 50)"); +define("_MD_ADDMODCATEGORY","<b>カテゴリ:</b> カテゴリの追加/修正/削除"); +define("_MD_DLSWAITING","ダウンロード許可待ち"); +define("_MD_BROKENREPORTS","破損ファイルレポート"); +define("_MD_MODREQUESTS","ダウンロード情報修正要求"); +define("_MD_EMAILOPTION","承認時のメール発信者: "); +define("_MD_COMMENTOPTION","コメント許可:"); +define("_MD_SUBMITTER","提供者: "); +define("_MD_DOWNLOAD","ダウンロード"); +define("_MD_FILELINK","全文表示"); +define("_MD_SUBMITTEDBY","ファイル提供: "); +define("_MD_APPROVE","承認"); +define("_MD_DELETE","削除"); +define("_MD_NOSUBMITTED","新たに提供されたダウンロードファイルはありませ ん"); +define("_MD_ADDMAIN","主カテゴリ追加"); +define("_MD_TITLEC","タイトル: "); +define("_MD_CATSEC", "カテゴリへのアクセス: ============================================================================== Diff truncated at 200k characters