Początkujący
Postów: 177
Data rejestracji: 17.03.2006 19:10
|
Chciałem zastosować tą modyfikacje dla EP
MOD: Mozliwosc wpisywania kodu HTML w nazwach linkach nawigacji:
Edytujemy plik: administration/site_links.php
Zmieniamy 2 linijki na:
57:
$link_name = $_POST['link_name'];
75:
$link_name = stripinput($data['link_name']);
Zapisujemy i juz.
Po tym zabiegu mozna dodawac dowolne znaczniki do nazw linkow. Wlacznie z obrazkami co moze nam zastapic new nawigation panel (uszanowanie dla autora ale nie wytrzymalem nerwowo przy bledach tego infusiona).
Niestety administration/site_links.php w EP wygląda troszke inaczej niż w zwykłym fusionie.
Bardzo proszę kogoś kto umie zrobić taką modyfikacje dla EP bo od tygodnia nic mi nie wychodzi :D
EP 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")) 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."?action=lupdate&link_id=".$link_id."&group_id=".$group_id;
} else {
$form_action = FUSION_SELF."?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'>
<tr><td><br></td><td><br></td></tr>";
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."?action=gupdate&group_id=".$group_id;
} else {
$group_name = "";
$group_access = "";
$group_image = "";
$group_hide = "";
$form_action = FUSION_SELF."?action=gsave"; }
echo "<form name='groupadd' method='post' action='".$form_action."'>
<table width='50%' cellpadding='3' cellspacing='0' border='0' align='center'>
<tr><td><br></td><td><br></td></tr>
<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."?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."?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."?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."?action=gdel&group_id=".$group['group_id']."'>".$locale['N_014']."</a> | ";
}
echo "<a href='".FUSION_SELF."?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."?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."?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."?action=ledit&link_id=".$link['link_id']."&group_id=".$link['link_group_id']."'>".$locale['N_013']."</a> / <a href='".FUSION_SELF."?action=ldel&link_id=".$link['link_id']."'>".$locale['N_014']."</a>]</td></tr>\n";
$l_count++;
}
}
echo "<tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>";
$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."?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."?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."?action=ledit&group_id=0&link_id=".$link_top['link_id']."'>".$locale['N_013']."</a> / <a href='".FUSION_SELF."?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'>
<tr><td><br></td></tr>";
$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."?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."?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."?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."?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>
<tr><td><br></td></tr></table>";
closetable();
require_once BASEDIR."footer.php";
?>
i dla norm. fusion site_links.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/sitelinks.php";
if (!checkrights("SL") || !defined("iAUTH") || $aid != iAUTH) fallback("../index.php");
if (isset($link_id) && !isNum($link_id)) fallback(FUSION_SELF.$aidlink);
if (!isset($action)) $action = "";
if (isset($status)) {
if ($status == "del") {
$title = $locale['400'];
$message = "<b>".$locale['401']."</b>";
}
opentable($title);
echo "<div align='center'>".$message."</div>\n";
closetable();
tablebreak();
}
if ($action == "refresh") {
$i = 1;
$result = dbquery("SELECT * FROM ".$db_prefix."site_links ORDER BY link_order");
while ($data = dbarray($result)) {
$result2 = dbquery("UPDATE ".$db_prefix."site_links SET link_order='$i' WHERE link_id='".$data['link_id']."'");
$i++;
}
redirect(FUSION_SELF.$aidlink);
} elseif ($action == "moveup") {
$data = dbarray(dbquery("SELECT * FROM ".$db_prefix."site_links WHERE 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'");
redirect(FUSION_SELF.$aidlink);
} elseif ($action == "movedown") {
$data = dbarray(dbquery("SELECT * FROM ".$db_prefix."site_links WHERE 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'");
redirect(FUSION_SELF.$aidlink);
} elseif ($action == "delete") {
$data = dbarray(dbquery("SELECT * FROM ".$db_prefix."site_links WHERE link_id='$link_id'"));
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_order=link_order-1 WHERE link_order>'".$data['link_order']."'");
$result = dbquery("DELETE FROM ".$db_prefix."site_links WHERE link_id='$link_id'");
redirect(FUSION_SELF.$aidlink."&status=del");
} else {
if (isset($_POST['savelink'])) {
$link_name = stripinput($_POST['link_name']);
$link_url = stripinput($_POST['link_url']);
$link_visibility = isNum($_POST['link_visibility']) ? $_POST['link_visibility'] : "0";
$link_position = isset($_POST['link_position']) ? $_POST['link_position'] : "0";
$link_window = isset($_POST['link_window']) ? $_POST['link_window'] : "0";
if ($action == "edit") {
$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='$link_window' WHERE link_id='$link_id'");
redirect(FUSION_SELF.$aidlink);
} else {
if(!$link_order) $link_order=dbresult(dbquery("SELECT MAX(link_order) FROM ".$db_prefix."site_links"),0)+1;
$result = dbquery("UPDATE ".$db_prefix."site_links SET link_order=link_order+1 WHERE link_order>='$link_order'");
$result = dbquery("INSERT INTO ".$db_prefix."site_links (link_name, link_url, link_visibility, link_position, link_window, link_order) VALUES ('$link_name', '$link_url', '$link_visibility', '$link_position', '$link_window', '$link_order')");
redirect(FUSION_SELF.$aidlink);
}
}
if ($action == "edit") {
$result = dbquery("SELECT * FROM ".$db_prefix."site_links WHERE link_id='$link_id'");
$data = dbarray($result);
$link_name = $data['link_name'];
$link_url = $data['link_url'];
$link_visibility = $data['link_visibility'];
$link_order = $data['link_order'];
$pos1_check = ($data['link_position']=="1" ? " checked" : "");
$pos2_check = ($data['link_position']=="2" ? " checked" : "");
$pos3_check = ($data['link_position']=="3" ? " checked" : "");
$window_check = ($data['link_window']=="1" ? " checked" : "");
$formaction = FUSION_SELF.$aidlink."&action=edit&link_id=".$data['link_id'];
opentable($locale['410']);
} else {
$link_name = "";
$link_url = "";
$link_visibility = "";
$link_order = "";
$pos1_check = " checked";
$pos2_check = "";
$pos3_check = "";
$window_check = "";
$formaction = FUSION_SELF.$aidlink;
opentable($locale['411']);
}
$visibility_opts = ""; $sel = "";
$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 "<form name='layoutform' method='post' action='$formaction'>
<table align='center' cellpadding='0' cellspacing='0'>
<tr>
<td class='tbl'>".$locale['420']."</td>
<td class='tbl'><input type='text' name='link_name' value='$link_name' maxlength='100' class='textbox' style='width:240px;'></td>
</tr>
<tr>
<td class='tbl'>".$locale['421']."</td>
<td class='tbl'><input type='text' name='link_url' value='$link_url' maxlength='200' class='textbox' style='width:240px;'></td>
</tr>
<tr>
<td class='tbl'>".$locale['422']."</td>
<td class='tbl'><select name='link_visibility' class='textbox'>
$visibility_opts</select>\n";
if ($action != "edit") {
echo $locale['423']."
<input type='text' name='link_order' value='$link_order' maxlength='2' class='textbox' style='width:40px;'>";
}
echo "</td>
</tr>
<tr>
<td valign='top' class='tbl'>".$locale['424']."</td>
<td class='tbl'><input type='radio' name='link_position' value='1'$pos1_check> ".$locale['425']."<br>
<input type='radio' name='link_position' value='2'$pos2_check> ".$locale['426']."<br>
<input type='radio' name='link_position' value='3'$pos3_check> ".$locale['427']."<hr>
<input type='checkbox' name='link_window' value='1'$window_check> ".$locale['428']."</td>
</tr>
<tr>
<td align='center' colspan='2' class='tbl'>
<input type='submit' name='savelink' value='".$locale['429']."' class='button'></td>
</tr>
</table>
</form>\n";
closetable();
tablebreak();
opentable($locale['412']);
echo "<table align='center' cellpadding='0' cellspacing='1' width='450' class='tbl-border'>
<tr>
<td class='tbl2'><b>".$locale['430']."</b></td>
<td align='center' width='1%' class='tbl2' style='white-space:nowrap'><b>".$locale['431']."</b></td>
<td align='center' colspan='2' width='1%' class='tbl2' style='white-space:nowrap'><b>".$locale['432']."</b></td>
<td align='center' width='1%' class='tbl2' style='white-space:nowrap'><b>".$locale['433']."</b></td>
</tr>\n";
$result = dbquery("SELECT * FROM ".$db_prefix."site_links ORDER BY link_order");
if (dbrows($result) != 0) {
$i = 0; $k = 1;
while($data = dbarray($result)) {
echo "<tr>\n<td class='tbl1'>";
if ($data['link_position'] == 3) echo "<i>";
if ($data['link_name'] != "---" && $data['link_url'] == "---") {
echo "<b>".$data['link_name']."</b>\n";
} else if ($data['link_name'] == "---" && $data['link_url'] == "---") {
echo "<hr>\n";
} else {
if (strstr($data['link_url'], "http://") || strstr($data['link_url'], "https://")) {
echo "<img src='".THEME."images/bullet.gif' alt=''> <a href='".$data['link_url']."'>".$data['link_name']."</a>\n";
} else {
echo "<img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR.$data['link_url']."'>".$data['link_name']."</a>\n";
}
}
if ($data['link_position'] == 3) echo "</i>";
echo "</td>
<td align='center' width='1%' class='tbl1' style='white-space:nowrap'>".getgroupname($data['link_visibility'])."</td>
<td align='center' width='1%' class='tbl2' style='white-space:nowrap'>".$data['link_order']."</td>
<td align='center' width='1%' class='tbl1' style='white-space:nowrap'>\n";
if (dbrows($result) != 1) {
$up = $data['link_order'] - 1;
$down = $data['link_order'] + 1;
if ($k == 1) {
echo "<a href='".FUSION_SELF.$aidlink."&action=movedown&order=$down&link_id=".$data['link_id']."'><img src='".THEME."images/down.gif' alt='".$locale['441']."' title='".$locale['443']."' style='border:0px;'></a>\n";
} elseif ($k < dbrows($result)) {
echo "<a href='".FUSION_SELF.$aidlink."&action=moveup&order=$up&link_id=".$data['link_id']."'><img src='".THEME."images/up.gif' alt='".$locale['440']."' title='".$locale['442']."' style='border:0px;'></a>\n";
echo "<a href='".FUSION_SELF.$aidlink."&action=movedown&order=$down&link_id=".$data['link_id']."'><img src='".THEME."images/down.gif' alt='".$locale['441']."' title='".$locale['443']."' style='border:0px;'></a>\n";
} else {
echo "<a href='".FUSION_SELF.$aidlink."&action=moveup&order=$up&link_id=".$data['link_id']."'><img src='".THEME."images/up.gif' alt='".$locale['440']."' title='".$locale['442']."' style='border:0px;'></a>\n";
}
}
$k++;
echo "</td>
<td align='center' width='1%' class='tbl1' style='white-space:nowrap'><a href='".FUSION_SELF.$aidlink."&action=edit&link_id=".$data['link_id']."'>".$locale['434']."</a> -
<a href='".FUSION_SELF.$aidlink."&action=delete&link_id=".$data['link_id']."'>".$locale['435']."</a></td>
</tr>\n";
}
} else {
echo "<tr>\n<td align='center' colspan='4' class='tbl1'>".$locale['436']."</td>\n</tr>\n";
}
if (dbrows($result)) echo "<tr>\n<td align='center' colspan='5' class='tbl1'>[ <a href='".FUSION_SELF.$aidlink."&action=refresh'>".$locale['444']."</a> ]</td>\n</tr>\n";
echo "</table>\n";
closetable();
}
echo "</td>\n";
require_once BASEDIR."footer.php";
?>
|
Bywalec
Postów: 880 Pomógł: 23 Ostrzeżeń: 2
Data rejestracji: 14.12.2005 19:38
|
<?
/*--------------------------------------------------------------------------+
| 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")) 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."?action=lupdate&link_id=".$link_id."&group_id=".$group_id;
} else {
$form_action = FUSION_SELF."?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'>
<tr><td><br></td><td><br></td></tr>";
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 = stripinput($data['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."?action=gupdate&group_id=".$group_id;
} else {
$group_name = "";
$group_access = "";
$group_image = "";
$group_hide = "";
$form_action = FUSION_SELF."?action=gsave"; }
echo "<form name='groupadd' method='post' action='".$form_action."'>
<table width='50%' cellpadding='3' cellspacing='0' border='0' align='center'>
<tr><td><br></td><td><br></td></tr>
<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."?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."?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."?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."?action=gdel&group_id=".$group['group_id']."'>".$locale['N_014']."</a> | ";
}
echo "<a href='".FUSION_SELF."?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."?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."?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."?action=ledit&link_id=".$link['link_id']."&group_id=".$link['link_group_id']."'>".$locale['N_013']."</a> / <a href='".FUSION_SELF."?action=ldel&link_id=".$link['link_id']."'>".$locale['N_014']."</a>]</td></tr>\n";
$l_count++;
}
}
echo "<tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>";
$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."?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."?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."?action=ledit&group_id=0&link_id=".$link_top['link_id']."'>".$locale['N_013']."</a> / <a href='".FUSION_SELF."?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'>
<tr><td><br></td></tr>";
$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."?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."?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."?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."?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>
<tr><td><br></td></tr></table>";
closetable();
require_once BASEDIR."footer.php";
?>
sprawdz ;) |
Bywalec
Postów: 880 Pomógł: 23 Ostrzeżeń: 2
Data rejestracji: 14.12.2005 19:38
|
<?
/*--------------------------------------------------------------------------+
| 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")) 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."?action=lupdate&link_id=".$link_id."&group_id=".$group_id;
} else {
$form_action = FUSION_SELF."?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'>
<tr><td><br></td><td><br></td></tr>";
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 = stripinput($data['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 = stripinput($data['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."?action=gupdate&group_id=".$group_id;
} else {
$group_name = "";
$group_access = "";
$group_image = "";
$group_hide = "";
$form_action = FUSION_SELF."?action=gsave"; }
echo "<form name='groupadd' method='post' action='".$form_action."'>
<table width='50%' cellpadding='3' cellspacing='0' border='0' align='center'>
<tr><td><br></td><td><br></td></tr>
<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."?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."?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."?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."?action=gdel&group_id=".$group['group_id']."'>".$locale['N_014']."</a> | ";
}
echo "<a href='".FUSION_SELF."?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."?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."?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."?action=ledit&link_id=".$link['link_id']."&group_id=".$link['link_group_id']."'>".$locale['N_013']."</a> / <a href='".FUSION_SELF."?action=ldel&link_id=".$link['link_id']."'>".$locale['N_014']."</a>]</td></tr>\n";
$l_count++;
}
}
echo "<tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>";
$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."?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."?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."?action=ledit&group_id=0&link_id=".$link_top['link_id']."'>".$locale['N_013']."</a> / <a href='".FUSION_SELF."?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'>
<tr><td><br></td></tr>";
$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."?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."?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."?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."?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>
<tr><td><br></td></tr></table>";
closetable();
require_once BASEDIR."footer.php";
?>
sprawdź teraz ;) |