Files
IPB/upload/sources/action_admin/help.php
T
2025-12-19 00:21:15 -08:00

319 lines
9.8 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: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $
| > $Revision: 23 $
| > $Author: matt $
+---------------------------------------------------------------------------
|
| > Help Control functions
| > Module written by Matt Mecham
| > Date started: 2nd April 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Mon 24th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Íåâåðíûé âõîä</h1> Ó Âàñ íåò äîñòóïà ê äèðåêòèâå ýòîãî ôàéëà. Åñëè Âû ïðîâîäèëè îáíîâëåíèÿ, óáåäèòåñü, ÷òî íå çàáûëè îáíîâèòü 'admin.php'.";
exit();
}
class ad_help
{
var $base_url;
/**
* Section title name
*
* @var string
*/
var $perm_main = "tools";
/**
* Section title name
*
* @var string
*/
var $perm_child = "help";
function auto_run()
{
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
//-----------------------------------------
switch($this->ipsclass->input['code'])
{
case 'edit':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
$this->show_form('edit');
break;
case 'new':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':add' );
$this->show_form('new');
break;
case 'doedit':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
$this->doedit();
break;
case 'donew':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':add' );
$this->doadd();
break;
case 'remove':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':remove' );
$this->remove();
break;
//-----------------------------------------
default:
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' );
$this->list_files();
break;
}
}
//-----------------------------------------
// HELP FILE FUNCTIONS
//-----------------------------------------
function doedit()
{
if ($this->ipsclass->input['id'] == "")
{
$this->ipsclass->admin->error("Âû äîëæíû ââåñòè ïðàâèëüíûé ID ôàéëà ïîìîùè!");
}
$text = preg_replace( "/\n/", "<br>", stripslashes($_POST['text'] ) );
//$title = preg_replace( "/\n/", "<br>", stripslashes($_POST['title'] ) );
$desc = preg_replace( "/\n/", "<br>", stripslashes($_POST['description'] ) );
$text = preg_replace( "/\\\/", "&#092;", $text );
$this->ipsclass->DB->do_update( 'faq', array( 'title' => $this->ipsclass->input['title'],
'text' => $text,
'description' => $desc,
) , "id=".intval($this->ipsclass->input['id']) );
$this->ipsclass->admin->save_log("Èçìåíåí ôàéë ïîìîùè");
$this->ipsclass->boink_it($this->ipsclass->base_url."&{$this->ipsclass->form_code}");
exit();
}
//=====================================================
function show_form($type='new')
{
$this->ipsclass->admin->page_detail = "Â ýòîé ñåêöèè âû ìîæåòå äîáàâëÿòü, èçìåíÿòü è óäàëÿòü ôàéëû ïîìîùè.";
$this->ipsclass->admin->page_title = "Óïðàâëåíèå ôàéëàìè ïîìîùè";
//-----------------------------------------
if ($type != 'new')
{
if ($this->ipsclass->input['id'] == "")
{
$this->ipsclass->admin->error("Âû äîëæíû ââåñòè ïðàâèëüíûé ID ôàéëà ïîìîùè!");
}
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'faq', 'where' => "id=".intval($this->ipsclass->input['id']) ) );
$this->ipsclass->DB->simple_exec();
if ( ! $r = $this->ipsclass->DB->fetch_row() )
{
$this->ipsclass->admin->error("Íåâîçìîæíî íàéòè â áàçå äàííûõ ôàéë ïîìîùè ñ òàêèì ID");
}
//-----------------------------------------
$button = 'Èçìåíèòü ýòîò ôàéë ïîìîùè';
$code = 'doedit';
}
else
{
$r = array();
$button = 'Äîáàâèòü ýòîò ôàéë ïîìîùè';
$code = 'donew';
}
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code' , $code ),
2 => array( 'act' , 'help' ),
3 => array( 'id' , $this->ipsclass->input['id'] ),
4 => array( 'section', $this->ipsclass->section_code ),
) );
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "20%" );
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "80%" );
$r['text'] = preg_replace( "/<br>/i", "\n", stripslashes($r['text']) );
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( $button );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Íàçâàíèå ôàéëà ïîìîùè",
$this->ipsclass->adskin->form_input('title' , stripslashes($r['title']) ),
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Îïèñàíèå",
$this->ipsclass->adskin->form_textarea('description', stripslashes($r['description']) ),
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Òåêñò",
$this->ipsclass->adskin->form_textarea('text', $r['text'], "60", "10" ),
) );
$this->ipsclass->html .= $this->ipsclass->adskin->end_form($button);
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
$this->ipsclass->admin->output();
}
//=====================================================
function remove()
{
if ($this->ipsclass->input['id'] == "")
{
$this->ipsclass->admin->error("Âû äîëæíû ââåñòè ïðàâèëüíûé ID ôàéëà ïîìîùè!");
}
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'faq', 'where' => "id=".$this->ipsclass->input['id'] ) );
$this->ipsclass->admin->save_log("Removed a help file");
$this->ipsclass->boink_it($this->ipsclass->base_url."&{$this->ipsclass->form_code}");
exit();
}
//=====================================================
function doadd()
{
if ($this->ipsclass->input['title'] == "")
{
$this->ipsclass->admin->error("Âû äîëæíû ââåñòè íàçâàíèå ôàéëà ïîìîùè!");
}
$text = preg_replace( "/\n/", "<br>", stripslashes($_POST['text'] ) );
$title = preg_replace( "/\n/", "<br>", stripslashes($_POST['title'] ) );
$desc = preg_replace( "/\n/", "<br>", stripslashes($_POST['description'] ) );
$text = preg_replace( "/\\\/", "&#092;", $text );
$this->ipsclass->DB->do_insert( 'faq', array( 'title' => $title,
'text' => $text,
'description' => $desc,
) );
$this->ipsclass->admin->save_log("Äîáàâëåí ôàéë ïîìîùè");
$this->ipsclass->boink_it($this->ipsclass->base_url."&{$this->ipsclass->form_code}");
exit();
}
//=====================================================
function list_files()
{
$this->ipsclass->admin->page_detail = "Â ýòîé ñåêöèè âû ìîæåòå äîáàâëÿòü, èçìåíÿòü è óäàëÿòü ôàéëû ïîìîùè";
$this->ipsclass->admin->page_title = "Óïðàâëåíèå ôàéëàìè ïîìîùè";
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( "Íàçâàíèå" , "50%" );
$this->ipsclass->adskin->td_header[] = array( "Èçìåíèòü" , "30%" );
$this->ipsclass->adskin->td_header[] = array( "Óäàëèòü" , "20%" );
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Òåêóùèå ôàéëû ïîìîùè" );
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'faq', 'order' => "id" ) );
$this->ipsclass->DB->simple_exec();
if ( $this->ipsclass->DB->get_num_rows() )
{
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>".stripslashes($r['title'])."</b><br>".stripslashes($r['description']),
"<center><a href='".$this->ipsclass->base_url."&{$this->ipsclass->form_code}&code=edit&id={$r['id']}'>Èçìåíèòü</a></center>",
"<center><a href='".$this->ipsclass->base_url."&{$this->ipsclass->form_code}&code=remove&id={$r['id']}'>Óäàëèòü</a></center>",
) );
}
}
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic("<a href='".$this->ipsclass->base_url."&{$this->ipsclass->form_code}&code=new'>Äîáàâèòü íîâûé ôàéë ïîìîùè</a>", "center", "pformstrip" );
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
//-----------------------------------------
$this->ipsclass->admin->output();
}
}
?>