Admin HTML stuff library
| > Script written by Matt Mecham
| > Date started: 1st march 2002
|
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
class admin_skin {
var $base_url;
var $img_url;
var $has_title;
var $td_widths = array();
var $td_header = array();
var $td_colspan;
function admin_skin()
{
global $ibforums;
$this->base_url = $ibforums->base_url;
$this->img_url = $ibforums->skin_url;
}
//-----------------------------------------
//--------------------------------------------------------------------
// Javascript elements
//-----------------------------------------
//--------------------------------------------------------------------
function js_make_button($text="", $url="", $css='realbutton', $title="")
{
return " ";
}
function js_pop_win()
{
return "
";
}
function js_help_link($help="", $text="Quick Help")
{
return "( base_url}&act=quickhelp&id=$help','Help','width=250,height=400,resizable=yes,scrollbars=yes'); return false;\">$text )";
}
function js_template_tools()
{
global $ibforums;
return "
";
}
function js_checkdelete($txt="Are you sure you wish to remove this?")
{
return "
";
}
function js_no_specialchars()
{
return "
";
}
function make_page_jump($tp="", $pp="", $ub="" )
{
global $IN, $INFO;
return "Pages: ";
}
//-----------------------------------------
//--------------------------------------------------------------------
// FORM ELEMENTS
//-----------------------------------------
//--------------------------------------------------------------------
function start_form($hiddens="", $name='theAdminForm', $js="") {
global $IN, $INFO;
$form = "
";
return $html;
}
//-----------------------------------------
function end_form_standalone($text = "", $js = "")
{
$html = "";
$colspan = "";
if ($text != "")
{
$html .= "\n";
}
$html .= "";
return $html;
}
//-----------------------------------------
function form_upload($name="FILE_UPLOAD", $js="") {
if ($js != "")
{
$js = ' '.$js.' ';
}
return " ";
}
//-----------------------------------------
function form_input($name, $value="", $type='text', $js="", $size="30") {
if ($js != "")
{
$js = ' '.$js.' ';
}
return " ";
}
function form_simple_input($name, $value="", $size='5') {
return " ";
}
//-----------------------------------------
function form_textarea($name, $value="", $cols='60', $rows='5', $wrap='soft', $id="", $style="") {
if ( $id )
{
$id = "id='$id'";
}
if ( $style )
{
$style = "style='$style'";
}
return "";
}
//-----------------------------------------
function form_dropdown($name, $list=array(), $default_val="", $js="", $css="") {
if ($js != "")
{
$js = ' '.$js.' ';
}
if ($css != "")
{
$css = ' class="'.$css.'" ';
}
$html = "\n";
foreach ($list as $k => $v)
{
$selected = "";
if ( ($default_val != "") and ($v[0] == $default_val) )
{
$selected = ' selected';
}
$html .= "".$v[1]." \n";
}
$html .= " \n\n";
return $html;
}
//-----------------------------------------
function form_multiselect($name, $list=array(), $default=array(), $size=5, $js="") {
if ($js != "")
{
$js = ' '.$js.' ';
}
//$html = "\n";
$html = "\n";
foreach ($list as $k => $v)
{
$selected = "";
if ( count($default) > 0 )
{
if ( in_array( $v[0], $default ) )
{
$selected = ' selected="selected"';
}
}
$html .= "".$v[1]." \n";
}
$html .= " \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 = "Yes ";
$no = " No";
if ($default_val == 1)
{
$yes = "Yes ";
}
else
{
$no = " No";
}
return $yes.' '.$no;
}
//-----------------------------------------
function form_checkbox( $name, $checked=0, $val=1, $js=array() ) {
if ($checked == 1)
{
return " ";
}
else
{
return " ";
}
}
//-----------------------------------------
function build_group_perms( $show='*', $read='*', $write='*', $reply='*', $upload='*' )
{
global $DB;
$html = "
";
$html .= $this->add_td_basic( "GLOBAL: All current and future permission masks", "left", "pformstrip" );
//-----------------------------------------
if ($show == '*')
{
$html_show = " \n";
}
else
{
$html_show = " \n";
}
//-----------------------------------------
if ($read == '*')
{
$html_read = " \n";
}
else
{
$html_read = " \n";
}
//-----------------------------------------
if ($reply == '*')
{
$html_reply = " \n";
}
else
{
$html_reply = " \n";
}
//-----------------------------------------
if ($write == '*')
{
$html_start = " \n";
}
else
{
$html_start = " \n";
}
if ($upload == '*')
{
$html_upload = " \n";
}
else
{
$html_upload = " \n";
}
//-----------------------------------------
$html .= $this->add_td_row( array( "All current and future permission masks ",
"$html_show ",
"$html_read ",
"$html_reply ",
"$html_start ",
"$html_upload ",
) );
//-----------------------------------------
$html .= $this->add_td_basic( "OR: Adjust permissions per mask below", "left", "pformstrip" );
$DB->simple_construct( array( 'select' => '*', 'from' => 'forum_perms', 'order' => "perm_name ASC" ) );
$DB->simple_exec();
while ( $data = $DB->fetch_row() )
{
if ($show == '*')
{
$html_show = " ";
}
else if ( preg_match( "/(^|,)".$data['perm_id']."(,|$)/", $show ) )
{
$html_show = " ";
}
else
{
$html_show = " ";
}
//-----------------------------------------
if ($read == '*')
{
$html_read = " ";
}
else if ( preg_match( "/(^|,)".$data['perm_id']."(,|$)/", $read ) )
{
$html_read = " ";
}
else
{
$html_read = " ";
}
//-----------------------------------------
if ($reply == '*')
{
$html_reply = " ";
}
else if ( preg_match( "/(?:^|,)".$data['perm_id']."(?:,|$)/", $reply ) )
{
$html_reply = " ";
}
else
{
$html_reply = " ";
}
//-----------------------------------------
if ($write == '*')
{
$html_start = " ";
}
else if ( preg_match( "/(?:^|,)".$data['perm_id']."(?:,|$)/", $write ) )
{
$html_start = " ";
}
else
{
$html_start = " ";
}
//-----------------------------------------
if ($upload == '*')
{
$html_upload = " ";
}
else if ( preg_match( "/(?:^|,)".$data['perm_id']."(?:,|$)/", $upload ) )
{
$html_upload = " ";
}
else
{
$html_upload = " ";
}
$html .= $this->add_td_row( array( "{$data['perm_name']}
",
"$html_show ",
"$html_read ",
"$html_reply ",
"$html_start ",
"$html_upload ",
) );
}
$html .= $this->add_td_row( array( " ",
" ",
" ",
" ",
" ",
" ",
) );
return $html;
}
//-----------------------------------------
//--------------------------------------------------------------------
// SCREEN ELEMENTS
//-----------------------------------------
//--------------------------------------------------------------------
function add_subtitle($title="",$id="subtitle", $colspan="") {
if ($colspan != "")
{
$colspan = " colspan='$colspan' ";
}
return "\n$title \n";
}
//-----------------------------------------
function start_table( $title="", $desc="") {
if ($title != "")
{
$this->has_title = 1;
$html .= "
$title
\n";
if ( $desc != "" )
{
$html .= "
$desc
\n";
}
}
$html .= "\n
";
if (isset($this->td_header[0]))
{
$html .= "\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[0]} \n";
}
$this->td_colspan++;
}
$html.= " \n";
}
return $html;
}
//-----------------------------------------
function add_standalone_row($text = "", $align='center', $class='pformstrip')
{
return "\n";
}
//-----------------------------------------
function add_td_row( $array, $css="", $align='middle' ) {
if (is_array($array))
{
$html = "\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 .= "".$text." \n";
}
else
{
if ($this->td_header[$i][1] != "")
{
$width = " width='{$this->td_header[$i][1]}' ";
}
else
{
$width = "";
}
$html .= "".$array[$i]." \n";
}
}
$html .= " \n";
return $html;
}
}
//-----------------------------------------
function add_td_basic($text="",$align="left",$id="tdrow1") {
$html = "";
$colspan = "";
if ($text != "")
{
if ($this->td_colspan > 0)
{
$colspan = " colspan='".$this->td_colspan."' ";
}
$html .= "$text \n";
}
return $html;
}
//-----------------------------------------
function add_td_spacer() {
if ($this->td_colspan > 0)
{
$colspan = " colspan='".$this->td_colspan."' ";
}
return " ";
}
//-----------------------------------------
function end_table() {
$this->td_header = array(); // Reset TD headers
if ($this->has_title == 1)
{
$this->has_title = 0;
return "
\n\n";
}
else
{
return "\n\n";
}
}
//-----------------------------------------
function print_top($title="",$desc="")
{
global $ibforums;
return "
Menu
skin_url}/acp_css.css\" />
top_extra}>
$desc
";
}
function wrap_nav($links)
{
return "\n$links
\n";
}
//-----------------------------------------
function print_foot() {
return "
Quick Jump
Invision Power Board © ".date("Y")."
IPS, Inc.
";
}
//-----------------------------------------
//{ background-color:#C2CFDF; font-weight:bold; font-size:12px; color:#000055 }
function menu_top()
{
global $ibforums;
return "
Menu
skin_url}/acp_css.css\" />
";
}
function get_css() { }
//-----------------------------------------
function menu_foot() {
return "
";
}
//-----------------------------------------
function menu_cat_wrap($show, $name="", $links="", $id = "", $desc, $color='#FFF', $extra='') {
global $IN;
return "$extra
\n";
}
//-----------------------------------------
function menu_cat_link($pid, $cid, $url="", $name="", $urltype=0, $isredirect=0)
{
global $INFO;
if ( $urltype == 1 )
{
$theurl = $ibforums->vars['board_url'].'/index.'.$ibforums->vars['php_ext'].'?';
}
else
{
$theurl = $this->base_url;
}
if ( $isredirect )
{
$icon = " ";
$extra_css = ';font-style:italic';
}
else
{
$icon = " ";
$extra_css = "";
}
return "\n";
}
//-----------------------------------------
function frame_set()
{
global $ibforums, $std;
$extra_query = 'act=index';
if ( $ibforums->input['act'] != 'idx' )
{
$extra_query = str_replace( '&', '&', $std->clean_value($_SERVER['QUERY_STRING']) );
$extra_query = str_replace( "{$ibforums->vars['board_url']}" , "" , $extra_query );
$extra_query = preg_replace( "!/?admin\.{$ibforums->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 );
}
$frames = "
Invision Power Board Administration Center
";
return $frames;
}
function skin_jump_menu_wrap()
{
global $ibforums, $DB;
return "
".$ibforums->admin->skin_jump_menu()."
";
}
}
?>