Cmq lo script lo sto facendo funzionare senza mysql, quindi non devo inserire niente..
Il file da modificare è gallery.inc.php:
credo sia questa parte..
Codice PHP:
// display admin cp header
echo "<table border='0' align='center' cellpadding='2' cellspacing='2' class='mgtxt'>\n";
echo "<tr><td class='mgadmincap'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0' class='mgtxt'>\n";
echo "<tr><td ><font color='#FFFFFF'>[b]MyGallery Admin CP[/b]</font></td>\n";
echo "<td align='right' style='color:#ffffff;'>[[url='$me$getvars']$txtlogout[/url]] </td>\n";
echo "</tr></table>\n";
echo "</td></tr>\n";
// if in gallery edit mode
if ($showedit || $_REQUEST['mgaction']=="edit"){
$gal=$_REQUEST['mggal'];
echo "<tr><td class='mgadmintdbg'>\n";
echo "[b]$txtediting<em style='letter-spacing:1px'>".$galleries[$gal][1]."[/i][/b]
\n";
echo "<form name='form1' enctype='multipart/form-data' method='post' action='$me$getvars'>\n";
echo "[b]$txtaddpicscap[/b]
$txtaddpics
<input name='mgfile' type='file' id='mgfile' class='mginputln'>
\n";
if ($mgConf['watermarkimg'] != "") echo "<input name='mgwatermark' type='checkbox' id='mgwatermark' class='mginputradio' checked='checked'> <label for='mgwatermark'>$txtincludewatermark</label>
\n";
echo "<input type='submit' name='Submit' value='$txtadd'>\n";
echo "<input name='mgdo' type='hidden' id='mgdo' value='admin'>\n";
echo "<input name='mgaction' type='hidden' id='mgdo' value='upload'>\n";
echo "<input name='mggal' type='hidden' id='mgdo' value='$gal'>\n";
echo "<input name='mghash' type='hidden' id='mgdo' value='$hash'>\n";
echo "<center style='color:#cc0000;'>$output</center>\n";
echo "</form>
\n";
$caps=getcaps($gal, $imgdir);
$i=1;
$pictures = getpics($gal, $imgdir, $mgConf['pathtoscript'], $mgConf['thumbnails']);
if ($pictures!==false){
echo "<form name='fomr9' method='post' action='$me$getvars'>\n";
echo "[b]$txtgalname[/b]
";
echo "<input name='mggallery' type='text' id='mggallery' style='width:100%;' value='".(stripslashes($galleries[$gal][1]))."' class='mginputln'>
\n";
echo "[b]$txtdescription[/b]
";
echo "<textarea name='mgdescr' id='mgdescr' style='width:100%;' rows='5' class='mginputln'>".(brtonl(stripslashes($galleries[$gal][2])))."</textarea>
\n";
echo "<table width='100%' border='0' align='center' cellpadding='2' cellspacing='2' class='mgtxt'><tr class='mgsmall'>\n\n";
foreach ($pictures as $pic){
$img=($mgConf['thumbnails']) ? $pic['thumb'] : $pic['pic'];
$size=getimagesize($img);
$attr=($size[0]>$mgConf['thumbwidth']) ? "width='".$mgConf['thumbwidth']."' height='".($mgConf['thumbwidth']*$size[1]/$size[0])."'" : "width='$size[0]' height='$size[1]'";
echo "<td width='25%' valign='top' class='mgaltbgcol'>\n";
echo "$txtcaption
<input name='mgcap[".$pic['id']."]' type='text' id='mglogin' size='15' value='".(stripslashes($caps[$pic['id']]))."' class='mginputln'>
\n";
// rename file
echo "$txtfilename
<input name='mgfilename[".$pic['id']."]' type='text' id='mglogin' size='15' value='".$pic['id']."' class='mginputln'>
\n";
echo "<input name='mgtodel[".$pic['id']."]' type='checkbox' value='1' style='vertical-align:-5px;' id='mgtodel[".$pic['id']."]'>[<label for='mgtodel[".$pic['id']."]'>$txtdelete</label>]
\n";
echo "[img]$img[/img]\n";
echo "</td>\n\n";
if (fmod($i, $mgConf['thumbcolsadmin'])==0) echo "</tr><tr class='mgsmall'>\n";
$i++;
}
echo "</tr><tr><td colspan='".$mgConf['thumbcolsadmin']."' align='center' height='40' valign='bottom'>";
echo "<input type='submit' name='Submit' value='$txtsavechange'>\n";
echo "<input type='button' value='$txtback' onClick='location.href=\"$me$getvars&mgdo=admin\"'>\n";
echo "<input name='mgdo' type='hidden' id='mgdo' value='admin'>\n";
echo "<input name='mgaction' type='hidden' id='mgdo' value='savegal'>\n";
echo "<input name='mghash' type='hidden' id='mgdo' value='$hash'>\n";
echo "<input name='mggal' type='hidden' id='mgdo' value='$gal'>\n";
echo "</td></tr></table></form>\n";
}// endif $pictures!==false
echo "</td></tr>\n";
// else in not edit mode
}else{
// upload new gallery form
echo "<tr><td class='mgadmintdbg'>\n";
echo "<form name='form1' enctype='multipart/form-data' method='post' action='$me$getvars'>\n";
echo "[b]$txtnewgal[/b]
$txtzipdesc
\n";
echo "<table width='100%' border='0' cellspacing='0' cellpadding='1' class='mgtxt'>\n";
echo "<tr><td width='100'>$txtgalname:</td>\n";
echo "<td><input name='mggallery' type='text' id='mggallery' style='width:100%;' class='mginputln'></td></tr>\n";
echo "<tr><td width='100'>$txtdescription:</td>\n";
echo "<td><textarea name='mgdescr' type='text' id='mgdescr'style='width:100%;' rows='4' class='mginputln'></textarea></td></tr>\n";
echo "<tr><td></td><td>";
if ($mgConf['watermarkimg'] != "") echo "<input name='mgwatermark' type='checkbox' id='mgwatermark' class='mginputradio' checked='checked'> <label for='mgwatermark'>$txtincludewatermark</label>";
echo "</td>\n";
echo "<tr><td></td>\n";
echo "<td>($txtselzip)
<input name='mgfile' type='file' id='mgfile' class='mginputln'>\n";
echo "</td></tr>\n";
echo "<tr><td></td>\n";
echo "<td height='40'>\n";
echo "<input type='submit' name='Submit' value='$txtbuild'>\n";
echo "<input name='mgdo' type='hidden' id='mgdo' value='admin'>\n";
echo "<input name='mgaction' type='hidden' id='mgdo' value='upload'>\n";
echo "<input name='mghash' type='hidden' id='mgdo' value='$hash'>\n";
echo "</td></tr></table>\n";
echo "<center style='color:#cc0000;'>$output</center>\n";
echo "</form></td></tr>\n";
// show gallery list
if($galleries!==false){
echo "<tr><td class='mgadmintdbg'>[b]$txtexgals
[/b]\n";
echo "<table width='100%' border='0' cellspacing='0' cellpadding='0' class='mgtxt'>\n";
echo "<tr>\n";
echo "<td width='30' align='center' class='mgadmincap'><font color='#FFFFFF'>#</font></td>\n";
echo "<td class='mgadmincap'><font color='#FFFFFF'>$txtname</font></td>\n";
echo "<td class='mgadmincap'></td>\n";
echo "</tr>\n";
$i=1;
$bgcol[0]="";
$bgcol[1]="class='mgaltbgcol'";
krsort($galleries);
//print_r($galleries);
foreach($galleries as $gal){
$name = (strlen($gal[1]) > 38) ? substr($gal[1], 0, 38)."..." : $gal[1];
echo "<tr ".$bgcol[fmod($i,2)].">\n";
echo "<td align='center'>$i</td>\n";
echo "<td>[url='$me$getvars&mggal=$gal[0]']".stripslashes($name)."[/url]</td>\n";
echo "<td align='right'>";
echo "[url='$me$getvars&mgdo=admin&mgaction=move&mgcmd=up&mgid=$gal[0]']$txtup[/url]\n";
echo "[url='$me$getvars&mgdo=admin&mgaction=move&mgcmd=down&mgid=$gal[0]']$txtdown[/url]\n";
echo "[url='$me$getvars&mgdo=admin&mgaction=edit&mggal=$gal[0]']$txtedit[/url]\n";
echo "[url='javascript: if(confirm(\"$txtasktodel\")){ location.href=\"$me$getvars&mgdo=admin&mgaction=delete&mgid=$gal[0]\";}']$txtdelete[/url]\n";
echo "</td>\n";
echo "</tr>\n";
$i++;
}
echo "</table>\n";
echo "</td></tr>\n";
}
}// endif (not edit mode)
echo "</table>\n";
// if not logged in -> admin login form
}else{
echo "<script language='JavaScript'>\n";
echo "window.onload=function(){ document.forms['loginform'].elements['mglogin'].focus(); }\n";
echo "</script>\n";
echo "<table border='0' align='center' cellpadding='2' cellspacing='2' class='mgtxt'>\n";
echo "<tr><td class='mgadmincap'><font color='#FFFFFF'>[b]MyGallery Admin CP [/b]</font></td></tr>\n";
echo "<tr><td class='mgadmintdbg'>\n";
echo "<form name='loginform' method='post' action='$me$getvars'>\n";
echo "$txtlogin <input name='mglogin' type='text' id='mglogin' size='20' class='mginputln'>\n";
echo "$txtpass <input name='mgpwd' type='password' id='mgpwd' size='20' class='mginputln'>\n";
echo "<input type='submit' name='Submit' value='Login'>\n";
echo "<input name='mgdo' type='hidden' id='mgdo' value='admin'>\n";
echo "<input name='mgaction' type='hidden' id='mgaction' value='login'>\n";
echo "<input name='mghash' type='hidden' id='mgdo' value='$hash'>\n";
echo "</form></td></tr></table>\n";
}
// ***************************** MAIN *****************************
// ****************************************************************
// if not in admin mode
}else{
if ($mgConf['is_cmsms_module'] === true && adminloggedin($logfile)){
echo "[url='$me$getvars&mgdo=admin']$txtadmin[/url]
";
}
// get gallery list from data file
$galleries=false;
if ($gals=file($galfile)){
foreach ($gals as $gal){
$gal= explode('|', rtrim($gal));
$galleries[$gal[0]] = array($gal[0], $gal[1], $gal[2]);
}
krsort($galleries, SORT_NUMERIC);
}
// show the gallery list
if (!isset($_REQUEST['mggal'])){
if ($galleries!==false){
// reorganize $galleries array
$foo=$galleries;
$galleries=array();
foreach ($foo as $g) $galleries[]=$g;
// paging
$page=(is_numeric($_REQUEST['mgpage'])) ? $_REQUEST['mgpage'] : 1;
$start= ($page-1) * $mgConf['gpp'];
$numgals=count($galleries);
$pages=ceil($numgals/$mgConf['gpp']);
$paging=paging($pages, "mgpage");
// get template for gallleries list
$tpl=getTemplate("GALLERIES", implode("", file($tplfile)));
$tplrow=getTemplate("ROW", $tpl);
$rows="";
for ($i=$start; $i<($start+$mgConf['gpp']); $i++){
if (is_array($galleries[$i])){
$gal=$galleries[$i];
// get random preview thumbnail
$pictures = getpics($gal[0], $imgdir, $mgConf['pathtoscript'], $mgConf['thumbnails']);
$c=count($pictures);
$imgsrc=$pictures[rand(0, ($c-1))]['thumb'];
$match=array("{urlthumb}", "{title}", "{description}", "{urlgallery}");
$replace=array($imgsrc, stripslashes($gal[1]), $gal[2], $me.$getvars."&mggal=".$gal[0]);
$rows.=str_replace($match, $replace, $tplrow);
}
}
$match= array("/\{paging\}/", "/<\!\-\-ROW\-\->(.*?)<\!\-\-ROW\-\->/s");
$replace= array($paging, $rows);
$html = preg_replace($match, $replace, $tpl);
echo execTemplate($html);
}// endif $galleries!==false)
// show specific gallery
}else{
$gal=$_REQUEST['mggal'];
if ($pictures = getpics($gal, $imgdir)){
$numpics=count($pictures);
// show thumbnails page
if (!isset($_REQUEST['mgid']) && $mgConf['thumbnails']){
// paging
$page = (is_numeric($_REQUEST['mgpage'])) ? $_REQUEST['mgpage'] : 1;
$start = ($page-1) * $mgConf['tpp'];
$end = ($start + $mgConf['tpp'] > $numpics) ? $numpics : ($start + $mgConf['tpp']);
$pages = ceil($numpics/$mgConf['tpp']);
$paging = paging($pages, "mgpage");