Hallo, liebe Gemeinde...
Ich hab mich im Forum durchgesucht, finde aber nichtden Beitrag von jubilee wieder, wo er geschrieben hast, dass er einen Bannerblock hast, der ohne Rand etc. ist.
Ich würde auch gern einen centerblock haben, der optisch abweichend ist vom "normalen" [function thememiddlebox($title,$content,$block=array())] ,
weiss aber nicht, wie man in einer neuen Block-Datei , z.B. block-banner2.php, definiert, dass das template der Function [function thememiddlebox2()] genommen werden soll.
Das gleiche Spiel beschäftigt mich auch in dem Zusammenhang,
dass ich gern eine zusätzliche rechte Spalte neben dem vkpmx 2.1b (mit "normalem" theme (nicht Themeengine) )
hätte, in der ich einen Block ebenfalls ohne Rand setze, dem ich skyscraper-Banner über die Administration zuordnen kann.
Die zusätzliche Spalte könnte ich ja vielleicht hinbekoommen, aber der Rest.....
So wie ich Euch spezies kennengelernt habe, hat doch mind. jede(r) Zweite mit so was schon Erfahrung ;)
Herzlichst Gabi
Ich hab mal
in der modules/blocks.php (oben ist ein bischen falsch)
<?php
/************************************
vkpMx Content Management System
Copyright (c) 2005 pragmaMx Dev Team - http://pragmaMx.org
***********************************
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.
***********************************
$Source: D:/CVS/vkpMx_2.1_a/admin/modules/blocks.php,v $
$Revision: 1.1 $
$Author: Andreas Ellsel $
$Date: 2005/06/03 21:05:25 $
************************************/
if (!defined("mxAdminFileLoaded")) die("Access Denied");
if (!mxGetAdminPref("radminsuper")) {
mxErrorScreen("Access Denied"); die();
}
/*********************************************************/
/* Blocks Functions */
/*********************************************************/
################################################################
function BlocksAdmin($gvs = array()) {
global $bgcolor3, $bgcolor2, $bgcolor1, $prefix, $currentlang;
$img_activate = mxCreateImage("images/activate.gif", _ACTIVATE);
$img_deactivate = mxCreateImage("images/deactivate.gif", _DEACTIVATE);
$img_delete = mxCreateImage("images/delete.gif", _DELETE);
$img_edit = mxCreateImage("images/edit.gif", _EDIT);
$img_view = mxCreateImage("images/view.gif", _SHOW);
$curpos = ""; $i = 0;
if (isset($gvs['filter'])) {
if ($gvs['filter']==-1) {
mxSessionDelVar("blockfilter");
}
else {
mxSessionSetVar("blockfilter", $gvs['filter']);
}
}
$filterlink[] = (mxSessionGetVar("blockfilter")==1) ? "<b>"._BLOCKSHOWACTIVE."</b>" : "<a href=\"admin.php?op=BlocksAdmin&filter=1\">"._BLOCKSHOWACTIVE."</a>";
$filterlink[] = (!mxSessionGetVar("blockfilter")) ? "<b>"._BLOCKSHOWALL."</b>" : "<a href=\"admin.php?op=BlocksAdmin&filter=-1\">"._BLOCKSHOWALL."</a>";
$filterlink[] = (mxSessionGetVar("blockfilter")==2) ? "<b>"._BLOCKSHOWDEACTIVE."</b>" : "<a href=\"admin.php?op=BlocksAdmin&filter=2\">"._BLOCKSHOWDEACTIVE."</a>";
$filterlink = "[ ".implode(" | ",$filterlink)." ]";
if (mxSessionGetVar("blockfilter")==1) {
$qryfilter = " WHERE active = 1 ";
}
else if (mxSessionGetVar("blockfilter")==2) {
$qryfilter = " WHERE active = 0 ";
}
else {
$qryfilter = "";
}
$qry = "SELECT bid, bkey, title, url, position, weight, active, blanguage, blockfile, view, refresh
FROM ${prefix}_blocks ".$qryfilter."
ORDER BY position, weight";
$result = sql_query($qry);
while($block = sql_fetch_array($result)) {
$temp = $block['position'];
if (mxIsNewsBlockfile($block['blockfile'])) {
$temp = "z";
}
$block['cachetime'] = getRefreshTimeString($block['refresh']);
if ($temp == "c") $block['pos'] = _CENTERUP;
else if ($temp == "d") $block['pos'] = _CENTERDOWN;
else if ($temp == "do") $block['pos'] = _CENTERDOWN_OHNERAND;//GG
else if ($temp == "co") $block['pos'] = _CENTERUP_OHNERAND;//GG
else if ($temp == "r") $block['pos'] = _RIGHT;
else if ($temp == "z") $block['pos'] = _RIGHTNEWS;
else if ($temp == "sr") $block['pos'] = _RIGHTSKYSCRAPER; //GG
else if ($temp == "sl") $block['pos'] = _LEFTSKYSCRAPER; //GG
else $block['pos'] = _LEFT;
if (!empty($block['url'])) $block['type'] = "RSS/RDF";
#else if (!empty($block['blockfile'])) $block['type'] = _BLOCKFILE2;
else if (!empty($block['blockfile'])) $block['type'] = "".str_replace(".php","",str_replace("block-","",$block['blockfile']))." ("._BLOCKFILE2.")";
else $block['type'] = "HTML";
if ($block['view'] == 0) $block['who_view'] = _MVALL;
elseif ($block['view'] == 1) $block['who_view'] = _MVGROUPS2;
elseif ($block['view'] == 2) $block['who_view'] = _MVADMIN;
elseif ($block['view'] == 3) $block['who_view'] = _MVANON;
$block['title'] = (empty($block['active'])) ? "<i>".$block['title']."</i>" : $block['title'];
$block['change'] = (empty($block['active'])) ? $img_activate : $img_deactivate;
$block['active'] = (empty($block['active'])) ? "<i>"._INACTIVE."</i>" : _ACTIVE;
if ($GLOBALS['multilingual']) {
if (empty($block['blanguage'])) {
$block['blanguage'] = _ALL;
}
else {
$block['blanguage'] = ucfirst($block['blanguage']);
}
}
#$block['weight1'] = $block['weight'] - 1;
#$block['weight3'] = $block['weight'] + 1;
#$res = sql_query("select bid from ${prefix}_blocks where weight='".$block['weight1']."' AND position='".$block['position']."'");
#list ($block['con1']) = sql_fetch_row($res);
#$res2 = sql_query("select bid from ${prefix}_blocks where weight='".$block['weight3']."' AND position='".$block['position']."'");
#list ($block['con2']) = sql_fetch_row($res2);
$allblocks[$temp][$i] = $block;
$i++;
}
$newblocks = array();
if (isset($allblocks)) {
ksort($allblocks);
foreach ($allblocks as $array) {
$newblocks = array_merge($newblocks, $array);
}
unset($allblocks);
}
include("header.php");
#$colspan = 8;
$colspan = 7;
$headline = "<tr bgcolor=\"$bgcolor2\">"
."<td align=\"center\"><b>"._BLOCKORDER."</b></td>"
#."<td align=\"center\" colspan=\"2\"><b>"._WEIGHT."</b></td>"
."<td align=\"center\"><b>"._TITLE."</b></td>"
."<td align=\"center\"><b>"._TYPE."/"._FILENAME."</b></td>"
."<td align=\"center\"><b>"._STATUS."</b></td>"
."<td align=\"center\"><b>"."Caching"."</b></td>"
."<td align=\"center\"><b>"._VIEW."</b></td>";
if ($GLOBALS['multilingual']) {
$headline .= "<td align=\"center\"><b>"._LANGUAGE."</b></td>";
$colspan++;
}
$headline .= "<td align=\"center\"><b>"._FUNCTIONS."</b></td></tr>";
GraphicAdmin();
title(_BLOCKSADMIN);
OpenTable();
echo "<center><span class=\"content\">".$filterlink."</span></center>";
if (!count($newblocks)) {
echo "<center><span class=\"content\"><br>"._BLOCKNOBLOCKS."</span></center>";
}
CloseTable();
echo "<br>";
if (count($newblocks)) {
echo "<form action=\"admin.php\" method=\"post\">";
echo "<input type=\"hidden\" name=\"op\" value=\"BlocksListWeigth\">";
echo "<table border=\"0\" width=\"100%\" bgcolor=\"$bgcolor1\" cellpadding=\"1\" cellspacing=\"1\">";
$i = 1;
foreach ($newblocks as $block) {
extract($block);
if ($curpos != $pos) {
echo "<tr bgcolor=\"$bgcolor2\"><td colspan=\"$colspan\"><font class=\"title\">"._POSITION.": <b><i>".$pos."</i></b></font></td></tr>\n".$headline."";
$curpos = $pos;
$i = 1;
}
echo "<tr bgcolor=\"$bgcolor3\">";
echo "<td align=\"left\">";
#if ($con1 || $con2) {
echo "<input type=\"text\" name=\"weight[".$bid."]\" value=\"".$i."\" size=\"3\" maxlength=\"3\">"; #style=\"text-align: right;\"
# }
#else {
# echo " ".$weight." ";
# }
echo "</td>";
#echo "<td align=\"center\">";
#if ($con1) {
# echo"<a href=\"admin.php?op=BlockOrder&weight=".$weight."&bidori=".$bid."&weightrep=".$weight1."&bidrep=".$con1."\"><img src=\"images/up.gif\" alt=\""._BLOCKUP."\" title=\""._BLOCKUP."\" border=\"0\" hspace=\"3\"></a>";
# }
#if ($con2) {
# echo "<a href=\"admin.php?op=BlockOrder&weight=".$weight."&bidori=".$bid."&weightrep=".$weight3."&bidrep=".$con2."\"><img src=\"images/down.gif\" alt=\""._BLOCKDOWN."\" title=\""._BLOCKDOWN."\" border=\"0\" hspace=\"3\"></a>";
# }
#echo"</td>";
echo "<td>".$title."</td>";
echo "<td>".$type."</td><td>".$active."</td><td>".$cachetime."</td><td>".$who_view."</td>";
if ($GLOBALS['multilingual']) {
echo "<td>".$blanguage."</td>";
}
echo "<td nowrap><font class=\"content\"><a href=\"admin.php?op=BlocksEdit&bid=".$bid."\">".$img_edit."</a> <a href=\"admin.php?op=ChangeStatus&bid=".$bid."\">".$change."</a> ";
if ($pos != _RIGHTNEWS) {
echo " <a href=\"admin.php?op=BlocksDelete&bid=".$bid."\">".$img_delete."</a> ";
echo " <a href=\"admin.php?op=block_show&bid=".$bid."\">".$img_view."</a> ";
}
echo "</font></td></tr>";
$i++;
}
echo "<tr bgcolor=\"$bgcolor2\"><td colspan=\"$colspan\"><input type=\"submit\" value=\""._BLOCKSAVEORDER."\"></td></tr>\n";
echo "</table>";
echo "</form>";
#echo "<br>";
}
OpenTable();
echo "<center>[ <a href=\"admin.php?op=fixweight\">"._FIXBLOCKS."</a> | <a href=\"admin.php?op=resetBlockCache\">"._BLOCKDELCACHE."</a> ]</center>";
CloseTable();
blockaddform("file");
blockaddform("html");
blockaddform("rss");
include("footer.php");
}
################################################################
function BlocksListWeigth($pvs) {
global $prefix;
$i = 0;
foreach ($pvs['weight'] as $bid => $weight) {
$qry = "UPDATE ${prefix}_blocks SET weight=".$weight." WHERE bid=".$bid." AND weight<>".$weight."";
$result = sql_query($qry);
if ($result) $i++;
}
if ($i) {
repairweigth();
}
Header("Location: admin.php?op=BlocksAdmin");
}
################################################################
function blockaddform ($mode) {
static $groupselect;
if (!isset($groupselect)) {
$groupselect = getGroupSelect(0);
}
if ($mode == "file") $type = _BLOCKFILE;
if ($mode == "html") $type = "(HTML)";
if ($mode == "rss") $type = _RSSCONTENT;
echo "<br>";
OpenTable();
echo "<center><font class=\"option\"><b>"._ADDNEWBLOCK." ".$type."</b></font></center><br><br>";
echo "<form action=\"admin.php\" method=\"post\">";
echo "<table border=\"0\" width=\"100%\">";
echo "<tr valign='top'><td width=\"20%\">"._TITLE.":</td><td width=\"80%\"><input type=\"text\" name=\"title\" size=\"30\" maxlength=\"60\"></td></tr>";
if ($mode == "file") {
echo "<tr valign='top'><td>"._FILENAME.":</td><td>".mxGetBlockfileSelect("")."</td></tr>";
}
if ($mode == "rss") {
echo "<tr valign='top'><td>"._RSSFILE.":</td><td>".getHeadlineSelect ("")."</td></tr>";
}
if ($mode == "html") {
echo "<tr valign='top'><td>"._CONTENT.":</td><td><textarea name=\"content\" cols=\"70\" rows=\"10\"></textarea></td></tr>";
}
echo "<tr valign='top'><td>"._POSITION.":</td><td>".getPositionSelect("l")."</td></tr>";
echo "<tr valign='top'><td>"._WEIGHT.":</td><td><input type=\"text\" name=\"weight\" size=\"3\" maxlength=\"3\" value=\"0\"></td></tr>";
if ($GLOBALS['multilingual']) {
echo "<tr valign='top'><td>"._LANGUAGE.":</td><td>".mxAdminLanguageSelect("blanguage")."</td>";
}
else {
echo "<input type=\"hidden\" name=\"blanguage\" value=\"\">";
}
echo "<tr valign='top'><td>"._ACTIVATE2."</td><td>".getActiveSelect(1)."</td></tr>";
echo "<tr valign='top'><td>"._VIEWPRIV."</td><td>".getViewSelect(0)."</td></tr>";#</table><br><br>
echo "<tr valign='top'><td><!-- "._VIEWPRIV." --></td><td>".$groupselect."</td></tr>";
if ($mode == "rss") {
echo "<tr valign='top'><td>"._REFRESHTIME.":</td><td>".getRefreshSelect(3600,0)."</td></tr>";
}
else if ($mode == "file") {
echo "<tr valign='top'><td>"._REFRESHTIME.":</td><td>".getRefreshSelect(0,1)."</td></tr>";
}
echo "</table>";
echo "<input type=\"hidden\" name=\"op\" value=\"BlocksAdd\">";
echo "<input type=\"submit\" value=\""._CREATEBLOCK."\">";
echo "</form>";
CloseTable();
}
################################################################
function BlocksEdit($gvs) {
global $bgcolor2, $bgcolor4, $prefix;
$bid = (int)$gvs['bid'];
$result = sql_query("select * from ${prefix}_blocks where bid=".$bid."");
$block = sql_fetch_array($result);
extract($block);
$type = (empty($url)) ? "HTML" : _RSSCONTENT;
$type = (empty($blockfile)) ? $type : _BLOCKFILE;
$oldposition = $position;
include("header.php");
GraphicAdmin();
title(_EDITBLOCK);
OpenTable();
echo "<center><font class=\"option\"><b>"._BLOCK.": ".$title." <i>".$type."</i></b></font></center><br><br>"
."<form action=\"admin.php\" method=\"post\">"
."<table border=\"0\" width=\"100%\">"
."<tr valign='top'><td width=\"20%\">"._TITLE.":</td><td width=\"80%\"><input type=\"text\" name=\"title\" size=\"30\" maxlength=\"60\" value=\"".mxPrepareToDisplay($title)."\"></td></tr>";
if ($type == _BLOCKFILE) {
if (mxIsNewsBlockfile($blockfile)) {
echo "<input type=\"hidden\" name=\"blockfile\" value=\"".$blockfile."\">";
}
else {
echo "<tr valign='top'><td>"._FILENAME.":</td><td>".mxGetBlockfileSelect($blockfile)."</td></tr>";
}
}
else if ($type == _RSSCONTENT) {
#echo "<tr valign='top'><td>"._RSSFILE.":</td><td><input type=\"text\" name=\"url\" size=\"30\" maxlength=\"200\" value=\"".$url."\"> <font class=\"tiny\">"._ONLYHEADLINES."</font></td></tr>";
#echo "<tr valign='top'><td>"._RSSFILE.":</td><td><input type=\"text\" name=\"url\" size=\"30\" maxlength=\"200\" value=\"".$url."\">".getHeadlineSelect ($url)."</td></tr>";
echo "<tr valign='top'><td>"._RSSFILE.":</td><td>".getHeadlineSelect ($url)."</td></tr>";
}
else {
echo "<tr valign='top'><td>"._CONTENT.":</td><td><textarea name=\"content\" cols=\"70\" rows=\"10\">".$content."</textarea></td></tr>";
}
if (!mxIsNewsBlockfile($blockfile)) {
echo "<tr valign='top'><td>"._POSITION.":</td><td>".getPositionSelect($position)."</td></tr>";
}
else {
echo "<tr valign='top'><td>"._POSITION.":</td><td><b>"._RIGHT."</b><input type=\"hidden\" name=\"position\" value=\"r\"></td></tr>";
}
echo "<tr valign='top'><td>"._WEIGHT.":</td><td><input type=\"text\" name=\"weight\" size=\"5\" maxlength=\"3\" value=\"".$weight."\"></td></tr>";
if ($GLOBALS['multilingual']) {
echo "<tr valign='top'><td>"._LANGUAGE.":</td><td>".mxAdminLanguageSelect("blanguage", $blanguage)."</td></tr>";
}
else {
echo "<input type=\"hidden\" name=\"blanguage\" value=\"\">";
}
echo "<tr valign='top'><td>"._ACTIVATE2."</td><td>".getActiveSelect($active)."</td></tr>";
echo "<tr valign='top'><td>"._VIEWPRIV."</td><td>".getViewSelect($view)."</td></tr>"; #</table><br><br>
echo "<tr valign='top'><td><!-- "._VIEWPRIV." --></td><td>".getGroupSelect($bid)."</td></tr>";
if ($type == _BLOCKFILE) {
echo "<tr valign='top'><td>"._REFRESHTIME.":</td><td>".getRefreshSelect($refresh,1)."</td></tr>";
}
else if ($type == _RSSCONTENT) {
echo "<tr valign='top'><td>"._REFRESHTIME.":</td><td>".getRefreshSelect($refresh,0)."</td></tr>";
}
echo "</table>";
echo "<input type=\"hidden\" name=\"op\" value=\"BlocksEditSave\">"
."<input type=\"hidden\" name=\"oldposition\" value=\"".$oldposition."\">"
."<input type=\"hidden\" name=\"bid\" value=\"".$bid."\">"
."<input type=\"hidden\" name=\"bkey\" value=\"".$bkey."\">"
."<input type=\"submit\" value=\""._SAVEBLOCK."\">"
."</form>";
CloseTable();
echo "<br>";
block_editmenue ($block, _BLOCKACTIVATION);
showpreview($block);
include("footer.php");
}
################################################################
function Blocksave($block) {
global $prefix;
$block['active'] = (empty($block['active'])) ? 0 : 1;
$block['weight'] = (empty($block['weight'])) ? 0 : (int)$block['weight'];
$block['view'] = (empty($block['view'])) ? 0 : (int)$block['view'];
$block['refresh'] = (empty($block['refresh'])) ? 0 : (int)$block['refresh'];
$block['url'] = (empty($block['url'])) ? "" : $block['url'];
$block['blockfile'] = (empty($block['blockfile'])) ? "" : $block['blockfile'];
$block['blanguage'] = (empty($block['blanguage'])) ? "" : $block['blanguage'];
$block['content'] = (empty($block['content'])) ? "" : $block['content'];
if (!empty($block['headline'])) {
$result = sql_query("select sitename, headlinesurl from ".$prefix."_headlines where hid='".$block['headline']."'");
list ($xtitle, $block['url']) = sql_fetch_row($result);
if (empty($block['title'])) $block['title'] = $xtitle;
}
$block['content'] = (empty($block['url'])) ? $block['content'] : mxGetRssContent($block['url']);
if (empty($block['content']) && empty($block['blockfile']) && !empty($block['url'])) {
rssfail();
exit;
}
$block = mxAddSlashesForSQL($block);
#mxdebugfuncvars($block);
if ($block['op'] == "BlocksEditSave") {
$qry = "UPDATE ${prefix}_blocks SET
title='".$block['title']."',
blockfile='".$block['blockfile']."',
content='".$block['content']."',
url='".$block['url']."',
position='".$block['position']."',
weight=".$block['weight'].",
active=".$block['active'].",
refresh=".$block['refresh'].",
blanguage='".$block['blanguage']."',
view=".$block['view']."
where bid=".$block['bid']."";
$location = "admin.php?op=BlocksEdit&bid=".$block['bid']."";
if ($block['refresh'] && $block['blockfile']) {
resetBlockCache($block['bid']);
}
}
else {
$result1 = sql_query("SELECT Max(bid)+1 AS new FROM ${prefix}_blocks");
list($block['bid']) = sql_fetch_row($result1);
$qry = "INSERT INTO ${prefix}_blocks
(bid, title,content,url,position,weight,active,refresh,time,blanguage,blockfile,view) values
(".$block['bid'].", '".$block['title']."','".$block['content']."','".$block['url']."','".$block['position']."',".$block['weight'].",".$block['active'].",".$block['refresh'].",0,'".$block['blanguage']."','".$block['blockfile']."',".$block['view'].")";
$location = "admin.php?op=BlocksAdmin";
}
$result = sql_query($qry);
if ($result) {
repairweigth();
// Gruppen aktualisieren
sql_query("DELETE FROM ".$prefix."_groups_blocks WHERE block_id=".$block['bid']."");
if ($block['view']==1) {
foreach ($block['groups'] as $groupid) {
sql_query("INSERT INTO ".$prefix."_groups_blocks (group_id, block_id) VALUES (".$groupid.", ".$block['bid'].")");
}
}
/// RSS-Daten an Headlines anfuegen
if (empty($block['headline']) && !empty($block['url']) && !empty($block['content']) && !empty($block['title']) && $result) {
$result2 = sql_query("select headlinesurl from ".$prefix."_headlines where headlinesurl='".$block['url']."' OR sitename='".$block['title']."'");
list ($xurl) = sql_fetch_row($result2);
if (empty($xurl)) {
sql_query("INSERT INTO ".$prefix."_headlines (sitename, headlinesurl) values ('".$block['title']."', '".$block['url']."')");
}
}
}
Header("Location: ".$location."");
}
################################################################
function getActiveSelect($active=1) {
$active = (int)$active;
$out = "<input type=\"radio\" name=\"active\" value=\"1\"".(($active==1) ? " checked" : "").">"._YES." ";
$out .= "<input type=\"radio\" name=\"active\" value=\"0\"".(($active==0) ? " checked" : "").">"._NO."\n";
return $out;
}
################################################################
function getRefreshSelect($refresh=0, $shownever=0) {
$refresh = (int)$refresh;
$out = "<select name=\"refresh\">";
if ($shownever) {
$out .= "<option value=\"0\"".(($refresh==0) ? " SELECTED" : "").">- "._NEVER."</option>";
}
$out .= "<option value=\"300\"".(($refresh==300) ? " SELECTED" : "").">5 "._MINUTES."</option>"
."<option value=\"600\"".(($refresh==600) ? " SELECTED" : "").">10 "._MINUTES."</option>"
."<option value=\"1200\"".(($refresh==1200) ? " SELECTED" : "").">20 "._MINUTES."</option>"
."<option value=\"1800\"".(($refresh==1800) ? " SELECTED" : "").">30 "._MINUTES."</option>"
."<option value=\"3600\"".(($refresh==3600) ? " SELECTED" : "").">1 "._HOUR."</option>"
."<option value=\"18000\"".(($refresh==18000) ? " SELECTED" : "").">5 "._HOURS."</option>"
."<option value=\"36000\"".(($refresh==36000) ? " SELECTED" : "").">10 "._HOURS."</option>"
."<option value=\"86400\"".(($refresh==86400) ? " SELECTED" : "").">24 "._HOURS."</option>"
."<option value=\"172800\"".(($refresh==172800) ? " SELECTED" : "").">48 "._HOURS."</option>"
."</select>";
if ($shownever) {
$out .= "<br><span class=\"tiny\">"._BLOCKCACHEMSG."</span>";
}
#." <font class=\"tiny\">"._ONLYHEADLINES."</font>";
return $out;
}
################################################################
function getRefreshTimeString($refresh) {
$r = (int)$refresh;
if ($r== 300) return "5 "._MINUTES;
else if ($r== 600) return "10 "._MINUTES;
else if ($r== 1200) return "20 "._MINUTES;
else if ($r== 1800) return "30 "._MINUTES;
else if ($r== 3600) return "1 "._HOUR;
else if ($r== 18000) return "5 "._HOURS;
else if ($r== 36000) return "10 "._HOURS;
else if ($r== 86400) return "24 "._HOURS;
else if ($r== 172800) return "48 "._HOURS;
else return "";
}
################################################################
function getViewSelect($view=0) {
$view = (int)$view;
$out = "<select name=\"view\">"
."<option value=\"0\"".(($view==0) ? " SELECTED" : "").">"._MVALL."</option>"
."<option value=\"1\"".(($view==1) ? " SELECTED" : "").">"._MVGROUPS."</option>"
."<option value=\"2\"".(($view==2) ? " SELECTED" : "").">"._MVADMIN."</option>"
."<option value=\"3\"".(($view==3) ? " SELECTED" : "").">"._MVANON."</option>"
."</select>";
return $out;
}
################################################################
function getGroupSelect($blockid = 0) {
global $prefix;
$blockid = (int)$blockid;
if (!empty($blockid)) {
$qry = "SELECT group_id FROM ${prefix}_groups_blocks WHERE block_id=".$blockid."";
$result = sql_query($qry);
while (list($groups[]) = sql_fetch_row($result));
}
$groups = (empty($groups)) ? 1 : $groups;
$groupoptions = getAllAccessLevelSelectOptions($groups);
$cnt = substr_count($groupoptions, "<option")+1;
$out = "<select name='groups[]' id='groups' size='".$cnt."' multiple>".$groupoptions."</select>";
return $out;
}
################################################################
function getPositionSelect($pos="") {
$out = "<select name=\"position\">\n"
."<option value=\"l\"".(($pos=="l") ? " SELECTED" : "").">"._LEFT."</option>\n"
."<option value=\"c\"".(($pos=="c") ? " SELECTED" : "").">"._CENTERUP."</option>\n"
."<option value=\"d\"".(($pos=="d") ? " SELECTED" : "").">"._CENTERDOWN."</option>\n"
."<option value=\"co\"".(($pos=="co") ? " SELECTED" : "").">"._CENTERUP_OHNERAND."</option>\n"//GG
."<option value=\"do\"".(($pos=="do") ? " SELECTED" : "").">"._CENTERDOWN_OHNERAND."</option>\n"//GG
."<option value=\"r\"".(($pos=="r") ? " SELECTED" : "").">"._RIGHT."</option>\n"
."<option value=\"sr\"".(($pos=="sr") ? " SELECTED" : "").">"._RIGHTSKYSCRAPER."</option>\n"//GG
."<option value=\"sl\"".(($pos=="sl") ? " SELECTED" : "").">"._LEFTSKYSCRAPER."</option>\n"//GG
."</select>\n";
return $out;
}
################################################################
function getHeadlineSelect ($url = "") {
global $prefix;
$res = sql_query("select hid, sitename, headlinesurl from ".$prefix."_headlines ORDER BY sitename");
$out = "<input type=\"text\" name=\"url\" size=\"30\" maxlength=\"200\" value=\"".$url."\"> ";
$out .= "<select name=\"headline\">\n";
$out .= "<option value=\"0\" selected>"._CUSTOM."</option>\n";
while(list($hid, $htitle, $hurl) = sql_fetch_row($res)) {
$out .= "<option value=\"".$hid."\"".(($url == $hurl) ? " selected" : "").">".$htitle."</option>\n";
}
$out .= "</select>\n [ <a href=\"admin.php?op=HeadlinesAdmin\">Setup</a> ]<br>\n";
$out .= "<font class=\"tiny\">"._SETUPHEADLINES."</font>\n";
return $out;
}
################################################################
function block_editmenue($block, $optitle = "") {
$optitle = (empty($optitle)) ? _BLOCKSADMIN : $optitle;
$active = ($block['active']) ?_DEACTIVATE : _ACTIVATE;
$link[] = "<a href=\"admin.php?op=ChangeStatus&bid=".$block['bid']."\">".$active."</a>";
$link[] = "<a href=\"admin.php?op=BlocksEdit&bid=".$block['bid']."\">"._EDIT."</a>";
if (!mxIsNewsBlockfile($block['blockfile'])) {
$link[] = "<a href=\"admin.php?op=BlocksDelete&bid=".$block['bid']."\">"._DELETE."</a>";
}
else {
$link[] = ""._DELETE."";
}
$link[] = "<a href=\"admin.php?op=BlocksAdmin\">"._BLOCKSADMIN."</a>";
$links = implode(" | ",$link);
OpenTable();
echo "<center><font class=\"option\"><b>"._BLOCKSADMIN.": "._FUNCTIONS."</b></font><br><br>";
echo "[ ".$links." ]</center>";
CloseTable();
echo "<br>";
}
################################################################
function block_show($gvs) {
global $prefix;
$bid = (int)$gvs['bid'];
$result = sql_query("select * from ${prefix}_blocks where bid=".$bid."");
$block = sql_fetch_array($result);
include("header.php");
#GraphicAdmin();
title(_BLOCKSADMIN);
block_editmenue($block);
showpreview($block);
include("footer.php");
}
################################################################
function showpreview($block) {
#mxDebugFuncVars($block);
global $prefix;
if (mxIsNewsBlockfile($block['blockfile'])) {
$result = sql_query("select * from ${prefix}_stories LIMIT 0,1");
$GLOBALS['story_blocks'] = sql_fetch_array($result);
$GLOBALS['name'] ="News";
@mxGetLangfile("News");
}
OpenTable();
$block = mxGetBlockData($block,1); // ohne cache
echo "<center>"._BLOCKPREVIEW." <b>".$block['title']."</b><br><br>\n";
render_blocks($block);
CloseTable();
echo "<br>\n";
}
################################################################
function fixweight() {
repairweigth();
Header("Location: admin.php?op=BlocksAdmin");
exit;
}
################################################################
function repairweigth() {
global $prefix;
$newweight = 0;
$lastpos = "xyz";
$qry = "select position,bid,weight
from ${prefix}_blocks
order by position, weight, bid";
$result = sql_query($qry);
while (list($pos,$bid,$weight) = sql_fetch_row($result)) {
if ($lastpos != $pos) {
$lastpos = $pos;
$newweight = 0;
}
$newweight++;
$qry = "update ${prefix}_blocks set weight = $newweight where bid=$bid";
if ($newweight != $weight || empty($bkey)) {
sql_query($qry);
}
}
}
################################################################
function BlockOrder ($gvs) {
global $prefix;
extract($gvs);
$result = sql_query("update ${prefix}_blocks set weight='$weight' where bid='$bidrep'");
$result2 = sql_query("update ${prefix}_blocks set weight='$weightrep' where bid='$bidori'");
Header("Location: admin.php?op=BlocksAdmin");
}
################################################################
function rssfail() {
include("header.php");
GraphicAdmin();
title(_BLOCKSADMIN);
OpenTable();
echo "<center><b>"._RSSFAIL."</b><br><br>"._RSSTRYAGAIN."<br><br>"._GOBACK."</center>";
CloseTable();
include("footer.php");
die;
}
################################################################
function ChangeStatus($gvs) {
global $prefix;
$ok = (empty($gvs['ok'])) ? 0 : 1;
$bid = (int)$gvs['bid'];
$result = sql_query("select * from ${prefix}_blocks where bid='$bid'");
$block = sql_fetch_array($result);
extract ($block);
if (($ok) OR ($block['active'] == 1)) {
$active = (empty($block['active'])) ? 1 : 0;
$result = sql_query("update ${prefix}_blocks set active='$active' where bid=".$bid."");
Header("Location: admin.php?op=BlocksAdmin");
}
else {
include("header.php");
title(_BLOCKACTIVATION);
OpenTable();
#echo ""._BLOCKPREVIEW." <b>".$block['title']."</b><br>";
echo "<center><br>"._WANT2ACTIVATE."<br><br>";
echo "[ <a href=\"admin.php?op=BlocksAdmin\">"._NO."</a> | <a href=\"admin.php?op=ChangeStatus&bid=".$bid."&ok=1\">"._YES."</a> ]<br>";
echo "</center>";
CloseTable();
echo "<br>";
showpreview($block);
block_editmenue ($block, _BLOCKACTIVATION);
include("footer.php");
}
}
################################################################
function BlocksDelete($gvs) {
global $prefix;
$ok = (empty($gvs['ok'])) ? 0 : 1;
$bid = (int)$gvs['bid'];
if ($ok) {
sql_query("DELETE FROM ${prefix}_blocks where bid='$bid'");
repairweigth();
Header("Location: admin.php?op=BlocksAdmin");
}
$result = sql_query("select * from ${prefix}_blocks where bid='$bid'");
$block = sql_fetch_array($result);
extract ($block);
include("header.php");
GraphicAdmin();
title(_BLOCKSADMIN);
OpenTable();
echo "<center>"._ARESUREDELBLOCK." <i>$title</i>?";
echo "<br><br>[ <a href=\"admin.php?op=BlocksAdmin\">"._NO."</a> | <a href=\"admin.php?op=BlocksDelete&bid=$bid&ok=1\">"._YES."</a> ]</center>";
CloseTable();
echo "<br>";
showpreview($block);
block_editmenue ($block, _BLOCKACTIVATION);
include("footer.php");
}
################################################################
function HeadlinesAdmin() {
global $bgcolor1, $bgcolor2, $bgcolor3, $prefix;
include ("header.php");
GraphicAdmin();
title(_HEADLINESADMIN);
OpenTable();
echo "<form action=\"admin.php\" method=\"post\">"
."<table border='0' cellspacing='1' cellpadding='2' bgcolor='$bgcolor2'>"
."<tr valign='top' bgcolor=\"$bgcolor2\"><th>"._SITENAME."</th><th>"._URL."</th><th>"._FUNCTIONS."</td></tr>";
$result = sql_query("select hid, sitename, headlinesurl from ".$prefix."_headlines order by sitename");
while(list($hid, $sitename, $headlinesurl) = sql_fetch_row($result)) {
echo "<tr valign='top' bgcolor=\"$bgcolor1\"><td class='content'>".$sitename."</td>"
."<td class='tiny'><a href=\"$headlinesurl\" target=\"new\">$headlinesurl</a></td>"
."<td nowrap class='tiny'>[ <a href=\"admin.php?op=HeadlinesEdit&hid=$hid\">"._EDIT."</a> | <a href=\"admin.php?op=HeadlinesDel&hid=$hid&ok=0\">"._DELETE."</a> ]</td></tr>";
}
echo "</form></table>";
CloseTable();
echo "<br>";
OpenTable();
echo "<font class=\"option\"><b>"._ADDHEADLINE."</b></font><br><br>"
."<font class=\"content\">"
."<form action=\"admin.php\" method=\"post\">"
."<table border=\"0\" width=\"100%\"><tr valign='top'><td>"
.""._SITENAME.":</td><td><input type=\"text\" name=\"xsitename\" size=\"31\" maxlength=\"30\"></td></tr><tr valign='top'><td>"
.""._RSSFILE.":</td><td><input type=\"text\" name=\"headlinesurl\" size=\"50\" maxlength=\"200\"></td></tr><tr valign='top'><td>"
."</td></tr></table>"
."<input type=\"hidden\" name=\"op\" value=\"HeadlinesAdd\">"
."<input type=\"submit\" value=\""._ADD."\">"
."</form>";
CloseTable();
include("footer.php");
}
################################################################
function HeadlinesEdit($gvs) {
global $prefix;
$hid = (int)$gvs['hid'];
$result = sql_query("select sitename, headlinesurl from ".$prefix."_headlines where hid=".$hid."");
list($xsitename, $headlinesurl) = sql_fetch_row($result);
include ("header.php");
GraphicAdmin();
title(_HEADLINESADMIN);
OpenTable();
echo "<center><font class=\"option\"><b>"._EDITHEADLINE."</b></font></center>
<form action=\"admin.php\" method=\"post\">
<input type=\"hidden\" name=\"hid\" value=\"$hid\">
<table border=\"0\" width=\"100%\"><tr valign='top'><td>
"._SITENAME.":</td><td><input type=\"text\" name=\"xsitename\" size=\"31\" maxlength=\"30\" value=\"".mxPrepareToDisplay($xsitename)."\"></td></tr><tr valign='top'><td>
"._RSSFILE.":</td><td><input type=\"text\" name=\"headlinesurl\" size=\"50\" maxlength=\"200\" value=\"".mxPrepareToDisplay($headlinesurl)."\"></td></tr><tr valign='top'><td>
</select></td></tr></table>
<input type=\"hidden\" name=\"op\" value=\"HeadlinesSave\">
<input type=\"submit\" value=\""._SAVECHANGES."\">
</form>";
CloseTable();
include("footer.php");
}
################################################################
function HeadlinesSave($pvs) {
global $prefix;
$hid = $pvs['hid'];
#$xsitename = str_replace(" ", "", $xsitename);
sql_query("update ".$prefix."_headlines set sitename='".mxAddSlashesForSQL($pvs['xsitename'])."', headlinesurl='".mxAddSlashesForSQL($pvs['headlinesurl'])."' where hid='".$hid."'");
Header("Location: admin.php?op=HeadlinesAdmin");
}
################################################################
function HeadlinesAdd($pvs) {
global $prefix;
#$xsitename = str_replace(" ", "", $xsitename);
sql_query("INSERT INTO ".$prefix."_headlines (sitename, headlinesurl) values ('".mxAddSlashesForSQL($pvs['xsitename'])."', '".mxAddSlashesForSQL($pvs['headlinesurl'])."')");
Header("Location: admin.php?op=HeadlinesAdmin");
}
################################################################
function HeadlinesDel($gvs) {
global $prefix;
extract($gvs);
$ok = (empty($ok)) ? 0 : 1;
$hid = (int)$hid;
if($ok) {
sql_query("DELETE FROM ".$prefix."_headlines where hid=".$hid."");
Header("Location: admin.php?op=HeadlinesAdmin");
}
else {
include("header.php");
GraphicAdmin();
title(_HEADLINESADMIN);
OpenTable();
echo "<center><br>";
echo "<font class=\"option\">";
echo "<b>"._SURE2DELHEADLINE."</b></font><br><br>";
echo "[ <a href=\"admin.php?op=HeadlinesDel&hid=".$hid."&ok=1\">"._YES."</a> | <a href=\"admin.php?op=HeadlinesAdmin\">"._NO."</a> ]<br><br>";
CloseTable();
include("footer.php");
}
}
################################################################
function mxGetBlockfileSelect($blockfile = "") {
global $prefix;
$result = sql_query("select blockfile from ${prefix}_blocks where blockfile<>''");
while(list($bfs) = sql_fetch_row($result)) {
$dbblocks[] = $bfs;
}
$blocksdir = dir("blocks");
while ($block = $blocksdir -> read()) {
if(substr($block, 0, 6) == "block-") {
$mode = (in_array($block, $dbblocks)) ? 1 : 0;
$is = ($mode) ? "* ": "";
$bl = ereg_replace("block-","",$block);
$bl = ereg_replace(".php","",$bl);
#$bl = ereg_replace("_"," ",$bl);
if (!mxIsNewsBlockfile($block)) {
$options[$mode][strtolower($bl)] = ($blockfile == $block) ? "<option value=\"".$block."\" selected>".$is.$bl."</option>" : "<option value=\"".$block."\">".$is.$bl."</option>";
}
}
}
closedir($blocksdir -> handle);
if (empty($blockfile)) $options[0][' '] = '<option value="" selected="selected"></option>';
$view = "";
if (isset($options[0])) {
ksort($options[0]);
$view .= implode("\n",$options[0]);
}
if (isset($options[0]) && isset($options[1])) {
$view .= "<option value=\"\">____________________________________</option>\n";
}
if (isset($options[1])) {
ksort($options[1]);
$view .= implode("\n",$options[1]);
}
$out = "<select name=\"blockfile\">".$view."</select>\n";
$out .= "<br><span class=\"tiny\">"._BLOCKINSYSTEM."</span>";
#$out .= " <font class=\"tiny\">"._FILEINCLUDE."</font>";
return $out;
}
##################################################################################
function resetBlockCache($bid = 0) {
global $prefix;
$bid = (int)$bid;
$qrybid = (empty($bid)) ? "" : " AND bid=".$bid." ";
$result = sql_query("select * from ${prefix}_blocks where blockfile<>'' ".$qrybid." LIMIT 0,1");
$block = sql_fetch_array($result);
if (empty($block)) return;
$handle = opendir('language');
while ($file = readdir($handle)) {
if (preg_match("/^lang\-(.+)\.php/", $file, $matches)) {
$field = "cache_".trim($matches[1]);
if (isset($block[$field])) {
$set[] = " ".$field." = ''";
}
}
}
closedir($handle);
if (isset($set)) {
$sets = implode(", ",$set);
$qry = "UPDATE ${prefix}_blocks SET ".$sets." where blockfile<>'' ".$qrybid."";
sql_query($qry);
}
if (empty($bid)) {
include("header.php");
GraphicAdmin();
title(_BLOCKSADMIN);
OpenTable();
echo "<center>"._BLOCKDELCACHEOK."<br><br><a href=\"admin.php?op=BlocksAdmin\">"._BLOCKDELCACHENEXT."</a></center>";
CloseTable();
include("footer.php");
}
}
##################################################################################
switch($_REQUEST['op']) {
case "BlocksAdmin":
BlocksAdmin($_GET);
break;
case "BlocksAdd":
Blocksave($_POST);
break;
case "BlocksEdit":
BlocksEdit($_GET);
break;
case "BlocksEditSave":
Blocksave($_POST);
break;
case "ChangeStatus":
ChangeStatus($_GET);
break;
case "BlocksDelete":
BlocksDelete($_GET);
break;
case "BlockOrder":
BlockOrder ($_GET);
break;
case "HeadlinesDel":
HeadlinesDel($_GET);
break;
case "HeadlinesAdd":
HeadlinesAdd($_POST);
break;
case "HeadlinesSave":
HeadlinesSave($_POST);
break;
case "HeadlinesAdmin":
HeadlinesAdmin();
break;
case "HeadlinesEdit":
HeadlinesEdit($_GET);
break;
case "fixweight":
fixweight();
break;
case "block_show":
block_show($_GET);
break;
case "BlocksListWeigth":
BlocksListWeigth($_POST);
break;
case "resetBlockCache":
resetBlockCache();
break;
}
?>