Version 3.0.5
This commit is contained in:
1 parent
19b38c7c74
commit
1d4720f3e2
3755 files changed
+508378
-664541
No files matched your search
Binary file not shown.
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* API: Core
|
||||
* Last Updated: $Date: 2009-05-11 17:39:45 -0400 (Mon, 11 May 2009) $
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4628 $
|
||||
*/
|
||||
|
||||
class apiCore
|
||||
{
|
||||
/**
|
||||
* Registry Object Shortcuts
|
||||
*/
|
||||
protected $DB;
|
||||
protected $settings;
|
||||
protected $request;
|
||||
protected $lang;
|
||||
protected $member;
|
||||
protected $cache;
|
||||
protected $registry;
|
||||
|
||||
/**
|
||||
* API Error string
|
||||
*
|
||||
* @var array Errors
|
||||
*/
|
||||
public $api_error = array();
|
||||
|
||||
/**
|
||||
* API Path to IPB root (where init.php/index.php is)
|
||||
*
|
||||
* @var string Path to IPB root folder
|
||||
*/
|
||||
public $path_to_ipb = '';
|
||||
|
||||
/**
|
||||
* Loads the API Classes
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
if( !$this->path_to_ipb )
|
||||
{
|
||||
if( defined('DOC_IPS_ROOT_PATH') )
|
||||
{
|
||||
$this->path_to_ipb = DOC_IPS_ROOT_PATH;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->path_to_ipb = dirname(__FILE__) . '/../../';
|
||||
}
|
||||
}
|
||||
|
||||
/* Load the registry */
|
||||
require_once( $this->path_to_ipb . 'initdata.php' );
|
||||
require_once( $this->path_to_ipb . CP_DIRECTORY . '/sources/base/ipsRegistry.php' );
|
||||
|
||||
$this->registry = ipsRegistry::instance();
|
||||
$this->registry->init();
|
||||
|
||||
/* Make Shortcuts */
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->lang = $this->registry->getClass('class_localization');
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
|
||||
/* INIT Child? */
|
||||
if( method_exists( $this, 'childInit' ) )
|
||||
{
|
||||
$this->childInit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Blog API file
|
||||
* Last Updated: $Date: 2009-02-04 15:03:59 -0500 (Wed, 04 Feb 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage IP.Gallery
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 3887 $
|
||||
* @since 2.2.0
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'apiCore' ) )
|
||||
{
|
||||
require_once( IPS_ROOT_PATH . 'api/api_core.php' );
|
||||
}
|
||||
|
||||
class apiBlog extends apiCore
|
||||
{
|
||||
/**
|
||||
* Constructor. Calls parent init() method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->init();
|
||||
|
||||
if( ! ipsRegistry::isClassLoaded( 'blogFunctions' ) )
|
||||
{
|
||||
/* Load the Blog functions library */
|
||||
require_once( IPSLib::getAppDir( 'blog' ) . '/sources/classes/blogFunctions.php' );
|
||||
$this->registry->setClass( 'blogFunctions', new blogFunctions( $this->registry ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the Blog ID of a member
|
||||
* THIS IS DEPRECATED - use fetchBlogIds
|
||||
*
|
||||
* @param int Member ID
|
||||
* @return int Blog ID ( 0 if no Blog found )
|
||||
*/
|
||||
public function getBlogID( $member_id=0 )
|
||||
{
|
||||
$member_id = intval( $member_id );
|
||||
|
||||
//-----------------------------------------
|
||||
// We entered here on member id, find blog_id and redirect them to here
|
||||
//-----------------------------------------
|
||||
$blog = $this->DB->buildAndFetch( array(
|
||||
'select' => 'blog_id, blog_name',
|
||||
'from' => 'blog_blogs',
|
||||
'where' => "member_id={$member_id}"
|
||||
) );
|
||||
if( ! $blog['blog_id'] or ! $blog['blog_name'] )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $blog['blog_id'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve blog IDs this member can author in
|
||||
*
|
||||
* @access public
|
||||
* @param int Member ID
|
||||
* @return array array of ids with basic information, like: array( blog_id => array( 'blog_name', 'blog_seo_name' )
|
||||
*/
|
||||
public function fetchBlogIds( $member_id=0 )
|
||||
{
|
||||
$return = array();
|
||||
$member_id = intval( $member_id );
|
||||
$data = $this->registry->getClass('blogFunctions')->fetchMyBlogs( IPSMember::load( $member_id ) );
|
||||
|
||||
if ( is_array( $data ) AND count( $data ) )
|
||||
{
|
||||
foreach( $data as $id => $blog )
|
||||
{
|
||||
if ( $blog['_canPostIn'] )
|
||||
{
|
||||
$return[ $id ] = $blog;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the Blog ID of a member
|
||||
*
|
||||
* @param int Blog ID
|
||||
* @return string Blog URL
|
||||
*/
|
||||
public function getBlogUrl( $blog_id=0 )
|
||||
{
|
||||
$blog_id = intval( $blog_id );
|
||||
|
||||
//-----------------------------------------
|
||||
// We entered here on member id, find blog_id and redirect them to here
|
||||
//-----------------------------------------
|
||||
$blog = $this->DB->buildAndFetch( array (
|
||||
'select' => 'blog_id, blog_name, blog_seo_name',
|
||||
'from' => 'blog_blogs',
|
||||
'where' => "blog_id={$blog_id}"
|
||||
) );
|
||||
if( ! $blog['blog_id'] or ! $blog['blog_name'] )
|
||||
{
|
||||
return '';
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->registry->output->buildSEOUrl( 'app=blog&blogid=' . $blog_id, 'public', $blog['blog_seo_name'], 'showblog' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the last x entries of a Blog
|
||||
* Only public publishes entries are returned
|
||||
*
|
||||
* @param string Either 'member' or 'blog'
|
||||
* @param int Blog ID or Member ID
|
||||
* @param int Number of entries (to return)
|
||||
* @return array Array of last X entries
|
||||
*/
|
||||
public function lastXEntries( $type, $id, $number_of_entries=10 )
|
||||
{
|
||||
/* INIT */
|
||||
$id = intval( $id );
|
||||
$return_array = array();
|
||||
$extra = "";
|
||||
$allowguests = "";
|
||||
|
||||
/* Build permissions */
|
||||
$this->registry->blogFunctions->buildPerms();
|
||||
|
||||
/* Got permission to view blog entries? */
|
||||
if ( $this->memberData['g_blog_settings']['g_blog_allowview'] )
|
||||
{
|
||||
/* Private club? */
|
||||
if( ! $this->memberData['member_id'] )
|
||||
{
|
||||
$allowguests .= " AND b.blog_allowguests = 1";
|
||||
}
|
||||
|
||||
if( ! $this->memberData['_blogmod']['moderate_can_view_private'] )
|
||||
{
|
||||
$extra = " AND ( ( ( b.blog_owner_only=1 AND b.member_id={$this->memberData['member_id']} ) OR b.blog_owner_only=0 ) AND ( b.blog_authorized_users LIKE '%,{$this->memberData['member_id']},%' OR b.blog_authorized_users IS NULL ) ) ";
|
||||
}
|
||||
|
||||
$qtype = $type == 'member' ? "b.member_id={$id}" : "b.blog_id={$id}";
|
||||
|
||||
$this->DB->build( array( 'select' => "e.*",
|
||||
'from' => array('blog_entries' => 'e'),
|
||||
'where' => "{$qtype} AND b.blog_type='local' AND e.entry_status='published'".$allowguests.$extra,
|
||||
'order' => 'e.entry_date DESC',
|
||||
'limit' => array( 0, intval( $number_of_entries ) ),
|
||||
'add_join' => array( array( 'select' => 'b.blog_name, b.blog_seo_name',
|
||||
'from' => array( 'blog_blogs' => 'b' ),
|
||||
'where' => "e.blog_id=b.blog_id",
|
||||
'type' => 'left' ) ) ) );
|
||||
|
||||
$outer = $this->DB->execute();
|
||||
|
||||
while( $entry = $this->DB->fetch($outer) )
|
||||
{
|
||||
$entry['blog_url'] = $this->registry->blogFunctions->getBlogUrl( $entry['blog_id'] );
|
||||
$entry['entry_url'] = $entry['blog_url'] . 'showentry='.$entry['entry_id'];
|
||||
|
||||
$return_array[] = $entry;
|
||||
}
|
||||
return $return_array;
|
||||
}
|
||||
else
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,289 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Forums topic view API file
|
||||
* Last Updated: $Date: 2009-02-04 15:03:59 -0500 (Wed, 04 Feb 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 3887 $
|
||||
* @since 2.2.0
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'apiCore' ) )
|
||||
{
|
||||
require_once( IPS_ROOT_PATH . 'api/api_core.php' );
|
||||
}
|
||||
|
||||
class apiTopicView extends apiCore
|
||||
{
|
||||
/**
|
||||
* Topic list config
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $topic_list_config = array( 'offset' => 0,
|
||||
'limit' => 5,
|
||||
'forums' => '*',
|
||||
'order_field' => 'last_post',
|
||||
'order_by' => 'DESC' );
|
||||
|
||||
/**
|
||||
* Attachment pids
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $attach_pids = array();
|
||||
|
||||
/**
|
||||
* Constructor. Calls parent init() method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->init();
|
||||
|
||||
//-----------------------------------------
|
||||
// Get some classes
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . '/app_class_forums.php' );
|
||||
$appClass = new app_class_forums( $this->registry );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of gallery data
|
||||
*
|
||||
* @access public
|
||||
* @param bool View as guest?
|
||||
* @return mixed Array of data, or void
|
||||
*/
|
||||
public function return_topic_list_data( $view_as_guest=0 )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$topics = array();
|
||||
|
||||
if( !$view_as_guest )
|
||||
{
|
||||
$this->registry->class_forums->strip_invisible = false;
|
||||
$this->registry->class_forums->forumsInit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->class_forums->strip_invisible = true;
|
||||
$this->registry->class_forums->forumsInit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up
|
||||
//-----------------------------------------
|
||||
|
||||
$this->topic_list_config['order_field'] = ( $this->topic_list_config['order_field'] == 'started' ) ? 'start_date' : $this->topic_list_config['order_field'];
|
||||
$this->topic_list_config['order_field'] = ( $this->topic_list_config['order_field'] == 'lastpost' ) ? 'last_post' : $this->topic_list_config['order_field'];
|
||||
$this->topic_list_config['forums'] = ( is_array( $this->topic_list_config['forums'] ) ) ? implode( ",", $this->topic_list_config['forums'] ) : $this->topic_list_config['forums'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up allowed forums
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->topic_list_config['forums'] )
|
||||
{
|
||||
# Reset topics...
|
||||
if ( $this->topic_list_config['forums'] == '*' )
|
||||
{
|
||||
$_tmp_array = array();
|
||||
$this->topic_list_config['forums'] = '';
|
||||
|
||||
foreach( $this->registry->class_forums->forum_by_id as $id => $data )
|
||||
{
|
||||
$_tmp_forums[] = $id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$_tmp_forums = explode( ',', $this->topic_list_config['forums'] );
|
||||
$_tmp_array = array();
|
||||
$this->topic_list_config['forums'] = '';
|
||||
}
|
||||
|
||||
foreach( $_tmp_forums as $_id )
|
||||
{
|
||||
$_tmp_array[] = $_id;
|
||||
}
|
||||
|
||||
$this->topic_list_config['forums'] = implode( ',', $_tmp_array );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get from the DB
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => 't.*',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.approved=1 AND t.forum_id IN (0,'.$this->topic_list_config['forums'].')',
|
||||
'order' => $this->topic_list_config['order_field'].' '.$this->topic_list_config['order_by'],
|
||||
'limit' => array( $this->topic_list_config['offset'], $this->topic_list_config['limit'] ),
|
||||
'add_join' => array(
|
||||
0 => array( 'select' => 'p.*',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 't.topic_firstpost=p.pid',
|
||||
'type' => 'left' ),
|
||||
1 => array( 'select' => 'm.member_id, m.members_display_name as member_name, m.members_seo_name, m.member_group_id, m.email',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.member_id=p.author_id",
|
||||
'type' => 'left' ),
|
||||
2 => array( 'select' => 'f.id as forum_id, f.name as forum_name, f.use_html, f.name_seo',
|
||||
'from' => array( 'forums' => 'f' ),
|
||||
'where' => "t.forum_id=f.id",
|
||||
'type' => 'left' ) )
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
if( $row['topic_hasattach'] )
|
||||
{
|
||||
$this->attach_pids[] = $row['pid'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Guest name?
|
||||
//-----------------------------------------
|
||||
|
||||
$row['member_name'] = $row['member_name'] ? $row['member_name'] : $row['author_name'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Topic link
|
||||
//-----------------------------------------
|
||||
|
||||
$row['link-topic'] = $this->registry->getClass('output')->buildSEOUrl( "showtopic={$row['tid']}", 'public', $row['title_seo'], 'showtopic' );
|
||||
$row['link-forum'] = $this->registry->getClass('output')->buildSEOUrl( "showforum={$row['forum_id']}", 'public', $row['name_seo'], 'showforum' );
|
||||
$row['link-profile'] = $this->registry->getClass('output')->buildSEOUrl( "showuser={$row['member_id']}", 'public', $row['members_seo_name'], 'showuser' );
|
||||
|
||||
$topics[] = $row;
|
||||
}
|
||||
|
||||
if( count( $this->attach_pids ) )
|
||||
{
|
||||
$final_attachments = array();
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'attachments',
|
||||
'where' => "attach_rel_module='post' AND attach_rel_id IN (" . implode( ",", $this->attach_pids ) . ")"
|
||||
) );
|
||||
|
||||
$this->DB->execute;
|
||||
|
||||
while ( $a = $this->DB->fetch() )
|
||||
{
|
||||
$final_attachments[ $a[ 'attach_pid' ] ][ $a['attach_id'] ] = $a;
|
||||
}
|
||||
|
||||
$final_topics = array();
|
||||
|
||||
foreach( $topics as $mytopic )
|
||||
{
|
||||
$this_topic_attachments = array();
|
||||
|
||||
foreach ( $final_attachments as $pid => $data )
|
||||
{
|
||||
if( $pid <> $mytopic['pid'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$temp_out = "";
|
||||
$temp_hold = array();
|
||||
|
||||
foreach( $final_attachments[$pid] as $aid => $row )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Is it an image, and are we viewing the image in the post?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->settings['show_img_upload'] and $row['attach_is_image'] )
|
||||
{
|
||||
if ( $this->settings['siu_thumb'] AND $row['attach_thumb_location'] AND $row['attach_thumb_width'] )
|
||||
{
|
||||
$this_topic_attachments[] = array( 'size' => IPSLib::sizeFormat( $row['attach_filesize'] ),
|
||||
'method' => 'post',
|
||||
'id' => $row['attach_id'],
|
||||
'file' => $row['attach_file'],
|
||||
'hits' => $row['attach_hits'],
|
||||
'thumb_location' => $row['attach_thumb_location'],
|
||||
'type' => 'thumb',
|
||||
'thumb_x' => $row['attach_thumb_width'],
|
||||
'thumb_y' => $row['attach_thumb_height'],
|
||||
'ext' => $row['attach_ext'],
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this_topic_attachments[] = array( 'size' => IPSLib::sizeFormat( $row['attach_filesize'] ),
|
||||
'method' => 'post',
|
||||
'id' => $row['attach_id'],
|
||||
'file' => $row['attach_file'],
|
||||
'hits' => $row['attach_hits'],
|
||||
'thumb_location' => $row['attach_thumb_location'],
|
||||
'type' => 'image',
|
||||
'thumb_x' => $row['attach_thumb_width'],
|
||||
'thumb_y' => $row['attach_thumb_height'],
|
||||
'ext' => $row['attach_ext'],
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this_topic_attachments[] = array( 'size' => IPSLib::sizeFormat( $row['attach_filesize'] ),
|
||||
'method' => 'post',
|
||||
'id' => $row['attach_id'],
|
||||
'file' => $row['attach_file'],
|
||||
'hits' => $row['attach_hits'],
|
||||
'thumb_location' => $row['attach_thumb_location'],
|
||||
'type' => 'reg',
|
||||
'thumb_x' => $row['attach_thumb_width'],
|
||||
'thumb_y' => $row['attach_thumb_height'],
|
||||
'ext' => $row['attach_ext'],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( count( $this_topic_attachments ) )
|
||||
{
|
||||
$mytopic['attachment_data'] = $this_topic_attachments;
|
||||
}
|
||||
|
||||
$final_topics[] = $mytopic;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Return...
|
||||
//-----------------------------------------
|
||||
|
||||
if( count( $final_topics ) )
|
||||
{
|
||||
return $final_topics;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $topics;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Gallery API file
|
||||
* Last Updated: $Date: 2009-11-11 11:00:08 -0500 (Wed, 11 Nov 2009) $
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage IP.Gallery
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 5351 $
|
||||
* @since 2.2.0
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'apiCore' ) )
|
||||
{
|
||||
require_once( IPS_ROOT_PATH . 'api/api_core.php' );
|
||||
}
|
||||
|
||||
class apiGallery extends apiCore
|
||||
{
|
||||
/**
|
||||
* Gallery library object
|
||||
*
|
||||
* @access public
|
||||
* @var object
|
||||
*/
|
||||
public $glib;
|
||||
|
||||
/**
|
||||
* Gallery category object
|
||||
*
|
||||
* @access public
|
||||
* @var object
|
||||
*/
|
||||
public $category;
|
||||
|
||||
/**
|
||||
* Total images found for result
|
||||
*
|
||||
* @access public
|
||||
* @var integer
|
||||
*/
|
||||
public $total = 0;
|
||||
|
||||
/**
|
||||
* Database result resource
|
||||
*
|
||||
* @access public
|
||||
* @var resource
|
||||
*/
|
||||
public $res;
|
||||
|
||||
/**
|
||||
* Constructor. Calls parent init() method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of gallery data
|
||||
*
|
||||
* @access public
|
||||
* @param integer Member id
|
||||
* @param integer Limit
|
||||
* @param integer true pulls the image results and returns them, false leaves the result set as $this->res
|
||||
* @return mixed Array of gallery data, or void
|
||||
*/
|
||||
function return_gallery_data( $member_id=0, $limit=5, $do_pull=true )
|
||||
{
|
||||
if( !$member_id )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$images = array();
|
||||
|
||||
$member_id = intval($member_id);
|
||||
|
||||
$categories = $this->category->getAllowedCats( 0 );
|
||||
$albums = $this->glib->getAllowedAlbums();
|
||||
|
||||
if( !count($categories) AND !count($albums) )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
$where = array();
|
||||
$where_statement = "";
|
||||
|
||||
if( count($categories) )
|
||||
{
|
||||
$where[] = "i.category_id IN (".implode( ',', $categories ).")";
|
||||
}
|
||||
|
||||
if( is_array($albums) AND count($albums) )
|
||||
{
|
||||
$where[] = "i.album_id IN (".implode( ",", $albums ).")";
|
||||
}
|
||||
else if( $albums == true AND count($categories) )
|
||||
{
|
||||
$dewhere .= " ( i.album_id > 0 AND a.category_id IN ( ".implode( ",", $categories )." ) ";
|
||||
|
||||
if( !$this->memberData['g_mod_albums'] )
|
||||
{
|
||||
$dewhere .= " AND ( a.public_album=1 OR a.member_id={$this->memberData['member_id']} ) ";
|
||||
}
|
||||
|
||||
$dewhere .= ")";
|
||||
|
||||
$where[] = $dewhere;
|
||||
}
|
||||
|
||||
if( !count($where) )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$where_statement = implode( " OR ", $where );
|
||||
}
|
||||
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'i.*',
|
||||
'from' => array( 'gallery_images' => 'i' ),
|
||||
'where' => "i.approved=1 AND i.member_id={$member_id} AND ({$where_statement})",
|
||||
'add_join' => array(
|
||||
array(
|
||||
'type' => 'left',
|
||||
'select' => 'a.name as album_name, a.public_album',
|
||||
'from' => array( 'gallery_albums' => 'a' ),
|
||||
'where' => 'a.id=i.album_id',
|
||||
),
|
||||
array(
|
||||
'type' => 'left',
|
||||
'select' => 'c.name as category_name',
|
||||
'from' => array( 'gallery_categories' => 'c' ),
|
||||
'where' => "c.id=i.category_id",
|
||||
),
|
||||
array(
|
||||
'type' => 'left',
|
||||
'select' => 'm.members_display_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.member_id=i.member_id",
|
||||
),
|
||||
array(
|
||||
'type' => 'left',
|
||||
'select' => 'r.id as rated, r.rate as my_rate',
|
||||
'from' => array( 'gallery_ratings' => 'r' ),
|
||||
'where' => "r.img_id=i.id AND r.member_id={$this->memberData['member_id']}",
|
||||
)
|
||||
),
|
||||
'order' => 'i.idate DESC',
|
||||
'limit' => array( 0, $limit )
|
||||
) );
|
||||
|
||||
$this->res = $this->DB->execute();
|
||||
|
||||
$this->total = $this->DB->getTotalRows( $this->res );
|
||||
|
||||
if( $do_pull )
|
||||
{
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$r['_my_rate'] = $r['my_rate'];
|
||||
|
||||
$images[] = $r;
|
||||
}
|
||||
|
||||
return $images;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Member property updater (AJAX)
|
||||
* Last Updated: $Date: 2009-08-20 18:20:40 -0400 (Thu, 20 Aug 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 1st march 2002
|
||||
* @version $Revision: 5035 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_member_form__core implements admin_member_form
|
||||
{
|
||||
/**
|
||||
* Tab name
|
||||
* This can be left blank and the application title will
|
||||
* be used
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $tab_name = "";
|
||||
|
||||
|
||||
/**
|
||||
* Returns sidebar links for this tab
|
||||
* You may return an empty array or FALSE to not have
|
||||
* any links show in the sidebar for this block.
|
||||
*
|
||||
* The links must have 'section=xxxxx&module=xxxxx[&do=xxxxxx]'. The rest of the URL
|
||||
* is added automatically.
|
||||
*
|
||||
* The image must be a full URL or blank to use a default image.
|
||||
*
|
||||
* Use the format:
|
||||
* $array[] = array( 'img' => '', 'url' => '', 'title' => '' );
|
||||
*
|
||||
* @access public
|
||||
* @author Matt Mecham
|
||||
* @param array Member data
|
||||
* @return array Array of links
|
||||
*/
|
||||
public function getSidebarLinks( $member=array() )
|
||||
{
|
||||
$array = array();
|
||||
|
||||
if( $member['failed_login_count'] )
|
||||
{
|
||||
$array[] = array( 'img' => '',
|
||||
'url' => "app=members&module=members&section=tools&do=do_locked&auth_key=".ipsRegistry::member()->form_hash."&mid_{$member['member_id']}=1&type=unlock",
|
||||
'title' => "Сбросить" );
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns content for the page.
|
||||
*
|
||||
* @access public
|
||||
* @author Matt Mecham
|
||||
* @param array Member data
|
||||
* @return array Array of tabs, content
|
||||
*/
|
||||
public function getDisplayContent( $member=array() )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the entries for saving and return
|
||||
*
|
||||
* @access public
|
||||
* @author Brandon Farber
|
||||
* @return array Multi-dimensional array (core, extendedProfile) for saving
|
||||
*/
|
||||
public function getForSave()
|
||||
{
|
||||
return array( 'core' => array(), 'extendedProfile' => array() );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Core Sessions
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Main loader class
|
||||
*/
|
||||
class publicSessions__core
|
||||
{
|
||||
/**
|
||||
* Return session variables for this application
|
||||
*
|
||||
* current_appcomponent, current_module and current_section are automatically
|
||||
* stored. This function allows you to add specific variables in.
|
||||
*
|
||||
* @access public
|
||||
* @author Matt Mecham
|
||||
* @return array
|
||||
*/
|
||||
public function getSessionVariables()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$array = array( 'location_1_type' => '',
|
||||
'location_1_id' => 0,
|
||||
'location_2_type' => '',
|
||||
'location_2_id' => 0 );
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse/format the online list data for the records
|
||||
*
|
||||
* @access public
|
||||
* @author Brandon Farber
|
||||
* @param array Online list rows to check against
|
||||
* @return array Online list rows parsed
|
||||
*/
|
||||
public function parseOnlineEntries( $rows )
|
||||
{
|
||||
if( !is_array($rows) OR !count($rows) )
|
||||
{
|
||||
return $rows;
|
||||
}
|
||||
|
||||
$final = array();
|
||||
|
||||
foreach( $rows as $row )
|
||||
{
|
||||
if( $row['current_appcomponent'] == 'core' )
|
||||
{
|
||||
if( $row['current_module'] == 'global' )
|
||||
{
|
||||
if( $row['current_section'] == 'login' )
|
||||
{
|
||||
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_login'];
|
||||
}
|
||||
}
|
||||
else if( $row['current_module'] == 'search' )
|
||||
{
|
||||
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_search'];
|
||||
}
|
||||
else if( $row['current_module'] == 'reports' )
|
||||
{
|
||||
$rcCache = ipsRegistry::cache()->getCache('report_cache');
|
||||
|
||||
if( is_array( $rcCache ) )
|
||||
{
|
||||
if( $rcCache['group_access'][ ipsRegistry::member()->getProperty('member_group_id') ] == true )
|
||||
{
|
||||
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_reports'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$final[ $row['id'] ] = $row;
|
||||
}
|
||||
|
||||
return $final;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Core registered caches, redirect resets and bitwise settings
|
||||
* Last Updated: $Date: 2009-11-25 17:27:38 -0500 (Wed, 25 Nov 2009) $
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 5477 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Which caches to load by default
|
||||
*/
|
||||
$_LOAD = array();
|
||||
|
||||
if ( $_GET['module'] == 'search' )
|
||||
{
|
||||
$_LOAD['ranks'] = 1;
|
||||
$_LOAD['bbcode'] = 1;
|
||||
$_LOAD['emoticons'] = 1;
|
||||
$_LOAD['reputation_levels'] = 1;
|
||||
}
|
||||
|
||||
if ( $_GET['module'] == 'reports' )
|
||||
{
|
||||
$_LOAD['ranks'] = 1;
|
||||
$_LOAD['bbcode'] = 1;
|
||||
$_LOAD['emoticons'] = 1;
|
||||
}
|
||||
|
||||
if( $_GET['module'] == 'usercp' )
|
||||
{
|
||||
$_LOAD['ranks'] = 1;
|
||||
$_LOAD['reputation_levels'] = 1;
|
||||
$_LOAD['emoticons'] = 1;
|
||||
}
|
||||
|
||||
|
||||
/* Never, ever remove or re-order these options!!
|
||||
* Feel free to add, though. :) */
|
||||
|
||||
$_BITWISE = array();
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* BBCode Management : Determines if bbcode can be used in this section
|
||||
* Last Updated: $LastChangedDate: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/*
|
||||
* An array of key => value pairs
|
||||
* When going to parse, the key should be passed to the editor
|
||||
* to determine which bbcodes should be parsed in the section
|
||||
*
|
||||
*/
|
||||
$BBCODE = array(
|
||||
'reports' => ipsRegistry::getClass('class_localization')->words['ctype__reports'],
|
||||
);
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Sets up SEO templates
|
||||
* Last Updated: $Date: 2009-03-04 15:08:31 +0000 (Wed, 04 Mar 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4136 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* SEO templates
|
||||
*
|
||||
* 'allowRedirect' is a flag to tell IP.Board whether to check the incoming link and if not formatted correctly, redirect the correct one
|
||||
*
|
||||
* OUT FORMAT REGEX:
|
||||
* First array element is a regex to run to see if we've a match for the URL
|
||||
* The second array element is the template to use the results of the parenthesis capture
|
||||
*
|
||||
* Special variable #{__title__} is replaced with the $title data passed to output->formatUrl( $url, $title)
|
||||
*
|
||||
* IMPORTANT: Remember that when these regex are used, the output has not been fully parsed so you will get:
|
||||
* showuser={$data['member_id']} NOT showuser=1 so do not try and match numerics only!
|
||||
*
|
||||
* IN FORMAT REGEX
|
||||
*
|
||||
* This allows the registry to piece back together a URL based on the template regex
|
||||
* So, for example: "/user/(\d+?)/", 'matches' => array( array( 'showuser' => '$1' ) )tells IP.Board to populate 'showuser' with the result
|
||||
* of the parenthesis capture #1
|
||||
*/
|
||||
$_SEOTEMPLATES = array(
|
||||
|
||||
'section=register' => array( 'app' => 'core',
|
||||
'allowRedirect' => 0,
|
||||
'out' => array( '#app=core(&|&)module=global(&|&)section=register(&|&|$)#i', 'register/$3' ),
|
||||
'in' => array( 'regex' => "#/register/?(.+?)?$#i",
|
||||
'matches' => array( array( 'app', 'core' ), array( 'module', 'global' ), array( 'section', 'register' ) ) ) ),
|
||||
|
||||
'section=rss' => array( 'app' => 'core',
|
||||
'allowRedirect' => 0,
|
||||
'out' => array( '#app=core(&|&)module=global(&|&)section=rss(&|&)type=(\w+?)$#i', 'rss/$4/' ),
|
||||
'in' => array( 'regex' => "#/rss/(\w+?)/$#i",
|
||||
'matches' => array( array( 'app', 'core' ), array( 'module', 'global' ), array( 'section', 'rss' ), array( 'type', '$1' ) ) ) ),
|
||||
|
||||
'section=rss2' => array( 'app' => 'core',
|
||||
'allowRedirect' => 0,
|
||||
'out' => array( '#app=core(&|&)module=global(&|&)section=rss(&|&)type=(\w+?)(&|&)id=(\d+?)$#i', 'rss/$4/$6-#{__title__}/' ),
|
||||
'in' => array( 'regex' => "#/rss/(\w+?)/(\d+?)-#i",
|
||||
'matches' => array( array( 'app', 'core' ), array( 'module', 'global' ), array( 'section', 'rss' ), array( 'type', '$1' ), array( 'id', '$2' ) ) ) ),
|
||||
|
||||
#http://81.98.113.31/invisionboard3/index.php?app=core&module=global§ion=rss&type=forums&id=1
|
||||
);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* RSS output plugin :: report center
|
||||
* Last Updated: $Date: 2009-03-12 13:47:14 -0400 (Thu, 12 Mar 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 6/24/2008
|
||||
* @version $Revision: 4206 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class rss_output_core
|
||||
{
|
||||
/**
|
||||
* Expiration date
|
||||
*
|
||||
* @access private
|
||||
* @var integer Expiration timestamp
|
||||
*/
|
||||
private $expires = 0;
|
||||
|
||||
/**
|
||||
* Grab the RSS links
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getRssLinks()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// As this is member specific, hardcoded
|
||||
// into output library
|
||||
//-----------------------------------------
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab the RSS document content and return it
|
||||
*
|
||||
* @access public
|
||||
* @return string RSS document
|
||||
*/
|
||||
public function returnRSSDocument()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$member_id = intval( ipsRegistry::$request['member_id'] );
|
||||
$secure_key = IPSText::md5Clean( ipsRegistry::$request['rss_key'] );
|
||||
$rss_data = array();
|
||||
$to_print = '';
|
||||
|
||||
if( $secure_key and $member_id )
|
||||
{
|
||||
if( $member_id == ipsRegistry::member()->getProperty('member_id') )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get RSS export
|
||||
//-----------------------------------------
|
||||
|
||||
$rss_data = ipsRegistry::DB()->buildAndFetch( array( 'select' => 'rss_cache',
|
||||
'from' => 'rc_modpref',
|
||||
'where' => "mem_id=" . $member_id . " AND rss_key='" . $secure_key . "'" ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Got one?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $rss_data['rss_cache'] )
|
||||
{
|
||||
return $rss_data['rss_cache'];
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Create a dummy one
|
||||
//-----------------------------------------
|
||||
|
||||
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'public_reports' ), 'core' );
|
||||
|
||||
require_once( IPS_KERNEL_PATH . 'classRss.php' );
|
||||
$rss = new classRss();
|
||||
$channel_id = $rss->createNewChannel( array( 'title' => ipsRegistry::getClass('class_localization')->words['rss_feed_title'],
|
||||
'link' => ipsRegistry::$settings['board_url'],
|
||||
'description' => ipsRegistry::getClass('class_localization')->words['reports_rss_desc'],
|
||||
'pubDate' => $rss->formatDate( time() )
|
||||
) );
|
||||
$rss->createRssDocument();
|
||||
|
||||
return $rss->rss_document;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab the RSS document expiration timestamp
|
||||
*
|
||||
* @access public
|
||||
* @return integer Expiration timestamp
|
||||
*/
|
||||
public function grabExpiryDate()
|
||||
{
|
||||
return time() + 3600;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Formats help file search results
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4948 $
|
||||
**/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class coreSearchDisplay implements iSearchDisplay
|
||||
{
|
||||
/**
|
||||
* The search plugin for this app
|
||||
*
|
||||
* @access public
|
||||
* @var object
|
||||
*/
|
||||
public $search_plugin;
|
||||
|
||||
/**
|
||||
* Formats the member search result for display
|
||||
*
|
||||
* @access public
|
||||
* @param array $search_row Array of data from search_index
|
||||
* @return string Formatted content, ready for display
|
||||
**/
|
||||
public function formatContent( $search_row )
|
||||
{
|
||||
return ipsRegistry::getClass( 'output' )->getTemplate( 'search' )->helpSearchResult( $search_row, $this->search_plugin->onlyTitles );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retuns the html for displaying the member filter on the advanced search page
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
**/
|
||||
public function getFilterHTML()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifies the SQL query
|
||||
*
|
||||
* @access public
|
||||
* @param array
|
||||
* @return array
|
||||
**/
|
||||
public function buildFilterSQL( $data )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,387 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Basic Help Files Search
|
||||
* Last Updated: $Date: 2009-01-09 15:37:32 -0500 (Fri, 09 Jan 2009) $
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 3627 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class searchCorePlugin implements iSearchIndexPlugin
|
||||
{
|
||||
/**
|
||||
* Database object
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $DB;
|
||||
|
||||
/**
|
||||
* Date range restriction start
|
||||
*
|
||||
* @access private
|
||||
* @var integer
|
||||
*/
|
||||
private $search_begin_timestamp = 0;
|
||||
|
||||
/**
|
||||
* Date range restriction end
|
||||
*
|
||||
* @access private
|
||||
* @var integer
|
||||
*/
|
||||
private $search_end_timestamp = 0;
|
||||
|
||||
/**
|
||||
* Array of conditions for this search
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $whereConditions = array();
|
||||
|
||||
/**
|
||||
* Remoe self from search results
|
||||
*
|
||||
* @access public
|
||||
* @var boolean
|
||||
*/
|
||||
public $removeSelf = false;
|
||||
|
||||
/**
|
||||
* Only display title
|
||||
*
|
||||
* @access public
|
||||
* @var boolean
|
||||
*/
|
||||
public $onlyTitles = false;
|
||||
|
||||
/**
|
||||
* Setup registry objects
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry $registry
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->DB = $registry->DB();
|
||||
$this->member = $registry->member();
|
||||
$this->memberData =& $registry->member()->fetchMemberData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs search and returns an array of results
|
||||
*
|
||||
* @access public
|
||||
* @param string $search_term
|
||||
* @param array $limit_clause The erray should be array( begin, end )
|
||||
* @param string $sort_by Column to sort by
|
||||
* @param string $group_by Column to group by
|
||||
* @param bool $content_title_only Only search title records
|
||||
* @return array
|
||||
*/
|
||||
public function getSearchResults( $search_term, $limit_clause, $sort_by, $group_by='', $content_title_only=false, $sort_order='' )
|
||||
{
|
||||
/* User prefs */
|
||||
$order_dir = ( $sort_order == 'asc' ) ? 'asc' : 'desc';
|
||||
|
||||
/* Group By */
|
||||
if( $group_by )
|
||||
{
|
||||
$group_by = 'h.' . $group_by;
|
||||
}
|
||||
|
||||
/* Do the search */
|
||||
$this->DB->build( array(
|
||||
'select' => "h.*",
|
||||
'from' => array( 'faq' => 'h' ),
|
||||
'where' => $this->_buildWhereStatement( $search_term, $content_title_only ),
|
||||
'limit' => $limit_clause,
|
||||
'order' => 'h.id ' . $order_dir,
|
||||
'group' => $group_by,
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'i.*',
|
||||
'from' => array( 'permission_index' => 'i' ),
|
||||
'where' => "i.perm_type='help' AND i.perm_type_id=1",
|
||||
'type' => 'left',
|
||||
),
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
/* Build result array */
|
||||
$rows = array();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
/* Reassign stuff to match the search_index */
|
||||
$rows[] = $this->formatFieldsForIndex( $r );
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs live search and returns an array of results
|
||||
* NOT AVAILABLE IN BASIC SEARCH
|
||||
*
|
||||
* @access public
|
||||
* @param string $search_term
|
||||
* @return array
|
||||
*/
|
||||
public function getLiveSearchResults( $search_term )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the total number of results the search will return
|
||||
*
|
||||
* @access public
|
||||
* @param string $search_term Search term
|
||||
* @param string $group_by Column to group by
|
||||
* @param bool $content_title_only Only search title records
|
||||
* @return integer
|
||||
*/
|
||||
public function getSearchCount( $search_term, $group_by='', $content_title_only=false )
|
||||
{
|
||||
/* Group By */
|
||||
if( $group_by )
|
||||
{
|
||||
$group_by = 'h.' . $group_by;
|
||||
}
|
||||
|
||||
/* Query the count */
|
||||
$this->DB->build( array(
|
||||
'select' => 'COUNT(*) as total_results',
|
||||
'from' => array( 'faq' => 'h' ),
|
||||
'where' => $this->_buildWhereStatement( $search_term, $content_title_only ),
|
||||
'group' => $group_by,
|
||||
'add_join' => array(
|
||||
array(
|
||||
'from' => array( 'permission_index' => 'i' ),
|
||||
'where' => "i.perm_type='help' AND i.perm_type_id=1",
|
||||
'type' => 'left',
|
||||
),
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
$search = $this->DB->fetch();
|
||||
|
||||
/* Return the count */
|
||||
return $search['total_results'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Restrict the date range that the search is performed on
|
||||
*
|
||||
* @access public
|
||||
* @param int $begin Start timestamp
|
||||
* @param int [$end] End timestamp
|
||||
* @return void
|
||||
*/
|
||||
public function setDateRange( $begin, $end=0 )
|
||||
{
|
||||
$this->search_begin_timestamp = $begin;
|
||||
$this->search_end_timestamp = $end;
|
||||
}
|
||||
|
||||
/**
|
||||
* mySQL function for adding special search conditions
|
||||
*
|
||||
* @access public
|
||||
* @param string $column sql table column for this condition
|
||||
* @param string $operator Operation to perform for this condition, ex: =, <>, IN, NOT IN
|
||||
* @param mixed $value Value to check with
|
||||
* @param string $comp Comparison type
|
||||
* @return void
|
||||
*/
|
||||
public function setCondition( $column, $operator, $value, $comp='AND' )
|
||||
{
|
||||
/* Remap */
|
||||
return;
|
||||
|
||||
/* Build the condition based on operator */
|
||||
switch( strtoupper( $operator ) )
|
||||
{
|
||||
case 'IN':
|
||||
case 'NOT IN':
|
||||
$this->whereConditions[$comp][] = "h.{$column} {$operator} ( {$value} )";
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->whereConditions[$comp][] = "h.{$column} {$operator} {$value}";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows you to specify multiple conditions that are chained together
|
||||
*
|
||||
* @access public
|
||||
* @param array $conditions Array of conditions, each element has 3 keys: column, operator, value, see the setCondition function for information on each
|
||||
* @param string $inner_comp Comparison operator to use inside the chain
|
||||
* @param string $outer_comp Comparison operator to use outside the chain
|
||||
* @return void
|
||||
*/
|
||||
public function setMultiConditions( $conditions, $inner_comp='OR', $outer_comp='AND' )
|
||||
{
|
||||
return;
|
||||
|
||||
/* Loop through the conditions to build the statement */
|
||||
$_temp = array();
|
||||
|
||||
foreach( $conditions as $r )
|
||||
{
|
||||
switch( strtoupper( $r['operator'] ) )
|
||||
{
|
||||
case 'IN':
|
||||
case 'NOT IN':
|
||||
$_temp[] = "h.{$r['column']} {$r['operator']} ( {$r['value']} )";
|
||||
break;
|
||||
|
||||
default:
|
||||
$_temp[] = "h.{$r['column']} {$r['operator']} {$r['value']}";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->whereConditions[$outer_comp][] = '( ' . implode( $_temp, ' ' . $inner_comp . ' ' ) . ' ) ';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set search conditions for "View unread content"
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function setUnreadConditions()
|
||||
{
|
||||
$this->removeSelf = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the where portion of a search string
|
||||
*
|
||||
* @access private
|
||||
* @param string $search_term The string to use in the search
|
||||
* @param bool $content_title_only Search only title records
|
||||
* @return string
|
||||
**/
|
||||
private function _buildWhereStatement( $search_term, $content_title_only=false )
|
||||
{
|
||||
/* INI */
|
||||
$where_clause = array();
|
||||
|
||||
if( $search_term )
|
||||
{
|
||||
if( $content_title_only )
|
||||
{
|
||||
$where_clause[] = "h.title LIKE '%{$search_term}%'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$where_clause[] = "h.title LIKE '%{$search_term}%' OR h.text LIKE '%{$search_term}%' OR h.description LIKE '%{$search_term}%'";
|
||||
}
|
||||
}
|
||||
|
||||
/* Add in AND where conditions */
|
||||
if( isset( $this->whereConditions['AND'] ) && count( $this->whereConditions['AND'] ) )
|
||||
{
|
||||
$where_clause = array_merge( $where_clause, $this->whereConditions['AND'] );
|
||||
}
|
||||
|
||||
/* ADD in OR where conditions */
|
||||
if( isset( $this->whereConditions['OR'] ) && count( $this->whereConditions['OR'] ) )
|
||||
{
|
||||
$where_clause[] = '( ' . implode( ' OR ', $this->whereConditions['OR'] ) . ' )';
|
||||
}
|
||||
|
||||
/* Permissions */
|
||||
$where_clause[] = $this->DB->buildRegexp( "i.perm_view", $this->member->perm_id_array );
|
||||
|
||||
/* Build and return the string */
|
||||
return implode( " AND ", $where_clause );
|
||||
}
|
||||
|
||||
/**
|
||||
* Reassigns fields in a way the index exepcts
|
||||
*
|
||||
* @param array $r
|
||||
* @return array
|
||||
**/
|
||||
public function formatFieldsForIndex( $r )
|
||||
{
|
||||
$r['app'] = 'core';
|
||||
$r['content'] = $r['title'];
|
||||
$r['content_title'] = $r['description'];
|
||||
$r['updated'] = time();
|
||||
$r['type_2'] = 'help';
|
||||
$r['type_id_2'] = $r['id'];
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function grabs the actual results for display
|
||||
*
|
||||
* @param array $ids
|
||||
* @return query result
|
||||
**/
|
||||
public function getResultsForSphinx( $ids )
|
||||
{
|
||||
$this->DB->build( array(
|
||||
'select' => "h.*",
|
||||
'from' => array( 'faq' => 'h' ),
|
||||
'where' => 'h.id IN( ' . implode( ',', $ids ) . ')',
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'i.*',
|
||||
'from' => array( 'permission_index' => 'i' ),
|
||||
'where' => "i.perm_type='help' AND i.perm_type_id=1",
|
||||
'type' => 'left',
|
||||
),
|
||||
)
|
||||
) );
|
||||
return $this->DB->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of the field this search index uses for dates.... >_<
|
||||
*
|
||||
* @return string
|
||||
**/
|
||||
public function getDateField()
|
||||
{
|
||||
return 'search_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets field names for other conditions
|
||||
*
|
||||
* @param string Column
|
||||
* @return string
|
||||
**/
|
||||
public function getConditionField( $column )
|
||||
{
|
||||
return $column;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Sphinx template file
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4948 $
|
||||
* @since 3.0.0
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
$appSphinxTemplate = <<<EOF
|
||||
|
||||
############################### --- CORE --- ################################
|
||||
|
||||
source core_search_main : ipb_source_config
|
||||
{
|
||||
# Set our forum PID counter
|
||||
sql_query_pre = REPLACE INTO <!--SPHINX_DB_PREFIX-->cache_store VALUES( 'sphinx_core_counter', (SELECT max(id) FROM <!--SPHINX_DB_PREFIX-->faq), '', 0, UNIX_TIMESTAMP() )
|
||||
|
||||
# Query posts for the main source
|
||||
sql_query = SELECT f.*, f.id as search_id, \
|
||||
REPLACE( pi.perm_view, '*', 0 ) as perm_view \
|
||||
FROM <!--SPHINX_DB_PREFIX-->faq f \
|
||||
LEFT JOIN <!--SPHINX_DB_PREFIX-->permission_index pi ON ( pi.perm_type_id=1 AND pi.perm_type='help' ) \
|
||||
WHERE f.id <= ( SELECT cs_value FROM <!--SPHINX_DB_PREFIX-->cache_store WHERE cs_key='sphinx_core_counter' )
|
||||
|
||||
# Fields
|
||||
sql_attr_uint = search_id
|
||||
|
||||
sql_ranged_throttle = 0
|
||||
}
|
||||
|
||||
source core_search_delta : core_search_main
|
||||
{
|
||||
# Override the base sql_query_pre
|
||||
sql_query_pre =
|
||||
|
||||
# Query posts for the main source
|
||||
sql_query = SELECT f.*, f.id as search_id, \
|
||||
REPLACE( pi.perm_view, '*', 0 ) as perm_view \
|
||||
FROM <!--SPHINX_DB_PREFIX-->faq f \
|
||||
LEFT JOIN <!--SPHINX_DB_PREFIX-->permission_index pi ON ( pi.perm_type_id=1 AND pi.perm_type='help' ) \
|
||||
WHERE f.id > ( SELECT cs_value FROM <!--SPHINX_DB_PREFIX-->cache_store WHERE cs_key='sphinx_core_counter' )
|
||||
|
||||
# Fields
|
||||
sql_attr_uint = search_id
|
||||
|
||||
sql_ranged_throttle = 0
|
||||
}
|
||||
|
||||
index core_search_main
|
||||
{
|
||||
source = core_search_main
|
||||
path = <!--SPHINX_BASE_PATH-->/core_search_main
|
||||
|
||||
docinfo = extern
|
||||
mlock = 0
|
||||
morphology = none
|
||||
min_word_len = 2
|
||||
charset_type = sbcs
|
||||
html_strip = 0
|
||||
}
|
||||
|
||||
index core_search_delta : core_search_main
|
||||
{
|
||||
source = core_search_delta
|
||||
path = <!--SPHINX_BASE_PATH-->/core_search_delta
|
||||
}
|
||||
|
||||
|
||||
EOF;
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,43 @@
|
||||
/************************************************/
|
||||
/* IPB3 Javascript */
|
||||
/* -------------------------------------------- */
|
||||
/* ips.global.js - Global functionality */
|
||||
/* (c) IPS, Inc 2008 */
|
||||
/* -------------------------------------------- */
|
||||
/* Author: Rikki Tissier */
|
||||
/************************************************/
|
||||
|
||||
ACPEasyLogo = {
|
||||
init: function()
|
||||
{
|
||||
Debug.write("Initializing acp.easylogo.js");
|
||||
|
||||
document.observe("dom:loaded", function(){
|
||||
$('skin').observe( "change", ACPEasyLogo.resetMacro );
|
||||
});
|
||||
},
|
||||
|
||||
resetMacro: function(e)
|
||||
{
|
||||
var value = $F('skin');
|
||||
|
||||
//Get hits
|
||||
new Ajax.Request(
|
||||
ipb.vars['base_url'] + "app=core&module=ajax§ion=replacements&do=retrieve&secure_key=" + ipb.vars['md5_hash'] + "&value=" + value ,
|
||||
{
|
||||
method: 'get',
|
||||
evalJSON: 'force',
|
||||
onSuccess: function(t){
|
||||
if ( t.responseJSON['url'] )
|
||||
{
|
||||
$('logo_url').value = t.responseJSON['url'];
|
||||
$('replacementId').value = t.responseJSON['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
ACPEasyLogo.init();
|
||||
@@ -0,0 +1,35 @@
|
||||
/************************************************/
|
||||
/* IPB3 Javascript */
|
||||
/* -------------------------------------------- */
|
||||
/* acp.homepage.js - Homepage javascript */
|
||||
/* (c) IPS, Inc 2008 */
|
||||
/* -------------------------------------------- */
|
||||
/* Author: Brandon Farber */
|
||||
/************************************************/
|
||||
|
||||
ACPHomepage = {
|
||||
|
||||
/*------------------------------*/
|
||||
/* Constructor */
|
||||
init: function()
|
||||
{
|
||||
Debug.write("Initializing acp.homepage.js");
|
||||
|
||||
document.observe("dom:loaded", function(){
|
||||
ACPHomepage.autoComplete = new ipb.Autocomplete( $('members_display_name'), { multibox: false, url: acp.autocompleteUrl, templates: { wrap: acp.autocompleteWrap, item: acp.autocompleteItem } } );
|
||||
});
|
||||
},
|
||||
|
||||
editMember: function()
|
||||
{
|
||||
if ( $('members_display_name').value == "" )
|
||||
{
|
||||
alert("Нужно ввести имя пользователя!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
ACPHomepage.init();
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,412 @@
|
||||
/**
|
||||
* INVISION POWER BOARD v3
|
||||
*
|
||||
* Topics View Javascript File
|
||||
* @author Matt Mecham, Brandon Farber, Josh Williams
|
||||
* @since 2008
|
||||
*/
|
||||
|
||||
/**
|
||||
* "ACP" Class. Designed for ... ACP CSS Functions
|
||||
* @author (v.1.0.0) Matt Mecham
|
||||
*/
|
||||
|
||||
function IPBCSS()
|
||||
{
|
||||
/**
|
||||
* Template groups
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
this.CSSData = {};
|
||||
|
||||
/**
|
||||
* Current template bit
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
this.currentCSS = '';
|
||||
|
||||
/**
|
||||
* Current set ID
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
this.currentSetData = {};
|
||||
|
||||
/**
|
||||
* CSS Names
|
||||
*
|
||||
* @var hash
|
||||
*/
|
||||
this.cssNames = {
|
||||
'cssRow' : 'tablerow2',
|
||||
'cssHover' : 'cssHover' };
|
||||
|
||||
|
||||
/**
|
||||
* INIT Applications
|
||||
*/
|
||||
this.init = function()
|
||||
{
|
||||
/* Build CSS list */
|
||||
this.buildCSSList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load css groups
|
||||
*/
|
||||
this.loadCSSGroups = function()
|
||||
{
|
||||
/* Grab the JSON for the template bits for the current template group */
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=css&do=getCSSGroups&setID=" + this.currentSetData['set_id'] + '&secure_key=' + ipb.vars['md5_hash'];
|
||||
|
||||
new Ajax.Request( url.replace( /&/g, '&' ),
|
||||
{
|
||||
method: 'GET',
|
||||
onSuccess: function (t )
|
||||
{
|
||||
if ( t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
$('tplate_debug').innerHTML += "\n" + t.responseText;
|
||||
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( json['error'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3CSS.CSSData = json;
|
||||
IPB3CSS.buildCSSList();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Исключение: " + e ) },
|
||||
onFailure: function( t ){ alert( "Ошибка: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Save CSS
|
||||
*/
|
||||
this.saveCSS = function( css_id )
|
||||
{
|
||||
/* Grab the JSON for the template bits for the current template group */
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=css&do=saveCSS&setID=" + this.currentSetData['set_id'] + '&css_id=' + css_id + '&secure_key=' + ipb.vars['md5_hash'];
|
||||
|
||||
/* Set up params */
|
||||
var params = { 'css_content' : $F('tplate_editBox_' + css_id ),
|
||||
'css_position' : $F('tplate_posBox_' + css_id ),
|
||||
'css_set_id' : this.currentSetData['set_id'],
|
||||
'_css_group' : $F('tplate_groupBox_' + css_id ),
|
||||
'type' : ( css_id == 0 ) ? 'add' : 'edit' };
|
||||
|
||||
|
||||
new Ajax.Request( url.replace( /&/g, '&' ),
|
||||
{
|
||||
method: 'POST',
|
||||
parameters: params,
|
||||
onSuccess: function (t )
|
||||
{
|
||||
if ( t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( json['error'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3CSS.currentCSS = json['cssData'];
|
||||
IPB3CSS.showCSSEditor( json );
|
||||
IPB3CSS.loadCSSGroups();
|
||||
|
||||
if ( json['errors'] )
|
||||
{
|
||||
/* Something inline would be very nice here.. rather than this ugly alert */
|
||||
alert("Ошибка: " + json['errors'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("Сохранено!");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Галектеко ОПАСНОСТЕ! ПЫЩПЫЩ!11: " + t.responseText );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Исключение: " + e ) },
|
||||
onFailure: function( t ){ alert( "Ошибка: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Revert css
|
||||
*/
|
||||
this.revertCSS = function( css_id )
|
||||
{
|
||||
/* Make sure we're mean it... */
|
||||
if ( $('tplate_cssRow_' + css_id ).hasClassName( 'tplateRow_new') )
|
||||
{
|
||||
if ( ! confirm( "Удалить CSS файл ?\nФайл будет удален из ВСЕХ стилей!" ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! confirm( "Отменить изменения в CSS файле ?\nВсе изменения будут утеряны!" ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Grab the JSON for the template bits for the current template group */
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=css&do=revertCSS&setID=" + this.currentSetData['set_id'] + '&css_id=' + css_id + '&secure_key=' + ipb.vars['md5_hash'];
|
||||
|
||||
new Ajax.Request( url.replace( /&/g, '&' ),
|
||||
{
|
||||
method: 'GET',
|
||||
onSuccess: function (t )
|
||||
{
|
||||
if ( t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( json['error'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3CSS.loadCSSGroups();
|
||||
|
||||
if ( json['errors'] )
|
||||
{
|
||||
/* Something inline would be very nice here.. rather than this ugly alert */
|
||||
alert("Я СКАЗАЛ: " + json['errors'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Галектеко ОПАСНОСТЕ! ПЫЩПЫЩ!11: " + t.responseText );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Исключение: " + e ) },
|
||||
onFailure: function( t ){ alert( "Ошибка: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load template bits
|
||||
*/
|
||||
this.loadCSSEditor = function( css_id )
|
||||
{
|
||||
/* Grab the JSON for the template bits for the current template group */
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=css&do=getCSSForEdit&setID=" + this.currentSetData['set_id'] + '&css_id=' + css_id + '&secure_key=' + ipb.vars['md5_hash'];
|
||||
|
||||
new Ajax.Request( url.replace( /&/g, '&' ),
|
||||
{
|
||||
method: 'GET',
|
||||
onSuccess: function (t )
|
||||
{
|
||||
if ( t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( json['error'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3CSS.showCSSEditor( json );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Галектеко ОПАСНОСТЕ! ПЫЩПЫЩ!11: " + t.responseText );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Исключение: " + e ) },
|
||||
onFailure: function( t ){ alert( "Ошибка: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add CSS form
|
||||
*/
|
||||
this.addCSSForm = function()
|
||||
{
|
||||
IPB3CSS.showCSSEditor( { 'cssData' : { 'css_id' : 0, 'css_group' : '', 'css_content' : '', 'css_added_to' : 0, '_type' : 'new' } } );
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the template editor
|
||||
*/
|
||||
this.showCSSEditor = function( json )
|
||||
{
|
||||
/* Close any open editors */
|
||||
IPB3CSS.cancelCSS( json['cssData']['css_id'] );
|
||||
|
||||
var _tplate = new Template( $('tplate_cssEditor').innerHTML );
|
||||
|
||||
IPB3CSS.currentCSS = json['cssData'];
|
||||
|
||||
var _div = document.createElement( "DIV" );
|
||||
_div.id = 'tplate_editorWrapper';
|
||||
_div.update( _tplate.evaluate( json['cssData'] ) );
|
||||
document.body.appendChild( _div );
|
||||
|
||||
/* New? */
|
||||
if ( json['cssData']['_type'] == 'new' || ( json['cssData']['css_added_to'] == IPB3CSS.currentSetData['set_id'] ) )
|
||||
{
|
||||
$( 'tplate_groupBoxWrap_' + json['cssData']['css_id'] ).show();
|
||||
}
|
||||
|
||||
ipb.positionCenter( 'tplate_editor_' + json['cssData']['css_id'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the template editor
|
||||
*/
|
||||
this.cancelCSS = function( cssID )
|
||||
{
|
||||
/*if ( ! confirm( "All unsaved changes will be lost!" ) )
|
||||
{
|
||||
return false;
|
||||
}*/
|
||||
|
||||
try
|
||||
{
|
||||
$('tplate_editorWrapper').remove();
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a list of CSS groups (files)
|
||||
*/
|
||||
this.buildCSSList = function()
|
||||
{
|
||||
/* INIT */
|
||||
var _output = '';
|
||||
var _tplate = new Template( $('tplate_cssRow').innerHTML );
|
||||
var json = IPB3CSS.CSSData;
|
||||
|
||||
var _groups = Object.keys( json['css'] ).sort( function(a,b) { return a-b; } );
|
||||
|
||||
/* Clear out any current listing */
|
||||
$('tplate_cssList').update('');
|
||||
|
||||
/* Format... */
|
||||
_groups.each( function( i )
|
||||
{
|
||||
/* Inline deleted? */
|
||||
if ( ! json['css'][i]['_deleted'] )
|
||||
{
|
||||
/* Figure out if this in an inherited row, a changed row, a new row or a default row */
|
||||
if ( json['css'][i]['css_added_to'] == IPB3CSS.currentSetData['set_id'] )
|
||||
{
|
||||
/* This is a modified row */
|
||||
json['css'][i]['_cssState'] = 'new';
|
||||
json['css'][i]['_cssClass'] = 'tplateRow_new';
|
||||
}
|
||||
else if ( json['css'][i]['css_set_id'] == IPB3CSS.currentSetData['set_id'] )
|
||||
{
|
||||
/* This is a modified row */
|
||||
json['css'][i]['_cssState'] = 'modified';
|
||||
json['css'][i]['_cssClass'] = 'tplateRow_mod';
|
||||
}
|
||||
else if ( IPB3CSS.currentSetData['_parentTree'].indexOf( json['css'][i]['css_set_id'] ) != -1 )
|
||||
{
|
||||
/* Inherited */
|
||||
json['css'][i]['_cssState'] = 'inherit';
|
||||
json['css'][i]['_cssClass'] = 'tplateRow_inh';
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is a default row */
|
||||
json['css'][i]['_cssState'] = 'default';
|
||||
json['css'][i]['_cssClass'] = 'tplateRow_def';
|
||||
}
|
||||
|
||||
_output += _tplate.evaluate( json['css'][i] );
|
||||
}
|
||||
} );
|
||||
|
||||
/* Write it out */
|
||||
$('tplate_cssList').update( _output );
|
||||
|
||||
/* Post Process */
|
||||
_groups.each( function( i )
|
||||
{
|
||||
/* Inline deleted? */
|
||||
if ( ! json['css'][i]['_deleted'] )
|
||||
{
|
||||
if ( json['css'][i]['_cssState'] == 'new' )
|
||||
{
|
||||
$('tplate_cssRow_' + json['css'][i]['css_id'] + '_revert').update('Remove');
|
||||
}
|
||||
else if ( json['css'][i]['_cssState'] != 'default' )
|
||||
{
|
||||
$('tplate_cssRow_' + json['css'][i]['css_id'] + '_revert').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('tplate_cssRow_' + json['css'][i]['css_id'] + '_revert').hide();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Template Mouse Event
|
||||
*/
|
||||
this.mouseEvent = function( e )
|
||||
{
|
||||
if ( _div = $( Event.element( e ) ).up( '.' + IPB3CSS.cssNames['cssRow'] ) )
|
||||
{
|
||||
var _css_id = _div.id.replace( 'tplate_cssRow_', '' );
|
||||
|
||||
if ( e.type == 'mouseover' )
|
||||
{
|
||||
_div.addClassName( IPB3CSS.cssNames['cssHover'] );
|
||||
}
|
||||
else if ( e.type == 'mouseout' )
|
||||
{
|
||||
_div.removeClassName( IPB3CSS.cssNames['cssHover'] );
|
||||
}
|
||||
else if ( e.type == 'click' )
|
||||
{
|
||||
var _el = Event.findElement( e, 'div' ).id;
|
||||
|
||||
if ( _el.endsWith('_revert' ) )
|
||||
{
|
||||
IPB3CSS.revertCSS( _css_id );
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3CSS.loadCSSEditor( _css_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
|
||||
function addAnotherFile()
|
||||
{
|
||||
elementIndex = parseInt(elementIndex) + 1;
|
||||
|
||||
var list = new Element( 'ul', { 'id': 'fileTable_' + elementIndex } );
|
||||
list.addClassName( 'acp-form' );
|
||||
list.addClassName( 'alternate_rows' );
|
||||
$('fileTableContainer').insert( list );
|
||||
|
||||
var li1 = new Element( 'li' ).update( "<label>" + ipb.lang['hook_filename'] + "</label><input type='text' name='file[" + elementIndex + "]' value='' size='50' class='inputtext' />" );
|
||||
var li2 = new Element( 'li' ).update( "<label>" + ipb.lang['hook_classname'] + "</label><input type='text' name='hook_classname[" + elementIndex + "]' value='' size='50' class='inputtext' />" );
|
||||
var li3 = new Element( 'li' ).update( "<label>" + ipb.lang['hook_filetype'] + "</label><select name='hook_type[" + elementIndex + "]' id='hook_type[" + elementIndex + "]' onchange='selectHookType(" + elementIndex + ");'><option value='0'>" + ipb.lang['hook_filetype_select'] + "</option><option value='commandHooks'>" + ipb.lang['hook_filetype_action'] + "</option><option value='skinHooks'>" + ipb.lang['hook_filetype_skin'] + "</option><option value='templateHooks'>" + ipb.lang['hook_filetype_template'] + "</option></select>" );
|
||||
|
||||
$('fileTable_' + elementIndex).insert( li1 );
|
||||
$('fileTable_' + elementIndex).insert( li2 );
|
||||
$('fileTable_' + elementIndex).insert( li3 );
|
||||
}
|
||||
|
||||
function selectHookType( elementIndex )
|
||||
{
|
||||
var type = $F('hook_type[' + elementIndex + ']');
|
||||
|
||||
if( $('tr_classToOverload[' + elementIndex + ']') != null )
|
||||
{
|
||||
$('tr_classToOverload[' + elementIndex + ']').remove();
|
||||
}
|
||||
|
||||
if( $('tr_skinGroup[' + elementIndex + ']') != null )
|
||||
{
|
||||
$('tr_skinGroup[' + elementIndex + ']').remove();
|
||||
}
|
||||
|
||||
if( $('tr_skinFunction[' + elementIndex + ']') != null )
|
||||
{
|
||||
$('tr_skinFunction[' + elementIndex + ']').remove();
|
||||
}
|
||||
|
||||
if( $('tr_type[' + elementIndex + ']') != null )
|
||||
{
|
||||
$('tr_type[' + elementIndex + ']').remove();
|
||||
}
|
||||
|
||||
if( $('tr_id[' + elementIndex + ']') != null )
|
||||
{
|
||||
$('tr_id[' + elementIndex + ']').remove();
|
||||
}
|
||||
|
||||
if( $('tr_position[' + elementIndex + ']') != null )
|
||||
{
|
||||
$('tr_position[' + elementIndex + ']').remove();
|
||||
}
|
||||
|
||||
if( type == 'templateHooks' )
|
||||
{
|
||||
// Show the skin dropdown now
|
||||
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=hooks&do=getGroupsForAdd&secure_key=" + ipb.vars['md5_hash'] + "&i=" + elementIndex;
|
||||
url = url.replace( /&/g, '&' );
|
||||
|
||||
new Ajax.Request( url,
|
||||
{
|
||||
method: 'GET',
|
||||
onSuccess: function (t )
|
||||
{
|
||||
li1 = new Element( 'li', { 'id': 'tr_skinGroup[' + elementIndex + ']' } ).update( "<label>" + ipb.lang['hook_skingroup'] + "</label>" + t.responseText );
|
||||
$('fileTable_' + elementIndex).insert( li1 );
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
else if( type != '0' )
|
||||
{
|
||||
// Show the classToOverload field
|
||||
|
||||
var li1 = new Element( 'li', { 'id': 'tr_classToOverload[' + elementIndex + ']' } ).update( "<label>" + ipb.lang['hook_extends'] + "</label><input type='text' name='classToOverload[" + elementIndex + "]' value='' size='50' class='inputtext' />" );
|
||||
$('fileTable_' + elementIndex).insert( li1 );
|
||||
}
|
||||
}
|
||||
|
||||
function getTemplatesForAdd( elementIndex )
|
||||
{
|
||||
var type = $F('skinGroup[' + elementIndex + ']');
|
||||
|
||||
if( $('tr_skinFunction[' + elementIndex + ']') != null )
|
||||
{
|
||||
$('tr_skinFunction[' + elementIndex + ']').remove();
|
||||
}
|
||||
|
||||
if( $('tr_type[' + elementIndex + ']') != null )
|
||||
{
|
||||
$('tr_type[' + elementIndex + ']').remove();
|
||||
}
|
||||
|
||||
if( $('tr_id[' + elementIndex + ']') != null )
|
||||
{
|
||||
$('tr_id[' + elementIndex + ']').remove();
|
||||
}
|
||||
|
||||
if( $('tr_position[' + elementIndex + ']') != null )
|
||||
{
|
||||
$('tr_position[' + elementIndex + ']').remove();
|
||||
}
|
||||
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=hooks&do=getTemplatesForAdd&secure_key=" + ipb.vars['md5_hash'] + "&i=" + elementIndex + "&group=" + type;
|
||||
url = url.replace( /&/g, '&' );
|
||||
|
||||
new Ajax.Request( url,
|
||||
{
|
||||
method: 'GET',
|
||||
onSuccess: function (t )
|
||||
{
|
||||
li1 = new Element( 'li', { 'id': 'tr_skinFunction[' + elementIndex + ']' } ).update( "<label>" + ipb.lang['hook_skinfunc'] + "</label>" + t.responseText );
|
||||
$('fileTable_' + elementIndex).insert( li1 );
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
function getTypeOfHook( elementIndex )
|
||||
{
|
||||
var type = $F('skinFunction[' + elementIndex + ']');
|
||||
|
||||
if( $('tr_type[' + elementIndex + ']') != null )
|
||||
{
|
||||
$('tr_type[' + elementIndex + ']').remove();
|
||||
}
|
||||
|
||||
if( $('tr_id[' + elementIndex + ']') != null )
|
||||
{
|
||||
$('tr_id[' + elementIndex + ']').remove();
|
||||
}
|
||||
|
||||
if( $('tr_position[' + elementIndex + ']') != null )
|
||||
{
|
||||
$('tr_position[' + elementIndex + ']').remove();
|
||||
}
|
||||
|
||||
li1 = new Element( 'li', { 'id': 'tr_type[' + elementIndex + ']' } ).update( "<label>" + ipb.lang['hook_temptype'] + "</label><select name='type[" + elementIndex + "]' id='type[" + elementIndex + "]' onchange='getHookIds(" + elementIndex + ");'><option value='0'>" + ipb.lang['hook_filetype_select'] + "</option><option value='foreach'>foreach loop</option><option value='if'>if statement</option></select>" );
|
||||
$('fileTable_' + elementIndex).insert( li1 );
|
||||
}
|
||||
|
||||
function getHookIds( elementIndex )
|
||||
{
|
||||
var template = $F('skinFunction[' + elementIndex + ']');
|
||||
var type = $F('type[' + elementIndex + ']');
|
||||
|
||||
if( $('tr_id[' + elementIndex + ']') != null )
|
||||
{
|
||||
$('tr_id[' + elementIndex + ']').remove();
|
||||
}
|
||||
|
||||
if( $('tr_position[' + elementIndex + ']') != null )
|
||||
{
|
||||
$('tr_position[' + elementIndex + ']').remove();
|
||||
}
|
||||
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=hooks&do=getHookIds&secure_key=" + ipb.vars['md5_hash'] + "&i=" + elementIndex + "&type=" + type + "&template=" + template;
|
||||
url = url.replace( /&/g, '&' );
|
||||
|
||||
new Ajax.Request( url,
|
||||
{
|
||||
method: 'GET',
|
||||
onSuccess: function (t )
|
||||
{
|
||||
li1 = new Element( 'li', { 'id': 'tr_id[' + elementIndex + ']' } ).update( "<label>" + ipb.lang['hook_hookid'] + "</label>" + t.responseText );
|
||||
$('fileTable_' + elementIndex).insert( li1 );
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
function getHookEntryPoints( elementIndex )
|
||||
{
|
||||
var type = $F('type[' + elementIndex + ']');
|
||||
|
||||
if( $('tr_position[' + elementIndex + ']') != null )
|
||||
{
|
||||
$('tr_position[' + elementIndex + ']').remove();
|
||||
}
|
||||
|
||||
var options = '';
|
||||
options += "<option value='0'>" + ipb.lang['hook_filetype_select'] + "</option>";
|
||||
|
||||
if( type == 'foreach' )
|
||||
{
|
||||
options += "<option value='outer.pre'>(outer.pre) " + ipb.lang['a_outerpre'] + "</option>";
|
||||
options += "<option value='inner.pre'>(inner.pre) " + ipb.lang['a_innerpre'] + "</option>";
|
||||
options += "<option value='inner.post'>(inner.post) " + ipb.lang['a_innerpost']+ "</option>";
|
||||
options += "<option value='outer.post'>(outer.post) " + ipb.lang['a_outerpost']+ "</option>";
|
||||
}
|
||||
else
|
||||
{
|
||||
options += "<option value='pre.startif'>(pre.startif) " + ipb.lang['a_prestartif'] + "</option>";
|
||||
options += "<option value='post.startif'>(post.startif) " + ipb.lang['a_poststartif'] + "</option>";
|
||||
options += "<option value='pre.else'>(pre.else) " + ipb.lang['a_preelse'] + "</option>";
|
||||
options += "<option value='post.else'>(post.else) " + ipb.lang['a_postelse'] + "</option>";
|
||||
options += "<option value='pre.endif'>(pre.endif) " + ipb.lang['a_preendif'] + "</option>";
|
||||
options += "<option value='post.endif'>(post.endif) " + ipb.lang['a_postendif'] + "</option>";
|
||||
}
|
||||
|
||||
var li1 = new Element( 'li', { 'id': 'tr_position[' + elementIndex + ']' } ).update( "<label>" + ipb.lang['hook_temptype'] + "</label><select name='position[" + elementIndex + "]' id='position[" + elementIndex + "]'>" + options + "</select>" );
|
||||
$('fileTable_' + elementIndex).insert( li1 );
|
||||
}
|
||||
@@ -0,0 +1,447 @@
|
||||
/**
|
||||
* INVISION POWER BOARD v3
|
||||
*
|
||||
* Topics View Javascript File
|
||||
* @author Matt Mecham, Brandon Farber, Josh Williams
|
||||
* @since 2008
|
||||
*/
|
||||
|
||||
/**
|
||||
* "ACP" Class. Designed for ... ACP Replacements Functions
|
||||
* @author (v.1.0.0) Matt Mecham
|
||||
*/
|
||||
|
||||
function IPBReplacements()
|
||||
{
|
||||
/**
|
||||
* Template groups
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
this.ReplacementsData = {};
|
||||
|
||||
/**
|
||||
* Current template bit
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
this.currentReplacement = '';
|
||||
|
||||
/**
|
||||
* Current set ID
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
this.currentSetData = {};
|
||||
|
||||
/**
|
||||
* Replacements Names
|
||||
*
|
||||
* @var hash
|
||||
*/
|
||||
this.cssNames = {
|
||||
'replacementsRow' : 'tablerow2',
|
||||
'replacementsHover' : 'replacementsHover' };
|
||||
|
||||
|
||||
/**
|
||||
* INIT Applications
|
||||
*/
|
||||
this.init = function()
|
||||
{
|
||||
/* Build Replacements list */
|
||||
this.buildReplacementsList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load css groups
|
||||
*/
|
||||
this.loadReplacementsGroups = function()
|
||||
{
|
||||
/* Grab the JSON for the template bits for the current template group */
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=replacements&do=getReplacementsGroups&setID=" + this.currentSetData['set_id'] + '&secure_key=' + ipb.vars['md5_hash'];
|
||||
|
||||
new Ajax.Request( url.replace( /&/g, '&' ),
|
||||
{
|
||||
method: 'GET',
|
||||
onSuccess: function (t )
|
||||
{
|
||||
if ( t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
$('tplate_debug').innerHTML += "\n" + t.responseText;
|
||||
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( json['error'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3Replacements.ReplacementsData = json;
|
||||
IPB3Replacements.buildReplacementsList();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Replacements
|
||||
*/
|
||||
this.saveReplacement = function( replacement_id )
|
||||
{
|
||||
/* Grab the JSON for the template bits for the current template group */
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=replacements&do=saveReplacement&setID=" + this.currentSetData['set_id'] + '&replacement_id=' + replacement_id + '&secure_key=' + ipb.vars['md5_hash'];
|
||||
|
||||
/* Set up params */
|
||||
var params = { 'replacement_content' : $F('tplate_editBox_' + replacement_id ),
|
||||
'replacement_set_id' : this.currentSetData['set_id'],
|
||||
'_replacement_key' : $F('tplate_keyBox_' + replacement_id ),
|
||||
'type' : ( replacement_id == 0 ) ? 'add' : 'edit' };
|
||||
|
||||
|
||||
new Ajax.Request( url.replace( /&/g, '&' ),
|
||||
{
|
||||
method: 'POST',
|
||||
parameters: params,
|
||||
onSuccess: function (t )
|
||||
{
|
||||
if ( t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( json['error'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3Replacements.ReplacementsData = json;
|
||||
IPB3Replacements.buildReplacementsList();
|
||||
|
||||
if ( json['errors'] )
|
||||
{
|
||||
/* Something inline would be very nice here.. rather than this ugly alert */
|
||||
alert("Message: " + json['errors'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("Message: Saved!");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Revert css
|
||||
*/
|
||||
this.revertReplacement = function( replacement_id )
|
||||
{
|
||||
/* Make sure we're mean it... */
|
||||
if ( $('tplate_replacementsRow_' + replacement_id ).hasClassName( 'tplateRow_new') )
|
||||
{
|
||||
if ( ! confirm( "REMOVE Replacements file?\n This will remove this replacement in ALL skins!" ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! confirm( "Revert Replacements file?\n All changes WILL be lost!" ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Grab the JSON for the template bits for the current template group */
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=replacements&do=revertReplacement&setID=" + this.currentSetData['set_id'] + '&replacement_id=' + replacement_id + '&secure_key=' + ipb.vars['md5_hash'];
|
||||
|
||||
new Ajax.Request( url.replace( /&/g, '&' ),
|
||||
{
|
||||
method: 'GET',
|
||||
onSuccess: function (t )
|
||||
{
|
||||
if ( t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( json['error'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3Replacements.ReplacementsData = json;
|
||||
IPB3Replacements.buildReplacementsList();
|
||||
|
||||
if ( json['errors'] )
|
||||
{
|
||||
/* Something inline would be very nice here.. rather than this ugly alert */
|
||||
alert("Message: " + json['errors'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Replacements form
|
||||
*/
|
||||
this.addReplacementsForm = function()
|
||||
{
|
||||
IPB3Replacements.showReplacementsEditor( 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the template editor
|
||||
*/
|
||||
this.showReplacementsEditor = function( replacement_id )
|
||||
{
|
||||
/* Close any open editors */
|
||||
IPB3Replacements.cancelReplacements();
|
||||
|
||||
var _tplate = new Template( $('tplate_replacementsEditor').innerHTML );
|
||||
var _keys = Object.keys( IPB3Replacements.ReplacementsData['replacements'] ).sort();
|
||||
var _data = {};
|
||||
|
||||
/* Get replacement Data */
|
||||
if ( replacement_id )
|
||||
{
|
||||
_keys.each( function( i )
|
||||
{
|
||||
if ( IPB3Replacements.ReplacementsData['replacements'][ i ]['replacement_id'] == replacement_id )
|
||||
{
|
||||
_data = IPB3Replacements.ReplacementsData['replacements'][ i ];
|
||||
}
|
||||
} );
|
||||
}
|
||||
else
|
||||
{
|
||||
_data = { 'replacement_id' : 0, 'replacement_key' : '', 'SAFE_replacement_content' : '' };
|
||||
}
|
||||
|
||||
var _div = document.createElement( "DIV" );
|
||||
_div.id = 'tplate_editorWrapper';
|
||||
_div.update( _tplate.evaluate( _data ) );
|
||||
document.body.appendChild( _div );
|
||||
|
||||
/* New? */
|
||||
if ( ! replacement_id || ( _data['replacement_added_to'] == IPB3Replacements.currentSetData['set_id'] ) )
|
||||
{
|
||||
$( 'tplate_keyBoxWrap_' + replacement_id ).show();
|
||||
}
|
||||
|
||||
/* Adjust title */
|
||||
if ( ! replacement_id )
|
||||
{
|
||||
$('tplate_title_' + replacement_id ).update("Adding Replacement");
|
||||
}
|
||||
|
||||
ipb.positionCenter( 'tplate_editor_' + replacement_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Preview the replacement
|
||||
*/
|
||||
this.previewReplacement = function( replacement_id )
|
||||
{
|
||||
/* Close any open editors */
|
||||
IPB3Replacements.closePreview();
|
||||
|
||||
var _tplate = new Template( $('tplate_replacementsPreview').innerHTML );
|
||||
var _keys = Object.keys( IPB3Replacements.ReplacementsData['replacements'] ).sort();
|
||||
var _data = {};
|
||||
|
||||
/* Get replacement Data */
|
||||
_keys.each( function( i )
|
||||
{
|
||||
if ( IPB3Replacements.ReplacementsData['replacements'][ i ]['replacement_id'] == replacement_id )
|
||||
{
|
||||
_data = IPB3Replacements.ReplacementsData['replacements'][ i ];
|
||||
}
|
||||
} );
|
||||
|
||||
/* For mat.... oh, for me? */
|
||||
_data['_preview'] = _data['replacement_content'].escapeHTML();
|
||||
|
||||
/* But, is it an image? */
|
||||
if ( _data['replacement_content'].startsWith( "<img" ) )
|
||||
{
|
||||
_data['_preview'] = _data['replacement_content'].sub( '\{style_image_url\}', IPB3Replacements.imgURL );
|
||||
}
|
||||
|
||||
var _div = document.createElement( "DIV" );
|
||||
_div.id = 'tplate_previewWrapper';
|
||||
_div.update( _tplate.evaluate( _data ) );
|
||||
document.body.appendChild( _div );
|
||||
|
||||
ipb.positionCenter( 'tplate_preview_' + _data['replacement_id'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Close Preview
|
||||
*/
|
||||
this.closePreview = function()
|
||||
{
|
||||
try
|
||||
{
|
||||
$('tplate_previewWrapper').remove();
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the template editor
|
||||
*/
|
||||
this.cancelReplacements = function()
|
||||
{
|
||||
/*if ( ! confirm( "All unsaved changes will be lost!" ) )
|
||||
{
|
||||
return false;
|
||||
}*/
|
||||
|
||||
try
|
||||
{
|
||||
$('tplate_editorWrapper').remove();
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a list of Replacements groups (files)
|
||||
*/
|
||||
this.buildReplacementsList = function()
|
||||
{
|
||||
/* INIT */
|
||||
var _output = '';
|
||||
var _tplate = new Template( $('tplate_replacementsRow').innerHTML );
|
||||
var json = IPB3Replacements.ReplacementsData;
|
||||
|
||||
var _groups = Object.keys( json['replacements'] ).sort();
|
||||
|
||||
/* Clear out any current listing */
|
||||
$('tplate_replacementsList').update('');
|
||||
|
||||
/* Format... */
|
||||
_groups.each( function( i )
|
||||
{
|
||||
/* Figure out if this in an inherited row, a changed row, a new row or a default row */
|
||||
if ( json['replacements'][i]['replacement_added_to'] == IPB3Replacements.currentSetData['set_id'] )
|
||||
{
|
||||
/* This is a modified row */
|
||||
json['replacements'][i]['_cssState'] = 'new';
|
||||
json['replacements'][i]['_cssClass'] = 'tplateRow_new';
|
||||
}
|
||||
else if ( json['replacements'][i]['replacement_set_id'] == IPB3Replacements.currentSetData['set_id'] )
|
||||
{
|
||||
/* This is a modified row */
|
||||
json['replacements'][i]['_cssState'] = 'modified';
|
||||
json['replacements'][i]['_cssClass'] = 'tplateRow_mod';
|
||||
}
|
||||
else if ( IPB3Replacements.currentSetData['_parentTree'].indexOf( json['replacements'][i]['replacement_set_id'] ) != -1 )
|
||||
{
|
||||
/* Inherited */
|
||||
json['replacements'][i]['_cssState'] = 'inherit';
|
||||
json['replacements'][i]['_cssClass'] = 'tplateRow_inh';
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is a default row */
|
||||
json['replacements'][i]['_cssState'] = 'default';
|
||||
json['replacements'][i]['_cssClass'] = 'tplateRow_def';
|
||||
}
|
||||
|
||||
_output += _tplate.evaluate( json['replacements'][i] );
|
||||
|
||||
} );
|
||||
|
||||
/* Write it out */
|
||||
$('tplate_replacementsList').update( _output );
|
||||
|
||||
/* Post Process */
|
||||
_groups.each( function( i )
|
||||
{
|
||||
/* Inline deleted? */
|
||||
if ( json['replacements'][i]['_cssState'] == 'new' )
|
||||
{
|
||||
$('tplate_replacementsRow_' + json['replacements'][i]['replacement_id'] + '_revert').update('Remove');
|
||||
}
|
||||
else if ( json['replacements'][i]['_cssState'] != 'default' )
|
||||
{
|
||||
$('tplate_replacementsRow_' + json['replacements'][i]['replacement_id'] + '_revert').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('tplate_replacementsRow_' + json['replacements'][i]['replacement_id'] + '_revert').hide();
|
||||
}
|
||||
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Template Mouse Event
|
||||
*/
|
||||
this.mouseEvent = function( e )
|
||||
{
|
||||
if ( _div = $( Event.element( e ) ).up( '.' + IPB3Replacements.cssNames['replacementsRow'] ) )
|
||||
{
|
||||
var _replacement_id = _div.id.replace( 'tplate_replacementsRow_', '' );
|
||||
|
||||
if ( e.type == 'mouseover' )
|
||||
{
|
||||
_div.addClassName( IPB3Replacements.cssNames['replacementsHover'] );
|
||||
}
|
||||
else if ( e.type == 'mouseout' )
|
||||
{
|
||||
_div.removeClassName( IPB3Replacements.cssNames['replacementsHover'] );
|
||||
}
|
||||
else if ( e.type == 'click' )
|
||||
{
|
||||
var _el = Event.findElement( e, 'div' ).id;
|
||||
|
||||
if ( _el.endsWith('_revert' ) )
|
||||
{
|
||||
IPB3Replacements.revertReplacement( _replacement_id );
|
||||
}
|
||||
else if ( _el.endsWith('_preview' ) )
|
||||
{
|
||||
IPB3Replacements.previewReplacement( _replacement_id );
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3Replacements.showReplacementsEditor( _replacement_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
/**
|
||||
* INVISION POWER BOARD v3
|
||||
*
|
||||
* Topics View Javascript File
|
||||
* @author Matt Mecham, Brandon Farber, Josh Williams
|
||||
* @since 2008
|
||||
*/
|
||||
|
||||
/**
|
||||
* "ACP" Class. Designed for ... ACP Template Diff Functions
|
||||
* @author (v.1.0.0) Matt Mecham
|
||||
*/
|
||||
|
||||
/* Prototype Ajax Global Responders
|
||||
* Based on code from: http://codejanitor.com/wp/2006/03/23/ajax-timeouts-with-prototype/
|
||||
* Aborts ajax after a 5 minute delay of nothing happening
|
||||
*/
|
||||
|
||||
var IPB3TemplateDiff = new IPBTemplateDiff;
|
||||
|
||||
Ajax.Responders.register( {
|
||||
onCreate: function( t )
|
||||
{
|
||||
t['_t'] = window.setInterval(
|
||||
function()
|
||||
{
|
||||
if ( IPB3TemplateDiff.callInProgress( t.transport) )
|
||||
{
|
||||
IPB3TemplateDiff.timeOutAjax( t );
|
||||
}
|
||||
},
|
||||
300000
|
||||
);
|
||||
|
||||
t['_t2'] = window.setInterval(
|
||||
function()
|
||||
{
|
||||
switch( t.transport.readyState )
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
IPB3TemplateDiff.updateProgressImage( 'wait' );
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
case 4:
|
||||
IPB3TemplateDiff.updateProgressImage( 'receive' );
|
||||
break;
|
||||
}
|
||||
},
|
||||
500
|
||||
);
|
||||
},
|
||||
onComplete: function( t )
|
||||
{
|
||||
window.clearInterval( t['_t'] );
|
||||
window.clearInterval( t['_t2'] );
|
||||
}
|
||||
} );
|
||||
|
||||
function IPBTemplateDiff()
|
||||
{
|
||||
/**
|
||||
* URLS
|
||||
*/
|
||||
this.baseUrl = '';
|
||||
this.imageUrl = '';
|
||||
|
||||
/*
|
||||
* Stored JSON
|
||||
*/
|
||||
this.storedJSON = {};
|
||||
|
||||
/**
|
||||
* Per go
|
||||
*/
|
||||
this.perGo = 10;
|
||||
|
||||
/**
|
||||
* Total bits
|
||||
*/
|
||||
this.totalBits = 0;
|
||||
|
||||
/**
|
||||
* Init Function
|
||||
* @author Matt Mecham
|
||||
*/
|
||||
this.init = function()
|
||||
{
|
||||
this.beginDiff();
|
||||
};
|
||||
|
||||
/**
|
||||
* Begin the upgrade procedure
|
||||
*/
|
||||
this.beginDiff = function()
|
||||
{
|
||||
/* Start text output.. */
|
||||
this.updateCounter( 0 );
|
||||
|
||||
/* Reset progress bar */
|
||||
this.updateProgressBar( false );
|
||||
|
||||
/* Reset image */
|
||||
this.updateProgressImage( 'send' );
|
||||
|
||||
/* Start off with the SQL */
|
||||
this.fireAjax( 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the progress bar
|
||||
*/
|
||||
this.updateProgressBar = function( processed )
|
||||
{
|
||||
/* INIT */
|
||||
var _element = $( 'diffLogProgressBarInner' );
|
||||
|
||||
if ( processed !== false )
|
||||
{
|
||||
if ( processed == -1 )
|
||||
{
|
||||
_element.style.backgroundImage = 'url(' + this.imageUrl + 'donebar.gif)';
|
||||
_element.style.width = '100%';
|
||||
}
|
||||
else
|
||||
{
|
||||
_element.style.backgroundImage = 'url(' + this.imageUrl + 'progressbar.gif)';
|
||||
_element.style.width = Math.round( ( 100 / this.totalBits ) * processed ) + '%';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_element.style.width = '1%';
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Update progress image
|
||||
*/
|
||||
this.updateProgressImage = function( type )
|
||||
{
|
||||
/* INIT */
|
||||
var _img = '';
|
||||
|
||||
switch( type )
|
||||
{
|
||||
default:
|
||||
case 'stop':
|
||||
_img = 'stop.png';
|
||||
break;
|
||||
case 'ready':
|
||||
_img = 'ready.png';
|
||||
break;
|
||||
case 'warn':
|
||||
_img = 'warning.png';
|
||||
break;
|
||||
case 'send':
|
||||
_img = 'sending.png';
|
||||
break;
|
||||
case 'wait':
|
||||
_img = 'mini-wait.gif';
|
||||
break;
|
||||
case 'receive':
|
||||
_img = 'receiving.png';
|
||||
break;
|
||||
}
|
||||
|
||||
/* Update image */
|
||||
if ( IPB3TemplateDiff.currentImage != _img )
|
||||
{
|
||||
$( 'diffStatusImage' ).src = IPB3TemplateDiff.imageUrl + _img;
|
||||
IPB3TemplateDiff.currentImage = _img;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire Ajax
|
||||
*/
|
||||
this.fireAjax = function()
|
||||
{
|
||||
/* Update image */
|
||||
this.updateProgressImage( 'send' );
|
||||
|
||||
new Ajax.Request( this.baseUrl + '&do=process',
|
||||
{
|
||||
method: 'get',
|
||||
onSuccess: this.processAjax.bind(this),
|
||||
onException: this.exceptionAjax.bind(this),
|
||||
onFailure: this.failureAjax.bind(this)
|
||||
} );
|
||||
};
|
||||
|
||||
/**
|
||||
* Checking to see if there's a call in progres...
|
||||
*/
|
||||
this.callInProgress = function( t )
|
||||
{
|
||||
switch ( t.readyState )
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* On Timeout
|
||||
*/
|
||||
this.timeOutAjax = function( t )
|
||||
{
|
||||
if ( confirm( "No response from the webserver.\nDo you wish to continue waiting?" ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
t.transport.abort();
|
||||
alert( "Request Cancelled" );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* On Failure
|
||||
*/
|
||||
this.failureAjax = function( t )
|
||||
{
|
||||
alert( "Failure: " + t.responseText );
|
||||
};
|
||||
|
||||
/**
|
||||
* On Failure
|
||||
*/
|
||||
this.exceptionAjax = function( t )
|
||||
{
|
||||
alert( "Exception: " + t.responseText );
|
||||
}
|
||||
|
||||
/**
|
||||
* Process Ajax (Success)
|
||||
*/
|
||||
this.processAjax = function( t )
|
||||
{
|
||||
/* Update Image */
|
||||
this.updateProgressImage( 'receive' );
|
||||
|
||||
/* Not a JSON response? */
|
||||
if ( ! t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
alert( "Error:\n" + t.responseText );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Process results */
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( "An error occured: " . json['error'] );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* All good: Update status message... */
|
||||
this.updateCounter( json['processed'] );
|
||||
|
||||
/* Update progress bar */
|
||||
this.updateProgressBar( json['processed'] );
|
||||
|
||||
/* Finish? If so - say all done and go tubby-bye-bye */
|
||||
if ( json['completed'] != 1 )
|
||||
{
|
||||
/* Fire Ajax */
|
||||
this.fireAjax();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* All Done */
|
||||
this.updateProgressBar( -1 );
|
||||
this.updateProgressImage( 'ready' );
|
||||
|
||||
/* Show done thing */
|
||||
$( 'diffDone' ).show();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Write to Log
|
||||
*/
|
||||
this.updateCounter = function( count )
|
||||
{
|
||||
$( 'diffLogProcessed' ).innerHTML = count;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,393 @@
|
||||
/**
|
||||
* INVISION POWER BOARD v3
|
||||
*
|
||||
* Topics View Javascript File
|
||||
* @author Matt Mecham, Brandon Farber, Josh Williams
|
||||
* @since 2008
|
||||
*/
|
||||
|
||||
/**
|
||||
* "ACP" Class. Designed for ... ACP Template Search And Replace Functions
|
||||
* @author (v.1.0.0) Matt Mecham
|
||||
*/
|
||||
|
||||
function IPBTemplateSandR()
|
||||
{
|
||||
/**
|
||||
* Session ID
|
||||
*/
|
||||
this.sessionID = '';
|
||||
|
||||
/*
|
||||
* JSON
|
||||
*/
|
||||
this.sessionData = {};
|
||||
this.templateGroups = {};
|
||||
this.setData = {};
|
||||
this.currentTemplateBit = {};
|
||||
this.currentTemplateGroup = {};
|
||||
|
||||
/**
|
||||
* Init Function
|
||||
* @author Matt Mecham
|
||||
*/
|
||||
this.init = function()
|
||||
{
|
||||
/* Set Session ID */
|
||||
this.sessionID = this.sessionData['sandr_session_id'];
|
||||
/* Build group list */
|
||||
this.buildGroupsList();
|
||||
};
|
||||
|
||||
/**
|
||||
* Toggle all template bits box
|
||||
*/
|
||||
this.toggleGroupBox = function( groupName )
|
||||
{
|
||||
var checked = $( 'cbox_group_' + groupName ).checked;
|
||||
|
||||
$$('.cboxGroup' + groupName ).each(function(cbox)
|
||||
{
|
||||
cbox.checked = checked;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check group check box
|
||||
*/
|
||||
this.checkGroupBox = function( groupName )
|
||||
{
|
||||
var _checkedCount = 0;
|
||||
var _allCount = 0;
|
||||
|
||||
$$('.cboxGroup' + groupName ).each(function(cbox)
|
||||
{
|
||||
if ( cbox.checked )
|
||||
{
|
||||
_checkedCount++;
|
||||
}
|
||||
|
||||
_allCount++;
|
||||
});
|
||||
|
||||
$( 'cbox_group_' + groupName ).checked = ( _allCount == _checkedCount ) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load template bits
|
||||
*/
|
||||
this.loadTemplateEditor = function( template_id )
|
||||
{
|
||||
/* Grab the JSON for the template bits for the current template group */
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=templates&do=getTemplateForEdit&setID=" + this.setData['set_id'] + '&template_id=' + template_id + '&secure_key=' + ipb.vars['md5_hash'];
|
||||
|
||||
new Ajax.Request( url.replace( /&/g, '&' ),
|
||||
{
|
||||
method: 'GET',
|
||||
onSuccess: function (t )
|
||||
{
|
||||
if ( t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( json['error'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3TemplatesSandR.showTemplateEditor( json );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Галектеко ОПАСНОСТЕ! ПЫЩПЫЩ!11: " + t.responseText );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Исключение: " + e ) },
|
||||
onFailure: function( t ){ alert( "Ошибка: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the template editor
|
||||
*/
|
||||
this.showTemplateEditor = function( json )
|
||||
{
|
||||
/* Close any open editors */
|
||||
IPB3TemplatesSandR.cancelTemplateBit( json['templateData']['template_id'] );
|
||||
|
||||
var _tplate = new Template( $('tplate_templateEditor').innerHTML );
|
||||
|
||||
IPB3TemplatesSandR.currentTemplateBit = json['templateData'];
|
||||
|
||||
var _div = document.createElement( "DIV" );
|
||||
_div.id = 'tplate_editorWrapper';
|
||||
_div.update( _tplate.evaluate( json['templateData'] ) );
|
||||
document.body.appendChild( _div );
|
||||
|
||||
ipb.positionCenter( 'tplate_editor_' + json['templateData']['template_id'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Peform the placements
|
||||
*/
|
||||
this.performReplacement = function()
|
||||
{
|
||||
/* Grab the JSON for the template bits for the current template group */
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=templatesandr&do=replace&&sessionID=" + this.sessionID + '&secure_key=' + ipb.vars['md5_hash'];
|
||||
|
||||
$('replaceButton').disabled = true;
|
||||
$('replaceButton').value = "Сохранение...";
|
||||
|
||||
new Ajax.Request( url.replace( /&/g, '&' ),
|
||||
{
|
||||
method: 'POST',
|
||||
parameters: $('sandrForm').serialize(true),
|
||||
onSuccess: function (t )
|
||||
{
|
||||
if ( t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( json['error'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( json['errors'] )
|
||||
{
|
||||
/* Something inline would be very nice here.. rather than this ugly alert */
|
||||
alert("Ошибка: " + json['errors'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$('replaceButton').disabled = false;
|
||||
$('replaceButton').value = "Заменить выбранные";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Галектеко ОПАСНОСТЕ! ПЫЩПЫЩ!11: " + t.responseText );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Исключение: " + e ) },
|
||||
onFailure: function( t ){ alert( "Ошибка: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Save template bit
|
||||
*/
|
||||
this.saveTemplateBit = function( template_id )
|
||||
{
|
||||
/* Grab the JSON for the template bits for the current template group */
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=templates&do=saveTemplateBit&setID=" + this.setData['set_id'] + '&template_id=' + template_id + '&secure_key=' + ipb.vars['md5_hash'];
|
||||
|
||||
/* Set up params */
|
||||
var params = { 'template_content' : $F('tplate_editBox_' + template_id ),
|
||||
'template_data' : $F('tplate_dataBox_' + template_id ),
|
||||
'template_set' : this.setData['set_id'],
|
||||
'template_group' : IPB3TemplatesSandR.currentTemplateGroup,
|
||||
'type' : 'edit' };
|
||||
|
||||
new Ajax.Request( url.replace( /&/g, '&' ),
|
||||
{
|
||||
method: 'POST',
|
||||
parameters: params,
|
||||
onSuccess: function (t )
|
||||
{
|
||||
if ( t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( json['error'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3TemplatesSandR.currentTemplateBit = json['templateData'];
|
||||
IPB3TemplatesSandR.showTemplateEditor( json );
|
||||
|
||||
if ( json['errors'] )
|
||||
{
|
||||
/* Something inline would be very nice here.. rather than this ugly alert */
|
||||
alert("Ошибка: " + json['errors'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
new Effect.Pulsate( $('tplate_editor_' + template_id ), { 'pulses' : 2, 'from' : 0.7, 'duration' : 0.5 } );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Галектеко ОПАСНОСТЕ! ПЫЩПЫЩ!11: " + t.responseText );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Исключение: " + e ) },
|
||||
onFailure: function( t ){ alert( "Ошибка: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the template editor
|
||||
*/
|
||||
this.cancelTemplateBit = function( templateID )
|
||||
{
|
||||
try
|
||||
{
|
||||
$('tplate_editorWrapper').remove();
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a list of template groups
|
||||
*/
|
||||
this.buildGroupsList = function()
|
||||
{
|
||||
/* INIT */
|
||||
var _output = '';
|
||||
var _tplate = new Template( $('tplate_groupRow').innerHTML );
|
||||
var json = IPB3TemplatesSandR.templateGroups;
|
||||
|
||||
var ROW_ON_OFF = true;
|
||||
var CLASS_NAME = '';
|
||||
|
||||
var _groups = Object.keys( json['groups'] ).sort();
|
||||
|
||||
/* Clear out any current listing */
|
||||
$('tplate_groupList').update('');
|
||||
|
||||
/* Format... */
|
||||
_groups.each( function( i )
|
||||
{
|
||||
if( ROW_ON_OFF)
|
||||
{
|
||||
ROW_ON_OFF = false;
|
||||
CLASS_NAME = 'acp-row-off';
|
||||
}
|
||||
else
|
||||
{
|
||||
ROW_ON_OFF = true;
|
||||
CLASS_NAME = 'acp-row-on';
|
||||
}
|
||||
|
||||
_output += _tplate.evaluate( { 'groupName' : i, '_matches' : Object.keys( json['groups'][i] ).length, 'classname' : CLASS_NAME } );
|
||||
} );
|
||||
|
||||
/* Write it out */
|
||||
$('tplate_groupList').update( _output );
|
||||
|
||||
/* Post process */
|
||||
_groups.each( function( i )
|
||||
{
|
||||
if ( IPB3TemplatesSandR.sessionData['sandr_search_only'] )
|
||||
{
|
||||
$( 'groupRowCbox_' + i ).hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
$( 'groupRowCbox_' + i ).show();
|
||||
}
|
||||
} );
|
||||
|
||||
doStriping();
|
||||
};
|
||||
|
||||
/**
|
||||
* Build a list of template bits
|
||||
*/
|
||||
this.buildTemplateList = function( groupName, json )
|
||||
{
|
||||
/* INIT */
|
||||
var _output = '';
|
||||
var _tplate = new Template( $('tplate_templateRow').innerHTML );
|
||||
|
||||
IPB3TemplatesSandR.currentTemplateGroup = groupName;
|
||||
|
||||
/* Clear out any current listing */
|
||||
$( 'groupRowTemplates_' + groupName ).update('');
|
||||
|
||||
/* Add in the new... */
|
||||
for( i = 0 ; i < json['templates'].length; i++ )
|
||||
{
|
||||
_output += _tplate.evaluate( json['templates'][i] );
|
||||
};
|
||||
|
||||
/* Write it out */
|
||||
$( 'groupRowTemplates_' + groupName ).update( _output );
|
||||
|
||||
/* Post process */
|
||||
for( i = 0 ; i < json['templates'].length; i++ )
|
||||
{
|
||||
if ( IPB3TemplatesSandR.sessionData['sandr_search_only'] )
|
||||
{
|
||||
$( 'templateRowCbox_' + json['templates'][i]['template_id'] ).hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
$( 'templateRowCbox_' + json['templates'][i]['template_id'] ).show();
|
||||
|
||||
/* Checked, please? */
|
||||
IPB3TemplatesSandR.toggleGroupBox( json['templates'][i]['template_group'] );
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Show / Hide templates
|
||||
*/
|
||||
this.toggleTemplates = function( groupName )
|
||||
{
|
||||
if ( $('groupRowTemplates_' + groupName ).hasClassName( 'tmplShow' ) )
|
||||
{
|
||||
$('groupRowTemplates_' + groupName ).removeClassName( 'tmplShow' );
|
||||
$('groupRowTemplates_' + groupName ).hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('groupRowTemplates_' + groupName ).addClassName( 'tmplShow' );
|
||||
$('groupRowTemplates_' + groupName ).show();
|
||||
|
||||
/* Ajax */
|
||||
/* Grab the JSON for the template bits for the current template group */
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=templatesandr&do=getTemplateBitList&setID=" + this.setData['set_id'] + '&templateGroup=' + groupName + '&secure_key=' + ipb.vars['md5_hash'] + '&sessionID=' + this.sessionID;
|
||||
|
||||
new Ajax.Request( url.replace( /&/g, '&' ),
|
||||
{
|
||||
method: 'GET',
|
||||
onSuccess: function (t )
|
||||
{
|
||||
if ( t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( json['error'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3TemplatesSandR.buildTemplateList( groupName, json );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,583 @@
|
||||
/**
|
||||
* INVISION POWER BOARD v3
|
||||
*
|
||||
* Topics View Javascript File
|
||||
* @author Matt Mecham, Brandon Farber, Josh Williams
|
||||
* @since 2008
|
||||
*/
|
||||
|
||||
/**
|
||||
* "ACP" Class. Designed for ... ACP Templating Functions
|
||||
* @author (v.1.0.0) Matt Mecham
|
||||
*/
|
||||
|
||||
function IPBTemplates()
|
||||
{
|
||||
/**
|
||||
* Template groups
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
this.templateGroups = {};
|
||||
|
||||
/**
|
||||
* Current template group
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
this.currentTemplateGroup = '';
|
||||
|
||||
/**
|
||||
* Current template bit
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
this.currentTemplateBit = '';
|
||||
|
||||
/**
|
||||
* Current set ID
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
this.currentSetData = {};
|
||||
|
||||
/**
|
||||
* CSS Names
|
||||
*
|
||||
* @var hash
|
||||
*/
|
||||
this.cssNames = { 'groupRowLit' : 'tplateLit',
|
||||
'groupHover' : 'groupHover',
|
||||
'groupRowLitMain' : 'tablerow1',
|
||||
'groupRow' : 'tablerow2',
|
||||
'templateRow' : 'tablerow2',
|
||||
'templateHover' : 'templateHover' };
|
||||
|
||||
|
||||
/**
|
||||
* INIT Applications
|
||||
*/
|
||||
this.init = function()
|
||||
{
|
||||
/* Build group list */
|
||||
this.buildGroupsList();
|
||||
|
||||
/* fix template window to same height as group list and make it scrollable */
|
||||
$('tplate_bitList').setStyle( { 'height' : $('tplate_groupList').getHeight() + 'px', 'overflow' : 'auto'} );
|
||||
|
||||
this.loadTemplateBits( this.currentTemplateGroup );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load template groups
|
||||
*/
|
||||
this.loadTemplateGroups = function()
|
||||
{
|
||||
/* Grab the JSON for the template bits for the current template group */
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=templates&do=getTemplateGroupList&setID=" + this.currentSetData['set_id'] + '&secure_key=' + ipb.vars['md5_hash'];
|
||||
|
||||
new Ajax.Request( url.replace( /&/g, '&' ),
|
||||
{
|
||||
method: 'GET',
|
||||
onSuccess: function (t )
|
||||
{
|
||||
if ( t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
$('tplate_debug').innerHTML += "\n" + t.responseText;
|
||||
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( json['error'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3Templates.templateGroups = json;
|
||||
IPB3Templates.buildGroupsList();
|
||||
|
||||
/* Hilite */
|
||||
IPB3Templates.hiliteGroup( IPB3Templates.currentTemplateGroup );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load template bits
|
||||
*/
|
||||
this.loadTemplateBits = function( groupName, force )
|
||||
{
|
||||
/* Grab the JSON for the template bits for the current template group */
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=templates&do=getTemplateBitList&setID=" + this.currentSetData['set_id'] + '&templateGroup=' + groupName + '&secure_key=' + ipb.vars['md5_hash'];
|
||||
|
||||
new Ajax.Request( url.replace( /&/g, '&' ),
|
||||
{
|
||||
method: 'GET',
|
||||
onSuccess: function (t )
|
||||
{
|
||||
if ( t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
$('tplate_debug').innerHTML += "\n" + t.responseText;
|
||||
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( json['error'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
var _reload = 0;
|
||||
|
||||
/* New group? */
|
||||
if ( ! IPB3Templates.templateGroups['groups'][ groupName ] )
|
||||
{
|
||||
IPB3Templates.templateGroups['groups'][ groupName ] = { '_modCount' : 0, 'template_group' : groupName };
|
||||
_reload = 1;
|
||||
}
|
||||
|
||||
/* Update group's template count */
|
||||
if ( json['groupData'] )
|
||||
{
|
||||
if ( json['groupData']['_modCount'] != IPB3Templates.templateGroups['groups'][ groupName ]['_modCount'] )
|
||||
{
|
||||
IPB3Templates.templateGroups['groups'][ groupName ]['_modCount'] = json['groupData']['_modCount'];
|
||||
_reload = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Re-draw list */
|
||||
if ( _reload )
|
||||
{
|
||||
IPB3Templates.buildGroupsList();
|
||||
}
|
||||
|
||||
/* Hilite */
|
||||
IPB3Templates.hiliteGroup( groupName );
|
||||
IPB3Templates.buildTemplateList( json );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Save template bit
|
||||
*/
|
||||
this.saveTemplateBit = function( template_id )
|
||||
{
|
||||
/* Grab the JSON for the template bits for the current template group */
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=templates&do=saveTemplateBit&setID=" + this.currentSetData['set_id'] + '&template_id=' + template_id + '&secure_key=' + ipb.vars['md5_hash'];
|
||||
|
||||
/* Set up params */
|
||||
var params = { 'template_content' : $F('tplate_editBox_' + template_id ),
|
||||
'template_data' : $F('tplate_dataBox_' + template_id ),
|
||||
'template_set' : this.currentSetData['set_id'],
|
||||
'template_group' : IPB3Templates.currentTemplateGroup,
|
||||
'type' : IPB3Templates.currentTemplateBit['_type'] };
|
||||
|
||||
if ( IPB3Templates.currentTemplateBit['_type'] == 'add' )
|
||||
{
|
||||
params['_template_name'] = $F('tplate_addNameTextField_0');
|
||||
params['_template_group'] = $F('tplate_addGroupTextField_0');
|
||||
}
|
||||
|
||||
new Ajax.Request( url.replace( /&/g, '&' ),
|
||||
{
|
||||
method: 'POST',
|
||||
parameters: params,
|
||||
onSuccess: function (t )
|
||||
{
|
||||
if ( t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( json['error'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3Templates.currentTemplateBit = json['templateData'];
|
||||
IPB3Templates.showTemplateEditor( json );
|
||||
IPB3Templates.loadTemplateBits( json['templateData']['template_group'] );
|
||||
|
||||
if ( json['errors'] )
|
||||
{
|
||||
/* Something inline would be very nice here.. rather than this ugly alert */
|
||||
alert("UGLY ALERT BOX SAYS: " + json['errors'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("UGLY ALERT BOX SAYS: Saved!");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Revert template bit
|
||||
*/
|
||||
this.revertTemplateBit = function( template_id )
|
||||
{
|
||||
/* Make sure we're mean it... */
|
||||
if ( $('tplate_templaterow_' + template_id ).hasClassName( 'tplateRow_new') )
|
||||
{
|
||||
if ( ! confirm( "REMOVE template bit?\n This will remove this template bit in ALL skins!" ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! confirm( "Revert template bit?\n All changes WILL be lost!" ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Grab the JSON for the template bits for the current template group */
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=templates&do=revertTemplateBit&setID=" + this.currentSetData['set_id'] + '&template_id=' + template_id + '&secure_key=' + ipb.vars['md5_hash'];
|
||||
|
||||
new Ajax.Request( url.replace( /&/g, '&' ),
|
||||
{
|
||||
method: 'GET',
|
||||
onSuccess: function (t )
|
||||
{
|
||||
if ( t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( json['error'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( json['templateData'] )
|
||||
{
|
||||
IPB3Templates.currentTemplateBit = json['templateData'];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Reload the group */
|
||||
IPB3Templates.loadTemplateGroups();
|
||||
}
|
||||
|
||||
IPB3Templates.loadTemplateBits( IPB3Templates.currentTemplateBit['template_group'] );
|
||||
|
||||
if ( json['errors'] )
|
||||
{
|
||||
/* Something inline would be very nice here.. rather than this ugly alert */
|
||||
alert("UGLY ALERT BOX SAYS: " + json['errors'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load template bits
|
||||
*/
|
||||
this.loadTemplateEditor = function( template_id )
|
||||
{
|
||||
/* Grab the JSON for the template bits for the current template group */
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=templates&do=getTemplateForEdit&setID=" + this.currentSetData['set_id'] + '&template_id=' + template_id + '&secure_key=' + ipb.vars['md5_hash'];
|
||||
|
||||
new Ajax.Request( url.replace( /&/g, '&' ),
|
||||
{
|
||||
method: 'GET',
|
||||
onSuccess: function (t )
|
||||
{
|
||||
if ( t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( json['error'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3Templates.showTemplateEditor( json );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the new template bit form
|
||||
*/
|
||||
this.addBitForm = function()
|
||||
{
|
||||
/* Close any open editors */
|
||||
IPB3Templates.cancelTemplateBit( 0 );
|
||||
|
||||
var _tplate = new Template( $('tplate_templateEditorAdd').innerHTML );
|
||||
var _data = { 'template_id' : 0,
|
||||
'template_set_id' : IPB3Templates.currentSetData['set_id'],
|
||||
'template_group' : IPB3Templates.currentTemplateGroup,
|
||||
'template_content' : '',
|
||||
'_type' : 'add' };
|
||||
|
||||
var _div = document.createElement( "DIV" );
|
||||
_div.id = 'tplate_editorWrapper';
|
||||
_div.update( _tplate.evaluate( _data ) );
|
||||
document.body.appendChild( _div );
|
||||
|
||||
ipb.positionCenter( 'tplate_editor_0' );
|
||||
|
||||
IPB3Templates.currentTemplateBit = _data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the template editor
|
||||
*/
|
||||
this.showTemplateEditor = function( json )
|
||||
{
|
||||
/* Close any open editors */
|
||||
IPB3Templates.cancelTemplateBit( json['templateData']['template_id'] );
|
||||
|
||||
var _tplate = new Template( $('tplate_templateEditor').innerHTML );
|
||||
|
||||
IPB3Templates.currentTemplateBit = json['templateData'];
|
||||
|
||||
var _div = document.createElement( "DIV" );
|
||||
_div.id = 'tplate_editorWrapper';
|
||||
_div.update( _tplate.evaluate( json['templateData'] ) );
|
||||
document.body.appendChild( _div );
|
||||
|
||||
ipb.positionCenter( 'tplate_editor_' + json['templateData']['template_id'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the template editor
|
||||
*/
|
||||
this.cancelTemplateBit = function( templateID )
|
||||
{
|
||||
/*if ( ! confirm( "All unsaved changes will be lost!" ) )
|
||||
{
|
||||
return false;
|
||||
}*/
|
||||
|
||||
try
|
||||
{
|
||||
$('tplate_editorWrapper').remove();
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a group entry as 'lit'
|
||||
*/
|
||||
this.hiliteGroup = function( templateGroup )
|
||||
{
|
||||
/* Un-hi-lite all groups */
|
||||
var _groups = Object.keys( IPB3Templates.templateGroups['groups'] ).sort();
|
||||
|
||||
/* Format... */
|
||||
_groups.each( function( i )
|
||||
{
|
||||
/* Fix up template */
|
||||
$('tplate_grouprow_' + i ).removeClassName( IPB3Templates.cssNames['groupRowLitMain'] );
|
||||
$('tplate_grouprow_' + i ).removeClassName( IPB3Templates.cssNames['groupRowLit'] );
|
||||
$('tplate_grouprow_' + i ).addClassName( IPB3Templates.cssNames['groupRow'] );
|
||||
} );
|
||||
|
||||
$('tplate_grouprow_' + templateGroup ).removeClassName( IPB3Templates.cssNames['groupRow'] );
|
||||
$('tplate_grouprow_' + templateGroup ).addClassName( IPB3Templates.cssNames['groupRowLitMain'] );
|
||||
$('tplate_grouprow_' + templateGroup ).addClassName( IPB3Templates.cssNames['groupRowLit'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a list of template groups
|
||||
*/
|
||||
this.buildGroupsList = function()
|
||||
{
|
||||
/* INIT */
|
||||
var _output = '';
|
||||
var _tplate = new Template( $('tplate_groupRow').innerHTML );
|
||||
var json = IPB3Templates.templateGroups;
|
||||
|
||||
var _groups = Object.keys( json['groups'] ).sort();
|
||||
|
||||
/* Clear out any current listing */
|
||||
$('tplate_groupList').update('');
|
||||
|
||||
/* Format... */
|
||||
_groups.each( function( i )
|
||||
{
|
||||
_output += _tplate.evaluate( { 'groupName' : i, '_modCount' : json['groups'][i]['_modCount'] } );
|
||||
} );
|
||||
|
||||
/* Write it out */
|
||||
$('tplate_groupList').update( _output );
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a list of template bits
|
||||
*/
|
||||
this.buildTemplateList = function( json )
|
||||
{
|
||||
/* INIT */
|
||||
var _output = '';
|
||||
var _tplate = new Template( $('tplate_templateRow').innerHTML );
|
||||
|
||||
/* Clear out any current listing */
|
||||
$('tplate_bitList').update('');
|
||||
|
||||
/* Add in the new... */
|
||||
for( i = 0 ; i < json['templates'].length; i++ )
|
||||
{
|
||||
/* Figure out if this in an inherited row, a changed row, a new row or a default row */
|
||||
if ( json['templates'][i]['template_added_to'] == IPB3Templates.currentSetData['set_id'] )
|
||||
{
|
||||
/* This is a modified row */
|
||||
json['templates'][i]['_templateState'] = 'new';
|
||||
json['templates'][i]['_cssClass'] = 'tplateRow_new';
|
||||
}
|
||||
else if ( json['templates'][i]['template_set_id'] == IPB3Templates.currentSetData['set_id'] )
|
||||
{
|
||||
/* This is a modified row */
|
||||
json['templates'][i]['_templateState'] = 'modified';
|
||||
json['templates'][i]['_cssClass'] = 'tplateRow_mod';
|
||||
}
|
||||
else if ( IPB3Templates.currentSetData['_parentTree'].indexOf( json['templates'][i]['template_set_id'] ) != -1 )
|
||||
{
|
||||
/* Inherited */
|
||||
json['templates'][i]['_templateState'] = 'inherit';
|
||||
json['templates'][i]['_cssClass'] = 'tplateRow_inh';
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is a default row */
|
||||
json['templates'][i]['_templateState'] = 'default';
|
||||
json['templates'][i]['_cssClass'] = 'tplateRow_def';
|
||||
}
|
||||
|
||||
_output += _tplate.evaluate( json['templates'][i] );
|
||||
};
|
||||
|
||||
/* Write it out */
|
||||
$('tplate_bitList').update( _output );
|
||||
|
||||
/* Post Process */
|
||||
for( i = 0 ; i < json['templates'].length; i++ )
|
||||
{
|
||||
if ( json['templates'][i]['_templateState'] == 'new' )
|
||||
{
|
||||
$('tplate_templateRow_' + json['templates'][i]['template_id'] + '_revert').update('Remove');
|
||||
}
|
||||
else if ( json['templates'][i]['_templateState'] != 'default' )
|
||||
{
|
||||
$('tplate_templateRow_' + json['templates'][i]['template_id'] + '_revert').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('tplate_templateRow_' + json['templates'][i]['template_id'] + '_revert').hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Template Mouse Event
|
||||
*/
|
||||
this.templateMouseEvent = function( e )
|
||||
{
|
||||
if ( _div = $( Event.element( e ) ).up( '.' + IPB3Templates.cssNames['templateRow'] ) )
|
||||
{
|
||||
var _template_id = _div.id.replace( 'tplate_templaterow_', '' );
|
||||
|
||||
if ( e.type == 'mouseover' )
|
||||
{
|
||||
_div.addClassName( IPB3Templates.cssNames['templateHover'] );
|
||||
}
|
||||
else if ( e.type == 'mouseout' )
|
||||
{
|
||||
_div.removeClassName( IPB3Templates.cssNames['templateHover'] );
|
||||
}
|
||||
else if ( e.type == 'click' )
|
||||
{
|
||||
var _el = Event.findElement( e, 'div' ).id;
|
||||
|
||||
if ( _el.endsWith('_revert' ) )
|
||||
{
|
||||
IPB3Templates.revertTemplateBit( _template_id );
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3Templates.loadTemplateEditor( _template_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Group Mouse Event
|
||||
*/
|
||||
this.groupMouseEvent = function( e )
|
||||
{
|
||||
var groupName = $( Event.findElement( e, 'div' ) ).id;
|
||||
var _groupName = groupName.replace( 'tplate_grouprow_', '' );
|
||||
|
||||
if ( e.type == 'mouseover' )
|
||||
{
|
||||
$( groupName ).addClassName( IPB3Templates.cssNames['groupHover'] );
|
||||
}
|
||||
else if ( e.type == 'mouseout' )
|
||||
{
|
||||
$( groupName ).removeClassName( IPB3Templates.cssNames['groupHover'] );
|
||||
}
|
||||
else if ( e.type == 'click' )
|
||||
{
|
||||
IPB3Templates.currentTemplateGroup = _groupName;
|
||||
|
||||
IPB3Templates.loadTemplateBits( _groupName );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,604 @@
|
||||
/**
|
||||
* INVISION POWER BOARD v3
|
||||
*
|
||||
* Topics View Javascript File
|
||||
* @author Matt Mecham, Brandon Farber, Josh Williams
|
||||
* @since 2008
|
||||
*/
|
||||
|
||||
/**
|
||||
* "ACP" Class. Designed for ... ACP User Agents Functions
|
||||
* @author (v.1.0.0) Matt Mecham
|
||||
*/
|
||||
|
||||
function IPBUAgents()
|
||||
{
|
||||
/**
|
||||
* Template groups
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
this.uAgentsData = {};
|
||||
|
||||
/**
|
||||
* Group Data
|
||||
*/
|
||||
this.uAgentsGroupData = {};
|
||||
|
||||
/**
|
||||
* Agents by key
|
||||
*/
|
||||
this.agentsByKey = {};
|
||||
|
||||
/**
|
||||
* uagents Names
|
||||
*
|
||||
* @var hash
|
||||
*/
|
||||
this.cssNames = {
|
||||
'uagentsRow' : 'uAgentsRow',
|
||||
'uagentsHover' : 'uAgentsHover',
|
||||
'uagentsGRow' : 'uAgentsGRow',
|
||||
'uagentsGHover' : 'uAgentsGHover',
|
||||
'uagentsGRRow' : 'uAgentsGRRow',
|
||||
'uagentsGRHover' : 'uAgentsGRHover'
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* INIT User Agents List
|
||||
*/
|
||||
this.init = function()
|
||||
{
|
||||
/* Build uagents list */
|
||||
this.buildUAgentsList();
|
||||
}
|
||||
|
||||
/**
|
||||
* INIT User Agent Form
|
||||
*/
|
||||
this.groupFormInit = function()
|
||||
{
|
||||
/* Figure out which are already in the list */
|
||||
|
||||
/* Set up key based array */
|
||||
Object.keys( this.uAgentsData['uagents'] ).each( function( i )
|
||||
{
|
||||
IPB3UAgents.agentsByKey[ IPB3UAgents.uAgentsData['uagents'][i]['uagent_key'] ] = IPB3UAgents.uAgentsData['uagents'][i];
|
||||
} );
|
||||
|
||||
/* Soft delete the ones in the group already */
|
||||
Object.keys( this.uAgentsGroupData ).each( function( i )
|
||||
{
|
||||
IPB3UAgents.uAgentsData['uagents'][ IPB3UAgents.agentsByKey[ IPB3UAgents.uAgentsGroupData[i]['uagent_key'] ]['uagent_id'] ]['_used'] = 1;
|
||||
} );
|
||||
|
||||
|
||||
/* Build uagents list */
|
||||
this.buildGroupAgentList();
|
||||
|
||||
/* Build uagents list that are already in the group */
|
||||
this.buildGroupAgentsUsedList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save uagents
|
||||
*/
|
||||
this.saveuAgent = function( uagent_id )
|
||||
{
|
||||
/* Grab the JSON for the template bits for the current template group */
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=uagents&do=saveuAgent&&uagent_id=" + uagent_id + '&secure_key=' + ipb.vars['md5_hash'];
|
||||
|
||||
/* Set up params */
|
||||
var params = { 'uagent_key' : $F('tplate_keyBox_' + uagent_id ),
|
||||
'uagent_name' : $F('tplate_titleBox_' + uagent_id ),
|
||||
'uagent_regex' : $F('tplate_regexBox_' + uagent_id ),
|
||||
'uagent_regex_capture' : $F('tplate_captureBox_' + uagent_id ),
|
||||
'uagent_type' : $F('tplate_typeBox_' + uagent_id ),
|
||||
'uagent_position' : $F('tplate_positionBox_' + uagent_id ),
|
||||
'type' : ( uagent_id == 0 ) ? 'add' : 'edit'
|
||||
};
|
||||
|
||||
new Ajax.Request( url.replace( /&/g, '&' ),
|
||||
{
|
||||
method: 'POST',
|
||||
parameters: params,
|
||||
onSuccess: function (t )
|
||||
{
|
||||
if ( t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( json['error'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3UAgents.uAgentsData = json;
|
||||
IPB3UAgents.buildUAgentsList();
|
||||
|
||||
if ( json['errors'] )
|
||||
{
|
||||
/* Something inline would be very nice here.. rather than this ugly alert */
|
||||
alert("UGLY ALERT BOX SAYS: " + json['errors'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("UGLY ALERT BOX SAYS: Saved!");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Revert css
|
||||
*/
|
||||
this.removeuAgent = function( uagent_id )
|
||||
{
|
||||
/* Make sure we're mean it... */
|
||||
if ( ! confirm( "Remove user agent?\\nThis will be removed permanently" ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Grab the JSON for the template bits for the current template group */
|
||||
url = ipb.vars['base_url'] + "app=core&module=ajax&section=uagents&do=removeuAgent&uagent_id=" + uagent_id + '&secure_key=' + ipb.vars['md5_hash'];
|
||||
|
||||
new Ajax.Request( url.replace( /&/g, '&' ),
|
||||
{
|
||||
method: 'GET',
|
||||
onSuccess: function (t )
|
||||
{
|
||||
if ( t.responseText.match( /^(\s+?)?\{/ ) )
|
||||
{
|
||||
eval( "var json = " + t.responseText );
|
||||
|
||||
if ( json['error'] )
|
||||
{
|
||||
alert( json['error'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3UAgents.uAgentsData = json;
|
||||
IPB3UAgents.buildUAgentsList();
|
||||
|
||||
if ( json['errors'] )
|
||||
{
|
||||
/* Something inline would be very nice here.. rather than this ugly alert */
|
||||
alert("UGLY ALERT BOX SAYS: " + json['errors'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add uagents form
|
||||
*/
|
||||
this.adduAgentForm = function()
|
||||
{
|
||||
IPB3UAgents.showuAgentsEditor( 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the template editor
|
||||
*/
|
||||
this.showuAgentsEditor = function( uagent_id )
|
||||
{
|
||||
/* Close any open editors */
|
||||
IPB3UAgents.canceluAgents();
|
||||
|
||||
var _tplate = new Template( $('tplate_uagentsEditor').innerHTML );
|
||||
var _keys = Object.keys( IPB3UAgents.uAgentsData['uagents'] );
|
||||
var _data = {};
|
||||
|
||||
/* Get replacement Data */
|
||||
if ( uagent_id )
|
||||
{
|
||||
_keys.each( function( i )
|
||||
{
|
||||
if ( IPB3UAgents.uAgentsData['uagents'][ i ]['uagent_id'] == uagent_id )
|
||||
{
|
||||
_data = IPB3UAgents.uAgentsData['uagents'][ i ];
|
||||
}
|
||||
} );
|
||||
}
|
||||
else
|
||||
{
|
||||
_data = { 'uagent_id' : 0 };
|
||||
}
|
||||
|
||||
var _div = new Element('div', { id: 'tplate_editorWrapper' } );
|
||||
//_div.id = 'tplate_editorWrapper';
|
||||
_div.update( _tplate.evaluate( _data ) );
|
||||
document.body.appendChild( _div );
|
||||
|
||||
/* Adjust title */
|
||||
if ( ! uagent_id )
|
||||
{
|
||||
$('tplate_title_' + uagent_id ).update("Adding User Agent");
|
||||
}
|
||||
|
||||
/* Select box type */
|
||||
_box = $('tplate_typeBox_' + _data['uagent_id'] );
|
||||
|
||||
for( i = 0 ; i < _box.options.length ; i++ )
|
||||
{
|
||||
if ( _box.options[i].value == _data['uagent_type'] )
|
||||
{
|
||||
_box.selectedIndex = i;
|
||||
}
|
||||
};
|
||||
|
||||
ipb.positionCenter( 'tplate_editor_' + uagent_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the editor
|
||||
*/
|
||||
this.canceluAgents = function()
|
||||
{
|
||||
/*if ( ! confirm( "All unsaved changes will be lost!" ) )
|
||||
{
|
||||
return false;
|
||||
}*/
|
||||
|
||||
try
|
||||
{
|
||||
$('tplate_editorWrapper').remove();
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a list of uagents groups (files)
|
||||
*/
|
||||
this.buildUAgentsList = function()
|
||||
{
|
||||
/* INIT */
|
||||
var _output = '';
|
||||
var _tplate = new Template( $('tplate_uagentsRow').innerHTML );
|
||||
var json = IPB3UAgents.uAgentsData;
|
||||
|
||||
var _groups = Object.keys( json['uagents'] );
|
||||
|
||||
/* Clear out any current listing */
|
||||
$('tplate_uagentList').update('');
|
||||
|
||||
/* Format... */
|
||||
_groups.each( function( i )
|
||||
{
|
||||
json['uagents'][i]['_cssClass'] = IPB3UAgents.cssNames['uagentsRow'];
|
||||
|
||||
_output += _tplate.evaluate( json['uagents'][i] );
|
||||
|
||||
} );
|
||||
|
||||
/* Write it out */
|
||||
$('tplate_uagentList').update( _output );
|
||||
|
||||
/* Post process */
|
||||
_groups.each( function( i )
|
||||
{
|
||||
/* Image. Can't use #{...} inline as it parses as HTML entities. Most annoying */
|
||||
$('tplate_img_' + json['uagents'][i]['uagent_id'] ).src += 'type_' + json['uagents'][i]['uagent_type'] + '.png';
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Template Mouse Event
|
||||
*/
|
||||
this.mouseEvent = function( e )
|
||||
{
|
||||
if ( _div = $( Event.element( e ) ).up( '.' + IPB3UAgents.cssNames['uagentsRow'] ) )
|
||||
{
|
||||
var _uagent_id = _div.id.replace( 'tplate_uagentsRow_', '' );
|
||||
|
||||
if ( e.type == 'mouseover' )
|
||||
{
|
||||
_div.addClassName( IPB3UAgents.cssNames['uagentsHover'] );
|
||||
}
|
||||
else if ( e.type == 'mouseout' )
|
||||
{
|
||||
_div.removeClassName( IPB3UAgents.cssNames['uagentsHover'] );
|
||||
}
|
||||
else if ( e.type == 'click' )
|
||||
{
|
||||
var _el = Event.findElement( e, 'div' ).id;
|
||||
|
||||
if ( _el.endsWith('_remove' ) )
|
||||
{
|
||||
IPB3UAgents.removeuAgent( _uagent_id );
|
||||
}
|
||||
else
|
||||
{
|
||||
IPB3UAgents.showuAgentsEditor( _uagent_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a list of USED uagents
|
||||
*/
|
||||
this.buildGroupAgentsUsedList = function()
|
||||
{
|
||||
/* INIT */
|
||||
var _output = '';
|
||||
var _tplate = new Template( $('tplate_groupRow').innerHTML );
|
||||
var json = IPB3UAgents.uAgentsGroupData;
|
||||
|
||||
var _groups = Object.keys( json );
|
||||
|
||||
var _save = {};
|
||||
|
||||
/* Clear out any current listing */
|
||||
$('tplate_groupList').update('');
|
||||
|
||||
/* Format... */
|
||||
_groups.each( function( i )
|
||||
{
|
||||
if ( ! IPB3UAgents.uAgentsGroupData[i]['_hide'] )
|
||||
{
|
||||
_save[i] = IPB3UAgents.uAgentsGroupData[i];
|
||||
|
||||
json[i] = IPB3UAgents.uAgentsData['uagents'][ IPB3UAgents.agentsByKey[ IPB3UAgents.uAgentsGroupData[i]['uagent_key'] ]['uagent_id'] ];
|
||||
json[i]['uagent_versions'] = _save[i]['uagent_versions'];
|
||||
|
||||
json[i]['_cssClass'] = IPB3UAgents.cssNames['uagentsGRRow'];
|
||||
|
||||
_output += _tplate.evaluate( json[i] );
|
||||
}
|
||||
} );
|
||||
|
||||
/* Write it out */
|
||||
$('tplate_groupList').update( _output );
|
||||
|
||||
/* Post process */
|
||||
_groups.each( function( i )
|
||||
{
|
||||
if ( ! IPB3UAgents.uAgentsGroupData[i]['_hide'] )
|
||||
{
|
||||
/* Image. Can't use #{...} inline as it parses as HTML entities. Most annoying */
|
||||
$('tplate_groupimg_' + json[i]['uagent_id'] ).src += 'type_' + json[i]['uagent_type'] + '.png';
|
||||
|
||||
/* Can we configure a version? */
|
||||
var _data = IPB3UAgents.uAgentsData['uagents'][ IPB3UAgents.agentsByKey[ IPB3UAgents.uAgentsGroupData[i]['uagent_key'] ]['uagent_id'] ];
|
||||
|
||||
if ( _data['uagent_regex_capture'] > 0 )
|
||||
{
|
||||
$('tplate_grouprow_' + _data['uagent_id'] + '_configure').show();
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
/* Update hidden field */
|
||||
$('uAgentsData').value = Object.toJSON( _save );
|
||||
}
|
||||
|
||||
/**
|
||||
* Save user agent form
|
||||
*/
|
||||
this.saveGroupForm = function()
|
||||
{
|
||||
$('uAgentsForm').submit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Template Mouse Event
|
||||
*/
|
||||
this.groupUsedMouseEvent = function( e )
|
||||
{
|
||||
if ( _div = $( Event.element( e ) ).up( '.' + IPB3UAgents.cssNames['uagentsGRRow'] ) )
|
||||
{
|
||||
var _uagent_id = _div.id.replace( 'tplate_grouprow_', '' );
|
||||
|
||||
if ( e.type == 'mouseover' )
|
||||
{
|
||||
_div.addClassName( IPB3UAgents.cssNames['uagentsGRHover'] );
|
||||
}
|
||||
else if ( e.type == 'mouseout' )
|
||||
{
|
||||
_div.removeClassName( IPB3UAgents.cssNames['uagentsGRHover'] );
|
||||
}
|
||||
else if ( e.type == 'click' )
|
||||
{
|
||||
var _el = Event.findElement( e, 'div' ).id;
|
||||
|
||||
if ( _el.endsWith('_remove' ) )
|
||||
{
|
||||
IPB3UAgents.groupRemoveFromList( _uagent_id );
|
||||
}
|
||||
else if ( _el.endsWith( '_configure' ) )
|
||||
{
|
||||
IPB3UAgents.showConfigureEditor( _uagent_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the editor
|
||||
*/
|
||||
this.cancelAgentVersion = function()
|
||||
{
|
||||
/*if ( ! confirm( "All unsaved changes will be lost!" ) )
|
||||
{
|
||||
return false;
|
||||
}*/
|
||||
|
||||
try
|
||||
{
|
||||
$('tplate_versionsWrapper').remove();
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the versions editor
|
||||
*/
|
||||
this.showConfigureEditor = function( uagent_id )
|
||||
{
|
||||
/* Close any open editors */
|
||||
IPB3UAgents.cancelAgentVersion();
|
||||
|
||||
var _tplate = new Template( $('tplate_versionsEditor').innerHTML );
|
||||
var _keys = Object.keys( IPB3UAgents.uAgentsData['uagents'] );
|
||||
var _data = {};
|
||||
|
||||
_keys.each( function( i )
|
||||
{
|
||||
if ( IPB3UAgents.uAgentsData['uagents'][ i ]['uagent_id'] == uagent_id )
|
||||
{
|
||||
_data = IPB3UAgents.uAgentsData['uagents'][ i ];
|
||||
_data['uagent_versions'] = IPB3UAgents.uAgentsGroupData[ IPB3UAgents.uAgentsData['uagents'][ i ]['uagent_key'] ]['uagent_versions'];
|
||||
}
|
||||
} );
|
||||
|
||||
var _div = new Element('div', { id: 'tplate_versionsWrapper' } );
|
||||
_div.update( _tplate.evaluate( _data ) );
|
||||
document.body.appendChild( _div );
|
||||
|
||||
ipb.positionCenter( 'tplate_versions_' + uagent_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Save agent version info
|
||||
*/
|
||||
this.saveAgentVersion = function( uagent_id )
|
||||
{
|
||||
/* Update array */
|
||||
IPB3UAgents.uAgentsGroupData[ IPB3UAgents.uAgentsData['uagents'][ uagent_id ]['uagent_key'] ]['uagent_versions'] = $F( 'tplate_versionsBox_' + uagent_id );
|
||||
|
||||
/* Update display */
|
||||
IPB3UAgents.buildGroupAgentsUsedList();
|
||||
|
||||
/* Close any open editors */
|
||||
IPB3UAgents.cancelAgentVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add user agent to the list
|
||||
*/
|
||||
this.groupRemoveFromList = function( uagent_id )
|
||||
{
|
||||
/* Soft delete */
|
||||
IPB3UAgents.uAgentsData['uagents'][ uagent_id ]['_used'] = 0;
|
||||
|
||||
/* Add to add to group array */
|
||||
IPB3UAgents.uAgentsGroupData[ IPB3UAgents.uAgentsData['uagents'][ uagent_id ]['uagent_key'] ]['_hide'] = 1;
|
||||
|
||||
/* Build uagents list */
|
||||
IPB3UAgents.buildGroupAgentList();
|
||||
|
||||
/* Build uagents list that are already in the group */
|
||||
IPB3UAgents.buildGroupAgentsUsedList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add user agent to the list
|
||||
*/
|
||||
this.groupAddToList = function( uagent_id )
|
||||
{
|
||||
/* Soft delete */
|
||||
IPB3UAgents.uAgentsData['uagents'][ uagent_id ]['_used'] = 1;
|
||||
|
||||
/* Add to add to group array */
|
||||
IPB3UAgents.uAgentsGroupData[ IPB3UAgents.uAgentsData['uagents'][ uagent_id ]['uagent_key'] ] = IPB3UAgents.uAgentsData['uagents'][ uagent_id ];
|
||||
IPB3UAgents.uAgentsGroupData[ IPB3UAgents.uAgentsData['uagents'][ uagent_id ]['uagent_key'] ]['_hide'] = 0;
|
||||
|
||||
/* Build uagents list */
|
||||
IPB3UAgents.buildGroupAgentList();
|
||||
|
||||
/* Build uagents list that are already in the group */
|
||||
IPB3UAgents.buildGroupAgentsUsedList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Template Mouse Event
|
||||
*/
|
||||
this.groupMouseEvent = function( e )
|
||||
{
|
||||
if ( _div = $( Event.element( e ) ).up( '.' + IPB3UAgents.cssNames['uagentsGRow'] ) )
|
||||
{
|
||||
var _uagent_id = _div.id.replace( 'tplate_agentrow_', '' );
|
||||
|
||||
if ( e.type == 'mouseover' )
|
||||
{
|
||||
_div.addClassName( IPB3UAgents.cssNames['uagentsGHover'] );
|
||||
}
|
||||
else if ( e.type == 'mouseout' )
|
||||
{
|
||||
_div.removeClassName( IPB3UAgents.cssNames['uagentsGHover'] );
|
||||
}
|
||||
else if ( e.type == 'click' )
|
||||
{
|
||||
IPB3UAgents.groupAddToList( _uagent_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a list of uagents
|
||||
*/
|
||||
this.buildGroupAgentList = function()
|
||||
{
|
||||
/* INIT */
|
||||
var _output = '';
|
||||
var _tplate = new Template( $('tplate_agentRow').innerHTML );
|
||||
var json = IPB3UAgents.uAgentsData;
|
||||
|
||||
var _groups = Object.keys( json['uagents'] );
|
||||
|
||||
/* Clear out any current listing */
|
||||
$('tplate_agentsList').update('');
|
||||
|
||||
/* Format... */
|
||||
_groups.each( function( i )
|
||||
{
|
||||
if ( ! json['uagents'][i]['_used'] )
|
||||
{
|
||||
json['uagents'][i]['_cssClass'] = IPB3UAgents.cssNames['uagentsGRow'];
|
||||
|
||||
_output += _tplate.evaluate( json['uagents'][i] );
|
||||
}
|
||||
} );
|
||||
|
||||
/* Write it out */
|
||||
$('tplate_agentsList').update( _output );
|
||||
|
||||
/* Post process */
|
||||
_groups.each( function( i )
|
||||
{
|
||||
if ( ! json['uagents'][i]['_used'] )
|
||||
{
|
||||
/* Image. Can't use #{...} inline as it parses as HTML entities. Most annoying */
|
||||
$('tplate_agentimg_' + json['uagents'][i]['uagent_id'] ).src += 'type_' + json['uagents'][i]['uagent_type'] + '.png';
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Template comparison
|
||||
* Last Updated: $Date: 2009-02-18 12:02:42 -0500 (Wed, 18 Feb 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since Friday 19th May 2006 17:33
|
||||
* @version $Revision: 4036 $
|
||||
*/
|
||||
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_ajax_compare extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* Skin functions object handle
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $skinFunctions;
|
||||
|
||||
/**
|
||||
* HTML Skin object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $html;
|
||||
|
||||
/**
|
||||
* Main executable
|
||||
*
|
||||
* @access public
|
||||
* @param object registry object
|
||||
* @return void
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load functions and cache classes
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinDifferences.php' );
|
||||
|
||||
$this->skinFunctions = new skinDifferences( $registry );
|
||||
|
||||
//-----------------------------------------
|
||||
// Load lang
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_templates' ), 'core' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Load skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html = $this->registry->output->loadTemplate('cp_skin_templates');
|
||||
|
||||
//-----------------------------------------
|
||||
// What shall we do?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'css':
|
||||
$this->_getCssDifferences();
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'differences':
|
||||
$this->_getDifferences();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get differences of a CSS file
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
private function _getCssDifferences()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Init
|
||||
//-----------------------------------------
|
||||
|
||||
$setID = intval($this->request['setID']);
|
||||
$fileID = intval($this->request['file_id']);
|
||||
|
||||
//-----------------------------------------
|
||||
// Get requested
|
||||
//-----------------------------------------
|
||||
|
||||
$current = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'skin_css', 'where' => 'css_id=' . $fileID ) );
|
||||
|
||||
if( $current['css_id'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get the original
|
||||
//-----------------------------------------
|
||||
|
||||
$original = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'skin_css', 'where' => "css_set_id=0 AND css_group='{$current['css_group']}'" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$original['css_content'] = $current['css_content'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get Diff library
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_KERNEL_PATH . 'classDifference.php' );
|
||||
$classDifference = new classDifference();
|
||||
$classDifference->method = 'PHP';
|
||||
|
||||
|
||||
$difference = $classDifference->getDifferences( $original['css_content'], $current['css_content'] );
|
||||
|
||||
if( $classDifference->diff_found )
|
||||
{
|
||||
$difference = str_replace( "\n", "<br>", $difference );
|
||||
$difference = str_replace( "><", ">\n<" ,$difference );
|
||||
$difference = preg_replace( "#(?<!(\<del|\<ins)) {1}(?!:style)#i", " " ,$difference );
|
||||
$difference = str_replace( "\t", " ", $difference );
|
||||
}
|
||||
else
|
||||
{
|
||||
$difference = htmlspecialchars($current['css_content']);
|
||||
$difference = str_replace( ' ', ' ', $difference );
|
||||
$difference = str_replace( "\r", '<br />', $difference );
|
||||
$difference = str_replace( "\n", '<br />', $difference );
|
||||
$difference = str_replace( "><", ">\n<" ,$difference );
|
||||
$difference = str_replace( "\t", " ", $difference );
|
||||
}
|
||||
|
||||
$this->returnHtml( $this->html->differenceResult( $difference ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get differences of a template
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
private function _getDifferences()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Init
|
||||
//-----------------------------------------
|
||||
|
||||
$setID = intval($this->request['setID']);
|
||||
$templateID = intval($this->request['template_id']);
|
||||
|
||||
//-----------------------------------------
|
||||
// Get requested
|
||||
//-----------------------------------------
|
||||
|
||||
$current = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'skin_templates', 'where' => 'template_id=' . $templateID ) );
|
||||
|
||||
if( $current['template_set_id'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get the original
|
||||
//-----------------------------------------
|
||||
|
||||
$original = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'skin_templates', 'where' => "template_set_id=0 AND template_group='{$current['template_group']}' AND template_name='{$current['template_name']}'" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$original['template_content'] = $current['template_content'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get Diff library
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_KERNEL_PATH . 'classDifference.php' );
|
||||
$classDifference = new classDifference();
|
||||
$classDifference->method = 'PHP';
|
||||
|
||||
|
||||
$difference = $classDifference->getDifferences( $original['template_content'], $current['template_content'] );
|
||||
|
||||
if( $classDifference->diff_found )
|
||||
{
|
||||
$difference = str_replace( "\n", "<br>", $difference );
|
||||
$difference = str_replace( "><", ">\n<" ,$difference );
|
||||
$difference = preg_replace( "#(?<!(\<del|\<ins)) {1}(?!:style)#i", " " ,$difference );
|
||||
$difference = str_replace( "\t", " ", $difference );
|
||||
}
|
||||
else
|
||||
{
|
||||
$difference = htmlspecialchars($current['template_content']);
|
||||
$difference = str_replace( ' ', ' ', $difference );
|
||||
$difference = str_replace( "\r", '<br />', $difference );
|
||||
$difference = str_replace( "\n", '<br />', $difference );
|
||||
$difference = str_replace( "><", ">\n<" ,$difference );
|
||||
$difference = str_replace( "\t", " ", $difference );
|
||||
}
|
||||
|
||||
$this->returnHtml( $this->html->differenceResult( $difference ) );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,278 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* AJAX Functions For applications/core/js/ipb3CSS.js file
|
||||
* Last Updated: $Date: 2009-09-30 10:45:37 -0400 (Wed, 30 Sep 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since Friday 19th May 2006 17:33
|
||||
* @version $Revision: 5183 $
|
||||
*/
|
||||
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_ajax_css extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* Skin functions object handle
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $skinFunctions;
|
||||
|
||||
/**
|
||||
* Main executable
|
||||
*
|
||||
* @access public
|
||||
* @param object registry object
|
||||
* @return void
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$registry->getClass('class_localization')->loadLanguageFile( array( 'admin_templates' ), 'core' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Load functions and cache classes
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
|
||||
$this->skinFunctions = new skinCaching( $registry );
|
||||
|
||||
/* Check... */
|
||||
if ( ! $registry->getClass('class_permissions')->checkPermission( 'css_manage', ipsRegistry::$current_application, 'templates' ) )
|
||||
{
|
||||
$this->returnJsonError( $registry->getClass('class_localization')->words['sk_ajax_noperm'] );
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// What shall we do?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'getCSSGroups':
|
||||
$this->_getCSSGroups();
|
||||
break;
|
||||
case 'getCSSForEdit':
|
||||
$this->_getCSSForEdit();
|
||||
break;
|
||||
case 'saveCSS':
|
||||
$this->_saveCSS();
|
||||
break;
|
||||
case 'revertCSS':
|
||||
/* Check... */
|
||||
if ( !$registry->getClass('class_permissions')->checkPermission( 'css_delete', ipsRegistry::$current_application, 'templates' ) )
|
||||
{
|
||||
$this->returnJsonError( $registry->lang->words['sk_ajax_noperm'] );
|
||||
exit();
|
||||
}
|
||||
$this->_revertCSS();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverts CSS
|
||||
*
|
||||
* @access private
|
||||
* @return string Json
|
||||
*/
|
||||
private function _revertCSS()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$setID = intval( $this->request['setID'] );
|
||||
$cssID = intval( $this->request['css_id'] );
|
||||
$fromDelete = intval( $this->request['fromDelete'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Checks...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $setID OR ! $cssID )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['ajax_missing_data'] );
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get template data
|
||||
//-----------------------------------------
|
||||
|
||||
$css = $this->skinFunctions->revertCSS( $cssID, $setID, $fromDelete );
|
||||
|
||||
$this->returnJsonArray( array( 'cssData' => $css, 'errors' => $this->skinFunctions->fetchErrorMessages() ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the CSS
|
||||
*
|
||||
* @access private
|
||||
* @return string Json
|
||||
*/
|
||||
private function _saveCSS()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$setID = intval( $this->request['setID'] );
|
||||
$cssID = intval( $this->request['css_id'] );
|
||||
$type = ( $this->request['type'] == 'add' ) ? 'add' : 'edit';
|
||||
$css_content = $_POST['css_content'];
|
||||
$css_group = IPSText::alphanumericalClean( $_POST['_css_group'] );
|
||||
$css_position = intval( $this->request['css_position'] );
|
||||
$css_attributes = $_POST['css_attributes'];
|
||||
$css_app = IPSText::alphanumericalClean( $_POST['css_app'] );
|
||||
$css_app_hide = intval( $this->request['css_app_hide'] );
|
||||
$css_modules = trim( $this->request['css_modules'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Checks...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $setID OR ( $type == 'edit' AND ! $cssID ) )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['ajax_missing_data'] );
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add checks
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $type == 'add' )
|
||||
{
|
||||
if ( ! $css_group )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['ajax_missing_data'] );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Save it
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $type == 'edit' )
|
||||
{
|
||||
$css_id = $this->skinFunctions->saveCSSFromEdit( $cssID, $setID, $css_content, $css_group, $css_position, $css_attributes, $css_app, $css_app_hide, $css_modules );
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
$css_id = $this->skinFunctions->saveCSSFromAdd( $setID, $css_content, str_replace( '.css', '', $css_group ), $css_position, $css_attributes, $css_app, $css_app_hide, $css_modules );
|
||||
}
|
||||
catch( Exception $err )
|
||||
{
|
||||
$this->returnJsonError( $err->getMessage() );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get Data
|
||||
//-----------------------------------------
|
||||
|
||||
$css = $this->skinFunctions->fetchCSSForEdit( $css_id, $setID );
|
||||
|
||||
$this->returnJsonArray( array( 'cssData' => $css, 'errors' => $this->skinFunctions->fetchErrorMessages() ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a JSON list of template data ready for editing
|
||||
*
|
||||
* @access private
|
||||
* @return string Json
|
||||
*/
|
||||
private function _getCSSForEdit()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$setID = intval( $this->request['setID'] );
|
||||
$cssID = intval( $this->request['css_id'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Checks...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $setID OR ! $cssID )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['ajax_missing_data'] );
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get template data
|
||||
//-----------------------------------------
|
||||
|
||||
$css = $this->skinFunctions->fetchCSSForEdit( $cssID, $setID );
|
||||
|
||||
$this->returnJsonArray( array( 'cssData' => $css ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a JSON list of CSS group names
|
||||
*
|
||||
* @access private
|
||||
* @return string Json
|
||||
*/
|
||||
private function _getCSSGroups()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$setID = intval( $this->request['setID'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Checks...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $setID )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['ajax_missing_data'] );
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get CSS
|
||||
//-----------------------------------------
|
||||
|
||||
$_css = $this->skinFunctions->fetchCSS( $setID );
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up positioning
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $_css as $_id => $_data )
|
||||
{
|
||||
unset( $_data['css_content'] );
|
||||
$css[ $_data['css_position'] . '.' . $_data['css_id'] ] = $_data;
|
||||
}
|
||||
|
||||
ksort( $css, SORT_NUMERIC );
|
||||
|
||||
$this->returnJsonArray( array( 'css' => $css ) );
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,229 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Live Search
|
||||
* Last Updated: $Date: 2009-09-30 10:45:37 -0400 (Wed, 30 Sep 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 5183 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_ajax_livesearch extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* HTML to output
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $output;
|
||||
|
||||
/**
|
||||
* Skin object
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load skin
|
||||
//-----------------------------------------
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'admin_ajax' ) );
|
||||
$this->html = $this->registry->output->loadTemplate('cp_skin_livesearch');
|
||||
|
||||
/* What to do */
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'search':
|
||||
$this->doSearchRequest();
|
||||
break;
|
||||
|
||||
case 'template':
|
||||
default:
|
||||
$this->getTemplate();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->returnHtml( $this->output );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the live search template
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getTemplate()
|
||||
{
|
||||
$this->output .= $this->html->liveSearchTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the live search
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function doSearchRequest()
|
||||
{
|
||||
/* INI */
|
||||
$search_term = $this->request['search_term'];
|
||||
|
||||
$results = array();
|
||||
$return = array( 'settings' => null, 'location' => null );
|
||||
$max = 20;
|
||||
$count = 0;
|
||||
$secCount = 0;
|
||||
|
||||
/* Do search here */
|
||||
$results = $this->_getSettings( $search_term, $results );
|
||||
|
||||
$results = $this->_getFromXML( $search_term, $results );
|
||||
if( isset( $results['settings'] ) AND is_array( $results['settings'] ) AND count($results['settings']) )
|
||||
{
|
||||
foreach( $results['settings'] as $setting )
|
||||
{
|
||||
$count++;
|
||||
$secCount++;
|
||||
$return['settings'] .= $this->html->searchRowSetting( $setting, $count, $secCount );
|
||||
|
||||
/*if( $count >= $max )
|
||||
{
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
$secCount = 0;
|
||||
|
||||
if( isset( $results['location'] ) AND is_array( $results['location'] ) AND count($results['location']))
|
||||
{
|
||||
foreach( $results['location'] as $location )
|
||||
{
|
||||
$count++;
|
||||
$secCount++;
|
||||
$return['location'] .= $this->html->searchRowLocation( $location, $count, $secCount );
|
||||
|
||||
/*if( $count >= $max )
|
||||
{
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->output .= $this->html->liveSearchDisplay( $return, $search_term );
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches the settings table
|
||||
*
|
||||
* @access private
|
||||
* @param string Search term
|
||||
* @param array Existing search results
|
||||
* @return array New search results
|
||||
*/
|
||||
private function _getSettings( $term, $results )
|
||||
{
|
||||
$term = strtolower($term);
|
||||
|
||||
if( !IN_DEV )
|
||||
{
|
||||
$this->DB->build( array(
|
||||
'select' => 'c.conf_group, c.conf_title, c.conf_description, c.conf_keywords',
|
||||
'from' => array( 'core_sys_conf_settings' => 'c' ),
|
||||
'where' => 't.conf_title_noshow=0 AND (' . $this->DB->buildLower('c.conf_title') . " LIKE '%{$term}%' OR ". $this->DB->buildLower('c.conf_description') . " LIKE '%{$term}%' OR " . $this->DB->buildLower('c.conf_keywords') . " LIKE '%{$term}%')",
|
||||
'add_join' => array(
|
||||
array(
|
||||
'from' => array( 'core_sys_settings_titles' => 't' ),
|
||||
'where' => 't.conf_title_id=c.conf_group',
|
||||
'type' => 'left'
|
||||
)
|
||||
)
|
||||
) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DB->build( array(
|
||||
'select' => 'conf_group, conf_title, conf_description, conf_keywords',
|
||||
'from' => 'core_sys_conf_settings',
|
||||
'where' => $this->DB->buildLower('conf_title') . " LIKE '%{$term}%' OR ". $this->DB->buildLower('conf_description') . " LIKE '%{$term}%' OR " . $this->DB->buildLower('conf_keywords') . " LIKE '%{$term}%'",
|
||||
) );
|
||||
}
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$results['settings'][] = $r;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches the XML Files
|
||||
*
|
||||
* @access private
|
||||
* @param string Search term
|
||||
* @param array Existing search results
|
||||
* @return array New search results
|
||||
*/
|
||||
private function _getFromXML( $term, $results )
|
||||
{
|
||||
foreach( $this->cache->getCache('app_menu_cache') as $app => $cache )
|
||||
{
|
||||
foreach( $cache as $entry )
|
||||
{
|
||||
if( count($entry['items']) )
|
||||
{
|
||||
foreach( $entry['items'] as $item )
|
||||
{
|
||||
if( $item['section'] )
|
||||
{
|
||||
$item['url'] = "section={$item['section']}&" . $item['url'];
|
||||
}
|
||||
|
||||
if( isset($item['keywords']) AND stripos( $item['keywords'], $term ) !== false )
|
||||
{
|
||||
$item['url'] = "&app={$app}&module={$item['module']}&{$item['url']}";
|
||||
$results['location'][] = $item;
|
||||
}
|
||||
else if( stripos( $item['title'], $term ) !== false )
|
||||
{
|
||||
$item['fullurl'] = "&app={$app}&module={$item['module']}&{$item['url']}";
|
||||
$results['location'][] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* AJAX Functions For applications/core/js/ipb3CSS.js file
|
||||
* Last Updated: $Date: 2009-05-15 21:17:56 -0400 (Fri, 15 May 2009) $
|
||||
*
|
||||
* Author: Matt Mecham
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since Friday 19th May 2006 17:33
|
||||
* @version $Revision: 4663 $
|
||||
*/
|
||||
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_ajax_replacements extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* Skin functions object handle
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $skinFunctions;
|
||||
|
||||
/**
|
||||
* Main executable
|
||||
*
|
||||
* @access public
|
||||
* @param object registry object
|
||||
* @return void
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$registry->getClass('class_localization')->loadLanguageFile( array( 'admin_templates' ), 'core' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Load functions and cache classes
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
|
||||
|
||||
$this->skinFunctions = new skinCaching( $registry );
|
||||
|
||||
//-----------------------------------------
|
||||
// What shall we do?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'saveReplacement':
|
||||
/* Check... */
|
||||
if ( !$registry->getClass('class_permissions')->checkPermission( 'replacements_manage', ipsRegistry::$current_application, 'templates' ) )
|
||||
{
|
||||
$this->returnJsonError( $registry->getClass('class_localization')->words['sk_ajax_noperm'] );
|
||||
exit();
|
||||
}
|
||||
$this->_saveReplacement();
|
||||
break;
|
||||
case 'revertReplacement':
|
||||
/* Check... */
|
||||
if ( !$registry->getClass('class_permissions')->checkPermission( 'replacements_delete', ipsRegistry::$current_application, 'templates' ) )
|
||||
{
|
||||
$this->returnJsonError( $registry->getClass('class_localization')->words['sk_ajax_noperm'] );
|
||||
exit();
|
||||
}
|
||||
$this->_revertReplacement();
|
||||
break;
|
||||
|
||||
case 'retrieve':
|
||||
/* Check... */
|
||||
if ( !$registry->getClass('class_permissions')->checkPermission( 'easy_logo', ipsRegistry::$current_application, 'templates' ) )
|
||||
{
|
||||
$this->returnJsonError( $registry->getClass('class_localization')->words['sk_ajax_noperm'] );
|
||||
exit();
|
||||
}
|
||||
$this->getEasyLogo();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get logo image replacement for a skin
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getEasyLogo()
|
||||
{
|
||||
$setID = intval( $this->request['value'] );
|
||||
|
||||
$replacements = $this->skinFunctions->fetchReplacements( $setID );
|
||||
$currentUrl = $replacements['logo_img']['replacement_content'];
|
||||
$currentId = $replacements['logo_img']['replacement_id'];
|
||||
|
||||
$this->returnJsonArray( array( 'url' => $currentUrl, 'id' => $currentId ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverts replacement
|
||||
*
|
||||
* @access private
|
||||
* @return string Json
|
||||
*/
|
||||
private function _revertReplacement()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$setID = intval( $this->request['setID'] );
|
||||
$replacementID = intval( $this->request['replacement_id'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Checks...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $setID OR ! $replacementID )
|
||||
{
|
||||
$this->returnJsonError('Missing Data');
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get template data
|
||||
//-----------------------------------------
|
||||
|
||||
$replacements = $this->skinFunctions->revertReplacement( $replacementID, $setID );
|
||||
|
||||
$this->returnJsonArray( array( 'replacements' => $replacements, 'errors' => $this->skinFunctions->fetchErrorMessages() ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the CSS
|
||||
*
|
||||
* @access private
|
||||
* @return string Json
|
||||
*/
|
||||
private function _saveReplacement()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$setID = intval( $this->request['setID'] );
|
||||
$replacementID = intval( $this->request['replacement_id'] );
|
||||
$type = ( $this->request['type'] == 'add' ) ? 'add' : 'edit';
|
||||
$replacement_content = $this->convertUnicode( $_POST['replacement_content'] );
|
||||
$replacement_key = $this->convertUnicode( $_POST['_replacement_key'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Checks...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $setID OR ( $type == 'edit' AND ! $replacementID ) )
|
||||
{
|
||||
$this->returnJsonError('Missing Data');
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add checks
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $type == 'add' )
|
||||
{
|
||||
if ( ! $replacement_key )
|
||||
{
|
||||
$this->returnJsonError('Missing Data');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Save it
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $type == 'edit' )
|
||||
{
|
||||
$css_id = $this->skinFunctions->saveReplacementFromEdit( $replacementID, $setID, $replacement_content, $replacement_key );
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
$css_id = $this->skinFunctions->saveReplacementFromAdd( $setID, $replacement_content, $replacement_key );
|
||||
}
|
||||
catch( Exception $err )
|
||||
{
|
||||
$this->returnJsonError( $err->getMessage() );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get Data
|
||||
//-----------------------------------------
|
||||
|
||||
$replacements = $this->skinFunctions->fetchReplacements( $setID );
|
||||
|
||||
$this->returnJsonArray( array( 'replacements' => $replacements, 'errors' => $this->skinFunctions->fetchErrorMessages() ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* AJAX Functions For applications/core/js/ipb3Templates.js file
|
||||
* Last Updated: $Date: 2009-05-15 21:17:56 -0400 (Fri, 15 May 2009) $
|
||||
*
|
||||
* Author: Matt Mecham
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since Friday 19th May 2006 17:33
|
||||
* @version $Revision: 4663 $
|
||||
*/
|
||||
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_ajax_templatediff extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* Skin functions object handle
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $skinFunctions;
|
||||
|
||||
/**
|
||||
* Main executable
|
||||
*
|
||||
* @access public
|
||||
* @param object registry object
|
||||
* @return void
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$registry->getClass('class_localization')->loadLanguageFile( array( 'admin_templates' ), 'core' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Load functions and cache classes
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinDifferences.php' );
|
||||
|
||||
$this->skinFunctions = new skinDifferences( $registry );
|
||||
|
||||
/* Check... */
|
||||
if ( !$registry->getClass('class_permissions')->checkPermission( 'skindiff_reports', ipsRegistry::$current_application, 'templates' ) )
|
||||
{
|
||||
$this->returnJsonError( $registry->getClass('class_localization')->words['sk_ajax_noperm'] );
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// What shall we do?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
default:
|
||||
case 'process':
|
||||
$this->_process();
|
||||
break;
|
||||
case 'viewDiff':
|
||||
$this->_viewDiff();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab a diff to show
|
||||
*
|
||||
* @access private
|
||||
* @return string JSON
|
||||
*/
|
||||
private function _viewDiff()
|
||||
{
|
||||
$key = trim( $this->request['key'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get data
|
||||
//-----------------------------------------
|
||||
|
||||
$diff_row = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'template_diff_changes',
|
||||
'where' => "diff_change_key='" . $this->DB->addslashes($key) . "'" ) );
|
||||
|
||||
|
||||
if ( ! $diff_row['diff_change_key'] )
|
||||
{
|
||||
$this->returnJsonError('No Key Found');
|
||||
exit();
|
||||
}
|
||||
|
||||
$diff_row['diff_change_content'] = str_replace( "\n", "<br>", $diff_row['diff_change_content']);
|
||||
$diff_row['diff_change_content'] = str_replace( "><", ">\n<" ,$diff_row['diff_change_content']);
|
||||
$diff_row['diff_change_content'] = preg_replace( "#(?<!(\<del|\<ins)) {1}(?!:style)#i", " " ,$diff_row['diff_change_content']);
|
||||
$diff_row['diff_change_content'] = str_replace( "\t", " ", $diff_row['diff_change_content'] );
|
||||
|
||||
$this->returnJsonArray( $diff_row );
|
||||
}
|
||||
|
||||
/**
|
||||
* Process
|
||||
*
|
||||
* @access private
|
||||
* @return string Json
|
||||
*/
|
||||
private function _process()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$pergo = intval( $this->request['perGo'] ) ? intval( $this->request['perGo'] ) : 10;
|
||||
$diffSessionID = intval( $this->request['sessionID'] );
|
||||
$completed = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Fetch current session
|
||||
//-----------------------------------------
|
||||
|
||||
$session = $this->skinFunctions->fetchSession( $diffSessionID );
|
||||
|
||||
if ( $session === FALSE )
|
||||
{
|
||||
$this->returnJsonError('Could not locate a valid differences session');
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get Diff library
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_KERNEL_PATH . 'classDifference.php' );
|
||||
$classDifference = new classDifference();
|
||||
$classDifference->method = 'PHP';
|
||||
|
||||
//-----------------------------------------
|
||||
// Get template bits to check
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'skin_templates',
|
||||
'where' => 'template_set_id=0',
|
||||
'order' => 'template_id ASC',
|
||||
'limit' => array( intval( $session['diff_session_done'] ), intval( $pergo ) ) ) );
|
||||
|
||||
$outer = $this->DB->execute();
|
||||
|
||||
if ( ! $this->DB->getTotalRows( $outer ) )
|
||||
{
|
||||
$completed = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
while( $row = $this->DB->fetch( $outer ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get corresponding row from diff table
|
||||
//-----------------------------------------
|
||||
|
||||
$diff_row = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'templates_diff_import',
|
||||
'where' => "diff_func_group='{$row['template_group']}' AND diff_func_name='{$row['template_name']}' AND diff_session_id=".$diffSessionID ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Got anything?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $diff_row['diff_key'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get difference
|
||||
//-----------------------------------------
|
||||
|
||||
$difference = $classDifference->getDifferences( $diff_row['diff_func_content'], $row['template_content'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Got any differences?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $classDifference->diff_found )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get corresponding row from diff table
|
||||
//-----------------------------------------
|
||||
|
||||
$diff_check = $this->DB->buildAndFetch( array( 'select' => 'diff_change_key',
|
||||
'from' => 'template_diff_changes',
|
||||
'where' => "diff_change_key='" . $diffSessionID.':'.$row['template_group'].':'.$row['template_name'] . "'" ) );
|
||||
|
||||
if ( $diff_check['diff_change_key'] )
|
||||
{
|
||||
$this->DB->update( 'template_diff_changes', array( 'diff_change_func_group' => $row['template_group'],
|
||||
'diff_change_func_name' => $row['template_name'],
|
||||
'diff_change_content' => $difference,
|
||||
'diff_change_type' => 1,
|
||||
'diff_session_id' => $diffSessionID ),
|
||||
"diff_change_key='" . $diffSessionID.':'.$row['template_group'].':'.$row['template_name'] . "'" );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DB->insert( 'template_diff_changes', array( 'diff_change_key' => $diffSessionID.':'.$row['template_group'].':'.$row['template_name'],
|
||||
'diff_change_func_group' => $row['template_group'],
|
||||
'diff_change_func_name' => $row['template_name'],
|
||||
'diff_change_content' => $difference,
|
||||
'diff_change_type' => 1,
|
||||
'diff_session_id' => $diffSessionID ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! $session['diff_session_ignore_missing'] )
|
||||
{
|
||||
$this->DB->insert( 'template_diff_changes', array( 'diff_change_key' => $diffSessionID.':'.$row['template_group'].':'.$row['template_name'],
|
||||
'diff_change_func_group' => $row['template_group'],
|
||||
'diff_change_func_name' => $row['template_name'],
|
||||
'diff_change_content' => htmlspecialchars($row['template_content']),
|
||||
'diff_change_type' => 0,
|
||||
'diff_session_id' => $diffSessionID ) );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Increment
|
||||
//-----------------------------------------
|
||||
|
||||
$session['diff_session_done']++;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update current session
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->update( 'template_diff_session', array( 'diff_session_done' => intval( $session['diff_session_done'] ) ), 'diff_session_id='.$diffSessionID );
|
||||
|
||||
//-----------------------------------------
|
||||
// Done or more?
|
||||
//-----------------------------------------
|
||||
|
||||
$this->returnJsonArray( array( 'processed' => $session['diff_session_done'], 'completed' => $completed, 'message' => $session['diff_session_done'] . ' template bits processed...' ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,331 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* AJAX Functions For applications/core/js/ipb3Templates.js file
|
||||
* Last Updated: $Date: 2009-09-21 18:02:56 -0400 (Mon, 21 Sep 2009) $
|
||||
*
|
||||
* Author: Matt Mecham
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since Friday 19th May 2006 17:33
|
||||
* @version $Revision: 5135 $
|
||||
*/
|
||||
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_ajax_templates extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* Skin functions object handle
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $skinFunctions;
|
||||
|
||||
/**
|
||||
* Main executable
|
||||
*
|
||||
* @access public
|
||||
* @param object registry object
|
||||
* @return void
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$registry->getClass('class_localization')->loadLanguageFile( array( 'admin_templates' ), 'core' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Load functions and cache classes
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
|
||||
|
||||
$this->skinFunctions = new skinCaching( $registry );
|
||||
|
||||
/* Check... */
|
||||
if ( !$registry->getClass('class_permissions')->checkPermission( 'templates_manage', ipsRegistry::$current_application, 'templates' ) )
|
||||
{
|
||||
$this->returnJsonError( $registry->getClass('class_localization')->words['sk_ajax_noperm'] );
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// What shall we do?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'getTemplateBitList':
|
||||
$this->_getTemplateBitList();
|
||||
break;
|
||||
case 'getTemplateGroupList':
|
||||
$this->_getTemplateGroupList();
|
||||
break;
|
||||
case 'getTemplateForEdit':
|
||||
$this->_getTemplateForEdit();
|
||||
break;
|
||||
case 'saveTemplateBit':
|
||||
$this->_saveTemplateBit();
|
||||
break;
|
||||
case 'revertTemplateBit':
|
||||
/* Check... */
|
||||
if ( !$registry->getClass('class_permissions')->checkPermission( 'templates_delete', ipsRegistry::$current_application, 'templates' ) )
|
||||
{
|
||||
$this->returnJsonError( $registry->getClass('class_localization')->words['sk_ajax_noperm'] );
|
||||
exit();
|
||||
}
|
||||
$this->_revertTemplateBit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverts a template bit
|
||||
*
|
||||
* @access private
|
||||
* @return string Json
|
||||
*/
|
||||
private function _revertTemplateBit()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$setID = intval( $this->request['setID'] );
|
||||
$templateID = intval( $this->request['template_id'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Checks...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $setID OR ! $templateID )
|
||||
{
|
||||
$this->returnJsonError('Missing Data');
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get template data
|
||||
//-----------------------------------------
|
||||
|
||||
$template = $this->skinFunctions->revertTemplateBit( $templateID, $setID );
|
||||
|
||||
$this->returnJsonArray( array( 'templateData' => $template, 'errors' => $this->skinFunctions->fetchErrorMessages() ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the template bit
|
||||
*
|
||||
* @access private
|
||||
* @return string Json
|
||||
*/
|
||||
private function _saveTemplateBit()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$test = $_POST['_template_name'];
|
||||
$setID = intval( $this->request['template_set'] );
|
||||
$templateID = intval( $this->request['template_id'] );
|
||||
$type = ( $this->request['type'] == 'add' ) ? 'add' : 'edit';
|
||||
$template_content = $_POST['template_content'];
|
||||
$template_group = IPSText::alphanumericalClean( $_POST['template_group'] );
|
||||
$ent_template_group = str_replace( "skin_", "", IPSText::alphanumericalClean( $_POST['_template_group'] ) );
|
||||
$template_name = IPSText::alphanumericalClean( $_POST['_template_name'] );
|
||||
$template_data = $_POST['template_data'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Checks...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $setID OR ( $type == 'edit' AND ! $templateID ) )
|
||||
{
|
||||
$this->returnJsonError('Missing Data');
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add checks
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $type == 'add' )
|
||||
{
|
||||
if ( ! $template_name )
|
||||
{
|
||||
$this->returnJsonError('Missing Data');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Save it
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $type == 'edit' )
|
||||
{
|
||||
try
|
||||
{
|
||||
$template_id = $this->skinFunctions->saveTemplateBitFromEdit( $templateID, $setID, $template_content, $template_data );
|
||||
}
|
||||
catch( Exception $err )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words[ 'templates_' . $err->getMessage() ] ? $this->lang->words[ 'templates_' . $err->getMessage() ] : $err->getMessage() );//. ' ' . implode( "\n", $this->skinFunctions->fetchMessages() ) );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$template_group = ( $ent_template_group ) ? 'skin_' . $ent_template_group : $template_group;
|
||||
|
||||
try
|
||||
{
|
||||
$template_id = $this->skinFunctions->saveTemplateBitFromAdd( $setID, $template_content, $template_data, $template_group, $template_name );
|
||||
}
|
||||
catch( Exception $err )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words[ 'templates_' . $err->getMessage() ] ? $this->lang->words[ 'templates_' . $err->getMessage() ] : $err->getMessage() );// . ' ' . implode( "\n", $this->skinFunctions->fetchMessages() ) );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Fetch new data and return
|
||||
//-----------------------------------------
|
||||
|
||||
$template = $this->skinFunctions->fetchTemplateBitForEdit( $template_id, $setID );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get Data
|
||||
//-----------------------------------------
|
||||
|
||||
$this->returnJsonArray( array( 'templateData' => $template, 'errors' => $this->skinFunctions->fetchErrorMessages() ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a JSON list of template data ready for editing
|
||||
*
|
||||
* @access private
|
||||
* @return string Json
|
||||
*/
|
||||
private function _getTemplateForEdit()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$setID = intval( $this->request['setID'] );
|
||||
$templateID = intval( $this->request['template_id'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Checks...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $setID OR ! $templateID )
|
||||
{
|
||||
$this->returnJsonError('Missing Data');
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get template data
|
||||
//-----------------------------------------
|
||||
|
||||
$template = $this->skinFunctions->fetchTemplateBitForEdit( $templateID, $setID );
|
||||
|
||||
$this->returnJsonArray( array( 'templateData' => $template ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a JSON list of template groups
|
||||
*
|
||||
* @access private
|
||||
* @return string Json
|
||||
*/
|
||||
private function _getTemplateGroupList()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$setID = intval( $this->request['setID'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Checks...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $setID )
|
||||
{
|
||||
$this->returnJsonError('Missing Data');
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get templates
|
||||
//-----------------------------------------
|
||||
|
||||
$templateGroups = $this->skinFunctions->fetchTemplates( $setID, 'groupNames' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Add in group counts
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $templateGroups as $name => $data )
|
||||
{
|
||||
$templateGroups[ $name ]['_modCount'] = $this->skinFunctions->fetchModifiedTemplateCount( $setID, $name );
|
||||
unset( $templateGroups[ $name ]['template_name'] );
|
||||
unset( $templateGroups[ $name ]['template_data'] );
|
||||
unset( $templateGroups[ $name ]['template_content'] );
|
||||
}
|
||||
|
||||
$this->returnJsonArray( array( 'groups' => $templateGroups ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a JSON list of template bits for the template group
|
||||
*
|
||||
* @access private
|
||||
* @return string Json
|
||||
*/
|
||||
private function _getTemplateBitList()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$setID = intval( $this->request['setID'] );
|
||||
$templateGroup = IPSText::alphanumericalClean( $this->request['templateGroup'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Checks...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $setID OR ! $templateGroup )
|
||||
{
|
||||
$this->returnJsonError('Missing Data');
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get templates
|
||||
//-----------------------------------------
|
||||
|
||||
$templates = $this->skinFunctions->fetchTemplates( $setID, 'groupTemplatesNoContent', $templateGroup );
|
||||
|
||||
$this->returnJsonArray( array( 'templates' => array_values( $templates ),
|
||||
'groupData' => array( '_modCount' => $this->skinFunctions->fetchModifiedTemplateCount( $setID, $templateGroup ) ) ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* AJAX Functions For applications/core/js/ipb3Templates.js file
|
||||
* Last Updated: $Date: 2009-05-15 21:17:56 -0400 (Fri, 15 May 2009) $
|
||||
*
|
||||
* Author: Matt Mecham
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since Friday 19th May 2006 17:33
|
||||
* @version $Revision: 4663 $
|
||||
*/
|
||||
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_ajax_templatesandr extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* Skin functions object handle
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $skinFunctions;
|
||||
|
||||
/**
|
||||
* Main executable
|
||||
*
|
||||
* @access public
|
||||
* @param object registry object
|
||||
* @return void
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$registry->getClass('class_localization')->loadLanguageFile( array( 'admin_templates' ), 'core' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Load functions and cache classes
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinDifferences.php' );
|
||||
|
||||
$this->skinFunctions = new skinDifferences( $registry );
|
||||
|
||||
/* Check... */
|
||||
if ( !$registry->getClass('class_permissions')->checkPermission( 'templates_manage', ipsRegistry::$current_application, 'templates' ) )
|
||||
{
|
||||
$this->returnJsonError( $registry->getClass('class_localization')->words['sk_ajax_noperm'] );
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// What shall we do?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
default:
|
||||
case 'getTemplateBitList':
|
||||
$this->_getTemplateBitList();
|
||||
break;
|
||||
case 'replace':
|
||||
$this->_replace();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a JSON list of template bits for the template group
|
||||
*
|
||||
* @access private
|
||||
* @return string Json
|
||||
*/
|
||||
private function _replace()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$finalIDs = array();
|
||||
$templates = array();
|
||||
$sessionID = IPSText::md5Clean( $this->request['sessionID'] );
|
||||
|
||||
$sessionData = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'template_sandr',
|
||||
'where' => "sandr_session_id='" . addslashes( $sessionID ) ."'" ) );
|
||||
|
||||
$templateData = unserialize( $sessionData['sandr_results'] );
|
||||
|
||||
if ( is_array( $templateData ) )
|
||||
{
|
||||
foreach( $templateData as $_group => $_data )
|
||||
{
|
||||
if ( isset( $_POST['groups'][ $_group ] ) AND $_POST['groups'][ $_group ] )
|
||||
{
|
||||
foreach( $_data as $_name => $_id )
|
||||
{
|
||||
$finalIDs[] = $_id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach( $_data as $_name => $_id )
|
||||
{
|
||||
if ( isset( $_POST['templates'][ $_id ] ) AND $_POST['templates'][ $_id ] )
|
||||
{
|
||||
$finalIDs[] = $_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check... */
|
||||
if ( ! count( $finalIDs ) )
|
||||
{
|
||||
$this->returnJsonError('Missing Data');
|
||||
exit();
|
||||
}
|
||||
|
||||
/* Load templates */
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'skin_templates',
|
||||
'where' => 'template_id IN ('. implode( ',', $finalIDs ) . ')' ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
$templates[ $row['template_id'] ] = $row;
|
||||
}
|
||||
|
||||
/* Perform the replacement */
|
||||
foreach( $templates as $template_id => $template )
|
||||
{
|
||||
if ( $sessionData['sandr_is_regex'] )
|
||||
{
|
||||
$before = str_replace( '#', '\#', IPSText::stripslashes( $sessionData['sandr_search_for'] ) );
|
||||
$after = preg_replace( '#\\\\\\\\(\d+?)#i', '$\\1', $sessionData['sandr_replace_with'] );
|
||||
|
||||
$template['template_content'] = preg_replace( "#{$before}#si", $after, $template['template_content'] );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$template['template_content'] = str_ireplace( $sessionData['sandr_search_for'], $sessionData['sandr_replace_with'], $template['template_content'] );
|
||||
}
|
||||
|
||||
/* Save it */
|
||||
$this->skinFunctions->saveTemplateBitFromEdit( $template['template_id'], $sessionData['sandr_set_id'], $template['template_content'], $template['template_data'] );
|
||||
}
|
||||
|
||||
/* Done */
|
||||
$this->returnJsonArray( array( 'status' => 'ok' ) );
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a JSON list of template bits for the template group
|
||||
*
|
||||
* @access private
|
||||
* @return string Json
|
||||
*/
|
||||
private function _getTemplateBitList()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$setID = intval( $this->request['setID'] );
|
||||
$templateGroup = IPSText::alphanumericalClean( $this->request['templateGroup'] );
|
||||
$sessionID = IPSText::md5Clean( $this->request['sessionID'] );
|
||||
$templates = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Checks...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $setID OR ! $templateGroup or ! $sessionID )
|
||||
{
|
||||
$this->returnJsonError('Missing Data');
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get templates
|
||||
//-----------------------------------------
|
||||
|
||||
$sessionData = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'template_sandr',
|
||||
'where' => "sandr_session_id='" . addslashes( $sessionID ) ."'" ) );
|
||||
|
||||
$templateIDs = unserialize( $sessionData['sandr_results'] );
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'skin_templates',
|
||||
'where' => 'template_id IN ('. implode( ',', array_values( $templateIDs[ $templateGroup] ) ) . ')' ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
unset( $row['template_content'] );
|
||||
$templates[] = $row;
|
||||
}
|
||||
|
||||
$this->returnJsonArray( array( 'templates' => $templates ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* AJAX Functions For applications/core/js/ipb3CSS.js file
|
||||
* Last Updated: $Date: 2009-07-06 21:23:35 -0400 (Mon, 06 Jul 2009) $
|
||||
*
|
||||
* Author: Matt Mecham
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since Friday 19th May 2006 17:33
|
||||
* @version $Revision: 4843 $
|
||||
*/
|
||||
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_ajax_uagents extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* User agent functions
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $userAgentFunctions;
|
||||
|
||||
/**
|
||||
* Main executable
|
||||
*
|
||||
* @access public
|
||||
* @param object registry object
|
||||
* @return void
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$registry->getClass('class_localization')->loadLanguageFile( array( 'admin_templates' ), 'core' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Load functions and cache classes
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/useragents/userAgentFunctions.php' );
|
||||
|
||||
$this->userAgentFunctions = new userAgentFunctions( $registry );
|
||||
|
||||
//-----------------------------------------
|
||||
// What shall we do?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'saveuAgent':
|
||||
if ( !$registry->getClass('class_permissions')->checkPermission( 'ua_manage', ipsRegistry::$current_application, 'tools' ) )
|
||||
{
|
||||
$this->returnJsonError( $registry->getClass('class_localization')->words['sk_ajax_noperm'] );
|
||||
exit();
|
||||
}
|
||||
$this->_saveuAgent();
|
||||
break;
|
||||
case 'removeuAgent':
|
||||
if ( !$registry->getClass('class_permissions')->checkPermission( 'ua_remove', ipsRegistry::$current_application, 'tools' ) )
|
||||
{
|
||||
$this->returnJsonError( $registry->getClass('class_localization')->words['sk_ajax_noperm'] );
|
||||
exit();
|
||||
}
|
||||
$this->_removeuAgent();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverts replacement
|
||||
*
|
||||
* @access private
|
||||
* @return string Json
|
||||
*/
|
||||
private function _removeuAgent()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$uagent_id = intval( $this->request['uagent_id'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Checks...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $uagent_id )
|
||||
{
|
||||
$this->returnJsonError('Missing Data');
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get template data
|
||||
//-----------------------------------------
|
||||
|
||||
$userAgents = $this->userAgentFunctions->removeUserAgent( $uagent_id );
|
||||
|
||||
$this->returnJsonArray( array( 'uagents' => $userAgents, 'errors' => $this->userAgentFunctions->fetchErrorMessages() ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the user agent
|
||||
*
|
||||
* @access private
|
||||
* @return string Json
|
||||
*/
|
||||
private function _saveuAgent()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$uagent_id = intval( $this->request['uagent_id'] );
|
||||
$uagent_key = IPSText::alphanumericalClean( $this->request['uagent_key'] );
|
||||
$uagent_name = $this->convertAndMakeSafe( $_POST['uagent_name'] );
|
||||
$uagent_regex = $this->convertUnicode( $_POST['uagent_regex'] );
|
||||
$uagent_regex_capture = intval( $this->request['uagent_regex_capture'] );
|
||||
$uagent_type = IPSText::alphanumericalClean( $this->request['uagent_type'] );
|
||||
$uagent_position = intval( $this->request['uagent_position'] );
|
||||
$type = $this->request['type'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Checks...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $type == 'edit' AND ! $uagent_id )
|
||||
{
|
||||
$this->returnJsonError('Missing Data');
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Other checks
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $uagent_key OR ! $uagent_name OR ! $uagent_regex OR ! $uagent_type )
|
||||
{
|
||||
$this->returnJsonError('Missing Data');
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Save it
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $type == 'edit' )
|
||||
{
|
||||
try
|
||||
{
|
||||
$userAgentID = $this->userAgentFunctions->saveUserAgentFromEdit( $uagent_id, $uagent_key, $uagent_name, $uagent_regex, $uagent_regex_capture, $uagent_type, $uagent_position );
|
||||
}
|
||||
catch( Exception $err )
|
||||
{
|
||||
$this->returnJsonError( $err->getMessage() . ' ' . str_replace( "\n", "\\n", implode( ",", $this->userAgentFunctions->fetchMessages() ) ) );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
$userAgentID = $this->userAgentFunctions->saveUserAgentFromAdd( $uagent_key, $uagent_name, $uagent_regex, $uagent_regex_capture, $uagent_type, $uagent_position );
|
||||
}
|
||||
catch( Exception $err )
|
||||
{
|
||||
$this->returnJsonError( $err->getMessage() );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get Data
|
||||
//-----------------------------------------
|
||||
|
||||
$userAgents = $this->userAgentFunctions->fetchAgents();
|
||||
|
||||
$this->returnJsonArray( array( 'uagents' => $userAgents, 'returnid' => $userAgentID, 'errors' => $this->userAgentFunctions->fetchErrorMessages() ) );
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Blog Application
|
||||
* Last Updated: $Date: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 27th Aug 2004
|
||||
* @version $Revision: 3887 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_applications_blog extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'purchase_app' );
|
||||
|
||||
$this->registry->output->showInsideIframe("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Download Manager Application
|
||||
* Last Updated: $Date: 2009-02-12 13:32:01 -0500 (Thu, 12 Feb 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 17 February 2003
|
||||
* @version $Revision: 3944 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_applications_copyright extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* HTML skin
|
||||
*
|
||||
* @access public
|
||||
* @var object Skin file
|
||||
*/
|
||||
public $html;
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'purchase_app' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Load HTML
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html = $this->registry->output->loadTemplate( 'cp_skin_applications' );
|
||||
|
||||
$this->registry->getClass( 'class_localization' )->loadLanguageFile( array( 'admin_applications' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$this->form_code = $this->html->form_code = 'module=applications&section=copyright';
|
||||
$this->form_code_js = $this->html->form_code_js = 'module=applications§ion=copyright';
|
||||
|
||||
//-----------------------------------------
|
||||
// Just redirect to the setting
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->silentRedirect( $this->settings['base_url'] . 'app=core&module=tools§ion=settings&do=setting_view&conf_title_keyword=ipbcopyright' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Define the default applications section
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'applications';
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Download Manager Application
|
||||
* Last Updated: $Date: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since Who knows...
|
||||
* @version $Revision: 3887 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_applications_downloads extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'purchase_app' );
|
||||
|
||||
$this->registry->output->showInsideIframe("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Gallery Application
|
||||
* Last Updated: $Date: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since Who knows...
|
||||
* @version $Revision: 3887 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_applications_gallery extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'purchase_app' );
|
||||
|
||||
$this->registry->output->showInsideIframe("");
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<menu>
|
||||
<tabitems>
|
||||
<item>
|
||||
<title>Управление модулями</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Список модулей</subitemtitle>
|
||||
<subsection>applications</subsection>
|
||||
<subitemurl>do=applications_overview</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>Управление модификациями (hooks)</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Список модификаций</subitemtitle>
|
||||
<subsection>hooks</subsection>
|
||||
<subitemurl>do=hooks_overview</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
</tabitems>
|
||||
</menu>
|
||||
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<permissions>
|
||||
<group>
|
||||
<grouptitle>Управление приложениями</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>app_manage</key>
|
||||
<string>Может изменять/добавлять приложения?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>app_delete</key>
|
||||
<string>Может удалять приложения?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>app_install</key>
|
||||
<string>Может устанавливать новые приложения?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>build_sphinx</key>
|
||||
<string>Может создавать sphinx.conf? ВНИМАНИЕ: будут доступны данные для соединения с базой данных</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
<group>
|
||||
<grouptitle>Управление модулями</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>module_manage</key>
|
||||
<string>Может изменять/добавлять модули?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>module_delete</key>
|
||||
<string>Может удалять модули приложений?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
<group>
|
||||
<grouptitle>Покупка приложений</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>purchase_app</key>
|
||||
<string>Может просматривать страницу с платными приложениями?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
<group>
|
||||
<grouptitle>Управление модификациями</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>hooks_manage</key>
|
||||
<string>Может добавлять/изменять модификации?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>hooks_delete</key>
|
||||
<string>Может удалять модификации?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
</permissions>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Define the default diagnostics section
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'diagnostics';
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<menu>
|
||||
<tabitems>
|
||||
<item>
|
||||
<title>Состояние системы</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Обзор системы</subitemtitle>
|
||||
<subsection>diagnostics</subsection>
|
||||
<subitemurl></subitemurl>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Проверка версий файлов</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Проверка версий файлов</subitemtitle>
|
||||
<subsection>diagnostics</subsection>
|
||||
<subitemurl>do=fileversions</subitemurl>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Проверка лишних пробелов</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Поиск файлов содержащих лишние пробелы</subitemtitle>
|
||||
<subsection>diagnostics</subsection>
|
||||
<subitemurl>do=whitespace</subitemurl>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Проверка прав файлов</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Проверка прав доступа к файлам</subitemtitle>
|
||||
<subsection>diagnostics</subsection>
|
||||
<subitemurl>do=filepermissions</subitemurl>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Проверка структуры базы</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Проверка структуры базы дынных</subitemtitle>
|
||||
<subsection>diagnostics</subsection>
|
||||
<subitemurl>do=dbchecker</subitemurl>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Проверка индексов базы</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Проверка индексов базы данных</subitemtitle>
|
||||
<subsection>diagnostics</subsection>
|
||||
<subitemurl>do=dbindex</subitemurl>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
</tabitems>
|
||||
</menu>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<permissions>
|
||||
<group>
|
||||
<grouptitle>Инструменты диагностики</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>index_checker</key>
|
||||
<string>Может проверять индексы таблиц базы? Внимание: позволяет выполнять запросы к базе.</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>database_checker</key>
|
||||
<string>Может использовать проверку базы данных? Внимание: позволяет выполнять запросы к базе.</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>whitespace_checker</key>
|
||||
<string>Может проверять файлы на лишние пробелы?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>version_checker</key>
|
||||
<string>Может проверять файлы на правильность версии?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>permission_checker</key>
|
||||
<string>Может проверять файлы и директории на правильность расстановки прав доступа?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
</permissions>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Define the default help section
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'quickhelp';
|
||||
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Quick help - shows popups with help information
|
||||
* Last Updated: $Date: 2009-02-26 18:25:15 -0500 (Thu, 26 Feb 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 1st march 2002
|
||||
* @version $Revision: 4115 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_help_quickhelp extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Array of help text
|
||||
*
|
||||
* @access private
|
||||
* @var array Help texts
|
||||
*/
|
||||
private $help_text = array();
|
||||
|
||||
/**
|
||||
* Initialize the help text array
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _initText()
|
||||
{
|
||||
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_system' ) );
|
||||
|
||||
return array( 'mg_dohtml' => array( 'title' => $this->lang->words['q_html'],
|
||||
'body' => $this->lang->words['q_html_info'],
|
||||
),
|
||||
|
||||
'mod_mmod' => array( 'title' => $this->lang->words['q_multi'],
|
||||
'body' => $this->lang->words['q_multi_info'],
|
||||
),
|
||||
|
||||
'set_spider' => array( 'title' => $this->lang->words['q_bots'],
|
||||
'body' => $this->lang->words['q_bots_info'],
|
||||
),
|
||||
|
||||
'mg_upload' => array( 'title' => $this->lang->words['q_upload'],
|
||||
'body' => $this->lang->words['q_upload_info'],
|
||||
),
|
||||
|
||||
|
||||
'mg_promote' => array( 'title' => $this->lang->words['q_promote'],
|
||||
'body' => $this->lang->words['q_promote_info'],
|
||||
),
|
||||
's_reg_antispam' => array ( 'title' => $this->lang->words['q_captcha'],
|
||||
'body' => $this->lang->words['q_captcha_info'],
|
||||
),
|
||||
|
||||
'm_bulkemail' => array ( 'title' => $this->lang->words['q_bulk'],
|
||||
'body' => $this->lang->words['q_bulk_info'],
|
||||
),
|
||||
'comp_menu' => array ( 'title' => $this->lang->words['q_components'],
|
||||
'body' => $this->lang->words['q_components_info'],
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$id = $this->request['id'];
|
||||
/**
|
||||
* Èçìåíåíèå ðåäèðåêòà, ïðåäëîæåíî(çà ÷òî åìó áîëüøîå ñïàñèáî :)) $iD
|
||||
|
||||
if( $this->request['do'] == 'redirect' )
|
||||
{
|
||||
$this->_redirect( $id );
|
||||
}
|
||||
*/
|
||||
|
||||
$this->help_text = $this->_initText();
|
||||
|
||||
if ($this->help_text[ $id ]['title'] == "")
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['q_nohelp'], 11148 );
|
||||
}
|
||||
|
||||
$this->registry->output->html .= $this->registry->output->global_template->quickHelp( $this->help_text[$id]['title'], $this->help_text[$id]['body'] );
|
||||
|
||||
$this->registry->output->printPopupWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect offsite for more help/options
|
||||
*
|
||||
* @access private
|
||||
* @param string 'key' to redirect to
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
/**
|
||||
* Èçìåíåíèå ðåäèðåêòà, ïðåäëîæåíî(çà ÷òî åìó áîëüøîå ñïàñèáî :)) $iD
|
||||
|
||||
private function _redirect( $id )
|
||||
{
|
||||
switch( $id )
|
||||
{
|
||||
case 'docs':
|
||||
$url = "";
|
||||
break;
|
||||
|
||||
case 'kb':
|
||||
$url = "";
|
||||
break;
|
||||
|
||||
case 'resources':
|
||||
$url = "";
|
||||
break;
|
||||
|
||||
case 'contact':
|
||||
$url = "";
|
||||
break;
|
||||
|
||||
case 'features':
|
||||
$url = "";
|
||||
break;
|
||||
|
||||
case 'bugs':
|
||||
$url = "";
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'support':
|
||||
$url = "";
|
||||
break;
|
||||
}
|
||||
|
||||
$this->registry->output->silentRedirect( $url );
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<menu>
|
||||
<tabitems>
|
||||
<item>
|
||||
<title>Документация</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Документация</subitemtitle>
|
||||
<subsection>quickhelp</subsection>
|
||||
<subitemurl>do=redirect&id=docs</subitemurl>
|
||||
<subisredirect>1</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>База знаний</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>База знаний</subitemtitle>
|
||||
<subsection>quickhelp</subsection>
|
||||
<subitemurl>do=redirect&id=kb</subitemurl>
|
||||
<subisredirect>1</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Тех. поддержка</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Техническая поддержка</subitemtitle>
|
||||
<subsection>quickhelp</subsection>
|
||||
<subitemurl>do=redirect&id=support</subitemurl>
|
||||
<subisredirect>1</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Форумы</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Форумы IBResource</subitemtitle>
|
||||
<subsection>quickhelp</subsection>
|
||||
<subitemurl>do=redirect&id=resources</subitemurl>
|
||||
<subisredirect>1</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Контакты</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Контактная информация</subitemtitle>
|
||||
<subsection>quickhelp</subsection>
|
||||
<subitemurl>do=redirect&id=contact</subitemurl>
|
||||
<subisredirect>1</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Сообщить об ошибке</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Сообщить об ошибке</subitemtitle>
|
||||
<subsection>quickhelp</subsection>
|
||||
<subitemurl>do=redirect&id=bugs</subitemurl>
|
||||
<subisredirect>1</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
</tabitems>
|
||||
</menu>
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Define the default languages section
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'manage_languages';
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<menu>
|
||||
<tabitems>
|
||||
<item>
|
||||
<title>Языки</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Языки системы</subitemtitle>
|
||||
<subsection>manage_languages</subsection>
|
||||
<subitemurl></subitemurl>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
</tabitems>
|
||||
</menu>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<permissions>
|
||||
<group>
|
||||
<grouptitle>Управление языками</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>lang_words</key>
|
||||
<string>Может добавлять/изменять слова?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>lang_packs</key>
|
||||
<string>Может добавлять/изменять языковые наборы?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>lang_pack_info</key>
|
||||
<string>Может изменять настройки и информацию языковых наборов?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
</permissions>
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,410 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* ACP Login/Logout Routines
|
||||
* Last Updated: $Date: 2009-11-13 19:55:00 -0500 (Fri, 13 Nov 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since Tuesday 17th August 2004
|
||||
* @version $Revision: 5405 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
class admin_core_login_manualResolver extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* HTML Skin object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $html;
|
||||
|
||||
/**#@+
|
||||
* Registry objects
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
public $registry;
|
||||
public $DB;
|
||||
public $settings;
|
||||
public $request;
|
||||
public $lang;
|
||||
public $member;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Login handler object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $han_login;
|
||||
|
||||
/**
|
||||
* Initiate login handler
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function initHanLogin()
|
||||
{
|
||||
require_once( IPS_ROOT_PATH . 'sources/handlers/han_login.php' );
|
||||
$this->han_login = new han_login( $this->registry );
|
||||
$this->han_login->is_admin_auth = 1;
|
||||
$this->han_login->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @param string Validation message
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry, $validationMessage='' )
|
||||
{
|
||||
/* Make object */
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_login' ), 'core' );
|
||||
|
||||
$this->lang = $this->registry->getClass('class_localization');
|
||||
|
||||
$this->initHanLogin();
|
||||
|
||||
//-----------------------------------------
|
||||
// What to do?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'login':
|
||||
default:
|
||||
$this->loginForm();
|
||||
break;
|
||||
|
||||
case 'login-complete':
|
||||
$this->loginComplete();
|
||||
break;
|
||||
|
||||
case 'login-out':
|
||||
$this->loginOut();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check and verify the login was successful
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function loginComplete()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Check form details.
|
||||
//-----------------------------------------
|
||||
|
||||
$this->request['email'] = str_replace( '|', '|', $this->request['email'] );
|
||||
|
||||
$username = '';
|
||||
$email = '';
|
||||
|
||||
//-----------------------------------------
|
||||
// Is this a username or email address?
|
||||
//-----------------------------------------
|
||||
|
||||
if( IPSText::checkEmailAddress( $this->request['username'] ) )
|
||||
{
|
||||
$email = $this->request['username'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$username = $this->request['username'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check auth
|
||||
//-----------------------------------------
|
||||
|
||||
$this->han_login->loginAuthenticate( $username, $email, trim($this->request['password']) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check return code...
|
||||
//-----------------------------------------
|
||||
|
||||
$mem = $this->han_login->member_data;
|
||||
|
||||
if ( ( ! $mem['member_id'] ) or ( $this->han_login->return_code == 'NO_USER' ) )
|
||||
{
|
||||
$this->_writeToLog( $this->request['username'], 'fail' );
|
||||
$this->loginForm( $this->lang->words['bad_email_password'] );
|
||||
}
|
||||
|
||||
if ( $this->han_login->return_code == 'NO_ACCESS' )
|
||||
{
|
||||
$this->_writeToLog( $this->request['username'], 'fail' );
|
||||
$this->loginForm( $this->lang->words['no_acp_access'] );
|
||||
}
|
||||
else if ( $this->han_login->return_code != 'SUCCESS' )
|
||||
{
|
||||
$this->_writeToLog( $this->request['username'], 'fail' );
|
||||
$this->loginForm( $this->lang->words['bad_email_password'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// And sort secondary groups...
|
||||
//-----------------------------------------
|
||||
|
||||
$mem = $this->member->setUpSecondaryGroups( $mem );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check access...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $mem['g_access_cp'] != 1 )
|
||||
{
|
||||
$this->_writeToLog( $this->request['username'], 'fail' );
|
||||
$this->loginForm( $this->lang->words['no_acp_access'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Fix up query string...
|
||||
//-----------------------------------------
|
||||
|
||||
$extra_query = "";
|
||||
|
||||
if ( $_POST['qstring'] )
|
||||
{
|
||||
$extra_query = stripslashes( $_POST['qstring'] );
|
||||
$extra_query = str_replace( $this->settings['_original_base_url'] , "" , $extra_query );
|
||||
$extra_query = str_ireplace( "?index." . $this->settings['php_ext'] , "" , $extra_query );
|
||||
$extra_query = ltrim( $extra_query, '?' );
|
||||
$extra_query = preg_replace( "!adsess=(\w){32}!" , "" , $extra_query );
|
||||
$extra_query = str_replace( "adsess=x" , "" , $extra_query );
|
||||
$extra_query = str_replace( array( 'old_&', 'old_&' ) , "" , $extra_query );
|
||||
$extra_query = preg_replace( "!s=(\w){32}!" , "" , $extra_query );
|
||||
$extra_query = str_replace( "module=login" , "" , $extra_query );
|
||||
$extra_query = str_replace( "do=login-complete" , "" , $extra_query );
|
||||
$extra_query = str_replace( "/admin" , "" , $extra_query );
|
||||
$extra_query = str_replace( '&' , '&', $extra_query );
|
||||
$extra_query = preg_replace( "#&{1,}#" , "&", $extra_query );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Insert session
|
||||
//-----------------------------------------
|
||||
|
||||
$sess_id = md5( uniqid( microtime() ) );
|
||||
|
||||
$this->DB->delete( 'core_sys_cp_sessions', 'session_member_id=' . $mem['member_id'] );
|
||||
|
||||
/* Grab user agent */
|
||||
$uAgent = array();
|
||||
|
||||
$this->DB->insert( 'core_sys_cp_sessions', array (
|
||||
'session_id' => $sess_id,
|
||||
'session_ip_address' => $this->member->ip_address,
|
||||
'session_member_name' => $mem['members_display_name'],
|
||||
'session_member_id' => $mem['member_id'],
|
||||
'session_member_login_key' => $mem['member_login_key'],
|
||||
'session_location' => 'index',
|
||||
'session_log_in_time' => time(),
|
||||
'session_running_time' => time(),
|
||||
'session_app_data' => serialize( $uAgent ),
|
||||
'session_url' => '',
|
||||
) );
|
||||
|
||||
$this->request[ 'adsess'] = $sess_id ;
|
||||
|
||||
//-----------------------------------------
|
||||
// Redirect...
|
||||
//-----------------------------------------
|
||||
|
||||
$url = $this->settings['_original_base_url'] . '/' . CP_DIRECTORY . '/index.php?adsess=' . $sess_id . '&' . $extra_query;
|
||||
|
||||
$this->_writeToLog( $this->request['username'], 'ok' );
|
||||
|
||||
ipsRegistry::getClass('output')->redirect( $url, $this->lang->words['login_successful'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log the user out
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function loginOut()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Do it..
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->delete( 'core_sys_cp_sessions', "session_id='" . $this->request['adsess'] . "'" );
|
||||
|
||||
//-----------------------------------------
|
||||
// Bash cookie
|
||||
//-----------------------------------------
|
||||
|
||||
IPSCookie::set("ipb3AcpSessionId", 'x', -1);
|
||||
|
||||
//-----------------------------------------
|
||||
// Redirect...
|
||||
//-----------------------------------------
|
||||
|
||||
ipsRegistry::getClass('output')->redirect( $this->settings['base_url'] . '/' . CP_DIRECTORY . '/index.php', $this->lang->words['logout_complete'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Log the user out
|
||||
*
|
||||
* @access public
|
||||
* @param string Message to show on the form
|
||||
* @return void
|
||||
*/
|
||||
public function loginForm( $message='' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$message = $message ? $message : $this->member->sessionClass()->getMessage();
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Remove all out of date sessions, like a good boy. Woof.
|
||||
//-------------------------------------------------------
|
||||
|
||||
$cut_off_stamp = time() - 60*60*2;
|
||||
|
||||
$this->DB->delete( 'core_sys_cp_sessions', "session_running_time < {$cut_off_stamp}" );
|
||||
|
||||
//------------------------------------------------------
|
||||
// Start form
|
||||
//------------------------------------------------------
|
||||
|
||||
$qs = str_replace( '&' , '&' , IPSText::parseCleanValue( urldecode( my_getenv( 'QUERY_STRING' ) ) ) );
|
||||
$qs = str_replace( 'adsess=' , 'old_adsess=' , $qs );
|
||||
$qs = str_replace( 'module=menu', '' , $qs );
|
||||
|
||||
$additional_data = $this->han_login->additionalFormHTML();
|
||||
$replace = false;
|
||||
$data = array();
|
||||
|
||||
if( !is_null($additional_data) AND is_array($additional_data) AND count($additional_data) )
|
||||
{
|
||||
$replace = $additional_data[0];
|
||||
$data = $additional_data[1];
|
||||
}
|
||||
|
||||
$uses_name = false;
|
||||
$uses_email = false;
|
||||
|
||||
foreach( ipsRegistry::cache()->getCache('login_methods') as $method )
|
||||
{
|
||||
$login_methods[ $method['login_folder_name'] ] = $method['login_folder_name'];
|
||||
|
||||
if( $method['login_user_id'] == 'username' )
|
||||
{
|
||||
$uses_name = true;
|
||||
}
|
||||
|
||||
if( $method['login_user_id'] == 'email' )
|
||||
{
|
||||
$uses_email = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( $uses_name AND $uses_email )
|
||||
{
|
||||
$this->lang->words['gl_signinname'] = $this->lang->words['enter_name_and_email'];
|
||||
}
|
||||
else if( $uses_email )
|
||||
{
|
||||
$this->lang->words['gl_signinname'] = $this->lang->words['enter_useremail'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->lang->words['gl_signinname'] = $this->lang->words['enter_username'];
|
||||
}
|
||||
|
||||
ipsRegistry::getClass('output')->html_title = $this->lang->words['ipb_login'];
|
||||
ipsRegistry::getClass('output')->html_main = str_replace( '<%CONTENT%>', ipsRegistry::getClass('output')->global_template->log_in_form( $qs, $message, $replace == 'replace' ? true : false, $data ), ipsRegistry::getClass('output')->global_template->global_main_wrapper_no_furniture() );
|
||||
ipsRegistry::getClass('output')->html_main = str_replace( '<%TITLE%>' , ipsRegistry::getClass('output')->html_title, ipsRegistry::getClass('output')->html_main );
|
||||
|
||||
@header("Content-type: text/html");
|
||||
print ipsRegistry::getClass('output')->html_main;
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Write to the admin log in loggy ma log
|
||||
*
|
||||
* @access private
|
||||
* @param string Username
|
||||
* @param string ok/fail flag
|
||||
* @return void
|
||||
*/
|
||||
private function _writeToLog( $username='', $flag='fail' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$username = $username ? $username : $this->request['username'];
|
||||
$flag = ( $flag == 'ok' ) ? 1 : 0;
|
||||
$admin_post_details = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Generate POST / GET details
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $_GET as $k => $v )
|
||||
{
|
||||
$admin_post_details['get'][ $k ] = $v;
|
||||
}
|
||||
|
||||
foreach( $_POST as $k => $v )
|
||||
{
|
||||
if ( $k == 'password' AND IPSText::mbstrlen( $v ) > 1 )
|
||||
{
|
||||
$v = $v ? ( (IPSText::mbstrlen( $v ) - 1) > 0 ? str_repeat( '*', IPSText::mbstrlen( $v ) - 1 ) : '' ) . substr( $v, -1, 1 ) : '';
|
||||
}
|
||||
|
||||
$admin_post_details['post'][ $k ] = $v;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Write to disk...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->insert( 'admin_login_logs', array( 'admin_ip_address' => $this->member->ip_address,
|
||||
'admin_username' => $username,
|
||||
'admin_time' => time(),
|
||||
'admin_success' => $flag,
|
||||
'admin_post_details' => serialize( $admin_post_details ) ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,347 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Admin logs
|
||||
* Last Updated: $LastChangedDate: 2009-12-07 09:26:30 -0500 (Mon, 07 Dec 2009) $
|
||||
*
|
||||
* @author $Author: mark $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 27th January 2004
|
||||
* @version $Rev: 5526 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_logs_adminlogs extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Generate some pretty colors for the logs
|
||||
*
|
||||
* @access private
|
||||
* @var array Different colors for different actions
|
||||
*/
|
||||
private $colours = array();
|
||||
|
||||
/**
|
||||
* Skin object
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html = $this->registry->output->loadTemplate('cp_skin_adminlogs');
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$this->form_code = $this->html->form_code = 'module=logs&section=adminlogs';
|
||||
$this->form_code_js = $this->html->form_code_js = 'module=logs§ion=adminlogs';
|
||||
|
||||
//-----------------------------------------
|
||||
// Load lang
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_logs' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up navigation bar
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->core_nav = array();
|
||||
$this->registry->output->ignoreCoreNav = true;
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=tools', $this->lang->words['nav_toolsmodule'] );
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=tools§ion=logsSplash', $this->lang->words['nav_logssplash'] );
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=logs§ion=adminlogs', $this->lang->words['alog_adminlogs'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Add some colors from the paintbucket
|
||||
//-----------------------------------------
|
||||
|
||||
$this->colours = array(
|
||||
"cat" => "green",
|
||||
"forum" => "darkgreen",
|
||||
"mem" => "red",
|
||||
'group' => "purple",
|
||||
'mod' => 'orange',
|
||||
'op' => 'darkred',
|
||||
'help' => 'darkorange',
|
||||
'modlog' => 'steelblue',
|
||||
);
|
||||
|
||||
///----------------------------------------
|
||||
// What to do...
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'view':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'adminlogs_view' );
|
||||
$this->_view();
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'adminlogs_delete' );
|
||||
$this->_remove();
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'adminlogs_view' );
|
||||
$this->_listCurrent();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* View all logs for a given admin
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _view()
|
||||
{
|
||||
///----------------------------------------
|
||||
// Basic init
|
||||
//-----------------------------------------
|
||||
|
||||
$start = intval($this->request['st']) >= 0 ? intval($this->request['st']) : 0;
|
||||
|
||||
///----------------------------------------
|
||||
// No mid or search string?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->request['search_string'] AND !$this->request['mid'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['alog_nostring'];
|
||||
$this->_listCurrent();
|
||||
return;
|
||||
}
|
||||
|
||||
///----------------------------------------
|
||||
// mid?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->request['search_string'] )
|
||||
{
|
||||
$row = $this->DB->buildAndFetch( array( 'select' => 'COUNT(id) as count', 'from' => 'admin_logs', 'where' => "member_id=" . intval($this->request['mid']) ) );
|
||||
|
||||
$row_count = $row['count'];
|
||||
|
||||
$query = "&{$this->form_code}&mid=" . $this->request['mid'] . "&do=view";
|
||||
|
||||
$this->DB->build( array( 'select' => 'm.*',
|
||||
'from' => array( 'admin_logs' => 'm' ),
|
||||
'where' => 'm.member_id=' . intval($this->request['mid']),
|
||||
'order' => 'm.ctime DESC',
|
||||
'limit' => array( $start, 20 ),
|
||||
'add_join' => array(
|
||||
array( 'select' => 'mem.member_id, mem.members_display_name',
|
||||
'from' => array( 'members' => 'mem' ),
|
||||
'where' => 'mem.member_id=m.member_id',
|
||||
'type' => 'left'
|
||||
)
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
}
|
||||
|
||||
///----------------------------------------
|
||||
// search string?
|
||||
//-----------------------------------------
|
||||
|
||||
else
|
||||
{
|
||||
$this->request[ 'search_string'] = IPSText::parseCleanValue( urldecode($this->request['search_string'] ) );
|
||||
|
||||
if( !$this->DB->checkForField( $this->request['search_type'], 'admin_logs' ) )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['alog_whatfield'], 4110, true );
|
||||
}
|
||||
|
||||
if( $this->request['search_type'] == 'member_id' )
|
||||
{
|
||||
$dbq = "m." . $this->request['search_type'] . "='" . $this->request['search_string'] . "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$dbq = "m." . $this->request['search_type'] . " LIKE '%" . $this->request['search_string'] . "%'";
|
||||
}
|
||||
|
||||
$row = $this->DB->buildAndFetch( array( 'select' => 'COUNT(m.member_id) as count', 'from' => 'admin_logs m', 'where' => $dbq ) );
|
||||
|
||||
$row_count = $row['count'];
|
||||
|
||||
$query = "&{$this->form_code}&do=view&search_type=" . $this->request['search_type'] . "&search_string=" . urlencode($this->request['search_string']);
|
||||
|
||||
$this->DB->build( array( 'select' => 'm.*',
|
||||
'from' => array( 'admin_logs' => 'm' ),
|
||||
'where' => $dbq,
|
||||
'order' => 'm.ctime DESC',
|
||||
'limit' => array( $start, 20 ),
|
||||
'add_join' => array(
|
||||
array( 'select' => 'mem.member_id, mem.members_display_name',
|
||||
'from' => array( 'members' => 'mem' ),
|
||||
'where' => 'mem.member_id=m.member_id',
|
||||
'type' => 'left'
|
||||
)
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
}
|
||||
|
||||
///----------------------------------------
|
||||
// Page links
|
||||
//-----------------------------------------
|
||||
|
||||
$links = $this->registry->output->generatePagination( array( 'totalItems' => $row_count,
|
||||
'itemsPerPage' => 20,
|
||||
'currentStartValue' => $start,
|
||||
'baseUrl' => $this->settings['base_url'] . $query,
|
||||
)
|
||||
);
|
||||
|
||||
///----------------------------------------
|
||||
// Get db results
|
||||
//-----------------------------------------
|
||||
|
||||
while ( $row = $this->DB->fetch() )
|
||||
{
|
||||
$row['_time'] = $this->registry->class_localization->getDate( $row['ctime'], 'LONG' );
|
||||
$row['color'] = $this->colours[ $row['act'] ];
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
///----------------------------------------
|
||||
// And output
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->html .= $this->html->adminlogsView( $rows, $links );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove logs by an admin
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _remove()
|
||||
{
|
||||
if ( $this->request['mid'] == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['alog_whoselog'], 11114 );
|
||||
}
|
||||
|
||||
$this->DB->delete( 'admin_logs', "member_id=" . intval($this->request['mid']) );
|
||||
|
||||
$this->registry->output->silentRedirect( $this->settings['base_url']."&{$this->form_code}" );
|
||||
}
|
||||
|
||||
/**
|
||||
* List the current logs with links to view per-admin
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _listCurrent()
|
||||
{
|
||||
$rows = array();
|
||||
$admins = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// LAST FIVE ACTIONS
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => 'm.*',
|
||||
'from' => array( 'admin_logs' => 'm' ),
|
||||
'order' => 'm.ctime DESC',
|
||||
'limit' => array( 5 ),
|
||||
'add_join' => array(
|
||||
array( 'select' => 'mem.member_id, mem.members_display_name',
|
||||
'from' => array( 'members' => 'mem' ),
|
||||
'where' => 'mem.member_id=m.member_id',
|
||||
'type' => 'left'
|
||||
)
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $row = $this->DB->fetch() )
|
||||
{
|
||||
$row['_time'] = $this->registry->class_localization->getDate( $row['ctime'], 'LONG' );
|
||||
$row['color'] = $this->colours[ $row['act'] ];
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// All admins
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'member_id, count(member_id) as act_count',
|
||||
'from' => 'admin_logs',
|
||||
'group' => 'member_id',
|
||||
'order' => 'act_count DESC'
|
||||
) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
$_members = array();
|
||||
$_store = array();
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$_members[] = $r['member_id'];
|
||||
$_store[ $r['member_id'] ] = $r;
|
||||
}
|
||||
|
||||
if ( !empty( $_members ) )
|
||||
{
|
||||
$this->DB->build( array( 'select' => 'member_id, members_display_name',
|
||||
'from' => 'members',
|
||||
'where' => 'member_id IN (' . implode( ',', $_members ) . ')',
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$admins[] = array_merge( $r, $_store[ $r['member_id'] ] );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// And output
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->html .= $this->html->adminlogsWrapper( $rows, $admins );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Define the default logs section
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'adminlogs';
|
||||
@@ -0,0 +1,280 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Email error logs
|
||||
* Last Updated: $LastChangedDate: 2009-08-18 03:26:21 -0400 (Tue, 18 Aug 2009) $
|
||||
*
|
||||
* @author $Author: matt $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 27th January 2004
|
||||
* @version $Rev: 5023 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_logs_emailerrorlogs extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Skin object
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html = $this->registry->output->loadTemplate('cp_skin_emailerrorlogs');
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$this->form_code = $this->html->form_code = 'module=logs&section=emailerrorlogs';
|
||||
$this->form_code_js = $this->html->form_code_js = 'module=logs§ion=emailerrorlogs';
|
||||
|
||||
//-----------------------------------------
|
||||
// Load lang
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_logs' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up navigation bar
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->core_nav = array();
|
||||
$this->registry->output->ignoreCoreNav = true;
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=tools', $this->lang->words['nav_toolsmodule'] );
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=tools§ion=logsSplash', $this->lang->words['nav_logssplash'] );
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=logs§ion=emailerrorlogs', $this->lang->words['elog_email_err_logs'] );
|
||||
|
||||
///----------------------------------------
|
||||
// What to do...
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
default:
|
||||
case 'list':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emailerrorlogs_view' );
|
||||
$this->_listCurrent();
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emailerrorlogs_delete' );
|
||||
$this->_remove();
|
||||
break;
|
||||
|
||||
case 'viewemail':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emailerrorlogs_view' );
|
||||
$this->_viewEmail();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove email logs
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _remove()
|
||||
{
|
||||
if ( $this->request['type'] == 'all' )
|
||||
{
|
||||
$this->DB->delete( 'mail_error_logs' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$ids = array();
|
||||
|
||||
foreach ( $this->request as $k => $v )
|
||||
{
|
||||
if ( preg_match( "/^id_(\d+)$/", $k, $match ) )
|
||||
{
|
||||
if ($this->request[ $match[0] ] )
|
||||
{
|
||||
$ids[] = $match[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ids = IPSLib::cleanIntArray( $ids );
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count($ids) < 1 )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['erlog_noneselected'], 11115 );
|
||||
}
|
||||
|
||||
$this->DB->delete( 'mail_error_logs', "mlog_id IN (" . implode( ',', $ids ) . ")" );
|
||||
}
|
||||
|
||||
$this->registry->getClass('adminFunctions')->saveAdminLog( $this->lang->words['erlog_removed'] );
|
||||
|
||||
$this->registry->output->silentRedirect( $this->settings['base_url']."&{$this->form_code}" );
|
||||
}
|
||||
|
||||
/**
|
||||
* List the current logs
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _listCurrent()
|
||||
{
|
||||
$start = intval($this->request['st']) >= 0 ? intval($this->request['st']) : 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Check URL parameters
|
||||
//-----------------------------------------
|
||||
|
||||
$url_query = array();
|
||||
$db_query = array();
|
||||
|
||||
if ( $this->request['type'] AND $this->request['type'] != "" )
|
||||
{
|
||||
$this->registry->output->html_help_title .= $this->lang->words['erlog_results'];
|
||||
|
||||
$string = IPSText::parseCleanValue( urldecode($this->request['string']) );
|
||||
|
||||
if ( $string == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['erlog_enter_sumthang_yo'], 11116 );
|
||||
}
|
||||
|
||||
$url_query[] = 'type=' . $this->request['type'];
|
||||
$url_query[] = 'string=' . urlencode($string);
|
||||
|
||||
switch( $this->request['type'] )
|
||||
{
|
||||
case 'subject':
|
||||
$db_query[] = $this->request['match'] == 'loose' ? "mlog_subject LIKE '%". preg_replace_callback( '/([=_\?\x00-\x1F\x80-\xFF])/', create_function( '$match', 'return "=" . strtoupper( dechex( ord( "$match[1]" ) ) );' ), $string ) ."%'" : "mlog_subject='{$string}'";
|
||||
break;
|
||||
|
||||
case 'email_from':
|
||||
$db_query[] = $this->request['match'] == 'loose' ? "mlog_from LIKE '%{$string}%'" : "mlog_from='{$string}'";
|
||||
break;
|
||||
case 'email_to':
|
||||
$db_query[] = $this->request['match'] == 'loose' ? "mlog_to LIKE '%{$string}%'" : "mlog_to='{$string}'";
|
||||
break;
|
||||
case 'error':
|
||||
$db_query[] = $this->request['match'] == 'loose' ? "mlog_msg LIKE '%{$string}%' or mlog_smtp_msg LIKE '%{$string}%'" : "mlog_msg='{$string} or mlog_smtp_msg='{$string}'";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( $this->request['match'] )
|
||||
{
|
||||
$url_query[] = 'match=' . $this->request['match'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// LIST 'EM
|
||||
//-----------------------------------------
|
||||
|
||||
$dbe = "";
|
||||
$url = "";
|
||||
|
||||
if ( count($db_query) > 0 )
|
||||
{
|
||||
$dbe = implode( ' AND ', $db_query );
|
||||
}
|
||||
|
||||
if ( count($url_query) > 0 )
|
||||
{
|
||||
$url = '&' . implode( '&', $url_query );
|
||||
}
|
||||
|
||||
$count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as cnt', 'from' => 'mail_error_logs', 'where' => $dbe ) );
|
||||
|
||||
$links = $this->registry->output->generatePagination( array( 'totalItems' => $count['cnt'],
|
||||
'itemsPerPage' => 25,
|
||||
'currentStartValue' => $start,
|
||||
'baseUrl' => $this->settings['base_url'] . "&{$this->form_code}" . $url,
|
||||
)
|
||||
);
|
||||
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'mail_error_logs', 'where' => $dbe, 'order' => 'mlog_date DESC', 'limit' => array( $start, 25 ) ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $row = $this->DB->fetch() )
|
||||
{
|
||||
$row['_date'] = $this->registry->class_localization->getDate( $row['mlog_date'], 'SHORT' );
|
||||
|
||||
$row['mlog_subject'] = ( empty( $row['mlog_subject'] ) ) ? '--' : $row['mlog_subject'];
|
||||
$row['mlog_subject'] = ( strpos( $row['mlog_subject'], "=?".IPS_DOC_CHAR_SET."?Q?" ) !== FALSE )
|
||||
? str_replace( "=?".IPS_DOC_CHAR_SET."?Q?", "", str_replace( "?=", "", preg_replace_callback( '/=([A-F0-9]{2})/', create_function( '$match', 'return chr( hexdec( "$match[1]" ) );' ), $row['mlog_subject'] ) ) )
|
||||
: $row['mlog_subject'];
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
$this->registry->output->html .= $this->html->emailerrorlogsWrapper( $rows, $links );
|
||||
}
|
||||
|
||||
/**
|
||||
* View an individual email
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _viewEmail()
|
||||
{
|
||||
if ( $this->request['id'] == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['erlog_404'], 11117 );
|
||||
}
|
||||
|
||||
$id = intval($this->request['id']);
|
||||
|
||||
$row = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'mail_error_logs', 'where' => "mlog_id={$id}" ) );
|
||||
|
||||
if ( ! $row['mlog_id'] )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['erlog_404'], 11118 );
|
||||
}
|
||||
|
||||
$row['_date'] = $this->registry->class_localization->getDate( $row['mlog_date'], 'LONG' );
|
||||
$row['mlog_content'] = nl2br($row['mlog_content']);
|
||||
|
||||
$row['mlog_subject'] = ( strpos( $row['mlog_subject'], "=?".IPS_DOC_CHAR_SET."?Q?" ) !== FALSE )
|
||||
? str_replace( "=?".IPS_DOC_CHAR_SET."?Q?", "", str_replace( "?=", "", preg_replace_callback( '/=([A-F0-9]{2})/', create_function( '$match', 'return chr( hexdec( "$match[1]" ) );' ), $row['mlog_subject'] ) ) )
|
||||
: $row['mlog_subject'];
|
||||
|
||||
$row['mlog_msg'] = $row['mlog_msg'] ? $row['mlog_msg'] : $this->lang->words['erlog_noinfo'];
|
||||
$row['mlog_code'] = $row['mlog_code'] ? $row['mlog_code'] : $this->lang->words['erlog_noinfo'];
|
||||
$row['mlog_smtp_error'] = $row['mlog_smtp_error'] ? $row['mlog_smtp_error'] : $this->lang->words['erlog_noinfo'];
|
||||
|
||||
$this->registry->output->html .= $this->html->emailerrorlogsEmail( $row );
|
||||
|
||||
$this->registry->output->printPopupWindow();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,426 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Email logs
|
||||
* Last Updated: $LastChangedDate: 2009-08-18 03:26:21 -0400 (Tue, 18 Aug 2009) $
|
||||
*
|
||||
* @author $Author: matt $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 27th January 2004
|
||||
* @version $Rev: 5023 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_logs_emaillogs extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Skin object
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html = $this->registry->output->loadTemplate('cp_skin_emaillogs');
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$this->form_code = $this->html->form_code = 'module=logs&section=emaillogs';
|
||||
$this->form_code_js = $this->html->form_code_js = 'module=logs§ion=emaillogs';
|
||||
|
||||
//-----------------------------------------
|
||||
// Load lang
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_logs' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up navigation bar
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->core_nav = array();
|
||||
$this->registry->output->ignoreCoreNav = true;
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=tools', $this->lang->words['nav_toolsmodule'] );
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=tools§ion=logsSplash', $this->lang->words['nav_logssplash'] );
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=logs§ion=emaillogs', $this->lang->words['elog_emaillogs'] );
|
||||
|
||||
///----------------------------------------
|
||||
// What to do...
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
default:
|
||||
case 'list':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emaillogs_view' );
|
||||
$this->_listCurrent();
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emaillogs_delete' );
|
||||
$this->_remove();
|
||||
break;
|
||||
|
||||
case 'viewemail':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emaillogs_view' );
|
||||
$this->_viewEmail();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove email logs
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _remove()
|
||||
{
|
||||
if ( $this->request['type'] == 'all' )
|
||||
{
|
||||
$this->DB->delete( 'email_logs' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$ids = array();
|
||||
|
||||
foreach ( $this->request as $k => $v )
|
||||
{
|
||||
if ( preg_match( "/^id_(\d+)$/", $k, $match ) )
|
||||
{
|
||||
if ($this->request[ $match[0] ] )
|
||||
{
|
||||
$ids[] = $match[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ids = IPSLib::cleanIntArray( $ids );
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count($ids) < 1 )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['elog_noneselected'], 11119 );
|
||||
}
|
||||
|
||||
$this->DB->delete( 'email_logs', "email_id IN (" . implode( ',', $ids ) . ")" );
|
||||
}
|
||||
|
||||
$this->registry->getClass('adminFunctions')->saveAdminLog( $this->lang->words['elog_removed'] );
|
||||
|
||||
$this->registry->output->silentRedirect( $this->settings['base_url']."&{$this->form_code}" );
|
||||
}
|
||||
|
||||
/**
|
||||
* List the current logs
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _listCurrent()
|
||||
{
|
||||
$start = intval($this->request['st']) >= 0 ? intval($this->request['st']) : 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Check URL parameters
|
||||
//-----------------------------------------
|
||||
|
||||
$url_query = array();
|
||||
$db_query = array();
|
||||
|
||||
if ( $this->request['type'] AND $this->request['type'] != "" )
|
||||
{
|
||||
$this->registry->output->html_help_title .= $this->lang->words['elog_results'];
|
||||
|
||||
switch( $this->request['type'] )
|
||||
{
|
||||
case 'fromid':
|
||||
$url_query[] = 'type=fromid';
|
||||
$url_query[] = 'id=' . intval($this->request['id']);
|
||||
$db_query[] = 'email.from_member_id=' . intval($this->request['id']);
|
||||
break;
|
||||
|
||||
case 'toid':
|
||||
$url_query[] = 'type=toid';
|
||||
$url_query[] = 'id=' . intval($this->request['id']);
|
||||
$db_query[] = 'email.to_member_id=' . intval($this->request['id']);
|
||||
break;
|
||||
|
||||
case 'subject':
|
||||
$string = IPSText::parseCleanValue( urldecode($this->request['string']) );
|
||||
|
||||
if ( $string == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['elog_notsearched'], 11120 );
|
||||
}
|
||||
|
||||
$url_query[] = 'type=' . $this->request['type'];
|
||||
$url_query[] = 'string=' . urlencode($string);
|
||||
$db_query[] = $this->request['match'] == 'loose' ? "email.email_subject LIKE '%{$string}%'" : "email.email_subject='{$string}'";
|
||||
break;
|
||||
|
||||
case 'content':
|
||||
$string = IPSText::parseCleanValue( urldecode($this->request['string']) );
|
||||
|
||||
if ( $string == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['elog_notsearched'], 11121 );
|
||||
}
|
||||
|
||||
$url_query[] = 'type=' . $this->request['type'];
|
||||
$url_query[] = 'string=' . urlencode($string);
|
||||
$db_query[] = $this->request['match'] == 'loose' ? "email.email_content LIKE '%{$string}%'" : "email.email_content='{$string}'";
|
||||
break;
|
||||
|
||||
case 'email_from':
|
||||
$string = IPSText::parseCleanValue( urldecode($this->request['string']) );
|
||||
|
||||
if ( $string == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['elog_notsearched'], 11122 );
|
||||
}
|
||||
|
||||
$url_query[] = 'type=' . $this->request['type'];
|
||||
$url_query[] = 'string=' . urlencode($string);
|
||||
$db_query[] = $this->request['match'] == 'loose' ? "email.from_email_address LIKE '%{$string}%'" : "email.from_email_address='{$string}'";
|
||||
break;
|
||||
|
||||
case 'email_to':
|
||||
$string = IPSText::parseCleanValue( urldecode($this->request['string']) );
|
||||
|
||||
if ( $string == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['elog_notsearched'], 11123 );
|
||||
}
|
||||
|
||||
$url_query[] = 'type=' . $this->request['type'];
|
||||
$url_query[] = 'string=' . urlencode($string);
|
||||
$db_query[] = $this->request['match'] == 'loose' ? "email.to_email_address LIKE '%{$string}%'" : "email.to_email_address='{$string}'";
|
||||
break;
|
||||
|
||||
case 'name_from':
|
||||
$string = IPSText::parseCleanValue( urldecode($this->request['string']) );
|
||||
|
||||
if ( $string == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['elog_notsearched'], 11124 );
|
||||
}
|
||||
|
||||
if ( $this->request['match'] == 'loose' )
|
||||
{
|
||||
$this->DB->build( array( 'select' => 'member_id', 'from' => 'members', 'where' => "members_display_name LIKE '%{$string}%'" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
if ( ! $this->DB->getTotalRows() )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['elog_nomatches'], 111160 );
|
||||
}
|
||||
|
||||
$ids = array();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$ids[] = $r['member_id'];
|
||||
}
|
||||
|
||||
$db_query[] = 'email.from_member_id IN(' . implode( ',', $ids ) . ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$r = $this->DB->buildAndFetch( array( 'select' => 'member_id', 'from' => 'members', 'where' => "members_display_name='{$string}'" ) );
|
||||
|
||||
if ( ! $r['member_id'] )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['elog_nomatches'], 11125 );
|
||||
}
|
||||
|
||||
$db_query[] = 'email.from_member_id=' . $r['member_id'];
|
||||
}
|
||||
|
||||
$url_query[] = 'type=' . $this->request['type'];
|
||||
$url_query[] = 'string=' . urlencode($string);
|
||||
break;
|
||||
|
||||
case 'name_to':
|
||||
$string = urldecode($this->request['string']);
|
||||
|
||||
if ( $string == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['elog_notsearched'], 11126 );
|
||||
}
|
||||
|
||||
if ( $this->request['match'] == 'loose' )
|
||||
{
|
||||
$this->DB->build( array( 'select' => 'member_id', 'from' => 'members', 'where' => "members_display_name LIKE '%{$string}%'" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
if ( ! $this->DB->getTotalRows() )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['elog_nomatches'], 11127 );
|
||||
}
|
||||
|
||||
$ids = array();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$ids[] = $r['member_id'];
|
||||
}
|
||||
|
||||
$db_query[] = 'email.to_member_id IN(' . implode( ',', $ids ) . ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$r = $this->DB->buildAndFetch( array( 'select' => 'member_id', 'from' => 'members', 'where' => "members_display_name='{$string}'" ) );
|
||||
|
||||
if ( ! $r['member_id'] )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['elog_nomatches'], 11128 );
|
||||
}
|
||||
|
||||
$db_query[] = 'email.to_member_id=' . $r['member_id'];
|
||||
}
|
||||
|
||||
$url_query[] = 'type=' . $this->request['type'];
|
||||
$url_query[] = 'string=' . urlencode($string);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( $this->request['match'] )
|
||||
{
|
||||
$url_query[] = 'match=' . $this->request['match'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// LIST 'EM
|
||||
//-----------------------------------------
|
||||
|
||||
$dbe = "";
|
||||
$url = "";
|
||||
|
||||
if ( count($db_query) > 0 )
|
||||
{
|
||||
$dbe = implode(' AND ', $db_query );
|
||||
}
|
||||
|
||||
if ( count($url_query) > 0 )
|
||||
{
|
||||
$url = '&' . implode( '&', $url_query );
|
||||
}
|
||||
|
||||
$count = $this->DB->buildAndFetch( array( 'select' => 'count(email.email_id) as cnt',
|
||||
'from' => 'email_logs email',
|
||||
'where' => $dbe ) );
|
||||
|
||||
$links = $this->registry->output->generatePagination( array( 'totalItems' => $count['cnt'],
|
||||
'itemsPerPage' => 25,
|
||||
'currentStartValue' => $start,
|
||||
'baseUrl' => $this->settings['base_url'] . "&{$this->form_code}" . $url,
|
||||
)
|
||||
);
|
||||
|
||||
$this->DB->build( array( 'select' => 'email.*',
|
||||
'from' => array( 'email_logs' => 'email' ),
|
||||
'where' => $dbe,
|
||||
'order' => 'email.email_date DESC',
|
||||
'limit' => array( $start, 25 ),
|
||||
'add_join' => array(
|
||||
array( 'select' => 'm.member_id, m.members_display_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=email.from_member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array( 'select' => 'mem.member_id as to_id, mem.members_display_name as to_name',
|
||||
'from' => array( 'members' => 'mem' ),
|
||||
'where' => 'mem.member_id=email.to_member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $row = $this->DB->fetch() )
|
||||
{
|
||||
$row['_date'] = $this->registry->class_localization->getDate( $row['email_date'], 'SHORT' );
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
$this->registry->output->html .= $this->html->emaillogsWrapper( $rows, $links );
|
||||
}
|
||||
|
||||
/**
|
||||
* View a single email
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _viewEmail()
|
||||
{
|
||||
if ( $this->request['id'] == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['elog_log_404'], 11129 );
|
||||
}
|
||||
|
||||
$id = intval($this->request['id']);
|
||||
|
||||
$row = $this->DB->buildAndFetch( array( 'select' => 'email.*',
|
||||
'from' => array( 'email_logs' => 'email' ),
|
||||
'where' => 'email.email_id=' . $id,
|
||||
'add_join' => array(
|
||||
array( 'select' => 'm.member_id, m.members_display_name as name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=email.from_member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array( 'select' => 'mem.member_id as to_id, mem.members_display_name as to_name',
|
||||
'from' => array( 'members' => 'mem' ),
|
||||
'where' => 'mem.member_id=email.to_member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
)
|
||||
) );
|
||||
|
||||
if ( ! $row['email_id'] )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['elog_log_404'], 11130 );
|
||||
}
|
||||
|
||||
$row['_date'] = $this->registry->class_localization->getDate( $row['email_date'], 'LONG' );
|
||||
|
||||
$this->registry->output->html .= $this->html->emaillogsEmail( $row );
|
||||
|
||||
$this->registry->output->printPopupWindow();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Error logs
|
||||
* Last Updated: $LastChangedDate: 2009-11-23 12:23:43 -0500 (Mon, 23 Nov 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 27th January 2004
|
||||
* @version $Rev: 5457 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_logs_errorlogs extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Skin object
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html = $this->registry->output->loadTemplate('cp_skin_errorlogs');
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$this->form_code = $this->html->form_code = 'module=logs&section=errorlogs';
|
||||
$this->form_code_js = $this->html->form_code_js = 'module=logs§ion=errorlogs';
|
||||
|
||||
//-----------------------------------------
|
||||
// Load lang
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_logs' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up navigation bar
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->core_nav = array();
|
||||
$this->registry->output->ignoreCoreNav = true;
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=tools', $this->lang->words['nav_toolsmodule'] );
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=tools§ion=logsSplash', $this->lang->words['nav_logssplash'] );
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=logs§ion=errorlogs', $this->lang->words['error_log_thelogs'] );
|
||||
|
||||
///----------------------------------------
|
||||
// What to do...
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
default:
|
||||
case 'list':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'errorlogs_view' );
|
||||
$this->_listCurrent();
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'errorlogs_delete' );
|
||||
$this->_remove();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove email logs
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _remove()
|
||||
{
|
||||
if( $this->request['type'] == 'all' )
|
||||
{
|
||||
$this->DB->delete( 'error_logs' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$ids = array();
|
||||
|
||||
foreach( $this->request as $k => $v )
|
||||
{
|
||||
if ( preg_match( "/^id_(\d+)$/", $k, $match ) )
|
||||
{
|
||||
if ($this->request[ $match[0] ] )
|
||||
{
|
||||
$ids[] = $match[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ids = IPSLib::cleanIntArray( $ids );
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
if( count($ids) < 1 )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['erlog_noneselected'], 11115 );
|
||||
}
|
||||
|
||||
$this->DB->delete( 'error_logs', "log_id IN (" . implode( ',', $ids ) . ")" );
|
||||
}
|
||||
|
||||
$this->registry->adminFunctions->saveAdminLog( $this->lang->words['error_log_removed'] );
|
||||
|
||||
$this->registry->output->silentRedirect( $this->settings['base_url'] . "&{$this->form_code}" );
|
||||
}
|
||||
|
||||
/**
|
||||
* List the current logs
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _listCurrent()
|
||||
{
|
||||
$start = intval( $this->request['st'] ) >= 0 ? intval( $this->request['st'] ) : 0;
|
||||
|
||||
/* Check URL parameters */
|
||||
$url_query = array();
|
||||
$db_query = array();
|
||||
|
||||
if( $this->request['type'] )
|
||||
{
|
||||
$string = IPSText::parseCleanValue( urldecode( $this->request['string'] ) );
|
||||
|
||||
if( $string == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['erlog_enter_sumthang_yo'], 11116 );
|
||||
}
|
||||
|
||||
$url_query[] = 'type=' . $this->request['type'];
|
||||
$url_query[] = 'string=' . urlencode( $string );
|
||||
|
||||
switch( $this->request['type'] )
|
||||
{
|
||||
case 'log_error':
|
||||
$db_query[] = $this->request['match'] == 'loose' ? "e.log_error LIKE '%{$string}%'" : "e.log_error='{$string}'";
|
||||
break;
|
||||
|
||||
case 'log_error_code':
|
||||
$db_query[] = $this->request['match'] == 'loose' ? "e.log_error_code LIKE '%{$string}%'" : "e.log_error_code='{$string}'";
|
||||
break;
|
||||
|
||||
case 'log_request_uri':
|
||||
$db_query[] = $this->request['match'] == 'loose' ? "e.log_request_uri LIKE '%{$string}%'" : "e.log_request_uri='{$string}'";
|
||||
break;
|
||||
|
||||
case 'members_display_name':
|
||||
$db_query[] = $this->request['match'] == 'loose' ? "m.members_display_name LIKE '%{$string}%'" : "m.members_display_name='{$string}'";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Build extra query stuff */
|
||||
$dbe = '';
|
||||
$url = '';
|
||||
|
||||
if( count( $db_query ) )
|
||||
{
|
||||
$dbe = implode( ' AND ', $db_query );
|
||||
}
|
||||
|
||||
if( count( $url_query ) )
|
||||
{
|
||||
$url = '&' . implode( '&', $url_query );
|
||||
}
|
||||
|
||||
/* Pagination */
|
||||
$count = $this->DB->buildAndFetch( array(
|
||||
'select' => 'count(*) as cnt',
|
||||
'from' => array( 'error_logs' => 'e' ),
|
||||
'where' => $dbe,
|
||||
'add_join' => array(
|
||||
array(
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'e.log_member=m.member_id',
|
||||
'type' => 'left',
|
||||
)
|
||||
)
|
||||
) );
|
||||
|
||||
$links = $this->registry->output->generatePagination( array(
|
||||
'totalItems' => $count['cnt'],
|
||||
'itemsPerPage' => 25,
|
||||
'currentStartValue' => $start,
|
||||
'baseUrl' => $this->settings['base_url'] . "&{$this->form_code}" . $url,
|
||||
)
|
||||
);
|
||||
|
||||
/* Query the logs */
|
||||
$this->DB->build( array(
|
||||
'select' => 'e.*',
|
||||
'from' => array( 'error_logs' => 'e' ),
|
||||
'where' => $dbe,
|
||||
'order' => 'e.log_date DESC',
|
||||
'limit' => array( $start, 25 ),
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'm.members_display_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'e.log_member=m.member_id',
|
||||
'type' => 'left',
|
||||
)
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
$row['_date'] = $this->registry->class_localization->getDate( $row['log_date'], 'SHORT' );
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
$this->registry->output->html .= $this->html->errorlogsWrapper( $rows, $links );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,337 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Moderator logs
|
||||
* Last Updated: $LastChangedDate: 2009-12-07 09:26:30 -0500 (Mon, 07 Dec 2009) $
|
||||
*
|
||||
* @author $Author: mark $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 27th January 2004
|
||||
* @version $Rev: 5526 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_logs_modlogs extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Skin object
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html = $this->registry->output->loadTemplate('cp_skin_modlogs');
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$this->form_code = $this->html->form_code = 'module=logs&section=modlogs';
|
||||
$this->form_code_js = $this->html->form_code_js = 'module=logs§ion=modlogs';
|
||||
|
||||
//-----------------------------------------
|
||||
// Load lang
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_logs' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up navigation bar
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->core_nav = array();
|
||||
$this->registry->output->ignoreCoreNav = true;
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=tools', $this->lang->words['nav_toolsmodule'] );
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=tools§ion=logsSplash', $this->lang->words['nav_logssplash'] );
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=logs§ion=modlogs', $this->lang->words['mlog_modlogs'] );
|
||||
|
||||
///----------------------------------------
|
||||
// What to do...
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'view':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'modlogs_view' );
|
||||
$this->_view();
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'modlogs_delete' );
|
||||
$this->_remove();
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'modlogs_view' );
|
||||
$this->_listCurrent();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* View all logs for a given moderator
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _view()
|
||||
{
|
||||
///----------------------------------------
|
||||
// Basic init
|
||||
//-----------------------------------------
|
||||
|
||||
$start = intval($this->request['st']) >= 0 ? intval($this->request['st']) : 0;
|
||||
|
||||
///----------------------------------------
|
||||
// No mid or search string?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->request['search_string'] AND !$this->request['mid'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['mlog_nostring'];
|
||||
$this->_listCurrent();
|
||||
return;
|
||||
}
|
||||
|
||||
///----------------------------------------
|
||||
// mid?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->request['search_string'] )
|
||||
{
|
||||
$row = $this->DB->buildAndFetch( array( 'select' => 'COUNT(id) as count', 'from' => 'moderator_logs', 'where' => "member_id=" . intval($this->request['mid']) ) );
|
||||
|
||||
$row_count = $row['count'];
|
||||
|
||||
$query = "&{$this->form_code}&mid=" . $this->request['mid'] . "&do=view";
|
||||
|
||||
$this->DB->build( array( 'select' => 'm.*',
|
||||
'from' => array( 'moderator_logs' => 'm' ),
|
||||
'where' => 'm.member_id=' . intval($this->request['mid']),
|
||||
'order' => 'm.ctime DESC',
|
||||
'limit' => array( $start, 20 ),
|
||||
'add_join' => array(
|
||||
array( 'select' => 'mem.members_display_name',
|
||||
'from' => array( 'members' => 'mem' ),
|
||||
'where' => 'mem.member_id=m.member_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
array( 'select' => 'f.id as forum_id, f.name',
|
||||
'from' => array( 'forums' => 'f' ),
|
||||
'where' => 'f.id=m.forum_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->request[ 'search_string'] = IPSText::parseCleanValue( urldecode($this->request['search_string'] ) );
|
||||
|
||||
if( !$this->DB->checkForField( $this->request['search_type'], 'moderator_logs' ) )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mlog_whatfield'], 4111 );
|
||||
}
|
||||
|
||||
if( $this->request['search_type'] == 'topic_id' OR $this->request['search_type'] == 'forum_id' )
|
||||
{
|
||||
$dbq = "m." . $this->request['search_type'] . "='" . $this->request['search_string'] . "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$dbq = "m." . $this->request['search_type'] . " LIKE '%" . $this->request['search_string'] . "%'";
|
||||
}
|
||||
|
||||
$row = $this->DB->buildAndFetch( array( 'select' => 'COUNT(m.member_id) as count', 'from' => 'moderator_logs m', 'where' => $dbq ) );
|
||||
|
||||
$row_count = $row['count'];
|
||||
|
||||
$query = "&{$this->form_code}&do=view&search_type=" . $this->request['search_type'] . "&search_string=".urlencode($this->request['search_string']);
|
||||
|
||||
$this->DB->build( array( 'select' => 'm.*',
|
||||
'from' => array( 'moderator_logs' => 'm' ),
|
||||
'where' => $dbq,
|
||||
'order' => 'm.ctime DESC',
|
||||
'limit' => array( $start, 20 ),
|
||||
'add_join' => array(
|
||||
array( 'select' => 'mem.members_display_name',
|
||||
'from' => array( 'members' => 'mem' ),
|
||||
'where' => 'mem.member_id=m.member_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
array( 'select' => 'f.id as forum_id, f.name',
|
||||
'from' => array( 'forums' => 'f' ),
|
||||
'where' => 'f.id=m.forum_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
}
|
||||
|
||||
///----------------------------------------
|
||||
// Page links
|
||||
//-----------------------------------------
|
||||
|
||||
$links = $this->registry->output->generatePagination( array( 'totalItems' => $row_count,
|
||||
'itemsPerPage' => 20,
|
||||
'currentStartValue' => $start,
|
||||
'baseUrl' => $this->settings['base_url'] . $query,
|
||||
)
|
||||
);
|
||||
|
||||
///----------------------------------------
|
||||
// Get db results
|
||||
//-----------------------------------------
|
||||
|
||||
while ( $row = $this->DB->fetch() )
|
||||
{
|
||||
$row['_time'] = $this->registry->class_localization->getDate( $row['ctime'], 'LONG' );
|
||||
$row['topic'] = $row['topic_id'] ? $this->lang->words['mlog_topicid'] . $row['topic_id'] : ' ';
|
||||
$row['http_referer'] = preg_replace( "/s=(\w){32}/" , "", $row['http_referer'] );
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
///----------------------------------------
|
||||
// And output
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->html .= $this->html->modlogsView( $rows, $links );
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove logs by a moderator
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _remove()
|
||||
{
|
||||
if ( $this->request['mid'] == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mlog_noid'], 11131 );
|
||||
}
|
||||
|
||||
$this->DB->delete( 'moderator_logs', "member_id=" . intval($this->request['mid']) );
|
||||
|
||||
$this->registry->getClass('adminFunctions')->saveAdminLog( $this->lang->words['mlog_removed'] . $this->request['mid'] );
|
||||
|
||||
$this->registry->output->silentRedirect( $this->settings['base_url'] . "&{$this->form_code}" );
|
||||
}
|
||||
|
||||
/**
|
||||
* List the current logs with links to view per-admin
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _listCurrent()
|
||||
{
|
||||
$rows = array();
|
||||
$admins = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// VIEW LAST 5
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => 'm.*',
|
||||
'from' => array( 'moderator_logs' => 'm' ),
|
||||
'order' => 'm.ctime DESC',
|
||||
'limit' => array( 0, 5 ),
|
||||
'add_join' => array(
|
||||
array( 'select' => 'mem.members_display_name',
|
||||
'from' => array( 'members' => 'mem' ),
|
||||
'where' => 'mem.member_id=m.member_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
array( 'select' => 'f.id as forum_id, f.name',
|
||||
'from' => array( 'forums' => 'f' ),
|
||||
'where' => 'f.id=m.forum_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $row = $this->DB->fetch() )
|
||||
{
|
||||
$row['_time'] = $this->registry->class_localization->getDate( $row['ctime'], 'LONG' );
|
||||
$row['topic'] = $row['topic_id'] ? $this->lang->words['mlog_topicid'] . $row['topic_id'] : ' ';
|
||||
$row['http_referer'] = preg_replace( "/s=(\w){32}/" , "", $row['http_referer'] );
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// All mods
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'member_id, count(member_id) as act_count',
|
||||
'from' => 'moderator_logs',
|
||||
'group' => 'member_id',
|
||||
'order' => 'act_count DESC'
|
||||
) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
$_members = array();
|
||||
$_store = array();
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$_members[] = $r['member_id'];
|
||||
$_store[ $r['member_id'] ] = $r;
|
||||
}
|
||||
|
||||
if ( !empty( $_members ) )
|
||||
{
|
||||
$this->DB->build( array( 'select' => 'member_id, members_display_name',
|
||||
'from' => 'members',
|
||||
'where' => 'member_id IN (' . implode( ',', $_members ) . ')',
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$admins[] = array_merge( $r, $_store[ $r['member_id'] ] );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// And output
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->html .= $this->html->modlogsWrapper( $rows, $admins );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Admin logs
|
||||
* Last Updated: $LastChangedDate$
|
||||
*
|
||||
* @author $Author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev$
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_logs_spamlogs extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Skin object
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html = $this->registry->output->loadTemplate('cp_skin_spamlogs');
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$this->form_code = $this->html->form_code = 'module=logs&section=spamlogs';
|
||||
$this->form_code_js = $this->html->form_code_js = 'module=logs§ion=spamlogs';
|
||||
|
||||
//-----------------------------------------
|
||||
// Load lang
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_logs' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up navigation bar
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->core_nav = array();
|
||||
$this->registry->output->ignoreCoreNav = true;
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=tools', $this->lang->words['nav_toolsmodule'] );
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=tools§ion=logsSplash', $this->lang->words['nav_logssplash'] );
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=logs§ion=spamlogs', $this->lang->words['slog_spamlogs'] );
|
||||
|
||||
///----------------------------------------
|
||||
// What to do...
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'remove':
|
||||
$this->_remove();
|
||||
break;
|
||||
|
||||
case 'testapi':
|
||||
$this->_testApiConnection();
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->_listCurrent();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
protected function _testApiConnection()
|
||||
{
|
||||
/* Test the connection */
|
||||
$result = IPSMember::querySpamService( '', '', '', 1 );
|
||||
|
||||
$this->registry->output->html .= $this->html->spamServiceTest($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove log
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
protected function _remove()
|
||||
{
|
||||
if( $this->request['type'] == 'all' )
|
||||
{
|
||||
$this->DB->delete( 'spam_service_log' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$ids = array();
|
||||
|
||||
foreach( $this->request as $k => $v )
|
||||
{
|
||||
if ( preg_match( "/^id_(\d+)$/", $k, $match ) )
|
||||
{
|
||||
if ($this->request[ $match[0] ] )
|
||||
{
|
||||
$ids[] = $match[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ids = IPSLib::cleanIntArray( $ids );
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
if( count($ids) < 1 )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['erlog_noneselected'], 11115 );
|
||||
}
|
||||
|
||||
$this->DB->delete( 'spam_service_log', "id IN (" . implode( ',', $ids ) . ")" );
|
||||
}
|
||||
|
||||
$this->registry->output->silentRedirect( $this->settings['base_url']."&{$this->form_code}" );
|
||||
}
|
||||
|
||||
/**
|
||||
* List the current logs
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
protected function _listCurrent()
|
||||
{
|
||||
/* INIT */
|
||||
$rows = array();
|
||||
$st = $this->request['st'] ? intval( $this->request['st'] ) : 0;
|
||||
$perPage = 25;
|
||||
|
||||
/* Pagination */
|
||||
$total = $this->DB->buildAndFetch( array( 'select' => 'count(*) as logs', 'from' => 'spam_service_log' ) );
|
||||
|
||||
$pageLinks = $this->registry->output->generatePagination( array(
|
||||
'totalItems' => $total['logs'],
|
||||
'itemsPerPage' => $perPage,
|
||||
'currentStartValue' => $st,
|
||||
'baseUrl' => $this->settings['base_url'] . $this->form_code,
|
||||
) );
|
||||
|
||||
/* Query the logs */
|
||||
$this->DB->build( array(
|
||||
'select' => '*',
|
||||
'from' => 'spam_service_log',
|
||||
'order' => 'log_date DESC',
|
||||
'limit' => array( $st, $perPage ),
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
$row['_time'] = $this->registry->class_localization->getDate( $row['log_date'], 'LONG' );
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// And output
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->html .= $this->html->spamlogsWrapper( $rows, $pageLinks );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Search Engine Spider logs
|
||||
* Last Updated: $LastChangedDate: 2009-12-07 09:26:30 -0500 (Mon, 07 Dec 2009) $
|
||||
*
|
||||
* @author $Author: mark $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 27th January 2004
|
||||
* @version $Rev: 5526 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_logs_spiderlogs extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Skin object
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Spider map
|
||||
*
|
||||
* @access private
|
||||
* @var array Spider keys to values
|
||||
*/
|
||||
private $bot_map = array();
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* Load bat names from the useragents cache */
|
||||
foreach( $this->cache->getCache( 'useragents' ) as $agent )
|
||||
{
|
||||
if( $agent['uagent_type'] == 'search' )
|
||||
{
|
||||
$this->bot_map[ $agent['uagent_key'] ] = $agent['uagent_name'];
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Load skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html = $this->registry->output->loadTemplate('cp_skin_spiderlogs');
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$this->form_code = $this->html->form_code = 'module=logs&section=spiderlogs';
|
||||
$this->form_code_js = $this->html->form_code_js = 'module=logs§ion=spiderlogs';
|
||||
|
||||
//-----------------------------------------
|
||||
// Load lang
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_logs' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up navigation bar
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->core_nav = array();
|
||||
$this->registry->output->ignoreCoreNav = true;
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=tools', $this->lang->words['nav_toolsmodule'] );
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=tools§ion=logsSplash', $this->lang->words['nav_logssplash'] );
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=logs§ion=spiderlogs', $this->lang->words['slog_spider_logs'] );
|
||||
|
||||
///----------------------------------------
|
||||
// What to do...
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'view':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'spiderlogs_view' );
|
||||
$this->_view();
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'spiderlogs_delete' );
|
||||
$this->_remove();
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'spiderlogs_view' );
|
||||
$this->_listCurrent();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* View all logs for a given moderator
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _view()
|
||||
{
|
||||
///----------------------------------------
|
||||
// Basic init
|
||||
//-----------------------------------------
|
||||
|
||||
$start = intval($this->request['st']) >= 0 ? intval($this->request['st']) : 0;
|
||||
|
||||
$botty = IPSText::parseCleanValue( urldecode($this->request['bid'] ) );
|
||||
$botty = str_replace( "!", "!", $botty );
|
||||
|
||||
///----------------------------------------
|
||||
// No bid or search string?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->request['search_string'] AND !$this->request['bid'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['slog_nostring'];
|
||||
$this->_listCurrent();
|
||||
return;
|
||||
}
|
||||
|
||||
///----------------------------------------
|
||||
// mid?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->request['search_string'] )
|
||||
{
|
||||
$row = $this->DB->buildAndFetch( array( 'select' => 'COUNT(sid) as count', 'from' => 'spider_logs', 'where' => "bot='{$botty}'" ) );
|
||||
|
||||
$row_count = $row['count'];
|
||||
|
||||
$query = "&{$this->form_code}&bid=" . $this->request['bid'] . "&do=view";
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'spider_logs',
|
||||
'where' => "bot='{$botty}'",
|
||||
'order' => 'entry_date DESC',
|
||||
'limit' => array( $start, 20 ) ) );
|
||||
$this->DB->execute();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->request[ 'search_string'] = IPSText::parseCleanValue( urldecode($this->request['search_string'] ) );
|
||||
|
||||
$row = $this->DB->buildAndFetch( array( 'select' => 'COUNT(sid) as count', 'from' => 'spider_logs', 'where' => "query_string LIKE '%" . $this->request['search_string'] . "%'" ) );
|
||||
|
||||
$row_count = $row['count'];
|
||||
|
||||
$query = "&{$this->form_code}&do=view&search_string=" . urlencode($this->request['search_string']);
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'spider_logs',
|
||||
'where' => "query_string LIKE '%" . $this->request['search_string'] . "%'",
|
||||
'order' => 'entry_date DESC',
|
||||
'limit' => array( $start, 20 ) ) );
|
||||
$this->DB->execute();
|
||||
}
|
||||
|
||||
///----------------------------------------
|
||||
// Page links
|
||||
//-----------------------------------------
|
||||
|
||||
$links = $this->registry->output->generatePagination( array( 'totalItems' => $row_count,
|
||||
'itemsPerPage' => 20,
|
||||
'currentStartValue' => $start,
|
||||
'baseUrl' => $this->settings['base_url'] . $query,
|
||||
)
|
||||
);
|
||||
|
||||
///----------------------------------------
|
||||
// Get db results
|
||||
//-----------------------------------------
|
||||
|
||||
while ( $row = $this->DB->fetch() )
|
||||
{
|
||||
$extra = "";
|
||||
|
||||
if ( stripos( '#lo-fi#i', $row['query_string'] ) !== false )
|
||||
{
|
||||
$extra = $this->lang->words['slog_lofi'];
|
||||
|
||||
$query_string_html = $extra . ' ' . $row['query_string'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$query_string_html = "<a href='" . $this->settings['board_url'] . "/index." . $this->settings['php_ext'] . "?{$row['query_string']}' target='_blank'>" . IPSText::truncate($row['query_string']) . "</a>";
|
||||
}
|
||||
|
||||
$row['_bot_name'] = $this->bot_map[ mb_strtolower($row['bot']) ];
|
||||
$row['_query_string'] = $query_string_html;
|
||||
$row['_time'] = $this->registry->getClass('class_localization')->getDate( $row['entry_date'], 'LONG' );
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
///----------------------------------------
|
||||
// And output
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->html .= $this->html->spiderlogsView( $rows, $links );
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove logs by a moderator
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _remove()
|
||||
{
|
||||
if ( $this->request['bid'] == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['slog_nologs'], 11132 );
|
||||
}
|
||||
|
||||
$botty = urldecode($this->request['bid']);
|
||||
$botty = str_replace( "!", "!", $botty );
|
||||
|
||||
$this->DB->delete( 'spider_logs', "bot='{$botty}'" );
|
||||
|
||||
$this->registry->getClass('adminFunctions')->saveAdminLog($this->lang->words['slog_adminlog']);
|
||||
|
||||
$this->registry->output->silentRedirect( $this->settings['base_url']."&{$this->form_code}" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* List the current logs with links to view per-admin
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _listCurrent()
|
||||
{
|
||||
$spiders = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// All bots
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => 'count(*) as cnt, bot, max(entry_date) as entry_date',
|
||||
'from' => 'spider_logs',
|
||||
'group' => 'bot',
|
||||
'order' => 'entry_date DESC',
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$r['_bot_name'] = $this->bot_map[ mb_strtolower($r['bot']) ];
|
||||
$r['_time'] = $this->registry->getClass('class_localization')->getDate( $r['entry_date'], 'SHORT' );
|
||||
$r['_bot_url'] = urlencode($r['bot']);
|
||||
|
||||
$spiders[] = $r;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// And output
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->html .= $this->html->spiderlogsWrapper( $spiders );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,505 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Warn logs
|
||||
* Last Updated: $LastChangedDate: 2009-12-07 09:26:30 -0500 (Mon, 07 Dec 2009) $
|
||||
*
|
||||
* @author $Author: mark $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 27th January 2004
|
||||
* @version $Rev: 5526 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_logs_warnlogs extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Skin object
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html = $this->registry->output->loadTemplate('cp_skin_warnlogs');
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$this->form_code = $this->html->form_code = 'module=logs&section=warnlogs';
|
||||
$this->form_code_js = $this->html->form_code_js = 'module=logs§ion=warnlogs';
|
||||
|
||||
//-----------------------------------------
|
||||
// Load lang
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_logs' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up navigation bar
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->core_nav = array();
|
||||
$this->registry->output->ignoreCoreNav = true;
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=tools', $this->lang->words['nav_toolsmodule'] );
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=tools§ion=logsSplash', $this->lang->words['nav_logssplash'] );
|
||||
$this->registry->output->core_nav[] = array( $this->settings['base_url'] . 'module=logs§ion=warnlogs', $this->lang->words['wlog_warn_logs'] );
|
||||
|
||||
///----------------------------------------
|
||||
// What to do...
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'view':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'warnlogs_view' );
|
||||
$this->_view();
|
||||
break;
|
||||
|
||||
case 'viewcontact':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'warnlogs_view' );
|
||||
$this->_viewContact();
|
||||
break;
|
||||
|
||||
case 'viewnote':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'warnlogs_view' );
|
||||
$this->_viewNote();
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'warnlogs_delete' );
|
||||
$this->_remove();
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'warnlogs_view' );
|
||||
$this->_listCurrent();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* View all logs for a given moderator
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _view()
|
||||
{
|
||||
///----------------------------------------
|
||||
// Basic init
|
||||
//-----------------------------------------
|
||||
|
||||
$start = intval($this->request['st']) >= 0 ? intval($this->request['st']) : 0;
|
||||
|
||||
///----------------------------------------
|
||||
// No mid or search string?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->request['search_string'] AND !$this->request['mid'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['wlog_nostring'];
|
||||
$this->_listCurrent();
|
||||
return;
|
||||
}
|
||||
|
||||
///----------------------------------------
|
||||
// mid?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->request['search_string'] )
|
||||
{
|
||||
$row = $this->DB->buildAndFetch( array( 'select' => 'COUNT(wlog_id) as count', 'from' => 'warn_logs', 'where' => "wlog_mid=".intval($this->request['mid']) ) );
|
||||
|
||||
$row_count = $row['count'];
|
||||
|
||||
$query = "&{$this->form_code}&mid=" . $this->request['mid'] . "&do=view";
|
||||
|
||||
$this->DB->build( array( 'select' => 'l.*',
|
||||
'from' => array( 'warn_logs' => 'l' ),
|
||||
'where' => 'l.wlog_mid=' . intval($this->request['mid']),
|
||||
'order' => 'l.wlog_date DESC',
|
||||
'limit' => array( $start, 30 ),
|
||||
'add_join' => array(
|
||||
array( 'select' => 'm.member_id as a_id, m.members_display_name as a_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=l.wlog_mid',
|
||||
'type' => 'left'
|
||||
),
|
||||
array( 'select' => 'p.member_id as p_id, p.members_display_name as p_name',
|
||||
'from' => array( 'members' => 'p' ),
|
||||
'where' => 'p.member_id=l.wlog_addedby',
|
||||
'type' => 'left'
|
||||
),
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->request[ 'search_string'] = IPSText::parseCleanValue( urldecode($this->request['search_string'] ) );
|
||||
|
||||
if ( ($this->request['search_type'] == 'notes') )
|
||||
{
|
||||
$dbq = "l.wlog_notes LIKE '%" . $this->request['search_string'] . "%'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$dbq = "l.wlog_contact_content LIKE '%" . $this->request['search_string'] . "%'";
|
||||
}
|
||||
|
||||
$row = $this->DB->buildAndFetch( array( 'select' => 'COUNT(l.wlog_id) as count', 'from' => 'warn_logs l', 'where' => $dbq ) );
|
||||
|
||||
$row_count = $row['count'];
|
||||
|
||||
$query = "&{$this->form_code}&do=view&search_type=" . $this->request['search_type'] . "&search_string=" . urlencode($this->request['search_string']);
|
||||
|
||||
$this->DB->build( array( 'select' => 'l.*',
|
||||
'from' => array( 'warn_logs' => 'l' ),
|
||||
'where' => $dbq,
|
||||
'order' => 'l.wlog_date DESC',
|
||||
'limit' => array( $start, 30 ),
|
||||
'add_join' => array(
|
||||
array( 'select' => 'm.member_id as a_id, m.members_display_name as a_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=l.wlog_mid',
|
||||
'type' => 'left'
|
||||
),
|
||||
array( 'select' => 'p.member_id as p_id, p.members_display_name as p_name',
|
||||
'from' => array( 'members' => 'p' ),
|
||||
'where' => 'p.member_id=l.wlog_addedby',
|
||||
'type' => 'left'
|
||||
),
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
}
|
||||
|
||||
///----------------------------------------
|
||||
// Page links
|
||||
//-----------------------------------------
|
||||
|
||||
$links = $this->registry->output->generatePagination( array( 'totalItems' => $row_count,
|
||||
'itemsPerPage' => 20,
|
||||
'currentStartValue' => $start,
|
||||
'baseUrl' => $this->settings['base_url'] . $query,
|
||||
)
|
||||
);
|
||||
|
||||
///----------------------------------------
|
||||
// Get teh results
|
||||
//-----------------------------------------
|
||||
|
||||
$days = array( 'd' => $this->lang->words['wlog_days'], 'h' => $this->lang->words['wlog_hours'] );
|
||||
|
||||
while ( $row = $this->DB->fetch() )
|
||||
{
|
||||
///----------------------------------------
|
||||
// Basics
|
||||
//-----------------------------------------
|
||||
|
||||
$row['_a_name'] = $row['a_name'] ? $row['a_name'] : sprintf( $this->lang->words['wlog_deleted'], $row['wlog_mid'] );
|
||||
$row['_date'] = $this->registry->class_localization->getDate( $row['wlog_date'], 'LONG' );
|
||||
|
||||
$row['_type'] = ( $row['wlog_type'] == 'pos' ) ? '<span style="color:green;font-weight:bold">-</span>' : '<span style="color:red;font-weight:bold">+</span>';
|
||||
$row['_type'] = ( $row['wlog_type'] == 'custom' ) ? '<span style="color:grey;font-weight:bold">C</span>' : $row['_type'];
|
||||
$row['_cont'] = ( $row['wlog_contact'] != 'none' ) ? "<a href='#' onclick='return acp.openWindow(\"{$this->settings['base_url']}&{$this->form_code}&do=viewcontact&id={$row['wlog_id']}\", 400,400, \"{$this->lang->words['wlog_log']}\"); return false;'>{$this->lang->words['wlog_view']}</a>" : ' ';
|
||||
|
||||
///----------------------------------------
|
||||
// Mod Q
|
||||
//-----------------------------------------
|
||||
|
||||
$mod = preg_match( "#<mod>(.+?)</mod>#is" , $row['wlog_notes'], $mm );
|
||||
$mod = trim($mm[1]);
|
||||
list($v, $u, $i) = explode( ',', $mod);
|
||||
|
||||
$row['_mod'] = ( $i == 1 ) ? 'INDEF' : ( $v == "" ? 'None' : $v . ' ' . $days[$u] );
|
||||
|
||||
///----------------------------------------
|
||||
// Susp
|
||||
//-----------------------------------------
|
||||
|
||||
$susp = preg_match( "#<susp>(.+?)</susp>#is" , $row['wlog_notes'], $sm );
|
||||
$susp = trim($sm[1]);
|
||||
list($v, $u) = explode( ',', $susp );
|
||||
$row['_susp'] = $v == '' ? 'None' : $v . ' ' . $days[$u];
|
||||
|
||||
///----------------------------------------
|
||||
// Posting Susp
|
||||
//-----------------------------------------
|
||||
|
||||
$post = preg_match( "#<post>(.+?)</post>#is" , $row['wlog_notes'], $pm );
|
||||
$post = trim($pm[1]);
|
||||
list($v, $u, $i) = explode( ',', $post );
|
||||
|
||||
$row['_post'] = ( $i == 1 ) ? 'INDEF' : ( $v == "" ? 'None' : $v . ' ' . $days[$u] );
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
///----------------------------------------
|
||||
// And output
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->html .= $this->html->warnlogsView( $rows, $links );
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove logs by a moderator
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _remove()
|
||||
{
|
||||
if ( $this->request['mid'] == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['wlog_nofind'], 11133 );
|
||||
}
|
||||
|
||||
$this->DB->delete( 'warn_logs', "wlog_mid=" . intval($this->request['mid']) );
|
||||
|
||||
$this->registry->getClass('adminFunctions')->saveAdminLog( sprintf( $this->lang->words['wlog_removelogs'], $this->request['mid'] ) );
|
||||
|
||||
$this->registry->output->silentRedirect( $this->settings['base_url']."&{$this->form_code}" );
|
||||
}
|
||||
|
||||
/**
|
||||
* List the current logs with links to view per-admin
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _listCurrent()
|
||||
{
|
||||
$rows = array();
|
||||
$members = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// VIEW LAST 5
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => 'l.*',
|
||||
'from' => array( 'warn_logs' => 'l' ),
|
||||
'order' => 'l.wlog_date DESC',
|
||||
'limit' => array( 0, 10 ),
|
||||
'add_join' => array(
|
||||
array( 'select' => 'm.member_id as a_id, m.members_display_name as a_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=l.wlog_mid',
|
||||
'type' => 'left'
|
||||
),
|
||||
array( 'select' => 'p.member_id as p_id, p.members_display_name as p_name',
|
||||
'from' => array( 'members' => 'p' ),
|
||||
'where' => 'p.member_id=l.wlog_addedby',
|
||||
'type' => 'left'
|
||||
),
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $row = $this->DB->fetch() )
|
||||
{
|
||||
$row['_a_name'] = $row['a_name'] ? $row['a_name'] : sprintf( $this->lang->words['wlog_deleted'], $row['wlog_mid'] );
|
||||
$row['_date'] = $this->registry->class_localization->getDate( $row['wlog_date'], 'LONG' );
|
||||
$row['_type'] = ( $row['wlog_type'] == 'pos' ) ? '<span style="color:green;font-weight:bold">-</span>' : '<span style="color:red;font-weight:bold">+</span>';
|
||||
$row['_type'] = ( $row['wlog_type'] == 'custom' ) ? '<span style="color:grey;font-weight:bold">C</span>' : $row['_type'];
|
||||
$row['_cont'] = ( $row['wlog_contact'] != 'none' ) ? "<a title='{$this->lang->words['wlog_showmessage']}' href='#' onclick='return acp.openWindow(\"{$this->settings['base_url']}&{$this->form_code}&do=viewcontact&id={$row['wlog_id']}\",400,400,\"{$this->lang->words['wlog_log']}\"); return false;'><img src='{$this->settings['skin_acp_url']}/_newimages/icons/tick.png' border='0' alt='{$this->lang->words['wlog_contacted']}'></a>" : ' ';
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// All members
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'wlog_mid, count(wlog_mid) as act_count',
|
||||
'from' => 'warn_logs',
|
||||
'group' => 'wlog_mid',
|
||||
'order' => 'act_count DESC'
|
||||
) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
$_members = array();
|
||||
$_store = array();
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$_members[] = $r['wlog_mid'];
|
||||
$_store[ $r['wlog_mid'] ] = $r;
|
||||
}
|
||||
|
||||
if ( !empty( $_members ) )
|
||||
{
|
||||
$this->DB->build( array( 'select' => 'member_id, members_display_name',
|
||||
'from' => 'members',
|
||||
'where' => 'member_id IN (' . implode( ',', $_members ) . ')',
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$members[] = array_merge( $r, $_store[ $r['member_id'] ] );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Output
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->html .= $this->html->warnlogsWrapper( $rows, $members );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Popup window to view a note
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _viewNote()
|
||||
{
|
||||
if ( $this->request['id'] == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['wlog_nologs'], 11134 );
|
||||
}
|
||||
|
||||
$id = intval($this->request['id']);
|
||||
|
||||
$row = $this->DB->buildAndFetch( array( 'select' => 'l.*',
|
||||
'from' => array( 'warn_logs' => 'l' ),
|
||||
'where' => 'l.wlog_id=' . $id,
|
||||
'add_join' => array(
|
||||
array( 'select' => 'm.member_id as a_id, m.members_display_name as a_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=l.wlog_mid',
|
||||
'type' => 'left'
|
||||
),
|
||||
array( 'select' => 'p.member_id as p_id, p.members_display_name as p_name, p.member_group_id, p.mgroup_others',
|
||||
'from' => array( 'members' => 'p' ),
|
||||
'where' => 'p.member_id=l.wlog_addedby',
|
||||
'type' => 'left'
|
||||
),
|
||||
)
|
||||
) );
|
||||
|
||||
if ( ! $row['wlog_id'] )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['wlog_cantresolve'], 11135 );
|
||||
}
|
||||
|
||||
$content = preg_match( "#<content>(.+?)</content>#is", $row['wlog_notes'], $cont );
|
||||
|
||||
$row['_date'] = $this->registry->class_localization->getDate( $row['wlog_date'], 'LONG' );
|
||||
$row['a_name'] = $row['a_name'] ? $row['a_name'] : 'Deleted Member (ID:' . $row['wlog_mid'] . ')';
|
||||
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_smilies = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_html = 0;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
|
||||
IPSText::getTextClass('bbcode')->parsing_section = 'warn';
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $row['member_group_id'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $row['mgroup_others'];
|
||||
|
||||
$row['_text'] = IPSText::getTextClass('bbcode')->preDisplayParse( $cont[1] );
|
||||
|
||||
$this->registry->output->html .= $this->html->warnlogsNote( $row );
|
||||
|
||||
$this->registry->output->printPopupWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Popup window to view a contact
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _viewContact()
|
||||
{
|
||||
if ( $this->request['id'] == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['wlog_nologs'], 11136 );
|
||||
}
|
||||
|
||||
$id = intval($this->request['id']);
|
||||
|
||||
$row = $this->DB->buildAndFetch( array( 'select' => 'l.*',
|
||||
'from' => array( 'warn_logs' => 'l' ),
|
||||
'where' => 'l.wlog_id=' . $id,
|
||||
'add_join' => array(
|
||||
array( 'select' => 'm.member_id as a_id, m.members_display_name as a_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=l.wlog_mid',
|
||||
'type' => 'left'
|
||||
),
|
||||
array( 'select' => 'p.member_id as p_id, p.members_display_name as p_name, p.member_group_id, p.mgroup_others',
|
||||
'from' => array( 'members' => 'p' ),
|
||||
'where' => 'p.member_id=l.wlog_addedby',
|
||||
'type' => 'left'
|
||||
),
|
||||
)
|
||||
) );
|
||||
|
||||
if ( ! $row['wlog_id'] )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['wlog_nologs'], 11137 );
|
||||
}
|
||||
|
||||
$subject = preg_match( "#<subject>(.+?)</subject>#is", $row['wlog_contact_content'], $subj );
|
||||
$content = preg_match( "#<content>(.+?)</content>#is", $row['wlog_contact_content'], $cont );
|
||||
|
||||
$row['_type'] = $row['wlog_contact'] == 'pm' ? $this->lang->words['wlog_pm'] : $this->lang->words['wlog_email'];
|
||||
$row['_subject'] = $subj[1];
|
||||
$row['_date'] = $this->registry->class_localization->getDate( $row['wlog_date'], 'LONG' );
|
||||
$row['a_name'] = $row['a_name'] ? $row['a_name'] : sprintf( $this->lang->words['wlog_deleted'], $row['wlog_mid'] );
|
||||
|
||||
$row['_text'] = $cont[1];
|
||||
|
||||
IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_html = 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = 'warn';
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $row['member_group_id'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $row['mgroup_others'];
|
||||
|
||||
$row['_text'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $row['_text'] );
|
||||
$row['_text'] = $this->registry->output->replaceMacros( $row['_text'] );
|
||||
|
||||
$this->registry->output->html .= $this->html->warnlogsContact( $row );
|
||||
|
||||
$this->registry->output->printPopupWindow();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<permissions>
|
||||
<group>
|
||||
<grouptitle>Журнал администраторских действий</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>adminlogs_view</key>
|
||||
<string>Может просматривать журнал?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>adminlogs_delete</key>
|
||||
<string>Может удлаять записи?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
<group>
|
||||
<grouptitle>Журнал модераторских действий</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>modlogs_view</key>
|
||||
<string>Может просматривать журнал?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>modlogs_delete</key>
|
||||
<string>Может удлаять записи?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
<group>
|
||||
<grouptitle>Журнал Email отправлений</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>emaillogs_view</key>
|
||||
<string>Может просматривать журнал?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>emaillogs_delete</key>
|
||||
<string>Может удлаять записи?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
<group>
|
||||
<grouptitle>Журнал ошибок Email</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>emailerrorlogs_view</key>
|
||||
<string>Может просматривать журнал?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>emailerrorlogs_delete</key>
|
||||
<string>Может удлаять записи?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
<group>
|
||||
<grouptitle>Журнал действий поисковых роботов</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>spiderlogs_view</key>
|
||||
<string>Может просматривать журнал?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>spiderlogs_delete</key>
|
||||
<string>Может удлаять записи?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
<group>
|
||||
<grouptitle>Журнал пользовательских предупреждений</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>warnlogs_view</key>
|
||||
<string>Может просматривать журнал?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>warnlogs_delete</key>
|
||||
<string>Может удлаять записи?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
<group>
|
||||
<grouptitle>Журнал ошибок системы</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>errorlogs_view</key>
|
||||
<string>Может просматривать журнал?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>errorlogs_delete</key>
|
||||
<string>Может удлаять записи?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
</permissions>
|
||||
@@ -0,0 +1,688 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Dashboard
|
||||
* Last Updated: $Date: 2009-12-01 17:42:17 -0500 (Tue, 01 Dec 2009) $
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 5th January 2005
|
||||
* @version $Revision: 5501 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_mycp_dashboard extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Skin object
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Shortcut for url
|
||||
*
|
||||
* @access private
|
||||
* @var string URL shortcut
|
||||
*/
|
||||
private $form_code;
|
||||
|
||||
/**
|
||||
* Shortcut for url (javascript)
|
||||
*
|
||||
* @access private
|
||||
* @var string JS URL shortcut
|
||||
*/
|
||||
private $form_code_js;
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html = $this->registry->output->loadTemplate('cp_skin_mycp');
|
||||
|
||||
//-----------------------------------------
|
||||
// Load language
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_mycp' ) );
|
||||
|
||||
/* This is a little hacky, but we have to allow access to the whole module to get access to
|
||||
'change my details'. This check just makes sure that we don't also get access to the Dashboard
|
||||
if the permission system automatically added permission for 'change my details' */
|
||||
if( $this->registry->getClass('class_permissions')->editDetailsOnly )
|
||||
{
|
||||
ipsRegistry::getClass('output')->showError( 'no_permission', 1004 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$this->form_code = $this->html->form_code = 'module=mycp&section=dashboard';
|
||||
$this->form_code_js = $this->html->form_code_js = 'module=mycp§ion=dashboard';
|
||||
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
define( 'IPS_NEWS_URL' , '' );
|
||||
define( 'IPS_BULLETINS_URL' , '' );
|
||||
define( 'IPS_VERSION_CHECK_URL' , '' );
|
||||
|
||||
$content = array();
|
||||
$thiscontent = "";
|
||||
$latest_version = array();
|
||||
$reg_end = "";
|
||||
$sm_install = 0;
|
||||
$lock_file = 0;
|
||||
$converter = 0;
|
||||
$fulltext_a = 0;
|
||||
$unfinished_upgrade = 0;
|
||||
$urls = array( 'news' => IPS_NEWS_URL,
|
||||
'keiths_bits' => IPS_BULLETINS_URL,
|
||||
'version_check' => IPS_VERSION_CHECK_URL,
|
||||
'blogs' => '' );
|
||||
|
||||
if ( @file_exists( IPS_ROOT_PATH . 'install/index.php' ) )
|
||||
{
|
||||
$sm_install = 1;
|
||||
}
|
||||
|
||||
if ( @file_exists( DOC_IPS_ROOT_PATH . 'cache/installer_lock.php' ) )
|
||||
{
|
||||
$lock_file = 1;
|
||||
}
|
||||
|
||||
if ( @is_dir( IPS_ROOT_PATH . 'applications_addon/ips/convert/' ) and !@file_exists( DOC_IPS_ROOT_PATH . 'cache/converter_lock.php' ) )
|
||||
{
|
||||
$converter = 1;
|
||||
}
|
||||
|
||||
if( $this->DB->checkFulltextSupport() )
|
||||
{
|
||||
if( ! $this->DB->getFulltextStatus( 'posts' ) )
|
||||
{
|
||||
$fulltext_a = 1;
|
||||
}
|
||||
}
|
||||
|
||||
require_once( IPS_ROOT_PATH . '/setup/sources/base/setup.php' );
|
||||
$versions = IPSSetUp::fetchAppVersionNumbers( 'core' );
|
||||
|
||||
if( $versions['current'][0] != $versions['latest'][0] )
|
||||
{
|
||||
$unfinished_upgrade = 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get MySQL & PHP Version
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->getSqlVersion();
|
||||
|
||||
//-----------------------------------------
|
||||
// Upgrade history?
|
||||
//-----------------------------------------
|
||||
|
||||
$latest_version = array( 'upgrade_version_id' => NULL );
|
||||
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'upgrade_history', 'order' => 'upgrade_version_id DESC', 'limit' => array(1) ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$latest_version = $r;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Resetting security image?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->request['reset_security_flag'] AND $this->request['reset_security_flag'] == 1 AND $this->request['new_build'] )
|
||||
{
|
||||
$_latest = IPSLib::fetchVersionNumber('core');
|
||||
$new_build = intval( $this->request['new_build'] );
|
||||
$new_reason = trim( substr( $this->request['new_reason'], 0, 1 ) );
|
||||
$new_version = $_latest['long'].'.'.$new_build.'.'.$new_reason;
|
||||
|
||||
$this->DB->update( 'upgrade_history', array( 'upgrade_notes' => $new_version ), 'upgrade_version_id='.$latest_version['upgrade_version_id'] );
|
||||
|
||||
$latest_version['upgrade_notes'] = $new_version;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Got real version number?
|
||||
//-----------------------------------------
|
||||
|
||||
ipsRegistry::$version = 'v'.$latest_version['upgrade_version_human'];
|
||||
ipsRegistry::$vn_full = ( isset($latest_version['upgrade_notes']) AND $latest_version['upgrade_notes'] ) ? $latest_version['upgrade_notes'] : ipsRegistry::$vn_full;
|
||||
|
||||
//-----------------------------------------
|
||||
// Licensed?
|
||||
//-----------------------------------------
|
||||
|
||||
$urls['keiths_bits'] = IPS_BULLETINS_URL . '?v=' . ipsRegistry::$vn_full;
|
||||
|
||||
//-----------------------------------------
|
||||
// Notepad
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->request['save'] AND $this->request['save'] == 1 )
|
||||
{
|
||||
$_POST['notes'] = $_POST['notes'] ? $_POST['notes'] : $this->lang->words['cp_acpnotes'];
|
||||
$this->cache->setCache( 'adminnotes', IPSText::stripslashes($_POST['notes']), array( 'donow' => 1, 'array' => 0 ) );
|
||||
}
|
||||
|
||||
$text = $this->lang->words['cp_acpnotes'];
|
||||
|
||||
if ( !$this->cache->getCache('adminnotes') OR !$this->cache->getCache('adminnotes') )
|
||||
{
|
||||
$this->cache->setCache( 'adminnotes', $text, array( 'donow' => 1, 'array' => 0 ) );
|
||||
}
|
||||
|
||||
$this->cache->updateCacheWithoutSaving( 'adminnotes', htmlspecialchars($this->cache->getCache('adminnotes'), ENT_QUOTES) );
|
||||
$this->cache->updateCacheWithoutSaving( 'adminnotes', str_replace( "&#", "&#", $this->cache->getCache('adminnotes') ) );
|
||||
|
||||
$content['ad_notes'] = $this->html->acp_notes( $this->cache->getCache('adminnotes') );
|
||||
|
||||
//-----------------------------------------
|
||||
// ADMINS USING CP
|
||||
//-----------------------------------------
|
||||
|
||||
$t_time = time() - 60*10;
|
||||
$time_now = time();
|
||||
$seen_name = array();
|
||||
$acponline = "";
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 's.session_member_name, s.session_member_id, s.session_location, s.session_log_in_time, s.session_running_time, s.session_ip_address, s.session_url',
|
||||
'from' => array( 'core_sys_cp_sessions' => 's' ),
|
||||
'add_join' => array( array( 'select' => 'm.*',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.member_id=s.session_member_id",
|
||||
'type' => 'left'
|
||||
),
|
||||
array( 'select' => 'pp.*',
|
||||
'from' => array( 'profile_portal' => 'pp' ),
|
||||
'where' => 'pp.pp_member_id=m.member_id',
|
||||
'type' => 'left'
|
||||
) ) ) );
|
||||
|
||||
$q = $this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch( $q ) )
|
||||
{
|
||||
if ( isset($seen_name[ $r['session_member_name'] ]) AND $seen_name[ $r['session_member_name'] ] == 1 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$seen_name[ $r['session_member_name'] ] = 1;
|
||||
}
|
||||
|
||||
$r['_log_in'] = $time_now - $r['session_log_in_time'];
|
||||
$r['_click'] = $time_now - $r['session_running_time'];
|
||||
|
||||
if ( ($r['_log_in'] / 60) < 1 )
|
||||
{
|
||||
$r['_log_in'] = sprintf("%0d", $r['_log_in']) . $this->lang->words['cp_secondsago'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$r['_log_in'] = sprintf("%0d", ($r['_log_in'] / 60) ) . $this->lang->words['cp_minutesago'];
|
||||
}
|
||||
|
||||
if ( ($r['_click'] / 60) < 1 )
|
||||
{
|
||||
$r['_click'] = sprintf("%0d", $r['_click']) . $this->lang->words['cp_secondsago'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$r['_click'] = sprintf("%0d", ($r['_click'] / 60) ) . $this->lang->words['cp_minutesago'];
|
||||
}
|
||||
|
||||
$r['session_location'] = $r['session_location'] ? "<a href='" . preg_replace( '/&app=([a-zA-Z0-9\-_]+)/', '', $this->settings['base_url'] ) . $r['session_url'] . "'>{$r['session_location']}</a>" : $this->lang->words['cp_index'];
|
||||
|
||||
$acponline .= $this->html->acp_onlineadmin_row( IPSMember::buildDisplayData( $r ) );
|
||||
}
|
||||
|
||||
$content['acp_online'] = $this->html->acp_onlineadmin_wrapper( $acponline );
|
||||
|
||||
//-----------------------------------------
|
||||
// Stats
|
||||
//-----------------------------------------
|
||||
|
||||
$reg = $this->DB->buildAndFetch( array(
|
||||
'select' => 'COUNT(*) as reg' ,
|
||||
'from' => array( 'validating' => 'v' ),
|
||||
'where' => 'v.lost_pass <> 1 AND m.member_group_id=' . $this->settings['auth_group'],
|
||||
'add_join' => array( array(
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=v.member_id',
|
||||
'type' => 'left'
|
||||
) ) ) );
|
||||
|
||||
if( $this->settings['ipb_bruteforce_attempts'] )
|
||||
{
|
||||
$lock = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as mems' , 'from' => 'members', 'where' => 'failed_login_count >= ' . $this->settings['ipb_bruteforce_attempts'] ) );
|
||||
}
|
||||
|
||||
$coppa = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as coppa', 'from' => 'validating', 'where' => 'coppa_user=1' ) );
|
||||
|
||||
$my_timestamp = time() - $this->settings['au_cutoff'] * 60;
|
||||
|
||||
$online = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as sessions', 'from' => 'sessions', 'where' => 'running_time>' . $my_timestamp ) );
|
||||
|
||||
$pending = $this->DB->buildAndFetch( array( 'select' => 'SUM(queued_topics) as topics, SUM(queued_posts) as posts', 'from' => 'forums' ) );
|
||||
|
||||
$spammers = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count, MAX(joined) as joined',
|
||||
'from' => 'members',
|
||||
//'where' => IPSBWOptions::sql( 'bw_is_spammer', 'members_bitoptions', 'members', 'global', 'has' ) ) );
|
||||
'where' => "members_bitoptions = '1'" ) );
|
||||
|
||||
$content['stats'] = $this->html->acp_stats_wrapper( array( 'topics' => intval($this->caches['stats']['total_topics']),
|
||||
'replies' => intval($this->caches['stats']['total_replies']),
|
||||
'topics_mod' => intval($pending['topics']),
|
||||
'posts_mod' => intval($pending['posts']),
|
||||
'members' => intval($this->caches['stats']['mem_count']),
|
||||
'validate' => intval( $reg['reg'] ),
|
||||
'spammer' => array( intval( $spammers['count'] ), intval( $spammers['joined'] ) ),
|
||||
'locked' => intval( $lock['mems'] ),
|
||||
'coppa' => intval( $coppa['coppa'] ),
|
||||
'sql_driver' => strtoupper(SQL_DRIVER),
|
||||
'sql_version' => $this->DB->true_version,
|
||||
'php_version' => phpversion(),
|
||||
'sessions' => intval($online['sessions']),
|
||||
'php_sapi' => @php_sapi_name(),
|
||||
'ipb_version' => ipsRegistry::$version,
|
||||
'ipb_id' => ipsRegistry::$vn_full ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Members awaiting admin validation?
|
||||
//-----------------------------------------
|
||||
|
||||
if( $this->settings['reg_auth_type'] == 'admin_user' OR $this->settings['reg_auth_type'] == 'admin' )
|
||||
{
|
||||
$where_extra = $this->settings['reg_auth_type'] == 'admin_user' ? ' AND user_verified=1' : '';
|
||||
|
||||
$admin_reg = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as reg' , 'from' => 'validating', 'where' => 'new_reg=1' . $where_extra ) );
|
||||
|
||||
if( $admin_reg['reg'] > 0 )
|
||||
{
|
||||
// We have some member's awaiting admin validation
|
||||
$data = null;
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'v.*',
|
||||
'from' => array( 'validating' => 'v' ),
|
||||
'where' => 'new_reg=1' . $where_extra,
|
||||
'limit' => array( 3 ),
|
||||
'add_join' => array(
|
||||
array(
|
||||
'type' => 'left',
|
||||
'select' => 'm.members_display_name, m.email, m.ip_address',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=v.member_id'
|
||||
)
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
if ($r['coppa_user'] == 1)
|
||||
{
|
||||
$r['_coppa'] = ' ( COPPA )';
|
||||
}
|
||||
else
|
||||
{
|
||||
$r['_coppa'] = "";
|
||||
}
|
||||
|
||||
$r['_entry'] = $this->registry->getClass( 'class_localization')->getDate( $r['entry_date'], 'TINY' );
|
||||
|
||||
$data .= $this->html->acp_validating_block( $r );
|
||||
|
||||
|
||||
}
|
||||
|
||||
$content['validating'] = $this->html->acp_validating_wrapper( $data );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Forum and group dropdowns
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/forums/class_forums.php' );
|
||||
$this->registry->setClass( 'class_forums', new class_forums($this->registry) );
|
||||
$this->registry->getClass('class_forums')->forumsInit();
|
||||
|
||||
$forums = $this->registry->getClass('class_forums')->forumsForumJump( 1 );
|
||||
|
||||
$groups = array();
|
||||
$groups_html = '';
|
||||
|
||||
foreach( $this->cache->getCache('group_cache') as $k => $v )
|
||||
{
|
||||
$groups[ $v['g_title'] ] = "<option value='{$k}'>{$v['g_title']}</option>";
|
||||
}
|
||||
|
||||
ksort( $groups );
|
||||
|
||||
$groups_html = implode( "\n", $groups );
|
||||
|
||||
//-----------------------------------------
|
||||
// Piece it together
|
||||
//-----------------------------------------
|
||||
|
||||
$urls['version_check'] = IPS_VERSION_CHECK_URL . '?' . base64_encode( ipsRegistry::$vn_full.'|^|'.$this->settings['board_url'] );
|
||||
$this->registry->output->html .= $this->html->mainTemplate( $content, $forums, $groups_html, $urls );
|
||||
|
||||
//-----------------------------------------
|
||||
// FURL cache OOD?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( file_exists( IPS_CACHE_PATH . 'cache/furlCache.php' ) )
|
||||
{
|
||||
$mtime = intval( @filemtime( IPS_CACHE_PATH . 'cache/furlCache.php' ) );
|
||||
|
||||
/* Check mtimes on extensions.. */
|
||||
foreach( ipsRegistry::$applications as $app_dir => $application )
|
||||
{
|
||||
if ( file_exists( IPSLib::getAppDir( $app_dir ) . '/extensions/furlTemplates.php' ) )
|
||||
{
|
||||
$_mtime = intval( @filemtime( IPSLib::getAppDir( $app_dir ) . '/extensions/furlTemplates.php' ) );
|
||||
|
||||
if ( $_mtime > $mtime )
|
||||
{
|
||||
$_html = $this->html->warning_box( $this->lang->words['furlcache_outofdate'], "<a href='" . $this->settings['base_url'] . "app=core&module=applications&section=applications&do=seoRebuild'>{$this->lang->words['rebuild_furl_cache']}</a>" ) . "<br />";
|
||||
$this->registry->output->html = str_replace( '<!--in_dev_check-->', $_html . '<!--in_dev_check-->', $this->registry->output->html );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Minify on but /cache/tmp not writeable?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( isset( $this->settings['_use_minify'] ) AND $this->settings['_use_minify'] )
|
||||
{
|
||||
$_html = $this->html->warning_box( $this->lang->words['minifywrite_head'], $this->lang->words['minifynot_writeable'] ) . "<br />";
|
||||
$this->registry->output->html = str_replace( '<!--in_dev_check-->', $_html . '<!--in_dev_check-->', $this->registry->output->html );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Left log all on?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( IPS_LOG_ALL === TRUE )
|
||||
{
|
||||
$_html = $this->html->warning_box( $this->lang->words['ds_log_all_title'], $this->lang->words['ds_log_all_desc'] ) . "<br />";
|
||||
$this->registry->output->html = str_replace( '<!--in_dev_check-->', $_html . '<!--in_dev_check-->', $this->registry->output->html );
|
||||
}
|
||||
|
||||
if ( count( $tasksContent ) )
|
||||
{
|
||||
$_html .= $this->html->warning_box( $this->lang->words['cp_taskssneedup'], implode( $tasksContent, "<br />" ) . "<br /><a href='" . $this->settings['base_url'] . "app=core&module=system&section=taskmanager&do=tasksImportAllApps'>{$this->lang->words['cp_clickhere']}</a> {$this->lang->words['cp_clickhere_info']}.");
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// IN DEV stuff...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( IN_DEV )
|
||||
{
|
||||
$lastUpdate = $this->caches['indev'];
|
||||
$lastUpdate = ( is_array( $lastUpdate ) ) ? $lastUpdate : array( 'import' => array( 'settings' => array() ) );
|
||||
$lastModUpdate = ( is_array( $lastUpdate ) ) ? $lastUpdate : array( 'import' => array( 'modules' => array() ) );
|
||||
$lastTaskUpdate = ( is_array( $lastUpdate ) ) ? $lastUpdate : array( 'import' => array( 'tasks' => array() ) );
|
||||
$lastHelpUpdate = ( is_array( $lastUpdate ) ) ? $lastUpdate : array( 'import' => array( 'help' => array() ) );
|
||||
$lastbbUpdate = ( is_array( $lastUpdate ) ) ? $lastUpdate : array( 'import' => array( 'bbcode' => array() ) );
|
||||
$content = array();
|
||||
$modContent = array();
|
||||
$tasksContent = array();
|
||||
$helpContent = array();
|
||||
$bbContent = array();
|
||||
$_html = '';
|
||||
|
||||
foreach( ipsRegistry::$applications as $app_dir => $data )
|
||||
{
|
||||
/* Settings */
|
||||
$lastMtime = intval( @filemtime( IPSLib::getAppDir( $app_dir ) . '/xml/' . $app_dir . '_settings.xml' ) );
|
||||
$lastDBtime = intval( $lastUpdate['import']['settings'][ $app_dir ] );
|
||||
|
||||
if ( $lastMtime > $lastDBtime )
|
||||
{
|
||||
$_mtime = $this->registry->getClass( 'class_localization')->getDate( $lastMtime , 'JOINED' );
|
||||
$_dbtime = $this->registry->getClass( 'class_localization')->getDate( $lastDBtime, 'JOINED' );
|
||||
|
||||
$content[] = "<strong>" . $app['app_title'] . " {$this->lang->words['cp_settingsupdated']}.</strong><br />-- {$this->lang->words['cp_lastimportrun']}: {$_dbtime}<br />-- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
|
||||
}
|
||||
|
||||
/* Modules */
|
||||
$lastMtime = intval( @filemtime( IPSLib::getAppDir( $app_dir ) . '/xml/' . $app_dir . '_modules.xml' ) );
|
||||
$lastDBtime = intval( $lastUpdate['import']['modules'][ $app_dir ] );
|
||||
|
||||
if ( $lastMtime > $lastDBtime )
|
||||
{
|
||||
$_mtime = $this->registry->getClass( 'class_localization')->getDate( $lastMtime , 'JOINED' );
|
||||
$_dbtime = $this->registry->getClass( 'class_localization')->getDate( $lastDBtime, 'JOINED' );
|
||||
|
||||
$modContent[] = "<strong>" . $app['app_title'] . " {$this->lang->words['cp_modulessneedup']}.</strong><br />-- {$this->lang->words['cp_lastimportrun']}: {$_dbtime}<br />-- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
|
||||
}
|
||||
|
||||
/* Tasks */
|
||||
$lastMtime = intval( @filemtime( IPSLib::getAppDir( $app_dir ) . '/xml/' . $app_dir . '_tasks.xml' ) );
|
||||
$lastDBtime = intval( $lastUpdate['import']['tasks'][ $app_dir ] );
|
||||
|
||||
if ( $lastMtime > $lastDBtime )
|
||||
{
|
||||
$_mtime = $this->registry->getClass( 'class_localization')->getDate( $lastMtime , 'JOINED' );
|
||||
$_dbtime = $this->registry->getClass( 'class_localization')->getDate( $lastDBtime, 'JOINED' );
|
||||
|
||||
$tasksContent[] = "<strong>" . $app['app_title'] . " {$this->lang->words['cp_taskssneedup']}.</strong><br />-- {$this->lang->words['cp_lastimportrun']}: {$_dbtime}<br />-- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
|
||||
}
|
||||
|
||||
/* Help Files */
|
||||
$lastMtime = intval( @filemtime( IPSLib::getAppDir( $app_dir ) . '/xml/' . $app_dir . '_help.xml' ) );
|
||||
$lastDBtime = intval( $lastUpdate['import']['help'][ $app_dir ] );
|
||||
|
||||
if ( $lastMtime > $lastDBtime )
|
||||
{
|
||||
$_mtime = $this->registry->getClass( 'class_localization')->getDate( $lastMtime , 'JOINED' );
|
||||
$_dbtime = $this->registry->getClass( 'class_localization')->getDate( $lastDBtime, 'JOINED' );
|
||||
|
||||
$helpContent[] = "<strong>" . $app['app_title'] . " {$this->lang->words['cp_helpneedup']}.</strong><br />-- {$this->lang->words['cp_lastimportrun']}: {$_dbtime}<br />-- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
|
||||
}
|
||||
|
||||
/* BBCode Files */
|
||||
$lastMtime = intval( @filemtime( IPSLib::getAppDir( $app_dir ) . '/xml/' . $app_dir . '_bbcode.xml' ) );
|
||||
$lastDBtime = intval( $lastUpdate['import']['bbcode'][ $app_dir ] );
|
||||
|
||||
if ( $lastMtime > $lastDBtime )
|
||||
{
|
||||
$_mtime = $this->registry->getClass( 'class_localization')->getDate( $lastMtime , 'JOINED' );
|
||||
$_dbtime = $this->registry->getClass( 'class_localization')->getDate( $lastDBtime, 'JOINED' );
|
||||
|
||||
$bbContent[] = "<strong>" . $app['app_title'] . " {$this->lang->words['cp_bbcodeneedup']}.</strong><br />-- {$this->lang->words['cp_lastimportrun']}: {$_dbtime}<br />-- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $content ) )
|
||||
{
|
||||
$_html = $this->html->warning_box( $this->lang->words['cp_settingsneedup'], implode( $content, "<br />" ) . "<br /><a href='" . $this->settings['base_url'] . "app=core&module=tools&section=settings&do=settingsImportApps'>{$this->lang->words['cp_clickhere']}</a> {$this->lang->words['cp_clickhere_info']}.");
|
||||
}
|
||||
|
||||
if ( count( $modContent ) )
|
||||
{
|
||||
$_html .= $this->html->warning_box( $this->lang->words['cp_modulessneedup'], implode( $modContent, "<br />" ) . "<br /><a href='" . $this->settings['base_url'] . "app=core&module=applications&section=applications&do=inDevRebuildAll'>{$this->lang->words['cp_clickhere']}</a> {$this->lang->words['cp_clickhere_info']}.");
|
||||
}
|
||||
|
||||
if ( count( $tasksContent ) )
|
||||
{
|
||||
$_html .= $this->html->warning_box( $this->lang->words['cp_taskssneedup'], implode( $tasksContent, "<br />" ) . "<br /><a href='" . $this->settings['base_url'] . "app=core&module=system&section=taskmanager&do=tasksImportAllApps'>{$this->lang->words['cp_clickhere']}</a> {$this->lang->words['cp_clickhere_info']}.");
|
||||
}
|
||||
|
||||
if ( count( $helpContent ) )
|
||||
{
|
||||
$_html .= $this->html->warning_box( $this->lang->words['cp_helpneedup'], implode( $helpContent, "<br />" ) . "<br /><a href='" . $this->settings['base_url'] . "app=core&module=tools&section=help&do=importXml'>{$this->lang->words['cp_clickhere']}</a> {$this->lang->words['cp_clickhere_info']}.");
|
||||
}
|
||||
|
||||
if ( count( $bbContent ) )
|
||||
{
|
||||
$_html .= $this->html->warning_box( $this->lang->words['cp_bbcodeneedup'], implode( $bbContent, "<br />" ) . "<br /><a href='" . $this->settings['base_url'] . "app=core&module=posts&section=bbcode&do=bbcode_import_all'>{$this->lang->words['cp_clickhere']}</a> {$this->lang->words['cp_clickhere_info']}.");
|
||||
}
|
||||
|
||||
$this->registry->output->html = str_replace( '<!--in_dev_check-->', $_html, $this->registry->output->html );
|
||||
|
||||
if ( @file_exists( DOC_IPS_ROOT_PATH . '_dev_notes.txt' ) )
|
||||
{
|
||||
$_notes = @file_get_contents( DOC_IPS_ROOT_PATH . '_dev_notes.txt' );
|
||||
|
||||
if ( $_notes )
|
||||
{
|
||||
$_html = $this->registry->output->global_template->information_box( $this->lang->words['cp_devnotes'], nl2br($_notes) ) . "<br />";
|
||||
$this->registry->output->html = str_replace( '<!--in_dev_notes-->', $_html, $this->registry->output->html );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// INSTALLER PRESENT?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $sm_install == 1 )
|
||||
{
|
||||
if ( $lock_file != 1 )
|
||||
{
|
||||
$this->lang->words['cp_unlocked_warning'] = sprintf( $this->lang->words['cp_unlocked_warning'], CP_DIRECTORY );
|
||||
$installer = $this->html->warning_box( $this->lang->words['cp_unlockedinstaller'], $this->html->warning_unlocked_installer() ) . "<br />";
|
||||
|
||||
$this->registry->output->html = str_replace( '<!--warninginstaller-->', $installer, $this->registry->output->html );
|
||||
}
|
||||
else
|
||||
{
|
||||
$installer = $this->html->warning_box( $this->lang->words['cp_installerpresent'], $this->html->warning_installer() ) . "<br />";
|
||||
|
||||
$this->registry->output->html = str_replace( '<!--warninginstaller-->', $installer, $this->registry->output->html );
|
||||
}
|
||||
}
|
||||
else if( $converter )
|
||||
{
|
||||
$text = $this->lang->words['cp_unlocked_converter'];
|
||||
$installer = $this->html->warning_box( $text, $this->html->warning_converter($converter) ) . "<br />";
|
||||
|
||||
$this->registry->output->html = str_replace( '<!--warningconverter-->', $installer, $this->registry->output->html );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// UNFINISHED UPGRADE?
|
||||
//-----------------------------------------
|
||||
|
||||
if( $unfinished_upgrade == 1 )
|
||||
{
|
||||
$this->lang->words['cp_upgrade_warning'] = sprintf( $this->lang->words['cp_upgrade_warning'], $versions['current'][1], $versions['latest'][1], $this->settings['base_acp_url'] );
|
||||
|
||||
$upgrade = $this->html->warning_box( $this->lang->words['cp_unfinishedupgrade'], $this->html->warning_upgrade() ) . "<br />";
|
||||
|
||||
$this->registry->output->html = str_replace( '<!--warningupgrade-->', $upgrade, $this->registry->output->html );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// INSUFFICIENT PHP VERSION?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( PHP_VERSION < '5.1.0' )
|
||||
{
|
||||
$version = $this->html->warning_box( sprintf( $this->lang->words['cp_yourphpversion'], PHP_VERSION ),
|
||||
$this->html->acp_php_version_warning() ) . "<br />";
|
||||
|
||||
$this->registry->output->html = str_replace( '<!--phpversioncheck-->', $version, $this->registry->output->html );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// BOARD OFFLINE?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->settings['board_offline'] )
|
||||
{
|
||||
$offline = $this->html->warning_box( $this->lang->words['cp_boardoffline'], "{$this->lang->words['cp_boardoffline1']}<br /><br />» <a href='" . $this->settings['base_url'] . "&module=tools&section=settings&do=findsetting&key=boardoffline'>{$this->lang->words['cp_boardoffline2']}</a>" ) . "<br />";
|
||||
|
||||
$this->registry->output->html = str_replace( '<!--boardoffline-->', $offline, $this->registry->output->html );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// No fulltext
|
||||
//-----------------------------------------
|
||||
|
||||
if( $this->settings['search_method'] == 'traditional' AND !$this->settings['use_fulltext'] AND !$this->settings['hide_ftext_note'] )
|
||||
{
|
||||
$ftext = $this->html->warning_box( $this->lang->words['fulltext_off'], "{$this->lang->words['fulltext_turnon']}<br /><br />» <a href='" . $this->settings['base_url'] . "&module=tools&section=settings&do=findsetting&key=searchsetup'>{$this->lang->words['fulltext_find']}</a>" ) . "<br />";
|
||||
|
||||
$this->registry->output->html = str_replace( '<!--fulltext-->', $ftext, $this->registry->output->html );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Last 5 log in attempts
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('class_permissions')->return = true;
|
||||
|
||||
if( $this->registry->getClass('class_permissions')->checkPermission( 'acplogin_log' ) )
|
||||
{
|
||||
$this->DB->build( array(
|
||||
'select' => '*',
|
||||
'from' => 'admin_login_logs',
|
||||
'order' => 'admin_time DESC',
|
||||
'limit' => array( 0, 5 )
|
||||
) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $rowb = $this->DB->fetch() )
|
||||
{
|
||||
$rowb['_admin_time'] = $this->registry->class_localization->getDate( $rowb['admin_time'], 'long' );
|
||||
$rowb['_admin_img'] = $rowb['admin_success'] ? 'aff_tick.png' : 'aff_cross.png';
|
||||
|
||||
$logins .= $this->html->acp_last_logins_row( $rowb );
|
||||
}
|
||||
|
||||
$this->registry->output->html = str_replace( '<!--acplogins-->', $this->html->acp_last_logins_wrapper( $logins ), $this->registry->output->html );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Pass to CP output hander
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('output')->html_main .= $this->registry->getClass('output')->global_template->global_frame_wrapper();
|
||||
$this->registry->getClass('output')->sendOutput();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Define the default mycp section
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'dashboard';
|
||||
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Admin change email/password
|
||||
* Last Updated: $Date: 2009-05-20 09:25:28 -0400 (Wed, 20 May 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 5th January 2005
|
||||
* @version $Revision: 4674 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_mycp_details extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Skin object
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html = $this->registry->output->loadTemplate('cp_skin_mycp');
|
||||
|
||||
//-----------------------------------------
|
||||
// Load language
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_mycp' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$this->form_code = $this->html->form_code = 'module=mycp&section=dashboard';
|
||||
$this->form_code_js = $this->html->form_code_js = 'module=mycp§ion=dashboard';
|
||||
|
||||
///----------------------------------------
|
||||
// What to do...
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'form':
|
||||
default:
|
||||
$this->_showForm();
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
$this->_saveForm();
|
||||
break;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Pass to CP output hander
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('output')->html_main .= $this->registry->getClass('output')->global_template->global_frame_wrapper();
|
||||
$this->registry->getClass('output')->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form so admin can reset email/pass
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function _showForm()
|
||||
{
|
||||
$this->registry->output->html .= $this->html->showChangeForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save new email and/or pass
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function _saveForm()
|
||||
{
|
||||
if( !$this->request['email'] AND !$this->request['password'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['change_nothing_update'];
|
||||
$this->_showForm();
|
||||
return;
|
||||
}
|
||||
|
||||
if( $this->request['email'] )
|
||||
{
|
||||
if( !$this->request['email_confirm'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['change_both_fields'];
|
||||
$this->_showForm();
|
||||
return;
|
||||
}
|
||||
else if( $this->request['email'] != $this->request['email_confirm'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['change_not_match'];
|
||||
$this->_showForm();
|
||||
return;
|
||||
}
|
||||
|
||||
$email = trim($this->request['email']);
|
||||
$email_check = IPSMember::load( mb_strtolower($email) );
|
||||
|
||||
if ( $email_check['member_id'] AND $email_check['member_id'] != $member_id )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['change_email_already_used'];
|
||||
$this->_showForm();
|
||||
return;
|
||||
}
|
||||
else if( $email_check['member_id'] == $this->memberData['member_id'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['already_using_email'];
|
||||
$this->_showForm();
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Load handler...
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/handlers/han_login.php' );
|
||||
$han_login = new han_login( $this->registry );
|
||||
$han_login->init();
|
||||
$han_login->changeEmail( trim( mb_strtolower( $this->memberData['email'] ) ), trim( mb_strtolower( $email ) ) );
|
||||
|
||||
IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'email' => mb_strtolower( $email ) ) ) );
|
||||
|
||||
IPSLib::runMemberSync( 'onEmailChange', $this->memberData['member_id'], mb_strtolower( $email ) );
|
||||
|
||||
ipsRegistry::getClass('adminFunctions')->saveAdminLog( sprintf( $this->lang->words['changed_email'], $email ) );
|
||||
}
|
||||
|
||||
if( $this->request['password'] )
|
||||
{
|
||||
if( !$this->request['password_confirm'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['change_both_fields'];
|
||||
$this->_showForm();
|
||||
return;
|
||||
}
|
||||
else if( $this->request['password'] != $this->request['password_confirm'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['change_not_match_pw'];
|
||||
$this->_showForm();
|
||||
return;
|
||||
}
|
||||
|
||||
$password = $this->request['password'];
|
||||
$salt = str_replace( '\\', "\\\\", IPSMember::generatePasswordSalt(5) );
|
||||
$key = IPSMember::generateAutoLoginKey();
|
||||
$md5_once = md5( trim($password) );
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/handlers/han_login.php' );
|
||||
$han_login = new han_login( $this->registry );
|
||||
$han_login->init();
|
||||
$han_login->changePass( $this->memberData['email'], $md5_once );
|
||||
|
||||
IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'members_pass_salt' => $salt, 'member_login_key' => $key ) ) );
|
||||
IPSMember::updatePassword( $this->memberData['member_id'], $md5_once );
|
||||
IPSLib::runMemberSync( 'onPassChange', $this->memberData['member_id'], $password );
|
||||
|
||||
ipsRegistry::getClass('adminFunctions')->saveAdminLog( $this->lang->words['changed_password'] );
|
||||
}
|
||||
|
||||
$this->registry->output->global_message = $this->lang->words['details_updated'];
|
||||
$this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<menu>
|
||||
<tabitems>
|
||||
<item>
|
||||
<title>Панель управления</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Панель управления</subitemtitle>
|
||||
<subsection>dashboard</subsection>
|
||||
<subitemurl></subitemurl>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Изменить свои данные</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Изменение своих данных</subitemtitle>
|
||||
<subsection>details</subsection>
|
||||
<subitemurl></subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
</tabitems>
|
||||
</menu>
|
||||
@@ -0,0 +1,425 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Bad Word Filters
|
||||
* Last Updated: $LastChangedDate: 2009-10-01 10:02:08 -0400 (Thu, 01 Oct 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 27th January 2004
|
||||
* @version $Rev: 5190 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_posts_badwords extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* HTML skin object
|
||||
*
|
||||
* @access public
|
||||
* @var object
|
||||
*/
|
||||
public $html;
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* Load Skin and Lang */
|
||||
$this->html = $this->registry->output->loadTemplate( 'cp_skin_badwords' );
|
||||
$this->html->form_code = '&module=posts&section=badwords';
|
||||
$this->html->form_code_js = '&module=posts§ion=badwords';
|
||||
|
||||
$this->lang->loadLanguageFile( array( 'admin_posts' ) );
|
||||
|
||||
/* What to do */
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'badword_add':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'badword_manage' );
|
||||
$this->badwordAdd();
|
||||
break;
|
||||
|
||||
case 'badword_remove':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'badword_delete' );
|
||||
$this->badwordRemove();
|
||||
break;
|
||||
|
||||
case 'badword_edit':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'badword_manage' );
|
||||
$this->badwordEditForm();
|
||||
break;
|
||||
|
||||
case 'badword_doedit':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'badword_manage' );
|
||||
$this->handleBadwordEdit();
|
||||
break;
|
||||
|
||||
case 'badword_export':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'badword_manage' );
|
||||
$this->badwordsExport();
|
||||
break;
|
||||
|
||||
case 'badword_import':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'badword_manage' );
|
||||
$this->badwordsImport();
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'overview':
|
||||
case 'badword':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'badword_manage' );
|
||||
$this->badwordsOvervew();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a badword filter
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function badwordRemove()
|
||||
{
|
||||
/* Check ID */
|
||||
$id = intval( $this->request['id'] );
|
||||
|
||||
if( ! $id )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['bwl_nofiter'], 11138 );
|
||||
}
|
||||
|
||||
/* Delete */
|
||||
$this->DB->delete( 'badwords', "wid={$id}" );
|
||||
|
||||
/* Rebuild cache and bounce */
|
||||
$this->badwordsRebuildCache();
|
||||
$this->registry->output->global_message = $this->lang->words['bwl_filter_removed'];
|
||||
$this->badwordsOvervew();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the badword edit form
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function handleBadwordEdit()
|
||||
{
|
||||
/* Check for before */
|
||||
if( ! $this->request['before'] )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['bwl_noword'], 11139 );
|
||||
}
|
||||
|
||||
/* Check ID */
|
||||
$id = intval( $this->request['id'] );
|
||||
|
||||
if( ! $id )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['bwl_nofilter'], 11140 );
|
||||
}
|
||||
|
||||
/* Match */
|
||||
$this->request['match'] = $this->request['match'] ? 1 : 0;
|
||||
|
||||
/* Swap Text */
|
||||
$this->request['after'] = isset( $this->request['after'] ) && $this->request['after'] ? $this->request['after'] : "";
|
||||
|
||||
$this->DB->force_data_type['type'] = 'string';
|
||||
$this->DB->force_data_type['swop'] = 'string';
|
||||
|
||||
$this->DB->update( 'badwords', array(
|
||||
'type' => trim( $this->request['before'] ),
|
||||
'swop' => trim( $this->request['after'] ),
|
||||
'm_exact' => $this->request['match']
|
||||
), "wid={$id}" );
|
||||
|
||||
/* Recache and bounce */
|
||||
$this->badwordsRebuildCache();
|
||||
$this->registry->output->global_message = $this->lang->words['bwl_filter_edited'];
|
||||
$this->badwordsOvervew();
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit Badword Form
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @author Josh
|
||||
*/
|
||||
public function badwordEditForm()
|
||||
{
|
||||
/* Check ID */
|
||||
$id = intval( $this->request['id'] );
|
||||
if( ! $id )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['bwl_nofilter'], 11141 );
|
||||
}
|
||||
|
||||
/* Get the field */
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'badwords', 'where' => "wid='{$id}'" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
if ( ! $r = $this->DB->fetch() )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['bwl_filter_404'], 11142 );
|
||||
}
|
||||
|
||||
/* Form Fields */
|
||||
$form = array();
|
||||
$form['before'] = $this->registry->output->formInput('before', stripslashes( $r['type'] ) );
|
||||
$form['after'] = $this->registry->output->formInput('after' , stripslashes( $r['swop'] ) );
|
||||
$form['match'] = $this->registry->output->formDropdown( 'match', array( 0 => array( 1, $this->lang->words['bwl_exact'] ), 1 => array( 0, $this->lang->words['bwl_loose'] ) ), $r['m_exact'] );
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html .= $this->html->badwordEditForm( $id, $form );
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle add bad word request
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function badwordAdd()
|
||||
{
|
||||
/* Check for before text */
|
||||
if( ! $this->request['before'] )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['bwl_noword'], 11143 );
|
||||
}
|
||||
|
||||
/* Match */
|
||||
$this->request['match'] = $this->request['match'] ? 1 : 0;
|
||||
|
||||
/* Swap Text */
|
||||
$this->request['after'] = isset( $this->request['after'] ) && $this->request['after'] ? $this->request['after'] : "";
|
||||
|
||||
/* Insert filter */
|
||||
$this->DB->force_data_type['type'] = 'string';
|
||||
$this->DB->force_data_type['swop'] = 'string';
|
||||
|
||||
$this->DB->insert( 'badwords', array(
|
||||
'type' => trim( $this->request['before'] ),
|
||||
'swop' => trim( $this->request['after'] ),
|
||||
'm_exact' => $this->request['match']
|
||||
)
|
||||
);
|
||||
|
||||
/* Rebuild the cache */
|
||||
$this->badwordsRebuildCache();
|
||||
|
||||
/* Bounce */
|
||||
$this->registry->output->global_message = $this->lang->words['bwl_filter_new'];
|
||||
$this->badwordsOvervew();
|
||||
}
|
||||
|
||||
/**
|
||||
* Badword Overview Screen
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function badwordsOvervew()
|
||||
{
|
||||
/* Query the bad words */
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'badwords', 'order' => 'type' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
/* Loop through the results */
|
||||
$rows = array();
|
||||
|
||||
if ( $this->DB->getTotalRows() )
|
||||
{
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$words[] = $r;
|
||||
}
|
||||
|
||||
foreach( $words as $r )
|
||||
{
|
||||
$r['replace'] = $r['swop'] ? stripslashes( $r['swop'] ) : '######';
|
||||
$r['method'] = $r['m_exact'] ? $this->lang->words['bwl_exact'] : $this->lang->words['bwl_loose'];
|
||||
$r['type'] = stripslashes( $r['type'] );
|
||||
|
||||
$rows[] = $r;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html .= $this->html->badwordsWrapper( $rows );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Import badwords from an xml file
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function badwordsImport()
|
||||
{
|
||||
/* Get Badwords XML */
|
||||
$content = $this->registry->adminFunctions->importXml( 'ipb_badwords.xml' );
|
||||
|
||||
/* Check for content */
|
||||
if ( ! $content )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['bwl_upload_failed'];
|
||||
$this->badwordsOvervew();
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get xml class
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_KERNEL_PATH.'classXML.php' );
|
||||
|
||||
$xml = new classXML( IPS_DOC_CHAR_SET );
|
||||
$xml->loadXML( $content );
|
||||
|
||||
if( !count( $xml->fetchElements('badword') ) )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['bwl_upload_wrong'];
|
||||
$this->badwordsOvervew();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get a list of current badwords */
|
||||
$words = array();
|
||||
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'badwords', 'order' => 'type' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$words[ $r['type'] ] = 1;
|
||||
}
|
||||
|
||||
/* Loop through the xml document and insert new bad words */
|
||||
foreach( $xml->fetchElements('badword') as $badword )
|
||||
{
|
||||
$entry = $xml->fetchElementsFromRecord( $badword );
|
||||
|
||||
/* Get the filter settings */
|
||||
$type = $entry['type'];
|
||||
$swop = $entry['swop'];
|
||||
$m_exact = $entry['m_exact'];
|
||||
|
||||
/* Skip if it's already in the db */
|
||||
if ( $words[ $type ] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Add to the db */
|
||||
if ( $type )
|
||||
{
|
||||
$this->DB->insert( 'badwords', array( 'type' => $type, 'swop' => $swop, 'm_exact' => $m_exact ) );
|
||||
}
|
||||
}
|
||||
|
||||
/* Rebuild cache and bounce */
|
||||
$this->badwordsRebuildCache();
|
||||
$this->registry->output->global_message = $this->lang->words['bwl_upload_good'];
|
||||
$this->badwordsOvervew();
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports badwords to an xml file
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function badwordsExport()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get xml class
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_KERNEL_PATH.'classXML.php' );
|
||||
|
||||
$xml = new classXML( IPS_DOC_CHAR_SET );
|
||||
|
||||
$xml->newXMLDocument();
|
||||
$xml->addElement( 'badwordexport' );
|
||||
$xml->addElement( 'badwordgroup', 'badwordexport' );
|
||||
|
||||
/* Query the badwords */
|
||||
$this->DB->build( array( 'select' => 'type, swop, m_exact', 'from' => 'badwords', 'order' => 'type' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
/* Add the bad word entries to the xml file */
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$xml->addElementAsRecord( 'badwordgroup', 'badword', $r );
|
||||
}
|
||||
|
||||
/* Create the xml document and send to the browser */
|
||||
$xmlData = $xml->fetchDocument();
|
||||
$this->registry->output->showDownload( $xmlData, 'ipb_badwords.xml' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild badword cache
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function badwordsRebuildCache()
|
||||
{
|
||||
$cache = array();
|
||||
|
||||
$this->DB->build( array( 'select' => 'type,swop,m_exact', 'from' => 'badwords' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$cache[] = $r;
|
||||
}
|
||||
|
||||
usort( $cache, array( $this, '_thisUsort' ) );
|
||||
|
||||
$this->cache->setCache( 'badwords', $cache, array( 'array' => 1 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom sort operation
|
||||
*
|
||||
* @access private
|
||||
* @param string A
|
||||
* @param string B
|
||||
* @return integer
|
||||
*/
|
||||
private function _thisUsort($a, $b)
|
||||
{
|
||||
if ( IPSText::mbstrlen($a['type']) == IPSText::mbstrlen($b['type']) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ( IPSText::mbstrlen($a['type']) > IPSText::mbstrlen($b['type']) ) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,842 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* BBCode Management
|
||||
* Last Updated: $LastChangedDate: 2009-11-09 16:42:49 -0500 (Mon, 09 Nov 2009) $
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 27th January 2004
|
||||
* @version $Rev: 5341 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_posts_bbcode extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Skin object
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html = $this->registry->output->loadTemplate('cp_skin_bbcode');
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$this->form_code = $this->html->form_code = 'module=posts&section=bbcode';
|
||||
$this->form_code_js = $this->html->form_code_js = 'module=posts§ion=bbcode';
|
||||
|
||||
//-----------------------------------------
|
||||
// Load lang
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_posts' ) );
|
||||
|
||||
///----------------------------------------
|
||||
// What to do...
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'bbcode_add':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bbcode_manage' );
|
||||
$this->_bbcodeForm('add');
|
||||
break;
|
||||
|
||||
case 'bbcode_doadd':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bbcode_manage' );
|
||||
$this->_bbcodeSave('add');
|
||||
break;
|
||||
|
||||
case 'bbcode_edit':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bbcode_manage' );
|
||||
$this->_bbcodeForm('edit');
|
||||
break;
|
||||
|
||||
case 'bbcode_doedit':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bbcode_manage' );
|
||||
$this->_bbcodeSave('edit');
|
||||
break;
|
||||
|
||||
case 'bbcode_test':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bbcode_manage' );
|
||||
$this->_bbcodeTest();
|
||||
break;
|
||||
|
||||
case 'bbcode_delete':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bbcode_delete' );
|
||||
$this->_bbcodeDelete();
|
||||
break;
|
||||
|
||||
case 'bbcode_export':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bbcode_manage' );
|
||||
$this->_bbcodeExport();
|
||||
break;
|
||||
|
||||
case 'bbcode_import':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bbcode_manage' );
|
||||
$this->_bbcodeImport();
|
||||
break;
|
||||
|
||||
case 'bbcode_import_all':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bbcode_manage' );
|
||||
$this->_bbcodeImportAll();
|
||||
break;
|
||||
case 'bbcode_export_all':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bbcode_manage' );
|
||||
$this->_bbcodeExportAll();
|
||||
break;
|
||||
|
||||
case 'bbcode':
|
||||
case 'overview':
|
||||
default:
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bbcode_manage' );
|
||||
$this->_bbcodeStart();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Export all bbcode XML file
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _bbcodeExportAll()
|
||||
{
|
||||
/* Loop through apps */
|
||||
$msg = array();
|
||||
|
||||
require_once( IPS_KERNEL_PATH.'classXML.php' );
|
||||
|
||||
$xml = new classXML( IPS_DOC_CHAR_SET );
|
||||
|
||||
foreach( ipsRegistry::$applications as $appDir => $appData )
|
||||
{
|
||||
$_c = 0;
|
||||
|
||||
$xml->newXMLDocument();
|
||||
$xml->addElement( 'bbcodeexport' );
|
||||
$xml->addElement( 'bbcodegroup', 'bbcodeexport' );
|
||||
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'custom_bbcode', 'where' => 'bbcode_app=\'' . $appDir . "'" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$_c++;
|
||||
|
||||
$xml->addElementAsRecord( 'bbcodegroup', 'bbcode', $r );
|
||||
}
|
||||
|
||||
$xmlData = $xml->fetchDocument();
|
||||
|
||||
|
||||
$file = IPSLib::getAppDir( $appDir ) . '/xml/' . $appDir . '_bbcode.xml';
|
||||
|
||||
/* remove old file */
|
||||
@unlink( $file );
|
||||
|
||||
/* Write it.. */
|
||||
if ( $_c )
|
||||
{
|
||||
@file_put_contents( $file, $xmlData );
|
||||
}
|
||||
|
||||
/* In dev time stamp? */
|
||||
if ( IN_DEV )
|
||||
{
|
||||
$cache = $this->caches['indev'];
|
||||
$cache['import']['bbcode'][ $appDir ] = time();
|
||||
$this->cache->setCache( 'indev', $cache, array( 'donow' => 1, 'array' => 1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
$this->registry->output->global_message = "Completed" . implode( "<br />", $msg );
|
||||
|
||||
$this->_bbcodeStart();
|
||||
}
|
||||
|
||||
/**
|
||||
* Import a bbcode XML file
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _bbcodeImportAll()
|
||||
{
|
||||
/* Loop through apps */
|
||||
$msg = array();
|
||||
|
||||
foreach( ipsRegistry::$applications as $appDir => $appData )
|
||||
{
|
||||
$file = IPSLib::getAppDir( $appDir ) . '/xml/' . $appDir . '_bbcode.xml';
|
||||
|
||||
if ( file_exists( $file ) )
|
||||
{
|
||||
$content = @file_get_contents( $file );
|
||||
|
||||
if ( $content )
|
||||
{
|
||||
$result = $this->bbcodeImportDo( $content, $appDir );
|
||||
|
||||
$msg[] = sprintf( $this->lang->words['bbcode_import_app'], $appDir, $result['inserted'], $result['updated'] );
|
||||
}
|
||||
}
|
||||
|
||||
/* In dev time stamp? */
|
||||
if ( IN_DEV )
|
||||
{
|
||||
$cache = $this->caches['indev'];
|
||||
$cache['import']['bbcode'][ $appDir ] = time();
|
||||
$this->cache->setCache( 'indev', $cache, array( 'donow' => 1, 'array' => 1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
$this->registry->output->global_message = implode( "<br />", $msg );
|
||||
|
||||
$this->_bbcodeStart();
|
||||
}
|
||||
|
||||
/**
|
||||
* Import a bbcode XML file
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _bbcodeImport()
|
||||
{
|
||||
$content = $this->registry->getClass('adminFunctions')->importXml();
|
||||
|
||||
//-----------------------------------------
|
||||
// Got anything?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $content )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['upload_failed'];
|
||||
$this->_bbcodeStart();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Do it */
|
||||
$this->bbcodeImportDo( $content );
|
||||
|
||||
$this->registry->output->global_message = $this->lang->words['import_complete'];
|
||||
|
||||
$this->_bbcodeStart();
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the BBcode import
|
||||
* Abstracted here so the installer can use it (and potentially other apps)
|
||||
*
|
||||
* @access public
|
||||
* @param string Raw XML code
|
||||
* @return array [ 'inserted' => int, 'updated' => int ]
|
||||
*/
|
||||
public function bbcodeImportDo( $content, $app='core' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get xml class
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_KERNEL_PATH.'classXML.php' );
|
||||
|
||||
$xml = new classXML( IPS_DOC_CHAR_SET );
|
||||
$xml->loadXML( $content );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get current custom bbcodes
|
||||
//-----------------------------------------
|
||||
|
||||
$tags = array();
|
||||
$return = array( 'updated' => 0, 'inserted' => 0 );
|
||||
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'custom_bbcode' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$tags[ $r['bbcode_tag'] ] = 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// pArse
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $xml->fetchElements('bbcode') as $bbcode )
|
||||
{
|
||||
$entry = $xml->fetchElementsFromRecord( $bbcode );
|
||||
|
||||
$bbcode_title = $entry['bbcode_title'];
|
||||
$bbcode_desc = $entry['bbcode_desc'];
|
||||
$bbcode_tag = $entry['bbcode_tag'];
|
||||
$bbcode_replace = $entry['bbcode_replace'];
|
||||
$bbcode_useoption = $entry['bbcode_useoption'];
|
||||
$bbcode_example = $entry['bbcode_example'];
|
||||
$bbcode_switch_option = $entry['bbcode_switch_option'];
|
||||
$bbcode_menu_option_text = $entry['bbcode_menu_option_text'];
|
||||
$bbcode_menu_content_text = $entry['bbcode_menu_content_text'];
|
||||
$bbcode_single_tag = $entry['bbcode_single_tag'];
|
||||
$bbcode_php_plugin = $entry['bbcode_php_plugin'];
|
||||
$bbcode_parse = 2;
|
||||
$bbcode_no_parsing = $entry['bbcode_no_parsing'];
|
||||
$bbcode_optional_option = $entry['bbcode_optional_option'];
|
||||
$bbcode_aliases = $entry['bbcode_aliases'];
|
||||
$bbcode_image = $entry['bbcode_image'];
|
||||
$bbcode_app = ( $entry['bbcode_app'] ) ? $entry['bbcode_app'] : $app;
|
||||
$bbcode_protected = ( $entry['bbcode_protected'] ) ? $entry['bbcode_protected'] : 0;
|
||||
$bbcode_sections = ( $entry['bbcode_sections'] ) ? $entry['bbcode_sections'] : 'all';
|
||||
|
||||
if ( $tags[ $bbcode_tag ] )
|
||||
{
|
||||
$bbarray = array(
|
||||
'bbcode_title' => $bbcode_title,
|
||||
'bbcode_desc' => $bbcode_desc,
|
||||
'bbcode_tag' => $bbcode_tag,
|
||||
'bbcode_replace' => IPSText::safeslashes($bbcode_replace),
|
||||
'bbcode_useoption' => $bbcode_useoption,
|
||||
'bbcode_example' => $bbcode_example,
|
||||
'bbcode_switch_option' => $bbcode_switch_option,
|
||||
'bbcode_menu_option_text' => $bbcode_menu_option_text,
|
||||
'bbcode_menu_content_text' => $bbcode_menu_content_text,
|
||||
'bbcode_php_plugin' => $bbcode_php_plugin,
|
||||
'bbcode_parse' => $bbcode_parse,
|
||||
'bbcode_no_parsing' => $bbcode_no_parsing,
|
||||
'bbcode_optional_option' => $bbcode_optional_option,
|
||||
'bbcode_aliases' => $bbcode_aliases,
|
||||
'bbcode_image' => $bbcode_image,
|
||||
'bbcode_single_tag' => $bbcode_single_tag,
|
||||
'bbcode_app' => $bbcode_app,
|
||||
'bbcode_protected' => $bbcode_protected
|
||||
);
|
||||
|
||||
$this->DB->update( 'custom_bbcode', $bbarray, "bbcode_tag='" . $bbcode_tag . "'" );
|
||||
$return['updated']++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $bbcode_tag )
|
||||
{
|
||||
$bbarray = array(
|
||||
'bbcode_title' => $bbcode_title,
|
||||
'bbcode_desc' => $bbcode_desc,
|
||||
'bbcode_tag' => $bbcode_tag,
|
||||
'bbcode_replace' => IPSText::safeslashes($bbcode_replace),
|
||||
'bbcode_useoption' => $bbcode_useoption,
|
||||
'bbcode_example' => $bbcode_example,
|
||||
'bbcode_switch_option' => $bbcode_switch_option,
|
||||
'bbcode_menu_option_text' => $bbcode_menu_option_text,
|
||||
'bbcode_menu_content_text' => $bbcode_menu_content_text,
|
||||
'bbcode_groups' => 'all',
|
||||
'bbcode_sections' => $bbcode_sections,
|
||||
'bbcode_php_plugin' => $bbcode_php_plugin,
|
||||
'bbcode_parse' => $bbcode_parse,
|
||||
'bbcode_no_parsing' => $bbcode_no_parsing,
|
||||
'bbcode_optional_option' => $bbcode_optional_option,
|
||||
'bbcode_aliases' => $bbcode_aliases,
|
||||
'bbcode_image' => $bbcode_image,
|
||||
'bbcode_single_tag' => $bbcode_single_tag,
|
||||
'bbcode_app' => $bbcode_app,
|
||||
'bbcode_protected' => $bbcode_protected
|
||||
);
|
||||
|
||||
$this->DB->insert( 'custom_bbcode', $bbarray );
|
||||
$return['inserted']++;
|
||||
}
|
||||
}
|
||||
|
||||
$this->bbcodeRebuildCache();
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export a bbcode XML file
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _bbcodeExport()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get xml class
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_KERNEL_PATH.'classXML.php' );
|
||||
|
||||
$xml = new classXML( IPS_DOC_CHAR_SET );
|
||||
|
||||
$xml->newXMLDocument();
|
||||
$xml->addElement( 'bbcodeexport' );
|
||||
$xml->addElement( 'bbcodegroup', 'bbcodeexport' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get bbcodes
|
||||
//-----------------------------------------
|
||||
|
||||
$select = array( 'select' => '*', 'from' => 'custom_bbcode' );
|
||||
|
||||
if( $this->request['id'] )
|
||||
{
|
||||
$select['where'] = 'bbcode_id=' . intval($this->request['id']);
|
||||
}
|
||||
|
||||
$this->DB->build( $select );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$xml->addElementAsRecord( 'bbcodegroup', 'bbcode', $r );
|
||||
}
|
||||
|
||||
$xmlData = $xml->fetchDocument();
|
||||
|
||||
//-----------------------------------------
|
||||
// Send to browser.
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->showDownload( $xmlData, 'bbcode.xml', '', 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a bbcode
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _bbcodeDelete()
|
||||
{
|
||||
if ( ! $this->request['id'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['no_bbcode_found_delete'];
|
||||
$this->_bbcodeStart();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->DB->delete( 'custom_bbcode', 'bbcode_id=' . intval($this->request['id']) );
|
||||
|
||||
$this->bbcodeRebuildCache();
|
||||
|
||||
$this->_bbcodeStart();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a bbcode
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
* @todo [Future] Also show the resulting HTML alongside the formatted content
|
||||
*/
|
||||
private function _bbcodeTest()
|
||||
{
|
||||
$t = IPSText::stripslashes(htmlspecialchars($_POST['bbtest']));
|
||||
|
||||
//-----------------------------------------
|
||||
// Run through libraries
|
||||
//-----------------------------------------
|
||||
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_smilies = 0;
|
||||
IPSText::getTextClass('bbcode')->parse_wordwrap = 0;
|
||||
IPSText::getTextClass('bbcode')->parsing_section = 'global';
|
||||
|
||||
//-----------------------------------------
|
||||
// Store the url/fix base url
|
||||
//-----------------------------------------
|
||||
|
||||
$_current = $this->settings[ 'base_url' ];
|
||||
$this->settings['base_url'] = $this->settings['board_url'] . '/index.php?';
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse
|
||||
//-----------------------------------------
|
||||
|
||||
$t = IPSText::getTextClass('bbcode')->preDbParse( $t );
|
||||
$t = IPSText::getTextClass('bbcode')->preDisplayParse( $t );
|
||||
|
||||
//-----------------------------------------
|
||||
// Restore base url
|
||||
//-----------------------------------------
|
||||
|
||||
$this->settings['base_url'] = $_current;
|
||||
|
||||
$this->registry->output->global_message = $this->lang->words['bbcode_test'] . $t;
|
||||
|
||||
$this->_bbcodeStart();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a bbcode [add|edit]
|
||||
*
|
||||
* @access private
|
||||
* @param string [add|edit]
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _bbcodeSave($type='add')
|
||||
{
|
||||
if ( $type == 'edit' )
|
||||
{
|
||||
if ( ! $this->request['id'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['no_bbcode_found_edit'];
|
||||
$this->_bbcodeForm($type);
|
||||
return;
|
||||
}
|
||||
|
||||
$bbcode = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'custom_bbcode', 'where' => 'bbcode_id=' . intval($this->request['id']) ) );
|
||||
|
||||
if( !$bbcode['bbcode_id'] )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['no_bbcode_found_edit'], 111162 );
|
||||
}
|
||||
|
||||
if( $this->request['bbcode_tag'] )
|
||||
{
|
||||
$duplicate = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'custom_bbcode', 'where' => "bbcode_tag='{$this->request['bbcode_tag']}'" ) );
|
||||
|
||||
if( $duplicate['bbcode_id'] != $this->request['id'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['tag_already'];
|
||||
$this->_bbcodeForm($type);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check aliases */
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'custom_bbcode',
|
||||
'where' => 'bbcode_aliases LIKE \'%' . $this->DB->addSlashes( $this->request['bbcode_tag'] ) . '%\'' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
if( $row['bbcode_id'] == $this->request['id'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach( explode( ',', $row['bbcode_aliases'] ) as $alias )
|
||||
{
|
||||
if ( strtolower( $alias ) == strtolower( $this->request['bbcode_tag'] ) )
|
||||
{
|
||||
$this->registry->output->global_message = sprintf( $this->lang->words['tag_already_alias'], $this->request['bbcode_tag'], $row['bbcode_tag'] );
|
||||
$this->_bbcodeForm($type);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$bbcode = array();
|
||||
|
||||
if( $this->request['bbcode_tag'] )
|
||||
{
|
||||
$duplicate = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'custom_bbcode', 'where' => "bbcode_tag='{$this->request['bbcode_tag']}'" ) );
|
||||
|
||||
if( $duplicate['bbcode_id'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['tag_already'];
|
||||
$this->_bbcodeForm($type);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check aliases */
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'custom_bbcode',
|
||||
'where' => 'bbcode_aliases LIKE \'%' . $this->DB->addSlashes( $this->request['bbcode_tag'] ) . '%\'' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
foreach( explode( ',', $row['bbcode_aliases'] ) as $alias )
|
||||
{
|
||||
if ( strtolower( $alias ) == strtolower( $this->request['bbcode_tag'] ) )
|
||||
{
|
||||
$this->registry->output->global_message = sprintf( $this->lang->words['tag_already_alias'], $this->request['bbcode_tag'], $row['bbcode_tag'] );
|
||||
$this->_bbcodeForm($type);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix BR tags
|
||||
//-----------------------------------------
|
||||
|
||||
$this->request['bbcode_aliases'] = str_replace( array( ' ', "\n" ), '', IPSText::br2nl( $this->request['bbcode_aliases'] ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// check...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->request['bbcode_title'] or !$this->request['bbcode_tag'] or ( !$this->request['bbcode_replace'] AND !$this->request['bbcode_php_plugin'] ) )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['complete_form'];
|
||||
$this->_bbcodeForm($type);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !$this->request['bbcode_single_tag'] AND !strstr( $this->request['bbcode_replace'], '{content}' ) AND !$this->request['bbcode_php_plugin'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['must_use_content'];
|
||||
$this->_bbcodeForm($type);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !strstr( $this->request['bbcode_replace'], '{option}' ) AND $this->request['bbcode_useoption'] AND !$this->request['bbcode_php_plugin'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['must_use_option'];
|
||||
$this->_bbcodeForm($type);
|
||||
return;
|
||||
}
|
||||
|
||||
if( preg_match( "/[^a-zA-Z0-9_]/", $this->request['bbcode_tag'] ) )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['bbcode_alpha_num'];
|
||||
$this->_bbcodeForm($type);
|
||||
return;
|
||||
}
|
||||
|
||||
$_aliases = explode( ",", $this->request['bbcode_aliases'] );
|
||||
|
||||
foreach( $_aliases as $_alias )
|
||||
{
|
||||
if( preg_match( "/[^a-zA-Z0-9_]/", $_alias ) )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['bbcode_alpha_num'];
|
||||
$this->_bbcodeForm($type);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$array = array(
|
||||
'bbcode_title' => $this->request['bbcode_title'],
|
||||
'bbcode_desc' => IPSText::safeslashes( $_POST['bbcode_desc'] ),
|
||||
'bbcode_tag' => preg_replace( "/[^a-zA-Z0-9_]/", "", $this->request['bbcode_tag'] ),
|
||||
'bbcode_replace' => IPSText::safeslashes( $_POST['bbcode_replace'] ),
|
||||
'bbcode_example' => IPSText::safeslashes( $_POST['bbcode_example'] ),
|
||||
'bbcode_useoption' => $this->request['bbcode_useoption'],
|
||||
'bbcode_switch_option' => intval( $this->request['bbcode_switch_option'] ),
|
||||
'bbcode_menu_option_text' => trim( $this->request['bbcode_menu_option_text'] ),
|
||||
'bbcode_menu_content_text' => trim( $this->request['bbcode_menu_content_text'] ),
|
||||
'bbcode_single_tag' => intval( $this->request['bbcode_single_tag'] ),
|
||||
'bbcode_groups' => is_array( $this->request['bbcode_groups'] ) ? implode( ',', $this->request['bbcode_groups'] ) : '',
|
||||
'bbcode_sections' => is_array( $this->request['bbcode_sections'] ) ? implode( ',', $this->request['bbcode_sections'] ) : '',
|
||||
'bbcode_php_plugin' => trim( $this->request['bbcode_php_plugin'] ),
|
||||
'bbcode_parse' => 2,
|
||||
'bbcode_no_parsing' => intval( $this->request['bbcode_no_parsing'] ),
|
||||
'bbcode_optional_option' => intval( $this->request['bbcode_optional_option'] ),
|
||||
'bbcode_aliases' => $this->request['bbcode_aliases'],
|
||||
'bbcode_image' => $this->request['bbcode_image'],
|
||||
'bbcode_strip_search' => intval( $this->request['bbcode_strip_search'] ),
|
||||
'bbcode_app' => $this->request['bbcode_app'],
|
||||
);
|
||||
|
||||
if( IN_DEV )
|
||||
{
|
||||
$array['bbcode_protected'] = intval( $this->request['bbcode_protected'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$array['bbcode_protected'] = $bbcode['bbcode_protected'];
|
||||
}
|
||||
|
||||
if ( $type == 'add' )
|
||||
{
|
||||
$check = $this->DB->buildAndFetch( array( 'select' => 'bbcode_tag', 'from' => 'custom_bbcode', 'where' => "bbcode_tag='{$array['bbcode_tag']}'" ) );
|
||||
|
||||
if( $check['bbcode_tag'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['must_use_unique_btag'];
|
||||
$this->_bbcodeForm($type);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->DB->insert( 'custom_bbcode', $array );
|
||||
$this->registry->output->global_message = $this->lang->words['new_bbcode'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$check = $this->DB->buildAndFetch( array( 'select' => 'bbcode_tag', 'from' => 'custom_bbcode', 'where' => "bbcode_tag='{$array['bbcode_tag']}' AND bbcode_id<>" . intval($this->request['id']) ) );
|
||||
|
||||
if( $check['bbcode_tag'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['must_use_unique_btag'];
|
||||
$this->_bbcodeForm($type);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $this->request['drop_cache'] )
|
||||
{
|
||||
IPSContentCache::truncate();
|
||||
}
|
||||
|
||||
$this->DB->update( 'custom_bbcode', $array, 'bbcode_id=' . intval($this->request['id']) );
|
||||
$this->registry->output->global_message = $this->lang->words['edited_bbcode'];
|
||||
}
|
||||
|
||||
$this->bbcodeRebuildCache();
|
||||
|
||||
$this->_bbcodeStart();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add/Edit bbcode form
|
||||
*
|
||||
* @access private
|
||||
* @param string [add|edit]
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _bbcodeForm($type='add')
|
||||
{
|
||||
$this->registry->output->nav[] = array( '', $this->lang->words['add_edit'] );
|
||||
|
||||
if ( $type == 'edit' )
|
||||
{
|
||||
if ( ! $this->request['id'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['no_bbcode_found_edit'];
|
||||
$this->_bbcodeStart();
|
||||
return;
|
||||
}
|
||||
|
||||
$bbcode = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'custom_bbcode', 'where' => 'bbcode_id=' . intval($this->request['id']) ) );
|
||||
|
||||
if( !$bbcode['bbcode_id'] )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['no_bbcode_found_edit'], 111163 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$bbcode = array();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Grab the 'sections'
|
||||
//-----------------------------------------
|
||||
|
||||
$sections = array();
|
||||
|
||||
foreach( ipsRegistry::$applications as $_app_dir => $app_data )
|
||||
{
|
||||
$_file = IPSLib::getAppDir( $_app_dir ) . '/extensions/editorSections.php';
|
||||
|
||||
if( file_exists($_file) )
|
||||
{
|
||||
$BBCODE = array();
|
||||
|
||||
include( $_file );
|
||||
|
||||
if( is_array($BBCODE) AND count($BBCODE) )
|
||||
{
|
||||
$sections = array_merge( $sections, $BBCODE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->registry->output->html .= $this->html->bbcodeForm( $type, $bbcode, $sections );
|
||||
}
|
||||
|
||||
/**
|
||||
* Bbcode splash page
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _bbcodeStart()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Show the codes mahn!
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'custom_bbcode', 'order' => 'bbcode_title' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
$bbcode_rows = "";
|
||||
|
||||
while ( $row = $this->DB->fetch() )
|
||||
{
|
||||
if ( $row['bbcode_useoption'] )
|
||||
{
|
||||
$option = '={option}';
|
||||
}
|
||||
else
|
||||
{
|
||||
$option = '';
|
||||
}
|
||||
|
||||
if( $row['bbcode_single_tag'] )
|
||||
{
|
||||
$row['bbcode_fulltag'] = '['.$row['bbcode_tag'].$option.']';
|
||||
}
|
||||
else
|
||||
{
|
||||
$row['bbcode_fulltag'] = '['.$row['bbcode_tag'].$option.']{content}[/'.$row['bbcode_tag'].']';
|
||||
}
|
||||
|
||||
$bbcode_rows .= $this->html->bbcodeRow( $row );
|
||||
}
|
||||
|
||||
$this->registry->output->html .= $this->html->bbcodeWrapper( $bbcode_rows );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild bbcode cache
|
||||
*
|
||||
* @access public
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function bbcodeRebuildCache()
|
||||
{
|
||||
$cache = array();
|
||||
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'custom_bbcode' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch($bbcode) )
|
||||
{
|
||||
$cache[] = $r;
|
||||
}
|
||||
|
||||
$this->cache->setCache( 'bbcode', $cache, array( 'array' => 1 ) );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Define the default posts section
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'emoticons';
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,434 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* BBCode Media Tag Management
|
||||
* Last Updated: $LastChangedDate: 2009-10-01 10:02:08 -0400 (Thu, 01 Oct 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 27th January 2004
|
||||
* @version $Rev: 5190 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_core_posts_media extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Skin object
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html = $this->registry->output->loadTemplate('cp_skin_bbcode');
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$this->form_code = $this->html->form_code = 'module=posts&section=media';
|
||||
$this->form_code_js = $this->html->form_code_js = 'module=posts§ion=media';
|
||||
|
||||
//-----------------------------------------
|
||||
// Load lang
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_posts' ) );
|
||||
|
||||
///----------------------------------------
|
||||
// What to do...
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'do_del':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'media_delete' );
|
||||
$this->_mediaTagDelete();
|
||||
break;
|
||||
|
||||
case 'form_add':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'media_manage' );
|
||||
$this->_mediaTagForm( 'add' );
|
||||
break;
|
||||
|
||||
case 'form_edit':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'media_manage' );
|
||||
$this->_mediaTagForm( 'edit' );
|
||||
break;
|
||||
|
||||
case 'domediatagadd':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'media_manage' );
|
||||
$this->_mediaTagSave( 'add' );
|
||||
break;
|
||||
|
||||
case 'domediatagedit':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'media_manage' );
|
||||
$this->_mediaTagSave( 'edit' );
|
||||
break;
|
||||
|
||||
case 'mediatag_export':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'media_manage' );
|
||||
$this->_mediaTagExport();
|
||||
break;
|
||||
|
||||
case 'mediatag_import':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'media_manage' );
|
||||
$this->_mediaTagImport();
|
||||
break;
|
||||
|
||||
case 'index':
|
||||
case 'overview':
|
||||
default:
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'media_manage' );
|
||||
$this->_mediaTagIndex();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Import a mediaTag XML file
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _mediaTagImport()
|
||||
{
|
||||
$content = $this->registry->getClass('adminFunctions')->importXml( 'mediatag.xml' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Got anything?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $content )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['m_upload_failed'];
|
||||
$this->_mediaTagIndex();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->doMediaImport( $content );
|
||||
|
||||
$this->registry->output->global_message = $this->lang->words['m_upload_complete'];
|
||||
|
||||
$this->_mediaTagIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstracted import routine for installer
|
||||
*
|
||||
* @access public
|
||||
* @param string XML file content
|
||||
* @return void
|
||||
*/
|
||||
public function doMediaImport( $content )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get xml mah-do-dah
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_KERNEL_PATH.'classXML.php' );
|
||||
|
||||
$xml = new classXML( IPS_DOC_CHAR_SET );
|
||||
$xml->loadXML( $content );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get current custom bbcodes
|
||||
//-----------------------------------------
|
||||
|
||||
$tags = array();
|
||||
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'bbcode_mediatag' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$tags[ $r['mediatag_name'] ] = $r['mediatag_id'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// pArse
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $xml->fetchElements('mediatag') as $mediatag )
|
||||
{
|
||||
$entry = $xml->fetchElementsFromRecord( $mediatag );
|
||||
|
||||
$name = $entry['mediatag_name'];
|
||||
$match = $entry['mediatag_match'];
|
||||
$replace = $entry['mediatag_replace'];
|
||||
|
||||
$array = array(
|
||||
'mediatag_name' => $name,
|
||||
'mediatag_match' => $match,
|
||||
'mediatag_replace' => $replace
|
||||
);
|
||||
|
||||
if ( $tags[ $name ] )
|
||||
{
|
||||
$this->DB->update( 'bbcode_mediatag', $array, "mediatag_id=" . $tags[ $name ] );
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $name )
|
||||
{
|
||||
$this->DB->insert( 'bbcode_mediatag', $array );
|
||||
}
|
||||
}
|
||||
|
||||
$this->recacheMediaTag();
|
||||
}
|
||||
|
||||
/**
|
||||
* Export a mediaTag XML file
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _mediaTagExport()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get xml mah-do-dah
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_KERNEL_PATH.'classXML.php' );
|
||||
|
||||
$xml = new classXML( IPS_DOC_CHAR_SET );
|
||||
|
||||
$xml->newXMLDocument();
|
||||
$xml->addElement( 'mediatagexport' );
|
||||
$xml->addElement( 'mediataggroup', 'mediatagexport' );
|
||||
|
||||
$select = array( 'select' => '*', 'from' => 'bbcode_mediatag' );
|
||||
|
||||
if( $this->request['id'] )
|
||||
{
|
||||
$select['where'] = 'mediatag_id=' . intval($this->request['id']);
|
||||
}
|
||||
|
||||
$this->DB->build( $select );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$xml->addElementAsRecord( 'mediataggroup', 'mediatag', $r );
|
||||
}
|
||||
|
||||
$xmlData = $xml->fetchDocument();
|
||||
|
||||
//-----------------------------------------
|
||||
// Send to browser.
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->showDownload( $xmlData, 'mediatag.xml', '', 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a custom media tag
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
private function _mediaTagDelete()
|
||||
{
|
||||
/* ID */
|
||||
$id = intval( $this->request['id'] );
|
||||
|
||||
/* Remove */
|
||||
$this->DB->delete( 'bbcode_mediatag', "mediatag_id={$id}" );
|
||||
|
||||
$this->recacheMediaTag();
|
||||
|
||||
/* Redirect */
|
||||
$this->registry->output->global_message = $this->lang->words['m_replace_removed'];
|
||||
$this->_mediaTagIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save changes to a custom media tag
|
||||
*
|
||||
* @access private
|
||||
* @param string [$type='add']
|
||||
* @return void
|
||||
*/
|
||||
private function _mediaTagSave( $type='add' )
|
||||
{
|
||||
/* INI */
|
||||
$errors = array();
|
||||
|
||||
/* Check input */
|
||||
if( ! $this->request['mediatag_name'] )
|
||||
{
|
||||
$errors[] = $this->lang->words['m_error_name'];
|
||||
}
|
||||
|
||||
if( ! $this->request['mediatag_match'] )
|
||||
{
|
||||
$errors[] = $this->lang->words['m_error_match'];
|
||||
}
|
||||
|
||||
if( ! $this->request['mediatag_replace'] )
|
||||
{
|
||||
$errors[] = $this->lang->words['m_error_replace'];
|
||||
}
|
||||
|
||||
if( count( $errors ) )
|
||||
{
|
||||
$this->_mediaTagForm( $type, $errors );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Data */
|
||||
$data = array(
|
||||
'mediatag_name' => $this->request['mediatag_name'],
|
||||
'mediatag_match' => rtrim( str_replace( '\', '\\', str_replace( ''', "'", trim( IPSText::stripslashes( $_POST['mediatag_match'] ) ) ) ), ',' ),
|
||||
'mediatag_replace' => rtrim( str_replace( '\', '\\', str_replace( ''', "'", trim( IPSText::stripslashes( $_POST['mediatag_replace'] ) ) ) ), ',' ),
|
||||
);
|
||||
|
||||
/* Check the type */
|
||||
if( $type == 'add' )
|
||||
{
|
||||
/* Insert the record */
|
||||
$this->DB->insert( 'bbcode_mediatag', $data );
|
||||
|
||||
/* Update cache */
|
||||
$this->recacheMediaTag();
|
||||
|
||||
/* All done */
|
||||
$this->registry->output->doneScreen( sprintf( $this->lang->words['m_tag_added'], $data['mediatag_name']), $this->lang->words['m_manager'], "{$this->form_code}&do=overview", 'redirect' );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ID */
|
||||
$id = intval( $this->request['id'] );
|
||||
|
||||
/* Update */
|
||||
$this->DB->update( 'bbcode_mediatag', $data, "mediatag_id={$id}" );
|
||||
|
||||
/* Recache */
|
||||
$this->recacheMediaTag();
|
||||
|
||||
/* Done and done */
|
||||
$this->registry->output->doneScreen( sprintf( $this->lang->words['m_tag_updated'], $data['mediatag_name']), $this->lang->words['m_manager'], "{$this->form_code}&do=overview", 'redirect' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the mediatag add/edit form
|
||||
*
|
||||
* @access private
|
||||
* @param string [$type='add']
|
||||
* @param array [Optional] array of errors
|
||||
* @return void
|
||||
*/
|
||||
private function _mediaTagForm( $type='add', $errors=array() )
|
||||
{
|
||||
/* Check form type */
|
||||
if( $type == 'add' )
|
||||
{
|
||||
/* Data */
|
||||
$data = array(
|
||||
'mediatag_name' => $this->request['mediatag_name'],
|
||||
'mediatag_match' => rtrim( str_replace( '\', '\\', str_replace( ''', "'", trim( IPSText::stripslashes( $_POST['mediatag_match'] ) ) ) ), ',' ),
|
||||
'mediatag_replace' => rtrim( str_replace( '\', '\\', str_replace( ''', "'", trim( IPSText::stripslashes( $_POST['mediatag_replace'] ) ) ) ), ',' ),
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Data */
|
||||
$id = intval( $this->request['id'] );
|
||||
$data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'bbcode_mediatag', 'where' => "mediatag_id={$id}" ) );
|
||||
|
||||
/* Set Defaults */
|
||||
$data['mediatag_name'] = ( isset( $this->request['mediatag_name'] ) && $this->request['mediatag_name'] ) ? $this->request['mediatag_name'] : $data['mediatag_name'];
|
||||
$data['mediatag_match'] = ( isset( $this->request['mediatag_match'] ) && $this->request['mediatag_match'] ) ? $this->request['mediatag_match'] : $data['mediatag_match'];
|
||||
$data['mediatag_replace'] = ( isset( $this->request['mediatag_replace'] ) && $this->request['mediatag_replace'] ) ? $this->request['mediatag_replace'] : $data['mediatag_replace'];
|
||||
}
|
||||
|
||||
/* Setup Form */
|
||||
$this->registry->output->html .= $this->html->mediaTagForm( $type, $data, $errors );
|
||||
}
|
||||
|
||||
/**
|
||||
* List all the the current media tag types
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
private function _mediaTagIndex()
|
||||
{
|
||||
/* Query Bookmarks */
|
||||
$this->DB->build( array(
|
||||
'select' => '*',
|
||||
'from' => 'bbcode_mediatag',
|
||||
'order' => 'mediatag_name ASC',
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
$bbcode_rows = "";
|
||||
|
||||
/* List the bookmarks */
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$bbcode_rows .= $this->html->mediaTagRow( $r );
|
||||
}
|
||||
|
||||
/* End table and output */
|
||||
$this->registry->output->html .= $this->html->mediaTagWrapper( $bbcode_rows );
|
||||
}
|
||||
|
||||
/**
|
||||
* Recache the mediatag config
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function recacheMediaTag()
|
||||
{
|
||||
/* Query the tags */
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'bbcode_mediatag' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
$media_config = array();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$media_config[$r['mediatag_name']] = array(
|
||||
'match' => preg_replace( "#{[0-9]}#", "(.*?)", str_replace( '.', '\.', str_replace( '?', '\?', $r['mediatag_match'] ) ) ),
|
||||
'replace' => $r['mediatag_replace'],
|
||||
);
|
||||
}
|
||||
|
||||
/* Save to cache */
|
||||
$this->cache->setCache( 'mediatag', $media_config, array( 'array' => 1 ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<menu>
|
||||
<tabitems>
|
||||
<item>
|
||||
<title>Смайлики</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Управление смайликами</subitemtitle>
|
||||
<subsection>emoticons</subsection>
|
||||
<subitemurl>do=overview</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
<subitem>
|
||||
<subitemtitle>Импорт / Экспорт</subitemtitle>
|
||||
<subsection>emoticons</subsection>
|
||||
<subitemurl>do=emo_packsplash</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>BB-коды</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Управление BB-кодами</subitemtitle>
|
||||
<subsection>bbcode</subsection>
|
||||
<subitemurl>do=overview</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
<subitem>
|
||||
<subitemtitle>Медиа BB-коды</subitemtitle>
|
||||
<subsection>media</subsection>
|
||||
<subitemurl>do=overview</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Нецензурные слова</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Управление нецензурными словами</subitemtitle>
|
||||
<subsection>badwords</subsection>
|
||||
<subitemurl>do=overview</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
</tabitems>
|
||||
</menu>
|
||||
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<permissions>
|
||||
<group>
|
||||
<grouptitle>Управление нецензурными словами</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>badword_manage</key>
|
||||
<string>Может добавлять/изменять?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>badword_delete</key>
|
||||
<string>Может удалять?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
<group>
|
||||
<grouptitle>Смайлики</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>emoticons_manage</key>
|
||||
<string>Имеет доступ к менеджеру смайликов?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>emoticons_edit</key>
|
||||
<string>Может изменять смайлики?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>emoticons_add</key>
|
||||
<string>Может добавлять смайлики?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>emoticons_delete</key>
|
||||
<string>Может удалять смайлики?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
<group>
|
||||
<grouptitle>BB-коды</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>bbcode_manage</key>
|
||||
<string>Может добавлять/изменять?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>bbcode_delete</key>
|
||||
<string>Может удалять?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
<group>
|
||||
<grouptitle>Управление Media тегами</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>media_manage</key>
|
||||
<string>Может добавлять/изменять?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>media_delete</key>
|
||||
<string>Может удалять?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
</permissions>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Define the default reports section
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'reports';
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<menu>
|
||||
<tabitems>
|
||||
<item>
|
||||
<title>Обзор системы</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Обзор</subitemtitle>
|
||||
<subsection>reports</subsection>
|
||||
<subitemurl>do=show_main</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Плагины системы</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Плагины системы жалоб</subitemtitle>
|
||||
<subsection>reports</subsection>
|
||||
<subitemurl>do=plugin</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Статусы жалоб</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Статусы жалоб</subitemtitle>
|
||||
<subsection>reports</subsection>
|
||||
<subitemurl>do=status</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
</tabitems>
|
||||
</menu>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<permissions>
|
||||
<group>
|
||||
<grouptitle>Плагины системы жалоб</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>plugins_manage</key>
|
||||
<string>Может добавлять/изменять плагины?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>plugins_remove</key>
|
||||
<string>Может удалять плагины?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
<group>
|
||||
<grouptitle>Управление статусами жалоб</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>sands_manage</key>
|
||||
<string>Может добавлять/изменять статусы жалоб?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>sands_remove</key>
|
||||
<string>Может удалять статусы?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
<group>
|
||||
<grouptitle>Статистика системы жалоб</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>stats_access</key>
|
||||
<string>Может просматривать статистику?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
</permissions>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Define the default sql section
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'toolbox';
|
||||
Loaded 100 of 3755 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user