693 lines
17 KiB
PHP
693 lines
17 KiB
PHP
<?php
|
|
|
|
/*
|
|
+--------------------------------------------------------------------------
|
|
| Invision Power Board 2.1.7
|
|
| =============================================
|
|
| by Matthew Mecham
|
|
| (c) 2001 - 2005 Invision Power Services, Inc.
|
|
| http://www.invisionpower.com
|
|
| =============================================
|
|
| Web: http://www.invisionboard.com
|
|
| http://www.ibresource.ru/products/invisionpowerboard/
|
|
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
|
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
|
| Licence Info: http://www.invisionboard.com/?license
|
|
| http://www.ibresource.ru/license
|
|
+---------------------------------------------------------------------------
|
|
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
|
+---------------------------------------------------------------------------
|
|
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
|
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
|
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
|
+---------------------------------------------------------------------------
|
|
| > $Date: 2006-02-03 16:54:26 +0000 (Fri, 03 Feb 2006) $
|
|
| > $Revision: 137 $
|
|
| > $Author: bfarber $
|
|
+---------------------------------------------------------------------------
|
|
|
|
|
| > Admin HTML stuff library
|
|
| > Script written by Matt Mecham
|
|
| > Date started: 1st march 2002
|
|
|
|
|
| > DBA Checked: Tue 25th May 2004
|
|
+--------------------------------------------------------------------------
|
|
*/
|
|
|
|
|
|
class admin_skin
|
|
{
|
|
# Global
|
|
var $ipsclass;
|
|
|
|
var $base_url;
|
|
var $img_url;
|
|
var $has_title;
|
|
var $td_widths = array();
|
|
var $td_header = array();
|
|
var $td_colspan;
|
|
var $valid_hostnames = array();
|
|
|
|
function init_admin_skin()
|
|
{
|
|
$this->base_url = $this->ipsclass->base_url;
|
|
$this->img_url = $this->ipsclass->skin_url;
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Print the global ACP header
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function print_top($title="",$desc="")
|
|
{
|
|
return $this->ipsclass->skin_global_acp->global_header( $title, $desc );
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Print the nav wrapper
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function wrap_nav($links)
|
|
{
|
|
return $this->ipsclass->skin_global_acp->global_wrap_nav( $links );
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Print the global ACP footer
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function print_foot()
|
|
{
|
|
return $this->ipsclass->skin_global_acp->global_footer( date("Y") );
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Print the global ACP menu header
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function menu_top()
|
|
{
|
|
return $this->ipsclass->skin_global_acp->global_menu_header();
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Print the global ACP menu footer
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function menu_foot()
|
|
{
|
|
return $this->ipsclass->skin_global_acp->global_menu_footer();
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Print the global ACP frameset
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function frame_set()
|
|
{
|
|
//-----------------------------------------
|
|
// Carry on
|
|
//-----------------------------------------
|
|
|
|
$extra_query = 'act=index';
|
|
|
|
if ( $this->ipsclass->input['act'] != 'idx' )
|
|
{
|
|
$extra_query = str_replace( '&', '&', $this->ipsclass->parse_clean_value($_SERVER['QUERY_STRING']) );
|
|
$extra_query = str_replace( "{$this->ipsclass->vars['board_url']}" , "" , $extra_query );
|
|
$extra_query = preg_replace( "!/?admin\.{$this->ipsclass->vars['php_ext']}!i", "" , $extra_query );
|
|
$extra_query = preg_replace( "!^\?!" , "" , $extra_query );
|
|
$extra_query = str_replace( "printframes=1" , "" , $extra_query );
|
|
$extra_query = preg_replace( "!adsess=(\w){32}!" , "" , $extra_query );
|
|
$extra_query = preg_replace( "!s=(\w){32}!" , "" , $extra_query );
|
|
}
|
|
|
|
return $this->ipsclass->skin_global_acp->global_frame_set( $extra_query );
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Print the global menu cat wrap
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function menu_cat_wrap($show, $name="", $links="", $id = "", $desc, $color='#FFF', $extra='')
|
|
{
|
|
return $this->ipsclass->skin_global_acp->global_menu_cat_wrap($show, $name, $links, $id, $desc, $color, $extra);
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Print the global menu cat link
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function menu_cat_link($pid, $cid, $url="", $name="", $urltype=0, $isredirect=0, $no_access=0)
|
|
{
|
|
if ( $urltype == 1 )
|
|
{
|
|
$theurl = $this->ipsclass->vars['board_url'].'/index.'.$this->ipsclass->vars['php_ext'].'?';
|
|
}
|
|
else
|
|
{
|
|
$theurl = $this->ipsclass->base_url;
|
|
}
|
|
|
|
if ( $isredirect )
|
|
{
|
|
$icon = "<img src='{$this->ipsclass->skin_url}/images/menu_shortcut.gif' border='0' alt='' valign='absmiddle' />";
|
|
$extra_css = ';font-style:italic';
|
|
}
|
|
else
|
|
{
|
|
$icon = "<img src='{$this->ipsclass->skin_url}/images/item.gif' border='0' alt='' valign='absmiddle' />";
|
|
$extra_css = "";
|
|
}
|
|
|
|
if ( $no_access )
|
|
{
|
|
$extra_css .= ";color:#777";
|
|
}
|
|
|
|
return $this->ipsclass->skin_global_acp->global_menu_cat_link( $cid, $pid, $icon, $extra_css, $name, $url, $theurl );
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// JS Make button
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function js_make_button($text="", $url="", $css='realbutton', $title="")
|
|
{
|
|
return "<input type='button' class='{$css}' value='{$text}' onclick='self.location.href=\"{$url}\"' title='$title' />";
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// JS Help Link
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function js_help_link($help="", $text="Áûñòðàÿ ïîìîùü")
|
|
{
|
|
return "( <a href='#' onClick=\"window.open('{$this->ipsclass->base_url}&act=quickhelp&id=$help','Ïîìîùü','width=250,height=400,resizable=yes,scrollbars=yes'); return false;\">$text</a> )";
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// JS Template tools
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function js_template_tools()
|
|
{
|
|
return "
|
|
<script language='javascript'>
|
|
<!--
|
|
var template_bit_ids = '<!--IPB.TEMPLATE_BIT_IDS-->';
|
|
//-->
|
|
</script>
|
|
";
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// JS Make page jump
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function make_page_jump($tp="", $pp="", $ub="" )
|
|
{
|
|
return "<a href='#' title=\"Ïåðåéòè ê ñòðàíèöå...\" onclick=\"multi_page_jump('$ub',$tp,$pp);\">Pages:</a>";
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Form: Start Form
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function start_form($hiddens="", $name='theAdminForm', $js="", $id="")
|
|
{
|
|
if ( ! $id )
|
|
{
|
|
$id = $name;
|
|
}
|
|
|
|
$form = "<form action='{$this->ipsclass->base_url}' method='post' name='$name' $js id='$id'>";
|
|
|
|
if (is_array($hiddens))
|
|
{
|
|
foreach ($hiddens as $k => $v)
|
|
{
|
|
$form .= "\n<input type='hidden' name='{$v[0]}' value='{$v[1]}'>";
|
|
}
|
|
}
|
|
|
|
return $form;
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Form: Hidden
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function form_hidden($hiddens="")
|
|
{
|
|
if (is_array($hiddens))
|
|
{
|
|
foreach ($hiddens as $k => $v)
|
|
{
|
|
$form .= "\n<input type='hidden' name='{$v[0]}' value='{$v[1]}'>";
|
|
}
|
|
}
|
|
|
|
return $form;
|
|
}
|
|
|
|
|
|
//-----------------------------------------
|
|
|
|
function end_form($text = "", $js = "", $extra = "")
|
|
{
|
|
$html = "";
|
|
$colspan = "";
|
|
|
|
if ($text != "")
|
|
{
|
|
if ($this->td_colspan > 0)
|
|
{
|
|
$colspan = " colspan='".$this->td_colspan."' ";
|
|
}
|
|
|
|
$html .= "<tr><td align='center' class='pformstrip'".$colspan."><input type='submit' value='$text'".$js." id='button' accesskey='s'>{$extra}</td></tr>\n";
|
|
}
|
|
|
|
$html .= "</form>";
|
|
|
|
return $html;
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
function end_form_standalone($text = "", $js = "")
|
|
{
|
|
$html = "";
|
|
$colspan = "";
|
|
|
|
if ($text != "")
|
|
{
|
|
$html .= "<div class='tableborder'><div align='center' class='pformstrip'><input type='submit' value='$text'".$js." id='button' accesskey='s'></div></div>\n";
|
|
}
|
|
|
|
$html .= "</form>";
|
|
|
|
return $html;
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
function form_upload($name="FILE_UPLOAD", $js="")
|
|
{
|
|
if ($js != "")
|
|
{
|
|
$js = ' '.$js.' ';
|
|
}
|
|
|
|
return "<input class='textinput' type='file' $js size='30' name='$name'>";
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
function form_input($name, $value="", $type='text', $js="", $size="30")
|
|
{
|
|
if ($js != "")
|
|
{
|
|
$js = ' '.$js.' ';
|
|
}
|
|
|
|
return "<input type='$type' name='$name' value=\"$value\" size='$size'".$js." class='textinput'>";
|
|
}
|
|
|
|
function form_simple_input($name, $value="", $size='5')
|
|
{
|
|
return "<input type='text' name='$name' value='$value' size='$size' class='textinput'>";
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
function form_textarea($name, $value="", $cols='60', $rows='5', $wrap='soft', $id="", $style="", $js="") {
|
|
|
|
if ( $id )
|
|
{
|
|
$id = "id='$id'";
|
|
}
|
|
else
|
|
{
|
|
$id = "id='{$name}'";
|
|
}
|
|
|
|
if ( $style )
|
|
{
|
|
$style = "style='$style'";
|
|
}
|
|
|
|
return "<textarea name='$name' cols='$cols' rows='$rows' wrap='$wrap' $id $style $js class='multitext'>$value</textarea>";
|
|
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
function form_dropdown($name, $list=array(), $default_val="", $js="", $css="") {
|
|
|
|
if ($js != "")
|
|
{
|
|
$js = ' '.$js.' ';
|
|
}
|
|
|
|
if ($css != "")
|
|
{
|
|
$css = ' class="'.$css.'" ';
|
|
}
|
|
|
|
$html = "<select name='$name'".$js." $css class='dropdown'>\n";
|
|
|
|
foreach ($list as $k => $v)
|
|
{
|
|
$selected = "";
|
|
|
|
if ( ($default_val != "") and ($v[0] == $default_val) )
|
|
{
|
|
$selected = ' selected';
|
|
}
|
|
|
|
$html .= "<option value='".$v[0]."'".$selected.">".$v[1]."</option>\n";
|
|
}
|
|
|
|
$html .= "</select>\n\n";
|
|
|
|
return $html;
|
|
|
|
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
function form_multiselect($name, $list=array(), $default=array(), $size=5, $js="") {
|
|
|
|
if ($js != "")
|
|
{
|
|
$js = ' '.$js.' ';
|
|
}
|
|
|
|
//$html = "<select name='$name".'[]'."'".$js." id='dropdown' multiple='multiple' size='$size'>\n";
|
|
$html = "<select name='$name"."'".$js." class='dropdown' multiple='multiple' size='$size'>\n";
|
|
foreach ($list as $k => $v)
|
|
{
|
|
|
|
$selected = "";
|
|
|
|
if ( count($default) > 0 )
|
|
{
|
|
if ( in_array( $v[0], $default ) )
|
|
{
|
|
$selected = ' selected="selected"';
|
|
}
|
|
}
|
|
|
|
$html .= "<option value='".$v[0]."'".$selected.">".$v[1]."</option>\n";
|
|
}
|
|
|
|
$html .= "</select>\n\n";
|
|
|
|
return $html;
|
|
|
|
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
function form_yes_no( $name, $default_val="", $js=array() ) {
|
|
|
|
$y_js = "";
|
|
$n_js = "";
|
|
|
|
if ( $js['yes'] != "" )
|
|
{
|
|
$y_js = $js['yes'];
|
|
}
|
|
|
|
if ( $js['no'] != "" )
|
|
{
|
|
$n_js = $js['no'];
|
|
}
|
|
|
|
$yes = "Äà <input type='radio' name='$name' value='1' $y_js id='green'>";
|
|
$no = "<input type='radio' name='$name' value='0' $n_js id='red'> Íåò";
|
|
|
|
|
|
|
|
if ($default_val == 1)
|
|
{
|
|
|
|
$yes = "Äà <input type='radio' name='$name' value='1'$y_js checked id='green'>";
|
|
}
|
|
else
|
|
{
|
|
$no = "<input type='radio' name='$name' value='0' checked $n_js id='red'> Íåò";
|
|
}
|
|
|
|
|
|
return $yes.' '.$no;
|
|
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
function form_checkbox( $name, $checked=0, $val=1, $js=array() ) {
|
|
|
|
$form_js = "";
|
|
|
|
if( count( $js ) )
|
|
{
|
|
foreach( $js as $javascript )
|
|
{
|
|
$form_js .= $javascript." ";
|
|
}
|
|
}
|
|
if ($checked == 1)
|
|
{
|
|
|
|
return "<input type='checkbox' name='$name' value='$val' $form_js checked='checked'>";
|
|
}
|
|
else
|
|
{
|
|
return "<input type='checkbox' name='$name' value='$val' $form_js>";
|
|
}
|
|
}
|
|
|
|
//-----------------------------------------
|
|
//--------------------------------------------------------------------
|
|
// SCREEN ELEMENTS
|
|
//-----------------------------------------
|
|
//--------------------------------------------------------------------
|
|
|
|
function add_subtitle($title="",$id="subtitle", $colspan="") {
|
|
|
|
if ($colspan != "")
|
|
{
|
|
$colspan = " colspan='$colspan' ";
|
|
}
|
|
|
|
return "\n<tr><td id='$id'".$colspan.">$title</td><tr>\n";
|
|
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
function start_table( $title="", $desc="") {
|
|
|
|
if ($title != "")
|
|
{
|
|
$this->has_title = 1;
|
|
$html .= "<div class='tableborder'>
|
|
<div class='maintitle'>$title</div>\n";
|
|
|
|
if ( $desc != "" )
|
|
{
|
|
$html .= "<div class='pformstrip'>$desc</div>\n";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$html .= "\n<table width='100%' cellspacing='0' cellpadding='5' align='center' border='0'>";
|
|
|
|
|
|
if (isset($this->td_header[0]))
|
|
{
|
|
$html .= "<tr>\n";
|
|
|
|
// Auto remove two only headers..
|
|
|
|
if ( $this->td_header[0][0] == ' ' && $this->td_header[1][0] == ' ' && ( ! isset( $this->td_header[2][0] ) ) )
|
|
{
|
|
$this->td_header[0][0] = '{none}';
|
|
$this->td_header[1][0] = '{none}';
|
|
}
|
|
|
|
foreach ($this->td_header as $td)
|
|
{
|
|
if ($td[1] != "")
|
|
{
|
|
$width = " width='{$td[1]}' ";
|
|
}
|
|
else
|
|
{
|
|
$width = "";
|
|
}
|
|
|
|
if ($td[0] != '{none}')
|
|
{
|
|
$html .= "<td class='titlemedium'".$width."align='center'>{$td[0]}</td>\n";
|
|
}
|
|
|
|
$this->td_colspan++;
|
|
}
|
|
|
|
$html.= "</tr>\n";
|
|
}
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
function add_standalone_row($text = "", $align='center', $class='pformstrip')
|
|
{
|
|
return "<div class='tableborder'><div align='{$align}' class='{$class}'>{$text}</div></div>\n";
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
|
|
function add_td_row( $array, $css="", $align='middle' ) {
|
|
|
|
if (is_array($array))
|
|
{
|
|
$html = "<tr>\n";
|
|
|
|
$count = count($array);
|
|
|
|
$this->td_colspan = $count;
|
|
|
|
for ($i = 0; $i < $count ; $i++ )
|
|
{
|
|
$td_col = $i % 2 ? 'tdrow2' : 'tdrow1';
|
|
|
|
if ($css != "")
|
|
{
|
|
$td_col = $css;
|
|
}
|
|
|
|
if (is_array($array[$i]))
|
|
{
|
|
$text = $array[$i][0];
|
|
$colspan = $array[$i][1];
|
|
$td_col = $array[$i][2] != "" ? $array[$i][2] : $td_col;
|
|
|
|
$html .= "<td class='$td_col' colspan='$colspan' valign='$align'>".$text."</td>\n";
|
|
}
|
|
else
|
|
{
|
|
if ($this->td_header[$i][1] != "")
|
|
{
|
|
$width = " width='{$this->td_header[$i][1]}' ";
|
|
}
|
|
else
|
|
{
|
|
$width = "";
|
|
}
|
|
|
|
$html .= "<td class='$td_col' $width valign='$align'>".$array[$i]."</td>\n";
|
|
}
|
|
}
|
|
|
|
$html .= "</tr>\n";
|
|
|
|
return $html;
|
|
}
|
|
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
function add_td_basic($text="",$align="left",$id="tdrow1", $colspanint=0) {
|
|
|
|
$html = "";
|
|
$colspan = "";
|
|
|
|
if ( $colspanint )
|
|
{
|
|
$this->td_colspan = $colspanint;
|
|
}
|
|
|
|
if ($text != "")
|
|
{
|
|
if ($this->td_colspan > 0)
|
|
{
|
|
$colspan = " colspan='".$this->td_colspan."' ";
|
|
}
|
|
|
|
|
|
$html .= "<tr><td align='$align' class='$id'".$colspan.">$text</td></tr>\n";
|
|
}
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
//-----------------------------------------
|
|
|
|
function add_td_spacer() {
|
|
|
|
if ($this->td_colspan > 0)
|
|
{
|
|
$colspan = " colspan='".$this->td_colspan."' ";
|
|
}
|
|
|
|
return "<tr><td".$colspan."><br /></td></tr>";
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------
|
|
|
|
function end_table() {
|
|
|
|
$this->td_header = array(); // Reset TD headers
|
|
|
|
if ($this->has_title == 1)
|
|
{
|
|
$this->has_title = 0;
|
|
|
|
return "</table></div><br />\n\n";
|
|
}
|
|
else
|
|
{
|
|
return "</table>\n\n";
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------
|
|
|
|
|
|
function skin_jump_menu_wrap()
|
|
{
|
|
return "<br /><div align='center' style='width:250px;margin-left:auto;margin-right:auto;'>
|
|
<div style='padding:3px 0px 3px 0px;border:1px solid #AAA;'>
|
|
<div class='tablepad' align='center'>".$this->ipsclass->admin->skin_jump_menu()."</div></div></div>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|