Hey swenieboy,
PicOfX mit einstellbarer Bilder Anzahl
install.php einfach im Ilch Root Speichern und Aufrufen (www.musterseite.de/install.php)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<meta name="author" content="OloX" />
<meta http-equiv="Content-Type" content="text/html; Select from list" />
<title>-=] Installation [=-</title>
<style type="text/css">
<!--
html { margin:0; padding:0;}
* { margin: 0; padding: 0; outline: 0; }
body {
margin:0; padding:0;
font-family: Tahoma, Verdana, Arial, "Trebuchet MS";
font-size: 12px;
color: #ffffff; text-align: center;
background: #23252f;
}
#container {
margin: 0 auto;
width: 500px;
}
#main {
text-align: center;
font: 12px Tahoma;
color: #045d96;
border: 1px dashed #00CCFF;
background-color:#c1c1c1;
padding:5px;
width: 500px;
margin-top: 1px;
}
#head {
text-align: center;
border: 1px dashed #00CCFF;
background-color:#323543;
padding:5px;
width: 500px;
height: 30px;
margin-top: 10px;
}
#foot {
text-align: center;
border: 1px dashed #00CCFF;
background-color:#323543;
padding:5px;
width: 500px;
height: 10px;
margin-top: 1px;
}
h1 {
margin-bottom: 3px;
margin-top: 0.3em;
color: #3a738d;
font-size: 1.4em;
}
-->
</style>
</head>
<body>
<div id="container">
<div id="head"><h1>Installation</h1></div>
<?php
define ( 'main' , TRUE );
require_once('include/includes/config.php');
require_once('include/includes/func/db/mysql.php');
db_connect();
if (db_count_query("SELECT COUNT(*) FROM prefix_allg WHERE k = 'picofx' AND v1 = 'piclimit'") == 0) {
db_query("INSERT INTO `prefix_allg` (`k`, `v1` ,`v2`) VALUES ('picofx', 'piclimit', '6');");
}
if (db_query("ALTER TABLE `prefix_allg` CHANGE COLUMN `v2` `v2` TEXT NOT NULL DEFAULT '';") and db_query("UPDATE `prefix_allg` SET `v2` = '' WHERE `v1` = 'pic' LIMIT 1;") )
echo '<div id="main">Installation <strong>erfolgreich</strong> abgeschlossen.<br />Bitte <strong>install.php</strong> löschen.</div><div id="foot"></div></div>
</body>
</html>';
else
echo '<div id="main"><b>Fehler aufgetreten:</b><br />'.mysql_error().'</div><div id="foot"></div></div>
</body>
</html>';
db_close();
?>
include/admin/picofx.php
<?php
/* ìlchClan Pic of the X modul
-------------------------------------------------------------|
Copyright : © by Manuel |
E-Mail : manuel@ilch.de |
Internet : www.ilch.de |
Version : v.1.0.6 |
Lastupdate : 20.12.2004 |
Modul Copyright : © by David "scarfhogg" |
------------------------------------------------------------*/
defined ('main') or die ( 'no direct access' );
defined ('admin') or die ( 'only admin access' );
function getGalleryCats($cats,$cat,&$op,$sel,$lvl){
foreach ($cats[$cat] as $k => $v) {
$op .= '<option value="'.$k.'"'.($sel == $k ? 'selected="selected"' : '').'> '.$lvl.' '.$v.'</option>';
getGalleryCats($cats,$k,$op,$sel,$lvl.'-');
}
}
$design = new design ( 'Admins Area', 'Admins Area', 2 );
$design->header();
$um = $menu->get(1);
if ( empty ( $um ) )
{
$svResult = db_query('SELECT * FROM prefix_allg WHERE k = \'picofx\'');
while($saRow = db_fetch_assoc($svResult))
{
$picofxOpts[$saRow['v1']] = $saRow['v2'];
}
?>
<h2><b>Pic of the X verwalten</b></h2>
<br /><br /><form action="admin.php?picofx-update" method="POST">
<table cellspacing="1" border="0" cellpadding="10" class="border">
<tr class="Chead">
<td colspan="2">
<b>Einstellungen</b></td></tr>
<tr><td class="Cmite" width="20%">Kategorie</td><td class="Cnorm">
<select name="directory">
<option value="">gallery</option>
<?php
$erg = db_query("SELECT id,cat,name FROM prefix_gallery_cats ORDER BY cat,pos");
$cats = array();
while ($r = db_fetch_object($erg)) {
$cats[$r->cat][$r->id] = $r->name;
}
$outputcats = '';
getGalleryCats($cats,0,$outputcats,$picofxOpts['directory'],'-');
echo $outputcats;
$int_opts = array('0' => 'bei jedem Seitenaufruf', '1' => 'jeden Tag', '7' => 'jede Woche', '30' => 'jeden Monat', 'c' => 'selbstdefiniert');
?></select></td></tr>
<tr><td class="Cmite">Wechseln</td><td class="Cnorm">
<select name="change">
<?php
foreach($int_opts as $key => $val)
{
$sel = '';
$cval = '';
if($picofxOpts['interval'] == $key)
{
$sel = ' selected';
$seld = 1;
}
if($seld != 1 && $key == 'c')
{
$sel = ' selected';
$cval = $picofxOpts['interval'];
}
echo '<option value="'.$key.'"'.$sel.'>'.$val.'</option>'."\n";
}
?>
</select></td></tr>
<tr><td class="Cmite">Wechseln alle <br></td><td class="Cnorm" valign="top"><input type="text" value="<?php echo $cval ?>" name="cchange" size="3" maxlength="2"> Tage <br><br>
<small><b>Nur ausfüllen wenn oben "selbstdefiniert" ausgewählt ist!<br>
Andernfalls wird dieses Feld ignoriert.</b></small></td></tr>
<tr><td class="Cmite">Bilder Anzahl<br></td><td class="Cnorm" valign="top"><input type="text" value="<?php echo $picofxOpts['piclimit'] ?>" name="piclimit" size="3" maxlength="2"> Bild(er) <br><br>
</td></tr>
<tr><td class="Cmite">Thumbnail Breite</td><td class="Cnorm" valign="top"><input type="text" value="<?php echo $picofxOpts['picwidth'] ?>" name="picwidth" size="3" maxlength="3"> Pixel</td></tr>
<tr class="Cdark"><td></td><td><input type="submit" value="Speichern"></td></tr></table>
</td></tr></table></form>
<?php
}
elseif($um == 'update')
{
$directory = '';
$change = 'x';
$picofxPicWidth = !empty($_POST['picwidth']) ? intval($_POST['picwidth']) : '100';
$picofxPicLimit = !empty($_POST['piclimit']) ? intval($_POST['piclimit']) : '6';
$directory = intval($_POST['directory']);
if(isset($_POST['change']))
{
if($_POST['change'] == 'c')
{
$change = intval($_POST['cchange']);
}
else
{
$change = intval($_POST['change']);
}
$picofxNextChange = date('Y-m-d', time() + 3600 * 24 * $change);
}
if(strval($change) == 'x')
{
echo 'c '.$change;
echo '<br>d '.$directory;
echo '<br>fehler';
}
else
{
$picData = array();
$sql = sprintf("SELECT `a`.`id` AS `id`, `a`.`cat`, `a`.`endung`, `a`.`besch`, COUNT(`b`.`id`) AS `anz`
FROM prefix_gallery_imgs AS `a`
LEFT JOIN `prefix_gallery_imgs` AS `b` ON b.id < a.id AND `b`.`cat` = a.cat
%s
GROUP BY `a`.`id`, `a`.`cat`, `a`.`endung`, `a`.`besch`
ORDER BY RAND() LIMIT 0,%d"
, $directory != 0 ? "WHERE a.cat = ". $directory : "", $picofxPicLimit );
$q = db_query($sql);
while( $row = db_fetch_assoc($q) ) {
$picData[$row['id']] = array('id' => $row['id'], 'endung' => $row['endung'], 'kata' => $row['cat'], 'description' => $row['besch'], 'count' => $row['anz']);
}
$picofxOpts['pic'] = serialize($picData);
// geaendertes pic in db speichern
db_query('UPDATE prefix_allg SET v2 = \''. $picofxOpts['pic'] .'\' WHERE k = \'picofx\' AND v1 =\'pic\' LIMIT 1');
db_query('UPDATE prefix_allg SET v2 = \''. $directory .'\' WHERE k = \'picofx\' AND v1 =\'directory\' LIMIT 1');
db_query('UPDATE prefix_allg SET v2 = \''. $change .'\' WHERE k = \'picofx\' AND v1 =\'interval\' LIMIT 1');
db_query('UPDATE prefix_allg SET v2 = \''. $picofxNextChange .'\' WHERE k = \'picofx\' AND v1 =\'nextchange\' LIMIT 1');
db_query('UPDATE prefix_allg SET v2 = \''. $picofxPicWidth .'\' WHERE k = \'picofx\' AND v1 =\'picwidth\' LIMIT 1');
db_query('UPDATE prefix_allg SET v2 = \''. $picofxPicLimit .'\' WHERE k = \'picofx\' AND v1 =\'piclimit\' LIMIT 1');
wd ( 'admin.php?picofx','Pic of X Einstellungen gespeichert');
}
}
$design->footer();
?>
include/boxes/picofx.php
<?php
/* ilchClan Pic of the X modul
-------------------------------------------------------------|
Copyright : copy by Manuel |
E-Mail : Webmaster@ilch.de |
Internet : www.ilch.de |
Version : v.1 |
Lastupdate : 20.12.2005 |
Modul Copyright : copy by David "scarfhogg" |
------------------------------------------------------------*/
defined ('main') or die ( 'no direct access' );
$svResult = db_query('SELECT * FROM prefix_allg WHERE k = \'picofx\'');
while($saRow = db_fetch_assoc($svResult))
{
$picofxOpts[$saRow['v1']] = $saRow['v2'];
}
$picofxNow = date('Y-m-d');
// pruefen ob das bild gewechselt werden muss.
if($picofxOpts['nextchange'] == $picofxNow || $picofxOpts['nextchange'] < $picofxNow)
{
$picData = array();
$sql = sprintf("SELECT `a`.`id` AS `id`, `a`.`cat`, `a`.`endung`, `a`.`besch`, COUNT(`b`.`id`) AS `anz`
FROM prefix_gallery_imgs AS `a`
LEFT JOIN `prefix_gallery_imgs` AS `b` ON b.id < a.id AND `b`.`cat` = a.cat
%s
GROUP BY `a`.`id`, `a`.`cat`, `a`.`endung`, `a`.`besch`
ORDER BY RAND() LIMIT 0,%d"
, $picofxOpts['directory'] != 0 ? "WHERE a.cat = ".$picofxOpts['directory'] : "", $picofxOpts['piclimit']);
$q = db_query($sql);
while( $row = db_fetch_assoc($q) ) {
$picData[$row['id']] = array('id' => $row['id'], 'endung' => $row['endung'], 'kata' => $row['cat'], 'description' => $row['besch'], 'count' => $row['anz']);
}
$picofxOpts['pic'] = serialize($picData);
$picofxNextChange = date('Y-m-d', time() + 3600 * 24 * $picofxOpts['interval']);
// geaendertes pic in db speichern
db_query('UPDATE prefix_allg SET v2 = \''. $picofxOpts['pic'] .'\' WHERE k = \'picofx\' AND v1 =\'pic\' LIMIT 1');
db_query('UPDATE prefix_allg SET v2 = \''. $picofxNextChange .'\' WHERE k = \'picofx\' AND v1 =\'nextchange\' LIMIT 1');
}
$picofxOpts['pic'] = unserialize($picofxOpts['pic']);
if (is_array($picofxOpts['pic']) and count($picofxOpts['pic']) > 0 ) {
$weite = $allgAr['gallery_normal_width']+30;
?>
<script language="JavaScript" type="text/javascript">
<!--
function picOfxOeffneFenster (bildr, cat) {
var fenster = window.open ('index.php?gallery-show-'+cat+'-p'+bildr,'showBild','scrollbars=yes,height=600,width=<?php echo $weite; ?>,left=200,status=yes');
fenster.focus();
return (false);
}
//-->
</script>
<?php
echo '<div>'."\n";
foreach ($picofxOpts['pic'] as $k => $v) {
$picofxThumb = 'img_thumb_'.$v['id'].'.'.$v['endung'];
if (file_exists ('include/images/gallery/'.$picofxThumb)) {
$picofxImg = getimagesize('include/images/gallery/'.$picofxThumb);
if($picofxImg[0] < $picofxOpts['picwidth']) {
$picofxImg[1] = @ceil(($picofxImg[1] / $picofxImg[0]) * $picofxOpts['picwidth']);
$picofxImg[0] = $picofxOpts['picwidth'];
}
echo '<div class="rand" style="margin:2px; padding:2px; float:left;"><a target="_blank" title="'.$v['description'].'" href="index.php?gallery-show-'.$v['kata'].'-p'.$v['count'].'" onClick="return picOfxOeffneFenster('.$v['count'].','.$v['kata'].');"><img border="0" src="include/images/gallery/'.$picofxThumb.'" width="'.$picofxImg[0].'" height="'.$picofxImg[1].'" alt="" /></a></div>'."\n";
}
}
echo '</div>'."\n";
} else {
echo $lang['nothingavailable'];
}
?>
Viel Spaß damit!
Edit:
Code Update... Jetzt funzt alles!
MfG OloX
Zuletzt modifiziert von OloX am 27.06.2010 - 00:50:24