Ирина Спирина
Участник
- Сообщения
- 37
- Реакции
- 2
R1KO, вот
function AddTab($title, $url, $desc, $active=false)
{
global $tabs;
$tab_arr = array( );
$tab_arr[0] = "Главная";
$tab_arr[1] = "Банлист";
$tab_arr[2] = "Серверы";
$tab_arr[3] = "Предложить бан";
$tab_arr[4] = "Протест бана";
$tab_arr[5] = "Админлист";
$tabs = array();
$tabs['title'] = $title;
$tabs['url'] = $url;
$tabs['desc'] = $desc;
if($_GET['p'] == "default" && $title == $tab_arr[intval($GLOBALS['config']['config.defaultpage'])])
{
$tabs['active'] = true;
$GLOBALS['pagetitle'] = $title;
}
else
{
if($_GET['p'] != "default" && substr($url, 12) == $_GET['p'])
{
$tabs['active'] = true;
$GLOBALS['pagetitle'] = $title;
}
else
$tabs['active'] = false;
}
if ($tabs['active'] == true) {
echo '
<li class="active">';
}
else {
echo '
<li class="nonactive">';
}
echo CreateLinkR($tabs['title'], $tabs['url'], $tabs['desc']).'
</li>';
}
/**
* Displays the pagetabs
*
* @return noreturn
*/
function BuildPageTabs()
{
global $userbank;
$links = $GLOBALS['db']->Execute("SELECT * FROM `".DB_PREFIX."_links` ORDER BY `id` ASC");
foreach($links as $link) {
if( ($link['active'] != 1)
||
($link['link'] == 'index.php?p=submit' && $GLOBALS['config']['config.enablesubmit'] != 1)
||
($link['link'] == 'index.php?p=protest' && $GLOBALS['config']['config.enableprotest'] != 1)
||
($link['link'] == 'index.php?p=admin' && !$userbank->is_admin())) {
continue;
}
AddTab($link['anchor'], $link['link'], $link['title']);
}
include INCLUDES_PATH . '/CTabsMenu.php';
// BUILD THE SUB-MENU's FOR ADMIN PAGES
$submenu = new CTabsMenu();
if( $userbank->HasAccess(ADMIN_OWNER|ADMIN_LIST_ADMINS|ADMIN_ADD_ADMINS|ADMIN_EDIT_ADMINS|ADMIN_DELETE_ADMINS ) )
$submenu->addMenuItem('Админы', 0,'', 'index.php?p=admin&c=admins', true);
if($userbank->HasAccess(ADMIN_OWNER|ADMIN_LIST_SERVERS|ADMIN_ADD_SERVER|ADMIN_EDIT_SERVERS|ADMIN_DELETE_SERVERS))
$submenu->addMenuItem('Серверы', 0,'', 'index.php?p=admin&c=servers', true);
if($userbank->HasAccess( ADMIN_OWNER|ADMIN_ADD_BAN|ADMIN_EDIT_OWN_BANS|ADMIN_EDIT_GROUP_BANS|ADMIN_EDIT_ALL_BANS|ADMIN_BAN_PROTESTS|ADMIN_BAN_SUBMISSIONS))
$submenu->addMenuItem('Баны', 0,'', 'index.php?p=admin&c=bans', true);
if($userbank->HasAccess(ADMIN_OWNER|ADMIN_LIST_GROUPS|ADMIN_ADD_GROUP|ADMIN_EDIT_GROUPS|ADMIN_DELETE_GROUPS))
$submenu->addMenuItem('Группы', 0,'', 'index.php?p=admin&c=groups', true);
if($userbank->HasAccess( ADMIN_OWNER|ADMIN_LIST_MODS|ADMIN_ADD_MODS|ADMIN_EDIT_MODS|ADMIN_DELETE_MODS))
$submenu->addMenuItem('МОДы', 0,'', '?p=admin&c=mods', true);
if($userbank->HasAccess(ADMIN_OWNER|ADMIN_WEB_SETTINGS)) {
$submenu->addMenuItem('Настройки', 0,'', 'index.php?p=admin&c=settings', true);
$submenu->addMenuItem('Ссылки', 0,'', '?p=admin&c=links', true);
}
SubMenu( $submenu->getMenuArray() );
}
/**
* Rewrites the breadcrumb html
*
* @return noreturn
*/
function BuildBreadcrumbs()
{
$base = isset($GLOBALS['pagetitle']) ? $GLOBALS['pagetitle'] : '';
if(isset($_GET['c']))
{
switch($_GET['c'])
{
case 'admins':
$cat = 'Управление админами';
break;
case 'servers':
$cat = 'Управление серверами';
break;
case 'bans':
$cat = 'Управление админами';
break;
case 'groups':
$cat = 'Управление группами';
break;
case 'settings':
$cat = 'Настройки SourceBans';
break;
case 'mods':
$cat = 'Управление МОДами';
break;
case 'pay_settings':
$cat = 'Настройки платных услуг';
break;
case 'zayavki':
$cat = 'Заявки';
break;
}
}
if(!isset($_GET['c']))
{
if(!empty($base))
$bread = '<b>' . $base . '</b>';
else
unset ($bread);
}
else
{
if(!empty($cat))
$bread = '<a href="index.php?p='. $_GET['p'] . '">' . $base . '</a> » <b>' . $cat . '</b>';
else
$bread = '<a href="index.php?p='. $_GET['p'] . '">' . $base . '</a>';
}
if(!empty($bread))
$text = '» <a href="index.php?p=home">Главная</a> » ' . $bread;
else
$text = '» <a href="index.php?p=home">Главная</a>';
echo '<script type="text/javascript">$(\'breadcrumb\').setHTML(\'' . $text . '\');</script>';
}
/**
* Creates an anchor tag, and adds tooltip code if needed
*
* @param string $title The title of the tooltip/text to link
* @param string $url The link
* @param string $tooltip The tooltip message
* @param string $target The new links target
* @return noreturn
*/
function CreateLink($title, $url, $tooltip='', $target='_self', $wide=false)
{
if($wide)
$class = 'perm';
else
$class = 'tip';
if(strlen($tooltip) == 0)
{
echo '<a href="' . $url . '" target="' . $target . '">' . $title .' </a>';
}else{
echo '<a href="' . $url . '" class="' . $class .'" title="' . $title . ' :: ' . $tooltip . '" target="' . $target . '">' . $title .' </a>';
}
}
/**
* Creates an anchor tag, and adds tooltip code if needed
*
* @param string $title The title of the tooltip/text to link
* @param string $url The link
* @param string $tooltip The tooltip message
* @param string $target The new links target
* @return URL
*/
function CreateLinkR($title, $url, $tooltip='', $target='_self', $wide=false, $onclick='')
{
if($wide)
$class = 'perm';
else
$class = 'tip';
if(strlen($tooltip) == 0)
{
return '<a href="' . $url . '" onclick="' . $onclick . '" target="' . $target . '">' . $title .' </a>';
}else{
return '<a href="' . $url . '" class="' . $class .'" title="' . $title . ' :: ' . $tooltip . '" target="' . $target . '">' . $title .' </a>';
}
}
function HelpIcon($title, $text)
{
return '<img border="0" align="absbottom" src="themes/' . SB_THEME .'/images/admin/help.png" class="tip" title="' . $title . ' :: ' . $text . '"> ';
}
/**
* Allows the title of the page to change wherever the code is being executed from
*
* @param string $title The new title
* @return noreturn
*/
function RewritePageTitle($title)
{
$GLOBALS['TitleRewrite'] = $title;
}
/**
* Build sub-menu
*
* @param array $el The array of elements for the menu
* @return noreturn
*/
{
global $tabs;
$tab_arr = array( );
$tab_arr[0] = "Главная";
$tab_arr[1] = "Банлист";
$tab_arr[2] = "Серверы";
$tab_arr[3] = "Предложить бан";
$tab_arr[4] = "Протест бана";
$tab_arr[5] = "Админлист";
$tabs = array();
$tabs['title'] = $title;
$tabs['url'] = $url;
$tabs['desc'] = $desc;
if($_GET['p'] == "default" && $title == $tab_arr[intval($GLOBALS['config']['config.defaultpage'])])
{
$tabs['active'] = true;
$GLOBALS['pagetitle'] = $title;
}
else
{
if($_GET['p'] != "default" && substr($url, 12) == $_GET['p'])
{
$tabs['active'] = true;
$GLOBALS['pagetitle'] = $title;
}
else
$tabs['active'] = false;
}
if ($tabs['active'] == true) {
echo '
<li class="active">';
}
else {
echo '
<li class="nonactive">';
}
echo CreateLinkR($tabs['title'], $tabs['url'], $tabs['desc']).'
</li>';
}
/**
* Displays the pagetabs
*
* @return noreturn
*/
function BuildPageTabs()
{
global $userbank;
$links = $GLOBALS['db']->Execute("SELECT * FROM `".DB_PREFIX."_links` ORDER BY `id` ASC");
foreach($links as $link) {
if( ($link['active'] != 1)
||
($link['link'] == 'index.php?p=submit' && $GLOBALS['config']['config.enablesubmit'] != 1)
||
($link['link'] == 'index.php?p=protest' && $GLOBALS['config']['config.enableprotest'] != 1)
||
($link['link'] == 'index.php?p=admin' && !$userbank->is_admin())) {
continue;
}
AddTab($link['anchor'], $link['link'], $link['title']);
}
include INCLUDES_PATH . '/CTabsMenu.php';
// BUILD THE SUB-MENU's FOR ADMIN PAGES
$submenu = new CTabsMenu();
if( $userbank->HasAccess(ADMIN_OWNER|ADMIN_LIST_ADMINS|ADMIN_ADD_ADMINS|ADMIN_EDIT_ADMINS|ADMIN_DELETE_ADMINS ) )
$submenu->addMenuItem('Админы', 0,'', 'index.php?p=admin&c=admins', true);
if($userbank->HasAccess(ADMIN_OWNER|ADMIN_LIST_SERVERS|ADMIN_ADD_SERVER|ADMIN_EDIT_SERVERS|ADMIN_DELETE_SERVERS))
$submenu->addMenuItem('Серверы', 0,'', 'index.php?p=admin&c=servers', true);
if($userbank->HasAccess( ADMIN_OWNER|ADMIN_ADD_BAN|ADMIN_EDIT_OWN_BANS|ADMIN_EDIT_GROUP_BANS|ADMIN_EDIT_ALL_BANS|ADMIN_BAN_PROTESTS|ADMIN_BAN_SUBMISSIONS))
$submenu->addMenuItem('Баны', 0,'', 'index.php?p=admin&c=bans', true);
if($userbank->HasAccess(ADMIN_OWNER|ADMIN_LIST_GROUPS|ADMIN_ADD_GROUP|ADMIN_EDIT_GROUPS|ADMIN_DELETE_GROUPS))
$submenu->addMenuItem('Группы', 0,'', 'index.php?p=admin&c=groups', true);
if($userbank->HasAccess( ADMIN_OWNER|ADMIN_LIST_MODS|ADMIN_ADD_MODS|ADMIN_EDIT_MODS|ADMIN_DELETE_MODS))
$submenu->addMenuItem('МОДы', 0,'', '?p=admin&c=mods', true);
if($userbank->HasAccess(ADMIN_OWNER|ADMIN_WEB_SETTINGS)) {
$submenu->addMenuItem('Настройки', 0,'', 'index.php?p=admin&c=settings', true);
$submenu->addMenuItem('Ссылки', 0,'', '?p=admin&c=links', true);
}
SubMenu( $submenu->getMenuArray() );
}
/**
* Rewrites the breadcrumb html
*
* @return noreturn
*/
function BuildBreadcrumbs()
{
$base = isset($GLOBALS['pagetitle']) ? $GLOBALS['pagetitle'] : '';
if(isset($_GET['c']))
{
switch($_GET['c'])
{
case 'admins':
$cat = 'Управление админами';
break;
case 'servers':
$cat = 'Управление серверами';
break;
case 'bans':
$cat = 'Управление админами';
break;
case 'groups':
$cat = 'Управление группами';
break;
case 'settings':
$cat = 'Настройки SourceBans';
break;
case 'mods':
$cat = 'Управление МОДами';
break;
case 'pay_settings':
$cat = 'Настройки платных услуг';
break;
case 'zayavki':
$cat = 'Заявки';
break;
}
}
if(!isset($_GET['c']))
{
if(!empty($base))
$bread = '<b>' . $base . '</b>';
else
unset ($bread);
}
else
{
if(!empty($cat))
$bread = '<a href="index.php?p='. $_GET['p'] . '">' . $base . '</a> » <b>' . $cat . '</b>';
else
$bread = '<a href="index.php?p='. $_GET['p'] . '">' . $base . '</a>';
}
if(!empty($bread))
$text = '» <a href="index.php?p=home">Главная</a> » ' . $bread;
else
$text = '» <a href="index.php?p=home">Главная</a>';
echo '<script type="text/javascript">$(\'breadcrumb\').setHTML(\'' . $text . '\');</script>';
}
/**
* Creates an anchor tag, and adds tooltip code if needed
*
* @param string $title The title of the tooltip/text to link
* @param string $url The link
* @param string $tooltip The tooltip message
* @param string $target The new links target
* @return noreturn
*/
function CreateLink($title, $url, $tooltip='', $target='_self', $wide=false)
{
if($wide)
$class = 'perm';
else
$class = 'tip';
if(strlen($tooltip) == 0)
{
echo '<a href="' . $url . '" target="' . $target . '">' . $title .' </a>';
}else{
echo '<a href="' . $url . '" class="' . $class .'" title="' . $title . ' :: ' . $tooltip . '" target="' . $target . '">' . $title .' </a>';
}
}
/**
* Creates an anchor tag, and adds tooltip code if needed
*
* @param string $title The title of the tooltip/text to link
* @param string $url The link
* @param string $tooltip The tooltip message
* @param string $target The new links target
* @return URL
*/
function CreateLinkR($title, $url, $tooltip='', $target='_self', $wide=false, $onclick='')
{
if($wide)
$class = 'perm';
else
$class = 'tip';
if(strlen($tooltip) == 0)
{
return '<a href="' . $url . '" onclick="' . $onclick . '" target="' . $target . '">' . $title .' </a>';
}else{
return '<a href="' . $url . '" class="' . $class .'" title="' . $title . ' :: ' . $tooltip . '" target="' . $target . '">' . $title .' </a>';
}
}
function HelpIcon($title, $text)
{
return '<img border="0" align="absbottom" src="themes/' . SB_THEME .'/images/admin/help.png" class="tip" title="' . $title . ' :: ' . $text . '"> ';
}
/**
* Allows the title of the page to change wherever the code is being executed from
*
* @param string $title The new title
* @return noreturn
*/
function RewritePageTitle($title)
{
$GLOBALS['TitleRewrite'] = $title;
}
/**
* Build sub-menu
*
* @param array $el The array of elements for the menu
* @return noreturn
*/