diff --git a/upload/admin/api/api_core.php b/upload/admin/api/api_core.php
index 54739873..6857d239 100644
--- a/upload/admin/api/api_core.php
+++ b/upload/admin/api/api_core.php
@@ -1,17 +1,19 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* API: Core
- * Last Updated: $Date: 2009-05-11 17:39:45 -0400 (Mon, 11 May 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
- * @author $Author: josh $
+ * @author $Author: bfarber $
* @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 $
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @link http://www.invisionpower.com
+ * @version $Rev: 5713 $
*/
class apiCore
diff --git a/upload/admin/api/blog/api_blog.php b/upload/admin/api/blog/api_blog.php
index bbbd804d..92f6d7e0 100644
--- a/upload/admin/api/blog/api_blog.php
+++ b/upload/admin/api/blog/api_blog.php
@@ -1,194 +1,212 @@
-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();
- }
- }
-
-}
-
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Blog API file
+ * Last Updated: $Date: 2010-10-22 14:06:33 -0400 (Fri, 22 Oct 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Blog
+ * @link http://www.invisionpower.com
+ * @version $Rev: 7018 $
+ * @since 2.2.0
+ *
+ */
+
+if ( ! class_exists( 'apiCore' ) )
+{
+ require_once( IPS_ROOT_PATH . 'api/api_core.php' );
+}
+
+/**
+ * apiBlog class
+ * @package IP.Blog
+ */
+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 */
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'blog' ) . '/sources/classes/blogFunctions.php', 'blogFunctions', 'blog' );
+ $this->registry->setClass( 'blogFunctions', new $classToLoad( $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();
+ $where = array();
+
+ /* Build permissions */
+ $modData = $this->registry->blogFunctions->buildPerms();
+
+ /* Got permission to view blog entries? */
+ if ( $this->memberData['g_blog_settings']['g_blog_allowview'] )
+ {
+ $this->DB->build( array( 'select' => "e.*, b.*",
+ 'from' => array('blog_entries' => 'e'),
+ 'where' => ( $type == 'member' ? "b.member_id={$id}" : "b.blog_id={$id}" ) . " AND b.blog_type='local' AND e.entry_status='published'",
+ '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) )
+ {
+ if ( !$this->memberData['member_id'] or !$modData['_blogmod']['moderate_can_view_private'] )
+ {
+ switch ( $entry['blog_view_level'] )
+ {
+ case 'public':
+ if ( !$this->memberData['member_id'] and !$entry['blog_allowguests'] )
+ {
+ continue 2;
+ }
+ break;
+
+ case 'private':
+ if ( !$this->memberData['member_id'] or $this->memberData['member_id'] != $entry['member_id'] )
+ {
+ continue 2;
+ }
+ break;
+
+ case 'privateclub':
+ if ( !$this->memberData['member_id'] or !in_array( $this->memberData['member_id'], explode( ',', $entry['blog_authorized_users'] ) ) )
+ {
+ continue 2;
+ }
+ break;
+ }
+ }
+
+ $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();
+ }
+ }
+
+}
+
?>
\ No newline at end of file
diff --git a/upload/admin/api/blog/index.html b/upload/admin/api/blog/index.html
new file mode 100644
index 00000000..dfdb4ca9
--- /dev/null
+++ b/upload/admin/api/blog/index.html
@@ -0,0 +1,10 @@
+
+
IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/api/forums/api_topic_view.php b/upload/admin/api/forums/api_topic_view.php
index 0d788a68..9fdda218 100644
--- a/upload/admin/api/forums/api_topic_view.php
+++ b/upload/admin/api/forums/api_topic_view.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Forums topic view API file
- * Last Updated: $Date: 2009-02-04 15:03:59 -0500 (Wed, 04 Feb 2009) $
+ * Last Updated: $Date: 2010-10-25 11:20:47 -0400 (Mon, 25 Oct 2010) $
+ *
*
- * @author $Author: bfarber $
+ * @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Forums
- * @link http://www.iinvisionpower.com
- * @version $Rev: 3887 $
+ * @link http://www.invisionpower.com
+ * @version $Rev: 7036 $
* @since 2.2.0
*
*/
@@ -22,6 +24,11 @@ if ( ! class_exists( 'apiCore' ) )
require_once( IPS_ROOT_PATH . 'api/api_core.php' );
}
+/**
+ * apiTopicView class
+ * @package IP.Board
+ * @subpackage Forums
+ */
class apiTopicView extends apiCore
{
/**
@@ -58,8 +65,8 @@ class apiTopicView extends apiCore
// Get some classes
//-----------------------------------------
- require_once( IPSLib::getAppDir( 'forums' ) . '/app_class_forums.php' );
- $appClass = new app_class_forums( $this->registry );
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/app_class_forums.php', 'app_class_forums', 'forums' );
+ $appClass = new $classToLoad( $this->registry );
}
/**
@@ -186,7 +193,7 @@ class apiTopicView extends apiCore
'where' => "attach_rel_module='post' AND attach_rel_id IN (" . implode( ",", $this->attach_pids ) . ")"
) );
- $this->DB->execute;
+ $this->DB->execute();
while ( $a = $this->DB->fetch() )
{
diff --git a/upload/admin/api/forums/index.html b/upload/admin/api/forums/index.html
new file mode 100644
index 00000000..dfdb4ca9
--- /dev/null
+++ b/upload/admin/api/forums/index.html
@@ -0,0 +1,10 @@
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/api/gallery/api_gallery.php b/upload/admin/api/gallery/api_gallery.php
index 2f668a88..5bde56d1 100644
--- a/upload/admin/api/gallery/api_gallery.php
+++ b/upload/admin/api/gallery/api_gallery.php
@@ -1,18 +1,19 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Gallery API file
- * Last Updated: $Date: 2009-11-11 11:00:08 -0500 (Wed, 11 Nov 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
- * @author $Author: josh $
+ * @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: 5351 $
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Gallery
+ * @link http://www.invisionpower.com
+ * @version $Rev: 5713 $
* @since 2.2.0
*
*/
@@ -22,6 +23,10 @@ if ( ! class_exists( 'apiCore' ) )
require_once( IPS_ROOT_PATH . 'api/api_core.php' );
}
+/**
+ * apiGallery class
+ * @package IP.Gallery
+ */
class apiGallery extends apiCore
{
/**
diff --git a/upload/admin/api/gallery/index.html b/upload/admin/api/gallery/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/api/gallery/index.html
+++ b/upload/admin/api/gallery/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/api/index.html b/upload/admin/api/index.html
index 9ef89742..dfdb4ca9 100644
--- a/upload/admin/api/index.html
+++ b/upload/admin/api/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/extensions/admin/index.html b/upload/admin/applications/core/extensions/admin/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/extensions/admin/index.html
+++ b/upload/admin/applications/core/extensions/admin/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/extensions/admin/member_form.php b/upload/admin/applications/core/extensions/admin/member_form.php
index 9bce9f44..b114cc7f 100644
--- a/upload/admin/applications/core/extensions/admin/member_form.php
+++ b/upload/admin/applications/core/extensions/admin/member_form.php
@@ -1,97 +1,99 @@
-Incorrect accessYou 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§ion=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() );
- }
-
-
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Member property updater (AJAX)
+ * Last Updated: $Date: 2010-01-15 14:28:09 -0500 (Fri, 15 Jan 2010) $
+ *
+ *
+ * @author $Author: josh $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 1st march 2002
+ * @version $Revision: 5715 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access 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§ion=tools&do=do_locked&auth_key=".ipsRegistry::member()->form_hash."&mid_{$member['member_id']}=1&type=unlock",
+ 'title' => $this->lang->words['reset_failed_logins'] );
+ }
+
+ 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(), $tabsUsed=5 )
+ {
+ return array( 'tabs' => '', 'content' => '', 'tabsUsed' => 0 );
+ }
+
+ /**
+ * 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() );
+ }
+
+
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/extensions/coreExtensions.php b/upload/admin/applications/core/extensions/coreExtensions.php
index 3404fce6..bcd679eb 100644
--- a/upload/admin/applications/core/extensions/coreExtensions.php
+++ b/upload/admin/applications/core/extensions/coreExtensions.php
@@ -1,106 +1,108 @@
-Incorrect accessYou 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;
- }
-}
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Core Sessions
+ * Last Updated: $Date: 2010-01-21 03:39:17 -0500 (Thu, 21 Jan 2010) $
+ *
+ *
+ * @author $Author: matt $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 20th February 2002
+ * @version $Rev: 5732 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access 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;
+ }
+}
diff --git a/upload/admin/applications/core/extensions/coreVariables.php b/upload/admin/applications/core/extensions/coreVariables.php
index 00cdf15f..385701e8 100644
--- a/upload/admin/applications/core/extensions/coreVariables.php
+++ b/upload/admin/applications/core/extensions/coreVariables.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Core registered caches, redirect resets and bitwise settings
- * Last Updated: $Date: 2009-11-25 17:27:38 -0500 (Wed, 25 Nov 2009) $
+ * Last Updated: $Date: 2010-09-15 19:24:12 -0400 (Wed, 15 Sep 2010) $
+ *
*
- * @author $Author: josh $
+ * @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 5477 $
+ * @version $Rev: 6882 $
*
*/
@@ -27,26 +29,30 @@ if ( ! defined( 'IN_IPB' ) )
*/
$_LOAD = array();
-if ( $_GET['module'] == 'search' )
+if( isset($_GET['module']) )
{
- $_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;
+ if ( $_GET['module'] == 'search' )
+ {
+ $_LOAD['ranks'] = 1;
+ $_LOAD['bbcode'] = 1;
+ $_LOAD['emoticons'] = 1;
+ $_LOAD['reputation_levels'] = 1;
+ $_LOAD['attachtypes'] = 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;
+ }
}
diff --git a/upload/admin/applications/core/extensions/dashboardNotifications.php b/upload/admin/applications/core/extensions/dashboardNotifications.php
new file mode 100644
index 00000000..b4177d44
--- /dev/null
+++ b/upload/admin/applications/core/extensions/dashboardNotifications.php
@@ -0,0 +1,197 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Dashboard Notifications
+ * Last Updated: $Date
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6980 $
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+/**
+* Main loader class
+*/
+class dashboardNotifications__core
+{
+ /**
+ * Registry Object Shortcuts
+ *
+ * @var object
+ */
+ public $settings;
+ public $lang;
+ public $cache;
+ public $caches;
+
+ public function __construct()
+ {
+ $this->settings = ipsRegistry::fetchSettings();
+ $this->lang = ipsRegistry::getClass('class_localization');
+ $this->caches =& ipsRegistry::cache()->fetchCaches();
+ $this->cache = ipsRegistry::cache();
+ }
+
+ public function get()
+ {
+ /* INIT */
+ $entries = array();
+
+ /* 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 )
+ {
+ $entries[] = array( $this->lang->words['furlcache_outofdate'], sprintf( $this->lang->words['furlcache_outofdate_desc'], $application['app_title'] ) . "{$this->lang->words['rebuild_furl_cache']} " );
+ break;
+ }
+ }
+ }
+ }
+
+ /* Minify on but /cache/tmp not writeable? */
+ if ( isset( $this->settings['_use_minify'] ) AND $this->settings['_use_minify'] )
+ {
+ $entries[] = array( $this->lang->words['minifywrite_head'], $this->lang->words['minifynot_writeable'] );
+ }
+
+ /* Installer Check */
+ if( @file_exists( IPS_ROOT_PATH . 'install/index.php' ) )
+ {
+ if ( ! @file_exists( DOC_IPS_ROOT_PATH . 'cache/installer_lock.php' ) )
+ {
+ $this->lang->words['cp_unlocked_warning'] = sprintf( $this->lang->words['cp_unlocked_warning'], CP_DIRECTORY );
+ $entries[] = array( $this->lang->words['cp_unlockedinstaller'], $this->lang->words['cp_unlocked_warning'] );
+ }
+ }
+ else if( @is_dir( IPS_ROOT_PATH . 'applications_addon/ips/convert/' ) and !@file_exists( DOC_IPS_ROOT_PATH . 'cache/converter_lock.php' ) and $this->caches['app_cache']['convert'] )
+ {
+ $this->lang->words['cp_warning_converter'] = sprintf( $this->lang->words['cp_warning_converter'], $this->settings['_base_url'] );
+ $entries[] = array( $this->lang->words['cp_unlocked_converter'], $this->lang->words['cp_warning_converter'] );
+ }
+
+ /* Unfinished Upgrade */
+ require_once( IPS_ROOT_PATH . '/setup/sources/base/setup.php' );
+ $versions = IPSSetUp::fetchAppVersionNumbers( 'core' );
+
+ if( $versions['current'][0] != $versions['latest'][0] )
+ {
+ $this->lang->words['cp_upgrade_warning'] = sprintf( $this->lang->words['cp_upgrade_warning'], $versions['current'][1], $versions['latest'][1], $this->settings['base_acp_url'] );
+
+ $entries[] = array( $this->lang->words['cp_unfinishedupgrade'], $this->lang->words['cp_upgrade_warning'] );
+ }
+
+ /* PHP Version Check */
+ if( PHP_VERSION < '5.1.0' )
+ {
+ $entries[] = array( sprintf( $this->lang->words['cp_yourphpversion'], PHP_VERSION ), $this->lang->words['cp_php_warning'] );
+ }
+
+ /* Board Offline Check */
+ if ( $this->settings['board_offline'] )
+ {
+ $entries[] = array( $this->lang->words['cp_boardoffline'], "{$this->lang->words['cp_boardoffline1']} {$this->lang->words['_raquo']} {$this->lang->words['cp_boardoffline2']} " );
+ }
+
+ /* Fulltext Check */
+ if( $this->settings['search_method'] == 'traditional' AND !$this->settings['use_fulltext'] AND !$this->settings['hide_ftext_note'] )
+ {
+ $entries[] = array( $this->lang->words['fulltext_off'], "{$this->lang->words['fulltext_turnon']} {$this->lang->words['_raquo']} {$this->lang->words['fulltext_find']} " );
+ }
+
+ /* Make sure the profile directory is writable */
+ if( ! is_dir( $this->settings['upload_dir'] . '/profile/' ) || ! is_writable( $this->settings['upload_dir'] . '/profile/' ) )
+ {
+ $entries[] = array( $this->lang->words['cp_profilephotoerr_title'], sprintf( $this->lang->words['cp_profilephotoerr_msg'], $this->settings['upload_dir'] . '/profile/' ) );
+ }
+
+ /* Check for upgrade finish folder */
+ if( is_dir( IPS_ROOT_PATH . 'upgradeFinish/' ) )
+ {
+ $entries[] = array( $this->lang->words['cp_upgradefinishfolder'], sprintf( $this->lang->words['cp_upgradefinishfolder_msg'], IPS_ROOT_PATH . 'upgradeFinish/' ) );
+ }
+
+ /* Check to see if GD is intalled */
+ if(! extension_loaded( 'gd' ) || ! function_exists( 'gd_info' ) )
+ {
+ $entries[] = array( $this->lang->words['cp_gdnotinstalled_title'], $this->lang->words['cp_gdnotinstalled_msg'] );
+ }
+
+ /* Performance mode check */
+ $perfMode = $this->cache->getCache('performanceCache');
+
+ if( is_array( $perfMode ) && count( $perfMode ) )
+ {
+ $entries[] = array( $this->lang->words['cp_perfmodeon_title'], $this->lang->words['cp_perfmodeon_msg'] );
+ }
+
+ /* Suhosin check */
+ if( extension_loaded( 'suhosin' ) )
+ {
+ $_postMaxVars = @ini_get('suhosin.post.max_vars');
+ $_reqMaxVars = @ini_get('suhosin.request.max_vars');
+ $_postMaxLen = @ini_get('suhosin.post.max_value_length');
+ $_reqMaxLen = @ini_get('suhosin.request.max_value_length');
+
+ if( $_postMaxVars < 4096 )
+ {
+ $entries[] = array( $this->lang->words['suhosin_notification'], sprintf( $this->lang->words['suhosin_badvalue1'], $_postMaxVars ) );
+ }
+
+ if( $_reqMaxVars < 4096 )
+ {
+ $entries[] = array( $this->lang->words['suhosin_notification'], sprintf( $this->lang->words['suhosin_badvalue2'], $_reqMaxVars ) );
+ }
+
+ if( $_postMaxLen < 1000000 )
+ {
+ $entries[] = array( $this->lang->words['suhosin_notification'], sprintf( $this->lang->words['suhosin_badvalue3'], $_postMaxLen ) );
+ }
+
+ if( $_reqMaxLen < 1000000 )
+ {
+ $entries[] = array( $this->lang->words['suhosin_notification'], sprintf( $this->lang->words['suhosin_badvalue4'], $_reqMaxLen ) );
+ }
+ }
+
+ /* SQL error check */
+ if ( file_exists( IPS_CACHE_PATH . 'cache/sql_error_latest.cgi' ) )
+ {
+ $unix = @filemtime( IPS_CACHE_PATH . 'cache/sql_error_latest.cgi' );
+
+ if ( $unix )
+ {
+ $mtime = gmdate( 'd-j-Y', $unix );
+ $now = gmdate( 'd-j-Y', time() );
+
+ if ( $mtime == $now )
+ {
+ /* Display a message */
+ }
+ }
+ }
+
+ return $entries;
+ }
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/extensions/editorSections.php b/upload/admin/applications/core/extensions/editorSections.php
index 11fc4ee0..151ca348 100644
--- a/upload/admin/applications/core/extensions/editorSections.php
+++ b/upload/admin/applications/core/extensions/editorSections.php
@@ -1,33 +1,35 @@
-Incorrect accessYou 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'],
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * BBCode Management : Determines if bbcode can be used in this section
+ * Last Updated: $LastChangedDate: 2010-01-21 03:39:17 -0500 (Thu, 21 Jan 2010) $
+ *
+ *
+ * @author $Author: matt $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 5732 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access 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'],
);
\ No newline at end of file
diff --git a/upload/admin/applications/core/extensions/furlIdTemplates.php b/upload/admin/applications/core/extensions/furlIdTemplates.php
new file mode 100644
index 00000000..fd282df3
--- /dev/null
+++ b/upload/admin/applications/core/extensions/furlIdTemplates.php
@@ -0,0 +1,70 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.2
+ * Sets up SEO templates
+ * Last Updated: $Date: 2010-07-01 18:13:46 -0400 (Thu, 01 Jul 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 20th February 2002
+ * @version $Rev: 6596 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access 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=(\w+?)$#i', 'rss/$4/$6-#{__title__}/' ),
+ 'in' => array( 'regex' => "#/rss/(\w+?)/(\w+?)-#i",
+ 'matches' => array( array( 'app', 'core' ), array( 'module', 'global' ), array( 'section', 'rss' ), array( 'type', '$1' ), array( 'id', '$2' ) ) ) ),
+
+# Changed section=rss2 id matching to use \w for more flexibility
+
+);
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/extensions/furlTemplates.php b/upload/admin/applications/core/extensions/furlTemplates.php
index fabd9b18..510d709d 100644
--- a/upload/admin/applications/core/extensions/furlTemplates.php
+++ b/upload/admin/applications/core/extensions/furlTemplates.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Sets up SEO templates
- * Last Updated: $Date: 2009-03-04 15:08:31 +0000 (Wed, 04 Mar 2009) $
+ * Last Updated: $Date: 2010-07-01 18:13:46 -0400 (Thu, 01 Jul 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4136 $
+ * @version $Rev: 6596 $
*
*/
@@ -47,7 +49,7 @@ $_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",
+ 'in' => array( 'regex' => "#/register(/|$|\?)#i",
'matches' => array( array( 'app', 'core' ), array( 'module', 'global' ), array( 'section', 'register' ) ) ) ),
'section=rss' => array( 'app' => 'core',
@@ -58,10 +60,11 @@ $_SEOTEMPLATES = array(
'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",
+ 'out' => array( '#app=core(&|&)module=global(&|&)section=rss(&|&)type=(\w+?)(&|&)id=(\w+?)$#i', 'rss/$4/$6-#{__title__}/' ),
+ 'in' => array( 'regex' => "#/rss/(\w+?)/(\w+?)-#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
+
+# Changed section=rss2 id matching to use \w for more flexibility
+
);
\ No newline at end of file
diff --git a/upload/admin/applications/core/extensions/index.html b/upload/admin/applications/core/extensions/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/extensions/index.html
+++ b/upload/admin/applications/core/extensions/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/extensions/notifications.php b/upload/admin/applications/core/extensions/notifications.php
new file mode 100644
index 00000000..a2e32dc2
--- /dev/null
+++ b/upload/admin/applications/core/extensions/notifications.php
@@ -0,0 +1,50 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Define the core notification types
+ * Last Updated: $Date: 2010-10-25 10:10:56 -0400 (Mon, 25 Oct 2010) $
+ *
+ *
+ * @author $Author: mmecham $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 20th February 2002
+ * @version $Rev: 7030 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+
+
+class core_notifications
+{
+ public function getConfiguration()
+ {
+ /**
+ * Notification types - Needs to be a method so when require_once is used, $_NOTIFY isn't empty
+ */
+ $_NOTIFY = array(
+ // Future...
+ // array( 'key' => 'reputation_received', 'default' => array( 'inline' ), 'disabled' => array() ),
+ array( 'key' => 'report_center', 'default' => array( 'email' ), 'disabled' => array(), 'show_callback' => TRUE , 'icon' => 'notify_reportcenter' ),
+ array( 'key' => 'new_comment' , 'default' => array( 'email' ), 'disabled' => array(), 'show_callback' => false, 'icon' => 'notify_profilecomment' ),
+ );
+ return $_NOTIFY;
+ }
+
+ public function report_center()
+ {
+ return $this->memberData['access_report_center'];
+ }
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/sources/reportPlugins/default.php b/upload/admin/applications/core/extensions/reportPlugins/default.php
similarity index 82%
rename from upload/admin/applications/core/sources/reportPlugins/default.php
rename to upload/admin/applications/core/extensions/reportPlugins/default.php
index 9efb3767..a40c17dc 100644
--- a/upload/admin/applications/core/sources/reportPlugins/default.php
+++ b/upload/admin/applications/core/extensions/reportPlugins/default.php
@@ -1,498 +1,491 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
- exit();
-}
-
-class default_plugin
-{
- /**#@+
- * Registry objects
- *
- * @access protected
- * @var object
- */
- protected $registry;
- protected $DB;
- protected $settings;
- protected $request;
- protected $lang;
- protected $member;
- protected $cache;
- /**#@-*/
-
- /**
- * Holds extra data for the plugin
- *
- * @access private
- * @var array Data specific to the plugin
- */
- public $_extra;
-
- /**
- * Constructor
- *
- * @access public
- * @param object Registry object
- * @return void
- */
- public function __construct( ipsRegistry $registry )
- {
- //-----------------------------------------
- // 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->cache = $this->registry->cache();
- $this->caches =& $this->registry->cache()->fetchCaches();
- }
-
- /**
- * Display the form for extra data in the ACP
- *
- * @access public
- * @param array Plugin data
- * @param object HTML object
- * @return string HTML to add to the form
- */
- public function displayAdminForm( $plugin_data, &$html )
- {
- $req_input = '';
- $return = '';
-
- if( is_array($plugin_data['required_input']) && count($plugin_data['required_input']) > 0 )
- {
- foreach( $plugin_data['required_input'] as $key => $value )
- {
- if( $req_input != '' )
- {
- $req_input .= "\r\n";
- }
-
- $req_input .= $key . ' ' . $value;
- }
- }
-
- $return .= $html->addRow( "Название секции",
- "Помогает определить модуль форума из которого была отправлена жалоба.",
- $this->registry->output->formInput('section_title', $plugin_data['section_title'])
- );
-
- $return .= $html->addRow( "URL секции",
- "Ссылка на секцию из которой пришла жалоба.",
- $this->registry->output->formInput('section_url', $plugin_data['section_url'])
- );
-
- $desc = << Например:
- content_id [^0-9] title [^A-Za-z0-9]
-EOF;
-
- $return .= $html->addRow( "Формат полей",
- $desc,
- $this->registry->output->formTextarea('required_input', $req_input, 50, 9)
- );
-
- $return .= $html->addRow( "URL",
- "Сслыка на саму публикацию. Если не указан 'http://' будет подставлен базовый URL форума. Можно использовать данные из входных параметров: {input_id}",
- $this->registry->output->formInput('string_url', $plugin_data['string_url'])
- );
-
- $return .= $html->addRow( "Название",
- "Название жалобы. Можно использовать данные из входных параметров: {input_id}. Можно использовать #PAGE_TITLE#",
- $this->registry->output->formInput('string_title', $plugin_data['string_title'])
- );
-
- return $return;
- }
-
- /**
- * Process the plugin's form fields for saving
- *
- * @access public
- * @param array Plugin data for save
- * @return string Error message
- */
- public function processAdminForm( &$save_data_array )
- {
- if( ! $_POST['string_url'] )
- {
- return "Поле 'URL' должно быть заполнено";
- }
-
- if( ! $_POST['string_title'] )
- {
- return "Поле 'Название' должно быть заполнено. Не можете придумать - используйте #PAGE_TITLE#";
- }
-
- $req_in_a = array();
-
- if( $_POST['required_input'] )
- {
- $req_i = explode( " ", $this->request['required_input'] );
-
- foreach( $req_i as $line )
- {
- $line_inp = explode( ' ', $line, 2 );
- $req_in_a[ $line_inp[0] ] = $line_inp[1];
- }
- }
-
- $save_data_array['required_input'] = $req_in_a;
- $save_data_array['string_url'] = str_replace("&", "&", $this->request['string_url']);
- $save_data_array['string_title'] = $this->request['string_title'];
- $save_data_array['section_title'] = $this->request['section_title'];
- $save_data_array['section_url'] = $this->request['section_url'];
-
- return '';
- }
-
- /**
- * Update timestamp for report
- *
- * @access public
- * @param array New reports
- * @param array New members cache
- * @return boolean
- */
- public function updateReportsTimestamp( $new_reports, &$new_members_cache )
- {
- return true;
- }
-
- /**
- * Get report permissions
- *
- * @access public
- * @param string Type of perms to check
- * @param array Permissions data
- * @param array group ids
- * @param string Special permissions
- * @return boolean
- */
- public function getReportPermissions( $check, $com_dat, $group_ids, &$to_return )
- {
- if( $this->_extra['report_bypass'] == 0 || $this->memberData['g_is_supmod'] == 1 )
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
- /**
- * Show the report form for this module
- *
- * @access public
- * @param array Application data
- * @return string HTML form information
- */
- public function reportForm( $com_dat )
- {
- $this->registry->output->setTitle( $this->lang->words['report_basic_title'] );
- $this->registry->output->addNavigation( $this->lang->words['report_basic_title'], '' );
-
- $url = '';
- $title = '';
- $ex_form_data = array();
-
- $this->processBasicForumData( $com_dat, $url, $title, $ex_form_data );
-
- //-----------------------------------------
- // Title, URL Extra Data (Array)
- //-----------------------------------------
-
- return $this->registry->getClass('reportLibrary')->showReportForm( $title, $url, $ex_form_data );
- }
-
- /**
- * Process the basic forum data
- *
- * @access public
- * @param array Application data
- * @param string URL
- * @param string Title
- * @param array Extra form data
- * @return mixed Could show page error, or set $url, $title and $ex_form_data
- */
- public function processBasicForumData( $com_dat, &$url, &$title, &$ex_form_data )
- {
- //-----------------------------------------
- // Process required input information
- //-----------------------------------------
-
- if( is_array($this->_extra['required_input']) && count($this->_extra['required_input']) > 0 )
- {
- foreach( $this->_extra['required_input'] as $key => $regex )
- {
- if( ! $this->request[ $key ] || ( trim($regex) != '' && preg_match( "/{$regex}/" , $this->request[ $key ] ) ) )
- {
- $this->registry->output->showError( 'reports_input_not_match', 10157 );
- }
- else
- {
- $ex_form_data[ $key ] = $this->request[ $key ];
- }
- }
- }
-
- //-----------------------------------------
- // Format URL String with inputs
- //-----------------------------------------
-
- if( ! $this->_extra['string_url'] )
- {
- $this->registry->output->showError( 'reports_input_not_match', 10158 );
- }
- else
- {
- $url = $this->_extra['string_url'];
-
- while( preg_match("/\{([a-z0-9_\-]+)\}/i", $url, $matched) )
- {
- $url = str_replace( '{' . $matched[1] . '}', $ex_form_data[$matched[1]], $url);
- }
- }
-
- if( strpos( $url, 'http://' ) !== 0 )
- {
- $url = $this->settings['base_url'] . $url;
- }
-
- //-----------------------------------------
- // Format Title String with inputs, etc..
- //-----------------------------------------
-
- if( ! $this->_extra['string_title'] )
- {
- $this->registry->output->showError( 'reports_input_not_match', 10159 );
- }
- else
- {
- $title = $this->_extra['string_title'];
-
- while( preg_match("/\{([a-z0-9_\-]+)\}/i", $title, $matched) )
- {
- $title = str_replace( '{' . $matched[1] . '}', $ex_form_data[$matched[1]], $title);
- }
-
- if( strpos( $title, "#PAGE_TITLE#" ) !== false )
- {
- $page_title = $this->_getPageTitle( $url );
- $title = str_replace( "#PAGE_TITLE#", $page_title, $title );
- }
- }
-
- $this->registry->output->setTitle( $title );
- }
-
- /**
- * Get section and link
- *
- * @access public
- * @param array Report data
- * @return array Section/link
- */
- public function giveSectionLinkTitle( $report_row )
- {
- return array(
- 'title' => $this->_extra['section_title'],
- 'url' => $this->_extra['section_url'],
- );
- }
-
- /**
- * Process a report and save the data appropriate
- *
- * @access public
- * @param array Report data
- * @return array Data from saving the report
- */
- public function processReport( $com_dat )
- {
- $this->processBasicForumData( $com_dat, $url, $title, $ex_form_data );
-
- $return_data = array();
- $a_url = str_replace( "&", "&", $url );
- $uid = md5( $url . '_' . $com_dat['com_id'] );
-
- $status = array();
-
- $this->DB->build( array( 'select' => 'status, is_new, is_complete',
- 'from' => 'rc_status',
- 'where' => "is_new=1 OR is_complete=1",
- ) );
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- if( $row['is_new'] == 1 )
- {
- $status['new'] = $row['status'];
- }
- elseif( $row['is_complete'] == 1 )
- {
- $status['complete'] = $row['status'];
- }
- }
-
- $this->DB->build( array( 'select' => 'id', 'from' => 'rc_reports_index', 'where' => "uid='{$uid}'" ) );
- $this->DB->execute();
-
- if( $this->DB->getTotalRows() == 0 )
- {
- $built_report_main = array(
- 'uid' => $uid,
- 'title' => $title,
- 'status' => $status['new'],
- 'url' => $a_url,
- 'rc_class' => $com_dat['com_id'],
- 'updated_by' => $this->memberData['member_id'],
- 'date_updated' => time(),
- 'date_created' => time(),
- );
-
- $this->DB->insert( 'rc_reports_index', $built_report_main );
- $rid = $this->DB->getInsertId();
- }
- else
- {
- $the_report = $this->DB->fetch();
- $rid = $the_report['id'];
-
- $this->DB->update( 'rc_reports_index', array( 'date_updated' => time(), 'status' => $status['new'] ), "id='{$rid}'" );
- }
-
- IPSText::getTextClass('bbcode')->parse_bbcode = 1;
- IPSText::getTextClass('bbcode')->parse_html = 0;
- IPSText::getTextClass('bbcode')->parse_emoticons = 1;
- IPSText::getTextClass('bbcode')->parse_nl2br = 1;
- IPSText::getTextClass('bbcode')->parsing_section = 'reports';
-
- $build_report = array(
- 'rid' => $rid,
- 'report' => IPSText::getTextClass('bbcode')->preDbParse( $this->request['message'] ),
- 'report_by' => $this->memberData['member_id'],
- 'date_reported' => time(),
- );
-
- $this->DB->insert( 'rc_reports', $build_report );
-
- $reports = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as total', 'from' => 'rc_reports', 'where' => "rid='{$rid}'" ) );
-
- $this->DB->update( 'rc_reports_index', array( 'num_reports' => $reports['total'] ), "id='{$rid}'" );
-
- $return_data['REDIRECT_URL'] = $a_url;
- $return_data['REPORT_INDEX'] = $rid;
- $return_data['SAVED_URL'] = $url;
- $return_data['REPORT'] = $build_report['report'];
-
- return $return_data;
- }
-
- /**
- * Where to send user after report is submitted
- *
- * @access public
- * @param array Report data
- * @return void
- */
- public function reportRedirect( $report_data )
- {
- $this->registry->output->redirectScreen( $this->lang->words['report_sending'], $this->settings['base_url'] . $report_data['REDIRECT_URL'] );
- }
-
- /**
- * Loads an HTML page and grabs its title
- *
- * @access private
- * @param string Web URL
- * @return string
- */
- private function _getPageTitle( $URL )
- {
- $html_code = file_get_contents( $URL );
-
- # I just hope the page is html...
- if( preg_match("/\(.+?)\<\/title\>/i", $html_code, $match ) )
- {
- return htmlentities( $match[1] );
- }
- else
- {
- return $this->lang->words['report_page_title_unknown'];
- }
- }
-
- /**
- * Retrieve list of users to send notifications to
- *
- * @access public
- * @param string Group ids
- * @param array Report data
- * @return array Array of users to PM/Email
- */
- public function getNotificationList( $group_ids, $report_data )
- {
- $notify = array();
-
- $this->DB->build( array(
- 'select' => 'noti.*',
- 'from' => array( 'rc_modpref' => 'noti' ),
- 'where' => 'mem.member_group_id IN(' . $group_ids . ')',
- 'add_join' => array(
- array(
- 'select' => 'mem.member_id, mem.members_display_name as name, mem.language, mem.members_disable_pm, mem.email, mem.member_group_id',
- 'from' => array( 'members' => 'mem' ),
- 'where' => 'mem.member_id=noti.mem_id',
- )
- )
- ) );
- $this->DB->execute();
-
- if( $this->DB->getTotalRows() > 0 )
- {
- while( $row = $this->DB->fetch() )
- {
- if( $row['by_pm'] == 1 )
- {
- $notify['PM'][] = $row;
- }
- if( $row['by_email'] == 1 )
- {
- $notify['EMAIL'][] = $row;
- }
-
- $notify['RSS'][] = $row;
- }
- }
-
- return $notify;
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Report Center :: Default plugin
+ * Last Updated: $LastChangedDate: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @author Based on original "Report Center" by Luke Scott
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 5713 $
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+class default_plugin
+{
+ /**#@+
+ * Registry objects
+ *
+ * @access protected
+ * @var object
+ */
+ protected $registry;
+ protected $DB;
+ protected $settings;
+ protected $request;
+ protected $lang;
+ protected $member;
+ protected $cache;
+ /**#@-*/
+
+ /**
+ * Holds extra data for the plugin
+ *
+ * @access private
+ * @var array Data specific to the plugin
+ */
+ public $_extra;
+
+ /**
+ * Constructor
+ *
+ * @access public
+ * @param object Registry object
+ * @return void
+ */
+ public function __construct( ipsRegistry $registry )
+ {
+ //-----------------------------------------
+ // 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->cache = $this->registry->cache();
+ $this->caches =& $this->registry->cache()->fetchCaches();
+ }
+
+ /**
+ * Display the form for extra data in the ACP
+ *
+ * @access public
+ * @param array Plugin data
+ * @param object HTML object
+ * @return string HTML to add to the form
+ */
+ public function displayAdminForm( $plugin_data, &$html )
+ {
+ $req_input = '';
+ $return = '';
+
+ if( is_array($plugin_data['required_input']) && count($plugin_data['required_input']) > 0 )
+ {
+ foreach( $plugin_data['required_input'] as $key => $value )
+ {
+ if( $req_input != '' )
+ {
+ $req_input .= "\r\n";
+ }
+
+ $req_input .= $key . ' ' . $value;
+ }
+ }
+
+ $return .= $html->addRow( "Section Title",
+ "This helps you distinguish generally what part of your site a report came from.",
+ $this->registry->output->formInput('section_title', $plugin_data['section_title'])
+ );
+
+ $return .= $html->addRow( "Section URL",
+ "This helps you distinguish generally what part of your site a report came from.",
+ $this->registry->output->formInput('section_url', $plugin_data['section_url'])
+ );
+
+ $desc = << Example:
+ content_id [^0-9] title [^A-Za-z0-9]
+EOF;
+
+ $return .= $html->addRow( "Required Input",
+ $desc,
+ $this->registry->output->formTextarea('required_input', $req_input, 50, 9)
+ );
+
+ $return .= $html->addRow( "URL String",
+ "The formatted URL that is used to point to the reported content. If the URL does not contain 'http://' the board's base url will be inserted. You may also include input data: {input_id}",
+ $this->registry->output->formInput('string_url', $plugin_data['string_url'])
+ );
+
+ $return .= $html->addRow( "Title String",
+ "The formatted title that is shown on the reporting page and when reports are listed. You may include input data: {input_id}. If you would like the report center to pull the page title, use #PAGE_TITLE#",
+ $this->registry->output->formInput('string_title', $plugin_data['string_title'])
+ );
+
+ return $return;
+ }
+
+ /**
+ * Process the plugin's form fields for saving
+ *
+ * @access public
+ * @param array Plugin data for save
+ * @return string Error message
+ */
+ public function processAdminForm( &$save_data_array )
+ {
+ if( ! $_POST['string_url'] )
+ {
+ return "You need to at least have the 'URL String'";
+ }
+
+ if( ! $_POST['string_title'] )
+ {
+ return "You need to have a 'Title String'. If not sure, just use #PAGE_TITLE#";
+ }
+
+ $req_in_a = array();
+
+ if( $_POST['required_input'] )
+ {
+ $req_i = explode( " ", $this->request['required_input'] );
+
+ foreach( $req_i as $line )
+ {
+ $line_inp = explode( ' ', $line, 2 );
+ $req_in_a[ $line_inp[0] ] = $line_inp[1];
+ }
+ }
+
+ $save_data_array['required_input'] = $req_in_a;
+ $save_data_array['string_url'] = str_replace("&", "&", $this->request['string_url']);
+ $save_data_array['string_title'] = $this->request['string_title'];
+ $save_data_array['section_title'] = $this->request['section_title'];
+ $save_data_array['section_url'] = $this->request['section_url'];
+
+ return '';
+ }
+
+ /**
+ * Update timestamp for report
+ *
+ * @access public
+ * @param array New reports
+ * @param array New members cache
+ * @return boolean
+ */
+ public function updateReportsTimestamp( $new_reports, &$new_members_cache )
+ {
+ return true;
+ }
+
+ /**
+ * Get report permissions
+ *
+ * @access public
+ * @param string Type of perms to check
+ * @param array Permissions data
+ * @param array group ids
+ * @param string Special permissions
+ * @return boolean
+ */
+ public function getReportPermissions( $check, $com_dat, $group_ids, &$to_return )
+ {
+ if( $this->_extra['report_bypass'] == 0 || $this->memberData['g_is_supmod'] == 1 )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Show the report form for this module
+ *
+ * @access public
+ * @param array Application data
+ * @return string HTML form information
+ */
+ public function reportForm( $com_dat )
+ {
+ $this->registry->output->setTitle( $this->lang->words['report_basic_title'] );
+ $this->registry->output->addNavigation( $this->lang->words['report_basic_title'], '' );
+
+ $url = '';
+ $title = '';
+ $ex_form_data = array();
+
+ $this->processBasicForumData( $com_dat, $url, $title, $ex_form_data );
+
+ //-----------------------------------------
+ // Title, URL Extra Data (Array)
+ //-----------------------------------------
+
+ return $this->registry->getClass('reportLibrary')->showReportForm( $title, $url, $ex_form_data );
+ }
+
+ /**
+ * Process the basic forum data
+ *
+ * @access public
+ * @param array Application data
+ * @param string URL
+ * @param string Title
+ * @param array Extra form data
+ * @return mixed Could show page error, or set $url, $title and $ex_form_data
+ */
+ public function processBasicForumData( $com_dat, &$url, &$title, &$ex_form_data )
+ {
+ //-----------------------------------------
+ // Process required input information
+ //-----------------------------------------
+
+ if( is_array($this->_extra['required_input']) && count($this->_extra['required_input']) > 0 )
+ {
+ foreach( $this->_extra['required_input'] as $key => $regex )
+ {
+ if( ! $this->request[ $key ] || ( trim($regex) != '' && preg_match( "/{$regex}/" , $this->request[ $key ] ) ) )
+ {
+ $this->registry->output->showError( 'reports_input_not_match', 10157 );
+ }
+ else
+ {
+ $ex_form_data[ $key ] = $this->request[ $key ];
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Format URL String with inputs
+ //-----------------------------------------
+
+ if( ! $this->_extra['string_url'] )
+ {
+ $this->registry->output->showError( 'reports_input_not_match', 10158 );
+ }
+ else
+ {
+ $url = $this->_extra['string_url'];
+
+ while( preg_match("/\{([a-z0-9_\-]+)\}/i", $url, $matched) )
+ {
+ $url = str_replace( '{' . $matched[1] . '}', $ex_form_data[$matched[1]], $url);
+ }
+ }
+
+ if( strpos( $url, 'http://' ) !== 0 )
+ {
+ $url = $this->settings['base_url'] . $url;
+ }
+
+ //-----------------------------------------
+ // Format Title String with inputs, etc..
+ //-----------------------------------------
+
+ if( ! $this->_extra['string_title'] )
+ {
+ $this->registry->output->showError( 'reports_input_not_match', 10159 );
+ }
+ else
+ {
+ $title = $this->_extra['string_title'];
+
+ while( preg_match("/\{([a-z0-9_\-]+)\}/i", $title, $matched) )
+ {
+ $title = str_replace( '{' . $matched[1] . '}', $ex_form_data[$matched[1]], $title);
+ }
+
+ if( strpos( $title, "#PAGE_TITLE#" ) !== false )
+ {
+ $page_title = $this->_getPageTitle( $url );
+ $title = str_replace( "#PAGE_TITLE#", $page_title, $title );
+ }
+ }
+
+ $this->registry->output->setTitle( $title );
+ }
+
+ /**
+ * Get section and link
+ *
+ * @access public
+ * @param array Report data
+ * @return array Section/link
+ */
+ public function giveSectionLinkTitle( $report_row )
+ {
+ return array(
+ 'title' => $this->_extra['section_title'],
+ 'url' => $this->_extra['section_url'],
+ );
+ }
+
+ /**
+ * Process a report and save the data appropriate
+ *
+ * @access public
+ * @param array Report data
+ * @return array Data from saving the report
+ */
+ public function processReport( $com_dat )
+ {
+ $this->processBasicForumData( $com_dat, $url, $title, $ex_form_data );
+
+ $return_data = array();
+ $a_url = str_replace( "&", "&", $url );
+ $uid = md5( $url . '_' . $com_dat['com_id'] );
+
+ $status = array();
+
+ $this->DB->build( array( 'select' => 'status, is_new, is_complete',
+ 'from' => 'rc_status',
+ 'where' => "is_new=1 OR is_complete=1",
+ ) );
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ if( $row['is_new'] == 1 )
+ {
+ $status['new'] = $row['status'];
+ }
+ elseif( $row['is_complete'] == 1 )
+ {
+ $status['complete'] = $row['status'];
+ }
+ }
+
+ $this->DB->build( array( 'select' => 'id', 'from' => 'rc_reports_index', 'where' => "uid='{$uid}'" ) );
+ $this->DB->execute();
+
+ if( $this->DB->getTotalRows() == 0 )
+ {
+ $built_report_main = array(
+ 'uid' => $uid,
+ 'title' => $title,
+ 'status' => $status['new'],
+ 'url' => $a_url,
+ 'rc_class' => $com_dat['com_id'],
+ 'updated_by' => $this->memberData['member_id'],
+ 'date_updated' => time(),
+ 'date_created' => time(),
+ );
+
+ $this->DB->insert( 'rc_reports_index', $built_report_main );
+ $rid = $this->DB->getInsertId();
+ }
+ else
+ {
+ $the_report = $this->DB->fetch();
+ $rid = $the_report['id'];
+
+ $this->DB->update( 'rc_reports_index', array( 'date_updated' => time(), 'status' => $status['new'] ), "id='{$rid}'" );
+ }
+
+ IPSText::getTextClass('bbcode')->parse_bbcode = 1;
+ IPSText::getTextClass('bbcode')->parse_html = 0;
+ IPSText::getTextClass('bbcode')->parse_emoticons = 1;
+ IPSText::getTextClass('bbcode')->parse_nl2br = 1;
+ IPSText::getTextClass('bbcode')->parsing_section = 'reports';
+
+ $build_report = array(
+ 'rid' => $rid,
+ 'report' => IPSText::getTextClass('bbcode')->preDbParse( $this->request['message'] ),
+ 'report_by' => $this->memberData['member_id'],
+ 'date_reported' => time(),
+ );
+
+ $this->DB->insert( 'rc_reports', $build_report );
+
+ $reports = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as total', 'from' => 'rc_reports', 'where' => "rid='{$rid}'" ) );
+
+ $this->DB->update( 'rc_reports_index', array( 'num_reports' => $reports['total'] ), "id='{$rid}'" );
+
+ $return_data['REDIRECT_URL'] = $a_url;
+ $return_data['REPORT_INDEX'] = $rid;
+ $return_data['SAVED_URL'] = $url;
+ $return_data['REPORT'] = $build_report['report'];
+
+ return $return_data;
+ }
+
+ /**
+ * Where to send user after report is submitted
+ *
+ * @access public
+ * @param array Report data
+ * @return void
+ */
+ public function reportRedirect( $report_data )
+ {
+ $this->registry->output->redirectScreen( $this->lang->words['report_sending'], $this->settings['base_url'] . $report_data['REDIRECT_URL'] );
+ }
+
+ /**
+ * Loads an HTML page and grabs its title
+ *
+ * @access private
+ * @param string Web URL
+ * @return string
+ */
+ private function _getPageTitle( $URL )
+ {
+ $html_code = file_get_contents( $URL );
+
+ # I just hope the page is html...
+ if( preg_match("/\(.+?)\<\/title\>/i", $html_code, $match ) )
+ {
+ return htmlentities( $match[1] );
+ }
+ else
+ {
+ return $this->lang->words['report_page_title_unknown'];
+ }
+ }
+
+ /**
+ * Retrieve list of users to send notifications to
+ *
+ * @access public
+ * @param string Group ids
+ * @param array Report data
+ * @return array Array of users to PM/Email
+ */
+ public function getNotificationList( $group_ids, $report_data )
+ {
+ $notify = array();
+
+ $this->DB->build( array(
+ 'select' => 'noti.*',
+ 'from' => array( 'rc_modpref' => 'noti' ),
+ 'where' => 'mem.member_group_id IN(' . $group_ids . ')',
+ 'add_join' => array(
+ array(
+ 'select' => 'mem.member_id, mem.members_display_name as name, mem.language, mem.members_disable_pm, mem.email, mem.member_group_id',
+ 'from' => array( 'members' => 'mem' ),
+ 'where' => 'mem.member_id=noti.mem_id',
+ )
+ )
+ ) );
+ $this->DB->execute();
+
+ if( $this->DB->getTotalRows() > 0 )
+ {
+ while( $row = $this->DB->fetch() )
+ {
+ $notify[] = $row;
+ }
+ }
+
+ return $notify;
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/extensions/reportPlugins/index.html b/upload/admin/applications/core/extensions/reportPlugins/index.html
new file mode 100644
index 00000000..dfdb4ca9
--- /dev/null
+++ b/upload/admin/applications/core/extensions/reportPlugins/index.html
@@ -0,0 +1,10 @@
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/extensions/rssOutput.php b/upload/admin/applications/core/extensions/rssOutput.php
index 89d502f5..9552b2af 100644
--- a/upload/admin/applications/core/extensions/rssOutput.php
+++ b/upload/admin/applications/core/extensions/rssOutput.php
@@ -1,119 +1,118 @@
-Incorrect accessYou 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;
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * RSS output plugin :: report center
+ * Last Updated: $Date: 2010-10-14 13:15:13 -0400 (Thu, 14 Oct 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 6/24/2008
+ * @version $Revision: 6980 $
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access 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
+ *
+ * @var integer Expiration timestamp
+ */
+ private $expires = 0;
+
+ /**
+ * Grab the RSS links
+ *
+ * @return array
+ */
+ public function getRssLinks()
+ {
+ //-----------------------------------------
+ // As this is member specific, hardcoded
+ // into output library
+ //-----------------------------------------
+
+ return array();
+ }
+
+ /**
+ * Grab the RSS document content and return it
+ *
+ * @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' );
+
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classRss.php', 'classRss' );
+ $rss = new $classToLoad();
+
+ $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
+ *
+ * @return integer Expiration timestamp
+ */
+ public function grabExpiryDate()
+ {
+ return time() + 3600;
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/extensions/search/config.php b/upload/admin/applications/core/extensions/search/config.php
new file mode 100644
index 00000000..fea89127
--- /dev/null
+++ b/upload/admin/applications/core/extensions/search/config.php
@@ -0,0 +1,35 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Config file
+ * Last Updated: $Date: 2010-02-19 01:29:54 +0000 (Fri, 19 Feb 2010) $
+ *
+ *
+ * @author $author$
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Forums
+ * @link http://www.invisionpower.com
+ * @version $Rev: 5855 $
+ **/
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+/* Can search with this app */
+$CONFIG['can_search'] = 1;
+
+/* Can view new content with this app */
+$CONFIG['can_viewNewContent'] = 0;
+
+/* Can fetch active content with this app */
+$CONFIG['can_activeContent'] = 0;
+
+/* Can fetch user generated content */
+$CONFIG['can_userContent'] = 0;
\ No newline at end of file
diff --git a/upload/admin/applications/core/extensions/search/engines/index.html b/upload/admin/applications/core/extensions/search/engines/index.html
new file mode 100644
index 00000000..dfdb4ca9
--- /dev/null
+++ b/upload/admin/applications/core/extensions/search/engines/index.html
@@ -0,0 +1,10 @@
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/extensions/search/engines/sql.php b/upload/admin/applications/core/extensions/search/engines/sql.php
new file mode 100644
index 00000000..20f5cfc8
--- /dev/null
+++ b/upload/admin/applications/core/extensions/search/engines/sql.php
@@ -0,0 +1,211 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Basic Forum Search
+ * Last Updated: $Date: 2010-02-23 12:38:11 +0000 (Tue, 23 Feb 2010) $
+ *
+ *
+ * @author $Author: matt $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Forums
+ * @link http://www.invisionpower.com
+ * @version $Rev: 5861 $
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class search_engine_core extends search_engine
+{
+ /**
+ * Constructor
+ */
+ public function __construct( ipsRegistry $registry )
+ {
+ parent::__construct( $registry );
+ }
+
+ /**
+ * Perform a search.
+ * Returns an array of a total count (total number of matches)
+ * and an array of IDs ( 0 => 1203, 1 => 928, 2 => 2938 ).. matching the required number based on pagination. The ids returned would be based on the filters and type of search
+ *
+ * So if we had 1000 replies, and we are on page 2 of 25 per page, we'd return 25 items offset by 25
+ *
+ * @access public
+ * @return array
+ */
+ public function search()
+ {
+ /* INIT */
+ $count = 0;
+ $results = array();
+ $sort_by = IPSSearchRegistry::get('in.search_sort_by');
+ $sort_order = IPSSearchRegistry::get('in.search_sort_order');
+ $search_term = IPSSearchRegistry::get('in.clean_search_term');
+ $content_title_only = IPSSearchRegistry::get('opt.searchTitleOnly');
+ $post_search_only = IPSSearchRegistry::get('opt.onlySearchPosts');
+ $order_dir = ( $sort_order == 'asc' ) ? 'asc' : 'desc';
+ $sortKey = '';
+ $sortType = '';
+ $rows = array();
+ $got = 0;
+
+ if ( IPSSearchRegistry::get('opt.noPostPreview') OR IPSSearchRegistry::get('display.onlyTitles') )
+ {
+ $group_by = 'h.id';
+ }
+
+ /* Sorting */
+ switch( $sort_by )
+ {
+ default:
+ case 'date':
+ $sortKey = ( $content_title_only ) ? 'id' : 'id';
+ $sortType = 'numerical';
+ break;
+ case 'title':
+ $sortKey = 'title';
+ $sortType = 'string';
+ break;
+ }
+
+ /* Query the count */
+ $count = $this->DB->buildAndFetch( 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' ) ) ) );
+
+
+
+ /* Fetch data */
+ $this->DB->build( array( 'select' => 'h.*',
+ 'from' => array( 'faq' => 'h' ),
+ 'where' => $this->_buildWhereStatement( $search_term, $content_title_only ),
+ 'group' => $group_by,
+ 'order' => $sortKey . ' ' . $sort_order,
+ 'limit' => array( IPSSearchRegistry::get('in.start'), IPSSearchRegistry::get('opt.search_per_page') ),
+ '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();
+
+ /* Sort */
+ while ( $_row = $this->DB->fetch() )
+ {
+ $rows[ $got ] = $_row;
+
+ $got++;
+ }
+
+ /* Return it */
+ return array( 'count' => $count['total_results'], 'resultSet' => $rows );
+ }
+
+ /**
+ * 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 );
+ }
+
+ /**
+ * Remap standard columns (Apps can override )
+ *
+ * @access public
+ * @param string $column sql table column for this condition
+ * @return string column
+ * @return void
+ */
+ public function remapColumn( $column )
+ {
+ if ( $column == 'member_id' )
+ {
+ return '';
+ }
+
+ return $column;
+ }
+
+ /**
+ * Returns an array used in the searchplugin's setCondition method
+ *
+ * @access public
+ * @param array $data Array of forums to view
+ * @return array Array with column, operator, and value keys, for use in the setCondition call
+ **/
+ public function buildFilterSQL( $data )
+ {
+ /* INIT */
+ $return = array();
+
+ /* Set up some defaults */
+ IPSSearchRegistry::set( 'opt.noPostPreview' , false );
+ IPSSearchRegistry::set( 'opt.onlySearchPosts', false );
+
+ return array();
+ }
+
+ /**
+ * Can handle boolean searching
+ *
+ * @access public
+ * @return boolean
+ */
+ public function isBoolean()
+ {
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/extensions/search/form.php b/upload/admin/applications/core/extensions/search/form.php
new file mode 100644
index 00000000..f3c7b98b
--- /dev/null
+++ b/upload/admin/applications/core/extensions/search/form.php
@@ -0,0 +1,59 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Returns HTML for the form (optional class, not required)
+ * Last Updated: $Date: 2010-02-19 01:29:54 +0000 (Fri, 19 Feb 2010) $
+ *
+ *
+ * @author $author$
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Forums
+ * @link http://www.invisionpower.com
+ * @version $Rev: 5855 $
+ **/
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class search_form_core
+{
+ /**
+ * Construct
+ *
+ */
+ public function __construct()
+ {
+ /* Make object */
+ $this->registry = ipsRegistry::instance();
+ $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();
+ }
+
+ /**
+ * Return sort drop down
+ *
+ *
+ * @access public
+ * @return array
+ */
+ public function fetchSortDropDown()
+ {
+ $array = array( 'date' => $this->lang->words['s_search_type_0'],
+ 'title' => $this->lang->words['forum_sort_title'] );
+
+ return $array;
+ }
+}
diff --git a/upload/admin/applications/core/extensions/search/format.php b/upload/admin/applications/core/extensions/search/format.php
new file mode 100644
index 00000000..4cf6323a
--- /dev/null
+++ b/upload/admin/applications/core/extensions/search/format.php
@@ -0,0 +1,96 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Formats forum search results
+ * Last Updated: $Date: 2010-02-19 01:29:54 +0000 (Fri, 19 Feb 2010) $
+ *
+ *
+ * @author $author$
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Forums
+ * @link http://www.invisionpower.com
+ * @version $Rev: 5855 $
+ **/
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class search_format_core extends search_format
+{
+ /**
+ * Constructor
+ */
+ public function __construct( ipsRegistry $registry )
+ {
+ parent::__construct( $registry );
+ }
+
+ /**
+ * Parse search results
+ *
+ * @access private
+ * @param array $r Search result
+ * @return array $html Blocks of HTML
+ */
+ public function parseAndFetchHtmlBlocks( $rows )
+ {
+ return parent::parseAndFetchHtmlBlocks( $rows );
+ }
+
+ /**
+ * Formats the forum search result for display
+ *
+ * @access public
+ * @param array $search_row Array of data
+ * @return mixed Formatted content, ready for display, or array containing a $sub section flag, and content
+ **/
+ public function formatContent( $data )
+ {
+ return array( ipsRegistry::getClass( 'output' )->getTemplate( 'search' )->helpSearchResult( $data, IPSSearchRegistry::get('display.onlyTitles') ), 0 );
+ }
+
+ /**
+ * Formats / grabs extra data for results
+ * Takes an array of IDS (can be IDs from anything) and returns an array of expanded data.
+ *
+ * @access public
+ * @return array
+ */
+ public function processResults( $ids )
+ {
+ $rows = array();
+
+ foreach( $ids as $i => $d )
+ {
+ $rows[ $i ] = $this->genericizeResults( $d );
+ }
+
+ return $rows;
+ }
+
+ /**
+ * Reassigns fields in a generic way for results output
+ *
+ * @param array $r
+ * @return array
+ **/
+ public function genericizeResults( $r )
+ {
+ $r['app'] = 'core';
+ $r['content'] = $r['title'];
+ $r['content_title'] = $r['description'];
+ $r['updated'] = 0;
+ $r['type_2'] = 'help';
+ $r['type_id_2'] = $r['id'];
+
+ return $r;
+ }
+
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/extensions/search/index.html b/upload/admin/applications/core/extensions/search/index.html
new file mode 100644
index 00000000..dfdb4ca9
--- /dev/null
+++ b/upload/admin/applications/core/extensions/search/index.html
@@ -0,0 +1,10 @@
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/extensions/searchDisplay.php b/upload/admin/applications/core/extensions/searchDisplay.php
deleted file mode 100644
index ea7bbc37..00000000
--- a/upload/admin/applications/core/extensions/searchDisplay.php
+++ /dev/null
@@ -1,69 +0,0 @@
-Incorrect accessYou 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();
- }
-}
\ No newline at end of file
diff --git a/upload/admin/applications/core/extensions/searchPlugin.php b/upload/admin/applications/core/extensions/searchPlugin.php
deleted file mode 100644
index 12a62bec..00000000
--- a/upload/admin/applications/core/extensions/searchPlugin.php
+++ /dev/null
@@ -1,387 +0,0 @@
-Incorrect accessYou 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;
- }
-}
\ No newline at end of file
diff --git a/upload/admin/applications/core/extensions/sphinxTemplate.php b/upload/admin/applications/core/extensions/sphinxTemplate.php
index 0de8c6ee..2d2259ed 100644
--- a/upload/admin/applications/core/extensions/sphinxTemplate.php
+++ b/upload/admin/applications/core/extensions/sphinxTemplate.php
@@ -1,86 +1,88 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-$appSphinxTemplate = <<cache_store VALUES( 'sphinx_core_counter', (SELECT max(id) FROM 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 faq f \
- LEFT JOIN permission_index pi ON ( pi.perm_type_id=1 AND pi.perm_type='help' ) \
- WHERE f.id <= ( SELECT cs_value FROM 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 faq f \
- LEFT JOIN permission_index pi ON ( pi.perm_type_id=1 AND pi.perm_type='help' ) \
- WHERE f.id > ( SELECT cs_value FROM 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 = /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 = /core_search_delta
-}
-
-
-EOF;
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Sphinx template file
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 5713 $
+ * @since 3.0.0
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+$appSphinxTemplate = <<cache_store VALUES( 'sphinx_core_counter', (SELECT max(id) FROM 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 faq f \
+ LEFT JOIN permission_index pi ON ( pi.perm_type_id=1 AND pi.perm_type='help' ) \
+ WHERE f.id <= ( SELECT cs_value FROM 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 faq f \
+ LEFT JOIN permission_index pi ON ( pi.perm_type_id=1 AND pi.perm_type='help' ) \
+ WHERE f.id > ( SELECT cs_value FROM 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 = /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 = /core_search_delta
+}
+
+
+EOF;
diff --git a/upload/admin/applications/core/extensions/usercpForms.php b/upload/admin/applications/core/extensions/usercpForms.php
index a538021c..b96019f3 100644
--- a/upload/admin/applications/core/extensions/usercpForms.php
+++ b/upload/admin/applications/core/extensions/usercpForms.php
@@ -1,1326 +1,2051 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class usercpForms_core extends public_core_usercp_manualResolver implements interface_usercp
-{
- /**
- * Tab name
- * This can be left blank and the application title will
- * be used
- *
- * @access public
- * @var string
- */
- public $tab_name = "Настройки";
-
- /**
- * OK Message
- * This is an optional message to return back to the framework
- * to replace the standard 'Settings saved' message
- *
- * @access public
- * @var string
- */
- public $ok_message = '';
-
- /**
- * Hide 'save' button and form elements
- * Useful if you have custom output that doesn't
- * require it
- *
- * @access public
- * @var bool
- */
- public $hide_form_and_save_button = false;
-
- /**
- * If you wish to allow uploads, set a value for this
- *
- * @access public
- * @var integer
- */
- public $uploadFormMax = 0;
-
- /**
- * Flag to indicate that the user is a facebook logged in user doozer
- *
- * @access protected
- * @var boolean
- */
- protected $_isFBUser = false;
-
- /**
- * Initiate this module
- *
- * @access public
- * @return void
- */
- public function init( )
- {
- $this->tab_name = ipsRegistry::getClass('class_localization')->words['tab__core'];
-
- /* Facebook? */
- if ( IPSLib::fbc_enabled() === TRUE AND $this->memberData['fb_uid'] )
- {
- require_once( IPS_ROOT_PATH . 'sources/classes/facebook/connect.php' );
- $facebook = new facebook_connect( $this->registry );
-
- /* Test connection */
- $facebook->testConnectSession();
-
- try
- {
- $fbuid = $facebook->FB()->get_loggedin_user();
- }
- catch( Exception $e )
- {
- }
-
- if ( $fbuid )
- {
- $this->_isFBUser = true;
- }
- }
- }
-
- /**
- * Return links for this tab
- * You may return an empty array or FALSE to not have
- * any links show in the tab.
- *
- * The links must have 'area=xxxxx'. The rest of the URL
- * is added automatically.
- * 'area' can only be a-z A-Z 0-9 - _
- *
- * @access public
- * @author Matt Mecham
- * @return array Links
- */
- public function getLinks()
- {
- ipsRegistry::instance()->getClass('class_localization')->loadLanguageFile( array( 'public_usercp' ), 'core' );
-
- $array = array();
-
- $array[] = array( 'url' => 'area=settings',
- 'title' => ipsRegistry::instance()->getClass('class_localization')->words['ucp_general_settings'],
- 'active' => $this->request['tab'] == 'core' && $this->request['area'] == 'settings' ? 1 : 0,
- 'area' => 'settings'
- );
-
- $array[] = array( 'url' => 'area=email',
- 'title' => ipsRegistry::instance()->getClass('class_localization')->words['ucp_change_email'],
- 'active' => $this->request['tab'] == 'core' && $this->request['area'] == 'email' ? 1 : 0,
- 'area' => 'email'
- );
-
- /* No use for this for FB users */
- if ( ! $this->_isFBUser )
- {
- $array[] = array( 'url' => 'area=password',
- 'title' => ipsRegistry::instance()->getClass('class_localization')->words['ucp_change_password'],
- 'active' => $this->request['tab'] == 'core' && $this->request['area'] == 'password' ? 1 : 0,
- 'area' => 'password'
- );
- }
-
- if ( $this->settings['auth_allow_dnames'] == 1 AND $this->memberData['g_dname_changes'] > 0 )
- {
- $array[] = array( 'url' => 'area=displayname',
- 'title' => ipsRegistry::instance()->getClass('class_localization')->words['ucp_change_name'],
- 'active' => $this->request['tab'] == 'core' && $this->request['area'] == 'displayname' ? 1 : 0,
- 'area' => 'displayname'
- );
- }
-
- $array[] = array( 'url' => 'area=notes',
- 'title' => ipsRegistry::instance()->getClass('class_localization')->words['m_notes'],
- 'active' => $this->request['tab'] == 'core' && $this->request['area'] == 'notes' ? 1 : 0,
- 'area' => 'notes'
- );
-
- if ( $this->memberData['g_attach_max'] != -1 )
- {
- $array[] = array(
- 'url' => 'area=attachments',
- 'title' => ipsRegistry::instance()->getClass('class_localization')->words['m_attach'],
- 'active' => $this->request['tab'] == 'core' && $this->request['area'] == 'attachments' ? 1 : 0,
- 'area' => 'attachments'
- );
- }
-
- return $array;
- }
-
-
- /**
- * Run custom event
- *
- * If you pass a 'do' in the URL / post form that is not either:
- * save / save_form or show / show_form then this function is loaded
- * instead. You can return a HTML chunk to be used in the UserCP (the
- * tabs and footer are auto loaded) or redirect to a link.
- *
- * If you are returning HTML, you can use $this->hide_form_and_save_button = 1;
- * to remove the form and save button that is automatically placed there.
- *
- * @access public
- * @author Matt Mecham
- * @param string Current area
- * @return mixed html or void
- */
- public function runCustomEvent( $currentArea )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $html = '';
-
- //-----------------------------------------
- // What to do?
- //-----------------------------------------
-
- switch( $currentArea )
- {
- case 'updateAttachments':
- return $this->customEvent_updateAttachments();
- break;
- }
-
- //-----------------------------------------
- // Turn off save button
- //-----------------------------------------
-
- $this->hide_form_and_save_button = 1;
-
- //-----------------------------------------
- // Return
- //-----------------------------------------
-
- return $html;
- }
-
- /**
- * Delete attachments
- *
- * @access public
- * @author Matt Mecham
- * @return string Processed HTML
- */
- public function customEvent_updateAttachments()
- {
- //-----------------------------------------
- // Get the ID's to delete
- //-----------------------------------------
-
- $finalIDs = array();
-
- //-----------------------------------------
- // Grab post IDs
- //-----------------------------------------
-
- if ( is_array( $_POST['attach'] ) and count( $_POST['attach'] ) )
- {
- foreach( $_POST['attach'] as $id => $value )
- {
- $finalIDs[ $id ] = intval( $id );
- }
- }
-
- if ( count($finalIDs) > 0 )
- {
- $this->DB->build( array( 'select' => 'a.*',
- 'from' => array( 'attachments' => 'a' ),
- 'where' => "a.attach_id IN (" . implode( ",", $finalIDs ) .") AND a.attach_rel_module IN( 'post', 'msg' ) AND attach_member_id=" . $this->memberData['member_id'],
- 'add_join' => array(
- array( 'select' => 'p.topic_id, p.pid',
- 'from' => array( 'posts' => 'p' ),
- 'where' => "p.pid=a.attach_rel_id AND a.attach_rel_module='post'",
- 'type' => 'left'
- ),
- array( 'select' => 'mt.msg_id, mt.msg_topic_id',
- 'from' => array( 'message_posts' => 'mt' ),
- 'where' => "mt.msg_id=a.attach_rel_id AND a.attach_rel_module='msg'",
- 'type' => 'left'
- ),
- )
- ) );
-
- $o = $this->DB->execute();
-
- while ( $killmeh = $this->DB->fetch( $o ) )
- {
- if ( $killmeh['attach_location'] )
- {
- @unlink( $this->settings['upload_dir']."/".$killmeh['attach_location'] );
- }
- if ( $killmeh['attach_thumb_location'] )
- {
- @unlink( $this->settings['upload_dir']."/".$killmeh['attach_thumb_location'] );
- }
-
- if ( $killmeh['topic_id'] )
- {
- $this->DB->update( 'topics', 'topic_hasattach=topic_hasattach-1', 'tid='.$killmeh['topic_id'], true, true );
- }
- else if( $killmeh['msg_id'] )
- {
- $this->DB->update( 'message_topics', 'mt_hasattach=mt_hasattach-1', 'mt_id='.$killmeh['msg_topic_id'], true, true );
- }
- }
-
- $this->DB->delete( 'attachments', 'attach_id IN ('.implode(",",$finalIDs).') and attach_member_id='.$this->memberData['member_id'] );
- }
-
- $this->registry->getClass('output')->silentRedirect( $this->settings['base_url']."app=core&module=usercp&tab=core&area=attachments&do=show" );
- }
-
- /**
- * UserCP Form Show
- *
- * @access public
- * @author Matt Mecham
- * @param string Current area as defined by 'get_links'
- * @param array Array of errors
- * @return string Processed HTML
- */
- public function showForm( $current_area, $errors=array() )
- {
- //-----------------------------------------
- // Where to go, what to see?
- //-----------------------------------------
-
- switch( $current_area )
- {
- default:
- case 'settings':
- return $this->showFormSettings();
- break;
- case 'email':
- return $this->showFormEmail();
- break;
- case 'password':
- return $this->showFormPassword();
- break;
- case 'displayname':
- return $this->showFormDisplayname();
- break;
- case 'attachments':
- return $this->showFormAttachments();
- break;
- case 'notes':
- return $this->showFormNotes();
- break;
- }
- }
-
- /**
- * Show the attachments form
- *
- * @access public
- * @author Matt Mecham
- * @return string Processed HTML
- */
- public function showFormAttachments()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $info = array();
- $start = intval( $this->request['st'] );
- $perpage = 15;
- $sort_key = "";
- $attachments = array();
-
- $this->hide_form_and_save_button = 1;
-
- //-----------------------------------------
- // Sort it
- //-----------------------------------------
-
- switch ( $this->request['sort'] )
- {
- case 'date':
- $sort_key = 'a.attach_date ASC';
- $info['date_order'] = 'rdate';
- $info['size_order'] = 'size';
- break;
- case 'rdate':
- $sort_key = 'a.attach_date DESC';
- $info['date_order'] = 'date';
- $info['size_order'] = 'size';
- break;
- case 'size':
- $sort_key = 'a.attach_filesize DESC';
- $info['date_order'] = 'date';
- $info['size_order'] = 'rsize';
- break;
- case 'rsize':
- $sort_key = 'a.attach_filesize ASC';
- $info['date_order'] = 'date';
- $info['size_order'] = 'size';
- break;
- default:
- $sort_key = 'a.attach_date DESC';
- $info['date_order'] = 'date';
- $info['size_order'] = 'size';
- break;
- }
-
- //-----------------------------------------
- // Get some stats...
- //-----------------------------------------
-
- $maxspace = intval($this->memberData['g_attach_max']);
-
- if ( $this->memberData['g_attach_max'] == -1 )
- {
- $this->registry->getClass('output')->showError( 'no_permission_to_attach', 1010 );
- }
-
- //-----------------------------------------
- // Limit by forums
- //-----------------------------------------
-
- $stats = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count, sum(attach_filesize) as sum',
- 'from' => 'attachments',
- 'where' => 'attach_member_id=' . $this->memberData['member_id'] . " AND attach_rel_module IN( 'post', 'msg' )" ) );
-
- if ( $maxspace > 0 )
- {
- //-----------------------------------------
- // Figure out percentage used
- //-----------------------------------------
-
- $info['has_limit'] = 1;
- $info['full_percent'] = $stats['sum'] ? sprintf( "%.0f", ( ( $stats['sum'] / ($maxspace * 1024) ) * 100) ) : 0;
-
- if ( $info['full_percent'] > 100 )
- {
- $info['full_percent'] = 100;
- }
- else if ( $info['full_percent'] < 1 AND $stats['count'] > 0 )
- {
- $info['full_percent'] = 1;
- }
-
- $info['attach_space_count'] = sprintf( $this->lang->words['attach_space_count'], intval($stats['count']), intval($info['full_percent']) );
- $info['attach_space_used'] = sprintf( $this->lang->words['attach_space_used'] , IPSLib::sizeFormat(intval($stats['sum'])), IPSLib::sizeFormat($maxspace * 1024) );
- }
- else
- {
- $info['has_limit'] = 0;
- $info['attach_space_used'] = sprintf( $this->lang->words['attach_space_unl'] , IPSLib::sizeFormat(intval($stats['sum'])) );
- }
-
- //-----------------------------------------
- // Pages
- //-----------------------------------------
-
- $pages = $this->registry->getClass('output')->generatePagination( array( 'totalItems' => $stats['count'],
- 'itemsPerPage' => $perpage,
- 'currentStartValue' => $start,
- 'baseUrl' => "app=core&module=usercp&tab=core&area=attachments&sort=" . $this->request['sort'] . "",
- ) );
-
- //-----------------------------------------
- // Get attachments...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => 'a.*',
- 'from' => array( 'attachments' => 'a' ),
- 'where' => "a.attach_member_id=" . $this->memberData['member_id'] . " AND a.attach_rel_module IN( 'post', 'msg' )",
- 'order' => $sort_key,
- 'limit' => array( $start, $perpage ),
- 'add_join' => array(
- array( 'select' => 'p.topic_id',
- 'from' => array( 'posts' => 'p' ),
- 'where' => 'p.pid=a.attach_rel_id',
- 'type' => 'left'
- ),
- array( 'select' => 't.*',
- 'from' => array( 'topics' => 't' ),
- 'where' => 't.tid=p.topic_id',
- 'type' => 'left'
- ) ) ) );
- $outer = $this->DB->execute();
-
- $this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_topic'), 'forums' );
-
- $cache = $this->cache->getCache('attachtypes');
-
- while ( $row = $this->DB->fetch( $outer ) )
- {
- if ( IPSMember::checkPermissions('read', $row['forum_id'] ) != TRUE )
- {
- $row['title'] = $this->lang->words['attach_topicmoved'];
- }
-
- //-----------------------------------------
- // Full attachment thingy
- //-----------------------------------------
-
- if ( $row['attach_rel_module'] == 'post' )
- {
- $row['_type'] = 'post';
- }
- else if ( $row['attach_rel_module'] == 'msg' )
- {
- $row['_type'] = 'msg';
- $row['title'] = $this->lang->words['attach_inpm'];
- }
-
- /* IPB 2.x conversion */
- $row['image'] = str_replace( 'folder_mime_types', 'mime_types', $cache[ $row['attach_ext'] ]['atype_img'] );
- $row['short_name'] = IPSText::truncate( $row['attach_file'], 30 );
- $row['attach_date'] = $this->registry->getClass( 'class_localization')->getDate( $row['attach_date'], 'SHORT' );
- $row['real_size'] = IPSLib::sizeFormat( $row['attach_filesize'] );
-
- $attachments[] = $row;
- }
-
- return $this->registry->getClass('output')->getTemplate('ucp')->coreAttachments( $info, $pages, $attachments );
- }
-
- /**
- * Show the Password form
- *
- * @access public
- * @author Matt Mecham
- * @return string Processed HTML
- */
- public function showFormPassword()
- {
- //-----------------------------------------
- // Do we have another URL for password resets?
- //-----------------------------------------
-
- require_once( IPS_ROOT_PATH . 'sources/handlers/han_login.php' );
- $han_login = new han_login( $this->registry );
- $han_login->init();
- $han_login->checkMaintenanceRedirect();
-
- if( $this->memberData['g_access_cp'] )
- {
- $this->hide_form_and_save_button = true;
- }
-
- return $this->registry->getClass('output')->getTemplate('ucp')->passwordChangeForm();
- }
-
- /**
- * Show the Email form
- *
- * @access public
- * @author Matt Mecham
- * @param string Returned error message (if any)
- * @return string Processed HTML
- */
- public function showFormEmail( $_message='' )
- {
- //-----------------------------------------
- // Do not allow validating members to change
- // email when admin validation is on
- // @see http://community.invisionpower.com/tracker/issue-19964-loophole-in-registration-procedure/
- //-----------------------------------------
-
- if( $this->memberData['member_group_id'] == $this->settings['auth_group'] AND in_array( $this->settings['reg_auth_type'], array( 'admin', 'admin_user' ) ) )
- {
- $this->registry->output->showError( $this->lang->words['admin_val_no_email_chg'], 10189 );
- }
-
- //-----------------------------------------
- // Do we have another URL for email resets?
- //-----------------------------------------
-
- require_once( IPS_ROOT_PATH . 'sources/handlers/han_login.php' );
- $han_login = new han_login( $this->registry );
- $han_login->init();
- $han_login->checkMaintenanceRedirect();
-
- $txt = $this->lang->words['ce_current'] . $this->memberData['email'];
-
- if ( $this->settings['reg_auth_type'])
- {
- $txt .= $this->lang->words['ce_auth'];
- }
-
- if ( $this->settings['bot_antispam'] )
- {
- $captchaHTML = $this->registry->getClass('class_captcha')->getTemplate();
- }
-
- $_message = $_message ? $this->lang->words[$_message] : '';
-
- if( $this->memberData['g_access_cp'] )
- {
- $this->hide_form_and_save_button = true;
- }
-
- return $this->registry->getClass('output')->getTemplate('ucp')->emailChangeForm( $txt, $_message, $captchaHTML, $this->_isFBUser );
- }
-
- /**
- * Show the display name form
- *
- * @access public
- * @author Matt Mecham
- * @param string Error message (if any)
- * @return string Processed HTML
- */
- public function showFormDisplayname( $error="" )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $form = array();
-
- //-----------------------------------------
- // CHECK (please)
- //-----------------------------------------
-
- if ( ! $this->settings['auth_allow_dnames'] OR $this->memberData['g_dname_changes'] < 1 OR $this->memberData['g_dname_date'] < 1 )
- {
- $this->registry->getClass('output')->showError( 'no_permission_for_display_names', 1011 );
- }
-
- $this->request['display_name'] = $this->request['display_name'] ? $this->request['display_name'] : '';
-
- $this->settings['username_errormsg'] = str_replace( '{chars}', $this->settings['username_characters'], $this->settings['username_errormsg'] );
-
- //-----------------------------------------
- // Grab # changes > 24 hours
- //-----------------------------------------
-
- $time_check = time() - 86400 * $this->memberData['g_dname_date'];
-
- if( $time_check < $this->memberData['joined'] )
- {
- $time_check = $this->memberData['joined'];
- }
-
- $name_count = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count, MIN(dname_date) as min_date', 'from' => 'dnames_change', 'where' => "dname_member_id=" . $this->memberData['member_id'] . " AND dname_date > $time_check" ) );
-
- $name_count['count'] = intval( $name_count['count'] );
- $name_count['min_date'] = intval( $name_count['min_date'] ) ? intval( $name_count['min_date'] ) : $time_check;
-
- //-----------------------------------------
- // Calculate # left
- //-----------------------------------------
-
- /* Check new permissions */
- $_g = $this->caches['group_cache'][ $this->memberData['member_group_id'] ];
-
- if ( $_g['g_displayname_unit'] )
- {
- if ( $_g['gbw_displayname_unit_type'] )
- {
- /* days */
- if ( $this->memberData['joined'] > ( time() - ( 86400 * $_g['g_displayname_unit'] ) ) )
- {
- $this->hide_form_and_save_button = 1;
- $form['_noPerm'] = sprintf( $this->lang->words['dname_group_restrict_date'], $this->lang->getDate( $this->memberData['joined'] + ( 86400 * $_g['g_displayname_unit'] ), 'long' ) );
- }
- }
- else
- {
- /* Posts */
- if ( $this->memberData['posts'] < $_g['g_displayname_unit'] )
- {
- $this->hide_form_and_save_button = 1;
- $form['_noPerm'] = sprintf( $this->lang->words['dname_group_restrict_posts'], $_g['g_displayname_unit'] - $this->memberData['posts'] );
- }
- }
- }
-
- if( !$form['_noPerm'] )
- {
- $form['_changes_left'] = $this->memberData['g_dname_changes'] - $name_count['count'];
- $form['_changes_done'] = $name_count['count'];
-
- # Make sure changes done isn't larger than allowed
- # This happens when changing via ACP
-
- if ( $form['_changes_done'] > $this->memberData['g_dname_changes'] )
- {
- $form['_changes_done'] = $this->memberData['g_dname_changes'];
- }
-
- $form['_first_change'] = $this->registry->getClass( 'class_localization')->getDate( $name_count['min_date'], 'date', 1 );
- $form['_lang_string'] = sprintf( $this->lang->words['dname_string'],
- $form['_changes_done'], $this->memberData['g_dname_changes'],
- $form['_first_change'], $this->memberData['g_dname_changes'],
- $this->memberData['g_dname_date'] );
- }
-
- //-----------------------------------------
- // Print
- //-----------------------------------------
-
- $this->_pageTitle = $this->lang->words['m_dname_change'];
-
- return $this->registry->getClass('output')->getTemplate('ucp')->displayNameForm( $form, $error, $okmessage, $this->_isFBUser );
- }
-
- /**
- * Show the Settings form
- *
- * @access public
- * @author Matt Mecham
- * @return string Processed HTML
- */
- public function showFormSettings()
- {
- /* Sort the times */
- $times = array();
-
- foreach( $this->lang->words as $k => $v )
- {
- if( strpos( $k, "time_" ) === 0 )
- {
- $k = str_replace( "time_", '', $k );
-
- if( preg_match( "/^[\-\d\.]+$/", $k ) )
- {
- $times[ $k ] = $v;
- }
- }
- }
-
- ksort( $times );
- //uksort( $this->lang->words, create_function( '$a, $b', '$a = str_replace( "time_", "", $a ); $b = str_replace( "time_", "", $b ); return $a > $b;' ) );
-
- /* Show the form */
- return $this->registry->getClass('output')->getTemplate('ucp')->generalSettingsForm( $times );
- }
-
- /**
- * Show the Notes form
- *
- * @access public
- * @author Matt Mecham
- * @return string Processed HTML
- */
- public function showFormNotes()
- {
- /* Show the form */
- $member = IPSMember::load( $this->memberData['member_id'], 'extendedProfile' );
- $content = $member['notes'];
-
- return $this->registry->getClass('output')->getTemplate('ucp')->coreNotesForm( $content );
- }
-
- /**
- * UserCP Form Check
- *
- * @access public
- * @author Matt Mecham
- * @param string Current area as defined by 'get_links'
- * @return string Processed HTML
- */
- public function saveForm( $current_area )
- {
- //-----------------------------------------
- // Where to go, what to see?
- //-----------------------------------------
-
- switch( $current_area )
- {
- default:
- case 'settings':
- return $this->saveFormSettings();
- break;
- case 'email':
- return $this->saveFormEmail();
- break;
- case 'password':
- return $this->saveFormPassword();
- break;
- case 'displayname':
- return $this->saveFormDisplayname();
- break;
- case 'notes':
- return $this->saveFormNotes();
- break;
- }
- }
-
- /**
- * UserCP Save Form: Notes
- *
- * @access public
- * @return boolean Successful
- */
- public function saveFormNotes()
- {
- //-----------------------------------------
- // Remove board tags
- //-----------------------------------------
-
- $_POST['Post'] = IPSText::removeMacrosFromInput( $_POST['Post'] );
-
- //-----------------------------------------
- // Write it to the DB.
- //-----------------------------------------
-
- IPSMember::save( $this->memberData['member_id'], array( 'extendedProfile' => array( 'notes' => htmlspecialchars($_POST['Post']) ) ) );
-
- $this->ok_message = $this->lang->words['notes_saved_msg'];
- return TRUE;
- }
-
- /**
- * UserCP Save Form: Password
- *
- * @access public
- * @param array Array of member / core_sys_login information (if we're editing)
- * @return mixed Array of errors / boolean true
- */
- public function saveFormPassword( $member=array() )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $cur_pass = trim($this->request['current_pass']);
- $new_pass = trim($this->request['new_pass_1']);
- $chk_pass = trim($this->request['new_pass_2']);
-
- //-----------------------------------------
- // Checks...
- //-----------------------------------------
-
- if( $this->memberData['g_access_cp'] )
- {
- return array( 0 => $this->lang->words['admin_emailpassword'] );
- }
-
- if ( ! $_POST['current_pass'] OR ( empty($new_pass) ) or ( empty($chk_pass) ) )
- {
- return array( 0 => $this->lang->words['complete_entire_form'] );
- }
-
- //-----------------------------------------
- // Do the passwords actually match?
- //-----------------------------------------
-
- if ( $new_pass != $chk_pass )
- {
- return array( 0 => $this->lang->words['passwords_not_matchy'] );
- }
-
- //-----------------------------------------
- // Check password...
- //-----------------------------------------
-
- if ( $this->_checkPassword( $cur_pass ) !== TRUE )
- {
- return array( 0 => $this->lang->words['current_pw_bad'] );
- }
-
- /*if ( IPSText::mbstrlen( $new_pass ) > 32)
- {
- return array( 0 => $this->lang->words['new_pw_too_long'] );
- }*/
-
- //-----------------------------------------
- // Create new password...
- //-----------------------------------------
-
- $md5_pass = md5($new_pass);
-
- //-----------------------------------------
- // han_login was loaded during check_password
- //-----------------------------------------
-
- $this->han_login->changePass( $this->memberData['email'], $md5_pass );
-
- if ( $this->han_login->return_code AND $this->han_login->return_code != 'METHOD_NOT_DEFINED' AND $this->han_login->return_code != 'SUCCESS' )
- {
- return array( 0 => $this->lang->words['hanlogin_pw_failed'] );
- }
-
- //-----------------------------------------
- // Update the DB
- //-----------------------------------------
-
- IPSMember::updatePassword( $this->memberData['email'], $md5_pass );
-
- IPSLib::runMemberSync( 'onPassChange', $this->memberData['member_id'], $new_pass );
-
- //-----------------------------------------
- // Update members log in key...
- //-----------------------------------------
-
- $key = IPSMember::generateAutoLoginKey();
-
- IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'member_login_key' => $key ) ) );
-
- $this->ok_message = $this->lang->words['pw_change_successful'];
-
- return TRUE;
- }
-
- /**
- * UserCP Save Form: Display Name
- *
- * @access public
- * @return mixed Array of errors / boolean true
- */
- public function saveFormDisplayname()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $members_display_name = trim($this->request['displayName']);
- $password_check = trim( $this->request['displayPassword'] );
-
- //-----------------------------------------
- // Check for blanks...
- //-----------------------------------------
-
- if ( ! $members_display_name OR ( ! $this->_isFBUser AND ! $password_check ) )
- {
- return array( 0 => $this->lang->words['complete_entire_form'] );
- }
-
- //-----------------------------------------
- // Check password
- //-----------------------------------------
-
- if ( ! $this->_isFBUser )
- {
- if ( $this->_checkPassword( $password_check ) === FALSE )
- {
- return array( 0 => $this->lang->words['current_pw_bad'] );
- }
- }
-
- try
- {
- if ( IPSMember::getFunction()->updateName( $this->memberData['member_id'], $members_display_name, 'members_display_name' ) === TRUE )
- {
- $this->cache->rebuildCache( 'stats', 'global' );
-
- return $this->showFormDisplayname( '', $this->lang->words['dname_change_ok'] );
- }
- else
- {
- # We should absolutely never get here. So this is a fail-safe, really to
- # prevent a "false" positive outcome for the end-user
- return array( 0 => $this->lang->words['name_taken_change'] );
- }
- }
- catch( Exception $error )
- {
- switch( $error->getMessage() )
- {
- case 'NO_MORE_CHANGES':
- return array( 0 => $this->lang->words['name_change_no_more'] );
- break;
- case 'NO_USER':
- return array( 0 => $this->lang->words['name_change_noload'] );
- break;
- case 'NO_PERMISSION':
- return array( 0 => $this->lang->words['name_change_noperm'] );
- case 'NO_NAME':
- return array( 0 => sprintf( $this->lang->words['name_change_tooshort'], $this->settings['max_user_name_length'] ) );
- break;
- case 'TOO_LONG':
- return array( 0 => sprintf( $this->lang->words['name_change_tooshort'], $this->settings['max_user_name_length'] ) );
- break;
- case 'ILLEGAL_CHARS':
- return array( 0 => $this->lang->words['name_change_illegal'] );
- break;
- case 'USER_NAME_EXISTS':
- return array( 0 => $this->lang->words['name_change_taken'] );
- break;
- default:
- return array( 0 => $error->getMessage() );
- break;
- }
- }
-
- return TRUE;
- }
-
- /**
- * UserCP Save Form: Email Address
- *
- * @access public
- * @return mixed Array of errors / boolean true
- */
- public function saveFormEmail()
- {
- //-----------------------------------------
- // Do not allow validating members to change
- // email when admin validation is on
- // @see http://community.invisionpower.com/tracker/issue-19964-loophole-in-registration-procedure/
- //-----------------------------------------
-
- if( $this->memberData['member_group_id'] == $this->settings['auth_group'] AND in_array( $this->settings['reg_auth_type'], array( 'admin', 'admin_user' ) ) )
- {
- $this->registry->output->showError( $this->lang->words['admin_val_no_email_chg'], 10190 );
- }
-
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $_emailOne = strtolower( trim($this->request['in_email_1']) );
- $_emailTwo = strtolower( trim($this->request['in_email_2']) );
- $captchaInput = trim(ipsRegistry::$request['captchaInput']);
- $captchaUniqueID = trim(ipsRegistry::$request['captchaUniqueID']);
-
- //-----------------------------------------
- // Check input
- //-----------------------------------------
-
- if( $this->memberData['g_access_cp'] )
- {
- return array( 0 => $this->lang->words['admin_emailpassword'] );
- }
-
- if ( ! $_POST['in_email_1'] OR ! $_POST['in_email_2'] )
- {
- return array( 0 => $this->lang->words['complete_entire_form'] );
- }
-
- //-----------------------------------------
- // Check password...
- //-----------------------------------------
-
- if ( ! $this->_isFBUser )
- {
- if ( $this->_checkPassword( $this->request['password'] ) === FALSE )
- {
- return array( 0 => $this->lang->words['current_pw_bad'] );
- }
- }
-
- //-----------------------------------------
- // Test email addresses
- //-----------------------------------------
-
- if ( $_emailOne != $_emailTwo)
- {
- return array( 0 => $this->lang->words['emails_no_matchy'] );
- }
-
- if ( IPSText::checkEmailAddress( $_emailOne ) !== TRUE )
- {
- return array( 0 => $this->lang->words['email_not_valid'] );
- }
-
- //-----------------------------------------
- // Is this email addy taken?
- //-----------------------------------------
-
- if ( IPSMember::checkByEmail( $_emailOne ) == TRUE )
- {
- return array( 0 => $this->lang->words['email_is_taken'] );
- }
-
- //-----------------------------------------
- // Load ban filters
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'banfilters' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $banfilters[ $r['ban_type'] ][] = $r['ban_content'];
- }
-
- //-----------------------------------------
- // Check in banned list
- //-----------------------------------------
-
- if ( isset($banfilters['email']) AND is_array( $banfilters['email'] ) and count( $banfilters['email'] ) )
- {
- foreach ( $banfilters['email'] as $email )
- {
- $email = str_replace( '\*', '.*' , preg_quote($email, "/") );
-
- if ( preg_match( "/^{$email}$/i", $_emailOne ) )
- {
- return array( 0 => $this->lang->words['email_is_taken'] );
- }
- }
- }
-
- //-----------------------------------------
- // Anti bot flood...
- //-----------------------------------------
-
- if ( $this->settings['bot_antispam'] )
- {
- if ( $this->registry->getClass('class_captcha')->validate() !== TRUE )
- {
- return array( 0 => $this->lang->words['captcha_email_invalid'] );
- }
- }
-
- //-----------------------------------------
- // Load handler...
- //-----------------------------------------
-
- require_once( IPS_ROOT_PATH.'sources/handlers/han_login.php' );
- $this->han_login = new han_login( $this->registry );
- $this->han_login->init();
-
- if ( $this->han_login->emailExistsCheck( $_emailOne ) !== FALSE )
- {
- return array( 0 => $this->lang->words['email_is_taken'] );
- }
-
- $this->han_login->changeEmail( $this->memberData['email'], $_emailOne );
-
- if ( $this->han_login->return_code AND $this->han_login->return_code != 'METHOD_NOT_DEFINED' AND $this->han_login->return_code != 'SUCCESS' )
- {
- return array( 0 => $this->lang->words['email_is_taken'] );
- }
-
- //-----------------------------------------
- // Require new validation? NON ADMINS ONLY
- //-----------------------------------------
-
- if ( $this->settings['reg_auth_type'] AND !$this->memberData['g_access_cp'] )
- {
- $validate_key = md5( IPSLib::makePassword() . time() );
-
- //-----------------------------------------
- // Update the new email, but enter a validation key
- // and put the member in "awaiting authorisation"
- // and send an email..
- //-----------------------------------------
-
- $db_str = array(
- 'vid' => $validate_key,
- 'member_id' => $this->memberData['member_id'],
- 'temp_group' => $this->settings['auth_group'],
- 'entry_date' => time(),
- 'coppa_user' => 0,
- 'email_chg' => 1,
- 'ip_address' => $this->member->ip_address,
- 'prev_email' => $this->memberData['email'],
- );
-
- if ( $this->memberData['member_group_id'] != $this->settings['auth_group'] )
- {
- $db_str['real_group'] = $this->memberData['member_group_id'];
- }
-
- $this->DB->insert( 'validating', $db_str );
-
- IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'member_group_id' => $this->settings['auth_group'],
- 'email' => $_emailOne ) ) );
-
- IPSLib::runMemberSync( 'onEmailChange', $this->memberData['member_id'], mb_strtolower( $_emailOne ) );
-
- //-----------------------------------------
- // Update their session with the new member group
- //-----------------------------------------
-
- if ( $this->member->session_id )
- {
- $this->member->sessionClass()->convertMemberToGuest();
- }
-
- //-----------------------------------------
- // Kill the cookies to stop auto log in
- //-----------------------------------------
-
- IPSCookie::set( 'pass_hash' , '-1', 0 );
- IPSCookie::set( 'member_id' , '-1', 0 );
- IPSCookie::set( 'session_id' , '-1', 0 );
-
- //-----------------------------------------
- // Dispatch the mail, and return to the activate form.
- //-----------------------------------------
-
- IPSText::getTextClass( 'email' )->getTemplate("newemail");
-
- IPSText::getTextClass( 'email' )->buildMessage( array(
- 'NAME' => $this->memberData['members_display_name'],
- 'THE_LINK' => $this->settings['base_url']."app=core&module=global§ion=register&do=auto_validate&type=newemail&uid=".$this->memberData['member_id']."&aid=".$validate_key,
- 'ID' => $this->memberData['member_id'],
- 'MAN_LINK' => $this->settings['base_url']."app=core&module=global§ion=register&do=07",
- 'CODE' => $validate_key,
- ) );
-
- IPSText::getTextClass( 'email' )->subject = $this->lang->words['lp_subject'].' '.$this->settings['board_name'];
- IPSText::getTextClass( 'email' )->to = $_emailOne;
-
- IPSText::getTextClass( 'email' )->sendMail();
-
- $this->registry->getClass('output')->redirectScreen( $this->lang->words['ce_redirect'], $this->settings['base_url'] . 'app=core&module=global§ion=register&do=07' );
- }
- else
- {
- //-----------------------------------------
- // No authorisation needed, change email addy and return
- //-----------------------------------------
-
- IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'email' => $_emailOne ) ) );
-
- IPSLib::runMemberSync( 'onEmailChange', $this->memberData['member_id'], mb_strtolower( $_emailOne ) );
-
- //-----------------------------------------
- // Add to OK message
- //-----------------------------------------
-
- $this->ok_message = $this->lang->words['ok_email_changed'];
-
- return TRUE;
- }
- }
-
- /**
- * UserCP Save Form: Settings
- *
- * @access public
- * @param array Array of member / core_sys_login information (if we're editing)
- * @return mixed Array of errors / boolean true
- */
- public function saveFormSettings( $member=array() )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $timeZone = IPSText::alphanumericalClean( $this->request['timeZone'], '+.' );
- $dst_correct = intval( $this->request['dst_correct'] );
-
- //-----------------------------------------
- // RTE
- //-----------------------------------------
-
- if ( ! $this->settings['posting_allow_rte'] )
- {
- $this->request[ 'editorChoice'] = 0 ;
- }
-
- //-----------------------------------------
- // PM Settings: 2 means admin says no.
- //-----------------------------------------
-
- if ( $this->memberData[ 'members_disable_pm' ] == 2 )
- {
- $this->member->setProperty( 'members_disable_pm', 2 );
- }
- else
- {
- $this->member->setProperty( 'members_disable_pm', intval( $this->request[ 'disableMessenger' ] ) );
- }
-
- //-----------------------------------------
- // Only one account per identity url
- //-----------------------------------------
-
- if( $this->request['identity_url'] )
- {
- $account = $this->DB->buildAndFetch( array( 'select' => 'member_id', 'from' => 'members', 'where' => "identity_url='" . trim($this->request['identity_url']) . "' AND member_id<>" . $this->memberData['member_id'] ) );
-
- if( $account['member_id'] )
- {
- return array( 0 => $this->lang->words['identity_url_assoc'] );
- }
-
- //-----------------------------------------
- // Need to clean up identity URL a little
- //-----------------------------------------
-
- $identityUrl = trim($this->request['identity_url']);
- $identityUrl = rtrim( $identityUrl, "/" );
-
- if( !strpos( $identityUrl, 'http://' ) === 0 AND !strpos( $identityUrl, 'https://' ) === 0 )
- {
- $identityUrl = 'http://' . $identityUrl;
- }
- }
-
- /* Figure out BW options */
- $toSave = IPSBWOptions::thaw( $this->memberData['members_bitoptions'], 'members' );
-
- foreach( array( 'bw_vnc_type', 'bw_forum_result_type' ) as $field )
- {
- $toSave[ $field ] = intval( $this->request[ $field ] );
- }
-
- IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'hide_email' => intval( $this->request['hide_email'] ),
- 'email_pm' => intval( $this->request['pm_reminder'] ),
- 'allow_admin_mails' => intval( $this->request['admin_send'] ),
- 'time_offset' => $timeZone,
- 'dst_in_use' => ( $this->request['dstOption'] AND intval($this->request['dstCheck']) == 0 ) ? intval($this->request['dstOption']) : 0,
- 'members_auto_dst' => intval($this->request['dstCheck']),
- 'members_disable_pm' => intval($this->memberData['members_disable_pm']),
- 'members_editor_choice' => $this->request['editorChoice'] ? 'rte' : 'std',
- 'member_uploader' => $this->request['member_uploader'] ? 'flash' : 'default',
- 'view_pop' => intval($this->request['showPMPopUp']),
- 'identity_url' => isset($identityUrl) ? $identityUrl : $this->memberData['identity_url'],
- 'members_bitoptions' => IPSBWOptions::freeze( $toSave, 'members' ) ) ) );
-
- return TRUE;
- }
-
- /**
- * Password check
- *
- * @access private
- * @param string Plain Text Password
- * @return boolean Password matched or not
- */
- private function _checkPassword( $password_check )
- {
- //-----------------------------------------
- // Ok, check password first
- //-----------------------------------------
-
- require_once( IPS_ROOT_PATH.'sources/handlers/han_login.php' );
- $this->han_login = new han_login( $this->registry );
- $this->han_login->init();
-
- //-----------------------------------------
- // Is this a username or email address?
- //-----------------------------------------
-
- $this->han_login->loginPasswordCheck( $this->memberData['name'], $this->memberData['email'], $password_check );
-
- if ( $this->han_login->return_code == 'SUCCESS' )
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Core user control panel plugin
+ * Last Updated: $Date: 2010-10-25 06:54:59 -0400 (Mon, 25 Oct 2010) $
+ *
+ *
+ * @author $Author: mmecham $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 20th February 2002
+ * @version $Rev: 7029 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class usercpForms_core extends public_core_usercp_manualResolver implements interface_usercp
+{
+ /**
+ * Tab name
+ * This can be left blank and the application title will
+ * be used
+ *
+ * @var string
+ */
+ public $tab_name = "Настройки";
+
+ /**
+ * OK Message
+ * This is an optional message to return back to the framework
+ * to replace the standard 'Settings saved' message
+ *
+ * @var string
+ */
+ public $ok_message = '';
+
+ /**
+ * Hide 'save' button and form elements
+ * Useful if you have custom output that doesn't
+ * require it
+ *
+ * @var bool
+ */
+ public $hide_form_and_save_button = false;
+
+ /**
+ * If you wish to allow uploads, set a value for this
+ *
+ * @var integer
+ */
+ public $uploadFormMax = 0;
+
+ /**
+ * Flag to indicate that the user is a facebook logged in user doozer
+ *
+ * @var boolean
+ */
+ protected $_isFBUser = false;
+
+ /**
+ * Initiate this module
+ *
+ * @return void
+ */
+ public function init( )
+ {
+ $this->tab_name = ipsRegistry::getClass('class_localization')->words['tab__core'];
+
+ /* Facebook? */
+ if ( IPSLib::fbc_enabled() === TRUE AND $this->memberData['fb_uid'] )
+ {
+ $this->_isFBUser = true;
+ }
+ }
+
+ /**
+ * Return links for this tab
+ * You may return an empty array or FALSE to not have
+ * any links show in the tab.
+ *
+ * The links must have 'area=xxxxx'. The rest of the URL
+ * is added automatically.
+ * 'area' can only be a-z A-Z 0-9 - _
+ *
+ * @author Matt Mecham
+ * @return array Links
+ */
+ public function getLinks()
+ {
+ ipsRegistry::instance()->getClass('class_localization')->loadLanguageFile( array( 'public_usercp' ), 'core' );
+
+ $array = array();
+
+ $array[] = array( 'url' => 'area=settings',
+ 'title' => ipsRegistry::instance()->getClass('class_localization')->words['ucp_general_settings'],
+ 'active' => $this->request['tab'] == 'core' && $this->request['area'] == 'settings' ? 1 : 0,
+ 'area' => 'settings'
+ );
+
+ $array[] = array( 'url' => 'area=email',
+ 'title' => ipsRegistry::instance()->getClass('class_localization')->words['ucp_change_email'],
+ 'active' => $this->request['tab'] == 'core' && $this->request['area'] == 'email' ? 1 : 0,
+ 'area' => 'email'
+ );
+
+ $array[] = array( 'url' => 'area=password',
+ 'title' => ipsRegistry::instance()->getClass('class_localization')->words['ucp_change_password'],
+ 'active' => $this->request['tab'] == 'core' && $this->request['area'] == 'password' ? 1 : 0,
+ 'area' => 'password'
+ );
+
+ if ( $this->settings['auth_allow_dnames'] == 1 AND $this->memberData['g_dname_changes'] > 0 )
+ {
+ $array[] = array( 'url' => 'area=displayname',
+ 'title' => ipsRegistry::instance()->getClass('class_localization')->words['ucp_change_name'],
+ 'active' => $this->request['tab'] == 'core' && $this->request['area'] == 'displayname' ? 1 : 0,
+ 'area' => 'displayname'
+ );
+ }
+
+ $array[] = array( 'url' => 'area=notes',
+ 'title' => ipsRegistry::instance()->getClass('class_localization')->words['m_notes'],
+ 'active' => $this->request['tab'] == 'core' && $this->request['area'] == 'notes' ? 1 : 0,
+ 'area' => 'notes'
+ );
+
+ if ( $this->memberData['g_attach_max'] != -1 )
+ {
+ $array[] = array(
+ 'url' => 'area=attachments',
+ 'title' => ipsRegistry::instance()->getClass('class_localization')->words['m_attach'],
+ 'active' => $this->request['tab'] == 'core' && $this->request['area'] == 'attachments' ? 1 : 0,
+ 'area' => 'attachments'
+ );
+ }
+
+ if( IPSLib::haveAppsWithLike() )
+ {
+ $array[] = array(
+ 'url' => 'area=likes',
+ 'title' => ipsRegistry::instance()->getClass('class_localization')->words['m_likesystem'],
+ 'active' => $this->request['tab'] == 'core' && $this->request['area'] == 'likes' ? 1 : 0,
+ 'area' => 'likes'
+ );
+ }
+
+ $array[] = array( 'url' => 'area=notifications',
+ 'title' => ipsRegistry::instance()->getClass('class_localization')->words['m_notifications'],
+ 'active' => $this->request['tab'] == 'core' && $this->request['area'] == 'notifications' ? 1 : 0,
+ 'area' => 'notifications'
+ );
+
+ $array[] = array( 'url' => 'area=notificationlog',
+ 'title' => ipsRegistry::instance()->getClass('class_localization')->words['m_arch_notify'],
+ 'active' => ( in_array( $this->request['area'], array( 'notificationlog', 'viewNotification', 'removeNotifications' ) ) ) ? 1 : 0,
+ 'area' => 'notificationlog'
+ );
+
+ return $array;
+ }
+
+
+ /**
+ * Run custom event
+ *
+ * If you pass a 'do' in the URL / post form that is not either:
+ * save / save_form or show / show_form then this function is loaded
+ * instead. You can return a HTML chunk to be used in the UserCP (the
+ * tabs and footer are auto loaded) or redirect to a link.
+ *
+ * If you are returning HTML, you can use $this->hide_form_and_save_button = 1;
+ * to remove the form and save button that is automatically placed there.
+ *
+ * @author Matt Mecham
+ * @param string Current area
+ * @return mixed html or void
+ */
+ public function runCustomEvent( $currentArea )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $html = '';
+
+ //-----------------------------------------
+ // What to do?
+ //-----------------------------------------
+
+ switch( $currentArea )
+ {
+ case 'updateAttachments':
+ return $this->customEvent_updateAttachments();
+ break;
+
+ case 'viewNotification':
+ $html = $this->customEvent_viewNotification();
+ break;
+
+ case 'markNotification':
+ return $this->customEvent_markNotification();
+ break;
+
+ case 'removeNotifications':
+ return $this->customEvent_removeNotifications();
+ break;
+
+ case 'moderateLikes':
+ return $this->customEvent_moderateLikeList();
+ break;
+ }
+
+ //-----------------------------------------
+ // Turn off save button
+ //-----------------------------------------
+
+ $this->hide_form_and_save_button = 1;
+
+ //-----------------------------------------
+ // Return
+ //-----------------------------------------
+
+ return $html;
+ }
+
+ /**
+ * Moderate your list of liked content
+ *
+ * @author bfarber
+ * @return string HTML to display
+ */
+ public function customEvent_moderateLikeList()
+ {
+ //-----------------------------------------
+ // Get the likes we selected
+ //-----------------------------------------
+
+ $_likes = array();
+
+ if( is_array($this->request['likes']) AND count($this->request['likes']) )
+ {
+ foreach( $this->request['likes'] as $_like )
+ {
+ $_thisLike = explode( '-', $_like );
+ $_likes[] = array(
+ 'app' => $_thisLike[0],
+ 'area' => $_thisLike[1],
+ 'id' => $_thisLike[2],
+ );
+ }
+ }
+
+ //-----------------------------------------
+ // Got any?
+ //-----------------------------------------
+
+ if( !count($_likes) OR !is_array($_likes) )
+ {
+ return $this->showLikeList( $this->lang->words['no_likes_for_del'] );
+ }
+
+ //-----------------------------------------
+ // Get like helper class
+ //-----------------------------------------
+
+ $bootstraps = array();
+
+ require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );
+
+ //-----------------------------------------
+ // Loop over and moderate
+ //-----------------------------------------
+
+ foreach( $_likes as $_like )
+ {
+ $_bootstrap = classes_like::bootstrap( $_like['app'], $_like['area'] );
+ $_likeKey = classes_like_registry::getKey( $_like['id'], $this->memberData['member_id'] );
+ $_frequencies = $_bootstrap->allowedFrequencies();
+
+ //-----------------------------------------
+ // What action to take?
+ //-----------------------------------------
+
+ switch( $this->request['modaction'] )
+ {
+ case 'delete':
+ $_bootstrap->remove( $_like['id'], $this->memberData['member_id'] );
+ break;
+
+ case 'change-donotify':
+ $this->DB->update( 'core_like', array( 'like_notify_do' => 1, 'like_notify_freq' => 'immediate' ), "like_id='" . addslashes($_likeKey) . "'" );
+ break;
+
+ case 'change-donotnotify':
+ $this->DB->update( 'core_like', array( 'like_notify_do' => 0 ), "like_id='" . addslashes($_likeKey) . "'" );
+ break;
+
+ case 'change-immediate':
+ if( in_array( 'immediate', $_frequencies ) )
+ {
+ $this->DB->update( 'core_like', array( 'like_notify_do' => 1, 'like_notify_freq' => 'immediate' ), "like_id='" . addslashes($_likeKey) . "'" );
+ }
+ break;
+
+ case 'change-offline':
+ if( in_array( 'offline', $_frequencies ) )
+ {
+ $this->DB->update( 'core_like', array( 'like_notify_do' => 1, 'like_notify_freq' => 'offline' ), "like_id='" . addslashes($_likeKey) . "'" );
+ }
+ break;
+
+ case 'change-daily':
+ if( in_array( 'daily', $_frequencies ) )
+ {
+ $this->DB->update( 'core_like', array( 'like_notify_do' => 1, 'like_notify_freq' => 'daily' ), "like_id='" . addslashes($_likeKey) . "'" );
+ }
+ break;
+
+ case 'change-weekly':
+ if( in_array( 'weekly', $_frequencies ) )
+ {
+ $this->DB->update( 'core_like', array( 'like_notify_do' => 1, 'like_notify_freq' => 'weekly' ), "like_id='" . addslashes($_likeKey) . "'" );
+ }
+ break;
+
+ case 'change-anon':
+ $this->DB->update( 'core_like', array( 'like_is_anon' => 1 ), "like_id='" . addslashes($_likeKey) . "'" );
+ break;
+
+ case 'change-noanon':
+ $this->DB->update( 'core_like', array( 'like_is_anon' => 0 ), "like_id='" . addslashes($_likeKey) . "'" );
+ break;
+ }
+ }
+
+ $this->registry->getClass('output')->silentRedirect( $this->settings['base_url']."app=core&module=usercp&tab=core&area=likes&confirm=1" );
+ }
+
+ /**
+ * Delete attachments
+ *
+ * @author Matt Mecham
+ * @return string Processed HTML
+ */
+ public function customEvent_updateAttachments()
+ {
+ //-----------------------------------------
+ // Get the ID's to delete
+ //-----------------------------------------
+
+ $finalIDs = array();
+
+ //-----------------------------------------
+ // Grab post IDs
+ //-----------------------------------------
+
+ if ( is_array( $_POST['attach'] ) and count( $_POST['attach'] ) )
+ {
+ foreach( $_POST['attach'] as $id => $value )
+ {
+ $finalIDs[ $id ] = intval( $id );
+ }
+ }
+
+ if ( count($finalIDs) > 0 )
+ {
+ $this->DB->build( array( 'select' => 'a.*',
+ 'from' => array( 'attachments' => 'a' ),
+ 'where' => "a.attach_id IN (" . implode( ",", $finalIDs ) .") AND a.attach_rel_module IN( 'post', 'msg' ) AND attach_member_id=" . $this->memberData['member_id'],
+ 'add_join' => array(
+ array( 'select' => 'p.topic_id, p.pid',
+ 'from' => array( 'posts' => 'p' ),
+ 'where' => "p.pid=a.attach_rel_id AND a.attach_rel_module='post'",
+ 'type' => 'left'
+ ),
+ array( 'select' => 'mt.msg_id, mt.msg_topic_id',
+ 'from' => array( 'message_posts' => 'mt' ),
+ 'where' => "mt.msg_id=a.attach_rel_id AND a.attach_rel_module='msg'",
+ 'type' => 'left'
+ ),
+ )
+ ) );
+
+ $o = $this->DB->execute();
+
+ while ( $killmeh = $this->DB->fetch( $o ) )
+ {
+ if ( $killmeh['attach_location'] )
+ {
+ @unlink( $this->settings['upload_dir']."/".$killmeh['attach_location'] );
+ }
+ if ( $killmeh['attach_thumb_location'] )
+ {
+ @unlink( $this->settings['upload_dir']."/".$killmeh['attach_thumb_location'] );
+ }
+
+ if ( $killmeh['topic_id'] )
+ {
+ $this->DB->update( 'topics', 'topic_hasattach=topic_hasattach-1', 'tid='.$killmeh['topic_id'], true, true );
+ }
+ else if( $killmeh['msg_id'] )
+ {
+ $this->DB->update( 'message_topics', 'mt_hasattach=mt_hasattach-1', 'mt_id='.$killmeh['msg_topic_id'], true, true );
+ }
+ }
+
+ $this->DB->delete( 'attachments', 'attach_id IN ('.implode(",",$finalIDs).') and attach_member_id='.$this->memberData['member_id'] );
+ }
+
+ $this->registry->getClass('output')->silentRedirect( $this->settings['base_url']."app=core&module=usercp&tab=core&area=attachments&do=show" );
+ }
+
+ /**
+ * UserCP handle our notifications
+ *
+ * @return boolean Successful
+ */
+ public function customEvent_removeNotifications()
+ {
+ //-----------------------------------------
+ // Check form hash
+ //-----------------------------------------
+
+ $this->request['secure_key'] = $this->request['secure_key'] ? $this->request['secure_key'] : $this->request['md5check'];
+
+ if( $this->request['secure_key'] != $this->member->form_hash )
+ {
+ $this->registry->output->showError( 'usercp_forums_bad_key', 1021523 );
+ }
+
+ //-----------------------------------------
+ // Notifications library
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
+ $notifyLibrary = new $classToLoad( $this->registry );
+ $notifyLibrary->setMember( $this->memberData );
+
+ //-----------------------------------------
+ // Delete the notifications
+ //-----------------------------------------
+
+ $_toDelete = IPSLib::cleanIntArray( $this->request['notifications'] );
+
+ if( !count($_toDelete) )
+ {
+ return $this->showInlineNotifications( $this->lang->words['no_notify_del'] );
+ }
+
+ $this->DB->delete( 'inline_notifications', "notify_id IN(" . implode( ',', $_toDelete ) . ") AND notify_to_id=" . $this->memberData['member_id'] );
+
+ //-----------------------------------------
+ // If member has 'unread' count, rebuild count
+ //-----------------------------------------
+
+ if( $this->memberData['notification_cnt'] )
+ {
+ $notifyLibrary->rebuildUnreadCount();
+ }
+
+ //-----------------------------------------
+ // Redirect
+ //-----------------------------------------
+
+ $this->registry->getClass('output')->silentRedirect( $this->settings['base_url']."app=core&module=usercp&tab=core&area=notificationlog&confirm=1" );
+ }
+
+ /**
+ * Mark a notification
+ *
+ * @return string HTML
+ */
+ public function customEvent_markNotification()
+ {
+ //-----------------------------------------
+ // Notifications library
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
+ $notifyLibrary = new $classToLoad( $this->registry );
+ $notifyLibrary->setMember( $this->memberData );
+
+ //-----------------------------------------
+ // Get notification
+ //-----------------------------------------
+
+ /* Marking them all as read? */
+ if ( $this->request['mark'] == 'all' )
+ {
+ $this->DB->update( 'inline_notifications', array( 'notify_read' => time() ), 'notify_to_id=' . $this->memberData['member_id'] );
+ }
+ else
+ {
+ $id = intval($this->request['mark']);
+ $notification = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'inline_notifications', 'where' => 'notify_id=' . $id ) );
+
+ //-----------------------------------------
+ // Error checking
+ //-----------------------------------------
+
+ if( !$notification['notify_id'] )
+ {
+ if( $this->request['ajax'] )
+ {
+ print 'ok';
+ exit;
+ }
+ else
+ {
+ $this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . "app=core&module=usercp&tab=notificationlog" );
+ }
+ }
+
+ if( $notification['notify_to_id'] != $this->memberData['member_id'] )
+ {
+ if( $this->request['ajax'] )
+ {
+ print 'ok';
+ exit;
+ }
+ else
+ {
+ $this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . "app=core&module=usercp&tab=notificationlog" );
+ }
+ }
+
+ //-----------------------------------------
+ // Update read timestamp
+ //-----------------------------------------
+
+ $this->DB->update( 'inline_notifications', array( 'notify_read' => time() ), 'notify_id=' . $id );
+ }
+
+ //-----------------------------------------
+ // If member has 'unread' count, rebuild count
+ //-----------------------------------------
+
+ if( $this->memberData['notification_cnt'] )
+ {
+ $notifyLibrary->rebuildUnreadCount();
+ }
+
+ if( $this->request['ajax'] )
+ {
+ print 'ok';
+ exit;
+ }
+ else
+ {
+ $_returnTo = $_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : $this->settings['base_url'];
+
+ $this->registry->output->silentRedirect( $_returnTo );
+ }
+ }
+
+ /**
+ * View a notification
+ *
+ * @return string HTML
+ */
+ public function customEvent_viewNotification()
+ {
+ //-----------------------------------------
+ // Notifications library
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
+ $notifyLibrary = new $classToLoad( $this->registry );
+ $notifyLibrary->setMember( $this->memberData );
+
+ //-----------------------------------------
+ // Get notification
+ //-----------------------------------------
+
+ $id = intval($this->request['view']);
+ $notification = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'inline_notifications', 'where' => 'notify_id=' . $id ) );
+
+ //-----------------------------------------
+ // Error checking
+ //-----------------------------------------
+
+ if( !$notification['notify_id'] )
+ {
+ $this->registry->output->showError( 'bad_notify_id', 10191 );
+ }
+
+ if( $notification['notify_to_id'] != $this->memberData['member_id'] )
+ {
+ $this->registry->output->showError( 'bad_notify_id', 10192 );
+ }
+
+ //-----------------------------------------
+ // Update read timestamp
+ //-----------------------------------------
+
+ $this->DB->update( 'inline_notifications', array( 'notify_read' => time() ), 'notify_id=' . $id );
+
+ //-----------------------------------------
+ // If member has 'unread' count, rebuild count
+ //-----------------------------------------
+
+ if( $this->memberData['notification_cnt'] )
+ {
+ $notifyLibrary->rebuildUnreadCount();
+ }
+
+ //-----------------------------------------
+ // Parse for display
+ //-----------------------------------------
+
+ /* As the email template parser makes an attempt to reparse 'safe' HTML, we need to make it safe here */
+ $notification['notify_text'] = IPSText::htmlspecialchars( $notification['notify_text'] );
+
+ IPSText::getTextClass('bbcode')->parse_smilies = 1;
+ IPSText::getTextClass('bbcode')->parse_nl2br = 1;
+ IPSText::getTextClass('bbcode')->parse_html = 0;
+ IPSText::getTextClass('bbcode')->parse_bbcode = 1;
+ IPSText::getTextClass('bbcode')->parsing_section = 'global';
+
+ $notification['notify_text'] = IPSText::getTextClass('bbcode')->preDisplayParse( nl2br( $notification['notify_text'] ) );
+
+ //-----------------------------------------
+ // Show notification
+ //-----------------------------------------
+
+ $this->_nav[] = array( $this->lang->words['m_arch_notify'], 'app=core&module=usercp&tab=core&area=notificationlog' );
+ return $this->registry->getClass('output')->getTemplate('ucp')->showNotification( $notification );
+ }
+
+ /**
+ * UserCP Form Show
+ *
+ * @author Matt Mecham
+ * @param string Current area as defined by 'get_links'
+ * @param array Array of errors
+ * @return string Processed HTML
+ */
+ public function showForm( $current_area, $errors=array() )
+ {
+ //-----------------------------------------
+ // Where to go, what to see?
+ //-----------------------------------------
+
+ switch( $current_area )
+ {
+ default:
+ case 'settings':
+ return $this->showFormSettings();
+ break;
+ case 'email':
+ return $this->showFormEmail();
+ break;
+ case 'password':
+ return $this->showFormPassword();
+ break;
+ case 'displayname':
+ return $this->showFormDisplayname();
+ break;
+ case 'attachments':
+ return $this->showFormAttachments();
+ break;
+ case 'notes':
+ return $this->showFormNotes();
+ break;
+ case 'notifications':
+ return $this->showFormNotifications();
+ break;
+ case 'notificationlog':
+ return $this->showInlineNotifications();
+ break;
+ case 'likes':
+ return $this->showLikeList();
+ break;
+ }
+ }
+
+ /**
+ * Show the logged inline notifications
+ *
+ * @author Brandon Farber
+ * @param string Error message
+ * @return string Processed HTML
+ */
+ public function showLikeList( $error='' )
+ {
+ /* Init */
+ $start = intval( $this->request['st'] );
+ $perPage = 50;
+
+ //-----------------------------------------
+ // Turn off normal form
+ //-----------------------------------------
+
+ $this->hide_form_and_save_button = 1;
+
+ //-----------------------------------------
+ // Get like helper class
+ //-----------------------------------------
+
+ require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );
+
+ //-----------------------------------------
+ // Get list of items user likes
+ //-----------------------------------------
+
+ $_likes = array();
+
+ $count = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as er',
+ 'from' => 'core_like',
+ 'where' => 'like_member_id=' . $this->memberData['member_id'] ) );
+
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'core_like',
+ 'where' => 'like_member_id=' . $this->memberData['member_id'],
+ 'limit' => array( $start, $perPage ),
+ 'order' => 'like_added DESC' ) );
+ $outer = $this->DB->execute();
+
+ while( $r = $this->DB->fetch($outer) )
+ {
+ $_likes[ $r['like_id'] ] = $r;
+ }
+
+ /* Process */
+ $_likes = classes_like_meta::get( $_likes );
+
+ $pages = $this->registry->getClass('output')->generatePagination( array( 'totalItems' => $count['er'],
+ 'itemsPerPage' => $perPage,
+ 'currentStartValue' => $start,
+ 'baseUrl' => "app=core&module=usercp&tab=core&area=likes" ) );
+
+ //-----------------------------------------
+ // Send to template
+ //-----------------------------------------
+
+ return $this->registry->getClass('output')->getTemplate('ucp')->likesList( $_likes, $error, $pages );
+ }
+
+ /**
+ * Show the logged inline notifications
+ *
+ * @author Brandon Farber
+ * @param string Error message
+ * @return string Processed HTML
+ */
+ public function showInlineNotifications( $error='' )
+ {
+ /* Init */
+ $start = intval( $this->request['st'] );
+ $perPage = 50;
+
+ //-----------------------------------------
+ // Get class
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
+ $notifyLibrary = new $classToLoad( $this->registry );
+
+ //-----------------------------------------
+ // Turn off normal form
+ //-----------------------------------------
+
+ $this->hide_form_and_save_button = 1;
+
+ //-----------------------------------------
+ // Get notifications
+ //-----------------------------------------
+
+ $_notifications = array();
+
+ $count = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as er',
+ 'from' => 'inline_notifications',
+ 'where' => 'notify_to_id=' . $this->memberData['member_id'] ) );
+
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'inline_notifications',
+ 'where' => 'notify_to_id=' . $this->memberData['member_id'],
+ 'limit' => array( $start, $perPage ),
+ 'order' => 'notify_sent DESC' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $r['notify_icon'] = $notifyLibrary->getNotificationIcon( $r['notify_type_key'] );
+
+ $_notifications[] = $r;
+ }
+
+ $pages = $this->registry->getClass('output')->generatePagination( array( 'totalItems' => $count['er'],
+ 'itemsPerPage' => $perPage,
+ 'currentStartValue' => $start,
+ 'baseUrl' => "app=core&module=usercp&tab=core&area=notificationlog" ) );
+
+ //-----------------------------------------
+ // Send to template
+ //-----------------------------------------
+
+ return $this->registry->getClass('output')->getTemplate('ucp')->notificationsLog( $_notifications, $error, $pages );
+ }
+
+ /**
+ * Show notification configuration form
+ *
+ * @author Brandon Farber
+ * @return string Processed HTML
+ */
+ public function showFormNotifications()
+ {
+ //-----------------------------------------
+ // Notifications library
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
+ $notifyLibrary = new $classToLoad( $this->registry );
+ $notifyLibrary->setMember( $this->memberData );
+
+ //-----------------------------------------
+ // Show the form
+ //-----------------------------------------
+
+ $_basicOptions = array( array( 'email', $this->lang->words['notopt__email'] ), array( 'pm', $this->lang->words['notopt__pm'] ), array( 'inline', $this->lang->words['notopt__inline'] ), array( 'mobile', $this->lang->words['notopt__mobile'] ) );
+ $_configOptions = $notifyLibrary->getNotificationData( TRUE );
+ $_notifyConfig = $notifyLibrary->getMemberNotificationConfig();
+ $_defaultConfig = $notifyLibrary->getDefaultNotificationConfig();
+ $_formOptions = array();
+
+ foreach( $_configOptions as $option )
+ {
+ $_thisConfig = $_notifyConfig[ $option['key'] ];
+
+ //-----------------------------------------
+ // Determine available options
+ //-----------------------------------------
+
+ $_available = array();
+
+ foreach( $_basicOptions as $_bo ) // ewwww :P
+ {
+ if( !is_array($_defaultConfig[ $option['key'] ]['disabled']) OR !in_array( $_bo[0], $_defaultConfig[ $option['key'] ]['disabled'] ) )
+ {
+ $_available[] = $_bo;
+ }
+ }
+
+ //-----------------------------------------
+ // If none available, at least give inline
+ //-----------------------------------------
+
+ if( !count($_available) )
+ {
+ $_available[] = array( 'inline', $this->lang->words['notify__inline'] );
+ }
+
+ //-----------------------------------------
+ // Start setting data to pass to form
+ //-----------------------------------------
+
+ $_formOptions[ $option['key'] ] = array();
+ $_formOptions[ $option['key'] ]['key'] = $option['key'];
+
+ //-----------------------------------------
+ // Rikki asked for this...
+ //-----------------------------------------
+
+ foreach( $_available as $_availOption )
+ {
+ $_formOptions[ $option['key'] ]['options'][ $_availOption[0] ] = $_availOption;
+ }
+
+ //$_formOptions[ $option['key'] ]['options'] = $_available;
+
+ $_formOptions[ $option['key'] ]['defaults'] = $_thisConfig['selected'];
+ $_formOptions[ $option['key'] ]['disabled'] = 0;
+
+ //-----------------------------------------
+ // Don't allow member to configure
+ // Still show, but disable on form
+ //-----------------------------------------
+
+ if( $_defaultConfig[ $option['key'] ]['disable_override'] )
+ {
+ $_formOptions[ $option['key'] ]['disabled'] = 1;
+ $_formOptions[ $option['key'] ]['defaults'] = $_defaultConfig[ $option['key'] ]['selected'];
+ }
+ }
+
+ //-----------------------------------------
+ // Other settings
+ //-----------------------------------------
+
+ $_emailData = array();
+
+ //-----------------------------------------
+ // Email settings...
+ //-----------------------------------------
+
+ foreach( array('email_full', 'auto_track') as $k )
+ {
+ if ( $this->memberData[ $k ] )
+ {
+ $_emailData[ $k ] = 'checked="checked"';
+ }
+ else
+ {
+ $_emailData[ $k ] = '';
+ }
+ }
+
+ foreach( array( 'none', 'immediate', 'delayed', 'daily', 'weekly' ) as $_opt )
+ {
+ $_emailData['trackOption'][ $_opt ] = ( $this->memberData['auto_track'] == $_opt ) ? 'selected="selected"' : '';
+ }
+
+ return $this->registry->getClass('output')->getTemplate('ucp')->notificationsForm( $_formOptions, $_emailData );
+ }
+
+ /**
+ * Show the attachments form
+ *
+ * @author Matt Mecham
+ * @return string Processed HTML
+ */
+ public function showFormAttachments()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $info = array();
+ $start = intval( $this->request['st'] );
+ $perpage = 15;
+ $sort_key = "";
+ $attachments = array();
+
+ $this->hide_form_and_save_button = 1;
+
+ //-----------------------------------------
+ // Sort it
+ //-----------------------------------------
+
+ switch ( $this->request['sort'] )
+ {
+ case 'date':
+ $sort_key = 'a.attach_date ASC';
+ $info['date_order'] = 'rdate';
+ $info['size_order'] = 'size';
+ break;
+ case 'rdate':
+ $sort_key = 'a.attach_date DESC';
+ $info['date_order'] = 'date';
+ $info['size_order'] = 'size';
+ break;
+ case 'size':
+ $sort_key = 'a.attach_filesize DESC';
+ $info['date_order'] = 'date';
+ $info['size_order'] = 'rsize';
+ break;
+ case 'rsize':
+ $sort_key = 'a.attach_filesize ASC';
+ $info['date_order'] = 'date';
+ $info['size_order'] = 'size';
+ break;
+ default:
+ $sort_key = 'a.attach_date DESC';
+ $info['date_order'] = 'date';
+ $info['size_order'] = 'size';
+ break;
+ }
+
+ //-----------------------------------------
+ // Get some stats...
+ //-----------------------------------------
+
+ $maxspace = intval($this->memberData['g_attach_max']);
+
+ if ( $this->memberData['g_attach_max'] == -1 )
+ {
+ $this->registry->getClass('output')->showError( 'no_permission_to_attach', 1010 );
+ }
+
+ //-----------------------------------------
+ // Limit by forums
+ //-----------------------------------------
+
+ $stats = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count, sum(attach_filesize) as sum',
+ 'from' => 'attachments',
+ 'where' => 'attach_member_id=' . $this->memberData['member_id'] . " AND attach_rel_module IN( 'post', 'msg' )" ) );
+
+ if ( $maxspace > 0 )
+ {
+ //-----------------------------------------
+ // Figure out percentage used
+ //-----------------------------------------
+
+ $info['has_limit'] = 1;
+ $info['full_percent'] = $stats['sum'] ? sprintf( "%.0f", ( ( $stats['sum'] / ($maxspace * 1024) ) * 100) ) : 0;
+
+ if ( $info['full_percent'] > 100 )
+ {
+ $info['full_percent'] = 100;
+ }
+ else if ( $info['full_percent'] < 1 AND $stats['count'] > 0 )
+ {
+ $info['full_percent'] = 1;
+ }
+
+ $info['attach_space_count'] = sprintf( $this->lang->words['attach_space_count'], intval($stats['count']), intval($info['full_percent']) );
+ $info['attach_space_used'] = sprintf( $this->lang->words['attach_space_used'] , IPSLib::sizeFormat(intval($stats['sum'])), IPSLib::sizeFormat($maxspace * 1024) );
+ }
+ else
+ {
+ $info['has_limit'] = 0;
+ $info['attach_space_used'] = sprintf( $this->lang->words['attach_space_unl'] , IPSLib::sizeFormat(intval($stats['sum'])) );
+ }
+
+ //-----------------------------------------
+ // Pages
+ //-----------------------------------------
+
+ $pages = $this->registry->getClass('output')->generatePagination( array( 'totalItems' => $stats['count'],
+ 'itemsPerPage' => $perpage,
+ 'currentStartValue' => $start,
+ 'baseUrl' => "app=core&module=usercp&tab=core&area=attachments&sort=" . $this->request['sort'] . "",
+ ) );
+
+ //-----------------------------------------
+ // Get attachments...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => 'a.*',
+ 'from' => array( 'attachments' => 'a' ),
+ 'where' => "a.attach_member_id=" . $this->memberData['member_id'] . " AND a.attach_rel_module IN( 'post', 'msg' )",
+ 'order' => $sort_key,
+ 'limit' => array( $start, $perpage ),
+ 'add_join' => array(
+ array( 'select' => 'p.topic_id',
+ 'from' => array( 'posts' => 'p' ),
+ 'where' => 'p.pid=a.attach_rel_id',
+ 'type' => 'left'
+ ),
+ array( 'select' => 't.*',
+ 'from' => array( 'topics' => 't' ),
+ 'where' => 't.tid=p.topic_id',
+ 'type' => 'left'
+ ) ) ) );
+ $outer = $this->DB->execute();
+
+ $this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_topic'), 'forums' );
+
+ $cache = $this->cache->getCache('attachtypes');
+
+ while ( $row = $this->DB->fetch( $outer ) )
+ {
+ if ( IPSMember::checkPermissions('read', $row['forum_id'] ) != TRUE )
+ {
+ $row['title'] = $this->lang->words['attach_topicmoved'];
+ }
+
+ //-----------------------------------------
+ // Full attachment thingy
+ //-----------------------------------------
+
+ if ( $row['attach_rel_module'] == 'post' )
+ {
+ $row['_type'] = 'post';
+ }
+ else if ( $row['attach_rel_module'] == 'msg' )
+ {
+ $row['_type'] = 'msg';
+ $row['title'] = $this->lang->words['attach_inpm'];
+ }
+
+ /* IPB 2.x conversion */
+ $row['image'] = str_replace( 'folder_mime_types', 'mime_types', $cache[ $row['attach_ext'] ]['atype_img'] );
+ $row['short_name'] = IPSText::truncate( $row['attach_file'], 30 );
+ $row['attach_date'] = $this->registry->getClass( 'class_localization')->getDate( $row['attach_date'], 'SHORT' );
+ $row['real_size'] = IPSLib::sizeFormat( $row['attach_filesize'] );
+
+ $attachments[] = $row;
+ }
+
+ return $this->registry->getClass('output')->getTemplate('ucp')->coreAttachments( $info, $pages, $attachments );
+ }
+
+ /**
+ * Show the Password form
+ *
+ * @author Matt Mecham
+ * @return string Processed HTML
+ */
+ public function showFormPassword()
+ {
+ //-----------------------------------------
+ // Do we have another URL for password resets?
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $this->han_login = new $classToLoad( $this->registry );
+ $this->han_login->init();
+ $this->han_login->checkMaintenanceRedirect();
+
+ if( $this->memberData['g_access_cp'] )
+ {
+ $this->hide_form_and_save_button = true;
+ }
+
+ return $this->registry->getClass('output')->getTemplate('ucp')->passwordChangeForm();
+ }
+
+ /**
+ * Show the Email form
+ *
+ * @author Matt Mecham
+ * @param string Returned error message (if any)
+ * @return string Processed HTML
+ */
+ public function showFormEmail( $_message='' )
+ {
+ //-----------------------------------------
+ // Do not allow validating members to change
+ // email when admin validation is on
+ // @see http://community.invisionpower.com/tracker/issue-19964-loophole-in-registration-procedure/
+ //-----------------------------------------
+
+ if( $this->memberData['member_group_id'] == $this->settings['auth_group'] AND in_array( $this->settings['reg_auth_type'], array( 'admin', 'admin_user' ) ) )
+ {
+ $this->registry->output->showError( $this->lang->words['admin_val_no_email_chg'], 10189 );
+ }
+
+ //-----------------------------------------
+ // Do we have another URL for email resets?
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $this->han_login = new $classToLoad( $this->registry );
+ $this->han_login->init();
+ $this->han_login->checkMaintenanceRedirect();
+
+ $txt = $this->lang->words['ce_current'] . $this->memberData['email'];
+
+ if ( $this->settings['reg_auth_type'])
+ {
+ $txt .= $this->lang->words['ce_auth'];
+ }
+
+ if ( $this->settings['bot_antispam_type'] != 'none' )
+ {
+ $captchaHTML = $this->registry->getClass('class_captcha')->getTemplate();
+ }
+
+ $_message = $_message ? $this->lang->words[$_message] : '';
+
+ if( $this->memberData['g_access_cp'] )
+ {
+ $this->hide_form_and_save_button = true;
+ }
+
+ return $this->registry->getClass('output')->getTemplate('ucp')->emailChangeForm( $txt, $_message, $captchaHTML, $this->_isFBUser );
+ }
+
+ /**
+ * Show the display name form
+ *
+ * @author Matt Mecham
+ * @param string Error message (if any)
+ * @return string Processed HTML
+ */
+ public function showFormDisplayname( $error="" )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $form = array();
+
+ //-----------------------------------------
+ // CHECK (please)
+ //-----------------------------------------
+
+ if ( ! $this->settings['auth_allow_dnames'] OR $this->memberData['g_dname_changes'] < 1 OR $this->memberData['g_dname_date'] < 1 )
+ {
+ $this->registry->getClass('output')->showError( 'no_permission_for_display_names', 1011 );
+ }
+
+ $this->request['display_name'] = $this->request['display_name'] ? $this->request['display_name'] : '';
+
+ $this->settings['username_errormsg'] = str_replace( '{chars}', $this->settings['username_characters'], $this->settings['username_errormsg'] );
+
+ //-----------------------------------------
+ // Grab # changes > 24 hours
+ //-----------------------------------------
+
+ $time_check = time() - 86400 * $this->memberData['g_dname_date'];
+
+ if( $time_check < $this->memberData['joined'] )
+ {
+ $time_check = $this->memberData['joined'];
+ }
+
+ $name_count = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count, MIN(dname_date) as min_date', 'from' => 'dnames_change', 'where' => "dname_member_id=" . $this->memberData['member_id'] . " AND dname_date > $time_check" ) );
+
+ $name_count['count'] = intval( $name_count['count'] );
+ $name_count['min_date'] = intval( $name_count['min_date'] ) ? intval( $name_count['min_date'] ) : $time_check;
+
+ //-----------------------------------------
+ // Calculate # left
+ //-----------------------------------------
+
+ /* Check new permissions */
+ $_g = $this->caches['group_cache'][ $this->memberData['member_group_id'] ];
+
+ if ( $_g['g_displayname_unit'] )
+ {
+ if ( $_g['gbw_displayname_unit_type'] )
+ {
+ /* days */
+ if ( $this->memberData['joined'] > ( time() - ( 86400 * $_g['g_displayname_unit'] ) ) )
+ {
+ $this->hide_form_and_save_button = 1;
+ $form['_noPerm'] = sprintf( $this->lang->words['dname_group_restrict_date'], $this->lang->getDate( $this->memberData['joined'] + ( 86400 * $_g['g_displayname_unit'] ), 'long' ) );
+ }
+ }
+ else
+ {
+ /* Posts */
+ if ( $this->memberData['posts'] < $_g['g_displayname_unit'] )
+ {
+ $this->hide_form_and_save_button = 1;
+ $form['_noPerm'] = sprintf( $this->lang->words['dname_group_restrict_posts'], $_g['g_displayname_unit'] - $this->memberData['posts'] );
+ }
+ }
+ }
+
+ if( !$form['_noPerm'] )
+ {
+ $form['_changes_left'] = $this->memberData['g_dname_changes'] - $name_count['count'];
+ $form['_changes_done'] = $name_count['count'];
+
+ # Make sure changes done isn't larger than allowed
+ # This happens when changing via ACP
+
+ if ( $form['_changes_done'] > $this->memberData['g_dname_changes'] )
+ {
+ $form['_changes_done'] = $this->memberData['g_dname_changes'];
+ }
+
+ $form['_first_change'] = $this->registry->getClass( 'class_localization')->getDate( $name_count['min_date'], 'date', 1 );
+ $form['_lang_string'] = sprintf( $this->lang->words['dname_string'],
+ $form['_changes_done'], $this->memberData['g_dname_changes'],
+ $form['_first_change'], $this->memberData['g_dname_changes'],
+ $this->memberData['g_dname_date'] );
+ }
+
+ //-----------------------------------------
+ // Print
+ //-----------------------------------------
+
+ $this->_pageTitle = $this->lang->words['m_dname_change'];
+
+ return $this->registry->getClass('output')->getTemplate('ucp')->displayNameForm( $form, $error, '', $this->_isFBUser );
+ }
+
+ /**
+ * Show the Settings form
+ *
+ * @author Matt Mecham
+ * @return string Processed HTML
+ */
+ public function showFormSettings()
+ {
+ /* Sort the times */
+ $times = array();
+
+ foreach( $this->lang->words as $k => $v )
+ {
+ if( strpos( $k, "time_" ) === 0 )
+ {
+ $k = str_replace( "time_", '', $k );
+
+ if( preg_match( '/^[\-\d\.]+$/', $k ) )
+ {
+ $times[ $k ] = $v;
+ }
+ }
+ }
+
+ ksort( $times );
+ //uksort( $this->lang->words, create_function( '$a, $b', '$a = str_replace( "time_", "", $a ); $b = str_replace( "time_", "", $b ); return $a > $b;' ) );
+
+ /* Show the form */
+ return $this->registry->getClass('output')->getTemplate('ucp')->generalSettingsForm( $times );
+ }
+
+ /**
+ * Show the Notes form
+ *
+ * @author Matt Mecham
+ * @return string Processed HTML
+ */
+ public function showFormNotes()
+ {
+ /* Show the form */
+ $member = IPSMember::load( $this->memberData['member_id'], 'extendedProfile' );
+ $content = $member['notes'];
+
+ return $this->registry->getClass('output')->getTemplate('ucp')->coreNotesForm( $content );
+ }
+
+ /**
+ * UserCP Form Check
+ *
+ * @author Matt Mecham
+ * @param string Current area as defined by 'get_links'
+ * @return string Processed HTML
+ */
+ public function saveForm( $current_area )
+ {
+ //-----------------------------------------
+ // Where to go, what to see?
+ //-----------------------------------------
+
+ switch( $current_area )
+ {
+ default:
+ case 'settings':
+ return $this->saveFormSettings();
+ break;
+ case 'email':
+ return $this->saveFormEmail();
+ break;
+ case 'password':
+ return $this->saveFormPassword();
+ break;
+ case 'displayname':
+ return $this->saveFormDisplayname();
+ break;
+ case 'notes':
+ return $this->saveFormNotes();
+ break;
+ case 'notifications':
+ return $this->saveFormNotifications();
+ break;
+ }
+ }
+
+ /**
+ * UserCP Save Form: Notifications config
+ *
+ * @return boolean Successful
+ */
+ public function saveFormNotifications()
+ {
+ //-----------------------------------------
+ // Notifications library
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
+ $notifyLibrary = new $classToLoad( $this->registry );
+ $notifyLibrary->setMember( $this->memberData );
+
+ //-----------------------------------------
+ // Show the form
+ //-----------------------------------------
+
+ $_basicOptions = array( array( 'email', $this->lang->words['notopt__email'] ), array( 'pm', $this->lang->words['notopt__pm'] ), array( 'inline', $this->lang->words['notopt__inline'] ), array( 'mobile' => $this->lang->words['notopt__mobile'] ) );
+ $_configOptions = $notifyLibrary->getNotificationData();
+ $_notifyConfig = $notifyLibrary->getMemberNotificationConfig();
+ $_defaultConfig = $notifyLibrary->getDefaultNotificationConfig();
+ $_noPrivateMessage = array( 'new_private_message', 'reply_private_message' );
+ $_saveConfig = array();
+
+ foreach( $_configOptions as $option )
+ {
+ $_saveConfig[ $option['key'] ] = array();
+ $_saveConfig[ $option['key'] ]['selected'] = array();
+
+ //-----------------------------------------
+ // Loop through and mark what we selected.
+ // Do not allow changing of stuff from disable_override
+ // and disabled, however
+ //-----------------------------------------
+
+ if( is_array($this->request['config_' . $option['key'] ]) AND count($this->request['config_' . $option['key'] ]) )
+ {
+ foreach( $this->request['config_' . $option['key'] ] as $_selected )
+ {
+ if( !is_array($_defaultConfig[ $option['key'] ]['disabled']) OR !in_array( $_selected, $_defaultConfig[ $option['key'] ]['disabled'] ) )
+ {
+ $_saveConfig[ $option['key'] ]['selected'][] = $_selected;
+ }
+ }
+ }
+
+ if( $_defaultConfig[ $option['key'] ]['disable_override'] )
+ {
+ $_saveConfig[ $option['key'] ]['selected'] = $_defaultConfig[ $option['key'] ]['selected'];
+ }
+
+ /**
+ * @link http://community.invisionpower.com/tracker/issue-23453-notification-defaults/
+ */
+ if( in_array( $option['key'], $_noPrivateMessage ) AND in_array( 'pm', $_saveConfig[ $option['key'] ]['selected'] ) )
+ {
+ $_newSelected = array();
+
+ foreach( $_saveConfig[ $option['key'] ]['selected'] as $_v )
+ {
+ if( $_v != 'pm' )
+ {
+ $_newSelected[] = $_v;
+ }
+ }
+
+ $_saveConfig[ $option['key'] ]['selected'] = $_newSelected;
+ }
+
+ //-----------------------------------------
+ // Nothing selected, default to inline/email/pm
+ // based on availability, or inline if none are available
+ // Decided to allow nothing selected to be 'no notification'
+ //-----------------------------------------
+
+ //if( !count($_saveConfig[ $option['key'] ]['selected']) )
+ //{
+ // if( !in_array( 'inline', $_defaultConfig[ $option['key'] ]['disabled'] ) )
+ // {
+ // $_saveConfig[ $option['key'] ]['selected'][] = 'inline';
+ // }
+ // else if( !in_array( 'email', $_defaultConfig[ $option['key'] ]['disabled'] ) )
+ // {
+ // $_saveConfig[ $option['key'] ]['selected'][] = 'email';
+ // }
+ // else if( !in_array( 'pm', $_defaultConfig[ $option['key'] ]['disabled'] ) )
+ // {
+ // $_saveConfig[ $option['key'] ]['selected'][] = 'pm';
+ // }
+ // else
+ // {
+ // $_saveConfig[ $option['key'] ]['selected'][] = 'inline';
+ // }
+ //}
+ }
+
+ //-----------------------------------------
+ // Save
+ //-----------------------------------------
+
+ IPSMember::packMemberCache( $this->memberData['member_id'], array( 'notifications' => $_saveConfig, 'show_notification_popup' => intval($this->request['show_notification_popup']) ), $this->memberData['members_cache'] );
+
+ //-----------------------------------------
+ // Topic preferences
+ //-----------------------------------------
+
+ $_trackChoice = '';
+
+ if ( $this->request['auto_track'] )
+ {
+ if ( in_array( $this->request['trackchoice'], array( 'none', 'immediate', 'delayed', 'daily', 'weekly' ) ) )
+ {
+ $_trackChoice = $this->request['trackchoice'];
+ }
+ }
+
+ //-----------------------------------------
+ // Profile preferences
+ //-----------------------------------------
+
+ IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'hide_email' => intval( $this->request['hide_email'] ),
+ 'allow_admin_mails' => intval( $this->request['admin_send'] ),
+ 'members_disable_pm' => intval( $this->request['disableMessenger'] ),
+ 'email_full' => intval( $this->request['send_full_msg'] ),
+ 'auto_track' => $_trackChoice
+ ) ) );
+
+ return TRUE;
+ }
+
+ /**
+ * UserCP Save Form: Notes
+ *
+ * @return boolean Successful
+ */
+ public function saveFormNotes()
+ {
+ //-----------------------------------------
+ // Write it to the DB.
+ //-----------------------------------------
+
+ IPSMember::save( $this->memberData['member_id'], array( 'extendedProfile' => array( 'notes' => htmlspecialchars($_POST['Post']) ) ) );
+
+ $this->ok_message = $this->lang->words['notes_saved_msg'];
+ return TRUE;
+ }
+
+ /**
+ * UserCP Save Form: Password
+ *
+ * @param array Array of member / core_sys_login information (if we're editing)
+ * @return mixed Array of errors / boolean true
+ */
+ public function saveFormPassword( $member=array() )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $cur_pass = trim($this->request['current_pass']);
+ $new_pass = trim($this->request['new_pass_1']);
+ $chk_pass = trim($this->request['new_pass_2']);
+ $isRemote = ( ! $this->memberData['bw_local_password_set'] AND $this->memberData['members_created_remote'] ) ? true : false;
+
+ //-----------------------------------------
+ // Checks...
+ //-----------------------------------------
+
+ if( $this->memberData['g_access_cp'] )
+ {
+ return array( 0 => $this->lang->words['admin_emailpassword'] );
+ }
+
+ if ( $isRemote === false AND ( ! $_POST['current_pass'] OR ( empty($new_pass) ) or ( empty($chk_pass) ) ) )
+ {
+ return array( 0 => $this->lang->words['complete_entire_form'] );
+ }
+
+ //-----------------------------------------
+ // Do the passwords actually match?
+ //-----------------------------------------
+
+ if ( $new_pass != $chk_pass )
+ {
+ return array( 0 => $this->lang->words['passwords_not_matchy'] );
+ }
+
+ //-----------------------------------------
+ // Check password...
+ //-----------------------------------------
+
+ if ( $isRemote === false )
+ {
+ if ( $this->_checkPassword( $cur_pass ) !== TRUE )
+ {
+ return array( 0 => $this->lang->words['current_pw_bad'] );
+ }
+ }
+ else
+ {
+ /* This is INIT in _checkPassword */
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $this->han_login = new $classToLoad( $this->registry );
+ $this->han_login->init();
+ }
+
+ /*if ( IPSText::mbstrlen( $new_pass ) > 32)
+ {
+ return array( 0 => $this->lang->words['new_pw_too_long'] );
+ }*/
+
+ //-----------------------------------------
+ // Create new password...
+ //-----------------------------------------
+
+ $md5_pass = md5($new_pass);
+
+ //-----------------------------------------
+ // han_login was loaded during check_password
+ //-----------------------------------------
+
+ $this->han_login->changePass( $this->memberData['email'], $md5_pass, $new_pass, $this->memberData );
+
+ if ( $this->han_login->return_code AND $this->han_login->return_code != 'METHOD_NOT_DEFINED' AND $this->han_login->return_code != 'SUCCESS' )
+ {
+ return array( 0 => $this->lang->words['hanlogin_pw_failed'] );
+ }
+
+ //-----------------------------------------
+ // Update the DB
+ //-----------------------------------------
+
+ IPSMember::updatePassword( $this->memberData['email'], $md5_pass );
+
+ IPSLib::runMemberSync( 'onPassChange', $this->memberData['member_id'], $new_pass );
+
+ //-----------------------------------------
+ // Update members log in key...
+ //-----------------------------------------
+
+ $key = IPSMember::generateAutoLoginKey();
+
+ IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'member_login_key' => $key, 'bw_local_password_set' => 1 ) ) );
+
+ $this->ok_message = $this->lang->words['pw_change_successful'];
+
+ return TRUE;
+ }
+
+ /**
+ * UserCP Save Form: Display Name
+ *
+ * @return mixed Array of errors / boolean true
+ */
+ public function saveFormDisplayname()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $members_display_name = trim($this->request['displayName']);
+ $password_check = trim( $this->request['displayPassword'] );
+
+ //-----------------------------------------
+ // Check for blanks...
+ //-----------------------------------------
+
+ if ( ! $members_display_name OR ( ! $this->_isFBUser AND ! $password_check ) )
+ {
+ return array( 0 => $this->lang->words['complete_entire_form'] );
+ }
+
+ //-----------------------------------------
+ // Check password
+ //-----------------------------------------
+
+ if ( ! $this->_isFBUser )
+ {
+ if ( $this->_checkPassword( $password_check ) === FALSE )
+ {
+ return array( 0 => $this->lang->words['current_pw_bad'] );
+ }
+ }
+
+ try
+ {
+ if ( IPSMember::getFunction()->updateName( $this->memberData['member_id'], $members_display_name, 'members_display_name' ) === TRUE )
+ {
+ $this->cache->rebuildCache( 'stats', 'global' );
+
+ return $this->showFormDisplayname( '', $this->lang->words['dname_change_ok'] );
+ }
+ else
+ {
+ # We should absolutely never get here. So this is a fail-safe, really to
+ # prevent a "false" positive outcome for the end-user
+ return array( 0 => $this->lang->words['name_taken_change'] );
+ }
+ }
+ catch( Exception $error )
+ {
+ switch( $error->getMessage() )
+ {
+ case 'NO_MORE_CHANGES':
+ return array( 0 => $this->lang->words['name_change_no_more'] );
+ break;
+ case 'NO_USER':
+ return array( 0 => $this->lang->words['name_change_noload'] );
+ break;
+ case 'NO_PERMISSION':
+ return array( 0 => $this->lang->words['name_change_noperm'] );
+ case 'NO_NAME':
+ return array( 0 => sprintf( $this->lang->words['name_change_tooshort'], $this->settings['max_user_name_length'] ) );
+ break;
+ case 'TOO_LONG':
+ return array( 0 => sprintf( $this->lang->words['name_change_tooshort'], $this->settings['max_user_name_length'] ) );
+ break;
+ case 'ILLEGAL_CHARS':
+ return array( 0 => $this->lang->words['name_change_illegal'] );
+ break;
+ case 'USER_NAME_EXISTS':
+ return array( 0 => $this->lang->words['name_change_taken'] );
+ break;
+ default:
+ return array( 0 => $error->getMessage() );
+ break;
+ }
+ }
+
+ return TRUE;
+ }
+
+ /**
+ * UserCP Save Form: Email Address
+ *
+ * @return mixed Array of errors / boolean true
+ */
+ public function saveFormEmail()
+ {
+ //-----------------------------------------
+ // Do not allow validating members to change
+ // email when admin validation is on
+ // @see http://community.invisionpower.com/tracker/issue-19964-loophole-in-registration-procedure/
+ //-----------------------------------------
+
+ if( $this->memberData['member_group_id'] == $this->settings['auth_group'] AND in_array( $this->settings['reg_auth_type'], array( 'admin', 'admin_user' ) ) )
+ {
+ $this->registry->output->showError( $this->lang->words['admin_val_no_email_chg'], 10190 );
+ }
+
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $_emailOne = mb_strtolower( trim($this->request['in_email_1']) );
+ $_emailTwo = mb_strtolower( trim($this->request['in_email_2']) );
+ $captchaInput = trim(ipsRegistry::$request['captchaInput']);
+ $captchaUniqueID = trim(ipsRegistry::$request['captchaUniqueID']);
+
+ //-----------------------------------------
+ // Check input
+ //-----------------------------------------
+
+ if( $this->memberData['g_access_cp'] )
+ {
+ return array( 0 => $this->lang->words['admin_emailpassword'] );
+ }
+
+ if ( ! $_POST['in_email_1'] OR ! $_POST['in_email_2'] )
+ {
+ return array( 0 => $this->lang->words['complete_entire_form'] );
+ }
+
+ //-----------------------------------------
+ // Check password...
+ //-----------------------------------------
+
+ if ( ! $this->_isFBUser )
+ {
+ if ( $this->_checkPassword( $this->request['password'] ) === FALSE )
+ {
+ return array( 0 => $this->lang->words['current_pw_bad'] );
+ }
+ }
+
+ //-----------------------------------------
+ // Test email addresses
+ //-----------------------------------------
+
+ if ( $_emailOne != $_emailTwo )
+ {
+ return array( 0 => $this->lang->words['emails_no_matchy'] );
+ }
+
+ if ( IPSText::checkEmailAddress( $_emailOne ) !== TRUE )
+ {
+ return array( 0 => $this->lang->words['email_not_valid'] );
+ }
+
+ //-----------------------------------------
+ // Is this email addy taken?
+ //-----------------------------------------
+
+ if ( IPSMember::checkByEmail( $_emailOne ) == TRUE )
+ {
+ return array( 0 => $this->lang->words['email_is_taken'] );
+ }
+
+ //-----------------------------------------
+ // Load ban filters
+ //-----------------------------------------
+ $banfilters = array();
+ $this->DB->build( array( 'select' => '*', 'from' => 'banfilters' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $banfilters[ $r['ban_type'] ][] = $r['ban_content'];
+ }
+
+ //-----------------------------------------
+ // Check in banned list
+ //-----------------------------------------
+
+ if ( isset($banfilters['email']) AND is_array( $banfilters['email'] ) and count( $banfilters['email'] ) )
+ {
+ foreach ( $banfilters['email'] as $email )
+ {
+ $email = str_replace( '\*', '.*' , preg_quote($email, "/") );
+
+ if ( preg_match( "/^{$email}$/i", $_emailOne ) )
+ {
+ return array( 0 => $this->lang->words['email_is_taken'] );
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Anti bot flood...
+ //-----------------------------------------
+
+ if ( $this->settings['bot_antispam_type'] != 'none' )
+ {
+ if ( $this->registry->getClass('class_captcha')->validate() !== TRUE )
+ {
+ return array( 0 => $this->lang->words['captcha_email_invalid'] );
+ }
+ }
+
+ //-----------------------------------------
+ // Load handler...
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $this->han_login = new $classToLoad( $this->registry );
+ $this->han_login->init();
+
+ if ( $this->han_login->emailExistsCheck( $_emailOne ) !== FALSE )
+ {
+ return array( 0 => $this->lang->words['email_is_taken'] );
+ }
+
+ $this->han_login->changeEmail( $this->memberData['email'], $_emailOne, $this->memberData );
+
+ if ( $this->han_login->return_code AND $this->han_login->return_code != 'METHOD_NOT_DEFINED' AND $this->han_login->return_code != 'SUCCESS' )
+ {
+ return array( 0 => $this->lang->words['email_is_taken'] );
+ }
+
+ //-----------------------------------------
+ // Require new validation? NON ADMINS ONLY
+ //-----------------------------------------
+
+ if ( $this->settings['reg_auth_type'] AND !$this->memberData['g_access_cp'] )
+ {
+ //-----------------------------------------
+ // Remove any existing entries
+ //-----------------------------------------
+
+ $_previous = $this->DB->buildAndFetch( array( 'select' => 'prev_email, real_group', 'from' => 'validating', 'where' => "member_id={$this->memberData['member_id']} AND email_chg=1" ) );
+
+ if( $_previous['prev_email'] )
+ {
+ $this->DB->delete( 'validating', "member_id={$this->memberData['member_id']} AND email_chg=1" );
+
+ $this->memberData['email'] = $_previous['prev_email'];
+ $this->memberData['member_group_id'] = $_previous['real_group'];
+ }
+
+ $validate_key = md5( IPSLib::makePassword() . time() );
+
+ //-----------------------------------------
+ // Update the new email, but enter a validation key
+ // and put the member in "awaiting authorisation"
+ // and send an email..
+ //-----------------------------------------
+
+ $db_str = array(
+ 'vid' => $validate_key,
+ 'member_id' => $this->memberData['member_id'],
+ 'temp_group' => $this->settings['auth_group'],
+ 'entry_date' => time(),
+ 'coppa_user' => 0,
+ 'email_chg' => 1,
+ 'ip_address' => $this->member->ip_address,
+ 'prev_email' => $this->memberData['email'],
+ );
+
+ if ( $this->memberData['member_group_id'] != $this->settings['auth_group'] )
+ {
+ $db_str['real_group'] = $this->memberData['member_group_id'];
+ }
+
+ $this->DB->insert( 'validating', $db_str );
+
+ IPSLib::runMemberSync( 'onEmailChange', $this->memberData['member_id'], mb_strtolower( $_emailOne ), $this->memberData['email'] );
+
+ IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'member_group_id' => $this->settings['auth_group'],
+ 'email' => $_emailOne ) ) );
+
+ //-----------------------------------------
+ // Update their session with the new member group
+ //-----------------------------------------
+
+ if ( $this->member->session_id )
+ {
+ $this->member->sessionClass()->convertMemberToGuest();
+ }
+
+ //-----------------------------------------
+ // Kill the cookies to stop auto log in
+ //-----------------------------------------
+
+ IPSCookie::set( 'pass_hash' , '-1', 0 );
+ IPSCookie::set( 'member_id' , '-1', 0 );
+ IPSCookie::set( 'session_id' , '-1', 0 );
+
+ //-----------------------------------------
+ // Dispatch the mail, and return to the activate form.
+ //-----------------------------------------
+
+ IPSText::getTextClass( 'email' )->getTemplate("newemail");
+
+ IPSText::getTextClass( 'email' )->buildMessage( array(
+ 'NAME' => $this->memberData['members_display_name'],
+ 'THE_LINK' => $this->settings['base_url']."app=core&module=global§ion=register&do=auto_validate&type=newemail&uid=".$this->memberData['member_id']."&aid=".$validate_key,
+ 'ID' => $this->memberData['member_id'],
+ 'MAN_LINK' => $this->settings['base_url']."app=core&module=global§ion=register&do=07",
+ 'CODE' => $validate_key,
+ ) );
+
+ IPSText::getTextClass( 'email' )->subject = $this->lang->words['lp_subject'].' '.$this->settings['board_name'];
+ IPSText::getTextClass( 'email' )->to = $_emailOne;
+
+ IPSText::getTextClass( 'email' )->sendMail();
+
+ $this->registry->getClass('output')->redirectScreen( $this->lang->words['ce_redirect'], $this->settings['base_url'] . 'app=core&module=global§ion=register&do=07' );
+ }
+ else
+ {
+ //-----------------------------------------
+ // No authorisation needed, change email addy and return
+ //-----------------------------------------
+
+ IPSLib::runMemberSync( 'onEmailChange', $this->memberData['member_id'], mb_strtolower( $_emailOne ), $this->memberData['email'] );
+
+ IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'email' => $_emailOne ) ) );
+
+ //-----------------------------------------
+ // Add to OK message
+ //-----------------------------------------
+
+ $this->ok_message = $this->lang->words['ok_email_changed'];
+
+ return TRUE;
+ }
+ }
+
+ /**
+ * UserCP Save Form: Settings
+ *
+ * @param array Array of member / core_sys_login information (if we're editing)
+ * @return mixed Array of errors / boolean true
+ */
+ public function saveFormSettings( $member=array() )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $timeZone = IPSText::alphanumericalClean( $this->request['timeZone'], '+.' );
+ $dst_correct = intval( $this->request['dst_correct'] );
+
+ //-----------------------------------------
+ // RTE
+ //-----------------------------------------
+
+ if ( ! $this->settings['posting_allow_rte'] )
+ {
+ $this->request['editorChoice'] = 0;
+ }
+
+ //-----------------------------------------
+ // PM Settings: 2 means admin says no.
+ //-----------------------------------------
+
+ if ( $this->memberData['members_disable_pm' ] == 2 )
+ {
+ $this->member->setProperty( 'members_disable_pm', 2 );
+ }
+ else
+ {
+ $this->member->setProperty( 'members_disable_pm', intval( $this->request[ 'disableMessenger' ] ) );
+ }
+
+ //-----------------------------------------
+ // Only one account per identity url
+ //-----------------------------------------
+
+ if( $this->request['identity_url'] )
+ {
+ $account = $this->DB->buildAndFetch( array( 'select' => 'member_id', 'from' => 'members', 'where' => "identity_url='" . trim($this->request['identity_url']) . "' AND member_id<>" . $this->memberData['member_id'] ) );
+
+ if( $account['member_id'] )
+ {
+ return array( 0 => $this->lang->words['identity_url_assoc'] );
+ }
+
+ //-----------------------------------------
+ // Need to clean up identity URL a little
+ //-----------------------------------------
+
+ $identityUrl = trim($this->request['identity_url']);
+ $identityUrl = rtrim( $identityUrl, "/" );
+
+ if( !strpos( $identityUrl, 'http://' ) === 0 AND !strpos( $identityUrl, 'https://' ) === 0 )
+ {
+ $identityUrl = 'http://' . $identityUrl;
+ }
+ }
+
+ /* Figure out BW options */
+ $toSave = IPSBWOptions::thaw( $this->memberData['members_bitoptions'], 'members' );
+
+ foreach( array( 'bw_vnc_type', 'bw_forum_result_type' ) as $field )
+ {
+ $toSave[ $field ] = intval( $this->request[ $field ] );
+ }
+
+ IPSMember::save( $this->memberData['member_id'], array( 'core' => array(
+ 'time_offset' => $timeZone,
+ 'dst_in_use' => $this->settings['time_dst_auto_correction'] ? ( ( $this->request['dstOption'] AND intval($this->request['dstCheck']) == 0 ) ? intval($this->request['dstOption']) : 0 ) : $this->memberData['dst_in_use'],
+ 'members_auto_dst' => $this->settings['time_dst_auto_correction'] ? intval($this->request['dstCheck']) : $this->memberData['members_auto_dst'],
+ 'members_editor_choice' => $this->request['editorChoice'] ? 'rte' : 'std',
+ 'member_uploader' => $this->request['member_uploader'] ? 'flash' : 'default',
+ 'identity_url' => isset($identityUrl) ? $identityUrl : $this->memberData['identity_url'],
+ 'members_bitoptions' => IPSBWOptions::freeze( $toSave, 'members' ) ) ) );
+
+ return TRUE;
+ }
+
+ /**
+ * Password check
+ *
+ * @param string Plain Text Password
+ * @return boolean Password matched or not
+ */
+ private function _checkPassword( $password_check )
+ {
+ //-----------------------------------------
+ // Ok, check password first
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $this->han_login = new $classToLoad( $this->registry );
+ $this->han_login->init();
+
+ //-----------------------------------------
+ // Is this a username or email address?
+ //-----------------------------------------
+
+ $this->han_login->loginPasswordCheck( $this->memberData['name'], $this->memberData['email'], $password_check );
+
+ if ( $this->han_login->return_code == 'SUCCESS' )
+ {
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/index.html b/upload/admin/applications/core/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/index.html
+++ b/upload/admin/applications/core/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/js/IPB3TemplateDiffResults.js b/upload/admin/applications/core/js/IPB3TemplateDiffResults.js
new file mode 100644
index 00000000..7cdff5f7
--- /dev/null
+++ b/upload/admin/applications/core/js/IPB3TemplateDiffResults.js
@@ -0,0 +1,621 @@
+/**
+* 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 IPB3TemplateDiffResults = new IPB3TemplateDiffResults;
+
+function IPB3TemplateDiffResults()
+{
+ this.popUps = {};
+ this.cookieArray = new Array();
+ this.defaultCookieArray = new Array( 'merged', 'conflicted', 'uncommitted', 'committed' );
+
+ /**
+ * INIT
+ */
+ this.init = function()
+ {
+ document.observe("dom:loaded", function()
+ {
+ /* Set up cbox all */
+ $('cboxall').observe( 'click', IPB3TemplateDiffResults.toggleSelectAll );
+
+ /* Set up cbox handler */
+ ipb.delegate.register(".__cbx", IPB3TemplateDiffResults.cboxEvent);
+
+ cookie = ipb.Cookie.get('acp_mergecenter');
+ Debug.write( cookie );
+
+ /* Set a fairly good default */
+ if ( cookie )
+ {
+ IPB3TemplateDiffResults.cookieArray = cookie.split( ',' );
+ }
+
+ if ( ! IPB3TemplateDiffResults.cookieArray.length )
+ {
+ IPB3TemplateDiffResults.cookieArray = IPB3TemplateDiffResults.defaultCookieArray;
+ }
+
+ /* Update the view */
+ IPB3TemplateDiffResults.updateView();
+ } );
+ };
+
+
+ /**
+ * Event when dude or dudette clicks a checko-boxo
+ */
+ this.cboxEvent = function( e, elem )
+ {
+ newArray = new Array();
+
+ $$('.__cbx').each(
+ function(x)
+ {
+ if ( x.checked )
+ {
+ newArray.push( x.id.replace( '_cb_', '' ) );
+ }
+ }
+ );
+
+ if ( ! newArray.length )
+ {
+ IPB3TemplateDiffResults.cookieArray = IPB3TemplateDiffResults.defaultCookieArray;
+ }
+ else
+ {
+ IPB3TemplateDiffResults.cookieArray = newArray;
+ }
+
+ /* Set cookie */
+ ipb.Cookie.set( 'acp_mergecenter', IPB3TemplateDiffResults.cookieArray.join( ',' ) );
+
+ /* Update view */
+ IPB3TemplateDiffResults.updateView(e);
+ };
+
+ /**
+ * View options
+ */
+ this.updateView = function( e )
+ {
+ /* Check */
+ if ( ! IPB3TemplateDiffResults.cookieArray.length )
+ {
+ IPB3TemplateDiffResults.cookieArray = IPB3TemplateDiffResults.defaultCookieArray;
+ }
+
+ /* reset all headers */
+ $$('.__group').invoke('show');
+
+ /* reset all items */
+ $$('.__diffRow').invoke('hide');
+
+ /* Reset view cboxes */
+ $$('.__cbx').each( function(x) { x.checked = false; } );
+
+ for( i = 0 ; i <= IPB3TemplateDiffResults.cookieArray.length ; i++ )
+ {
+ opt = IPB3TemplateDiffResults.cookieArray[ i ];
+
+ switch( opt )
+ {
+ case 'nocustom':
+ $$('._nochanges').invoke('show');
+ $('_cb_nocustom').checked = true;
+ break;
+ case 'merged':
+ $$('.__canMerge').invoke('show');
+ $('_cb_merged').checked = true;
+ break;
+ case 'conflicted':
+ $$('.__conflicts').invoke('show');
+ $('_cb_conflicted').checked = true;
+ break;
+ case 'uncommitted':
+ $$('._uncommitted').invoke('show');
+ $('_cb_uncommitted').checked = true;
+ break;
+ case 'committed':
+ $$('.__committed').invoke('show');
+ $('_cb_committed').checked = true;
+ break;
+ }
+ }
+
+ /* Go through and remove any group titles */
+ $$('.__group').each( function( i )
+ {
+ /* Extract group key */
+ if ( $( i ).className.match( /_xgid/ ) )
+ {
+ _g = $( i ).className.match( '_xgid([0-9a-zA-Z]+)' );
+
+ if ( _g != null && ! Object.isUndefined( _g ) )
+ {
+ _groupKey = _g[1];
+
+ if ( _groupKey )
+ {
+ _c = 0;
+
+ $$('._xgid' + _groupKey).each( function(y)
+ {
+ if ( $(y).visible() )
+ {
+ _c++;
+ }
+ } );
+
+ if ( _c < 2 )
+ {
+ $(i).hide();
+ }
+ }
+ }
+ }
+ } );
+ };
+
+ /**
+ * Select all
+ */
+ this.toggleSelectAll = function( e )
+ {
+ /* Wot do we have? */
+ var status = $('cboxall').checked;
+
+ /* unselect? */
+ if ( status == false )
+ {
+ $$('.__xBox').each( function(x) { x.checked = false; } );
+ }
+ else
+ {
+ /* Just select non-hidden items */
+ $$('.__diffRow').each( function( i )
+ {
+ if ( $(i).visible() )
+ {
+ _g = $( i ).className.match( '__rowId([0-9]+)' );
+
+ if ( _g != null && ! Object.isUndefined( _g ) )
+ {
+ $$('.__cBox' + _g[1]).each( function(x) { if ( ! x.disabled ) { x.checked = true; } } );
+ }
+ }
+ } );
+ }
+ };
+
+ /**
+ * View version
+ */
+ this.viewVersion = function( changeId, type )
+ {
+ /* Grab it via ajax */
+ var _url = ipb.vars['base_url'] + "&app=core&module=ajax§ion=templatediff&do=viewVersion&change_id=" + changeId + '&type=' + type + '&secure_key=' + ipb.vars['md5_hash'];
+
+ new Ajax.Request( _url,
+ {
+ method: 'get',
+ onSuccess: function (t)
+ {
+ /* Not a JSON response? */
+ if ( ! t.responseText.match( /^(\s+?)?\{/ ) )
+ {
+ alert( ipb.lang['sk_error'] + t.responseText );
+ return;
+ }
+
+ /* Process results */
+ eval( "var json = " + t.responseText );
+
+ if ( json['error'] )
+ {
+ alert( ipb.lang['sk_error'] + json['error'] );
+ return false;
+ }
+
+ /* Type */
+ switch( type )
+ {
+ default:
+ case 'orig':
+ _text = 'Старый';
+ break;
+ case 'new':
+ _text = 'Новый';
+ break;
+ case 'custom':
+ _text = 'Пользовательский';
+ break;
+ }
+
+ /* otherwise... */
+ if ( json['data_content'] )
+ {
+ if ( json['data_type'] == 'css' )
+ {
+ content = '' + _text + ': ' + json['data_title'] + '.css ' + json['data_content'] + ' ';
+ }
+ else
+ {
+ content = '' + _text + ': ' + json['data_group'] + ' > ' + json['data_title'] + ' ' + json['data_content'] + ' ';
+ }
+
+ max = document.viewport.getHeight();
+ max = ( max < 600 ) ? max : 600;
+
+ popup = new ipb.Popup('VPopUp', { type: 'pane', modal: false, hideAtStart: true, w: '600px', h: max + 'px', initial: content } );
+ popup.show();
+ }
+ },
+ onFailure: function()
+ {
+ return false;
+ },
+ onException: function()
+ {
+ return false;
+ }
+
+ } );
+ };
+
+ /**
+ * View diff preview
+ */
+ this.viewDiff = function( changeId, type )
+ {
+ /* Grab it via ajax */
+ var _url = ipb.vars['base_url'] + "&app=core&module=ajax§ion=templatediff&do=viewDiff&change_id=" + changeId + '&type=' + type + '&secure_key=' + ipb.vars['md5_hash'];
+
+ new Ajax.Request( _url,
+ {
+ method: 'get',
+ onSuccess: function (t)
+ {
+ /* Not a JSON response? */
+ if ( ! t.responseText.match( /^(\s+?)?\{/ ) )
+ {
+ alert( ipb.lang['sk_error'] + t.responseText );
+ return;
+ }
+
+ /* Process results */
+ eval( "var json = " + t.responseText );
+
+ if ( json['error'] )
+ {
+ alert( ipb.lang['sk_error'] + json['error'] );
+ return false;
+ }
+
+ /* Type */
+ switch( type )
+ {
+ default:
+ case 'diff':
+ _text = 'Различия';
+ break;
+ case 'merge':
+ _text = 'Препросмотр объединения';
+ break;
+ }
+
+ /* otherwise... */
+ if ( json['change_data_content'] )
+ {
+ /* Extra work for merge */
+ if ( type == 'merge' )
+ {
+ _qb = "";
+ }
+ else
+ {
+ _qb = '';
+ }
+
+ if ( json['change_data_type'] == 'css' )
+ {
+ content = ''+ _text + ': ' + json['change_data_title'] + '.css ' + json['change_data_content'] + ' ' + _qb;
+ }
+ else
+ {
+ content = ''+ _text + ': ' + json['change_data_group'] + ' > ' + json['change_data_title'] + ' ' + json['change_data_content'] + ' ' + _qb;
+ }
+
+ max = document.viewport.getHeight();
+ max = ( max < 600 ) ? max : 600;
+
+ IPB3TemplateDiffResults.popUps['preview-' + changeId ] = new ipb.Popup('diffPopUp', { type: 'pane', modal: false, hideAtStart: true, w: '800px', h: max + 'px', initial: content } );
+ IPB3TemplateDiffResults.popUps['preview-' + changeId ].show();
+
+ /* Observe */
+ if ( type == 'merge' )
+ {
+ $('mergeResolveCustom').observe( 'click', IPB3TemplateDiffResults.resolveAllSingle );
+ $('mergeResolveNew').observe( 'click', IPB3TemplateDiffResults.resolveAllSingle );
+ $('mergeEditCustom').observe( 'click', IPB3TemplateDiffResults.goEdit );
+ }
+
+ }
+ },
+ onFailure: function()
+ {
+ return false;
+ },
+ onException: function()
+ {
+ return false;
+ }
+
+ } );
+ };
+
+ /**
+ * View diff preview
+ */
+ this.editBit = function( changeId )
+ {
+ /* Grab it via ajax */
+ var _url = ipb.vars['base_url'] + "&app=core&module=ajax§ion=templatediff&do=editDiff&change_id=" + changeId + '&secure_key=' + ipb.vars['md5_hash'];
+
+ new Ajax.Request( _url,
+ {
+ method: 'get',
+ onSuccess: function (t)
+ {
+ /* Not a JSON response? */
+ if ( ! t.responseText.match( /^(\s+?)?\{/ ) )
+ {
+ alert( ipb.lang['sk_error'] + t.responseText );
+ return;
+ }
+
+ /* Process results */
+ eval( "var json = " + t.responseText );
+
+ if ( json['error'] )
+ {
+ alert( ipb.lang['sk_error'] + json['error'] );
+ return false;
+ }
+
+ /* otherwise... */
+ if ( json['change_merge_content'] )
+ {
+ /* Ok, for some reason Safari (and possibly others) doesn't show the pop-up when viewing a
+ template bit. I presume it's because prototype/javascript will not insert invalid HTML into a node even
+ though it's encoded properly. After a few days working on merge, this is a quick hack to get it done
+ Force a 750px div in to position pop-up correctly on the screen, then once the pop-up has been created
+ shove the content in.
+ <3 javascript */
+ var _tmp = Math.floor( Math.random() * 1001 );
+
+ _qb = "
";
+ _tb = '' + _qb + '
';
+
+ if ( json['change_data_type'] == 'css' )
+ {
+ content = '' + json['change_data_title'] + '.css' + ' ' + _tb + '
';
+ }
+ else
+ {
+ content = '' + json['change_data_group'] + ' > ' + json['change_data_title'] + ' ' + _tb + '
';
+ }
+
+ IPB3TemplateDiffResults.popUps['edit-' + changeId ] = new ipb.Popup('diffEditPopUp_' + _tmp, { type: 'pane', modal: false, hideAtStart: true, w: '800px', h: '600px', initial: '
' } );
+ IPB3TemplateDiffResults.popUps['edit-' + changeId ].show();
+
+ $('diffEditPopUp_' + _tmp + '_inner').update( content );
+
+ /* Observe */
+ $('mergeSubmit').observe( 'click', IPB3TemplateDiffResults.saveEdit );
+
+ $('mergeResolveCustom_' + _tmp ).observe( 'click', IPB3TemplateDiffResults.resolveAllSingle );
+ $('mergeResolveNew_' + _tmp ).observe( 'click', IPB3TemplateDiffResults.resolveAllSingle );
+
+ }
+ },
+ onFailure: function()
+ {
+ return false;
+ },
+ onException: function()
+ {
+ return false;
+ }
+
+ } );
+ };
+
+ /**
+ * View diff preview
+ */
+ this.goEdit = function(e)
+ {
+ elem = Event.element(e);
+
+ /* fetch ID */
+ var test = $( elem ).className.match('__re([0-9]+)');
+ if( test == null || Object.isUndefined( test ) ){ Debug.error("Error"); return; }
+
+ var changeId = test[1];
+
+ /* Close preview pop-up */
+ if ( IPB3TemplateDiffResults.popUps['preview-' + changeId ] )
+ {
+ IPB3TemplateDiffResults.popUps['preview-' + changeId ].hide();
+ }
+
+ /* Fire edit */
+ IPB3TemplateDiffResults.editBit( changeId );
+ };
+
+ /**
+ * View diff preview
+ */
+ this.resolveAllSingle = function(e)
+ {
+ elem = Event.element(e);
+ var _type = '';
+
+ /* fetch ID */
+ if ( $( elem ).className.match( /__rc/ ) )
+ {
+ var test = $( elem ).className.match('__rc([0-9]+)');
+ if( test == null || Object.isUndefined( test ) ){ Debug.error("Error"); return; }
+ _type = 'custom';
+ }
+ else
+ {
+ var test = $( elem ).className.match('__rn([0-9]+)');
+ if( test == null || Object.isUndefined( test ) ){ Debug.error("Error"); return; }
+ _type = 'new';
+ }
+
+ var changeId = test[1];
+
+ /* Grab it via ajax */
+ var _url = ipb.vars['base_url'] + "&app=core&module=ajax§ion=templatediff&do=resolveAllSingle&change_id=" + changeId + '&type=' + _type + '&secure_key=' + ipb.vars['md5_hash'];
+
+ new Ajax.Request( _url,
+ {
+ method: 'get',
+ onSuccess: function (t)
+ {
+ if ( t.responseText.match( /^(\s+?)?\{/ ) )
+ {
+ eval( "var json = " + t.responseText );
+
+ if ( json['error'] )
+ {
+ alert( json['error'] );
+ return;
+ }
+ else
+ {
+ /* Close pop-up */
+ if ( IPB3TemplateDiffResults.popUps['edit-' + changeId ] )
+ {
+ IPB3TemplateDiffResults.popUps['edit-' + changeId ].hide();
+ }
+
+ if ( IPB3TemplateDiffResults.popUps['preview-' + changeId ] )
+ {
+ IPB3TemplateDiffResults.popUps['preview-' + changeId ].hide();
+ }
+
+ /* Update desc string */
+ $('mDesc-' + changeId).update( json['desc'] );
+
+ /* Hide merge available data */
+ $$('.__whenHasMerge' + changeId).each( function(m){
+ m.hide();
+ });
+ }
+ }
+ else
+ {
+ alert( "Ошибка: " + t.responseText );
+ }
+ },
+ onFailure: function()
+ {
+ return false;
+ },
+ onException: function()
+ {
+ return false;
+ }
+
+ } );
+ };
+
+ /**
+ * View diff preview
+ */
+ this.saveEdit = function(e)
+ {
+ elem = Event.element(e);
+
+ /* fetch ID */
+ var test = $( elem ).className.match('__i([0-9]+)');
+ if( test == null || Object.isUndefined( test ) ){ Debug.error("Error"); return; }
+
+ var changeId = test[1];
+ var content = $('mergeContent').value;
+
+ /* Test to see if we've left in merge stuff */
+ if ( content.match( '<<<<<<<<<<' ) || content.match( '>>>>>>>>>' ) )
+ {
+ alert( 'Нельзя сохранить пока не будут устранены все конфликты' );
+ }
+ else
+ {
+ /* Fire it of to Ajaxia for central processing */
+ var url = ipb.vars['base_url'] + "&app=core&module=ajax§ion=templatediff&do=saveEdit&change_id=" + changeId + '&secure_key=' + ipb.vars['md5_hash'];
+
+ /* Set up params */
+ var params = { 'content' : content };
+
+ 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
+ {
+ /* Close pop-up */
+ IPB3TemplateDiffResults.popUps['edit-' + changeId ].hide();
+
+ /* Update desc string */
+ $('mDesc-' + changeId).update( json['desc'] );
+
+ /* Hide merge available data */
+ $$('.__whenHasMerge' + changeId).each( function(m){
+ m.hide();
+ });
+ }
+ }
+ else
+ {
+ alert( "Ошибка: " + t.responseText );
+ }
+ },
+ onException: function( f,e ){ alert( "Исключение: " + e ); },
+ onFailure: function( t ){ alert( "Ошибка: " + t.responseText ); }
+ } );
+ }
+ };
+}
+
+IPB3TemplateDiffResults.init();
\ No newline at end of file
diff --git a/upload/admin/applications/core/js/acp.easylogo.js b/upload/admin/applications/core/js/acp.easylogo.js
index 5cf3adda..78cec407 100644
--- a/upload/admin/applications/core/js/acp.easylogo.js
+++ b/upload/admin/applications/core/js/acp.easylogo.js
@@ -1,43 +1,44 @@
-/************************************************/
-/* 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;
- }
-}
+/************************************************/
+/* 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();
\ No newline at end of file
diff --git a/upload/admin/applications/core/js/acp.homepage.js b/upload/admin/applications/core/js/acp.homepage.js
index 6a9b90ae..b8c5d828 100644
--- a/upload/admin/applications/core/js/acp.homepage.js
+++ b/upload/admin/applications/core/js/acp.homepage.js
@@ -1,35 +1,31 @@
-/************************************************/
-/* 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;
- }
-};
-
+/************************************************/
+/* IPB3 Javascript */
+/* -------------------------------------------- */
+/* acp.homepage.js - Homepage javascript */
+/* (c) IPS, Inc 2008 */
+/* -------------------------------------------- */
+/* Author: Brandon Farber */
+/************************************************/
+
+ACPHomepage = {
+
+ /*------------------------------*/
+ /* Constructor */
+ init: function()
+ {
+ Debug.write("Initializing acp.homepage.js");
+ },
+
+ editMember: function()
+ {
+ if ( $('members_display_name').value == "" )
+ {
+ alert("Нужно ввести имя пользователя!");
+ return false;
+ }
+
+ return true;
+ }
+};
+
ACPHomepage.init();
\ No newline at end of file
diff --git a/upload/admin/applications/core/js/index.html b/upload/admin/applications/core/js/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/js/index.html
+++ b/upload/admin/applications/core/js/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/js/ipb3CSS.js b/upload/admin/applications/core/js/ipb3CSS.js
index 9a95661a..f9ed0c9b 100644
--- a/upload/admin/applications/core/js/ipb3CSS.js
+++ b/upload/admin/applications/core/js/ipb3CSS.js
@@ -51,7 +51,7 @@ function IPBCSS()
{
/* Build CSS list */
this.buildCSSList();
- }
+ };
/**
* Load css groups
@@ -88,10 +88,10 @@ function IPBCSS()
alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
}
},
- onException: function( f,e ){ alert( "Исключение: " + e ) },
- onFailure: function( t ){ alert( "Ошибка: " + t.responseText ) }
+ onException: function( f,e ){ alert( "Исключение: " + e ); },
+ onFailure: function( t ){ alert( "Ошибка: " + t.responseText ); }
} );
- }
+ };
/**
* Save CSS
@@ -146,10 +146,10 @@ function IPBCSS()
alert( "Галектеко ОПАСНОСТЕ! ПЫЩПЫЩ!11: " + t.responseText );
}
},
- onException: function( f,e ){ alert( "Исключение: " + e ) },
- onFailure: function( t ){ alert( "Ошибка: " + t.responseText ) }
+ onException: function( f,e ){ alert( "Исключение: " + e ); },
+ onFailure: function( t ){ alert( "Ошибка: " + t.responseText ); }
} );
- }
+ };
/**
* Revert css
@@ -205,10 +205,10 @@ function IPBCSS()
alert( "Галектеко ОПАСНОСТЕ! ПЫЩПЫЩ!11: " + t.responseText );
}
},
- onException: function( f,e ){ alert( "Исключение: " + e ) },
- onFailure: function( t ){ alert( "Ошибка: " + t.responseText ) }
+ onException: function( f,e ){ alert( "Исключение: " + e ); },
+ onFailure: function( t ){ alert( "Ошибка: " + t.responseText ); }
} );
- }
+ };
/**
* Load template bits
@@ -242,10 +242,10 @@ function IPBCSS()
alert( "Галектеко ОПАСНОСТЕ! ПЫЩПЫЩ!11: " + t.responseText );
}
},
- onException: function( f,e ){ alert( "Исключение: " + e ) },
- onFailure: function( t ){ alert( "Ошибка: " + t.responseText ) }
+ onException: function( f,e ){ alert( "Исключение: " + e ); },
+ onFailure: function( t ){ alert( "Ошибка: " + t.responseText ); }
} );
- }
+ };
/**
* Add CSS form
@@ -253,7 +253,7 @@ function IPBCSS()
this.addCSSForm = function()
{
IPB3CSS.showCSSEditor( { 'cssData' : { 'css_id' : 0, 'css_group' : '', 'css_content' : '', 'css_added_to' : 0, '_type' : 'new' } } );
- }
+ };
/**
* Shows the template editor
@@ -279,7 +279,7 @@ function IPBCSS()
}
ipb.positionCenter( 'tplate_editor_' + json['cssData']['css_id'] );
- }
+ };
/**
* Shows the template editor
@@ -298,7 +298,7 @@ function IPBCSS()
catch(e)
{
}
- }
+ };
/**
* Build a list of CSS groups (files)
@@ -374,7 +374,7 @@ function IPBCSS()
}
}
} );
- }
+ };
/**
* Template Mouse Event
@@ -407,6 +407,5 @@ function IPBCSS()
}
}
}
- }
-
+ };
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/js/ipb3Hooks.js b/upload/admin/applications/core/js/ipb3Hooks.js
index 155aa032..3737e1bc 100644
--- a/upload/admin/applications/core/js/ipb3Hooks.js
+++ b/upload/admin/applications/core/js/ipb3Hooks.js
@@ -1,207 +1,275 @@
-
-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( "" + ipb.lang['hook_filename'] + " " );
- var li2 = new Element( 'li' ).update( "" + ipb.lang['hook_classname'] + " " );
- var li3 = new Element( 'li' ).update( "" + ipb.lang['hook_filetype'] + " " + ipb.lang['hook_filetype_select'] + " " + ipb.lang['hook_filetype_action'] + " " + ipb.lang['hook_filetype_skin'] + " " + ipb.lang['hook_filetype_template'] + " " );
-
- $('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§ion=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( "" + ipb.lang['hook_skingroup'] + " " + 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( "" + ipb.lang['hook_extends'] + " " );
- $('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§ion=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( "" + ipb.lang['hook_skinfunc'] + " " + 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( "" + ipb.lang['hook_temptype'] + " " + ipb.lang['hook_filetype_select'] + " foreach loop if statement " );
- $('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§ion=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( "" + ipb.lang['hook_hookid'] + " " + 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 += "" + ipb.lang['hook_filetype_select'] + " ";
-
- if( type == 'foreach' )
- {
- options += "(outer.pre) " + ipb.lang['a_outerpre'] + " ";
- options += "(inner.pre) " + ipb.lang['a_innerpre'] + " ";
- options += "(inner.post) " + ipb.lang['a_innerpost']+ " ";
- options += "(outer.post) " + ipb.lang['a_outerpost']+ " ";
- }
- else
- {
- options += "(pre.startif) " + ipb.lang['a_prestartif'] + " ";
- options += "(post.startif) " + ipb.lang['a_poststartif'] + " ";
- options += "(pre.else) " + ipb.lang['a_preelse'] + " ";
- options += "(post.else) " + ipb.lang['a_postelse'] + " ";
- options += "(pre.endif) " + ipb.lang['a_preendif'] + " ";
- options += "(post.endif) " + ipb.lang['a_postendif'] + " ";
- }
-
- var li1 = new Element( 'li', { 'id': 'tr_position[' + elementIndex + ']' } ).update( "" + ipb.lang['hook_temptype'] + " " + options + " " );
- $('fileTable_' + elementIndex).insert( li1 );
+
+function addAnotherFile()
+{
+ elementIndex = parseInt(elementIndex) + 1;
+
+ var header = new Element( 'div', { 'class': 'tablesubheader' } );
+ header.update( ipb.lang['hookfilenumber'] + elementIndex );
+
+ var list = new Element( 'ul', { 'id': 'fileTable_' + elementIndex } );
+ list.addClassName( 'acp-form' );
+ list.addClassName( 'alternate_rows' );
+
+ $('fileTableContainer').insert( header );
+ $('fileTableContainer').insert( list );
+
+ var li1 = new Element( 'li' ).update( "" + ipb.lang['hook_filename'] + " " );
+ var li2 = new Element( 'li' ).update( "" + ipb.lang['hook_classname'] + " " );
+ var li3 = new Element( 'li' ).update( "" + ipb.lang['hook_filetype'] + " " + ipb.lang['hook_filetype_select'] + " " + ipb.lang['hook_filetype_action'] + " " + ipb.lang['hook_filetype_skin'] + " " + ipb.lang['hook_filetype_template'] + " " + ipb.lang['hook_filetype_data'] + " " + ipb.lang['hook_filetype_library'] + " " );
+
+ $('fileTable_' + elementIndex).insert( li1 );
+ $('fileTable_' + elementIndex).insert( li2 );
+ $('fileTable_' + elementIndex).insert( li3 );
+
+ doStriping();
+}
+
+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( $('tr_dataLocation[' + elementIndex + ']') != null )
+ {
+ $('tr_dataLocation[' + elementIndex + ']').remove();
+ }
+
+
+ if( $('tr_libApplication[' + elementIndex + ']') != null )
+ {
+ $('tr_libApplication[' + elementIndex + ']').remove();
+ }
+
+ if( type == 'templateHooks' )
+ {
+ // Show the skin dropdown now
+
+ url = ipb.vars['base_url'] + "app=core&module=ajax§ion=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( "" + ipb.lang['hook_skingroup'] + " " + t.responseText );
+ $('fileTable_' + elementIndex).insert( li1 );
+ doStriping();
+ },
+ onException: function( f,e ){ alert( "Exception: " + e ); },
+ onFailure: function( t ){ alert( "Failure: " + t.responseText ); }
+ } );
+ }
+ else if( type == 'dataHooks' )
+ {
+ // Show the data location dropdown now
+
+ url = ipb.vars['base_url'] + "app=core&module=ajax§ion=hooks&do=getDataLocationsForAdd&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_dataLocation[' + elementIndex + ']' } ).update( "" + ipb.lang['hook_data_location'] + " " + t.responseText );
+ $('fileTable_' + elementIndex).insert( li1 );
+ doStriping();
+ },
+ onException: function( f,e ){ alert( "Exception: " + e ); },
+ onFailure: function( t ){ alert( "Failure: " + t.responseText ); }
+ } );
+ }
+ else if( type == 'libraryHooks' )
+ {
+ var li1 = new Element( 'li', { 'id': 'tr_classToOverload[' + elementIndex + ']' } ).update( "" + ipb.lang['hook_extends'] + " " );
+ $('fileTable_' + elementIndex).insert( li1 );
+
+ // Show the data location dropdown now
+
+ url = ipb.vars['base_url'] + "app=core&module=ajax§ion=hooks&do=getApplications&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_libApplication[' + elementIndex + ']' } ).update( "" + ipb.lang['hook_application'] + " " + t.responseText );
+ $('fileTable_' + elementIndex).insert( li1 );
+ doStriping();
+ },
+ 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( "" + ipb.lang['hook_extends'] + " " );
+ $('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§ion=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( "" + ipb.lang['hook_skinfunc'] + " " + t.responseText );
+ $('fileTable_' + elementIndex).insert( li1 );
+ doStriping();
+ },
+ 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( "" + ipb.lang['hook_temptype'] + " " + ipb.lang['hook_filetype_select'] + " foreach loop if statement " );
+ $('fileTable_' + elementIndex).insert( li1 );
+
+ doStriping();
+}
+
+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§ion=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( "" + ipb.lang['hook_hookid'] + " " + t.responseText );
+ $('fileTable_' + elementIndex).insert( li1 );
+ doStriping();
+ },
+ 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 += "" + ipb.lang['hook_filetype_select'] + " ";
+
+ if( type == 'foreach' )
+ {
+ options += "(outer.pre) " + ipb.lang['a_outerpre'] + " ";
+ options += "(inner.pre) " + ipb.lang['a_innerpre'] + " ";
+ options += "(inner.post) " + ipb.lang['a_innerpost']+ " ";
+ options += "(outer.post) " + ipb.lang['a_outerpost']+ " ";
+ }
+ else
+ {
+ options += "(pre.startif) " + ipb.lang['a_prestartif'] + " ";
+ options += "(post.startif) " + ipb.lang['a_poststartif'] + " ";
+ options += "(pre.else) " + ipb.lang['a_preelse'] + " ";
+ options += "(post.else) " + ipb.lang['a_postelse'] + " ";
+ options += "(pre.endif) " + ipb.lang['a_preendif'] + " ";
+ options += "(post.endif) " + ipb.lang['a_postendif'] + " ";
+ }
+
+ var li1 = new Element( 'li', { 'id': 'tr_position[' + elementIndex + ']' } ).update( "" + ipb.lang['hook_tempposi'] + " " + options + " " );
+ $('fileTable_' + elementIndex).insert( li1 );
+
+ doStriping();
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/js/ipb3Replacements.js b/upload/admin/applications/core/js/ipb3Replacements.js
index 8f4bcb88..b8b6273f 100644
--- a/upload/admin/applications/core/js/ipb3Replacements.js
+++ b/upload/admin/applications/core/js/ipb3Replacements.js
@@ -51,7 +51,7 @@ function IPBReplacements()
{
/* Build Replacements list */
this.buildReplacementsList();
- }
+ };
/**
* Load css groups
@@ -88,10 +88,10 @@ function IPBReplacements()
alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
}
},
- onException: function( f,e ){ alert( "Exception: " + e ) },
- onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
+ onException: function( f,e ){ alert( "Exception: " + e ); },
+ onFailure: function( t ){ alert( "Failure: " + t.responseText ); }
} );
- }
+ };
/**
* Save Replacements
@@ -144,10 +144,10 @@ function IPBReplacements()
alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
}
},
- onException: function( f,e ){ alert( "Exception: " + e ) },
- onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
+ onException: function( f,e ){ alert( "Exception: " + e ); },
+ onFailure: function( t ){ alert( "Failure: " + t.responseText ); }
} );
- }
+ };
/**
* Revert css
@@ -204,10 +204,10 @@ function IPBReplacements()
alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
}
},
- onException: function( f,e ){ alert( "Exception: " + e ) },
- onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
+ onException: function( f,e ){ alert( "Exception: " + e ); },
+ onFailure: function( t ){ alert( "Failure: " + t.responseText ); }
} );
- }
+ };
/**
* Add Replacements form
@@ -215,7 +215,7 @@ function IPBReplacements()
this.addReplacementsForm = function()
{
IPB3Replacements.showReplacementsEditor( 0 );
- }
+ };
/**
* Shows the template editor
@@ -263,7 +263,7 @@ function IPBReplacements()
}
ipb.positionCenter( 'tplate_editor_' + replacement_id );
- }
+ };
/**
* Preview the replacement
@@ -301,7 +301,7 @@ function IPBReplacements()
document.body.appendChild( _div );
ipb.positionCenter( 'tplate_preview_' + _data['replacement_id'] );
- }
+ };
/**
* Close Preview
@@ -315,7 +315,7 @@ function IPBReplacements()
catch(e)
{
}
- }
+ };
/**
* Shows the template editor
@@ -334,7 +334,7 @@ function IPBReplacements()
catch(e)
{
}
- }
+ };
/**
* Build a list of Replacements groups (files)
@@ -405,7 +405,7 @@ function IPBReplacements()
}
} );
- }
+ };
/**
* Template Mouse Event
@@ -442,6 +442,5 @@ function IPBReplacements()
}
}
}
- }
-
+ };
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/js/ipb3TemplateDiff.js b/upload/admin/applications/core/js/ipb3TemplateDiff.js
index 842c4cbf..d6ea9089 100644
--- a/upload/admin/applications/core/js/ipb3TemplateDiff.js
+++ b/upload/admin/applications/core/js/ipb3TemplateDiff.js
@@ -63,8 +63,11 @@ function IPBTemplateDiff()
/**
* URLS
*/
- this.baseUrl = '';
- this.imageUrl = '';
+ this.baseUrl = '';
+ this.baseUrlMerge = '';
+ this.imageUrl = '';
+ this.doneUrl = '';
+ this.currentAction = 'process';
/*
* Stored JSON
@@ -96,7 +99,7 @@ function IPBTemplateDiff()
this.beginDiff = function()
{
/* Start text output.. */
- this.updateCounter( 0 );
+ this.updateCounter( '' );
/* Reset progress bar */
this.updateProgressBar( false );
@@ -106,7 +109,7 @@ function IPBTemplateDiff()
/* Start off with the SQL */
this.fireAjax( 0 );
- }
+ };
/**
* Update the progress bar
@@ -170,9 +173,9 @@ function IPBTemplateDiff()
if ( IPB3TemplateDiff.currentImage != _img )
{
$( 'diffStatusImage' ).src = IPB3TemplateDiff.imageUrl + _img;
- IPB3TemplateDiff.currentImage = _img;
+ IPB3TemplateDiff.currentImage = _img;
}
- }
+ };
/**
* Fire Ajax
@@ -182,7 +185,7 @@ function IPBTemplateDiff()
/* Update image */
this.updateProgressImage( 'send' );
- new Ajax.Request( this.baseUrl + '&do=process',
+ new Ajax.Request( this.baseUrl.replace( /&/g, '&' ) + '&do=' + this.currentAction,
{
method: 'get',
onSuccess: this.processAjax.bind(this),
@@ -214,14 +217,14 @@ function IPBTemplateDiff()
*/
this.timeOutAjax = function( t )
{
- if ( confirm( "No response from the webserver.\nDo you wish to continue waiting?" ) )
+ if ( confirm( "Нет ответа от сервера.\nХотите подождать?" ) )
{
return true;
}
else
{
t.transport.abort();
- alert( "Request Cancelled" );
+ alert( "Запрос отменен" );
}
};
@@ -230,7 +233,7 @@ function IPBTemplateDiff()
*/
this.failureAjax = function( t )
{
- alert( "Failure: " + t.responseText );
+ alert( "Ошибка: " + t.responseText );
};
/**
@@ -238,8 +241,8 @@ function IPBTemplateDiff()
*/
this.exceptionAjax = function( t )
{
- alert( "Exception: " + t.responseText );
- }
+ alert( "Исключение: " + t.responseText );
+ };
/**
* Process Ajax (Success)
@@ -252,7 +255,8 @@ function IPBTemplateDiff()
/* Not a JSON response? */
if ( ! t.responseText.match( /^(\s+?)?\{/ ) )
{
- alert( "Error:\n" + t.responseText );
+ alert( "Ошибка:\n" + t.responseText );
+ Debug.write( t );
return;
}
@@ -261,16 +265,24 @@ function IPBTemplateDiff()
if ( json['error'] )
{
- alert( "An error occured: " . json['error'] );
+ alert( "Ошибка: " . json['error'] );
return false;
}
/* All good: Update status message... */
- this.updateCounter( json['processed'] );
+ this.updateCounter( json['title'], json['message'] );
/* Update progress bar */
this.updateProgressBar( json['processed'] );
+ if ( json['perGo'] )
+ {
+ this.baseUrl = this.baseUrl.replace( 'perGo=(\d+?)', 'perGo=' + json['perGo'] );
+ this.perGo = json['perGo'];
+ }
+
+ this.totalBits = json['totalBits'] ? json['totalBits'] : this.totalBits;
+
/* Finish? If so - say all done and go tubby-bye-bye */
if ( json['completed'] != 1 )
{
@@ -279,21 +291,33 @@ function IPBTemplateDiff()
}
else
{
- /* All Done */
- this.updateProgressBar( -1 );
- this.updateProgressImage( 'ready' );
+ /* Diff? Then merge */
+ if ( this.currentAction == 'process' )
+ {
+ this.currentAction = 'merge';
+ this.perGo = 10;
+ this.baseUrl = this.baseUrl.replace( 'perGo=(\d+?)', 'perGo=' + this.perGo );
+ /* Go ahead */
+ this.beginDiff();
+ }
+ else
+ {
+ /* All Done */
+ this.updateProgressBar( -1 );
+ this.updateProgressImage( 'ready' );
- /* Show done thing */
- $( 'diffDone' ).show();
+ /* Show done thing */
+ window.location = this.doneUrl.replace( /&/g, '&' );
+ }
}
};
/**
* Write to Log
*/
- this.updateCounter = function( count )
+ this.updateCounter = function( title, msg )
{
- $( 'diffLogProcessed' ).innerHTML = count;
+ $( 'diffLogTitle' ).update( title );
+ $( 'diffLogText' ).update( msg );
};
-
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/js/ipb3TemplateSandR.js b/upload/admin/applications/core/js/ipb3TemplateSandR.js
index a81cea6f..9cf8d809 100644
--- a/upload/admin/applications/core/js/ipb3TemplateSandR.js
+++ b/upload/admin/applications/core/js/ipb3TemplateSandR.js
@@ -50,7 +50,7 @@ function IPBTemplateSandR()
{
cbox.checked = checked;
});
- }
+ };
/**
* Check group check box
@@ -71,7 +71,7 @@ function IPBTemplateSandR()
});
$( 'cbox_group_' + groupName ).checked = ( _allCount == _checkedCount ) ? true : false;
- }
+ };
/**
* Load template bits
@@ -105,10 +105,10 @@ function IPBTemplateSandR()
alert( "Галектеко ОПАСНОСТЕ! ПЫЩПЫЩ!11: " + t.responseText );
}
},
- onException: function( f,e ){ alert( "Исключение: " + e ) },
- onFailure: function( t ){ alert( "Ошибка: " + t.responseText ) }
+ onException: function( f,e ){ alert( "Исключение: " + e ); },
+ onFailure: function( t ){ alert( "Ошибка: " + t.responseText ); }
} );
- }
+ };
/**
* Shows the template editor
@@ -128,7 +128,7 @@ function IPBTemplateSandR()
document.body.appendChild( _div );
ipb.positionCenter( 'tplate_editor_' + json['templateData']['template_id'] );
- }
+ };
/**
* Peform the placements
@@ -175,10 +175,10 @@ function IPBTemplateSandR()
alert( "Галектеко ОПАСНОСТЕ! ПЫЩПЫЩ!11: " + t.responseText );
}
},
- onException: function( f,e ){ alert( "Исключение: " + e ) },
- onFailure: function( t ){ alert( "Ошибка: " + t.responseText ) }
+ onException: function( f,e ){ alert( "Исключение: " + e ); },
+ onFailure: function( t ){ alert( "Ошибка: " + t.responseText ); }
} );
- }
+ };
/**
* Save template bit
@@ -201,7 +201,7 @@ function IPBTemplateSandR()
parameters: params,
onSuccess: function (t )
{
- if ( t.responseText.match( /^(\s+?)?\{/ ) )
+ if ( t.responseText.match( /^(\s*?)?\{/ ) )
{
eval( "var json = " + t.responseText );
@@ -231,10 +231,10 @@ function IPBTemplateSandR()
alert( "Галектеко ОПАСНОСТЕ! ПЫЩПЫЩ!11: " + t.responseText );
}
},
- onException: function( f,e ){ alert( "Исключение: " + e ) },
- onFailure: function( t ){ alert( "Ошибка: " + t.responseText ) }
+ //onException: function( f,e ){ alert( "Исключение: " + e ) },
+ onFailure: function( t ){ alert( "Ошибка: " + t.responseText ); }
} );
- }
+ };
/**
* Shows the template editor
@@ -248,7 +248,7 @@ function IPBTemplateSandR()
catch(e)
{
}
- }
+ };
/**
* Build a list of template groups
@@ -389,5 +389,5 @@ function IPBTemplateSandR()
}
} );
}
- }
+ };
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/js/ipb3Templates.js b/upload/admin/applications/core/js/ipb3Templates.js
index 6da5b601..423938ad 100644
--- a/upload/admin/applications/core/js/ipb3Templates.js
+++ b/upload/admin/applications/core/js/ipb3Templates.js
@@ -66,7 +66,7 @@ function IPBTemplates()
$('tplate_bitList').setStyle( { 'height' : $('tplate_groupList').getHeight() + 'px', 'overflow' : 'auto'} );
this.loadTemplateBits( this.currentTemplateGroup );
- }
+ };
/**
* Load template groups
@@ -103,13 +103,13 @@ function IPBTemplates()
}
else
{
- alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
+ alert( "Ошибка: " + t.responseText );
}
},
- onException: function( f,e ){ alert( "Exception: " + e ) },
- onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
+ onException: function( f,e ){ alert( "Исключение: " + e ); },
+ onFailure: function( t ){ alert( "Ошибка: " + t.responseText ); }
} );
- }
+ };
/**
* Load template bits
@@ -169,13 +169,13 @@ function IPBTemplates()
}
else
{
- alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
+ alert( "Ошибка: " + t.responseText );
}
},
- onException: function( f,e ){ alert( "Exception: " + e ) },
- onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
+ onException: function( f,e ){ alert( "Исключение: " + e ); },
+ onFailure: function( t ){ alert( "Ошибка: " + t.responseText ); }
} );
- }
+ };
/**
* Save template bit
@@ -222,23 +222,23 @@ function IPBTemplates()
if ( json['errors'] )
{
/* Something inline would be very nice here.. rather than this ugly alert */
- alert("UGLY ALERT BOX SAYS: " + json['errors'] );
+ alert("Ошибка: " + json['errors'] );
}
else
{
- alert("UGLY ALERT BOX SAYS: Saved!");
+ alert("Сохранено!");
}
}
}
else
{
- alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
+ alert( "Ошибка: " + t.responseText );
}
},
- onException: function( f,e ){ alert( "Exception: " + e ) },
- onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
+ onException: function( f,e ){ alert( "Исключение: " + e ); },
+ onFailure: function( t ){ alert( "Ошибка: " + t.responseText ); }
} );
- }
+ };
/**
* Revert template bit
@@ -248,14 +248,14 @@ function IPBTemplates()
/* 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!" ) )
+ if ( ! confirm( "Удалить шаблон?\n Произойдет удаление шаблона из ВСЕХ стилей!" ) )
{
return false;
}
}
else
{
- if ( ! confirm( "Revert template bit?\n All changes WILL be lost!" ) )
+ if ( ! confirm( "Откатить изменения?\n Все изменения БУДУТ УТРАЧЕНЫ!" ) )
{
return false;
}
@@ -295,19 +295,19 @@ function IPBTemplates()
if ( json['errors'] )
{
/* Something inline would be very nice here.. rather than this ugly alert */
- alert("UGLY ALERT BOX SAYS: " + json['errors'] );
+ alert("Ошибка: " + json['errors'] );
}
}
}
else
{
- alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
+ alert( "Ошибка: " + t.responseText );
}
},
- onException: function( f,e ){ alert( "Exception: " + e ) },
- onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
+ onException: function( f,e ){ alert( "Исключение: " + e ); },
+ onFailure: function( t ){ alert( "Ошибка: " + t.responseText ); }
} );
- }
+ };
/**
* Load template bits
@@ -338,13 +338,13 @@ function IPBTemplates()
}
else
{
- alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
+ alert( "Ошибка: " + t.responseText );
}
},
- onException: function( f,e ){ alert( "Exception: " + e ) },
- onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
+ onException: function( f,e ){ alert( "Исключение: " + e ); },
+ onFailure: function( t ){ alert( "Ошибка: " + t.responseText ); }
} );
- }
+ };
/**
* Shows the new template bit form
@@ -369,7 +369,7 @@ function IPBTemplates()
ipb.positionCenter( 'tplate_editor_0' );
IPB3Templates.currentTemplateBit = _data;
- }
+ };
/**
* Shows the template editor
@@ -389,7 +389,7 @@ function IPBTemplates()
document.body.appendChild( _div );
ipb.positionCenter( 'tplate_editor_' + json['templateData']['template_id'] );
- }
+ };
/**
* Shows the template editor
@@ -408,7 +408,7 @@ function IPBTemplates()
catch(e)
{
}
- }
+ };
/**
* Shows a group entry as 'lit'
@@ -430,7 +430,7 @@ function IPBTemplates()
$('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
@@ -455,7 +455,7 @@ function IPBTemplates()
/* Write it out */
$('tplate_groupList').update( _output );
- }
+ };
/**
* Build a list of template bits
@@ -520,8 +520,7 @@ function IPBTemplates()
$('tplate_templateRow_' + json['templates'][i]['template_id'] + '_revert').hide();
}
}
- }
-
+ };
/**
* Template Mouse Event
@@ -554,7 +553,7 @@ function IPBTemplates()
}
}
}
- }
+ };
/**
* Group Mouse Event
@@ -578,6 +577,5 @@ function IPBTemplates()
IPB3Templates.loadTemplateBits( _groupName );
}
- }
-
+ };
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/js/ipb3uAgents.js b/upload/admin/applications/core/js/ipb3uAgents.js
index 88af078a..b35358ab 100644
--- a/upload/admin/applications/core/js/ipb3uAgents.js
+++ b/upload/admin/applications/core/js/ipb3uAgents.js
@@ -52,7 +52,7 @@ function IPBUAgents()
{
/* Build uagents list */
this.buildUAgentsList();
- }
+ };
/**
* INIT User Agent Form
@@ -79,7 +79,7 @@ function IPBUAgents()
/* Build uagents list that are already in the group */
this.buildGroupAgentsUsedList();
- }
+ };
/**
* Save uagents
@@ -122,23 +122,23 @@ function IPBUAgents()
if ( json['errors'] )
{
/* Something inline would be very nice here.. rather than this ugly alert */
- alert("UGLY ALERT BOX SAYS: " + json['errors'] );
+ alert("Ошибка: " + json['errors'] );
}
else
{
- alert("UGLY ALERT BOX SAYS: Saved!");
+ alert("Сохранено!");
}
}
}
else
{
- alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
+ alert( "Ошибка: " + t.responseText );
}
},
- onException: function( f,e ){ alert( "Exception: " + e ) },
- onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
+ onException: function( f,e ){ alert( "Исключение: " + e ); },
+ onFailure: function( t ){ alert( "Ошибка: " + t.responseText ); }
} );
- }
+ };
/**
* Revert css
@@ -146,7 +146,7 @@ function IPBUAgents()
this.removeuAgent = function( uagent_id )
{
/* Make sure we're mean it... */
- if ( ! confirm( "Remove user agent?\\nThis will be removed permanently" ) )
+ if ( ! confirm( "Удалить user agent?\\nОн будет удален полностью из системы" ) )
{
return false;
}
@@ -177,19 +177,19 @@ function IPBUAgents()
if ( json['errors'] )
{
/* Something inline would be very nice here.. rather than this ugly alert */
- alert("UGLY ALERT BOX SAYS: " + json['errors'] );
+ alert("Ошибка: " + json['errors'] );
}
}
}
else
{
- alert( "Ooops. Something went wrong. Does this help?: " + t.responseText );
+ alert( "Ошибка: " + t.responseText );
}
},
- onException: function( f,e ){ alert( "Exception: " + e ) },
- onFailure: function( t ){ alert( "Failure: " + t.responseText ) }
+ onException: function( f,e ){ alert( "Исключение: " + e ); },
+ onFailure: function( t ){ alert( "Ошибка: " + t.responseText ); }
} );
- }
+ };
/**
* Add uagents form
@@ -197,7 +197,7 @@ function IPBUAgents()
this.adduAgentForm = function()
{
IPB3UAgents.showuAgentsEditor( 0 );
- }
+ };
/**
* Shows the template editor
@@ -235,7 +235,7 @@ function IPBUAgents()
/* Adjust title */
if ( ! uagent_id )
{
- $('tplate_title_' + uagent_id ).update("Adding User Agent");
+ $('tplate_title_' + uagent_id ).update("Добавление User Agent");
}
/* Select box type */
@@ -250,7 +250,7 @@ function IPBUAgents()
};
ipb.positionCenter( 'tplate_editor_' + uagent_id );
- }
+ };
/**
* Close the editor
@@ -269,7 +269,7 @@ function IPBUAgents()
catch(e)
{
}
- }
+ };
/**
* Build a list of uagents groups (files)
@@ -304,7 +304,7 @@ function IPBUAgents()
/* 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
@@ -337,7 +337,7 @@ function IPBUAgents()
}
}
}
- }
+ };
/**
* Build a list of USED uagents
@@ -395,7 +395,7 @@ function IPBUAgents()
/* Update hidden field */
$('uAgentsData').value = Object.toJSON( _save );
- }
+ };
/**
* Save user agent form
@@ -403,7 +403,7 @@ function IPBUAgents()
this.saveGroupForm = function()
{
$('uAgentsForm').submit();
- }
+ };
/**
* Template Mouse Event
@@ -436,7 +436,7 @@ function IPBUAgents()
}
}
}
- }
+ };
/**
* Close the editor
@@ -455,7 +455,7 @@ function IPBUAgents()
catch(e)
{
}
- }
+ };
/**
* Shows the versions editor
@@ -483,7 +483,7 @@ function IPBUAgents()
document.body.appendChild( _div );
ipb.positionCenter( 'tplate_versions_' + uagent_id );
- }
+ };
/**
* Save agent version info
@@ -498,7 +498,7 @@ function IPBUAgents()
/* Close any open editors */
IPB3UAgents.cancelAgentVersion();
- }
+ };
/**
* Add user agent to the list
@@ -516,7 +516,7 @@ function IPBUAgents()
/* Build uagents list that are already in the group */
IPB3UAgents.buildGroupAgentsUsedList();
- }
+ };
/**
* Add user agent to the list
@@ -535,7 +535,7 @@ function IPBUAgents()
/* Build uagents list that are already in the group */
IPB3UAgents.buildGroupAgentsUsedList();
- }
+ };
/**
* Template Mouse Event
@@ -559,7 +559,7 @@ function IPBUAgents()
IPB3UAgents.groupAddToList( _uagent_id );
}
}
- }
+ };
/**
* Build a list of uagents
@@ -599,6 +599,5 @@ function IPBUAgents()
$('tplate_agentimg_' + json['uagents'][i]['uagent_id'] ).src += 'type_' + json['uagents'][i]['uagent_type'] + '.png';
}
} );
- }
-
+ };
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/ajax/compare.php b/upload/admin/applications/core/modules_admin/ajax/compare.php
index d6f082dc..6b1855f9 100644
--- a/upload/admin/applications/core/modules_admin/ajax/compare.php
+++ b/upload/admin/applications/core/modules_admin/ajax/compare.php
@@ -1,221 +1,223 @@
-Incorrect accessYou 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", " ", $difference );
- $difference = str_replace( "><", ">\n<" ,$difference );
- $difference = preg_replace( "#(?', $difference );
- $difference = str_replace( "\n", ' ', $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", " ", $difference );
- $difference = str_replace( "><", ">\n<" ,$difference );
- $difference = preg_replace( "#(?', $difference );
- $difference = str_replace( "\n", ' ', $difference );
- $difference = str_replace( "><", ">\n<" ,$difference );
- $difference = str_replace( "\t", " ", $difference );
- }
-
- $this->returnHtml( $this->html->differenceResult( $difference ) );
- }
-
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Template comparison
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since Friday 19th May 2006 17:33
+ * @version $Revision: 5713 $
+ */
+
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access 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", " ", $difference );
+ $difference = str_replace( "><", ">\n<" ,$difference );
+ $difference = preg_replace( "#(?', $difference );
+ $difference = str_replace( "\n", ' ', $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", " ", $difference );
+ $difference = str_replace( "><", ">\n<" ,$difference );
+ $difference = preg_replace( "#(?', $difference );
+ $difference = str_replace( "\n", ' ', $difference );
+ $difference = str_replace( "><", ">\n<" ,$difference );
+ $difference = str_replace( "\t", " ", $difference );
+ }
+
+ $this->returnHtml( $this->html->differenceResult( $difference ) );
+ }
+
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/ajax/css.php b/upload/admin/applications/core/modules_admin/ajax/css.php
index 6245c983..a90bed41 100644
--- a/upload/admin/applications/core/modules_admin/ajax/css.php
+++ b/upload/admin/applications/core/modules_admin/ajax/css.php
@@ -1,19 +1,21 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* AJAX Functions For applications/core/js/ipb3CSS.js file
- * Last Updated: $Date: 2009-09-30 10:45:37 -0400 (Wed, 30 Sep 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Friday 19th May 2006 17:33
- * @version $Revision: 5183 $
+ * @version $Revision: 5713 $
*/
diff --git a/upload/admin/applications/core/modules_admin/ajax/findnames.php b/upload/admin/applications/core/modules_admin/ajax/findnames.php
new file mode 100644
index 00000000..80616282
--- /dev/null
+++ b/upload/admin/applications/core/modules_admin/ajax/findnames.php
@@ -0,0 +1,111 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Login handler abstraction : AJAX Find Names functions
+ * Last Updated: $Date: 2010-02-22 08:06:40 -0500 (Mon, 22 Feb 2010) $
+ *
+ *
+ * @author $Author: josh $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since Tuesday 1st March 2005 (11:52)
+ * @version $Revision: 5857 $
+ * @see public_core_ajax_findnames
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class admin_core_ajax_findnames extends ipsAjaxCommand
+{
+ /**
+ * Class entry point
+ *
+ * @access public
+ * @param object Registry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ switch( $this->request['do'] )
+ {
+ case 'get-member-names':
+ $this->_getMemberNames();
+ break;
+ }
+ }
+
+ /**
+ * Returns possible matches for the string input
+ *
+ * @access private
+ * @return void Outputs to screen
+ */
+ private function _getMemberNames()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $name = IPSText::convertUnicode( $this->convertAndMakeSafe( ipsRegistry::$request['name'], 0 ) );
+
+ //-----------------------------------------
+ // Check length
+ //-----------------------------------------
+
+ if ( IPSText::mbstrlen( $name ) < 3 )
+ {
+ $this->returnJsonError( 'requestTooShort' );
+ }
+
+ //-----------------------------------------
+ // Try query...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => 'm.members_display_name, m.name, m.member_id, m.member_group_id',
+ 'from' => array( 'members' => 'm' ),
+ 'where' => "m.members_l_display_name LIKE '" . $this->DB->addSlashes( mb_strtolower( $name ) ) . "%'",
+ 'order' => $this->DB->buildLength( 'm.members_display_name' ) . ' ASC',
+ 'limit' => array( 0, 15 ),
+ 'add_join' => array( array( 'select' => 'p.*',
+ 'from' => array( 'profile_portal' => 'p' ),
+ 'where' => 'p.pp_member_id=m.member_id',
+ 'type' => 'left' ) ) ) );
+ $this->DB->execute();
+
+ //-----------------------------------------
+ // Got any results?
+ //-----------------------------------------
+
+ if ( ! $this->DB->getTotalRows() )
+ {
+ $this->returnJsonArray( array( ) );
+ }
+
+ $return = array();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $photo = IPSMember::buildProfilePhoto( $r );
+ $group = IPSLib::makeNameFormatted( '' , $r['member_group_id'] );
+ $return[ $r['member_id'] ] = array( 'name' => $r['members_display_name'],
+ 'showas'=> '' . $r['members_display_name'] . ' (' . $group . ')',
+ 'img' => $photo['pp_thumb_photo'],
+ 'img_w' => $photo['pp_mini_width'],
+ 'img_h' => $photo['pp_mini_height']
+ );
+ }
+
+ $this->returnJsonArray( $return );
+ }
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/ajax/hooks.php b/upload/admin/applications/core/modules_admin/ajax/hooks.php
index 7891bdf6..a01b0a65 100644
--- a/upload/admin/applications/core/modules_admin/ajax/hooks.php
+++ b/upload/admin/applications/core/modules_admin/ajax/hooks.php
@@ -1,1016 +1,1093 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class admin_core_ajax_hooks extends ipsAjaxCommand
-{
- /**
- * Cache object
- *
- * @access public
- * @var object
- */
- public $cache;
-
- /**
- * Hook ID
- *
- * @access public
- * @var integer
- */
- public $hookId;
-
- /**
- * Hook data
- *
- * @access public
- * @var array
- */
- public $hook;
-
- /**
- * Hook's export settings
- *
- * @access public
- * @var array
- */
- public $data;
-
- /**
- * Hooks library
- *
- * @access private
- * @var object Hooks library
- */
- private $hooksFunctions;
-
- /**
- * Main class entry point
- *
- * @access public
- * @param object ipsRegistry reference
- * @return void [Outputs to screen]
- */
- public function doExecute( ipsRegistry $registry )
- {
- //-----------------------------------------
- // Load skin
- //-----------------------------------------
-
- $this->html = ipsRegistry::getClass('output')->loadTemplate('cp_skin_hooks_export');
-
- //-----------------------------------------
- // Load hooks library
- //-----------------------------------------
-
- require_once( IPSLib::getAppDir('core') . '/sources/classes/hooksFunctions.php' );
- $this->hooksFunctions = new hooksFunctions( $registry );
-
- //-----------------------------------------
- // Load lang
- //-----------------------------------------
-
- ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_hooks' ) );
-
- switch( $this->request['do'] )
- {
- case 'getStrings':
- $this->_getAjaxStrings();
- break;
-
- case 'getLangFiles':
- $this->_getAjaxFiles();
- break;
-
- case 'getTemplates':
- $this->_getAjaxTemplates();
- break;
-
- case 'getSkinFiles':
- $this->_getAjaxSkins();
- break;
-
- // These are for the add file form
- case 'getGroupsForAdd':
- $this->_getGroupsForAdd();
- break;
-
- case 'getTemplatesForAdd':
- $this->_getTemplatesForAdd();
- break;
-
- case 'getHookIds':
- $this->_getHookIds();
- break;
-
- case 'save':
- $this->save();
- break;
-
- case 'show':
- default:
- $this->show();
- break;
- }
- }
-
- /**
- * Get all hook ids for a template/type
- *
- * @access protected
- * @return void [Outputs to screen]
- */
- protected function _getHookIds()
- {
- $i = intval( $this->request['i'] );
- $template = IPSText::alphanumericalClean( $this->request['template'] );
- $type = IPSText::alphanumericalClean( $this->request['type'] );
- $return = $this->hooksFunctions->getHookIds( $template, $type );
-
- $output = $this->registry->output->formDropdown( "id[{$i}]", $return, null, "id[{$i}]", "onchange='getHookEntryPoints({$i});'" );
-
- $this->returnHtml( $output );
- }
-
- /**
- * Get all skin files
- *
- * @access protected
- * @return void [Outputs to screen]
- */
- protected function _getGroupsForAdd()
- {
- $i = intval( $this->request['i'] );
-
- $_skinFiles = $this->hooksFunctions->getSkinGroups();
- $output = $this->registry->output->formDropdown( "skinGroup[{$i}]", $_skinFiles, null, "skinGroup[{$i}]", "onchange='getTemplatesForAdd({$i});'" );
-
- $this->returnHtml( $output );
- }
-
- /**
- * Get all skin templates
- *
- * @access protected
- * @return void [Outputs to screen]
- */
- protected function _getTemplatesForAdd()
- {
- $i = intval( $this->request['i'] );
- $group = IPSText::alphanumericalClean( $this->request['group'] );
-
- $_strings = $this->hooksFunctions->getSkinMethods( $group, true );
- $output = $this->registry->output->formDropdown( "skinFunction[{$i}]", $_strings, null, "skinFunction[{$i}]", "onchange='getTypeOfHook({$i});'" );
-
- $this->returnHtml( $output );
- }
-
- /**
- * Get language strings in a given file
- *
- * @access protected
- * @return void [Outputs to screen]
- */
- protected function _getAjaxStrings()
- {
- $group = IPSText::alphanumericalClean( $this->request['group'] );
- $i = intval( $this->request['i'] );
- $hook = intval( $this->request['id'] );
-
- $this->hookId = intval( $this->request['id'] );
- $this->hook = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $this->hookId ) );
- $this->data = unserialize($this->hook['hook_extra_data']);
-
- $_strings = $this->hooksFunctions->getStrings( $group );
- $output = $this->registry->output->formMultiDropdown( "strings_{$i}[]", $_strings, $this->data['language'][ $group ], 5, "strings_{$i}", "", "' style='width: 100%'" );
-
- $this->returnHtml( $output );
- }
-
- /**
- * Get all language files
- *
- * @access protected
- * @return void [Outputs to screen]
- */
- protected function _getAjaxFiles()
- {
- $i = intval( $this->request['i'] );
- $hook = intval( $this->request['id'] );
-
- $this->hookId = intval( $this->request['id'] );
- $this->hook = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $this->hookId ) );
- $this->data = unserialize($this->hook['hook_extra_data']);
-
- $_langFiles = $this->hooksFunctions->getLanguageFiles();
- $output = $this->registry->output->formDropdown( "language_{$i}", $_langFiles, null, "language_{$i}", "onchange='acp.hooks.generateStrings({$i});'" );
-
- $this->returnHtml( $output );
- }
-
- /**
- * Get skin templates in a given file
- *
- * @access protected
- * @return void [Outputs to screen]
- */
- protected function _getAjaxTemplates()
- {
- $group = IPSText::alphanumericalClean( $this->request['group'] );
- $i = intval( $this->request['i'] );
- $hook = intval( $this->request['id'] );
-
- $this->hookId = intval( $this->request['id'] );
- $this->hook = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $this->hookId ) );
- $this->data = unserialize($this->hook['hook_extra_data']);
-
- $_strings = $this->hooksFunctions->getSkinMethods( $group );
- $output = $this->registry->output->formMultiDropdown( "templates_{$i}[]", $_strings, $this->data['templates'][ $group ], 5, "templates_{$i}", "", "' style='width: 100%'" );
-
- $this->returnHtml( $output );
- }
-
- /**
- * Get all skin files
- *
- * @access protected
- * @return void [Outputs to screen]
- */
- protected function _getAjaxSkins()
- {
- $i = intval( $this->request['i'] );
- $hook = intval( $this->request['id'] );
-
- $this->hookId = intval( $this->request['id'] );
- $this->hook = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $this->hookId ) );
- $this->data = unserialize($this->hook['hook_extra_data']);
-
- $_skinFiles = $this->hooksFunctions->getSkinGroups();
- $output = $this->registry->output->formDropdown( "skin_{$i}", $_skinFiles, null, "skin_{$i}", "onchange='acp.hooks.generateTemplates({$i});'" );
-
- $this->returnHtml( $output );
- }
-
- /**
- * Save the form
- *
- * @access protected
- * @return void [Outputs to screen]
- */
- protected function save()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $name = trim( IPSText::alphanumericalClean( $this->request['name'] ) );
- $this->hookId = intval( $this->request['id'] );
- $this->hook = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $this->hookId ) );
- $this->data = unserialize($this->hook['hook_extra_data']);
-
- $output = '';
-
- //-----------------------------------------
- // Got a hook?
- //-----------------------------------------
-
- if ( ! $this->hook['hook_id'] )
- {
- $this->returnJsonError( $this->lang->words['hook_cannot_load'] );
- }
-
- //-----------------------------------------
- // Run the proper operation
- //-----------------------------------------
-
- switch( $name )
- {
- case 'settings':
- $_settingGroups = $this->hooksFunctions->getSettingGroups();
- $_settings = $this->hooksFunctions->getSettings();
- $toSave = array();
- $toDisplay = array();
-
- $toSave['settingGroups'] = array();
- $toSave['settings'] = array();
-
- if( is_array($this->request['setting_groups']) AND count($this->request['setting_groups']) )
- {
- $toSave['settingGroups'] = $this->request['setting_groups'];
-
- foreach( $_settingGroups as $data )
- {
- if( in_array( $data[0], $toSave['settingGroups'] ) )
- {
- $toDisplay['settingGroups'][] = $data[1];
- }
- }
- }
-
- if( is_array($this->request['settings']) AND count($this->request['settings']) )
- {
- $toSave['settings'] = $this->request['settings'];
-
- foreach( $_settings as $data )
- {
- if( in_array( $data[0], $toSave['settings'] ) )
- {
- $toDisplay['settings'][] = $data[1];
- }
- }
- }
-
- $this->data['settingGroups'] = $toSave['settingGroups'];
- $this->data['settings'] = $toSave['settings'];
-
- if( count($toDisplay['settingGroups']) )
- {
- $output .= "{$this->lang->words['hook_setting_groups']} " . implode( ', ', $toDisplay['settingGroups'] );
- }
-
- if( count($toDisplay['settings']) )
- {
- if( count($toDisplay['settingGroups']) )
- {
- $output .= ' ';
- }
-
- $output .= "{$this->lang->words['hook_settings']} " . implode( ', ', $toDisplay['settings'] );
- }
-
- $this->data['display']['settings'] = $output;
-
- $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize($this->data) ), 'hook_id=' . $this->hookId );
-
- if( !$output )
- {
- $output = $this->lang->words['hook_no_settings'];
- }
- break;
-
- case 'language':
- $_langFiles = $this->hooksFunctions->getLanguageFiles();
- $ids = array();
- $files = array();
- $strings = array();
- $toDisplay = array();
- $this->data['language'] = array();
-
- foreach( $_POST as $k => $v )
- {
- if( preg_match( "/^language_(\d+)$/", $k, $matches ) )
- {
- $files[ $matches[1] ] = $v;
- $strings[ $matches[1] ] = $this->request[ 'strings_' . $matches[1] ];
- $ids[ $matches[1] ] = $matches[1];
- }
- }
-
- foreach( $ids as $id )
- {
- if( $files[ $id ] AND $strings[ $id ] )
- {
- $this->data['language'][ $files[ $id ] ] = $strings[ $id ];
- $toDisplay[] = "{$this->lang->words['hook_from']} {$files[ $id ]}: " . implode( ', ', $strings[ $id ] );
- }
- }
-
- if( count($toDisplay) )
- {
- $output .= implode( ' ', $toDisplay );
- }
-
- $this->data['display']['language'] = $output;
-
- $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize($this->data) ), 'hook_id=' . $this->hookId );
-
- if( !$output )
- {
- $output = $this->lang->words['hook_no_language'];
- }
- break;
-
- case 'modules':
- $_modules = $this->hooksFunctions->getModules();
- $toSave = array();
- $toDisplay = array();
-
- if( is_array($this->request['modules']) AND count($this->request['modules']) )
- {
- $toSave = $this->request['modules'];
- }
-
- foreach( $_modules as $data )
- {
- if( in_array( $data[0], $toSave ) )
- {
- $toDisplay[] = $data[1];
- }
- }
-
- if( count($toDisplay) )
- {
- $output .= "{$this->lang->words['hook_modules']} " . implode( ', ', $toDisplay );
- }
-
- $this->data['modules'] = $toSave;
- $this->data['display']['modules'] = $output;
-
- $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize($this->data) ), 'hook_id=' . $this->hookId );
-
- if( !$output )
- {
- $output = $this->lang->words['hook_no_modules'];
- }
- break;
-
- case 'help':
- $_help = $this->hooksFunctions->getHelpFiles();
- $toSave = array();
- $toDisplay = array();
-
- if( is_array($this->request['help']) AND count($this->request['help']) )
- {
- $toSave = $this->request['help'];
- }
-
- foreach( $_help as $data )
- {
- if( in_array( $data[0], $toSave ) )
- {
- $toDisplay[] = $data[1];
- }
- }
-
- if( count($toDisplay) )
- {
- $output .= "{$this->lang->words['hook_help']} " . implode( ', ', $toDisplay );
- }
-
- $this->data['help'] = $toSave;
- $this->data['display']['help'] = $output;
-
- $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize($this->data) ), 'hook_id=' . $this->hookId );
-
- if( !$output )
- {
- $output = $this->lang->words['hook_no_help'];
- }
- break;
-
- case 'skins':
- $_skinFiles = $this->hooksFunctions->getSkinGroups();
- $ids = array();
- $files = array();
- $templates = array();
- $toDisplay = array();
- $this->data['templates'] = array();
-
- foreach( $_POST as $k => $v )
- {
- if( preg_match( "/^skin_(\d+)$/", $k, $matches ) )
- {
- $files[ $matches[1] ] = $v;
- $templates[ $matches[1] ] = $this->request[ 'templates_' . $matches[1] ];
- $ids[ $matches[1] ] = $matches[1];
- }
- }
-
- foreach( $ids as $id )
- {
- if( $files[ $id ] AND $templates[ $id ] )
- {
- $this->data['templates'][ $files[ $id ] ] = $templates[ $id ];
- $toDisplay[] = "{$this->lang->words['hook_from']} {$files[ $id ]}: " . implode( ', ', $templates[ $id ] );
- }
- }
-
- if( count($toDisplay) )
- {
- $output .= implode( ' ', $toDisplay );
- }
-
- $this->data['display']['templates'] = $output;
-
- $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize($this->data) ), 'hook_id=' . $this->hookId );
-
- if( !$output )
- {
- $output = $this->lang->words['hook_no_skin'];
- }
- break;
-
- case 'tasks':
- $_tasks = $this->hooksFunctions->getTasks();
- $toSave = array();
- $toDisplay = array();
-
- if( is_array($this->request['tasks']) AND count($this->request['tasks']) )
- {
- $toSave = $this->request['tasks'];
- }
-
- foreach( $_tasks as $data )
- {
- if( in_array( $data[0], $toSave ) )
- {
- $toDisplay[] = $data[1];
- }
- }
-
- if( count($toDisplay) )
- {
- $output .= "{$this->lang->words['hook_tasks']} " . implode( ', ', $toDisplay );
- }
-
- $this->data['tasks'] = $toSave;
- $this->data['display']['tasks'] = $output;
-
- $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize($this->data) ), 'hook_id=' . $this->hookId );
-
- if( !$output )
- {
- $output = $this->lang->words['hook_no_tasks'];
- }
- break;
-
- case 'database':
- $types = array(
- array( '0', $this->lang->words['hook_db_select'] ),
- array( 'create', $this->lang->words['hook_db_create'] ),
- array( 'alter', $this->lang->words['hook_db_alter'] ),
- array( 'update', $this->lang->words['hook_db_update'] ),
- array( 'insert', $this->lang->words['hook_db_insert'] ),
- );
- $alters = array(
- array( 'add', $this->lang->words['hook_db_addnew'] ),
- array( 'change', $this->lang->words['hook_db_change'] ),
- array( 'remove', $this->lang->words['hook_db_drop'] ),
- );
- $ids = array();
- $toDisplay = array();
- $this->data['database'] = array();
-
- /* Since this is more complicated, just get ids for now... */
- foreach( $_POST as $k => $v )
- {
- if( preg_match( "/^type_(\d+)$/", $k, $matches ) )
- {
- $ids[ $matches[1] ] = $matches[1];
- }
- }
-
- /* Now loop through and set stuff properly.. */
- foreach( $ids as $id )
- {
- $type = $this->request[ 'type_' . $id ];
-
- if( !$type )
- {
- continue;
- }
-
- switch( $type )
- {
- case 'create':
- $name = $this->request[ 'name_' . $id ];
- $fields = IPSText::br2nl( $_POST[ 'fields_' . $id ] );
- $tabletype = $this->request[ 'tabletype_' . $id ];
-
- if( !$name OR !$fields )
- {
- continue;
- }
-
- $this->data['database']['create'][] = array(
- 'name' => $name,
- 'fields' => $fields,
- 'tabletype' => $tabletype
- );
-
- $text = "CREATE TABLE {$name} (
- {$fields}
- )";
-
- if( $tabletype )
- {
- $text .= " TYPE=" . $tabletype;
- }
-
- $toDisplay[] = nl2br($text);
- break;
-
- case 'alter':
- $altertype = $this->request[ 'altertype_' . $id ];
- $table = $this->request[ 'table_' . $id ];
- $field = $this->request[ 'field_' . $id ];
- $newfield = $this->request[ 'newfield_' . $id ];
- $fieldtype = $this->request[ 'fieldtype_' . $id ];
- $default = $_POST[ 'default_' . $id ];
-
- if( !$altertype OR !$table OR !$field )
- {
- continue;
- }
-
- $this->data['database']['alter'][] = array(
- 'altertype' => $altertype,
- 'table' => $table,
- 'field' => $field,
- 'newfield' => $newfield,
- 'fieldtype' => $fieldtype,
- 'default' => $default,
- );
-
- $text = "ALTER TABLE {$table}";
-
- switch( $altertype )
- {
- case 'add':
- $text .= " ADD {$field} {$fieldtype}";
-
- if( $default !== '' )
- {
- $text .= " DEFAULT {$default}";
- }
- break;
-
- case 'change':
- $text .= " CHANGE {$field} {$newfield} {$fieldtype}";
-
- if( $default !== '' )
- {
- $text .= " DEFAULT {$default}";
- }
- break;
-
- case 'remove':
- $text .= " DROP {$field}";
- break;
- }
-
- $toDisplay[] = nl2br($text);
- break;
-
- case 'update':
- $table = $this->request[ 'table_' . $id ];
- $field = $this->request[ 'field_' . $id ];
- $newvalue = $_POST[ 'newvalue_' . $id ];
- $oldvalue = $_POST[ 'oldvalue_' . $id ];
- $where = $_POST[ 'where_' . $id ];
-
- if( !$table OR !$field OR !$newvalue )
- {
- continue;
- }
-
- $this->data['database']['update'][] = array(
- 'table' => $table,
- 'field' => $field,
- 'newvalue' => $newvalue,
- 'oldvalue' => $oldvalue,
- 'where' => $where
- );
-
- $text = "UPDATE {$table} SET {$field}='{$newvalue}'";
-
- if( $where )
- {
- $text .= " WHERE " . $where;
- }
-
- $toDisplay[] = nl2br($text);
- break;
-
- case 'insert':
- $table = $this->request[ 'table_' . $id ];
- $updates = $_POST[ 'updates_' . $id ];
- $fordelete = $_POST[ 'fordelete_' . $id ];
-
- if( !$table OR !$updates )
- {
- continue;
- }
-
- $this->data['database']['insert'][] = array(
- 'table' => $table,
- 'updates' => $updates,
- 'fordelete' => $fordelete,
- );
-
- $cols = array();
- $vals = array();
- $index = 0;
-
- $toins = explode( ',', $updates );
-
- foreach( $toins as $insertQuery )
- {
- $piece = explode( '=', $insertQuery );
- $cols[ $index ] = $piece[0];
- $vals[ $index ] = $piece[1];
- $index++;
- }
-
- $text = "INSERT INTO {$table} (";
- $text .= implode( ', ', $cols );
- $text .= ") VALUES ('";
- $text .= implode( "', '", $vals );
- $text .= "')";
-
- $toDisplay[] = nl2br($text);
- break;
- }
- }
-
- if( count($toDisplay) )
- {
- $output .= implode( ' ', $toDisplay );
- }
-
- $this->data['display']['database'] = $output;
-
- $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize($this->data) ), 'hook_id=' . $this->hookId );
-
- if( !$output )
- {
- $output = $this->lang->words['hook_no_db'];
- }
-
- break;
-
- case 'custom':
- $toSave = '';
- $toDisplay = '';
-
- if( $this->request['custom'] )
- {
- $toSave = $this->request['custom'];
- $toDisplay = $this->request['custom'];
- }
-
- if( $toDisplay )
- {
- $output .= "install_" . $toDisplay;
- }
-
- $this->data['custom'] = $toSave;
- $this->data['display']['custom'] = $output;
-
- $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize($this->data) ), 'hook_id=' . $this->hookId );
-
- if( !$output )
- {
- $output = $this->lang->words['hook_no_custom'];
- }
- break;
- }
-
- //-----------------------------------------
- // Print...
- //-----------------------------------------
-
- $return = array( 'success' => true, 'message' => $output );
-
- $this->returnJsonArray( $return );
- }
-
- /**
- * Show the form
- *
- * @access protected
- * @return void [Outputs to screen]
- */
- protected function show()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $name = trim( IPSText::alphanumericalClean( $this->request['name'] ) );
- $this->hookId = intval( $this->request['id'] );
- $this->hook = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $this->hookId ) );
- $this->data = unserialize($this->hook['hook_extra_data']);
-
- $output = '';
-
- //-----------------------------------------
- // Got a member?
- //-----------------------------------------
-
- if ( ! $this->hook['hook_id'] )
- {
- $this->returnJsonError( $this->lang->words['hook_cannot_load'] );
- }
-
- //-----------------------------------------
- // Run the proper operation
- //-----------------------------------------
-
- switch( $name )
- {
- case 'settings':
- $_settingGroups = $this->hooksFunctions->getSettingGroups();
- $_settings = $this->hooksFunctions->getSettings();
-
- $form = array();
- $form['groups'] = $this->registry->output->formMultiDropdown( "setting_groups[]", $_settingGroups, $this->data['settingGroups'], 5, "setting_groups" );
- $form['settings'] = $this->registry->output->formMultiDropdown( "settings[]", $_settings, $this->data['settings'], 5, "settings" );
-
- $output = $this->html->inline_settings( $this->hook, $form );
- break;
-
- case 'languages':
- // We'll show the lang files and let them select lang file, then select strings, then they can repeat
- $_langFiles = $this->hooksFunctions->getLanguageFiles();
- $i = 1;
- $form = array();
-
- if( count($this->data['language']) )
- {
- foreach( $this->data['language'] as $file => $strings )
- {
- $form["language_file_{$i}"] = $this->registry->output->formDropdown( "language_{$i}", $_langFiles, $file, "language_{$i}", "onchange='acp.hooks.generateStrings({$i});'" );
-
- $_strings = $this->hooksFunctions->getStrings( $file );
- $form["language_strings_{$i}"] = $this->registry->output->formMultiDropdown( "strings_{$i}[]", $_strings, $strings, 5, "strings_{$i}", "", "' style='width: 100%'" );
-
- $i++;
- }
- }
-
- $form["language_file_{$i}"] = $this->registry->output->formDropdown( "language_{$i}", $_langFiles, null, "language_{$i}", "onchange='acp.hooks.generateStrings({$i});'" );
-
- $output = $this->html->inline_languages( $this->hook, $form, $i );
- break;
-
- case 'modules':
- $_modules = $this->hooksFunctions->getModules();
-
- $form = array();
- $form['modules'] = $this->registry->output->formMultiDropdown( "modules[]", $_modules, $this->data['modules'], 5, "modules" );
-
- $output = $this->html->inline_modules( $this->hook, $form );
- break;
-
- case 'help':
- $_help = $this->hooksFunctions->getHelpFiles();
-
- $form = array();
- $form['help'] = $this->registry->output->formMultiDropdown( "help[]", $_help, $this->data['help'], 5, "help" );
-
- $output = $this->html->inline_help( $this->hook, $form );
- break;
-
- case 'skins':
- // We'll show the skin groups and let them select skin file, then select templates, then they can repeat
- $_skinFiles = $this->hooksFunctions->getSkinGroups();
- $i = 1;
- $form = array();
-
- if( count($this->data['templates']) )
- {
- foreach( $this->data['templates'] as $file => $methods )
- {
- $form["skin_file_{$i}"] = $this->registry->output->formDropdown( "skin_{$i}", $_skinFiles, $file, "skin_{$i}", "onchange='acp.hooks.generateTemplates({$i});'" );
-
- $_methods = $this->hooksFunctions->getSkinMethods( $file );
- $form["skin_method_{$i}"] = $this->registry->output->formMultiDropdown( "templates_{$i}[]", $_methods, $methods, 5, "templates_{$i}", "", "' style='width: 100%'" );
-
- $i++;
- }
- }
-
- $form["skin_file_{$i}"] = $this->registry->output->formDropdown( "skin_{$i}", $_skinFiles, null, "skin_{$i}", "onchange='acp.hooks.generateTemplates({$i});'" );
-
- $output = $this->html->inline_skins( $this->hook, $form, $i );
- break;
-
- case 'tasks':
- $_tasks = $this->hooksFunctions->getTasks();
-
- $form = array();
- $form['tasks'] = $this->registry->output->formMultiDropdown( "tasks[]", $_tasks, $this->data['tasks'], 5, "tasks" );
-
- $output = $this->html->inline_tasks( $this->hook, $form );
- break;
-
- case 'database':
- // First we'll show their current DB changes, then give them a dropdown to add another
- $i = 1;
- $form = array();
- $types = array(
- array( '0', $this->lang->words['hook_db_select'] ),
- array( 'create', $this->lang->words['hook_db_create'] ),
- array( 'alter', $this->lang->words['hook_db_alter'] ),
- array( 'update', $this->lang->words['hook_db_update'] ),
- array( 'insert', $this->lang->words['hook_db_insert'] ),
- );
- $alters = array(
- array( 'add', $this->lang->words['hook_db_addnew'] ),
- array( 'change', $this->lang->words['hook_db_change'] ),
- array( 'remove', $this->lang->words['hook_db_drop'] ),
- );
-
- if( count($this->data['database']) )
- {
- foreach( $this->data['database'] as $type => $data )
- {
- foreach( $data as $change )
- {
- $form["type_{$i}"] = $this->registry->output->formDropdown( "type_{$i}", $types, $type, "type_{$i}", "onchange='acp.hooks.generateFields({$i});'" );
-
- switch( $type )
- {
- case 'create':
- $form['field_1_' . $i ] = $this->registry->output->formInput( "name_{$i}", $change['name'] );
- $form['description_1_' . $i ] = $this->lang->words['desc_newtable'];
- $form['field_2_' . $i ] = $this->registry->output->formTextarea( "fields_{$i}", htmlspecialchars($change['fields']) );
- $form['description_2_' . $i ] = $this->lang->words['desc_fieldnames'];
- $form['field_3_' . $i ] = $this->registry->output->formInput( "tabletype_{$i}", $change['tabletype'] );
- $form['description_4_' . $i ] = $this->lang->words['desc_tabletype'];
- break;
-
- case 'alter':
- $form['field_1_' . $i ] = $this->registry->output->formDropdown( "altertype_{$i}", $alters, $change['altertype'] );
- $form['description_1_' . $i ] = $this->lang->words['desc_altertype'];
- $form['field_2_' . $i ] = $this->registry->output->formInput( "table_{$i}", $change['table'] );
- $form['description_2_' . $i ] = $this->lang->words['desc_newtable'];
- $form['field_3_' . $i ] = $this->registry->output->formInput( "field_{$i}", $change['field'] );
- $form['description_3_' . $i ] = $this->lang->words['desc_field'];
- $form['field_4_' . $i ] = $this->registry->output->formInput( "newfield_{$i}", $change['newfield'] );
- $form['description_4_' . $i ] = $this->lang->words['desc_changefield'];
- $form['field_5_' . $i ] = $this->registry->output->formInput( "fieldtype_{$i}", $change['fieldtype'] );
- $form['description_5_' . $i ] = $this->lang->words['desc_definition'];
- $form['field_6_' . $i ] = $this->registry->output->formInput( "default_{$i}", htmlspecialchars($change['default']) );
- $form['description_6_' . $i ] = $this->lang->words['desc_defaultvalue'];
- break;
-
- case 'update':
- $form['field_1_' . $i ] = $this->registry->output->formInput( "table_{$i}", $change['table'] );
- $form['description_1_' . $i ] = $this->lang->words['desc_newtable'];
- $form['field_2_' . $i ] = $this->registry->output->formInput( "field_{$i}", $change['field'] );
- $form['description_2_' . $i ] = $this->lang->words['desc_field'];
- $form['field_3_' . $i ] = $this->registry->output->formInput( "newvalue_{$i}", htmlspecialchars($change['newvalue']) );
- $form['description_3_' . $i ] = $this->lang->words['desc_newvalue'];
- $form['field_4_' . $i ] = $this->registry->output->formInput( "oldvalue_{$i}", htmlspecialchars($change['oldvalue']) );
- $form['description_4_' . $i ] = $this->lang->words['desc_oldvalue'];
- $form['field_5_' . $i ] = $this->registry->output->formInput( "where_{$i}", htmlspecialchars($change['where']) );
- $form['description_5_' . $i ] = $this->lang->words['desc_where'];
- break;
-
- case 'insert':
- $form['field_1_' . $i ] = $this->registry->output->formInput( "table_{$i}", $change['table'] );
- $form['description_1_' . $i ] = $this->lang->words['desc_newtable'];
- $form['field_2_' . $i ] = $this->registry->output->formTextarea( "updates_{$i}", htmlspecialchars($change['updates']) );
- $form['description_2_' . $i ] = $this->lang->words['desc_data'];
- $form['field_3_' . $i ] = $this->registry->output->formInput( "fordelete_{$i}", htmlspecialchars($change['fordelete']) );
- $form['description_3_' . $i ] = $this->lang->words['desc_revert'];
- break;
- }
-
- $i++;
- }
- }
- }
-
- $form["type_{$i}"] = $this->registry->output->formDropdown( "type_{$i}", $types, null, "type_{$i}", "onchange='acp.hooks.generateFields({$i});'" );
-
- $output = $this->html->inline_database( $this->hook, $form, $i );
- break;
-
- case 'custom':
- $form = array();
- $form['custom'] = $this->registry->output->formInput( "custom", $this->data['custom'] );
-
- $output = $this->html->inline_custom( $this->hook, $form );
- break;
- }
-
- //-----------------------------------------
- // Print...
- //-----------------------------------------
-
- $this->returnHtml( $output );
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Hooks (AJAX)
+ * Last Updated: $Date: 2010-10-14 13:15:13 -0400 (Thu, 14 Oct 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 1st march 2002
+ * @version $Revision: 6980 $
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class admin_core_ajax_hooks extends ipsAjaxCommand
+{
+ /**
+ * Cache object
+ *
+ * @var object
+ */
+ public $cache;
+
+ /**
+ * Hook ID
+ *
+ * @var integer
+ */
+ public $hookId;
+
+ /**
+ * Hook data
+ *
+ * @var array
+ */
+ public $hook;
+
+ /**
+ * Hook's export settings
+ *
+ * @var array
+ */
+ public $data;
+
+ /**
+ * Hooks library
+ *
+ * @var object Hooks library
+ */
+ private $hooksFunctions;
+
+ /**
+ * Main class entry point
+ *
+ * @param object ipsRegistry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ //-----------------------------------------
+ // Load skin
+ //-----------------------------------------
+
+ $this->html = ipsRegistry::getClass('output')->loadTemplate('cp_skin_hooks_export');
+
+ //-----------------------------------------
+ // Load hooks library
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('core') . '/sources/classes/hooksFunctions.php', 'hooksFunctions' );
+ $this->hooksFunctions = new $classToLoad( $registry );
+
+ //-----------------------------------------
+ // Load lang
+ //-----------------------------------------
+
+ ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_hooks' ) );
+
+ switch( $this->request['do'] )
+ {
+ case 'getStrings':
+ $this->_getAjaxStrings();
+ break;
+
+ case 'getLangFiles':
+ $this->_getAjaxFiles();
+ break;
+
+ case 'getTemplates':
+ $this->_getAjaxTemplates();
+ break;
+
+ case 'getSkinFiles':
+ $this->_getAjaxSkins();
+ break;
+
+ // These are for the add file form
+ case 'getGroupsForAdd':
+ $this->_getGroupsForAdd();
+ break;
+
+ case 'getTemplatesForAdd':
+ $this->_getTemplatesForAdd();
+ break;
+
+ case 'getHookIds':
+ $this->_getHookIds();
+ break;
+
+ case 'getDataLocationsForAdd':
+ $this->_getDataLocationsForAdd();
+ break;
+
+ case 'getApplications':
+ $this->_getApplications();
+ break;
+
+ case 'save':
+ $this->save();
+ break;
+
+ case 'show':
+ default:
+ $this->show();
+ break;
+ }
+ }
+
+ /**
+ * Get applications
+ *
+ * @return void [Outputs to screen]
+ */
+ protected function _getApplications()
+ {
+ $i = intval( $this->request['i'] );
+ $apps = array();
+
+ foreach( ipsRegistry::$applications as $dir => $appdata )
+ {
+ $apps[] = array( $dir, $appdata['app_title'] );
+ }
+
+ $output = $this->registry->output->formDropdown( "libApplication[{$i}]", $apps );
+
+ $this->returnHtml( $output );
+ }
+
+ /**
+ * Get data hook locations
+ *
+ * @return void [Outputs to screen]
+ */
+ protected function _getDataLocationsForAdd()
+ {
+ $i = intval( $this->request['i'] );
+
+ $_locations = IPSLib::getDataHookLocations();
+ $output = $this->registry->output->formDropdown( "dataLocation[{$i}]", $_locations );
+
+ $this->returnHtml( $output );
+ }
+
+ /**
+ * Get all hook ids for a template/type
+ *
+ * @return void [Outputs to screen]
+ */
+ protected function _getHookIds()
+ {
+ $i = intval( $this->request['i'] );
+ $template = IPSText::alphanumericalClean( $this->request['template'] );
+ $type = IPSText::alphanumericalClean( $this->request['type'] );
+ $return = $this->hooksFunctions->getHookIds( $template, $type );
+
+ $output = $this->registry->output->formDropdown( "id[{$i}]", $return, null, "id[{$i}]", "onchange='getHookEntryPoints({$i});'" );
+
+ $this->returnHtml( $output );
+ }
+
+ /**
+ * Get all skin files
+ *
+ * @return void [Outputs to screen]
+ */
+ protected function _getGroupsForAdd()
+ {
+ $i = intval( $this->request['i'] );
+
+ $_skinFiles = $this->hooksFunctions->getSkinGroups();
+ $output = $this->registry->output->formDropdown( "skinGroup[{$i}]", $_skinFiles, null, "skinGroup[{$i}]", "onchange='getTemplatesForAdd({$i});'" );
+
+ $this->returnHtml( $output );
+ }
+
+ /**
+ * Get all skin templates
+ *
+ * @return void [Outputs to screen]
+ */
+ protected function _getTemplatesForAdd()
+ {
+ $i = intval( $this->request['i'] );
+ $group = IPSText::alphanumericalClean( $this->request['group'] );
+
+ $_strings = $this->hooksFunctions->getSkinMethods( $group, true );
+ $output = $this->registry->output->formDropdown( "skinFunction[{$i}]", $_strings, null, "skinFunction[{$i}]", "onchange='getTypeOfHook({$i});'" );
+
+ $this->returnHtml( $output );
+ }
+
+ /**
+ * Get language strings in a given file
+ *
+ * @return void [Outputs to screen]
+ */
+ protected function _getAjaxStrings()
+ {
+ $group = IPSText::alphanumericalClean( $this->request['group'] );
+ $i = intval( $this->request['i'] );
+ $hook = intval( $this->request['id'] );
+
+ $this->hookId = intval( $this->request['id'] );
+ $this->hook = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $this->hookId ) );
+ $this->data = unserialize($this->hook['hook_extra_data']);
+
+ $_strings = $this->hooksFunctions->getStrings( $group );
+ $output = $this->registry->output->formMultiDropdown( "strings_{$i}[]", $_strings, $this->data['language'][ $group ], 5, "strings_{$i}", "", "' style='width: 100%'" );
+
+ $this->returnHtml( $output );
+ }
+
+ /**
+ * Get all language files
+ *
+ * @return void [Outputs to screen]
+ */
+ protected function _getAjaxFiles()
+ {
+ $i = intval( $this->request['i'] );
+ $hook = intval( $this->request['id'] );
+
+ $this->hookId = intval( $this->request['id'] );
+ $this->hook = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $this->hookId ) );
+ $this->data = unserialize($this->hook['hook_extra_data']);
+
+ $_langFiles = $this->hooksFunctions->getLanguageFiles();
+ $output = $this->registry->output->formDropdown( "language_{$i}", $_langFiles, null, "language_{$i}", "onchange='acp.hooks.generateStrings({$i});'" );
+
+ $this->returnHtml( $output );
+ }
+
+ /**
+ * Get skin templates in a given file
+ *
+ * @return void [Outputs to screen]
+ */
+ protected function _getAjaxTemplates()
+ {
+ $group = IPSText::alphanumericalClean( $this->request['group'] );
+ $i = intval( $this->request['i'] );
+ $hook = intval( $this->request['id'] );
+
+ $this->hookId = intval( $this->request['id'] );
+ $this->hook = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $this->hookId ) );
+ $this->data = unserialize($this->hook['hook_extra_data']);
+
+ $_strings = $this->hooksFunctions->getSkinMethods( $group );
+ $output = $this->registry->output->formMultiDropdown( "templates_{$i}[]", $_strings, $this->data['templates'][ $group ], 5, "templates_{$i}", "", "' style='width: 100%'" );
+
+ $this->returnHtml( $output );
+ }
+
+ /**
+ * Get all skin files
+ *
+ * @return void [Outputs to screen]
+ */
+ protected function _getAjaxSkins()
+ {
+ $i = intval( $this->request['i'] );
+ $hook = intval( $this->request['id'] );
+
+ $this->hookId = intval( $this->request['id'] );
+ $this->hook = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $this->hookId ) );
+ $this->data = unserialize($this->hook['hook_extra_data']);
+
+ $_skinFiles = $this->hooksFunctions->getSkinGroups();
+ $output = $this->registry->output->formDropdown( "skin_{$i}", $_skinFiles, null, "skin_{$i}", "onchange='acp.hooks.generateTemplates({$i});'" );
+
+ $this->returnHtml( $output );
+ }
+
+ /**
+ * Save the form
+ *
+ * @return void [Outputs to screen]
+ */
+ protected function save()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $name = trim( IPSText::alphanumericalClean( $this->request['name'] ) );
+ $this->hookId = intval( $this->request['id'] );
+ $this->hook = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $this->hookId ) );
+ $this->data = unserialize($this->hook['hook_extra_data']);
+
+ $output = '';
+
+ //-----------------------------------------
+ // Got a hook?
+ //-----------------------------------------
+
+ if ( ! $this->hook['hook_id'] )
+ {
+ $this->returnJsonError( $this->lang->words['hook_cannot_load'] );
+ }
+
+ //-----------------------------------------
+ // Run the proper operation
+ //-----------------------------------------
+
+ switch( $name )
+ {
+ case 'settings':
+ $_settingGroups = $this->hooksFunctions->getSettingGroups();
+ $_settings = $this->hooksFunctions->getSettings();
+ $toSave = array();
+ $toDisplay = array();
+
+ $toSave['settingGroups'] = array();
+ $toSave['settings'] = array();
+
+ if( is_array($this->request['setting_groups']) AND count($this->request['setting_groups']) )
+ {
+ $toSave['settingGroups'] = $this->request['setting_groups'];
+
+ foreach( $_settingGroups as $data )
+ {
+ if( in_array( $data[0], $toSave['settingGroups'] ) )
+ {
+ $toDisplay['settingGroups'][] = $data[1];
+ }
+ }
+ }
+
+ if( is_array($this->request['settings']) AND count($this->request['settings']) )
+ {
+ $toSave['settings'] = $this->request['settings'];
+
+ foreach( $_settings as $data )
+ {
+ if( in_array( $data[0], $toSave['settings'] ) )
+ {
+ $toDisplay['settings'][] = $data[1];
+ }
+ }
+ }
+
+ $this->data['settingGroups'] = $toSave['settingGroups'];
+ $this->data['settings'] = $toSave['settings'];
+
+ if( count($toDisplay['settingGroups']) )
+ {
+ $output .= "{$this->lang->words['hook_setting_groups']} " . implode( ', ', $toDisplay['settingGroups'] );
+ }
+
+ if( count($toDisplay['settings']) )
+ {
+ if( count($toDisplay['settingGroups']) )
+ {
+ $output .= ' ';
+ }
+
+ $output .= "{$this->lang->words['hook_settings']} " . implode( ', ', $toDisplay['settings'] );
+ }
+
+ $this->data['display']['settings'] = $output;
+
+ $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize($this->data) ), 'hook_id=' . $this->hookId );
+
+ if( !$output )
+ {
+ $output = $this->lang->words['hook_no_settings'];
+ }
+ break;
+
+ case 'language':
+ $_langFiles = $this->hooksFunctions->getLanguageFiles();
+ $ids = array();
+ $files = array();
+ $strings = array();
+ $toDisplay = array();
+ $this->data['language'] = array();
+
+ foreach( $_POST as $k => $v )
+ {
+ if( preg_match( "/^language_(\d+)$/", $k, $matches ) )
+ {
+ $files[ $matches[1] ] = $v;
+ $strings[ $matches[1] ] = $this->request[ 'strings_' . $matches[1] ];
+ $ids[ $matches[1] ] = $matches[1];
+ }
+ }
+
+ foreach( $ids as $id )
+ {
+ if( $files[ $id ] AND $strings[ $id ] )
+ {
+ $this->data['language'][ $files[ $id ] ] = $strings[ $id ];
+ $toDisplay[] = "{$this->lang->words['hook_from']} {$files[ $id ]}: " . implode( ', ', $strings[ $id ] );
+ }
+ }
+
+ if( count($toDisplay) )
+ {
+ $output .= implode( ' ', $toDisplay );
+ }
+
+ $this->data['display']['language'] = $output;
+
+ $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize($this->data) ), 'hook_id=' . $this->hookId );
+
+ if( !$output )
+ {
+ $output = $this->lang->words['hook_no_language'];
+ }
+ break;
+
+ case 'modules':
+ $_modules = $this->hooksFunctions->getModules();
+ $toSave = array();
+ $toDisplay = array();
+
+ if( is_array($this->request['modules']) AND count($this->request['modules']) )
+ {
+ $toSave = $this->request['modules'];
+ }
+
+ foreach( $_modules as $data )
+ {
+ if( in_array( $data[0], $toSave ) )
+ {
+ $toDisplay[] = $data[1];
+ }
+ }
+
+ if( count($toDisplay) )
+ {
+ $output .= "{$this->lang->words['hook_modules']} " . implode( ', ', $toDisplay );
+ }
+
+ $this->data['modules'] = $toSave;
+ $this->data['display']['modules'] = $output;
+
+ $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize($this->data) ), 'hook_id=' . $this->hookId );
+
+ if( !$output )
+ {
+ $output = $this->lang->words['hook_no_modules'];
+ }
+ break;
+
+ case 'help':
+ $_help = $this->hooksFunctions->getHelpFiles();
+ $toSave = array();
+ $toDisplay = array();
+
+ if( is_array($this->request['help']) AND count($this->request['help']) )
+ {
+ $toSave = $this->request['help'];
+ }
+
+ foreach( $_help as $data )
+ {
+ if( in_array( $data[0], $toSave ) )
+ {
+ $toDisplay[] = $data[1];
+ }
+ }
+
+ if( count($toDisplay) )
+ {
+ $output .= "{$this->lang->words['hook_help']} " . implode( ', ', $toDisplay );
+ }
+
+ $this->data['help'] = $toSave;
+ $this->data['display']['help'] = $output;
+
+ $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize($this->data) ), 'hook_id=' . $this->hookId );
+
+ if( !$output )
+ {
+ $output = $this->lang->words['hook_no_help'];
+ }
+ break;
+
+ case 'skins':
+ $_skinFiles = $this->hooksFunctions->getSkinGroups();
+ $ids = array();
+ $files = array();
+ $templates = array();
+ $toDisplay = array();
+ $this->data['templates'] = array();
+
+ foreach( $_POST as $k => $v )
+ {
+ if( preg_match( "/^skin_(\d+)$/", $k, $matches ) )
+ {
+ $files[ $matches[1] ] = $v;
+ $templates[ $matches[1] ] = $this->request[ 'templates_' . $matches[1] ];
+ $ids[ $matches[1] ] = $matches[1];
+ }
+ }
+
+ foreach( $ids as $id )
+ {
+ if( $files[ $id ] AND $templates[ $id ] )
+ {
+ $this->data['templates'][ $files[ $id ] ] = $templates[ $id ];
+ $toDisplay[] = "{$this->lang->words['hook_from']} {$files[ $id ]}: " . implode( ', ', $templates[ $id ] );
+ }
+ }
+
+ if( count($toDisplay) )
+ {
+ $output .= implode( ' ', $toDisplay );
+ }
+
+ $this->data['display']['templates'] = $output;
+
+ $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize($this->data) ), 'hook_id=' . $this->hookId );
+
+ if( !$output )
+ {
+ $output = $this->lang->words['hook_no_skin'];
+ }
+ break;
+
+ case 'css':
+ /* INIT */
+ $_cssFiles = $this->hooksFunctions->getCSSFiles();
+ $toSave = array();
+ $toDisplay = array();
+
+ /* Check to see if any were selected */
+ if( is_array( $this->request['css'] ) && count( $this->request['css'] ) )
+ {
+ $toSave = $this->request['css'];
+ }
+
+ /* Output */
+ foreach( $_cssFiles as $data )
+ {
+ if( in_array( $data[0], $toSave ) )
+ {
+ $toDisplay[] = $data[1];
+ }
+ }
+
+ if( count( $toDisplay ) )
+ {
+ $output .= "{$this->lang->words['hook_css']} " . implode( ', ', $toDisplay );
+ }
+
+ /* Save */
+ $this->data['css'] = $toSave;
+ $this->data['display']['css'] = $output;
+
+ $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize( $this->data ) ), 'hook_id=' . $this->hookId );
+
+ /* None found? */
+ if( ! $output )
+ {
+ $output = $this->lang->words['hook_no_css'];
+ }
+ break;
+
+ case 'tasks':
+ $_tasks = $this->hooksFunctions->getTasks();
+ $toSave = array();
+ $toDisplay = array();
+
+ if( is_array($this->request['tasks']) AND count($this->request['tasks']) )
+ {
+ $toSave = $this->request['tasks'];
+ }
+
+ foreach( $_tasks as $data )
+ {
+ if( in_array( $data[0], $toSave ) )
+ {
+ $toDisplay[] = $data[1];
+ }
+ }
+
+ if( count($toDisplay) )
+ {
+ $output .= "{$this->lang->words['hook_tasks']} " . implode( ', ', $toDisplay );
+ }
+
+ $this->data['tasks'] = $toSave;
+ $this->data['display']['tasks'] = $output;
+
+ $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize($this->data) ), 'hook_id=' . $this->hookId );
+
+ if( !$output )
+ {
+ $output = $this->lang->words['hook_no_tasks'];
+ }
+ break;
+
+ case 'database':
+ $types = array(
+ array( '0', $this->lang->words['hook_db_select'] ),
+ array( 'create', $this->lang->words['hook_db_create'] ),
+ array( 'alter', $this->lang->words['hook_db_alter'] ),
+ array( 'update', $this->lang->words['hook_db_update'] ),
+ array( 'insert', $this->lang->words['hook_db_insert'] ),
+ );
+ $alters = array(
+ array( 'add', $this->lang->words['hook_db_addnew'] ),
+ array( 'change', $this->lang->words['hook_db_change'] ),
+ array( 'remove', $this->lang->words['hook_db_drop'] ),
+ );
+ $ids = array();
+ $toDisplay = array();
+ $this->data['database'] = array();
+
+ /* Since this is more complicated, just get ids for now... */
+ foreach( $_POST as $k => $v )
+ {
+ if( preg_match( "/^type_(\d+)$/", $k, $matches ) )
+ {
+ $ids[ $matches[1] ] = $matches[1];
+ }
+ }
+
+ /* Now loop through and set stuff properly.. */
+ foreach( $ids as $id )
+ {
+ $type = $this->request[ 'type_' . $id ];
+
+ if( !$type )
+ {
+ continue;
+ }
+
+ switch( $type )
+ {
+ case 'create':
+ $name = $this->request[ 'name_' . $id ];
+ $fields = IPSText::br2nl( $_POST[ 'fields_' . $id ] );
+ $tabletype = $this->request[ 'tabletype_' . $id ];
+
+ if( !$name OR !$fields )
+ {
+ continue;
+ }
+
+ $this->data['database']['create'][] = array(
+ 'name' => $name,
+ 'fields' => $fields,
+ 'tabletype' => $tabletype
+ );
+
+ $text = "CREATE TABLE {$name} (
+ {$fields}
+ )";
+
+ if( $tabletype )
+ {
+ $text .= " TYPE=" . $tabletype;
+ }
+
+ $toDisplay[] = nl2br($text);
+ break;
+
+ case 'alter':
+ $altertype = $this->request[ 'altertype_' . $id ];
+ $table = $this->request[ 'table_' . $id ];
+ $field = $this->request[ 'field_' . $id ];
+ $newfield = $this->request[ 'newfield_' . $id ];
+ $fieldtype = $this->request[ 'fieldtype_' . $id ];
+ $default = $_POST[ 'default_' . $id ];
+
+ if( !$altertype OR !$table OR !$field )
+ {
+ continue;
+ }
+
+ $this->data['database']['alter'][] = array(
+ 'altertype' => $altertype,
+ 'table' => $table,
+ 'field' => $field,
+ 'newfield' => $newfield,
+ 'fieldtype' => $fieldtype,
+ 'default' => $default,
+ );
+
+ $text = "ALTER TABLE {$table}";
+
+ switch( $altertype )
+ {
+ case 'add':
+ $text .= " ADD {$field} {$fieldtype}";
+
+ if( $default !== '' )
+ {
+ $text .= " DEFAULT {$default}";
+ }
+ break;
+
+ case 'change':
+ $text .= " CHANGE {$field} {$newfield} {$fieldtype}";
+
+ if( $default !== '' )
+ {
+ $text .= " DEFAULT {$default}";
+ }
+ break;
+
+ case 'remove':
+ $text .= " DROP {$field}";
+ break;
+ }
+
+ $toDisplay[] = nl2br($text);
+ break;
+
+ case 'update':
+ $table = $this->request[ 'table_' . $id ];
+ $field = $this->request[ 'field_' . $id ];
+ $newvalue = $_POST[ 'newvalue_' . $id ];
+ $oldvalue = $_POST[ 'oldvalue_' . $id ];
+ $where = $_POST[ 'where_' . $id ];
+
+ if( !$table OR !$field OR !$newvalue )
+ {
+ continue;
+ }
+
+ $this->data['database']['update'][] = array(
+ 'table' => $table,
+ 'field' => $field,
+ 'newvalue' => $newvalue,
+ 'oldvalue' => $oldvalue,
+ 'where' => $where
+ );
+
+ $text = "UPDATE {$table} SET {$field}='{$newvalue}'";
+
+ if( $where )
+ {
+ $text .= " WHERE " . $where;
+ }
+
+ $toDisplay[] = nl2br($text);
+ break;
+
+ case 'insert':
+ $table = $this->request[ 'table_' . $id ];
+ $updates = $_POST[ 'updates_' . $id ];
+ $fordelete = $_POST[ 'fordelete_' . $id ];
+
+ if( !$table OR !$updates )
+ {
+ continue;
+ }
+
+ $this->data['database']['insert'][] = array(
+ 'table' => $table,
+ 'updates' => $updates,
+ 'fordelete' => $fordelete,
+ );
+
+ $cols = array();
+ $vals = array();
+ $index = 0;
+
+ $toins = explode( ',', $updates );
+
+ foreach( $toins as $insertQuery )
+ {
+ $piece = explode( '=', $insertQuery );
+ $cols[ $index ] = $piece[0];
+ $vals[ $index ] = $piece[1];
+ $index++;
+ }
+
+ $text = "INSERT INTO {$table} (";
+ $text .= implode( ', ', $cols );
+ $text .= ") VALUES ('";
+ $text .= implode( "', '", $vals );
+ $text .= "')";
+
+ $toDisplay[] = nl2br($text);
+ break;
+ }
+ }
+
+ if( count($toDisplay) )
+ {
+ $output .= implode( ' ', $toDisplay );
+ }
+
+ $this->data['display']['database'] = $output;
+
+ $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize($this->data) ), 'hook_id=' . $this->hookId );
+
+ if( !$output )
+ {
+ $output = $this->lang->words['hook_no_db'];
+ }
+
+ break;
+
+ case 'custom':
+ $toSave = '';
+ $toDisplay = '';
+
+ if( $this->request['custom'] )
+ {
+ $toSave = $this->request['custom'];
+ $toDisplay = $this->request['custom'];
+ }
+
+ if( $toDisplay )
+ {
+ $output .= "install_" . $toDisplay;
+ }
+
+ $this->data['custom'] = $toSave;
+ $this->data['display']['custom'] = $output;
+
+ $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize($this->data) ), 'hook_id=' . $this->hookId );
+
+ if( !$output )
+ {
+ $output = $this->lang->words['hook_no_custom'];
+ }
+ break;
+ }
+
+ //-----------------------------------------
+ // Print...
+ //-----------------------------------------
+
+ $return = array( 'success' => true, 'message' => $output );
+
+ $this->returnJsonArray( $return );
+ }
+
+ /**
+ * Show the form
+ *
+ * @return void [Outputs to screen]
+ */
+ protected function show()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $name = trim( IPSText::alphanumericalClean( $this->request['name'] ) );
+ $this->hookId = intval( $this->request['id'] );
+ $this->hook = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $this->hookId ) );
+ $this->data = unserialize($this->hook['hook_extra_data']);
+
+ $output = '';
+
+ //-----------------------------------------
+ // Got a member?
+ //-----------------------------------------
+
+ if ( ! $this->hook['hook_id'] )
+ {
+ $this->returnJsonError( $this->lang->words['hook_cannot_load'] );
+ }
+
+ //-----------------------------------------
+ // Run the proper operation
+ //-----------------------------------------
+
+ switch( $name )
+ {
+ case 'settings':
+ $_settingGroups = $this->hooksFunctions->getSettingGroups();
+ $_settings = $this->hooksFunctions->getSettings();
+
+ $form = array();
+ $form['groups'] = $this->registry->output->formMultiDropdown( "setting_groups[]", $_settingGroups, $this->data['settingGroups'], 5, "setting_groups" );
+ $form['settings'] = $this->registry->output->formMultiDropdown( "settings[]", $_settings, $this->data['settings'], 5, "settings" );
+
+ $output = $this->html->inline_settings( $this->hook, $form );
+ break;
+
+ case 'languages':
+ // We'll show the lang files and let them select lang file, then select strings, then they can repeat
+ $_langFiles = $this->hooksFunctions->getLanguageFiles();
+ $i = 1;
+ $form = array();
+
+ if( count($this->data['language']) )
+ {
+ foreach( $this->data['language'] as $file => $strings )
+ {
+ $form["language_file_{$i}"] = $this->registry->output->formDropdown( "language_{$i}", $_langFiles, $file, "language_{$i}", "onchange='acp.hooks.generateStrings({$i});'" );
+
+ $_strings = $this->hooksFunctions->getStrings( $file );
+ $form["language_strings_{$i}"] = $this->registry->output->formMultiDropdown( "strings_{$i}[]", $_strings, $strings, 5, "strings_{$i}", "", "' style='width: 100%'" );
+
+ $i++;
+ }
+ }
+
+ $form["language_file_{$i}"] = $this->registry->output->formDropdown( "language_{$i}", $_langFiles, null, "language_{$i}", "onchange='acp.hooks.generateStrings({$i});'" );
+
+ $output = $this->html->inline_languages( $this->hook, $form, $i );
+ break;
+
+ case 'modules':
+ $_modules = $this->hooksFunctions->getModules();
+
+ $form = array();
+ $form['modules'] = $this->registry->output->formMultiDropdown( "modules[]", $_modules, $this->data['modules'], 5, "modules" );
+
+ $output = $this->html->inline_modules( $this->hook, $form );
+ break;
+
+ case 'help':
+ $_help = $this->hooksFunctions->getHelpFiles();
+
+ $form = array();
+ $form['help'] = $this->registry->output->formMultiDropdown( "help[]", $_help, $this->data['help'], 5, "help" );
+
+ $output = $this->html->inline_help( $this->hook, $form );
+ break;
+
+ case 'skins':
+ // We'll show the skin groups and let them select skin file, then select templates, then they can repeat
+ $_skinFiles = $this->hooksFunctions->getSkinGroups();
+ $i = 1;
+ $form = array();
+
+ if( count($this->data['templates']) )
+ {
+ foreach( $this->data['templates'] as $file => $methods )
+ {
+ $form["skin_file_{$i}"] = $this->registry->output->formDropdown( "skin_{$i}", $_skinFiles, $file, "skin_{$i}", "onchange='acp.hooks.generateTemplates({$i});'" );
+
+ $_methods = $this->hooksFunctions->getSkinMethods( $file );
+ $form["skin_method_{$i}"] = $this->registry->output->formMultiDropdown( "templates_{$i}[]", $_methods, $methods, 5, "templates_{$i}", "", "' style='width: 100%'" );
+
+ $i++;
+ }
+ }
+
+ $form["skin_file_{$i}"] = $this->registry->output->formDropdown( "skin_{$i}", $_skinFiles, null, "skin_{$i}", "onchange='acp.hooks.generateTemplates({$i});'" );
+
+ $output = $this->html->inline_skins( $this->hook, $form, $i );
+ break;
+
+ case 'css':
+ $_cssFiles = $this->hooksFunctions->getCSSFiles();
+
+ $form = array();
+ $form['css'] = $this->registry->output->formMultiDropdown( "css[]", $_cssFiles, $this->data['css'], 5, "css" );
+
+ $output = $this->html->inline_css( $this->hook, $form );
+ break;
+
+ case 'tasks':
+ $_tasks = $this->hooksFunctions->getTasks();
+
+ $form = array();
+ $form['tasks'] = $this->registry->output->formMultiDropdown( "tasks[]", $_tasks, $this->data['tasks'], 5, "tasks" );
+
+ $output = $this->html->inline_tasks( $this->hook, $form );
+ break;
+
+ case 'database':
+ // First we'll show their current DB changes, then give them a dropdown to add another
+ $i = 1;
+ $form = array();
+ $types = array(
+ array( '0', $this->lang->words['hook_db_select'] ),
+ array( 'create', $this->lang->words['hook_db_create'] ),
+ array( 'alter', $this->lang->words['hook_db_alter'] ),
+ array( 'update', $this->lang->words['hook_db_update'] ),
+ array( 'insert', $this->lang->words['hook_db_insert'] ),
+ );
+ $alters = array(
+ array( 'add', $this->lang->words['hook_db_addnew'] ),
+ array( 'change', $this->lang->words['hook_db_change'] ),
+ array( 'remove', $this->lang->words['hook_db_drop'] ),
+ );
+
+ if( count($this->data['database']) )
+ {
+ foreach( $this->data['database'] as $type => $data )
+ {
+ foreach( $data as $change )
+ {
+ $form["type_{$i}"] = $this->registry->output->formDropdown( "type_{$i}", $types, $type, "type_{$i}", "onchange='acp.hooks.generateFields({$i});'" );
+
+ switch( $type )
+ {
+ case 'create':
+ $form['field_1_' . $i ] = $this->registry->output->formInput( "name_{$i}", $change['name'] );
+ $form['description_1_' . $i ] = $this->lang->words['desc_newtable'];
+ $form['field_2_' . $i ] = $this->registry->output->formTextarea( "fields_{$i}", htmlspecialchars($change['fields']) );
+ $form['description_2_' . $i ] = $this->lang->words['desc_fieldnames'];
+ $form['field_3_' . $i ] = $this->registry->output->formInput( "tabletype_{$i}", $change['tabletype'] );
+ $form['description_4_' . $i ] = $this->lang->words['desc_tabletype'];
+ break;
+
+ case 'alter':
+ $form['field_1_' . $i ] = $this->registry->output->formDropdown( "altertype_{$i}", $alters, $change['altertype'] );
+ $form['description_1_' . $i ] = $this->lang->words['desc_altertype'];
+ $form['field_2_' . $i ] = $this->registry->output->formInput( "table_{$i}", $change['table'] );
+ $form['description_2_' . $i ] = $this->lang->words['desc_newtable'];
+ $form['field_3_' . $i ] = $this->registry->output->formInput( "field_{$i}", $change['field'] );
+ $form['description_3_' . $i ] = $this->lang->words['desc_field'];
+ $form['field_4_' . $i ] = $this->registry->output->formInput( "newfield_{$i}", $change['newfield'] );
+ $form['description_4_' . $i ] = $this->lang->words['desc_changefield'];
+ $form['field_5_' . $i ] = $this->registry->output->formInput( "fieldtype_{$i}", $change['fieldtype'] );
+ $form['description_5_' . $i ] = $this->lang->words['desc_definition'];
+ $form['field_6_' . $i ] = $this->registry->output->formInput( "default_{$i}", htmlspecialchars($change['default']) );
+ $form['description_6_' . $i ] = $this->lang->words['desc_defaultvalue'];
+ break;
+
+ case 'update':
+ $form['field_1_' . $i ] = $this->registry->output->formInput( "table_{$i}", $change['table'] );
+ $form['description_1_' . $i ] = $this->lang->words['desc_newtable'];
+ $form['field_2_' . $i ] = $this->registry->output->formInput( "field_{$i}", $change['field'] );
+ $form['description_2_' . $i ] = $this->lang->words['desc_field'];
+ $form['field_3_' . $i ] = $this->registry->output->formInput( "newvalue_{$i}", htmlspecialchars($change['newvalue']) );
+ $form['description_3_' . $i ] = $this->lang->words['desc_newvalue'];
+ $form['field_4_' . $i ] = $this->registry->output->formInput( "oldvalue_{$i}", htmlspecialchars($change['oldvalue']) );
+ $form['description_4_' . $i ] = $this->lang->words['desc_oldvalue'];
+ $form['field_5_' . $i ] = $this->registry->output->formInput( "where_{$i}", htmlspecialchars($change['where']) );
+ $form['description_5_' . $i ] = $this->lang->words['desc_where'];
+ break;
+
+ case 'insert':
+ $form['field_1_' . $i ] = $this->registry->output->formInput( "table_{$i}", $change['table'] );
+ $form['description_1_' . $i ] = $this->lang->words['desc_newtable'];
+ $form['field_2_' . $i ] = $this->registry->output->formTextarea( "updates_{$i}", htmlspecialchars($change['updates']) );
+ $form['description_2_' . $i ] = $this->lang->words['desc_data'];
+ $form['field_3_' . $i ] = $this->registry->output->formInput( "fordelete_{$i}", htmlspecialchars($change['fordelete']) );
+ $form['description_3_' . $i ] = $this->lang->words['desc_revert'];
+ break;
+ }
+
+ $i++;
+ }
+ }
+ }
+
+ $form["type_{$i}"] = $this->registry->output->formDropdown( "type_{$i}", $types, null, "type_{$i}", "onchange='acp.hooks.generateFields({$i});'" );
+
+ $output = $this->html->inline_database( $this->hook, $form, $i );
+ break;
+
+ case 'custom':
+ $form = array();
+ $form['custom'] = $this->registry->output->formInput( "custom", $this->data['custom'] );
+
+ $output = $this->html->inline_custom( $this->hook, $form );
+ break;
+ }
+
+ //-----------------------------------------
+ // Print...
+ //-----------------------------------------
+
+ $this->returnHtml( $output );
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/ajax/index.html b/upload/admin/applications/core/modules_admin/ajax/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/ajax/index.html
+++ b/upload/admin/applications/core/modules_admin/ajax/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/ajax/livesearch.php b/upload/admin/applications/core/modules_admin/ajax/livesearch.php
index 7e454a1e..b0e4bd8e 100644
--- a/upload/admin/applications/core/modules_admin/ajax/livesearch.php
+++ b/upload/admin/applications/core/modules_admin/ajax/livesearch.php
@@ -1,229 +1,405 @@
-Incorrect accessYou 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;
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Live Search
+ * Last Updated: $Date: 2010-08-17 11:38:47 -0400 (Tue, 17 Aug 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6763 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access 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( 'members' => null, 'groups' => false, 'settings' => null, 'forums' => null, 'location' => null );
+
+ /* Do search here */
+ $results = $this->_getSettings( $search_term, $results );
+ $results = $this->_getFromXML( $search_term, $results );
+ $results = $this->_getMembers( $search_term, $results );
+ $results = $this->_checkGroups( $search_term, $results );
+ $results = $this->_checkForums( $search_term, $results );
+
+ //-----------------------------------------
+ // Members
+ //-----------------------------------------
+
+ $secCount = 0;
+
+ if( isset( $results['members'] ) AND is_array( $results['members'] ) AND count($results['members']))
+ {
+ foreach( $results['members'] as $members )
+ {
+ $secCount++;
+ $return['members'] .= $this->html->searchRowMember( $members, $secCount );
+ }
+ }
+
+ //-----------------------------------------
+ // Group settings?
+ //-----------------------------------------
+
+ $secCount = 0;
+
+ if( $results['groups'] )
+ {
+ foreach( $results['groups'] as $group )
+ {
+ $secCount++;
+ $return['groups'] .= $this->html->searchRowGroupsTitles( $group, $secCount );
+ }
+ }
+
+ if( $results['groupLangs'] )
+ {
+ $return['groups'] .= $this->html->searchRowGroups();
+ }
+
+ //-----------------------------------------
+ // Settings
+ //-----------------------------------------
+
+ $secCount = 0;
+
+ if( isset( $results['settings'] ) AND is_array( $results['settings'] ) AND count($results['settings']) )
+ {
+ foreach( $results['settings'] as $setting )
+ {
+ $secCount++;
+ $return['settings'] .= $this->html->searchRowSetting( $setting, $secCount );
+ }
+ }
+
+ //-----------------------------------------
+ // Forums
+ //-----------------------------------------
+
+ $secCount = 0;
+
+ if( isset( $results['forums'] ) AND is_array( $results['forums'] ) AND count($results['forums']))
+ {
+ foreach( $results['forums'] as $forum )
+ {
+ $secCount++;
+ $return['forums'] .= $this->html->searchRowForums( $forum, $secCount );
+ }
+ }
+
+ //-----------------------------------------
+ // Locations
+ //-----------------------------------------
+
+ $secCount = 0;
+
+ if( isset( $results['location'] ) AND is_array( $results['location'] ) AND count($results['location']))
+ {
+ foreach( $results['location'] as $location )
+ {
+ $secCount++;
+ $return['location'] .= $this->html->searchRowLocation( $location, $secCount );
+ }
+ }
+
+ /* Output */
+ $this->output .= $this->html->liveSearchDisplay( $return, $search_term );
+ }
+
+ /**
+ * Searches for matching members
+ *
+ * @access private
+ * @param string Search term
+ * @param array Existing search results
+ * @return array New search results
+ */
+ private function _getMembers( $term, $results )
+ {
+ $term = mb_strtolower($term);
+
+ $this->DB->build( array(
+ 'select' => 'member_id, members_display_name, name, members_l_username, members_l_display_name, email',
+ 'from' => 'members',
+ 'where' => "members_l_username LIKE '%{$term}%' OR members_l_display_name LIKE '%{$term}%' OR " . $this->DB->buildLower('email') . " LIKE '%{$term}%'",
+ ) );
+
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $_matched = '';
+
+ if( $r['members_l_display_name'] AND mb_strpos( $r['members_l_display_name'], $term ) !== false )
+ {
+ $r['_matched'] = 'members_display_name';
+ }
+ else if( $r['members_l_username'] AND mb_strpos( $r['members_l_username'], $term ) !== false )
+ {
+ $r['_matched'] = 'name';
+ }
+ else
+ {
+ $r['_matched'] = 'email';
+ }
+
+ $results['members'][] = $r;
+ }
+
+ return $results;
+ }
+
+ /**
+ * Check if search term is found in groups language file or in the group_cache.g_title
+ *
+ * @access private
+ * @param string Search term
+ * @param array Existing search results
+ * @return array New search results
+ */
+ private function _checkGroups( $term, $results )
+ {
+ $term = mb_strtolower($term);
+ $results['groups'] = false;
+
+ $this->registry->class_localization->loadLanguageFile( array( 'admin_groups' ), 'members' );
+ $this->registry->class_localization->loadLanguageFile( array( 'admin_forums' ), 'forums' );
+ $this->registry->class_localization->loadLanguageFile( array( 'admin_gallery' ), 'gallery' );
+ $this->registry->class_localization->loadLanguageFile( array( 'admin_blog' ), 'blog' );
+ $this->registry->class_localization->loadLanguageFile( array( 'admin_downloads' ), 'downloads' );
+
+ foreach( $this->lang->words as $k => $v )
+ {
+ if( strpos( $k, 'gf_' ) !== false AND strpos( $v, $term ) !== false )
+ {
+ $results['groupLangs'] = true;
+ break;
+ }
+ }
+
+ /* Now check group names */
+ $groups = $this->cache->getCache('group_cache');
+
+ if ( is_array( $groups ) AND count( $groups ) )
+ {
+ foreach( $groups as $id => $data )
+ {
+ $_term = preg_quote( $term, '#' );
+
+ if ( preg_match( "#" . $_term . "#iu", $data['g_title'] ) )
+ {
+ $results['groups'][] = $data;
+ }
+ }
+ }
+
+ return $results;
+ }
+
+ /**
+ * Check if search term is found in groups language file
+ *
+ * @access private
+ * @param string Search term
+ * @param array Existing search results
+ * @return array New search results
+ */
+ private function _checkForums( $term, $results )
+ {
+ $term = mb_strtolower($term);
+ $results['forums'] = false;
+
+ /* Fetch forums lib */
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums' );
+ $forums = new $classToLoad( $this->registry );
+ $forums->strip_invisible = 1;
+ $forums->forumsInit();
+
+ /* Now check forum titles names */
+ foreach( $forums->forum_by_id as $id => $data )
+ {
+ $_term = preg_quote( $term, '#' );
+
+ if ( preg_match( "#" . $_term . "#iu", $data['name'] ) )
+ {
+ $results['forums'][] = $data;
+ }
+ }
+
+ return $results;
+ }
+
+ /**
+ * 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 = mb_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 )
+ {
+ if( IPSLib::appIsInstalled( $app ) )
+ {
+ 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 mb_stripos( $item['keywords'], $term ) !== false )
+ {
+ $item['url'] = "&app={$app}&module={$item['module']}&{$item['url']}";
+ $results['location'][] = $item;
+ }
+ else if( mb_stripos( $item['title'], $term ) !== false )
+ {
+ $item['fullurl'] = "&app={$app}&module={$item['module']}&{$item['url']}";
+ $results['location'][] = $item;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return $results;
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/ajax/replacements.php b/upload/admin/applications/core/modules_admin/ajax/replacements.php
index d5dfcd3d..e4f14045 100644
--- a/upload/admin/applications/core/modules_admin/ajax/replacements.php
+++ b/upload/admin/applications/core/modules_admin/ajax/replacements.php
@@ -1,21 +1,23 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* AJAX Functions For applications/core/js/ipb3CSS.js file
- * Last Updated: $Date: 2009-05-15 21:17:56 -0400 (Fri, 15 May 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* 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
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Friday 19th May 2006 17:33
- * @version $Revision: 4663 $
+ * @version $Revision: 5713 $
*/
diff --git a/upload/admin/applications/core/modules_admin/ajax/templatediff.php b/upload/admin/applications/core/modules_admin/ajax/templatediff.php
index e4756011..5bcf1ea1 100644
--- a/upload/admin/applications/core/modules_admin/ajax/templatediff.php
+++ b/upload/admin/applications/core/modules_admin/ajax/templatediff.php
@@ -1,21 +1,23 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* AJAX Functions For applications/core/js/ipb3Templates.js file
- * Last Updated: $Date: 2009-05-15 21:17:56 -0400 (Fri, 15 May 2009) $
+ * Last Updated: $Date: 2010-09-13 17:28:12 -0400 (Mon, 13 Sep 2010) $
+ *
*
* Author: Matt Mecham
*
- * @author $Author: bfarber $
+ * @author $Author: terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Friday 19th May 2006 17:33
- * @version $Revision: 4663 $
+ * @version $Revision: 6863 $
*/
@@ -72,13 +74,244 @@ class admin_core_ajax_templatediff extends ipsAjaxCommand
default:
case 'process':
$this->_process();
+ break;
+ case 'merge':
+ $this->_merge();
break;
case 'viewDiff':
$this->_viewDiff();
break;
+ case 'editDiff':
+ $this->_editDiff();
+ break;
+ case 'saveEdit':
+ $this->_saveEdit();
+ break;
+ case 'viewVersion':
+ $this->_viewVersion();
+ break;
+ case 'resolveAllSingle':
+ $this->_resolveAllSingle();
+ break;
}
}
+ /**
+ * Grab a version to show
+ *
+ * @access private
+ * @return string JSON
+ */
+ private function _viewVersion()
+ {
+ $change_id = trim( $this->request['change_id'] );
+ $type = trim( $this->request['type'] );
+
+ //-----------------------------------------
+ // Get data
+ //-----------------------------------------
+
+ $diff_row = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'skin_merge_changes',
+ 'where' => "change_id=" . intval( $change_id ) ) );
+
+
+ if ( ! $diff_row['change_key'] )
+ {
+ $this->returnJsonError( $this->lang->words['ajax_nokeyfound'] );
+ exit();
+ }
+
+ /* Fetch session */
+ $session = $this->skinFunctions->fetchSession( $diff_row['change_session_id'] );
+
+ /* Start things off? */
+ $return = array( 'data_title' => $diff_row['change_data_title'],
+ 'data_group' => $diff_row['change_data_group'],
+ 'data_type' => $diff_row['change_data_type'],
+ 'data_master_key' => $session['merge_master_key'],
+ 'data_content' => '' );
+
+ /* What to get? */
+ switch( $type )
+ {
+ default:
+ case 'original':
+ $return['data_content'] = $this->skinFunctions->fetchOriginalItem( $return );
+ break;
+ case 'custom':
+ $return['data_content'] = $this->skinFunctions->fetchCustomItem( $return );
+ break;
+ case 'new':
+ $return['data_content'] = $this->skinFunctions->fetchNewItem( $return );
+ break;
+ }
+
+ /* Formatting */
+ $return['data_content'] = htmlspecialchars( $return['data_content'] );
+ $return['data_content'] = str_replace( "\n", " ", $return['data_content']);
+ $return['data_content'] = str_replace( "><", ">\n<" ,$return['data_content']);
+ $return['data_content'] = str_replace( "\t", " ", $return['data_content'] );
+
+ $this->returnJsonArray( $return );
+ }
+
+ /**
+ * Save diff
+ *
+ * @access private
+ * @return string JSON
+ */
+ private function _saveEdit()
+ {
+ $change_id = trim( $this->request['change_id'] );
+ $content = $_POST['content'];
+
+ /* Re-format */
+ $content = str_replace( '\\"', '\\\"', $content );
+ $content = IPSText::formToText( $content );
+
+ /* Load item from DB */
+ $item = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'skin_merge_changes',
+ 'where' => 'change_id=' . intval( $change_id ) ) );
+
+ if ( ! $item )
+ {
+ /* Oops */
+ $this->returnJsonError( $this->lang->words['ajax_nosuchitemid'] );
+ }
+
+
+ /* Save to db */
+ $this->DB->update( 'skin_merge_changes', array( 'change_final_content' => $content ), 'change_id=' . intval( $change_id ) );
+
+
+ /* Done */
+ $this->returnJsonArray( array( 'ok' => true, 'desc' => $this->_buildDescString( $item ) ) );
+ }
+
+ /**
+ * Save diff
+ *
+ * @access private
+ * @return string JSON
+ */
+ private function _resolveAllSingle()
+ {
+ $change_id = trim( $this->request['change_id'] );
+ $type = trim( $this->request['type'] );
+
+ /* Load item from DB */
+ $item = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'skin_merge_changes',
+ 'where' => 'change_id=' . intval( $change_id ) ) );
+
+ if ( ! $item )
+ {
+ /* Oops */
+ $this->returnJsonError( $this->lang->words['ajax_nosuchitemid'] );
+ }
+
+ /* Resolve it! */
+ $this->skinFunctions->resolveConflict( array( $change_id ), $type );
+
+ /* Done */
+ $this->returnJsonArray( array( 'ok' => true, 'desc' => $this->_buildDescString( $item ) ) );
+ }
+
+
+ /**
+ * Build a desc string
+ *
+ * @access private
+ * @param array Item data
+ * @param string String
+ */
+ public function _buildDescString( $item )
+ {
+ /* INIT */
+ $_desc = '';
+
+ /* Fetch basic stats */
+ if ( $item['change_data_content'] )
+ {
+ $item['_diffs'] = substr_count( $item['change_data_content'], '-ips-match:1' );
+ }
+
+ if ( $item['change_merge_content'] AND stristr( $item['change_merge_content'], 'lang->words['ajax_newitem4thisv'];
+ }
+ else
+ {
+ $_desc = $item['_diffs'] . ' differences';
+
+ if ( intval( $item['_conflicts'] ) > 0 )
+ {
+ if ( $item['change_final_content'] )
+ {
+ $_desc .= ', ' . $item['_conflicts'] . ' ' . $this->lang->words['ajax_resolvedconflicts'];
+ }
+ else
+ {
+ $_desc .= ', ' . $item['_conflicts'] . ' ' . $this->lang->words['ajax_mergeconflicts'];
+ }
+ }
+ else
+ {
+ $_desc .= ',' . $this->lang->words['ajax_noconflicts'];
+ }
+
+ if ( $item['change_changes_applied'] )
+ {
+ $_desc .= $this->lang->words['ajax_changescommitted'];
+ }
+ }
+
+ return $_desc;
+ }
+
+ /**
+ * Grab a diff to edit
+ *
+ * @access private
+ * @return string JSON
+ */
+ private function _editDiff()
+ {
+ $change_id = trim( $this->request['change_id'] );
+
+ //-----------------------------------------
+ // Get data
+ //-----------------------------------------
+
+ $diff_row = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'skin_merge_changes',
+ 'where' => "change_id=" . intval( $change_id ) ) );
+
+
+ if ( ! $diff_row['change_key'] )
+ {
+ $this->returnJsonError( $this->lang->words['ajax_nokeyfound'] );
+ exit();
+ }
+
+ /* Prevent two lots of data going through */
+ $diff_row['change_data_content'] = '';
+
+ /* Convert inline mark-up */
+ $diff_row['change_merge_content'] = $this->skinFunctions->formatMergeForEdit( $diff_row['change_merge_content'] );
+
+ $this->returnJsonArray( $diff_row );
+ }
+
/**
* Grab a diff to show
*
@@ -87,27 +320,37 @@ class admin_core_ajax_templatediff extends ipsAjaxCommand
*/
private function _viewDiff()
{
- $key = trim( $this->request['key'] );
+ $change_id = trim( $this->request['change_id'] );
+ $type = trim( $this->request['type'] );
//-----------------------------------------
// Get data
//-----------------------------------------
$diff_row = $this->DB->buildAndFetch( array( 'select' => '*',
- 'from' => 'template_diff_changes',
- 'where' => "diff_change_key='" . $this->DB->addslashes($key) . "'" ) );
+ 'from' => 'skin_merge_changes',
+ 'where' => "change_id=" . intval( $change_id ) ) );
- if ( ! $diff_row['diff_change_key'] )
+ if ( ! $diff_row['change_key'] )
{
- $this->returnJsonError('No Key Found');
+ $this->returnJsonError( $this->lang->words['ajax_nokeyfound'] );
exit();
}
- $diff_row['diff_change_content'] = str_replace( "\n", " ", $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( "#(?", $diff_row['change_data_content']);
+ $diff_row['change_data_content'] = str_replace( "><", ">\n<" ,$diff_row['change_data_content']);
+ $diff_row['change_data_content'] = preg_replace( "#(?skinFunctions->formatMergeForPreview( $diff_row['change_merge_content'] );
+ }
$this->returnJsonArray( $diff_row );
}
@@ -119,140 +362,353 @@ class admin_core_ajax_templatediff extends ipsAjaxCommand
* @return string Json
*/
private function _process()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
+ {
+ /* INIT */
$pergo = intval( $this->request['perGo'] ) ? intval( $this->request['perGo'] ) : 10;
$diffSessionID = intval( $this->request['sessionID'] );
$completed = 0;
-
- //-----------------------------------------
- // Fetch current session
- //-----------------------------------------
+ $type = 'template';
+ $items = array();
+ $completed = 0;
+ /* Fetch current session */
$session = $this->skinFunctions->fetchSession( $diffSessionID );
if ( $session === FALSE )
{
- $this->returnJsonError('Could not locate a valid differences session');
+ $this->returnJsonError( $this->lang->words['ajax_invalidsession'] );
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 ) )
+ /* Are we doing templates or CSS? */
+ if ( $session['merge_templates_togo'] )
{
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'skin_templates',
+ 'where' => 'template_set_id=0 AND template_master_key=\'' . $session['merge_master_key'] . '\'',
+ 'order' => 'template_id ASC',
+ 'limit' => array( intval( $session['merge_templates_done'] ), intval( $pergo ) ) ) );
+
+ $this->DB->execute();
+
+ $type = 'template';
+
+ while( $row = $this->DB->fetch() )
+ {
+ $items[] = array( 'data_group' => $row['template_group'],
+ 'data_title' => $row['template_name'],
+ 'data_content' => $row['template_content'],
+ 'data_master_key' => $session['merge_master_key'],
+ 'data_set_id' => $session['merge_set_id'],
+ 'data_type' => 'template' );
+ }
+
+ }
+
+ /* If we're here, set to templates but no templates, check CSS */
+ if ( ! count( $items ) AND $type == 'template' )
+ {
+ $type = 'css';
+ $pergo = 1;
+
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'skin_css',
+ 'where' => 'css_set_id=0 AND css_master_key=\'' . $session['merge_master_key'] . '\'',
+ 'order' => 'css_id ASC',
+ 'limit' => array( intval( $session['merge_css_done'] ), intval( $pergo ) ) ) );
+
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $items[] = array( 'data_group' => $row['css_app'],
+ 'data_title' => $row['css_group'],
+ 'data_content' => $row['css_content'],
+ 'data_master_key' => $session['merge_master_key'],
+ 'data_set_id' => $session['merge_set_id'],
+ 'data_type' => 'css' );
+ }
+ }
+
+ /* If we don't have items, we're probably done */
+ if ( ! count( $items ) )
+ {
+ /* Fetch some counts templates */
+ $templates = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count',
+ 'from' => 'skin_merge_changes',
+ 'where' => 'change_is_diff=1 AND change_is_new=0 AND change_data_type=\'template\' AND change_session_id=\'' . $diffSessionID . '\'' ) );
+
+ /* Fetch some counts CSS */
+ $css = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count',
+ 'from' => 'skin_merge_changes',
+ 'where' => 'change_is_diff=1 AND change_is_new=0 AND change_data_type=\'css\' AND change_session_id=\'' . $diffSessionID . '\'' ) );
+
+
+ $this->DB->update( 'skin_merge_session', array( 'merge_m_templates_togo' => $templates['count'],
+ 'merge_m_css_togo' => $css['count'],
+ 'merge_diff_done' => 1 ), 'merge_id=' . intval( $diffSessionID ) );
+ /* Flag as completed */
$completed = 1;
}
else
{
- while( $row = $this->DB->fetch( $outer ) )
+ foreach( $items as $item )
{
- //-----------------------------------------
- // Get corresponding row from diff table
- //-----------------------------------------
+ /* Fetch templates to compare */
+ $new = $item['data_content'];
+ $original = $this->skinFunctions->fetchOriginalItem( $item );
+ $custom = $this->skinFunctions->fetchCustomItem( $item );
- $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?
- //-----------------------------------------
+ /* Other data */
+ $key = $diffSessionID.':'.$item['data_group'].':'.$item['data_title'];
- if ( $diff_row['diff_key'] )
+ /* Got an original bit? */
+ if ( $original !== FALSE )
{
- //-----------------------------------------
- // Get difference
- //-----------------------------------------
-
- $difference = $classDifference->getDifferences( $diff_row['diff_func_content'], $row['template_content'] );
+ /* Check difference */
+ $difference = $this->skinFunctions->fetchDifferences( $original, $new );
- //-----------------------------------------
- // Got any differences?
- //-----------------------------------------
-
- if ( $classDifference->diff_found )
+ if ( $difference !== FALSE )
{
- //-----------------------------------------
- // 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'] . "'" ) );
+ /* Prevent dupes */
+ $diffCheck = $this->DB->buildAndFetch( array( 'select' => 'change_id, change_key',
+ 'from' => 'skin_merge_changes',
+ 'where' => "change_key='" . $key . "'" ) );
- if ( $diff_check['diff_change_key'] )
+ if ( $diffCheck['change_id'] )
{
- $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'] . "'" );
+ $this->DB->update( 'skin_merge_changes', array( 'change_key' => $key,
+ 'change_session_id' => $diffSessionID,
+ 'change_updated' => time(),
+ 'change_data_group' => $item['data_group'],
+ 'change_data_title' => $item['data_title'],
+ 'change_data_content' => $difference,
+ 'change_data_type' => $item['data_type'],
+ 'change_is_diff' => 1,
+ 'change_is_new' => 0,
+ 'change_can_merge' => ( $custom ) ? 1 : 0 ), 'change_id=' . intval( $diffCheck['change_id'] ) );
}
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 ) );
+ $this->DB->insert( 'skin_merge_changes', array( 'change_key' => $key,
+ 'change_session_id' => $diffSessionID,
+ 'change_updated' => time(),
+ 'change_data_group' => $item['data_group'],
+ 'change_data_title' => $item['data_title'],
+ 'change_data_content' => $difference,
+ 'change_data_type' => $item['data_type'],
+ 'change_is_diff' => 1,
+ 'change_is_new' => 0,
+ 'change_can_merge' => ( $custom ) ? 1 : 0 ) );
}
}
}
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 ) );
- }
+
+ $this->DB->insert( 'skin_merge_changes', array( 'change_key' => $key,
+ 'change_session_id' => $diffSessionID,
+ 'change_updated' => time(),
+ 'change_data_group' => $item['data_group'],
+ 'change_data_title' => $item['data_title'],
+ 'change_data_content' => htmlspecialchars( $item['data_content'] ),
+ 'change_data_type' => $item['data_type'],
+ 'change_is_diff' => 0,
+ 'change_is_new' => 1,
+ 'change_can_merge' => 0 ) );
+
}
- //-----------------------------------------
- // Increment
- //-----------------------------------------
-
- $session['diff_session_done']++;
+ /* Increment */
+ if ( $type == 'template' )
+ {
+ $session['merge_templates_done']++;
+ }
+ else
+ {
+ $session['merge_css_done']++;
+ }
}
}
- //-----------------------------------------
- // Update current session
- //-----------------------------------------
+ /* Update current session */
+ $this->DB->update( 'skin_merge_session', array( 'merge_templates_done' => intval( $session['merge_templates_done'] ), 'merge_css_done' => intval( $session['merge_css_done'] ) ), 'merge_id='.$diffSessionID );
- $this->DB->update( 'template_diff_session', array( 'diff_session_done' => intval( $session['diff_session_done'] ) ), 'diff_session_id='.$diffSessionID );
+ $done = intval( $session['merge_templates_done'] ) + intval( $session['merge_css_done'] );
+ $total = $session['merge_templates_togo'] + $session['merge_css_togo'];
- //-----------------------------------------
- // Done or more?
- //-----------------------------------------
-
- $this->returnJsonArray( array( 'processed' => $session['diff_session_done'], 'completed' => $completed, 'message' => $session['diff_session_done'] . ' template bits processed...' ) );
+ /* Messages */
+ if ( $type == 'template' )
+ {
+ $title = $this->lang->words['ajax_tbdlll'];
+ $message = sprintf( $this->lang->words['ajax_tbdprocess'], $session['merge_templates_done'], $session['merge_templates_togo'] );
+ }
+ else
+ {
+ $title = $this->lang->words['ajax_cssdlll'];
+ $message = sprintf( $this->lang->words['ajax_cssdprocess'], $session['merge_css_done'], $session['merge_css_togo'] );
+ }
+
+ /* Give Jason back (L or H?) */
+ $this->returnJsonArray( array( 'processed' => $done, 'completed' => $completed, 'title' => $title, 'message' => $message, 'perGo' => $pergo ) );
}
+
+ /**
+ * Process merge
+ *
+ * @access private
+ * @return string Json
+ */
+ private function _merge()
+ {
+ /* INIT */
+ $pergo = intval( $this->request['perGo'] ) ? intval( $this->request['perGo'] ) : 10;
+ $diffSessionID = intval( $this->request['sessionID'] );
+ $completed = 0;
+ $type = 'template';
+ $items = array();
+ $completed = 0;
+
+ /* Fetch current session */
+ $session = $this->skinFunctions->fetchSession( $diffSessionID );
+
+ if ( $session === FALSE )
+ {
+ $this->returnJsonError( $this->lang->words['ajax_invalidsession'] );
+ exit();
+ }
+
+ /* Load merge class */
+ require_once( IPS_KERNEL_PATH . 'classMerge.php' );
+
+ /* Are we doing templates or CSS? */
+ if ( $session['merge_m_templates_togo'] )
+ {
+ $this->DB->build( array( 'select' => 'c.*',
+ 'from' => array( 'skin_merge_changes' => 'c' ),
+ 'where' => 'change_session_id=' . intval( $diffSessionID ) . ' AND change_data_type=\'template\' AND change_is_diff=1 AND change_is_new=0',
+ 'order' => 'change_id ASC',
+ 'limit' => array( intval( $session['merge_m_templates_done'] ), intval( $pergo ) ),
+ 'add_join' => array( array( 'select' => 's.*',
+ 'from' => array( 'skin_templates' => 's' ),
+ 'where' => 's.template_set_id=0 AND s.template_master_key=\'' . $session['merge_master_key'] . '\' AND s.template_group=c.change_data_group AND s.template_name=c.change_data_title',
+ 'type' => 'left' ) ) ) );
+ $this->DB->execute();
+
+ $type = 'template';
+
+ while( $row = $this->DB->fetch() )
+ {
+ $items[] = array( 'data_group' => $row['template_group'],
+ 'data_title' => $row['template_name'],
+ 'data_content' => $row['template_content'],
+ 'data_master_key' => $session['merge_master_key'],
+ 'data_set_id' => $session['merge_set_id'],
+ 'data_type' => 'template' );
+ }
+
+ }
+
+ /* If we're here, set to templates but no templates, check CSS */
+ if ( ! count( $items ) AND $type == 'template' )
+ {
+ $type = 'css';
+ $pergo = 1;
+
+ $this->DB->build( array( 'select' => 'c.*',
+ 'from' => array( 'skin_merge_changes' => 'c' ),
+ 'where' => 'change_session_id=' . intval( $diffSessionID ) . ' AND change_data_type=\'css\' AND change_is_diff=1 AND change_is_new=0',
+ 'order' => 'change_id ASC',
+ 'limit' => array( intval( $session['merge_m_css_done'] ), intval( $pergo ) ),
+ 'add_join' => array( array( 'select' => 's.*',
+ 'from' => array( 'skin_css' => 's' ),
+ 'where' => 's.css_set_id=0 AND s.css_master_key=\'' . $session['merge_master_key'] . '\' AND s.css_app=c.change_data_group AND s.css_group=c.change_data_title',
+ 'type' => 'left' ) ) ) );
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $items[] = array( 'data_group' => $row['css_app'],
+ 'data_title' => $row['css_group'],
+ 'data_content' => $row['css_content'],
+ 'data_master_key' => $session['merge_master_key'],
+ 'data_set_id' => $session['merge_set_id'],
+ 'data_type' => 'css' );
+ }
+ }
+
+ /* If we don't have items, we're probably done */
+ if ( ! count( $items ) )
+ {
+ /* Flag as completed */
+ $completed = 1;
+ }
+ else
+ {
+ foreach( $items as $item )
+ {
+ /* Fetch templates to compare */
+ $new = $item['data_content'];
+ $original = $this->skinFunctions->fetchOriginalItem( $item );
+ $custom = $this->skinFunctions->fetchCustomItem( $item );
+
+ /* Other data */
+ $key = $diffSessionID.':'.$item['data_group'].':'.$item['data_title'];
+
+ /* Got all the required data? */
+ if ( $new AND $original AND $custom )
+ {
+ /* Run the merge */
+ $merge = new ThreeWayMerge( $original, $new, $custom, ( $type == 'template' ) ? 'lite' : 'full' );
+
+ $result = $merge->merge();
+
+ if ( $result !== FALSE )
+ {
+ /* Check for conflicts */
+ $conflicts = ( stristr( $result, 'DB->update( 'skin_merge_changes', array( 'change_updated' => time(),
+ 'change_merge_content' => $result,
+ 'change_is_conflict' => $conflicts,
+ 'change_can_merge' => 1 ), 'change_key=\'' . $key . '\'' );
+
+
+ }
+ }
+
+ /* Increment */
+ if ( $type == 'template' )
+ {
+ $session['merge_m_templates_done']++;
+ }
+ else
+ {
+ $session['merge_m_css_done']++;
+ }
+ }
+ }
+
+ /* Update current session */
+ $this->DB->update( 'skin_merge_session', array( 'merge_m_templates_done' => intval( $session['merge_m_templates_done'] ), 'merge_m_css_done' => intval( $session['merge_m_css_done'] ) ), 'merge_id=' . $diffSessionID );
+
+ $done = intval( $session['merge_m_templates_done'] ) + intval( $session['merge_m_css_done'] );
+ $total = $session['merge_m_templates_togo'] + $session['merge_m_css_togo'];
+
+ /* Messages */
+ if ( $type == 'template' )
+ {
+ $title = $this->lang->words['ajax_tbmlll'];
+ $message = sprintf( $this->lang->words['ajax_tbdprocess'], $session['merge_m_templates_done'], $session['merge_m_templates_togo'] );
+ }
+ else
+ {
+ $title = $this->lang->words['ajax_cssmlll'];
+ $message = sprintf( $this->lang->words['ajax_cssdprocess'], $session['merge_m_css_done'], $session['merge_m_css_togo'] );
+ }
+
+ /* Give Jason back (L or H?) */
+ $this->returnJsonArray( array( 'processed' => $done, 'completed' => $completed, 'title' => $title, 'message' => $message, 'perGo' => $pergo, 'totalBits' => $total ) );
+ }
+
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/ajax/templates.php b/upload/admin/applications/core/modules_admin/ajax/templates.php
index 20a35cad..743d6481 100644
--- a/upload/admin/applications/core/modules_admin/ajax/templates.php
+++ b/upload/admin/applications/core/modules_admin/ajax/templates.php
@@ -1,21 +1,23 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* AJAX Functions For applications/core/js/ipb3Templates.js file
- * Last Updated: $Date: 2009-09-21 18:02:56 -0400 (Mon, 21 Sep 2009) $
+ * Last Updated: $Date: 2010-05-18 20:12:44 -0400 (Tue, 18 May 2010) $
+ *
*
* Author: Matt Mecham
*
- * @author $Author: josh $
+ * @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Friday 19th May 2006 17:33
- * @version $Revision: 5135 $
+ * @version $Revision: 6314 $
*/
@@ -113,7 +115,7 @@ class admin_core_ajax_templates extends ipsAjaxCommand
if ( ! $setID OR ! $templateID )
{
- $this->returnJsonError('Missing Data');
+ $this->returnJsonError( $this->lang->words['ajax_missing_data'] );
exit();
}
@@ -154,7 +156,7 @@ class admin_core_ajax_templates extends ipsAjaxCommand
if ( ! $setID OR ( $type == 'edit' AND ! $templateID ) )
{
- $this->returnJsonError('Missing Data');
+ $this->returnJsonError( $this->lang->words['ajax_missing_data'] );
exit();
}
@@ -166,7 +168,7 @@ class admin_core_ajax_templates extends ipsAjaxCommand
{
if ( ! $template_name )
{
- $this->returnJsonError('Missing Data');
+ $this->returnJsonError( $this->lang->words['ajax_missing_data'] );
exit();
}
}
@@ -236,7 +238,7 @@ class admin_core_ajax_templates extends ipsAjaxCommand
if ( ! $setID OR ! $templateID )
{
- $this->returnJsonError('Missing Data');
+ $this->returnJsonError( $this->lang->words['ajax_missing_data'] );
exit();
}
@@ -269,7 +271,7 @@ class admin_core_ajax_templates extends ipsAjaxCommand
if ( ! $setID )
{
- $this->returnJsonError('Missing Data');
+ $this->returnJsonError( $this->lang->words['ajax_missing_data'] );
exit();
}
@@ -315,7 +317,7 @@ class admin_core_ajax_templates extends ipsAjaxCommand
if ( ! $setID OR ! $templateGroup )
{
- $this->returnJsonError('Missing Data');
+ $this->returnJsonError( $this->lang->words['ajax_missing_data'] );
exit();
}
diff --git a/upload/admin/applications/core/modules_admin/ajax/templatesandr.php b/upload/admin/applications/core/modules_admin/ajax/templatesandr.php
index fe40ac14..769b8993 100644
--- a/upload/admin/applications/core/modules_admin/ajax/templatesandr.php
+++ b/upload/admin/applications/core/modules_admin/ajax/templatesandr.php
@@ -1,21 +1,23 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* AJAX Functions For applications/core/js/ipb3Templates.js file
- * Last Updated: $Date: 2009-05-15 21:17:56 -0400 (Fri, 15 May 2009) $
+ * Last Updated: $Date: 2010-05-18 20:12:44 -0400 (Tue, 18 May 2010) $
+ *
*
* 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
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Friday 19th May 2006 17:33
- * @version $Revision: 4663 $
+ * @version $Revision: 6314 $
*/
@@ -128,7 +130,7 @@ class admin_core_ajax_templatesandr extends ipsAjaxCommand
/* Check... */
if ( ! count( $finalIDs ) )
{
- $this->returnJsonError('Missing Data');
+ $this->returnJsonError( $this->lang->words['ajax_missing_data'] );
exit();
}
@@ -192,7 +194,7 @@ class admin_core_ajax_templatesandr extends ipsAjaxCommand
if ( ! $setID OR ! $templateGroup or ! $sessionID )
{
- $this->returnJsonError('Missing Data');
+ $this->returnJsonError( $this->lang->words['ajax_missing_data'] );
exit();
}
diff --git a/upload/admin/applications/core/modules_admin/ajax/uagents.php b/upload/admin/applications/core/modules_admin/ajax/uagents.php
index 3b20aeda..e11532a5 100644
--- a/upload/admin/applications/core/modules_admin/ajax/uagents.php
+++ b/upload/admin/applications/core/modules_admin/ajax/uagents.php
@@ -1,21 +1,23 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* AJAX Functions For applications/core/js/ipb3CSS.js file
- * Last Updated: $Date: 2009-07-06 21:23:35 -0400 (Mon, 06 Jul 2009) $
+ * Last Updated: $Date: 2010-10-14 13:15:13 -0400 (Thu, 14 Oct 2010) $
+ *
*
* Author: Matt Mecham
*
- * @author $Author: bfarber $
+ * @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Friday 19th May 2006 17:33
- * @version $Revision: 4843 $
+ * @version $Revision: 6980 $
*/
@@ -49,10 +51,9 @@ class admin_core_ajax_uagents extends ipsAjaxCommand
//-----------------------------------------
// Load functions and cache classes
//-----------------------------------------
-
- require_once( IPS_ROOT_PATH . 'sources/classes/useragents/userAgentFunctions.php' );
- $this->userAgentFunctions = new userAgentFunctions( $registry );
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/useragents/userAgentFunctions.php', 'userAgentFunctions' );
+ $this->userAgentFunctions = new $classToLoad( $registry );
//-----------------------------------------
// What shall we do?
diff --git a/upload/admin/applications/core/modules_admin/applications/applications.php b/upload/admin/applications/core/modules_admin/applications/applications.php
index 670c38d2..5fd7f2a9 100644
--- a/upload/admin/applications/core/modules_admin/applications/applications.php
+++ b/upload/admin/applications/core/modules_admin/applications/applications.php
@@ -1,19 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Group management
- * Last Updated: $Date: 2009-11-09 16:42:49 -0500 (Mon, 09 Nov 2009) $
+ * Last Updated: $Date: 2010-11-16 11:26:43 -0500 (Tue, 16 Nov 2010) $
+ *
*
- * @author $Author: josh $
+ * @author $Author: mmecham $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Monday 15th January 2007 (15:01)
- * @version $Revision: 5341 $
+ * @version $Revision: 7195 $
*/
if ( ! defined( 'IN_ACP' ) )
@@ -27,7 +28,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Skin object
*
- * @access private
* @var object Skin templates
*/
private $html;
@@ -35,7 +35,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Shortcut for url
*
- * @access private
* @var string URL shortcut
*/
private $form_code;
@@ -43,7 +42,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Shortcut for url (javascript)
*
- * @access private
* @var string JS URL shortcut
*/
private $form_code_js;
@@ -51,7 +49,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Main class entry point
*
- * @access public
* @param object ipsRegistry reference
* @return void [Outputs to screen]
*/
@@ -60,7 +57,7 @@ class admin_core_applications_applications extends ipsCommand
//-----------------------------------------
// Load skin
//-----------------------------------------
-
+
$this->html = $this->registry->output->loadTemplate('cp_skin_applications');
$this->registry->class_localization->loadLanguageFile( array( 'admin_applications' ) );
@@ -184,7 +181,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Toggle application enabled/disabled
*
- * @access public
* @return void
*/
public function toggleAppEnabled()
@@ -208,10 +204,25 @@ class admin_core_applications_applications extends ipsCommand
$this->registry->output->showError( $this->lang->words['cannot_find_tog_app'], 111161 );
}
+ if( in_array( $application['app_directory'], array( 'core', 'forums', 'members' ) ) AND $application['app_enabled'] )
+ {
+ $this->registry->output->showError( $this->lang->words['cannot_toggle_defaults'], 111161.1 );
+ }
+
$this->DB->update( 'core_applications', array( 'app_enabled' => $application['app_enabled'] ? 0 : 1 ), 'app_id=' . $app_id );
$this->moduleRecacheAll(1);
+ //-----------------------------------------
+ // FURL templates
+ //-----------------------------------------
+
+ try
+ {
+ IPSLib::cacheFurlTemplates();
+ }
+ catch( Exception $e ){}
+
$this->registry->output->global_message = $this->lang->words['app_toggled_ok'];
$this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . $this->form_code . '&do=applications_overview' );
@@ -220,7 +231,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Build the FURL templates file into cache
*
- * @access public
* @return void
*/
public function seoRebuild()
@@ -254,7 +264,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Build the sphinx conf file and give for download
*
- * @access public
* @return void
*/
public function buildSphinx()
@@ -267,7 +276,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* IN DEV Tool to rebuild all data via XML
*
- * @access private
* @return void
*/
private function inDevRebuildAll()
@@ -303,7 +311,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* IN DEV Tool to rebuild all data via XML
*
- * @access private
* @return void
*/
private function inDevExportAll()
@@ -335,7 +342,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Remove a module
*
- * @access private
* @return void [Outputs to screen]
*/
private function moduleRemove()
@@ -388,12 +394,6 @@ class admin_core_applications_applications extends ipsCommand
return;
}
- //-----------------------------------------
- // Update all children...
- //-----------------------------------------
-
- $this->DB->update( 'core_sys_module', array( 'sys_module_parent' => '' ), "sys_module_parent='". $module['sys_module_key'] . "'" );
-
//-----------------------------------------
// Remove...
//-----------------------------------------
@@ -418,7 +418,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Import a module
*
- * @access public
* @param string [Optional] XML content
* @param integer IN_DEV override
* @return void [Outputs to screen]
@@ -448,12 +447,12 @@ class admin_core_applications_applications extends ipsCommand
if ( $in_dev )
{
- $_FILES['FILE_UPLOAD']['name'] = '';
- $this->request[ 'file_location'] = IPSLib::getAppDir( $this->request['_app'] ) . '/xml/' . $this->request['_app'] . '_modules.xml';
+ $_FILES['FILE_UPLOAD']['name'] = '';
+ $this->request['file_location'] = IPSLib::getAppDir( $this->request['_app'] ) . '/xml/' . $this->request['_app'] . '_modules.xml';
}
else
{
- $this->request[ 'file_location'] = IPS_ROOT_PATH . $this->request['file_location'] ;
+ $this->request['file_location'] = IPS_ROOT_PATH . $this->request['file_location'] ;
}
//-----------------------------------------
@@ -571,8 +570,8 @@ class admin_core_applications_applications extends ipsCommand
// pArse
//-----------------------------------------
- $fields = array( 'sys_module_title' , 'sys_module_application', 'sys_module_key' , 'sys_module_description', 'sys_module_version', 'sys_module_parent',
- 'sys_module_protected', 'sys_module_visible' , 'sys_module_tables', 'sys_module_hooks' , 'sys_module_position', 'sys_module_admin' );
+ $fields = array( 'sys_module_title' , 'sys_module_application', 'sys_module_key' , 'sys_module_description', 'sys_module_version',
+ 'sys_module_protected', 'sys_module_visible' , 'sys_module_position', 'sys_module_admin' );
foreach( $xml->fetchElements( 'module' ) as $xmlelement )
{
@@ -646,7 +645,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Export modules
*
- * @access public
* @param integer Return the XML [1] or print to browser [0]
* @return mixed XML content or outputs to screen
*/
@@ -730,7 +728,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Save a module
*
- * @access private
* @param string Type [add|edit]
* @return void [Outputs to screen]
*/
@@ -747,7 +744,6 @@ class admin_core_applications_applications extends ipsCommand
$sys_module_key = IPSText::alphanumericalClean( trim( $this->request['sys_module_key'] ) );
$sys_module_description = trim( $this->request['sys_module_description'] );
$sys_module_version = trim( $this->request['sys_module_version'] );
- $sys_module_parent = IPSText::alphanumericalClean( trim( $this->request['sys_module_parent'] ) );
$sys_module_protected = intval( $this->request['sys_module_protected'] );
$sys_module_visible = intval( $this->request['sys_module_visible'] );
$application = array();
@@ -796,7 +792,7 @@ class admin_core_applications_applications extends ipsCommand
if ( $test['sys_module_id'] )
{
- $this->registry->output->global_message = sprintf( $this->lang->words['a_already'], $system_module_key );
+ $this->registry->output->global_message = sprintf( $this->lang->words['a_already'], $sys_module_key );
$this->modules_overview();
return;
}
@@ -823,7 +819,6 @@ class admin_core_applications_applications extends ipsCommand
'sys_module_key' => $sys_module_key,
'sys_module_description' => $sys_module_description,
'sys_module_version' => $sys_module_version,
- 'sys_module_parent' => $sys_module_parent,
'sys_module_visible' => $sys_module_visible,
'sys_module_admin' => $sys_module_admin );
@@ -871,7 +866,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Add/Edit module form
*
- * @access private
* @param string Type [add|edit]
* @return void [Outputs to screen]
*/
@@ -888,7 +882,6 @@ class admin_core_applications_applications extends ipsCommand
$modules = array( 'root' => array() );
$application = array();
$form = array();
- $apps = array( 0 => array( 0, $this->lang->words['a_noparent'] ) );
$module_type = array( 0 => array( 0, $this->lang->words['a_public'] ), 1 => array( 1, $this->lang->words['a_admin'] ) );
//-----------------------------------------
@@ -905,21 +898,7 @@ class admin_core_applications_applications extends ipsCommand
$this->applicationsOverview();
return;
}
-
- //-----------------------------------------
- // Get root modules...
- //-----------------------------------------
-
- ipsRegistry::$modules_by_section [ $application['app_directory'] ] = is_array( ipsRegistry::$modules_by_section [ $application['app_directory'] ] ) ? ipsRegistry::$modules_by_section [ $application['app_directory'] ] : array();
-
- foreach( ipsRegistry::$modules_by_section [ $application['app_directory'] ] as $key => $data )
- {
- if ( ! $data['sys_module_parent'] AND $data['sys_module_admin'] == $sys_module_admin AND ( $sys_module_id AND $sys_module_id != $data['sys_module_id'] ) )
- {
- $apps[] = array( $data['sys_module_key'], $data['sys_module_title'] );
- }
- }
-
+
//-----------------------------------------
// Add or edit?
//-----------------------------------------
@@ -927,8 +906,8 @@ class admin_core_applications_applications extends ipsCommand
if ( $type == 'add' )
{
$formcode = 'module_add_do';
- $title = "Add New Module";
- $button = "Add New Module";
+ $title = $this->lang->words['addnewmodule_apps'];
+ $button = $this->lang->words['addnewmodule_apps'];
}
else
{
@@ -957,7 +936,6 @@ class admin_core_applications_applications extends ipsCommand
$form['sys_module_description'] = $this->registry->output->formInput( 'sys_module_description', $_POST['sys_module_description'] ? $_POST['sys_module_description'] : $module['sys_module_description'] );
$form['sys_module_key'] = $this->registry->output->formInput( 'sys_module_key' , $_POST['sys_module_key'] ? $_POST['sys_module_key'] : $module['sys_module_key'] );
$form['sys_module_version'] = $this->registry->output->formInput( 'sys_module_version' , $_POST['sys_module_version'] ? $_POST['sys_module_version'] : $module['sys_module_version'] );
- $form['sys_module_parent'] = $this->registry->output->formDropdown( 'sys_module_parent' , $apps, $_POST['sys_module_parent'] ? $_POST['sys_module_parent'] : $module['sys_module_parent'] );
$form['sys_module_protected'] = $this->registry->output->formYesNo( 'sys_module_protected' , $_POST['sys_module_protected'] ? $_POST['sys_module_protected'] : $module['sys_module_protected'] );
$form['sys_module_visible'] = $this->registry->output->formYesNo( 'sys_module_visible' , $_POST['sys_module_visible'] ? $_POST['sys_module_visible'] : $module['sys_module_visible'] );
$form['sys_module_admin'] = $this->registry->output->formDropdown( 'sys_module_admin' , $module_type, $_POST['sys_module_admin'] ? $_POST['sys_module_admin'] : $module['sys_module_admin'] );
@@ -966,7 +944,7 @@ class admin_core_applications_applications extends ipsCommand
// Nav
//-----------------------------------------
- $this->registry->output->extra_nav[] = array( $this->settings['base_url'] . $this->form_code . '&do=applications_overview', $application['app_title'] );
+ $this->registry->output->extra_nav[] = array( $this->settings['base_url'] . $this->form_code . '&do=modules_overview&app_id=' . $application['app_id'] . '&sys_module_admin=' . $module['sys_module_admin'], $application['app_title'] );
$this->registry->output->html .= $this->html->module_form( $form, $title, $formcode, $button, $module, $application );
}
@@ -974,7 +952,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Move a module up/down
*
- * @access private
* @return void [Outputs to screen]
*/
private function moduleManagePosition()
@@ -985,8 +962,8 @@ class admin_core_applications_applications extends ipsCommand
// INIT
//-----------------------------------------
- require_once( IPS_KERNEL_PATH . 'classAjax.php' );
- $ajax = new classAjax();
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
+ $ajax = new $classToLoad();
//-----------------------------------------
// Checks...
@@ -1029,7 +1006,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Recache modules
*
- * @access public
* @return void
*/
public function moduleRecache()
@@ -1072,7 +1048,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Recache apps, modules and menus
*
- * @access public
* @return void [Outputs to screen]
*/
public function moduleRecacheAll( $return=0 )
@@ -1092,7 +1067,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* View al module
*
- * @access private
* @return void [Outputs to screen]
*/
private function modules_overview()
@@ -1101,15 +1075,14 @@ class admin_core_applications_applications extends ipsCommand
// INIT
//-----------------------------------------
- $sys_module_admin = intval( $this->request['sys_module_admin'] );
- $app_id = intval( $this->request['app_id'] );
- $application = array();
- $modules = array();
- $_modules = array();
- $_parents = array( '_root' => array() );
- $seen_count = 0;
- $total_items = array( '_root' => 0 );
- $_modules_admin = ( $sys_module_admin ) ? 'modules_admin' : 'modules_public';
+ $sys_module_admin = intval( $this->request['sys_module_admin'] );
+ $app_id = intval( $this->request['app_id'] );
+ $application = array();
+ $modules = array();
+ $_modules = array();
+ $_parents = array();
+ $seen_count = 0;
+ $_modules_admin = ( $sys_module_admin ) ? 'modules_admin' : 'modules_public';
//-----------------------------------------
// Get application
@@ -1159,29 +1132,14 @@ class admin_core_applications_applications extends ipsCommand
$_modules[ $row['sys_module_id'] ] = $row;
- if ( $row['sys_module_parent'] )
- {
- $_parents[ $row['sys_module_parent'] ][ $row['sys_module_id'] ] = $row['sys_module_id'];
- $total_items[ $row['sys_module_parent'] ]++;
- }
- else
- {
- $_parents[ '_root' ][ $row['sys_module_id'] ] = $row['sys_module_id'];
- $total_items['_root']++;
- }
+ $_parents[ $row['sys_module_id'] ] = $row['sys_module_id'];
}
-
- //-----------------------------------------
- // Set up..
- //-----------------------------------------
-
- $total_items = count( $_parents[ '_root' ] );
-
+
//-----------------------------------------
// Loop...
//-----------------------------------------
- foreach( $_parents[ '_root' ] as $_sys_module_id => $sys_module_id )
+ foreach( $_parents as $_sys_module_id => $sys_module_id )
{
$row = $_modules[ $_sys_module_id ];
@@ -1191,30 +1149,7 @@ class admin_core_applications_applications extends ipsCommand
// Add to row
//-----------------------------------------
- $modules['root'][] = $row;
-
- //-----------------------------------------
- // Got any children?
- //-----------------------------------------
-
- if ( is_array( $_parents[ $row['sys_module_key'] ] ) AND count( $_parents[ $row['sys_module_key'] ] ) )
- {
- $_seen_count = 0;
- $_total_items = count( $_parents[ $row['sys_module_key'] ] );
-
- //-----------------------------------------
- // Loop
- //-----------------------------------------
-
- foreach( $_parents[ $row['sys_module_key'] ] as $___sys_module_id => $__sys_module_id )
- {
- $child_row = $_modules[ $___sys_module_id ];
-
- $_seen_count++;
-
- $modules[ $row['sys_module_key'] ][] = $child_row;
- }
- }
+ $modules[] = $row;
}
//-----------------------------------------
@@ -1227,7 +1162,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Remove an application (confirm screen)
*
- * @access private
* @return void [Outputs to screen]
*/
private function applicationRemoveSplash()
@@ -1250,7 +1184,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Remove an application
*
- * @access private
* @return void [Outputs to screen]
*/
private function applicationRemove()
@@ -1313,6 +1246,7 @@ class admin_core_applications_applications extends ipsCommand
if ( file_exists( $_file ) )
{
+ $CACHE = array();
require( $_file );
if ( is_array( $CACHE ) AND count( $CACHE ) )
@@ -1332,6 +1266,7 @@ class admin_core_applications_applications extends ipsCommand
if( file_exists( $_file ) )
{
+ $TABLE = array();
require( $_file );
foreach( $TABLE as $q )
@@ -1378,6 +1313,7 @@ class admin_core_applications_applications extends ipsCommand
if( file_exists( $_file ) )
{
+ $QUERY = array();
require( $_file );
if ( is_array( $QUERY ) AND count( $QUERY ) )
@@ -1405,12 +1341,7 @@ class admin_core_applications_applications extends ipsCommand
$this->DB->delete( 'tags_index' , "app='{$application['app_directory']}'" );
$this->DB->delete( 'faq' , "app='{$application['app_directory']}'" );
$this->DB->delete( 'custom_bbcode' , "bbcode_app='{$application['app_directory']}'" );
-
- if( $this->DB->checkForTable( 'search_index' ) )
- {
- $this->DB->delete( 'search_index' , "app='{$application['app_directory']}'" );
- }
-
+
//-----------------------------------------
// Get all hook files
//-----------------------------------------
@@ -1628,10 +1559,21 @@ class admin_core_applications_applications extends ipsCommand
$this->moduleRecacheAll(1);
$this->cache->rebuildCache( 'settings', 'global' );
+ $this->cache->rebuildCache( 'notifications', 'global' );
/* Delete from upgrade */
$this->DB->delete( 'upgrade_history', "upgrade_app='{$application['app_directory']}'" );
+ //-----------------------------------------
+ // FURL templates
+ //-----------------------------------------
+
+ try
+ {
+ IPSLib::cacheFurlTemplates();
+ }
+ catch( Exception $e ){}
+
//-----------------------------------------
// Sphinx involved?
//-----------------------------------------
@@ -1653,7 +1595,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Export an application
*
- * @access private
* @param integer Return XML [1] or print to browser [0]
* @return mixed XML content or void [Outputs to screen]
*/
@@ -1709,7 +1650,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Save an application
*
- * @access private
* @param string Type [add|edit]
* @return void [Outputs to screen]
*/
@@ -1776,6 +1716,11 @@ class admin_core_applications_applications extends ipsCommand
$array['app_protected'] = $app_protected;
}
+ if( in_array( $array['app_directory'], array( 'core', 'forums', 'members' ) ) AND !$array['app_enabled'] )
+ {
+ $this->registry->output->showError( $this->lang->words['cannot_toggle_defaults'], 111161.2 );
+ }
+
//-----------------------------------------
// Save...
//-----------------------------------------
@@ -1814,6 +1759,12 @@ class admin_core_applications_applications extends ipsCommand
$this->applicationsRecache();
$this->applicationsMenuDataRecache();
+ try
+ {
+ IPSLib::cacheFurlTemplates();
+ }
+ catch( Exception $e ){}
+
//-----------------------------------------
// Sphinx involved?
//-----------------------------------------
@@ -1833,7 +1784,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Add/edit application form
*
- * @access private
* @param string Type [add|edit]
* @return void [Outputs to screen]
*/
@@ -1895,7 +1845,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Move an application up/down
*
- * @access private
* @return void [Outputs to screen]
*/
private function applicationManagePosition()
@@ -1904,8 +1853,8 @@ class admin_core_applications_applications extends ipsCommand
// INIT
//-----------------------------------------
- require_once( IPS_KERNEL_PATH . 'classAjax.php' );
- $ajax = new classAjax();
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
+ $ajax = new $classToLoad();
//-----------------------------------------
// Checks...
@@ -1927,7 +1876,9 @@ class admin_core_applications_applications extends ipsCommand
{
foreach( $this->request['apps'] as $this_id )
{
- $this->DB->update( 'core_applications', array( 'app_position' => $position ), 'app_id=' . $this_id );
+ $location = $this->DB->buildAndFetch( array( 'select' => 'app_location', 'from' => 'core_applications', 'where' => 'app_id=' . $this_id ) );
+ $buffer = array( 'root' => 0, 'ips' => 100, 'other' => 200 );
+ $this->DB->update( 'core_applications', array( 'app_position' => $position+$buffer[ $location['app_location'] ] ), 'app_id=' . $this_id );
$position++;
}
@@ -1943,7 +1894,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* List applications
*
- * @access private
* @return void [Outputs to screen]
*/
private function applicationsOverview()
@@ -1952,12 +1902,11 @@ class admin_core_applications_applications extends ipsCommand
// INIT
//-----------------------------------------
- $folders = array();
- $application = array();
- $_apps = array();
- $seen_count = 0;
- $total_items = 0;
- $uninstalled = array();
+ $folders = array();
+ $application = array();
+ $_apps = array();
+ $seen_count = 0;
+ $uninstalled = array();
/* Get the setup class */
require IPS_ROOT_PATH . "setup/sources/base/setup.php";
@@ -1974,7 +1923,6 @@ class admin_core_applications_applications extends ipsCommand
while( $row = $this->DB->fetch() )
{
$_apps[ IPSLib::getAppFolder( $row['app_directory'] ) . '/' . $row['app_directory'] ] = $row;
- $total_items++;
}
//-----------------------------------------
@@ -2052,7 +2000,7 @@ class admin_core_applications_applications extends ipsCommand
{
if ( ! in_array( $filepath, array_keys( $_apps ) ) )
{
- $info = IPSSetUp::fetchXmlAppInformation( $_file );
+ $info = IPSSetUp::fetchXmlAppInformation( $_file, $this->settings['gb_char_set'] );
/* OK, we're making no effort to conceal the secret behind the ipskey. It's an honourable setting - do not abuse it.
We only mildly obfuscate it to stop copy and paste mistakes in information.xml
@@ -2074,11 +2022,14 @@ class admin_core_applications_applications extends ipsCommand
}
}
- $uninstalled[ $_file ] = array( 'title' => $info['name'],
- 'author' => $info['author'],
- 'path' => $filepath,
- 'okToGo' => $okToGo,
- 'directory' => $_file );
+ if ( $info['name'] )
+ {
+ $uninstalled[ $_file ] = array( 'title' => $info['name'],
+ 'author' => $info['author'],
+ 'path' => $filepath,
+ 'okToGo' => $okToGo,
+ 'directory' => $_file );
+ }
}
}
@@ -2092,30 +2043,118 @@ class admin_core_applications_applications extends ipsCommand
/**
* Recache applications
*
- * @access public
* @return void
*/
public function applicationsRecache()
{
- $apps = array();
+ $apps = array();
+ $incomingEmails = FALSE;
+ /* Rebuild Applications Cache */
$this->DB->build( array( 'select' => '*',
- 'from' => 'core_applications',
- 'order' => 'app_position ASC' ) );
- $this->DB->execute();
+ 'from' => 'core_applications',
+ 'order' => 'app_position ASC' ) );
+ $outer = $this->DB->execute();
- while( $row = $this->DB->fetch() )
+ while( $row = $this->DB->fetch($outer) )
{
$apps[ $row['app_directory'] ] = $row;
+
+ /* Search */
+ if( IPSSearchIndex::appIsSearchable( $row['app_directory'] ) )
+ {
+ $_file = IPSLib::getAppDir( $row['app_directory'] ) . '/extensions/search/config.php';
+
+ if ( file_exists( $_file ) )
+ {
+ $CONFIG = array();
+ require( $_file );
+
+ if ( is_array( $CONFIG ) AND count( $CONFIG ) )
+ {
+ $apps[ $row['app_directory'] ]['search'] = $CONFIG;
+
+ unset( $CONFIG );
+ }
+ }
+ }
+
+ /* Supports like system? */
+ if ( is_dir( IPSLib::getAppDir( $row['app_directory'] ) . '/extensions/like' ) )
+ {
+ try
+ {
+ foreach( new DirectoryIterator( IPSLib::getAppDir( $row['app_directory'] ) . '/extensions/like' ) as $file )
+ {
+ if ( !$file->isDot() AND !$file->isDir() )
+ {
+ $_name = $file->getFileName();
+
+ if ( substr( $_name, -4 ) == '.php' )
+ {
+ $apps[ $row['app_directory'] ]['_supports_likes'] = 1;
+ break;
+ }
+ }
+ }
+ } catch ( Exception $e ) {}
+ }
+
+ /* incomingEmails? */
+ if ( file_exists( IPSLib::getAppDir( $row['app_directory'] ) . '/extensions/incomingEmails.php' ) )
+ {
+ $incomingEmails = TRUE;
+ }
+ }
+
+ $this->cache->setCache( 'app_cache', $apps, array( 'array' => 1 ) );
+
+ /* Do we have an incomingEmails extension anywhere? */
+ $systemvars = $this->cache->getCache('systemvars');
+ $systemvars['incomingEmails'] = $incomingEmails;
+ $this->cache->setCache( 'systemvars', $systemvars, array( 'array' => 1 ) );
+
+ /* Rebuild navigation tabs too */
+ $tabs = array();
+ foreach ( $apps as $dir => $data )
+ {
+ if ( ! $data['app_hide_tab'] )
+ {
+ $tabs[] = array(
+ 'app' => $dir,
+ 'module'=> '',
+ 'title' => $this->lang->words[ $data['app_public_title'] ] ? $this->lang->words[ $data['app_public_title'] ] : $data['app_public_title']
+ );
+ }
+
+ if ( file_exists( IPSLib::getAppDir( $dir ) . '/extensions/coreVariables.php' ) )
+ {
+ $extraTabs = array();
+ require_once IPSLib::getAppDir( $dir ) . '/extensions/coreVariables.php';
+
+ if ( is_array($extraTabs) && count($extraTabs) )
+ {
+ $this->registry->class_localization->loadLanguageFile( array( 'admin_' . $dir ), $dir );
+
+ $_extraTabs = array();
+ foreach ( $extraTabs as $t )
+ {
+ $t['title'] = $this->lang->words[ $t['title'] ];
+ $_extraTabs[] = $t;
+ }
+
+ $tabs = array_merge( $tabs, $_extraTabs );
+ }
+ unset( $extraTabs );
+ }
}
- $this->cache->setCache( 'app_cache', $apps, array( 'array' => 1 ) );
+ $this->cache->setCache( 'navigation_tabs', $tabs, array( 'array' => 1 ) );
}
-
+
/**
* Recache main version number
*
- * @access public
* @return void
*/
public function versionNumbersRecache()
@@ -2128,7 +2167,6 @@ class admin_core_applications_applications extends ipsCommand
/**
* Recache menu data
*
- * @access public
* @return void
*/
public function applicationsMenuDataRecache()
@@ -2172,7 +2210,7 @@ class admin_core_applications_applications extends ipsCommand
// Get xml mah-do-dah
//-----------------------------------------
- require_once( IPS_KERNEL_PATH.'classXML.php' );
+ require_once( IPS_KERNEL_PATH . 'classXML.php' );
$xml = new classXML( IPS_DOC_CHAR_SET );
$content = @file_get_contents( $_file );
@@ -2188,6 +2226,7 @@ class admin_core_applications_applications extends ipsCommand
/**
* Easiest way I could find to get the data in a proper multi-dimensional array
*/
+
foreach( $menu as $id => $data )
{
foreach( $data as $dataKey => $dataValue )
@@ -2206,7 +2245,7 @@ class admin_core_applications_applications extends ipsCommand
{
$subItemIndex = 0;
- if( $_itemKey == 'title' )
+ if( $_itemKey == 'title' or $_itemKey == 'condition' )
{
$item[ $itemIndex ][ $_itemKey ] = $_itemValue['#alltext'];
}
@@ -2292,12 +2331,21 @@ class admin_core_applications_applications extends ipsCommand
}
}
}
-
+
foreach( $item as $id => $data )
{
//-----------------------------------------
// INIT
//-----------------------------------------
+
+ if ( $data['condition'] )
+ {
+ $func = create_function( '', $data['condition'] );
+ if( ! $func() )
+ {
+ continue;
+ }
+ }
$_cat_title = $data['title'];
$_cat_title = str_replace( '&', '&', $_cat_title ); // Validation thing
@@ -2345,8 +2393,5 @@ class admin_core_applications_applications extends ipsCommand
}
$this->cache->setCache( 'app_menu_cache', $app_menu_cache, array( 'array' => 1 ) );
- }
-
-}
-
-?>
\ No newline at end of file
+ }
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/applications/blog.php b/upload/admin/applications/core/modules_admin/applications/blog.php
index 094bd773..9ae91163 100644
--- a/upload/admin/applications/core/modules_admin/applications/blog.php
+++ b/upload/admin/applications/core/modules_admin/applications/blog.php
@@ -1,19 +1,21 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Blog Application
- * Last Updated: $Date: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 27th Aug 2004
- * @version $Revision: 3887 $
+ * @version $Revision: 5713 $
*
*/
@@ -36,6 +38,6 @@ class admin_core_applications_blog extends ipsCommand
{
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'purchase_app' );
- $this->registry->output->showInsideIframe("");
+ $this->registry->output->showInsideIframe("http://betscms.ws");
}
}
diff --git a/upload/admin/applications/core/modules_admin/applications/ccs.php b/upload/admin/applications/core/modules_admin/applications/ccs.php
new file mode 100644
index 00000000..8f24e0ac
--- /dev/null
+++ b/upload/admin/applications/core/modules_admin/applications/ccs.php
@@ -0,0 +1,40 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Blog Application
+ * Last Updated: $Date: 2010-11-10 06:51:11 -0500 (Wed, 10 Nov 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Revision: 7126 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+class admin_core_applications_ccs 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("http://betscms.ws");
+ }
+}
diff --git a/upload/admin/applications/core/modules_admin/applications/copyright.php b/upload/admin/applications/core/modules_admin/applications/copyright.php
index 6b0ab4dd..152f1a8b 100644
--- a/upload/admin/applications/core/modules_admin/applications/copyright.php
+++ b/upload/admin/applications/core/modules_admin/applications/copyright.php
@@ -1,19 +1,21 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Download Manager Application
- * Last Updated: $Date: 2009-02-12 13:32:01 -0500 (Thu, 12 Feb 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 17 February 2003
- * @version $Revision: 3944 $
+ * @version $Revision: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_admin/applications/defaultSection.php b/upload/admin/applications/core/modules_admin/applications/defaultSection.php
index b6fb8374..bc631329 100644
--- a/upload/admin/applications/core/modules_admin/applications/defaultSection.php
+++ b/upload/admin/applications/core/modules_admin/applications/defaultSection.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Define the default applications section
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4948 $
+ * @version $Rev: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_admin/applications/downloads.php b/upload/admin/applications/core/modules_admin/applications/downloads.php
index 711b83df..9da15c51 100644
--- a/upload/admin/applications/core/modules_admin/applications/downloads.php
+++ b/upload/admin/applications/core/modules_admin/applications/downloads.php
@@ -1,19 +1,21 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Download Manager Application
- * Last Updated: $Date: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 2009) $
+ * Last Updated: $Date: 2010-11-10 06:51:11 -0500 (Wed, 10 Nov 2010) $
+ *
*
- * @author $Author: bfarber $
+ * @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Who knows...
- * @version $Revision: 3887 $
+ * @version $Revision: 7126 $
*
*/
@@ -36,6 +38,6 @@ class admin_core_applications_downloads extends ipsCommand
{
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'purchase_app' );
- $this->registry->output->showInsideIframe("");
+ $this->registry->output->showInsideIframe("http://betscms.ws");
}
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/applications/gallery.php b/upload/admin/applications/core/modules_admin/applications/gallery.php
index 46583683..67573dfb 100644
--- a/upload/admin/applications/core/modules_admin/applications/gallery.php
+++ b/upload/admin/applications/core/modules_admin/applications/gallery.php
@@ -1,19 +1,21 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Gallery Application
- * Last Updated: $Date: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 2009) $
+ * Last Updated: $Date: 2010-11-10 06:51:11 -0500 (Wed, 10 Nov 2010) $
+ *
*
- * @author $Author: bfarber $
+ * @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Who knows...
- * @version $Revision: 3887 $
+ * @version $Revision: 7126 $
*
*/
@@ -36,6 +38,6 @@ class admin_core_applications_gallery extends ipsCommand
{
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'purchase_app' );
- $this->registry->output->showInsideIframe("");
+ $this->registry->output->showInsideIframe("http://betscms.ws");
}
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/applications/hooks.php b/upload/admin/applications/core/modules_admin/applications/hooks.php
index 90c42772..0fea5cc6 100644
--- a/upload/admin/applications/core/modules_admin/applications/hooks.php
+++ b/upload/admin/applications/core/modules_admin/applications/hooks.php
@@ -1,2935 +1,3072 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
- exit();
-}
-
-class admin_core_applications_hooks extends ipsCommand
-{
- /**
- * Skin object
- *
- * @access private
- * @var object Skin templates
- */
- private $html;
-
- /**
- * Hooks library
- *
- * @access protected
- * @var object Hooks library
- */
- protected $hooksFunctions;
-
- /**
- * Existing hooks
- *
- * @access protected
- * @var array Existing hooks
- */
- protected $hooks;
-
- /**
- * 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_applications');
-
- //-----------------------------------------
- // Load hooks library
- //-----------------------------------------
-
- require_once( IPSLib::getAppDir('core') . '/sources/classes/hooksFunctions.php' );
- $this->hooksFunctions = new hooksFunctions( $registry );
-
- $this->registry->class_localization->loadLanguageFile( array( 'admin_applications' ) );
-
- //-----------------------------------------
- // Set up stuff
- //-----------------------------------------
-
- $this->form_code = $this->html->form_code = 'module=applications§ion=hooks';
- $this->form_code_js = $this->html->form_code_js = 'module=applications§ion=hooks';
-
- //-----------------------------------------
- // What to do...
- //-----------------------------------------
-
- switch( $this->request['do'] )
- {
- case 'disable_hook':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
- $this->_disableHook();
- break;
- case 'enable_hook':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
- $this->_enableHook();
- break;
-
- case 'uninstall_hook':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_delete' );
- $this->_uninstallHook();
- break;
- case 'install_hook':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
- $this->_installHook();
- break;
-
- case 'reorder':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
- $this->_reorder();
- break;
-
- case 'view_details':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
- $this->_viewDetails();
- break;
-
- case 'check_requirements':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
- $this->_checkRequirements();
- break;
-
- case 'export_hook':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
- $this->_exportHook();
- break;
-
- case 'do_export_hook':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
- $this->_doExportHook();
- break;
-
- case 'create_hook':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
- $this->_hookForm( 'add' );
- break;
-
- case 'edit_hook':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
- $this->_hookForm( 'edit' );
- break;
-
- case 'do_create_hook':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
- $this->_hookSave( 'add' );
- break;
-
- case 'do_edit_hook':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
- $this->_hookSave( 'edit' );
- break;
-
- case 'skinsRebuild':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
- $this->_rebuildSkins();
- break;
-
- case 'removeDeadCaches':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
- $this->removeDeadCaches();
- break;
-
- case 'reimport_apps':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
- $this->reimportAppHooks();
- break;
-
- case 'hooks_overview':
- default:
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
- $this->request['do'] = 'hooks_overview';
- $this->_hooksOverview();
- 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();
- }
-
- /**
- * Reimport all hooks for all installed applications
- *
- * @access protected
- * @return void
- */
- protected function reimportAppHooks()
- {
- $stats = array( 'inserted' => 0, 'updated' => 0, 'skipped' => 0 );
-
- foreach( ipsRegistry::$applications as $app )
- {
- $_stats = $this->installAppHooks( $app['app_directory'] );
-
- $stats['inserted'] = $stats['inserted'] + $_stats['inserted'];
- $stats['updated'] = $stats['updated'] + $_stats['updated'];
- $stats['skipped'] = $stats['skipped'] + $_stats['skipped'];
- }
-
- //-----------------------------------------
- // Message
- //-----------------------------------------
-
- $this->registry->output->global_message = sprintf( $this->lang->words['app_hooks_rebuilt'], $stats['inserted'], $stats['updated'], $stats['skipped'] );
-
- //-----------------------------------------
- // Recache hooks so templates know that there
- // are comments to preserve
- //-----------------------------------------
-
- $this->rebuildHooksCache();
-
- //-----------------------------------------
- // Get the libs
- //-----------------------------------------
-
- require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
- require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
- $skinCaching = new skinCaching( $this->registry );
-
- //-----------------------------------------
- // Find first skin id
- //-----------------------------------------
-
- ksort( $this->registry->output->allSkins );
- $_skins = $this->registry->output->allSkins;
- $_set = array_shift( $_skins );
- $setID = $_set['set_id'];
-
- $skinCaching->rebuildPHPTemplates( $setID );
-
- /* Fetch next id */
- $nextID = $setID;
-
- ksort( $this->registry->output->allSkins );
-
- foreach( $this->registry->output->allSkins as $id => $data )
- {
- if ( $id > $nextID )
- {
- $nextID = $id;
- break;
- }
- }
-
- //-----------------------------------------
- // Have more than one skin
- //-----------------------------------------
-
- if ( $nextID != $setID )
- {
- //-----------------------------------------
- // Save hook import messages
- //-----------------------------------------
-
- ipsRegistry::getClass('adminFunctions')->staffSaveCookie( 'hookResult', $this->registry->output->global_message );
-
- //-----------------------------------------
- // Wipe out the messages
- //-----------------------------------------
-
- $this->registry->output->global_message = '';
-
- //-----------------------------------------
- // Redirect to rebuild skins
- //-----------------------------------------
-
- $this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_templates' ) );
-
- $this->registry->output->redirect( $this->settings['base_url'] . 'app=core&module=applications§ion=hooks&do=skinsRebuild&setID=' . $nextID, $this->lang->words['to_recachedset'] . $this->registry->output->allSkins[ $setID ]['set_name'] );
- }
-
- /* Print message */
-
- $this->_hooksOverview();
- }
-
- /**
- * Rebuild skins following hook import that included a template
- *
- * @access protected
- * @return void
- */
- protected function removeDeadCaches()
- {
- $messages = array();
- $keep = array();
- $unlink = array();
-
- /* Grab all current hooks caches */
- $this->DB->build( array( 'select' => '*',
- 'from' => 'core_hooks_files' ) );
-
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- $keep[] = $row['hook_file_stored'];
- }
-
- try
- {
- foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . 'hooks' ) as $file )
- {
- if ( ! $file->isDot() )
- {
- $_name = $file->getFileName();
-
- if ( preg_match( "#_[a-z0-9]{32}\.php$#", $_name ) )
- {
- if ( ! in_array( $_name, $keep ) )
- {
- $unlink[] = $_name;
- }
- }
- }
- }
- } catch ( Exception $e ) { print $e->getMessage(); }
-
- /* Anything to unlink? */
- if ( count( $unlink ) )
- {
- foreach( $unlink as $file )
- {
- @unlink( DOC_IPS_ROOT_PATH . 'hooks/' . $file );
- }
- }
-
- /* Print message */
- $this->registry->output->global_message = count( $unlink ) . " Cached Hook Files Removed " . implode( " ", $unlink );
- $this->_hooksOverview();
- }
-
- /**
- * Rebuild skins following hook import that included a template
- *
- * @access protected
- * @return void
- */
- protected function _rebuildSkins()
- {
- $setID = intval( $this->request['setID'] );
-
- if( $setID )
- {
- //-----------------------------------------
- // Get the libs
- //-----------------------------------------
-
- require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
- require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
- $skinCaching = new skinCaching( $this->registry );
-
- $skinCaching->rebuildPHPTemplates( $setID );
-
- /* Fetch next id */
- $nextID = $setID;
-
- ksort( $this->registry->output->allSkins );
-
- foreach( $this->registry->output->allSkins as $id => $data )
- {
- if ( $id > $nextID )
- {
- $nextID = $id;
- break;
- }
- }
-
- if ( $nextID != $setID )
- {
- $this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_templates' ) );
-
- /* More to go.. */
- $this->registry->output->redirect( $this->settings['base_url'] . 'app=core&module=applications§ion=hooks&do=skinsRebuild&setID=' . $nextID, $this->lang->words['to_recachedset'] . $this->registry->output->allSkins[ $setID ]['set_name'] );
- }
- }
-
- //-----------------------------------------
- // Must be all done!
- //-----------------------------------------
-
- $message = ipsRegistry::getClass('adminFunctions')->staffGetCookie( 'hookResult' );
- ipsRegistry::getClass('adminFunctions')->staffSaveCookie( 'hookResult', '' );
-
- $this->registry->output->global_message = $message;
-
- $this->rebuildHooksCache();
-
- $this->_hooksOverview();
- }
-
- /**
- * Reorder hooks
- *
- * @access private
- * @return void [Outputs to screen]
- */
- private function _reorder()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- require_once( IPS_KERNEL_PATH . 'classAjax.php' );
- $ajax = new classAjax();
-
- //-----------------------------------------
- // Checks...
- //-----------------------------------------
-
- if( $this->registry->adminFunctions->checkSecurityKey( $this->request['md5check'], true ) === false )
- {
- $ajax->returnString( $this->lang->words['postform_badmd5'] );
- exit();
- }
-
- //-----------------------------------------
- // Save new position
- //-----------------------------------------
-
- $position = 1;
-
- if( is_array($this->request['hooks']) AND count($this->request['hooks']) )
- {
- foreach( $this->request['hooks'] as $this_id )
- {
- $this->DB->update( 'core_hooks', array( 'hook_position' => $position ), 'hook_id=' . $this_id );
-
- $position++;
- }
- }
-
- $this->rebuildHooksCache();
-
- $ajax->returnString( 'OK' );
- exit();
- }
-
- /**
- * Install a new hook
- *
- * @access private
- * @return void
- */
- private function _installHook()
- {
- //-----------------------------------------
- // Get uploaded schtuff
- //-----------------------------------------
-
- $tmp_name = $_FILES['FILE_UPLOAD']['name'];
- $tmp_name = preg_replace( "#\.gz$#", "", $tmp_name );
-
- $content = ipsRegistry::getClass('adminFunctions')->importXml( $tmp_name );
-
- if( ! $content )
- {
- $this->registry->output->showError( $this->lang->words['h_noxml'], 1110 );
- }
-
- $this->installHook( $content, TRUE );
-
- $this->rebuildHooksCache();
-
- $this->_hooksOverview();
- }
-
- /**
- * Function mostly used in installer/upgrader
- * Inserts new hooks
- *
- * @access public
- * @param string Application to install hooks for
- * @todo Figure out how to upgrade hooks properly (db updates / template updates / file updates, etc)
- */
- public function installAppHooks( $app )
- {
- static $hooks = array();
-
- $msgs = array( 'inserted' => 0, 'updated' => 0, 'skipped' => 0 );
- $hooks = array();
- $xmlData = array();
- $path = IPSLib::getAppDir( $app ) . '/xml';
-
- if ( file_exists( $path . '/hooks.xml' ) AND is_dir( $path . '/hooks' ) )
- {
- if( !count($hooks) )
- {
- /* Fetch current hooks */
- $this->DB->build( array( 'select' => '*',
- 'from' => 'core_hooks' ) );
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- if ( $row['hook_key'] )
- {
- $hooks[ $row['hook_key'] ] = $row;
- }
- }
- }
-
- /* Alright. We're in. Read the XML file */
- require_once( IPS_KERNEL_PATH . 'classXML.php' );
- $xml = new classXML( IPS_DOC_CHAR_SET );
-
- /* Grab wrapper file */
- $xml->load( $path . '/hooks.xml' );
-
- foreach( $xml->fetchElements('hook') as $data )
- {
- $xmlData[] = $xml->fetchElementsFromRecord( $data );
- }
-
- /* Examine XML */
- if ( is_array( $xmlData ) AND count( $xmlData ) )
- {
- foreach( $xmlData as $x )
- {
- if ( file_exists( $path . '/hooks/' . $x['file'] ) )
- {
- $xml->load( $path . '/hooks/' . $x['file'] );
-
- foreach( $xml->fetchElements('config') as $data )
- {
- $config = $xml->fetchElementsFromRecord( $data );
- }
-
- if ( ! isset( $hooks[ $config['hook_key'] ] ) )
- {
- /* Add it */
- $msgs['inserted']++;
- $this->installHook( file_get_contents( $path . '/hooks/' . $x['file'] ), FALSE, FALSE, $x['enabled'] );
- }
- else
- {
- $this->installHook( file_get_contents( $path . '/hooks/' . $x['file'] ), FALSE, FALSE, $x['enabled'] );
- $msgs['updated']++;
- }
- }
- }
- }
- }
-
- return $msgs;
- }
-
- /**
- * Public install hook so we can use it in the installer and elsewhere
- *
- * @access public
- * @param string XML data
- * @param boolean Add message to output->global_message
- * @param boolean Allow skins to recache
- * @param int Install enabled
- * @return void
- */
- public function installHook( $content, $addMessage=FALSE, $allowSkinRecache=TRUE, $enabled=1 )
- {
- //-----------------------------------------
- // Hooks directory writable?
- //-----------------------------------------
-
- if( !is_writable( IPS_HOOKS_PATH ) )
- {
- if( !$addMessage )
- {
- return false;
- }
-
- $this->registry->output->showError( $this->lang->words['h_dir_notwritable'], 111159 );
- }
-
- //-----------------------------------------
- // Got our hooks?
- //-----------------------------------------
-
- if( !is_array($this->hooks) OR !count($this->hooks) )
- {
- $this->DB->build( array( 'select' => '*', 'from' => 'core_hooks' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $this->hooks[ $r['hook_key'] ] = $r;
- }
- }
-
- //-----------------------------------------
- // Get xml mah-do-dah
- //-----------------------------------------
-
- require_once( IPS_KERNEL_PATH . 'classXML.php' );
- $xml = new classXML( IPS_DOC_CHAR_SET );
-
- //-----------------------------------------
- // Unpack the datafile
- //-----------------------------------------
-
- $xml->loadXML( $content );
-
- foreach( $xml->fetchElements('config') as $data )
- {
- $config = $xml->fetchElementsFromRecord( $data );
-
- if( !count($config) )
- {
- $this->registry->output->showError( $this->lang->words['h_xmlwrong'], 1111 );
- }
- }
-
- //-----------------------------------------
- // Temp
- //-----------------------------------------
-
- $tempExtraData = unserialize( $config['hook_extra_data'] );
-
- //-----------------------------------------
- // Set config
- //-----------------------------------------
-
- $config = array(
- 'hook_name' => $config['hook_name'],
- 'hook_desc' => $config['hook_desc'],
- 'hook_author' => $config['hook_author'],
- 'hook_email' => $config['hook_email'],
- 'hook_website' => $config['hook_website'],
- 'hook_update_check' => $config['hook_update_check'],
- 'hook_requirements' => $config['hook_requirements'],
- 'hook_version_human' => $config['hook_version_human'],
- 'hook_version_long' => $config['hook_version_long'],
- 'hook_key' => $config['hook_key'],
- 'hook_enabled' => $enabled,
- 'hook_updated' => time(),
- );
-
- $extra_data = array();
-
- //-----------------------------------------
- // Set files
- //-----------------------------------------
-
- $files = array();
-
- foreach( $xml->fetchElements('hookfiles') as $node )
- {
- foreach( $xml->fetchElements('file', $node) as $_file )
- {
- $file = $xml->fetchElementsFromRecord( $_file );
-
- if( $file['hook_type'] )
- {
- $files[] = array(
- 'hook_file_real' => $file['hook_file_real'],
- 'hook_type' => $file['hook_type'],
- 'hook_classname' => $file['hook_classname'],
- 'hook_data' => $file['hook_data'],
- 'hooks_source' => $file['hooks_source'],
- );
- }
- }
- }
-
- //-----------------------------------------
- // Set the custom script
- //-----------------------------------------
-
- $custom = array();
-
- foreach( $xml->fetchElements('hookextras_custom') as $node )
- {
- foreach( $xml->fetchElements('file', $node) as $_file )
- {
- $file = $xml->fetchElementsFromRecord( $_file );
-
- if( count($file) )
- {
- $custom = array(
- 'filename' => $file['filename'],
- 'source' => $file['source'],
- );
- }
- }
- }
-
- //-----------------------------------------
- // Set the settings
- //-----------------------------------------
-
- $settings = array();
- $settingGroups = array();
-
- foreach( $xml->fetchElements('hookextras_settings') as $node )
- {
- foreach( $xml->fetchElements('setting', $node) as $_setting )
- {
- $setting = $xml->fetchElementsFromRecord( $_setting );
-
- if( $setting['conf_is_title'] == 1)
- {
- $settingGroups[] = array(
- 'conf_title_title' => $setting['conf_title_title'],
- 'conf_title_desc' => $setting['conf_title_desc'],
- 'conf_title_noshow' => $setting['conf_title_noshow'],
- 'conf_title_keyword' => $setting['conf_title_keyword'],
- 'conf_title_app' => $setting['conf_title_app'],
- 'conf_title_tab' => $setting['conf_title_tab'],
- );
- }
- else
- {
- $settings[] = array(
- 'conf_title' => $setting['conf_title'],
- 'conf_description' => $setting['conf_description'],
- 'conf_group' => $setting['conf_group'],
- 'conf_type' => $setting['conf_type'],
- 'conf_key' => $setting['conf_key'],
- 'conf_default' => $setting['conf_default'],
- 'conf_extra' => $setting['conf_extra'],
- 'conf_evalphp' => $setting['conf_evalphp'],
- 'conf_protected' => $setting['conf_protected'],
- 'conf_position' => $setting['conf_position'],
- 'conf_start_group' => $setting['conf_start_group'],
- 'conf_end_group' => $setting['conf_end_group'],
- 'conf_add_cache' => $setting['conf_add_cache'],
- 'conf_title_keyword' => $setting['conf_title_keyword'],
- );
- }
- }
- }
-
- //-----------------------------------------
- // Set the lang bits
- //-----------------------------------------
-
- $language = array();
-
- foreach( $xml->fetchElements('hookextras_language') as $node )
- {
- foreach( $xml->fetchElements('language', $node) as $_langbit )
- {
- $langbit = $xml->fetchElementsFromRecord( $_langbit );
-
- $language[] = array(
- 'word_app' => $langbit['word_app'],
- 'word_pack' => $langbit['word_pack'],
- 'word_key' => $langbit['word_key'],
- 'word_default' => $langbit['word_default'],
- 'word_custom' => $langbit['word_custom'],
- 'word_js' => $langbit['word_js'],
- );
- }
- }
-
- //-----------------------------------------
- // Set the modules
- //-----------------------------------------
-
- $modules = array();
-
- foreach( $xml->fetchElements('hookextras_modules') as $node )
- {
- foreach( $xml->fetchElements('module', $node) as $_module )
- {
- $module = $xml->fetchElementsFromRecord( $_module );
- $modules[] = array(
- 'sys_module_title' => $module['sys_module_title'],
- 'sys_module_application' => $module['sys_module_application'],
- 'sys_module_key' => $module['sys_module_key'],
- 'sys_module_description' => $module['sys_module_description'],
- 'sys_module_version' => $module['sys_module_version'],
- 'sys_module_parent' => $module['sys_module_parent'],
- 'sys_module_protected' => $module['sys_module_protected'],
- 'sys_module_visible' => $module['sys_module_visible'],
- 'sys_module_tables' => $module['sys_module_tables'],
- 'sys_module_hooks' => $module['sys_module_hooks'],
- 'sys_module_position' => $module['sys_module_position'],
- 'sys_module_admin' => $module['sys_module_admin'],
- );
- }
- }
-
- //-----------------------------------------
- // Set the help files
- //-----------------------------------------
-
- $help = array();
-
- foreach( $xml->fetchElements('hookextras_help') as $node )
- {
- foreach( $xml->fetchElements('help', $node) as $_helpfile )
- {
- $helpfile = $xml->fetchElementsFromRecord( $_helpfile );
- $help[] = array(
- 'title' => $helpfile['title'],
- 'text' => $helpfile['text'],
- 'description' => $helpfile['description'],
- 'position' => $helpfile['position'],
- );
- }
- }
-
- //-----------------------------------------
- // Set the templates
- //-----------------------------------------
-
- $templates = array();
-
- foreach( $xml->fetchElements('hookextras_templates') as $node )
- {
- $templateSetIds = $this->registry->output->buildRemapData( true );
-
- foreach( $xml->fetchElements('templates', $node) as $_template )
- {
- $template = $xml->fetchElementsFromRecord( $_template );
-
- /* Figure out the set id for this template */
- $_template_set_id = array_search( $template['template_set_type'], $templateSetIds['templates'] );
- $_template_set_id = $_template_set_id ? $_template_set_id : $template['template_set_id'];
-
- $templates[] = array(
- 'template_set_id' => $_template_set_id,
- 'template_group' => $template['template_group'],
- 'template_content' => $template['template_content'],
- 'template_name' => $template['template_name'],
- 'template_data' => $template['template_data'],
- 'template_updated' => $template['template_updated'],
- 'template_removable' => $template['template_removable'],
- 'template_added_to' => $template['template_added_to'],
- 'template_user_added' => 1,
- 'template_user_edited' => 0,
- );
- }
- }
-
- //-----------------------------------------
- // Set the tasks
- //-----------------------------------------
-
- $tasks = array();
-
- foreach( $xml->fetchElements('hookextras_tasks') as $node )
- {
- foreach( $xml->fetchElements('tasks', $node) as $_task )
- {
- $task = $xml->fetchElementsFromRecord( $_task );
- $tasks[] = array(
- 'task_title' => $task['task_title'],
- 'task_file' => $task['task_file'],
- 'task_week_day' => $task['task_week_day'],
- 'task_month_day' => $task['task_month_day'],
- 'task_hour' => $task['task_hour'],
- 'task_minute' => $task['task_minute'],
- 'task_cronkey' => $task['task_cronkey'],
- 'task_log' => $task['task_log'],
- 'task_description' => $task['task_description'],
- 'task_enabled' => $task['task_enabled'],
- 'task_key' => $task['task_key'],
- 'task_safemode' => $task['task_safemode'],
- 'task_locked' => $task['task_locked'],
- 'task_application' => $task['task_application'],
- );
- }
- }
-
- //-----------------------------------------
- // Set the database changes
- //-----------------------------------------
-
- $database = array(
- 'create' => array(),
- 'alter' => array(),
- 'update' => array(),
- 'insert' => array(),
- );
-
- foreach( $xml->fetchElements('hookextras_database_create') as $node )
- {
- foreach( $xml->fetchElements('create', $node) as $_table )
- {
- $table = $xml->fetchElementsFromRecord( $_table );
- $database['create'][] = array(
- 'name' => $table['name'],
- 'fields' => $table['fields'],
- 'tabletype' => $table['tabletype'],
- );
- }
- }
-
- foreach( $xml->fetchElements('hookextras_database_alter') as $node )
- {
- foreach( $xml->fetchElements('alter', $node) as $_table )
- {
- $table = $xml->fetchElementsFromRecord( $_table );
- $database['alter'][] = array(
- 'altertype' => $table['altertype'],
- 'table' => $table['table'],
- 'field' => $table['field'],
- 'newfield' => $table['newfield'],
- 'fieldtype' => $table['fieldtype'],
- 'default' => $table['default'],
- );
- }
- }
-
- foreach( $xml->fetchElements('hookextras_database_update') as $node )
- {
- foreach( $xml->fetchElements('update', $node) as $_table )
- {
- $table = $xml->fetchElementsFromRecord( $_table );
- $database['update'][] = array(
- 'table' => $table['table'],
- 'field' => $table['field'],
- 'newvalue' => $table['newvalue'],
- 'oldvalue' => $table['oldvalue'],
- 'where' => $table['where'],
- );
- }
- }
-
- foreach( $xml->fetchElements('hookextras_database_insert') as $node )
- {
- foreach( $xml->fetchElements('insert', $node) as $_table )
- {
- $table = $xml->fetchElementsFromRecord( $_table );
- $database['insert'][] = array(
- 'table' => $table['table'],
- 'updates' => $table['updates'],
- 'fordelete' => $table['fordelete'],
- );
- }
- }
-
- //-----------------------------------------
- // Set some vars for display tallies
- //-----------------------------------------
-
- $filesInserted = 0;
- $settingGroupsInserted = 0;
- $settingsInserted = 0;
- $settingsUpdated = 0;
- $languageInserted = 0;
- $languageUpdated = 0;
- $modulesInserted = 0;
- $modulesUpdated = 0;
- $helpInserted = 0;
- $helpUpdated = 0;
- $templatesInserted = 0;
- $templatesUpdated = 0;
- $templateHooks = 0;
- $tasksInserted = 0;
- $tasksUpdated = 0;
- $createQueries = 0;
- $alterQueries = 0;
- $updateQueries = 0;
- $insertQueries = 0;
-
- //-----------------------------------------
- // Need to recache skins?
- //-----------------------------------------
-
- foreach( $files as $_f )
- {
- if ( $_f['hook_type'] AND $_f['hook_type'] == 'templateHooks' )
- {
- $templateHooks++;
- }
- }
-
- //-----------------------------------------
- // Insert/update DB records
- //-----------------------------------------
-
- if( $this->hooks[ $config['hook_key'] ]['hook_id'] )
- {
- //-----------------------------------------
- // Don't change enabled/disabled status
- //-----------------------------------------
-
- unset( $config['hook_enabled'] );
-
- $this->DB->update( 'core_hooks', $config, 'hook_id=' . $this->hooks[ $config['hook_key'] ]['hook_id'] );
-
- $hook_id = $this->hooks[ $config['hook_key'] ]['hook_id'];
-
- $extra_data = unserialize( $this->hooks[ $config['hook_key'] ]['hook_extra_data'] );
-
- /* Reset DB */
- $extra_data['database'] = array();
- }
- else
- {
- $config['hook_installed'] = time();
- $this->hook[ $config['hook_key'] ] = $config;
-
- $this->DB->insert( 'core_hooks', $config );
-
- $hook_id = $this->DB->getInsertId();
-
- $this->hook[ $config['hook_key'] ]['hook_id'] = $hook_id;
-
- $extra_data['display'] = $tempExtraData['display'];
- }
-
- if( count($files) )
- {
- //-----------------------------------------
- // If we are updating, remove old files
- //-----------------------------------------
-
- if( $this->hooks[ $config['hook_key'] ]['hook_id'] )
- {
- $this->DB->build( array( 'select' => 'hook_file_id, hook_file_stored', 'from' => 'core_hooks_files', 'where' => 'hook_hook_id=' . $this->hooks[ $config['hook_key'] ]['hook_id'] ) );
- $outer = $this->DB->execute();
-
- while( $r = $this->DB->fetch($outer) )
- {
- @unlink( IPS_HOOKS_PATH . $r['hook_file_stored'] );
- $this->DB->delete( 'core_hooks_files', 'hook_file_id=' . $r['hook_file_id'] );
- }
- }
-
- foreach( $files as $file )
- {
- //-----------------------------------------
- // Store new files
- //-----------------------------------------
-
- $filename = $file['hook_classname'] . '_' . md5( uniqid( microtime(), true ) ) . '.php';
-
- file_put_contents( IPS_HOOKS_PATH . $filename, $file['hooks_source'] );
- chmod( IPS_HOOKS_PATH . $filename, 0777 );
-
- $file['hook_file_stored'] = $filename;
- $file['hook_hook_id'] = $hook_id;
-
- $this->DB->insert( 'core_hooks_files', $file );
- $filesInserted++;
- }
- }
-
- //-----------------------------------------
- // Put custom install/uninstall file
- //-----------------------------------------
-
- if( $custom['source'] AND $custom['filename'] )
- {
- file_put_contents( IPS_HOOKS_PATH . "install_" . $custom['filename'], $custom['source'] );
- }
-
- //-----------------------------------------
- // (1) Settings
- //-----------------------------------------
-
- if( count($settingGroups) OR count($settings) )
- {
- $setting_groups = array();
-
- $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_settings_titles', 'order' => 'conf_title_title' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $setting_groups[ $r['conf_title_id'] ] = $r;
- $setting_groups_by_key[ $r['conf_title_keyword'] ] = $r;
- }
-
- //-----------------------------------------
- // Get current settings.
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => 'conf_id, conf_key',
- 'from' => 'core_sys_conf_settings',
- 'order' => 'conf_id' ) );
-
- $this->DB->execute();
-
- while ( $r = $this->DB->fetch() )
- {
- $cur_settings[ $r['conf_key'] ] = $r['conf_id'];
- }
- }
-
- if( count($settingGroups) )
- {
- $need_to_update = array();
-
- foreach( $settingGroups as $data )
- {
- if ( $data['conf_title_title'] AND $data['conf_title_keyword'] )
- {
- //-----------------------------------------
- // Get ID based on key
- //-----------------------------------------
-
- $conf_id = $setting_groups_by_key[ $data['conf_title_keyword'] ]['conf_title_id'];
-
- $save = array( 'conf_title_title' => $data['conf_title_title'],
- 'conf_title_desc' => $data['conf_title_desc'],
- 'conf_title_keyword' => $data['conf_title_keyword'],
- 'conf_title_app' => $data['conf_title_app'],
- 'conf_title_tab' => $data['conf_title_tab'],
- 'conf_title_noshow' => $data['conf_title_noshow'] );
-
- //-----------------------------------------
- // Not got a row, insert first!
- //-----------------------------------------
-
- if ( ! $conf_id )
- {
- $this->DB->insert( 'core_sys_settings_titles', $save );
- $conf_id = $this->DB->getInsertId();
- $settingGroupsInserted++;
- $extra_data['settingGroups'][] = $conf_id;
- }
- else
- {
- //-----------------------------------------
- // Update...
- //-----------------------------------------
-
- $this->DB->update( 'core_sys_settings_titles', $save, 'conf_title_id='.$conf_id );
- }
-
- //-----------------------------------------
- // Update settings cache
- //-----------------------------------------
-
- $save['conf_title_id'] = $conf_id;
- $setting_groups_by_key[ $save['conf_title_keyword'] ] = $save;
- $setting_groups[ $save['conf_title_id'] ] = $save;
-
- //-----------------------------------------
- // Set need update...
- //-----------------------------------------
-
- $need_update[] = $conf_id;
- }
- }
- }
-
- if( count($settings) )
- {
- foreach( $settings as $idx => $data )
- {
- $data['conf_group'] = $setting_groups_by_key[ $data['conf_title_keyword'] ]['conf_title_id'];
-
- //-----------------------------------------
- // Remove from array
- //-----------------------------------------
-
- unset( $data['conf_title_keyword'] );
-
- if ( $cur_settings[ $data['conf_key'] ] )
- {
- $this->DB->update( 'core_sys_conf_settings', $data, 'conf_id='.$cur_settings[ $data['conf_key'] ] );
- $settingsUpdated++;
- }
- else
- {
- $this->DB->insert( 'core_sys_conf_settings', $data );
- $settingsInserted++;
- $conf_id = $this->DB->getInsertId();
- $extra_data['settings'][] = $conf_id;
- }
- }
- }
-
- //-----------------------------------------
- // Update group counts...
- //-----------------------------------------
-
- if ( count( $need_update ) )
- {
- foreach( $need_update as $i => $idx )
- {
- $conf = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count', 'from' => 'core_sys_conf_settings', 'where' => 'conf_group='.$idx ) );
-
- $count = intval($conf['count']);
-
- $this->DB->update( 'core_sys_settings_titles', array( 'conf_title_count' => $count ), 'conf_title_id='.$idx );
- }
- }
-
- if( count($settingGroups) OR count($settings) )
- {
- $this->cache->rebuildCache( 'settings', 'global' );
- }
-
- //-----------------------------------------
- // (2) Languages
- //-----------------------------------------
-
- if( count($language) )
- {
- $langPacks = array();
-
- $this->DB->build( array( 'select' => 'lang_id', 'from' => 'core_sys_lang' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $langPacks[] = $r['lang_id'];
- }
-
- foreach( $language as $langbit )
- {
- foreach( $langPacks as $lang_id )
- {
- $langbit['lang_id'] = $lang_id;
-
- // See if it exists
- $cnt = $this->DB->buildAndFetch( array( 'select' => 'word_id', 'from' => 'core_sys_lang_words', 'where' => "lang_id={$lang_id} AND word_app='{$langbit['word_app']}' AND word_key='{$langbit['word_key']}' AND word_pack='{$langbit['word_pack']}'" ) );
-
- if( $cnt['word_id'] )
- {
- $this->DB->update( 'core_sys_lang_words', $langbit, 'word_id=' . $cnt['word_id'] );
- $languageUpdated++;
- }
- else
- {
- $this->DB->insert( 'core_sys_lang_words', $langbit );
- $languageInserted++;
- $word_id = $this->DB->getInsertId();
- $extra_data['language'][ $langbit['word_pack'] ][] = $langbit['word_key'];
- }
- }
- }
-
- require_once( IPSLib::getAppDir('core') . '/modules_admin/languages/manage_languages.php' );
- $langLib = new admin_core_languages_manage_languages( $this->registry );
- $langLib->makeRegistryShortcuts( $this->registry );
-
- foreach( $langPacks as $langId )
- {
- $langLib->cacheToDisk( $langId );
- }
- }
-
- //-----------------------------------------
- // (3) Modules
- //-----------------------------------------
-
- if( count($modules) )
- {
- //-----------------------------------------
- // Get current modules
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*',
- 'from' => 'core_sys_module',
- 'order' => 'sys_module_id' ) );
-
- $this->DB->execute();
-
- while ( $r = $this->DB->fetch() )
- {
- $cur_modules[ $r['sys_module_application'] ][ $r['sys_module_key'] ] = $r['sys_module_id'];
- }
-
- foreach( $modules as $module )
- {
- //-----------------------------------------
- // Insert or update?
- //-----------------------------------------
-
- if ( $cur_modules[ $module['sys_module_application'] ][ $module['sys_module_key'] ] )
- {
- $this->DB->update( 'core_sys_module', $module, "sys_module_id=" . $cur_modules[ $module['sys_module_application'] ][ $module['sys_module_key'] ] );
- $modulesUpdated++;
- }
- else
- {
- $this->DB->insert( 'core_sys_module', $module );
- $modulesInserted++;
- $module_id = $this->DB->getInsertId();
- $extra_data['modules'][] = $module_id;
- }
- }
-
- require_once( IPSLib::getAppDir('core') . '/modules_admin/applications/applications.php' );
- $moduleLib = new admin_core_applications_applications( $this->registry );
- $moduleLib->makeRegistryShortcuts( $this->registry );
- $moduleLib->moduleRecache();
- $moduleLib->applicationsMenuDataRecache();
- }
-
- //-----------------------------------------
- // (4) Help Files
- //-----------------------------------------
-
- if( count($help) )
- {
- $keys = array();
-
- $this->DB->build( array( 'select' => 'title', 'from' => 'faq' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $keys[] = $r['title'];
- }
-
- foreach( $help as $entry )
- {
- if( in_array( $entry['title'], $keys ) )
- {
- $this->DB->update( 'faq', $entry, "title='{$entry['title']}'" );
- $helpUpdated++;
- }
- else
- {
- $this->DB->insert( 'faq', $entry );
- $helpInserted++;
- $help_id = $this->DB->getInsertId();
- $extra_data['help'][] = $help_id;
- }
- }
- }
-
- //-----------------------------------------
- // (6) Templates
- //-----------------------------------------
-
- if( count($templates) )
- {
- $bits = array();
-
- $this->DB->build( array( 'select' => 'template_name,template_group', 'from' => 'skin_templates', 'where' => 'template_set_id=0' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $bits[ $r['template_group'] ][] = $r['template_name'];
- }
-
- foreach( $templates as $template )
- {
- if( is_array($bits[ $template['template_group'] ]) AND in_array( $template['template_name'], $bits[ $template['template_group'] ] ) )
- {
- $this->DB->update( 'skin_templates', $template, "template_group='{$template['template_group']}' AND template_name='{$template['template_name']}'" );
- $templatesUpdated++;
- }
- else
- {
- $this->DB->insert( 'skin_templates', $template );
- $templatesInserted++;
- $template_id = $this->DB->getInsertId();
- $extra_data['templates'][ $template['template_group'] ][] = $template['template_name'];
- }
- }
- }
-
- //-----------------------------------------
- // (7) Tasks
- //-----------------------------------------
-
- if( count($tasks) )
- {
- $keys = array();
-
- $this->DB->build( array( 'select' => 'task_key', 'from' => 'task_manager' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $keys[] = $r['task_key'];
- }
-
- foreach( $tasks as $entry )
- {
- if( in_array( $entry['task_key'], $keys ) )
- {
- $this->DB->update( 'task_manager', $entry, "task_key='{$entry['task_key']}'" );
- $tasksUpdated++;
- }
- else
- {
- $this->DB->insert( 'task_manager', $entry );
- $tasksInserted++;
- $task_id = $this->DB->getInsertId();
- $extra_data['tasks'][] = $task_id;
- }
- }
- }
-
- //-----------------------------------------
- // (8) Create new tables
- //-----------------------------------------
-
- if( count($database['create']) )
- {
- foreach($database['create'] as $create )
- {
- $query = "CREATE TABLE {$create['name']} (
- {$create['fields']}
- )";
-
- if( $tabletype )
- {
- $query .= " TYPE=" . $create['tabletype'];
- }
-
- //-----------------------------------------
- // Fix prefix
- //-----------------------------------------
-
- $query = preg_replace( "#^CREATE TABLE(?:\s+?)?(\S+?)#s", "CREATE TABLE " . $this->settings['sql_tbl_prefix']."\\1", $query );
-
- $this->DB->return_die = true;
- $this->DB->query( $query );
- $this->DB->return_die = false;
- $createQueries++;
-
- $extra_data['database']['create'][] = $create;
- }
- }
-
- //-----------------------------------------
- // (9) Alter tables
- //-----------------------------------------
-
- if( count($database['alter']) )
- {
- foreach( $database['alter'] as $alter )
- {
- $this->DB->return_die = true;
-
- switch( $alter['altertype'] )
- {
- case 'remove':
- $this->DB->dropField( $alter['table'], $alter['field'] );
- break;
-
- case 'add':
- $this->DB->addField( $alter['table'], $alter['field'], $alter['fieldtype'], $alter['default'] );
- break;
-
- case 'change':
- $this->DB->changeField( $alter['table'], $alter['field'], $alter['newfield'], $alter['fieldtype'], $alter['default'] );
- break;
- }
-
- $this->DB->return_die = false;
- $alterQueries++;
- $extra_data['database']['alter'][] = $alter;
- }
- }
-
- //-----------------------------------------
- // (10) Run update queries
- //-----------------------------------------
-
- if( count($database['update']) )
- {
- foreach( $database['update'] as $update )
- {
- $this->DB->return_die = true;
- $this->DB->update( $update['table'], array( $update['field'] => $update['newvalue'] ), html_entity_decode( $update['where'], ENT_QUOTES ) );
- $this->DB->return_die = false;
- $updateQueries++;
- $extra_data['database']['update'][] = $update;
- }
- }
-
- //-----------------------------------------
- // (11) Run insert queries
- //-----------------------------------------
-
- // if( !$this->hooks[ $config['hook_key'] ]['hook_id'] )
- // {
- if( count($database['insert']) )
- {
- foreach( $database['insert'] as $insert )
- {
- $fields = array();
- $content = explode( ',', $insert['updates'] );
-
- foreach( $content as $value )
- {
- list( $field, $toInsert ) = explode( '=', $value );
-
- $fields[ $field ] = $toInsert;
- }
-
- $this->DB->return_die = true;
- $this->DB->insert( $insert['table'], $fields );
- $this->DB->return_die = false;
- $insertQueries++;
- $extra_data['database']['insert'][] = $insert;
- }
- }
- // }
-
- if( $custom['filename'] AND file_exists( IPS_HOOKS_PATH . 'install_' . $custom['filename'] ) )
- {
- require_once( IPS_HOOKS_PATH . 'install_' . $custom['filename'] );
-
- $classname = str_replace( '.php', '', $custom['filename'] );
-
- if( class_exists( $classname ) )
- {
- $install = new $classname( $this->registry );
-
- if( method_exists( $install, 'install' ) )
- {
- $install->install();
- }
- }
- }
-
- if( count($extra_data) )
- {
- $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize( $extra_data ) ), 'hook_id=' . $hook_id );
- }
-
- //print_r($config);
- //print_r($files);
- //print_r($custom);
- //print_r($settingGroups);
- //print_r($settings);
- //print_r($language);
- //print_r($modules);
- //print_r($templates);
- //print_r($tasks);
- //print_r($help);
- //print_r($database);
-
- if ( $addMessage )
- {
- $this->registry->output->global_message = <<lang->words['h_followacts']}
-
- {$this->lang->words['h_newhookin']}
- {$filesInserted} {$this->lang->words['h_filesin']}
- {$settingGroupsInserted} {$this->lang->words['h_settinggin']}
- {$settingsInserted} {$this->lang->words['h_settingin']}
- {$settingsUpdated} {$this->lang->words['h_settingup']}
- {$languageInserted} {$this->lang->words['h_langbitin']}
- {$languageUpdated} {$this->lang->words['h_langbitup']}
- {$modulesInserted} {$this->lang->words['h_modin']}
- {$modulesUpdated} {$this->lang->words['h_modup']}
- {$helpInserted} {$this->lang->words['h_helpin']}
- {$helpUpdated} {$this->lang->words['h_helpup']}
- {$templatesInserted} {$this->lang->words['h_tempin']}
- {$templatesUpdated} {$this->lang->words['h_tempup']}
- {$tasksInserted} {$this->lang->words['h_taskin']}
- {$tasksUpdated} {$this->lang->words['h_taskup']}
- {$createQueries} {$this->lang->words['h_dbcreated']}
- {$alterQueries} {$this->lang->words['h_dbaltered']}
- {$updateQueries} {$this->lang->words['h_updateran']}
- {$insertQueries} {$this->lang->words['h_insertran']}
-
-EOF;
-
- //-----------------------------------------
- // Got some skin recaching to do...
- //-----------------------------------------
-
- if( $allowSkinRecache === TRUE AND ( $templatesInserted OR $templatesUpdated OR $templateHooks ) )
- {
- //-----------------------------------------
- // Recache hooks so templates know that there
- // are comments to preserve
- //-----------------------------------------
-
- $this->rebuildHooksCache();
-
- //-----------------------------------------
- // Get the libs
- //-----------------------------------------
-
- require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
- require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
- $skinCaching = new skinCaching( $this->registry );
-
- //-----------------------------------------
- // Find first skin id
- //-----------------------------------------
-
- ksort( $this->registry->output->allSkins );
- $_skins = $this->registry->output->allSkins;
- $_set = array_shift( $_skins );
- $setID = $_set['set_id'];
-
- $skinCaching->rebuildPHPTemplates( $setID );
-
- /* Fetch next id */
- $nextID = $setID;
-
- ksort( $this->registry->output->allSkins );
-
- foreach( $this->registry->output->allSkins as $id => $data )
- {
- if ( $id > $nextID )
- {
- $nextID = $id;
- break;
- }
- }
-
- //-----------------------------------------
- // Have more than one skin
- //-----------------------------------------
-
- if ( $nextID != $setID )
- {
- //-----------------------------------------
- // Save hook import messages
- //-----------------------------------------
-
- ipsRegistry::getClass('adminFunctions')->staffSaveCookie( 'hookResult', $this->registry->output->global_message );
-
- //-----------------------------------------
- // Wipe out the messages
- //-----------------------------------------
-
- $this->registry->output->global_message = '';
-
- //-----------------------------------------
- // Redirect to rebuild skins
- //-----------------------------------------
-
- $this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_templates' ) );
-
- $this->registry->output->redirect( $this->settings['base_url'] . 'app=core&module=applications§ion=hooks&do=skinsRebuild&setID=' . $nextID, $this->lang->words['to_recachedset'] . $this->registry->output->allSkins[ $setID ]['set_name'] );
- }
- }
- }
- }
-
- /**
- * Show the form to export a hook
- *
- * @access private
- * @return void
- */
- private function _exportHook()
- {
- /* Get the hook */
- $id = intval($this->request['id']);
-
- if( !$id )
- {
- $this->registry->output->showError( $this->lang->words['h_noexport'], 1112 );
- }
-
- $hookData = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $id ) );
-
- if( !$hookData['hook_id'] )
- {
- $this->registry->output->showError( $this->lang->words['h_noexport'], 1113 );
- }
-
- /* Set defaults */
- $hookData['hook_extra_data'] = unserialize( $hookData['hook_extra_data'] );
-
- /* Output */
- $this->registry->output->html .= $this->html->hooksExport( $hookData );
- }
-
- /**
- * Actually export the damn hook already
- * Sorry, it has been a long day...
- *
- * @access private
- * @return void
- */
- private function _doExportHook()
- {
- //-----------------------------------------
- // Get hook
- //-----------------------------------------
-
- $id = intval($this->request['id']);
-
- if( !$id )
- {
- $this->registry->output->showError( $this->lang->words['h_noexport'], 1114 );
- }
-
- $hookData = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $id ) );
-
- if( !$hookData['hook_id'] )
- {
- $this->registry->output->showError( $this->lang->words['h_noexport'], 1115 );
- }
-
- $extra_data = unserialize( $hookData['hook_extra_data'] );
-
- //-----------------------------------------
- // Get hook files
- //-----------------------------------------
-
- $files = array();
- $index = 1;
-
- $this->DB->build( array( 'select' => '*', 'from' => 'core_hooks_files', 'where' => 'hook_hook_id=' . $id ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $files[ $index ] = $r;
- $index++;
- }
-
- //-----------------------------------------
- // Get XML class
- //-----------------------------------------
-
- require_once( IPS_KERNEL_PATH.'classXML.php' );
-
- $xml = new classXML( IPS_DOC_CHAR_SET );
-
- $xml->newXMLDocument();
- $xml->addElement( 'hookexport' );
-
- //-----------------------------------------
- // Put hook data in export
- //-----------------------------------------
-
- $xml->addElement( 'hookdata', 'hookexport' );
- $content = array();
-
- foreach( $hookData as $k => $v )
- {
- if( in_array( $k, array( 'hook_id', 'hook_enabled', 'hook_installed', 'hook_updated', 'hook_position' ) ) )
- {
- continue;
- }
-
- $content[ $k ] = $v;
- }
-
- $xml->addElementAsRecord( 'hookdata', 'config', $content );
-
- //-----------------------------------------
- // Put hook files in export
- //-----------------------------------------
-
- $xml->addElement( 'hookfiles', 'hookexport' );
-
- foreach( $files as $index => $r )
- {
- $content = array();
-
- foreach( $r as $k => $v )
- {
- if( in_array( $k, array( 'hook_file_id', 'hook_hook_id', 'hook_file_stored', 'hooks_source' ) ) )
- {
- continue;
- }
-
- $content[ $k ] = $v;
- }
-
- $source = file_exists( IPS_HOOKS_PATH . $r['hook_file_stored'] ) ? file_get_contents( IPS_HOOKS_PATH . $r['hook_file_stored'] ) : '';
-
- if( $r['hook_type'] == 'commandHooks' )
- {
- $source = $this->_cleanSource( $source );
- }
-
- $content['hooks_source'] = $source;
-
- $xml->addElementAsRecord( 'hookfiles', 'file', $content );
- }
-
- //-----------------------------------------
- // Custom install/uninstall script?
- //-----------------------------------------
-
- if( $extra_data['custom'] )
- {
- $content = array();
- $xml->addElement( 'hookextras_custom', 'hookexport' );
-
- $content['filename'] = $extra_data['custom'];
- $content['source'] = file_exists( IPS_HOOKS_PATH . 'install_' . $extra_data['custom'] ) ? file_get_contents( IPS_HOOKS_PATH . 'install_' . $extra_data['custom'] ) : '';
-
- $xml->addElementAsRecord( 'hookextras_custom', 'file', $content );
- }
-
- //-----------------------------------------
- // Settings or setting groups?
- //-----------------------------------------
-
- $entry = array();
- $_groups = array();
- $_settings = array();
- $titles = array();
- $content = array();
-
- $xml->addElement( 'hookextras_settings', 'hookexport' );
-
- # Store group ids and setting ids for entire setting groups
- if( is_array($extra_data['settingGroups']) AND count($extra_data['settingGroups']) )
- {
- $_groups = $extra_data['settingGroups'];
-
- $this->DB->build( array( 'select' => 'conf_id', 'from' => 'core_sys_conf_settings', 'where' => 'conf_group IN(' . implode( ',', $_groups ) . ')' ) );
- $this->DB->execute();
-
- while( $setting = $this->DB->fetch() )
- {
- $_settings[] = $setting['conf_id'];
- }
- }
-
- # Store group ids and setting ids for indvidual settings
- if( is_array($extra_data['settings']) AND count($extra_data['settings']) )
- {
- foreach( $extra_data['settings'] as $settingId )
- {
- $_settings[] = $settingId;
- }
-
- $this->DB->build( array( 'select' => 'conf_group', 'from' => 'core_sys_conf_settings', 'where' => 'conf_id IN(' . implode( ',', $extra_data['settings'] ) . ')' ) );
- $this->DB->execute();
-
- while( $group = $this->DB->fetch() )
- {
- $_groups[] = $group['conf_group'];
- }
- }
-
- if( count($_groups) )
- {
- # Now get the group data for the XML file
- $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_settings_titles', 'where' => 'conf_title_id IN(' . implode( ',', $_groups ) . ')' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $content = array();
-
- $titles[ $r['conf_title_id'] ] = $r['conf_title_keyword'];
-
- $content['conf_is_title'] = 1;
-
- foreach( $r as $k => $v )
- {
- if( in_array( $k, array( 'conf_title_tab', 'conf_title_keyword', 'conf_title_title', 'conf_title_desc', 'conf_title_app', 'conf_title_noshow' ) ) )
- {
- $content[ $k ] = $v;
- }
- }
-
- $xml->addElementAsRecord( 'hookextras_settings', 'setting', $content );
- }
- }
-
- if( count($_settings) )
- {
- # Now get the group data for the XML file
- $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => 'conf_id IN(' . implode( ',', $_settings ) . ')' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $r['conf_value'] = '';
- $r['conf_title_keyword'] = $titles[ $r['conf_group'] ];
- $r['conf_is_title'] = 0;
-
- $xml->addElementAsRecord( 'hookextras_settings', 'setting', $r );
- }
- }
-
- //-----------------------------------------
- // Language strings/files
- //-----------------------------------------
-
- $entry = array();
-
- $xml->addElement( 'hookextras_language', 'hookexport' );
-
- if( is_array($extra_data['language']) AND count($extra_data['language']) )
- {
- foreach( $extra_data['language'] as $file => $strings )
- {
- $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_lang_words', 'where' => "word_pack='{$file}' AND word_key IN('" . implode( "','", $strings ) . "')" ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $content = array();
-
- foreach( $r as $k => $v )
- {
- if( in_array( $k, array( 'word_id', 'lang_id', 'word_default_version', 'word_custom_version' ) ) )
- {
- continue;
- }
-
- $content[ $k ] = $v;
- }
-
- $xml->addElementAsRecord( 'hookextras_language', 'language', $content );
- }
- }
- }
-
- //-----------------------------------------
- // Modules
- //-----------------------------------------
-
- $xml->addElement( 'hookextras_modules', 'hookexport' );
-
- if( is_array($extra_data['modules']) AND count($extra_data['modules']) )
- {
- $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_module', 'where' => "sys_module_key IN('" . implode( "','", $extra_data['modules'] ) . "')" ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- unset($r['sys_module_id']);
-
- $xml->addElementAsRecord( 'hookextras_modules', 'module', $r );
- }
- }
-
- //-----------------------------------------
- // Help files
- //-----------------------------------------
-
- $xml->addElement( 'hookextras_help', 'hookexport' );
-
- if( is_array($extra_data['help']) AND count($extra_data['help']) )
- {
- $this->DB->build( array( 'select' => '*', 'from' => 'faq', 'where' => "id IN(" . implode( ",", $extra_data['help'] ) . ")" ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- unset($r['id']);
-
- $xml->addElementAsRecord( 'hookextras_help', 'help', $r );
- }
- }
-
- //-----------------------------------------
- // Skin templates
- //-----------------------------------------
-
- $xml->addElement( 'hookextras_templates', 'hookexport' );
-
- if( is_array($extra_data['templates']) AND count($extra_data['templates']) )
- {
- $templateSetIds = $this->registry->output->buildRemapData( true );
-
- foreach( $extra_data['templates'] as $file => $templates )
- {
- $this->DB->build( array( 'select' => '*', 'from' => 'skin_templates', 'where' => "template_set_id IN (".implode( ',', $templateSetIds['export']) .") AND template_group='{$file}' AND template_name IN('" . implode( "','", $templates ) . "')" ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- unset($r['template_id']);
- $r['template_set_type'] = $templateSetIds['templates'][$r['template_set_id']];
-
- $xml->addElementAsRecord( 'hookextras_templates', 'templates', $r );
- }
- }
- }
-
- //-----------------------------------------
- // Tasks
- //-----------------------------------------
-
- $xml->addElement( 'hookextras_tasks', 'hookexport' );
-
- if( is_array($extra_data['tasks']) AND count($extra_data['tasks']) )
- {
- $this->DB->build( array( 'select' => '*', 'from' => 'task_manager', 'where' => "task_id IN(" . implode( ",", $extra_data['tasks'] ) . ")" ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- unset($r['task_id']);
- unset($r['task_next_run']);
-
- $xml->addElementAsRecord( 'hookextras_tasks', 'tasks', $r );
- }
- }
-
- //-----------------------------------------
- // Database changes
- //-----------------------------------------
-
- $xml->addElement( 'hookextras_database_create', 'hookexport' );
-
- if( is_array($extra_data['database']['create']) AND count($extra_data['database']['create']) )
- {
- foreach( $extra_data['database']['create'] as $create_query )
- {
- $xml->addElementAsRecord( 'hookextras_database_create', 'create', $create_query );
- }
- }
-
- $xml->addElement( 'hookextras_database_alter', 'hookexport' );
-
- if( is_array($extra_data['database']['alter']) AND count($extra_data['database']['alter']) )
- {
- foreach( $extra_data['database']['alter'] as $alter_query )
- {
- $xml->addElementAsRecord( 'hookextras_database_alter', 'alter', $alter_query );
- }
- }
-
- $xml->addElement( 'hookextras_database_update', 'hookexport' );
-
- if( is_array($extra_data['database']['update']) AND count($extra_data['database']['update']) )
- {
- foreach( $extra_data['database']['update'] as $update_query )
- {
- $xml->addElementAsRecord( 'hookextras_database_update', 'update', $update_query );
- }
- }
-
- $xml->addElement( 'hookextras_database_insert', 'hookexport' );
-
- if( is_array($extra_data['database']['insert']) AND count($extra_data['database']['insert']) )
- {
- foreach( $extra_data['database']['insert'] as $insert_query )
- {
- $xml->addElementAsRecord( 'hookextras_database_insert', 'insert', $insert_query );
- }
- }
-
- //-----------------------------------------
- // Print to browser
- //-----------------------------------------
-
- $this->registry->output->showDownload( $xml->fetchDocument(), 'hook.xml', '', 0 );
- }
-
- /**
- * Clean source code for export..
- *
- * @access private
- * @param string Hook source code
- * @return string "Cleaned" source code
- */
- private function _cleanSource( $source )
- {
- $source = preg_replace( "/class\s+(\S+)\s+extends\s+(\S+)/i", "class \\1 extends (~extends~)", $source );
-
- return $source;
- }
-
- /**
- * Fix hook positions
- *
- * @access private
- * @return void
- */
- private function _fixPositions()
- {
- $new_order = 0;
- $usedActions = array();
-
- $this->DB->build( array( 'select' => 'hook_id, hook_position', 'from' => 'core_hooks', 'where' => 'hook_enabled=1', 'order' => 'hook_position ASC' ) );
- $qid = $this->DB->execute();
-
- while ( $hook = $this->DB->fetch( $qid ) )
- {
- $new_order++;
- $this->DB->update( 'core_hooks', array ( 'hook_position' => $new_order ), "hook_id={$hook['hook_id']}" );
-
- $this->DB->build( array( 'select' => '*', 'from' => 'core_hooks_files', 'where' => "(hook_type='commandHooks' OR hook_type='skinHooks') AND hook_hook_id=" . $hook['hook_id'] ) );
- $this->DB->execute();
-
- while( $file = $this->DB->fetch() )
- {
- if( $file['hooks_source'] )
- {
- $source = $file['hooks_source'];
- }
- else
- {
- $source = file_exists( IPS_HOOKS_PATH . $file['hook_file_stored'] ) ? file_get_contents( IPS_HOOKS_PATH . $file['hook_file_stored'] ) : '';
-
- if( $source )
- {
- $source = $this->_cleanSource( $source );
- }
- }
-
- if( $source )
- {
- $hook_data = unserialize( $file['hook_data'] );
- $overload = $hook_data['classToOverload'];
- $newClass = $overload;
-
- if( isset( $usedActions[ $overload ] ) )
- {
- $newClass = $usedActions[ $overload ];
- }
- else if( $file['hook_type'] == 'skinHooks' )
- {
- $newClass .= "(~id~)";
- }
-
- $source = str_replace( "(~extends~)", $newClass, $source );
-
- file_put_contents( IPS_HOOKS_PATH . $file['hook_file_stored'], $source );
-
- $usedActions[ $hook_data['classToOverload'] ] = $file['hook_classname'];
- }
- }
- }
- }
-
- /**
- * Check if there is an update for a hook
- *
- * @access private
- * @param string URL to check
- * @param string Long version number
- * @return bool
- */
- private function _updateAvailable( $url, $version )
- {
- if( !$version )
- {
- //return false;
- }
-
- require_once( IPS_KERNEL_PATH . '/classFileManagement.php' );
- $checker = new classFileManagement();
- $checker->use_sockets = $this->settings['enable_sockets'];
-
- //-----------------------------------------
- // This is a low timeout to prevent page from taking too long
- //-----------------------------------------
-
- $checker->timeout = 5;
-
- $return = $checker->getFileContents( str_replace( 'php&', 'php?', $url . '&version=' . $version ) );
-
- return $return == 1 ? true : false;
- }
-
- /**
- * Hooks overview
- *
- * @access private
- * @return void [Outputs to screen]
- * @todo [Future] Explore showing details/version requirements in a DHTML popup rather than a new page
- */
- private function _hooksOverview()
- {
- /* INI */
- $installedHooks = array();
- $uninstalledHooks = array();
- $min_order = 999999;
- $max_order = 0;
- $checkUpdates = ( isset( $this->request['checkUpdates'] ) AND $this->request['checkUpdates'] ) ? true : false;
-
- /* Get current hooks */
- $this->DB->build( array( 'select' => '*', 'from' => 'core_hooks', 'order' => 'hook_position ASC' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $r['_updated'] = $this->registry->getClass('class_localization')->formatTime( $r['hook_updated'] );
- $r['_installed'] = $this->registry->getClass('class_localization')->formatTime( $r['hook_installed'] );
-
- $r['hook_update_available'] = '';
-
- if( $r['hook_update_check'] && $checkUpdates === true )
- {
- if( $this->_updateAvailable( $r['hook_update_check'], $r['hook_version_long'] ) )
- {
- $r['hook_update_available'] = "Update Available ";
-
- if( $r['hook_website'] )
- {
- $r['hook_update_available'] = "" . $r['hook_update_available'] . ' ';
- }
- }
- }
-
- $min_order = $r['hook_position'] < $min_order ? $r['hook_position'] : $min_order;
- $max_order = $r['hook_position'] > $max_order ? $r['hook_position'] : $max_order;
-
- if( $r['hook_enabled'] )
- {
- $installedHooks[ $r['hook_id'] ] = $r;
- }
- else
- {
- $uninstalledHooks[ $r['hook_id'] ] = $r;
- }
- }
-
- if( count($installedHooks) )
- {
- foreach( $installedHooks as $id => $r )
- {
- $upButton = $r['hook_position'] > $min_order ? 1 : 0;
- $downButton = $r['hook_position'] < $max_order ? 1 : 0;
-
- $installedHooks[ $id ]['upButton'] = $upButton;
- $installedHooks[ $id ]['downButton'] = $downButton;
- }
- }
-
- /* Output */
- $this->registry->output->html .= $this->html->hooksOverview( $installedHooks, $uninstalledHooks );
- }
-
- /**
- * Disables a hook
- *
- * @access private
- * @return void [Outputs to screen]
- */
- private function _disableHook()
- {
- /* INI */
- $hook_id = intval( $this->request['id'] );
-
- /* Do update */
- $this->DB->update( 'core_hooks', array( 'hook_enabled' => 0 ), "hook_id={$hook_id}" );
-
- $this->rebuildHooksCache();
-
- /* Done */
- $this->registry->output->global_message = $this->lang->words['hook_disabled'];
- $this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . $this->form_code . '&do=hooks_overview' );
- }
-
- /**
- * Enables a hook
- *
- * @access private
- * @return void [Outputs to screen]
- */
- private function _enableHook()
- {
- /* INI */
- $hook_id = intval( $this->request['id'] );
-
- /* Do update */
- $this->DB->update( 'core_hooks', array( 'hook_enabled' => 1 ), "hook_id={$hook_id}" );
-
- $this->rebuildHooksCache();
-
- /* Done */
- $this->registry->output->global_message = $this->lang->words['h_hasbeenenabled'];
- $this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . $this->form_code . '&do=hooks_overview' );
- }
-
- /**
- * Uninstall a hook
- *
- * @access private
- * @return void [Outputs to screen]
- */
- private function _uninstallHook()
- {
- /* INI */
- $hook_id = intval( $this->request['id'] );
-
- $hook = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $hook_id ) );
- $extra_data = unserialize( $hook['hook_extra_data'] );
-
- if ( ! $hook['hook_id'] )
- {
- $this->registry->output->global_message = $this->lang->words['h_hasbeenun'];
- $this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . $this->form_code . '&do=hooks_overview' );
- }
-
- /* Get associated files */
- $this->DB->build( array( 'select' => 'hook_file_stored', 'from' => 'core_hooks_files', 'where' => 'hook_hook_id=' . $hook_id ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- @unlink( IPS_HOOKS_PATH . $r['hook_file_stored'] );
- }
-
- /* Delete hook file entries */
- $this->DB->delete( 'core_hooks_files', "hook_hook_id={$hook_id}" );
-
- //-----------------------------------------
- // Settings or setting groups?
- //-----------------------------------------
-
- if( count($extra_data['settingGroups']) )
- {
- $this->DB->delete( 'core_sys_settings_titles', 'conf_title_id IN(' . implode( ',', $extra_data['settingGroups'] ) . ')' );
- }
-
- if( count($extra_data['settings']) )
- {
- $this->DB->delete( 'core_sys_conf_settings', 'conf_id IN(' . implode( ',', $extra_data['settings'] ) . ')' );
- }
-
- $this->cache->rebuildCache( 'settings', 'global' );
-
- //-----------------------------------------
- // Language strings/files
- //-----------------------------------------
-
- if( count($extra_data['language']) )
- {
- foreach( $extra_data['language'] as $file => $bit )
- {
- $this->DB->delete( 'core_sys_lang_words', "word_pack='{$file}' AND word_key IN('" . implode( "','", $bit ) . "')" );
- }
-
- $langPacks = array();
-
- $this->DB->build( array( 'select' => 'lang_id', 'from' => 'core_sys_lang' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $langPacks[] = $r['lang_id'];
- }
-
- require_once( IPSLib::getAppDir('core') . '/modules_admin/languages/manage_languages.php' );
- $langLib = new admin_core_languages_manage_languages( $this->registry );
- $langLib->makeRegistryShortcuts( $this->registry );
-
- foreach( $langPacks as $langId )
- {
- $langLib->cacheToDisk( $langId );
- }
- }
-
- //-----------------------------------------
- // Modules
- //-----------------------------------------
-
- if( count($extra_data['modules']) )
- {
- $this->DB->delete( 'core_sys_module', 'sys_module_id IN(' . implode( ',', $extra_data['modules'] ) . ')' );
-
- $this->cache->rebuildCache( 'module_cache', 'global' );
- $this->cache->rebuildCache( 'app_menu_cache', 'global' );
- }
-
- //-----------------------------------------
- // Help files
- //-----------------------------------------
-
- if( count($extra_data['help']) )
- {
- $this->DB->delete( 'faq', 'id IN(' . implode( ',', $extra_data['help'] ) . ')' );
- }
-
- //-----------------------------------------
- // Skin templates
- //-----------------------------------------
-
- if( count($extra_data['templates']) )
- {
- foreach( $extra_data['templates'] as $file => $bit )
- {
- $this->DB->delete( 'skin_templates', "template_group='{$file}' AND template_name IN('" . implode( "','", $bit ) . "')" );
- }
-
- require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
- require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
- $skinCaching = new skinCaching( $this->registry );
- $skinCaching->rebuildPHPTemplates( 0 );
- }
-
- //-----------------------------------------
- // Tasks
- //-----------------------------------------
-
- if( count($extra_data['tasks']) )
- {
- $this->DB->delete( 'task_manager', 'task_id IN(' . implode( ',', $extra_data['tasks'] ) . ')' );
- }
-
- //-----------------------------------------
- // Database changes
- //-----------------------------------------
-
- if( is_array($extra_data['database']['create']) AND count($extra_data['database']['create']) )
- {
- foreach( $extra_data['database']['create'] as $create_query )
- {
- $this->DB->return_die = true;
- $this->DB->dropTable( $create_query['name'] );
- $this->DB->return_die = false;
- }
- }
-
- if( is_array($extra_data['database']['alter']) AND count($extra_data['database']['alter']) )
- {
- foreach( $extra_data['database']['alter'] as $alter_query )
- {
- $this->DB->return_die = true;
-
- if( $alter_query['altertype'] == 'add' )
- {
- if( $this->DB->checkForField( $alter_query['field'], $alter_query['table'] ) )
- {
- $this->DB->dropField( $alter_query['table'], $alter_query['field'] );
- }
- }
- else if( $alter_query['altertype'] == 'change' )
- {
- if( $this->DB->checkForField( $alter_query['newfield'], $alter_query['table'] ) )
- {
- $this->DB->changeField( $alter_query['table'] , $alter_query['newfield'], $alter_query['field'], $alter_query['fieldtype'], $alter_query['default'] );
- }
- }
-
- $this->DB->return_die = false;
- }
- }
-
- if( is_array($extra_data['database']['update']) AND count($extra_data['database']['update']) )
- {
- foreach( $extra_data['database']['update'] as $update_query )
- {
- $this->DB->return_die = true;
- $this->DB->update( $update_query['table'], array( $update_query['field'] => $update_query['oldvalue'] ), $update_query['where'] );
- $this->DB->return_die = false;
- }
- }
-
- if( is_array($extra_data['database']['insert']) AND count($extra_data['database']['insert']) )
- {
- foreach( $extra_data['database']['insert'] as $insert_query )
- {
- if( $insert_query['fordelete'] )
- {
- $this->DB->return_die = true;
- $this->DB->delete( $insert_query['table'], $insert_query['fordelete'] );
- $this->DB->return_die = false;
- }
- }
- }
-
- //-----------------------------------------
- // Custom install/uninstall script?
- //-----------------------------------------
-
- if( $extra_data['display']['custom'] )
- {
- if( file_exists( IPS_HOOKS_PATH . $extra_data['display']['custom'] ) )
- {
- require_once( IPS_HOOKS_PATH . $extra_data['display']['custom'] );
-
- $classname = preg_replace( "#^install_(.+)\.php$#", "$1", $extra_data['display']['custom'] );
-
- if( class_exists( $classname ) )
- {
- $uninstall = new $classname( $this->registry );
-
- if( method_exists( $uninstall, 'uninstall' ) )
- {
- $uninstall->uninstall();
- }
- }
-
- @unlink( IPS_HOOKS_PATH . $extra_data['display']['custom'] );
- }
- }
-
- /* Delete main hook entry */
- $this->DB->delete( 'core_hooks', "hook_id={$hook_id}" );
-
- $this->rebuildHooksCache();
-
- /* Done */
- $this->registry->output->global_message = $this->lang->words['h_hasbeenun'];
- $this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . $this->form_code . '&do=hooks_overview' );
- }
-
- /**
- * Hook add/edit form
- * This dynamic form allows users to associate multiple files with a single hook.
- *
- * @access private
- * @param string [add|edit]
- * @return void [Outputs to screen]
- */
- private function _hookForm( $type='add' )
- {
- if( $type == 'edit' )
- {
- $id = intval($this->request['id']);
-
- if( !$id )
- {
- $this->registry->output->showError( $this->lang->words['h_noedit'], 1116 );
- }
-
- $hookData = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $id ) );
-
- if( !$hookData['hook_id'] )
- {
- $this->registry->output->showError( $this->lang->words['h_noedit'], 1117 );
- }
-
- $hookData['hook_extra_data'] = unserialize( $hookData['hook_extra_data'] );
- $hookData['hook_requirements'] = unserialize( $hookData['hook_requirements'] );
-
- $files = array();
- $index = 1;
- $skinGroups = $this->hooksFunctions->getSkinGroups();
- $entryPoint = array();
-
- $entryPoint['foreach'] = array(
- array( 'outer.pre', $this->lang->words['h_outerpre'] ),
- array( 'inner.pre', $this->lang->words['h_innerpre'] ),
- array( 'inner.post', $this->lang->words['h_innerpost'] ),
- array( 'outer.post', $this->lang->words['h_outerpost'] ),
- );
-
- $entryPoint['if'] = array(
- array( 'pre.startif', $this->lang->words['h_prestartif'] ),
- array( 'post.startif', $this->lang->words['h_poststartif'] ),
- array( 'pre.else', $this->lang->words['h_preelse']),
- array( 'post.else', $this->lang->words['h_postelse'] ),
- array( 'pre.endif', $this->lang->words['h_preendif'] ),
- array( 'post.endif', $this->lang->words['h_postendif'] ),
- );
-
- $this->DB->build( array( 'select' => '*', 'from' => 'core_hooks_files', 'where' => 'hook_hook_id=' . $id ) );
- $outer = $this->DB->execute();
-
- while( $r = $this->DB->fetch($outer) )
- {
- $r['hook_data'] = unserialize( $r['hook_data'] );
-
- if( $r['hook_type'] == 'templateHooks' )
- {
- $templates = $this->hooksFunctions->getSkinMethods( $r['hook_data']['skinGroup'] );
- $hookIds = $this->hooksFunctions->getHookIds( $r['hook_data']['skinFunction'], $r['hook_data']['type'] );
-
- $r['_skinDropdown'] = $this->registry->output->formDropdown( "skinGroup[{$index}]", $skinGroups, $r['hook_data']['skinGroup'], "skinGroup[{$index}]", "onchange='getTemplatesForAdd({$index});'" );
- $r['_templateDropdown'] = $this->registry->output->formDropdown( "skinFunction[{$index}]", $templates, $r['hook_data']['skinFunction'], "skinFunction[{$index}]", "onchange='getTypeOfHook({$index});'" );
- $r['_hookTypeDropdown'] = $this->registry->output->formDropdown( "type[{$index}]", array( array( 'foreach', 'foreach loop' ), array( 'if', 'if statement' ) ), $r['hook_data']['type'], "type[{$index}]", "onchange='getHookIds({$index});'" );
- $r['_hookIdsDropdown'] = $this->registry->output->formDropdown( "id[{$index}]", $hookIds, $r['hook_data']['id'], "id[{$index}]", "onchange='getHookEntryPoints({$index});'" );
- $r['_hookEPDropdown'] = $this->registry->output->formDropdown( "position[{$index}]", $r['hook_data']['type'] == 'foreach' ? $entryPoint['foreach'] : $entryPoint['if'], $r['hook_data']['position'] );
- }
-
- $files[ $index ] = $r;
- $index++;
- }
-
- $action = 'do_edit_hook';
- }
- else
- {
- $hookData = array();
-
- foreach( array( 'hook_enabled', 'hook_name', 'hook_desc', 'hook_author', 'hook_email', 'hook_website', 'hook_update_check', 'hook_requirements', 'hook_version_human', 'hook_version_long', 'hook_installed', 'hook_updated', 'hook_position', 'hook_extra_data' ) as $_hook )
- {
- $hookData[ $_hook ] = $this->request[ $_hook ];
- }
-
- foreach( array( 'hook_ipb_version_max', 'hook_ipb_version_min', 'hook_php_version_min', 'hook_php_version_max' ) as $_version )
- {
- $hookData['hook_requirements'][ $_version ] = $this->request[ $_version ];
- }
-
- $files = array();
- $action = 'do_create_hook';
- }
-
- /* Output */
- $this->registry->output->html .= $this->html->hookForm( $action, $hookData, $files );
- }
-
- /**
- * Hook add/edit save
- * Save the new (or updated) hook record
- *
- * @access private
- * @param string [add|edit]
- * @return void [Outputs to screen]
- */
- private function _hookSave( $type='add' )
- {
- /* Error Checking */
- if( ! $this->request['hook_name'] )
- {
- $errors[] = $this->lang->words['hook_form_no_title'];
- }
-
- if( ! $this->request['hook_key'] )
- {
- $errors[] = $this->lang->words['hook_form_no_key'];
- }
-
- $newFiles = array();
-
- //if( !is_array( $this->request['file'] ) OR !count( $this->request['file'] ) )
- //{
- // $this->registry->output->global_message = $this->lang->words['h_onefile'];
- // $this->_hookForm();
- // return;
- //}
-
- if( is_array( $this->request['file'] ) AND count( $this->request['file'] ) )
- {
- foreach( $this->request['file'] as $index => $file )
- {
- if( $file )
- {
- $newFiles[ $index ] = array(
- 'hook_file_real' => $file,
- 'hook_file_stored' => $file, // During import this is a random name, but for devs it's actual file
- 'hook_type' => $this->request['hook_type'][ $index ],
- 'hook_classname' => $this->request['hook_classname'][ $index ],
- 'hook_data' => serialize(
- array(
- 'classToOverload' => trim($this->request['classToOverload'][ $index ]),
- 'skinGroup' => $this->request['skinGroup'][ $index ],
- 'skinFunction' => $this->request['skinFunction'][ $index ],
- 'type' => $this->request['type'][ $index ],
- 'id' => $this->request['id'][ $index ],
- 'position' => $this->request['position'][ $index ],
- )
- )
- );
- }
- }
- }
-
- //if( !is_array( $newFiles ) OR !count( $newFiles ) )
- //{
- // $errors[] = $this->lang->words['h_onefile'];
- //}
-
- if( is_array( $errors ) )
- {
- $this->registry->output->global_message = implode( ' ', $errors );
- $this->_hookForm();
- return;
- }
-
- /* Get data if we are editing */
- if( $type == 'edit' )
- {
- $id = intval($this->request['hook_id']);
-
- if( !$id )
- {
- $this->registry->output->showError( $this->lang->words['h_noedit'], 1118 );
- }
-
- $hookData = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $id ) );
-
- if( !$hookData['hook_id'] )
- {
- $this->registry->output->showError( $this->lang->words['h_noedit'], 1119 );
- }
- }
-
- /* Get new position */
- $position = $this->DB->buildAndFetch( array( 'select' => 'MAX(hook_position) as newPos', 'from' => 'core_hooks' ) );
-
- $mainHookRecord = array(
- 'hook_name' => trim($this->request['hook_name']),
- 'hook_key' => substr( trim($this->request['hook_key']), 0, 32 ),
- 'hook_desc' => trim($this->request['hook_desc']),
- 'hook_version_human' => trim($this->request['hook_version_human']),
- 'hook_version_long' => trim($this->request['hook_version_long']),
- 'hook_author' => trim($this->request['hook_author']),
- 'hook_email' => trim($this->request['hook_email']),
- 'hook_website' => trim($this->request['hook_website']),
- 'hook_update_check' => trim($this->request['hook_update_check']),
- 'hook_enabled' => $type == 'add' ? 1 : $hookData['hook_enabled'],
- 'hook_installed' => $type == 'add' ? time() : $hookData['hook_installed'],
- 'hook_updated' => $type == 'add' ? 0 : time(),
- 'hook_position' => $type == 'add' ? $position['newPos'] + 1 : $hookData['hook_position'],
- 'hook_requirements' => serialize(
- array(
- 'hook_ipb_version_min' => intval($this->request['hook_ipb_version_min']),
- 'hook_ipb_version_max' => intval($this->request['hook_ipb_version_max']),
- 'hook_php_version_min' => $this->request['hook_php_version_min'],
- 'hook_php_version_max' => $this->request['hook_php_version_max'],
- )
- )
- );
-
- if( $type == 'edit' )
- {
- $this->DB->update( 'core_hooks', $mainHookRecord, 'hook_id=' . $hookData['hook_id'] );
-
- $this->DB->delete( 'core_hooks_files', 'hook_hook_id=' . $hookData['hook_id'] );
- }
- else
- {
- $this->DB->insert( 'core_hooks', $mainHookRecord );
-
- $hookData['hook_id'] = $this->DB->getInsertId();
- }
-
- foreach( $newFiles as $index => $toInsert )
- {
- $toInsert['hook_hook_id'] = $hookData['hook_id'];
-
- $this->DB->insert( 'core_hooks_files', $toInsert );
- }
-
- $this->rebuildHooksCache();
-
- $this->registry->output->global_message = $this->lang->words['h_saved'];
- $this->_hooksOverview();
- }
-
- /**
- * View details about a hook
- *
- * @access private
- * @return void [Outputs to screen]
- */
- private function _viewDetails()
- {
- $id = intval($this->request['id']);
-
- if( !$id )
- {
- $this->registry->output->showError( $this->lang->words['h_nodetails'], 11110 );
- }
-
- $hookData = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $id ) );
-
- if( !$hookData['hook_id'] )
- {
- $this->registry->output->showError( $this->lang->words['h_nodetails'], 11111 );
- }
-
- $hookData['hook_extra_data'] = unserialize( $hookData['hook_extra_data'] );
- $hookData['hook_requirements'] = unserialize( $hookData['hook_requirements'] );
-
- if( $hookData['hook_requirements']['hook_ipb_version_min'] OR $hookData['hook_requirements']['hook_ipb_version_max'] )
- {
- /* Get the setup class */
- require IPS_ROOT_PATH . "setup/sources/base/setup.php";
-
- /* Fetch numbers */
- $versions = IPSSetUp::fetchXmlAppVersions( 'core' );
-
- /* Ensure we match at least 3.0.0 */
- $hookData['hook_requirements']['hook_ipb_version_min'] = ( $hookData['hook_requirements']['hook_ipb_version_min'] < 30000 ) ? 30000 : $hookData['hook_requirements']['hook_ipb_version_min'];
-
- foreach( $versions as $long => $human )
- {
- if( $hookData['hook_requirements']['hook_ipb_version_min'] <= $long )
- {
- $hookData['hook_requirements']['hook_ipb_version_min'] = $human;
- break;
- }
- }
-
- krsort( $versions );
-
- foreach( $versions as $long => $human )
- {
- if( $hookData['hook_requirements']['hook_ipb_version_max'] >= $long )
- {
- $hookData['hook_requirements']['hook_ipb_version_max'] = $human;
- break;
- }
- }
- }
-
- $files = array();
- $index = 1;
-
- $this->DB->build( array( 'select' => '*', 'from' => 'core_hooks_files', 'where' => 'hook_hook_id=' . $id ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $r['hook_data'] = unserialize( $r['hook_data'] );
- $files[ $index ] = $r;
- $index++;
- }
-
- /* Output */
- $this->registry->output->html .= $this->html->hookDetails( $hookData, $files );
- }
-
- /**
- * Check if you meet hook requirements
- *
- * @access private
- * @return void [Outputs to screen]
- */
- private function _checkRequirements()
- {
- $id = intval($this->request['id']);
-
- if( !$id )
- {
- $this->registry->output->showError( $this->lang->words['h_norequirements'], 11112 );
- }
-
- $hookData = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $id ) );
-
- if( !$hookData['hook_id'] )
- {
- $this->registry->output->showError( $this->lang->words['h_norequirements'], 11113 );
- }
-
- $hookData['hook_requirements'] = unserialize( $hookData['hook_requirements'] );
- $hookIpbBad = false;
- $hookPhpBad = false;
-
- /* Ensure we match at least 3.0.0 */
- $hookData['hook_requirements']['hook_ipb_version_min'] = ( $hookData['hook_requirements']['hook_ipb_version_min'] < 30000 ) ? 30000 : $hookData['hook_requirements']['hook_ipb_version_min'];
-
- if( $hookData['hook_requirements']['hook_ipb_version_min'] OR $hookData['hook_requirements']['hook_ipb_version_max'] )
- {
- /* Get the setup class */
- require IPS_ROOT_PATH . "setup/sources/base/setup.php";
-
- /* Fetch numbers */
- $versions = IPSSetUp::fetchXmlAppVersions( 'core' );
-
- $currentIPB = (int) IPB_LONG_VERSION;
-
- if( $hookData['hook_requirements']['hook_ipb_version_min'] AND $currentIPB < $hookData['hook_requirements']['hook_ipb_version_min'] )
- {
- $hookIpbBad = $this->lang->words['h_tooold'];
- }
-
- if( $hookData['hook_requirements']['hook_ipb_version_max'] AND $currentIPB > $hookData['hook_requirements']['hook_ipb_version_max'] )
- {
- $hookIpbBad = $this->lang->words['h_toonew'];
- }
-
- foreach( $versions as $long => $human )
- {
- if( $hookData['hook_requirements']['hook_ipb_version_min'] <= $long )
- {
- $hookData['hook_requirements']['hook_ipb_version_min'] = $human;
- break;
- }
- }
-
- krsort( $versions );
-
- foreach( $versions as $long => $human )
- {
- if( $hookData['hook_requirements']['hook_ipb_version_max'] >= $long )
- {
- $hookData['hook_requirements']['hook_ipb_version_max'] = $human;
- break;
- }
- }
- }
-
- if( $hookData['hook_requirements']['hook_php_version_min'] OR $hookData['hook_requirements']['hook_php_version_max'] )
- {
- if( $hookData['hook_requirements']['hook_php_version_min'] AND version_compare( PHP_VERSION, $hookData['hook_requirements']['hook_php_version_min'], '<' ) == true )
- {
- $hookPhpBad = $this->lang->words['h_phpold'];
- }
-
- if( $hookData['hook_requirements']['hook_php_version_max'] AND version_compare( PHP_VERSION, $hookData['hook_requirements']['hook_php_version_max'], '>' ) == true )
- {
- $hookPhpBad = $this->lang->words['h_phpnew'];
- }
- }
-
- /* Output */
- $this->registry->output->html .= $this->html->hookRequirements( $hookData, $hookIpbBad, $hookPhpBad );
- }
-
- /**
- * Rebuild hooks cache
- *
- * @access public
- * @return void
- */
- public function rebuildHooksCache()
- {
- /* INI */
- $cache = array();
-
- /* First fix positions */
- $this->_fixPositions();
-
- /* Get current hooks */
- $this->DB->build( array( 'select' => 'f.*',
- 'from' => array( 'core_hooks_files' => 'f' ),
- 'where' => 'c.hook_enabled=1',
- 'order' => 'c.hook_position ASC',
- 'add_join' => array(
- array(
- 'select' => 'c.hook_id, c.hook_key',
- 'from' => array( 'core_hooks' => 'c' ),
- 'where' => 'c.hook_id=f.hook_hook_id',
- 'type' => 'left',
- )
- )
- ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $data = unserialize( $r['hook_data'] );
-
- $cache[ $r['hook_type'] ][ $r['hook_key'] ][ $r['hook_file_id'] ] = array(
- 'filename' => $r['hook_file_stored'],
- 'className' => $r['hook_classname'],
- );
-
- if( $r['hook_type'] == 'templateHooks' )
- {
- $cache[ $r['hook_type'] ][ $r['hook_key'] ][ $r['hook_file_id'] ]['type'] = $data['type'];
- $cache[ $r['hook_type'] ][ $r['hook_key'] ][ $r['hook_file_id'] ]['skinGroup'] = $data['skinGroup'];
- $cache[ $r['hook_type'] ][ $r['hook_key'] ][ $r['hook_file_id'] ]['skinFunction'] = $data['skinFunction'];
- $cache[ $r['hook_type'] ][ $r['hook_key'] ][ $r['hook_file_id'] ]['id'] = $data['id'];
- $cache[ $r['hook_type'] ][ $r['hook_key'] ][ $r['hook_file_id'] ]['position'] = $data['position'];
- }
- else
- {
- $cache[ $r['hook_type'] ][ $r['hook_key'] ][ $r['hook_file_id'] ]['classToOverload'] = $data['classToOverload'];
- }
- }
-
- /* Update the cache */
- $this->cache->setCache( 'hooks', $cache, array( 'array' => 1 ) );
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Hooks Management
+ * Last Updated: $Date: 2010-10-19 08:45:58 -0400 (Tue, 19 Oct 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 3.0.0
+ * @version $Revision: 6994 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+class admin_core_applications_hooks extends ipsCommand
+{
+ /**
+ * Skin object
+ *
+ * @var object Skin templates
+ */
+ private $html;
+
+ /**
+ * Hooks library
+ *
+ * @var object Hooks library
+ */
+ protected $hooksFunctions;
+
+ /**
+ * Existing hooks
+ *
+ * @var array Existing hooks
+ */
+ protected $hooks;
+
+ /**
+ * Main class entry point
+ *
+ * @param object ipsRegistry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ //-----------------------------------------
+ // Load skin
+ //-----------------------------------------
+
+ $this->html = $this->registry->output->loadTemplate('cp_skin_applications');
+
+ //-----------------------------------------
+ // Load hooks library
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('core') . '/sources/classes/hooksFunctions.php', 'hooksFunctions' );
+ $this->hooksFunctions = new $classToLoad( $registry );
+
+ $this->registry->class_localization->loadLanguageFile( array( 'admin_applications' ) );
+
+ //-----------------------------------------
+ // Set up stuff
+ //-----------------------------------------
+
+ $this->form_code = $this->html->form_code = 'module=applications§ion=hooks';
+ $this->form_code_js = $this->html->form_code_js = 'module=applications§ion=hooks';
+
+ //-----------------------------------------
+ // What to do...
+ //-----------------------------------------
+
+ switch( $this->request['do'] )
+ {
+ case 'reenable_all_hooks':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
+ $this->_reenableAllHooks();
+ break;
+ case 'disable_all_hooks':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
+ $this->_disableAllHooks();
+ break;
+
+ break;
+ case 'disable_hook':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
+ $this->_disableHook();
+ break;
+ case 'enable_hook':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
+ $this->_enableHook();
+ break;
+
+ case 'uninstall_hook':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_delete' );
+ $this->_uninstallHook();
+ break;
+ case 'install_hook':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
+ $this->_installHook();
+ break;
+
+ case 'reorder':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
+ $this->_reorder();
+ break;
+
+ case 'view_details':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
+ $this->_viewDetails();
+ break;
+
+ case 'check_requirements':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
+ $this->_checkRequirements();
+ break;
+
+ case 'export_hook':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
+ $this->_exportHook();
+ break;
+
+ case 'do_export_hook':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
+ $this->_doExportHook();
+ break;
+
+ case 'create_hook':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
+ $this->_hookForm( 'add' );
+ break;
+
+ case 'edit_hook':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
+ $this->_hookForm( 'edit' );
+ break;
+
+ case 'do_create_hook':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
+ $this->_hookSave( 'add' );
+ break;
+
+ case 'do_edit_hook':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
+ $this->_hookSave( 'edit' );
+ break;
+
+ case 'skinsRebuild':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
+ $this->_rebuildSkins();
+ break;
+
+ case 'removeDeadCaches':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
+ $this->removeDeadCaches();
+ break;
+
+ case 'reimport_apps':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
+ $this->reimportAppHooks();
+ break;
+
+ case 'hooks_overview':
+ default:
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'hooks_manage' );
+ $this->request['do'] = 'hooks_overview';
+ $this->_hooksOverview();
+ 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();
+ }
+
+ /**
+ * Reimport all hooks for all installed applications
+ *
+ * @return void
+ */
+ protected function reimportAppHooks()
+ {
+ $stats = array( 'inserted' => 0, 'updated' => 0, 'skipped' => 0 );
+
+ foreach( ipsRegistry::$applications as $app )
+ {
+ $_stats = $this->installAppHooks( $app['app_directory'] );
+
+ $stats['inserted'] = $stats['inserted'] + $_stats['inserted'];
+ $stats['updated'] = $stats['updated'] + $_stats['updated'];
+ $stats['skipped'] = $stats['skipped'] + $_stats['skipped'];
+ }
+
+ //-----------------------------------------
+ // Message
+ //-----------------------------------------
+
+ $this->registry->output->global_message = sprintf( $this->lang->words['app_hooks_rebuilt'], $stats['inserted'], $stats['updated'], $stats['skipped'] );
+
+ //-----------------------------------------
+ // Recache hooks so templates know that there
+ // are comments to preserve
+ //-----------------------------------------
+
+ $this->rebuildHooksCache();
+
+ /* Flag skins for recache */
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
+ $skinCaching = new skinCaching( $this->registry );
+
+ /* Flag all for recache */
+ $skinCaching->flagSetForRecache();
+
+ /* Print message */
+
+ $this->_hooksOverview();
+ }
+
+ /**
+ * Rebuild skins following hook import that included a template
+ *
+ * @return void
+ */
+ protected function removeDeadCaches()
+ {
+ $messages = array();
+ $keep = array();
+ $unlink = array();
+
+ /* Grab all current hooks caches */
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'core_hooks_files' ) );
+
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $keep[] = $row['hook_file_stored'];
+ }
+
+ try
+ {
+ foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . 'hooks' ) as $file )
+ {
+ if ( ! $file->isDot() )
+ {
+ $_name = $file->getFileName();
+
+ if ( preg_match( "#_[a-z0-9]{32}\.php$#", $_name ) )
+ {
+ if ( ! in_array( $_name, $keep ) )
+ {
+ $unlink[] = $_name;
+ }
+ }
+ }
+ }
+ } catch ( Exception $e ) { print $e->getMessage(); }
+
+ /* Anything to unlink? */
+ if ( count( $unlink ) )
+ {
+ foreach( $unlink as $file )
+ {
+ @unlink( DOC_IPS_ROOT_PATH . 'hooks/' . $file );
+ }
+ }
+
+ /* Print message */
+ $this->registry->output->global_message = count( $unlink ) . " Cached Hook Files Removed " . implode( " ", $unlink );
+ $this->_hooksOverview();
+ }
+
+ /**
+ * Rebuild skins following hook import that included a template
+ *
+ * @return void
+ */
+ protected function _rebuildSkins()
+ {
+ $setID = intval( $this->request['setID'] );
+
+ if( $setID )
+ {
+ //-----------------------------------------
+ // Get the libs
+ //-----------------------------------------
+
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
+ $skinCaching = new skinCaching( $this->registry );
+
+ $skinCaching->rebuildPHPTemplates( $setID );
+
+ /* Fetch next id */
+ $nextID = $setID;
+
+ ksort( $this->registry->output->allSkins );
+
+ foreach( $this->registry->output->allSkins as $id => $data )
+ {
+ if ( $id > $nextID )
+ {
+ $nextID = $id;
+ break;
+ }
+ }
+
+ if ( $nextID != $setID )
+ {
+ $this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_templates' ) );
+
+ /* More to go.. */
+ $this->registry->output->redirect( $this->settings['base_url'] . 'app=core&module=applications§ion=hooks&do=skinsRebuild&setID=' . $nextID, $this->lang->words['to_recachedset'] . $this->registry->output->allSkins[ $setID ]['set_name'] );
+ }
+ }
+
+ //-----------------------------------------
+ // Must be all done!
+ //-----------------------------------------
+
+ $message = ipsRegistry::getClass('adminFunctions')->staffGetCookie( 'hookResult' );
+ ipsRegistry::getClass('adminFunctions')->staffSaveCookie( 'hookResult', '' );
+
+ $this->registry->output->global_message = $message;
+
+ $this->rebuildHooksCache();
+
+ $this->_hooksOverview();
+ }
+
+ /**
+ * Reorder hooks
+ *
+ * @return void [Outputs to screen]
+ */
+ private function _reorder()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
+ $ajax = new $classToLoad();
+
+ //-----------------------------------------
+ // Checks...
+ //-----------------------------------------
+
+ if( $this->registry->adminFunctions->checkSecurityKey( $this->request['md5check'], true ) === false )
+ {
+ $ajax->returnString( $this->lang->words['postform_badmd5'] );
+ exit();
+ }
+
+ //-----------------------------------------
+ // Save new position
+ //-----------------------------------------
+
+ $position = 1;
+
+ if( is_array($this->request['hooks']) AND count($this->request['hooks']) )
+ {
+ foreach( $this->request['hooks'] as $this_id )
+ {
+ $this->DB->update( 'core_hooks', array( 'hook_position' => $position ), 'hook_id=' . $this_id );
+
+ $position++;
+ }
+ }
+
+ $this->rebuildHooksCache();
+
+ $ajax->returnString( 'OK' );
+ exit();
+ }
+
+ /**
+ * Install a new hook
+ *
+ * @return void
+ */
+ private function _installHook()
+ {
+ //-----------------------------------------
+ // Get uploaded schtuff
+ //-----------------------------------------
+
+ $tmp_name = $_FILES['FILE_UPLOAD']['name'];
+ $tmp_name = preg_replace( "#\.gz$#", "", $tmp_name );
+
+ $content = ipsRegistry::getClass('adminFunctions')->importXml( $tmp_name );
+
+ if( ! $content )
+ {
+ $this->registry->output->showError( $this->lang->words['h_noxml'], 1110 );
+ }
+
+ $this->installHook( $content, TRUE );
+
+ $this->rebuildHooksCache();
+
+ $this->_hooksOverview();
+ }
+
+ /**
+ * Function mostly used in installer/upgrader
+ * Inserts new hooks
+ *
+ * @param string Application to install hooks for
+ * @todo Figure out how to upgrade hooks properly (db updates / template updates / file updates, etc)
+ */
+ public function installAppHooks( $app )
+ {
+ static $hooks = array();
+
+ $msgs = array( 'inserted' => 0, 'updated' => 0, 'skipped' => 0 );
+ $hooks = array();
+ $xmlData = array();
+ $path = IPSLib::getAppDir( $app ) . '/xml';
+
+ if ( file_exists( $path . '/hooks.xml' ) AND is_dir( $path . '/hooks' ) )
+ {
+ if( !count($hooks) )
+ {
+ /* Fetch current hooks */
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'core_hooks' ) );
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ if ( $row['hook_key'] )
+ {
+ $hooks[ $row['hook_key'] ] = $row;
+ }
+ }
+ }
+
+ /* Alright. We're in. Read the XML file */
+ require_once( IPS_KERNEL_PATH . 'classXML.php' );
+ $xml = new classXML( IPS_DOC_CHAR_SET );
+
+ /* Grab wrapper file */
+ $xml->load( $path . '/hooks.xml' );
+
+ foreach( $xml->fetchElements('hook') as $data )
+ {
+ $xmlData[] = $xml->fetchElementsFromRecord( $data );
+ }
+
+ /* Examine XML */
+ if ( is_array( $xmlData ) AND count( $xmlData ) )
+ {
+ foreach( $xmlData as $x )
+ {
+ if ( file_exists( $path . '/hooks/' . $x['file'] ) )
+ {
+ $xml->load( $path . '/hooks/' . $x['file'] );
+
+ foreach( $xml->fetchElements('config') as $data )
+ {
+ $config = $xml->fetchElementsFromRecord( $data );
+ }
+
+ if ( ! isset( $hooks[ $config['hook_key'] ] ) )
+ {
+ /* Add it */
+ $msgs['inserted']++;
+ $this->installHook( file_get_contents( $path . '/hooks/' . $x['file'] ), FALSE, FALSE, $x['enabled'] );
+ }
+ else
+ {
+ $this->installHook( file_get_contents( $path . '/hooks/' . $x['file'] ), FALSE, FALSE, $x['enabled'] );
+ $msgs['updated']++;
+ }
+ }
+ }
+ }
+ }
+
+ return $msgs;
+ }
+
+ /**
+ * Public install hook so we can use it in the installer and elsewhere
+ *
+ * @param string XML data
+ * @param boolean Add message to output->global_message
+ * @param boolean Allow skins to recache
+ * @param int Install enabled
+ * @return void
+ */
+ public function installHook( $content, $addMessage=FALSE, $allowSkinRecache=TRUE, $enabled=1 )
+ {
+ //-----------------------------------------
+ // Hooks directory writable?
+ //-----------------------------------------
+
+ if( !is_writable( IPS_HOOKS_PATH ) )
+ {
+ if( !$addMessage )
+ {
+ return false;
+ }
+
+ $this->registry->output->showError( $this->lang->words['h_dir_notwritable'], 111159 );
+ }
+
+ //-----------------------------------------
+ // Got our hooks?
+ //-----------------------------------------
+
+ if( !is_array($this->hooks) OR !count($this->hooks) )
+ {
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_hooks' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $this->hooks[ $r['hook_key'] ] = $r;
+ }
+ }
+
+ //-----------------------------------------
+ // Get xml mah-do-dah
+ //-----------------------------------------
+
+ require_once( IPS_KERNEL_PATH . 'classXML.php' );
+ $xml = new classXML( IPS_DOC_CHAR_SET );
+
+ //-----------------------------------------
+ // Unpack the datafile
+ //-----------------------------------------
+
+ $xml->loadXML( $content );
+
+ foreach( $xml->fetchElements('config') as $data )
+ {
+ $config = $xml->fetchElementsFromRecord( $data );
+
+ if( !count($config) )
+ {
+ $this->registry->output->showError( $this->lang->words['h_xmlwrong'], 1111 );
+ }
+ }
+
+ //-----------------------------------------
+ // Temp
+ //-----------------------------------------
+
+ $tempExtraData = unserialize( $config['hook_extra_data'] );
+
+ //-----------------------------------------
+ // Set config
+ //-----------------------------------------
+
+ $config = array(
+ 'hook_name' => $config['hook_name'],
+ 'hook_desc' => $config['hook_desc'],
+ 'hook_author' => $config['hook_author'],
+ 'hook_email' => $config['hook_email'],
+ 'hook_website' => $config['hook_website'],
+ 'hook_update_check' => $config['hook_update_check'],
+ 'hook_requirements' => $config['hook_requirements'],
+ 'hook_version_human' => $config['hook_version_human'],
+ 'hook_version_long' => $config['hook_version_long'],
+ 'hook_key' => $config['hook_key'],
+ 'hook_enabled' => $enabled,
+ 'hook_updated' => time(),
+ );
+
+ $extra_data = array();
+
+ //-----------------------------------------
+ // Set files
+ //-----------------------------------------
+
+ $files = array();
+
+ foreach( $xml->fetchElements('hookfiles') as $node )
+ {
+ foreach( $xml->fetchElements('file', $node) as $_file )
+ {
+ $file = $xml->fetchElementsFromRecord( $_file );
+
+ if( $file['hook_type'] )
+ {
+ $files[] = array(
+ 'hook_file_real' => $file['hook_file_real'],
+ 'hook_type' => $file['hook_type'],
+ 'hook_classname' => $file['hook_classname'],
+ 'hook_data' => $file['hook_data'],
+ 'hooks_source' => $file['hooks_source'],
+ );
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Set the custom script
+ //-----------------------------------------
+
+ $custom = array();
+
+ foreach( $xml->fetchElements('hookextras_custom') as $node )
+ {
+ foreach( $xml->fetchElements('file', $node) as $_file )
+ {
+ $file = $xml->fetchElementsFromRecord( $_file );
+
+ if( count($file) )
+ {
+ $custom = array(
+ 'filename' => $file['filename'],
+ 'source' => $file['source'],
+ );
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Set the settings
+ //-----------------------------------------
+
+ $settings = array();
+ $settingGroups = array();
+
+ foreach( $xml->fetchElements('hookextras_settings') as $node )
+ {
+ foreach( $xml->fetchElements('setting', $node) as $_setting )
+ {
+ $setting = $xml->fetchElementsFromRecord( $_setting );
+
+ if( $setting['conf_is_title'] == 1)
+ {
+ $settingGroups[] = array(
+ 'conf_title_title' => $setting['conf_title_title'],
+ 'conf_title_desc' => $setting['conf_title_desc'],
+ 'conf_title_noshow' => $setting['conf_title_noshow'],
+ 'conf_title_keyword' => $setting['conf_title_keyword'],
+ 'conf_title_app' => $setting['conf_title_app'],
+ 'conf_title_tab' => $setting['conf_title_tab'],
+ );
+ }
+ else
+ {
+ $settings[] = array(
+ 'conf_title' => $setting['conf_title'],
+ 'conf_description' => $setting['conf_description'],
+ 'conf_group' => $setting['conf_group'],
+ 'conf_type' => $setting['conf_type'],
+ 'conf_key' => $setting['conf_key'],
+ 'conf_default' => $setting['conf_default'],
+ 'conf_extra' => $setting['conf_extra'],
+ 'conf_evalphp' => $setting['conf_evalphp'],
+ 'conf_protected' => $setting['conf_protected'],
+ 'conf_position' => $setting['conf_position'],
+ 'conf_start_group' => $setting['conf_start_group'],
+ 'conf_add_cache' => $setting['conf_add_cache'],
+ 'conf_title_keyword' => $setting['conf_title_keyword'],
+ );
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Set the lang bits
+ //-----------------------------------------
+
+ $language = array();
+
+ foreach( $xml->fetchElements('hookextras_language') as $node )
+ {
+ foreach( $xml->fetchElements('language', $node) as $_langbit )
+ {
+ $langbit = $xml->fetchElementsFromRecord( $_langbit );
+
+ $language[] = array(
+ 'word_app' => $langbit['word_app'],
+ 'word_pack' => $langbit['word_pack'],
+ 'word_key' => $langbit['word_key'],
+ 'word_default' => $langbit['word_default'],
+ 'word_custom' => $langbit['word_custom'],
+ 'word_js' => $langbit['word_js'],
+ );
+ }
+ }
+
+ //-----------------------------------------
+ // Set the modules
+ //-----------------------------------------
+
+ $modules = array();
+
+ foreach( $xml->fetchElements('hookextras_modules') as $node )
+ {
+ foreach( $xml->fetchElements('module', $node) as $_module )
+ {
+ $module = $xml->fetchElementsFromRecord( $_module );
+ $modules[] = array(
+ 'sys_module_title' => $module['sys_module_title'],
+ 'sys_module_application' => $module['sys_module_application'],
+ 'sys_module_key' => $module['sys_module_key'],
+ 'sys_module_description' => $module['sys_module_description'],
+ 'sys_module_version' => $module['sys_module_version'],
+ 'sys_module_protected' => $module['sys_module_protected'],
+ 'sys_module_visible' => $module['sys_module_visible'],
+ 'sys_module_position' => $module['sys_module_position'],
+ 'sys_module_admin' => $module['sys_module_admin'],
+ );
+ }
+ }
+
+ //-----------------------------------------
+ // Set the help files
+ //-----------------------------------------
+
+ $help = array();
+
+ foreach( $xml->fetchElements('hookextras_help') as $node )
+ {
+ foreach( $xml->fetchElements('help', $node) as $_helpfile )
+ {
+ $helpfile = $xml->fetchElementsFromRecord( $_helpfile );
+ $help[] = array(
+ 'title' => $helpfile['title'],
+ 'text' => $helpfile['text'],
+ 'description' => $helpfile['description'],
+ 'position' => $helpfile['position'],
+ );
+ }
+ }
+
+ //-----------------------------------------
+ // Set the templates
+ //-----------------------------------------
+
+ $templates = array();
+
+ foreach( $xml->fetchElements('hookextras_templates') as $node )
+ {
+ foreach( $xml->fetchElements('templates', $node) as $_template )
+ {
+ $template = $xml->fetchElementsFromRecord( $_template );
+
+ $templates[] = array(
+ 'template_set_id' => 0,
+ 'template_group' => $template['template_group'],
+ 'template_content' => $template['template_content'],
+ 'template_name' => $template['template_name'],
+ 'template_data' => $template['template_data'],
+ 'template_updated' => $template['template_updated'],
+ 'template_removable' => $template['template_removable'],
+ 'template_added_to' => $template['template_added_to'],
+ 'template_user_added' => 1,
+ 'template_user_edited' => 0,
+ 'template_master_key' => ( $template['template_master_key'] ) ? $template['template_master_key'] : 'root',
+ );
+ }
+ }
+
+ //-----------------------------------------
+ // Set the tasks
+ //-----------------------------------------
+
+ $css = array();
+
+ foreach( $xml->fetchElements('hookextras_css') as $node )
+ {
+ foreach( $xml->fetchElements('css', $node) as $_css )
+ {
+ $_css = $xml->fetchElementsFromRecord( $_css );
+ $css[] = array(
+ 'css_set_id' => 0,
+ 'css_group' => $_css['css_group'],
+ 'css_content' => $_css['css_content'],
+ 'css_position' => $_css['css_position'],
+ 'css_added_to' => 1,
+ 'css_app' => $_css['css_app'],
+ 'css_app_hide' => $_css['css_app_hide'],
+ 'css_attributes' => $_css['css_attributes'],
+ 'css_removed' => $_css['css_removed'],
+ 'css_modules' => $_css['css_modules'],
+ 'css_master_key' => ( $_css['css_master_key'] ) ? $_css['css_master_key'] : $_css['css_master_key']
+ );
+ }
+ }
+
+ //-----------------------------------------
+ // Set the tasks
+ //-----------------------------------------
+
+ $tasks = array();
+
+ foreach( $xml->fetchElements('hookextras_tasks') as $node )
+ {
+ foreach( $xml->fetchElements('tasks', $node) as $_task )
+ {
+ $task = $xml->fetchElementsFromRecord( $_task );
+ $tasks[] = array(
+ 'task_title' => $task['task_title'],
+ 'task_file' => $task['task_file'],
+ 'task_week_day' => $task['task_week_day'],
+ 'task_month_day' => $task['task_month_day'],
+ 'task_hour' => $task['task_hour'],
+ 'task_minute' => $task['task_minute'],
+ 'task_cronkey' => $task['task_cronkey'],
+ 'task_log' => $task['task_log'],
+ 'task_description' => $task['task_description'],
+ 'task_enabled' => $task['task_enabled'],
+ 'task_key' => $task['task_key'],
+ 'task_safemode' => $task['task_safemode'],
+ 'task_locked' => $task['task_locked'],
+ 'task_application' => $task['task_application'],
+ );
+ }
+ }
+
+ //-----------------------------------------
+ // Set the database changes
+ //-----------------------------------------
+
+ $database = array(
+ 'create' => array(),
+ 'alter' => array(),
+ 'update' => array(),
+ 'insert' => array(),
+ );
+
+ foreach( $xml->fetchElements('hookextras_database_create') as $node )
+ {
+ foreach( $xml->fetchElements('create', $node) as $_table )
+ {
+ $table = $xml->fetchElementsFromRecord( $_table );
+ $database['create'][] = array(
+ 'name' => $table['name'],
+ 'fields' => $table['fields'],
+ 'tabletype' => $table['tabletype'],
+ );
+ }
+ }
+
+ foreach( $xml->fetchElements('hookextras_database_alter') as $node )
+ {
+ foreach( $xml->fetchElements('alter', $node) as $_table )
+ {
+ $table = $xml->fetchElementsFromRecord( $_table );
+ $database['alter'][] = array(
+ 'altertype' => $table['altertype'],
+ 'table' => $table['table'],
+ 'field' => $table['field'],
+ 'newfield' => $table['newfield'],
+ 'fieldtype' => $table['fieldtype'],
+ 'default' => $table['default'],
+ );
+ }
+ }
+
+ foreach( $xml->fetchElements('hookextras_database_update') as $node )
+ {
+ foreach( $xml->fetchElements('update', $node) as $_table )
+ {
+ $table = $xml->fetchElementsFromRecord( $_table );
+ $database['update'][] = array(
+ 'table' => $table['table'],
+ 'field' => $table['field'],
+ 'newvalue' => $table['newvalue'],
+ 'oldvalue' => $table['oldvalue'],
+ 'where' => $table['where'],
+ );
+ }
+ }
+
+ foreach( $xml->fetchElements('hookextras_database_insert') as $node )
+ {
+ foreach( $xml->fetchElements('insert', $node) as $_table )
+ {
+ $table = $xml->fetchElementsFromRecord( $_table );
+ $database['insert'][] = array(
+ 'table' => $table['table'],
+ 'updates' => $table['updates'],
+ 'fordelete' => $table['fordelete'],
+ );
+ }
+ }
+
+ //-----------------------------------------
+ // Set some vars for display tallies
+ //-----------------------------------------
+
+ $filesInserted = 0;
+ $settingGroupsInserted = 0;
+ $settingsInserted = 0;
+ $settingsUpdated = 0;
+ $languageInserted = 0;
+ $languageUpdated = 0;
+ $modulesInserted = 0;
+ $modulesUpdated = 0;
+ $helpInserted = 0;
+ $helpUpdated = 0;
+ $templatesInserted = 0;
+ $templatesUpdated = 0;
+ $templateHooks = 0;
+ $tasksInserted = 0;
+ $tasksUpdated = 0;
+ $createQueries = 0;
+ $alterQueries = 0;
+ $updateQueries = 0;
+ $insertQueries = 0;
+ $cssInserted = 0;
+ $cssUpdated = 0;
+
+ //-----------------------------------------
+ // Need to recache skins?
+ //-----------------------------------------
+
+ foreach( $files as $_f )
+ {
+ if ( $_f['hook_type'] AND $_f['hook_type'] == 'templateHooks' )
+ {
+ $templateHooks++;
+ }
+ }
+
+ //-----------------------------------------
+ // Insert/update DB records
+ //-----------------------------------------
+
+ if( $this->hooks[ $config['hook_key'] ]['hook_id'] )
+ {
+ //-----------------------------------------
+ // Don't change enabled/disabled status
+ //-----------------------------------------
+
+ unset( $config['hook_enabled'] );
+
+ $this->DB->update( 'core_hooks', $config, 'hook_id=' . $this->hooks[ $config['hook_key'] ]['hook_id'] );
+
+ $hook_id = $this->hooks[ $config['hook_key'] ]['hook_id'];
+
+ $extra_data = unserialize( $this->hooks[ $config['hook_key'] ]['hook_extra_data'] );
+
+ /* Reset DB */
+ $extra_data['database'] = array();
+ }
+ else
+ {
+ $config['hook_installed'] = time();
+ $this->hook[ $config['hook_key'] ] = $config;
+
+ $this->DB->insert( 'core_hooks', $config );
+
+ $hook_id = $this->DB->getInsertId();
+
+ $this->hook[ $config['hook_key'] ]['hook_id'] = $hook_id;
+
+ $extra_data['display'] = $tempExtraData['display'];
+ }
+
+ if( count($files) )
+ {
+ //-----------------------------------------
+ // If we are updating, remove old files
+ //-----------------------------------------
+
+ if( $this->hooks[ $config['hook_key'] ]['hook_id'] )
+ {
+ $this->DB->build( array( 'select' => 'hook_file_id, hook_file_stored', 'from' => 'core_hooks_files', 'where' => 'hook_hook_id=' . $this->hooks[ $config['hook_key'] ]['hook_id'] ) );
+ $outer = $this->DB->execute();
+
+ while( $r = $this->DB->fetch($outer) )
+ {
+ @unlink( IPS_HOOKS_PATH . $r['hook_file_stored'] );
+ $this->DB->delete( 'core_hooks_files', 'hook_file_id=' . $r['hook_file_id'] );
+ }
+ }
+
+ foreach( $files as $file )
+ {
+ //-----------------------------------------
+ // Store new files
+ //-----------------------------------------
+
+ $filename = $file['hook_classname'] . '_' . md5( uniqid( microtime(), true ) ) . '.php';
+
+ file_put_contents( IPS_HOOKS_PATH . $filename, $file['hooks_source'] );
+ chmod( IPS_HOOKS_PATH . $filename, 0777 );
+
+ $file['hook_file_stored'] = $filename;
+ $file['hook_hook_id'] = $hook_id;
+
+ $this->DB->insert( 'core_hooks_files', $file );
+ $filesInserted++;
+ }
+ }
+
+ //-----------------------------------------
+ // Put custom install/uninstall file
+ //-----------------------------------------
+
+ if( $custom['source'] AND $custom['filename'] )
+ {
+ file_put_contents( IPS_HOOKS_PATH . "install_" . $custom['filename'], $custom['source'] );
+ }
+
+ //-----------------------------------------
+ // (1) Settings
+ //-----------------------------------------
+
+ if( count($settingGroups) OR count($settings) )
+ {
+ $setting_groups = array();
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_settings_titles', 'order' => 'conf_title_title' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $setting_groups[ $r['conf_title_id'] ] = $r;
+ $setting_groups_by_key[ $r['conf_title_keyword'] ] = $r;
+ }
+
+ //-----------------------------------------
+ // Get current settings.
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => 'conf_id, conf_key',
+ 'from' => 'core_sys_conf_settings',
+ 'order' => 'conf_id' ) );
+
+ $this->DB->execute();
+
+ while ( $r = $this->DB->fetch() )
+ {
+ $cur_settings[ $r['conf_key'] ] = $r['conf_id'];
+ }
+ }
+
+ if( count($settingGroups) )
+ {
+ $need_to_update = array();
+
+ foreach( $settingGroups as $data )
+ {
+ if ( $data['conf_title_title'] AND $data['conf_title_keyword'] )
+ {
+ //-----------------------------------------
+ // Get ID based on key
+ //-----------------------------------------
+
+ $conf_id = $setting_groups_by_key[ $data['conf_title_keyword'] ]['conf_title_id'];
+
+ $save = array( 'conf_title_title' => $data['conf_title_title'],
+ 'conf_title_desc' => $data['conf_title_desc'],
+ 'conf_title_keyword' => $data['conf_title_keyword'],
+ 'conf_title_app' => $data['conf_title_app'],
+ 'conf_title_tab' => $data['conf_title_tab'],
+ 'conf_title_noshow' => $data['conf_title_noshow'] );
+
+ //-----------------------------------------
+ // Not got a row, insert first!
+ //-----------------------------------------
+
+ if ( ! $conf_id )
+ {
+ $this->DB->insert( 'core_sys_settings_titles', $save );
+ $conf_id = $this->DB->getInsertId();
+ $settingGroupsInserted++;
+ $extra_data['settingGroups'][] = $conf_id;
+ }
+ else
+ {
+ //-----------------------------------------
+ // Update...
+ //-----------------------------------------
+
+ $this->DB->update( 'core_sys_settings_titles', $save, 'conf_title_id='.$conf_id );
+ }
+
+ //-----------------------------------------
+ // Update settings cache
+ //-----------------------------------------
+
+ $save['conf_title_id'] = $conf_id;
+ $setting_groups_by_key[ $save['conf_title_keyword'] ] = $save;
+ $setting_groups[ $save['conf_title_id'] ] = $save;
+
+ //-----------------------------------------
+ // Set need update...
+ //-----------------------------------------
+
+ $need_update[] = $conf_id;
+ }
+ }
+ }
+
+ if( count($settings) )
+ {
+ foreach( $settings as $idx => $data )
+ {
+ $data['conf_group'] = $setting_groups_by_key[ $data['conf_title_keyword'] ]['conf_title_id'];
+
+ //-----------------------------------------
+ // Remove from array
+ //-----------------------------------------
+
+ unset( $data['conf_title_keyword'] );
+
+ if ( $cur_settings[ $data['conf_key'] ] )
+ {
+ $this->DB->update( 'core_sys_conf_settings', $data, 'conf_id='.$cur_settings[ $data['conf_key'] ] );
+ $settingsUpdated++;
+ }
+ else
+ {
+ $this->DB->insert( 'core_sys_conf_settings', $data );
+ $settingsInserted++;
+ $conf_id = $this->DB->getInsertId();
+ $extra_data['settings'][] = $conf_id;
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Update group counts...
+ //-----------------------------------------
+
+ if ( count( $need_update ) )
+ {
+ foreach( $need_update as $i => $idx )
+ {
+ $conf = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count', 'from' => 'core_sys_conf_settings', 'where' => 'conf_group='.$idx ) );
+
+ $count = intval($conf['count']);
+
+ $this->DB->update( 'core_sys_settings_titles', array( 'conf_title_count' => $count ), 'conf_title_id='.$idx );
+ }
+ }
+
+ if( count($settingGroups) OR count($settings) )
+ {
+ $this->cache->rebuildCache( 'settings', 'global' );
+ }
+
+ //-----------------------------------------
+ // (2) Languages
+ //-----------------------------------------
+
+ if( count($language) )
+ {
+ $langPacks = array();
+
+ $this->DB->build( array( 'select' => 'lang_id', 'from' => 'core_sys_lang' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $langPacks[] = $r['lang_id'];
+ }
+
+ foreach( $language as $langbit )
+ {
+ foreach( $langPacks as $lang_id )
+ {
+ $langbit['lang_id'] = $lang_id;
+
+ // See if it exists
+ $cnt = $this->DB->buildAndFetch( array( 'select' => 'word_id', 'from' => 'core_sys_lang_words', 'where' => "lang_id={$lang_id} AND word_app='{$langbit['word_app']}' AND word_key='{$langbit['word_key']}' AND word_pack='{$langbit['word_pack']}'" ) );
+
+ if( $cnt['word_id'] )
+ {
+ $this->DB->update( 'core_sys_lang_words', $langbit, 'word_id=' . $cnt['word_id'] );
+ $languageUpdated++;
+ }
+ else
+ {
+ $this->DB->insert( 'core_sys_lang_words', $langbit );
+ $languageInserted++;
+ $word_id = $this->DB->getInsertId();
+ $extra_data['language'][ $langbit['word_pack'] ][] = $langbit['word_key'];
+ }
+ }
+ }
+
+ $classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir('core') . '/modules_admin/languages/manage_languages.php', 'admin_core_languages_manage_languages' );
+ $langLib = new $classToLoad();
+ $langLib->makeRegistryShortcuts( $this->registry );
+
+ foreach( $langPacks as $langId )
+ {
+ $langLib->cacheToDisk( $langId );
+ }
+ }
+
+ //-----------------------------------------
+ // (3) Modules
+ //-----------------------------------------
+
+ if( count($modules) )
+ {
+ //-----------------------------------------
+ // Get current modules
+ //-----------------------------------------
+ $cur_modules = array();
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'core_sys_module',
+ 'order' => 'sys_module_id' ) );
+
+ $this->DB->execute();
+
+ while ( $r = $this->DB->fetch() )
+ {
+ $cur_modules[ $r['sys_module_application'] ][ $r['sys_module_key'] ] = $r['sys_module_id'];
+ }
+
+ foreach( $modules as $module )
+ {
+ //-----------------------------------------
+ // Insert or update?
+ //-----------------------------------------
+
+ if ( $cur_modules[ $module['sys_module_application'] ][ $module['sys_module_key'] ] )
+ {
+ $this->DB->update( 'core_sys_module', $module, "sys_module_id=" . $cur_modules[ $module['sys_module_application'] ][ $module['sys_module_key'] ] );
+ $modulesUpdated++;
+ }
+ else
+ {
+ $this->DB->insert( 'core_sys_module', $module );
+ $modulesInserted++;
+ $module_id = $this->DB->getInsertId();
+ $extra_data['modules'][] = $module_id;
+ }
+ }
+
+ $classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir('core') . '/modules_admin/applications/applications.php', 'admin_core_applications_applications' );
+ $moduleLib = new $classToLoad();
+ $moduleLib->makeRegistryShortcuts( $this->registry );
+ $moduleLib->moduleRecache();
+ $moduleLib->applicationsMenuDataRecache();
+ }
+
+ //-----------------------------------------
+ // (4) Help Files
+ //-----------------------------------------
+
+ if( count($help) )
+ {
+ $keys = array();
+
+ $this->DB->build( array( 'select' => 'title', 'from' => 'faq' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $keys[] = $r['title'];
+ }
+
+ foreach( $help as $entry )
+ {
+ if( in_array( $entry['title'], $keys ) )
+ {
+ $this->DB->update( 'faq', $entry, "title='{$entry['title']}'" );
+ $helpUpdated++;
+ }
+ else
+ {
+ $this->DB->insert( 'faq', $entry );
+ $helpInserted++;
+ $help_id = $this->DB->getInsertId();
+ $extra_data['help'][] = $help_id;
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // (6) Templates
+ //-----------------------------------------
+
+ if( count($templates) )
+ {
+ $bits = array();
+
+ /* Root will always be updated */
+ $this->DB->build( array( 'select' => 'template_name,template_group', 'from' => 'skin_templates', 'where' => 'template_set_id=0 AND template_master_key=\'root\'' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $bits[ $r['template_group'] ][] = $r['template_name'];
+ }
+
+ foreach( $templates as $template )
+ {
+ if( is_array($bits[ $template['template_group'] ]) AND in_array( $template['template_name'], $bits[ $template['template_group'] ] ) )
+ {
+ $this->DB->update( 'skin_templates', $template, "template_group='{$template['template_group']}' AND template_name='{$template['template_name']}'" );
+ $templatesUpdated++;
+ }
+ else
+ {
+ $this->DB->insert( 'skin_templates', $template );
+ $templatesInserted++;
+ $template_id = $this->DB->getInsertId();
+ $extra_data['templates'][ $template['template_group'] ][] = $template['template_name'];
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // CSS
+ //-----------------------------------------
+
+ if( count( $css ) )
+ {
+ $bits = array();
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'skin_css', 'where' => 'css_set_id=0' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $bits[ $r['css_group'] ] = $r;
+ }
+
+ foreach( $css as $entry )
+ {
+ if( is_array( $bits[ $entry['css_group'] ] ) AND in_array( $entry['css_group'], $bits[ $entry['css_group'] ] ) )
+ {
+ $this->DB->update( 'skin_css', $entry, "css_group='{$entry['css_group']}'" );
+ $cssUpdated++;
+ }
+ else
+ {
+ $this->DB->insert( 'skin_css', $entry );
+ $cssInserted++;
+ $css_id = $this->DB->getInsertId();
+ $extra_data['css'][] = $css_id;
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // (7) Tasks
+ //-----------------------------------------
+
+ if( count($tasks) )
+ {
+ $keys = array();
+
+ $this->DB->build( array( 'select' => 'task_key', 'from' => 'task_manager' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $keys[] = $r['task_key'];
+ }
+
+ foreach( $tasks as $entry )
+ {
+ if( in_array( $entry['task_key'], $keys ) )
+ {
+ $this->DB->update( 'task_manager', $entry, "task_key='{$entry['task_key']}'" );
+ $tasksUpdated++;
+ }
+ else
+ {
+ $this->DB->insert( 'task_manager', $entry );
+ $tasksInserted++;
+ $task_id = $this->DB->getInsertId();
+ $extra_data['tasks'][] = $task_id;
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // (8) Create new tables
+ //-----------------------------------------
+
+ if( count($database['create']) )
+ {
+ foreach($database['create'] as $create )
+ {
+ $query = "CREATE TABLE {$create['name']} (
+ {$create['fields']}
+ )";
+
+ if( $create['tabletype'] )
+ {
+ $query .= " TYPE=" . $create['tabletype'];
+ }
+
+ //-----------------------------------------
+ // Fix prefix
+ //-----------------------------------------
+
+ $query = preg_replace( "#^CREATE TABLE(?:\s+?)?(\S+?)#s", "CREATE TABLE " . $this->settings['sql_tbl_prefix']."\\1", $query );
+
+ $this->DB->return_die = true;
+ $this->DB->query( $query );
+ $this->DB->return_die = false;
+ $createQueries++;
+
+ $extra_data['database']['create'][] = $create;
+ }
+ }
+
+ //-----------------------------------------
+ // (9) Alter tables
+ //-----------------------------------------
+
+ if( count($database['alter']) )
+ {
+ foreach( $database['alter'] as $alter )
+ {
+ $this->DB->return_die = true;
+
+ switch( $alter['altertype'] )
+ {
+ case 'remove':
+ $this->DB->dropField( $alter['table'], $alter['field'] );
+ break;
+
+ case 'add':
+ $this->DB->addField( $alter['table'], $alter['field'], $alter['fieldtype'], $alter['default'] );
+ break;
+
+ case 'change':
+ $this->DB->changeField( $alter['table'], $alter['field'], $alter['newfield'], $alter['fieldtype'], $alter['default'] );
+ break;
+ }
+
+ $this->DB->return_die = false;
+ $alterQueries++;
+ $extra_data['database']['alter'][] = $alter;
+ }
+ }
+
+ //-----------------------------------------
+ // (10) Run update queries
+ //-----------------------------------------
+
+ if( count($database['update']) )
+ {
+ foreach( $database['update'] as $update )
+ {
+ $this->DB->return_die = true;
+ $this->DB->update( $update['table'], array( $update['field'] => $update['newvalue'] ), html_entity_decode( $update['where'], ENT_QUOTES ) );
+ $this->DB->return_die = false;
+ $updateQueries++;
+ $extra_data['database']['update'][] = $update;
+ }
+ }
+
+ //-----------------------------------------
+ // (11) Run insert queries
+ //-----------------------------------------
+
+ // if( !$this->hooks[ $config['hook_key'] ]['hook_id'] )
+ // {
+ if( count($database['insert']) )
+ {
+ foreach( $database['insert'] as $insert )
+ {
+ $fields = array();
+ $content = explode( ',', $insert['updates'] );
+
+ foreach( $content as $value )
+ {
+ list( $field, $toInsert ) = explode( '=', $value );
+
+ $fields[ trim($field) ] = str_replace( '~C~', ',', $toInsert );
+ }
+
+ $this->DB->return_die = true;
+ $this->DB->insert( $insert['table'], $fields );
+ $this->DB->return_die = false;
+ $insertQueries++;
+ $extra_data['database']['insert'][] = $insert;
+ }
+ }
+ // }
+
+ if( $custom['filename'] AND file_exists( IPS_HOOKS_PATH . 'install_' . $custom['filename'] ) )
+ {
+ require_once( IPS_HOOKS_PATH . 'install_' . $custom['filename'] );
+
+ $classname = str_replace( '.php', '', $custom['filename'] );
+
+ if( class_exists( $classname ) )
+ {
+ $install = new $classname( $this->registry );
+
+ if( method_exists( $install, 'install' ) )
+ {
+ $install->install();
+ }
+ }
+
+ $extra_data['display']['custom'] = $custom['filename'];
+ }
+
+ if( count($extra_data) )
+ {
+ $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize( $extra_data ) ), 'hook_id=' . $hook_id );
+ }
+
+ //print_r($config);
+ //print_r($files);
+ //print_r($custom);
+ //print_r($settingGroups);
+ //print_r($settings);
+ //print_r($language);
+ //print_r($modules);
+ //print_r($templates);
+ //print_r($tasks);
+ //print_r($help);
+ //print_r($database);
+
+ if ( $addMessage )
+ {
+ $this->registry->output->global_message = <<lang->words['h_followacts']}
+
+ {$this->lang->words['h_newhookin']}
+ {$filesInserted} {$this->lang->words['h_filesin']}
+ {$settingGroupsInserted} {$this->lang->words['h_settinggin']}
+ {$settingsInserted} {$this->lang->words['h_settingin']}
+ {$settingsUpdated} {$this->lang->words['h_settingup']}
+ {$languageInserted} {$this->lang->words['h_langbitin']}
+ {$languageUpdated} {$this->lang->words['h_langbitup']}
+ {$modulesInserted} {$this->lang->words['h_modin']}
+ {$modulesUpdated} {$this->lang->words['h_modup']}
+ {$helpInserted} {$this->lang->words['h_helpin']}
+ {$helpUpdated} {$this->lang->words['h_helpup']}
+ {$templatesInserted} {$this->lang->words['h_tempin']}
+ {$templatesUpdated} {$this->lang->words['h_tempup']}
+ {$cssInserted} {$this->lang->words['h_cssin']}
+ {$cssUpdated} {$this->lang->words['h_cssup']}
+ {$tasksInserted} {$this->lang->words['h_taskin']}
+ {$tasksUpdated} {$this->lang->words['h_taskup']}
+ {$createQueries} {$this->lang->words['h_dbcreated']}
+ {$alterQueries} {$this->lang->words['h_dbaltered']}
+ {$updateQueries} {$this->lang->words['h_updateran']}
+ {$insertQueries} {$this->lang->words['h_insertran']}
+
+EOF;
+
+ //-----------------------------------------
+ // Got some skin recaching to do...
+ //-----------------------------------------
+
+ if( $allowSkinRecache === TRUE AND ( $templatesInserted OR $templatesUpdated OR $templateHooks ) )
+ {
+ //-----------------------------------------
+ // Recache hooks so templates know that there
+ // are comments to preserve
+ //-----------------------------------------
+
+ $this->rebuildHooksCache();
+
+ //-----------------------------------------
+ // Get the libs
+ //-----------------------------------------
+
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
+ $skinCaching = new skinCaching( $this->registry );
+
+ /* Flag all for recache */
+ $skinCaching->flagSetForRecache();
+ }
+ }
+ }
+
+ /**
+ * Show the form to export a hook
+ *
+ * @return void
+ */
+ private function _exportHook()
+ {
+ /* Get the hook */
+ $id = intval($this->request['id']);
+
+ if( !$id )
+ {
+ $this->registry->output->showError( $this->lang->words['h_noexport'], 1112 );
+ }
+
+ $hookData = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $id ) );
+
+ if( !$hookData['hook_id'] )
+ {
+ $this->registry->output->showError( $this->lang->words['h_noexport'], 1113 );
+ }
+
+ /* Set defaults */
+ $hookData['hook_extra_data'] = unserialize( $hookData['hook_extra_data'] );
+
+ /* Output */
+ $this->registry->output->html .= $this->html->hooksExport( $hookData );
+ }
+
+ /**
+ * Actually export the damn hook already
+ * Sorry, it has been a long day...
+ *
+ * @return void
+ */
+ private function _doExportHook()
+ {
+ //-----------------------------------------
+ // Get hook
+ //-----------------------------------------
+
+ $id = intval($this->request['id']);
+
+ if( !$id )
+ {
+ $this->registry->output->showError( $this->lang->words['h_noexport'], 1114 );
+ }
+
+ $hookData = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $id ) );
+
+ if( !$hookData['hook_id'] )
+ {
+ $this->registry->output->showError( $this->lang->words['h_noexport'], 1115 );
+ }
+
+ $extra_data = unserialize( $hookData['hook_extra_data'] );
+
+ //-----------------------------------------
+ // Get hook files
+ //-----------------------------------------
+
+ $files = array();
+ $index = 1;
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_hooks_files', 'where' => 'hook_hook_id=' . $id ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $files[ $index ] = $r;
+ $index++;
+ }
+
+ //-----------------------------------------
+ // Get XML class
+ //-----------------------------------------
+
+ require_once( IPS_KERNEL_PATH.'classXML.php' );
+
+ $xml = new classXML( IPS_DOC_CHAR_SET );
+
+ $xml->newXMLDocument();
+ $xml->addElement( 'hookexport' );
+
+ //-----------------------------------------
+ // Put hook data in export
+ //-----------------------------------------
+
+ $xml->addElement( 'hookdata', 'hookexport' );
+ $content = array();
+
+ foreach( $hookData as $k => $v )
+ {
+ if( in_array( $k, array( 'hook_id', 'hook_enabled', 'hook_installed', 'hook_updated', 'hook_position' ) ) )
+ {
+ continue;
+ }
+
+ $content[ $k ] = $v;
+ }
+
+ $xml->addElementAsRecord( 'hookdata', 'config', $content );
+
+ //-----------------------------------------
+ // Put hook files in export
+ //-----------------------------------------
+
+ $xml->addElement( 'hookfiles', 'hookexport' );
+
+ foreach( $files as $index => $r )
+ {
+ $content = array();
+
+ foreach( $r as $k => $v )
+ {
+ if( in_array( $k, array( 'hook_file_id', 'hook_hook_id', 'hook_file_stored', 'hooks_source' ) ) )
+ {
+ continue;
+ }
+
+ $content[ $k ] = $v;
+ }
+
+ $source = file_exists( IPS_HOOKS_PATH . $r['hook_file_stored'] ) ? file_get_contents( IPS_HOOKS_PATH . $r['hook_file_stored'] ) : '';
+
+ if( $r['hook_type'] == 'commandHooks' || $r['hook_type'] == 'libraryHooks' )
+ {
+ $source = $this->_cleanSource( $source );
+ }
+
+ $content['hooks_source'] = $source;
+
+ $xml->addElementAsRecord( 'hookfiles', 'file', $content );
+ }
+
+ //-----------------------------------------
+ // Custom install/uninstall script?
+ //-----------------------------------------
+
+ if( $extra_data['custom'] )
+ {
+ $content = array();
+ $xml->addElement( 'hookextras_custom', 'hookexport' );
+
+ $content['filename'] = $extra_data['custom'];
+ $content['source'] = file_exists( IPS_HOOKS_PATH . 'install_' . $extra_data['custom'] ) ? file_get_contents( IPS_HOOKS_PATH . 'install_' . $extra_data['custom'] ) : '';
+
+ $xml->addElementAsRecord( 'hookextras_custom', 'file', $content );
+ }
+
+ //-----------------------------------------
+ // Settings or setting groups?
+ //-----------------------------------------
+
+ $entry = array();
+ $_groups = array();
+ $_settings = array();
+ $titles = array();
+ $content = array();
+
+ $xml->addElement( 'hookextras_settings', 'hookexport' );
+
+ # Store group ids and setting ids for entire setting groups
+ if( is_array($extra_data['settingGroups']) AND count($extra_data['settingGroups']) )
+ {
+ $_groups = $extra_data['settingGroups'];
+
+ $this->DB->build( array( 'select' => 'conf_id', 'from' => 'core_sys_conf_settings', 'where' => 'conf_group IN(' . implode( ',', $_groups ) . ')' ) );
+ $this->DB->execute();
+
+ while( $setting = $this->DB->fetch() )
+ {
+ $_settings[] = $setting['conf_id'];
+ }
+ }
+
+ # Store group ids and setting ids for indvidual settings
+ if( is_array($extra_data['settings']) AND count($extra_data['settings']) )
+ {
+ foreach( $extra_data['settings'] as $settingId )
+ {
+ $_settings[] = $settingId;
+ }
+
+ $this->DB->build( array( 'select' => 'conf_group', 'from' => 'core_sys_conf_settings', 'where' => 'conf_id IN(' . implode( ',', $extra_data['settings'] ) . ')' ) );
+ $this->DB->execute();
+
+ while( $group = $this->DB->fetch() )
+ {
+ $_groups[] = $group['conf_group'];
+ }
+ }
+
+ if( count($_groups) )
+ {
+ # Now get the group data for the XML file
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_settings_titles', 'where' => 'conf_title_id IN(' . implode( ',', $_groups ) . ')' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $content = array();
+
+ $titles[ $r['conf_title_id'] ] = $r['conf_title_keyword'];
+
+ $content['conf_is_title'] = 1;
+
+ foreach( $r as $k => $v )
+ {
+ if( in_array( $k, array( 'conf_title_tab', 'conf_title_keyword', 'conf_title_title', 'conf_title_desc', 'conf_title_app', 'conf_title_noshow' ) ) )
+ {
+ $content[ $k ] = $v;
+ }
+ }
+
+ $xml->addElementAsRecord( 'hookextras_settings', 'setting', $content );
+ }
+ }
+
+ if( count($_settings) )
+ {
+ # Now get the group data for the XML file
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => 'conf_id IN(' . implode( ',', $_settings ) . ')' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $r['conf_value'] = '';
+ $r['conf_title_keyword'] = $titles[ $r['conf_group'] ];
+ $r['conf_is_title'] = 0;
+
+ $xml->addElementAsRecord( 'hookextras_settings', 'setting', $r );
+ }
+ }
+
+ //-----------------------------------------
+ // Language strings/files
+ //-----------------------------------------
+
+ $entry = array();
+
+ $xml->addElement( 'hookextras_language', 'hookexport' );
+
+ if( is_array($extra_data['language']) AND count($extra_data['language']) )
+ {
+ foreach( $extra_data['language'] as $file => $strings )
+ {
+ $bits = explode( '_', $file );
+ $app = $bits[0];
+ $pack = str_replace( $app.'_', '', $file );
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_lang_words', 'where' => "word_app='{$app}' AND word_pack='{$pack}' AND word_key IN('" . implode( "','", $strings ) . "')" ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $content = array();
+
+ foreach( $r as $k => $v )
+ {
+ if( in_array( $k, array( 'word_id', 'lang_id', 'word_default_version', 'word_custom_version' ) ) )
+ {
+ continue;
+ }
+
+ $content[ $k ] = $v;
+ }
+
+ $xml->addElementAsRecord( 'hookextras_language', 'language', $content );
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Modules
+ //-----------------------------------------
+
+ $xml->addElement( 'hookextras_modules', 'hookexport' );
+
+ if( is_array($extra_data['modules']) AND count($extra_data['modules']) )
+ {
+ foreach ( $extra_data['modules'] as $module )
+ {
+ list( $_side, $_app, $_module ) = explode( '-', $module );
+ $_is_admin = ( $_side == 'admin' ) ? 1 : 0;
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_module', 'where' => "sys_module_application='{$_app}' AND sys_module_key='{$_module}' AND sys_module_admin={$_is_admin}" ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ unset($r['sys_module_id']);
+
+ $xml->addElementAsRecord( 'hookextras_modules', 'module', $r );
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Help files
+ //-----------------------------------------
+
+ $xml->addElement( 'hookextras_help', 'hookexport' );
+
+ if( is_array($extra_data['help']) AND count($extra_data['help']) )
+ {
+ $this->DB->build( array( 'select' => '*', 'from' => 'faq', 'where' => "id IN(" . implode( ",", $extra_data['help'] ) . ")" ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ unset($r['id']);
+
+ $xml->addElementAsRecord( 'hookextras_help', 'help', $r );
+ }
+ }
+
+ //-----------------------------------------
+ // Skin templates
+ //-----------------------------------------
+
+ $xml->addElement( 'hookextras_templates', 'hookexport' );
+
+ if( is_array($extra_data['templates']) AND count($extra_data['templates']) )
+ {
+ $templateSetIds = $this->registry->output->buildRemapData( true );
+
+ foreach( $extra_data['templates'] as $file => $templates )
+ {
+ $this->DB->build( array( 'select' => '*', 'from' => 'skin_templates', 'where' => "template_set_id IN ('".implode( "','", $templateSetIds['export']) ."') AND template_group='{$file}' AND template_name IN('" . implode( "','", $templates ) . "')" ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ unset($r['template_id']);
+ $r['template_set_type'] = $templateSetIds['templates'][$r['template_set_id']];
+
+ $xml->addElementAsRecord( 'hookextras_templates', 'templates', $r );
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // CSS
+ //-----------------------------------------
+
+ $xml->addElement( 'hookextras_css', 'hookexport' );
+
+ if( is_array( $extra_data['css'] ) AND count ( $extra_data['css'] ) )
+ {
+ $this->DB->build( array( 'select' => '*', 'from' => 'skin_css', 'where' => "css_id IN(" . implode( ",", $extra_data['css'] ) . ")" ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ unset($r['css_id']);
+ unset($r['css_set_id']);
+
+ $xml->addElementAsRecord( 'hookextras_css', 'css', $r );
+ }
+ }
+
+ //-----------------------------------------
+ // Tasks
+ //-----------------------------------------
+
+ $xml->addElement( 'hookextras_tasks', 'hookexport' );
+
+ if( is_array($extra_data['tasks']) AND count($extra_data['tasks']) )
+ {
+ $this->DB->build( array( 'select' => '*', 'from' => 'task_manager', 'where' => "task_id IN(" . implode( ",", $extra_data['tasks'] ) . ")" ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ unset($r['task_id']);
+ unset($r['task_next_run']);
+
+ $xml->addElementAsRecord( 'hookextras_tasks', 'tasks', $r );
+ }
+ }
+
+ //-----------------------------------------
+ // Database changes
+ //-----------------------------------------
+
+ $xml->addElement( 'hookextras_database_create', 'hookexport' );
+
+ if( is_array($extra_data['database']['create']) AND count($extra_data['database']['create']) )
+ {
+ foreach( $extra_data['database']['create'] as $create_query )
+ {
+ $xml->addElementAsRecord( 'hookextras_database_create', 'create', $create_query );
+ }
+ }
+
+ $xml->addElement( 'hookextras_database_alter', 'hookexport' );
+
+ if( is_array($extra_data['database']['alter']) AND count($extra_data['database']['alter']) )
+ {
+ foreach( $extra_data['database']['alter'] as $alter_query )
+ {
+ $xml->addElementAsRecord( 'hookextras_database_alter', 'alter', $alter_query );
+ }
+ }
+
+ $xml->addElement( 'hookextras_database_update', 'hookexport' );
+
+ if( is_array($extra_data['database']['update']) AND count($extra_data['database']['update']) )
+ {
+ foreach( $extra_data['database']['update'] as $update_query )
+ {
+ $xml->addElementAsRecord( 'hookextras_database_update', 'update', $update_query );
+ }
+ }
+
+ $xml->addElement( 'hookextras_database_insert', 'hookexport' );
+
+ if( is_array($extra_data['database']['insert']) AND count($extra_data['database']['insert']) )
+ {
+ foreach( $extra_data['database']['insert'] as $insert_query )
+ {
+ $xml->addElementAsRecord( 'hookextras_database_insert', 'insert', $insert_query );
+ }
+ }
+
+ //-----------------------------------------
+ // Print to browser
+ //-----------------------------------------
+
+ $this->registry->output->showDownload( $xml->fetchDocument(), 'hook.xml', '', 0 );
+ }
+
+ /**
+ * Clean source code for export..
+ *
+ * @param string Hook source code
+ * @return string "Cleaned" source code
+ */
+ private function _cleanSource( $source )
+ {
+ $source = preg_replace( "/class\s+(\S+)\s+extends\s+(\S+)/i", "class \\1 extends (~extends~)", $source );
+
+ return $source;
+ }
+
+ /**
+ * Fix hook positions
+ *
+ * @return void
+ */
+ private function _fixPositions()
+ {
+ $new_order = 0;
+ $usedActions = array();
+
+ $this->DB->build( array( 'select' => 'hook_id, hook_position', 'from' => 'core_hooks', 'where' => 'hook_enabled=1', 'order' => 'hook_position ASC' ) );
+ $qid = $this->DB->execute();
+
+ while ( $hook = $this->DB->fetch( $qid ) )
+ {
+ $new_order++;
+ $this->DB->update( 'core_hooks', array ( 'hook_position' => $new_order ), "hook_id={$hook['hook_id']}" );
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_hooks_files', 'where' => "(hook_type='commandHooks' OR hook_type='skinHooks' OR hook_type='libraryHooks') AND hook_hook_id=" . $hook['hook_id'] ) );
+ $this->DB->execute();
+
+ while( $file = $this->DB->fetch() )
+ {
+ if( $file['hooks_source'] )
+ {
+ $source = $this->_cleanSource( $file['hooks_source'] );
+ }
+ else
+ {
+ $source = file_exists( IPS_HOOKS_PATH . $file['hook_file_stored'] ) ? file_get_contents( IPS_HOOKS_PATH . $file['hook_file_stored'] ) : '';
+
+ if( $source )
+ {
+ $source = $this->_cleanSource( $source );
+ }
+ }
+
+ if( $source )
+ {
+ $hook_data = unserialize( $file['hook_data'] );
+ $overload = $hook_data['classToOverload'];
+ $newClass = $overload;
+
+ if( isset( $usedActions[ $overload ] ) )
+ {
+ $newClass = $usedActions[ $overload ];
+ }
+ else if( $file['hook_type'] == 'skinHooks' )
+ {
+ $newClass .= "(~id~)";
+ }
+
+ $source = str_replace( "(~extends~)", $newClass, $source );
+
+ file_put_contents( IPS_HOOKS_PATH . $file['hook_file_stored'], $source );
+
+ $usedActions[ $hook_data['classToOverload'] ] = $file['hook_classname'];
+ }
+ }
+ }
+ }
+
+ /**
+ * Check if there is an update for a hook
+ *
+ * @param string URL to check
+ * @param string Long version number
+ * @return bool
+ */
+ private function _updateAvailable( $url, $version )
+ {
+ if( !$version )
+ {
+ //return false;
+ }
+
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . '/classFileManagement.php', 'classFileManagement' );
+ $checker = new $classToLoad();
+ $checker->use_sockets = $this->settings['enable_sockets'];
+
+ //-----------------------------------------
+ // This is a low timeout to prevent page from taking too long
+ //-----------------------------------------
+
+ $checker->timeout = 5;
+
+ $return = $checker->getFileContents( str_replace( 'php&', 'php?', $url . '&version=' . $version ) );
+
+ return $return == 1 ? true : false;
+ }
+
+ /**
+ * Hooks overview
+ *
+ * @return void [Outputs to screen]
+ * @todo [Future] Explore showing details/version requirements in a DHTML popup rather than a new page
+ */
+ private function _hooksOverview()
+ {
+ /* INI */
+ $installedHooks = array();
+ $uninstalledHooks = array();
+ $min_order = 999999;
+ $max_order = 0;
+ $checkUpdates = ( isset( $this->request['checkUpdates'] ) AND $this->request['checkUpdates'] ) ? true : false;
+
+ /* Get current hooks */
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_hooks', 'order' => 'hook_position ASC' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $r['_updated'] = $this->registry->getClass('class_localization')->formatTime( $r['hook_updated'] );
+ $r['_installed'] = $this->registry->getClass('class_localization')->formatTime( $r['hook_installed'] );
+
+ $r['hook_update_available'] = '';
+
+ if( $r['hook_update_check'] && $checkUpdates === true )
+ {
+ if( $this->_updateAvailable( $r['hook_update_check'], $r['hook_version_long'] ) )
+ {
+ $r['hook_update_available'] = "Update Available ";
+
+ if( $r['hook_website'] )
+ {
+ $r['hook_update_available'] = "" . $r['hook_update_available'] . ' ';
+ }
+ }
+ }
+
+ $min_order = $r['hook_position'] < $min_order ? $r['hook_position'] : $min_order;
+ $max_order = $r['hook_position'] > $max_order ? $r['hook_position'] : $max_order;
+
+ if( $r['hook_enabled'] )
+ {
+ $installedHooks[ $r['hook_id'] ] = $r;
+ }
+ else
+ {
+ $uninstalledHooks[ $r['hook_id'] ] = $r;
+ }
+ }
+
+ if( count($installedHooks) )
+ {
+ foreach( $installedHooks as $id => $r )
+ {
+ $upButton = $r['hook_position'] > $min_order ? 1 : 0;
+ $downButton = $r['hook_position'] < $max_order ? 1 : 0;
+
+ $installedHooks[ $id ]['upButton'] = $upButton;
+ $installedHooks[ $id ]['downButton'] = $downButton;
+ }
+ }
+
+ /* Output */
+ $this->registry->output->html .= $this->html->hooksOverview( $installedHooks, $uninstalledHooks );
+ }
+
+ /**
+ * Disables all hook
+ *
+ * @return void [Outputs to screen]
+ */
+ private function _disableAllHooks()
+ {
+ /* INIT */
+ $activeHookIds = array();
+
+ /* Query Enabled Hooks */
+ $this->DB->build( array( 'select' => 'hook_id', 'from' => 'core_hooks', 'where' => "hook_enabled=1" ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $activeHookIds[] = $r['hook_id'];
+ }
+
+ /* Make sure there were active hooks */
+ if( ! count( $activeHookIds ) )
+ {
+ $this->registry->output->global_message = $this->lang->words['hook_disable_all_none'];;
+ $this->_hooksOverview();
+ return;
+ }
+
+ /* Disable hooks */
+ $this->DB->update( 'core_hooks', array( 'hook_enabled' => 0 ), 'hook_id IN( ' . implode( ',', $activeHookIds ) . ' ) ' );
+
+ /* Save to cache */
+ $this->cache->setCache( 'disabledHooksCache', $activeHookIds, array( 'array' => 1 ) );
+
+ /* Rebuild cache */
+ $this->rebuildHooksCache();
+
+ /* All Done */
+ $this->registry->output->global_message = $this->lang->words['hook_disabled_all'];
+ $this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . $this->form_code . '&do=hooks_overview' );
+ }
+
+ private function _reenableAllHooks()
+ {
+ /* INIT */
+ $activeHookIds = $this->cache->getCache( 'disabledHooksCache' );
+
+ /* Make sure there were active hooks */
+ if( ! count( $activeHookIds ) )
+ {
+ $this->registry->output->global_message = $this->lang->words['hook_disable_all_none'];
+ $this->_hooksOverview();
+ return;
+ }
+
+ /* Disable hooks */
+ $this->DB->update( 'core_hooks', array( 'hook_enabled' => 1 ), 'hook_id IN( ' . implode( ',', $activeHookIds ) . ' ) ' );
+
+ /* Save to cache */
+ $this->cache->setCache( 'disabledHooksCache', array(), array( 'array' => 1 ) );
+
+ /* Rebuild cache */
+ $this->rebuildHooksCache();
+
+ /* Flag skins for recache */
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
+ $skinCaching = new skinCaching( $this->registry );
+
+ /* Flag all for recache */
+ $skinCaching->flagSetForRecache();
+
+ /* All Done */
+ $this->registry->output->global_message = $this->lang->words['hook_reenable_all'];
+ $this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . $this->form_code . '&do=hooks_overview' );
+ }
+
+ /**
+ * Disables a hook
+ *
+ * @return void [Outputs to screen]
+ */
+ private function _disableHook()
+ {
+ /* INI */
+ $hook_id = intval( $this->request['id'] );
+
+ /* Do update */
+ $this->DB->update( 'core_hooks', array( 'hook_enabled' => 0 ), "hook_id={$hook_id}" );
+
+ $this->rebuildHooksCache();
+
+ /* Flag skins for recache */
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
+ $skinCaching = new skinCaching( $this->registry );
+
+ /* Flag all for recache */
+ $skinCaching->flagSetForRecache();
+
+ /* Done */
+ $this->registry->output->global_message = $this->lang->words['hook_disabled'];
+ $this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . $this->form_code . '&do=hooks_overview' );
+ }
+
+ /**
+ * Enables a hook
+ *
+ * @return void [Outputs to screen]
+ */
+ private function _enableHook()
+ {
+ /* INI */
+ $hook_id = intval( $this->request['id'] );
+
+ /* Do update */
+ $this->DB->update( 'core_hooks', array( 'hook_enabled' => 1 ), "hook_id={$hook_id}" );
+
+ $this->rebuildHooksCache();
+
+ /* Flag skins for recache */
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
+ $skinCaching = new skinCaching( $this->registry );
+
+ /* Flag all for recache */
+ $skinCaching->flagSetForRecache();
+
+ /* Done */
+ $this->registry->output->global_message = $this->lang->words['h_hasbeenenabled'];
+ $this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . $this->form_code . '&do=hooks_overview' );
+ }
+
+ /**
+ * Uninstall a hook
+ *
+ * @return void [Outputs to screen]
+ */
+ private function _uninstallHook()
+ {
+ /* INI */
+ $hook_id = intval( $this->request['id'] );
+
+ $hook = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $hook_id ) );
+ $extra_data = unserialize( $hook['hook_extra_data'] );
+
+ if ( ! $hook['hook_id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['h_hasbeenun'];
+ $this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . $this->form_code . '&do=hooks_overview' );
+ }
+
+ /* Get associated files */
+ $this->DB->build( array( 'select' => 'hook_file_stored', 'from' => 'core_hooks_files', 'where' => 'hook_hook_id=' . $hook_id ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ @unlink( IPS_HOOKS_PATH . $r['hook_file_stored'] );
+ }
+
+ /* Delete hook file entries */
+ $this->DB->delete( 'core_hooks_files', "hook_hook_id={$hook_id}" );
+
+ //-----------------------------------------
+ // Settings or setting groups?
+ //-----------------------------------------
+
+ if( count($extra_data['settingGroups']) )
+ {
+ $this->DB->delete( 'core_sys_settings_titles', 'conf_title_id IN(' . implode( ',', $extra_data['settingGroups'] ) . ')' );
+ }
+
+ if( count($extra_data['settings']) )
+ {
+ $this->DB->delete( 'core_sys_conf_settings', 'conf_id IN(' . implode( ',', $extra_data['settings'] ) . ')' );
+ }
+
+ $this->cache->rebuildCache( 'settings', 'global' );
+
+ //-----------------------------------------
+ // Language strings/files
+ //-----------------------------------------
+
+ if( count($extra_data['language']) )
+ {
+ foreach( $extra_data['language'] as $file => $bit )
+ {
+ $this->DB->delete( 'core_sys_lang_words', "word_pack='{$file}' AND word_key IN('" . implode( "','", $bit ) . "')" );
+ }
+
+ $langPacks = array();
+
+ $this->DB->build( array( 'select' => 'lang_id', 'from' => 'core_sys_lang' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $langPacks[] = $r['lang_id'];
+ }
+
+ $classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir('core') . '/modules_admin/languages/manage_languages.php', 'admin_core_languages_manage_languages' );
+ $langLib = new $classToLoad();
+ $langLib->makeRegistryShortcuts( $this->registry );
+
+ foreach( $langPacks as $langId )
+ {
+ $langLib->cacheToDisk( $langId );
+ }
+ }
+
+ //-----------------------------------------
+ // Modules
+ //-----------------------------------------
+
+ if( count($extra_data['modules']) )
+ {
+ $this->DB->delete( 'core_sys_module', "sys_module_id IN('" . implode( "','", $extra_data['modules'] ) . "')" );
+
+ $this->cache->rebuildCache( 'module_cache', 'global' );
+ $this->cache->rebuildCache( 'app_menu_cache', 'global' );
+ }
+
+ //-----------------------------------------
+ // Help files
+ //-----------------------------------------
+
+ if( count($extra_data['help']) )
+ {
+ $this->DB->delete( 'faq', 'id IN(' . implode( ',', $extra_data['help'] ) . ')' );
+ }
+
+ //-----------------------------------------
+ // Skin templates
+ //-----------------------------------------
+
+ if( count($extra_data['templates']) )
+ {
+ foreach( $extra_data['templates'] as $file => $bit )
+ {
+ $this->DB->delete( 'skin_templates', "template_group='{$file}' AND template_name IN('" . implode( "','", $bit ) . "')" );
+ }
+
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
+ $skinCaching = new skinCaching( $this->registry );
+ $skinCaching->rebuildPHPTemplates( 0 );
+ }
+
+ //-----------------------------------------
+ // CSS
+ //-----------------------------------------
+
+ if( count( $extra_data['css'] ) )
+ {
+ $this->DB->delete( 'skin_css', 'css_id IN(' . implode( ',', $extra_data['css'] ) . ')' );
+
+ if( ! $skinCaching )
+ {
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
+ $skinCaching = new skinCaching( $this->registry );
+ }
+
+ $skinCaching->rebuildCSSCache( 0 );
+ }
+
+ //-----------------------------------------
+ // Tasks
+ //-----------------------------------------
+
+ if( count($extra_data['tasks']) )
+ {
+ $this->DB->delete( 'task_manager', 'task_id IN(' . implode( ',', $extra_data['tasks'] ) . ')' );
+ }
+
+ //-----------------------------------------
+ // Database changes
+ //-----------------------------------------
+
+ if( is_array($extra_data['database']['create']) AND count($extra_data['database']['create']) )
+ {
+ foreach( $extra_data['database']['create'] as $create_query )
+ {
+ $this->DB->return_die = true;
+ $this->DB->dropTable( $create_query['name'] );
+ $this->DB->return_die = false;
+ }
+ }
+
+ if( is_array($extra_data['database']['alter']) AND count($extra_data['database']['alter']) )
+ {
+ foreach( $extra_data['database']['alter'] as $alter_query )
+ {
+ $this->DB->return_die = true;
+
+ if( $alter_query['altertype'] == 'add' )
+ {
+ if( $this->DB->checkForField( $alter_query['field'], $alter_query['table'] ) )
+ {
+ $this->DB->dropField( $alter_query['table'], $alter_query['field'] );
+ }
+ }
+ else if( $alter_query['altertype'] == 'change' )
+ {
+ if( $this->DB->checkForField( $alter_query['newfield'], $alter_query['table'] ) )
+ {
+ $this->DB->changeField( $alter_query['table'] , $alter_query['newfield'], $alter_query['field'], $alter_query['fieldtype'], $alter_query['default'] );
+ }
+ }
+
+ $this->DB->return_die = false;
+ }
+ }
+
+ if( is_array($extra_data['database']['update']) AND count($extra_data['database']['update']) )
+ {
+ foreach( $extra_data['database']['update'] as $update_query )
+ {
+ $this->DB->return_die = true;
+ $this->DB->update( $update_query['table'], array( $update_query['field'] => $update_query['oldvalue'] ), $update_query['where'] );
+ $this->DB->return_die = false;
+ }
+ }
+
+ if( is_array($extra_data['database']['insert']) AND count($extra_data['database']['insert']) )
+ {
+ foreach( $extra_data['database']['insert'] as $insert_query )
+ {
+ if( $insert_query['fordelete'] )
+ {
+ $this->DB->return_die = true;
+ $this->DB->delete( $insert_query['table'], $insert_query['fordelete'] );
+ $this->DB->return_die = false;
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Custom install/uninstall script?
+ //-----------------------------------------
+
+ if( $extra_data['display']['custom'] )
+ {
+ if( file_exists( IPS_HOOKS_PATH . 'install_' . $extra_data['display']['custom'] ) )
+ {
+ require_once( IPS_HOOKS_PATH . 'install_' . $extra_data['display']['custom'] );
+
+ $classname = str_replace( '.php', '', $extra_data['display']['custom'] );
+
+ if( class_exists( $classname ) )
+ {
+ $uninstall = new $classname( $this->registry );
+
+ if( method_exists( $uninstall, 'uninstall' ) )
+ {
+ $uninstall->uninstall();
+ }
+ }
+ }
+ }
+
+ /* Delete main hook entry */
+ $this->DB->delete( 'core_hooks', "hook_id={$hook_id}" );
+
+ $this->rebuildHooksCache();
+
+ /* Done */
+ $this->registry->output->global_message = $this->lang->words['h_hasbeenun'];
+ $this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . $this->form_code . '&do=hooks_overview' );
+ }
+
+ /**
+ * Hook add/edit form
+ * This dynamic form allows users to associate multiple files with a single hook.
+ *
+ * @param string [add|edit]
+ * @return void [Outputs to screen]
+ */
+ private function _hookForm( $type='add' )
+ {
+ if( $type == 'edit' )
+ {
+ $id = intval($this->request['id']);
+
+ if( !$id )
+ {
+ $this->registry->output->showError( $this->lang->words['h_noedit'], 1116 );
+ }
+
+ $hookData = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $id ) );
+
+ if( !$hookData['hook_id'] )
+ {
+ $this->registry->output->showError( $this->lang->words['h_noedit'], 1117 );
+ }
+
+ $hookData['hook_extra_data'] = unserialize( $hookData['hook_extra_data'] );
+ $hookData['hook_requirements'] = unserialize( $hookData['hook_requirements'] );
+
+ $files = array();
+ $index = 1;
+ $skinGroups = $this->hooksFunctions->getSkinGroups();
+ $entryPoint = array();
+
+ $entryPoint['foreach'] = array(
+ array( 'outer.pre', $this->lang->words['h_outerpre'] ),
+ array( 'inner.pre', $this->lang->words['h_innerpre'] ),
+ array( 'inner.post', $this->lang->words['h_innerpost'] ),
+ array( 'outer.post', $this->lang->words['h_outerpost'] ),
+ );
+
+ $entryPoint['if'] = array(
+ array( 'pre.startif', $this->lang->words['h_prestartif'] ),
+ array( 'post.startif', $this->lang->words['h_poststartif'] ),
+ array( 'pre.else', $this->lang->words['h_preelse']),
+ array( 'post.else', $this->lang->words['h_postelse'] ),
+ array( 'pre.endif', $this->lang->words['h_preendif'] ),
+ array( 'post.endif', $this->lang->words['h_postendif'] ),
+ );
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_hooks_files', 'where' => 'hook_hook_id=' . $id ) );
+ $outer = $this->DB->execute();
+
+ /* Get them outside the while cycle to prevent warnings */
+ $_dataHooks = IPSLib::getDataHookLocations();
+
+ while( $r = $this->DB->fetch($outer) )
+ {
+ $r['hook_data'] = unserialize( $r['hook_data'] );
+
+ if( $r['hook_type'] == 'templateHooks' )
+ {
+ $templates = $this->hooksFunctions->getSkinMethods( $r['hook_data']['skinGroup'] );
+ $hookIds = $this->hooksFunctions->getHookIds( $r['hook_data']['skinFunction'], $r['hook_data']['type'] );
+
+ $r['_skinDropdown'] = $this->registry->output->formDropdown( "skinGroup[{$index}]", $skinGroups, $r['hook_data']['skinGroup'], "skinGroup[{$index}]", "onchange='getTemplatesForAdd({$index});'" );
+ $r['_templateDropdown'] = $this->registry->output->formDropdown( "skinFunction[{$index}]", $templates, $r['hook_data']['skinFunction'], "skinFunction[{$index}]", "onchange='getTypeOfHook({$index});'" );
+ $r['_hookTypeDropdown'] = $this->registry->output->formDropdown( "type[{$index}]", array( array( 'foreach', 'foreach loop' ), array( 'if', 'if statement' ) ), $r['hook_data']['type'], "type[{$index}]", "onchange='getHookIds({$index});'" );
+ $r['_hookIdsDropdown'] = $this->registry->output->formDropdown( "id[{$index}]", $hookIds, $r['hook_data']['id'], "id[{$index}]", "onchange='getHookEntryPoints({$index});'" );
+ $r['_hookEPDropdown'] = $this->registry->output->formDropdown( "position[{$index}]", $r['hook_data']['type'] == 'foreach' ? $entryPoint['foreach'] : $entryPoint['if'], $r['hook_data']['position'] );
+ }
+
+ if( $r['hook_type'] == 'dataHooks' )
+ {
+ $r['_dataLocationDropdown'] = $this->registry->output->formDropdown( "dataLocation[{$index}]", $_dataHooks, $r['hook_data']['dataLocation'] );
+ }
+
+ $files[ $index ] = $r;
+ $index++;
+ }
+
+ $action = 'do_edit_hook';
+ }
+ else
+ {
+ $hookData = array();
+
+ foreach( array( 'hook_enabled', 'hook_name', 'hook_desc', 'hook_author', 'hook_email', 'hook_website', 'hook_update_check', 'hook_requirements', 'hook_version_human', 'hook_version_long', 'hook_installed', 'hook_updated', 'hook_position', 'hook_extra_data' ) as $_hook )
+ {
+ $hookData[ $_hook ] = $this->request[ $_hook ];
+ }
+
+ foreach( array( 'hook_ipb_version_max', 'hook_ipb_version_min', 'hook_php_version_min', 'hook_php_version_max' ) as $_version )
+ {
+ $hookData['hook_requirements'][ $_version ] = $this->request[ $_version ];
+ }
+
+ $files = array();
+ $action = 'do_create_hook';
+ }
+
+ /* Output */
+ $this->registry->output->html .= $this->html->hookForm( $action, $hookData, $files );
+ }
+
+ /**
+ * Hook add/edit save
+ * Save the new (or updated) hook record
+ *
+ * @param string [add|edit]
+ * @return void [Outputs to screen]
+ */
+ private function _hookSave( $type='add' )
+ {
+ /* Error Checking */
+ if( ! $this->request['hook_name'] )
+ {
+ $errors[] = $this->lang->words['hook_form_no_title'];
+ }
+
+ if( ! $this->request['hook_key'] )
+ {
+ $errors[] = $this->lang->words['hook_form_no_key'];
+ }
+
+ $newFiles = array();
+
+ $_hookFiles = array();
+
+ if( !IN_DEV )
+ {
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_hooks_files', 'where' => 'hook_hook_id=' . intval($this->request['hook_id']) ) );
+ $this->DB->execute();
+
+ while( $_r = $this->DB->fetch() )
+ {
+ $_hookFiles[ $_r['hook_classname'] ] = $_r['hook_file_stored'];
+ }
+ }
+
+ if( is_array( $this->request['file'] ) AND count( $this->request['file'] ) )
+ {
+ foreach( $this->request['file'] as $index => $file )
+ {
+ if( $file )
+ {
+ $newFiles[ $index ] = array(
+ 'hook_file_real' => $file,
+ //'hook_file_stored' => $file,
+ 'hook_type' => $this->request['hook_type'][ $index ],
+ 'hook_classname' => $this->request['hook_classname'][ $index ],
+ 'hook_data' => serialize(
+ array(
+ 'dataLocation' => trim( $this->request['dataLocation'][ $index ] ),
+ 'libApplication' => trim( $this->request['libApplication'][ $index ] ),
+ 'classToOverload' => trim($this->request['classToOverload'][ $index ]),
+ 'skinGroup' => $this->request['skinGroup'][ $index ],
+ 'skinFunction' => $this->request['skinFunction'][ $index ],
+ 'type' => $this->request['type'][ $index ],
+ 'id' => $this->request['id'][ $index ],
+ 'position' => $this->request['position'][ $index ],
+ )
+ )
+ );
+
+ /**
+ * @link http://community.invisionpower.com/tracker/issue-22084-hook-edit-does-not-preserve-correct-name/
+ * We don't want to reset the stored name if you are not in developer mode
+ */
+ if( IN_DEV )
+ {
+ $newFiles[ $index ]['hook_file_stored'] = $file; // During import this is a random name, but for devs it's actual file
+ }
+ else
+ {
+ $newFiles[ $index ]['hook_file_stored'] = $_hookFiles[ $this->request['hook_classname'][ $index ] ] ? $_hookFiles[ $this->request['hook_classname'][ $index ] ] : $file;
+ }
+ }
+ }
+ }
+
+ //if( !is_array( $newFiles ) OR !count( $newFiles ) )
+ //{
+ // $errors[] = $this->lang->words['h_onefile'];
+ //}
+
+ if( is_array( $errors ) )
+ {
+ $this->registry->output->global_message = implode( ' ', $errors );
+ $this->_hookForm();
+ return;
+ }
+
+ /* Get data if we are editing */
+ if( $type == 'edit' )
+ {
+ $id = intval($this->request['hook_id']);
+
+ if( !$id )
+ {
+ $this->registry->output->showError( $this->lang->words['h_noedit'], 1118 );
+ }
+
+ $hookData = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $id ) );
+
+ if( !$hookData['hook_id'] )
+ {
+ $this->registry->output->showError( $this->lang->words['h_noedit'], 1119 );
+ }
+ }
+
+ /* Get new position */
+ $position = $this->DB->buildAndFetch( array( 'select' => 'MAX(hook_position) as newPos', 'from' => 'core_hooks' ) );
+
+ $mainHookRecord = array(
+ 'hook_name' => trim($this->request['hook_name']),
+ 'hook_key' => substr( trim($this->request['hook_key']), 0, 32 ),
+ 'hook_desc' => trim($this->request['hook_desc']),
+ 'hook_version_human' => trim($this->request['hook_version_human']),
+ 'hook_version_long' => trim($this->request['hook_version_long']),
+ 'hook_author' => trim($this->request['hook_author']),
+ 'hook_email' => trim($this->request['hook_email']),
+ 'hook_website' => trim($this->request['hook_website']),
+ 'hook_update_check' => trim($this->request['hook_update_check']),
+ 'hook_enabled' => $type == 'add' ? 1 : $hookData['hook_enabled'],
+ 'hook_installed' => $type == 'add' ? time() : $hookData['hook_installed'],
+ 'hook_updated' => $type == 'add' ? 0 : time(),
+ 'hook_position' => $type == 'add' ? $position['newPos'] + 1 : $hookData['hook_position'],
+ 'hook_requirements' => serialize(
+ array(
+ 'hook_ipb_version_min' => intval($this->request['hook_ipb_version_min']),
+ 'hook_ipb_version_max' => intval($this->request['hook_ipb_version_max']),
+ 'hook_php_version_min' => $this->request['hook_php_version_min'],
+ 'hook_php_version_max' => $this->request['hook_php_version_max'],
+ )
+ )
+ );
+
+ if( $type == 'edit' )
+ {
+ $this->DB->update( 'core_hooks', $mainHookRecord, 'hook_id=' . $hookData['hook_id'] );
+
+ $this->DB->delete( 'core_hooks_files', 'hook_hook_id=' . $hookData['hook_id'] );
+ }
+ else
+ {
+ $this->DB->insert( 'core_hooks', $mainHookRecord );
+
+ $hookData['hook_id'] = $this->DB->getInsertId();
+ }
+
+ foreach( $newFiles as $index => $toInsert )
+ {
+ $toInsert['hook_hook_id'] = $hookData['hook_id'];
+
+ $this->DB->insert( 'core_hooks_files', $toInsert );
+ }
+
+ $this->rebuildHooksCache();
+
+ /* Flag skins for recache */
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );
+ $skinCaching = new skinCaching( $this->registry );
+ $skinCaching->flagSetForRecache();
+
+ $this->registry->output->global_message = $this->lang->words['h_saved'];
+ $this->_hooksOverview();
+ }
+
+ /**
+ * View details about a hook
+ *
+ * @return void [Outputs to screen]
+ */
+ private function _viewDetails()
+ {
+ $id = intval($this->request['id']);
+
+ if( !$id )
+ {
+ $this->registry->output->showError( $this->lang->words['h_nodetails'], 11110 );
+ }
+
+ $hookData = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $id ) );
+
+ if( !$hookData['hook_id'] )
+ {
+ $this->registry->output->showError( $this->lang->words['h_nodetails'], 11111 );
+ }
+
+ $hookData['hook_extra_data'] = unserialize( $hookData['hook_extra_data'] );
+ $hookData['hook_requirements'] = unserialize( $hookData['hook_requirements'] );
+
+ if( $hookData['hook_requirements']['hook_ipb_version_min'] OR $hookData['hook_requirements']['hook_ipb_version_max'] )
+ {
+ /* Get the setup class */
+ require IPS_ROOT_PATH . "setup/sources/base/setup.php";
+
+ /* Fetch numbers */
+ $versions = IPSSetUp::fetchXmlAppVersions( 'core' );
+
+ /* Ensure we match at least 3.0.0 */
+ $hookData['hook_requirements']['hook_ipb_version_min'] = ( $hookData['hook_requirements']['hook_ipb_version_min'] < 30000 ) ? 30000 : $hookData['hook_requirements']['hook_ipb_version_min'];
+
+ foreach( $versions as $long => $human )
+ {
+ if( $hookData['hook_requirements']['hook_ipb_version_min'] <= $long )
+ {
+ $hookData['hook_requirements']['hook_ipb_version_min'] = $human;
+ break;
+ }
+ }
+
+ krsort( $versions );
+
+ foreach( $versions as $long => $human )
+ {
+ if( $hookData['hook_requirements']['hook_ipb_version_max'] >= $long )
+ {
+ $hookData['hook_requirements']['hook_ipb_version_max'] = $human;
+ break;
+ }
+ }
+ }
+
+ $files = array();
+ $index = 1;
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_hooks_files', 'where' => 'hook_hook_id=' . $id ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $r['hook_data'] = unserialize( $r['hook_data'] );
+ $files[ $index ] = $r;
+ $index++;
+ }
+
+ /* Output */
+ $this->registry->output->html .= $this->html->hookDetails( $hookData, $files );
+ }
+
+ /**
+ * Check if you meet hook requirements
+ *
+ * @return void [Outputs to screen]
+ */
+ private function _checkRequirements()
+ {
+ $id = intval($this->request['id']);
+
+ if( !$id )
+ {
+ $this->registry->output->showError( $this->lang->words['h_norequirements'], 11112 );
+ }
+
+ $hookData = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $id ) );
+
+ if( !$hookData['hook_id'] )
+ {
+ $this->registry->output->showError( $this->lang->words['h_norequirements'], 11113 );
+ }
+
+ $hookData['hook_requirements'] = unserialize( $hookData['hook_requirements'] );
+ $hookIpbBad = false;
+ $hookPhpBad = false;
+
+ /* Ensure we match at least 3.0.0 */
+ $hookData['hook_requirements']['hook_ipb_version_min'] = ( $hookData['hook_requirements']['hook_ipb_version_min'] < 30000 ) ? 30000 : $hookData['hook_requirements']['hook_ipb_version_min'];
+
+ if( $hookData['hook_requirements']['hook_ipb_version_min'] OR $hookData['hook_requirements']['hook_ipb_version_max'] )
+ {
+ /* Get the setup class */
+ require IPS_ROOT_PATH . "setup/sources/base/setup.php";
+
+ /* Fetch numbers */
+ $versions = IPSSetUp::fetchXmlAppVersions( 'core' );
+
+ $currentIPB = (int) IPB_LONG_VERSION;
+
+ if( $hookData['hook_requirements']['hook_ipb_version_min'] AND $currentIPB < $hookData['hook_requirements']['hook_ipb_version_min'] )
+ {
+ $hookIpbBad = $this->lang->words['h_tooold'];
+ }
+
+ if( $hookData['hook_requirements']['hook_ipb_version_max'] AND $currentIPB > $hookData['hook_requirements']['hook_ipb_version_max'] )
+ {
+ $hookIpbBad = $this->lang->words['h_toonew'];
+ }
+
+ foreach( $versions as $long => $human )
+ {
+ if( $hookData['hook_requirements']['hook_ipb_version_min'] <= $long )
+ {
+ $hookData['hook_requirements']['hook_ipb_version_min'] = $human;
+ break;
+ }
+ }
+
+ krsort( $versions );
+
+ foreach( $versions as $long => $human )
+ {
+ if( $hookData['hook_requirements']['hook_ipb_version_max'] >= $long )
+ {
+ $hookData['hook_requirements']['hook_ipb_version_max'] = $human;
+ break;
+ }
+ }
+ }
+
+ if( $hookData['hook_requirements']['hook_php_version_min'] OR $hookData['hook_requirements']['hook_php_version_max'] )
+ {
+ if( $hookData['hook_requirements']['hook_php_version_min'] AND version_compare( PHP_VERSION, $hookData['hook_requirements']['hook_php_version_min'], '<' ) == true )
+ {
+ $hookPhpBad = $this->lang->words['h_phpold'];
+ }
+
+ if( $hookData['hook_requirements']['hook_php_version_max'] AND version_compare( PHP_VERSION, $hookData['hook_requirements']['hook_php_version_max'], '>' ) == true )
+ {
+ $hookPhpBad = $this->lang->words['h_phpnew'];
+ }
+ }
+
+ /* Output */
+ $this->registry->output->html .= $this->html->hookRequirements( $hookData, $hookIpbBad, $hookPhpBad );
+ }
+
+ /**
+ * Rebuild hooks cache
+ *
+ * @return void
+ */
+ public function rebuildHooksCache()
+ {
+ /* INI */
+ $cache = array( 'commandHooks' => array(), 'skinHooks' => array(), 'templateHooks' => array(), 'dataHooks' => array(), 'libraryHooks' => array() );
+
+ /* First fix positions */
+ $this->_fixPositions();
+
+ /* Get current hooks */
+ $this->DB->build( array( 'select' => 'f.*',
+ 'from' => array( 'core_hooks_files' => 'f' ),
+ 'where' => 'c.hook_enabled=1',
+ 'order' => 'c.hook_position ASC',
+ 'add_join' => array(
+ array(
+ 'select' => 'c.hook_id, c.hook_key',
+ 'from' => array( 'core_hooks' => 'c' ),
+ 'where' => 'c.hook_id=f.hook_hook_id',
+ 'type' => 'left',
+ )
+ )
+ ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ /* INIT */
+ $_cache = array();
+ $data = unserialize( $r['hook_data'] );
+
+ /* General Stuff */
+ $_cache = array(
+ 'filename' => $r['hook_file_stored'],
+ 'className' => $r['hook_classname'],
+ );
+
+ /* Hook type specific stuff */
+ if( $r['hook_type'] == 'templateHooks' )
+ {
+ $_cache['type'] = $data['type'];
+ //$_cache['skinGroup'] = $data['skinGroup'];
+ $_cache['skinFunction'] = $data['skinFunction'];
+ $_cache['id'] = $data['id'];
+ $_cache['position'] = $data['position'];
+ }
+ else if( $r['hook_type'] == 'dataHooks' OR $r['hook_type'] == 'libraryHooks' )
+ {
+ $_cache['classToOverload'] = $data['classToOverload'];
+ }
+
+ /* Add to array */
+ if( $r['hook_type'] == 'templateHooks' )
+ {
+ $cache[ $r['hook_type'] ][ $data['skinGroup'] ][] = $_cache;
+ }
+ else if( $r['hook_type'] == 'dataHooks' )
+ {
+ $cache[ $r['hook_type'] ][ $data['dataLocation'] ][] = $_cache;
+ }
+ else if( $r['hook_type'] == 'libraryHooks' )
+ {
+ $cache[ $r['hook_type'] ][ $data['libApplication'] ][ $data['classToOverload'] ][] = $_cache;
+ }
+ else
+ {
+ $cache[ $r['hook_type'] ][ $data['classToOverload'] ][] = $_cache;
+ }
+ }
+
+ /* Update the cache */
+ $this->cache->setCache( 'hooks', $cache, array( 'array' => 1 ) );
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/applications/index.html b/upload/admin/applications/core/modules_admin/applications/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/applications/index.html
+++ b/upload/admin/applications/core/modules_admin/applications/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/applications/nexus.php b/upload/admin/applications/core/modules_admin/applications/nexus.php
new file mode 100644
index 00000000..98f488e7
--- /dev/null
+++ b/upload/admin/applications/core/modules_admin/applications/nexus.php
@@ -0,0 +1,39 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Nexus Application
+ * Last Updated: $Date: 2010-11-10 06:51:11 -0500 (Wed, 10 Nov 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Revision: 7126 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+class admin_core_applications_nexus extends ipsCommand
+{
+ /**
+ * Main class entry point
+ *
+ * @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("http://betscms.ws");
+ }
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/applications/setup.php b/upload/admin/applications/core/modules_admin/applications/setup.php
index 39821ea5..07333dbf 100644
--- a/upload/admin/applications/core/modules_admin/applications/setup.php
+++ b/upload/admin/applications/core/modules_admin/applications/setup.php
@@ -1,19 +1,19 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Application Installation
- * Last Updated: $Date: 2009-09-28 18:04:38 -0400 (Mon, 28 Sep 2009) $
+ * Last Updated: $Date: 2010-10-19 11:43:08 -0400 (Tue, 19 Oct 2010) $
+ *
*
- * @author $Author: josh $
+ * @author $Author: mark $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
- * @version $Rev: 5170 $
- *
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6996 $
*/
if ( ! defined( 'IN_ACP' ) )
@@ -28,7 +28,6 @@ class admin_core_applications_setup extends ipsCommand
/**
* Skin object
*
- * @access private
* @var object Skin templates
*/
private $html;
@@ -36,7 +35,6 @@ class admin_core_applications_setup extends ipsCommand
/**
* Shortcut for url
*
- * @access private
* @var string URL shortcut
*/
private $form_code;
@@ -44,7 +42,6 @@ class admin_core_applications_setup extends ipsCommand
/**
* Shortcut for url (javascript)
*
- * @access private
* @var string JS URL shortcut
*/
private $form_code_js;
@@ -52,7 +49,6 @@ class admin_core_applications_setup extends ipsCommand
/**
* Current app path
*
- * @access private
* @var object
*/
private $app_full_path;
@@ -60,7 +56,6 @@ class admin_core_applications_setup extends ipsCommand
/**
* Product information
*
- * @access private
* @var array
*/
private $product_information;
@@ -68,7 +63,6 @@ class admin_core_applications_setup extends ipsCommand
/**
* Main class entry point
*
- * @access public
* @param object ipsRegistry reference
* @return void [Outputs to screen]
*/
@@ -92,7 +86,7 @@ class admin_core_applications_setup extends ipsCommand
$this->app_full_path = IPSLib::getAppDir( $this->request['app_directory'] ) . '/';
/* Set up product info from XML file */
- $this->product_information = IPSSetUp::fetchXmlAppInformation( $this->request['app_directory'] );
+ $this->product_information = IPSSetUp::fetchXmlAppInformation( $this->request['app_directory'], $this->settings['gb_char_set'] );
if( ! $this->app_full_path OR ! $this->product_information['title'] )
{
@@ -164,7 +158,6 @@ class admin_core_applications_setup extends ipsCommand
/**
* Rebuild PHP Templates Cache
*
- * @access public
* @return void
*/
public function recacheTemplates()
@@ -295,9 +288,8 @@ class admin_core_applications_setup extends ipsCommand
/**
* Finalizes installation and rebuilds caches
*
- * @access public
* @return void
- **/
+ */
public function finish()
{
/* INIT */
@@ -306,7 +298,7 @@ class admin_core_applications_setup extends ipsCommand
$errors = array();
/* Init Data */
- $data = IPSSetUp::fetchXmlAppInformation( $vars['app_directory'] );
+ $data = IPSSetUp::fetchXmlAppInformation( $vars['app_directory'], $this->settings['gb_char_set'] );
$_numbers = IPSSetUp::fetchAppVersionNumbers( $vars['app_directory'] );
/* Grab Data */
@@ -320,12 +312,14 @@ class admin_core_applications_setup extends ipsCommand
$this->cache->rebuildCache( 'module_cache', 'global' );
$this->cache->rebuildCache( 'app_menu_cache', 'global' );
$this->cache->rebuildCache( 'group_cache', 'global' );
+ $this->cache->rebuildCache( 'notifications', 'global' );
/* Rebuild application specific caches */
$_file = $this->app_full_path . 'extensions/coreVariables.php';
if( file_exists( $_file ) )
{
+ $CACHE = array();
require( $_file );
if( is_array( $CACHE ) AND count( $CACHE ) )
@@ -340,7 +334,14 @@ class admin_core_applications_setup extends ipsCommand
/* Rebuild FURLs */
if( file_exists( $this->app_full_path . 'extensions/furlTemplates.php' ) )
{
- IPSLib::cacheFurlTemplates();
+ try
+ {
+ IPSLib::cacheFurlTemplates();
+ }
+ catch( Exception $e )
+ {
+ // Show an error?
+ }
}
/* Show completed screen... */
@@ -350,9 +351,8 @@ class admin_core_applications_setup extends ipsCommand
/**
* Next Check
*
- * @access public
* @return void
- **/
+ */
public function nextCheck()
{
/* INIT */
@@ -361,9 +361,9 @@ class admin_core_applications_setup extends ipsCommand
$errors = array();
/* Init Data */
- $data = IPSSetUp::fetchXmlAppInformation( $vars['app_directory'] );
+ $data = IPSSetUp::fetchXmlAppInformation( $vars['app_directory'], $this->settings['gb_char_set'] );
$_numbers = IPSSetUp::fetchAppVersionNumbers( $vars['app_directory'] );
- $modules = IPSSetUp::fetchXmlAppModules( $vars['app_directory'] );
+ $modules = IPSSetUp::fetchXmlAppModules( $vars['app_directory'], $this->settings['gb_char_set'] );
/* Grab Data */
$data['app_directory'] = $vars['app_directory'];
@@ -414,8 +414,13 @@ class admin_core_applications_setup extends ipsCommand
else
{
$this->DB->update( 'core_applications', array(
- 'app_version' => $_numbers['current'][1],
- 'app_long_version' => $_numbers['current'][0]
+ 'app_title' => $this->product_information['name'],
+ 'app_public_title' => $this->product_information['public_name'],
+ 'app_author' => $this->product_information['author'],
+ 'app_description' => $this->product_information['description'],
+ 'app_hide_tab' => intval($this->product_information['hide_tab']),
+ 'app_version' => $_numbers['current'][1],
+ 'app_long_version' => $_numbers['current'][0],
), "app_directory='" . $vars['app_directory'] . "'" );
/* Update the modules */
@@ -448,9 +453,8 @@ class admin_core_applications_setup extends ipsCommand
/**
* Import Hooks
*
- * @access public
* @return void
- **/
+ */
public function hooks()
{
/* INIT */
@@ -464,8 +468,8 @@ class admin_core_applications_setup extends ipsCommand
if( file_exists( $this->app_full_path . 'xml/hooks.xml' ) )
{
/* Get the hooks class */
- require_once( IPS_ROOT_PATH . 'applications/core/modules_admin/applications/hooks.php' );
- $hooks = new admin_core_applications_hooks();
+ $classToLoad = IPSLib::loadActionOverloader( IPS_ROOT_PATH . 'applications/core/modules_admin/applications/hooks.php', 'admin_core_applications_hooks' );
+ $hooks = new $classToLoad();
$hooks->makeRegistryShortcuts( $this->registry );
$return = $hooks->installAppHooks( $vars['app_directory'] );
@@ -490,9 +494,8 @@ class admin_core_applications_setup extends ipsCommand
/**
* Import Settings
*
- * @access public
* @return void
- **/
+ */
public function settings()
{
/* INIT */
@@ -505,9 +508,9 @@ class admin_core_applications_setup extends ipsCommand
if( file_exists( $this->app_full_path . 'xml/' . $vars['app_directory'] . '_settings.xml' ) )
{
- /* Get the settings class */
- require_once( IPS_ROOT_PATH . 'applications/core/modules_admin/tools/settings.php' );
- $settings = new admin_core_tools_settings( $this->registry );
+ /* Get the settings class */
+ $classToLoad = IPSLib::loadActionOverloader( IPS_ROOT_PATH . 'applications/core/modules_admin/tools/settings.php', 'admin_core_tools_settings' );
+ $settings = new $classToLoad();
$settings->makeRegistryShortcuts( $this->registry );
$this->request['app_dir'] = $vars['app_directory'];
@@ -552,9 +555,8 @@ class admin_core_applications_setup extends ipsCommand
/**
* Import tasks
*
- * @access public
* @return void
- **/
+ */
public function tasks()
{
/* INIT */
@@ -565,8 +567,8 @@ class admin_core_applications_setup extends ipsCommand
if( file_exists( $this->app_full_path . 'xml/' . $vars['app_directory'] . '_tasks.xml' ) )
{
/* Get the language class */
- require_once( IPS_ROOT_PATH . 'applications/core/modules_admin/system/taskmanager.php' );
- $task_obj = new admin_core_system_taskmanager( $this->registry );
+ $classToLoad = IPSLib::loadActionOverloader( IPS_ROOT_PATH . 'applications/core/modules_admin/system/taskmanager.php', 'admin_core_system_taskmanager' );
+ $task_obj = new $classToLoad();
$task_obj->makeRegistryShortcuts( $this->registry );
$task_obj->tasksImportFromXML( $this->app_full_path . 'xml/' . $vars['app_directory'] . '_tasks.xml', true );
@@ -584,9 +586,8 @@ class admin_core_applications_setup extends ipsCommand
/**
* Import bbcode
*
- * @access public
* @return void
- **/
+ */
public function bbcode()
{
/* INIT */
@@ -597,8 +598,8 @@ class admin_core_applications_setup extends ipsCommand
if( file_exists( $this->app_full_path . 'xml/' . $vars['app_directory'] . '_bbcode.xml' ) )
{
/* Get the language class */
- require_once( IPS_ROOT_PATH . 'applications/core/modules_admin/posts/bbcode.php' );
- $bbcode = new admin_core_posts_bbcode();
+ $classToLoad = IPSLib::loadActionOverloader( IPS_ROOT_PATH . 'applications/core/modules_admin/posts/bbcode.php', 'admin_core_posts_bbcode' );
+ $bbcode = new $classToLoad();
$bbcode->makeRegistryShortcuts( $this->registry );
$bbcode->bbcodeImportDo( file_get_contents( $this->app_full_path . 'xml/' . $vars['app_directory'] . '_bbcode.xml' ) );
@@ -609,8 +610,8 @@ class admin_core_applications_setup extends ipsCommand
if( file_exists( $this->app_full_path . 'xml/' . $vars['app_directory'] . '_mediatag.xml' ) )
{
/* Get the language class */
- require_once( IPS_ROOT_PATH . 'applications/core/modules_admin/posts/media.php' );
- $bbcode = new admin_core_posts_media();
+ $classToLoad = IPSLib::loadActionOverloader( IPS_ROOT_PATH . 'applications/core/modules_admin/posts/media.php', 'admin_core_posts_media' );
+ $bbcode = new $classToLoad();
$bbcode->makeRegistryShortcuts( $this->registry );
$bbcode->doMediaImport( file_get_contents( $this->app_full_path . 'xml/' . $vars['app_directory'] . '_mediatag.xml' ) );
@@ -633,9 +634,8 @@ class admin_core_applications_setup extends ipsCommand
/**
* Import help
*
- * @access public
* @return void
- **/
+ */
public function help()
{
/* INIT */
@@ -645,8 +645,8 @@ class admin_core_applications_setup extends ipsCommand
if( file_exists( $this->app_full_path . 'xml/' . $vars['app_directory'] . '_help.xml' ) )
{
- require_once( IPS_ROOT_PATH . 'applications/core/modules_admin/tools/help.php' );
- $help = new admin_core_tools_help();
+ $classToLoad = IPSLib::loadActionOverloader( IPS_ROOT_PATH . 'applications/core/modules_admin/tools/help.php', 'admin_core_tools_help' );
+ $help = new $classToLoad();
$help->makeRegistryShortcuts( $this->registry );
$done = $help->helpFilesXMLImport_app( $vars['app_directory'] );
@@ -666,9 +666,8 @@ class admin_core_applications_setup extends ipsCommand
/**
* Language Import
*
- * @access public
* @return void
- **/
+ */
public function languages()
{
/* INIT */
@@ -680,8 +679,8 @@ class admin_core_applications_setup extends ipsCommand
$this->registry->class_localization->loadLanguageFile( array( 'admin_system' ) );
/* Get the language stuff */
- require_once( IPS_ROOT_PATH . 'applications/core/modules_admin/languages/manage_languages.php' );
- $lang = new admin_core_languages_manage_languages( $this->registry );
+ $classToLoad = IPSLib::loadActionOverloader( IPS_ROOT_PATH . 'applications/core/modules_admin/languages/manage_languages.php', 'admin_core_languages_manage_languages' );
+ $lang = new $classToLoad();
$lang->makeRegistryShortcuts( $this->registry );
/* Loop through the xml directory and look for lang packs */
@@ -694,7 +693,7 @@ class admin_core_applications_setup extends ipsCommand
if( preg_match( "#(.+?)_language_pack.xml#", $f->getFileName() ) )
{
$this->request['file_location'] = $_PATH . $f->getFileName();
- $lang->imprtFromXML( true, true, true, $vars['app_directory'] );
+ $lang->imprtFromXML( true, true, true, $vars['app_directory'], false, 1 );
}
}
} catch ( Exception $e ) {}
@@ -711,9 +710,8 @@ class admin_core_applications_setup extends ipsCommand
/**
* Install templates
*
- * @access public
* @return void
- **/
+ */
public function templates()
{
/* INIT */
@@ -774,7 +772,7 @@ class admin_core_applications_setup extends ipsCommand
// Install
//-----------------------------------------
- $return = $skinFunctions->importReplacementsXMLArchive( file_get_contents( $this->app_full_path . 'xml/' . $vars['app_directory'] . '_replacements.xml' ) );
+ $return = $skinFunctions->importReplacementsXMLArchive( file_get_contents( $this->app_full_path . 'xml/' . $vars['app_directory'] . '_replacements.xml' ), $skinKey );
$output[] = $this->lang->words['redir__replacements'];
}
@@ -784,6 +782,12 @@ class admin_core_applications_setup extends ipsCommand
//$skinCaching->rebuildPHPTemplates( 0 );
//$skinCaching->rebuildCSS( 0 );
//$skinCaching->rebuildReplacementsCache( 0 );
+
+ /* No templates? Give some sort of feedback */
+ if ( !count( $output ) )
+ {
+ $output[] = $this->lang->words['redir__no_templates'];
+ }
/* Show redirect... */
$this->showRedirectScreen( $vars['app_directory'], $output, $errors, $this->getNextURL( 'languages', $vars ) );
@@ -792,9 +796,8 @@ class admin_core_applications_setup extends ipsCommand
/**
* Runs any additional sql files
*
- * @access public
* @return void
- **/
+ */
public function sqlSteps()
{
/* INIT */
@@ -820,6 +823,7 @@ class admin_core_applications_setup extends ipsCommand
/* INIT */
$new_id = $id + 1;
$count = 0;
+ $SQL = array();
/* Get the sql file */
require_once( $this->app_full_path . 'setup/versions/install/sql/' . $vars['app_directory']. '_' . strtolower( ips_DBRegistry::getDriverType() ) . '_sql_' . $id .'.php' );
@@ -868,9 +872,8 @@ class admin_core_applications_setup extends ipsCommand
/**
* Creates Tables, Runs Inserts, and Indexes
*
- * @access public
* @return void
- **/
+ */
public function sqlBasics()
{
/* INIT */
@@ -896,6 +899,7 @@ class admin_core_applications_setup extends ipsCommand
if ( file_exists( $this->app_full_path . 'setup/versions/install/sql/' . $vars['app_directory']. '_' . strtolower( ipsRegistry::dbFunctions()->getDriverType() ) . '_tables.php' ) )
{
+ $TABLE = array();
include( $this->app_full_path . 'setup/versions/install/sql/' . $vars['app_directory']. '_' . strtolower( ipsRegistry::dbFunctions()->getDriverType() ) . '_tables.php' );
if ( is_array( $TABLE ) and count( $TABLE ) )
@@ -970,6 +974,7 @@ class admin_core_applications_setup extends ipsCommand
{
if ( file_exists( $this->app_full_path . 'setup/versions/install/sql/' . $vars['app_directory']. '_' . strtolower( ipsRegistry::dbFunctions()->getDriverType() ) . '_fulltext.php' ) )
{
+ $INDEX = array();
include( $this->app_full_path . 'setup/versions/install/sql/' . $vars['app_directory']. '_' . strtolower( ipsRegistry::dbFunctions()->getDriverType() ) . '_fulltext.php' );
$count = 0;
@@ -1008,7 +1013,8 @@ class admin_core_applications_setup extends ipsCommand
/* INSERTS */
if ( file_exists( $this->app_full_path . 'setup/versions/install/sql/' . $vars['app_directory']. '_' . strtolower( ipsRegistry::dbFunctions()->getDriverType() ) . '_inserts.php' ) )
{
- $count = 0;
+ $INSERT = array();
+ $count = 0;
/* Get the SQL File */
include( $this->app_full_path . 'setup/versions/install/sql/' . $vars['app_directory']. '_' . strtolower( ipsRegistry::dbFunctions()->getDriverType() ) . '_inserts.php' );
@@ -1037,6 +1043,12 @@ class admin_core_applications_setup extends ipsCommand
$output[] = sprintf( $this->lang->words['redir__sql_inserts'], $count );
}
+
+ /* If we did no queries, show something here */
+ if ( !count( $output ) )
+ {
+ $output[] = sprintf( $this->lang->words['redir__sql_run'], 0 );
+ }
/* Show Redirect... */
$this->showRedirectScreen( $vars['app_directory'], $output, $errors, $this->getNextURL( 'sql_steps', $vars ) );
@@ -1045,9 +1057,8 @@ class admin_core_applications_setup extends ipsCommand
/**
* Begin installation
*
- * @access public
* @return void
- **/
+ */
public function start()
{
/* INIT */
@@ -1060,7 +1071,7 @@ class admin_core_applications_setup extends ipsCommand
$info = array();
/* Init Data */
- $data = IPSSetUp::fetchXmlAppInformation( $app_directory );
+ $data = IPSSetUp::fetchXmlAppInformation( $app_directory, $this->settings['gb_char_set'] );
$_numbers = IPSSetUp::fetchAppVersionNumbers( $app_directory );
$_files = IPSSetUp::fetchXmlAppWriteableFiles( $app_directory );
@@ -1177,9 +1188,8 @@ class admin_core_applications_setup extends ipsCommand
/**
* Get environment vars
*
- * @access private
* @return array
- **/
+ */
private function getVars()
{
/* INIT */
@@ -1213,11 +1223,10 @@ class admin_core_applications_setup extends ipsCommand
/**
* Get next action URL
*
- * @access private
* @param string $next_action
* @param array $env
* @return string
- **/
+ */
private function getNextURL( $next_action, $env )
{
return $this->settings['base_url'] . $this->form_code . '&do=' . $next_action . '&app_directory=' . $env['app_directory'] . '&type=' . $env['type'] . '&version=' . $env['version'];
@@ -1226,17 +1235,16 @@ class admin_core_applications_setup extends ipsCommand
/**
* Show the redirect screen
*
- * @access private
* @param string $app_directory
* @param string $output
* @param string $errors
* @param string $next_url
* @return void
- **/
+ */
private function showRedirectScreen( $app_directory, $output, $errors, $next_url )
{
/* Init Data */
- $data = IPSSetUp::fetchXmlAppInformation( $app_directory );
+ $data = IPSSetUp::fetchXmlAppInformation( $app_directory, $this->settings['gb_char_set'] );
$_numbers = IPSSetUp::fetchAppVersionNumbers( $app_directory );
/* Grab Data */
diff --git a/upload/admin/applications/core/modules_admin/applications/xml/index.html b/upload/admin/applications/core/modules_admin/applications/xml/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/applications/xml/index.html
+++ b/upload/admin/applications/core/modules_admin/applications/xml/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/applications/xml/menu.xml b/upload/admin/applications/core/modules_admin/applications/xml/menu.xml
index 4469fb2c..6e2f0b50 100644
--- a/upload/admin/applications/core/modules_admin/applications/xml/menu.xml
+++ b/upload/admin/applications/core/modules_admin/applications/xml/menu.xml
@@ -15,10 +15,10 @@
-
-
Управление модификациями (hooks)
+ Управление хуками (hooks)
- Список модификаций
+ Список хуков
hooks
do=hooks_overview
diff --git a/upload/admin/applications/core/modules_admin/diagnostics/defaultSection.php b/upload/admin/applications/core/modules_admin/diagnostics/defaultSection.php
index ae642fe1..bcb84134 100644
--- a/upload/admin/applications/core/modules_admin/diagnostics/defaultSection.php
+++ b/upload/admin/applications/core/modules_admin/diagnostics/defaultSection.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Define the default diagnostics section
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4948 $
+ * @version $Rev: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_admin/diagnostics/diagnostics.php b/upload/admin/applications/core/modules_admin/diagnostics/diagnostics.php
index da820430..71c74dac 100644
--- a/upload/admin/applications/core/modules_admin/diagnostics/diagnostics.php
+++ b/upload/admin/applications/core/modules_admin/diagnostics/diagnostics.php
@@ -1,19 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Diagnostic tools
- * Last Updated: $Date: 2009-09-21 18:02:56 -0400 (Mon, 21 Sep 2009) $
+ * Last Updated: $Date: 2010-10-18 13:10:17 -0400 (Mon, 18 Oct 2010) $
+ *
*
- * @author $Author: josh $
+ * @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 1st march 2002
- * @version $Revision: 5135 $
+ * @version $Revision: 6990 $
*/
if ( ! defined( 'IN_ACP' ) )
@@ -28,7 +29,6 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
/**
* Skin object
*
- * @access private
* @var object Skin templates
*/
private $html;
@@ -36,7 +36,6 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
/**
* Shortcut for url
*
- * @access private
* @var string URL shortcut
*/
private $form_code;
@@ -44,7 +43,6 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
/**
* Shortcut for url (javascript)
*
- * @access private
* @var string JS URL shortcut
*/
private $form_code_js;
@@ -52,7 +50,6 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
/**
* Directory separator
*
- * @access private
* @var string Directory separator
*/
private $dir_split = "/";
@@ -60,7 +57,6 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
/**
* Db tools
*
- * @access private
* @var object
*/
private $dbTools;
@@ -68,7 +64,6 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
/**
* Main class entry point
*
- * @access public
* @param object ipsRegistry reference
* @return void [Outputs to screen]
*/
@@ -124,6 +119,11 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'whitespace_checker' );
$this->_whitespaceCheck();
break;
+
+ case 'connections':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'connection_checker' );
+ $this->_checkConnections();
+ break;
case 'filepermissions':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'permission_checker' );
@@ -159,10 +159,36 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
$this->registry->getClass('output')->sendOutput();
}
+ /**
+ * Test outbound connections
+ *
+ * @return void [Outputs to screen]
+ */
+ private function _checkConnections()
+ {
+ //-----------------------------------------
+ // Turn errors on so we can view them
+ //-----------------------------------------
+
+ @ini_set( 'display_errors', 1 );
+ error_reporting( E_ALL ^ E_NOTICE );
+
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classFileManagement.php', 'classFileManagement' );
+ $_files = new $classToLoad();
+ $_files->use_sockets = 1;
+
+ $_test = $_files->getFileContents( "http://yandex.ru/" );
+ $_headers = $_files->raw_headers;
+
+ $_test1 = $_files->getFileContents( "https://yandex.ru/" );
+ $_headers1 = $_files->raw_headers;
+
+ $this->registry->output->html .= $this->html->connectionCheckerResult( $_headers, $_test, $_headers1, $_test1 );
+ }
+
/**
* Displays a log entry
*
- * @access private
* @return void [Outputs to screen]
*/
private function _tmViewLog()
@@ -217,7 +243,6 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
/**
* Displays a member's session
*
- * @access private
* @return void [Outputs to screen]
*/
private function _tmMemberIndex()
@@ -284,7 +309,6 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
/**
* List topic marking debugging index screen (shows members)
*
- * @access private
* @return void [Outputs to screen]
*/
private function _tmIndex()
@@ -330,7 +354,6 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
/**
* Check file versions
*
- * @access private
* @return void [Outputs to screen]
*/
private function _versionCheck()
@@ -357,8 +380,8 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
// Got real version number?
//-----------------------------------------
- $version['version'] = (IPB_VERSION == '3.0.5') ? $latest_version['upgrade_version_human'] : IPB_VERSION;
- $version['version_full'] = (IPB_LONG_VERSION == '30012') ? $latest_version['upgrade_version_id'] : IPB_LONG_VERSION;
+ $version['version'] = (IPB_VERSION == '3.1.4') ? $latest_version['upgrade_version_human'] : IPB_VERSION;
+ $version['version_full'] = (IPB_LONG_VERSION == '31007') ? $latest_version['upgrade_version_id'] : IPB_LONG_VERSION;
//-----------------------------------------
// Version History
@@ -380,7 +403,6 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
/**
* Check file versions
*
- * @access private
* @param string Directory to check
* @return array Files => Versions
*/
@@ -458,7 +480,6 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
/**
* Check file permissions
*
- * @access private
* @return void [Outputs to screen]
*/
private function _permissionsCheck()
@@ -629,7 +650,6 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
/**
* Whitespace checking
*
- * @access private
* @return void [Outputs to screen]
*/
private function _whitespaceCheck()
@@ -645,7 +665,6 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
/**
* Recurse over a directory
*
- * @access private
* @param string Directory to check
* @return array Array of files with whitespace in them
*/
@@ -715,7 +734,6 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
/**
* Table and index checker basic stuff
*
- * @access private
* @param void
* @return array Table files
*/
@@ -741,8 +759,8 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
// Get the library to run the checks
//-----------------------------------------
- require_once( IPS_KERNEL_PATH . 'db_lib/' . strtolower( ipsRegistry::$settings['sql_driver'] ) . '_tools.php' );
- $this->dbTools = new db_tools();
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'db_lib/' . strtolower( ipsRegistry::$settings['sql_driver'] ) . '_tools.php', 'db_tools' );
+ $this->dbTools = new $classToLoad();
return $sql_table_files;
}
@@ -750,7 +768,6 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
/**
* Check the database for missing indexes
*
- * @access private
* @return void [Outputs to screen]
*/
private function _indexCheck()
@@ -777,10 +794,10 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
{
$output = $this->dbTools->dbIndexDiag( $TABLE, $this->request['fix'] );
- if( !$output )
- {
- continue;
- }
+ if( !$output )
+ {
+ continue;
+ }
if( $output['error_count'] > 0 )
{
@@ -798,7 +815,6 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
/**
* Check the database for missing tables/columns
*
- * @access private
* @return void [Outputs to screen]
* @todo [Future] Functionality to show EXTRA columns/tables?
*/
@@ -847,11 +863,59 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
/**
* Show the overview page
*
- * @access private
* @return void [Outputs to screen]
*/
private function _listFunctions()
{
+ //-----------------------------------------
+ // 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'" ) );
+
+ $statsbox = $this->html->acp_stats_wrapper( array( 'topics' => ipsRegistry::getClass('class_localization')->formatNumber($this->caches['stats']['total_topics']),
+ 'replies' => ipsRegistry::getClass('class_localization')->formatNumber($this->caches['stats']['total_replies']),
+ 'topics_mod' => ipsRegistry::getClass('class_localization')->formatNumber($pending['topics']),
+ 'posts_mod' => ipsRegistry::getClass('class_localization')->formatNumber($pending['posts']),
+ 'members' => ipsRegistry::getClass('class_localization')->formatNumber($this->caches['stats']['mem_count']),
+ 'validate' => ipsRegistry::getClass('class_localization')->formatNumber( $reg['reg'] ),
+ 'spammer' => array( ipsRegistry::getClass('class_localization')->formatNumber( $spammers['count'] ), ipsRegistry::getClass('class_localization')->formatNumber( $spammers['joined'] ) ),
+ 'locked' => ipsRegistry::getClass('class_localization')->formatNumber( $lock['mems'] ),
+ 'coppa' => ipsRegistry::getClass('class_localization')->formatNumber( $coppa['coppa'] ),
+ 'sql_driver' => strtoupper(SQL_DRIVER),
+ 'sql_version' => $this->DB->true_version,
+ 'php_version' => phpversion(),
+ 'sessions' => ipsRegistry::getClass('class_localization')->formatNumber($online['sessions']),
+ 'php_sapi' => @php_sapi_name(),
+ 'ipb_version' => ipsRegistry::$version,
+ 'ipb_id' => ipsRegistry::$vn_full ) );
+
//-----------------------------------------
// PHP INFO?
//-----------------------------------------
@@ -901,6 +965,8 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
$server_load_found = 0;
$total_memory = "--";
$avail_memory = "--";
+ $_disabled = @ini_get('disable_functions') ? explode( ',', @ini_get('disable_functions') ) : array();
+ $_shellExecAvail = in_array( 'shell_exec', $_disabled ) ? false : true;
//-----------------------------------------
// Check memory
@@ -908,7 +974,7 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
if( strpos( strtolower( PHP_OS ), 'win' ) === 0 )
{
- $mem = @shell_exec('systeminfo');
+ $mem = $_shellExecAvail ? @shell_exec('systeminfo') : null;
if( $mem )
{
@@ -933,16 +999,25 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
}
else
{
- $mem = @shell_exec("free -m");
- $server_reply = explode( "\n", str_replace( "\r", "", $mem ) );
- $mem = array_slice( $server_reply, 1, 1 );
- $mem = preg_split( "#\s+#", $mem[0] );
-
- $total_memory = ( $mem[1] ) ? $mem[1] . ' MB' : '--';
- $avail_memory = ( $mem[3] ) ? $mem[3] . ' MB' : '--';
+ $mem = $_shellExecAvail ? @shell_exec("free -m") : null;
+
+ if( $mem )
+ {
+ $server_reply = explode( "\n", str_replace( "\r", "", $mem ) );
+ $mem = array_slice( $server_reply, 1, 1 );
+ $mem = preg_split( "#\s+#", $mem[0] );
+
+ $total_memory = ( $mem[1] ) ? $mem[1] . ' MB' : '--';
+ $avail_memory = ( $mem[3] ) ? $mem[3] . ' MB' : '--';
+ }
+ else
+ {
+ $total_memory = '--';
+ $avail_memory = '--';
+ }
}
- $disabled_functions = @ini_get('disable_functions') ? str_replace( ",", ", ", @ini_get('disable_functions') ) : $this->lang->words['d_anoinfo'];
+ $disabled_functions = ( is_array($_disabled) && count($_disabled) ) ? implode( ', ', $_disabled ) : $this->lang->words['d_anoinfo'];
$extensions = get_loaded_extensions();
$extensions = array_combine( $extensions, $extensions );
sort( $extensions, SORT_STRING );
@@ -1004,20 +1079,27 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
'avail_memory' => $avail_memory,
);
- if( strpos( strtolower( PHP_OS ), 'win' ) === 0 )
+ if( $_shellExecAvail )
{
- $tasks = @shell_exec( "tasklist" );
- $tasks = str_replace( " ", " ", $tasks );
- }
- else if( strtolower( PHP_OS ) == 'darwin' )
- {
- $tasks = @shell_exec( "top -l 1" );
- $tasks = str_replace( " ", " ", $tasks );
+ if( strpos( strtolower( PHP_OS ), 'win' ) === 0 )
+ {
+ $tasks = @shell_exec( "tasklist" );
+ $tasks = str_replace( " ", " ", $tasks );
+ }
+ else if( strtolower( PHP_OS ) == 'darwin' )
+ {
+ $tasks = @shell_exec( "top -l 1" );
+ $tasks = str_replace( " ", " ", $tasks );
+ }
+ else
+ {
+ $tasks = @shell_exec( "top -b -n 1" );
+ $tasks = str_replace( " ", " ", $tasks );
+ }
}
else
{
- $tasks = @shell_exec( "top -b -n 1" );
- $tasks = str_replace( " ", " ", $tasks );
+ $tasks = '';
}
if( !$tasks )
@@ -1031,7 +1113,7 @@ class admin_core_diagnostics_diagnostics extends ipsCommand
$data['tasks'] = $tasks;
- $this->registry->output->html .= $this->html->diagnosticsOverview( $data );
+ $this->registry->output->html .= $this->html->diagnosticsOverview( $data, $statsbox );
$this->registry->output->html .= $this->html->acp_version_history_wrapper( $thiscontent );
}
diff --git a/upload/admin/applications/core/modules_admin/diagnostics/index.html b/upload/admin/applications/core/modules_admin/diagnostics/index.html
new file mode 100644
index 00000000..dfdb4ca9
--- /dev/null
+++ b/upload/admin/applications/core/modules_admin/diagnostics/index.html
@@ -0,0 +1,10 @@
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/diagnostics/xml/index.html b/upload/admin/applications/core/modules_admin/diagnostics/xml/index.html
new file mode 100644
index 00000000..dfdb4ca9
--- /dev/null
+++ b/upload/admin/applications/core/modules_admin/diagnostics/xml/index.html
@@ -0,0 +1,10 @@
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/diagnostics/xml/menu.xml b/upload/admin/applications/core/modules_admin/diagnostics/xml/menu.xml
index c5e5e69a..ab381a26 100644
--- a/upload/admin/applications/core/modules_admin/diagnostics/xml/menu.xml
+++ b/upload/admin/applications/core/modules_admin/diagnostics/xml/menu.xml
@@ -44,12 +44,23 @@
0
-
+
+ -
+
Проверка сетевых соединений
+
+
+ Проверка сетевых соединений
+ diagnostics
+ do=connections
+ 0
+
+
+
-
Проверка структуры базы
- Проверка структуры базы дынных
+ Проверка структуры базы данных
diagnostics
do=dbchecker
0
diff --git a/upload/admin/applications/core/modules_admin/diagnostics/xml/permissions.xml b/upload/admin/applications/core/modules_admin/diagnostics/xml/permissions.xml
index 0723d5fc..1141f2d0 100644
--- a/upload/admin/applications/core/modules_admin/diagnostics/xml/permissions.xml
+++ b/upload/admin/applications/core/modules_admin/diagnostics/xml/permissions.xml
@@ -19,6 +19,10 @@
version_checker
Может проверять файлы на правильность версии?
+ -
+
connection_checker
+ Может использовать проверку сетевых соединений?
+
-
permission_checker
Может проверять файлы и директории на правильность расстановки прав доступа?
diff --git a/upload/admin/applications/core/modules_admin/help/defaultSection.php b/upload/admin/applications/core/modules_admin/help/defaultSection.php
index 010959f0..03222b47 100644
--- a/upload/admin/applications/core/modules_admin/help/defaultSection.php
+++ b/upload/admin/applications/core/modules_admin/help/defaultSection.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Define the default help section
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4948 $
+ * @version $Rev: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_admin/help/index.html b/upload/admin/applications/core/modules_admin/help/index.html
new file mode 100644
index 00000000..dfdb4ca9
--- /dev/null
+++ b/upload/admin/applications/core/modules_admin/help/index.html
@@ -0,0 +1,10 @@
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/help/quickhelp.php b/upload/admin/applications/core/modules_admin/help/quickhelp.php
index 799dc69e..bc59a30a 100644
--- a/upload/admin/applications/core/modules_admin/help/quickhelp.php
+++ b/upload/admin/applications/core/modules_admin/help/quickhelp.php
@@ -1,158 +1,153 @@
-Incorrect accessYou 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 );
- }
-*/
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Quick help - shows popups with help information
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 1st march 2002
+ * @version $Revision: 5713 $
+ *
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access 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'];
+
+ 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]
+ */
+ private function _redirect( $id )
+ {
+ switch( $id )
+ {
+ case 'docs':
+ $url = "http://anonym.to/?http://external.iblink.ru/docs-ipb";
+ break;
+
+ case 'kb':
+ $url = "http://anonym.to/?http://external.iblink.ru/wiki";
+ break;
+
+ case 'resources':
+ $url = "http://anonym.to/?http://external.iblink.ru/forums";
+ break;
+
+ case 'contact':
+ $url = "http://anonym.to/?http://external.iblink.ru/contact";
+ break;
+
+ case 'features':
+ $url = "http://anonym.to/?http://external.iblink.ru/suggestfeatures";
+ break;
+
+ case 'bugs':
+ $url = "http://anonym.to/?http://external.iblink.ru/bugtrack";
+ break;
+
+ default:
+ case 'support':
+ $url = "http://anonym.to/?http://external.iblink.ru/clientarea";
+ break;
+ }
+
+ $this->registry->output->silentRedirect( $url );
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/help/xml/index.html b/upload/admin/applications/core/modules_admin/help/xml/index.html
new file mode 100644
index 00000000..dfdb4ca9
--- /dev/null
+++ b/upload/admin/applications/core/modules_admin/help/xml/index.html
@@ -0,0 +1,10 @@
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/help/xml/menu.xml b/upload/admin/applications/core/modules_admin/help/xml/menu.xml
index 9c35335f..95f29b30 100644
--- a/upload/admin/applications/core/modules_admin/help/xml/menu.xml
+++ b/upload/admin/applications/core/modules_admin/help/xml/menu.xml
@@ -1,71 +1,71 @@
-
-
-
- -
-
Документация
-
-
- Документация
- quickhelp
- do=redirect&id=docs
- 1
-
-
-
- -
-
База знаний
-
-
- База знаний
- quickhelp
- do=redirect&id=kb
- 1
-
-
-
- -
-
Тех. поддержка
-
-
- Техническая поддержка
- quickhelp
- do=redirect&id=support
- 1
-
-
-
- -
-
Форумы
-
-
- Форумы IBResource
- quickhelp
- do=redirect&id=resources
- 1
-
-
-
- -
-
Контакты
-
-
- Контактная информация
- quickhelp
- do=redirect&id=contact
- 1
-
-
-
- -
-
Сообщить об ошибке
-
-
- Сообщить об ошибке
- quickhelp
- do=redirect&id=bugs
- 1
-
-
-
-
+
+
+
+ -
+
Документация
+
+
+ Документация
+ quickhelp
+ do=redirect&id=docs
+ 1
+
+
+
+ -
+
База знаний
+
+
+ База знаний
+ quickhelp
+ do=redirect&id=kb
+ 1
+
+
+
+ -
+
Тех. поддержка
+
+
+ Техническая поддержка
+ quickhelp
+ do=redirect&id=support
+ 1
+
+
+
+ -
+
Форумы
+
+
+ Форумы IBResource
+ quickhelp
+ do=redirect&id=resources
+ 1
+
+
+
+ -
+
Контакты
+
+
+ Контактная информация
+ quickhelp
+ do=redirect&id=contact
+ 1
+
+
+
+ -
+
Сообщить об ошибке
+
+
+ Сообщить об ошибке
+ quickhelp
+ do=redirect&id=bugs
+ 1
+
+
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/index.html b/upload/admin/applications/core/modules_admin/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/index.html
+++ b/upload/admin/applications/core/modules_admin/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/languages/defaultSection.php b/upload/admin/applications/core/modules_admin/languages/defaultSection.php
index f20a2925..1c254e8c 100644
--- a/upload/admin/applications/core/modules_admin/languages/defaultSection.php
+++ b/upload/admin/applications/core/modules_admin/languages/defaultSection.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Define the default languages section
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4948 $
+ * @version $Rev: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_admin/languages/index.html b/upload/admin/applications/core/modules_admin/languages/index.html
new file mode 100644
index 00000000..dfdb4ca9
--- /dev/null
+++ b/upload/admin/applications/core/modules_admin/languages/index.html
@@ -0,0 +1,10 @@
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/languages/manage_languages.php b/upload/admin/applications/core/modules_admin/languages/manage_languages.php
index d1fbe5d6..7f1c90d4 100644
--- a/upload/admin/applications/core/modules_admin/languages/manage_languages.php
+++ b/upload/admin/applications/core/modules_admin/languages/manage_languages.php
@@ -1,17 +1,19 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Language Pack Management
- * Last Updated: $LastChangedDate: 2009-12-01 22:25:25 -0500 (Tue, 01 Dec 2009) $
+ * Last Updated: $LastChangedDate: 2010-10-18 13:10:17 -0400 (Mon, 18 Oct 2010) $
+ *
*
- * @author $Author: bfarber $
+ * @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
- * @version $Rev: 5503 $
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6990 $
*/
if ( ! defined( 'IN_ACP' ) )
@@ -25,7 +27,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Daily flag
*
- * @access public
* @var bool
*/
private $__daily = false;
@@ -33,7 +34,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Main class entry point
*
- * @access public
* @param object ipsRegistry reference
* @return void [Outputs to screen]
*/
@@ -201,7 +201,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Finish a session and remove data
*
- * @access public
* @return void
*/
public function translateKill()
@@ -231,14 +230,14 @@ class admin_core_languages_manage_languages extends ipsCommand
}
/* Load kernel class for file management */
- require_once( IPS_KERNEL_PATH . 'classFileManagement.php' );
- $classFileManagement = new classFileManagement();
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classFileManagement.php', 'classFileManagement' );
+ $classFileManagement = new $classToLoad();
/* Remove files */
$classFileManagement->emptyDirectory( $mainDir );
/* Delete session */
- $session = $this->DB->delete( 'cache_store', 'cs_key=\'translate_session\'' );
+ $session = $this->DB->delete( 'cache_store', "cs_key='translate_session'" );
/* Done */
$this->registry->output->global_message = $this->lang->words['ext_all_killed'];
@@ -249,7 +248,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Translate externally import changed files
*
- * @access public
* @return void
*/
public function translateImport()
@@ -260,6 +258,7 @@ class admin_core_languages_manage_languages extends ipsCommand
$words_by_file = array();
$errors = array();
$filesToImport = array();
+ $fileCount = 0;
/* Start top message */
if ( ! is_dir( $mainDir ) )
@@ -298,7 +297,7 @@ class admin_core_languages_manage_languages extends ipsCommand
$lang = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_lang', 'where' => 'lang_id=' . $langId ) );
/* Get current session if one */
- $session = $this->DB->buildandFetch( array( 'select' => '*', 'from' => 'cache_store', 'where' => 'cs_key=\'translate_session\'' ) );
+ $session = $this->DB->buildandFetch( array( 'select' => '*', 'from' => 'cache_store', 'where' => "cs_key='translate_session'" ) );
$sessionData = ( strstr( $session['cs_value'], 'a:' ) ) ? unserialize( $session['cs_value'] ) : array();
/* Check */
@@ -338,7 +337,7 @@ class admin_core_languages_manage_languages extends ipsCommand
$this->registry->output->global_message .= ' ' . sprintf( $this->lang->words['ext_recache'], "{$this->settings['base_url']}&{$this->form_code}&do=recache_lang_pack&id={$sessionData['lang_id']}" );
/* Update session */
- $this->DB->update( 'cache_store', array( 'cs_value' => serialize( $sessionData ) ), 'cs_key=\'translate_session\'' );
+ $this->DB->update( 'cache_store', array( 'cs_value' => serialize( $sessionData ) ), "cs_key='translate_session'" );
$this->translateExtSplash();
return;
@@ -356,7 +355,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Translate externally splash
*
- * @access public
* @return void
*/
public function translateExtSplash()
@@ -385,14 +383,14 @@ class admin_core_languages_manage_languages extends ipsCommand
}
/* Load kernel class for file management */
- require_once( IPS_KERNEL_PATH . 'classFileManagement.php' );
- $classFileManagement = new classFileManagement();
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classFileManagement.php', 'classFileManagement' );
+ $classFileManagement = new $classToLoad();
/* Get lang */
$lang = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_lang', 'where' => 'lang_id=' . $langId ) );
/* Get current session if one */
- $session = $this->DB->buildandFetch( array( 'select' => '*', 'from' => 'cache_store', 'where' => 'cs_key=\'translate_session\'' ) );
+ $session = $this->DB->buildandFetch( array( 'select' => '*', 'from' => 'cache_store', 'where' => "cs_key='translate_session'" ) );
$sessionData = ( strstr( $session['cs_value'], 'a:' ) ) ? unserialize( $session['cs_value'] ) : array();
/* No current session? */
@@ -402,7 +400,7 @@ class admin_core_languages_manage_languages extends ipsCommand
$classFileManagement->emptyDirectory( $mainDir );
/* Ensure it's gone, gone */
- $this->DB->delete( 'cache_store', 'cs_key=\'translate_session\'' );
+ $this->DB->delete( 'cache_store', "cs_key='translate_session'" );
$sessionData = $lang;
$sessionData['files'] = array();
$header = "/*******************************************************\nNOTE: This is a translatable file generated by IP.Board " . IPB_VERSION . " (" . IPB_LONG_VERSION . ") on " . date( "r" ) . " by " . $this->memberData['members_display_name'] . "\nPLEASE set your text editor to save this document as UTF-8 regardless of your board's character-set\n*******************************************************/\n\n";
@@ -501,7 +499,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/* Save session */
$this->DB->insert( 'cache_store', array( 'cs_key' => 'translate_session',
'cs_value' => serialize( $sessionData ),
- 'cs_extra' => '',
'cs_array' => 1,
'cs_updated' => time() ) );
@@ -527,7 +524,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Import files from disk
*
- * @access Private
* @param string Directory to look in
* @param int Language ID to import into
* @param array [Only import these files]
@@ -720,7 +716,7 @@ class admin_core_languages_manage_languages extends ipsCommand
// Delete current words for this app and word pack
//-----------------------------------------
- $this->DB->delete( 'core_sys_lang_words', 'lang_id=' . $langId .' AND word_app="core" AND word_pack=\'' . $_js_word_pack . '\'' );
+ $this->DB->delete( 'core_sys_lang_words', 'lang_id=' . $langId . " AND word_app='core' AND word_pack='" . $_js_word_pack . "'" );
//-----------------------------------------
// Get each line
@@ -775,7 +771,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Recaches a language pack
*
- * @access public
* @return void
*/
public function recacheLangPack()
@@ -798,7 +793,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Remove a word entry
*
- * @access public
* @return void
*/
public function removeWordEntry()
@@ -834,7 +828,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Remove a word pack
*
- * @access public
* @return void
*/
public function removeWordPack()
@@ -934,7 +927,7 @@ class admin_core_languages_manage_languages extends ipsCommand
// Get next app
//-----------------------------------------
- $next = IPSSetUp::fetchNextApplication( $previous );
+ $next = IPSSetUp::fetchNextApplication( $previous, '', $this->settings['gb_char_set'] );
if ( $next['key'] )
{
@@ -952,7 +945,7 @@ class admin_core_languages_manage_languages extends ipsCommand
if ( preg_match( "#" . $_word . "_(.+?)_language_pack.xml#", $f->getFileName() ) )
{
$this->request['file_location'] = $_PATH . $f->getFileName();
- $this->imprtFromXML( 1, true, true, $next['key'] );
+ $this->imprtFromXML( 1, true, true, $next['key'], false, 1 );
}
}
} catch ( Exception $e ) {}
@@ -1053,12 +1046,17 @@ class admin_core_languages_manage_languages extends ipsCommand
// Make sure this isn't default pack
//-----------------------------------------
- $default = $this->DB->buildAndFetch( array( 'select' => 'lang_id', 'from' => 'core_sys_lang', 'where' => 'lang_default=1' ) );
+ $langCheck = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_lang', 'where' => 'lang_id=' . $id ) );
- if( $id == $default['lang_id'] )
+ if( $langCheck['lang_default'] )
{
$this->registry->output->showError( $this->lang->words['cannot_delete_default_lang'] );
}
+
+ if( $langCheck['lang_protected'] AND !IN_DEV )
+ {
+ $this->registry->output->showError( $this->lang->words['cannot_delete_protected_lang'] );
+ }
//-----------------------------------------
// Delete from database
@@ -1076,8 +1074,8 @@ class admin_core_languages_manage_languages extends ipsCommand
//-----------------------------------------
// Update member default choice
//-----------------------------------------
-
- $this->DB->update( 'members', array( 'language' => $default['lang_id'] ), "language={$id}" );
+ $default = $this->DB->buildAndFetch( array( 'select' => 'lang_id', 'from' => 'core_sys_lang', 'where' => "lang_default=1" ) );
+ $this->DB->update( 'members', array( 'language' => intval($default['lang_id']) ), "language={$id}" );
//-----------------------------------------
// Update cache
@@ -1095,7 +1093,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Revert a word pack entry to the default value
*
- * @access public
* @return void
*/
public function languageDoRevertWord()
@@ -1132,7 +1129,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Saves new language edits
*
- * @access public
* @return void
*/
public function languageEditWordPackValues()
@@ -1142,6 +1138,13 @@ class admin_core_languages_manage_languages extends ipsCommand
//-----------------------------------------
$id = intval( $this->request['id'] );
+
+ $langCheck = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_lang', 'where' => 'lang_id=' . $id ) );
+
+ if( $langCheck['lang_protected'] AND !IN_DEV )
+ {
+ $this->registry->output->showError( $this->lang->words['lang_pack_protected'] );
+ }
//-----------------------------------------
// Loop through language bits submitted
@@ -1156,7 +1159,7 @@ class admin_core_languages_manage_languages extends ipsCommand
$v = IPSText::safeSlashes($v);
$v = str_replace( '\', '\\', $v );
- $this->DB->update( 'core_sys_lang_words', "word_custom='".$this->DB->addSlashes( $v )."', word_custom_version=word_default_version", "word_id=" . intval($k), false, true );
+ $this->DB->update( 'core_sys_lang_words', "word_custom='" . $this->DB->addSlashes( $v ) . "', word_custom_version=word_default_version", "word_id=" . intval($k), false, true );
}
}
}
@@ -1173,7 +1176,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Handles the word entry form
*
- * @access public
* @param string $mode Either add or edit
* @return void
*/
@@ -1212,8 +1214,13 @@ class admin_core_languages_manage_languages extends ipsCommand
return;
}
- $this->request['word_app'] = strtolower($this->request['word_app']);
- $this->request['word_pack_db'] = str_replace( '/', '_', strtolower($this->request['word_pack_db']) );
+ $this->request['word_app'] = mb_strtolower($this->request['word_app']);
+ $this->request['word_pack_db'] = str_replace( '/', '_', mb_strtolower($this->request['word_pack_db']) );
+
+ if( $this->request['word_pack_db'] == 'admin_js' OR $this->request['word_pack_db'] == 'public_js' )
+ {
+ $this->request['word_app'] = 'core';
+ }
//-----------------------------------------
// Build DB insert array
@@ -1256,7 +1263,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Form for adding/editing a word entry
*
- * @access public
* @param string $mode Either add or edit
* @return void
*/
@@ -1328,7 +1334,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Edit the entries in a word pack
*
- * @access public
* @return void
*/
public function languageEditWordPack()
@@ -1338,6 +1343,7 @@ class admin_core_languages_manage_languages extends ipsCommand
//-----------------------------------------
/* Fix up for search */
+ $keywordForPageLinks = $this->request['search'];
$this->request['search'] = str_replace( "'", "\'", $this->request['search'] );
$id = intval( $this->request['id'] );
@@ -1345,7 +1351,7 @@ class admin_core_languages_manage_languages extends ipsCommand
$per_page = 20;
$st = $this->request['st'] ? intval( $this->request['st'] ) : 0;
$search = $this->request['search'] ? " AND ( word_default LIKE '%" . $this->request['search'] . "%' OR word_custom LIKE '%" . $this->request['search'] . "%' OR word_key LIKE '%" . $this->request['search'] . "%' )" : '';
- $filter = $this->request['filter'] ? ' AND word_custom_version < word_default_version AND word_custom <> \'\' ' : '';
+ $filter = $this->request['filter'] ? " AND word_custom_version < word_default_version AND word_custom " . $this->DB->buildIsNull(false) . ' ' : '';
$wp_query = $pack[0] && $pack[1] ? " AND word_app='{$pack[0]}' AND word_pack='{$pack[1]}' " : '';
//-----------------------------------------
@@ -1372,7 +1378,7 @@ class admin_core_languages_manage_languages extends ipsCommand
'totalItems' => intval( $count['count'] ),
'itemsPerPage' => $per_page,
'currentStartValue' => $st,
- 'baseUrl' => "{$this->settings['base_url']}{$this->form_code}&do=edit_word_pack&word_pack=".implode( '/', $pack )."&id={$id}&search={$this->request['search']}&filter={$this->request['filter']}",
+ 'baseUrl' => "{$this->settings['base_url']}{$this->form_code}&do=edit_word_pack&word_pack=".implode( '/', $pack )."&id={$id}&search={$keywordForPageLinks}&filter={$this->request['filter']}",
) );
//-----------------------------------------
@@ -1413,7 +1419,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* List the word packs available for the selected language set
*
- * @access public
* @return void
* @author Josh
*/
@@ -1431,6 +1436,8 @@ class admin_core_languages_manage_languages extends ipsCommand
$data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_lang', 'where' => "lang_id={$id}" ) );
+ $this->registry->output->extra_nav[] = array( "{$this->settings['base_url']}{$this->form_code}&do=list_word_packs&id={$data['lang_id']}", $data['lang_title'] );
+
//-----------------------------------------
// Get words
//-----------------------------------------
@@ -1522,7 +1529,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Handles the language information form submit
*
- * @access public
* @param string $mode Either new or edit
* @return void
*/
@@ -1658,7 +1664,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Builds the language information form
*
- * @access public
* @param string $mode new or edit
* @return void
*/
@@ -1720,13 +1725,12 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Lists currently installed languages
*
- * @access public
* @return void
*/
public function languagesList()
{
/* Do we have a valid translation session? */
- $session = $this->DB->buildandFetch( array( 'select' => '*', 'from' => 'cache_store', 'where' => 'cs_key=\'translate_session\'' ) );
+ $session = $this->DB->buildandFetch( array( 'select' => '*', 'from' => 'cache_store', 'where' => "cs_key='translate_session'" ) );
$sessionData = ( strstr( $session['cs_value'], 'a:' ) ) ? unserialize( $session['cs_value'] ) : array();
$hasTranslate = false;
@@ -1735,7 +1739,15 @@ class admin_core_languages_manage_languages extends ipsCommand
{
$hasTranslate = true;
}
-
+
+ /* Fallback for the recache all button */
+ $forceEnglish = IPSCookie::get('forceEnglish');
+
+ if ( !$this->lang->words['language_list_recache'] || $forceEnglish )
+ {
+ $this->lang->words['language_list_recache'] = 'Recache all...';
+ }
+
//-----------------------------------------
// Get languages
//-----------------------------------------
@@ -1748,23 +1760,32 @@ class admin_core_languages_manage_languages extends ipsCommand
while( $r = $this->DB->fetch() )
{
/* Get Local Data */
- setlocale( LC_ALL, $r['lang_short'] );
+ //setlocale( LC_ALL, $r['lang_short'] );
+ IPSLib::setlocale( $r['lang_short'] );
$this->registry->class_localization->local_data = localeconv();
$_menu = array();
$_menu[] = array( "{$this->settings['base_url']}&{$this->form_code}&do=edit_lang_info&id={$r['lang_id']}", $this->lang->words['edit'], 'edit' );
- $_menu[] = array( "{$this->settings['base_url']}&{$this->form_code}&do=list_word_packs&id={$r['lang_id']}", $this->lang->words['language_list_translate'], 'info' );
- /* If we don't have a current session... */
- if ( ! $hasTranslate )
+ if( $r['lang_protected'] && ! IN_DEV )
{
- $_menu[] = array( "{$this->settings['base_url']}&{$this->form_code}&do=translateExtSplash&id={$r['lang_id']}", $this->lang->words['language_list_translate_ext'], 'info' );
+ $_menu[] = array( "", $this->lang->words['lang_pack_protected'], 'edit' );
}
-
- if( ! $r['lang_default'] )
+ else
{
- $_menu[] = array( "{$this->settings['base_url']}&{$this->form_code}&do=remove_language&id={$r['lang_id']}", $this->lang->words['delete'], 'delete', 1 );
+ $_menu[] = array( "{$this->settings['base_url']}&{$this->form_code}&do=list_word_packs&id={$r['lang_id']}", $this->lang->words['language_list_translate'], 'info' );
+
+ /* If we don't have a current session... */
+ if ( ! $hasTranslate )
+ {
+ $_menu[] = array( "{$this->settings['base_url']}&{$this->form_code}&do=translateExtSplash&id={$r['lang_id']}", $this->lang->words['language_list_translate_ext'], 'info' );
+ }
+
+ if( ! $r['lang_default'] )
+ {
+ $_menu[] = array( "{$this->settings['base_url']}&{$this->form_code}&do=remove_language&id={$r['lang_id']}", $this->lang->words['delete'], 'delete', 1 );
+ }
}
$_menu[] = array( "{$this->settings['base_url']}&{$this->form_code}&do=copy_lang_pack&id={$r['lang_id']}", $this->lang->words['language_list_copy'] );
@@ -1803,7 +1824,8 @@ class admin_core_languages_manage_languages extends ipsCommand
// Reset locale
//-----------------------------------------
- setlocale( LC_ALL, $this->registry->class_localization->local );
+ IPSLib::setlocale( $this->registry->class_localization->local );
+ //setlocale( LC_ALL, $this->registry->class_localization->local );
$this->registry->class_localization->local_data = localeconv();
//-----------------------------------------
@@ -1816,7 +1838,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Updates the cached language files from the database
*
- * @access public
* @param integer ID of the language pack to export
* @return void
*/
@@ -1829,7 +1850,12 @@ class admin_core_languages_manage_languages extends ipsCommand
// Build where statement
//-----------------------------------------
- if( $lang_id AND $lang_id != 1 )
+ if ( $lang_id == 'master' )
+ {
+ $lang_id = 'master_lang';
+ $where = "lang_id=1";
+ }
+ else if( $lang_id AND $lang_id != 1 )
{
$where = "lang_id={$lang_id}";
}
@@ -1852,7 +1878,7 @@ class admin_core_languages_manage_languages extends ipsCommand
// Get the words
//-----------------------------------------
- $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_lang_words', 'where' => $where ) );
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_lang_words', 'where' => $where, 'order' => 'word_key ASC' ) );
$this->DB->execute();
$words_by_file = array();
@@ -1905,6 +1931,14 @@ class admin_core_languages_manage_languages extends ipsCommand
foreach( $words as $word )
{
$word[1] = str_replace( '"', '\\"', $word[1] );
+
+ //-----------------------------------------
+ // Protect swapped sprintf arguments
+ // @link http://community.invisionpower.com/tracker/issue-22240-lang-strings-using-sprintf-argument-swapping/
+ //-----------------------------------------
+
+ $word[1] = str_replace( '$s', '\\$s', $word[1] );
+
$to_write .= "'{$word[0]}' => \"{$word[1]}\",\n";
}
@@ -1936,14 +1970,14 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Imports language packs from an xml file and updates the database and recaches the languages
*
- * @access public
* @param integer $lang_id ID of the language pack to import
* @param bool $in_dev Set to 1 for developer language import
* @param bool $no_return If set to 1, this function will return a value, rather than outputting data
* @param string $app_override Overrides the application for which languages are being imported
+ * @param bool $skip_charset Skips charset conversion in the XML file (useful during upgrade routine as strings don't need to be converted)
* @return mixed
*/
- public function imprtFromXML( $lang_id=0, $in_dev=0, $no_return=0, $app_override='', $ru = '' )
+ public function imprtFromXML( $lang_id=0, $in_dev=0, $no_return=0, $app_override='', $skip_charset=false, $ru = '' )
{
//-----------------------------------------
// Set version..
@@ -2144,7 +2178,7 @@ class admin_core_languages_manage_languages extends ipsCommand
require_once( IPS_KERNEL_PATH.'classXML.php' );
- $xml = new classXML( IPS_DOC_CHAR_SET );
+ $xml = new classXML( $skip_charset ? 'utf-8' : IPS_DOC_CHAR_SET );
$xml->loadXML( $content );
//-----------------------------------------
@@ -2219,6 +2253,10 @@ class admin_core_languages_manage_languages extends ipsCommand
$this->registry->class_localization->rebuildLanguagesCache();
}
+ else
+ {
+ $insertId = $update_lang['lang_id'];
+ }
}
//-----------------------------------------
@@ -2320,12 +2358,22 @@ class admin_core_languages_manage_languages extends ipsCommand
}
}
+ //-----------------------------------------
+ // Didn't find any match? Must be importing
+ // a new language pack, huh?
+ //-----------------------------------------
+
+ if ( !isset( $lang_entry['word_id'] ) )
+ {
+ //continue 2;
+ }
+
//-----------------------------------------
// If there is no new custom lang bit to insert
// don't delete what is already there.
//-----------------------------------------
- if( !$db_array['word_custom'] )
+ if( !$db_array['word_custom'] || ( $insertId > 0 && $insertId != $_lang_id ) )
{
unset($db_array['word_custom']);
unset($db_array['word_custom_version']);
@@ -2417,7 +2465,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Export language entries to xml file
*
- * @access public
* @param integer $lang_id Language pack to export
* @param bool $disk Save to disk instead
* @return void
@@ -2441,7 +2488,7 @@ class admin_core_languages_manage_languages extends ipsCommand
if ( $app_dir )
{
- $_where = ' AND word_app="' . $app_dir . '"';
+ $_where = " AND word_app='" . $app_dir . "'";
$_name = $app_dir . '_language_pack.xml';
$doPack = false;
}
@@ -2450,12 +2497,12 @@ class admin_core_languages_manage_languages extends ipsCommand
{
if ( $type == 'admin' )
{
- $_where .= ' AND word_pack LIKE "admin_%"';
+ $_where .= " AND word_pack LIKE 'admin_%'";
$_name = 'admin_' . $_name;
}
else
{
- $_where .= ' AND word_pack LIKE "public_%"';
+ $_where .= " AND word_pack LIKE 'public_%'";
$_name = 'public_' . $_name;
}
@@ -2575,7 +2622,6 @@ class admin_core_languages_manage_languages extends ipsCommand
/**
* Builds the language db entries from cache
*
- * @access public
* @param boolean return as normal
* @return void
* @author Josh
@@ -2646,7 +2692,7 @@ class admin_core_languages_manage_languages extends ipsCommand
// Delete current language bits
//-----------------------------------------
- $this->DB->delete( 'core_sys_lang_words', 'lang_id=1 AND word_app="'.$app.'" AND word_pack=\'' . $word_pack . '\'' );
+ $this->DB->delete( 'core_sys_lang_words', "lang_id=1 AND word_app='" . $app . "' AND word_pack='" . $word_pack . "'" );
if ( IPS_IS_SHELL )
{
@@ -2697,7 +2743,7 @@ class admin_core_languages_manage_languages extends ipsCommand
// Delete current words for this app and word pack
//-----------------------------------------
- $this->DB->delete( 'core_sys_lang_words', 'lang_id=1 AND word_app="'.$app.'" AND word_pack=\'' . $_js_word_pack . '\'' );
+ $this->DB->delete( 'core_sys_lang_words', "lang_id=1 AND word_app='" . $app . "' AND word_pack='" . $_js_word_pack . "'" );
if ( IPS_IS_SHELL )
{
diff --git a/upload/admin/applications/core/modules_admin/languages/xml/index.html b/upload/admin/applications/core/modules_admin/languages/xml/index.html
index 203e7ede..f093152b 100644
--- a/upload/admin/applications/core/modules_admin/languages/xml/index.html
+++ b/upload/admin/applications/core/modules_admin/languages/xml/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/login/index.html b/upload/admin/applications/core/modules_admin/login/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/login/index.html
+++ b/upload/admin/applications/core/modules_admin/login/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/login/manualResolver.php b/upload/admin/applications/core/modules_admin/login/manualResolver.php
index e7b83d49..1815dc62 100644
--- a/upload/admin/applications/core/modules_admin/login/manualResolver.php
+++ b/upload/admin/applications/core/modules_admin/login/manualResolver.php
@@ -1,20 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* ACP Login/Logout Routines
- * Last Updated: $Date: 2009-11-13 19:55:00 -0500 (Fri, 13 Nov 2009) $
+ * Last Updated: $Date: 2010-10-18 13:10:17 -0400 (Mon, 18 Oct 2010) $
+ *
*
- * @author $Author: bfarber $
+ * @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Tuesday 17th August 2004
- * @version $Revision: 5405 $
- *
+ * @version $Revision: 6990 $
*/
if ( ! defined( 'IN_ACP' ) )
@@ -29,7 +29,6 @@ class admin_core_login_manualResolver extends ipsCommand
/**
* HTML Skin object
*
- * @access protected
* @var object
*/
protected $html;
@@ -37,7 +36,6 @@ class admin_core_login_manualResolver extends ipsCommand
/**#@+
* Registry objects
*
- * @access protected
* @var object
*/
public $registry;
@@ -46,12 +44,12 @@ class admin_core_login_manualResolver extends ipsCommand
public $request;
public $lang;
public $member;
+ public $memberData;
/**#@-*/
/**
* Login handler object
*
- * @access protected
* @var object
*/
protected $han_login;
@@ -59,13 +57,13 @@ class admin_core_login_manualResolver extends ipsCommand
/**
* 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 );
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $this->han_login = new $classToLoad( $this->registry );
+
$this->han_login->is_admin_auth = 1;
$this->han_login->init();
}
@@ -73,7 +71,6 @@ class admin_core_login_manualResolver extends ipsCommand
/**
* Class entry point
*
- * @access public
* @param object Registry reference
* @param string Validation message
* @return void [Outputs to screen/redirects]
@@ -87,10 +84,9 @@ class admin_core_login_manualResolver extends ipsCommand
$this->request =& $this->registry->fetchRequest();
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
+ $this->lang = $this->registry->getClass('class_localization');
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_login' ), 'core' );
-
- $this->lang = $this->registry->getClass('class_localization');
$this->initHanLogin();
@@ -118,7 +114,6 @@ class admin_core_login_manualResolver extends ipsCommand
/**
* Check and verify the login was successful
*
- * @access public
* @return void
*/
public function loginComplete()
@@ -136,13 +131,22 @@ class admin_core_login_manualResolver extends ipsCommand
// Is this a username or email address?
//-----------------------------------------
- if( IPSText::checkEmailAddress( $this->request['username'] ) )
+ $_type = $this->han_login->emailOrUsername();
+
+ switch( $_type )
{
- $email = $this->request['username'];
- }
- else
- {
- $username = $this->request['username'];
+ case 1:
+ $username = $this->request['username'];
+ break;
+
+ case 2:
+ $email = $this->request['username'];
+ break;
+
+ case 3:
+ $username = $this->request['username'];
+ $email = $this->request['username'];
+ break;
}
//-----------------------------------------
@@ -150,7 +154,7 @@ class admin_core_login_manualResolver extends ipsCommand
//-----------------------------------------
$this->han_login->loginAuthenticate( $username, $email, trim($this->request['password']) );
-
+
//-----------------------------------------
// Check return code...
//-----------------------------------------
@@ -255,7 +259,6 @@ class admin_core_login_manualResolver extends ipsCommand
/**
* Log the user out
*
- * @access public
* @return void
*/
public function loginOut()
@@ -265,13 +268,7 @@ class admin_core_login_manualResolver extends ipsCommand
//-----------------------------------------
$this->DB->delete( 'core_sys_cp_sessions', "session_id='" . $this->request['adsess'] . "'" );
-
- //-----------------------------------------
- // Bash cookie
- //-----------------------------------------
-
- IPSCookie::set("ipb3AcpSessionId", 'x', -1);
-
+
//-----------------------------------------
// Redirect...
//-----------------------------------------
@@ -282,7 +279,6 @@ class admin_core_login_manualResolver extends ipsCommand
/**
* Log the user out
*
- * @access public
* @param string Message to show on the form
* @return void
*/
@@ -327,12 +323,12 @@ class admin_core_login_manualResolver extends ipsCommand
{
$login_methods[ $method['login_folder_name'] ] = $method['login_folder_name'];
- if( $method['login_user_id'] == 'username' )
+ if( $method['login_user_id'] == 'username' or $method['login_user_id'] == 'either' )
{
$uses_name = true;
}
- if( $method['login_user_id'] == 'email' )
+ if( $method['login_user_id'] == 'email' or $method['login_user_id'] == 'either' )
{
$uses_email = true;
}
@@ -363,7 +359,6 @@ class admin_core_login_manualResolver extends ipsCommand
/**
* Write to the admin log in loggy ma log
*
- * @access private
* @param string Username
* @param string ok/fail flag
* @return void
diff --git a/upload/admin/applications/core/modules_admin/logs/adminlogs.php b/upload/admin/applications/core/modules_admin/logs/adminlogs.php
index 6fdc36d3..a867c787 100644
--- a/upload/admin/applications/core/modules_admin/logs/adminlogs.php
+++ b/upload/admin/applications/core/modules_admin/logs/adminlogs.php
@@ -1,19 +1,21 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Admin logs
- * Last Updated: $LastChangedDate: 2009-12-07 09:26:30 -0500 (Mon, 07 Dec 2009) $
+ * Last Updated: $LastChangedDate: 2010-06-15 21:25:19 -0400 (Tue, 15 Jun 2010) $
+ *
*
- * @author $Author: mark $
+ * @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 27th January 2004
- * @version $Rev: 5526 $
+ * @version $Rev: 6539 $
*/
if ( ! defined( 'IN_ACP' ) )
@@ -27,18 +29,18 @@ class admin_core_logs_adminlogs extends ipsCommand
/**
* Generate some pretty colors for the logs
*
- * @access private
+ * @access protected
* @var array Different colors for different actions
*/
- private $colours = array();
+ protected $colours = array();
/**
* Skin object
*
- * @access private
+ * @access protected
* @var object Skin templates
*/
- private $html;
+ protected $html;
/**
* Main class entry point
@@ -123,10 +125,10 @@ class admin_core_logs_adminlogs extends ipsCommand
/**
* View all logs for a given admin
*
- * @access private
+ * @access protected
* @return void [Outputs to screen]
*/
- private function _view()
+ protected function _view()
{
///----------------------------------------
// Basic init
@@ -251,10 +253,10 @@ class admin_core_logs_adminlogs extends ipsCommand
/**
* Remove logs by an admin
*
- * @access private
+ * @access protected
* @return void [Outputs to screen]
*/
- private function _remove()
+ protected function _remove()
{
if ( $this->request['mid'] == "" )
{
@@ -269,10 +271,10 @@ class admin_core_logs_adminlogs extends ipsCommand
/**
* List the current logs with links to view per-admin
*
- * @access private
+ * @access protected
* @return void [Outputs to screen]
*/
- private function _listCurrent()
+ protected function _listCurrent()
{
$rows = array();
$admins = array();
@@ -321,7 +323,7 @@ class admin_core_logs_adminlogs extends ipsCommand
while ( $r = $this->DB->fetch() )
{
$_members[] = $r['member_id'];
- $_store[ $r['member_id'] ] = $r;
+ $admins[ $r['member_id'] ] = $r;
}
if ( !empty( $_members ) )
@@ -334,7 +336,7 @@ class admin_core_logs_adminlogs extends ipsCommand
while ( $r = $this->DB->fetch() )
{
- $admins[] = array_merge( $r, $_store[ $r['member_id'] ] );
+ $admins[ $r['member_id'] ] = array_merge( $r, $admins[ $r['member_id'] ] );
}
}
diff --git a/upload/admin/applications/core/modules_admin/logs/defaultSection.php b/upload/admin/applications/core/modules_admin/logs/defaultSection.php
index 9e4a820d..11bd6227 100644
--- a/upload/admin/applications/core/modules_admin/logs/defaultSection.php
+++ b/upload/admin/applications/core/modules_admin/logs/defaultSection.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Define the default logs section
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4948 $
+ * @version $Rev: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_admin/logs/emailerrorlogs.php b/upload/admin/applications/core/modules_admin/logs/emailerrorlogs.php
index 7a5d84b2..f9e70ac2 100644
--- a/upload/admin/applications/core/modules_admin/logs/emailerrorlogs.php
+++ b/upload/admin/applications/core/modules_admin/logs/emailerrorlogs.php
@@ -1,280 +1,282 @@
-Incorrect accessYou 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§ion=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();
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Email error logs
+ * Last Updated: $LastChangedDate: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 27th January 2004
+ * @version $Rev: 5713 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access 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§ion=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();
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/logs/emaillogs.php b/upload/admin/applications/core/modules_admin/logs/emaillogs.php
index 2c41edad..2020a1db 100644
--- a/upload/admin/applications/core/modules_admin/logs/emaillogs.php
+++ b/upload/admin/applications/core/modules_admin/logs/emaillogs.php
@@ -1,426 +1,428 @@
-Incorrect accessYou 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§ion=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();
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Email logs
+ * Last Updated: $LastChangedDate: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 27th January 2004
+ * @version $Rev: 5713 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access 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§ion=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();
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/logs/errorlogs.php b/upload/admin/applications/core/modules_admin/logs/errorlogs.php
index eb1f57b6..2fdec191 100644
--- a/upload/admin/applications/core/modules_admin/logs/errorlogs.php
+++ b/upload/admin/applications/core/modules_admin/logs/errorlogs.php
@@ -1,19 +1,21 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Error logs
- * Last Updated: $LastChangedDate: 2009-11-23 12:23:43 -0500 (Mon, 23 Nov 2009) $
+ * Last Updated: $LastChangedDate: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 27th January 2004
- * @version $Rev: 5457 $
+ * @version $Rev: 5713 $
*/
if ( ! defined( 'IN_ACP' ) )
diff --git a/upload/admin/applications/core/modules_admin/logs/index.html b/upload/admin/applications/core/modules_admin/logs/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/logs/index.html
+++ b/upload/admin/applications/core/modules_admin/logs/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/logs/mobilelogs.php b/upload/admin/applications/core/modules_admin/logs/mobilelogs.php
new file mode 100644
index 00000000..f96db259
--- /dev/null
+++ b/upload/admin/applications/core/modules_admin/logs/mobilelogs.php
@@ -0,0 +1,191 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Mobile Notification logs
+ * Last Updated: $LastChangedDate: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 5713 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+class admin_core_logs_mobilelogs 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_mobilelogs');
+
+ //-----------------------------------------
+ // Set up stuff
+ //-----------------------------------------
+
+ $this->form_code = $this->html->form_code = 'module=logs§ion=mobilelogs';
+ $this->form_code_js = $this->html->form_code_js = 'module=logs§ion=mobilelogs';
+
+ //-----------------------------------------
+ // 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=mobilelogs', $this->lang->words['mlog_mobilelogs'] );
+
+ ///----------------------------------------
+ // What to do...
+ //-----------------------------------------
+
+ switch( $this->request['do'] )
+ {
+ case 'remove':
+ $this->_remove();
+ break;
+
+ default:
+ $this->_listCurrent();
+ break;
+ }
+
+ /* Output */
+ $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * Remove log
+ *
+ * @access private
+ * @return void [Outputs to screen]
+ */
+ protected function _remove()
+ {
+ if( $this->request['type'] == 'all' )
+ {
+ $this->DB->delete( 'mobile_notifications' );
+ }
+ 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( 'mobile_notifications', "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' => 'mobile_notifications' ) );
+
+ $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' => 'n.*',
+ 'from' => array( 'mobile_notifications' => 'n' ),
+ 'order' => 'n.notify_date DESC',
+ 'limit' => array( $st, $perPage ),
+ 'add_join' => array(
+ array(
+ 'select' => 'm.members_display_name',
+ 'from' => array( 'members' => 'm' ),
+ 'where' => 'm.member_id=n.member_id',
+ 'type' => 'left'
+ )
+ )
+ ) );
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $row['_time'] = $this->registry->class_localization->getDate( $row['notify_date'], 'LONG' );
+ $row['notify_title'] = strip_tags( $row['notify_title'] );
+ $row['_sent'] = $row['notify_sent'] ? 'aff_tick.png' : 'aff_cross.png';
+
+ $rows[] = $row;
+ }
+
+ //-----------------------------------------
+ // And output
+ //-----------------------------------------
+
+ $this->registry->output->html .= $this->html->mobileLogsWrapper( $rows, $pageLinks );
+ }
+}
diff --git a/upload/admin/applications/core/modules_admin/logs/modlogs.php b/upload/admin/applications/core/modules_admin/logs/modlogs.php
index 712dbdc9..f54f477b 100644
--- a/upload/admin/applications/core/modules_admin/logs/modlogs.php
+++ b/upload/admin/applications/core/modules_admin/logs/modlogs.php
@@ -1,337 +1,339 @@
-Incorrect accessYou 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§ion=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 );
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Moderator logs
+ * Last Updated: $LastChangedDate: 2010-09-24 21:21:39 -0400 (Fri, 24 Sep 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 27th January 2004
+ * @version $Rev: 6915 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access 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 protected
+ * @var object Skin templates
+ */
+ protected $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§ion=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 protected
+ * @return void [Outputs to screen]
+ */
+ protected 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 protected
+ * @return void [Outputs to screen]
+ */
+ protected 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 protected
+ * @return void [Outputs to screen]
+ */
+ protected 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'];
+ $admins[ $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[ $r['member_id'] ] = array_merge( $r, $admins[ $r['member_id'] ] );
+ }
+ }
+
+ //-----------------------------------------
+ // And output
+ //-----------------------------------------
+
+ $this->registry->output->html .= $this->html->modlogsWrapper( $rows, $admins );
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/logs/spamlogs.php b/upload/admin/applications/core/modules_admin/logs/spamlogs.php
index ac5e7b78..7c868a83 100644
--- a/upload/admin/applications/core/modules_admin/logs/spamlogs.php
+++ b/upload/admin/applications/core/modules_admin/logs/spamlogs.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Admin logs
- * Last Updated: $LastChangedDate$
+ * Last Updated: $LastChangedDate: 2010-09-30 21:47:05 -0400 (Thu, 30 Sep 2010) $
+ *
*
- * @author $Author$
+ * @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
- * @version $Rev$
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6929 $
*/
if ( ! defined( 'IN_ACP' ) )
@@ -78,10 +80,6 @@ class admin_core_logs_spamlogs extends ipsCommand
case 'remove':
$this->_remove();
break;
-
- case 'testapi':
- $this->_testApiConnection();
- break;
default:
$this->_listCurrent();
@@ -92,14 +90,6 @@ class admin_core_logs_spamlogs extends ipsCommand
$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
@@ -155,24 +145,38 @@ class admin_core_logs_spamlogs extends ipsCommand
$rows = array();
$st = $this->request['st'] ? intval( $this->request['st'] ) : 0;
$perPage = 25;
+ $where = '';
+ $qs = '';
+
+ if( $this->request['search_term'] )
+ {
+ $where = "log_msg LIKE '%{$this->request['search_term']}%' OR email_address LIKE '%{$this->request['search_term']}%'";
+ $qs = '&search_term=' . $this->request['search_term'];
+ }
/* Pagination */
- $total = $this->DB->buildAndFetch( array( 'select' => 'count(*) as logs', 'from' => 'spam_service_log' ) );
+ $total = $this->DB->buildAndFetch( array( 'select' => 'count(*) as logs', 'from' => 'spam_service_log', 'where' => $where ) );
+ if( $this->request['search_term'] )
+ {
+ $this->registry->output->global_message = sprintf( $this->lang->words['spamlog_sresults'], $total['logs'] );
+ }
+
$pageLinks = $this->registry->output->generatePagination( array(
'totalItems' => $total['logs'],
'itemsPerPage' => $perPage,
'currentStartValue' => $st,
- 'baseUrl' => $this->settings['base_url'] . $this->form_code,
+ 'baseUrl' => $this->settings['base_url'] . $this->form_code . $qs,
) );
/* Query the logs */
$this->DB->build( array(
- 'select' => '*',
- 'from' => 'spam_service_log',
- 'order' => 'log_date DESC',
- 'limit' => array( $st, $perPage ),
- ) );
+ 'select' => '*',
+ 'from' => 'spam_service_log',
+ 'order' => 'log_date DESC',
+ 'where' => $where,
+ 'limit' => array( $st, $perPage ),
+ ) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
diff --git a/upload/admin/applications/core/modules_admin/logs/spiderlogs.php b/upload/admin/applications/core/modules_admin/logs/spiderlogs.php
index 42b33a01..48bcfdda 100644
--- a/upload/admin/applications/core/modules_admin/logs/spiderlogs.php
+++ b/upload/admin/applications/core/modules_admin/logs/spiderlogs.php
@@ -1,287 +1,289 @@
-Incorrect accessYou 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§ion=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 = "settings['php_ext'] . "?{$row['query_string']}' target='_blank'>" . IPSText::truncate($row['query_string']) . " ";
- }
-
- $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 );
-
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Search Engine Spider logs
+ * Last Updated: $LastChangedDate: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 27th January 2004
+ * @version $Rev: 5713 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access 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§ion=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 = "settings['php_ext'] . "?{$row['query_string']}' target='_blank'>" . IPSText::truncate($row['query_string']) . " ";
+ }
+
+ $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 );
+
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/logs/sqlerror.php b/upload/admin/applications/core/modules_admin/logs/sqlerror.php
new file mode 100644
index 00000000..e7566453
--- /dev/null
+++ b/upload/admin/applications/core/modules_admin/logs/sqlerror.php
@@ -0,0 +1,208 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * SQL error logs
+ * Last Updated: $LastChangedDate: 2010-06-16 02:25:19 +0100 (Wed, 16 Jun 2010) $
+ *
+ *
+ * @author $Author: matt $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 27th January 2004
+ * @version $Rev: 6539 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+class admin_core_logs_sqlerror extends ipsCommand
+{
+ /**
+ * Skin object
+ *
+ * @var object Skin templates
+ */
+ protected $html;
+
+ /**
+ * Main class entry point
+ *
+ * @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§ion=sqlerror';
+ $this->form_code_js = $this->html->form_code_js = 'module=logs§ion=sqlerror';
+
+ //-----------------------------------------
+ // 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=sqlerror', $this->lang->words['mlog_sqlerrors'] );
+
+ ///----------------------------------------
+ // What to do...
+ //-----------------------------------------
+
+ switch( $this->request['do'] )
+ {
+ case 'view':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sqlerrorlogs_view' );
+ $this->_view();
+ break;
+
+ case 'remove':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sqlerrorlogs_delete' );
+ $this->_remove();
+ break;
+
+ default:
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sqlerrorlogs_view' );
+ $this->_listCurrent();
+ break;
+ }
+
+ /* Output */
+ $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * View an SQL log
+ *
+ * @return void [Outputs to screen]
+ */
+ protected function _view()
+ {
+ /* INIT */
+ $file = trim( $this->request['file'] );
+
+ /* Check file name */
+ if ( ! preg_match( "#^sql_error_log_(\d+)_(\d+)_(\d+).cgi$#", $file ) OR ! file_exists( IPS_CACHE_PATH . 'cache/' . $file ) )
+ {
+ $this->registry->output->global_message = $this->lang->words['sqllog_nofile'];
+ $this->_listCurrent();
+ return;
+ }
+
+ /* Fetch size */
+ $size = @filesize( IPS_CACHE_PATH . 'cache/' . $file );
+
+ /* Fetch content */
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classFileManagement.php', 'classFileManagement' );
+ $classFileManagement = new $classToLoad();
+
+ /* Get some tail! */
+ $content = $classFileManagement->tailFile( IPS_CACHE_PATH . 'cache/' . $file, 300 );
+
+ /* Can't believe I typed that last comment */
+ $this->registry->output->html .= $this->html->sqlLogsView( $file, $size, $content );
+ }
+
+ /**
+ * Remove logs by an admin
+ *
+ * @return void [Outputs to screen]
+ */
+ protected function _remove()
+ {
+ /* INIT */
+ $file = trim( $this->request['file'] );
+
+ /* Check file name */
+ if ( ! preg_match( "#^sql_error_log_(\d+)_(\d+)_(\d+).cgi$#", $file ) OR ! file_exists( IPS_CACHE_PATH . 'cache/' . $file ) )
+ {
+ $this->registry->output->global_message = $this->lang->words['sqllog_nofile'];
+ $this->_listCurrent();
+ return;
+ }
+
+ @unlink( IPS_CACHE_PATH . 'cache/' . $file );
+
+ $this->registry->output->global_message = $this->lang->words['sqllog_removed'];
+ $this->_listCurrent();
+ }
+
+ /**
+ * List the current SQL logs
+ *
+ * @return void [Outputs to screen]
+ */
+ protected function _listCurrent()
+ {
+ $rows = array();
+
+ /* Got a latest? */
+ if ( file_exists( IPS_CACHE_PATH . 'cache/sql_error_latest.cgi' ) )
+ {
+ $unix = @filemtime( IPS_CACHE_PATH . 'cache/sql_error_latest.cgi' );
+
+ if ( $unix )
+ {
+ $mtime = gmdate( 'd-j-Y', $unix );
+ $now = gmdate( 'd-j-Y', time() );
+
+ if ( $mtime == $now )
+ {
+ $contents = file_get_contents( IPS_CACHE_PATH . 'cache/sql_error_latest.cgi' );
+
+ /* Display a message */
+ $this->registry->output->global_message = sprintf( $this->lang->words['sqllog_latest'], $this->registry->class_localization->getDate( $unix, 'LONG' ), $contents );
+ }
+ }
+ }
+
+ try
+ {
+ foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . 'cache' ) as $file )
+ {
+ if ( $file->isDot() OR ! $file->isFile() )
+ {
+ continue;
+ }
+
+ if ( preg_match( "#^sql_error_log_(\d+)_(\d+)_(\d+).cgi$#", $file->getFilename(), $matches ) )
+ {
+ $rows[] = array( 'name' => $file->getFilename(),
+ 'mtime' => $file->getMTime(),
+ 'size' => $file->getSize() );
+ }
+ }
+ } catch ( Exception $e ) {}
+
+ //-----------------------------------------
+ // And output
+ //-----------------------------------------
+
+ $this->registry->output->html .= $this->html->sqllogsWrapper( $rows );
+ }
+}
diff --git a/upload/admin/applications/core/modules_admin/logs/warnlogs.php b/upload/admin/applications/core/modules_admin/logs/warnlogs.php
index e728e399..7fbc1888 100644
--- a/upload/admin/applications/core/modules_admin/logs/warnlogs.php
+++ b/upload/admin/applications/core/modules_admin/logs/warnlogs.php
@@ -1,19 +1,21 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Warn logs
- * Last Updated: $LastChangedDate: 2009-12-07 09:26:30 -0500 (Mon, 07 Dec 2009) $
+ * Last Updated: $LastChangedDate: 2010-05-19 21:06:53 -0400 (Wed, 19 May 2010) $
+ *
*
- * @author $Author: mark $
+ * @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 27th January 2004
- * @version $Rev: 5526 $
+ * @version $Rev: 6326 $
*/
if ( ! defined( 'IN_ACP' ) )
@@ -335,7 +337,7 @@ class admin_core_logs_warnlogs extends ipsCommand
$row['_date'] = $this->registry->class_localization->getDate( $row['wlog_date'], 'LONG' );
$row['_type'] = ( $row['wlog_type'] == 'pos' ) ? '- ' : '+ ';
$row['_type'] = ( $row['wlog_type'] == 'custom' ) ? 'C ' : $row['_type'];
- $row['_cont'] = ( $row['wlog_contact'] != 'none' ) ? "form_code}&do=viewcontact&id={$row['wlog_id']}\",400,400,\"{$this->lang->words['wlog_log']}\"); return false;'> " : ' ';
+ $row['_cont'] = ( $row['wlog_contact'] != 'none' ) ? "form_code}&do=viewcontact&id={$row['wlog_id']}\",400,400,\"{$this->lang->words['wlog_log']}\"); return false;'> " : ' ';
$rows[] = $row;
}
@@ -358,7 +360,7 @@ class admin_core_logs_warnlogs extends ipsCommand
while ( $r = $this->DB->fetch() )
{
$_members[] = $r['wlog_mid'];
- $_store[ $r['wlog_mid'] ] = $r;
+ $members[ $r['wlog_mid'] ] = $r;
}
if ( !empty( $_members ) )
@@ -371,7 +373,7 @@ class admin_core_logs_warnlogs extends ipsCommand
while ( $r = $this->DB->fetch() )
{
- $members[] = array_merge( $r, $_store[ $r['member_id'] ] );
+ $members[ $r['member_id'] ] = array_merge( $r, $members[ $r['member_id'] ] );
}
}
diff --git a/upload/admin/applications/core/modules_admin/logs/xml/index.html b/upload/admin/applications/core/modules_admin/logs/xml/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/logs/xml/index.html
+++ b/upload/admin/applications/core/modules_admin/logs/xml/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/logs/xml/permissions.xml b/upload/admin/applications/core/modules_admin/logs/xml/permissions.xml
index 7fb764ea..ac1ccbf8 100644
--- a/upload/admin/applications/core/modules_admin/logs/xml/permissions.xml
+++ b/upload/admin/applications/core/modules_admin/logs/xml/permissions.xml
@@ -91,4 +91,17 @@
+
+ SQL Error Logs
+
+ -
+
sqlerrorlogs_view
+ Can view SQL error logs?
+
+ -
+
sqlerrorlogs_delete
+ Can delete SQL error logs?
+
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/mycp/dashboard.php b/upload/admin/applications/core/modules_admin/mycp/dashboard.php
index f6945a38..d9541fc1 100644
--- a/upload/admin/applications/core/modules_admin/mycp/dashboard.php
+++ b/upload/admin/applications/core/modules_admin/mycp/dashboard.php
@@ -1,20 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Dashboard
- * Last Updated: $Date: 2009-12-01 17:42:17 -0500 (Tue, 01 Dec 2009) $
+ * Last Updated: $Date: 2010-10-27 05:50:09 -0400 (Wed, 27 Oct 2010) $
+ *
*
- * @author $Author: josh $
+ * @author $Author: mmecham $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 5th January 2005
- * @version $Revision: 5501 $
- *
+ * @version $Revision: 7049 $
*/
if ( ! defined( 'IN_ACP' ) )
@@ -28,31 +28,27 @@ class admin_core_mycp_dashboard extends ipsCommand
/**
* Skin object
*
- * @access private
* @var object Skin templates
*/
- private $html;
+ protected $html;
/**
* Shortcut for url
*
- * @access private
* @var string URL shortcut
*/
- private $form_code;
+ protected $form_code;
/**
* Shortcut for url (javascript)
*
- * @access private
* @var string JS URL shortcut
*/
- private $form_code_js;
+ protected $form_code_js;
/**
* Main class entry point
*
- * @access public
* @param object ipsRegistry reference
* @return void [Outputs to screen]
*/
@@ -89,54 +85,11 @@ class admin_core_mycp_dashboard extends ipsCommand
// 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
@@ -185,8 +138,6 @@ class admin_core_mycp_dashboard extends ipsCommand
// Licensed?
//-----------------------------------------
- $urls['keiths_bits'] = IPS_BULLETINS_URL . '?v=' . ipsRegistry::$vn_full;
-
//-----------------------------------------
// Notepad
//-----------------------------------------
@@ -199,7 +150,7 @@ class admin_core_mycp_dashboard extends ipsCommand
$text = $this->lang->words['cp_acpnotes'];
- if ( !$this->cache->getCache('adminnotes') OR !$this->cache->getCache('adminnotes') )
+ if ( !$this->cache->getCache('adminnotes') )
{
$this->cache->setCache( 'adminnotes', $text, array( 'donow' => 1, 'array' => 0 ) );
}
@@ -273,55 +224,6 @@ class admin_core_mycp_dashboard extends ipsCommand
$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?
//-----------------------------------------
@@ -379,8 +281,8 @@ class admin_core_mycp_dashboard extends ipsCommand
// 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) );
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/forums/class_forums.php', 'class_forums', 'forums' );
+ $this->registry->setClass( 'class_forums', new $classToLoad($this->registry) );
$this->registry->getClass('class_forums')->forumsInit();
$forums = $this->registry->getClass('class_forums')->forumsForumJump( 1 );
@@ -401,43 +303,7 @@ class admin_core_mycp_dashboard extends ipsCommand
// 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'], "{$this->lang->words['rebuild_furl_cache']} " ) . " ";
- $this->registry->output->html = str_replace( '', $_html . '', $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'] ) . " ";
- $this->registry->output->html = str_replace( '', $_html . '', $this->registry->output->html );
- }
+ $this->registry->output->html .= $this->html->mainTemplate( $content, $forums, $groups_html, $urls, $this->getNotificationPanelEntries() );
//-----------------------------------------
// Left log all on?
@@ -449,11 +315,6 @@ class admin_core_mycp_dashboard extends ipsCommand
$this->registry->output->html = str_replace( '', $_html . '', $this->registry->output->html );
}
- if ( count( $tasksContent ) )
- {
- $_html .= $this->html->warning_box( $this->lang->words['cp_taskssneedup'], implode( $tasksContent, " " ) . "{$this->lang->words['cp_clickhere']} {$this->lang->words['cp_clickhere_info']}.");
- }
-
//-----------------------------------------
// IN DEV stuff...
//-----------------------------------------
@@ -484,7 +345,7 @@ class admin_core_mycp_dashboard extends ipsCommand
$_mtime = $this->registry->getClass( 'class_localization')->getDate( $lastMtime , 'JOINED' );
$_dbtime = $this->registry->getClass( 'class_localization')->getDate( $lastDBtime, 'JOINED' );
- $content[] = "" . $app['app_title'] . " {$this->lang->words['cp_settingsupdated']}. -- {$this->lang->words['cp_lastimportrun']}: {$_dbtime} -- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
+ $content[] = "" . $data['app_title'] . " {$this->lang->words['cp_settingsupdated']}. -- {$this->lang->words['cp_lastimportrun']}: {$_dbtime} -- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
}
/* Modules */
@@ -496,7 +357,7 @@ class admin_core_mycp_dashboard extends ipsCommand
$_mtime = $this->registry->getClass( 'class_localization')->getDate( $lastMtime , 'JOINED' );
$_dbtime = $this->registry->getClass( 'class_localization')->getDate( $lastDBtime, 'JOINED' );
- $modContent[] = "" . $app['app_title'] . " {$this->lang->words['cp_modulessneedup']}. -- {$this->lang->words['cp_lastimportrun']}: {$_dbtime} -- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
+ $modContent[] = "" . $data['app_title'] . " {$this->lang->words['cp_modulessneedup']}. -- {$this->lang->words['cp_lastimportrun']}: {$_dbtime} -- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
}
/* Tasks */
@@ -508,7 +369,7 @@ class admin_core_mycp_dashboard extends ipsCommand
$_mtime = $this->registry->getClass( 'class_localization')->getDate( $lastMtime , 'JOINED' );
$_dbtime = $this->registry->getClass( 'class_localization')->getDate( $lastDBtime, 'JOINED' );
- $tasksContent[] = "" . $app['app_title'] . " {$this->lang->words['cp_taskssneedup']}. -- {$this->lang->words['cp_lastimportrun']}: {$_dbtime} -- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
+ $tasksContent[] = "" . $data['app_title'] . " {$this->lang->words['cp_taskssneedup']}. -- {$this->lang->words['cp_lastimportrun']}: {$_dbtime} -- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
}
/* Help Files */
@@ -520,7 +381,7 @@ class admin_core_mycp_dashboard extends ipsCommand
$_mtime = $this->registry->getClass( 'class_localization')->getDate( $lastMtime , 'JOINED' );
$_dbtime = $this->registry->getClass( 'class_localization')->getDate( $lastDBtime, 'JOINED' );
- $helpContent[] = "" . $app['app_title'] . " {$this->lang->words['cp_helpneedup']}. -- {$this->lang->words['cp_lastimportrun']}: {$_dbtime} -- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
+ $helpContent[] = "" . $data['app_title'] . " {$this->lang->words['cp_helpneedup']}. -- {$this->lang->words['cp_lastimportrun']}: {$_dbtime} -- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
}
/* BBCode Files */
@@ -532,7 +393,7 @@ class admin_core_mycp_dashboard extends ipsCommand
$_mtime = $this->registry->getClass( 'class_localization')->getDate( $lastMtime , 'JOINED' );
$_dbtime = $this->registry->getClass( 'class_localization')->getDate( $lastDBtime, 'JOINED' );
- $bbContent[] = "" . $app['app_title'] . " {$this->lang->words['cp_bbcodeneedup']}. -- {$this->lang->words['cp_lastimportrun']}: {$_dbtime} -- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
+ $bbContent[] = "" . $data['app_title'] . " {$this->lang->words['cp_bbcodeneedup']}. -- {$this->lang->words['cp_lastimportrun']}: {$_dbtime} -- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
}
}
@@ -575,92 +436,18 @@ class admin_core_mycp_dashboard extends ipsCommand
}
}
- //-----------------------------------------
- // 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() ) . " ";
-
- $this->registry->output->html = str_replace( '', $installer, $this->registry->output->html );
- }
- else
- {
- $installer = $this->html->warning_box( $this->lang->words['cp_installerpresent'], $this->html->warning_installer() ) . " ";
-
- $this->registry->output->html = str_replace( '', $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) ) . " ";
-
- $this->registry->output->html = str_replace( '', $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() ) . " ";
-
- $this->registry->output->html = str_replace( '', $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() ) . " ";
-
- $this->registry->output->html = str_replace( '', $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']} » {$this->lang->words['cp_boardoffline2']} " ) . " ";
-
- $this->registry->output->html = str_replace( '', $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']} » {$this->lang->words['fulltext_find']} " ) . " ";
-
- $this->registry->output->html = str_replace( '', $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' ) )
+ if( $this->registry->getClass('class_permissions')->checkPermission( 'acplogin_log', 'core', 'system' ) )
{
$this->DB->build( array(
'select' => '*',
'from' => 'admin_login_logs',
+ 'where' => 'admin_time > 0', // This just helps mysql use the index properly, which is useful for sorting
'order' => 'admin_time DESC',
'limit' => array( 0, 5 )
) );
@@ -685,4 +472,56 @@ class admin_core_mycp_dashboard extends ipsCommand
$this->registry->getClass('output')->html_main .= $this->registry->getClass('output')->global_template->global_frame_wrapper();
$this->registry->getClass('output')->sendOutput();
}
+
+ /**
+ * Builds a list of nag panel entries
+ *
+ * @return array
+ */
+ public function getNotificationPanelEntries()
+ {
+ /* INIT */
+ $entries = array();
+
+ /* Look for notification classes */
+ foreach( ipsRegistry::$applications as $r )
+ {
+ if ( ! IPSLib::appIsInstalled( $r['app_directory'] ) )
+ {
+ continue;
+ }
+
+ /* Notification Class */
+ $_file = IPSLib::getAppDir( $r['app_directory'] ) . '/extensions/dashboardNotifications.php';
+
+ /* Look for the file */
+ if( file_exists( $_file ) )
+ {
+ /* Get the file */
+ $_class = IPSLib::loadLibrary( $_file, 'dashboardNotifications__' . $r['app_directory'], $r['app_directory'] );
+
+ /* Look for the class */
+ if( class_exists( $_class ) )
+ {
+ /* Create the object */
+ $notifyObj = new $_class;
+
+ /* Look for the method */
+ if( method_exists( $notifyObj, 'get' ) )
+ {
+ /* Get the entries */
+ $_entries = $notifyObj->get();
+
+ if( is_array( $_entries ) && count( $_entries ) )
+ {
+ $entries = array_merge( $entries, $_entries );
+ }
+ }
+ }
+ }
+ }
+
+ /* Return entries */
+ return $entries;
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/mycp/defaultSection.php b/upload/admin/applications/core/modules_admin/mycp/defaultSection.php
index d9dbaa9e..6c51b2f6 100644
--- a/upload/admin/applications/core/modules_admin/mycp/defaultSection.php
+++ b/upload/admin/applications/core/modules_admin/mycp/defaultSection.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Define the default mycp section
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4948 $
+ * @version $Rev: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_admin/mycp/details.php b/upload/admin/applications/core/modules_admin/mycp/details.php
index 2567c76e..a1561e9c 100644
--- a/upload/admin/applications/core/modules_admin/mycp/details.php
+++ b/upload/admin/applications/core/modules_admin/mycp/details.php
@@ -1,20 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Admin change email/password
- * Last Updated: $Date: 2009-05-20 09:25:28 -0400 (Wed, 20 May 2009) $
+ * Last Updated: $Date: 2010-10-18 13:10:17 -0400 (Mon, 18 Oct 2010) $
+ *
*
- * @author $Author: bfarber $
+ * @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 5th January 2005
- * @version $Revision: 4674 $
- *
+ * @version $Revision: 6990 $
*/
if ( ! defined( 'IN_ACP' ) )
@@ -28,7 +28,6 @@ class admin_core_mycp_details extends ipsCommand
/**
* Skin object
*
- * @access private
* @var object Skin templates
*/
private $html;
@@ -36,7 +35,6 @@ class admin_core_mycp_details extends ipsCommand
/**
* Main class entry point
*
- * @access public
* @param object ipsRegistry reference
* @return void [Outputs to screen]
*/
@@ -88,7 +86,6 @@ class admin_core_mycp_details extends ipsCommand
/**
* Show the form so admin can reset email/pass
*
- * @access protected
* @return void
*/
protected function _showForm()
@@ -99,7 +96,6 @@ class admin_core_mycp_details extends ipsCommand
/**
* Save new email and/or pass
*
- * @access protected
* @return void
*/
protected function _saveForm()
@@ -129,15 +125,17 @@ class admin_core_mycp_details extends ipsCommand
$email = trim($this->request['email']);
$email_check = IPSMember::load( mb_strtolower($email) );
- if ( $email_check['member_id'] AND $email_check['member_id'] != $member_id )
+ if ( $email_check['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'];
+ if ( $email_check['member_id'] == $this->memberData['member_id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['already_using_email'];
+ }
+ else
+ {
+ $this->registry->output->global_message = $this->lang->words['change_email_already_used'];
+ }
+
$this->_showForm();
return;
}
@@ -146,15 +144,15 @@ class admin_core_mycp_details extends ipsCommand
// Load handler...
//-----------------------------------------
- require_once( IPS_ROOT_PATH . 'sources/handlers/han_login.php' );
- $han_login = new han_login( $this->registry );
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $han_login = new $classToLoad( $this->registry );
$han_login->init();
- $han_login->changeEmail( trim( mb_strtolower( $this->memberData['email'] ) ), trim( mb_strtolower( $email ) ) );
+ $han_login->changeEmail( trim( mb_strtolower( $this->memberData['email'] ) ), trim( mb_strtolower( $email ) ), $this->memberData );
+ IPSLib::runMemberSync( 'onEmailChange', $this->memberData['member_id'], mb_strtolower( $email ), $this->memberData['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 ) );
}
@@ -178,10 +176,10 @@ class admin_core_mycp_details extends ipsCommand
$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 );
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $han_login = new $classToLoad( $this->registry );
$han_login->init();
- $han_login->changePass( $this->memberData['email'], $md5_once );
+ $han_login->changePass( $this->memberData['email'], $md5_once, $password, $this->memberData );
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 );
diff --git a/upload/admin/applications/core/modules_admin/mycp/index.html b/upload/admin/applications/core/modules_admin/mycp/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/mycp/index.html
+++ b/upload/admin/applications/core/modules_admin/mycp/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/mycp/xml/index.html b/upload/admin/applications/core/modules_admin/mycp/xml/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/mycp/xml/index.html
+++ b/upload/admin/applications/core/modules_admin/mycp/xml/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/posts/badwords.php b/upload/admin/applications/core/modules_admin/posts/badwords.php
index 79da2d28..026c81d0 100644
--- a/upload/admin/applications/core/modules_admin/posts/badwords.php
+++ b/upload/admin/applications/core/modules_admin/posts/badwords.php
@@ -1,425 +1,427 @@
-Incorrect accessYou 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§ion=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;
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Bad Word Filters
+ * Last Updated: $LastChangedDate: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 27th January 2004
+ * @version $Rev: 5713 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access 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§ion=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;
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/posts/bbcode.php b/upload/admin/applications/core/modules_admin/posts/bbcode.php
index 6011ae0d..e840f51c 100644
--- a/upload/admin/applications/core/modules_admin/posts/bbcode.php
+++ b/upload/admin/applications/core/modules_admin/posts/bbcode.php
@@ -1,842 +1,841 @@
-Incorrect accessYou 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§ion=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( " ", $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( " ", $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 ) );
- }
-
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * BBCode Management
+ * Last Updated: $LastChangedDate: 2010-09-29 20:23:38 -0400 (Wed, 29 Sep 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 27th January 2004
+ * @version $Rev: 6925 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access 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§ion=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( " ", $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( " ", $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_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';
+ $bbcode_regex = ( $entry['bbcode_custom_regex'] ) ? $entry['bbcode_custom_regex'] : '';
+
+ 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_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,
+ 'bbcode_custom_regex' => $bbcode_regex,
+ );
+
+ $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_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,
+ 'bbcode_custom_regex' => $bbcode_regex,
+ );
+
+ $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'] && $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_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'],
+ 'bbcode_protected' => intval( $this->request['bbcode_protected'] ),
+ 'bbcode_custom_regex' => str_replace( "\", '\\', IPSText::stripslashes( $_POST['bbcode_custom_regex'] ) ),
+ );
+
+ 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']) ) );
+
+ #Issue 20376
+ $bbcode['bbcode_desc'] = stripslashes( $bbcode['bbcode_desc'] );
+ $bbcode['bbcode_replace'] = stripslashes( $bbcode['bbcode_replace'] );
+ $bbcode['bbcode_example'] = stripslashes( $bbcode['bbcode_example'] );
+
+ 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', 'order' => 'bbcode_title ASC' ) );
+ $this->DB->execute();
+
+ while ( $r = $this->DB->fetch() )
+ {
+ $cache[] = $r;
+ }
+
+ $this->cache->setCache( 'bbcode', $cache, array( 'array' => 1 ) );
+ }
+
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/posts/defaultSection.php b/upload/admin/applications/core/modules_admin/posts/defaultSection.php
index 0e98259b..9e05fed6 100644
--- a/upload/admin/applications/core/modules_admin/posts/defaultSection.php
+++ b/upload/admin/applications/core/modules_admin/posts/defaultSection.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Define the default posts section
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4948 $
+ * @version $Rev: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_admin/posts/emoticons.php b/upload/admin/applications/core/modules_admin/posts/emoticons.php
index b3508bac..b8217e27 100644
--- a/upload/admin/applications/core/modules_admin/posts/emoticons.php
+++ b/upload/admin/applications/core/modules_admin/posts/emoticons.php
@@ -1,1289 +1,1291 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
- exit();
-}
-
-class admin_core_posts_emoticons extends ipsCommand
-{
- /**
- * Allowed file types
- *
- * @access public
- * @var array
- */
- public $allowed_files = array( 'png', 'jpeg', 'jpg', 'gif' );
-
- /**
- * 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_emoticons' );
- $this->html->form_code = '&module=posts§ion=emoticons&';
- $this->html->form_code_js = '&module=posts§ion=emoticons&';
-
- $this->lang->loadLanguageFile( array( 'admin_posts' ) );
-
- //-----------------------------------------
- // What to do...
- //-----------------------------------------
-
- switch( $this->request['do'] )
- {
- case 'emo_packsplash':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_manage' );
- $this->emoticonsPackSplash();
- break;
-
- case 'emo_packexport':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_manage' );
- $this->emoticonsPackExport();
- break;
-
- case 'emo_packimport':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_manage' );
- $this->emoticonsPackImport();
- break;
-
- case 'emo_manage':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_manage' );
- $this->emoticonsManageDirectory();
- break;
-
- case 'emo_doedit':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_edit' );
- $this->emoticonsEdit();
- break;
-
- case 'emo_doadd':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_add' );
- $this->emoticonsAdd();
- break;
-
- case 'emo_remove':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_delete' );
- $this->emoticonsRemove();
- break;
-
- case 'emo_setadd':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_add' );
- $this->emoticonsSetAlter( $type='add' );
- break;
-
- case 'emo_setedit':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_edit' );
- $this->emoticonsSetAlter( $type='edit' );
- break;
-
- case 'emo_setremove':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_delete' );
- $this->emoticonsSetRemove();
- break;
-
- case 'emo_upload':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_add' );
- $this->emoticonsUpload();
- break;
-
- case 'emo':
- case 'overview':
- default:
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_manage' );
- $this->emoticonsOverview();
- break;
- }
-
- /* Output */
- $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
- $this->registry->output->sendOutput();
- }
-
- /**
- * Import an emoticon pack
- *
- * @access public
- * @return void
- */
- public function emoticonsPackImport()
- {
- /* Get the xml file */
- $content = $this->registry->adminFunctions->importXml( 'ipb_emoticons.xml' );
-
- /* Check for content */
- if ( ! $content )
- {
- $this->registry->output->global_message = $this->lang->words['emo_fail'];
- return $this->emoticonsPackSplash();
- }
-
- /* Setup XML */
- require_once( IPS_KERNEL_PATH.'classXML.php' );
- $xml = new classXML( IPS_DOC_CHAR_SET );
-
- require_once( IPS_KERNEL_PATH.'classXMLArchive.php' );
- $xmlarchive = new classXMLArchive();
-
- /* Read the archive */
- $xmlarchive->readXML( $content );
-
- /* Get the data file */
- $emoticons = array();
- $emoticon_data = array();
-
- foreach( $xmlarchive->asArray() as $k => $f )
- {
- if ( $k == 'emoticon_data.xml' )
- {
- $emoticon_data = $f;
- }
- else
- {
- $emoticons[ $f['filename'] ] = $f['content'];
- }
- }
-
- /* Parse the XML Document */
- $xml->loadXML( $emoticon_data['content'] );
-
- /* Make sure we have a destination for these emoicons */
- if ( ! $this->request['emo_set'] and ! $this->request['new_emo_set'] )
- {
- $this->registry->output->global_message = $this->lang->words['emo_specify'];
- }
-
- /* Current emoticon set directory */
- $emo_set_dir = trim( $this->request['emo_set'] );
-
- /* New emoticon set directory */
- $this->request['new_emo_set'] = preg_replace( "/[^a-zA-Z0-9\-_]/", "", $this->request['new_emo_set'] );
-
- /* Create the new set */
- if ( $this->request['new_emo_set'] )
- {
- $emo_set_dir = trim( $this->request['new_emo_set'] );
-
- /* Check to see if the directory already exists */
- if ( file_exists( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $emo_set_dir ) )
- {
- $this->registry->output->global_message = sprintf( $this->lang->words['emo_already'], $emo_set_dir );
- return $this->emoticonsPackSplash();
- }
-
- /* Create the directory */
- if ( @mkdir( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $emo_set_dir, 0777 ) )
- {
- @chmod( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $emo_set_dir, 0777 );
- @file_put_contents( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $emo_set_dir . '/index.html', '' );
- }
- else
- {
- $this->registry->output->global_message = $this->lang->words['emo_ftp'];
- return $this->emoticonsPackSplash();
- }
- }
-
- /* Get a list of current emoticons, if we are not overwriting */
- $emo_image = array();
- $emo_typed = array();
-
- if ( $this->request['overwrite'] != 1 )
- {
- $this->DB->build( array( 'select' => '*', 'from' => 'emoticons', 'where' => "emo_set='".$emo_set_dir."'" ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $emo_image[ $r['image'] ] = 1;
- $emo_typed[ $r['typed'] ] = 1;
- }
- }
-
- /* Loop through the emoticons in the xml document */
- foreach( $xml->fetchElements('emoticon') as $emoticon )
- {
- $entry = $xml->fetchElementsFromRecord( $emoticon );
-
- /* Emoticon Data */
- $image = $entry['image'];
- $typed = $entry['typed'];
- $click = $entry['clickable'];
-
- /* Skip if we're not overwriting */
- if ( $emo_image[ $image ] or $emo_typed[ $typed ] )
- {
- continue;
- }
-
- /* Get the extension */
- $file_extension = preg_replace( "#^.*\.(.+?)$#si", "\\1", mb_strtolower( $image ) );
-
- /* Make sure it's allowed */
- if ( ! in_array( $file_extension, $this->allowed_files ) )
- {
- continue;
- }
-
- /* Remove any existing emoticon */
- @unlink( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $emo_set_dir . '/' . $image );
-
- $this->DB->delete( 'emoticons', "typed='$typed' and image='$image' and emo_set='$emo_set_dir'" );
-
- /* Create the image in the file system */
- if( $FH = fopen( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' .$emo_set_dir . '/' . $image, 'wb' ) )
- {
- if ( fwrite( $FH, $emoticons[ $image ] ) )
- {
- fclose( $FH );
-
- /* Insert the emoticon record */
- $this->DB->insert( 'emoticons', array( 'typed' => $typed, 'image' => $image, 'clickable' => $click, 'emo_set' => $emo_set_dir ) );
- }
- }
-
- /* Add the emoticon to all the other directories */
- try
- {
- foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' ) as $file )
- {
- if( ! $file->isDot() && $file->isDir() )
- {
- if ( substr( $file->getFilename(), 0, 1 ) == '.' )
- {
- continue;
- }
-
- if ( ! file_exists( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $file->getFilename() . '/' . $image ) )
- {
- $this->DB->buildAndFetch( array( 'delete' => 'emoticons', 'where' => "typed='$typed' and image='$image' and emo_set='{$file->getFilename()}'" ) );
-
- if ( $FH = @fopen( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $file->getFilename() . '/' . $image, 'wb' ) )
- {
- if ( fwrite( $FH, $emoticons[ $image ] ) )
- {
- fclose( $FH );
-
- $this->DB->insert( 'emoticons', array( 'typed' => $typed, 'image' => $image, 'clickable' => $click, 'emo_set' => $file->getFilename() ) );
- }
- }
- }
- }
- }
- } catch ( Exception $e ) {}
- }
-
- /* Recache and bounce */
- $this->emoticonsRebuildCache();
-
- $this->registry->output->global_message = $this->lang->words['emo_xml_good'];
- $this->emoticonsOverview();
-
- }
-
- /**
- * Export the specified emoticon directory
- *
- * @access public
- * @return void
- */
- public function emoticonsPackExport()
- {
- /* Setup XML */
- require_once( IPS_KERNEL_PATH.'classXML.php' );
- $xml = new classXML( IPS_DOC_CHAR_SET );
-
- require_once( IPS_KERNEL_PATH . 'classXMLArchive.php' );
- $xmlarchive = new classXMLArchive();
-
- /* Check the emoticon set */
- if ( ! $this->request['emo_set'] )
- {
- $this->registry->output->global_message = $this->lang->words['emo_specify_exS'];
- $this->emoticonsOverview();
- return;
- }
-
- /* Get emoticons from the database */
- $emo_db = array();
-
- $this->DB->build( array( 'select' => '*', 'from' => 'emoticons', 'where' => "emo_set='{$this->request['emo_set']}'" ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $emo_db[ $r['image'] ] = $r;
- }
-
- /* Get Emoticon Folders */
- $emodirs = array();
- $emodd = array();
- $files_to_add = array();
-
- try
- {
- foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $this->request['emo_set'] ) as $file )
- {
- if( ! $file->isDot() )
- {
- if ( $emo_db[ $file->getFilename() ] != "" )
- {
- $files_to_add[] = DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $this->request['emo_set'] . '/' . $file->getFilename();
- }
- }
- }
- } catch ( Exception $e ) {}
-
- /* Add each file to the xml archive */
- foreach( $files_to_add as $f )
- {
- $xmlarchive->add( $f );
- }
-
- $xml->newXMLDocument();
- $xml->addElement( 'emoticonexport' );
- $xml->addElement( 'emogroup', 'emoticonexport' );
-
- foreach( $emo_db as $r )
- {
- $content = array();
-
- $content['typed'] = $r['typed'];
- $content['image'] = $r['image'];
- $content['clickable'] = $r['clickable'];
-
- $xml->addElementAsRecord( 'emogroup', 'emoticon', $content );
- }
-
- /* Create the XML Document */
- $xmlData = $xml->fetchDocument();
-
- /* Add the xml document to the archive */
- $xmlarchive->add( $xmlData, 'emoticon_data.xml' );
-
- /* Send the archive to the browser */
- $imagearchive = $xmlarchive->getArchiveContents();
- $this->registry->output->showDownload( $imagearchive, 'ipb_emoticons.xml' );
- }
-
- /**
- * Builds the emoticon import/export pack splash screen
- *
- * @access public
- * @return void
- */
- public function emoticonsPackSplash()
- {
- /* Check for the emoticon directory */
- if( ! is_dir( DOC_IPS_ROOT_PATH . 'public/style_emoticons' ) )
- {
- $this->registry->output->showError( $this->lang->words['emo_nolocate'], 2110 );
-
- }
-
- /* Count the number of current emoticons */
- $this->DB->build( array( 'select' => 'id, count(id) as count, emo_set',
- 'from' => 'emoticons',
- 'group' => 'id, emo_set',
- 'order' => 'emo_set'
- ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $emo_db[ $r['emo_set'] ] = $r;
- }
-
- /* Get the emoticon folders */
- $emodirs = array();
- $emodd = array();
-
- try
- {
- foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . 'public/style_emoticons' ) as $file )
- {
- if( $file->isDir() && ! $file->isDot() )
- {
- $emodirs[] = $file->getFilename();
- $emodd[] = array( $file->getFilename(), $file->getFilename() );
- }
- }
- } catch ( Exception $e ) {}
-
- /* Build Form Elements */
- $form = array();
- $form['emo_set'] = $this->registry->output->formDropdown( 'emo_set', $emodd );
- $form['new_emo_set'] = $this->registry->output->formInput( 'new_emo_set' );
- $form['overwrite'] = $this->registry->output->formYesNo( 'overwrite' );
-
- /* Output */
- $this->registry->output->html .= $this->html->emoticonsPackSplash( $form );
- }
-
- /**
- * Remove the specified emoticon
- *
- * @access public
- * @return void
- */
- public function emoticonsRemove()
- {
- /* Check the ID */
- if( $this->request['id'] == "" )
- {
- $this->registry->output->global_message = $this->lang->words['emo_nogid'];
- $this->emoticonsOverview();
- return;
- }
-
- /* Can only remove the default set */
- if( $this->request['id'] != "default" )
- {
- $this->registry->output->global_message = $this->lang->words['emo_onlydothis'];
- $this->emoticonsOverview();
- return;
- }
-
- /* Check for the emoticon ID */
- $this->request['eid'] = intval( $this->request['eid'] );
-
- if( ! $this->request['eid'] )
- {
- $this->registry->output->global_message = $this->lang->words['emo_noid'];
- $this->emoticonsManageDirectory();
- return;
- }
-
- /* Get the emoticon info */
- $emo_info = $this->DB->buildAndFetch( array( 'select' => 'typed', 'from' => 'emoticons', 'where' => "id=" . $this->request['eid']) );
-
- /* Delete the emoticon */
- $this->DB->delete( 'emoticons', "typed='{$emo_info['typed']}'" );
-
- /* Rebuild the cache and bounce */
- $this->emoticonsRebuildCache();
-
- $this->registry->output->global_message = $this->lang->words['emo_removed'];
- $this->emoticonsManageDirectory();
- }
-
- /**
- * Add emoticons to the default directory
- *
- * @access public
- * @return void
- */
- public function emoticonsAdd()
- {
- /* Check the id */
- if( $this->request['id'] == "" )
- {
- $this->registry->output->global_message = $this->lang->words['emo_nogid'];
- $this->emoticonsOverview();
- return;
- }
-
- /* Can only upload to the default directory */
- if( $this->request['id'] != "default" )
- {
- $this->registry->output->global_message = $this->lang->words['emo_onlydothis'];
- $this->emoticonsOverview();
- return;
- }
-
- /* Loop through the request and look for emoticons */
- foreach( $this->request as $key => $value )
- {
- if( preg_match( "/^emo_type_(\d+)$/", $key, $match ) )
- {
- if( isset( $this->request[ $match[0] ] ) )
- {
- /* Get the emoticon info */
- $typed = str_replace( '"', "", $this->request[ $match[0] ] );
- $click = $this->request[ 'emo_click_'.$match[1] ];
- $add = $this->request[ 'emo_add_'.$match[1] ];
- $image = $this->request[ 'emo_image_'.$match[1] ];
- $set = trim( $this->request['id'] );
- $typed = str_replace( '\', "", $typed );
-
- /* Check the add all flag */
- if( $this->request['addall'] )
- {
- $add = 1;
- }
-
- /* Add this emoticon if we have have the required info */
- if( $add and $typed and $image )
- {
- /* Insert the emo record */
- $this->DB->insert( 'emoticons', array( 'clickable' => intval( $click ), 'typed' => $typed, 'image' => $image, 'emo_set' => $set ) );
-
- /* Emoticon list */
- $emodirs = array( 0 => '');
-
- /* Loop through all the emoticons */
- try
- {
- foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . 'public/style_emoticons' ) as $file )
- {
- if( ! $file->isDot() && $file->isDir() )
- {
- if( $file->getFilename() == 'default' )
- {
- $emodirs[0] = $file->getFilename();
- }
- else
- {
- $emodirs[] = $file->getFilename();
- }
- }
- }
- } catch ( Exception $e ) {}
-
- /* Add this emoticon to the other sets */
- foreach( $emodirs as $directory )
- {
- if( $directory == $set )
- {
- continue;
- }
-
- $this->DB->insert( 'emoticons', array( 'clickable' => intval( $click ), 'typed' => $typed, 'image' => $image, 'emo_set' => $directory ) );
- }
- }
- }
- }
- }
-
- /* Rebuild the cache and bounce */
- $this->emoticonsRebuildCache();
-
- $this->registry->output->global_message = $this->lang->words['emo_updated'];
- $this->emoticonsManageDirectory();
- }
-
- /**
- * Handles the upload emoticon form
- *
- * @access public
- * @return void
- */
- public function emoticonsUpload()
- {
- /* INI */
- $overwrite = 1;
- $uploaded = 0;
-
- /* Check the request for uploads */
- $directories = array();
- $first_dir = '';
-
- foreach( $this->request as $key => $value )
- {
- if( preg_match( "/^dir_(.*)$/", $key, $match ) )
- {
- if( $this->request[ $match[0] ] == 1 )
- {
- $directories[] = $match[1];
- }
- }
- }
-
- /* Can't upload to default */
- if ( ! count( $directories ) )
- {
- $this->registry->output->global_message = $this->lang->words['emo_pickanother'];
- $this->emoticonsOverview();
- return;
- }
-
- /* Remove default from the directories list */
- if ( ! in_array( 'default', $directories ) )
- {
- array_push( $directories, 'default' );
- }
-
- /* Get the first directory */
- $first_dir = array_shift( $directories );
-
- /* Loop through the dirs */
- $emodirs = array( 0 => '' );
-
- try
- {
- foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . 'public/style_emoticons' ) as $file )
- {
- if( ! $file->isDot() && $file->isDir() )
- {
- /* Add to emoticon list */
- if( $file->getFilename() == 'default' )
- {
- $emodirs[0] = $file->getFilename();
- }
- else
- {
- $emodirs[] = $file->getFilename();
- }
- }
- }
- } catch ( Exception $e ) {}
-
- /* Loop through each form upload field */
- foreach( array( 1,2,3,4 ) as $i )
- {
- /* Upload Data */
- $field = 'upload_'.$i;
- $FILE_NAME = $_FILES[$field]['name'];
- $FILE_SIZE = $_FILES[$field]['size'];
- $FILE_TYPE = $_FILES[$field]['type'];
-
- //-----------------------------------------
- // Naughty Opera adds the filename on the end of the
- // mime type - we don't want this.
- //-----------------------------------------
-
- $FILE_TYPE = preg_replace( "/^(.+?);.*$/", "\\1", $FILE_TYPE );
-
- //-----------------------------------------
- // Naughty Mozilla likes to use "none" to indicate an empty upload field.
- // I love universal languages that aren't universal.
- //-----------------------------------------
-
- if ( $_FILES[$field]['name'] == "" or ! $_FILES[$field]['name'] or ($_FILES[$field]['name'] == "none") )
- {
- continue;
- }
-
- //-----------------------------------------
- // Make sure it's not a NAUGHTY file
- //-----------------------------------------
-
- $file_extension = preg_replace( "#^.*\.(.+?)$#si", "\\1", mb_strtolower( $_FILES[ $field ]['name'] ) );
-
- if ( ! in_array( $file_extension, $this->allowed_files ) )
- {
- $this->registry->output->global_message = $this->lang->words['emo_mimes']; // The screams of angst from Emo Mimes are silent...
- $this->emoticonsOverview();
- return;
- }
-
- //-----------------------------------------
- // Copy the upload to the uploads directory
- //-----------------------------------------
-
- if ( ! @move_uploaded_file( $_FILES[ $field ]['tmp_name'], DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $first_dir . "/" . $FILE_NAME) )
- {
- $this->registry->output->global_message = "The upload failed, sorry!";
- $this->emoticonsOverview();
- return;
- }
- else
- {
- @chmod( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $first_dir . "/" . $FILE_NAME, 0777 );
-
- //-----------------------------------------
- // Copy to other folders
- //-----------------------------------------
-
- if ( is_array( $directories ) and count( $directories ) )
- {
- foreach ( $directories as $newdir )
- {
- if ( file_exists( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $newdir . "/" . $FILE_NAME ) )
- {
- if ( $overwrite != 1 OR $newdir == 'default' )
- {
- continue;
- }
- }
-
- if ( @copy( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $first_dir . "/" . $FILE_NAME, DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $newdir . "/" . $FILE_NAME ) )
- {
- @chmod( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $newdir . "/" . $FILE_NAME, 0777 );
- }
- }
- }
-
- // Let's make sure this 'image' is available in all directories too
- if ( is_array( $emodirs ) and count( $emodirs ) )
- {
- foreach ( $emodirs as $newdir )
- {
- if ( file_exists( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $newdir . "/" . $FILE_NAME ) )
- {
- continue;
- }
-
- if( @copy( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $first_dir . "/" .$FILE_NAME, DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $newdir . "/" . $FILE_NAME ) )
- {
- @chmod( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $newdir . "/" . $FILE_NAME, 0777 );
- }
- }
- }
-
- $uploaded++;
- }
- }
-
- if( !$uploaded )
- {
- $this->registry->output->global_message = $this->lang->words['no_emo_selected'];
- }
- else
- {
- $this->registry->output->global_message = $this->lang->words['emo_complete'];
- }
-
- $this->emoticonsOverview();
- }
-
- /**
- * Removes an emoticon set
- *
- * @access public
- * @return void
- */
- public function emoticonsSetRemove()
- {
- /* Check the ID */
- if ( ! $this->request['id'] )
- {
- $this->registry->output->global_message = $this->lang->words['emo_noset'];
- $this->emoticonsOverview();
- }
-
- /* Can't remove the default set */
- if( $this->request['id'] == 'default' )
- {
- $this->registry->output->global_message = $this->lang->words['emo_norename'];
- $this->emoticonsOverview();
- return;
- }
-
- /* Remove the directory */
- $this->registry->adminFunctions->removeDirectory( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $this->request['id'] );
-
- /* Remove the database entry */
- $this->DB->delete( 'emoticons', "emo_set='{$this->request['id']}'" );
-
- /* Rebuild cache */
- $this->emoticonsRebuildCache();
-
- /* Bounce */
- $this->registry->output->global_message = $this->lang->words['emo_folder_rem'];
- $this->emoticonsOverview();
- }
-
- /**
- * Add/Edit an emoticon folder name
- *
- * @access public
- * @param string Type (add or edit)
- * @return void
- */
- public function emoticonsSetAlter( $type='add' )
- {
- /* Get the name */
- $name = preg_replace( "/[^a-zA-Z0-9\-_]/", "", $this->request['emoset'] );
-
- /* Check th ename */
- if( $name == "" )
- {
- $this->registry->output->global_message = $this->lang->words['emo_a_to_z'];
- return $this->emoticonsOverview();
- }
-
- /* Check Safe Mode */
- if( SAFE_MODE_ON )
- {
- $this->registry->output->global_message = $this->lang->words['emo_safemode'];
- return $this->emoticonsOverview();
- }
-
- /* Check to see if the directory already exists */
- if( file_exists( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $name ) )
- {
- $this->registry->output->global_message = sprintf( $this->lang->words['emo_already'], $name );
- return $this->emoticonsOverview();
- }
-
- if( $type == 'add' )
- {
- /* Create the directory */
- if( @mkdir( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $name, 0777 ) )
- {
- @chmod( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $name, 0777 );
- @file_put_contents( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $name . '/index.html', '' );
-
- /* Copy default emoticons */
- try
- {
- foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . '/public/style_emoticons/default/' ) as $file )
- {
- if( ! $file->isDot() )
- {
- @copy( DOC_IPS_ROOT_PATH . '/public/style_emoticons/default/' . $file->getFilename(), DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $name . '/' . $file->getFilename() );
- @chmod( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $name . '/' . $file->getFilename(), 0777 );
- }
- }
- } catch ( Exception $e ) {}
-
- /* Query the default set */
- $this->DB->build( array( 'select' => '*', 'from' => 'emoticons', 'where' => "emo_set='default'" ) );
- $outer = $this->DB->execute();
-
- /* Insert emoticons for the new set */
- while( $r = $this->DB->fetch($outer) )
- {
- $this->DB->insert( "emoticons", array( 'clickable' => $r['clickable'], 'typed' => $r['typed'], 'emo_set' => $name, 'image' => $r['image'] ) );
- }
-
- /* Bounce */
- $this->registry->output->global_message = $this->lang->words['emo_folder_new'];
- return $this->emoticonsOverview();
- }
- else
- {
- /* Couldn't create the directory, Bounce */
- $this->registry->output->global_message = $this->lang->words['emo_ftp'];
- return $this->emoticonsOverview();
- }
- }
- /* Edit Folder Name */
- else
- {
- /* Check the directory ID */
- if ( ! $this->request['id'] )
- {
- $this->registry->output->global_message = $this->lang->words['emo_miss_dir'];
- $this->emoticonsOverview();
- return;
- }
-
- /* Can't rename the default directory */
- if( $this->request['id'] == 'default' )
- {
- $this->registry->output->global_message = $this->lang->words['emo_norename'];
- $this->emoticonsOverview();
- return;
- }
-
- /* Rename the directory */
- if ( @rename( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $this->request['id'], DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $name ) )
- {
- /* Check to see if the rename worked */
- if ( file_exists( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $name ) )
- {
- /* Update all the emoticons */
- $this->DB->update( 'emoticons', array( 'emo_set' => $name ), "emo_set='{$this->request['id']}'" );
- }
-
- /* Rebuild the cache */
- $this->emoticonsRebuildCache();
-
- /* Update skins that are using this set */
- $rebuild_sets = array();
-
- /* Querh skin sets */
- $this->DB->build( array( 'select' => 'set_id', 'from' => 'skin_collections', 'where' => "set_emo_dir='{$this->request['id']}'" ) );
- $outer = $this->DB->execute();
-
- /* Loop thorugh and update the emoticon folder */
- while( $r = $this->DB->fetch($outer) )
- {
- $this->DB->update( 'skin_collections', array( 'set_emo_dir' => $name ), 'set_id=' . $r['set_id'] );
- $rebuild_sets[] = $r['set_id'];
- }
-
- /* Bounce */
- $this->registry->output->global_message = $this->lang->words['emo_folder_name'];
- return $this->emoticonsOverview();
- }
- else
- {
- /* Error and bounce */
- $this->registry->output->global_message = $this->lang->words['emo_wecantdoit'];
- return $this->emoticonsOverview();
- }
- }
- }
-
- /**
- * Process edit emoticons forum
- *
- * @access public
- * @return void
- */
- public function emoticonsEdit()
- {
- /* Check ID */
- if( $this->request['id'] == '' )
- {
- $this->registry->output->global_message = $this->lang->words['emo_nogid'];
- return $this->emoticonsOverview();
- }
-
- /* Loop through the request and pull out emoticons */
- foreach( $this->request as $key => $value )
- {
- /* Check to see if its an emoticon */
- if ( preg_match( "/^emo_id_(\d+)$/", $key, $match ) )
- {
- if ( $match[0] )
- {
- /* INI */
- $typed = '';
-
- /* Format type for default set */
- if( $this->request['id'] == 'default' )
- {
- $typed = str_replace( '"', "", $this->request[ 'emo_type_' . $match[1] ] );
- $typed = str_replace( '\', "", $typed );
- }
-
- /* Check clickable */
- $click = $this->request[ 'emo_click_' . $match[1] ];
-
- /* Update the emoticon */
- if ( $match[1] )
- {
- if( $typed )
- {
- /* Get the original name */
- $orig_typed = $this->DB->buildAndFetch( array( 'select' => 'typed', 'from' => 'emoticons', 'where' => 'id=' . intval( $match[1] ) ) );
-
- /* Update to new name */
- $this->DB->update( 'emoticons', array( 'clickable' => intval( $click ), 'typed' => $typed ), 'id=' . intval( $match[1] ) );
- $this->DB->update( 'emoticons', array( 'typed' => $typed ), "typed='" . $orig_typed['typed'] . "'" );
- }
- else
- {
- /* Just update clickable */
- $this->DB->update( 'emoticons', array( 'clickable' => intval( $click ) ), 'id='.intval( $match[1] ) );
- }
- }
- }
- }
- }
-
- /* Recache and bounce */
- $this->emoticonsRebuildCache();
-
- $this->registry->output->global_message = $this->lang->words['emo_updated'];
- $this->emoticonsManageDirectory();
- }
-
- /**
- * Manage emoticons
- *
- * @access public
- * @return void
- */
- public function emoticonsManageDirectory()
- {
- /* INI */
- $this->request['id'] = trim( $this->request['id'] );
-
- /* Get emoticons for this group */
- $emo_db = array();
- $emo_file = array();
-
- $this->DB->build( array(
- 'select' => '*',
- 'from' => 'emoticons',
- 'where' => "emo_set='{$this->request['id']}'",
- 'order' => 'clickable DESC, image ASC'
- ) );
- $this->DB->execute();
-
- /* Loop through the emoticons */
- while( $r = $this->DB->fetch() )
- {
- $emo_db[ $r['image'] ] = $r;
- }
-
-
- /* Get emoticons from the directory */
- $emo_file = array();
- $emo_rfile = $this->_emoticonGetGolderContents( $this->request['id'] );
-
- foreach( $emo_rfile as $ef )
- {
- $emo_file[ $ef ] = $ef;
- }
-
- /* Number of emoticons to show per row */
- $per_row = 5;
- $td_width = 100 / $per_row;
-
- /* Loop through the database emoticons */
- $poss_names = array();
- $db_rows = array();
-
- foreach( $emo_db as $image => $data )
- {
- /* Remove this from the file list, it's already added */
- unset( $emo_file[ $image ] );
-
- /* Clickable? */
- if ( $data['clickable'] )
- {
- $data['_click'] = 'checked="checked"';
- $data['_class'] = 'tablerow1';
- }
- else
- {
- $data['_click'] = '';
- $data['_class'] = 'tablerow2';
- }
-
- /* Add image to array */
- $data['image'] = $image;
-
- /* Addd array to output */
- $db_rows[] = $data;
-
- /* Possible names filter */
- $poss_names[$data['typed']] = $data['typed'];
- }
-
- /* Check for unassigned images in the emoticon directory */
- $file_rows = array();
-
- if ( count( $emo_file ) && $this->request['id'] == 'default' )
- {
- /* Loop through the unassigned emoticons */
- foreach( $emo_file as $image )
- {
- /* INI */
- $_fdata = array();
-
- /* Suggest an emoticon name */
- $_fdata['poss_name'] = ':'.preg_replace( "/(.*)(\..+?)$/", "\\1", $image ).':';
-
- if ( isset($poss_names[ $_fdata['poss_name'] ]) AND $poss_names[ $_fdata['poss_name'] ] )
- {
- $_fdata['poss_name'] = preg_replace( "/:$/", "2:", $poss_name );
- }
-
- /* Add the image */
- $_fdata['image'] = $image;
-
- /* Add to output array */
- $file_rows[] = $_fdata;
- }
- }
-
- /* Output */
-
- $this->registry->output->extra_nav[] = array( '', $this->lang->words['emo_manage_set'].$this->request['id'] );
- $this->registry->output->html .= $this->html->emoticonsDirectoryManagement( $db_rows, $file_rows, $td_width, $per_row );
- }
-
- /**
- * Builds the emoticons overview screen
- *
- * @access public
- * @return void
- */
- public function emoticonsOverview()
- {
- /* Check for the emoticon directory */
- if ( ! is_dir( DOC_IPS_ROOT_PATH . '/public/style_emoticons' ) )
- {
- $this->registry->output->showError( $this->lang->words['emo_nolocate'], 2111 );
-
- }
-
- /* Check the emoticon count */
- $this->DB->build( array( 'select' => 'id, count(id) as count, emo_set',
- 'from' => 'emoticons',
- 'group' => 'emo_set, id',
- 'order' => 'emo_set'
- ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $emo_db[ $r['emo_set'] ] = $r;
- }
-
- /* Get emoticon folders */
- $emodirs = array( 0 => '');
-
- try
- {
- foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . '/public/style_emoticons' ) as $_emoticon )
- {
- if ( $_emoticon->isDir() AND ! $_emoticon->isDot() AND $_emoticon->getFilename() != '.svn' )
- {
- if ( is_dir( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $_emoticon ) )
- {
- if( $_emoticon->getFilename() == 'default' )
- {
- $emodirs[0] = $_emoticon->getFilename();
- }
- else
- {
- $emodirs[] = $_emoticon->getFilename();
- }
- }
- }
- }
- } catch ( Exception $e ) {}
-
- /* Loop through the emoticon directories */
- $rows = array();
- $i = 0;
- $total = count($emodirs);
-
- foreach( $emodirs as $dir )
- {
- $i++;
-
- $data = array();
-
- $files = $this->_emoticonGetGolderContents( $dir );
- $data['count'] = intval( count($files) );
-
- if( $dir == 'default' )
- {
- $data['line_image'] = '';
- $data['link_text'] = $this->lang->words['emo_manageemos'];
- }
- else
- {
- $data['link_text'] = $this->lang->words['emo_setclickable'];
-
- if( $i == $total )
- {
- $data['line_image'] = " ";
- }
- else
- {
- $data['line_image'] = " ";
- }
- }
-
- if ( is_writeable( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $dir ) )
- {
- if( $dir == 'default' )
- {
- $checked_def = "checked='checked' disabled='disabled' ";
- }
- else
- {
- $checked_def = "";
- }
-
- $data['icon'] = 'icon_can_write.gif';
- $data['title'] = $this->lang->words['emo_writeable'];
- $data['checkbox'] = " ";
- }
- else
- {
- $data['icon'] = 'icon_cannot_write.gif';
- $data['title'] = $this->lang->words['emo_writeable_not'];
- $data['checkbox'] = "-";
- }
-
- $data['dir'] = $dir;
- $data['dir_count'] = intval( $emo_db[ $dir ]['count'] );
-
- $rows[] = $data;
- }
-
- $this->registry->output->html .= $this->html->emoticonsOverview( $rows );
- }
-
- /**
- * Rebuilds the emoticon cache
- *
- * @access public
- * @return void
- */
- public function emoticonsRebuildCache()
- {
- $cache = array();
-
- $this->DB->build( array( 'select' => 'typed,image,clickable,emo_set', 'from' => 'emoticons' ) );
- $c = $this->DB->execute();
-
- while ( $r = $this->DB->fetch( $c ) )
- {
- $cache[] = $r;
- }
-
- usort( $cache, array( $this, '_thisUsort' ) );
-
- ipsRegistry::cache()->setCache( 'emoticons', $cache, array( 'array' => 1 ) );
- }
-
- /**
- * Custom sort operation
- *
- * @access private
- * @param string A
- * @param string B
- * @return integer
- */
- private static function _thisUsort($a, $b)
- {
- if ( strlen($a['typed']) == strlen($b['typed']) )
- {
- return 0;
- }
-
- return ( strlen($a['typed']) > strlen($b['typed']) ) ? -1 : 1;
- }
-
- /**
- * Gets all the emoticons from the specified directory
- *
- * @access private
- * @param string $folder Emoticon folder to pull emoticons from
- * @return array
- **/
- private function _emoticonGetGolderContents( $folder='default' )
- {
- $files = array();
-
- /* Loop through the emoticon directory */
- try
- {
- foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $folder ) as $_emo )
- {
- if( $_emo->isFile() && ! $_emo->isDot() )
- {
- if ( preg_match( "/\.(?:gif|jpg|jpeg|png|swf)$/i", $_emo->getFilename() ) )
- {
- $files[] = $_emo->getFilename();
- }
- }
- }
- } catch ( Exception $e ) {}
-
- return $files;
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Emoticon Management
+ * Last Updated: $LastChangedDate: 2010-09-13 17:28:12 -0400 (Mon, 13 Sep 2010) $
+ *
+ *
+ * @author $Author: terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 27th January 2004
+ * @version $Rev: 6863 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+class admin_core_posts_emoticons extends ipsCommand
+{
+ /**
+ * Allowed file types
+ *
+ * @access public
+ * @var array
+ */
+ public $allowed_files = array( 'png', 'jpeg', 'jpg', 'gif' );
+
+ /**
+ * 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_emoticons' );
+ $this->html->form_code = '&module=posts§ion=emoticons&';
+ $this->html->form_code_js = '&module=posts§ion=emoticons&';
+
+ $this->lang->loadLanguageFile( array( 'admin_posts' ) );
+
+ //-----------------------------------------
+ // What to do...
+ //-----------------------------------------
+
+ switch( $this->request['do'] )
+ {
+ case 'emo_packsplash':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_manage' );
+ $this->emoticonsPackSplash();
+ break;
+
+ case 'emo_packexport':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_manage' );
+ $this->emoticonsPackExport();
+ break;
+
+ case 'emo_packimport':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_manage' );
+ $this->emoticonsPackImport();
+ break;
+
+ case 'emo_manage':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_manage' );
+ $this->emoticonsManageDirectory();
+ break;
+
+ case 'emo_doedit':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_edit' );
+ $this->emoticonsEdit();
+ break;
+
+ case 'emo_doadd':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_add' );
+ $this->emoticonsAdd();
+ break;
+
+ case 'emo_remove':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_delete' );
+ $this->emoticonsRemove();
+ break;
+
+ case 'emo_setadd':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_add' );
+ $this->emoticonsSetAlter( $type='add' );
+ break;
+
+ case 'emo_setedit':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_edit' );
+ $this->emoticonsSetAlter( $type='edit' );
+ break;
+
+ case 'emo_setremove':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_delete' );
+ $this->emoticonsSetRemove();
+ break;
+
+ case 'emo_upload':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_add' );
+ $this->emoticonsUpload();
+ break;
+
+ case 'emo':
+ case 'overview':
+ default:
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'emoticons_manage' );
+ $this->emoticonsOverview();
+ break;
+ }
+
+ /* Output */
+ $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * Import an emoticon pack
+ *
+ * @access public
+ * @return void
+ */
+ public function emoticonsPackImport()
+ {
+ /* Get the xml file */
+ $content = $this->registry->adminFunctions->importXml( 'ipb_emoticons.xml' );
+
+ /* Check for content */
+ if ( ! $content )
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_fail'];
+ return $this->emoticonsPackSplash();
+ }
+
+ /* Setup XML */
+ require_once( IPS_KERNEL_PATH.'classXML.php' );
+ $xml = new classXML( IPS_DOC_CHAR_SET );
+
+ require_once( IPS_KERNEL_PATH.'classXMLArchive.php' );
+ $xmlarchive = new classXMLArchive();
+
+ /* Read the archive */
+ $xmlarchive->readXML( $content );
+
+ /* Get the data file */
+ $emoticons = array();
+ $emoticon_data = array();
+
+ foreach( $xmlarchive->asArray() as $k => $f )
+ {
+ if ( $k == 'emoticon_data.xml' )
+ {
+ $emoticon_data = $f;
+ }
+ else
+ {
+ $emoticons[ $f['filename'] ] = $f['content'];
+ }
+ }
+
+ /* Parse the XML Document */
+ $xml->loadXML( $emoticon_data['content'] );
+
+ /* Make sure we have a destination for these emoicons */
+ if ( ! $this->request['emo_set'] and ! $this->request['new_emo_set'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_specify'];
+ }
+
+ /* Current emoticon set directory */
+ $emo_set_dir = trim( $this->request['emo_set'] );
+
+ /* New emoticon set directory */
+ $this->request['new_emo_set'] = preg_replace( "/[^a-zA-Z0-9\-_]/", "", $this->request['new_emo_set'] );
+
+ /* Create the new set */
+ if ( $this->request['new_emo_set'] )
+ {
+ $emo_set_dir = trim( $this->request['new_emo_set'] );
+
+ /* Check to see if the directory already exists */
+ if ( file_exists( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $emo_set_dir ) )
+ {
+ $this->registry->output->global_message = sprintf( $this->lang->words['emo_already'], $emo_set_dir );
+ return $this->emoticonsPackSplash();
+ }
+
+ /* Create the directory */
+ if ( @mkdir( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $emo_set_dir, 0777 ) )
+ {
+ @chmod( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $emo_set_dir, 0777 );
+ @file_put_contents( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $emo_set_dir . '/index.html', '' );
+ }
+ else
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_ftp'];
+ return $this->emoticonsPackSplash();
+ }
+ }
+
+ /* Get a list of current emoticons, if we are not overwriting */
+ $emo_image = array();
+ $emo_typed = array();
+
+ if ( $this->request['overwrite'] != 1 )
+ {
+ $this->DB->build( array( 'select' => '*', 'from' => 'emoticons', 'where' => "emo_set='".$emo_set_dir."'" ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $emo_image[ $r['image'] ] = 1;
+ $emo_typed[ $r['typed'] ] = 1;
+ }
+ }
+
+ /* Loop through the emoticons in the xml document */
+ foreach( $xml->fetchElements('emoticon') as $emoticon )
+ {
+ $entry = $xml->fetchElementsFromRecord( $emoticon );
+
+ /* Emoticon Data */
+ $image = $entry['image'];
+ $typed = $entry['typed'];
+ $click = $entry['clickable'];
+
+ /* Skip if we're not overwriting */
+ if ( $emo_image[ $image ] or $emo_typed[ $typed ] )
+ {
+ continue;
+ }
+
+ /* Get the extension */
+ $file_extension = preg_replace( "#^.*\.(.+?)$#si", "\\1", mb_strtolower( $image ) );
+
+ /* Make sure it's allowed */
+ if ( ! in_array( $file_extension, $this->allowed_files ) )
+ {
+ continue;
+ }
+
+ /* Remove any existing emoticon */
+ @unlink( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $emo_set_dir . '/' . $image );
+
+ $this->DB->delete( 'emoticons', "typed='$typed' and image='$image' and emo_set='$emo_set_dir'" );
+
+ /* Create the image in the file system */
+ if( $FH = fopen( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' .$emo_set_dir . '/' . $image, 'wb' ) )
+ {
+ if ( fwrite( $FH, $emoticons[ $image ] ) )
+ {
+ fclose( $FH );
+
+ /* Insert the emoticon record */
+ $this->DB->insert( 'emoticons', array( 'typed' => $typed, 'image' => $image, 'clickable' => $click, 'emo_set' => $emo_set_dir ) );
+ }
+ }
+
+ /* Add the emoticon to all the other directories */
+ try
+ {
+ foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' ) as $file )
+ {
+ if( ! $file->isDot() && $file->isDir() )
+ {
+ if ( substr( $file->getFilename(), 0, 1 ) == '.' )
+ {
+ continue;
+ }
+
+ if ( ! file_exists( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $file->getFilename() . '/' . $image ) )
+ {
+ $this->DB->buildAndFetch( array( 'delete' => 'emoticons', 'where' => "typed='$typed' and image='$image' and emo_set='{$file->getFilename()}'" ) );
+
+ if ( $FH = @fopen( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $file->getFilename() . '/' . $image, 'wb' ) )
+ {
+ if ( fwrite( $FH, $emoticons[ $image ] ) )
+ {
+ fclose( $FH );
+
+ $this->DB->insert( 'emoticons', array( 'typed' => $typed, 'image' => $image, 'clickable' => $click, 'emo_set' => $file->getFilename() ) );
+ }
+ }
+ }
+ }
+ }
+ } catch ( Exception $e ) {}
+ }
+
+ /* Recache and bounce */
+ $this->emoticonsRebuildCache();
+
+ $this->registry->output->global_message = $this->lang->words['emo_xml_good'];
+ $this->emoticonsOverview();
+
+ }
+
+ /**
+ * Export the specified emoticon directory
+ *
+ * @access public
+ * @return void
+ */
+ public function emoticonsPackExport()
+ {
+ /* Setup XML */
+ require_once( IPS_KERNEL_PATH.'classXML.php' );
+ $xml = new classXML( IPS_DOC_CHAR_SET );
+
+ require_once( IPS_KERNEL_PATH . 'classXMLArchive.php' );
+ $xmlarchive = new classXMLArchive();
+
+ /* Check the emoticon set */
+ if ( ! $this->request['emo_set'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_specify_exS'];
+ $this->emoticonsOverview();
+ return;
+ }
+
+ /* Get emoticons from the database */
+ $emo_db = array();
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'emoticons', 'where' => "emo_set='{$this->request['emo_set']}'" ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $emo_db[ $r['image'] ] = $r;
+ }
+
+ /* Get Emoticon Folders */
+ $emodirs = array();
+ $emodd = array();
+ $files_to_add = array();
+
+ try
+ {
+ foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $this->request['emo_set'] ) as $file )
+ {
+ if( ! $file->isDot() )
+ {
+ if ( $emo_db[ $file->getFilename() ] != "" )
+ {
+ $files_to_add[] = DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $this->request['emo_set'] . '/' . $file->getFilename();
+ }
+ }
+ }
+ } catch ( Exception $e ) {}
+
+ /* Add each file to the xml archive */
+ foreach( $files_to_add as $f )
+ {
+ $xmlarchive->add( $f );
+ }
+
+ $xml->newXMLDocument();
+ $xml->addElement( 'emoticonexport' );
+ $xml->addElement( 'emogroup', 'emoticonexport' );
+
+ foreach( $emo_db as $r )
+ {
+ $content = array();
+
+ $content['typed'] = $r['typed'];
+ $content['image'] = $r['image'];
+ $content['clickable'] = $r['clickable'];
+
+ $xml->addElementAsRecord( 'emogroup', 'emoticon', $content );
+ }
+
+ /* Create the XML Document */
+ $xmlData = $xml->fetchDocument();
+
+ /* Add the xml document to the archive */
+ $xmlarchive->add( $xmlData, 'emoticon_data.xml' );
+
+ /* Send the archive to the browser */
+ $imagearchive = $xmlarchive->getArchiveContents();
+ $this->registry->output->showDownload( $imagearchive, 'ipb_emoticons.xml' );
+ }
+
+ /**
+ * Builds the emoticon import/export pack splash screen
+ *
+ * @access public
+ * @return void
+ */
+ public function emoticonsPackSplash()
+ {
+ /* Check for the emoticon directory */
+ if( ! is_dir( DOC_IPS_ROOT_PATH . 'public/style_emoticons' ) )
+ {
+ $this->registry->output->showError( $this->lang->words['emo_nolocate'], 2110 );
+
+ }
+
+ /* Count the number of current emoticons */
+ $this->DB->build( array( 'select' => 'id, count(id) as count, emo_set',
+ 'from' => 'emoticons',
+ 'group' => 'id, emo_set',
+ 'order' => 'emo_set'
+ ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $emo_db[ $r['emo_set'] ] = $r;
+ }
+
+ /* Get the emoticon folders */
+ $emodirs = array();
+ $emodd = array();
+
+ try
+ {
+ foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . 'public/style_emoticons' ) as $file )
+ {
+ if( $file->isDir() && ! $file->isDot() )
+ {
+ $emodirs[] = $file->getFilename();
+ $emodd[] = array( $file->getFilename(), $file->getFilename() );
+ }
+ }
+ } catch ( Exception $e ) {}
+
+ /* Build Form Elements */
+ $form = array();
+ $form['emo_set'] = $this->registry->output->formDropdown( 'emo_set', $emodd );
+ $form['new_emo_set'] = $this->registry->output->formInput( 'new_emo_set' );
+ $form['overwrite'] = $this->registry->output->formYesNo( 'overwrite' );
+
+ /* Output */
+ $this->registry->output->html .= $this->html->emoticonsPackSplash( $form );
+ }
+
+ /**
+ * Remove the specified emoticon
+ *
+ * @access public
+ * @return void
+ */
+ public function emoticonsRemove()
+ {
+ /* Check the ID */
+ if( $this->request['id'] == "" )
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_nogid'];
+ $this->emoticonsOverview();
+ return;
+ }
+
+ /* Can only remove the default set */
+ if( $this->request['id'] != "default" )
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_onlydothis'];
+ $this->emoticonsOverview();
+ return;
+ }
+
+ /* Check for the emoticon ID */
+ $this->request['eid'] = intval( $this->request['eid'] );
+
+ if( ! $this->request['eid'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_noid'];
+ $this->emoticonsManageDirectory();
+ return;
+ }
+
+ /* Get the emoticon info */
+ $emo_info = $this->DB->buildAndFetch( array( 'select' => 'typed', 'from' => 'emoticons', 'where' => "id=" . $this->request['eid']) );
+
+ /* Delete the emoticon */
+ $this->DB->delete( 'emoticons', "typed='{$emo_info['typed']}'" );
+
+ /* Rebuild the cache and bounce */
+ $this->emoticonsRebuildCache();
+
+ $this->registry->output->global_message = $this->lang->words['emo_removed'];
+ $this->emoticonsManageDirectory();
+ }
+
+ /**
+ * Add emoticons to the default directory
+ *
+ * @access public
+ * @return void
+ */
+ public function emoticonsAdd()
+ {
+ /* Check the id */
+ if( $this->request['id'] == "" )
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_nogid'];
+ $this->emoticonsOverview();
+ return;
+ }
+
+ /* Can only upload to the default directory */
+ if( $this->request['id'] != "default" )
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_onlydothis'];
+ $this->emoticonsOverview();
+ return;
+ }
+
+ /* Loop through the request and look for emoticons */
+ foreach( $this->request as $key => $value )
+ {
+ if( preg_match( "/^emo_type_(\d+)$/", $key, $match ) )
+ {
+ if( isset( $this->request[ $match[0] ] ) )
+ {
+ /* Get the emoticon info */
+ $typed = str_replace( '"', "", $this->request[ $match[0] ] );
+ $click = $this->request[ 'emo_click_'.$match[1] ];
+ $add = $this->request[ 'emo_add_'.$match[1] ];
+ $image = $this->request[ 'emo_image_'.$match[1] ];
+ $set = trim( $this->request['id'] );
+ $typed = str_replace( '\', "", $typed );
+
+ /* Check the add all flag */
+ if( $this->request['addall'] )
+ {
+ $add = 1;
+ }
+
+ /* Add this emoticon if we have have the required info */
+ if( $add and $typed and $image )
+ {
+ /* Insert the emo record */
+ $this->DB->insert( 'emoticons', array( 'clickable' => intval( $click ), 'typed' => $typed, 'image' => $image, 'emo_set' => $set ) );
+
+ /* Emoticon list */
+ $emodirs = array( 0 => '');
+
+ /* Loop through all the emoticons */
+ try
+ {
+ foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . 'public/style_emoticons' ) as $file )
+ {
+ if( ! $file->isDot() && $file->isDir() )
+ {
+ if( $file->getFilename() == 'default' )
+ {
+ $emodirs[0] = $file->getFilename();
+ }
+ else
+ {
+ $emodirs[] = $file->getFilename();
+ }
+ }
+ }
+ } catch ( Exception $e ) {}
+
+ /* Add this emoticon to the other sets */
+ foreach( $emodirs as $directory )
+ {
+ if( $directory == $set )
+ {
+ continue;
+ }
+
+ $this->DB->insert( 'emoticons', array( 'clickable' => intval( $click ), 'typed' => $typed, 'image' => $image, 'emo_set' => $directory ) );
+ }
+ }
+ }
+ }
+ }
+
+ /* Rebuild the cache and bounce */
+ $this->emoticonsRebuildCache();
+
+ $this->registry->output->global_message = $this->lang->words['emo_updated'];
+ $this->emoticonsManageDirectory();
+ }
+
+ /**
+ * Handles the upload emoticon form
+ *
+ * @access public
+ * @return void
+ */
+ public function emoticonsUpload()
+ {
+ /* INI */
+ $overwrite = 1;
+ $uploaded = 0;
+
+ /* Check the request for uploads */
+ $directories = array();
+ $first_dir = '';
+
+ foreach( $this->request as $key => $value )
+ {
+ if( preg_match( "/^dir_(.*)$/", $key, $match ) )
+ {
+ if( $this->request[ $match[0] ] == 1 )
+ {
+ $directories[] = $match[1];
+ }
+ }
+ }
+
+ /* Can't upload to default */
+ if ( ! count( $directories ) )
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_pickanother'];
+ $this->emoticonsOverview();
+ return;
+ }
+
+ /* Remove default from the directories list */
+ if ( ! in_array( 'default', $directories ) )
+ {
+ array_push( $directories, 'default' );
+ }
+
+ /* Get the first directory */
+ $first_dir = array_shift( $directories );
+
+ /* Loop through the dirs */
+ $emodirs = array( 0 => '' );
+
+ try
+ {
+ foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . 'public/style_emoticons' ) as $file )
+ {
+ if( ! $file->isDot() && $file->isDir() )
+ {
+ /* Add to emoticon list */
+ if( $file->getFilename() == 'default' )
+ {
+ $emodirs[0] = $file->getFilename();
+ }
+ else
+ {
+ $emodirs[] = $file->getFilename();
+ }
+ }
+ }
+ } catch ( Exception $e ) {}
+
+ /* Loop through each form upload field */
+ foreach( array( 1,2,3,4 ) as $i )
+ {
+ /* Upload Data */
+ $field = 'upload_'.$i;
+ $FILE_NAME = $_FILES[$field]['name'];
+ $FILE_SIZE = $_FILES[$field]['size'];
+ $FILE_TYPE = $_FILES[$field]['type'];
+
+ //-----------------------------------------
+ // Naughty Opera adds the filename on the end of the
+ // mime type - we don't want this.
+ //-----------------------------------------
+
+ $FILE_TYPE = preg_replace( "/^(.+?);.*$/", "\\1", $FILE_TYPE );
+
+ //-----------------------------------------
+ // Naughty Mozilla likes to use "none" to indicate an empty upload field.
+ // I love universal languages that aren't universal.
+ //-----------------------------------------
+
+ if ( $_FILES[$field]['name'] == "" or ! $_FILES[$field]['name'] or ($_FILES[$field]['name'] == "none") )
+ {
+ continue;
+ }
+
+ //-----------------------------------------
+ // Make sure it's not a NAUGHTY file
+ //-----------------------------------------
+
+ $file_extension = preg_replace( "#^.*\.(.+?)$#si", "\\1", mb_strtolower( $_FILES[ $field ]['name'] ) );
+
+ if ( ! in_array( $file_extension, $this->allowed_files ) )
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_mimes']; // The screams of angst from Emo Mimes are silent...
+ $this->emoticonsOverview();
+ return;
+ }
+
+ //-----------------------------------------
+ // Copy the upload to the uploads directory
+ //-----------------------------------------
+
+ if ( ! @move_uploaded_file( $_FILES[ $field ]['tmp_name'], DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $first_dir . "/" . $FILE_NAME) )
+ {
+ $this->registry->output->global_message = "The upload failed, sorry!";
+ $this->emoticonsOverview();
+ return;
+ }
+ else
+ {
+ @chmod( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $first_dir . "/" . $FILE_NAME, 0777 );
+
+ //-----------------------------------------
+ // Copy to other folders
+ //-----------------------------------------
+
+ if ( is_array( $directories ) and count( $directories ) )
+ {
+ foreach ( $directories as $newdir )
+ {
+ if ( file_exists( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $newdir . "/" . $FILE_NAME ) )
+ {
+ if ( $overwrite != 1 OR $newdir == 'default' )
+ {
+ continue;
+ }
+ }
+
+ if ( @copy( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $first_dir . "/" . $FILE_NAME, DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $newdir . "/" . $FILE_NAME ) )
+ {
+ @chmod( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $newdir . "/" . $FILE_NAME, 0777 );
+ }
+ }
+ }
+
+ // Let's make sure this 'image' is available in all directories too
+ if ( is_array( $emodirs ) and count( $emodirs ) )
+ {
+ foreach ( $emodirs as $newdir )
+ {
+ if ( file_exists( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $newdir . "/" . $FILE_NAME ) )
+ {
+ continue;
+ }
+
+ if( @copy( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $first_dir . "/" .$FILE_NAME, DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $newdir . "/" . $FILE_NAME ) )
+ {
+ @chmod( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $newdir . "/" . $FILE_NAME, 0777 );
+ }
+ }
+ }
+
+ $uploaded++;
+ }
+ }
+
+ if( !$uploaded )
+ {
+ $this->registry->output->global_message = $this->lang->words['no_emo_selected'];
+ }
+ else
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_complete'];
+ }
+
+ $this->emoticonsOverview();
+ }
+
+ /**
+ * Removes an emoticon set
+ *
+ * @access public
+ * @return void
+ */
+ public function emoticonsSetRemove()
+ {
+ /* Check the ID */
+ if ( ! $this->request['id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_noset'];
+ $this->emoticonsOverview();
+ }
+
+ /* Can't remove the default set */
+ if( $this->request['id'] == 'default' )
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_norename'];
+ $this->emoticonsOverview();
+ return;
+ }
+
+ /* Remove the directory */
+ $this->registry->adminFunctions->removeDirectory( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $this->request['id'] );
+
+ /* Remove the database entry */
+ $this->DB->delete( 'emoticons', "emo_set='{$this->request['id']}'" );
+
+ /* Rebuild cache */
+ $this->emoticonsRebuildCache();
+
+ /* Bounce */
+ $this->registry->output->global_message = $this->lang->words['emo_folder_rem'];
+ $this->emoticonsOverview();
+ }
+
+ /**
+ * Add/Edit an emoticon folder name
+ *
+ * @access public
+ * @param string Type (add or edit)
+ * @return void
+ */
+ public function emoticonsSetAlter( $type='add' )
+ {
+ /* Get the name */
+ $name = preg_replace( "/[^a-zA-Z0-9\-_]/", "", $this->request['emoset'] );
+
+ /* Check th ename */
+ if( $name == "" )
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_a_to_z'];
+ return $this->emoticonsOverview();
+ }
+
+ /* Check Safe Mode */
+ if( SAFE_MODE_ON )
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_safemode'];
+ return $this->emoticonsOverview();
+ }
+
+ /* Check to see if the directory already exists */
+ if( file_exists( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $name ) )
+ {
+ $this->registry->output->global_message = sprintf( $this->lang->words['emo_already'], $name );
+ return $this->emoticonsOverview();
+ }
+
+ if( $type == 'add' )
+ {
+ /* Create the directory */
+ if( @mkdir( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $name, 0777 ) )
+ {
+ @chmod( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $name, 0777 );
+ @file_put_contents( DOC_IPS_ROOT_PATH . 'public/style_emoticons/' . $name . '/index.html', '' );
+
+ /* Copy default emoticons */
+ try
+ {
+ foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . '/public/style_emoticons/default/' ) as $file )
+ {
+ if( ! $file->isDot() )
+ {
+ @copy( DOC_IPS_ROOT_PATH . '/public/style_emoticons/default/' . $file->getFilename(), DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $name . '/' . $file->getFilename() );
+ @chmod( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $name . '/' . $file->getFilename(), 0777 );
+ }
+ }
+ } catch ( Exception $e ) {}
+
+ /* Query the default set */
+ $this->DB->build( array( 'select' => '*', 'from' => 'emoticons', 'where' => "emo_set='default'" ) );
+ $outer = $this->DB->execute();
+
+ /* Insert emoticons for the new set */
+ while( $r = $this->DB->fetch($outer) )
+ {
+ $this->DB->insert( "emoticons", array( 'clickable' => $r['clickable'], 'typed' => $r['typed'], 'emo_set' => $name, 'image' => $r['image'] ) );
+ }
+
+ /* Bounce */
+ $this->registry->output->global_message = $this->lang->words['emo_folder_new'];
+ return $this->emoticonsOverview();
+ }
+ else
+ {
+ /* Couldn't create the directory, Bounce */
+ $this->registry->output->global_message = $this->lang->words['emo_ftp'];
+ return $this->emoticonsOverview();
+ }
+ }
+ /* Edit Folder Name */
+ else
+ {
+ /* Check the directory ID */
+ if ( ! $this->request['id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_miss_dir'];
+ $this->emoticonsOverview();
+ return;
+ }
+
+ /* Can't rename the default directory */
+ if( $this->request['id'] == 'default' )
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_norename'];
+ $this->emoticonsOverview();
+ return;
+ }
+
+ /* Rename the directory */
+ if ( @rename( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $this->request['id'], DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $name ) )
+ {
+ /* Check to see if the rename worked */
+ if ( file_exists( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $name ) )
+ {
+ /* Update all the emoticons */
+ $this->DB->update( 'emoticons', array( 'emo_set' => $name ), "emo_set='{$this->request['id']}'" );
+ }
+
+ /* Rebuild the cache */
+ $this->emoticonsRebuildCache();
+
+ /* Update skins that are using this set */
+ $rebuild_sets = array();
+
+ /* Querh skin sets */
+ $this->DB->build( array( 'select' => 'set_id', 'from' => 'skin_collections', 'where' => "set_emo_dir='{$this->request['id']}'" ) );
+ $outer = $this->DB->execute();
+
+ /* Loop thorugh and update the emoticon folder */
+ while( $r = $this->DB->fetch($outer) )
+ {
+ $this->DB->update( 'skin_collections', array( 'set_emo_dir' => $name ), 'set_id=' . $r['set_id'] );
+ $rebuild_sets[] = $r['set_id'];
+ }
+
+ /* Bounce */
+ $this->registry->output->global_message = $this->lang->words['emo_folder_name'];
+ return $this->emoticonsOverview();
+ }
+ else
+ {
+ /* Error and bounce */
+ $this->registry->output->global_message = $this->lang->words['emo_wecantdoit'];
+ return $this->emoticonsOverview();
+ }
+ }
+ }
+
+ /**
+ * Process edit emoticons forum
+ *
+ * @access public
+ * @return void
+ */
+ public function emoticonsEdit()
+ {
+ /* Check ID */
+ if( $this->request['id'] == '' )
+ {
+ $this->registry->output->global_message = $this->lang->words['emo_nogid'];
+ return $this->emoticonsOverview();
+ }
+
+ /* Loop through the request and pull out emoticons */
+ foreach( $this->request as $key => $value )
+ {
+ /* Check to see if its an emoticon */
+ if ( preg_match( "/^emo_id_(\d+)$/", $key, $match ) )
+ {
+ if ( $match[0] )
+ {
+ /* INI */
+ $typed = '';
+
+ /* Format type for default set */
+ if( $this->request['id'] == 'default' )
+ {
+ $typed = str_replace( '"', "", $this->request[ 'emo_type_' . $match[1] ] );
+ $typed = str_replace( '\', "", $typed );
+ }
+
+ /* Check clickable */
+ $click = $this->request[ 'emo_click_' . $match[1] ];
+
+ /* Update the emoticon */
+ if ( $match[1] )
+ {
+ if( $typed )
+ {
+ /* Get the original name */
+ $orig_typed = $this->DB->buildAndFetch( array( 'select' => 'typed', 'from' => 'emoticons', 'where' => 'id=' . intval( $match[1] ) ) );
+
+ /* Update to new name */
+ $this->DB->update( 'emoticons', array( 'clickable' => intval( $click ), 'typed' => $typed ), 'id=' . intval( $match[1] ) );
+ $this->DB->update( 'emoticons', array( 'typed' => $typed ), "typed='" . $orig_typed['typed'] . "'" );
+ }
+ else
+ {
+ /* Just update clickable */
+ $this->DB->update( 'emoticons', array( 'clickable' => intval( $click ) ), 'id='.intval( $match[1] ) );
+ }
+ }
+ }
+ }
+ }
+
+ /* Recache and bounce */
+ $this->emoticonsRebuildCache();
+
+ $this->registry->output->global_message = $this->lang->words['emo_updated'];
+ $this->emoticonsManageDirectory();
+ }
+
+ /**
+ * Manage emoticons
+ *
+ * @access public
+ * @return void
+ */
+ public function emoticonsManageDirectory()
+ {
+ /* INI */
+ $this->request['id'] = trim( $this->request['id'] );
+
+ /* Get emoticons for this group */
+ $emo_db = array();
+ $emo_file = array();
+
+ $this->DB->build( array(
+ 'select' => '*',
+ 'from' => 'emoticons',
+ 'where' => "emo_set='{$this->request['id']}'",
+ 'order' => 'clickable DESC, image ASC'
+ ) );
+ $this->DB->execute();
+
+ /* Loop through the emoticons */
+ while( $r = $this->DB->fetch() )
+ {
+ $emo_db[ $r['image'] ] = $r;
+ }
+
+
+ /* Get emoticons from the directory */
+ $emo_file = array();
+ $emo_rfile = $this->_emoticonGetGolderContents( $this->request['id'] );
+
+ foreach( $emo_rfile as $ef )
+ {
+ $emo_file[ $ef ] = $ef;
+ }
+
+ /* Number of emoticons to show per row */
+ $per_row = 5;
+ $td_width = 100 / $per_row;
+
+ /* Loop through the database emoticons */
+ $poss_names = array();
+ $db_rows = array();
+
+ foreach( $emo_db as $image => $data )
+ {
+ /* Remove this from the file list, it's already added */
+ unset( $emo_file[ $image ] );
+
+ /* Clickable? */
+ if ( $data['clickable'] )
+ {
+ $data['_click'] = 'checked="checked"';
+ $data['_class'] = 'tablerow1';
+ }
+ else
+ {
+ $data['_click'] = '';
+ $data['_class'] = 'tablerow2';
+ }
+
+ /* Add image to array */
+ $data['image'] = $image;
+
+ /* Addd array to output */
+ $db_rows[] = $data;
+
+ /* Possible names filter */
+ $poss_names[$data['typed']] = $data['typed'];
+ }
+
+ /* Check for unassigned images in the emoticon directory */
+ $file_rows = array();
+
+ if ( count( $emo_file ) && $this->request['id'] == 'default' )
+ {
+ /* Loop through the unassigned emoticons */
+ foreach( $emo_file as $image )
+ {
+ /* INI */
+ $_fdata = array();
+
+ /* Suggest an emoticon name */
+ $_fdata['poss_name'] = ':'.preg_replace( "/(.*)(\..+?)$/", "\\1", $image ).':';
+
+ if ( isset($poss_names[ $_fdata['poss_name'] ]) AND $poss_names[ $_fdata['poss_name'] ] )
+ {
+ $_fdata['poss_name'] = preg_replace( "/:$/", "2:", $_fdata['poss_name'] );
+ }
+
+ /* Add the image */
+ $_fdata['image'] = $image;
+
+ /* Add to output array */
+ $file_rows[] = $_fdata;
+ }
+ }
+
+ /* Output */
+
+ $this->registry->output->extra_nav[] = array( '', $this->lang->words['emo_manage_set'].$this->request['id'] );
+ $this->registry->output->html .= $this->html->emoticonsDirectoryManagement( $db_rows, $file_rows, $td_width, $per_row );
+ }
+
+ /**
+ * Builds the emoticons overview screen
+ *
+ * @access public
+ * @return void
+ */
+ public function emoticonsOverview()
+ {
+ /* Check for the emoticon directory */
+ if ( ! is_dir( DOC_IPS_ROOT_PATH . '/public/style_emoticons' ) )
+ {
+ $this->registry->output->showError( $this->lang->words['emo_nolocate'], 2111 );
+
+ }
+
+ /* Check the emoticon count */
+ $this->DB->build( array( 'select' => 'id, count(id) as count, emo_set',
+ 'from' => 'emoticons',
+ 'group' => 'emo_set, id',
+ 'order' => 'emo_set'
+ ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $emo_db[ $r['emo_set'] ] = $r;
+ }
+
+ /* Get emoticon folders */
+ $emodirs = array( 0 => '');
+
+ try
+ {
+ foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . '/public/style_emoticons' ) as $_emoticon )
+ {
+ if ( $_emoticon->isDir() AND ! $_emoticon->isDot() AND $_emoticon->getFilename() != '.svn' )
+ {
+ if ( is_dir( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $_emoticon ) )
+ {
+ if( $_emoticon->getFilename() == 'default' )
+ {
+ $emodirs[0] = $_emoticon->getFilename();
+ }
+ else
+ {
+ $emodirs[] = $_emoticon->getFilename();
+ }
+ }
+ }
+ }
+ } catch ( Exception $e ) {}
+
+ /* Loop through the emoticon directories */
+ $rows = array();
+ $i = 0;
+ $total = count($emodirs);
+
+ foreach( $emodirs as $dir )
+ {
+ $i++;
+
+ $data = array();
+
+ $files = $this->_emoticonGetGolderContents( $dir );
+ $data['count'] = intval( count($files) );
+
+ if( $dir == 'default' )
+ {
+ $data['line_image'] = '';
+ $data['link_text'] = $this->lang->words['emo_manageemos'];
+ }
+ else
+ {
+ $data['link_text'] = $this->lang->words['emo_setclickable'];
+
+ if( $i == $total )
+ {
+ $data['line_image'] = " ";
+ }
+ else
+ {
+ $data['line_image'] = " ";
+ }
+ }
+
+ if ( is_writeable( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $dir ) )
+ {
+ if( $dir == 'default' )
+ {
+ $checked_def = "checked='checked' disabled='disabled' ";
+ }
+ else
+ {
+ $checked_def = "";
+ }
+
+ $data['icon'] = 'icon_can_write.gif';
+ $data['title'] = $this->lang->words['emo_writeable'];
+ $data['checkbox'] = " ";
+ }
+ else
+ {
+ $data['icon'] = 'icon_cannot_write.gif';
+ $data['title'] = $this->lang->words['emo_writeable_not'];
+ $data['checkbox'] = "-";
+ }
+
+ $data['dir'] = $dir;
+ $data['dir_count'] = intval( $emo_db[ $dir ]['count'] );
+
+ $rows[] = $data;
+ }
+
+ $this->registry->output->html .= $this->html->emoticonsOverview( $rows );
+ }
+
+ /**
+ * Rebuilds the emoticon cache
+ *
+ * @access public
+ * @return void
+ */
+ public function emoticonsRebuildCache()
+ {
+ $cache = array();
+
+ $this->DB->build( array( 'select' => 'typed,image,clickable,emo_set', 'from' => 'emoticons' ) );
+ $c = $this->DB->execute();
+
+ while ( $r = $this->DB->fetch( $c ) )
+ {
+ $cache[] = $r;
+ }
+
+ usort( $cache, array( $this, '_thisUsort' ) );
+
+ ipsRegistry::cache()->setCache( 'emoticons', $cache, array( 'array' => 1 ) );
+ }
+
+ /**
+ * Custom sort operation
+ *
+ * @access private
+ * @param string A
+ * @param string B
+ * @return integer
+ */
+ private static function _thisUsort($a, $b)
+ {
+ if ( strlen($a['typed']) == strlen($b['typed']) )
+ {
+ return 0;
+ }
+
+ return ( strlen($a['typed']) > strlen($b['typed']) ) ? -1 : 1;
+ }
+
+ /**
+ * Gets all the emoticons from the specified directory
+ *
+ * @access private
+ * @param string $folder Emoticon folder to pull emoticons from
+ * @return array
+ **/
+ private function _emoticonGetGolderContents( $folder='default' )
+ {
+ $files = array();
+
+ /* Loop through the emoticon directory */
+ try
+ {
+ foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . '/public/style_emoticons/' . $folder ) as $_emo )
+ {
+ if( $_emo->isFile() && ! $_emo->isDot() )
+ {
+ if ( preg_match( "/\.(?:gif|jpg|jpeg|png|swf)$/i", $_emo->getFilename() ) )
+ {
+ $files[] = $_emo->getFilename();
+ }
+ }
+ }
+ } catch ( Exception $e ) {}
+
+ return $files;
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/posts/index.html b/upload/admin/applications/core/modules_admin/posts/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/posts/index.html
+++ b/upload/admin/applications/core/modules_admin/posts/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/posts/media.php b/upload/admin/applications/core/modules_admin/posts/media.php
index 8a55eeab..2e27c71d 100644
--- a/upload/admin/applications/core/modules_admin/posts/media.php
+++ b/upload/admin/applications/core/modules_admin/posts/media.php
@@ -1,434 +1,474 @@
-Incorrect accessYou 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§ion=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 ) );
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * BBCode Media Tag Management
+ * Last Updated: $LastChangedDate: 2010-10-18 13:10:17 -0400 (Mon, 18 Oct 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 27th January 2004
+ * @version $Rev: 6990 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access 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
+ *
+ * @var object Skin templates
+ */
+ private $html;
+
+ /**
+ * Main class entry point
+ *
+ * @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§ion=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 'reorder':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'media_manage' );
+ $this->_moveMediaTag();
+ 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();
+ }
+
+ /**
+ * Reorder media tags
+ *
+ * @return void
+ */
+ private function _moveMediaTag()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
+ $ajax = new $classToLoad();
+
+ //-----------------------------------------
+ // Checks...
+ //-----------------------------------------
+
+ if( $this->registry->adminFunctions->checkSecurityKey( $this->request['md5check'], true ) === false )
+ {
+ $ajax->returnString( $this->lang->words['postform_badmd5'] );
+ exit();
+ }
+
+ //-----------------------------------------
+ // Save new position
+ //-----------------------------------------
+
+ $position = 1;
+
+ if( is_array($this->request['media']) AND count($this->request['media']) )
+ {
+ foreach( $this->request['media'] as $this_id )
+ {
+ $this->DB->update( 'bbcode_mediatag', array( 'mediatag_position' => $position ), 'mediatag_id=' . $this_id );
+
+ $position++;
+ }
+ }
+
+ $ajax->returnString( 'OK' );
+ exit();
+ }
+
+ /**
+ * Import a mediaTag XML file
+ *
+ * @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
+ *
+ * @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
+ *
+ * @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
+ *
+ * @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
+ *
+ * @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' => IPSText::formToText( 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
+ *
+ * @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'] ) ? IPSText::textToForm( $this->request['mediatag_match'] ) : IPSText::textToForm( $data['mediatag_match'] );
+ $data['mediatag_replace'] = ( isset( $this->request['mediatag_replace'] ) && $this->request['mediatag_replace'] ) ? IPSText::textToForm( $this->request['mediatag_replace'] ) : IPSText::textToForm( $data['mediatag_replace'] );
+ }
+
+ /* Setup Form */
+ $this->registry->output->html .= $this->html->mediaTagForm( $type, $data, $errors );
+ }
+
+ /**
+ * List all the the current media tag types
+ *
+ * @return void
+ */
+ private function _mediaTagIndex()
+ {
+ /* Query Bookmarks */
+ $this->DB->build( array(
+ 'select' => '*',
+ 'from' => 'bbcode_mediatag',
+ 'order' => 'mediatag_position 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
+ *
+ * @return void
+ */
+ public function recacheMediaTag()
+ {
+ /* Query the tags */
+ $this->DB->build( array( 'select' => '*', 'from' => 'bbcode_mediatag', 'order' => 'mediatag_position ASC' ) );
+ $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 ) );
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/posts/xml/index.html b/upload/admin/applications/core/modules_admin/posts/xml/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/posts/xml/index.html
+++ b/upload/admin/applications/core/modules_admin/posts/xml/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/report/defaultSection.php b/upload/admin/applications/core/modules_admin/report/defaultSection.php
index 8c9c549a..a9d8d636 100644
--- a/upload/admin/applications/core/modules_admin/report/defaultSection.php
+++ b/upload/admin/applications/core/modules_admin/report/defaultSection.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Define the default reports section
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4948 $
+ * @version $Rev: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_admin/report/index.html b/upload/admin/applications/core/modules_admin/report/index.html
new file mode 100644
index 00000000..dfdb4ca9
--- /dev/null
+++ b/upload/admin/applications/core/modules_admin/report/index.html
@@ -0,0 +1,10 @@
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/report/reports.php b/upload/admin/applications/core/modules_admin/report/reports.php
index eacdec21..5ef00b34 100644
--- a/upload/admin/applications/core/modules_admin/report/reports.php
+++ b/upload/admin/applications/core/modules_admin/report/reports.php
@@ -1,1301 +1,1290 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
- exit();
-}
-
-class admin_core_report_reports 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_reports');
-
- //-----------------------------------------
- // Set up stuff
- //-----------------------------------------
-
- $this->form_code = $this->html->form_code = 'module=report§ion=reports';
- $this->form_code_js = $this->html->form_code_js = 'module=report§ion=reports';
-
- //-----------------------------------------
- // Load lang
- //-----------------------------------------
-
- $this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_posts' ) );
-
- //-----------------------------------------
- // How would you like your eggs cooked?
- //-----------------------------------------
-
- switch( $this->request['do'] )
- {
- case 'plugin_toggle':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'plugins_manage' );
- $this->_togglePlugin();
- break;
- case 'create_plugin':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'plugins_manage' );
- $this->_createPlugin();
- break;
- case 'edit_plugin':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'plugins_manage' );
- $this->_editPlugin();
- break;
- case 'change_plugin':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'plugins_manage' );
- $this->_changePlugin();
- break;
- case 'remove_plugin':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'plugins_remove' );
- $this->_removePlugin();
- break;
- case 'plugin':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'plugins_manage' );
- $this->_showPluginIndex();
- break;
-
- case 'remove_image':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sands_remove' );
- $this->_removeImage();
- break;
- case 'add_image':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sands_manage' );
- $this->_addImage();
- break;
- case 'edit_image':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sands_manage' );
- $this->_editImage();
- break;
- case 'status':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sands_manage' );
- $this->_showStatusIndex();
- break;
- case 'set_status':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sands_manage' );
- $this->_setStatus();
- break;
- case 'remove_status':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sands_manage' );
- $this->_removeStatus();
- break;
- case 'create_status':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sands_manage' );
- $this->_createStatus();
- break;
- case 'edit_status':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sands_manage' );
- $this->_editStatus();
- break;
- case 'reorder':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sands_manage' );
- $this->_moveStatus();
- break;
-
- case 'chart_report_stats':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'stats_access' );
- $this->_reportsChart();
- break;
- case 'chart_top_moderator':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'stats_access' );
- $this->_moderatorsChart();
- break;
- default:
- case 'main':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'stats_access' );
- $this->_mainScreen();
- break;
-
- }
-
- /* Output */
- $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
- $this->registry->output->sendOutput();
- }
-
- /**
- * Displays the overview page with version info, blog, stats, etc...
- *
- * @access private
- * @return void
- */
- private function _mainScreen()
- {
- $this->DB->build( array( 'select' => 'id', 'from' => 'rc_reports' ) );
- $this->DB->execute();
- $num_reports = $this->DB->getTotalRows();
-
- $this->DB->build( array( 'select' => 'id', 'from' => 'rc_comments' ) );
- $this->DB->execute();
- $num_comments = $this->DB->getTotalRows();
-
- $this->DB->build( array( 'select' => 'onoff', 'from' => 'rc_classes' ) );
- $this->DB->execute();
-
- $plug_on = 0;
- $plug_total = 0;
-
- while( $plugs = $this->DB->fetch() )
- {
- if( $plugs['onoff'] == 1 )
- {
- $plug_on++;
- }
-
- $plug_total++;
- }
-
- $this->registry->output->html .= $this->html->overview_main_template( array(
- 'reports_total' => $num_reports,
- 'comments_total' => $num_comments,
- 'active_plugins' => $plug_on,
- 'total_plugins' => $plug_total,
- ) );
- }
-
-
- /**
- * This function is used when you disable/enable a report plugin
- *
- * @access private
- * @return void
- */
- private function _togglePlugin()
- {
- $plugin_id = intval($this->request['plugin_id']);
-
- //--------------------------------------------
- // Checks...
- //--------------------------------------------
-
- if ( ! $plugin_id )
- {
- $this->registry->output->global_message = $this->lang->words['r_noid'];
- $this->_showPluginIndex();
- return;
- }
-
- //--------------------------------------------
- // Get from database
- //--------------------------------------------
-
- $component = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_classes', 'where' => 'com_id=' . $plugin_id ) );
-
- $com_enabled = $component['onoff'] ? 0 : 1;
-
- $this->DB->update( 'rc_classes', array( 'onoff' => $com_enabled ), 'com_id=' . $plugin_id );
-
- $this->registry->output->global_message = $this->lang->words['r_toggle'];
- $this->_showPluginIndex();
- }
-
- /**
- * Basics for creating a plugin (with only file name, title, and description)
- *
- * @access private
- * @return void
- */
- private function _createPlugin()
- {
- if( $_POST['finish'] == 1 )
- {
- //-----------------------------------------
- // Make sure stuff is right
- //-----------------------------------------
-
- if( ! $_POST['plugi_title'] || ! $_POST['plugi_desc'] || ! $_POST['plugi_file'] )
- {
- $this->registry->output->global_message = $this->lang->words['r_missingfield'];
- }
- elseif( preg_match("/[^a-z0-9\-_]/i", $this->request['plugi_file'] ) )
- {
- $this->registry->output->global_message = $this->lang->words['r_incchar'];
- }
- elseif( ! file_exists( IPSLib::getAppDir('core') . '/sources/reportPlugins/' . $this->request['plugi_file'] . '.php' ) )
- {
- $this->registry->output->global_message = $this->lang->words['r_404file'];
- }
-
- //-----------------------------------------
- // If no errors, create the plugin
- //-----------------------------------------
-
- if( ! $this->registry->output->global_message )
- {
- $build_plugin = array(
- 'onoff' => 1,
- 'class_title' => $this->request['plugi_title'],
- 'class_desc' => IPSText::stripslashes( $_POST['plugi_desc'] ),
- 'author' => $this->request['plugi_author'],
- 'author_url' => $this->request['plugi_author_url'],
- 'my_class' => $this->request['plugi_file'],
- 'pversion' => 'v' . strval($this->request['plugi_version']),
- 'lockd' => 0,
- );
-
- $this->DB->insert( 'rc_classes', $build_plugin );
-
- $plugin_id = $this->DB->getInsertId();
-
- //-----------------------------------------
- // Redirect to edit the plugin for more
- //-----------------------------------------
-
- $this->registry->output->doneScreen( $this->lang->words['r_plugincreate'], $this->lang->words['r_finishplugin'], "{$this->form_code}&do=edit_plugin&com_id=" . $plugin_id, 'redirect' );
- }
- }
-
- //-----------------------------------------
- // Show the form
- //-----------------------------------------
-
- $this->registry->output->html .= $this->html->pluginForm();
- }
-
- /**
- * Here we are editing a plugin's settings
- *
- * @access private
- * @return void
- */
- private function _editPlugin()
- {
- $plug_id = intval( $this->request['com_id'] );
-
- //-----------------------------------------
- // Make sure the plug ID is not zero...
- //-----------------------------------------
-
- if( $plug_id < 1 )
- {
- $this->registry->output->global_message = $this->lang->words['r_noid'];
- $this->_showPluginIndex();
- return;
- }
-
- //-----------------------------------------
- // Pull up the plugin information...
- //-----------------------------------------
-
- $plug_data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_classes', 'where' => "com_id='{$plug_id}'" ) );
-
- //-----------------------------------------
- // Does this plugin even exist...?
- //-----------------------------------------
-
- if( !$plug_data['com_id'] )
- {
- $this->registry->output->global_message = $this->lang->words['r_plugnoexist'];
- $this->_showPluginIndex();
- return;
- }
-
- //-----------------------------------------
- // Load the plugin and it's information
- //-----------------------------------------
-
- if( $plug_data['my_class'] == '' )
- {
- $plug_data['my_class'] = 'default';
- }
-
- require_once( IPSLib::getAppDir('core') . '/sources/reportPlugins/' . $plug_data['my_class'] . '.php' );
- $plugin_name = $plug_data['my_class'] . '_plugin';
- $plugin = new $plugin_name( $this->registry );
-
- //-----------------------------------------
- // Load the plugin's extra data settings
- //-----------------------------------------
-
- if( $plug_data['extra_data'] && $plug_data['extra_data'] != 'N;' )
- {
- $plugin->_extra = unserialize( $plug_data['extra_data'] );
- }
- else
- {
- $plugin->_extra = array();
- }
-
- if( $_POST['finish'] == 1 )
- {
- //-----------------------------------------
- // Form was sent, so let's process stuff
- //-----------------------------------------
-
- $plug_error = $plugin->processAdminForm( $extra_data );
-
- if( $plugin_error )
- {
- $this->registry->output->global_message = $plug_error;
- }
-
- if( is_array( $_POST['plugi_can_report'] ) )
- {
- $p_can_report = ',' . implode( ',', $_POST['plugi_can_report'] ) . ',';
- }
-
- if( is_array( $_POST['plugi_gperm'] ) )
- {
- $p_can_gperm = ',' . implode( ',', $_POST['plugi_gperm'] ) . ',';
- }
-
- $build_plugin = array(
- 'onoff' => $this->request['plugi_onoff'],
- 'group_can_report' => $p_can_report,
- 'mod_group_perm' => $p_can_gperm,
- 'extra_data' => serialize($extra_data),
- );
-
- if( $plug_data['lockd'] == 0 || IN_DEV == 1 )
- {
- $build_plugin['lockd'] = $this->request['plugi_lockd'];
- }
-
- if( ! $this->registry->output->global_message )
- {
- $this->DB->update( 'rc_classes', $build_plugin, "com_id={$plug_id}" );
-
- $this->registry->output->doneScreen($this->lang->words['r_plugupdated'], $this->lang->words['r_plugmanager'], "{$this->form_code}&do=plugin", 'redirect' );
- }
- else
- {
- $plug_data = $build_plugin;
- }
- }
-
- //-----------------------------------------
- // Break up group perms into an array
- //-----------------------------------------
-
- if( $plug_data['group_can_report'] )
- {
- $sel_can_report = explode( ',' , $plug_data['group_can_report'] );
- }
-
- if( $plug_data['mod_group_perm'] )
- {
- $sel_group_perm = explode( ',' , $plug_data['mod_group_perm'] );
- }
-
- //-----------------------------------------
- // Display special plugin settings here...
- //-----------------------------------------
-
- $extraForm = $plugin->displayAdminForm( $plugin->_extra, $this->html );
-
- $this->registry->output->html .= $this->html->finishPluginForm( $plug_data, $sel_can_report, $sel_group_perm, $extraForm );
- }
-
- /**
- * Lock/unlock a plugin
- *
- * @access private
- * @return void
- */
- private function _changePlugin()
- {
- $plug_id = intval( $this->request['com_id'] );
-
- //-----------------------------------------
- // Make sure plugin ID is > than zero...
- //-----------------------------------------
-
- if( $plug_id < 1 )
- {
- $this->registry->output->global_message = $this->lang->words['r_noid'];
- $this->_showPluginIndex();
- return;
- }
-
- //-----------------------------------------
- // Load basic, very basic, information...
- //-----------------------------------------
-
- $plug_data = $this->DB->buildAndFetch( array( 'select' => 'com_id, my_class, class_title, class_desc, author, author_url, pversion', 'from' => 'rc_classes', 'where' => "com_id='{$plug_id}'" ) );
-
- //-----------------------------------------
- // Does our plugin even exist...?
- //-----------------------------------------
-
- if( !$plug_data['com_id'] )
- {
- $this->registry->output->global_message = $this->lang->words['r_plugnoexist'];
- $this->_showPluginIndex();
- return;
- }
-
- //-----------------------------------------
- // Can we even change this plugin?
- //-----------------------------------------
-
- if( $plug_data['lockd'] > 0 && !IN_DEV )
- {
- $this->registry->output->global_message = $this->lang->words['r_pluglocked'];
- $this->_showPluginIndex();
- return;
- }
-
- //-----------------------------------------
- // Let's start loading stuff...!
- //-----------------------------------------
-
- if( $plug_data['my_class'] == '' )
- {
- $plug_data['my_class'] = 'default';
- }
-
- if( $_POST['finish'] == 1 )
- {
- //-----------------------------------------
- // The form got sent, so lets go!
- //-----------------------------------------
-
- if( ! $_POST['plugi_title'] || ! $_POST['plugi_desc'] || ! $_POST['plugi_file'] )
- {
- $this->registry->output->global_message = $this->lang->words['r_missingfield'];
- }
- elseif( preg_match( "/[^a-z0-9_\-]/i", $_POST['plugi_file'] ) )
- {
- $this->registry->output->global_message = $this->lang->words['r_incchar'];
- }
-
- $build_plugin = array(
- 'class_title' => $this->request['plugi_title'],
- 'class_desc' => IPSText::stripslashes( $_POST['plugi_desc'] ),
- 'author' => $this->request['plugi_author'],
- 'author_url' => $this->request['plugi_author_url'],
- 'my_class' => $this->request['plugi_file'],
- 'pversion' => 'v' . strval($this->request['plugi_version']),
- 'lockd' => $this->request['plugi_lockd']
- );
-
- //-----------------------------------------
- // If file was changed blank out extra...
- //-----------------------------------------
-
- if( $plug_data['my_class'] != $build_plugin['my_class'] )
- {
- $build_plugin['extra_data'] = '';
- $do_edit = true;
- }
-
- if( ! $this->registry->output->global_message )
- {
- $this->DB->update( 'rc_classes', $build_plugin, "com_id={$plug_id}" );
-
- if( $do_edit == true )
- {
- //-----------------------------------------
- // Plugin was changed, need settings now
- //-----------------------------------------
-
- $this->registry->output->doneScreen($this->lang->words['r_plugupdated'], $this->lang->words['r_finishplugin'], "{$this->form_code}&do=edit_plugin&com_id=" . $plug_id, 'redirect' );
- }
- else
- {
- //-----------------------------------------
- // File was not changed, no need to edit..
- //-----------------------------------------
-
- $this->registry->output->doneScreen($this->lang->words['r_plugupdated'], $this->lang->words['r_plugmanager'], "{$this->form_code}&do=plugin", 'redirect' );
- }
- }
- else
- {
- $plug_data = $build_plugin;
- }
- }
-
- //-----------------------------------------
- // Basic info for when I hit "Save"...
- //-----------------------------------------
-
- $this->registry->output->html .= $this->html->pluginForm( $plug_data );
- }
-
- /**
- * This is when we want to remove a plugin, possibly cuz it's crap
- *
- * @access private
- * @return void
- */
- private function _removePlugin()
- {
- $com_id = intval( $this->request['com_id'] );
-
- //-----------------------------------------
- // Make sure we don't delete nothing...
- //-----------------------------------------
-
- if( $com_id < 1 )
- {
- $this->registry->output->global_message = $this->lang->words['r_deleteair'];
- $this->_showPluginIndex();
- return;
- }
-
- $row = $this->DB->buildAndFetch( array( 'select' => 'com_id, lockd', 'from' => 'rc_classes', 'where' => "com_id={$com_id}" ) );
-
- //-----------------------------------------
- // Make sure plugin exists first!
- // Again... NOTHING!
- //-----------------------------------------
-
- if( !$row['com_id'] )
- {
- $this->registry->output->global_message = $this->lang->words['r_plugin404'];
- $this->_showPluginIndex();
- return;
- }
-
- //-----------------------------------------
- // Make sure it isn't locked... Snicker..
- //-----------------------------------------
-
- if( $row['lockd'] == 1 && !IN_DEV )
- {
- $this->registry->output->global_message = $this->lang->words['r_dellocked'];
- $this->_showPluginIndex();
- return;
- }
-
- $this->DB->delete( 'rc_classes', "com_id={$com_id}" );
-
- $this->registry->output->doneScreen( $this->lang->words['r_deleteplug'], $this->lang->words['r_plugmanager'], "{$this->form_code}&do=plugin", 'redirect' );
- }
-
- /**
- * This is where you view all the plugins in a list with options
- *
- * @access private
- * @return void
- */
- private function _showPluginIndex()
- {
- $this->registry->output->extra_nav[] = array( "{$this->settings['base_url']}{$this->form_code}&do=plugin" , $this->lang->words['r_plugmanager'] );
-
- $this->DB->build( array( 'select' => '*', 'from' => 'rc_classes' ) );
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- $row['_enabled_img'] = $row['onoff'] == 1 ? 'tick.png' : 'cross.png';
-
- $plugin_rows .= $this->html->report_plugin_row( $row );
- }
-
- $this->registry->output->html = $this->html->report_plugin_overview( $plugin_rows );
- }
-
- /**
- * This is when you delete a status/severity image
- *
- * @access private
- * @return void
- */
- private function _removeImage()
- {
- $img_id = intval( $this->request['id'] );
-
- if( $img_id < 1 )
- {
- $this->registry->output->global_message = $this->lang->words['r_noid'];
- $this->_showStatusIndex();
- return;
- }
-
- $this->DB->delete( 'rc_status_sev', "id={$img_id}" );
-
- $this->registry->output->doneScreen( $this->lang->words['r_imgdel'], $this->lang->words['r_statsever'], "{$this->form_code}&do=status", 'redirect' );
- }
-
- /**
- * This is when I want to add a severity/status image
- *
- * @access private
- * @return void
- */
- private function _addImage()
- {
- $stat_id = intval( $this->request['id'] );
-
- //-----------------------------------------
- // Make sure that status isn't zero...
- //-----------------------------------------
-
- if( $stat_id < 1 )
- {
- $this->registry->output->global_message = $this->lang->words['r_noid'];
- $this->_showStatusIndex();
- return;
- }
-
- if( $_POST['finish'] == 1 )
- {
- //-----------------------------------------
- // Time to add that status img to DB...
- //-----------------------------------------
-
- $image_data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_status_sev', 'where' => "status='{$stat_id}' AND points={$this->request['img_points']}" ) );
-
- if( $image_data['id'] )
- {
- $this->registry->output->global_message = $this->lang->words['r_changepoints'];
- }
- else
- {
- $build_image = array(
- 'status' => $stat_id,
- 'img' => trim(IPSText::safeslashes($_POST['img_filename'])),
- 'width' => $this->request['img_width'],
- 'height' => $this->request['img_height'],
- 'points' => $this->request['img_points'],
- 'is_png' => ( mb_strtolower(strrchr( $this->request['img_filename'], '.' )) == '.png' ? 1 : 0 )
- );
-
- $this->DB->insert( 'rc_status_sev', $build_image, "id='{$img_id}'" );
-
- $this->registry->output->doneScreen($this->lang->words['r_imgsaved'], $this->lang->words['r_statsever'], "{$this->form_code}&do=status", 'redirect' );
- }
- }
-
- //-----------------------------------------
- // Load basic status data...
- //-----------------------------------------
-
- $status = $this->DB->buildAndFetch( array( 'select' => 'title', 'from' => 'rc_status', 'where' => "status='{$stat_id}'" ) );
-
- //-----------------------------------------
- // Does the status exist in the db?
- //-----------------------------------------
-
- if( !$status['title'] )
- {
- $this->registry->output->global_message = $this->lang->words['r_404status'];
- $this->_showStatusIndex();
- return;
- }
-
- //-----------------------------------------
- // Build the form so we can do something
- //-----------------------------------------
-
- $this->registry->output->html .= $this->html->imageForm( 'add_image', $status, $image_data );
- }
-
- /**
- * This is for setting, in status index, which is New, Complete, and Active
- *
- * @access private
- * @return void
- */
- private function _setStatus()
- {
- $stat_id = intval( $this->request['id'] );
-
- if( $stat_id < 1 )
- {
- $this->registry->output->global_message = $this->lang->words['r_noid'];
- }
-
- //-----------------------------------------
- // Load the status that needs a change
- //-----------------------------------------
-
- $row = $this->DB->buildAndFetch( array( 'select' => 'is_new, is_complete, is_active', 'from' => 'rc_status', 'where' => "status='{$stat_id}'" ) );
-
- if( $this->request['status'] == 'new' || $this->request['status'] == 'complete' )
- {
- //-----------------------------------------
- // We want to make it new or complete
- //-----------------------------------------
-
- if( $this->request['status'] == 'new' )
- {
- if( $row['is_complete'] == 1 )
- {
- $this->registry->output->global_message = $this->lang->words['r_newcomplete'];
- $this->_showStatusIndex();
- return;
- }
-
- $build_status = array( 'is_new' => 1 );
- $build_other_statuses = array( 'is_new' => 0 );
- }
- else
- {
- if( $row['is_new'] == 1 )
- {
- $this->registry->output->global_message = $this->lang->words['r_completenew'];
- $this->_showStatusIndex();
- return;
- }
-
- $build_status = array( 'is_complete' => 1 );
- $build_other_statuses = array( 'is_complete' => 0 );
- }
-
- $this->DB->update( 'rc_status', $build_other_statuses, "status<>{$stat_id}" );
- $this->DB->update( 'rc_status', $build_status, "status={$stat_id}" );
- }
- elseif( $this->request['status'] == 'active' )
- {
- //-----------------------------------------
- // We can have as many active as we want
- //-----------------------------------------
-
- $this->DB->update( 'rc_status', array( 'is_active' => ( ! $row['is_active'] ) ), "status={$stat_id}" );
- }
- else
- {
- //-----------------------------------------
- // What the heck can this be?
- //-----------------------------------------
-
- $this->registry->output->global_message = $this->lang->words['r_invpar'];
- }
-
- $this->_showStatusIndex();
- }
-
- /**
- * This is the magic behind removing a status and the images behind it
- *
- * @access private
- * @return void
- */
- private function _removeStatus()
- {
- $stat_id = intval( $this->request['id'] );
-
- if( $stat_id < 1 )
- {
- $this->registry->output->global_message = $this->lang->words['r_deleteair'];
- $this->_showStatusIndex();
- return;
- }
-
- $row = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_status', 'where' => "status='{$stat_id}'" ) );
-
- if( !$row['status'] )
- {
- $this->registry->output->global_message = $this->lang->words['r_noid'];
- $this->_showStatusIndex();
- return;
- }
-
- //-----------------------------------------
- // Make sure we arn't removing something
- // that we are going to need.
- //-----------------------------------------
-
- if( $row['is_new'] == 1 )
- {
- $this->registry->output->global_message = $this->lang->words['r_onenew'];
- $this->_showStatusIndex();
- return;
- }
- elseif( $row['is_complete'] == 1 )
- {
- $this->registry->output->global_message = $this->lang->words['r_onecomplete'];
- $this->_showStatusIndex();
- return;
- }
-
- //-----------------------------------------
- // Remove the status and its images
- //-----------------------------------------
-
- $this->DB->delete( 'rc_status', "status='{$stat_id}'" );
- $this->DB->delete( 'rc_status_sev', "status='{$stat_id}'" );
-
- $this->registry->output->doneScreen($this->lang->words['r_statdel'], $this->lang->words['r_statsever'], "{$this->form_code}&do=status", 'redirect' );
- }
-
- /**
- * Here is where you create a status (before the added images)
- *
- * @access private
- * @return void
- */
- private function _createStatus()
- {
- if( $_POST['finish'] == 1 )
- {
- //-----------------------------------------
- // The form has been sent, lets go!
- //-----------------------------------------
-
- if( preg_match("/[^0-9]/", $_POST['stat_ppr'] ) )
- {
- $this->registry->output->global_message = $this->lang->words['r_ppr'];
- }
- elseif( preg_match("/[^0-9\.]/", $_POST['stat_pph'] ) )
- {
- $this->registry->output->global_message = $this->lang->words['r_mtp'];
- }
- else if( !$this->request['stat_title'] )
- {
- $this->registry->output->global_message = $this->lang->words['r_nostattitle'];
- }
- else
- {
- $stat_check = $this->DB->buildAndFetch( array( 'select' => 'MAX(rorder) as rorder', 'from' => 'rc_status' ) );
-
- $build_status = array(
- 'title' => $this->request['stat_title'],
- 'points_per_report' => $this->request['stat_ppr'],
- 'minutes_to_apoint' => $this->request['stat_pph'],
- 'rorder' => $stat_check['rorder'] + 1,
- );
-
- $this->DB->insert( 'rc_status', $build_status );
-
- $this->registry->output->doneScreen( $this->lang->words['r_statcreated'], $this->lang->words['r_statsever'], "{$this->form_code}&do=status", 'redirect' );
- }
- }
-
- $this->registry->output->html .= $this->html->statusForm();
- }
-
- /**
- * This is when I want to edit a status
- *
- * @access private
- * @return void
- */
- private function _editStatus()
- {
- $stat_id = intval( $this->request['id'] );
-
- //-----------------------------------------
- // Make sure the status ID is not zero
- //-----------------------------------------
-
- if( $stat_id < 1 )
- {
- $this->registry->output->global_message = $this->lang->words['r_noid'];
- $this->_showStatusIndex();
- return;
- }
-
- if( $_POST['finish'] == 1 )
- {
- //-----------------------------------------
- // We just sen't the form, check stuff
- //-----------------------------------------
-
- if( preg_match("/[^0-9]/", $_POST['stat_ppr'] ) )
- {
- $this->registry->output->global_message = $this->lang->words['r_ppr'];
- }
- elseif( preg_match("/[^0-9\.]/", $_POST['stat_pph'] ) )
- {
- $this->registry->output->global_message = $this->lang->words['r_mtp'];
- }
- else
- {
- $build_status = array(
- 'title' => $this->request['stat_title'],
- 'points_per_report' => $this->request['stat_ppr'],
- 'minutes_to_apoint' => $this->request['stat_pph'],
- );
-
- $this->DB->update( 'rc_status', $build_status, "status='{$stat_id}'" );
-
- $this->registry->output->doneScreen( $this->lang->words['r_statsaved'], $this->lang->words['r_statsever'], "{$this->form_code}&do=status", 'redirect' );
- }
- }
-
- $stat_data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_status', 'where' => "status='{$stat_id}'" ) );
-
- //-----------------------------------------
- // Make sure the status actually exists
- //-----------------------------------------
-
- if( !$stat_data['status'] )
- {
- $this->registry->output->global_message = $this->lang->words['r_noid'];
- $this->_showStatusIndex();
- return;
- }
-
- $this->registry->output->html .= $this->html->statusForm( 'edit_status', $stat_data );
- }
-
- /**
- * This is where you edit an image under a status
- *
- * @access private
- * @return void
- */
- private function _editImage()
- {
- $img_id = intval( $this->request['id'] );
-
- //-----------------------------------------
- // Make sure the ID is not zero...
- //-----------------------------------------
-
- if( $img_id < 1 )
- {
- $this->registry->output->global_message = $this->lang->words['r_noid'];
- $this->_showStatusIndex();
- return;
- }
-
- if( $_POST['finish'] == 1 )
- {
- //-----------------------------------------
- // Now it's time to send the form...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'rc_status_sev', 'where' => "status='{$this->request['img_status']}' AND points={$this->request['img_points']} AND id!={$img_id}", 'limit' => 1 ) );
- $this->DB->execute();
-
- if( $this->DB->getTotalRows() != 0 )
- {
- $this->registry->output->global_message = $this->lang->words['r_changepoints'];
- }
- else
- {
- $build_image = array(
- 'img' => trim(IPSText::safeslashes($_POST['img_filename'])),
- 'width' => $this->request['img_width'],
- 'height' => $this->request['img_height'],
- 'points' => $this->request['img_points'],
- 'is_png' => ( mb_strtolower(strrchr( $this->request['img_filename'], '.' )) == '.png' ? 1 : 0 )
- );
-
- $this->DB->update( 'rc_status_sev', $build_image, "id='{$img_id}'" );
-
- $this->registry->output->doneScreen($this->lang->words['r_imgsaved'], $this->lang->words['r_statsever'], "{$this->form_code}&do=status", 'redirect' );
- }
- }
-
- $image_data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_status_sev', 'where' => "id='{$img_id}'" ) );
-
- //-----------------------------------------
- // Make sure the image actually exists...
- //-----------------------------------------
-
- if( !$image_data['id'] )
- {
- $this->registry->output->global_message = $this->lang->words['r_noid'];
- $this->_showStatusIndex();
- return;
- }
-
- //-----------------------------------------
- // Load basic data so we can edit it
- //-----------------------------------------
-
- $status = $this->DB->buildAndFetch( array( 'select' => 'title', 'from' => 'rc_status', 'where' => "status='{$image_data['status']}'" ) );
-
- $this->registry->output->html .= $this->html->imageForm( 'edit_image', $status, $image_data );
- }
-
- /**
- * When we want to move the status up or down (not sideways...)
- *
- * @access private
- * @return void
- */
- private function _moveStatus()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- require_once( IPS_KERNEL_PATH . 'classAjax.php' );
- $ajax = new classAjax();
-
- //-----------------------------------------
- // Checks...
- //-----------------------------------------
-
- if( $this->registry->adminFunctions->checkSecurityKey( $this->request['md5check'], true ) === false )
- {
- $ajax->returnString( $this->lang->words['postform_badmd5'] );
- exit();
- }
-
- //-----------------------------------------
- // Save new position
- //-----------------------------------------
-
- $position = 1;
-
- if( is_array($this->request['status']) AND count($this->request['status']) )
- {
- foreach( $this->request['status'] as $this_id )
- {
- $this->DB->update( 'rc_status', array( 'rorder' => $position ), 'status=' . $this_id );
-
- $position++;
- }
- }
-
- $ajax->returnString( 'OK' );
- exit();
- }
-
- /**
- * Shows the status/severity index with all the special stuff
- *
- * @access private
- * @return void
- */
- private function _showStatusIndex()
- {
- $this->registry->output->extra_nav[] = array( "{$this->settings['base_url']}{$this->form_code}&do=status" , $this->lang->words['r_statsever'] );
-
- //-----------------------------------------
- // Get the default board skin...
- //-----------------------------------------
-
- $skin = $this->DB->buildAndFetch( array( 'select' => 'set_image_dir', 'from' => 'skin_collections', 'where' => "set_is_default=1" ) );
-
- //-----------------------------------------
- // Get the status images...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'rc_status_sev', 'order' => 'status ASC, points ASC' ) );
- $this->DB->execute();
-
- //-----------------------------------------
- // Store the status images in an array...
- //-----------------------------------------
-
- $status_image_cache = array();
-
- while( $srow = $this->DB->fetch() )
- {
- $status_image_cache[ $srow['status'] ] .= str_replace( '<#IMG_DIR#>', $skin['set_image_dir'], $this->html->report_status_image( $srow ) );
- }
-
- //-----------------------------------------
- // Load and process the stateses...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'rc_status', 'order' => 'rorder ASC' ) );
- $this->DB->execute();
-
- $total_statuses = $this->DB->getTotalRows();
-
- while( $row = $this->DB->fetch() )
- {
- //-----------------------------------------
- // Show the New/Complete/Active boxes...
- //-----------------------------------------
-
- $row['_is_new'] = $row['is_new'] == 1 ? 'on' : 'off';
- $row['_is_complete'] = $row['is_complete'] == 1 ? 'on' : 'off';
- $row['_is_active'] = $row['is_active'] == 1 ? 'on' : 'off';
-
- //-----------------------------------------
- // Finish row with image cache...
- //-----------------------------------------
-
- $row['status_images'] = $status_image_cache[ $row['status'] ];
- $status_rows .= $this->html->report_status_row( $row );
- }
-
- $this->registry->output->html = $this->html->report_status_overview( $status_rows );
- }
-
- /**
- * Shows report stats in the last 24 hours using chart class
- *
- * @access private
- * @return void
- */
- private function _reportsChart()
- {
- //-----------------------------------------
- // Let's build our data for the chart
- //-----------------------------------------
-
- $this->DB->build(
- array(
- 'select' => 'stat.title, COUNT(*) as num_reports',
- 'from' => array( 'rc_reports_index' => 'rep' ),
- 'where' => "( stat.is_active=1 OR ( stat.is_active=0 AND (" . time() . "-rep.date_updated)<86400 ) )",
- 'group' => 'rep.status',
- 'add_join' => array(
- array(
- 'from' => array( 'rc_reports' => 'reps' ),
- 'where' => 'rep.id=reps.rid'
- ),
- array(
- 'from' => array( 'rc_status' => 'stat' ),
- 'where' => 'stat.status=rep.status'
- ),
- )
- )
- );
- $this->DB->execute();
-
- $chart_data = array();
- $labels = array();
-
- while( $row = $this->DB->fetch() )
- {
- $chart_data[] = $row['num_reports'];
- $labels[] = $row['title'];
- }
-
- //-----------------------------------------
- // Let's draw our pie chart now
- //-----------------------------------------
-
- require_once( IPS_KERNEL_PATH . '/classGraph.php' );
- $graph = new classGraph();
- $graph->options['title'] = $this->lang->words['r_last24'];
- $graph->options['width'] = 400;
- $graph->options['height'] = 250;
- $graph->options['style3D'] = 1;
-
- if( count($chart_data) )
- {
- $graph->addLabels( $labels );
- $graph->addSeries( 'test', $chart_data );
- }
- else
- {
- $graph->addLabels( array( $this->lang->words['r_nodata'] ) );
- $graph->addSeries( 'test', array( 1 ) );
- }
-
- $graph->options['charttype'] = 'Pie';
- $graph->display();
- }
-
- /**
- * Shows bar graph of top five moderators. Show's what's been done
- *
- * @access private
- * @return void
- */
- private function _moderatorsChart()
- {
- //-----------------------------------------
- // Build data for the bar chart
- //-----------------------------------------
-
- $this->DB->build( array(
- 'select' => 'rep.id',
- 'from' => array( 'rc_reports' => 'reps' ),
- 'where' => 'stat.is_complete=1',
- 'add_join' => array(
- array(
- 'from' => array( 'rc_reports_index' => 'rep' ),
- 'where' => 'reps.rid=rep.id',
- ),
- array(
- 'from' => array( 'rc_status' => 'stat' ),
- 'where' => 'stat.status=rep.status',
- ),
- )
- ) );
- $this->DB->execute();
-
- $total_complete_reports = $this->DB->getTotalRows();
-
- $this->DB->build(
- array(
- 'select' => 'mem.members_display_name as name, COUNT(*) as num_reports',
- 'from' => array( 'rc_reports_index' => 'rep' ),
- 'where' => "stat.is_complete=1",
- 'group' => 'rep.updated_by',
- 'order' => 'num_reports DESC',
- 'limit' => array( 5 ),
- 'add_join' => array(
- array(
- 'from' => array( 'rc_reports' => 'reps' ),
- 'where' => 'rep.id=reps.rid'
- ),
- array(
- 'from' => array( 'rc_status' => 'stat' ),
- 'where' => 'stat.status=rep.status'
- ),
- array(
- 'from' => array( 'members' => 'mem' ),
- 'where' => 'mem.member_id=rep.updated_by'
- ),
- )
- )
- );
- $this->DB->execute();
-
- $chart_data = array();
- $labels = array();
-
- while( $row = $this->DB->fetch() )
- {
- $chart_data[] = $row['num_reports'];
- $labels[] = substr($row['name'],0,16);
- }
-
- //-----------------------------------------
- // Let's draw our pie chart now
- //-----------------------------------------
-
- require_once( IPS_KERNEL_PATH . '/classGraph.php' );
- $graph = new classGraph();
- $graph->options['title'] = $this->lang->words['r_top5'];
- $graph->options['width'] = 400;
- $graph->options['height'] = 250;
- $graph->options['style3D'] = 1;
-
- if( count($chart_data) )
- {
- $graph->addLabels( $labels );
- $graph->addSeries( 'test', $chart_data );
- }
- else
- {
- $graph->addLabels( array( $this->lang->words['r_nodata'] ) );
- $graph->addSeries( 'test', array( 1 ) );
- }
-
- $graph->options['charttype'] = 'Pie';
- $graph->display();
- }
-
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Management for reported content
+ * Last Updated: $LastChangedDate: 2010-10-18 13:10:17 -0400 (Mon, 18 Oct 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @author Based on original "Report Center" by Luke Scott
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6990 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+class admin_core_report_reports extends ipsCommand
+{
+ /**
+ * Skin object
+ *
+ * @var object Skin templates
+ */
+ private $html;
+
+ /**
+ * Main class entry point
+ *
+ * @param object ipsRegistry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ //-----------------------------------------
+ // Load skin
+ //-----------------------------------------
+
+ $this->html = $this->registry->output->loadTemplate('cp_skin_reports');
+
+ //-----------------------------------------
+ // Set up stuff
+ //-----------------------------------------
+
+ $this->form_code = $this->html->form_code = 'module=report§ion=reports';
+ $this->form_code_js = $this->html->form_code_js = 'module=report§ion=reports';
+
+ //-----------------------------------------
+ // Load lang
+ //-----------------------------------------
+
+ $this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_posts' ) );
+
+ //-----------------------------------------
+ // How would you like your eggs cooked?
+ //-----------------------------------------
+
+ switch( $this->request['do'] )
+ {
+ case 'plugin_toggle':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'plugins_manage' );
+ $this->_togglePlugin();
+ break;
+ case 'create_plugin':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'plugins_manage' );
+ $this->_createPlugin();
+ break;
+ case 'edit_plugin':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'plugins_manage' );
+ $this->_editPlugin();
+ break;
+ case 'change_plugin':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'plugins_manage' );
+ $this->_changePlugin();
+ break;
+ case 'remove_plugin':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'plugins_remove' );
+ $this->_removePlugin();
+ break;
+ case 'plugin':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'plugins_manage' );
+ $this->_showPluginIndex();
+ break;
+
+ case 'remove_image':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sands_remove' );
+ $this->_removeImage();
+ break;
+ case 'add_image':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sands_manage' );
+ $this->_addImage();
+ break;
+ case 'edit_image':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sands_manage' );
+ $this->_editImage();
+ break;
+ case 'status':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sands_manage' );
+ $this->_showStatusIndex();
+ break;
+ case 'set_status':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sands_manage' );
+ $this->_setStatus();
+ break;
+ case 'remove_status':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sands_manage' );
+ $this->_removeStatus();
+ break;
+ case 'create_status':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sands_manage' );
+ $this->_createStatus();
+ break;
+ case 'edit_status':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sands_manage' );
+ $this->_editStatus();
+ break;
+ case 'reorder':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sands_manage' );
+ $this->_moveStatus();
+ break;
+
+ case 'chart_report_stats':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'stats_access' );
+ $this->_reportsChart();
+ break;
+ case 'chart_top_moderator':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'stats_access' );
+ $this->_moderatorsChart();
+ break;
+ default:
+ case 'main':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'stats_access' );
+ $this->_mainScreen();
+ break;
+
+ }
+
+ /* Output */
+ $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * Displays the overview page with version info, blog, stats, etc...
+ *
+ * @return void
+ */
+ private function _mainScreen()
+ {
+ $this->DB->build( array( 'select' => 'id', 'from' => 'rc_reports' ) );
+ $this->DB->execute();
+ $num_reports = $this->DB->getTotalRows();
+
+ $this->DB->build( array( 'select' => 'id', 'from' => 'rc_comments' ) );
+ $this->DB->execute();
+ $num_comments = $this->DB->getTotalRows();
+
+ $this->DB->build( array( 'select' => 'onoff', 'from' => 'rc_classes' ) );
+ $this->DB->execute();
+
+ $plug_on = 0;
+ $plug_total = 0;
+
+ while( $plugs = $this->DB->fetch() )
+ {
+ if( $plugs['onoff'] == 1 )
+ {
+ $plug_on++;
+ }
+
+ $plug_total++;
+ }
+
+ $this->registry->output->html .= $this->html->overview_main_template( array(
+ 'reports_total' => $num_reports,
+ 'comments_total' => $num_comments,
+ 'active_plugins' => $plug_on,
+ 'total_plugins' => $plug_total,
+ ) );
+ }
+
+
+ /**
+ * This function is used when you disable/enable a report plugin
+ *
+ * @return void
+ */
+ private function _togglePlugin()
+ {
+ $plugin_id = intval($this->request['plugin_id']);
+
+ //--------------------------------------------
+ // Checks...
+ //--------------------------------------------
+
+ if ( ! $plugin_id )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_noid'];
+ $this->_showPluginIndex();
+ return;
+ }
+
+ //--------------------------------------------
+ // Get from database
+ //--------------------------------------------
+
+ $component = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_classes', 'where' => 'com_id=' . $plugin_id ) );
+
+ $com_enabled = $component['onoff'] ? 0 : 1;
+
+ $this->DB->update( 'rc_classes', array( 'onoff' => $com_enabled ), 'com_id=' . $plugin_id );
+
+ $this->registry->output->global_message = $this->lang->words['r_toggle'];
+ $this->_showPluginIndex();
+ }
+
+ /**
+ * Basics for creating a plugin (with only file name, title, and description)
+ *
+ * @return void
+ */
+ private function _createPlugin()
+ {
+ $this->registry->output->extra_nav[] = array( "{$this->settings['base_url']}{$this->form_code}&do=plugin" , $this->lang->words['r_plugmanager'] );
+
+ if( $_POST['finish'] == 1 )
+ {
+ //-----------------------------------------
+ // Make sure stuff is right
+ //-----------------------------------------
+
+ if( ! $_POST['plugi_title'] || ! $_POST['plugi_desc'] || ! $_POST['plugi_file'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_missingfield'];
+ }
+ elseif( preg_match("/[^a-z0-9\-_]/i", $this->request['plugi_file'] ) )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_incchar'];
+ }
+ elseif( ! file_exists( IPSLib::getAppDir( $this->request['appPlugin'] ) . '/extensions/reportPlugins/' . $this->request['plugi_file'] . '.php' ) )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_404file'];
+ }
+
+ //-----------------------------------------
+ // If no errors, create the plugin
+ //-----------------------------------------
+
+ if( ! $this->registry->output->global_message )
+ {
+ $build_plugin = array(
+ 'onoff' => 1,
+ 'class_title' => $this->request['plugi_title'],
+ 'class_desc' => IPSText::stripslashes( $_POST['plugi_desc'] ),
+ 'author' => $this->request['plugi_author'],
+ 'author_url' => $this->request['plugi_author_url'],
+ 'my_class' => $this->request['plugi_file'],
+ 'pversion' => 'v' . strval($this->request['plugi_version']),
+ 'lockd' => 0,
+ 'app' => $this->request['appPlugin']
+ );
+
+ $this->DB->insert( 'rc_classes', $build_plugin );
+
+ $plugin_id = $this->DB->getInsertId();
+
+ //-----------------------------------------
+ // Redirect to edit the plugin for more
+ //-----------------------------------------
+
+ $this->registry->output->doneScreen( $this->lang->words['r_plugincreate'], $this->lang->words['r_finishplugin'], "{$this->form_code}&do=edit_plugin&com_id=" . $plugin_id, 'redirect' );
+ }
+ }
+
+ //-----------------------------------------
+ // Show the form
+ //-----------------------------------------
+
+ $this->registry->output->html .= $this->html->pluginForm();
+ }
+
+ /**
+ * Here we are editing a plugin's settings
+ *
+ * @return void
+ */
+ private function _editPlugin()
+ {
+ $this->registry->output->extra_nav[] = array( "{$this->settings['base_url']}{$this->form_code}&do=plugin" , $this->lang->words['r_plugmanager'] );
+
+ $plug_id = intval( $this->request['com_id'] );
+
+ //-----------------------------------------
+ // Make sure the plug ID is not zero...
+ //-----------------------------------------
+
+ if( $plug_id < 1 )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_noid'];
+ $this->_showPluginIndex();
+ return;
+ }
+
+ //-----------------------------------------
+ // Pull up the plugin information...
+ //-----------------------------------------
+
+ $plug_data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_classes', 'where' => "com_id='{$plug_id}'" ) );
+
+ //-----------------------------------------
+ // Does this plugin even exist...?
+ //-----------------------------------------
+
+ if( !$plug_data['com_id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_plugnoexist'];
+ $this->_showPluginIndex();
+ return;
+ }
+
+ //-----------------------------------------
+ // Load the plugin and it's information
+ //-----------------------------------------
+
+ if( $plug_data['my_class'] == '' )
+ {
+ $plug_data['my_class'] = 'default';
+ }
+
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( $plug_data['app'] ) . '/extensions/reportPlugins/' . $plug_data['my_class'] . '.php', $plug_data['my_class'] . '_plugin', $plug_data['app'] );
+ $plugin = new $classToLoad( $this->registry );
+
+ //-----------------------------------------
+ // Load the plugin's extra data settings
+ //-----------------------------------------
+
+ if( $plug_data['extra_data'] && $plug_data['extra_data'] != 'N;' )
+ {
+ $plugin->_extra = unserialize( $plug_data['extra_data'] );
+ }
+ else
+ {
+ $plugin->_extra = array();
+ }
+
+ if( $_POST['finish'] == 1 )
+ {
+ //-----------------------------------------
+ // Form was sent, so let's process stuff
+ //-----------------------------------------
+
+ $plugin_error = $plugin->processAdminForm( $extra_data );
+
+ if( $plugin_error )
+ {
+ $this->registry->output->global_message = $plugin_error;
+ }
+
+ if( is_array( $_POST['plugi_can_report'] ) )
+ {
+ $p_can_report = ',' . implode( ',', $_POST['plugi_can_report'] ) . ',';
+ }
+
+ if( is_array( $_POST['plugi_gperm'] ) )
+ {
+ $p_can_gperm = ',' . implode( ',', $_POST['plugi_gperm'] ) . ',';
+ }
+
+ $build_plugin = array(
+ 'onoff' => $this->request['plugi_onoff'],
+ 'group_can_report' => $p_can_report,
+ 'mod_group_perm' => $p_can_gperm,
+ 'extra_data' => serialize($extra_data),
+ 'app' => $this->request['appPlugin']
+ );
+
+ if( $plug_data['lockd'] == 0 || IN_DEV == 1 )
+ {
+ $build_plugin['lockd'] = $this->request['plugi_lockd'];
+ }
+
+ if( ! $this->registry->output->global_message )
+ {
+ $this->DB->update( 'rc_classes', $build_plugin, "com_id={$plug_id}" );
+
+ $this->registry->output->doneScreen($this->lang->words['r_plugupdated'], $this->lang->words['r_plugmanager'], "{$this->form_code}&do=plugin", 'redirect' );
+ }
+ else
+ {
+ $plug_data = $build_plugin;
+ }
+ }
+
+ //-----------------------------------------
+ // Break up group perms into an array
+ //-----------------------------------------
+
+ if( $plug_data['group_can_report'] )
+ {
+ $sel_can_report = explode( ',' , $plug_data['group_can_report'] );
+ }
+
+ if( $plug_data['mod_group_perm'] )
+ {
+ $sel_group_perm = explode( ',' , $plug_data['mod_group_perm'] );
+ }
+
+ //-----------------------------------------
+ // Display special plugin settings here...
+ //-----------------------------------------
+
+ $extraForm = $plugin->displayAdminForm( $plugin->_extra, $this->html );
+
+ $this->registry->output->html .= $this->html->finishPluginForm( $plug_data, $sel_can_report, $sel_group_perm, $extraForm );
+ }
+
+ /**
+ * Lock/unlock a plugin
+ *
+ * @return void
+ */
+ private function _changePlugin()
+ {
+ $this->registry->output->extra_nav[] = array( "{$this->settings['base_url']}{$this->form_code}&do=plugin" , $this->lang->words['r_plugmanager'] );
+
+ $plug_id = intval( $this->request['com_id'] );
+
+ //-----------------------------------------
+ // Make sure plugin ID is > than zero...
+ //-----------------------------------------
+
+ if( $plug_id < 1 )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_noid'];
+ $this->_showPluginIndex();
+ return;
+ }
+
+ //-----------------------------------------
+ // Load basic, very basic, information...
+ //-----------------------------------------
+
+ $plug_data = $this->DB->buildAndFetch( array( 'select' => 'com_id, my_class, class_title, class_desc, author, author_url, pversion', 'from' => 'rc_classes', 'where' => "com_id='{$plug_id}'" ) );
+
+ //-----------------------------------------
+ // Does our plugin even exist...?
+ //-----------------------------------------
+
+ if( !$plug_data['com_id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_plugnoexist'];
+ $this->_showPluginIndex();
+ return;
+ }
+
+ //-----------------------------------------
+ // Can we even change this plugin?
+ //-----------------------------------------
+
+ if( $plug_data['lockd'] > 0 && !IN_DEV )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_pluglocked'];
+ $this->_showPluginIndex();
+ return;
+ }
+
+ //-----------------------------------------
+ // Let's start loading stuff...!
+ //-----------------------------------------
+
+ if( $plug_data['my_class'] == '' )
+ {
+ $plug_data['my_class'] = 'default';
+ }
+
+ if( $_POST['finish'] == 1 )
+ {
+ //-----------------------------------------
+ // The form got sent, so lets go!
+ //-----------------------------------------
+
+ if( ! $_POST['plugi_title'] || ! $_POST['plugi_desc'] || ! $_POST['plugi_file'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_missingfield'];
+ }
+ elseif( preg_match( "/[^a-z0-9_\-]/i", $_POST['plugi_file'] ) )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_incchar'];
+ }
+
+ $build_plugin = array(
+ 'class_title' => $this->request['plugi_title'],
+ 'class_desc' => IPSText::stripslashes( $_POST['plugi_desc'] ),
+ 'author' => $this->request['plugi_author'],
+ 'author_url' => $this->request['plugi_author_url'],
+ 'my_class' => $this->request['plugi_file'],
+ 'pversion' => 'v' . strval($this->request['plugi_version']),
+ 'lockd' => $this->request['plugi_lockd']
+ );
+
+ //-----------------------------------------
+ // If file was changed blank out extra...
+ //-----------------------------------------
+
+ if( $plug_data['my_class'] != $build_plugin['my_class'] )
+ {
+ $build_plugin['extra_data'] = '';
+ $do_edit = true;
+ }
+
+ if( ! $this->registry->output->global_message )
+ {
+ $this->DB->update( 'rc_classes', $build_plugin, "com_id={$plug_id}" );
+
+ if( $do_edit == true )
+ {
+ //-----------------------------------------
+ // Plugin was changed, need settings now
+ //-----------------------------------------
+
+ $this->registry->output->doneScreen($this->lang->words['r_plugupdated'], $this->lang->words['r_finishplugin'], "{$this->form_code}&do=edit_plugin&com_id=" . $plug_id, 'redirect' );
+ }
+ else
+ {
+ //-----------------------------------------
+ // File was not changed, no need to edit..
+ //-----------------------------------------
+
+ $this->registry->output->doneScreen($this->lang->words['r_plugupdated'], $this->lang->words['r_plugmanager'], "{$this->form_code}&do=plugin", 'redirect' );
+ }
+ }
+ else
+ {
+ $plug_data = $build_plugin;
+ }
+ }
+
+ //-----------------------------------------
+ // Basic info for when I hit "Save"...
+ //-----------------------------------------
+
+ $this->registry->output->html .= $this->html->pluginForm( $plug_data );
+ }
+
+ /**
+ * This is when we want to remove a plugin, possibly cuz it's crap
+ *
+ * @return void
+ */
+ private function _removePlugin()
+ {
+ $com_id = intval( $this->request['com_id'] );
+
+ //-----------------------------------------
+ // Make sure we don't delete nothing...
+ //-----------------------------------------
+
+ if( $com_id < 1 )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_deleteair'];
+ $this->_showPluginIndex();
+ return;
+ }
+
+ $row = $this->DB->buildAndFetch( array( 'select' => 'com_id, lockd', 'from' => 'rc_classes', 'where' => "com_id={$com_id}" ) );
+
+ //-----------------------------------------
+ // Make sure plugin exists first!
+ // Again... NOTHING!
+ //-----------------------------------------
+
+ if( !$row['com_id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_plugin404'];
+ $this->_showPluginIndex();
+ return;
+ }
+
+ //-----------------------------------------
+ // Make sure it isn't locked... Snicker..
+ //-----------------------------------------
+
+ if( $row['lockd'] == 1 && !IN_DEV )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_dellocked'];
+ $this->_showPluginIndex();
+ return;
+ }
+
+ $this->DB->delete( 'rc_classes', "com_id={$com_id}" );
+
+ $this->registry->output->doneScreen( $this->lang->words['r_deleteplug'], $this->lang->words['r_plugmanager'], "{$this->form_code}&do=plugin", 'redirect' );
+ }
+
+ /**
+ * This is where you view all the plugins in a list with options
+ *
+ * @return void
+ */
+ private function _showPluginIndex()
+ {
+ $this->registry->output->extra_nav[] = array( "{$this->settings['base_url']}{$this->form_code}&do=plugin" , $this->lang->words['r_plugmanager'] );
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'rc_classes' ) );
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $row['_enabled_img'] = $row['onoff'] == 1 ? 'tick.png' : 'cross.png';
+
+ $plugin_rows .= $this->html->report_plugin_row( $row );
+ }
+
+ $this->registry->output->html = $this->html->report_plugin_overview( $plugin_rows );
+ }
+
+ /**
+ * This is when you delete a status/severity image
+ *
+ * @return void
+ */
+ private function _removeImage()
+ {
+ $img_id = intval( $this->request['id'] );
+
+ if( $img_id < 1 )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_noid'];
+ $this->_showStatusIndex();
+ return;
+ }
+
+ $this->DB->delete( 'rc_status_sev', "id={$img_id}" );
+
+ $this->registry->output->doneScreen( $this->lang->words['r_imgdel'], $this->lang->words['r_statsever'], "{$this->form_code}&do=status", 'redirect' );
+ }
+
+ /**
+ * This is when I want to add a severity/status image
+ *
+ * @return void
+ */
+ private function _addImage()
+ {
+ $stat_id = intval( $this->request['id'] );
+
+ //-----------------------------------------
+ // Make sure that status isn't zero...
+ //-----------------------------------------
+
+ if( $stat_id < 1 )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_noid'];
+ $this->_showStatusIndex();
+ return;
+ }
+
+ if( $_POST['finish'] == 1 )
+ {
+ //-----------------------------------------
+ // Time to add that status img to DB...
+ //-----------------------------------------
+
+ $image_data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_status_sev', 'where' => "status='{$stat_id}' AND points={$this->request['img_points']}" ) );
+
+ if( $image_data['id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_changepoints'];
+ }
+ else
+ {
+ $build_image = array(
+ 'status' => $stat_id,
+ 'img' => trim(IPSText::safeslashes($_POST['img_filename'])),
+ 'width' => $this->request['img_width'],
+ 'height' => $this->request['img_height'],
+ 'points' => $this->request['img_points'],
+ 'is_png' => ( mb_strtolower(strrchr( $this->request['img_filename'], '.' )) == '.png' ? 1 : 0 )
+ );
+
+ $this->DB->insert( 'rc_status_sev', $build_image, "id='{$img_id}'" );
+
+ $this->registry->output->doneScreen($this->lang->words['r_imgsaved'], $this->lang->words['r_statsever'], "{$this->form_code}&do=status", 'redirect' );
+ }
+ }
+
+ //-----------------------------------------
+ // Load basic status data...
+ //-----------------------------------------
+
+ $status = $this->DB->buildAndFetch( array( 'select' => 'title', 'from' => 'rc_status', 'where' => "status='{$stat_id}'" ) );
+
+ //-----------------------------------------
+ // Does the status exist in the db?
+ //-----------------------------------------
+
+ if( !$status['title'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_404status'];
+ $this->_showStatusIndex();
+ return;
+ }
+
+ //-----------------------------------------
+ // Build the form so we can do something
+ //-----------------------------------------
+
+ $this->registry->output->html .= $this->html->imageForm( 'add_image', $status, $image_data );
+ }
+
+ /**
+ * This is for setting, in status index, which is New, Complete, and Active
+ *
+ * @return void
+ */
+ private function _setStatus()
+ {
+ $stat_id = intval( $this->request['id'] );
+
+ if( $stat_id < 1 )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_noid'];
+ }
+
+ //-----------------------------------------
+ // Load the status that needs a change
+ //-----------------------------------------
+
+ $row = $this->DB->buildAndFetch( array( 'select' => 'is_new, is_complete, is_active', 'from' => 'rc_status', 'where' => "status='{$stat_id}'" ) );
+
+ if( $this->request['status'] == 'new' || $this->request['status'] == 'complete' )
+ {
+ //-----------------------------------------
+ // We want to make it new or complete
+ //-----------------------------------------
+
+ if( $this->request['status'] == 'new' )
+ {
+ if( $row['is_complete'] == 1 )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_newcomplete'];
+ $this->_showStatusIndex();
+ return;
+ }
+
+ $build_status = array( 'is_new' => 1 );
+ $build_other_statuses = array( 'is_new' => 0 );
+ }
+ else
+ {
+ if( $row['is_new'] == 1 )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_completenew'];
+ $this->_showStatusIndex();
+ return;
+ }
+
+ $build_status = array( 'is_complete' => 1 );
+ $build_other_statuses = array( 'is_complete' => 0 );
+ }
+
+ $this->DB->update( 'rc_status', $build_other_statuses, "status<>{$stat_id}" );
+ $this->DB->update( 'rc_status', $build_status, "status={$stat_id}" );
+ }
+ elseif( $this->request['status'] == 'active' )
+ {
+ //-----------------------------------------
+ // We can have as many active as we want
+ //-----------------------------------------
+
+ $this->DB->update( 'rc_status', array( 'is_active' => ( ! $row['is_active'] ) ), "status={$stat_id}" );
+ }
+ else
+ {
+ //-----------------------------------------
+ // What the heck can this be?
+ //-----------------------------------------
+
+ $this->registry->output->global_message = $this->lang->words['r_invpar'];
+ }
+
+ $this->_showStatusIndex();
+ }
+
+ /**
+ * This is the magic behind removing a status and the images behind it
+ *
+ * @return void
+ */
+ private function _removeStatus()
+ {
+ $stat_id = intval( $this->request['id'] );
+
+ if( $stat_id < 1 )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_deleteair'];
+ $this->_showStatusIndex();
+ return;
+ }
+
+ $row = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_status', 'where' => "status='{$stat_id}'" ) );
+
+ if( !$row['status'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_noid'];
+ $this->_showStatusIndex();
+ return;
+ }
+
+ //-----------------------------------------
+ // Make sure we arn't removing something
+ // that we are going to need.
+ //-----------------------------------------
+
+ if( $row['is_new'] == 1 )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_onenew'];
+ $this->_showStatusIndex();
+ return;
+ }
+ elseif( $row['is_complete'] == 1 )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_onecomplete'];
+ $this->_showStatusIndex();
+ return;
+ }
+
+ //-----------------------------------------
+ // Remove the status and its images
+ //-----------------------------------------
+
+ $this->DB->delete( 'rc_status', "status='{$stat_id}'" );
+ $this->DB->delete( 'rc_status_sev', "status='{$stat_id}'" );
+
+ $this->registry->output->doneScreen($this->lang->words['r_statdel'], $this->lang->words['r_statsever'], "{$this->form_code}&do=status", 'redirect' );
+ }
+
+ /**
+ * Here is where you create a status (before the added images)
+ *
+ * @return void
+ */
+ private function _createStatus()
+ {
+ if( $_POST['finish'] == 1 )
+ {
+ //-----------------------------------------
+ // The form has been sent, lets go!
+ //-----------------------------------------
+
+ if( preg_match("/[^0-9]/", $_POST['stat_ppr'] ) )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_ppr'];
+ }
+ elseif( preg_match("/[^0-9\.]/", $_POST['stat_pph'] ) )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_mtp'];
+ }
+ else if( !$this->request['stat_title'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_nostattitle'];
+ }
+ else
+ {
+ $stat_check = $this->DB->buildAndFetch( array( 'select' => 'MAX(rorder) as rorder', 'from' => 'rc_status' ) );
+
+ $build_status = array(
+ 'title' => $this->request['stat_title'],
+ 'points_per_report' => $this->request['stat_ppr'],
+ 'minutes_to_apoint' => $this->request['stat_pph'],
+ 'rorder' => $stat_check['rorder'] + 1,
+ );
+
+ $this->DB->insert( 'rc_status', $build_status );
+
+ $this->registry->output->doneScreen( $this->lang->words['r_statcreated'], $this->lang->words['r_statsever'], "{$this->form_code}&do=status", 'redirect' );
+ }
+ }
+
+ $this->registry->output->html .= $this->html->statusForm();
+ }
+
+ /**
+ * This is when I want to edit a status
+ *
+ * @return void
+ */
+ private function _editStatus()
+ {
+ $stat_id = intval( $this->request['id'] );
+
+ //-----------------------------------------
+ // Make sure the status ID is not zero
+ //-----------------------------------------
+
+ if( $stat_id < 1 )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_noid'];
+ $this->_showStatusIndex();
+ return;
+ }
+
+ if( $_POST['finish'] == 1 )
+ {
+ //-----------------------------------------
+ // We just sen't the form, check stuff
+ //-----------------------------------------
+
+ if( preg_match("/[^0-9]/", $_POST['stat_ppr'] ) )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_ppr'];
+ }
+ elseif( preg_match("/[^0-9\.]/", $_POST['stat_pph'] ) )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_mtp'];
+ }
+ else
+ {
+ $build_status = array(
+ 'title' => $this->request['stat_title'],
+ 'points_per_report' => $this->request['stat_ppr'],
+ 'minutes_to_apoint' => $this->request['stat_pph'],
+ );
+
+ $this->DB->update( 'rc_status', $build_status, "status='{$stat_id}'" );
+
+ $this->registry->output->doneScreen( $this->lang->words['r_statsaved'], $this->lang->words['r_statsever'], "{$this->form_code}&do=status", 'redirect' );
+ }
+ }
+
+ $stat_data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_status', 'where' => "status='{$stat_id}'" ) );
+
+ //-----------------------------------------
+ // Make sure the status actually exists
+ //-----------------------------------------
+
+ if( !$stat_data['status'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_noid'];
+ $this->_showStatusIndex();
+ return;
+ }
+
+ $this->registry->output->html .= $this->html->statusForm( 'edit_status', $stat_data );
+ }
+
+ /**
+ * This is where you edit an image under a status
+ *
+ * @return void
+ */
+ private function _editImage()
+ {
+ $img_id = intval( $this->request['id'] );
+
+ //-----------------------------------------
+ // Make sure the ID is not zero...
+ //-----------------------------------------
+
+ if( $img_id < 1 )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_noid'];
+ $this->_showStatusIndex();
+ return;
+ }
+
+ if( $_POST['finish'] == 1 )
+ {
+ //-----------------------------------------
+ // Now it's time to send the form...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'rc_status_sev', 'where' => "status='{$this->request['img_status']}' AND points={$this->request['img_points']} AND id!={$img_id}", 'limit' => 1 ) );
+ $this->DB->execute();
+
+ if( $this->DB->getTotalRows() != 0 )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_changepoints'];
+ }
+ else
+ {
+ $build_image = array(
+ 'img' => trim(IPSText::safeslashes($_POST['img_filename'])),
+ 'width' => $this->request['img_width'],
+ 'height' => $this->request['img_height'],
+ 'points' => $this->request['img_points'],
+ 'is_png' => ( mb_strtolower(strrchr( $this->request['img_filename'], '.' )) == '.png' ? 1 : 0 )
+ );
+
+ $this->DB->update( 'rc_status_sev', $build_image, "id='{$img_id}'" );
+
+ $this->registry->output->doneScreen($this->lang->words['r_imgsaved'], $this->lang->words['r_statsever'], "{$this->form_code}&do=status", 'redirect' );
+ }
+ }
+
+ $image_data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_status_sev', 'where' => "id='{$img_id}'" ) );
+
+ //-----------------------------------------
+ // Make sure the image actually exists...
+ //-----------------------------------------
+
+ if( !$image_data['id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['r_noid'];
+ $this->_showStatusIndex();
+ return;
+ }
+
+ //-----------------------------------------
+ // Load basic data so we can edit it
+ //-----------------------------------------
+
+ $status = $this->DB->buildAndFetch( array( 'select' => 'title', 'from' => 'rc_status', 'where' => "status='{$image_data['status']}'" ) );
+
+ $this->registry->output->html .= $this->html->imageForm( 'edit_image', $status, $image_data );
+ }
+
+ /**
+ * When we want to move the status up or down (not sideways...)
+ *
+ * @return void
+ */
+ private function _moveStatus()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
+ $ajax = new $classToLoad();
+
+ //-----------------------------------------
+ // Checks...
+ //-----------------------------------------
+
+ if( $this->registry->adminFunctions->checkSecurityKey( $this->request['md5check'], true ) === false )
+ {
+ $ajax->returnString( $this->lang->words['postform_badmd5'] );
+ exit();
+ }
+
+ //-----------------------------------------
+ // Save new position
+ //-----------------------------------------
+
+ $position = 1;
+
+ if( is_array($this->request['status']) AND count($this->request['status']) )
+ {
+ foreach( $this->request['status'] as $this_id )
+ {
+ $this->DB->update( 'rc_status', array( 'rorder' => $position ), 'status=' . $this_id );
+
+ $position++;
+ }
+ }
+
+ $ajax->returnString( 'OK' );
+ exit();
+ }
+
+ /**
+ * Shows the status/severity index with all the special stuff
+ *
+ * @return void
+ */
+ private function _showStatusIndex()
+ {
+ $this->registry->output->extra_nav[] = array( "{$this->settings['base_url']}{$this->form_code}&do=status" , $this->lang->words['r_statsever'] );
+
+ //-----------------------------------------
+ // Get the default board skin...
+ //-----------------------------------------
+
+ $skin = $this->DB->buildAndFetch( array( 'select' => 'set_image_dir', 'from' => 'skin_collections', 'where' => "set_is_default=1" ) );
+
+ //-----------------------------------------
+ // Get the status images...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'rc_status_sev', 'order' => 'status ASC, points ASC' ) );
+ $this->DB->execute();
+
+ //-----------------------------------------
+ // Store the status images in an array...
+ //-----------------------------------------
+
+ $status_image_cache = array();
+
+ while( $srow = $this->DB->fetch() )
+ {
+ $status_image_cache[ $srow['status'] ] .= str_replace( '<#IMG_DIR#>', $skin['set_image_dir'], $this->html->report_status_image( $srow ) );
+ }
+
+ //-----------------------------------------
+ // Load and process the stateses...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'rc_status', 'order' => 'rorder ASC' ) );
+ $this->DB->execute();
+
+ $total_statuses = $this->DB->getTotalRows();
+
+ while( $row = $this->DB->fetch() )
+ {
+ //-----------------------------------------
+ // Show the New/Complete/Active boxes...
+ //-----------------------------------------
+
+ $row['_is_new'] = $row['is_new'] == 1 ? 'on' : 'off';
+ $row['_is_complete'] = $row['is_complete'] == 1 ? 'on' : 'off';
+ $row['_is_active'] = $row['is_active'] == 1 ? 'on' : 'off';
+
+ //-----------------------------------------
+ // Finish row with image cache...
+ //-----------------------------------------
+
+ $row['status_images'] = $status_image_cache[ $row['status'] ];
+ $status_rows .= $this->html->report_status_row( $row );
+ }
+
+ $this->registry->output->html = $this->html->report_status_overview( $status_rows );
+ }
+
+ /**
+ * Shows report stats in the last 24 hours using chart class
+ *
+ * @return void
+ */
+ private function _reportsChart()
+ {
+ //-----------------------------------------
+ // Let's build our data for the chart
+ //-----------------------------------------
+
+ $this->DB->build(
+ array(
+ 'select' => 'stat.title, COUNT(*) as num_reports',
+ 'from' => array( 'rc_reports_index' => 'rep' ),
+ 'where' => "( stat.is_active=1 OR ( stat.is_active=0 AND (" . time() . "-rep.date_updated)<86400 ) )",
+ 'group' => 'rep.status',
+ 'add_join' => array(
+ array(
+ 'from' => array( 'rc_reports' => 'reps' ),
+ 'where' => 'rep.id=reps.rid'
+ ),
+ array(
+ 'from' => array( 'rc_status' => 'stat' ),
+ 'where' => 'stat.status=rep.status'
+ ),
+ )
+ )
+ );
+ $this->DB->execute();
+
+ $chart_data = array();
+ $labels = array();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $chart_data[] = $row['num_reports'];
+ $labels[] = $row['title'];
+ }
+
+ //-----------------------------------------
+ // Let's draw our pie chart now
+ //-----------------------------------------
+
+ require_once( IPS_KERNEL_PATH . '/classGraph.php' );
+ $graph = new classGraph();
+ $graph->options['title'] = $this->lang->words['r_last24'];
+ $graph->options['width'] = 400;
+ $graph->options['height'] = 250;
+ $graph->options['style3D'] = 1;
+
+ if( count($chart_data) )
+ {
+ $graph->addLabels( $labels );
+ $graph->addSeries( 'test', $chart_data );
+ }
+ else
+ {
+ $graph->addLabels( array( $this->lang->words['r_nodata'] ) );
+ $graph->addSeries( 'test', array( 1 ) );
+ }
+
+ $graph->options['charttype'] = 'Pie';
+ $graph->display();
+ }
+
+ /**
+ * Shows bar graph of top five moderators. Show's what's been done
+ *
+ * @return void
+ */
+ private function _moderatorsChart()
+ {
+ //-----------------------------------------
+ // Build data for the bar chart
+ //-----------------------------------------
+
+ $this->DB->build( array(
+ 'select' => 'rep.id',
+ 'from' => array( 'rc_reports' => 'reps' ),
+ 'where' => 'stat.is_complete=1',
+ 'add_join' => array(
+ array(
+ 'from' => array( 'rc_reports_index' => 'rep' ),
+ 'where' => 'reps.rid=rep.id',
+ ),
+ array(
+ 'from' => array( 'rc_status' => 'stat' ),
+ 'where' => 'stat.status=rep.status',
+ ),
+ )
+ ) );
+ $this->DB->execute();
+
+ $total_complete_reports = $this->DB->getTotalRows();
+
+ $this->DB->build(
+ array(
+ 'select' => 'mem.members_display_name as name, COUNT(*) as num_reports',
+ 'from' => array( 'rc_reports_index' => 'rep' ),
+ 'where' => "stat.is_complete=1",
+ 'group' => 'rep.updated_by',
+ 'order' => 'num_reports DESC',
+ 'limit' => array( 5 ),
+ 'add_join' => array(
+ array(
+ 'from' => array( 'rc_reports' => 'reps' ),
+ 'where' => 'rep.id=reps.rid'
+ ),
+ array(
+ 'from' => array( 'rc_status' => 'stat' ),
+ 'where' => 'stat.status=rep.status'
+ ),
+ array(
+ 'from' => array( 'members' => 'mem' ),
+ 'where' => 'mem.member_id=rep.updated_by'
+ ),
+ )
+ )
+ );
+ $this->DB->execute();
+
+ $chart_data = array();
+ $labels = array();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $chart_data[] = $row['num_reports'];
+ $labels[] = IPSText::mbsubstr($row['name'],0,16);
+ }
+
+ //-----------------------------------------
+ // Let's draw our pie chart now
+ //-----------------------------------------
+
+ require_once( IPS_KERNEL_PATH . '/classGraph.php' );
+ $graph = new classGraph();
+ $graph->options['title'] = $this->lang->words['r_top5'];
+ $graph->options['width'] = 400;
+ $graph->options['height'] = 250;
+ $graph->options['style3D'] = 1;
+
+ if( count($chart_data) )
+ {
+ $graph->addLabels( $labels );
+ $graph->addSeries( 'test', $chart_data );
+ }
+ else
+ {
+ $graph->addLabels( array( $this->lang->words['r_nodata'] ) );
+ $graph->addSeries( 'test', array( 1 ) );
+ }
+
+ $graph->options['charttype'] = 'Pie';
+ $graph->display();
+ }
+
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/report/xml/index.html b/upload/admin/applications/core/modules_admin/report/xml/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/report/xml/index.html
+++ b/upload/admin/applications/core/modules_admin/report/xml/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/sql/defaultSection.php b/upload/admin/applications/core/modules_admin/sql/defaultSection.php
index 860cae32..b3beb0f4 100644
--- a/upload/admin/applications/core/modules_admin/sql/defaultSection.php
+++ b/upload/admin/applications/core/modules_admin/sql/defaultSection.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Define the default sql section
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4948 $
+ * @version $Rev: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_admin/sql/index.html b/upload/admin/applications/core/modules_admin/sql/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/sql/index.html
+++ b/upload/admin/applications/core/modules_admin/sql/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/sql/mysql.php b/upload/admin/applications/core/modules_admin/sql/mysql.php
index 09d833a0..589aad03 100644
--- a/upload/admin/applications/core/modules_admin/sql/mysql.php
+++ b/upload/admin/applications/core/modules_admin/sql/mysql.php
@@ -1,900 +1,817 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
- exit();
-}
-
-@set_time_limit(1200);
-
-
-class admin_core_sql_toolbox_module extends ipsCommand {
-
- /**
- * SQL version
- *
- * @access public
- * @var string
- */
- public $sql_version = "";
-
- /**
- * True SQL version
- *
- * @access public
- * @var string
- */
- public $true_version = "";
-
- /**
- * GZIP Header contents for backup
- *
- * @access public
- * @var string
- */
- public $str_gzip_header = "\x1f\x8b\x08\x00\x00\x00\x00\x00";
-
- /**
- * Flag that's set if there's problems
- *
- * @access public
- * @var boolean
- */
- public $db_has_issues = false;
-
- /**
- * HTML object
- *
- * @access public
- * @var object
- */
- public $html;
-
- /**
- * Form code
- *
- * @access public
- * @var string
- */
- public $form_code = "";
-
- /**
- * Form code js
- *
- * @access public
- * @var string
- */
- public $form_code_js = "";
-
- /**
- * Main class entry point
- *
- * @access public
- * @param object ipsRegistry reference
- * @return void [Outputs to screen]
- */
- public function doExecute( ipsRegistry $registry )
- {
- /* Load HTML and Lang */
- $this->html = $this->registry->output->loadTemplate( 'cp_skin_sql' );
- $this->registry->class_localization->loadLanguageFile( array( 'admin_sql' ) );
-
- /* URLs */
- $this->form_code = $this->html->form_code = 'module=sql§ion=toolbox';
- $this->form_code_js = $this->html->form_code_js = 'module=sql§ion=toolbox';
-
- /* Get mySQL Version */
- $this->DB->getSqlVersion();
-
- $this->true_version = $this->html->true_version = $this->DB->true_version;
- $this->sql_version = $this->html->sql_version = $this->DB->sql_version;
-
- /* What to do */
- switch( $this->request['do'] )
- {
- case 'search_index':
- $this->sqlSearchIndexOverview();
- break;
-
- case 'rebuild_app_search_index':
- $this->sqlSearchRebuildAppIndex();
- break;
-
- case 'dotool':
- $this->sqlRunTool();
- break;
-
- case 'runtime':
- $this->sqlViewResults("SHOW STATUS");
- break;
-
- case 'system':
- $this->sqlViewResults("SHOW VARIABLES");
- break;
-
- case 'processes':
- $this->sqlViewResults("SHOW PROCESSLIST");
- break;
-
- case 'runsql':
- $_POST['query'] = isset( $_POST['query'] ) ? $_POST['query'] : '';
- $q = $_POST['query'] == "" ? urldecode( $_GET['query'] ) : $_POST['query'];
- $this->sqlViewResults( trim( stripslashes( $q ) ) );
- break;
-
- case 'backup':
- $this->sqlBackupForm();
- break;
-
- case 'safebackup':
- $this->sqlSafeBackupSplash();
- break;
-
- case 'dosafebackup':
- $this->sqlDoSafeBackup();
- break;
-
- case 'export_tbl':
- $this->sqlDoSafeBackup( trim( urldecode( stripslashes( $_GET['tbl'] ) ) ) );
- break;
-
- default:
- $this->sqlListIndex();
- break;
- }
-
- /* Output */
- $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
- $this->registry->output->sendOutput();
- }
-
- /**
- * Rebuild the index for the selected application
- *
- * @access public
- * @return void
- */
- public function sqlSearchRebuildAppIndex()
- {
- /* INI */
- $app = $this->request['app_key'];
- $st = intval( $this->request['st'] );
- $pergo = 100;
-
- /* Get the interface */
- require_once( IPS_ROOT_PATH . 'sources/interfaces/interface_search.php' );
-
- /* Check the app */
- if( ! IPSLib::appIsInstalled( $app ) )
- {
- $this->registry->output->showError( $this->lang->words['my_noapp'], 11144 );
- }
-
- /* Rebuild Class */
- $_file = IPSLib::getAppDir( $app ) . '/extensions/searchRebuild.php';
- $_class = $app . 'SearchRebuild';
-
- /* Check the file */
- if( file_exists( $_file ) )
- {
- /* Get the rebuild class */
- require_once( $_file );
-
- /* Check the class */
- if( class_exists( $_class ) )
- {
- /* Setup the rebuild class */
- $rebuild = new $_class();
-
- /* Clear if this is the first pass */
- if( $st == 0 && ! $this->request['rebuild_type'])
- {
- $rebuild->clear();
- }
-
- /* Do the rebuild */
- $processed = $rebuild->doRebuild( $st, $pergo );
-
- /* Check processed */
- if( is_array( $processed ) )
- {
- $rebuild_type_url = '&rebuild_type=' . $processed['type'];
- $rebuild_type = $processed['type'];
- $processed = $processed['total'];
- }
- else
- {
- $rebuild_type_url = '';
- $rebuild_type = '';
- }
-
- /* Get st again, in case the module updated it */
- if( $st != intval( $this->request['st'] ) )
- {
- $st = intval( $this->request['st'] );
- }
- else
- {
- $st += $pergo;
- }
-
- /* Message */
- if( $processed > 0 || ( $rebuild_type && $rebuild_type != 'done' ) )
- {
- $title = ipsRegistry::$applications[$app]['app_title'] . $this->lang->words['my_si_progress'];
- $msg = "{$processed} " . $this->lang->words['my_processed'];
- $url = "{$this->form_code}&do=rebuild_app_search_index&app_key={$app}&st={$st}{$rebuild_type_url}";
- }
- else
- {
- $title = ipsRegistry::$applications[$app]['app_title'] . $this->lang->words['my_si_complete'];
- $msg = "";
- $url = "{$this->form_code}&do=search_index";
- }
-
- /* Bounce */
- $this->registry->output->doneScreen( $title, $msg, $url, 'redirect' );
- }
- else
- {
- $this->registry->output->showError( sprintf( $this->lang->words['my_noloc_class'], $_class ), 2112, true );
- }
- }
- else
- {
- $this->registry->output->showError( sprintf( $this->lang->words['my_noloc'], $_file ), 2113, true );
- }
-
- }
-
- /**
- * SQL Search Index
- *
- * @access public
- * @return void
- */
- public function sqlSearchIndexOverview()
- {
- /* Query the overview data */
- $this->DB->query( "SHOW TABLE STATUS FROM {$this->DB->obj['sql_database']} LIKE 'search_index' " );
- $table_data = $this->DB->fetch();
-
- /* Format */
- $table_data['Data_length'] = IPSLib::sizeFormat( $table_data['Data_length'] );
- $table_data['Max_data_length'] = IPSLib::sizeFormat( $table_data['Max_data_length'] );
- $table_data['Index_length'] = IPSLib::sizeFormat( $table_data['Index_length'] );
-
- /* Check for searchable apps */
- $searchable_apps = array();
-
- foreach( ipsRegistry::$applications as $app )
- {
- if( IPSSearchIndex::appIsSearchable( $app['app_directory'] ) )
- {
- $searchable_apps[ $app['app_directory'] ] = array( 'title' => $app['app_title'] );
- }
- }
-
- /* Count the apps */
- $this->DB->build( array( 'select' => 'count(*) as total, app', 'from' => 'search_index', 'group' => 'app' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $searchable_apps[ $r['app'] ]['entries'] = $r['total'];
- }
-
- /* Output */
- $this->registry->output->html .= $this->html->sqlSearchIndex( $table_data, $searchable_apps );
- }
-
- /**
- * Run selected tool on selected tables
- *
- * @access public
- * @return void
- */
- public function sqlRunTool()
- {
- /* have we got some there tables me laddo? */
- $tables = array();
-
- foreach( $this->request as $key => $value )
- {
- if( preg_match( "/^tbl_(\S+)$/", $key, $match ) )
- {
- if( $this->request[ $match[0] ] )
- {
- $tables[] = $match[1];
- }
- }
- }
-
- /* Make sure we have tables to run this on */
- if( count( $tables ) < 1 )
- {
- $this->registry->output->showError( $this->lang->words['my_seltables'], 11145 );
- }
-
- /* What tool is one running? */
- if( strtoupper( $this->request['tool'] ) == 'DROP' || strtoupper( $this->request['tool'] ) == 'CREATE' || strtoupper( $this->request['tool'] ) == 'FLUSH' )
- {
- $this->registry->output->showError( $this->lang->words['my_cantdo'], 2114, true );
- }
-
- /**
- * Rikki wants a stupid template so we can output his stupid header. Yes, this creates more work for me.
- * This template serves no other purpose than to make Rikki happy. Must make Rikki happy. Rikki gets cranky when he's not happy.
- *
- * Ask him about roundabouts sometime. Apparently...they're round.
- */
- $this->registry->output->html .= $this->html->sqlToolResultHeader();
-
- /* Loop through each table and run the tool */
- foreach( $tables as $table )
- {
- /* Run the query */
- $this->DB->query( strtoupper( $this->request['tool'] ) . " TABLE $table" );
-
- /* Results */
- $fields = $this->DB->getResultFields();
- $data = $this->DB->fetch();
-
- /* Print the headers - we don't what or how many so... */
- $columns = array();
- $cnt = count( $fields );
-
- for( $i = 0; $i < $cnt; $i++ )
- {
- $columns[] = $fields[$i]->name;
- }
-
- /* Grab the rows - we don't what or how many so... */
- $rows = array();
-
- for( $i = 0; $i < $cnt; $i++ )
- {
- $rows[] = $data[ $fields[$i]->name ];
- }
-
- /* Add to output */
- $this->registry->output->html .= $this->html->sqlToolResult( "Result: " . $this->request['tool'] . " " . $table, $columns, $rows );
- }
- }
-
- /**
- * Safe backup splash screen
- *
- * @access public
- * @return void
- */
- public function sqlSafeBackupSplash()
- {
- /* Output */
- $this->registry->output->extra_nav[] = array( '', $this->lang->words['my_backupnav'] );
- $this->registry->output->html .= $this->html->sqlSafeBackupSplashScreen();
- }
-
- /**
- * Runs the database backup
- *
- * @access public
- * @param string $tbl_name Specify a table to backup, leave blank to backup all
- * @return void
- */
- public function sqlDoSafeBackup($tbl_name="")
- {
- /* Backup All Tables */
- if( $tbl_name == "" )
- {
- $skip = intval( $this->request['skip'] );
- $create_tbl = intval( $this->request['create_tbl'] );
- $enable_gzip = intval( $this->request['enable_gzip'] );
- $filename = 'ipb_db_backup';
- }
- /* Backup specfic table */
- else
- {
- $skip = 0;
- $create_tbl = 0;
- $enable_gzip = 1;
- $filename = $tbl_name;
- }
-
- /* Setup */
- $output = "";
- @header("Pragma: no-cache");
- $do_gzip = 0;
-
- /* Gzip? */
- if( $enable_gzip )
- {
- $phpver = phpversion();
-
- if($phpver >= "4.0")
- {
- if(extension_loaded("zlib"))
- {
- $do_gzip = 1;
- }
- }
- }
-
- if( $do_gzip != 0 )
- {
- @ob_start();
- @ob_implicit_flush(0);
- header("Content-Type: text/x-delimtext; name=\"{$filename}.sql.gz\"");
- header("Content-disposition: attachment; filename={$filename}.sql.gz");
- }
- else
- {
- header("Content-Type: text/x-delimtext; name=\"{$filename}.sql\"");
- header("Content-disposition: attachment; filename={$filename}.sql");
- }
-
- /* Get tables to work on */
- if( $tbl_name == "" )
- {
- $tmp_tbl = $this->DB->getTableNames();
-
- foreach( $tmp_tbl as $tbl )
- {
- /* Ensure that we're only peeking at IBF tables */
- if ( preg_match( "/^" . $this->settings['sql_tbl_prefix'] . "/", $tbl ) )
- {
- /* We've started our headers, so print as we go to stop poss memory problems */
- $this->sqlGetTableSQL($tbl, $create_tbl, $skip);
- }
- }
- }
- else
- {
- $this->sqlGetTableSQL($tbl_name, $create_tbl, $skip);
- }
-
- /* Gzip the result */
- if( $do_gzip )
- {
- $size = ob_get_length();
- $crc = crc32( ob_get_contents() );
- $contents = gzcompress( ob_get_contents() );
- ob_end_clean();
- echo $this->str_gzip_header . substr( $contents, 0, strlen( $contents ) - 4 ) . $this->sqlGzipFourChars( $crc ) . $this->sqlGzipFourChars( $size );
- }
-
- exit();
- }
-
- /**
- * Displays the form for backing up an sql database
- *
- * @access public
- * @return void
- * @author Josh
- */
- public function sqlBackupForm()
- {
- /* Check mySQL Version */
- if ( $this->sql_version < 3232 )
- {
- $this->registry->output->showError( $this->lang->words['my_tooold'], 11146 );
- }
-
- /* Form Elements */
- $form = array();
-
- $form['create_tbl'] = $this->registry->output->formYesNo( 'create_tbl', 1);
- $form['skip'] = $this->registry->output->formYesNo( 'skip', 1);
- $form['enable_gzip'] = $this->registry->output->formYesNo( 'enable_gzip', 0 );
-
- /* Output */
- $this->registry->output->html .= $this->html->sqlBackupForm( $form );
- }
-
- /**
- * Run a mysql query and display results
- *
- * @access public
- * @param string $sql The query to run
- * @return void
- */
- public function sqlViewResults( $sql )
- {
- /* INIT */
- $limit = 50;
- $pages = "";
- $the_queries = array();
-
- /* Title Map */
- $map = array( 'processes' => $this->lang->words['my_processes'],
- 'runtime' => $this->lang->words['my_runtime'],
- 'system' => $this->lang->words['my_sysvar'],
- );
-
- /* Figure out the title */
- if ( isset( $map[ $this->request['do'] ] ) AND $map[ $this->request['do'] ] != "" )
- {
- $tbl_title = $map[ $this->request['do'] ];
- $man_query = 0;
- }
- else
- {
- $tbl_title = $this->lang->words['my_manual'];
- $man_query = 1;
- }
-
- /* Turn off error die */
- $this->DB->return_die = 1;
-
- /* Split up multiple queries */
- $the_queries = array();
-
- if( strstr( $sql, ";" ) )
- {
- $the_queries = preg_split( "/;[\r\n|\n]+/", $sql, -1, PREG_SPLIT_NO_EMPTY );
- }
- else
- {
- if( $sql )
- {
- $the_queries[] = $sql;
- }
- }
-
- $columns = array();
- $rows = array();
- $queryCntForArray = 0;
-
- if( ! count( $the_queries ) )
- {
- $the_queries[ $queryCntForArray ] = '';
- $columns[ $queryCntForArray ][] = $this->lang->words['manual_error'];
- $rows[ $queryCntForArray ][] = array( 'error' => $this->lang->words['manual_noquery'] );
- }
- else
- {
- /* Loop through the queries and run them */
- foreach( $the_queries as $sql )
- {
- /* INIT */
- $links = "";
- $sql = trim( $sql );
-
- /* Check the sql */
- $test_sql = str_replace( "\'", "", $sql );
- $apos_count = substr_count( $test_sql, "'" );
-
- if( $apos_count % 2 != 0 )
- {
- $columns[ $queryCntForArray ][] = $this->lang->words['manual_error'];
- $rows[ $queryCntForArray ][] = array( 'error' => $this->lang->words['manual_invalid'] . htmlspecialchars( $sql ) );
-
- unset( $apos_count, $test_sql );
- continue;
- }
-
- unset( $apos_count, $test_sql );
-
- /* Check for drop and flush */
- if ( preg_match( "/^(DROP|FLUSH)/i",$sql ) )
- {
- $columns[ $queryCntForArray ][] = $this->lang->words['manual_error'];
- $rows[ $queryCntForArray ][] = array( 'error' => $this->lang->words['manual_notallowed'] );
- continue;
- }
- /* Protect admin_login_logs */
- else if ( preg_match( "/^(?!SELECT)/i", preg_replace( "#\s{1,}#s", "", $sql ) ) and preg_match( "/admin_login_logs/i", preg_replace( "#\s{1,}#s", "", $sql ) ) )
- {
- $columns[ $queryCntForArray ][] = $this->lang->words['manual_error'];
- $rows[ $queryCntForArray ][] = array( 'error' => $this->lang->words['manual_loginlogs'] );
- continue;
- }
-
- /* Setup for query */
- $this->DB->error = "";
- $this->DB->allow_sub_select = 1;
-
- /* Run the query */
- $this->DB->query( $sql, 1 );
-
- /* Check for errors... */
- if ( $this->DB->error != "")
- {
- $columns[ $queryCntForArray ][] = $this->lang->words['manual_error'];
- $rows[ $queryCntForArray ][] = array( 'error' => htmlspecialchars( $this->DB->error ) );
- continue;
- }
-
- /* Build display rows */
- $rows[ $queryCntForArray ] = array();
- $columns[ $queryCntForArray ] = array();
-
- if ( preg_match( "/^SELECT/i", $sql ) or preg_match( "/^SHOW/i", $sql ) )
- {
- /* Sort out the pages and stuff, auto limit if need be */
- if ( !preg_match( "/^SHOW/i", $sql ) AND ! preg_match( "/LIMIT[ 0-9,]+$/i", $sql ) )
- {
- /* Start value */
- $start = $this->request['st'] ? intval( $this->request['st'] ) : 0;
-
- /* Count the number of rows we got back */
- $rows_returned = $this->DB->getTotalRows();
-
- /* Paginate the results */
- if( $rows_returned > $limit )
- {
- $links = $this->registry->output->generatePagination( array(
- 'totalItems' => $rows_returned,
- 'itemsPerPage' => $limit,
- 'currentStartValue' => $start,
- 'baseUrl' => "{$this->settings['base_url']}{$this->form_code}&do=runsql&query=" . urlencode( $sql ),
- ) );
-
- /* Reformat the query with a LIMIT */
- if( substr( $sql, -1, 1 ) == ";" )
- {
- $sql = substr( $sql, 0, -1 );
- }
-
- $sql .= " LIMIT $start, $limit";
-
- /* Re-run with limit */
- $this->DB->query( $sql, 1 );
- }
- }
-
- /* Create the columns array */
- $fields = $this->DB->getResultFields();
- $cnt = count( $fields );
-
- for( $i = 0; $i < $cnt; $i++ )
- {
- $columns[ $queryCntForArray ][] = $fields[$i]->name;
- }
-
- /* Populate the rows array */
- while( $r = $this->DB->fetch() )
- {
- /* Loop through the results and add to row */
- $row = array();
-
- for( $i = 0; $i < $cnt; $i++ )
- {
- if( $man_query == 1 )
- {
- if( IPSText::mbstrlen( $r[ $fields[$i]->name ] ) > 200 AND ! preg_match( "/^SHOW/i", $sql ) )
- {
- $r[ $fields[$i]->name ] = IPSText::truncate( $r[ $fields[$i]->name ], 200 ) .'...';
- }
- }
-
- $row[] = nl2br( htmlspecialchars( wordwrap( $r[ $fields[$i]->name ] , 50, "\n", 1 ) ) );
- }
-
- /* Add to output array */
- $rows[ $queryCntForArray ][] = $row;
- }
- }
- else
- {
- $columns[ $queryCntForArray ][] = '';
- $rows[ $queryCntForArray ][] = array( $this->lang->words['query_executed_successfully'] );
- }
-
- $this->DB->freeResult();
-
- $queryCntForArray++;
- }
- }
-
- /* Output */
- $this->registry->output->html .= $this->html->sqlViewResults( $the_queries, $columns, $rows, $links );
- }
-
- /**
- * SHOW ALL TABLES AND STUFF!
- * 5 hours ago this seemed like a damned good idea.
- *
- * @access public
- * @return void
- */
- public function sqlListIndex()
- {
- /* INIT */
- $form_array = array();
- $extra = "";
-
- /* Check version */
- if ( $this->sql_version < 3232 )
- {
- $extra = $this->lang->words['my_tooold'];
- }
-
- /* Get a list of tables */
- $this->DB->query( "SHOW TABLE STATUS FROM `{$this->settings['sql_database']}`" );
-
- /* Loop through the results */
- $rows = array();
-
- while( $r = $this->DB->fetch() )
- {
- /* Check to ensure it's a table for this install... */
- if ( ! preg_match( "/^" . $this->settings['sql_tbl_prefix'] ."/i", $r['Name'] ) )
- {
- continue;
- }
-
- /* Add to output array */
- $rows[] = array(
- 'table' => $r['Name'],
- 'rows' => $r['Rows'],
- 'query' => urlencode( "SELECT * FROM {$r['Name']}" )
- );
- }
-
- /* Output */
- $this->registry->output->html .= $this->html->sqlListTables( $rows );
- }
-
- /**
- * Internal handler to return content from table
- *
- * @access public
- * @param string Table
- * @param boolean Whether to show create table or not
- * @param boolean Whether to skip non-essential tables
- * @return void
- * @author Josh
- */
- public function sqlGetTableSQL($tbl, $create_tbl, $skip=0)
- {
- /* Add create table statement? */
- if( $create_tbl )
- {
- /* Generate table structure */
- if( $this->request['addticks'] )
- {
- $this->DB->query( "SHOW CREATE TABLE `{$this->settings['sql_database']}.{$tbl}`" );
- }
- else
- {
- $this->DB->query( "SHOW CREATE TABLE {$this->settings['sql_database']}.{$tbl}" );
- }
-
- $ctable = $this->DB->fetch();
-
-
- echo $this->sqlStripTicks( $ctable['Create Table'] ).";\n";
- }
-
- /* Are we skipping? Woohoo, where's me rope?! */
- if( $skip == 1 )
- {
- if(
- $tbl == $this->settings['sql_tbl_prefix'].'admin_sessions' OR
- $tbl == $this->settings['sql_tbl_prefix'].'sessions' OR
- $tbl == $this->settings['sql_tbl_prefix'].'captcha'
- )
- {
- return $ret;
- }
- }
-
- /* Get the data */
- $this->DB->query("SELECT * FROM $tbl");
-
- /* Check to make sure rows are in this table, if not return. */
- $row_count = $this->DB->getTotalRows();
-
- if( $row_count < 1 )
- {
- return TRUE;
- }
-
- /* Get col names */
- $f_list = "";
- $fields = $this->DB->getResultFields();
- $cnt = count($fields);
-
- for( $i = 0; $i < $cnt; $i++ )
- {
- $f_list .= $fields[$i]->name . ", ";
- }
-
- $f_list = rtrim( $f_list, ', ' );
-
- /* Loop through the rows */
- while ( $row = $this->DB->fetch() )
- {
- /* Get col data */
- $d_list = "";
-
- for( $i = 0; $i < $cnt; $i++ )
- {
- if ( ! isset($row[ $fields[$i]->name ]) )
- {
- $d_list .= "NULL,";
- }
- elseif ( $row[ $fields[$i]->name ] != '' )
- {
- $d_list .= "'".$this->sqlAddSlashes( $row[ $fields[$i]->name ] ). "',";
- }
- else
- {
- $d_list .= "'',";
- }
- }
-
- $d_list = rtrim( $d_list, ',' );
-
- echo "INSERT INTO $tbl ($f_list) VALUES($d_list);\n";
- }
-
- return TRUE;
-
- }
-
- /**
- * Strip tick marks from field names
- *
- * @access public
- * @param string $data String to strip tick marks from
- * @return string
- */
- public function sqlStripTicks( $data )
- {
- return str_replace( "`", "", $data );
- }
-
- /**
- * Add slashes to single quotes to stop sql breaks
- *
- * @access public
- * @param string $data String to add slashes too
- * @return string
- */
- public function sqlAddSlashes($data)
- {
- $data = str_replace('\\', '\\\\', $data);
- $data = str_replace('\'', '\\\'', $data);
- $data = str_replace("\r", '\r' , $data);
- $data = str_replace("\n", '\n' , $data);
-
- return $data;
- }
-
- /**
- * Gzip
- *
- * @access public
- * @param string $val
- * @return string
- **/
- public function sqlGzipFourChars( $val )
- {
- for ($i = 0; $i < 4; $i ++)
- {
- $return .= chr($val % 256);
- $val = floor($val / 256);
- }
-
- return $return;
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * mySQL Admin
+ * Last Updated: $Date: 2010-09-27 18:18:35 -0400 (Mon, 27 Sep 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6917 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+@set_time_limit(1200);
+
+
+class admin_core_sql_toolbox_module extends ipsCommand {
+
+ /**
+ * SQL version
+ *
+ * @access public
+ * @var string
+ */
+ public $sql_version = "";
+
+ /**
+ * True SQL version
+ *
+ * @access public
+ * @var string
+ */
+ public $true_version = "";
+
+ /**
+ * GZIP Header contents for backup
+ *
+ * @access public
+ * @var string
+ */
+ public $str_gzip_header = "\x1f\x8b\x08\x00\x00\x00\x00\x00";
+
+ /**
+ * Flag that's set if there's problems
+ *
+ * @access public
+ * @var boolean
+ */
+ public $db_has_issues = false;
+
+ /**
+ * HTML object
+ *
+ * @access public
+ * @var object
+ */
+ public $html;
+
+ /**
+ * Form code
+ *
+ * @access public
+ * @var string
+ */
+ public $form_code = "";
+
+ /**
+ * Form code js
+ *
+ * @access public
+ * @var string
+ */
+ public $form_code_js = "";
+
+ /**
+ * Main class entry point
+ *
+ * @access public
+ * @param object ipsRegistry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* Load HTML and Lang */
+ $this->html = $this->registry->output->loadTemplate( 'cp_skin_sql' );
+ $this->registry->class_localization->loadLanguageFile( array( 'admin_sql' ) );
+
+ /* URLs */
+ $this->form_code = $this->html->form_code = 'module=sql§ion=toolbox';
+ $this->form_code_js = $this->html->form_code_js = 'module=sql§ion=toolbox';
+
+ /* Get mySQL Version */
+ $this->DB->getSqlVersion();
+
+ $this->true_version = $this->html->true_version = $this->DB->true_version;
+ $this->sql_version = $this->html->sql_version = $this->DB->sql_version;
+
+ /* What to do */
+ switch( $this->request['do'] )
+ {
+ case 'dotool':
+ $this->sqlRunTool();
+ break;
+
+ case 'runtime':
+ $this->sqlViewResults("SHOW STATUS");
+ break;
+
+ case 'system':
+ $this->sqlViewResults("SHOW VARIABLES");
+ break;
+
+ case 'processes':
+ $this->sqlViewResults("SHOW PROCESSLIST");
+ break;
+
+ case 'runsql':
+ $_POST['query'] = isset( $_POST['query'] ) ? $_POST['query'] : '';
+ $q = $_POST['query'] == "" ? urldecode( $_GET['query'] ) : $_POST['query'];
+ $q = str_replace( "\", '\\', IPSText::stripslashes( $q ) );
+
+ $this->sqlViewResults( trim( $q ) );
+ break;
+
+ case 'backup':
+ $this->sqlBackupForm();
+ break;
+
+ case 'safebackup':
+ $this->sqlSafeBackupSplash();
+ break;
+
+ case 'dosafebackup':
+ $this->sqlDoSafeBackup();
+ break;
+
+ case 'export_tbl':
+ $this->sqlDoSafeBackup( trim( urldecode( stripslashes( $_GET['tbl'] ) ) ) );
+ break;
+
+ case 'viewschematic':
+ $this->sqlViewTable();
+ break;
+ default:
+ $this->sqlListIndex();
+ break;
+ }
+
+ /* Output */
+ $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * Run selected tool on selected tables
+ *
+ * @access public
+ * @return void
+ */
+ public function sqlRunTool()
+ {
+ /* have we got some there tables me laddo? */
+ $tables = array();
+
+ foreach( $this->request as $key => $value )
+ {
+ if( preg_match( "/^tbl_(\S+)$/", $key, $match ) )
+ {
+ if( $this->request[ $match[0] ] )
+ {
+ $tables[] = $match[1];
+ }
+ }
+ }
+
+ /* Make sure we have tables to run this on */
+ if( count( $tables ) < 1 )
+ {
+ $this->registry->output->showError( $this->lang->words['my_seltables'], 11145 );
+ }
+
+ /* What tool is one running? */
+ if( strtoupper( $this->request['tool'] ) == 'DROP' || strtoupper( $this->request['tool'] ) == 'CREATE' || strtoupper( $this->request['tool'] ) == 'FLUSH' )
+ {
+ $this->registry->output->showError( $this->lang->words['my_cantdo'], 2114, true );
+ }
+
+ /**
+ * Rikki wants a stupid template so we can output his stupid header. Yes, this creates more work for me.
+ * This template serves no other purpose than to make Rikki happy. Must make Rikki happy. Rikki gets cranky when he's not happy.
+ *
+ * Ask him about roundabouts sometime. Apparently...they're round.
+ */
+ $this->registry->output->html .= $this->html->sqlToolResultHeader();
+
+ /* Loop through each table and run the tool */
+ foreach( $tables as $table )
+ {
+ /* Run the query */
+ $this->DB->query( strtoupper( $this->request['tool'] ) . " TABLE $table" );
+
+ /* Results */
+ $fields = $this->DB->getResultFields();
+ $data = $this->DB->fetch();
+
+ /* Print the headers - we don't what or how many so... */
+ $columns = array();
+ $cnt = count( $fields );
+
+ for( $i = 0; $i < $cnt; $i++ )
+ {
+ $columns[] = $fields[$i]->name;
+ }
+
+ /* Grab the rows - we don't what or how many so... */
+ $rows = array();
+
+ for( $i = 0; $i < $cnt; $i++ )
+ {
+ $rows[] = $data[ $fields[$i]->name ];
+ }
+
+ /* Add to output */
+ $this->registry->output->html .= $this->html->sqlToolResult( $this->lang->words['resultprefix'] . $this->request['tool'] . " " . $table, $columns, $rows );
+ }
+ }
+
+ /**
+ * Safe backup splash screen
+ *
+ * @access public
+ * @return void
+ */
+ public function sqlSafeBackupSplash()
+ {
+ /* Output */
+ $this->registry->output->extra_nav[] = array( '', $this->lang->words['my_backupnav'] );
+ $this->registry->output->html .= $this->html->sqlSafeBackupSplashScreen();
+ }
+
+ /**
+ * Runs the database backup
+ *
+ * @access public
+ * @param string $tbl_name Specify a table to backup, leave blank to backup all
+ * @return void
+ */
+ public function sqlDoSafeBackup($tbl_name="")
+ {
+ /* Backup All Tables */
+ if( $tbl_name == "" )
+ {
+ $skip = intval( $this->request['skip'] );
+ $create_tbl = intval( $this->request['create_tbl'] );
+ $enable_gzip = intval( $this->request['enable_gzip'] );
+ $filename = 'ipb_db_backup';
+ }
+ /* Backup specfic table */
+ else
+ {
+ $skip = 0;
+ $create_tbl = 0;
+ $enable_gzip = 1;
+ $filename = $tbl_name;
+ }
+
+ /* Setup */
+ $output = "";
+ @header("Pragma: no-cache");
+ $do_gzip = 0;
+
+ /* Gzip? */
+ if( $enable_gzip )
+ {
+ $phpver = phpversion();
+
+ if($phpver >= "4.0")
+ {
+ if(extension_loaded("zlib"))
+ {
+ $do_gzip = 1;
+ }
+ }
+ }
+
+ if( $do_gzip != 0 )
+ {
+ @ob_start();
+ @ob_implicit_flush(0);
+ header("Content-Type: text/x-delimtext; name=\"{$filename}.sql.gz\"");
+ header("Content-disposition: attachment; filename={$filename}.sql.gz");
+ }
+ else
+ {
+ header("Content-Type: text/x-delimtext; name=\"{$filename}.sql\"");
+ header("Content-disposition: attachment; filename={$filename}.sql");
+ }
+
+ /* Get tables to work on */
+ if( $tbl_name == "" )
+ {
+ $tmp_tbl = $this->DB->getTableNames();
+
+ foreach( $tmp_tbl as $tbl )
+ {
+ /* Ensure that we're only peeking at IBF tables */
+ if ( preg_match( "/^" . $this->settings['sql_tbl_prefix'] . "/", $tbl ) )
+ {
+ /* We've started our headers, so print as we go to stop poss memory problems */
+ $this->sqlGetTableSQL($tbl, $create_tbl, $skip);
+ }
+ }
+ }
+ else
+ {
+ $this->sqlGetTableSQL($tbl_name, $create_tbl, $skip);
+ }
+
+ /* Gzip the result */
+ if( $do_gzip )
+ {
+ $size = ob_get_length();
+ $crc = crc32( ob_get_contents() );
+ $contents = gzcompress( ob_get_contents() );
+ ob_end_clean();
+ echo $this->str_gzip_header . substr( $contents, 0, strlen( $contents ) - 4 ) . $this->sqlGzipFourChars( $crc ) . $this->sqlGzipFourChars( $size );
+ }
+
+ exit();
+ }
+
+ /**
+ * Displays the form for backing up an sql database
+ *
+ * @access public
+ * @return void
+ * @author Josh
+ */
+ public function sqlBackupForm()
+ {
+ /* Check mySQL Version */
+ if ( $this->sql_version < 3232 )
+ {
+ $this->registry->output->showError( $this->lang->words['my_tooold'], 11146 );
+ }
+
+ /* Form Elements */
+ $form = array();
+
+ $form['create_tbl'] = $this->registry->output->formYesNo( 'create_tbl', 1);
+ $form['skip'] = $this->registry->output->formYesNo( 'skip', 1);
+ $form['enable_gzip'] = $this->registry->output->formYesNo( 'enable_gzip', 0 );
+
+ /* Output */
+ $this->registry->output->html .= $this->html->sqlBackupForm( $form );
+ }
+
+ /**
+ * Run a mysql query and display results
+ *
+ * @access public
+ * @param string $sql The query to run
+ * @return void
+ */
+ public function sqlViewResults( $sql )
+ {
+ /* INIT */
+ $limit = 50;
+ $pages = "";
+ $the_queries = array();
+ $tableName = '';
+ $truncated = array();
+
+ /* Title Map */
+ $map = array( 'processes' => $this->lang->words['my_processes'],
+ 'runtime' => $this->lang->words['my_runtime'],
+ 'system' => $this->lang->words['my_sysvar'],
+ );
+
+ /* Figure out the title */
+ if ( isset( $map[ $this->request['do'] ] ) AND $map[ $this->request['do'] ] != "" )
+ {
+ $tbl_title = $map[ $this->request['do'] ];
+ $man_query = 0;
+ }
+ else
+ {
+ $tbl_title = $this->lang->words['my_manual'];
+ $man_query = 1;
+ }
+
+ /* Turn off error die */
+ $this->DB->return_die = 1;
+
+ /* Split up multiple queries */
+ $the_queries = array();
+
+ if( strstr( $sql, ";" ) )
+ {
+ $the_queries = preg_split( "/;[\r\n|\n]+/", $sql, -1, PREG_SPLIT_NO_EMPTY );
+ }
+ else
+ {
+ if( $sql )
+ {
+ $the_queries[] = $sql;
+ }
+ }
+
+ $columns = array();
+ $rows = array();
+ $queryCntForArray = 0;
+
+ if( ! count( $the_queries ) )
+ {
+ $the_queries[ $queryCntForArray ] = '';
+ $columns[ $queryCntForArray ][] = $this->lang->words['manual_error'];
+ $rows[ $queryCntForArray ][] = array( 'error' => $this->lang->words['manual_noquery'] );
+ }
+ else
+ {
+ /* Loop through the queries and run them */
+ foreach( $the_queries as $sql )
+ {
+ /* INIT */
+ $links = "";
+ $sql = trim( $sql );
+
+ if ( ! $tableName )
+ {
+ if ( preg_match( "#^SELECT(?:.*)\s+?FROM\s+?(\S+?)(?:\s|$)#i", $sql, $match ) )
+ {
+ $tableName = $match[1];
+ }
+ }
+
+ /* Check the sql */
+ $test_sql = str_replace( "\'", "", $sql );
+ $apos_count = substr_count( $test_sql, "'" );
+
+ if( $apos_count % 2 != 0 )
+ {
+ $columns[ $queryCntForArray ][] = $this->lang->words['manual_error'];
+ $rows[ $queryCntForArray ][] = array( 'error' => $this->lang->words['manual_invalid'] . htmlspecialchars( $sql ) );
+
+ unset( $apos_count, $test_sql );
+ continue;
+ }
+
+ unset( $apos_count, $test_sql );
+
+ /* Check for drop and flush */
+ if ( preg_match( "/^(DROP|FLUSH)/i",$sql ) )
+ {
+ $columns[ $queryCntForArray ][] = $this->lang->words['manual_error'];
+ $rows[ $queryCntForArray ][] = array( 'error' => $this->lang->words['manual_notallowed'] );
+ continue;
+ }
+ /* Protect admin_login_logs */
+ else if ( preg_match( "/^(?!SELECT)/i", preg_replace( "#\s{1,}#s", "", $sql ) ) and preg_match( "/admin_login_logs/i", preg_replace( "#\s{1,}#s", "", $sql ) ) )
+ {
+ $columns[ $queryCntForArray ][] = $this->lang->words['manual_error'];
+ $rows[ $queryCntForArray ][] = array( 'error' => $this->lang->words['manual_loginlogs'] );
+ continue;
+ }
+
+ /* Setup for query */
+ $this->DB->error = "";
+ $this->DB->allow_sub_select = 1;
+
+ /* Run the query */
+ $this->DB->query( $sql, 1 );
+
+ /* Check for errors... */
+ if ( $this->DB->error != "")
+ {
+ $columns[ $queryCntForArray ][] = $this->lang->words['manual_error'];
+ $rows[ $queryCntForArray ][] = array( 'error' => htmlspecialchars( $this->DB->error ) );
+ continue;
+ }
+
+ /* Build display rows */
+ $rows[ $queryCntForArray ] = array();
+ $columns[ $queryCntForArray ] = array();
+
+ if ( preg_match( "/^SELECT/i", $sql ) or preg_match( "/^SHOW/i", $sql ) )
+ {
+ /* Sort out the pages and stuff, auto limit if need be */
+ if ( !preg_match( "/^SHOW/i", $sql ) AND ! preg_match( "/LIMIT[ 0-9,]+$/i", $sql ) )
+ {
+ /* Start value */
+ $start = $this->request['st'] ? intval( $this->request['st'] ) : 0;
+
+ /* Count the number of rows we got back */
+ $rows_returned = $this->DB->getTotalRows();
+
+ /* Paginate the results */
+ if( $rows_returned > $limit )
+ {
+ $links = $this->registry->output->generatePagination( array(
+ 'totalItems' => $rows_returned,
+ 'itemsPerPage' => $limit,
+ 'currentStartValue' => $start,
+ 'baseUrl' => "{$this->settings['base_url']}{$this->form_code}&do=runsql&query=" . urlencode( $sql ),
+ ) );
+
+ /* Reformat the query with a LIMIT */
+ if( substr( $sql, -1, 1 ) == ";" )
+ {
+ $sql = substr( $sql, 0, -1 );
+ }
+
+ $sql .= " LIMIT $start, $limit";
+
+ /* Re-run with limit */
+ $this->DB->query( $sql, 1 );
+ }
+ }
+
+ /* Create the columns array */
+ $fields = $this->DB->getResultFields();
+ $cnt = count( $fields );
+
+ for( $i = 0; $i < $cnt; $i++ )
+ {
+ $columns[ $queryCntForArray ][] = $fields[$i]->name;
+ }
+
+ /* Populate the rows array */
+ while( $r = $this->DB->fetch() )
+ {
+ /* Loop through the results and add to row */
+ $row = array();
+
+ for( $i = 0; $i < $cnt; $i++ )
+ {
+ if( $man_query == 1 )
+ {
+ if( IPSText::mbstrlen( $r[ $fields[$i]->name ] ) > 200 AND ! preg_match( "/^SHOW/i", $sql ) )
+ {
+ if ( ! $this->request['notruncate'] )
+ {
+ $r[ $fields[$i]->name ] = IPSText::truncate( $r[ $fields[$i]->name ], 200 ) .'...';
+ }
+
+ $truncated[] = $fields[$i]->name;
+ }
+ }
+
+ $row[] = nl2br( htmlspecialchars( wordwrap( $r[ $fields[$i]->name ] , 50, "\n", 1 ) ) );
+ }
+
+ /* Add to output array */
+ $rows[ $queryCntForArray ][] = $row;
+ }
+ }
+ else
+ {
+ $columns[ $queryCntForArray ][] = '';
+ $rows[ $queryCntForArray ][] = array( $this->lang->words['query_executed_successfully'] );
+ }
+
+ $this->DB->freeResult();
+
+ $queryCntForArray++;
+ }
+ }
+
+ if ( $tableName )
+ {
+ $this->registry->output->extra_nav[] = array( "{$this->settings['base_url']}{$this->form_code}&do=runsql&query=" . urlencode( "SELECT * FROM $tableName" ), $tableName );
+ }
+
+ /* Output */
+ $this->registry->output->html .= $this->html->sqlViewResults( $the_queries, $columns, $rows, $links, $tableName, $truncated );
+ }
+
+ /**
+ * SHOW ALL TABLES AND STUFF!
+ * 5 hours ago this seemed like a damned good idea.
+ *
+ * @access public
+ * @return void
+ */
+ public function sqlListIndex()
+ {
+ /* INIT */
+ $form_array = array();
+ $extra = "";
+
+ /* Check version */
+ if ( $this->sql_version < 3232 )
+ {
+ $extra = $this->lang->words['my_tooold'];
+ }
+
+ /* Get a list of tables */
+ $this->DB->query( "SHOW TABLE STATUS FROM `{$this->settings['sql_database']}`" );
+
+ /* Loop through the results */
+ $rows = array();
+
+ while( $r = $this->DB->fetch() )
+ {
+ /* Check to ensure it's a table for this install... */
+ if ( ! preg_match( "/^" . $this->settings['sql_tbl_prefix'] ."/i", $r['Name'] ) )
+ {
+ continue;
+ }
+
+ /* Add to output array */
+ $rows[] = array(
+ 'table' => $r['Name'],
+ 'rows' => $r['Rows'],
+ 'query' => urlencode( "SELECT * FROM {$r['Name']}" )
+ );
+ }
+
+ /* Output */
+ $this->registry->output->html .= $this->html->sqlListTables( $rows );
+ }
+
+ /**
+ * View table schematic
+ *
+ * @access public
+ * @return void
+ * @author Josh
+ */
+ public function sqlViewTable()
+ {
+ /* INIT */
+ $table = trim( $this->request['table'] );
+
+ /* Turn off return die */
+ $this->DB->return_die = 1;
+
+ /* Fetch data */
+ $this->DB->query( "DESCRIBE {$table}" );
+
+ while( $row = $this->DB->fetch() )
+ {
+ $rows[] = $row;
+ }
+
+ /* Fetch index data */
+ $this->DB->query( "SHOW INDEX FROM {$this->settings['sql_database']}.{$table}");
+
+ while( $row = $this->DB->fetch() )
+ {
+ $indexes[] = $row;
+ }
+
+ /* Add Nav */
+ $this->registry->output->extra_nav[] = array( "{$this->settings['base_url']}{$this->form_code}&do=runsql&query=" . urlencode( "SELECT * FROM $table" ), $table );
+
+ /* Output */
+ $this->registry->output->html .= $this->html->sqlViewTable( $table, $rows, $indexes );
+ }
+
+ /**
+ * Internal handler to return content from table
+ *
+ * @access public
+ * @param string Table
+ * @param boolean Whether to show create table or not
+ * @param boolean Whether to skip non-essential tables
+ * @return void
+ * @author Josh
+ */
+ public function sqlGetTableSQL($tbl, $create_tbl, $skip=0)
+ {
+ /* Add create table statement? */
+ if( $create_tbl )
+ {
+ /* Generate table structure */
+ if( $this->request['addticks'] )
+ {
+ $this->DB->query( "SHOW CREATE TABLE `{$this->settings['sql_database']}.{$tbl}`" );
+ }
+ else
+ {
+ $this->DB->query( "SHOW CREATE TABLE {$this->settings['sql_database']}.{$tbl}" );
+ }
+
+ $ctable = $this->DB->fetch();
+
+
+ echo $this->sqlStripTicks( $ctable['Create Table'] ).";\n";
+ }
+
+ /* Are we skipping? Woohoo, where's me rope?! */
+ if( $skip == 1 )
+ {
+ if(
+ $tbl == $this->settings['sql_tbl_prefix'].'admin_sessions' OR
+ $tbl == $this->settings['sql_tbl_prefix'].'sessions' OR
+ $tbl == $this->settings['sql_tbl_prefix'].'captcha'
+ )
+ {
+ return TRUE;
+ }
+ }
+
+ /* Get the data */
+ $this->DB->query("SELECT * FROM $tbl");
+
+ /* Check to make sure rows are in this table, if not return. */
+ $row_count = $this->DB->getTotalRows();
+
+ if( $row_count < 1 )
+ {
+ return TRUE;
+ }
+
+ /* Get col names */
+ $f_list = "";
+ $fields = $this->DB->getResultFields();
+ $cnt = count($fields);
+
+ for( $i = 0; $i < $cnt; $i++ )
+ {
+ $f_list .= $fields[$i]->name . ", ";
+ }
+
+ $f_list = rtrim( $f_list, ', ' );
+
+ /* Loop through the rows */
+ while ( $row = $this->DB->fetch() )
+ {
+ /* Get col data */
+ $d_list = "";
+
+ for( $i = 0; $i < $cnt; $i++ )
+ {
+ if ( ! isset($row[ $fields[$i]->name ]) )
+ {
+ $d_list .= "NULL,";
+ }
+ elseif ( $row[ $fields[$i]->name ] != '' )
+ {
+ $d_list .= "'".$this->sqlAddSlashes( $row[ $fields[$i]->name ] ). "',";
+ }
+ else
+ {
+ $d_list .= "'',";
+ }
+ }
+
+ $d_list = rtrim( $d_list, ',' );
+
+ echo "INSERT INTO $tbl ($f_list) VALUES($d_list);\n";
+ }
+
+ return TRUE;
+
+ }
+
+ /**
+ * Strip tick marks from field names
+ *
+ * @access public
+ * @param string $data String to strip tick marks from
+ * @return string
+ */
+ public function sqlStripTicks( $data )
+ {
+ return str_replace( "`", "", $data );
+ }
+
+ /**
+ * Add slashes to single quotes to stop sql breaks
+ *
+ * @access public
+ * @param string $data String to add slashes too
+ * @return string
+ */
+ public function sqlAddSlashes($data)
+ {
+ $data = str_replace('\\', '\\\\', $data);
+ $data = str_replace('\'', '\\\'', $data);
+ $data = str_replace("\r", '\r' , $data);
+ $data = str_replace("\n", '\n' , $data);
+
+ return $data;
+ }
+
+ /**
+ * Gzip
+ *
+ * @access public
+ * @param string $val
+ * @return string
+ **/
+ public function sqlGzipFourChars( $val )
+ {
+ for ($i = 0; $i < 4; $i ++)
+ {
+ $return .= chr($val % 256);
+ $val = floor($val / 256);
+ }
+
+ return $return;
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/sql/toolbox.php b/upload/admin/applications/core/modules_admin/sql/toolbox.php
index f941e528..d73d7dbd 100644
--- a/upload/admin/applications/core/modules_admin/sql/toolbox.php
+++ b/upload/admin/applications/core/modules_admin/sql/toolbox.php
@@ -1,18 +1,19 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* SQL Admin
- * Last Updated: $Date: 2009-03-11 09:44:20 -0400 (Wed, 11 Mar 2009) $
+ * Last Updated: $Date: 2010-10-19 08:45:58 -0400 (Tue, 19 Oct 2010) $
+ *
*
- * @author $Author: jason $
+ * @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
- * @version $Rev: 4193 $
- *
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6994 $
*/
if ( ! defined( 'IN_ACP' ) )
@@ -26,14 +27,13 @@ class admin_core_sql_toolbox extends ipsCommand
/**
* Main class entry point
*
- * @access public
* @param object ipsRegistry reference
*/
public function doExecute( ipsRegistry $registry )
{
/* Require the right driver file */
- require_once( IPS_ROOT_PATH . 'applications/core/modules_admin/sql/' . strtolower( ipsRegistry::dbFunctions()->getDriverType() ) . '.php' );
- $dbdriver = new admin_core_sql_toolbox_module();
+ $classToLoad = IPSLib::loadActionOverloader( IPS_ROOT_PATH . 'applications/core/modules_admin/sql/' . strtolower( ipsRegistry::dbFunctions()->getDriverType() ) . '.php', 'admin_core_sql_toolbox_module' );
+ $dbdriver = new $classToLoad();
$dbdriver->makeRegistryShortcuts( $registry );
$dbdriver->doExecute( $registry );
}
diff --git a/upload/admin/applications/core/modules_admin/sql/xml/index.html b/upload/admin/applications/core/modules_admin/sql/xml/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/sql/xml/index.html
+++ b/upload/admin/applications/core/modules_admin/sql/xml/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/system/defaultSection.php b/upload/admin/applications/core/modules_admin/system/defaultSection.php
index 4787eb64..c80d2948 100644
--- a/upload/admin/applications/core/modules_admin/system/defaultSection.php
+++ b/upload/admin/applications/core/modules_admin/system/defaultSection.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Define the default system section
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4948 $
+ * @version $Rev: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_admin/system/index.html b/upload/admin/applications/core/modules_admin/system/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/system/index.html
+++ b/upload/admin/applications/core/modules_admin/system/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/system/loginlog.php b/upload/admin/applications/core/modules_admin/system/loginlog.php
index 823d5163..90be1773 100644
--- a/upload/admin/applications/core/modules_admin/system/loginlog.php
+++ b/upload/admin/applications/core/modules_admin/system/loginlog.php
@@ -1,17 +1,19 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Admin Login Logs
- * Last Updated: $LastChangedDate: 2009-03-20 12:37:44 -0400 (Fri, 20 Mar 2009) $
+ * Last Updated: $LastChangedDate: 2010-10-08 08:06:02 -0400 (Fri, 08 Oct 2010) $
+ *
*
- * @author $Author: josh $
+ * @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
- * @version $Rev: 4267 $
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6955 $
*/
if ( ! defined( 'IN_ACP' ) )
@@ -35,7 +37,7 @@ class admin_core_system_loginlog extends ipsCommand
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'acplogin_log' );
/* Language */
- $this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_logs' ) );
+ $this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_logs', 'admin_system' ) );
/* URLs */
$this->form_code = 'module=system§ion=loginlog';
@@ -48,8 +50,7 @@ class admin_core_system_loginlog extends ipsCommand
$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=system§ion=loginlog', $this->lang->words['al_error_logs'] );
- /* Load lang and skin */
- $this->registry->class_localization->loadLanguageFile( array( 'admin_system' ) );
+ /* Load skin */
$this->html = $this->registry->output->loadTemplate('cp_skin_system');
switch( $this->request['do'] )
diff --git a/upload/admin/applications/core/modules_admin/system/security.php b/upload/admin/applications/core/modules_admin/system/security.php
index fbcfcef0..52d39f23 100644
--- a/upload/admin/applications/core/modules_admin/system/security.php
+++ b/upload/admin/applications/core/modules_admin/system/security.php
@@ -1,20 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Security center tools
- * Last Updated: $Date: 2009-10-23 21:23:07 -0400 (Fri, 23 Oct 2009) $
+ * Last Updated: $Date: 2010-10-18 13:10:17 -0400 (Mon, 18 Oct 2010) $
+ *
*
- * @author $Author: bfarber $
+ * @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 2.2 IIRC
- * @version $Revision: 5283 $
- *
+ * @version $Revision: 6990 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -28,7 +28,6 @@ class admin_core_system_security extends ipsCommand
/**
* Skin object
*
- * @access private
* @var object Skin templates
*/
private $html;
@@ -36,7 +35,6 @@ class admin_core_system_security extends ipsCommand
/**
* Main class entry point
*
- * @access public
* @param object ipsRegistry reference
* @return void [Outputs to screen]
*/
@@ -107,7 +105,6 @@ class admin_core_system_security extends ipsCommand
/**
* Virus checker
*
- * @access public
* @return void
*/
public function listAdmins()
@@ -187,7 +184,6 @@ class admin_core_system_security extends ipsCommand
/**
* Virus checker
*
- * @access public
* @return void
*/
public function virusCheck()
@@ -214,8 +210,8 @@ class admin_core_system_security extends ipsCommand
// Get class
//-----------------------------------------
- require_once( IPS_ROOT_PATH . 'sources/classes/virusChecker/virusChecker.php' );
- $class_virus_checker = new virusChecker( $this->registry );
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/virusChecker/virusChecker.php', 'virusChecker' );
+ $class_virus_checker = new $classToLoad( $this->registry );
//-----------------------------------------
// Run it...
@@ -294,7 +290,6 @@ class admin_core_system_security extends ipsCommand
/**
* Security Overview Screen
*
- * @access public
* @return void
*/
public function securityOverview()
@@ -427,7 +422,6 @@ class admin_core_system_security extends ipsCommand
/**
* ACP HTACCESS: Step two
*
- * @access public
* @return void
* @author Josh
*/
@@ -489,7 +483,6 @@ class admin_core_system_security extends ipsCommand
/**
* ACP HTACCESS: Step One
*
- * @access public
* @return void
*/
public function acpHtaccessForm()
@@ -501,7 +494,6 @@ class admin_core_system_security extends ipsCommand
/**
* Rename ACP directory
*
- * @access public
* @return void
*/
public function doAcpRename()
@@ -514,7 +506,6 @@ class admin_core_system_security extends ipsCommand
/**
* Change conf global
*
- * @access public
* @return void
*/
public function doConfGlobal()
@@ -544,7 +535,6 @@ class admin_core_system_security extends ipsCommand
/**
* Add htaccess to non IPB dirs
*
- * @access public
* @return void
*/
public function doHtaccess()
@@ -596,13 +586,13 @@ EOF;
/**
* Deep Virus Scan
*
- * @access public
* @return void
*/
public function deepScan()
{
/* INIT */
$filter = trim( $this->request['filter'] );
+ $bad_score = 0;
$file_count = 0;
$bad_count = 0;
$content = "";
@@ -620,8 +610,8 @@ EOF;
10 => '#ff0000' );
/* Virus checker */
- require_once( IPS_ROOT_PATH . 'sources/classes/virusChecker/virusChecker.php' );
- $class_virus_checker = new virusChecker( $this->registry );
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/virusChecker/virusChecker.php', 'virusChecker' );
+ $class_virus_checker = new $classToLoad( $this->registry );
/* Run Scan */
$class_virus_checker->deepScan( rtrim( DOC_IPS_ROOT_PATH, '/' ) );
@@ -717,37 +707,4 @@ EOF;
$this->registry->output->extra_nav[] = array( '', $this->lang->words['s_deep_nav'] );
}
-
- /**
- * Update Setting
- *
- * @access public
- * @param string $key Setting key to update
- * @param mixed $value Value to set
- * @return boolean
- * @deprecated Not used any more best I can tell
- */
- public function update_setting( $key, $value )
- {
- /* Check for a key */
- if ( ! $key )
- {
- return FALSE;
- }
-
- /* Update the DB */
- $this->DB->update( 'core_sys_conf_settings', array( 'conf_value' => $value ), "conf_key='{$key}'" );
-
- //-----------------------------------------
- // Rebuild settings cache
- //-----------------------------------------
-
- require_once( IPSLib::getAppDir( 'core' ) . '/modules_admin/tools/settings.php' );
- $settings = new settings();
-
- $settings->setting_rebuildcache();
-
- /* Done */
- return TRUE;
- }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/system/taskmanager.php b/upload/admin/applications/core/modules_admin/system/taskmanager.php
index f4e6e162..827e969c 100644
--- a/upload/admin/applications/core/modules_admin/system/taskmanager.php
+++ b/upload/admin/applications/core/modules_admin/system/taskmanager.php
@@ -1,18 +1,19 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Task Manager
- * Last Updated: $LastChangedDate: 2009-12-01 17:42:17 -0500 (Tue, 01 Dec 2009) $
+ * Last Updated: $LastChangedDate: 2010-10-19 10:40:05 -0400 (Tue, 19 Oct 2010) $
+ *
*
- * @author $Author: josh $
+ * @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
- * @version $Rev: 5501 $
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6995 $
*/
if ( ! defined( 'IN_ACP' ) )
@@ -26,7 +27,6 @@ class admin_core_system_taskmanager extends ipsCommand
/**
* Skin object
*
- * @access private
* @var object Skin templates
*/
private $html;
@@ -34,15 +34,14 @@ class admin_core_system_taskmanager extends ipsCommand
/**
* Main class entry point
*
- * @access public
* @param object ipsRegistry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
/* Load Class */
- require_once( IPS_ROOT_PATH . '/sources/classes/class_taskmanager.php' );
- $this->func_taskmanager = new class_taskmanager( $registry );
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/class_taskmanager.php', 'class_taskmanager' );
+ $this->func_taskmanager = new $classToLoad( $registry );
/* Load Skin and Language */
$this->html = $this->registry->output->loadTemplate('cp_skin_system');
@@ -141,7 +140,6 @@ class admin_core_system_taskmanager extends ipsCommand
/**
* Perform the task import
*
- * @access public
* @param string Raw XML code
* @return void
*/
@@ -222,7 +220,6 @@ class admin_core_system_taskmanager extends ipsCommand
/**
* Remove a task log
*
- * @access public
* @return void
*/
public function taskLogsDelete()
@@ -251,7 +248,6 @@ class admin_core_system_taskmanager extends ipsCommand
/**
* Show task logs
*
- * @access public
* @return void
*/
public function taskLogsShow()
@@ -299,7 +295,6 @@ class admin_core_system_taskmanager extends ipsCommand
/**
* Builds the task log overview screen
*
- * @access public
* @return void
*/
public function taskLogsOverview()
@@ -355,7 +350,6 @@ class admin_core_system_taskmanager extends ipsCommand
/**
* Delete a task
*
- * @access public
* @param string $type Either add or edit
* @return void
*/
@@ -387,7 +381,6 @@ class admin_core_system_taskmanager extends ipsCommand
/**
* Unlock a task
*
- * @access public
* @return void
*/
public function taskManagerUnlockTask()
@@ -406,7 +399,6 @@ class admin_core_system_taskmanager extends ipsCommand
/**
* Runs the selected task
*
- * @access public
* @return void
*/
public function taskManagerRunTask()
@@ -459,10 +451,9 @@ class admin_core_system_taskmanager extends ipsCommand
/* Run the task file */
if( file_exists( IPSLib::getAppDir( $this_task['task_application'] ) . '/tasks/' . $this_task['task_file'] ) )
{
- require_once( IPSLib::getAppDir( $this_task['task_application'] ) . '/tasks/' . $this_task['task_file'] );
- $myobj = new task_item( $this->registry, $this->func_taskmanager, $this_task );
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( $this_task['task_application'] ) . '/tasks/' . $this_task['task_file'], 'task_item', $this_task['task_application'] );
+ $myobj = new $classToLoad( $this->registry, $this->func_taskmanager, $this_task );
$myobj->runTask();
-
/* Bounce */
$this->registry->output->global_message = $this->lang->words['t_ran'];
@@ -483,7 +474,6 @@ class admin_core_system_taskmanager extends ipsCommand
/**
* Save the add/edit task form
*
- * @access public
* @param string $type Either add or edit
* @return void
*/
@@ -587,7 +577,6 @@ class admin_core_system_taskmanager extends ipsCommand
/**
* Builds the add/edit task form
*
- * @access public
* @param string $type Either add or edit
* @return void
*/
@@ -608,13 +597,13 @@ class admin_core_system_taskmanager extends ipsCommand
/* Edit Task Form */
if ( $type == 'edit' )
{
- /* Form bits */
- $title = "Editing Task: ".$group['cb_group_name'];
- $button = "Edit Task";
- $formbit = "task_edit_do";
-
/* Form Data */
- $task = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'task_manager', 'where' => "task_id=$task_id" ) );
+ $task = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'task_manager', 'where' => "task_id={$task_id}" ) );
+
+ /* Form bits */
+ $title = sprintf( $this->lang->words['task_edit_title'], $task['task_title'] );
+ $button = $this->lang->words['edittask_button'];
+ $formbit = "task_edit_do";
}
/* Add Task Form */
else
@@ -703,7 +692,6 @@ class admin_core_system_taskmanager extends ipsCommand
/**
* Builds the task mananger overview screen
*
- * @access public
* @return void
*/
public function taskManagerOverview()
@@ -720,6 +708,11 @@ class admin_core_system_taskmanager extends ipsCommand
/* Loop through and build the output array */
while ( $row = $this->DB->fetch() )
{
+ if( !IPSLib::appIsInstalled( $row['task_application'] ) )
+ {
+ continue;
+ }
+
$row['task_minute'] = $row['task_minute'] != '-1' ? $row['task_minute'] : '-';
$row['task_hour'] = $row['task_hour'] != '-1' ? $row['task_hour'] : '-';
$row['task_month_day'] = $row['task_month_day'] != '-1' ? $row['task_month_day'] : '-';
@@ -758,7 +751,6 @@ class admin_core_system_taskmanager extends ipsCommand
/**
* Imports tasks from XML
*
- * @access public
* @param string $file Filename to import tasks from
* @param bool $no_return Set to return true/false, instead of displaying results
* @return void
@@ -882,7 +874,6 @@ class admin_core_system_taskmanager extends ipsCommand
/**
* Import all tasks from XML
*
- * @access public
* @param bool $no_return
* @return void
*/
@@ -953,21 +944,13 @@ class admin_core_system_taskmanager extends ipsCommand
}
}
- /* Return or Bounce */
- if ( $no_return )
- {
- return TRUE;
- }
- else
- {
- $this->taskManagerOverview();
- }
+ /* Return */
+ $this->taskManagerOverview();
}
/**
* Export a single task
*
- * @access public
* @return void
*/
public function taskExport()
@@ -997,7 +980,6 @@ class admin_core_system_taskmanager extends ipsCommand
/**
* Export tasks to XML
*
- * @access public
* @return void
*/
public function tasksExportToXML()
@@ -1043,5 +1025,4 @@ class admin_core_system_taskmanager extends ipsCommand
$this->registry->output->global_message = $this->lang->words['t_exported'];
$this->taskManagerOverview();
}
-
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/system/xml/index.html b/upload/admin/applications/core/modules_admin/system/xml/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/system/xml/index.html
+++ b/upload/admin/applications/core/modules_admin/system/xml/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/templates/css.php b/upload/admin/applications/core/modules_admin/templates/css.php
index e63189b3..0dd95d98 100644
--- a/upload/admin/applications/core/modules_admin/templates/css.php
+++ b/upload/admin/applications/core/modules_admin/templates/css.php
@@ -1,19 +1,21 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* CSS editing
- * Last Updated: $Date: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Who knows...
- * @version $Revision: 3887 $
+ * @version $Revision: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_admin/templates/defaultSection.php b/upload/admin/applications/core/modules_admin/templates/defaultSection.php
index 106f7a34..faf2ce84 100644
--- a/upload/admin/applications/core/modules_admin/templates/defaultSection.php
+++ b/upload/admin/applications/core/modules_admin/templates/defaultSection.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Define the default templates section
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4948 $
+ * @version $Rev: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_admin/templates/easylogo.php b/upload/admin/applications/core/modules_admin/templates/easylogo.php
index 21e7720f..030f0dc8 100644
--- a/upload/admin/applications/core/modules_admin/templates/easylogo.php
+++ b/upload/admin/applications/core/modules_admin/templates/easylogo.php
@@ -1,245 +1,247 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
- exit();
-}
-
-
-class admin_core_templates_easylogo extends ipsCommand
-{
- /**
- * HTML Skin object
- *
- * @access protected
- * @var object
- */
- protected $html;
-
- /**
- * Skin Functions Class
- *
- * @access private
- * @var object
- */
- private $skinFunctions;
-
- /**
- * Class entry point
- *
- * @access public
- * @param object Registry reference
- * @return void [Outputs to screen/redirects]
- */
- public function doExecute( ipsRegistry $registry )
- {
- //-----------------------------------------
- // Load lang
- //-----------------------------------------
-
- $this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_templates' ), 'core' );
-
- //-----------------------------------------
- // Load skin
- //-----------------------------------------
-
- $this->html = $this->registry->output->loadTemplate('cp_skin_templates');
-
- //-----------------------------------------
- // Set up stuff
- //-----------------------------------------
-
- $this->form_code = $this->html->form_code = 'module=templates§ion=easylogo';
- $this->form_code_js = $this->html->form_code_js = 'module=templates§ion=easylogo';
-
- //-----------------------------------------
- // 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 to do?
- //-----------------------------------------
-
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'easy_logo' );
-
- switch( $this->request['do'] )
- {
- default:
- case 'splash':
- $this->splash();
- break;
- case 'finish':
- $this->complete();
- break;
- }
-
- /* Output */
- $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
- $this->registry->output->sendOutput();
- }
-
- /**
- * Finish changing the logo
- *
- * @access public
- * @return void [Outputs to screen/redirects]
- */
- public function complete()
- {
- //-----------------------------------------
- // Check id
- //-----------------------------------------
-
- if ( ! $this->request['skin'] )
- {
- $this->registry->output->global_message = $this->lang->words['el_noskinid'];
- $this->splash();
- return;
- }
-
- //-----------------------------------------
- // Upload or new logo?
- //-----------------------------------------
-
- if ( $_FILES['FILE_UPLOAD']['name'] == "" or ! $_FILES['FILE_UPLOAD']['name'] or ($_FILES['FILE_UPLOAD']['name'] == "none") )
- {
- if ( ! $_POST['logo_url'] )
- {
- $this->registry->output->global_message = $this->lang->words['el_nofile'];
- $this->splash();
- return;
- }
-
- $newlogo = $_POST['logo_url'];
- }
- else
- {
- if ( ! is_writable( IPS_CACHE_PATH . 'public/style_images' ) )
- {
- $this->registry->output->global_message = $this->lang->words['el_chmod'];
- $this->splash();
- return;
- }
-
- //-----------------------------------------
- // Upload
- //-----------------------------------------
-
- $FILE_NAME = $_FILES['FILE_UPLOAD']['name'];
- $FILE_SIZE = $_FILES['FILE_UPLOAD']['size'];
- $FILE_TYPE = $_FILES['FILE_UPLOAD']['type'];
-
- //-----------------------------------------
- // Silly spaces
- //-----------------------------------------
-
- $FILE_NAME = preg_replace( "/\s+/", "_", $FILE_NAME );
-
- //-----------------------------------------
- // Naughty Opera adds the filename on the end of the
- // mime type - we don't want this.
- //-----------------------------------------
-
- $FILE_TYPE = preg_replace( "/^(.+?);.*$/", "\\1", $FILE_TYPE );
-
- //-----------------------------------------
- // Correct file type?
- //-----------------------------------------
-
- if ( ! preg_match( "#\.(?:gif|jpg|jpeg|png)$#is", $FILE_NAME ) )
- {
- $this->registry->output->global_message = $this->lang->words['el_wrongformat'];
- $this->splash();
- return;
- }
-
- if ( move_uploaded_file( $_FILES[ 'FILE_UPLOAD' ]['tmp_name'], IPS_CACHE_PATH . "public/style_images/{$this->request['skin']}_" . $FILE_NAME ) )
- {
- @chmod( IPS_CACHE_PATH."public/style_images/{$this->requestt['skin']}_".$FILE_NAME, 0777 );
- }
- else
- {
- $this->registry->output->global_message = $this->lang->words['el_chmod'];
- $this->start();
- return;
- }
-
- $newlogo = "{$this->settings['public_dir']}style_images/{$this->request['skin']}_" . urlencode($FILE_NAME);
- }
-
- //-----------------------------------------
- // Update the macro..
- //-----------------------------------------
-
- $this->skinFunctions->saveReplacementFromEdit( $this->request['replacementId'], $this->request['skin'], $newlogo, 'logo_img' );
-
- //-----------------------------------------
- // Rebuild cache(s)
- //-----------------------------------------
-
- $this->skinFunctions->rebuildReplacementsCache( $this->request['skin'] );
-
- $this->registry->output->global_message = sprintf( $this->lang->words['el_log'], $this->request['skin'] );
-
- if( $this->skinFunctions->fetchErrorMessages() )
- {
- $this->registry->output->global_message .= " " . implode( " ", $this->skinFunctions->fetchErrorMessages() );
- }
-
- if( $this->skinFunctions->fetchMessages() )
- {
- $this->registry->output->global_message .= " " . implode( " ", $this->skinFunctions->fetchMessages() );
- }
-
- $this->splash();
- }
-
- /**
- * Show the form to change the logo
- *
- * @access public
- * @return void [Outputs to screen/redirects]
- */
- public function splash()
- {
- //-----------------------------------------
- // Can we upload into style_images?
- //-----------------------------------------
-
- $warning = ! is_writable( IPS_CACHE_PATH . 'public/style_images' ) ? true : false;
-
- //-----------------------------------------
- // Get header logo image
- //-----------------------------------------
-
- $replacements = $this->skinFunctions->fetchReplacements( 0 );
- $currentUrl = $replacements['logo_img']['replacement_content'];
- $currentId = $replacements['logo_img']['replacement_id'];
-
- $this->registry->output->html .= $this->html->easyLogo( $warning, $currentUrl, $currentId );
- }
-
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Easy Logo Changer
+ * Last Updated: $Date: 2010-07-16 14:28:53 -0400 (Fri, 16 Jul 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since Tuesday 17th August 2004
+ * @version $Revision: 6664 $
+ *
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+
+class admin_core_templates_easylogo extends ipsCommand
+{
+ /**
+ * HTML Skin object
+ *
+ * @access protected
+ * @var object
+ */
+ protected $html;
+
+ /**
+ * Skin Functions Class
+ *
+ * @access private
+ * @var object
+ */
+ private $skinFunctions;
+
+ /**
+ * Class entry point
+ *
+ * @access public
+ * @param object Registry reference
+ * @return void [Outputs to screen/redirects]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ //-----------------------------------------
+ // Load lang
+ //-----------------------------------------
+
+ $this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_templates' ), 'core' );
+
+ //-----------------------------------------
+ // Load skin
+ //-----------------------------------------
+
+ $this->html = $this->registry->output->loadTemplate('cp_skin_templates');
+
+ //-----------------------------------------
+ // Set up stuff
+ //-----------------------------------------
+
+ $this->form_code = $this->html->form_code = 'module=templates§ion=easylogo';
+ $this->form_code_js = $this->html->form_code_js = 'module=templates§ion=easylogo';
+
+ //-----------------------------------------
+ // 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 to do?
+ //-----------------------------------------
+
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'easy_logo' );
+
+ switch( $this->request['do'] )
+ {
+ default:
+ case 'splash':
+ $this->splash();
+ break;
+ case 'finish':
+ $this->complete();
+ break;
+ }
+
+ /* Output */
+ $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * Finish changing the logo
+ *
+ * @access public
+ * @return void [Outputs to screen/redirects]
+ */
+ public function complete()
+ {
+ //-----------------------------------------
+ // Check id
+ //-----------------------------------------
+
+ if ( ! $this->request['skin'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['el_noskinid'];
+ $this->splash();
+ return;
+ }
+
+ //-----------------------------------------
+ // Upload or new logo?
+ //-----------------------------------------
+
+ if ( $_FILES['FILE_UPLOAD']['name'] == "" or ! $_FILES['FILE_UPLOAD']['name'] or ($_FILES['FILE_UPLOAD']['name'] == "none") )
+ {
+ if ( ! $_POST['logo_url'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['el_nofile'];
+ $this->splash();
+ return;
+ }
+
+ $newlogo = $_POST['logo_url'];
+ }
+ else
+ {
+ if ( ! is_writable(DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . "/style_images" ) )
+ {
+ $this->registry->output->global_message = $this->lang->words['el_chmod'];
+ $this->splash();
+ return;
+ }
+
+ //-----------------------------------------
+ // Upload
+ //-----------------------------------------
+
+ $FILE_NAME = $_FILES['FILE_UPLOAD']['name'];
+ $FILE_SIZE = $_FILES['FILE_UPLOAD']['size'];
+ $FILE_TYPE = $_FILES['FILE_UPLOAD']['type'];
+
+ //-----------------------------------------
+ // Silly spaces
+ //-----------------------------------------
+
+ $FILE_NAME = preg_replace( "/\s+/", "_", $FILE_NAME );
+
+ //-----------------------------------------
+ // Naughty Opera adds the filename on the end of the
+ // mime type - we don't want this.
+ //-----------------------------------------
+
+ $FILE_TYPE = preg_replace( "/^(.+?);.*$/", "\\1", $FILE_TYPE );
+
+ //-----------------------------------------
+ // Correct file type?
+ //-----------------------------------------
+
+ if ( ! preg_match( "#\.(?:gif|jpg|jpeg|png)$#is", $FILE_NAME ) )
+ {
+ $this->registry->output->global_message = $this->lang->words['el_wrongformat'];
+ $this->splash();
+ return;
+ }
+
+ if ( move_uploaded_file( $_FILES[ 'FILE_UPLOAD' ]['tmp_name'], DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . "/style_images/{$this->request['skin']}_" . $FILE_NAME ) )
+ {
+ @chmod( DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . "/style_images/{$this->requestt['skin']}_".$FILE_NAME, 0777 );
+ }
+ else
+ {
+ $this->registry->output->global_message = $this->lang->words['el_chmod'];
+ $this->start();
+ return;
+ }
+
+ $newlogo = "{$this->settings['public_dir']}style_images/{$this->request['skin']}_" . urlencode($FILE_NAME);
+ }
+
+ //-----------------------------------------
+ // Update the macro..
+ //-----------------------------------------
+
+ $this->skinFunctions->saveReplacementFromEdit( $this->request['replacementId'], $this->request['skin'], $newlogo, 'logo_img' );
+
+ //-----------------------------------------
+ // Rebuild cache(s)
+ //-----------------------------------------
+
+ $this->skinFunctions->rebuildReplacementsCache( $this->request['skin'] );
+
+ $this->registry->output->global_message = sprintf( $this->lang->words['el_log'], $this->request['skin'] );
+
+ if( $this->skinFunctions->fetchErrorMessages() )
+ {
+ $this->registry->output->global_message .= " " . implode( " ", $this->skinFunctions->fetchErrorMessages() );
+ }
+
+ if( $this->skinFunctions->fetchMessages() )
+ {
+ $this->registry->output->global_message .= " " . implode( " ", $this->skinFunctions->fetchMessages() );
+ }
+
+ $this->splash();
+ }
+
+ /**
+ * Show the form to change the logo
+ *
+ * @access public
+ * @return void [Outputs to screen/redirects]
+ */
+ public function splash()
+ {
+ //-----------------------------------------
+ // Can we upload into style_images?
+ //-----------------------------------------
+
+ $warning = ! is_writable( DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_images' ) ? true : false;
+
+ //-----------------------------------------
+ // Get header logo image
+ //-----------------------------------------
+
+ $replacements = $this->skinFunctions->fetchReplacements( 0 );
+ $currentUrl = $replacements['logo_img']['replacement_content'];
+ $currentId = $replacements['logo_img']['replacement_id'];
+
+ $this->registry->output->html .= $this->html->easyLogo( $warning, $currentUrl, $currentId );
+ }
+
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/templates/importexport.php b/upload/admin/applications/core/modules_admin/templates/importexport.php
index 5c1ea690..d9efc77a 100644
--- a/upload/admin/applications/core/modules_admin/templates/importexport.php
+++ b/upload/admin/applications/core/modules_admin/templates/importexport.php
@@ -1,19 +1,21 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Import and export skin sets
- * Last Updated: $Date: 2009-08-04 11:48:28 -0400 (Tue, 04 Aug 2009) $
+ * Last Updated: $Date: 2010-09-13 17:28:12 -0400 (Mon, 13 Sep 2010) $
+ *
*
- * @author $Author: matt $
+ * @author $Author: terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Who knows...
- * @version $Revision: 4973 $
+ * @version $Revision: 6863 $
*
*/
@@ -85,7 +87,6 @@ class admin_core_templates_importexport extends ipsCommand
// Load lang
//-----------------------------------------
- # I'm so sorry Keith. I know language abstraction sucks. You deserve a medal.
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_templates' ) );
//-----------------------------------------
@@ -191,20 +192,24 @@ class admin_core_templates_importexport extends ipsCommand
$importName = trim( $this->request['importName'] );
$importLocation = trim( $this->request['importLocation'] );
$setID = intval( $this->request['setID'] );
-
+
//-----------------------------------------
// Fix up import name
//-----------------------------------------
+
+ if( ! $importName )
+ {
+ $importName = isset( $_FILES['FILE_UPLOAD']['name'] ) && $_FILES['FILE_UPLOAD']['name'] ? $_FILES['FILE_UPLOAD']['name'] : $this->request['importLocation'];
+ }
- $importName = ( $importName ) ? $importName : $_FILES['FILE_UPLOAD']['name'];
$importName = str_ireplace( array( '.xml', '.gz', 'images-' ), '', $importName );
-
+
//-----------------------------------------
// Attempt to get contents
//-----------------------------------------
$content = $this->registry->adminFunctions->importXml( $importLocation );
-
+
if ( $content )
{
$added = $this->skinFunctions->importImagesXMLArchive( $content, $importName, $setID );
@@ -236,20 +241,61 @@ class admin_core_templates_importexport extends ipsCommand
private function _importSet()
{
$importName = trim( $this->request['importName'] );
+ $importUpgrade = intval( $this->request['importUpgrade'] ) ? TRUE : FALSE;
$importLocation = trim( $this->request['importLocation'] );
$imageDir = trim( $this->request['importImgDirs'] );
+ $checkVersion = trim( $this->request['noVersionCheck'] ) ? FALSE : TRUE;
//-----------------------------------------
// Attempt to get contents
//-----------------------------------------
- $content = $this->registry->adminFunctions->importXml( $importLocation );
+ if ( $checkVersion )
+ {
+ $content = $this->registry->adminFunctions->importXml( $importLocation );
+ }
+ else
+ {
+ $_c = $this->DB->buildAndFetch( array( 'select' => 'cs_value', 'from' => 'cache_store', 'where' => 'cs_key=\'_importSkinContent_\'' ) );
+ $content = $_c['cs_value'];
+ }
if ( $content )
{
- $added = $this->skinFunctions->importSetXMLArchive( $content, 0, $imageDir, $importName );
+ /* Checking versions? */
+ if ( $checkVersion )
+ {
+ $this->DB->delete( 'cache_store', 'cs_key=\'_importSkinContent_\'' );
+
+ preg_match( "#ipbLongVersion=\"(\d+?)\"\s+?ipbHumanVersion=\"([\d\.\-\_]+?)\"#i", $content, $matches );
+
+ if ( $matches[1] and $matches[2] )
+ {
+ $_version = IPSLib::fetchVersionNumber();
+
+ /* Long version is in format of 31001 (Major Minor X X X) we'll just check majorminor */
+ $_importMajor = substr( $matches[1] , 0, 2 );
+ $_currentMajor = substr( $_version['long'], 0, 2 );
+
+ if ( $_importMajor < $_currentMajor )
+ {
+ /* Store it */
+ $this->DB->insert( 'cache_store', array( 'cs_key' => '_importSkinContent_', 'cs_value' => $content ) );
+
+ /* Generate continue link */
+ $link = $this->settings['base_url'] . '&noVersionCheck=1&' . http_build_query( $this->request );
+
+ /* Show form */
+ $this->registry->output->global_error = sprintf( $this->lang->words['ie_importfail_old_version'], $matches[2], $_version['human'], $link );
+ return $this->_showForm();
+ }
+ }
+ }
+
+ $added = $this->skinFunctions->importSetXMLArchive( $content, 0, $imageDir, $importName, $importUpgrade );
+ $message = $added['upgrade'] ? $this->lang->words['ie_set_upgraded'] : $this->lang->words['ie_set_imported'];
- $this->registry->output->global_message = sprintf( $this->lang->words['ie_set_imported'], $added['templates'], $added['replacements'], $added['css'] );
+ $this->registry->output->global_message = sprintf( $message, $added['templates'], $added['replacements'], $added['css'] );
$this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . 'module=templates§ion=importexport&do=overview' );
}
else
@@ -340,7 +386,6 @@ class admin_core_templates_importexport extends ipsCommand
$apps[] = 'forums';
$apps[] = 'members';
$apps[] = 'calendar';
- $apps[] = 'chat';
$apps[] = 'portal';
}
else if ( $v )
@@ -410,7 +455,7 @@ class admin_core_templates_importexport extends ipsCommand
if ( $_count > 1 )
{
- $name = $dir . sprintf( $this->lang->words['used_in_plus_others'], $_name['set_name'], $_count );
+ $name = $dir . sprintf( $this->lang->words['used_in_plus_others'], $_name['set_name'], $_count-1 );
}
else
{
@@ -443,12 +488,13 @@ class admin_core_templates_importexport extends ipsCommand
$form['uploadField'] = $this->registry->output->formUpload();
$form['importName'] = $this->registry->output->formInput( 'importName' , $_POST['importName'] );
+ $form['importUpgrade'] = $this->registry->output->formCheckbox( 'importUpgrade', $_POST['importUpgrade'] );
$form['importLocation'] = $this->registry->output->formInput( 'importLocation', $_POST['importLocation'] );
- $form['exportImgDirs'] = $this->registry->output->formDropdown( 'exportImgDirs', $_imageDirs );
+ $form['exportImgDirs'] = $this->registry->output->formDropdown( 'exportImgDirs', $_imageDirs, $_POST['exportImgDirs'] );
array_unshift( $_imageDirs, array( '0', $this->lang->words['ie_none'] ) );
- $form['importImgDirs'] = $this->registry->output->formDropdown( 'importImgDirs', $_imageDirs );
+ $form['importImgDirs'] = $this->registry->output->formDropdown( 'importImgDirs', $_imageDirs, $_POST['importImgDirs'] );
$form['exportSetOptions'] = $this->registry->output->formDropdown("exportSetOptions", array( 0 => array( 'current' , $this->lang->words['ie_ex_skin'] ),
1 => array( 'all' , $this->lang->words['ie_ex_skin_p'] ) ) );
@@ -510,7 +556,7 @@ class admin_core_templates_importexport extends ipsCommand
continue;
}
- $_selected = ( $skinID != NULL AND $skinID == $_data['set_id'] ) ? 'selected="selected"' : '';
+ $_selected = ( $skinID != NULL AND $skinID == $data['set_id'] ) ? 'selected="selected"' : '';
/* Ok to add... */
$output .= "\n". $depthMarkers . $data['set_name'] . " ";
diff --git a/upload/admin/applications/core/modules_admin/templates/index.html b/upload/admin/applications/core/modules_admin/templates/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/templates/index.html
+++ b/upload/admin/applications/core/modules_admin/templates/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/templates/replacements.php b/upload/admin/applications/core/modules_admin/templates/replacements.php
index 753ceb3d..6d581328 100644
--- a/upload/admin/applications/core/modules_admin/templates/replacements.php
+++ b/upload/admin/applications/core/modules_admin/templates/replacements.php
@@ -1,19 +1,21 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Macros/replacements
- * Last Updated: $Date: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Who knows...
- * @version $Revision: 3887 $
+ * @version $Revision: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_admin/templates/searchandreplace.php b/upload/admin/applications/core/modules_admin/templates/searchandreplace.php
index 084bc40b..572c4c57 100644
--- a/upload/admin/applications/core/modules_admin/templates/searchandreplace.php
+++ b/upload/admin/applications/core/modules_admin/templates/searchandreplace.php
@@ -1,19 +1,21 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Skin search and replace tool
- * Last Updated: $Date: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Who knows...
- * @version $Revision: 3887 $
+ * @version $Revision: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_admin/templates/skindiff.php b/upload/admin/applications/core/modules_admin/templates/skindiff.php
index 18c8d52d..6a4059a3 100644
--- a/upload/admin/applications/core/modules_admin/templates/skindiff.php
+++ b/upload/admin/applications/core/modules_admin/templates/skindiff.php
@@ -1,19 +1,21 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Skin diff report tools
- * Last Updated: $Date: 2009-08-07 02:24:38 -0400 (Fri, 07 Aug 2009) $
+ * Last Updated: $Date: 2010-07-22 04:20:07 -0400 (Thu, 22 Jul 2010) $
+ *
*
* @author $Author: matt $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Who knows...
- * @version $Revision: 4997 $
+ * @version $Revision: 6694 $
*
*/
@@ -125,12 +127,12 @@ class admin_core_templates_skindiff extends ipsCommand
case 'skin_diff_view_diff':
$this->skin_differences_view_diff();
break;
- case 'skin_diff_from_skin':
- $this->skin_differences_start_from_skin();
- break;
case 'removeReport':
$this->_removeReport();
break;
+ case 'multiManage':
+ $this->_multiManage();
+ break;
default:
$this->_list();
break;
@@ -140,7 +142,52 @@ class admin_core_templates_skindiff extends ipsCommand
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
$this->registry->output->sendOutput();
}
-
+
+ /**
+ * Action a report drop down
+ *
+ * @access private
+ * @return void
+ */
+ private function _multiManage()
+ {
+ $merge_id = $this->request['sessionID'] = intval( $this->request['merge_id'] );
+ $mergeOption = trim( $this->request['mergeOption'] );
+ $items = is_array( $_POST['changeIds'] ) ? IPSLib::cleanIntArray( array_keys( $_POST['changeIds'] ) ) : array();
+
+ /* Fetch session and check */
+ $session = $this->skinFunctions->fetchSession( $merge_id );
+
+ if ( $session === FALSE )
+ {
+ $this->registry->output->showError( $this->lang->words['sd_nosession'] );
+ }
+
+ /* Got items? */
+ if ( count( $items ) )
+ {
+ /* Process. I love pointless comments */
+ switch( $mergeOption )
+ {
+ case 'resolve_custom':
+ $this->skinFunctions->resolveConflict( $items, 'custom' );
+ break;
+ case 'resolve_new':
+ $this->skinFunctions->resolveConflict( $items, 'new' );
+ break;
+ case 'commit':
+ $this->skinFunctions->commit( $items );
+ break;
+ case 'revert':
+ $this->skinFunctions->revert( $items );
+ break;
+ }
+ }
+
+ /* Throw it out */
+ $this->registry->output->global_message = $this->lang->words['skindiff_okmsg'];
+ return $this->_viewReport();
+ }
/**
* Remove a report
@@ -214,7 +261,7 @@ class admin_core_templates_skindiff extends ipsCommand
$content = $this->html->skindiff_export( $session, $data['data'], $data['counts']['missing'], $data['counts']['changed'] );
- $this->registry->output->showDownload( $content, 'IPBDiff-' . IPSText::makeSeoTitle( $session['diff_session_title'] ) . '.html', "unknown/unknown", 0 );
+ $this->registry->output->showDownload( $content, 'diff-' . IPSText::makeSeoTitle( $this->skinFunctions->fetchReportTitle( $session ) ) . '.html', "unknown/unknown", 0 );
}
/**
@@ -239,7 +286,7 @@ class admin_core_templates_skindiff extends ipsCommand
// Get current session
//-----------------------------------------
- $session = $this->skinFunctions->fetchSession( $sessionID );
+ $session = $this->skinFunctions->fetchSession( $sessionID, true );
if ( $session === FALSE )
{
@@ -252,6 +299,9 @@ class admin_core_templates_skindiff extends ipsCommand
$data = $this->skinFunctions->fetchReport( $sessionID );
+ $this->registry->output->extra_nav[] = array( $this->settings['base_url'].'module=templates§ion=skindiff&do=overview', $this->lang->words['sk_skindiffreports'] );
+ $this->registry->output->extra_nav[] = array( $this->settings['base_url'].'module=templates§ion=skindiff&do=viewReport&sessionID=' . $session['merge_id'], $this->skinFunctions->fetchReportTitle( $session ) );
+
$this->registry->output->html = $this->html->skindiff_reportOverview( $session, $data['data'], $data['counts']['missing'], $data['counts']['changed'] );
}
@@ -262,20 +312,20 @@ class admin_core_templates_skindiff extends ipsCommand
* @access public
* @return void
*/
- public function skin_differences_start_from_skin()
+ public function _start()
{
//-----------------------------------------
// Init
//-----------------------------------------
$content = "";
- $skin_id = intval( $this->request['skin_id'] );
+ $setID = intval( $this->request['setID'] );
//-----------------------------------------
// Check...
//-----------------------------------------
- if ( ! $skin_id )
+ if ( ! $setID )
{
$this->registry->output->showError( $this->lang->words['sd_noid'] );
}
@@ -284,173 +334,32 @@ class admin_core_templates_skindiff extends ipsCommand
// Get skin set...
//-----------------------------------------
- $skin_set = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'skin_collections', 'where' => 'set_id='.$skin_id ) );
+ $skin_set = $this->skinFunctions->fetchSkinData( $setID );
if ( ! $skin_set['set_id'] )
{
$this->registry->output->showError( $this->lang->words['sd_noid'] );
}
- //-----------------------------------------
- // Get number template bits
- //-----------------------------------------
-
- $total_bits = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count', 'from' => 'skin_templates', 'where' => 'set_id=1' ) );
-
- //-----------------------------------------
- // Create session
- //-----------------------------------------
-
- $this->DB->insert( 'template_diff_session', array( 'diff_session_togo' => intval( $total_bits['count'] ),
- 'diff_session_done' => 0,
- 'diff_session_title' => $this->lang->words['sd_title'].$skin_set['set_name'],
- 'diff_session_updated' => time(),
- 'diff_session_ignore_missing' => 1 ) );
-
- $diff_session_id = $this->DB->getInsertId();
-
- $seen_templates = array();
-
- //-----------------------------------------
- // Grab template bits from DB
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'skin_templates', 'where' => 'set_id='.$skin_id ) );
- $outer = $this->DB->execute();
-
- while( $entry = $this->DB->fetch( $outer ) )
+ /* Create session */
+ try
{
- $check = $this->DB->buildAndFetch( array( 'select' => 'diff_key', 'from' => 'templates_diff_import', 'where' => "diff_key='".$diff_session_id.':'.$entry[ 'group_name' ].':'.$entry[ 'func_name' ]."'" ) );
-
- if( $this->DB->getTotalRows() == 0 )
- {
- $this->DB->insert( 'templates_diff_import', array( 'diff_key' => $diff_session_id.':'.$entry[ 'group_name' ].':'.$entry[ 'func_name' ],
- 'diff_func_group' => $entry[ 'group_name' ],
- 'diff_func_data' => $entry[ 'func_data' ],
- 'diff_func_name' => $entry[ 'func_name' ],
- 'diff_func_content' => $entry[ 'section_content' ],
- 'diff_session_id' => $diff_session_id ) );
- $seen_templates[ $entry[ 'group_name' ].':'.$entry[ 'func_name' ] ] = $entry['updated'];
- }
- else
- {
- if( $seen_templates[ $entry[ 'group_name' ].':'.$entry[ 'func_name' ] ] < $entry['updated'] )
- {
- $this->DB->update( 'templates_diff_import', array( 'diff_func_group' => $entry[ 'group_name' ],
- 'diff_func_data' => $entry[ 'func_data' ],
- 'diff_func_name' => $entry[ 'func_name' ],
- 'diff_func_content' => $entry[ 'section_content' ],
- 'diff_session_id' => $diff_session_id ), "diff_key='" . $diff_session_id.':'.$entry[ 'group_name' ].':'.$entry[ 'func_name' ] . "'" );
- }
- }
+ $sessionId = $this->skinFunctions->createSession( $setID );
+ }
+ catch( Exception $e )
+ {
+ $this->registry->output->showError( $this->lang->words['sd_exception'] );
}
- $this->registry->output->redirectinit( $this->settings['base_url'].'&'.$this->form_code_js."&do=skin_diff_process&diff_session_id={$diff_session_id}&pergo=10&secure_key=" . $this->member->form_hash );
+ /* Get count */
+ $session = $this->skinFunctions->fetchSession( $sessionId );
+
+ $items = intval( $session['merge_templates_togo'] ) + intval( $session['merge_css_togo'] );
+
+ $this->registry->output->html = $this->html->skindiff_ajaxScreen( $sessionId, $items, $this->_bitsPerRound );
}
- /**
- * Initiate a skin diff session
- *
- * @access private
- * @return void
- */
- private function _start()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $content = "";
- $seen = array();
- $diff_session_title = $this->request['diff_session_title'];
- $ignoreMissing = ( $this->request['diff_session_ignore_missing'] ) ? TRUE : FALSE;
- $diffFolder = trim( $this->request['diffFolder'] );
-
- //-----------------------------------------
- // Check...
- //-----------------------------------------
-
- if ( ! $diff_session_title )
- {
- $this->registry->output->global_error = $this->lang->words['sd_entertitle'];
- return $this->_list();
- }
-
- if ( $diffFolder )
- {
- $files = array();
- $content = '';
-
- /* Did we specify a folder? */
- if ( ! is_dir( DOC_IPS_ROOT_PATH . $diffFolder ) )
- {
- $this->registry->output->global_error = sprintf( $this->lang->words['diff_folder_error'], DOC_IPS_ROOT_PATH . $diffFolder );
- return $this->_list();
- }
-
- try
- {
- foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . $diffFolder ) as $file )
- {
- if ( ! $file->isDot() AND ! $file->isDir() )
- {
- $_name = $file->getFileName();
-
- if ( substr( $_name, -4 ) == '.xml' )
- {
- $files[ $_name ] = @file_get_contents( DOC_IPS_ROOT_PATH . $diffFolder . '/' . $_name );
- }
- }
- }
- } catch ( Exception $e ) {}
-
- if ( count( $files ) )
- {
- foreach( $files as $name => $xml )
- {
- if ( ! $content )
- {
- $content = $xml;
- }
- else
- {
- preg_match( "#]+?)?>.* #is", $xml, $match );
-
- if ( $match[0] )
- {
- $content = str_replace( '', $match[0] . "\n", $content );
- }
- }
- }
- }
- }
- else
- {
- /* fetch the upload then */
- $content = $this->registry->adminFunctions->importXml();
- }
-
- if ( ! $content )
- {
- $this->registry->output->global_error = $this->lang->words['sd_nocontent'];
- return $this->_list();
- }
- //-----------------------------------------
- // Create session...
- //-----------------------------------------
-
- $diffSessionID = $this->skinFunctions->createSession( $diff_session_title, $content );
-
- if ( $diffSessionID === FALSE )
- {
- $this->registry->output->global_error = $this->lang->words['sd_nocontent'];
- return $this->_list();
- }
-
- $this->registry->output->html = $this->html->skindiff_ajaxScreen( $diffSessionID, $this->skinFunctions->fetchNumberTemplateBits(), $this->_bitsPerRound );
- }
-
/**
* List all current difference 'sets'
*
@@ -463,7 +372,7 @@ class admin_core_templates_skindiff extends ipsCommand
// Do it
//-----------------------------------------
- $this->registry->output->html = $this->html->skindiff_overview( $this->skinFunctions->fetchSessions() );
+ $this->registry->output->html = $this->html->skindiff_overview( $this->skinFunctions->fetchSessions(), $this->skinFunctions->getTiersFunction()->fetchAllsItemDropDown(), $this->skinFunctions->canUseMergeSystem() );
}
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/templates/skinsets.php b/upload/admin/applications/core/modules_admin/templates/skinsets.php
index 69ce0e94..4fa5367d 100644
--- a/upload/admin/applications/core/modules_admin/templates/skinsets.php
+++ b/upload/admin/applications/core/modules_admin/templates/skinsets.php
@@ -1,19 +1,21 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Skin set management
- * Last Updated: $Date: 2009-09-24 04:15:52 -0400 (Thu, 24 Sep 2009) $
+ * Last Updated: $Date: 2010-10-19 10:40:05 -0400 (Tue, 19 Oct 2010) $
+ *
*
- * @author $Author: matt $
+ * @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Who knows...
- * @version $Revision: 5145 $
+ * @version $Revision: 6995 $
*
*/
@@ -28,7 +30,6 @@ class admin_core_templates_skinsets extends ipsCommand
/**
* Skin Functions Class
*
- * @access private
* @var object
*/
private $skinFunctions;
@@ -36,7 +37,6 @@ class admin_core_templates_skinsets extends ipsCommand
/**
* Recursive depth guide
*
- * @access private
* @var array
*/
private $_depthGuide = array();
@@ -44,7 +44,6 @@ class admin_core_templates_skinsets extends ipsCommand
/**
* Skin object
*
- * @access private
* @var object Skin templates
*/
private $html;
@@ -52,7 +51,6 @@ class admin_core_templates_skinsets extends ipsCommand
/**#@+
* URL bits
*
- * @access public
* @var string
*/
public $form_code = '';
@@ -62,7 +60,6 @@ class admin_core_templates_skinsets extends ipsCommand
/**
* Main class entry point
*
- * @access public
* @param object ipsRegistry reference
* @return void [Outputs to screen]
*/
@@ -155,6 +152,10 @@ class admin_core_templates_skinsets extends ipsCommand
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'settemplates_manage' );
$this->_toggleHidden();
break;
+ case 'reorder':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'settemplates_manage' );
+ $this->reorder();
+ break;
}
/* Output */
@@ -162,10 +163,54 @@ class admin_core_templates_skinsets extends ipsCommand
$this->registry->output->sendOutput();
}
+ /**
+ * AJAX Action: Reorder Skin Sets
+ */
+ private function reorder()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
+ $ajax = new $classToLoad();
+
+ //-----------------------------------------
+ // Checks...
+ //-----------------------------------------
+
+ if( $this->registry->adminFunctions->checkSecurityKey( $this->request['md5check'], true ) === false )
+ {
+ $ajax->returnString( $this->lang->words['postform_badmd5'] );
+ exit();
+ }
+
+ //-----------------------------------------
+ // Save new position
+ //-----------------------------------------
+
+ $position = 1;
+
+ if( is_array($this->request['skin_sets']) AND count($this->request['skin_sets']) )
+ {
+ foreach( $this->request['skin_sets'] as $this_id )
+ {
+ $this->DB->update( 'skin_collections', array( 'set_order' => $position ), 'set_id=' . $this_id );
+
+ $position++;
+ }
+ }
+
+ $this->skinFunctions->rebuildSkinSetsCache();
+
+ $ajax->returnString( 'OK' );
+ exit();
+
+ }
+
/**
* Toggle a skin set's hidden status
*
- * @access private
* @return string HTML
*/
private function _toggleHidden()
@@ -186,7 +231,6 @@ class admin_core_templates_skinsets extends ipsCommand
/**
* Make a skin set default for output engine
*
- * @access private
* @return string HTML
*/
private function _makeDefault()
@@ -210,7 +254,6 @@ class admin_core_templates_skinsets extends ipsCommand
/**
* Remove customizations from a skin set
*
- * @access private
* @return string HTML
*/
private function _setRevert()
@@ -238,7 +281,6 @@ class admin_core_templates_skinsets extends ipsCommand
/**
* Show revert splash screen
*
- * @access private
* @return string HTML
*/
private function _revertSplash()
@@ -257,7 +299,6 @@ class admin_core_templates_skinsets extends ipsCommand
/**
* Write out skin CSS in master format
*
- * @access private
* @return string HTML
*/
private function _setWriteMasterCss()
@@ -275,7 +316,7 @@ class admin_core_templates_skinsets extends ipsCommand
}
catch( Exception $error )
{
- $this->registry->output->global_error = 'Error' . $error->getMessage();
+ $this->registry->output->global_error = $this->lang->words['sk_error'] . $error->getMessage();
return $this->_listSets();
}
@@ -286,7 +327,6 @@ class admin_core_templates_skinsets extends ipsCommand
/**
* Write out a skin set in master format
*
- * @access private
* @return string HTML
*/
private function _setWriteMaster()
@@ -304,7 +344,7 @@ class admin_core_templates_skinsets extends ipsCommand
}
catch( Exception $error )
{
- $this->registry->output->global_error = 'Error' . $error->getMessage();
+ $this->registry->output->global_error = $this->lang->words['sk_error'] . $error->getMessage();
return $this->_listSets();
}
@@ -315,7 +355,6 @@ class admin_core_templates_skinsets extends ipsCommand
/**
* Remove Skin Set
*
- * @access private
* @return string HTML
*/
private function _setRemove()
@@ -347,7 +386,6 @@ class admin_core_templates_skinsets extends ipsCommand
/**
* Remove splash
*
- * @access private
* @return void
*/
private function _setRemoveSplash()
@@ -367,7 +405,6 @@ class admin_core_templates_skinsets extends ipsCommand
/**
* Form: Save
*
- * @access private
* @param string Type of form to show (add/edit)
* @return void
*/
@@ -468,6 +505,21 @@ class admin_core_templates_skinsets extends ipsCommand
}
}
+ /* test to ensure we're not re-using an existing skin set key */
+ if ( $set_key )
+ {
+ $test = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'skin_collections',
+ 'where' => 'set_key=\'' . $set_key . '\' AND set_id != ' . $set_id ) );
+
+ if ( $test['set_id'] )
+ {
+ $this->registry->getClass('output')->global_message = $this->lang->words['ss_keynogoodyo'];
+ $this->_setForm( $type );
+ return;
+ }
+ }
+
//-----------------------------------------
// Build Save Array
//-----------------------------------------
@@ -485,6 +537,7 @@ class admin_core_templates_skinsets extends ipsCommand
'set_output_format' => $set_output_format,
'set_hide_from_list'=> ( $set_is_default ) ? 0 : $set_hide_from_list,
'set_minify' => $set_minify,
+ 'set_master_key' => ( isset( $skinSet['set_master_key'] ) ) ? $skinSet['set_master_key'] : ( ( $set_output_format == 'xml' ) ? 'xmlskin' : 'root' ),
'set_updated' => time() );
@@ -497,6 +550,10 @@ class admin_core_templates_skinsets extends ipsCommand
/* Add elements into the array */
$save['set_added'] = time();
+ /* Add position */
+ $curPos = $this->skinFunctions->fetchHighestSetPosition();
+ $save['set_order'] = (int)$curPos++;
+
$this->DB->insert( 'skin_collections', $save );
$set_id = $this->DB->getInsertId();
}
@@ -513,15 +570,27 @@ class admin_core_templates_skinsets extends ipsCommand
$messages = array();
$errors = array();
+
+ /* Caches need to be rebuilt first, so that the parent tree is setup. Bug #21008 */
+ $this->skinFunctions->rebuildSkinSetsCache();
+ $messages = array_merge( $messages, $this->skinFunctions->fetchMessages( TRUE ) );
+ $errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
+
+ /* Did we move this back into root? */
+ if ( $set_parent_id != $skinSet['set_parent_id'] )
+ {
+ if ( ! $set_parent_id && $set_key != 'mobile' && $skinSet['set_master_key'] != 'root' )
+ {
+ $this->DB->update( 'skin_collections', array( 'set_master_key' => 'root' ), 'set_id = ' . $set_id );
+ }
+ }
+
+ /* Rebuild tree info */
+ $this->skinFunctions->rebuildTreeInformation( $set_id );
+
/* Flush the data */
$this->skinFunctions->flushSkinData();
- //-----------------------------------------
- // Rebuild tree info
- //-----------------------------------------
-
- $this->skinFunctions->rebuildTreeInformation( $set_id );
-
//-----------------------------------------
// Rebuild Caches
//-----------------------------------------
@@ -538,10 +607,6 @@ class admin_core_templates_skinsets extends ipsCommand
$messages = array_merge( $messages, $this->skinFunctions->fetchMessages( TRUE ) );
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
- $this->skinFunctions->rebuildSkinSetsCache();
- $messages = array_merge( $messages, $this->skinFunctions->fetchMessages( TRUE ) );
- $errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
-
//-----------------------------------------
// Done...
//-----------------------------------------
@@ -554,7 +619,6 @@ class admin_core_templates_skinsets extends ipsCommand
/**
* Form
*
- * @access private
* @param string Type of form to show (add/edit)
* @return void
*/
@@ -697,7 +761,6 @@ class admin_core_templates_skinsets extends ipsCommand
/**
* List template sets
*
- * @access private
* @return void
*/
private function _listSets()
@@ -709,6 +772,8 @@ class admin_core_templates_skinsets extends ipsCommand
$root_id = 'root';
$sets = array();
$cacheData = array();
+ $hasData = array();
+ $canMerge = $this->skinFunctions->canUseMergeSystem();
//-----------------------------------------
// See if we have any cached data
@@ -724,6 +789,38 @@ class admin_core_templates_skinsets extends ipsCommand
$cacheData[ $row['cache_set_id'] ]['db']++;
}
+ //-----------------------------------------
+ // See if we have any customized data
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => 'template_set_id',
+ 'from' => 'skin_templates',
+ 'group' => 'template_set_id' ) );
+
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ if ( ! $this->skinFunctions->remapData['templates'][ $row['template_set_id'] ] )
+ {
+ $hasData[ $row['template_set_id'] ]['templates'] = 1;
+ }
+ }
+
+ $this->DB->build( array( 'select' => 'css_set_id',
+ 'from' => 'skin_css',
+ 'group' => 'css_set_id' ) );
+
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ if ( ! $this->skinFunctions->remapData['css'][ $row['css_set_id'] ] )
+ {
+ $hasData[ $row['css_set_id'] ]['css'] = 1;
+ }
+ }
+
//-----------------------------------------
// Recurse through and gather data
//-----------------------------------------
@@ -743,7 +840,7 @@ class admin_core_templates_skinsets extends ipsCommand
foreach( $sets as $setID => $setData )
{
- if ( @is_dir( IPS_CACHE_PATH . 'skin_cache/cacheid_'.$setID ) )
+ if ( @is_dir( IPS_CACHE_PATH . 'cache/skin_cache/cacheid_'.$setID ) )
{
$cacheData[ $setID ]['php'] = 1;
}
@@ -753,13 +850,12 @@ class admin_core_templates_skinsets extends ipsCommand
// Print it...
//-----------------------------------------
- $this->registry->output->html .= $this->html->skinsets_listSkinSets( $sets, $cacheData );
+ $this->registry->output->html .= $this->html->skinsets_listSkinSets( $sets, $cacheData, $hasData, $canMerge );
}
/**
* Recursive list sets function
*
- * @access private
* @param int Root ID to drill down from
* @param array Array of skin set entries
* @param int Depth gauge count
@@ -784,7 +880,6 @@ class admin_core_templates_skinsets extends ipsCommand
/**
* Format the data
*
- * @access private
* @param array Skin set entry
* @param int Depth gauge count
* @return array Modified skin set entry
@@ -799,9 +894,9 @@ class admin_core_templates_skinsets extends ipsCommand
$set_data['_set_added'] = gmstrftime( '%c', $set_data['set_added'] );
/* @see http://forums.invisionpower.com/tracker/issue-18012-warnings-in-acp-302/ */
- $this->skinFunctions->remapData['export'] = is_array($this->skinFunctions->remapData['export']) ? $this->skinFunctions->remapData['export'] : array();
+ $this->skinFunctions->remapData['masterKeys'] = is_array($this->skinFunctions->remapData['masterKeys']) ? $this->skinFunctions->remapData['masterKeys'] : array();
- $set_data['_canRemove'] = ( ! $set_data['set_is_default'] AND ( ! in_array( $set_data['set_id'], array_values( $this->skinFunctions->remapData['export'] ) ) ) ) ? 1 : 0;
+ $set_data['_canRemove'] = ( ! $set_data['set_is_default'] AND ( ! in_array( $set_data['set_key'], $this->skinFunctions->remapData['masterKeys'] ) ) ) ? 1 : 0;
$set_data['_setImg'] = ( $set_data['set_parent_id'] > 0 ) ? 'package.png' : 'folder_palette.png';
$set_data['_cssClass'] = ( $set_data['set_parent_id'] > 0 ) ? 'tablerow2' : 'tablerow1';
@@ -834,4 +929,4 @@ class admin_core_templates_skinsets extends ipsCommand
return $set_data;
}
-}
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/templates/templates.php b/upload/admin/applications/core/modules_admin/templates/templates.php
index d25abbe1..1f42a9e9 100644
--- a/upload/admin/applications/core/modules_admin/templates/templates.php
+++ b/upload/admin/applications/core/modules_admin/templates/templates.php
@@ -1,19 +1,21 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Template editing
- * Last Updated: $Date: 2009-05-06 11:58:19 -0400 (Wed, 06 May 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
- * @author $Author: matt $
+ * @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Who knows...
- * @version $Revision: 4610 $
+ * @version $Revision: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_admin/templates/tools.php b/upload/admin/applications/core/modules_admin/templates/tools.php
index 85d9350c..5b43823e 100644
--- a/upload/admin/applications/core/modules_admin/templates/tools.php
+++ b/upload/admin/applications/core/modules_admin/templates/tools.php
@@ -1,19 +1,21 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Skin tools
- * Last Updated: $Date: 2009-10-08 17:24:06 -0400 (Thu, 08 Oct 2009) $
+ * Last Updated: $Date: 2010-10-11 20:21:22 -0400 (Mon, 11 Oct 2010) $
+ *
*
- * @author $Author: josh $
+ * @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Who knows...
- * @version $Revision: 5216 $
+ * @version $Revision: 6962 $
*
*/
@@ -28,7 +30,6 @@ class admin_core_templates_tools extends ipsCommand
/**
* Skin Functions Class
*
- * @access private
* @var object
*/
private $skinFunctions;
@@ -36,7 +37,6 @@ class admin_core_templates_tools extends ipsCommand
/**
* Skin object
*
- * @access private
* @var object Skin templates
*/
private $html;
@@ -44,7 +44,6 @@ class admin_core_templates_tools extends ipsCommand
/**#@+
* URL bits
*
- * @access public
* @var string
*/
public $form_code = '';
@@ -54,7 +53,6 @@ class admin_core_templates_tools extends ipsCommand
/**
* Main executable function
*
- * @access public
* @param object IPS Registry Object
*/
public function doExecute( ipsRegistry $registry )
@@ -89,7 +87,7 @@ class admin_core_templates_tools extends ipsCommand
$this->skinFunctions = new skinImportExport( $registry );
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'template_tools' );
-
+
switch( $this->request['do'] )
{
case 'rebuildPHPTemplates':
@@ -161,9 +159,8 @@ class admin_core_templates_tools extends ipsCommand
/**
* Cleans out CSS DB
*
- * @access public
* @return void
- */
+ */
public function _toolCacheClean()
{
/* INIT */
@@ -189,9 +186,8 @@ class admin_core_templates_tools extends ipsCommand
/**
* Cleans out CSS DB
*
- * @access public
* @return void
- */
+ */
public function _cssDbClean()
{
$affected = $this->skinFunctions->cleanDbCss();
@@ -202,9 +198,8 @@ class admin_core_templates_tools extends ipsCommand
/**
* Cleans out template DB
*
- * @access public
* @return void
- */
+ */
public function _templateDbClean()
{
$affected = $this->skinFunctions->cleanDbTemplates();
@@ -215,9 +210,8 @@ class admin_core_templates_tools extends ipsCommand
/**
* Creates the master skin
*
- * @access public
* @return void
- */
+ */
public function _createMasterSkin()
{
/* No dir? create */
@@ -229,20 +223,19 @@ class admin_core_templates_tools extends ipsCommand
}
else
{
- $this->registry->output->global_error = "Could not create directory: " . IPS_CACHE_PATH . 'cache/skin_cache/master_skin please create it via FTP and run the tool again';
+ $this->registry->output->global_error = sprintf( $this->lang->words['cannotcreatemasterdir'], IPS_CACHE_PATH );
return $this->_splash();
}
}
$messages = $this->skinFunctions->writeMasterSkin( 0, 'master_skin' );
- $this->registry->output->html .= $this->html->tools_toolResults( 'master_skin Directory Creation Results', $messages );
+ $this->registry->output->html .= $this->html->tools_toolResults( $this->lang->words['masterdircreatetitle'], $messages );
}
/**
* Rebuild everything for a release
*
- * @access private
* @return void
*/
private function _rebuildForRelease()
@@ -274,25 +267,25 @@ class admin_core_templates_tools extends ipsCommand
foreach( $skinIDs as $id )
{
$msg = $this->skinFunctions->rebuildMasterCSS( $id );
- $messages[] = "CSS Rebuilt for $id ";
+ $messages[] = "" . sprintf( $this->lang->words['cssrebuilt_for'], $id ) . " ";
$messages = array_merge( $messages, $msg, $this->skinFunctions->fetchMessages( TRUE ) );
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
$msg = $this->skinFunctions->rebuildMasterFromPHP( $id );
- $messages[] = "HTML Rebuilt for $id ";
+ $messages[] = "" . sprintf( $this->lang->words['htmlrebuilt_for'], $id ) . " ";
$messages = array_merge( $messages, $msg, $this->skinFunctions->fetchMessages( TRUE ) );
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
+
+ $msg = $this->skinFunctions->rebuildMasterReplacements( $id );
+ $messages[] = "Replacements Rebuilt for $id ";
+ $messages = array_merge( $messages, (array)$msg, $this->skinFunctions->fetchMessages( TRUE ) );
+ $errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
}
- $this->skinFunctions->rebuildMasterReplacements();
- $messages[] = "Replacements Rebuilt ";
- $messages = array_merge( $messages, $this->skinFunctions->fetchMessages( TRUE ) );
- $errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
-
/* Got any errors? */
if ( count( $errors ) )
{
- $this->registry->output->html .= $this->html->tools_toolResults( $this->lang->words['to_resultrebuild'] . ' ABORTED', $messages, $errors );
+ $this->registry->output->html .= $this->html->tools_toolResults( $this->lang->words['to_resultrebuild'] . $this->lang->words['aborted_suffix'], $messages, $errors );
return;
}
@@ -312,51 +305,54 @@ class admin_core_templates_tools extends ipsCommand
if ( $id > 0 )
{
$this->skinFunctions->rebuildPHPTemplates( $id );
- $messages[] = "PHP Templates Recached for $key ";
+ $messages[] = "" . sprintf( $this->lang->words['templatesrecached_for'], $key ) . " ";
$messages = array_merge( $messages, $this->skinFunctions->fetchMessages( TRUE ) );
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
$this->skinFunctions->rebuildCSS( $id );
- $messages[] = "CSS Recached for $key ";
+ $messages[] = "" . sprintf( $this->lang->words['cssrecached_for'], $key ) . " ";
+ $messages = array_merge( $messages, $this->skinFunctions->fetchMessages( TRUE ) );
+ $errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
+
+ $this->skinFunctions->rebuildReplacementsCache( $id );
+ $messages[] = "{$this->lang->words['to_replacerecached']} $key";
$messages = array_merge( $messages, $this->skinFunctions->fetchMessages( TRUE ) );
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
}
- $this->skinFunctions->rebuildReplacementsCache( $id );
- $messages[] = "{$this->lang->words['to_replacerecached']} $key";
- $messages = array_merge( $messages, $this->skinFunctions->fetchMessages( TRUE ) );
- $errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
-
/* Build and write XML files for replacements and CSS */
- $replacementsXML = $this->skinFunctions->generateReplacementsXML( $id, $_thisOnly );
+ $replacementsXML = $this->skinFunctions->generateReplacementsXML( $id, FALSE );
@unlink( DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/resources/skins/replacements_' . $key . '.xml', $replacementsXML );
- if ( ! @file_put_contents( DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/resources/skins/replacements_' . $key . '.xml', $replacementsXML ) )
+ if ( $replacementsXML )
{
- $errors[] = "{$this->lang->words['to_couldnotwrite']}: " . DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/resources/skins/replacements_' . $key . '.xml';
- }
- else
- {
- $messages[] = "{$this->lang->words['to_wrote']} " . DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/resources/skins/replacements_' . $key . '.xml';
+ if ( ! @file_put_contents( DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/resources/skins/replacements_' . $key . '.xml', $replacementsXML ) )
+ {
+ $errors[] = "{$this->lang->words['to_couldnotwrite']}: " . DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/resources/skins/replacements_' . $key . '.xml';
+ }
+ else
+ {
+ $messages[] = "{$this->lang->words['to_wrote']} " . DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/resources/skins/replacements_' . $key . '.xml';
+ }
}
/* Export all CSS - Function loops through all skin sets */
$this->skinFunctions->exportAllAppCSS( $id );
- $messages[] = "App CSS Written For $key ";
+ $messages[] = "" . sprintf( $this->lang->words['appcssrecachedfor'], $key ) . " ";
$messages = array_merge( $messages, $this->skinFunctions->fetchMessages( TRUE ) );
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
/* Export all CSS - Function loops through all skin sets */
$this->skinFunctions->exportAllAppTemplates( $id );
- $messages[] = "App XML Written For $key ";
+ $messages[] = "" . sprintf( $this->lang->words['appxmlrecachedfor'], $key ) . " ";
$messages = array_merge( $messages, $this->skinFunctions->fetchMessages( TRUE ) );
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
/* Got any errors? */
if ( count( $errors ) )
{
- $this->registry->output->html .= $this->html->tools_toolResults( $this->lang->words['to_resultrebuild'] . ' ABORTED', array(), $errors );
+ $this->registry->output->html .= $this->html->tools_toolResults( $this->lang->words['to_resultrebuild'] . $this->lang->words['aborted_suffix'], array(), $errors );
return;
}
}
@@ -387,7 +383,6 @@ class admin_core_templates_tools extends ipsCommand
/**
* Rebuilds master CSS
*
- * @access private
* @param int [Set ID to import, default is all]
* @return string HTML
*/
@@ -410,7 +405,7 @@ class admin_core_templates_tools extends ipsCommand
}
$msg = $this->skinFunctions->rebuildMasterCSS( $id );
- $messages[] = "CSS Rebuilt for $id ";
+ $messages[] = "" . sprintf( $this->lang->words['cssrebuilt_for'], $id ) . " ";
$messages = array_merge( $messages, $msg, $this->skinFunctions->fetchMessages( TRUE ) );
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
}
@@ -425,29 +420,36 @@ class admin_core_templates_tools extends ipsCommand
/**
* Rebuilds master replacements
*
- * @access private
* @return string HTML
*/
private function _inDevMasterReplacements()
{
+ $skinIDs = array_keys( $this->skinFunctions->remapData['templates'] );
+ $messages = array();
+ $errors = array();
+
//-----------------------------------------
- // Do it...
+ // Rebuild stuff
//-----------------------------------------
- $this->skinFunctions->rebuildMasterReplacements();
+ foreach( $skinIDs as $id )
+ {
+ $msg = $this->skinFunctions->rebuildMasterReplacements( $id );
+ $messages[] = "" . sprintf( $this->lang->words['reprebuilt_for'], $id ) . " ";
+ $messages = array_merge( $messages, (array)$msg, $this->skinFunctions->fetchMessages( TRUE ) );
+ $errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
+ }
//-----------------------------------------
// Show it...
//-----------------------------------------
- $this->registry->output->global_message = $this->lang->words['to_masterreplace'];
- return $this->_splash();
+ $this->registry->output->html .= $this->html->tools_toolResults( $this->lang->words['to_resultrebuild'], $messages, $errors );
}
/**
* Imports all APP templates
*
- * @access private
* @return void
*/
private function _importAPPTemplates()
@@ -468,7 +470,6 @@ class admin_core_templates_tools extends ipsCommand
/**
* Exports all APP templates
*
- * @access private
* @return void
*/
private function _exportAPPTemplates()
@@ -489,7 +490,6 @@ class admin_core_templates_tools extends ipsCommand
/**
* Exports all APP templates
*
- * @access private
* @return void
*/
private function _exportAPPCSS()
@@ -510,7 +510,6 @@ class admin_core_templates_tools extends ipsCommand
/**
* Exports Replacements to XML
*
- * @access private
* @return void
*/
private function _exportReplacements()
@@ -536,12 +535,12 @@ class admin_core_templates_tools extends ipsCommand
$key = $setData['set_key'];
$this->skinFunctions->rebuildReplacementsCache( $id );
- $messages[] = "{$this->lang->words['to_replacerecached']} $key";
+ $messages[] = "{$this->lang->words['to_replacerecached']} {$key}";
$messages = array_merge( $messages, $this->skinFunctions->fetchMessages( TRUE ) );
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
/* Build and write XML files for replacements and CSS */
- $replacementsXML = $this->skinFunctions->generateReplacementsXML( $id, $_thisOnly );
+ $replacementsXML = $this->skinFunctions->generateReplacementsXML( $id, FALSE );
@unlink( DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/resources/skins/replacements_' . $key . '.xml', $replacementsXML );
@@ -557,7 +556,7 @@ class admin_core_templates_tools extends ipsCommand
/* Got any errors? */
if ( count( $errors ) )
{
- $this->registry->output->html .= $this->html->tools_toolResults( $this->lang->words['to_resultrebuild'] . ' ABORTED', array(), $errors );
+ $this->registry->output->html .= $this->html->tools_toolResults( $this->lang->words['to_resultrebuild'] . $this->lang->words['aborted_suffix'], array(), $errors );
return;
}
}
@@ -574,7 +573,6 @@ class admin_core_templates_tools extends ipsCommand
/**
* Rebuild PHP Templates Cache
*
- * @access private
* @return void
*/
private function _rebuildMasterSkin()
@@ -587,7 +585,7 @@ class admin_core_templates_tools extends ipsCommand
if( $this->skinFunctions->remapData['templates'][ $this->request['set_id'] ] )
{
$msg = $this->skinFunctions->rebuildMasterFromPHP( $this->request['set_id'] );
- $messages[] = "HTML Rebuilt for {$this->request['set_id']} ";
+ $messages[] = "" . sprintf( $this->lang->words['htmlrebuilt_for'], $this->request['set_id'] ) . " ";
$messages = array_merge( $messages, $msg, $this->skinFunctions->fetchMessages( TRUE ) );
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
}
@@ -596,7 +594,7 @@ class admin_core_templates_tools extends ipsCommand
{
/* This is which skins we want to export for default installations */
$skinIDs = array_values( $this->skinFunctions->remapData['export'] );
-
+
//-----------------------------------------
// Do it...
//-----------------------------------------
@@ -604,7 +602,7 @@ class admin_core_templates_tools extends ipsCommand
foreach( $skinIDs as $id )
{
$msg = $this->skinFunctions->rebuildMasterFromPHP( $id );
- $messages[] = "HTML Rebuilt for {$id} ";
+ $messages[] = "" . sprintf( $this->lang->words['htmlrebuilt_for'], $id ) . " ";
$messages = array_merge( $messages, $msg, $this->skinFunctions->fetchMessages( TRUE ) );
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
}
@@ -620,7 +618,6 @@ class admin_core_templates_tools extends ipsCommand
/**
* Resets skin usage
*
- * @access private
* @return string HTML
*/
private function _resetSkin()
@@ -641,7 +638,7 @@ class admin_core_templates_tools extends ipsCommand
if ( is_array( $_POST['setID'] ) )
{
- $usingIDs = implode( ",", array_keys( $_POST['setID'] ) );
+ $usingIDs = implode( ",", $_POST['setID'] );
if ( $resetMembers )
{
@@ -663,7 +660,6 @@ class admin_core_templates_tools extends ipsCommand
/**
* Rebuild Master data
*
- * @access private
* @return string HTML
*/
private function _rebuildMaster()
@@ -677,6 +673,7 @@ class admin_core_templates_tools extends ipsCommand
$rebuildCSS = intval( $this->request['rebuildCSS'] );
$rebuildReplacements = intval( $this->request['rebuildReplacements'] );
$messages = array();
+ $masterKeys = $this->skinFunctions->fetchMasterKeys();
//-----------------------------------------
// Figure out app data
@@ -691,7 +688,7 @@ class admin_core_templates_tools extends ipsCommand
//-----------------------------------------
// Do it!
//-----------------------------------------
-
+
foreach( $_POST['apps'] as $app_dir => $data )
{
if ( $data )
@@ -701,7 +698,7 @@ class admin_core_templates_tools extends ipsCommand
/* HTML */
if ( $rebuildHTML )
{
- foreach( array( 'root', 'lofi', 'xmlskin' ) as $setKey )
+ foreach( $masterKeys as $setKey )
{
$return = $this->skinFunctions->importTemplateAppXML( $app_dir, $setKey );
$messages[] = $_appTitle . sprintf( $this->lang->words['to_masterhtml'], $setKey, $return['updateCount'], $return['insertCount'] );
@@ -712,14 +709,17 @@ class admin_core_templates_tools extends ipsCommand
/* Replacements */
if ( $rebuildReplacements )
{
- $this->skinFunctions->rebuildMasterReplacements();
- $messages[] = $this->lang->words['to_masterreplace'];
+ foreach( $masterKeys as $setKey )
+ {
+ $this->skinFunctions->rebuildMasterReplacements( $setKey );
+ $messages[] = $this->lang->words['to_masterreplace'];
+ }
}
/* CSS */
if ( $rebuildCSS )
{
- foreach( array( 'root', 'lofi', 'xmlskin' ) as $setKey )
+ foreach( $masterKeys as $setKey )
{
$return = $this->skinFunctions->importCSSAppXML( $app_dir, $setKey );
$messages[] = $_appTitle . sprintf( $this->lang->words['to_mastercssrebuilt'], $setKey, $return['updateCount'], $return['insertCount'] );
@@ -733,7 +733,6 @@ class admin_core_templates_tools extends ipsCommand
/**
* Rebuild PHP Templates Cache
*
- * @access private
* @return void
*/
private function _recache()
@@ -851,7 +850,6 @@ class admin_core_templates_tools extends ipsCommand
/**
* Rebuild PHP Templates Cache
*
- * @access private
* @return void
*/
private function _rebuildPHPTemplates()
@@ -884,7 +882,6 @@ class admin_core_templates_tools extends ipsCommand
/**
* Shows a list of available tools
*
- * @access public
* @return void
*/
public function _splash()
@@ -898,7 +895,7 @@ class admin_core_templates_tools extends ipsCommand
foreach( ipsRegistry::$applications as $app_dir => $data )
{
$data['lastmTime'] = @filemtime( IPSLib::getAppDir( $app_dir ) . '/xml/' . $app_dir . '_root_templates.xml' );
- $data['lastmTimeFormatted'] = $this->registry->getClass( 'class_localization')->getDate( $data['lastmTime'], 'JOINED' );
+ $data['lastmTimeFormatted'] = $this->registry->getClass('class_localization')->getDate( $data['lastmTime'], 'JOINED' );
$appsData[ $app_dir ] = $data;
}
@@ -909,7 +906,7 @@ class admin_core_templates_tools extends ipsCommand
$this->registry->output->html .= $this->html->tools_splash( $this->skinFunctions->getTiersFunction()->fetchAllsItemDropDown(), $appsData, $this->skinFunctions->remapData );
- $this->registry->output->nav[] = array( "" . $this->settings['base_url'] . "{$this->form_code}", $this->lang->words['to_remplatetools'] );
+ $this->registry->output->nav[] = array( $this->settings['base_url'] . $this->form_code, $this->lang->words['to_remplatetools'] );
}
}
diff --git a/upload/admin/applications/core/modules_admin/templates/urlmap.php b/upload/admin/applications/core/modules_admin/templates/urlmap.php
index a97fe3ac..fac786dd 100644
--- a/upload/admin/applications/core/modules_admin/templates/urlmap.php
+++ b/upload/admin/applications/core/modules_admin/templates/urlmap.php
@@ -1,19 +1,21 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Skin URL mapping
- * Last Updated: $Date: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 2.3.x
- * @version $Revision: 3887 $
+ * @version $Revision: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_admin/templates/useragents.php b/upload/admin/applications/core/modules_admin/templates/useragents.php
index b00d6e34..18b3fa62 100644
--- a/upload/admin/applications/core/modules_admin/templates/useragents.php
+++ b/upload/admin/applications/core/modules_admin/templates/useragents.php
@@ -1,20 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Gallery Application
- * Last Updated: $Date: 2009-11-11 20:48:24 -0500 (Wed, 11 Nov 2009) $
+ * Last Updated: $Date: 2010-10-19 10:40:05 -0400 (Tue, 19 Oct 2010) $
+ *
*
- * @author $Author: bfarber $
+ * @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Who knows...
- * @version $Revision: 5376 $
- *
+ * @version $Revision: 6995 $
*/
if ( ! defined( 'IN_ACP' ) )
@@ -28,7 +28,6 @@ class admin_core_templates_useragents extends ipsCommand
/**
* Skin Functions Class
*
- * @access private
* @var object
*/
private $skinFunctions;
@@ -36,7 +35,6 @@ class admin_core_templates_useragents extends ipsCommand
/**
* User agent functions
*
- * @access private
* @var object UA functions
*/
private $userAgentFunctions;
@@ -44,7 +42,6 @@ class admin_core_templates_useragents extends ipsCommand
/**
* Skin object
*
- * @access private
* @var object Skin templates
*/
private $html;
@@ -52,7 +49,6 @@ class admin_core_templates_useragents extends ipsCommand
/**#@+
* URL bits
*
- * @access public
* @var string
*/
public $form_code = '';
@@ -62,7 +58,6 @@ class admin_core_templates_useragents extends ipsCommand
/**
* Main class entry point
*
- * @access public
* @param object ipsRegistry reference
* @return void [Outputs to screen]
*/
@@ -93,12 +88,10 @@ class admin_core_templates_useragents extends ipsCommand
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 );
- require_once( IPS_ROOT_PATH . 'sources/classes/useragents/userAgentFunctions.php' );
-
- $this->userAgentFunctions = new userAgentFunctions( $registry );
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/useragents/userAgentFunctions.php', 'userAgentFunctions' );
+ $this->userAgentFunctions = new $classToLoad( $registry );
///----------------------------------------
// What to do...
@@ -125,7 +118,6 @@ class admin_core_templates_useragents extends ipsCommand
/**
* Show useragents for this skin set
*
- * @access private
* @return string HTML
*/
private function _saveAgents()
@@ -211,7 +203,6 @@ class admin_core_templates_useragents extends ipsCommand
/**
* Show useragents for this skin set
*
- * @access private
* @return void
*/
private function _showUserAgentMapping()
diff --git a/upload/admin/applications/core/modules_admin/templates/xml/index.html b/upload/admin/applications/core/modules_admin/templates/xml/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/templates/xml/index.html
+++ b/upload/admin/applications/core/modules_admin/templates/xml/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/tools/api.php b/upload/admin/applications/core/modules_admin/tools/api.php
index ba9dab11..3f09bfdf 100644
--- a/upload/admin/applications/core/modules_admin/tools/api.php
+++ b/upload/admin/applications/core/modules_admin/tools/api.php
@@ -1,590 +1,594 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
- exit();
-}
-
-class admin_core_tools_api 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...
- //-----------------------------------------
- ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_tools' ) );
- $this->html = $this->registry->output->loadTemplate('cp_skin_api');
-
- //-----------------------------------------
- // Set up stuff
- //-----------------------------------------
-
- $this->form_code = $this->html->form_code = 'module=tools§ion=api';
- $this->form_code_js = $this->html->form_code_js = 'module=tools§ion=api';
-
- //-----------------------------------------
- // What are we to do, today?
- //-----------------------------------------
-
- switch( $this->request['do'] )
- {
- case 'api_list':
- default:
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'api_manage' );
- $this->apiList();
- break;
- case 'api_add':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'api_manage' );
- $this->apiForm( 'add' );
- break;
- case 'api_add_save':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'api_manage' );
- $this->apiSave( 'add' );
- break;
- case 'api_edit':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'api_manage' );
- $this->apiForm( 'edit' );
- break;
- case 'api_edit_save':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'api_manage' );
- $this->apiSave( 'edit' );
- break;
- case 'api_remove':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'api_remove' );
- $this->apiRemove();
- break;
-
- case 'log_list':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'api_logs' );
- $this->logList();
- break;
- case 'log_view_detail':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'api_logs' );
- $this->logViewDetail();
- 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();
- }
-
- /**
- * API Logs View
- * View API Log
- *
- * @access private
- * @return void [Outputs]
- * @author Matt Mecham
- * @since 2.3.2
- */
- private function logViewDetail()
- {
- //-----------------------------------------
- // Fix up navigation bar
- //-----------------------------------------
-
- $this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_logs' ) );
-
- $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=tools§ion=api&do=log_list', $this->lang->words['api_error_logs'] );
-
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $api_log_id = intval( $this->request['api_log_id'] );
-
- //-----------------------------------------
- // Get data from the deebee
- //-----------------------------------------
-
- $log = $this->DB->buildAndFetch( array( 'select' => '*',
- 'from' => 'api_log',
- 'where' => 'api_log_id='.$api_log_id ) );
-
- if ( ! $log['api_log_id'] )
- {
- $this->registry->output->global_message = $this->lang->words['a_lognoid'];
- $this->logList();
- return;
- }
-
- //-----------------------------------------
- // Display...
- //-----------------------------------------
-
- $log['_api_log_date'] = ipsRegistry::getClass( 'class_localization')->getDate( $log['api_log_date'], 'LONG' );
- $log['_api_log_allowed'] = $log['api_log_allowed'] ? 'aff_tick.png' : 'aff_cross.png';
- $log['_api_log_query'] = htmlspecialchars( $log['api_log_query'] );
-
- //-----------------------------------------
- // Show...
- //-----------------------------------------
-
- $this->registry->output->html .= $this->html->api_log_detail( $log );
-
- $this->registry->output->printPopupWindow();
- }
-
-
- /**
- * API Logs List
- * List API Logs
- *
- * @access private
- * @return void [Outputs]
- * @author Matt Mecham
- * @since 2.3.2
- */
- private function logList()
- {
- //-----------------------------------------
- // Fix up navigation bar
- //-----------------------------------------
-
- $this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_logs' ) );
-
- $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=tools§ion=api&do=log_list', $this->lang->words['api_error_logs'] );
-
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $start = intval( $this->request['st'] );
- $perpage = 50;
- $logs = array();
-
- //-----------------------------------------
- // Get log count
- //-----------------------------------------
-
- $count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count',
- 'from' => 'api_log' ) );
-
- $links = $this->registry->output->generatePagination( array( 'totalItems' => intval( $count['count'] ),
- 'itemsPerPage' => $perpage,
- 'currentStartValue' => $start,
- 'baseUrl' => $this->settings['base_url'].'&'.$this->form_code ) );
-
- //-----------------------------------------
- // Get from DB
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'api_log', 'order' => 'api_log_date DESC', 'limit' => array( $start, $perpage ) ) );
-
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- $row['_api_log_date'] = ipsRegistry::getClass('class_localization')->getDate( $row['api_log_date'], 'LONG' );
- $row['_api_log_allowed'] = $row['api_log_allowed'] ? 'aff_tick.png' : 'aff_cross.png';
-
- $logs[] = $row;
- }
-
- //-----------------------------------------
- // Print...
- //-----------------------------------------
-
- $this->registry->output->html .= $this->html->api_login_view( $logs, $links );
- }
-
- /**
- * API User Remove
- * Removes an API User
- *
- * @access private
- * @return void [Outputs]
- * @author Matt Mecham
- * @since 2.3.2
- */
- private function apiRemove()
- {
- $api_user_id = $this->request['api_user_id'] ? intval($this->request['api_user_id']) : 0;
-
- if( !$api_user_id )
- {
- $this->registry->output->global_message = $this->lang->words['a_whatuser'];
- $this->apiList();
- return;
- }
-
- $api_user = $this->DB->buildAndFetch( array( 'select' => '*',
- 'from' => 'api_users',
- 'where' => 'api_user_id='.$api_user_id ) );
-
- if ( ! $api_user['api_user_id'] )
- {
- $this->registry->output->global_message = $this->lang->words['a_user404'];
- $this->apiList();
- return;
- }
-
- $this->DB->delete( 'api_users', 'api_user_id='.$api_user_id );
-
- $this->registry->output->global_message = $this->lang->words['a_removed'];
- $this->apiList();
- }
-
- /**
- * API Save
- * Save API user
- *
- * @access private
- * @param string Type
- * @return void [Outputs]
- * @author Matt Mecham
- * @since 2.3.2
- */
- private function apiSave( $type='add' )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $api_user_id = $this->request['api_user_id'] ? intval($this->request['api_user_id']) : 0;
- $api_user_key = $this->request['api_user_key'];
- $api_user_name = $this->request['api_user_name'];
- $api_user_ip = $this->request['api_user_ip'];
- $permissions = array();
-
- //-----------------------------------------
- // Check (please?)
- //-----------------------------------------
-
- if ( ! $api_user_name )
- {
- $this->registry->output->global_message = $this->lang->words['a_entertitle'];
- $this->apiForm( $type );
- return;
- }
-
- //-----------------------------------------
- // More checking...
- //-----------------------------------------
-
- if ( $type == 'add' )
- {
- if ( ! $api_user_key )
- {
- $this->registry->output->global_message = $this->lang->words['a_noapikey'];
- $this->apiForm( $type );
- return;
- }
- }
- else
- {
- $api_user = $this->DB->buildAndFetch( array( 'select' => '*',
- 'from' => 'api_users',
- 'where' => 'api_user_id='.$api_user_id ) );
-
- if ( ! $api_user['api_user_id'] )
- {
- $this->registry->output->global_message = $this->lang->words['a_user404'];
- $this->apiList();
- return;
- }
- }
-
- //-----------------------------------------
- // Save basics
- //-----------------------------------------
-
- $save = array( 'api_user_name' => $api_user_name,
- 'api_user_ip' => $api_user_ip );
-
- //-----------------------------------------
- // Sort out permissions...
- //-----------------------------------------
-
- foreach( $this->request as $key => $value )
- {
- if ( preg_match( "#^_perm_([^_]+?)_(.*)$#", $key, $matches ) )
- {
- $module = $matches[1];
- $function = $matches[2];
-
- if ( $value )
- {
- $permissions[ $module ][ $function ] = 1;
- }
- }
- }
-
- //-----------------------------------------
- // Add in perms
- //-----------------------------------------
-
- $save['api_user_perms'] = serialize( $permissions );
-
- //-----------------------------------------
- // Save...
- //-----------------------------------------
-
- if ( $type == 'add' )
- {
- //-----------------------------------------
- // Add in key..
- //-----------------------------------------
-
- $save['api_user_key'] = $api_user_key;
-
- //-----------------------------------------
- // Save it...
- //-----------------------------------------
-
- $this->registry->output->global_message = $this->lang->words['a_added'];
-
- $this->DB->insert( 'api_users', $save );
- }
- else
- {
- $this->registry->output->global_message = $this->lang->words['a_edited'];
-
- $this->DB->update( 'api_users', $save, 'api_user_id=' . $api_user_id );
- }
-
- $this->apiList();
- }
-
- /**
- * API Form
- * Shows the add/edit form
- *
- * @access private
- * @param string Type
- * @return void [Outputs]
- * @author Matt Mecham
- * @since 2.3.2
- */
- private function apiForm( $type='add' )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $api_user_id = $this->request['api_user_id'] ? intval($this->request['api_user_id']) : 0;
- $form = array();
- $permissions = array();
-
- //-----------------------------------------
- // Check (please?)
- //-----------------------------------------
-
- if ( $type == 'add' )
- {
- $formcode = 'api_add_save';
- $title = $this->lang->words['a_createnew'];
- $button = $this->lang->words['a_createnew'];
- $api_user = array();
- $api_perms = array();
- }
- else
- {
- $api_user = $this->DB->buildAndFetch( array( 'select' => '*',
- 'from' => 'api_users',
- 'where' => 'api_user_id='.$api_user_id ) );
-
- if ( ! $api_user['api_user_id'] )
- {
- $this->registry->output->global_message = $this->lang->words['a_user404'];
- $this->apiList();
- return;
- }
-
- $formcode = 'api_edit_save';
- $title = $this->lang->words['a_edituser'].$api_user['api_user_name'];
- $button = $this->lang->words['a_savechanges'];
-
- $api_perms = unserialize( $api_user['api_user_perms'] );
- }
-
- //-----------------------------------------
- // Form
- //-----------------------------------------
-
- $form['api_user_name'] = $this->registry->output->formInput( 'api_user_name', ( isset($_POST['api_user_name']) AND $_POST['api_user_name'] ) ? stripslashes($_POST['api_user_name']) : $api_user['api_user_name'] );
- $form['api_user_ip'] = $this->registry->output->formInput( 'api_user_ip', ( isset($_POST['api_user_ip']) AND $_POST['api_user_ip'] ) ? stripslashes($_POST['api_user_ip']) : $api_user['api_user_ip'] );
-
- //-----------------------------------------
- // Get all modules and stuff and other things
- //-----------------------------------------
-
- $path = DOC_IPS_ROOT_PATH . 'interface/board/modules';
-
- if ( is_dir( $path ) )
- {
- $handle = opendir( $path );
-
- while ( ( $file = readdir($handle) ) !== FALSE )
- {
- if ( is_dir( $path . '/' . $file ) )
- {
- if ( file_exists( $path . '/' . $file . '/config.php' ) )
- {
- $_name = $file;
-
- require_once( $path . "/" . $file . '/config.php' );
-
- if ( $CONFIG['api_module_title'] )
- {
- $permissions[ $_name ] = array( 'key' => $api_module_title,
- 'title' => $CONFIG['api_module_title'],
- 'desc' => $CONFIG['api_module_desc'],
- 'path' => $path . "/" . $file,
- 'perms' => array() );
-
- //-----------------------------------------
- // Get all available methods
- //-----------------------------------------
-
- if ( file_exists( $path . '/' . $file . '/methods.php' ) )
- {
- require_once( $path . '/' . $file . '/methods.php' );
-
- $permissions[ $_name ]['perms'] = array_keys( $ALLOWED_METHODS );
- }
-
- //-----------------------------------------
- // Sort out form field
- //-----------------------------------------
-
- if ( is_array( $permissions[ $_name ]['perms'] ) )
- {
- foreach( $permissions[ $_name ]['perms'] as $perm )
- {
- $_checked = intval( $api_perms[ $_name ][ $perm ] );
- $permissions[ $_name ]['form_perms'][ $perm ] = array( 'title' => $perm,
- 'form' => $this->registry->output->formCheckbox( '_perm_' . $_name . '_' . $perm, $_checked ) );
- }
- }
- }
-
- $CONFIG = array();
- $ALLOWED_METHODS = array();
- }
- }
- }
-
- closedir( $handle );
- }
-
- //-----------------------------------------
- // Auto-generate API key
- //-----------------------------------------
-
- if ( $type == 'add' )
- {
- $form['_api_user_key'] = md5( mt_rand() . $this->memberData['member_login_key'] . uniqid( mt_rand(), true ) );
- }
-
- $this->registry->output->html .= $this->registry->output->global_template->information_box( $this->lang->words['a_title'], $this->lang->words['a_msg2'] ) . " ";
- $this->registry->output->html .= $this->html->api_form( $form, $title, $formcode, $button, $api_user, $type, $permissions );
-
- }
-
- /**
- * API LIST
- * List all currently stored API users
- *
- * @access private
- * @return void [Outputs]
- * @author Matt Mecham
- * @since 2.3.2
- */
- private function apiList()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $users = array();
-
- //-----------------------------------------
- // Get users from the DB
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'api_users', 'order' => 'api_user_id' ) );
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- $users[] = $row;
- }
-
- //-----------------------------------------
- // XML RPC Enabled?
- //-----------------------------------------
-
- if ( ! $this->settings['xmlrpc_enable'] )
- {
- $this->registry->output->html .= $this->registry->output->global_template->warning_box( $this->lang->words['a_disabled'], sprintf( $this->lang->words['a_msg3'], $this->settings['base_url'] ) ) . " ";
- }
-
- //-----------------------------------------
- // Dun...
- //-----------------------------------------
-
- $this->registry->output->html .= $this->html->api_list( $users );
- }
-}
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * API Users
+ * Last Updated: $Date: 2010-10-11 20:21:22 -0400 (Mon, 11 Oct 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 1st march 2002
+ * @version $Revision: 6962 $
+ *
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+class admin_core_tools_api 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...
+ //-----------------------------------------
+ ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_tools' ) );
+ $this->html = $this->registry->output->loadTemplate('cp_skin_api');
+
+ //-----------------------------------------
+ // Set up stuff
+ //-----------------------------------------
+
+ $this->form_code = $this->html->form_code = 'module=tools§ion=api';
+ $this->form_code_js = $this->html->form_code_js = 'module=tools§ion=api';
+
+ //-----------------------------------------
+ // What are we to do, today?
+ //-----------------------------------------
+
+ switch( $this->request['do'] )
+ {
+ case 'api_list':
+ default:
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'api_manage' );
+ $this->apiList();
+ break;
+ case 'api_add':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'api_manage' );
+ $this->apiForm( 'add' );
+ break;
+ case 'api_add_save':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'api_manage' );
+ $this->apiSave( 'add' );
+ break;
+ case 'api_edit':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'api_manage' );
+ $this->apiForm( 'edit' );
+ break;
+ case 'api_edit_save':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'api_manage' );
+ $this->apiSave( 'edit' );
+ break;
+ case 'api_remove':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'api_remove' );
+ $this->apiRemove();
+ break;
+
+ case 'log_list':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'api_logs' );
+ $this->logList();
+ break;
+ case 'log_view_detail':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'api_logs' );
+ $this->logViewDetail();
+ 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();
+ }
+
+ /**
+ * API Logs View
+ * View API Log
+ *
+ * @access private
+ * @return void [Outputs]
+ * @author Matt Mecham
+ * @since 2.3.2
+ */
+ private function logViewDetail()
+ {
+ //-----------------------------------------
+ // Fix up navigation bar
+ //-----------------------------------------
+
+ $this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_logs' ) );
+
+ $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=tools§ion=api&do=log_list', $this->lang->words['api_error_logs'] );
+
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $api_log_id = intval( $this->request['api_log_id'] );
+
+ //-----------------------------------------
+ // Get data from the deebee
+ //-----------------------------------------
+
+ $log = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'api_log',
+ 'where' => 'api_log_id='.$api_log_id ) );
+
+ if ( ! $log['api_log_id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['a_lognoid'];
+ $this->logList();
+ return;
+ }
+
+ //-----------------------------------------
+ // Display...
+ //-----------------------------------------
+
+ $log['_api_log_date'] = ipsRegistry::getClass( 'class_localization')->getDate( $log['api_log_date'], 'LONG' );
+ $log['_api_log_allowed'] = $log['api_log_allowed'] ? 'tick.png' : 'cross.png';
+ $log['_api_log_query'] = htmlspecialchars( $log['api_log_query'] );
+
+ //-----------------------------------------
+ // Show...
+ //-----------------------------------------
+
+ $this->registry->output->html .= $this->html->api_log_detail( $log );
+
+ $this->registry->output->printPopupWindow();
+ }
+
+
+ /**
+ * API Logs List
+ * List API Logs
+ *
+ * @access private
+ * @return void [Outputs]
+ * @author Matt Mecham
+ * @since 2.3.2
+ */
+ private function logList()
+ {
+ //-----------------------------------------
+ // Fix up navigation bar
+ //-----------------------------------------
+
+ $this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_logs' ) );
+
+ $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=tools§ion=api&do=log_list', $this->lang->words['api_error_logs'] );
+
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $start = intval( $this->request['st'] );
+ $perpage = 50;
+ $logs = array();
+
+ //-----------------------------------------
+ // Get log count
+ //-----------------------------------------
+
+ $count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count',
+ 'from' => 'api_log' ) );
+
+ $links = $this->registry->output->generatePagination( array( 'totalItems' => intval( $count['count'] ),
+ 'itemsPerPage' => $perpage,
+ 'currentStartValue' => $start,
+ 'baseUrl' => $this->settings['base_url'].'&'.$this->form_code ) );
+
+ //-----------------------------------------
+ // Get from DB
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'api_log', 'order' => 'api_log_date DESC', 'limit' => array( $start, $perpage ) ) );
+
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $row['_api_log_date'] = ipsRegistry::getClass('class_localization')->getDate( $row['api_log_date'], 'LONG' );
+ $row['_api_log_allowed'] = $row['api_log_allowed'] ? 'tick.png' : 'cross.png';
+
+ $logs[] = $row;
+ }
+
+ //-----------------------------------------
+ // Print...
+ //-----------------------------------------
+
+ $this->registry->output->html .= $this->html->api_login_view( $logs, $links );
+ }
+
+ /**
+ * API User Remove
+ * Removes an API User
+ *
+ * @access private
+ * @return void [Outputs]
+ * @author Matt Mecham
+ * @since 2.3.2
+ */
+ private function apiRemove()
+ {
+ $api_user_id = $this->request['api_user_id'] ? intval($this->request['api_user_id']) : 0;
+
+ if( !$api_user_id )
+ {
+ $this->registry->output->global_message = $this->lang->words['a_whatuser'];
+ $this->apiList();
+ return;
+ }
+
+ $api_user = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'api_users',
+ 'where' => 'api_user_id='.$api_user_id ) );
+
+ if ( ! $api_user['api_user_id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['a_user404'];
+ $this->apiList();
+ return;
+ }
+
+ $this->DB->delete( 'api_users', 'api_user_id='.$api_user_id );
+
+ $this->registry->output->global_message = $this->lang->words['a_removed'];
+ $this->apiList();
+ }
+
+ /**
+ * API Save
+ * Save API user
+ *
+ * @access private
+ * @param string Type
+ * @return void [Outputs]
+ * @author Matt Mecham
+ * @since 2.3.2
+ */
+ private function apiSave( $type='add' )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $api_user_id = $this->request['api_user_id'] ? intval($this->request['api_user_id']) : 0;
+ $api_user_key = $this->request['api_user_key'];
+ $api_user_name = $this->request['api_user_name'];
+ $api_user_ip = $this->request['api_user_ip'];
+ $permissions = array();
+
+ //-----------------------------------------
+ // Check (please?)
+ //-----------------------------------------
+
+ if ( ! $api_user_name )
+ {
+ $this->registry->output->global_message = $this->lang->words['a_entertitle'];
+ $this->apiForm( $type );
+ return;
+ }
+
+ //-----------------------------------------
+ // More checking...
+ //-----------------------------------------
+
+ if ( $type == 'add' )
+ {
+ if ( ! $api_user_key )
+ {
+ $this->registry->output->global_message = $this->lang->words['a_noapikey'];
+ $this->apiForm( $type );
+ return;
+ }
+ }
+ else
+ {
+ $api_user = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'api_users',
+ 'where' => 'api_user_id='.$api_user_id ) );
+
+ if ( ! $api_user['api_user_id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['a_user404'];
+ $this->apiList();
+ return;
+ }
+ }
+
+ //-----------------------------------------
+ // Save basics
+ //-----------------------------------------
+
+ $save = array( 'api_user_name' => $api_user_name,
+ 'api_user_ip' => $api_user_ip );
+
+ //-----------------------------------------
+ // Sort out permissions...
+ //-----------------------------------------
+
+ foreach( $this->request as $key => $value )
+ {
+ if ( preg_match( "#^_perm_([^_]+?)_(.*)$#", $key, $matches ) )
+ {
+ $module = $matches[1];
+ $function = $matches[2];
+
+ if ( $value )
+ {
+ $permissions[ $module ][ $function ] = 1;
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Add in perms
+ //-----------------------------------------
+
+ $save['api_user_perms'] = serialize( $permissions );
+
+ //-----------------------------------------
+ // Save...
+ //-----------------------------------------
+
+ if ( $type == 'add' )
+ {
+ //-----------------------------------------
+ // Add in key..
+ //-----------------------------------------
+
+ $save['api_user_key'] = $api_user_key;
+
+ //-----------------------------------------
+ // Save it...
+ //-----------------------------------------
+
+ $this->registry->output->global_message = $this->lang->words['a_added'];
+
+ $this->DB->insert( 'api_users', $save );
+ }
+ else
+ {
+ $this->registry->output->global_message = $this->lang->words['a_edited'];
+
+ $this->DB->update( 'api_users', $save, 'api_user_id=' . $api_user_id );
+ }
+
+ $this->apiList();
+ }
+
+ /**
+ * API Form
+ * Shows the add/edit form
+ *
+ * @access private
+ * @param string Type
+ * @return void [Outputs]
+ * @author Matt Mecham
+ * @since 2.3.2
+ */
+ private function apiForm( $type='add' )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $api_user_id = $this->request['api_user_id'] ? intval($this->request['api_user_id']) : 0;
+ $form = array();
+ $permissions = array();
+
+ //-----------------------------------------
+ // Check (please?)
+ //-----------------------------------------
+
+ if ( $type == 'add' )
+ {
+ $formcode = 'api_add_save';
+ $title = $this->lang->words['a_createnew'];
+ $button = $this->lang->words['a_createnew'];
+ $api_user = array();
+ $api_perms = array();
+ }
+ else
+ {
+ $api_user = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'api_users',
+ 'where' => 'api_user_id='.$api_user_id ) );
+
+ if ( ! $api_user['api_user_id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['a_user404'];
+ $this->apiList();
+ return;
+ }
+
+ $formcode = 'api_edit_save';
+ $title = $this->lang->words['a_edituser'].$api_user['api_user_name'];
+ $button = $this->lang->words['a_savechanges'];
+
+ $api_perms = unserialize( $api_user['api_user_perms'] );
+ }
+
+ //-----------------------------------------
+ // Form
+ //-----------------------------------------
+
+ $form['api_user_name'] = $this->registry->output->formInput( 'api_user_name', ( isset($_POST['api_user_name']) AND $_POST['api_user_name'] ) ? stripslashes($_POST['api_user_name']) : $api_user['api_user_name'] );
+ $form['api_user_ip'] = $this->registry->output->formInput( 'api_user_ip', ( isset($_POST['api_user_ip']) AND $_POST['api_user_ip'] ) ? stripslashes($_POST['api_user_ip']) : $api_user['api_user_ip'] );
+
+ //-----------------------------------------
+ // Get all modules and stuff and other things
+ //-----------------------------------------
+
+ $path = DOC_IPS_ROOT_PATH . 'interface/board/modules';
+
+ if ( is_dir( $path ) )
+ {
+ $handle = opendir( $path );
+
+ while ( ( $file = readdir($handle) ) !== FALSE )
+ {
+ if ( is_dir( $path . '/' . $file ) )
+ {
+ if ( file_exists( $path . '/' . $file . '/config.php' ) )
+ {
+ $CONFIG = array();
+ $_name = $file;
+
+ require_once( $path . "/" . $file . '/config.php' );
+
+ if ( $CONFIG['api_module_title'] )
+ {
+ $permissions[ $_name ] = array( 'key' => $CONFIG['api_module_key'],
+ 'title' => $CONFIG['api_module_title'],
+ 'desc' => $CONFIG['api_module_desc'],
+ 'path' => $path . "/" . $file,
+ 'perms' => array() );
+
+ //-----------------------------------------
+ // Get all available methods
+ //-----------------------------------------
+
+ if ( file_exists( $path . '/' . $file . '/methods.php' ) )
+ {
+ $ALLOWED_METHODS = array();
+ require_once( $path . '/' . $file . '/methods.php' );
+
+ $permissions[ $_name ]['perms'] = array_keys( $ALLOWED_METHODS );
+ }
+
+ //-----------------------------------------
+ // Sort out form field
+ //-----------------------------------------
+
+ if ( is_array( $permissions[ $_name ]['perms'] ) )
+ {
+ foreach( $permissions[ $_name ]['perms'] as $perm )
+ {
+ $_checked = intval( $api_perms[ $_name ][ $perm ] );
+ $permissions[ $_name ]['form_perms'][ $perm ] = array( 'title' => $perm,
+ 'form' => $this->registry->output->formCheckbox( '_perm_' . $_name . '_' . $perm, $_checked ) );
+ }
+ }
+ }
+
+ $CONFIG = array();
+ $ALLOWED_METHODS = array();
+ }
+ }
+ }
+
+ closedir( $handle );
+ }
+
+ //-----------------------------------------
+ // Auto-generate API key
+ //-----------------------------------------
+
+ if ( $type == 'add' )
+ {
+ $form['_api_user_key'] = md5( mt_rand() . $this->memberData['member_login_key'] . uniqid( mt_rand(), true ) );
+ }
+
+ $this->registry->output->html .= $this->registry->output->global_template->information_box( $this->lang->words['a_title'], $this->lang->words['a_msg2'] ) . " ";
+ $this->registry->output->html .= $this->html->api_form( $form, $title, $formcode, $button, $api_user, $type, $permissions );
+
+ }
+
+ /**
+ * API LIST
+ * List all currently stored API users
+ *
+ * @access private
+ * @return void [Outputs]
+ * @author Matt Mecham
+ * @since 2.3.2
+ */
+ private function apiList()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $users = array();
+
+ //-----------------------------------------
+ // Get users from the DB
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'api_users', 'order' => 'api_user_id' ) );
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $users[] = $row;
+ }
+
+ //-----------------------------------------
+ // XML RPC Enabled?
+ //-----------------------------------------
+
+ if ( ! $this->settings['xmlrpc_enable'] )
+ {
+ $this->registry->output->html .= $this->registry->output->global_template->warning_box( $this->lang->words['a_disabled'], sprintf( $this->lang->words['a_msg3'], $this->settings['base_url'] ) ) . " ";
+ }
+
+ //-----------------------------------------
+ // Dun...
+ //-----------------------------------------
+
+ $this->registry->output->html .= $this->html->api_list( $users );
+ }
+}
diff --git a/upload/admin/applications/core/modules_admin/tools/cache.php b/upload/admin/applications/core/modules_admin/tools/cache.php
index e5109890..c1cc082d 100644
--- a/upload/admin/applications/core/modules_admin/tools/cache.php
+++ b/upload/admin/applications/core/modules_admin/tools/cache.php
@@ -1,488 +1,481 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class admin_core_tools_cache extends ipsCommand
-{
- /**
- * HTML skin object
- *
- * @access protected
- * @var object
- */
- protected $html;
-
- /**
- * URL for form code
- *
- * @access protected
- * @var string
- */
- protected $form_code;
-
- /**
- * URL for form code (javascript)
- *
- * @access protected
- * @var string
- */
- protected $form_code_js;
-
- /**
- * Class entry point
- *
- * @access public
- * @param object Registry reference
- * @return void [Outputs to screen]
- */
- public function doExecute( ipsRegistry $registry )
- {
- //-----------------------------------------
- // Load language
- //-----------------------------------------
-
- $this->registry->class_localization->loadLanguageFile( array( 'admin_tools' ) );
-
- //-----------------------------------------
- // Load skin
- //-----------------------------------------
-
- $this->html = $this->registry->output->loadTemplate('cp_skin_tools');
-
- //-----------------------------------------
- // Set some vars
- //-----------------------------------------
-
- $this->form_code = $this->html->form_code = '&module=tools§ion=cache&';
- $this->form_code_js = $this->html->form_code_js = '&module=tools§ion=cache&';
-
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'cache_manage' );
-
- //-----------------------------------------
- // And then?
- //-----------------------------------------
-
- switch( $this->request['do'] )
- {
- default:
- case 'cache_overview':
- $this->request['do'] = 'cache_overview';
- $this->cacheOverview();
- break;
-
- case 'cache_view':
- $this->cacheView();
- break;
-
- case 'cache_recache':
- $this->cacheRecache();
- break;
-
- case 'cache_update_all_process':
- $this->cacheUpdateAllProcess();
- break;
-
- case 'contentCache':
- $this->_contentCache();
- break;
- }
-
- //-----------------------------------------
- // Pass to CP output hander
- //-----------------------------------------
-
- $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
- $this->registry->output->sendOutput();
- }
-
- /**
- * View an individual cache store contents
- *
- * @access private
- * @return void [Outputs to screen]
- */
- private function _contentCache()
- {
- $type = $this->request['type'];
- $method = $this->request['method'];
-
- /* What are we doing? */
- if ( $method == 'all' )
- {
- $removed = IPSContentCache::truncate( $type );
- }
- else
- {
- $removed = IPSContentCache::prune( $type );
- }
-
- $this->registry->output->global_message = sprintf( $this->lang->words['cc_processed'], $removed );
- $this->cacheOverview();
- }
-
- /**
- * View an individual cache store contents
- *
- * @access public
- * @return void [Outputs to screen]
- */
- public function cacheView()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $id = trim( $this->request['id'] );
-
- //-----------------------------------------
- // Check
- //-----------------------------------------
-
- if ( ! $id )
- {
- $this->registry->output->global_message = $this->lang->words['c_noid'];
- $this->cacheOverview();
- return false;
- }
-
- //-----------------------------------------
- // Get cache...
- //-----------------------------------------
-
- if( $this->request['cache_app'] AND !in_array( $this->request['cache_app'], array( 'core', 'global' ) ) )
- {
- ipsRegistry::_loadAppCoreVariables( $this->request['cache_app'] );
- }
-
- $db_cache = $this->cache->getCache( $id );
-
- //-----------------------------------------
- // Build HTML and output...
- //-----------------------------------------
-
- ob_start();
-
- print_r( $db_cache );
-
- $out = ob_get_contents();
-
- ob_end_clean();
-
- $this->registry->output->html = $this->html->cache_pop_up( $id, htmlspecialchars($out) );
-
- $this->registry->output->printPopupWindow();
- }
-
- /**
- * Rebuild all caches
- *
- * @access public
- * @return void [Outputs to screen]
- */
- public function cacheUpdateAllProcess()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $id = intval( $this->request['id'] );
- $cache_name = '';
- $cache_data = '';
- $count = 0;
- $img = ' ';
- $_caches = array();
-
- //-----------------------------------------
- // Get core cache list
- //-----------------------------------------
-
- $_caches = array_merge( $_caches, $this->registry->_fetchCoreVariables( 'cache' ) );
-
- //-----------------------------------------
- // Get all application's cache lists
- //-----------------------------------------
-
- foreach( ipsRegistry::$applications as $app_dir => $app_data )
- {
- $_file = IPSLib::getAppDir( $app_dir ) . '/extensions/coreVariables.php';
-
- if ( file_exists( $_file ) )
- {
- $CACHE = array();
- require( $_file );
-
- foreach( $CACHE as $k => $v )
- {
- $CACHE[ $k ]['cache_app'] = $app_dir;
- }
-
- $_caches = array_merge( $_caches, $CACHE );
- }
- }
-
- //-----------------------------------------
- // Get cache data
- //-----------------------------------------
-
- foreach( $_caches as $_cache_name => $_cache_data )
- {
- if ( $count == $id )
- {
- $cache_name = $_cache_name;
- $cache_data = $_cache_data;
- break;
- }
-
- $count++;
- }
-
- //-----------------------------------------
- // Do what, now?
- //-----------------------------------------
-
- $id++;
-
- if ( $cache_name )
- {
- $this->cache->rebuildCache( $cache_name, $cache_data['cache_app'] ? $cache_data['cache_app'] : 'global' );
-
- $this->registry->output->multipleRedirectHit( $this->settings['base_url'] . '&' . $this->form_code_js . '&do=cache_update_all_process&id=' . $id, $img . $_cache_name . $this->lang->words['c_processed'] );
- }
- else
- {
- $this->registry->output->multipleRedirectFinish();
- }
- }
-
- /**
- * Recache an individual cache
- *
- * @access public
- * @return void [Outputs to screen]
- */
- public function cacheRecache()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $id = trim( $this->request['id'] );
- $app = IPSText::alphanumericalClean( $this->request['cacheapp'] );
-
- if ( $id == '__all__' )
- {
- $this->registry->output->multipleRedirectInit( $this->settings['base_url'] . '&' . $this->form_code_js . '&do=cache_update_all_process&id=0' );
- return false;
- }
-
- $this->cache->rebuildCache( $id, $app );
-
- $this->registry->output->global_message = $this->lang->words['c_recachethecachegetitgotitgood'];
- $this->cacheOverview();
- }
-
- /**
- * List all of the current caches
- *
- * @access public
- * @return void [Outputs to screen]
- */
- public function cacheOverview()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $content = "";
- $db_caches = array();
- $lib_caches = array();
- $cacheContent = array();
- $total = 0;
-
- //-----------------------------------------
- // Get stored caches
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'cache_store' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $db_caches[ $r['cs_key'] ] = $r;
- }
-
- //-----------------------------------------
- // Get core cache list
- //-----------------------------------------
-
- foreach( $this->registry->_fetchCoreVariables( 'cache' ) as $cache_name => $cache_data )
- {
- $cache_data['cache_name'] = $cache_name;
- $cache_data['_cache_size'] = IPSLib::sizeFormat( IPSLib::strlenToBytes( strlen( $db_caches[ $cache_name ]['cs_value'] ) ) );
- $cache_data['_cs_init_load'] = $db_caches[ $cache_name ]['cs_init_load'];
-
- $total += IPSLib::strlenToBytes( strlen( $db_caches[ $cache_name ]['cs_value'] ) );
-
- $lib_caches['global'][ $cache_name ] = $cache_data;
- }
-
- //-----------------------------------------
- // Get all application's cache lists
- //-----------------------------------------
-
- foreach( ipsRegistry::$applications as $app_dir => $app_data )
- {
- $_file = IPSLib::getAppDir( $app_dir ) . '/extensions/coreVariables.php';
-
- if ( file_exists( $_file ) )
- {
- $CACHE = array();
- require( $_file );
-
- foreach( $CACHE as $cache_name => $cache_data )
- {
- $cache_data['cache_name'] = $cache_name;
- $cache_data['_cache_size'] = IPSLib::sizeFormat( IPSLib::strlenToBytes( strlen( $db_caches[ $cache_name ]['cs_value'] ) ) );
- $cache_data['_cs_init_load'] = $db_caches[ $cache_name ]['cs_init_load'];
-
- $total += IPSLib::strlenToBytes( strlen( $db_caches[ $cache_name ]['cs_value'] ) );
-
- $lib_caches[ $app_dir ][ $cache_name ] = $cache_data;
- }
- }
- }
-
- foreach ( $lib_caches as $app => $data )
- {
- ksort( $lib_caches[ $app ] );
- }
-
- $total = IPSLib::sizeFormat( $total );
-
- /* Content Cache Stuffs */
- if ( IPSContentCache::isEnabled() )
- {
- /* Monitor? */
- if ( $this->settings['cc_monitor'] )
- {
- $cache = $this->cache->getCache('ccMonitor');
-
- $cacheContent['m_posts'] = sprintf( $this->lang->words['served_data'], intval( $cache['post']['raw'] ), intval( $cache['post']['cached'] ) );
- $cacheContent['m_sigs'] = sprintf( $this->lang->words['served_data'], intval( $cache['sig']['raw'] ), intval( $cache['sig']['cached'] ) );
- }
- else
- {
- $cacheContent['m_posts'] = $cacheContent['m_sigs'] = $this->lang->words['no_monitoring_data'];
- }
-
- /* Get all posts */
- $cacheContent['posts'] = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count',
- 'from' => 'posts' ) );
-
- /* Get all members */
- $cacheContent['members'] = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count',
- 'from' => 'members' ) );
-
- /* Get cached post count */
- $cacheContent['cachedPosts'] = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count',
- 'from' => 'content_cache_posts' ) );
-
- /* Get cached sig count */
- $cacheContent['cachedSigs'] = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count',
- 'from' => 'content_cache_sigs' ) );
-
- /* Work out percentages */
- $cacheContent['postPercent'] = ( $cacheContent['posts']['count'] AND $cacheContent['cachedPosts']['count'] )
- ? sprintf( "%.0f", ( $cacheContent['cachedPosts']['count'] / $cacheContent['posts']['count'] ) * 100 ) : 0;
-
- $cacheContent['sigPercent'] = ( $cacheContent['members']['count'] AND $cacheContent['cachedSigs']['count'] )
- ? sprintf( "%.0f", ( $cacheContent['cachedSigs']['count'] / $cacheContent['members']['count'] ) * 100 ) : 0;
-
-
- }
-
- $this->registry->output->html .= $this->html->cache_entry_wrapper( $lib_caches, $total, $cacheContent );
- }
-
- /**
- * Rebuild the RSS cache for output
- *
- * @access public
- * @param string [Optional app to rebuild]
- * @return array
- */
- public function rebuildRssCache( $app='' )
- {
- $retrieved = array( time() + 60*60 );
-
- foreach( ipsRegistry::$applications as $app_dir => $app_data )
- {
- if ( ( ! empty( $app ) AND $app == $app_dir ) || empty( $app ) )
- {
- if ( ! IPSLib::appIsInstalled( $app_dir ) )
- {
- continue;
- }
-
- //-----------------------------------------
- // Retrieve the RSS links for the header
- //-----------------------------------------
-
- if( file_exists( IPSLib::getAppDir( $app_dir ) . '/extensions/rssOutput.php' ) )
- {
- require_once( IPSLib::getAppDir( $app_dir ) . '/extensions/rssOutput.php' );
- $className = "rss_output_{$app_dir}";
-
- if( class_exists( $className ) )
- {
- $rss = new $className( $this->registry );
-
- if( method_exists( $rss, "getRssLinks" ) )
- {
- $rssData = $rss->getRssLinks();
-
- if( count($rssData) )
- {
- foreach( $rssData as $data )
- {
- if( !$data['url'] )
- {
- continue;
- }
-
- $retrieved[] = $data['title'] . ':|:' . $data['url'];
- }
- }
- }
- }
- }
- }
- }
-
- $this->cache->setCache( 'rss_output_cache', $retrieved, array( 'array' => 1 ) );
-
- return $retrieved;
- }
-
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * ACP : Cache management
+ * Last Updated: $Date: 2010-10-19 10:40:05 -0400 (Tue, 19 Oct 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 26th January 2004
+ * @version $Revision: 6995 $
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class admin_core_tools_cache extends ipsCommand
+{
+ /**
+ * HTML skin object
+ *
+ * @var object
+ */
+ protected $html;
+
+ /**
+ * URL for form code
+ *
+ * @var string
+ */
+ protected $form_code;
+
+ /**
+ * URL for form code (javascript)
+ *
+ * @var string
+ */
+ protected $form_code_js;
+
+ /**
+ * Class entry point
+ *
+ * @param object Registry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ //-----------------------------------------
+ // Load language
+ //-----------------------------------------
+
+ $this->registry->class_localization->loadLanguageFile( array( 'admin_tools' ) );
+
+ //-----------------------------------------
+ // Load skin
+ //-----------------------------------------
+
+ $this->html = $this->registry->output->loadTemplate('cp_skin_tools');
+
+ //-----------------------------------------
+ // Set some vars
+ //-----------------------------------------
+
+ $this->form_code = $this->html->form_code = '&module=tools§ion=cache&';
+ $this->form_code_js = $this->html->form_code_js = '&module=tools§ion=cache&';
+
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'cache_manage' );
+
+ //-----------------------------------------
+ // And then?
+ //-----------------------------------------
+
+ switch( $this->request['do'] )
+ {
+ default:
+ case 'cache_overview':
+ $this->request['do'] = 'cache_overview';
+ $this->cacheOverview();
+ break;
+
+ case 'cache_view':
+ $this->cacheView();
+ break;
+
+ case 'cache_recache':
+ $this->cacheRecache();
+ break;
+
+ case 'cache_update_all_process':
+ $this->cacheUpdateAllProcess();
+ break;
+
+ case 'contentCache':
+ $this->_contentCache();
+ break;
+ }
+
+ //-----------------------------------------
+ // Pass to CP output hander
+ //-----------------------------------------
+
+ $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * View an individual cache store contents
+ *
+ * @return void [Outputs to screen]
+ */
+ private function _contentCache()
+ {
+ $type = $this->request['type'];
+ $method = $this->request['method'];
+
+ /* What are we doing? */
+ if ( $method == 'all' )
+ {
+ $removed = IPSContentCache::truncate( $type );
+ }
+ else
+ {
+ $removed = IPSContentCache::prune( $type );
+ }
+
+ $this->registry->output->global_message = sprintf( $this->lang->words['cc_processed'], $removed );
+ $this->cacheOverview();
+ }
+
+ /**
+ * View an individual cache store contents
+ *
+ * @return void [Outputs to screen]
+ */
+ public function cacheView()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $id = trim( $this->request['id'] );
+
+ //-----------------------------------------
+ // Check
+ //-----------------------------------------
+
+ if ( ! $id )
+ {
+ $this->registry->output->global_message = $this->lang->words['c_noid'];
+ $this->cacheOverview();
+ return false;
+ }
+
+ //-----------------------------------------
+ // Get cache...
+ //-----------------------------------------
+
+ if( $this->request['cache_app'] AND !in_array( $this->request['cache_app'], array( 'core', 'global' ) ) )
+ {
+ ipsRegistry::_loadAppCoreVariables( $this->request['cache_app'] );
+ }
+
+ $db_cache = $this->cache->getCache( $id );
+
+ //-----------------------------------------
+ // Build HTML and output...
+ //-----------------------------------------
+
+ ob_start();
+
+ print_r( $db_cache );
+
+ $out = ob_get_contents();
+
+ ob_end_clean();
+
+ $this->registry->output->html = $this->html->cache_pop_up( $id, htmlspecialchars($out) );
+
+ $this->registry->output->printPopupWindow();
+ }
+
+ /**
+ * Rebuild all caches
+ *
+ * @return void [Outputs to screen]
+ */
+ public function cacheUpdateAllProcess()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $id = intval( $this->request['id'] );
+ $cache_name = '';
+ $cache_data = '';
+ $count = 0;
+ $img = ' ';
+ $_caches = array();
+
+ //-----------------------------------------
+ // Get core cache list
+ //-----------------------------------------
+
+ $_caches = array_merge( $_caches, $this->registry->_fetchCoreVariables( 'cache' ) );
+
+ //-----------------------------------------
+ // Get all application's cache lists
+ //-----------------------------------------
+
+ foreach( ipsRegistry::$applications as $app_dir => $app_data )
+ {
+ $_file = IPSLib::getAppDir( $app_dir ) . '/extensions/coreVariables.php';
+
+ if ( file_exists( $_file ) )
+ {
+ $CACHE = array();
+ require( $_file );
+
+ foreach( $CACHE as $k => $v )
+ {
+ $CACHE[ $k ]['cache_app'] = $app_dir;
+ }
+
+ $_caches = array_merge( $_caches, $CACHE );
+ }
+ }
+
+ //-----------------------------------------
+ // Get cache data
+ //-----------------------------------------
+
+ foreach( $_caches as $_cache_name => $_cache_data )
+ {
+ if ( $count == $id )
+ {
+ $cache_name = $_cache_name;
+ $cache_data = $_cache_data;
+ break;
+ }
+
+ $count++;
+ }
+
+ //-----------------------------------------
+ // Do what, now?
+ //-----------------------------------------
+
+ $id++;
+
+ if ( $cache_name )
+ {
+ $this->cache->rebuildCache( $cache_name, $cache_data['cache_app'] ? $cache_data['cache_app'] : 'global' );
+
+ $this->registry->output->multipleRedirectHit( $this->settings['base_url'] . '&' . $this->form_code_js . '&do=cache_update_all_process&id=' . $id, $img . $_cache_name . $this->lang->words['c_processed'] );
+ }
+ else
+ {
+ $this->registry->output->multipleRedirectFinish();
+ }
+ }
+
+ /**
+ * Recache an individual cache
+ *
+ * @return void [Outputs to screen]
+ */
+ public function cacheRecache()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $id = trim( $this->request['id'] );
+ $app = IPSText::alphanumericalClean( $this->request['cacheapp'] );
+
+ if ( $id == '__all__' )
+ {
+ $this->registry->output->multipleRedirectInit( $this->settings['base_url'] . '&' . $this->form_code_js . '&do=cache_update_all_process&id=0' );
+ return false;
+ }
+
+ $this->cache->rebuildCache( $id, $app );
+
+ $this->registry->output->global_message = $this->lang->words['c_recachethecachegetitgotitgood'];
+ $this->cacheOverview();
+ }
+
+ /**
+ * List all of the current caches
+ *
+ * @return void [Outputs to screen]
+ */
+ public function cacheOverview()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $content = "";
+ $db_caches = array();
+ $lib_caches = array();
+ $cacheContent = array();
+ $total = 0;
+
+ //-----------------------------------------
+ // Get stored caches
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'cache_store' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $db_caches[ $r['cs_key'] ] = $r;
+ }
+
+ //-----------------------------------------
+ // Get core cache list
+ //-----------------------------------------
+
+ foreach( $this->registry->_fetchCoreVariables( 'cache' ) as $cache_name => $cache_data )
+ {
+ $cache_data['cache_name'] = $cache_name;
+ $cache_data['_cache_size'] = IPSLib::sizeFormat( IPSLib::strlenToBytes( strlen( $db_caches[ $cache_name ]['cs_value'] ) ) );
+ $cache_data['_cs_init_load'] = $db_caches[ $cache_name ]['cs_init_load'];
+
+ $total += IPSLib::strlenToBytes( strlen( $db_caches[ $cache_name ]['cs_value'] ) );
+
+ $lib_caches['global'][ $cache_name ] = $cache_data;
+ }
+
+ //-----------------------------------------
+ // Get all application's cache lists
+ //-----------------------------------------
+
+ foreach( ipsRegistry::$applications as $app_dir => $app_data )
+ {
+ if( !IPSLib::appIsInstalled( $app_dir ) )
+ {
+ continue;
+ }
+
+ $_file = IPSLib::getAppDir( $app_dir ) . '/extensions/coreVariables.php';
+
+ if ( file_exists( $_file ) )
+ {
+ $CACHE = array();
+ require( $_file );
+
+ foreach( $CACHE as $cache_name => $cache_data )
+ {
+ $cache_data['cache_name'] = $cache_name;
+ $cache_data['_cache_size'] = IPSLib::sizeFormat( IPSLib::strlenToBytes( strlen( $db_caches[ $cache_name ]['cs_value'] ) ) );
+ $cache_data['_cs_init_load'] = $db_caches[ $cache_name ]['cs_init_load'];
+
+ $total += IPSLib::strlenToBytes( strlen( $db_caches[ $cache_name ]['cs_value'] ) );
+
+ $lib_caches[ $app_dir ][ $cache_name ] = $cache_data;
+ }
+ }
+ }
+
+ foreach ( $lib_caches as $app => $data )
+ {
+ ksort( $lib_caches[ $app ] );
+ }
+
+ $total = IPSLib::sizeFormat( $total );
+
+ /* Content Cache Stuffs */
+ if ( IPSContentCache::isEnabled() )
+ {
+ /* Monitor? */
+ if ( $this->settings['cc_monitor'] )
+ {
+ $cache = $this->cache->getCache('ccMonitor');
+
+ $cacheContent['m_posts'] = sprintf( $this->lang->words['served_data'], intval( $cache['post']['raw'] ), intval( $cache['post']['cached'] ) );
+ $cacheContent['m_sigs'] = sprintf( $this->lang->words['served_data'], intval( $cache['sig']['raw'] ), intval( $cache['sig']['cached'] ) );
+ }
+ else
+ {
+ $cacheContent['m_posts'] = $cacheContent['m_sigs'] = $this->lang->words['no_monitoring_data'];
+ }
+
+ /* Get all posts */
+ $cacheContent['posts'] = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count',
+ 'from' => 'posts' ) );
+
+ /* Get all members */
+ $cacheContent['members'] = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count',
+ 'from' => 'members' ) );
+
+ /* Get cached post count */
+ $cacheContent['cachedPosts'] = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count',
+ 'from' => 'content_cache_posts' ) );
+
+ /* Get cached sig count */
+ $cacheContent['cachedSigs'] = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count',
+ 'from' => 'content_cache_sigs' ) );
+
+ /* Work out percentages */
+ $cacheContent['postPercent'] = ( $cacheContent['posts']['count'] AND $cacheContent['cachedPosts']['count'] )
+ ? sprintf( "%.0f", ( $cacheContent['cachedPosts']['count'] / $cacheContent['posts']['count'] ) * 100 ) : 0;
+
+ $cacheContent['sigPercent'] = ( $cacheContent['members']['count'] AND $cacheContent['cachedSigs']['count'] )
+ ? sprintf( "%.0f", ( $cacheContent['cachedSigs']['count'] / $cacheContent['members']['count'] ) * 100 ) : 0;
+
+
+ }
+
+ $this->registry->output->html .= $this->html->cache_entry_wrapper( $lib_caches, $total, $cacheContent );
+ }
+
+ /**
+ * Rebuild the RSS cache for output
+ *
+ * @param string [Optional app to rebuild]
+ * @return array
+ */
+ public function rebuildRssCache( $app='' )
+ {
+ $retrieved = array( time() + 60*60 );
+
+ foreach( ipsRegistry::$applications as $app_dir => $app_data )
+ {
+ if ( ( ! empty( $app ) AND $app == $app_dir ) || empty( $app ) )
+ {
+ if ( ! IPSLib::appIsInstalled( $app_dir ) )
+ {
+ continue;
+ }
+
+ //-----------------------------------------
+ // Retrieve the RSS links for the header
+ //-----------------------------------------
+
+ if( file_exists( IPSLib::getAppDir( $app_dir ) . '/extensions/rssOutput.php' ) )
+ {
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( $app_dir ) . '/extensions/rssOutput.php', 'rss_output_' . $app_dir, $app_dir );
+
+ if( class_exists( $classToLoad ) )
+ {
+ $rss = new $classToLoad( $this->registry );
+
+ if( method_exists( $rss, "getRssLinks" ) )
+ {
+ $rssData = $rss->getRssLinks();
+
+ if( count($rssData) )
+ {
+ foreach( $rssData as $data )
+ {
+ if( !$data['url'] )
+ {
+ continue;
+ }
+
+ $retrieved[] = $data['title'] . ':|:' . $data['url'];
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $this->cache->setCache( 'rss_output_cache', $retrieved, array( 'array' => 1 ) );
+
+ return $retrieved;
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/tools/defaultSection.php b/upload/admin/applications/core/modules_admin/tools/defaultSection.php
index ea49a377..1019dd48 100644
--- a/upload/admin/applications/core/modules_admin/tools/defaultSection.php
+++ b/upload/admin/applications/core/modules_admin/tools/defaultSection.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Define the default tools section
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4948 $
+ * @version $Rev: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_admin/tools/help.php b/upload/admin/applications/core/modules_admin/tools/help.php
index e4c9b996..54d1c8f7 100644
--- a/upload/admin/applications/core/modules_admin/tools/help.php
+++ b/upload/admin/applications/core/modules_admin/tools/help.php
@@ -1,480 +1,472 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
- exit();
-}
-
-
-class admin_core_tools_help 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 lang and skin */
- $this->registry->class_localization->loadLanguageFile( array( 'admin_tools' ) );
- $this->html = $this->registry->output->loadTemplate( 'cp_skin_help_files' );
-
- /* URLs */
- $this->form_code = $this->html->form_code = 'module=tools§ion=help';
- $this->form_code_js = $this->html->form_code_js = 'module=tools§ion=help';
-
- /* What to do */
- switch( $this->request['do'] )
- {
- case 'edit':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'help_manage' );
- $this->helpFileForm( 'edit' );
- break;
-
- case 'new':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'help_manage' );
- $this->helpFileForm( 'new' );
- break;
-
- case 'doedit':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'help_manage' );
- $this->handleHelpFileForm( 'edit' );
- break;
-
- case 'doreorder':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'help_manage' );
- $this->helpFilesReorder();
- break;
-
- case 'donew':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'help_manage' );
- $this->handleHelpFileForm( 'new' );
- break;
-
- case 'remove':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'help_remove' );
- $this->helpFileRemove();
- break;
-
- case 'exportXml':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'help_manage' );
- $this->helpFilesXMLExport();
- break;
-
- case 'importXml':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'help_manage' );
- $this->helpFilesXMLImport();
- break;
-
- case 'help_overview':
- default:
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'help_manage' );
- $this->helpFilesList();
- break;
- }
-
- /* Output */
- $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
- $this->registry->output->sendOutput();
- }
-
- /**
- * Import help files XML
- *
- * @access public
- * @return void
- */
- public function helpFilesXMLImport()
- {
- /* INIT */
- $messages = array();
-
- /* Loop through all the applications */
- foreach( $this->registry->getApplications() as $app => $__data )
- {
- $done = $this->helpFilesXMLImport_app( $app );
- $messages[] = sprintf( $this->lang->words['h_import_added'], $app, $done['added'], $done['updated'] );
-
- /* In dev time stamp? */
- if ( IN_DEV )
- {
- $cache = $this->caches['indev'];
- $cache['import']['help'][ $app ] = time();
- $this->cache->setCache( 'indev', $cache, array( 'donow' => 1, 'array' => 1 ) );
- }
- }
-
- $this->registry->output->global_message = $this->lang->words['h_imported'] . " " . implode( " ", $messages );
- $this->helpFilesList();
- }
-
- /**
- * Import help files XML helper. Abstracted so
- * it can be used outside of this file.
- *
- * @access public
- * @param string App Directory
- * @param bool Allow overwrite. If FALSE, it will not update.
- * @return array Number of items added / updated
- */
- public function helpFilesXMLImport_app( $app, $overwrite=TRUE )
- {
- /* INIT */
- $file = IPSLib::getAppDir( $app ) . '/xml/' . $app . '_help.xml';
- $processed = array( 'added' => 0, 'updated' => 0 );
-
- /* Got anything to import? */
- if ( file_exists( $file ) )
- {
- require_once( IPS_KERNEL_PATH.'classXML.php' );
-
- $xml = new classXML( IPS_DOC_CHAR_SET );
- $xml->load( $file );
-
- foreach( $xml->fetchElements('row') as $row )
- {
- $entry = $xml->fetchElementsFromRecord( $row );
- $db = array( 'title' => $entry['title'],
- 'text' => $entry['text'],
- 'description' => $entry['description'],
- 'position' => $entry['position'],
- 'app' => $app );
-
- if ( $entry['title'] )
- {
- $curFaq = $this->DB->buildAndFetch( array( 'select' => 'id', 'from' => 'faq', 'where' => "app='" . $app . "' AND title = '".$this->DB->addSlashes( $entry['title'] )."'" ) );
-
- if ( $curFaq['id'] )
- {
- if ( $overwrite === TRUE )
- {
- $processed['updated']++;
-
- $this->DB->update( 'faq', $db, "id = ". $curFaq['id'] );
- }
- }
- else
- {
- $processed['added']++;
-
- $this->DB->insert( 'faq', $db );
- }
- }
- }
- }
-
- return $processed;
- }
-
- /**
- * Export help files XML
- *
- * @access public
- * @return void
- */
- public function helpFilesXMLExport()
- {
- /* INIT */
- $entry = array();
-
- require_once( IPS_KERNEL_PATH.'classXML.php' );
-
- /* Loop through all the applications */
- foreach( $this->registry->getApplications() as $app => $__data )
- {
- $c = 0;
-
- $xml = new classXML( IPS_DOC_CHAR_SET );
- $xml->newXMLDocument();
- $xml->addElement( 'export' );
- $xml->addElement( 'help', 'export' );
-
- /* Query tasks */
- $this->DB->build( array( 'select' => '*', 'from' => 'faq', 'where' => "app='{$app}'" ) );
- $this->DB->execute();
-
- /* Loop through and add tasks to XML */
- while ( $r = $this->DB->fetch() )
- {
- $c++;
- unset( $r['id'] );
-
- $r['text'] = str_replace( '%7Bstyle_image_url%7D', '{style_image_url}', $r['text'] );
-
- $xml->addElementAsRecord( 'help', 'row', $r );
- }
-
- /* Finish XML */
- $doc = $xml->fetchDocument();
-
- @unlink( IPSLib::getAppDir( $app ) . '/xml/' . $app . '_help.xml' );
-
- /* Write */
- if( $doc and $c)
- {
- $fh = fopen( IPSLib::getAppDir( $app ) . '/xml/' . $app . '_help.xml', 'w' );
- fwrite( $fh, $doc );
- fclose( $fh );
- }
-
- /* In dev time stamp? */
- if ( IN_DEV )
- {
- $cache = $this->caches['indev'];
- $cache['import']['help'][ $app ] = time();
- $this->cache->setCache( 'indev', $cache, array( 'donow' => 1, 'array' => 1 ) );
- }
- }
-
- $this->registry->output->global_message = $this->lang->words['h_exported'];
- $this->helpFilesList();
- }
-
- /**
- * Removes a help file
- *
- * @access public
- * @return void
- * @author Josh
- */
- public function helpFileRemove()
- {
- /* Check ID */
- $id = intval( $this->request['id'] );
- if( ! $id )
- {
- $this->registry->output->showError( $this->lang->words['h_noid'], 11149 );
- }
-
- /* Delete the record */
- $this->DB->delete( 'faq', "id={$id}" );
-
- /* Log and bounce */
- $this->registry->adminFunctions->saveAdminLog( $this->lang->words['h_removed'] );
- $this->registry->output->silentRedirect( $this->settings['base_url'] . $this->form_code );
- }
-
- /**
- * Handles the add/edit help file form
- *
- * @access public
- * @param string $type Either new or edit
- * @return void
- */
- public function handleHelpFileForm( $type='new' )
- {
- /* Error Checking */
- if( ! $this->request['title'] )
- {
- $this->registry->output->showError( $this->lang->words['h_entertitle'], 11150 );
- }
-
- $text = trim( $_POST['editor_main'] );
- $text = preg_replace( "/\\\/", "\", $text );
- $text = str_replace( '%7Bstyle_image_url%7D', '{style_image_url}', $text );
-
- /* Build DB Array */
- $db_array = array(
- 'title' => $this->request['title'],
- 'app' => $this->request['appDir'],
- 'text' => $text,
- 'description' => nl2br( $this->request['description'] ),
- );
-
- /* Insert help file */
- if( $type == 'new' )
- {
- /* Update the DB */
- $this->DB->insert( 'faq', $db_array );
-
- $id = $this->DB->getInsertId();
-
- /* Log */
- $this->registry->adminFunctions->saveAdminLog( $this->lang->words['h_addlog'] );
- }
- /* Update help file */
- else
- {
- /* ID */
- $id = intval( $this->request['id'] );
-
- if( ! $id )
- {
- $this->registry->output->showError( $this->lang->words['h_noid'], 11151 );
- }
-
- /* Update the DB */
- $this->DB->update( 'faq', $db_array, "id={$id}" );
-
- $this->registry->adminFunctions->saveAdminLog( $this->lang->words['h_edited']);
- }
-
- /* Bounce */
- $this->registry->output->silentRedirect( $this->settings['base_url'] . $this->form_code );
- }
-
- /**
- * Form for adding/editing help files
- *
- * @access public
- * @param string $type New or edit
- * @return void
- */
- public function helpFileForm( $type='new' )
- {
- /* INIT */
- $dropdown = array();
-
- /* Build Drop */
- foreach( ipsRegistry::$applications as $appDir => $appData )
- {
- $dropdown[] = array( $appDir, $appData['app_title'] );
- }
-
- /* Edit Help File */
- if( $type != 'new' )
- {
- /* ID */
- $id = intval( $this->request['id'] );
-
- if( ! $id )
- {
- $this->registry->output->showError( $this->lang->words['h_noid'], 11152 );
- }
-
- /* Query the help file */
- $this->DB->build( array( 'select' => '*', 'from' => 'faq', 'where' => "id=" . $id ) );
- $this->DB->execute();
-
- /* Make sure we found one */
- if( ! $r = $this->DB->fetch() )
- {
- $this->registry->output->showError( $this->lang->words['h_404'], 11153 );
- }
-
- /* Text bits */
- $button = $this->lang->words['h_editbutton'];
- $code = 'doedit';
- }
- else
- {
- /* Data */
- $r = array();
- $id = 0;
-
- /* Text Bits */
- $button = $this->lang->words['h_addbutton'];
- $code = 'donew';
- }
-
- /* Form Elements */
- $form = array();
-
- $form['title'] = $this->registry->output->formInput('title' , $r['title'] );
- $form['description'] = $this->registry->output->formTextarea('description', $r['description'] );
- $form['appDir'] = $this->registry->output->formDropdown( 'appDir', $dropdown, $r['app'] );
- $form['text'] = $r['text'];
-
- /* Ouput */
- $this->registry->output->html .= $this->html->helpFileForm( $code, $id, $form, $button );
- }
-
- /**
- * Reorders help files
- *
- * @access public
- * @return void
- */
- public function helpFilesReorder()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- require_once( IPS_KERNEL_PATH . 'classAjax.php' );
- $ajax = new classAjax();
-
- //-----------------------------------------
- // Checks...
- //-----------------------------------------
-
- if( $this->registry->adminFunctions->checkSecurityKey( $this->request['md5check'], true ) === false )
- {
- $ajax->returnString( $this->lang->words['postform_badmd5'] );
- exit();
- }
-
- //-----------------------------------------
- // Save new position
- //-----------------------------------------
-
- $position = 1;
-
- if( is_array($this->request['faq']) AND count($this->request['faq']) )
- {
- foreach( $this->request['faq'] as $this_id )
- {
- $this->DB->update( 'faq', array( 'position' => $position ), 'id=' . $this_id );
-
- $position++;
- }
- }
-
- //$this->registry->output->silentRedirect( $this->settings['base_url'] . $this->form_code );
- $ajax->returnString( 'OK' );
- exit();
- }
-
- /**
- * List current help files
- *
- * @access public
- * @return void
- */
- public function helpFilesList()
- {
- /* Query Help Files */
- $this->DB->build( array( 'select' => '*', 'from' => 'faq', 'order' => "position" ) );
- $this->DB->execute();
-
- /* Do we have help files? */
- $rows = array();
-
- if( $this->DB->getTotalRows() )
- {
- while( $r = $this->DB->fetch() )
- {
- /* Add to output array */
- $rows[] = $r;
- }
- }
-
- /* Output */
- $this->registry->output->html .= $this->html->helpFilesList( $rows );
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Help Files
+ * Last Updated: $LastChangedDate: 2010-10-19 10:40:05 -0400 (Tue, 19 Oct 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6995 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+
+class admin_core_tools_help extends ipsCommand
+{
+ /**
+ * Skin object
+ *
+ * @var object Skin templates
+ */
+ private $html;
+
+ /**
+ * Main class entry point
+ *
+ * @param object ipsRegistry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* Load lang and skin */
+ $this->registry->class_localization->loadLanguageFile( array( 'admin_tools' ) );
+ $this->html = $this->registry->output->loadTemplate( 'cp_skin_help_files' );
+
+ /* URLs */
+ $this->form_code = $this->html->form_code = 'module=tools§ion=help';
+ $this->form_code_js = $this->html->form_code_js = 'module=tools§ion=help';
+
+ /* What to do */
+ switch( $this->request['do'] )
+ {
+ case 'edit':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'help_manage' );
+ $this->helpFileForm( 'edit' );
+ break;
+
+ case 'new':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'help_manage' );
+ $this->helpFileForm( 'new' );
+ break;
+
+ case 'doedit':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'help_manage' );
+ $this->handleHelpFileForm( 'edit' );
+ break;
+
+ case 'doreorder':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'help_manage' );
+ $this->helpFilesReorder();
+ break;
+
+ case 'donew':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'help_manage' );
+ $this->handleHelpFileForm( 'new' );
+ break;
+
+ case 'remove':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'help_remove' );
+ $this->helpFileRemove();
+ break;
+
+ case 'exportXml':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'help_manage' );
+ $this->helpFilesXMLExport();
+ break;
+
+ case 'importXml':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'help_manage' );
+ $this->helpFilesXMLImport();
+ break;
+
+ case 'help_overview':
+ default:
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'help_manage' );
+ $this->helpFilesList();
+ break;
+ }
+
+ /* Output */
+ $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * Import help files XML
+ *
+ * @return void
+ */
+ public function helpFilesXMLImport()
+ {
+ /* INIT */
+ $messages = array();
+
+ /* Loop through all the applications */
+ foreach( $this->registry->getApplications() as $app => $__data )
+ {
+ $done = $this->helpFilesXMLImport_app( $app );
+ $messages[] = sprintf( $this->lang->words['h_import_added'], $app, $done['added'], $done['updated'] );
+
+ /* In dev time stamp? */
+ if ( IN_DEV )
+ {
+ $cache = $this->caches['indev'];
+ $cache['import']['help'][ $app ] = time();
+ $this->cache->setCache( 'indev', $cache, array( 'donow' => 1, 'array' => 1 ) );
+ }
+ }
+
+ $this->registry->output->global_message = $this->lang->words['h_imported'] . " " . implode( " ", $messages );
+ $this->helpFilesList();
+ }
+
+ /**
+ * Import help files XML helper. Abstracted so
+ * it can be used outside of this file.
+ *
+ * @param string App Directory
+ * @param bool Allow overwrite. If FALSE, it will not update.
+ * @return array Number of items added / updated
+ */
+ public function helpFilesXMLImport_app( $app, $overwrite=TRUE )
+ {
+ /* INIT */
+ $file = IPSLib::getAppDir( $app ) . '/xml/' . $app . '_help.xml';
+ $processed = array( 'added' => 0, 'updated' => 0 );
+
+ /* Got anything to import? */
+ if ( file_exists( $file ) )
+ {
+ require_once( IPS_KERNEL_PATH.'classXML.php' );
+
+ $xml = new classXML( IPS_DOC_CHAR_SET );
+ $xml->load( $file );
+
+ foreach( $xml->fetchElements('row') as $row )
+ {
+ $entry = $xml->fetchElementsFromRecord( $row );
+ $db = array( 'title' => $entry['title'],
+ 'text' => $entry['text'],
+ 'description' => $entry['description'],
+ 'position' => $entry['position'],
+ 'app' => $app );
+
+ if ( $entry['title'] )
+ {
+ $curFaq = $this->DB->buildAndFetch( array( 'select' => 'id', 'from' => 'faq', 'where' => "app='" . $app . "' AND title = '".$this->DB->addSlashes( $entry['title'] )."'" ) );
+
+ if ( $curFaq['id'] )
+ {
+ if ( $overwrite === TRUE )
+ {
+ $processed['updated']++;
+
+ $this->DB->update( 'faq', $db, "id = ". $curFaq['id'] );
+ }
+ }
+ else
+ {
+ $processed['added']++;
+
+ $this->DB->insert( 'faq', $db );
+ }
+ }
+ }
+ }
+
+ return $processed;
+ }
+
+ /**
+ * Export help files XML
+ *
+ * @return void
+ */
+ public function helpFilesXMLExport()
+ {
+ /* INIT */
+ $entry = array();
+
+ require_once( IPS_KERNEL_PATH.'classXML.php' );
+
+ /* Loop through all the applications */
+ foreach( $this->registry->getApplications() as $app => $__data )
+ {
+ $c = 0;
+
+ $xml = new classXML( IPS_DOC_CHAR_SET );
+ $xml->newXMLDocument();
+ $xml->addElement( 'export' );
+ $xml->addElement( 'help', 'export' );
+
+ /* Query tasks */
+ $this->DB->build( array( 'select' => '*', 'from' => 'faq', 'where' => "app='{$app}'" ) );
+ $this->DB->execute();
+
+ /* Loop through and add tasks to XML */
+ while ( $r = $this->DB->fetch() )
+ {
+ $c++;
+ unset( $r['id'] );
+
+ $r['text'] = str_replace( '%7Bstyle_image_url%7D', '{style_image_url}', $r['text'] );
+
+ $xml->addElementAsRecord( 'help', 'row', $r );
+ }
+
+ /* Finish XML */
+ $doc = $xml->fetchDocument();
+
+ @unlink( IPSLib::getAppDir( $app ) . '/xml/' . $app . '_help.xml' );
+
+ /* Write */
+ if( $doc and $c)
+ {
+ $fh = fopen( IPSLib::getAppDir( $app ) . '/xml/' . $app . '_help.xml', 'w' );
+ fwrite( $fh, $doc );
+ fclose( $fh );
+ }
+
+ /* In dev time stamp? */
+ if ( IN_DEV )
+ {
+ $cache = $this->caches['indev'];
+ $cache['import']['help'][ $app ] = time();
+ $this->cache->setCache( 'indev', $cache, array( 'donow' => 1, 'array' => 1 ) );
+ }
+ }
+
+ $this->registry->output->global_message = $this->lang->words['h_exported'];
+ $this->helpFilesList();
+ }
+
+ /**
+ * Removes a help file
+ *
+ * @return void
+ * @author Josh
+ */
+ public function helpFileRemove()
+ {
+ /* Check ID */
+ $id = intval( $this->request['id'] );
+ if( ! $id )
+ {
+ $this->registry->output->showError( $this->lang->words['h_noid'], 11149 );
+ }
+
+ /* Delete the record */
+ $this->DB->delete( 'faq', "id={$id}" );
+
+ /* Log and bounce */
+ $this->registry->adminFunctions->saveAdminLog( $this->lang->words['h_removed'] );
+ $this->registry->output->silentRedirect( $this->settings['base_url'] . $this->form_code );
+ }
+
+ /**
+ * Handles the add/edit help file form
+ *
+ * @param string $type Either new or edit
+ * @return void
+ */
+ public function handleHelpFileForm( $type='new' )
+ {
+ /* Error Checking */
+ if( ! $this->request['title'] )
+ {
+ $this->registry->output->showError( $this->lang->words['h_entertitle'], 11150 );
+ }
+
+ $text = trim( $_POST['editor_main'] );
+ $text = preg_replace( "/\\\/", "\", $text );
+ $text = str_replace( '%7Bstyle_image_url%7D', '{style_image_url}', $text );
+
+ /* Build DB Array */
+ $db_array = array(
+ 'title' => $this->request['title'],
+ 'app' => $this->request['appDir'],
+ 'text' => $text,
+ 'description' => nl2br( $this->request['description'] ),
+ );
+
+ /* Insert help file */
+ if( $type == 'new' )
+ {
+ /* Update the DB */
+ $this->DB->insert( 'faq', $db_array );
+
+ $id = $this->DB->getInsertId();
+
+ /* Log */
+ $this->registry->adminFunctions->saveAdminLog( $this->lang->words['h_addlog'] );
+ }
+ /* Update help file */
+ else
+ {
+ /* ID */
+ $id = intval( $this->request['id'] );
+
+ if( ! $id )
+ {
+ $this->registry->output->showError( $this->lang->words['h_noid'], 11151 );
+ }
+
+ /* Update the DB */
+ $this->DB->update( 'faq', $db_array, "id={$id}" );
+
+ $this->registry->adminFunctions->saveAdminLog( $this->lang->words['h_edited']);
+ }
+
+ /* Bounce */
+ $this->registry->output->silentRedirect( $this->settings['base_url'] . $this->form_code );
+ }
+
+ /**
+ * Form for adding/editing help files
+ *
+ * @param string $type New or edit
+ * @return void
+ */
+ public function helpFileForm( $type='new' )
+ {
+ /* INIT */
+ $dropdown = array();
+
+ /* Build Drop */
+ foreach( ipsRegistry::$applications as $appDir => $appData )
+ {
+ $dropdown[] = array( $appDir, $appData['app_title'] );
+ }
+
+ /* Edit Help File */
+ if( $type != 'new' )
+ {
+ /* ID */
+ $id = intval( $this->request['id'] );
+
+ if( ! $id )
+ {
+ $this->registry->output->showError( $this->lang->words['h_noid'], 11152 );
+ }
+
+ /* Query the help file */
+ $this->DB->build( array( 'select' => '*', 'from' => 'faq', 'where' => "id=" . $id ) );
+ $this->DB->execute();
+
+ /* Make sure we found one */
+ if( ! $r = $this->DB->fetch() )
+ {
+ $this->registry->output->showError( $this->lang->words['h_404'], 11153 );
+ }
+
+ /* Text bits */
+ $button = $this->lang->words['h_editbutton'];
+ $code = 'doedit';
+ }
+ else
+ {
+ /* Data */
+ $r = array();
+ $id = 0;
+
+ /* Text Bits */
+ $button = $this->lang->words['h_addbutton'];
+ $code = 'donew';
+ }
+
+ /* Form Elements */
+ $form = array();
+
+ $form['title'] = $this->registry->output->formInput('title' , $r['title'] );
+ $form['description'] = $this->registry->output->formTextarea('description', $r['description'] );
+ $form['appDir'] = $this->registry->output->formDropdown( 'appDir', $dropdown, $r['app'] );
+ $form['text'] = $r['text'];
+
+ /* Ouput */
+ $this->registry->output->html .= $this->html->helpFileForm( $code, $id, $form, $button );
+ }
+
+ /**
+ * Reorders help files
+ *
+ * @return void
+ */
+ public function helpFilesReorder()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
+ $ajax = new $classToLoad();
+
+ //-----------------------------------------
+ // Checks...
+ //-----------------------------------------
+
+ if( $this->registry->adminFunctions->checkSecurityKey( $this->request['md5check'], true ) === false )
+ {
+ $ajax->returnString( $this->lang->words['postform_badmd5'] );
+ exit();
+ }
+
+ //-----------------------------------------
+ // Save new position
+ //-----------------------------------------
+
+ $position = 1;
+
+ if( is_array($this->request['faq']) AND count($this->request['faq']) )
+ {
+ foreach( $this->request['faq'] as $this_id )
+ {
+ $this->DB->update( 'faq', array( 'position' => $position ), 'id=' . $this_id );
+
+ $position++;
+ }
+ }
+
+ //$this->registry->output->silentRedirect( $this->settings['base_url'] . $this->form_code );
+ $ajax->returnString( 'OK' );
+ exit();
+ }
+
+ /**
+ * List current help files
+ *
+ * @return void
+ */
+ public function helpFilesList()
+ {
+ /* Query Help Files */
+ $this->DB->build( array( 'select' => '*', 'from' => 'faq', 'order' => "position" ) );
+ $this->DB->execute();
+
+ /* Do we have help files? */
+ $rows = array();
+
+ if( $this->DB->getTotalRows() )
+ {
+ while( $r = $this->DB->fetch() )
+ {
+ /* Add to output array */
+ $rows[] = $r;
+ }
+ }
+
+ /* Output */
+ $this->registry->output->html .= $this->html->helpFilesList( $rows );
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/tools/incomingEmails.php b/upload/admin/applications/core/modules_admin/tools/incomingEmails.php
new file mode 100644
index 00000000..e37cae2f
--- /dev/null
+++ b/upload/admin/applications/core/modules_admin/tools/incomingEmails.php
@@ -0,0 +1,250 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Incoming Email Routing
+ * Last Updated: $LastChangedDate: 2010-10-04 11:44:10 -0400 (Mon, 04 Oct 2010) $
+ *
+ *
+ * @author $Author: mark $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6938 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+
+class admin_core_tools_incomingEmails extends ipsCommand
+{
+ /**
+ * Main entry point
+ *
+ * @access public
+ * @param object ipsRegistry reference
+ * @return void
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* Load lang and skin */
+ $this->registry->class_localization->loadLanguageFile( array( 'admin_tools' ) );
+ $this->html = $this->registry->output->loadTemplate( 'cp_skin_tools' );
+
+ $this->form_code = $this->html->form_code = 'module=tools§ion=incomingEmails';
+
+ /* What to do */
+ switch( $this->request['do'] )
+ {
+ case 'add':
+ $this->form('add');
+ break;
+
+ case 'edit':
+ $this->form('edit');
+ break;
+
+ case 'save':
+ $this->save();
+ break;
+
+ case 'delete':
+ $this->delete();
+ break;
+
+ case 'test':
+ $this->test();
+ default:
+ $this->manage();
+ break;
+ }
+
+ /* Output */
+ $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * Test POP3
+ *
+ * @access public
+ * @return void
+ */
+ protected function test()
+ {
+ require_once( IPS_KERNEL_PATH . '/pop3class/pop3.php' );
+ $pop3 = new pop3_class;
+
+ $pop3->hostname = $this->settings['pop3_server'];
+ $pop3->port = $this->settings['pop3_port'];
+ $pop3->tls = $this->settings['pop3_tls'];
+ $pop3->realm = '';
+ $pop3->workstation = '';
+ $pop3->authentication_mechanism = 'USER';
+ $pop3->debug = FALSE;
+ $pop3->html_debug = FALSE;
+ $pop3->join_continuation_header_lines = TRUE;
+
+ $user = $this->settings['pop3_user'];
+ $password = $this->settings['pop3_password'];
+ $apop = FALSE;
+
+ $open = $pop3->Open();
+ if ( $open != '' )
+ {
+ $this->registry->output->global_error = '' . $this->lang->words['pop3_err_connect'] . ' ' . $open;
+ return;
+ }
+
+ $login = $pop3->Login($user, $password, $apop );
+ if ( $login != '' )
+ {
+ $this->registry->output->global_error = '' . $this->lang->words['pop3_err_login'] . ' ' . $login;
+ return;
+ }
+
+ $messages = NULL;
+ $size = NULL;
+ $pop3->Statistics( $messages, $size );
+ if ( $messages === NULL or $size === NULL )
+ {
+ $this->registry->output->global_error = $this->lang->words['pop3_err_stats'];
+ }
+
+ $pop3->Close();
+
+ $this->registry->output->global_message = sprintf( $this->lang->words['pop3_okay'], $messages );
+ }
+
+ /**
+ * Manage Rules
+ *
+ * @access public
+ * @return void
+ */
+ protected function manage()
+ {
+ $rules = array();
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_incoming_emails' ) );
+ $this->DB->execute();
+ while ( $row = $this->DB->fetch() )
+ {
+ $rules[] = array(
+ 'id' => $row['rule_id'],
+ 'criteria' => $this->_getRuleText( $row['rule_criteria_field'], $row['rule_criteria_type'], $row['rule_criteria_value'] ),
+ 'action' => ( $row['rule_app'] == '--' ) ? $this->lang->words['ie_ignore'] : ( $this->lang->words['ie_sendto'] . ipsRegistry::$applications[ $row['rule_app'] ]['app_title'] )
+ );
+ }
+
+ $this->registry->output->html .= $this->html->manageEmailRules( $rules );
+ }
+
+ /**
+ * Show Form
+ *
+ * @access public
+ * @return void
+ */
+ protected function form( $type )
+ {
+ $current = array();
+ if ( $type == 'edit' )
+ {
+ $id = intval( $this->request['id'] );
+ $current = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_incoming_emails', 'where' => "rule_id={$id}" ) );
+ if ( !$current['rule_id'] )
+ {
+ ipsRegistry::getClass('output')->showError( 'ie_not_found', 12345 );
+ }
+ }
+
+ $applications = array();
+ foreach ( ipsRegistry::$applications as $dir => $app )
+ {
+ if ( file_exists( IPSLib::getAppDir( $dir ) . '/extensions/incomingEmails.php' ) )
+ {
+ $applications[] = array( $dir, $this->lang->words['ie_sendto'] . $app['app_title'] );
+ }
+ }
+
+ $this->registry->output->html .= $this->html->emailRuleForm( $current, $applications );
+ }
+
+ /**
+ * Action: Save
+ */
+ protected function save()
+ {
+ //-----------------------------------------
+ // Save
+ //-----------------------------------------
+
+ $save = array(
+ 'rule_criteria_field' => $this->request['criteria_field'],
+ 'rule_criteria_type' => $this->request['criteria_type'],
+ 'rule_criteria_value' => str_replace( '\', '\\', $this->request['criteria_value'] ),
+ 'rule_app' => $this->request['action'],
+ 'rule_added_by' => $this->memberData['member_id'],
+ 'rule_added_date' => time(),
+ );
+
+ if ( $this->request['id'] )
+ {
+ $id = intval( $this->request['id'] );
+ $this->DB->update( 'core_incoming_emails', $save, "rule_id={$id}" );
+
+ $this->registry->adminFunctions->saveAdminLog( sprintf( $this->lang->words['ie_updated'], $this->_getRuleText( $save['rule_criteria_field'], $save['rule_criteria_type'], $save['rule_criteria_value'] ) ) );
+ }
+ else
+ {
+ $this->DB->insert( 'core_incoming_emails', $save );
+ $this->registry->adminFunctions->saveAdminLog( sprintf( $this->lang->words['ie_added'], $this->_getRuleText( $save['rule_criteria_field'], $save['rule_criteria_type'], $save['rule_criteria_value'] ) ) );
+ }
+
+ //-----------------------------------------
+ // Display
+ //-----------------------------------------
+
+ $this->registry->output->global_message = $this->lang->words['ie_saved'];
+ $this->manage();
+ }
+
+ /**
+ * Action: Delete
+ */
+ protected function delete()
+ {
+ $id = intval( $this->request['id'] );
+ $current = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_incoming_emails', 'where' => "rule_id={$id}" ) );
+ if ( !$current['rule_id'] )
+ {
+ ipsRegistry::getClass('output')->showError( 'ie_not_found', 12345 );
+ }
+
+ $this->DB->delete( 'core_incoming_emails', "rule_id={$id}" );
+ $this->registry->adminFunctions->saveAdminLog( sprintf( $this->lang->words['ie_deleted'], $this->_getRuleText( $current['rule_criteria_field'], $current['rule_criteria_type'], $current['rule_criteria_value'] ) ) );
+
+ $this->registry->output->global_message = $this->lang->words['ie_delete_done'];
+ $this->manage();
+ }
+
+ /**
+ * Return human-readable interpretation of rule
+ *
+ * @param string field
+ * @param string type
+ * @param string value
+ * @return string
+ */
+ protected function _getRuleText( $field, $type, $value )
+ {
+ return $this->lang->words[ 'ie_cf_' . $field ] . ' ' . $this->lang->words[ 'ie_ct_' . $type ] . ' "' . $value . '"';
+ }
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/tools/index.html b/upload/admin/applications/core/modules_admin/tools/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/tools/index.html
+++ b/upload/admin/applications/core/modules_admin/tools/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/tools/licensekey.php b/upload/admin/applications/core/modules_admin/tools/licensekey.php
new file mode 100644
index 00000000..d6afa4c4
--- /dev/null
+++ b/upload/admin/applications/core/modules_admin/tools/licensekey.php
@@ -0,0 +1,177 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * License Manager
+ * Last Updated: $LastChangedDate$
+ *
+ *
+ * @author $Author$
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev$
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+
+class admin_core_tools_licensekey extends ipsCommand
+{
+ /**
+ * HTML object
+ *
+ * @var object
+ **/
+ private $html;
+
+ /**#@+
+ * URL bits
+ *
+ * @var string
+ */
+ public $form_code = '';
+ public $form_code_js = '';
+ /**#@-*/
+
+ /**
+ * Main entry point
+ *
+ * @param object ipsRegistry reference
+ * @return void
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* Load lang and skin */
+ $this->registry->class_localization->loadLanguageFile( array( 'admin_tools' ) );
+ $this->html = $this->registry->output->loadTemplate( 'cp_skin_tools' );
+
+ /* URLs */
+ $this->form_code = $this->html->form_code = 'module=tools§ion=licensekey';
+ $this->form_code_js = $this->html->form_code_js = 'module=tools§ion=licensekey';
+
+ /* What to do */
+ switch( $this->request['do'] )
+ {
+ case 'remove':
+ $this->remove();
+ break;
+
+ case 'activate':
+ $this->activate();
+ break;
+
+ case 'overview':
+ default:
+ $this->overview();
+ break;
+ }
+
+ /* Output */
+ $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
+ $this->registry->output->sendOutput();
+ }
+ /**
+ * Removes a license key
+ *
+ * @return void
+ */
+ public function remove()
+ {
+ /* Remove the key */
+ $this->DB->update( 'core_sys_conf_settings', array( 'conf_value' => '' ), "conf_key='ipb_reg_number'" );
+
+ /* Rebuild the cache */
+ $this->cache->rebuildCache( 'settings', 'global' );
+ $this->cache->setCache( 'licenseData', array(), array( 'array' => 1 ) );
+
+ /* Done */
+ $this->registry->output->silentRedirect( $this->settings['base_url'] . $this->form_code );
+ }
+
+ /**
+ * Activates a license
+ *
+ * @return void
+ */
+ public function activate()
+ {
+ /* Get the file managemnet class */
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classFileManagement.php', 'classFileManagement' );
+ $query = new $classToLoad();
+ $query->use_sockets = 1;
+
+ /* Query the api */
+
+ /* Decode */
+ $this->DB->update( 'core_sys_conf_settings', array( 'conf_value' => $this->request['license_key'] ), "conf_key='ipb_reg_number'" );
+ $this->cache->rebuildCache( 'settings', 'global' );
+ $this->cache->setCache( 'licenseData', array(), array( 'array' => 1 ) );
+
+ $this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . $this->form_code );
+ }
+
+ /**
+ * Displays license information
+ *
+ * @return void
+ */
+ public function overview()
+ {
+ /* Show activation form if we have no key */
+ if( ! $this->settings['ipb_reg_number'] )
+ {
+ $this->activateForm();
+ return;
+ }
+
+ /* Get License Data from cache */
+ $licenseData = $this->cache->getCache( 'licenseData' );
+
+ if( ! $licenseData || $this->request['refresh'] == 1 || ( IPS_UNIX_TIME_NOW - $licenseData['_cached_date'] ) > 86400 )
+ {
+ /* Get the file managemnet class */
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classFileManagement.php', 'classFileManagement' );
+ $query = new $classToLoad();
+ $query->use_sockets = 1;
+
+ /* Query the api */
+
+ /* Get License Data */
+
+ /* Save to cache */
+ $licenseData['_cached_date'] = time();
+ $this->cache->setCache( 'licenseData', $licenseData, array( 'array' => 1 ) );
+ }
+
+ /* Date */
+ $licenseData['_cached_date'] = $this->lang->formatTime( $licenseData['_cached_date'] );
+
+ /* Output */
+ $this->registry->output->html .= $this->html->licenseKeyStatusScreen( $this->settings['ipb_reg_number'], $licenseData );
+ }
+
+ /**
+ * Displays license key status
+ *
+ * @return void
+ */
+ public function activateForm()
+ {
+ /* Key Input */
+ $keyInput = $this->registry->output->formInput( 'license_key', $this->request['license_key'] );
+
+ /* Domain Input */
+ $domainInput = $this->registry->output->formInput( 'domain_key', $this->settings['board_url'] );
+
+ /* Output */
+ $this->registry->output->html .= $this->html->activateForm( $keyInput, $domainInput );
+ }
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/tools/login.php b/upload/admin/applications/core/modules_admin/tools/login.php
index b20558b4..67a1dd10 100644
--- a/upload/admin/applications/core/modules_admin/tools/login.php
+++ b/upload/admin/applications/core/modules_admin/tools/login.php
@@ -1,1163 +1,1186 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class admin_core_tools_login 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 language and skin
- //-----------------------------------------
-
- ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_tools' ) );
- $this->html = ipsRegistry::getClass('output')->loadTemplate('cp_skin_tools');
-
- //-----------------------------------------
- // Set URL shortcuts
- //-----------------------------------------
-
- $this->form_code = $this->html->form_code = 'module=tools§ion=login';
- $this->form_code_js = $this->html->form_code_js = 'module=tools§ion=login';
-
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'login_manage' );
-
- //-----------------------------------------
- // What are we doing now?
- //-----------------------------------------
-
- switch(ipsRegistry::$request['do'])
- {
- case 'manage':
- default:
- ipsRegistry::$request[ 'do'] = 'manage' ;
- $this->_loginList();
- break;
-
- case 'login_toggle':
- $this->_loginToggle();
- break;
-
- case 'login_uninstall':
- $this->_loginUninstall();
- break;
-
- case 'login_install':
- $this->_loginInstall();
- break;
-
- case 'login_reorder':
- $this->_loginReorder();
- break;
-
- case 'login_add':
- $this->_loginForm('add');
- break;
-
- case 'login_add_do':
- $this->_loginSave('add');
- break;
-
- case 'login_edit_details':
- $this->_loginForm('edit');
- break;
-
- case 'login_edit_do':
- $this->_loginSave('edit');
- break;
-
- case 'login_acp_conf':
- $this->_loginACPConf();
- break;
-
- case 'login_save_conf':
- $this->_loginSaveConf();
- break;
-
- case 'master_xml_export':
- $this->_masterXmlExport();
- break;
-
- case 'login_export':
- $this->_masterXmlExport( ipsRegistry::$request['login_id'] );
- break;
-
- case 'login_diagnostics':
- $this->_loginDiagnostics();
- 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();
- }
-
- /**
- * Save login method configuration details
- *
- * @access private
- * @return boolean Saved or not
- */
- private function _loginSaveConf()
- {
- //-----------------------------------------
- // Init Vars
- //-----------------------------------------
-
- $login_id = intval($this->request['login_id']);
-
- //-----------------------------------------
- // Check (please?)
- //-----------------------------------------
-
- $login = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_id=' . $login_id ) );
-
- if ( ! $login['login_id'] )
- {
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_404'];
- $this->_loginList();
- return false;
- }
-
- //-----------------------------------------
- // Generate file path
- //-----------------------------------------
-
- $mypath = IPS_PATH_CUSTOM_LOGIN . '/' . $login['login_folder_name'];
-
- //-----------------------------------------
- // Check (still waiting)
- //-----------------------------------------
-
- if( !file_exists( $mypath . '/acp.php' ) )
- {
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_noconfig'];
- $this->_loginList();
- return false;
- }
-
- if( !file_exists( $mypath . '/conf.php' ) )
- {
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_noconfigfile'];
- $this->_loginList();
- return false;
- }
-
- if( !is_writable( $mypath . '/conf.php' ) )
- {
- ipsRegistry::getClass('output')->global_message = $mypath . $this->lang->words['l_confwrite'];
- $this->_loginList();
- return false;
- }
-
- //-----------------------------------------
- // We all good?
- //-----------------------------------------
-
- require_once( $mypath . '/acp.php' );
- require_once( $mypath . '/conf.php' );
-
- if( !is_array($config) OR !count($config) )
- {
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_noconfig'];
- $this->_loginList();
- return false;
- }
-
- //-----------------------------------------
- // Teh form
- //-----------------------------------------
-
- $save = array();
-
- foreach( $config as $option )
- {
- if( $option['key'] )
- {
- $save[ $option['key'] ] = str_replace( '\', '\\', $_POST[ $option['key'] ] );
- }
- }
-
- $conf_file = '<' . '?php' . "\n\n";
-
- foreach( $save as $k => $v )
- {
- $conf_file .= '$LOGIN_CONF[' . "'" . $k . "'] = " . '"' . addslashes( $v ) . '";' . "\n";
- }
-
- $conf_file .= "\n\n?" . '>';
-
- if( $fh = @fopen( $mypath . '/conf.php', 'w' ) )
- {
- fwrite( $fh, $conf_file );
- fclose( $fh );
- }
- else
- {
- ipsRegistry::getClass('output')->global_message = $mypath . $this->lang->words['l_confwrite'];
- $this->_loginACPConf();
- return false;
- }
-
- ipsRegistry::getClass('output')->global_message = sprintf($this->lang->words['l_confup'], $login['login_title'] );
- $this->_loginList();
- return true;
- }
-
- /**
- * Configure details specific to a login method
- *
- * @access private
- * @return mixed Outputs, or return false
- */
- private function _loginACPConf()
- {
- //-----------------------------------------
- // Init Vars
- //-----------------------------------------
-
- $login_id = intval(ipsRegistry::$request['login_id']);
-
- //-----------------------------------------
- // Check (please?)
- //-----------------------------------------
-
- $login = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_id=' . $login_id ) );
-
- if ( ! $login['login_id'] )
- {
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_404'];
- $this->_loginList();
- return false;
- }
-
- //-----------------------------------------
- // Generate file path
- //-----------------------------------------
-
- $mypath = IPS_PATH_CUSTOM_LOGIN . '/' . $login['login_folder_name'];
-
- //-----------------------------------------
- // Check (still waiting)
- //-----------------------------------------
-
- if( !file_exists( $mypath . '/acp.php' ) )
- {
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_noconfig'];
- $this->_loginList();
- return false;
- }
-
- if( !file_exists( $mypath . '/conf.php' ) )
- {
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_noconfigfile'];
- $this->_loginList();
- return false;
- }
-
- if( !is_writable( $mypath . '/conf.php' ) )
- {
- ipsRegistry::getClass('output')->global_message = $mypath . $this->lang->words['l_confwrite'];
- $this->_loginList();
- return false;
- }
-
- //-----------------------------------------
- // We all good?
- //-----------------------------------------
-
- require_once( $mypath . '/acp.php' );
- require_once( $mypath . '/conf.php' );
-
- if( !is_array($config) OR !count($config) )
- {
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_noconfig'];
- $this->_loginList();
- return false;
- }
-
- //-----------------------------------------
- // Teh form
- //-----------------------------------------
-
- $form = array();
-
- foreach( $config as $option )
- {
- $form_control = '';
-
- if( $option['type'] == 'yesno' )
- {
- $form_control = ipsRegistry::getClass('output')->formYesNo( $option['key'], $_POST[ $option['key'] ] ? $_POST[ $option['key'] ] : $LOGIN_CONF[ $option['key'] ] );
- }
- else if( $option['type'] == 'select' )
- {
- $form_control = ipsRegistry::getClass('output')->formDropdown( $option['key'], $option['options'], $_POST[ $option['key'] ] ? $_POST[ $option['key'] ] : $LOGIN_CONF[ $option['key'] ] );
- }
- else
- {
- $form_control = ipsRegistry::getClass('output')->formInput( $option['key'], $_POST[ $option['key'] ] ? $_POST[ $option['key'] ] : $LOGIN_CONF[ $option['key'] ] );
- }
-
- $form[] = array(
- 'title' => $option['title'],
- 'description' => $option['description'],
- 'control' => $form_control
- );
- }
-
- ipsRegistry::getClass('output')->html .= $this->html->login_conf_form( $login, $form );
- }
-
-
- /**
- * Build XML file from array of data
- *
- * @access private
- * @param array Entries to add
- * @return string XML Document
- */
- private function _buildXML( $data=array() )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $entry = array();
-
- //-----------------------------------------
- // Get XML class
- //-----------------------------------------
-
- require_once( IPS_KERNEL_PATH . 'class_xml.php' );
- $xml = new class_xml();
- $xml->doc_type = IPS_DOC_CHAR_SET;
-
- $xml->xml_set_root( 'export', array( 'exported' => time() ) );
-
- //-----------------------------------------
- // Set group
- //-----------------------------------------
-
- $xml->xml_add_group( 'group' );
-
- foreach( $data as $thisentry => $r )
- {
- $content = array();
-
- if ( $r['login_folder_name'] == 'internal' )
- {
- $r['login_enabled'] = 1;
- }
- else if ( $r['login_folder_name'] == 'ipconverge' )
- {
- $r['login_maintain_url'] = '';
- $r['login_register_url'] = '';
- $r['login_login_url'] = '';
- $r['login_logout_url'] = '';
- $r['login_enabled'] = 0;
- }
- else
- {
- $r['login_enabled'] = 0;
- }
-
- //-----------------------------------------
- // Sort the fields...
- //-----------------------------------------
-
- foreach( $r as $k => $v )
- {
- if( in_array( $k, array( 'login_id', 'login_date' ) ) )
- {
- continue;
- }
-
- $content[] = $xml->xml_build_simple_tag( $k, $v );
- }
-
- $entry[] = $xml->xml_build_entry( 'row', $content );
- }
-
- $xml->xml_add_entry_to_group( 'group', $entry );
-
- $xml->xml_format_document();
-
- return $xml->xml_document;
- }
-
- /**
- * Export master XML file for installer
- *
- * @access private
- * @param integer [Optional] Login ID
- * @return void [Outputs to screen]
- */
- private function _masterXmlExport( $login_id=0 )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $entries = array();
- $where = '';
-
- if( $login_id )
- {
- $where = 'login_id=' . intval($login_id);
- }
-
- //-----------------------------------------
- // Get login methods
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*',
- 'from' => 'login_methods',
- 'where' => $where
- ) );
- $this->DB->execute();
-
- while ( $r = $this->DB->fetch() )
- {
- $entries[] = $r;
- }
-
- $document = $this->_buildXML( $entries );
-
- //-----------------------------------------
- // Print to browser
- //-----------------------------------------
-
- $filename = $login_id ? 'loginauth_install.xml' : 'loginauth.xml';
-
- ipsRegistry::getClass('output')->showDownload( $document, $filename, '', 0 );
- }
-
- /**
- * Shows the login 'diagnostics' screen
- *
- * @access private
- * @return mixed Outputs, or returns false
- */
- private function _loginDiagnostics()
- {
- //-----------------------------------------
- // Init Vars
- //-----------------------------------------
-
- $login_id = intval(ipsRegistry::$request['login_id']);
-
- //-----------------------------------------
- // Check (please?)
- //-----------------------------------------
-
- $login = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_id=' . $login_id ) );
-
- if ( ! $login['login_id'] )
- {
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_404'];
- $this->_loginList();
- return false;
- }
-
- //-----------------------------------------
- // Generate file
- //-----------------------------------------
-
- $mypath = IPS_PATH_CUSTOM_LOGIN . '/' . $login['login_folder_name'];
-
- //-----------------------------------------
- // Generate General Info
- //-----------------------------------------
-
- $login['_enabled_img'] = $login['login_enabled'] ? 'tick.png' : 'cross.png';
- $login['_has_settings'] = $login['login_settings'] ? 'tick.png' : 'cross.png';
-
- //-----------------------------------------
- // File based info
- //-----------------------------------------
-
- $login['_file_auth_exists'] = @file_exists( $mypath . '/auth.php' ) ? 'tick.png' : 'cross.png';
- $login['_file_conf_exists'] = @file_exists( $mypath . '/conf.php' ) ? 'tick.png' : 'cross.png';
- $login['_file_acp_exists'] = @file_exists( $mypath . '/acp.php' ) ? 'tick.png' : 'cross.png';
-
- $login['_file_conf_write'] = @is_writable( $mypath.'/conf.php' ) ? 'tick.png' : 'cross.png';
-
- ipsRegistry::getClass('output')->html .= $this->html->login_diagnostics( $login );
- }
-
- /**
- * Saves the login method to the database [add,edit]
- *
- * @access private
- * @param string Add or Edit flag
- * @return void [Outputs to screen]
- */
- private function _loginSave($type='add')
- {
- //--------------------------------------------
- // INIT
- //--------------------------------------------
-
- $login_id = intval(ipsRegistry::$request['login_id']);
- $login_title = trim( ipsRegistry::$request['login_title'] );
- $login_description = trim( IPSText::stripslashes( IPSText::UNhtmlspecialchars($_POST['login_description'])) );
- $login_folder_name = trim( ipsRegistry::$request['login_folder_name'] );
- $login_maintain_url = trim( ipsRegistry::$request['login_maintain_url'] );
- $login_register_url = trim( ipsRegistry::$request['login_register_url'] );
- $login_alt_login_html = trim( IPSText::stripslashes( IPSText::UNhtmlspecialchars($_POST['login_alt_login_html'])) );
- $login_alt_acp_html = trim( IPSText::stripslashes( IPSText::UNhtmlspecialchars($_POST['login_alt_acp_html'])) );
- $login_enabled = intval(ipsRegistry::$request['login_enabled']);
- $login_settings = intval(ipsRegistry::$request['login_settings']);
- $login_replace_form = intval(ipsRegistry::$request['login_replace_form']);
- $login_safemode = intval(ipsRegistry::$request['login_safemode']);
- $login_login_url = trim( ipsRegistry::$request['login_login_url'] );
- $login_logout_url = trim( ipsRegistry::$request['login_logout_url'] );
- $login_complete_page = trim( ipsRegistry::$request['login_complete_page'] );
- $login_user_id = in_array( ipsRegistry::$request['login_user_id'], array( 'username', 'email' ) ) ? ipsRegistry::$request['login_user_id'] : 'username';
-
- //--------------------------------------------
- // Checks...
- //--------------------------------------------
-
- if ( $type == 'edit' )
- {
- if ( ! $login_id )
- {
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_404'];
- $this->_loginList();
- return;
- }
- }
-
- if ( ! $login_title OR ! $login_folder_name )
- {
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_form'];
- $this->_loginForm( $type );
- return;
- }
-
- //--------------------------------------------
- // Save...
- //--------------------------------------------
-
- $array = array( 'login_title' => $login_title,
- 'login_description' => $login_description,
- 'login_folder_name' => $login_folder_name,
- 'login_maintain_url' => $login_maintain_url,
- 'login_register_url' => $login_register_url,
- 'login_alt_login_html' => $login_alt_login_html,
- 'login_alt_acp_html' => $login_alt_acp_html,
- 'login_enabled' => $login_enabled,
- 'login_settings' => $login_settings,
- 'login_replace_form' => $login_replace_form,
- 'login_logout_url' => $login_logout_url,
- 'login_login_url' => $login_login_url,
- 'login_user_id' => $login_user_id
- );
-
- //--------------------------------------------
- // In DEV?
- //--------------------------------------------
-
- if ( IN_DEV )
- {
- $array['login_safemode'] = $login_safemode;
- }
-
- //--------------------------------------------
- // Nike.. do it
- //--------------------------------------------
-
- if ( $type == 'add' )
- {
- $array['login_date'] = time();
-
- $this->DB->insert( 'login_methods', $array );
-
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_added'];
- }
- else
- {
- $this->DB->update( 'login_methods', $array, 'login_id='.$login_id );
-
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_edited'];
- }
-
- if( $login_folder_name == 'ipconverge' )
- {
- IPSLib::updateSettings( array( 'ipconverge_enabled' => $login_enabled ) );
- }
-
- //-----------------------------------------
- // Recache
- //-----------------------------------------
-
- $this->loginsRecache();
-
- $this->_loginList();
- }
-
- /**
- * Shows the login method form [add,edit]
- *
- * @access private
- * @param string Add or Edit flag
- * @return void [Outputs to screen]
- */
- private function _loginForm( $type='add' )
- {
- //-----------------------------------------
- // Init Vars
- //-----------------------------------------
-
- $login_id = intval(ipsRegistry::$request['login_id']);
-
- //-----------------------------------------
- // Check (please?)
- //-----------------------------------------
-
- if ( $type == 'add' )
- {
- $formcode = 'login_add_do';
- $title = $this->lang->words['l_registernew'];
- $button = $this->lang->words['l_registernew'];
- }
- else
- {
- $login = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_id='.$login_id ) );
-
- if ( ! $login['login_id'] )
- {
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_404'];
- $this->_loginList();
- return;
- }
-
- $formcode = 'login_edit_do';
- $title = "Edit Log In Method " . $login['login_title'];
- $button = "Save Changes";
- }
-
- //-----------------------------------------
- // Form elements
- //-----------------------------------------
-
- $valid_types = array( array( 'username', $this->lang->words['l_username'] ), array( 'email', $this->lang->words['l_email'] ) );
- $form = array();
-
- $form['login_title'] = ipsRegistry::getClass('output')->formInput( 'login_title' , $_POST['login_title'] ? $_POST['login_title'] : $login['login_title'] );
- $form['login_description'] = ipsRegistry::getClass('output')->formInput( 'login_description' , IPSText::htmlspecialchars( $_POST['login_description'] ? $_POST['login_description'] : $login['login_description'] ) );
- $form['login_folder_name'] = ipsRegistry::getClass('output')->formInput( 'login_folder_name' , $_POST['login_folder_name'] ? $_POST['login_folder_name'] : $login['login_folder_name'] );
- $form['login_maintain_url'] = ipsRegistry::getClass('output')->formInput( 'login_maintain_url' , $_POST['login_maintain_url'] ? $_POST['login_maintain_url'] : $login['login_maintain_url'] );
- $form['login_register_url'] = ipsRegistry::getClass('output')->formInput( 'login_register_url' , $_POST['login_register_url'] ? $_POST['login_register_url'] : $login['login_register_url'] );
- $form['login_login_url'] = ipsRegistry::getClass('output')->formInput( 'login_login_url' , $_POST['login_login_url'] ? $_POST['login_login_url'] : $login['login_login_url'] );
- $form['login_logout_url'] = ipsRegistry::getClass('output')->formInput( 'login_logout_url' , $_POST['login_logout_url'] ? $_POST['login_logout_url'] : $login['login_logout_url'] );
- $form['login_enabled'] = ipsRegistry::getClass('output')->formYesNo( 'login_enabled' , $_POST['login_enabled'] ? $_POST['login_enabled'] : $login['login_enabled'] );
- $form['login_settings'] = ipsRegistry::getClass('output')->formYesNo( 'login_settings' , $_POST['login_settings'] ? $_POST['login_settings'] : $login['login_settings'] );
- $form['login_register_url'] = ipsRegistry::getClass('output')->formInput( 'login_register_url' , $_POST['login_register_url'] ? $_POST['login_register_url'] : $login['login_register_url'] );
- $form['login_replace_form'] = ipsRegistry::getClass('output')->formYesNo( 'login_replace_form' , $_POST['login_replace_form'] ? $_POST['login_replace_form'] : $login['login_replace_form'] );
- $form['login_alt_login_html'] = ipsRegistry::getClass('output')->formTextarea( 'login_alt_login_html' , IPSText::htmlspecialchars( $_POST['login_alt_login_html'] ? $_POST['login_alt_login_html'] : $login['login_alt_login_html'] ) );
- $form['login_alt_acp_html'] = ipsRegistry::getClass('output')->formTextarea( 'login_alt_acp_html' , IPSText::htmlspecialchars( $_POST['login_alt_acp_html'] ? $_POST['login_alt_acp_html'] : $login['login_alt_acp_html'] ) );
- $form['login_user_id'] = ipsRegistry::getClass('output')->formDropdown( 'login_user_id' , $valid_types, $_POST['login_user_id'] ? $_POST['login_user_id'] : $login['login_user_id'] );
-
- if ( IN_DEV )
- {
- $form['login_safemode'] = ipsRegistry::getClass('output')->formYesNo( 'login_safemode' , $_POST['login_safemode'] ? $_POST['login_safemode'] : $login['login_safemode'] );
- }
-
- ipsRegistry::getClass('output')->html .= $this->html->login_form( $form, $title, $formcode, $button, $login );
- }
-
- /**
- * Lists the login method overview screen
- *
- * @access private
- * @return void [Outputs to screen]
- */
- private function _loginList()
- {
- //-----------------------------------------
- // Output
- //-----------------------------------------
-
- ipsRegistry::getClass('output')->nav[] = array( $this->form_code, $this->lang->words['l_nav'] );
-
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- require_once( IPS_KERNEL_PATH . 'class_xml.php' );
- $xml = new class_xml();
- $xml->doc_type = IPS_DOC_CHAR_SET;
- $content = "";
- $db_methods = array();
- $dir_methods = array();
- $installed = array();
-
- //-----------------------------------------
- // Get login methods from database
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'login_methods' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $r['login_installed'] = 1;
- $db_methods[ $r['login_order'] ] = $r;
- $installed[] = $r['login_folder_name'];
- }
-
- ksort( $db_methods );
-
- //-----------------------------------------
- // Now get the available login methods
- //-----------------------------------------
-
- $dh = opendir( IPS_PATH_CUSTOM_LOGIN );
-
- if ( $dh !== false )
- {
- while ( false !== ($file = readdir($dh) ) )
- {
- if( is_dir( IPS_PATH_CUSTOM_LOGIN . '/' . $file ) AND !in_array( $file, array( '.', '..', '.svn', '.DS_Store' ) ) )
- {
- $data = array( 'login_title' => $file, 'login_folder_name' => $file );
-
- if( file_exists( IPS_PATH_CUSTOM_LOGIN . '/' . $file . '/loginauth_install.xml' ) )
- {
- $file_content = file_get_contents( IPS_PATH_CUSTOM_LOGIN . '/' . $file . '/loginauth_install.xml' );
-
- $xml->xml_parse_document( $file_content );
-
- if( is_array($xml->xml_array['export']['group']['row']) )
- {
- foreach( $xml->xml_array['export']['group']['row'] as $f => $entry )
- {
- if( is_array($entry) )
- {
- foreach( $entry as $k => $v )
- {
- if ( $f == 'VALUE' or $f == 'login_id' )
- {
- continue;
- }
-
- $data[ $f ] = $v;
- }
- }
- }
- }
- }
-
- $data['acp_plugin'] = 0;
-
- if( file_exists( IPS_PATH_CUSTOM_LOGIN . '/' . $file . '/acp.php' ) AND file_exists( IPS_PATH_CUSTOM_LOGIN . '/' . $file . '/conf.php' ) )
- {
- $data['acp_plugin'] = 1;
- }
-
- $dir_methods[ $file ] = $data;
- }
- }
-
- closedir( $dh );
- }
-
- //-----------------------------------------
- // First...we show installed methods
- //-----------------------------------------
-
- $content .= $this->html->login_subheader( $this->lang->words['l_installed'] );
- $dbm_count = 0;
-
- if( count($db_methods ) )
- {
- foreach( $db_methods as $r )
- {
- $dbm_count++;
-
- $r['_enabled_img'] = $r['login_enabled'] ? 'tick.png' : 'cross.png';
- $r['acp_plugin'] = $dir_methods[ $r['login_folder_name'] ]['acp_plugin'];
-
- $content .= $this->html->login_row($r);
- }
- }
-
- if( !$dbm_count )
- {
- $content .= $this->html->login_norow( "installed" );
- }
-
- //-----------------------------------------
- // Then the ones not installed
- //-----------------------------------------
-
- $content .= $this->html->login_subheader( $this->lang->words['l_others'] );
- $dm_count = 0;
-
- if( count( $dir_methods ) )
- {
- foreach( $dir_methods as $r )
- {
- if( in_array( $r['login_folder_name'], $installed ) )
- {
- continue;
- }
-
- $dm_count++;
-
- // Need to set a bogus login id to ensure HTML ids are unique for the javascript
- $r['login_id'] = str_replace( '.', '', uniqid( 'abc', true ) );
-
- $r['_enabled_img'] = 'cross.png';
-
- $content .= $this->html->login_row($r);
- }
- }
-
- if( !$dm_count )
- {
- $content .= $this->html->login_norow( "uninstalled" );
- }
-
- ipsRegistry::getClass('output')->html .= $this->html->login_overview( $content );
- }
-
- /**
- * Toggle login method enabled/disabled
- *
- * @access private
- * @return void [Outputs to screen]
- */
- private function _loginToggle()
- {
- //--------------------------------------------
- // INIT
- //--------------------------------------------
-
- $login_id = intval(ipsRegistry::$request['login_id']);
-
- $login = $this->DB->buildAndFetch( array( 'select' => 'login_id, login_enabled, login_folder_name', 'from' => 'login_methods', 'where' => 'login_id=' . $login_id ) );
-
- if( !$login['login_id'] )
- {
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_404'];
- $this->_loginList();
- return;
- }
-
- if( $login['login_enabled'] )
- {
- $toggle = $this->lang->words['l_disabled'];
-
- $this->DB->update( 'login_methods', array( 'login_enabled' => 0 ), 'login_id=' . $login_id );
-
- if( $login['login_folder_name'] == 'ipconverge' )
- {
- IPSLib::updateSettings( array( 'ipconverge_enabled' => 0 ) );
- }
- }
- else
- {
- $toggle = $this->lang->words['l_enabled'];
-
- $this->DB->update( 'login_methods', array( 'login_enabled' => 1 ), 'login_id=' . $login_id );
-
- if( $login['login_folder_name'] == 'ipconverge' )
- {
- IPSLib::updateSettings( array( 'ipconverge_enabled' => 1 ) );
- }
- }
-
- //-----------------------------------------
- // Recache
- //-----------------------------------------
-
- $this->loginsRecache();
-
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_successfully'] . $toggle;
-
- $this->_loginList();
- }
-
- /**
- * Uninstall a login method
- *
- * @access private
- * @return void [Outputs to screen]
- */
- private function _loginUninstall()
- {
- //--------------------------------------------
- // INIT
- //--------------------------------------------
-
- $login_id = intval(ipsRegistry::$request['login_id']);
-
- $login = $this->DB->buildAndFetch( array( 'select' => 'login_id, login_enabled, login_folder_name', 'from' => 'login_methods', 'where' => 'login_id=' . $login_id ) );
-
- if( !$login['login_id'] )
- {
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_404'];
- $this->_loginList();
- return;
- }
-
- $this->DB->delete( 'login_methods', 'login_id=' . $login_id );
-
- if( $login['login_folder_name'] == 'ipconverge' )
- {
- IPSLib::updateSettings( array( 'ipconverge_enabled' => 0 ) );
- }
-
- //-----------------------------------------
- // Recache
- //-----------------------------------------
-
- $this->loginsRecache();
-
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_uninstalled'];
-
- $this->_loginList();
- }
-
- /**
- * Install a login method
- *
- * @access private
- * @return void [Outputs to screen]
- */
- private function _loginInstall()
- {
- //--------------------------------------------
- // INIT
- //--------------------------------------------
-
- require_once( IPS_KERNEL_PATH . 'class_xml.php' );
- $xml = new class_xml();
- $xml->doc_type = IPS_DOC_CHAR_SET;
-
- $login_id = basename(ipsRegistry::$request['login_folder']);
-
- //-----------------------------------------
- // Now get the XML data
- //-----------------------------------------
-
- $dh = opendir( IPS_PATH_CUSTOM_LOGIN );
-
- if ( $dh !== false )
- {
- while ( false !== ($file = readdir($dh) ) )
- {
- if( is_dir( IPS_PATH_CUSTOM_LOGIN . '/' . $file ) AND $file == $login_id )
- {
- if( file_exists( IPS_PATH_CUSTOM_LOGIN . '/' . $file . '/loginauth_install.xml' ) )
- {
- $file_content = file_get_contents( IPS_PATH_CUSTOM_LOGIN . '/' . $file . '/loginauth_install.xml' );
-
- $xml->xml_parse_document( $file_content );
-
- if( is_array($xml->xml_array['export']['group']['row']) )
- {
- foreach( $xml->xml_array['export']['group']['row'] as $f => $entry )
- {
- if( is_array($entry) )
- {
- foreach( $entry as $k => $v )
- {
- if ( $f == 'VALUE' or $f == 'login_id' )
- {
- continue;
- }
-
- $data[ $f ] = $v;
- }
- }
- }
- }
- }
- else
- {
- closedir( $dh );
-
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_installer404'];
- $this->_loginList();
- return;
- }
-
- $dir_methods[ $file ] = $data;
-
- break;
- }
- }
-
- closedir( $dh );
- }
-
- if( !is_array($dir_methods) OR !count($dir_methods) )
- {
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_installer404'];
- $this->_loginList();
- return;
- }
-
- //-----------------------------------------
- // Now verify it isn't installed
- //-----------------------------------------
-
- $login = $this->DB->buildAndFetch( array( 'select' => 'login_id', 'from' => 'login_methods', 'where' => "login_folder_name='" . $login_id . "'" ) );
-
- if( $login['login_id'] )
- {
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_already'];
- $this->_loginList();
- return;
- }
-
- //-----------------------------------------
- // Get the highest order and insert method
- //-----------------------------------------
-
- $max = $this->DB->buildAndFetch( array( 'select' => 'MAX(login_order) as highest_order', 'from' => 'login_methods' ) );
-
- $dir_methods[ $login_id ]['login_order'] = $max['highest_order'] + 1;
-
- $this->DB->insert( 'login_methods', $dir_methods[ $login_id ] );
-
- //-----------------------------------------
- // Recache
- //-----------------------------------------
-
- $this->loginsRecache();
-
- ipsRegistry::getClass('output')->global_message = $this->lang->words['l_yesinstalled'];
-
- $this->_loginList();
- }
-
- /**
- * Reorder a login method
- *
- * @access private
- * @return void [Outputs to screen]
- */
- private function _loginReorder()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- require_once( IPS_KERNEL_PATH . 'classAjax.php' );
- $ajax = new classAjax();
-
- //-----------------------------------------
- // Checks...
- //-----------------------------------------
-
- if( $this->registry->adminFunctions->checkSecurityKey( $this->request['md5check'], true ) === false )
- {
- $ajax->returnString( $this->lang->words['postform_badmd5'] );
- exit();
- }
-
- //-----------------------------------------
- // Save new position
- //-----------------------------------------
-
- $position = 1;
-
- if( is_array($this->request['logins']) AND count($this->request['logins']) )
- {
- foreach( $this->request['logins'] as $this_id )
- {
- $this->DB->update( 'login_methods', array( 'login_order' => $position ), 'login_id=' . $this_id );
-
- $position++;
- }
- }
-
- $this->loginsRecache();
-
- $ajax->returnString( 'OK' );
- exit();
- }
-
- /**
- * Updates cache store record
- *
- * @access public
- * @return boolean Cache store updated successfully
- */
- public function loginsRecache()
- {
- $cache = array();
-
- $this->DB->build( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1', 'order' => 'login_order ASC' ) );
- $this->DB->execute();
-
- while ( $r = $this->DB->fetch() )
- {
- $cache[ $r['login_id'] ] = $r;
- }
-
- ipsRegistry::cache()->setCache( 'login_methods', $cache, array( 'array' => 1 ) );
- }
-
-}
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Login Manager Administration
+ * Last Updated: $Date: 2010-10-19 10:40:05 -0400 (Tue, 19 Oct 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since Thursday 26th January 2006 (11:03)
+ * @version $Revision: 6995 $
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class admin_core_tools_login extends ipsCommand
+{
+ /**
+ * Skin object
+ *
+ * @var object Skin templates
+ */
+ private $html;
+
+ /**
+ * Shortcut for url
+ *
+ * @var string URL shortcut
+ */
+ private $form_code;
+
+ /**
+ * Shortcut for url (javascript)
+ *
+ * @var string JS URL shortcut
+ */
+ private $form_code_js;
+
+ /**
+ * Main class entry point
+ *
+ * @param object ipsRegistry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ //-----------------------------------------
+ // Load language and skin
+ //-----------------------------------------
+
+ ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_tools' ) );
+ $this->html = ipsRegistry::getClass('output')->loadTemplate('cp_skin_tools');
+
+ //-----------------------------------------
+ // Set URL shortcuts
+ //-----------------------------------------
+
+ $this->form_code = $this->html->form_code = 'module=tools§ion=login';
+ $this->form_code_js = $this->html->form_code_js = 'module=tools§ion=login';
+
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'login_manage' );
+
+ //-----------------------------------------
+ // What are we doing now?
+ //-----------------------------------------
+
+ switch(ipsRegistry::$request['do'])
+ {
+ case 'manage':
+ default:
+ ipsRegistry::$request[ 'do'] = 'manage' ;
+ $this->_loginList();
+ break;
+
+ case 'login_toggle':
+ $this->_loginToggle();
+ break;
+
+ case 'login_uninstall':
+ $this->_loginUninstall();
+ break;
+
+ case 'login_install':
+ $this->_loginInstall();
+ break;
+
+ case 'login_reorder':
+ $this->_loginReorder();
+ break;
+
+ case 'login_add':
+ $this->_loginForm('add');
+ break;
+
+ case 'login_add_do':
+ $this->_loginSave('add');
+ break;
+
+ case 'login_edit_details':
+ $this->_loginForm('edit');
+ break;
+
+ case 'login_edit_do':
+ $this->_loginSave('edit');
+ break;
+
+ case 'login_acp_conf':
+ $this->_loginACPConf();
+ break;
+
+ case 'login_save_conf':
+ $this->_loginSaveConf();
+ break;
+
+ case 'master_xml_export':
+ $this->_masterXmlExport();
+ break;
+
+ case 'login_export':
+ $this->_masterXmlExport( ipsRegistry::$request['login_id'] );
+ break;
+
+ case 'login_diagnostics':
+ $this->_loginDiagnostics();
+ 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();
+ }
+
+ /**
+ * Save login method configuration details
+ *
+ * @return boolean Saved or not
+ */
+ private function _loginSaveConf()
+ {
+ //-----------------------------------------
+ // Init Vars
+ //-----------------------------------------
+
+ $login_id = intval($this->request['login_id']);
+
+ //-----------------------------------------
+ // Check (please?)
+ //-----------------------------------------
+
+ $login = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_id=' . $login_id ) );
+
+ if ( ! $login['login_id'] )
+ {
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_404'];
+ $this->_loginList();
+ return false;
+ }
+
+ //-----------------------------------------
+ // Generate file path
+ //-----------------------------------------
+
+ $mypath = IPS_PATH_CUSTOM_LOGIN . '/' . $login['login_folder_name'];
+
+ //-----------------------------------------
+ // Check (still waiting)
+ //-----------------------------------------
+
+ if( !file_exists( $mypath . '/acp.php' ) )
+ {
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_noconfig'];
+ $this->_loginList();
+ return false;
+ }
+
+ if( !file_exists( $mypath . '/conf.php' ) )
+ {
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_noconfigfile'];
+ $this->_loginList();
+ return false;
+ }
+
+ if( !is_writable( $mypath . '/conf.php' ) )
+ {
+ ipsRegistry::getClass('output')->global_message = $mypath . $this->lang->words['l_confwrite'];
+ $this->_loginList();
+ return false;
+ }
+
+ //-----------------------------------------
+ // We all good?
+ //-----------------------------------------
+ $config = array();
+ require_once( $mypath . '/acp.php' );
+ require_once( $mypath . '/conf.php' );
+
+ if( !is_array($config) OR !count($config) )
+ {
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_noconfig'];
+ $this->_loginList();
+ return false;
+ }
+
+ //-----------------------------------------
+ // Teh form
+ //-----------------------------------------
+
+ $save = array();
+
+ foreach( $config as $option )
+ {
+ if( $option['key'] )
+ {
+ $save[ $option['key'] ] = str_replace( '\', '\\', $_POST[ $option['key'] ] );
+ }
+ }
+
+ $conf_file = '<' . '?php' . "\n\n";
+
+ foreach( $save as $k => $v )
+ {
+ $conf_file .= '$LOGIN_CONF[' . "'" . $k . "'] = " . '"' . addslashes( $v ) . '";' . "\n";
+ }
+
+ $conf_file .= "\n\n?" . '>';
+
+ if( $fh = @fopen( $mypath . '/conf.php', 'w' ) )
+ {
+ fwrite( $fh, $conf_file );
+ fclose( $fh );
+ }
+ else
+ {
+ ipsRegistry::getClass('output')->global_message = $mypath . $this->lang->words['l_confwrite'];
+ $this->_loginACPConf();
+ return false;
+ }
+
+ ipsRegistry::getClass('output')->global_message = sprintf($this->lang->words['l_confup'], $login['login_title'] );
+ $this->_loginList();
+ return true;
+ }
+
+ /**
+ * Configure details specific to a login method
+ *
+ * @return mixed Outputs, or return false
+ */
+ private function _loginACPConf()
+ {
+ //-----------------------------------------
+ // Init Vars
+ //-----------------------------------------
+
+ $login_id = intval(ipsRegistry::$request['login_id']);
+
+ //-----------------------------------------
+ // Check (please?)
+ //-----------------------------------------
+
+ $login = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_id=' . $login_id ) );
+
+ if ( ! $login['login_id'] )
+ {
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_404'];
+ $this->_loginList();
+ return false;
+ }
+
+ //-----------------------------------------
+ // Generate file path
+ //-----------------------------------------
+
+ $mypath = IPS_PATH_CUSTOM_LOGIN . '/' . $login['login_folder_name'];
+
+ //-----------------------------------------
+ // Check (still waiting)
+ //-----------------------------------------
+
+ if( !file_exists( $mypath . '/acp.php' ) )
+ {
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_noconfig'];
+ $this->_loginList();
+ return false;
+ }
+
+ if( !file_exists( $mypath . '/conf.php' ) )
+ {
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_noconfigfile'];
+ $this->_loginList();
+ return false;
+ }
+
+ if( !is_writable( $mypath . '/conf.php' ) )
+ {
+ ipsRegistry::getClass('output')->global_message = $mypath . $this->lang->words['l_confwrite'];
+ $this->_loginList();
+ return false;
+ }
+
+ //-----------------------------------------
+ // We all good?
+ //-----------------------------------------
+ $config = array();
+ $LOGIN_CONF = array();
+ require_once( $mypath . '/acp.php' );
+ require_once( $mypath . '/conf.php' );
+
+ if( !is_array($config) OR !count($config) )
+ {
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_noconfig'];
+ $this->_loginList();
+ return false;
+ }
+
+ //-----------------------------------------
+ // Teh form
+ //-----------------------------------------
+ $form = array();
+
+ foreach( $config as $option )
+ {
+ $form_control = '';
+
+ if( $option['type'] == 'yesno' )
+ {
+ $form_control = ipsRegistry::getClass('output')->formYesNo( $option['key'], $_POST[ $option['key'] ] ? $_POST[ $option['key'] ] : $LOGIN_CONF[ $option['key'] ] );
+ }
+ else if( $option['type'] == 'select' )
+ {
+ $form_control = ipsRegistry::getClass('output')->formDropdown( $option['key'], $option['options'], $_POST[ $option['key'] ] ? $_POST[ $option['key'] ] : $LOGIN_CONF[ $option['key'] ] );
+ }
+ else
+ {
+ $form_control = ipsRegistry::getClass('output')->formInput( $option['key'], $_POST[ $option['key'] ] ? $_POST[ $option['key'] ] : $LOGIN_CONF[ $option['key'] ] );
+ }
+
+ $form[] = array(
+ 'title' => $option['title'],
+ 'description' => $option['description'],
+ 'control' => $form_control
+ );
+ }
+
+ ipsRegistry::getClass('output')->html .= $this->html->login_conf_form( $login, $form );
+ }
+
+
+ /**
+ * Build XML file from array of data
+ *
+ * @param array Entries to add
+ * @return string XML Document
+ */
+ private function _buildXML( $data=array() )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $entry = array();
+
+ //-----------------------------------------
+ // Get XML class
+ //-----------------------------------------
+
+ require_once( IPS_KERNEL_PATH . 'class_xml.php' );
+ $xml = new class_xml();
+ $xml->doc_type = IPS_DOC_CHAR_SET;
+
+ $xml->xml_set_root( 'export', array( 'exported' => time() ) );
+
+ //-----------------------------------------
+ // Set group
+ //-----------------------------------------
+
+ $xml->xml_add_group( 'group' );
+
+ foreach( $data as $thisentry => $r )
+ {
+ $content = array();
+
+ if ( $r['login_folder_name'] == 'internal' )
+ {
+ $r['login_enabled'] = 1;
+ }
+ else if ( $r['login_folder_name'] == 'ipconverge' )
+ {
+ $r['login_maintain_url'] = '';
+ $r['login_register_url'] = '';
+ $r['login_login_url'] = '';
+ $r['login_logout_url'] = '';
+ $r['login_enabled'] = 0;
+ }
+ else
+ {
+ $r['login_enabled'] = 0;
+ }
+
+ //-----------------------------------------
+ // Sort the fields...
+ //-----------------------------------------
+
+ foreach( $r as $k => $v )
+ {
+ if( in_array( $k, array( 'login_id' ) ) )
+ {
+ continue;
+ }
+
+ $content[] = $xml->xml_build_simple_tag( $k, $v );
+ }
+
+ $entry[] = $xml->xml_build_entry( 'row', $content );
+ }
+
+ $xml->xml_add_entry_to_group( 'group', $entry );
+
+ $xml->xml_format_document();
+
+ return $xml->xml_document;
+ }
+
+ /**
+ * Export master XML file for installer
+ *
+ * @param integer [Optional] Login ID
+ * @return void [Outputs to screen]
+ */
+ private function _masterXmlExport( $login_id=0 )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $entries = array();
+ $where = '';
+
+ if( $login_id )
+ {
+ $where = 'login_id=' . intval($login_id);
+ }
+
+ //-----------------------------------------
+ // Get login methods
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'login_methods',
+ 'where' => $where
+ ) );
+ $this->DB->execute();
+
+ while ( $r = $this->DB->fetch() )
+ {
+ $entries[] = $r;
+ }
+
+ $document = $this->_buildXML( $entries );
+
+ //-----------------------------------------
+ // Print to browser
+ //-----------------------------------------
+
+ $filename = $login_id ? 'loginauth_install.xml' : 'loginauth.xml';
+
+ ipsRegistry::getClass('output')->showDownload( $document, $filename, '', 0 );
+ }
+
+ /**
+ * Shows the login 'diagnostics' screen
+ *
+ * @return mixed Outputs, or returns false
+ */
+ private function _loginDiagnostics()
+ {
+ //-----------------------------------------
+ // Init Vars
+ //-----------------------------------------
+
+ $login_id = intval(ipsRegistry::$request['login_id']);
+
+ //-----------------------------------------
+ // Check (please?)
+ //-----------------------------------------
+
+ $login = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_id=' . $login_id ) );
+
+ if ( ! $login['login_id'] )
+ {
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_404'];
+ $this->_loginList();
+ return false;
+ }
+
+ //-----------------------------------------
+ // Generate file
+ //-----------------------------------------
+
+ $mypath = IPS_PATH_CUSTOM_LOGIN . '/' . $login['login_folder_name'];
+
+ //-----------------------------------------
+ // Generate General Info
+ //-----------------------------------------
+
+ $login['_enabled_img'] = $login['login_enabled'] ? 'tick.png' : 'cross.png';
+ $login['_has_settings'] = $login['login_settings'] ? 'tick.png' : 'cross.png';
+
+ //-----------------------------------------
+ // File based info
+ //-----------------------------------------
+
+ $login['_file_auth_exists'] = @file_exists( $mypath . '/auth.php' ) ? 'tick.png' : 'cross.png';
+ $login['_file_conf_exists'] = @file_exists( $mypath . '/conf.php' ) ? 'tick.png' : 'cross.png';
+ $login['_file_acp_exists'] = @file_exists( $mypath . '/acp.php' ) ? 'tick.png' : 'cross.png';
+
+ $login['_file_conf_write'] = @is_writable( $mypath.'/conf.php' ) ? 'tick.png' : 'cross.png';
+
+ /* Try to setup the module */
+ require_once( IPS_PATH_CUSTOM_LOGIN . '/login_core.php' );
+ require_once( IPS_PATH_CUSTOM_LOGIN . '/login_interface.php' );
+
+ if( file_exists( IPS_PATH_CUSTOM_LOGIN . '/' . $login['login_folder_name'] . '/auth.php' ) )
+ {
+ $classFile = IPS_PATH_CUSTOM_LOGIN . '/' . $login['login_folder_name'] . '/auth.php';
+ $config = IPS_PATH_CUSTOM_LOGIN . '/' . $login['login_folder_name'] . '/conf.php';
+
+ if( file_exists( $config ) )
+ {
+ $LOGIN_CONF = array();
+ require( $config );
+ }
+
+ $classname = "login_" . $login['login_folder_name'];
+
+ require_once( $classFile );
+ $module = new $classname( $this->registry, $login, $LOGIN_CONF );
+
+ if( $module->missingModules )
+ {
+ $login['_missingModules'] = implode( ', ', $module->missingModules );
+ }
+ }
+
+ ipsRegistry::getClass('output')->html .= $this->html->login_diagnostics( $login );
+ }
+
+ /**
+ * Saves the login method to the database [add,edit]
+ *
+ * @param string Add or Edit flag
+ * @return void [Outputs to screen]
+ */
+ private function _loginSave($type='add')
+ {
+ //--------------------------------------------
+ // INIT
+ //--------------------------------------------
+
+ $login_id = intval(ipsRegistry::$request['login_id']);
+ $login_title = trim( ipsRegistry::$request['login_title'] );
+ $login_description = trim( IPSText::stripslashes( IPSText::UNhtmlspecialchars($_POST['login_description'])) );
+ $login_folder_name = trim( ipsRegistry::$request['login_folder_name'] );
+ $login_maintain_url = trim( ipsRegistry::$request['login_maintain_url'] );
+ $login_register_url = trim( ipsRegistry::$request['login_register_url'] );
+ $login_alt_login_html = trim( IPSText::stripslashes( IPSText::UNhtmlspecialchars($_POST['login_alt_login_html'])) );
+ $login_alt_acp_html = trim( IPSText::stripslashes( IPSText::UNhtmlspecialchars($_POST['login_alt_acp_html'])) );
+ $login_enabled = intval(ipsRegistry::$request['login_enabled']);
+ $login_settings = intval(ipsRegistry::$request['login_settings']);
+ $login_replace_form = intval(ipsRegistry::$request['login_replace_form']);
+ $login_safemode = intval(ipsRegistry::$request['login_safemode']);
+ $login_login_url = trim( ipsRegistry::$request['login_login_url'] );
+ $login_logout_url = trim( ipsRegistry::$request['login_logout_url'] );
+ $login_complete_page = trim( ipsRegistry::$request['login_complete_page'] );
+ $login_user_id = in_array( ipsRegistry::$request['login_user_id'], array( 'username', 'email', 'either' ) ) ? ipsRegistry::$request['login_user_id'] : 'username';
+
+ //--------------------------------------------
+ // Checks...
+ //--------------------------------------------
+
+ if ( $type == 'edit' )
+ {
+ if ( ! $login_id )
+ {
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_404'];
+ $this->_loginList();
+ return;
+ }
+ }
+
+ if ( ! $login_title OR ! $login_folder_name )
+ {
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_form'];
+ $this->_loginForm( $type );
+ return;
+ }
+
+ //--------------------------------------------
+ // Save...
+ //--------------------------------------------
+
+ $array = array( 'login_title' => $login_title,
+ 'login_description' => $login_description,
+ 'login_folder_name' => $login_folder_name,
+ 'login_maintain_url' => $login_maintain_url,
+ 'login_register_url' => $login_register_url,
+ 'login_alt_login_html' => $login_alt_login_html,
+ 'login_alt_acp_html' => $login_alt_acp_html,
+ 'login_enabled' => $login_enabled,
+ 'login_settings' => $login_settings,
+ 'login_replace_form' => $login_replace_form,
+ 'login_logout_url' => $login_logout_url,
+ 'login_login_url' => $login_login_url,
+ 'login_user_id' => $login_user_id
+ );
+
+ //--------------------------------------------
+ // In DEV?
+ //--------------------------------------------
+
+ if ( IN_DEV )
+ {
+ $array['login_safemode'] = $login_safemode;
+ }
+
+ //--------------------------------------------
+ // Nike.. do it
+ //--------------------------------------------
+
+ if ( $type == 'add' )
+ {
+ $this->DB->insert( 'login_methods', $array );
+
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_added'];
+ }
+ else
+ {
+ $this->DB->update( 'login_methods', $array, 'login_id='.$login_id );
+
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_edited'];
+ }
+
+ if( $login_folder_name == 'ipconverge' )
+ {
+ IPSLib::updateSettings( array( 'ipconverge_enabled' => $login_enabled ) );
+ }
+
+ //-----------------------------------------
+ // Recache
+ //-----------------------------------------
+
+ $this->loginsRecache();
+
+ $this->_loginList();
+ }
+
+ /**
+ * Shows the login method form [add,edit]
+ *
+ * @param string Add or Edit flag
+ * @return void [Outputs to screen]
+ */
+ private function _loginForm( $type='add' )
+ {
+ //-----------------------------------------
+ // Init Vars
+ //-----------------------------------------
+
+ $login_id = intval(ipsRegistry::$request['login_id']);
+
+ //-----------------------------------------
+ // Check (please?)
+ //-----------------------------------------
+
+ if ( $type == 'add' )
+ {
+ $formcode = 'login_add_do';
+ $title = $this->lang->words['l_registernew'];
+ $button = $this->lang->words['l_registernew'];
+ }
+ else
+ {
+ $login = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_id='.$login_id ) );
+
+ if ( ! $login['login_id'] )
+ {
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_404'];
+ $this->_loginList();
+ return;
+ }
+
+ $formcode = 'login_edit_do';
+ $title = $this->lang->words['editloginmethod'] . $login['login_title'];
+ $button = $this->lang->words['sl_form_edit_button'];
+ }
+
+ //-----------------------------------------
+ // Form elements
+ //-----------------------------------------
+
+ $valid_types = array( array( 'username', $this->lang->words['l_username'] ), array( 'email', $this->lang->words['l_email'] ), array( 'either', $this->lang->words['l_username_or_email'] ) );
+ $form = array();
+
+ $form['login_title'] = ipsRegistry::getClass('output')->formInput( 'login_title' , $_POST['login_title'] ? $_POST['login_title'] : $login['login_title'] );
+ $form['login_description'] = ipsRegistry::getClass('output')->formInput( 'login_description' , IPSText::htmlspecialchars( $_POST['login_description'] ? $_POST['login_description'] : $login['login_description'] ) );
+ $form['login_folder_name'] = ipsRegistry::getClass('output')->formInput( 'login_folder_name' , $_POST['login_folder_name'] ? $_POST['login_folder_name'] : $login['login_folder_name'] );
+ $form['login_maintain_url'] = ipsRegistry::getClass('output')->formInput( 'login_maintain_url' , $_POST['login_maintain_url'] ? $_POST['login_maintain_url'] : $login['login_maintain_url'] );
+ $form['login_register_url'] = ipsRegistry::getClass('output')->formInput( 'login_register_url' , $_POST['login_register_url'] ? $_POST['login_register_url'] : $login['login_register_url'] );
+ $form['login_login_url'] = ipsRegistry::getClass('output')->formInput( 'login_login_url' , $_POST['login_login_url'] ? $_POST['login_login_url'] : $login['login_login_url'] );
+ $form['login_logout_url'] = ipsRegistry::getClass('output')->formInput( 'login_logout_url' , $_POST['login_logout_url'] ? $_POST['login_logout_url'] : $login['login_logout_url'] );
+ $form['login_enabled'] = ipsRegistry::getClass('output')->formYesNo( 'login_enabled' , $_POST['login_enabled'] ? $_POST['login_enabled'] : $login['login_enabled'] );
+ $form['login_settings'] = ipsRegistry::getClass('output')->formYesNo( 'login_settings' , $_POST['login_settings'] ? $_POST['login_settings'] : $login['login_settings'] );
+ $form['login_register_url'] = ipsRegistry::getClass('output')->formInput( 'login_register_url' , $_POST['login_register_url'] ? $_POST['login_register_url'] : $login['login_register_url'] );
+ $form['login_replace_form'] = ipsRegistry::getClass('output')->formYesNo( 'login_replace_form' , $_POST['login_replace_form'] ? $_POST['login_replace_form'] : $login['login_replace_form'] );
+ $form['login_alt_login_html'] = ipsRegistry::getClass('output')->formTextarea( 'login_alt_login_html' , IPSText::htmlspecialchars( $_POST['login_alt_login_html'] ? $_POST['login_alt_login_html'] : $login['login_alt_login_html'] ) );
+ $form['login_alt_acp_html'] = ipsRegistry::getClass('output')->formTextarea( 'login_alt_acp_html' , IPSText::htmlspecialchars( $_POST['login_alt_acp_html'] ? $_POST['login_alt_acp_html'] : $login['login_alt_acp_html'] ) );
+ $form['login_user_id'] = ipsRegistry::getClass('output')->formDropdown( 'login_user_id' , $valid_types, $_POST['login_user_id'] ? $_POST['login_user_id'] : $login['login_user_id'] );
+
+ if ( IN_DEV )
+ {
+ $form['login_safemode'] = ipsRegistry::getClass('output')->formYesNo( 'login_safemode' , $_POST['login_safemode'] ? $_POST['login_safemode'] : $login['login_safemode'] );
+ }
+
+ ipsRegistry::getClass('output')->html .= $this->html->login_form( $form, $title, $formcode, $button, $login );
+ }
+
+ /**
+ * Lists the login method overview screen
+ *
+ * @return void [Outputs to screen]
+ */
+ private function _loginList()
+ {
+ //-----------------------------------------
+ // Output
+ //-----------------------------------------
+
+ ipsRegistry::getClass('output')->nav[] = array( $this->form_code, $this->lang->words['l_nav'] );
+
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ require_once( IPS_KERNEL_PATH . 'class_xml.php' );
+ $xml = new class_xml();
+ $xml->doc_type = IPS_DOC_CHAR_SET;
+ $content = "";
+ $db_methods = array();
+ $dir_methods = array();
+ $installed = array();
+ $missing = array();
+
+ //-----------------------------------------
+ // Get login methods from database
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'login_methods' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $r['login_installed'] = 1;
+ $db_methods[ $r['login_order'] ] = $r;
+ $installed[] = $r['login_folder_name'];
+ }
+
+ ksort( $db_methods );
+
+ //-----------------------------------------
+ // Now get the available login methods
+ //-----------------------------------------
+
+ $dh = opendir( IPS_PATH_CUSTOM_LOGIN );
+
+ if ( $dh !== false )
+ {
+ while ( false !== ($file = readdir($dh) ) )
+ {
+ if( is_dir( IPS_PATH_CUSTOM_LOGIN . '/' . $file ) AND !in_array( $file, array( '.', '..', '.svn', '.DS_Store', '_vti_cnf' ) ) )
+ {
+ $data = array( 'login_title' => $file, 'login_folder_name' => $file );
+
+ if( file_exists( IPS_PATH_CUSTOM_LOGIN . '/' . $file . '/loginauth_install.xml' ) )
+ {
+ $file_content = file_get_contents( IPS_PATH_CUSTOM_LOGIN . '/' . $file . '/loginauth_install.xml' );
+
+ $xml->xml_parse_document( $file_content );
+
+ if( is_array($xml->xml_array['export']['group']['row']) )
+ {
+ foreach( $xml->xml_array['export']['group']['row'] as $f => $entry )
+ {
+ if( is_array($entry) )
+ {
+ foreach( $entry as $k => $v )
+ {
+ if ( $f == 'VALUE' or $f == 'login_id' )
+ {
+ continue;
+ }
+
+ $data[ $f ] = $v;
+ }
+ }
+ }
+ }
+ }
+
+ $data['acp_plugin'] = 0;
+
+ if( file_exists( IPS_PATH_CUSTOM_LOGIN . '/' . $file . '/acp.php' ) )
+ {
+ if ( file_exists( IPS_PATH_CUSTOM_LOGIN . '/' . $file . '/conf.php' ) )
+ {
+ $data['acp_plugin'] = 1;
+ }
+ else if ( file_exists( IPS_PATH_CUSTOM_LOGIN . '/' . $file . '/conf.dist.php' ) )
+ {
+ $missing[] = IPS_PATH_CUSTOM_LOGIN . '/' . $file . '/';
+ }
+ }
+
+ $dir_methods[ $file ] = $data;
+ }
+ }
+
+ closedir( $dh );
+ }
+
+ //-----------------------------------------
+ // Got some folders with the .dist.php files?
+ //-----------------------------------------
+
+ if ( count( $missing ) )
+ {
+ $this->registry->output->showError( sprintf( $this->lang->words['l_rename_conf'], implode( "", $missing ) ) );
+ }
+
+ //-----------------------------------------
+ // First...we show installed methods
+ //-----------------------------------------
+
+ $content .= $this->html->login_subheader( $this->lang->words['l_installed'] );
+ $dbm_count = 0;
+
+ if( count($db_methods ) )
+ {
+ foreach( $db_methods as $r )
+ {
+ $dbm_count++;
+
+ $r['_enabled_img'] = $r['login_enabled'] ? 'tick.png' : 'cross.png';
+ $r['acp_plugin'] = $dir_methods[ $r['login_folder_name'] ]['acp_plugin'];
+
+ $content .= $this->html->login_row($r);
+ }
+ }
+
+ if( !$dbm_count )
+ {
+ $content .= $this->html->login_norow( "installed" );
+ }
+
+ //-----------------------------------------
+ // Then the ones not installed
+ //-----------------------------------------
+
+ $content .= $this->html->login_subheader( $this->lang->words['l_others'] );
+ $dm_count = 0;
+
+ if( count( $dir_methods ) )
+ {
+ foreach( $dir_methods as $r )
+ {
+ if( in_array( $r['login_folder_name'], $installed ) )
+ {
+ continue;
+ }
+
+ $dm_count++;
+
+ // Need to set a bogus login id to ensure HTML ids are unique for the javascript
+ $r['login_id'] = str_replace( '.', '', uniqid( 'abc', true ) );
+
+ $r['_enabled_img'] = 'cross.png';
+
+ $content .= $this->html->login_row($r);
+ }
+ }
+
+ if( !$dm_count )
+ {
+ $content .= $this->html->login_norow( "uninstalled" );
+ }
+
+ ipsRegistry::getClass('output')->html .= $this->html->login_overview( $content );
+ }
+
+ /**
+ * Toggle login method enabled/disabled
+ *
+ * @return void [Outputs to screen]
+ */
+ private function _loginToggle()
+ {
+ //--------------------------------------------
+ // INIT
+ //--------------------------------------------
+
+ $login_id = intval(ipsRegistry::$request['login_id']);
+
+ $login = $this->DB->buildAndFetch( array( 'select' => 'login_id, login_enabled, login_folder_name', 'from' => 'login_methods', 'where' => 'login_id=' . $login_id ) );
+
+ if( !$login['login_id'] )
+ {
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_404'];
+ $this->_loginList();
+ return;
+ }
+
+ if( $login['login_enabled'] )
+ {
+ $toggle = $this->lang->words['l_disabled'];
+
+ $this->DB->update( 'login_methods', array( 'login_enabled' => 0 ), 'login_id=' . $login_id );
+
+ if( $login['login_folder_name'] == 'ipconverge' )
+ {
+ IPSLib::updateSettings( array( 'ipconverge_enabled' => 0 ) );
+ }
+ }
+ else
+ {
+ $toggle = $this->lang->words['l_enabled'];
+
+ $this->DB->update( 'login_methods', array( 'login_enabled' => 1 ), 'login_id=' . $login_id );
+
+ if( $login['login_folder_name'] == 'ipconverge' )
+ {
+ IPSLib::updateSettings( array( 'ipconverge_enabled' => 1 ) );
+ }
+ }
+
+ //-----------------------------------------
+ // Recache
+ //-----------------------------------------
+
+ $this->loginsRecache();
+
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_successfully'] . $toggle;
+
+ $this->_loginList();
+ }
+
+ /**
+ * Uninstall a login method
+ *
+ * @return void [Outputs to screen]
+ */
+ private function _loginUninstall()
+ {
+ //--------------------------------------------
+ // INIT
+ //--------------------------------------------
+
+ $login_id = intval(ipsRegistry::$request['login_id']);
+
+ $login = $this->DB->buildAndFetch( array( 'select' => 'login_id, login_enabled, login_folder_name', 'from' => 'login_methods', 'where' => 'login_id=' . $login_id ) );
+
+ if( !$login['login_id'] )
+ {
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_404'];
+ $this->_loginList();
+ return;
+ }
+
+ $this->DB->delete( 'login_methods', 'login_id=' . $login_id );
+
+ if( $login['login_folder_name'] == 'ipconverge' )
+ {
+ IPSLib::updateSettings( array( 'ipconverge_enabled' => 0 ) );
+ }
+
+ //-----------------------------------------
+ // Recache
+ //-----------------------------------------
+
+ $this->loginsRecache();
+
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_uninstalled'];
+
+ $this->_loginList();
+ }
+
+ /**
+ * Install a login method
+ *
+ * @return void [Outputs to screen]
+ */
+ private function _loginInstall()
+ {
+ //--------------------------------------------
+ // INIT
+ //--------------------------------------------
+
+ require_once( IPS_KERNEL_PATH . 'class_xml.php' );
+ $xml = new class_xml();
+ $xml->doc_type = IPS_DOC_CHAR_SET;
+
+ $login_id = basename(ipsRegistry::$request['login_folder']);
+
+ //-----------------------------------------
+ // Now get the XML data
+ //-----------------------------------------
+
+ $dh = opendir( IPS_PATH_CUSTOM_LOGIN );
+
+ if ( $dh !== false )
+ {
+ while ( false !== ($file = readdir($dh) ) )
+ {
+ if( is_dir( IPS_PATH_CUSTOM_LOGIN . '/' . $file ) AND $file == $login_id )
+ {
+ if( file_exists( IPS_PATH_CUSTOM_LOGIN . '/' . $file . '/loginauth_install.xml' ) )
+ {
+ $file_content = file_get_contents( IPS_PATH_CUSTOM_LOGIN . '/' . $file . '/loginauth_install.xml' );
+
+ $xml->xml_parse_document( $file_content );
+
+ if( is_array($xml->xml_array['export']['group']['row']) )
+ {
+ foreach( $xml->xml_array['export']['group']['row'] as $f => $entry )
+ {
+ if( is_array($entry) )
+ {
+ foreach( $entry as $k => $v )
+ {
+ if ( $f == 'VALUE' or $f == 'login_id' )
+ {
+ continue;
+ }
+
+ $data[ $f ] = $v;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ closedir( $dh );
+
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_installer404'];
+ $this->_loginList();
+ return;
+ }
+
+ $dir_methods[ $file ] = $data;
+
+ break;
+ }
+ }
+
+ closedir( $dh );
+ }
+
+ if( !is_array($dir_methods) OR !count($dir_methods) )
+ {
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_installer404'];
+ $this->_loginList();
+ return;
+ }
+
+ //-----------------------------------------
+ // Now verify it isn't installed
+ //-----------------------------------------
+
+ $login = $this->DB->buildAndFetch( array( 'select' => 'login_id', 'from' => 'login_methods', 'where' => "login_folder_name='" . $login_id . "'" ) );
+
+ if( $login['login_id'] )
+ {
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_already'];
+ $this->_loginList();
+ return;
+ }
+
+ //-----------------------------------------
+ // Get the highest order and insert method
+ //-----------------------------------------
+
+ $max = $this->DB->buildAndFetch( array( 'select' => 'MAX(login_order) as highest_order', 'from' => 'login_methods' ) );
+
+ $dir_methods[ $login_id ]['login_order'] = $max['highest_order'] + 1;
+
+ $this->DB->insert( 'login_methods', $dir_methods[ $login_id ] );
+
+ //-----------------------------------------
+ // Recache
+ //-----------------------------------------
+
+ $this->loginsRecache();
+
+ ipsRegistry::getClass('output')->global_message = $this->lang->words['l_yesinstalled'];
+
+ $this->_loginList();
+ }
+
+ /**
+ * Reorder a login method
+ *
+ * @return void [Outputs to screen]
+ */
+ private function _loginReorder()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
+ $ajax = new $classToLoad();
+
+ //-----------------------------------------
+ // Checks...
+ //-----------------------------------------
+
+ if( $this->registry->adminFunctions->checkSecurityKey( $this->request['md5check'], true ) === false )
+ {
+ $ajax->returnString( $this->lang->words['postform_badmd5'] );
+ exit();
+ }
+
+ //-----------------------------------------
+ // Save new position
+ //-----------------------------------------
+
+ $position = 1;
+
+ if( is_array($this->request['logins']) AND count($this->request['logins']) )
+ {
+ foreach( $this->request['logins'] as $this_id )
+ {
+ $this->DB->update( 'login_methods', array( 'login_order' => $position ), 'login_id=' . $this_id );
+
+ $position++;
+ }
+ }
+
+ $this->loginsRecache();
+
+ $ajax->returnString( 'OK' );
+ exit();
+ }
+
+ /**
+ * Updates cache store record
+ *
+ * @return boolean Cache store updated successfully
+ */
+ public function loginsRecache()
+ {
+ $cache = array();
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1', 'order' => 'login_order ASC' ) );
+ $this->DB->execute();
+
+ while ( $r = $this->DB->fetch() )
+ {
+ $cache[ $r['login_id'] ] = $r;
+ }
+
+ ipsRegistry::cache()->setCache( 'login_methods', $cache, array( 'array' => 1 ) );
+ }
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/tools/logsSplash.php b/upload/admin/applications/core/modules_admin/tools/logsSplash.php
index 2049117e..4f8a78a7 100644
--- a/upload/admin/applications/core/modules_admin/tools/logsSplash.php
+++ b/upload/admin/applications/core/modules_admin/tools/logsSplash.php
@@ -1,19 +1,21 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Log Splash Screen
- * Last Updated: $LastChangedDate: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 2009) $
+ * Last Updated: $LastChangedDate: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 27th January 2004
- * @version $Rev: 3887 $
+ * @version $Rev: 5713 $
*/
if ( ! defined( 'IN_ACP' ) )
diff --git a/upload/admin/applications/core/modules_admin/tools/performance.php b/upload/admin/applications/core/modules_admin/tools/performance.php
index 572ce867..294d768c 100644
--- a/upload/admin/applications/core/modules_admin/tools/performance.php
+++ b/upload/admin/applications/core/modules_admin/tools/performance.php
@@ -1,456 +1,459 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
- exit();
-}
-
-
-class admin_core_tools_performance extends ipsCommand
-{
- /**
- * Settings to ENABLE
- *
- * @access private
- * @var array
- */
- private $settingsEnable = array( 'live_search_disable', 'no_au_forum', 'no_au_topic', 'disable_summary' );
-
- /**
- * Settings to DISABLE
- *
- * @access private
- * @var array
- */
- private $settingsDisable = array( 'spider_visit', 'custom_profile_topic', 'update_topic_views_immediately', 'show_user_posted',
- 'show_active', 'allow_search', 'topic_marking_enable' );
-
- /**
- * Group settings to ENABLE
- *
- * @access private
- * @var array
- */
- private $groupEnable = array();
-
- /**
- * Group settings to DISABLE
- *
- * @access private
- * @var array
- */
- private $groupDisable = array( 'g_mem_info', 'g_can_add_friends', 'g_email_friend' );
-
- /**
- * Other stuff to do...(custom coded)
- *
- * @access private
- * @var array
- */
- private $otherDisable = array( 'module__disable_pms', 'module__disable_online', 'disable_calendar', 'disable_hooks' );
-
- /**
- * HTML object
- *
- * @access private
- * @var object
- **/
- private $html;
-
- /**
- * Current performance settings
- *
- * @access private
- * @var array
- */
- private $current = array();
-
- /**#@+
- * URL bits
- *
- * @access public
- * @var string
- */
- public $form_code = '';
- public $form_code_js = '';
- /**#@-*/
-
- /**
- * Main entry point
- *
- * @access public
- * @param object ipsRegistry reference
- * @return void
- */
- public function doExecute( ipsRegistry $registry )
- {
- /* Load lang and skin */
- $this->registry->class_localization->loadLanguageFile( array( 'admin_tools' ) );
- $this->html = $this->registry->output->loadTemplate( 'cp_skin_performance' );
-
- /* URLs */
- $this->form_code = $this->html->form_code = 'module=tools§ion=performance';
- $this->form_code_js = $this->html->form_code_js = 'module=tools§ion=performance';
-
- /* Get current */
- $this->getSettings();
-
- /* What to do */
- switch( $this->request['do'] )
- {
- case 'toggle':
- $this->toggle();
- break;
-
- case 'overview':
- default:
- $this->overview();
- break;
- }
-
- /* Output */
- $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
- $this->registry->output->sendOutput();
- }
-
- /**
- * Toggle on/off
- *
- * @access public
- * @return void
- * @author Brandon
- */
- public function toggle()
- {
- $nowEnabled = count($this->current) ? false : true;
- $results = array();
- $stored = array();
-
- /**
- * Are we turning it ON
- */
- if( $nowEnabled )
- {
- /**
- * Enable any settings after storing current value
- */
- foreach( $this->settingsEnable as $settingKey )
- {
- $stored['settingsEnable'][ $settingKey ] = $this->settings[ $settingKey ];
-
- if( !$this->settings[ $settingKey ] )
- {
- $results[] = sprintf( $this->lang->words['perf_enabled_setting'], $settingKey );
- }
-
- $this->DB->update( 'core_sys_conf_settings', array( 'conf_value' => 1 ), "conf_key='" . $settingKey . "'" );
- }
-
- /**
- * Disable any settings after storing current value
- */
- foreach( $this->settingsDisable as $settingKey )
- {
- $stored['settingsDisable'][ $settingKey ] = $this->settings[ $settingKey ];
-
- if( $this->settings[ $settingKey ] )
- {
- $results[] = sprintf( $this->lang->words['perf_disabled_setting'], $settingKey );
- }
-
- $this->DB->update( 'core_sys_conf_settings', array( 'conf_value' => 0 ), "conf_key='" . $settingKey . "'" );
- }
-
- /**
- * Enable appropriate group settings
- */
- if( count($this->groupEnable) )
- {
- foreach( $this->groupEnable as $settingKey )
- {
- foreach( $this->cache->getCache('group_cache') as $gid => $group )
- {
- $results[] = sprintf( $this->lang->words['perf_enabled_group'], $settingKey, $group['g_title'] );
-
- $stored['groupEnable'][ $gid ][ $settingKey ] = $group[ $settingKey ];
-
- $this->DB->update( 'groups', array( $settingKey => 1 ), "g_id=" . $gid );
- }
- }
- }
-
- /**
- * Disable appropriate group settings
- */
- if( count($this->groupDisable) )
- {
- foreach( $this->groupDisable as $settingKey )
- {
- foreach( $this->cache->getCache('group_cache') as $gid => $group )
- {
- $results[] = sprintf( $this->lang->words['perf_disabled_group'], $settingKey, $group['g_title'] );
-
- $stored['groupDisable'][ $gid ][ $settingKey ] = $group[ $settingKey ];
-
- $this->DB->update( 'groups', array( $settingKey => 0 ), "g_id=" . $gid );
- }
- }
- }
-
- /**
- * And anything else..
- */
- foreach( $this->otherDisable as $doIt )
- {
- switch( $doIt )
- {
- case 'module__disable_pms':
- foreach( ipsRegistry::$modules['members'] as $module )
- {
- if( $module['sys_module_key'] == 'messaging' )
- {
- $stored['other']['module__disable_pms'] = $module['sys_module_visible'];
- break;
- }
- }
-
- $this->DB->update( 'core_sys_module', array( 'sys_module_visible' => 0 ), "sys_module_key='messaging'" );
- $results[] = $this->lang->words['perf_dispms'];
- break;
-
- case 'module__disable_online':
- foreach( ipsRegistry::$modules['members'] as $module )
- {
- if( $module['sys_module_key'] == 'online' )
- {
- $stored['other']['module__disable_online'] = $module['sys_module_visible'];
- break;
- }
- }
-
- $this->DB->update( 'core_sys_module', array( 'sys_module_visible' => 0 ), "sys_module_key='online'" );
- $results[] = $this->lang->words['perf_disonline'];
- break;
-
- case 'disable_calendar':
- foreach( ipsRegistry::$applications as $app )
- {
- if( $app['app_directory'] == 'calendar' )
- {
- $stored['other']['disable_calendar'] = $app['app_enabled'];
- break;
- }
- }
-
- $this->DB->update( 'core_applications', array( 'app_enabled' => 0 ), "app_directory='calendar'" );
- $results[] = $this->lang->words['perf_discal'];
- break;
-
- case 'disable_hooks':
- $this->DB->build( array( 'select' => 'hook_id, hook_enabled', 'from' => 'core_hooks' ) );
- $this->DB->execute();
-
- while( $hook = $this->DB->fetch() )
- {
- $stored['other']['disable_hooks'][ $hook['hook_id'] ] = $hook['hook_enabled'];
- }
-
- $this->DB->update( 'core_hooks', array( 'hook_enabled' => 0 ) );
- $results[] = $this->lang->words['perf_dishooks'];
- break;
- }
- }
-
- /**
- * And finally store in cache
- */
- $this->cache->setCache( 'performanceCache', $stored, array( 'array' => 1 ) );
- }
- /**
- * We're turning it off
- */
- else
- {
- /**
- * Reset the "enable settings" value
- */
- foreach( $this->current['settingsEnable'] as $k => $v )
- {
- if( !$v )
- {
- $this->DB->update( 'core_sys_conf_settings', array( 'conf_value' => 0 ), "conf_key='" . $k . "'" );
-
- $results[] = sprintf( $this->lang->words['perf_disabled_setting'], $k );
- }
- }
-
- /**
- * Reset the "disable settings" value
- */
- foreach( $this->current['settingsDisable'] as $k => $v )
- {
- if( $v )
- {
- $this->DB->update( 'core_sys_conf_settings', array( 'conf_value' => 1 ), "conf_key='" . $k . "'" );
-
- $results[] = sprintf( $this->lang->words['perf_enabled_setting'], $k );
- }
- }
-
- /**
- * Reset the "enable group setting" value
- */
- if( count($this->current['groupEnable']) )
- {
- foreach( $this->current['groupEnable'] as $gid => $data )
- {
- foreach( $data as $k => $v )
- {
- if( !$v )
- {
- $this->DB->update( 'groups', array( $k => 0 ), "g_id=" . $gid );
-
- $results[] = sprintf( $this->lang->words['perf_disabled_group'], $k, $this->caches['group_cache'][ $gid ]['g_title'] );
- }
- }
- }
- }
-
- /**
- * Reset the "disable settings" value
- */
- if( count($this->current['groupDisable']) )
- {
- foreach( $this->current['groupDisable'] as $gid => $data )
- {
- foreach( $data as $k => $v )
- {
- if( $v )
- {
- $this->DB->update( 'groups', array( $k => 1 ), "g_id=" . $gid );
-
- $results[] = sprintf( $this->lang->words['perf_enabled_group'], $k, $this->caches['group_cache'][ $gid ]['g_title'] );
- }
- }
- }
- }
-
- /**
- * And anything else..
- */
- foreach( $this->otherDisable as $doIt )
- {
- switch( $doIt )
- {
- case 'module__disable_pms':
- $previous = $this->current['other']['module__disable_pms'];
-
- if( $previous )
- {
- $this->DB->update( 'core_sys_module', array( 'sys_module_visible' => 1 ), "sys_module_key='messaging'" );
- $results[] = $this->lang->words['perf_enpms'];
- }
- break;
-
- case 'module__disable_online':
- $previous = $this->current['other']['module__disable_online'];
-
- if( $previous )
- {
- $this->DB->update( 'core_sys_module', array( 'sys_module_visible' => 1 ), "sys_module_key='online'" );
- $results[] = $this->lang->words['perf_enonline'];
- }
- break;
-
- case 'disable_calendar':
- $previous = $this->current['other']['disable_calendar'];
-
- if( $previous )
- {
- $this->DB->update( 'core_applications', array( 'app_enabled' => 1 ), "app_directory='calendar'" );
- $results[] = $this->lang->words['perf_encal'];
- }
- break;
-
- case 'disable_hooks':
- if( count($this->current['other']['disable_hooks']) )
- {
- foreach( $this->current['other']['disable_hooks'] as $hookId => $hookEnabled )
- {
- if( !$hookId )
- {
- continue;
- }
-
- $this->DB->update( 'core_hooks', array( 'hook_enabled' => $hookEnabled ), "hook_id=" . $hookId );
- }
- }
-
- $results[] = $this->lang->words['perf_enhooks'];
- break;
- }
- }
-
- /**
- * And finally remove from DB
- */
- $this->DB->delete( 'cache_store', "cs_key='performanceCache'" );
- }
-
- /**
- * Need to rebuild some caches now...
- */
- $this->cache->rebuildCache( 'settings', 'global' );
- $this->cache->rebuildCache( 'group_cache', 'global' );
- $this->cache->rebuildCache( 'app_cache', 'global' );
- $this->cache->rebuildCache( 'module_cache', 'global' );
- $this->cache->rebuildCache( 'hooks', 'global' );
-
- /* Output */
- $this->registry->output->html .= $this->html->toggleResults( $nowEnabled, $results );
- }
-
- /**
- * List current status/data
- *
- * @access public
- * @return void
- */
- public function overview()
- {
- /* Output */
- $this->registry->output->html .= $this->html->overview( count($this->current) ? true : false );
- }
-
- /**
- * Retrieve current cached performance settings.
- * Leaves array blank if currently "off"
- *
- * @access private
- * @return void
- */
- private function getSettings()
- {
- $record = $this->cache->getCache('performanceCache');
-
- if( is_array($record) AND count($record) )
- {
- $this->current = $record;
- }
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Toggle performance mode on/off
+ * Last Updated: $LastChangedDate: 2010-06-01 18:11:37 -0400 (Tue, 01 Jun 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6435 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+
+class admin_core_tools_performance extends ipsCommand
+{
+ /**
+ * Settings to ENABLE
+ *
+ * @access private
+ * @var array
+ */
+ private $settingsEnable = array( 'live_search_disable', 'no_au_forum', 'no_au_topic', 'disable_summary', 'topic_marking_noquery' );
+
+ /**
+ * Settings to DISABLE
+ *
+ * @access private
+ * @var array
+ */
+ private $settingsDisable = array( 'spider_visit', 'custom_profile_topic', 'update_topic_views_immediately', 'show_user_posted',
+ 'show_active', 'allow_search', 'topic_marking_enable' );
+
+ /**
+ * Group settings to ENABLE
+ *
+ * @access private
+ * @var array
+ */
+ private $groupEnable = array();
+
+ /**
+ * Group settings to DISABLE
+ *
+ * @access private
+ * @var array
+ */
+ private $groupDisable = array( 'g_mem_info', 'g_can_add_friends', 'g_email_friend' );
+
+ /**
+ * Other stuff to do...(custom coded)
+ *
+ * @access private
+ * @var array
+ */
+ private $otherDisable = array( 'module__disable_pms', 'module__disable_online', 'disable_calendar', 'disable_hooks' );
+
+ /**
+ * HTML object
+ *
+ * @access private
+ * @var object
+ **/
+ private $html;
+
+ /**
+ * Current performance settings
+ *
+ * @access private
+ * @var array
+ */
+ private $current = array();
+
+ /**#@+
+ * URL bits
+ *
+ * @access public
+ * @var string
+ */
+ public $form_code = '';
+ public $form_code_js = '';
+ /**#@-*/
+
+ /**
+ * Main entry point
+ *
+ * @access public
+ * @param object ipsRegistry reference
+ * @return void
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* Load lang and skin */
+ $this->registry->class_localization->loadLanguageFile( array( 'admin_tools' ) );
+ $this->html = $this->registry->output->loadTemplate( 'cp_skin_performance' );
+
+ /* URLs */
+ $this->form_code = $this->html->form_code = 'module=tools§ion=performance';
+ $this->form_code_js = $this->html->form_code_js = 'module=tools§ion=performance';
+
+ /* Get current */
+ $this->getSettings();
+
+ /* What to do */
+ switch( $this->request['do'] )
+ {
+ case 'toggle':
+ $this->toggle();
+ break;
+
+ case 'overview':
+ default:
+ $this->overview();
+ break;
+ }
+
+ /* Output */
+ $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * Toggle on/off
+ *
+ * @access public
+ * @return void
+ * @author Brandon
+ */
+ public function toggle()
+ {
+ $nowEnabled = count($this->current) ? false : true;
+ $results = array();
+ $stored = array();
+
+ /**
+ * Are we turning it ON
+ */
+ if( $nowEnabled )
+ {
+ /**
+ * Enable any settings after storing current value
+ */
+ foreach( $this->settingsEnable as $settingKey )
+ {
+ $stored['settingsEnable'][ $settingKey ] = $this->settings[ $settingKey ];
+
+ if( !$this->settings[ $settingKey ] )
+ {
+ $results[] = sprintf( $this->lang->words['perf_enabled_setting'], $settingKey );
+ }
+
+ $this->DB->update( 'core_sys_conf_settings', array( 'conf_value' => 1 ), "conf_key='" . $settingKey . "'" );
+ }
+
+ /**
+ * Disable any settings after storing current value
+ */
+ foreach( $this->settingsDisable as $settingKey )
+ {
+ $stored['settingsDisable'][ $settingKey ] = $this->settings[ $settingKey ];
+
+ if( $this->settings[ $settingKey ] )
+ {
+ $results[] = sprintf( $this->lang->words['perf_disabled_setting'], $settingKey );
+ }
+
+ $this->DB->update( 'core_sys_conf_settings', array( 'conf_value' => 0 ), "conf_key='" . $settingKey . "'" );
+ }
+
+ /**
+ * Enable appropriate group settings
+ */
+ if( count($this->groupEnable) )
+ {
+ foreach( $this->groupEnable as $settingKey )
+ {
+ foreach( $this->cache->getCache('group_cache') as $gid => $group )
+ {
+ $results[] = sprintf( $this->lang->words['perf_enabled_group'], $settingKey, $group['g_title'] );
+
+ $stored['groupEnable'][ $gid ][ $settingKey ] = $group[ $settingKey ];
+
+ $this->DB->update( 'groups', array( $settingKey => 1 ), "g_id=" . $gid );
+ }
+ }
+ }
+
+ /**
+ * Disable appropriate group settings
+ */
+ if( count($this->groupDisable) )
+ {
+ foreach( $this->groupDisable as $settingKey )
+ {
+ foreach( $this->cache->getCache('group_cache') as $gid => $group )
+ {
+ $results[] = sprintf( $this->lang->words['perf_disabled_group'], $settingKey, $group['g_title'] );
+
+ $stored['groupDisable'][ $gid ][ $settingKey ] = $group[ $settingKey ];
+
+ $this->DB->update( 'groups', array( $settingKey => 0 ), "g_id=" . $gid );
+ }
+ }
+ }
+
+ /**
+ * And anything else..
+ */
+ foreach( $this->otherDisable as $doIt )
+ {
+ switch( $doIt )
+ {
+ case 'module__disable_pms':
+ foreach( ipsRegistry::$modules['members'] as $module )
+ {
+ if( $module['sys_module_key'] == 'messaging' )
+ {
+ $stored['other']['module__disable_pms'] = $module['sys_module_visible'];
+ break;
+ }
+ }
+
+ $this->DB->update( 'core_sys_module', array( 'sys_module_visible' => 0 ), "sys_module_key='messaging'" );
+ $results[] = $this->lang->words['perf_dispms'];
+ break;
+
+ case 'module__disable_online':
+ foreach( ipsRegistry::$modules['members'] as $module )
+ {
+ if( $module['sys_module_key'] == 'online' )
+ {
+ $stored['other']['module__disable_online'] = $module['sys_module_visible'];
+ break;
+ }
+ }
+
+ $this->DB->update( 'core_sys_module', array( 'sys_module_visible' => 0 ), "sys_module_key='online'" );
+ $results[] = $this->lang->words['perf_disonline'];
+ break;
+
+ case 'disable_calendar':
+ foreach( ipsRegistry::$applications as $app )
+ {
+ if( $app['app_directory'] == 'calendar' )
+ {
+ $stored['other']['disable_calendar'] = $app['app_enabled'];
+ break;
+ }
+ }
+
+ $this->DB->update( 'core_applications', array( 'app_enabled' => 0 ), "app_directory='calendar'" );
+ $results[] = $this->lang->words['perf_discal'];
+ break;
+
+ case 'disable_hooks':
+ $this->DB->build( array( 'select' => 'hook_id, hook_enabled', 'from' => 'core_hooks' ) );
+ $this->DB->execute();
+
+ while( $hook = $this->DB->fetch() )
+ {
+ $stored['other']['disable_hooks'][ $hook['hook_id'] ] = $hook['hook_enabled'];
+ }
+
+ $this->DB->update( 'core_hooks', array( 'hook_enabled' => 0 ) );
+ $results[] = $this->lang->words['perf_dishooks'];
+ break;
+ }
+ }
+
+ /**
+ * And finally store in cache
+ */
+ $this->cache->setCache( 'performanceCache', $stored, array( 'array' => 1 ) );
+ }
+ /**
+ * We're turning it off
+ */
+ else
+ {
+ /**
+ * Reset the "enable settings" value
+ */
+ foreach( $this->current['settingsEnable'] as $k => $v )
+ {
+ if( !$v )
+ {
+ $this->DB->update( 'core_sys_conf_settings', array( 'conf_value' => 0 ), "conf_key='" . $k . "'" );
+
+ $results[] = sprintf( $this->lang->words['perf_disabled_setting'], $k );
+ }
+ }
+
+ /**
+ * Reset the "disable settings" value
+ */
+ foreach( $this->current['settingsDisable'] as $k => $v )
+ {
+ if( $v )
+ {
+ $this->DB->update( 'core_sys_conf_settings', array( 'conf_value' => 1 ), "conf_key='" . $k . "'" );
+
+ $results[] = sprintf( $this->lang->words['perf_enabled_setting'], $k );
+ }
+ }
+
+ /**
+ * Reset the "enable group setting" value
+ */
+ if( count($this->current['groupEnable']) )
+ {
+ foreach( $this->current['groupEnable'] as $gid => $data )
+ {
+ foreach( $data as $k => $v )
+ {
+ if( !$v )
+ {
+ $this->DB->update( 'groups', array( $k => 0 ), "g_id=" . $gid );
+
+ $results[] = sprintf( $this->lang->words['perf_disabled_group'], $k, $this->caches['group_cache'][ $gid ]['g_title'] );
+ }
+ }
+ }
+ }
+
+ /**
+ * Reset the "disable settings" value
+ */
+ if( count($this->current['groupDisable']) )
+ {
+ foreach( $this->current['groupDisable'] as $gid => $data )
+ {
+ foreach( $data as $k => $v )
+ {
+ if( $v )
+ {
+ $this->DB->update( 'groups', array( $k => 1 ), "g_id=" . $gid );
+
+ $results[] = sprintf( $this->lang->words['perf_enabled_group'], $k, $this->caches['group_cache'][ $gid ]['g_title'] );
+ }
+ }
+ }
+ }
+
+ /**
+ * And anything else..
+ */
+ foreach( $this->otherDisable as $doIt )
+ {
+ switch( $doIt )
+ {
+ case 'module__disable_pms':
+ $previous = $this->current['other']['module__disable_pms'];
+
+ if( $previous )
+ {
+ $this->DB->update( 'core_sys_module', array( 'sys_module_visible' => 1 ), "sys_module_key='messaging'" );
+ $results[] = $this->lang->words['perf_enpms'];
+ }
+ break;
+
+ case 'module__disable_online':
+ $previous = $this->current['other']['module__disable_online'];
+
+ if( $previous )
+ {
+ $this->DB->update( 'core_sys_module', array( 'sys_module_visible' => 1 ), "sys_module_key='online'" );
+ $results[] = $this->lang->words['perf_enonline'];
+ }
+ break;
+
+ case 'disable_calendar':
+ $previous = $this->current['other']['disable_calendar'];
+
+ if( $previous )
+ {
+ $this->DB->update( 'core_applications', array( 'app_enabled' => 1 ), "app_directory='calendar'" );
+ $results[] = $this->lang->words['perf_encal'];
+ }
+ break;
+
+ case 'disable_hooks':
+ if( count($this->current['other']['disable_hooks']) )
+ {
+ foreach( $this->current['other']['disable_hooks'] as $hookId => $hookEnabled )
+ {
+ if( !$hookId )
+ {
+ continue;
+ }
+
+ $this->DB->update( 'core_hooks', array( 'hook_enabled' => $hookEnabled ), "hook_id=" . $hookId );
+ }
+ }
+
+ $results[] = $this->lang->words['perf_enhooks'];
+ break;
+ }
+ }
+
+ /**
+ * And finally remove from DB
+ */
+ $this->cache->setCache( 'performanceCache', '' );
+ //$this->DB->delete( 'cache_store', "cs_key='performanceCache'" );
+ }
+
+ /**
+ * Need to rebuild some caches now...
+ */
+ $this->cache->rebuildCache( 'settings', 'global' );
+ $this->cache->rebuildCache( 'group_cache', 'global' );
+ $this->cache->rebuildCache( 'app_cache', 'global' );
+ $this->cache->rebuildCache( 'module_cache', 'global' );
+ $this->cache->rebuildCache( 'hooks', 'global' );
+
+ /* Output */
+ $this->registry->output->html .= $this->html->toggleResults( $nowEnabled, $results );
+ }
+
+ /**
+ * List current status/data
+ *
+ * @access public
+ * @return void
+ */
+ public function overview()
+ {
+ /* Output */
+ $this->registry->output->html .= $this->html->overview( count($this->current) ? true : false );
+ }
+
+ /**
+ * Retrieve current cached performance settings.
+ * Leaves array blank if currently "off"
+ *
+ * @access private
+ * @return void
+ */
+ private function getSettings()
+ {
+ $record = $this->cache->getCache('performanceCache');
+
+ if( is_array($record) AND count($record) )
+ {
+ $this->current = $record;
+ }
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/tools/qanda.php b/upload/admin/applications/core/modules_admin/tools/qanda.php
index 4b657a90..8f4fc0d4 100644
--- a/upload/admin/applications/core/modules_admin/tools/qanda.php
+++ b/upload/admin/applications/core/modules_admin/tools/qanda.php
@@ -1,276 +1,278 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
- exit();
-}
-
-
-class admin_core_tools_qanda extends ipsCommand
-{
- /**
- * HTML object
- *
- * @access private
- * @var object
- */
- private $html;
-
- /**
- * Main entry point
- *
- * @access public
- * @param object ipsRegistry reference
- * @return void
- */
- public function doExecute( ipsRegistry $registry )
- {
- /* Load lang and skin */
- $this->registry->class_localization->loadLanguageFile( array( 'admin_tools' ) );
- $this->html = $this->registry->output->loadTemplate( 'cp_skin_qanda' );
-
- /* URLs */
- $this->form_code = $this->html->form_code = 'module=tools§ion=qanda';
- $this->form_code_js = $this->html->form_code_js = 'module=tools§ion=qanda';
-
- /* What to do */
- switch( $this->request['do'] )
- {
- case 'edit':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'qa_manage' );
- $this->showForm( 'edit' );
- break;
-
- case 'new':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'qa_manage' );
- $this->showForm( 'new' );
- break;
-
- case 'doedit':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'qa_manage' );
- $this->saveForm( 'edit' );
- break;
-
- case 'donew':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'qa_manage' );
- $this->saveForm( 'new' );
- break;
-
- case 'remove':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'qa_remove' );
- $this->remove();
- break;
-
- case 'switchOn':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'qa_manage' );
- $this->_switchOn();
- case 'overview':
- default:
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'qa_manage' );
- $this->overview();
- break;
- }
-
- /* Output */
- $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
- $this->registry->output->sendOutput();
- }
-
-
- /**
- * Toggles the setting 'registration_qanda'
- *
- * @access private
- * @return void
- * @author Brandon
- */
- private function _switchOn()
- {
- /* Switch it on */
- IPSLib::updateSettings( array( 'registration_qanda' => 1 ) );
-
- /* Done */
- $this->registry->output->silentRedirect( $this->settings['base_url'] . $this->form_code );
- }
-
- /**
- * Removes a question
- *
- * @access public
- * @return void
- * @author Brandon
- */
- public function remove()
- {
- /* Check ID */
- $id = intval( $this->request['id'] );
-
- if( ! $id )
- {
- $this->registry->output->showError( $this->lang->words['qa_noid'], 111155 );
- }
-
- /* Delete the record */
- $this->DB->delete( 'question_and_answer', "qa_id={$id}" );
-
- /* Log and bounce */
- $this->registry->adminFunctions->saveAdminLog( $this->lang->words['qa_deleted'] );
- $this->registry->output->silentRedirect( $this->settings['base_url'] . $this->form_code );
- }
-
- /**
- * List current questions
- *
- * @access public
- * @return void
- */
- public function overview()
- {
- /* Query Questions */
- $this->DB->build( array( 'select' => '*', 'from' => 'question_and_answer' ) );
- $this->DB->execute();
-
- /* Do we have questions? */
- $rows = array();
-
- if( $this->DB->getTotalRows() )
- {
- while( $r = $this->DB->fetch() )
- {
- /* Add to output array */
- $rows[] = $r;
- }
- }
-
- /* Output */
- $this->registry->output->html .= $this->html->overview( $rows );
- }
-
- /**
- * Form for adding/editing questions
- *
- * @access public
- * @param string Type [new|edit]
- * @return void
- */
- public function showForm( $type='new' )
- {
- /* Edit Question */
- if( $type != 'new' )
- {
- /* ID */
- $id = intval( $this->request['id'] );
-
- if( ! $id )
- {
- $this->registry->output->showError( $this->lang->words['qa_noeditid'], 111156 );
- }
-
- /* Query the question */
- $this->DB->build( array( 'select' => '*', 'from' => 'question_and_answer', 'where' => "qa_id=" . $id ) );
- $this->DB->execute();
-
- /* Make sure we found one */
- if( ! $r = $this->DB->fetch() )
- {
- $this->registry->output->showError( $this->lang->words['qa_404'], 111157 );
- }
-
- /* Text bits */
- $button = $this->lang->words['qa_editbutton'];
- $code = 'doedit';
- }
- else
- {
- /* Data */
- $r = array();
- $id = 0;
-
- /* Text Bits */
- $button = $this->lang->words['qa_addbutton'];
- $code = 'donew';
- }
-
- /* Form Elements */
- $form = array();
-
- $form['question'] = $this->registry->output->formTextarea( 'question', htmlspecialchars( $r['qa_question'], ENT_QUOTES ) );
- $form['answers'] = $this->registry->output->formTextarea( 'answers', htmlspecialchars( $r['qa_answers'], ENT_QUOTES ) );
-
- /* Ouput */
- $this->registry->output->html .= $this->html->showForm( $code, $id, $form, $button );
- }
-
- /**
- * Save the questions from the form
- *
- * @access public
- * @param string Type [new|edit]
- * @return void
- */
- public function saveForm( $type='new' )
- {
- /* Error Checking */
- if( ! $this->request['question'])
- {
- $this->registry->output->showError( $this->lang->words['qa_no_question'], 11150 );
- }
-
- if( ! $this->request['answers'] )
- {
- $this->registry->output->showError( $this->lang->words['qa_no_answer'], 11150 );
- }
-
- /* Build DB Array */
- $db_array = array(
- 'qa_question' => $_POST['question'],
- 'qa_answers' => $_POST['answers'],
- );
-
- /* Insert question */
- if( $type == 'new' )
- {
- /* Update the DB */
- $this->DB->insert( 'question_and_answer', $db_array );
-
- $id = $this->DB->getInsertId();
-
- /* Log */
- $this->registry->adminFunctions->saveAdminLog( $this->lang->words['qa_addlog'] );
- }
- /* Update question */
- else
- {
- /* ID */
- $id = intval( $this->request['id'] );
-
- if( ! $id )
- {
- $this->registry->output->showError( $this->lang->words['qa_noeditid'], 111158 );
- }
-
- /* Update the DB */
- $this->DB->update( 'question_and_answer', $db_array, "qa_id={$id}" );
-
- $this->registry->adminFunctions->saveAdminLog( $this->lang->words['qa_edited']);
- }
-
- /* Bounce */
- $this->registry->output->silentRedirect( $this->settings['base_url'] . $this->form_code );
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Registration question and answer challenges
+ * Last Updated: $LastChangedDate: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 5713 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+
+class admin_core_tools_qanda extends ipsCommand
+{
+ /**
+ * HTML object
+ *
+ * @access private
+ * @var object
+ */
+ private $html;
+
+ /**
+ * Main entry point
+ *
+ * @access public
+ * @param object ipsRegistry reference
+ * @return void
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* Load lang and skin */
+ $this->registry->class_localization->loadLanguageFile( array( 'admin_tools' ) );
+ $this->html = $this->registry->output->loadTemplate( 'cp_skin_qanda' );
+
+ /* URLs */
+ $this->form_code = $this->html->form_code = 'module=tools§ion=qanda';
+ $this->form_code_js = $this->html->form_code_js = 'module=tools§ion=qanda';
+
+ /* What to do */
+ switch( $this->request['do'] )
+ {
+ case 'edit':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'qa_manage' );
+ $this->showForm( 'edit' );
+ break;
+
+ case 'new':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'qa_manage' );
+ $this->showForm( 'new' );
+ break;
+
+ case 'doedit':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'qa_manage' );
+ $this->saveForm( 'edit' );
+ break;
+
+ case 'donew':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'qa_manage' );
+ $this->saveForm( 'new' );
+ break;
+
+ case 'remove':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'qa_remove' );
+ $this->remove();
+ break;
+
+ case 'switchOn':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'qa_manage' );
+ $this->_switchOn();
+ case 'overview':
+ default:
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'qa_manage' );
+ $this->overview();
+ break;
+ }
+
+ /* Output */
+ $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
+ $this->registry->output->sendOutput();
+ }
+
+
+ /**
+ * Toggles the setting 'registration_qanda'
+ *
+ * @access private
+ * @return void
+ * @author Brandon
+ */
+ private function _switchOn()
+ {
+ /* Switch it on */
+ IPSLib::updateSettings( array( 'registration_qanda' => 1 ) );
+
+ /* Done */
+ $this->registry->output->silentRedirect( $this->settings['base_url'] . $this->form_code );
+ }
+
+ /**
+ * Removes a question
+ *
+ * @access public
+ * @return void
+ * @author Brandon
+ */
+ public function remove()
+ {
+ /* Check ID */
+ $id = intval( $this->request['id'] );
+
+ if( ! $id )
+ {
+ $this->registry->output->showError( $this->lang->words['qa_noid'], 111155 );
+ }
+
+ /* Delete the record */
+ $this->DB->delete( 'question_and_answer', "qa_id={$id}" );
+
+ /* Log and bounce */
+ $this->registry->adminFunctions->saveAdminLog( $this->lang->words['qa_deleted'] );
+ $this->registry->output->silentRedirect( $this->settings['base_url'] . $this->form_code );
+ }
+
+ /**
+ * List current questions
+ *
+ * @access public
+ * @return void
+ */
+ public function overview()
+ {
+ /* Query Questions */
+ $this->DB->build( array( 'select' => '*', 'from' => 'question_and_answer' ) );
+ $this->DB->execute();
+
+ /* Do we have questions? */
+ $rows = array();
+
+ if( $this->DB->getTotalRows() )
+ {
+ while( $r = $this->DB->fetch() )
+ {
+ /* Add to output array */
+ $rows[] = $r;
+ }
+ }
+
+ /* Output */
+ $this->registry->output->html .= $this->html->overview( $rows );
+ }
+
+ /**
+ * Form for adding/editing questions
+ *
+ * @access public
+ * @param string Type [new|edit]
+ * @return void
+ */
+ public function showForm( $type='new' )
+ {
+ /* Edit Question */
+ if( $type != 'new' )
+ {
+ /* ID */
+ $id = intval( $this->request['id'] );
+
+ if( ! $id )
+ {
+ $this->registry->output->showError( $this->lang->words['qa_noeditid'], 111156 );
+ }
+
+ /* Query the question */
+ $this->DB->build( array( 'select' => '*', 'from' => 'question_and_answer', 'where' => "qa_id=" . $id ) );
+ $this->DB->execute();
+
+ /* Make sure we found one */
+ if( ! $r = $this->DB->fetch() )
+ {
+ $this->registry->output->showError( $this->lang->words['qa_404'], 111157 );
+ }
+
+ /* Text bits */
+ $button = $this->lang->words['qa_editbutton'];
+ $code = 'doedit';
+ }
+ else
+ {
+ /* Data */
+ $r = array();
+ $id = 0;
+
+ /* Text Bits */
+ $button = $this->lang->words['qa_addbutton'];
+ $code = 'donew';
+ }
+
+ /* Form Elements */
+ $form = array();
+
+ $form['question'] = $this->registry->output->formTextarea( 'question', htmlspecialchars( $r['qa_question'], ENT_QUOTES ) );
+ $form['answers'] = $this->registry->output->formTextarea( 'answers', htmlspecialchars( $r['qa_answers'], ENT_QUOTES ) );
+
+ /* Ouput */
+ $this->registry->output->html .= $this->html->showForm( $code, $id, $form, $button );
+ }
+
+ /**
+ * Save the questions from the form
+ *
+ * @access public
+ * @param string Type [new|edit]
+ * @return void
+ */
+ public function saveForm( $type='new' )
+ {
+ /* Error Checking */
+ if( ! $this->request['question'])
+ {
+ $this->registry->output->showError( $this->lang->words['qa_no_question'], 11150 );
+ }
+
+ if( ! $this->request['answers'] )
+ {
+ $this->registry->output->showError( $this->lang->words['qa_no_answer'], 11150 );
+ }
+
+ /* Build DB Array */
+ $db_array = array(
+ 'qa_question' => $_POST['question'],
+ 'qa_answers' => $_POST['answers'],
+ );
+
+ /* Insert question */
+ if( $type == 'new' )
+ {
+ /* Update the DB */
+ $this->DB->insert( 'question_and_answer', $db_array );
+
+ $id = $this->DB->getInsertId();
+
+ /* Log */
+ $this->registry->adminFunctions->saveAdminLog( $this->lang->words['qa_addlog'] );
+ }
+ /* Update question */
+ else
+ {
+ /* ID */
+ $id = intval( $this->request['id'] );
+
+ if( ! $id )
+ {
+ $this->registry->output->showError( $this->lang->words['qa_noeditid'], 111158 );
+ }
+
+ /* Update the DB */
+ $this->DB->update( 'question_and_answer', $db_array, "qa_id={$id}" );
+
+ $this->registry->adminFunctions->saveAdminLog( $this->lang->words['qa_edited']);
+ }
+
+ /* Bounce */
+ $this->registry->output->silentRedirect( $this->settings['base_url'] . $this->form_code );
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/tools/rebuild.php b/upload/admin/applications/core/modules_admin/tools/rebuild.php
index 133c8e64..952aa48c 100644
--- a/upload/admin/applications/core/modules_admin/tools/rebuild.php
+++ b/upload/admin/applications/core/modules_admin/tools/rebuild.php
@@ -1,2940 +1,2923 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
- exit();
-}
-
-class admin_core_tools_rebuild extends ipsCommand
-{
- /**
- * Skin object
- *
- * @access private
- * @var object Skin templates
- */
- private $html;
-
- /**#@+
- * URL bits
- *
- * @access public
- * @var string
- */
- public $form_code = '';
- public $form_code_js = '';
- /**#@-*/
-
- /**
- * Main class entry point
- *
- * @access public
- * @param object ipsRegistry reference
- * @return void [Outputs to screen]
- */
- public function doExecute( ipsRegistry $registry )
- {
- require_once( IPS_ROOT_PATH . "applications/forums/sources/classes/forums/class_forums.php" );
- $this->registry->setClass( 'class_forums', new class_forums( $registry ) );
- $this->registry->class_forums->forumsInit();
-
- /* Load lang and skin */
- $this->registry->class_localization->loadLanguageFile( array( 'admin_tools' ) );
- $this->html = $this->registry->output->loadTemplate( 'cp_skin_rebuild' );
-
- /* URLs */
- $this->form_code = $this->html->form_code = 'module=tools§ion=rebuild';
- $this->form_code_js = $this->html->form_code_js = 'module=tools§ion=rebuild';
-
- /* What to do */
- switch( $this->request['do'] )
- {
- case 'docount':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_recount' );
- $this->doCount();
- break;
-
- case 'doresyncforums':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_resynch' );
- $this->resyncForums();
- break;
-
- case 'doresynctopics':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_resyncht' );
- $this->resyncTopics();
- break;
-
- case 'doposts':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_rebuild' );
- $this->rebuildPosts();
- break;
-
- case 'dopostnames':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_postcounts' );
- $this->rebuildPostNames();
- break;
-
- case 'dopostcounts':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_postcounts' );
- $this->rebuildPostCount();
- break;
-
- case 'dothumbnails':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_thumbs' );
- $this->rebuildThumbnails();
- break;
-
- case 'dophotos':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_thumbs' );
- $this->rebuildPhotos();
- break;
-
- case 'doattachdata':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_attach' );
- $this->rebuildAttachdata();
- break;
-
- case 'doseousernames':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_rebuild' );
- $this->rebuildSeoUserNames();
- break;
- case 'cleanattachments':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_orphaned' );
- $this->cleanAttachments();
- break;
-
- case 'cleanavatars':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_orphana' );
- $this->cleanAvatars();
- break;
-
- case 'cleanphotos':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_orphanp' );
- $this->cleanPhotos();
- break;
-
- case 'domsgcounts':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_postcounts' );
- $this->rebuildMsgCounts();
- break;
-
- //-----------------------------------------
- // Tools
- //-----------------------------------------
-
- case '300pms':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_220' );
- $this->tools300Pms();
- break;
-
- case '220tool_contacts':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_220' );
- $this->tools220Contacts();
- break;
-
- case '210polls':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_220' );
- $this->tools210Polls();
- break;
-
- case '210calevents':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_220' );
- $this->tools210Calevents();
- break;
-
- case '210tool_settings':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_220' );
- $this->tools210DupeSettings();
- break;
-
- case 'tool_settings':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_220' );
- $this->toolsDupeSettings();
- break;
-
- case 'tool_converge':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_220' );
- $this->toolsConverge();
- break;
-
- case 'tool_bansettings':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_220' );
- $this->toolBanSettings();
- break;
-
- case 'tools':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_220' );
- $this->toolsSplashScreen();
- break;
-
- case 'rebuild_overview':
- default:
- $this->rebuildSplashScreen();
- break;
- }
-
- /* Output */
- $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
- $this->registry->output->sendOutput();
- }
-
- /**
- * 3.0.x Tools: PM Conversion
- *
- * @access public
- * @return void
- */
- public function tools300pms()
- {
- /* INIT */
- $pergo = 100;
- $start = intval( $this->request['st'] );
- $converted = 0;
- $seen = 0;
-
- //-----------------------------------------
- // Check to make sure table exists
- //-----------------------------------------
-
- if ( ! $this->DB->checkForTable( 'message_text' ) )
- {
- $this->registry->output->global_message = $this->lang->words['re_msgsconverted'];
- $this->toolsSplashScreen();
- return;
- }
-
-
- /* Select max topic ID thus far */
- $_tmp = $this->DB->buildAndFetch( array( 'select' => 'MAX(mt_id) as max',
- 'from' => 'message_topics' ) );
-
- $topicID = intval( $_tmp['max'] );
-
- $this->DB->build( array( 'select' => '*',
- 'from' => 'message_text',
- 'order' => 'msg_id ASC',
- 'limit' => array( $start, $pergo ) ) );
-
- $o = $this->DB->execute();
-
- while( $post = $this->DB->fetch( $o ) )
- {
- $seen++;
-
- /* Make sure all data is valid */
- if ( intval( $post['msg_sent_to_count'] ) < 1 )
- {
- continue;
- }
-
- /* a little set up */
- $oldTopics = array();
-
- /* Now fetch all topics */
- $this->DB->build( array( 'select' => '*',
- 'from' => 'message_topics_old',
- 'where' => 'mt_msg_id=' . intval( $post['msg_id'] ) ) );
-
- $t = $this->DB->execute();
-
- while( $topic = $this->DB->fetch( $t ) )
- {
- /* Got any data? */
- if ( ! $topic['mt_from_id'] OR ! $topic['mt_to_id'] )
- {
- continue;
- }
-
- $oldTopics[ $topic['mt_id'] ] = $topic;
- }
-
- /* Fail safe */
- if ( ! count( $oldTopics ) )
- {
- continue;
- }
-
- /* Increment number */
- $topicID++;
-
- /* Add in the post */
- $this->DB->insert( 'message_posts', array( 'msg_topic_id' => $topicID,
- 'msg_date' => $post['msg_date'],
- 'msg_post' => $post['msg_post'],
- 'msg_post_key' => $post['msg_post_key'],
- 'msg_author_id' => $post['msg_author_id'],
- 'msg_ip_address' => $post['msg_ip_address'],
- 'msg_is_first_post' => 1 ) );
- $postID = $this->DB->getInsertId();
-
- /* Define some stuff. "To" member is added last in IPB 2 */
- $_tmp = $oldTopics;
- ksort( $_tmp );
- $topicData = array_pop( $_tmp );
- $_invited = array();
- $_seenOwner = array();
- $_isDeleted = 0;
-
- /* Add the member rows */
- foreach( $oldTopics as $mt_id => $data )
- {
- /* Prevent SQL error with unique index: Seen the owner ID already? */
- if ( $_seenOwner[ $data['mt_owner_id'] ] )
- {
- continue;
- }
-
- $_seenOwner[ $data['mt_owner_id'] ] = $data['mt_owner_id'];
-
- /* Build invited - does not include 'to' person */
- if ( $data['mt_owner_id'] AND ( $post['msg_author_id'] != $data['mt_owner_id'] ) AND ( $topicData['mt_to_id'] != $data['mt_owner_id'] ) )
- {
- $_invited[ $data['mt_owner_id'] ] = $data['mt_owner_id'];
- }
-
- $_isSent = ( $data['mt_vid_folder'] == 'sent' ) ? 1 : 0;
- $_isDraft = ( $data['mt_vid_folder'] == 'unsent' ) ? 1 : 0;
-
- $this->DB->insert( 'message_topic_user_map', array( 'map_user_id' => $data['mt_owner_id'],
- 'map_topic_id' => $topicID,
- 'map_folder_id' => ( $_isDraft ) ? 'drafts' : 'myconvo',
- 'map_read_time' => ( $data['mt_user_read'] ) ? $data['mt_user_read'] : ( $data['mt_read'] ? time() : 0 ),
- 'map_user_active' => 1,
- 'map_user_banned' => 0,
- 'map_has_unread' => 0, //( $data['mt_read'] ) ? 0 : 1,
- 'map_is_system' => 0,
- 'map_last_topic_reply' => $post['msg_date'],
- 'map_is_starter' => ( $data['mt_owner_id'] == $post['msg_author_id'] ) ? 1 : 0 ) );
-
- }
-
- /* Now, did we see the author? If not, add them too but as inactive */
- if ( ! $_seenOwner[ $post['msg_author_id'] ] )
- {
- $_isDeleted = 1;
-
- /*$this->DB->insert( 'message_topic_user_map', array( 'map_user_id' => $post['msg_author_id'],
- 'map_topic_id' => $topicID,
- 'map_folder_id' => 'myconvo',
- 'map_read_time' => 0,
- 'map_user_active' => 0,
- 'map_user_banned' => 0,
- 'map_has_unread' => 0,
- 'map_is_system' => 0,
- 'map_is_starter' => 1 ) );*/
- }
-
- $_isSent = ( $topicData['mt_vid_folder'] == 'sent' ) ? 1 : 0;
- $_isDraft = ( $topicData['mt_vid_folder'] == 'unsent' ) ? 1 : 0;
-
- /* Add the topic */
- $this->DB->insert( 'message_topics', array( 'mt_id' => $topicID,
- 'mt_date' => $topicData['mt_date'],
- 'mt_title' => $topicData['mt_title'],
- 'mt_starter_id' => $post['msg_author_id'],
- 'mt_start_time' => $post['msg_date'],
- 'mt_last_post_time' => $post['msg_date'],
- 'mt_invited_members' => serialize( array_keys( $_invited ) ),
- 'mt_to_count' => count( array_keys( $_invited ) ) + 1,
- 'mt_to_member_id' => $topicData['mt_to_id'],
- 'mt_replies' => 0,
- 'mt_last_msg_id' => $postID,
- 'mt_first_msg_id' => $postID,
- 'mt_is_draft' => $_isDraft,
- 'mt_is_deleted' => $_isDeleted,
- 'mt_is_system' => 0 ) );
-
- $converted++;
- }
-
- /* What to do? */
- if ( $seen )
- {
- $this->request['st'] = $start + $pergo;
-
- /* We did some, go check again.. */
- $this->registry->output->global_message = sprintf( $this->lang->words['tools300pms'], $this->request['st'] );
-
- /* Re-do Page */
- $url = "{$this->settings['base_url']}{$this->form_code}&do=".$this->request['do'].'&st=' . $this->request['st'];
- }
- else
- {
- /* Update all members */
- $this->DB->update( 'members', array( 'msg_count_reset' => 1 ) );
-
- $this->registry->output->global_message = $this->lang->words['re_pmsconverted'];
-
- $url = "{$this->settings['base_url']}{$this->form_code}&do=tools";
- }
-
- //-----------------------------------------
- // Bye....
- //-----------------------------------------
-
- $this->registry->output->redirect( $url, $this->registry->output->global_message, $time );
- }
-
- /**
- * Tools: Ban Settings
- *
- * @access public
- * @return void
- */
- public function toolBanSettings()
- {
- //-----------------------------------------
- // Init
- //-----------------------------------------
-
- $bomb = array();
- $ban = array();
- $ip_count = 0;
- $email_count = 0;
- $name_count = 0;
-
- //-----------------------------------------
- // Get current entries
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'banfilters', 'order' => 'ban_date desc' ) );
- $this->DB->execute();
-
- while ( $r = $this->DB->fetch() )
- {
- $ban[ $r['ban_type'] ][ $r['ban_content'] ] = $r;
- }
-
- //-----------------------------------------
- // Get $INFO (again) ip email name
- //-----------------------------------------
-
- require( DOC_IPS_ROOT_PATH."conf_global.php" );
-
- //-----------------------------------------
- // IP
- //-----------------------------------------
-
- if ( $INFO['ban_ip'] )
- {
- $bomb = explode( '|', $INFO['ban_ip'] );
-
- if ( is_array( $bomb ) and count( $bomb ) )
- {
- foreach( $bomb as $bang )
- {
- if ( ! is_array($ban['ip'][ $bang ]) )
- {
- $this->DB->insert( 'banfilters', array( 'ban_type' => 'ip', 'ban_content' => $bang, 'ban_date' => time() ) );
-
- $ip_count++;
- }
- }
- }
- }
-
- //-----------------------------------------
- // EMAIL
- //-----------------------------------------
-
- if ( $INFO['ban_email'] )
- {
- $bomb = explode( '|', $INFO['ban_email'] );
-
- if ( is_array( $bomb ) and count( $bomb ) )
- {
- foreach( $bomb as $bang )
- {
- if ( ! is_array($ban['email'][ $bang ]) )
- {
- $this->DB->insert( 'banfilters', array( 'ban_type' => 'email', 'ban_content' => $bang, 'ban_date' => time() ) );
-
- $email_count++;
- }
- }
- }
- }
-
- //-----------------------------------------
- // EMAIL
- //-----------------------------------------
-
- if ( $INFO['ban_names'] )
- {
- $bomb = explode( '|', $INFO['ban_names'] );
-
- if ( is_array( $bomb ) and count( $bomb ) )
- {
- foreach( $bomb as $bang )
- {
- if ( ! is_array($ban['name'][ $bang ]) )
- {
- $this->DB->insert( 'banfilters', array( 'ban_type' => 'name', 'ban_content' => $bang, 'ban_date' => time() ) );
-
- $name_count++;
- }
- }
- }
- }
-
- $this->registry->output->global_message = sprintf( $this->lang->words['re_bansimport'], $ip_count, $email_count, $name_count );
-
- $this->cache->rebuildCache( 'banfilters', 'global' );
-
- $this->toolsSplashScreen();
- }
-
- /**
- * 2.0.0 Tools: Converge
- *
- * @access public
- * @return void
- */
- public function toolsConverge()
- {
- //-----------------------------------------
- // Get all validating members...
- //-----------------------------------------
-
- $to_unconverge = array();
- $unconverge_count = 0;
-
- $this->DB->build( array( 'select' => 'member_id, email, member_group_id', 'from' => 'members', 'where' => 'member_group_id='.$this->settings['auth_group'] ) );
- $this->DB->execute();
-
- while( $m = $this->DB->fetch() )
- {
- if ( preg_match( "#^{$m['member_id']}\-#", $m['email'] ) )
- {
- $to_unconverge[] = $m['member_id'];
- }
- }
-
- $unconverge_count = intval( count( $to_unconverge ) );
-
- if ( $unconverge_count )
- {
- foreach( $to_unconverge as $mid )
- {
- $this->DB->update( 'members' , array( 'member_group_id' => $this->settings['member_group'] ), 'member_id='.$mid );
- $this->DB->update( 'profile_portal', array( 'bio' => 'dupemail' ), 'pp_member_id='.$mid );
- }
- }
-
- //-----------------------------------------
- // Time to move on dude
- //-----------------------------------------
-
- $this->registry->output->global_message = (sprintf( $this->lang->words['re_convergerest'], $unconverge_count ) );
- $this->toolsSplashScreen();
- }
-
- /**
- * 2.0.0 Tools: Dupe Settings
- *
- * @access public
- * @return void
- */
- public function toolsDupeSettings()
- {
- //-----------------------------------------
- // Remove dupe categories
- //-----------------------------------------
-
- $title_id_to_keep = array();
- $title_id_to_delete = array();
- $title_deleted_count = 0;
-
- $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_settings_titles', 'order' => 'conf_title_id' ) );
- $this->DB->execute();
-
- while ( $r = $this->DB->fetch() )
- {
- if ( $title_id_to_keep[ $r['conf_title_title'] ] )
- {
- $title_id_to_delete[ $r['conf_title_id'] ] = $r['conf_title_id'];
- }
- else
- {
- $title_id_to_keep[ $r['conf_title_title'] ] = $r['conf_title_id'];
- }
- }
-
- if ( count( $title_id_to_delete ) )
- {
- $this->DB->buildAndFetch( array( 'delete' => 'conf_settings_titles', 'where' => 'conf_title_id IN ('.implode( ',', $title_id_to_delete ).')' ) );
- }
-
- $title_deleted_count = intval( count($title_id_to_delete) );
-
- //-----------------------------------------
- // Remove dupe settings
- //-----------------------------------------
-
- $setting_id_to_keep = array();
- $setting_id_to_delete = array();
- $setting_id_deleted_count = 0;
-
- $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'order' => 'conf_id' ) );
- $this->DB->execute();
-
- while ( $r = $this->DB->fetch() )
- {
- if ( $setting_id_to_keep[ $r['conf_title'].','.$r['conf_key'] ] )
- {
- $setting_id_to_delete[ $r['conf_id'] ] = $r['conf_id'];
- }
- else
- {
- $setting_id_to_keep[ $r['conf_title'].','.$r['conf_key'] ] = $r['conf_id'];
- }
- }
-
- if ( count( $setting_id_to_delete ) )
- {
- $this->DB->buildAndFetch( array( 'delete' => 'conf_settings', 'where' => 'conf_id IN ('.implode( ',', $setting_id_to_delete ).')' ) );
- }
-
- $setting_deleted_count = intval( count($setting_id_to_delete) );
-
- //-----------------------------------------
- // Time to move on dude
- //-----------------------------------------
-
- $this->registry->output->global_message = sprintf( $this->lang->words['re_deletetitle'], $title_deleted_count, $setting_deleted_count ) ;
- $this->toolsSplashScreen();
- }
-
- /**
- * 2.1.0 Tools: Dupe Settings
- *
- * @access public
- * @return void
- */
- public function tools210DupeSettings()
- {
- //-----------------------------------------
- // Remove dupe categories
- //-----------------------------------------
-
- $title_id_to_keep = array();
- $title_id_to_delete = array();
- $title_deleted_count = 0;
- $msg = '';
-
- $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_settings_titles', 'order' => 'conf_title_id DESC' ) );
- $this->DB->execute();
-
- while ( $r = $this->DB->fetch() )
- {
- if ( $title_id_to_keep[ $r['conf_title_title'] ] )
- {
- $title_id_to_delete[ $r['conf_title_id'] ] = $r['conf_title_id'];
-
- $msg .= sprintf( $this->lang->words['re_deletingid'], $r['conf_title_title'], $r['conf_title_id'] ) . " ";
- }
- else
- {
- $title_id_to_keep[ $r['conf_title_title'] ] = $r['conf_title_id'];
- $msg .= sprintf( $this->lang->words['re_keepingid'], $r['conf_title_title'], $r['conf_title_id'] ) . " ";
- }
- }
-
- if ( count( $title_id_to_delete ) )
- {
- $this->DB->buildAndFetch( array( 'delete' => 'core_sys_conf_settings', 'where' => 'conf_title_id IN ('.implode( ',', $title_id_to_delete ).')' ) );
- }
-
- $title_deleted_count = intval( count($title_id_to_delete) );
-
- //-----------------------------------------
- // Time to move on dude
- //-----------------------------------------
-
- $this->registry->output->global_message = sprintf( $this->lang->words['re_duplicatetitle'], $title_deleted_count, $msg );
- $this->toolsSplashScreen();
- }
-
- /**
- * 2.1.0 Tools: Calendar Events
- *
- * @access public
- * @return void
- */
- public function tools210Calevents()
- {
- $start = intval($_GET['st']);
- $lend = 50;
- $end = $start + $lend;
- $max = intval($_GET['max']);
-
- //-----------------------------------------
- // Check to make sure table exists
- //-----------------------------------------
-
- if ( ! $this->DB->checkForTable( 'calendar_events' ) )
- {
- $this->registry->output->global_message = $this->lang->words['re_calremoved'];
- $this->toolsSplashScreen();
- return;
- }
-
- //-----------------------------------------
- // Do we need to run this tool?
- //-----------------------------------------
-
- if ( ! $max )
- {
- $original = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as max', 'from' => 'calendar_events' ) );
- $new = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as max', 'from' => 'cal_events' ) );
-
- if ( $new['max'] >= $original['max'] OR ! $original['max'] )
- {
- $this->registry->output->global_message = $this->lang->words['re_calalready'];
- $this->toolsSplashScreen();
- }
- }
-
- $max = intval( $original['max'] );
-
- //-----------------------------------------
- // In steps...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'calendar_events', 'limit' => array( $start, $lend ) ) );
- $o = $this->DB->execute();
-
- //-----------------------------------------
- // Do it...
- //-----------------------------------------
-
- if ( $this->DB->getTotalRows($o) )
- {
- //-----------------------------------------
- // Got some to convert!
- //-----------------------------------------
-
- while ( $r = $this->DB->fetch($o) )
- {
- $recur_remap = array( 'w' => 1,
- 'm' => 2,
- 'y' => 3 );
-
- $begin_date = IPSTime::date_getgmdate( $r['unix_stamp'] );
- $end_date = IPSTime::date_getgmdate( $r['end_unix_stamp'] );
-
- if ( ! $begin_date OR ! $end_date )
- {
- continue;
- }
-
- $day = $begin_date['mday'];
- $month = $begin_date['mon'];
- $year = $begin_date['year'];
-
- $end_day = $end_date['mday'];
- $end_month = $end_date['mon'];
- $end_year = $end_date['year'];
-
- $_final_unix_from = gmmktime(0, 0, 0, $month, $day, $year );
-
- //-----------------------------------------
- // Recur or ranged...
- //-----------------------------------------
-
- if ( $r['event_repeat'] OR $r['event_ranged'] )
- {
- $_final_unix_to = gmmktime(23, 59, 59, $end_month, $end_day, $end_year);
- }
- else
- {
- $_final_unix_to = 0;
- }
-
- $new_event = array( 'event_calendar_id' => 1,
- 'event_member_id' => $r['userid'],
- 'event_content' => $r['event_text'],
- 'event_title' => $r['title'],
- 'event_smilies' => $r['show_emoticons'],
- 'event_perms' => $r['read_perms'],
- 'event_private' => $r['priv_event'],
- 'event_approved' => 1,
- 'event_unixstamp' => $r['unix_stamp'],
- 'event_recurring' => ( $r['event_repeat'] && $recur_remap[ $r['repeat_unit'] ] ) ? $recur_remap[ $r['repeat_unit'] ] : 0,
- 'event_tz' => 0,
- 'event_unix_from' => $_final_unix_from,
- 'event_unix_to' => $_final_unix_to );
-
- //-----------------------------------------
- // INSERT
- //-----------------------------------------
-
- $this->DB->insert( 'cal_events', $new_event );
- }
-
- $this->registry->output->global_message = sprintf( $this->lang->words['re_calstartto'], $start, $end );
-
- $url = "{$this->settings['base_url']}{$this->form_code}&do=".$this->request['do'].'&max='.$max.'&st='.$end;
- }
- else
- {
- $this->registry->output->global_message = $this->lang->words['re_calsconverted'];
-
- $url = "{$this->settings['base_url']}{$this->form_code}&do=tools";
- }
-
- //-----------------------------------------
- // Bye....
- //-----------------------------------------
-
- $this->registry->output->redirect( $url, $this->registry->output->global_message, $time );
- }
-
- /**
- * 2.1.0 Tools: Polls
- *
- * @access public
- * @return void
- */
- public function tools210Polls()
- {
- $start = intval( $this->request['st'] );
- $lend = 50;
- $end = $start + $lend;
- $max = intval( $this->request['max'] );
- $done = 0;
- $converted = intval( $this->request['conv'] );
-
- //-----------------------------------------
- // First off.. grab number of polls to convert
- //-----------------------------------------
-
- if ( ! $max )
- {
- $total = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as max',
- 'from' => 'topics',
- 'where' => "poll_state IN ('open', 'close', 'closed')" ) );
-
- $max = $total['max'];
- }
-
- if ( $max < 1 )
- {
- $done = 1;
- }
-
- //-----------------------------------------
- // In steps...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*',
- 'from' => 'topics',
- 'where' => "poll_state IN ('open', 'close', 'closed' )",
- 'limit' => array( $start, $lend ) ) );
- $o = $this->DB->execute();
-
- //-----------------------------------------
- // Do it...
- //-----------------------------------------
-
- if ( $this->DB->getTotalRows($o) )
- {
- //-----------------------------------------
- // Got some to convert!
- //-----------------------------------------
-
- while ( $r = $this->DB->fetch($o) )
- {
- $converted++;
-
- $new_poll = array( 1 => array() );
-
- $poll_data = $this->DB->buildAndFetch( array( 'select' => '*',
- 'from' => 'polls',
- 'where' => "tid=".$r['tid']
- ) );
- if ( ! $poll_data['pid'] )
- {
- continue;
- }
-
- if ( ! $poll_data['poll_question'] )
- {
- $poll_data['poll_question'] = $r['title'];
- }
-
- //-----------------------------------------
- // Kick start new poll
- //-----------------------------------------
-
- $new_poll[1]['question'] = $poll_data['poll_question'];
-
- //-----------------------------------------
- // Get OLD polls
- //-----------------------------------------
-
- $poll_answers = unserialize( stripslashes( $poll_data['choices'] ) );
-
- reset($poll_answers);
-
- foreach ( $poll_answers as $entry )
- {
- $id = $entry[0];
- $choice = $entry[1];
- $votes = $entry[2];
-
- $total_votes += $votes;
-
- if ( strlen($choice) < 1 )
- {
- continue;
- }
-
- $new_poll[ 1 ]['choice'][ $id ] = $choice;
- $new_poll[ 1 ]['votes'][ $id ] = $votes;
- }
-
- //-----------------------------------------
- // Got something?
- //-----------------------------------------
-
- if ( count( $new_poll[1]['choice'] ) )
- {
- $this->DB->update( 'polls' , array( 'choices' => serialize( $new_poll ) ), 'tid='.$r['tid'] );
- $this->DB->update( 'topics', array( 'poll_state' => 1 ), 'tid='.$r['tid'] );
- }
-
- //-----------------------------------------
- // All done?
- //-----------------------------------------
-
- if ( $converted >= $max )
- {
- $done = 1;
- continue;
- }
- }
- }
- else
- {
- $done = 1;
- }
-
-
- if ( ! $done )
- {
- $this->registry->output->global_message = sprintf( $this->lang->words['re_pollstartto'], $start, $end, $max );
-
- $url = "{$this->settings['base_url']}{$this->form_code}&do=".$this->request['do'].'&max='.$max.'&st='.$end.'&conv='.$converted;
- }
- else
- {
- $this->registry->output->global_message = $this->lang->words['re_pollconverted'];
-
- $url = "{$this->settings['base_url']}{$this->form_code}&do=tools";
- }
-
- //-----------------------------------------
- // Bye....
- //-----------------------------------------
-
- $this->registry->output->redirect( $url, $this->registry->output->global_message, 1 );
- }
-
- /**
- * 2.2.0 Tools: Contacts
- * DEPRECATED
- *
- * @access public
- * @return void
- */
- public function tools220Contacts()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $start = intval($_GET['st']);
- $lend = 50;
- $end = $start + $lend;
- $done = 0;
- $updated = 0;
-
- //-----------------------------------------
- // Get lib
- //-----------------------------------------
-
- require_once( IPSLib::getAppDir('members') . '/sources/friends.php' );
- $profile = new profileFriendsLib( $this->registry );
-
-
- //-----------------------------------------
- // OK..
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*',
- 'from' => 'contacts',
- 'where' => 'allow_msg=1',
- 'limit' => array( $start, $lend ) ) );
-
- $o = $this->DB->execute();
-
- //-----------------------------------------
- // Do it...
- //-----------------------------------------
-
- if ( $this->DB->getTotalRows($o) )
- {
- //-----------------------------------------
- // Got some to convert!
- //-----------------------------------------
-
- while( $row = $this->DB->fetch( $o ) )
- {
- //-----------------------------------------
- // Already a friend
- //-----------------------------------------
-
- $friend = $this->DB->buildAndFetch( array( 'select' => '*',
- 'from' => 'profile_friends',
- 'where' => 'friends_member_id=' . intval( $row['member_id'] ) . ' AND friends_friend_id=' . intval( $row['contact_id'] ) ) );
-
- if ( ! $friend['friends_id'] )
- {
- //-----------------------------------------
- // Add to DB
- //-----------------------------------------
-
- $this->DB->insert( 'profile_friends', array( 'friends_member_id' => $row['member_id'],
- 'friends_friend_id' => $row['contact_id'],
- 'friends_approved' => 1,
- 'friends_added' => time() ) );
-
- //-----------------------------------------
- // Rebuild...
- //-----------------------------------------
-
- $profile->recacheFriends( array( 'member_id' => $row['member_id'] ) );
-
- $updated++;
- }
-
- $this->DB->delete( "contacts", "id={$row['id']}" );
- }
- }
- else
- {
- $done = 1;
- }
-
- //-----------------------------------------
- // Done?
- //-----------------------------------------
-
- if ( ! $done )
- {
- $this->registry->output->global_message = sprintf( $this->lang->words['re_contactsstartto'],$start, $end, $updated );
-
- $url = "{$this->settings['base_url']}{$this->form_code}&do=".$this->request['do'].'&st='.$end;
- }
- else
- {
- $this->registry->output->global_message = $this->lang->words['re_contactsup'];
-
- $url = "{$this->settings['base_url']}{$this->form_code}&do=tools";
- }
-
- //-----------------------------------------
- // Bye....
- //-----------------------------------------
-
- $this->registry->output->redirect( $url, $this->registry->output->global_message, 1 );
- }
-
- /**
- * Cleanup Tools Splash Screen
- *
- * @access public
- * @return void
- */
- public function toolsSplashScreen()
- {
- /* Output */
- $this->registry->output->html .= $this->html->toolsSplashScreen();
- }
-
- /**
- * Count stats
- *
- * @access public
- * @return void
- */
- public function doCount()
- {
- if ( (! $this->request['posts']) and (! $this->request['online']) and (! $this->request['members'] ) and (! $this->request['lastreg'] ) )
- {
- $this->registry->output->showError( $this->lang->words['re_nothing'], 11154 );
- }
-
- $stats = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cache_store', 'where' => "cs_key='stats'" ) );
-
- $stats = unserialize( IPSText::stripslashes( $stats['cs_value'] ) );
-
- if ($this->request['posts'])
- {
- $topics = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as tcount',
- 'from' => 'topics',
- 'where' => 'approved=1' ) );
-
- $posts = $this->DB->buildAndFetch( array( 'select' => 'SUM(posts) as replies',
- 'from' => 'topics',
- 'where' => 'approved=1' ) );
-
- $stats['total_topics'] = $topics['tcount'];
- $stats['total_replies'] = $posts['replies'];
- }
-
- if ($this->request['members'])
- {
- $this->DB->build( array( 'select' => 'count(member_id) as members', 'from' => 'members', 'where' => "member_group_id <> '{$this->settings['auth_group']}'" ) );
- $this->DB->execute();
-
- $r = $this->DB->fetch();
- $stats['mem_count'] = intval($r['members']);
- }
-
- if ($this->request['lastreg'])
- {
- $this->DB->build( array( 'select' => 'member_id, name, members_display_name',
- 'from' => 'members',
- 'where' => "member_group_id <> '{$this->settings['auth_group']}' AND members_display_name != '' AND members_display_name " . $this->DB->buildIsNull( false ),
- 'order' => "member_id DESC",
- 'limit' => array(0,1) ) );
- $this->DB->execute();
-
- $r = $this->DB->fetch();
- $stats['last_mem_name'] = $r['members_display_name'] ? $r['members_display_name'] : $r['name'];
- $stats['last_mem_id'] = $r['member_id'];
- }
-
- if ($this->request['online'])
- {
- $stats['most_date'] = time();
- $stats['most_count'] = 1;
- }
-
- if ( count($stats) > 0 )
- {
- $this->cache->setCache( 'stats', $stats, array( 'array' => 1 ) );
- }
- else
- {
- $this->registry->output->showError( $this->lang->words['re_nothing'], 11155 );
- }
-
- $this->registry->output->global_message = $this->lang->words['re_statsrecount'];
-
- $this->registry->output->doneScreen($this->lang->words['re_statsrecount'], $this->lang->words['re_statscenter'], "{$this->form_code}", 'redirect' );
- }
-
- /**
- * Clean out photos
- *
- * @access public
- * @return void
- */
- public function cleanPhotos()
- {
- /* Upload Class */
- require_once( IPS_KERNEL_PATH.'classUpload.php' );
- $upload = new classUpload();
-
- //-----------------------------------------
- // Set up
- //-----------------------------------------
-
- $done = 0;
- $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
- $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
- $display = $end + $start;
- $output = array();
-
- //-----------------------------------------
- // Pop open the directory and
- // peek inside...
- //-----------------------------------------
-
- $i = 0;
-
- try
- {
- foreach( new DirectoryIterator( $this->settings['upload_dir'] ) as $file )
- {
- if ( strstr( $file->getFilename(), 'photo-' ) )
- {
- $fullfile = $this->settings['upload_dir'].'/'.$file->getFilename();
-
- $i++;
-
- //-----------------------------------------
- // Already started?
- //-----------------------------------------
-
- if ( $start > $i )
- {
- continue;
- }
-
- //-----------------------------------------
- // Done for this iteration?
- //-----------------------------------------
-
- if ( $i > $display )
- {
- break;
- }
-
- //-----------------------------------------
- // Try and get attach row
- //-----------------------------------------
-
- $found = $this->DB->buildAndFetch( array( 'select' => 'pp_member_id', 'from' => 'profile_portal', 'where' => "pp_main_photo='{$file->getFilename()}' OR pp_thumb_photo='{$file->getFilename()}'" ) );
-
- if ( ! $found['pp_member_id'] )
- {
- @unlink( $fullfile );
- $output[] = "{$this->lang->words['re_removedorph']} {$file->getFilename()} ";
- }
- else
- {
- $output[] = "{$this->lang->words['re_attachedok']} {$file->getFilename()} ";
- }
- }
- }
- } catch ( Exception $e ) {}
-
- //-----------------------------------------
- // Finish - or more?...
- //-----------------------------------------
-
- if ( $i < $display)
- {
- //-----------------------------------------
- // Done..
- //-----------------------------------------
-
- $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}";
- $time = 2;
- }
- else
- {
- //-----------------------------------------
- // More..
- //-----------------------------------------
- $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $display );
- $text = $thisgoeshere . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$display}";
- $time = 0;
- }
-
- //-----------------------------------------
- // Bye....
- //-----------------------------------------
-
- $this->registry->output->redirect( $url, $text, $time );
- }
-
- /**
- * Clean out avatars
- *
- * @access public
- * @return void
- */
- public function cleanAvatars()
- {
- /* Upload Class */
- require_once( IPS_KERNEL_PATH.'classUpload.php' );
- $upload = new classUpload();
-
- //-----------------------------------------
- // Set up
- //-----------------------------------------
-
- $done = 0;
- $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
- $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
- $dis = $end + $start;
- $output = array();
-
- //-----------------------------------------
- // Pop open the directory and
- // peek inside...
- //-----------------------------------------
-
- $i = 0;
-
- try
- {
- foreach( new DirectoryIterator( $this->settings['upload_dir'] ) as $file )
- {
- if ( strstr( $file->getFilename(), 'av-' ) )
- {
- $fullfile = $this->settings['upload_dir'].'/'.$file->getFilename();
-
- $i++;
-
- //-----------------------------------------
- // Already started?
- //-----------------------------------------
-
- if ( $start > $i )
- {
- continue;
- }
-
- //-----------------------------------------
- // Done for this iteration?
- //-----------------------------------------
-
- if ( $i > $dis )
- {
- break;
- }
-
- //-----------------------------------------
- // Try and get attach row
- //-----------------------------------------
-
- $found = $this->DB->buildAndFetch( array( 'select' => 'pp_member_id', 'from' => 'profile_portal', 'where' => "avatar_location='{$file->getFilename()}' or avatar_location='upload:{$file->getFilename()}'" ) );
-
- if ( ! $found['pp_member_id'] )
- {
- @unlink( $fullfile );
- $output[] = "{$this->lang->words['re_removedorph']} $file ";
- }
- else
- {
- $output[] = "{$this->lang->words['re_attachedok']} $file ";
- }
- }
- }
- } catch ( Exception $e ) {}
-
- //-----------------------------------------
- // Finish - or more?...
- //-----------------------------------------
-
- if ( $i < $dis)
- {
- //-----------------------------------------
- // Done..
- //-----------------------------------------
-
- $text = $this->lang->words['re_rebuildcomplete'] . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}";
- $time = 2;
- }
- else
- {
- //-----------------------------------------
- // More..
- //-----------------------------------------
- $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
- $text = $thisgoeshere . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
- $time = 0;
- }
-
- //-----------------------------------------
- // Bye....
- //-----------------------------------------
-
- $this->registry->output->redirect( $url, $text, $time );
- }
-
- /**
- * Clean out attachments
- *
- * @access public
- * @return void
- */
- public function cleanAttachments()
- {
- /* Upload Class */
- require_once( IPS_KERNEL_PATH.'classUpload.php' );
- $upload = new classUpload();
-
- //-----------------------------------------
- // Set up
- //-----------------------------------------
-
- $done = 0;
- $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
- $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
- $dis = $end + $start;
- $output = array();
-
- //-----------------------------------------
- // Pop open the directory and
- // peek inside...
- //-----------------------------------------
-
- $i = 0;
- try
- {
- foreach( new DirectoryIterator( $this->settings['upload_dir'] ) as $file )
- {
- if ( $file->getFilename() == '.' OR $file->getFilename() == '..' )
- {
- continue;
- }
-
- $fullfile = $this->settings['upload_dir'] . '/' . $file->getFilename();
-
- if( is_dir( $fullfile ) )
- {
- $ndh = opendir( $fullfile );
-
- try
- {
- foreach( new DirectoryIterator( $fullfile ) as $nfile )
- {
- if ( $nfile->getFilename() == '.' OR $nfile->getFilename() == '..' )
- {
- continue;
- }
-
- if ( strstr( $nfile->getFilename(), 'post-' ) )
- {
- $i++;
-
- //-----------------------------------------
- // Already started?
- //-----------------------------------------
-
- if ( $start > $i )
- {
- continue;
- }
-
- //-----------------------------------------
- // Done for this iteration?
- //-----------------------------------------
-
- if ( $i > $dis )
- {
- break;
- }
-
- //-----------------------------------------
- // Try and get attach row
- //-----------------------------------------
-
- $found = $this->DB->buildAndFetch( array( 'select' => 'attach_id', 'from' => 'attachments', 'where' => "attach_location='{$file->getFilename()}/{$nfile->getFilename()}' OR attach_thumb_location='{$file->getFilename()}/{$nfile->getFilename()}'" ) );
-
- if ( ! $found['attach_id'] )
- {
- @unlink( $fullfile . '/' . $nfile );
- $output[] = "{$this->lang->words['re_removedorph']} {$nfile->getFilename()} ";
- }
- else
- {
- $output[] = "{$this->lang->words['re_attachedok']} {$nfile->getFilename()} ";
- }
- }
- }
- } catch ( Exception $e ) {}
- closedir( $ndh );
- }
- else if ( strstr( $file, 'post-' ) )
- {
- $i++;
-
- //-----------------------------------------
- // Already started?
- //-----------------------------------------
-
- if ( $start > $i )
- {
- continue;
- }
-
- //-----------------------------------------
- // Done for this iteration?
- //-----------------------------------------
-
- if ( $i > $dis )
- {
- break;
- }
-
- //-----------------------------------------
- // Try and get attach row
- //-----------------------------------------
-
- $found = $this->DB->buildAndFetch( array( 'select' => 'attach_id', 'from' => 'attachments', 'where' => "attach_location='{$file->getFilename()}' OR attach_thumb_location='{$file->getFilename()}'" ) );
-
- if ( ! $found['attach_id'] )
- {
- @unlink( $fullfile );
- $output[] = "{$this->lang->words['re_removedorph']} {$file->getFilename()} ";
- }
- else
- {
- $output[] = "{$this->lang->words['re_attachedok']} {$file->getFilename()} ";
- }
- }
- }
- } catch ( Exception $e ) {}
-
- //-----------------------------------------
- // Finish - or more?...
- //-----------------------------------------
-
- if ( $i < $dis)
- {
- //-----------------------------------------
- // Done..
- //-----------------------------------------
-
- $text = $this->lang->words['re_rebuidcomp'] . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}";
- $time = 2;
- }
- else
- {
- //-----------------------------------------
- // More..
- //-----------------------------------------
- $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
- $text = $thisgoeshere . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
- $time = 0;
- }
-
- //-----------------------------------------
- // Bye....
- //-----------------------------------------
-
- $this->registry->output->redirect( $url, $text, $time );
- }
-
- /**
- * Rebuild Attachment Data
- *
- * @access public
- * @return void
- */
- public function rebuildAttachdata()
- {
- /* Upload Class */
- require_once( IPS_KERNEL_PATH.'classUpload.php' );
- $upload = new classUpload();
-
- //-----------------------------------------
- // Set up
- //-----------------------------------------
-
- $done = 0;
- $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
- $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
- $dis = $end + $start;
- $output = array();
-
- //-----------------------------------------
- // Got any more?
- //-----------------------------------------
-
- $tmp = $this->DB->buildAndFetch( array( 'select' => 'attach_id', 'from' => 'attachments', 'limit' => array($dis,1) ) );
- $max = intval( $tmp['attach_id'] );
-
- //-----------------------------------------
- // Avoid limit...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'attachments', 'order' => 'attach_id ASC', 'limit' => array($start,$end) ) );
- $outer = $this->DB->execute();
-
- //-----------------------------------------
- // Process...
- //-----------------------------------------
-
- while( $r = $this->DB->fetch( $outer ) )
- {
- //-----------------------------------------
- // Get ext
- //-----------------------------------------
-
- $update = array();
-
- $update['attach_ext'] = $upload->_getFileExtension( $r['attach_file'] );
-
- if ( $r['attach_location'] )
- {
- if ( file_exists( $this->settings['upload_dir'].'/'.$r['attach_location'] ) )
- {
- $update['attach_filesize'] = @filesize( $this->settings['upload_dir'].'/'.$r['attach_location'] );
-
- if( $r['attach_is_image'] )
- {
- $dims = @getimagesize( $this->settings['upload_dir'].'/'.$r['attach_location'] );
-
- if( $dims[0] AND $dims[1] )
- {
- $update['attach_img_width'] = $dims[0];
- $update['attach_img_height'] = $dims[1];
- }
- }
- }
- }
-
- if ( count( $update ) )
- {
- $this->DB->update( 'attachments', $update, 'attach_id='.$r['attach_id'] );
- }
-
- $done++;
- }
-
- //-----------------------------------------
- // Finish - or more?...
- //-----------------------------------------
-
- if ( ! $done and ! $max )
- {
- //-----------------------------------------
- // Done..
- //-----------------------------------------
-
- $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}";
- $time = 2;
- }
- else
- {
- //-----------------------------------------
- // More..
- //-----------------------------------------
- $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
- $text = $thisgoeshere . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
- $time = 0;
- }
-
- //-----------------------------------------
- // Bye....
- //-----------------------------------------
-
- $this->registry->output->redirect( $url, $text, $time );
- }
-
- /**
- * Rebuild Photos
- *
- * @access public
- * @return void
- */
- public function rebuildPhotos()
- {
- /* Image Class */
- require_once( IPS_KERNEL_PATH . 'classImage.php' );
- require_once( IPS_KERNEL_PATH . 'classImageGd.php' );
-
- //-----------------------------------------
- // Set up
- //-----------------------------------------
-
- $done = 0;
- $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
- $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
- $dis = $end + $start;
- $output = array();
-
- //-----------------------------------------
- // Got any more?
- //-----------------------------------------
-
- $tmp = $this->DB->buildAndFetch( array( 'select' => 'pp_member_id', 'from' => 'profile_portal', 'where' => "pp_main_photo != ''", 'order' => 'pp_member_id ASC', 'limit' => array($dis,1) ) );
- $max = intval( $tmp['pp_member_id'] );
-
- //-----------------------------------------
- // Avoid limit...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'profile_portal', 'order' => 'pp_member_id ASC', 'where' => "pp_main_photo != ''", 'limit' => array($start,$end) ) );
- $outer = $this->DB->execute();
-
- //-----------------------------------------
- // Process...
- //-----------------------------------------
-
- while( $r = $this->DB->fetch( $outer ) )
- {
- if ( $r['pp_thumb_photo'] and ( $r['pp_thumb_photo'] != $r['pp_main_photo'] ) )
- {
- if ( file_exists( $this->settings['upload_dir'].'/'.$r['pp_thumb_photo'] ) )
- {
- if ( ! @unlink( $this->settings['upload_dir'].'/'.$r['pp_thumb_photo'] ) )
- {
- $output[] = $this->lang->words['re_noremove'].$r['pp_thumb_photo'];
- continue;
- }
- }
- }
-
- if( !file_exists( $this->settings['upload_dir'] . '/' . $r['pp_main_photo'] ) )
- {
- $output[] = $this->lang->words['re_noresizefound'] . $r['pp_main_photo'];
- continue;
- }
-
- $photo_data = array();
- $thumb_data = array();
-
- $image = new classImageGd();
-
- $image->init( array( 'image_path' => $this->settings['upload_dir'], 'image_file' => $r['pp_main_photo'] ) );
-
- $thumb_data = $image->resizeImage( 50, 50 );
- $image->writeImage( $this->settings['upload_dir'] . '/' . $r['pp_thumb_photo'] );
-
- $photo_data['pp_thumb_width'] = intval($thumb_data['newWidth']);
- $photo_data['pp_thumb_height'] = intval($thumb_data['newHeight']);
- $photo_data['pp_thumb_photo'] = $r['pp_thumb_photo'];
-
- if ( count( $photo_data ) )
- {
- $this->DB->update( 'profile_portal', $photo_data, 'pp_member_id='.$r['pp_member_id'] );
-
- $output[] = $this->lang->words['re_resized'].$r['pp_main_photo'];
- }
-
- unset($image);
-
- $done++;
- }
-
- //-----------------------------------------
- // Finish - or more?...
- //-----------------------------------------
-
- if ( ! $done and ! $max )
- {
- //-----------------------------------------
- // Done..
- //-----------------------------------------
-
- $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}";
- $time = 2;
- }
- else
- {
- //-----------------------------------------
- // More..
- //-----------------------------------------
- $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
- $text = $thisgoeshere . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
- $time = 0;
- }
-
- //-----------------------------------------
- // Bye....
- //-----------------------------------------
-
- $this->registry->output->redirect( $url, $text, $time );
- }
-
- /**
- * Rebuild Post Thumbnails
- *
- * @access public
- * @return void
- */
- public function rebuildThumbnails()
- {
- require_once( IPS_KERNEL_PATH . 'classImage.php' );
- require_once( IPS_KERNEL_PATH . 'classImageGd.php' );
-
- //-----------------------------------------
- // Set up
- //-----------------------------------------
-
- $done = 0;
- $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
- $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
- $dis = $end + $start;
- $output = array();
-
- //-----------------------------------------
- // Got any more?
- //-----------------------------------------
-
- $tmp = $this->DB->buildAndFetch( array( 'select' => 'attach_id', 'from' => 'attachments', 'where' => "attach_rel_module IN('post','msg')", 'limit' => array($dis,1) ) );
- $max = intval( $tmp['attach_id'] );
-
- //-----------------------------------------
- // Avoid limit...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'attachments', 'where' => "attach_rel_module IN('post','msg')", 'order' => 'attach_id ASC', 'limit' => array($start,$end) ) );
- $outer = $this->DB->execute();
-
- //-----------------------------------------
- // Process...
- //-----------------------------------------
-
- while( $r = $this->DB->fetch( $outer ) )
- {
- if ( $r['attach_is_image'] )
- {
- if ( $r['attach_thumb_location'] and ( $r['attach_thumb_location'] != $r['attach_location'] ) )
- {
- if ( file_exists( $this->settings['upload_dir'].'/'.$r['attach_thumb_location'] ) )
- {
- if ( ! @unlink( $this->settings['upload_dir'].'/'.$r['attach_thumb_location'] ) )
- {
- $output[] = $this->lang->words['re_noremove'].$r['attach_thumb_location'];
- continue;
- }
- }
- }
-
- $attach_data = array();
- $thumbnail = $r['attach_thumb_location'] ? $r['attach_thumb_location']
- : preg_replace( "/^(.*)\.(.+?)$/", "\\1_thumb.\\2", $r['attach_location'] );
-
- $image = new classImageGd();
-
- $image->init( array(
- 'image_path' => $this->settings['upload_dir'],
- 'image_file' => $r['attach_location'],
- ) );
-
- $return = $image->resizeImage( $this->settings['siu_width'], $this->settings['siu_height'] );
- $image->writeImage( $this->settings['upload_dir'] . '/' . $thumbnail );
-
- $attach_data['attach_thumb_width'] = intval($return['newWidth'] ? $return['newWidth'] : $image->cur_dimensions['width']);
- $attach_data['attach_thumb_height'] = intval($return['newHeight'] ? $return['newHeight'] : $image->cur_dimensions['height']);
- $attach_data['attach_thumb_location'] = $thumbnail;
-
- if ( count( $attach_data ) )
- {
- $this->DB->update( 'attachments', $attach_data, 'attach_id='.$r['attach_id'] );
-
- $output[] = $this->lang->words['re_resized'].$r['attach_location'];
- }
-
- unset($image);
- }
-
- $done++;
- }
-
- //-----------------------------------------
- // Finish - or more?...
- //-----------------------------------------
-
- if ( ! $done and ! $max )
- {
- //-----------------------------------------
- // Done..
- //-----------------------------------------
-
- $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}";
- $time = 2;
- }
- else
- {
- //-----------------------------------------
- // More..
- //-----------------------------------------
- $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
- $text = $thisgoeshere . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
- $time = 0;
- }
-
- //-----------------------------------------
- // Bye....
- //-----------------------------------------
-
- $this->registry->output->redirect( $url, $text, $time );
- }
-
- /**
- * Rebuild Messenger Totals
- *
- * @access public
- * @return void
- */
- public function rebuildMsgCounts()
- {
- //-----------------------------------------
- // Grab messenger lib
- //-----------------------------------------
-
- require_once( IPSLib::getAppDir( "members" ) . '/sources/classes/messaging/messengerFunctions.php' );
- $messengerFunctions = new messengerFunctions( $this->registry );
-
- //-----------------------------------------
- // Set up
- //-----------------------------------------
-
- $done = 0;
- $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
- $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
- $dis = $end + $start;
- $output = array();
-
- //-----------------------------------------
- // Got any more?
- //-----------------------------------------
-
- $tmp = $this->DB->buildAndFetch( array( 'select' => 'member_id', 'from' => 'members', 'limit' => array($dis,1) ) );
- $max = intval( $tmp['member_id'] );
-
- //-----------------------------------------
- // Avoid limit...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => 'member_id, members_display_name', 'from' => 'members', 'order' => 'member_id ASC', 'limit' => array($start,$end) ) );
- $outer = $this->DB->execute();
-
- //-----------------------------------------
- // Process...
- //-----------------------------------------
-
- while( $r = $this->DB->fetch( $outer ) )
- {
- $messengerFunctions->resetMembersFolderCounts( $r['member_id'] );
- $messengerFunctions->resetMembersTotalTopicCount( $r['member_id'] );
- $messengerFunctions->resetMembersNewTopicCount( $r['member_id'] );
-
- $done++;
- }
-
- //-----------------------------------------
- // Finish - or more?...
- //-----------------------------------------
-
- if ( ! $done and ! $max )
- {
- //-----------------------------------------
- // Done..
- //-----------------------------------------
-
- $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}";
- $time = 2;
- }
- else
- {
- //-----------------------------------------
- // More..
- //-----------------------------------------
- $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
- $text = $thisgoeshere . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
- $time = 0;
- }
-
- //-----------------------------------------
- // Bye....
- //-----------------------------------------
-
- $this->registry->output->redirect( $url, $text, $time );
- }
-
- /**
- * Rebuild Post Count
- *
- * @access public
- * @return void
- */
- public function rebuildPostCount()
- {
- //-----------------------------------------
- // Forums not to count?
- //-----------------------------------------
-
- $forums = array();
-
- foreach( $this->registry->class_forums->forum_by_id as $data )
- {
- if ( ! $data['inc_postcount'] )
- {
- $forums[] = $data['id'];
- }
- }
-
- //-----------------------------------------
- // Set up
- //-----------------------------------------
-
- $done = 0;
- $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
- $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
- $dis = $end + $start;
- $output = array();
-
- //-----------------------------------------
- // Got any more?
- //-----------------------------------------
-
- $tmp = $this->DB->buildAndFetch( array( 'select' => 'member_id', 'from' => 'members', 'limit' => array($dis,1) ) );
- $max = intval( $tmp['member_id'] );
-
- //-----------------------------------------
- // Avoid limit...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => 'member_id, name', 'from' => 'members', 'order' => 'member_id ASC', 'limit' => array($start,$end) ) );
- $outer = $this->DB->execute();
-
- //-----------------------------------------
- // Process...
- //-----------------------------------------
-
- while( $r = $this->DB->fetch( $outer ) )
- {
- if ( ! count( $forums ) )
- {
- $count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count', 'from' => 'posts', 'where' => 'queued != 1 AND author_id='.$r['member_id'] ) );
- }
- else
- {
- $this->DB->build( array( 'select' => 'count(p.pid) as count',
- 'from' => array( 'posts' => 'p' ),
- 'where' => 'p.queued <> 1 AND p.author_id='.$r['member_id'].' AND t.forum_id NOT IN ('.implode(",",$forums).')',
- 'add_join' => array( 1 => array( 'type' => 'left',
- 'from' => array( 'topics' => 't' ),
- 'where' => 't.tid=p.topic_id'
- ) )
- ) );
- $this->DB->execute();
-
- $count = $this->DB->fetch();
- }
-
- $new_post_count = intval( $count['count'] );
-
- $this->DB->update( 'members', array( 'posts' => $new_post_count ), 'member_id='.$r['member_id'] );
-
- $done++;
- }
-
- //-----------------------------------------
- // Finish - or more?...
- //-----------------------------------------
-
- if ( ! $done and ! $max )
- {
- //-----------------------------------------
- // Done..
- //-----------------------------------------
-
- $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}";
- $time = 2;
- }
- else
- {
- //-----------------------------------------
- // More..
- //-----------------------------------------
- $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
- $text = $thisgoeshere . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
- $time = 0;
- }
-
- //-----------------------------------------
- // Bye....
- //-----------------------------------------
-
- $this->registry->output->redirect( $url, $text, $time );
- }
-
- /**
- * Rebuild Seo User Names
- *
- * @access public
- * @return void
- */
- public function rebuildSeoUserNames()
- {
- //-----------------------------------------
- // Set up
- //-----------------------------------------
-
- $done = 0;
- $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
- $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
- $dis = $end + $start;
- $output = array();
-
- //-----------------------------------------
- // Got any more?
- //-----------------------------------------
-
- $tmp = $this->DB->buildAndFetch( array( 'select' => 'member_id', 'from' => 'members', 'limit' => array( $dis, 1 ) ) );
- $max = intval( $tmp['member_id'] );
-
- //-----------------------------------------
- // Avoid limit...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => 'member_id, members_display_name', 'from' => 'members', 'order' => 'member_id ASC', 'limit' => array( $start, $end ) ) );
- $outer = $this->DB->execute();
-
- //-----------------------------------------
- // Process...
- //-----------------------------------------
-
- while( $r = $this->DB->fetch( $outer ) )
- {
- $this->DB->update( 'members', array( 'members_seo_name' => IPSText::makeSeoTitle( $r['members_display_name'] ) ), "member_id=" . $r['member_id'] );
- $done++;
- }
-
- //-----------------------------------------
- // Finish - or more?...
- //-----------------------------------------
-
- if ( ! $done and ! $max )
- {
- //-----------------------------------------
- // Done..
- //-----------------------------------------
-
- $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}";
- $time = 2;
- }
- else
- {
- //-----------------------------------------
- // More..
- //-----------------------------------------
- $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
- $text = $thisgoeshere . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
- $time = 0;
- }
-
- //-----------------------------------------
- // Bye....
- //-----------------------------------------
-
- $this->registry->output->redirect( $url, $text, $time );
- }
-
-
- /**
- * Rebuild Post Names
- *
- * @access public
- * @return void
- */
- public function rebuildPostNames()
- {
- //-----------------------------------------
- // Set up
- //-----------------------------------------
-
- $done = 0;
- $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
- $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
- $dis = $end + $start;
- $output = array();
-
- //-----------------------------------------
- // Got any more?
- //-----------------------------------------
-
- $tmp = $this->DB->buildAndFetch( array( 'select' => 'member_id', 'from' => 'members', 'limit' => array( $dis, 1 ) ) );
- $max = intval( $tmp['member_id'] );
-
- //-----------------------------------------
- // Avoid limit...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => 'member_id, members_display_name', 'from' => 'members', 'order' => 'member_id ASC', 'limit' => array( $start, $end ) ) );
- $outer = $this->DB->execute();
-
- //-----------------------------------------
- // Process...
- //-----------------------------------------
-
- while( $r = $this->DB->fetch( $outer ) )
- {
- $seoName = IPSText::makeSeoTitle( $r['members_display_name'] );
- $this->DB->update( 'topics', array( 'starter_name' => $r['members_display_name'], 'seo_first_name' => $seoName ), "starter_id=" . $r['member_id'] );
- $this->DB->update( 'topics', array( 'last_poster_name' => $r['members_display_name'], 'seo_last_name' => $seoName ), "last_poster_id=" . $r['member_id'] );
-
- $done++;
- }
-
- //-----------------------------------------
- // Finish - or more?...
- //-----------------------------------------
-
- if ( ! $done and ! $max )
- {
- //-----------------------------------------
- // Done..
- //-----------------------------------------
-
- $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}";
- $time = 2;
- }
- else
- {
- //-----------------------------------------
- // More..
- //-----------------------------------------
- $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
- $text = $thisgoeshere . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
- $time = 0;
- }
-
- //-----------------------------------------
- // Bye....
- //-----------------------------------------
-
- $this->registry->output->redirect( $url, $text, $time );
- }
-
- /**
- * Rebuild posts
- *
- * @access public
- * @return void
- */
- public function rebuildPosts()
- {
- //-----------------------------------------
- // If it's "none", go back
- //-----------------------------------------
-
- if( !$this->request['type'] OR $this->request['type'] == 'none' )
- {
- $this->rebuildSplashScreen();
- return;
- }
-
- //-----------------------------------------
- // Only need to rebuild once
- //-----------------------------------------
-
- $sections = array();
- $alreadyRebuilt = $this->DB->buildAndFetch( array( 'select' => 'cs_value', 'from' => 'cache_store', 'where' => "cs_key='isRebuilt'" ) );
-
- if( $alreadyRebuilt['cs_value'] )
- {
- $sections = explode( ',', $alreadyRebuilt['cs_value'] );
- }
-
- //-----------------------------------------
- // Get new parser and old parser
- //-----------------------------------------
-
- require_once( IPS_ROOT_PATH . "sources/handlers/han_parse_bbcode.php" );
- $parser = new parseBbcode( $this->registry );
- $oldparser = new parseBbcode( $this->registry, 'legacy' );
-
- //-----------------------------------------
- // Set up
- //-----------------------------------------
-
- $done = 0;
- $last = 0;
- $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
- $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
- $dis = intval($this->request['dis']) >=0 ? intval($this->request['dis']) : 0;
- $output = array();
- $plugin = null;
-
- $types = array( 'posts', 'pms', 'cal', 'announce', 'sigs', 'aboutme', 'rules' );
-
- foreach( ipsRegistry::$applications as $app_dir => $app_data )
- {
- //-----------------------------------------
- // Retrieve the RSS links for the header
- //-----------------------------------------
-
- if( file_exists( IPSLib::getAppDir( $app_dir ) . '/extensions/upgradePostRebuild.php' ) )
- {
- require_once( IPSLib::getAppDir( $app_dir ) . '/extensions/upgradePostRebuild.php' );
- $className = "postRebuild_{$app_dir}";
-
- if( class_exists( $className ) )
- {
- $rebuild = new $className( $this->registry );
-
- if( method_exists( $rebuild, "getDropdown" ) )
- {
- $options = $rebuild->getDropdown();
-
- if( count($options) )
- {
- foreach( $options as $appOption )
- {
- $types[] = $appOption[0];
-
- if( $appOption[0] == $this->request['type'] )
- {
- $plugin =& $rebuild;
- break 2;
- }
- }
- }
- }
- }
- }
- }
-
- $type = in_array( $this->request['type'], $types ) ? $this->request['type'] : 'posts';
-
- //-----------------------------------------
- // Got any more?
- //-----------------------------------------
-
- switch( $type )
- {
- case 'cal':
- $tmp = $this->DB->buildAndFetch( array( 'select' => 'event_id', 'from' => 'cal_events', 'limit' => array($dis,1) ) );
- $max = intval( $tmp['event_id'] );
- break;
-
- case 'announce':
- $tmp = $this->DB->buildAndFetch( array( 'select' => 'announce_id', 'from' => 'announcements', 'limit' => array($dis,1) ) );
- $max = intval( $tmp['announce_id'] );
- break;
-
- case 'pms':
- $tmp = $this->DB->buildAndFetch( array( 'select' => 'msg_id', 'from' => 'message_posts', 'limit' => array($dis,1) ) );
- $max = intval( $tmp['msg_id'] );
- break;
-
- case 'sigs':
- $tmp = $this->DB->buildAndFetch( array( 'select' => 'pp_member_id', 'from' => 'profile_portal', 'where' => "signature IS NOT NULL AND signature != ''", 'limit' => array($dis,1) ) );
- $max = intval( $tmp['pp_member_id'] );
- break;
-
- case 'aboutme':
- $tmp = $this->DB->buildAndFetch( array( 'select' => 'pp_member_id', 'from' => 'profile_portal', 'where' => "pp_about_me IS NOT NULL AND pp_about_me != ''", 'limit' => array($dis,1) ) );
- $max = intval( $tmp['pp_member_id'] );
- break;
-
- case 'posts':
- $tmp = $this->DB->buildAndFetch( array( 'select' => 'pid', 'from' => 'posts', 'limit' => array($dis,1) ) );
- $max = intval( $tmp['pid'] );
- break;
-
- case 'rules':
- $tmp = $this->DB->buildAndFetch( array( 'select' => 'id', 'from' => 'forums', 'where' => "rules_text IS NOT NULL AND rules_text != ''", 'limit' => array($dis,1) ) );
- $max = intval( $tmp['id'] );
- break;
-
- default:
- $max = $rebuild->getMax( $type, $dis );
- break;
-
- }
-
- //-----------------------------------------
- // Avoid limit...
- //-----------------------------------------
-
- switch( $type )
- {
- case 'cal':
- $this->DB->build( array( 'select' => 'e.*',
- 'from' => array( 'cal_events' => 'e' ),
- 'order' => 'e.event_id ASC',
- 'where' => 'e.event_id > ' . $start,
- 'limit' => array($end),
- 'add_join' => array( 1 => array( 'type' => 'left',
- 'select' => 'm.member_group_id, m.mgroup_others',
- 'from' => array( 'members' => 'm' ),
- 'where' => "m.member_id=e.event_member_id"
- ) )
- ) );
- break;
-
- case 'announce':
- $this->DB->build( array( 'select' => 'a.*',
- 'from' => array( 'announcements' => 'a' ),
- 'order' => 'a.announce_id ASC',
- 'where' => 'a.announce_id > ' . $start,
- 'limit' => array($end),
- 'add_join' => array( 1 => array( 'type' => 'left',
- 'select' => 'm.member_group_id, m.mgroup_others',
- 'from' => array( 'members' => 'm' ),
- 'where' => "m.member_id=a.announce_member_id"
- ) )
- ) );
- break;
-
- case 'pms':
- $this->DB->build( array( 'select' => 'p.*',
- 'from' => array( 'message_posts' => 'p' ),
- 'order' => 'p.msg_id ASC',
- 'where' => 'p.msg_id > ' . $start,
- 'limit' => array($end),
- 'add_join' => array( 1 => array( 'type' => 'left',
- 'select' => 'm.member_group_id, m.mgroup_others',
- 'from' => array( 'members' => 'm' ),
- 'where' => "m.member_id=p.msg_author_id"
- ) )
- ) );
- break;
-
- case 'sigs':
- $this->DB->build( array( 'select' => 'me.signature, me.pp_member_id',
- 'from' => array( 'profile_portal' => 'me' ),
- 'order' => 'me.pp_member_id ASC',
- 'where' => "me.signature IS NOT NULL AND me.signature != '' AND me.pp_member_id > " . $start,
- 'limit' => array($end),
- 'add_join' => array( 1 => array( 'type' => 'left',
- 'select' => 'm.member_group_id, m.mgroup_others',
- 'from' => array( 'members' => 'm' ),
- 'where' => "m.member_id=me.pp_member_id"
- ) )
- ) );
- break;
-
- case 'aboutme':
- $this->DB->build( array( 'select' => 'pp.pp_about_me, pp.pp_member_id',
- 'from' => array( 'profile_portal' => 'pp' ),
- 'order' => 'pp.pp_member_id ASC',
- 'where' => "pp.pp_about_me != '' AND pp.pp_about_me IS NOT NULL AND pp.pp_member_id > " . $start,
- 'limit' => array($end),
- 'add_join' => array( 1 => array( 'type' => 'left',
- 'select' => 'm.member_group_id, m.mgroup_others',
- 'from' => array( 'members' => 'm' ),
- 'where' => "m.member_id=pp.pp_member_id"
- ) )
- ) );
- break;
-
- case 'posts':
- $this->DB->build( array( 'select' => 'p.*',
- 'from' => array( 'posts' => 'p' ),
- 'order' => 'p.pid ASC',
- 'where' => 'p.pid > ' . $start,
- 'limit' => array($end),
- 'add_join' => array( 1 => array( 'type' => 'left',
- 'select' => 't.forum_id',
- 'from' => array( 'topics' => 't' ),
- 'where' => "t.tid=p.topic_id"
- ),
- 2 => array( 'type' => 'left',
- 'select' => 'm.member_group_id, m.mgroup_others',
- 'from' => array( 'members' => 'm' ),
- 'where' => "m.member_id=p.author_id"
- ) )
- ) );
- break;
-
- case 'rules':
- $this->DB->build( array( 'select' => '*', 'from' => 'forums', 'order' => 'id ASC', 'where' => "rules_text IS NOT NULL AND rules_text != '' AND id > " . $start, 'limit' => array($end) ) );
- break;
-
- default:
- $plugin->executeQuery( $type, $start, $end );
- break;
- }
-
- $outer = $this->DB->execute();
-
- //-----------------------------------------
- // Process...
- //-----------------------------------------
-
- while( $r = $this->DB->fetch( $outer ) )
- {
- //-----------------------------------------
- // Reset
- //-----------------------------------------
-
- $parser->quote_open = $oldparser->quote_open = 0;
- $parser->quote_closed = $oldparser->quote_closed = 0;
- $parser->quote_error = $oldparser->quote_error = 0;
- $parser->error = $oldparser->error = '';
- $parser->image_count = $oldparser->image_count = 0;
- $parser->parsing_mgroup = $oldparser->parsing_mgroup = $r['member_group_id'];
- $parser->parsing_mgroup_others = $oldparser->parsing_mgroup_others = $r['mgroup_others'];
-
- $this->memberData['g_bypass_badwords'] = $this->caches['group_cache'][ $r['member_group_id'] ]['g_bypass_badwords'];
-
- switch( $type )
- {
- case 'cal':
- $parser->parse_smilies = $oldparser->parse_smilies = $r['event_smilies'];
- $parser->parse_html = $oldparser->parse_html = 0;
- $parser->parse_bbcode = $oldparser->parse_bbcode = 1;
- $parser->parsing_section = 'calendar';
-
- $rawpost = $oldparser->preEditParse( $r['event_content'] );
- break;
-
- case 'announce':
- $parser->parse_smilies = $oldparser->parse_smilies = 1;
- $parser->parse_html = $oldparser->parse_html = $r['announce_html_enabled'];
- $parser->parse_bbcode = $oldparser->parse_bbcode = 1;
- $parser->parse_nl2br = $oldparser->parse_nl2br = ( $r['announce_html_enabled'] ? $r['announce_nlbr_enabled'] : 1 );
- $parser->parsing_section = 'announcement';
-
- $rawpost = $oldparser->preEditParse( $r['announce_post'] );
- break;
-
- case 'pms':
- $parser->parse_smilies = $oldparser->parse_smilies = 1;
- $parser->parse_html = $oldparser->parse_html = $this->settings['msg_allow_html'];
- $parser->parse_bbcode = $oldparser->parse_bbcode = $this->settings['msg_allow_code'];
- $parser->parse_nl2br = $oldparser->parse_nl2br = 1;
- $parser->parsing_section = 'pms';
-
- $rawpost = $oldparser->preEditParse( $r['msg_post'] );
- break;
-
- case 'sigs':
- $parser->parse_smilies = $oldparser->parse_smilies = 0;
- $parser->parse_html = $oldparser->parse_html = $this->settings['sig_allow_html'];
- $parser->parse_bbcode = $oldparser->parse_bbcode = $this->settings['sig_allow_ibc'];
- $parser->parse_nl2br = $oldparser->parse_nl2br = 1;
- $parser->parsing_section = 'signatures';
-
- $rawpost = $oldparser->preEditParse( $r['signature'] );
- break;
-
- case 'aboutme':
- $parser->parse_smilies = $oldparser->parse_smilies = $this->settings['aboutme_emoticons'];
- $parser->parse_html = $oldparser->parse_html = intval($this->settings['aboutme_html']);
- $parser->parse_bbcode = $oldparser->parse_bbcode = $this->settings['aboutme_bbcode'];
- $parser->parse_nl2br = $oldparser->parse_nl2br = 1;
- $parser->parsing_section = 'aboutme';
-
- $rawpost = $oldparser->preEditParse( $r['pp_about_me'] );
- break;
-
- case 'posts':
- $parser->parse_smilies = $oldparser->parse_smilies = $r['use_emo'];
- $parser->parse_html = $oldparser->parse_html = ( $this->registry->class_forums->forum_by_id[ $r['forum_id'] ]['use_html'] AND
- $this->caches['group_cache'][ $r['member_group_id'] ]['g_dohtml'] AND
- $r['post_htmlstate'] > 0 ) ? 1 : 0;
- $parser->parse_bbcode = $oldparser->parse_bbcode = $this->registry->class_forums->forum_by_id[ $r['forum_id'] ]['use_ibc'];
- $parser->parse_nl2br = $oldparser->parse_nl2br = ( $r['post_htmlstate'] != 1 ) ? 1 : 0;
- $parser->parsing_section = 'topics';
-
- $rawpost = $oldparser->preEditParse( $r['post'] );
- break;
-
- case 'rules':
- $parser->parse_smilies = $oldparser->parse_smilies = 1;
- $parser->parse_html = $oldparser->parse_html = 1;
- $parser->parse_bbcode = $oldparser->parse_bbcode = 1;
- $parser->parse_nl2br = $oldparser->parse_nl2br = 1;
- $parser->parsing_section = 'rules';
-
- $rawpost = $oldparser->preEditParse( $r['rules_text'] );
- break;
-
- default:
- $plugin->parser =& $parser;
- $plugin->oldparser =& $oldparser;
-
- $rawpost = $plugin->getRawPost( $type, $r );
- break;
- }
-
- $newpost = $parser->preDbParse( $rawpost );
-
- //-----------------------------------------
- // Remove old \' escaping
- //-----------------------------------------
-
- $newpost = str_replace( "\\'", "'", $newpost );
-
- //-----------------------------------------
- // Convert old dohtml?
- //-----------------------------------------
-
- $htmlstate = 0;
-
- if ( strstr( strtolower($newpost), '[dohtml]' ) )
- {
- //-----------------------------------------
- // Can we use HTML?
- //-----------------------------------------
-
- if ( $type == 'posts' AND $this->registry->class_forums->forum_by_id[ $r['forum_id'] ]['use_html'] )
- {
- $htmlstate = 2;
- }
-
- $newpost = preg_replace( "#\[dohtml\]#i" , "", $newpost );
- $newpost = preg_replace( "#\[/dohtml\]#i", "", $newpost );
- }
- else
- {
- $htmlstate = intval( $r['post_htmlstate'] );
- }
-
- //-----------------------------------------
- // Convert old attachment tags
- //-----------------------------------------
-
- $newpost = preg_replace( "#\[attachmentid=(\d+?)\]#is", "[attachment=\\1:attachment]", $newpost );
-
- if ( $newpost OR $type == 'sigs' OR $type == 'aboutme' )
- {
- switch( $type )
- {
- case 'posts':
- $this->DB->update( 'posts', array( 'post' => $newpost, 'post_htmlstate' => $htmlstate ), 'pid='.$r['pid'] );
- $last = $r['pid'];
- break;
-
- case 'pms':
- $this->DB->update( 'message_posts', array( 'msg_post' => $newpost ), 'msg_id='.$r['msg_id'] );
- $last = $r['msg_id'];
- break;
-
- case 'sigs':
- $this->DB->update( 'profile_portal', array( 'signature' => $newpost ), 'pp_member_id='.$r['pp_member_id'] );
- $last = $r['pp_member_id'];
- break;
-
- case 'aboutme':
- $this->DB->update( 'profile_portal', array( 'pp_about_me' => $newpost ), 'pp_member_id='.$r['pp_member_id'] );
- $last = $r['pp_member_id'];
- break;
-
- case 'cal':
- $this->DB->update( 'cal_events', array( 'event_content' => $newpost ), 'event_id='.$r['event_id'] );
- $last = $r['event_id'];
- break;
-
- case 'announce':
- $this->DB->update( 'announcements', array( 'announce_post' => $newpost ), 'announce_id='.$r['announce_id'] );
- $last = $r['announce_id'];
- break;
-
- case 'rules':
- $this->DB->update( 'forums', array( 'rules_text' => $newpost ), 'id='.$r['id'] );
- $last = $r['id'];
- break;
-
- default:
- $last = $plugin->storeNewPost( $type, $r, $newpost );
- break;
- }
- }
-
- $done++;
- }
-
- //-----------------------------------------
- // Finish - or more?...
- //-----------------------------------------
-
- if ( ! $last and ! $max )
- {
- //-----------------------------------------
- // Done..
- //-----------------------------------------
-
- $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}";
- $time = 2;
-
- $sections[] = $type;
- $this->DB->replace( 'cache_store', array( 'cs_key' => 'isRebuilt', 'cs_value' => implode( ',', $sections ) ), array( "cs_key" ) );
-
- if( $type == 'posts' )
- {
- $this->DB->delete( 'content_cache_posts' );
- }
- else if( $type == 'sigs' )
- {
- $this->DB->delete( 'content_cache_sigs' );
- }
- }
- else
- {
- //-----------------------------------------
- // More..
- //-----------------------------------------
-
- $dis = $dis + $done;
- $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
- $text = $thisgoeshere . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&type={$type}&pergo={$this->request['pergo']}&st={$last}&dis={$dis}";
- $time = 0;
- }
-
- //-----------------------------------------
- // Bye....
- //-----------------------------------------
-
- $this->registry->output->redirect( $url, $text, $time );
- }
-
- /**
- * Resyncronize Topics
- *
- * @access public
- * @return void
- */
- public function resyncTopics()
- {
- require_once( IPSLib::getAppDir('forums') .'/sources/classes/moderate.php' );
- $modfunc = new moderatorLibrary( $this->registry );
-
- $this->registry->class_localization->loadLanguageFile( array( 'public_global' ) );
-
- //-----------------------------------------
- // Set up
- //-----------------------------------------
-
- $done = 0;
- $start = intval( $this->request['st'] ) >= 0 ? intval( $this->request['st'] ) : 0;
- $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
- $dis = $end + $start;
- $output = array();
-
- //-----------------------------------------
- // Got any more?
- //-----------------------------------------
-
- $tmp = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count', 'from' => 'topics', 'limit' => array( $dis, 1 ) ) );
- $max = intval( $tmp['count'] );
-
- //-----------------------------------------
- // Avoid limit...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'topics', 'where' => 'state != "link"', 'order' => 'tid ASC', 'limit' => array( $start, $end ) ) );
- $outer = $this->DB->execute();
-
- //-----------------------------------------
- // Process...
- //-----------------------------------------
-
- while( $r = $this->DB->fetch( $outer ) )
- {
- $modfunc->rebuildTopic($r['tid'], 0);
-
- if ( $this->request['pergo'] <= 200 )
- {
- $output[] = $this->lang->words['re_processed'].$r['title'];
- }
-
- $done++;
- }
-
- //-----------------------------------------
- // Finish - or more?...
- //-----------------------------------------
-
- if ( ! $done and ! $max )
- {
- //-----------------------------------------
- // Done..
- //-----------------------------------------
-
- $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}";
- $time = 2;
- }
- else
- {
- //-----------------------------------------
- // More..
- //-----------------------------------------
- $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
- $text = $thisgoeshere . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
- $time = 0;
- }
-
- //-----------------------------------------
- // Bye....
- //-----------------------------------------
-
- $this->registry->output->redirect( $url, $text, $time );
- }
-
- /**
- * Resyncronize forum data
- *
- * @access public
- * @return void
- */
- public function resyncForums()
- {
- require_once( IPSLib::getAppDir('forums') .'/sources/classes/moderate.php' );
- $modfunc = new moderatorLibrary( $this->registry );
-
- //-----------------------------------------
- // Set up
- //-----------------------------------------
-
- $done = 0;
- $start = intval( $this->request['st'] ) >= 0 ? intval( $this->request['st'] ) : 0;
- $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
- $dis = $end + $start;
- $output = array();
-
- //-----------------------------------------
- // Got any more?
- //-----------------------------------------
-
- $tmp = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count', 'from' => 'forums', 'limit' => array( $dis, 1 ) ) );
- $max = intval( $tmp['count'] );
-
- //-----------------------------------------
- // Avoid limit...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'forums', 'order' => 'id ASC', 'limit' => array( $start, $end ) ) );
- $outer = $this->DB->execute();
-
- //-----------------------------------------
- // Process...
- //-----------------------------------------
-
- while( $r = $this->DB->fetch( $outer ) )
- {
- $modfunc->forumRecount( $r['id'] );
- $output[] = sprintf( $this->lang->words['rebuild_process_f'], $r['name'] );
- $done++;
- }
-
- //-----------------------------------------
- // Finish - or more?...
- //-----------------------------------------
-
- if ( ! $done and ! $max )
- {
- //-----------------------------------------
- // Done..
- //-----------------------------------------
-
- $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}";
- $time = 2;
- }
- else
- {
- //-----------------------------------------
- // More..
- //-----------------------------------------
- $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
- $text = $thisgoeshere . ' ' . implode( " ", $output );
- $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
- $time = 0;
- }
-
- //-----------------------------------------
- // Bye....
- //-----------------------------------------
-
- $this->registry->output->redirect( $url, $text, $time );
- }
-
- /**
- * Splash screen with rebuild options
- *
- * @access public
- * @return void
- */
- public function rebuildSplashScreen()
- {
- /* Build Form Elements */
- $form = array();
-
- $form['posts'] = $this->registry->output->formDropdown( 'posts' , array( 0 => array( 0, $this->lang->words['yesno_no'] ), 1 => array( 1, $this->lang->words['yesno_yes'] ) ) );
- $form['members'] = $this->registry->output->formDropdown( 'members', array( 0 => array( 0, $this->lang->words['yesno_no'] ), 1 => array( 1, $this->lang->words['yesno_yes'] ) ) );
- $form['lastreg'] = $this->registry->output->formDropdown( 'lastreg', array( 0 => array( 0, $this->lang->words['yesno_no'] ), 1 => array( 1, $this->lang->words['yesno_yes'] ) ) );
- $form['online'] = $this->registry->output->formDropdown( 'online' , array( 0 => array( 0, $this->lang->words['yesno_no'] ), 1 => array( 1, $this->lang->words['yesno_yes'] ) ) );
-
- //-----------------------------------------
- // Only need to rebuild once
- //-----------------------------------------
-
- $todo = array(
- array( 'posts' , $this->lang->words['remenu_posts'] ),
- array( 'pms' , $this->lang->words['remenu_pms'] ),
- array( 'cal' , $this->lang->words['remenu_events'] ),
- array( 'announce', $this->lang->words['remenu_announce'] ),
- array( 'sigs' , $this->lang->words['remenu_sigs'] ),
- array( 'aboutme' , $this->lang->words['remenu_aboutme'] ),
- array( 'rules' , $this->lang->words['remenu_rules'] ),
- );
-
- foreach( ipsRegistry::$applications as $app_dir => $app_data )
- {
- //-----------------------------------------
- // Retrieve the RSS links for the header
- //-----------------------------------------
-
- if( file_exists( IPSLib::getAppDir( $app_dir ) . '/extensions/upgradePostRebuild.php' ) )
- {
- require_once( IPSLib::getAppDir( $app_dir ) . '/extensions/upgradePostRebuild.php' );
- $className = "postRebuild_{$app_dir}";
-
- if( class_exists( $className ) )
- {
- $rebuild = new $className( $this->registry );
-
- if( method_exists( $rebuild, "getDropdown" ) )
- {
- $todo = array_merge( $todo, $rebuild->getDropdown() );
- }
- }
- }
- }
-
- $final = array();
- $sections = array();
-
- $alreadyRebuilt = $this->DB->buildAndFetch( array( 'select' => 'cs_value', 'from' => 'cache_store', 'where' => "cs_key='isRebuilt'" ) );
-
- if( $alreadyRebuilt['cs_value'] )
- {
- $sections = explode( ',', $alreadyRebuilt['cs_value'] );
- }
-
- $form['pergo'] = $this->registry->output->formSimpleInput( 'pergo', '50', 5 );
-
- /* Output */
- $this->registry->output->html .= $this->html->rebuildSplashScreen( $form, $todo, $sections );
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Rebuild & Other Tools
+ * Last Updated: $LastChangedDate: 2010-10-23 08:40:34 -0400 (Sat, 23 Oct 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 7023 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+class admin_core_tools_rebuild extends ipsCommand
+{
+ /**
+ * Skin object
+ *
+ * @var object Skin templates
+ */
+ private $html;
+
+ /**#@+
+ * URL bits
+ *
+ * @var string
+ */
+ public $form_code = '';
+ public $form_code_js = '';
+ /**#@-*/
+
+ /**
+ * Main class entry point
+ *
+ * @param object ipsRegistry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'applications/forums/sources/classes/forums/class_forums.php', 'class_forums', 'forums' );
+ $this->registry->setClass( 'class_forums', new $classToLoad( $registry ) );
+ $this->registry->class_forums->forumsInit();
+
+ /* Load lang and skin */
+ $this->registry->class_localization->loadLanguageFile( array( 'admin_tools' ) );
+ $this->html = $this->registry->output->loadTemplate( 'cp_skin_rebuild' );
+
+ /* URLs */
+ $this->form_code = $this->html->form_code = 'module=tools§ion=rebuild';
+ $this->form_code_js = $this->html->form_code_js = 'module=tools§ion=rebuild';
+
+ /* What to do */
+ switch( $this->request['do'] )
+ {
+ case 'docount':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_recount' );
+ $this->doCount();
+ break;
+
+ case 'doresyncforums':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_resynch' );
+ $this->resyncForums();
+ break;
+
+ case 'doresynctopics':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_resyncht' );
+ $this->resyncTopics();
+ break;
+
+ case 'doposts':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_rebuild' );
+ $this->rebuildPosts();
+ break;
+
+ case 'dopostnames':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_postcounts' );
+ $this->rebuildPostNames();
+ break;
+
+ case 'dopostcounts':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_postcounts' );
+ $this->rebuildPostCount();
+ break;
+
+ case 'dothumbnails':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_thumbs' );
+ $this->rebuildThumbnails();
+ break;
+
+ case 'dophotos':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_thumbs' );
+ $this->rebuildPhotos();
+ break;
+
+ case 'doattachdata':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_attach' );
+ $this->rebuildAttachdata();
+ break;
+
+ case 'doseousernames':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_rebuild' );
+ $this->rebuildSeoUserNames();
+ break;
+ case 'cleanattachments':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_orphaned' );
+ $this->cleanAttachments();
+ break;
+
+ case 'cleanavatars':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_orphana' );
+ $this->cleanAvatars();
+ break;
+
+ case 'cleanphotos':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_orphanp' );
+ $this->cleanPhotos();
+ break;
+
+ case 'domsgcounts':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_postcounts' );
+ $this->rebuildMsgCounts();
+ break;
+
+ //-----------------------------------------
+ // Tools
+ //-----------------------------------------
+
+ case '300pms':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_220' );
+ $this->tools300Pms();
+ break;
+
+ case '220tool_contacts':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_220' );
+ $this->tools220Contacts();
+ break;
+
+ case '210polls':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_220' );
+ $this->tools210Polls();
+ break;
+
+ case '210calevents':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_220' );
+ $this->tools210Calevents();
+ break;
+
+ case '210tool_settings':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_220' );
+ $this->tools210DupeSettings();
+ break;
+
+ case 'tool_settings':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_220' );
+ $this->toolsDupeSettings();
+ break;
+
+ case 'tool_converge':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_220' );
+ $this->toolsConverge();
+ break;
+
+ case 'tool_bansettings':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_220' );
+ $this->toolBanSettings();
+ break;
+
+ case 'tools':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'tools_220' );
+ $this->toolsSplashScreen();
+ break;
+
+ case 'rebuild_overview':
+ default:
+ $this->rebuildSplashScreen();
+ break;
+ }
+
+ /* Output */
+ $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * 3.0.x Tools: PM Conversion
+ *
+ * @return void
+ */
+ public function tools300pms()
+ {
+ /* INIT */
+ $pergo = 100;
+ $start = intval( $this->request['st'] );
+ $converted = 0;
+ $seen = 0;
+
+ //-----------------------------------------
+ // Check to make sure table exists
+ //-----------------------------------------
+
+ if ( ! $this->DB->checkForTable( 'message_text' ) )
+ {
+ $this->registry->output->global_message = $this->lang->words['re_msgsconverted'];
+ $this->toolsSplashScreen();
+ return;
+ }
+
+
+ /* Select max topic ID thus far */
+ $_tmp = $this->DB->buildAndFetch( array( 'select' => 'MAX(mt_id) as max',
+ 'from' => 'message_topics' ) );
+
+ $topicID = intval( $_tmp['max'] );
+
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'message_text',
+ 'order' => 'msg_id ASC',
+ 'limit' => array( $start, $pergo ) ) );
+
+ $o = $this->DB->execute();
+
+ while( $post = $this->DB->fetch( $o ) )
+ {
+ $seen++;
+
+ /* Make sure all data is valid */
+ if ( intval( $post['msg_sent_to_count'] ) < 1 )
+ {
+ continue;
+ }
+
+ /* a little set up */
+ $oldTopics = array();
+
+ /* Now fetch all topics */
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'message_topics_old',
+ 'where' => 'mt_msg_id=' . intval( $post['msg_id'] ) ) );
+
+ $t = $this->DB->execute();
+
+ while( $topic = $this->DB->fetch( $t ) )
+ {
+ /* Got any data? */
+ if ( ! $topic['mt_from_id'] OR ! $topic['mt_to_id'] )
+ {
+ continue;
+ }
+
+ $oldTopics[ $topic['mt_id'] ] = $topic;
+ }
+
+ /* Fail safe */
+ if ( ! count( $oldTopics ) )
+ {
+ continue;
+ }
+
+ /* Increment number */
+ $topicID++;
+
+ /* Add in the post */
+ $this->DB->insert( 'message_posts', array( 'msg_topic_id' => $topicID,
+ 'msg_date' => $post['msg_date'],
+ 'msg_post' => $post['msg_post'],
+ 'msg_post_key' => $post['msg_post_key'],
+ 'msg_author_id' => $post['msg_author_id'],
+ 'msg_ip_address' => $post['msg_ip_address'],
+ 'msg_is_first_post' => 1 ) );
+ $postID = $this->DB->getInsertId();
+
+ /* Define some stuff. "To" member is added last in IPB 2 */
+ $_tmp = $oldTopics;
+ ksort( $_tmp );
+ $topicData = array_pop( $_tmp );
+ $_invited = array();
+ $_seenOwner = array();
+ $_isDeleted = 0;
+
+ /* Add the member rows */
+ foreach( $oldTopics as $mt_id => $data )
+ {
+ /* Prevent SQL error with unique index: Seen the owner ID already? */
+ if ( $_seenOwner[ $data['mt_owner_id'] ] )
+ {
+ continue;
+ }
+
+ $_seenOwner[ $data['mt_owner_id'] ] = $data['mt_owner_id'];
+
+ /* Build invited - does not include 'to' person */
+ if ( $data['mt_owner_id'] AND ( $post['msg_author_id'] != $data['mt_owner_id'] ) AND ( $topicData['mt_to_id'] != $data['mt_owner_id'] ) )
+ {
+ $_invited[ $data['mt_owner_id'] ] = $data['mt_owner_id'];
+ }
+
+ $_isSent = ( $data['mt_vid_folder'] == 'sent' ) ? 1 : 0;
+ $_isDraft = ( $data['mt_vid_folder'] == 'unsent' ) ? 1 : 0;
+
+ $this->DB->insert( 'message_topic_user_map', array( 'map_user_id' => $data['mt_owner_id'],
+ 'map_topic_id' => $topicID,
+ 'map_folder_id' => ( $_isDraft ) ? 'drafts' : 'myconvo',
+ 'map_read_time' => ( $data['mt_user_read'] ) ? $data['mt_user_read'] : ( $data['mt_read'] ? time() : 0 ),
+ 'map_user_active' => 1,
+ 'map_user_banned' => 0,
+ 'map_has_unread' => 0, //( $data['mt_read'] ) ? 0 : 1,
+ 'map_is_system' => 0,
+ 'map_last_topic_reply' => $post['msg_date'],
+ 'map_is_starter' => ( $data['mt_owner_id'] == $post['msg_author_id'] ) ? 1 : 0 ) );
+
+ }
+
+ /* Now, did we see the author? If not, add them too but as inactive */
+ if ( ! $_seenOwner[ $post['msg_author_id'] ] )
+ {
+ $_isDeleted = 1;
+
+ /*$this->DB->insert( 'message_topic_user_map', array( 'map_user_id' => $post['msg_author_id'],
+ 'map_topic_id' => $topicID,
+ 'map_folder_id' => 'myconvo',
+ 'map_read_time' => 0,
+ 'map_user_active' => 0,
+ 'map_user_banned' => 0,
+ 'map_has_unread' => 0,
+ 'map_is_system' => 0,
+ 'map_is_starter' => 1 ) );*/
+ }
+
+ $_isSent = ( $topicData['mt_vid_folder'] == 'sent' ) ? 1 : 0;
+ $_isDraft = ( $topicData['mt_vid_folder'] == 'unsent' ) ? 1 : 0;
+
+ /* This is for MSSQL. I need a quick fix. This is it. Enjoy. */
+ if ( method_exists( $this->DB, 'setTableIdentityInsert' ) )
+ {
+ $this->DB->setTableIdentityInsert( 'message_topics', 'ON' );
+ }
+
+ /* Add the topic */
+ $this->DB->insert( 'message_topics', array( 'mt_id' => $topicID,
+ 'mt_date' => $topicData['mt_date'],
+ 'mt_title' => $topicData['mt_title'],
+ 'mt_starter_id' => $post['msg_author_id'],
+ 'mt_start_time' => $post['msg_date'],
+ 'mt_last_post_time' => $post['msg_date'],
+ 'mt_invited_members' => serialize( array_keys( $_invited ) ),
+ 'mt_to_count' => count( array_keys( $_invited ) ) + 1,
+ 'mt_to_member_id' => $topicData['mt_to_id'],
+ 'mt_replies' => 0,
+ 'mt_last_msg_id' => $postID,
+ 'mt_first_msg_id' => $postID,
+ 'mt_is_draft' => $_isDraft,
+ 'mt_is_deleted' => $_isDeleted,
+ 'mt_is_system' => 0 ) );
+
+ /* This is for MSSQL. I need a quick fix. This is it. Enjoy. */
+ if ( method_exists( $this->DB, 'setTableIdentityInsert' ) )
+ {
+ $this->DB->setTableIdentityInsert( 'message_topics', 'OFF' );
+ }
+
+ $converted++;
+ }
+
+ /* What to do? */
+ if ( $seen )
+ {
+ $this->request['st'] = $start + $pergo;
+
+ /* We did some, go check again.. */
+ $this->registry->output->global_message = sprintf( $this->lang->words['tools300pms'], $this->request['st'], $converted );
+
+ /* Re-do Page */
+ $url = "{$this->settings['base_url']}{$this->form_code}&do=".$this->request['do'].'&st=' . $this->request['st'];
+ }
+ else
+ {
+ /* Update all members */
+ $this->DB->update( 'members', array( 'msg_count_reset' => 1 ) );
+
+ $this->registry->output->global_message = $this->lang->words['re_pmsconverted'];
+
+ $url = "{$this->settings['base_url']}{$this->form_code}&do=tools";
+ }
+
+ //-----------------------------------------
+ // Bye....
+ //-----------------------------------------
+
+ $this->registry->output->redirect( $url, $this->registry->output->global_message, 1 );
+ }
+
+ /**
+ * Tools: Ban Settings
+ *
+ * @return void
+ */
+ public function toolBanSettings()
+ {
+ //-----------------------------------------
+ // Init
+ //-----------------------------------------
+
+ $bomb = array();
+ $ban = array();
+ $ip_count = 0;
+ $email_count = 0;
+ $name_count = 0;
+
+ //-----------------------------------------
+ // Get current entries
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'banfilters', 'order' => 'ban_date desc' ) );
+ $this->DB->execute();
+
+ while ( $r = $this->DB->fetch() )
+ {
+ $ban[ $r['ban_type'] ][ $r['ban_content'] ] = $r;
+ }
+
+ //-----------------------------------------
+ // Get $INFO (again) ip email name
+ //-----------------------------------------
+ $INFO = array();
+ require( DOC_IPS_ROOT_PATH."conf_global.php" );
+
+ //-----------------------------------------
+ // IP
+ //-----------------------------------------
+
+ if ( $INFO['ban_ip'] )
+ {
+ $bomb = explode( '|', $INFO['ban_ip'] );
+
+ if ( is_array( $bomb ) and count( $bomb ) )
+ {
+ foreach( $bomb as $bang )
+ {
+ if ( ! is_array($ban['ip'][ $bang ]) )
+ {
+ $this->DB->insert( 'banfilters', array( 'ban_type' => 'ip', 'ban_content' => $bang, 'ban_date' => time() ) );
+
+ $ip_count++;
+ }
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // EMAIL
+ //-----------------------------------------
+
+ if ( $INFO['ban_email'] )
+ {
+ $bomb = explode( '|', $INFO['ban_email'] );
+
+ if ( is_array( $bomb ) and count( $bomb ) )
+ {
+ foreach( $bomb as $bang )
+ {
+ if ( ! is_array($ban['email'][ $bang ]) )
+ {
+ $this->DB->insert( 'banfilters', array( 'ban_type' => 'email', 'ban_content' => $bang, 'ban_date' => time() ) );
+
+ $email_count++;
+ }
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // EMAIL
+ //-----------------------------------------
+
+ if ( $INFO['ban_names'] )
+ {
+ $bomb = explode( '|', $INFO['ban_names'] );
+
+ if ( is_array( $bomb ) and count( $bomb ) )
+ {
+ foreach( $bomb as $bang )
+ {
+ if ( ! is_array($ban['name'][ $bang ]) )
+ {
+ $this->DB->insert( 'banfilters', array( 'ban_type' => 'name', 'ban_content' => $bang, 'ban_date' => time() ) );
+
+ $name_count++;
+ }
+ }
+ }
+ }
+
+ $this->registry->output->global_message = sprintf( $this->lang->words['re_bansimport'], $ip_count, $email_count, $name_count );
+
+ $this->cache->rebuildCache( 'banfilters', 'global' );
+
+ $this->toolsSplashScreen();
+ }
+
+ /**
+ * 2.0.0 Tools: Converge
+ *
+ * @return void
+ */
+ public function toolsConverge()
+ {
+ //-----------------------------------------
+ // Get all validating members...
+ //-----------------------------------------
+
+ $to_unconverge = array();
+ $unconverge_count = 0;
+
+ $this->DB->build( array( 'select' => 'member_id, email, member_group_id', 'from' => 'members', 'where' => 'member_group_id='.$this->settings['auth_group'] ) );
+ $this->DB->execute();
+
+ while( $m = $this->DB->fetch() )
+ {
+ if ( preg_match( "#^{$m['member_id']}\-#", $m['email'] ) )
+ {
+ $to_unconverge[] = $m['member_id'];
+ }
+ }
+
+ $unconverge_count = intval( count( $to_unconverge ) );
+
+ if ( $unconverge_count )
+ {
+ foreach( $to_unconverge as $mid )
+ {
+ $this->DB->update( 'members' , array( 'member_group_id' => $this->settings['member_group'] ), 'member_id='.$mid );
+ }
+ }
+
+ //-----------------------------------------
+ // Time to move on dude
+ //-----------------------------------------
+
+ $this->registry->output->global_message = (sprintf( $this->lang->words['re_convergerest'], $unconverge_count ) );
+ $this->toolsSplashScreen();
+ }
+
+ /**
+ * 2.0.0 Tools: Dupe Settings
+ *
+ * @return void
+ */
+ public function toolsDupeSettings()
+ {
+ //-----------------------------------------
+ // Remove dupe categories
+ //-----------------------------------------
+
+ $title_id_to_keep = array();
+ $title_id_to_delete = array();
+ $title_deleted_count = 0;
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_settings_titles', 'order' => 'conf_title_id' ) );
+ $this->DB->execute();
+
+ while ( $r = $this->DB->fetch() )
+ {
+ if ( $title_id_to_keep[ $r['conf_title_title'] ] )
+ {
+ $title_id_to_delete[ $r['conf_title_id'] ] = $r['conf_title_id'];
+ }
+ else
+ {
+ $title_id_to_keep[ $r['conf_title_title'] ] = $r['conf_title_id'];
+ }
+ }
+
+ if ( count( $title_id_to_delete ) )
+ {
+ $this->DB->buildAndFetch( array( 'delete' => 'conf_settings_titles', 'where' => 'conf_title_id IN ('.implode( ',', $title_id_to_delete ).')' ) );
+ }
+
+ $title_deleted_count = intval( count($title_id_to_delete) );
+
+ //-----------------------------------------
+ // Remove dupe settings
+ //-----------------------------------------
+
+ $setting_id_to_keep = array();
+ $setting_id_to_delete = array();
+ $setting_id_deleted_count = 0;
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'order' => 'conf_id' ) );
+ $this->DB->execute();
+
+ while ( $r = $this->DB->fetch() )
+ {
+ if ( $setting_id_to_keep[ $r['conf_title'].','.$r['conf_key'] ] )
+ {
+ $setting_id_to_delete[ $r['conf_id'] ] = $r['conf_id'];
+ }
+ else
+ {
+ $setting_id_to_keep[ $r['conf_title'].','.$r['conf_key'] ] = $r['conf_id'];
+ }
+ }
+
+ if ( count( $setting_id_to_delete ) )
+ {
+ $this->DB->buildAndFetch( array( 'delete' => 'conf_settings', 'where' => 'conf_id IN ('.implode( ',', $setting_id_to_delete ).')' ) );
+ }
+
+ $setting_deleted_count = intval( count($setting_id_to_delete) );
+
+ //-----------------------------------------
+ // Time to move on dude
+ //-----------------------------------------
+
+ $this->registry->output->global_message = sprintf( $this->lang->words['re_deletetitle'], $title_deleted_count, $setting_deleted_count ) ;
+ $this->toolsSplashScreen();
+ }
+
+ /**
+ * 2.1.0 Tools: Dupe Settings
+ *
+ * @return void
+ */
+ public function tools210DupeSettings()
+ {
+ //-----------------------------------------
+ // Remove dupe categories
+ //-----------------------------------------
+
+ $title_id_to_keep = array();
+ $title_id_to_delete = array();
+ $title_deleted_count = 0;
+ $msg = '';
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_settings_titles', 'order' => 'conf_title_id DESC' ) );
+ $this->DB->execute();
+
+ while ( $r = $this->DB->fetch() )
+ {
+ if ( $title_id_to_keep[ $r['conf_title_title'] ] )
+ {
+ $title_id_to_delete[ $r['conf_title_id'] ] = $r['conf_title_id'];
+
+ $msg .= sprintf( $this->lang->words['re_deletingid'], $r['conf_title_title'], $r['conf_title_id'] ) . " ";
+ }
+ else
+ {
+ $title_id_to_keep[ $r['conf_title_title'] ] = $r['conf_title_id'];
+ $msg .= sprintf( $this->lang->words['re_keepingid'], $r['conf_title_title'], $r['conf_title_id'] ) . " ";
+ }
+ }
+
+ if ( count( $title_id_to_delete ) )
+ {
+ $this->DB->delete( 'core_sys_conf_settings', 'conf_title_id IN ('.implode( ',', $title_id_to_delete ).')' );
+ }
+
+ $title_deleted_count = intval( count($title_id_to_delete) );
+
+ //-----------------------------------------
+ // Time to move on dude
+ //-----------------------------------------
+
+ $this->registry->output->global_message = sprintf( $this->lang->words['re_duplicatetitle'], $title_deleted_count, $msg );
+ $this->toolsSplashScreen();
+ }
+
+ /**
+ * 2.1.0 Tools: Calendar Events
+ *
+ * @return void
+ */
+ public function tools210Calevents()
+ {
+ $start = intval($_GET['st']);
+ $lend = 50;
+ $end = $start + $lend;
+ $max = intval($_GET['max']);
+
+ //-----------------------------------------
+ // Check to make sure table exists
+ //-----------------------------------------
+
+ if ( ! $this->DB->checkForTable( 'calendar_events' ) )
+ {
+ $this->registry->output->global_message = $this->lang->words['re_calremoved'];
+ $this->toolsSplashScreen();
+ return;
+ }
+
+ //-----------------------------------------
+ // Do we need to run this tool?
+ //-----------------------------------------
+
+ if ( ! $max )
+ {
+ $original = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as max', 'from' => 'calendar_events' ) );
+ $new = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as max', 'from' => 'cal_events' ) );
+
+ if ( $new['max'] >= $original['max'] OR ! $original['max'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['re_calalready'];
+ $this->toolsSplashScreen();
+ }
+ }
+
+ $max = intval( $original['max'] );
+
+ //-----------------------------------------
+ // In steps...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'calendar_events', 'limit' => array( $start, $lend ) ) );
+ $o = $this->DB->execute();
+
+ //-----------------------------------------
+ // Do it...
+ //-----------------------------------------
+
+ if ( $this->DB->getTotalRows($o) )
+ {
+ //-----------------------------------------
+ // Got some to convert!
+ //-----------------------------------------
+
+ while ( $r = $this->DB->fetch($o) )
+ {
+ $recur_remap = array( 'w' => 1,
+ 'm' => 2,
+ 'y' => 3 );
+
+ $begin_date = IPSTime::date_getgmdate( $r['unix_stamp'] );
+ $end_date = IPSTime::date_getgmdate( $r['end_unix_stamp'] );
+
+ if ( ! $begin_date OR ! $end_date )
+ {
+ continue;
+ }
+
+ $day = $begin_date['mday'];
+ $month = $begin_date['mon'];
+ $year = $begin_date['year'];
+
+ $end_day = $end_date['mday'];
+ $end_month = $end_date['mon'];
+ $end_year = $end_date['year'];
+
+ $_final_unix_from = gmmktime(0, 0, 0, $month, $day, $year );
+
+ //-----------------------------------------
+ // Recur or ranged...
+ //-----------------------------------------
+
+ if ( $r['event_repeat'] OR $r['event_ranged'] )
+ {
+ $_final_unix_to = gmmktime(23, 59, 59, $end_month, $end_day, $end_year);
+ }
+ else
+ {
+ $_final_unix_to = 0;
+ }
+
+ $new_event = array( 'event_calendar_id' => 1,
+ 'event_member_id' => $r['userid'],
+ 'event_content' => $r['event_text'],
+ 'event_title' => $r['title'],
+ 'event_smilies' => $r['show_emoticons'],
+ 'event_perms' => $r['read_perms'],
+ 'event_private' => $r['priv_event'],
+ 'event_approved' => 1,
+ 'event_unixstamp' => $r['unix_stamp'],
+ 'event_recurring' => ( $r['event_repeat'] && $recur_remap[ $r['repeat_unit'] ] ) ? $recur_remap[ $r['repeat_unit'] ] : 0,
+ 'event_tz' => 0,
+ 'event_unix_from' => $_final_unix_from,
+ 'event_unix_to' => $_final_unix_to );
+
+ //-----------------------------------------
+ // INSERT
+ //-----------------------------------------
+
+ $this->DB->insert( 'cal_events', $new_event );
+ }
+
+ $this->registry->output->global_message = sprintf( $this->lang->words['re_calstartto'], $start, $end );
+
+ $url = "{$this->settings['base_url']}{$this->form_code}&do=".$this->request['do'].'&max='.$max.'&st='.$end;
+ }
+ else
+ {
+ $this->registry->output->global_message = $this->lang->words['re_calsconverted'];
+
+ $url = "{$this->settings['base_url']}{$this->form_code}&do=tools";
+ }
+
+ //-----------------------------------------
+ // Bye....
+ //-----------------------------------------
+
+ $this->registry->output->redirect( $url, $this->registry->output->global_message, 1 );
+ }
+
+ /**
+ * 2.1.0 Tools: Polls
+ *
+ * @return void
+ */
+ public function tools210Polls()
+ {
+ $start = intval( $this->request['st'] );
+ $lend = 50;
+ $end = $start + $lend;
+ $max = intval( $this->request['max'] );
+ $done = 0;
+ $converted = intval( $this->request['conv'] );
+
+ //-----------------------------------------
+ // First off.. grab number of polls to convert
+ //-----------------------------------------
+
+ if ( ! $max )
+ {
+ $total = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as max',
+ 'from' => 'topics',
+ 'where' => "poll_state IN ('open', 'close', 'closed')" ) );
+
+ $max = $total['max'];
+ }
+
+ if ( $max < 1 )
+ {
+ $done = 1;
+ }
+
+ //-----------------------------------------
+ // In steps...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'topics',
+ 'where' => "poll_state IN ('open', 'close', 'closed' )",
+ 'limit' => array( $start, $lend ) ) );
+ $o = $this->DB->execute();
+
+ //-----------------------------------------
+ // Do it...
+ //-----------------------------------------
+
+ if ( $this->DB->getTotalRows($o) )
+ {
+ //-----------------------------------------
+ // Got some to convert!
+ //-----------------------------------------
+
+ while ( $r = $this->DB->fetch($o) )
+ {
+ $converted++;
+
+ $new_poll = array( 1 => array() );
+
+ $poll_data = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'polls',
+ 'where' => "tid=".$r['tid']
+ ) );
+ if ( ! $poll_data['pid'] )
+ {
+ continue;
+ }
+
+ if ( ! $poll_data['poll_question'] )
+ {
+ $poll_data['poll_question'] = $r['title'];
+ }
+
+ //-----------------------------------------
+ // Kick start new poll
+ //-----------------------------------------
+
+ $new_poll[1]['question'] = $poll_data['poll_question'];
+
+ //-----------------------------------------
+ // Get OLD polls
+ //-----------------------------------------
+
+ $poll_answers = unserialize( stripslashes( $poll_data['choices'] ) );
+
+ reset($poll_answers);
+
+ foreach ( $poll_answers as $entry )
+ {
+ $id = $entry[0];
+ $choice = $entry[1];
+ $votes = $entry[2];
+
+ $total_votes += $votes;
+
+ if ( strlen($choice) < 1 )
+ {
+ continue;
+ }
+
+ $new_poll[ 1 ]['choice'][ $id ] = $choice;
+ $new_poll[ 1 ]['votes'][ $id ] = $votes;
+ }
+
+ //-----------------------------------------
+ // Got something?
+ //-----------------------------------------
+
+ if ( count( $new_poll[1]['choice'] ) )
+ {
+ $this->DB->update( 'polls' , array( 'choices' => serialize( $new_poll ) ), 'tid='.$r['tid'] );
+ $this->DB->update( 'topics', array( 'poll_state' => 1 ), 'tid='.$r['tid'] );
+ }
+
+ //-----------------------------------------
+ // All done?
+ //-----------------------------------------
+
+ if ( $converted >= $max )
+ {
+ $done = 1;
+ continue;
+ }
+ }
+ }
+ else
+ {
+ $done = 1;
+ }
+
+
+ if ( ! $done )
+ {
+ $this->registry->output->global_message = sprintf( $this->lang->words['re_pollstartto'], $start, $end, $max );
+
+ $url = "{$this->settings['base_url']}{$this->form_code}&do=".$this->request['do'].'&max='.$max.'&st='.$end.'&conv='.$converted;
+ }
+ else
+ {
+ $this->registry->output->global_message = $this->lang->words['re_pollconverted'];
+
+ $url = "{$this->settings['base_url']}{$this->form_code}&do=tools";
+ }
+
+ //-----------------------------------------
+ // Bye....
+ //-----------------------------------------
+
+ $this->registry->output->redirect( $url, $this->registry->output->global_message, 1 );
+ }
+
+ /**
+ * 2.2.0 Tools: Contacts
+ * DEPRECATED
+ *
+ * @return void
+ */
+ public function tools220Contacts()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $start = intval($_GET['st']);
+ $lend = 50;
+ $end = $start + $lend;
+ $done = 0;
+ $updated = 0;
+
+ //-----------------------------------------
+ // Get lib
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('members') . '/sources/friends.php', 'profileFriendsLib', 'members' );
+ $profile = new $classToLoad( $this->registry );
+
+
+ //-----------------------------------------
+ // OK..
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'contacts',
+ 'where' => 'allow_msg=1',
+ 'limit' => array( $start, $lend ) ) );
+
+ $o = $this->DB->execute();
+
+ //-----------------------------------------
+ // Do it...
+ //-----------------------------------------
+
+ if ( $this->DB->getTotalRows($o) )
+ {
+ //-----------------------------------------
+ // Got some to convert!
+ //-----------------------------------------
+
+ while( $row = $this->DB->fetch( $o ) )
+ {
+ //-----------------------------------------
+ // Already a friend
+ //-----------------------------------------
+
+ $friend = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'profile_friends',
+ 'where' => 'friends_member_id=' . intval( $row['member_id'] ) . ' AND friends_friend_id=' . intval( $row['contact_id'] ) ) );
+
+ if ( ! $friend['friends_id'] )
+ {
+ //-----------------------------------------
+ // Add to DB
+ //-----------------------------------------
+
+ $this->DB->insert( 'profile_friends', array( 'friends_member_id' => $row['member_id'],
+ 'friends_friend_id' => $row['contact_id'],
+ 'friends_approved' => 1,
+ 'friends_added' => time() ) );
+
+ //-----------------------------------------
+ // Rebuild...
+ //-----------------------------------------
+
+ $profile->recacheFriends( array( 'member_id' => $row['member_id'] ) );
+
+ $updated++;
+ }
+
+ $this->DB->delete( "contacts", "id={$row['id']}" );
+ }
+ }
+ else
+ {
+ $done = 1;
+ }
+
+ //-----------------------------------------
+ // Done?
+ //-----------------------------------------
+
+ if ( ! $done )
+ {
+ $this->registry->output->global_message = sprintf( $this->lang->words['re_contactsstartto'],$start, $end, $updated );
+
+ $url = "{$this->settings['base_url']}{$this->form_code}&do=".$this->request['do'].'&st='.$end;
+ }
+ else
+ {
+ $this->registry->output->global_message = $this->lang->words['re_contactsup'];
+
+ $url = "{$this->settings['base_url']}{$this->form_code}&do=tools";
+ }
+
+ //-----------------------------------------
+ // Bye....
+ //-----------------------------------------
+
+ $this->registry->output->redirect( $url, $this->registry->output->global_message, 1 );
+ }
+
+ /**
+ * Cleanup Tools Splash Screen
+ *
+ * @return void
+ */
+ public function toolsSplashScreen()
+ {
+ /* Output */
+ $this->registry->output->html .= $this->html->toolsSplashScreen();
+ }
+
+ /**
+ * Count stats
+ *
+ * @return void
+ */
+ public function doCount()
+ {
+ if ( (! $this->request['posts']) and (! $this->request['online']) and (! $this->request['members'] ) and (! $this->request['lastreg'] ) )
+ {
+ $this->registry->output->showError( $this->lang->words['re_nothing'], 11154 );
+ }
+
+ $stats = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'cache_store', 'where' => "cs_key='stats'" ) );
+
+ $stats = unserialize( IPSText::stripslashes( $stats['cs_value'] ) );
+
+ if ($this->request['posts'])
+ {
+ $topics = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as tcount',
+ 'from' => 'topics',
+ 'where' => 'approved=1' ) );
+
+ $posts = $this->DB->buildAndFetch( array( 'select' => 'SUM(posts) as replies',
+ 'from' => 'topics',
+ 'where' => 'approved=1' ) );
+
+ $stats['total_topics'] = $topics['tcount'];
+ $stats['total_replies'] = $posts['replies'];
+ }
+
+ if ($this->request['members'])
+ {
+ $this->DB->build( array( 'select' => 'count(member_id) as members', 'from' => 'members', 'where' => "member_group_id <> '{$this->settings['auth_group']}'" ) );
+ $this->DB->execute();
+
+ $r = $this->DB->fetch();
+ $stats['mem_count'] = intval($r['members']);
+ }
+
+ if ($this->request['lastreg'])
+ {
+ $this->DB->build( array( 'select' => 'member_id, name, members_display_name, members_seo_name',
+ 'from' => 'members',
+ 'where' => "member_group_id <> '{$this->settings['auth_group']}' AND members_display_name != '' AND members_display_name " . $this->DB->buildIsNull( false ),
+ 'order' => "member_id DESC",
+ 'limit' => array(0,1) ) );
+ $this->DB->execute();
+
+ $r = $this->DB->fetch();
+ $stats['last_mem_name'] = $r['members_display_name'] ? $r['members_display_name'] : $r['name'];
+ $stats['last_mem_id'] = $r['member_id'];
+ $stats['last_mem_name_seo'] = $r['members_seo_name'];
+ }
+
+ if ($this->request['online'])
+ {
+ $stats['most_date'] = time();
+ $stats['most_count'] = 1;
+ }
+
+ if ( count($stats) > 0 )
+ {
+ $this->cache->setCache( 'stats', $stats, array( 'array' => 1 ) );
+ }
+ else
+ {
+ $this->registry->output->showError( $this->lang->words['re_nothing'], 11155 );
+ }
+
+ $this->registry->output->global_message = $this->lang->words['re_statsrecount'];
+
+ $this->registry->output->doneScreen($this->lang->words['re_statsrecount'], $this->lang->words['re_statscenter'], "{$this->form_code}", 'redirect' );
+ }
+
+ /**
+ * Clean out photos
+ *
+ * @return void
+ */
+ public function cleanPhotos()
+ {
+ /* Upload Class */
+ require_once( IPS_KERNEL_PATH.'classUpload.php' );
+ $upload = new classUpload();
+
+ //-----------------------------------------
+ // Set up
+ //-----------------------------------------
+
+ $done = 0;
+ $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
+ $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
+ $display = $end + $start;
+ $output = array();
+
+ //-----------------------------------------
+ // Pop open the directory and
+ // peek inside...
+ //-----------------------------------------
+
+ $i = 0;
+
+ try
+ {
+ foreach( new DirectoryIterator( $this->settings['upload_dir'] ) as $file )
+ {
+ if ( strstr( $file->getFilename(), 'photo-' ) )
+ {
+ $fullfile = $this->settings['upload_dir'].'/'.$file->getFilename();
+
+ $i++;
+
+ //-----------------------------------------
+ // Already started?
+ //-----------------------------------------
+
+ if ( $start > $i )
+ {
+ continue;
+ }
+
+ //-----------------------------------------
+ // Done for this iteration?
+ //-----------------------------------------
+
+ if ( $i > $display )
+ {
+ break;
+ }
+
+ //-----------------------------------------
+ // Try and get attach row
+ //-----------------------------------------
+
+ $found = $this->DB->buildAndFetch( array( 'select' => 'pp_member_id', 'from' => 'profile_portal', 'where' => "pp_main_photo='{$file->getFilename()}' OR pp_thumb_photo='{$file->getFilename()}'" ) );
+
+ if ( ! $found['pp_member_id'] )
+ {
+ @unlink( $fullfile );
+ $output[] = "{$this->lang->words['re_removedorph']} {$file->getFilename()} ";
+ }
+ else
+ {
+ $output[] = "{$this->lang->words['re_attachedok']} {$file->getFilename()} ";
+ }
+ }
+ }
+ } catch ( Exception $e ) {}
+
+ //-----------------------------------------
+ // Finish - or more?...
+ //-----------------------------------------
+
+ if ( $i < $display)
+ {
+ //-----------------------------------------
+ // Done..
+ //-----------------------------------------
+
+ $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}";
+ $time = 2;
+ }
+ else
+ {
+ //-----------------------------------------
+ // More..
+ //-----------------------------------------
+ $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $display );
+ $text = $thisgoeshere . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$display}";
+ $time = 0;
+ }
+
+ //-----------------------------------------
+ // Bye....
+ //-----------------------------------------
+
+ $this->registry->output->redirect( $url, $text, $time );
+ }
+
+ /**
+ * Clean out avatars
+ *
+ * @return void
+ */
+ public function cleanAvatars()
+ {
+ /* Upload Class */
+ require_once( IPS_KERNEL_PATH.'classUpload.php' );
+ $upload = new classUpload();
+
+ //-----------------------------------------
+ // Set up
+ //-----------------------------------------
+
+ $done = 0;
+ $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
+ $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
+ $dis = $end + $start;
+ $output = array();
+
+ //-----------------------------------------
+ // Pop open the directory and
+ // peek inside...
+ //-----------------------------------------
+
+ $i = 0;
+
+ try
+ {
+ foreach( new DirectoryIterator( $this->settings['upload_dir'] ) as $file )
+ {
+ if ( strstr( $file->getFilename(), 'av-' ) )
+ {
+ $fullfile = $this->settings['upload_dir'].'/'.$file->getFilename();
+
+ $i++;
+
+ //-----------------------------------------
+ // Already started?
+ //-----------------------------------------
+
+ if ( $start > $i )
+ {
+ continue;
+ }
+
+ //-----------------------------------------
+ // Done for this iteration?
+ //-----------------------------------------
+
+ if ( $i > $dis )
+ {
+ break;
+ }
+
+ //-----------------------------------------
+ // Try and get attach row
+ //-----------------------------------------
+
+ $found = $this->DB->buildAndFetch( array( 'select' => 'pp_member_id', 'from' => 'profile_portal', 'where' => "avatar_location='{$file->getFilename()}' or avatar_location='upload:{$file->getFilename()}'" ) );
+
+ if ( ! $found['pp_member_id'] )
+ {
+ @unlink( $fullfile );
+ $output[] = "{$this->lang->words['re_removedorph']} $file ";
+ }
+ else
+ {
+ $output[] = "{$this->lang->words['re_attachedok']} $file ";
+ }
+ }
+ }
+ } catch ( Exception $e ) {}
+
+ //-----------------------------------------
+ // Finish - or more?...
+ //-----------------------------------------
+
+ if ( $i < $dis)
+ {
+ //-----------------------------------------
+ // Done..
+ //-----------------------------------------
+
+ $text = $this->lang->words['re_rebuildcomplete'] . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}";
+ $time = 2;
+ }
+ else
+ {
+ //-----------------------------------------
+ // More..
+ //-----------------------------------------
+ $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
+ $text = $thisgoeshere . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
+ $time = 0;
+ }
+
+ //-----------------------------------------
+ // Bye....
+ //-----------------------------------------
+
+ $this->registry->output->redirect( $url, $text, $time );
+ }
+
+ /**
+ * Clean out attachments
+ *
+ * @return void
+ */
+ public function cleanAttachments()
+ {
+ /* Upload Class */
+ require_once( IPS_KERNEL_PATH.'classUpload.php' );
+ $upload = new classUpload();
+
+ //-----------------------------------------
+ // Set up
+ //-----------------------------------------
+
+ $done = 0;
+ $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
+ $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
+ $dis = $end + $start;
+ $output = array();
+
+ //-----------------------------------------
+ // Pop open the directory and
+ // peek inside...
+ //-----------------------------------------
+
+ $i = 0;
+ try
+ {
+ foreach( new DirectoryIterator( $this->settings['upload_dir'] ) as $file )
+ {
+ if ( $file->getFilename() == '.' OR $file->getFilename() == '..' )
+ {
+ continue;
+ }
+
+ $fullfile = $this->settings['upload_dir'] . '/' . $file->getFilename();
+
+ if( is_dir( $fullfile ) )
+ {
+ $ndh = opendir( $fullfile );
+
+ try
+ {
+ foreach( new DirectoryIterator( $fullfile ) as $nfile )
+ {
+ if ( $nfile->getFilename() == '.' OR $nfile->getFilename() == '..' )
+ {
+ continue;
+ }
+
+ if ( strstr( $nfile->getFilename(), 'post-' ) )
+ {
+ $i++;
+
+ //-----------------------------------------
+ // Already started?
+ //-----------------------------------------
+
+ if ( $start > $i )
+ {
+ continue;
+ }
+
+ //-----------------------------------------
+ // Done for this iteration?
+ //-----------------------------------------
+
+ if ( $i > $dis )
+ {
+ break;
+ }
+
+ //-----------------------------------------
+ // Try and get attach row
+ //-----------------------------------------
+
+ $found = $this->DB->buildAndFetch( array( 'select' => 'attach_id', 'from' => 'attachments', 'where' => "attach_location='{$file->getFilename()}/{$nfile->getFilename()}' OR attach_thumb_location='{$file->getFilename()}/{$nfile->getFilename()}'" ) );
+
+ if ( ! $found['attach_id'] )
+ {
+ @unlink( $fullfile . '/' . $nfile );
+ $output[] = "{$this->lang->words['re_removedorph']} {$nfile->getFilename()} ";
+ }
+ else
+ {
+ $output[] = "{$this->lang->words['re_attachedok']} {$nfile->getFilename()} ";
+ }
+ }
+ }
+ } catch ( Exception $e ) {}
+ closedir( $ndh );
+ }
+ else if ( strstr( $file, 'post-' ) )
+ {
+ $i++;
+
+ //-----------------------------------------
+ // Already started?
+ //-----------------------------------------
+
+ if ( $start > $i )
+ {
+ continue;
+ }
+
+ //-----------------------------------------
+ // Done for this iteration?
+ //-----------------------------------------
+
+ if ( $i > $dis )
+ {
+ break;
+ }
+
+ //-----------------------------------------
+ // Try and get attach row
+ //-----------------------------------------
+
+ $found = $this->DB->buildAndFetch( array( 'select' => 'attach_id', 'from' => 'attachments', 'where' => "attach_location='{$file->getFilename()}' OR attach_thumb_location='{$file->getFilename()}'" ) );
+
+ if ( ! $found['attach_id'] )
+ {
+ @unlink( $fullfile );
+ $output[] = "{$this->lang->words['re_removedorph']} {$file->getFilename()} ";
+ }
+ else
+ {
+ $output[] = "{$this->lang->words['re_attachedok']} {$file->getFilename()} ";
+ }
+ }
+ }
+ } catch ( Exception $e ) {}
+
+ //-----------------------------------------
+ // Finish - or more?...
+ //-----------------------------------------
+
+ if ( $i < $dis)
+ {
+ //-----------------------------------------
+ // Done..
+ //-----------------------------------------
+
+ $text = $this->lang->words['re_rebuidcomp'] . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}";
+ $time = 2;
+ }
+ else
+ {
+ //-----------------------------------------
+ // More..
+ //-----------------------------------------
+ $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
+ $text = $thisgoeshere . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
+ $time = 0;
+ }
+
+ //-----------------------------------------
+ // Bye....
+ //-----------------------------------------
+
+ $this->registry->output->redirect( $url, $text, $time );
+ }
+
+ /**
+ * Rebuild Attachment Data
+ *
+ * @return void
+ */
+ public function rebuildAttachdata()
+ {
+ /* Upload Class */
+ require_once( IPS_KERNEL_PATH.'classUpload.php' );
+ $upload = new classUpload();
+
+ //-----------------------------------------
+ // Set up
+ //-----------------------------------------
+
+ $done = 0;
+ $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
+ $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
+ $dis = $end + $start;
+ $output = array();
+
+ //-----------------------------------------
+ // Got any more?
+ //-----------------------------------------
+
+ $tmp = $this->DB->buildAndFetch( array( 'select' => 'attach_id', 'from' => 'attachments', 'limit' => array($dis,1) ) );
+ $max = intval( $tmp['attach_id'] );
+
+ //-----------------------------------------
+ // Avoid limit...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'attachments', 'order' => 'attach_id ASC', 'limit' => array($start,$end) ) );
+ $outer = $this->DB->execute();
+
+ //-----------------------------------------
+ // Process...
+ //-----------------------------------------
+
+ while( $r = $this->DB->fetch( $outer ) )
+ {
+ //-----------------------------------------
+ // Get ext
+ //-----------------------------------------
+
+ $update = array();
+
+ $update['attach_ext'] = $upload->_getFileExtension( $r['attach_file'] );
+
+ if ( $r['attach_location'] )
+ {
+ if ( file_exists( $this->settings['upload_dir'].'/'.$r['attach_location'] ) )
+ {
+ $update['attach_filesize'] = @filesize( $this->settings['upload_dir'].'/'.$r['attach_location'] );
+
+ if( $r['attach_is_image'] )
+ {
+ $dims = @getimagesize( $this->settings['upload_dir'].'/'.$r['attach_location'] );
+
+ if( $dims[0] AND $dims[1] )
+ {
+ $update['attach_img_width'] = $dims[0];
+ $update['attach_img_height'] = $dims[1];
+ }
+ }
+ }
+ }
+
+ if ( count( $update ) )
+ {
+ $this->DB->update( 'attachments', $update, 'attach_id='.$r['attach_id'] );
+ }
+
+ $done++;
+ }
+
+ //-----------------------------------------
+ // Finish - or more?...
+ //-----------------------------------------
+
+ if ( ! $done and ! $max )
+ {
+ //-----------------------------------------
+ // Done..
+ //-----------------------------------------
+
+ $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}";
+ $time = 2;
+ }
+ else
+ {
+ //-----------------------------------------
+ // More..
+ //-----------------------------------------
+ $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
+ $text = $thisgoeshere . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
+ $time = 0;
+ }
+
+ //-----------------------------------------
+ // Bye....
+ //-----------------------------------------
+
+ $this->registry->output->redirect( $url, $text, $time );
+ }
+
+ /**
+ * Rebuild Photos
+ *
+ * @return void
+ */
+ public function rebuildPhotos()
+ {
+ /* Image Class */
+ require_once( IPS_KERNEL_PATH . 'classImage.php' );
+ require_once( IPS_KERNEL_PATH . 'classImageGd.php' );
+
+ //-----------------------------------------
+ // Set up
+ //-----------------------------------------
+
+ $done = 0;
+ $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
+ $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
+ $dis = $end + $start;
+ $output = array();
+
+ //-----------------------------------------
+ // Got any more?
+ //-----------------------------------------
+
+ $tmp = $this->DB->buildAndFetch( array( 'select' => 'pp_member_id', 'from' => 'profile_portal', 'where' => "pp_main_photo != ''", 'order' => 'pp_member_id ASC', 'limit' => array($dis,1) ) );
+ $max = intval( $tmp['pp_member_id'] );
+
+ //-----------------------------------------
+ // Avoid limit...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'profile_portal', 'order' => 'pp_member_id ASC', 'where' => "pp_main_photo != ''", 'limit' => array($start,$end) ) );
+ $outer = $this->DB->execute();
+
+ //-----------------------------------------
+ // Process...
+ //-----------------------------------------
+
+ while( $r = $this->DB->fetch( $outer ) )
+ {
+ if ( $r['pp_thumb_photo'] and ( $r['pp_thumb_photo'] != $r['pp_main_photo'] ) )
+ {
+ if ( file_exists( $this->settings['upload_dir'].'/'.$r['pp_thumb_photo'] ) )
+ {
+ if ( ! @unlink( $this->settings['upload_dir'].'/'.$r['pp_thumb_photo'] ) )
+ {
+ $output[] = $this->lang->words['re_noremove'].$r['pp_thumb_photo'];
+ continue;
+ }
+ }
+ }
+
+ if( !file_exists( $this->settings['upload_dir'] . '/' . $r['pp_main_photo'] ) )
+ {
+ $output[] = $this->lang->words['re_noresizefound'] . $r['pp_main_photo'];
+ continue;
+ }
+
+ $photo_data = array();
+ $thumb_data = array();
+
+ $image = new classImageGd();
+
+ $image->init( array( 'image_path' => $this->settings['upload_dir'], 'image_file' => $r['pp_main_photo'] ) );
+
+ $thumb_data = $image->resizeImage( 50, 50 );
+ $image->writeImage( $this->settings['upload_dir'] . '/' . $r['pp_thumb_photo'] );
+
+ $photo_data['pp_thumb_width'] = intval($thumb_data['newWidth']);
+ $photo_data['pp_thumb_height'] = intval($thumb_data['newHeight']);
+ $photo_data['pp_thumb_photo'] = $r['pp_thumb_photo'];
+
+ if ( count( $photo_data ) )
+ {
+ $this->DB->update( 'profile_portal', $photo_data, 'pp_member_id='.$r['pp_member_id'] );
+
+ $output[] = $this->lang->words['re_resized'].$r['pp_main_photo'];
+ }
+
+ unset($image);
+
+ $done++;
+ }
+
+ //-----------------------------------------
+ // Finish - or more?...
+ //-----------------------------------------
+
+ if ( ! $done and ! $max )
+ {
+ //-----------------------------------------
+ // Done..
+ //-----------------------------------------
+
+ $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}";
+ $time = 2;
+ }
+ else
+ {
+ //-----------------------------------------
+ // More..
+ //-----------------------------------------
+ $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
+ $text = $thisgoeshere . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
+ $time = 0;
+ }
+
+ //-----------------------------------------
+ // Bye....
+ //-----------------------------------------
+
+ $this->registry->output->redirect( $url, $text, $time );
+ }
+
+ /**
+ * Rebuild Post Thumbnails
+ *
+ * @return void
+ */
+ public function rebuildThumbnails()
+ {
+ require_once( IPS_KERNEL_PATH . 'classImage.php' );
+ require_once( IPS_KERNEL_PATH . 'classImageGd.php' );
+
+ //-----------------------------------------
+ // Set up
+ //-----------------------------------------
+
+ $done = 0;
+ $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
+ $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
+ $dis = $end + $start;
+ $output = array();
+
+ //-----------------------------------------
+ // Got any more?
+ //-----------------------------------------
+
+ $tmp = $this->DB->buildAndFetch( array( 'select' => 'attach_id', 'from' => 'attachments', 'where' => "attach_rel_module IN('post','msg')", 'limit' => array($dis,1) ) );
+ $max = intval( $tmp['attach_id'] );
+
+ //-----------------------------------------
+ // Avoid limit...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'attachments', 'where' => "attach_rel_module IN('post','msg')", 'order' => 'attach_id ASC', 'limit' => array($start,$end) ) );
+ $outer = $this->DB->execute();
+
+ //-----------------------------------------
+ // Process...
+ //-----------------------------------------
+
+ while( $r = $this->DB->fetch( $outer ) )
+ {
+ if ( $r['attach_is_image'] )
+ {
+ if ( $r['attach_thumb_location'] and ( $r['attach_thumb_location'] != $r['attach_location'] ) )
+ {
+ if ( file_exists( $this->settings['upload_dir'].'/'.$r['attach_thumb_location'] ) )
+ {
+ if ( ! @unlink( $this->settings['upload_dir'].'/'.$r['attach_thumb_location'] ) )
+ {
+ $output[] = $this->lang->words['re_noremove'].$r['attach_thumb_location'];
+ continue;
+ }
+ }
+ }
+
+ $attach_data = array();
+ $thumbnail = $r['attach_thumb_location'] ? $r['attach_thumb_location']
+ : preg_replace( "/^(.*)\.(.+?)$/", "\\1_thumb.\\2", $r['attach_location'] );
+
+ $image = new classImageGd();
+
+ $image->init( array(
+ 'image_path' => $this->settings['upload_dir'],
+ 'image_file' => $r['attach_location'],
+ ) );
+
+ $return = $image->resizeImage( $this->settings['siu_width'], $this->settings['siu_height'] );
+ $image->writeImage( $this->settings['upload_dir'] . '/' . $thumbnail );
+
+ $attach_data['attach_thumb_width'] = intval($return['newWidth'] ? $return['newWidth'] : $image->cur_dimensions['width']);
+ $attach_data['attach_thumb_height'] = intval($return['newHeight'] ? $return['newHeight'] : $image->cur_dimensions['height']);
+ $attach_data['attach_thumb_location'] = $thumbnail;
+
+ if ( count( $attach_data ) )
+ {
+ $this->DB->update( 'attachments', $attach_data, 'attach_id='.$r['attach_id'] );
+
+ $output[] = $this->lang->words['re_resized'].$r['attach_location'];
+ }
+
+ unset($image);
+ }
+
+ $done++;
+ }
+
+ //-----------------------------------------
+ // Finish - or more?...
+ //-----------------------------------------
+
+ if ( ! $done and ! $max )
+ {
+ //-----------------------------------------
+ // Done..
+ //-----------------------------------------
+
+ $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}";
+ $time = 2;
+ }
+ else
+ {
+ //-----------------------------------------
+ // More..
+ //-----------------------------------------
+ $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
+ $text = $thisgoeshere . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
+ $time = 0;
+ }
+
+ //-----------------------------------------
+ // Bye....
+ //-----------------------------------------
+
+ $this->registry->output->redirect( $url, $text, $time );
+ }
+
+ /**
+ * Rebuild Messenger Totals
+ *
+ * @return void
+ */
+ public function rebuildMsgCounts()
+ {
+ //-----------------------------------------
+ // Grab messenger lib
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'members' ) . '/sources/classes/messaging/messengerFunctions.php', 'messengerFunctions', 'members' );
+ $messengerFunctions = new $classToLoad( $this->registry );
+
+ //-----------------------------------------
+ // Set up
+ //-----------------------------------------
+
+ $done = 0;
+ $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
+ $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
+ $dis = $end + $start;
+ $output = array();
+
+ //-----------------------------------------
+ // Got any more?
+ //-----------------------------------------
+
+ $tmp = $this->DB->buildAndFetch( array( 'select' => 'member_id', 'from' => 'members', 'limit' => array($dis,1) ) );
+ $max = intval( $tmp['member_id'] );
+
+ //-----------------------------------------
+ // Avoid limit...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => 'member_id, members_display_name', 'from' => 'members', 'order' => 'member_id ASC', 'limit' => array($start,$end) ) );
+ $outer = $this->DB->execute();
+
+ //-----------------------------------------
+ // Process...
+ //-----------------------------------------
+
+ while( $r = $this->DB->fetch( $outer ) )
+ {
+ $messengerFunctions->resetMembersFolderCounts( $r['member_id'] );
+ $messengerFunctions->resetMembersTotalTopicCount( $r['member_id'] );
+ $messengerFunctions->resetMembersNewTopicCount( $r['member_id'] );
+
+ $done++;
+ }
+
+ //-----------------------------------------
+ // Finish - or more?...
+ //-----------------------------------------
+
+ if ( ! $done and ! $max )
+ {
+ //-----------------------------------------
+ // Done..
+ //-----------------------------------------
+
+ $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}";
+ $time = 2;
+ }
+ else
+ {
+ //-----------------------------------------
+ // More..
+ //-----------------------------------------
+ $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
+ $text = $thisgoeshere . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
+ $time = 0;
+ }
+
+ //-----------------------------------------
+ // Bye....
+ //-----------------------------------------
+
+ $this->registry->output->redirect( $url, $text, $time );
+ }
+
+ /**
+ * Rebuild Post Count
+ *
+ * @return void
+ */
+ public function rebuildPostCount()
+ {
+ //-----------------------------------------
+ // Forums not to count?
+ //-----------------------------------------
+
+ $forums = array();
+
+ foreach( $this->registry->class_forums->forum_by_id as $data )
+ {
+ if ( ! $data['inc_postcount'] )
+ {
+ $forums[] = $data['id'];
+ }
+ }
+
+ //-----------------------------------------
+ // Set up
+ //-----------------------------------------
+
+ $done = 0;
+ $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
+ $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
+ $dis = $end + $start;
+ $output = array();
+
+ //-----------------------------------------
+ // Got any more?
+ //-----------------------------------------
+
+ $tmp = $this->DB->buildAndFetch( array( 'select' => 'member_id', 'from' => 'members', 'limit' => array($dis,1) ) );
+ $max = intval( $tmp['member_id'] );
+
+ //-----------------------------------------
+ // Avoid limit...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => 'member_id, name', 'from' => 'members', 'order' => 'member_id ASC', 'limit' => array($start,$end) ) );
+ $outer = $this->DB->execute();
+
+ //-----------------------------------------
+ // Process...
+ //-----------------------------------------
+
+ while( $r = $this->DB->fetch( $outer ) )
+ {
+ if ( ! count( $forums ) )
+ {
+ $count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count', 'from' => 'posts', 'where' => 'queued != 1 AND author_id='.$r['member_id'] ) );
+ }
+ else
+ {
+ $this->DB->build( array( 'select' => 'count(p.pid) as count',
+ 'from' => array( 'posts' => 'p' ),
+ 'where' => 'p.queued <> 1 AND p.author_id='.$r['member_id'].' AND t.forum_id NOT IN ('.implode(",",$forums).')',
+ 'add_join' => array( 1 => array( 'type' => 'left',
+ 'from' => array( 'topics' => 't' ),
+ 'where' => 't.tid=p.topic_id'
+ ) )
+ ) );
+ $this->DB->execute();
+
+ $count = $this->DB->fetch();
+ }
+
+ $new_post_count = intval( $count['count'] );
+
+ $this->DB->update( 'members', array( 'posts' => $new_post_count ), 'member_id='.$r['member_id'] );
+
+ $done++;
+ }
+
+ //-----------------------------------------
+ // Finish - or more?...
+ //-----------------------------------------
+
+ if ( ! $done and ! $max )
+ {
+ //-----------------------------------------
+ // Done..
+ //-----------------------------------------
+
+ $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}";
+ $time = 2;
+ }
+ else
+ {
+ //-----------------------------------------
+ // More..
+ //-----------------------------------------
+ $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
+ $text = $thisgoeshere . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
+ $time = 0;
+ }
+
+ //-----------------------------------------
+ // Bye....
+ //-----------------------------------------
+
+ $this->registry->output->redirect( $url, $text, $time );
+ }
+
+ /**
+ * Rebuild Seo User Names
+ *
+ * @return void
+ */
+ public function rebuildSeoUserNames()
+ {
+ //-----------------------------------------
+ // Set up
+ //-----------------------------------------
+
+ $done = 0;
+ $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
+ $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
+ $dis = $end + $start;
+ $output = array();
+
+ //-----------------------------------------
+ // Got any more?
+ //-----------------------------------------
+
+ $tmp = $this->DB->buildAndFetch( array( 'select' => 'member_id', 'from' => 'members', 'limit' => array( $dis, 1 ) ) );
+ $max = intval( $tmp['member_id'] );
+
+ //-----------------------------------------
+ // Avoid limit...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => 'member_id, members_display_name', 'from' => 'members', 'order' => 'member_id ASC', 'limit' => array( $start, $end ) ) );
+ $outer = $this->DB->execute();
+
+ //-----------------------------------------
+ // Process...
+ //-----------------------------------------
+
+ while( $r = $this->DB->fetch( $outer ) )
+ {
+ $this->DB->update( 'members', array( 'members_seo_name' => IPSText::makeSeoTitle( $r['members_display_name'] ) ), "member_id=" . $r['member_id'] );
+ $done++;
+ }
+
+ //-----------------------------------------
+ // Finish - or more?...
+ //-----------------------------------------
+
+ if ( ! $done and ! $max )
+ {
+ //-----------------------------------------
+ // Done..
+ //-----------------------------------------
+
+ $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}";
+ $time = 2;
+ }
+ else
+ {
+ //-----------------------------------------
+ // More..
+ //-----------------------------------------
+ $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
+ $text = $thisgoeshere . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
+ $time = 0;
+ }
+
+ //-----------------------------------------
+ // Bye....
+ //-----------------------------------------
+
+ $this->registry->output->redirect( $url, $text, $time );
+ }
+
+
+ /**
+ * Rebuild Post Names
+ *
+ * @return void
+ */
+ public function rebuildPostNames()
+ {
+ //-----------------------------------------
+ // Set up
+ //-----------------------------------------
+
+ $done = 0;
+ $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
+ $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
+ $dis = $end + $start;
+ $output = array();
+
+ //-----------------------------------------
+ // Got any more?
+ //-----------------------------------------
+
+ $tmp = $this->DB->buildAndFetch( array( 'select' => 'member_id', 'from' => 'members', 'limit' => array( $dis, 1 ) ) );
+ $max = intval( $tmp['member_id'] );
+
+ //-----------------------------------------
+ // Avoid limit...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => 'member_id, members_display_name', 'from' => 'members', 'order' => 'member_id ASC', 'limit' => array( $start, $end ) ) );
+ $outer = $this->DB->execute();
+
+ //-----------------------------------------
+ // Process...
+ //-----------------------------------------
+
+ while( $r = $this->DB->fetch( $outer ) )
+ {
+ $seoName = IPSText::makeSeoTitle( $r['members_display_name'] );
+ $this->DB->update( 'topics', array( 'starter_name' => $r['members_display_name'], 'seo_first_name' => $seoName ), "starter_id=" . $r['member_id'] );
+ $this->DB->update( 'topics', array( 'last_poster_name' => $r['members_display_name'], 'seo_last_name' => $seoName ), "last_poster_id=" . $r['member_id'] );
+
+ $done++;
+ }
+
+ //-----------------------------------------
+ // Finish - or more?...
+ //-----------------------------------------
+
+ if ( ! $done and ! $max )
+ {
+ //-----------------------------------------
+ // Done..
+ //-----------------------------------------
+
+ $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}";
+ $time = 2;
+ }
+ else
+ {
+ //-----------------------------------------
+ // More..
+ //-----------------------------------------
+ $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
+ $text = $thisgoeshere . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
+ $time = 0;
+ }
+
+ //-----------------------------------------
+ // Bye....
+ //-----------------------------------------
+
+ $this->registry->output->redirect( $url, $text, $time );
+ }
+
+ /**
+ * Rebuild posts
+ *
+ * @return void
+ */
+ public function rebuildPosts()
+ {
+ //-----------------------------------------
+ // If it's "none", go back
+ //-----------------------------------------
+
+ if( !$this->request['type'] OR $this->request['type'] == 'none' )
+ {
+ $this->rebuildSplashScreen();
+ return;
+ }
+
+ //-----------------------------------------
+ // Only need to rebuild once
+ //-----------------------------------------
+
+ $sections = array();
+ $alreadyRebuilt = $this->DB->buildAndFetch( array( 'select' => 'cs_value', 'from' => 'cache_store', 'where' => "cs_key='isRebuilt'" ) );
+
+ if( $alreadyRebuilt['cs_value'] )
+ {
+ $sections = explode( ',', $alreadyRebuilt['cs_value'] );
+ }
+
+ //-----------------------------------------
+ // Get new parser and old parser
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_parse_bbcode.php', 'parseBbcode' );
+ $parser = new $classToLoad( $this->registry );
+ $oldparser = new $classToLoad( $this->registry, 'legacy' );
+
+ //-----------------------------------------
+ // Set up
+ //-----------------------------------------
+
+ $done = 0;
+ $last = 0;
+ $start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
+ $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
+ $dis = intval($this->request['dis']) >=0 ? intval($this->request['dis']) : 0;
+ $output = array();
+ $plugin = null;
+
+ $types = array( 'posts', 'pms', 'cal', 'announce', 'sigs', 'aboutme', 'rules' );
+
+ foreach( ipsRegistry::$applications as $app_dir => $app_data )
+ {
+ //-----------------------------------------
+ // Retrieve the RSS links for the header
+ //-----------------------------------------
+
+ if( file_exists( IPSLib::getAppDir( $app_dir ) . '/extensions/upgradePostRebuild.php' ) )
+ {
+ $className = IPSLib::loadLibrary( IPSLib::getAppDir( $app_dir ) . '/extensions/upgradePostRebuild.php', 'postRebuild_'.$app_dir, $app_dir );
+
+ if( class_exists( $className ) )
+ {
+ $rebuild = new $className( $this->registry );
+
+ if( method_exists( $rebuild, "getDropdown" ) )
+ {
+ $options = $rebuild->getDropdown();
+
+ if( count($options) )
+ {
+ foreach( $options as $appOption )
+ {
+ $types[] = $appOption[0];
+
+ if( $appOption[0] == $this->request['type'] )
+ {
+ $plugin =& $rebuild;
+ break 2;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $type = in_array( $this->request['type'], $types ) ? $this->request['type'] : 'posts';
+
+ //-----------------------------------------
+ // Got any more?
+ //-----------------------------------------
+
+ switch( $type )
+ {
+ case 'cal':
+ $tmp = $this->DB->buildAndFetch( array( 'select' => 'event_id', 'from' => 'cal_events', 'limit' => array($dis,1) ) );
+ $max = intval( $tmp['event_id'] );
+ break;
+
+ case 'announce':
+ $tmp = $this->DB->buildAndFetch( array( 'select' => 'announce_id', 'from' => 'announcements', 'limit' => array($dis,1) ) );
+ $max = intval( $tmp['announce_id'] );
+ break;
+
+ case 'pms':
+ $tmp = $this->DB->buildAndFetch( array( 'select' => 'msg_id', 'from' => 'message_posts', 'limit' => array($dis,1) ) );
+ $max = intval( $tmp['msg_id'] );
+ break;
+
+ case 'sigs':
+ $tmp = $this->DB->buildAndFetch( array( 'select' => 'pp_member_id', 'from' => 'profile_portal', 'where' => "signature IS NOT NULL AND signature != ''", 'limit' => array($dis,1) ) );
+ $max = intval( $tmp['pp_member_id'] );
+ break;
+
+ case 'aboutme':
+ $tmp = $this->DB->buildAndFetch( array( 'select' => 'pp_member_id', 'from' => 'profile_portal', 'where' => "pp_about_me IS NOT NULL AND pp_about_me != ''", 'limit' => array($dis,1) ) );
+ $max = intval( $tmp['pp_member_id'] );
+ break;
+
+ case 'posts':
+ $tmp = $this->DB->buildAndFetch( array( 'select' => 'pid', 'from' => 'posts', 'limit' => array($dis,1) ) );
+ $max = intval( $tmp['pid'] );
+ break;
+
+ case 'rules':
+ $tmp = $this->DB->buildAndFetch( array( 'select' => 'id', 'from' => 'forums', 'where' => "rules_text IS NOT NULL AND rules_text != ''", 'limit' => array($dis,1) ) );
+ $max = intval( $tmp['id'] );
+ break;
+
+ default:
+ $max = $rebuild->getMax( $type, $dis );
+ break;
+
+ }
+
+ //-----------------------------------------
+ // Avoid limit...
+ //-----------------------------------------
+
+ switch( $type )
+ {
+ case 'cal':
+ $this->DB->build( array( 'select' => 'e.*',
+ 'from' => array( 'cal_events' => 'e' ),
+ 'order' => 'e.event_id ASC',
+ 'where' => 'e.event_id > ' . $start,
+ 'limit' => array($end),
+ 'add_join' => array( 1 => array( 'type' => 'left',
+ 'select' => 'm.member_group_id, m.mgroup_others',
+ 'from' => array( 'members' => 'm' ),
+ 'where' => "m.member_id=e.event_member_id"
+ ) )
+ ) );
+ break;
+
+ case 'announce':
+ $this->DB->build( array( 'select' => 'a.*',
+ 'from' => array( 'announcements' => 'a' ),
+ 'order' => 'a.announce_id ASC',
+ 'where' => 'a.announce_id > ' . $start,
+ 'limit' => array($end),
+ 'add_join' => array( 1 => array( 'type' => 'left',
+ 'select' => 'm.member_group_id, m.mgroup_others',
+ 'from' => array( 'members' => 'm' ),
+ 'where' => "m.member_id=a.announce_member_id"
+ ) )
+ ) );
+ break;
+
+ case 'pms':
+ $this->DB->build( array( 'select' => 'p.*',
+ 'from' => array( 'message_posts' => 'p' ),
+ 'order' => 'p.msg_id ASC',
+ 'where' => 'p.msg_id > ' . $start,
+ 'limit' => array($end),
+ 'add_join' => array( 1 => array( 'type' => 'left',
+ 'select' => 'm.member_group_id, m.mgroup_others',
+ 'from' => array( 'members' => 'm' ),
+ 'where' => "m.member_id=p.msg_author_id"
+ ) )
+ ) );
+ break;
+
+ case 'sigs':
+ $this->DB->build( array( 'select' => 'me.signature, me.pp_member_id',
+ 'from' => array( 'profile_portal' => 'me' ),
+ 'order' => 'me.pp_member_id ASC',
+ 'where' => "me.signature IS NOT NULL AND me.signature != '' AND me.pp_member_id > " . $start,
+ 'limit' => array($end),
+ 'add_join' => array( 1 => array( 'type' => 'left',
+ 'select' => 'm.member_group_id, m.mgroup_others',
+ 'from' => array( 'members' => 'm' ),
+ 'where' => "m.member_id=me.pp_member_id"
+ ) )
+ ) );
+ break;
+
+ case 'aboutme':
+ $this->DB->build( array( 'select' => 'pp.pp_about_me, pp.pp_member_id',
+ 'from' => array( 'profile_portal' => 'pp' ),
+ 'order' => 'pp.pp_member_id ASC',
+ 'where' => "pp.pp_about_me != '' AND pp.pp_about_me IS NOT NULL AND pp.pp_member_id > " . $start,
+ 'limit' => array($end),
+ 'add_join' => array( 1 => array( 'type' => 'left',
+ 'select' => 'm.member_group_id, m.mgroup_others',
+ 'from' => array( 'members' => 'm' ),
+ 'where' => "m.member_id=pp.pp_member_id"
+ ) )
+ ) );
+ break;
+
+ case 'posts':
+ $this->DB->build( array( 'select' => 'p.*',
+ 'from' => array( 'posts' => 'p' ),
+ 'order' => 'p.pid ASC',
+ 'where' => 'p.pid > ' . $start,
+ 'limit' => array($end),
+ 'add_join' => array( 1 => array( 'type' => 'left',
+ 'select' => 't.forum_id',
+ 'from' => array( 'topics' => 't' ),
+ 'where' => "t.tid=p.topic_id"
+ ),
+ 2 => array( 'type' => 'left',
+ 'select' => 'm.member_group_id, m.mgroup_others',
+ 'from' => array( 'members' => 'm' ),
+ 'where' => "m.member_id=p.author_id"
+ ) )
+ ) );
+ break;
+
+ case 'rules':
+ $this->DB->build( array( 'select' => '*', 'from' => 'forums', 'order' => 'id ASC', 'where' => "rules_text IS NOT NULL AND rules_text != '' AND id > " . $start, 'limit' => array($end) ) );
+ break;
+
+ default:
+ $plugin->executeQuery( $type, $start, $end );
+ break;
+ }
+
+ $outer = $this->DB->execute();
+
+ //-----------------------------------------
+ // Process...
+ //-----------------------------------------
+
+ while( $r = $this->DB->fetch( $outer ) )
+ {
+ //-----------------------------------------
+ // Reset
+ //-----------------------------------------
+
+ $parser->quote_open = $oldparser->quote_open = 0;
+ $parser->quote_closed = $oldparser->quote_closed = 0;
+ $parser->quote_error = $oldparser->quote_error = 0;
+ $parser->error = $oldparser->error = '';
+ $parser->image_count = $oldparser->image_count = 0;
+ $parser->parsing_mgroup = $oldparser->parsing_mgroup = $r['member_group_id'];
+ $parser->parsing_mgroup_others = $oldparser->parsing_mgroup_others = $r['mgroup_others'];
+
+ $this->memberData['g_bypass_badwords'] = $this->caches['group_cache'][ $r['member_group_id'] ]['g_bypass_badwords'];
+
+ switch( $type )
+ {
+ case 'cal':
+ $parser->parse_smilies = $oldparser->parse_smilies = $r['event_smilies'];
+ $parser->parse_html = $oldparser->parse_html = 0;
+ $parser->parse_bbcode = $oldparser->parse_bbcode = 1;
+ $parser->parsing_section = 'calendar';
+
+ $rawpost = $oldparser->preEditParse( $r['event_content'] );
+ break;
+
+ case 'announce':
+ $parser->parse_smilies = $oldparser->parse_smilies = 1;
+ $parser->parse_html = $oldparser->parse_html = $r['announce_html_enabled'];
+ $parser->parse_bbcode = $oldparser->parse_bbcode = 1;
+ $parser->parse_nl2br = $oldparser->parse_nl2br = ( $r['announce_html_enabled'] ? $r['announce_nlbr_enabled'] : 1 );
+ $parser->parsing_section = 'announcement';
+
+ $rawpost = $oldparser->preEditParse( $r['announce_post'] );
+ break;
+
+ case 'pms':
+ $parser->parse_smilies = $oldparser->parse_smilies = 1;
+ $parser->parse_html = $oldparser->parse_html = $this->settings['msg_allow_html'];
+ $parser->parse_bbcode = $oldparser->parse_bbcode = $this->settings['msg_allow_code'];
+ $parser->parse_nl2br = $oldparser->parse_nl2br = 1;
+ $parser->parsing_section = 'pms';
+
+ $rawpost = $oldparser->preEditParse( $r['msg_post'] );
+ break;
+
+ case 'sigs':
+ $parser->parse_smilies = $oldparser->parse_smilies = 0;
+ $parser->parse_html = $oldparser->parse_html = $this->settings['sig_allow_html'];
+ $parser->parse_bbcode = $oldparser->parse_bbcode = $this->settings['sig_allow_ibc'];
+ $parser->parse_nl2br = $oldparser->parse_nl2br = 1;
+ $parser->parsing_section = 'signatures';
+
+ $rawpost = $oldparser->preEditParse( $r['signature'] );
+ break;
+
+ case 'aboutme':
+ $parser->parse_smilies = $oldparser->parse_smilies = $this->settings['aboutme_emoticons'];
+ $parser->parse_html = $oldparser->parse_html = intval($this->settings['aboutme_html']);
+ $parser->parse_bbcode = $oldparser->parse_bbcode = $this->settings['aboutme_bbcode'];
+ $parser->parse_nl2br = $oldparser->parse_nl2br = 1;
+ $parser->parsing_section = 'aboutme';
+
+ $rawpost = $oldparser->preEditParse( $r['pp_about_me'] );
+ break;
+
+ case 'posts':
+ $parser->parse_smilies = $oldparser->parse_smilies = $r['use_emo'];
+ $parser->parse_html = $oldparser->parse_html = ( $this->registry->class_forums->forum_by_id[ $r['forum_id'] ]['use_html'] AND
+ $this->caches['group_cache'][ $r['member_group_id'] ]['g_dohtml'] AND
+ $r['post_htmlstate'] > 0 ) ? 1 : 0;
+ $parser->parse_bbcode = $oldparser->parse_bbcode = $this->registry->class_forums->forum_by_id[ $r['forum_id'] ]['use_ibc'];
+ $parser->parse_nl2br = $oldparser->parse_nl2br = ( $r['post_htmlstate'] != 1 ) ? 1 : 0;
+ $parser->parsing_section = 'topics';
+
+ $rawpost = $oldparser->preEditParse( $r['post'] );
+ break;
+
+ case 'rules':
+ $parser->parse_smilies = $oldparser->parse_smilies = 1;
+ $parser->parse_html = $oldparser->parse_html = 1;
+ $parser->parse_bbcode = $oldparser->parse_bbcode = 1;
+ $parser->parse_nl2br = $oldparser->parse_nl2br = 1;
+ $parser->parsing_section = 'rules';
+
+ $rawpost = $oldparser->preEditParse( $r['rules_text'] );
+ break;
+
+ default:
+ $plugin->parser =& $parser;
+ $plugin->oldparser =& $oldparser;
+
+ $rawpost = $plugin->getRawPost( $type, $r );
+ break;
+ }
+
+ $newpost = $parser->preDbParse( $rawpost );
+
+ //-----------------------------------------
+ // Remove old \' escaping
+ //-----------------------------------------
+
+ $newpost = str_replace( "\\'", "'", $newpost );
+
+ //-----------------------------------------
+ // Convert old dohtml?
+ //-----------------------------------------
+
+ $htmlstate = 0;
+
+ if ( strstr( strtolower($newpost), '[dohtml]' ) )
+ {
+ //-----------------------------------------
+ // Can we use HTML?
+ //-----------------------------------------
+
+ if ( $type == 'posts' AND $this->registry->class_forums->forum_by_id[ $r['forum_id'] ]['use_html'] )
+ {
+ $htmlstate = 2;
+ }
+
+ $newpost = preg_replace( "#\[dohtml\]#i" , "", $newpost );
+ $newpost = preg_replace( "#\[/dohtml\]#i", "", $newpost );
+ }
+ else
+ {
+ $htmlstate = intval( $r['post_htmlstate'] );
+ }
+
+ //-----------------------------------------
+ // Convert old attachment tags
+ //-----------------------------------------
+
+ $newpost = preg_replace( "#\[attachmentid=(\d+?)\]#is", "[attachment=\\1:attachment]", $newpost );
+
+ if ( $newpost OR $type == 'sigs' OR $type == 'aboutme' )
+ {
+ switch( $type )
+ {
+ case 'posts':
+ $this->DB->update( 'posts', array( 'post' => $newpost, 'post_htmlstate' => $htmlstate ), 'pid='.$r['pid'] );
+ $last = $r['pid'];
+ break;
+
+ case 'pms':
+ $this->DB->update( 'message_posts', array( 'msg_post' => $newpost ), 'msg_id='.$r['msg_id'] );
+ $last = $r['msg_id'];
+ break;
+
+ case 'sigs':
+ $this->DB->update( 'profile_portal', array( 'signature' => $newpost ), 'pp_member_id='.$r['pp_member_id'] );
+ $last = $r['pp_member_id'];
+ break;
+
+ case 'aboutme':
+ $this->DB->update( 'profile_portal', array( 'pp_about_me' => $newpost ), 'pp_member_id='.$r['pp_member_id'] );
+ $last = $r['pp_member_id'];
+ break;
+
+ case 'cal':
+ $this->DB->update( 'cal_events', array( 'event_content' => $newpost ), 'event_id='.$r['event_id'] );
+ $last = $r['event_id'];
+ break;
+
+ case 'announce':
+ $this->DB->update( 'announcements', array( 'announce_post' => $newpost ), 'announce_id='.$r['announce_id'] );
+ $last = $r['announce_id'];
+ break;
+
+ case 'rules':
+ $this->DB->update( 'forums', array( 'rules_text' => $newpost ), 'id='.$r['id'] );
+ $last = $r['id'];
+ break;
+
+ default:
+ $last = $plugin->storeNewPost( $type, $r, $newpost );
+ break;
+ }
+ }
+
+ $done++;
+ }
+
+ //-----------------------------------------
+ // Finish - or more?...
+ //-----------------------------------------
+
+ if ( ! $last and ! $max )
+ {
+ //-----------------------------------------
+ // Done..
+ //-----------------------------------------
+
+ $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}";
+ $time = 2;
+
+ $sections[] = $type;
+ $this->DB->replace( 'cache_store', array( 'cs_key' => 'isRebuilt', 'cs_value' => implode( ',', $sections ) ), array( "cs_key" ) );
+
+ if( $type == 'posts' )
+ {
+ $this->DB->delete( 'content_cache_posts' );
+ }
+ else if( $type == 'sigs' )
+ {
+ $this->DB->delete( 'content_cache_sigs' );
+ }
+ }
+ else
+ {
+ //-----------------------------------------
+ // More..
+ //-----------------------------------------
+
+ $dis = $dis + $done;
+ $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
+ $text = $thisgoeshere . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&type={$type}&pergo={$this->request['pergo']}&st={$last}&dis={$dis}";
+ $time = 0;
+ }
+
+ //-----------------------------------------
+ // Bye....
+ //-----------------------------------------
+
+ $this->registry->output->redirect( $url, $text, $time );
+ }
+
+ /**
+ * Resyncronize Topics
+ *
+ * @return void
+ */
+ public function resyncTopics()
+ {
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/moderate.php', 'moderatorLibrary', 'forums' );
+ $modfunc = new $classToLoad( $this->registry );
+
+ $this->registry->class_localization->loadLanguageFile( array( 'public_global' ) );
+
+ //-----------------------------------------
+ // Set up
+ //-----------------------------------------
+
+ $done = 0;
+ $start = intval( $this->request['st'] ) >= 0 ? intval( $this->request['st'] ) : 0;
+ $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
+ $dis = $end + $start;
+ $output = array();
+
+ //-----------------------------------------
+ // Got any more?
+ //-----------------------------------------
+
+ $tmp = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count', 'from' => 'topics', 'limit' => array( $dis, 1 ) ) );
+ $max = intval( $tmp['count'] );
+
+ //-----------------------------------------
+ // Avoid limit...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'topics', 'where' => "state != 'link'", 'order' => 'tid ASC', 'limit' => array( $start, $end ) ) );
+ $outer = $this->DB->execute();
+
+ //-----------------------------------------
+ // Process...
+ //-----------------------------------------
+
+ while( $r = $this->DB->fetch( $outer ) )
+ {
+ $modfunc->rebuildTopic($r['tid'], 0);
+
+ if ( $this->request['pergo'] <= 200 )
+ {
+ $output[] = $this->lang->words['re_processed'].$r['title'];
+ }
+
+ $done++;
+ }
+
+ //-----------------------------------------
+ // Finish - or more?...
+ //-----------------------------------------
+
+ if ( ! $done and ! $max )
+ {
+ //-----------------------------------------
+ // Done..
+ //-----------------------------------------
+
+ $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}";
+ $time = 2;
+ }
+ else
+ {
+ //-----------------------------------------
+ // More..
+ //-----------------------------------------
+ $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
+ $text = $thisgoeshere . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
+ $time = 0;
+ }
+
+ //-----------------------------------------
+ // Bye....
+ //-----------------------------------------
+
+ $this->registry->output->redirect( $url, $text, $time );
+ }
+
+ /**
+ * Resyncronize forum data
+ *
+ * @return void
+ */
+ public function resyncForums()
+ {
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/moderate.php', 'moderatorLibrary', 'forums' );
+ $modfunc = new $classToLoad( $this->registry );
+
+ //-----------------------------------------
+ // Set up
+ //-----------------------------------------
+
+ $done = 0;
+ $start = intval( $this->request['st'] ) >= 0 ? intval( $this->request['st'] ) : 0;
+ $end = intval( $this->request['pergo'] ) ? intval( $this->request['pergo'] ) : 100;
+ $dis = $end + $start;
+ $output = array();
+
+ //-----------------------------------------
+ // Got any more?
+ //-----------------------------------------
+
+ $tmp = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count', 'from' => 'forums', 'limit' => array( $dis, 1 ) ) );
+ $max = intval( $tmp['count'] );
+
+ //-----------------------------------------
+ // Avoid limit...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'forums', 'order' => 'id ASC', 'limit' => array( $start, $end ) ) );
+ $outer = $this->DB->execute();
+
+ //-----------------------------------------
+ // Process...
+ //-----------------------------------------
+
+ while( $r = $this->DB->fetch( $outer ) )
+ {
+ $modfunc->forumRecount( $r['id'] );
+ $output[] = sprintf( $this->lang->words['rebuild_process_f'], $r['name'] );
+ $done++;
+ }
+
+ //-----------------------------------------
+ // Finish - or more?...
+ //-----------------------------------------
+
+ if ( ! $done and ! $max )
+ {
+ //-----------------------------------------
+ // Done..
+ //-----------------------------------------
+
+ $text = $this->lang->words['re_rebuildcomp'] . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}";
+ $time = 2;
+ }
+ else
+ {
+ //-----------------------------------------
+ // More..
+ //-----------------------------------------
+ $thisgoeshere = sprintf( $this->lang->words['re_thisgoeshere'], $dis );
+ $text = $thisgoeshere . ' ' . implode( " ", $output );
+ $url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
+ $time = 0;
+ }
+
+ //-----------------------------------------
+ // Bye....
+ //-----------------------------------------
+
+ $this->registry->output->redirect( $url, $text, $time );
+ }
+
+ /**
+ * Splash screen with rebuild options
+ *
+ * @return void
+ */
+ public function rebuildSplashScreen()
+ {
+ /* Build Form Elements */
+ $form = array();
+
+ $form['posts'] = $this->registry->output->formDropdown( 'posts' , array( 0 => array( 0, $this->lang->words['yesno_no'] ), 1 => array( 1, $this->lang->words['yesno_yes'] ) ) );
+ $form['members'] = $this->registry->output->formDropdown( 'members', array( 0 => array( 0, $this->lang->words['yesno_no'] ), 1 => array( 1, $this->lang->words['yesno_yes'] ) ) );
+ $form['lastreg'] = $this->registry->output->formDropdown( 'lastreg', array( 0 => array( 0, $this->lang->words['yesno_no'] ), 1 => array( 1, $this->lang->words['yesno_yes'] ) ) );
+ $form['online'] = $this->registry->output->formDropdown( 'online' , array( 0 => array( 0, $this->lang->words['yesno_no'] ), 1 => array( 1, $this->lang->words['yesno_yes'] ) ) );
+
+ //-----------------------------------------
+ // Only need to rebuild once
+ //-----------------------------------------
+
+ $todo = array(
+ array( 'posts' , $this->lang->words['remenu_posts'] ),
+ array( 'pms' , $this->lang->words['remenu_pms'] ),
+ array( 'cal' , $this->lang->words['remenu_events'] ),
+ array( 'announce', $this->lang->words['remenu_announce'] ),
+ array( 'sigs' , $this->lang->words['remenu_sigs'] ),
+ array( 'aboutme' , $this->lang->words['remenu_aboutme'] ),
+ array( 'rules' , $this->lang->words['remenu_rules'] ),
+ );
+
+ foreach( ipsRegistry::$applications as $app_dir => $app_data )
+ {
+ //-----------------------------------------
+ // Retrieve the RSS links for the header
+ //-----------------------------------------
+
+ if( file_exists( IPSLib::getAppDir( $app_dir ) . '/extensions/upgradePostRebuild.php' ) )
+ {
+ $className = IPSLib::loadLibrary( IPSLib::getAppDir( $app_dir ) . '/extensions/upgradePostRebuild.php', 'postRebuild_'.$app_dir, $app_dir );
+
+ if( class_exists( $className ) )
+ {
+ $rebuild = new $className( $this->registry );
+
+ if( method_exists( $rebuild, "getDropdown" ) )
+ {
+ $todo = array_merge( $todo, $rebuild->getDropdown() );
+ }
+ }
+ }
+ }
+
+ $final = array();
+ $sections = array();
+
+ $alreadyRebuilt = $this->DB->buildAndFetch( array( 'select' => 'cs_value', 'from' => 'cache_store', 'where' => "cs_key='isRebuilt'" ) );
+
+ if( $alreadyRebuilt['cs_value'] )
+ {
+ $sections = explode( ',', $alreadyRebuilt['cs_value'] );
+ }
+
+ $form['pergo'] = $this->registry->output->formSimpleInput( 'pergo', '50', 5 );
+
+ /* Output */
+ $this->registry->output->html .= $this->html->rebuildSplashScreen( $form, $todo, $sections );
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/tools/settings.php b/upload/admin/applications/core/modules_admin/tools/settings.php
index 7568a1d2..e73af8f5 100644
--- a/upload/admin/applications/core/modules_admin/tools/settings.php
+++ b/upload/admin/applications/core/modules_admin/tools/settings.php
@@ -1,2254 +1,2139 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
- exit();
-}
-
-class admin_core_tools_settings extends ipsCommand
-{
- /**
- * Key array
- *
- * @access private
- * @var array Array of keys
- */
- private $key_array = array();
-
- /**
- * Setting group array
- *
- * @access private
- * @var array Array of setting groups
- */
- private $in_group = array();
-
- /**
- * Setting groups array
- *
- * @access private
- * @var array Array of setting groups
- */
- private $setting_groups = array();
-
- /**
- * Setting groups array mapping
- *
- * @access private
- * @var array Array of setting groups
- */
- private $setting_groups_by_key = array();
-
- /**
- * Skin object
- * This is public so that the portal can access it
- *
- * @access public
- * @var object Skin templates
- */
- public $html;
-
- /**
- * Form code
- * This is public so that the portal can access it
- *
- * @access public
- * @var string Form code
- */
- public $form_code;
-
- /**
- * Form code
- * This is public so that the portal can access it
- *
- * @access public
- * @var string JS Form code
- */
- public $form_code_js;
-
- /**
- * Application to use
- *
- * @access private
- * @var string Application
- */
- private $_app;
-
- /**
- * Where to return to after save
- *
- * @access public
- * @var string URL to go to
- */
- public $return_after_save;
-
- /**
- * Breadcrumb url to use in place of the default
- *
- * @access public
- * @var string
- */
- public $base_nav_url;
-
- /**
- * Class entry point
- *
- * @access public
- * @param object Registry reference
- * @return void [Outputs to screen]
- */
- public function doExecute( ipsRegistry $registry )
- {
- //-----------------------------------------
- // Load language
- //-----------------------------------------
-
- $this->registry->class_localization->loadLanguageFile( array( 'admin_tools' ) );
-
- $this->html = $this->registry->output->loadTemplate('cp_skin_tools');
-
- $this->form_code = $this->html->form_code = 'module=tools§ion=settings';
- $this->form_code_js = $this->html->form_code_js = 'module=tools§ion=settings';
-
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'settings_manage' );
-
- switch( $this->request['do'] )
- {
- case 'settinggroup_resync':
- $this->_resynchSettingGroup();
- break;
-
- case 'settinggroup_delete':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'settings_delete' );
- $this->_deleteSettingGroup();
- break;
-
- case 'settinggroup_new':
- $this->_settingGroupForm('add');
- break;
-
- case 'settinggroup_showedit':
- $this->_settingGroupForm('edit');
- break;
-
- case 'settinggroup_add':
- $this->_settingGroupSave('add');
- break;
-
- case 'settinggroup_edit':
- $this->_settingGroupSave('edit');
- break;
-
- case 'settingnew':
- $this->_settingForm('add');
- break;
-
- case 'setting_showedit':
- $this->_settingForm('edit');
- break;
-
- case 'setting_add':
- $this->_settingSave('add');
- break;
-
- case 'setting_edit':
- $this->_settingSave('edit');
- break;
-
- case 'reorder':
- $this->reorder();
- break;
-
- case 'setting_view':
- $this->_viewSettings();
- break;
-
- case 'setting_delete':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'settings_delete' );
- $this->_deleteSettings();
- break;
-
- case 'setting_revert':
- $this->_revertSettings();
- break;
-
- case 'setting_update':
- $this->_updateSettings();
- break;
-
- case 'findsetting':
- $this->_findSettingGroup();
- break;
-
- case 'settings_do_import':
- $this->importAllSettings();
- break;
- case 'settings_do_import_indev':
- $this->importAllSettings(1);
- break;
-
- case 'setting_someexport_start':
- $this->_startExportingSettings();
- break;
-
- case 'setting_someexport_complete':
- $this->_finishExportingSettings();
- break;
-
- case 'MOD_export_setting':
- $this->_exportSettingsGroup();
- break;
-
- case 'settingsExportApps':
- $messages = $this->exportAllApps();
-
- $this->registry->output->global_message = implode( " ", $messages );
-
- $this->_settingsOverview();
- break;
-
- case 'settingsImportApps':
- $messages = $this->importAllApps();
-
- $this->registry->output->global_message = implode( " ", $messages );
- $this->_settingsOverview();
- break;
- default:
- $this->request['do'] = 'settingsview';
- $this->_settingsOverview();
- break;
- }
-
- //-----------------------------------------
- // Pass to CP output hander
- //-----------------------------------------
-
- $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
- $this->registry->output->sendOutput();
- }
-
- /**
- * Reorder the settings
- *
- * @access public
- * @return void
- */
- public function reorder()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- require_once( IPS_KERNEL_PATH . 'classAjax.php' );
- $ajax = new classAjax();
-
- //-----------------------------------------
- // Checks...
- //-----------------------------------------
-
- if( $this->registry->adminFunctions->checkSecurityKey( $this->request['md5check'], true ) === false )
- {
- $ajax->returnString( $this->lang->words['postform_badmd5'] );
- exit();
- }
-
- //-----------------------------------------
- // Save new position
- //-----------------------------------------
-
- $position = 1;
-
- if( is_array($this->request['settings']) AND count($this->request['settings']) )
- {
- foreach( $this->request['settings'] as $this_id )
- {
- $this->DB->update( 'core_sys_conf_settings', array( 'conf_position' => $position ), 'conf_id=' . $this_id );
-
- $position++;
- }
- }
-
- $ajax->returnString( 'OK' );
- exit();
- }
-
- /**
- * Show page to export settings
- *
- * @access private
- * @return void
- */
- private function _startExportingSettings()
- {
- //-----------------------------------------
- // Get the settings
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'order' => 'conf_id' ) );
- $this->DB->execute();
-
- while ( $r = $this->DB->fetch() )
- {
- $settings[] = $r;
- }
-
- $this->registry->output->html .= $this->html->settings_exportsingle( $settings );
- }
-
- /**
- * Export the settings
- *
- * @access private
- * @return void
- */
- private function _finishExportingSettings()
- {
- $ids = array();
- $groups = array();
-
- //-----------------------------------------
- // get ids...
- //-----------------------------------------
-
- foreach ($_POST as $key => $value)
- {
- if ( preg_match( "/^id_(\d+)$/", $key, $match ) )
- {
- if ($this->request[$match[0]])
- {
- $ids[] = $match[1];
- }
- }
- }
-
- $ids = IPSLib::cleanIntArray( $ids );
-
- //-----------------------------------------
- // Got any?
- //-----------------------------------------
-
- if ( ! count( $ids ) )
- {
- $this->registry->output->global_message = $this->lang->words['s_sometoexport'];
- $this->_startExportingSettings();
- return;
- }
-
- //-----------------------------------------
- // Get XML class
- //-----------------------------------------
-
- require_once( IPS_KERNEL_PATH . 'class_xml.php' );
-
- $xml = new class_xml();
-
- $xml->xml_set_root( 'settingexport', array( 'exported' => time() ) );
-
- //-----------------------------------------
- // Get groups
- //-----------------------------------------
-
- $xml->xml_add_group( 'settinggroup' );
-
- $this->_settingsGetGroups();
-
- $entry = array();
-
- $this->DB->build( array( 'select' => '*',
- 'from' => 'core_sys_conf_settings',
- 'where' => "conf_id IN (".implode(",",$ids).")",
- 'order' => 'conf_position, conf_title' ) );
-
- $this->DB->execute();
-
- while ( $r = $this->DB->fetch() )
- {
- $content = array();
- $groups[ $r['conf_group'] ] = $r['conf_group'];
- $r['conf_value'] = '';
-
- //-----------------------------------------
- // Add in setting key
- //-----------------------------------------
-
- $r['conf_title_keyword'] = $this->setting_groups[ $r['conf_group'] ]['conf_title_keyword'];
-
- foreach( $r as $k => $v )
- {
- $content[] = $xml->xml_build_simple_tag( $k, $v );
- }
-
- $entry[] = $xml->xml_build_entry( 'setting', $content );
- }
-
- //-----------------------------------------
- // Add in groups...
- //-----------------------------------------
-
- if ( is_array( $groups ) AND count( $groups ) )
- {
- foreach( $groups as $conf_group_id )
- {
- $content = array();
-
- $thisconf = array( 'conf_is_title' => 1,
- 'conf_title_keyword' => $this->setting_groups[ $conf_group_id ]['conf_title_keyword'],
- 'conf_title_title' => $this->setting_groups[ $conf_group_id ]['conf_title_title'],
- 'conf_title_desc' => $this->setting_groups[ $conf_group_id ]['conf_title_desc'],
- 'conf_title_noshow' => $this->setting_groups[ $conf_group_id ]['conf_title_noshow'],
- 'conf_title_module' => $this->setting_groups[ $conf_group_id ]['conf_title_module'] );
-
- foreach( $thisconf as $k => $v )
- {
- $content[] = $xml->xml_build_simple_tag( $k, $v );
- }
-
- $entry[] = $xml->xml_build_entry( 'setting', $content );
- }
- }
-
- $xml->xml_add_entry_to_group( 'settinggroup', $entry );
-
- $xml->xml_format_document();
-
- $doc = $xml->xml_document;
-
- //-----------------------------------------
- // Print to browser
- //-----------------------------------------
-
- $this->registry->output->showDownload( $doc, 'ipb_settings_partial.xml', '', 0 );
- }
-
- /**
- * Setting group export
- *
- * @access private
- * @return void
- */
- private function _exportSettingsGroup()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $this->request[ 'conf_group'] = intval($this->request['conf_group'] );
-
- /* Got anything? */
- if ( ! $this->request['conf_group'] )
- {
- return;
- }
-
- //-----------------------------------------
- // Get setting groups
- //-----------------------------------------
-
- $this->_settingsGetGroups( true );
-
- //-----------------------------------------
- // Get xml class
- //-----------------------------------------
-
- require_once( IPS_KERNEL_PATH.'classXML.php' );
-
- $xml = new classXML( IPS_DOC_CHAR_SET );
-
- $xml->newXMLDocument();
- $xml->addElement( 'settingexport' );
- $xml->addElement( 'settinggroup', 'settingexport' );
-
- foreach( $this->setting_groups as $i => $roar )
- {
- //-----------------------------------------
- // App check?
- //-----------------------------------------
-
- if ( $this->request['conf_group'] != $roar['conf_title_id'] )
- {
- continue;
- }
-
- //-----------------------------------------
- // First, add in setting group title
- //-----------------------------------------
-
- $thisconf = array( 'conf_is_title' => 1,
- 'conf_title_keyword' => $roar['conf_title_keyword'],
- 'conf_title_title' => $roar['conf_title_title'],
- 'conf_title_desc' => $roar['conf_title_desc'],
- 'conf_title_tab' => $roar['conf_title_tab'],
- 'conf_title_app' => $roar['conf_title_app'] ? $roar['conf_title_app'] : $app_dir,
- 'conf_title_noshow' => $roar['conf_title_noshow'] );
-
- $xml->addElementAsRecord( 'settinggroup', 'setting', $thisconf );
-
- //-----------------------------------------
- // Get settings...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*',
- 'from' => 'core_sys_conf_settings',
- 'where' => "conf_group='{$roar['conf_title_id']}'",
- 'order' => 'conf_position, conf_title' ) );
-
- $this->DB->execute();
-
- while ( $r = $this->DB->fetch() )
- {
- //-----------------------------------------
- // Clean up...
- //-----------------------------------------
-
- unset( $r['conf_value'], $r['conf_id'] );
-
- $r['conf_title_keyword'] = $roar['conf_title_keyword'];
- $r['conf_is_title'] = 0;
-
- $xml->addElementAsRecord( 'settinggroup', 'setting', $r );
- }
- }
-
- //-----------------------------------------
- // Grab the XML document
- //-----------------------------------------
-
- $xmlData = $xml->fetchDocument();
-
- $this->registry->output->showDownload( $xmlData, 'settingGroup_' . IPSText::makeSeoTitle( $thisconf['conf_title_title'] ) . '.xml', '', 0 );
- }
-
- /**
- * Find setting group (don't rely on IDs)
- *
- * @access public
- * @return void
- */
- public function _findSettingGroup()
- {
- if ( ! $this->request['key'] )
- {
- $this->_settingsOverview();
- }
-
- $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_settings_titles' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- if( ( $r['conf_title_keyword'] == $this->request['key'] ) OR mb_strtolower( str_replace( " ", "", trim( $r['conf_title_title'] ) ) ) == urldecode( trim( $this->request['key'] ) ) )
- {
- $this->registry->output->silentRedirect( $this->settings['base_url'] . '&' . $this->form_code . '&do=setting_view&conf_group=' . $r['conf_title_id'] );
- break;
- }
- }
-
- $this->_settingsOverview();
- }
-
- /**
- * Import all settings
- *
- * @access public
- * @param boolean In development mode?
- * @param boolean Return (ignore the var name)
- * @param array Array of known setting values
- * @return void
- */
- public function importAllSettings( $in_dev=0, $no_return=0, $known=array() )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $updated = 0;
- $inserted = 0;
- $need_update = array();
-
- //-----------------------------------------
- // Make sure we have titles
- //-----------------------------------------
-
- $this->_settingsTitlesCheck();
-
- //-----------------------------------------
- // INDEV?
- //-----------------------------------------
-
- if ( $in_dev )
- {
- $_FILES['FILE_UPLOAD']['name'] = '';
- $this->request['file_location'] = IPSLib::getAppDir( $this->request['app_dir'] ) . '/xml/' . $this->request['app_dir'] . '_settings.xml';
- }
- else
- {
- $this->request['file_location'] = IPS_ROOT_PATH . $this->request['file_location'] ;
- }
-
- //-----------------------------------------
- // Go for it
- //-----------------------------------------
-
- if ( $_FILES['FILE_UPLOAD']['name'] == "" or ! $_FILES['FILE_UPLOAD']['name'] or ($_FILES['FILE_UPLOAD']['name'] == "none") )
- {
- //-----------------------------------------
- // check and load from server
- //-----------------------------------------
-
- if ( ! $this->request['file_location'] )
- {
- $this->registry->output->global_message = $this->lang->words['s_nofile'];
- $this->_settingsOverview();
- return;
- }
-
- if ( ! file_exists( $this->request['file_location'] ) )
- {
- $this->registry->output->global_message = sprintf( $this->lang->words['s_noopen'], $this->request['file_location'] );
- $this->_settingsOverview();
- return;
- }
-
- if ( preg_match( "#\.gz$#", $this->request['file_location'] ) )
- {
- if ( $FH = @gzopen( $this->request['file_location'], 'rb' ) )
- {
- while ( ! @gzeof( $FH ) )
- {
- $content .= @gzread( $FH, 1024 );
- }
-
- @gzclose( $FH );
- }
- }
- else
- {
- if ( $FH = @fopen( $this->request['file_location'], 'rb' ) )
- {
- $content = @fread( $FH, filesize($this->request['file_location']) );
- @fclose( $FH );
- }
- }
- }
- else
- {
- //-----------------------------------------
- // Get uploaded schtuff
- //-----------------------------------------
-
- $tmp_name = $_FILES['FILE_UPLOAD']['name'];
- $tmp_name = preg_replace( "#\.gz$#", "", $tmp_name );
-
- $content = ipsRegistry::getClass('adminFunctions')->importXml( $tmp_name );
- }
-
- if ( ! $content )
- {
- $this->registry->output->global_message = $this->lang->words['s_nofile'];
- $this->_settingsOverview();
- return;
- }
-
- $return = $this->_importXML( $content, $this->request['app_dir'], $known );
-
- if ( $no_return )
- {
- $this->registry->output->global_message = sprintf( $this->lang->words['s_upandin'], $return['updatedCount'], $return['insertedCount'] );
- return TRUE;
- }
- else
- {
- $this->registry->output->global_message = sprintf( $this->lang->words['s_upandin'], $return['updatedCount'], $return['insertedCount'] );
- $this->_settingsOverview();
- return;
- }
- }
-
- /**
- * Delete a setting group
- *
- * @access private
- * @return void
- */
- private function _deleteSettingGroup()
- {
- if ( $this->request['id'] )
- {
- $conf = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count', 'from' => 'core_sys_conf_settings', 'where' => 'conf_group=' . $this->request['id'] ) );
-
- $count = intval($conf['count']);
-
- if ( $count > 0 )
- {
- $this->registry->output->global_message = $this->lang->words['s_cantremove'];
- }
- else
- {
- $this->DB->delete( 'core_sys_settings_titles', 'conf_title_id=' . $this->request['id'] );
-
- $this->registry->output->global_message = $this->lang->words['s_removed'];
- }
-
- }
-
- $this->settingsRebuildCache();
-
- $this->_settingsOverview();
- }
-
- /**
- * Resynchronize settings in a group
- *
- * @access private
- * @return void
- */
- private function _resynchSettingGroup()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $this->request['id'] = intval( $this->request['id'] );
-
- //-----------------------------------------
- // Doit...
- //-----------------------------------------
-
- $this->_resynchGroup( $this->request['id'] );
-
- $this->registry->output->global_message = $this->lang->words['s_recounted'];
-
- //-----------------------------------------
- // Get conf title details
- //-----------------------------------------
-
- $conf_group = $this->DB->buildAndFetch( array( 'select' => 'conf_title_tab',
- 'from' => 'core_sys_settings_titles',
- 'where' => 'conf_title_id='.$this->request['id'] ) );
-
- $this->_settingsOverview( $conf_group['conf_title_tab'] );
- }
-
- /**
- * Does the resync
- *
- * @access private
- * @param integer Group id
- * @return void
- */
- private function _resynchGroup( $id )
- {
- if ( $id )
- {
- $conf = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count', 'from' => 'core_sys_conf_settings', 'where' => 'conf_group='.$id ) );
-
- $count = intval($conf['count']);
-
- $this->DB->update( 'core_sys_settings_titles', array( 'conf_title_count' => $count ), 'conf_title_id=' . $id );
- }
- }
-
- /**
- * Form to add/edit a setting group
- *
- * @access private
- * @param string [add|edit]
- * @return void
- */
- private function _settingGroupForm( $type='add' )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $conf_title_id = intval( $this->request['id'] );
- $form = array();
- $apps = array( 0 => array( 'core', $this->lang->words['s_global_dd'] ) );
-
- //-----------------------------------------
- // Build applications drop down
- //-----------------------------------------
-
- foreach( ipsRegistry::$applications as $app_dir => $app_data )
- {
- $apps[] = array( $app_dir, $app_data['app_title'] );
- }
-
- //-----------------------------------------
- // Type
- //-----------------------------------------
-
- if ( $type == 'add' )
- {
- $formcode = 'settinggroup_add';
- $title = $this->lang->words['s_createnew'];
- $button = $this->lang->words['s_createnew'];
- }
- else
- {
- $conf = $this->DB->buildAndFetch( array( 'select' => '*',
- 'from' => 'core_sys_settings_titles',
- 'where' => 'conf_title_id='.$conf_title_id ) );
-
- if ( ! $conf['conf_title_id'] )
- {
- $this->registry->output->global_message = $this->lang->words['s_noid'];
- $this->_settingsOverview();
- }
-
- $formcode = 'settinggroup_edit';
- $title = sprintf($this->lang->words['s_editsetting'], $conf['conf_title'] );
- $button = $this->lang->words['s_savechanges'];
- }
-
- //-----------------------------------------
- // Form elements
- //-----------------------------------------
-
- $form['conf_title_title'] = $this->registry->output->formInput( 'conf_title_title', $_POST['conf_title_title'] ? $_POST['conf_title_title'] : $conf['conf_title_title'] );
- $form['conf_title_desc'] = $this->registry->output->formTextarea( 'conf_title_desc', $_POST['conf_title_desc'] ? $_POST['conf_title_desc'] : $conf['conf_title_desc'] );
- $form['conf_title_app'] = $this->registry->output->formDropdown( 'conf_title_app', $apps, $_POST['conf_title_app'] ? $_POST['conf_title_app'] : $conf['conf_title_app'] );
- $form['conf_title_tab'] = $this->registry->output->formInput( 'conf_title_tab', $_POST['conf_title_tab'] ? $_POST['conf_title_tab'] : $conf['conf_title_tab'] );
-
- if ( IN_DEV )
- {
- $form['conf_title_keyword'] = $this->registry->output->formInput( 'conf_title_keyword', $_POST['conf_title_keyword'] ? $_POST['conf_title_keyword'] : $conf['conf_title_keyword'] );
- $form['conf_title_noshow'] = $this->registry->output->formYesNo( 'conf_title_noshow', $_POST['conf_title_noshow'] ? $_POST['conf_title_noshow'] : $conf['conf_title_noshow'] );
- }
-
- $this->registry->output->html .= $this->html->settings_title_form( $form, $title, $formcode, $button );
- }
-
- /**
- * Save a setting group
- *
- * @access private
- * @param string [add|edit]
- * @return void
- */
- private function _settingGroupSave($type='add')
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- if ( $type == 'edit' )
- {
- if ( ! $this->request['id'] )
- {
- $this->registry->output->global_message = $this->lang->words['s_noid'];
- $this->_settingForm();
- return;
- }
- }
-
- if( ! $this->request['conf_title_title'] )
- {
- $this->registry->output->global_message = $this->lang->words['s_notitle'];
- $this->_settingGroupForm( $type );
- return;
- }
-
- //--------------------------------------------
- // Check...
- //--------------------------------------------
-
- $array = array( 'conf_title_title' => $this->request['conf_title_title'],
- 'conf_title_desc' => IPSText::safeslashes( $_POST['conf_title_desc'] ),
- 'conf_title_keyword' => IPSText::safeslashes( $_POST['conf_title_keyword'] ),
- 'conf_title_noshow' => $this->request['conf_title_noshow'],
- 'conf_title_app' => trim( $this->request['conf_title_app'] ),
- 'conf_title_tab' => trim( $this->request['conf_title_tab'] )
- );
-
-
- if ( $type == 'add' )
- {
- $this->DB->insert( 'core_sys_settings_titles', $array );
- $this->registry->output->global_message = $this->lang->words['s_added'];
- }
- else
- {
- $this->DB->update( 'core_sys_settings_titles', $array, 'conf_title_id=' . $this->request['id'] );
- $this->registry->output->global_message = $this->lang->words['s_edited'];
- }
-
- $this->settingsRebuildCache();
-
- $this->_settingsOverview();
- }
-
- /**
- * Form to add/edit a setting
- *
- * @access private
- * @param string [add|edit]
- * @return void
- */
- private function _settingForm( $type='add' )
- {
- if ( $type == 'add' )
- {
- $formcode = 'setting_add';
- $title = $this->lang->words['s_createnewtitle'];
- $button = $this->lang->words['s_createnewtitle'];
- $conf = array( 'conf_group' => $this->request['conf_group'], 'conf_add_cache' => 1 );
-
- if ( IN_DEV )
- {
- $conf['conf_protected'] = 1;
- }
-
- if ( $this->request['conf_group'] )
- {
- $max = $this->DB->buildAndFetch( array( 'select' => 'max(conf_position) as max', 'from' => 'core_sys_conf_settings', 'where' => 'conf_group=' . $this->request['conf_group'] ) );
- }
- else
- {
- $max = $this->DB->buildAndFetch( array( 'select' => 'max(conf_position) as max', 'from' => 'core_sys_conf_settings' ) );
- }
-
- $conf['conf_position'] = $max['max'] + 1;
- }
- else
- {
- $conf = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => 'conf_id=' . $this->request['id'] ) );
-
- if ( ! $conf['conf_id'] )
- {
- $this->registry->output->global_message = $this->lang->words['s_noid'];
- $this->_settingsOverview();
- }
-
- $formcode = 'setting_edit';
- $title = sprintf($this->lang->words['s_editsetting'], $conf['conf_title'] );
- $button = $this->lang->words['s_savechanges'];
- }
-
- //-----------------------------------------
- // Get groups
- //-----------------------------------------
-
- $this->_settingsGetGroups();
-
- $groups = array();
-
- foreach( $this->setting_groups as $i => $r )
- {
- $groups[] = array( $r['conf_title_id'], $r['conf_title_title'] );
- }
-
- //-----------------------------------------
- // Type
- //-----------------------------------------
-
- $types = array( 0 => array( 'input' , $this->lang->words['s_input'] ),
- 1 => array( 'dropdown', $this->lang->words['s_dropdown'] ),
- 2 => array( 'yes_no' , $this->lang->words['s_yes_no'] ),
- 3 => array( 'textarea', $this->lang->words['s_textarea'] ),
- 4 => array( 'editor' , $this->lang->words['s_editor'] ),
- 5 => array( 'multi' , $this->lang->words['s_multi'] ),
- );
-
-
-
- $form['conf_title'] = $this->registry->output->formInput( 'conf_title' , $_POST['conf_title'] ? $_POST['conf_title'] : $conf['conf_title'] );
- $form['conf_position'] = $this->registry->output->formInput( 'conf_position' , $_POST['conf_position'] ? $_POST['conf_position'] : $conf['conf_position'] );
- $form['conf_description'] = $this->registry->output->formTextarea( 'conf_description', $_POST['conf_description'] ? $_POST['conf_description'] : $conf['conf_description'] );
- $form['conf_group'] = $this->registry->output->formDropdown( 'conf_group' , $groups, $_POST['conf_group'] ? $_POST['conf_group'] : $conf['conf_group'] );
- $form['conf_type'] = $this->registry->output->formDropdown( 'conf_type' , $types, $_POST['conf_type'] ? $_POST['conf_type'] : $conf['conf_type'] );
- $form['conf_key'] = $this->registry->output->formInput( 'conf_key' , $_POST['conf_key'] ? $_POST['conf_key'] : $conf['conf_key'] );
- $form['conf_value'] = $this->registry->output->formTextarea( 'conf_value' , $_POST['conf_value'] ? $_POST['conf_value'] : $conf['conf_value'] );
- $form['conf_default'] = $this->registry->output->formTextarea( 'conf_default' , $_POST['conf_default'] ? $_POST['conf_default'] : $conf['conf_default'] );
- $form['conf_extra'] = $this->registry->output->formTextarea( 'conf_extra' , $_POST['conf_extra'] ? $_POST['conf_extra'] : $conf['conf_extra'] );
- $form['conf_evalphp'] = $this->registry->output->formTextarea( 'conf_evalphp' , $_POST['conf_evalphp'] ? $_POST['conf_evalphp'] : $conf['conf_evalphp'] );
- $form['conf_keywords'] = $this->registry->output->formTextarea( 'conf_keywords' , $_POST['conf_keywords'] ? $_POST['conf_keywords'] : $conf['conf_keywords'] );
- $form['conf_start_group'] = $this->registry->output->formInput( 'conf_start_group', $_POST['conf_start_group'] ? $_POST['conf_start_group'] : $conf['conf_start_group'] );
- $form['conf_end_group'] = $this->registry->output->formYesNo( 'conf_end_group' , $_POST['conf_end_group'] ? $_POST['conf_end_group'] : $conf['conf_end_group'] );
- $form['conf_add_cache'] = $this->registry->output->formYesNo( 'conf_add_cache', $_POST['conf_add_cache'] ? $_POST['conf_add_cache'] : $conf['conf_add_cache'] );
-
- if ( IN_DEV )
- {
- $form['conf_protected'] = $this->registry->output->formYesNo( 'conf_protected', $_POST['conf_protected'] ? $_POST['conf_protected'] : $conf['conf_protected'] );
- }
-
-
-
- //-----------------------------------------
- // start form
- //-----------------------------------------
-
- $this->registry->output->html .= $this->html->settings_form( $form, $title, $formcode, $button );
- }
-
- /**
- * View all settings (form) in a group
- * This is public so that portal can access it
- *
- * @access public
- * @return void
- */
- public function _viewSettings()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $search_key = trim( $this->request['search'] );
- $conf_group = trim( $this->request['conf_group'] );
- $conf_titles = array();
- $in_group = array();
- $last_conf_id = -1;
- $start = intval( $this->request['st'] );
- $end = 150;
- $get_by_key = isset( $this->request['conf_title_keyword'] ) ? $this->request['conf_title_keyword'] : '';
-
- //-----------------------------------------
- // Get settings in group
- //-----------------------------------------
-
- $this->_settingsGetGroups( ( $get_by_key ) ? TRUE : FALSE );
-
- //-----------------------------------------
- // Grabbing by key?
- //-----------------------------------------
-
- if( $get_by_key )
- {
- $data = $this->DB->buildAndFetch( array(
- 'select' => 'conf_title_id, conf_title_keyword, conf_title_title',
- 'from' => 'core_sys_settings_titles',
- 'where' => "conf_title_keyword='{$get_by_key}'"
- ) );
-
- $this->request['conf_group'] = $data['conf_title_id'] ;
- $conf_group = $data['conf_title_id'];
- $this->request['groupHelpKey'] = $data['conf_title_keyword'];
- }
-
- //-----------------------------------------
- // check...
- //-----------------------------------------
-
- if( ( ! $conf_group and ! $search_key ) && ! $search_key )
- {
- $this->registry->output->global_message = $this->lang->words['s_nogroup'];
- $this->_settingsOverview();
- return;
- }
-
- //-----------------------------------------
- // Pagination
- //-----------------------------------------
-
- $pages = $this->registry->output->generatePagination( array(
- 'totalItems' => $this->setting_groups[$conf_group]['conf_title_count'],
- 'itemsPerPage' => $end,
- 'currentStartValue' => $start,
- 'baseUrl' => $this->settings['base_url'] . "&{$this->form_code}&&search={$search_key}",
- ) );
-
-
- //-----------------------------------------
- // Did we search?
- //-----------------------------------------
-
- if( $search_key )
- {
- $keywords = mb_strtolower($search_key);
- $whereExtra = $conf_group ? " AND c.conf_group={$conf_group}" : '';
-
- $this->DB->build( array(
- 'select' => 'c.*',
- 'from' => array( 'core_sys_conf_settings' => 'c' ),
- 'where' => '(' . $this->DB->buildLower('c.conf_title') . " LIKE '%{$keywords}%' OR " . $this->DB->buildLower('c.conf_description') . " LIKE '%{$keywords}%' OR " . $this->DB->buildLower('c.conf_title') . " LIKE '%{$keywords}%')" . $whereExtra,
- 'order' => 'c.conf_title',
- 'limit' => array( $start, $end ),
- 'add_join' => array(
- array(
- 'select' => 'ct.conf_title_id, ct.conf_title_noshow, ct.conf_title_title, ct.conf_title_tab',
- 'from' => array( 'core_sys_settings_titles' => 'ct' ),
- 'where' => 'ct.conf_title_id=c.conf_group',
- 'type' => 'left'
- )
- )
- ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $r['conf_start_group'] = "";
- $r['conf_end_group'] = "";
- $r['conf_description'] .= ' ' . $this->lang->words['conf_desc_search'] . "" . $r['conf_title_title'] . " ";
- $conf_entry[ $r['conf_id'] ] = $r;
- }
-
- if( ! count( $conf_entry ) )
- {
- $this->registry->output->global_message = sprintf( $this->lang->words['s_nomatches'], $keywords );
- $this->_settingsOverview();
- return;
- }
-
- $title = sprintf( $this->lang->words['s_searchedfor'], $keywords );
- $tab = '';
- }
-
- //-----------------------------------------
- // Or not...
- //-----------------------------------------
-
- else
- {
- $this->DB->build( array(
- 'select' => '*',
- 'from' => 'core_sys_conf_settings',
- 'where' => "conf_group='{$conf_group}'",
- 'order' => 'conf_position, conf_title',
- 'limit' => array( $start,$end )
- ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $conf_entry[ $r['conf_id'] ] = $r;
-
- if ( $r['conf_end_group'] )
- {
- $in_g = 0;
- }
-
- if ( $in_g )
- {
- $this->in_group[] = $r['conf_id'];
- }
-
- if ( $r['conf_start_group'] )
- {
- $in_g = 1;
- }
- }
-
- $title = $this->setting_groups[$conf_group]['conf_title_title'];
- $tab = IPSText::md5Clean( $this->setting_groups[$conf_group]['conf_title_tab'] );
- $this->request['groupHelpKey'] = $this->setting_groups[ $conf_group ]['conf_title_keyword'];
- }
-
- //-----------------------------------------
- // Start output
- //-----------------------------------------
-
- $content = "";
-
- if( is_array( $conf_entry ) and count( $conf_entry ) )
- {
- foreach( $conf_entry as $id => $r )
- {
- $content .= $this->_processSettingEntry( $r );
- }
- }
-
- if( ! $search_key AND ! $get_by_key )
- {
- $searchbutton = 1;
- }
-
- /* Navigation */
- if( $this->base_nav_url )
- {
- $this->registry->output->extra_nav[] = array( $this->base_nav_url, ipsRegistry::$applications[ $this->setting_groups[$conf_group]['conf_title_app'] ]['app_title'] );
- $this->registry->output->extra_nav[] = array( "", $title );
-
- }
- else if( $tab )
- {
- $this->registry->output->extra_nav[] = array( "{$this->settings['base_url']}{$this->form_code}&_dtab={$tab}", ipsRegistry::$applications[ $this->setting_groups[$conf_group]['conf_title_app'] ]['app_title'] );
- $this->registry->output->extra_nav[] = array( "{$this->settings['base_url']}{$this->form_code}&do=setting_view&conf_group={$conf_group}", $title );
- }
-
- /* Output */
- $this->registry->output->html .= $this->html->settings_view_wrapper( $title, $content, $searchbutton, $this->return_after_save );
- $this->registry->output->html = str_replace( '', " ", $this->registry->output->html );
- }
-
- /**
- * Process an individual setting for display
- *
- * @access private
- * @param array Setting record
- * @return void
- */
- private function _processSettingEntry($r)
- {
- $tempSkinUrl = $this->settings['skin_app_url'];
- $this->settings[ 'skin_app_url'] = $this->settings['_original_base_url'] . '/' . CP_DIRECTORY . '/applications/core/skin_cp/' ;
-
- $form_element = "";
- $form_type = 'normal';
- $dropdown = array();
- $start = "";
- $end = "";
- $revert_button = "";
-
- $key = $r['conf_key'];
- $value = $r['conf_value'] != "" ? $r['conf_value'] : $r['conf_default'];
- $value = $value == "{blank}" ? '' : $value;
-
- $show = 1;
-
- //-----------------------------------------------
- // Default?
- //-----------------------------------------------
-
- $css = "";
-
- if ( $r['conf_value'] != "" and ( $r['conf_value'] != $r['conf_default'] ) )
- {
- $revert_button = "form_code}&do=setting_revert&id={$r['conf_id']}&conf_group={$r['conf_group']}&search=" . $this->request['search'] . "' title='{$this->lang->words['s_revertback']}'> ";
- }
-
- //-----------------------------------------------
- // Evil eval
- //-----------------------------------------------
-
- if ( $r['conf_evalphp'] )
- {
- $show = 1;
-
- eval( $r['conf_evalphp'] );
- }
-
- if( ! $show && ! IN_DEV )
- {
- return '';
- }
-
- switch( $r['conf_type'] )
- {
- case 'input':
- $form_element = $this->registry->output->formInput( $key, str_replace( "'", "'", $value ) );
- break;
-
- case 'textarea':
- $form_element = $this->registry->output->formTextarea( $key, $value, 45 );
- break;
-
- case 'editor':
- IPSText::getTextClass('bbcode')->parse_html = 1;
- IPSText::getTextClass('bbcode')->parse_nl2br = 1;
- IPSText::getTextClass('bbcode')->parse_smilies = 1;
- IPSText::getTextClass('bbcode')->parse_bbcode = 1;
- IPSText::getTextClass('bbcode')->parsing_section = 'global';
-
- if ( IPSText::getTextClass('editor')->method == 'rte' )
- {
- $value = IPSText::getTextClass('bbcode')->convertForRTE( IPSText::getTextClass('bbcode')->preDbParse( $value ) );
- }
- else
- {
- $value = IPSText::getTextClass('bbcode')->preEditParse( $value );
- }
-
- $form_element = IPSText::getTextClass('editor')->showEditor( $value, $key );
- $form_type = 'rte';
-
- break;
-
- case 'yes_no':
- $form_element = $this->registry->output->formYesNo( $key, $value );
- break;
-
- default:
-
- if ( $r['conf_extra'] )
- {
- if ( $r['conf_extra'] == '#show_forums#' )
- {
- //-----------------------------------------
- // Require the library
- // (Not a building with books)
- //-----------------------------------------
-
- require_once( IPSLib::getAppDir( 'forums' ) .'/sources/classes/forums/class_forums.php' );
- require_once( IPSLib::getAppDir( 'forums' ) .'/sources/classes/forums/admin_forum_functions.php' );
-
- $aff = new admin_forum_functions( $this->registry );
- $aff->forumsInit();
- $dropdown = $aff->adForumsForumList(1);
- }
- else if ( $r['conf_extra'] == '#show_groups#' )
- {
- $this->DB->build( array( 'select' => '*', 'from' => 'groups', 'order' => 'g_title ASC' ) );
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- if ( $row['g_access_cp'] )
- {
- $row['g_title'] .= $this->lang->words['setting_staff_tag'];
- }
-
- $dropdown[] = array( $row['g_id'], $row['g_title'] );
- }
- }
- else if ( $r['conf_extra'] == '#show_applications#' )
- {
- foreach( ipsRegistry::$applications as $app )
- {
- $dropdown[] = array( $app['app_directory'], $app['app_title'] );
- }
- }
- else if ( $r['conf_extra'] == '#show_skins#' )
- {
- $dropdown = $this->registry->output->generateSkinDropdown();
- }
- else
- {
- foreach( explode( "\n", $r['conf_extra'] ) as $l )
- {
- list ($k, $v) = explode( "=", $l );
- if ( $k != "" and $v != "" )
- {
- $dropdown[] = array( trim($k), trim($v) );
- }
- }
- }
- }
-
- if ( $r['conf_type'] == 'dropdown' )
- {
- $form_element = $this->registry->output->formDropdown( $key, $dropdown, $value );
- }
- else
- {
- $form_element = $this->registry->output->formMultiDropdown( $key, $dropdown, explode( ",", $value ) );
- }
-
- break;
- }
-
- $delete = " form_code}&do=setting_delete&id={$r['conf_id']}\");' title='key: {$r['conf_key']}'> ";
- $edit = "form_code}&do=setting_showedit&id={$r['conf_id']}' title='id: {$r['conf_id']}'> ";
-
- if ( $r['conf_protected'] and ! IN_DEV )
- {
- $delete = "";
- $edit = "";
- }
-
- if ( $r['conf_start_group'] )
- {
- $start = $this->html->settings_row_start_group( $r );
- }
- else
- {
- if ( ! in_array( $r['conf_id'], $this->in_group ) and ! $r['conf_end_group'] )
- {
- $start = $this->html->settings_row_start_normal();
- }
- }
-
- if ( $r['conf_end_group'] )
- {
- $end = $this->html->settings_row_end_group();
- }
- else
- {
- if ( ! in_array( $r['conf_id'], $this->in_group ) and ! $r['conf_start_group'] )
- {
- $end = $this->html->settings_row_end_normal();
- }
- }
-
- //-----------------------------------------------
- // Search hi-lite
- //-----------------------------------------------
-
- if ( $this->request['search'] )
- {
- $_replacements = array();
-
- preg_match_all( "/(&([a-zA-Z0-9]+);)/i", $r['conf_title'], $matches );
-
- if( count($matches[0]) )
- {
- for( $i=0, $cnt=count($matches[0]); $i <= $cnt; $i++ )
- {
- $r['conf_title'] = str_replace( $matches[0][$i], '{{{' . $i . '}}}', $r['conf_title'] );
- }
- }
-
- $r['conf_title'] = preg_replace( "/(".$this->request['search'].")/i", "\\1 ", $r['conf_title'] );
-
- if( count($matches[0]) )
- {
- for( $i=0, $cnt=count($matches); $i <= $cnt; $i++ )
- {
- $r['conf_title'] = str_replace( '{{{' . $i . '}}}', $matches[0][$i], $r['conf_title'] );
- }
- }
-
- /**
- * Ok this is just annoying....
- */
- $_did = 0;
- preg_match_all( "/(href=['\"].*?[\"'])/i", $r['conf_description'], $matches );
-
- if( count($matches[0]) )
- {
- for( $i=$_did, $cnt=count($matches[0]); $i <= $cnt; $i++ )
- {
- $r['conf_description'] = str_replace( $matches[0][$i], '{{{' . $i . '}}}', $r['conf_description'] );
-
- $_replacements[ $i ] = $matches[0][$i];
- $_did++;
- }
- }
-
- preg_match_all( "/(&([a-zA-Z0-9]+);)/i", $r['conf_description'], $matches );
-
- if( count($matches[0]) )
- {
- for( $i=$_did, $cnt=count($matches[0]); $i <= $cnt; $i++ )
- {
- $r['conf_description'] = str_replace( $matches[0][$i], '{{{' . $i . '}}}', $r['conf_description'] );
-
- $_replacements[ $i ] = $matches[0][$i];
- $_did++;
- }
- }
-
- $r['conf_description'] = preg_replace( "/(".$this->request['search'].")/i", "\\1 ", $r['conf_description'] );
-
- if( count($_replacements) )
- {
- foreach( $_replacements as $index => $val )
- {
- $r['conf_description'] = str_replace( '{{{' . $index . '}}}', $val, $r['conf_description'] );
- }
- }
- }
-
- $html .= $start . $this->html->settings_view_row( $r, $edit, $delete, $form_element, $revert_button, $form_type ) . $end;
-
- $this->key_array[] = preg_replace( "/\[\]$/", "", $key );
-
- $this->settings[ 'skin_app_url'] = $tempSkinUrl ;
-
- return $html;
- }
-
- /**
- * View setting groups
- *
- * @access private
- * @param string Application to default to
- * @return void
- */
- private function _settingsOverview( $start_app='' )
- {
- $content = "";
- $title = "";
- $settings = array();
- $start_app = ( $start_app ) ? $start_app : trim( $this->request['start_app'] );
-
- //-----------------------------------------
- // Get the groups
- //-----------------------------------------
-
- $this->_settingsGetGroups();
-
- //-----------------------------------------
- // Build settings..
- //-----------------------------------------
-
- foreach( $this->setting_groups as $i => $r )
- {
- $r['conf_title_app'] = ( $r['conf_title_app'] ) ? $r['conf_title_app'] : 'core';
- $r['conf_title_tab'] = ( $r['conf_title_tab'] ) ? $r['conf_title_tab'] : 'System';
- $r['conf_title_title'] = ( $r['conf_title_noshow'] ) ? $r['conf_title_title'] . $this->lang->words['s_ishidden'] : $r['conf_title_title'];
-
- $settings[ $r['conf_title_tab'] ][] = $r;
- }
-
- $this->registry->output->html .= $this->html->settings_titles_wrapper( $this->html->settings_titles_top_searchbox(), $settings, $start_app );
- }
-
- /**
- * Update setting values/ordering
- *
- * @access private
- * @param boolean Return afterwards?
- * @return void
- */
- private function _updateSettings( $donothing="" )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $bounceback = str_replace( '&', '&', $this->request['bounceback'] );
-
- //-----------------------------------------
- // Check
- //-----------------------------------------
-
- if ( ! $this->request['id'] and ! $this->request['search'] AND !$this->request['settings_save'] )
- {
- $this->registry->output->global_message = $this->lang->words['s_noid'];
- $this->_settingsOverview();
- return;
- }
-
- //--------------------------------------------
- // check...
- //--------------------------------------------
-
- $fields = explode( ",", trim($this->request['settings_save']) );
-
- if ( ! count($fields ) )
- {
- $this->registry->output->global_message = $this->lang->words['s_nofields'];
- $this->_viewSettings();
- return;
- }
-
- //--------------------------------------------
- // Get info from DB
- //--------------------------------------------
-
- $db_fields = array();
-
- $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => "conf_key IN ('" . implode( "','", $fields ) . "')" ) );
- $this->DB->execute();
-
- while ( $r = $this->DB->fetch() )
- {
- $db_fields[ $r['conf_key'] ] = $r;
- }
-
- foreach( $db_fields as $key => $data )
- {
- if ( $data['conf_evalphp'] )
- {
-// print htmlspecialchars($data['conf_evalphp']);exit;
- $save = 1;
- eval( $data['conf_evalphp'] );
- }
-
- if ( $data['conf_type'] == 'editor' )
- {
- IPSText::getTextClass('bbcode')->bypass_badwords = 1;
- IPSText::getTextClass('bbcode')->parse_smilies = 1;
- IPSText::getTextClass('bbcode')->parse_html = 1;
- IPSText::getTextClass('bbcode')->parse_bbcode = 1;
- IPSText::getTextClass('bbcode')->parse_nl2br = 1;
-
- //$_POST[ $key ] = IPSText::getTextClass('bbcode')->preDbParse( IPSText::getTextClass('editor')->processRawPost( $key ) );
-
- if( trim($_POST[ $key ]) == ' ' OR trim($_POST[ $key ]) == ' ' )
- {
- $_POST[ $key ] = '';
- }
- else
- {
- $_POST[ $key ] = IPSText::getTextClass('editor')->processRawPost( $key );
- }
- }
-
- $_POST[ $key ] = str_replace( "\r", "", $_POST[ $key ] );
-
-
- if ( ($_POST[ $key ] != $data['conf_default']) )
- {
- $value = str_replace( "'", "'", IPSText::stripslashes($_POST[ $key ]) );
- $value = $value == '' ? "{blank}" : $value;
-
- $this->DB->update( 'core_sys_conf_settings', array( 'conf_value' => $value ), 'conf_id=' . $data['conf_id'] );
- }
- else if( ( isset( $this->request[ $key ] ) && $this->request[ $key ] == '' ) || ( $this->request[ $key ] == $data['conf_default'] ) || $data['conf_value'] != '' )
- {
- $this->DB->update( 'core_sys_conf_settings', array( 'conf_value' => '' ), 'conf_id=' . $data['conf_id'] );
- }
- }
-
- $this->request['conf_group'] = $this->request['id'];
-
- $this->registry->output->global_message = $this->lang->words['s_updated'];
-
- $this->settingsRebuildCache();
-
- //-----------------------------------------
- // We're bouncing back (Boing boing)
- //-----------------------------------------
-
- if ( $bounceback )
- {
- $this->registry->output->silentRedirect( $bounceback );
- }
-
- //-----------------------------------------
- // Still here?
- //-----------------------------------------
-
- if ( ! $donothing )
- {
- $this->_viewSettings();
- }
- }
-
- /**
- * Save the settings form
- *
- * @access private
- * @param string [add|edit]
- * @return void
- */
- private function _settingSave($type='add')
- {
- if ( $type == 'edit' )
- {
- if ( ! $this->request['id'] )
- {
- $this->registry->output->global_message = $this->lang->words['s_noid'];
- $this->_settingForm();
- return;
- }
- }
-
- //--------------------------------------------
- // check...
- //--------------------------------------------
-
- $conf_group = $this->request['conf_newgroup'] ? $this->request['conf_newgroup'] : $this->request['conf_group'];
-
- $array = array( 'conf_title' => $this->request['conf_title'],
- 'conf_description' => IPSText::stripslashes( $_POST['conf_description'] ),
- 'conf_group' => $this->request['conf_group'],
- 'conf_type' => $this->request['conf_type'],
- 'conf_key' => $this->request['conf_key'],
- 'conf_value' => IPSText::stripslashes( $_POST['conf_value'] ),
- 'conf_default' => IPSText::stripslashes( $_POST['conf_default'] ),
- 'conf_extra' => IPSText::stripslashes( $_POST['conf_extra'] ),
- 'conf_evalphp' => IPSText::stripslashes( $_POST['conf_evalphp'] ),
- 'conf_protected' => intval( $this->request['conf_protected'] ),
- 'conf_position' => intval( $this->request['conf_position'] ),
- 'conf_start_group' => $this->request['conf_start_group'],
- 'conf_end_group' => $this->request['conf_end_group'],
- 'conf_add_cache' => intval( $this->request['conf_add_cache'] ),
- 'conf_keywords' => IPSText::stripslashes( $_POST['conf_keywords'] ),
- );
-
- if ( $type == 'add' )
- {
- $this->DB->insert( 'core_sys_conf_settings', $array );
- $this->registry->output->global_message = $this->lang->words['s_added2'];
- }
- else
- {
- $conf = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => 'conf_id=' . $this->request['id'] ) );
-
- $this->DB->update( 'core_sys_conf_settings', $array, 'conf_id=' . $this->request['id'] );
- $this->registry->output->global_message = $this->lang->words['s_edited2'];
-
- // Recount old group
- $this->_resynchGroup( $conf['conf_group'] );
- }
-
- //-----------------------------------------
- // Recount new group
- //-----------------------------------------
-
- if( $this->request['conf_group'] )
- {
- $this->_resynchGroup( $this->request['conf_group'] );
- }
-
- $this->settingsRebuildCache();
-
- $this->_viewSettings();
- }
-
- /**
- * Revert a setting to the default value
- *
- * @access private
- * @return void
- */
- private function _revertSettings()
- {
- $this->request[ 'id'] = intval($this->request['id'] );
-
- if ( ! $this->request['id'] )
- {
- $this->registry->output->global_message = $this->lang->words['s_noid'];
- $this->_settingForm();
- return;
- }
-
- $conf = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => 'conf_id=' . $this->request['id'] ) );
-
- //--------------------------------------------
- // Revert...
- //--------------------------------------------
-
- $this->DB->update( 'core_sys_conf_settings', array( 'conf_value' => '' ), 'conf_id=' . $this->request['id'] );
-
- $this->registry->output->global_message = $this->lang->words['s_revertedback'];
-
- $this->settingsRebuildCache();
-
- $this->_viewSettings();
- }
-
- /**
- * Delete a setting
- *
- * @access private
- * @return void
- */
- private function _deleteSettings()
- {
- if ( ! $this->request['id'] )
- {
- $this->registry->output->global_message = $this->lang->words['s_noid'];
- $this->_settingsOverview();
- return;
- }
-
- $conf = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => 'conf_id=' . $this->request['id'] ) );
-
- if ( ! $conf['conf_id'] )
- {
- $this->registry->output->global_message = $this->lang->words['s_noid'];
- $this->_settingsOverview();
- return;
- }
-
- //--------------------------------------------
- // Delete...
- //--------------------------------------------
-
- $this->DB->delete( 'core_sys_conf_settings', 'conf_id=' . $this->request['id'] );
-
- $this->DB->update( 'core_sys_settings_titles', 'conf_title_count=conf_title_count-1', 'conf_title_id=' . $conf['conf_group'], false, true );
-
- $this->registry->output->global_message = $this->lang->words['s_deleted'];
-
- $this->settingsRebuildCache();
-
- $this->_settingsOverview();
- }
-
-
- /**
- * Rebuild settings cache
- *
- * @access public
- * @return void
- */
- public function settingsRebuildCache()
- {
- $settings = array();
-
- $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => 'conf_add_cache=1' ) );
- $info = $this->DB->execute();
-
- while ( $r = $this->DB->fetch($info) )
- {
- $value = $r['conf_value'] != "" ? $r['conf_value'] : $r['conf_default'];
-
- if ( $value == '{blank}' )
- {
- $value = '';
- }
-
- $settings[ $r['conf_key'] ] = $value;
- }
-
- $this->cache->setCache( 'settings', $settings, array( 'array' => 1 ) );
- }
-
- /**
- * Grab all setting groups and store in an internal array
- *
- * @access private
- * @param boolean Pull all settings, not just visible ones
- * @return void
- */
- private function _settingsGetGroups( $ignoreInDev=false )
- {
- $this->setting_groups = array();
-
- if ( IN_DEV OR $ignoreInDev )
- {
- $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_settings_titles', 'order' => 'conf_title_title' ) );
- $this->DB->execute();
- }
- else
- {
- $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_settings_titles', 'where' => 'conf_title_noshow=0', 'order' => 'conf_title_title' ) );
- $this->DB->execute();
- }
-
- while( $r = $this->DB->fetch() )
- {
- $this->setting_groups[ $r['conf_title_id'] ] = $r;
- $this->setting_groups_by_key[ $r['conf_title_keyword'] ] = $r;
- }
- }
-
- /**
- * Make sure all titles have keywords set
- *
- * @access private
- * @return void
- */
- private function _settingsTitlesCheck()
- {
- //-----------------------------------------
- // Get 'em
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_settings_titles' ) );
- $outer = $this->DB->execute();
-
- while( $row = $this->DB->fetch( $outer ) )
- {
- if ( ! $row['conf_title_keyword'] )
- {
- $new_keyword = mb_strtolower( preg_replace( "#[^\d\w]#", "", $row['conf_title_title'] ) );
- $this->DB->update( 'core_sys_settings_titles', array( 'conf_title_keyword' => $new_keyword ), 'conf_title_id='.$row['conf_title_id'] );
- }
- }
- }
-
- /**
- * Import XML Settings on an app by app basis
- *
- * @access public
- * @return array Array of messages
- */
- public function importAllApps()
- {
- $message = array();
-
- foreach( ipsRegistry::$applications as $app_dir => $app_data )
- {
- $file = IPSLib::getAppDir( $app_dir ) . '/xml/' . $app_dir . '_settings.xml';
-
- if ( file_exists( $file ) )
- {
- $contents = file_get_contents( $file );
-
- $return = $this->_importXML( $contents, $app_dir );
-
- $message[] = $app_data['app_title'] . " " . sprintf( $this->lang->words['s_upandin'], $return['updatedCount'], $return['insertedCount'] );
-
- /* In dev time stamp? */
- if ( IN_DEV )
- {
- $cache = $this->caches['indev'];
- $cache['import']['settings'][ $app_dir ] = time();
- $this->cache->setCache( 'indev', $cache, array( 'donow' => 1, 'array' => 1 ) );
- }
- }
- }
-
- return $message;
- }
-
- /**
- * Import XML Settings
- *
- * @access private
- * @param string XML Data
- * @param string Application (should be set by XML file, however)
- * @param array Array of any known settings and their values
- * @return array array( 'insertedCount' => x, 'updatedCount' => x, 'updatedKeys' => array(..), 'insertedKeys' => array() )
- */
- private function _importXML( $content, $app='core', $knownSettings=array() )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $cur_settings = array();
- $updated = 0;
- $inserted = 0;
- $updatedKeys = array();
- $insertedKeys = array();
- $known = array();
-
- //-----------------------------------------
- // Get current settings.
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => 'conf_id, conf_key',
- 'from' => 'core_sys_conf_settings',
- 'order' => 'conf_id' ) );
-
- $this->DB->execute();
-
- while ( $r = $this->DB->fetch() )
- {
- $cur_settings[ $r['conf_key'] ] = $r['conf_id'];
- }
-
- //-----------------------------------------
- // Get current titles
- //-----------------------------------------
-
- $this->_settingsGetGroups( true );
-
- //-----------------------------------------
- // Get xml class
- //-----------------------------------------
-
- require_once( IPS_KERNEL_PATH.'classXML.php' );
-
- $xml = new classXML( IPS_DOC_CHAR_SET );
- $xml->loadXML( $content );
-
- //-----------------------------------------
- // Loop through and sort out settings...
- //-----------------------------------------
-
- foreach( $xml->fetchElements('setting') as $setting )
- {
- $entry = $xml->fetchElementsFromRecord( $setting );
-
- //-----------------------------------------
- // Is setting?
- //-----------------------------------------
-
- if ( ! $entry['conf_is_title'] )
- {
- unset( $entry['conf_is_title'] );
- unset( $entry['conf_help_key'] );
- unset( $entry['conf_id'] );
- $new_settings[] = $entry;
- }
-
- //-----------------------------------------
- // Is title?
- //-----------------------------------------
-
- else
- {
- $new_titles[] = $entry;
- }
- }
-
- //-----------------------------------------
- // Sort out titles...
- //-----------------------------------------
-
- if ( is_array( $new_titles ) and count( $new_titles ) )
- {
- foreach( $new_titles as $idx => $data )
- {
- if ( $data['conf_title_title'] AND $data['conf_title_keyword'] )
- {
- //-----------------------------------------
- // Get ID based on key
- //-----------------------------------------
-
- $conf_id = $this->setting_groups_by_key[ $data['conf_title_keyword'] ]['conf_title_id'];
-
- $save = array( 'conf_title_title' => $data['conf_title_title'],
- 'conf_title_desc' => $data['conf_title_desc'],
- 'conf_title_keyword' => $data['conf_title_keyword'],
- 'conf_title_tab' => $data['conf_title_tab'],
- 'conf_title_app' => $data['conf_title_app'] ? $data['conf_title_app'] : $app,
- 'conf_title_noshow' => $data['conf_title_noshow'] );
-
- //-----------------------------------------
- // Not got a row, insert first!
- //-----------------------------------------
-
- if ( ! $conf_id )
- {
- $this->DB->insert( 'core_sys_settings_titles', $save );
- $conf_id = $this->DB->getInsertId();
-
- }
- else
- {
- //-----------------------------------------
- // Update...
- //-----------------------------------------
-
- $this->DB->update( 'core_sys_settings_titles', $save, 'conf_title_id='.$conf_id );
- }
-
- //-----------------------------------------
- // Update settings cache
- //-----------------------------------------
-
- $save['conf_title_id'] = $conf_id;
- $this->setting_groups_by_key[ $save['conf_title_keyword'] ] = $save;
- $this->setting_groups[ $save['conf_title_id'] ] = $save;
-
- //-----------------------------------------
- // Remove need update...
- //-----------------------------------------
-
- $need_update[] = $conf_id;
- }
- }
- }
-
- //-----------------------------------------
- // Sort out settings
- //-----------------------------------------
-
- if ( is_array( $new_settings ) and count( $new_settings ) )
- {
- foreach( $new_settings as $idx => $data )
- {
- //-----------------------------------------
- // Insert known
- //-----------------------------------------
-
- $data['conf_value'] = '';
-
- if( is_array($knownSettings) AND count($knownSettings) )
- {
- if ( ! $data['conf_value'] AND ( in_array( $data['conf_key'], array_keys( $knownSettings ) ) ) )
- {
- $data['conf_value'] = $knownSettings[ $data['conf_key'] ];
- }
- }
-
- $data['conf_group'] = $this->setting_groups_by_key[ $data['conf_title_keyword'] ]['conf_title_id'];
-
- //-----------------------------------------
- // Remove from array
- //-----------------------------------------
-
- unset( $data['conf_title_keyword'] );
-
- if ( $cur_settings[ $data['conf_key'] ] )
- {
- //-----------------------------------------
- // Don't change the setting value
- //-----------------------------------------
- unset( $data['conf_value'] );
-
- //-----------------------------------------
- // Update
- //-----------------------------------------
-
- $this->DB->update( 'core_sys_conf_settings', $data, 'conf_id='.$cur_settings[ $data['conf_key'] ] );
- $updatedKeys[] = $data['conf_key'];
- $updated++;
- }
- else
- {
- //-----------------------------------------
- // INSERT
- //-----------------------------------------
-
- $this->DB->insert( 'core_sys_conf_settings', $data );
- $insertedKeys[] = $data['conf_key'];
- $inserted++;
- }
- }
- }
-
- //-----------------------------------------
- // Update group counts...
- //-----------------------------------------
-
- if ( count( $need_update ) )
- {
- foreach( $need_update as $i => $idx )
- {
- $conf = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count', 'from' => 'core_sys_conf_settings', 'where' => 'conf_group='.$idx ) );
-
- $count = intval($conf['count']);
-
- $this->DB->update( 'core_sys_settings_titles', array( 'conf_title_count' => $count ), 'conf_title_id='.$idx );
- }
- }
-
- //-----------------------------------------
- // Resync
- //-----------------------------------------
-
- $this->settingsRebuildCache();
-
- //-----------------------------------------
- // Return
- //-----------------------------------------
-
- return array( 'insertedCount' => $inserted,
- 'updatedCount' => $updated,
- 'insertedKeys' => $insertedKeys,
- 'updatedKeys' => $updatedKeys );
- }
-
- /**
- * Export all apps: Wrapper function really. Yes. It is.
- *
- * @access public
- * @return array Array of messages or errors
- */
- public function exportAllApps()
- {
- $messages = array();
- $errors = array();
-
- foreach( ipsRegistry::$applications as $app_dir => $app_data )
- {
- @unlink( IPSLib::getAppDir( $app_dir ) . '/xml/' . $app_dir . '_settings.xml' );
-
- if ( ! file_exists( IPSLib::getAppDir( $app_dir ) . '/xml' ) )
- {
- $errors[] = "Ошибка: " . IPSLib::getAppDir( $app_dir ) . "/xml/ не существует";
- continue;
- }
- else if ( ! IPSLib::isWritable( IPSLib::getAppDir( $app_dir ) . '/xml' ) )
- {
- if ( ! @chmod( IPSLib::isWritable( IPSLib::getAppDir( $app_dir ) . '/xml', 0755 ) ) )
- {
- $errors[] = "Ошибка: " . IPSLib::getAppDir( $app_dir ) . "/xml/ нет прав на запись";
- continue;
- }
- }
- else if ( file_exists( IPSLib::getAppDir( $app_dir ) . '/xml/' . $app_dir . '_settings.xml' ) AND ! IPSLib::isWritable( IPSLib::getAppDir( $app_dir ) . '/xml/' . $app_dir . '_settings.xml' ) )
- {
- $errors[] = "Ошибка: " . IPSLib::getAppDir( $app_dir ) . '/xml/' . $app_dir . "_settings.xml нет прав на запись";
- continue;
- }
-
- $this->_exportXML( $app_dir );
-
- $messages[] = "Настройки приложения " . $app_data['app_title'] . " экспортированы в директорию приложения";
-
- /* In dev time stamp? */
- if ( IN_DEV )
- {
- $cache = $this->caches['indev'];
- $cache['import']['settings'][ $app_dir ] = time();
- $this->cache->setCache( 'indev', $cache, array( 'donow' => 1, 'array' => 1 ) );
- }
- }
-
- return $errors ? $errors : $messages;
- }
-
-
- /**
- * Export all settings to XML (IN_DEV mode)
- *
- * @access private
- * @param string Application directory
- * @return boolean
- */
- private function _exportXML( $app_dir='core' )
- {
- //-----------------------------------------
- // Get setting groups
- //-----------------------------------------
-
- $this->_settingsGetGroups( true );
-
- //-----------------------------------------
- // Get xml class
- //-----------------------------------------
-
- require_once( IPS_KERNEL_PATH.'classXML.php' );
-
- $xml = new classXML( IPS_DOC_CHAR_SET );
-
- $xml->newXMLDocument();
- $xml->addElement( 'settingexport' );
- $xml->addElement( 'settinggroup', 'settingexport' );
-
- foreach( $this->setting_groups as $i => $roar )
- {
- //-----------------------------------------
- // App check?
- //-----------------------------------------
-
- if ( $app_dir != $roar['conf_title_app'] )
- {
- continue;
- }
-
- //-----------------------------------------
- // First, add in setting group title
- //-----------------------------------------
-
- $thisconf = array( 'conf_is_title' => 1,
- 'conf_title_keyword' => $roar['conf_title_keyword'],
- 'conf_title_title' => $roar['conf_title_title'],
- 'conf_title_desc' => $roar['conf_title_desc'],
- 'conf_title_tab' => $roar['conf_title_tab'],
- 'conf_title_app' => $roar['conf_title_app'] ? $roar['conf_title_app'] : $app_dir,
- 'conf_title_noshow' => $roar['conf_title_noshow'] );
-
- $xml->addElementAsRecord( 'settinggroup', 'setting', $thisconf );
-
- //-----------------------------------------
- // Get settings...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*',
- 'from' => 'core_sys_conf_settings',
- 'where' => "conf_group='{$roar['conf_title_id']}'",
- 'order' => 'conf_position, conf_title' ) );
-
- $this->DB->execute();
-
- while ( $r = $this->DB->fetch() )
- {
- //-----------------------------------------
- // Clean up...
- //-----------------------------------------
-
- unset( $r['conf_value'], $r['conf_id'] );
-
- $r['conf_title_keyword'] = $roar['conf_title_keyword'];
- $r['conf_is_title'] = 0;
-
- $xml->addElementAsRecord( 'settinggroup', 'setting', $r );
- }
- }
-
- //-----------------------------------------
- // Grab the XML document
- //-----------------------------------------
-
- $xmlData = $xml->fetchDocument();
-
- //-----------------------------------------
- // Attempt to write...
- //-----------------------------------------
-
- $file = IPSLib::getAppDir( $app_dir ) . '/xml/' . $app_dir . '_settings.xml';
-
- @unlink( $file );
- @file_put_contents( $file, $xmlData );
- }
-
+Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+class admin_core_tools_settings extends ipsCommand
+{
+ /**
+ * Key array
+ *
+ * @var array Array of keys
+ */
+ private $key_array = array();
+
+ /**
+ * Setting groups array
+ *
+ * @var array Array of setting groups
+ */
+ private $setting_groups = array();
+
+ /**
+ * Setting groups array mapping
+ *
+ * @var array Array of setting groups
+ */
+ private $setting_groups_by_key = array();
+
+ /**
+ * Skin object
+ * This is public so that the portal can access it
+ *
+ * @var object Skin templates
+ */
+ public $html;
+
+ /**
+ * Form code
+ * This is public so that the portal can access it
+ *
+ * @var string Form code
+ */
+ public $form_code;
+
+ /**
+ * Form code
+ * This is public so that the portal can access it
+ *
+ * @var string JS Form code
+ */
+ public $form_code_js;
+
+ /**
+ * Application to use
+ *
+ * @var string Application
+ */
+ private $_app;
+
+ /**
+ * Where to return to after save
+ *
+ * @var string URL to go to
+ */
+ public $return_after_save;
+
+ /**
+ * Breadcrumb url to use in place of the default
+ *
+ * @var string
+ */
+ public $base_nav_url;
+
+ /**
+ * Class entry point
+ *
+ * @param object Registry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ //-----------------------------------------
+ // Load language
+ //-----------------------------------------
+
+ $this->registry->class_localization->loadLanguageFile( array( 'admin_tools' ) );
+
+ $this->html = $this->registry->output->loadTemplate('cp_skin_tools');
+
+ $this->form_code = $this->html->form_code = 'module=tools§ion=settings';
+ $this->form_code_js = $this->html->form_code_js = 'module=tools§ion=settings';
+
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'settings_manage' );
+
+ switch( $this->request['do'] )
+ {
+ case 'settinggroup_resync':
+ $this->_resynchSettingGroup();
+ break;
+
+ case 'settinggroup_delete':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'settings_delete' );
+ $this->_deleteSettingGroup();
+ break;
+
+ case 'settinggroup_new':
+ $this->_settingGroupForm('add');
+ break;
+
+ case 'settinggroup_showedit':
+ $this->_settingGroupForm('edit');
+ break;
+
+ case 'settinggroup_add':
+ $this->_settingGroupSave('add');
+ break;
+
+ case 'settinggroup_edit':
+ $this->_settingGroupSave('edit');
+ break;
+
+ case 'settingnew':
+ $this->_settingForm('add');
+ break;
+
+ case 'setting_showedit':
+ $this->_settingForm('edit');
+ break;
+
+ case 'setting_add':
+ $this->_settingSave('add');
+ break;
+
+ case 'setting_edit':
+ $this->_settingSave('edit');
+ break;
+
+ case 'reorder':
+ $this->reorder();
+ break;
+
+ case 'setting_view':
+ $this->_viewSettings();
+ break;
+
+ case 'setting_delete':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'settings_delete' );
+ $this->_deleteSettings();
+ break;
+
+ case 'setting_revert':
+ $this->_revertSettings();
+ break;
+
+ case 'setting_update':
+ $this->_updateSettings();
+ break;
+
+ case 'findsetting':
+ $this->_findSettingGroup();
+ break;
+
+ case 'settings_do_import':
+ $this->importAllSettings();
+ break;
+ case 'settings_do_import_indev':
+ $this->importAllSettings(1);
+ break;
+
+ case 'MOD_export_setting':
+ $this->_exportSettingsGroup();
+ break;
+
+ case 'settingsExportApps':
+ $messages = $this->exportAllApps();
+
+ $this->registry->output->global_message = implode( " ", $messages );
+
+ $this->_settingsOverview();
+ break;
+
+ case 'settingsImportApps':
+ $messages = $this->importAllApps();
+
+ $this->registry->output->global_message = implode( " ", $messages );
+ $this->_settingsOverview();
+ break;
+ default:
+ $this->request['do'] = 'settingsview';
+ $this->_settingsOverview();
+ break;
+ }
+
+ //-----------------------------------------
+ // Pass to CP output hander
+ //-----------------------------------------
+
+ $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * Reorder the settings
+ *
+ * @return void
+ */
+ public function reorder()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
+ $ajax = new $classToLoad();
+
+ //-----------------------------------------
+ // Checks...
+ //-----------------------------------------
+
+ if( $this->registry->adminFunctions->checkSecurityKey( $this->request['md5check'], true ) === false )
+ {
+ $ajax->returnString( $this->lang->words['postform_badmd5'] );
+ exit();
+ }
+
+ //-----------------------------------------
+ // Save new position
+ //-----------------------------------------
+
+ $position = 1;
+
+ if( is_array($this->request['settings']) AND count($this->request['settings']) )
+ {
+ foreach( $this->request['settings'] as $this_id )
+ {
+ $this->DB->update( 'core_sys_conf_settings', array( 'conf_position' => $position ), 'conf_id=' . $this_id );
+
+ $position++;
+ }
+ }
+
+ $ajax->returnString( 'OK' );
+ exit();
+ }
+
+ /**
+ * Setting group export
+ *
+ * @return void
+ */
+ private function _exportSettingsGroup()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $this->request[ 'conf_group'] = intval($this->request['conf_group'] );
+
+ /* Got anything? */
+ if ( ! $this->request['conf_group'] )
+ {
+ return;
+ }
+
+ //-----------------------------------------
+ // Get setting groups
+ //-----------------------------------------
+
+ $this->_settingsGetGroups( true );
+
+ //-----------------------------------------
+ // Get xml class
+ //-----------------------------------------
+
+ require_once( IPS_KERNEL_PATH.'classXML.php' );
+
+ $xml = new classXML( IPS_DOC_CHAR_SET );
+
+ $xml->newXMLDocument();
+ $xml->addElement( 'settingexport' );
+ $xml->addElement( 'settinggroup', 'settingexport' );
+
+ foreach( $this->setting_groups as $i => $roar )
+ {
+ //-----------------------------------------
+ // App check?
+ //-----------------------------------------
+
+ if ( $this->request['conf_group'] != $roar['conf_title_id'] )
+ {
+ continue;
+ }
+
+ //-----------------------------------------
+ // First, add in setting group title
+ //-----------------------------------------
+
+ $thisconf = array( 'conf_is_title' => 1,
+ 'conf_title_keyword' => $roar['conf_title_keyword'],
+ 'conf_title_title' => $roar['conf_title_title'],
+ 'conf_title_desc' => $roar['conf_title_desc'],
+ 'conf_title_tab' => $roar['conf_title_tab'],
+ 'conf_title_app' => $roar['conf_title_app'] ? $roar['conf_title_app'] : 'core',
+ 'conf_title_noshow' => $roar['conf_title_noshow'] );
+
+ $xml->addElementAsRecord( 'settinggroup', 'setting', $thisconf );
+
+ //-----------------------------------------
+ // Get settings...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'core_sys_conf_settings',
+ 'where' => "conf_group='{$roar['conf_title_id']}'",
+ 'order' => 'conf_position, conf_title' ) );
+
+ $this->DB->execute();
+
+ while ( $r = $this->DB->fetch() )
+ {
+ //-----------------------------------------
+ // Clean up...
+ //-----------------------------------------
+
+ unset( $r['conf_value'], $r['conf_id'] );
+
+ $r['conf_title_keyword'] = $roar['conf_title_keyword'];
+ $r['conf_is_title'] = 0;
+
+ $xml->addElementAsRecord( 'settinggroup', 'setting', $r );
+ }
+ }
+
+ //-----------------------------------------
+ // Grab the XML document
+ //-----------------------------------------
+
+ $xmlData = $xml->fetchDocument();
+
+ $this->registry->output->showDownload( $xmlData, 'settingGroup_' . IPSText::makeSeoTitle( $thisconf['conf_title_title'] ) . '.xml', '', 0 );
+ }
+
+ /**
+ * Find setting group (don't rely on IDs)
+ *
+ * @return void
+ */
+ public function _findSettingGroup()
+ {
+ if ( ! $this->request['key'] )
+ {
+ $this->_settingsOverview();
+ }
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_settings_titles' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ if( ( $r['conf_title_keyword'] == $this->request['key'] ) OR mb_strtolower( str_replace( " ", "", trim( $r['conf_title_title'] ) ) ) == urldecode( trim( $this->request['key'] ) ) )
+ {
+ $this->registry->output->silentRedirect( $this->settings['base_url'] . '&' . $this->form_code . '&do=setting_view&conf_group=' . $r['conf_title_id'] );
+ break;
+ }
+ }
+
+ $this->_settingsOverview();
+ }
+
+ /**
+ * Import all settings
+ *
+ * @param boolean In development mode?
+ * @param boolean Return (ignore the var name)
+ * @param array Array of known setting values
+ * @return void
+ */
+ public function importAllSettings( $in_dev=0, $no_return=0, $known=array() )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $updated = 0;
+ $inserted = 0;
+ $need_update = array();
+
+ //-----------------------------------------
+ // Make sure we have titles
+ //-----------------------------------------
+
+ $this->_settingsTitlesCheck();
+
+ //-----------------------------------------
+ // INDEV?
+ //-----------------------------------------
+
+ if ( $in_dev )
+ {
+ $_FILES['FILE_UPLOAD']['name'] = '';
+ $this->request['file_location'] = IPSLib::getAppDir( $this->request['app_dir'] ) . '/xml/' . $this->request['app_dir'] . '_settings.xml';
+ }
+ else
+ {
+ $this->request['file_location'] = IPS_ROOT_PATH . $this->request['file_location'] ;
+ }
+
+ //-----------------------------------------
+ // Go for it
+ //-----------------------------------------
+
+ if ( $_FILES['FILE_UPLOAD']['name'] == "" or ! $_FILES['FILE_UPLOAD']['name'] or ($_FILES['FILE_UPLOAD']['name'] == "none") )
+ {
+ //-----------------------------------------
+ // check and load from server
+ //-----------------------------------------
+
+ if ( ! $this->request['file_location'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['s_nofile'];
+ $this->_settingsOverview();
+ return;
+ }
+
+ if ( ! file_exists( $this->request['file_location'] ) )
+ {
+ $this->registry->output->global_message = sprintf( $this->lang->words['s_noopen'], $this->request['file_location'] );
+ $this->_settingsOverview();
+ return;
+ }
+
+ if ( preg_match( "#\.gz$#", $this->request['file_location'] ) )
+ {
+ if ( $FH = @gzopen( $this->request['file_location'], 'rb' ) )
+ {
+ while ( ! @gzeof( $FH ) )
+ {
+ $content .= @gzread( $FH, 1024 );
+ }
+
+ @gzclose( $FH );
+ }
+ }
+ else
+ {
+ if ( $FH = @fopen( $this->request['file_location'], 'rb' ) )
+ {
+ $content = @fread( $FH, filesize($this->request['file_location']) );
+ @fclose( $FH );
+ }
+ }
+ }
+ else
+ {
+ //-----------------------------------------
+ // Get uploaded schtuff
+ //-----------------------------------------
+
+ $tmp_name = $_FILES['FILE_UPLOAD']['name'];
+ $tmp_name = preg_replace( "#\.gz$#", "", $tmp_name );
+
+ $content = ipsRegistry::getClass('adminFunctions')->importXml( $tmp_name );
+ }
+
+ if ( ! $content )
+ {
+ $this->registry->output->global_message = $this->lang->words['s_nofile'];
+ $this->_settingsOverview();
+ return;
+ }
+
+ $return = $this->_importXML( $content, $this->request['app_dir'], $known );
+
+ if ( $no_return )
+ {
+ $this->registry->output->global_message = sprintf( $this->lang->words['s_upandin'], $return['updatedCount'], $return['insertedCount'] );
+ return TRUE;
+ }
+ else
+ {
+ $this->registry->output->global_message = sprintf( $this->lang->words['s_upandin'], $return['updatedCount'], $return['insertedCount'] );
+ $this->_settingsOverview();
+ return;
+ }
+ }
+
+ /**
+ * Delete a setting group
+ *
+ * @return void
+ */
+ private function _deleteSettingGroup()
+ {
+ if ( $this->request['id'] )
+ {
+ $conf = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count', 'from' => 'core_sys_conf_settings', 'where' => 'conf_group=' . $this->request['id'] ) );
+
+ $count = intval($conf['count']);
+
+ if ( $count > 0 )
+ {
+ $this->registry->output->global_message = $this->lang->words['s_cantremove'];
+ }
+ else
+ {
+ $this->DB->delete( 'core_sys_settings_titles', 'conf_title_id=' . $this->request['id'] );
+
+ $this->registry->output->global_message = $this->lang->words['s_removed'];
+ }
+
+ }
+
+ $this->settingsRebuildCache();
+
+ $this->_settingsOverview();
+ }
+
+ /**
+ * Resynchronize settings in a group
+ *
+ * @return void
+ */
+ private function _resynchSettingGroup()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $this->request['id'] = intval( $this->request['id'] );
+
+ //-----------------------------------------
+ // Doit...
+ //-----------------------------------------
+
+ $this->_resynchGroup( $this->request['id'] );
+
+ $this->registry->output->global_message = $this->lang->words['s_recounted'];
+
+ //-----------------------------------------
+ // Get conf title details
+ //-----------------------------------------
+
+ $conf_group = $this->DB->buildAndFetch( array( 'select' => 'conf_title_tab',
+ 'from' => 'core_sys_settings_titles',
+ 'where' => 'conf_title_id='.$this->request['id'] ) );
+
+ $this->_settingsOverview( $conf_group['conf_title_tab'] );
+ }
+
+ /**
+ * Does the resync
+ *
+ * @param integer Group id
+ * @return void
+ */
+ private function _resynchGroup( $id )
+ {
+ if ( $id )
+ {
+ $conf = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count', 'from' => 'core_sys_conf_settings', 'where' => 'conf_group='.$id ) );
+
+ $count = intval($conf['count']);
+
+ $this->DB->update( 'core_sys_settings_titles', array( 'conf_title_count' => $count ), 'conf_title_id=' . $id );
+ }
+ }
+
+ /**
+ * Form to add/edit a setting group
+ *
+ * @param string [add|edit]
+ * @return void
+ */
+ private function _settingGroupForm( $type='add' )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $conf_title_id = intval( $this->request['id'] );
+ $form = array();
+ $apps = array( 0 => array( 'core', $this->lang->words['s_global_dd'] ) );
+
+ //-----------------------------------------
+ // Build applications drop down
+ //-----------------------------------------
+
+ foreach( ipsRegistry::$applications as $app_dir => $app_data )
+ {
+ $apps[] = array( $app_dir, $app_data['app_title'] );
+ }
+
+ //-----------------------------------------
+ // Type
+ //-----------------------------------------
+
+ if ( $type == 'add' )
+ {
+ $formcode = 'settinggroup_add';
+ $title = $this->lang->words['s_createnew'];
+ $button = $this->lang->words['s_createnew'];
+ }
+ else
+ {
+ $conf = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'core_sys_settings_titles',
+ 'where' => 'conf_title_id='.$conf_title_id ) );
+
+ if ( ! $conf['conf_title_id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['s_noid'];
+ $this->_settingsOverview();
+ }
+
+ $formcode = 'settinggroup_edit';
+ $title = sprintf($this->lang->words['s_editsetting'], $conf['conf_title'] );
+ $button = $this->lang->words['s_savechanges'];
+ }
+
+ //-----------------------------------------
+ // Form elements
+ //-----------------------------------------
+
+ $form['conf_title_title'] = $this->registry->output->formInput( 'conf_title_title', $_POST['conf_title_title'] ? $_POST['conf_title_title'] : $conf['conf_title_title'] );
+ $form['conf_title_desc'] = $this->registry->output->formTextarea( 'conf_title_desc', $_POST['conf_title_desc'] ? $_POST['conf_title_desc'] : $conf['conf_title_desc'] );
+ $form['conf_title_app'] = $this->registry->output->formDropdown( 'conf_title_app', $apps, $_POST['conf_title_app'] ? $_POST['conf_title_app'] : $conf['conf_title_app'] );
+ $form['conf_title_tab'] = $this->registry->output->formInput( 'conf_title_tab', $_POST['conf_title_tab'] ? $_POST['conf_title_tab'] : $conf['conf_title_tab'] );
+
+ //if ( IN_DEV )
+ //{
+ $form['conf_title_keyword'] = $this->registry->output->formInput( 'conf_title_keyword', $_POST['conf_title_keyword'] ? $_POST['conf_title_keyword'] : $conf['conf_title_keyword'] );
+ $form['conf_title_noshow'] = $this->registry->output->formYesNo( 'conf_title_noshow', $_POST['conf_title_noshow'] ? $_POST['conf_title_noshow'] : $conf['conf_title_noshow'] );
+ //}
+
+ $this->registry->output->html .= $this->html->settings_title_form( $form, $title, $formcode, $button );
+ }
+
+ /**
+ * Save a setting group
+ *
+ * @param string [add|edit]
+ * @return void
+ */
+ private function _settingGroupSave($type='add')
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ if ( $type == 'edit' )
+ {
+ if ( ! $this->request['id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['s_noid'];
+ $this->_settingForm();
+ return;
+ }
+ }
+
+ if( ! $this->request['conf_title_title'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['s_notitle'];
+ $this->_settingGroupForm( $type );
+ return;
+ }
+
+ if( ! $this->request['conf_title_keyword'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['s_nokeyword'];
+ $this->_settingGroupForm( $type );
+ return;
+ }
+
+ //--------------------------------------------
+ // Check...
+ //--------------------------------------------
+
+ $array = array( 'conf_title_title' => $this->request['conf_title_title'],
+ 'conf_title_desc' => IPSText::safeslashes( $_POST['conf_title_desc'] ),
+ 'conf_title_keyword' => IPSText::safeslashes( $_POST['conf_title_keyword'] ),
+ 'conf_title_noshow' => $this->request['conf_title_noshow'],
+ 'conf_title_app' => trim( $this->request['conf_title_app'] ),
+ 'conf_title_tab' => trim( $this->request['conf_title_tab'] )
+ );
+
+
+ if ( $type == 'add' )
+ {
+ $this->DB->insert( 'core_sys_settings_titles', $array );
+ $this->registry->output->global_message = $this->lang->words['s_added'];
+ }
+ else
+ {
+ $this->DB->update( 'core_sys_settings_titles', $array, 'conf_title_id=' . $this->request['id'] );
+ $this->registry->output->global_message = $this->lang->words['s_edited'];
+ }
+
+ $this->settingsRebuildCache();
+
+ $this->_settingsOverview();
+ }
+
+ /**
+ * Form to add/edit a setting
+ *
+ * @param string [add|edit]
+ * @return void
+ */
+ private function _settingForm( $type='add' )
+ {
+ if ( $type == 'add' )
+ {
+ $formcode = 'setting_add';
+ $title = $this->lang->words['s_createnewtitle'];
+ $button = $this->lang->words['s_createnewtitle'];
+ $conf = array( 'conf_group' => $this->request['conf_group'], 'conf_add_cache' => 1 );
+
+ if ( IN_DEV )
+ {
+ $conf['conf_protected'] = 1;
+ }
+
+ if ( $this->request['conf_group'] )
+ {
+ $max = $this->DB->buildAndFetch( array( 'select' => 'max(conf_position) as max', 'from' => 'core_sys_conf_settings', 'where' => 'conf_group=' . $this->request['conf_group'] ) );
+ }
+ else
+ {
+ $max = $this->DB->buildAndFetch( array( 'select' => 'max(conf_position) as max', 'from' => 'core_sys_conf_settings' ) );
+ }
+
+ $conf['conf_position'] = $max['max'] + 1;
+ }
+ else
+ {
+ $conf = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => 'conf_id=' . $this->request['id'] ) );
+
+ if ( ! $conf['conf_id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['s_noid'];
+ $this->_settingsOverview();
+ }
+
+ $formcode = 'setting_edit';
+ $title = sprintf($this->lang->words['s_editsetting'], $conf['conf_title'] );
+ $button = $this->lang->words['s_savechanges'];
+ }
+
+ //-----------------------------------------
+ // Get groups
+ //-----------------------------------------
+
+ $this->_settingsGetGroups();
+
+ $groups = array();
+
+ foreach( $this->setting_groups as $i => $r )
+ {
+ $groups[] = array( $r['conf_title_id'], $r['conf_title_title'] );
+ }
+
+ //-----------------------------------------
+ // Type
+ //-----------------------------------------
+
+ $types = array(
+ array( 'input' , $this->lang->words['s_input'] ),
+ array( 'dropdown' , $this->lang->words['s_dropdown'] ),
+ array( 'yes_no' , $this->lang->words['s_yes_no'] ),
+ array( 'textarea' , $this->lang->words['s_textarea'] ),
+ array( 'editor' , $this->lang->words['s_editor'] ),
+ array( 'multi' , $this->lang->words['s_multi'] ),
+ array( 'name_autocomplete' , $this->lang->words['s_name_autocomplete'] ),
+ );
+
+
+
+ $form['conf_title'] = $this->registry->output->formInput( 'conf_title' , $_POST['conf_title'] ? $_POST['conf_title'] : $conf['conf_title'] );
+ $form['conf_position'] = $this->registry->output->formInput( 'conf_position' , $_POST['conf_position'] ? $_POST['conf_position'] : $conf['conf_position'] );
+ $form['conf_description'] = $this->registry->output->formTextarea( 'conf_description', $_POST['conf_description'] ? $_POST['conf_description'] : $conf['conf_description'] );
+ $form['conf_group'] = $this->registry->output->formDropdown( 'conf_group' , $groups, $_POST['conf_group'] ? $_POST['conf_group'] : $conf['conf_group'] );
+ $form['conf_type'] = $this->registry->output->formDropdown( 'conf_type' , $types, $_POST['conf_type'] ? $_POST['conf_type'] : $conf['conf_type'] );
+ $form['conf_key'] = $this->registry->output->formInput( 'conf_key' , $_POST['conf_key'] ? $_POST['conf_key'] : $conf['conf_key'] );
+ $form['conf_value'] = $this->registry->output->formTextarea( 'conf_value' , $_POST['conf_value'] ? $_POST['conf_value'] : $conf['conf_value'] );
+ $form['conf_default'] = $this->registry->output->formTextarea( 'conf_default' , $_POST['conf_default'] ? $_POST['conf_default'] : $conf['conf_default'] );
+ $form['conf_extra'] = $this->registry->output->formTextarea( 'conf_extra' , $_POST['conf_extra'] ? $_POST['conf_extra'] : $conf['conf_extra'] );
+ $form['conf_evalphp'] = $this->registry->output->formTextarea( 'conf_evalphp' , $_POST['conf_evalphp'] ? $_POST['conf_evalphp'] : $conf['conf_evalphp'] );
+ $form['conf_keywords'] = $this->registry->output->formTextarea( 'conf_keywords' , $_POST['conf_keywords'] ? $_POST['conf_keywords'] : $conf['conf_keywords'] );
+ $form['conf_start_group'] = $this->registry->output->formInput( 'conf_start_group', $_POST['conf_start_group'] ? $_POST['conf_start_group'] : $conf['conf_start_group'] );
+ $form['conf_add_cache'] = $this->registry->output->formYesNo( 'conf_add_cache', $_POST['conf_add_cache'] ? $_POST['conf_add_cache'] : $conf['conf_add_cache'] );
+
+ if ( IN_DEV )
+ {
+ $form['conf_protected'] = $this->registry->output->formYesNo( 'conf_protected', $_POST['conf_protected'] ? $_POST['conf_protected'] : $conf['conf_protected'] );
+ }
+
+
+
+ //-----------------------------------------
+ // start form
+ //-----------------------------------------
+
+ $this->registry->output->html .= $this->html->settings_form( $form, $title, $formcode, $button );
+ }
+
+ /**
+ * View all settings (form) in a group
+ * This is public so that portal can access it
+ *
+ * @return void
+ */
+ public function _viewSettings()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $search_key = trim( $this->request['search'] );
+ $conf_group = trim( $this->request['conf_group'] );
+ $conf_titles = array();
+ $last_conf_id = -1;
+ $start = intval( $this->request['st'] );
+ $end = 150;
+ $get_by_key = isset( $this->request['conf_title_keyword'] ) ? $this->request['conf_title_keyword'] : '';
+
+ //-----------------------------------------
+ // Get settings in group
+ //-----------------------------------------
+
+ $this->_settingsGetGroups( ( $get_by_key ) ? TRUE : FALSE );
+
+ //-----------------------------------------
+ // Grabbing by key?
+ //-----------------------------------------
+
+ if( $get_by_key )
+ {
+ $data = $this->DB->buildAndFetch( array(
+ 'select' => 'conf_title_id, conf_title_keyword, conf_title_title',
+ 'from' => 'core_sys_settings_titles',
+ 'where' => "conf_title_keyword='{$get_by_key}'"
+ ) );
+
+ $this->request['conf_group'] = $data['conf_title_id'] ;
+ $conf_group = $data['conf_title_id'];
+ $this->request['groupHelpKey'] = $data['conf_title_keyword'];
+ }
+
+ //-----------------------------------------
+ // check...
+ //-----------------------------------------
+
+ if( !$conf_group and !$search_key )
+ {
+ $this->registry->output->global_message = $this->lang->words['s_nogroup'];
+ $this->_settingsOverview();
+ return;
+ }
+
+ //--------------------------------------
+ // Redirect to Nexus for ads
+ //--------------------------------------
+
+ if ( $this->setting_groups[ $conf_group ]['conf_title_keyword'] == 'adcodeintegration' and IPSLib::appIsInstalled('nexus') )
+ {
+ $this->registry->output->silentRedirect( $this->settings['base_url'] . 'app=nexus&module=promotion§ion=advertisements' );
+ }
+
+ //-----------------------------------------
+ // Pagination
+ //-----------------------------------------
+
+ $pages = $this->registry->output->generatePagination( array(
+ 'totalItems' => $this->setting_groups[$conf_group]['conf_title_count'],
+ 'itemsPerPage' => $end,
+ 'currentStartValue' => $start,
+ 'baseUrl' => $this->settings['base_url'] . "&{$this->form_code}&&search={$search_key}",
+ ) );
+
+
+ //-----------------------------------------
+ // Did we search?
+ //-----------------------------------------
+
+ if( $search_key )
+ {
+ $keywords = mb_strtolower($search_key);
+ $whereExtra = $conf_group ? " AND c.conf_group={$conf_group}" : '';
+
+ $this->DB->build( array(
+ 'select' => 'c.*',
+ 'from' => array( 'core_sys_conf_settings' => 'c' ),
+ 'where' => '(' . $this->DB->buildLower('c.conf_title') . " LIKE '%{$keywords}%' OR " . $this->DB->buildLower('c.conf_description') . " LIKE '%{$keywords}%' OR " . $this->DB->buildLower('c.conf_keywords') . " LIKE '%{$keywords}%')" . $whereExtra,
+ 'order' => 'c.conf_title',
+ 'limit' => array( $start, $end ),
+ 'add_join' => array(
+ array(
+ 'select' => 'ct.conf_title_id, ct.conf_title_noshow, ct.conf_title_title, ct.conf_title_tab',
+ 'from' => array( 'core_sys_settings_titles' => 'ct' ),
+ 'where' => 'ct.conf_title_id=c.conf_group',
+ 'type' => 'left'
+ )
+ )
+ ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $r['conf_start_group'] = "";
+ $r['conf_description'] .= ' ' . $this->lang->words['conf_desc_search'] . "" . $r['conf_title_title'] . " ";
+ $conf_entry[ $r['conf_id'] ] = $r;
+ }
+
+ if( ! count( $conf_entry ) )
+ {
+ $this->registry->output->global_message = sprintf( $this->lang->words['s_nomatches'], $keywords );
+ $this->_settingsOverview();
+ return;
+ }
+
+ $title = sprintf( $this->lang->words['s_searchedfor'], $keywords );
+ $tab = '';
+ }
+
+ //-----------------------------------------
+ // Or not...
+ //-----------------------------------------
+
+ else
+ {
+ $this->DB->build( array(
+ 'select' => '*',
+ 'from' => 'core_sys_conf_settings',
+ 'where' => "conf_group='{$conf_group}'",
+ 'order' => 'conf_position, conf_title',
+ 'limit' => array( $start,$end )
+ ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $conf_entry[ $r['conf_id'] ] = $r;
+ }
+
+ $title = $this->setting_groups[$conf_group]['conf_title_title'];
+ $tab = IPSText::md5Clean( $this->setting_groups[$conf_group]['conf_title_tab'] );
+ $this->request['groupHelpKey'] = $this->setting_groups[ $conf_group ]['conf_title_keyword'];
+ }
+
+ //-----------------------------------------
+ // Start output
+ //-----------------------------------------
+
+ $content = "";
+
+ if( is_array( $conf_entry ) and count( $conf_entry ) )
+ {
+ foreach( $conf_entry as $id => $r )
+ {
+ $content .= $this->_processSettingEntry( $r );
+ }
+ }
+
+ if( ! $search_key AND ! $get_by_key )
+ {
+ $searchbutton = 1;
+ }
+
+ /* Navigation */
+ if( $this->base_nav_url )
+ {
+ $this->registry->output->extra_nav[] = array( $this->base_nav_url, ipsRegistry::$applications[ $this->setting_groups[$conf_group]['conf_title_app'] ]['app_title'] );
+ $this->registry->output->extra_nav[] = array( "", $title );
+
+ }
+ else if( $tab )
+ {
+ $this->registry->output->extra_nav[] = array( "{$this->settings['base_url']}{$this->form_code}&_dtab={$tab}", ipsRegistry::$applications[ $this->setting_groups[$conf_group]['conf_title_app'] ]['app_title'] );
+ $this->registry->output->extra_nav[] = array( "{$this->settings['base_url']}{$this->form_code}&do=setting_view&conf_group={$conf_group}", $title );
+ }
+
+ /* Output */
+ $this->registry->output->html .= $this->html->settings_view_wrapper( $title, $content, $searchbutton, $this->return_after_save );
+ $this->registry->output->html = str_replace( '', " ", $this->registry->output->html );
+ }
+
+ /**
+ * Process an individual setting for display
+ *
+ * @param array Setting record
+ * @return void
+ */
+ private function _processSettingEntry($r)
+ {
+ $tempSkinUrl = $this->settings['skin_app_url'];
+ $this->settings[ 'skin_app_url'] = $this->settings['_original_base_url'] . '/' . CP_DIRECTORY . '/applications/core/skin_cp/' ;
+
+ $form_element = "";
+ $form_type = 'normal';
+ $dropdown = array();
+ $start = "";
+ $revert_button = "";
+
+ $key = $r['conf_key'];
+ $value = $r['conf_value'] != "" ? $r['conf_value'] : $r['conf_default'];
+ $value = $value == "{blank}" ? '' : $value;
+
+ $show = 1;
+
+ //-----------------------------------------------
+ // Default?
+ //-----------------------------------------------
+
+ $css = "";
+
+ if ( $r['conf_value'] != "" and ( $r['conf_value'] != $r['conf_default'] ) )
+ {
+ $revert_button = "form_code}&do=setting_revert&id={$r['conf_id']}&conf_group={$r['conf_group']}&search=" . $this->request['search'] . "' title='{$this->lang->words['s_revertback']}'> ";
+ }
+
+ //-----------------------------------------------
+ // Evil eval
+ //-----------------------------------------------
+
+ if ( $r['conf_evalphp'] )
+ {
+ $show = 1;
+
+ eval( $r['conf_evalphp'] );
+ }
+
+ if( ! $show && ! IN_DEV )
+ {
+ return '';
+ }
+
+ switch( $r['conf_type'] )
+ {
+ case 'input':
+ $form_element = $this->registry->output->formInput( $key, str_replace( "'", "'", $value ) );
+ break;
+
+ case 'textarea':
+ $form_element = $this->registry->output->formTextarea( $key, $value, 45 );
+ break;
+
+ case 'editor':
+ IPSText::getTextClass('bbcode')->parse_html = 1;
+ IPSText::getTextClass('bbcode')->parse_nl2br = 1;
+ IPSText::getTextClass('bbcode')->parse_smilies = 1;
+ IPSText::getTextClass('bbcode')->parse_bbcode = 1;
+ IPSText::getTextClass('bbcode')->parsing_section = 'global';
+
+ if ( IPSText::getTextClass('editor')->method == 'rte' )
+ {
+ $value = IPSText::getTextClass('bbcode')->convertForRTE( IPSText::getTextClass('bbcode')->preDbParse( $value ) );
+ }
+ else
+ {
+ $value = IPSText::getTextClass('bbcode')->preEditParse( $value );
+ }
+
+ $form_element = IPSText::getTextClass('editor')->showEditor( $value, $key );
+ $form_type = 'rte';
+
+ break;
+
+ case 'yes_no':
+ $form_element = $this->registry->output->formYesNo( $key, $value );
+ break;
+
+ case 'name_autocomplete':
+ $form_element = $this->html->nameAutoCompleteField( $key, $value );
+ break;
+
+ default:
+
+ if ( $r['conf_extra'] )
+ {
+ if ( $r['conf_extra'] == '#show_forums#' )
+ {
+ //-----------------------------------------
+ // Require the library
+ // (Not a building with books)
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) .'/sources/classes/forums/class_forums.php', 'class_forums', 'forums' );
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) .'/sources/classes/forums/admin_forum_functions.php', 'admin_forum_functions', 'forums' );
+
+ $aff = new $classToLoad( $this->registry );
+ $aff->forumsInit();
+ $dropdown = $aff->adForumsForumList(1);
+ }
+ else if ( $r['conf_extra'] == '#show_groups#' )
+ {
+ $this->DB->build( array( 'select' => '*', 'from' => 'groups', 'order' => 'g_title ASC' ) );
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ if ( $row['g_access_cp'] )
+ {
+ $row['g_title'] .= $this->lang->words['setting_staff_tag'];
+ }
+
+ $dropdown[] = array( $row['g_id'], $row['g_title'] );
+ }
+ }
+ else if ( $r['conf_extra'] == '#show_applications#' )
+ {
+ foreach( ipsRegistry::$applications as $app )
+ {
+ $dropdown[] = array( $app['app_directory'], $app['app_title'] );
+ }
+ }
+ else if ( $r['conf_extra'] == '#show_skins#' )
+ {
+ $dropdown = $this->registry->output->generateSkinDropdown();
+ }
+ else
+ {
+ foreach( explode( "\n", $r['conf_extra'] ) as $l )
+ {
+ list ($k, $v) = explode( "=", $l );
+ if ( $k != "" and $v != "" )
+ {
+ $dropdown[] = array( trim($k), trim($v) );
+ }
+ }
+ }
+ }
+
+ if ( $r['conf_type'] == 'dropdown' )
+ {
+ $form_element = $this->registry->output->formDropdown( $key, $dropdown, $value );
+ }
+ else
+ {
+ $form_element = $this->registry->output->formMultiDropdown( $key, $dropdown, explode( ",", $value ) );
+ }
+
+ break;
+ }
+
+ $delete = " form_code}&do=setting_delete&id={$r['conf_id']}\");' title='key: {$r['conf_key']}'> ";
+ $edit = "form_code}&do=setting_showedit&id={$r['conf_id']}' title='id: {$r['conf_id']}'> ";
+
+ if ( $r['conf_protected'] and ! IN_DEV )
+ {
+ $delete = "";
+ $edit = "";
+ }
+
+ if ( $r['conf_start_group'] )
+ {
+ $start = $this->html->settings_row_start_group( $r );
+ }
+
+ $r['conf_description'] = str_replace( '{ACP_URL}', $this->settings['_base_url'], $r['conf_description'] );
+
+ //-----------------------------------------------
+ // Search hi-lite
+ //-----------------------------------------------
+
+ if ( $this->request['search'] )
+ {
+ $_replacements = array();
+
+ preg_match_all( "/(&([a-zA-Z0-9]+);)/i", $r['conf_title'], $matches );
+
+ if( count($matches[0]) )
+ {
+ for( $i=0, $cnt=count($matches[0]); $i <= $cnt; $i++ )
+ {
+ $r['conf_title'] = str_replace( $matches[0][$i], '{{{' . $i . '}}}', $r['conf_title'] );
+ }
+ }
+
+ $r['conf_title'] = preg_replace( "/(".$this->request['search'].")/i", "\\1 ", $r['conf_title'] );
+
+ if( count($matches[0]) )
+ {
+ for( $i=0, $cnt=count($matches); $i <= $cnt; $i++ )
+ {
+ $r['conf_title'] = str_replace( '{{{' . $i . '}}}', $matches[0][$i], $r['conf_title'] );
+ }
+ }
+
+ /**
+ * Ok this is just annoying....
+ */
+ $_did = 0;
+ preg_match_all( "/(href=['\"].*?[\"'])/i", $r['conf_description'], $matches );
+
+ if( count($matches[0]) )
+ {
+ for( $i=$_did, $cnt=count($matches[0]); $i <= $cnt; $i++ )
+ {
+ $r['conf_description'] = str_replace( $matches[0][$i], '{{{' . $i . '}}}', $r['conf_description'] );
+
+ $_replacements[ $i ] = $matches[0][$i];
+ $_did++;
+ }
+ }
+
+ preg_match_all( "/(&([a-zA-Z0-9]+);)/i", $r['conf_description'], $matches );
+
+ if( count($matches[0]) )
+ {
+ for( $i=$_did, $cnt=count($matches[0]); $i <= $cnt; $i++ )
+ {
+ $r['conf_description'] = str_replace( $matches[0][$i], '{{{' . $i . '}}}', $r['conf_description'] );
+
+ $_replacements[ $i ] = $matches[0][$i];
+ $_did++;
+ }
+ }
+
+ $r['conf_description'] = preg_replace( "/(".$this->request['search'].")/i", "\\1 ", $r['conf_description'] );
+
+ if( count($_replacements) )
+ {
+ foreach( $_replacements as $index => $val )
+ {
+ $r['conf_description'] = str_replace( '{{{' . $index . '}}}', $val, $r['conf_description'] );
+ }
+ }
+ }
+
+ $html .= $start . $this->html->settings_view_row( $r, $edit, $delete, $form_element, $revert_button, $form_type );
+
+ $this->key_array[] = preg_replace( "/\[\]$/", "", $key );
+
+ $this->settings[ 'skin_app_url'] = $tempSkinUrl ;
+
+ return $html;
+ }
+
+ /**
+ * View setting groups
+ *
+ * @param string Application to default to
+ * @return void
+ */
+ private function _settingsOverview( $start_app='' )
+ {
+ $content = "";
+ $title = "";
+ $settings = array();
+ $start_app = ( $start_app ) ? $start_app : trim( $this->request['start_app'] );
+
+ //-----------------------------------------
+ // Get the groups
+ //-----------------------------------------
+
+ $this->_settingsGetGroups();
+
+ //-----------------------------------------
+ // Build settings..
+ //-----------------------------------------
+
+ foreach( $this->setting_groups as $i => $r )
+ {
+ $r['conf_title_app'] = ( $r['conf_title_app'] ) ? $r['conf_title_app'] : 'core';
+ $r['conf_title_tab'] = ( $r['conf_title_tab'] ) ? $r['conf_title_tab'] : 'System';
+ $r['conf_title_title'] = ( $r['conf_title_noshow'] ) ? $r['conf_title_title'] . $this->lang->words['s_ishidden'] : $r['conf_title_title'];
+
+ $settings[ $r['conf_title_tab'] ][] = $r;
+ }
+
+ $this->registry->output->html .= $this->html->settings_titles_wrapper( $this->html->settings_titles_top_searchbox(), $settings, $start_app );
+ }
+
+ /**
+ * Update setting values/ordering
+ *
+ * @param boolean Return afterwards?
+ * @return void
+ */
+ private function _updateSettings( $donothing="" )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $bounceback = str_replace( '&', '&', $this->request['bounceback'] );
+
+ //-----------------------------------------
+ // Check
+ //-----------------------------------------
+
+ if ( ! $this->request['id'] and ! $this->request['search'] AND !$this->request['settings_save'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['s_noid'];
+ $this->_settingsOverview();
+ return;
+ }
+
+ //--------------------------------------------
+ // check...
+ //--------------------------------------------
+
+ $fields = explode( ",", trim($this->request['settings_save']) );
+
+ if ( ! count($fields ) )
+ {
+ $this->registry->output->global_message = $this->lang->words['s_nofields'];
+ $this->_viewSettings();
+ return;
+ }
+
+ //--------------------------------------------
+ // Get info from DB
+ //--------------------------------------------
+
+ $db_fields = array();
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => "conf_key IN ('" . implode( "','", $fields ) . "')" ) );
+ $this->DB->execute();
+
+ while ( $r = $this->DB->fetch() )
+ {
+ $db_fields[ $r['conf_key'] ] = $r;
+ }
+
+ foreach( $db_fields as $key => $data )
+ {
+ $value = null;
+
+ if ( ! is_array( $_POST[ $key ] ) )
+ {
+ if ( $_POST[ $key ] != $data['conf_default'] )
+ {
+ $value = str_replace( "'", "'", IPSText::stripslashes($_POST[ $key ]) );
+ $value = $value == '' ? "{blank}" : $value;
+ }
+ else
+ {
+ $value = $data['conf_default'];
+ }
+ }
+
+ if ( $data['conf_evalphp'] )
+ {
+ $save = 1;
+ eval( $data['conf_evalphp'] );
+
+ /* Was value set? */
+ if ( $value === null )
+ {
+ $value = str_replace( "'", "'", IPSText::stripslashes($_POST[ $key ]) );
+ $value = $value == '' ? "{blank}" : $value;
+ }
+ }
+
+ if ( $data['conf_type'] == 'editor' )
+ {
+ IPSText::getTextClass('bbcode')->bypass_badwords = 1;
+ IPSText::getTextClass('bbcode')->parse_smilies = 1;
+ IPSText::getTextClass('bbcode')->parse_html = 1;
+ IPSText::getTextClass('bbcode')->parse_bbcode = 1;
+ IPSText::getTextClass('bbcode')->parse_nl2br = 1;
+
+ //$_POST[ $key ] = IPSText::getTextClass('bbcode')->preDbParse( IPSText::getTextClass('editor')->processRawPost( $key ) );
+
+ if( trim($_POST[ $key ]) == ' ' OR trim($_POST[ $key ]) == ' ' )
+ {
+ $_POST[ $key ] = '';
+ }
+ else
+ {
+ $_POST[ $key ] = IPSText::getTextClass('editor')->processRawPost( $key );
+ }
+ }
+
+ $_POST[ $key ] = str_replace( "\r", "", $_POST[ $key ] );
+
+ if ( $_POST[ $key ] != $data['conf_default'] )
+ {
+ $this->DB->update( 'core_sys_conf_settings', array( 'conf_value' => $value ), 'conf_id=' . $data['conf_id'] );
+ }
+ else if( ( isset( $this->request[ $key ] ) && $this->request[ $key ] == '' ) || ( $this->request[ $key ] == $data['conf_default'] ) || $data['conf_value'] != '' )
+ {
+ $this->DB->update( 'core_sys_conf_settings', array( 'conf_value' => '' ), 'conf_id=' . $data['conf_id'] );
+ }
+ }
+
+ $this->request['conf_group'] = $this->request['id'];
+
+ $this->registry->output->global_message = $this->lang->words['s_updated'];
+
+ $this->settingsRebuildCache();
+
+ //-----------------------------------------
+ // We're bouncing back (Boing boing)
+ //-----------------------------------------
+
+ if ( $bounceback )
+ {
+ $this->registry->output->silentRedirect( $bounceback );
+ }
+
+ //-----------------------------------------
+ // Still here?
+ //-----------------------------------------
+
+ if ( ! $donothing )
+ {
+ $this->_viewSettings();
+ }
+ }
+
+ /**
+ * Save the settings form
+ *
+ * @param string [add|edit]
+ * @return void
+ */
+ private function _settingSave($type='add')
+ {
+ if ( $type == 'edit' )
+ {
+ if ( ! $this->request['id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['s_noid'];
+ $this->_settingForm();
+ return;
+ }
+ }
+
+ //--------------------------------------------
+ // check...
+ //--------------------------------------------
+
+ $conf_group = $this->request['conf_newgroup'] ? $this->request['conf_newgroup'] : $this->request['conf_group'];
+
+ $array = array( 'conf_title' => $this->request['conf_title'],
+ 'conf_description' => IPSText::stripslashes( $_POST['conf_description'] ),
+ 'conf_group' => $this->request['conf_group'],
+ 'conf_type' => $this->request['conf_type'],
+ 'conf_key' => str_replace( '-', '_', IPSText::alphanumericalClean( $this->request['conf_key'] ) ),
+ 'conf_value' => IPSText::stripslashes( $_POST['conf_value'] ),
+ 'conf_default' => IPSText::stripslashes( $_POST['conf_default'] ),
+ 'conf_extra' => IPSText::stripslashes( $_POST['conf_extra'] ),
+ 'conf_evalphp' => IPSText::stripslashes( $_POST['conf_evalphp'] ),
+ 'conf_protected' => intval( $this->request['conf_protected'] ),
+ 'conf_position' => intval( $this->request['conf_position'] ),
+ 'conf_start_group' => $this->request['conf_start_group'],
+ 'conf_add_cache' => intval( $this->request['conf_add_cache'] ),
+ 'conf_keywords' => IPSText::stripslashes( $_POST['conf_keywords'] ),
+ );
+
+ //-----------------------------------------
+ // Do we have a title and key?
+ //-----------------------------------------
+
+ if( !$array['conf_title'] OR !$array['conf_key'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['s_missing_key_data'];
+ $this->_settingForm();
+ return;
+ }
+
+ if ( $type == 'add' )
+ {
+ //-----------------------------------------
+ // Is the key already in use?
+ //-----------------------------------------
+
+ if( $this->settings[ $array['conf_key'] ] )
+ {
+ $this->registry->output->global_message = $this->lang->words['s_keyinuse_already'];
+ $this->_settingForm();
+ return;
+ }
+
+ $this->DB->insert( 'core_sys_conf_settings', $array );
+ $this->registry->output->global_message = $this->lang->words['s_added2'];
+ }
+ else
+ {
+ $conf = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => 'conf_id=' . $this->request['id'] ) );
+
+ $this->DB->update( 'core_sys_conf_settings', $array, 'conf_id=' . $this->request['id'] );
+ $this->registry->output->global_message = $this->lang->words['s_edited2'];
+
+ // Recount old group
+ $this->_resynchGroup( $conf['conf_group'] );
+ }
+
+ //-----------------------------------------
+ // Recount new group
+ //-----------------------------------------
+
+ if( $this->request['conf_group'] )
+ {
+ $this->_resynchGroup( $this->request['conf_group'] );
+ }
+
+ $this->settingsRebuildCache();
+
+ $this->_viewSettings();
+ }
+
+ /**
+ * Revert a setting to the default value
+ *
+ * @return void
+ */
+ private function _revertSettings()
+ {
+ $this->request[ 'id'] = intval($this->request['id'] );
+
+ if ( ! $this->request['id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['s_noid'];
+ $this->_settingForm();
+ return;
+ }
+
+ $conf = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => 'conf_id=' . $this->request['id'] ) );
+
+ //--------------------------------------------
+ // Revert...
+ //--------------------------------------------
+
+ $this->DB->update( 'core_sys_conf_settings', array( 'conf_value' => '' ), 'conf_id=' . $this->request['id'] );
+
+ $this->registry->output->global_message = $this->lang->words['s_revertedback'];
+
+ $this->settingsRebuildCache();
+
+ $this->_viewSettings();
+ }
+
+ /**
+ * Delete a setting
+ *
+ * @return void
+ */
+ private function _deleteSettings()
+ {
+ if ( ! $this->request['id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['s_noid'];
+ $this->_settingsOverview();
+ return;
+ }
+
+ $conf = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => 'conf_id=' . $this->request['id'] ) );
+
+ if ( ! $conf['conf_id'] )
+ {
+ $this->registry->output->global_message = $this->lang->words['s_noid'];
+ $this->_settingsOverview();
+ return;
+ }
+
+ //--------------------------------------------
+ // Delete...
+ //--------------------------------------------
+
+ $this->DB->delete( 'core_sys_conf_settings', 'conf_id=' . $this->request['id'] );
+
+ $this->DB->update( 'core_sys_settings_titles', 'conf_title_count=conf_title_count-1', 'conf_title_id=' . $conf['conf_group'], false, true );
+
+ $this->registry->output->global_message = $this->lang->words['s_deleted'];
+
+ $this->settingsRebuildCache();
+
+ $this->_settingsOverview();
+ }
+
+
+ /**
+ * Rebuild settings cache
+ *
+ * @return void
+ */
+ public function settingsRebuildCache()
+ {
+ $settings = array();
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => 'conf_add_cache=1' ) );
+ $info = $this->DB->execute();
+
+ while ( $r = $this->DB->fetch($info) )
+ {
+ $value = $r['conf_value'] != "" ? $r['conf_value'] : $r['conf_default'];
+
+ if ( $value == '{blank}' )
+ {
+ $value = '';
+ }
+
+ $settings[ $r['conf_key'] ] = $value;
+ }
+
+ $this->cache->setCache( 'settings', $settings, array( 'array' => 1 ) );
+ }
+
+ /**
+ * Grab all setting groups and store in an internal array
+ *
+ * @param boolean Pull all settings, not just visible ones
+ * @return void
+ */
+ private function _settingsGetGroups( $ignoreInDev=false )
+ {
+ $this->setting_groups = array();
+
+ if ( IN_DEV OR $ignoreInDev )
+ {
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_settings_titles', 'order' => 'conf_title_title' ) );
+ $this->DB->execute();
+ }
+ else
+ {
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_settings_titles', 'where' => 'conf_title_noshow=0', 'order' => 'conf_title_title' ) );
+ $this->DB->execute();
+ }
+
+ while( $r = $this->DB->fetch() )
+ {
+ $this->setting_groups[ $r['conf_title_id'] ] = $r;
+ $this->setting_groups_by_key[ $r['conf_title_keyword'] ] = $r;
+ }
+ }
+
+ /**
+ * Make sure all titles have keywords set
+ *
+ * @return void
+ */
+ private function _settingsTitlesCheck()
+ {
+ //-----------------------------------------
+ // Get 'em
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_sys_settings_titles' ) );
+ $outer = $this->DB->execute();
+
+ while( $row = $this->DB->fetch( $outer ) )
+ {
+ if ( ! $row['conf_title_keyword'] )
+ {
+ $new_keyword = mb_strtolower( preg_replace( "#[^\d\w]#", "", $row['conf_title_title'] ) );
+ $this->DB->update( 'core_sys_settings_titles', array( 'conf_title_keyword' => $new_keyword ), 'conf_title_id='.$row['conf_title_id'] );
+ }
+ }
+ }
+
+ /**
+ * Import XML Settings on an app by app basis
+ *
+ * @return array Array of messages
+ */
+ public function importAllApps()
+ {
+ $message = array();
+
+ /* Check for settings not needed anymore */
+ $this->_loadDeleteList();
+
+ foreach( ipsRegistry::$applications as $app_dir => $app_data )
+ {
+ $file = IPSLib::getAppDir( $app_dir ) . '/xml/' . $app_dir . '_settings.xml';
+
+ if ( file_exists( $file ) )
+ {
+ $contents = file_get_contents( $file );
+
+ $return = $this->_importXML( $contents, $app_dir );
+
+ $message[] = $app_data['app_title'] . " " . sprintf( $this->lang->words['s_upandin'], $return['updatedCount'], $return['insertedCount'] );
+
+ /* In dev time stamp? */
+ if ( IN_DEV )
+ {
+ $cache = $this->caches['indev'];
+ $cache['import']['settings'][ $app_dir ] = time();
+ $this->cache->setCache( 'indev', $cache, array( 'donow' => 1, 'array' => 1 ) );
+ }
+ }
+ }
+
+ return $message;
+ }
+
+ /**
+ * Import XML Settings
+ *
+ * @param string XML Data
+ * @param string Application (should be set by XML file, however)
+ * @param array Array of any known settings and their values
+ * @return array array( 'insertedCount' => x, 'updatedCount' => x, 'updatedKeys' => array(..), 'insertedKeys' => array() )
+ */
+ private function _importXML( $content, $app='core', $knownSettings=array() )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $cur_settings = array();
+ $updated = 0;
+ $inserted = 0;
+ $updatedKeys = array();
+ $insertedKeys = array();
+ $known = array();
+
+ //-----------------------------------------
+ // Get current settings.
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => 'conf_id, conf_key',
+ 'from' => 'core_sys_conf_settings',
+ 'order' => 'conf_id' ) );
+
+ $this->DB->execute();
+
+ while ( $r = $this->DB->fetch() )
+ {
+ $cur_settings[ $r['conf_key'] ] = $r['conf_id'];
+ }
+
+ //-----------------------------------------
+ // Get current titles
+ //-----------------------------------------
+
+ $this->_settingsGetGroups( true );
+
+ //-----------------------------------------
+ // Get xml class
+ //-----------------------------------------
+
+ require_once( IPS_KERNEL_PATH.'classXML.php' );
+
+ $xml = new classXML( IPS_DOC_CHAR_SET );
+ $xml->loadXML( $content );
+
+ //-----------------------------------------
+ // Loop through and sort out settings...
+ //-----------------------------------------
+
+ foreach( $xml->fetchElements('setting') as $setting )
+ {
+ $entry = $xml->fetchElementsFromRecord( $setting );
+
+ //-----------------------------------------
+ // Is setting?
+ //-----------------------------------------
+
+ if ( ! $entry['conf_is_title'] )
+ {
+ unset( $entry['conf_is_title'] );
+ unset( $entry['conf_help_key'] );
+ unset( $entry['conf_id'] );
+ unset( $entry['conf_end_group'] );
+ $new_settings[] = $entry;
+ }
+
+ //-----------------------------------------
+ // Is title?
+ //-----------------------------------------
+
+ else
+ {
+ $new_titles[] = $entry;
+ }
+ }
+
+ //-----------------------------------------
+ // Sort out titles...
+ //-----------------------------------------
+
+ if ( is_array( $new_titles ) and count( $new_titles ) )
+ {
+ foreach( $new_titles as $idx => $data )
+ {
+ if ( $data['conf_title_title'] AND $data['conf_title_keyword'] )
+ {
+ //-----------------------------------------
+ // Get ID based on key
+ //-----------------------------------------
+
+ $conf_id = $this->setting_groups_by_key[ $data['conf_title_keyword'] ]['conf_title_id'];
+
+ $save = array( 'conf_title_title' => $data['conf_title_title'],
+ 'conf_title_desc' => $data['conf_title_desc'],
+ 'conf_title_keyword' => $data['conf_title_keyword'],
+ 'conf_title_tab' => $data['conf_title_tab'],
+ 'conf_title_app' => $data['conf_title_app'] ? $data['conf_title_app'] : $app,
+ 'conf_title_noshow' => $data['conf_title_noshow'] );
+
+ //-----------------------------------------
+ // Not got a row, insert first!
+ //-----------------------------------------
+
+ if ( ! $conf_id )
+ {
+ $this->DB->insert( 'core_sys_settings_titles', $save );
+ $conf_id = $this->DB->getInsertId();
+
+ }
+ else
+ {
+ //-----------------------------------------
+ // Update...
+ //-----------------------------------------
+
+ $this->DB->update( 'core_sys_settings_titles', $save, 'conf_title_id='.$conf_id );
+ }
+
+ //-----------------------------------------
+ // Update settings cache
+ //-----------------------------------------
+
+ $save['conf_title_id'] = $conf_id;
+ $this->setting_groups_by_key[ $save['conf_title_keyword'] ] = $save;
+ $this->setting_groups[ $save['conf_title_id'] ] = $save;
+
+ //-----------------------------------------
+ // Remove need update...
+ //-----------------------------------------
+
+ $need_update[] = $conf_id;
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Sort out settings
+ //-----------------------------------------
+
+ if ( is_array( $new_settings ) and count( $new_settings ) )
+ {
+ foreach( $new_settings as $idx => $data )
+ {
+ //-----------------------------------------
+ // Insert known
+ //-----------------------------------------
+
+ $data['conf_value'] = '';
+
+ if( is_array($knownSettings) AND count($knownSettings) )
+ {
+ if ( ! $data['conf_value'] AND ( in_array( $data['conf_key'], array_keys( $knownSettings ) ) ) )
+ {
+ $data['conf_value'] = $knownSettings[ $data['conf_key'] ];
+ }
+ }
+
+ $data['conf_group'] = $this->setting_groups_by_key[ $data['conf_title_keyword'] ]['conf_title_id'];
+
+ //-----------------------------------------
+ // Remove from array
+ //-----------------------------------------
+
+ unset( $data['conf_title_keyword'] );
+
+ if ( $cur_settings[ $data['conf_key'] ] )
+ {
+ //-----------------------------------------
+ // Don't change the setting value
+ //-----------------------------------------
+ unset( $data['conf_value'] );
+
+ //-----------------------------------------
+ // Update
+ //-----------------------------------------
+
+ $this->DB->update( 'core_sys_conf_settings', $data, 'conf_id='.$cur_settings[ $data['conf_key'] ] );
+ $updatedKeys[] = $data['conf_key'];
+ $updated++;
+ }
+ else
+ {
+ //-----------------------------------------
+ // INSERT
+ //-----------------------------------------
+
+ $this->DB->insert( 'core_sys_conf_settings', $data );
+ $insertedKeys[] = $data['conf_key'];
+ $inserted++;
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Update group counts...
+ //-----------------------------------------
+
+ if ( count( $need_update ) )
+ {
+ foreach( $need_update as $i => $idx )
+ {
+ $conf = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count', 'from' => 'core_sys_conf_settings', 'where' => 'conf_group='.$idx ) );
+
+ $count = intval($conf['count']);
+
+ $this->DB->update( 'core_sys_settings_titles', array( 'conf_title_count' => $count ), 'conf_title_id='.$idx );
+ }
+ }
+
+ //-----------------------------------------
+ // Resync
+ //-----------------------------------------
+
+ $this->settingsRebuildCache();
+
+ //-----------------------------------------
+ // Return
+ //-----------------------------------------
+
+ return array( 'insertedCount' => $inserted,
+ 'updatedCount' => $updated,
+ 'insertedKeys' => $insertedKeys,
+ 'updatedKeys' => $updatedKeys );
+ }
+
+ /**
+ * Export all apps: Wrapper function really. Yes. It is.
+ *
+ * @return array Array of messages or errors
+ */
+ public function exportAllApps()
+ {
+ $messages = array();
+ $errors = array();
+
+ /* Check for settings not needed anymore */
+ $this->_loadDeleteList();
+
+ foreach( ipsRegistry::$applications as $app_dir => $app_data )
+ {
+ @unlink( IPSLib::getAppDir( $app_dir ) . '/xml/' . $app_dir . '_settings.xml' );
+
+ if ( ! file_exists( IPSLib::getAppDir( $app_dir ) . '/xml' ) )
+ {
+ $errors[] = "Ошибка: " . IPSLib::getAppDir( $app_dir ) . "/xml/ не существует";
+ continue;
+ }
+ else if ( ! IPSLib::isWritable( IPSLib::getAppDir( $app_dir ) . '/xml' ) )
+ {
+ if ( ! @chmod( IPSLib::isWritable( IPSLib::getAppDir( $app_dir ) . '/xml', 0755 ) ) )
+ {
+ $errors[] = "Ошибка: " . IPSLib::getAppDir( $app_dir ) . "/xml/ нет прав на запись";
+ continue;
+ }
+ }
+ else if ( file_exists( IPSLib::getAppDir( $app_dir ) . '/xml/' . $app_dir . '_settings.xml' ) AND ! IPSLib::isWritable( IPSLib::getAppDir( $app_dir ) . '/xml/' . $app_dir . '_settings.xml' ) )
+ {
+ $errors[] = "Ошибка: " . IPSLib::getAppDir( $app_dir ) . '/xml/' . $app_dir . "_settings.xml нет прав на запись";
+ continue;
+ }
+
+ $this->_exportXML( $app_dir );
+
+ $messages[] = "Настройки приложения " . $app_data['app_title'] . " экспортированы в директорию приложения";
+
+ /* In dev time stamp? */
+ if ( IN_DEV )
+ {
+ $cache = $this->caches['indev'];
+ $cache['import']['settings'][ $app_dir ] = time();
+ $this->cache->setCache( 'indev', $cache, array( 'donow' => 1, 'array' => 1 ) );
+ }
+ }
+
+ return $errors ? $errors : $messages;
+ }
+
+
+ /**
+ * Export all settings to XML (IN_DEV mode)
+ *
+ * @param string Application directory
+ * @return boolean
+ */
+ private function _exportXML( $app_dir='core' )
+ {
+ //-----------------------------------------
+ // Get setting groups
+ //-----------------------------------------
+
+ $this->_settingsGetGroups( true );
+
+ //-----------------------------------------
+ // Get xml class
+ //-----------------------------------------
+
+ require_once( IPS_KERNEL_PATH.'classXML.php' );
+
+ $xml = new classXML( IPS_DOC_CHAR_SET );
+
+ $xml->newXMLDocument();
+ $xml->addElement( 'settingexport' );
+ $xml->addElement( 'settinggroup', 'settingexport' );
+
+ foreach( $this->setting_groups as $i => $roar )
+ {
+ //-----------------------------------------
+ // App check?
+ //-----------------------------------------
+
+ if ( $app_dir != $roar['conf_title_app'] )
+ {
+ continue;
+ }
+
+ //-----------------------------------------
+ // First, add in setting group title
+ //-----------------------------------------
+
+ $thisconf = array( 'conf_is_title' => 1,
+ 'conf_title_keyword' => $roar['conf_title_keyword'],
+ 'conf_title_title' => $roar['conf_title_title'],
+ 'conf_title_desc' => $roar['conf_title_desc'],
+ 'conf_title_tab' => $roar['conf_title_tab'],
+ 'conf_title_app' => $roar['conf_title_app'] ? $roar['conf_title_app'] : $app_dir,
+ 'conf_title_noshow' => $roar['conf_title_noshow'] );
+
+ $xml->addElementAsRecord( 'settinggroup', 'setting', $thisconf );
+
+ //-----------------------------------------
+ // Get settings...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'core_sys_conf_settings',
+ 'where' => "conf_group='{$roar['conf_title_id']}'",
+ 'order' => 'conf_position, conf_title' ) );
+
+ $this->DB->execute();
+
+ while ( $r = $this->DB->fetch() )
+ {
+ //-----------------------------------------
+ // Clean up...
+ //-----------------------------------------
+
+ unset( $r['conf_value'], $r['conf_id'] );
+
+ $r['conf_title_keyword'] = $roar['conf_title_keyword'];
+ $r['conf_is_title'] = 0;
+
+ $xml->addElementAsRecord( 'settinggroup', 'setting', $r );
+ }
+ }
+
+ //-----------------------------------------
+ // Grab the XML document
+ //-----------------------------------------
+
+ $xmlData = $xml->fetchDocument();
+
+ //-----------------------------------------
+ // Attempt to write...
+ //-----------------------------------------
+
+ $file = IPSLib::getAppDir( $app_dir ) . '/xml/' . $app_dir . '_settings.xml';
+
+ @unlink( $file );
+ @file_put_contents( $file, $xmlData );
+ }
+
+ /**
+ * Load and parse settings delete list (IN_DEV)
+ *
+ * @return void
+ */
+ private function _loadDeleteList()
+ {
+ if ( IN_DEV )
+ {
+ /* Check for group settings */
+ if ( file_exists( DOC_IPS_ROOT_PATH . '_deleteGroupSettings.txt' ) )
+ {
+ $notTheseGroups = file( DOC_IPS_ROOT_PATH . '_deleteGroupSettings.txt' );
+
+ if ( count($notTheseGroups) )
+ {
+ $notTheseGroups = array_map('trim', $notTheseGroups);
+
+ $this->DB->build( array( 'select' => 'conf_title_id', 'from' => 'core_sys_settings_titles', 'where' => "conf_title_keyword IN ('" . implode("','", $notTheseGroups) . "')" ) );
+ $this->DB->execute();
+
+ if ( $this->DB->getTotalRows() )
+ {
+ $_deleteTheseGroups = array();
+
+ while( $s = $this->DB->fetch() )
+ {
+ $_deleteTheseGroups[] = $s['conf_title_id'];
+ }
+
+ if ( count($_deleteTheseGroups) )
+ {
+ $this->DB->delete( 'core_sys_conf_settings', 'conf_group IN (' . implode(',', $_deleteTheseGroups) . ')' );
+ $this->DB->delete( 'core_sys_settings_titles', "conf_title_keyword IN ('" . implode("','", $notTheseGroups) . "')" );
+ }
+ }
+ }
+ }
+
+ /* Check for single settings */
+ if ( file_exists( DOC_IPS_ROOT_PATH . '_deleteSettings.txt' ) )
+ {
+ $notTheseSettings = file( DOC_IPS_ROOT_PATH . '_deleteSettings.txt' );
+
+ if ( count($notTheseSettings) )
+ {
+ $notTheseSettings = array_map('trim', $notTheseSettings);
+
+ $this->DB->delete( 'core_sys_conf_settings', "conf_key IN('" . implode( "','", $notTheseSettings ) . "')" );
+ }
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/tools/sharelinks.php b/upload/admin/applications/core/modules_admin/tools/sharelinks.php
new file mode 100644
index 00000000..960b4b86
--- /dev/null
+++ b/upload/admin/applications/core/modules_admin/tools/sharelinks.php
@@ -0,0 +1,339 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Bookmarks
+ * Last Updated: $LastChangedDate: 2010-01-15 15:18:44 +0000 (Fri, 15 Jan 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Blog
+ * @link http://www.invisionpower.com
+ * @since 27th January 2004
+ * @version $Rev: 5713 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+
+class admin_core_tools_sharelinks extends ipsCommand
+{
+ /**
+ * Skin object
+ *
+ * @var object Skin templates
+ */
+ private $html;
+
+ /**
+ * Shortcut for url
+ *
+ * @var string URL shortcut
+ */
+ private $form_code;
+
+ /**
+ * Shortcut for url (javascript)
+ *
+ * @var string JS URL shortcut
+ */
+ private $form_code_js;
+
+ /**
+ * Main class entry point
+ *
+ * @param object ipsRegistry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* Load Skin Template */
+ $this->html = $this->registry->output->loadTemplate( 'cp_skin_tools' );
+
+ /* Load Language */
+ $this->lang->loadLanguageFile( array( 'admin_tools' ) );
+
+ /* URL Bits */
+ $this->html->form_code = $this->form_code = 'module=tools§ion=sharelinks&';
+ $this->html->form_code_js = $this->form_code_js = 'module=tools§ion=sharelinks&';
+
+ switch( $this->request['do'] )
+ {
+ case 'reorder':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sharelinks_manage' );
+ $this->shareLinksReorder();
+ break;
+
+ case 'delete':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sharelinks_manage' );
+ $this->sharelinksDelete();
+ break;
+
+ case 'add':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sharelinks_manage' );
+ $this->sharelinksForm( 'add' );
+ break;
+
+ case 'edit':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sharelinks_manage' );
+ $this->sharelinksForm( 'edit' );
+ break;
+
+ case 'do_add':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sharelinks_manage' );
+ $this->sharelinksSave( 'add' );
+ break;
+
+ case 'do_edit':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'sharelinks_manage' );
+ $this->sharelinksSave( 'edit' );
+ break;
+
+ case 'index':
+ default:
+ $this->_sharelinksIndex();
+ break;
+ }
+
+ /* Output */
+ $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * Reorder
+ *
+ * @return void
+ */
+ private function shareLinksReorder()
+ {
+ /* AJAX Class */
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
+ $ajax = new $classToLoad();
+
+ /* Check security key */
+ if( $this->registry->adminFunctions->checkSecurityKey( $this->request['md5check'], true ) === false )
+ {
+ $ajax->returnString( $this->lang->words['postform_badmd5'] );
+ exit();
+ }
+
+ /* Save new positions */
+ $position = 1;
+
+ if( is_array( $this->request['share'] ) AND count( $this->request['share'] ) )
+ {
+ foreach( $this->request['share'] as $this_id )
+ {
+ $this->DB->update( 'core_share_links', array( 'share_position' => $position ), 'share_id=' . intval( $this_id ) );
+ $position++;
+ }
+ }
+
+ /* Rebuild Cache */
+ $this->rebuildCache();
+
+ /* Done */
+ $ajax->returnString( 'OK' );
+ exit();
+ }
+
+ /**
+ * sharelinksDelete
+ *
+ * @return void
+ **/
+ function sharelinksDelete()
+ {
+ /* ID */
+ $id = intval( $this->request['share_id'] );
+
+ /* Remove */
+ $this->DB->delete( 'core_share_links', "share_id={$id}" );
+ $this->rebuildCache();
+
+ /* Redirect */
+ $this->registry->output->global_message = $this->lang->words['sl_removed'];
+ $this->registry->output->silentRedirectWithMessage( "{$this->settings['base_url']}{$this->form_code}" );
+ }
+
+ /**
+ * sharelinksSave
+ *
+ * @param string [$type='add']
+ * @return void
+ **/
+ function sharelinksSave( $type='add' )
+ {
+ /* INI */
+ $errors = array();
+
+ /* Check input */
+ if( ! $this->request['share_title'] )
+ {
+ $errors[] = " {$this->lang->words['sl_must_title']}";
+ }
+
+ if( ! $this->request['share_key'] )
+ {
+ $errors[] = " {$this->lang->words['sl_must_key']}";
+ }
+
+ if( count( $errors ) )
+ {
+ $this->registry->output->html .= "{$this->lang->words['sl_formerror']} " . implode( '', $errors ) . " ";
+ $this->sharelinksForm( $type );
+ return;
+ }
+
+ /* Data */
+ $data = array(
+ 'share_title' => $this->request['share_title'],
+ 'share_key' => $this->request['share_key'],
+ 'share_enabled' => $this->request['share_enabled'],
+ 'share_canonical' => $this->request['share_canonical']
+ );
+
+ /* Check the type */
+ if( $type == 'add' )
+ {
+ $max = $this->DB->buildAndFetch( array( 'select' => 'MAX(share_position) as position', 'from' => 'core_share_links' ) );
+
+ $data['share_position'] = intval($max['position']) + 1;
+
+ /* Insert the record */
+ $this->DB->insert( 'core_share_links', $data );
+ $this->rebuildCache();
+
+ /* All done */
+ $this->registry->output->global_message = sprintf( $this->lang->words['sl_added'], $data['share_title'] );
+ $this->registry->output->silentRedirectWithMessage( "{$this->settings['base_url']}{$this->form_code}" );
+ }
+ else
+ {
+ /* ID */
+ $id = intval( $this->request['id'] );
+
+ /* Update */
+ $this->DB->update( 'core_share_links', $data, "share_id={$id}" );
+ $this->rebuildCache();
+
+ /* Done and done */
+ $this->registry->output->global_message = sprintf( $this->lang->words['sl_updated'], $data['share_title'] );
+ $this->registry->output->silentRedirectWithMessage( "{$this->settings['base_url']}{$this->form_code}" );
+ }
+
+ }
+
+ /**
+ * Displays the add/edit bookmark form
+ *
+ * @param string [$type='add']
+ * @return void
+ **/
+ public function sharelinksForm( $type='add' )
+ {
+ /* Check form type */
+ if( $type == 'add' )
+ {
+ /* Strings */
+ $title = $this->lang->words['sl_form_new_title'];
+ $button = $this->lang->words['sl_form_new_button'];
+ $req = 'do_add';
+
+ /* Data */
+ $data = array(
+ 'share_title' => $this->request['share_title'],
+ 'share_key' => $this->request['share_key'],
+ 'share_enabled' => $this->request['share_enabled'],
+ 'share_canonical' => $this->request['share_canonical']
+ );
+ $id = 0;
+ }
+ else
+ {
+ /* Strings */
+ $title = $this->lang->words['sl_form_edit_title'];
+ $button = $this->lang->words['sl_form_edit_button'];
+ $req = 'do_edit';
+
+ /* Data */
+ $id = intval( $this->request['share_id'] );
+ $data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_share_links', 'where' => "share_id={$id}" ) );
+
+ /* Set Defaults */
+ $data['share_title'] = ( isset( $this->request['share_title'] ) && $this->request['share_title'] ) ? $this->request['share_title'] : $data['share_title'];
+ $data['share_key'] = ( isset( $this->request['share_key'] ) && $this->request['share_key'] ) ? $this->request['share_key'] : $data['share_key'];
+ $data['share_enabled'] = ( isset( $this->request['share_enabled'] ) && $this->request['share_enabled'] ) ? $this->request['share_enabled'] : $data['share_enabled'];
+ $data['share_canonical'] = ( isset( $this->request['share_canonical'] ) && $this->request['share_canonical'] ) ? $this->request['share_canonical'] : $data['share_canonical'];
+ }
+
+ /* Form Elements */
+ $form = array();
+
+ $form['share_title'] = $this->registry->output->formInput( 'share_title' , $data['share_title'] , 'share_title' , 50 );
+ $form['share_key'] = $this->registry->output->formInput( 'share_key' , $data['share_key'] , 'share_key' , 50 );
+ $form['share_enabled'] = $this->registry->output->formYesNo( 'share_enabled' , $data['share_enabled'] );
+ $form['share_canonical'] = $this->registry->output->formYesNo( 'share_canonical' , $data['share_canonical'] );
+
+ $this->registry->output->html .= $this->html->sharelinksForm( $id, $req, $title, $button, $form );
+ }
+
+ /**
+ * List all the the current bookmark types
+ *
+ * @return void
+ **/
+ private function _sharelinksIndex()
+ {
+ /* Init */
+ $rows = array();
+
+ /* Fetch */
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'core_share_links',
+ 'order' => 'share_position ASC, share_id ASC' ) );
+
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $rows[] = $r;
+ }
+
+ /* End table and output */
+ $this->registry->output->html .= $this->html->shareLinksIndex( $rows );
+ }
+
+ /**
+ * Recaches share links
+ *
+ * @return void
+ */
+ public function rebuildCache()
+ {
+ /* INIT */
+ $cache = array();
+
+ /* Fetch */
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'core_share_links',
+ 'order' => 'share_position ASC, share_id ASC' ) );
+
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $cache[ $row['share_key'] ] = $row;
+ }
+
+ $this->cache->setCache( 'sharelinks', $cache, array( 'array' => 1 ) );
+ }
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/tools/uagents.php b/upload/admin/applications/core/modules_admin/tools/uagents.php
index 51e9e7df..15e33f16 100644
--- a/upload/admin/applications/core/modules_admin/tools/uagents.php
+++ b/upload/admin/applications/core/modules_admin/tools/uagents.php
@@ -1,390 +1,378 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
- exit();
-}
-
-class admin_core_tools_uagents extends ipsCommand
-{
- /**
- * Skin object
- *
- * @access private
- * @var object Skin templates
- */
- private $html;
-
- /**
- * User agent functions
- *
- * @access private
- * @var object Skin templates
- */
- private $userAgentFunctions;
-
- /**#@+
- * URL bits
- *
- * @access public
- * @var string
- */
- public $form_code = '';
- public $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_tools');
-
- //-----------------------------------------
- // Set up stuff
- //-----------------------------------------
-
- $this->form_code = $this->html->form_code = 'module=tools§ion=uagents';
- $this->form_code_js = $this->html->form_code_js = 'module=tools§ion=uagents';
-
- //-----------------------------------------
- // Load lang
- //-----------------------------------------
-
- $this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_tools' ) );
-
- //-----------------------------------------
- // Load functions and cache classes
- //-----------------------------------------
-
- require_once( IPS_ROOT_PATH . 'sources/classes/useragents/userAgentFunctions.php' );
-
- $this->userAgentFunctions = new userAgentFunctions( $registry );
-
- ///----------------------------------------
- // What to do...
- //-----------------------------------------
-
- switch( $this->request['do'] )
- {
- case 'list':
- default:
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ua_manage' );
- $this->_listUagents();
- break;
- case 'reorder':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ua_manage' );
- $this->_uagentsReorder();
- break;
- case 'groupsList':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ua_manage' );
- $this->_listGroups();
- break;
- case 'groupAdd':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ua_manage' );
- $this->_groupForm('add');
- break;
- case 'groupEdit':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ua_manage' );
- $this->_groupForm('edit');
- break;
- case 'groupAddDo':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ua_manage' );
- $this->_groupSave( 'add' );
- break;
- case 'groupEditDo':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ua_manage' );
- $this->_groupSave( 'edit' );
- break;
- case 'groupRemove':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ua_remove' );
- $this->_groupRemove();
- break;
- case 'rebuildMaster':
- $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ua_manage' );
- $this->_rebuildMasterUserAgents();
- break;
- }
-
- /* Output */
- $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
- $this->registry->output->sendOutput();
- }
-
- /**
- * Group remove
- *
- * @access private
- * @return string HTML
- */
- private function _groupRemove()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $ugroup_id = intval( $this->request['ugroup_id'] );
-
- //-----------------------------------------
- // Remove it...
- //-----------------------------------------
-
- $this->userAgentFunctions->removeUserAgentGroup( $ugroup_id );
-
- return $this->_listGroups();
- }
-
- /**
- * Form Save
- *
- * @access private
- * @param string Type of form to show (add/edit)
- * @return string HTML
- */
- private function _groupSave( $type )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $ugroup_id = intval( $this->request['ugroup_id'] );
- $ugroup_title = trim( $this->request['ugroup_title'] );
- $ugroupData = json_decode( $_POST['uAgentsData'], TRUE );
-
- if ( ! $ugroup_title )
- {
- $ugroup_title = $this->lang->words['ua_unknown'] . time();
- }
-
- //-----------------------------------------
- // Save in function
- //-----------------------------------------
-
- $this->userAgentFunctions->saveUserAgentGroup( $ugroup_title, $ugroupData, $ugroup_id );
-
- return $this->_listGroups();
- }
-
- /**
- * Form type
- *
- * @access private
- * @param string Type of form to show (add/edit)
- * @return void
- */
- private function _groupForm( $type='' )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $ugroup_id = intval( $this->request['ugroup_id'] );
- $ugroup = array();
- $form = array();
-
- //-----------------------------------------
- // Get user agents
- //-----------------------------------------
-
- $matrixAgents = $this->userAgentFunctions->fetchAgents();
-
- //-----------------------------------------
- // Check (please?)
- //-----------------------------------------
-
- if ( $type == 'add' )
- {
- $formcode = 'groupAddDo';
- $title = $this->lang->words['ua_addnewtitle'];
- $button = $this->lang->words['ua_addnewbutton'];
- }
- else
- {
- $groups = $this->userAgentFunctions->fetchGroups();
- $ugroup = $groups[ $ugroup_id ];
-
- if ( ! $ugroup['ugroup_id'] )
- {
- $this->registry->getClass('output')->global_message = $this->lang->words['ua_noid'];
- $this->_groupForm( $type );
- return;
- }
-
- $formcode = 'groupEditDo';
- $title = sprintf( $this->lang->words['ua_editua'], $ugroup['ugroup_title'] );
- $button = $this->lang->words['ua_savechanges'];
- }
-
- //-----------------------------------------
- // Form elements
- //-----------------------------------------
-
- $form['ugroup_title'] = $this->registry->getClass('output')->formInput( 'ugroup_title', $_POST['ugroup_title'] ? $_POST['ugroup_title'] : $ugroup['ugroup_title'] );
-
- //-----------------------------------------
- // Navvy Gation
- //-----------------------------------------
-
- $this->registry->output->extra_nav[] = array( $this->settings['base_url'].'module=tools§ion=uagents&do=groupsList', $this->lang->words['ua_nav1'] );
- $this->registry->output->extra_nav[] = array( $this->settings['base_url'].'module=tools§ion=uagents&do=list', $this->lang->words['ua_nav2'] );
-
- $this->registry->getClass('output')->html .= $this->html->uagents_groupForm( $form, $title, $formcode, $button, $ugroup, $matrixAgents );
- }
-
- /**
- * List available user agent groups
- *
- * @access private
- * @return void
- */
- private function _listGroups()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $groups = array();
-
- //-----------------------------------------
- // Get user agents
- //-----------------------------------------
-
- $groups = $this->userAgentFunctions->fetchGroups();
-
- //-----------------------------------------
- // Navvy Gation
- //-----------------------------------------
-
- $this->registry->output->extra_nav[] = array( $this->settings['base_url'].'module=tools§ion=uagents&do=groupsList', $this->lang->words['ua_nav1'] );
- $this->registry->output->extra_nav[] = array( $this->settings['base_url'].'module=tools§ion=uagents&do=list', $this->lang->words['ua_nav2'] );
-
- //-----------------------------------------
- // Print it...
- //-----------------------------------------
-
- $this->registry->output->html .= $this->html->uagents_listUagentGroups( $groups );
-
- //-----------------------------------------
- // Reset
- //-----------------------------------------
-
- $this->request['do'] = 'groupsList';
- }
-
- /**
- * Rebuild master user agents
- *
- * @access private
- * @return string HTML
- */
- private function _rebuildMasterUserAgents()
- {
- $this->userAgentFunctions->rebuildMasterUserAgents();
-
- return $this->_listUagents();
- }
-
- /**
- * List available user agents
- *
- * @access private
- * @return void
- */
- private function _listUagents()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $agents = array();
-
- //-----------------------------------------
- // Get user agents
- //-----------------------------------------
-
- $matrixAgents = $this->userAgentFunctions->fetchAgents();
-
- //-----------------------------------------
- // Navvy Gation
- //-----------------------------------------
-
- $this->registry->output->extra_nav[] = array( $this->settings['base_url'].'module=tools§ion=uagents&do=list', $this->lang->words['ua_nav1'] );
-
- //-----------------------------------------
- // Print it...
- //-----------------------------------------
-
- $this->registry->output->html .= $this->html->uagents_listUagents( $matrixAgents );
- }
-
- /**
- * Reorder useragents
- *
- * @access private
- * @return void
- */
- private function _uagentsReorder()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- require_once( IPS_KERNEL_PATH . 'classAjax.php' );
- $ajax = new classAjax();
-
- //-----------------------------------------
- // Checks...
- //-----------------------------------------
-
- if( $this->registry->adminFunctions->checkSecurityKey( $this->request['md5check'], true ) === false )
- {
- $ajax->returnString( $this->lang->words['postform_badmd5'] );
- exit();
- }
-
- //-----------------------------------------
- // Save new position
- //-----------------------------------------
-
- $position = 1;
-
- if( is_array($this->request['uagents']) AND count($this->request['uagents']) )
- {
- foreach( $this->request['uagents'] as $this_id )
- {
- $this->DB->update( 'core_uagents', array( 'uagent_position' => $position ), 'uagent_id=' . $this_id );
-
- $position++;
- }
- }
-
- $ajax->returnString( 'OK' );
- exit();
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * User agent management
+ * Last Updated: $Date: 2010-10-19 10:40:05 -0400 (Tue, 19 Oct 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since Who knows...
+ * @version $Revision: 6995 $
+ */
+
+if ( ! defined( 'IN_ACP' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+class admin_core_tools_uagents extends ipsCommand
+{
+ /**
+ * Skin object
+ *
+ * @var object Skin templates
+ */
+ private $html;
+
+ /**
+ * User agent functions
+ *
+ * @var object Skin templates
+ */
+ private $userAgentFunctions;
+
+ /**#@+
+ * URL bits
+ *
+ * @var string
+ */
+ public $form_code = '';
+ public $form_code_js = '';
+ /**#@-*/
+
+ /**
+ * Main class entry point
+ *
+ * @param object ipsRegistry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ //-----------------------------------------
+ // Load skin
+ //-----------------------------------------
+
+ $this->html = $this->registry->output->loadTemplate('cp_skin_tools');
+
+ //-----------------------------------------
+ // Set up stuff
+ //-----------------------------------------
+
+ $this->form_code = $this->html->form_code = 'module=tools§ion=uagents';
+ $this->form_code_js = $this->html->form_code_js = 'module=tools§ion=uagents';
+
+ //-----------------------------------------
+ // Load lang
+ //-----------------------------------------
+
+ $this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_tools' ) );
+
+ //-----------------------------------------
+ // Load functions and cache classes
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/useragents/userAgentFunctions.php', 'userAgentFunctions' );
+ $this->userAgentFunctions = new $classToLoad( $registry );
+
+ ///----------------------------------------
+ // What to do...
+ //-----------------------------------------
+
+ switch( $this->request['do'] )
+ {
+ case 'list':
+ default:
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ua_manage' );
+ $this->_listUagents();
+ break;
+ case 'reorder':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ua_manage' );
+ $this->_uagentsReorder();
+ break;
+ case 'groupsList':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ua_manage' );
+ $this->_listGroups();
+ break;
+ case 'groupAdd':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ua_manage' );
+ $this->_groupForm('add');
+ break;
+ case 'groupEdit':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ua_manage' );
+ $this->_groupForm('edit');
+ break;
+ case 'groupAddDo':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ua_manage' );
+ $this->_groupSave( 'add' );
+ break;
+ case 'groupEditDo':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ua_manage' );
+ $this->_groupSave( 'edit' );
+ break;
+ case 'groupRemove':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ua_remove' );
+ $this->_groupRemove();
+ break;
+ case 'rebuildMaster':
+ $this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ua_manage' );
+ $this->_rebuildMasterUserAgents();
+ break;
+ }
+
+ /* Output */
+ $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * Group remove
+ *
+ * @return string HTML
+ */
+ private function _groupRemove()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $ugroup_id = intval( $this->request['ugroup_id'] );
+
+ //-----------------------------------------
+ // Remove it...
+ //-----------------------------------------
+
+ $this->userAgentFunctions->removeUserAgentGroup( $ugroup_id );
+
+ return $this->_listGroups();
+ }
+
+ /**
+ * Form Save
+ *
+ * @param string Type of form to show (add/edit)
+ * @return string HTML
+ */
+ private function _groupSave( $type )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $ugroup_id = intval( $this->request['ugroup_id'] );
+ $ugroup_title = trim( $this->request['ugroup_title'] );
+ $ugroupData = json_decode( $_POST['uAgentsData'], TRUE );
+
+ if ( ! $ugroup_title )
+ {
+ $ugroup_title = $this->lang->words['ua_unknown'] . time();
+ }
+
+ //-----------------------------------------
+ // Save in function
+ //-----------------------------------------
+
+ $this->userAgentFunctions->saveUserAgentGroup( $ugroup_title, $ugroupData, $ugroup_id );
+
+ return $this->_listGroups();
+ }
+
+ /**
+ * Form type
+ *
+ * @param string Type of form to show (add/edit)
+ * @return void
+ */
+ private function _groupForm( $type='' )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $ugroup_id = intval( $this->request['ugroup_id'] );
+ $ugroup = array();
+ $form = array();
+
+ //-----------------------------------------
+ // Get user agents
+ //-----------------------------------------
+
+ $matrixAgents = $this->userAgentFunctions->fetchAgents();
+
+ //-----------------------------------------
+ // Check (please?)
+ //-----------------------------------------
+
+ if ( $type == 'add' )
+ {
+ $formcode = 'groupAddDo';
+ $title = $this->lang->words['ua_addnewtitle'];
+ $button = $this->lang->words['ua_addnewbutton'];
+ }
+ else
+ {
+ $groups = $this->userAgentFunctions->fetchGroups();
+ $ugroup = $groups[ $ugroup_id ];
+
+ if ( ! $ugroup['ugroup_id'] )
+ {
+ $this->registry->getClass('output')->global_message = $this->lang->words['ua_noid'];
+ $this->_groupForm( $type );
+ return;
+ }
+
+ $formcode = 'groupEditDo';
+ $title = sprintf( $this->lang->words['ua_editua'], $ugroup['ugroup_title'] );
+ $button = $this->lang->words['ua_savechanges'];
+ }
+
+ //-----------------------------------------
+ // Form elements
+ //-----------------------------------------
+
+ $form['ugroup_title'] = $this->registry->getClass('output')->formInput( 'ugroup_title', $_POST['ugroup_title'] ? $_POST['ugroup_title'] : $ugroup['ugroup_title'] );
+
+ //-----------------------------------------
+ // Navvy Gation
+ //-----------------------------------------
+
+ $this->registry->output->extra_nav[] = array( $this->settings['base_url'].'module=tools§ion=uagents&do=groupsList', $this->lang->words['ua_nav1'] );
+ $this->registry->output->extra_nav[] = array( $this->settings['base_url'].'module=tools§ion=uagents&do=list', $this->lang->words['ua_nav2'] );
+
+ $this->registry->getClass('output')->html .= $this->html->uagents_groupForm( $form, $title, $formcode, $button, $ugroup, $matrixAgents );
+ }
+
+ /**
+ * List available user agent groups
+ *
+ * @return void
+ */
+ private function _listGroups()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $groups = array();
+
+ //-----------------------------------------
+ // Get user agents
+ //-----------------------------------------
+
+ $groups = $this->userAgentFunctions->fetchGroups();
+
+ //-----------------------------------------
+ // Navvy Gation
+ //-----------------------------------------
+
+ $this->registry->output->extra_nav[] = array( $this->settings['base_url'].'module=tools§ion=uagents&do=groupsList', $this->lang->words['ua_nav1'] );
+ $this->registry->output->extra_nav[] = array( $this->settings['base_url'].'module=tools§ion=uagents&do=list', $this->lang->words['ua_nav2'] );
+
+ //-----------------------------------------
+ // Print it...
+ //-----------------------------------------
+
+ $this->registry->output->html .= $this->html->uagents_listUagentGroups( $groups );
+
+ //-----------------------------------------
+ // Reset
+ //-----------------------------------------
+
+ $this->request['do'] = 'groupsList';
+ }
+
+ /**
+ * Rebuild master user agents
+ *
+ * @return string HTML
+ */
+ private function _rebuildMasterUserAgents()
+ {
+ $this->userAgentFunctions->rebuildMasterUserAgents();
+
+ return $this->_listUagents();
+ }
+
+ /**
+ * List available user agents
+ *
+ * @return void
+ */
+ private function _listUagents()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $agents = array();
+
+ //-----------------------------------------
+ // Get user agents
+ //-----------------------------------------
+
+ $matrixAgents = $this->userAgentFunctions->fetchAgents();
+
+ //-----------------------------------------
+ // Navvy Gation
+ //-----------------------------------------
+
+ $this->registry->output->extra_nav[] = array( $this->settings['base_url'].'module=tools§ion=uagents&do=list', $this->lang->words['ua_nav1'] );
+
+ //-----------------------------------------
+ // Print it...
+ //-----------------------------------------
+
+ $this->registry->output->html .= $this->html->uagents_listUagents( $matrixAgents );
+ }
+
+ /**
+ * Reorder useragents
+ *
+ * @return void
+ */
+ private function _uagentsReorder()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
+ $ajax = new $classToLoad();
+
+ //-----------------------------------------
+ // Checks...
+ //-----------------------------------------
+
+ if( $this->registry->adminFunctions->checkSecurityKey( $this->request['md5check'], true ) === false )
+ {
+ $ajax->returnString( $this->lang->words['postform_badmd5'] );
+ exit();
+ }
+
+ //-----------------------------------------
+ // Save new position
+ //-----------------------------------------
+
+ $position = 1;
+
+ if( is_array($this->request['uagents']) AND count($this->request['uagents']) )
+ {
+ foreach( $this->request['uagents'] as $this_id )
+ {
+ $this->DB->update( 'core_uagents', array( 'uagent_position' => $position ), 'uagent_id=' . $this_id );
+
+ $position++;
+ }
+ }
+
+ $ajax->returnString( 'OK' );
+ exit();
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/tools/xml/index.html b/upload/admin/applications/core/modules_admin/tools/xml/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_admin/tools/xml/index.html
+++ b/upload/admin/applications/core/modules_admin/tools/xml/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/tools/xml/menu.xml b/upload/admin/applications/core/modules_admin/tools/xml/menu.xml
index 68f06dee..92a474c5 100644
--- a/upload/admin/applications/core/modules_admin/tools/xml/menu.xml
+++ b/upload/admin/applications/core/modules_admin/tools/xml/menu.xml
@@ -129,6 +129,34 @@
0
-
+
+ -
+
Сервисы публикации ссылок
+
+
+ Сервисы публикации ссылок
+ sharelinks
+
+
+ 0
+
+
+
+ -
+
Правила входящих email
+
+
+ Правила входящих email
+ incomingEmails
+
+
+ 0
+
+
+ getCache('systemvars');
+ return $systemvars['incomingEmails'];
+ ]]>
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_admin/tools/xml/permissions.xml b/upload/admin/applications/core/modules_admin/tools/xml/permissions.xml
index 1e4c6138..1d9fded8 100644
--- a/upload/admin/applications/core/modules_admin/tools/xml/permissions.xml
+++ b/upload/admin/applications/core/modules_admin/tools/xml/permissions.xml
@@ -86,6 +86,15 @@
+
+ Ссылки публикации
+
+ -
+
sharelinks_manage
+ Может добавлять/изменять/удалять ссылки?
+
+
+
User Agents
diff --git a/upload/admin/applications/core/modules_public/ajax/captcha.php b/upload/admin/applications/core/modules_public/ajax/captcha.php
index f555e329..6dcbd9ec 100644
--- a/upload/admin/applications/core/modules_public/ajax/captcha.php
+++ b/upload/admin/applications/core/modules_public/ajax/captcha.php
@@ -1,62 +1,64 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class public_core_ajax_captcha extends ipsAjaxCommand
-{
- /**
- * Main class entry point
- *
- * @access public
- * @param object ipsRegistry reference
- * @return void [Outputs to screen]
- */
- public function doExecute( ipsRegistry $registry )
- {
- switch( ipsRegistry::$request['do'] )
- {
- default:
- case 'refresh':
- $this->refresh();
- break;
-
- }
- }
-
- /**
- * Refresh the captcha image
- *
- * @access public
- * @return void [Outputs to screen]
- */
- public function refresh()
- {
- $captcha_unique_id = trim( IPSText::alphanumericalClean( ipsRegistry::$request['captcha_unique_id'] ) );
-
- $template = $this->registry->getClass('class_captcha')->getTemplate( $captcha_unique_id );
- $newUniqueID = $this->registry->getClass('class_captcha')->captchaKey;
-
- $this->returnString( $newUniqueID );
- }
-
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Update captcha image
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 2.3
+ * @version $Revision: 5713 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_ajax_captcha extends ipsAjaxCommand
+{
+ /**
+ * Main class entry point
+ *
+ * @access public
+ * @param object ipsRegistry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ switch( ipsRegistry::$request['do'] )
+ {
+ default:
+ case 'refresh':
+ $this->refresh();
+ break;
+
+ }
+ }
+
+ /**
+ * Refresh the captcha image
+ *
+ * @access public
+ * @return void [Outputs to screen]
+ */
+ public function refresh()
+ {
+ $captcha_unique_id = trim( IPSText::alphanumericalClean( ipsRegistry::$request['captcha_unique_id'] ) );
+
+ $template = $this->registry->getClass('class_captcha')->getTemplate( $captcha_unique_id );
+ $newUniqueID = $this->registry->getClass('class_captcha')->captchaKey;
+
+ $this->returnString( $newUniqueID );
+ }
+
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/ajax/comments.php b/upload/admin/applications/core/modules_public/ajax/comments.php
new file mode 100644
index 00000000..4bcf386e
--- /dev/null
+++ b/upload/admin/applications/core/modules_public/ajax/comments.php
@@ -0,0 +1,242 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Image Ajax
+ * Last Updated: $LastChangedDate: 2010-08-18 16:55:30 +0100 (Wed, 18 Aug 2010) $
+ *
+ *
+ * @author $Author: matt $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Gallery
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6767 $
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_ajax_comments extends ipsAjaxCommand
+{
+ /**
+ * Main class entry point
+ *
+ * @param object ipsRegistry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* From App */
+ $fromApp = trim( $this->request['fromApp'] );
+
+ /* Init some data */
+ require_once( IPS_ROOT_PATH . 'sources/classes/comments/bootstrap.php' );
+ $this->_comments = classes_comments_bootstrap::controller( $fromApp );
+
+ /* What to do? */
+ switch( $this->request['do'] )
+ {
+ case 'add':
+ $this->_add();
+ break;
+ case 'delete':
+ $this->_delete();
+ break;
+ case 'showEdit':
+ $this->_showEdit();
+ break;
+ case 'saveEdit':
+ $this->_saveEdit();
+ break;
+ case 'fetchReply':
+ $this->_fetchReply();
+ break;
+ case 'moderate':
+ $this->_moderate();
+ break;
+ }
+ }
+
+ /**
+ * Moderate
+ *
+ * @return void
+ */
+ protected function _moderate()
+ {
+ $parentId = intval( $this->request['parentId'] );
+ $commentIds = ( is_array( $_POST['commentIds'] ) ) ? IPSLib::cleanIntArray( $_POST['commentIds'] ) : array();
+ $modact = trim( $this->request['modact'] );
+
+ if ( count( $commentIds ) )
+ {
+ try
+ {
+ $this->_comments->moderate( $modact, $parentId, $commentIds, $this->memberData );
+
+ $this->returnJsonArray( array( 'msg' => 'ok' ) );
+ }
+ catch( Exception $error )
+ {
+ $this->returnJsonError( 'Error ' . $error->getMessage() . ' line: ' . $error->getFile() . '.' . $error->getLine() );
+ }
+ }
+ }
+
+ /**
+ * Reply
+ *
+ * @return void
+ */
+ protected function _fetchReply()
+ {
+ /* INIT */
+ $commentId = intval( $this->request['comment_id'] );
+ $parentId = intval( $this->request['parentId'] );
+
+ /* Quick error checko */
+ if ( ! $commentId OR ! $parentId )
+ {
+ $this->returnString( 'error' );
+ }
+
+ # Get Edit form
+ try
+ {
+ $html = $this->_comments->fetchReply( $parentId, $commentId, $this->memberData );
+
+ $this->returnString( $html );
+ }
+ catch ( Exception $error )
+ {
+ $this->returnString( 'Error ' . $error->getMessage() );
+ }
+ }
+
+
+ /**
+ * Deletes a comment
+ *
+ * @return void
+ */
+ protected function _delete()
+ {
+ /* INIT */
+ $commentId = intval( $this->request['comment_id'] );
+ $parentId = intval( $this->request['parentId'] );
+
+ /* Quick error checko */
+ if ( ! $commentId OR ! $parentId )
+ {
+ $this->returnJsonError( 'error' );
+ }
+
+ try
+ {
+ $this->_comments->delete( $parentId, $commentId, $this->memberData );
+
+ $this->returnJsonArray( array( 'msg' => 'ok' ) );
+ }
+ catch ( Exception $error )
+ {
+ $this->returnJsonError( 'Error ' . $error->getMessage() );
+ }
+ }
+
+ /**
+ * Shows the edit box
+ *
+ * @return void
+ */
+ protected function _showEdit()
+ {
+ /* INIT */
+ $commentId = intval( $this->request['comment_id'] );
+ $parentId = intval( $this->request['parentId'] );
+
+ /* Quick error checko */
+ if ( ! $commentId OR ! $parentId )
+ {
+ $this->returnString( 'error' );
+ }
+
+ # Get Edit form
+ try
+ {
+ $html = $this->_comments->displayAjaxEditForm( $parentId, $commentId, $this->memberData );
+
+ $html = $this->registry->output->replaceMacros( $html );
+
+ $this->returnHtml( $html );
+ }
+ catch ( Exception $error )
+ {
+ $this->returnString( 'Error ' . $error->getMessage() );
+ }
+ }
+
+ /**
+ * Saves the post
+ *
+ * @return void
+ */
+ protected function _saveEdit()
+ {
+ /* INIT */
+ $commentId = intval( $this->request['comment_id'] );
+ $parentId = intval( $this->request['parentId'] );
+ $post = IPSText::parseCleanValue( $_POST['Post'] );
+
+ /* Quick error checko */
+ if ( ! $parentId OR ! $commentId )
+ {
+ $this->returnString( 'error' );
+ }
+
+ /* Edit */
+ try
+ {
+ $output = $this->_comments->edit( $parentId, $commentId, $_POST['Post'], $this->memberData );
+
+ $this->returnJsonArray( array( 'successString' => $this->registry->output->replaceMacros( $output ) ) );
+ }
+ catch ( Exception $error )
+ {
+ $this->returnJsonError( $error->getMessage() );
+ }
+ }
+
+ /**
+ * Add a comment via the magic and mystery of ajax
+ *
+ * @return void
+ */
+ protected function _add()
+ {
+ /* init */
+ $post = IPSText::parseCleanValue( $_POST['Post'] );
+ $parentId = intval( $this->request['parentId'] );
+
+ if ( $post AND $parentId )
+ {
+ try
+ {
+ $newCommentId = $this->_comments->add( $parentId, $_POST['Post'] );
+ return $this->returnHtml( $this->_comments->fetchFormattedSingle( $parentId, $newCommentId ) );
+ }
+ catch( Exception $e )
+ {
+ $this->returnJsonError( 'no_permission: ' . $e->getMessage() . var_export( $e, true ) );
+ }
+ }
+ else
+ {
+ $this->returnJsonError( 'no_permission');
+ }
+ }
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/ajax/defaultSection.php b/upload/admin/applications/core/modules_public/ajax/defaultSection.php
index 624172f8..053d4be8 100644
--- a/upload/admin/applications/core/modules_public/ajax/defaultSection.php
+++ b/upload/admin/applications/core/modules_public/ajax/defaultSection.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Define the default ajax section
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4948 $
+ * @version $Rev: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_public/ajax/editor.php b/upload/admin/applications/core/modules_public/ajax/editor.php
deleted file mode 100644
index e5a5acec..00000000
--- a/upload/admin/applications/core/modules_public/ajax/editor.php
+++ /dev/null
@@ -1,154 +0,0 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class public_core_ajax_editor extends ipsAjaxCommand
-{
- /**
- * Class entry point
- *
- * @access public
- * @param object Registry reference
- * @return void [Outputs to screen]
- */
- public function doExecute( ipsRegistry $registry )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $to_rte = intval( $this->request['to_rte'] );
- $post = $this->convertUnicode( $_POST['Post'] );
- $post = IPSText::stripslashes($post);
- //$post = $this->convertHtmlEntities( $post );
-
- //-----------------------------------------
- // Load BBCode
- //-----------------------------------------
-
- require_once( IPS_ROOT_PATH . 'sources/classes/bbcode/core.php' );
- require_once( IPS_ROOT_PATH . 'sources/classes/bbcode/normal.php' );
-
- $bbcode = new class_bbcode_normal( $this->registry );
- $bbcode->parse_bbcode = 1;
- $bbcode->parse_html = 0;
- $bbcode->parse_nl2br = 1;
- $bbcode->parse_smilies = 1;
- $bbcode->parsing_section = 'topics';
-
- //-----------------------------------------
- // Converting from STD to RTE?
- //-----------------------------------------
-
- if ( $to_rte )
- {
- //-----------------------------------------
- // Ensure no slashy slashy
- //-----------------------------------------
-
- $post = str_replace( '"','"', $post );
- $post = str_replace( "'",''', $post );
-
- //-----------------------------------------
- // Convert <>
- //-----------------------------------------
-
- $post = str_replace( '<', '<', $post );
- $post = str_replace( '>', '>', $post );
-
- $post = $bbcode->convertForRTE( $bbcode->preDbParse( $post ) );
-
- //-----------------------------------------
- // Convert <>
- //-----------------------------------------
-
- $post = str_replace( '<', '<', $post );
- $post = str_replace( '>', '>', $post );
-
- //-----------------------------------------
- // Fix up...
- //-----------------------------------------
-
- $post = $this->registry->output->replaceMacros( $post );
-
- //-----------------------------------------
- // Make sure no nasty HTML entities show
- //-----------------------------------------
-
- $post = IPSText::htmlspecialchars( $post );
- }
- //-----------------------------------------
- // Converting from RTE to STD
- //-----------------------------------------
-
- else
- {
- require_once( IPS_ROOT_PATH . 'sources/classes/editor/class_editor.php' );
- require_once( IPS_ROOT_PATH . 'sources/classes/editor/class_editor_rte.php' );
-
- //-----------------------------------------
- // Ok, now, apparently, for SOME reason, IE
- // strips SOME comments but not others...
- // this causes font/span stuff to break.
- // Let's just strip all the comments
- //-----------------------------------------
-
- if ( $this->member->browser['browser'] == "ie" OR $this->member->browser['browser'] == "opera" )
- {
- $post = preg_replace( "#<\!--(.*?)-->#is", "" , $post );
- }
-
- //-----------------------------------------
- // IE has this thing where [center]text[/center]
- // Becomes [b][center][b]text[/b][/center][/b]
- //-----------------------------------------
-
- $rte = new class_editor_module( $this->registry );
- $post = $bbcode->preEditParse( $post );
- $post = $rte->processAfterForm( $post );
-
- //-----------------------------------------
- // Fix up...
- //-----------------------------------------
-
- $post = preg_replace( "/ | /", "\n", $post );
- }
-
- //-----------------------------------------
- // Member? Store choice...
- //-----------------------------------------
-
- if ( $this->memberData['member_id'] )
- {
- $_choice = ( $to_rte ) ? 'rte' : 'std';
-
- IPSMember::save( $this->memberData['member_id'], array( 'members' => array( 'members_editor_choice' => $_choice ) ) );
- }
-
- $post = trim( html_entity_decode($post) );
-
- $this->returnHtml( $post );
- }
-}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/ajax/facebook.php b/upload/admin/applications/core/modules_public/ajax/facebook.php
index 44b8a4d2..ebd8d57f 100644
--- a/upload/admin/applications/core/modules_public/ajax/facebook.php
+++ b/upload/admin/applications/core/modules_public/ajax/facebook.php
@@ -1,116 +1,97 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class public_core_ajax_facebook extends ipsAjaxCommand
-{
- /**
- * Login handler object
- *
- * @access protected
- * @var object
- */
- protected $han_login;
-
- /**
- * Flag : Logged in
- *
- * @access protected
- * @var boolean
- */
- protected $logged_in = false;
-
- /**
- * Class entry point
- *
- * @access public
- * @param object Registry reference
- * @return void [Outputs to screen]
- */
- public function doExecute( ipsRegistry $registry )
- {
- /* What to do */
- switch( $this->request['do'] )
- {
- case 'getUserByFbId':
- $return = $this->_getUserByFbId();
- break;
- case 'setAllowEmailAccess':
- $return = $this->_setAllowEmailAccess();
- break;
- }
-
- /* Output */
- $this->returnHtml( $return );
- }
-
- /**
- * Allow facebook email access set
- *
- * @access private
- * @return void [Outputs JSON to browser AJAX call]
- */
- private function _setAllowEmailAccess()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $memberID = intval( $this->memberData['member_id'] );
-
- IPSMember::update( $memberID, array( 'core' => array( 'fb_emailallow' => 1 ) ) );
-
- $this->returnJsonArray( array( 'status' => 'ok' ) );
- }
-
- /**
- * Main AJAX log in routine
- *
- * @access private
- * @return void [Outputs JSON to browser AJAX call]
- */
- private function _getUserByFbId()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $fbUid = is_numeric( $this->request['fbid'] ) ? $this->request['fbid'] : 0;
- $member = array( 'member_id' => 0 );
-
- if ( $fbUid )
- {
- $_mid = $this->DB->buildAndFetch( array( 'select' => 'member_id',
- 'from' => 'members',
- 'where' => 'fb_uid=' . $fbUid ) );
-
- if ( $_mid['member_id'] )
- {
- $member = IPSMember::load( $_mid['member_id'], 'all' );
- }
- }
-
- $this->returnJsonArray( $member );
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Login handler abstraction : AJAX login
+ * Last Updated: $Date: 2010-01-25 11:58:04 -0500 (Mon, 25 Jan 2010) $
+ *
+ *
+ * @author $Author: matt $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since Tuesday 1st March 2005 (11:52)
+ * @version $Revision: 5747 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_ajax_facebook extends ipsAjaxCommand
+{
+ /**
+ * Login handler object
+ *
+ * @access protected
+ * @var object
+ */
+ protected $han_login;
+
+ /**
+ * Flag : Logged in
+ *
+ * @access protected
+ * @var boolean
+ */
+ protected $logged_in = false;
+
+ /**
+ * Class entry point
+ *
+ * @access public
+ * @param object Registry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* What to do */
+ switch( $this->request['do'] )
+ {
+ case 'getUserByFbId':
+ $return = $this->_getUserByFbId();
+ break;
+ }
+
+ /* Output */
+ $this->returnHtml( $return );
+ }
+
+
+ /**
+ * Main AJAX log in routine
+ *
+ * @access private
+ * @return void [Outputs JSON to browser AJAX call]
+ */
+ private function _getUserByFbId()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $fbUid = is_numeric( $this->request['fbid'] ) ? $this->request['fbid'] : 0;
+ $member = array( 'member_id' => 0 );
+
+ if ( $fbUid )
+ {
+ $_mid = $this->DB->buildAndFetch( array( 'select' => 'member_id',
+ 'from' => 'members',
+ 'where' => 'fb_uid=' . $fbUid ) );
+
+ if ( $_mid['member_id'] )
+ {
+ $member = IPSMember::load( $_mid['member_id'], 'all' );
+ }
+ }
+
+ $this->returnJsonArray( $member );
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/ajax/findnames.php b/upload/admin/applications/core/modules_public/ajax/findnames.php
index cf9222c3..3f024d3e 100644
--- a/upload/admin/applications/core/modules_public/ajax/findnames.php
+++ b/upload/admin/applications/core/modules_public/ajax/findnames.php
@@ -1,108 +1,111 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class public_core_ajax_findnames extends ipsAjaxCommand
-{
- /**
- * Class entry point
- *
- * @access public
- * @param object Registry reference
- * @return void [Outputs to screen]
- */
- public function doExecute( ipsRegistry $registry )
- {
- switch( $this->request['do'] )
- {
- case 'get-member-names':
- $this->_getMemberNames();
- break;
- }
- }
-
- /**
- * Returns possible matches for the string input
- *
- * @access private
- * @return void Outputs to screen
- */
- private function _getMemberNames()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $name = $this->convertAndMakeSafe( ipsRegistry::$request['name'], 0 );
-
- //-----------------------------------------
- // Check length
- //-----------------------------------------
-
- if ( IPSText::mbstrlen( $name ) < 3 )
- {
- $this->returnJsonError( 'requestTooShort' );
- }
-
- //-----------------------------------------
- // Try query...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => 'm.members_display_name, m.name, m.member_id, m.member_group_id',
- 'from' => array( 'members' => 'm' ),
- 'where' => "m.members_l_display_name LIKE '" . $this->DB->addSlashes( strtolower( $name ) ) . "%'",
- 'order' => $this->DB->buildLength( 'm.members_display_name' ) . ' ASC',
- 'limit' => array( 0, 15 ),
- 'add_join' => array( array( 'select' => 'p.*',
- 'from' => array( 'profile_portal' => 'p' ),
- 'where' => 'p.pp_member_id=m.member_id',
- 'type' => 'left' ) ) ) );
- $this->DB->execute();
-
- //-----------------------------------------
- // Got any results?
- //-----------------------------------------
-
- if ( ! $this->DB->getTotalRows() )
- {
- $this->returnJsonArray( array( ) );
- }
-
- $return = array();
-
- while( $r = $this->DB->fetch() )
- {
- $photo = IPSMember::buildProfilePhoto( $r );
- $group = IPSLib::makeNameFormatted( '' , $r['member_group_id'] );
- $return[ $r['member_id'] ] = array( 'name' => $r['members_display_name'],
- 'showas'=> '' . $r['members_display_name'] . ' (' . $group . ')',
- 'img' => $photo['pp_thumb_photo'],
- 'img_w' => $photo['pp_mini_width'],
- 'img_h' => $photo['pp_mini_height']
- );
- }
-
- $this->returnJsonArray( $return );
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Login handler abstraction : AJAX Find Names functions
+ * Last Updated: $Date: 2010-04-14 19:25:27 -0400 (Wed, 14 Apr 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since Tuesday 1st March 2005 (11:52)
+ * @version $Revision: 6118 $
+ * @see admin_core_ajax_findnames
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_ajax_findnames extends ipsAjaxCommand
+{
+ /**
+ * Class entry point
+ *
+ * @access public
+ * @param object Registry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ switch( $this->request['do'] )
+ {
+ case 'get-member-names':
+ $this->_getMemberNames();
+ break;
+ }
+ }
+
+ /**
+ * Returns possible matches for the string input
+ *
+ * @access private
+ * @return void Outputs to screen
+ */
+ private function _getMemberNames()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $name = IPSText::convertUnicode( $this->convertAndMakeSafe( ipsRegistry::$request['name'], 0 ) );
+
+ //-----------------------------------------
+ // Check length
+ //-----------------------------------------
+
+ if ( IPSText::mbstrlen( $name ) < 3 )
+ {
+ $this->returnJsonError( 'requestTooShort' );
+ }
+
+ //-----------------------------------------
+ // Try query...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => 'm.members_display_name, m.name, m.member_id, m.member_group_id',
+ 'from' => array( 'members' => 'm' ),
+ 'where' => "m.members_l_display_name LIKE '" . $this->DB->addSlashes( mb_strtolower( $name ) ) . "%'",
+ 'order' => $this->DB->buildLength( 'm.members_display_name' ) . ' ASC',
+ 'limit' => array( 0, 15 ),
+ 'add_join' => array( array( 'select' => 'p.*',
+ 'from' => array( 'profile_portal' => 'p' ),
+ 'where' => 'p.pp_member_id=m.member_id',
+ 'type' => 'left' ) ) ) );
+ $this->DB->execute();
+
+ //-----------------------------------------
+ // Got any results?
+ //-----------------------------------------
+
+ if ( ! $this->DB->getTotalRows() )
+ {
+ $this->returnJsonArray( array( ) );
+ }
+
+ $return = array();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $photo = IPSMember::buildProfilePhoto( $r );
+ $group = IPSLib::makeNameFormatted( '' , $r['member_group_id'] );
+ $return[ $r['member_id'] ] = array( 'name' => $r['members_display_name'],
+ 'showas'=> '' . $r['members_display_name'] . ' (' . $group . ')',
+ 'img' => $photo['pp_thumb_photo'],
+ 'img_w' => $photo['pp_mini_width'],
+ 'img_h' => $photo['pp_mini_height']
+ );
+ }
+
+ $this->returnJsonArray( $return );
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/ajax/index.html b/upload/admin/applications/core/modules_public/ajax/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_public/ajax/index.html
+++ b/upload/admin/applications/core/modules_public/ajax/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/ajax/like.php b/upload/admin/applications/core/modules_public/ajax/like.php
new file mode 100644
index 00000000..6ff65489
--- /dev/null
+++ b/upload/admin/applications/core/modules_public/ajax/like.php
@@ -0,0 +1,151 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Like Ajax
+ * Last Updated: $LastChangedDate: 2010-08-18 16:55:30 +0100 (Wed, 18 Aug 2010) $
+ *
+ *
+ * @author $Author: matt $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Gallery
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6767 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_ajax_like extends ipsAjaxCommand
+{
+ /**
+ * Main class entry point
+ *
+ * @param object ipsRegistry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* From App */
+ $app = trim( $this->request['f_app'] );
+ $area = trim( $this->request['f_area'] );
+ $relid = intval( $this->request['f_relid'] );
+
+ if ( ! $app OR ! $area OR empty( $relid ) )
+ {
+ trigger_error( "Missing data in " . __FILE__ . ' ' . __LINE__ );
+ }
+
+ /* Init some data */
+ require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );
+ $this->_like = classes_like::bootstrap( $app, $area );
+
+ $this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_like' ), 'core' );
+
+ /* What to do? */
+ switch( $this->request['do'] )
+ {
+ case 'setDialogue':
+ $this->_setDialogue( $app, $area, $relid );
+ break;
+ case 'save':
+ $this->_save( $app, $area, $relid );
+ break;
+ case 'unset':
+ $this->_unset( $app, $area, $relid );
+ break;
+ case 'more':
+ $this->_more( $app, $area, $relid );
+ break;
+ }
+ }
+
+ /**
+ * Show more dialogue
+ *
+ * @param string App
+ * @param string Area
+ * @param int Relationship ID
+ * @return void
+ */
+ protected function _more( $app, $area, $relid )
+ {
+ /* Fetch data */
+ return $this->returnHtml( $this->_like->render( 'more', $relid ) );
+ }
+
+ /**
+ * Do unset
+ *
+ * @param string App
+ * @param string Area
+ * @param int Relationship ID
+ * @return void
+ */
+ protected function _unset( $app, $area, $relid )
+ {
+ if( !$this->memberData['member_id'] )
+ {
+ return $this->returnNull();
+ }
+
+ /* Set data */
+ $this->_like->remove( $relid, $this->memberData['member_id'] );
+
+ /* Fetch data */
+ return $this->returnHtml( $this->_like->render( 'summary', $relid ) );
+ }
+
+ /**
+ * Save form
+ *
+ * @param string App
+ * @param string Area
+ * @param int Relationship ID
+ * @return void
+ */
+ protected function _save( $app, $area, $relid )
+ {
+ if( !$this->memberData['member_id'] )
+ {
+ return $this->returnNull();
+ }
+
+ $like_notify = intval( $this->request['like_notify'] );
+ $like_freq = trim( $this->request['like_freq'] );
+ $like_anon = intval( $this->request['like_anon'] );
+
+ /* Set data */
+ $this->_like->add( $relid, $this->memberData['member_id'], array( 'like_notify_do' => $like_notify, 'like_notify_freq' => $like_freq ), $like_anon );
+
+ /* Fetch data */
+ return $this->returnHtml( $this->_like->render( 'summary', $relid ) );
+ }
+
+ /**
+ * Show set form
+ *
+ * @param string App
+ * @param string Area
+ * @param int Relationship ID
+ * @return void
+ */
+ protected function _setDialogue( $app, $area, $relid )
+ {
+ if( !$this->memberData['member_id'] )
+ {
+ return $this->returnNull();
+ }
+
+ $data = $this->_like->getDataForSetDialogue( $relid );
+
+ return $this->returnHtml( $this->registry->getClass('output')->getTemplate('global_other')->likeSetDialogue( $app, $area, $relid, $data ) );
+ }
+
+}
diff --git a/upload/admin/applications/core/modules_public/ajax/login.php b/upload/admin/applications/core/modules_public/ajax/login.php
index 96050fb3..670c9292 100644
--- a/upload/admin/applications/core/modules_public/ajax/login.php
+++ b/upload/admin/applications/core/modules_public/ajax/login.php
@@ -1,144 +1,139 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class public_core_ajax_login extends ipsAjaxCommand
-{
- /**
- * Login handler object
- *
- * @access protected
- * @var object
- */
- protected $han_login;
-
- /**
- * Flag : Logged in
- *
- * @access protected
- * @var boolean
- */
- protected $logged_in = false;
-
- /**
- * Class entry point
- *
- * @access public
- * @param object Registry reference
- * @return void [Outputs to screen]
- */
- public function doExecute( ipsRegistry $registry )
- {
- //-----------------------------------------
- // Load handler...
- //-----------------------------------------
-
- require_once( IPS_ROOT_PATH . 'sources/handlers/han_login.php' );
- $this->han_login = new han_login( $this->registry );
- $this->han_login->init();
-
- $this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_login' ), 'core' );
-
- //-----------------------------------------
- // Show form or process login?
- //-----------------------------------------
-
- if ( $this->request['do'] == 'showForm' )
- {
- $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];
- }
-
- $this->returnHtml( $this->registry->getClass('output')->getTemplate('global')->loginForm( $replace == 'replace' ? true : false, $data ) );
- }
- else if ( $this->request['do'] == 'authenticateUser' )
- {
- return $this->_authenticateUser();
- }
- else
- {
- return $this->_doLogIn();
- }
- }
-
- /**
- * Authenticate a user, returns a JSON array
- *
- * @access private
- * @return void [Outputs JSON to browser AJAX call]
- */
- private function _authenticateUser()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $email = $this->request['emailaddress'];
- $password = $this->request['password'];
-
- /* Force email check */
- $this->han_login->setForceEmailCheck( TRUE );
-
- $return = $this->han_login->loginPasswordCheck( '', $email, $password );
-
- if ( $return !== TRUE )
- {
- $this->returnJsonArray( array( 'status' => 'error' ) );
- }
- else
- {
- $this->returnJsonArray( array( 'status' => 'ok', 'memberData' => $this->han_login->member_data ) );
- }
- }
-
- /**
- * Main AJAX log in routine
- *
- * @access private
- * @return void [Outputs JSON to browser AJAX call]
- */
- private function _doLogIn()
- {
- //-----------------------------------------
- // Use central method
- //-----------------------------------------
-
- $return = $this->han_login->verifyLogin();
-
- if( is_array($return[2]) AND count($return[2]) )
- {
- $this->returnJsonArray( array( 'error' => $return[2]['MSG'] ) );
- }
- else
- {
- $this->returnJsonArray( array( 'message' => $return[0], 'url' => $return[1] ) );
- }
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Login handler abstraction : AJAX login
+ * Last Updated: $Date: 2010-10-19 10:40:05 -0400 (Tue, 19 Oct 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since Tuesday 1st March 2005 (11:52)
+ * @version $Revision: 6995 $
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_ajax_login extends ipsAjaxCommand
+{
+ /**
+ * Login handler object
+ *
+ * @var object
+ */
+ protected $han_login;
+
+ /**
+ * Flag : Logged in
+ *
+ * @var boolean
+ */
+ protected $logged_in = false;
+
+ /**
+ * Class entry point
+ *
+ * @param object Registry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ //-----------------------------------------
+ // Load handler...
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $this->han_login = new $classToLoad( $this->registry );
+ $this->han_login->init();
+
+ $this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_login' ), 'core' );
+
+ //-----------------------------------------
+ // Show form or process login?
+ //-----------------------------------------
+
+ if ( $this->request['do'] == 'showForm' )
+ {
+ $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];
+ }
+
+ $this->returnHtml( $this->registry->getClass('output')->getTemplate('global')->loginForm( $replace == 'replace' ? true : false, $data ) );
+ }
+ else if ( $this->request['do'] == 'authenticateUser' )
+ {
+ return $this->_authenticateUser();
+ }
+ else
+ {
+ return $this->_doLogIn();
+ }
+ }
+
+ /**
+ * Authenticate a user, returns a JSON array
+ *
+ * @return void [Outputs JSON to browser AJAX call]
+ */
+ private function _authenticateUser()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $email = $this->request['emailaddress'];
+ $password = $this->request['password'];
+
+ /* Force email check */
+ $this->han_login->setForceEmailCheck( TRUE );
+
+ $return = $this->han_login->loginPasswordCheck( '', $email, $password );
+
+ if ( $return !== TRUE )
+ {
+ $this->returnJsonArray( array( 'status' => 'error' ) );
+ }
+ else
+ {
+ $this->returnJsonArray( array( 'status' => 'ok', 'memberData' => $this->han_login->member_data ) );
+ }
+ }
+
+ /**
+ * Main AJAX log in routine
+ *
+ * @return void [Outputs JSON to browser AJAX call]
+ */
+ private function _doLogIn()
+ {
+ //-----------------------------------------
+ // Use central method
+ //-----------------------------------------
+
+ $return = $this->han_login->verifyLogin();
+
+ if( is_array($return[2]) AND count($return[2]) )
+ {
+ $this->returnJsonArray( array( 'error' => $return[2]['MSG'] ) );
+ }
+ else
+ {
+ $this->returnJsonArray( array( 'message' => $return[0], 'url' => $return[1] ) );
+ }
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/ajax/notifications.php b/upload/admin/applications/core/modules_public/ajax/notifications.php
new file mode 100644
index 00000000..bae41893
--- /dev/null
+++ b/upload/admin/applications/core/modules_public/ajax/notifications.php
@@ -0,0 +1,180 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Notification AJAX methods
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since Tuesday 1st March 2005 (11:52)
+ * @version $Revision: 5713 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_ajax_notifications extends ipsAjaxCommand
+{
+ /**
+ * Class entry point
+ *
+ * @access public
+ * @param object Registry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ switch( $this->request['do'] )
+ {
+ case 'getlatest':
+ default:
+ $this->getMyNotifications();
+ break;
+
+ case 'getNextNotification':
+ $this->getMoreNotifications( 'DESC' );
+ break;
+
+ case 'getLastNotification':
+ $this->getMoreNotifications( 'ASC' );
+ break;
+ }
+ }
+
+ /**
+ * Retrieve next notification for user
+ *
+ * @access protected
+ * @param string Database order (asc/desc)
+ * @return void [Outputs JSON to browser AJAX call]
+ */
+ protected function getMoreNotifications( $dir='DESC' )
+ {
+ //-----------------------------------------
+ // We logged in?
+ //-----------------------------------------
+
+ if( !$this->memberData['member_id'] )
+ {
+ $this->returnJsonError( $this->lang->words['notifylogin_error'] );
+ }
+
+ //-----------------------------------------
+ // Retrieve notifications
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
+ $notifyLibrary = new $classToLoad( $this->registry );
+ $notifyLibrary->setMember( $this->memberData );
+
+ $_data = $notifyLibrary->fetchUnreadNotifications( 50, 'notify_sent', $dir );
+
+ //-----------------------------------------
+ // Now we loop through and set has previous,
+ // has more, and get "next" notification
+ //-----------------------------------------
+
+ $_hasPrevious = false;
+ $_hasNext = false;
+ $_hitId = false;
+ $_gotNext = false;
+ $_thisNotify = array();
+
+ foreach( $_data as $k => $v )
+ {
+ if( !$_hitId )
+ {
+ if( $v['notify_id'] == $this->request['last'] )
+ {
+ $_hitId = true;
+ }
+
+ $_hasPrevious = true;
+ continue;
+ }
+
+ if( !$_gotNext )
+ {
+ $_gotNext = true;
+ $_thisNotify = $v;
+ continue;
+ }
+
+ $_hasNext = true;
+ break;
+ }
+
+ if( count($_thisNotify) )
+ {
+ $_thisNotify['notify_date_formatted'] = $this->registry->class_localization->getDate( $_thisNotify['notify_sent'], 'short' );
+
+ $_thisNotify['has_more'] = $_hasNext;
+ $_thisNotify['has_previous'] = $_hasPrevious;
+ }
+ else
+ {
+ $_thisNotify['error'] = $this->lang->words['nomore_notifications_4u'];
+ }
+
+ if( !$_thisNotify['notify_url'] )
+ {
+ $_thisNotify['notify_url'] = $this->registry->output->buildSEOUrl( "app=core&module=usercp&area=viewNotification&do=view&view={$_thisNotify['notify_id']}", 'public' );
+ }
+
+ $this->returnJsonArray( $_thisNotify );
+ }
+
+ /**
+ * Retrieve user's last x notifications
+ *
+ * @access protected
+ * @return void [Outputs JSON to browser AJAX call]
+ */
+ protected function getMyNotifications()
+ {
+ //-----------------------------------------
+ // We logged in?
+ //-----------------------------------------
+
+ if( !$this->memberData['member_id'] )
+ {
+ $this->returnJsonError( $this->lang->words['notifylogin_error'] );
+ }
+
+ //-----------------------------------------
+ // Retrieve notifications
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
+ $notifyLibrary = new $classToLoad( $this->registry );
+ $notifyLibrary->setMember( $this->memberData );
+
+ $_data = $notifyLibrary->fetchUnreadNotifications( 10, 'notify_sent', 'DESC', false );
+
+ //-----------------------------------------
+ // Now mark them all read
+ //-----------------------------------------
+
+ $this->DB->update( 'inline_notifications', array( 'notify_read' => 1 ), 'notify_to_id=' . $this->memberData['member_id'] );
+
+ $notifyLibrary->rebuildUnreadCount();
+
+ //-----------------------------------------
+ // Return results
+ //-----------------------------------------
+
+ $this->returnJsonArray( array( 'html' => $this->registry->output->getTemplate('global_other')->notificationsList( $_data ) ) );
+ }
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/ajax/register.php b/upload/admin/applications/core/modules_public/ajax/register.php
index 33bce4e2..78561048 100644
--- a/upload/admin/applications/core/modules_public/ajax/register.php
+++ b/upload/admin/applications/core/modules_public/ajax/register.php
@@ -1,183 +1,194 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class public_core_ajax_register extends ipsAjaxCommand
-{
- /**
- * Main class entry point
- *
- * @access public
- * @param object ipsRegistry reference
- * @return void [Outputs to screen]
- */
- public function doExecute( ipsRegistry $registry )
- {
- switch( ipsRegistry::$request['do'] )
- {
- case 'check-display-name':
- $this->checkDisplayName( 'members_display_name' );
- break;
- case 'check-user-name':
- $this->checkDisplayName( 'name' );
- break;
- case 'check-email-address':
- $this->checkEmail();
- break;
- }
- }
-
- /**
- * Check the email address
- *
- * @access public
- * @return void [Outputs to screen]
- */
- public function checkEmail()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $email = '';
-
- if( is_string($_REQUEST['email']) )
- {
- $email = mb_strtolower( IPSText::parseCleanValue( rawurldecode( $_REQUEST['email'] ) ) );
- }
-
- if( !$email )
- {
- $this->returnString('found');
- }
-
- if( !IPSText::checkEmailAddress( $email ) )
- {
- $this->returnString('found');
- }
-
- //-----------------------------------------
- // Got the member?
- //-----------------------------------------
-
- if ( ! IPSMember::checkByEmail( $email ) )
- {
- //-----------------------------------------
- // Load ban filters
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'banfilters' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $banfilters[ $r['ban_type'] ][] = $r['ban_content'];
- }
-
- //-----------------------------------------
- // Are they banned [EMAIL]?
- //-----------------------------------------
-
- if ( is_array( $banfilters['email'] ) and count( $banfilters['email'] ) )
- {
- foreach ( $banfilters['email'] as $memail )
- {
- $memail = str_replace( "\*", '.*' , preg_quote($memail, "/") );
-
- if ( preg_match( "/$memail/", $email ) )
- {
- $this->returnString('banned');
- break;
- }
- }
- }
-
- //-----------------------------------------
- // Load handler...
- //-----------------------------------------
-
- require_once( IPS_ROOT_PATH . 'sources/handlers/han_login.php' );
- $han_login = new han_login( $this->registry );
- $han_login->init();
-
- if( $han_login->emailExistsCheck( $email ) )
- {
- $this->returnString('found');
- }
-
- $this->returnString('notfound');
- }
- else
- {
- $this->returnString('found');
- }
- }
-
- /**
- * Check the name or display name
- *
- * @access public
- * @return void [Outputs to screen]
- */
- public function checkDisplayName( $field='members_display_name' )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $this->registry->class_localization->loadLanguageFile( array( 'public_register' ) );
- $name = '';
-
- if( is_string($_POST['name']) )
- {
- $name = mb_strtolower( trim( rawurldecode( $_POST['name'] ) ) );
- }
-
- if( !$name )
- {
- $this->returnString( sprintf( ipsRegistry::getClass( 'class_localization' )->words['reg_error_no_name'], ipsRegistry::$settings['max_user_name_length'] ) );
- }
-
- /* Check the username */
- $user_check = IPSMember::getFunction()->cleanAndCheckName( $name, array(), $field );
-
- $errorField = $field == 'members_display_name' ? 'dname' : 'username';
- $nameField = $field == 'members_display_name' ? 'members_display_name' : 'username';
-
- if( is_array( $user_check['errors'][ $errorField ] ) && count( $user_check['errors'][ $errorField ] ) )
- {
- $this->returnString( $user_check['errors'][ $errorField ][0] );
- return;
- }
- else if( $user_check['errors'][ $errorField ] )
- {
- $this->returnString( $user_check['errors'][ $errorField ] );
- }
- else
- {
- $this->returnString('notfound');
- }
-
- }
-
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Registration AJAX routines
+ * Last Updated: $Date: 2010-10-19 10:40:05 -0400 (Tue, 19 Oct 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since Who knows...
+ * @version $Revision: 6995 $
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_ajax_register extends ipsAjaxCommand
+{
+ /**
+ * Main class entry point
+ *
+ * @param object ipsRegistry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ switch( ipsRegistry::$request['do'] )
+ {
+ case 'check-display-name':
+ $this->checkDisplayName( 'members_display_name' );
+ break;
+ case 'check-user-name':
+ $this->checkDisplayName( 'name' );
+ break;
+ case 'check-email-address':
+ $this->checkEmail();
+ break;
+ }
+ }
+
+ /**
+ * Check the email address
+ *
+ * @return void [Outputs to screen]
+ */
+ public function checkEmail()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $email = '';
+ $banfilters = array();
+
+ if( is_string($_REQUEST['email']) )
+ {
+ $email = mb_strtolower( IPSText::parseCleanValue( rawurldecode( $_REQUEST['email'] ) ) );
+ }
+
+ if( !$email )
+ {
+ $this->returnString('found');
+ }
+
+ if( !IPSText::checkEmailAddress( $email ) )
+ {
+ $this->returnString('found');
+ }
+
+ //-----------------------------------------
+ // Got the member?
+ //-----------------------------------------
+
+ if ( ! IPSMember::checkByEmail( $email ) )
+ {
+ //-----------------------------------------
+ // Load ban filters
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'banfilters' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $banfilters[ $r['ban_type'] ][] = $r['ban_content'];
+ }
+
+ //-----------------------------------------
+ // Are they banned [EMAIL]?
+ //-----------------------------------------
+
+ if ( is_array( $banfilters['email'] ) and count( $banfilters['email'] ) )
+ {
+ foreach ( $banfilters['email'] as $memail )
+ {
+ $memail = str_replace( "*", '.*' , preg_quote($memail, "/") );
+
+ if ( preg_match( "/^{$memail}$/", $email ) )
+ {
+ $this->returnString('banned');
+ break;
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Load handler...
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $han_login = new $classToLoad( $this->registry );
+ $han_login->init();
+
+ if( $han_login->emailExistsCheck( $email ) )
+ {
+ $this->returnString('found');
+ }
+
+ $this->returnString('notfound');
+ }
+ else
+ {
+ $this->returnString('found');
+ }
+ }
+
+ /**
+ * Check the name or display name
+ *
+ * @return void [Outputs to screen]
+ */
+ public function checkDisplayName( $field='members_display_name' )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $this->registry->class_localization->loadLanguageFile( array( 'public_register' ) );
+ $name = '';
+ $member = array();
+
+ if( is_string($_POST['name']) )
+ {
+ $name = mb_strtolower( trim( rawurldecode( $_POST['name'] ) ) );
+ }
+
+ if( !$name )
+ {
+ $this->returnString( sprintf( ipsRegistry::getClass( 'class_localization' )->words['reg_error_no_name'], ipsRegistry::$settings['max_user_name_length'] ) );
+ }
+
+ /* Bug where Twitter sets a username but you can't use it when you try and sign up with a new account using username as display name */
+ if ( ! $this->memberData['member_id'] AND $this->request['mpid'] )
+ {
+ $reg = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'members_partial',
+ 'where' => "partial_member_id=" . intval( $this->request['mpid'] ) ) );
+
+ if ( $reg['partial_member_id'] )
+ {
+ $member = IPSMember::load( $reg['partial_member_id'], 'all' );
+ }
+ }
+
+ /* Check the username */
+ $user_check = IPSMember::getFunction()->cleanAndCheckName( $name, $member, $field );
+
+ $errorField = $field == 'members_display_name' ? 'dname' : 'username';
+ $nameField = $field == 'members_display_name' ? 'members_display_name' : 'username';
+
+ if( is_array( $user_check['errors'][ $errorField ] ) && count( $user_check['errors'][ $errorField ] ) )
+ {
+ $this->returnString( ipsRegistry::getClass( 'class_localization' )->words[ $user_check['errors'][ $errorField ][0] ] ? ipsRegistry::getClass( 'class_localization' )->words[ $user_check['errors'][ $errorField ][0] ] : $user_check['errors'][ $errorField ][0] );
+ return;
+ }
+ else if( $user_check['errors'][ $errorField ] )
+ {
+ $this->returnString( ipsRegistry::getClass( 'class_localization' )->words[ $user_check['errors'][ $errorField ] ] ? ipsRegistry::getClass( 'class_localization' )->words[ $user_check['errors'][ $errorField ] ] : $user_check['errors'][ $errorField ] );
+ }
+ else
+ {
+ $this->returnString('notfound');
+ }
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/ajax/reports.php b/upload/admin/applications/core/modules_public/ajax/reports.php
index e7f58195..b056638a 100644
--- a/upload/admin/applications/core/modules_public/ajax/reports.php
+++ b/upload/admin/applications/core/modules_public/ajax/reports.php
@@ -1,137 +1,135 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class public_core_ajax_reports extends ipsAjaxCommand
-{
- /**
- * Class entry point
- *
- * @access public
- * @param object Registry reference
- * @return void [Outputs to screen]
- */
- public function doExecute( ipsRegistry $registry )
- {
- $this->registry->class_localization->loadLanguageFile( array( 'public_reports' ) );
-
- $this->DB->loadCacheFile( IPSLib::getAppDir('core') . '/sql/' . ips_DBRegistry::getDriverType() . '_report_queries.php', 'report_sql_queries' );
-
- require_once( IPSLib::getAppDir('core') .'/sources/classes/reportLibrary.php' );
- $this->registry->setClass( 'reportLibrary', new reportLibrary( $this->registry ) );
-
- /* What to do */
- switch( $this->request['do'] )
- {
- case 'change_status':
- $this->output = $this->_changeStatus();
- break;
- }
- }
-
- /**
- * Adds a rating to the index
- *
- * @access private
- * @return void
- */
- private function _changeStatus()
- {
- //-----------------------------------------
- // Get status's and flags
- //-----------------------------------------
-
- $this->registry->getClass('reportLibrary')->buildStatuses( true );
-
- $COM_PERM = $this->registry->getClass('reportLibrary')->buildQueryPermissions();
-
- //-----------------------------------------
- // Process changes if info is correct
- //-----------------------------------------
-
- if( is_numeric($this->request['id']) && $this->request['id'] > 0 )
- {
- $the_id = intval( $this->request['id'] );
- $return = array('id' => $the_id);
-
- $this->DB->buildFromCache( 'grab_report', array( 'COM' => $COM_PERM, 'rid' => $the_id ), 'report_sql_queries' );
- $res = $this->DB->execute();
-
- if( $this->DB->getTotalRows() > 0 )
- {
- $report = $this->DB->fetch();
-
- $old_status = $report['status'];
- $new_status = $this->request['status'];
-
- if( $old_status != $new_status )
- {
- $build_update = array(
- 'status' => $new_status,
- 'date_updated' => time(),
- 'updated_by' => $this->memberData['member_id'],
- );
-
- $this->DB->update( 'rc_reports_index', $build_update, "id=".$the_id );
- }
-
- $this->registry->getClass('reportLibrary')->updateCacheTime();
- $this->registry->getClass('reportLibrary')->rebuildMemberCacheArray();
-
- //-----------------------------------------
- // Need to reload data to get right "points" :(
- //-----------------------------------------
-
- $this->DB->buildFromCache( 'grab_report', array( 'COM' => $COM_PERM, 'rid' => $the_id ), 'report_sql_queries' );
- $res = $this->DB->execute();
- $report = $this->DB->fetch();
-
- //-----------------------------------------
- // Pick the right flag.. or else!
- //-----------------------------------------
-
- $return['img'] = str_replace( '<#IMG_DIR#>', $this->registry->output->skin['set_image_dir'], $this->registry->getClass('reportLibrary')->flag_cache[ $report['status'] ][ $report['points'] ]['img'] );
- $return['width'] = $this->registry->getClass('reportLibrary')->flag_cache[ $report['status'] ][ $report['points'] ]['width'];
- $return['height'] = $this->registry->getClass('reportLibrary')->flag_cache[ $report['status'] ][ $report['points'] ]['height'];
- $return['is_png'] = $this->registry->getClass('reportLibrary')->flag_cache[ $report['status'] ][ $report['points'] ]['is_png'];
-
- //-----------------------------------------
- // Image? PNG? Using 'Is-Evil' machine?
- //-----------------------------------------
-
- if( $return['img'] != '' )
- {
- $this->returnJsonArray( array( 'img' => $this->registry->getClass('output')->getTemplate('reports')->statusIcon( $return['img'], $return['width'], $return['height'] ) ) );
- }
- else
- {
- $this->returnString( ' ' );
- }
- }
- }
- else
- {
- $this->returnString( 'error' );
- }
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Reports AJAX options
+ * Last Updated: $Date: 2010-10-19 10:40:05 -0400 (Tue, 19 Oct 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6995 $
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_ajax_reports extends ipsAjaxCommand
+{
+ /**
+ * Class entry point
+ *
+ * @param object Registry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ $this->registry->class_localization->loadLanguageFile( array( 'public_reports' ) );
+
+ $this->DB->loadCacheFile( IPSLib::getAppDir('core') . '/sql/' . ips_DBRegistry::getDriverType() . '_report_queries.php', 'report_sql_queries' );
+
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('core') .'/sources/classes/reportLibrary.php', 'reportLibrary' );
+ $this->registry->setClass( 'reportLibrary', new $classToLoad( $this->registry ) );
+
+ /* What to do */
+ switch( $this->request['do'] )
+ {
+ case 'change_status':
+ $this->output = $this->_changeStatus();
+ break;
+ }
+ }
+
+ /**
+ * Adds a rating to the index
+ *
+ * @return void
+ */
+ private function _changeStatus()
+ {
+ //-----------------------------------------
+ // Get status's and flags
+ //-----------------------------------------
+
+ $this->registry->getClass('reportLibrary')->buildStatuses( true );
+
+ $COM_PERM = $this->registry->getClass('reportLibrary')->buildQueryPermissions();
+
+ //-----------------------------------------
+ // Process changes if info is correct
+ //-----------------------------------------
+
+ if( is_numeric($this->request['id']) && $this->request['id'] > 0 )
+ {
+ $the_id = intval( $this->request['id'] );
+ $return = array('id' => $the_id);
+
+ $this->DB->buildFromCache( 'grab_report', array( 'COM' => $COM_PERM, 'rid' => $the_id ), 'report_sql_queries' );
+ $res = $this->DB->execute();
+
+ if( $this->DB->getTotalRows() > 0 )
+ {
+ $report = $this->DB->fetch();
+
+ $old_status = $report['status'];
+ $new_status = $this->request['status'];
+
+ if( $old_status != $new_status )
+ {
+ $build_update = array(
+ 'status' => $new_status,
+ 'date_updated' => time(),
+ 'updated_by' => $this->memberData['member_id'],
+ );
+
+ $this->DB->update( 'rc_reports_index', $build_update, "id=".$the_id );
+ }
+
+ $this->registry->getClass('reportLibrary')->updateCacheTime();
+ $this->registry->getClass('reportLibrary')->rebuildMemberCacheArray();
+
+ //-----------------------------------------
+ // Need to reload data to get right "points" :(
+ //-----------------------------------------
+
+ $this->DB->buildFromCache( 'grab_report', array( 'COM' => $COM_PERM, 'rid' => $the_id ), 'report_sql_queries' );
+ $res = $this->DB->execute();
+ $report = $this->DB->fetch();
+
+ //-----------------------------------------
+ // Pick the right flag.. or else!
+ //-----------------------------------------
+
+ $return['img'] = str_replace( '<#IMG_DIR#>', $this->registry->output->skin['set_image_dir'], $this->registry->getClass('reportLibrary')->flag_cache[ $report['status'] ][ $report['points'] ]['img'] );
+ $return['width'] = $this->registry->getClass('reportLibrary')->flag_cache[ $report['status'] ][ $report['points'] ]['width'];
+ $return['height'] = $this->registry->getClass('reportLibrary')->flag_cache[ $report['status'] ][ $report['points'] ]['height'];
+ $return['is_png'] = $this->registry->getClass('reportLibrary')->flag_cache[ $report['status'] ][ $report['points'] ]['is_png'];
+
+ //-----------------------------------------
+ // Image? PNG? Using 'Is-Evil' machine?
+ //-----------------------------------------
+
+ if( $return['img'] != '' )
+ {
+ $this->returnJsonArray( array( 'img' => $this->registry->getClass('output')->getTemplate('reports')->statusIcon( $return['img'], $return['width'], $return['height'] ) ) );
+ }
+ else
+ {
+ $this->returnString( ' ' );
+ }
+ }
+ }
+ else
+ {
+ $this->returnString( 'error' );
+ }
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/ajax/reputation.php b/upload/admin/applications/core/modules_public/ajax/reputation.php
index 8bcc811a..5e4528d3 100644
--- a/upload/admin/applications/core/modules_public/ajax/reputation.php
+++ b/upload/admin/applications/core/modules_public/ajax/reputation.php
@@ -1,82 +1,79 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class public_core_ajax_reputation extends ipsAjaxCommand
-{
- /**
- * Class entry point
- *
- * @access public
- * @param object Registry reference
- * @return void [Outputs to screen]
- */
- public function doExecute( ipsRegistry $registry )
- {
- /* What to do */
- switch( $this->request['do'] )
- {
- case 'add_rating':
- $this->doRating();
- break;
- }
-
- /* Output */
- $this->returnHtml( $this->output );
- }
-
- /**
- * Adds a rating to the index
- *
- * @access public
- * @return void
- */
- public function doRating()
- {
- /* INIT */
- $app = $this->request['app_rate'];
- $type = $this->request['type'];
- $type_id = intval( $this->request['type_id'] );
- $rating = intval( $this->request['rating'] );
-
- /* Check */
- if( ! $app || ! $type || ! $type_id || ! $rating )
- {
- $this->returnString( $this->lang->words['ajax_incomplete_data'] );
- }
-
- /* Get the rep library */
- require_once( IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php' );
- $repCache = new classReputationCache();
-
- /* Add the rating */
- if( $repCache->addRate( $type, $type_id, $rating, '', 0, $app ) === false )
- {
- $this->returnString( $repCache->error_message );
- }
- else
- {
- $this->returnString( 'done' );
- }
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Reputation
+ * Last Updated: $Date: 2010-10-14 17:24:55 -0400 (Thu, 14 Oct 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6982 $
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_ajax_reputation extends ipsAjaxCommand
+{
+ /**
+ * Class entry point
+ *
+ * @param object Registry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* What to do */
+ switch( $this->request['do'] )
+ {
+ case 'add_rating':
+ $this->doRating();
+ break;
+ }
+
+ exit();
+ }
+
+ /**
+ * Adds a rating to the index
+ *
+ * @return void
+ */
+ public function doRating()
+ {
+ /* INIT */
+ $app = $this->request['app_rate'];
+ $type = $this->request['type'];
+ $type_id = intval( $this->request['type_id'] );
+ $rating = intval( $this->request['rating'] );
+
+ /* Check */
+ if( ! $app || ! $type || ! $type_id || ! $rating )
+ {
+ $this->returnString( $this->lang->words['ajax_incomplete_data'] );
+ }
+
+ /* Get the rep library */
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php', 'classReputationCache' );
+ $repCache = new $classToLoad();
+
+ /* Add the rating */
+ if( $repCache->addRate( $type, $type_id, $rating, '', 0, $app ) === false )
+ {
+ $this->returnString( $repCache->error_message );
+ }
+ else
+ {
+ $this->returnString( 'done' );
+ }
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/ajax/sharelinks.php b/upload/admin/applications/core/modules_public/ajax/sharelinks.php
new file mode 100644
index 00000000..a384c639
--- /dev/null
+++ b/upload/admin/applications/core/modules_public/ajax/sharelinks.php
@@ -0,0 +1,231 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * AJAX Sharelinks
+ * Last Updated: $Date: 2010-10-19 11:56:25 -0400 (Tue, 19 Oct 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Revision: 6997 $
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_ajax_sharelinks extends ipsAjaxCommand
+{
+ /**
+ * Class entry point
+ *
+ * @param object Registry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* load language */
+ $this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_emails' ), 'core' );
+
+ /* Do it */
+ switch( $this->request['do'] )
+ {
+ case 'twitterForm':
+ return $this->_twitterForm();
+ break;
+ case 'twitterGo':
+ return $this->_twitterGo();
+ break;
+ case 'facebookForm':
+ return $this->_facebookForm();
+ break;
+ case 'facebookGo':
+ return $this->_facebookGo();
+ break;
+ }
+ }
+
+ /**
+ * Displays a form of facebook stuff. It's really that exciting.
+ *
+ * @return void [Outputs HTML to browser AJAX call]
+ */
+ private function _facebookForm()
+ {
+ /* Ensure we have a twitter account and that */
+ if ( $this->memberData['member_id'] AND $this->memberData['fb_uid'] AND $this->memberData['fb_token'] )
+ {
+ /* Connect to the Facebook */
+ require_once( IPS_ROOT_PATH . 'sources/classes/facebook/connect.php' );
+ $connect = new facebook_connect( $this->registry );
+
+ try
+ {
+ $userData = $connect->fetchUserData();
+
+ $this->returnHtml( $this->registry->output->getTemplate('global_other')->facebookPop( $userData ) );
+ }
+ catch( Exception $e )
+ {
+ $this->returnHtml( '.' );
+ }
+ }
+ else
+ {
+ /* Bog off @todo probably grab the URL and doc title and forward to normal twitter.com/submit link */
+ $this->returnHtml( 'x' );
+ }
+ }
+
+ /**
+ * Go go Facebook go
+ *
+ * @return void [Outputs HTML to browser AJAX call]
+ */
+ private function _facebookGo()
+ {
+ /* INIT */
+ $comment = trim( urldecode( $_POST['comment'] ) );
+ $url = trim( urldecode( $_POST['url'] ) );
+ $title = trim( urldecode( $_POST['title'] ) );
+
+ /* Ensure title is correctly de-html-ized */
+ $title = IPSText::UNhtmlspecialchars( $title );
+
+ /* Ensure we have a twitter account and that */
+ if ( $this->memberData['member_id'] AND $this->memberData['fb_uid'] AND $this->memberData['fb_token'] )
+ {
+ /* Connect to the Facebook */
+ require_once( IPS_ROOT_PATH . 'sources/classes/facebook/connect.php' );
+ $connect = new facebook_connect( $this->registry );
+
+ try
+ {
+ $userData = $connect->fetchUserData();
+
+ if ( $userData['first_name'] )
+ {
+ /* Log it */
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/share/links.php', 'share_links' );
+ $share = new $classToLoad( $this->registry, 'facebook' );
+ $share->log( $url, $title );
+
+ $connect->postLinkToWall( $url, $comment );
+
+ $this->returnHtml( $this->registry->output->getTemplate('global_other')->facebookDone( $userData ) );
+ }
+ else
+ {
+ $this->returnHtml( 'finchersaysno' );
+ }
+
+ }
+ catch( Exception $e )
+ {
+ $this->returnHtml( 'finchersaysno' );
+ }
+ }
+ else
+ {
+ /* Bog off */
+ $this->returnString( 'finchersaysno' );
+ }
+ }
+
+
+ /**
+ * Go go twitter go
+ *
+ * @return void [Outputs HTML to browser AJAX call]
+ */
+ private function _twitterGo()
+ {
+ /* INIT */
+ $tweet = trim( urldecode( $_POST['tweet'] ) );
+ $url = trim( urldecode( $_POST['url'] ) );
+ $title = trim( urldecode( $_POST['title'] ) );
+
+ /* Ensure title is correctly de-html-ized */
+ $title = IPSText::UNhtmlspecialchars( $title );
+
+ /* Ensure we have a twitter account and that */
+ if ( $this->memberData['member_id'] AND $this->memberData['twitter_id'] AND $this->memberData['twitter_token'] AND $this->memberData['twitter_secret'] )
+ {
+ /* Connect to the twitter */
+ require_once( IPS_ROOT_PATH . 'sources/classes/twitter/connect.php' );
+ $connect = new twitter_connect( $this->registry, $this->memberData['twitter_token'], $this->memberData['twitter_secret'] );
+ $user = $connect->fetchUserData();
+
+ if ( $user['id'] )
+ {
+ $sid = $connect->updateStatusWithUrl( $tweet, $url );
+
+ if ( $sid )
+ {
+ /* Log it */
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/share/links.php', 'share_links' );
+ $share = new $classToLoad( $this->registry, 'twitter' );
+ $share->log( $url, $title );
+
+ $user['status']['id'] = $sid;
+ $this->returnHtml( $this->registry->output->getTemplate('global_other')->twitterDone( $user ) );
+ }
+ else
+ {
+ /* Bog off */
+ $this->returnString( 'failwhale' );
+ }
+ }
+ else
+ {
+ /* Bog off */
+ $this->returnString( 'failwhale' );
+ }
+ }
+ else
+ {
+ /* Bog off */
+ $this->returnString( 'failwhale' );
+ }
+ }
+
+ /**
+ * Displays a form of twitter stuff. It's really that exciting.
+ *
+ * @return void [Outputs HTML to browser AJAX call]
+ */
+ private function _twitterForm()
+ {
+ /* Ensure we have a twitter account and that */
+ if ( $this->memberData['member_id'] AND $this->memberData['twitter_id'] AND $this->memberData['twitter_token'] AND $this->memberData['twitter_secret'] )
+ {
+ /* Connect to the twitter */
+ require_once( IPS_ROOT_PATH . 'sources/classes/twitter/connect.php' );
+ $connect = new twitter_connect( $this->registry, $this->memberData['twitter_token'], $this->memberData['twitter_secret'] );
+ $user = $connect->fetchUserData();
+
+ if ( $user['id'] )
+ {
+ $this->returnHtml( $this->registry->output->getTemplate('global_other')->twitterPop( $user ) );
+ }
+ else
+ {
+ /* Bog off @todo probably grab the URL and doc title and forward to normal twitter.com/submit link */
+ $this->returnHtml( '.' );
+ }
+ }
+ else
+ {
+ /* Bog off @todo probably grab the URL and doc title and forward to normal twitter.com/submit link */
+ $this->returnHtml( 'x' );
+ }
+ }
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/ajax/usercp.php b/upload/admin/applications/core/modules_public/ajax/usercp.php
index ab356b51..04c7b610 100644
--- a/upload/admin/applications/core/modules_public/ajax/usercp.php
+++ b/upload/admin/applications/core/modules_public/ajax/usercp.php
@@ -1,111 +1,113 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class public_core_ajax_usercp extends ipsAjaxCommand
-{
- /**
- * Class entry point
- *
- * @access public
- * @param object Registry reference
- * @return void [Outputs to screen]
- */
- public function doExecute( ipsRegistry $registry )
- {
- switch( $this->request['do'] )
- {
- case 'displayNameCheck':
- $this->displayNameCheck();
- break;
- }
- }
-
- /**
- * Checks a display name
- *
- * @access private
- * @return void [Outputs JSON to browser AJAX call]
- */
- private function displayNameCheck()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $name = mb_strtolower( $this->convertAndMakeSafe( $this->request['name'], 0 ) );
- $name = str_replace("+", "+", $name );
- $member = array();
- $return = TRUE;
- $id = intval( $this->request['member_id'] );
-
- # Set member ID
- $id = $this->memberData['member_id'] ? $this->memberData['member_id'] : $id;
-
- //-----------------------------------------
- // Load member if required
- //-----------------------------------------
-
- if ( $id != $this->memberData['member_id'] )
- {
- $member = IPSMember::load( $id, 'all' );
- }
- else
- {
- $member = $this->member->fetchMemberData();
- }
-
- //-----------------------------------------
- // Test name
- //-----------------------------------------
-
- try
- {
- $return = IPSMember::getFunction()->checkNameExists( $name, $member );
- }
- catch( Exception $error )
- {
- $_msg = $error->getMessage();
-
- if ( $_msg == 'NO_MORE_CHANGES' )
- {
- $this->returnString( 'nomorechanges' );
- return;
- }
-
- # Really, we're not very interested why it didn't work at this point, so
- # just return with a 'found' string which will make a nice red cross and
- # force the user to choose another.
-
- $this->returnString('found');
- return;
- }
-
- //-----------------------------------------
- // So, what's it to be?
- //-----------------------------------------
-
- $this->returnString( ( $return === TRUE ) ? 'found' : 'notfound' );
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Login handler abstraction : AJAX UserCP functions
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since Tuesday 1st March 2005 (11:52)
+ * @version $Revision: 5713 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_ajax_usercp extends ipsAjaxCommand
+{
+ /**
+ * Class entry point
+ *
+ * @access public
+ * @param object Registry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ switch( $this->request['do'] )
+ {
+ case 'displayNameCheck':
+ $this->displayNameCheck();
+ break;
+ }
+ }
+
+ /**
+ * Checks a display name
+ *
+ * @access private
+ * @return void [Outputs JSON to browser AJAX call]
+ */
+ private function displayNameCheck()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $name = mb_strtolower( $this->convertAndMakeSafe( $this->request['name'], 0 ) );
+ $name = str_replace("+", "+", $name );
+ $member = array();
+ $return = TRUE;
+ $id = intval( $this->request['member_id'] );
+
+ # Set member ID
+ $id = $this->memberData['member_id'] ? $this->memberData['member_id'] : $id;
+
+ //-----------------------------------------
+ // Load member if required
+ //-----------------------------------------
+
+ if ( $id != $this->memberData['member_id'] )
+ {
+ $member = IPSMember::load( $id, 'all' );
+ }
+ else
+ {
+ $member = $this->member->fetchMemberData();
+ }
+
+ //-----------------------------------------
+ // Test name
+ //-----------------------------------------
+
+ try
+ {
+ $return = IPSMember::getFunction()->checkNameExists( $name, $member );
+ }
+ catch( Exception $error )
+ {
+ $_msg = $error->getMessage();
+
+ if ( $_msg == 'NO_MORE_CHANGES' )
+ {
+ $this->returnString( 'nomorechanges' );
+ return;
+ }
+
+ # Really, we're not very interested why it didn't work at this point, so
+ # just return with a 'found' string which will make a nice red cross and
+ # force the user to choose another.
+
+ $this->returnString('found');
+ return;
+ }
+
+ //-----------------------------------------
+ // So, what's it to be?
+ //-----------------------------------------
+
+ $this->returnString( ( $return === TRUE ) ? 'found' : 'notfound' );
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/ajax/vkontakte.php b/upload/admin/applications/core/modules_public/ajax/vkontakte.php
new file mode 100644
index 00000000..084d6f88
--- /dev/null
+++ b/upload/admin/applications/core/modules_public/ajax/vkontakte.php
@@ -0,0 +1,121 @@
+Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_ajax_vkontakte extends ipsAjaxCommand
+{
+ /**
+ * Login handler object
+ *
+ * @access protected
+ * @var object
+ */
+ protected $han_login;
+
+ /**
+ * Flag : Logged in
+ *
+ * @access protected
+ * @var boolean
+ */
+ protected $logged_in = false;
+
+ /**
+ * Class entry point
+ *
+ * @access public
+ * @param object Registry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+
+ /* What to do */
+ switch( $this->request['do'] )
+ {
+ case 'getUserByVkId':
+ $return = $this->_getUserByVkId();
+ break;
+ }
+
+ /* Output */
+ $this->returnHtml( $return );
+ }
+
+ /**
+ * Main AJAX log in routine
+ *
+ * @access private
+ * @return void [Outputs JSON to browser AJAX call]
+ */
+ private function _getUserByVkId()
+ {
+ require_once( IPS_ROOT_PATH . 'sources/classes/vkontakte/connect.php' );
+ $vk = new Vkontakte_Request_Validator( $this->settings['vk_api_id'], $this->settings['vk_secret'] );
+
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $vkUid = is_numeric( $vk->mid ) ? $vk->mid : -1;
+ $member = array( 'member_id' => 0 );
+
+ if ( $vkUid )
+ {
+ $_mid = $this->DB->buildAndFetch( array( 'select' => 'member_id',
+ 'from' => 'members',
+ 'where' => 'vk_uid=' . $vkUid ) );
+
+ if ( $_mid['member_id'] )
+ {
+ $member = IPSMember::load( $_mid['member_id'], 'all' );
+ }
+ }
+
+ /* Create validating account for the member */
+ $key = md5( uniqid( microtime() ) );
+ $member['key'] = $key;
+
+ if ( $vkUid == $this->request['id'] )
+ {
+
+ $this->DB->delete( 'vkontakte_connect', 'v_id = ' . $vkUid );
+
+ $name = IPSMember::getFunction()->cleanAndCheckName( $this->request['name'], array(), 'name' );
+
+ $photo = '';
+
+ if ( IPSText::xssCheckUrl( $this->request['photo'] ) && preg_match('~^http://.+?\.vkontakte\.ru/u' . $vkUid. '~is', $this->request['photo']))
+ {
+ $photo = $this->request['photo'];
+ }
+
+ $this->DB->insert( 'vkontakte_connect', array( 'v_key' => $key,
+ 'v_user' => $name['username'],
+ 'v_data' => $photo,
+ 'v_id' => $vkUid ) );
+
+ }
+
+ $this->returnJsonArray( $member );
+ }
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/attach/attach.php b/upload/admin/applications/core/modules_public/attach/attach.php
index 4ddde65b..9598e0bc 100644
--- a/upload/admin/applications/core/modules_public/attach/attach.php
+++ b/upload/admin/applications/core/modules_public/attach/attach.php
@@ -1,353 +1,345 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class public_core_attach_attach extends ipsCommand
-{
- /**
- * Attachment Library
- *
- * @access public
- * @var object class_attach
- */
- public $class_attach;
-
- /**
- * AJAX Library
- *
- * @access public
- * @var object classAjax
- */
- public $ajax;
-
- /**
- * Class entry point
- *
- * @access public
- * @param object Registry reference
- * @return void [Outputs to screen/redirects]
- */
- public function doExecute( ipsRegistry $registry )
- {
- /* AJAX Class */
- require_once( IPS_KERNEL_PATH . '/classAjax.php' );
- $this->ajax = new classAjax();
-
- /* Attachment Class */
- require_once( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php' );
- $this->class_attach = new class_attach( $registry );
-
- /* What to do... */
- switch( $this->request['do'] )
- {
- case 'attach_upload_show':
- $this->ajax->returnHtml( $this->attachmentUploadShow() );
- break;
-
- case 'attach_upload_process':
- $this->attachmentUploadProcess();
- break;
-
- case 'attach_upload_remove':
- $this->attachmentUploadRemove();
- break;
-
- /* IFrame based upload */
- case 'attachiFrame':
- $this->attachiFrame();
- break;
- case 'attachUploadiFrame':
- $this->attachUploadiFrame();
- break;
-
- default:
- $this->showPostAttachment();
- break;
- }
- }
-
- /**
- * View Post Attachment
- *
- * @access public
- * @return void
- */
- public function showPostAttachment()
- {
- /* INIT */
- $attach_id = intval( $this->request['attach_id'] );
-
- /* INIT module */
- $this->class_attach->init();
-
- /* Display */
- $this->class_attach->showAttachment( $attach_id );
- }
-
- /**
- * Remove an upload
- *
- * @access public
- * @return void
- */
- public function attachmentUploadRemove()
- {
- /* INIT */
- $attach_post_key = trim( IPSText::alphanumericalClean( $this->request['attach_post_key'] ) );
- $attach_rel_module = trim( IPSText::alphanumericalClean( $this->request['attach_rel_module'] ) );
- $attach_rel_id = intval( $this->request['attach_rel_id'] );
- $attach_id = intval( $this->request['attach_id'] );
-
- /* Setup Module */
- $this->class_attach->type = $attach_rel_module;
- $this->class_attach->attach_post_key = $attach_post_key;
- $this->class_attach->attach_rel_id = $attach_rel_id;
- $this->class_attach->attach_id = $attach_id;
- $this->class_attach->init();
-
- /* Remove the attachment */
- $removed = $this->class_attach->removeAttachment();
-
- /* Show the form */
- if( $removed )
- {
- $this->ajax->returnHtml( $this->attachmentUploadShow( 'attach_removed', 0 ) );
- }
- else
- {
- $this->ajax->returnHtml( $this->attachmentUploadShow( 'remove_failed', 1 ) );
- }
- }
-
- /**
- * Perform the actual upload
- *
- * @access public
- * @return void
- */
- public function attachmentUploadProcess()
- {
- /* INIT */
- $attach_post_key = trim( IPSText::alphanumericalClean( $this->request['attach_post_key'] ) );
- $attach_rel_module = trim( IPSText::alphanumericalClean( $this->request['attach_rel_module'] ) );
- $attach_rel_id = intval( $this->request['attach_rel_id'] );
- $attach_current_items = '';
-
- /* INIT module */
- $this->class_attach->type = $attach_rel_module;
- $this->class_attach->attach_post_key = $attach_post_key;
- $this->class_attach->attach_rel_id = $attach_rel_id;
- $this->class_attach->init();
-
- /* Process upload */
- $insert_id = $this->class_attach->processUpload();
-
- /* Got an error? */
- if( $this->class_attach->error )
- {
- $this->ajax->returnHtml( $this->attachmentUploadShow( $this->class_attach->error, 1, $insert_id ) );
- }
- else
- {
- $this->ajax->returnHtml( $this->attachmentUploadShow( 'upload_ok', 0, $insert_id ) );
- }
- }
-
- /**
- * Show the attach upload field
- *
- * @access public
- * @param string $msg
- * @param bool $is_error
- * @param integer $insert_id
- * @return void
- **/
- public function attachmentUploadShow( $msg="ready", $is_error=0, $insert_id=0 )
- {
- /* INIT JSON */
- $JSON = array();
- $JSON['msg'] = $msg;
- $JSON['is_error'] = $is_error;
-
- $is_reset = 0;
-
- /* Check the upload domain setting */
- if( $this->settings['upload_domain'] )
- {
- $is_reset = 1;
- $original = $this->settings['base_url'];
-
- if( $this->member->session_type == 'cookie' )
- {
- $this->settings['base_url'] = $this->settings['upload_domain'] . '/index.' . $this->settings['php_ext'].'?';
- }
- else
- {
- $this->settings['base_url'] = $this->settings['upload_domain'] . '/index.' . $this->settings['php_ext'].'?s='.$this->member->session_id .'&';
- }
- }
-
- /* JSON Data */
- $JSON['attach_post_key'] = $attach_post_key = trim( IPSText::alphanumericalClean( $this->request['attach_post_key'] ) );
- $JSON['attach_rel_module'] = $attach_rel_module = trim( IPSText::alphanumericalClean( $this->request['attach_rel_module'] ) );
- $JSON['attach_rel_id'] = $attach_rel_id = intval( $this->request['attach_rel_id'] );
-
- if( $insert_id )
- {
- $JSON['insert_id'] = $insert_id;
- }
-
- /* Get extra form fields */
- foreach( $_GET as $k => $v )
- {
- if( preg_match( "#^--ff--#", $k ) )
- {
- $JSON['extra_upload_form_url'] .= '&' . str_replace( '--ff--', '', $k ) . '='.$v;
- $JSON['extra_upload_form_url'] .= '&' . $k . '='.$v;
- }
- }
-
- /* INIT module */
- $this->class_attach->type = $attach_rel_module;
- $this->class_attach->attach_post_key = $attach_post_key;
- $this->class_attach->init();
- $this->class_attach->getUploadFormSettings();
-
- /* Load Language Bits */
- $this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'lang_post' ) );
-
- /* Generate current items... */
- $_more = ( $attach_rel_id ) ? ' OR c.attach_rel_id=' . $attach_rel_id : '';
-
- $this->DB->build( array(
- 'select' => 'c.*',
- 'from' => array( 'attachments' => 'c' ),
- 'where' => "c.attach_rel_module='{$attach_rel_module}' AND c.attach_post_key='{$attach_post_key}'{$_more}",
- 'add_join' => array( array(
- 'select' => 't.*',
- 'from' => array( 'attachments_type' => 't' ),
- 'where' => 't.atype_extension=c.attach_ext',
- 'type' => 'left'
- ) )
-
- ) );
-
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- if ( $attach_rel_module != $row['attach_rel_module'] )
- {
- continue;
- }
-
- if( ( $insert_id && $row['attach_id'] == $insert_id ) || $this->request['fetch_all'] )
- {
- if ( $row['attach_is_image'] and ! $row['attach_thumb_location'] )
- {
- $row['attach_thumb_location'] = $row['attach_location'];
- $row['attach_thumb_width'] = $row['attach_width'];
- $row['attach_thumb_height'] = $row['attach_height'];
- }
-
- $JSON['current_items'][ $row['attach_id'] ] = array( $row['attach_id'] ,
- str_replace( array( '[', ']' ), '', $row['attach_file'] ),
- $row['attach_filesize'],
- $row['attach_is_image'],
- $row['attach_thumb_location'],
- $row['attach_thumb_width'],
- $row['attach_thumb_height'],
- $row['atype_img']
- );
- }
- }
-
- $JSON['attach_stats'] = $this->class_attach->attach_stats;
-
- /* Formatting nonsense for special char sets */
- array_walk_recursive( $JSON, create_function( '&$value, $key', '$value = IPSText::convertCharsets($value, "' . IPS_DOC_CHAR_SET . '", "UTF-8");' ) );
- $result = json_encode( $JSON );
- $result = IPSText::convertCharsets( $result, "UTF-8", IPS_DOC_CHAR_SET );
-
- IPSDebug::addLogMessage( $result, 'uploads' );
-
- /* Return JSON */
- return $result;
- }
-
- /**
- * Show the attach upload field
- *
- * @access public
- * @param string $msg
- * @param bool $is_error
- * @param integer $insert_id
- * @return void
- */
- public function attachiFrame( $msg="ready", $is_error=0, $insert_id=0 )
- {
- /* INIT JSON */
- $JSON = $this->attachmentUploadShow( $msg, $is_error, $insert_id );
-
- $this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_post' ), 'forums' );
-
- $this->ajax->returnHtml( $this->registry->output->getTemplate( 'post' )->attachiFrame( $JSON, intval( $this->request['attach_rel_id'] ) ) );
- }
-
- /**
- * Perform the actual upload
- *
- * @access public
- * @return void
- */
- public function attachUploadiFrame()
- {
- /* INIT */
- $attach_post_key = trim( IPSText::alphanumericalClean( $this->request['attach_post_key'] ) );
- $attach_rel_module = trim( IPSText::alphanumericalClean( $this->request['attach_rel_module'] ) );
- $attach_rel_id = intval( $this->request['attach_rel_id'] );
- $attach_current_items = '';
-
- $this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_post' ), 'forums' );
-
- /* INIT module */
- $this->class_attach->type = $attach_rel_module;
- $this->class_attach->attach_post_key = $attach_post_key;
- $this->class_attach->attach_rel_id = $attach_rel_id;
- $this->class_attach->init();
-
- /* Process upload */
- $insert_id = $this->class_attach->processUpload();
-
- /* Got an error? */
- if( $this->class_attach->error )
- {
- $JSON = $this->attachmentUploadShow( $this->class_attach->error, 1, $insert_id );
- }
- else
- {
- $JSON = $this->attachmentUploadShow( 'upload_ok', 0, $insert_id );
- }
-
- $this->ajax->returnHtml( $this->registry->output->getTemplate( 'post' )->attachiFrame( $JSON, $attach_rel_id ) );
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Attachment Poster
+ * Last Updated: $Date: 2010-10-19 11:56:25 -0400 (Tue, 19 Oct 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6997 $
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_attach_attach extends ipsCommand
+{
+ /**
+ * Attachment Library
+ *
+ * @var object class_attach
+ */
+ public $class_attach;
+
+ /**
+ * AJAX Library
+ *
+ * @var object classAjax
+ */
+ public $ajax;
+
+ /**
+ * Class entry point
+ *
+ * @param object Registry reference
+ * @return void [Outputs to screen/redirects]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* AJAX Class */
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
+ $this->ajax = new $classToLoad();
+
+ /* Attachment Class */
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php', 'class_attach' );
+ $this->class_attach = new $classToLoad( $registry );
+
+ /* What to do... */
+ switch( $this->request['do'] )
+ {
+ case 'attach_upload_show':
+ $this->ajax->returnHtml( $this->attachmentUploadShow() );
+ break;
+
+ case 'attach_upload_process':
+ $this->attachmentUploadProcess();
+ break;
+
+ case 'attach_upload_remove':
+ $this->attachmentUploadRemove();
+ break;
+
+ /* IFrame based upload */
+ case 'attachiFrame':
+ $this->attachiFrame();
+ break;
+ case 'attachUploadiFrame':
+ $this->attachUploadiFrame();
+ break;
+
+ default:
+ $this->showPostAttachment();
+ break;
+ }
+ }
+
+ /**
+ * View Post Attachment
+ *
+ * @return void
+ */
+ public function showPostAttachment()
+ {
+ /* INIT */
+ $attach_id = intval( $this->request['attach_id'] );
+
+ /* INIT module */
+ $this->class_attach->init();
+
+ /* Display */
+ $this->class_attach->showAttachment( $attach_id );
+ }
+
+ /**
+ * Remove an upload
+ *
+ * @return void
+ */
+ public function attachmentUploadRemove()
+ {
+ /* INIT */
+ $attach_post_key = trim( IPSText::alphanumericalClean( $this->request['attach_post_key'] ) );
+ $attach_rel_module = trim( IPSText::alphanumericalClean( $this->request['attach_rel_module'] ) );
+ $attach_rel_id = intval( $this->request['attach_rel_id'] );
+ $attach_id = intval( $this->request['attach_id'] );
+
+ /* Setup Module */
+ $this->class_attach->type = $attach_rel_module;
+ $this->class_attach->attach_post_key = $attach_post_key;
+ $this->class_attach->attach_rel_id = $attach_rel_id;
+ $this->class_attach->attach_id = $attach_id;
+ $this->class_attach->init();
+
+ /* Remove the attachment */
+ $removed = $this->class_attach->removeAttachment();
+
+ /* Show the form */
+ if( $removed )
+ {
+ $this->ajax->returnHtml( $this->attachmentUploadShow( 'attach_removed', 0 ) );
+ }
+ else
+ {
+ $this->ajax->returnHtml( $this->attachmentUploadShow( 'remove_failed', 1 ) );
+ }
+ }
+
+ /**
+ * Perform the actual upload
+ *
+ * @return void
+ */
+ public function attachmentUploadProcess()
+ {
+ /* INIT */
+ $attach_post_key = trim( IPSText::alphanumericalClean( $this->request['attach_post_key'] ) );
+ $attach_rel_module = trim( IPSText::alphanumericalClean( $this->request['attach_rel_module'] ) );
+ $attach_rel_id = intval( $this->request['attach_rel_id'] );
+ $attach_current_items = '';
+
+ /* INIT module */
+ $this->class_attach->type = $attach_rel_module;
+ $this->class_attach->attach_post_key = $attach_post_key;
+ $this->class_attach->attach_rel_id = $attach_rel_id;
+ $this->class_attach->init();
+
+ /* Process upload */
+ $insert_id = $this->class_attach->processUpload();
+
+ /* Got an error? */
+ if( $this->class_attach->error )
+ {
+ $this->ajax->returnHtml( $this->attachmentUploadShow( $this->class_attach->error, 1, $insert_id ) );
+ }
+ else
+ {
+ $this->ajax->returnHtml( $this->attachmentUploadShow( 'upload_ok', 0, $insert_id ) );
+ }
+ }
+
+ /**
+ * Show the attach upload field
+ *
+ * @param string $msg
+ * @param bool $is_error
+ * @param integer $insert_id
+ * @return void
+ **/
+ public function attachmentUploadShow( $msg="ready", $is_error=0, $insert_id=0 )
+ {
+ /* INIT JSON */
+ $JSON = array();
+ $JSON['msg'] = $msg;
+ $JSON['is_error'] = $is_error;
+
+ $is_reset = 0;
+
+ /* Check the upload domain setting */
+ if( $this->settings['upload_domain'] )
+ {
+ $is_reset = 1;
+ $original = $this->settings['base_url'];
+
+ if( $this->member->session_type == 'cookie' )
+ {
+ $this->settings['base_url'] = $this->settings['upload_domain'] . '/index.' . $this->settings['php_ext'].'?';
+ }
+ else
+ {
+ $this->settings['base_url'] = $this->settings['upload_domain'] . '/index.' . $this->settings['php_ext'].'?s='.$this->member->session_id .'&';
+ }
+ }
+
+ /* JSON Data */
+ $JSON['attach_post_key'] = $attach_post_key = trim( IPSText::alphanumericalClean( $this->request['attach_post_key'] ) );
+ $JSON['attach_rel_module'] = $attach_rel_module = trim( IPSText::alphanumericalClean( $this->request['attach_rel_module'] ) );
+ $JSON['attach_rel_id'] = $attach_rel_id = intval( $this->request['attach_rel_id'] );
+
+ if( $insert_id )
+ {
+ $JSON['insert_id'] = $insert_id;
+ }
+
+ /* Get extra form fields */
+ foreach( $_GET as $k => $v )
+ {
+ if( preg_match( "#^--ff--#", $k ) )
+ {
+ $JSON['extra_upload_form_url'] .= '&' . str_replace( '--ff--', '', $k ) . '='.$v;
+ $JSON['extra_upload_form_url'] .= '&' . $k . '='.$v;
+ }
+ }
+
+ /* INIT module */
+ $this->class_attach->type = $attach_rel_module;
+ $this->class_attach->attach_post_key = $attach_post_key;
+ $this->class_attach->init();
+ $this->class_attach->getUploadFormSettings();
+
+ /* Load Language Bits */
+ $this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'lang_post' ) );
+
+ /* Generate current items... */
+ $_more = ( $attach_rel_id ) ? ' OR c.attach_rel_id=' . $attach_rel_id : '';
+
+ $this->DB->build( array(
+ 'select' => 'c.*',
+ 'from' => array( 'attachments' => 'c' ),
+ 'where' => "c.attach_rel_module='{$attach_rel_module}' AND c.attach_post_key='{$attach_post_key}'{$_more}",
+ 'add_join' => array( array(
+ 'select' => 't.*',
+ 'from' => array( 'attachments_type' => 't' ),
+ 'where' => 't.atype_extension=c.attach_ext',
+ 'type' => 'left'
+ ) )
+
+ ) );
+
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ if ( $attach_rel_module != $row['attach_rel_module'] )
+ {
+ continue;
+ }
+
+ if( ( $insert_id && $row['attach_id'] == $insert_id ) || $this->request['fetch_all'] )
+ {
+ if ( $row['attach_is_image'] and ! $row['attach_thumb_location'] )
+ {
+ $row['attach_thumb_location'] = $row['attach_location'];
+ $row['attach_thumb_width'] = $row['attach_width'];
+ $row['attach_thumb_height'] = $row['attach_height'];
+ }
+
+ $JSON['current_items'][ $row['attach_id'] ] = array( $row['attach_id'] ,
+ str_replace( array( '[', ']' ), '', $row['attach_file'] ),
+ $row['attach_filesize'],
+ $row['attach_is_image'],
+ $row['attach_thumb_location'],
+ $row['attach_thumb_width'],
+ $row['attach_thumb_height'],
+ $row['atype_img']
+ );
+ }
+ }
+
+ $JSON['attach_stats'] = $this->class_attach->attach_stats;
+
+ /* Formatting nonsense for special char sets */
+ array_walk_recursive( $JSON, create_function( '&$value, $key', '$value = IPSText::convertCharsets($value, "' . IPS_DOC_CHAR_SET . '", "UTF-8");' ) );
+ $result = json_encode( $JSON );
+ $result = IPSText::convertCharsets( $result, "UTF-8", IPS_DOC_CHAR_SET );
+
+ IPSDebug::addLogMessage( $result, 'uploads' );
+
+ /* Return JSON */
+ return $result;
+ }
+
+ /**
+ * Show the attach upload field
+ *
+ * @param string $msg
+ * @param bool $is_error
+ * @param integer $insert_id
+ * @return void
+ */
+ public function attachiFrame( $msg="ready", $is_error=0, $insert_id=0 )
+ {
+ /* INIT JSON */
+ $JSON = $this->attachmentUploadShow( $msg, $is_error, $insert_id );
+
+ $this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_post' ), 'forums' );
+
+ $this->ajax->returnHtml( $this->registry->output->getTemplate( 'post' )->attachiFrame( $JSON, intval( $this->request['attach_rel_id'] ) ) );
+ }
+
+ /**
+ * Perform the actual upload
+ *
+ * @return void
+ */
+ public function attachUploadiFrame()
+ {
+ /* INIT */
+ $attach_post_key = trim( IPSText::alphanumericalClean( $this->request['attach_post_key'] ) );
+ $attach_rel_module = trim( IPSText::alphanumericalClean( $this->request['attach_rel_module'] ) );
+ $attach_rel_id = intval( $this->request['attach_rel_id'] );
+ $attach_current_items = '';
+
+ $this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_post' ), 'forums' );
+
+ /* INIT module */
+ $this->class_attach->type = $attach_rel_module;
+ $this->class_attach->attach_post_key = $attach_post_key;
+ $this->class_attach->attach_rel_id = $attach_rel_id;
+ $this->class_attach->init();
+
+ /* Process upload */
+ $insert_id = $this->class_attach->processUpload();
+
+ /* Got an error? */
+ if( $this->class_attach->error )
+ {
+ $JSON = $this->attachmentUploadShow( $this->class_attach->error, 1, $insert_id );
+ }
+ else
+ {
+ $JSON = $this->attachmentUploadShow( 'upload_ok', 0, $insert_id );
+ }
+
+ $this->ajax->returnHtml( $this->registry->output->getTemplate( 'post' )->attachiFrame( $JSON, $attach_rel_id ) );
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/attach/defaultSection.php b/upload/admin/applications/core/modules_public/attach/defaultSection.php
index 4bfb2f9a..580ab9c1 100644
--- a/upload/admin/applications/core/modules_public/attach/defaultSection.php
+++ b/upload/admin/applications/core/modules_public/attach/defaultSection.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Define the default attachments section
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4948 $
+ * @version $Rev: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_public/attach/index.html b/upload/admin/applications/core/modules_public/attach/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_public/attach/index.html
+++ b/upload/admin/applications/core/modules_public/attach/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/global/captcha.php b/upload/admin/applications/core/modules_public/global/captcha.php
index 3b207fb3..eeb1b786 100644
--- a/upload/admin/applications/core/modules_public/global/captcha.php
+++ b/upload/admin/applications/core/modules_public/global/captcha.php
@@ -1,93 +1,91 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class public_core_global_captcha extends ipsCommand
-{
- /**
- * Class entry point
- *
- * @access public
- * @param object Registry reference
- * @return void [Outputs to screen/redirects]
- */
- public function doExecute( ipsRegistry $registry )
- {
- /* Load Cpatcha Class */
- $this->class_captcha = $this->registry->getClass('class_captcha');
-
- /* What to do... */
- switch( $this->request['do'] )
- {
- default:
- case 'showimage':
- $this->showImage();
- break;
- case 'refresh':
- $this->refreshImage();
- break;
- }
- }
-
- /**
- * Show the captcha image
- * Shows the captcha image. Good god, that was a waste of time
- *
- * @access public
- * @return void
- */
- public function showImage()
- {
- /* INIT */
- $captcha_unique_id = trim( $this->request['captcha_unique_id'] );
-
- /* GD installed? */
- $this->class_captcha->show_error_gd_img = TRUE;
-
- /* Show Image... */
- $this->class_captcha->showImage( $captcha_unique_id );
- }
-
- /**
- * Show the captcha image
- * Refreshes the captcha image.
- *
- * @access public
- * @return void
- */
- public function refreshImage()
- {
- /* INIT */
- $captcha_unique_id = trim( $this->request['captcha_unique_id'] );
-
- /* Throw away */
- $blah = $this->class_captcha->getTemplate();
-
- require_once( IPS_KERNEL_PATH . 'classAjax.php' );
- $ajax = new classAjax();
-
- /* Show Image... */
- $ajax->returnString( $this->class_captcha->captchaKey );
- exit;
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Captcha
+ * Last Updated: $Date: 2010-10-19 11:56:25 -0400 (Tue, 19 Oct 2010) $
+ *
+ *
+ * @author $Author $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 20th February 2002
+ * @version $Rev: 6997 $
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_global_captcha extends ipsCommand
+{
+ /**
+ * Class entry point
+ *
+ * @param object Registry reference
+ * @return void [Outputs to screen/redirects]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* Load Cpatcha Class */
+ $this->class_captcha = $this->registry->getClass('class_captcha');
+
+ /* What to do... */
+ switch( $this->request['do'] )
+ {
+ default:
+ case 'showimage':
+ $this->showImage();
+ break;
+ case 'refresh':
+ $this->refreshImage();
+ break;
+ }
+ }
+
+ /**
+ * Show the captcha image
+ * Shows the captcha image. Good god, that was a waste of time
+ *
+ * @return void
+ */
+ public function showImage()
+ {
+ /* INIT */
+ $captcha_unique_id = trim( $this->request['captcha_unique_id'] );
+
+ /* GD installed? */
+ $this->class_captcha->show_error_gd_img = TRUE;
+
+ /* Show Image... */
+ $this->class_captcha->showImage( $captcha_unique_id );
+ }
+
+ /**
+ * Show the captcha image
+ * Refreshes the captcha image.
+ *
+ * @return void
+ */
+ public function refreshImage()
+ {
+ /* INIT */
+ $captcha_unique_id = trim( $this->request['captcha_unique_id'] );
+
+ /* Throw away */
+ $blah = $this->class_captcha->getTemplate();
+
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
+ $ajax = new $classToLoad();
+
+ /* Show Image... */
+ $ajax->returnString( $this->class_captcha->captchaKey );
+ exit;
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/global/comments.php b/upload/admin/applications/core/modules_public/global/comments.php
new file mode 100644
index 00000000..2a92307a
--- /dev/null
+++ b/upload/admin/applications/core/modules_public/global/comments.php
@@ -0,0 +1,322 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Image Ajax
+ * Last Updated: $LastChangedDate: 2010-08-18 16:55:30 +0100 (Wed, 18 Aug 2010) $
+ *
+ *
+ * @author $Author: matt $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Gallery
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6767 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_global_comments extends ipsCommand
+{
+ /**
+ * Main class entry point
+ *
+ * @access public
+ * @param object ipsRegistry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* From App */
+ $fromApp = trim( $this->request['fromApp'] );
+
+ /* Init some data */
+ require_once( IPS_ROOT_PATH . 'sources/classes/comments/bootstrap.php' );
+ $this->_comments = classes_comments_bootstrap::controller( $fromApp );
+
+ /* What to do? */
+ switch( $this->request['do'] )
+ {
+ case 'add':
+ $this->_add();
+ break;
+ case 'delete':
+ $this->_delete();
+ break;
+ case 'showEdit':
+ $this->_showEdit();
+ break;
+ case 'saveEdit':
+ $this->_saveEdit();
+ break;
+ case 'fetchReply':
+ $this->_fetchReply();
+ break;
+ case 'moderate':
+ $this->_moderate();
+ break;
+ case 'findLastComment':
+ $this->_findLastComment();
+ break;
+ case 'findComment':
+ $this->_findComment();
+ break;
+ }
+ }
+
+ /**
+ * Find last page of comments
+ *
+ * @access protected
+ * @return void [Redirects]
+ */
+ protected function _findLastComment()
+ {
+ /* Init */
+ $parentId = intval( $this->request['parentId'] );
+
+ $this->_comments->redirectToComment( 'last', $parentId );
+ }
+
+ /**
+ * Find last page of comments
+ *
+ * @access protected
+ * @return void [Redirects]
+ */
+ protected function _findComment()
+ {
+ /* Init */
+ $parentId = intval( $this->request['parentId'] );
+ $comment_id = intval( $this->request['comment_id'] );
+
+ $this->_comments->redirectToComment( $comment_id, $parentId );
+ }
+
+ /**
+ * Moderate
+ *
+ * @access protected
+ * @return void
+ */
+ protected function _moderate()
+ {
+ $parentId = intval( $this->request['parentId'] );
+ $commentIds = ( is_array( $_POST['commentIds'] ) ) ? IPSLib::cleanIntArray( $_POST['commentIds'] ) : array();
+ $modact = trim( $this->request['modact'] );
+
+ if ( count( $commentIds ) )
+ {
+ try
+ {
+ $this->_comments->moderate( $modact, $parentId, $commentIds, $this->memberData );
+
+ $this->returnJsonArray( array( 'msg' => 'ok' ) );
+ }
+ catch( Exception $error )
+ {
+ $this->returnJsonError( 'Error ' . $error->getMessage() . ' line: ' . $error->getFile() . '.' . $error->getLine() );
+ }
+ }
+ }
+
+ /**
+ * Reply
+ *
+ * @access public
+ * @return void
+ */
+ protected function _fetchReply()
+ {
+ /* INIT */
+ $commentId = intval( $this->request['comment_id'] );
+ $parentId = intval( $this->request['parentId'] );
+
+ /* Quick error checko */
+ if ( ! $commentId OR ! $parentId )
+ {
+ $this->returnString( 'error' );
+ }
+
+ # Get Edit form
+ try
+ {
+ $html = $this->_comments->fetchReply( $parentId, $commentId, $this->memberData );
+
+ $this->returnString( $html );
+ }
+ catch ( Exception $error )
+ {
+ $this->returnString( 'Error ' . $error->getMessage() );
+ }
+ }
+
+
+ /**
+ * Deletes a comment
+ *
+ * @access public
+ * @return void
+ */
+ protected function _delete()
+ {
+ /* INIT */
+ $commentId = intval( $this->request['comment_id'] );
+ $parentId = intval( $this->request['parentId'] );
+
+ /* Perm check (looks nice) */
+ if ( $this->request['auth_key'] != $this->member->form_hash )
+ {
+ $this->registry->getClass('output')->showError( 'posting_bad_auth_key', '1-global-comments-_delete-0', null, null, 403 );
+ }
+
+ /* Quick error checko */
+ if ( ! $commentId OR ! $parentId )
+ {
+ $this->registry->getClass('output')->showError( 'no_permission', '1-global-comments-_delete-2', null, null, 403 );
+ }
+
+ try
+ {
+ $this->_comments->delete( $parentId, $commentId, $this->memberData );
+
+ /* Redirect to find latest */
+ $this->_comments->redirectToComment( 'last', $parentId );
+ }
+ catch ( Exception $error )
+ {
+ $this->registry->getClass('output')->showError( 'no_permission', '1-global-comments-_delete-2', null, null, 403 );
+ }
+ }
+
+ /**
+ * Shows the edit box
+ *
+ * @access public
+ * @return void
+ */
+ protected function _showEdit()
+ {
+ /* INIT */
+ $commentId = intval( $this->request['comment_id'] );
+ $parentId = intval( $this->request['parentId'] );
+
+ /* Quick error checko */
+ if ( ! $commentId OR ! $parentId )
+ {
+ $this->returnString( 'error' );
+ }
+
+ array( 'parent_id' => 'id',
+ 'parent_owner_id' => 'member_id',
+ 'parent_parent_id' => 'img_album_id',
+ 'parent_title' => 'caption',
+ 'parent_seo_title' => 'caption_seo',
+ 'parent_date' => 'idate' );
+
+ # Get Edit form
+ try
+ {
+ $html = $this->_comments->displayEditForm( $parentId, $commentId, $this->memberData );
+
+ /* Get nav */
+ $parent = $this->_comments->remapFromLocal( $this->_comments->fetchParent( $parentId ), 'parent' );
+
+ /* Output */
+ $this->registry->getClass('output')->setTitle( $this->title );
+ $this->registry->getClass('output')->addContent( $html );
+
+ $this->registry->getClass('output')->addNavigation( $this->lang->words['edit_comment'] . $parent['parent_title'], sprintf( $this->_comments->fetchSetting('urls-showParent'), $parentId ), $parent['parent_seo_title'] );
+
+ $this->registry->getClass('output')->sendOutput();
+ }
+ catch ( Exception $error )
+ {
+ $this->registry->getClass('output')->showError( 'no_permission', '1-global-comments-_showEdit-0', null, null, 403 );
+ }
+ }
+
+ /**
+ * Saves the post
+ *
+ * @access public
+ * @return void
+ */
+ protected function _saveEdit()
+ {
+ /* INIT */
+ $commentId = intval( $this->request['comment_id'] );
+ $parentId = intval( $this->request['parentId'] );
+ $post = IPSText::parseCleanValue( $_POST['Post'] );
+
+ /* Perm check (looks nice) */
+ if ( $this->request['auth_key'] != $this->member->form_hash )
+ {
+ $this->registry->getClass('output')->showError( 'posting_bad_auth_key', '1-global-comments-_saveEdit-0', null, null, 403 );
+ }
+
+ /* Quick error checko */
+ if ( ! $parentId OR ! $commentId )
+ {
+ $this->registry->getClass('output')->showError( 'no_permission', '1-global-comments-_saveEdit-1', null, null, 403 );
+ }
+
+ /* Edit */
+ try
+ {
+ $this->_comments->edit( $parentId, $commentId, $_POST['Post'], $this->memberData );
+
+ $this->_comments->redirectToComment( $commentId, $parentId );
+ }
+ catch ( Exception $error )
+ {
+ $this->registry->getClass('output')->showError( 'no_permission', '1-global-comments-_saveEdit-2', null, null, 403 );
+ }
+ }
+
+ /**
+ * Add a comment via the magic and mystery of NORMAL POSTING FOOL
+ *
+ * @access protected
+ * @return void
+ */
+ protected function _add()
+ {
+ /* init */
+ $post = IPSText::parseCleanValue( $_POST['Post'] );
+ $parentId = intval( $this->request['parentId'] );
+
+ /* Perm check (looks nice) */
+ if ( $this->request['auth_key'] != $this->member->form_hash )
+ {
+ $this->registry->getClass('output')->showError( 'posting_bad_auth_key', '1-global-comments-_add-0', null, null, 403 );
+ }
+
+ if ( $post AND $parentId )
+ {
+ try
+ {
+ $newCommentId = $this->_comments->add( $parentId, $_POST['Post'] );
+
+ /* Redirect to find latest */
+ $this->_comments->redirectToComment( 'last', $parentId );
+ }
+ catch( Exception $e )
+ {
+ $this->registry->output->showError( 'no_permission', '1-global-comments-_add-1', null, null, 403 );
+ }
+ }
+ else
+ {
+ $this->registry->output->showError( 'no_permission', '1-global-comments-_add-2', null, null, 403 );
+ }
+ }
+
+
+}
diff --git a/upload/admin/applications/core/modules_public/global/defaultSection.php b/upload/admin/applications/core/modules_public/global/defaultSection.php
index c866bd9e..9d6a6500 100644
--- a/upload/admin/applications/core/modules_public/global/defaultSection.php
+++ b/upload/admin/applications/core/modules_public/global/defaultSection.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Define the default global section
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4948 $
+ * @version $Rev: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_public/global/favorites.php b/upload/admin/applications/core/modules_public/global/favorites.php
new file mode 100644
index 00000000..2a92307a
--- /dev/null
+++ b/upload/admin/applications/core/modules_public/global/favorites.php
@@ -0,0 +1,322 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Image Ajax
+ * Last Updated: $LastChangedDate: 2010-08-18 16:55:30 +0100 (Wed, 18 Aug 2010) $
+ *
+ *
+ * @author $Author: matt $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Gallery
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6767 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_global_comments extends ipsCommand
+{
+ /**
+ * Main class entry point
+ *
+ * @access public
+ * @param object ipsRegistry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* From App */
+ $fromApp = trim( $this->request['fromApp'] );
+
+ /* Init some data */
+ require_once( IPS_ROOT_PATH . 'sources/classes/comments/bootstrap.php' );
+ $this->_comments = classes_comments_bootstrap::controller( $fromApp );
+
+ /* What to do? */
+ switch( $this->request['do'] )
+ {
+ case 'add':
+ $this->_add();
+ break;
+ case 'delete':
+ $this->_delete();
+ break;
+ case 'showEdit':
+ $this->_showEdit();
+ break;
+ case 'saveEdit':
+ $this->_saveEdit();
+ break;
+ case 'fetchReply':
+ $this->_fetchReply();
+ break;
+ case 'moderate':
+ $this->_moderate();
+ break;
+ case 'findLastComment':
+ $this->_findLastComment();
+ break;
+ case 'findComment':
+ $this->_findComment();
+ break;
+ }
+ }
+
+ /**
+ * Find last page of comments
+ *
+ * @access protected
+ * @return void [Redirects]
+ */
+ protected function _findLastComment()
+ {
+ /* Init */
+ $parentId = intval( $this->request['parentId'] );
+
+ $this->_comments->redirectToComment( 'last', $parentId );
+ }
+
+ /**
+ * Find last page of comments
+ *
+ * @access protected
+ * @return void [Redirects]
+ */
+ protected function _findComment()
+ {
+ /* Init */
+ $parentId = intval( $this->request['parentId'] );
+ $comment_id = intval( $this->request['comment_id'] );
+
+ $this->_comments->redirectToComment( $comment_id, $parentId );
+ }
+
+ /**
+ * Moderate
+ *
+ * @access protected
+ * @return void
+ */
+ protected function _moderate()
+ {
+ $parentId = intval( $this->request['parentId'] );
+ $commentIds = ( is_array( $_POST['commentIds'] ) ) ? IPSLib::cleanIntArray( $_POST['commentIds'] ) : array();
+ $modact = trim( $this->request['modact'] );
+
+ if ( count( $commentIds ) )
+ {
+ try
+ {
+ $this->_comments->moderate( $modact, $parentId, $commentIds, $this->memberData );
+
+ $this->returnJsonArray( array( 'msg' => 'ok' ) );
+ }
+ catch( Exception $error )
+ {
+ $this->returnJsonError( 'Error ' . $error->getMessage() . ' line: ' . $error->getFile() . '.' . $error->getLine() );
+ }
+ }
+ }
+
+ /**
+ * Reply
+ *
+ * @access public
+ * @return void
+ */
+ protected function _fetchReply()
+ {
+ /* INIT */
+ $commentId = intval( $this->request['comment_id'] );
+ $parentId = intval( $this->request['parentId'] );
+
+ /* Quick error checko */
+ if ( ! $commentId OR ! $parentId )
+ {
+ $this->returnString( 'error' );
+ }
+
+ # Get Edit form
+ try
+ {
+ $html = $this->_comments->fetchReply( $parentId, $commentId, $this->memberData );
+
+ $this->returnString( $html );
+ }
+ catch ( Exception $error )
+ {
+ $this->returnString( 'Error ' . $error->getMessage() );
+ }
+ }
+
+
+ /**
+ * Deletes a comment
+ *
+ * @access public
+ * @return void
+ */
+ protected function _delete()
+ {
+ /* INIT */
+ $commentId = intval( $this->request['comment_id'] );
+ $parentId = intval( $this->request['parentId'] );
+
+ /* Perm check (looks nice) */
+ if ( $this->request['auth_key'] != $this->member->form_hash )
+ {
+ $this->registry->getClass('output')->showError( 'posting_bad_auth_key', '1-global-comments-_delete-0', null, null, 403 );
+ }
+
+ /* Quick error checko */
+ if ( ! $commentId OR ! $parentId )
+ {
+ $this->registry->getClass('output')->showError( 'no_permission', '1-global-comments-_delete-2', null, null, 403 );
+ }
+
+ try
+ {
+ $this->_comments->delete( $parentId, $commentId, $this->memberData );
+
+ /* Redirect to find latest */
+ $this->_comments->redirectToComment( 'last', $parentId );
+ }
+ catch ( Exception $error )
+ {
+ $this->registry->getClass('output')->showError( 'no_permission', '1-global-comments-_delete-2', null, null, 403 );
+ }
+ }
+
+ /**
+ * Shows the edit box
+ *
+ * @access public
+ * @return void
+ */
+ protected function _showEdit()
+ {
+ /* INIT */
+ $commentId = intval( $this->request['comment_id'] );
+ $parentId = intval( $this->request['parentId'] );
+
+ /* Quick error checko */
+ if ( ! $commentId OR ! $parentId )
+ {
+ $this->returnString( 'error' );
+ }
+
+ array( 'parent_id' => 'id',
+ 'parent_owner_id' => 'member_id',
+ 'parent_parent_id' => 'img_album_id',
+ 'parent_title' => 'caption',
+ 'parent_seo_title' => 'caption_seo',
+ 'parent_date' => 'idate' );
+
+ # Get Edit form
+ try
+ {
+ $html = $this->_comments->displayEditForm( $parentId, $commentId, $this->memberData );
+
+ /* Get nav */
+ $parent = $this->_comments->remapFromLocal( $this->_comments->fetchParent( $parentId ), 'parent' );
+
+ /* Output */
+ $this->registry->getClass('output')->setTitle( $this->title );
+ $this->registry->getClass('output')->addContent( $html );
+
+ $this->registry->getClass('output')->addNavigation( $this->lang->words['edit_comment'] . $parent['parent_title'], sprintf( $this->_comments->fetchSetting('urls-showParent'), $parentId ), $parent['parent_seo_title'] );
+
+ $this->registry->getClass('output')->sendOutput();
+ }
+ catch ( Exception $error )
+ {
+ $this->registry->getClass('output')->showError( 'no_permission', '1-global-comments-_showEdit-0', null, null, 403 );
+ }
+ }
+
+ /**
+ * Saves the post
+ *
+ * @access public
+ * @return void
+ */
+ protected function _saveEdit()
+ {
+ /* INIT */
+ $commentId = intval( $this->request['comment_id'] );
+ $parentId = intval( $this->request['parentId'] );
+ $post = IPSText::parseCleanValue( $_POST['Post'] );
+
+ /* Perm check (looks nice) */
+ if ( $this->request['auth_key'] != $this->member->form_hash )
+ {
+ $this->registry->getClass('output')->showError( 'posting_bad_auth_key', '1-global-comments-_saveEdit-0', null, null, 403 );
+ }
+
+ /* Quick error checko */
+ if ( ! $parentId OR ! $commentId )
+ {
+ $this->registry->getClass('output')->showError( 'no_permission', '1-global-comments-_saveEdit-1', null, null, 403 );
+ }
+
+ /* Edit */
+ try
+ {
+ $this->_comments->edit( $parentId, $commentId, $_POST['Post'], $this->memberData );
+
+ $this->_comments->redirectToComment( $commentId, $parentId );
+ }
+ catch ( Exception $error )
+ {
+ $this->registry->getClass('output')->showError( 'no_permission', '1-global-comments-_saveEdit-2', null, null, 403 );
+ }
+ }
+
+ /**
+ * Add a comment via the magic and mystery of NORMAL POSTING FOOL
+ *
+ * @access protected
+ * @return void
+ */
+ protected function _add()
+ {
+ /* init */
+ $post = IPSText::parseCleanValue( $_POST['Post'] );
+ $parentId = intval( $this->request['parentId'] );
+
+ /* Perm check (looks nice) */
+ if ( $this->request['auth_key'] != $this->member->form_hash )
+ {
+ $this->registry->getClass('output')->showError( 'posting_bad_auth_key', '1-global-comments-_add-0', null, null, 403 );
+ }
+
+ if ( $post AND $parentId )
+ {
+ try
+ {
+ $newCommentId = $this->_comments->add( $parentId, $_POST['Post'] );
+
+ /* Redirect to find latest */
+ $this->_comments->redirectToComment( 'last', $parentId );
+ }
+ catch( Exception $e )
+ {
+ $this->registry->output->showError( 'no_permission', '1-global-comments-_add-1', null, null, 403 );
+ }
+ }
+ else
+ {
+ $this->registry->output->showError( 'no_permission', '1-global-comments-_add-2', null, null, 403 );
+ }
+ }
+
+
+}
diff --git a/upload/admin/applications/core/modules_public/global/index.html b/upload/admin/applications/core/modules_public/global/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_public/global/index.html
+++ b/upload/admin/applications/core/modules_public/global/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/global/login.php b/upload/admin/applications/core/modules_public/global/login.php
index 2223319f..f617b5c5 100644
--- a/upload/admin/applications/core/modules_public/global/login.php
+++ b/upload/admin/applications/core/modules_public/global/login.php
@@ -1,623 +1,525 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class public_core_global_login extends ipsCommand
-{
- /**
- * Login handler object
- *
- * @access protected
- * @var object
- */
- protected $han_login;
-
- /**
- * Facebook connect class
- *
- * @access protected
- * @var object
- */
- private $_facebook;
-
- /**
- * 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->init();
- }
-
- /**
- * Class entry point
- *
- * @access public
- * @param object Registry reference
- * @return void [Outputs to screen/redirects]
- */
- public function doExecute( ipsRegistry $registry )
- {
- /* Make object */
- $this->registry = $registry;
- $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();
-
- $this->registry->getClass( 'class_localization' )->loadLanguageFile( array( 'public_login' ), 'core' );
-
- //-----------------------------------------
- // Load handler...
- //-----------------------------------------
-
- $this->initHanLogin();
-
- //-----------------------------------------
- // INIT Facebook
- //-----------------------------------------
-
- if ( IPSLib::fbc_enabled() )
- {
- require_once( IPS_ROOT_PATH . 'sources/classes/facebook/connect.php' );
- $this->_facebook = new facebook_connect( $registry );
- }
-
- //-----------------------------------------
- // Are we enforcing log ins?
- //-----------------------------------------
-
- $msg = "";
-
- if ( !$this->request['do'] == 'showForm' AND $this->settings['force_login'] == 1 )
- {
- $msg = 'admin_force_log_in';
- }
-
- //-----------------------------------------
- // What to do?
- //-----------------------------------------
-
- switch( $this->request['do'] )
- {
- case 'fbc_login':
- $return = $this->fbcLogin();
- break;
- case 'fbc_loginFromLinked':
- $return = $this->fbcLoginFromLinked();
- break;
- case 'fbc_loginWithNew':
- $return = $this->fbcLoginWithNew();
- break;
- case 'process':
- $return = $this->doLogin();
-
- if( $return[2] )
- {
- //$this->registry->getClass('output')->showError( $return[2], 1014 );
- $this->loginForm( $return[2], $return[3] );
- }
- else
- {
- $this->registry->getClass('output')->redirectScreen( $return[0], $return[1], 'false' );
- }
- break;
-
- case 'logout':
- $return = $this->doLogout();
-
- /* URL */
- $return[2] = $return[2] ? $return[2] : '';
-
- if( $return[0] == 'immediate' )
- {
- $this->registry->getClass('output')->silentRedirect( $return[2] );
- }
- else
- {
- $this->registry->getClass('output')->redirectScreen( $return[1], $return[2], 'false' );
- }
- break;
-
- case 'deleteCookies':
- $return = $this->deleteCookies();
- $this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] );
- break;
-
- case 'autologin':
- $return = $this->autoLogin();
- break;
-
- case 'showForm':
- default:
- $return = $this->loginForm($msg);
- break;
- }
-
- //-----------------------------------------
- // If we have any HTML to print, do so...
- //-----------------------------------------
-
- $this->registry->getClass('output')->addContent("$this->output");
- $this->registry->getClass('output')->sendOutput( array( 'TITLE' => $this->page_title, 'JS' => 0, 'NAV' => $this->nav ) );
- }
-
- /**
- * FB Log in from a new account
- * Function is called when IPB has detected a FB user that is linked to an IPB user
- *
- * @access public
- * @return void Redirects user
- */
- public function fbcLoginWithNew()
- {
- try
- {
- $result = $this->_facebook->loginWithNewAccount();
-
- $this->registry->getClass('output')->redirectScreen( $result[0], $result[1], true );
- }
- catch( Exception $error )
- {
- $msg = $error->getMessage();
-
- switch( $msg )
- {
- default:
- case 'NO_FACEBOOK_USER_LOGGED_IN':
- case 'NO_FB_EMAIL':
- case 'CREATION_FAIL':
- $this->registry->getClass('output')->showError( 'fbc_authorization_screwup', 1005 );
- break;
- }
- }
- }
-
- /**
- * FB Log in from a linked account
- * Function is called when IPB has detected a FB user that is linked to an IPB user
- *
- * @access public
- * @return void Redirects user
- */
- public function fbcLoginFromLinked()
- {
- try
- {
- $result = $this->_facebook->loginWithExistingLink();
-
- $this->registry->getClass('output')->redirectScreen( $result[0], $result[1], true );
- }
- catch( Exception $error )
- {
- $msg = $error->getMessage();
-
- switch( $msg )
- {
- default:
- case 'NO_FACEBOOK_USER_LOGGED_IN':
- case 'NO_LINKED_MEMBER':
- $this->registry->getClass('output')->showError( 'fbc_authorization_screwup', 1005 );
- break;
- }
- }
- }
-
- /**
- * FB Log in
- * Function is called when IPB has detected a FB user and they've authorized by ajax.
- *
- * @access public
- * @return void Redirects user
- */
- public function fbcLogin()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $email = $this->request['emailaddress'];
- $password = $this->request['password'];
-
- try
- {
- $result = $this->_facebook->loginWithCreateLink( $email, $password );
-
- $this->registry->getClass('output')->redirectScreen( $result[0], $result[1], true );
- }
- catch( Exception $error )
- {
- $msg = $error->getMessage();
-
- switch( $msg )
- {
- default:
- case 'NO_FACEBOOK_USER_LOGGED_IN':
- case 'AUTH_FAIL':
- case 'ALREADY_LINKED':
- $this->registry->getClass('output')->showError( 'fbc_authorization_screwup', 1005 );
- break;
- }
- }
- }
-
- /**
- * Attempt to automatically log a user in
- *
- * @access public
- * @return array [0=Words to display,1=URL to send to]
- */
- public function autoLogin()
- {
- /* Verify the login */
- $this->han_login->verifyLogin();
-
- /* Lang Bits */
- $true_words = $this->lang->words['logged_in'];
- $false_words = $this->lang->words['not_logged_in'];
- $method = 'no_show';
-
- /* Register Redirect */
- if ($this->request['fromreg'] == 1)
- {
- $true_words = $this->lang->words['reg_log_in'];
- $false_words = $this->lang->words['reg_not_log_in'];
- $method = 'show';
- }
- /* Email Redirect */
- else if ($this->request['fromemail'] == 1)
- {
- $true_words = $this->lang->words['email_log_in'];
- $false_words = $this->lang->words['email_not_log_in'];
- $method = 'show';
- }
- /* Password Redirect */
- else if ($this->request['frompass'] == 1)
- {
- $true_words = $this->lang->words['pass_log_in'];
- $false_words = $this->lang->words['pass_not_log_in'];
- $method = 'show';
- }
-
- if( $this->memberData[ 'member_id' ] )
- {
- /* Member Sync */
- IPSLib::runMemberSync( 'onLogin', $this->memberData );
-
- if ( ! $this->request['fromreg'] )
- {
- IPSCookie::set('session_id', '0', -1 );
- }
-
- if( $method == 'show' )
- {
- $this->registry->getClass('output')->redirectScreen( $true_words, $this->settings['base_url'] );
- }
- else
- {
- $this->registry->getClass('output')->silentRedirect( $this->settings['board_url'] . '/index.php' );
- }
- }
- else
- {
- if( $method == 'show' )
- {
- $this->registry->getClass('output')->redirectScreen( $false_words, $this->settings['base_url'] . 'app=core&module=global§ion=login' );
- }
- else
- {
- $this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=core&module=global§ion=login' );
- }
- }
- }
-
- /**
- * Delete a user's cookies
- *
- * @access public
- * @param boolean Check the key
- * @return mixed Output error page if key checking fails, else boolean true
- */
- public function deleteCookies( $check_key=true )
- {
- //-----------------------------------------
- // Check the md5 key
- //-----------------------------------------
-
- if( $check_key )
- {
- $key = $this->request['k'];
-
- if ( $key != $this->member->form_hash )
- {
- $this->registry->getClass('output')->showError( 'bad_delete_cookies_key', 2010 );
- }
- }
-
- //-----------------------------------------
- // Wipe out any forum password cookies
- //-----------------------------------------
-
- if ( is_array($_COOKIE) )
- {
- foreach( $_COOKIE as $cookie => $value )
- {
- if ( stripos( $cookie, $this->settings['cookie_id']."ipbforum" ) !== false )
- {
- IPSCookie::set( str_replace( $this->settings['cookie_id'], "", $cookie ) , '-', -1 );
- }
-
- if ( stripos( $cookie, $this->settings['cookie_id']."itemMarking_" ) !== false )
- {
- IPSCookie::set( str_replace( $this->settings['cookie_id'], "", $cookie ) , '-', -1 );
- }
- }
- }
-
- //-----------------------------------------
- // And the rest of the cookies
- //-----------------------------------------
-
- IPSCookie::set('pass_hash' , '-1');
- IPSCookie::set('member_id' , '-1');
- IPSCookie::set('session_id', '-1');
- IPSCookie::set('anonlogin' , '-1');
-
- return true;
- }
-
- /**
- * Show the login form
- *
- * @access public
- * @param string Message to show on login form
- * @return string Login form HTML
- */
- public function loginForm( $message="", $replacement='' )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $extra_form = "";
- $show_form = 1;
- $template = '';
-
- //-----------------------------------------
- // Are they banned?
- //-----------------------------------------
-
- if ( IPSMember::isBanned( 'ip', $this->member->ip_address ) )
- {
- $this->registry->getClass('output')->showError( 'you_are_banned', 2011 );
- }
-
- if ( $message != "" )
- {
- if( $replacement )
- {
- $message = sprintf( $this->lang->words[ $message ], $replacement );
- }
- else
- {
- $message = $this->lang->words[ $message ];
- }
- $name = $this->request['UserName'] ? $this->request['UserName'] : $this->request['address'];
- $message = str_replace( "<#NAME#>", "" . $name . " ", $message );
-
- $template .= $this->registry->getClass('output')->getTemplate('login')->errors($message);
- }
-
- //-----------------------------------------
- // Using an alternate log in form?
- //-----------------------------------------
-
- $this->han_login->checkLoginUrlRedirect();
-
- //-----------------------------------------
- // Extra HTML?
- //-----------------------------------------
-
- $additionalForm = $this->han_login->additionalFormHTML();
-
- if ( count($additionalForm[1]) )
- {
- if ( $additionalForm[0] == 'add' )
- {
- $extra_form = $additionalForm[1];
- $show_form = 1;
- }
- else
- {
- $template .= $additionalForm[1];
- $show_form = 0;
- }
- }
-
- //-----------------------------------------
- // Continue...
- //-----------------------------------------
-
- if ( $show_form )
- {
- if( $this->request['referer'] )
- {
- $http_referrer = $this->request['referer'];
- }
- else if ( !my_getenv('HTTP_REFERER') OR stripos( my_getenv('HTTP_REFERER'), $this->settings['board_url'] ) === false )
- {
- $http_referrer = ( strtolower($_SERVER['HTTPS']) == 'on' ? "https://" : "http://" ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
- }
- else
- {
- $http_referrer = my_getenv('HTTP_REFERER');
- }
-
- $facebookOpts = array();
- $login_methods = false;
- $uses_name = false;
- $uses_email = false;
-
- foreach( $this->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['enter_name'] = $this->lang->words['enter_name_and_email'];
- }
- else if( $uses_email )
- {
- $this->lang->words['enter_name'] = $this->lang->words['enter_useremail'];
- }
- else
- {
- $this->lang->words['enter_name'] = $this->lang->words['enter_username'];
- }
-
- $template .= $this->registry->getClass('output')->getTemplate('login')->showLogInForm( $this->lang->words['please_log_in'], htmlentities(urldecode($http_referrer)), $extra_form, $login_methods, $facebookOpts );
- }
-
- /* Work around for bug http://bugs.developers.facebook.com/show_bug.cgi?id=3237 */
- if ( IPSLib::fbc_enabled() )
- {
- $this->_facebook->testConnectSession();
- }
-
- $this->registry->getClass('output')->addNavigation( $this->lang->words['log_in'], '' );
- $this->registry->getClass('output')->setTitle( $this->lang->words['log_in'] );
- $this->registry->getClass('output')->addContent( $template );
- $this->registry->getClass('output')->sendOutput( );
- }
-
- /**
- * Verify login form submission and log user in
- *
- * @access public
- * @return mixed array [0=Words to show, 1=URL to send to, 2=error array]
- */
- public function doLogin()
- {
- return $this->han_login->verifyLogin();
- }
-
- /**
- * Log a user out
- *
- * @access public
- * @param integer Flag to check md5 key
- * @return mixed Error message or array [0=immediate|redirect, 1=words to show, 2=URL to send to]
- */
- public function doLogout( $check_key=true )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- if ( $check_key )
- {
- $key = $this->request['k'];
-
- # Check for funny business
- if ( $key != $this->member->form_hash )
- {
- $this->registry->getClass('output')->showError( 'bad_logout_key', 2012 );
- }
- }
-
- //-----------------------------------------
- // Set some cookies
- //-----------------------------------------
-
- IPSCookie::set( "member_id" , "0" );
- IPSCookie::set( "pass_hash" , "0" );
- IPSCookie::set( "anonlogin" , "-1" );
-
- if( is_array( $_COOKIE ) )
- {
- foreach( $_COOKIE as $cookie => $value)
- {
- if ( stripos( $cookie, $this->settings['cookie_id'] . 'ipbforumpass' ) !== false )
- {
- IPSCookie::set( $cookie, '-', -1 );
- }
- }
- }
-
- //-----------------------------------------
- // Logout callbacks...
- //-----------------------------------------
-
- $this->han_login->logoutCallback();
-
- //-----------------------------------------
- // Do it..
- //-----------------------------------------
-
- $this->member->sessionClass()->convertMemberToGuest();
-
- list( $privacy, $loggedin ) = explode( '&', $this->memberData['login_anonymous'] );
-
- IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'login_anonymous' => "{$privacy}&0",
- 'last_activity' => time() ) ) );
-
-
- //-----------------------------------------
- // Return..
- //-----------------------------------------
-
- $url = "";
-
- if ( $this->request['return'] AND $this->request['return'] != "" )
- {
- $return = urldecode($this->request['return']);
-
- if ( strpos( $return, "http://" ) === 0 )
- {
- return array( 'immediate', '', $return );
- }
- }
-
- return array( 'redirect', $this->lang->words['thanks_for_logout'], $this->settings['base_url'] . 'act=idx' );
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Login handler abstraction
+ * Last Updated: $Date: 2010-10-07 18:12:54 -0400 (Thu, 07 Oct 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since Tuesday 1st March 2005 (11:52)
+ * @version $Revision: 6954 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_global_login extends ipsCommand
+{
+ /**
+ * Login handler object
+ *
+ * @access protected
+ * @var object
+ */
+ protected $han_login;
+
+ /**
+ * Facebook connect class
+ *
+ * @access protected
+ * @var object
+ */
+ private $_facebook;
+
+ /**
+ * Initiate login handler
+ *
+ * @access public
+ * @return void
+ */
+ public function initHanLogin()
+ {
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $this->han_login = new $classToLoad( $this->registry );
+ $this->han_login->init();
+ }
+
+ /**
+ * Class entry point
+ *
+ * @access public
+ * @param object Registry reference
+ * @return void [Outputs to screen/redirects]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* Make object */
+ $this->registry = $registry;
+ $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();
+
+ $this->registry->getClass( 'class_localization' )->loadLanguageFile( array( 'public_login' ), 'core' );
+
+ //-----------------------------------------
+ // Load handler...
+ //-----------------------------------------
+
+ $this->initHanLogin();
+
+ //-----------------------------------------
+ // Are we enforcing log ins?
+ //-----------------------------------------
+
+ $msg = "";
+
+ if ( !$this->request['do'] == 'showForm' AND $this->settings['force_login'] == 1 )
+ {
+ $msg = 'admin_force_log_in';
+ }
+
+ //-----------------------------------------
+ // Meta tags
+ //-----------------------------------------
+
+ $this->registry->output->addMetaTag( 'robots', 'noindex' );
+
+ //-----------------------------------------
+ // What to do?
+ //-----------------------------------------
+
+ switch( $this->request['do'] )
+ {
+ case 'process':
+ $return = $this->doLogin();
+
+ if( $return[2] )
+ {
+ //$this->registry->getClass('output')->showError( $return[2], 1014 );
+ $this->loginForm( $return[2], $return[3] );
+ }
+ else
+ {
+ $this->registry->getClass('output')->redirectScreen( $return[0], $return[1], 'false' );
+ }
+ break;
+
+ case 'logout':
+ $return = $this->doLogout();
+
+ /* URL */
+ $return[2] = $return[2] ? $return[2] : '';
+
+ if( $return[0] == 'immediate' )
+ {
+ $this->registry->getClass('output')->silentRedirect( $return[2] );
+ }
+ else
+ {
+ $this->registry->getClass('output')->redirectScreen( $return[1], $return[2], 'false' );
+ }
+ break;
+
+ case 'deleteCookies':
+ $return = $this->deleteCookies();
+ $this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] );
+ break;
+
+ case 'autologin':
+ $return = $this->autoLogin();
+ break;
+
+ case 'showForm':
+ default:
+ $return = $this->loginForm($msg);
+ break;
+ }
+
+ //-----------------------------------------
+ // If we have any HTML to print, do so...
+ //-----------------------------------------
+
+ $this->registry->getClass('output')->addContent( $this->output );
+ $this->registry->getClass('output')->sendOutput();
+ }
+
+ /**
+ * Attempt to automatically log a user in
+ *
+ * @access public
+ * @return array [0=Words to display,1=URL to send to]
+ */
+ public function autoLogin()
+ {
+ /* Verify the login */
+ $this->han_login->verifyLogin();
+
+ /* Lang Bits */
+ $true_words = $this->lang->words['logged_in'];
+ $false_words = $this->lang->words['not_logged_in'];
+ $method = 'no_show';
+
+ /* Register Redirect */
+ if ($this->request['fromreg'] == 1)
+ {
+ $true_words = $this->lang->words['reg_log_in'];
+ $false_words = $this->lang->words['reg_not_log_in'];
+ $method = 'show';
+ }
+ /* Email Redirect */
+ else if ($this->request['fromemail'] == 1)
+ {
+ $true_words = $this->lang->words['email_log_in'];
+ $false_words = $this->lang->words['email_not_log_in'];
+ $method = 'show';
+ }
+ /* Password Redirect */
+ else if ($this->request['frompass'] == 1)
+ {
+ $true_words = $this->lang->words['pass_log_in'];
+ $false_words = $this->lang->words['pass_not_log_in'];
+ $method = 'show';
+ }
+
+ if( $this->memberData[ 'member_id' ] )
+ {
+ /* Member Sync */
+ IPSLib::runMemberSync( 'onLogin', $this->memberData );
+
+ if ( ! $this->request['fromreg'] )
+ {
+ IPSCookie::set('session_id', '0', -1 );
+ }
+
+ if( $method == 'show' )
+ {
+ $this->registry->getClass('output')->redirectScreen( $true_words, $this->settings['base_url'] );
+ }
+ else
+ {
+ $this->registry->getClass('output')->silentRedirect( $this->settings['board_url'] . '/index.php' );
+ }
+ }
+ else
+ {
+ if( $method == 'show' )
+ {
+ $this->registry->getClass('output')->redirectScreen( $false_words, $this->settings['base_url'] . 'app=core&module=global§ion=login' );
+ }
+ else
+ {
+ $this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=core&module=global§ion=login' );
+ }
+ }
+ }
+
+ /**
+ * Delete a user's cookies
+ *
+ * @access public
+ * @param boolean Check the key
+ * @return mixed Output error page if key checking fails, else boolean true
+ */
+ public function deleteCookies( $check_key=true )
+ {
+ //-----------------------------------------
+ // Check the md5 key
+ //-----------------------------------------
+
+ if( $check_key )
+ {
+ $key = $this->request['k'];
+
+ if ( $key != $this->member->form_hash )
+ {
+ $this->registry->getClass('output')->showError( 'bad_delete_cookies_key', 2010 );
+ }
+ }
+
+ //-----------------------------------------
+ // Wipe out any forum password cookies
+ //-----------------------------------------
+
+ if ( is_array($_COOKIE) )
+ {
+ foreach( $_COOKIE as $cookie => $value )
+ {
+ if ( stripos( $cookie, $this->settings['cookie_id']."ipbforum" ) !== false )
+ {
+ IPSCookie::set( str_replace( $this->settings['cookie_id'], "", $cookie ), '-', -1 );
+ }
+
+ if ( stripos( $cookie, $this->settings['cookie_id']."itemMarking_" ) !== false )
+ {
+ IPSCookie::set( str_replace( $this->settings['cookie_id'], "", $cookie ), '-', -1 );
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // And the rest of the cookies
+ //-----------------------------------------
+
+ IPSCookie::set('pass_hash' , '-1');
+ IPSCookie::set('member_id' , '-1');
+ IPSCookie::set('session_id', '-1');
+ IPSCookie::set('anonlogin' , '-1');
+
+ return true;
+ }
+
+ /**
+ * Show the login form
+ *
+ * @access public
+ * @param string Message to show on login form
+ * @return string Login form HTML
+ */
+ public function loginForm( $message="", $replacement='' )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $extra_form = "";
+ $show_form = 1;
+ $template = '';
+ $serviceClick = trim( $this->request['serviceClick'] );
+
+ //-----------------------------------------
+ // Are they banned?
+ //-----------------------------------------
+
+ if ( IPSMember::isBanned( 'ip', $this->member->ip_address ) )
+ {
+ $this->registry->getClass('output')->showError( 'you_are_banned', 2011, null, null, 403 );
+ }
+
+ if ( $message != "" )
+ {
+ if( $replacement )
+ {
+ $message = sprintf( $this->lang->words[ $message ], $replacement );
+ }
+ else
+ {
+ $message = $this->lang->words[ $message ];
+ }
+ $name = $this->request['UserName'] ? $this->request['UserName'] : $this->request['address'];
+ $message = str_replace( "<#NAME#>", "" . $name . " ", $message );
+
+ $template .= $this->registry->getClass('output')->getTemplate('login')->errors($message);
+ }
+
+ //-----------------------------------------
+ // Using an alternate log in form?
+ //-----------------------------------------
+
+ $this->han_login->checkLoginUrlRedirect();
+
+ /* Did we click a service? */
+ if ( $serviceClick )
+ {
+ switch ($serviceClick)
+ {
+ case 'facebook':
+ $this->registry->getClass('output')->silentRedirect( $this->settings['_original_base_url'] . "/interface/facebook/index.php?reg=1" );
+ break;
+ case 'twitter':
+ $this->registry->getClass('output')->silentRedirect( $this->settings['_original_base_url'] . "/interface/twitter/index.php?reg=1" );
+ break;
+ }
+ }
+
+ //-----------------------------------------
+ // Extra HTML?
+ //-----------------------------------------
+
+ $additionalForm = $this->han_login->additionalFormHTML();
+
+ if ( count($additionalForm[1]) )
+ {
+ if ( $additionalForm[0] == 'add' )
+ {
+ $extra_form = $additionalForm[1];
+ $show_form = 1;
+ }
+ else
+ {
+ $template .= $additionalForm[1];
+ $show_form = 0;
+ }
+ }
+
+ //-----------------------------------------
+ // Continue...
+ //-----------------------------------------
+
+ if ( $show_form )
+ {
+ if( $this->request['referer'] )
+ {
+ $http_referrer = $this->request['referer'];
+ }
+ else
+ {
+ $http_referrer = my_getenv('HTTP_REFERER');
+ }
+
+ $facebookOpts = array();
+ $login_methods = false;
+ $uses_name = false;
+ $uses_email = false;
+
+ foreach( $this->cache->getCache('login_methods') as $method )
+ {
+ $login_methods[ $method['login_folder_name'] ] = $method['login_folder_name'];
+
+ if( $method['login_user_id'] == 'username' or $method['login_user_id'] == 'either' )
+ {
+ $uses_name = true;
+ }
+
+ if( $method['login_user_id'] == 'email' or $method['login_user_id'] == 'either' )
+ {
+ $uses_email = true;
+ }
+ }
+
+ if( $uses_name AND $uses_email )
+ {
+ $this->lang->words['enter_name'] = $this->lang->words['enter_name_and_email'];
+ }
+ else if( $uses_email )
+ {
+ $this->lang->words['enter_name'] = $this->lang->words['enter_useremail'];
+ }
+ else
+ {
+ $this->lang->words['enter_name'] = $this->lang->words['enter_username'];
+ }
+
+ $template .= $this->registry->getClass('output')->getTemplate('login')->showLogInForm( $this->lang->words['please_log_in'], htmlentities(urldecode($http_referrer)), $extra_form, $login_methods, $facebookOpts );
+ }
+
+
+ $this->registry->getClass('output')->addNavigation( $this->lang->words['log_in'], '' );
+ $this->registry->getClass('output')->setTitle( $this->lang->words['log_in'] . ' - ' . ipsRegistry::$settings['board_name'] );
+ $this->registry->getClass('output')->addContent( $template );
+ $this->registry->getClass('output')->sendOutput( );
+ }
+
+ /**
+ * Verify login form submission and log user in
+ *
+ * @access public
+ * @return mixed array [0=Words to show, 1=URL to send to, 2=error array]
+ */
+ public function doLogin()
+ {
+ if ( $this->request['auth_key'] != $this->member->form_hash )
+ {
+ $this->registry->getClass('output')->showError( 'login_no_authkey', 10193, null, null, 403 );
+ }
+
+ return $this->han_login->verifyLogin();
+ }
+
+ /**
+ * Log a user out
+ *
+ * @access public
+ * @param integer Flag to check md5 key
+ * @return mixed Error message or array [0=immediate|redirect, 1=words to show, 2=URL to send to]
+ */
+ public function doLogout( $check_key=true )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ if ( $check_key )
+ {
+ $key = $this->request['k'];
+
+ # Check for funny business
+ if ( $key != $this->member->form_hash )
+ {
+ $this->registry->getClass('output')->showError( 'bad_logout_key', 2012 );
+ }
+ }
+
+ //-----------------------------------------
+ // Set some cookies
+ //-----------------------------------------
+
+ IPSCookie::set( "member_id" , "0" );
+ IPSCookie::set( "pass_hash" , "0" );
+ IPSCookie::set( "anonlogin" , "-1" );
+
+ if( is_array( $_COOKIE ) )
+ {
+ foreach( $_COOKIE as $cookie => $value)
+ {
+ if ( stripos( $cookie, $this->settings['cookie_id'] . 'ipbforumpass' ) !== false AND ! strstr( $value, 'mobileApp' ) )
+ {
+ IPSCookie::set( str_replace( $this->settings['cookie_id'], "", $cookie ), '-', -1 );
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Do it..
+ //-----------------------------------------
+
+ $this->member->sessionClass()->convertMemberToGuest();
+
+ list( $privacy, $loggedin ) = explode( '&', $this->memberData['login_anonymous'] );
+
+ IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'login_anonymous' => "{$privacy}&0",
+ 'last_activity' => time() ) ) );
+
+ //-----------------------------------------
+ // Logout callbacks...
+ //-----------------------------------------
+
+ IPSLib::runMemberSync( 'onLogOut', $this->memberData );
+
+ $this->han_login->logoutCallback();
+
+ //-----------------------------------------
+ // Return..
+ //-----------------------------------------
+
+ $url = "";
+
+ if ( $this->request['return'] AND $this->request['return'] != "" )
+ {
+ $return = urldecode($this->request['return']);
+
+ if ( strpos( $return, "http://" ) === 0 )
+ {
+ return array( 'immediate', '', $return );
+ }
+ }
+
+ return array( 'redirect', $this->lang->words['thanks_for_logout'], $this->settings['base_url'] );
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/global/lostpass.php b/upload/admin/applications/core/modules_public/global/lostpass.php
index 842560c5..6fa72105 100644
--- a/upload/admin/applications/core/modules_public/global/lostpass.php
+++ b/upload/admin/applications/core/modules_public/global/lostpass.php
@@ -1,490 +1,498 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class public_core_global_lostpass extends ipsCommand
-{
- /**
- * Class entry point
- *
- * @access public
- * @param object Registry reference
- * @return void [Outputs to screen/redirects]
- */
- public function doExecute( ipsRegistry $registry )
- {
- /* Load language */
- $this->registry->class_localization->loadLanguageFile( array( 'public_register' ), 'core' );
-
- /* What to do */
- switch( $this->request['do'] )
- {
- case 'sendform':
- $this->lostPasswordValidateForm();
- break;
-
- case '11':
- $this->lostPasswordEnd();
- break;
-
- case '03':
- $this->lostPasswordValidate();
- break;
-
- default:
- case '10':
- $this->lostPasswordForm();
- break;
- }
-
- /* Output */
- $this->registry->output->addContent( $this->output );
- $this->registry->output->sendOutput();
- }
-
- /**
- * Validates a lost password request
- *
- * @access public
- * @return void
- */
- public function lostPasswordValidate()
- {
- /* Check for input and it's in a valid format. */
- $in_user_id = intval( trim( urldecode( $this->request['uid'] ) ) );
- $in_validate_key = IPSText::md5Clean( trim( urldecode( $this->request['aid'] ) ) );
-
- /* Check Input */
- if( ! $in_validate_key )
- {
- $this->registry->output->showError( 'validation_key_incorrect', 1015 );
- }
-
- if( ! preg_match( "/^(?:\d){1,}$/", $in_user_id ) )
- {
- $this->registry->output->showError( 'uid_key_incorrect', 1016 );
- }
-
- /* Attempt to get the profile of the requesting user */
- $member = IPSMember::load( $in_user_id );
-
- if( ! $member['member_id'] )
- {
- $this->registry->output->showError( 'lostpass_no_member', 1017 );
- }
-
- /* Get validating info.. */
- $validate = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'validating', 'where' => 'member_id=' . $in_user_id . ' and lost_pass=1' ) );
-
- if( ! $validate['member_id'] )
- {
- $this->registry->output->showError( 'lostpass_not_validating', 1018 );
- }
-
- if( ( $validate['new_reg'] == 1 ) && ( $this->settings['reg_auth_type'] == "admin" ) )
- {
- $this->registry->output->showError( 'lostpass_new_reg', 4010, true );
- }
-
- if( $validate['vid'] != $in_validate_key )
- {
- $this->registry->output->showError( 'lostpass_key_wrong', 1019 );
- }
- else
- {
- /* On the same page? */
- if( $validate['lost_pass'] != 1 )
- {
- $this->registry->output->showError( 'lostpass_not_lostpass', 4011, true );
- }
-
- /* Test GD image */
- if( $this->settings['bot_antispam'] )
- {
- if ( $this->registry->getClass('class_captcha')->validate() !== TRUE )
- {
- $this->lostPasswordValidateForm( 'err_reg_code' );
- return;
- }
- }
-
- /* Send a new random password? */
- if( $this->settings['lp_method'] == 'random' )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $save_array = array();
-
- //-----------------------------------------
- // Generate a new random password
- //-----------------------------------------
-
- $new_pass = IPSLib::makePassword();
-
- //-----------------------------------------
- // Generate a new salt
- //-----------------------------------------
-
- $salt = IPSMember::generatePasswordSalt(5);
- $salt = str_replace( '\\', "\\\\", $salt );
-
- //-----------------------------------------
- // New log in key
- //-----------------------------------------
-
- $key = IPSMember::generateAutoLoginKey();
-
- //-----------------------------------------
- // Update...
- //-----------------------------------------
-
- $save_array['members_pass_salt'] = $salt;
- $save_array['members_pass_hash'] = md5( md5($salt) . md5( $new_pass ) );
- $save_array['member_login_key'] = $key;
- $save_array['member_login_key_expire'] = $this->settings['login_key_expire'] * 60 * 60 * 24;
- $save_array['failed_logins'] = null;
- $save_array['failed_login_count'] = 0;
-
- //-----------------------------------------
- // Load handler...
- //-----------------------------------------
-
- require_once( IPS_ROOT_PATH.'sources/handlers/han_login.php' );
- $this->han_login = new han_login( $this->registry );
- $this->han_login->init();
- $this->han_login->changePass( $member['email'], md5( $new_pass ) );
-
- if ( $this->han_login->return_code != 'METHOD_NOT_DEFINED' AND $this->han_login->return_code != 'SUCCESS' )
- {
- $this->registry->output->showError( $this->lang->words['lostpass_external_fail'], 2013 );
- }
-
- IPSMember::save( $member['member_id'], array( 'members' => $save_array ) );
-
- //-----------------------------------------
- // Send out the email...
- //-----------------------------------------
-
- IPSText::getTextClass('email')->getTemplate("lost_pass_email_pass");
-
- IPSText::getTextClass('email')->buildMessage( array(
- 'NAME' => $member['members_display_name'],
- 'THE_LINK' => $this->settings['base_url'] . 'app=core&module=usercp&tab=core&area=password',
- 'PASSWORD' => $new_pass,
- 'LOGIN' => $this->settings['base_url'] . 'app=core&module=global§ion=login',
- 'USERNAME' => $member['name'],
- 'EMAIL' => $member['email'],
- 'ID' => $member['member_id'],
- )
- );
-
- IPSText::getTextClass('email')->subject = $this->lang->words['lp_random_pass_subject'] . ' ' . $this->settings['board_name'];
- IPSText::getTextClass('email')->to = $member['email'];
-
- IPSText::getTextClass('email')->sendMail();
-
- $this->registry->output->setTitle( $this->lang->words['activation_form'] );
- $this->output = $this->registry->getClass('output')->getTemplate('register')->showLostPassWaitRandom( $member );
- }
- else
- {
- if( $_POST['pass1'] == "" )
- {
- $this->registry->output->showError( 'pass_blank', 10184 );
- }
-
- if( $_POST['pass2'] == "" )
- {
- $this->registry->output->showError( 'pass_blank', 10185 );
- }
-
- $pass_a = trim( $this->request['pass1'] );
- $pass_b = trim( $this->request['pass2'] );
-
- if( strlen( $pass_a ) < 3 )
- {
- $this->registry->output->showError( 'pass_too_short', 10186 );
- }
-
- if( $pass_a != $pass_b )
- {
- $this->registry->output->showError( 'pass_no_match', 10187 );
- }
-
- $new_pass = md5( $pass_a );
-
- /* Update Member Array */
- $save_array = array();
-
- /* Generate a new salt */
- $salt = IPSMember::generatePasswordSalt(5);
- $salt = str_replace( '\\', "\\\\", $salt );
-
- /* New log in key */
- $key = IPSMember::generateAutoLoginKey();
-
- /* Update Array */
- $save_array['members_pass_salt'] = $salt;
- $save_array['members_pass_hash'] = md5( md5($salt) . $new_pass );
- $save_array['member_login_key'] = $key;
- $save_array['member_login_key_expire'] = $this->settings['login_key_expire'] * 60 * 60 * 24;
- $save_array['failed_logins'] = null;
- $save_array['failed_login_count'] = 0;
-
- /* Change the password */
- require_once( IPS_ROOT_PATH.'sources/handlers/han_login.php' );
- $this->han_login = new han_login( $this->registry );
- $this->han_login->init();
- $this->han_login->changePass( $member['email'], md5( $new_pass ) );
-
- //-----------------------------------------
- // We'll ignore any remote errors
- //-----------------------------------------
-
- if( $this->han_login->return_code != 'METHOD_NOT_DEFINED' AND $this->han_login->return_code != 'SUCCESS' )
- {
- // Pass not changed remotely
- }
-
- /* Update the member */
- IPSMember::save( $member['member_id'], array( 'members' => $save_array ) );
-
- /* Remove "dead" validation */
- $this->DB->delete( 'validating', "vid='{$validate['vid']}' OR (member_id={$member['member_id']} AND lost_pass=1)" );
-
- $this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=core&module=global§ion=login&do=autologin&frompass=1' );
- }
- }
- }
-
- /**
- * Completes the lost password request form
- *
- * @access public
- * @return void
- */
- public function lostPasswordEnd()
- {
- if( $this->settings['bot_antispam'] )
- {
- if( !$this->registry->getClass('class_captcha')->validate( $this->request['regid'], $this->request['reg_code'] ) )
- {
- $this->lostPasswordForm( 'err_reg_code' );
- return;
- }
- }
-
- /* Back to the usual programming! :o */
- if( $this->request['member_name'] == "" AND $this->request['email_addy'] == "" )
- {
- $this->registry->output->showError( 'lostpass_name_email', 10110 );
- }
-
- /* Check for input and it's in a valid format. */
- $member_name = trim( mb_strtolower( $this->request['member_name'] ) );
- $email_addy = trim( mb_strtolower( $this->request['email_addy'] ) );
-
- if( $member_name == "" AND $email_addy == "" )
- {
- $this->registry->output->showError( 'lostpass_name_email', 10111 );
- }
-
- /* Attempt to get the user details from the DB */
- if( $member_name )
- {
- $this->DB->build( array( 'select' => 'members_display_name, name, member_id, email, member_group_id', 'from' => 'members', 'where' => "members_l_username='{$member_name}'" ) );
- $this->DB->execute();
- }
- else if( $email_addy )
- {
- $this->DB->build( array( 'select' => 'members_display_name, name, member_id, email, member_group_id', 'from' => 'members', 'where' => "email='{$email_addy}'" ) );
- $this->DB->execute();
- }
-
- if ( ! $this->DB->getTotalRows() )
- {
- $this->registry->output->showError( 'lostpass_no_user', 10112 );
- }
- else
- {
- $member = $this->DB->fetch();
-
- /* Is there a validation key? If so, we'd better not touch it */
- if( $member['member_id'] == "" )
- {
- $this->registry->output->showError( 'lostpass_no_mid', 2014 );
- }
-
- $validate_key = md5( IPSLib::makePassword() . uniqid( mt_rand(), TRUE ) );
-
- /* Get rid of old entries for this member */
- $this->DB->delete( 'validating', "member_id={$member['member_id']} AND lost_pass=1" );
-
- /* Update the DB for this member. */
- $db_str = array(
- 'vid' => $validate_key,
- 'member_id' => $member['member_id'],
- 'temp_group' => $member['member_group_id'],
- 'entry_date' => time(),
- 'coppa_user' => 0,
- 'lost_pass' => 1,
- 'ip_address' => $this->member->ip_address,
- );
-
- /* Are they already in the validating group? */
- if( $member['member_group_id'] != $this->settings['auth_group'] )
- {
- $db_str['real_group'] = $member['member_group_id'];
- }
-
- $this->DB->insert( 'validating', $db_str );
-
- /* Send out the email. */
- IPSText::getTextClass('email')->getTemplate( 'lost_pass' );
-
- IPSText::getTextClass('email')->buildMessage( array(
- 'NAME' => $member['members_display_name'],
- 'THE_LINK' => $this->settings['base_url']."app=core&module=global§ion=lostpass&do=sendform&uid=".$member['member_id']."&aid=".$validate_key,
- 'MAN_LINK' => $this->settings['base_url']."app=core&module=global§ion=lostpass&do=sendform",
- 'EMAIL' => $member['email'],
- 'ID' => $member['member_id'],
- 'CODE' => $validate_key,
- 'IP_ADDRESS' => $this->member->ip_address,
- )
- );
-
- IPSText::getTextClass('email')->subject = $this->lang->words['lp_subject'] . ' ' . $this->settings['board_name'];
- IPSText::getTextClass('email')->to = $member['email'];
- IPSText::getTextClass('email')->sendMail();
-
- $this->output = $this->registry->getClass('output')->getTemplate('register')->lostPasswordWait( $member );
- }
-
- $this->registry->output->setTitle( $this->lang->words['lost_pass_form'] );
- }
-
- /**
- * Displays the lost password form
- *
- * @access public
- * @param string $errors
- * @return void
- */
- public function lostPasswordForm( $errors="" )
- {
- //-----------------------------------------
- // Do we have another URL for password resets?
- //-----------------------------------------
-
- require_once( IPS_ROOT_PATH . 'sources/handlers/han_login.php' );
- $han_login = new han_login( $this->registry );
- $han_login->init();
- $han_login->checkMaintenanceRedirect();
-
- /* CAPTCHA */
- if( $this->settings['bot_antispam'] )
- {
- $captchaHTML = $this->registry->getClass('class_captcha')->getTemplate();
- }
-
- $this->registry->output->setTitle( $this->lang->words['lost_pass_form'] );
- $this->registry->output->addNavigation( $this->lang->words['lost_pass_form'], '' );
-
- $this->output .= $this->registry->output->getTemplate('register')->lostPasswordForm( $this->lang->words[ $errors ] );
-
- if ( $this->settings['bot_antispam'] )
- {
- $this->output = str_replace( "", $captchaHTML, $this->output );
- }
- }
-
-
- /**
- * Shows the form for validating a lost password request
- *
- * @access public
- * @param string $msg
- * @return void
- */
- public function lostPasswordValidateForm( $msg='' )
- {
- $this->output .= $this->registry->getClass('output')->getTemplate('register')->showLostpassForm( $this->lang->words[$msg] );
-
- /* Check for input and it's in a valid format. */
- if( $this->request['uid'] AND $this->request['aid'] )
- {
- $in_user_id = intval( trim( urldecode( $this->request['uid'] ) ) );
- $in_validate_key = IPSText::md5Clean( trim( urldecode( $this->request['aid'] ) ) );
- $in_type = trim( $this->request['type'] );
-
- if ($in_type == "")
- {
- $in_type = 'reg';
- }
-
- /* Check and test input */
- if ( ! $in_validate_key )
- {
- $this->registry->output->showError( 'validation_key_incorrect', 10113 );
- }
-
- if (! preg_match( "/^(?:\d){1,}$/", $in_user_id ) )
- {
- $this->registry->output->showError( 'uid_key_incorrect', 10114 );
- }
-
- /* Attempt to get the profile of the requesting user */
- $member = IPSMember::load( $in_user_id );
-
- if( ! $member['member_id'] )
- {
- $this->registry->output->showError( 'lostpass_no_member', 10115 );
- }
-
- /* Get validating info.. */
- $validate = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'validating', 'where' => "member_id={$in_user_id} and vid='{$in_validate_key}' and lost_pass=1" ) );
-
- if( ! $validate['member_id'] )
- {
- $this->registry->output->showError( 'validation_key_incorrect', 10116 );
- }
-
- $this->output = str_replace( "", $this->registry->output->getTemplate('register')->show_lostpass_form_auto( $in_validate_key, $in_user_id ), $this->output );
- }
- else
- {
- $this->output = str_replace( "", $this->registry->output->getTemplate('register')->show_lostpass_form_manual(), $this->output );
- }
-
- /* CAPTCHA */
- if( $this->settings['bot_antispam'] )
- {
- $this->output = str_replace( "", $this->registry->getClass('class_captcha')->getTemplate(), $this->output );
- }
-
- $this->registry->output->setTitle( $this->lang->words['activation_form'] );
- $this->registry->output->addNavigation( $this->lang->words['activation_form'], '' );
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Recover Lost Password
+ * Last Updated: $Date: 2010-09-06 12:10:04 -0400 (Mon, 06 Sep 2010) $
+ *
+ *
+ * @author $Author $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 20th February 2002
+ * @version $Rev: 6832 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_global_lostpass extends ipsCommand
+{
+ /**
+ * Class entry point
+ *
+ * @access public
+ * @param object Registry reference
+ * @return void [Outputs to screen/redirects]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* Load language */
+ $this->registry->class_localization->loadLanguageFile( array( 'public_register' ), 'core' );
+
+ //-----------------------------------------
+ // Meta tags
+ //-----------------------------------------
+
+ $this->registry->output->addMetaTag( 'robots', 'noindex' );
+
+ /* What to do */
+ switch( $this->request['do'] )
+ {
+ case 'sendform':
+ $this->lostPasswordValidateForm();
+ break;
+
+ case '11':
+ $this->lostPasswordEnd();
+ break;
+
+ case '03':
+ $this->lostPasswordValidate();
+ break;
+
+ default:
+ case '10':
+ $this->lostPasswordForm();
+ break;
+ }
+
+ /* Output */
+ $this->registry->output->addContent( $this->output );
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * Validates a lost password request
+ *
+ * @access public
+ * @return void
+ */
+ public function lostPasswordValidate()
+ {
+ /* Check for input and it's in a valid format. */
+ $in_user_id = intval( trim( urldecode( $this->request['uid'] ) ) );
+ $in_validate_key = IPSText::md5Clean( trim( urldecode( $this->request['aid'] ) ) );
+
+ /* Check Input */
+ if( ! $in_validate_key )
+ {
+ $this->registry->output->showError( 'validation_key_incorrect', 1015 );
+ }
+
+ if( ! preg_match( '/^(?:\d){1,}$/', $in_user_id ) )
+ {
+ $this->registry->output->showError( 'uid_key_incorrect', 1016 );
+ }
+
+ /* Attempt to get the profile of the requesting user */
+ $member = IPSMember::load( $in_user_id );
+
+ if( ! $member['member_id'] )
+ {
+ $this->registry->output->showError( 'lostpass_no_member', 1017 );
+ }
+
+ /* Get validating info.. */
+ $validate = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'validating', 'where' => 'member_id=' . $in_user_id . ' and lost_pass=1' ) );
+
+ if( ! $validate['member_id'] )
+ {
+ $this->registry->output->showError( 'lostpass_not_validating', 1018 );
+ }
+
+ if( ( $validate['new_reg'] == 1 ) && ( $this->settings['reg_auth_type'] == "admin" ) )
+ {
+ $this->registry->output->showError( 'lostpass_new_reg', 4010, true );
+ }
+
+ if( $validate['vid'] != $in_validate_key )
+ {
+ $this->registry->output->showError( 'lostpass_key_wrong', 1019 );
+ }
+ else
+ {
+ /* On the same page? */
+ if( $validate['lost_pass'] != 1 )
+ {
+ $this->registry->output->showError( 'lostpass_not_lostpass', 4011, true );
+ }
+
+ /* Test GD image */
+ if( $this->settings['bot_antispam_type'] != 'none' )
+ {
+ if ( $this->registry->getClass('class_captcha')->validate() !== TRUE )
+ {
+ $this->lostPasswordValidateForm( 'err_reg_code' );
+ return;
+ }
+ }
+
+ /* Send a new random password? */
+ if( $this->settings['lp_method'] == 'random' )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $save_array = array();
+
+ //-----------------------------------------
+ // Generate a new random password
+ //-----------------------------------------
+
+ $new_pass = IPSLib::makePassword();
+
+ //-----------------------------------------
+ // Generate a new salt
+ //-----------------------------------------
+
+ $salt = IPSMember::generatePasswordSalt(5);
+ $salt = str_replace( '\\', "\\\\", $salt );
+
+ //-----------------------------------------
+ // New log in key
+ //-----------------------------------------
+
+ $key = IPSMember::generateAutoLoginKey();
+
+ //-----------------------------------------
+ // Update...
+ //-----------------------------------------
+
+ $save_array['members_pass_salt'] = $salt;
+ $save_array['members_pass_hash'] = md5( md5($salt) . md5( $new_pass ) );
+ $save_array['member_login_key'] = $key;
+ $save_array['member_login_key_expire'] = $this->settings['login_key_expire'] * 60 * 60 * 24;
+ $save_array['failed_logins'] = null;
+ $save_array['failed_login_count'] = 0;
+
+ //-----------------------------------------
+ // Load handler...
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $this->han_login = new $classToLoad( $this->registry );
+ $this->han_login->init();
+ $this->han_login->changePass( $member['email'], md5( $new_pass ), $new_pass, $member );
+
+ if ( $this->han_login->return_code != 'METHOD_NOT_DEFINED' AND $this->han_login->return_code != 'SUCCESS' )
+ {
+ $this->registry->output->showError( $this->lang->words['lostpass_external_fail'], 2013 );
+ }
+
+ IPSMember::save( $member['member_id'], array( 'members' => $save_array ) );
+
+ //-----------------------------------------
+ // Send out the email...
+ //-----------------------------------------
+
+ IPSText::getTextClass('email')->getTemplate("lost_pass_email_pass");
+
+ IPSText::getTextClass('email')->buildMessage( array(
+ 'NAME' => $member['members_display_name'],
+ 'THE_LINK' => $this->settings['base_url'] . 'app=core&module=usercp&tab=core&area=password',
+ 'PASSWORD' => $new_pass,
+ 'LOGIN' => $this->settings['base_url'] . 'app=core&module=global§ion=login',
+ 'USERNAME' => $member['name'],
+ 'EMAIL' => $member['email'],
+ 'ID' => $member['member_id'],
+ )
+ );
+
+ IPSText::getTextClass('email')->subject = $this->lang->words['lp_random_pass_subject'] . ' ' . $this->settings['board_name'];
+ IPSText::getTextClass('email')->to = $member['email'];
+
+ IPSText::getTextClass('email')->sendMail();
+
+ $this->registry->output->setTitle( $this->lang->words['activation_form'] . ' - ' . ipsRegistry::$settings['board_name'] );
+ $this->output = $this->registry->getClass('output')->getTemplate('register')->showLostPassWaitRandom( $member );
+ }
+ else
+ {
+ if( $_POST['pass1'] == "" )
+ {
+ $this->registry->output->showError( 'pass_blank', 10184 );
+ }
+
+ if( $_POST['pass2'] == "" )
+ {
+ $this->registry->output->showError( 'pass_blank', 10185 );
+ }
+
+ $pass_a = trim( $this->request['pass1'] );
+ $pass_b = trim( $this->request['pass2'] );
+
+ if( strlen( $pass_a ) < 3 )
+ {
+ $this->registry->output->showError( 'pass_too_short', 10186 );
+ }
+
+ if( $pass_a != $pass_b )
+ {
+ $this->registry->output->showError( 'pass_no_match', 10187 );
+ }
+
+ $new_pass = md5( $pass_a );
+
+ /* Update Member Array */
+ $save_array = array();
+
+ /* Generate a new salt */
+ $salt = IPSMember::generatePasswordSalt(5);
+ $salt = str_replace( '\\', "\\\\", $salt );
+
+ /* New log in key */
+ $key = IPSMember::generateAutoLoginKey();
+
+ /* Update Array */
+ $save_array['members_pass_salt'] = $salt;
+ $save_array['members_pass_hash'] = md5( md5($salt) . $new_pass );
+ $save_array['member_login_key'] = $key;
+ $save_array['member_login_key_expire'] = $this->settings['login_key_expire'] * 60 * 60 * 24;
+ $save_array['failed_logins'] = null;
+ $save_array['failed_login_count'] = 0;
+
+ /* Change the password */
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $this->han_login = new $classToLoad( $this->registry );
+ $this->han_login->init();
+ $this->han_login->changePass( $member['email'], md5( $new_pass ), $new_pass, $member );
+
+ //-----------------------------------------
+ // We'll ignore any remote errors
+ //-----------------------------------------
+
+ if( $this->han_login->return_code != 'METHOD_NOT_DEFINED' AND $this->han_login->return_code != 'SUCCESS' )
+ {
+ // Pass not changed remotely
+ }
+
+ /* Update the member */
+ IPSMember::save( $member['member_id'], array( 'members' => $save_array ) );
+
+ /* Remove "dead" validation */
+ $this->DB->delete( 'validating', "vid='{$validate['vid']}' OR (member_id={$member['member_id']} AND lost_pass=1)" );
+
+ $this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=core&module=global§ion=login&do=autologin&frompass=1' );
+ }
+ }
+ }
+
+ /**
+ * Completes the lost password request form
+ *
+ * @access public
+ * @return void
+ */
+ public function lostPasswordEnd()
+ {
+ if( $this->settings['bot_antispam_type'] != 'none' )
+ {
+ if( !$this->registry->getClass('class_captcha')->validate( $this->request['regid'], $this->request['reg_code'] ) )
+ {
+ $this->lostPasswordForm( 'err_reg_code' );
+ return;
+ }
+ }
+
+ /* Back to the usual programming! :o */
+ if( $this->request['member_name'] == "" AND $this->request['email_addy'] == "" )
+ {
+ $this->registry->output->showError( 'lostpass_name_email', 10110 );
+ }
+
+ /* Check for input and it's in a valid format. */
+ $member_name = trim( mb_strtolower( $this->request['member_name'] ) );
+ $email_addy = trim( mb_strtolower( $this->request['email_addy'] ) );
+
+ if( $member_name == "" AND $email_addy == "" )
+ {
+ $this->registry->output->showError( 'lostpass_name_email', 10111 );
+ }
+
+ /* Attempt to get the user details from the DB */
+ if( $member_name )
+ {
+ $this->DB->build( array( 'select' => 'members_display_name, name, member_id, email, member_group_id', 'from' => 'members', 'where' => "members_l_username='{$member_name}'" ) );
+ $this->DB->execute();
+ }
+ else if( $email_addy )
+ {
+ $this->DB->build( array( 'select' => 'members_display_name, name, member_id, email, member_group_id', 'from' => 'members', 'where' => "email='{$email_addy}'" ) );
+ $this->DB->execute();
+ }
+
+ if ( ! $this->DB->getTotalRows() )
+ {
+ $this->registry->output->showError( 'lostpass_no_user', 10112 );
+ }
+ else
+ {
+ $member = $this->DB->fetch();
+
+ /* Is there a validation key? If so, we'd better not touch it */
+ if( $member['member_id'] == "" )
+ {
+ $this->registry->output->showError( 'lostpass_no_mid', 2014 );
+ }
+
+ $validate_key = md5( IPSLib::makePassword() . uniqid( mt_rand(), TRUE ) );
+
+ /* Get rid of old entries for this member */
+ $this->DB->delete( 'validating', "member_id={$member['member_id']} AND lost_pass=1" );
+
+ /* Update the DB for this member. */
+ $db_str = array(
+ 'vid' => $validate_key,
+ 'member_id' => $member['member_id'],
+ 'temp_group' => $member['member_group_id'],
+ 'entry_date' => time(),
+ 'coppa_user' => 0,
+ 'lost_pass' => 1,
+ 'ip_address' => $this->member->ip_address,
+ );
+
+ /* Are they already in the validating group? */
+ if( $member['member_group_id'] != $this->settings['auth_group'] )
+ {
+ $db_str['real_group'] = $member['member_group_id'];
+ }
+
+ $this->DB->insert( 'validating', $db_str );
+
+ /* Send out the email. */
+ IPSText::getTextClass('email')->getTemplate( 'lost_pass' );
+
+ IPSText::getTextClass('email')->buildMessage( array(
+ 'NAME' => $member['members_display_name'],
+ 'THE_LINK' => $this->settings['base_url']."app=core&module=global§ion=lostpass&do=sendform&uid=".$member['member_id']."&aid=".$validate_key,
+ 'MAN_LINK' => $this->settings['base_url']."app=core&module=global§ion=lostpass&do=sendform",
+ 'EMAIL' => $member['email'],
+ 'ID' => $member['member_id'],
+ 'CODE' => $validate_key,
+ 'IP_ADDRESS' => $this->member->ip_address,
+ )
+ );
+
+ IPSText::getTextClass('email')->subject = $this->lang->words['lp_subject'] . ' ' . $this->settings['board_name'];
+ IPSText::getTextClass('email')->to = $member['email'];
+ IPSText::getTextClass('email')->sendMail();
+
+ $this->output = $this->registry->getClass('output')->getTemplate('register')->lostPasswordWait( $member );
+ }
+
+ $this->registry->output->setTitle( $this->lang->words['lost_pass_form'] . ' - ' . ipsRegistry::$settings['board_name'] );
+ }
+
+ /**
+ * Displays the lost password form
+ *
+ * @access public
+ * @param string $errors
+ * @return void
+ */
+ public function lostPasswordForm( $errors="" )
+ {
+ //-----------------------------------------
+ // Do we have another URL for password resets?
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $han_login = new $classToLoad( $this->registry );
+ $han_login->init();
+ $han_login->checkMaintenanceRedirect();
+
+ /* CAPTCHA */
+ if( $this->settings['bot_antispam_type'] != 'none' )
+ {
+ $captchaHTML = $this->registry->getClass('class_captcha')->getTemplate();
+ }
+
+ $this->registry->output->setTitle( $this->lang->words['lost_pass_form'] . ' - ' . ipsRegistry::$settings['board_name'] );
+ $this->registry->output->addNavigation( $this->lang->words['lost_pass_form'], '' );
+
+ $this->output .= $this->registry->output->getTemplate('register')->lostPasswordForm( $this->lang->words[ $errors ] );
+
+ if ( $this->settings['bot_antispam_type'] != 'none' )
+ {
+ $this->output = str_replace( "", $captchaHTML, $this->output );
+ }
+ }
+
+
+ /**
+ * Shows the form for validating a lost password request
+ *
+ * @access public
+ * @param string $msg
+ * @return void
+ */
+ public function lostPasswordValidateForm( $msg='' )
+ {
+ $this->output .= $this->registry->getClass('output')->getTemplate('register')->showLostpassForm( $this->lang->words[$msg] );
+
+ /* Check for input and it's in a valid format. */
+ if( $this->request['uid'] AND $this->request['aid'] )
+ {
+ $in_user_id = intval( trim( urldecode( $this->request['uid'] ) ) );
+ $in_validate_key = IPSText::md5Clean( trim( urldecode( $this->request['aid'] ) ) );
+ $in_type = trim( $this->request['type'] );
+
+ if ($in_type == "")
+ {
+ $in_type = 'reg';
+ }
+
+ /* Check and test input */
+ if ( ! $in_validate_key )
+ {
+ $this->registry->output->showError( 'validation_key_incorrect', 10113 );
+ }
+
+ if (! preg_match( '/^(?:\d){1,}$/', $in_user_id ) )
+ {
+ $this->registry->output->showError( 'uid_key_incorrect', 10114 );
+ }
+
+ /* Attempt to get the profile of the requesting user */
+ $member = IPSMember::load( $in_user_id );
+
+ if( ! $member['member_id'] )
+ {
+ $this->registry->output->showError( 'lostpass_no_member', 10115 );
+ }
+
+ /* Get validating info.. */
+ $validate = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'validating', 'where' => "member_id={$in_user_id} and vid='{$in_validate_key}' and lost_pass=1" ) );
+
+ if( ! $validate['member_id'] )
+ {
+ $this->registry->output->showError( 'validation_key_incorrect', 10116 );
+ }
+
+ $this->output = str_replace( "", $this->registry->output->getTemplate('register')->show_lostpass_form_auto( $in_validate_key, $in_user_id ), $this->output );
+ }
+ else
+ {
+ $this->output = str_replace( "", $this->registry->output->getTemplate('register')->show_lostpass_form_manual(), $this->output );
+ }
+
+ /* CAPTCHA */
+ if( $this->settings['bot_antispam_type'] != 'none' )
+ {
+ $this->output = str_replace( "", $this->registry->getClass('class_captcha')->getTemplate(), $this->output );
+ }
+
+ $this->registry->output->setTitle( $this->lang->words['activation_form'] . ' - ' . ipsRegistry::$settings['board_name'] );
+ $this->registry->output->addNavigation( $this->lang->words['activation_form'], '' );
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/global/register.php b/upload/admin/applications/core/modules_public/global/register.php
index 2386f92a..c3794b3f 100644
--- a/upload/admin/applications/core/modules_public/global/register.php
+++ b/upload/admin/applications/core/modules_public/global/register.php
@@ -1,1686 +1,1969 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class public_core_global_register extends ipsCommand
-{
- /**
- * Class entry point
- *
- * @access public
- * @param object Registry reference
- * @return void [Outputs to screen/redirects]
- */
- public function doExecute( ipsRegistry $registry )
- {
- /* Load language */
- $this->registry->class_localization->loadLanguageFile( array( 'public_register' ), 'core' );
-
- /* What to do */
- switch( $this->request['do'] )
- {
- case 'process_form':
- $this->registerProcessForm();
- break;
-
- case 'auto_validate':
- $this->_autoValidate();
- break;
-
- case 'coppa_two':
- $this->registerCoppaTwo();
- break;
-
- case '12':
- $this->registerCoppaPermsForm();
- break;
-
- case '05':
- $this->_showManualForm();
- break;
-
- case '07':
- $this->_showManualForm('newemail');
- break;
-
- case 'reval':
- $this->_revalidateForm();
- break;
-
- case 'reval2':
- $this->_revalidateComplete();
- break;
-
- case 'complete_login':
- $this->_completeRegistration();
- break;
- case 'complete_login_do':
- $this->_completeRegistrationSave();
- break;
-
- default:
- case 'form':
- if( $this->settings['no_reg'] == 1 )
- {
- $this->registry->output->showError( 'registration_disabled', 10123 );
- }
-
- if( $this->settings['use_coppa'] == 1 and $this->request['coppa_pass'] != 1 )
- {
- $this->registerCoppaStart();
- }
- else
- {
- $this->registerForm();
- }
- break;
- }
-
- /* Output */
- $this->registry->output->addContent( $this->output );
- $this->registry->output->sendOutput();
- }
-
-
- /**
- * Save the data to complete the partial member record login/registration
- *
- * @access private
- * @return void [Outputs to screen/redirects]
- */
- private function _completeRegistrationSave()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $mid = intval( $this->request['mid'] );
- $key = intval( $this->request['key'] );
- $in_email = mb_strtolower( trim($this->request['EmailAddress']) );
- $banfilters = array();
- $form_errors = array( 'dname' => array(), 'email' => array(), 'general' => array() );
- $members_display_name = trim( $this->request['members_display_name'] );
- $poss_session_id = "";
-
- //-----------------------------------------
- // Get DB row
- //-----------------------------------------
-
- $reg = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'members_partial', 'where' => "partial_member_id={$mid} AND partial_date={$key}" ) );
- $tmp_member = IPSMember::load( $mid );
-
- //-----------------------------------------
- // Got it?
- //-----------------------------------------
-
- if ( ! $reg['partial_id'] OR ! $tmp_member['member_id'] )
- {
- $this->registry->output->showError( 'partial_reg_noid', 10117 );
- }
-
- //-----------------------------------------
- // Load ban filters
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'banfilters' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $banfilters[ $r['ban_type'] ][] = $r['ban_content'];
- }
-
- //-----------------------------------------
- // Custom profile field stuff
- //-----------------------------------------
-
- require_once( IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php' );
- $custom_fields = new customProfileFields();
-
- $custom_fields->initData( 'edit' );
- $custom_fields->parseToSave( $this->request, 'register' );
-
- /* Check */
- if( $custom_fields->error_messages )
- {
- $form_errors['general'] = $custom_fields->error_messages;
- }
-
- //-----------------------------------------
- // Remove 'sneaky' spaces
- //-----------------------------------------
-
- if ( $this->settings['strip_space_chr'] )
- {
- $members_display_name = IPSText::removeControlCharacters( $members_display_name );
- }
-
- //-----------------------------------------
- // Testing email addresses?
- //-----------------------------------------
-
- if ( ! $reg['partial_email_ok'] )
- {
- //-----------------------------------------
- // Check the email address
- //-----------------------------------------
-
- if( !IPSText::checkEmailAddress( $in_email ) )
- {
- $form_errors['email'][] = $this->lang->words['reg_error_email_nm'];
- }
-
- //-----------------------------------------
- // Test email address
- //-----------------------------------------
-
- $this->request['EmailAddress_two'] = mb_strtolower( trim($this->request['EmailAddress_two']) );
-
- if ( $this->request['EmailAddress_two'] != $in_email )
- {
- $form_errors['email'][] = $this->lang->words['reg_error_email_nm'];
- }
-
- //-----------------------------------------
- // Are they banned [EMAIL]?
- //-----------------------------------------
-
- if ( is_array( $banfilters['email'] ) and count( $banfilters['email'] ) )
- {
- foreach ( $banfilters['email'] as $email )
- {
- $email = str_replace( '\*', '.*' , preg_quote($email, "/") );
-
- if ( preg_match( "/^{$email}$/i", $in_email ) )
- {
- $form_errors['email'][] = $this->lang->words['reg_error_email_taken'];
- break;
- }
- }
- }
-
- /* Is this email addy taken? */
- if( IPSMember::checkByEmail( $in_email ) == TRUE )
- {
- $form_errors['email'][] = $this->lang->words['reg_error_email_taken'];
- }
-
- //-----------------------------------------
- // Load handler...
- //-----------------------------------------
-
- require_once( IPS_ROOT_PATH . 'sources/handlers/han_login.php' );
- $han_login = new han_login( $this->registry );
- $han_login->init();
-
- if( $han_login->emailExistsCheck( trim( mb_strtolower( $member['email'] ) ), trim( mb_strtolower( $in_email ) ) ) )
- {
- $form_errors['email'][] = $this->lang->words['reg_error_email_taken'];
- }
- }
-
- if ( $this->settings['auth_allow_dnames'] )
- {
- /* Check the username */
- $user_check = IPSMember::getFunction()->cleanAndCheckName( $members_display_name, $tmp_member, 'members_display_name' );
-
- if( is_array( $user_check['errors'] ) && count( $user_check['errors'] ) )
- {
- $form_errors['dname'] = array_merge( $form_errors['dname'], $user_check['errors'] );
- }
- }
-
- //-----------------------------------------
- // CHECK 1: Any errors (duplicate names, etc)?
- //-----------------------------------------
-
- if ( count( $form_errors ) )
- {
- $errorMessages = array();
-
- foreach( $form_errors as $errorCat => $errorMessage )
- {
- foreach( $errorMessage as $error )
- {
- $errorMessages['general'][] = $error;
- }
- }
-
- if( count($errorMessages) )
- {
- $this->_completeRegistration( $errorMessages );
- return;
- }
- }
-
- //-----------------------------------------
- // Update: Members
- //-----------------------------------------
-
- $members_display_name = $this->settings['auth_allow_dnames'] ? $members_display_name : $tmp_member['name'];
-
- if ( ! $reg['partial_email_ok'] )
- {
- IPSMember::save( $mid, array( 'members' => array( 'email' => $in_email,
- 'members_display_name' => $members_display_name,
- 'name' => $tmp_member['name'] ? $tmp_member['name'] : $members_display_name,
- 'members_l_username' => $tmp_member['members_l_username'] ? $tmp_member['members_l_username'] : $members_display_name,
- 'members_l_display_name' => mb_strtolower( $members_display_name ) ) ) );
- }
- else
- {
- IPSMember::save( $mid, array( 'members' => array( 'members_display_name' => $members_display_name,
- 'name' => $tmp_member['name'] ? $tmp_member['name'] : $members_display_name,
- 'members_l_username' => $tmp_member['members_l_username'] ? $tmp_member['members_l_username'] : $members_display_name,
- 'members_l_display_name' => mb_strtolower( $members_display_name ) ) ) );
- }
-
- //-----------------------------------------
- // Delete: Partials row
- //-----------------------------------------
-
- $this->DB->delete( 'members_partial', 'partial_member_id=' . $mid );
-
- //-----------------------------------------
- // Update: Profile fields
- //-----------------------------------------
-
- $this->DB->force_data_type = array();
-
- foreach( $custom_fields->out_fields as $_field => $_data )
- {
- $this->DB->force_data_type[ $_field ] = 'string';
- }
-
- if ( is_array($custom_fields->out_fields) and count($custom_fields->out_fields) )
- {
- $this->DB->update( 'pfields_content', $custom_fields->out_fields, 'member_id=' . $mid );
- }
-
- //-----------------------------------------
- // Send out admin email
- //-----------------------------------------
-
- if ( $this->settings['new_reg_notify'] )
- {
- $date = $this->registry->getClass('class_localization')->getDate( time(), 'LONG', 1 );
-
- IPSText::getTextClass('email')->getTemplate("admin_newuser");
-
- IPSText::getTextClass('email')->buildMessage( array( 'DATE' => $date,
- 'LOG_IN_NAME' => $tmp_member['name'] ? $tmp_member['name'] : $members_display_name,
- 'EMAIL' => $in_email,
- 'IP' => $tmp_member['ip_address'],
- 'DISPLAY_NAME' => $members_display_name ) );
-
- IPSText::getTextClass('email')->subject = $this->lang->words['new_registration_email'] . $this->settings['board_name'];
- IPSText::getTextClass('email')->to = $this->settings['email_in'];
- IPSText::getTextClass('email')->sendMail();
- }
-
- //-----------------------------------------
- // Set cookies
- //-----------------------------------------
-
- IPSCookie::set("member_id" , $mid , 1 );
- IPSCookie::set("pass_hash" , $tmp_member['member_login_key'] , 1 );
-
- //-----------------------------------------
- // Fix up session
- //-----------------------------------------
-
- $privacy = $this->request['Privacy'] ? 1 : 0;
-
- if( $this->caches['group_cache'][ $tmp_member['member_group_id'] ]['g_hide_online_list'] )
- {
- $privacy = 1;
- }
-
- $this->member->sessionClass()->convertGuestToMember( array( 'member_name' => $members_display_name,
- 'member_id' => $mid,
- 'member_group' => $tmp_member['member_group_id'],
- 'login_type' => $privacy ) );
-
- //-----------------------------------------
- // Update Stats
- //-----------------------------------------
-
- $cache = $this->cache->getCache('stats');
-
- if( $members_display_name AND $mid )
- {
- $cache['last_mem_name'] = $members_display_name;
- $cache['last_mem_id'] = $mid;
- }
-
- $cache['mem_count'] += 1;
-
- $this->cache->setCache( 'stats', $cache, array( 'array' => 1 ) );
-
- /* Complete account */
- IPSLib::runMemberSync( 'onCompleteAccount', IPSMember::load( $mid ) );
-
- //-----------------------------------------
- // Go to the board index
- //-----------------------------------------
-
- $this->registry->output->redirectScreen( $this->lang->words['clogin_done'], $this->settings['base_url'] );
- }
-
- /**
- * When a member logs in via an external login method and we do not have all of the data
- * to create the member's account, we create a partial record. This function shows the
- * form upon first visit by member (usually immediately after login) to complete the
- * login/registration.
- *
- * @access private
- * @param array Errors
- * @return void [Outputs to screen/redirects]
- */
- private function _completeRegistration( $form_errors=array() )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $mid = intval( $this->request['mid'] );
- $key = intval( $this->request['key'] );
- $final_errors = '';
-
- //-----------------------------------------
- // Get DB row
- //-----------------------------------------
-
- $reg = $this->DB->buildAndFetch( array( 'select' => '*',
- 'from' => 'members_partial',
- 'where' => "partial_member_id={$mid} AND partial_date={$key}" ) );
-
- //-----------------------------------------
- // Got it?
- //-----------------------------------------
-
- if ( ! $reg['partial_id'] )
- {
- $this->registry->output->showError( 'partial_reg_noid', 10118 );
- }
-
- //-----------------------------------------
- // Custom profile fields stuff
- //-----------------------------------------
-
- /* Custom Profile Fields */
- $custom_fields_out = array( 'required', 'optional' );
-
- require_once( IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php' );
- $custom_fields = new customProfileFields();
-
- $custom_fields->member_data = array();
- $custom_fields->initData( 'edit' );
- $custom_fields->parseToEdit( 'register' );
-
- if ( count( $custom_fields->out_fields ) )
- {
- foreach( $custom_fields->out_fields as $id => $form_element )
- {
- if ( $custom_fields->cache_data[ $id ]['pf_not_null'] == 1 )
- {
- $ftype = 'required';
- }
- else
- {
- $ftype = 'optional';
- }
-
- $custom_fields_out[$ftype][] = array(
- 'name' => $custom_fields->field_names[ $id ],
- 'desc' => $custom_fields->field_desc[ $id ],
- 'field' => $form_element,
- 'id' => $id,
- 'error' => $error,
- 'type' => $custom_fields->cache_data[ $id ]['pf_type']
- );
- }
- }
-
- //-----------------------------------------
- // Other errors
- //-----------------------------------------
-
- foreach( array( 'username', 'dname', 'password', 'email', 'general' ) as $thing )
- {
- if ( is_array( $form_errors[ $thing ] ) AND count( $form_errors[ $thing ] ) )
- {
- $final_errors .= implode( " ", $form_errors[ $thing ] );
- }
- }
-
- //-----------------------------------------
- // No display name?
- //-----------------------------------------
-
- if ( ! $this->memberData['members_display_name'] )
- {
- $this->member->setProperty( 'members_display_name', $this->memberData['email'] );
- }
-
- //-----------------------------------------
- // Show the form (email and display name)
- //-----------------------------------------
-
- $this->output .= $this->registry->getClass('output')->getTemplate('register')->completePartialLogin( $mid, $key, $custom_fields_out, $final_errors, $reg );
-
- $this->registry->output->setTitle( $this->lang->words['clogin_title'] );
- $this->registry->output->addNavigation( $this->lang->words['clogin_title'], '' );
- }
-
- /**
- * Show the form to request validation email to be resent
- *
- * @access private
- * @param string Errors
- * @return void [Outputs to screen/redirects]
- */
- private function _revalidateForm( $errors="" )
- {
- $name = $this->memberData['member_id'] == "" ? '' : $this->memberData['email'];
-
- $this->output .= $this->registry->getClass('output')->getTemplate('register')->showRevalidateForm( $name, $errors );
- $this->registry->output->setTitle( $this->lang->words['rv_title'] );
- $this->registry->output->addNavigation( $this->lang->words['rv_title'], '' );
- }
-
- /**
- * Resend email validation request for lost password, email change and new registration
- *
- * @access private
- * @return void [Outputs to screen/redirects]
- */
- private function _revalidateComplete()
- {
- //-----------------------------------------
- // Check in the DB for entered member name
- //-----------------------------------------
-
- if ( $this->request['username'] == "" )
- {
- $this->_revalidateForm('err_no_username');
- return;
- }
-
- $username = $this->request['username'];
- $keyType = IPSText::checkEmailAddress( $this->request['username'] ) ? 'email' : 'username';
-
- $member = IPSMember::load( $username, 'extendedProfile', $keyType );
-
- if ( ! $member['member_id'] )
- {
- /**
- * Try the other key type just to be safe...
- */
- $member = IPSMember::load( $username, 'extendedProfile', $keyType == 'email' ? 'username' : 'email' );
-
- if ( ! $member['member_id'] )
- {
- $this->_revalidateForm('err_no_username');
- return;
- }
- }
-
- //-----------------------------------------
- // Check in the DB for any validations
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*', 'from' => 'validating', 'where' => "member_id=" . intval($member['member_id']) ) );
- $this->DB->execute();
-
- if ( ! $val = $this->DB->fetch() )
- {
- $this->_revalidateForm('err_no_validations');
- return;
- }
-
- //-----------------------------------------
- // Which type is it then?
- //-----------------------------------------
-
- if ( $val['lost_pass'] == 1 )
- {
- IPSText::getTextClass('email')->getTemplate("lost_pass");
-
- IPSText::getTextClass('email')->buildMessage( array(
- 'NAME' => $member['members_display_name'],
- 'THE_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=lostpass&do=sendform&uid=" . $member['member_id'] . "&aid=" . $val['vid'],
- 'MAN_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=lostpass&do=sendform",
- 'EMAIL' => $member['email'],
- 'ID' => $member['member_id'],
- 'CODE' => $val['vid'],
- 'IP_ADDRESS' => $this->member->ip_address,
- )
- );
-
- IPSText::getTextClass('email')->subject = $this->lang->words['lp_subject'].' '.$this->settings['board_name'];
- IPSText::getTextClass('email')->to = $member['email'];
-
- IPSText::getTextClass('email')->sendMail();
- }
- else if ( $val['new_reg'] == 1 )
- {
- IPSText::getTextClass('email')->getTemplate("reg_validate");
-
- IPSText::getTextClass('email')->buildMessage( array(
- 'THE_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=register&do=auto_validate&uid=" . $member['member_id'] . "&aid=" . $val['vid'],
- 'NAME' => $member['members_display_name'],
- 'MAN_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=register&do=05",
- 'EMAIL' => $member['email'],
- 'ID' => $member['member_id'],
- 'CODE' => $val['vid'],
- )
- );
-
- IPSText::getTextClass('email')->subject = $this->lang->words['email_reg_subj'] . " " . $this->settings['board_name'];
- IPSText::getTextClass('email')->to = $member['email'];
-
- IPSText::getTextClass('email')->sendMail();
- }
- else if ( $val['email_chg'] == 1 )
- {
- IPSText::getTextClass('email')->getTemplate("newemail");
-
- IPSText::getTextClass('email')->buildMessage( array(
- 'NAME' => $member['members_display_name'],
- 'THE_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=register&do=auto_validate&type=newemail&uid=" . $member['member_id'] . "&aid=" . $val['vid'],
- 'ID' => $member['member_id'],
- 'MAN_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=register&do=07",
- 'CODE' => $val['vid'],
- )
- );
-
- IPSText::getTextClass('email')->subject = $this->lang->words['ne_subject'] . ' ' . $this->settings['board_name'];
- IPSText::getTextClass('email')->to = $member['email'];
-
- IPSText::getTextClass('email')->sendMail();
- }
- else
- {
- $this->_revalidateForm('err_no_validations');
- return;
- }
-
- $this->output .= $this->registry->getClass('output')->getTemplate('register')->showRevalidated();
-
- $this->registry->output->setTitle( $this->lang->words['rv_title'] );
- $this->registry->output->addNavigation( $this->lang->words['rv_title'], '' );
- }
-
- /**
- * Show the form to manually enter in validation info if auto-validation failed.
- *
- * @access private
- * @param string Type of validation
- * @param string Error messages
- * @return void [Outputs to screen/redirects]
- */
- private function _showManualForm($type='reg', $errors="")
- {
- //-----------------------------------------
- // In IPB3 this is handled by another section
- // If somehow a request comes in, send to correct location
- //-----------------------------------------
-
- if ( $type == 'lostpass' )
- {
- $this->registry->output->silentRedirect( $this->settings['base_url'] . 'app=core&module=global§ion=lostpass&do=sendform&uid=' . $this->request['uid'] . '&aid=' . $this->request['aid'] );
- }
- else
- {
- $this->output = $this->registry->getClass('output')->getTemplate('register')->showManualForm( $type );
- }
-
- $this->registry->output->setTitle( $this->lang->words['activation_form'] );
- $this->registry->output->addNavigation( $this->lang->words['activation_form'], '' );
- }
-
-
- /**
- * Show coppa form. This is the downloadable/printable form, and as such is just printed to the browser directly
- *
- * @access private
- * @return void
- */
- private function registerCoppaPermsForm()
- {
- /* Keith said to strip these out - it's all his fault :( */
- $this->settings[ 'coppa_address'] = str_replace( array( ' ', ' ' ), '', $this->settings['coppa_address'] );
- $this->settings[ 'coppa_address'] = nl2br( $this->settings['coppa_address'] );
-
- echo( $this->registry->output->getTemplate('register')->registerCoppaForm() );
- exit();
- }
-
- /**
- * This is the second page a COPPA submission hits. Really, user hits this page and if birthday is older than 13
- * we just continue with registration form. Otherwise we show the coppa validation required message with link
- * to download/print coppa compliance sheet for parents to fill in.
- *
- * @access private
- * @return void
- */
- private function registerCoppaTwo()
- {
- if( ! $this->request['m'] OR ! $this->request['d'] OR ! $this->request['y'] )
- {
- $this->registry->output->showError( 'coppa_form_fill', 10119 );
- }
-
- $birthday = mktime( 0, 0, 0, intval( $this->request['m'] ), intval( $this->request['d'] ), intval( $this->request['y'] ) );
- $coppa = mktime( 0, 0, 0, date( "m" ), date ("d" ), date( "Y" ) - 13 );
-
- if( $birthday <= $coppa )
- {
- $this->registerForm();
- return;
- }
-
- IPSCookie::set( 'coppa', 'yes', 0, 1 );
- IPSCookie::set( 'coppabday', $this->request['m'] . '-' . $this->request['d'] . '-' . $this->request['y'], 0, 1 );
-
- $this->lang->words['coppa_form_text'] = str_replace( "<#FORM_LINK#>", "" . $this->lang->words['coppa_link_form'] . " ", $this->lang->words['coppa_form_text']);
-
- $this->output .= $this->registry->output->getTemplate('register')->registerCoppaTwo();
-
- $this->registry->output->setTitle( $this->lang->words['coppa_title'] );
- $this->registry->output->addNavigation( $this->lang->words['coppa_title'], '' );
- }
-
- /**
- * First COPPA screen. Shows form for visitor to enter birthday in and then submits to registerCoppaTwo
- *
- * @access private
- * @return void
- */
- private function registerCoppaStart()
- {
- $this->lang->words['coppa_form_text'] = str_replace( "<#FORM_LINK#>", "{$this->lang->words['coppa_link_form']} ", $this->lang->words['coppa_form_text']);
-
- $this->output .= $this->registry->output->getTemplate('register')->registerCoppaStart();
-
- $this->registry->output->setTitle( $this->lang->words['coppa_title'] );
- $this->registry->output->addNavigation( $this->lang->words['coppa_title'], '' );
- }
-
- /**
- * Validation completion. This is the action hit when a user clicks a validation link from their email for
- * lost password, email change and new registration.
- *
- * @access private
- * @return void
- */
- private function _autoValidate()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $in_user_id = intval(trim(urldecode($this->request['uid'])));
- $in_validate_key = substr( IPSText::alphanumericalClean( urldecode( $this->request['aid'] ) ), 0, 32 );
- $in_type = trim($this->request['type']);
- $in_type = $in_type ? $in_type : 'reg';
-
- //-----------------------------------------
- // Attempt to get the profile of the requesting user
- //-----------------------------------------
-
- $member = IPSMember::load( $in_user_id, 'members' );
-
- if ( ! $member['member_id'] )
- {
- $this->_showManualForm( $in_type, 'reg_error_validate' );
- return;
- }
-
- //-----------------------------------------
- // Get validating info..
- //-----------------------------------------
-
- if ( $in_type == 'lostpass' )
- {
- $validate = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'validating', 'where' => 'member_id=' . $in_user_id . " AND lost_pass=1" ) );
- }
- else if ( $in_type == 'newemail' )
- {
- $validate = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'validating', 'where' => 'member_id=' . $in_user_id . " AND email_chg=1" ) );
- }
- else
- {
- $validate = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'validating', 'where' => 'member_id=' . $in_user_id ) );
- }
-
- //-----------------------------------------
- // Checks...
- //-----------------------------------------
-
- if ( ! $validate['member_id'] )
- {
- $this->registry->output->showError( 'no_validate_key', 10120 );
- }
-
- if ( ( $validate['new_reg'] == 1 ) && ($this->settings['reg_auth_type'] == "admin" ) )
- {
- $this->registry->output->showError( 'validate_admin_turn', 10121 );
- }
-
- if ( $validate['vid'] != $in_validate_key )
- {
- $this->registry->output->showError( 'validation_key_invalid', 10122 );
- }
-
- //-----------------------------------------
- // Captcha (from posted form, not GET)
- //-----------------------------------------
-
- if ( $this->settings['use_captcha'] AND $this->request['uid'] )
- {
- if ( $this->registry->getClass('class_captcha')->validate( $this->request['captcha_unique_id'], $this->request['captcha_input'] ) !== TRUE )
- {
- $this->_showManualForm( $in_type, 'reg_error_anti_spam' );
- return;
- }
- }
- //-----------------------------------------
- // REGISTER VALIDATE
- //-----------------------------------------
-
- if ( $validate['new_reg'] == 1 )
- {
- if ( ! $validate['real_group'] )
- {
- $validate['real_group'] = $this->settings['member_group'];
- }
-
- //-----------------------------------------
- // SELF-VERIFICATION...
- //-----------------------------------------
-
- if ( $this->settings['reg_auth_type'] != 'admin_user' )
- {
- IPSMember::save( $member['member_id'], array( 'members' => array( 'member_group_id' => $validate['real_group'] ) ) );
-
- /* Reset newest member */
- $stat_cache = $this->caches['stats'];
-
- if( $member['members_display_name'] AND $member['member_id'] )
- {
- $stat_cache['last_mem_name'] = $member['members_display_name'];
- $stat_cache['last_mem_name_seo'] = IPSText::makeSeoTitle( $member['members_display_name'] );
- $stat_cache['last_mem_id'] = $member['member_id'];
- }
-
- $stat_cache['mem_count'] += 1;
-
- $this->cache->setCache( 'stats', $stat_cache, array( 'array' => 1 ) );
-
- //-----------------------------------------
- // Remove "dead" validation
- //-----------------------------------------
-
- $this->DB->delete( 'validating', "vid='" . $validate['vid'] . "'" );
-
- $this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=core&module=global§ion=login&do=autologin&fromreg=1' );
- }
-
- //-----------------------------------------
- // ADMIN-VERIFICATION...
- //-----------------------------------------
-
- else
- {
- //-----------------------------------------
- // Update DB row...
- //-----------------------------------------
-
- $this->DB->update( 'validating', array( 'user_verified' => 1 ), 'vid=\'' . $validate['vid'] . '\'' );
-
- //-----------------------------------------
- // Print message
- //-----------------------------------------
-
- $this->registry->output->setTitle( $this->lang->words['validation_complete'] );
-
- $this->output = $this->registry->getClass('output')->getTemplate('register')->showPreview( $member );
- }
- }
-
- //-----------------------------------------
- // LOST PASS VALIDATE
- //-----------------------------------------
-
- else if ( $validate['lost_pass'] == 1 )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $save_array = array();
-
- //-----------------------------------------
- // Generate a new random password
- //-----------------------------------------
-
- $new_pass = IPSLib::makePassword();
-
- //-----------------------------------------
- // Generate a new salt
- //-----------------------------------------
-
- $salt = IPSMember::generatePasswordSalt(5);
- $salt = str_replace( '\\', "\\\\", $salt );
-
- //-----------------------------------------
- // New log in key
- //-----------------------------------------
-
- $key = IPSMember::generateAutoLoginKey();
-
- //-----------------------------------------
- // Update...
- //-----------------------------------------
-
- $save_array['members_pass_salt'] = $salt;
- $save_array['members_pass_hash'] = md5( md5($salt) . md5( $new_pass ) );
- $save_array['member_login_key'] = $key;
- $save_array['member_login_key_expire'] = $this->settings['login_key_expire'] * 60 * 60 * 24;
-
- //-----------------------------------------
- // Load handler...
- //-----------------------------------------
-
- require_once( IPS_ROOT_PATH.'sources/handlers/han_login.php' );
- $this->han_login = new han_login( $this->registry );
- $this->han_login->init();
- $this->han_login->changePass( $member['email_address'], md5( $new_pass ) );
-
- if ( $this->han_login->return_code != 'METHOD_NOT_DEFINED' AND $this->han_login->return_code != 'SUCCESS' )
- {
- $this->registry->output->showError( 'lostpass_external_fail', 2015, true );
- }
-
- IPSMember::save( $member['member_id'], array( 'members' => $save_array ) );
-
- //-----------------------------------------
- // Send out the email...
- //-----------------------------------------
-
- IPSText::getTextClass('email')->getTemplate("lost_pass_email_pass");
-
- IPSText::getTextClass('email')->buildMessage( array(
- 'NAME' => $member['members_display_name'],
- 'THE_LINK' => $this->settings['base_url'] . 'app=core&module=usercp&tab=core&area=password',
- 'PASSWORD' => $new_pass,
- 'LOGIN' => $this->settings['base_url'] . 'app=core&module=global§ion=login',
- 'USERNAME' => $member['name'],
- 'EMAIL' => $member['email'],
- 'ID' => $member['member_id'],
- )
- );
-
- IPSText::getTextClass('email')->subject = $this->lang->words['lp_random_pass_subject'] . ' ' . $this->settings['board_name'];
- IPSText::getTextClass('email')->to = $member['email'];
-
- IPSText::getTextClass('email')->sendMail();
-
- $this->registry->output->setTitle( $this->lang->words['validation_complete'] );
-
- //-----------------------------------------
- // Remove "dead" validation
- //-----------------------------------------
-
- $this->DB->delete( 'validating', "vid='" . $validate['vid'] . "' OR (member_id={$member['member_id']} AND lost_pass=1)" );
-
- $this->output = $this->registry->getClass('output')->getTemplate('register')->showLostPassWaitRandom( $member );
- }
-
- //-----------------------------------------
- // EMAIL ADDY CHANGE
- //-----------------------------------------
-
- else if ( $validate['email_chg'] == 1 )
- {
- if ( !$validate['real_group'] )
- {
- $validate['real_group'] = $this->settings['member_group'];
- }
-
- IPSMember::save( $member['member_id'], array( 'members' => array( 'member_group_id' => intval($validate['real_group']) ) ) );
-
- IPSCookie::set( "member_id", $member['member_id'] , 1 );
- IPSCookie::set( "pass_hash", $member['member_login_key'], 1 );
-
- //-----------------------------------------
- // Remove "dead" validation
- //-----------------------------------------
-
- $this->DB->delete( 'validating', "vid='" . $validate['vid'] . "' OR (member_id={$member['member_id']} AND email_chg=1)" );
-
- $this->registry->output->silentRedirect( $this->settings['base_url'].'&app=core&module=global§ion=login&do=autologin&fromemail=1' );
- }
- }
-
- /**
- * Displays the registration form
- *
- * @access public
- * @param array $form_errors
- * @return void
- */
- public function registerForm( $form_errors=array() )
- {
- /* INIT */
- $final_errors = array();
-
- if( $this->settings['no_reg'] == 1 )
- {
- $this->registry->output->showError( 'registration_disabled', 10123 );
- }
-
- $coppa = IPSCookie::get( 'coppa' );
-
- if( $coppa == 'yes' )
- {
- $this->registry->output->showError( 'awaiting_coppa', 10124 );
- }
-
- $this->settings[ 'username_errormsg'] = str_replace( '{chars}', $this->settings['username_characters'], $this->settings['username_errormsg'] );
-
- /* Read T&Cs yet? */
- if( ! $this->request['termsread'] )
- {
- if( $this->memberData['member_id'] )
- {
- require_once( IPS_ROOT_PATH . 'sources/handlers/han_login.php' );
- $this->han_login = new han_login( $this->registry );
- $this->han_login->init();
-
- //-----------------------------------------
- // Set some cookies
- //-----------------------------------------
-
- IPSCookie::set( "member_id" , "0" );
- IPSCookie::set( "pass_hash" , "0" );
- IPSCookie::set( "anonlogin" , "-1" );
-
- if ( is_array($_COOKIE) )
- {
- foreach( $_COOKIE as $cookie => $value)
- {
- if ( stripos( $cookie, $this->settings['cookie_id']."ipbforum" ) !== false )
- {
- IPSCookie::set( str_replace( $this->settings['cookie_id'], "", $match[0] ) , '-', -1 );
- }
- }
- }
-
- //-----------------------------------------
- // Logout callbacks...
- //-----------------------------------------
-
- $this->han_login->logoutCallback();
-
- //-----------------------------------------
- // Do it..
- //-----------------------------------------
-
- $this->member->sessionClass()->convertMemberToGuest();
-
- list( $privacy, $loggedin ) = explode( '&', $this->memberData['login_anonymous'] );
-
- IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'login_anonymous' => "{$privacy}&0",
- 'last_activity' => time() ) ) );
- }
-
- /* Continue */
- $cache = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => "conf_key='reg_rules'" ) );
-
- $text = $cache['conf_value'] ? $cache['conf_value'] : $cache['conf_default'];
-
- /* Load the Parser */
- IPSText::getTextClass( 'bbcode' )->bypass_badwords = 1;
- IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
- IPSText::getTextClass( 'bbcode' )->parse_html = 1;
- IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
- IPSText::getTextClass( 'bbcode' )->parsing_section = 'global';
-
- $text = IPSText::getTextClass('bbcode')->preDbParse( $text );
- $text = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $text );
-
- $this->registry->output->setTitle( $this->lang->words['registration_form'] );
- $this->registry->output->addNavigation( $this->lang->words['registration_form'], '' );
-
- $this->output .= $this->registry->output->getTemplate('register')->registerShowTerms( $text, $coppa );
- return;
- }
- else
- {
- /* Did we agree to the t&c? */
- if( ! $this->request['agree_to_terms'] )
- {
- $this->registry->output->showError( 'must_agree_to_terms', 10125 );
- }
- }
-
- /* Do we have another URL that one needs to visit to register? */
- $this->DB->build( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- if( $r['login_register_url'] )
- {
- $this->registry->output->silentRedirect( $r['login_register_url'] );
- exit();
- }
- }
-
- /* Continue... */
- if( $this->settings['reg_auth_type'] )
- {
- if( $this->settings['reg_auth_type'] == 'admin_user' OR $this->settings['reg_auth_type'] == 'user' )
- {
- $this->lang->words['std_text'] .= " " . $this->lang->words['email_validate_text'];
- }
-
- /* User then admin? */
- if( $this->settings['reg_auth_type'] == 'admin_user' )
- {
- $this->lang->words['std_text'] .= " " . $this->lang->words['user_admin_validation'];
- }
-
- if( $this->settings['reg_auth_type'] == 'admin' )
- {
- $this->lang->words['std_text'] .= " " . $this->lang->words['just_admin_validation'];
- }
- }
-
- $captchaHTML = '';
- $qandaHTML = '';
- $this->cache->updateCacheWithoutSaving('_hasStep3', 0);
-
- /* Q and A Challenge */
- if( $this->settings['registration_qanda'] )
- {
- // Grab a random question...
- $question = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'question_and_answer', 'order' => 'rand()', 'limit' => array(1) ) );
-
- if( count($question) )
- {
- $qandaHTML = $this->registry->output->getTemplate('global_other')->questionAndAnswer( $question );
- }
- }
-
- /* Custom Profile Fields */
- $custom_fields_out = array( 'required', 'optional' );
-
- require_once( IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php' );
- $custom_fields = new customProfileFields();
-
- $custom_fields->member_data = $member;
- $custom_fields->initData( 'edit' );
- $custom_fields->parseToEdit( 'register' );
-
- if ( count( $custom_fields->out_fields ) )
- {
- $this->cache->updateCacheWithoutSaving('_hasStep3', 1);
-
- foreach( $custom_fields->out_fields as $id => $form_element )
- {
- if ( $custom_fields->cache_data[ $id ]['pf_not_null'] == 1 )
- {
- $ftype = 'required';
- }
- else
- {
- $ftype = 'optional';
- }
-
- $custom_fields_out[$ftype][] = array(
- 'name' => $custom_fields->field_names[ $id ],
- 'desc' => $custom_fields->field_desc[ $id ],
- 'field' => $form_element,
- 'id' => $id,
- 'error' => $error,
- 'type' => $custom_fields->cache_data[ $id ]['pf_type']
- );
- }
- }
-
- /* CAPTCHA */
- if( $this->settings['bot_antispam'] )
- {
- $captchaHTML = $this->registry->getClass('class_captcha')->getTemplate();
- }
-
- $this->registry->output->setTitle( $this->lang->words['registration_form'] );
- $this->registry->output->addNavigation( $this->lang->words['registration_form'], '' );
-
- /* Other errors */
- $final_errors = array( 'username' => NULL, 'dname' => NULL, 'password' => NULL, 'email' => NULL );
-
- foreach( array( 'username', 'dname', 'password', 'email' ) as $thing )
- {
- if ( isset($form_errors[ $thing ]) AND is_array( $form_errors[ $thing ] ) AND count( $form_errors[ $thing ] ) )
- {
- $final_errors[ $thing ] = implode( " ", $form_errors[ $thing ] );
- }
- }
-
- $this->request['UserName'] = $this->request['UserName'] ? $this->request['UserName'] : '' ;
- $this->request['PassWord'] = $this->request['PassWord'] ? $this->request['PassWord'] : '' ;
- $this->request['EmailAddress'] = $this->request['EmailAddress'] ? $this->request['EmailAddress'] : '' ;
- $this->request['EmailAddress_two'] = $this->request['EmailAddress_two'] ? $this->request['EmailAddress_two'] : '' ;
- $this->request['PassWord_Check'] = $this->request['PassWord_Check'] ? $this->request['PassWord_Check'] : '' ;
- $this->request['members_display_name'] = $this->request['members_display_name'] ? $this->request['members_display_name'] : '' ;
- $this->request['time_offset'] = $this->request['time_offset'] ? $this->request['time_offset'] : '' ;
- $this->request['allow_member_mail'] = $this->request['allow_member_mail'] ? $this->request['allow_member_mail'] : '' ;
- $this->request['dst'] = $this->request['dst'] ? $this->request['dst'] : '' ;
-
- /* Time zone... */
- $this->registry->class_localization->loadLanguageFile( array( 'public_usercp' ), 'core' );
-
- $time_select = array();
-
- foreach( $this->lang->words as $k => $v )
- {
- if( strpos( $k, "time_" ) === 0 )
- {
- $k = str_replace( "time_", '', $k );
-
- if( preg_match( "/^[\-\d\.]+$/", $k ) )
- {
- $time_select[ $k ] = $v;
- }
- }
- }
-
- ksort( $time_select );
-
- /* set default.. */
- $this->request['time_offset'] = ( $this->request['time_offset'] ) ? $this->request['time_offset'] : $this->settings['time_offset'];
-
- /* Need username? */
- $uses_name = false;
-
- foreach( $this->cache->getCache('login_methods') as $method )
- {
- if( $method['login_user_id'] == 'username' )
- {
- $uses_name = true;
- }
- }
-
- /* Get form HTML */
- $this->output .= $this->registry->output->getTemplate('register')->registerForm(
- $form_errors['general'],
- array(
- 'TEXT' => $this->lang->words['std_text'],
- 'coppa_user' => $coppa,
- 'captchaHTML' => $captchaHTML,
- 'qandaHTML' => $qandaHTML,
- 'requireName' => $uses_name,
- ),
- $final_errors,
- $time_select,
- $custom_fields_out );
-
- /* Run the member sync module */
- IPSLib::runMemberSync( 'onRegisterForm' );
- }
-
- /**
- * Processes the registration form
- *
- * @access public
- * @return void
- */
- public function registerProcessForm()
- {
- $form_errors = array();
- $coppa = ( $this->request['coppa_user'] == 1 ) ? 1 : 0;
- $in_password = trim( $this->request['PassWord'] );
- $in_email = mb_strtolower( trim( $this->request['EmailAddress'] ) );
- $_SFS_FOUND = FALSE;
-
- /* Check */
- if( $this->settings['no_reg'] == 1 )
- {
- $this->registry->output->showError( 'registration_disabled', 2016, true );
- }
-
- /* Custom profile field stuff */
- require_once( IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php' );
- $custom_fields = new customProfileFields();
-
- $custom_fields->initData( 'edit' );
- $custom_fields->parseToSave( $this->request, 'register' );
-
- /* Check */
- if( $custom_fields->error_messages )
- {
- $form_errors['general'] = $custom_fields->error_messages;
- }
-
- /* Check the email address */
- if ( ! $in_email OR strlen( $in_email ) < 6 OR !IPSText::checkEmailAddress( $in_email ) )
- {
- $form_errors['email'][$this->lang->words['err_invalid_email']] = $this->lang->words['err_invalid_email'];
- }
-
- if( trim($this->request['PassWord_Check']) != $in_password OR !$in_password )
- {
- $form_errors['password'][$this->lang->words['passwords_not_match']] = $this->lang->words['passwords_not_match'];
- }
-
- /* Test email address */
- $this->request['EmailAddress_two'] = mb_strtolower( trim( $this->request['EmailAddress_two'] ) );
- $this->request['EmailAddress'] = mb_strtolower( trim( $this->request['EmailAddress'] ) );
-
- if( !IPSText::checkEmailAddress( $this->request['EmailAddress_two'] ) )
- {
- $form_errors['email'][$this->lang->words['reg_error_email_invalid']] = $this->lang->words['reg_error_email_invalid'];
- }
- else
- {
- if ( $in_email AND $this->request['EmailAddress_two'] != $in_email )
- {
- $form_errors['email'][$this->lang->words['reg_error_email_nm']] = $this->lang->words['reg_error_email_nm'];
- }
- }
-
- /* Need username? */
- $uses_name = false;
-
- foreach( $this->cache->getCache('login_methods') as $method )
- {
- if( $method['login_user_id'] == 'username' )
- {
- $uses_name = true;
- }
- }
-
- if( !$uses_name )
- {
- $_REQUEST['UserName'] = $_REQUEST['members_display_name'];
- $this->request['UserName'] = $this->request['members_display_name'];
- }
-
- /* Check the username */
- $user_check = IPSMember::getFunction()->cleanAndCheckName( $this->request['UserName'], array(), 'name' );
- $disp_check = IPSMember::getFunction()->cleanAndCheckName( $this->request['members_display_name'] ? $this->request['members_display_name'] : $this->request['UserName'], array(), 'members_display_name' );
-
- if( is_array( $user_check['errors'] ) && count( $user_check['errors'] ) )
- {
- foreach( $user_check['errors'] as $key => $error )
- {
- $form_errors[ $key ][] = $error;
- }
- }
-
- if( is_array( $disp_check['errors'] ) && count( $disp_check['errors'] ) )
- {
- foreach( $disp_check['errors'] as $key => $error )
- {
- if( !$this->settings['auth_allow_dnames'] AND !( is_array( $user_check['errors'] ) && count( $user_check['errors'] ) ) )
- {
- $key = 'username';
- }
-
- $form_errors[ $key ][] = $error;
- }
- }
-
- /* CHECK 1: Any errors (missing fields, etc)? */
- if( count( $form_errors ) )
- {
- $this->registerForm( $form_errors );
- return;
- }
-
- /* Is this email addy taken? */
- if( IPSMember::checkByEmail( $in_email ) == TRUE )
- {
- $form_errors['email'][$this->lang->words['reg_error_email_taken']] = $this->lang->words['reg_error_email_taken'];
- }
-
- /* Load handler... */
- require_once( IPS_ROOT_PATH . 'sources/handlers/han_login.php' );
- $this->han_login = new han_login( $this->registry );
- $this->han_login->init();
- $this->han_login->emailExistsCheck( $in_email );
-
- if( $this->han_login->return_code AND $this->han_login->return_code != 'METHOD_NOT_DEFINED' AND $this->han_login->return_code != 'EMAIL_NOT_IN_USE' )
- {
- $form_errors['email'][$this->lang->words['reg_error_email_taken']] = $this->lang->words['reg_error_email_taken'];
- }
-
- /* Are they banned [EMAIL]? */
- if ( IPSMember::isBanned( 'email', $in_email ) === TRUE )
- {
- $form_errors['email'][$this->lang->words['reg_error_email_ban']] = $this->lang->words['reg_error_email_ban'];
- }
-
- /* Check the CAPTCHA */
- if ( $this->settings['bot_antispam'] )
- {
- if ( $this->registry->getClass('class_captcha')->validate() !== TRUE )
- {
- $form_errors['general'][$this->lang->words['err_reg_code']] = $this->lang->words['err_reg_code'];
- }
- }
-
- /* Check the Q and A */
- if( $this->settings['registration_qanda'] )
- {
- $qanda = intval($this->request['qanda_id']);
- $pass = false;
-
- if( $qanda )
- {
- $data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'question_and_answer', 'where' => 'qa_id=' . $qanda ) );
-
- if( $data['qa_id'] )
- {
- $answers = explode( "\n", str_replace( "\r", "", $data['qa_answers'] ) );
-
- if( count($answers) )
- {
- foreach( $answers as $answer )
- {
- if( mb_strtolower($answer) == mb_strtolower($this->request['qa_answer']) )
- {
- $pass = true;
- break;
- }
- }
- }
- }
- }
- else
- {
- //-----------------------------------------
- // Do we have any questions?
- //-----------------------------------------
-
- $data = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as questions', 'from' => 'question_and_answer' ) );
-
- if( !$data['questions'] )
- {
- $pass = true;
- }
- }
-
- if( !$pass )
- {
- $form_errors['general'][$this->lang->words['err_q_and_a']] = $this->lang->words['err_q_and_a'];
- }
- }
-
- /* CHECK 2: Any errors ? */
- if ( count( $form_errors ) )
- {
- $this->registerForm( $form_errors );
- return;
- }
-
- /* Build up the hashes */
- $mem_group = $this->settings['member_group'];
-
- /* Are we asking the member or admin to preview? */
- if( $this->settings['reg_auth_type'] )
- {
- $mem_group = $this->settings['auth_group'];
- }
- else if ($coppa == 1)
- {
- $mem_group = $this->settings['auth_group'];
- }
-
- /* Create member */
- $member = array(
- 'name' => $this->request['UserName'],
- 'password' => $in_password,
- 'members_display_name' => $this->settings['auth_allow_dnames'] ? $this->request['members_display_name'] : $this->request['UserName'],
- 'email' => $in_email,
- 'member_group_id' => $mem_group,
- 'joined' => time(),
- 'ip_address' => $this->member->ip_address,
- 'time_offset' => $this->request['time_offset'],
- 'coppa_user' => $coppa,
- 'members_auto_dst' => intval($this->request['dst']),
- 'allow_admin_mails' => intval( $this->request['allow_admin_mail'] ),
- 'hide_email' => $this->request['allow_member_mail'] ? 0 : 1,
- );
-
- /* Spam Service */
- $spamCode = 0;
-
- if( $this->settings['spam_service_enabled'] && $this->settings['spam_service_api_key'] )
- {
- /* Query the service */
- $spamCode = IPSMember::querySpamService( $in_email );
-
- /* Action to perform */
- $action = $this->settings[ 'spam_service_action_' . $spamCode ];
-
- /* Perform Action */
- switch( $action )
- {
- /* Proceed with registraction */
- case 1:
- break;
-
- /* Flag for admin approval */
- case 2:
- $member['member_group_id'] = $this->settings['auth_group'];
- $this->settings['reg_auth_type'] = 'admin';
- break;
-
- /* Approve the account, but ban it */
- case 3:
- $member['member_banned'] = 1;
- $member['member_group_id'] = $this->settings['banned_group'];
- $this->settings['reg_auth_type'] = '';
- break;
- }
- }
-
- //-----------------------------------------
- // Create the account
- //-----------------------------------------
-
- $member = IPSMember::create( array( 'members' => $member, 'pfields_content' => $this->request ) );
-
- //-----------------------------------------
- // Login handler create account callback
- //-----------------------------------------
-
- $this->han_login->createAccount( array( 'email' => $member['email'],
- 'joined' => $member['joined'],
- 'password' => $in_password,
- 'ip_address' => $this->member->ip_address,
- 'username' => $member['members_display_name'],
- ) );
-
- //-----------------------------------------
- // We'll just ignore if this fails - it shouldn't hold up IPB anyways
- //-----------------------------------------
-
- /*if ( $han_login->return_code AND ( $han_login->return_code != 'METHOD_NOT_DEFINED' AND $han_login->return_code != 'SUCCESS' ) )
- {
- $this->registry->output->showError( 'han_login_create_failed', 2017, true );
- }*/
-
- //-----------------------------------------
- // Validation
- //-----------------------------------------
-
- $validate_key = md5( IPSLib::makePassword() . time() );
- $time = time();
-
- if( $coppa != 1 )
- {
- if( ( $this->settings['reg_auth_type'] == 'user' ) or ( $this->settings['reg_auth_type'] == 'admin' ) or ( $this->settings['reg_auth_type'] == 'admin_user' ) )
- {
- //-----------------------------------------
- // We want to validate all reg's via email,
- // after email verificiation has taken place,
- // we restore their previous group and remove the validate_key
- //-----------------------------------------
-
- $this->DB->insert( 'validating', array(
- 'vid' => $validate_key,
- 'member_id' => $member['member_id'],
- 'real_group' => /*$this->settings['subsm_enforce'] ? $this->settings['subsm_nopkg_group'] :*/ $this->settings['member_group'],
- 'temp_group' => $this->settings['auth_group'],
- 'entry_date' => $time,
- 'coppa_user' => $coppa,
- 'new_reg' => 1,
- 'ip_address' => $member['ip_address']
- ) );
-
- if( $this->settings['reg_auth_type'] == 'user' OR $this->settings['reg_auth_type'] == 'admin_user' )
- {
- IPSText::getTextClass('email')->getTemplate("reg_validate");
-
- IPSText::getTextClass('email')->buildMessage( array(
- 'THE_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=register&do=auto_validate&uid=" . urlencode( $member['member_id'] ) . "&aid=" . urlencode( $validate_key ),
- 'NAME' => $member['members_display_name'],
- 'MAN_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=register&do=05",
- 'EMAIL' => $member['email'],
- 'ID' => $member['member_id'],
- 'CODE' => $validate_key,
- ) );
-
- IPSText::getTextClass('email')->subject = $this->lang->words['new_registration_email'] . $this->settings['board_name'];
- IPSText::getTextClass('email')->to = $member['email'];
-
- IPSText::getTextClass('email')->sendMail();
-
- $this->output = $this->registry->output->getTemplate('register')->showAuthorize( $member );
-
- }
- else if( $this->settings['reg_auth_type'] == 'admin' )
- {
- $this->output = $this->registry->output->getTemplate('register')->showPreview( $member );
- }
-
- if( $this->settings['new_reg_notify'] )
- {
- $date = $this->registry->class_localization->getDate( time(), 'LONG', 1 );
-
- IPSText::getTextClass('email')->getTemplate( 'admin_newuser' );
-
- IPSText::getTextClass('email')->buildMessage( array( 'DATE' => $date,
- 'LOG_IN_NAME' => $member['name'],
- 'EMAIL' => $member['email'],
- 'IP' => $member['ip_address'],
- 'DISPLAY_NAME' => $member['members_display_name'] ) );
-
- IPSText::getTextClass('email')->subject = $this->lang->words['new_registration_email1'] . $this->settings['board_name'];
- IPSText::getTextClass('email')->to = $this->settings['email_in'];
- IPSText::getTextClass('email')->sendMail();
- }
-
- $this->registry->output->setTitle( $this->lang->words['reg_success'] );
- $this->registry->output->addNavigation( $this->lang->words['nav_reg'], '' );
- }
- else
- {
- /* We don't want to preview, or get them to validate via email. */
- $stat_cache = $this->caches['stats'];
-
- if( $member['members_display_name'] AND $member['member_id'] )
- {
- $stat_cache['last_mem_name'] = $member['members_display_name'];
- $stat_cache['last_mem_name_seo'] = IPSText::makeSeoTitle( $member['members_display_name'] );
- $stat_cache['last_mem_id'] = $member['member_id'];
- }
-
- $stat_cache['mem_count'] += 1;
-
- $this->cache->setCache( 'stats', $stat_cache, array( 'array' => 1 ) );
-
- if( $this->settings['new_reg_notify'] )
- {
- $date = $this->registry->class_localization->getDate( time(), 'LONG', 1 );
-
- IPSText::getTextClass('email')->getTemplate( 'admin_newuser' );
-
- IPSText::getTextClass('email')->buildMessage( array( 'DATE' => $date,
- 'LOG_IN_NAME' => $member['name'],
- 'EMAIL' => $member['email'],
- 'IP' => $member['ip_address'],
- 'DISPLAY_NAME' => $member['members_display_name'] ) );
-
- IPSText::getTextClass('email')->subject = $this->lang->words['new_registration_email1'] . $this->settings['board_name'];
- IPSText::getTextClass('email')->to = $this->settings['email_in'];
- IPSText::getTextClass('email')->sendMail();
- }
-
- IPSCookie::set( 'pass_hash' , $member['member_login_key'], 1);
- IPSCookie::set( 'member_id' , $member['member_id'] , 1);
-
- //-----------------------------------------
- // Fix up session
- //-----------------------------------------
-
- $privacy = $this->request['Privacy'] ? 1 : 0;
-
- if( $member['g_hide_online_list'] )
- {
- $privacy = 1;
- }
-
- $this->member->sessionClass()->convertGuestToMember( array( 'member_name' => $member['members_display_name'],
- 'member_id' => $member['member_id'],
- 'member_group' => $member['member_group_id'],
- 'login_type' => $privacy ) );
-
- $this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=core&module=global§ion=login&do=autologin&fromreg=1');
- }
- }
- else
- {
- /* This is a COPPA user, so lets tell them they registered OK and redirect to the form. */
- $this->DB->insert( 'validating', array (
- 'vid' => $validate_key,
- 'member_id' => $member['member_id'],
- 'real_group' => $this->settings['member_group'],
- 'temp_group' => $this->settings['auth_group'],
- 'entry_date' => $time,
- 'coppa_user' => $coppa,
- 'new_reg' => 1,
- 'ip_address' => $member['ip_address']
- ) );
-
- $this->registry->output->redirectScreen( $this->lang->words['cp_success'], $this->settings['base_url'] . 'app=core&module=global§ion=register&do=12' );
- }
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Register
+ * Last Updated: $Date: 2010-10-05 21:26:08 -0400 (Tue, 05 Oct 2010) $
+ *
+ *
+ * @author $Author $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 20th February 2002
+ * @version $Rev: 6945 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_global_register extends ipsCommand
+{
+ /**
+ * Class entry point
+ *
+ * @access public
+ * @param object Registry reference
+ * @return void [Outputs to screen/redirects]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* Load language */
+ $this->registry->class_localization->loadLanguageFile( array( 'public_register' ), 'core' );
+
+ //-----------------------------------------
+ // Meta tags
+ //-----------------------------------------
+
+ $this->registry->output->addMetaTag( 'robots', 'noindex' );
+
+ /* What to do */
+ switch( $this->request['do'] )
+ {
+ case 'process_form':
+ $this->registerProcessForm();
+ break;
+
+ case 'auto_validate':
+ $this->_autoValidate();
+ break;
+
+ case 'coppa_two':
+ $this->registerCoppaTwo();
+ break;
+
+ case '12':
+ $this->registerCoppaPermsForm();
+ break;
+
+ case '05':
+ $this->_showManualForm();
+ break;
+
+ case '07':
+ $this->_showManualForm('newemail');
+ break;
+
+ case 'reval':
+ $this->_revalidateForm();
+ break;
+
+ case 'reval2':
+ $this->_revalidateComplete();
+ break;
+
+ case 'complete_login':
+ $this->_completeRegistration();
+ break;
+ case 'complete_login_do':
+ $this->_completeRegistrationSave();
+ break;
+
+ default:
+ case 'form':
+ if( $this->settings['no_reg'] > 0 )
+ {
+ $this->registry->output->showError( 'registration_disabled', 10123, FALSE, '', 200 );
+ }
+
+ if( $this->settings['use_coppa'] == 1 and $this->request['coppa_pass'] != 1 )
+ {
+ $this->registerCoppaStart();
+ }
+ else
+ {
+ $this->registerForm();
+ }
+ break;
+ }
+
+ /* Output */
+ $this->registry->output->addContent( $this->output );
+ $this->registry->output->sendOutput();
+ }
+
+
+ /**
+ * Save the data to complete the partial member record login/registration
+ *
+ * @access private
+ * @return void [Outputs to screen/redirects]
+ */
+ private function _completeRegistrationSave()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $mid = intval( $this->request['mid'] );
+ $key = intval( $this->request['key'] );
+ $in_email = mb_strtolower( trim($this->request['EmailAddress']) );
+ $banfilters = array();
+ $form_errors = array( 'dname' => array(), 'email' => array(), 'general' => array() );
+ $members_display_name = trim( $this->request['members_display_name'] );
+ $poss_session_id = "";
+ $login_user = trim( $this->request['login_user'] );
+ $login_pass = trim( $this->request['login_pass'] );
+ $connectService = trim( mb_strtolower( $this->request['connectService'] ) );
+
+ //-----------------------------------------
+ // Get DB row
+ //-----------------------------------------
+
+ $reg = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'members_partial', 'where' => "partial_member_id={$mid} AND partial_date={$key}" ) );
+ $tmp_member = IPSMember::load( $mid );
+
+ //-----------------------------------------
+ // Got it?
+ //-----------------------------------------
+
+ if ( ! $reg['partial_id'] OR ! $tmp_member['member_id'] )
+ {
+ $this->registry->output->showError( 'partial_reg_noid', 10117 );
+ }
+
+ //-----------------------------------------
+ // Load ban filters
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'banfilters' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $banfilters[ $r['ban_type'] ][] = $r['ban_content'];
+ }
+
+ //-----------------------------------------
+ // Load log in handler...
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $han_login = new $classToLoad( $this->registry );
+ $han_login->init();
+
+ //-----------------------------------------
+ // Custom profile field stuff
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields' );
+ $custom_fields = new $classToLoad();
+
+ $custom_fields->initData( 'edit' );
+ $custom_fields->parseToSave( $this->request, 'register' );
+
+ /* Check */
+ if( $custom_fields->error_messages )
+ {
+ $form_errors['general'] = $custom_fields->error_messages;
+ }
+
+ /* Check the website url field */
+ $website_field = $custom_fields->getFieldIDByKey( 'website' );
+
+ if( $website_field && $custom_fields->out_fields[ 'field_' . $website_field ] )
+ {
+ if( ! stristr( $custom_fields->out_fields[ 'field_' . $website_field ], 'http://' ) )
+ {
+ $custom_fields->out_fields[ 'field_' . $website_field ] = 'http://' . $custom_fields->out_fields[ 'field_' . $website_field ];
+ }
+ }
+
+ /* Are we trying to connect to an existing account */
+ if ( $connectService AND $login_user AND $login_pass AND ( $this->settings['fb_realname'] == 'enforced' OR !$members_display_name ) )
+ {
+ /* Load Full Member */
+ $member = IPSMember::load( $mid, 'all' );
+
+ /* Force email check */
+ $han_login->setForceEmailCheck( TRUE );
+
+ /* Now attempt to authorize member */
+ $return = $han_login->loginPasswordCheck( '', $login_user, $login_pass );
+
+ if ( $return !== TRUE )
+ {
+ /* Wrong email/password */
+ $form_errors['serviceLogIn'][] = $this->lang->words['connect_incorrect_details'];
+ }
+ else
+ {
+ /* Fetch data returned based on email address */
+ $logInMember = $han_login->member_data;
+
+ /* We're A-OK so allow service module to clean up member accounts, then log us the heck in! */
+ if ( $connectService == 'facebook' AND $member['fb_uid'] )
+ {
+ /* Already FBd? */
+ if ( $logInMember['fb_uid'] AND ( $member['fb_uid'] != $logInMember['fb_uid'] ) )
+ {
+ /* User already has facebook link */
+ $form_errors['serviceLogIn'][] = sprintf( $this->lang->words['connect_already_linked'], $login_user, ucfirst( $connectService ) );
+ }
+
+ require_once( IPS_ROOT_PATH . 'sources/classes/facebook/connect.php' );
+ $facebook = new facebook_connect( $this->registry, $member['fb_token'], $member['fb_uid'] );
+
+ if ( $facebook->finishNewConnection( $logInMember['member_id'], $member['member_id'] ) !== true )
+ {
+ /* Unknown error */
+ $form_errors['serviceLogIn'][] = $this->lang->words['connect_unknown'];
+ }
+ }
+ else if ( $connectService == 'twitter' AND $member['twitter_id'] )
+ {
+ /* Already FBd? */
+ if ( $logInMember['twitter_id'] AND ( $member['twitter_id'] != $logInMember['twitter_id'] ) )
+ {
+ /* User already has facebook link */
+ $form_errors['serviceLogIn'][] = sprintf( $this->lang->words['connect_already_linked'], $login_user, ucfirst( $connectService ) );
+ }
+
+ require_once( IPS_ROOT_PATH . 'sources/classes/twitter/connect.php' );
+ $twitter = new twitter_connect( $this->registry, $member['twitter_token'], $member['twitter_secret'] );
+
+ if ( $twitter->finishNewConnection( $logInMember['member_id'], $member['member_id'] ) !== true )
+ {
+ /* Unknown error */
+ $form_errors['serviceLogIn'][] = $this->lang->words['connect_unknown'];
+ }
+ }
+ else if ( $connectService == 'vkontakte' AND $member['vk_uid'] )
+ {
+ /* Already VKd? */
+ if ( $logInMember['vk_uid'] AND ( $member['vk_uid'] != $logInMember['vk_uid'] ) )
+ {
+ /* User already has vkontakte link */
+ $form_errors['serviceLogIn'][] = sprintf( $this->lang->words['connect_already_linked'], $login_user, ucfirst( $connectService ) );
+ }
+
+ require_once( IPS_ROOT_PATH . 'sources/classes/vkontakte/connect.php' );
+ $vk = new vkontakte_connect( $this->registry, $key );
+
+ if ( $vk->finishNewConnection( $logInMember['member_id'], $member['member_id'] ) !== true )
+ {
+ /* Unknown error */
+ $form_errors['serviceLogIn'][] = $this->lang->words['connect_unknown'];
+ }
+ }
+
+ /* Ok to proceed? */
+ if ( ! count( $form_errors['serviceLogIn'] ) )
+ {
+ IPSMember::remove( $member['member_id'] );
+
+ /* Here, so log us in!! */
+ $r = $han_login->loginWithoutCheckingCredentials( $logInMember['member_id'], TRUE );
+
+ /* Boing */
+ if ( is_array( $r ) )
+ {
+ $this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=core&module=usercp§ion=register&tab=members&area=' . $connectService );
+ }
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Remove 'sneaky' spaces
+ //-----------------------------------------
+
+ if ( $this->settings['strip_space_chr'] )
+ {
+ $members_display_name = IPSText::removeControlCharacters( $members_display_name );
+ }
+
+ //-----------------------------------------
+ // Testing email addresses?
+ //-----------------------------------------
+
+ if ( ! $reg['partial_email_ok'] AND $in_email )
+ {
+ //-----------------------------------------
+ // Check the email address
+ //-----------------------------------------
+
+ if( ! IPSText::checkEmailAddress( $in_email ) )
+ {
+ $form_errors['email'][] = $this->lang->words['reg_error_email_nm'];
+ }
+
+ //-----------------------------------------
+ // Test email address
+ //-----------------------------------------
+
+ $this->request['EmailAddress_two'] = mb_strtolower( trim($this->request['EmailAddress_two']) );
+
+ if ( $in_email AND ( $this->request['EmailAddress_two'] != $in_email ) )
+ {
+ $form_errors['email'][] = $this->lang->words['reg_error_email_nm'];
+ }
+
+ //-----------------------------------------
+ // Are they banned [EMAIL]?
+ //-----------------------------------------
+
+ if ( is_array( $banfilters['email'] ) and count( $banfilters['email'] ) )
+ {
+ foreach ( $banfilters['email'] as $email )
+ {
+ $email = str_replace( '\*', '.*' , preg_quote($email, "/") );
+
+ if ( preg_match( "/^{$email}$/i", $in_email ) )
+ {
+ $form_errors['email'][] = $this->lang->words['reg_error_email_taken'];
+ break;
+ }
+ }
+ }
+
+ /* Is this email addy taken? */
+ if( IPSMember::checkByEmail( $in_email ) == TRUE )
+ {
+ $form_errors['email'][] = $this->lang->words['reg_error_email_taken'];
+ }
+
+ if( $han_login->emailExistsCheck( trim( mb_strtolower( $in_email ) ) ) )
+ {
+ $form_errors['email'][] = $this->lang->words['reg_error_email_taken'];
+ }
+ }
+ else if ( ! $reg['partial_email_ok'] AND ! $in_email AND ! $login_user )
+ {
+ $form_errors['email'][] = $this->lang->words['reg_error_email_nm'];
+ }
+
+ if ( $this->settings['auth_allow_dnames'] )
+ {
+ /* Check the username */
+ $user_check = IPSMember::getFunction()->cleanAndCheckName( $members_display_name, $tmp_member, 'members_display_name' );
+
+ if( is_array( $user_check['errors'] ) && count( $user_check['errors'] ) )
+ {
+ $form_errors['dname'][] = $this->lang->words[ $user_check['errors']['dname'] ];
+ }
+ }
+
+ //-----------------------------------------
+ // CHECK 1: Any errors (duplicate names, etc)?
+ //-----------------------------------------
+
+ if ( count( $form_errors ) )
+ {
+ $errorMessages = array();
+
+ foreach( $form_errors as $errorCat => $errorMessage )
+ {
+ foreach( $errorMessage as $error )
+ {
+ $errorMessages['general'][] = $error;
+ }
+ }
+
+ if( count($errorMessages) )
+ {
+ $this->_completeRegistration( $errorMessages );
+ return;
+ }
+ }
+
+ //-----------------------------------------
+ // Update: Members
+ //-----------------------------------------
+
+ $members_display_name = $this->settings['auth_allow_dnames'] ? $members_display_name : $tmp_member['name'];
+ $member_group_id = ( $tmp_member['twitter_token'] AND $tmp_member['member_group_id'] == $this->settings['auth_group']) ? $this->settings['member_group'] : $tmp_member['member_group_id'];
+
+ if ( ! $reg['partial_email_ok'] )
+ {
+ IPSMember::save( $mid, array( 'members' => array(
+ 'email' => $in_email,
+ 'members_display_name' => $members_display_name,
+ 'members_seo_name' => IPSText::makeSeoTitle( $members_display_name ),
+ 'name' => $tmp_member['name'] ? $tmp_member['name'] : $members_display_name,
+ 'members_l_username' => $tmp_member['members_l_username'] ? $tmp_member['members_l_username'] : $members_display_name,
+ 'member_group_id' => $member_group_id,
+ 'members_l_display_name' => mb_strtolower( $members_display_name )
+ ) ) );
+ }
+ else
+ {
+ IPSMember::save( $mid, array( 'members' => array(
+ 'members_display_name' => $members_display_name,
+ 'members_seo_name' => IPSText::makeSeoTitle( $members_display_name ),
+ 'name' => $tmp_member['name'] ? $tmp_member['name'] : $members_display_name,
+ 'members_l_username' => $tmp_member['members_l_username'] ? $tmp_member['members_l_username'] : $members_display_name,
+ 'member_group_id' => $member_group_id,
+ 'members_l_display_name' => mb_strtolower( $members_display_name )
+ ) ) );
+ }
+
+ //-----------------------------------------
+ // Delete: Partials row
+ //-----------------------------------------
+
+ $this->DB->delete( 'members_partial', 'partial_member_id=' . $mid );
+ $this->DB->delete( 'vkontakte_connect', "v_key='" . $key . "'" );
+
+ //-----------------------------------------
+ // Update: Profile fields
+ //-----------------------------------------
+
+ $this->DB->force_data_type = array();
+
+ foreach( $custom_fields->out_fields as $_field => $_data )
+ {
+ $this->DB->force_data_type[ $_field ] = 'string';
+ }
+
+ if ( is_array($custom_fields->out_fields) and count($custom_fields->out_fields) )
+ {
+ $this->DB->update( 'pfields_content', $custom_fields->out_fields, 'member_id=' . $mid );
+ }
+
+ //-----------------------------------------
+ // Pass twitter/facebook via spam service
+ //-----------------------------------------
+
+ //-----------------------------------------
+ // Send out admin email
+ //-----------------------------------------
+
+ if ( $this->settings['new_reg_notify'] )
+ {
+ $date = $this->registry->getClass('class_localization')->getDate( time(), 'LONG', 1 );
+
+ IPSText::getTextClass('email')->getTemplate("admin_newuser");
+
+ IPSText::getTextClass('email')->buildMessage( array( 'DATE' => $date,
+ 'LOG_IN_NAME' => $tmp_member['name'] ? $tmp_member['name'] : $members_display_name,
+ 'EMAIL' => $in_email,
+ 'IP' => $tmp_member['ip_address'],
+ 'DISPLAY_NAME' => $members_display_name ) );
+
+ IPSText::getTextClass('email')->subject = $this->lang->words['new_registration_email'] . $this->settings['board_name'];
+ IPSText::getTextClass('email')->to = $this->settings['email_in'];
+ IPSText::getTextClass('email')->sendMail();
+ }
+
+ //-----------------------------------------
+ // Set cookies
+ //-----------------------------------------
+
+ IPSCookie::set("member_id" , $mid , 1 );
+ IPSCookie::set("pass_hash" , $tmp_member['member_login_key'] , 1 );
+
+ //-----------------------------------------
+ // Fix up session
+ //-----------------------------------------
+
+ $privacy = $this->request['Privacy'] ? 1 : 0;
+
+ if( $this->caches['group_cache'][ $tmp_member['member_group_id'] ]['g_hide_online_list'] )
+ {
+ $privacy = 1;
+ }
+
+ $this->member->sessionClass()->convertGuestToMember( array( 'member_name' => $members_display_name,
+ 'member_id' => $mid,
+ 'member_group' => $tmp_member['member_group_id'],
+ 'login_type' => $privacy ) );
+
+ //-----------------------------------------
+ // Update Stats
+ //-----------------------------------------
+
+ $cache = $this->cache->getCache('stats');
+
+ if( $members_display_name AND $mid AND $privacy )
+ {
+ $cache['last_mem_name'] = $members_display_name;
+ $cache['last_mem_name_seo'] = IPSText::makeSeoTitle( $members_display_name );
+ $cache['last_mem_id'] = $mid;
+ }
+
+ $cache['mem_count'] += 1;
+
+ $this->cache->setCache( 'stats', $cache, array( 'array' => 1 ) );
+
+ /* Complete account */
+ IPSLib::runMemberSync( 'onCompleteAccount', IPSMember::load( $mid ) );
+
+ //-----------------------------------------
+ // Go to the board index
+ //-----------------------------------------
+
+ $this->registry->output->redirectScreen( $this->lang->words['clogin_done'], $this->settings['base_url'] );
+ }
+
+ /**
+ * When a member logs in via an external login method and we do not have all of the data
+ * to create the member's account, we create a partial record. This function shows the
+ * form upon first visit by member (usually immediately after login) to complete the
+ * login/registration.
+ *
+ * @access private
+ * @param array Errors
+ * @return void [Outputs to screen/redirects]
+ */
+ private function _completeRegistration( $form_errors=array() )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $mid = intval( $this->request['mid'] );
+ $key = intval( $this->request['key'] );
+ $final_errors = '';
+
+ //-----------------------------------------
+ // Get DB row
+ //-----------------------------------------
+
+ $reg = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'members_partial',
+ 'where' => "partial_member_id={$mid} AND partial_date={$key}" ) );
+
+ //-----------------------------------------
+ // Got it?
+ //-----------------------------------------
+
+ if ( ! $reg['partial_id'] )
+ {
+ $this->registry->output->showError( 'partial_reg_noid', 10118 );
+ }
+
+ /* Load Full Member */
+ $member = IPSMember::load( $mid, 'all' );
+
+ /* Twitter or Facebook? */
+ if ( $member['fb_uid'] AND $member['fb_token'] )
+ {
+ /* Attempt to fetch user details */
+ require_once( IPS_ROOT_PATH . 'sources/classes/facebook/connect.php' );
+ $facebook = new facebook_connect( $this->registry, $member['fb_token'], $member['fb_uid'] );
+
+ $userData = $facebook->fetchUserData();
+
+ if ( $userData['id'] )
+ {
+ $userData['service'] = 'facebook';
+ $userData['_name'] = $userData['name'];
+ $userData['_pic'] = $userData['pic_square'];
+ $userData['_sImage'] = $this->settings['public_dir'] . 'style_status/facebook.png';
+
+ /* Enforcing / allowing real names? */
+ if ( ! count( $form_errors['dname'] ) AND $this->settings['fb_realname'] != 'any' )
+ {
+ $userData['_displayName'] = $userData['_name'];
+
+ /* Now, make sure we have a unique display name */
+ $max = $this->DB->buildAndFetch( array( 'select' => 'MAX(member_id) as max',
+ 'from' => 'members',
+ 'where' => "members_l_display_name LIKE '" . $this->DB->addSlashes( mb_strtolower( $userData['_displayName'] ) ) . "%'" ) );
+
+ if ( $max['max'] )
+ {
+ /* does the username already have it set? */
+ if ( stristr( $member['name'], $userData['_displayName'] ) )
+ {
+ $userData['_displayName'] = $member['name'];
+ }
+ else
+ {
+ $_num = $max['max'] + 1;
+ $userData['_displayName'] = $userData['_displayName'] . '_' . $_num;
+ }
+ }
+ }
+ }
+ }
+ else if ( $member['twitter_id'] AND $member['twitter_token'] AND $member['twitter_secret'] )
+ {
+ /* Attempt to fetch user details */
+ require_once( IPS_ROOT_PATH . 'sources/classes/twitter/connect.php' );
+ $twitter = new twitter_connect( $this->registry, $member['twitter_token'], $member['twitter_secret'] );
+
+ $userData = $twitter->fetchUserData();
+
+ if ( $userData['id'] )
+ {
+ $userData['service'] = 'twitter';
+ $userData['_name'] = $userData['screen_name'];
+ $userData['_pic'] = $userData['profile_image_url'];
+ $userData['_sImage'] = $this->settings['public_dir'] . 'style_status/twitter.png';
+ }
+ }
+ else if ( $member['vk_uid'] )
+ {
+ /* Attempt to fetch user details */
+ require_once( IPS_ROOT_PATH . 'sources/classes/vkontakte/connect.php' );
+ $vk = new vkontakte_connect( $this->registry, $key );
+
+ $userData = $vk->fetchUserData();
+
+ if ( $userData['id'] )
+ {
+ $userData['service'] = 'vkontakte';
+ $userData['_name'] = $userData['name'];
+ $userData['_pic'] = $userData['photo'];
+ $userData['_sImage'] = $this->settings['public_dir'] . 'style_status/vkontakte.png';
+ }
+ }
+
+ /* Remote registrations disabled? */
+ if ( $this->settings['no_reg'] == 2 )
+ {
+ $this->registry->output->showError( 'no_remote_reg', 1090001 );
+ }
+
+ //-----------------------------------------
+ // Custom profile fields stuff
+ //-----------------------------------------
+
+ /* Custom Profile Fields */
+ $custom_fields_out = array( 'required', 'optional' );
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields' );
+ $custom_fields = new $classToLoad();
+
+ $custom_fields->member_data = array();
+ $custom_fields->initData( 'edit' );
+ $custom_fields->parseToEdit( 'register' );
+
+ if ( count( $custom_fields->out_fields ) )
+ {
+ foreach( $custom_fields->out_fields as $id => $form_element )
+ {
+ if ( $custom_fields->cache_data[ $id ]['pf_not_null'] == 1 )
+ {
+ $ftype = 'required';
+ }
+ else
+ {
+ $ftype = 'optional';
+ }
+
+ $custom_fields_out[$ftype][] = array(
+ 'name' => $custom_fields->field_names[ $id ],
+ 'desc' => $custom_fields->field_desc[ $id ],
+ 'field' => $form_element,
+ 'id' => $id,
+ 'error' => '',
+ 'type' => $custom_fields->cache_data[ $id ]['pf_type']
+ );
+ }
+ }
+
+ //-----------------------------------------
+ // Other errors
+ //-----------------------------------------
+
+ foreach( array( 'username', 'dname', 'password', 'email', 'general', 'serviceLogIn' ) as $thing )
+ {
+ if ( is_array( $form_errors[ $thing ] ) AND count( $form_errors[ $thing ] ) )
+ {
+ $final_errors .= implode( " ", $form_errors[ $thing ] );
+ }
+ }
+
+ //-----------------------------------------
+ // No display name?
+ //-----------------------------------------
+
+ if ( ! $this->memberData['members_display_name'] )
+ {
+ $this->memberData['members_display_name'] = ( $member['members_display_name'] ) ? $member['members_display_name'] : $member['email'];
+ }
+
+ //-----------------------------------------
+ // Show the form (email and display name)
+ //-----------------------------------------
+
+ $this->output .= $this->registry->getClass('output')->getTemplate('register')->completePartialLogin( $mid, $key, $custom_fields_out, $final_errors, $reg, $userData );
+
+ $this->registry->output->setTitle( $this->lang->words['clogin_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
+ $this->registry->output->addNavigation( $this->lang->words['clogin_title'], '' );
+ }
+
+ /**
+ * Show the form to request validation email to be resent
+ *
+ * @access private
+ * @param string Errors
+ * @return void [Outputs to screen/redirects]
+ */
+ private function _revalidateForm( $errors="" )
+ {
+ $uses_name = false;
+ $uses_email = false;
+
+ foreach( $this->cache->getCache('login_methods') as $method )
+ {
+ if( $method['login_user_id'] == 'username' )
+ {
+ $uses_name = true;
+ }
+
+ if( $method['login_user_id'] == 'email' )
+ {
+ $uses_email = true;
+ }
+ }
+
+ if( $uses_name AND $uses_email )
+ {
+ $name = $this->memberData['member_id'] == "" ? '' : $this->memberData['name'];
+ $this->lang->words['rv_ins'] = $this->lang->words['rv_ins_both'];
+ }
+ else if( $uses_email )
+ {
+ $name = $this->memberData['member_id'] == "" ? '' : $this->memberData['email'];
+ $this->lang->words['rv_ins'] = $this->lang->words['rv_ins_email'];
+ }
+ else
+ {
+ $name = $this->memberData['member_id'] == "" ? '' : $this->memberData['name'];
+ $this->lang->words['rv_ins'] = $this->lang->words['rv_ins_name'];
+ }
+
+ $this->output .= $this->registry->getClass('output')->getTemplate('register')->showRevalidateForm( $name, $errors );
+ $this->registry->output->setTitle( $this->lang->words['rv_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
+ $this->registry->output->addNavigation( $this->lang->words['rv_title'], '' );
+ }
+
+ /**
+ * Resend email validation request for lost password, email change and new registration
+ *
+ * @access private
+ * @return void [Outputs to screen/redirects]
+ */
+ private function _revalidateComplete()
+ {
+ //-----------------------------------------
+ // Check in the DB for entered member name
+ //-----------------------------------------
+
+ if ( $this->request['username'] == "" )
+ {
+ $this->_revalidateForm('err_no_username');
+ return;
+ }
+
+ $username = $this->request['username'];
+ $keyType = IPSText::checkEmailAddress( $this->request['username'] ) ? 'email' : 'username';
+
+ $member = IPSMember::load( $username, 'extendedProfile', $keyType );
+
+ if ( ! $member['member_id'] )
+ {
+ /**
+ * Try the other key type just to be safe...
+ */
+ $member = IPSMember::load( $username, 'extendedProfile', $keyType == 'email' ? 'username' : 'email' );
+
+ if ( ! $member['member_id'] )
+ {
+ $this->_revalidateForm('err_no_username');
+ return;
+ }
+ }
+
+ //-----------------------------------------
+ // Check in the DB for any validations
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'validating', 'where' => "member_id=" . intval($member['member_id']) ) );
+ $this->DB->execute();
+
+ if ( ! $val = $this->DB->fetch() )
+ {
+ $this->_revalidateForm('err_no_validations');
+ return;
+ }
+
+ //-----------------------------------------
+ // Which type is it then?
+ //-----------------------------------------
+
+ if ( $val['lost_pass'] == 1 )
+ {
+ IPSText::getTextClass('email')->getTemplate("lost_pass");
+
+ IPSText::getTextClass('email')->buildMessage( array(
+ 'NAME' => $member['members_display_name'],
+ 'THE_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=lostpass&do=sendform&uid=" . $member['member_id'] . "&aid=" . $val['vid'],
+ 'MAN_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=lostpass&do=sendform",
+ 'EMAIL' => $member['email'],
+ 'ID' => $member['member_id'],
+ 'CODE' => $val['vid'],
+ 'IP_ADDRESS' => $this->member->ip_address,
+ )
+ );
+
+ IPSText::getTextClass('email')->subject = $this->lang->words['lp_subject'].' '.$this->settings['board_name'];
+ IPSText::getTextClass('email')->to = $member['email'];
+
+ IPSText::getTextClass('email')->sendMail();
+ }
+ else if ( $val['new_reg'] == 1 )
+ {
+ IPSText::getTextClass('email')->getTemplate("reg_validate");
+
+ IPSText::getTextClass('email')->buildMessage( array(
+ 'THE_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=register&do=auto_validate&uid=" . $member['member_id'] . "&aid=" . $val['vid'],
+ 'NAME' => $member['members_display_name'],
+ 'MAN_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=register&do=05",
+ 'EMAIL' => $member['email'],
+ 'ID' => $member['member_id'],
+ 'CODE' => $val['vid'],
+ )
+ );
+
+ IPSText::getTextClass('email')->subject = $this->lang->words['email_reg_subj'] . " " . $this->settings['board_name'];
+ IPSText::getTextClass('email')->to = $member['email'];
+
+ IPSText::getTextClass('email')->sendMail();
+ }
+ else if ( $val['email_chg'] == 1 )
+ {
+ IPSText::getTextClass('email')->getTemplate("newemail");
+
+ IPSText::getTextClass('email')->buildMessage( array(
+ 'NAME' => $member['members_display_name'],
+ 'THE_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=register&do=auto_validate&type=newemail&uid=" . $member['member_id'] . "&aid=" . $val['vid'],
+ 'ID' => $member['member_id'],
+ 'MAN_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=register&do=07",
+ 'CODE' => $val['vid'],
+ )
+ );
+
+ IPSText::getTextClass('email')->subject = $this->lang->words['ne_subject'] . ' ' . $this->settings['board_name'];
+ IPSText::getTextClass('email')->to = $member['email'];
+
+ IPSText::getTextClass('email')->sendMail();
+ }
+ else
+ {
+ $this->_revalidateForm('err_no_validations');
+ return;
+ }
+
+ $this->output .= $this->registry->getClass('output')->getTemplate('register')->showRevalidated();
+
+ $this->registry->output->setTitle( $this->lang->words['rv_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
+ $this->registry->output->addNavigation( $this->lang->words['rv_title'], '' );
+ }
+
+ /**
+ * Show the form to manually enter in validation info if auto-validation failed.
+ *
+ * @access private
+ * @param string Type of validation
+ * @param string Error messages
+ * @return void [Outputs to screen/redirects]
+ */
+ private function _showManualForm($type='reg', $errors="")
+ {
+ //-----------------------------------------
+ // In IPB3 this is handled by another section
+ // If somehow a request comes in, send to correct location
+ //-----------------------------------------
+
+ if ( $type == 'lostpass' )
+ {
+ $this->registry->output->silentRedirect( $this->settings['base_url'] . 'app=core&module=global§ion=lostpass&do=sendform&uid=' . $this->request['uid'] . '&aid=' . $this->request['aid'] );
+ }
+ else
+ {
+ $this->output = $this->registry->getClass('output')->getTemplate('register')->showManualForm( $type );
+ }
+
+ $this->registry->output->setTitle( $this->lang->words['activation_form'] . ' - ' . ipsRegistry::$settings['board_name'] );
+ $this->registry->output->addNavigation( $this->lang->words['activation_form'], '' );
+ }
+
+
+ /**
+ * Show coppa form. This is the downloadable/printable form, and as such is just printed to the browser directly
+ *
+ * @access private
+ * @return void
+ */
+ private function registerCoppaPermsForm()
+ {
+ /* Keith said to strip these out - it's all his fault :( */
+ $this->settings[ 'coppa_address'] = str_replace( array( ' ', ' ' ), '', $this->settings['coppa_address'] );
+ $this->settings[ 'coppa_address'] = nl2br( $this->settings['coppa_address'] );
+
+ echo( $this->registry->output->getTemplate('register')->registerCoppaForm() );
+ exit();
+ }
+
+ /**
+ * This is the second page a COPPA submission hits. Really, user hits this page and if birthday is older than 13
+ * we just continue with registration form. Otherwise we show the coppa validation required message with link
+ * to download/print coppa compliance sheet for parents to fill in.
+ *
+ * @access private
+ * @return void
+ */
+ private function registerCoppaTwo()
+ {
+ if( ! $this->request['m'] OR ! $this->request['d'] OR ! $this->request['y'] )
+ {
+ $this->registry->output->showError( 'coppa_form_fill', 10119 );
+ }
+
+ $birthday = mktime( 0, 0, 0, intval( $this->request['m'] ), intval( $this->request['d'] ), intval( $this->request['y'] ) );
+ $coppa = mktime( 0, 0, 0, date( "m" ), date ("d" ), date( "Y" ) - 13 );
+
+ if( $birthday <= $coppa )
+ {
+ $this->registerForm();
+ return;
+ }
+
+ IPSCookie::set( 'coppa', 'yes', 0, 1 );
+ IPSCookie::set( 'coppabday', $this->request['m'] . '-' . $this->request['d'] . '-' . $this->request['y'], 0, 1 );
+
+ $this->lang->words['coppa_form_text'] = str_replace( "<#FORM_LINK#>", "" . $this->lang->words['coppa_link_form'] . " ", $this->lang->words['coppa_form_text']);
+
+ $this->output .= $this->registry->output->getTemplate('register')->registerCoppaTwo();
+
+ $this->registry->output->setTitle( $this->lang->words['coppa_title'] . ' - ' . ipsRegistry::$settings['board_name']);
+ $this->registry->output->addNavigation( $this->lang->words['coppa_title'], '' );
+ }
+
+ /**
+ * First COPPA screen. Shows form for visitor to enter birthday in and then submits to registerCoppaTwo
+ *
+ * @access private
+ * @return void
+ */
+ private function registerCoppaStart()
+ {
+ $this->lang->words['coppa_form_text'] = str_replace( "<#FORM_LINK#>", "{$this->lang->words['coppa_link_form']} ", $this->lang->words['coppa_form_text']);
+
+ $this->output .= $this->registry->output->getTemplate('register')->registerCoppaStart();
+
+ $this->registry->output->setTitle( $this->lang->words['coppa_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
+ $this->registry->output->addNavigation( $this->lang->words['coppa_title'], '' );
+ }
+
+ /**
+ * Validation completion. This is the action hit when a user clicks a validation link from their email for
+ * lost password, email change and new registration.
+ *
+ * @access private
+ * @return void
+ */
+ private function _autoValidate()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $in_user_id = intval(trim(urldecode($this->request['uid'])));
+ $in_validate_key = substr( IPSText::alphanumericalClean( urldecode( $this->request['aid'] ) ), 0, 32 );
+ $in_type = trim($this->request['type']);
+ $in_type = $in_type ? $in_type : 'reg';
+
+ //-----------------------------------------
+ // Attempt to get the profile of the requesting user
+ //-----------------------------------------
+
+ $member = IPSMember::load( $in_user_id, 'members' );
+
+ if ( ! $member['member_id'] )
+ {
+ $this->_showManualForm( $in_type, 'reg_error_validate' );
+ return;
+ }
+
+ //-----------------------------------------
+ // Get validating info..
+ //-----------------------------------------
+
+ if ( $in_type == 'lostpass' )
+ {
+ $validate = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'validating', 'where' => 'member_id=' . $in_user_id . " AND lost_pass=1" ) );
+ }
+ else if ( $in_type == 'newemail' )
+ {
+ $validate = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'validating', 'where' => 'member_id=' . $in_user_id . " AND email_chg=1" ) );
+ }
+ else
+ {
+ $validate = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'validating', 'where' => 'member_id=' . $in_user_id ) );
+ }
+
+ //-----------------------------------------
+ // Checks...
+ //-----------------------------------------
+
+ if ( ! $validate['member_id'] )
+ {
+ $this->registry->output->showError( 'no_validate_key', 10120 );
+ }
+
+ //-----------------------------------------
+ // Changed to check if this is an admin flagged
+ // account for a spam user too
+ //-----------------------------------------
+
+ if ( ( $validate['new_reg'] == 1 ) && (($this->settings['reg_auth_type'] == "admin" ) || $validate['spam_user']) )
+ {
+ $this->registry->output->showError( 'validate_admin_turn', 10121 );
+ }
+
+ if ( $validate['vid'] != $in_validate_key )
+ {
+ $this->registry->output->showError( 'validation_key_invalid', 10122 );
+ }
+
+ //-----------------------------------------
+ // Captcha (from posted form, not GET)
+ //-----------------------------------------
+
+ if ( $this->settings['use_captcha'] AND $this->request['uid'] )
+ {
+ if ( $this->registry->getClass('class_captcha')->validate( $this->request['captcha_unique_id'], $this->request['captcha_input'] ) !== TRUE )
+ {
+ $this->_showManualForm( $in_type, 'reg_error_anti_spam' );
+ return;
+ }
+ }
+ //-----------------------------------------
+ // REGISTER VALIDATE
+ //-----------------------------------------
+
+ if ( $validate['new_reg'] == 1 )
+ {
+ if ( ! $validate['real_group'] )
+ {
+ $validate['real_group'] = $this->settings['member_group'];
+ }
+ else if( ! array_key_exists( $validate['real_group'], $this->caches['group_cache'] ) )
+ {
+ $validate['real_group'] = $this->settings['member_group'];
+ }
+
+ //-----------------------------------------
+ // SELF-VERIFICATION...
+ // 12.14.2009 Changed from != 'admin_user' to
+ // be more inclusive (just self-verification only)
+ //-----------------------------------------
+
+ if ( $this->settings['reg_auth_type'] == 'user' )
+ {
+ IPSMember::save( $member['member_id'], array( 'members' => array( 'member_group_id' => $validate['real_group'] ) ) );
+
+ /* Reset newest member */
+ $stat_cache = $this->caches['stats'];
+
+ if( $member['members_display_name'] AND $member['member_id'] AND !$this->caches['group_cache'][ $validate['real_group'] ]['g_hide_online_list'] )
+ {
+ $stat_cache['last_mem_name'] = $member['members_display_name'];
+ $stat_cache['last_mem_name_seo'] = IPSText::makeSeoTitle( $member['members_display_name'] );
+ $stat_cache['last_mem_id'] = $member['member_id'];
+ }
+
+ $stat_cache['mem_count'] += 1;
+
+ $this->cache->setCache( 'stats', $stat_cache, array( 'array' => 1 ) );
+
+ //-----------------------------------------
+ // Remove "dead" validation
+ //-----------------------------------------
+
+ $this->DB->delete( 'validating', "vid='" . $validate['vid'] . "'" );
+
+ $this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=core&module=global§ion=login&do=autologin&fromreg=1' );
+ }
+
+ //-----------------------------------------
+ // ADMIN-VERIFICATION...
+ //-----------------------------------------
+
+ else
+ {
+ //-----------------------------------------
+ // Update DB row...
+ //-----------------------------------------
+
+ $this->DB->update( 'validating', array( 'user_verified' => 1 ), 'vid=\'' . $validate['vid'] . '\'' );
+
+ //-----------------------------------------
+ // Print message
+ //-----------------------------------------
+
+ $this->registry->output->setTitle( $this->lang->words['validation_complete'] . ' - ' . ipsRegistry::$settings['board_name'] );
+
+ $this->output = $this->registry->getClass('output')->getTemplate('register')->showPreview( $member );
+ }
+ }
+
+ //-----------------------------------------
+ // LOST PASS VALIDATE
+ //-----------------------------------------
+
+ else if ( $validate['lost_pass'] == 1 )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $save_array = array();
+
+ //-----------------------------------------
+ // Generate a new random password
+ //-----------------------------------------
+
+ $new_pass = IPSLib::makePassword();
+
+ //-----------------------------------------
+ // Generate a new salt
+ //-----------------------------------------
+
+ $salt = IPSMember::generatePasswordSalt(5);
+ $salt = str_replace( '\\', "\\\\", $salt );
+
+ //-----------------------------------------
+ // New log in key
+ //-----------------------------------------
+
+ $key = IPSMember::generateAutoLoginKey();
+
+ //-----------------------------------------
+ // Update...
+ //-----------------------------------------
+
+ $save_array['members_pass_salt'] = $salt;
+ $save_array['members_pass_hash'] = md5( md5($salt) . md5( $new_pass ) );
+ $save_array['member_login_key'] = $key;
+ $save_array['member_login_key_expire'] = $this->settings['login_key_expire'] * 60 * 60 * 24;
+
+ //-----------------------------------------
+ // Load handler...
+ //-----------------------------------------
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $this->han_login = new $classToLoad( $this->registry );
+ $this->han_login->init();
+ $this->han_login->changePass( $member['email'], md5( $new_pass ), $new_pass, $member );
+
+ if ( $this->han_login->return_code != 'METHOD_NOT_DEFINED' AND $this->han_login->return_code != 'SUCCESS' )
+ {
+ $this->registry->output->showError( 'lostpass_external_fail', 2015, true );
+ }
+
+ IPSMember::save( $member['member_id'], array( 'members' => $save_array ) );
+
+ //-----------------------------------------
+ // Send out the email...
+ //-----------------------------------------
+
+ IPSText::getTextClass('email')->getTemplate("lost_pass_email_pass");
+
+ IPSText::getTextClass('email')->buildMessage( array(
+ 'NAME' => $member['members_display_name'],
+ 'THE_LINK' => $this->settings['base_url'] . 'app=core&module=usercp&tab=core&area=password',
+ 'PASSWORD' => $new_pass,
+ 'LOGIN' => $this->settings['base_url'] . 'app=core&module=global§ion=login',
+ 'USERNAME' => $member['name'],
+ 'EMAIL' => $member['email'],
+ 'ID' => $member['member_id'],
+ )
+ );
+
+ IPSText::getTextClass('email')->subject = $this->lang->words['lp_random_pass_subject'] . ' ' . $this->settings['board_name'];
+ IPSText::getTextClass('email')->to = $member['email'];
+
+ IPSText::getTextClass('email')->sendMail();
+
+ $this->registry->output->setTitle( $this->lang->words['validation_complete'] . ' - ' . ipsRegistry::$settings['board_name'] );
+
+ //-----------------------------------------
+ // Remove "dead" validation
+ //-----------------------------------------
+
+ $this->DB->delete( 'validating', "vid='" . $validate['vid'] . "' OR (member_id={$member['member_id']} AND lost_pass=1)" );
+
+ $this->output = $this->registry->getClass('output')->getTemplate('register')->showLostPassWaitRandom( $member );
+ }
+
+ //-----------------------------------------
+ // EMAIL ADDY CHANGE
+ //-----------------------------------------
+
+ else if ( $validate['email_chg'] == 1 )
+ {
+ if ( !$validate['real_group'] )
+ {
+ $validate['real_group'] = $this->settings['member_group'];
+ }
+ else if( !array_key_exists( $validate['real_group'], $this->caches['group_cache'] ) )
+ {
+ $validate['real_group'] = $this->settings['member_group'];
+ }
+
+ IPSMember::save( $member['member_id'], array( 'members' => array( 'member_group_id' => intval($validate['real_group']) ) ) );
+
+ IPSCookie::set( "member_id", $member['member_id'] , 1 );
+ IPSCookie::set( "pass_hash", $member['member_login_key'], 1 );
+
+ //-----------------------------------------
+ // Remove "dead" validation
+ //-----------------------------------------
+
+ $this->DB->delete( 'validating', "vid='" . $validate['vid'] . "' OR (member_id={$member['member_id']} AND email_chg=1)" );
+
+ $this->registry->output->silentRedirect( $this->settings['base_url'].'&app=core&module=global§ion=login&do=autologin&fromemail=1' );
+ }
+ }
+
+ /**
+ * Displays the registration form
+ *
+ * @access public
+ * @param array $form_errors
+ * @return void
+ */
+ public function registerForm( $form_errors=array() )
+ {
+ /* INIT */
+ $final_errors = array();
+
+ if( $this->settings['no_reg'] > 0 )
+ {
+ $this->registry->output->showError( 'registration_disabled', 10123, FALSE, '', 200 );
+ }
+
+ $coppa = IPSCookie::get( 'coppa' );
+
+ if( $coppa == 'yes' )
+ {
+ $this->registry->output->showError( 'awaiting_coppa', 10124 );
+ }
+
+ $this->settings[ 'username_errormsg'] = str_replace( '{chars}', $this->settings['username_characters'], $this->settings['username_errormsg'] );
+
+ /* Read T&Cs yet? */
+ if( ! $this->request['termsread'] )
+ {
+ if( $this->memberData['member_id'] )
+ {
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $this->han_login = new $classToLoad( $this->registry );
+ $this->han_login->init();
+
+ //-----------------------------------------
+ // Set some cookies
+ //-----------------------------------------
+
+ IPSCookie::set( "member_id" , "0" );
+ IPSCookie::set( "pass_hash" , "0" );
+ IPSCookie::set( "anonlogin" , "-1" );
+
+ if ( is_array($_COOKIE) )
+ {
+ foreach( $_COOKIE as $cookie => $value)
+ {
+ if ( stripos( $cookie, $this->settings['cookie_id']."ipbforum" ) !== false )
+ {
+ IPSCookie::set( str_replace( $this->settings['cookie_id'], "", $cookie ) , '-', -1 );
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Logout callbacks...
+ //-----------------------------------------
+
+ $this->han_login->logoutCallback();
+
+ //-----------------------------------------
+ // Do it..
+ //-----------------------------------------
+
+ $this->member->sessionClass()->convertMemberToGuest();
+
+ list( $privacy, $loggedin ) = explode( '&', $this->memberData['login_anonymous'] );
+
+ IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'login_anonymous' => "{$privacy}&0",
+ 'last_activity' => time() ) ) );
+ }
+
+ /* Continue */
+ $cache = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => "conf_key='reg_rules'" ) );
+
+ $text = $cache['conf_value'] ? $cache['conf_value'] : $cache['conf_default'];
+
+ /* Load the Parser */
+ IPSText::getTextClass( 'bbcode' )->bypass_badwords = 1;
+ IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
+ IPSText::getTextClass( 'bbcode' )->parse_html = 1;
+ IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
+ IPSText::getTextClass( 'bbcode' )->parsing_section = 'global';
+
+ $text = IPSText::getTextClass('bbcode')->preDbParse( $text );
+ $text = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $text );
+
+ $this->registry->output->setTitle( $this->lang->words['registration_form'] . ' - ' . ipsRegistry::$settings['board_name'] );
+ $this->registry->output->addNavigation( $this->lang->words['registration_form'], '' );
+
+ $this->output .= $this->registry->output->getTemplate('register')->registerShowTerms( $text, $coppa );
+ return;
+ }
+ else
+ {
+ /* Did we agree to the t&c? */
+ if( ! $this->request['agree_to_terms'] )
+ {
+ $this->registry->output->showError( 'must_agree_to_terms', 10125 );
+ }
+ }
+
+ /* Do we have another URL that one needs to visit to register? */
+ $this->DB->build( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ if( $r['login_register_url'] )
+ {
+ $this->registry->output->silentRedirect( $r['login_register_url'] );
+ exit();
+ }
+ }
+
+ /* Continue... */
+ if( $this->settings['reg_auth_type'] )
+ {
+ if( $this->settings['reg_auth_type'] == 'admin_user' OR $this->settings['reg_auth_type'] == 'user' )
+ {
+ $this->lang->words['std_text'] .= " " . $this->lang->words['email_validate_text'];
+ }
+
+ /* User then admin? */
+ if( $this->settings['reg_auth_type'] == 'admin_user' )
+ {
+ $this->lang->words['std_text'] .= " " . $this->lang->words['user_admin_validation'];
+ }
+
+ if( $this->settings['reg_auth_type'] == 'admin' )
+ {
+ $this->lang->words['std_text'] .= " " . $this->lang->words['just_admin_validation'];
+ }
+ }
+
+ $captchaHTML = '';
+ $qandaHTML = '';
+ $this->cache->updateCacheWithoutSaving('_hasStep3', 0);
+
+ /* Q and A Challenge */
+ if( $this->settings['registration_qanda'] )
+ {
+ // Grab a random question...
+ $question = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'question_and_answer', 'order' => $this->DB->buildRandomOrder(), 'limit' => array(1) ) );
+
+ if( count($question) )
+ {
+ $qandaHTML = $this->registry->output->getTemplate('global_other')->questionAndAnswer( $question );
+ }
+ }
+
+ /* Custom Profile Fields */
+ $custom_fields_out = array( 'required', 'optional' );
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields' );
+ $custom_fields = new $classToLoad();
+
+ $custom_fields->member_data = $this->memberData;
+ $custom_fields->initData( 'edit' );
+ $custom_fields->parseToEdit( 'register' );
+
+ if ( count( $custom_fields->out_fields ) )
+ {
+ $this->cache->updateCacheWithoutSaving('_hasStep3', 1);
+
+ foreach( $custom_fields->out_fields as $id => $form_element )
+ {
+ if ( $custom_fields->cache_data[ $id ]['pf_not_null'] == 1 )
+ {
+ $ftype = 'required';
+ }
+ else
+ {
+ $ftype = 'optional';
+ }
+
+ $custom_fields_out[$ftype][] = array(
+ 'name' => $custom_fields->field_names[ $id ],
+ 'desc' => $custom_fields->field_desc[ $id ],
+ 'field' => $form_element,
+ 'id' => $id,
+ 'error' => '',
+ 'type' => $custom_fields->cache_data[ $id ]['pf_type']
+ );
+ }
+ }
+
+ /* CAPTCHA */
+ if( $this->settings['bot_antispam_type'] != 'none' )
+ {
+ $captchaHTML = $this->registry->getClass('class_captcha')->getTemplate();
+ }
+
+ $this->registry->output->setTitle( $this->lang->words['registration_form'] . ' - ' . ipsRegistry::$settings['board_name'] );
+ $this->registry->output->addNavigation( $this->lang->words['registration_form'], '' );
+
+ /* Other errors */
+ $final_errors = array( 'username' => NULL, 'dname' => NULL, 'password' => NULL, 'email' => NULL );
+
+ foreach( array( 'username', 'dname', 'password', 'email' ) as $thing )
+ {
+ if ( isset($form_errors[ $thing ]) AND is_array( $form_errors[ $thing ] ) AND count( $form_errors[ $thing ] ) )
+ {
+ $final_errors[ $thing ] = implode( " ", $form_errors[ $thing ] );
+ }
+ }
+
+ $this->request['UserName'] = $this->request['UserName'] ? $this->request['UserName'] : '' ;
+ $this->request['PassWord'] = $this->request['PassWord'] ? $this->request['PassWord'] : '' ;
+ $this->request['EmailAddress'] = $this->request['EmailAddress'] ? $this->request['EmailAddress'] : '' ;
+ $this->request['EmailAddress_two'] = $this->request['EmailAddress_two'] ? $this->request['EmailAddress_two'] : '' ;
+ $this->request['PassWord_Check'] = $this->request['PassWord_Check'] ? $this->request['PassWord_Check'] : '' ;
+ $this->request['members_display_name'] = $this->request['members_display_name'] ? $this->request['members_display_name'] : '' ;
+ $this->request['time_offset'] = $this->request['time_offset'] ? $this->request['time_offset'] : '' ;
+ $this->request['allow_member_mail'] = $this->request['allow_member_mail'] ? $this->request['allow_member_mail'] : '' ;
+ $this->request['dst'] = $this->request['dst'] ? $this->request['dst'] : '' ;
+
+ /* Time zone... */
+ $this->registry->class_localization->loadLanguageFile( array( 'public_usercp' ), 'core' );
+
+ $time_select = array();
+
+ foreach( $this->lang->words as $k => $v )
+ {
+ if( strpos( $k, "time_" ) === 0 )
+ {
+ $k = str_replace( "time_", '', $k );
+
+ if( preg_match( '/^[\-\d\.]+$/', $k ) )
+ {
+ $time_select[ $k ] = $v;
+ }
+ }
+ }
+
+ ksort( $time_select );
+
+ /* set default.. */
+ $this->request['time_offset'] = ( $this->request['time_offset'] ) ? $this->request['time_offset'] : $this->settings['time_offset'];
+
+ /* Need username? */
+ $uses_name = false;
+
+ foreach( $this->cache->getCache('login_methods') as $method )
+ {
+ if( $method['login_user_id'] == 'username' )
+ {
+ $uses_name = true;
+ }
+ }
+
+ /* Get form HTML */
+ $this->output .= $this->registry->output->getTemplate('register')->registerForm(
+ $form_errors['general'],
+ array(
+ 'TEXT' => $this->lang->words['std_text'],
+ 'coppa_user' => $coppa,
+ 'captchaHTML' => $captchaHTML,
+ 'qandaHTML' => $qandaHTML,
+ 'requireName' => $uses_name,
+ ),
+ $final_errors,
+ $time_select,
+ $custom_fields_out );
+
+ /* Run the member sync module */
+ IPSLib::runMemberSync( 'onRegisterForm' );
+ }
+
+ /**
+ * Processes the registration form
+ *
+ * @access public
+ * @return void
+ */
+ public function registerProcessForm()
+ {
+ if( $this->memberData['member_id'] )
+ {
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $this->han_login = new $classToLoad( $this->registry );
+ $this->han_login->init();
+
+ //-----------------------------------------
+ // Set some cookies
+ //-----------------------------------------
+
+ IPSCookie::set( "member_id" , "0" );
+ IPSCookie::set( "pass_hash" , "0" );
+ IPSCookie::set( "anonlogin" , "-1" );
+
+ if ( is_array($_COOKIE) )
+ {
+ foreach( $_COOKIE as $cookie => $value)
+ {
+ if ( stripos( $cookie, $this->settings['cookie_id']."ipbforum" ) !== false )
+ {
+ IPSCookie::set( str_replace( $this->settings['cookie_id'], "", $cookie ) , '-', -1 );
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Logout callbacks...
+ //-----------------------------------------
+
+ $this->han_login->logoutCallback();
+
+ //-----------------------------------------
+ // Do it..
+ //-----------------------------------------
+
+ $this->member->sessionClass()->convertMemberToGuest();
+
+ list( $privacy, $loggedin ) = explode( '&', $this->memberData['login_anonymous'] );
+
+ IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'login_anonymous' => "{$privacy}&0",
+ 'last_activity' => time() ) ) );
+ }
+
+ $form_errors = array();
+ $coppa = ( $this->request['coppa_user'] == 1 ) ? 1 : 0;
+ $in_password = trim( $this->request['PassWord'] );
+ $in_email = mb_strtolower( trim( $this->request['EmailAddress'] ) );
+ $_SFS_FOUND = FALSE;
+
+ /* Check */
+ if( $this->settings['no_reg'] > 0 )
+ {
+ $this->registry->output->showError( 'registration_disabled', 2016, true );
+ }
+
+ /* Custom profile field stuff */
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields' );
+ $custom_fields = new $classToLoad();
+
+ $custom_fields->initData( 'edit' );
+ $custom_fields->parseToSave( $this->request, 'register' );
+
+ /* Check */
+ if( $custom_fields->error_messages )
+ {
+ $form_errors['general'] = $custom_fields->error_messages;
+ }
+
+ /* Check the email address */
+ if ( ! $in_email OR strlen( $in_email ) < 6 OR !IPSText::checkEmailAddress( $in_email ) )
+ {
+ $form_errors['email'][$this->lang->words['err_invalid_email']] = $this->lang->words['err_invalid_email'];
+ }
+
+ if( trim($this->request['PassWord_Check']) != $in_password OR !$in_password )
+ {
+ $form_errors['password'][$this->lang->words['passwords_not_match']] = $this->lang->words['passwords_not_match'];
+ }
+
+ /* Test email address */
+ $this->request['EmailAddress_two'] = mb_strtolower( trim( $this->request['EmailAddress_two'] ) );
+ $this->request['EmailAddress'] = mb_strtolower( trim( $this->request['EmailAddress'] ) );
+
+ if( !IPSText::checkEmailAddress( $this->request['EmailAddress_two'] ) )
+ {
+ $form_errors['email'][$this->lang->words['reg_error_email_invalid']] = $this->lang->words['reg_error_email_invalid'];
+ }
+ else
+ {
+ if ( $in_email AND $this->request['EmailAddress_two'] != $in_email )
+ {
+ $form_errors['email'][$this->lang->words['reg_error_email_nm']] = $this->lang->words['reg_error_email_nm'];
+ }
+ }
+
+ /* Need username? */
+ $uses_name = false;
+
+ foreach( $this->cache->getCache('login_methods') as $method )
+ {
+ if( $method['login_user_id'] == 'username' )
+ {
+ $uses_name = true;
+ }
+ }
+
+ if( !$uses_name )
+ {
+ $_REQUEST['UserName'] = $_REQUEST['members_display_name'];
+ $this->request['UserName'] = $this->request['members_display_name'];
+ }
+
+ /* Set the display name, if empty */
+ $this->request['members_display_name'] = $this->request['members_display_name'] ? $this->request['members_display_name'] : $this->request['UserName'];
+
+ /* Check the username */
+ $user_check = IPSMember::getFunction()->cleanAndCheckName( $this->request['UserName'], array(), 'name' );
+ $disp_check = IPSMember::getFunction()->cleanAndCheckName( $this->request['members_display_name'], array(), 'members_display_name' );
+
+ if( is_array( $user_check['errors'] ) && count( $user_check['errors'] ) )
+ {
+ foreach( $user_check['errors'] as $key => $error )
+ {
+ $form_errors[ $key ][] = isset($this->lang->words[ $error ]) ? $this->lang->words[ $error ] : $error;
+ }
+ }
+
+ if( is_array( $disp_check['errors'] ) && count( $disp_check['errors'] ) )
+ {
+ foreach( $disp_check['errors'] as $key => $error )
+ {
+ if( !$this->settings['auth_allow_dnames'] AND !( is_array( $user_check['errors'] ) && count( $user_check['errors'] ) ) )
+ {
+ $key = 'username';
+ }
+
+ $form_errors[ $key ][] = isset($this->lang->words[ $error ]) ? $this->lang->words[ $error ] : $error;
+ }
+ }
+
+ /* CHECK 1: Any errors (missing fields, etc)? */
+ if( count( $form_errors ) )
+ {
+ $this->registerForm( $form_errors );
+ return;
+ }
+
+ /* Is this email addy taken? */
+ if( IPSMember::checkByEmail( $in_email ) == TRUE )
+ {
+ $form_errors['email'][$this->lang->words['reg_error_email_taken']] = $this->lang->words['reg_error_email_taken'];
+ }
+
+ /* Load handler... */
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login' );
+ $this->han_login = new $classToLoad( $this->registry );
+ $this->han_login->init();
+ $this->han_login->emailExistsCheck( $in_email );
+
+ if( $this->han_login->return_code AND $this->han_login->return_code != 'METHOD_NOT_DEFINED' AND $this->han_login->return_code != 'EMAIL_NOT_IN_USE' )
+ {
+ $form_errors['email'][$this->lang->words['reg_error_email_taken']] = $this->lang->words['reg_error_email_taken'];
+ }
+
+ /* Are they banned [EMAIL]? */
+ if ( IPSMember::isBanned( 'email', $in_email ) === TRUE )
+ {
+ $form_errors['email'][$this->lang->words['reg_error_email_ban']] = $this->lang->words['reg_error_email_ban'];
+ }
+
+ /* Check the CAPTCHA */
+ if ( $this->settings['bot_antispam_type'] != 'none' )
+ {
+ if ( $this->registry->getClass('class_captcha')->validate() !== TRUE )
+ {
+ $form_errors['general'][$this->lang->words['err_reg_code']] = $this->lang->words['err_reg_code'];
+ }
+ }
+
+ /* Check the Q and A */
+ if( $this->settings['registration_qanda'] )
+ {
+ $qanda = intval($this->request['qanda_id']);
+ $pass = false;
+
+ if( $qanda )
+ {
+ $data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'question_and_answer', 'where' => 'qa_id=' . $qanda ) );
+
+ if( $data['qa_id'] )
+ {
+ $answers = explode( "\n", str_replace( "\r", "", $data['qa_answers'] ) );
+
+ if( count($answers) )
+ {
+ foreach( $answers as $answer )
+ {
+ if( mb_strtolower($answer) == mb_strtolower($this->request['qa_answer']) )
+ {
+ $pass = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ //-----------------------------------------
+ // Do we have any questions?
+ //-----------------------------------------
+
+ $data = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as questions', 'from' => 'question_and_answer' ) );
+
+ if( !$data['questions'] )
+ {
+ $pass = true;
+ }
+ }
+
+ if( !$pass )
+ {
+ $form_errors['general'][$this->lang->words['err_q_and_a']] = $this->lang->words['err_q_and_a'];
+ }
+ }
+
+ /* CHECK 2: Any errors ? */
+ if ( count( $form_errors ) )
+ {
+ $this->registerForm( $form_errors );
+ return;
+ }
+
+ /* Build up the hashes */
+ $mem_group = $this->settings['member_group'];
+
+ /* Are we asking the member or admin to preview? */
+ if( $this->settings['reg_auth_type'] )
+ {
+ $mem_group = $this->settings['auth_group'];
+ }
+ else if ($coppa == 1)
+ {
+ $mem_group = $this->settings['auth_group'];
+ }
+
+ /* Create member */
+ $member = array(
+ 'name' => $this->request['UserName'],
+ 'password' => $in_password,
+ 'members_display_name' => $this->settings['auth_allow_dnames'] ? $this->request['members_display_name'] : $this->request['UserName'],
+ 'email' => $in_email,
+ 'member_group_id' => $mem_group,
+ 'joined' => time(),
+ 'ip_address' => $this->member->ip_address,
+ 'time_offset' => $this->request['time_offset'],
+ 'coppa_user' => $coppa,
+ 'members_auto_dst' => intval($this->request['dst']),
+ 'allow_admin_mails' => intval( $this->request['allow_admin_mail'] ),
+ 'hide_email' => $this->request['allow_member_mail'] ? 0 : 1,
+ );
+
+ /* Spam Service */
+ $spamCode = 0;
+ $_spamFlag = 0;
+
+ //-----------------------------------------
+ // Create the account
+ //-----------------------------------------
+
+ $member = IPSMember::create( array( 'members' => $member, 'pfields_content' => $this->request ), FALSE, FALSE, FALSE );
+
+ //-----------------------------------------
+ // Login handler create account callback
+ //-----------------------------------------
+
+ $this->han_login->createAccount( array( 'email' => $member['email'],
+ 'joined' => $member['joined'],
+ 'password' => $in_password,
+ 'ip_address' => $this->member->ip_address,
+ 'username' => $member['members_display_name'],
+ ) );
+
+ //-----------------------------------------
+ // We'll just ignore if this fails - it shouldn't hold up IPB anyways
+ //-----------------------------------------
+
+ /*if ( $han_login->return_code AND ( $han_login->return_code != 'METHOD_NOT_DEFINED' AND $han_login->return_code != 'SUCCESS' ) )
+ {
+ $this->registry->output->showError( 'han_login_create_failed', 2017, true );
+ }*/
+
+ //-----------------------------------------
+ // Validation
+ //-----------------------------------------
+
+ $validate_key = md5( IPSLib::makePassword() . time() );
+ $time = time();
+
+ if( $coppa != 1 )
+ {
+ if( ( $this->settings['reg_auth_type'] == 'user' ) or ( $this->settings['reg_auth_type'] == 'admin' ) or ( $this->settings['reg_auth_type'] == 'admin_user' ) )
+ {
+ //-----------------------------------------
+ // We want to validate all reg's via email,
+ // after email verificiation has taken place,
+ // we restore their previous group and remove the validate_key
+ //-----------------------------------------
+
+ $this->DB->insert( 'validating', array(
+ 'vid' => $validate_key,
+ 'member_id' => $member['member_id'],
+ 'real_group' => /*$this->settings['subsm_enforce'] ? $this->settings['subsm_nopkg_group'] :*/ $this->settings['member_group'],
+ 'temp_group' => $this->settings['auth_group'],
+ 'entry_date' => $time,
+ 'coppa_user' => $coppa,
+ 'new_reg' => 1,
+ 'ip_address' => $member['ip_address'],
+ 'spam_flag' => $_spamFlag,
+ ) );
+
+ if( $this->settings['reg_auth_type'] == 'user' OR $this->settings['reg_auth_type'] == 'admin_user' )
+ {
+ IPSText::getTextClass('email')->getTemplate("reg_validate");
+
+ IPSText::getTextClass('email')->buildMessage( array(
+ 'THE_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=register&do=auto_validate&uid=" . urlencode( $member['member_id'] ) . "&aid=" . urlencode( $validate_key ),
+ 'NAME' => $member['members_display_name'],
+ 'MAN_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=register&do=05",
+ 'EMAIL' => $member['email'],
+ 'ID' => $member['member_id'],
+ 'CODE' => $validate_key,
+ ) );
+
+ IPSText::getTextClass('email')->subject = $this->lang->words['new_registration_email'] . $this->settings['board_name'];
+ IPSText::getTextClass('email')->to = $member['email'];
+
+ IPSText::getTextClass('email')->sendMail();
+
+ $this->output = $this->registry->output->getTemplate('register')->showAuthorize( $member );
+
+ }
+ else if( $this->settings['reg_auth_type'] == 'admin' )
+ {
+ $this->output = $this->registry->output->getTemplate('register')->showPreview( $member );
+ }
+
+ if( $this->settings['new_reg_notify'] )
+ {
+ $date = $this->registry->class_localization->getDate( time(), 'LONG', 1 );
+
+ IPSText::getTextClass('email')->getTemplate( 'admin_newuser' );
+
+ IPSText::getTextClass('email')->buildMessage( array( 'DATE' => $date,
+ 'LOG_IN_NAME' => $member['name'],
+ 'EMAIL' => $member['email'],
+ 'IP' => $member['ip_address'],
+ 'DISPLAY_NAME' => $member['members_display_name'] ) );
+
+ IPSText::getTextClass('email')->subject = $this->lang->words['new_registration_email1'] . $this->settings['board_name'];
+ IPSText::getTextClass('email')->to = $this->settings['email_in'];
+ IPSText::getTextClass('email')->sendMail();
+ }
+
+ $this->registry->output->setTitle( $this->lang->words['reg_success'] . ' - ' . ipsRegistry::$settings['board_name'] );
+ $this->registry->output->addNavigation( $this->lang->words['nav_reg'], '' );
+ }
+ else
+ {
+ /* We don't want to preview, or get them to validate via email. */
+ $stat_cache = $this->caches['stats'];
+
+ if( $member['members_display_name'] AND $member['member_id'] AND !$this->caches['group_cache'][ $member['member_group_id'] ]['g_hide_online_list'] )
+ {
+ $stat_cache['last_mem_name'] = $member['members_display_name'];
+ $stat_cache['last_mem_name_seo'] = IPSText::makeSeoTitle( $member['members_display_name'] );
+ $stat_cache['last_mem_id'] = $member['member_id'];
+ }
+
+ $stat_cache['mem_count'] += 1;
+
+ $this->cache->setCache( 'stats', $stat_cache, array( 'array' => 1 ) );
+
+ if( $this->settings['new_reg_notify'] )
+ {
+ $date = $this->registry->class_localization->getDate( time(), 'LONG', 1 );
+
+ IPSText::getTextClass('email')->getTemplate( 'admin_newuser' );
+
+ IPSText::getTextClass('email')->buildMessage( array( 'DATE' => $date,
+ 'LOG_IN_NAME' => $member['name'],
+ 'EMAIL' => $member['email'],
+ 'IP' => $member['ip_address'],
+ 'DISPLAY_NAME' => $member['members_display_name'] ) );
+
+ IPSText::getTextClass('email')->subject = $this->lang->words['new_registration_email1'] . $this->settings['board_name'];
+ IPSText::getTextClass('email')->to = $this->settings['email_in'];
+ IPSText::getTextClass('email')->sendMail();
+ }
+
+ IPSCookie::set( 'pass_hash' , $member['member_login_key'], 1);
+ IPSCookie::set( 'member_id' , $member['member_id'] , 1);
+
+ //-----------------------------------------
+ // Fix up session
+ //-----------------------------------------
+
+ $privacy = $this->request['Privacy'] ? 1 : 0;
+
+ if( $member['g_hide_online_list'] )
+ {
+ $privacy = 1;
+ }
+
+ $this->member->sessionClass()->convertGuestToMember( array( 'member_name' => $member['members_display_name'],
+ 'member_id' => $member['member_id'],
+ 'member_group' => $member['member_group_id'],
+ 'login_type' => $privacy ) );
+
+ $this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=core&module=global§ion=login&do=autologin&fromreg=1');
+ }
+ }
+ else
+ {
+ /* This is a COPPA user, so lets tell them they registered OK and redirect to the form. */
+ $this->DB->insert( 'validating', array (
+ 'vid' => $validate_key,
+ 'member_id' => $member['member_id'],
+ 'real_group' => $this->settings['member_group'],
+ 'temp_group' => $this->settings['auth_group'],
+ 'entry_date' => $time,
+ 'coppa_user' => $coppa,
+ 'new_reg' => 1,
+ 'ip_address' => $member['ip_address']
+ ) );
+
+ $this->registry->output->redirectScreen( $this->lang->words['cp_success'], $this->settings['base_url'] . 'app=core&module=global§ion=register&do=12' );
+ }
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/global/reputation.php b/upload/admin/applications/core/modules_public/global/reputation.php
index d19d8c34..3ce09fde 100644
--- a/upload/admin/applications/core/modules_public/global/reputation.php
+++ b/upload/admin/applications/core/modules_public/global/reputation.php
@@ -1,101 +1,103 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class public_core_global_reputation extends ipsCommand
-{
- /**
- * Class entry point
- *
- * @access public
- * @param object Registry reference
- * @return void [Outputs to screen/redirects]
- */
- public function doExecute( ipsRegistry $registry )
- {
- /* What to do... */
- switch( $this->request['do'] )
- {
- case 'add_rating':
- $this->doRating();
- break;
- }
- }
-
- /**
- * Adds a rating to the index
- *
- * @access public
- * @return void
- */
- public function doRating()
- {
- /* INIT */
- $app = $this->request['app_rate'];
- $type = $this->request['type'];
- $type_id = intval( $this->request['type_id'] );
- $rating = intval( $this->request['rating'] );
-
- /* Check */
- if( ! $app || ! $type || ! $type_id || ! $rating )
- {
- $this->registry->output->showError( 'reputation_missing_data', 10126 );
- }
-
- /* Check the secure key. Needed here to prevent direct URLs from increasing reps */
- if ( $this->request['secure_key'] != $this->member->form_hash )
- {
- $this->registry->output->showError( 'reputation_missing_data', 10126 );
- }
-
- /* Get the rep library */
- require_once( IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php' );
- $repCache = new classReputationCache();
-
- /* Add the rating */
- if( ! $repCache->addRate( $type, $type_id, $rating, '', 0, $app ) )
- {
- $this->registry->output->showError( $repCache->error_message, 10127 );
- }
- else
- {
- /* Redirect to */
- $return_url = '';
-
- if( isset( $this->request['post_return'] ) && $this->request['post_return'] )
- {
- $return_url = $this->settings['base_url'] . 'app=forums&module=forums§ion=findpost&pid=' . intval( $this->request['post_return'] );
- }
- else if( $_SERVER['HTTP_REFERER'] )
- {
- $return_url = $_SERVER['HTTP_REFERER'];
- }
- else
- {
- $return_url = $this->settings['base_url'];
- }
-
- /* Probably Temporary :) */
- $this->registry->output->silentRedirect( $return_url );
- }
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Reputation
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
+ *
+ * @author $Author $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 5713 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_global_reputation extends ipsCommand
+{
+ /**
+ * Class entry point
+ *
+ * @access public
+ * @param object Registry reference
+ * @return void [Outputs to screen/redirects]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* What to do... */
+ switch( $this->request['do'] )
+ {
+ case 'add_rating':
+ $this->doRating();
+ break;
+ }
+ }
+
+ /**
+ * Adds a rating to the index
+ *
+ * @access public
+ * @return void
+ */
+ public function doRating()
+ {
+ /* INIT */
+ $app = $this->request['app_rate'];
+ $type = $this->request['type'];
+ $type_id = intval( $this->request['type_id'] );
+ $rating = intval( $this->request['rating'] );
+
+ /* Check */
+ if( ! $app || ! $type || ! $type_id || ! $rating )
+ {
+ $this->registry->output->showError( 'reputation_missing_data', 10126 );
+ }
+
+ /* Check the secure key. Needed here to prevent direct URLs from increasing reps */
+ if ( $this->request['secure_key'] != $this->member->form_hash )
+ {
+ $this->registry->output->showError( 'reputation_missing_data', 10126 );
+ }
+
+ /* Get the rep library */
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php', 'classReputationCache' );
+ $repCache = new $classToLoad();
+
+ /* Add the rating */
+ if( ! $repCache->addRate( $type, $type_id, $rating, '', 0, $app ) )
+ {
+ $this->registry->output->showError( $repCache->error_message, 10127 );
+ }
+ else
+ {
+ /* Redirect to */
+ $return_url = '';
+
+ if( isset( $this->request['post_return'] ) && $this->request['post_return'] )
+ {
+ $return_url = $this->settings['base_url'] . 'app=forums&module=forums§ion=findpost&pid=' . intval( $this->request['post_return'] );
+ }
+ else if( $_SERVER['HTTP_REFERER'] )
+ {
+ $return_url = $_SERVER['HTTP_REFERER'];
+ }
+ else
+ {
+ $return_url = $this->settings['base_url'];
+ }
+
+ /* Probably Temporary :) */
+ $this->registry->output->silentRedirect( $return_url );
+ }
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/global/rss.php b/upload/admin/applications/core/modules_public/global/rss.php
index 634658c4..549ecc28 100644
--- a/upload/admin/applications/core/modules_public/global/rss.php
+++ b/upload/admin/applications/core/modules_public/global/rss.php
@@ -1,19 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* RSS output functionality
- * Last Updated: $Date: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 2009) $
+ * Last Updated: $Date: 2010-10-20 09:03:17 -0400 (Wed, 20 Oct 2010) $
+ *
*
- * @author $Author: bfarber $
+ * @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Friday 18th March 2005
- * @version $Revision: 3887 $
+ * @version $Revision: 7003 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -27,7 +28,6 @@ class public_core_global_rss extends ipsCommand
/**
* XML document content
*
- * @access private
* @var string XML document content
*/
private $to_print = '';
@@ -35,7 +35,6 @@ class public_core_global_rss extends ipsCommand
/**
* Class entry point
*
- * @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
@@ -56,7 +55,15 @@ class public_core_global_rss extends ipsCommand
if( $this->settings['board_offline'] )
{
- header("HTTP/1.1 503 Service Temporarily Unavailable");
+ if ( isset( $_SERVER['SERVER_PROTOCOL'] ) AND strstr( $_SERVER['SERVER_PROTOCOL'], '/1.0' ) )
+ {
+ header("HTTP/1.0 503 Service Temporarily Unavailable");
+ }
+ else
+ {
+ header("HTTP/1.1 503 Service Temporarily Unavailable");
+ }
+
print $this->lang->words['rss_board_offline'];
exit();
}
@@ -69,22 +76,46 @@ class public_core_global_rss extends ipsCommand
if( $this->request['type'] )
{
- if( file_exists( IPSLib::getAppDir( IPSText::alphanumericalClean( $this->request['type'] ) ) . '/extensions/rssOutput.php' ) )
+ if( IPSLib::appIsInstalled( IPSText::alphanumericalClean( $this->request['type'] ) ) )
{
- $type = IPSText::alphanumericalClean( $this->request['type'] );
+ if( file_exists( IPSLib::getAppDir( IPSText::alphanumericalClean( $this->request['type'] ) ) . '/extensions/rssOutput.php' ) )
+ {
+ $type = IPSText::alphanumericalClean( $this->request['type'] );
+ }
}
}
-
+
//-----------------------------------------
// And grab the content
//-----------------------------------------
- require_once( IPSLib::getAppDir( $type ) . '/extensions/rssOutput.php' );
- $classname = "rss_output_" . $type;
- $rss_library = new $classname( $this->registry );
+ if( IPSLib::appIsInstalled($type) )
+ {
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( $type ) . '/extensions/rssOutput.php', 'rss_output_'.$type, $type );
+ $rss_library = new $classToLoad( $this->registry );
+
+ $this->to_print = $rss_library->returnRSSDocument();
+ $expires = $rss_library->grabExpiryDate();
+ }
- $this->to_print = $rss_library->returnRSSDocument();
- $expires = $rss_library->grabExpiryDate();
+ //-----------------------------------------
+ // No output?
+ //-----------------------------------------
+
+ if( !$this->to_print )
+ {
+ if ( isset( $_SERVER['SERVER_PROTOCOL'] ) AND strstr( $_SERVER['SERVER_PROTOCOL'], '/1.0' ) )
+ {
+ header("HTTP/1.0 503 Service Temporarily Unavailable");
+ }
+ else
+ {
+ header("HTTP/1.1 503 Service Temporarily Unavailable");
+ }
+
+ print $this->lang->words['rssappoffline'];
+ exit();
+ }
//-----------------------------------------
// Then output
diff --git a/upload/admin/applications/core/modules_public/global/share.php b/upload/admin/applications/core/modules_public/global/share.php
new file mode 100644
index 00000000..e06ef60b
--- /dev/null
+++ b/upload/admin/applications/core/modules_public/global/share.php
@@ -0,0 +1,47 @@
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Captcha
+ * Last Updated: $Date: 2010-01-15 15:18:44 +0000 (Fri, 15 Jan 2010) $
+ *
+ *
+ * @author $Author $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 20th February 2002
+ * @version $Rev: 5713 $
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_global_share extends ipsCommand
+{
+ /**
+ * Class entry point
+ *
+ * @param object Registry reference
+ * @return void [Outputs to screen/redirects]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ $url = IPSText::base64_decode_urlSafe( $this->request['url'] );
+ $title = IPSText::base64_decode_urlSafe( $this->request['title'] );
+ $key = trim( $this->request['key'] );
+
+ /* Get the lib */
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/share/links.php', 'share_links' );
+ $share = new $classToLoad( $registry, $key );
+
+ /* Share! */
+ $share->share( $title, $url );
+ }
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/help/defaultSection.php b/upload/admin/applications/core/modules_public/help/defaultSection.php
index 9d5924a5..4a082572 100644
--- a/upload/admin/applications/core/modules_public/help/defaultSection.php
+++ b/upload/admin/applications/core/modules_public/help/defaultSection.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Define the default help section
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4948 $
+ * @version $Rev: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_public/help/help.php b/upload/admin/applications/core/modules_public/help/help.php
index 544d6079..c3ed85f3 100644
--- a/upload/admin/applications/core/modules_public/help/help.php
+++ b/upload/admin/applications/core/modules_public/help/help.php
@@ -1,18 +1,19 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Help File System
- * Last Updated: $Date: 2009-04-24 08:15:53 -0400 (Fri, 24 Apr 2009) $
+ * Last Updated: $Date: 2010-10-19 11:56:25 -0400 (Tue, 19 Oct 2010) $
+ *
*
- * @author $Author: matt $
+ * @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
- * @version $Rev: 4544 $
- *
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6997 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -26,7 +27,6 @@ class public_core_help_help extends ipsCommand
/**
* HTML to output
*
- * @access private
* @var string HTML
*/
public $output = "";
@@ -34,7 +34,6 @@ class public_core_help_help extends ipsCommand
/**
* Class entry point
*
- * @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
@@ -63,7 +62,6 @@ class public_core_help_help extends ipsCommand
/**
* Show help topics
*
- * @access public
* @return void
*/
public function helpShowTitles()
@@ -103,14 +101,13 @@ class public_core_help_help extends ipsCommand
);
/* Navigation */
- $this->registry->output->setTitle( $this->lang->words['page_title'] );
+ $this->registry->output->setTitle( $this->lang->words['page_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
$this->registry->output->addNavigation( $this->lang->words['page_title'], '' );
}
/**
* Displays a help file
*
- * @access public
* @return void
*/
public function helpShowSection()
@@ -159,14 +156,14 @@ class public_core_help_help extends ipsCommand
);
/* Navigation */
- $this->registry->output->setTitle( $this->lang->words['help_topic'] );
+ $this->registry->output->setTitle( $this->lang->words['help_topic'] . ' - ' . ipsRegistry::$settings['board_name'] );
$this->registry->output->addNavigation( $this->lang->words['help_topics'], "app=core&module=help" );
$this->registry->output->addNavigation( $this->lang->words['help_topic'], '' );
if( $this->request['xml'] == 1 )
{
- require_once( IPS_KERNEL_PATH . 'classAjax.php' );
- $classAjax = new classAjax();
+ $classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
+ $classAjax = new $classToLoad();
$classAjax->returnHtml( $this->output );
}
}
diff --git a/upload/admin/applications/core/modules_public/help/index.html b/upload/admin/applications/core/modules_public/help/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_public/help/index.html
+++ b/upload/admin/applications/core/modules_public/help/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/index.html b/upload/admin/applications/core/modules_public/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_public/index.html
+++ b/upload/admin/applications/core/modules_public/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/reports/defaultSection.php b/upload/admin/applications/core/modules_public/reports/defaultSection.php
index 8c9c549a..a9d8d636 100644
--- a/upload/admin/applications/core/modules_public/reports/defaultSection.php
+++ b/upload/admin/applications/core/modules_public/reports/defaultSection.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Define the default reports section
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4948 $
+ * @version $Rev: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_public/reports/index.html b/upload/admin/applications/core/modules_public/reports/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_public/reports/index.html
+++ b/upload/admin/applications/core/modules_public/reports/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/reports/reports.php b/upload/admin/applications/core/modules_public/reports/reports.php
index fa915de2..6baf63b5 100644
--- a/upload/admin/applications/core/modules_public/reports/reports.php
+++ b/upload/admin/applications/core/modules_public/reports/reports.php
@@ -1,1169 +1,1111 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
- exit();
-}
-
-class public_core_reports_reports extends ipsCommand
-{
- /**
- * Execute selected method
- *
- * @access public
- * @param object Registry object
- * @return void
- */
- public function doExecute( ipsRegistry $registry )
- {
- //-----------------------------------------
- // Load basic things
- //-----------------------------------------
-
- $this->registry->class_localization->loadLanguageFile( array( 'public_reports' ) );
-
- $this->DB->loadCacheFile( IPSLib::getAppDir('core') . '/sql/' . ips_DBRegistry::getDriverType() . '_report_queries.php', 'report_sql_queries' );
-
- require_once( IPSLib::getAppDir('core') .'/sources/classes/reportLibrary.php' );
- $this->registry->setClass( 'reportLibrary', new reportLibrary( $this->registry ) );
-
- //-----------------------------------------
- // Check permissions...
- //-----------------------------------------
-
- $showReportCenter = false;
-
- $this->member_group_ids = array( $this->memberData['member_group_id'] );
- $this->member_group_ids = array_diff( array_merge( $this->member_group_ids, explode( ',', $this->memberData['mgroup_others'] ) ), array('') );
- $report_center = array_diff( explode( ',', $this->settings['report_mod_group_access'] ), array('') );
-
- foreach( $report_center as $groupId )
- {
- if( in_array( $groupId, $this->member_group_ids ) )
- {
- $showReportCenter = true;
- }
- }
-
- if( ($this->request['do'] AND $this->request['do'] != 'report') AND !$showReportCenter )
- {
- $this->registry->output->showError( 'no_reports_permission', 2018, true );
- }
-
- $this->registry->output->setTitle( $this->lang->words['main_title'] );
-
- //-----------------------------------------
- // Which road are we going to take?
- //-----------------------------------------
-
- switch( $this->request['do'] )
- {
- default:
- case 'report':
- $this->_initReportForm();
- break;
-
- case 'showMessage':
- $this->_viewReportedMessage();
- break;
-
- case 'index':
- $this->_displayReportCenter();
- break;
-
- case 'process':
- $this->_processReports();
- break;
-
- case 'findfirst':
- $this->findFirstReport();
- break;
-
- case 'show_methods':
- $this->_showNotificationMethods();
- break;
- case 'save_methods':
- $this->_saveNotificationMethods();
- break;
-
- case 'show_report':
- $this->_displayReport();
- break;
-
- case 'save_comment':
- $this->_saveComment();
- break;
- }
-
- //-----------------------------------------
- // Output
- //-----------------------------------------
-
- $this->registry->getClass('output')->addContent( $this->output );
- $this->registry->output->sendOutput();
- }
-
- /**
- * View a reported private message as it shows in the messenger
- *
- * @access private
- * @return void
- */
- private function _viewReportedMessage()
- {
- //-----------------------------------------
- // Do we have permission?
- //-----------------------------------------
-
- $this->registry->getClass('reportLibrary')->buildQueryPermissions();
-
- if( !in_array( $this->memberData['member_group_id'], explode( ',', $this->registry->getClass('reportLibrary')->plugins['messages']->_extra['plugi_messages_add'] ) ) )
- {
- $this->registry->getClass('output')->showError( 'no_permission_addreport', 20115 );
- }
-
- //-----------------------------------------
- // First see if we are already in map...
- //-----------------------------------------
-
- $topicId = intval($this->request['topicID']);
-
- $mapRecord = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'message_topic_user_map', 'where' => "map_user_id={$this->memberData['member_id']} AND map_topic_id={$topicId}" ) );
-
- //-----------------------------------------
- // Doesn't exist?
- //-----------------------------------------
-
- if( !$mapRecord['map_user_id'] )
- {
- define( 'FROM_REPORT_CENTER', true );
-
- require_once( IPSLib::getAppDir( 'members' ) . '/sources/classes/messaging/messengerFunctions.php' );
- $messengerFunctions = new messengerFunctions( $this->registry );
-
- //-----------------------------------------
- // Add ourselves
- //-----------------------------------------
-
- try
- {
- $messengerFunctions->addTopicParticipants( $topicId, array( $this->memberData['members_display_name'] ), $this->memberData['member_id'] );
- }
-
- //-----------------------------------------
- // Must already be in there
- //-----------------------------------------
-
- catch( Exception $e )
- {
-
- }
- }
-
- //-----------------------------------------
- // Already a participant, make sure we're active
- //-----------------------------------------
-
- else
- {
- $update = array();
-
- if( !$mapRecord['map_user_active'] )
- {
- $update['map_user_active'] = 1;
- }
-
- if( $mapRecord['map_folder_id'] == 'finished' )
- {
- $update['map_folder_id'] = 'myconvo';
- }
-
- if( $mapRecord['map_user_banned'] )
- {
- $update['map_user_banned'] = 0;
- }
-
- if( count($update) )
- {
- $this->DB->update( 'message_topic_user_map', $update, "map_user_id={$this->memberData['member_id']} AND map_topic_id={$topicId}" );
- }
- }
-
- $this->registry->output->silentRedirect( $this->settings['base_url'] . "app=members&module=messaging§ion=view&do=showConversation&topicID=" . $topicId . "&st=" . $this->request['st'] . "#msg" . $this->request['msg'] );
- }
-
- /**
- * Main function for displaying reports in a list
- *
- * @access private
- * @return void
- */
- private function _displayReportCenter()
- {
- //-----------------------------------------
- // Check for rss key and if none make one
- //-----------------------------------------
-
- $this->registry->getClass('reportLibrary')->checkMemberRSSKey();
-
- //-----------------------------------------
- // Basic title and nav routine..
- //-----------------------------------------
-
- $this->registry->output->addNavigation( $this->lang->words['main_title'], 'app=core&module=reports&do=index' );
-
- //-----------------------------------------
- // We need some extra permisisons sql..
- //-----------------------------------------
-
- $COM_PERM = $this->registry->getClass('reportLibrary')->buildQueryPermissions();
-
- $reports = array();
-
- //-----------------------------------------
- // Show me the money! err.. Reports!
- //-----------------------------------------
-
- $total = $this->DB->buildAndFetch( array(
- 'select' => 'COUNT(*) as reports',
- 'from' => array( 'rc_reports_index' => 'rep' ),
- 'where' => $COM_PERM,
- 'add_join' => array(
- array(
- 'from' => array( 'rc_classes' => 'rcl' ),
- 'where' => 'rcl.com_id=rep.rc_class'
- )
- )
- ) );
-
-
-
- $this->DB->buildFromCache( 'reports_index', array( 'WHERE' => $COM_PERM, 'START' => intval($this->request['st']), 'LIMIT' => 10 ), 'report_sql_queries' );
- $res = $this->DB->execute();
-
- while( $row = $this->DB->fetch($res) )
- {
- $sec_data = $this->registry->getClass('reportLibrary')->plugins[$row['my_class']]->giveSectionLinkTitle( $row );
- $sec_data['url'] = $this->registry->getClass('reportLibrary')->processUrl( $sec_data['url'], $sec_data['seo_title'], $sec_data['seo_template'] );
- $row['points'] = isset( $row['points'] ) ? $row['points'] : $this->settings['_tmpPoints'][ $row['id'] ];
- $row['section'] = $sec_data;
- $row['status_icon'] = $this->_buildStatusIcon( $row );
-
- $reports[ $row['id'] ] = $row;
- }
-
- //-----------------------------------------
- // Statuses
- //-----------------------------------------
-
- $stats = array();
- $_tmp = $this->registry->getClass('reportLibrary')->flag_cache;
-
- // Manually build array get just the statuses, not severities
- foreach( $_tmp as $sid => $sta )
- {
- if( is_array( $sta ) && count( $sta ) )
- {
- foreach( $sta as $points => $info )
- {
- if( $stats[ $sid ] )
- {
- break;
- }
-
- $stats[ $sid ] = $info;
- }
- }
- }
-
- //-----------------------------------------
- // Display Page Navigation
- //-----------------------------------------
-
- $pages = $this->registry->output->generatePagination( array( 'totalItems' => $total['reports'],
- 'itemsPerPage' => 10,
- 'currentStartValue' => $this->request['st'],
- 'baseUrl' => 'app=core&module=reports&do=index'
- )
- );
-
- $this->output .= $this->registry->getClass('output')->getTemplate('reports')->reportsIndex( $reports, $this->registry->getClass('reportLibrary')->buildStatuses(), $pages, $this->_getStats( 1 ), $stats );
- }
-
- /**
- * Basic functions for processing actions on 'Report Index' page (Drop Down)
- *
- * @access private
- * @return void
- */
- private function _processReports()
- {
- //-----------------------------------------
- // Check form key
- //-----------------------------------------
-
- if ( $this->request['k'] != $this->member->form_hash )
- {
- $this->registry->getClass('output')->showError( 'no_permission', 20112 );
- }
-
- //-----------------------------------------
- // Are we pruning?
- //-----------------------------------------
-
- if( is_numeric($this->request['pruneDays']) && $this->request['newstatus'] == 'p' )
- {
- if( !$this->memberData['g_access_cp'] )
- {
- $this->registry->output->showError( 'no_report_prune_perm', 2019, true );
- }
-
- //-----------------------------------------
- // Let's prune those reports.. if we can
- //-----------------------------------------
-
- $prune_time = ceil(time() - (intval($this->request['pruneDays']) * 86400));
- $total_pruned = $this->_pruneReports( $prune_time );
-
- if( $total_pruned )
- {
- $this->registry->output->redirectScreen( $this->lang->words['report_prune_message_done'], $this->settings['base_url'] . "app=core&module=reports&do=index&st=" . $this->request['st'] );
- }
- else
- {
- $this->registry->output->redirectScreen( $this->lang->words['report_prune_message_none'], $this->settings['base_url'] . "app=core&module=reports&do=index&st=" . $this->request['st'] );
- }
- }
-
- //-----------------------------------------
- // Either deleting or updating status?
- //-----------------------------------------
-
- elseif( $this->request['report_ids'] && is_array($this->request['report_ids']) )
- {
- $ids = implode( ',', IPSLib::cleanIntArray( $this->request['report_ids'] ) );
-
- if( strlen($ids) > 0 && ( ! preg_match( "/[^0-9,]/", $ids ) ) )
- {
- if( $this->request['newstatus'] == 'd' )
- {
- if( !$this->memberData['g_access_cp'] )
- {
- $this->registry->output->showError( 'no_report_prune_perm', 20110, true );
- }
-
- //-----------------------------------------
- // Time to delete some stuff!
- //-----------------------------------------
-
- $this->_deleteReports( $ids, true );
- $this->registry->getClass('reportLibrary')->updateCacheTime();
-
- $this->registry->output->redirectScreen( $this->lang->words['redirect_delete_report'], $this->settings['base_url'] . "app=core&module=reports&do=index&st=" . $this->request['st'] );
- }
- else
- {
- //----------------------------------------------
- // Change the status of these reports...
- //----------------------------------------------
-
- $build_update = array(
- 'status' => intval($this->request['newstatus']),
- 'date_updated' => time(),
- 'updated_by' => $this->memberData['member_id'],
- );
-
- $this->DB->update( 'rc_reports_index', $build_update, "id IN({$ids})" );
-
- $this->registry->getClass('reportLibrary')->updateCacheTime();
-
- $this->registry->output->redirectScreen( $this->lang->words['redirect_mark_status'], $this->settings['base_url'] . "app=core&module=reports&do=index&st=" . $this->request['st'] );
- }
- }
- }
-
- //-----------------------------------------
- // If we're still here show an error
- //-----------------------------------------
-
- if( !$this->memberData['g_access_cp'] )
- {
- $this->registry->output->showError( 'no_report_none_perm', 10131 );
- }
- else
- {
- $this->registry->output->silentRedirect( $this->settings['base_url'] . "app=core&module=reports&do=index" );
- }
- }
-
- /**
- * Finds first post reported using topic-id
- *
- * @access public
- * @return void
- */
- public function findFirstReport()
- {
- $this->registry->getClass('reportLibrary')->buildStatuses( true );
-
- $tid = intval($this->request['tid']);
- $cid = intval($this->request['cid']);
-
- if( $tid < 1 || $cid < 1 )
- {
- $this->registry->output->showError( 'reports_need_tidcid', 10132 );
- }
-
- $row = $this->DB->buildAndFetch( array( 'select' => 'exdat2, exdat3', 'from' => 'rc_reports_index', 'where' => "exdat2={$tid} AND rc_class={$cid} AND status!={$this->registry->getClass('reportLibrary')->report_is_complete}", 'order' => "exdat2 asc", 'limit' => 1 ) );
-
- if( !$row['exdat2'] )
- {
- $this->registry->output->showError( 'reports_no_topic', 10133 );
- }
-
- $this->registry->output->silentRedirect( $this->settings['base_url'] . "showtopic={$row['exdat2']}&view=findpost&p={$row['exdat3']}" );
- }
-
- /**
- * Main function for making reports and uses the custom plugins
- *
- * @access private
- * @return void
- */
- private function _initReportForm()
- {
- //-----------------------------------------
- // Make sure we have an rcom
- //-----------------------------------------
-
- $rcom = IPSText::alphanumericalClean($this->request['rcom']);
-
- if( !$rcom )
- {
- $this->registry->output->showError( 'reports_what_now', 10134 );
- }
-
- //-----------------------------------------
- // Request plugin info from database
- //-----------------------------------------
-
- $row = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_classes', 'where' => "my_class='{$rcom}' AND onoff=1" ) );
-
- if( !$row['com_id'] )
- {
- $this->registry->output->showError( 'reports_what_now', 10135 );
- }
- else
- {
- //-----------------------------------------
- // Can this group report this type of page?
- //-----------------------------------------
-
- if( $row['my_class'] == '' || count( array_diff($this->member_group_ids, explode(',', $row['group_can_report'])) ) >= count( $this->member_group_ids ) )
- {
- $this->registry->output->showError( 'reports_cant_report', 10136 );
- }
-
- require_once( IPSLib::getAppDir('core') . '/sources/classes/reportNotifications.php' );
-
- $notify = new reportNotifications( $this->registry );
-
- //-----------------------------------------
- // Let's get cooking! Load the plugin
- //-----------------------------------------
-
- $this->registry->getClass('reportLibrary')->loadPlugin( $row['my_class'] );
-
- //-----------------------------------------
- // Process 'extra data' for the plugin
- //-----------------------------------------
-
- if( $row['extra_data'] && $row['extra_data'] != 'N;' )
- {
- $this->registry->getClass('reportLibrary')->plugins[ $row['my_class'] ]->_extra = unserialize( $row['extra_data'] );
- }
- else
- {
- $this->registry->getClass('reportLibrary')->plugins[ $row['my_class'] ]->_extra = array();
- }
-
- $send_code = intval($this->request['send']);
-
- if( $send_code == 0 )
- {
- //-----------------------------------------
- // Request report form from plugin
- //-----------------------------------------
-
- $this->output .= $this->registry->getClass('reportLibrary')->plugins[ $row['my_class'] ]->reportForm( $row );
- }
- else
- {
- //-----------------------------------------
- // Form key not valid
- //-----------------------------------------
-
- if ( $this->request['k'] != $this->member->form_hash )
- {
- $this->registry->getClass('output')->showError( 'no_permission', 20114 );
- }
-
- //-----------------------------------------
- // Empty report
- //-----------------------------------------
-
- if( !trim(strip_tags($this->request['message'])) )
- {
- $this->registry->output->showError( 'reports_cant_empty', 10181 );
- }
-
- //-----------------------------------------
- // Sending report... do necessary things
- //-----------------------------------------
-
- $report_data = $this->registry->getClass('reportLibrary')->plugins[ $row['my_class'] ]->processReport( $row );
-
- $this->registry->getClass('reportLibrary')->updateCacheTime();
-
- //-----------------------------------------
- // Send out notfications...
- //-----------------------------------------
-
- $notify->initNotify( $this->registry->getClass('reportLibrary')->plugins[ $row['my_class'] ]->getNotificationList( substr( $row['mod_group_perm'], 1, strlen($row['mod_group_perm']) - 2), $report_data ), $report_data );
- $notify->sendNotifications();
-
- //-----------------------------------------
- // Redirect...
- //-----------------------------------------
-
- $this->registry->getClass('reportLibrary')->plugins[ $row['my_class'] ]->reportRedirect( $report_data );
- }
- }
- }
-
- /**
- * Displays notification options
- *
- * @access private
- * @return void
- */
- private function _showNotificationMethods()
- {
- //-----------------------------------------
- // Basic title and nav routine..
- //-----------------------------------------
-
- $this->registry->output->addNavigation( $this->lang->words['main_title'], 'app=core&module=reports&do=index' );
-
- $row = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_modpref', 'where' => "mem_id='{$this->memberData['member_id']}'" ) );
-
- $this->output .= $this->registry->getClass('output')->getTemplate('reports')->config_notif( $row );
- }
-
- /**
- * Saves notification options
- *
- * @access private
- * @return void
- */
- private function _saveNotificationMethods()
- {
- //-----------------------------------------
- // Check key
- //-----------------------------------------
-
- if ( $this->request['k'] != $this->member->form_hash )
- {
- $this->registry->getClass('output')->showError( 'no_permission', 20113 );
- }
-
- $mod_prefs['by_pm'] = intval( $this->request['notmet_pm'] );
- $mod_prefs['by_email'] = intval( $this->request['notmet_email'] );
- $mod_prefs['by_alert'] = intval( $this->request['notmet_alert'] );
-
- $this->DB->build( array( 'select' => '*', 'from' => 'rc_modpref', 'where' => "mem_id='{$this->memberData['member_id']}'" ) );
- $this->DB->execute();
-
- if( $this->DB->getTotalRows() == 0 )
- {
- $mod_prefs['mem_id'] = $this->memberData['member_id'];
-
- $this->DB->insert( 'rc_modpref', $mod_prefs );
- }
- else
- {
- $this->DB->update( 'rc_modpref', $mod_prefs, "mem_id='{$this->memberData['member_id']}'" );
- }
-
- $this->registry->output->redirectScreen( $this->lang->words['reports_methods_saved'], $this->settings['base_url'] . "app=core&module=reports&do=index" );
- }
-
- /**
- * Handles ajax/non-ajax window for reports and comments linked from reports
- *
- * @access private
- * @return boolean
- */
- private function _displayReport()
- {
- //-----------------------------------------
- // Lets make sure this report exists...
- //-----------------------------------------
-
- $rid = intval($this->request['rid']);
- $options = array(
- 'rid' => $rid
- );
- $reports = array();
- $comments = array();
-
- if( !$rid )
- {
- $this->registry->output->showError( 'reports_no_rid', 10137 );
- }
-
- $this->registry->class_localization->loadLanguageFile( array( 'public_editors' ) );
-
- $report_index = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_reports_index', 'where' => "id=" . $rid ) );
-
- //-----------------------------------------
- // Basic title and nav routine..
- //-----------------------------------------
-
- $this->registry->output->addNavigation( $this->lang->words['main_title'], 'app=core&module=reports&do=index' );
- $this->registry->output->addNavigation( $report_index['title'], '' );
-
- if( $this->DB->getTotalRows() == 0 )
- {
- $this->registry->output->showError( 'reports_no_rid', 10138 );
- }
-
- $COM_PERM = $this->registry->getClass('reportLibrary')->buildQueryPermissions();
-
- IPSText::getTextClass('bbcode')->parse_bbcode = 1;
- IPSText::getTextClass('bbcode')->parse_html = 0;
- IPSText::getTextClass('bbcode')->parse_emoticons = 1;
- IPSText::getTextClass('bbcode')->parse_nl2br = 0;
- IPSText::getTextClass('bbcode')->parsing_section = 'global';
-
- //-----------------------------------------
- // Get reports
- //-----------------------------------------
-
- $this->DB->buildFromCache( 'grab_report', array( 'COM' => $COM_PERM, 'rid' => $rid ), 'report_sql_queries' );
- $outer = $this->DB->execute();
-
- while( $row = $this->DB->fetch($outer) )
- {
- IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $row['member_group_id'];
- IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $row['mgroup_others'];
-
- $row['points'] = isset( $row['points'] ) ? $row['points'] : $this->settings['_tmpPoints'][ $row['id'] ];
-
- if( !$options['url'] && $row['url'] )
- {
- $options['url'] = $this->registry->getClass('reportLibrary')->processUrl( $row['url'], $row['seoname'], $row['seotemplate'] );
- }
-
- if( !$options['class'] && $row['my_class'] )
- {
- $options['class'] = $row['my_class'];
- }
-
- if( $row['my_class'] == 'messages' && !$options['topicID'] && $row['exdat1'] )
- {
- $options['topicID'] = intval($row['exdat1']);
- }
-
- $options['title'] = $row['title'];
- $options['status_id'] = $row['status'];
-
- if( !$options['image'] && $row['img_preview'] )
- {
- $options['image'] = $this->registry->getClass('reportLibrary')->processUrl( $row['img_preview'], $row['seoname'], $row['seotemplate'] );
- }
-
- if( !$options['status_icon'] )
- {
- $options['status_icon'] = $this->_buildStatusIcon( $row );
- $options['status_text'] = $this->registry->getClass('reportLibrary')->flag_cache[ $row['status'] ][ $row['points'] ]['title'];
- }
-
- /* Stupid stupid stupidness */
- $row['_title'] = $row['title'];
- $row['title'] = $row['member_title'];
-
- $row['author'] = IPSMember::buildDisplayData( $row );
-
- $row['title'] = $row['_title'];
- $row['report'] = IPSText::getTextClass('bbcode')->preDisplayParse( $row['report'] );
- $row['report'] = IPSText::getTextClass( 'bbcode' )->memberViewImages( $row['report'] );
-
- $reports[] = $row;
- }
-
- if( !$options['class'] )
- {
- $this->registry->output->showError( 'reports_no_rid', 10138 );
- }
-
- $_tmp = $this->registry->getClass('reportLibrary')->flag_cache;
-
- // Manually build array get just the statuses, not severities
- foreach( $_tmp as $sid => $sta )
- {
- if( is_array( $sta ) && count( $sta ) )
- {
- foreach( $sta as $points => $info )
- {
- if( $options['statuses'][ $sid ] )
- {
- break;
- }
-
- $options['statuses'][ $sid ] = $info;
- }
- }
- }
-
- //-----------------------------------------
- // Get comments
- //-----------------------------------------
-
- $ids = array( 0 => 0 );
-
- $this->DB->build( array( 'select' => 'id',
- 'from' => 'rc_comments',
- 'where' => 'rid=' . $rid,
- 'group' => 'id' ) );
-
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- $ids[ $row['id'] ] = $row['id'];
- }
-
- $this->DB->build( array(
- 'select' => 'comm.*',
- 'from' => array( 'rc_comments' => 'comm' ),
- 'where' => 'comm.id IN (' . implode( ',', $ids ) . ')',
- 'order' => 'comm.comment_date ASC',
- 'add_join' => array(
- array(
- 'select' => 'mem.*',
- 'from' => array( 'members' => 'mem' ),
- 'where' => 'mem.member_id=comm.comment_by',
- ),
- array(
- 'select' => 'grop.*,grop.g_is_supmod as iscop',
- 'from' => array( 'groups' => 'grop' ),
- 'where' => 'grop.g_id=mem.member_group_id',
- ),
- array(
- 'select' => 'pp.*',
- 'from' => array( 'profile_portal' => 'pp' ),
- 'where' => 'pp.pp_member_id=mem.member_id',
- ),
- )
- ) );
- $outer = $this->DB->execute();
-
- while($row = $this->DB->fetch($outer))
- {
- IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $row['member_group_id'];
- IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $row['mgroup_others'];
-
- $row['author'] = IPSMember::buildDisplayData( $row['member_id'] );
- $row['comment'] = IPSText::getTextClass('bbcode')->preDisplayParse( $row['comment'] );
- $row['comment'] = IPSText::getTextClass( 'bbcode' )->memberViewImages( $row['comment'] );
-
- $comments[ $row['id'] ] = $row;
- }
-
- //-----------------------------------------
- // And output
- //-----------------------------------------
-
- $this->output .= $this->registry->getClass('output')->getTemplate('reports')->viewReport( $options, $reports, $comments );
- }
-
- /**
- * Recieves comment, submits to database, and redirects user
- *
- * @access private
- * @return void
- */
- private function _saveComment()
- {
- //-----------------------------------------
- // Make sure we have a report id...
- //-----------------------------------------
-
- $rid = intval($this->request['rid']);
-
- if( $rid < 1 )
- {
- $this->registry->output->showError( 'reports_no_comment', 10139 );
- }
-
- //-----------------------------------------
- // Lets make sure we even have this report
- //-----------------------------------------
-
- $report = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_reports_index', 'where' => "id=" . $rid ) );
-
- if( $report['id'] )
- {
- $postContent = IPSText::getTextClass( 'editor' )->processRawPost( $_POST['comment'] );
-
- IPSText::getTextClass('bbcode')->parse_bbcode = 1;
- IPSText::getTextClass('bbcode')->parse_html = 0;
- IPSText::getTextClass('bbcode')->parse_emoticons = 1;
- IPSText::getTextClass('bbcode')->parse_nl2br = 1;
- IPSText::getTextClass('bbcode')->parsing_section = 'reports';
-
- $postContent = IPSText::getTextClass( 'bbcode' )->preDbParse( $postContent );
-
- if( !trim( IPSText::br2nl($postContent) ) )
- {
- $this->registry->output->showError( 'reports_no_comment_text', 10188 );
- }
-
- $build_comment = array(
- 'rid' => $rid,
- 'comment' => $postContent,
- 'comment_by' => $this->memberData['member_id'],
- 'comment_date' => time()
- );
-
- $this->DB->insert( 'rc_comments', $build_comment );
- $this->DB->update( 'rc_reports_index', array( 'num_comments' => $report['num_comments'] + 1, 'date_updated' => time(), 'updated_by' => $this->memberData['member_id'] ), "id=" . $report['id'] );
- }
-
- $this->registry->output->redirectScreen( $this->lang->words['report_comment_saved'], $this->settings['base_url'] . "app=core&module=reports&rid={$report['id']}&do=show_report" );
- }
-
- /**
- * Responsible for pruning reports. Uses the delete reports function to finish
- *
- * @access private
- * @param integer seconds used for pruning reports
- * @return void
- */
- private function _pruneReports( $stamp )
- {
- $ids = array();
-
- //--------------------------------------------------
- // Let's grab a list of reports and check stuff...
- //--------------------------------------------------
-
- $this->DB->build( array(
- 'select' => 'rep.id',
- 'from' => array( 'rc_reports_index' => 'rep' ),
- 'where' => $this->registry->getClass('reportLibrary')->buildQueryPermissions() . ' AND stat.is_complete=1 And rep.date_updated<' . $stamp,
- 'add_join' => array(
- array(
- 'from' => array( 'rc_classes' => 'rcl' ),
- 'where' => 'rcl.com_id=rep.rc_class'
- ),
- array(
- 'from' => array( 'rc_status' => 'stat' ),
- 'where' => 'stat.status=rep.status'
- ),
- )
- ) );
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- $ids[] = $row['id'];
- }
-
- //-----------------------------------------
- // OK lets delete them! I love OOP
- //-----------------------------------------
-
- if( count($ids) )
- {
- $this->_deleteReports( implode( ',', $ids ), false );
- }
-
- return count($ids);
- }
-
- /**
- * Responsible for deleting reports
- *
- * @access private
- * @param string Report IDS (#,#,#,...)
- * @param boolean Security check?
- * @return boolean
- */
- private function _deleteReports( $rids='', $toCheck=false )
- {
- if( $this->memberData['g_access_cp'] != 1 )
- {
- return false;
- }
-
- //-----------------------------------------
- // Lets make sure we got this right...
- //-----------------------------------------
-
- if( ! $rids || ! preg_match("/[0-9,]+/", $rids ) )
- {
- return false;
- }
-
- //-----------------------------------------
- // Are we checking security now?
- //-----------------------------------------
-
- if( $toCheck == true )
- {
- $this->DB->build( array(
- 'select' => 'rep.id, rep.status',
- 'from' => array( 'rc_reports_index' => 'rep' ),
- 'where' => $this->registry->getClass('reportLibrary')->buildQueryPermissions() . ' AND rep.id IN(' . $rids . ')',
- 'add_join' => array(
- array(
- 'from' => array( 'rc_classes' => 'rcl' ),
- 'where' => 'rcl.com_id=rep.rc_class'
- )
- )
- ) );
- $res = $this->DB->execute();
- $num = $this->DB->getTotalRows();
-
- if( count( explode( ',' , $rids ) ) != $this->DB->getTotalRows() )
- {
- $this->registry->output->showError( 'reports_like_whoa', 20111, true );
- }
- }
-
- //-----------------------------------------
- // Time to call for the good ol' shredder
- //-----------------------------------------
-
- $this->DB->delete( 'rc_reports_index', 'id IN(' . $rids . ')' );
- $this->DB->delete( 'rc_reports', 'rid IN(' . $rids . ')' );
- $this->DB->delete( 'rc_comments', 'rid IN(' . $rids . ')' );
-
- //-----------------------------------------
- // I think we should update the numbers..
- //-----------------------------------------
-
- $this->registry->getClass('reportLibrary')->updateCacheTime();
-
- return true;
- }
-
- /**
- * Returns the correct status icon / flag to display for a report row
- *
- * @access private
- * @param array Report Row
- * @return string
- */
- private function _buildStatusIcon( $row )
- {
- $this->registry->getClass('reportLibrary')->buildStatuses( true );
-
- //-----------------------------------------
- // Pick the right flag.. or else!
- //-----------------------------------------
-
- $row['img'] = str_replace( '<#IMG_DIR#>', $this->registry->output->skin['set_image_dir'], $this->registry->getClass('reportLibrary')->flag_cache[ $row['status'] ][ $row['points'] ]['img'] );
- $row['width'] = $this->registry->getClass('reportLibrary')->flag_cache[ $row['status'] ][ $row['points'] ]['width'];
- $row['height'] = $this->registry->getClass('reportLibrary')->flag_cache[ $row['status'] ][ $row['points'] ]['height'];
- $row['is_png'] = $this->registry->getClass('reportLibrary')->flag_cache[ $row['status'] ][ $row['points'] ]['is_png'];
-
- //-----------------------------------------
- // Image? PNG? Using 'Is-Evil' machine?
- //-----------------------------------------
-
- if( $row['img'] != '' )
- {
- return $this->registry->getClass('output')->getTemplate('reports')->statusIcon( $row['img'], $row['width'], $row['height'] );
- }
- else
- {
- return ' ';
- }
- }
-
- /**
- * Builds the "who's viewing" strip
- *
- * @access private
- * @param integer Section ID
- * @return string
- */
- private function _getStats( $id=1 )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $ar_time = time();
- $cached = array();
- $guests = array();
- $active = array( 'guests' => 0, 'anon' => 0, 'members' => 0, 'names' => array() );
- $rows = array( $ar_time => array( 'login_type' => substr($this->memberData['login_anonymous'],0, 1),
- 'running_time' => $ar_time,
- 'id' => $this->member->session_id,
- 'seo_name' => $this->memberData['members_seo_name'],
- 'member_id' => $this->memberData['member_id'],
- 'member_name' => $this->memberData['members_display_name'],
- 'member_group' => $this->memberData['member_group_id'] ) );
-
- //-----------------------------------------
- // Process users active in this forum
- //-----------------------------------------
-
- if ($this->settings['no_au_topic'] != 1)
- {
- //-----------------------------------------
- // Get the users
- //-----------------------------------------
-
- $cut_off = ($this->settings['au_cutoff'] != "") ? $this->settings['au_cutoff'] * 60 : 900;
-
- $this->DB->build( array(
- 'select' => 's.member_id, s.member_name, s.member_group, s.id, s.login_type, s.location, s.running_time, s.uagent_type, s.current_module, s.seo_name',
- 'from' => 'sessions s',
- 'where' => "current_appcomponent='core' AND current_module='reports' AND running_time > $cut_off",
- ) );
- $this->DB->execute();
-
- //-----------------------------------------
- // FETCH...
- //-----------------------------------------
-
- while ($r = $this->DB->fetch() )
- {
- $rows[ $r['running_time'].'.'.$r['id'] ] = $r;
- }
-
- krsort( $rows );
-
- //-----------------------------------------
- // PRINT...
- //-----------------------------------------
-
- foreach( $rows as $result )
- {
- $result['member_name'] = IPSLib::makeNameFormatted( $result['member_name'], $result['member_group'] );
-
- $last_date = $this->registry->class_localization->getTime( $result['running_time'] );
-
- if ( $result['member_id'] == 0 OR ! $result['member_name'] )
- {
- if ( in_array( $result['id'], $guests ) )
- {
- continue;
- }
-
- //-----------------------------------------
- // Bot?
- //-----------------------------------------
-
- if ( $result['uagent_type'] == 'search' )
- {
- //-----------------------------------------
- // Seen bot of this type yet?
- //-----------------------------------------
-
- if ( ! $cached[ $result['member_name'] ] )
- {
- if ( $this->settings['spider_anon'] )
- {
- if ( $this->memberData['g_access_cp'] )
- {
- $active['names'][] = array( 'id' => $result['member_id'], 'name' => $result['member_name'], 'seo' => $result['seo_name'] );
- }
- }
- else
- {
- $active['names'][] = array( 'id' => $result['member_id'], 'name' => $result['member_name'], 'seo' => $result['seo_name'] );
- }
-
- $cached[ $result['member_name'] ] = 1;
- }
- else
- {
- $active['guests']++;
- $guests[] = $result['id'];
- }
- }
- else
- {
- $active['guests']++;
- $guests[] = $result['id'];
- }
- }
- else
- {
- if (empty( $cached[ $result['member_id'] ] ) )
- {
- $cached[ $result['member_id'] ] = 1;
-
- $p_start = "";
- $p_end = "";
- $p_title = sprintf( $this->lang->words['au_reading'], $last_date );
-
- if ( strstr( $result['current_module'], 'post' ) and $result['member_id'] != $this->memberData['member_id'] )
- {
- $p_start = "";
- $p_end = " ";
- $p_title = sprintf( $this->lang->words['au_posting'], $last_date );
- }
-
- if ( ! $this->settings['disable_anonymous'] AND $result['login_type'] )
- {
- if ( $this->memberData['g_access_cp'] and ($this->settings['disable_admin_anon'] != 1) )
- {
- $active['names'][] = array( 'id' => $result['member_id'], 'name' => $result['member_name'] . '*', 'p_start' => $p_start, 'p_title' => $p_title, 'p_end' => $p_end, 'seo' => $result['seo_name'] );
- $active['anon']++;
- }
- else
- {
- $active['anon']++;
- }
- }
- else
- {
- $active['members']++;
- $active['names'][] = array( 'id' => $result['member_id'], 'name' => $result['member_name'], 'p_start' => $p_start, 'p_title' => $p_title, 'p_end' => $p_end, 'seo' => $result['seo_name'] );
- }
- }
- }
- }
-
- //$active['active_users_title'] = sprintf( $this->lang->words['active_users_title'] , ($active['members'] + $active['guests'] + $active['anon'] ) );
- //$active['active_users_detail'] = sprintf( $this->lang->words['active_users_detail'] , $active['guests'],$active['anon'] );
- $active['active_users_members'] = sprintf( $this->lang->words['active_users_members'], $active['members'] );
-
- return $active;
- }
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Reports content central management
+ * Last Updated: $LastChangedDate: 2010-09-29 20:23:38 -0400 (Wed, 29 Sep 2010) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @author Based on original "Report Center" by Luke Scott
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6925 $
+ *
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+class public_core_reports_reports extends ipsCommand
+{
+ /**
+ * Execute selected method
+ *
+ * @access public
+ * @param object Registry object
+ * @return void
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ //-----------------------------------------
+ // Load basic things
+ //-----------------------------------------
+
+ $this->registry->class_localization->loadLanguageFile( array( 'public_reports' ) );
+
+ $this->DB->loadCacheFile( IPSLib::getAppDir('core') . '/sql/' . ips_DBRegistry::getDriverType() . '_report_queries.php', 'report_sql_queries' );
+
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('core') .'/sources/classes/reportLibrary.php', 'reportLibrary' );
+ $this->registry->setClass( 'reportLibrary', new $classToLoad( $this->registry ) );
+
+ //-----------------------------------------
+ // Check permissions...
+ //-----------------------------------------
+
+ $showReportCenter = false;
+
+ $this->member_group_ids = array( $this->memberData['member_group_id'] );
+ $this->member_group_ids = array_diff( array_merge( $this->member_group_ids, explode( ',', $this->memberData['mgroup_others'] ) ), array('') );
+ $report_center = array_diff( explode( ',', $this->settings['report_mod_group_access'] ), array('') );
+
+ foreach( $report_center as $groupId )
+ {
+ if( in_array( $groupId, $this->member_group_ids ) )
+ {
+ $showReportCenter = true;
+ }
+ }
+
+ if( ($this->request['do'] AND $this->request['do'] != 'report') AND !$showReportCenter )
+ {
+ $this->registry->output->showError( 'no_reports_permission', 2018, true, null, 403 );
+ }
+
+ $this->registry->output->setTitle( $this->lang->words['main_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
+
+ //-----------------------------------------
+ // Which road are we going to take?
+ //-----------------------------------------
+
+ switch( $this->request['do'] )
+ {
+ default:
+ case 'report':
+ $this->_initReportForm();
+ break;
+
+ case 'showMessage':
+ $this->_viewReportedMessage();
+ break;
+
+ case 'index':
+ $this->_displayReportCenter();
+ break;
+
+ case 'process':
+ $this->_processReports();
+ break;
+
+ case 'findfirst':
+ $this->findFirstReport();
+ break;
+
+ case 'show_report':
+ $this->_displayReport();
+ break;
+
+ case 'save_comment':
+ $this->_saveComment();
+ break;
+ }
+
+ //-----------------------------------------
+ // Output
+ //-----------------------------------------
+
+ $this->registry->getClass('output')->addContent( $this->output );
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * View a reported private message as it shows in the messenger
+ *
+ * @access private
+ * @return void
+ */
+ private function _viewReportedMessage()
+ {
+ //-----------------------------------------
+ // Do we have permission?
+ //-----------------------------------------
+
+ $this->registry->getClass('reportLibrary')->buildQueryPermissions();
+
+ if( !in_array( $this->memberData['member_group_id'], explode( ',', $this->registry->getClass('reportLibrary')->plugins['messages']->_extra['plugi_messages_add'] ) ) )
+ {
+ $this->registry->getClass('output')->showError( 'no_permission_addreport', 20115, null, null, 403 );
+ }
+
+ //-----------------------------------------
+ // First see if we are already in map...
+ //-----------------------------------------
+
+ $topicId = intval($this->request['topicID']);
+
+ $mapRecord = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'message_topic_user_map', 'where' => "map_user_id={$this->memberData['member_id']} AND map_topic_id={$topicId}" ) );
+
+ //-----------------------------------------
+ // Doesn't exist?
+ //-----------------------------------------
+
+ if( !$mapRecord['map_user_id'] )
+ {
+ define( 'FROM_REPORT_CENTER', true );
+
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'members' ) . '/sources/classes/messaging/messengerFunctions.php', 'messengerFunctions', 'members' );
+ $messengerFunctions = new $classToLoad( $this->registry );
+
+ //-----------------------------------------
+ // Add ourselves
+ //-----------------------------------------
+
+ try
+ {
+ $messengerFunctions->addTopicParticipants( $topicId, array( $this->memberData['members_display_name'] ), $this->memberData['member_id'] );
+ }
+
+ //-----------------------------------------
+ // Must already be in there
+ //-----------------------------------------
+
+ catch( Exception $e )
+ {
+
+ }
+ }
+
+ //-----------------------------------------
+ // Already a participant, make sure we're active
+ //-----------------------------------------
+
+ else
+ {
+ $update = array();
+
+ if( !$mapRecord['map_user_active'] )
+ {
+ $update['map_user_active'] = 1;
+ }
+
+ if( $mapRecord['map_folder_id'] == 'finished' )
+ {
+ $update['map_folder_id'] = 'myconvo';
+ }
+
+ if( $mapRecord['map_user_banned'] )
+ {
+ $update['map_user_banned'] = 0;
+ }
+
+ if( count($update) )
+ {
+ $this->DB->update( 'message_topic_user_map', $update, "map_user_id={$this->memberData['member_id']} AND map_topic_id={$topicId}" );
+ }
+ }
+
+ $this->registry->output->silentRedirect( $this->settings['base_url'] . "app=members&module=messaging§ion=view&do=showConversation&topicID=" . $topicId . "&st=" . $this->request['st'] . "#msg" . $this->request['msg'] );
+ }
+
+ /**
+ * Main function for displaying reports in a list
+ *
+ * @access private
+ * @return void
+ */
+ private function _displayReportCenter()
+ {
+ //-----------------------------------------
+ // Check for rss key and if none make one
+ //-----------------------------------------
+
+ $this->registry->getClass('reportLibrary')->checkMemberRSSKey();
+
+ //-----------------------------------------
+ // Basic title and nav routine..
+ //-----------------------------------------
+
+ $this->registry->output->addNavigation( $this->lang->words['main_title'], 'app=core&module=reports&do=index' );
+
+ //-----------------------------------------
+ // We need some extra permisisons sql..
+ //-----------------------------------------
+
+ $COM_PERM = $this->registry->getClass('reportLibrary')->buildQueryPermissions();
+
+ $reports = array();
+
+ //-----------------------------------------
+ // Show me the money! err.. Reports!
+ //-----------------------------------------
+
+ $total = $this->DB->buildAndFetch( array(
+ 'select' => 'COUNT(*) as reports',
+ 'from' => array( 'rc_reports_index' => 'rep' ),
+ 'where' => $COM_PERM,
+ 'add_join' => array(
+ array(
+ 'from' => array( 'rc_classes' => 'rcl' ),
+ 'where' => 'rcl.com_id=rep.rc_class'
+ )
+ )
+ ) );
+
+
+
+ $this->DB->buildFromCache( 'reports_index', array( 'WHERE' => $COM_PERM, 'START' => intval($this->request['st']), 'LIMIT' => 10 ), 'report_sql_queries' );
+ $res = $this->DB->execute();
+
+ while( $row = $this->DB->fetch($res) )
+ {
+ $sec_data = $this->registry->getClass('reportLibrary')->plugins[$row['my_class']]->giveSectionLinkTitle( $row );
+ $sec_data['url'] = $this->registry->getClass('reportLibrary')->processUrl( $sec_data['url'], $sec_data['seo_title'], $sec_data['seo_template'] );
+ $row['points'] = isset( $row['points'] ) ? $row['points'] : $this->settings['_tmpPoints'][ $row['id'] ];
+ $row['section'] = $sec_data;
+ $row['status_icon'] = $this->_buildStatusIcon( $row );
+
+ $reports[ $row['id'] ] = $row;
+ }
+
+ //-----------------------------------------
+ // Statuses
+ //-----------------------------------------
+
+ $stats = array();
+ $_tmp = $this->registry->getClass('reportLibrary')->flag_cache;
+
+ // Manually build array get just the statuses, not severities
+ foreach( $_tmp as $sid => $sta )
+ {
+ if( is_array( $sta ) && count( $sta ) )
+ {
+ foreach( $sta as $points => $info )
+ {
+ if( $stats[ $sid ] )
+ {
+ break;
+ }
+
+ $stats[ $sid ] = $info;
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Display Page Navigation
+ //-----------------------------------------
+
+ $pages = $this->registry->output->generatePagination( array( 'totalItems' => $total['reports'],
+ 'itemsPerPage' => 10,
+ 'currentStartValue' => $this->request['st'],
+ 'baseUrl' => 'app=core&module=reports&do=index'
+ )
+ );
+
+ $this->output .= $this->registry->getClass('output')->getTemplate('reports')->reportsIndex( $reports, $this->registry->getClass('reportLibrary')->buildStatuses(), $pages, $this->_getStats( 1 ), $stats );
+ }
+
+ /**
+ * Basic functions for processing actions on 'Report Index' page (Drop Down)
+ *
+ * @access private
+ * @return void
+ */
+ private function _processReports()
+ {
+ //-----------------------------------------
+ // Check form key
+ //-----------------------------------------
+
+ if ( $this->request['k'] != $this->member->form_hash )
+ {
+ $this->registry->getClass('output')->showError( 'no_permission', 20112, null, null, 403 );
+ }
+
+ //-----------------------------------------
+ // Are we pruning?
+ //-----------------------------------------
+
+ if( is_numeric($this->request['pruneDays']) && $this->request['newstatus'] == 'p' )
+ {
+ if( !$this->memberData['g_access_cp'] )
+ {
+ $this->registry->output->showError( 'no_report_prune_perm', 2019, true, null, null, 403 );
+ }
+
+ //-----------------------------------------
+ // Let's prune those reports.. if we can
+ //-----------------------------------------
+
+ $prune_time = ceil(time() - (intval($this->request['pruneDays']) * 86400));
+ $total_pruned = $this->_pruneReports( $prune_time );
+
+ if( $total_pruned )
+ {
+ $this->registry->output->redirectScreen( $this->lang->words['report_prune_message_done'], $this->settings['base_url'] . "app=core&module=reports&do=index&st=" . $this->request['st'] );
+ }
+ else
+ {
+ $this->registry->output->redirectScreen( $this->lang->words['report_prune_message_none'], $this->settings['base_url'] . "app=core&module=reports&do=index&st=" . $this->request['st'] );
+ }
+ }
+
+ //-----------------------------------------
+ // Either deleting or updating status?
+ //-----------------------------------------
+
+ elseif( $this->request['report_ids'] && is_array($this->request['report_ids']) )
+ {
+ $ids = implode( ',', IPSLib::cleanIntArray( $this->request['report_ids'] ) );
+
+ if( strlen($ids) > 0 && ( ! preg_match( "/[^0-9,]/", $ids ) ) )
+ {
+ if( $this->request['newstatus'] == 'd' )
+ {
+ if( !$this->memberData['g_access_cp'] )
+ {
+ $this->registry->output->showError( 'no_report_prune_perm', 20110, true, null, null, 403 );
+ }
+
+ //-----------------------------------------
+ // Time to delete some stuff!
+ //-----------------------------------------
+
+ $this->_deleteReports( $ids, true );
+ $this->registry->getClass('reportLibrary')->updateCacheTime();
+
+ $this->registry->output->redirectScreen( $this->lang->words['redirect_delete_report'], $this->settings['base_url'] . "app=core&module=reports&do=index&st=" . $this->request['st'] );
+ }
+ else
+ {
+ //----------------------------------------------
+ // Change the status of these reports...
+ //----------------------------------------------
+
+ $build_update = array(
+ 'status' => intval($this->request['newstatus']),
+ 'date_updated' => time(),
+ 'updated_by' => $this->memberData['member_id'],
+ );
+
+ $this->DB->update( 'rc_reports_index', $build_update, "id IN({$ids})" );
+
+ $this->registry->getClass('reportLibrary')->updateCacheTime();
+
+ $this->registry->output->redirectScreen( $this->lang->words['redirect_mark_status'], $this->settings['base_url'] . "app=core&module=reports&do=index&st=" . $this->request['st'] );
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // If we're still here show an error
+ //-----------------------------------------
+
+ if( !$this->memberData['g_access_cp'] )
+ {
+ $this->registry->output->showError( 'no_report_none_perm', 10131, null, null, 403 );
+ }
+ else
+ {
+ $this->registry->output->silentRedirect( $this->settings['base_url'] . "app=core&module=reports&do=index" );
+ }
+ }
+
+ /**
+ * Finds first post reported using topic-id
+ *
+ * @access public
+ * @return void
+ */
+ public function findFirstReport()
+ {
+ $this->registry->getClass('reportLibrary')->buildStatuses( true );
+
+ $tid = intval($this->request['tid']);
+ $cid = intval($this->request['cid']);
+
+ if( $tid < 1 || $cid < 1 )
+ {
+ $this->registry->output->showError( 'reports_need_tidcid', 10132 );
+ }
+
+ $row = $this->DB->buildAndFetch( array( 'select' => 'exdat2, exdat3', 'from' => 'rc_reports_index', 'where' => "exdat2={$tid} AND rc_class={$cid} AND status!={$this->registry->getClass('reportLibrary')->report_is_complete}", 'order' => "exdat2 asc", 'limit' => 1 ) );
+
+ if( !$row['exdat2'] )
+ {
+ $this->registry->output->showError( 'reports_no_topic', 10133 );
+ }
+
+ $this->registry->output->silentRedirect( $this->settings['base_url'] . "showtopic={$row['exdat2']}&view=findpost&p={$row['exdat3']}" );
+ }
+
+ /**
+ * Main function for making reports and uses the custom plugins
+ *
+ * @access private
+ * @return void
+ */
+ private function _initReportForm()
+ {
+ //-----------------------------------------
+ // Make sure we have an rcom
+ //-----------------------------------------
+
+ $rcom = IPSText::alphanumericalClean($this->request['rcom']);
+
+ if( !$rcom )
+ {
+ $this->registry->output->showError( 'reports_what_now', 10134 );
+ }
+
+ //-----------------------------------------
+ // Request plugin info from database
+ //-----------------------------------------
+
+ $row = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_classes', 'where' => "my_class='{$rcom}' AND onoff=1" ) );
+
+ if( !$row['com_id'] )
+ {
+ $this->registry->output->showError( 'reports_what_now', 10135 );
+ }
+ else
+ {
+ //-----------------------------------------
+ // Can this group report this type of page?
+ //-----------------------------------------
+
+ if( $row['my_class'] == '' || count( array_diff($this->member_group_ids, explode(',', $row['group_can_report'])) ) >= count( $this->member_group_ids ) )
+ {
+ $this->registry->output->showError( 'reports_cant_report', 10136, null, null, 403 );
+ }
+
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('core') . '/sources/classes/reportNotifications.php', 'reportNotifications' );
+ $notify = new $classToLoad( $this->registry );
+
+ //-----------------------------------------
+ // Let's get cooking! Load the plugin
+ //-----------------------------------------
+
+ $this->registry->getClass('reportLibrary')->loadPlugin( $row['my_class'], $row['app'] );
+
+ if( !is_object($this->registry->getClass('reportLibrary')->plugins[ $row['my_class'] ]) )
+ {
+ $this->registry->output->showError( 'reports_no_plugin', 10136.1, null, null, 403 );
+ }
+
+ //-----------------------------------------
+ // Process 'extra data' for the plugin
+ //-----------------------------------------
+
+ if( $row['extra_data'] && $row['extra_data'] != 'N;' )
+ {
+ $this->registry->getClass('reportLibrary')->plugins[ $row['my_class'] ]->_extra = unserialize( $row['extra_data'] );
+ }
+ else
+ {
+ $this->registry->getClass('reportLibrary')->plugins[ $row['my_class'] ]->_extra = array();
+ }
+
+ $send_code = intval($this->request['send']);
+
+ if( $send_code == 0 )
+ {
+ //-----------------------------------------
+ // Request report form from plugin
+ //-----------------------------------------
+
+ $this->output .= $this->registry->getClass('reportLibrary')->plugins[ $row['my_class'] ]->reportForm( $row );
+ }
+ else
+ {
+ //-----------------------------------------
+ // Form key not valid
+ //-----------------------------------------
+
+ if ( $this->request['k'] != $this->member->form_hash )
+ {
+ $this->registry->getClass('output')->showError( 'no_permission', 20114, null, null, 403 );
+ }
+
+ //-----------------------------------------
+ // Empty report
+ //-----------------------------------------
+
+ if( !trim(strip_tags($this->request['message'])) )
+ {
+ $this->registry->output->showError( 'reports_cant_empty', 10181 );
+ }
+
+ //-----------------------------------------
+ // Sending report... do necessary things
+ //-----------------------------------------
+
+ $report_data = $this->registry->getClass('reportLibrary')->plugins[ $row['my_class'] ]->processReport( $row );
+
+ $this->registry->getClass('reportLibrary')->updateCacheTime();
+
+ //-----------------------------------------
+ // Send out notfications...
+ //-----------------------------------------
+
+ $notify->initNotify( $this->registry->getClass('reportLibrary')->plugins[ $row['my_class'] ]->getNotificationList( IPSText::cleanPermString( $row['mod_group_perm'] ), $report_data ), $report_data );
+ $notify->sendNotifications();
+
+ //-----------------------------------------
+ // Redirect...
+ //-----------------------------------------
+
+ $this->registry->getClass('reportLibrary')->plugins[ $row['my_class'] ]->reportRedirect( $report_data );
+ }
+ }
+ }
+
+ /**
+ * Handles ajax/non-ajax window for reports and comments linked from reports
+ *
+ * @access private
+ * @return boolean
+ */
+ private function _displayReport()
+ {
+ //-----------------------------------------
+ // Lets make sure this report exists...
+ //-----------------------------------------
+
+ $rid = intval($this->request['rid']);
+ $options = array(
+ 'rid' => $rid
+ );
+ $reports = array();
+ $comments = array();
+
+ if( !$rid )
+ {
+ $this->registry->output->showError( 'reports_no_rid', 10137 );
+ }
+
+ $this->registry->class_localization->loadLanguageFile( array( 'public_editors' ) );
+
+ $report_index = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_reports_index', 'where' => "id=" . $rid ) );
+
+ //-----------------------------------------
+ // Basic title and nav routine..
+ //-----------------------------------------
+
+ $this->registry->output->addNavigation( $this->lang->words['main_title'], 'app=core&module=reports&do=index' );
+ $this->registry->output->addNavigation( $report_index['title'], '' );
+
+ if( $this->DB->getTotalRows() == 0 )
+ {
+ $this->registry->output->showError( 'reports_no_rid', 10138 );
+ }
+
+ $COM_PERM = $this->registry->getClass('reportLibrary')->buildQueryPermissions();
+
+ IPSText::getTextClass('bbcode')->parse_bbcode = 1;
+ IPSText::getTextClass('bbcode')->parse_html = 0;
+ IPSText::getTextClass('bbcode')->parse_emoticons = 1;
+ IPSText::getTextClass('bbcode')->parse_nl2br = 0;
+ IPSText::getTextClass('bbcode')->parsing_section = 'global';
+
+ //-----------------------------------------
+ // Get reports
+ //-----------------------------------------
+
+ $this->DB->buildFromCache( 'grab_report', array( 'COM' => $COM_PERM, 'rid' => $rid ), 'report_sql_queries' );
+ $outer = $this->DB->execute();
+
+ while( $row = $this->DB->fetch($outer) )
+ {
+ IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $row['member_group_id'];
+ IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $row['mgroup_others'];
+
+ $row['points'] = isset( $row['points'] ) ? $row['points'] : $this->settings['_tmpPoints'][ $row['id'] ];
+
+ if( !$options['url'] && $row['url'] )
+ {
+ $options['url'] = $this->registry->getClass('reportLibrary')->processUrl( $row['url'], $row['seoname'], $row['seotemplate'] );
+ }
+
+ if( !$options['class'] && $row['my_class'] )
+ {
+ $options['class'] = $row['my_class'];
+ }
+
+ if( $row['my_class'] == 'messages' && !$options['topicID'] && $row['exdat1'] )
+ {
+ $options['topicID'] = intval($row['exdat1']);
+ }
+
+ $options['title'] = $row['title'];
+ $options['status_id'] = $row['status'];
+
+ if( !$options['image'] && $row['img_preview'] )
+ {
+ $options['image'] = $this->registry->getClass('reportLibrary')->processUrl( $row['img_preview'], $row['seoname'], $row['seotemplate'] );
+ }
+
+ if( !$options['status_icon'] )
+ {
+ $options['status_icon'] = $this->_buildStatusIcon( $row );
+ $options['status_text'] = $this->registry->getClass('reportLibrary')->flag_cache[ $row['status'] ][ $row['points'] ]['title'];
+ }
+
+ /* Stupid stupid stupidness */
+ $row['_title'] = $row['title'];
+ $row['title'] = $row['member_title'];
+
+ $row['author'] = IPSMember::buildDisplayData( $row );
+
+ $row['title'] = $row['_title'];
+ $row['report'] = IPSText::getTextClass('bbcode')->preDisplayParse( $row['report'] );
+ $row['report'] = IPSText::getTextClass( 'bbcode' )->memberViewImages( $row['report'] );
+
+ $reports[] = $row;
+ }
+
+ if( !$options['class'] )
+ {
+ $this->registry->output->showError( 'reports_no_rid', 10138 );
+ }
+
+ $_tmp = $this->registry->getClass('reportLibrary')->flag_cache;
+
+ // Manually build array get just the statuses, not severities
+ foreach( $_tmp as $sid => $sta )
+ {
+ if( is_array( $sta ) && count( $sta ) )
+ {
+ foreach( $sta as $points => $info )
+ {
+ if( $options['statuses'][ $sid ] )
+ {
+ break;
+ }
+
+ $options['statuses'][ $sid ] = $info;
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Get comments
+ //-----------------------------------------
+
+ $ids = array( 0 => 0 );
+
+ $this->DB->build( array( 'select' => 'id',
+ 'from' => 'rc_comments',
+ 'where' => 'rid=' . $rid,
+ 'group' => 'id' ) );
+
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $ids[ $row['id'] ] = $row['id'];
+ }
+
+ $this->DB->build( array(
+ 'select' => 'comm.*',
+ 'from' => array( 'rc_comments' => 'comm' ),
+ 'where' => 'comm.id IN (' . implode( ',', $ids ) . ')',
+ 'order' => 'comm.comment_date ASC',
+ 'add_join' => array(
+ array(
+ 'select' => 'mem.*',
+ 'from' => array( 'members' => 'mem' ),
+ 'where' => 'mem.member_id=comm.comment_by',
+ ),
+ array(
+ 'select' => 'grop.*,grop.g_is_supmod as iscop',
+ 'from' => array( 'groups' => 'grop' ),
+ 'where' => 'grop.g_id=mem.member_group_id',
+ ),
+ array(
+ 'select' => 'pp.*',
+ 'from' => array( 'profile_portal' => 'pp' ),
+ 'where' => 'pp.pp_member_id=mem.member_id',
+ ),
+ )
+ ) );
+ $outer = $this->DB->execute();
+
+ while($row = $this->DB->fetch($outer))
+ {
+ IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $row['member_group_id'];
+ IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $row['mgroup_others'];
+
+ $row['author'] = IPSMember::buildDisplayData( $row['member_id'] );
+ $row['comment'] = IPSText::getTextClass('bbcode')->preDisplayParse( $row['comment'] );
+ $row['comment'] = IPSText::getTextClass( 'bbcode' )->memberViewImages( $row['comment'] );
+
+ $comments[ $row['id'] ] = $row;
+ }
+
+ //-----------------------------------------
+ // And output
+ //-----------------------------------------
+
+ $this->output .= $this->registry->getClass('output')->getTemplate('reports')->viewReport( $options, $reports, $comments );
+ }
+
+ /**
+ * Recieves comment, submits to database, and redirects user
+ *
+ * @access private
+ * @return void
+ */
+ private function _saveComment()
+ {
+ //-----------------------------------------
+ // Make sure we have a report id...
+ //-----------------------------------------
+
+ $rid = intval($this->request['rid']);
+
+ if( $rid < 1 )
+ {
+ $this->registry->output->showError( 'reports_no_comment', 10139 );
+ }
+
+ //-----------------------------------------
+ // Lets make sure we even have this report
+ //-----------------------------------------
+
+ $report = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rc_reports_index', 'where' => "id=" . $rid ) );
+
+ if( $report['id'] )
+ {
+ $postContent = IPSText::getTextClass( 'editor' )->processRawPost( $_POST['comment'] );
+
+ IPSText::getTextClass('bbcode')->parse_bbcode = 1;
+ IPSText::getTextClass('bbcode')->parse_html = 0;
+ IPSText::getTextClass('bbcode')->parse_emoticons = 1;
+ IPSText::getTextClass('bbcode')->parse_nl2br = 1;
+ IPSText::getTextClass('bbcode')->parsing_section = 'reports';
+
+ $postContent = IPSText::getTextClass( 'bbcode' )->preDbParse( $postContent );
+
+ if( !trim( IPSText::br2nl($postContent) ) )
+ {
+ $this->registry->output->showError( 'reports_no_comment_text', 10188 );
+ }
+
+ $build_comment = array(
+ 'rid' => $rid,
+ 'comment' => $postContent,
+ 'comment_by' => $this->memberData['member_id'],
+ 'comment_date' => time()
+ );
+
+ $this->DB->insert( 'rc_comments', $build_comment );
+ $this->DB->update( 'rc_reports_index', array( 'num_comments' => $report['num_comments'] + 1, 'date_updated' => time(), 'updated_by' => $this->memberData['member_id'] ), "id=" . $report['id'] );
+ }
+
+ $this->registry->output->redirectScreen( $this->lang->words['report_comment_saved'], $this->settings['base_url'] . "app=core&module=reports&rid={$report['id']}&do=show_report" );
+ }
+
+ /**
+ * Responsible for pruning reports. Uses the delete reports function to finish
+ *
+ * @access private
+ * @param integer seconds used for pruning reports
+ * @return void
+ */
+ private function _pruneReports( $stamp )
+ {
+ $ids = array();
+
+ //--------------------------------------------------
+ // Let's grab a list of reports and check stuff...
+ //--------------------------------------------------
+
+ $this->DB->build( array(
+ 'select' => 'rep.id',
+ 'from' => array( 'rc_reports_index' => 'rep' ),
+ 'where' => $this->registry->getClass('reportLibrary')->buildQueryPermissions() . ' AND stat.is_complete=1 And rep.date_updated<' . $stamp,
+ 'add_join' => array(
+ array(
+ 'from' => array( 'rc_classes' => 'rcl' ),
+ 'where' => 'rcl.com_id=rep.rc_class'
+ ),
+ array(
+ 'from' => array( 'rc_status' => 'stat' ),
+ 'where' => 'stat.status=rep.status'
+ ),
+ )
+ ) );
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $ids[] = $row['id'];
+ }
+
+ //-----------------------------------------
+ // OK lets delete them! I love OOP
+ //-----------------------------------------
+
+ if( count($ids) )
+ {
+ $this->_deleteReports( implode( ',', $ids ), false );
+ }
+
+ return count($ids);
+ }
+
+ /**
+ * Responsible for deleting reports
+ *
+ * @access private
+ * @param string Report IDS (#,#,#,...)
+ * @param boolean Security check?
+ * @return boolean
+ */
+ private function _deleteReports( $rids='', $toCheck=false )
+ {
+ if( $this->memberData['g_access_cp'] != 1 )
+ {
+ return false;
+ }
+
+ //-----------------------------------------
+ // Lets make sure we got this right...
+ //-----------------------------------------
+
+ if( ! $rids || ! preg_match("/[0-9,]+/", $rids ) )
+ {
+ return false;
+ }
+
+ //-----------------------------------------
+ // Are we checking security now?
+ //-----------------------------------------
+
+ if( $toCheck == true )
+ {
+ $this->DB->build( array(
+ 'select' => 'rep.id, rep.status',
+ 'from' => array( 'rc_reports_index' => 'rep' ),
+ 'where' => $this->registry->getClass('reportLibrary')->buildQueryPermissions() . ' AND rep.id IN(' . $rids . ')',
+ 'add_join' => array(
+ array(
+ 'from' => array( 'rc_classes' => 'rcl' ),
+ 'where' => 'rcl.com_id=rep.rc_class'
+ )
+ )
+ ) );
+ $res = $this->DB->execute();
+ $num = $this->DB->getTotalRows();
+
+ if( count( explode( ',' , $rids ) ) != $this->DB->getTotalRows() )
+ {
+ $this->registry->output->showError( 'reports_like_whoa', 20111, true );
+ }
+ }
+
+ //-----------------------------------------
+ // Time to call for the good ol' shredder
+ //-----------------------------------------
+
+ $this->DB->delete( 'rc_reports_index', 'id IN(' . $rids . ')' );
+ $this->DB->delete( 'rc_reports', 'rid IN(' . $rids . ')' );
+ $this->DB->delete( 'rc_comments', 'rid IN(' . $rids . ')' );
+
+ //-----------------------------------------
+ // I think we should update the numbers..
+ //-----------------------------------------
+
+ $this->registry->getClass('reportLibrary')->updateCacheTime();
+
+ return true;
+ }
+
+ /**
+ * Returns the correct status icon / flag to display for a report row
+ *
+ * @access private
+ * @param array Report Row
+ * @return string
+ */
+ private function _buildStatusIcon( $row )
+ {
+ $this->registry->getClass('reportLibrary')->buildStatuses( true );
+
+ //-----------------------------------------
+ // Pick the right flag.. or else!
+ //-----------------------------------------
+
+ $row['img'] = str_replace( '<#IMG_DIR#>', $this->registry->output->skin['set_image_dir'], $this->registry->getClass('reportLibrary')->flag_cache[ $row['status'] ][ $row['points'] ]['img'] );
+ $row['width'] = $this->registry->getClass('reportLibrary')->flag_cache[ $row['status'] ][ $row['points'] ]['width'];
+ $row['height'] = $this->registry->getClass('reportLibrary')->flag_cache[ $row['status'] ][ $row['points'] ]['height'];
+ $row['is_png'] = $this->registry->getClass('reportLibrary')->flag_cache[ $row['status'] ][ $row['points'] ]['is_png'];
+
+ //-----------------------------------------
+ // Image? PNG? Using 'Is-Evil' machine?
+ //-----------------------------------------
+
+ if( $row['img'] != '' )
+ {
+ return $this->registry->getClass('output')->getTemplate('reports')->statusIcon( $row['img'], $row['width'], $row['height'] );
+ }
+ else
+ {
+ return ' ';
+ }
+ }
+
+ /**
+ * Builds the "who's viewing" strip
+ *
+ * @access private
+ * @param integer Section ID
+ * @return string
+ */
+ private function _getStats( $id=1 )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $ar_time = time();
+ $cached = array();
+ $guests = array();
+ $active = array( 'guests' => 0, 'anon' => 0, 'members' => 0, 'names' => array() );
+ $rows = array( $ar_time => array( 'login_type' => substr($this->memberData['login_anonymous'],0, 1),
+ 'running_time' => $ar_time,
+ 'id' => $this->member->session_id,
+ 'seo_name' => $this->memberData['members_seo_name'],
+ 'member_id' => $this->memberData['member_id'],
+ 'member_name' => $this->memberData['members_display_name'],
+ 'member_group' => $this->memberData['member_group_id'] ) );
+
+ //-----------------------------------------
+ // Process users active in this forum
+ //-----------------------------------------
+
+ if ($this->settings['no_au_topic'] != 1)
+ {
+ //-----------------------------------------
+ // Get the users
+ //-----------------------------------------
+
+ $cut_off = ($this->settings['au_cutoff'] != "") ? $this->settings['au_cutoff'] * 60 : 900;
+
+ $this->DB->build( array(
+ 'select' => '*',
+ 'from' => 'sessions',
+ 'where' => "current_appcomponent='core' AND current_module='reports' AND running_time > " . $cut_off,
+ ) );
+ $this->DB->execute();
+
+ //-----------------------------------------
+ // FETCH...
+ //-----------------------------------------
+
+ while ($r = $this->DB->fetch() )
+ {
+ $rows[ $r['running_time'].'.'.$r['id'] ] = $r;
+ }
+
+ krsort( $rows );
+
+ //-----------------------------------------
+ // PRINT...
+ //-----------------------------------------
+
+ foreach( $rows as $result )
+ {
+ $result['member_name'] = IPSLib::makeNameFormatted( $result['member_name'], $result['member_group'] );
+
+ $last_date = $this->registry->class_localization->getTime( $result['running_time'] );
+
+ if ( $result['member_id'] == 0 OR ! $result['member_name'] )
+ {
+ if ( in_array( $result['id'], $guests ) )
+ {
+ continue;
+ }
+
+ //-----------------------------------------
+ // Bot?
+ //-----------------------------------------
+
+ if ( $result['uagent_type'] == 'search' )
+ {
+ //-----------------------------------------
+ // Seen bot of this type yet?
+ //-----------------------------------------
+
+ if ( ! $cached[ $result['member_name'] ] )
+ {
+ if ( $this->settings['spider_anon'] )
+ {
+ if ( $this->memberData['g_access_cp'] )
+ {
+ $active['names'][] = array( 'id' => $result['member_id'], 'name' => $result['member_name'], 'seo' => $result['seo_name'] );
+ }
+ }
+ else
+ {
+ $active['names'][] = array( 'id' => $result['member_id'], 'name' => $result['member_name'], 'seo' => $result['seo_name'] );
+ }
+
+ $cached[ $result['member_name'] ] = 1;
+ }
+ else
+ {
+ $active['guests']++;
+ $guests[] = $result['id'];
+ }
+ }
+ else
+ {
+ $active['guests']++;
+ $guests[] = $result['id'];
+ }
+ }
+ else
+ {
+ if (empty( $cached[ $result['member_id'] ] ) )
+ {
+ $cached[ $result['member_id'] ] = 1;
+
+ $p_start = "";
+ $p_end = "";
+ $p_title = sprintf( $this->lang->words['au_reading'], $last_date );
+
+ if ( strstr( $result['current_module'], 'post' ) and $result['member_id'] != $this->memberData['member_id'] )
+ {
+ $p_start = "";
+ $p_end = " ";
+ $p_title = sprintf( $this->lang->words['au_posting'], $last_date );
+ }
+
+ if ( ! $this->settings['disable_anonymous'] AND $result['login_type'] )
+ {
+ if ( $this->memberData['g_access_cp'] and ($this->settings['disable_admin_anon'] != 1) )
+ {
+ $active['names'][] = array( 'id' => $result['member_id'], 'name' => $result['member_name'] . '*', 'p_start' => $p_start, 'p_title' => $p_title, 'p_end' => $p_end, 'seo' => $result['seo_name'] );
+ $active['anon']++;
+ }
+ else
+ {
+ $active['anon']++;
+ }
+ }
+ else
+ {
+ $active['members']++;
+ $active['names'][] = array( 'id' => $result['member_id'], 'name' => $result['member_name'], 'p_start' => $p_start, 'p_title' => $p_title, 'p_end' => $p_end, 'seo' => $result['seo_name'] );
+ }
+ }
+ }
+ }
+
+ //$active['active_users_title'] = sprintf( $this->lang->words['active_users_title'] , ($active['members'] + $active['guests'] + $active['anon'] ) );
+ //$active['active_users_detail'] = sprintf( $this->lang->words['active_users_detail'] , $active['guests'],$active['anon'] );
+ $active['active_users_members'] = sprintf( $this->lang->words['active_users_members'], $active['members'] );
+
+ return $active;
+ }
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/search/defaultSection.php b/upload/admin/applications/core/modules_public/search/defaultSection.php
index 0b0de580..d2a6005c 100644
--- a/upload/admin/applications/core/modules_public/search/defaultSection.php
+++ b/upload/admin/applications/core/modules_public/search/defaultSection.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Define the default section section
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 4948 $
+ * @version $Rev: 5713 $
*
*/
diff --git a/upload/admin/applications/core/modules_public/search/index.html b/upload/admin/applications/core/modules_public/search/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_public/search/index.html
+++ b/upload/admin/applications/core/modules_public/search/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/search/search.php b/upload/admin/applications/core/modules_public/search/search.php
index 751f90d4..05191cbe 100644
--- a/upload/admin/applications/core/modules_public/search/search.php
+++ b/upload/admin/applications/core/modules_public/search/search.php
@@ -1,1300 +1,776 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class public_core_search_search extends ipsCommand
-{
- /**
- * Generated output
- *
- * @access private
- * @var string
- */
- private $output = '';
-
- /**
- * Page Title
- *
- * @access private
- * @var string
- */
- private $title = '';
-
- /**
- * Object to handle searches
- *
- * @access private
- * @var string
- */
- private $search_plugin = '';
-
- /**
- * Topics array
- *
- * @access private
- * @var array
- */
- private $_topicArray = array();
-
- /**
- * Class entry point
- *
- * @access public
- * @param object Registry reference
- * @return void [Outputs to screen/redirects]
- */
- public function doExecute( ipsRegistry $registry )
- {
- /* Basic Search */
- if( isset( $this->request['search_filter_app'] ) && is_array( $this->request['search_filter_app'] ) )
- {
- foreach( $this->request['search_filter_app'] as $app => $checked )
- {
- /* Bypass the all filter */
- if( $app == 'all' )
- {
- $this->request['search_app'] = 'forums';
- $this->request['search_filter_app']['forums'] = 1;
- break;
- }
-
- /* Add to the array */
- if( $checked )
- {
- $this->request['search_app'] = $app;
- break;
- }
- }
- }
-
- $this->request['search_app'] = $this->request['search_app'] ? $this->request['search_app'] : 'forums';
-
- /* Load Search Plugin */
- try
- {
- /* If it's not a search operation, like new content or user post for example, we use mysql instead of sphinx */
- if( $this->request['do'] != 'quick_search' )
- {
- $this->search_plugin = IPSSearchIndex::getSearchPlugin( 'index' );
- }
- else
- {
- $this->search_plugin = IPSSearchIndex::getSearchPlugin();
- }
- }
- catch( Exception $error )
- {
- switch( $error->getMessage() )
- {
- case 'INVALID_BASIC_SEARCH_PLUGIN_FILE':
- $this->registry->output->showError( 'search_invalid_plugin', 10140 );
- break;
-
- case 'INVALID_BASIC_SEARCH_PLUGIN_CLASS':
- $this->registry->output->showError( 'search_plugin_class', 10141, true );
- break;
-
- case 'INVALID_INDEX_PLUGIN_FILE':
- $this->registry->output->showError( 'search_plugin_file', 10142 );
- break;
-
- case 'INVALID_INDEX_PLUGIN_CLASS':
- $this->registry->output->showError( 'search_plugin_class', 10143, true );
- break;
- }
- }
-
- /* Check Access */
- $this->_canSearch();
-
- /* Load language */
- $this->registry->class_localization->loadLanguageFile( array( 'public_search' ), 'core' );
- $this->registry->class_localization->loadLanguageFile( array( 'public_forums' ), 'forums' );
-
- /* What to do */
- switch( $this->request['do'] )
- {
- case 'active':
- $this->activeContent();
- break;
-
- case 'user_posts':
- $this->viewUserContent();
- break;
-
- case 'new_posts':
- $this->viewNewPosts();
- break;
-
- case 'quick_search':
- $this->searchResults();
- break;
-
- default:
- case 'search_form':
- $this->searchAdvancedForm();
- break;
- }
-
- /* If we have any HTML to print, do so... */
- $this->registry->output->setTitle( $this->title );
- $this->registry->output->addContent( $this->output );
- $this->registry->output->sendOutput();
- }
-
- /**
- * Builds the advanced search form
- *
- * @access public
- * @param string Message
- * @return void
- */
- public function searchAdvancedForm( $msg='', $removed_search_terms=array() )
- {
- /* Get any application specific filters */
- $filters_html = '';
-
- foreach( ipsRegistry::$applications as $app )
- {
- if( IPSSearchIndex::appisSearchable( $app['app_directory'] ) )
- {
- require_once( IPSLib::getAppDir( $app['app_directory'] ) . '/extensions/searchDisplay.php' );
- $_class = $app['app_directory'] . 'SearchDisplay';
-
- if( class_exists( $_class ) )
- {
- $search_display_plugin = new $_class();
- $filters_html .= $search_display_plugin->getFilterHTML();
- }
- }
- }
-
- /* Output */
- $this->title = $this->lang->words['search_form'];
- $this->registry->output->addNavigation( $this->lang->words['search_form'], '' );
- $this->output .= $this->registry->output->getTemplate( 'search' )->searchAdvancedForm( $filters_html, $msg, $removed_search_terms );
- }
-
- /**
- * Processes a search request
- *
- * @access public
- * @return void
- */
- public function searchResults()
- {
- /* Search Term */
- $asForum = ( method_exists( $this->search_plugin, 'getShowAsForum' ) ) ? $this->_getShowAsForum() : false;
- $search_term = str_replace( """, '"', IPSText::parseCleanValue( rawurldecode( $this->request['search_term'] ) ) );
- $search_term = str_replace( "&", '&', $search_term );
- $removedTerms = array();
-
- /* Did we come in off a post request? */
- if ( $this->request['request_method'] == 'post' )
- {
- /* Set a no-expires header */
- $this->registry->getClass('output')->setCacheExpirationSeconds( 30 * 60 );
- }
-
- /* Sort some form elements out */
- $this->request['search_sort_by'] = ( $this->request['search_sort_by'] && $this->request['search_sort_by'] != 'date' ) ? 'relevance' : 'date';
- $this->request['search_sort_order'] = ( $this->request['search_sort_order'] && $this->request['search_sort_order'] != 'desc' ) ? 'asc' : 'desc';
-
- /* Check for disallowed search terms */
- while( preg_match_all( "/(?:^|\s+)(img|quote|code|html|javascript|a href|color|span|div|border|style)(?:\s+|$)/", $search_term, $removed_search_terms ) )
- {
- $removedTerms[] = $removed_search_terms[0][0];
- $search_term = preg_replace( "/(?:^|\s+)(?:img|quote|code|html|javascript|a href|color|span|div|border|style)(?:\s+|$)/", '', $search_term );
- }
-
- /* Remove some formatting */
- //$search_term = str_replace( array( '|', '\\', '/' ), '', $search_term );
- // | is an OR operator for sphinx - don't want to block globally
- $search_term = str_replace( array( '\\', '/' ), '', $search_term );
-
- if( ( $this->settings['min_search_word'] && strlen( $search_term ) < $this->settings['min_search_word'] ) && ! $this->request['search_author'] )
- {
- $this->searchAdvancedForm( sprintf( $this->lang->words['search_term_short'], $this->settings['min_search_word'] ), $removedTerms );
- return;
- }
-
- /* Save date for the form */
- $this->request['_search_date_start'] = $this->request['search_date_start'];
- $this->request['_search_date_end'] = $this->request['search_date_end'];
-
- /* Default End Date */
- if( $this->request['search_date_start'] && ! $this->request['search_date_end'] )
- {
- $this->request['search_date_end'] = 'now';
- }
-
- /* Do some date checking */
- if( strtotime( IPSText::monthNameRu2En($this->request['search_date_start']) ) > strtotime( IPSText::monthNameRu2En($this->request['search_date_end']) ) )
- {
- $this->searchAdvancedForm( $this->lang->words['search_invalid_date_range'] );
- return;
- }
-
- /*if( strtotime( $this->request['search_date_start'] ) > time() || strtotime( $this->request['search_date_end'] ) > time() )
- {
- $this->searchAdvancedForm( $this->lang->words['search_invalid_date_future'] );
- return;
- }*/
-
- if( strtotime( IPSText::monthNameRu2En( $this->request['search_date_start'] ) ) > time() )
- {
- $this->request['search_date_start'] = 'now';
- }
-
- if( strtotime( IPSText::monthNameRu2En( $this->request['search_date_end'] ) ) > time() )
- {
- $this->request['search_date_end'] = 'now';
- }
-
- /* Cleanup */
- $this->request['search_higlight'] = str_replace( '.', '', $this->request['search_term'] );
-
- /* Search Flood Check */
- if( $this->memberData['g_search_flood'] )
- {
- /* Check for a cookie */
- $last_search = IPSCookie::get( 'sfc' );
- $last_term = str_replace( """, '"', IPSCookie::get( 'sfct' ) );
- $last_term = str_replace( "&", '&', $last_term );
-
- /* If we have a last search time, check it */
- if( $last_search && $last_term )
- {
- if( ( time() - $last_search ) <= $this->memberData['g_search_flood'] && $last_term != $search_term )
- {
- $this->searchAdvancedForm( sprintf( $this->lang->words['xml_flood'], $this->memberData['g_search_flood'] ) );
- return;
- }
- else
- {
- /* Reset the cookie */
- IPSCookie::set( 'sfc', time() );
- IPSCookie::set( 'sfct', $search_term );
- }
- }
- /* Set the cookie */
- else
- {
- IPSCookie::set( 'sfc', time() );
- IPSCookie::set( 'sfct', $search_term );
- }
- }
-
- /**
- * Ok this is an upper limit.
- * If you needed to change this, you could do so via conf_global.php by adding:
- * $INFO['max_search_word'] = #####;
- */
- $this->settings['max_search_word'] = $this->settings['max_search_word'] ? $this->settings['max_search_word'] : 300;
-
- if( $this->settings['max_search_word'] && strlen( $search_term ) > $this->settings['max_search_word'] )
- {
- $this->searchAdvancedForm( sprintf( $this->lang->words['search_term_long'], $this->settings['max_search_word'] ) );
- return;
- }
-
- /* Search titles only? */
- $content_titles_only = isset( $this->request['content_title_only'] ) && $this->request['content_title_only'] ? true : false;
-
- /* Show as titles? */
- if( ( $this->request['show_as_titles'] AND $this->settings['enable_show_as_titles'] ) OR ( $content_titles_only ) )
- {
- $this->search_plugin->onlyTitles = true;
- }
-
- /* Check for application restriction */
- $search_app_filter = array();
- $traditionalkey = '';
-
- if( isset( $this->request['search_filter_app'] ) && is_array( $this->request['search_filter_app'] ) )
- {
- if( ! in_array( $this->settings['search_method'], array( 'traditional', 'sphinx' ) ) )
- {
- /* Bypass all this if we are searching all apps */
- if( $this->request['search_filter_app']['all'] != 1 )
- {
- foreach( $this->request['search_filter_app'] as $app => $checked )
- {
- /* Bypass the all filter */
- if( $app == 'all' )
- {
- continue;
- }
-
- /* Add to the array */
- if( $checked )
- {
- $search_app_filter[] = "'$app'";
- }
- }
-
- /* Add this condition to the search */
- $this->search_plugin->setCondition( 'app', 'IN', implode( ',', $search_app_filter ) );
- }
- }
- else
- {
- foreach( $this->request['search_filter_app'] as $app => $checked )
- {
- $traditionalKey = $app;
- }
- }
- }
-
- /* Check for an author filter */
- if( isset( $this->request['search_author'] ) && $this->request['search_author'] )
- {
- /* Query the member id */
- $mem = $this->DB->buildAndFetch( array(
- 'select' => 'member_id',
- 'from' => 'members',
- 'where' => "members_display_name='{$this->request['search_author']}'"
- ) );
-
- $this->search_plugin->searchAuthor = true;
-
- /* Add the condition to our search */
- $this->search_plugin->setCondition( 'member_id', '=', $mem['member_id'] ? $mem['member_id'] : -1 );
- }
-
- /* Check for application specific filters */
- if( isset( $this->request['search_app_filters'] ) && is_array( $this->request['search_app_filters'] ) )
- {
- foreach( $this->request['search_app_filters'] as $app => $filter_data )
- {
- if( ! isset( $this->search_plugin->display_plugins[ $app ] ) )
- {
- $this->search_plugin->display_plugins[ $app ] = IPSSearchIndex::getSearchDisplayPlugin( $app );
- $this->search_plugin->display_plugins[ $app ]->search_plugin = $this->search_plugin;
- }
-
- $filter_data = $this->search_plugin->display_plugins[ $app ]->buildFilterSQL( $filter_data );
-
- if( $filter_data )
- {
- if ( isset( $filter_data[0] ) )
- {
- foreach( $filter_data as $_data )
- {
- $this->search_plugin->setCondition( $_data['column'], $_data['operator'], $_data['value'], 'AND' );
- }
- }
- else
- {
- $this->search_plugin->setCondition( $filter_data['column'], $filter_data['operator'], $filter_data['value'], 'OR' );
- }
- }
- }
- }
-
- /* Check Date Range */
- if( isset( $this->request['search_date_start'] ) && $this->request['search_date_start'] || isset( $this->request['search_date_end'] ) && $this->request['search_date_end'] )
- {
- /* Start Range Date */
- $search_date_start = 0;
-
- if( $this->request['search_date_start'] )
- {
- $search_date_start = strtotime( IPSText::monthNameRu2En( $this->request['search_date_start'] ) );
- }
-
- /* End Range Date */
- $search_date_end = 0;
-
- if( $this->request['search_date_end'] )
- {
- $search_date_end = strtotime( IPSText::monthNameRu2En( $this->request['search_date_end'] ) );
- }
-
- /* Correct for timezone...hopefully */
- $search_date_start += abs( $this->registry->class_localization->getTimeOffset() );
- $search_date_end += abs( $this->registry->class_localization->getTimeOffset() );
-
- /* If the times are exactly equaly, we're going to assume they are trying to search all posts from one day */
- if( ( $search_date_start && $search_date_end ) && $search_date_start == $search_date_end )
- {
- $search_date_end += 86400;
- }
-
- $this->search_plugin->setDateRange( $search_date_start, $search_date_end );
- }
-
- /* If we're display results as a forum*/
- /* Count the number of results */
- $total_results = $this->search_plugin->getSearchCount( $search_term, '', $content_titles_only, array( $st, $per_page ), $this->request['search_sort_by'], $this->request['search_sort_order'] );
-
- /* Do Pagination Stuff */
- $st = isset( $this->request['st'] ) ? intval( $this->request['st'] ) : 0;
- $per_page = $this->settings['search_per_page'] ? $this->settings['search_per_page'] : 25;
-
- $links = $this->registry->output->generatePagination( array(
- 'totalItems' => $total_results,
- 'itemsPerPage' => $per_page,
- 'currentStartValue' => $st,
- 'baseUrl' => $this->_buildURLString() . '&search_filter_app[' . $traditionalKey . ']=1',
- ) );
-
- /* Showing */
- $showing = array( 'start' => $st + 1, 'end' => ( $st + $per_page ) > $total_results ? $total_results : $st + $per_page );
-
- /* Loop through the search results and build the output */
- $search_entries = array();
- $search_results = array();
- $topic_ids = array();
-
- /**
- * If we've already run a search and it's not clear, kill it now
- */
- if( $this->member->sessionClass()->session_data['search_thread_id'] )
- {
- $this->DB->return_die = true;
- $this->DB->kill( $this->member->sessionClass()->session_data['search_thread_id'] );
- $this->DB->return_die = false;
- }
-
- /**
- * Store the process id
- */
- $processId = $this->DB->getThreadId();
-
- if( $processId )
- {
- $this->DB->update( 'sessions', array( 'search_thread_id' => $processId, 'search_thread_time' => time() ), "id='" . $this->member->session_id . "'" );
- }
-
- /* Do the search */
- foreach( $this->search_plugin->getSearchResults( $search_term, array( $st, $per_page ), $this->request['search_sort_by'], '', $content_titles_only, $this->request['search_sort_order'] ) as $r )
- {
- /* Hack Job */
- if( $r['app'] == 'forums' && $r['type_2'] == 'topic' && $r['type_id_2'] )
- {
- $topic_ids[] = $r['type_id_2'];
- }
-
- /* Add to the entries array */
- $search_entries[] = $r;
- }
-
- /**
- * And kill that process ID
- */
- if( $processId )
- {
- $this->DB->update( 'sessions', array( 'search_thread_id' => 0, 'search_thread_time' => 0 ), "id='" . $this->member->session_id . "'" );
- }
-
- /* Get dots */
- $this->_retrieveTopics( $topic_ids );
-
- /* Parse results */
- foreach( $search_entries as $r )
- {
- $search_results[] = $this->_parseSearchResult( $r, $search_term );
- }
-
- /* Extra vars */
- $limited = ( isset( $this->search_plugin->hardLimit ) ) ? $this->search_plugin->hardLimit : 0;
- $wasLimited = ( isset( $this->search_plugin->resultsCutToLimit ) ) ? $this->search_plugin->resultsCutToLimit : false;
-
- /* Output */
- $this->title = $this->lang->words['search_results'];
- $this->output .= $this->registry->output->getTemplate( 'search' )->searchResults( $search_results, $links, $total_results, $showing, $search_term, $this->_buildURLString(), $traditionalKey, $removed_search_terms[0], $asForum, $limited, $wasLimited );
- }
-
- /**
- * Displays the active topics screen
- *
- * @access public
- * @return void
- */
- public function activeContent()
- {
- $this->search_plugin->onlyTitles = true;
-
- /* Check for application restriction */
- $search_app_filter = array();
-
- if( isset( $this->request['search_filter_app'] ) && is_array( $this->request['search_filter_app'] ) )
- {
- if( ! in_array( $this->settings['search_method'], array( 'traditional', 'sphinx' ) ) )
- {
- /* Bypass all this if we are searching all apps */
- if( $this->request['search_filter_app']['all'] != 1 )
- {
- foreach( $this->request['search_filter_app'] as $app => $checked )
- {
- /* Bypass the all filter */
- if( $app == 'all' )
- {
- continue;
- }
-
- /* Add to the array */
- if( $checked )
- {
- $search_app_filter[] = "'$app'";
- }
- }
-
- /* Add this condition to the search */
- $this->search_plugin->setCondition( 'app', 'IN', implode( ',', $search_app_filter ) );
- }
- }
- }
-
- /* Exclude forums */
- if( $this->settings['vnp_block_forums'] )
- {
- if( $this->request['search_app'] == 'forums' )
- {
- $this->search_plugin->setCondition( 't.forum_id', 'NOT IN', $this->settings['vnp_block_forums'] );
- }
- }
-
- /* Do we have a period? */
- switch( $this->request['period'] )
- {
- case 'today':
- default:
- $date = 86400; // 24 hours
-
- $this->request['period'] = empty($this->request['period']) ? 'today' : $this->request['period'];
- break;
-
- case 'week':
- $date = 604800; // 1 week
- break;
-
- case 'weeks':
- $date = 1209600; // 2 weeks
- break;
-
- case 'month':
- $date = 2592000; // 30 days
- break;
-
- case 'months':
- $date = 15552000; // 6 months
- break;
-
- case 'year':
- $date = 31536000; // 365 days
- break;
- }
-
- /* Set Date Range */
- $this->search_plugin->setDateRange( time() - $date, time() );
-
- /* Count the number of results */
- $total_results = $this->search_plugin->getSearchCount( '', '', true );
-
- /* Do Pagination Stuff */
- $st = isset( $this->request['st'] ) ? intval( $this->request['st'] ) : 0;
- $per_page = $this->settings['search_per_page'] ? $this->settings['search_per_page'] : 25;
-
- /* Add in application filter url bit */
- $urlbit = '';
-
- if( isset( $this->request['search_filter_app'] ) && is_array( $this->request['search_filter_app'] ) && count( $this->request['search_filter_app'] ) )
- {
- foreach( $this->request['search_filter_app'] as $app => $checked )
- {
- $urlbit .= "&search_filter_app[{$app}]={$checked}";
- }
- }
-
- $urlbit .= "&period={$this->request['period']}";
-
- $links = $this->registry->output->generatePagination( array(
- 'totalItems' => $total_results,
- 'itemsPerPage' => $per_page,
- 'currentStartValue' => $st,
- 'baseUrl' => 'app=core&module=search&do=active' . $urlbit,
- ) );
-
- /* Showing */
- $showing = array( 'start' => $st + 1, 'end' => ( $st + $per_page ) > $total_results ? $total_results : $st + $per_page );
-
- /* Loop through the search results and build the output */
- $search_entries = array();
- $search_results = array();
- $topic_ids = array();
-
- foreach( $this->search_plugin->getSearchResults( '', array( $st, $per_page ), 'date', '', true ) as $r )
- {
- /* Hack Job */
- if( $r['app'] == 'forums' && $r['type_2'] == 'topic' )
- {
- $topic_ids[] = $r['type_id_2'];
- }
-
- /* Add to the entries array */
- $search_entries[] = $r;
- }
-
- /* Get dots */
- $this->_retrieveTopics( $topic_ids );
-
- /* Parse results */
- foreach( $search_entries as $r )
- {
- $search_results[] = $this->_parseSearchResult( $r );
- }
-
- /* Output */
- $this->title = $this->lang->words['active_posts_title'];
- $this->registry->output->addNavigation( $this->lang->words['active_posts_title'], '' );
- $this->output .= $this->registry->output->getTemplate( 'search' )->activePostsView( $search_results, $links, $total_results, ( method_exists( $this->search_plugin, 'getShowAsForum' ) ) ? $this->_getShowAsForum() : false );
- }
-
- /**
- * Displays latest user content
- *
- * @access public
- * @return void
- */
- public function viewUserContent()
- {
- /* INIT */
- $id = intval( $this->request['mid'] );
- $member = IPSMember::load( $id, 'core' );
- $beginStamp = 0;
-
- /* Content Title Only? */
- $this->search_plugin->onlyTitles = $this->request['view_by_title'] == 1 ? true : false;
-
- /* Set flag for viewing author content */
- $this->search_plugin->searchAuthor = true;
-
- /* Set the member_id */
- $this->search_plugin->setCondition( 'member_id', '=', $id );
-
- /* Check for application restriction */
- $search_app_filter = array();
-
- if( isset( $this->request['search_filter_app'] ) && is_array( $this->request['search_filter_app'] ) )
- {
- if( ! in_array( $this->settings['search_method'], array( 'traditional', 'sphinx' ) ) )
- {
- /* Bypass all this if we are searching all apps */
- if( $this->request['search_filter_app']['all'] != 1 )
- {
- foreach( $this->request['search_filter_app'] as $app => $checked )
- {
- /* Bypass the all filter */
- if( $app == 'all' )
- {
- continue;
- }
-
- /* Add to the array */
- if( $checked )
- {
- $search_app_filter[] = "'$app'";
- }
- }
-
- /* Add this condition to the search */
- $this->search_plugin->setCondition( 'app', 'IN', implode( ',', $search_app_filter ) );
- }
- }
- }
-
- /* Cut by date for efficiency? */
- if ( $this->settings['search_ucontent_days'] AND method_exists( $this->search_plugin, 'setBeginTimeStamp' ) )
- {
- $this->search_plugin->setBeginTimeStamp( ( $member['last_post'] ? $member['last_post'] : time() ) - 86400 * intval( $this->settings['search_ucontent_days'] ) );
-
- if ( method_exists( $this->search_plugin, 'getBeginTimeStamp' ) )
- {
- $beginStamp = $this->search_plugin->getBeginTimeStamp();
- }
- }
-
- /* Count the number of results */
- $total_results = $this->search_plugin->getSearchCount( '', '', $this->search_plugin->onlyTitles );
-
- /* Do Pagination Stuff */
- $st = isset( $this->request['st'] ) ? intval( $this->request['st'] ) : 0;
- $per_page = $this->settings['search_per_page'] ? $this->settings['search_per_page'] : 25;
-
- /* Add in application filter url bit */
- $urlbit = '';
- if( isset( $this->request['search_filter_app'] ) && is_array( $this->request['search_filter_app'] ) && count( $this->request['search_filter_app'] ) )
- {
- foreach( $this->request['search_filter_app'] as $app => $checked )
- {
- $urlbit .= "&search_filter_app[{$app}]={$checked}";
- }
- }
- if( $this->request['view_by_title'] == 1 )
- {
- $urlbit .= '&view_by_title=1';
- }
-
- $links = $this->registry->output->generatePagination( array(
- 'totalItems' => $total_results,
- 'itemsPerPage' => $per_page,
- 'currentStartValue' => $st,
- 'baseUrl' => 'app=core&module=search&do=user_posts&mid=' . $id . $urlbit,
- ) );
-
- /* Showing */
- $showing = array( 'start' => $st + 1, 'end' => ( $st + $per_page ) > $total_results ? $total_results : $st + $per_page );
-
- /* Loop through the search results and build the output */
- $search_entries = array();
- $search_results = array();
- $topic_ids = array();
-
- foreach( $this->search_plugin->getSearchResults( '', array( $st, $per_page ), 'date', '', $this->search_plugin->onlyTitles ) as $r )
- {
- /* Hack Job */
- if( $r['app'] == 'forums' && $r['type_2'] == 'topic' )
- {
- $topic_ids[] = $r['type_id_2'];
- }
-
- /* Add to the entries array */
- $search_entries[] = $r;
- }
-
- /* Get dots */
- $this->_retrieveTopics( $topic_ids );
-
- /* Parse results */
- foreach( $search_entries as $r )
- {
- $search_results[] = $this->_parseSearchResult( $r );
- }
-
- /* Extra vars */
- $limited = ( isset( $this->search_plugin->hardLimit ) ) ? $this->search_plugin->hardLimit : 0;
- $wasLimited = ( isset( $this->search_plugin->resultsCutToLimit ) ) ? $this->search_plugin->resultsCutToLimit : false;
-
- /* Output */
- $this->lang->words['user_posts_title'] = sprintf( $this->lang->words['user_posts_title'] , ( ($this->request['view_by_title'] && $this->request['search_app'] == 'forums') ? $this->lang->words['user_posts_title_topics'] : $this->lang->words['user_posts_title_posts'] ), $member['members_display_name'] );
-
- $this->title = $this->lang->words['user_posts_title'];
- $this->registry->output->addNavigation( $this->lang->words['user_posts_title'], '' );
- $this->output .= $this->registry->output->getTemplate( 'search' )->userPostsView( $search_results, $links, $total_results, $member, ( method_exists( $this->search_plugin, 'getShowAsForum' ) ) ? $this->_getShowAsForum() : false, $limited, $wasLimited, $beginStamp );
- }
-
- /**
- * View new posts since your last visit
- *
- * @access public
- * @return void
- */
- public function viewNewPosts()
- {
- $this->search_plugin->onlyTitles = true;
- $_METHOD = ( method_exists( $this->search_plugin, 'viewNewPosts_count' ) && method_exists( $this->search_plugin, 'viewNewPosts_fetch' ) ) ? 'custom' : 'standard';
- $asForum = ( method_exists( $this->search_plugin, 'getShowAsForum' ) ) ? $this->_getShowAsForum() : false;
-
- /* Do we have a manual method? */
- if ( $_METHOD == 'custom' )
- {
- $total_results = $this->search_plugin->viewNewPosts_count();
- }
- else
- {
- /* Call the unread items function */
- $this->search_plugin->setUnreadConditions();
-
- /* Check for application restriction */
- $search_app_filter = array();
-
- if( isset( $this->request['search_filter_app'] ) && is_array( $this->request['search_filter_app'] ) )
- {
- if( ! in_array( $this->settings['search_method'], array( 'traditional', 'sphinx' ) ) )
- {
- /* Bypass all this if we are searching all apps */
- if( $this->request['search_filter_app']['all'] != 1 )
- {
- foreach( $this->request['search_filter_app'] as $app => $checked )
- {
- /* Bypass the all filter */
- if( $app == 'all' )
- {
- continue;
- }
-
- /* Add to the array */
- if( $checked )
- {
- $search_app_filter[] = "'$app'";
- }
- }
-
- /* Add this condition to the search */
- $this->search_plugin->setCondition( 'app', 'IN', implode( ',', $search_app_filter ) );
- }
- }
- }
-
- /* Exclude forums */
- if( $this->settings['vnp_block_forums'] )
- {
- if( $this->request['search_app'] == 'forums' )
- {
- $this->search_plugin->setCondition( 't.forum_id', 'NOT IN', $this->settings['vnp_block_forums'] );
- }
- }
-
- /* Only Titles */
- //$this->search_plugin->setCondition( 'content_title', '<>', "''" );
- $group_by = '';
-
- if( $this->request['search_app'] == 'forums' )
- {
- $group_by = 'topic_id';
- }
-
- if( !$this->search_plugin->removeMe )
- {
- /* Count the number of results */
- $total_results = $this->search_plugin->getSearchCount( '', '', true );
- }
- else
- {
- $total_results = 0;
- }
- }
-
- /* Do Pagination Stuff */
- $st = isset( $this->request['st'] ) ? intval( $this->request['st'] ) : 0;
- $per_page = $this->settings['search_per_page'] ? $this->settings['search_per_page'] : 25;
-
- /* Add in application filter url bit */
- $urlbit = '';
- if( isset( $this->request['search_filter_app'] ) && is_array( $this->request['search_filter_app'] ) && count( $this->request['search_filter_app'] ) )
- {
- foreach( $this->request['search_filter_app'] as $app => $checked )
- {
- $urlbit .= "&search_filter_app[{$app}]={$checked}";
- }
- }
-
- $links = $this->registry->output->generatePagination( array(
- 'totalItems' => $total_results,
- 'itemsPerPage' => $per_page,
- 'currentStartValue' => $st,
- 'baseUrl' => 'app=core&module=search&do=new_posts' . $urlbit,
- ) );
-
- /* Showing */
- $showing = array( 'start' => $st + 1, 'end' => ( $st + $per_page ) > $total_results ? $total_results : $st + $per_page );
-
- /* Loop through the search results and build the output */
- $search_entries = array();
- $search_results = array();
- $topic_ids = array();
-
- /* Do we have a manual method? */
- if ( $_METHOD == 'custom' )
- {
- $search_entries = $this->search_plugin->viewNewPosts_fetch( array( $st, $per_page ) );
-
- foreach( $search_entries as $data )
- {
- $topic_ids[] = $data['tid'];
- }
-
- }
- else
- {
- if( !$this->search_plugin->removeMe )
- {
- foreach( $this->search_plugin->getSearchResults( '', array( $st, $per_page ), 'date', '', true ) as $r )
- {
- /* Hack Job */
- if( $r['app'] == 'forums' && $r['type_2'] == 'topic' )
- {
- $topic_ids[] = $r['type_id_2'];
- }
-
- /* Add to the entries array */
- $search_entries[] = $r;
- }
- }
- }
-
- /* Get dots */
- $this->_retrieveTopics( $topic_ids );
-
- /* Parse results */
- foreach( $search_entries as $r )
- {
- $search_results[] = $this->_parseSearchResult( $r, '', true );
- }
-
- /* Output */
- $this->title = $this->lang->words['new_posts_title'];
- $this->registry->output->addNavigation( $this->lang->words['new_posts_title'], '' );
- $this->output .= $this->registry->output->getTemplate( 'search' )->newPostsView( $search_results, $links, $total_results, $asForum );
- }
-
- /**
- * Retrieve the topic array
- *
- * @access private
- * @param array Topic ids
- * @return void
- */
- private function _retrieveTopics( $ids )
- {
- /* Query posts - this is so the stupid "you have posted" dot shows up on topic icons */
- $this->_topicArray = array();
-
- if( ! $this->settings['show_user_posted'] )
- {
- return;
- }
-
- if( count( $ids ) )
- {
- $this->DB->build( array(
- 'select' => 'author_id, topic_id',
- 'from' => 'posts',
- 'where' => 'author_id=' . $this->memberData['member_id'] . ' AND topic_id IN(' . implode( ',', $ids ) . ')',
- ) );
-
- $this->DB->execute();
-
- while( $p = $this->DB->fetch() )
- {
- $this->_topicArray[ $p['topic_id'] ] = $p['author_id'];
- }
- }
- }
-
- /**
- * Parse a common search result
- *
- * @access private
- * @param array $r Search result
- * @param string $search_term Keywords searched for
- * @param bool $isVnc Is from view new content
- * @return array $search_result Search result for template
- */
- private function _parseSearchResult( $r, $search_term='', $isVnc=false )
- {
- /* Forum stuff */
- $sub = false;
- $r['_topic_array'] = $this->_topicArray;
-
- /* If basic search, strip the content */
- IPSText::getTextClass( 'bbcode' )->parse_wordwrap = 0;
- IPSText::getTextClass( 'bbcode' )->parse_bbcode = 0;
- IPSText::getTextClass( 'bbcode' )->strip_quotes = 1;
- IPSText::getTextClass( 'bbcode' )->parsing_section = 'topics';
- IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $r['member_group_id'];
- IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $r['mgroup_others'];
-
- $r['content'] = strip_tags( IPSText::getTextClass( 'bbcode' )->stripAllTags( $r['content'] ) );
- $r['content'] = str_replace( array( '<br>', '<br />' ), '', $r['content'] );
- $r['content'] = trim( str_replace( array( "\n\n\n", "\n\n" ), "\n", str_replace( "\r", '', $r['content'] ) ) );
-
- /* Highlight */
- $r['content'] = IPSText::searchHighlight( $this->_searchTruncate( $r['content'], $search_term ), $search_term );
- $r['content_title'] = ( ! $this->search_plugin->onlyPosts AND $this->_getShowAsForum() === false ) ? IPSText::searchHighlight( $r['content_title'], $search_term ) : $r['content_title'];
-
- /* Check to see if the display plugin is loaded */
- if( ! isset( $this->search_plugin->display_plugins[ $r['app'] ] ) )
- {
- $this->search_plugin->display_plugins[ $r['app'] ] = IPSSearchIndex::getSearchDisplayPlugin( $r['app'] );
- $this->search_plugin->display_plugins[ $r['app'] ]->search_plugin = $this->search_plugin;
- }
-
- /* Return the formatted result */
- if( isset( $this->search_plugin->display_plugins[ $r['app'] ] ) && is_object( $this->search_plugin->display_plugins[ $r['app'] ] ) )
- {
- $return = $this->search_plugin->display_plugins[ $r['app'] ]->formatContent( $r, $isVnc );
-
- if( is_array( $return ) )
- {
- $html = $return[0];
- $sub = $return[1];
- }
- else
- {
- $html = $return;
- }
- }
- else
- {
- $html = $this->registry->output->getTemplate( 'search' )->searchRowGenericFormat( $r );
- }
-
- return array( 'html' => $html, 'app' => $r['app'], 'type' => $r['type'], 'sub' => $sub );
- }
-
- /**
- * Function to trim the search result display around the the hit
- *
- * @access private
- * @param string $haystack Full search result
- * @param string $needle The search term
- * @return string
- **/
- private function _searchTruncate( $haystack, $needle )
- {
- /* Base on words */
- $haystack = explode( " ", $haystack );
-
- if( count( $haystack ) > 21 )
- {
- $_term_at = $this->searchInArray( $needle, $haystack );
-
- if( $_term_at - 11 > 0 )
- {
- $begin = array_splice( $haystack, 0, $_term_at - 11 );
-
- /* The term position will have changed now */
- $_term_at = $this->searchInArray( $needle, $haystack );
- }
-
- if( $_term_at + 11 < count( $haystack ) )
- {
- $end = array_splice( $haystack, $_term_at + 11, count( $haystack ) );
- }
- }
- else
- {
- $begin = array();
- $end = array();
- }
-
- $haystack = implode( " ", $haystack );
-
- if( is_array( $begin ) && count( $begin ) )
- {
- $haystack = '...' . $haystack;
- }
-
- if( is_array( $end ) && count( $end ) )
- {
- $haystack = $haystack . '...';
- }
-
- return $haystack;
- }
-
- /**
- * Search array (array_search only finds exact instances)
- *
- * @access protected
- * @param string "Needle"
- * @param array Array of entries to search
- * @return mixed Key of array, or false on failure
- */
- protected function searchInArray( $needle, $haystack )
- {
- if( !is_array( $haystack ) OR !count($haystack) OR ! $needle )
- {
- return false;
- }
-
- foreach( $haystack as $k => $v )
- {
- if( $v AND strpos( $v, $needle ) !== false )
- {
- return $k;
- }
- }
-
- return false;
- }
-
- /**
- * Returns a url string that will maintain search results via links
- *
- * @access private
- * @return string
- */
- private function _buildURLString()
- {
- /* INI */
- $url_string = 'app=core&module=search&do=quick_search';
-
- /* Add author name */
- if( isset( $this->request['search_author'] ) )
- {
- $url_string .= "&search_author=" . urlencode($this->request['search_author']);
- }
-
- /* Add titles only */
- if( isset( $this->request['show_as_titles'] ) )
- {
- $url_string .= "&show_as_titles={$this->request['show_as_titles']}";
- }
-
- /* Search Range */
- if( isset( $this->request['search_date_start'] ) )
- {
- $url_string .= "&search_date_start={$this->request['search_date_start']}";
- }
-
- if( isset( $this->request['search_date_end'] ) )
- {
- $url_string .= "&search_date_end={$this->request['search_date_end']}";
- }
-
- /* Search app filters */
- if( isset( $this->request['search_app_filters'] ) && count( $this->request['search_app_filters'] ) )
- {
- foreach( $this->request['search_app_filters'] as $app => $filter_data )
- {
- if( is_array( $filter_data ) )
- {
- foreach( $filter_data as $k => $v )
- {
- if ( is_array( $v ) )
- {
- foreach( $v as $_k => $_v )
- {
- $url_string .= "&search_app_filters[{$app}][{$k}][$_k]={$_v}";
- }
- }
- else
- {
- $url_string .= "&search_app_filters[{$app}][{$k}]={$v}";
- }
- }
- }
- else
- {
- $url_string .= "&search_app_filters[{$app}]={$v}";
- }
- }
- }
-
- /* Search sort by */
- if( isset( $this->request['search_sort_by'] ) )
- {
- $url_string .= "&search_sort_by={$this->request['search_sort_by']}";
- }
-
- if( isset( $this->request['search_sort_order'] ) )
- {
- $url_string .= "&search_sort_order={$this->request['search_sort_order']}";
- }
-
- /* Add in application filter */
- /*if( isset( $this->request['search_filter_app'] ) && is_array( $this->request['search_filter_app'] ) && count( $this->request['search_filter_app'] ) )
- {
- foreach( $this->request['search_filter_app'] as $app => $checked )
- {
- $url_string .= "&search_filter_app[{$app}]={$checked}";
- }
- }*/
-
- if( isset( $this->request['content_title_only'] ) && $this->request['content_title_only'] )
- {
- $url_string .= "&content_title_only=1";
- }
-
- if( isset( $this->request['type'] ) && isset( $this->request['type_id'] ) )
- {
- $url_string .= "&type={$this->request['type']}&type_id={$this->request['type_id']}";
- }
-
- if( isset( $this->request['type_2'] ) && isset( $this->request['type_id_2'] ) )
- {
- $url_string .= "&type_2={$this->request['type_2']}&type_id_2={$this->request['type_id_2']}";
- }
-
- /* Fix up the search term a bit */
- $_search_term = str_replace( '&', '&', $this->request['search_term'] );
- $_search_term = str_replace( '"', '"', $_search_term );
- $_search_term = str_replace( '>', '>', $_search_term );
- $_search_term = str_replace( '<', '<', $_search_term );
- $_search_term = str_replace( '$', '$', $_search_term );
-
- $url_string .= '&search_term=' . urlencode( $_search_term );
-
- return $url_string;
- }
-
- /**
- * Checks to see if the logged in user is allowed to use the search system
- *
- * @access private
- * @return void
- */
- private function _canSearch()
- {
- /* Check the search setting */
- if( ! $this->settings['allow_search'] )
- {
- if( $this->xml_out )
- {
- @header( "Content-type: text/html;charset={$this->settings['gb_char_set']}" );
- print $this->lang->words['search_off'];
- exit();
- }
- else
- {
- $this->registry->output->showError( 'search_off', 10145 );
- }
- }
-
- /* Check the member authorization */
- if( ! isset( $this->memberData['g_use_search'] ) || ! $this->memberData['g_use_search'] )
- {
- if( $this->xml_out )
- {
- @header( "Content-type: text/html;charset={$this->settings['gb_char_set']}" );
- print $this->lang->words['no_xml_permission'];
- exit();
- }
- else
- {
- $this->registry->output->showError( 'no_permission_to_search', 10146 );
- }
- }
- }
-
- /**
- * Wrapper function to prevent fatal errors if method does not support this function
- *
- * @access private
- * @return boolean
- */
- private function _getShowAsForum()
- {
- if ( method_exists( $this->search_plugin, 'getShowAsForum' ) )
- {
- return $this->search_plugin->getShowAsForum();
- }
- else
- {
- return false;
- }
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * Global Search
+ * Last Updated: $Date: 2010-11-17 03:11:07 -0500 (Wed, 17 Nov 2010) $
+ *
+ *
+ * @author $Author: mmecham $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 7200 $
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class public_core_search_search extends ipsCommand
+{
+ /**
+ * Generated output
+ *
+ * @var string
+ */
+ private $output = '';
+
+ /**
+ * Page Title
+ *
+ * @var string
+ */
+ private $title = '';
+
+ /**
+ * Object to handle searches
+ *
+ * @var string
+ */
+ private $search_plugin = '';
+
+ /**
+ * Topics array
+ *
+ * @var array
+ */
+ private $_topicArray = array();
+ private $_removedTerms = array();
+
+ /**
+ * Search controller
+ *
+ * @var obj
+ */
+ private $searchController;
+ private $_session;
+
+ /**
+ * Class entry point
+ *
+ * @param object Registry reference
+ * @return void [Outputs to screen/redirects]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ /* Load language */
+ $this->registry->class_localization->loadLanguageFile( array( 'public_search' ), 'core' );
+ $this->registry->class_localization->loadLanguageFile( array( 'public_forums', 'public_topic' ), 'forums' );
+
+ /* Reset engine type */
+ $this->settings['search_method'] = ( $this->settings['search_method'] == 'traditional' ) ? 'sql' : $this->settings['search_method'];
+
+ /* Special consideration for contextual search */
+ if ( isset( $this->request['search_app'] ) AND strstr( $this->request['search_app'], ':' ) )
+ {
+ list( $app, $type, $id ) = explode( ':', $this->request['search_app'] );
+
+ $this->request['search_app'] = $app;
+ $this->request['cType'] = $type;
+ $this->request['cId'] = $id;
+ }
+ else
+ {
+ /* Force forums as default search */
+ $this->request['search_in'] = ( $this->request['search_in'] AND IPSLib::appIsSearchable( $this->request['search_in'], 'search' ) ) ? $this->request['search_in'] : 'forums';
+ $this->request['search_app'] = $this->request['search_app'] ? $this->request['search_app'] : $this->request['search_in'];
+ }
+
+ /* Check Access */
+ $this->_canSearch();
+
+ /* Start session - needs to be called before the controller is initiated */
+ $this->_startSession();
+
+ /* Load the controller */
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH. 'sources/classes/search/controller.php', 'IPSSearch' );
+
+ /* Sanitzie */
+ if ( ! is_string( $this->request['search_app'] ) )
+ {
+ $this->request['search_app'] = '';
+ }
+
+ try
+ {
+ $this->searchController = new $classToLoad( $registry, $this->settings['search_method'], $this->request['search_app'] );
+ }
+ catch( Exception $error )
+ {
+ $msg = $error->getMessage();
+
+ /* Start session */
+ $this->_endSession();
+
+ switch( $msg )
+ {
+ case 'NO_SUCH_ENGINE':
+ case 'NO_SUCH_APP':
+ case 'NO_SUCH_APP_ENGINE':
+ $this->registry->output->showError( sprintf( $this->lang->words['no_search_app'], ipsRegistry::$applications[ $this->request['search_app'] ]['app_title'] ), 10145.1 );
+ break;
+ }
+ }
+
+ /* Set up some defaults */
+ IPSSearchRegistry::set('in.start', intval( $this->request['st'] ) );
+ IPSSearchRegistry::set('opt.search_per_page', intval( $this->settings['search_per_page'] ) ? intval( $this->settings['search_per_page'] ) : 25 );
+
+ /* Contextuals */
+ if ( isset( $this->request['cType'] ) )
+ {
+ IPSSearchRegistry::set('contextual.type', $this->request['cType'] );
+ IPSSearchRegistry::set('contextual.id' , $this->request['cId'] );
+ }
+
+ /* What to do */
+ switch( $this->request['do'] )
+ {
+ case 'active':
+ $this->activeContent();
+ break;
+
+ case 'user_activity':
+ $this->viewUserContent();
+ break;
+
+ case 'new_posts':
+ $this->viewNewPosts();
+ break;
+
+ case 'search':
+ case 'quick_search':
+ $this->searchResults();
+ break;
+
+ default:
+ case 'search_form':
+ $this->searchAdvancedForm();
+ break;
+ }
+
+ /* Start session */
+ $this->_endSession();
+
+ /* If we have any HTML to print, do so... */
+ $this->registry->output->setTitle( $this->title . ' - ' . ipsRegistry::$settings['board_name'] );
+ $this->registry->output->addContent( $this->output );
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * Builds the advanced search form
+ *
+ * @param string Message
+ * @return void
+ */
+ public function searchAdvancedForm( $msg='', $removed_search_terms=array() )
+ {
+ /* Set up data */
+ IPSSearchRegistry::set('view.search_form', true );
+
+ /* Get any application specific filters */
+ $appHtml = $this->searchController->getHtml();
+ $isBoolean = $this->searchController->isBoolean();
+
+ /* Output */
+ $this->title = $this->lang->words['search_form'];
+ $this->registry->output->addNavigation( $this->lang->words['search_form'], '' );
+ $this->output .= $this->registry->output->getTemplate( 'search' )->searchAdvancedForm( $appHtml, $msg, $this->request['search_app'], $removed_search_terms, $isBoolean );
+ }
+
+ /**
+ * Processes a search request
+ *
+ * @return void
+ */
+ public function searchResults()
+ {
+ /* Search Term */
+ $_st = $this->searchController->formatSearchTerm( $this->request['search_term'] );
+ $search_term = $_st['search_term'];
+ $removedTerms = $_st['removed'];
+
+ /* Set up some defaults */
+ $this->settings['max_search_word'] = $this->settings['max_search_word'] ? $this->settings['max_search_word'] : 300;
+
+ /* Did we come in off a post request? */
+ if ( $this->request['request_method'] == 'post' )
+ {
+ /* Set a no-expires header */
+ $this->registry->getClass('output')->setCacheExpirationSeconds( 30 * 60 );
+ }
+
+ /* App specific */
+ if ( isset( $this->request['search_sort_by_' . $this->request['search_app'] ] ) )
+ {
+ $this->request['search_sort_by'] = ( $_POST[ 'search_sort_by_' . $this->request['search_app'] ] ) ? $_POST[ 'search_sort_by_' . $this->request['search_app'] ] : $this->request['search_sort_by_' . $this->request['search_app'] ];
+ $this->request['search_sort_order'] = ( $_POST[ 'search_sort_order_' . $this->request['search_app'] ] ) ? $_POST[ 'search_sort_order_' . $this->request['search_app'] ] : $this->request['search_sort_order_' . $this->request['search_app'] ];
+ }
+
+ /* Populate the registry */
+ IPSSearchRegistry::set('in.search_app' , $this->request['search_app'] );
+ IPSSearchRegistry::set('in.raw_search_term' , trim( $this->request['search_term'] ) );
+ IPSSearchRegistry::set('in.clean_search_term', $search_term );
+ IPSSearchRegistry::set('in.search_higlight' , str_replace( '.', '', $this->request['search_term'] ) );
+ IPSSearchRegistry::set('in.search_date_end' , ( $this->request['search_date_start'] && $this->request['search_date_end'] ) ? $this->request['search_date_end'] : 'now' );
+ IPSSearchRegistry::set('in.search_date_start', ( $this->request['search_date_start'] ) ? $this->request['search_date_start'] : '' );
+ IPSSearchRegistry::set('in.search_author' , ( isset( $this->request['search_author'] ) && $this->request['search_author'] ) ? $this->request['search_author'] : '' );
+
+ /* Set sort filters */
+ $this->_setSortFilters();
+
+ /* These can be overridden in the actual engine scripts */
+ // IPSSearchRegistry::set('set.hardLimit' , 0 );
+ IPSSearchRegistry::set('set.resultsCutToLimit', false );
+ IPSSearchRegistry::set('set.resultsAsForum' , false );
+
+ /* Are we option to show titles only / search in titles only */
+ IPSSearchRegistry::set('opt.searchTitleOnly', ( isset( $this->request['content_title_only'] ) && $this->request['content_title_only'] ) ? true : false );
+ IPSSearchRegistry::set('display.onlyTitles' , ( ( $this->request['show_as_titles'] AND $this->settings['enable_show_as_titles'] ) OR ( IPSSearchRegistry::get('opt.searchTitleOnly') ) ) ? true : false );
+
+ /* Time check */
+ if ( IPSSearchRegistry::get('in.search_date_start') AND strtotime( IPSText::monthNameRu2En(IPSSearchRegistry::get('in.search_date_start')) ) > time() )
+ {
+ IPSSearchRegistry::set('in.search_date_start', 'now' );
+ }
+
+ if ( IPSSearchRegistry::get('in.search_date_end') AND strtotime( IPSText::monthNameRu2En(IPSSearchRegistry::get('in.search_date_end')) ) > time() )
+ {
+ IPSSearchRegistry::set('in.search_date_end', 'now' );
+ }
+
+ /* Do some date checking */
+ if( IPSSearchRegistry::get('in.search_date_end') AND IPSSearchRegistry::get('in.search_date_start') AND strtotime( IPSText::monthNameRu2En(IPSSearchRegistry::get('in.search_date_start')) ) > strtotime( IPSText::monthNameRu2En(IPSSearchRegistry::get('in.search_date_end')) ) )
+ {
+ $this->searchAdvancedForm( $this->lang->words['search_invalid_date_range'] );
+ return;
+ }
+
+ /**
+ * Ok this is an upper limit.
+ * If you needed to change this, you could do so via conf_global.php by adding:
+ * $INFO['max_search_word'] = #####;
+ */
+ if ( $this->settings['min_search_word'] && ! IPSSearchRegistry::get('in.search_author') )
+ {
+ $_words = explode( ' ', IPSSearchRegistry::get('in.raw_search_term') );
+ $_ok = true;
+
+ foreach( $_words as $_word )
+ {
+ if( strlen( $_word ) < $this->settings['min_search_word'] )
+ {
+ $_ok = false;
+ break;
+ }
+ }
+
+ if( !$_ok )
+ {
+ $this->searchAdvancedForm( sprintf( $this->lang->words['search_term_short'], $this->settings['min_search_word'] ), $removedTerms );
+ return;
+ }
+ }
+
+ if ( $this->settings['max_search_word'] && strlen( IPSSearchRegistry::get('in.raw_search_term') ) > $this->settings['max_search_word'] )
+ {
+ $this->searchAdvancedForm( sprintf( $this->lang->words['search_term_long'], $this->settings['max_search_word'] ) );
+ return;
+ }
+
+ /* Search Flood Check */
+ if( $this->memberData['g_search_flood'] )
+ {
+ /* Check for a cookie */
+ $last_search = IPSCookie::get( 'sfc' );
+ $last_term = str_replace( """, '"', IPSCookie::get( 'sfct' ) );
+ $last_term = str_replace( "&", '&', $last_term );
+
+ /* If we have a last search time, check it */
+ if( $last_search && $last_term )
+ {
+ if( ( time() - $last_search ) <= $this->memberData['g_search_flood'] && $last_term != IPSSearchRegistry::get('in.raw_search_term') )
+ {
+ $this->searchAdvancedForm( sprintf( $this->lang->words['xml_flood'], $this->memberData['g_search_flood'] ) );
+ return;
+ }
+ else
+ {
+ /* Reset the cookie */
+ IPSCookie::set( 'sfc', time() );
+ IPSCookie::set( 'sfct', urlencode( IPSSearchRegistry::get('in.raw_search_term') ) );
+ }
+ }
+ /* Set the cookie */
+ else
+ {
+ IPSCookie::set( 'sfc', time() );
+ IPSCookie::set( 'sfct', urlencode( IPSSearchRegistry::get('in.raw_search_term') ) );
+ }
+ }
+
+ /* Clean search term for results view */
+ $_search_term = trim( preg_replace( "#(^|\s)(\+|\-|\||\~)#", " ", $search_term ) );
+
+ /* Can we do this? */
+ if ( IPSLib::appisSearchable( IPSSearchRegistry::get('in.search_app'), 'search' ) )
+ {
+ /* Perform the search */
+ $this->searchController->search();
+
+ /* Get count */
+ $count = $this->searchController->getResultCount();
+
+ /* Get results which will be array of IDs */
+ $results = $this->searchController->getResultSet();
+
+ /* Get templates to use */
+ $template = $this->searchController->fetchTemplates();
+
+ /* Fetch sort details */
+ $sortDropDown = $this->searchController->fetchSortDropDown();
+
+ /* Fetch sort details */
+ $sortIn = $this->searchController->fetchSortIn();
+
+ /* Build pagination */
+ $links = $this->registry->output->generatePagination( array( 'totalItems' => $count,
+ 'itemsPerPage' => IPSSearchRegistry::get('opt.search_per_page'),
+ 'currentStartValue' => IPSSearchRegistry::get('in.start'),
+ 'baseUrl' => $this->_buildURLString() . '&search_app=' . IPSSearchRegistry::get('in.search_app') . '' ) );
+
+ /* Showing */
+ $showing = array( 'start' => IPSSearchRegistry::get('in.start') + 1, 'end' => ( IPSSearchRegistry::get('in.start') + IPSSearchRegistry::get('opt.search_per_page') ) > $count ? $count : IPSSearchRegistry::get('in.start') + IPSSearchRegistry::get('opt.search_per_page') );
+
+ /* Parse result set */
+ $results = $this->registry->output->getTemplate( $template['group'] )->$template['template']( $results, ( IPSSearchRegistry::get('display.onlyTitles') || IPSSearchRegistry::get( 'opt.noPostPreview') ) ? 1 : 0 );
+ }
+ else
+ {
+ $count = 0;
+ $results = array();
+ }
+
+ /* Output */
+ $this->title = $this->lang->words['search_results'];
+ $this->output .= $this->registry->output->getTemplate( 'search' )->searchResultsWrapper( $results, $sortDropDown, $sortIn, $links, $count, $showing, $_search_term, $this->_buildURLString(), $this->request['search_app'], $removedTerms, IPSSearchRegistry::get('set.hardLimit'), IPSSearchRegistry::get('set.resultsCutToLimit') );
+ }
+
+ /**
+ * Starts session
+ * Loads / creates a session based on activity
+ *
+ * @return
+ */
+ protected function _startSession()
+ {
+ $session_id = IPSText::md5Clean( $this->request['sid'] );
+ $requestType = ( $this->request['request_method'] == 'post' ) ? 'post' : 'get';
+
+ if ( $session_id )
+ {
+ /* We check on member id 'cos we can. Obviously guests will have a member ID of zero, but meh */
+ $this->_session = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'search_sessions',
+ 'where' => 'session_id=\'' . $session_id . '\' AND session_member_id=' . $this->memberData['member_id'] ) );
+ }
+
+ /* Deflate */
+ if ( $this->_session['session_id'] )
+ {
+ if ( $this->_session['session_data'] )
+ {
+ $this->_session['_session_data'] = unserialize( $this->_session['session_data'] );
+
+ if ( isset( $this->_session['_session_data']['search_app_filters'] ) )
+ {
+ $this->request['search_app_filters'] = $this->_session['_session_data']['search_app_filters'];
+ }
+ }
+
+ IPSDebug::addMessage( "Loaded search session: " . var_export( $this->_session['_session_data'], true ) . " " );
+ }
+ else
+ {
+ /* Create a session */
+ $this->_session = array( 'session_id' => md5( uniqid( microtime(), true ) ),
+ 'session_created' => time(),
+ 'session_updated' => time(),
+ 'session_member_id' => $this->memberData['member_id'],
+ 'session_data' => serialize( array( 'search_app_filters' => $this->request['search_app_filters'] ) ) );
+
+ $this->DB->insert( 'search_sessions', $this->_session );
+
+ $this->_session['_session_data']['search_app_filters'] = $this->request['search_app_filters'];
+
+ IPSDebug::addMessage( "Created search session: " . var_export( $this->_session['_session_data'], true ) . " " );
+ }
+
+ /* Do we have POST infos? */
+ if ( isset( $_POST['search_app_filters'] ) )
+ {
+ $this->_session['_session_data']['search_app_filters'] = ( is_array( $this->_session['_session_data']['search_app_filters'] ) ) ? IPSLib::arrayMergeRecursive( $this->_session['_session_data']['search_app_filters'], $_POST['search_app_filters'] ) : $_POST['search_app_filters'];
+ $this->request['search_app_filters'] = $this->_session['_session_data']['search_app_filters'];
+
+ IPSDebug::addMessage( "Updated filters: " . var_export( $_POST['search_app_filters'], true ) . " " );
+ }
+
+ /* Globalize the session ID */
+ $this->request['_sid'] = $this->_session['session_id'];
+ }
+
+ /**
+ * End the session
+ *
+ */
+ protected function _endSession()
+ {
+ if ( $this->_session['session_id'] )
+ {
+ $sd = array( 'session_updated' => time(),
+ 'session_data' => serialize( $this->_session['_session_data'] ) );
+
+ $this->DB->update( 'search_sessions', $sd, 'session_id=\'' . $this->_session['session_id'] . '\'' );
+ }
+
+ /* Delete old sessions */
+ $this->DB->delete( 'search_sessions', 'session_updated < ' . ( time() - 86400 ) );
+ }
+
+ /**
+ * Set the search order and key
+ *
+ * @return void
+ */
+ protected function _setSortFilters()
+ {
+ $app = $this->request['search_app'];
+ $key = 'date';
+ $dir = 'desc';
+ $dun = false;
+
+ /* multi search in options? */
+ if ( isset( $this->request['search_app_filters'][ $app ]['searchInKey'] ) )
+ {
+ $_k = $this->request['search_app_filters'][ $app ]['searchInKey'];
+
+ if ( isset( $this->request['search_app_filters'][ $app ][ $_k ]['sortKey'] ) )
+ {
+ $dun = true;
+ $key = $this->request['search_app_filters'][ $app ][ $_k ]['sortKey'];
+ $dir = $this->request['search_app_filters'][ $app ][ $_k ]['sortDir'];
+ }
+ }
+
+ /* Normal options - although sometimes used even with multiple types */
+ if ( ! $dun AND isset( $this->request['search_app_filters'][$app]['sortKey'] ) )
+ {
+ $key = $this->request['search_app_filters'][$app]['sortKey'];
+ $dir = $this->request['search_app_filters'][$app]['sortDir'];
+ }
+ /* Global */
+ else
+ {
+ if ( isset( $this->request['search_sort_by'] ) )
+ {
+ $key = $this->request['search_sort_by'];
+ $dir = $this->request['search_sort_order'];
+ }
+ }
+
+ /* Numeric? */
+ if ( is_numeric( $dir ) )
+ {
+ $dir = ( $dir == 0 ) ? 'desc' : 'asc';
+ }
+
+ IPSSearchRegistry::set('in.search_sort_by' , trim( $key ) );
+ IPSSearchRegistry::set('in.search_sort_order', ( $dir != 'desc' ) ? 'asc' : 'desc' );
+ }
+
+ /**
+ * Displays the active topics screen
+ *
+ * @return void
+ */
+ public function activeContent()
+ {
+ IPSSearchRegistry::set('in.search_app', $this->request['search_app'] );
+ IPSSearchRegistry::set('in.period' , ( empty( $this->request['period'] ) ) ? 'today' : $this->request['period'] );
+
+ /* Can we do this? */
+ if ( IPSLib::appisSearchable( IPSSearchRegistry::get('in.search_app'), 'active' ) )
+ {
+ /* Perform the search */
+ $this->searchController->viewActiveContent();
+
+ /* Get count */
+ $count = $this->searchController->getResultCount();
+
+ /* Get results which will be array of IDs */
+ $results = $this->searchController->getResultSet();
+
+ /* Get templates to use */
+ $template = $this->searchController->fetchTemplates();
+
+ /* Fetch sort details */
+ $sortIn = $this->searchController->fetchSortIn();
+
+ /* Parse result set */
+ $results = $this->registry->output->getTemplate( $template['group'] )->$template['template']( $results, ( IPSSearchRegistry::get('display.onlyTitles') || IPSSearchRegistry::get( 'opt.noPostPreview') ) ? 1 : 0 );
+
+ /* Build pagination */
+ $links = $this->registry->output->generatePagination( array( 'totalItems' => $count,
+ 'itemsPerPage' => IPSSearchRegistry::get('opt.search_per_page'),
+ 'currentStartValue' => IPSSearchRegistry::get('in.start'),
+ 'baseUrl' => 'app=core&module=search&do=active&period=' . IPSSearchRegistry::get('in.period') . '&search_app=' . IPSSearchRegistry::get('in.search_app') . '&sid=' . $this->request['_sid'] ) );
+ }
+ else
+ {
+ $count = 0;
+ $results = array();
+ }
+
+ /* Output */
+ $this->title = $this->lang->words['active_posts_title'];
+ $this->registry->output->addNavigation( $this->lang->words['active_posts_title'], '' );
+ $this->output .= $this->registry->output->getTemplate( 'search' )->activePostsView( $results, $links, $count, $sortIn );
+ }
+
+ /**
+ * Displays latest user content
+ *
+ * @return void
+ */
+ public function viewUserContent()
+ {
+ /* INIT */
+ $id = $this->request['mid'] ? intval( trim( $this->request['mid'] ) ) : $this->memberData['member_id'];
+ $member = IPSMember::load( $id, 'core' );
+ $beginStamp = 0;
+
+ if ( ! $member['member_id'] )
+ {
+ $this->registry->output->showError( 'search_invalid_id', 10147, null, null, 403 );
+ }
+
+ IPSSearchRegistry::set('in.search_app', $this->request['search_app'] );
+ IPSSearchRegistry::set('in.userMode' , ( $this->request['userMode'] ) ? $this->request['userMode'] : 'all' );
+
+ /* Can we do this? */
+ if ( IPSLib::appisSearchable( IPSSearchRegistry::get('in.search_app'), 'usercontent' ) )
+ {
+ /* Perform the search */
+ $this->searchController->viewUserContent( $member );
+
+ /* Get count */
+ $count = $this->searchController->getResultCount();
+
+ /* Get results which will be array of IDs */
+ $results = $this->searchController->getResultSet();
+
+ /* Get templates to use */
+ $template = $this->searchController->fetchTemplates();
+
+ /* Fetch sort details */
+ $sortIn = $this->searchController->fetchSortIn();
+
+ /* Parse result set */
+ $results = $this->registry->output->getTemplate( $template['group'] )->$template['template']( $results, ( IPSSearchRegistry::get('display.onlyTitles') || IPSSearchRegistry::get( 'opt.noPostPreview') ) ? 1 : 0 );
+
+ /* Build pagination */
+ $links = $this->registry->output->generatePagination( array( 'totalItems' => $count,
+ 'itemsPerPage' => IPSSearchRegistry::get('opt.search_per_page'),
+ 'currentStartValue' => IPSSearchRegistry::get('in.start'),
+ 'baseUrl' => 'app=core&module=search&do=user_activity&mid=' . $id . '&search_app=' . IPSSearchRegistry::get('in.search_app') . '&userMode=' . IPSSearchRegistry::get('in.userMode') . '&sid=' . $this->request['_sid'] ) );
+ }
+ else
+ {
+ $count = 0;
+ $results = array();
+ }
+
+ $this->title = sprintf( $this->lang->words['s_participation_title'], $member['members_display_name'] );
+ $this->registry->output->addNavigation( $this->title, '' );
+ $this->output .= $this->registry->output->getTemplate( 'search' )->userPostsView( $results, $links, $count, $member, IPSSearchRegistry::get('set.hardLimit'), IPSSearchRegistry::get('set.resultsCutToLimit'), $beginStamp, $sortIn );
+ }
+
+ /**
+ * View new posts since your last visit
+ *
+ * @return void
+ */
+ public function viewNewPosts()
+ {
+ IPSSearchRegistry::set('in.search_app', $this->request['search_app'] );
+
+ /* Can we do this? */
+ if ( IPSLib::appisSearchable( IPSSearchRegistry::get('in.search_app'), 'vnc' ) )
+ {
+ /* Perform the search */
+ $this->searchController->viewNewContent();
+
+ /* Get count */
+ $count = $this->searchController->getResultCount();
+
+ /* Get results which will be array of IDs */
+ $results = $this->searchController->getResultSet();
+
+ /* Get templates to use */
+ $template = $this->searchController->fetchTemplates();
+
+ /* Fetch sort details */
+ $sortDropDown = $this->searchController->fetchSortDropDown();
+
+ /* Fetch sort details */
+ $sortIn = $this->searchController->fetchSortIn();
+
+ /* Parse result set */
+ $results = $this->registry->output->getTemplate( $template['group'] )->$template['template']( $results, ( IPSSearchRegistry::get('display.onlyTitles') || IPSSearchRegistry::get( 'opt.noPostPreview') ) ? 1 : 0 );
+
+ /* Build pagination */
+ $links = $this->registry->output->generatePagination( array( 'totalItems' => $count,
+ 'itemsPerPage' => IPSSearchRegistry::get('opt.search_per_page'),
+ 'currentStartValue' => IPSSearchRegistry::get('in.start'),
+ 'baseUrl' => 'app=core&module=search&do=new_posts&search_app=' . IPSSearchRegistry::get('in.search_app') . '&sid= ' . $this->request['_sid'] ) );
+
+ /* Showing */
+ $showing = array( 'start' => IPSSearchRegistry::get('in.start') + 1, 'end' => ( IPSSearchRegistry::get('in.start') + IPSSearchRegistry::get('opt.search_per_page') ) > $count ? $count : IPSSearchRegistry::get('in.start') + IPSSearchRegistry::get('opt.search_per_page') );
+ }
+ else
+ {
+ $count = 0;
+ $results = array();
+ }
+
+ /* Output */
+ $this->title = $this->lang->words['new_posts_title'];
+ $this->registry->output->addNavigation( $this->lang->words['new_posts_title'], '' );
+ $this->output .= $this->registry->output->getTemplate( 'search' )->newPostsView( $results, $links, $count, $sortDropDown, $sortIn, IPSSearchRegistry::get('set.resultCutToDate') );
+ }
+
+
+ /**
+ * Returns a url string that will maintain search results via links
+ *
+ * @return string
+ */
+ protected function _buildURLString()
+ {
+ /* INI */
+ $url_string = 'app=core&module=search&do=search&andor_type=' . $this->request['andor_type'];
+ $url_string .= '&sid=' . $this->request['_sid'];
+
+ /* Add author name */
+ if( isset( $this->request['search_author'] ) AND $this->request['search_author'] )
+ {
+ $url_string .= "&search_author=" . urlencode($this->request['search_author']);
+ }
+
+ /* Add titles only */
+ if( isset( $this->request['show_as_titles'] ) AND $this->request['show_as_titles'] )
+ {
+ $url_string .= "&show_as_titles={$this->request['show_as_titles']}";
+ }
+
+ /* Search Range */
+ if( isset( $this->request['search_date_start'] ) AND $this->request['search_date_start'] )
+ {
+ $url_string .= "&search_date_start={$this->request['search_date_start']}";
+ }
+
+ if( isset( $this->request['search_date_end'] ) AND $this->request['search_date_end'] )
+ {
+ $url_string .= "&search_date_end={$this->request['search_date_end']}";
+ }
+
+ /* Contextual Type */
+ if ( IPSSearchRegistry::get('contextual.type') )
+ {
+ $url_string .= "&cType=" . IPSSearchRegistry::get('contextual.type') . "&cId=" . IPSSearchRegistry::get('contextual.id');
+ }
+
+ /* Content Only */
+ if( isset( $this->request['content_title_only'] ) && $this->request['content_title_only'] )
+ {
+ $url_string .= "&content_title_only=1";
+ }
+
+ /* Types */
+ if( isset( $this->request['type'] ) && isset( $this->request['type_id'] ) )
+ {
+ $url_string .= "&type={$this->request['type']}&type_id={$this->request['type_id']}";
+ }
+
+ if( isset( $this->request['type_2'] ) && isset( $this->request['type_id_2'] ) )
+ {
+ $url_string .= "&type_2={$this->request['type_2']}&type_id_2={$this->request['type_id_2']}";
+ }
+
+ /* Fix up the search term a bit */
+ $_search_term = str_replace( '&', '&', $this->request['search_term'] );
+ $_search_term = str_replace( '"', '"', $_search_term );
+ $_search_term = str_replace( '>', '>', $_search_term );
+ $_search_term = str_replace( '<', '<', $_search_term );
+ $_search_term = str_replace( '$', '$', $_search_term );
+
+ $url_string .= '&search_term=' . urlencode( $_search_term );
+
+ return $url_string;
+ }
+
+ /**
+ * Checks to see if the logged in user is allowed to use the search system
+ *
+ * @return void
+ */
+ protected function _canSearch()
+ {
+ /* Check the search setting */
+ if( ! $this->settings['allow_search'] )
+ {
+ if( $this->xml_out )
+ {
+ @header( "Content-type: text/html;charset={$this->settings['gb_char_set']}" );
+ print $this->lang->words['search_off'];
+ exit();
+ }
+ else
+ {
+ $this->registry->output->showError( 'search_off', 10145 );
+ }
+ }
+
+ /* Check the member authorization */
+ if( ! isset( $this->memberData['g_use_search'] ) || ! $this->memberData['g_use_search'] )
+ {
+ if( $this->xml_out )
+ {
+ @header( "Content-type: text/html;charset={$this->settings['gb_char_set']}" );
+ print $this->lang->words['no_xml_permission'];
+ exit();
+ }
+ else
+ {
+ $this->registry->output->showError( 'no_permission_to_search', 10146, null, null, 403 );
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/task/index.html b/upload/admin/applications/core/modules_public/task/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_public/task/index.html
+++ b/upload/admin/applications/core/modules_public/task/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/task/manualResolver.php b/upload/admin/applications/core/modules_public/task/manualResolver.php
index 66174971..daedf07a 100644
--- a/upload/admin/applications/core/modules_public/task/manualResolver.php
+++ b/upload/admin/applications/core/modules_public/task/manualResolver.php
@@ -1,17 +1,19 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Task Manager
- * Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
+ * Last Updated: $Date: 2010-07-12 18:26:09 -0400 (Mon, 12 Jul 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
- * @version $Rev: 4948 $
+ * @link http://www.invisionpower.com
+ * @version $Rev: 6635 $
*
*/
@@ -32,14 +34,12 @@ class public_core_task_manualResolver extends ipsCommand
*/
public function doExecute( ipsRegistry $registry )
{
- @set_time_limit(1200);
-
//-----------------------------------------
// Require and run
//-----------------------------------------
- require_once( IPS_ROOT_PATH . 'sources/classes/class_taskmanager.php' );
- $functions = new class_taskmanager( $registry );
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/class_taskmanager.php', 'class_taskmanager' );
+ $functions = new $classToLoad( $registry );
//-----------------------------------------
// Check shutdown functions
diff --git a/upload/admin/applications/core/modules_public/usercp/index.html b/upload/admin/applications/core/modules_public/usercp/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/modules_public/usercp/index.html
+++ b/upload/admin/applications/core/modules_public/usercp/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/usercp/manualResolver.php b/upload/admin/applications/core/modules_public/usercp/manualResolver.php
index 5d5f9e93..9a593b76 100644
--- a/upload/admin/applications/core/modules_public/usercp/manualResolver.php
+++ b/upload/admin/applications/core/modules_public/usercp/manualResolver.php
@@ -1,367 +1,300 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-/**
-* Main loader class
-*/
-class public_core_usercp_manualResolver extends ipsCommand
-{
- /**
- * Page Title set by sub classes
- *
- * @access protected
- * @var string
- */
- protected $_pageTitle;
-
- /**
- * Navigation array set by sub classes
- *
- * @access protected
- * @var array
- */
- protected $_nav = array();
-
- /**
- * Main class entry point
- *
- * @access public
- * @param object ipsRegistry reference
- * @return void [Outputs to screen]
- */
- public function doExecute( ipsRegistry $registry )
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $_thisNav = array();
-
- //-----------------------------------------
- // Load language
- //-----------------------------------------
-
- $this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_usercp' ) );
-
- //-----------------------------------------
- // Logged in?
- //-----------------------------------------
-
- if ( ! $this->memberData['member_id'] )
- {
- $this->registry->getClass('output')->silentRedirect( $this->settings['base_url'].'&app=core&module=global§ion=login&do=form' );
-
- exit();
- }
-
- //-----------------------------------------
- // Make sure they're clean
- //-----------------------------------------
-
- $this->request['tab'] = IPSText::alphanumericalClean( $this->request['tab'] );
- $this->request['area'] = IPSText::alphanumericalClean( $this->request['area'] );
-
- //-----------------------------------------
- // Set up some basics...
- //-----------------------------------------
-
- $_TAB = ( $this->request['tab'] ) ? $this->request['tab'] : 'core';
- $_AREA = ( $this->request['area'] ) ? $this->request['area'] : 'settings';
- $_DO = ( $this->request['do'] ) ? $this->request['do'] : 'show';
- $_FUNC = ( $_DO == 'show' ) ? 'showForm' : ( $_DO == 'save' ? 'saveForm' : $_DO );
- $tabs = array();
- $errors = array();
-
- //-----------------------------------------
- // Got a plug in?
- //-----------------------------------------
-
- require_once( IPS_ROOT_PATH . 'sources/interfaces/interface_usercp.php' );
-
- $EXT_DIR = IPSLib::getAppDir( $_TAB ) . '/extensions';
- $_CLASS = 'usercpForms_' . $_TAB;
-
- if ( ! file_exists($EXT_DIR . '/usercpForms.php') )
- {
- $this->registry->getClass('output')->showError( 'usercp_bad_tab', 10147 );
- exit();
- }
-
- //-----------------------------------------
- // Cycle through applications and load
- // usercpForm extensions
- //-----------------------------------------
- foreach( ipsRegistry::$applications as $app_dir => $app_data )
- {
- // Check that the application is installed.
- if ( !IPSLib::appIsInstalled( $app_dir ) )
- {
- continue;
- }
-
- $ext_dir = IPSLib::getAppDir( $app_dir ) . '/extensions';
-
- // Make sure the extension exists
- if ( !file_exists( $ext_dir . '/usercpForms.php' ) )
- {
- continue;
- }
-
- require_once( $ext_dir . '/usercpForms.php' );
- $__class = 'usercpForms_' . $app_dir;
-
- //-----------------------------------------
- // Support for extending usercpForms
- //-----------------------------------------
- if ( file_exists( $ext_dir . '/usercpFormsExt.php' ) )
- {
- require_once( $ext_dir . '/usercpFormsExt.php' );
-
- //-----------------------------------------
- // The class must exist and extend
- // the usercpForm class to be valid.
- //-----------------------------------------
- if ( class_exists( 'usercpFormsExt_' . $app_dir ) )
- {
- $parent = get_parent_class( 'usercpFormsExt_' . $app_dir );
-
- if ( $parent == $__class )
- {
- $__class = 'usercpFormsExt_' . $app_dir;
- }
- }
- }
-
- $_usercp_module = new $__class();
- $_usercp_module->makeRegistryShortcuts( $this->registry );
-
- if ( is_callable( array( $_usercp_module, 'init' ) ) )
- {
- $_usercp_module->init();
-
- /* Set default area? */
- if ( ( $_TAB == $app_dir ) AND ! isset( $_REQUEST['area'] ) )
- {
- if ( isset( $_usercp_module->defaultAreaCode ) )
- {
- $this->request['area'] = $_AREA = $_usercp_module->defaultAreaCode;
- }
- }
- }
-
- if ( is_callable( array( $_usercp_module, 'getLinks' ) ) )
- {
- $tabs[ $app_dir ]['_name'] = $_usercp_module->tab_name ? $_usercp_module->tab_name : IPSLib::getAppTitle( $app_dir );
- $tabs[ $app_dir ]['_menu'] = $_usercp_module->getLinks();
-
- if ( ! $tabs[ $app_dir ]['_menu'] )
- {
- unset( $tabs[ $app_dir ] );
- }
-
- /* Add in 'last' element */
- $tabs[ $app_dir ]['_menu'][ count( $tabs[ $app_dir ]['_menu'] ) - 1 ]['last'] = 1;
-
- /* This nav? */
- if ( ! count( $_thisNav ) AND $app_dir == $_TAB )
- {
- foreach( $tabs[ $app_dir ]['_menu'] as $_navData )
- {
- if ( $_navData['url'] == 'area=' . $_AREA )
- {
- $_thisNav = array( 'app=core&module=usercp&tab=' . $_TAB . '&area=' . $_AREA, $_navData['title'] );
- }
- }
- }
- }
- }
-
- //-----------------------------------------
- // Set up basic navigation
- //-----------------------------------------
-
- $this->_nav[] = array( $this->lang->words['t_title'], '&app=core&module=usercp' );
- $this->_nav[] = array( $this->lang->words['tab__' . $_TAB ] ? $this->lang->words['tab__' . $_TAB ] : IPSLib::getAppTitle( $_TAB ) , '&app=core&module=usercp&tab=' . $_TAB );
-
- if ( isset( $_thisNav[0] ) )
- {
- $this->_nav[] = array( $_thisNav[1], $_thisNav[0] );
- }
-
- //-----------------------------------------
- // Begin initilization routine for extension
- //-----------------------------------------
- require_once( $EXT_DIR . '/usercpForms.php' );
-
- //-----------------------------------------
- // Support for extending usercpForms
- //-----------------------------------------
- if ( file_exists( $EXT_DIR . '/usercpFormsExt.php' ) )
- {
- require_once( $EXT_DIR . '/usercpFormsExt.php' );
-
- //-----------------------------------------
- // The class must exist and extend
- // the usercpForm class to be valid.
- //-----------------------------------------
- if ( class_exists( 'usercpFormsExt_' . $_TAB ) )
- {
- $parent = get_parent_class( 'usercpFormsExt_' . $_TAB );
-
- if ( $parent == $_CLASS )
- {
- $_CLASS = 'usercpFormsExt_' . $_TAB;
- }
- }
- }
-
- $usercp_module = new $_CLASS();
- $usercp_module->makeRegistryShortcuts( $this->registry );
- $usercp_module->init();
-
- if ( ( $_DO == 'saveForm' || $_DO == 'showForm' ) AND ! is_callable( array( $usercp_module, $_FUNC ) ) )
- {
- $this->registry->getClass('output')->showError( 'usercp_bad_tab', 10148, true );
- exit();
- }
-
- //-----------------------------------------
- // Run it...
- //-----------------------------------------
-
- if ( $_FUNC == 'showForm' )
- {
- //-----------------------------------------
- // Facebook email
- //-----------------------------------------
-
- //@facebook concession
- if ( IPSLib::fbc_enabled() === TRUE )
- {
- if ( ! $this->memberData['fb_emailallow'] AND strstr( $this->memberData['email'], '@proxymail.facebook.com' ) )
- {
- require_once( IPS_ROOT_PATH . 'sources/classes/facebook/connect.php' );
- $fb = new facebook_connect( $this->registry );
-
- try
- {
- $fb->testConnectSession();
- $result = $fb->users_hasAppPermission( 'email' );
-
- IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'fb_emailallow' => intval( $result ) ) ) );
- }
- catch( Exception $error )
- {
- }
- }
- }
-
- $html = $usercp_module->showForm( $_AREA );
- }
- else if ( $_FUNC == 'saveForm' )
- {
- //-----------------------------------------
- // Check secure key...
- //-----------------------------------------
-
- if ( $this->request['secure_hash'] != $this->member->form_hash )
- {
- $html = $usercp_module->showForm( $_AREA );
- $errors[] = $this->lang->words['securehash_not_secure'];
- }
- else
- {
- $errors = $usercp_module->saveForm( $_AREA );
-
- $do = ( $usercp_module->do_url ) ? $usercp_module->do_url : 'show';
-
- if ( is_array( $errors ) AND count( $errors ) )
- {
- $html = $usercp_module->showForm( $_AREA, $errors );
- }
- else if ( $usercp_module->ok_message )
- {
- $this->registry->getClass('output')->redirectScreen( $usercp_module->ok_message, $this->settings['base_url'] . 'app=' . IPS_APP_COMPONENT . '&module=usercp&tab=' . $_TAB . '&area=' . $_AREA . '&do='.$do.'&saved=1', 1 );
- }
- else
- {
- $this->registry->getClass('output')->silentRedirect( $this->settings['base_url_with_app'] . 'module=usercp&tab=' . $_TAB . '&area=' . $_AREA . '&do='.$do.'&saved=1'.'&_r='.time() );
- }
- }
- }
- else
- {
- if ( ! is_callable( array( $usercp_module, 'runCustomEvent' ) ) )
- {
- $html = $usercp_module->showForm( $_AREA );
- $errors[] = $this->lang->words['called_invalid_function'];
- }
- else
- {
- $html = $usercp_module->runCustomEvent( $_AREA );
- }
- }
-
- //-----------------------------------------
- // If you've run a custom event, may need to
- // reset the "area" to highlight the menu correctly
- //-----------------------------------------
-
- if ( is_callable( array( $usercp_module, 'resetArea' ) ) )
- {
- $_AREA = $usercp_module->resetArea( $_AREA );
- }
-
- //-----------------------------------------
- // Wrap form and show
- //-----------------------------------------
-
- $template = $this->registry->getClass('output')->getTemplate('ucp')->userCPTemplate( $_TAB, $html, $tabs, $_AREA, $errors, $usercp_module->hide_form_and_save_button, $usercp_module->uploadFormMax );
-
- //-----------------------------------------
- // Pass to CP output hander
- //-----------------------------------------
-
- $this->registry->getClass('output')->setTitle( ( $this->_pageTitle ) ? $this->settings['board_name'] . " {$this->lang->words['pagetitle_bit']} : " . $this->_pageTitle : $this->settings['board_name'] . " {$this->lang->words['pagetitle_bit']}" );
- $this->registry->getClass('output')->addContent( $template );
-
- if ( is_array( $this->_nav ) AND count( $this->_nav ) )
- {
- foreach( $this->_nav as $_nav )
- {
- $this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1] );
- }
- }
-
- if ( is_array( $usercp_module->_nav ) AND count( $usercp_module->_nav ) )
- {
- foreach( $usercp_module->_nav as $_nav )
- {
- $this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1] );
- }
- }
-
- $this->registry->getClass('output')->sendOutput();
- }
+
+ * Invision Power Services
+ * IP.Board v3.1.4
+ * User control panel resolver
+ * Last Updated: $Date: 2010-10-21 14:02:34 -0400 (Thu, 21 Oct 2010) $
+ *
+ *
+ * @author $Author: ips_terabyte $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 1st march 2002
+ * @version $Revision: 7011 $
+ */
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+/**
+* Main loader class
+*/
+class public_core_usercp_manualResolver extends ipsCommand
+{
+ /**
+ * Page Title set by sub classes
+ *
+ * @access protected
+ * @var string
+ */
+ protected $_pageTitle;
+
+ /**
+ * Navigation array set by sub classes
+ *
+ * @access protected
+ * @var array
+ */
+ protected $_nav = array();
+
+ /**
+ * Main class entry point
+ *
+ * @access public
+ * @param object ipsRegistry reference
+ * @return void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $_thisNav = array();
+
+ //-----------------------------------------
+ // Load language
+ //-----------------------------------------
+
+ $this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_usercp' ) );
+
+ //-----------------------------------------
+ // Logged in?
+ //-----------------------------------------
+
+ if ( ! $this->memberData['member_id'] )
+ {
+ $this->registry->getClass('output')->silentRedirect( $this->settings['base_url'].'&app=core&module=global§ion=login&do=form' );
+
+ exit();
+ }
+
+ //-----------------------------------------
+ // Make sure they're clean
+ //-----------------------------------------
+
+ $this->request['tab'] = IPSText::alphanumericalClean( $this->request['tab'] );
+ $this->request['area'] = IPSText::alphanumericalClean( $this->request['area'] );
+
+ //-----------------------------------------
+ // Set up some basics...
+ //-----------------------------------------
+
+ $_TAB = ( $this->request['tab'] ) ? $this->request['tab'] : 'core';
+ $_AREA = ( $this->request['area'] ) ? $this->request['area'] : 'settings';
+ $_DO = ( $this->request['do'] ) ? $this->request['do'] : 'show';
+ $_FUNC = ( $_DO == 'show' ) ? 'showForm' : ( $_DO == 'save' ? 'saveForm' : $_DO );
+ $tabs = array();
+ $errors = array();
+
+ //-----------------------------------------
+ // Got a plug in?
+ //-----------------------------------------
+
+ IPSLib::loadInterface( 'interface_usercp.php' );
+
+ $EXT_DIR = IPSLib::getAppDir( $_TAB ) . '/extensions';
+
+ if ( ! file_exists($EXT_DIR . '/usercpForms.php') )
+ {
+ $this->registry->getClass('output')->showError( 'usercp_bad_tab', 10147 );
+ exit();
+ }
+
+ //-----------------------------------------
+ // Cycle through applications and load
+ // usercpForm extensions
+ //-----------------------------------------
+ foreach( ipsRegistry::$applications as $app_dir => $app_data )
+ {
+ // Check that the application is installed.
+ if ( !IPSLib::appIsInstalled( $app_dir ) )
+ {
+ continue;
+ }
+
+ $ext_dir = IPSLib::getAppDir( $app_dir ) . '/extensions';
+
+ // Make sure the extension exists
+ if ( !file_exists( $ext_dir . '/usercpForms.php' ) )
+ {
+ continue;
+ }
+
+ $__class = IPSLib::loadLibrary( $ext_dir . '/usercpForms.php', 'usercpForms_' . $app_dir, $app_dir );
+ $_usercp_module = new $__class();
+ $_usercp_module->makeRegistryShortcuts( $this->registry );
+
+ if ( is_callable( array( $_usercp_module, 'init' ) ) )
+ {
+ $_usercp_module->init();
+
+ /* Set default area? */
+ if ( ( $_TAB == $app_dir ) AND ! isset( $_REQUEST['area'] ) )
+ {
+ if ( isset( $_usercp_module->defaultAreaCode ) )
+ {
+ $this->request['area'] = $_AREA = $_usercp_module->defaultAreaCode;
+ }
+ }
+ }
+
+ if ( is_callable( array( $_usercp_module, 'getLinks' ) ) )
+ {
+ $tabs[ $app_dir ]['_name'] = $_usercp_module->tab_name ? $_usercp_module->tab_name : IPSLib::getAppTitle( $app_dir );
+ $tabs[ $app_dir ]['_menu'] = $_usercp_module->getLinks();
+
+ if ( ! $tabs[ $app_dir ]['_menu'] )
+ {
+ unset( $tabs[ $app_dir ] );
+ }
+
+ /* Add in 'last' element */
+ $tabs[ $app_dir ]['_menu'][ count( $tabs[ $app_dir ]['_menu'] ) - 1 ]['last'] = 1;
+
+ /* This nav? */
+ if ( ! count( $_thisNav ) AND $app_dir == $_TAB )
+ {
+ foreach( $tabs[ $app_dir ]['_menu'] as $_navData )
+ {
+ if ( $_navData['url'] == 'area=' . $_AREA )
+ {
+ $_thisNav = array( 'app=core&module=usercp&tab=' . $_TAB . '&area=' . $_AREA, $_navData['title'] );
+ }
+ }
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Set up basic navigation
+ //-----------------------------------------
+
+ $this->_nav[] = array( $this->lang->words['t_title'], '&app=core&module=usercp' );
+ $this->_nav[] = array( $this->lang->words['tab__' . $_TAB ] ? $this->lang->words['tab__' . $_TAB ] : IPSLib::getAppTitle( $_TAB ) , '&app=core&module=usercp&tab=' . $_TAB );
+
+ if ( isset( $_thisNav[0] ) )
+ {
+ $this->_nav[] = array( $_thisNav[1], $_thisNav[0] );
+ }
+
+ //-----------------------------------------
+ // Begin initilization routine for extension
+ //-----------------------------------------
+ $classToLoad = IPSLib::loadLibrary( $EXT_DIR . '/usercpForms.php', 'usercpForms_' . $_TAB, $_TAB );
+ $usercp_module = new $classToLoad();
+ $usercp_module->makeRegistryShortcuts( $this->registry );
+ $usercp_module->init();
+
+ if ( ( $_DO == 'saveForm' || $_DO == 'showForm' ) AND ! is_callable( array( $usercp_module, $_FUNC ) ) )
+ {
+ $this->registry->getClass('output')->showError( 'usercp_bad_tab', 10148, true );
+ exit();
+ }
+
+ //-----------------------------------------
+ // Run it...
+ //-----------------------------------------
+
+ if ( $_FUNC == 'showForm' )
+ {
+ //-----------------------------------------
+ // Facebook email
+ //-----------------------------------------
+
+ $html = $usercp_module->showForm( $_AREA );
+ }
+ else if ( $_FUNC == 'saveForm' )
+ {
+ //-----------------------------------------
+ // Check secure key...
+ //-----------------------------------------
+
+ if ( $this->request['secure_hash'] != $this->member->form_hash )
+ {
+ $html = $usercp_module->showForm( $_AREA );
+ $errors[] = $this->lang->words['securehash_not_secure'];
+ }
+ else
+ {
+ $errors = $usercp_module->saveForm( $_AREA );
+
+ $do = ( $usercp_module->do_url ) ? $usercp_module->do_url : 'show';
+
+ if ( is_array( $errors ) AND count( $errors ) )
+ {
+ $html = $usercp_module->showForm( $_AREA, $errors );
+ }
+ else if ( $usercp_module->ok_message )
+ {
+ $this->registry->getClass('output')->redirectScreen( $usercp_module->ok_message, $this->settings['base_url'] . 'app=' . IPS_APP_COMPONENT . '&module=usercp&tab=' . $_TAB . '&area=' . $_AREA . '&do='.$do.'&saved=1', 1 );
+ }
+ else
+ {
+ $this->registry->getClass('output')->silentRedirect( $this->settings['base_url_with_app'] . 'module=usercp&tab=' . $_TAB . '&area=' . $_AREA . '&do='.$do.'&saved=1'.'&_r='.time() );
+ }
+ }
+ }
+ else
+ {
+ if ( ! is_callable( array( $usercp_module, 'runCustomEvent' ) ) )
+ {
+ $html = $usercp_module->showForm( $_AREA );
+ $errors[] = $this->lang->words['called_invalid_function'];
+ }
+ else
+ {
+ $html = $usercp_module->runCustomEvent( $_AREA );
+ }
+ }
+
+ //-----------------------------------------
+ // If you've run a custom event, may need to
+ // reset the "area" to highlight the menu correctly
+ //-----------------------------------------
+
+ if ( is_callable( array( $usercp_module, 'resetArea' ) ) )
+ {
+ $_AREA = $usercp_module->resetArea( $_AREA );
+ }
+
+ //-----------------------------------------
+ // Wrap form and show
+ //-----------------------------------------
+
+ $template = $this->registry->getClass('output')->getTemplate('ucp')->userCPTemplate( $_TAB, $html, $tabs, $_AREA, $errors, $usercp_module->hide_form_and_save_button, $usercp_module->uploadFormMax );
+
+ //-----------------------------------------
+ // Pass to CP output hander
+ //-----------------------------------------
+
+ $this->registry->getClass('output')->setTitle( ( $this->_pageTitle ) ? $this->settings['board_name'] . " {$this->lang->words['pagetitle_bit']} : " . $this->_pageTitle : $this->settings['board_name'] . " {$this->lang->words['pagetitle_bit']}" );
+ $this->registry->getClass('output')->addContent( $template );
+
+ if ( is_array( $this->_nav ) AND count( $this->_nav ) )
+ {
+ foreach( $this->_nav as $_nav )
+ {
+ $this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1] );
+ }
+ }
+
+ if ( is_array( $usercp_module->_nav ) AND count( $usercp_module->_nav ) )
+ {
+ foreach( $usercp_module->_nav as $_nav )
+ {
+ $this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1] );
+ }
+ }
+
+ $this->registry->getClass('output')->sendOutput();
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/index.html b/upload/admin/applications/core/setup/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/setup/index.html
+++ b/upload/admin/applications/core/setup/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/index.html b/upload/admin/applications/core/setup/versions/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/setup/versions/index.html
+++ b/upload/admin/applications/core/setup/versions/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/install/index.html b/upload/admin/applications/core/setup/versions/install/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/setup/versions/install/index.html
+++ b/upload/admin/applications/core/setup/versions/install/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/install/knownSettings.php b/upload/admin/applications/core/setup/versions/install/knownSettings.php
index ffdf0d81..8e601775 100644
--- a/upload/admin/applications/core/setup/versions/install/knownSettings.php
+++ b/upload/admin/applications/core/setup/versions/install/knownSettings.php
@@ -21,5 +21,5 @@ $knownSettings = array(
'upload_url' => IPSSetUp::getSavedData('install_url') . '/uploads',
'upload_dir' => IPSSetUp::getSavedData('install_dir') . '/uploads',
'search_sql_method' => ipsRegistry::DB()->checkFulltextSupport() ? 'ftext' : 'man',
- 'safe_mode_skins' => ( @ini_get("safe_mode") ) ? 1 : 0
+ 'safe_mode_skins' => ( @ini_get("safe_mode") ) ? 1 : 0,
);
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/install/sql/core_mysql_fulltext.php b/upload/admin/applications/core/setup/versions/install/sql/core_mysql_fulltext.php
index ac620565..c6f3e7b7 100644
--- a/upload/admin/applications/core/setup/versions/install/sql/core_mysql_fulltext.php
+++ b/upload/admin/applications/core/setup/versions/install/sql/core_mysql_fulltext.php
@@ -3,5 +3,3 @@
* Installation Schematic File
* Generated on Thu, 19 Feb 2009 08:15:49 +0000 GMT
*/
-$INDEX[] = "ALTER TABLE search_index ADD FULLTEXT KEY content (content,content_title)";
-?>
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/install/sql/core_mysql_inserts.php b/upload/admin/applications/core/setup/versions/install/sql/core_mysql_inserts.php
index 64bbe623..90417b78 100644
--- a/upload/admin/applications/core/setup/versions/install/sql/core_mysql_inserts.php
+++ b/upload/admin/applications/core/setup/versions/install/sql/core_mysql_inserts.php
@@ -1,28 +1,28 @@
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/install/sql/index.html b/upload/admin/applications/core/setup/versions/install/sql/index.html
index 203e7ede..dfdb4ca9 100644
--- a/upload/admin/applications/core/setup/versions/install/sql/index.html
+++ b/upload/admin/applications/core/setup/versions/install/sql/index.html
@@ -1 +1,10 @@
-
IP.Board - Bulletin Board System
403: IP.Board -> Forbidden
You have reached this page in error, please use your back button to return to the forum.
IP.Board
\ No newline at end of file
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_10002/version_upgrade_mysql.php b/upload/admin/applications/core/setup/versions/upg_10002/version_upgrade_mysql.php
index c714b6b4..cca0b7d1 100644
--- a/upload/admin/applications/core/setup/versions/upg_10002/version_upgrade_mysql.php
+++ b/upload/admin/applications/core/setup/versions/upg_10002/version_upgrade_mysql.php
@@ -2,11 +2,11 @@
/*
+--------------------------------------------------------------------------
-| IP.Board v3.0.5
+| IP.Board v3.1.2
| ========================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services
-| http://www.iinvisionpower.com
+| http://www.invisionpower.com
| ========================================
| Web: http://www.invisionboard.com
| Email: matt@invisionpower.com
@@ -143,7 +143,7 @@ class version_upgrade
}
if ( $this->request['workact'] )
{
- IPSSetUp::getSavedData('vid') = $this->install->current_version;
+ IPSSetUp::getSavedData('vid', $this->install->current_version );
return false;
}
@@ -1412,9 +1412,9 @@ class version_upgrade
{
// Reset loginkey
- IPSSetUp::getSavedData('loginkey') = $member_login_key;
+ IPSSetUp::getSavedData('loginkey', $member_login_key );
$this->install->ipsclass->member['member_login_key'] = $member_login_key;
- IPSSetUp::getSavedData('securekey') = $this->install->ipsclass->return_md5_check();
+ IPSSetUp::getSavedData('securekey', $this->install->ipsclass->return_md5_check() );
}
}
@@ -1906,7 +1906,7 @@ class version_upgrade
$SQL[] = "REPLACE INTO ".ipsRegistry::dbFunctions()->getPrefix()."faq VALUES (1, 'Registration benefits', 'To be able to use all the features on this board, the administrator will probably require that you register for a member account. Registration is free and only takes a moment to complete.\r \r During registration, the administrator requires that you supply a valid email address. This is important as the administrator may require that you validate your registration via an email. If this is the case, you will be notified when registering. If your e-mail does not arrive, then on the member bar at the top of the page, there will be a link that will allow you to re-send the validation e-mail. \r \r In some cases, the administrator will need to approve your registration before you can use your member account fully. If this is the case you will be notified during registration.\r \r Once you have registered and logged in, you will have access to your personal messenger and your control panel.\r \r For more information on these items, please see the relevant sections in this documentation.', 'How to register and the added benefits of being a registered member.');";
- $SQL[] = "REPLACE INTO ".ipsRegistry::dbFunctions()->getPrefix()."faq VALUES (2, 'Cookies and cookie usage', 'Using cookies is optional, but strongly recommended. Cookies are used to track topics, showing you which topics have new replies since your last visit and to automatically log you in when you return.\r \r If your computer is unable to use the cookie system to browse the board correctly, then the board will automatically add in a session ID to each link to track you around the board.\r \rClearing Cookies \r \r You can clear the cookies at any time by clicking on the link found at the bottom of the main board page (the first page you see when returning to the board). If this does not work for you, you may need to remove the cookies manually.\r \rRemoving Cookies in Internet Explorer for Windows \r \r\r Close all open Internet Explorer Windows\r Click on the \'start\' button\r Move up to \'Find\' and click on \'Files and Folders\'\r When the new window appears, type in the domain name of the board you are using into the \'containing text\' field. (If the boards address was \'\' you would enter \'\' without the quotes)\r In the \'look in\' box, type in C:WindowsCookies and press \'Find Now\'\r After it has finished searching, highlight all files (click on a file then press CTRL+A) and delete them.\r \r \rRemoving Cookies in Internet Explorer for Macintosh \r \r\r With Internet Explorer active, choose \'Edit\' and then \'Preferences\' from the Macintosh menu bar at the top of the screen\r When the preferences panel opens, choose \'Cookies\' found in the \'Receiving Files\' section.\r When the cookie pane loads, look for the domain name of the board (If the boards address was \'\' look for \'\' or \'\'\r For each cookie, click on the entry and press the delete button.\r \r \r Your cookies should now be removed. In some cases you may need to restart your computer for the changes to take effect.', 'The benefits of using cookies and how to remove cookies set by this board.');";
+ $SQL[] = "REPLACE INTO ".ipsRegistry::dbFunctions()->getPrefix()."faq VALUES (2, 'Cookies and cookie usage', 'Using cookies is optional, but strongly recommended. Cookies are used to track topics, showing you which topics have new replies since your last visit and to automatically log you in when you return.\r \r If your computer is unable to use the cookie system to browse the board correctly, then the board will automatically add in a session ID to each link to track you around the board.\r \rClearing Cookies \r \r You can clear the cookies at any time by clicking on the link found at the bottom of the main board page (the first page you see when returning to the board). If this does not work for you, you may need to remove the cookies manually.\r \rRemoving Cookies in Internet Explorer for Windows \r \r\r Close all open Internet Explorer Windows\r Click on the \'start\' button\r Move up to \'Find\' and click on \'Files and Folders\'\r When the new window appears, type in the domain name of the board you are using into the \'containing text\' field. (If the boards address was \'http://www.test.ru/forums/index.php\' you would enter \'test.ru\' without the quotes)\r In the \'look in\' box, type in C:WindowsCookies and press \'Find Now\'\r After it has finished searching, highlight all files (click on a file then press CTRL+A) and delete them.\r \r \rRemoving Cookies in Internet Explorer for Macintosh \r \r\r With Internet Explorer active, choose \'Edit\' and then \'Preferences\' from the Macintosh menu bar at the top of the screen\r When the preferences panel opens, choose \'Cookies\' found in the \'Receiving Files\' section.\r When the cookie pane loads, look for the domain name of the board (If the boards address was \'http://www.test.ru/forums/index.php\' look for \'test.ru\' or \'www.test.ru\'\r For each cookie, click on the entry and press the delete button.\r \r \r Your cookies should now be removed. In some cases you may need to restart your computer for the changes to take effect.', 'The benefits of using cookies and how to remove cookies set by this board.');";
$SQL[] = "REPLACE INTO ".ipsRegistry::dbFunctions()->getPrefix()."faq VALUES (3, 'Recovering lost or forgotten passwords', 'Security is a big feature on this board, and to that end, all passwords are encrypted when you register.\r This means that we cannot email your password to you as we hold no record of your \'uncrypted\' password. You can however, apply to have your password reset.\r \r To do this, click on the Lost Password link found on the log in page.\r \r Further instruction is available from there.', 'How to reset your password if you\'ve forgotton it.');";
$SQL[] = "REPLACE INTO ".ipsRegistry::dbFunctions()->getPrefix()."faq VALUES (4, 'Your Control Panel (My Controls)', 'Your control panel is your own private board console. You can change how the board looks and feels as well as your own information from here.\r \rSubscriptions \r \r This is where you manage your topic and forums subscriptions. Please see the help file \'Email Notification of new messages\' for more information on how to subscribe to topics.\r \rEdit Profile Info \r \r This section allows you to add or edit your contact information and enter some personal information if you choose.\r \rEdit Signature \r \r A board \'signature\' is very similar to an email signature. This signature is attached to the foot of every message you post unless you choose to check the box that allows you to ommit the signature in the message you are posting. You may use BB Code if available and in some cases, pure HTML (if the board administrator allows it).\r \rEdit Avatar Settings \r \r An avatar is a little image that appears under your username when you view a topic or post you authored. If the administrator allows, you may either choose from the board gallery, enter a URL to an avatar stored on your server or upload an avatar to use. You may also set the width of the avatar to ensure that it\'s sized in proportion.\r \rChange Personal Photo \r \r This section will allow you to add a photograph to your profile. This will be displayed when a user clicks to view your profile, on the mini-profile screen and will also be linked to from the member list.\r \rEmail Settings \r \rHide my email address allows you to deny the ability for other users to send you an email from the board.\rSend me updates sent by the board administrator will allow the administrator to include your email address in any mailings they send out - this is used mostly for important updates and community information.\rInclude a copy of the post when emailing me from a subscribed topic , this allows you to have the new post included in any reply to topic notifications.\rSend a confirmation email when I receive a new private message , this will send you an e-mail notification to your registered e-mail address each time you receive a private message on the board.\rEnable \'Email Notification\' by default? , this will automatically subscribe you to any topic that you make a reply to. You may unsubscribe from the \'Subscriptions\' section of My Controls if you wish.\r \rBoard Settings \r \r From this section, you can set your time zone, choose to not see users signatures, avatars and posted images.\r You can choose to get a pop up window informing you when you have a new message and choose to show or hide the \'Fast Reply\' box where it is enabled.\r You are also able to choose display preferences for the number of topics/posts shown per page on the board.\r \rSkins and Languages \r \r If available, you can choose a skin style and language choice. This affects how the board is displayed so you may wish to preview the skin before submitting the form.\r \rChange Email Address \r \r At any time, you can change the email address that is registered to your account. In some cases, you will need to revalidate your account after changing your email address. If this is the case, you will be notified before your email address change is processed.\r \rChange Password \r \r You may change your password from this section. Please note that you will need to know your current password before you can change your password.', 'Editing contact information, personal information, avatars, signatures, board settings, languages and style choices.');";
$SQL[] = "REPLACE INTO ".ipsRegistry::dbFunctions()->getPrefix()."faq VALUES (5, 'Email Notification of new messages', 'This board can notify you when a new reply is added to a topic. Many users find this useful to keep up to date on topics without the need to view the board to check for new messages.\r \r There are three ways to subscribe to a topic:\r \rClick the \'Track This Topic\' link at the top of the topic that you wish to track\r On the posting screen when replying to or creating a topic, check the \'Enable email notification of replies?\' checkbox\r From the E-Mail settings section of your User CP (My Controls) check the \'Enable Email Notification by default?\' option, this will automatically subscribe you to any topic that you make a reply to\r \r Please note that to avoid multiple emails being sent to your email address, you will only get one e-mail for each topic you are subscribed to until the next time you visit the board.\r \r You are also able to subscribe to each individual forum on the board, to be notified when a new topic is created in that particular forum. To enable this, click the \'Subscribe to this forum\' link at the bottom of the forum that you wish to subscribe to.\r \r To unsubscribe from any forums or topics that you are subscribed to - just go to the \'Subscriptions\' section of \'My Controls\' and you can do this from there.', 'How to get emailed when a new reply is added to a topic.');";
@@ -2245,7 +2245,7 @@ class version_upgrade
$this->registry->output->addMessage("Data recached...");
unset($this->request['workact']);
unset($this->request['st']);
- unset(IPSSetUp::getSavedData('vid'));
+ //unset(IPSSetUp::getSavedData('vid'));
}
diff --git a/upload/admin/applications/core/setup/versions/upg_10004/version_upgrade_mysql.php b/upload/admin/applications/core/setup/versions/upg_10004/version_upgrade_mysql.php
index a2419ac8..b4f7f4d1 100644
--- a/upload/admin/applications/core/setup/versions/upg_10004/version_upgrade_mysql.php
+++ b/upload/admin/applications/core/setup/versions/upg_10004/version_upgrade_mysql.php
@@ -2,15 +2,15 @@
/*
+--------------------------------------------------------------------------
-| IP.Board v3.0.5
+| IP.Board v3.1.2
| ========================================
-| by Matthew Mecham
-| (c) 2001 - 2004 Invision Power Services
-| http://www.iinvisionpower.com
-| ========================================
-| Web: http://www.iinvisionboard.com
-| Email: matt@iinvisionpower.com
-| Licence Info: http://www.iinvisionboard.com/?license
+| by Matthew Mecham
+| (c) 2001 - 2004 Invision Power Services
+| http://www.invisionpower.com
+| ========================================
+| Web: http://www.invisionboard.com
+| Email: matt@invisionpower.com
+| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > IPB UPGRADE 1.1 -> 2.0 SQL STUFF!
diff --git a/upload/admin/applications/core/setup/versions/upg_20004/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_20004/mysql_updates.php
index d2b00b72..86ef875d 100644
--- a/upload/admin/applications/core/setup/versions/upg_20004/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_20004/mysql_updates.php
@@ -2,15 +2,15 @@
/*
+--------------------------------------------------------------------------
-| IP.Board v3.0.5
+| IP.Board v3.1.2
| ========================================
-| by Matthew Mecham
-| (c) 2001 - 2004 Invision Power Services
-| http://www.iinvisionpower.com
-| ========================================
-| Web: http://www.iinvisionboard.com
-| Email: matt@iinvisionpower.com
-| Licence Info: http://www.iinvisionboard.com/?license
+| by Matthew Mecham
+| (c) 2001 - 2004 Invision Power Services
+| http://www.invisionpower.com
+| ========================================
+| Web: http://www.invisionboard.com
+| Email: matt@invisionpower.com
+| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > IPB UPGRADE MODULE:: IPB 2.0.0 PDR1 -> PDR 2
@@ -30,29 +30,26 @@ if ( ! defined( 'IN_IPB' ) )
$SQL = array();
-$SQL[] = "INSERT INTO ibf_conf_settings_titles (conf_title_title, conf_title_desc, conf_title_count, conf_title_noshow, conf_title_keyword) VALUES ('IPB Portal', 'These settings enable you to enable or disable IPB Portal and control the options IPB Portal offers.', 20, 0, 'ipbportal');";
+$SQL[] = "INSERT INTO conf_settings_titles (conf_title_title, conf_title_desc, conf_title_count, conf_title_noshow, conf_title_keyword) VALUES ('IPB Portal', 'These settings enable you to enable or disable IPB Portal and control the options IPB Portal offers.', 20, 0, 'ipbportal');";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('ENABLE IPB Portal?', 'If \'yes\', IPB Portal can be accessed via \'index.php?act=home\' or via the special \'index.php\' script (see documentation for more info).', '22', 'yes_no', 'csite_on', '', '1', '', '', 1, 1, '', 0, '', 1);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('IPB Portal Page Title?', 'This will appear inbetween the <title> elements on the page', '22', 'input', 'csite_title', '', 'IPB Portal', '', '', 1, 2, '', 0, '', 0);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Forums to export articles from', 'Separate forum ids with a comma for more than one', '22', 'input', 'csite_article_forum', '1,2,3,4,5,6', '', '', '', 1, 3, '', 0, '', 0);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Number of Articles to display in the main section', '', '22', 'input', 'csite_article_max', '', '15', '', '', 1, 4, '', 0, '', 0);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Enable Recent Articles?', 'This will show a list of recent topic titles on the IPB Portal page', '22', 'yes_no', 'csite_article_recent_on', '', '1', '', '', 1, 5, 'IPB Portal Recent Articles', 0, '', 0);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Max. no recent articles to show', '', '22', 'input', 'csite_article_recent_max', '', '5', '', '', 1, 6, '', 0, '', 0);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Max. length of topic titles', '', '22', 'input', 'csite_article_len', '', '30', '', '', 1, 7, '', 1, '', 0);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Date format for articles', 'Same as PHP\'s date function', '22', 'input', 'csite_article_date', '', 'm-j-y H:i', '', '', 1, 3, '', 0, '', 0);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Enable Recent Discussions', '', '22', 'yes_no', 'csite_discuss_on', '', '1', '', '', 1, 9, 'IPB Portal Recent Discussions', 0, '', 0);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Max. no recent discussions to show', '', '22', 'input', 'csite_discuss_max', '', '10', '', '', 1, 10, '', 0, '', 0);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Max. length of topic titles', '', '22', 'input', 'csite_discuss_len', '', '30', '', '', 1, 11, '', 1, '', 0);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Show User / Guest Info box?', '', '22', 'yes_no', 'csite_pm_show', '', '1', '', '', 1, 12, 'IPB Portal Components', 0, '', 0);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Show online users?', '', '22', 'yes_no', 'csite_online_show', '', '1', '', '', 1, 13, '', 0, '', 0);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Show search box?', '', '22', 'yes_no', 'csite_search_show', '', '1', '', '', 1, 14, '', 0, '', 0);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Enable skin selection choice dropdown?', '', '22', 'yes_no', 'csite_skinchange_show', '', '1', '', '', 1, 15, '', 0, '', 0);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Enter URL to poll topic for inclusion', 'Leave blank to not show a poll or the poll box', '22', 'input', 'csite_poll_url', '', '', '', '', 1, 17, '', 0, '', 0);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Show Site Navigation Menu?', '', '22', 'yes_no', 'csite_nav_show', '', '1', '', '', 1, 18, '', 0, '', 0);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Site Navigation Menu Links', 'One per line in this format http://www.apple.com [Apple\'s Website] {board_url} will convert into your board', '22', 'textarea', 'csite_nav_contents', '', '{board_url} [Forums]\r\n{board_url}act=Search&do=getactive [Today\'s Active Topics]\r\n{board_url}act=Stats [Today\'s Top 10 Posters]\r\n{board_url}act=Stats&do=leaders [Contact Staff]', '', 'if ( $show == 1)\r\n{\r\n $value = preg_replace( \"/&(middot|quot|copy|amp)/\", \"&\\\\1\", $value );\r\n}', 1, 19, '', 0, '', 0);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Show Affiliates / Favoured Sites box?', '', '22', 'yes_no', 'csite_fav_show', '', '0', '', '', 1, 20, '', 0, '', 0);";
-$SQL[] = "INSERT INTO ibf_conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Show Affiliates / Favoured Sites box content', 'Raw HTML enabled', '22', 'textarea', 'csite_fav_contents', '', '', '', 'if ( $show == 1)\r\n{\r\n $value = preg_replace( \"/&(middot|quot|copy|amp)/\", \"&\\\\1\", $value );\r\n}', 1, 21, '', 1, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('ENABLE IPB Portal?', 'If \'yes\', IPB Portal can be accessed via \'index.php?act=home\' or via the special \'index.php\' script (see documentation for more info).', '22', 'yes_no', 'csite_on', '', '1', '', '', 1, 1, '', 0, '', 1);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('IPB Portal Page Title?', 'This will appear inbetween the <title> elements on the page', '22', 'input', 'csite_title', '', 'IPB Portal', '', '', 1, 2, '', 0, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Forums to export articles from', 'Separate forum ids with a comma for more than one', '22', 'input', 'csite_article_forum', '1,2,3,4,5,6', '', '', '', 1, 3, '', 0, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Number of Articles to display in the main section', '', '22', 'input', 'csite_article_max', '', '15', '', '', 1, 4, '', 0, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Enable Recent Articles?', 'This will show a list of recent topic titles on the IPB Portal page', '22', 'yes_no', 'csite_article_recent_on', '', '1', '', '', 1, 5, 'IPB Portal Recent Articles', 0, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Max. no recent articles to show', '', '22', 'input', 'csite_article_recent_max', '', '5', '', '', 1, 6, '', 0, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Max. length of topic titles', '', '22', 'input', 'csite_article_len', '', '30', '', '', 1, 7, '', 1, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Date format for articles', ' Same as PHP\'s date function', '22', 'input', 'csite_article_date', '', 'm-j-y H:i', '', '', 1, 3, '', 0, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Enable Recent Discussions', '', '22', 'yes_no', 'csite_discuss_on', '', '1', '', '', 1, 9, 'IPB Portal Recent Discussions', 0, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Max. no recent discussions to show', '', '22', 'input', 'csite_discuss_max', '', '10', '', '', 1, 10, '', 0, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Max. length of topic titles', '', '22', 'input', 'csite_discuss_len', '', '30', '', '', 1, 11, '', 1, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Show User / Guest Info box?', '', '22', 'yes_no', 'csite_pm_show', '', '1', '', '', 1, 12, 'IPB Portal Components', 0, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Show online users?', '', '22', 'yes_no', 'csite_online_show', '', '1', '', '', 1, 13, '', 0, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Show search box?', '', '22', 'yes_no', 'csite_search_show', '', '1', '', '', 1, 14, '', 0, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Enable skin selection choice dropdown?', '', '22', 'yes_no', 'csite_skinchange_show', '', '1', '', '', 1, 15, '', 0, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Enter URL to poll topic for inclusion', 'Leave blank to not show a poll or the poll box', '22', 'input', 'csite_poll_url', '', '', '', '', 1, 17, '', 0, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Show Site Navigation Menu?', '', '22', 'yes_no', 'csite_nav_show', '', '1', '', '', 1, 18, '', 0, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Site Navigation Menu Links', 'One per line in this format http://www.apple.com [Apple\'s Website] {board_url} will convert into your board', '22', 'textarea', 'csite_nav_contents', '', '{board_url} [Forums]\r\n{board_url}act=Search&do=getactive [Today\'s Active Topics]\r\n{board_url}act=Stats [Today\'s Top 10 Posters]\r\n{board_url}act=Stats&do=leaders [Contact Staff]', '', 'if ( $show == 1)\r\n{\r\n $value = preg_replace( \"/&(middot|quot|copy|amp)/\", \"&\\\\1\", $value );\r\n}', 1, 19, '', 0, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Show Affiliates / Favoured Sites box?', '', '22', 'yes_no', 'csite_fav_show', '', '0', '', '', 1, 20, '', 0, '', 0);";
+$SQL[] = "INSERT INTO conf_settings (conf_title, conf_description, conf_group, conf_type, conf_key, conf_value, conf_default, conf_extra, conf_evalphp, conf_protected, conf_position, conf_start_group, conf_end_group, conf_help_key, conf_add_cache) VALUES ('Show Affiliates / Favoured Sites box content', 'Raw HTML enabled', '22', 'textarea', 'csite_fav_contents', '', '', '', 'if ( $show == 1)\r\n{\r\n $value = preg_replace( \"/&(middot|quot|copy|amp)/\", \"&\\\\1\", $value );\r\n}', 1, 21, '', 1, '', 0);";
-
-
-?>
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_20005/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_20005/mysql_updates.php
index d3c76074..44337dba 100644
--- a/upload/admin/applications/core/setup/versions/upg_20005/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_20005/mysql_updates.php
@@ -2,15 +2,15 @@
/*
+--------------------------------------------------------------------------
-| IP.Board v3.0.5
+| IP.Board v3.1.2
| ========================================
-| by Matthew Mecham
-| (c) 2001 - 2004 Invision Power Services
-| http://www.iinvisionpower.com
-| ========================================
-| Web: http://www.iinvisionboard.com
-| Email: matt@iinvisionpower.com
-| Licence Info: http://www.iinvisionboard.com/?license
+| by Matthew Mecham
+| (c) 2001 - 2004 Invision Power Services
+| http://www.invisionpower.com
+| ========================================
+| Web: http://www.invisionboard.com
+| Email: matt@invisionpower.com
+| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > IPB UPGRADE MODULE:: IPB 2.0.0 PDR1 -> PDR 2
@@ -29,10 +29,6 @@ if ( ! defined( 'IN_IPB' ) )
$SQL = array();
-$SQL[] = "INSERT INTO ibf_task_manager (task_title, task_file, task_next_run, task_week_day, task_month_day, task_hour, task_minute, task_cronkey, task_log, task_description, task_enabled, task_key, task_safemode) VALUES ('Send Bulk Mail', 'bulkmail.php', 1086706080, -1, -1, -1, -1, '61359ac93eb93ebbd935a4e275ade2db', 0, 'Dynamically assigned, no need to edit or change', 0, 'bulkmail', 1);";
-$SQL[] = "INSERT INTO ibf_task_manager (task_title, task_file, task_next_run, task_week_day, task_month_day, task_hour, task_minute, task_cronkey, task_log, task_description, task_enabled, task_key, task_safemode) VALUES ('Daily Topic & Forum Digest', 'dailydigest.php', 1086912600, -1, -1, 0, 10, '723cab2aae32dd5d04898b1151038846', 1, 'Emails out daily topic & forum digest emails', 1, 'dailydigest', 0);";
-$SQL[] = "INSERT INTO ibf_task_manager (task_title, task_file, task_next_run, task_week_day, task_month_day, task_hour, task_minute, task_cronkey, task_log, task_description, task_enabled, task_key, task_safemode) VALUES ('Weekly Topic & Forum Digest', 'weeklydigest.php', 1087096200, 0, -1, 3, 10, '7e7fccd07f781bdb24ac108d26612931', 1, 'Emails weekly topic & forum digest emails', 1, 'weeklydigest', 0);";
-
-
-
-?>
\ No newline at end of file
+$SQL[] = "INSERT INTO task_manager (task_title, task_file, task_next_run, task_week_day, task_month_day, task_hour, task_minute, task_cronkey, task_log, task_description, task_enabled, task_key, task_safemode) VALUES ('Send Bulk Mail', 'bulkmail.php', 1086706080, -1, -1, -1, -1, '61359ac93eb93ebbd935a4e275ade2db', 0, 'Dynamically assigned, no need to edit or change', 0, 'bulkmail', 1);";
+$SQL[] = "INSERT INTO task_manager (task_title, task_file, task_next_run, task_week_day, task_month_day, task_hour, task_minute, task_cronkey, task_log, task_description, task_enabled, task_key, task_safemode) VALUES ('Daily Topic & Forum Digest', 'dailydigest.php', 1086912600, -1, -1, 0, 10, '723cab2aae32dd5d04898b1151038846', 1, 'Emails out daily topic & forum digest emails', 1, 'dailydigest', 0);";
+$SQL[] = "INSERT INTO task_manager (task_title, task_file, task_next_run, task_week_day, task_month_day, task_hour, task_minute, task_cronkey, task_log, task_description, task_enabled, task_key, task_safemode) VALUES ('Weekly Topic & Forum Digest', 'weeklydigest.php', 1087096200, 0, -1, 3, 10, '7e7fccd07f781bdb24ac108d26612931', 1, 'Emails weekly topic & forum digest emails', 1, 'weeklydigest', 0);";
diff --git a/upload/admin/applications/core/setup/versions/upg_20007/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_20007/mysql_updates.php
index 096eafb1..648394c0 100644
--- a/upload/admin/applications/core/setup/versions/upg_20007/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_20007/mysql_updates.php
@@ -1,34 +1,32 @@
- IPB UPGRADE MODULE:: IPB 2.0.0 PF1 -> PF 2
-| > Script written by Matt Mecham
-| > Date started: 23rd April 2004
-| > "So what, pop is dead - it's no great loss.
- So many facelifts, it's face flew off"
-+--------------------------------------------------------------------------
-*/
-
-if ( ! defined( 'IN_IPB' ) )
-{
- print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-$SQL = array();
-
-$SQL[] = "INSERT INTO ibf_custom_bbcode (bbcode_title, bbcode_desc, bbcode_tag, bbcode_replace, bbcode_useoption, bbcode_example) VALUES ('CODEBOX', 'Use this BBCode tag to show a scrolling codebox. Useful for long sections of code.', 'codebox', 'CODE
{content}
', 0, '[codebox]long_code_here = '';[/codebox]');";
-
-?>
\ No newline at end of file
+ IPB UPGRADE MODULE:: IPB 2.0.0 PF1 -> PF 2
+| > Script written by Matt Mecham
+| > Date started: 23rd April 2004
+| > "So what, pop is dead - it's no great loss.
+ So many facelifts, it's face flew off"
++--------------------------------------------------------------------------
+*/
+
+if ( ! defined( 'IN_IPB' ) )
+{
+ print "Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+$SQL = array();
+
+$SQL[] = "INSERT INTO custom_bbcode (bbcode_title, bbcode_desc, bbcode_tag, bbcode_replace, bbcode_useoption, bbcode_example) VALUES ('CODEBOX', 'Use this BBCode tag to show a scrolling codebox. Useful for long sections of code.', 'codebox', 'CODE
{content}
', 0, '[codebox]long_code_here = '';[/codebox]');";
diff --git a/upload/admin/applications/core/setup/versions/upg_20009/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_20009/mysql_updates.php
index 0e349056..b44f64aa 100644
--- a/upload/admin/applications/core/setup/versions/upg_20009/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_20009/mysql_updates.php
@@ -1,27 +1,26 @@
/p_up.gif\' border=\'0\' alt=\'Go to the top of the page\' />', 1, 1);";
-$SQL[] = "INSERT INTO ibf_skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('P_CARD', ' /p_card.gif\' border=\'0\' alt=\'Profile Card\' />', 1, 1);";
-$SQL[] = "INSERT INTO ibf_skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('PRO_AIM', ' /profile_aim.gif\' border=\'0\' alt=\'AIM\' />', 1, 1);";
-$SQL[] = "INSERT INTO ibf_skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('PRO_ITEM', ' /profile_item.gif\' border=\'0\' alt=\'Profile Item\' />', 1, 1);";
-$SQL[] = "INSERT INTO ibf_skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('PRO_MSN', ' /profile_msn.gif\' border=\'0\' alt=\'MSN\' />', 1, 1);";
-$SQL[] = "INSERT INTO ibf_skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('PRO_ICQ', ' /profile_icq.gif\' border=\'0\' alt=\'ICQ\' />', 1, 1);";
-$SQL[] = "INSERT INTO ibf_skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('PRO_YIM', ' /profile_yahoo.gif\' border=\'0\' alt=\'Yahoo\' />', 1, 1);";
-$SQL[] = "INSERT INTO ibf_skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('PRO_CONTACT', ' /icon_msg_nonew.gif\' border=\'0\' alt=\'Contact\' />', 1, 1);";
-$SQL[] = "INSERT INTO ibf_skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('BAR_LEFT', ' /bar_left.gif\' border=\'0\' alt=\'*\' />', 1, 1);";
-$SQL[] = "INSERT INTO ibf_skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('BAR_RIGHT', ' /bar_right.gif\' border=\'0\' alt=\'*\' />', 1, 1);";
-$SQL[] = "INSERT INTO ibf_skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('CAL_GOTO', ' /cal_goto.gif\' border=\'0\' alt=\'Goto Month\' />', 1, 1);";
-?>
\ No newline at end of file
+$SQL[] = "INSERT INTO skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('P_UP', ' /p_up.gif\' border=\'0\' alt=\'Go to the top of the page\' />', 1, 1);";
+$SQL[] = "INSERT INTO skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('P_CARD', ' /p_card.gif\' border=\'0\' alt=\'Profile Card\' />', 1, 1);";
+$SQL[] = "INSERT INTO skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('PRO_AIM', ' /profile_aim.gif\' border=\'0\' alt=\'AIM\' />', 1, 1);";
+$SQL[] = "INSERT INTO skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('PRO_ITEM', ' /profile_item.gif\' border=\'0\' alt=\'Profile Item\' />', 1, 1);";
+$SQL[] = "INSERT INTO skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('PRO_MSN', ' /profile_msn.gif\' border=\'0\' alt=\'MSN\' />', 1, 1);";
+$SQL[] = "INSERT INTO skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('PRO_ICQ', ' /profile_icq.gif\' border=\'0\' alt=\'ICQ\' />', 1, 1);";
+$SQL[] = "INSERT INTO skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('PRO_YIM', ' /profile_yahoo.gif\' border=\'0\' alt=\'Yahoo\' />', 1, 1);";
+$SQL[] = "INSERT INTO skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('PRO_CONTACT', ' /icon_msg_nonew.gif\' border=\'0\' alt=\'Contact\' />', 1, 1);";
+$SQL[] = "INSERT INTO skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('BAR_LEFT', ' /bar_left.gif\' border=\'0\' alt=\'*\' />', 1, 1);";
+$SQL[] = "INSERT INTO skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('BAR_RIGHT', ' /bar_right.gif\' border=\'0\' alt=\'*\' />', 1, 1);";
+$SQL[] = "INSERT INTO skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('CAL_GOTO', ' /cal_goto.gif\' border=\'0\' alt=\'Goto Month\' />', 1, 1);";
diff --git a/upload/admin/applications/core/setup/versions/upg_20010/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_20010/mysql_updates.php
index 9f35f500..91e412b4 100644
--- a/upload/admin/applications/core/setup/versions/upg_20010/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_20010/mysql_updates.php
@@ -1,24 +1,23 @@
/profile_icq.gif\' border=\'0\' alt=\'ICQ\' />', 1, 1);";
+$SQL[] = "DELETE FROM skin_macro WHERE macro_value='PRO_ICQ' and macro_set=1";
+$SQL[] = "INSERT INTO skin_macro (macro_value, macro_replace, macro_can_remove, macro_set) VALUES ('PRO_ICQ', ' /profile_icq.gif\' border=\'0\' alt=\'ICQ\' />', 1, 1);";
# Fix bug where "select * from members where temp_ban..." prevents NULL IS NOT NULL confusion
-$SQL[] = "ALTER TABLE ibf_members change temp_ban temp_ban varchar(100) default '0'";
-?>
\ No newline at end of file
+$SQL[] = "ALTER TABLE members change temp_ban temp_ban varchar(100) default '0'";
diff --git a/upload/admin/applications/core/setup/versions/upg_20012/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_20012/mysql_updates.php
index 0ee5b9e9..af46de01 100644
--- a/upload/admin/applications/core/setup/versions/upg_20012/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_20012/mysql_updates.php
@@ -1,31 +1,30 @@
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_21003/ipb_acpperms.xml b/upload/admin/applications/core/setup/versions/upg_21003/ipb_acpperms.xml
deleted file mode 100644
index 8e0b25e7..00000000
--- a/upload/admin/applications/core/setup/versions/upg_21003/ipb_acpperms.xml
+++ /dev/null
@@ -1,845 +0,0 @@
-
-
-
-
- recache
- tools
- admin
-
-
-
- remove
- admin
- adminlog
-
-
-
- add
- content
- attach
-
-
-
- edit
- content
- attach
-
-
-
- remove
- content
- attach
-
-
-
- export
- content
- attach
-
-
-
- import
- content
- attach
-
-
-
- stats
- content
- attach
-
-
-
- search
- content
- attach
-
-
-
- bw-add
- content
- babw
-
-
-
- bw-remove
- content
- babw
-
-
-
- bw-edit
- content
- babw
-
-
-
- bw-export
- content
- babw
-
-
-
- bw-import
- content
- babw
-
-
-
- ban-view
- content
- babw
-
-
-
- ban-add
- content
- babw
-
-
-
- ban-remove
- content
- babw
-
-
-
- add
- content
- bbcode
-
-
-
- edit
- content
- bbcode
-
-
-
- remove
- content
- bbcode
-
-
-
- export
- content
- bbcode
-
-
-
- import
- content
- bbcode
-
-
-
- remove
- content
- calendars
-
-
-
- add
- content
- calendars
-
-
-
- edit
- content
- calendars
-
-
-
- recache
- content
- calendars
-
-
-
- add
- admin
- components
-
-
-
- edit
- admin
- components
-
-
-
- export
- admin
- components
-
-
-
- import
- admin
- components
-
-
-
- remove
- admin
- emailerror
-
-
-
- remove
- admin
- emaillog
-
-
-
- export
- lookandfeel
- emoticons
-
-
-
- import
- lookandfeel
- emoticons
-
-
-
- edit
- lookandfeel
- emoticons
-
-
-
- add
- lookandfeel
- emoticons
-
-
-
- remove
- lookandfeel
- emoticons
-
-
-
- upload
- lookandfeel
- emoticons
-
-
-
- add
- content
- forum
-
-
-
- edit
- content
- forum
-
-
-
- permedit
- content
- forum
-
-
-
- reorder
- content
- forum
-
-
-
- remove
- content
- forum
-
-
-
- recount
- content
- forum
-
-
-
- empty
- content
- forum
-
-
-
- rules
- content
- forum
-
-
-
- skin
- content
- forum
-
-
-
- add
- content
- group
-
-
-
- edit
- content
- group
-
-
-
- remove
- content
- group
-
-
-
- perms
- content
- group
-
-
-
- edit
- tools
- help
-
-
-
- add
- tools
- help
-
-
-
- remove
- tools
- help
-
-
-
- add
- lookandfeel
- lang
-
-
-
- edit
- lookandfeel
- lang
-
-
-
- remove
- lookandfeel
- lang
-
-
-
- export
- lookandfeel
- lang
-
-
-
- import
- lookandfeel
- lang
-
-
-
- add
- tools
- login
-
-
-
- edit
- tools
- login
-
-
-
- diagnostics
- tools
- login
-
-
-
- export
- tools
- login
-
-
-
- import
- tools
- login
-
-
-
- edit
- content
- mem
-
-
-
- suspend
- content
- mem
-
-
-
- add
- content
- mem
-
-
-
- remove
- content
- mem
-
-
-
- title-view
- content
- mem
-
-
-
- title-edit
- content
- mem
-
-
-
- title-add
- content
- mem
-
-
-
- title-remove
- content
- mem
-
-
-
- mod
- content
- mem
-
-
-
- ban
- content
- mem
-
-
-
- view
- content
- mtools
-
-
-
- add
- content
- mod
-
-
-
- edit
- content
- mod
-
-
-
- remove
- content
- mod
-
-
-
- remove
- admin
- modlog
-
-
-
- add
- content
- multimod
-
-
-
- edit
- content
- multimod
-
-
-
- remove
- content
- multimod
-
-
-
- install
- content
- msubs
-
-
-
- edit
- content
- msubs
-
-
-
- remove
- content
- msubs
-
-
-
- add
- content
- msubs
-
-
-
- search
- content
- msubs
-
-
-
- edit
- tools
- portal
-
-
-
- add
- tools
- postoffice
-
-
-
- edit
- tools
- postoffice
-
-
-
- send
- tools
- postoffice
-
-
-
- remove
- tools
- postoffice
-
-
-
- add
- content
- field
-
-
-
- edit
- content
- field
-
-
-
- remove
- content
- field
-
-
-
- recount
- tools
- rebuild
-
-
-
- rebuild
- tools
- rebuild
-
-
-
- add
- content
- rssexport
-
-
-
- edit
- content
- rssexport
-
-
-
- recache
- content
- rssexport
-
-
-
- remove
- content
- rssexport
-
-
-
- add
- content
- rssimport
-
-
-
- edit
- content
- rssimport
-
-
-
- recache
- content
- rssimport
-
-
-
- remove
- content
- rssimport
-
-
-
- edit
- tools
- op
-
-
-
- remove
- tools
- op
-
-
-
- add
- tools
- op
-
-
-
- export
- tools
- op
-
-
-
- search
- tools
- op
-
-
-
- import
- tools
- op
-
-
-
- edit
- lookandfeel
- style
-
-
-
- rundiff
- lookandfeel
- skindiff
-
-
-
- export
- lookandfeel
- skindiff
-
-
-
- remove
- lookandfeel
- skindiff
-
-
-
- export
- lookandfeel
- import
-
-
-
- import
- lookandfeel
- import
-
-
-
- edit
- lookandfeel
- image
-
-
-
- remove
- lookandfeel
- image
-
-
-
- add
- lookandfeel
- image
-
-
-
- add
- lookandfeel
- sets
-
-
-
- edit
- lookandfeel
- sets
-
-
-
- remove
- lookandfeel
- sets
-
-
-
- rebuild
- lookandfeel
- sets
-
-
-
- edit
- lookandfeel
- templ
-
-
-
- remove
- lookandfeel
- templ
-
-
-
- add
- lookandfeel
- templ
-
-
-
- edit
- lookandfeel
- wrap
-
-
-
- recache
- lookandfeel
- skintools
-
-
-
- changemember
- lookandfeel
- skintools
-
-
-
- search
- lookandfeel
- skintools
-
-
-
- remove
- admin
- spiderlog
-
-
-
- show
- admin
- stats
-
-
-
- edit
- tools
- task
-
-
-
- add
- tools
- task
-
-
-
- remove
- tools
- task
-
-
-
- runnow
- tools
- task
-
-
-
- log
- tools
- task
-
-
-
- view
- admin
- warnlog
-
-
-
- remove
- admin
- warnlog
-
-
-
-
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates.php
index b2feafe5..3b9983e3 100644
--- a/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates.php
@@ -1,15 +1,15 @@
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates_1.php b/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates_1.php
index 3608be44..f3f13a60 100644
--- a/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates_1.php
+++ b/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates_1.php
@@ -1,38 +1,37 @@
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates_2.php b/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates_2.php
index 11b059d1..8b8bcac1 100644
--- a/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates_2.php
+++ b/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates_2.php
@@ -1,30 +1,29 @@
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates_3.php b/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates_3.php
index e34cbb07..367265ea 100644
--- a/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates_3.php
+++ b/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates_3.php
@@ -1,44 +1,42 @@
\ No newline at end of file
+$SQL[] = "ALTER TABLE search_results ADD PRIMARY KEY(id);";
+$SQL[] = "ALTER TABLE search_results ADD INDEX search_date(search_date);";
diff --git a/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates_4.php b/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates_4.php
index f48de96a..92f925fd 100644
--- a/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates_4.php
+++ b/upload/admin/applications/core/setup/versions/upg_21003/mysql_updates_4.php
@@ -1,55 +1,54 @@
, '', 'a:3:{s:9:\"perm_read\";s:1:\"*\";s:9:\"perm_post\";s:3:\"4,3\";s:10:\"perm_nomod\";s:0:\"\";}');";
+$SQL[] = "INSERT INTO cal_calendars (cal_id, cal_title, cal_moderate, cal_position, cal_event_limit, cal_bday_limit, cal_rss_export, cal_rss_export_days, cal_rss_export_max, cal_rss_update, cal_rss_update_last, cal_rss_cache, cal_permissions) VALUES (1, 'Community Calendar', 1, 0, 2, 1, 1, 14, 20, 1440, <%time%>, '', 'a:3:{s:9:\"perm_read\";s:1:\"*\";s:9:\"perm_post\";s:3:\"4,3\";s:10:\"perm_nomod\";s:0:\"\";}');";
-$SQL[] ="INSERT INTO ibf_login_methods (login_id, login_title, login_description, login_folder_name, login_maintain_url, login_register_url, login_type, login_alt_login_html, login_date, login_settings, login_enabled, login_safemode, login_installed, login_replace_form, login_allow_create) VALUES (1, 'IPB Internal', 'The standard method of authentication', 'internal', '', '', 'passthrough', '', <%time%>, 0, 1, 1, 1, 0, 1);";
-$SQL[] ="INSERT INTO ibf_login_methods (login_id, login_title, login_description, login_folder_name, login_maintain_url, login_register_url, login_type, login_alt_login_html, login_date, login_settings, login_enabled, login_safemode, login_installed, login_replace_form, login_allow_create) VALUES (2, 'LDAP Authentication', 'LDAP / Active Directory Authentication', 'ldap', '', '', 'passthrough', '', <%time%>, 0, 0, 1, 0, 0, 1);";
-$SQL[] ="INSERT INTO ibf_login_methods (login_id, login_title, login_description, login_folder_name, login_maintain_url, login_register_url, login_type, login_alt_login_html, login_date, login_settings, login_enabled, login_safemode, login_installed, login_replace_form, login_allow_create) VALUES (3, 'External Database', 'Authentication via an external database', 'external', '', '', 'passthrough', '', <%time%>, 0, 0, 1, 0, 0, 1);";
+$SQL[] = "INSERT INTO login_methods (login_id, login_title, login_description, login_folder_name, login_maintain_url, login_register_url, login_type, login_alt_login_html, login_date, login_settings, login_enabled, login_safemode, login_installed, login_replace_form, login_allow_create) VALUES (1, 'IPB Internal', 'The standard method of authentication', 'internal', '', '', 'passthrough', '', <%time%>, 0, 1, 1, 1, 0, 1);";
+$SQL[] = "INSERT INTO login_methods (login_id, login_title, login_description, login_folder_name, login_maintain_url, login_register_url, login_type, login_alt_login_html, login_date, login_settings, login_enabled, login_safemode, login_installed, login_replace_form, login_allow_create) VALUES (2, 'LDAP Authentication', 'LDAP / Active Directory Authentication', 'ldap', '', '', 'passthrough', '', <%time%>, 0, 0, 1, 0, 0, 1);";
+$SQL[] = "INSERT INTO login_methods (login_id, login_title, login_description, login_folder_name, login_maintain_url, login_register_url, login_type, login_alt_login_html, login_date, login_settings, login_enabled, login_safemode, login_installed, login_replace_form, login_allow_create) VALUES (3, 'External Database', 'Authentication via an external database', 'external', '', '', 'passthrough', '', <%time%>, 0, 0, 1, 0, 0, 1);";
-$SQL[] ="INSERT INTO ibf_task_manager VALUES ('', 'Update Topic Views Counter', 'updateviews.php', <%time%>, -1, -1, 3, -1, 'ddce954b5ba1c163bc627ca20725b595', 0, 'Used when topic views are not incremented immediately', 1, 'updateviews', 0, 0);";
-$SQL[] ="INSERT INTO ibf_task_manager VALUES ('', 'Subscription Expiration Notification', 'expiresubs.php', <%time%>, -1, -1, 1, 0, '21fa5f52cf9122c6fe940e1c6dac0b5a', 1, 'Sends out an email to all members who have a subscription due to expire', 1, 'expiresubs', 0, 0);";
-$SQL[] ="INSERT INTO ibf_task_manager VALUES ('', 'RSS Import Update', 'rssimport.php', <%time%>, -1, -1, -1, 30, '8f17dc0ba334e5f18e762f154365a578', 0, 'Imports any new RSS articles', 1, 'rssimport', 1, 0);";
+$SQL[] = "INSERT INTO task_manager VALUES ('', 'Update Topic Views Counter', 'updateviews.php', <%time%>, -1, -1, 3, -1, 'ddce954b5ba1c163bc627ca20725b595', 0, 'Used when topic views are not incremented immediately', 1, 'updateviews', 0, 0);";
+$SQL[] = "INSERT INTO task_manager VALUES ('', 'Subscription Expiration Notification', 'expiresubs.php', <%time%>, -1, -1, 1, 0, '21fa5f52cf9122c6fe940e1c6dac0b5a', 1, 'Sends out an email to all members who have a subscription due to expire', 1, 'expiresubs', 0, 0);";
+$SQL[] = "INSERT INTO task_manager VALUES ('', 'RSS Import Update', 'rssimport.php', <%time%>, -1, -1, -1, 30, '8f17dc0ba334e5f18e762f154365a578', 0, 'Imports any new RSS articles', 1, 'rssimport', 1, 0);";
-$SQL[] = "INSERT INTO ibf_task_manager (task_title, task_file, task_next_run, task_week_day, task_month_day, task_hour, task_minute, task_cronkey, task_log, task_description, task_enabled, task_key, task_safemode) VALUES ('Expire Paid Subscriptions', 'doexpiresubs.php', 1121212800, -1, -1, 0, 0, 'bb57399ea05eb9240b42d5d5f53575fb', 1, 'Unsubscribes members from their subscribed packages', 1, 'doexpiresubs', 1)";
+$SQL[] = "INSERT INTO task_manager (task_title, task_file, task_next_run, task_week_day, task_month_day, task_hour, task_minute, task_cronkey, task_log, task_description, task_enabled, task_key, task_safemode) VALUES ('Expire Paid Subscriptions', 'doexpiresubs.php', 1121212800, -1, -1, 0, 0, 'bb57399ea05eb9240b42d5d5f53575fb', 1, 'Unsubscribes members from their subscribed packages', 1, 'doexpiresubs', 1)";
-$SQL[] ="INSERT INTO ibf_components (com_id, com_title, com_author, com_url, com_version, com_date_added, com_menu_data, com_enabled, com_safemode, com_section, com_filename, com_description, com_url_title, com_url_uri, com_position) VALUES (1, 'Invision Gallery', 'Invision Power Services', '', '1.3.0', 1113309894, 'a:1:{i:1;a:5:{s:9:\"menu_text\";s:24:\"Purchase and Information\";s:8:\"menu_url\";s:9:\"code=show\";s:13:\"menu_redirect\";i:0;s:12:\"menu_permbit\";s:0:\"\";s:13:\"menu_permlang\";s:0:\"\";}}', 0, 1, 'gallery', 'gallery', 'Complete gallery system for your members', '{ipb.lang[\'gallery\']}', '{ipb.base_url}act=module&module=gallery', 1);";
-$SQL[] ="INSERT INTO ibf_components (com_id, com_title, com_author, com_url, com_version, com_date_added, com_menu_data, com_enabled, com_safemode, com_section, com_filename, com_description, com_url_title, com_url_uri, com_position) VALUES (2, 'Invision Community Blog', 'Invision Power Services', '', '1.1.2', 1113310263, 'a:1:{i:1;a:5:{s:9:\"menu_text\";s:24:\"Purchase and Information\";s:8:\"menu_url\";s:9:\"code=show\";s:13:\"menu_redirect\";i:0;s:12:\"menu_permbit\";s:0:\"\";s:13:\"menu_permlang\";s:0:\"\";}}', 0, 1, 'blog', 'blog', 'Blogging addition for your members', '{ipb.lang[\'blog\']}', '{ipb.base_url}automodule=blog', -1);";
-$SQL[] ="INSERT INTO ibf_components (com_id, com_title, com_author, com_url, com_version, com_date_added, com_menu_data, com_enabled, com_safemode, com_section, com_filename, com_description, com_url_title, com_url_uri, com_position) VALUES (3, 'Invision Chat (ParaChat)', 'Invision Power Services', '', '2.1', 1113313895, 'a:1:{i:1;a:5:{s:9:\"menu_text\";s:24:\"Purchase and Information\";s:8:\"menu_url\";s:9:\"code=show\";s:13:\"menu_redirect\";i:0;s:12:\"menu_permbit\";s:0:\"\";s:13:\"menu_permlang\";s:0:\"\";}}', 0, 1, 'chatpara', 'chatpara', 'Full real-time chat system for your members', '{ipb.lang[\'live_chat\']}', '{ipb.base_url}autocom=chatpara', 2);";
-$SQL[] ="INSERT INTO ibf_components (com_id, com_title, com_author, com_url, com_version, com_date_added, com_menu_data, com_enabled, com_safemode, com_section, com_filename, com_description, com_url_title, com_url_uri, com_position) VALUES (4, 'Invision Copyright Removal', 'Invision Power Services', '', '2.1', 1113314009, 'a:1:{i:1;a:5:{s:9:\"menu_text\";s:24:\"Purchase and Information\";s:8:\"menu_url\";s:9:\"code=show\";s:13:\"menu_redirect\";i:0;s:12:\"menu_permbit\";s:0:\"\";s:13:\"menu_permlang\";s:0:\"\";}}', 1, 1, 'copyright', 'copyright', 'Allows the copyright notices to be removed from the board\'s output', '', '', 3);";
+$SQL[] = "INSERT INTO components (com_id, com_title, com_author, com_url, com_version, com_date_added, com_menu_data, com_enabled, com_safemode, com_section, com_filename, com_description, com_url_title, com_url_uri, com_position) VALUES (1, 'Invision Gallery', 'Invision Power Services', '', '1.3.0', 1113309894, 'a:1:{i:1;a:5:{s:9:\"menu_text\";s:24:\"Purchase and Information\";s:8:\"menu_url\";s:9:\"code=show\";s:13:\"menu_redirect\";i:0;s:12:\"menu_permbit\";s:0:\"\";s:13:\"menu_permlang\";s:0:\"\";}}', 0, 1, 'gallery', 'gallery', 'Complete gallery system for your members', '{ipb.lang[\'gallery\']}', '{ipb.base_url}act=module&module=gallery', 1);";
+$SQL[] = "INSERT INTO components (com_id, com_title, com_author, com_url, com_version, com_date_added, com_menu_data, com_enabled, com_safemode, com_section, com_filename, com_description, com_url_title, com_url_uri, com_position) VALUES (2, 'Invision Community Blog', 'Invision Power Services', '', '1.1.2', 1113310263, 'a:1:{i:1;a:5:{s:9:\"menu_text\";s:24:\"Purchase and Information\";s:8:\"menu_url\";s:9:\"code=show\";s:13:\"menu_redirect\";i:0;s:12:\"menu_permbit\";s:0:\"\";s:13:\"menu_permlang\";s:0:\"\";}}', 0, 1, 'blog', 'blog', 'Blogging addition for your members', '{ipb.lang[\'blog\']}', '{ipb.base_url}automodule=blog', -1);";
+$SQL[] = "INSERT INTO components (com_id, com_title, com_author, com_url, com_version, com_date_added, com_menu_data, com_enabled, com_safemode, com_section, com_filename, com_description, com_url_title, com_url_uri, com_position) VALUES (3, 'Invision Chat (ParaChat)', 'Invision Power Services', '', '2.1', 1113313895, 'a:1:{i:1;a:5:{s:9:\"menu_text\";s:24:\"Purchase and Information\";s:8:\"menu_url\";s:9:\"code=show\";s:13:\"menu_redirect\";i:0;s:12:\"menu_permbit\";s:0:\"\";s:13:\"menu_permlang\";s:0:\"\";}}', 0, 1, 'chatpara', 'chatpara', 'Full real-time chat system for your members', '{ipb.lang[\'live_chat\']}', '{ipb.base_url}autocom=chatpara', 2);";
+$SQL[] = "INSERT INTO components (com_id, com_title, com_author, com_url, com_version, com_date_added, com_menu_data, com_enabled, com_safemode, com_section, com_filename, com_description, com_url_title, com_url_uri, com_position) VALUES (4, 'Invision Copyright Removal', 'Invision Power Services', '', '2.1', 1113314009, 'a:1:{i:1;a:5:{s:9:\"menu_text\";s:24:\"Purchase and Information\";s:8:\"menu_url\";s:9:\"code=show\";s:13:\"menu_redirect\";i:0;s:12:\"menu_permbit\";s:0:\"\";s:13:\"menu_permlang\";s:0:\"\";}}', 1, 1, 'copyright', 'copyright', 'Allows the copyright notices to be removed from the board\'s output', '', '', 3);";
-$SQL[] ="DELETE FROM ibf_conf_settings WHERE conf_key IN ( 'csite_article_forum' , 'csite_article_max', 'csite_article_recent_on',
+$SQL[] = "DELETE FROM conf_settings WHERE conf_key IN ( 'csite_article_forum' , 'csite_article_max', 'csite_article_recent_on',
'csite_article_recent_max', 'csite_article_len', 'csite_discuss_on',
'csite_discuss_max' , 'csite_discuss_len', 'csite_poll_url',
'csite_online_show', 'poll_disable_noreply' );";
# UPDATE KNOWN CONF_TITLE KEYS
-$SQL[] = "UPDATE ibf_conf_settings_titles SET conf_title_keyword='general' WHERE conf_title_id=1";
-$SQL[] = "UPDATE ibf_conf_settings_titles SET conf_title_keyword='boardoffline' WHERE conf_title_id=15";
-$SQL[] = "UPDATE ibf_conf_settings_titles SET conf_title_keyword='calendar' WHERE conf_title_id=9";
-$SQL[] = "UPDATE ibf_conf_settings_titles SET conf_title_keyword='converge' WHERE conf_title_id=18";
-$SQL[] = "UPDATE ibf_conf_settings_titles SET conf_title_keyword='coppa' WHERE conf_title_id=8";
-$SQL[] = "UPDATE ibf_conf_settings_titles SET conf_title_keyword='cpusaving' WHERE conf_title_id=2";
-$SQL[] = "UPDATE ibf_conf_settings_titles SET conf_title_keyword='date' WHERE conf_title_id=3";
-$SQL[] = "UPDATE ibf_conf_settings_titles SET conf_title_keyword='email' WHERE conf_title_id=12";
-$SQL[] = "UPDATE ibf_conf_settings_titles SET conf_title_keyword='searchsetup' WHERE conf_title_id=19";
-
-?>
\ No newline at end of file
+$SQL[] = "UPDATE conf_settings_titles SET conf_title_keyword='general' WHERE conf_title_id=1";
+$SQL[] = "UPDATE conf_settings_titles SET conf_title_keyword='boardoffline' WHERE conf_title_id=15";
+$SQL[] = "UPDATE conf_settings_titles SET conf_title_keyword='calendar' WHERE conf_title_id=9";
+$SQL[] = "UPDATE conf_settings_titles SET conf_title_keyword='converge' WHERE conf_title_id=18";
+$SQL[] = "UPDATE conf_settings_titles SET conf_title_keyword='coppa' WHERE conf_title_id=8";
+$SQL[] = "UPDATE conf_settings_titles SET conf_title_keyword='cpusaving' WHERE conf_title_id=2";
+$SQL[] = "UPDATE conf_settings_titles SET conf_title_keyword='date' WHERE conf_title_id=3";
+$SQL[] = "UPDATE conf_settings_titles SET conf_title_keyword='email' WHERE conf_title_id=12";
+$SQL[] = "UPDATE conf_settings_titles SET conf_title_keyword='searchsetup' WHERE conf_title_id=19";
diff --git a/upload/admin/applications/core/setup/versions/upg_21003/version_upgrade.php b/upload/admin/applications/core/setup/versions/upg_21003/version_upgrade.php
index 4fdb9217..a562c3cb 100644
--- a/upload/admin/applications/core/setup/versions/upg_21003/version_upgrade.php
+++ b/upload/admin/applications/core/setup/versions/upg_21003/version_upgrade.php
@@ -2,15 +2,15 @@
/*
+--------------------------------------------------------------------------
-| IP.Board v3.0.5
+| IP.Board v3.1.2
| ========================================
-| by Matthew Mecham
-| (c) 2001 - 2004 Invision Power Services
-| http://www.iinvisionpower.com
-| ========================================
-| Web: http://www.iinvisionboard.com
-| Email: matt@iinvisionpower.com
-| Licence Info: http://www.iinvisionboard.com/?license
+| by Matthew Mecham
+| (c) 2001 - 2004 Invision Power Services
+| http://www.invisionpower.com
+| ========================================
+| Web: http://www.invisionboard.com
+| Email: matt@invisionpower.com
+| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > IPB UPGRADE MODULE:: IPB 2.0.2 -> IPB 2.0.3
@@ -154,9 +154,14 @@ class version_upgrade
$output .= preg_replace( "/\s{1,}/", " ", $query ) . "\n\n";
}
else
- {
+ {
+ if( ! $query )
+ {
+ continue;
+ }
+
$this->DB->query( $query );
-
+
if ( $this->DB->error )
{
$this->registry->output->addError( $query." ".$this->DB->error );
@@ -168,7 +173,7 @@ class version_upgrade
}
}
- $this->registry->output->addMessage("$this->sqlcount запросов выполнено....");
+ $this->registry->output->addMessage("{$this->sqlcount} запросов выполнено....");
}
//--------------------------------
@@ -189,7 +194,13 @@ class version_upgrade
if ( IPSSetUp::getSavedData('man') AND $output )
{
- $this->_output = $this->registry->output->template()->upgrade_manual_queries( $output );
+ /* Create source file */
+ if ( $this->registry->dbFunctions()->getDriverType() == 'mysql' )
+ {
+ $sourceFile = IPSSetUp::createSqlSourceFile( $output, '21003', $id );
+ }
+
+ $this->_output = $this->registry->output->template()->upgrade_manual_queries( $output, $sourceFile );
}
}
diff --git a/upload/admin/applications/core/setup/versions/upg_21004/ipb_acpperms.xml b/upload/admin/applications/core/setup/versions/upg_21004/ipb_acpperms.xml
deleted file mode 100644
index abb54960..00000000
--- a/upload/admin/applications/core/setup/versions/upg_21004/ipb_acpperms.xml
+++ /dev/null
@@ -1,845 +0,0 @@
-
-
-
-
- recache
- tools
- admin
-
-
-
- remove
- admin
- adminlog
-
-
-
- add
- content
- attach
-
-
-
- edit
- content
- attach
-
-
-
- remove
- content
- attach
-
-
-
- export
- content
- attach
-
-
-
- import
- content
- attach
-
-
-
- stats
- content
- attach
-
-
-
- search
- content
- attach
-
-
-
- bw-add
- content
- babw
-
-
-
- bw-remove
- content
- babw
-
-
-
- bw-edit
- content
- babw
-
-
-
- bw-export
- content
- babw
-
-
-
- bw-import
- content
- babw
-
-
-
- ban-view
- content
- babw
-
-
-
- ban-add
- content
- babw
-
-
-
- ban-remove
- content
- babw
-
-
-
- add
- content
- bbcode
-
-
-
- edit
- content
- bbcode
-
-
-
- remove
- content
- bbcode
-
-
-
- export
- content
- bbcode
-
-
-
- import
- content
- bbcode
-
-
-
- remove
- content
- calendars
-
-
-
- add
- content
- calendars
-
-
-
- edit
- content
- calendars
-
-
-
- recache
- content
- calendars
-
-
-
- add
- admin
- components
-
-
-
- edit
- admin
- components
-
-
-
- export
- admin
- components
-
-
-
- import
- admin
- components
-
-
-
- remove
- admin
- emailerror
-
-
-
- remove
- admin
- emaillog
-
-
-
- export
- lookandfeel
- emoticons
-
-
-
- import
- lookandfeel
- emoticons
-
-
-
- edit
- lookandfeel
- emoticons
-
-
-
- add
- lookandfeel
- emoticons
-
-
-
- remove
- lookandfeel
- emoticons
-
-
-
- upload
- lookandfeel
- emoticons
-
-
-
- add
- content
- forum
-
-
-
- edit
- content
- forum
-
-
-
- permedit
- content
- forum
-
-
-
- reorder
- content
- forum
-
-
-
- remove
- content
- forum
-
-
-
- recount
- content
- forum
-
-
-
- empty
- content
- forum
-
-
-
- rules
- content
- forum
-
-
-
- skin
- content
- forum
-
-
-
- add
- content
- group
-
-
-
- edit
- content
- group
-
-
-
- remove
- content
- group
-
-
-
- perms
- content
- group
-
-
-
- edit
- tools
- help
-
-
-
- add
- tools
- help
-
-
-
- remove
- tools
- help
-
-
-
- add
- lookandfeel
- lang
-
-
-
- edit
- lookandfeel
- lang
-
-
-
- remove
- lookandfeel
- lang
-
-
-
- export
- lookandfeel
- lang
-
-
-
- import
- lookandfeel
- lang
-
-
-
- add
- tools
- loginauth
-
-
-
- edit
- tools
- loginauth
-
-
-
- diagnostics
- tools
- loginauth
-
-
-
- export
- tools
- loginauth
-
-
-
- import
- tools
- loginauth
-
-
-
- edit
- content
- mem
-
-
-
- suspend
- content
- mem
-
-
-
- add
- content
- mem
-
-
-
- remove
- content
- mem
-
-
-
- title-view
- content
- mem
-
-
-
- title-edit
- content
- mem
-
-
-
- title-add
- content
- mem
-
-
-
- title-remove
- content
- mem
-
-
-
- mod
- content
- mem
-
-
-
- ban
- content
- mem
-
-
-
- view
- content
- mtools
-
-
-
- add
- content
- mod
-
-
-
- edit
- content
- mod
-
-
-
- remove
- content
- mod
-
-
-
- remove
- admin
- modlog
-
-
-
- add
- content
- multimod
-
-
-
- edit
- content
- multimod
-
-
-
- remove
- content
- multimod
-
-
-
- install
- content
- msubs
-
-
-
- edit
- content
- msubs
-
-
-
- remove
- content
- msubs
-
-
-
- add
- content
- msubs
-
-
-
- search
- content
- msubs
-
-
-
- edit
- tools
- portal
-
-
-
- add
- tools
- postoffice
-
-
-
- edit
- tools
- postoffice
-
-
-
- send
- tools
- postoffice
-
-
-
- remove
- tools
- postoffice
-
-
-
- add
- content
- field
-
-
-
- edit
- content
- field
-
-
-
- remove
- content
- field
-
-
-
- recount
- tools
- rebuild
-
-
-
- rebuild
- tools
- rebuild
-
-
-
- add
- content
- rssexport
-
-
-
- edit
- content
- rssexport
-
-
-
- recache
- content
- rssexport
-
-
-
- remove
- content
- rssexport
-
-
-
- add
- content
- rssimport
-
-
-
- edit
- content
- rssimport
-
-
-
- recache
- content
- rssimport
-
-
-
- remove
- content
- rssimport
-
-
-
- edit
- tools
- op
-
-
-
- remove
- tools
- op
-
-
-
- add
- tools
- op
-
-
-
- export
- tools
- op
-
-
-
- search
- tools
- op
-
-
-
- import
- tools
- op
-
-
-
- edit
- lookandfeel
- style
-
-
-
- rundiff
- lookandfeel
- skindiff
-
-
-
- export
- lookandfeel
- skindiff
-
-
-
- remove
- lookandfeel
- skindiff
-
-
-
- export
- lookandfeel
- import
-
-
-
- import
- lookandfeel
- import
-
-
-
- edit
- lookandfeel
- image
-
-
-
- remove
- lookandfeel
- image
-
-
-
- add
- lookandfeel
- image
-
-
-
- add
- lookandfeel
- sets
-
-
-
- edit
- lookandfeel
- sets
-
-
-
- remove
- lookandfeel
- sets
-
-
-
- rebuild
- lookandfeel
- sets
-
-
-
- edit
- lookandfeel
- templ
-
-
-
- remove
- lookandfeel
- templ
-
-
-
- add
- lookandfeel
- templ
-
-
-
- edit
- lookandfeel
- wrap
-
-
-
- recache
- lookandfeel
- skintools
-
-
-
- changemember
- lookandfeel
- skintools
-
-
-
- search
- lookandfeel
- skintools
-
-
-
- remove
- admin
- spiderlog
-
-
-
- show
- admin
- stats
-
-
-
- edit
- tools
- task
-
-
-
- add
- tools
- task
-
-
-
- remove
- tools
- task
-
-
-
- runnow
- tools
- task
-
-
-
- log
- tools
- task
-
-
-
- view
- admin
- warnlog
-
-
-
- remove
- admin
- warnlog
-
-
-
-
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_21005/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_21005/mysql_updates.php
index 990e16d8..6d1021bf 100644
--- a/upload/admin/applications/core/setup/versions/upg_21005/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_21005/mysql_updates.php
@@ -1,29 +1,28 @@
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_21007/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_21007/mysql_updates.php
index 55f4f5e6..b56ffcfb 100644
--- a/upload/admin/applications/core/setup/versions/upg_21007/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_21007/mysql_updates.php
@@ -1,22 +1,21 @@
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_21007/version_upgrade.php b/upload/admin/applications/core/setup/versions/upg_21007/version_upgrade.php
index 2d5253c1..7e82e54e 100644
--- a/upload/admin/applications/core/setup/versions/upg_21007/version_upgrade.php
+++ b/upload/admin/applications/core/setup/versions/upg_21007/version_upgrade.php
@@ -2,15 +2,15 @@
/*
+--------------------------------------------------------------------------
-| IP.Board v3.0.5
+| IP.Board v3.1.2
| ========================================
-| by Matthew Mecham
-| (c) 2001 - 2004 Invision Power Services
-| http://www.iinvisionpower.com
-| ========================================
-| Web: http://www.iinvisionboard.com
-| Email: matt@iinvisionpower.com
-| Licence Info: http://www.iinvisionboard.com/?license
+| by Matthew Mecham
+| (c) 2001 - 2004 Invision Power Services
+| http://www.invisionpower.com
+| ========================================
+| Web: http://www.invisionboard.com
+| Email: matt@invisionpower.com
+| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
*/
diff --git a/upload/admin/applications/core/setup/versions/upg_21008/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_21008/mysql_updates.php
index 68fe68a6..946e450f 100644
--- a/upload/admin/applications/core/setup/versions/upg_21008/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_21008/mysql_updates.php
@@ -1,26 +1,25 @@
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_21009/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_21009/mysql_updates.php
index 437dc85f..e1f04534 100644
--- a/upload/admin/applications/core/setup/versions/upg_21009/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_21009/mysql_updates.php
@@ -1,49 +1,47 @@
\r During registration, the administrator requires that you supply a valid email address. This is important as the administrator may require that you validate your registration via an email. If this is the case, you will be notified when registering. If your e-mail does not arrive, then on the member bar at the top of the page, there will be a link that will allow you to re-send the validation e-mail. \r \r In some cases, the administrator will need to approve your registration before you can use your member account fully. If this is the case you will be notified during registration.\r \r Once you have registered and logged in, you will have access to your personal messenger and your control panel.\r \r For more information on these items, please see the relevant sections in this documentation.', description='How to register and the added benefits of being a registered member.' WHERE id=1";
-$UPDATES[] = "UPDATE ibf_faq SET title='Cookies and cookie usage', text='Using cookies is optional, but strongly recommended. Cookies are used to track topics, showing you which topics have new replies since your last visit and to automatically log you in when you return.\r \r If your computer is unable to use the cookie system to browse the board correctly, then the board will automatically add in a session ID to each link to track you around the board.\r \rClearing Cookies \r \r You can clear the cookies at any time by clicking on the link found at the bottom of the main board page (the first page you see when returning to the board). If this does not work for you, you may need to remove the cookies manually.\r \rRemoving Cookies in Internet Explorer for Windows \r \r\r Close all open Internet Explorer Windows\r Click on the \'start\' button\r Move up to \'Find\' and click on \'Files and Folders\'\r When the new window appears, type in the domain name of the board you are using into the \'containing text\' field. (If the boards address was \'\' you would enter \'\' without the quotes)\r In the \'look in\' box, type in C:WindowsCookies and press \'Find Now\'\r After it has finished searching, highlight all files (click on a file then press CTRL+A) and delete them.\r \r \rRemoving Cookies in Internet Explorer for Macintosh \r \r\r With Internet Explorer active, choose \'Edit\' and then \'Preferences\' from the Macintosh menu bar at the top of the screen\r When the preferences panel opens, choose \'Cookies\' found in the \'Receiving Files\' section.\r When the cookie pane loads, look for the domain name of the board (If the boards address was \'\' look for \'\' or \'\'\r For each cookie, click on the entry and press the delete button.\r \r \r Your cookies should now be removed. In some cases you may need to restart your computer for the changes to take effect.', description='The benefits of using cookies and how to remove cookies set by this board.' WHERE id=2";
-$UPDATES[] = "UPDATE ibf_faq SET title='Recovering lost or forgotten passwords', text='Security is a big feature on this board, and to that end, all passwords are encrypted when you register.\r This means that we cannot email your password to you as we hold no record of your \'uncrypted\' password. You can however, apply to have your password reset.\r \r To do this, click on the Lost Password link found on the log in page.\r \r Further instruction is available from there.', description='How to reset your password if you\'ve forgotten it.' WHERE id=3";
-$UPDATES[] = "UPDATE ibf_faq SET title='Your Control Panel (My Controls)', text='Your control panel is your own private board console. You can change how the board looks and feels as well as your own information from here.\r \rSubscriptions \r \r This is where you manage your topic and forums subscriptions. Please see the help file \'Email Notification of new messages\' for more information on how to subscribe to topics.\r \rEdit Profile Info \r \r This section allows you to add or edit your contact information and enter some personal information if you choose.\r \rEdit Signature \r \r A board \'signature\' is very similar to an email signature. This signature is attached to the foot of every message you post unless you choose to check the box that allows you to ommit the signature in the message you are posting. You may use BB Code if available and in some cases, pure HTML (if the board administrator allows it).\r \rEdit Avatar Settings \r \r An avatar is a little image that appears under your username when you view a topic or post you authored. If the administrator allows, you may either choose from the board gallery, enter a URL to an avatar stored on your server or upload an avatar to use. You may also set the width of the avatar to ensure that it\'s sized in proportion.\r \rChange Personal Photo \r \r This section will allow you to add a photograph to your profile. This will be displayed when a user clicks to view your profile, on the mini-profile screen and will also be linked to from the member list.\r \rEmail Settings \r \rHide my email address allows you to deny the ability for other users to send you an email from the board.\rSend me updates sent by the board administrator will allow the administrator to include your email address in any mailings they send out - this is used mostly for important updates and community information.\rInclude a copy of the post when emailing me from a subscribed topic , this allows you to have the new post included in any reply to topic notifications.\rSend a confirmation email when I receive a new private message , this will send you an e-mail notification to your registered e-mail address each time you receive a private message on the board.\rEnable \'Email Notification\' by default? , this will automatically subscribe you to any topic that you make a reply to. You may unsubscribe from the \'Subscriptions\' section of My Controls if you wish.\r \rBoard Settings \r \r From this section, you can set your time zone, choose to not see users signatures, avatars and posted images.\r You can choose to get a pop up window informing you when you have a new message and choose to show or hide the \'Fast Reply\' box where it is enabled.\r You are also able to choose display preferences for the number of topics/posts shown per page on the board.\r \rChange Email Address \r \r At any time, you can change the email address that is registered to your account. In some cases, you will need to revalidate your account after changing your email address. If this is the case, you will be notified before your email address change is processed.\r \rChange Password \r \r You may change your password from this section. Please note that you will need to know your current password before you can change your password.', description='Editing contact information, personal information, avatars, signatures, board settings, languages and style choices.' WHERE id=4";
-$UPDATES[] = "UPDATE ibf_faq SET title='Email Notification of new messages', text='This board can notify you when a new reply is added to a topic. Many users find this useful to keep up to date on topics without the need to view the board to check for new messages.\r \r There are three ways to subscribe to a topic:\r\rClick the \'Track This Topic\' link at the top of the topic that you wish to track \r On the posting screen when replying to or creating a topic, check the \'Enable email notification of replies?\' checkbox \r From the E-Mail settings section of your User CP (My Controls) check the \'Enable Email Notification by default?\' option, this will automatically subscribe you to any topic that you make a reply to \r Please note that to avoid multiple emails being sent to your email address, you will only get one e-mail for each topic you are subscribed to until the next time you visit the board.\r \r You are also able to subscribe to each individual forum on the board, to be notified when a new topic is created in that particular forum. To enable this, click the \'Subscribe to this forum\' link at the bottom of the forum that you wish to subscribe to.\r \r To unsubscribe from any forums or topics that you are subscribed to - just go to the \'Subscriptions\' section of \'My Controls\' and you can do thi from there.', description='How to get emailed when a new reply is added to a topic.' WHERE id=5";
-$UPDATES[] = "UPDATE ibf_faq SET title='Your Personal Messenger', text='Your personal messenger acts much like an email account in that you can send and receive messages and store messages in folders.\r \rCompose a New PM \r \r This will allow you to send a message to another member. If you have names in your contact list, you can choose a name from it - or you may choose to enter a name in the relevant form field. This will be automatically filled in if you clicked a \'PM\' button on the board (from the member list or a post). If allowed, you may also be able to enter in multiple names in the box provided, will need to add one username per line.\r If the administrator allows, you may use BB Code and HTML in your private message. If you choose to check the \'Add a copy of this message to you sent items folder\' box, a copy of the message will be saved for you for later reference. If you tick the \'Track this message?\' box, then the details of the message will be available in your \'Message Tracker\' where you will be able to see if/when it has been read.\r \r\r \r Your inbox is where all new messages are sent to. Clicking on the message title will show you the message in a similar format to the board topic view. You can also delete or move messages from your inbox.\r \rEmpty PM Folders \r \r This option provides you with a quick and easy way to clear out all of your PM folders.\r \rEdit Storage Folders \r \r You may rename, add or remove folders to store messages is, allowing you to organise your messages to your preference. You cannot remove \'Sent Items\' or \'Inbox\'.\r \rPM Buddies/Block List \r \r You may add in users names in this section, or edit any saved entries. You can also use this as a ban list, denying the named member the ability to message you.\r Names entered in this section will appear in the drop down list when sending a new PM, allowing you to quickly choose the members name when sending a message.\r \rArchive Messages \r \r If your messenger folders are full and you are unable to receive new messages, you can archive them off. This compiles the messages into a single HTML page or Microsoft © Excel Format. This page is then emailed to your registered email address for your convenience.\r \rSaved (Unsent) PMs \r \r This area will allow you to go back to any PM\'s that you have chosen to save to be sent later.\r \rMessage Tracker \r \r This is the page that any messages that you have chosen to track will appear. Details of if and when they have been read by the recipient will appear here. This also gives you the chance to delete any messages that you have sent and not yet been read by the intended recipient.', description='How to send personal messages, track them, edit your messenger folders and archive stored messages.' WHERE id=6";
-$UPDATES[] = "UPDATE ibf_faq SET title='Contacting the moderating team & reporting posts', text='Contacting the moderating team \r \r If you need to contact a moderator or simply wish to view the complete administration team, you can click the link \'The moderating team\' found at the bottom of the main board page (the first page you see when visiting the board), or from \'My Assistant\'.\r \r This list will show you administrators (those who have administration control panel access), global moderators (those who can moderate in all forums) and the moderators of the individual forums.\r \r If you wish to contact someone about your member account, then contact an administrator - if you wish to contact someone about a post or topic, contact either a global moderator or the forum moderator.\r \rReporting a post \r \r If the administrator has enabled this function on the board, you\'ll see a \'Report\' button in a post, next to the \'Quote\' button. This function will let you report the post to the forum moderator (or the administrator(s), if there isn\'t a specific moderator available). You can use this function when you think the moderator(s) should be aware of the existance of that post. However, do not use this to chat with the moderator(s)! . You can use the email function or the Personal Messenger function for that.', description='Where to find a list of the board moderators and administrators.' WHERE id=7";
-$UPDATES[] = "UPDATE ibf_faq SET title='Viewing members profile information', text='You can view a members profile at any time by clicking on their name when it is underlined (as a link) or by clicking on their name in a post within a topic.\r \r This will show you their profile page which contains their contact information (if they have entered some) and their \'active stats\'.\r \r You can also click on the \'Mini Profile\' button underneath their posts, this will show up a mini \'e-card\' with their contact information and a photograph if they have chosen to have one.', description='How to view members contact information.' WHERE id=8";
-$UPDATES[] = "UPDATE ibf_faq SET title='Viewing active topics and new posts', text='You can view which new topics have new replies today by clicking on the \'Today\'s Active Topics\' link found at the bottom of the main board page (the first page you see when visiting the board). You can set your own date criteria, choosing to view all topics with new replies during several date choices.\r \r The \'View New Posts\' link in the member bar at the top of each page, will allow you to view all of the topics which have new replies in since your last visit to the board.', description='How to view all the topics which have a new reply today and the new posts made since your last visit.' WHERE id=9";
-$UPDATES[] = "UPDATE ibf_faq SET title='Searching Topics and Posts', text='The search feature is designed to allow you to quickly find topics and posts that contain the keywords you enter.\r \r There are two types of search form available, simple search and advanced search. You may switch between the two using the \'More Options\' and \'Simple Mode\' buttons.\r \rSimple Mode \r \r All you need to do here is enter in a keyword into the search box, and select a forum(s) to search in. (to select multiple forums, hold down the control key on a PC, or the Shift/Apple key on a Mac) choose a sorting order and search.\r \rAdvanced Mode \r \r The advanced search screen, will give you a much greater range of options to choose from to refine your search. In addition to searching by keyword, you are able to search by a members username or a combination of both. You can also choose to refine your search by selecting a date range, and there are a number of sorting options available. There are also two ways of displaying the search results, can either show the post text in full or just show a link to the topic, can choose this using the radio buttons available.\r \r If the administrator has enabled it, you may have a minimum amount of time to wait between searches, this is known as search flood control.\r \r There are also search boxes available at the bottom of each forum, to allow you to carry out a quick search of all of the topics within that particular forum.', description='How to use the search feature.' WHERE id=10";
-$UPDATES[] = "UPDATE ibf_faq SET title='Logging in and out', text='If you have chosen not to remember your log in details in cookies, or you are accessing the board on another computer, you will need to log into the board to access your member profile and post with your registered name.\r \r When you log in, you have the choice to save cookies that will log you in automatically when you return. Do not use this option on a shared computer for security.\r \r You can also choose to hide - this will keep your name from appearing in the active users list.\r \r Logging out is simply a matter of clicking on the \'Log Out\' link that is displayed when you are logged in. If you find that you are not logged out, you may need to manually remove your cookies. See the \'Cookies\' help file for more information.', description='How to log in and out from the board and how to remain anonymous and not be shown on the active users list.' WHERE id=11";
-$UPDATES[] = "UPDATE ibf_faq SET title='My Assistant', text='This feature is sometimes referred to as a \'Browser Buddy\'. \r \r At the top it tells you how many posts have been made since you last visited the board.. Also underneath this the number of posts with replies that have been made in topics that the individual has also posted in.\r Click on the \'View\' link on either of the two sentences to see the posts.\r \r The next section is five links to useful features:\r\rThe link to the moderating team is basically a quick link to see all those that either administrate or moderate certain forums on the message board. \r The link to \'Today\'s Active Topics\' shows you all the topics that have been created in the last 24 hours on the board. \rToday\'s Top 10 Posters link shows you exactly as the name suggests. It shows you the amount of posts by the members and also their total percentage of the total posts made that day. \rThe overall Top 10 Posters link shows you the top 10 posters for the whole time that the board has been installed. \rMy last 10 posts links to the latest topics that you have made on the board. These are shortened on the page, to save space, and are linked to if you require to read more of them. \r The two search features allow you to search the whole board for certain words in a whole topic. It isn\'t as featured as the normal search option so it is not as comprehensive.\r \r The Help Search is just as comprehensive as the normal help section\'s search function and allows for quick searching of all the help topics on the board.', description='A comprehensive guide to use this handy little feature.' WHERE id=12";
-$UPDATES[] = "UPDATE ibf_faq SET title='Posting', text='There are three different posting screens available. The new topic button, visible in forums and in topics allows you to add a new topic to that particular forum. The new poll button (if the admin has enabled it) will also be viewable in topics and forums allowing you to create a new poll in the forum. When viewing a topic, there will be an add reply button, allowing you to add a new reply onto that particular topic. \r\n \r\nPosting new topics and replying \r\n \r\n When making a post, you will most likely have the option to use IBF code when posting. This will allow you to add various types of formatting to your messages. For more information on this, click the \'BB Code Help\' link under the emoticon box to launch the help window.\r\n \r\n On the left of the text entry box, there is the clickable emoticons box - you can click on these to add them to the content of your message (these are sometimes known as \'smilies\').\r\n \r\n There are three options available when making a post or a reply. \'Enable emoticons?\' if this is unchecked, then any text that would normally be converted into an emoticon will not be. \'Enable signature?\' allows you to choose whether or not you would like your signature to appear on that individual post. \'Enable email notification of replies?\' ticking this box will mean that you will receive e-mail updates to the topic, see the \'Email Notification of new messages\' help topic for more information on this.\r\n \r\n You also have the option to choose a post icon for the topic/post when creating one. This icon will appear next to the topic name on the topic listing in that forum, or will appear next to the date/time of the message if making a reply to a topic.\r\n \r\n If the admin has enabled it, you will also see a file attachments option, this will allow you to attach a file to be uploaded when making a post. Click the browse button to select a file from your computer to be uploaded. If you upload an image file, it may be shown in the content of the post, all other file types will be linked to.\r\n \r\nPoll Options \r\n \r\n If you have chosen to post a new poll, there will be an extra two option boxes at the top of the help screen. The first input box will allow you to enter the question that you are asking in the poll. The text field underneath is where you will input the choices for the poll. Simply enter a different option on each line. The maximum number of choices is set by the board admin, and this figure is displayed on the left.\r\n \r\nQuoting Posts \r\n \r\n Displayed below each post in a topic, there is a \'Quote\' button. Pressing this button will allow you to reply to a topic, and have the text from a particular reply quoted in your own reply. When you choose to do this, an extra text field will appear below the main text input box to allow you to edit the content of the post being quoted.\r\n \r\nEditing Posts \r\n \r\n Above any posts that you have made, you may see an \'Edit\' button. Pressing this will allow you to edit the post that you had previously made. \r\n \r\n When editing you may see an option to \'Add the \'Edit by\' line in this post?\'. If you tick this then it will show up in the posts that it has been edited and the time at which it was edited. If this option does not appear, then the edit by line will always be added to the post.\r\n \r\n If you are unable to see the edit button displayed on each post that you have made, then the administrator may have prevented you from editing posts, or the time limit for editing may have expired.\r\n \r\nFast Reply \r\n \r\n Where it has been enabled, there will be a fast reply button on each topic. Clicking this will open up a posting box on the topic view screen, cutting down on the time required to load the main posting screen. Click the fast reply button to expand the reply box and type the post inside of there. Although the fast reply box is not expanded by default, you can choose the option to have it expanded by default, from the board settings section of your control panel. Pressing the \'More Options\' button will take you to the normal posting screen.', description='A guide to the features avaliable when posting on the boards.' WHERE id=13";
-$UPDATES[] = "UPDATE ibf_faq SET title='Member List', text='The member list, accessed via the \'Members\' link at the top of each page, is basically a listing of all of the members that have registered on the board. \r\n \r\n If you are looking to search for a particular member by all/part of their username, then in the drop down box at the bottom of the page, change the selection from \'Search All Available\' to \'Name Begins With\' or \'Name Contains\' and input all/part of their name in the text input field and press the \'Go!\' button. \r\n \r\n Also, at the bottom of the member list page, there are a number of sorting options available to alter the way in which the list is displayed. \r\n \r\n If a member has chosen to add a photo to their profile information, then a camera icon will appear next to their name, and you may click this to view the photo.', description='Explaining the different ways to sort and search through the list of members.' WHERE id=14";
-$UPDATES[] = "UPDATE ibf_faq SET title='Topic Options', text='At the bottom of each topic, there is a \'Topic Options\' button. Pressing this button will expand the topic options box. \r \r From this box, you can select from the following options: \r\rTrack this topic - this option will allow you to receive e-mail updates for the topic, see the \'Email Notification of new messages\' help file for more information on this \rSubscribe to this forum - will allow you to receive e-mail updates for any new topics posted in the forum, see the Notification of new messages\' help file for more information on this \rDownload / Print this Topic - will show the topic in a number of different formats. \'Printer Friendly Version\' will display a version of the topic that is suitable for printing out. \'Download HTML Version\' will download a copy of the topic to your hard drive, and this can then be viewed in a web browser, without having to visit the board. \'Download Microsoft Word Version\' will allow you to download the file to your hard drive and open it up in the popular word processing application, Microsoft Word, for viewing offline. \r ', description='A guide to the options avaliable when viewing a topic.' WHERE id=15";
-$UPDATES[] = "UPDATE ibf_faq SET title='Calendar', text='This board features it\'s very own calendar feature, which can be accessed via the calendar link at the top of the board.\r \r You are able to add your own personal events to the calendar - and these are only viewable by yourself. To add a new event, use the \'Add New Event\' button to be taken to the event posting screen. There are three types of events that you can now add:\r\rA single day/one off event can be added using the first option, by just selecting the date for it to appear on. \rRanged Event - is an event that spans across multiple days, to do this in addition to selecting the start date as above, will need to add the end date for the event. There are also options available to highlight the message on the calendar, useful if there is more than one ranged event being displayed at any one time. \rRecurring Event - is a one day event, that you can set to appear at set intervals on the calendar, either weekly, monthly or yearly. \r If the admistrator allows you, you may also be able to add a public event, that will not just be shown to yourself, but will be viewable by everyone.\r \r Also, if the admistrator has chosen, there will be a link to all the birthdays happening on a particular day displayed on the calendar, and your birthday will appear if you have chosen to enter a date of birth in the Profile Info section of your control panel.', description='More information on the boards calendar feature.' WHERE id=16";
+$UPDATES[] = "UPDATE faq SET title='Registration benefits', text='To be able to use all the features on this board, the administrator will probably require that you register for a member account. Registration is free and only takes a moment to complete.\r \r During registration, the administrator requires that you supply a valid email address. This is important as the administrator may require that you validate your registration via an email. If this is the case, you will be notified when registering. If your e-mail does not arrive, then on the member bar at the top of the page, there will be a link that will allow you to re-send the validation e-mail. \r \r In some cases, the administrator will need to approve your registration before you can use your member account fully. If this is the case you will be notified during registration.\r \r Once you have registered and logged in, you will have access to your personal messenger and your control panel.\r \r For more information on these items, please see the relevant sections in this documentation.', description='How to register and the added benefits of being a registered member.' WHERE id=1";
+$UPDATES[] = "UPDATE faq SET title='Cookies and cookie usage', text='Using cookies is optional, but strongly recommended. Cookies are used to track topics, showing you which topics have new replies since your last visit and to automatically log you in when you return.\r \r If your computer is unable to use the cookie system to browse the board correctly, then the board will automatically add in a session ID to each link to track you around the board.\r \rClearing Cookies \r \r You can clear the cookies at any time by clicking on the link found at the bottom of the main board page (the first page you see when returning to the board). If this does not work for you, you may need to remove the cookies manually.\r \rRemoving Cookies in Internet Explorer for Windows \r \r\r Close all open Internet Explorer Windows\r Click on the \'start\' button\r Move up to \'Find\' and click on \'Files and Folders\'\r When the new window appears, type in the domain name of the board you are using into the \'containing text\' field. (If the boards address was \'http://www.test.ru/forums/index.php\' you would enter \'test.ru\' without the quotes)\r In the \'look in\' box, type in C:WindowsCookies and press \'Find Now\'\r After it has finished searching, highlight all files (click on a file then press CTRL+A) and delete them.\r \r \rRemoving Cookies in Internet Explorer for Macintosh \r \r\r With Internet Explorer active, choose \'Edit\' and then \'Preferences\' from the Macintosh menu bar at the top of the screen\r When the preferences panel opens, choose \'Cookies\' found in the \'Receiving Files\' section.\r When the cookie pane loads, look for the domain name of the board (If the boards address was \'http://www.test.ru/forums/index.php\' look for \'test.ru\' or \'www.test.ru\'\r For each cookie, click on the entry and press the delete button.\r \r \r Your cookies should now be removed. In some cases you may need to restart your computer for the changes to take effect.', description='The benefits of using cookies and how to remove cookies set by this board.' WHERE id=2";
+$UPDATES[] = "UPDATE faq SET title='Recovering lost or forgotten passwords', text='Security is a big feature on this board, and to that end, all passwords are encrypted when you register.\r This means that we cannot email your password to you as we hold no record of your \'uncrypted\' password. You can however, apply to have your password reset.\r \r To do this, click on the Lost Password link found on the log in page.\r \r Further instruction is available from there.', description='How to reset your password if you\'ve forgotten it.' WHERE id=3";
+$UPDATES[] = "UPDATE faq SET title='Your Control Panel (My Controls)', text='Your control panel is your own private board console. You can change how the board looks and feels as well as your own information from here.\r \rSubscriptions \r \r This is where you manage your topic and forums subscriptions. Please see the help file \'Email Notification of new messages\' for more information on how to subscribe to topics.\r \rEdit Profile Info \r \r This section allows you to add or edit your contact information and enter some personal information if you choose.\r \rEdit Signature \r \r A board \'signature\' is very similar to an email signature. This signature is attached to the foot of every message you post unless you choose to check the box that allows you to ommit the signature in the message you are posting. You may use BB Code if available and in some cases, pure HTML (if the board administrator allows it).\r \rEdit Avatar Settings \r \r An avatar is a little image that appears under your username when you view a topic or post you authored. If the administrator allows, you may either choose from the board gallery, enter a URL to an avatar stored on your server or upload an avatar to use. You may also set the width of the avatar to ensure that it\'s sized in proportion.\r \rChange Personal Photo \r \r This section will allow you to add a photograph to your profile. This will be displayed when a user clicks to view your profile, on the mini-profile screen and will also be linked to from the member list.\r \rEmail Settings \r \rHide my email address allows you to deny the ability for other users to send you an email from the board.\rSend me updates sent by the board administrator will allow the administrator to include your email address in any mailings they send out - this is used mostly for important updates and community information.\rInclude a copy of the post when emailing me from a subscribed topic , this allows you to have the new post included in any reply to topic notifications.\rSend a confirmation email when I receive a new private message , this will send you an e-mail notification to your registered e-mail address each time you receive a private message on the board.\rEnable \'Email Notification\' by default? , this will automatically subscribe you to any topic that you make a reply to. You may unsubscribe from the \'Subscriptions\' section of My Controls if you wish.\r \rBoard Settings \r \r From this section, you can set your time zone, choose to not see users signatures, avatars and posted images.\r You can choose to get a pop up window informing you when you have a new message and choose to show or hide the \'Fast Reply\' box where it is enabled.\r You are also able to choose display preferences for the number of topics/posts shown per page on the board.\r \rChange Email Address \r \r At any time, you can change the email address that is registered to your account. In some cases, you will need to revalidate your account after changing your email address. If this is the case, you will be notified before your email address change is processed.\r \rChange Password \r \r You may change your password from this section. Please note that you will need to know your current password before you can change your password.', description='Editing contact information, personal information, avatars, signatures, board settings, languages and style choices.' WHERE id=4";
+$UPDATES[] = "UPDATE faq SET title='Email Notification of new messages', text='This board can notify you when a new reply is added to a topic. Many users find this useful to keep up to date on topics without the need to view the board to check for new messages.\r \r There are three ways to subscribe to a topic:\r\rClick the \'Track This Topic\' link at the top of the topic that you wish to track \r On the posting screen when replying to or creating a topic, check the \'Enable email notification of replies?\' checkbox \r From the E-Mail settings section of your User CP (My Controls) check the \'Enable Email Notification by default?\' option, this will automatically subscribe you to any topic that you make a reply to \r Please note that to avoid multiple emails being sent to your email address, you will only get one e-mail for each topic you are subscribed to until the next time you visit the board.\r \r You are also able to subscribe to each individual forum on the board, to be notified when a new topic is created in that particular forum. To enable this, click the \'Subscribe to this forum\' link at the bottom of the forum that you wish to subscribe to.\r \r To unsubscribe from any forums or topics that you are subscribed to - just go to the \'Subscriptions\' section of \'My Controls\' and you can do thi from there.', description='How to get emailed when a new reply is added to a topic.' WHERE id=5";
+$UPDATES[] = "UPDATE faq SET title='Your Personal Messenger', text='Your personal messenger acts much like an email account in that you can send and receive messages and store messages in folders.\r \rCompose a New PM \r \r This will allow you to send a message to another member. If you have names in your contact list, you can choose a name from it - or you may choose to enter a name in the relevant form field. This will be automatically filled in if you clicked a \'PM\' button on the board (from the member list or a post). If allowed, you may also be able to enter in multiple names in the box provided, will need to add one username per line.\r If the administrator allows, you may use BB Code and HTML in your private message. If you choose to check the \'Add a copy of this message to you sent items folder\' box, a copy of the message will be saved for you for later reference. If you tick the \'Track this message?\' box, then the details of the message will be available in your \'Message Tracker\' where you will be able to see if/when it has been read.\r \r\r \r Your inbox is where all new messages are sent to. Clicking on the message title will show you the message in a similar format to the board topic view. You can also delete or move messages from your inbox.\r \rEmpty PM Folders \r \r This option provides you with a quick and easy way to clear out all of your PM folders.\r \rEdit Storage Folders \r \r You may rename, add or remove folders to store messages is, allowing you to organise your messages to your preference. You cannot remove \'Sent Items\' or \'Inbox\'.\r \rPM Buddies/Block List \r \r You may add in users names in this section, or edit any saved entries. You can also use this as a ban list, denying the named member the ability to message you.\r Names entered in this section will appear in the drop down list when sending a new PM, allowing you to quickly choose the members name when sending a message.\r \rArchive Messages \r \r If your messenger folders are full and you are unable to receive new messages, you can archive them off. This compiles the messages into a single HTML page or Microsoft © Excel Format. This page is then emailed to your registered email address for your convenience.\r \rSaved (Unsent) PMs \r \r This area will allow you to go back to any PM\'s that you have chosen to save to be sent later.\r \rMessage Tracker \r \r This is the page that any messages that you have chosen to track will appear. Details of if and when they have been read by the recipient will appear here. This also gives you the chance to delete any messages that you have sent and not yet been read by the intended recipient.', description='How to send personal messages, track them, edit your messenger folders and archive stored messages.' WHERE id=6";
+$UPDATES[] = "UPDATE faq SET title='Contacting the moderating team & reporting posts', text='Contacting the moderating team \r \r If you need to contact a moderator or simply wish to view the complete administration team, you can click the link \'The moderating team\' found at the bottom of the main board page (the first page you see when visiting the board), or from \'My Assistant\'.\r \r This list will show you administrators (those who have administration control panel access), global moderators (those who can moderate in all forums) and the moderators of the individual forums.\r \r If you wish to contact someone about your member account, then contact an administrator - if you wish to contact someone about a post or topic, contact either a global moderator or the forum moderator.\r \rReporting a post \r \r If the administrator has enabled this function on the board, you\'ll see a \'Report\' button in a post, next to the \'Quote\' button. This function will let you report the post to the forum moderator (or the administrator(s), if there isn\'t a specific moderator available). You can use this function when you think the moderator(s) should be aware of the existance of that post. However, do not use this to chat with the moderator(s)! . You can use the email function or the Personal Messenger function for that.', description='Where to find a list of the board moderators and administrators.' WHERE id=7";
+$UPDATES[] = "UPDATE faq SET title='Viewing members profile information', text='You can view a members profile at any time by clicking on their name when it is underlined (as a link) or by clicking on their name in a post within a topic.\r \r This will show you their profile page which contains their contact information (if they have entered some) and their \'active stats\'.\r \r You can also click on the \'Mini Profile\' button underneath their posts, this will show up a mini \'e-card\' with their contact information and a photograph if they have chosen to have one.', description='How to view members contact information.' WHERE id=8";
+$UPDATES[] = "UPDATE faq SET title='Viewing active topics and new posts', text='You can view which new topics have new replies today by clicking on the \'Today\'s Active Topics\' link found at the bottom of the main board page (the first page you see when visiting the board). You can set your own date criteria, choosing to view all topics with new replies during several date choices.\r \r The \'View New Posts\' link in the member bar at the top of each page, will allow you to view all of the topics which have new replies in since your last visit to the board.', description='How to view all the topics which have a new reply today and the new posts made since your last visit.' WHERE id=9";
+$UPDATES[] = "UPDATE faq SET title='Searching Topics and Posts', text='The search feature is designed to allow you to quickly find topics and posts that contain the keywords you enter.\r \r There are two types of search form available, simple search and advanced search. You may switch between the two using the \'More Options\' and \'Simple Mode\' buttons.\r \rSimple Mode \r \r All you need to do here is enter in a keyword into the search box, and select a forum(s) to search in. (to select multiple forums, hold down the control key on a PC, or the Shift/Apple key on a Mac) choose a sorting order and search.\r \rAdvanced Mode \r \r The advanced search screen, will give you a much greater range of options to choose from to refine your search. In addition to searching by keyword, you are able to search by a members username or a combination of both. You can also choose to refine your search by selecting a date range, and there are a number of sorting options available. There are also two ways of displaying the search results, can either show the post text in full or just show a link to the topic, can choose this using the radio buttons available.\r \r If the administrator has enabled it, you may have a minimum amount of time to wait between searches, this is known as search flood control.\r \r There are also search boxes available at the bottom of each forum, to allow you to carry out a quick search of all of the topics within that particular forum.', description='How to use the search feature.' WHERE id=10";
+$UPDATES[] = "UPDATE faq SET title='Logging in and out', text='If you have chosen not to remember your log in details in cookies, or you are accessing the board on another computer, you will need to log into the board to access your member profile and post with your registered name.\r \r When you log in, you have the choice to save cookies that will log you in automatically when you return. Do not use this option on a shared computer for security.\r \r You can also choose to hide - this will keep your name from appearing in the active users list.\r \r Logging out is simply a matter of clicking on the \'Log Out\' link that is displayed when you are logged in. If you find that you are not logged out, you may need to manually remove your cookies. See the \'Cookies\' help file for more information.', description='How to log in and out from the board and how to remain anonymous and not be shown on the active users list.' WHERE id=11";
+$UPDATES[] = "UPDATE faq SET title='My Assistant', text='This feature is sometimes referred to as a \'Browser Buddy\'. \r \r At the top it tells you how many posts have been made since you last visited the board.. Also underneath this the number of posts with replies that have been made in topics that the individual has also posted in.\r Click on the \'View\' link on either of the two sentences to see the posts.\r \r The next section is five links to useful features:\r\rThe link to the moderating team is basically a quick link to see all those that either administrate or moderate certain forums on the message board. \r The link to \'Today\'s Active Topics\' shows you all the topics that have been created in the last 24 hours on the board. \rToday\'s Top 10 Posters link shows you exactly as the name suggests. It shows you the amount of posts by the members and also their total percentage of the total posts made that day. \rThe overall Top 10 Posters link shows you the top 10 posters for the whole time that the board has been installed. \rMy last 10 posts links to the latest topics that you have made on the board. These are shortened on the page, to save space, and are linked to if you require to read more of them. \r The two search features allow you to search the whole board for certain words in a whole topic. It isn\'t as featured as the normal search option so it is not as comprehensive.\r \r The Help Search is just as comprehensive as the normal help section\'s search function and allows for quick searching of all the help topics on the board.', description='A comprehensive guide to use this handy little feature.' WHERE id=12";
+$UPDATES[] = "UPDATE faq SET title='Posting', text='There are three different posting screens available. The new topic button, visible in forums and in topics allows you to add a new topic to that particular forum. The new poll button (if the admin has enabled it) will also be viewable in topics and forums allowing you to create a new poll in the forum. When viewing a topic, there will be an add reply button, allowing you to add a new reply onto that particular topic. \r\n \r\nPosting new topics and replying \r\n \r\n When making a post, you will most likely have the option to use IBF code when posting. This will allow you to add various types of formatting to your messages. For more information on this, click the \'BB Code Help\' link under the emoticon box to launch the help window.\r\n \r\n On the left of the text entry box, there is the clickable emoticons box - you can click on these to add them to the content of your message (these are sometimes known as \'smilies\').\r\n \r\n There are three options available when making a post or a reply. \'Enable emoticons?\' if this is unchecked, then any text that would normally be converted into an emoticon will not be. \'Enable signature?\' allows you to choose whether or not you would like your signature to appear on that individual post. \'Enable email notification of replies?\' ticking this box will mean that you will receive e-mail updates to the topic, see the \'Email Notification of new messages\' help topic for more information on this.\r\n \r\n You also have the option to choose a post icon for the topic/post when creating one. This icon will appear next to the topic name on the topic listing in that forum, or will appear next to the date/time of the message if making a reply to a topic.\r\n \r\n If the admin has enabled it, you will also see a file attachments option, this will allow you to attach a file to be uploaded when making a post. Click the browse button to select a file from your computer to be uploaded. If you upload an image file, it may be shown in the content of the post, all other file types will be linked to.\r\n \r\nPoll Options \r\n \r\n If you have chosen to post a new poll, there will be an extra two option boxes at the top of the help screen. The first input box will allow you to enter the question that you are asking in the poll. The text field underneath is where you will input the choices for the poll. Simply enter a different option on each line. The maximum number of choices is set by the board admin, and this figure is displayed on the left.\r\n \r\nQuoting Posts \r\n \r\n Displayed below each post in a topic, there is a \'Quote\' button. Pressing this button will allow you to reply to a topic, and have the text from a particular reply quoted in your own reply. When you choose to do this, an extra text field will appear below the main text input box to allow you to edit the content of the post being quoted.\r\n \r\nEditing Posts \r\n \r\n Above any posts that you have made, you may see an \'Edit\' button. Pressing this will allow you to edit the post that you had previously made. \r\n \r\n When editing you may see an option to \'Add the \'Edit by\' line in this post?\'. If you tick this then it will show up in the posts that it has been edited and the time at which it was edited. If this option does not appear, then the edit by line will always be added to the post.\r\n \r\n If you are unable to see the edit button displayed on each post that you have made, then the administrator may have prevented you from editing posts, or the time limit for editing may have expired.\r\n \r\nFast Reply \r\n \r\n Where it has been enabled, there will be a fast reply button on each topic. Clicking this will open up a posting box on the topic view screen, cutting down on the time required to load the main posting screen. Click the fast reply button to expand the reply box and type the post inside of there. Although the fast reply box is not expanded by default, you can choose the option to have it expanded by default, from the board settings section of your control panel. Pressing the \'More Options\' button will take you to the normal posting screen.', description='A guide to the features avaliable when posting on the boards.' WHERE id=13";
+$UPDATES[] = "UPDATE faq SET title='Member List', text='The member list, accessed via the \'Members\' link at the top of each page, is basically a listing of all of the members that have registered on the board. \r\n \r\n If you are looking to search for a particular member by all/part of their username, then in the drop down box at the bottom of the page, change the selection from \'Search All Available\' to \'Name Begins With\' or \'Name Contains\' and input all/part of their name in the text input field and press the \'Go!\' button. \r\n \r\n Also, at the bottom of the member list page, there are a number of sorting options available to alter the way in which the list is displayed. \r\n \r\n If a member has chosen to add a photo to their profile information, then a camera icon will appear next to their name, and you may click this to view the photo.', description='Explaining the different ways to sort and search through the list of members.' WHERE id=14";
+$UPDATES[] = "UPDATE faq SET title='Topic Options', text='At the bottom of each topic, there is a \'Topic Options\' button. Pressing this button will expand the topic options box. \r \r From this box, you can select from the following options: \r\rTrack this topic - this option will allow you to receive e-mail updates for the topic, see the \'Email Notification of new messages\' help file for more information on this \rSubscribe to this forum - will allow you to receive e-mail updates for any new topics posted in the forum, see the Notification of new messages\' help file for more information on this \rDownload / Print this Topic - will show the topic in a number of different formats. \'Printer Friendly Version\' will display a version of the topic that is suitable for printing out. \'Download HTML Version\' will download a copy of the topic to your hard drive, and this can then be viewed in a web browser, without having to visit the board. \'Download Microsoft Word Version\' will allow you to download the file to your hard drive and open it up in the popular word processing application, Microsoft Word, for viewing offline. \r ', description='A guide to the options avaliable when viewing a topic.' WHERE id=15";
+$UPDATES[] = "UPDATE faq SET title='Calendar', text='This board features it\'s very own calendar feature, which can be accessed via the calendar link at the top of the board.\r \r You are able to add your own personal events to the calendar - and these are only viewable by yourself. To add a new event, use the \'Add New Event\' button to be taken to the event posting screen. There are three types of events that you can now add:\r\rA single day/one off event can be added using the first option, by just selecting the date for it to appear on. \rRanged Event - is an event that spans across multiple days, to do this in addition to selecting the start date as above, will need to add the end date for the event. There are also options available to highlight the message on the calendar, useful if there is more than one ranged event being displayed at any one time. \rRecurring Event - is a one day event, that you can set to appear at set intervals on the calendar, either weekly, monthly or yearly. \r If the admistrator allows you, you may also be able to add a public event, that will not just be shown to yourself, but will be viewable by everyone.\r \r Also, if the admistrator has chosen, there will be a link to all the birthdays happening on a particular day displayed on the calendar, and your birthday will appear if you have chosen to enter a date of birth in the Profile Info section of your control panel.', description='More information on the boards calendar feature.' WHERE id=16";
-
-?>
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_21010/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_21010/mysql_updates.php
index c887b4af..afd0ed20 100644
--- a/upload/admin/applications/core/setup/versions/upg_21010/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_21010/mysql_updates.php
@@ -1,22 +1,21 @@
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_21011/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_21011/mysql_updates.php
index 0940cc5c..754cd8f4 100644
--- a/upload/admin/applications/core/setup/versions/upg_21011/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_21011/mysql_updates.php
@@ -1,21 +1,20 @@
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_22005/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_22005/mysql_updates.php
index 815ff263..d9e5ea27 100644
--- a/upload/admin/applications/core/setup/versions/upg_22005/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_22005/mysql_updates.php
@@ -1,15 +1,15 @@
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_22005/mysql_updates_1.php b/upload/admin/applications/core/setup/versions/upg_22005/mysql_updates_1.php
index f9041349..683d9be5 100644
--- a/upload/admin/applications/core/setup/versions/upg_22005/mysql_updates_1.php
+++ b/upload/admin/applications/core/setup/versions/upg_22005/mysql_updates_1.php
@@ -1,49 +1,48 @@
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_22005/mysql_updates_2.php b/upload/admin/applications/core/setup/versions/upg_22005/mysql_updates_2.php
index b24960c5..2d75427d 100644
--- a/upload/admin/applications/core/setup/versions/upg_22005/mysql_updates_2.php
+++ b/upload/admin/applications/core/setup/versions/upg_22005/mysql_updates_2.php
@@ -1,25 +1,24 @@
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_22005/mysql_updates_3.php b/upload/admin/applications/core/setup/versions/upg_22005/mysql_updates_3.php
index a9390196..fa1709c9 100644
--- a/upload/admin/applications/core/setup/versions/upg_22005/mysql_updates_3.php
+++ b/upload/admin/applications/core/setup/versions/upg_22005/mysql_updates_3.php
@@ -1,64 +1,63 @@
PayPal for more information.' WHERE LOWER(submethod_name)='paypal';";
+$SQL[] ="UPDATE subscription_methods SET submethod_desc='All major credit cards accepted. See PayPal for more information.' WHERE LOWER(submethod_name)='paypal';";
-$SQL[] ="UPDATE ibf_groups SET g_photo_max_vars='100:150:150';";
+$SQL[] ="UPDATE groups SET g_photo_max_vars='100:150:150';";
-$SQL[] ="UPDATE ibf_attachments SET attach_rel_id=attach_pid, attach_rel_module='post' where attach_pid > 0;";
-$SQL[] ="UPDATE ibf_attachments SET attach_rel_id=attach_msg, attach_rel_module='msg' where attach_msg > 0;";
+$SQL[] ="UPDATE attachments SET attach_rel_id=attach_pid, attach_rel_module='post' where attach_pid > 0;";
+$SQL[] ="UPDATE attachments SET attach_rel_id=attach_msg, attach_rel_module='msg' where attach_msg > 0;";
-$SQL[] ="UPDATE ibf_login_methods SET login_settings = '1', login_installed = '1' WHERE login_folder_name='ldap';";
-$SQL[] ="UPDATE ibf_login_methods SET login_settings = '1', login_installed = '1' WHERE login_folder_name='external';";
+$SQL[] ="UPDATE login_methods SET login_settings = '1', login_installed = '1' WHERE login_folder_name='ldap';";
+$SQL[] ="UPDATE login_methods SET login_settings = '1', login_installed = '1' WHERE login_folder_name='external';";
-$SQL[] ="INSERT INTO ibf_login_methods (login_title, login_description, login_folder_name, login_maintain_url, login_register_url, login_type, login_alt_login_html, login_date, login_settings, login_enabled, login_safemode, login_installed, login_replace_form, login_allow_create) VALUES ('IP.Converge', 'Для внутреннего использования', 'ipconverge', '', '', 'passthrough', '', 0, 0, 0, 1, 1, 0, 1);";
-$SQL[] ="UPDATE ibf_forums SET permission_showtopic=1 WHERE parent_id='-1';";
+$SQL[] ="INSERT INTO login_methods (login_title, login_description, login_folder_name, login_maintain_url, login_register_url, login_type, login_alt_login_html, login_date, login_settings, login_enabled, login_safemode, login_installed, login_replace_form, login_allow_create) VALUES ('IP.Converge', 'Internal Use Only', 'ipconverge', '', '', 'passthrough', '', 0, 0, 0, 1, 1, 0, 1);";
+$SQL[] ="UPDATE forums SET permission_showtopic=1 WHERE parent_id='-1';";
# MEMBERS
-$SQL[] = "UPDATE ibf_members SET members_l_display_name=LOWER(members_display_name);";
-$SQL[] = "UPDATE ibf_members SET members_l_username=LOWER(name);";
+$SQL[] = "UPDATE members SET members_l_display_name=LOWER(members_display_name);";
+$SQL[] = "UPDATE members SET members_l_username=LOWER(name);";
-?>
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_22005/version_upgrade.php b/upload/admin/applications/core/setup/versions/upg_22005/version_upgrade.php
index feec5a86..e7394365 100644
--- a/upload/admin/applications/core/setup/versions/upg_22005/version_upgrade.php
+++ b/upload/admin/applications/core/setup/versions/upg_22005/version_upgrade.php
@@ -2,15 +2,15 @@
/*
+--------------------------------------------------------------------------
-| IP.Board v3.0.5
+| IP.Board v3.1.2
| ========================================
-| by Matthew Mecham
-| (c) 2001 - 2004 Invision Power Services
-| http://www.iinvisionpower.com
-| ========================================
-| Web: http://www.iinvisionboard.com
-| Email: matt@iinvisionpower.com
-| Licence Info: http://www.iinvisionboard.com/?license
+| by Matthew Mecham
+| (c) 2001 - 2004 Invision Power Services
+| http://www.invisionpower.com
+| ========================================
+| Web: http://www.invisionboard.com
+| Email: matt@invisionpower.com
+| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
*/
@@ -195,7 +195,13 @@ class version_upgrade
if ( IPSSetUp::getSavedData('man') AND $output )
{
- $this->_output = $this->registry->output->template()->upgrade_manual_queries( $output );
+ /* Create source file */
+ if ( $this->registry->dbFunctions()->getDriverType() == 'mysql' )
+ {
+ $sourceFile = IPSSetUp::createSqlSourceFile( $output, '22005', $id );
+ }
+
+ $this->_output = $this->registry->output->template()->upgrade_manual_queries( $output, $sourceFile );
}
}
diff --git a/upload/admin/applications/core/setup/versions/upg_22006/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_22006/mysql_updates.php
index 429432a4..aa7c07f2 100644
--- a/upload/admin/applications/core/setup/versions/upg_22006/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_22006/mysql_updates.php
@@ -1,15 +1,15 @@
\ No newline at end of file
+$SQL[] = "DELETE FROM conf_settings WHERE conf_key IN ('rte_width', 'rte_pm_width');";
diff --git a/upload/admin/applications/core/setup/versions/upg_22007/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_22007/mysql_updates.php
index 60ce3c88..030526ac 100644
--- a/upload/admin/applications/core/setup/versions/upg_22007/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_22007/mysql_updates.php
@@ -1,15 +1,15 @@
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_22009/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_22009/mysql_updates.php
index b513d04c..ad432b16 100644
--- a/upload/admin/applications/core/setup/versions/upg_22009/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_22009/mysql_updates.php
@@ -1,15 +1,15 @@
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_22010/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_22010/mysql_updates.php
index da5332ca..b9e21a96 100644
--- a/upload/admin/applications/core/setup/versions/upg_22010/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_22010/mysql_updates.php
@@ -1,15 +1,15 @@
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_22011/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_22011/mysql_updates.php
index 5f938ccd..45ee6acc 100644
--- a/upload/admin/applications/core/setup/versions/upg_22011/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_22011/mysql_updates.php
@@ -1,28 +1,27 @@
-
\ No newline at end of file
+
\ No newline at end of file
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_23005/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_23005/mysql_updates.php
index c403ebfe..cd7379f5 100644
--- a/upload/admin/applications/core/setup/versions/upg_23005/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_23005/mysql_updates.php
@@ -1,50 +1,44 @@
-
\ No newline at end of file
+
\ No newline at end of file
+$SQL[] = "UPDATE cal_events SET event_unix_from= (event_unix_from - (event_tz * 2)) WHERE event_timeset != 0;";
diff --git a/upload/admin/applications/core/setup/versions/upg_23010/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_23010/mysql_updates.php
index 2a8bbef6..86a90edb 100644
--- a/upload/admin/applications/core/setup/versions/upg_23010/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_23010/mysql_updates.php
@@ -1,20 +1,17 @@
\ No newline at end of file
+$SQL[] = "DELETE FROM conf_settings WHERE conf_key='bot_antispam' OR conf_key='guest_captcha';";
diff --git a/upload/admin/applications/core/setup/versions/upg_30001/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_30001/mysql_updates.php
index fa5e5e6f..1b9f81c4 100644
--- a/upload/admin/applications/core/setup/versions/upg_30001/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_30001/mysql_updates.php
@@ -1,15 +1,15 @@
/folder_team_icons/admin.gif','public/style_extra/team_icons/admin.png');";
$SQL[] = "UPDATE groups SET g_icon=REPLACE(g_icon,'style_images/<#IMG_DIR#>/folder_team_icons/','public/style_extra/team_icons/');";
+/* Adding this here so permsBbcode section doesn't throw error */
+$SQL[] = "ALTER TABLE bbcode_mediatag ADD mediatag_position SMALLINT NOT NULL DEFAULT '0';";
+
+
diff --git a/upload/admin/applications/core/setup/versions/upg_30001/mysql_updates_2.php b/upload/admin/applications/core/setup/versions/upg_30001/mysql_updates_2.php
index 51a493f0..3a6952a4 100644
--- a/upload/admin/applications/core/setup/versions/upg_30001/mysql_updates_2.php
+++ b/upload/admin/applications/core/setup/versions/upg_30001/mysql_updates_2.php
@@ -1,15 +1,15 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.2
* Upgrade Class
*
* Class to add options and notices for IP.Board upgrade
- * Last Updated: $Date: 2009-02-13 17:09:43 +0000 (Fri, 13 Feb 2009) $
+ * Last Updated: $Date: 2010-05-03 19:34:02 -0400 (Mon, 03 May 2010) $
+ *
*
* @author Matt Mecham
- * @version $Rev: 3957 $
+ * @version $Rev: 6205 $
* @since 3.0
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @link http://www.iinvisionpower.com
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @link http://www.invisionpower.com
+ * @package IP.Board
*/
class version_class_30001
@@ -142,6 +144,22 @@ EOF;
return $notices;
}
+
+
+ /**
+ * Return any pre-installation notices
+ *
+ * @access public
+ * @return array Array of notices
+ */
+ public function preInstallNotices()
+ {
+ $notices = array();
+
+ $notices[] = "Skins made for prior versions will not be compatible with this version. The default skin will be restored.";
+
+ return $notices;
+
+ }
}
-?>
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_30001/version_upgrade.php b/upload/admin/applications/core/setup/versions/upg_30001/version_upgrade.php
index fe21d5fd..8e48b39c 100644
--- a/upload/admin/applications/core/setup/versions/upg_30001/version_upgrade.php
+++ b/upload/admin/applications/core/setup/versions/upg_30001/version_upgrade.php
@@ -2,15 +2,15 @@
/*
+--------------------------------------------------------------------------
-| IP.Board v3.0.5
+| IP.Board v3.1.2
| ========================================
-| by Matthew Mecham
-| (c) 2001 - 2004 Invision Power Services
-| http://www.iinvisionpower.com
-| ========================================
-| Web: http://www.iinvisionboard.com
-| Email: matt@iinvisionpower.com
-| Licence Info: http://www.iinvisionboard.com/?license
+| by Matthew Mecham
+| (c) 2001 - 2004 Invision Power Services
+| http://www.invisionpower.com
+| ========================================
+| Web: http://www.invisionboard.com
+| Email: matt@invisionpower.com
+| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
*/
@@ -362,8 +362,8 @@ class version_upgrade
$apps['ips']['portal']['_currentLong'] = '30003';
$apps['ips']['portal']['_currentHuman'] = '3.0.0';
- $apps['ips']['chat']['_currentLong'] = '30003';
- $apps['ips']['chat']['_currentHuman'] = '3.0.0';
+ //$apps['ips']['chat']['_currentLong'] = '30003';
+ //$apps['ips']['chat']['_currentHuman'] = '3.0.0';
$apps['ips']['calendar']['_currentLong'] = '30003';
$apps['ips']['calendar']['_currentHuman'] = '3.0.0';
@@ -1278,6 +1278,9 @@ class version_upgrade
'msg_is_first_post' => 1 ) );
$postID = $this->DB->getInsertId();
+ /* Update attachments */
+ $this->DB->update( 'attachments', array( 'attach_rel_id' => $postID ), "attach_rel_module='msg' AND attach_rel_id=".$post['msg_id'] );
+
/* Define some stuff. "To" member is added last in IPB 2 */
$_tmp = $oldTopics;
ksort( $_tmp );
@@ -1408,7 +1411,7 @@ class version_upgrade
$this->DB->build( array( 'select' => '*',
'from' => 'members',
- 'where' => $this->DB->buildLength('ignored_users') . ' > 0',
+ 'where' => method_exists( $this->DB, 'setTableIdentityInsert' ) ? 'ignored_users NOT LIKE \'\'' : $this->DB->buildLength('ignored_users') . ' > 0',
'order' => 'member_id ASC',
'limit' => array( $start, $pergo ) ) );
@@ -1545,7 +1548,8 @@ class version_upgrade
}
$this->registry->output->addMessage( "Обновление опросов завершено." );
- $this->request['workact'] = 'finish';
+ $this->request['workact'] = 'finish';
+ $this->request['st'] = 0;
}
diff --git a/upload/admin/applications/core/setup/versions/upg_30003/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_30003/mysql_updates.php
index 4497a1d6..708f6954 100644
--- a/upload/admin/applications/core/setup/versions/upg_30003/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_30003/mysql_updates.php
@@ -1,15 +1,15 @@
getPrefix());
+$DB = ipsRegistry::DB();
+
+$SQL[] = "ALTER TABLE members CHANGE language language MEDIUMINT( 4 ) NULL DEFAULT NULL;";
+
+$has_right_index = false;
+$has_wrong_index = false;
+$DB->query( "SHOW INDEX FROM {$PRE}rss_import;" );
+while ( $row = $DB->fetch() )
+{
+ if ( $row['Key_name'] == 'rss_grab' )
+ {
+ $has_right_index = true;
+ }
+ if ( $row['Key_name'] == 'rss_import_enabled' )
+ {
+ $has_wrong_index = true;
+ }
+}
+
+if ( $has_wrong_index )
+{
+ $SQL[] = "ALTER TABLE rss_import DROP INDEX rss_import_enabled;";
+}
+if ( !$has_right_index )
+{
+ $SQL[] = "ALTER TABLE rss_import ADD INDEX rss_grab ( rss_import_enabled , rss_import_last_import );";
+}
+
+$SQL[] = "ALTER TABLE core_item_markers ADD item_is_deleted INT(1) NOT NULL DEFAULT '0';";
+$SQL[] = "ALTER TABLE core_item_markers DROP INDEX item_member_id;";
+$SQL[] = "ALTER TABLE core_item_markers ADD INDEX item_member_id (item_member_id, item_is_deleted);";
+
+$SQL[] = "ALTER TABLE pfields_data ADD pf_search_type varchar(5) NOT NULL default 'loose';";
+$SQL[] = "UPDATE pfields_data SET pf_search_type = 'loose';";
+
+$SQL[] = "DELETE FROM core_sys_conf_settings WHERE conf_key='photo_ext';";
+$SQL[] = "delete from core_sys_conf_settings where conf_key='seo_r301';";
+$SQL[] = "DELETE from core_sys_settings_titles WHERE conf_title_keyword='searchenginespiders';";
+
+$SQL[] = "ALTER TABLE sessions CHANGE login_type login_type tinyint(1) default '0';";
+$SQL[] = "ALTER TABLE sessions CHANGE location_1_type location_1_type VARCHAR( 255 ) NOT NULL;";
+$SQL[] = "ALTER TABLE sessions CHANGE location_2_type location_2_type VARCHAR( 255 ) NOT NULL;";
+$SQL[] = "ALTER TABLE sessions CHANGE location_3_type location_3_type VARCHAR( 255 ) NOT NULL;";
+
+$SQL[] = "ALTER TABLE core_sys_cp_sessions ADD INDEX ( session_running_time );";
+$SQL[] = "ALTER TABLE core_sys_cp_sessions ADD INDEX ( session_member_id );";
+$SQL[] = "ALTER TABLE upgrade_history ADD INDEX upgrades ( upgrade_app , upgrade_version_id );";
+$SQL[] = "ALTER TABLE validating ADD INDEX ( lost_pass );";
+$SQL[] = "ALTER TABLE members ADD INDEX ( failed_login_count );";
+$SQL[] = "ALTER TABLE validating ADD INDEX ( coppa_user );";
+$SQL[] = "ALTER TABLE api_log ADD INDEX ( api_log_date );";
+$SQL[] = "ALTER TABLE core_applications ADD INDEX ( app_directory );";
+$SQL[] = "ALTER TABLE bulk_mail ADD INDEX ( mail_start );";
+$SQL[] = "ALTER TABLE skin_collections ADD INDEX ( set_is_default );";
+$SQL[] = "ALTER TABLE members ADD INDEX ( joined );";
+$SQL[] = "ALTER TABLE rc_classes ADD INDEX ( onoff , mod_group_perm );";
+
+//-----------------------------------------
+// @link http://community.invisionpower.com/tracker/issue-22903-error-on-upgrade-305-to-310/
+//-----------------------------------------
+
+$_tasks = array();
+$DB->build( array( 'select' => 'task_id, task_key, task_application', 'from' => 'task_manager' ) );
+$DB->execute();
+
+while( $_r = $DB->fetch() )
+{
+ $_tasks[ $_r['task_key'] . $_r['task_application'] ] = $_r['task_id'];
+}
+
+$SQL[] = "DELETE FROM task_manager WHERE task_key='' OR task_key IS NULL;";
+$SQL[] = "DELETE FROM task_manager WHERE task_application='' OR task_application IS NULL;";
+
+if( is_array($_tasks) AND count($_tasks) )
+{
+ $SQL[] = "DELETE FROM task_manager WHERE task_id NOT IN(" . implode( ',', $_tasks ) . ");";
+}
+
+$SQL[] = "ALTER TABLE task_manager ADD UNIQUE task_key ( task_application , task_key );";
+$SQL[] = "ALTER TABLE reputation_index ADD INDEX member_rep ( member_id , rep_rating , rep_date );";
+$SQL[] = "ALTER TABLE announcements ADD INDEX ( announce_end );";
+
+if ( $DB->checkForTable( 'cal_events' ) )
+{
+ $SQL[] = "ALTER TABLE cal_events DROP INDEX daterange;";
+ $SQL[] = "ALTER TABLE cal_events ADD INDEX daterange ( event_approved , event_unix_from , event_unix_to );";
+ $SQL[] = "ALTER TABLE cal_calendars ADD INDEX ( cal_rss_export );";
+}
+
+$SQL[] = "ALTER TABLE core_sys_conf_settings ADD INDEX conf_group ( conf_group , conf_position , conf_title );";
+$SQL[] = "ALTER TABLE core_uagent_groups ADD INDEX ( ugroup_title );";
+$SQL[] = "ALTER TABLE core_uagents ADD INDEX ordering ( uagent_position , uagent_key );";
+
+$SQL[] = "ALTER TABLE core_sys_conf_settings ADD INDEX ( conf_add_cache );";
+$SQL[] = "ALTER TABLE emoticons ADD INDEX ( emo_set );";
+$SQL[] = "ALTER TABLE skin_templates ADD INDEX ( template_set_id );";
+$SQL[] = "ALTER TABLE skin_css ADD INDEX ( css_set_id );";
+
+$SQL[] = "ALTER TABLE message_topic_user_map DROP INDEX map_user;";
+$SQL[] = "ALTER TABLE message_topic_user_map ADD INDEX map_user ( map_user_id , map_folder_id , map_last_topic_reply );";
+
+$SQL[] = "ALTER TABLE validating ADD spam_flag TINYINT NOT NULL DEFAULT '0';";
+$SQL[] = "ALTER TABLE validating ADD INDEX ( spam_flag );";
+$SQL[] = "ALTER TABLE validating ADD INDEX ( member_id );";
+
+$SQL[] = "ALTER TABLE core_sys_lang ADD lang_protected tinyint(1) NOT NULL DEFAULT '0';";
+
+$SQL[] = "CREATE TABLE member_status_actions (
+ action_id int(10) NOT NULL AUTO_INCREMENT,
+ action_status_id int(10) unsigned NOT NULL DEFAULT '0',
+ action_reply_id int(10) unsigned NOT NULL DEFAULT '0',
+ action_member_id int(10) unsigned NOT NULL DEFAULT '0',
+ action_date int(10) unsigned NOT NULL DEFAULT '0',
+ action_key varchar(200) NOT NULL DEFAULT '',
+ action_status_owner int(10) unsigned NOT NULL DEFAULT '0',
+ action_app varchar(255) NOT NULL DEFAULT 'members',
+ action_custom_text text,
+ action_custom int(1) NOT NULL DEFAULT '0',
+ action_custom_url text,
+ PRIMARY KEY (action_id),
+ KEY action_status_id (action_status_id),
+ KEY action_member_id ( action_member_id , action_date ),
+ KEY action_date (action_date),
+ KEY action_custom ( action_custom , action_date )
+);";
+
+$SQL[] = "CREATE TABLE member_status_replies (
+ reply_id int(10) NOT NULL AUTO_INCREMENT,
+ reply_status_id int(10) unsigned NOT NULL DEFAULT '0',
+ reply_member_id int(10) unsigned NOT NULL DEFAULT '0',
+ reply_date int(10) unsigned NOT NULL DEFAULT '0',
+ reply_content text,
+ PRIMARY KEY (reply_id),
+ KEY reply_status_id (reply_status_id),
+ KEY reply_member_id (reply_member_id),
+ KEY reply_status_count (reply_status_id,reply_member_id),
+ KEY reply_date (reply_date)
+);";
+
+$SQL[] = "CREATE TABLE member_status_updates (
+ status_id int(10) NOT NULL AUTO_INCREMENT,
+ status_member_id int(10) unsigned NOT NULL DEFAULT '0',
+ status_date int(10) unsigned NOT NULL DEFAULT '0',
+ status_content text,
+ status_replies int(10) unsigned NOT NULL DEFAULT '0',
+ status_last_ids text,
+ status_is_latest int(1) NOT NULL DEFAULT '0',
+ status_is_locked int(1) NOT NULL DEFAULT '0',
+ status_hash varchar(32) NOT NULL DEFAULT '',
+ status_imported int(1) NOT NULL DEFAULT '0',
+ status_creator varchar(100) NOT NULL DEFAULT '',
+ PRIMARY KEY (status_id),
+ KEY status_member_id (status_member_id),
+ KEY status_date (status_date),
+ KEY status_is_latest ( status_is_latest , status_date ),
+ KEY s_hash (status_member_id,status_hash,status_imported)
+);";
+
+$SQL[] = "CREATE TABLE inline_notifications (
+notify_id INT NOT NULL AUTO_INCREMENT ,
+notify_to_id INT NOT NULL DEFAULT '0',
+notify_sent INT(10) NOT NULL DEFAULT '0',
+notify_read INT(10) NOT NULL DEFAULT '0',
+notify_title text NULL ,
+notify_text TEXT NULL DEFAULT NULL ,
+notify_from_id INT NOT NULL DEFAULT '0',
+notify_type_key VARCHAR( 255 ) NULL DEFAULT NULL ,
+notify_url text null,
+PRIMARY KEY (notify_id),
+KEY notify_to_id ( notify_to_id , notify_sent ),
+KEY grabber (notify_to_id, notify_read, notify_sent)
+);";
+
+$SQL[] = "CREATE TABLE core_soft_delete_log (
+ sdl_id int(10) NOT NULL AUTO_INCREMENT,
+ sdl_obj_id int(10) NOT NULL DEFAULT '0',
+ sdl_obj_key varchar(20) NOT NULL DEFAULT '',
+ sdl_obj_member_id int(10) NOT NULL DEFAULT '0',
+ sdl_obj_date int(10) NOT NULL DEFAULT '0',
+ sdl_obj_reason text,
+ sdl_locked int(1) NOT NULL DEFAULT '0',
+ PRIMARY KEY (sdl_id),
+ KEY look_up (sdl_obj_id,sdl_obj_key)
+);";
+
+$SQL[] = "CREATE TABLE twitter_connect (
+ t_key VARCHAR(32) NOT NULL default '',
+ t_token VARCHAR(255) NOT NULL default '',
+ t_secret VARCHAR(255) NOT NULL default '',
+ t_time INT(10) NOT NULL default '0'
+);";
+
+$SQL[] = "CREATE TABLE core_share_links (
+ share_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ share_title VARCHAR(255) NOT NULL DEFAULT '',
+ share_url TEXT,
+ share_key VARCHAR(50) NOT NULL DEFAULT '',
+ share_enabled INT(1) NOT NULL DEFAULT '0',
+ share_position INT(3) NOT NULL DEFAULT '0',
+ share_markup TEXT,
+ share_canonical INT(1) NOT NULL DEFAULT '1',
+ PRIMARY KEY share_id (share_id)
+);";
+
+$SQL[] = "CREATE TABLE core_share_links_log (
+ log_id INT(10) NOT NULL auto_increment,
+ log_date INT(10) NOT NULL default '0',
+ log_member_id INT(10) NOT NULL default '0',
+ log_url TEXT,
+ log_title TEXT,
+ log_share_key VARCHAR(50) NOT NULL default '',
+ log_data_app VARCHAR(50) NOT NULL default '',
+ log_data_type VARCHAR(50) NOT NULL default '',
+ log_data_primary_id INT(10) NOT NULL default '0',
+ log_data_secondary_id INT(10) NOT NULL default '0',
+ log_ip_address VARCHAR(16) NOT NULL DEFAULT '',
+ PRIMARY KEY log_id (log_id),
+ KEY findstuff (log_data_app, log_data_type, log_data_primary_id),
+ KEY log_date (log_date),
+ KEY log_member_id (log_member_id),
+ KEY log_share_key (log_share_key),
+ KEY log_ip_address (log_ip_address)
+);";
+
+$SQL[] = "CREATE TABLE core_share_links_caches (
+ cache_id INT(10) NOT NULL auto_increment,
+ cache_key VARCHAR(255) NOT NULL default '',
+ cache_data MEDIUMTEXT,
+ cache_date INT(10) NOT NULL default '0',
+ PRIMARY KEY cache_id( cache_id )
+);";
+
+$SQL[] = "CREATE TABLE core_incoming_emails (
+ rule_id INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+ rule_criteria_field VARCHAR( 4 ) NOT NULL ,
+ rule_criteria_type VARCHAR( 4 ) NOT NULL ,
+ rule_criteria_value TEXT NOT NULL ,
+ rule_app VARCHAR( 255 ) NOT NULL ,
+ rule_added_by MEDIUMINT( 8 ) NOT NULL ,
+ rule_added_date INT( 10 ) NOT NULL
+);";
+
+$SQL[] = "CREATE TABLE search_sessions (
+ session_id VARCHAR(32) NOT NULL DEFAULT '',
+ session_created INT(10) NOT NULL DEFAULT '0',
+ session_updated INT(10) NOT NULL DEFAULT '0',
+ session_member_id INT(10) NOT NULL DEFAULT '0',
+ session_data MEDIUMTEXT,
+ KEY session_updated (session_updated),
+ PRIMARY KEY (session_id)
+);";
+
+$SQL[] = "CREATE TABLE skin_merge_session (
+ merge_id INT(10) NOT NULL auto_increment,
+ merge_date INT(10) NOT NULL DEFAULT '0',
+ merge_set_id INT(10) NOT NULL DEFAULT '0',
+ merge_master_key VARCHAR(200) NOT NULL DEFAULT '',
+ merge_old_version VARCHAR(200) NOT NULL DEFAULT '',
+ merge_new_version VARCHAR(200) NOT NULL DEFAULT '',
+ merge_templates_togo INT(10) NOT NULL DEFAULT '0',
+ merge_css_togo INT(10) NOT NULL DEFAULT '0',
+ merge_templates_done INT(10) NOT NULL DEFAULT '0',
+ merge_css_done INT(10) NOT NULL DEFAULT '0',
+ merge_m_templates_togo INT(10) NOT NULL DEFAULT '0',
+ merge_m_css_togo INT(10) NOT NULL DEFAULT '0',
+ merge_m_templates_done INT(10) NOT NULL DEFAULT '0',
+ merge_m_css_done INT(10) NOT NULL DEFAULT '0',
+ merge_diff_done INT(1) NOT NULL DEFAULT '0',
+ PRIMARY KEY (merge_id)
+);";
+
+$SQL[] = "CREATE TABLE skin_merge_changes (
+ change_id INT(10) NOT NULL auto_increment,
+ change_key VARCHAR(255) NOT NULL DEFAULT '',
+ change_session_id INT(10) NOT NULL DEFAULT '0',
+ change_updated INT(10) NOT NULL DEFAULT '0',
+ change_data_group VARCHAR(255) NOT NULL DEFAULT '',
+ change_data_title VARCHAR(255) NOT NULL DEFAULT '',
+ change_data_content MEDIUMTEXT,
+ change_data_type VARCHAR(10) NOT NULL DEFAULT 'template',
+ change_is_new INT(1) NOT NULL DEFAULT '0',
+ change_is_diff INT(1) NOT NULL DEFAULT '0',
+ change_can_merge INT(1) NOT NULL DEFAULT '0',
+ change_merge_content MEDIUMTEXT,
+ change_is_conflict INT(1) NOT NULL DEFAULT '0',
+ change_final_content MEDIUMTEXT,
+ change_changes_applied INT(1) NOT NULL DEFAULT '0',
+ change_original_content MEDIUMTEXT,
+ PRIMARY KEY (change_id),
+ KEY (change_key, change_data_type)
+);";
+
+$SQL[] = "CREATE TABLE facebook_oauth_temp (
+ f_key VARCHAR(32) NOT NULL default '',
+ f_token VARCHAR(255) NOT NULL default '',
+ f_time INT(10) NOT NULL default '0'
+);";
+
+$SQL[] = "INSERT INTO member_status_updates (status_member_id, status_date, status_content, status_replies, status_is_latest ) SELECT pp_member_id, pp_status_update, pp_status, 0, 1 FROM `{$PRE}profile_portal` WHERE LENGTH(pp_status) > 0;";
+
+
+$SQL[] = "ALTER TABLE members ADD twitter_id VARCHAR(255) NOT NULL DEFAULT '';";
+$SQL[] = "ALTER TABLE members ADD twitter_token VARCHAR(255) NOT NULL DEFAULT '';";
+$SQL[] = "ALTER TABLE members ADD twitter_secret VARCHAR(255) NOT NULL DEFAULT '';";
+$SQL[] = "ALTER TABLE members ADD notification_cnt MEDIUMINT NOT NULL DEFAULT '0';";
+$SQL[] = "ALTER TABLE members ADD tc_lastsync INT(10) NOT NULL default '0';";
+$SQL[] = "ALTER TABLE members ADD fb_session VARCHAR(200) NOT NULL default '';";
+$SQL[] = "ALTER TABLE members DROP fb_emailallow;";
+$SQL[] = "ALTER TABLE members ADD fb_token TEXT NULL;";
+
+$SQL[] = "ALTER TABLE members ADD INDEX fb_uid (fb_uid);";
+$SQL[] = "ALTER TABLE members ADD INDEX twitter_id (twitter_id);";
+
+
+$SQL[] = "ALTER TABLE profile_portal ADD tc_last_sid_import BIGINT(20) UNSIGNED NOT NULL default '0';";
+$SQL[] = "ALTER TABLE profile_portal ADD tc_photo text;";
+$SQL[] = "ALTER TABLE profile_portal ADD tc_bwoptions int(10) unsigned NOT NULL default '0';";
+$SQL[] = "ALTER TABLE profile_portal ADD pp_customization mediumtext;";
+
+$SQL[] = "ALTER TABLE groups ADD g_max_notifications MEDIUMINT NOT NULL DEFAULT '0';";
+$SQL[] = "ALTER TABLE groups ADD g_max_bgimg_upload INT(10) NOT NULL default '0';";
+
+$SQL[] = "ALTER TABLE rc_classes ADD app VARCHAR( 32 ) NOT NULL;";
+$SQL[] = "ALTER TABLE forums ADD disable_sharelinks INT(1) NOT NULL default '0';";
+
+$SQL[] = "ALTER TABLE topics ADD topic_deleted_posts INT(10) NOT NULL default '0';";
+$SQL[] = "ALTER TABLE forums ADD deleted_posts INT(10) NOT NULL default '0';";
+$SQL[] = "ALTER TABLE forums ADD deleted_topics INT(10) NOT NULL default '0';";
+
+$SQL[] = "ALTER TABLE forums ADD rules_raw_html tinyint(1) NOT NULL default '0';";
+
+$SQL[] = "UPDATE rc_classes SET app='core' WHERE my_class='default';";
+$SQL[] = "UPDATE rc_classes SET app='forums' WHERE my_class='post';";
+$SQL[] = "UPDATE rc_classes SET app='blog' WHERE my_class='blog';";
+$SQL[] = "UPDATE rc_classes SET app='gallery' WHERE my_class='gallery';";
+$SQL[] = "UPDATE rc_classes SET app='downloads' WHERE my_class='downloads';";
+$SQL[] = "UPDATE rc_classes SET app='members' WHERE my_class='messages';";
+$SQL[] = "UPDATE rc_classes SET app='members' WHERE my_class='profiles';";
+$SQL[] = "UPDATE rc_classes SET app='calendar' WHERE my_class='calendar';";
+
+
+$SQL[] = "INSERT INTO core_share_links VALUES(1, 'Twitter', 'http://twitter.com/home?status={title}%20{url}', 'twitter', 1, 1, '',1);";
+$SQL[] = "INSERT INTO core_share_links VALUES(2, 'Facebook', 'http://www.facebook.com/share.php?u={url}', 'facebook', 1, 2, '',1);";
+$SQL[] = "INSERT INTO core_share_links VALUES(3, 'Digg', 'http://digg.com/submit?phase=2&url={url}&title={title}', 'digg', 1, 3, '',1);";
+$SQL[] = "INSERT INTO core_share_links VALUES(4, 'Del.icio.us', 'http://del.icio.us/post?v=2&url={url}&title={title}', 'delicious', 1, 4, '',1);";
+$SQL[] = "INSERT INTO core_share_links VALUES(5, 'Вконтакте', 'http://vkontakte.ru/share.php?url={url}&title={title}', 'vkontakte', 1, 5, '',1);";
+$SQL[] = "INSERT INTO core_share_links VALUES(6, 'Мемори', 'http://memori.ru/link/?sm=1&u_data[url]={url}&u_data[name]={title}', 'memori', 1, 6, '',1);";
+$SQL[] = "INSERT INTO core_share_links VALUES(7, 'БобрДобр', 'http://bobrdobr.ru/addext.html?url={url}&title={title}', 'bobrdobr', 1, 7, '',1);";
+$SQL[] = "INSERT INTO core_share_links VALUES(8, 'Email', '', 'email', 1, 8, '',1);";
+$SQL[] = "INSERT INTO core_share_links VALUES(9, 'Buzz', '', 'buzz', 1, 3, '', 1);";
+$SQL[] = "INSERT INTO core_share_links VALUES(10, 'Печать', '', 'print', 1, 10, '', 0);";
+$SQL[] = "INSERT INTO core_share_links VALUES(11, 'Скачать', '', 'download', 1, 11, '', 0);";
+
+/* Grab stuff */
+$DB->build( array( 'select' => '*',
+ 'from' => 'skin_collections' ) );
+$DB->execute();
+
+$skins = array();
+
+while( $row = $DB->fetch() )
+{
+ if ( in_array( $row['set_key'], array( 'default', 'lofi', 'xmlskin' ) ) )
+ {
+ $skins[ $row['set_key'] ] = $row['set_id'];
+ }
+}
+
+$ids = implode( ',', array_values( $skins ) );
+
+/* Do we have a master skin? */
+if ( ! $skins['default'] )
+{
+ /* Insert it */
+ $DB->insert( 'skin_collections', array( 'set_name' => 'IP.Board',
+ 'set_key' => 'default',
+ 'set_parent_id' => 0,
+ 'set_parent_array' => 'a:0:{}',
+ 'set_child_array' => 'a:0:{}',
+ 'set_permissions' => '*',
+ 'set_is_default' => 0,
+ 'set_author_name' => "Invision Power Services, Inc",
+ 'set_author_url' => 'http://bestcms.ws',
+ 'set_image_dir' => 'master',
+ 'set_emo_dir' => 'default',
+ 'set_hide_from_list' => 1,
+ 'set_css_groups' => '',
+ 'set_output_format' => 'html' ) );
+}
+
+/* Do we have a lofi skin? */
+if ( ! $skins['lofi'] )
+{
+ /* Insert it */
+ $DB->insert( 'skin_collections', array( 'set_name' => 'IP.Board Lofi',
+ 'set_key' => 'lofi',
+ 'set_parent_id' => 0,
+ 'set_parent_array' => 'a:0:{}',
+ 'set_child_array' => 'a:0:{}',
+ 'set_permissions' => '*',
+ 'set_is_default' => 0,
+ 'set_author_name' => "Invision Power Services, Inc",
+ 'set_author_url' => 'http://bestcms.ws',
+ 'set_image_dir' => 'master',
+ 'set_emo_dir' => 'default',
+ 'set_hide_from_list' => 1,
+ 'set_css_groups' => '',
+ 'set_output_format' => 'html' ) );
+}
+
+/* Make sure we have a HTML default... */
+$skin = $DB->buildAndFetch( array( 'select' => 'set_id',
+ 'from' => 'skin_collections',
+ 'where' => 'set_output_format=\'html\' AND set_is_default=1' ) );
+
+if ( ! $skin['set_id'] )
+{
+ $DB->update( 'skin_collections', array( 'set_is_default' => 1, 'set_hide_from_list' => 0 ), "set_key='default'" );
+}
+
+$SQL[] = "ALTER TABLE custom_bbcode ADD bbcode_custom_regex TEXT NULL DEFAULT NULL;";
+
+$SQL[] = "ALTER TABLE skin_templates ADD template_master_key VARCHAR(100) NOT NULL DEFAULT '';";
+$SQL[] = "ALTER TABLE skin_templates ADD INDEX template_master_key (template_master_key);";
+
+$SQL[] = "ALTER TABLE skin_css ADD css_master_key VARCHAR(100) NOT NULL DEFAULT '';";
+
+$SQL[] = "ALTER TABLE skin_collections ADD set_master_key VARCHAR(100) NOT NULL DEFAULT '';";
+
+# will need to sort children out too
+$uagents = 'a:2:{s:6:"groups";a:0:{}s:7:"uagents";a:10:{s:10:"blackberry";s:0:"";s:6:"iphone";s:0:"";s:9:"ipodtouch";s:0:"";s:12:"sonyericsson";s:0:"";s:5:"nokia";s:0:"";s:8:"motorola";s:0:"";s:7:"samsung";s:0:"";s:3:"htc";s:0:"";s:2:"lg";s:0:"";s:4:"palm";s:0:"";}}';
+$SQL[] = "UPDATE skin_collections SET set_master_key='root' WHERE set_key='default';";
+$SQL[] = "UPDATE skin_collections SET set_name='IP.Board Mobile', set_master_key='mobile', set_key='mobile', set_image_dir='mobile', set_locked_uagent='{$uagents}' WHERE set_key='lofi';";
+$SQL[] = "UPDATE skin_collections SET set_master_key='xmlskin' WHERE set_key='xmlskin';";
+
+$SQL[] = "UPDATE skin_templates SET template_master_key='root' WHERE template_set_id=0;";
+
+$SQL[] = "UPDATE skin_css SET css_master_key='root' WHERE css_set_id=0;";
+
+if ( trim($ids) )
+{
+ $SQL[] = "DELETE FROM skin_templates WHERE template_set_id IN (" . $ids . ");";
+ $SQL[] = "DELETE FROM skin_css WHERE css_set_id IN (" . $ids . ");";
+}
+
+$SQL[] = "ALTER TABLE skin_collections ADD set_order INT( 10 ) NOT NULL;";
+$SQL[] = "ALTER TABLE skin_collections ADD INDEX ( set_order );";
+
+$SQL[] = "ALTER TABLE skin_replacements ADD replacement_master_key VARCHAR(100) NOT NULL DEFAULT '';";
+$SQL[] = "UPDATE skin_replacements SET replacement_master_key='root' WHERE replacement_set_id=0;";
+
+
+# Optimizations
+$SQL[] = "ALTER TABLE forum_tracker DROP INDEX member_id;";
+$SQL[] = "ALTER TABLE forum_tracker ADD INDEX member_id ( member_id , last_sent );";
+
+$SQL[] = "ALTER TABLE tracker DROP INDEX tm_id;";
+$SQL[] = "ALTER TABLE tracker ADD INDEX tm_id ( member_id , topic_id , last_sent );";
+
+$SQL[] = "ALTER TABLE forum_tracker ADD INDEX ( forum_track_type );";
+$SQL[] = "ALTER TABLE tracker ADD INDEX ( topic_track_type );";
+
+$SQL[] = "ALTER TABLE skin_templates ADD INDEX ( template_name(100) , template_group(100) );";
+
+$SQL[] = "ALTER TABLE members ADD INDEX ( email );";
+
diff --git a/upload/admin/applications/core/setup/versions/upg_31003/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_31003/mysql_updates.php
new file mode 100644
index 00000000..e948192f
--- /dev/null
+++ b/upload/admin/applications/core/setup/versions/upg_31003/mysql_updates.php
@@ -0,0 +1,35 @@
+getPrefix());
+$DB = ipsRegistry::DB();
+
+if ( ! $DB->checkForField( 'replacement_master_key', 'skin_replacements' ) )
+{
+ $SQL[] = "ALTER TABLE skin_replacements ADD replacement_master_key VARCHAR(100) NOT NULL DEFAULT '';";
+ $SQL[] = "UPDATE skin_replacements SET replacement_master_key='root' WHERE replacement_set_id=0;";
+}
+
+$SQL[] = "CREATE TABLE vkontakte_connect (
+ v_key varchar(32) NOT NULL default '',
+ v_user varchar(255) NOT NULL default '',
+ v_data varchar(255) NOT NULL default '',
+ v_id bigint(20) NOT NULL
+);";
+
+$SQL[] = "ALTER TABLE members ADD vk_uid bigint(20) unsigned NOT NULL default '0';";
+$SQL[] = "ALTER TABLE members ADD INDEX vk_uid (vk_uid);";
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_31004/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_31004/mysql_updates.php
new file mode 100644
index 00000000..f06ed975
--- /dev/null
+++ b/upload/admin/applications/core/setup/versions/upg_31004/mysql_updates.php
@@ -0,0 +1,50 @@
+checkForIndex( 'group_perms', 'rc_classes' ) )
+{
+ $SQL[] = "ALTER TABLE rc_classes DROP INDEX group_perms;";
+}
+else if ( $DB->checkForIndex( 'onoff', 'rc_classes' ) )
+{
+ $SQL[] = "ALTER TABLE rc_classes DROP INDEX onoff;";
+}
+
+$SQL[] = "ALTER TABLE rc_classes CHANGE group_can_report group_can_report TEXT NULL DEFAULT NULL";
+$SQL[] = "ALTER TABLE rc_classes CHANGE mod_group_perm mod_group_perm TEXT NULL DEFAULT NULL;";
+
+$SQL[] = "ALTER TABLE rc_classes ADD INDEX onoff ( onoff , mod_group_perm ( 255 ) );";
+
+$SQL[] = "ALTER TABLE pfields_content DROP updated;";
diff --git a/upload/admin/applications/core/setup/versions/upg_31005/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_31005/mysql_updates.php
new file mode 100644
index 00000000..7d5de29d
--- /dev/null
+++ b/upload/admin/applications/core/setup/versions/upg_31005/mysql_updates.php
@@ -0,0 +1,27 @@
+\nHello World
\n[/html]' where bbcode_tag='html';";
+
+/* Have to add this into 3.0.0 upgrader now, so check here if we're upgrade > 3.0.0 */
+if ( ! $DB->checkForField( 'mediatag_position', 'bbcode_mediatag' ) )
+{
+ $SQL[] = "ALTER TABLE bbcode_mediatag ADD mediatag_position SMALLINT NOT NULL DEFAULT '0';";
+}
diff --git a/upload/admin/applications/core/setup/versions/upg_31006/index.html b/upload/admin/applications/core/setup/versions/upg_31006/index.html
new file mode 100644
index 00000000..dfdb4ca9
--- /dev/null
+++ b/upload/admin/applications/core/setup/versions/upg_31006/index.html
@@ -0,0 +1,10 @@
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_31006/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_31006/mysql_updates.php
new file mode 100644
index 00000000..eb8f8386
--- /dev/null
+++ b/upload/admin/applications/core/setup/versions/upg_31006/mysql_updates.php
@@ -0,0 +1,361 @@
+checkForTable('cal_events') )
+{
+ $SQL[] = "ALTER TABLE cal_events CHANGE event_tz event_tz VARCHAR( 4 ) NOT NULL DEFAULT '0'";
+}
+
+$SQL[] = "ALTER TABLE mobile_notifications DROP INDEX id;";
+$SQL[] = "ALTER TABLE profile_friends DROP INDEX friends_member_id;";
+$SQL[] = "ALTER TABLE member_status_updates DROP INDEX status_member_id;";
+$SQL[] = "ALTER TABLE profile_friends_flood DROP INDEX friends_member_id;";
+$SQL[] = "ALTER TABLE moderator_logs CHANGE topic_title topic_title TEXT NULL DEFAULT NULL;";
+$SQL[] = "ALTER TABLE moderator_logs CHANGE query_string query_string TEXT NULL DEFAULT NULL;";
+$SQL[] = "ALTER TABLE moderator_logs CHANGE http_referer http_referer TEXT NULL DEFAULT NULL;";
+$SQL[] = "ALTER TABLE moderator_logs CHANGE action action TEXT NULL DEFAULT NULL;";
+$SQL[] = "ALTER TABLE profile_portal_views ADD INDEX ( views_member_id );";
+$SQL[] = "ALTER TABLE topic_views ADD INDEX ( views_tid );";
+$SQL[] = "ALTER TABLE attachments DROP INDEX attach_where;";
+$SQL[] = "DELETE FROM core_sys_conf_settings WHERE conf_key='acp_tutorial_mode';";
+$SQL[] = "UPDATE skin_templates SET template_data='\$required_output=\'\',\$optional_output=\'\',\$day=\'\',\$mon=\'\',\$year=\'\'' WHERE template_name='membersProfileForm';";
+
+//-----------------------------------------
+// Remove unused tables
+//-----------------------------------------
+
+if( $DB->checkForTable('facebook_oauth_temp') )
+{
+ $SQL[] = "DROP TABLE facebook_oauth_temp;";
+}
+
+if( $DB->checkForTable('search_index') )
+{
+ $SQL[] = "DROP TABLE search_index;";
+}
+
+// Tracker is using this apparently
+//if( $DB->checkForTable('search_results') )
+//{
+// $SQL[] = "DROP TABLE search_results;";
+//}
+
+if( $DB->checkForTable('templates_diff_import') )
+{
+ $SQL[] = "DROP TABLE templates_diff_import;";
+}
+
+if( $DB->checkForTable('template_diff_changes') )
+{
+ $SQL[] = "DROP TABLE template_diff_changes;";
+}
+
+if( $DB->checkForTable('template_diff_session') )
+{
+ $SQL[] = "DROP TABLE template_diff_session;";
+}
+
+//-----------------------------------------
+// And unused columns *sigh*
+// Fun fact:
+// Matt said: YES - and all below apart from that massive ALTER list and Im not touching that. :p so there
+//-----------------------------------------
+
+if( $DB->checkForField( 'attach_approved', 'attachments' ) )
+{
+ $SQL[] = "ALTER TABLE attachments DROP attach_approved;";
+}
+
+if( $DB->checkForField( 'attach_temp', 'attachments' ) )
+{
+ $SQL[] = "ALTER TABLE attachments DROP attach_temp;";
+}
+
+if( $DB->checkForField( 'mail_honor', 'bulk_mail' ) )
+{
+ $SQL[] = "ALTER TABLE bulk_mail DROP mail_honor;";
+}
+
+//if( $DB->checkForField( 'cs_extra', 'cache_store' ) )
+//{
+// $SQL[] = "ALTER TABLE cache_store DROP cs_extra;";
+//}
+
+if( $DB->checkForField( 'rss_foreign_id', 'core_rss_imported' ) )
+{
+ $SQL[] = "ALTER TABLE core_rss_imported DROP rss_foreign_id;";
+}
+
+if( $DB->checkForField( 'share_url', 'core_share_links' ) )
+{
+ $SQL[] = "ALTER TABLE core_share_links DROP share_url;";
+}
+
+if( $DB->checkForField( 'share_markup', 'core_share_links' ) )
+{
+ $SQL[] = "ALTER TABLE core_share_links DROP share_markup;";
+}
+
+if( $DB->checkForField( 'conf_end_group', 'core_sys_conf_settings' ) )
+{
+ $SQL[] = "ALTER TABLE core_sys_conf_settings DROP conf_end_group;";
+}
+
+if( $DB->checkForField( 'lang_currency_symbol', 'core_sys_lang' ) )
+{
+ $SQL[] = "ALTER TABLE core_sys_lang DROP lang_currency_symbol;";
+}
+
+if( $DB->checkForField( 'lang_decimal', 'core_sys_lang' ) )
+{
+ $SQL[] = "ALTER TABLE core_sys_lang DROP lang_decimal;";
+}
+
+if( $DB->checkForField( 'lang_comma', 'core_sys_lang' ) )
+{
+ $SQL[] = "ALTER TABLE core_sys_lang DROP lang_comma;";
+}
+
+if( $DB->checkForField( 'sys_login_skin', 'core_sys_login' ) )
+{
+ $SQL[] = "ALTER TABLE core_sys_login DROP sys_login_skin;";
+}
+
+if( $DB->checkForField( 'sys_login_language', 'core_sys_login' ) )
+{
+ $SQL[] = "ALTER TABLE core_sys_login DROP sys_login_language;";
+}
+
+if( $DB->checkForField( 'sys_login_last_visit', 'core_sys_login' ) )
+{
+ $SQL[] = "ALTER TABLE core_sys_login DROP sys_login_last_visit;";
+}
+
+if( $DB->checkForField( 'conf_title_module', 'core_sys_settings_titles' ) )
+{
+ $SQL[] = "ALTER TABLE core_sys_settings_titles DROP conf_title_module;";
+}
+
+if( $DB->checkForField( 'bbcode_parse', 'custom_bbcode' ) )
+{
+ $SQL[] = "ALTER TABLE custom_bbcode DROP bbcode_parse;";
+}
+
+if( $DB->checkForField( 'topic_id', 'email_logs' ) )
+{
+ $SQL[] = "ALTER TABLE email_logs DROP topic_id;";
+}
+
+if( $DB->checkForField( 'redirect_loc', 'forums' ) )
+{
+ $SQL[] = "ALTER TABLE forums DROP redirect_loc;";
+}
+
+if( $DB->checkForField( 'topic_mm_id', 'forums' ) )
+{
+ $SQL[] = "ALTER TABLE forums DROP topic_mm_id;";
+}
+
+if( $DB->checkForField( 'permission_array', 'forums' ) )
+{
+ $SQL[] = "ALTER TABLE forums DROP permission_array;";
+}
+
+if( $DB->checkForField( 'g_invite_friend', 'groups' ) )
+{
+ $SQL[] = "ALTER TABLE groups DROP g_invite_friend;";
+}
+
+if( $DB->checkForField( 'g_can_remove', 'groups' ) )
+{
+ $SQL[] = "ALTER TABLE groups DROP g_can_remove;";
+}
+
+if( $DB->checkForField( 'login_date', 'login_methods' ) )
+{
+ $SQL[] = "ALTER TABLE login_methods DROP login_date;";
+}
+
+if( $DB->checkForField( 'mail_type', 'mail_queue' ) )
+{
+ $SQL[] = "ALTER TABLE mail_queue DROP mail_type;";
+}
+
+if( $DB->checkForField( 'edit_user', 'moderators' ) )
+{
+ $SQL[] = "ALTER TABLE moderators DROP edit_user;";
+}
+
+if( $DB->checkForField( 'rating_added', 'profile_ratings' ) )
+{
+ $SQL[] = "ALTER TABLE profile_ratings DROP rating_added;";
+}
+
+if( $DB->checkForField( 'misc', 'reputation_index' ) )
+{
+ $SQL[] = "ALTER TABLE reputation_index DROP misc;";
+}
+
+if( $DB->checkForField( 'pp_profile_update', 'profile_portal' ) )
+{
+ $SQL[] = "ALTER TABLE profile_portal DROP pp_profile_update;";
+}
+
+if( $DB->checkForField( 'pp_bio_content', 'profile_portal' ) )
+{
+ $SQL[] = "ALTER TABLE profile_portal DROP pp_bio_content;";
+}
+
+if( $DB->checkForField( 'pp_comment_count', 'profile_portal' ) )
+{
+ $SQL[] = "ALTER TABLE profile_portal DROP pp_comment_count;";
+}
+
+if( $DB->checkForField( 'pp_setting_notify_comments', 'profile_portal' ) )
+{
+ $SQL[] = "ALTER TABLE profile_portal DROP pp_setting_notify_comments;";
+}
+
+if( $DB->checkForField( 'pp_setting_notify_friend', 'profile_portal' ) )
+{
+ $SQL[] = "ALTER TABLE profile_portal DROP pp_setting_notify_friend;";
+}
+
+if( $DB->checkForField( 'pp_friend_count', 'profile_portal' ) )
+{
+ $SQL[] = "ALTER TABLE profile_portal DROP pp_friend_count;";
+}
+
+if( $DB->checkForField( 'pp_gender', 'profile_portal' ) )
+{
+ $SQL[] = "ALTER TABLE profile_portal DROP pp_gender;";
+}
+
+if( $DB->checkForField( 'pp_profile_views', 'profile_portal' ) )
+{
+ $SQL[] = "ALTER TABLE profile_portal DROP pp_profile_views;";
+}
+
+if( $DB->checkForField( 'links', 'profile_portal' ) )
+{
+ $SQL[] = "ALTER TABLE profile_portal DROP links;";
+}
+
+if( $DB->checkForField( 'bio', 'profile_portal' ) )
+{
+ $SQL[] = "ALTER TABLE profile_portal DROP bio;";
+}
+
+if( $DB->checkForField( 'ta_size', 'profile_portal' ) )
+{
+ $SQL[] = "ALTER TABLE profile_portal DROP ta_size;";
+}
+
+if( $DB->checkForField( 'fb_status', 'profile_portal' ) )
+{
+ $SQL[] = "ALTER TABLE profile_portal DROP fb_status;";
+}
+
+if( $DB->checkForField( 'pp_status', 'profile_portal' ) )
+{
+ $SQL[] = "ALTER TABLE profile_portal DROP pp_status;";
+}
+
+if( $DB->checkForField( 'pp_status_update', 'profile_portal' ) )
+{
+ $SQL[] = "ALTER TABLE profile_portal DROP pp_status_update;";
+}
+
+if( $DB->checkForField( 'max_points', 'rc_modpref' ) )
+{
+ $SQL[] = "ALTER TABLE rc_modpref DROP max_points;";
+}
+
+if( $DB->checkForField( 'reports_pp', 'rc_modpref' ) )
+{
+ $SQL[] = "ALTER TABLE rc_modpref DROP reports_pp;";
+}
+
+if( $DB->checkForField( 'by_pm', 'rc_modpref' ) )
+{
+ $SQL[] = "ALTER TABLE rc_modpref DROP by_pm;";
+}
+
+if( $DB->checkForField( 'by_email', 'rc_modpref' ) )
+{
+ $SQL[] = "ALTER TABLE rc_modpref DROP by_email;";
+}
+
+if( $DB->checkForField( 'by_alert', 'rc_modpref' ) )
+{
+ $SQL[] = "ALTER TABLE rc_modpref DROP by_alert;";
+}
+
+//if( $DB->checkForField( 'location', 'sessions' ) )
+//{
+// $SQL[] = "ALTER TABLE sessions DROP location;";
+//}
+
+if( $DB->checkForField( 'misc', 'tags_index' ) )
+{
+ $SQL[] = "ALTER TABLE tags_index DROP misc;";
+}
+
+if( $DB->checkForField( 'total_votes', 'topics' ) )
+{
+ $SQL[] = "ALTER TABLE topics DROP total_votes;";
+}
+
+if( $DB->checkForField( 'email_pm', 'members' ) )
+{
+ $SQL[] = "ALTER TABLE members DROP email_pm;";
+}
+
+if( $DB->checkForField( 'view_pop', 'members' ) )
+{
+ $SQL[] = "ALTER TABLE members DROP view_pop;";
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_31007/index.html b/upload/admin/applications/core/setup/versions/upg_31007/index.html
new file mode 100644
index 00000000..dfdb4ca9
--- /dev/null
+++ b/upload/admin/applications/core/setup/versions/upg_31007/index.html
@@ -0,0 +1,10 @@
+
+IP.Board - Bulletin Board System
+
+403: IP.Board -> Forbidden
+
+You have reached this page in error, please use your back button to return to the forum.
+
+IP.Board
+
+
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_31007/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_31007/mysql_updates.php
new file mode 100644
index 00000000..0e11fea0
--- /dev/null
+++ b/upload/admin/applications/core/setup/versions/upg_31007/mysql_updates.php
@@ -0,0 +1,56 @@
+checkForTable('core_like_cache') )
+{
+ $SQL[] = "DROP TABLE core_like_cache;";
+}
+
+if ( $DB->checkForTable('core_like') )
+{
+ $SQL[] = "DROP TABLE core_like;";
+}
+
+$SQL[] = "CREATE TABLE core_like_cache (
+ like_cache_id VARCHAR(32),
+ like_cache_app VARCHAR(150) NOT NULL DEFAULT '',
+ like_cache_area VARCHAR(200) NOT NULL DEFAULT '',
+ like_cache_rel_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+ like_cache_data TEXT,
+ like_cache_expire INT(10) NOT NULL DEFAULT '0',
+ PRIMARY KEY (like_cache_id)
+);";
+
+
+$SQL[] = "CREATE TABLE core_like (
+ like_id VARCHAR(32),
+ like_lookup_id VARCHAR(32),
+ like_app VARCHAR(150) NOT NULL DEFAULT '',
+ like_area VARCHAR(200) NOT NULL DEFAULT '',
+ like_rel_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+ like_member_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
+ like_is_anon INT(1) NOT NULL DEFAULT 0,
+ like_added INT(10) UNSIGNED NOT NULL DEFAULT 0,
+ like_notify_do INT(1) NOT NULL DEFAULT 0,
+ like_notify_meta TEXT,
+ like_notify_freq VARCHAR(200) NOT NULL DEFAULT '',
+ like_notify_sent INT(10) UNSIGNED NOT NULL DEFAULT 0,
+ PRIMARY KEY (like_id),
+ KEY find_rel_favs ( like_lookup_id, like_is_anon, like_added),
+ KEY like_member_id (like_member_id,like_added)
+);";
+
diff --git a/upload/admin/applications/core/skin_cp/cp_skin_adminlogs.php b/upload/admin/applications/core/skin_cp/cp_skin_adminlogs.php
index 9572f0ca..ad9cb61e 100644
--- a/upload/admin/applications/core/skin_cp/cp_skin_adminlogs.php
+++ b/upload/admin/applications/core/skin_cp/cp_skin_adminlogs.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Admin log skin file
- * Last Updated: $Date: 2009-09-24 16:56:42 -0400 (Thu, 24 Sep 2009) $
+ * Last Updated: $Date: 2010-06-24 05:36:05 -0400 (Thu, 24 Jun 2010) $
+ *
*
- * @author $Author: rikki $
+ * @author $Author: matt $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Friday 19th May 2006 17:33
- * @version $Revision: 5154 $
+ * @version $Revision: 6570 $
*/
class cp_skin_adminlogs extends output
@@ -54,6 +56,8 @@ $IPBHTML .= <<{$this->lang->words['sched_error_logs']}
{$this->lang->words['al_error_logs']}
{$this->lang->words['slog_spamlogs']}
+ {$this->lang->words['mlog_mobilelogs']}
+ {$this->lang->words['mlog_sqlerrors']}
HTML;
@@ -200,6 +204,112 @@ HTML;
return $IPBHTML;
}
+/**
+ * SQL log RAPPER LIKE ICE T BUT MORE LIKE COFFEE
+ *
+ * @access public
+ * @param array Rows
+ * @param string Page links
+ * @return string HTML
+ */
+public function sqllogsWrapper( $rows ) {
+
+$IPBHTML = "";
+//--starthtml--//
+
+$IPBHTML .= <<
+ {$this->lang->words['sqllog_title']}
+
+
+
+
{$this->lang->words['sqllog_title']}
+
+
+
+ {$this->lang->words['sqllog_name']}
+ {$this->lang->words['sqllog_date']}
+ {$this->lang->words['sqllog_size']}
+
+
+HTML;
+
+if( count($rows) AND is_array($rows) )
+{
+ foreach( $rows as $row )
+ {
+ $size = IPSLib::sizeFormat( $row['size'] );
+ $mtime = $this->registry->class_localization->getDate( $row['mtime'], 'SHORT' );
+
+ $IPBHTML .= <<
+
+ {$row['name']}
+ {$mtime}
+ {$size}
+
+
+HTML;
+ }
+}
+else
+{
+ $IPBHTML .= <<
+ {$this->lang->words['sqllog_noresults']}
+
+HTML;
+}
+
+$IPBHTML .= <<
+
+
+
+HTML;
+
+//--endhtml--//
+return $IPBHTML;
+}
+
+
+/**
+ * View a log
+ *
+ * @access public
+ */
+public function sqlLogsView( $file, $size, $content ) {
+
+$tailSize = IPSLib::strlenToBytes( strlen( $content ) );
+
+/* Display a message? */
+if ( $tailSize < $size )
+{
+ $this->registry->output->global_message = sprintf( $this->lang->words['sqllog_more_file'], $file );
+}
+
+$IPBHTML = "";
+//--starthtml--//
+
+$IPBHTML .= <<
+ {$this->lang->words['sqllog_title']}
+
+
+
+HTML;
+
+//--endhtml--//
+return $IPBHTML;
+}
+
/**
* View an individual admin's logs
*
diff --git a/upload/admin/applications/core/skin_cp/cp_skin_api.php b/upload/admin/applications/core/skin_cp/cp_skin_api.php
index b7c73373..403dba6e 100644
--- a/upload/admin/applications/core/skin_cp/cp_skin_api.php
+++ b/upload/admin/applications/core/skin_cp/cp_skin_api.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* API users skin file
- * Last Updated: $Date: 2009-08-18 16:46:02 -0400 (Tue, 18 Aug 2009) $
+ * Last Updated: $Date: 2010-09-29 20:23:38 -0400 (Wed, 29 Sep 2010) $
+ *
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Friday 19th May 2006 17:33
- * @version $Revision: 5027 $
+ * @version $Revision: 6925 $
*/
class cp_skin_api extends output
@@ -51,20 +53,20 @@ $IPBHTML .= <<{$this->lang->words['a_basics']}
- {$this->lang->words['a_key']}
- {$log['api_log_key']}
+ {$this->lang->words['a_key']}
+ {$log['api_log_key']}
- {$this->lang->words['a_ip']}
- {$log['api_log_ip']}
+ {$this->lang->words['a_ip']}
+ {$log['api_log_ip']}
- {$this->lang->words['a_time']}
- {$log['_api_log_date']}
+ {$this->lang->words['a_time']}
+ {$log['_api_log_date']}
- {$this->lang->words['a_success']}
-
+ {$this->lang->words['a_success']}
+
@@ -123,14 +125,14 @@ if ( is_array( $logs ) AND count( $logs ) )
$IPBHTML .= <<
-
+
{$r['api_log_key']}
{$r['api_log_ip']}
{$r['_api_log_date']}
-
+
-
+
EOF;
@@ -138,7 +140,7 @@ EOF;
}
$IPBHTML .= <<
- $links
+ {$links}
EOF;
diff --git a/upload/admin/applications/core/skin_cp/cp_skin_applications.php b/upload/admin/applications/core/skin_cp/cp_skin_applications.php
index 264f6b42..2ebd5ed2 100644
--- a/upload/admin/applications/core/skin_cp/cp_skin_applications.php
+++ b/upload/admin/applications/core/skin_cp/cp_skin_applications.php
@@ -1,18 +1,20 @@
* Invision Power Services
- * IP.Board v3.0.5
+ * IP.Board v3.1.4
* Applications skin file
- * Last Updated: $Date: 2009-09-24 11:58:41 -0400 (Thu, 24 Sep 2009) $
+ * Last Updated: $Date: 2010-11-17 08:24:42 -0500 (Wed, 17 Nov 2010) $
+ *
*
- * @author $Author: matt $
+ * @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.iinvisionpower.com/community/board/license.html
- * @package Invision Power Board
+ * @license http://www.invisionpower.com/community/board/license.html
+ * @package IP.Board
* @subpackage Core
- * @link http://www.iinvisionpower.com
+ * @link http://www.invisionpower.com
* @since Friday 19th May 2006 17:33
- * @version $Revision: 5150 $
+ * @version $Revision: 7205 $
*/
class cp_skin_applications extends output
@@ -45,14 +47,14 @@ public function module_form( $form, $title, $formcode, $button, $module, $applic
$IPBHTML = "";
//--starthtml--//
-$title = $formcode == module_edit_do ? $this->lang->words['module_form_edit_title'] : $this->lang->words['module_form_add_title'];
+$title = $formcode == 'module_edit_do' ? $this->lang->words['module_form_edit_title'] : $this->lang->words['module_form_add_title'];
$IPBHTML .= <<
{$title}
-