Początkujący
Postów: 219 Pomógł: 1
Data rejestracji: 16.03.2007 13:34
|
nie wiem który z tych bo piszę w administration/site_links.php
Ale podam wszystkie o jakich myślę:
weblinks.php
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2006 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "../maincore.php";
require_once BASEDIR."subheader.php";
require_once ADMIN."navigation.php";
include LOCALE.LOCALESET."admin/weblinks.php";
if (!checkrights("W") || !defined("iAUTH") || $aid != iAUTH) fallback("../index.php");
if (isset($weblink_id) && !isNum($weblink_id)) fallback(FUSION_SELF.$aidlink);
if (!isset($step)) $step = "";
$result = dbquery("SELECT * FROM ".$db_prefix."weblink_cats");
if (dbrows($result) != 0) {
if ($step == "delete") {
$dane = dbarray(dbquery("SELECT user_id from ".$db_prefix."weblinks WHERE weblink_id='$weblink_id'"));
if (EPS)
{
$przydzial = dbarray(dbquery("SELECT point_ammount from ".DB_PREFIX."eps_points WHERE point_id='3'"));
$result = dbquery("UPDATE ".DB_PREFIX."users SET points_normal=points_normal-".($przydzial['point_ammount'])." WHERE user_id='".$dane['user_id']."'");
}
$result = dbquery("DELETE FROM ".$db_prefix."weblinks WHERE weblink_id='$weblink_id'");
redirect(FUSION_SELF.$aidlink."&weblink_cat_id=$weblink_cat_id");
}
if (isset($_POST['save_link'])) {
$weblink_name = stripinput($_POST['weblink_name']);
$weblink_description = addslash($_POST['weblink_description']);
$weblink_url = stripinput($_POST['weblink_url']);
$weblink_images = stripinput($_POST['weblink_images']);
if ($step == "edit") {
$weblink_datestamp = isset($_POST['update_datestamp']) ? ", weblink_datestamp='".time()."'" : "";
$result = dbquery("UPDATE ".$db_prefix."weblinks SET weblink_name='$weblink_name', weblink_description='$weblink_description', weblink_url='$weblink_url', weblink_cat='$weblink_cat'".$weblink_datestamp.", weblinks_images='$weblink_images' WHERE weblink_id='$weblink_id'");
redirect("weblinks.php?weblink_cat_id=$weblink_cat");
} else {
$result = dbquery("INSERT INTO ".$db_prefix."weblinks (weblink_name, weblink_description, weblink_url, weblink_cat, weblink_datestamp, weblink_count, weblinks_images) VALUES ('$weblink_name', '$weblink_description', '$weblink_url', '$weblink_cat', '".time()."', '0', '$weblink_images')");
redirect(FUSION_SELF.$aidlink."&weblink_cat_id=$weblink_cat");
}
}
if ($step == "edit") {
$result = dbquery("SELECT * FROM ".$db_prefix."weblinks WHERE weblink_id='$weblink_id'");
$data = dbarray($result);
$weblink_name = $data['weblink_name'];
$weblink_description = stripslashes($data['weblink_description']);
$weblink_url = $data['weblink_url'];
$weblink_images = $data['weblinks_images'];
$formaction = FUSION_SELF.$aidlink."&step=edit&weblink_cat_id=$weblink_cat_id&weblink_id=$weblink_id";
opentable($locale['470']);
} else {
$weblink_name = "";
$weblink_description = "";
$weblink_url = "http://";
$weblink_images = "";
$formaction = FUSION_SELF.$aidlink;
opentable($locale['471']);
}
$editlist = ""; $sel = "";
$result2 = dbquery("SELECT * FROM ".$db_prefix."weblink_cats ORDER BY weblink_cat_name");
if (dbrows($result2) != 0) {
while ($data2 = dbarray($result2)) {
if ($step == "edit") $sel = ($data['weblink_cat'] == $data2['weblink_cat_id'] ? " selected" : "");
$editlist .= "<option value='".$data2['weblink_cat_id']."'$sel>".$data2['weblink_cat_name']."</option>\n";
}
}
echo "<form name='inputform' method='post' action='$formaction'>
<table align='center' width='460' cellspacing='0' cellpadding='0'>
<tr>
<td width='80' class='tbl'>".$locale['480']."</td>
<td class='tbl'><input type='text' name='weblink_name' value='$weblink_name' class='textbox' style='width:380px;'></td>
</tr>
<tr>
<td valign='top' width='80' class='tbl'>".$locale['481']."</td>
<td class='tbl'><textarea name='weblink_description' rows='5' class='textbox' style='width:380px;'>".$weblink_description."</textarea></td>
</tr>
<tr>
<td class='tbl'></td><td class='tbl'>
<input type='button' value='b' class='button' style='font-weight:bold;width:25px;' onClick=\"addText('weblink_description', '<b>', '</b>');\">
<input type='button' value='i' class='button' style='font-style:italic;width:25px;' onClick=\"addText('weblink_description', '<i>', '</i>');\">
<input type='button' value='u' class='button' style='text-decoration:underline;width:25px;' onClick=\"addText('weblink_description', '<u>', '</u>');\">
<input type='button' value='link' class='button' style='width:35px' onClick=\"addText('weblink_description', '<a href=\'http://\' target=\'_blank\'>', '</a>');\">
<input type='button' value='img' class='button' style='width:35px' onClick=\"addText('weblink_description', '<img src=\'', '\' style=\'margin:5px\' align=\'left\'>');\">
<input type='button' value='center' class='button' style='width:45px' onClick=\"addText('weblink_description', '<center>', '</center>');\">
<input type='button' value='small' class='button' style='width:40px' onClick=\"addText('weblink_description', '<span class=\'small\'>', '</span>');\">
<input type='button' value='small2' class='button' style='width:45px' onClick=\"addText('weblink_description', '<span class=\'small2\'>', '</span>');\">
<input type='button' value='alt' class='button' style='width:25px' onClick=\"addText('weblink_description', '<span class=\'alt\'>', '</span>');\">
</td>
</tr>
<tr>
<td width='80' class='tbl'>".$locale['482']."</td>
<td class='tbl'><input type='text' name='weblink_url' value='$weblink_url' class='textbox' style='width:380px;'></td>
</tr>
<tr>
<td width='80' class='tbl' valign='top'>Banner:</td>
<td class='tbl'><textarea name='weblink_images' rows='2' class='textbox' style='width:380px;'>".$weblink_images."</textarea></td>
</tr>
<tr>
<td class='tbl'></td><td class='tbl'>
<input type='button' value='img' class='button' style='width:30px;' onClick=\"addText('weblink_images', '[img]', '[/img]');\">
<input type='button' value='flash' class='button' style='width:38px;' onClick=\"addText('weblink_images', '[flash width=xxx height=xxx]http://', '[/flash\]');\">
</td>
</tr>
<tr>
<td width='80' class='tbl'>".$locale['483']."</td>
<td class='tbl'><select name='weblink_cat' class='textbox' style='width:150px;'>
$editlist</select></td>
</tr>
<tr>
<td align='center' colspan='2' class='tbl'>";
if ($step == "edit") echo "<input type='checkbox' name='update_datestamp' value='1'> ".$locale['485']."\n";
echo "<input type='submit' name='save_link' value='".$locale['484']."' class='button'></td>
</tr>
</table>
</form>\n";
closetable();
tablebreak();
opentable($locale['500']);
echo "<table align='center' cellpadding='0' cellspacing='0' width='400'>\n";
$result = dbquery("SELECT * FROM ".$db_prefix."weblink_cats ORDER BY weblink_cat_name");
if (dbrows($result) != 0) {
echo "<tr>
<td class='tbl2'>".$locale['501']."</td>
<td align='right' class='tbl2'>".$locale['502']."</td>
</tr>
<tr>
<td colspan='2' height='1'></td>
</tr>\n";
while ($data = dbarray($result)) {
if (!isset($weblink_cat_id)) $weblink_cat_id = "";
if ($data['weblink_cat_id'] == $weblink_cat_id) { $p_img = "off"; $div = ""; } else { $p_img = "on"; $div = "style='display:none'"; }
echo "<tr>
<td class='tbl2'>".$data['weblink_cat_name']."</td>
<td class='tbl2' align='right'><img onclick=\"javascript:flipBox('".$data['weblink_cat_id']."')\" src='".THEME."images/panel_".$p_img.".gif' name='b_".$data['weblink_cat_id']."'></td>
</tr>\n";
$result2 = dbquery("SELECT * FROM ".$db_prefix."weblinks WHERE weblink_cat='".$data['weblink_cat_id']."' ORDER BY weblink_name");
if (dbrows($result2) != 0) {
echo "<tr>
<td colspan='2'>
<div id='box_".$data['weblink_cat_id']."'$div>
<table cellpadding='0' cellspacing='0' width='100%'>\n";
while ($data2 = dbarray($result2)) {
echo "<tr>
<td class='tbl'><a href='$data2[weblink_url]' target='_blank'>".$data2['weblink_name']."</a></td>
<td width='75' class='tbl'><a href='".FUSION_SELF.$aidlink."&step=edit&weblink_cat_id=".$data['weblink_cat_id']."&weblink_id=".$data2['weblink_id']."'>".$locale['503']."</a> -
<a href='".FUSION_SELF.$aidlink."&step=delete&weblink_cat_id=".$data['weblink_cat_id']."&weblink_id=".$data2['weblink_id']."' onClick='return DeleteItem()'>".$locale['504']."</a></td>
</tr>\n";
}
echo "</table>
</div>
</td>
</tr>\n";
} else {
echo "<tr>
<td colspan='2'>
<div id='box_".$data['weblink_cat_id']."' style='display:none'>
<table width='100%' cellspacing='0' cellpadding='0'>
<tr>
<td class='tbl'>".$locale['505']."</td>
</tr>
</table>
</div>
</td>
</tr>\n";
}
}
echo "</table>\n";
echo "<script type='text/javascript'>
function DeleteItem() {
return confirm('".$locale['460']."');
}
</script>\n";
} else {
echo "<tr>
<td align='center' class='tbl'>
".$locale['506']."
<a href='weblink_cats.php".$aidlink."'>".$locale['507']."</td>
</tr>
</table>\n";
}
closetable();
} else {
opentable($locale['500']);
echo "<center>".$locale['508']."\n".$locale['509']."\n
<a href='weblink_cats.php".$aidlink."'>".$locale['510']."</a>".$locale['511']."</center>\n";
closetable();
}
echo "</td>\n";
require_once BASEDIR."footer.php";
?>
weblinks_cats.php
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2006 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "../maincore.php";
require_once BASEDIR."subheader.php";
require_once ADMIN."navigation.php";
include LOCALE.LOCALESET."admin/weblinks.php";
if (!checkrights("WC") || !defined("iAUTH") || $aid != iAUTH) fallback("../index.php");
if (isset($cat_id) && !isNum($cat_id)) fallback(FUSION_SELF.$aidlink);
if (!isset($step)) $step = "";
if (isset($status)) {
if ($status == "deln") {
$title = $locale['400'];
$message = "<b>".$locale['401']."</b>\n".$locale['402'];
} elseif ($status == "dely") {
$title = $locale['400'];
$message = "<b>".$locale['405']."</b>";
}
opentable($title);
echo "<div align='center'>".$message."</div>\n";
closetable();
tablebreak();
}
if ($step == "delete") {
$result = dbquery("SELECT * FROM ".$db_prefix."weblinks WHERE weblink_cat='$cat_id'");
if (dbrows($result) != 0) {
redirect(FUSION_SELF.$aidlink."&status=deln");
} else {
$result = dbquery("DELETE FROM ".$db_prefix."weblink_cats WHERE weblink_cat_id='$cat_id'");
redirect(FUSION_SELF.$aidlink."&status=dely");
}
} else {
if (isset($_POST['save_cat'])) {
$cat_name = stripinput($_POST['cat_name']);
$cat_description = stripinput($_POST['cat_description']);
$cat_access = isNum($_POST['cat_access']) ? $_POST['cat_access'] : "0";
if (isNum($_POST['cat_sort_by']) && $_POST['cat_sort_by'] == "1") {
$cat_sorting = "weblink_id ".($_POST['cat_sort_order'] == "ASC" ? "ASC" : "DESC");
} else if (isNum($_POST['cat_sort_by']) && $_POST['cat_sort_by'] == "2") {
$cat_sorting = "weblink_name ".($_POST['cat_sort_order'] == "ASC" ? "ASC" : "DESC");
} else if (isNum($_POST['cat_sort_by']) && $_POST['cat_sort_by'] == "3") {
$cat_sorting = "weblink_datestamp ".($_POST['cat_sort_order'] == "ASC" ? "ASC" : "DESC");
} else {
$cat_sorting = "weblink_name ASC";
}
if ($step == "edit") {
$result = dbquery("UPDATE ".$db_prefix."weblink_cats SET weblink_cat_name='$cat_name', weblink_cat_description='$cat_description', weblink_cat_sorting='$cat_sorting', weblink_cat_access='$cat_access', weblink_cat_image='$cat_image' WHERE weblink_cat_id='$cat_id'");
} else {
$result = dbquery("INSERT INTO ".$db_prefix."weblink_cats (weblink_cat_name, weblink_cat_description, weblink_cat_sorting, weblink_cat_access, weblink_cat_image) VALUES ('$cat_name', '$cat_description', '$cat_sorting', '$cat_access', '$cat_image')");
}
redirect(FUSION_SELF.$aidlink);
}
if ($step == "edit") {
$result = dbquery("SELECT * FROM ".$db_prefix."weblink_cats WHERE weblink_cat_id='$cat_id'");
$data = dbarray($result);
$cat_name = $data['weblink_cat_name'];
$cat_description = $data['weblink_cat_description'];
$cat_image = $data['weblink_cat_image'];
$cat_sorting = explode(" ", $data['weblink_cat_sorting']);
if ($cat_sorting[0] == "weblink_id") { $cat_sort_by = "1"; }
if ($cat_sorting[0] == "weblink_name") { $cat_sort_by = "2"; }
if ($cat_sorting[0] == "weblink_datestamp") { $cat_sort_by = "3"; }
$cat_sort_order = $cat_sorting[1];
$cat_access = $data['weblink_cat_access'];
$formaction = FUSION_SELF.$aidlink."&step=edit&cat_id=".$data['weblink_cat_id'];
opentable($locale['420']);
} else {
$cat_name = "";
$cat_description = "";
$cat_image = "";
$cat_sort_by = "weblink_name";
$cat_sort_order = "ASC";
$cat_access = "";
$formaction = FUSION_SELF.$aidlink;
opentable($locale['421']);
}
$user_groups = getusergroups(); $access_opts = ""; $sel = "";
while(list($key, $user_group) = each($user_groups)){
$sel = ($cat_access == $user_group['0'] ? " selected" : "");
$access_opts .= "<option value='".$user_group['0']."'$sel>".$user_group['1']."</option>\n";
}
echo "<form name='addcat' method='post' action='$formaction'>
<table align='center' cellpadding='0' cellspacing='0' width='400'>
<tr>
<td width='1%' class='tbl' style='white-space:nowrap'>".$locale['430']."</td>
<td class='tbl'><input type='text' name='cat_name' value='$cat_name' class='textbox' style='width:200px;'></td>
</tr>
<tr>
<td width='1%' class='tbl' style='white-space:nowrap'>".$locale['431']."</td>
<td class='tbl'><input type='text' name='cat_description' value='$cat_description' class='textbox' style='width:250px;'></td>
</tr>
<tr>
<td width='130' class='tbl'>Img URL:</td>
<td class='tbl'><input type='text' name='cat_image' value='$cat_image' class='textbox' style='width:250px;'></td>
</tr>
<tr>
<td width='1%' class='tbl' style='white-space:nowrap'>".$locale['434']."</td>
<td class='tbl'><select name='cat_sort_by' class='textbox'>
<option value='1'".($cat_sort_by == "1" ? " selected" : "").">".$locale['435']."</option>
<option value='2'".($cat_sort_by == "2" ? " selected" : "").">".$locale['436']."</option>
<option value='3'".($cat_sort_by == "3" ? " selected" : "").">".$locale['437']."</option>
</select> -
<select name='cat_sort_order' class='textbox'>
<option value='ASC'".($cat_sort_order == "ASC" ? " selected" : "").">".$locale['438']."</option>
<option value='DESC'".($cat_sort_order == "DESC" ? " selected" : "").">".$locale['439']."</option>
</select></td>
</tr>
<tr>
<td width='1%' class='tbl' style='white-space:nowrap'>".$locale['433']."</td>
<td class='tbl'><select name='cat_access' class='textbox' style='width:150px;'>
$access_opts</select></td>
</tr>
<tr>
<td align='center' colspan='2' class='tbl'>
<input type='submit' name='save_cat' value='".$locale['432']."' class='button'></td>
</tr>
</table>
</form>\n";
closetable();
tablebreak();
opentable($locale['440']);
echo "<table align='center' cellpadding='0' cellspacing='1' width='400' class='tbl-border'>\n";
$result = dbquery("SELECT * FROM ".$db_prefix."weblink_cats ORDER BY weblink_cat_name");
if (dbrows($result) != 0) {
$i = 0;
echo "<tr>
<td class='tbl2'>".$locale['441']."</td>
<td align='center' class='tbl2'>Img</td>
<td align='center' width='1%' class='tbl2' style='white-space:nowrap'>".$locale['445']."</td>
<td align='center' width='1%' class='tbl2' style='white-space:nowrap'>".$locale['502']."</td>
</tr>\n";
while ($data = dbarray($result)) {
$cell_color = ($i % 2 == 0 ? "tbl1" : "tbl2");
echo "<tr>
<td class='$cell_color'><b>".$data['weblink_cat_name']."</b>"
.($data['weblink_cat_description'] ? "\n<span class='small'>".trimlink($data['weblink_cat_description'], 45)."</span>" : "")."</td>
<td align='center' class='$cell_color'>";
if ($data['weblink_cat_image'] > "0") {
echo "<img src='".IMAGES."tick.gif'>";
} else {
echo "-";
}
echo "<td align='center' width='1%' class='$cell_color' style='white-space:nowrap'>".getgroupname($data['weblink_cat_access'])."</td>
<td align='center' width='1%' class='$cell_color' style='white-space:nowrap'><a href='".FUSION_SELF.$aidlink."&step=edit&cat_id=".$data['weblink_cat_id']."'>".$locale['503']."</a> -
<a href='".FUSION_SELF.$aidlink."&step=delete&cat_id=".$data['weblink_cat_id']."'>".$locale['504']."</a></td>
</tr>\n";
$i++;
}
echo "</table>\n";
} else {
echo "<tr><td align='center' class='tbl1'>".$locale['508']."</td></tr>\n</table>\n";
}
closetable();
}
echo "</td>\n";
require_once BASEDIR."footer.php";
?>
site_links.php
<?
/*--------------------------------------------------------------------------+
| INF: eXtreme Navigation Panel dla PHP-Fusion v6
|---------------------------------------------
| author: eXtreme-fusion crew - (c) 2005
| web: http://extreme-fusion.pl
|---------------------------------------------
| Wycinanie kodu poza eXtreme-pack zabrionione.
| Je¶li po kopiowaniu co¶ nie działa - miej pretensje do siebie.
+--------------------------------------------------------------------------*/
require_once "../maincore.php";
require_once "subheader.php";
require_once ADMIN."navigation.php";
include LOCALE.LOCALESET."admin/sitelinks.php";
if (!checkrights("SL") || !defined("iAUTH") || $aid != iAUTH) fallback("../index.php");
if (isset($action) && $action=="ldel")
{
$data = dbarray(dbquery("SELECT link_position,link_group_id,link_order_left from ".$db_prefix."site_links WHERE link_id='".$link_id."'"));
$result = dbquery("DELETE from ".$db_prefix."site_links WHERE link_id='".$link_id."'");
if ($data['link_position']==1) {
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_order_left=link_order_left-1 WHERE link_group_id='".$data['link_group_id']."' AND link_order_left>='".$data['link_order_left']."'");
} elseif($data['link_position']==2) {
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_order_left=link_order_left-1 WHERE link_group_id='".$data['link_group_id']."' AND link_order_left>='".$data['link_order_left']."'");
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_order=link_order-1 WHERE link_position>='".$data['link_position']."' AND link_order>='".$data['link_order']."'");
} elseif ($data['link_position']==3) {
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_order=link_order-1 WHERE link_position='".$data['link_position']."' AND link_order>='".$data['link_order']."'");
}
}
if (isset($action) && $action=="gdel")
{
$data = dbarray(dbquery("SELECT group_order from ".$db_prefix."site_links_groups WHERE group_id='".$group_id."'"));
$result = dbquery("DELETE from ".$db_prefix."site_links_groups WHERE group_id='".$group_id."'");
$result = dbquery("UPDATE ".$db_prefix."site_links_groups SET group_order=group_order-1 WHERE group_order>='".$data['group_order']."'");
}
if (isset($action) && $action=="lup")
{
$data = dbarray(dbquery("SELECT link_id,link_group_id from ".$db_prefix."site_links WHERE link_group_id='".$group_id."' AND link_order_left='".$order."'"));
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_order_left=link_order_left+1 WHERE link_id='".$data['link_id']."' AND link_group_id='".$data['link_group_id']."'");
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_order_left=link_order_left-1 WHERE link_id='".$link_id."'");
}
if (isset($action) && $action=="ldown")
{
$data = dbarray(dbquery("SELECT link_id,link_group_id from ".$db_prefix."site_links WHERE link_group_id='".$group_id."' AND link_order_left='".$order."'"));
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_order_left=link_order_left-1 WHERE link_id='".$data['link_id']."' AND link_group_id='".$data['link_group_id']."'");
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_order_left=link_order_left+1 WHERE link_id='".$link_id."'");
}
if (isset($action) && $action=="lleft")
{
$data = dbarray(dbquery("SELECT link_id from ".$db_prefix."site_links WHERE link_position>='2' AND link_order='".$order."'"));
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_order=link_order+1 WHERE link_id='".$data['link_id']."'");
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_order=link_order-1 WHERE link_id='".$link_id."'");
}
if (isset($action) && $action=="lright")
{
$data = dbarray(dbquery("SELECT link_id from ".$db_prefix."site_links WHERE link_position>='2' AND link_order='".$order."'"));
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_order=link_order-1 WHERE link_id='".$data['link_id']."'");
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_order=link_order+1 WHERE link_id='".$link_id."'");
}
if (isset($action) && $action=="gup")
{
$data = dbarray(dbquery("SELECT group_id from ".$db_prefix."site_links_groups WHERE group_order='".$order."'"));
$result = dbquery("UPDATE ".$db_prefix."site_links_groups SET group_order=group_order+1 WHERE group_id='".$data['group_id']."'");
$result = dbquery("UPDATE ".$db_prefix."site_links_groups SET group_order=group_order-1 WHERE group_id='".$group_id."'");
}
if (isset($action) && $action=="gdown")
{
$data = dbarray(dbquery("SELECT group_id from ".$db_prefix."site_links_groups WHERE group_order='".$order."'"));
$result = dbquery("UPDATE ".$db_prefix."site_links_groups SET group_order=group_order-1 WHERE group_id='".$data['group_id']."'");
$result = dbquery("UPDATE ".$db_prefix."site_links_groups SET group_order=group_order+1 WHERE group_id='".$group_id."'");
}
if (isset($action) && ($action=="ladd" || $action=="ledit"))
{
opentable($locale['N_020']);
if ($action=="ledit")
{
$r = dbarray(dbquery("SELECT * from ".$db_prefix."site_links WHERE link_id='".$link_id."'"));
$link_name = $r['link_name'];
$link_url = $r['link_url'];
$link_visibility = $r['link_visibility'];
$link_position = $r['link_position'];
$link_image = $r['link_image'];
$form_action = FUSION_SELF.$aidlink."&action=lupdate&link_id=".$link_id."&group_id=".$group_id;
} else {
$form_action = FUSION_SELF.$aidlink."&action=lsave&group_id=".$group_id;
$link_name = "";
$link_url = "";
$link_visibility = "";
$link_position = "";
$link_image = "";
}
$data = dbarray(dbquery("SELECT group_name from ".$db_prefix."site_links_groups WHERE group_id='".$group_id."'"));
echo "<form name='linkadd' method='post' action='".$form_action."'>
<table width='50%' cellpadding='3' cellspacing='0' border='0' align='center'>
";
if ($group_id!=0) echo "<tr><td class='tbl2' align='right'>".$locale['N_021']." </td><td class='tbl2'><font color='orange'><strong>".$data['group_name']."</strong></font></td></tr>";
else echo "<tr><td class='tbl2' align='right'>".$locale['N_021']."</td><td class='tbl2'><font color='orange'><strong>".$locale['N_022']."</strong></font></td></tr>";
echo "<tr height='7'><td></td><td></td></tr>
<tr><td>".$locale['N_023']."</td><td align='center'><input type='text' class='textbox' name='link_name' value='".$link_name."' style='width: 200px;'></td></tr>
<tr><td>".$locale['N_024']."</td><td align='center'><input type='text' class='textbox' name='link_url' value='".$link_url."' style='width: 200px;'></td></tr>
<tr><td>".$locale['N_025']."</td><td align='center'><input type='text' class='textbox' name='link_image' value='".$link_image."' style='width: 200px;'></td></tr>
";
if (!isset($visibility_opts)) $visibility_opts="";
$user_groups = getusergroups();
while(list($key, $user_group) = each($user_groups)){
$sel = ($link_visibility == $user_group['0'] ? " selected" : "");
$visibility_opts .= "<option value='".$user_group['0']."'$sel>".$user_group['1']."</option>\n";
}
echo "
<tr><td>".$locale['N_026']."</td><td align='center'>
<select name='link_visibility' class='textbox' style='width:150'>
".$visibility_opts."</select></td></tr>
<tr><td>".$locale['N_027']."</td><td align='center'>
<select name='link_position' class='textbox' style='width:150'>
<option value='1' ".($link_position==1 ? 'selected' : '').">".$locale['N_028']."</option>
<option value='2' ".($link_position==2 ? 'selected' : '').">".$locale['N_029']."</option>
<option value='3' ".($link_position==3 ? 'selected' : '').">".$locale['N_030']."</option>
</select>
</td></tr>
";
if ($group_id==0 && $action=="ledit")
{
echo "<tr><td>".$locale['N_021']."</td>
<td align='center'><select name='link_group_id' class='textbox' style='width:150'>
<option value='0'>---------</option>";
$result = dbquery("SELECT * from ".$db_prefix."site_links_groups ORDER BY group_order");
while ($data = dbarray($result))
{
echo "<option value='".$data['group_id']."'>".$data['group_name']."</option>";
}
echo"</selected></td></tr>";
} echo "
<tr><td></td><td align='center'><input type='submit' value='".($action=='ladd' ? $locale['N_031'] : $locale['N_032'])."' class='button'></td></tr>
</table></form>
<table width='50%' cellpadding='3' cellspacing='0' border='0' align='center'>
<tr><td align='center'>".$locale['N_033']."</td></tr>
</table>
";
closetable();
tablebreak();
}
if (isset($action) && $action=="lsave")
{
$link_name = $_POST['link_name'];
$link_url = $_POST['link_url'];
$link_visibility = $_POST['link_visibility'];
$link_position = $_POST['link_position'];
if ($link_position==1){
$result = dbquery("SELECT * FROM ".$db_prefix."site_links WHERE link_group_id='".$group_id."' ORDER BY link_order_left DESC LIMIT 1");
if (dbrows($result) != 0) { $data = dbarray($result); $neworder_left = $data['link_order_left'] + 1; } else { $neworder_left = 1; }
$neworder=0; }
elseif ($link_position==2) {
$result = dbquery("SELECT * FROM ".$db_prefix."site_links WHERE link_group_id='".$group_id."' ORDER BY link_order_left DESC LIMIT 1");
if (dbrows($result) != 0) { $data = dbarray($result); $neworder_left = $data['link_order_left'] + 1; } else { $neworder_left = 1; }
$result1 = dbquery("SELECT * FROM ".$db_prefix."site_links WHERE link_position>='2' ORDER BY link_order DESC LIMIT 1");
if (dbrows($result1) != 0) { $data1 = dbarray($result1); $neworder = $data1['link_order'] + 1; } else { $neworder = 1; }
} elseif ($link_position==3) {
$result1 = dbquery("SELECT * FROM ".$db_prefix."site_links WHERE link_position>='2' ORDER BY link_order DESC LIMIT 1");
if (dbrows($result1) != 0) { $data1 = dbarray($result1); $neworder = $data1['link_order'] + 1; } else { $neworder = 1; }
$neworder_left=0;
}
$result=dbquery("INSERT INTO ".$db_prefix."site_links VALUES('', '$link_name', '$link_url', '$link_visibility', '$link_position', '$link_window', '$neworder', '$neworder_left', '$group_id', '$link_image')");
}
if (isset($action) && $action=="lupdate")
{
$data = dbarray(dbquery("SELECT * from ".$db_prefix."site_links WHERE link_id='".$link_id."'"));
$link_name = $_POST['link_name'];
$link_url = $_POST['link_url'];
$link_visibility = $_POST['link_visibility'];
$link_position = $_POST['link_position'];
$link_image = $_POST['link_image'];
if ($data['link_position']==$link_position)
{
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_name='".$link_name."', link_url='".$link_url."', link_visibility='".$link_visibility."', link_position='".$link_position."', link_window='0', link_image='".$link_image."' WHERE link_id='".$link_id."'");
} else {
if ($data['link_position']==1)
{
if ($link_position==2)
{
// dodanie do górnego
$result1 = dbquery("SELECT * FROM ".$db_prefix."site_links WHERE link_position>='2' ORDER BY link_order DESC LIMIT 1");
if (dbrows($result1) != 0) { $data1 = dbarray($result1); $neworder = $data1['link_order'] + 1; } else { $neworder = 1; }
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_name='".$link_name."', link_url='".$link_url."', link_visibility='".$link_visibility."', link_position='".$link_position."', link_window='0', link_order='".$neworder."', link_image='".$link_image."' WHERE link_id='".$link_id."'");
}
if ($link_position==3)
{
// usunięcie z lewego i....
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_name='".$link_name."', link_url='".$link_url."', link_visibility='".$link_visibility."', link_position='".$link_position."', link_window='0', link_order_left='0', link_image='".$link_image."' WHERE link_id='".$link_id."'");
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_order_left=link_order_left-1 WHERE link_group_id='".$data['link_group_id']."' AND link_order_left>='".$data['link_order_left']."'");
// dodanie do górnego
$result1 = dbquery("SELECT * FROM ".$db_prefix."site_links WHERE link_position>='2' ORDER BY link_order DESC LIMIT 1");
if (dbrows($result1) != 0) { $data1 = dbarray($result1); $neworder = $data1['link_order'] + 1; } else { $neworder = 1; }
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_name='".$link_name."', link_url='".$link_url."', link_visibility='".$link_visibility."', link_position='".$link_position."', link_window='0', link_order='".$neworder."', link_image='".$link_image."' WHERE link_id='".$link_id."'");
}
}
if ($data['link_position']==2)
{
if ($link_position==1)
{
// usunięcie z górnego
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_name='".$link_name."', link_url='".$link_url."', link_visibility='".$link_visibility."', link_position='".$link_position."', link_window='0', link_order='0', link_image='".$link_image."' WHERE link_id='".$link_id."'");
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_order=link_order-1 WHERE link_position>='2' AND link_order>='".$data['link_order']."'");
}
if ($link_position==3)
{
// usunięcie z lewego
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_name='".$link_name."', link_url='".$link_url."', link_visibility='".$link_visibility."', link_position='".$link_position."', link_window='0', link_order_left='0', link_image='".$link_image."' WHERE link_id='".$link_id."'");
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_order_left=link_order_left-1 WHERE link_group_id='".$data['link_group_id']."' AND link_order_left>='".$data['link_order_left']."'");
}
}
if ($data['link_position']==3)
{
if ($link_position==1 && $_POST['link_group_id']!=0)
{
// usunięcie z górnego i ...
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_name='".$link_name."', link_url='".$link_url."', link_visibility='".$link_visibility."', link_position='".$link_position."', link_window='0', link_order='0', link_image='".$link_image."' WHERE link_id='".$link_id."'");
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_order=link_order-1 WHERE link_position>='2' AND link_order>='".$data['link_order']."'");
// dodanie do lewego
$group_id = $_POST['link_group_id'];
$result = dbquery("SELECT * FROM ".$db_prefix."site_links WHERE link_group_id='".$group_id."' ORDER BY link_order_left DESC LIMIT 1");
if (dbrows($result) != 0) { $data = dbarray($result); $neworder_left = $data['link_order_left'] + 1; } else { $neworder_left = 1; }
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_name='".$link_name."', link_url='".$link_url."', link_visibility='".$link_visibility."', link_position='".$link_position."', link_order_left='".$neworder_left."', link_window='0', link_group_id='".$group_id."', link_image='".$link_image."' WHERE link_id='".$link_id."'");
}
if ($link_position==2 && $_POST['link_group_id']!=0)
{
// dodanie do lewego
$group_id = $_POST['link_group_id'];
$result = dbquery("SELECT * FROM ".$db_prefix."site_links WHERE link_group_id='".$group_id."' ORDER BY link_order_left DESC LIMIT 1");
if (dbrows($result) != 0) { $data = dbarray($result); $neworder_left = $data['link_order_left'] + 1; } else { $neworder_left = 1; }
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_name='".$link_name."', link_url='".$link_url."', link_visibility='".$link_visibility."', link_position='".$link_position."', link_order_left='".$neworder_left."', link_window='0', link_group_id='".$group_id."', link_image='".$link_image."' WHERE link_id='".$link_id."'");
}
}
}
}
if (isset($action) && ($action=="gadd" || $action=="gedit"))
{
opentable($locale['N_034']);
if ($action=="gedit")
{
$r = dbarray(dbquery("SELECT * from ".$db_prefix."site_links_groups WHERE group_id='".$group_id."'"));
$group_name = $r['group_name'];
$group_access = $r['group_access'];
$group_image = $r['group_image'];
$group_hide = $r['group_hide'];
$form_action = FUSION_SELF.$aidlink."&action=gupdate&group_id=".$group_id;
} else {
$group_name = "";
$group_access = "";
$group_image = "";
$group_hide = "";
$form_action = FUSION_SELF.$aidlink."&action=gsave"; }
echo "<form name='groupadd' method='post' action='".$form_action."'>
<table width='50%' cellpadding='3' cellspacing='0' border='0' align='center'>
<tr><td class='tbl2' align='left'> </td><td class='tbl2'>".$locale['N_035']."</td></tr>
<tr height='7'><td></td><td></td></tr>
<tr><td>".$locale['N_023']."</td><td align='center'><input type='text' class='textbox' name='group_name' value='".$group_name."' style='width: 200px;'></td></tr>
<tr><td>".$locale['N_025']."</td><td align='center'><input type='text' class='textbox' name='group_image' value='".$group_image."' style='width: 200px;'></td></tr>
";
if (!isset($visibility_opts)) $visibility_opts="";
$user_groups = getusergroups();
while(list($key, $user_group) = each($user_groups)){
$sel = ($group_access == $user_group['0'] ? " selected" : "");
$visibility_opts .= "<option value='".$user_group['0']."'$sel>".$user_group['1']."</option>\n";
}
echo "
<tr><td>".$locale['N_026']."</td><td align='center'>
<select name='group_access' class='textbox' style='width:150'>
".$visibility_opts."</select>
</td></tr>
<tr><td>".$locale['N_036']."</td><td align='center'>
<select name='group_hide' class='textbox' style='width:150'>
<option value='0' ".(0==$group_hide ? 'selected' : '').">".$locale['N_037']."</option>
<option value='1' ".(1==$group_hide ? 'selected' : '').">".$locale['N_038']."</option>
</select>
</td></tr>
<tr><td></td><td align='center'><input type='submit' value='".($action=='gadd' ? $locale['N_031'] : $locale['N_032'])."' class='button'></td></tr>
</table></form>";
closetable();
tablebreak();
}
if (isset($action) && $action=="gsave")
{
$group_name = $_POST['group_name'];
$group_image = $_POST['group_image'];
$group_access = $_POST['group_access'];
$result = dbquery("SELECT * FROM ".$db_prefix."site_links_groups ORDER BY group_order DESC LIMIT 1");
if (dbrows($result) != 0) { $data = dbarray($result); $neworder = $data['group_order'] + 1; } else { $neworder = 1; }
$result=dbquery("INSERT INTO ".$db_prefix."site_links_groups VALUES('', '$group_name', '$group_access', '$group_image', '$neworder', '$group_hide')");
}
if (isset($action) && $action=="gupdate")
{
$result = dbquery("UPDATE ".$db_prefix."site_links_groups SET group_name='".$group_name."', group_access='".$group_access."', group_image='".$group_image."', group_hide='".$group_hide."' WHERE group_id='".$group_id."'");
}
opentable($locale['N_001']);
echo "<table width='70%' cellpadding='3' cellspacing='0' border='0' align='center'>
<tr><td class='tbl2'>".$locale['N_002']."</td><td class='tbl2'>".$locale['N_003']."</td><td class='tbl2' align='center'>".$locale['N_004']."</td><td align='center' class='tbl2'>".$locale['N_005']."</td><td align='center' class='tbl2'>".$locale['N_006']."</td><td align='center' class='tbl2'>".$locale['N_007']."</td></tr>
<tr height='9'><td></td><td></td><td></td><td></td><td></td><td></td></tr>";
$group_r = dbquery("SELECT * from ".$db_prefix."site_links_groups ORDER BY group_order");
if (dbrows($group_r))
{
$g_num = dbrows($group_r);
$g_count = 1;
while ($group = dbarray($group_r))
{
echo "<tr><td class='tbl1'>";
if ($group['group_image'] !="") {
echo "<img src='".BASEDIR.$group['group_image']."' border='0'>";
} else {
echo "\n";
}
echo " <font color='orange'><strong>".$group['group_name']."</strong></font>".($group['group_hide']==1 ? '<strong> - '.$locale['N_012'].'</strong>' : '')."<strong> - [ <a href='".FUSION_SELF.$aidlink."&action=gedit&group_id=".$group['group_id']."'>".$locale['N_013']."</a> ]</strong></td>
<td class='tbl1' align='center'> </td>\n
<td class='tbl1'> </td>
<td class='tbl1' align='center'><strong>";
$gname="";
$user_groups = getusergroups();
while(list($key, $user_group) = each($user_groups)) {
$gname .= ($group['group_access'] == $user_group['0'] ? $user_group['1'] : ""); }
echo $gname;
echo "</strong></td>
<td class='tbl1' align='center'>";
if ($g_count!=1) echo "<a href='".FUSION_SELF.$aidlink."&action=gup&group_id=".$group['group_id']."&order=".($group['group_order']-1)."'><strong><img src='".THEME."images/up.gif'></strong></a>";
if ($g_count!=$g_num) echo "<a href='".FUSION_SELF.$aidlink."&action=gdown&group_id=".$group['group_id']."&order=".($group['group_order']+1)."'><strong><img src='".THEME."images/down.gif'></strong></a>";
if ($g_num==1) echo " ";
echo "</td><td class='tbl1' align='center'><strong>[";
$link_r = dbquery("SELECT * from ".$db_prefix."site_links WHERE link_group_id='".$group['group_id']."' ORDER BY link_order");
if (!dbrows($link_r))
{
echo " <a href='".FUSION_SELF.$aidlink."&action=gdel&group_id=".$group['group_id']."'>".$locale['N_014']."</a> | ";
}
echo "<a href='".FUSION_SELF.$aidlink."&action=ladd&group_id=".$group['group_id']."'>".$locale['N_015']."</a>]</strong>
</td></tr>";
$link_r = dbquery("SELECT * from ".$db_prefix."site_links WHERE link_group_id='".$group['group_id']."' ORDER BY link_order_left");
$l_count = 1;
$l_num = dbrows($link_r);
while ($link = dbarray($link_r))
{
if ($link['link_position']<"3")
{
echo "<tr><td> <img src='".THEME."images/bullet.gif' border='0'>";
if (strstr($link['link_url'], "http://") || strstr($link['link_url'], "https://"))
echo " <a href='".$link['link_url']."'>".$link['link_name']."</a></td>\n";
else echo " <a href='".BASEDIR.$link['link_url']."'>".$link['link_name']."</a></td>\n";
echo "<td align='center'>".($link['link_image']!=''? '<img src='.BASEDIR.$link['link_image'].'>' : '-' )."</td>\n
<td align='center'>".($link['link_position']>='2'? '<img src='.BASEDIR.'images/tick.gif'.'>' : '-')."</td>
<td align='center'>";
$gname="";
$user_groups = getusergroups();
while(list($key, $user_group) = each($user_groups)) {
$gname .= ($link['link_visibility'] == $user_group['0'] ? $user_group['1'] : ""); }
echo $gname;
echo "</td><td align='center'>\n";
if ($l_count!=1) echo "<a href='".FUSION_SELF.$aidlink."&action=lup&link_id=".$link['link_id']."&order=".($link['link_order_left']-1)."&group_id=".$link['link_group_id']."'><img src='".THEME."images/up.gif'></a>\n";
if ($l_count!=$l_num) echo "<a href='".FUSION_SELF.$aidlink."&action=ldown&link_id=".$link['link_id']."&order=".($link['link_order_left']+1)."&group_id=".$link['link_group_id']."'><img src='".THEME."images/down.gif'></a>\n";
echo "</td><td align='center'>[<a href='".FUSION_SELF.$aidlink."&action=ledit&link_id=".$link['link_id']."&group_id=".$link['link_group_id']."'>".$locale['N_013']."</a> / <a href='".FUSION_SELF.$aidlink."&action=ldel&link_id=".$link['link_id']."'>".$locale['N_014']."</a>]</td></tr>\n";
$l_count++;
}
}
echo "";
$g_count++;
}
}
else
echo $locale['N_016'];
echo "</table>
<table width='60%' cellpadding='3' cellspacing='0' border='0' align='center'>
<tr><td align='center'>[ <a href='".FUSION_SELF.$aidlink."&action=gadd'>".$locale['N_017']."</a> ]</td></tr></table>";
echo "<table width='50%' cellpadding='0' cellspacing='0' border='0' align='center'>
<tr height='20'><td></td><td></td></tr>
<tr><td class='tbl2'>".$locale['N_018']."</td><td class='tbl2' align='center'>[<a href='".FUSION_SELF.$aidlink."&action=ladd&group_id=0&link_position=3'>".$locale['N_015']."</a>]</td></tr>
<tr height='5'><td></td><td></td></tr>\n";
$link_top_r = dbquery("SELECT * from ".$db_prefix."site_links WHERE link_position='3'");
while ($link_top = dbarray($link_top_r))
{
if (strstr($link['link_url'], "http://") || strstr($link['link_url'], "https://"))
echo "<tr><td> <img src='".THEME."images/bullet.gif' border='0'> <a href='".$link_top['link_url']."'>".$link_top['link_name']."</a></td>";
else echo "<tr><td> <img src='".THEME."images/bullet.gif' border='0'> <a href='".BASEDIR.$link_top['link_url']."'>".$link_top['link_name']."</a></td>";
echo "<td align='center'>[<a href='".FUSION_SELF.$aidlink."&action=ledit&group_id=0&link_id=".$link_top['link_id']."'>".$locale['N_013']."</a> / <a href='".FUSION_SELF.$aidlink."&action=ldel&link_id=".$link_top['link_id']."'>".$locale['N_014']."</a>]</td></tr>\n";
}
echo "<tr height='1'><td class='tbl'></td><td></td></tr></table>";
closetable();
tablebreak();
opentable($locale['N_019']);
echo"<table width='70%' cellpadding='0' cellspacing='0' border='0' align='center'>
";
$result = dbquery("SELECT * from ".$db_prefix."site_links WHERE link_position>='2' ORDER BY link_order");
echo "<tr><td align='center'><strong>";
$num = dbrows($result);
$x=1;
while ($data = dbarray($result))
{
if ($x==1) echo "<a href='".BASEDIR.$data['link_url']."'>".$data['link_name']."</a> <a href='".FUSION_SELF.$aidlink."&action=lright&link_id=".$data['link_id']."&order=".($data['link_order']+1)."'><img src='".THEME."images/right.gif'></a> <img src='".THEME."images/bullet.gif'> ";
elseif ($x==$num) echo "<a href='".FUSION_SELF.$aidlink."&action=lleft&link_id=".$data['link_id']."&order=".($data['link_order']-1)."'><img src='".THEME."images/left.gif'></a> <a href='".BASEDIR.$data['link_url']."'>".$data['link_name']."</a>";
else echo "<a href='".FUSION_SELF.$aidlink."&action=lleft&link_id=".$data['link_id']."&order=".($data['link_order']-1)."'><img src='".THEME."images/left.gif'></a> <a href='".BASEDIR.$data['link_url']."'>".$data['link_name']."</a> <a href='".FUSION_SELF.$aidlink."&action=lright&link_id=".$data['link_id']."&order=".($data['link_order']+1)."'><img src='".THEME."images/right.gif'></a> <img src='".THEME."images/bullet.gif'> ";
$x++;
}
echo"</strong></td></tr>
</table>";
closetable();
require_once BASEDIR."footer.php";
?>
|