- Manage Caches
+ Настройки Инструментов
+ core_tands
+
+ -
+
performance_toggle
+ Может включать режим производительности?
+
+ -
+
licensekey_manage
+ Может работать с информацией о лицензии?
+
+
+
+
+ Управление кешем
core_caches
-
cache_manage
- Can view and recache caches?
+ Может посматривать и обновлять кеш?
- Manage Log In Modules
+ Управление модулями авторизации
core_login_modules
-
login_manage
- Can manage log in modules?
+ Может управлять модулями авторизации?
- Registration questions and answers
+ Система вопросов при регистрации
core_qanda
-
qanda_view
- Can access questions and answers?
+ Может просматривать?
-
qa_manage
- Can add, edit and remove questions and answers?
+ Может изменять, добавлять и удалять?
- Manage Help Files
+ Управление разделами помощи
core_helpfiles
-
helpfiles_manage
- Can access help files?
+ Может просматривать?
-
help_manage
- Can edit/add help files?
+ Может изменять/добавлять?
-
help_remove
- Can remove help files?
+ Может удалять?
- API Users
+ Пользователи API
core_apiusers
-
api_manage
- Can edit/add API users?
+ Может изменять/добавлять?
-
api_remove
- Can remove API users?
+ Может удалять?
-
api_logs
- Can access API logs?
+ Может просматривать логи?
- Share Links
+ Сервисы публикации ссылок
core_sharelinks
-
sharelinks_manage
- Can edit/add/delete share links?
+ Может изменять/добавлять/удалять?
- Manage User Agents
+ Управление User Agents
core_uagents
-
uagents
- Can manage user agents?
+ Может управлять?
-
ua_manage
- Can edit/add user agents and user agent groups?
+ Может изменять/добавлять группы и агенты?
-
ua_remove
- Can remove user agents and user agent groups?
+ Может удалять группы и агенты?
- Cleanup and Rebuild Tools
+ Инструменты очистки и перестроения
core_cleanuprebuild
-
rebuild_manage
- Can access rebuild tools?
+ Имеет доступ к инструментам перестроения?
-
cleanup_manage
- Can access recount tools?
+ Имеет доступ к инструментам пересчета?
-
tools_recount
- Can recount site statistics?
+ Может производить пересчет статистики форума?
-
tools_resynch
- Can resynchronize forums?
+ Может производить пересчет статистики форумов?
-
tools_resyncht
- Can resynchronize topics?
+ Может производить пересчет статистики тем?
-
tools_rebuild
- Can rebuild bbcode in post and other content?
+ Может производить перестроение содержимого сообщений?
-
tools_postcounts
- Can reset post counts and usernames in posts?
+ Может производить пересчет сообщений пользователей?
-
tools_thumbs
- Can rebuild thumbnails and user photos?
+ Может производить обновление изображений предпросмотра?
-
tools_attach
- Can rebuild attachment data?
+ Может производить перестроение прикреплений?
-
tools_orphaned
- Can remove orphaned attachments?
+ Может удалять потерянные файлы?
-
tools_orphanp
- Can remove orphaned photos?
+ Может удалять потерянные фотографии?
- Incoming Email Rules
+ Правила входящей почты
core_emailrules
-
incomingemail_manage
- Can manage Incoming Email rules?
+ Может управлять правилами?
diff --git a/upload/admin/applications/core/modules_public/ajax/attach.php b/upload/admin/applications/core/modules_public/ajax/attach.php
index e3ce8d44..0e1235cd 100644
--- a/upload/admin/applications/core/modules_public/ajax/attach.php
+++ b/upload/admin/applications/core/modules_public/ajax/attach.php
@@ -4,11 +4,11 @@
*
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
- * $Author: ips_terabyte $
+ * $Author: mmecham $
* @since -
- * $LastChangedDate: 2011-05-25 10:30:28 -0400 (Wed, 25 May 2011) $
- * @version v3.3.4
- * $Revision: 8887 $
+ * $LastChangedDate: 2013-03-19 09:02:31 -0400 (Tue, 19 Mar 2013) $
+ * @version v3.4.5
+ * $Revision: 12085 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -44,9 +44,58 @@ class public_core_ajax_attach extends ipsAjaxCommand
case 'setPref':
$this->_setPref();
break;
+ case 'getForumsAppUploader':
+ $this->_getForumsAppUploader();
+ break;
}
}
+ /**
+ * Gets the uploader form/data for ajaxy stuffs
+ */
+ protected function _getForumsAppUploader()
+ {
+ $this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_post', 'public_topics' ), 'forums' );
+
+ $attach_post_key = trim( $this->request['attach_post_key'] );
+ $attach_rel_id = intval( $this->request['attach_rel_id'] );
+ $forum_id = intval( $this->request['forum_id'] );
+
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php', 'class_attach' );
+ $class_attach = new $classToLoad( $this->registry );
+ $class_attach->type = 'post';
+ $class_attach->attach_post_key = $attach_post_key;
+ $class_attach->init();
+ $class_attach->getUploadFormSettings();
+
+ $html = $this->registry->getClass('output')->getTemplate('post')->uploadForm( $this->post_key, 'post', $class_attach->attach_stats, $attach_rel_id, $forum_id );
+
+ /* Need to make sure they are unique - if we implement, change template to accept a prefix */
+ $html = str_replace( "id='add_files_attach_" , "id='add_files_attach_pu_" , $html );
+ $html = str_replace( "id='nojs_attach_" , "id='nojs_attach_pu_" , $html );
+ $html = str_replace( "id='help_msg'" , "id='pu_help_msg'" , $html );
+ $html = str_replace( "id='space_info_attach_", "id='space_info_attach_pu_", $html );
+ $html = str_replace( "" , "" , $html );
+
+ /* Remove help msg */
+
+ /* remove inline execution */
+ preg_match_all( '##is', $html, $matches, PREG_SET_ORDER );
+
+ foreach( $matches as $val )
+ {
+ $all = $val[0];
+ $javascript = $val[1];
+
+ if ( stristr( $all, 'ipb.attach.registerUploader' ) )
+ {
+ $html = str_replace( $all, '', $html );
+ }
+ }
+
+ $this->returnHtml( $html );
+ }
+
/**
* Sets uploader preference
*
diff --git a/upload/admin/applications/core/modules_public/ajax/captcha.php b/upload/admin/applications/core/modules_public/ajax/captcha.php
index 3ad104f9..aa2340ce 100644
--- a/upload/admin/applications/core/modules_public/ajax/captcha.php
+++ b/upload/admin/applications/core/modules_public/ajax/captcha.php
@@ -2,9 +2,9 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Update captcha image
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
*
*
* @author $Author: bfarber $
@@ -14,7 +14,7 @@
* @subpackage Core
* @link http://www.invisionpower.com
* @since 2.3
- * @version $Revision: 10914 $
+ * @version $Revision: 10721 $
*
*/
diff --git a/upload/admin/applications/core/modules_public/ajax/comments.php b/upload/admin/applications/core/modules_public/ajax/comments.php
index 40e80c69..b272fdd2 100644
--- a/upload/admin/applications/core/modules_public/ajax/comments.php
+++ b/upload/admin/applications/core/modules_public/ajax/comments.php
@@ -2,17 +2,17 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Image Ajax
- * Last Updated: $LastChangedDate: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $LastChangedDate: 2013-02-08 10:22:34 -0500 (Fri, 08 Feb 2013) $
*
*
- * @author $Author: bfarber $
+ * @author $Author: mark $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Gallery
* @link http://www.invisionpower.com
- * @version $Rev: 10914 $
+ * @version $Rev: 11963 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -72,7 +72,7 @@ class public_core_ajax_comments extends ipsAjaxCommand
$parentId = intval( $this->request['parentId'] );
$commentIds = ( is_array( $_POST['commentIds'] ) ) ? IPSLib::cleanIntArray( $_POST['commentIds'] ) : array();
$modact = trim( $this->request['modact'] );
-
+
if ( count( $commentIds ) )
{
try
@@ -83,7 +83,14 @@ class public_core_ajax_comments extends ipsAjaxCommand
}
catch( Exception $error )
{
- $this->returnJsonError( 'Error ' . $error->getMessage() . ' line: ' . $error->getFile() . '.' . $error->getLine() );
+ if ( $error->getMessage() == 'NO_PERMISSION' )
+ {
+ $this->returnJsonError( $this->lang->words['ap_np_msg'] );
+ }
+ else
+ {
+ $this->returnJsonError( 'Error ' . $error->getMessage() . ' line: ' . $error->getFile() . '.' . $error->getLine() );
+ }
}
}
}
diff --git a/upload/admin/applications/core/modules_public/ajax/defaultSection.php b/upload/admin/applications/core/modules_public/ajax/defaultSection.php
index d3f13232..f8801479 100644
--- a/upload/admin/applications/core/modules_public/ajax/defaultSection.php
+++ b/upload/admin/applications/core/modules_public/ajax/defaultSection.php
@@ -7,7 +7,7 @@
* $Author: ips_terabyte $
* @since 20th February 2002
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
- * @version v3.3.4
+ * @version v3.4.5
* $Revision: 8655 $
*/
diff --git a/upload/admin/applications/core/modules_public/ajax/editor.php b/upload/admin/applications/core/modules_public/ajax/editor.php
index 9312a78d..f917ee12 100644
--- a/upload/admin/applications/core/modules_public/ajax/editor.php
+++ b/upload/admin/applications/core/modules_public/ajax/editor.php
@@ -2,18 +2,18 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Handles ajax functions for IP.Board Text Editor
* Author: Matt "Matt Mecham" Mecham
- * Last Updated: $LastChangedDate: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $LastChangedDate: 2012-10-10 06:39:40 -0400 (Wed, 10 Oct 2012) $
*
*
- * @author $Author: bfarber $
+ * @author $Author: mmecham $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Gallery
* @link http://www.invisionpower.com
- * @version $Rev: 10914 $
+ * @version $Rev: 11434 $
*
*/
@@ -38,6 +38,8 @@ class public_core_ajax_editor extends ipsAjaxCommand
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite' );
$this->editor = new $classToLoad();
+ $this->lang->loadLanguageFile( 'public_editors', 'core' );
+
/* What to do? */
switch( $this->request['do'] )
{
@@ -92,17 +94,16 @@ class public_core_ajax_editor extends ipsAjaxCommand
}
$clearSavedContent = intval( $this->request['clearSavedContent'] );
- $bw_cke_contextmenu = intval( $this->request['bw_cke_contextmenu'] );
+ $pastePlain = intval( $this->request['pastePlain'] );
if ( $clearSavedContent )
{
$this->DB->delete( 'core_editor_autosave', 'eas_member_id=' . $this->memberData['member_id'] );
}
- IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'bw_cke_contextmenu' => $bw_cke_contextmenu ) ) );
+ IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'bw_paste_plain' => $pastePlain ) ) );
$member = IPSMember::load( $this->memberData['member_id'] );
-
/* return if no errors occurred */
return $this->returnJsonArray( array( 'status' => 'ok' ) );
}
diff --git a/upload/admin/applications/core/modules_public/ajax/facebook.php b/upload/admin/applications/core/modules_public/ajax/facebook.php
index 720e405d..c09d8c85 100644
--- a/upload/admin/applications/core/modules_public/ajax/facebook.php
+++ b/upload/admin/applications/core/modules_public/ajax/facebook.php
@@ -3,9 +3,9 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Login handler abstraction : AJAX login
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
*
*
* @author $Author: bfarber $
@@ -15,7 +15,7 @@
* @subpackage Core
* @link http://www.invisionpower.com
* @since Tuesday 1st March 2005 (11:52)
- * @version $Revision: 10914 $
+ * @version $Revision: 10721 $
*
*/
diff --git a/upload/admin/applications/core/modules_public/ajax/findnames.php b/upload/admin/applications/core/modules_public/ajax/findnames.php
index bdff3534..74915012 100644
--- a/upload/admin/applications/core/modules_public/ajax/findnames.php
+++ b/upload/admin/applications/core/modules_public/ajax/findnames.php
@@ -1,110 +1,110 @@
-
- * Invision Power Services
- * IP.Board v3.3.4
- * Login handler abstraction : AJAX Find Names functions
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
- *
- *
- * @author $Author: bfarber $
- * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.invisionpower.com/company/standards.php#license
- * @package IP.Board
- * @subpackage Core
- * @link http://www.invisionpower.com
- * @since Tuesday 1st March 2005 (11:52)
- * @version $Revision: 10914 $
- * @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
- *
- * @param object Registry reference
- * @return @e 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
- *
- * @return @e void Outputs to screen
- */
- protected function _getMemberNames()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $name = IPSText::convertUnicode( $this->convertAndMakeSafe( $this->request['name'], 0 ), true );
- $name = IPSText::convertCharsets( $name, 'utf-8', IPS_DOC_CHAR_SET );
-
- //-----------------------------------------
- // 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 = IPSMember::makeNameFormatted( '' , $r['member_group_id'] );
- $return[ $r['member_id'] ] = array( 'name' => $r['members_display_name'],
- 'showas'=> '' . $r['members_display_name'] . ' (' . $group . ')',
- 'img' => $photo['pp_mini_photo'],
- 'img_w' => $photo['pp_mini_width'],
- 'img_h' => $photo['pp_mini_height']
- );
- }
-
- $this->returnJsonArray( $return );
- }
+
+ * Invision Power Services
+ * IP.Board v3.4.5
+ * Login handler abstraction : AJAX Find Names functions
+ * Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/company/standards.php#license
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since Tuesday 1st March 2005 (11:52)
+ * @version $Revision: 10721 $
+ * @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
+ *
+ * @param object Registry reference
+ * @return @e 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
+ *
+ * @return @e void Outputs to screen
+ */
+ protected function _getMemberNames()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $name = IPSText::convertUnicode( $this->convertAndMakeSafe( $this->request['name'], 0 ), true );
+ $name = IPSText::convertCharsets( $name, 'utf-8', IPS_DOC_CHAR_SET );
+
+ //-----------------------------------------
+ // 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 = IPSMember::makeNameFormatted( '' , $r['member_group_id'] );
+ $return[ $r['member_id'] ] = array( 'name' => $r['members_display_name'],
+ 'showas'=> '' . $r['members_display_name'] . ' (' . $group . ')',
+ 'img' => $photo['pp_mini_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/like.php b/upload/admin/applications/core/modules_public/ajax/like.php
index eb8b3558..58732697 100644
--- a/upload/admin/applications/core/modules_public/ajax/like.php
+++ b/upload/admin/applications/core/modules_public/ajax/like.php
@@ -7,7 +7,7 @@
* $Author: bfarber $
* @since -
* $LastChangedDate: 2011-08-05 20:51:01 -0400 (Fri, 05 Aug 2011) $
- * @version v3.3.4
+ * @version v3.4.5
* $Revision: 9373 $
*/
diff --git a/upload/admin/applications/core/modules_public/ajax/login.php b/upload/admin/applications/core/modules_public/ajax/login.php
index 13d2730f..beef3bbc 100644
--- a/upload/admin/applications/core/modules_public/ajax/login.php
+++ b/upload/admin/applications/core/modules_public/ajax/login.php
@@ -2,9 +2,9 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Login handler abstraction : AJAX login
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
*
*
* @author $Author: bfarber $
@@ -14,7 +14,7 @@
* @subpackage Core
* @link http://www.invisionpower.com
* @since Tuesday 1st March 2005 (11:52)
- * @version $Revision: 10914 $
+ * @version $Revision: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
diff --git a/upload/admin/applications/core/modules_public/ajax/media.php b/upload/admin/applications/core/modules_public/ajax/media.php
index e986a69b..16aaebde 100644
--- a/upload/admin/applications/core/modules_public/ajax/media.php
+++ b/upload/admin/applications/core/modules_public/ajax/media.php
@@ -2,18 +2,18 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Handles ajax functions for IP.Board Text Editor
* Author: Matt "Matt Mecham" Mecham
- * Last Updated: $LastChangedDate: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $LastChangedDate: 2012-06-07 06:21:09 -0400 (Thu, 07 Jun 2012) $
*
*
- * @author $Author: bfarber $
+ * @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Gallery
* @link http://www.invisionpower.com
- * @version $Rev: 10914 $
+ * @version $Rev: 10885 $
*
*/
diff --git a/upload/admin/applications/core/modules_public/ajax/modcp.php b/upload/admin/applications/core/modules_public/ajax/modcp.php
index 0eb6aec4..bd0cdf9a 100644
--- a/upload/admin/applications/core/modules_public/ajax/modcp.php
+++ b/upload/admin/applications/core/modules_public/ajax/modcp.php
@@ -1,175 +1,175 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
- exit();
-}
-
-/**
- *
- * @class public_core_ajax_modcp
- * @brief Moderator control panel
- *
- */
-class public_core_ajax_modcp extends ipsAjaxCommand
-{
- /**
- * Main function executed automatically by the controller
- *
- * @param object $registry Registry object
- * @return @e void
- */
- public function doExecute( ipsRegistry $registry )
- {
- //-----------------------------------------
- // Load basic things
- //-----------------------------------------
-
- $this->registry->class_localization->loadLanguageFile( array( 'public_modcp' ) );
-
- //-----------------------------------------
- // Which road are we going to take?
- //-----------------------------------------
-
- switch( $this->request['do'] )
- {
- default:
- case 'index':
- $this->_getTab();
- break;
-
- case 'getmembers':
- $this->_getMembers();
- break;
- }
-
- //-----------------------------------------
- // Output
- //-----------------------------------------
-
- $this->registry->getClass('output')->addContent( $this->output );
- $this->registry->output->sendOutput();
- }
-
- /**
- * Returns possible matches for the string input
- *
- * @return @e void Outputs to screen
- */
- protected function _getMembers()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $name = IPSText::convertUnicode( $this->convertAndMakeSafe( $this->request['name'], 0 ), true );
- $name = IPSText::convertCharsets( $name, 'utf-8', IPS_DOC_CHAR_SET );
-
- //-----------------------------------------
- // Check length
- //-----------------------------------------
-
- if ( IPSText::mbstrlen( $name ) < 3 )
- {
- $this->returnJsonError( 'requestTooShort' );
- }
-
- //-----------------------------------------
- // Try query...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => 'm.members_display_name, m.member_id, m.members_seo_name, 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() )
- {
- $url = $this->registry->output->buildSEOUrl( "app=core&module=modcp&do=editmember&mid={$r['member_id']}", 'public' );
- $photo = IPSMember::buildProfilePhoto( $r );
- $group = IPSMember::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'],
- 'url' => $url,
- );
- }
-
- $this->returnJsonArray( $return );
- }
-
- /**
- * Retrieve modcp tab based
- *
- * @return @e void
- */
- protected function _getTab()
- {
- //-----------------------------------------
- // Init
- //-----------------------------------------
-
- ipsRegistry::getAppClass( 'forums' );
-
- $app = trim($this->request['fromapp']);
- $plugin = trim($this->request['tab']);
- $moderator = $this->registry->class_forums->getModerator();
- $_output = '';
-
- //-----------------------------------------
- // Get plugin output
- //-----------------------------------------
-
- if( is_file( IPSLib::getAppDir( $app ) . '/extensions/modcp/plugin_' . $app . '_' . $plugin . '.php' ) )
- {
- $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( $app ) . '/extensions/modcp/plugin_' . $app . '_' . $plugin . '.php', 'plugin_' . $app . '_' . $plugin, $app );
- $_thisPlugin = new $classToLoad( $this->registry );
-
- $_output = $_thisPlugin->executePlugin( $moderator );
- }
-
- //-----------------------------------------
- // Output
- //-----------------------------------------
-
- if( $_output )
- {
- $this->returnJsonArray( array( 'html' => $_output ) );
- }
- else
- {
- $this->returnJsonError( $this->lang->words['plugin_not_found'] );
- }
- }
+Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
+ exit();
+}
+
+/**
+ *
+ * @class public_core_ajax_modcp
+ * @brief Moderator control panel
+ *
+ */
+class public_core_ajax_modcp extends ipsAjaxCommand
+{
+ /**
+ * Main function executed automatically by the controller
+ *
+ * @param object $registry Registry object
+ * @return @e void
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ //-----------------------------------------
+ // Load basic things
+ //-----------------------------------------
+
+ $this->registry->class_localization->loadLanguageFile( array( 'public_modcp' ) );
+
+ //-----------------------------------------
+ // Which road are we going to take?
+ //-----------------------------------------
+
+ switch( $this->request['do'] )
+ {
+ default:
+ case 'index':
+ $this->_getTab();
+ break;
+
+ case 'getmembers':
+ $this->_getMembers();
+ break;
+ }
+
+ //-----------------------------------------
+ // Output
+ //-----------------------------------------
+
+ $this->registry->getClass('output')->addContent( $this->output );
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * Returns possible matches for the string input
+ *
+ * @return @e void Outputs to screen
+ */
+ protected function _getMembers()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $name = IPSText::convertUnicode( $this->convertAndMakeSafe( $this->request['name'], 0 ), true );
+ $name = IPSText::convertCharsets( $name, 'utf-8', IPS_DOC_CHAR_SET );
+
+ //-----------------------------------------
+ // Check length
+ //-----------------------------------------
+
+ if ( IPSText::mbstrlen( $name ) < 3 )
+ {
+ $this->returnJsonError( 'requestTooShort' );
+ }
+
+ //-----------------------------------------
+ // Try query...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => 'm.members_display_name, m.member_id, m.members_seo_name, 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() )
+ {
+ $url = $this->registry->output->buildSEOUrl( "app=core&module=modcp&do=editmember&mid={$r['member_id']}", 'public' );
+ $photo = IPSMember::buildProfilePhoto( $r );
+ $group = IPSMember::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'],
+ 'url' => $url,
+ );
+ }
+
+ $this->returnJsonArray( $return );
+ }
+
+ /**
+ * Retrieve modcp tab based
+ *
+ * @return @e void
+ */
+ protected function _getTab()
+ {
+ //-----------------------------------------
+ // Init
+ //-----------------------------------------
+
+ ipsRegistry::getAppClass( 'forums' );
+
+ $app = trim($this->request['fromapp']);
+ $plugin = trim($this->request['tab']);
+ $moderator = $this->registry->class_forums->getModerator();
+ $_output = '';
+
+ //-----------------------------------------
+ // Get plugin output
+ //-----------------------------------------
+
+ if( is_file( IPSLib::getAppDir( $app ) . '/extensions/modcp/plugin_' . $app . '_' . $plugin . '.php' ) )
+ {
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( $app ) . '/extensions/modcp/plugin_' . $app . '_' . $plugin . '.php', 'plugin_' . $app . '_' . $plugin, $app );
+ $_thisPlugin = new $classToLoad( $this->registry );
+
+ $_output = $_thisPlugin->executePlugin( $moderator );
+ }
+
+ //-----------------------------------------
+ // Output
+ //-----------------------------------------
+
+ if( $_output )
+ {
+ $this->returnJsonArray( array( 'html' => $_output ) );
+ }
+ else
+ {
+ $this->returnJsonError( $this->lang->words['plugin_not_found'] );
+ }
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/ajax/navigation.php b/upload/admin/applications/core/modules_public/ajax/navigation.php
index 54bd260b..c8254c8b 100644
--- a/upload/admin/applications/core/modules_public/ajax/navigation.php
+++ b/upload/admin/applications/core/modules_public/ajax/navigation.php
@@ -6,7 +6,7 @@
* $Author: bfarber $
* @since 2/14/2011
* $LastChangedDate: 2011-04-27 19:56:50 -0400 (Wed, 27 Apr 2011) $
- * @version v3.3.4
+ * @version v3.4.5
* $Revision: 8514 $
*/
diff --git a/upload/admin/applications/core/modules_public/ajax/notifications.php b/upload/admin/applications/core/modules_public/ajax/notifications.php
index f71845f4..73f49ec0 100644
--- a/upload/admin/applications/core/modules_public/ajax/notifications.php
+++ b/upload/admin/applications/core/modules_public/ajax/notifications.php
@@ -3,9 +3,9 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Notification AJAX methods
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2012-08-28 17:56:22 -0400 (Tue, 28 Aug 2012) $
*
*
* @author $Author: bfarber $
@@ -15,7 +15,7 @@
* @subpackage Core
* @link http://www.invisionpower.com
* @since Tuesday 1st March 2005 (11:52)
- * @version $Revision: 10914 $
+ * @version $Revision: 11296 $
*
*/
@@ -170,6 +170,6 @@ class public_core_ajax_notifications extends ipsAjaxCommand
// Return results
//-----------------------------------------
- $this->returnJsonArray( array( 'html' => $this->cleanOutput( $this->registry->output->getTemplate('global_other')->notificationsList( $_data ) ) ) );
+ $this->returnJsonArray( array( 'html' => $this->registry->output->getTemplate('global_other')->notificationsList( $_data ) ), true );
}
}
\ 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 9881f407..55b1398a 100644
--- a/upload/admin/applications/core/modules_public/ajax/register.php
+++ b/upload/admin/applications/core/modules_public/ajax/register.php
@@ -2,19 +2,19 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Registration AJAX routines
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2012-07-19 11:49:35 -0400 (Thu, 19 Jul 2012) $
*
*
- * @author $Author: bfarber $
+ * @author $Author: mark $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Core
* @link http://www.invisionpower.com
* @since Who knows...
- * @version $Revision: 10914 $
+ * @version $Revision: 11095 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -120,7 +120,9 @@ class public_core_ajax_register extends ipsAjaxCommand
$han_login = new $classToLoad( $this->registry );
$han_login->init();
- if( $han_login->emailExistsCheck( $email ) )
+ $han_login->emailExistsCheck( $email );
+
+ if( $han_login->return_code AND $han_login->return_code != 'METHOD_NOT_DEFINED' AND $han_login->return_code != 'EMAIL_NOT_IN_USE' )
{
$this->returnString('found');
}
diff --git a/upload/admin/applications/core/modules_public/ajax/reports.php b/upload/admin/applications/core/modules_public/ajax/reports.php
index efdcce39..623b6c82 100644
--- a/upload/admin/applications/core/modules_public/ajax/reports.php
+++ b/upload/admin/applications/core/modules_public/ajax/reports.php
@@ -2,9 +2,9 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Reports AJAX options
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
*
*
* @author $Author: bfarber $
@@ -13,7 +13,7 @@
* @package IP.Board
* @subpackage Core
* @link http://www.invisionpower.com
- * @version $Rev: 10914 $
+ * @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
diff --git a/upload/admin/applications/core/modules_public/ajax/reputation.php b/upload/admin/applications/core/modules_public/ajax/reputation.php
index f68105b1..b0564f13 100644
--- a/upload/admin/applications/core/modules_public/ajax/reputation.php
+++ b/upload/admin/applications/core/modules_public/ajax/reputation.php
@@ -2,9 +2,9 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Reputation
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
*
*
* @author $Author: bfarber $
@@ -13,7 +13,7 @@
* @package IP.Board
* @subpackage Core
* @link http://www.invisionpower.com
- * @version $Rev: 10914 $
+ * @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
diff --git a/upload/admin/applications/core/modules_public/ajax/search.php b/upload/admin/applications/core/modules_public/ajax/search.php
index 68d69902..0fa1b7d2 100644
--- a/upload/admin/applications/core/modules_public/ajax/search.php
+++ b/upload/admin/applications/core/modules_public/ajax/search.php
@@ -3,11 +3,11 @@
* @file search.php AJAX configure VNC filters
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
- * $Author: ips_terabyte $
+ * $Author: AndyMillne $
* @since 2/14/2011
- * $LastChangedDate: 2011-05-25 10:30:28 -0400 (Wed, 25 May 2011) $
- * @version v3.3.4
- * $Revision: 8887 $
+ * $LastChangedDate: 2013-03-22 17:35:37 -0400 (Fri, 22 Mar 2013) $
+ * @version v3.4.5
+ * $Revision: 12112 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -60,9 +60,94 @@ class public_core_ajax_search extends ipsAjaxCommand
case 'saveForumsVncFilter':
$this->saveForm();
break;
+
+ case 'saveFollow':
+ $this->saveFollow();
+ break;
}
}
+ /**
+ * Save the 'like' preferences for a single object
+ *
+ * @return @e void
+ */
+ protected function saveFollow()
+ {
+ //-----------------------------------------
+ // Get like helper class
+ //-----------------------------------------
+
+ $bootstraps = array();
+
+ require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
+ $_bootstrap = classes_like::bootstrap( $this->request['searchApp'], $this->request['contentType'] );
+ $_likeKey = classes_like_registry::getKey( $this->request['id'], $this->memberData['member_id'] );
+ $_frequencies = $_bootstrap->allowedFrequencies();
+
+ //-----------------------------------------
+ // What action to take?
+ //-----------------------------------------
+
+ switch( $this->request['modaction'] )
+ {
+ case 'delete':
+ $_bootstrap->remove( $this->request['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;
+ default:
+ $this->returnJsonError("follow_no_action");
+ break;
+ }
+
+ $_data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_like', 'where' => "like_id='" . addslashes($_likeKey) . "'" ) );
+
+ $this->returnJsonArray( array( 'html' => $this->registry->output->getTemplate('search')->followData( $_data ) ) );
+ }
+
/**
* Save the form to configure VNC forum filters
*
diff --git a/upload/admin/applications/core/modules_public/ajax/sharelinks.php b/upload/admin/applications/core/modules_public/ajax/sharelinks.php
index 90d7125a..3c26723a 100644
--- a/upload/admin/applications/core/modules_public/ajax/sharelinks.php
+++ b/upload/admin/applications/core/modules_public/ajax/sharelinks.php
@@ -4,10 +4,10 @@
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2012 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
- * $Author: ips_terabyte $
- * $LastChangedDate: 2012-06-22 07:55:48 -0400 (Fri, 22 Jun 2012) $
- * @version v3.3.4
- * $Revision: 10969 $
+ * $Author: mmecham $
+ * $LastChangedDate: 2012-09-19 10:57:30 -0400 (Wed, 19 Sep 2012) $
+ * @version v3.4.5
+ * $Revision: 11350 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -176,7 +176,7 @@ class public_core_ajax_sharelinks extends ipsAjaxCommand
if ( $user['id'] )
{
- $sid = $connect->updateStatusWithUrl( $tweet, $url );
+ $sid = $connect->updateStatusWithUrl( $tweet, $url, true, $this->settings['twitter_hashtag'] );
if ( $sid )
{
diff --git a/upload/admin/applications/core/modules_public/ajax/skin.php b/upload/admin/applications/core/modules_public/ajax/skin.php
index 9c412814..07f0de18 100644
--- a/upload/admin/applications/core/modules_public/ajax/skin.php
+++ b/upload/admin/applications/core/modules_public/ajax/skin.php
@@ -7,7 +7,7 @@
* $Author: bfarber $
* @since -
* $LastChangedDate: 2011-08-06 01:51:01 +0100 (Sat, 06 Aug 2011) $
- * @version v3.3.4
+ * @version v3.4.5
* $Revision: 9373 $
*/
@@ -73,10 +73,7 @@ class public_core_ajax_skin extends ipsAjaxCommand
/* Make sure mobile skin is removed */
IPSCookie::set("mobileApp", 'false', -1);
IPSCookie::set("mobileBrowser", 0, -1);
-
- /* remove user agent bypass */
- IPSCookie::set("uagent_bypass", 0, -1);
-
+
/* Update member row */
$this->memberData['skin'] = $skinId;
}
@@ -106,10 +103,17 @@ class public_core_ajax_skin extends ipsAjaxCommand
break;
}
}
-
- /* Update... */
- IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'skin' => $skinId ) ) );
- }
+
+ /* Update... */
+ if ( $this->memberData['member_id'] )
+ {
+ IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'skin' => $skinId ) ) );
+ }
+ else
+ {
+ IPSCookie::set( 'guestSkinChoice', $skinId );
+ }
+ }
}
else if ( $skinId == 'unlockUserAgent' )
{
diff --git a/upload/admin/applications/core/modules_public/ajax/skingen.php b/upload/admin/applications/core/modules_public/ajax/skingen.php
index eef345ab..88b93611 100644
--- a/upload/admin/applications/core/modules_public/ajax/skingen.php
+++ b/upload/admin/applications/core/modules_public/ajax/skingen.php
@@ -2,7 +2,7 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Like Ajax
* Last Updated: $LastChangedDate: 2011-05-05 12:03:47 +0100 (Thu, 05 May 2011) $
*
diff --git a/upload/admin/applications/core/modules_public/ajax/tags.php b/upload/admin/applications/core/modules_public/ajax/tags.php
index 27cef64d..b27e0042 100644
--- a/upload/admin/applications/core/modules_public/ajax/tags.php
+++ b/upload/admin/applications/core/modules_public/ajax/tags.php
@@ -2,9 +2,9 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Like Ajax
- * Last Updated: $LastChangedDate: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $LastChangedDate: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
*
*
* @author $Author: bfarber $
@@ -12,7 +12,7 @@
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Gallery
* @link http://www.invisionpower.com
- * @version $Rev: 10914 $
+ * @version $Rev: 10721 $
*
*/
diff --git a/upload/admin/applications/core/modules_public/ajax/templates.php b/upload/admin/applications/core/modules_public/ajax/templates.php
index 81014d0e..11bc142a 100644
--- a/upload/admin/applications/core/modules_public/ajax/templates.php
+++ b/upload/admin/applications/core/modules_public/ajax/templates.php
@@ -7,7 +7,7 @@
* $Author: mmecham $
* @since Friday 19th May 2006 17:33
* $LastChangedDate: 2011-05-03 04:53:04 -0400 (Tue, 03 May 2011) $
- * @version v3.3.4
+ * @version v3.4.5
* $Revision: 8588 $
*/
diff --git a/upload/admin/applications/core/modules_public/ajax/usercp.php b/upload/admin/applications/core/modules_public/ajax/usercp.php
index 21b3a2ab..d52cbb2a 100644
--- a/upload/admin/applications/core/modules_public/ajax/usercp.php
+++ b/upload/admin/applications/core/modules_public/ajax/usercp.php
@@ -1,111 +1,111 @@
-
- * Invision Power Services
- * IP.Board v3.3.4
- * Login handler abstraction : AJAX UserCP functions
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
- *
- *
- * @author $Author: bfarber $
- * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.invisionpower.com/company/standards.php#license
- * @package IP.Board
- * @subpackage Core
- * @link http://www.invisionpower.com
- * @since Tuesday 1st March 2005 (11:52)
- * @version $Revision: 10914 $
- *
- */
-
-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
- *
- * @param object Registry reference
- * @return @e void [Outputs to screen]
- */
- public function doExecute( ipsRegistry $registry )
- {
- switch( $this->request['do'] )
- {
- case 'displayNameCheck':
- $this->displayNameCheck();
- break;
- }
- }
-
- /**
- * Checks a display name
- *
- * @return @e void [Outputs JSON to browser AJAX call]
- */
- protected function displayNameCheck()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $name = 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.4.5
+ * Login handler abstraction : AJAX UserCP functions
+ * Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/company/standards.php#license
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since Tuesday 1st March 2005 (11:52)
+ * @version $Revision: 10721 $
+ *
+ */
+
+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
+ *
+ * @param object Registry reference
+ * @return @e void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ switch( $this->request['do'] )
+ {
+ case 'displayNameCheck':
+ $this->displayNameCheck();
+ break;
+ }
+ }
+
+ /**
+ * Checks a display name
+ *
+ * @return @e void [Outputs JSON to browser AJAX call]
+ */
+ protected 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/attach/attach.php b/upload/admin/applications/core/modules_public/attach/attach.php
index de186292..b9b97c3a 100644
--- a/upload/admin/applications/core/modules_public/attach/attach.php
+++ b/upload/admin/applications/core/modules_public/attach/attach.php
@@ -2,18 +2,18 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Attachment Poster
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2012-08-22 05:05:53 -0400 (Wed, 22 Aug 2012) $
*
*
- * @author $Author: bfarber $
+ * @author $Author: mmecham $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Core
* @link http://www.invisionpower.com
- * @version $Rev: 10914 $
+ * @version $Rev: 11245 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -24,20 +24,6 @@ if ( ! defined( 'IN_IPB' ) )
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
*
@@ -46,298 +32,10 @@ class public_core_attach_attach extends ipsCommand
*/
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 );
+ /* Attachment Controller Class */
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/controller.php', 'classes_attach_controller' );
+ $controller = 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 @e 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 @e 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 @e 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 @e 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 */
- $result = IPSText::jsonEncodeForTemplate( $JSON );
-
- 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 @e 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 @e 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 ) );
+ $controller->run( $this->request['do'] );
}
}
\ 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 b1ad5ef3..0c3b828d 100644
--- a/upload/admin/applications/core/modules_public/attach/defaultSection.php
+++ b/upload/admin/applications/core/modules_public/attach/defaultSection.php
@@ -7,7 +7,7 @@
* $Author: ips_terabyte $
* @since 20th February 2002
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
- * @version v3.3.4
+ * @version v3.4.5
* $Revision: 8655 $
*/
diff --git a/upload/admin/applications/core/modules_public/global/captcha.php b/upload/admin/applications/core/modules_public/global/captcha.php
index 4596c8c2..f0ae99a1 100644
--- a/upload/admin/applications/core/modules_public/global/captcha.php
+++ b/upload/admin/applications/core/modules_public/global/captcha.php
@@ -2,9 +2,9 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Captcha
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
*
*
* @author $Author $
@@ -14,7 +14,7 @@
* @subpackage Core
* @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 10914 $
+ * @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
diff --git a/upload/admin/applications/core/modules_public/global/comments.php b/upload/admin/applications/core/modules_public/global/comments.php
index 3506131a..7facec79 100644
--- a/upload/admin/applications/core/modules_public/global/comments.php
+++ b/upload/admin/applications/core/modules_public/global/comments.php
@@ -2,17 +2,17 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Image Ajax
- * Last Updated: $LastChangedDate: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $LastChangedDate: 2012-10-03 17:32:06 -0400 (Wed, 03 Oct 2012) $
*
*
- * @author $Author: bfarber $
+ * @author $Author: AndyMillne $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Gallery
* @link http://www.invisionpower.com
- * @version $Rev: 10914 $
+ * @version $Rev: 11410 $
*
*/
@@ -117,7 +117,14 @@ class public_core_global_comments extends ipsCommand
/* Init */
$parentId = intval( $this->request['parentId'] );
- $this->_comments->redirectToComment( 'last', $parentId );
+ try
+ {
+ $this->_comments->redirectToComment( 'last', $parentId );
+ }
+ catch ( Exception $error )
+ {
+ $this->registry->getClass('output')->showError( 'no_permission', '1-global-comments-_findlast', null, null, 403 );
+ }
}
/**
@@ -136,7 +143,14 @@ class public_core_global_comments extends ipsCommand
$this->registry->output->showError( 'nocomment_found', '1-global-comments-find' );
}
- $this->_comments->redirectToComment( $comment_id, $parentId );
+ try
+ {
+ $this->_comments->redirectToComment( $comment_id, $parentId );
+ }
+ catch ( Exception $error )
+ {
+ $this->registry->getClass('output')->showError( 'no_permission', '1-global-comments-_find', 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 3066d827..47e7c4c6 100644
--- a/upload/admin/applications/core/modules_public/global/defaultSection.php
+++ b/upload/admin/applications/core/modules_public/global/defaultSection.php
@@ -7,7 +7,7 @@
* $Author: ips_terabyte $
* @since 20th February 2002
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
- * @version v3.3.4
+ * @version v3.4.5
* $Revision: 8655 $
*/
diff --git a/upload/admin/applications/core/modules_public/global/like.php b/upload/admin/applications/core/modules_public/global/like.php
index 88a5c706..08740aee 100644
--- a/upload/admin/applications/core/modules_public/global/like.php
+++ b/upload/admin/applications/core/modules_public/global/like.php
@@ -4,11 +4,11 @@
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
- * $Author: bfarber $
+ * $Author: AndyMillne $
* @since -
- * $LastChangedDate: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
- * @version v3.3.4
- * $Revision: 10914 $
+ * $LastChangedDate: 2013-02-06 16:33:34 -0500 (Wed, 06 Feb 2013) $
+ * @version v3.4.5
+ * $Revision: 11947 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -127,12 +127,12 @@ class public_core_global_like extends ipsCommand
if ( ( $memberId != $likeMemberId ) || ( $memberId != $this->memberData['member_id'] ) )
{
- $this->registry->output->showError( 'no_permission', 'pcgl-2' );
+ $this->registry->output->showError( 'no_unfollow', 'pcgl-2' );
}
if ( $email != $this->memberData['email'] )
{
- $this->registry->output->showError( 'no_permission', 'pcgl-3' );
+ $this->registry->output->showError( 'no_unfollow', 'pcgl-3' );
}
/* Think we're safe... */
diff --git a/upload/admin/applications/core/modules_public/global/login.php b/upload/admin/applications/core/modules_public/global/login.php
index ef40a9ad..420ba5e2 100644
--- a/upload/admin/applications/core/modules_public/global/login.php
+++ b/upload/admin/applications/core/modules_public/global/login.php
@@ -1,525 +1,558 @@
-
- * Invision Power Services
- * IP.Board v3.3.4
- * Login handler abstraction
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
- *
- *
- * @author $Author: bfarber $
- * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.invisionpower.com/company/standards.php#license
- * @package IP.Board
- * @subpackage Core
- * @link http://www.invisionpower.com
- * @since Tuesday 1st March 2005 (11:52)
- * @version $Revision: 10914 $
- *
- */
-
-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
- *
- * @var object
- */
- protected $han_login;
-
- /**
- * Facebook connect class
- *
- * @var object
- */
- protected $_facebook;
-
- /**
- * Initiate login handler
- *
- * @return @e 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
- *
- * @param object Registry reference
- * @return @e 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] );
- }
- 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] );
- }
- 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
- *
- * @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
- *
- * @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');
-
- return true;
- }
-
- /**
- * Show the login form
- *
- * @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
- {
- /* @link http://community.invisionpower.com/tracker/issue-32302-login-redirect-when-activating */
- $_urlPieces = @parse_url($this->settings['board_url']);
-
- if( strpos( my_getenv('HTTP_REFERER'), $_urlPieces['host'] ? $_urlPieces['host'] : $this->settings['board_url'] ) !== false )
- {
- $http_referrer = my_getenv('HTTP_REFERER');
- }
- else
- {
- $http_referrer = '';
- }
- }
-
- $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 );
- }
-
-
- $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
- *
- * @return mixed array [0=Words to show, 1=URL to send to, 2=error array]
- */
- public function doLogin()
- {
- if( !defined('IGNORE_AUTH_KEY') OR !IGNORE_AUTH_KEY )
- {
- 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
- *
- * @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" );
-
- 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();
-
- $privacy = intval( IPSMember::isLoggedInAnon($this->memberData) );
-
- IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'login_anonymous' => "{$privacy}&0", 'last_activity' => IPS_UNIX_TIME_NOW ) ) );
-
- //-----------------------------------------
- // 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'] );
- }
+
+ * Invision Power Services
+ * IP.Board v3.4.5
+ * Login handler abstraction
+ * Last Updated: $Date: 2013-05-23 12:11:14 -0400 (Thu, 23 May 2013) $
+ *
+ *
+ * @author $Author: bfarber $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/company/standards.php#license
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since Tuesday 1st March 2005 (11:52)
+ * @version $Revision: 12268 $
+ *
+ */
+
+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
+ *
+ * @var object
+ */
+ protected $han_login;
+
+ /**
+ * Facebook connect class
+ *
+ * @var object
+ */
+ protected $_facebook;
+
+ /**
+ * Initiate login handler
+ *
+ * @return @e 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
+ *
+ * @param object Registry reference
+ * @return @e 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] );
+ }
+ 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] );
+ }
+ 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
+ *
+ * @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
+ *
+ * @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');
+
+ return true;
+ }
+
+ /**
+ * Show the login form
+ *
+ * @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;
+ case 'vkontakte':
+ $this->registry->getClass('output')->silentRedirect( $this->settings['_original_base_url'] . "/interface/vkontakte/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
+ {
+ if( is_array($additionalForm[1]) )
+ {
+ foreach( $additionalForm[1] as $_form )
+ {
+ $template .= $_form;
+ }
+ }
+ else
+ {
+ $template .= $additionalForm[1];
+ }
+ $show_form = 0;
+ }
+ }
+
+ //-----------------------------------------
+ // Continue...
+ //-----------------------------------------
+
+ if ( $show_form )
+ {
+ if( $this->request['referer'] )
+ {
+ $http_referrer = $this->request['referer'];
+ }
+ else
+ {
+ /* @link http://community.invisionpower.com/tracker/issue-32302-login-redirect-when-activating */
+ $_urlPieces = @parse_url($this->settings['board_url']);
+
+ if( strpos( my_getenv('HTTP_REFERER'), $_urlPieces['host'] ? $_urlPieces['host'] : $this->settings['board_url'] ) !== false )
+ {
+ $http_referrer = my_getenv('HTTP_REFERER');
+ }
+ else
+ {
+ $http_referrer = '';
+ }
+ }
+
+ $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 );
+ }
+
+
+ $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
+ *
+ * @return mixed array [0=Words to show, 1=URL to send to, 2=error array]
+ */
+ public function doLogin()
+ {
+ if( !defined('IGNORE_AUTH_KEY') OR !IGNORE_AUTH_KEY )
+ {
+ 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
+ *
+ * @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", 1, 0, FALSE, TRUE );
+ IPSCookie::set( "pass_hash" , "0", 1, 0, FALSE, TRUE );
+
+ if( IPSCookie::get( "ipsconnect_" . md5( $this->settings['board_url'] . '/interface/ipsconnect/ipsconnect.php' ) ) )
+ {
+ IPSCookie::set( "ipsconnect_" . md5( $this->settings['board_url'] . '/interface/ipsconnect/ipsconnect.php' ), '0', 1, 0, FALSE, FALSE );
+ }
+
+ //-----------------------------------------
+ // IPS Connect
+ //-----------------------------------------
+
+ foreach ( $this->caches['login_methods'] as $k => $data )
+ {
+ if ( $data['login_folder_name'] == 'ipsconnect' and $data['login_enabled'] )
+ {
+ $ipsConnectSettings = unserialize( $data['login_custom_config'] );
+
+ IPSCookie::set( "ipsconnect_" . md5( $ipsConnectSettings['master_url'] ), '0', 1, 0, FALSE, FALSE );
+ }
+ }
+
+
+ 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();
+
+ $privacy = intval( IPSMember::isLoggedInAnon($this->memberData) );
+
+ IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'login_anonymous' => "{$privacy}&0", 'last_activity' => IPS_UNIX_TIME_NOW ) ) );
+
+ //-----------------------------------------
+ // Logout callbacks...
+ //-----------------------------------------
+
+ IPSLib::runMemberSync( 'onLogOut', $this->memberData );
+
+ $this->han_login->logoutCallback( $this->memberData );
+
+ //-----------------------------------------
+ // 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['board_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 6c246d26..478dea0b 100644
--- a/upload/admin/applications/core/modules_public/global/lostpass.php
+++ b/upload/admin/applications/core/modules_public/global/lostpass.php
@@ -1,499 +1,484 @@
-
- * Invision Power Services
- * IP.Board v3.3.4
- * Recover Lost Password
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
- *
- *
- * @author $Author $
- * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.invisionpower.com/company/standards.php#license
- * @package IP.Board
- * @subpackage Core
- * @link http://www.invisionpower.com
- * @since 20th February 2002
- * @version $Rev: 10914 $
- *
- */
-
-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
- *
- * @param object Registry reference
- * @return @e 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
- *
- * @return @e 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 = IPSMember::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 ) );
-
- /* Password has been changed! */
- IPSLib::runMemberSync( 'onPassChange', $member['member_id'], $new_pass );
-
- //-----------------------------------------
- // Send out the email...
- //-----------------------------------------
-
- IPSText::getTextClass('email')->getTemplate( "lost_pass_email_pass", $member['language'] );
-
- IPSText::getTextClass('email')->buildMessage( array(
- 'NAME' => $member['members_display_name'],
- 'THE_LINK' => $this->registry->getClass('output')->buildUrl( 'app=core&module=usercp&tab=core&area=email', 'publicNoSession' ),
- 'PASSWORD' => $new_pass,
- 'LOGIN' => $this->registry->getClass('output')->buildUrl( 'app=core&module=global§ion=login', 'publicNoSession' ),
- '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'], $new_pass, $pass_a, $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 ) );
-
- /* Password has been changed! */
- IPSLib::runMemberSync( 'onPassChange', $member['member_id'], $pass_a );
-
- /* 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->registry->getClass('output')->buildUrl( 'app=core&module=global§ion=login&do=autologin&frompass=1' ) );
- }
- }
- }
-
- /**
- * Completes the lost password request form
- *
- * @return @e 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( strtolower( $this->request['member_name'] ) );
- $email_addy = trim( 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( IPSMember::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', $member['language'] );
-
- IPSText::getTextClass('email')->buildMessage( array(
- 'USERNAME' => $member['name'],
- 'NAME' => $member['members_display_name'],
- 'THE_LINK' => $this->registry->getClass('output')->buildUrl( "app=core&module=global§ion=lostpass&do=sendform&uid={$member['member_id']}&aid={$validate_key}", 'publicNoSession' ),
- 'MAN_LINK' => $this->registry->getClass('output')->buildUrl( 'app=core&module=global§ion=lostpass&do=sendform', 'publicNoSession' ),
- '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
- *
- * @param string $errors
- * @return @e 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
- *
- * @param string $msg
- * @return @e 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'], '' );
- }
+
+ * Invision Power Services
+ * IP.Board v3.4.5
+ * Recover Lost Password
+ * Last Updated: $Date: 2012-11-28 04:54:58 -0500 (Wed, 28 Nov 2012) $
+ *
+ *
+ * @author $Author $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/company/standards.php#license
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 20th February 2002
+ * @version $Rev: 11651 $
+ *
+ */
+
+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
+ *
+ * @param object Registry reference
+ * @return @e 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
+ *
+ * @return @e 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 );
+ }
+
+ /* Send a new random password? */
+ if( $this->settings['lp_method'] == 'random' )
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $save_array = array();
+
+ //-----------------------------------------
+ // Generate a new random password
+ //-----------------------------------------
+
+ $new_pass = IPSMember::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 ) );
+
+ /* Password has been changed! */
+ IPSLib::runMemberSync( 'onPassChange', $member['member_id'], $new_pass );
+
+ //-----------------------------------------
+ // Send out the email...
+ //-----------------------------------------
+
+ $message = array( 'NAME' => $member['members_display_name'],
+ 'THE_LINK' => $this->registry->getClass('output')->buildSEOUrl( 'app=core&module=usercp&tab=core&area=email', 'publicNoSession', 'flase' ),
+ 'PASSWORD' => $new_pass,
+ 'LOGIN' => $this->registry->getClass('output')->buildSEOUrl( 'app=core&module=global§ion=login', 'publicNoSession', 'false' ),
+ 'USERNAME' => $member['name'],
+ 'EMAIL' => $member['email'],
+ 'ID' => $member['member_id'] );
+
+ IPSText::getTextClass('email')->setPlainTextTemplate( IPSText::getTextClass('email')->getTemplate( "lost_pass_email_pass", $member['language'] ) );
+ IPSText::getTextClass('email')->buildPlainTextContent( $message );
+ IPSText::getTextClass('email')->buildHtmlContent( $message );
+
+ 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'] );
+
+ /*
+ There's no reason for this - http://community.invisionpower.com/resources/bugs.html/_/ip-board/registrations-limit-passwords-to-32-characters-for-no-apparent-reason-r37770
+ 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'], $new_pass, $pass_a, $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 ) );
+
+ /* Password has been changed! */
+ IPSLib::runMemberSync( 'onPassChange', $member['member_id'], $pass_a );
+
+ /* 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->registry->getClass('output')->buildSEOUrl( 'app=core&module=global§ion=login&do=autologin&frompass=1' ) );
+ }
+ }
+ }
+
+ /**
+ * Completes the lost password request form
+ *
+ * @return @e 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( 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( IPSMember::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. */
+ $message = array( 'USERNAME' => $member['name'],
+ 'NAME' => $member['members_display_name'],
+ 'THE_LINK' => $this->registry->getClass('output')->buildSEOUrl( "app=core&module=global§ion=lostpass&do=sendform&uid={$member['member_id']}&aid={$validate_key}", 'publicNoSession', 'false' ),
+ 'MAN_LINK' => $this->registry->getClass('output')->buildSEOUrl( 'app=core&module=global§ion=lostpass&do=sendform', 'publicNoSession', 'false' ),
+ 'EMAIL' => $member['email'],
+ 'ID' => $member['member_id'],
+ 'CODE' => $validate_key,
+ 'IP_ADDRESS' => $this->member->ip_address );
+
+ IPSText::getTextClass('email')->setPlainTextTemplate( IPSText::getTextClass('email')->getTemplate( "lost_pass", $member['language'] ) );
+ IPSText::getTextClass('email')->buildPlainTextContent( $message );
+ IPSText::getTextClass('email')->buildHtmlContent( $message );
+
+ 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
+ *
+ * @param string $errors
+ * @return @e 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
+ *
+ * @param string $msg
+ * @return @e 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 );
+ }
+
+ $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/meta.php b/upload/admin/applications/core/modules_public/global/meta.php
new file mode 100644
index 00000000..61e908f4
--- /dev/null
+++ b/upload/admin/applications/core/modules_public/global/meta.php
@@ -0,0 +1,125 @@
+Incorrect accessYou cannot access this file directly.";
+ exit();
+}
+
+class public_core_global_meta extends ipsCommand
+{
+
+ /**
+ * Main class entry point
+ *
+ * @access public
+ * @param object ipsRegistry reference
+ * @return @e void [Outputs to screen]
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ if ( $this->request['do'] != 'end' )
+ {
+ /* Are we a logged in admin? */
+ if ( empty($this->memberData['member_id']) || empty($this->memberData['g_access_cp']) )
+ {
+ $this->registry->output->showError( 'meta_editor_no_admin', 'IPSEO-META-ADMIN' );
+ }
+
+ /* Permission Check */
+ require_once IPS_ROOT_PATH . 'sources/classes/class_permissions.php';
+ $class_permissions = new class_permissions( $this->registry );
+ $class_permissions->checkPermissionAutoMsg( 'settemplates_meta', 'core', 'templates' );
+ }
+
+ switch ( $this->request['do'] )
+ {
+ case 'init':
+ $this->init();
+ break;
+
+ case 'save':
+ $this->save();
+ break;
+
+ case 'end':
+ $this->end();
+ break;
+ }
+ }
+
+ /**
+ * Activates the live meta editor
+ *
+ * @return @e void
+ */
+ public function init()
+ {
+ /* Enable live meta editor and redirect */
+ IPSMember::packMemberCache( $this->memberData['member_id'], array( 'ipseo_live_meta_edit' => 1 ) );
+
+ $this->registry->output->silentRedirect( $this->settings['base_url'] );
+ }
+
+ /**
+ * Saves the meta tags for the page
+ *
+ * @return @e void
+ */
+ public function save()
+ {
+ //-----------------------------------------
+ // Save em
+ //-----------------------------------------
+
+ /* Delete any DB entries for this page as we're about to rebuild them */
+ $escapedPage = $this->DB->addSlashes( $this->request['url'] );
+ $this->DB->delete( 'seo_meta', "url='{$escapedPage}'" );
+
+ /* Insert Tags */
+ foreach( $this->request['meta-tags-title'] as $k => $v )
+ {
+ if ( $v )
+ {
+ $cache[ $this->request['url'] ][ $v ] = $this->request['meta-tags-content'][ $k ];
+ $this->DB->insert('seo_meta', array(
+ 'url' => $this->request['url'],
+ 'name' => $v,
+ 'content' => $this->request['meta-tags-content'][ $k ]
+ ) );
+ }
+ }
+
+ /* Rebuild Cache */
+ ips_CacheRegistry::instance()->rebuildCache( 'meta_tags' );
+
+ /* Boink */
+ $this->registry->output->silentRedirect( ipsRegistry::$settings['base_url'] . $this->request['url'] );
+
+ }
+
+ /**
+ * Disables the live meta editor
+ *
+ * @return @e void
+ */
+ public function end()
+ {
+ IPSMember::packMemberCache( $this->memberData['member_id'], array( 'ipseo_live_meta_edit' => 0 ) );
+
+ $this->registry->output->silentRedirect( ipsRegistry::$settings['base_url'] . $this->request['url'] );
+ }
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/global/navigation.php b/upload/admin/applications/core/modules_public/global/navigation.php
index 1c2606b1..c1ccf77b 100644
--- a/upload/admin/applications/core/modules_public/global/navigation.php
+++ b/upload/admin/applications/core/modules_public/global/navigation.php
@@ -2,9 +2,9 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Captcha
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2013-04-16 15:13:53 -0400 (Tue, 16 Apr 2013) $
*
*
* @author $Author $
@@ -14,7 +14,7 @@
* @subpackage Core
* @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 10914 $
+ * @version $Rev: 12182 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -34,7 +34,13 @@ class public_core_global_navigation extends ipsCommand
public function doExecute( ipsRegistry $registry )
{
/* Set up */
- $inapp = trim( $this->request['inapp'] );
+
+ $inapp = is_string( $this->request['inapp'] ) ? trim( $this->request['inapp'] ) : "";
+
+ if ( !$inapp )
+ {
+ $this->registry->output->showError( 'invalid_app', 1040007, null, null, 500 );
+ }
/* Load navigation stuff */
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/navigation/build.php', 'classes_navigation_build' );
@@ -43,7 +49,7 @@ class public_core_global_navigation extends ipsCommand
/* Return */
$html = $this->registry->output->getTemplate( 'global_other' )->quickNavigationWrapper( $navigation->loadApplicationTabs(), $navigation->loadNavigationData(), $inapp );
- $this->registry->getClass('output')->setTitle( $this->lang->words['navigation_title'] );
+ $this->registry->getClass('output')->setTitle( $this->lang->words['navigation_title'] . ' - ' . IPSLib::getAppTitle( $inapp ) );
$this->registry->getClass('output')->addContent( $html );
$this->registry->getClass('output')->sendOutput();
}
diff --git a/upload/admin/applications/core/modules_public/global/privacy.php b/upload/admin/applications/core/modules_public/global/privacy.php
index 71055332..845e8d81 100644
--- a/upload/admin/applications/core/modules_public/global/privacy.php
+++ b/upload/admin/applications/core/modules_public/global/privacy.php
@@ -3,7 +3,7 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Show forum rules
* Last Updated: $Date: 2011-05-05 12:03:47 +0100 (Thu, 05 May 2011) $
*
diff --git a/upload/admin/applications/core/modules_public/global/register.php b/upload/admin/applications/core/modules_public/global/register.php
index ab9c0431..bc1672a7 100644
--- a/upload/admin/applications/core/modules_public/global/register.php
+++ b/upload/admin/applications/core/modules_public/global/register.php
@@ -1,2086 +1,2115 @@
-
- * Invision Power Services
- * IP.Board v3.3.4
- * Register
- * Last Updated: $Date: 2012-06-22 07:58:19 -0400 (Fri, 22 Jun 2012) $
- *
- *
- * @author $Author $
- * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.invisionpower.com/company/standards.php#license
- * @package IP.Board
- * @subpackage Core
- * @link http://www.invisionpower.com
- * @since 20th February 2002
- * @version $Rev: 10970 $
- *
- */
-
-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
- *
- * @param object Registry reference
- * @return @e 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'] )
- {
- default:
- case 'form':
- if( $this->settings['no_reg'] > 0 )
- {
- $this->registry->output->showError( 'registration_disabled', 10123, FALSE, '', 200 );
- }
-
- $this->registerForm();
- break;
-
- case 'process_form':
- if( $this->settings['no_reg'] > 0 )
- {
- $this->registry->output->showError( 'registration_disabled', 2016, true );
- }
-
- $this->registerProcessForm();
- break;
-
- case 'auto_validate':
- $this->_autoValidate();
- break;
-
- case 'coppa_two':
- $this->registerCoppaTwo();
- break;
-
- case '12':
- $this->registerCoppaPermsForm();
- break;
-
- //-----------------------------------------
- // Validation (i.e. registration, pw change, etc.)
- //-----------------------------------------
-
- case '05':
- $this->_showManualForm();
- break;
-
- case '07':
- $this->_showManualForm('newemail');
- break;
-
- case 'reval':
- $this->_revalidateForm();
- break;
-
- case 'reval2':
- $this->_revalidateComplete();
- break;
-
- //-----------------------------------------
- // Complete a partial login
- //-----------------------------------------
-
- case 'complete_login':
- $this->_completeRegistration();
- break;
- case 'complete_login_do':
- $this->_completeRegistrationSave();
- break;
- }
-
- /* Output */
- $this->registry->output->addContent( $this->output );
- $this->registry->output->sendOutput();
- }
-
- /**
- * Reset a member if they are logged in
- *
- * @return @e void
- */
- protected function _resetMember()
- {
- 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" );
-
- 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();
-
- $privacy = intval( IPSMember::isLoggedInAnon($this->memberData) );
-
- IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'login_anonymous' => "{$privacy}&0", 'last_activity' => IPS_UNIX_TIME_NOW ) ) );
- }
- }
-
- /**
- * Displays the registration form
- *
- * @param array $form_errors
- * @return @e void
- */
- public function registerForm( $form_errors=array() )
- {
- //-----------------------------------------
- // Init
- //-----------------------------------------
-
- $final_errors = array();
- $coppa = IPSCookie::get( 'coppa' );
- $step = $this->request['step'] ? intval($this->request['step']) : 1;
-
- $this->settings['username_errormsg'] = str_replace( '{chars}', $this->settings['username_characters'], $this->settings['username_errormsg'] );
-
- if( $coppa == 'yes' )
- {
- $this->registry->output->showError( 'awaiting_coppa', 10124 );
- }
-
- $this->_resetMember();
-
- //-----------------------------------------
- // COPPA swapout
- //-----------------------------------------
-
- if( $this->settings['use_coppa'] )
- {
- $this->lang->words['confirm_over_thirteen'] = str_replace( "<#FORM_LINK#>", "{$this->settings['base_url']}app=core&module=global§ion=register&do=12", $this->lang->words['confirm_over_thirteen'] );
- }
-
- //-----------------------------------------
- // T & C
- //-----------------------------------------
-
- $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'];
-
- IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
- IPSText::getTextClass( 'bbcode' )->parse_html = 1;
- IPSText::getTextClass( 'bbcode' )->parse_nl2br = 1;
- IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
- IPSText::getTextClass( 'bbcode' )->parsing_section = 'global';
-
- $this->settings['_termsAndConditions'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $text );
-
- //-----------------------------------------
- // Page title / navigation
- //-----------------------------------------
-
- $this->registry->output->setTitle( $this->lang->words['registration_form'] . ' - ' . ipsRegistry::$settings['board_name'] );
- $this->registry->output->addNavigation( $this->lang->words['registration_form'], '' );
-
- //-----------------------------------------
- // If Nexus is installed, that is the first step
- //-----------------------------------------
-
- if( IPSLib::appIsInstalled('nexus') AND $this->settings['nexus_reg_show'] AND $this->settings['nexus_store_online'] )
- {
- //-----------------------------------------
- // We just submitted the form
- //-----------------------------------------
-
- if( $this->request['nexus_pass'] )
- {
- $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'nexus' ) . '/sources/hooks.php', 'nexusHooks', 'nexus' );
- $hookGateway = new $classToLoad( $this->registry );
-
- //-----------------------------------------
- // Check for errors
- //-----------------------------------------
-
- if ( $this->settings['nexus_reg_force'] and !IPSCookie::get( 'cm_reg' ) and empty( $this->request['cm_package'] ) )
- {
- $nexusError = $this->lang->words['forceby_no_sel'];
- }
-
- }
-
- //-----------------------------------------
- // If no errors, create invoice and set cookie
- //-----------------------------------------
-
- if ( !$nexusError and $this->request['nexus_pass'] )
- {
- //-----------------------------------------
- // Did we buy a package?
- //-----------------------------------------
-
- $chosenPackages = ipsRegistry::$request['cm_package'];
-
- if ( !empty( $chosenPackages ) )
- {
- // Get our package data
- $imploded = implode( ',', ipsRegistry::$request['cm_package'] );
- $packages = array();
- ipsRegistry::DB()->build( array( 'select' => '*', 'from' => 'nexus_packages', 'where' => "p_id IN({$imploded})" ) );
- ipsRegistry::DB()->execute();
- while ( $row = ipsRegistry::DB()->fetch() )
- {
- $packages[ $row['p_id'] ] = $row;
- }
-
- // Bundle 'em all up
- foreach ( $chosenPackages as $itemID )
- {
- // Add title to the array
- $titles[] = $packages[ $itemID ]['p_name'];
-
- // Process information
- $shippingData = package::load( $itemID )->shippingData();
- $renewOptions = $packages[ $itemID ]['p_renew_options'] ? unserialize( $packages[ $itemID ]['p_renew_options'] ) : array();
- $renewTerm = empty( $renewOptions ) ? array( 'term' => 0, 'unit' => '', 'price' => 0 ) : array_shift( $renewOptions );
- $items[] = array(
- 'act' => 'new',
- 'app' => 'nexus',
- 'type' => $packages[ $itemID ]['p_type'],
- 'cost' => $packages[ $itemID ]['p_base_price'],
- 'renew_term' => $renewTerm['term'],
- 'renew_units' => $renewTerm['unit'],
- 'renew_cost' => $renewTerm['price'],
- 'itemName' => $packages[ $itemID ]['p_name'],
- 'itemID' => $itemID,
- 'physical' => is_null( $shippingData ) ? FALSE : TRUE,
- 'shipping' => is_null( $shippingData ) ? array() : $shippingData['shipping'],
- 'weight' => is_null( $shippingData ) ? 0 : $shippingData['weight'],
- );
- }
-
- // What are we calling this invoice?
- if ( count( $titles ) == 1 )
- {
- $title = $titles[0];
- }
- else
- {
- $title = implode( ', ', $titles );
- if ( strlen( $title ) > 50 )
- {
- array_pop( $titles );
- $title = implode( ', ', $titles );
- while ( strlen( $title ) > 47 and count( $titles ) > 1 )
- {
- array_pop( $titles );
- $title = implode( ', ', $titles );
- }
- $title .= '...';
- }
- }
-
- // Generate it
- require_once( IPSLib::getAppDir('nexus') . '/sources/nexusApi.php' );/*noLibHook*/
- $invoiceID = nexusApi::generateInvoice( $title, $this->memberData['member_id'], $items );
-
- IPSCookie::set( 'cm_reg', $invoiceID );
- }
- }
- else
- {
- //-----------------------------------------
- // "step 1" if Nexus is set to show packages on registration
- //-----------------------------------------
-
- require_once( IPSLib::getAppDir('nexus') . '/sources/packageCore.php' );/*noLibHook*/
-
- $packages = array();
- $this->DB->build( array( 'select' => '*', 'from' => 'nexus_packages', 'where' => 'p_reg=1', 'order' => 'p_position' ) );
- $e = $this->DB->execute();
- while ( $row = $this->DB->fetch( $e ) )
- {
- $packages[ $row['p_id'] ] = package::load( $row['p_id'] )->buildDisplayData();
- }
-
- if ( !empty( $packages ) )
- {
- if ( isset( $this->request['cm_package'] ) )
- {
- foreach ( $this->request['cm_package'] as $packageID )
- {
- $packages[ $packageID ]['checked'] = "checked='checked'";
- }
- }
- $this->output .= $this->registry->output->getTemplate('nexus_payments')->regForm32( $packages, $nexusError );
- return;
- }
- }
- }
-
- //-----------------------------------------
- // Send to an alternate registration URL?
- //-----------------------------------------
-
- $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'] );
- }
- }
-
- //-----------------------------------------
- // Adjust text as needed based on validation type
- //-----------------------------------------
-
- 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'];
- }
- }
-
- //-----------------------------------------
- // Captcha / Q&A
- //-----------------------------------------
-
- $captchaHTML = '';
- $qandaHTML = '';
-
- $question = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'question_and_answer', 'order' => $this->DB->buildRandomOrder(), 'limit' => array(1) ) );
-
- if( $question AND count($question) )
- {
- $qandaHTML = $this->registry->output->getTemplate('global_other')->questionAndAnswer( $question );
- }
-
- if( $this->settings['bot_antispam_type'] != 'none' )
- {
- $captchaHTML = $this->registry->getClass('class_captcha')->getTemplate();
- }
-
- //-----------------------------------------
- // Custom 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 ) )
- {
- 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']
- );
- }
- }
-
- //-----------------------------------------
- // If Nexus is installed, also add billing information
- //-----------------------------------------
-
- $nexusFields = array();
- $nexusStates = array();
- if( IPSLib::appIsInstalled('nexus') AND $this->settings['nexus_reg_show'] AND $this->settings['nexus_store_online'] )
- {
- ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'public_countries' ), 'nexus' );
-
- $fields = array();
- $_fields = ipsRegistry::cache()->getCache('customer_fields');
-
- if( is_array($_fields) AND count($_fields) )
- {
- foreach ( $_fields['reg'] as $k )
- {
- $nexusFields[] = $_fields['fields'][ $k ];
- }
- }
-
- $nexusStates = customer::generateStateDropdown( TRUE );
- }
-
- //-----------------------------------------
- // Got errors to show?
- //-----------------------------------------
-
- $final_errors = array( 'dname' => NULL, 'password' => NULL, 'email' => NULL, 'tos' => NULL );
-
- foreach( array( 'dname', 'password', 'email', 'tos' ) 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['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'] : '' ;
-
- //-----------------------------------------
- // Create time zone dropdown array
- //-----------------------------------------
-
- $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 );
-
- $this->request['time_offset'] = ( $this->request['time_offset'] ) ? $this->request['time_offset'] : $this->settings['time_offset'];
-
- //-----------------------------------------
- // Start output
- //-----------------------------------------
-
- $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,
- 'showCOPPA' => $this->settings['use_coppa'] AND !(IPSLib::appIsInstalled('nexus') AND $this->settings['nexus_reg_show'] AND $this->settings['nexus_store_online']),
- ),
- $final_errors,
- $time_select,
- $custom_fields_out,
- $nexusFields,
- $nexusStates );
-
- //-----------------------------------------
- // Member sync module
- //-----------------------------------------
-
- IPSLib::runMemberSync( 'onRegisterForm' );
- }
-
- /**
- * Save the data to complete the partial member record login/registration
- *
- * @return @e void [Outputs to screen/redirects]
- */
- public function _completeRegistrationSave()
- {
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $mid = intval( $this->request['mid'] );
- $key = intval( $this->request['key'] );
- $in_email = strtolower( trim($this->request['EmailAddress']) );
- $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( 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 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://' ) === FALSE && stristr( $custom_fields->out_fields[ 'field_' . $website_field ], 'https://' ) === FALSE )
- {
- $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_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 ) );
- }
-
- $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/facebook/connect.php', 'facebook_connect' );
- $facebook = new $classToLoad( $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 Twitterd? */
- 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 ) );
- }
-
- $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/twitter/connect.php', 'twitter_connect' );
- $twitter = new $classToLoad( $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'];
- }
- }
-
- /* 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=core&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'] = 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'];
- }
-
- /* Is this email banned or does it exist already? */
- if ( IPSMember::isBanned( 'email', $in_email ) || IPSMember::checkByEmail( $in_email ) || $han_login->emailExistsCheck( trim(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' => 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' => strtolower( $members_display_name )
- ) ) );
- }
-
- //-----------------------------------------
- // Delete: Partials row
- //-----------------------------------------
-
- $this->DB->delete( 'members_partial', 'partial_member_id=' . $mid );
-
- //-----------------------------------------
- // Update: Profile fields
- //-----------------------------------------
-
- $this->DB->resetDataTypes();
- $this->DB->setDataType( array_keys( $custom_fields->out_fields ), '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
- //-----------------------------------------
-
- if ( $connectService AND ! $login_user AND $this->settings['spam_service_enabled'] )
- {
- /* Load all member data */
- $member = IPSMember::load( $mid, 'all' );
-
- /* Spam Service */
- $spamCode = 0;
- $_spamFlag = 0;
-
- /* Query the service */
- $spamCode = IPSMember::querySpamService( $member['email'] );
-
- /* Action to perform */
- $action = $this->settings[ 'spam_service_action_' . $spamCode ];
-
- /* Perform Action */
- switch( $action )
- {
- /* Proceed with registration */
- case 1:
- break;
-
- /* Flag for admin approval */
- case 2:
- $member['member_group_id'] = $this->settings['auth_group'];
- $this->settings['reg_auth_type'] = 'admin';
- $_spamFlag = 1;
- break;
-
- /* Approve the account, but ban it */
- case 3:
- $member['member_banned'] = 1;
- $member['bw_is_spammer'] = 1;
- $this->settings['reg_auth_type'] = '';
- break;
- }
-
- /* Update member */
- IPSMember::save( $member['member_id'], array( 'core' => array( 'member_group_id' => $member['member_group_id'],
- 'member_banned' => intval( $member['member_banned'] ),
- 'bw_is_spammer' => intval( $member['bw_is_spammer'] ) ) ) );
-
- /* Did we put them in validating? */
- if ( $_spamFlag )
- {
- $validate_key = md5( IPSMember::makePassword() . time() );
- $time = time();
-
- $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' => 0,
- 'new_reg' => 1,
- 'ip_address' => $member['ip_address'],
- 'spam_flag' => $_spamFlag ) );
-
- $this->output = $this->registry->output->getTemplate('register')->showPreview( $member );
- return; #Goes back to doExecute which sends $this->output to output class
- }
- }
-
- /* Send out notification */
- 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 = sprintf( $this->lang->words['new_registration_email'], $this->settings['board_name'] );
- IPSText::getTextClass('email')->to = $this->settings['email_in'];
- IPSText::getTextClass('email')->sendMail();
- }
-
- /* Got admin validation enabled? */
- if ( $connectService && ! $login_user && in_array( $this->settings['reg_auth_type'], array( 'admin', 'admin_user' ) ) )
- {
- /* Make them validating */
- IPSMember::save( $member['member_id'], array( 'core' => array( 'member_group_id' => $this->settings['auth_group'] ) ) );
-
- //-----------------------------------------
- // 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['member_group'],
- 'temp_group' => $this->settings['auth_group'],
- 'entry_date' => $time,
- 'coppa_user' => 0,
- 'new_reg' => 1,
- 'ip_address' => $member['ip_address'],
- 'spam_flag' => $_spamFlag ) );
-
- $this->output = $this->registry->output->getTemplate('register')->showPreview( IPSMember::load( $member['member_id'] ) );
- }
-
- //-----------------------------------------
- // Set cookies
- //-----------------------------------------
-
- IPSCookie::set("member_id" , $mid , 1 );
- IPSCookie::set("pass_hash" , $tmp_member['member_login_key'] , 1 );
-
- //-----------------------------------------
- // Fix up session
- //-----------------------------------------
-
- $privacy = ( $this->caches['group_cache'][ $tmp_member['member_group_id'] ]['g_hide_online_list'] || ( empty($this->settings['disable_anonymous']) && ! empty($this->request['Privacy']) ) ) ? 1 : 0;
-
- $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_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 */
- $memberData = IPSMember::load( $mid );
-
- IPSLib::runMemberSync( 'onCompleteAccount', $memberData );
- IPSLib::runMemberSync( 'onLogin', $memberData );
-
- //-----------------------------------------
- // 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.
- *
- * @param array Errors
- * @return @e void [Outputs to screen/redirects]
- */
- protected 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 */
- $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/facebook/connect.php', 'facebook_connect' );
- $facebook = new $classToLoad( $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( 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 */
- $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/twitter/connect.php', 'twitter_connect' );
- $twitter = new $classToLoad( $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
- {
- /* Set defaults for any we have */
- $this->request['members_display_name'] = !empty($this->request['members_display_name']) ? $this->request['members_display_name'] : $member['members_display_name'];
- $this->request['EmailAddress'] = !empty($this->request['EmailAddress']) ? $this->request['EmailAddress'] : $member['email'];
- $this->request['EmailAddress_two'] = !empty($this->request['EmailAddress_two']) ? $this->request['EmailAddress_two'] : $member['email'];
- }
-
- /* Remote registrations disabled? */
- if ( $this->settings['no_reg'] == 2 )
- {
- /* Clean up incomplete reg */
- if ( $reg['partial_member_id'] )
- {
- IPSMember::remove( array( $reg['partial_member_id'] ) );
- }
-
- $this->registry->output->showError( 'no_remote_reg', 1090001 );
- }
-
- //-----------------------------------------
- // Custom profile fields stuff
- //-----------------------------------------
-
- $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( '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
- *
- * @param string Errors
- * @return @e void [Outputs to screen/redirects]
- */
- protected 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
- *
- * @return @e void [Outputs to screen/redirects]
- */
- protected 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
- //-----------------------------------------
-
- $val = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'validating', 'where' => "member_id=" . intval($member['member_id']) ) );
-
- if ( empty($val['vid']) )
- {
- $this->_revalidateForm('err_no_validations');
- return;
- }
-
- //-----------------------------------------
- // Which type is it then?
- //-----------------------------------------
-
- if ( $val['lost_pass'] == 1 )
- {
- IPSText::getTextClass('email')->getTemplate("lost_pass", $member['language']);
-
- 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", $member['language'] );
-
- 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 = sprintf( $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 = sprintf( $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.
- *
- * @param string Type of validation
- * @param string Error messages
- * @return @e void [Outputs to screen/redirects]
- */
- protected 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
- *
- * @return @e void
- */
- protected 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.
- *
- * @return @e void
- */
- protected function registerCoppaTwo()
- {
- if( $this->request['coppa'] == 1 )
- {
- IPSCookie::set( 'coppa', 'no', 0, 1 );
- $this->registerForm();
- return;
- }
-
- IPSCookie::set( 'coppa', 'yes', 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'], '' );
- }
-
- /**
- * 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.
- *
- * @return @e void
- */
- protected 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_flag']) )
- {
- $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( $member['member_group_id'] == $this->settings['auth_group'] )
- {
- if ( ! $validate['real_group'] )
- {
- $validate['real_group'] = $this->settings['member_group'];
- }
- else if( !isset( $this->caches['group_cache'][ $validate['real_group'] ] ) )
- {
- $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' )
- {
- if( $member['member_group_id'] == $this->settings['auth_group'] )
- {
- 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'] . "'" );
-
- IPSLib::runMemberSync( 'onCompleteAccount', $member );
-
- $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 = IPSMember::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", $member['language']);
-
- IPSText::getTextClass('email')->buildMessage( array(
- 'NAME' => $member['members_display_name'],
- 'THE_LINK' => $this->settings['base_url'] . 'app=core&module=usercp&tab=core&area=email',
- '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( !isset( $this->caches['group_cache'][ $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' );
- }
- }
-
- /**
- * Processes the registration form
- *
- * @return @e void
- */
- public function registerProcessForm()
- {
- $this->_resetMember();
-
- $form_errors = array();
- $coppa = ( $this->request['coppa_user'] == 1 ) ? 1 : 0;
- $in_password = trim( $this->request['PassWord'] );
- $in_email = strtolower( trim( $this->request['EmailAddress'] ) );
-
- /* Did we agree to the t&c? */
- if( ! $this->request['agree_tos'] )
- {
- $form_errors['tos'] = array( $this->lang->words['must_agree_to_terms'] );
- }
-
- /* 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( $_POST, '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'];
- }
- elseif ( strlen( $in_password ) < 3 )
- {
- $form_errors['password'][$this->lang->words['pass_too_short']] = $this->lang->words['pass_too_short'];
- }
- elseif ( strlen( $in_password ) > 32 )
- {
- $form_errors['password'][$this->lang->words['pass_too_long']] = $this->lang->words['pass_too_long'];
- }
-
- /* Check the username */
- $user_check = IPSMember::getFunction()->cleanAndCheckName( $this->request['members_display_name'], 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['dname'][ $error ] = isset($this->lang->words[ $error ]) ? $this->lang->words[ $error ] : $error;
- }
- }
-
- /* this duplicates username error above */
- /*if( is_array( $disp_check['errors'] ) && count( $disp_check['errors'] ) )
- {
- foreach( $disp_check['errors'] as $key => $error )
- {
- $form_errors['dname'][ $error ] = 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 */
- $qanda = intval($this->request['qanda_id']);
- $pass = true;
-
- if( $qanda )
- {
- $pass = false;
- $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 )
- {
- $answer = trim($answer);
-
- if( strlen($answer) AND strtolower($answer) == 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 = false;
- }
- }
-
- 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['members_display_name'],
- 'password' => $in_password,
- 'members_display_name' => $this->request['members_display_name'],
- '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->settings['time_dst_auto_correction']),
- 'allow_admin_mails' => intval( $this->request['allow_admin_mail'] ),
- 'language' => $this->member->language_id,
- );
-
- /* Spam Service */
- $spamCode = 0;
- $_spamFlag = 0;
-
- if( $this->settings['spam_service_enabled'] )
- {
- /* Query the service */
- $spamCode = IPSMember::querySpamService( $in_email );
-
- /* Action to perform */
- $action = $this->settings[ 'spam_service_action_' . $spamCode ];
-
- /* Perform Action */
- switch( $action )
- {
- /* Proceed with registration */
- case 1:
- break;
-
- /* Flag for admin approval */
- case 2:
- $member['member_group_id'] = $this->settings['auth_group'];
- $this->settings['reg_auth_type'] = 'admin';
- $_spamFlag = 1;
- break;
-
- /* Approve the account, but ban it */
- case 3:
- $member['member_banned'] = 1;
- $member['bw_is_spammer'] = 1;
- $this->settings['reg_auth_type'] = '';
- break;
- }
- }
-
- //-----------------------------------------
- // Create the account
- //-----------------------------------------
-
- $member = IPSMember::create( array( 'members' => $member, 'pfields_content' => $custom_fields->out_fields ), 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( IPSMember::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['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 = sprintf( $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 );
- }
-
- /* Only send new registration email if the member wasn't banned */
- if( $this->settings['new_reg_notify'] AND ! $member['member_banned'] )
- {
- $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 = sprintf( $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->cache->getCache('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 ) );
-
- /* Only send new registration email if the member wasn't banned */
- if( $this->settings['new_reg_notify'] AND ! $member['member_banned'] )
- {
- $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 = sprintf( $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 = ( $member['g_hide_online_list'] || ( empty($this->settings['disable_anonymous']) && ! empty($this->request['Privacy']) ) ) ? 1 : 0;
-
- # Update value for onCompleteAccount call
- $member['login_anonymous'] = $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 ) );
-
- IPSLib::runMemberSync( 'onCompleteAccount', $member );
-
- $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.4.5
+ * Register
+ * Last Updated: $Date: 2013-05-03 23:09:37 -0400 (Fri, 03 May 2013) $
+ *
+ *
+ * @author $Author $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/company/standards.php#license
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 20th February 2002
+ * @version $Rev: 12226 $
+ *
+ */
+
+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
+ *
+ * @param object Registry reference
+ * @return @e 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'] )
+ {
+ default:
+ case 'form':
+ if( $this->settings['no_reg'] > 0 )
+ {
+ $this->registry->output->showError( 'registration_disabled', 10123, FALSE, '', 200 );
+ }
+
+ $this->registerForm();
+ break;
+
+ case 'process_form':
+ if( $this->settings['no_reg'] > 0 )
+ {
+ $this->registry->output->showError( 'registration_disabled', 2016, true );
+ }
+
+ $this->registerProcessForm();
+ break;
+
+ case 'auto_validate':
+ $this->_autoValidate();
+ break;
+
+ case 'coppa_two':
+ $this->registerCoppaTwo();
+ break;
+
+ case '12':
+ $this->registerCoppaPermsForm();
+ break;
+
+ //-----------------------------------------
+ // Validation (i.e. registration, pw change, etc.)
+ //-----------------------------------------
+
+ case '05':
+ $this->_showManualForm();
+ break;
+
+ case '07':
+ $this->_showManualForm('newemail');
+ break;
+
+ case 'reval':
+ $this->_revalidateForm();
+ break;
+
+ case 'reval2':
+ $this->_revalidateComplete();
+ break;
+
+ //-----------------------------------------
+ // Complete a partial login
+ //-----------------------------------------
+
+ case 'complete_login':
+ $this->_completeRegistration();
+ break;
+ case 'complete_login_do':
+ $this->_completeRegistrationSave();
+ break;
+ }
+
+ /* Output */
+ $this->registry->output->addContent( $this->output );
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * Reset a member if they are logged in
+ *
+ * @return @e void
+ */
+ protected function _resetMember()
+ {
+ 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" );
+
+ 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( $this->memberData );
+
+ //-----------------------------------------
+ // Do it..
+ //-----------------------------------------
+
+ $this->member->sessionClass()->convertMemberToGuest();
+
+ $privacy = intval( IPSMember::isLoggedInAnon($this->memberData) );
+
+ IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'login_anonymous' => "{$privacy}&0", 'last_activity' => IPS_UNIX_TIME_NOW ) ) );
+ }
+ }
+
+ /**
+ * Displays the registration form
+ *
+ * @param array $form_errors
+ * @return @e void
+ */
+ public function registerForm( $form_errors=array() )
+ {
+ //-----------------------------------------
+ // Init
+ //-----------------------------------------
+
+ $final_errors = array();
+ $coppa = IPSCookie::get( 'coppa' );
+ $step = $this->request['step'] ? intval($this->request['step']) : 1;
+
+ $this->settings['username_errormsg'] = str_replace( '{chars}', $this->settings['username_characters'], $this->settings['username_errormsg'] );
+
+ if( $coppa == 'yes' )
+ {
+ $this->registry->output->showError( 'awaiting_coppa', 10124 );
+ }
+
+ $this->_resetMember();
+
+ //-----------------------------------------
+ // COPPA swapout
+ //-----------------------------------------
+
+ if( $this->settings['use_coppa'] )
+ {
+ $this->lang->words['confirm_over_thirteen'] = str_replace( "<#FORM_LINK#>", "{$this->settings['base_url']}app=core&module=global§ion=register&do=12", $this->lang->words['confirm_over_thirteen'] );
+ }
+
+ //-----------------------------------------
+ // T & C
+ //-----------------------------------------
+
+ $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'];
+
+ IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
+ IPSText::getTextClass( 'bbcode' )->parse_html = 1;
+ IPSText::getTextClass( 'bbcode' )->parse_nl2br = 1;
+ IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
+ IPSText::getTextClass( 'bbcode' )->parsing_section = 'global';
+
+ $this->settings['_termsAndConditions'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $text );
+
+ //-----------------------------------------
+ // Page title / navigation
+ //-----------------------------------------
+
+ $this->registry->output->setTitle( $this->lang->words['registration_form'] . ' - ' . ipsRegistry::$settings['board_name'] );
+ $this->registry->output->addNavigation( $this->lang->words['registration_form'], '' );
+
+ //-----------------------------------------
+ // If Nexus is installed, that is the first step
+ //-----------------------------------------
+
+ if( IPSLib::appIsInstalled('nexus') AND $this->settings['nexus_reg_show'] AND $this->settings['nexus_store_online'] )
+ {
+ //-----------------------------------------
+ // We just submitted the form
+ //-----------------------------------------
+
+ if( $this->request['nexus_pass'] )
+ {
+ $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'nexus' ) . '/sources/hooks.php', 'nexusHooks', 'nexus' );
+ $hookGateway = new $classToLoad( $this->registry );
+
+ //-----------------------------------------
+ // Check for errors
+ //-----------------------------------------
+
+ if ( $this->settings['nexus_reg_force'] and !IPSCookie::get( 'cm_reg' ) and empty( $this->request['cm_package'] ) )
+ {
+ $nexusError = $this->lang->words['forceby_no_sel'];
+ }
+
+ }
+
+ //-----------------------------------------
+ // If no errors, create invoice and set cookie
+ //-----------------------------------------
+
+ if ( !$nexusError and $this->request['nexus_pass'] )
+ {
+ //-----------------------------------------
+ // Did we buy a package?
+ //-----------------------------------------
+
+ $chosenPackages = ipsRegistry::$request['cm_package'];
+
+ if ( !empty( $chosenPackages ) )
+ {
+ foreach ( $chosenPackages as $itemID )
+ {
+ require_once( IPSLib::getAppDir('nexus') . '/sources/packageCore.php' );/*noLibHook*/
+ $package = package::load( $itemID );
+ $shippingData = $package->shippingData();
+ $renewTerm = $package->renewalTerms();
+ $items[] = array(
+ 'act' => 'new',
+ 'app' => 'nexus',
+ 'type' => $package->data['p_type'],
+ 'cost' => $package->price( $this->memberData['member_id'], FALSE ),
+ 'tax' => $package->data['p_tax'],
+ 'renew_term' => $renewTerm['term'],
+ 'renew_units' => $renewTerm['unit'],
+ 'renew_cost' => $renewTerm['price'],
+ 'physical' => is_null( $shippingData ) ? FALSE : TRUE,
+ 'shipping' => is_null( $shippingData ) ? array() : $shippingData['shipping'],
+ 'weight' => is_null( $shippingData ) ? 0 : $shippingData['weight'],
+ 'itemName' => $package->data['p_name'],
+ 'itemID' => $package->data['p_id'],
+ 'groupRenewals' => $package->data['p_group_renewals'],
+ 'methods' => $package->data['p_methods'] ? explode( ',', $package->data['p_methods'] ) : array(),
+ );
+ }
+
+ // Generate it
+ require_once( IPSLib::getAppDir('nexus') . '/sources/nexusApi.php' );/*noLibHook*/
+ $invoiceID = nexusApi::generateInvoice( NULL, $this->memberData['member_id'], $items );
+
+ IPSCookie::set( 'cm_reg', $invoiceID );
+ }
+ }
+ else
+ {
+ //-----------------------------------------
+ // "step 1" if Nexus is set to show packages on registration
+ //-----------------------------------------
+
+ require_once( IPSLib::getAppDir('nexus') . '/sources/packageCore.php' );/*noLibHook*/
+
+ $packages = array();
+ $this->DB->build( array( 'select' => '*', 'from' => 'nexus_packages', 'where' => 'p_reg=1', 'order' => 'p_position' ) );
+ $e = $this->DB->execute();
+ while ( $row = $this->DB->fetch( $e ) )
+ {
+ $packages[ $row['p_id'] ] = package::load( $row['p_id'] )->buildDisplayData();
+ }
+
+ if ( !empty( $packages ) )
+ {
+ if ( isset( $this->request['cm_package'] ) )
+ {
+ foreach ( $this->request['cm_package'] as $packageID )
+ {
+ $packages[ $packageID ]['checked'] = "checked='checked'";
+ }
+ }
+ $this->output .= $this->registry->output->getTemplate('nexus_payments')->regForm32( $packages, $nexusError );
+ return;
+ }
+ else
+ {
+ $this->settings['nexus_reg_show'] = false;
+ }
+ }
+ }
+
+ //-----------------------------------------
+ // Send to an alternate registration URL?
+ //-----------------------------------------
+
+ $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'] );
+ }
+ }
+
+ //-----------------------------------------
+ // Adjust text as needed based on validation type
+ //-----------------------------------------
+
+ 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'];
+ }
+ }
+
+ //-----------------------------------------
+ // Captcha / Q&A
+ //-----------------------------------------
+
+ $captchaHTML = '';
+ $qandaHTML = '';
+
+ $question = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'question_and_answer', 'order' => $this->DB->buildRandomOrder(), 'limit' => array(1) ) );
+
+ if( $question AND count($question) )
+ {
+ $qandaHTML = $this->registry->output->getTemplate('global_other')->questionAndAnswer( $question );
+ }
+
+ if( $this->settings['bot_antispam_type'] != 'none' )
+ {
+ $captchaHTML = $this->registry->getClass('class_captcha')->getTemplate();
+ }
+
+ //-----------------------------------------
+ // Custom 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', 0, array( 'tabindex' => 6 ) );
+ $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']
+ );
+ }
+ }
+
+ //-----------------------------------------
+ // If Nexus is installed, also add billing information
+ //-----------------------------------------
+
+ $nexusFields = array();
+ $nexusStates = array();
+ if( IPSLib::appIsInstalled('nexus') AND $this->settings['nexus_reg_show'] AND $this->settings['nexus_store_online'] )
+ {
+ ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'public_countries' ), 'nexus' );
+
+ $fields = array();
+ $_fields = ipsRegistry::cache()->getCache('customer_fields');
+
+ if( is_array($_fields) AND count($_fields) )
+ {
+ foreach ( $_fields['reg'] as $k )
+ {
+ $nexusFields[] = $_fields['fields'][ $k ];
+ }
+ }
+
+ $nexusStates = customer::generateStateDropdown( TRUE );
+ }
+
+ //-----------------------------------------
+ // Got errors to show?
+ //-----------------------------------------
+
+ $final_errors = array( 'dname' => NULL, 'password' => NULL, 'email' => NULL, 'tos' => NULL );
+
+ foreach( array( 'dname', 'password', 'email', 'tos' ) 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['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'] : '' ;
+
+ //-----------------------------------------
+ // Create time zone dropdown array
+ //-----------------------------------------
+
+ $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 );
+
+ $this->request['time_offset'] = ( $this->request['time_offset'] ) ? $this->request['time_offset'] : $this->settings['time_offset'];
+
+ //-----------------------------------------
+ // Start output
+ //-----------------------------------------
+
+ $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,
+ 'showCOPPA' => $this->settings['use_coppa'] AND !(IPSLib::appIsInstalled('nexus') AND $this->settings['nexus_reg_show'] AND $this->settings['nexus_store_online']),
+ ),
+ $final_errors,
+ $time_select,
+ $custom_fields_out,
+ $nexusFields,
+ $nexusStates );
+
+ //-----------------------------------------
+ // Member sync module
+ //-----------------------------------------
+
+ IPSLib::runMemberSync( 'onRegisterForm' );
+ }
+
+ /**
+ * Save the data to complete the partial member record login/registration
+ *
+ * @return @e void [Outputs to screen/redirects]
+ */
+ public function _completeRegistrationSave()
+ {
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $mid = intval( $this->request['mid'] );
+ $key = intval( $this->request['key'] );
+ $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( 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 );
+ }
+
+ //-----------------------------------------
+ // Set up email
+ //-----------------------------------------
+
+ $in_email = ( $this->request['EmailAddress'] ) ? strtolower( trim($this->request['EmailAddress']) ) : $tmp_member['email'];
+
+ //-----------------------------------------
+ // 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://' ) === FALSE && stristr( $custom_fields->out_fields[ 'field_' . $website_field ], 'https://' ) === FALSE )
+ {
+ $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_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 ) );
+ }
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/facebook/connect.php', 'facebook_connect' );
+ $facebook = new $classToLoad( $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 Twitterd? */
+ 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 ) );
+ }
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/twitter/connect.php', 'twitter_connect' );
+ $twitter = new $classToLoad( $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 ) );
+ }
+
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/vkontakte/connect.php', 'vkontakte_connect' );
+ $vk = new $classToLoad( $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=core&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'] = 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'];
+ }
+
+ /* Is this email banned or does it exist already? */
+ if ( IPSMember::isBanned( 'email', $in_email ) || IPSMember::checkByEmail( $in_email ) || $han_login->emailExistsCheck( trim(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'][] = isset($this->lang->words[ $user_check['errors']['dname'] ]) ? $this->lang->words[ $user_check['errors']['dname'] ] : $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' => 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 );
+
+ //-----------------------------------------
+ // Update: Profile fields
+ //-----------------------------------------
+
+ $this->DB->resetDataTypes();
+ $this->DB->setDataType( array_keys( $custom_fields->out_fields ), '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
+ //-----------------------------------------
+
+ if ( $connectService AND ! $login_user AND $this->settings['spam_service_enabled'] )
+ {
+ /* Load all member data */
+ $member = IPSMember::load( $mid, 'all' );
+
+ /* Spam Service */
+ $spamCode = 0;
+ $_spamFlag = 0;
+
+ /* Query the service */
+ $spamCode = IPSMember::querySpamService( $member['email'] );
+
+ /* Action to perform */
+ $action = $this->settings[ 'spam_service_action_' . $spamCode ];
+
+ /* Perform Action */
+ switch( $action )
+ {
+ /* Proceed with registration */
+ case 1:
+ break;
+
+ /* Flag for admin approval */
+ case 2:
+ $member['member_group_id'] = $this->settings['auth_group'];
+ $this->settings['reg_auth_type'] = 'admin';
+ $_spamFlag = 1;
+ break;
+
+ /* Approve the account, but ban it */
+ case 3:
+ $member['member_banned'] = 1;
+ $member['bw_is_spammer'] = 1;
+ $this->settings['reg_auth_type'] = '';
+ break;
+ /* Deny registration */
+ case 4:
+ $this->registry->output->showError( 'spam_denied_account', '100x001', FALSE, '', 200 );
+ break;
+ }
+
+ /* Update member */
+ IPSMember::save( $member['member_id'], array( 'core' => array( 'member_group_id' => $member['member_group_id'],
+ 'member_banned' => intval( $member['member_banned'] ),
+ 'bw_is_spammer' => intval( $member['bw_is_spammer'] ) ) ) );
+
+ /* Did we put them in validating? */
+ if ( $_spamFlag )
+ {
+ $validate_key = md5( IPSMember::makePassword() . time() );
+ $time = time();
+
+ $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' => 0,
+ 'new_reg' => 1,
+ 'ip_address' => $member['ip_address'],
+ 'spam_flag' => $_spamFlag ) );
+
+ $this->output = $this->registry->output->getTemplate('register')->showPreview( $member );
+ return; #Goes back to doExecute which sends $this->output to output class
+ }
+ }
+
+ /* Send out notification */
+ 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 = sprintf( $this->lang->words['new_registration_email'], $this->settings['board_name'] );
+ IPSText::getTextClass('email')->to = $this->settings['email_in'];
+ IPSText::getTextClass('email')->sendMail();
+ }
+
+ //-----------------------------------------
+ // Update Stats
+ //-----------------------------------------
+
+ $cache = $this->cache->getCache('stats');
+
+ if( $members_display_name AND $mid )
+ {
+ $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 */
+ $memberData = IPSMember::load( $mid );
+
+ IPSLib::runMemberSync( 'onCompleteAccount', $memberData );
+
+ /* Got admin validation enabled? */
+ if ( $connectService && ! $login_user && in_array( $this->settings['reg_auth_type'], array( 'admin', 'admin_user' ) ) )
+ {
+ /* Make them validating */
+ IPSMember::save( $member['member_id'], array( 'core' => array( 'member_group_id' => $this->settings['auth_group'] ) ) );
+
+ //-----------------------------------------
+ // 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['member_group'],
+ 'temp_group' => $this->settings['auth_group'],
+ 'entry_date' => time(),
+ 'coppa_user' => 0,
+ 'new_reg' => 1,
+ 'ip_address' => $member['ip_address'],
+ 'spam_flag' => $_spamFlag ) );
+
+ $this->output = $this->registry->output->getTemplate('register')->showPreview( IPSMember::load( $member['member_id'] ) );
+ return;
+ }
+
+ //-----------------------------------------
+ // Set cookies
+ //-----------------------------------------
+
+ IPSCookie::set("member_id" , $mid , 1 );
+ IPSCookie::set("pass_hash" , $tmp_member['member_login_key'] , 1 );
+
+ //-----------------------------------------
+ // Fix up session
+ //-----------------------------------------
+
+ $privacy = ( $this->caches['group_cache'][ $tmp_member['member_group_id'] ]['g_hide_online_list'] || ( empty($this->settings['disable_anonymous']) && ! empty($this->request['Privacy']) ) ) ? 1 : 0;
+
+ $this->member->sessionClass()->convertGuestToMember( array( 'member_name' => $members_display_name,
+ 'member_id' => $mid,
+ 'member_group' => $tmp_member['member_group_id'],
+ 'login_type' => $privacy ) );
+
+ IPSLib::runMemberSync( 'onLogin', $memberData );
+
+ //-----------------------------------------
+ // 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.
+ *
+ * @param array Errors
+ * @return @e void [Outputs to screen/redirects]
+ */
+ protected 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 */
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/facebook/connect.php', 'facebook_connect' );
+ $facebook = new $classToLoad( $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 */
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/twitter/connect.php', 'twitter_connect' );
+ $twitter = new $classToLoad( $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'] AND $member['vk_token'] )
+ {
+ /* Attempt to fetch user details */
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/vkontakte/connect.php', 'vkontakte_connect' );
+ $vk = new $classToLoad( $this->registry, $member['vk_token'], $member['vk_uid'] );
+
+ $userData = $vk->fetchUserData();
+
+ if ( $userData['uid'] )
+ {
+ $userData['service'] = 'vkontakte';
+ $userData['_name'] = $userData['first_name'] . ' ' . $userData['last_name'];
+ $userData['_pic'] = $userData['photo'];
+ $userData['_sImage'] = $this->settings['public_dir'] . 'style_status/vkontakte.png';
+ }
+ }
+ else
+ {
+ /* Set defaults for any we have */
+ $this->request['members_display_name'] = !empty($this->request['members_display_name']) ? $this->request['members_display_name'] : $member['members_display_name'];
+ $this->request['EmailAddress'] = !empty($this->request['EmailAddress']) ? $this->request['EmailAddress'] : ( ( substr( $member['email'], 0, 1 ) === '@' ? '' : $member['email'] ) );
+ $this->request['EmailAddress_two'] = !empty($this->request['EmailAddress_two']) ? $this->request['EmailAddress_two'] : ( ( substr( $member['email'], 0, 1 ) === '@' ? '' : $member['email'] ) );
+
+ // http://community.invisionpower.com/resources/bugs.html/_/ip-board/partial-registrations-from-windows-live-possibly-others-r41100
+ if ( substr( $in_email, 0, 1 ) === '@' )
+ {
+ $in_email = '';
+ }
+ }
+
+ /* Remote registrations disabled? */
+ if ( $this->settings['no_reg'] == 2 )
+ {
+ /* Clean up incomplete reg */
+ if ( $reg['partial_member_id'] )
+ {
+ IPSMember::remove( array( $reg['partial_member_id'] ) );
+ }
+
+ $this->registry->output->showError( 'no_remote_reg', 1090001 );
+ }
+
+ //-----------------------------------------
+ // Custom profile fields stuff
+ //-----------------------------------------
+
+ $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( '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
+ *
+ * @param string Errors
+ * @return @e void [Outputs to screen/redirects]
+ */
+ protected 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
+ *
+ * @return @e void [Outputs to screen/redirects]
+ */
+ protected 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
+ //-----------------------------------------
+
+ $val = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'validating', 'where' => "member_id=" . intval($member['member_id']) ) );
+
+ if ( empty($val['vid']) )
+ {
+ $this->_revalidateForm('err_no_validations');
+ return;
+ }
+
+ //-----------------------------------------
+ // Which type is it then?
+ //-----------------------------------------
+
+ if ( $val['lost_pass'] == 1 )
+ {
+ IPSText::getTextClass('email')->getTemplate("lost_pass", $member['language']);
+
+ IPSText::getTextClass('email')->buildMessage( array(
+ 'NAME' => $member['members_display_name'],
+ 'THE_LINK' => $this->registry->getClass('output')->buildSEOUrl("app=core&module=global§ion=lostpass&do=sendform&uid=" . $member['member_id'] . "&aid=" . $val['vid'], 'publicNoSession', 'false'),
+ 'MAN_LINK' => $this->registry->getClass('output')->buildSEOUrl("app=core&module=global§ion=lostpass&do=sendform", 'publicNoSession', 'false'),
+ '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", $member['language'] );
+
+ IPSText::getTextClass('email')->buildMessage( array(
+ 'THE_LINK' => $this->registry->getClass('output')->buildSEOUrl( "app=core&module=global§ion=register&do=auto_validate&uid=" . $member['member_id'] . "&aid=" . $val['vid'], 'publicNoSession', 'false'),
+ 'NAME' => $member['members_display_name'],
+ 'MAN_LINK' => $this->registry->getClass('output')->buildSEOUrl("app=core&module=global§ion=register&do=05", 'publicNoSession', 'false'),
+ 'EMAIL' => $member['email'],
+ 'ID' => $member['member_id'],
+ 'CODE' => $val['vid'],
+ )
+ );
+
+ IPSText::getTextClass('email')->subject = sprintf( $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->registry->getClass('output')->buildSEOUrl("app=core&module=global§ion=register&do=auto_validate&type=newemail&uid=" . $member['member_id'] . "&aid=" . $val['vid'], 'publicNoSession', 'false'),
+ 'ID' => $member['member_id'],
+ 'MAN_LINK' => $this->registry->getClass('output')->buildSEOUrl("app=core&module=global§ion=register&do=07", 'publicNoSession', 'false'),
+ 'CODE' => $val['vid'],
+ )
+ );
+
+ IPSText::getTextClass('email')->subject = sprintf( $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.
+ *
+ * @param string Type of validation
+ * @param string Error messages
+ * @return @e void [Outputs to screen/redirects]
+ */
+ protected 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
+ *
+ * @return @e void
+ */
+ protected 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.
+ *
+ * @return @e void
+ */
+ protected function registerCoppaTwo()
+ {
+ if( $this->request['coppa'] == 1 )
+ {
+ IPSCookie::set( 'coppa', 'no', 0, 1 );
+ $this->registerForm();
+ return;
+ }
+
+ IPSCookie::set( 'coppa', 'yes', 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'], '' );
+ }
+
+ /**
+ * 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.
+ *
+ * @return @e void
+ */
+ protected 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_flag']) )
+ {
+ $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( $member['member_group_id'] == $this->settings['auth_group'] )
+ {
+ if ( ! $validate['real_group'] )
+ {
+ $validate['real_group'] = $this->settings['member_group'];
+ }
+ else if( !isset( $this->caches['group_cache'][ $validate['real_group'] ] ) )
+ {
+ $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' )
+ {
+ if( $member['member_group_id'] == $this->settings['auth_group'] )
+ {
+ 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'] . "'" );
+
+ IPSLib::runMemberSync( 'onCompleteAccount', $member );
+
+ $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 = IPSMember::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", $member['language']);
+
+ IPSText::getTextClass('email')->buildMessage( array(
+ 'NAME' => $member['members_display_name'],
+ 'THE_LINK' => $this->registry->getClass('output')->buildSEOUrl('app=core&module=usercp&tab=core&area=email', 'publicNoSession', 'false'),
+ 'PASSWORD' => $new_pass,
+ 'LOGIN' => $this->registry->getClass('output')->buildSEOUrl('app=core&module=global§ion=login', 'publicNoSession', 'false'),
+ '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( !isset( $this->caches['group_cache'][ $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' );
+ }
+ }
+
+ /**
+ * Processes the registration form
+ *
+ * @return @e void
+ */
+ public function registerProcessForm()
+ {
+ $this->_resetMember();
+
+ $form_errors = array();
+ $coppa = ( $this->request['coppa_user'] == 1 ) ? 1 : 0;
+ $in_password = trim( $this->request['PassWord'] );
+ $in_email = strtolower( trim( $this->request['EmailAddress'] ) );
+
+ /* Did we agree to the t&c? */
+ if( ! $this->request['agree_tos'] )
+ {
+ $form_errors['tos'] = array( $this->lang->words['must_agree_to_terms'] );
+ }
+
+ /* 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( $_POST, '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'];
+ }
+
+ /*
+ There's no reason for this - http://community.invisionpower.com/resources/bugs.html/_/ip-board/registrations-limit-passwords-to-32-characters-for-no-apparent-reason-r37770
+ elseif ( strlen( $in_password ) < 3 )
+ {
+ $form_errors['password'][$this->lang->words['pass_too_short']] = $this->lang->words['pass_too_short'];
+ }
+ elseif ( strlen( $in_password ) > 32 )
+ {
+ $form_errors['password'][$this->lang->words['pass_too_long']] = $this->lang->words['pass_too_long'];
+ }
+ */
+
+ /* Check the username */
+ $user_check = IPSMember::getFunction()->cleanAndCheckName( $this->request['members_display_name'], 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['dname'][ $error ] = isset($this->lang->words[ $error ]) ? $this->lang->words[ $error ] : $error;
+ }
+ }
+
+ /* this duplicates username error above */
+ /*if( is_array( $disp_check['errors'] ) && count( $disp_check['errors'] ) )
+ {
+ foreach( $disp_check['errors'] as $key => $error )
+ {
+ $form_errors['dname'][ $error ] = isset($this->lang->words[ $error ]) ? $this->lang->words[ $error ] : $error;
+ }
+ }*/
+
+ /* 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 */
+ $qanda = intval($this->request['qanda_id']);
+ $pass = true;
+
+ if( $qanda )
+ {
+ $pass = false;
+ $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 )
+ {
+ $answer = trim($answer);
+
+ if( IPSText::mbstrlen($answer) AND 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 = false;
+ }
+ }
+
+ 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['members_display_name'],
+ 'password' => $in_password,
+ 'members_display_name' => $this->request['members_display_name'],
+ '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->settings['time_dst_auto_correction']),
+ 'allow_admin_mails' => intval( $this->request['allow_admin_mail'] ),
+ 'language' => $this->member->language_id,
+ );
+
+ /* Spam Service */
+ $spamCode = 0;
+ $_spamFlag = 0;
+
+ if( $this->settings['spam_service_enabled'] )
+ {
+ /* Query the service */
+ $spamCode = IPSMember::querySpamService( $in_email );
+
+ /* Action to perform */
+ $action = $this->settings[ 'spam_service_action_' . $spamCode ];
+
+ /* Perform Action */
+ switch( $action )
+ {
+ /* Proceed with registration */
+ case 1:
+ break;
+
+ /* Flag for admin approval */
+ case 2:
+ $member['member_group_id'] = $this->settings['auth_group'];
+ $this->settings['reg_auth_type'] = 'admin';
+ $_spamFlag = 1;
+ break;
+
+ /* Approve the account, but ban it */
+ case 3:
+ $member['member_banned'] = 1;
+ $member['bw_is_spammer'] = 1;
+ $this->settings['reg_auth_type'] = '';
+ break;
+
+ /* Deny registration */
+ case 4:
+ $this->registry->output->showError( 'spam_denied_account', '100x001', FALSE, '', 200 );
+ break;
+ }
+ }
+
+ //-----------------------------------------
+ // Create the account
+ //-----------------------------------------
+
+ $member = IPSMember::create( array( 'members' => $member, 'pfields_content' => $custom_fields->out_fields ), FALSE, FALSE, FALSE );
+
+ //-----------------------------------------
+ // Login handler create account callback
+ //-----------------------------------------
+
+ $this->han_login->createAccount( array( 'member_id' => $member['member_id'],
+ 'email' => $member['email'],
+ 'joined' => $member['joined'],
+ 'password' => $in_password,
+ 'ip_address' => $this->member->ip_address,
+ 'username' => $member['members_display_name'],
+ 'name' => $member['name'],
+ 'members_display_name' => $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( IPSMember::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['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' )
+ {
+ /* Send out the email. */
+ $message = array( 'THE_LINK' => $this->registry->getClass('output')->buildSEOUrl("app=core&module=global§ion=register&do=auto_validate&uid=" . urlencode( $member['member_id'] ) . "&aid=" . urlencode( $validate_key ), 'publicNoSession', 'false'),
+ 'NAME' => $member['members_display_name'],
+ 'MAN_LINK' => $this->registry->getClass('output')->buildSEOUrl("app=core&module=global§ion=register&do=05", 'publicNoSession', 'false'),
+ 'EMAIL' => $member['email'],
+ 'ID' => $member['member_id'],
+ 'CODE' => $validate_key );
+
+ IPSText::getTextClass('email')->setPlainTextTemplate( IPSText::getTextClass('email')->getTemplate( "reg_validate", $this->member->language_id ) );
+ IPSText::getTextClass('email')->buildPlainTextContent( $message );
+ IPSText::getTextClass('email')->buildHtmlContent( $message );
+
+ IPSText::getTextClass('email')->subject = sprintf( $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 );
+ }
+
+ /* Only send new registration email if the member wasn't banned */
+ if( $this->settings['new_reg_notify'] AND ! $member['member_banned'] )
+ {
+ $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 = sprintf( $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->cache->getCache('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 ) );
+
+ /* Only send new registration email if the member wasn't banned */
+ if( $this->settings['new_reg_notify'] AND ! $member['member_banned'] )
+ {
+ $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 = sprintf( $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 = ( $member['g_hide_online_list'] || ( empty($this->settings['disable_anonymous']) && ! empty($this->request['Privacy']) ) ) ? 1 : 0;
+
+ # Update value for onCompleteAccount call
+ $member['login_anonymous'] = $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 ) );
+
+ IPSLib::runMemberSync( 'onCompleteAccount', $member );
+
+ $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 f1e78d74..8a210c8e 100644
--- a/upload/admin/applications/core/modules_public/global/reputation.php
+++ b/upload/admin/applications/core/modules_public/global/reputation.php
@@ -2,9 +2,9 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Reputation
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2013-04-16 15:13:53 -0400 (Tue, 16 Apr 2013) $
*
*
* @author $Author $
@@ -13,7 +13,7 @@
* @package IP.Board
* @subpackage Core
* @link http://www.invisionpower.com
- * @version $Rev: 10914 $
+ * @version $Rev: 12182 $
*
*/
@@ -81,7 +81,7 @@ class public_core_global_reputation extends ipsCommand
/* Redirect to */
$return_url = '';
- if( !empty( $this->request['post_return'] ) )
+ if( !empty( $this->request['post_return'] ) && $app == 'forums' )
{
$return_url = $this->settings['base_url'] . 'app=forums&module=forums§ion=findpost&pid=' . intval( $this->request['post_return'] );
}
diff --git a/upload/admin/applications/core/modules_public/global/rss.php b/upload/admin/applications/core/modules_public/global/rss.php
index 65c0b95b..d9bb0ea7 100644
--- a/upload/admin/applications/core/modules_public/global/rss.php
+++ b/upload/admin/applications/core/modules_public/global/rss.php
@@ -2,9 +2,9 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* RSS output functionality
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
*
*
* @author $Author: bfarber $
@@ -14,7 +14,7 @@
* @subpackage Core
* @link http://www.invisionpower.com
* @since Friday 18th March 2005
- * @version $Revision: 10914 $
+ * @version $Revision: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
diff --git a/upload/admin/applications/core/modules_public/global/share.php b/upload/admin/applications/core/modules_public/global/share.php
index 37912c2d..923f8f9f 100644
--- a/upload/admin/applications/core/modules_public/global/share.php
+++ b/upload/admin/applications/core/modules_public/global/share.php
@@ -2,9 +2,9 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Captcha
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2013-01-07 12:09:37 -0500 (Mon, 07 Jan 2013) $
*
*
* @author $Author $
@@ -14,7 +14,7 @@
* @subpackage Core
* @link http://www.invisionpower.com
* @since 20th February 2002
- * @version $Rev: 10914 $
+ * @version $Rev: 11791 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -38,13 +38,7 @@ class public_core_global_share extends ipsCommand
{
$this->registry->output->showError( 'no_permission', 100234.1, false, null, 403 );
}
-
- /* Disable for bots */
- if( $this->member->is_not_human )
- {
- $this->registry->output->showError( 'no_permission', 100234.2, false, null, 403 );
- }
-
+
$url = IPSText::base64_decode_urlSafe( $this->request['url'] );
$title = IPSText::base64_decode_urlSafe( $this->request['title'] );
$key = trim( $this->request['key'] );
diff --git a/upload/admin/applications/core/modules_public/global/sitemap.php b/upload/admin/applications/core/modules_public/global/sitemap.php
new file mode 100644
index 00000000..d6a91adc
--- /dev/null
+++ b/upload/admin/applications/core/modules_public/global/sitemap.php
@@ -0,0 +1,56 @@
+
+ * Invision Power Services
+ * IP.Board v3.4.5
+ * Sitemap Forwarder
+ * Last Updated: $Date: 2012-05-10 21:10:13 +0100 (Thu, 10 May 2012) $
+ *
+ *
+ * @author $Author $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/company/standards.php#license
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @since 27th June 2012
+ * @version $Rev: 10721 $
+ */
+
+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_sitemap extends ipsCommand
+{
+ public function doExecute( ipsRegistry $registry )
+ {
+ // Requesting a sitemap?
+ if(!array_key_exists('sitemap', $this->request))
+ {
+ $this->registry->output->showError( 'error_generic', 10850, null, null, 404 );
+ return false;
+ }
+
+ // Got a valid name?
+ if(!preg_match('/sitemap\_([a-zA-Z0-9\_]+)\.xml(\.gz)?/', $this->request['sitemap']))
+ {
+ $this->registry->output->showError( 'error_generic', 10850, null, null, 404 );
+ return false;
+ }
+
+ // Got a valid file?
+ if(!file_exists( IPS_CACHE_PATH . 'cache/' . $this->request['sitemap']))
+ {
+ $this->registry->output->showError( 'error_generic', 10850, null, null, 404 );
+ return false;
+ }
+
+ header('Content-Type: ' . (strpos($this->request['sitemap'], '.gz') ? 'application/x-gzip' : 'application/xml'));
+ header('Content-Disposition: attachment; filename=' . $this->request['sitemap']);
+
+ print file_get_contents( IPS_CACHE_PATH . 'cache/' . $this->request['sitemap']);
+ }
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/modules_public/global/skin.php b/upload/admin/applications/core/modules_public/global/skin.php
index c6543af6..ea635632 100644
--- a/upload/admin/applications/core/modules_public/global/skin.php
+++ b/upload/admin/applications/core/modules_public/global/skin.php
@@ -4,11 +4,11 @@
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
- * $Author: bfarber $
+ * $Author: AndyMillne $
* @since 27 March 2012
- * $LastChangedDate: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
- * @version v3.3.4
- * $Revision: 10914 $
+ * $LastChangedDate: 2012-09-17 12:07:56 -0400 (Mon, 17 Sep 2012) $
+ * @version v3.4.5
+ * $Revision: 11342 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -52,7 +52,7 @@ class public_core_global_skin extends ipsCommand
if ( ( $this->request['skinId'] != 'setAsMobile' ) && $this->request['k'] != $this->member->form_hash )
{
- $this->registry->output->showError('no_permission');
+ $this->registry->output->showError('no_permission', 10122243, FALSE, '', 403);
}
if ( is_numeric( $skinId ) )
diff --git a/upload/admin/applications/core/modules_public/global/unsubscribe.php b/upload/admin/applications/core/modules_public/global/unsubscribe.php
new file mode 100644
index 00000000..3563de59
--- /dev/null
+++ b/upload/admin/applications/core/modules_public/global/unsubscribe.php
@@ -0,0 +1,45 @@
+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_unsubscribe
+ * @brief Unsubscribes user from bulk mails
+ */
+class public_core_global_unsubscribe extends ipsCommand
+{
+ /**
+ * Main function executed automatically by the controller
+ *
+ * @param object $registry Registry object
+ * @return @e void
+ */
+ public function doExecute( ipsRegistry $registry )
+ {
+ $member = IPSMember::load( intval( $this->request['member'] ), 'none', 'id' );
+ if ( $member['member_id'] and $this->request['key'] == md5( $member['email'] . ':' . $member['members_pass_hash'] ) )
+ {
+ IPSMember::save( $member['member_id'], array( 'members' => array( 'allow_admin_mails' => 0 ) ) );
+
+ $this->registry->getClass('output')->addContent( $this->registry->output->getTemplate( 'ucp' )->unsubscribed() );
+ $this->registry->getClass('output')->sendOutput();
+ }
+
+ $this->registry->output->showError( 'email_no_unsubscribe' );
+ }
+}
\ 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 111887c5..452491bf 100644
--- a/upload/admin/applications/core/modules_public/help/defaultSection.php
+++ b/upload/admin/applications/core/modules_public/help/defaultSection.php
@@ -7,7 +7,7 @@
* $Author: ips_terabyte $
* @since 20th February 2002
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
- * @version v3.3.4
+ * @version v3.4.5
* $Revision: 8655 $
*/
diff --git a/upload/admin/applications/core/modules_public/help/help.php b/upload/admin/applications/core/modules_public/help/help.php
index 0998d3d3..86f6db16 100644
--- a/upload/admin/applications/core/modules_public/help/help.php
+++ b/upload/admin/applications/core/modules_public/help/help.php
@@ -2,18 +2,18 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Help File System
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2012-11-15 09:58:24 -0500 (Thu, 15 Nov 2012) $
*
*
- * @author $Author: bfarber $
+ * @author $Author: AndyMillne $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Core
* @link http://www.invisionpower.com
- * @version $Rev: 10914 $
+ * @version $Rev: 11605 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -160,7 +160,7 @@ class public_core_help_help extends ipsCommand
);
/* Navigation */
- $this->registry->output->setTitle( $this->lang->words['help_topic'] . ' - ' . ipsRegistry::$settings['board_name'] );
+ $this->registry->output->setTitle( $this->lang->words['help_topic'] . ': ' . $topic['title'] . ' - ' . 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'], '' );
diff --git a/upload/admin/applications/core/modules_public/modcp/defaultSection.php b/upload/admin/applications/core/modules_public/modcp/defaultSection.php
index d0c2156d..a13b1eb5 100644
--- a/upload/admin/applications/core/modules_public/modcp/defaultSection.php
+++ b/upload/admin/applications/core/modules_public/modcp/defaultSection.php
@@ -7,7 +7,7 @@
* $Author: ips_terabyte $
* @since 2/14/2011
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
- * @version v3.3.4
+ * @version v3.4.5
* $Revision: 8655 $
*/
diff --git a/upload/admin/applications/core/modules_public/modcp/modcp.php b/upload/admin/applications/core/modules_public/modcp/modcp.php
index cfc03db2..cc798635 100644
--- a/upload/admin/applications/core/modules_public/modcp/modcp.php
+++ b/upload/admin/applications/core/modules_public/modcp/modcp.php
@@ -3,11 +3,11 @@
* @file modcp.php Moderator control panel
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
- * $Author: bfarber $
+ * $Author: AndyMillne $
* @since 2/14/2011
- * $LastChangedDate: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
- * @version v3.3.4
- * $Revision: 10914 $
+ * $LastChangedDate: 2013-05-28 10:00:25 -0400 (Tue, 28 May 2013) $
+ * @version v3.4.5
+ * $Revision: 12273 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -183,15 +183,15 @@ class public_core_modcp_modcp extends ipsCommand
break;
case 'doeditmember':
- $this->_doEditMember();
+ $_output = $this->_doEditMember();
break;
case 'setAsSpammer':
- $this->_setAsSpammer();
+ $_output = $this->_setAsSpammer();
break;
default:
- $_output = $this->registry->output->getTemplate('modcp')->memberLookup();
+ $_output = $this->registry->output->getTemplate('modcp')->overview();
break;
}
}
@@ -415,41 +415,33 @@ class public_core_modcp_modcp extends ipsCommand
// Init
//-----------------------------------------
- $editable = array();
-
+ $editable = array();
+ $isHtml = intval( $this->request['sig_htmlstatus'] );
+
//-----------------------------------------
// Signature and about me
//-----------------------------------------
- $signature = $this->editor->process( $_POST['Post'] );
- $aboutme = $this->editor->process( $_POST['aboutme'] );
-
+ /* Load parser */
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser' );
+ $parser = new $classToLoad();
+
+ $this->editor->setLegacyMode(false);
+
//-----------------------------------------
// Parse signature
//-----------------------------------------
- IPSText::getTextClass('bbcode')->parse_smilies = 0;
- IPSText::getTextClass('bbcode')->parse_html = $this->caches['group_cache'][ $this->warn_member['member_group_id'] ]['g_dohtml'];
- IPSText::getTextClass('bbcode')->parse_bbcode = 1;
- IPSText::getTextClass('bbcode')->parsing_section = 'signatures';
- IPSText::getTextClass('bbcode')->parsing_mgroup = $this->warn_member['member_group_id'];
- IPSText::getTextClass('bbcode')->parsing_mgroup_others = $this->warn_member['mgroup_others'];
-
- $signature = IPSText::getTextClass('bbcode')->preDbParse( $signature );
- $signatureCache = IPSText::getTextClass('bbcode')->preDisplayParse( $signature );
+ /* Set content in editor */
+ $this->editor->setAllowBbcode( true );
+ $this->editor->setAllowSmilies( false );
+ $this->editor->setIsHtml( $this->caches['group_cache'][ $this->warn_member['member_group_id'] ]['g_dohtml'] && $isHtml );
+ $this->editor->setBbcodeSection('signatures');
+
+ $signature = $this->editor->process( $_POST['Post'] );
- //-----------------------------------------
- // Parse about me
- //-----------------------------------------
-
- IPSText::getTextClass('bbcode')->parse_smilies = 1;
- IPSText::getTextClass('bbcode')->parse_html = $this->caches['group_cache'][ $this->warn_member['member_group_id'] ]['g_dohtml'];
- IPSText::getTextClass('bbcode')->parse_bbcode = 1;
- IPSText::getTextClass('bbcode')->parsing_section = 'aboutme';
- IPSText::getTextClass('bbcode')->parsing_mgroup = $this->warn_member['member_group_id'];
- IPSText::getTextClass('bbcode')->parsing_mgroup_others = $this->warn_member['mgroup_others'];
-
- $aboutme = IPSText::getTextClass('bbcode')->preDbParse( $aboutme );
+ /* About Me */
+ $aboutme = $this->editor->process( $_POST['aboutme'] );
//-----------------------------------------
// Add to array to save
@@ -458,6 +450,10 @@ class public_core_modcp_modcp extends ipsCommand
$save['extendedProfile'] = array( 'signature' => $signature, 'pp_about_me' => $aboutme );
$save['members'] = array( 'title' => $this->request['title'] );
+ //-----------------------------------------
+ // Removing photo?
+ //-----------------------------------------
+
if ( $this->request['photo'] == 1 )
{
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/member/photo.php', 'classes_member_photo' );
@@ -465,6 +461,25 @@ class public_core_modcp_modcp extends ipsCommand
$photos->remove( $this->warn_member['member_id'] );
}
+ //-----------------------------------------
+ // Removing Restrictions?
+ //-----------------------------------------
+
+ if ( $this->request['modpreview'] == 1 )
+ {
+ $save['core']['mod_posts'] = 0;
+ }
+
+ if ( $this->request['postingrestriction'] == 1 )
+ {
+ $save['core']['restrict_post'] = 0;
+ }
+
+ if ( $this->request['remove_suspension'] == 1 )
+ {
+ $save['core']['temp_ban'] = 0;
+ }
+
//-----------------------------------------
// Profile fields
//-----------------------------------------
@@ -483,10 +498,13 @@ class public_core_modcp_modcp extends ipsCommand
//-----------------------------------------
// Bitwise
//-----------------------------------------
-
- $bw = IPSBWOptions::thaw( $this->warn_member['members_bitoptions'], 'members' );
- $bw['bw_no_status_update'] = ( $this->request['status_updates'] ) ? 0 : 1;
- $save['core']['members_bitoptions'] = IPSBWOptions::freeze( $bw, 'members' );
+
+ if ( isset( $this->request['status_updates'] ) )
+ {
+ $bw = IPSBWOptions::thaw( $this->warn_member['members_bitoptions'], 'members' );
+ $bw['bw_no_status_update'] = ( $this->request['status_updates'] ) ? 0 : 1;
+ $save['core']['members_bitoptions'] = IPSBWOptions::freeze( $bw, 'members' );
+ }
//-----------------------------------------
// Write it to the DB.
@@ -498,7 +516,8 @@ class public_core_modcp_modcp extends ipsCommand
// Update signature content cache
//-----------------------------------------
- IPSContentCache::update( $this->warn_member['member_id'], 'sig', $signatureCache );
+ /* Update cache */
+ IPSContentCache::update( $this->warn_member['member_id'], 'sig', $parser->display( $signature ) );
//-----------------------------------------
// Add a mod log entry and redirect
@@ -540,7 +559,12 @@ class public_core_modcp_modcp extends ipsCommand
{
$this->registry->output->showError( 'moderate_no_permission', 10311900, true, null, 404 );
}
-
+
+ if ( ! $this->memberData['g_access_cp'] AND $member['g_access_cp'] )
+ {
+ return $this->registry->getClass('output')->getTemplate('modcp')->modcpMessage( $this->lang->words['mod_cannot_edit_admin'] );
+ }
+
//-----------------------------------------
// Check permissions
//-----------------------------------------
@@ -555,6 +579,11 @@ class public_core_modcp_modcp extends ipsCommand
$this->registry->output->showError( 'moderate_no_permission', 10311901, true, null, 403 );
}
+ if ( $this->request['auth_key'] != $this->member->form_hash )
+ {
+ $this->registry->output->showError( 'moderate_no_permission', 10311902, null, null, 403 );
+ }
+
//-----------------------------------------
// Do it
//-----------------------------------------
diff --git a/upload/admin/applications/core/modules_public/reports/defaultSection.php b/upload/admin/applications/core/modules_public/reports/defaultSection.php
index ebf7d386..c85f3d9d 100644
--- a/upload/admin/applications/core/modules_public/reports/defaultSection.php
+++ b/upload/admin/applications/core/modules_public/reports/defaultSection.php
@@ -7,7 +7,7 @@
* $Author: ips_terabyte $
* @since 20th February 2002
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
- * @version v3.3.4
+ * @version v3.4.5
* $Revision: 8655 $
*/
diff --git a/upload/admin/applications/core/modules_public/reports/reports.php b/upload/admin/applications/core/modules_public/reports/reports.php
index ff6baf2d..b5c8eb98 100644
--- a/upload/admin/applications/core/modules_public/reports/reports.php
+++ b/upload/admin/applications/core/modules_public/reports/reports.php
@@ -7,9 +7,9 @@
* $Author: AndyMillne $
* @author Based on original "Report Center" by Luke Scott
* @since -
- * $LastChangedDate: 2012-06-26 07:24:43 -0400 (Tue, 26 Jun 2012) $
- * @version v3.3.4
- * $Revision: 10987 $
+ * $LastChangedDate: 2012-12-13 08:29:08 -0500 (Thu, 13 Dec 2012) $
+ * @version v3.4.5
+ * $Revision: 11713 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -275,7 +275,7 @@ class public_core_reports_reports extends ipsCommand
//-----------------------------------------
$COM_PERM = $this->registry->getClass('reportLibrary')->buildQueryPermissions();
-
+
$reports = array();
//-----------------------------------------
@@ -424,6 +424,11 @@ class public_core_reports_reports extends ipsCommand
$this->registry->getClass('output')->showError( 'no_permission', 20112, null, null, 403 );
}
+ if ( $this->request['newstatus'] == 'x' )
+ {
+ $this->registry->getClass('output')->showError( 'invalid_option', 20113, null, null, 403 );
+ }
+
//-----------------------------------------
// Are we pruning?
//-----------------------------------------
@@ -627,6 +632,18 @@ class public_core_reports_reports extends ipsCommand
$this->registry->getClass('output')->showError( 'no_permission', 20114, null, null, 403 );
}
+ //-----------------------------------------
+ // Check Captcha
+ //-----------------------------------------
+
+ if ( ! $this->memberData['member_id'] AND $this->settings['guest_captcha'] AND $this->settings['bot_antispam_type'] != 'none' )
+ {
+ if ( !$this->registry->getClass('class_captcha')->validate() )
+ {
+ $this->registry->output->showError( 'posting_bad_captcha', '20116', null, null, 403 );
+ }
+ }
+
//-----------------------------------------
// Empty report
//-----------------------------------------
@@ -698,13 +715,11 @@ class public_core_reports_reports extends ipsCommand
}
$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';
+ /* Load parser */
+ $classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser' );
+ $parser = new $classToLoad();
+
//-----------------------------------------
// Get reports
//-----------------------------------------
@@ -714,9 +729,6 @@ class public_core_reports_reports extends ipsCommand
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'] )
@@ -757,7 +769,15 @@ class public_core_reports_reports extends ipsCommand
}
$row['title'] = $row['_title'];
- $row['report'] = IPSText::getTextClass('bbcode')->preDisplayParse( $row['report'] );
+
+ /* Set up some settings */
+ $parser->set( array( 'parseArea' => 'reports',
+ 'memberData' => $row['author'],
+ 'parseBBCode' => true,
+ 'parseHtml' => false,
+ 'parseEmoticons' => true ) );
+
+ $row['report'] = $parser->display( $row['report'] );
$reports[] = $row;
}
diff --git a/upload/admin/applications/core/modules_public/search/defaultSection.php b/upload/admin/applications/core/modules_public/search/defaultSection.php
index f9aa0e71..ccebd263 100644
--- a/upload/admin/applications/core/modules_public/search/defaultSection.php
+++ b/upload/admin/applications/core/modules_public/search/defaultSection.php
@@ -7,7 +7,7 @@
* $Author: ips_terabyte $
* @since 20th February 2002
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
- * @version v3.3.4
+ * @version v3.4.5
* $Revision: 8655 $
*/
diff --git a/upload/admin/applications/core/modules_public/search/search.php b/upload/admin/applications/core/modules_public/search/search.php
index d1aa0618..2871ed52 100644
--- a/upload/admin/applications/core/modules_public/search/search.php
+++ b/upload/admin/applications/core/modules_public/search/search.php
@@ -1,1237 +1,1290 @@
-
- * Invision Power Services
- * IP.Board v3.3.4
- * Global Search
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
- *
- *
- * @author $Author: bfarber $
- * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.invisionpower.com/company/standards.php#license
- * @package IP.Board
- * @subpackage Core
- * @link http://www.invisionpower.com
- * @version $Rev: 10914 $
- */
-
-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
- */
- protected $output = '';
-
- /**
- * Page Title
- *
- * @var string
- */
- protected $title = '';
-
- /**
- * Object to handle searches
- *
- * @var string
- */
- protected $search_plugin = '';
-
- /**
- * Topics array
- *
- * @var array
- */
- protected $_topicArray = array();
- protected $_removedTerms = array();
-
- /**
- * Search controller
- *
- * @var obj
- */
- protected $searchController;
- protected $_session;
-
- /**
- * Class entry point
- *
- * @param object Registry reference
- * @return @e 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'];
-
- /* Force SQL for view new content? */
- if ( ! empty( $this->settings['force_sql_vnc'] ) && $this->request['do'] == 'viewNewContent' )
- {
- $this->settings['search_method'] = 'sql';
- }
-
- /* 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'] = 'forums';
- }
-
- 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;
- }
- }
-
- /* Log type */
- IPSDebug::addMessage( "Search type: " . $this->settings['search_method'] );
-
- /* Set up some defaults */
- IPSSearchRegistry::set('opt.noPostPreview', false );
- 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 );
-
- $this->settings['search_ucontent_days'] = ( $this->settings['search_ucontent_days'] ) ? $this->settings['search_ucontent_days'] : 365;
-
- /* 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 'user_activity':
- $this->viewUserContent();
- break;
-
- case 'new_posts':
- case 'viewNewContent':
- case 'active':
- $this->viewNewContent();
- break;
-
- case 'search':
- case 'quick_search':
- $this->searchResults();
- break;
-
- case 'followed':
- $this->viewFollowedContent();
- break;
-
- case 'manageFollowed':
- $this->updateFollowedContent();
- break;
-
- default:
- case 'search_form':
- $this->searchAdvancedForm();
- break;
- }
-
- /* Start session */
- $this->_endSession();
-
- /* If we have any HTML to print, do so... */
- if ( $this->request['do'] == 'search' && ! empty( $this->request['search_tags'] ) )
- {
- $this->registry->output->setTitle( IPSText::urldecode_furlSafe( $this->request['search_tags'] ) . ' - ' . $this->lang->words['st_tags'] . ' - ' . IPSLib::getAppTitle( $this->request['search_app'] ) . ' - ' . ipsRegistry::$settings['board_name'] );
-
- /* Add canonical tag */
- $extra = ( $this->request['st'] ) ? '&st=' . $this->request['st'] : '';
- $this->registry->output->addCanonicalTag( 'app=core&module=search&do=search&search_tags=' . IPSText::urlencode_furlSafe( $this->request['search_tags'] ) . '&search_app=' . $this->request['search_app']. $extra, $this->request['search_tags'], 'tags' );
- }
- else
- {
- $this->registry->output->setTitle( $this->title . ' - ' . ipsRegistry::$settings['board_name'] );
- }
-
- $this->registry->output->addContent( $this->output );
- $this->registry->output->sendOutput();
- }
-
- /**
- * Moderate your list of liked content
- *
- * @author bfarber
- * @return string HTML to display
- */
- public function updateFollowedContent()
- {
- IPSSearchRegistry::set( 'in.search_app', $this->request['search_app'] );
-
- //-----------------------------------------
- // 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->viewFollowedContent( $this->lang->words['no_likes_for_del'] );
- }
-
- //-----------------------------------------
- // Get like helper class
- //-----------------------------------------
-
- $bootstraps = array();
-
- require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
-
- //-----------------------------------------
- // 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=search&do=followed&search_app={$this->request['search_app']}&contentType={$this->request['contentType']}&confirm=1" );
- }
-
- /**
- * View content you are following
- *
- * @author Brandon Farber
- * @param string $error Error message
- * @return @e void
- */
- public function viewFollowedContent( $error='' )
- {
- IPSSearchRegistry::set( 'in.search_app', $this->request['search_app'] );
- IPSSearchRegistry::set( 'opt.searchType', 'titles' );
- IPSSearchRegistry::set( 'opt.noPostPreview', true );
-
- $results = array();
- $formatted = array();
- $count = 0;
-
- //-----------------------------------------
- // Determine content type
- //-----------------------------------------
-
- $contentTypes = IPSSearchRegistry::get('config.followContentTypes');
-
- //-----------------------------------------
- // Verify likes are available
- //-----------------------------------------
-
- if( count( IPSLib::getEnabledApplications('like') ) AND count( $contentTypes ) )
- {
- //-----------------------------------------
- // What content type?
- //-----------------------------------------
-
- $_type = '';
-
- if( $this->request['contentType'] AND in_array( $this->request['contentType'], $contentTypes ) )
- {
- $_type = $this->request['contentType'];
- }
- else
- {
- $_type = $contentTypes[0];
- }
-
- $this->request['contentType'] = $_type;
-
- IPSSearchRegistry::set( 'in.followContentType', $this->request['contentType'] );
-
- /* Fetch like class */
- try
- {
- require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
- $this->_like = classes_like::bootstrap( IPSSearchRegistry::get('in.search_app'), $_type );
- }
- catch ( Exception $e)
- {
- /* Fail safe... */
- $this->registry->output->addNavigation( $this->lang->words['followed_ct_title'], '' );
- $this->title = $this->lang->words['followed_ct_title'];
- $this->output .= $this->registry->output->getTemplate( 'search' )->followedContentView( array(), '', 0, $error, $contentTypes );
- }
-
- /* Do we have some custom join and sort data? */
- if ( method_exists( $this->_like, 'getSearchJoinAndSortBy' ) )
- {
- $custom = $this->_like->getSearchJoinAndSortBy();
-
- $countQ = array( 'select' => 'COUNT(*) as er',
- 'from' => array( 'core_like' => 'l' ),
- 'where' => 'like_member_id=' . $this->memberData['member_id'] . " AND like_visible=1 AND like_app='" . IPSSearchRegistry::get('in.search_app') . "' AND like_area='" . $_type . "'" );
- if ( $custom['from'] )
- {
- $countQ['add_join'][] = array( 'from' => $custom['from'], 'where' => $custom['where'] );
- }
- if ( $custom['order'] )
- {
- $countQ['order'] = $custom['order'] . ' DESC';
- }
- if ( $custom['extraWhere'] )
- {
- $countQ['where'] .= ' AND ' . $custom['extraWhere'];
- }
- $count = $this->DB->buildAndFetch( $countQ );
- $count = $count['er'];
-
- $q = array( 'select' => 'l.*',
- 'from' => array('core_like' => 'l'),
- 'where' => 'l.like_member_id=' . $this->memberData['member_id'] . " AND l.like_visible=1 AND l.like_app='" . IPSSearchRegistry::get('in.search_app') . "' AND l.like_area='" . $_type . "'",
- 'limit' => array( IPSSearchRegistry::get('in.start'), IPSSearchRegistry::get('opt.search_per_page') ),
- 'order' => 'like_added DESC'
- );
-
- if ( $custom['from'] )
- {
- $q['add_join'][] = array( 'from' => $custom['from'], 'where' => $custom['where'] );
- }
- if ( $custom['order'] )
- {
- $q['order'] = $custom['order'] . ' DESC';
- }
- if ( $custom['extraWhere'] )
- {
- $q['where'] .= ' AND ' . $custom['extraWhere'];
- }
-
- $this->DB->build( $q );
- }
- else
- {
- $count = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as er',
- 'from' => 'core_like',
- 'where' => 'like_member_id=' . $this->memberData['member_id'] . " AND like_visible=1 AND like_app='" . IPSSearchRegistry::get('in.search_app') . "' AND like_area='" . $_type . "'" ) );
- $count = $count['er'];
-
- $this->DB->build( array( 'select' => '*',
- 'from' => 'core_like',
- 'where' => 'like_member_id=' . $this->memberData['member_id'] . " AND like_visible=1 AND like_app='" . IPSSearchRegistry::get('in.search_app') . "' AND like_area='" . $_type . "'",
- 'limit' => array( IPSSearchRegistry::get('in.start'), IPSSearchRegistry::get('opt.search_per_page') ),
- 'order' => 'like_added DESC' ) );
- }
-
- $outer = $this->DB->execute();
-
- while( $r = $this->DB->fetch($outer) )
- {
- $results[] = $r['like_rel_id'];
-
- $formatted[ $r['like_id'] ] = $r;
- }
-
- /* Process */
- $results = $this->searchController->fetchFollowedContentOutput( $results, $formatted );
-
- $pages = $this->registry->getClass('output')->generatePagination( array( 'totalItems' => $count,
- 'itemsPerPage' => IPSSearchRegistry::get('opt.search_per_page'),
- 'currentStartValue' => IPSSearchRegistry::get('in.start'),
- 'baseUrl' => "app=core&module=search&do=followed&search_app=" . IPSSearchRegistry::get('in.search_app') . '&sid=' . $this->request['_sid'] . "&contentType=" . $this->request['contentType'] ) );
- }
- else
- {
- $count = 0;
- $results = array();
- }
-
- /* Output */
- $this->registry->output->addNavigation( $this->lang->words['followed_ct_title'], '' );
- $this->title = $this->lang->words['followed_ct_title'];
- $this->output .= $this->registry->output->getTemplate( 'search' )->followedContentView( $results, $pages, $count, $error, $contentTypes );
- }
-
- /**
- * Builds the advanced search form
- *
- * @param string Message
- * @return @e 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();
- $tagSupport = $this->searchController->getTagSupport();
-
- /* 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, $tagSupport );
- }
-
- /**
- * Processes a search request
- *
- * @return @e void
- */
- public function searchResults()
- {
- /* Search Term */
- $_st = $this->searchController->formatSearchTerm( trim( $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.raw_search_tags' , str_replace( '&', '&', trim( IPSText::parseCleanValue( IPSText::urldecode_furlSafe( $_REQUEST['search_tags'] ) ) ) ) );
- 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' , !empty( $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.searchType', ( !empty( $this->request['search_content'] ) AND in_array( $this->request['search_content'], array( 'both', 'titles', 'content' ) ) ) ? $this->request['search_content'] : 'both' );
-
- /* Time check */
- if ( IPSSearchRegistry::get('in.search_date_start') AND strtotime( IPSSearchRegistry::get('in.search_date_start') ) > time() )
- {
- IPSSearchRegistry::set('in.search_date_start', 'now' );
- }
-
- if ( IPSSearchRegistry::get('in.search_date_end') AND strtotime( 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( IPSSearchRegistry::get('in.search_date_start') ) > strtotime( IPSSearchRegistry::get('in.search_date_end') ) )
- {
- $this->searchAdvancedForm( $this->lang->words['search_invalid_date_range'] );
- return;
- }
-
- /**
- * Lower limit
- */
- if ( $this->settings['min_search_word'] && ! IPSSearchRegistry::get('in.search_author') && ! IPSSearchRegistry::get('in.raw_search_tags') )
- {
- if ( $this->settings['search_method'] == 'sphinx' && substr_count( $search_term, '"' ) == 2 )
- {
- $_ok = true;
- }
- else
- {
- $_words = explode( ' ', preg_replace( "#\"(.*?)\"#", '', $search_term ) );
- $_ok = $search_term ? true : false;
-
- foreach( $_words as $_word )
- {
- $_word = preg_replace( '#^\+(.+?)$#', "\\1", $_word );
-
- if ( ! $_word OR $_word == '|' )
- {
- continue;
- }
-
- 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;
- }
- }
-
- /**
- * 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['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'] - ( time() - $last_search ) ) );
- 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 ) );
-
- /* Got tag search only but app doesn't support tags */
- if ( IPSSearchRegistry::get('in.raw_search_tags') && ! IPSSearchRegistry::get( 'config.can_searchTags' ) && ! IPSSearchRegistry::get('in.raw_search_term') )
- {
- $count = 0;
- $results = array();
- }
- else 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();
-
- /* Set default sort option */
- $_a = IPSSearchRegistry::get('in.search_app');
- $_k = IPSSearchRegistry::get( $_a . '.searchInKey') ? IPSSearchRegistry::get( $_a . '.searchInKey') : '';
-
- if( $_k AND !$this->request['search_app_filters'][ $_a ][ $_k ]['sortKey'] AND is_array($sortDropDown) AND count($sortDropDown) )
- {
- $this->request['search_app_filters'][ $_a ][ $_k ]['sortKey'] = key( $sortDropDown );
- }
- else if( !$_k AND !$this->request['search_app_filters'][ $_a ]['sortKey'] AND is_array($sortDropDown) AND count($sortDropDown) )
- {
- $this->request['search_app_filters'][ $_a ]['sortKey'] = key( $sortDropDown );
- }
-
- /* 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('opt.searchType') == 'titles' || IPSSearchRegistry::get('opt.noPostPreview') ) ? 1 : 0 );
-
- /* Check for sortIn */
- if( count( $sortIn ) && !$this->request['search_app_filters'][ $this->request['search_app'] ]['searchInKey'] )
- {
- $this->request['search_app_filters'][ $this->request['search_app'] ]['searchInKey'] = $sortIn[0][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'), IPSSearchRegistry::get('in.raw_search_tags') );
- }
-
- /**
- * 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'] = is_array( $this->request['search_app_filters'] ) ? array_merge( $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 @e 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';
- }
- else
- {
- $dir = 'desc';
- }
-
- IPSSearchRegistry::set('in.search_sort_by' , trim( $key ) );
- IPSSearchRegistry::set('in.search_sort_order', ( $dir != 'desc' ) ? 'asc' : 'desc' );
- }
-
- /**
- * Displays latest user content
- *
- * @return @e void
- */
- public function viewUserContent()
- {
- /* INIT */
- $id = $this->request['mid'] ? intval( trim( $this->request['mid'] ) ) : $this->memberData['member_id'];
-
- /* Save query if we are viewing our own content */
- if( $this->memberData['member_id'] AND $id == $this->memberData['member_id'] )
- {
- $member = $this->memberData;
- }
- else
- {
- $member = IPSMember::load( $id, 'core' );
- }
-
- $beginStamp = 0;
-
- if ( ! $member['member_id'] )
- {
- $this->registry->output->showError( 'search_invalid_id', 10147, null, null, 403 );
- }
-
- $this->request['userMode'] = !empty($this->request['userMode']) ? $this->request['userMode'] : 'all';
-
- IPSSearchRegistry::set('in.search_app', $this->request['search_app'] );
- IPSSearchRegistry::set('in.userMode' , $this->request['userMode'] );
-
- /* Set sort filters */
- $this->_setSortFilters();
-
- /* 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 */
- $sortDropDown = $this->searchController->fetchSortDropDown();
-
- /* Set default sort option */
- $_a = IPSSearchRegistry::get('in.search_app');
- $_k = IPSSearchRegistry::get( $_a . '.searchInKey') ? IPSSearchRegistry::get( $_a . '.searchInKey') : '';
-
- if( $_k AND !$this->request['search_app_filters'][ $_a ][ $_k ]['sortKey'] AND is_array($sortDropDown) )
- {
- $this->request['search_app_filters'][ $_a ][ $_k ]['sortKey'] = key( $sortDropDown );
- }
- else if( !$_k AND !$this->request['search_app_filters'][ $_a ]['sortKey'] AND is_array($sortDropDown) )
- {
- $this->request['search_app_filters'][ $_a ]['sortKey'] = key( $sortDropDown );
- }
-
- /* Fetch sort details */
- $sortIn = $this->searchController->fetchSortIn();
-
- /* Reset for template */
- $this->_resetRequestParameters();
-
- /* Parse result set */
- $results = $this->registry->output->getTemplate( $template['group'] )->$template['template']( $results, ( IPSSearchRegistry::get('opt.searchType') == 'titles' || 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'] . $this->_returnSearchAppFilters() ) );
- }
- 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, $sortDropDown );
- }
-
- /**
- * View new posts since your last visit
- *
- * @return @e void
- */
- public function viewNewContent()
- {
- IPSSearchRegistry::set('in.search_app', $this->request['search_app'] );
-
- /* Fetch member cache to see if we have a value set */
- $vncPrefs = IPSMember::getFromMemberCache( $this->memberData, 'vncPrefs' );
-
- /* Guests */
- if ( ! $this->memberData['member_id'] AND ( ! $this->request['period'] OR $this->request['period'] == 'unread' ) )
- {
- $this->request['period'] = 'today';
- }
-
- /* In period */
- if ( $vncPrefs === null OR ! isset( $vncPrefs[ IPSSearchRegistry::get('in.search_app') ]['view'] ) OR ( ! empty( $this->request['period'] ) AND isset( $this->request['change'] ) ) )
- {
- $vncPrefs[ IPSSearchRegistry::get('in.search_app') ]['view'] = ( ! empty( $this->request['period'] ) ) ? $this->request['period'] : $this->settings['default_vnc_method'];
- }
-
- /* Follow filter enabled */
- if ( $vncPrefs === null OR ! isset( $vncPrefs[ IPSSearchRegistry::get('in.search_app') ]['view'] ) OR isset( $this->request['followedItemsOnly'] ) )
- {
- $vncPrefs[ IPSSearchRegistry::get('in.search_app') ]['vncFollowFilter'] = ( ! empty( $this->request['followedItemsOnly'] ) ) ? 1 : 0;
- }
-
- /* Filtering VNC by forum? */
- IPSSearchRegistry::set('forums.vncForumFilters', $vncPrefs['forums']['vnc_forum_filter'] );
-
- /* Set period up */
- IPSSearchRegistry::set('in.period' , $vncPrefs[ IPSSearchRegistry::get('in.search_app') ]['view'] );
- IPSSearchRegistry::set('in.vncFollowFilterOn', $vncPrefs[ IPSSearchRegistry::get('in.search_app') ]['vncFollowFilter'] );
-
- $this->request['userMode'] = !empty($this->request['userMode']) ? $this->request['userMode'] : '';
- IPSSearchRegistry::set('in.userMode' , $this->request['userMode'] );
-
- /* Update member cache */
- if ( isset( $this->request['period'] ) AND isset( $this->request['change'] ) )
- {
- IPSMember::setToMemberCache( $this->memberData, array( 'vncPrefs' => $vncPrefs ) );
- }
-
- IPSDebug::addMessage( var_export( $vncPrefs, true ) );
- IPSDebug::addMessage( 'Using: ' . IPSSearchRegistry::get('in.period') );
-
- /* Can we do this? */
- if ( IPSLib::appIsSearchable( IPSSearchRegistry::get('in.search_app'), 'vnc' ) || IPSLib::appIsSearchable( IPSSearchRegistry::get('in.search_app'), 'active' ) )
- {
- /* Can't do a specific unread search, so */
- if ( IPSSearchRegistry::get('in.period') == 'unread' && ! IPSLib::appIsSearchable( IPSSearchRegistry::get('in.search_app'), 'vncWithUnreadContent' ) )
- {
- IPSSearchRegistry::set( 'in.period', 'lastvisit' );
- }
-
- /* 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();
-
- /* Reset for template */
- $this->_resetRequestParameters();
-
- if( IPSSearchRegistry::get('in.start') > 0 AND !count($results) )
- {
- $new_url = 'app=core&module=search&do=viewNewContent&period=' . IPSSearchRegistry::get('in.period') . '&userMode=' . IPSSearchRegistry::get('in.userMode') . '&search_app=' . IPSSearchRegistry::get('in.search_app') . '&sid=' . $this->request['_sid'];
- $new_url .= '&st=' . ( IPSSearchRegistry::get('in.start') - IPSSearchRegistry::get('opt.search_per_page') ) . '&search_app_filters[' . IPSSearchRegistry::get('in.search_app') . '][searchInKey]=' . $this->request['search_app_filters'][ IPSSearchRegistry::get('in.search_app') ]['searchInKey'];
-
- $this->registry->output->silentRedirect( $this->settings['base_url'] . $new_url );
- }
-
- /* Parse result set */
- $results = $this->registry->output->getTemplate( $template['group'] )->$template['template']( $results, ( IPSSearchRegistry::get('opt.searchType') == 'titles' || 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'),
- //'method' => 'nextPrevious',
- 'baseUrl' => 'app=core&module=search&do=viewNewContent&period=' . IPSSearchRegistry::get('in.period') . '&userMode=' . IPSSearchRegistry::get('in.userMode') . '&search_app=' . IPSSearchRegistry::get('in.search_app') . '&sid=' . $this->request['_sid'] . $this->_returnSearchAppFilters() ) );
-
- /* 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();
- }
-
- /* Add Debug message */
- IPSDebug::addMessage( "View New Content Matches: " . $count );
-
- /* Check for sortIn */
- if( count( $sortIn ) && !$this->request['search_app_filters'][ $this->request['search_app'] ]['searchInKey'] )
- {
- $this->request['search_app_filters'][ $this->request['search_app'] ]['searchInKey'] = $sortIn[0][0];
- }
-
- /* 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' )->newContentView( $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( !empty( $this->request['search_author'] ) )
- {
- $url_string .= "&search_author=" . urlencode($this->request['search_author']);
- }
-
- /* Search Range */
- if( !empty( $this->request['search_date_start'] ) )
- {
- $url_string .= "&search_date_start={$this->request['search_date_start']}";
- }
-
- if( !empty( $this->request['search_date_end'] ) )
- {
- $url_string .= "&search_date_end={$this->request['search_date_end']}";
- }
-
- if( !empty( $this->request['search_app_filters'][ $this->request['search_app'] ]['sortKey'] ) )
- {
- $url_string .= "&search_app_filters[{$this->request['search_app']}][sortKey]=" . $this->request['search_app_filters'][ $this->request['search_app'] ]['sortKey'];
- }
-
- if( !empty( $this->request['search_app_filters'][ $this->request['search_app'] ]['sortDir'] ) )
- {
- $url_string .= "&search_app_filters[{$this->request['search_app']}][sortDir]=" . $this->request['search_app_filters'][ $this->request['search_app'] ]['sortDir'];
- }
-
- /* Contextual Type */
- if ( IPSSearchRegistry::get('contextual.type') )
- {
- $url_string .= "&cType=" . IPSSearchRegistry::get('contextual.type') . "&cId=" . IPSSearchRegistry::get('contextual.id');
- }
-
- /* Content Only */
- if( !empty( $this->request['search_content'] ) )
- {
- $url_string .= "&search_content=" . $this->request['search_content'];
- }
-
- if ( IPSSearchRegistry::get('in.raw_search_tags') )
- {
- $url_string .= "&search_tags=" . urlencode( IPSSearchRegistry::get('in.raw_search_tags') );
- }
-
- /* 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']}";
- }
-
- $url_string .= $this->_returnSearchAppFilters();
-
- /* 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;
- }
-
- /**
- * Return search app filters
- *
- * @return @e string
- */
- protected function _returnSearchAppFilters()
- {
- $url_string = '';
-
- if( isset($this->request['search_app_filters']) AND $this->request['search_app_filters'] )
- {
- foreach( $this->request['search_app_filters'] as $app => $filters )
- {
- if( $app == $this->request['search_app'] AND count($filters) )
- {
- foreach( $filters as $_filterKey => $_filterValue )
- {
- if( is_array($_filterValue) )
- {
- foreach( $_filterValue as $_filterValueKey => $_filterValueValue )
- {
- $url_string .= "&search_app_filters[{$app}][{$_filterKey}][{$_filterValueKey}]={$_filterValueValue}";
- }
- }
- else
- {
- $url_string .= "&search_app_filters[{$app}][{$_filterKey}]={$_filterValue}";
- }
- }
- }
- }
- }
-
- return $url_string;
- }
-
- /**
- * Checks to see if the logged in user is allowed to use the search system
- *
- * @return @e 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'] )
- {
- /* Is it a bot and we're looking for tags? */
- if ( $this->member->is_not_human && ( $this->request['do'] == 'search' && ! empty( $this->request['search_tags'] ) ) )
- {
- return true;
- }
- else
- {
- 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 );
- }
- }
- }
- }
-
- /**
- * Resets params for template
- */
- protected function _resetRequestParameters()
- {
- $this->request['period'] = IPSSearchRegistry::get('in.period');
- $this->request['real_period'] = IPSSearchRegistry::get('in.real_period');
- $this->request['search_app'] = IPSSearchRegistry::get('in.search_app');
- $this->request['vncFollowFilterOn'] = IPSSearchRegistry::get('in.vncFollowFilterOn');
- $this->request['followedItemsOnly'] = IPSSearchRegistry::get('in.vncFollowFilterOn');
- }
-
+
+ * Invision Power Services
+ * IP.Board v3.4.5
+ * Global Search
+ * Last Updated: $Date: 2013-03-20 10:14:51 -0400 (Wed, 20 Mar 2013) $
+ *
+ *
+ * @author $Author: mmecham $
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/company/standards.php#license
+ * @package IP.Board
+ * @subpackage Core
+ * @link http://www.invisionpower.com
+ * @version $Rev: 12094 $
+ */
+
+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
+ */
+ protected $output = '';
+
+ /**
+ * Page Title
+ *
+ * @var string
+ */
+ protected $title = '';
+
+ /**
+ * Object to handle searches
+ *
+ * @var string
+ */
+ protected $search_plugin = '';
+
+ /**
+ * Topics array
+ *
+ * @var array
+ */
+ protected $_topicArray = array();
+ protected $_removedTerms = array();
+
+ /**
+ * Search controller
+ *
+ * @var obj
+ */
+ protected $searchController;
+ protected $_session;
+
+ /**
+ * Class entry point
+ *
+ * @param object Registry reference
+ * @return @e 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'];
+
+ /* Force SQL for view new content? */
+ if ( ! empty( $this->settings['force_sql_vnc'] ) && $this->request['do'] == 'viewNewContent' )
+ {
+ $this->settings['search_method'] = 'sql';
+ }
+
+ $this->request['search_app_filters'] = $this->_cleanInputFilters( $this->request['search_app_filters'] );
+
+ /* 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'] = 'forums';
+ }
+
+ 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;
+ }
+ }
+
+ /* Log type */
+ IPSDebug::addMessage( "Search type: " . $this->settings['search_method'] );
+
+ /* Set up some defaults */
+ IPSSearchRegistry::set('opt.noPostPreview', false );
+ 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 );
+
+ $this->settings['search_ucontent_days'] = ( $this->settings['search_ucontent_days'] ) ? $this->settings['search_ucontent_days'] : 365;
+
+ /* 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 'user_activity':
+ $this->viewUserContent();
+ break;
+
+ case 'new_posts':
+ case 'viewNewContent':
+ case 'active':
+ $this->viewNewContent();
+ break;
+
+ case 'search':
+ case 'quick_search':
+ $this->searchResults();
+ break;
+
+ case 'followed':
+ $this->viewFollowedContent();
+ break;
+
+ case 'manageFollowed':
+ $this->updateFollowedContent();
+ break;
+
+ default:
+ case 'search_form':
+ $this->searchAdvancedForm();
+ break;
+ }
+
+ /* Start session */
+ $this->_endSession();
+
+ /* If we have any HTML to print, do so... */
+ if ( $this->request['do'] == 'search' && ! empty( $this->request['search_tags'] ) )
+ {
+ $this->registry->output->setTitle( IPSText::urldecode_furlSafe( $this->request['search_tags'] ) . ' - ' . $this->lang->words['st_tags'] . ' - ' . IPSLib::getAppTitle( $this->request['search_app'] ) . ' - ' . ipsRegistry::$settings['board_name'] );
+
+ /* Add canonical tag */
+ $extra = ( $this->request['st'] ) ? '&st=' . $this->request['st'] : '';
+ $this->registry->output->addCanonicalTag( 'app=core&module=search&do=search&search_tags=' . IPSText::urlencode_furlSafe( $this->request['search_tags'] ) . '&search_app=' . $this->request['search_app']. $extra, $this->request['search_tags'], 'tags' );
+ }
+ else
+ {
+ $this->registry->output->setTitle( $this->title . ' - ' . ipsRegistry::$settings['board_name'] );
+ }
+
+ $this->registry->output->addContent( $this->output );
+ $this->registry->output->sendOutput();
+ }
+
+ /**
+ * Moderate your list of liked content
+ *
+ * @author bfarber
+ * @return string HTML to display
+ */
+ public function updateFollowedContent()
+ {
+ IPSSearchRegistry::set( 'in.search_app', $this->request['search_app'] );
+
+ //-----------------------------------------
+ // 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->viewFollowedContent( $this->lang->words['no_likes_for_del'] );
+ }
+
+ //-----------------------------------------
+ // Get like helper class
+ //-----------------------------------------
+
+ $bootstraps = array();
+
+ require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
+
+ //-----------------------------------------
+ // 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;
+ default:
+ return $this->viewFollowedContent( $this->lang->words['likes_no_action'] );
+ break;
+ }
+ }
+
+ $this->registry->getClass('output')->silentRedirect( $this->settings['base_url']."app=core&module=search&do=followed&search_app={$this->request['search_app']}&contentType={$this->request['contentType']}&confirm=1" );
+ }
+
+ /**
+ * View content you are following
+ *
+ * @author Brandon Farber
+ * @param string $error Error message
+ * @return @e void
+ */
+ public function viewFollowedContent( $error='' )
+ {
+ IPSSearchRegistry::set( 'in.search_app', $this->request['search_app'] );
+ IPSSearchRegistry::set( 'opt.searchType', 'titles' );
+ IPSSearchRegistry::set( 'opt.noPostPreview', true );
+
+ $results = array();
+ $formatted = array();
+ $count = 0;
+
+ //-----------------------------------------
+ // Determine content type
+ //-----------------------------------------
+
+ $contentTypes = IPSSearchRegistry::get('config.followContentTypes');
+
+ //-----------------------------------------
+ // Verify likes are available
+ //-----------------------------------------
+
+ if( count( IPSLib::getEnabledApplications('like') ) AND count( $contentTypes ) AND IPSLib::appIsInstalled( IPSSearchRegistry::get('in.search_app'), true ) )
+ {
+ //-----------------------------------------
+ // What content type?
+ //-----------------------------------------
+
+ $_type = '';
+
+ if( $this->request['contentType'] AND in_array( $this->request['contentType'], $contentTypes ) )
+ {
+ $_type = $this->request['contentType'];
+ }
+ else
+ {
+ $_type = $contentTypes[0];
+ }
+
+ $this->request['contentType'] = $_type;
+
+ IPSSearchRegistry::set( 'in.followContentType', $this->request['contentType'] );
+
+ /* Fetch like class */
+ try
+ {
+ require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
+ $this->_like = classes_like::bootstrap( IPSSearchRegistry::get('in.search_app'), $_type );
+ }
+ catch ( Exception $e)
+ {
+ /* Fail safe... */
+ $this->registry->output->addNavigation( $this->lang->words['followed_ct_title'], '' );
+ $this->title = $this->lang->words['followed_ct_title'];
+ $this->output .= $this->registry->output->getTemplate( 'search' )->followedContentView( array(), '', 0, $error, $contentTypes );
+ }
+
+ /* Do we have some custom join and sort data? */
+ if ( method_exists( $this->_like, 'getSearchJoinAndSortBy' ) )
+ {
+ $custom = $this->_like->getSearchJoinAndSortBy();
+
+ $countQ = array( 'select' => 'COUNT(*) as er',
+ 'from' => array( 'core_like' => 'l' ),
+ 'where' => 'like_member_id=' . $this->memberData['member_id'] . " AND like_visible=1 AND like_app='" . IPSSearchRegistry::get('in.search_app') . "' AND like_area='" . $_type . "'" );
+ if ( $custom['from'] )
+ {
+ $countQ['add_join'][] = array( 'from' => $custom['from'], 'where' => $custom['where'] );
+ }
+ if ( $custom['order'] )
+ {
+ $countQ['order'] = $custom['order'] . ' DESC';
+ }
+ if ( $custom['extraWhere'] )
+ {
+ $countQ['where'] .= ' AND ' . $custom['extraWhere'];
+ }
+ $count = $this->DB->buildAndFetch( $countQ );
+ $count = $count['er'];
+
+ $q = array( 'select' => 'l.*',
+ 'from' => array('core_like' => 'l'),
+ 'where' => 'l.like_member_id=' . $this->memberData['member_id'] . " AND l.like_visible=1 AND l.like_app='" . IPSSearchRegistry::get('in.search_app') . "' AND l.like_area='" . $_type . "'",
+ 'limit' => array( IPSSearchRegistry::get('in.start'), IPSSearchRegistry::get('opt.search_per_page') ),
+ 'order' => 'like_added DESC'
+ );
+
+ if ( $custom['from'] )
+ {
+ $q['add_join'][] = array( 'from' => $custom['from'], 'where' => $custom['where'] );
+ }
+ if ( $custom['order'] )
+ {
+ $q['order'] = $custom['order'] . ' DESC';
+ }
+ if ( $custom['extraWhere'] )
+ {
+ $q['where'] .= ' AND ' . $custom['extraWhere'];
+ }
+
+ $this->DB->build( $q );
+ }
+ else
+ {
+ $count = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as er',
+ 'from' => 'core_like',
+ 'where' => 'like_member_id=' . $this->memberData['member_id'] . " AND like_visible=1 AND like_app='" . IPSSearchRegistry::get('in.search_app') . "' AND like_area='" . $_type . "'" ) );
+ $count = $count['er'];
+
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'core_like',
+ 'where' => 'like_member_id=' . $this->memberData['member_id'] . " AND like_visible=1 AND like_app='" . IPSSearchRegistry::get('in.search_app') . "' AND like_area='" . $_type . "'",
+ 'limit' => array( IPSSearchRegistry::get('in.start'), IPSSearchRegistry::get('opt.search_per_page') ),
+ 'order' => 'like_added DESC' ) );
+ }
+
+ $outer = $this->DB->execute();
+
+ while( $r = $this->DB->fetch($outer) )
+ {
+ $results[] = $r['like_rel_id'];
+
+ $formatted[ $r['like_id'] ] = $r;
+ }
+
+ /* Process */
+ $results = $this->searchController->fetchFollowedContentOutput( $results, $formatted );
+
+ $pages = $this->registry->getClass('output')->generatePagination( array( 'totalItems' => $count,
+ 'itemsPerPage' => IPSSearchRegistry::get('opt.search_per_page'),
+ 'currentStartValue' => IPSSearchRegistry::get('in.start'),
+ 'baseUrl' => "app=core&module=search&do=followed&search_app=" . IPSSearchRegistry::get('in.search_app') . '&sid=' . $this->request['_sid'] . "&contentType=" . $this->request['contentType'] ) );
+ }
+ else
+ {
+ $count = 0;
+ $results = array();
+ }
+
+ /* Output */
+ $this->registry->output->addNavigation( $this->lang->words['followed_ct_title'], '' );
+ $this->title = $this->lang->words['followed_ct_title'];
+ $this->output .= $this->registry->output->getTemplate( 'search' )->followedContentView( $results, $pages, $count, $error, $contentTypes );
+ }
+
+ /**
+ * Builds the advanced search form
+ *
+ * @param string Message
+ * @return @e 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();
+ $tagSupport = $this->searchController->getTagSupport();
+
+ /* 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, $tagSupport );
+ }
+
+ /**
+ * Processes a search request
+ *
+ * @return @e void
+ */
+ public function searchResults()
+ {
+ /* Search Term */
+ if( isset( $this->request['search_term'] ) && !is_string( $this->request['search_term'] ) )
+ {
+ $this->registry->getClass('output')->showError( 'invalid_search_term', 10312564 );
+ }
+
+ $_st = $this->searchController->formatSearchTerm( trim( $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 );
+ }
+
+ if ( is_array( $this->request['search_app_filters'] ) )
+ {
+ array_walk_recursive( $this->request['search_app_filters'], create_function('&$item, $key', '$item = IPSText::htmlspecialchars($item);' ) );
+ }
+
+ /* 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'] ] ) ? htmlspecialchars( $_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'] ] ) ? htmlspecialchars( $_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.raw_search_tags' , str_replace( '&', '&', trim( IPSText::parseCleanValue( IPSText::urldecode_furlSafe( $_REQUEST['search_tags'] ) ) ) ) );
+ 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' , !empty( $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.searchType', ( !empty( $this->request['search_content'] ) AND in_array( $this->request['search_content'], array( 'both', 'titles', 'content' ) ) ) ? $this->request['search_content'] : 'both' );
+
+ /* 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;
+ }
+
+ /**
+ * Lower limit
+ */
+ if ( $this->settings['min_search_word'] && ! IPSSearchRegistry::get('in.search_author') && ! IPSSearchRegistry::get('in.raw_search_tags') )
+ {
+ if ( $this->settings['search_method'] == 'sphinx' && substr_count( $search_term, '"' ) >= 2 )
+ {
+ $_ok = true;
+ }
+ else
+ {
+ $_words = explode( ' ', preg_replace( "#\"(.*?)\"#", '', $search_term ) );
+ $_ok = $search_term ? true : false;
+
+ foreach( $_words as $_word )
+ {
+ $_word = preg_replace( '#^\+(.+?)$#', "\\1", $_word );
+
+ if ( ! $_word OR $_word == '|' )
+ {
+ continue;
+ }
+
+ 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;
+ }
+ }
+
+ /**
+ * 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['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'] - ( time() - $last_search ) ) );
+ 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 ) );
+
+ /* Got tag search only but app doesn't support tags */
+ if ( IPSSearchRegistry::get('in.raw_search_tags') && ! IPSSearchRegistry::get( 'config.can_searchTags' ) && ! IPSSearchRegistry::get('in.raw_search_term') )
+ {
+ $count = 0;
+ $results = array();
+ }
+ else 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();
+
+ /* Set default sort option */
+ $_a = IPSSearchRegistry::get('in.search_app');
+ $_k = IPSSearchRegistry::get( $_a . '.searchInKey') ? IPSSearchRegistry::get( $_a . '.searchInKey') : '';
+
+ if( $_k AND !$this->request['search_app_filters'][ $_a ][ $_k ]['sortKey'] AND is_array($sortDropDown) AND count($sortDropDown) )
+ {
+ $this->request['search_app_filters'][ $_a ][ $_k ]['sortKey'] = key( $sortDropDown );
+ }
+ else if( !$_k AND !$this->request['search_app_filters'][ $_a ]['sortKey'] AND is_array($sortDropDown) AND count($sortDropDown) )
+ {
+ $this->request['search_app_filters'][ $_a ]['sortKey'] = key( $sortDropDown );
+ }
+
+ /* 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('opt.searchType') == 'titles' || IPSSearchRegistry::get('opt.noPostPreview') ) ? 1 : 0 );
+
+ /* Check for sortIn */
+ if( count( $sortIn ) && !$this->request['search_app_filters'][ $this->request['search_app'] ]['searchInKey'] )
+ {
+ $this->request['search_app_filters'][ $this->request['search_app'] ]['searchInKey'] = $sortIn[0][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'), IPSSearchRegistry::get('in.raw_search_tags') );
+ }
+
+ /**
+ * 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'] = is_array( $this->request['search_app_filters'] ) ? array_merge( $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 @e 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'];
+ }
+ }
+
+ /* Valid search key? */
+ if( !is_string( $key ) )
+ {
+ $this->registry->getClass('output')->showError( 'invalid_search_key', 10312565 );
+ }
+
+ /* Numeric? */
+ if ( is_numeric( $dir ) )
+ {
+ $dir = ( $dir == 0 ) ? 'desc' : 'asc';
+ }
+ else
+ {
+ $dir = 'desc';
+ }
+
+ IPSSearchRegistry::set('in.search_sort_by' , trim( $key ) );
+ IPSSearchRegistry::set('in.search_sort_order', ( $dir != 'desc' ) ? 'asc' : 'desc' );
+ }
+
+ /**
+ * Displays latest user content
+ *
+ * @return @e void
+ */
+ public function viewUserContent()
+ {
+
+ /* INIT */
+ $id = $this->request['mid'] ? intval( trim( $this->request['mid'] ) ) : $this->memberData['member_id'];
+
+ /* Save query if we are viewing our own content */
+ if( $this->memberData['member_id'] AND $id == $this->memberData['member_id'] )
+ {
+ $member = $this->memberData;
+ }
+ else
+ {
+ $member = IPSMember::load( $id, 'core' );
+ }
+
+ $beginStamp = 0;
+
+ if ( ! $member['member_id'] )
+ {
+ $this->registry->output->showError( 'search_invalid_id', 10147, null, null, 403 );
+ }
+
+ $this->request['userMode'] = !empty($this->request['userMode']) ? $this->request['userMode'] : 'all';
+
+ IPSSearchRegistry::set('in.search_app', $this->request['search_app'] );
+ IPSSearchRegistry::set('in.userMode' , $this->request['userMode'] );
+
+ /* Set sort filters */
+ $this->_setSortFilters();
+
+ /* 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 */
+ $sortDropDown = $this->searchController->fetchSortDropDown();
+
+ /* Set default sort option */
+ $_a = IPSSearchRegistry::get('in.search_app');
+ $_k = IPSSearchRegistry::get( $_a . '.searchInKey') ? IPSSearchRegistry::get( $_a . '.searchInKey') : '';
+
+ if( $_k AND !$this->request['search_app_filters'][ $_a ][ $_k ]['sortKey'] AND is_array($sortDropDown) )
+ {
+ $this->request['search_app_filters'][ $_a ][ $_k ]['sortKey'] = key( $sortDropDown );
+ }
+ else if( !$_k AND !$this->request['search_app_filters'][ $_a ]['sortKey'] AND is_array($sortDropDown) )
+ {
+ $this->request['search_app_filters'][ $_a ]['sortKey'] = key( $sortDropDown );
+ }
+
+ /* Fetch sort details */
+ $sortIn = $this->searchController->fetchSortIn();
+
+ /* Reset for template */
+ $this->_resetRequestParameters();
+
+ /* Parse result set */
+ $results = $this->registry->output->getTemplate( $template['group'] )->$template['template']( $results, ( IPSSearchRegistry::get('opt.searchType') == 'titles' || 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'] . $this->_returnSearchAppFilters() ) );
+ }
+ 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, $sortDropDown );
+ }
+
+ /**
+ * View new posts since your last visit
+ *
+ * @return @e void
+ */
+ public function viewNewContent()
+ {
+
+ IPSSearchRegistry::set('in.search_app', $this->request['search_app'] );
+
+ /* Fetch member cache to see if we have a value set */
+ $vncPrefs = IPSMember::getFromMemberCache( $this->memberData, 'vncPrefs' );
+
+ /* Guests */
+ if ( ! $this->memberData['member_id'] AND ( ! $this->request['period'] OR $this->request['period'] == 'unread' ) )
+ {
+ $this->request['period'] = 'today';
+ }
+
+ /* In period */
+ if ( $vncPrefs === null OR ! isset( $vncPrefs[ IPSSearchRegistry::get('in.search_app') ]['view'] ) OR ( ! empty( $this->request['period'] ) AND isset( $this->request['change'] ) ) )
+ {
+ $vncPrefs[ IPSSearchRegistry::get('in.search_app') ]['view'] = ( ! empty( $this->request['period'] ) ) ? $this->request['period'] : $this->settings['default_vnc_method'];
+ }
+
+ /* Follow filter enabled */
+ if ( $vncPrefs === null OR ! isset( $vncPrefs[ IPSSearchRegistry::get('in.search_app') ]['view'] ) OR isset( $this->request['followedItemsOnly'] ) )
+ {
+ $vncPrefs[ IPSSearchRegistry::get('in.search_app') ]['vncFollowFilter'] = ( ! empty( $this->request['followedItemsOnly'] ) ) ? 1 : 0;
+ }
+
+ /* Filtering VNC by forum? */
+ IPSSearchRegistry::set('forums.vncForumFilters', $vncPrefs['forums']['vnc_forum_filter'] );
+
+ /* Set period up */
+ IPSSearchRegistry::set('in.period' , $vncPrefs[ IPSSearchRegistry::get('in.search_app') ]['view'] );
+ IPSSearchRegistry::set('in.vncFollowFilterOn', $vncPrefs[ IPSSearchRegistry::get('in.search_app') ]['vncFollowFilter'] );
+
+ $this->request['userMode'] = !empty($this->request['userMode']) ? $this->request['userMode'] : '';
+ IPSSearchRegistry::set('in.userMode' , $this->request['userMode'] );
+
+ /* Update member cache */
+ if ( isset( $this->request['period'] ) AND isset( $this->request['change'] ) )
+ {
+ IPSMember::setToMemberCache( $this->memberData, array( 'vncPrefs' => $vncPrefs ) );
+ }
+
+ IPSDebug::addMessage( var_export( $vncPrefs, true ) );
+ IPSDebug::addMessage( 'Using: ' . IPSSearchRegistry::get('in.period') );
+
+ /* Can we do this? */
+ if ( IPSLib::appIsSearchable( IPSSearchRegistry::get('in.search_app'), 'vnc' ) || IPSLib::appIsSearchable( IPSSearchRegistry::get('in.search_app'), 'active' ) )
+ {
+ /* Can't do a specific unread search, so */
+ if ( IPSSearchRegistry::get('in.period') == 'unread' && ! IPSLib::appIsSearchable( IPSSearchRegistry::get('in.search_app'), 'vncWithUnreadContent' ) )
+ {
+ IPSSearchRegistry::set( 'in.period', 'lastvisit' );
+ }
+
+ /* 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();
+
+ /* Reset for template */
+ $this->_resetRequestParameters();
+
+ if( IPSSearchRegistry::get('in.start') > 0 AND !count($results) )
+ {
+ $new_url = 'app=core&module=search&do=viewNewContent&period=' . IPSSearchRegistry::get('in.period') . '&userMode=' . IPSSearchRegistry::get('in.userMode') . '&search_app=' . IPSSearchRegistry::get('in.search_app') . '&sid=' . $this->request['_sid'];
+ $new_url .= '&st=' . ( IPSSearchRegistry::get('in.start') - IPSSearchRegistry::get('opt.search_per_page') ) . '&search_app_filters[' . IPSSearchRegistry::get('in.search_app') . '][searchInKey]=' . $this->request['search_app_filters'][ IPSSearchRegistry::get('in.search_app') ]['searchInKey'];
+
+ $this->registry->output->silentRedirect( $this->settings['base_url'] . $new_url );
+ }
+
+ /* Parse result set */
+ $results = $this->registry->output->getTemplate( $template['group'] )->$template['template']( $results, ( IPSSearchRegistry::get('opt.searchType') == 'titles' || 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'),
+ //'method' => 'nextPrevious',
+ 'baseUrl' => 'app=core&module=search&do=viewNewContent&period=' . IPSSearchRegistry::get('in.period') . '&userMode=' . IPSSearchRegistry::get('in.userMode') . '&search_app=' . IPSSearchRegistry::get('in.search_app') . '&sid=' . $this->request['_sid'] . $this->_returnSearchAppFilters() ) );
+
+ /* 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();
+ }
+
+ /* Add Debug message */
+ IPSDebug::addMessage( "View New Content Matches: " . $count );
+
+ /* Check for sortIn */
+ if( count( $sortIn ) && !$this->request['search_app_filters'][ $this->request['search_app'] ]['searchInKey'] )
+ {
+ $this->request['search_app_filters'][ $this->request['search_app'] ]['searchInKey'] = $sortIn[0][0];
+ }
+
+ /* 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' )->newContentView( $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( !empty( $this->request['search_author'] ) )
+ {
+ $url_string .= "&search_author=" . urlencode($this->request['search_author']);
+ }
+
+ /* Search Range */
+ if( !empty( $this->request['search_date_start'] ) )
+ {
+ $url_string .= "&search_date_start={$this->request['search_date_start']}";
+ }
+
+ if( !empty( $this->request['search_date_end'] ) )
+ {
+ $url_string .= "&search_date_end={$this->request['search_date_end']}";
+ }
+
+ if( !empty( $this->request['search_app_filters'][ $this->request['search_app'] ]['sortKey'] ) )
+ {
+ $url_string .= "&search_app_filters[{$this->request['search_app']}][sortKey]=" . $this->request['search_app_filters'][ $this->request['search_app'] ]['sortKey'];
+ }
+
+ if( !empty( $this->request['search_app_filters'][ $this->request['search_app'] ]['sortDir'] ) )
+ {
+ $url_string .= "&search_app_filters[{$this->request['search_app']}][sortDir]=" . $this->request['search_app_filters'][ $this->request['search_app'] ]['sortDir'];
+ }
+
+ /* Contextual Type */
+ if ( IPSSearchRegistry::get('contextual.type') )
+ {
+ $url_string .= "&cType=" . IPSSearchRegistry::get('contextual.type') . "&cId=" . IPSSearchRegistry::get('contextual.id');
+ }
+
+ /* Content Only */
+ if( !empty( $this->request['search_content'] ) )
+ {
+ $url_string .= "&search_content=" . $this->request['search_content'];
+ }
+
+ if ( IPSSearchRegistry::get('in.raw_search_tags') )
+ {
+ $url_string .= "&search_tags=" . urlencode( IPSSearchRegistry::get('in.raw_search_tags') );
+ }
+
+ /* 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']}";
+ }
+
+ $url_string .= $this->_returnSearchAppFilters();
+
+ /* 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;
+ }
+
+ /**
+ * Return search app filters
+ *
+ * @return @e string
+ */
+ protected function _returnSearchAppFilters()
+ {
+ $url_string = '';
+
+ if( isset($this->request['search_app_filters']) AND $this->request['search_app_filters'] )
+ {
+ foreach( $this->request['search_app_filters'] as $app => $filters )
+ {
+ if( $app == $this->request['search_app'] AND is_array( $filters ) AND count($filters) )
+ {
+ foreach( $filters as $_filterKey => $_filterValue )
+ {
+ if( is_array($_filterValue) )
+ {
+ foreach( $_filterValue as $_filterValueKey => $_filterValueValue )
+ {
+ $url_string .= "&search_app_filters[{$app}][{$_filterKey}][{$_filterValueKey}]={$_filterValueValue}";
+ }
+ }
+ else
+ {
+ $url_string .= "&search_app_filters[{$app}][{$_filterKey}]={$_filterValue}";
+ }
+ }
+ }
+ }
+ }
+
+ return $url_string;
+ }
+
+ /**
+ * Checks to see if the logged in user is allowed to use the search system
+ *
+ * @return @e 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'] )
+ {
+ /* Is it a bot and we're looking for tags? */
+ if ( $this->member->is_not_human && ( $this->request['do'] == 'search' && ! empty( $this->request['search_tags'] ) ) )
+ {
+ return true;
+ }
+ else
+ {
+ 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 );
+ }
+ }
+ }
+ }
+
+ /**
+ * Clean search keys and values
+ */
+ protected function _cleanInputFilters( $filters )
+ {
+ if ( is_array( $filters ) )
+ {
+ foreach( $filters as $k => $v )
+ {
+ unset( $filters[ $k ] );
+
+ $k = IPSText::alphanumericalClean( $k );
+
+ if ( is_array( $v ) )
+ {
+ $filters[ $k ] = $this->_cleanInputFilters( $v );
+ }
+ else
+ {
+ $filters[ $k ] = IPSText::htmlspecialchars( $v );
+ }
+ }
+ }
+
+ return $filters;
+ }
+
+ /**
+ * Resets params for template
+ */
+ protected function _resetRequestParameters()
+ {
+ $this->request['period'] = IPSSearchRegistry::get('in.period');
+ $this->request['real_period'] = IPSSearchRegistry::get('in.real_period');
+ $this->request['search_app'] = IPSSearchRegistry::get('in.search_app');
+ $this->request['vncFollowFilterOn'] = IPSSearchRegistry::get('in.vncFollowFilterOn');
+ $this->request['followedItemsOnly'] = IPSSearchRegistry::get('in.vncFollowFilterOn');
+ }
+
+
}
\ 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 799a005a..649c84ed 100644
--- a/upload/admin/applications/core/modules_public/task/manualResolver.php
+++ b/upload/admin/applications/core/modules_public/task/manualResolver.php
@@ -2,9 +2,9 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Task Manager
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
*
*
* @author $Author: bfarber $
@@ -13,7 +13,7 @@
* @package IP.Board
* @subpackage Core
* @link http://www.invisionpower.com
- * @version $Rev: 10914 $
+ * @version $Rev: 10721 $
*
*/
diff --git a/upload/admin/applications/core/modules_public/usercp/manualResolver.php b/upload/admin/applications/core/modules_public/usercp/manualResolver.php
index 8a10bcf8..28fd0d32 100644
--- a/upload/admin/applications/core/modules_public/usercp/manualResolver.php
+++ b/upload/admin/applications/core/modules_public/usercp/manualResolver.php
@@ -3,9 +3,9 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* User control panel resolver
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2013-05-06 14:16:05 -0400 (Mon, 06 May 2013) $
*
*
* @author $Author: bfarber $
@@ -15,7 +15,7 @@
* @subpackage Core
* @link http://www.invisionpower.com
* @since 1st march 2002
- * @version $Revision: 10914 $
+ * @version $Revision: 12229 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -121,6 +121,12 @@ class public_core_usercp_manualResolver extends ipsCommand
}
$__class = IPSLib::loadLibrary( $ext_dir . '/usercpForms.php', 'usercpForms_' . $app_dir, $app_dir );
+
+ if( !class_exists($__class) )
+ {
+ continue;
+ }
+
$_usercp_module = new $__class();
/* Block based on version to prevent old files showing up/causing an error */
diff --git a/upload/admin/applications/core/setup/upgradeCheck.php b/upload/admin/applications/core/setup/upgradeCheck.php
index b817e914..bad82b82 100644
--- a/upload/admin/applications/core/setup/upgradeCheck.php
+++ b/upload/admin/applications/core/setup/upgradeCheck.php
@@ -3,16 +3,16 @@
*
* Invision Power Services
* IP.Board - requirements checker
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2012-05-21 09:09:36 -0400 (Mon, 21 May 2012) $
*
*
- * @author $Author: bfarber $ (Orginal: Mark)
+ * @author $Author: ips_terabyte $ (Orginal: Mark)
* @copyright (c) 2010 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @link http://www.invisionpower.com
* @since 8th September 2010
- * @version $Revision: 10914 $
+ * @version $Revision: 10771 $
*/
class core_upgradeCheck
@@ -61,7 +61,7 @@ class core_upgradeCheck
$appName = ipsRegistry::$applications[ $k ]['app_title'];
$allVersions = IPSSetUp::fetchXmlAppVersions( $k );
- return "The version of {$appName} you have installed will not work with this version of IP.Board. You must upgrade {$appName} to {$allVersions[ $v ]} or higher, or disable it in the Admin CP in order continue.";
+ return "Установленная версия {$appName} не будет работать с этой версией IP.Board. Вы должны обновить {$appName} версии {$allVersions[ $v ]} или выше, или отключить приложение в админцентре для продолжения.";
}
}
}
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 0364f8c1..364475f4 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
@@ -48,24 +48,24 @@ $INSERT[] = "INSERT INTO emoticons (id, typed, image, clickable, emo_set, emo_po
$INSERT[] = "INSERT INTO pfields_data (pf_id, pf_title, pf_desc, pf_content, pf_type, pf_not_null, pf_member_hide, pf_max_input, pf_member_edit, pf_position, pf_show_on_reg, pf_input_format, pf_admin_only, pf_topic_format, pf_group_id, pf_icon, pf_key) VALUES
(1, 'AIM', '', '', 'input', 0, 0, 0, 1, 0, 0, '', 0, '', 1, 'style_extra/cprofile_icons/profile_aim.gif', 'aim'),
(2, 'MSN', '', '', 'input', 0, 0, 0, 1, 0, 0, '', 0, '', 1, 'style_extra/cprofile_icons/profile_msn.gif', 'msn'),
-(3, 'Website URL', '', '', 'input', 0, 0, 0, 1, 0, 0, '', 0, '', 1, 'style_extra/cprofile_icons/profile_website.gif', 'website'),
+(3, 'Сайт', '', '', 'input', 0, 0, 0, 1, 0, 0, '', 0, '', 1, 'style_extra/cprofile_icons/profile_website.gif', 'website'),
(4, 'ICQ', '', '', 'input', 0, 0, 0, 1, 0, 0, '', 0, '', 1, 'style_extra/cprofile_icons/profile_icq.gif', 'icq'),
-(5, 'Gender', '', 'u=Not Telling|m=Male|f=Female', 'drop', 0, 0, 0, 1, 0, 0, '', 0, '', 2, '', 'gender'),
-(6, 'Location', '', '', 'input', 0, 0, 0, 1, 0, 0, '', 0, '{title} {content} ', 2, '', 'location'),
-(7, 'Interests', '', '', 'textarea', 0, 0, 0, 1, 0, 0, '', 0, '', 2, '', 'interests'),
+(5, 'Пол', '', 'u=Не определился|m=Мужчина|f=Женщина', 'drop', 0, 0, 0, 1, 0, 0, '', 0, '', 2, '', 'gender'),
+(6, 'Город', '', '', 'input', 0, 0, 0, 1, 0, 0, '', 0, '{title} {content} ', 2, '', 'location'),
+(7, 'Интересы', '', '', 'textarea', 0, 0, 0, 1, 0, 0, '', 0, '', 2, '', 'interests'),
(8, 'Yahoo', '', '', 'input', 0, 0, 0, 1, 0, 0, '', 0, '', 1, 'style_extra/cprofile_icons/profile_yahoo.gif', 'yahoo'),
(9, 'Jabber', '', '', 'input', 0, 0, 0, 1, 0, 0, '', 0, '', 1, 'style_extra/cprofile_icons/profile_jabber.gif', 'jabber'),
(10, 'Skype', '', '', 'input', 0, 0, 0, 1, 0, 0, '', 0, '', 1, 'style_extra/cprofile_icons/profile_skype.gif', 'skype')";
$INSERT[] = "INSERT INTO pfields_groups (pf_group_id, pf_group_name, pf_group_key) VALUES
-(1, 'Contact Methods', 'contact'),
-(2, 'Profile Information', 'profile_info')";
+(1, 'Контакты', 'contact'),
+(2, 'Информация', 'profile_info')";
-$INSERT[] = "INSERT INTO core_sys_lang VALUES(1, 'en_US', 'English (USA)', 1, 0, 1)";
+$INSERT[] = "INSERT INTO core_sys_lang VALUES(1, 'ru_RU.UTF-8', 'Русский (RU)', 1, 0, 1)";
-$INSERT[] = "INSERT INTO titles (id, posts, title, pips) VALUES (1, 0, 'Newbie', '1');";
-$INSERT[] = "INSERT INTO titles (id, posts, title, pips) VALUES (2, 10, 'Member', '2');";
-$INSERT[] = "INSERT INTO titles (id, posts, title, pips) VALUES (4, 30, 'Advanced Member', '3');";
+$INSERT[] = "INSERT INTO titles (id, posts, title, pips) VALUES (1, 0, 'Новичок', '1');";
+$INSERT[] = "INSERT INTO titles (id, posts, title, pips) VALUES (2, 10, 'Пользователь', '2');";
+$INSERT[] = "INSERT INTO titles (id, posts, title, pips) VALUES (4, 30, 'Продвинутый пользователь', '3');";
$INSERT[] ="INSERT INTO permission_index VALUES(1, 'members', 'profile_view', 1, '*', '', '', '', '', '', '', 0, 0, NULL)";
$INSERT[] ="INSERT INTO permission_index VALUES(2, 'core', 'help', 1, '*', '', '', '', '', '', '', 0, 0, NULL)";
@@ -74,25 +74,25 @@ $INSERT[] ="INSERT INTO permission_index VALUES(2, 'core', 'help', 1, '*', '', '
$INSERT[] = <<getPrefix()."cache_store (
+ /*$SQL[]="create table ".ipsRegistry::dbFunctions()->getPrefix()."cache_store (
cs_key varchar(255) NOT NULL default '',
cs_value text NULL,
cs_extra varchar(255) NOT NULL default '',
PRIMARY KEY(cs_key)
- );";
+ );";*/
$SQL[]="create table ".ipsRegistry::dbFunctions()->getPrefix()."email_logs (
email_id int(10) NOT NULL auto_increment,
@@ -934,7 +934,7 @@ class version_upgrade
function step_6()
{
- $SQL[] = "alter table ".ipsRegistry::dbFunctions()->getPrefix()."macro rename ibf_skin_macro;";
+ $SQL[] = "alter table ".ipsRegistry::dbFunctions()->getPrefix()."macro rename ".ipsRegistry::dbFunctions()->getPrefix()."skin_macro;";
$SQL[] = "alter table ".ipsRegistry::dbFunctions()->getPrefix()."skin_macro change can_remove macro_can_remove tinyint(1) default '0';";
$SQL[] = "alter table ".ipsRegistry::dbFunctions()->getPrefix()."groups add g_bypass_badwords tinyint(1) NOT NULL default '0';";
$SQL[] = "alter table ".ipsRegistry::dbFunctions()->getPrefix()."cache_store change cs_value cs_value mediumtext NULL;";
@@ -1739,6 +1739,53 @@ class version_upgrade
function step_17()
{
+ if( !ipsRegistry::DB()->checkForTable('pfields_content') )
+ {
+ $SQL[] = "CREATE TABLE ".ipsRegistry::dbFunctions()->getPrefix()."pfields_content ( member_id mediumint(8) NOT NULL default 0, PRIMARY KEY (member_id) );";
+ }
+
+ if( !ipsRegistry::DB()->checkForTable('pfields_data') )
+ {
+ $SQL[] = "CREATE TABLE ".ipsRegistry::dbFunctions()->getPrefix()."pfields_data (
+ pf_id smallint(5) NOT NULL auto_increment,
+ pf_title varchar(250) NOT NULL default '',
+ pf_desc varchar(250) NOT NULL default '',
+ pf_content text,
+ pf_type varchar(250) NOT NULL default '',
+ pf_not_null tinyint(1) NOT NULL default 0,
+ pf_member_hide tinyint(1) NOT NULL default 0,
+ pf_max_input smallint(6) NOT NULL default 0,
+ pf_member_edit tinyint(1) NOT NULL default 0,
+ pf_position smallint(6) NOT NULL default 0,
+ pf_show_on_reg tinyint(1) NOT NULL default 0,
+ pf_input_format text,
+ pf_admin_only tinyint(1) NOT NULL default 0,
+ pf_topic_format text,
+ pf_group_id mediumint(4) unsigned NOT NULL,
+ pf_icon varchar(255) default NULL,
+ pf_key varchar(255) default NULL,
+ pf_search_type varchar(5) NOT NULL default 'loose',
+ pf_filtering TINYINT( 1 ) NOT NULL DEFAULT '0',
+ PRIMARY KEY (pf_id)
+ );";
+ }
+
+ if( !ipsRegistry::DB()->checkForTable('warn_logs') )
+ {
+ $SQL[] = "CREATE TABLE ".ipsRegistry::dbFunctions()->getPrefix()."warn_logs (
+ wlog_id int(10) NOT NULL auto_increment,
+ wlog_mid mediumint(8) NOT NULL default 0,
+ wlog_notes text,
+ wlog_contact varchar(250) NOT NULL default 'none',
+ wlog_contact_content text,
+ wlog_date int(10) NOT NULL default 0,
+ wlog_type varchar(6) NOT NULL default 'pos',
+ wlog_addedby mediumint(8) NOT NULL default 0,
+ PRIMARY KEY (wlog_id),
+ KEY wlog_mid (wlog_mid, wlog_date)
+ );";
+ }
+
$SQL[] = "alter table ".ipsRegistry::dbFunctions()->getPrefix()."groups add g_attach_per_post int(10) NOT NULL default '0';";
$SQL[] = "alter table ".ipsRegistry::dbFunctions()->getPrefix()."topic_mmod add topic_approve tinyint(1) NOT NULL default '0';";
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 d5f05a1b..d2559263 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,7 +2,7 @@
/*
+--------------------------------------------------------------------------
-| IP.Board v3.3.4
+| IP.Board v3.4.5
| ========================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services
@@ -714,7 +714,7 @@ class version_upgrade
function step_6()
{
- $SQL[] = "alter table ".ipsRegistry::dbFunctions()->getPrefix()."macro rename ibf_skin_macro;";
+ $SQL[] = "alter table ".ipsRegistry::dbFunctions()->getPrefix()."macro rename ".ipsRegistry::dbFunctions()->getPrefix()."skin_macro;";
$SQL[] = "alter table ".ipsRegistry::dbFunctions()->getPrefix()."skin_macro change can_remove macro_can_remove tinyint(1) default '0';";
$SQL[] = "alter table ".ipsRegistry::dbFunctions()->getPrefix()."groups add g_bypass_badwords tinyint(1) NOT NULL default '0';";
$SQL[] = "alter table ".ipsRegistry::dbFunctions()->getPrefix()."cache_store change cs_value cs_value mediumtext NULL;";
@@ -1530,6 +1530,53 @@ class version_upgrade
function step_17()
{
+ if( !ipsRegistry::DB()->checkForTable('pfields_content') )
+ {
+ $SQL[] = "CREATE TABLE ".ipsRegistry::dbFunctions()->getPrefix()."pfields_content ( member_id mediumint(8) NOT NULL default 0, PRIMARY KEY (member_id) );";
+ }
+
+ if( !ipsRegistry::DB()->checkForTable('pfields_data') )
+ {
+ $SQL[] = "CREATE TABLE ".ipsRegistry::dbFunctions()->getPrefix()."pfields_data (
+ pf_id smallint(5) NOT NULL auto_increment,
+ pf_title varchar(250) NOT NULL default '',
+ pf_desc varchar(250) NOT NULL default '',
+ pf_content text,
+ pf_type varchar(250) NOT NULL default '',
+ pf_not_null tinyint(1) NOT NULL default 0,
+ pf_member_hide tinyint(1) NOT NULL default 0,
+ pf_max_input smallint(6) NOT NULL default 0,
+ pf_member_edit tinyint(1) NOT NULL default 0,
+ pf_position smallint(6) NOT NULL default 0,
+ pf_show_on_reg tinyint(1) NOT NULL default 0,
+ pf_input_format text,
+ pf_admin_only tinyint(1) NOT NULL default 0,
+ pf_topic_format text,
+ pf_group_id mediumint(4) unsigned NOT NULL,
+ pf_icon varchar(255) default NULL,
+ pf_key varchar(255) default NULL,
+ pf_search_type varchar(5) NOT NULL default 'loose',
+ pf_filtering TINYINT( 1 ) NOT NULL DEFAULT '0',
+ PRIMARY KEY (pf_id)
+ );";
+ }
+
+ if( !ipsRegistry::DB()->checkForTable('warn_logs') )
+ {
+ $SQL[] = "CREATE TABLE ".ipsRegistry::dbFunctions()->getPrefix()."warn_logs (
+ wlog_id int(10) NOT NULL auto_increment,
+ wlog_mid mediumint(8) NOT NULL default 0,
+ wlog_notes text,
+ wlog_contact varchar(250) NOT NULL default 'none',
+ wlog_contact_content text,
+ wlog_date int(10) NOT NULL default 0,
+ wlog_type varchar(6) NOT NULL default 'pos',
+ wlog_addedby mediumint(8) NOT NULL default 0,
+ PRIMARY KEY (wlog_id),
+ KEY wlog_mid (wlog_mid, wlog_date)
+ );";
+ }
+
$SQL[] = "alter table ".ipsRegistry::dbFunctions()->getPrefix()."groups add g_attach_per_post int(10) NOT NULL default '0';";
$SQL[] = "alter table ".ipsRegistry::dbFunctions()->getPrefix()."topic_mmod add topic_approve tinyint(1) NOT NULL default '0';";
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 1d2a653c..5e6ca57b 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,7 +2,7 @@
/*
+--------------------------------------------------------------------------
-| IP.Board v3.3.4
+| IP.Board v3.4.5
| ========================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services
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 0b8201bc..992bbb0e 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,7 +2,7 @@
/*
+--------------------------------------------------------------------------
-| IP.Board v3.3.4
+| IP.Board v3.4.5
| ========================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services
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 94cc3439..0ee24752 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
@@ -2,7 +2,7 @@
/*
+--------------------------------------------------------------------------
-| IP.Board v3.3.4
+| IP.Board v3.4.5
| ========================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services
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 00c4d9c7..f2981ed3 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,7 +1,7 @@
IPB UPGRADE MODULE:: IPB 2.0.2 -> IPB 2.0.3
-| > 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();
-}
-
-class version_upgrade
-{
- /**
- * Custom HTML to show
- *
- * @var string
- */
- protected $_output = '';
-
- /**
- * fetchs output
- *
- * @return string
- */
- public function fetchOutput()
- {
- return $this->_output;
- }
-
- /**
- * Execute selected method
- *
- * @param object Registry object
- * @return @e void
- */
- 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->cache = $this->registry->cache();
- $this->caches =& $this->registry->cache()->fetchCaches();
-
- //--------------------------------
- // What are we doing?
- //--------------------------------
-
- switch( $this->request['workact'] )
- {
- case 'sql':
- $this->upgrade_sql(1);
- break;
- case 'sql1':
- $this->upgrade_sql(1);
- break;
- case 'sql2':
- $this->upgrade_sql(2);
- break;
- case 'sql3':
- $this->upgrade_sql(3);
- break;
- case 'sql4':
- $this->upgrade_sql(4);
- break;
- case 'polls':
- $this->convert_polls();
- break;
- case 'calevents':
- $this->convert_calevents();
- break;
- case 'skin':
- $this->add_skin();
- break;
-
- default:
- $this->upgrade_sql(1);
- break;
- }
-
- if ( $this->request['workact'] )
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-
-
- /*-------------------------------------------------------------------------*/
- // SQL: 0
- /*-------------------------------------------------------------------------*/
-
- function upgrade_sql( $id=1 )
- {
- $man = 0; // Manual upgrade ? intval( $this->request['man'] );
- $cnt = 0;
- $SQL = array();
- $file = '_updates_'.$id.'.php';
- $output = "";
- $path = IPSLib::getAppDir( 'core' ) . '/setup/versions/upg_21003/' . strtolower( $this->registry->dbFunctions()->getDriverType() ) . $file;
- $prefix = $this->registry->dbFunctions()->getPrefix();
-
- if ( is_file( $path ) )
- {
- require( $path );/*noLibHook*/
-
- $this->error = array();
- $this->sqlcount = 0;
- $output = "";
-
- $this->DB->return_die = 1;
-
- foreach( $SQL as $query )
- {
- $this->DB->allow_sub_select = 1;
- $this->DB->error = '';
-
- $query = str_replace( "<%time%>", time(), $query );
-
- /* Need to tack on a prefix? */
- if ( $prefix )
- {
- $query = IPSSetUp::addPrefixToQuery( $query, $prefix );
- }
-
- if ( IPSSetUp::getSavedData('man') )
- {
- $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 );
- }
- else
- {
- $this->sqlcount++;
- }
- }
- }
-
- $this->registry->output->addMessage("{$this->sqlcount} queries ran....");
- }
-
- //--------------------------------
- // Next page...
- //--------------------------------
-
- $this->request['st'] = 0;
-
- if ( $id != 4 )
- {
- $nextid = $id + 1;
- $this->request['workact'] = 'sql'.$nextid;
- }
- else
- {
- $this->request['workact'] = 'polls';
- }
-
- if ( IPSSetUp::getSavedData('man') AND $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 );
- }
- }
-
-
- /*-------------------------------------------------------------------------*/
- // POLLS
- /*-------------------------------------------------------------------------*/
-
- function convert_polls()
- {
- $start = intval($this->request['st']) > 0 ? intval($this->request['st']) : 0;
- $lend = 50;
- $end = $start + $lend;
- $max = intval(IPSSetUp::getSavedData('max'));
- $converted = intval(IPSSetUp::getSavedData('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'];
- }
-
- //-----------------------------------------
- // In steps...
- //-----------------------------------------
-
- $this->DB->build( array( 'select' => '*',
- 'from' => 'topics',
- 'where' => "poll_state IN ('open', 'close', 'closed' )",
- 'limit' => array( 0, $lend ) ) );
- $o = $this->DB->execute();
-
- //-----------------------------------------
- // Do it...
- //-----------------------------------------
-
- if ( $this->DB->getTotalRows($o) )
- {
- //-----------------------------------------
- // Got some to convert!
- //-----------------------------------------
-
- while ( $r = $this->DB->fetch($o) )
- {
- $converted++;
-
- //-----------------------------------------
- // All done?
- //-----------------------------------------
-
- if ( $converted >= $max )
- {
- $done = 1;
- }
-
- $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'] );
- }
- }
- }
- else
- {
- $done = 1;
- }
-
-
- if ( ! $done )
- {
- $this->registry->output->addMessage("Polls: $start to $end completed....");
- $this->request['workact'] = 'polls';
- $this->request['st'] = $end;
- IPSSetUp::setSavedData('max', $max);
- IPSSetUp::setSavedData('conv', $converted);
- return FALSE;
- }
- else
- {
- $this->registry->output->addMessage("Polls converted, proceeding to calendar events...");
- $this->request['workact'] = 'calevents';
- $this->request['st'] = '0';
- return FALSE;
- }
- }
-
-
- /*-------------------------------------------------------------------------*/
- // CALENDAR EVENTS
- /*-------------------------------------------------------------------------*/
-
- function convert_calevents()
- {
- $start = intval($this->request['st']) > 0 ? intval($this->request['st']) : 0;
- $lend = 50;
- $end = $start + $lend;
-
- //-----------------------------------------
- // 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(11, 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->addMessage("Calendar events: $start to $end completed....");
- $this->request['workact'] = 'calevents';
- $this->request['st'] = $end;
- return FALSE;
- }
- else
- {
- $this->registry->output->addMessage("Calendar events converted, Creating new IPB 2.1 skin...");
- $this->request['workact'] = 'skin';
- return FALSE;
- }
- }
-
-
-
- /*-------------------------------------------------------------------------*/
- // CALENDAR EVENTS
- /*-------------------------------------------------------------------------*/
-
- function add_skin()
- {
- $this->registry->output->addMessage("Skipping 2.1 skin creation (latest skin will be inserted later)...");
- unset($this->request['workact']);
- return TRUE;
- }
+ IPB UPGRADE MODULE:: IPB 2.0.2 -> IPB 2.0.3
+| > 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();
+}
+
+class version_upgrade
+{
+ /**
+ * Custom HTML to show
+ *
+ * @var string
+ */
+ protected $_output = '';
+
+ /**
+ * fetchs output
+ *
+ * @return string
+ */
+ public function fetchOutput()
+ {
+ return $this->_output;
+ }
+
+ /**
+ * Execute selected method
+ *
+ * @param object Registry object
+ * @return @e void
+ */
+ 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->cache = $this->registry->cache();
+ $this->caches =& $this->registry->cache()->fetchCaches();
+
+ //--------------------------------
+ // What are we doing?
+ //--------------------------------
+
+ switch( $this->request['workact'] )
+ {
+ case 'sql':
+ $this->upgrade_sql(1);
+ break;
+ case 'sql1':
+ $this->upgrade_sql(1);
+ break;
+ case 'sql2':
+ $this->upgrade_sql(2);
+ break;
+ case 'sql3':
+ $this->upgrade_sql(3);
+ break;
+ case 'sql4':
+ $this->upgrade_sql(4);
+ break;
+ case 'polls':
+ $this->convert_polls();
+ break;
+ case 'calevents':
+ $this->convert_calevents();
+ break;
+ case 'skin':
+ $this->add_skin();
+ break;
+
+ default:
+ $this->upgrade_sql(1);
+ break;
+ }
+
+ if ( $this->request['workact'] )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+
+ /*-------------------------------------------------------------------------*/
+ // SQL: 0
+ /*-------------------------------------------------------------------------*/
+
+ function upgrade_sql( $id=1 )
+ {
+ $man = 0; // Manual upgrade ? intval( $this->request['man'] );
+ $cnt = 0;
+ $SQL = array();
+ $file = '_updates_'.$id.'.php';
+ $output = "";
+ $path = IPSLib::getAppDir( 'core' ) . '/setup/versions/upg_21003/' . strtolower( $this->registry->dbFunctions()->getDriverType() ) . $file;
+ $prefix = $this->registry->dbFunctions()->getPrefix();
+
+ if ( is_file( $path ) )
+ {
+ require( $path );/*noLibHook*/
+
+ $this->error = array();
+ $this->sqlcount = 0;
+ $output = "";
+
+ $this->DB->return_die = 1;
+
+ foreach( $SQL as $query )
+ {
+ $this->DB->allow_sub_select = 1;
+ $this->DB->error = '';
+
+ $query = str_replace( "<%time%>", time(), $query );
+
+ /* Need to tack on a prefix? */
+ if ( $prefix )
+ {
+ $query = IPSSetUp::addPrefixToQuery( $query, $prefix );
+ }
+
+ if ( IPSSetUp::getSavedData('man') )
+ {
+ $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 );
+ }
+ else
+ {
+ $this->sqlcount++;
+ }
+ }
+ }
+
+ $this->registry->output->addMessage("{$this->sqlcount} запросов выполнено....");
+ }
+
+ //--------------------------------
+ // Next page...
+ //--------------------------------
+
+ $this->request['st'] = 0;
+
+ if ( $id != 4 )
+ {
+ $nextid = $id + 1;
+ $this->request['workact'] = 'sql'.$nextid;
+ }
+ else
+ {
+ $this->request['workact'] = 'polls';
+ }
+
+ if ( IPSSetUp::getSavedData('man') AND $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 );
+ }
+ }
+
+
+ /*-------------------------------------------------------------------------*/
+ // POLLS
+ /*-------------------------------------------------------------------------*/
+
+ function convert_polls()
+ {
+ $start = intval($this->request['st']) > 0 ? intval($this->request['st']) : 0;
+ $lend = 50;
+ $end = $start + $lend;
+ $max = intval(IPSSetUp::getSavedData('max'));
+ $converted = intval(IPSSetUp::getSavedData('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'];
+ }
+
+ //-----------------------------------------
+ // In steps...
+ //-----------------------------------------
+
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'topics',
+ 'where' => "poll_state IN ('open', 'close', 'closed' )",
+ 'limit' => array( 0, $lend ) ) );
+ $o = $this->DB->execute();
+
+ //-----------------------------------------
+ // Do it...
+ //-----------------------------------------
+
+ if ( $this->DB->getTotalRows($o) )
+ {
+ //-----------------------------------------
+ // Got some to convert!
+ //-----------------------------------------
+
+ while ( $r = $this->DB->fetch($o) )
+ {
+ $converted++;
+
+ //-----------------------------------------
+ // All done?
+ //-----------------------------------------
+
+ if ( $converted >= $max )
+ {
+ $done = 1;
+ }
+
+ $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'] );
+ }
+ }
+ }
+ else
+ {
+ $done = 1;
+ }
+
+
+ if ( ! $done )
+ {
+ $this->registry->output->addMessage("Polls: $start to $end completed....");
+ $this->request['workact'] = 'polls';
+ $this->request['st'] = $end;
+ IPSSetUp::setSavedData('max', $max);
+ IPSSetUp::setSavedData('conv', $converted);
+ return FALSE;
+ }
+ else
+ {
+ $this->registry->output->addMessage("Polls converted, proceeding to calendar events...");
+ $this->request['workact'] = 'calevents';
+ $this->request['st'] = '0';
+ return FALSE;
+ }
+ }
+
+
+ /*-------------------------------------------------------------------------*/
+ // CALENDAR EVENTS
+ /*-------------------------------------------------------------------------*/
+
+ function convert_calevents()
+ {
+ $start = intval($this->request['st']) > 0 ? intval($this->request['st']) : 0;
+ $lend = 50;
+ $end = $start + $lend;
+
+ //-----------------------------------------
+ // In steps...
+ //-----------------------------------------
+
+ if( !$this->DB->checkForTable('calendar_events') )
+ {
+ $this->registry->output->addMessage("События календаря не найдены, Создается новый стиль внешнего вида IPB 2.1...");
+ $this->request['workact'] = 'skin';
+ return FALSE;
+ }
+
+ $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(11, 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->addMessage("Calendar events: $start to $end completed....");
+ $this->request['workact'] = 'calevents';
+ $this->request['st'] = $end;
+ return FALSE;
+ }
+ else
+ {
+ $this->registry->output->addMessage("Calendar events converted, Creating new IPB 2.1 skin...");
+ $this->request['workact'] = 'skin';
+ return FALSE;
+ }
+ }
+
+
+
+ /*-------------------------------------------------------------------------*/
+ // CALENDAR EVENTS
+ /*-------------------------------------------------------------------------*/
+
+ function add_skin()
+ {
+ $this->registry->output->addMessage("Skipping 2.1 skin creation (latest skin will be inserted later)...");
+ unset($this->request['workact']);
+ return TRUE;
+ }
}
\ 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 ac5e7214..8b28c54c 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,7 +1,7 @@
Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class version_upgrade
-{
- /**
- * Custom HTML to show
- *
- * @var string
- */
- protected $_output = '';
-
- /**
- * fetchs output
- *
- * @return string
- */
- public function fetchOutput()
- {
- return $this->_output;
- }
-
- /**
- * Execute selected method
- *
- * @param object Registry object
- * @return @e void
- */
- 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->cache = $this->registry->cache();
- $this->caches =& $this->registry->cache()->fetchCaches();
-
- //-----------------------------------------
- // Remove dupe categories
- //-----------------------------------------
-
- $title_id_to_keep = array();
- $title_id_to_delete = array();
- $title_deleted_count = 0;
- $msg = '';
-
- $this->DB->build( array( 'select' => '*', 'from' => 'conf_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'];
- }
- else
- {
- $title_id_to_keep[ $r['conf_title_title'] ] = $r['conf_title_id'];
- }
- }
-
- if ( count( $title_id_to_delete ) )
- {
- $this->DB->delete( 'conf_settings_titles', 'conf_title_id IN ('.implode( ',', $title_id_to_delete ).')' );
- }
-
- $title_deleted_count = intval( count($title_id_to_delete) );
-
- $this->registry->output->addMessage("$title_deleted_count duplicate settings deleted");
-
- return true;
- }
+Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class version_upgrade
+{
+ /**
+ * Custom HTML to show
+ *
+ * @var string
+ */
+ protected $_output = '';
+
+ /**
+ * fetchs output
+ *
+ * @return string
+ */
+ public function fetchOutput()
+ {
+ return $this->_output;
+ }
+
+ /**
+ * Execute selected method
+ *
+ * @param object Registry object
+ * @return @e void
+ */
+ 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->cache = $this->registry->cache();
+ $this->caches =& $this->registry->cache()->fetchCaches();
+
+ //-----------------------------------------
+ // Remove dupe categories
+ //-----------------------------------------
+
+ $title_id_to_keep = array();
+ $title_id_to_delete = array();
+ $title_deleted_count = 0;
+ $msg = '';
+
+ $this->DB->build( array( 'select' => '*', 'from' => 'conf_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'];
+ }
+ else
+ {
+ $title_id_to_keep[ $r['conf_title_title'] ] = $r['conf_title_id'];
+ }
+ }
+
+ if ( count( $title_id_to_delete ) )
+ {
+ $this->DB->delete( 'conf_settings_titles', 'conf_title_id IN ('.implode( ',', $title_id_to_delete ).')' );
+ }
+
+ $title_deleted_count = intval( count($title_id_to_delete) );
+
+ $this->registry->output->addMessage("$title_deleted_count дубликатов настроек удалено");
+
+ return true;
+ }
}
\ No newline at end of file
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 caa981c8..745f1b7d 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,7 +1,7 @@
Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class version_upgrade
-{
- /**
- * Custom HTML to show
- *
- * @var string
- */
- private $_output = '';
-
- /**
- * fetchs output
- *
- * @return string
- */
- public function fetchOutput()
- {
- return $this->_output;
- }
-
- /**
- * Execute selected method
- *
- * @param object Registry object
- * @return @e void
- */
- 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->cache = $this->registry->cache();
- $this->caches =& $this->registry->cache()->fetchCaches();
-
- /* Set DB driver to return any errors */
- $this->DB->return_die = 1;
-
- //--------------------------------
- // What are we doing?
- //--------------------------------
-
- switch( $this->request['workact'] )
- {
- case 'sql':
- $this->upgrade_sql(1);
- break;
- case 'sql1':
- $this->upgrade_sql(1);
- break;
- case 'sql2':
- $this->upgrade_sql(2);
- break;
- case 'sql3':
- $this->upgrade_sql(3);
- break;
- case 'sql4':
- $this->upgrade_sql(4);
- break;
- case 'forums':
- $this->update_forums();
- break;
- case 'finish':
- $this->finish_up();
- break;
- case 'skin':
- $this->add_skin();
- break;
- case 'update_template_bits':
- $this->update_template_bits();
- break;
-
- default:
- $this->upgrade_sql(1);
- break;
- }
-
- if ( $this->request['workact'] )
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-
-
- /*-------------------------------------------------------------------------*/
- // SQL: 0
- /*-------------------------------------------------------------------------*/
-
- function upgrade_sql( $id=1 )
- {
- $man = 0; // Manual upgrade ? intval( $this->request['man'] );
- $cnt = 0;
- $SQL = array();
- $file = '_updates_'.$id.'.php';
- $output = "";
- $path = IPSLib::getAppDir( 'core' ) . '/setup/versions/upg_22005/' . strtolower( $this->registry->dbFunctions()->getDriverType() ) . $file;
- $prefix = $this->registry->dbFunctions()->getPrefix();
-
- if ( is_file( $path ) )
- {
- require_once( $path );/*noLibHook*/
-
- $this->sqlcount = 0;
- $output = "";
-
- $this->DB->return_die = 1;
-
- foreach( $SQL as $query )
- {
- $this->DB->allow_sub_select = 1;
- $this->DB->error = '';
-
- $query = str_replace( "<%time%>", time(), $query );
-
- if( $this->settings['mysql_tbl_type'] )
- {
- if( preg_match( "/^create table(.+?)/i", $query ) )
- {
- $query = preg_replace( "/^(.+?)\);$/is", "\\1) ENGINE={$this->settings['mysql_tbl_type']};", $query );
- }
- }
-
- /* Need to tack on a prefix? */
- if ( $prefix )
- {
- $query = IPSSetUp::addPrefixToQuery( $query, $prefix );
- }
-
- if ( IPSSetUp::getSavedData('man') )
- {
- $output .= preg_replace( "/\s{1,}/", " ", $query ) ."\n\n";
- }
- else
- {
- $this->DB->query( $query );
-
- if ( $this->DB->error )
- {
- $this->registry->output->addError( $query." ".$this->DB->error );
- }
- else
- {
- $this->sqlcount++;
- }
- }
- }
-
- $this->registry->output->addMessage("$this->sqlcount queries ran....");
- }
-
- //--------------------------------
- // Next page...
- //--------------------------------
-
- $this->request['st'] = 0;
-
- if ( $id != 4 )
- {
- $nextid = $id + 1;
- $this->request['workact'] = 'sql'.$nextid;
- }
- else
- {
- $this->request['workact'] = 'forums';
- }
-
- if ( IPSSetUp::getSavedData('man') AND $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 );
- }
- }
-
-
- /*-------------------------------------------------------------------------*/
- // Update forums
- /*-------------------------------------------------------------------------*/
-
- function update_forums()
- {
- //-----------------------------------------
- // Update latest news...
- //-----------------------------------------
-
- $this->DB->update( "forums", "newest_title=last_title, newest_id=last_id", 'last_title IS NOT NULL AND last_id IS NOT NULL', false, true );
- $this->DB->execute();
-
- //-----------------------------------------
- // INIT
- //-----------------------------------------
-
- $ignore_me = array( 'redirect_url', 'redirect_loc', 'rules_text', 'permission_custom_error', 'notify_modq_emails' );
-
- if ( !empty($this->settings['forum_cache_minimum']) )
- {
- $ignore_me[] = 'description';
- $ignore_me[] = 'rules_title';
- }
-
- $this->caches['forum_cache'] = array();
-
- $this->DB->build( array( 'select' => '*',
- 'from' => 'forums',
- 'order' => 'parent_id, position'
- ) );
- $o = $this->DB->execute();
-
- while( $f = $this->DB->fetch( $o ) )
- {
- $fr = array();
-
- $perms = unserialize(stripslashes($f['permission_array']));
-
- //-----------------------------------------
- // Stuff we don't need...
- //-----------------------------------------
-
- if ( $f['parent_id'] == -1 )
- {
- $fr['id'] = $f['id'];
- $fr['sub_can_post'] = $f['sub_can_post'];
- $fr['name'] = $f['name'];
- $fr['parent_id'] = $f['parent_id'];
- $fr['show_perms'] = $perms['show_perms'];
- $fr['skin_id'] = $f['skin_id'];
- $fr['permission_showtopic'] = $f['permission_showtopic'];
- }
- else
- {
- foreach( $f as $k => $v )
- {
- if ( in_array( $k, $ignore_me ) )
- {
- continue;
- }
- else
- {
- if ( $v != "" )
- {
- $fr[ $k ] = $v;
- }
- }
- }
-
- $fr['read_perms'] = isset($perms['read_perms']) ? $perms['read_perms'] : '';
- $fr['reply_perms'] = isset($perms['reply_perms']) ? $perms['reply_perms'] : '';
- $fr['start_perms'] = isset($perms['start_perms']) ? $perms['start_perms'] : '';
- $fr['upload_perms'] = isset($perms['upload_perms']) ? $perms['upload_perms'] : '';
- $fr['download_perms'] = $perms['upload_perms'];
- $fr['show_perms'] = isset($perms['show_perms']) ? $perms['show_perms'] : '';
-
- unset($fr['permission_array']);
- }
-
- $this->caches['forum_cache'][ $fr['id'] ] = $fr;
-
- $perm_array = addslashes(serialize(array(
- 'start_perms' => $fr['start_perms'],
- 'reply_perms' => $fr['reply_perms'],
- 'read_perms' => $fr['read_perms'],
- 'upload_perms' => $fr['upload_perms'],
- 'download_perms' => $fr['download_perms'],
- 'show_perms' => $fr['show_perms']
- ) ) );
-
- //-----------------------------------------
- // Add to save array
- //-----------------------------------------
-
- $this->DB->update( 'forums', array( 'permission_array' => $perm_array ), 'id='.$fr['id'] );
-
- }
-
- $this->cache->setCache( 'forum_cache', $this->caches['forum_cache'], array( 'array' => 1 ) );
-
- $this->registry->output->addMessage("Download permissions added, Converting template bit HTML logic...");
- $this->request['workact'] = 'update_template_bits';
- }
-
- /*-------------------------------------------------------------------------*/
- // Update template bits
- /*-------------------------------------------------------------------------*/
-
- function update_template_bits()
- {
- $this->registry->output->addMessage("Template bits skipped, finishing up...");
- $this->request['workact'] = 'finish';
- return FALSE;
- }
-
- /*-------------------------------------------------------------------------*/
- // Update forums
- /*-------------------------------------------------------------------------*/
-
- function finish_up()
- {
- //-----------------------------------------
- // Has gallery?
- //-----------------------------------------
-
- $this->DB->return_die = 1;
- $this->DB->error = '';
-
- $table = 'members';
-
- if ( ! $this->DB->checkForField( 'has_gallery', $table ) )
- {
- $this->DB->addField( 'members', 'has_gallery', 'INT(1)', '0' );
-
- if ( $this->DB->error )
- {
- $this->registry->output->addError( "ALTER TABLE {$this->DB->obj['sql_tbl_prefix']}members ADD has_gallery INT(1) default 0 ".$this->DB->error );
- }
- }
-
- if( $this->settings['conv_configured'] != 1 OR $this->settings['conv_chosen'] == "" )
- {
- if( $this->DB->checkForField( "legacy_password", "members" ) )
- {
- $this->DB->dropField( 'members', 'legacy_password' );
-
- if ( $this->DB->error )
- {
- $this->registry->output->addError( "ALTER TABLE {$this->DB->obj['sql_tbl_prefix']}members DROP legacy_password ".$this->DB->error );
- }
- }
- }
-
- $test = $this->DB->buildAndFetch( array( 'select' => 'count(*) as numrows',
- 'from' => 'cache_store',
- 'where' => "cs_key='calendars'"
- ) );
-
- if ( ! $test['numrows'] )
- {
- $this->DB->insert( 'cache_store', array( 'cs_key' => 'calendars' ) );
- }
-
- $this->registry->output->addMessage("Clean up performed, Creating new IPB 2.2.0 skin...");
- $this->request['workact'] = 'skin';
- }
-
- /*-------------------------------------------------------------------------*/
- // Add new skin
- /*-------------------------------------------------------------------------*/
-
- function add_skin()
- {
- $this->registry->output->addMessage("2.2.0 skin skipped...");
- unset($this->request['workact']);
-
- return TRUE;
- }
-
+Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class version_upgrade
+{
+ /**
+ * Custom HTML to show
+ *
+ * @var string
+ */
+ private $_output = '';
+
+ /**
+ * fetchs output
+ *
+ * @return string
+ */
+ public function fetchOutput()
+ {
+ return $this->_output;
+ }
+
+ /**
+ * Execute selected method
+ *
+ * @param object Registry object
+ * @return @e void
+ */
+ 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->cache = $this->registry->cache();
+ $this->caches =& $this->registry->cache()->fetchCaches();
+
+ /* Set DB driver to return any errors */
+ $this->DB->return_die = 1;
+
+ //--------------------------------
+ // What are we doing?
+ //--------------------------------
+
+ switch( $this->request['workact'] )
+ {
+ case 'sql':
+ $this->upgrade_sql(1);
+ break;
+ case 'sql1':
+ $this->upgrade_sql(1);
+ break;
+ case 'sql2':
+ $this->upgrade_sql(2);
+ break;
+ case 'sql3':
+ $this->upgrade_sql(3);
+ break;
+ case 'sql4':
+ $this->upgrade_sql(4);
+ break;
+ case 'forums':
+ $this->update_forums();
+ break;
+ case 'finish':
+ $this->finish_up();
+ break;
+ case 'skin':
+ $this->add_skin();
+ break;
+ case 'update_template_bits':
+ $this->update_template_bits();
+ break;
+
+ default:
+ $this->upgrade_sql(1);
+ break;
+ }
+
+ if ( $this->request['workact'] )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+
+ /*-------------------------------------------------------------------------*/
+ // SQL: 0
+ /*-------------------------------------------------------------------------*/
+
+ function upgrade_sql( $id=1 )
+ {
+ $man = 0; // Manual upgrade ? intval( $this->request['man'] );
+ $cnt = 0;
+ $SQL = array();
+ $file = '_updates_'.$id.'.php';
+ $output = "";
+ $path = IPSLib::getAppDir( 'core' ) . '/setup/versions/upg_22005/' . strtolower( $this->registry->dbFunctions()->getDriverType() ) . $file;
+ $prefix = $this->registry->dbFunctions()->getPrefix();
+
+ if ( is_file( $path ) )
+ {
+ require_once( $path );/*noLibHook*/
+
+ $this->sqlcount = 0;
+ $output = "";
+
+ $this->DB->return_die = 1;
+
+ foreach( $SQL as $query )
+ {
+ $this->DB->allow_sub_select = 1;
+ $this->DB->error = '';
+
+ $query = str_replace( "<%time%>", time(), $query );
+
+ if( $this->settings['mysql_tbl_type'] )
+ {
+ if( preg_match( "/^create table(.+?)/i", $query ) )
+ {
+ $query = preg_replace( "/^(.+?)\);$/is", "\\1) ENGINE={$this->settings['mysql_tbl_type']};", $query );
+ }
+ }
+
+ /* Need to tack on a prefix? */
+ if ( $prefix )
+ {
+ $query = IPSSetUp::addPrefixToQuery( $query, $prefix );
+ }
+
+ if ( IPSSetUp::getSavedData('man') )
+ {
+ $output .= preg_replace( "/\s{1,}/", " ", $query ) ."\n\n";
+ }
+ else
+ {
+ $this->DB->query( $query );
+
+ if ( $this->DB->error )
+ {
+ $this->registry->output->addError( $query." ".$this->DB->error );
+ }
+ else
+ {
+ $this->sqlcount++;
+ }
+ }
+ }
+
+ $this->registry->output->addMessage("$this->sqlcount запросов выполнено....");
+ }
+
+ //--------------------------------
+ // Next page...
+ //--------------------------------
+
+ $this->request['st'] = 0;
+
+ if ( $id != 4 )
+ {
+ $nextid = $id + 1;
+ $this->request['workact'] = 'sql'.$nextid;
+ }
+ else
+ {
+ $this->request['workact'] = 'forums';
+ }
+
+ if ( IPSSetUp::getSavedData('man') AND $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 );
+ }
+ }
+
+
+ /*-------------------------------------------------------------------------*/
+ // Update forums
+ /*-------------------------------------------------------------------------*/
+
+ function update_forums()
+ {
+ //-----------------------------------------
+ // Update latest news...
+ //-----------------------------------------
+
+ $this->DB->update( "forums", "newest_title=last_title, newest_id=last_id", 'last_title IS NOT NULL AND last_id IS NOT NULL', false, true );
+ $this->DB->execute();
+
+ //-----------------------------------------
+ // INIT
+ //-----------------------------------------
+
+ $ignore_me = array( 'redirect_url', 'redirect_loc', 'rules_text', 'permission_custom_error', 'notify_modq_emails' );
+
+ if ( !empty($this->settings['forum_cache_minimum']) )
+ {
+ $ignore_me[] = 'description';
+ $ignore_me[] = 'rules_title';
+ }
+
+ $this->caches['forum_cache'] = array();
+
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'forums',
+ 'order' => 'parent_id, position'
+ ) );
+ $o = $this->DB->execute();
+
+ while( $f = $this->DB->fetch( $o ) )
+ {
+ $fr = array();
+
+ $perms = unserialize(stripslashes($f['permission_array']));
+
+ //-----------------------------------------
+ // Stuff we don't need...
+ //-----------------------------------------
+
+ if ( $f['parent_id'] == -1 )
+ {
+ $fr['id'] = $f['id'];
+ $fr['sub_can_post'] = $f['sub_can_post'];
+ $fr['name'] = $f['name'];
+ $fr['parent_id'] = $f['parent_id'];
+ $fr['show_perms'] = $perms['show_perms'];
+ $fr['skin_id'] = $f['skin_id'];
+ $fr['permission_showtopic'] = $f['permission_showtopic'];
+ }
+ else
+ {
+ foreach( $f as $k => $v )
+ {
+ if ( in_array( $k, $ignore_me ) )
+ {
+ continue;
+ }
+ else
+ {
+ if ( $v != "" )
+ {
+ $fr[ $k ] = $v;
+ }
+ }
+ }
+
+ $fr['read_perms'] = isset($perms['read_perms']) ? $perms['read_perms'] : '';
+ $fr['reply_perms'] = isset($perms['reply_perms']) ? $perms['reply_perms'] : '';
+ $fr['start_perms'] = isset($perms['start_perms']) ? $perms['start_perms'] : '';
+ $fr['upload_perms'] = isset($perms['upload_perms']) ? $perms['upload_perms'] : '';
+ $fr['download_perms'] = $perms['upload_perms'];
+ $fr['show_perms'] = isset($perms['show_perms']) ? $perms['show_perms'] : '';
+
+ unset($fr['permission_array']);
+ }
+
+ $this->caches['forum_cache'][ $fr['id'] ] = $fr;
+
+ $perm_array = addslashes(serialize(array(
+ 'start_perms' => $fr['start_perms'],
+ 'reply_perms' => $fr['reply_perms'],
+ 'read_perms' => $fr['read_perms'],
+ 'upload_perms' => $fr['upload_perms'],
+ 'download_perms' => $fr['download_perms'],
+ 'show_perms' => $fr['show_perms']
+ ) ) );
+
+ //-----------------------------------------
+ // Add to save array
+ //-----------------------------------------
+
+ $this->DB->update( 'forums', array( 'permission_array' => $perm_array ), 'id='.$fr['id'] );
+
+ }
+
+ $this->cache->setCache( 'forum_cache', $this->caches['forum_cache'], array( 'array' => 1 ) );
+
+ $this->registry->output->addMessage("Download permissions added, Converting template bit HTML logic...");
+ $this->request['workact'] = 'update_template_bits';
+ }
+
+ /*-------------------------------------------------------------------------*/
+ // Update template bits
+ /*-------------------------------------------------------------------------*/
+
+ function update_template_bits()
+ {
+ $this->registry->output->addMessage("Template bits skipped, finishing up...");
+ $this->request['workact'] = 'finish';
+ return FALSE;
+ }
+
+ /*-------------------------------------------------------------------------*/
+ // Update forums
+ /*-------------------------------------------------------------------------*/
+
+ function finish_up()
+ {
+ //-----------------------------------------
+ // Has gallery?
+ //-----------------------------------------
+
+ $this->DB->return_die = 1;
+ $this->DB->error = '';
+
+ $table = 'members';
+
+ if ( ! $this->DB->checkForField( 'has_gallery', $table ) )
+ {
+ $this->DB->addField( 'members', 'has_gallery', 'INT(1)', '0' );
+
+ if ( $this->DB->error )
+ {
+ $this->registry->output->addError( "ALTER TABLE {$this->DB->obj['sql_tbl_prefix']}members ADD has_gallery INT(1) default 0 ".$this->DB->error );
+ }
+ }
+
+ if( $this->settings['conv_configured'] != 1 OR $this->settings['conv_chosen'] == "" )
+ {
+ if( $this->DB->checkForField( "legacy_password", "members" ) )
+ {
+ $this->DB->dropField( 'members', 'legacy_password' );
+
+ if ( $this->DB->error )
+ {
+ $this->registry->output->addError( "ALTER TABLE {$this->DB->obj['sql_tbl_prefix']}members DROP legacy_password ".$this->DB->error );
+ }
+ }
+ }
+
+ $test = $this->DB->buildAndFetch( array( 'select' => 'count(*) as numrows',
+ 'from' => 'cache_store',
+ 'where' => "cs_key='calendars'"
+ ) );
+
+ if ( ! $test['numrows'] )
+ {
+ $this->DB->insert( 'cache_store', array( 'cs_key' => 'calendars' ) );
+ }
+
+ $this->registry->output->addMessage("Clean up performed, Creating new IPB 2.2.0 skin...");
+ $this->request['workact'] = 'skin';
+ }
+
+ /*-------------------------------------------------------------------------*/
+ // Add new skin
+ /*-------------------------------------------------------------------------*/
+
+ function add_skin()
+ {
+ $this->registry->output->addMessage("2.2.0 skin skipped...");
+ unset($this->request['workact']);
+
+ return TRUE;
+ }
+
}
\ No newline at end of file
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 83cf90cb..5b7bf7b3 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,7 +1,7 @@
{title}:{content} ', 2, '', 'gender'),
-(NULL, 'Location', '', '', 'input', 0, 0, 0, 1, 0, 0, '', 0, '{title}: {content} ', 2, '', 'location'),
-(NULL, 'Interests', '', '', 'textarea', 0, 0, 0, 1, 0, 0, '', 0, '{title}: {content} ', 2, '', 'interests'),
+(NULL, 'Пол', '', 'm=Мужчина|f=Женщина|u=Не определился', 'drop', 0, 0, 0, 1, 0, 0, '', 0, '{title}: {content} ', 2, '', 'gender'),
+(NULL, 'Город', '', '', 'input', 0, 0, 0, 1, 0, 0, '', 0, '{title}: {content} ', 2, '', 'location'),
+(NULL, 'Интересы', '', '', 'textarea', 0, 0, 0, 1, 0, 0, '', 0, '{title}: {content} ', 2, '', 'interests'),
(NULL, 'Yahoo', '', '', 'input', 0, 0, 0, 1, 0, 0, '', 0, '', 1, 'style_extra/cprofile_icons/profile_yahoo.gif', 'yahoo'),
(NULL, 'Jabber', '', '', 'input', 0, 0, 0, 1, 0, 0, '', 0, '', 1, 'style_extra/cprofile_icons/profile_jabber.gif', 'jabber'),
(NULL, 'Skype', '', '', 'input', 0, 0, 0, 1, 0, 0, '', 0, '', 1, 'style_extra/cprofile_icons/profile_skype.gif', 'skype');
@@ -100,10 +100,10 @@ $SQL[] = "TRUNCATE TABLE task_manager;";
$SQL[] = "DELETE FROM cache_store WHERE cs_key='skin_id_cache';";
$SQL[] = "DELETE FROM cache_store WHERE cs_key='forum_cache';";
-$SQL[] = "INSERT INTO reputation_levels VALUES(1, -20, 'Bad', '');";
-$SQL[] = "INSERT INTO reputation_levels VALUES(2, -10, 'Poor', '');";
-$SQL[] = "INSERT INTO reputation_levels VALUES(3, 0, 'Neutral', '');";
-$SQL[] = "INSERT INTO reputation_levels VALUES(4, 10, 'Good', '');";
-$SQL[] = "INSERT INTO reputation_levels VALUES(5, 20, 'Excellent', '');";
+$SQL[] = "INSERT INTO reputation_levels VALUES(1, -20, 'Очень плохой', '');";
+$SQL[] = "INSERT INTO reputation_levels VALUES(2, -10, 'Плохой', '');";
+$SQL[] = "INSERT INTO reputation_levels VALUES(3, 0, 'Обычный', '');";
+$SQL[] = "INSERT INTO reputation_levels VALUES(4, 10, 'Хороший', '');";
+$SQL[] = "INSERT INTO reputation_levels VALUES(5, 20, 'Очень хороший', '');";
?>
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_30001/mysql_updates_6.php b/upload/admin/applications/core/setup/versions/upg_30001/mysql_updates_6.php
index 51ea7194..2f399600 100644
--- a/upload/admin/applications/core/setup/versions/upg_30001/mysql_updates_6.php
+++ b/upload/admin/applications/core/setup/versions/upg_30001/mysql_updates_6.php
@@ -1,7 +1,7 @@
getPrefix();
+ if( empty($field) )
+ {
+ return null;
+ }
+
return "UPDATE {$PRE}pfields_content p, {$PRE}member_extra m
SET p.field_{$field['pf_id']}=m.{$old}
WHERE p.member_id=m.id";
diff --git a/upload/admin/applications/core/setup/versions/upg_30001/version_class.php b/upload/admin/applications/core/setup/versions/upg_30001/version_class.php
index bb1ee48e..5998065f 100644
--- a/upload/admin/applications/core/setup/versions/upg_30001/version_class.php
+++ b/upload/admin/applications/core/setup/versions/upg_30001/version_class.php
@@ -1,161 +1,161 @@
-
- * Invision Power Services
- * IP.Board v3.3.4
- * Upgrade Class
- *
- * Class to add options and notices for IP.Board upgrade
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
- *
- *
- * @author Matt Mecham
- * @version $Rev: 10914 $
- * @since 3.0
- * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.invisionpower.com/company/standards.php#license
- * @link http://www.invisionpower.com
- * @package IP.Board
- */
-
-class version_class_core_30001
-{
- /**
- * Constructor
- *
- * @param object $registry Registry object
- * @return @e 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->cache = $this->registry->cache();
- $this->caches =& $this->registry->cache()->fetchCaches();
- }
-
- /**
- * Add pre-upgrade options: Form
- *
- * @return string HTML block
- */
- public function preInstallOptionsForm()
- {
-return <<
-
-
- Export current skin's modified template bits and CSS? (This will be saved in /cache/previousSkinFiles)
-
-
-
- Copy language PHP files into /cache/previousLangFiles before upgrading?
-
-
-
- Skip PM Conversion? If so, old tables will not be removed and you can use the provided shell tool post-upgrade
-
-
-
- Remove all "non-root" admin ACP permissions? Due to the change in permission models, root admins and admins have the same default permissions.
- You have the option to restrict all non-root admins and then manually set up their permissions after the upgrade. Not ticking this box will effectively give all
- administrators full access regardless of administrator type.
-
-
-EOF;
-
- }
-
- /**
- * Add pre-upgrade options: Save
- *
- * Data will be saved in saved data array as: appOptions[ app ][ versionLong ] = ( key => value );
- *
- * @return array Key / value pairs to save
- */
- public function preInstallOptionsSave()
- {
- /* Return */
- return array( 'exportSkins' => intval( $_REQUEST['exportSkins'] ),
- 'exportLangs' => intval( $_REQUEST['exportLangs'] ),
- 'skipPms' => intval( $_REQUEST['skipPms'] )
- );
-
- }
-
- /**
- * Return any post-installation notices
- *
- * @return array Array of notices
- */
- public function postInstallNotices()
- {
- $options = IPSSetUp::getSavedData('custom_options');
- $_doSkin = $options['core'][30001]['exportSkins'];
- $_doLang = $options['core'][30001]['exportLangs'];
- $rootAdmins = $options['core'][30001]['rootAdmins'];
- $skipPms = $options['core'][30001]['skipPms'];
-
- $notices = array();
-
- if ( $_doSkin )
- {
- $notices[] = "All previous skins have been exported into 'cache/previousSkinFiles'";
- }
-
- if ( $_doLang )
- {
- $notices[] = "All previous language files have been exported into 'cache/previousLangFiles'";
- }
-
- if ( $skipPms )
- {
- $notices[] = "PM Conversion was skipped. If you want to convert PMs, please use the provided shell tool found in your 'tools' directory of the download";
- }
-
- /* Notice about post content */
- $notices[] = "You should now log into your Admin CP and rebuild post content (System > Recount & Rebuild)";
-
- /* Notice about admin restrictions */
- $notices[] = "Due to the change in permission systems, any admins that had restrictions have been updated to have no access to any module until you edit them.";
-
- /* Notice about admin restrictions */
- if ( $rootAdmins )
- {
- $notices[] = "Due to the change in permission systems, 'Root Admins' and 'Administrators' both have full access to the ACP including SQL toolbox, etc. You chose to remove all ACP permissions on upgrade. You can restore selective permissions via the ACP.";
- }
- else
- {
- $notices[] = "Due to the change in permission systems, 'Root Admins' and 'Administrators' both have full access to the ACP including SQL toolbox, etc. You can restrict individual admins using the ACP permission system.";
- }
-
- /* Notice about custom time settings */
- $notices[] = "Due to the change in how times are shown, all custom time/clock formats have been reset.";
-
- /* Notice about FURLs */
- $notices[] = "If you wish to use Friendly URLs, you will need to edit your conf_global.php file and add: \$INFO['use_friendly_urls'] = '1';. Once this is done run also the tool in \"ACP -> System TAB -> Recount & Rebuild -> Resynchronize Forums\".";
-
- return $notices;
- }
-
-
- /**
- * Return any pre-installation notices
- *
- * @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;
-
- }
-}
-
+
+ * Invision Power Services
+ * IP.Board v3.4.5
+ * Upgrade Class
+ *
+ * Class to add options and notices for IP.Board upgrade
+ * Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
+ *
+ *
+ * @author Matt Mecham
+ * @version $Rev: 10721 $
+ * @since 3.0
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/company/standards.php#license
+ * @link http://www.invisionpower.com
+ * @package IP.Board
+ */
+
+class version_class_core_30001
+{
+ /**
+ * Constructor
+ *
+ * @param object $registry Registry object
+ * @return @e 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->cache = $this->registry->cache();
+ $this->caches =& $this->registry->cache()->fetchCaches();
+ }
+
+ /**
+ * Add pre-upgrade options: Form
+ *
+ * @return string HTML block
+ */
+ public function preInstallOptionsForm()
+ {
+return <<
+
+
+ Экспортировать текущие шаблоны и CSS? (Будут сохранены в директории /cache/previousSkinFiles)
+
+
+
+ Скопировать старые директории языков в /cache/previousLangFiles ?
+
+
+
+ Пропустить конвертацию личных сообщений? Старые сообщения будут оставлены, вы в любой момент сможете сконвертировать ЛС при помощи shell или утилиты в админцентре.
+
+
+
+ Запретить доступ в АЦ для неглавных администраторов? В систему распеределния прав в IP.Board 3 внесены изменения, поэтому больше нет необходимости разделять администраторов и главных администраторов на разные группы.
+ Вы можете сохранить доступ в АЦ только для главных администраторов и вручную выставить права доступа. Если опция отключена, то
+ все администраторы получат доступ в АЦ независимо от типа.
+
+
+EOF;
+
+ }
+
+ /**
+ * Add pre-upgrade options: Save
+ *
+ * Data will be saved in saved data array as: appOptions[ app ][ versionLong ] = ( key => value );
+ *
+ * @return array Key / value pairs to save
+ */
+ public function preInstallOptionsSave()
+ {
+ /* Return */
+ return array( 'exportSkins' => intval( $_REQUEST['exportSkins'] ),
+ 'exportLangs' => intval( $_REQUEST['exportLangs'] ),
+ 'skipPms' => intval( $_REQUEST['skipPms'] )
+ );
+
+ }
+
+ /**
+ * Return any post-installation notices
+ *
+ * @return array Array of notices
+ */
+ public function postInstallNotices()
+ {
+ $options = IPSSetUp::getSavedData('custom_options');
+ $_doSkin = $options['core'][30001]['exportSkins'];
+ $_doLang = $options['core'][30001]['exportLangs'];
+ $rootAdmins = $options['core'][30001]['rootAdmins'];
+ $skipPms = $options['core'][30001]['skipPms'];
+
+ $notices = array();
+
+ if ( $_doSkin )
+ {
+ $notices[] = "Все старые стили сохранены в 'cache/previousSkinFiles'";
+ }
+
+ if ( $_doLang )
+ {
+ $notices[] = "Все старые языки сохранены в 'cache/previousLangFiles'";
+ }
+
+ if ( $skipPms )
+ {
+ $notices[] = "Конвертация личных сообщений пропущена. Для конвертации личных сообщений в будущем воспользуйтесь shell-скриптом из директории 'tools' дистрибутива";
+ }
+
+ /* Notice about post content */
+ $notices[] = "Теперь вам необходимо обновить содержимое всех сообщений через админцентр (Система > Пересчет и обновление). ";
+
+ /* Notice about admin restrictions */
+ $notices[] = "Из-за изменений в системе прав доступа. Все администраторы, имевшие ограничения, будут лишены доступа ко всем модулям, пока вы не измените права.";
+
+ /* Notice about admin restrictions */
+ if ( $rootAdmins )
+ {
+ $notices[] = "Были сброшены все ограничения для доступа в админцентр Вы можете восстановить их через АЦ. ";
+ }
+ else
+ {
+ $notices[] = "Все администраторы получили полный доступ к админцентру. Вы можете ограничить их доступ через АЦ. ";
+ }
+
+ /* Notice about custom time settings */
+ $notices[] = "Формат показа времени изменен в настройках. ";
+
+ /* Notice about FURLs */
+ $notices[] = "Для использования Friendly URLs (ЧПУ), добавьте в ваш conf_global.php строчку: \$INFO['use_friendly_urls'] = '1';.";
+
+ return $notices;
+ }
+
+
+ /**
+ * Return any pre-installation notices
+ *
+ * @return array Array of notices
+ */
+ public function preInstallNotices()
+ {
+ $notices = array();
+
+ $notices[] = "Стили внешнего вида более ранних версий будут несовместимы с этой версией форума. Будет восстановлен стиль по-умолчанию.";
+
+ return $notices;
+
+ }
+}
+
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 8ac21535..f5ba2057 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
@@ -1,1703 +1,1731 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class version_upgrade
-{
- /**
- * Custom HTML to show
- *
- * @var string
- */
- protected $_output = '';
-
- /**
- * fetchs output
- *
- * @return string
- */
- public function fetchOutput()
- {
- return $this->_output;
- }
-
- /**
- * Execute selected method
- *
- * @param object Registry object
- * @return @e void
- */
- 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->cache = $this->registry->cache();
- $this->caches =& $this->registry->cache()->fetchCaches();
-
- //--------------------------------
- // What are we doing?
- //--------------------------------
-
- switch( $this->request['workact'] )
- {
- case 'sql':
- case 'sql1':
- $this->upgradeSql(1);
- break;
- case 'sql2':
- $this->upgradeSql(2);
- break;
- case 'sql3':
- $this->upgradeSql(3);
- break;
- case 'sql4':
- $this->upgradeSql(4);
- break;
- case 'sql5':
- $this->upgradeSql(5);
- break;
- case 'sql6':
- $this->upgradeSql(6);
- break;
- case 'applications':
- $this->addApplications();
- break;
- case 'settings':
- $this->addSettings();
- break;
- case 'profile':
- $this->addProfile();
- break;
- case 'permsAndBbcode':
- $this->permsAndBbcode();
- break;
- case 'skinlang':
- $this->exportSkinLang();
- break;
- case 'pms':
- $this->convertPms();
- break;
- case 'contacts':
- $this->convertBlockLists();
- break;
- case 'pmblock':
- $this->convertPmBlockLists();
- break;
- case 'finish':
- $this->finish();
- break;
-
- default:
- $this->upgradeSql(1);
- break;
- }
-
- /* Workact is set in the function, so if it has not been set, then we're done. The last function should unset it. */
- if ( $this->request['workact'] )
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-
- /**
- * Run SQL files
- *
- * @param int
- * @return @e void
- */
- public function upgradeSql( $id=1 )
- {
- $cnt = 0;
- $SQL = array();
- $file = '_updates_'.$id.'.php';
- $output = "";
- $path = IPSLib::getAppDir( 'core' ) . '/setup/versions/upg_30001/' . strtolower( $this->registry->dbFunctions()->getDriverType() ) . $file;
- $prefix = $this->registry->dbFunctions()->getPrefix();
- $sourceFile = '';
-
- if ( is_file( $path ) )
- {
- require( $path );/*noLibHook*/
-
- /* Set DB driver to return any errors */
- $this->DB->return_die = 1;
-
- foreach( $SQL as $query )
- {
- $this->DB->allow_sub_select = 1;
- $this->DB->error = '';
-
- $query = str_replace( "<%time%>", time(), $query );
-
- if ( $this->settings['mysql_tbl_type'] )
- {
- if ( preg_match( "/^create table(.+?)/i", $query ) )
- {
- $query = preg_replace( "/^(.+?)\);$/is", "\\1) ENGINE={$this->settings['mysql_tbl_type']};", $query );
- }
- }
-
- /* Need to tack on a prefix? */
- if ( $prefix )
- {
- $query = IPSSetUp::addPrefixToQuery( $query, $prefix );
- }
-
- if( IPSSetUp::getSavedData('man') )
- {
- $query = trim( $query );
-
- /* Ensure the last character is a semi-colon */
- if ( substr( $query, -1 ) != ';' )
- {
- $query .= ';';
- }
-
- $output .= $query . "\n\n";
- }
- else
- {
- $this->DB->query( $query );
-
- if ( $this->DB->error )
- {
- $this->registry->output->addError( " " . $query." ".$this->DB->error );
- }
- else
- {
- $cnt++;
- }
- }
- }
-
- $this->registry->output->addMessage("$cnt queries ran....");
- }
-
- /* Next Page */
- $this->request['st'] = 0;
-
- if ( $id < 6 )
- {
- $nextid = $id + 1;
- $this->request['workact'] = 'sql'.$nextid;
- }
- else
- {
- $this->request['workact'] = 'applications';
- }
-
- if ( IPSSetUp::getSavedData('man') AND $output )
- {
- /* Create source file */
- if ( $this->registry->dbFunctions()->getDriverType() == 'mysql' )
- {
- $sourceFile = IPSSetUp::createSqlSourceFile( $output, '30001', $id );
- }
-
- $this->_output = $this->registry->output->template()->upgrade_manual_queries( $output, $sourceFile );
- }
- }
-
-
- /**
- * Add Applications
- *
- * @return @e void
- */
- public function addApplications()
- {
- /* Add applications.. */
- $apps = array( 'core' => array(), 'ips' => array(), 'other' => array() );
- $components = array();
-
- foreach( array( 'applications', 'applications_addon/ips', 'applications_addon/other' ) as $_pBit )
- {
- $path = IPS_ROOT_PATH . $_pBit;
- $handle = opendir( $path );
-
- while ( ( $file = readdir( $handle ) ) !== FALSE )
- {
- if ( ! preg_match( "#^\.#", $file ) )
- {
- if ( is_dir( $path . '/' . $file ) )
- {
- //-----------------------------------------
- // Get it!
- //-----------------------------------------
-
- if ( ! is_file( IPS_ROOT_PATH . $_pBit . '/' . $file . '/xml/information.xml' ) )
- {
- continue;
- }
-
- $data = IPSSetUp::fetchXmlAppInformation( $file );
-
- switch( $_pBit )
- {
- case 'applications':
- $apps['core'][ $file ] = $data;
- break;
- case 'applications_addon/ips':
- $apps['ips'][ $file ] = $data;
- break;
- case 'applications_addon/other':
- $apps['other'][ $file ] = $data;
- break;
- }
- }
- }
- }
-
- closedir( $handle );
- }
-
- /* Reorder the array so that core is first */
- $new_array = array();
- $new_array['core'] = $apps['core']['core'];
-
- foreach( $apps['core'] as $app => $data )
- {
- if( $app == 'core' )
- {
- continue;
- }
-
- $new_array[$app] = $data;
- }
-
- $apps['core'] = $new_array;
-
- /* Fetch data for current 'components' */
- $this->DB->build( array( 'select' => '*',
- 'from' => 'components' ) );
-
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- $components[ $row['com_section'] ] = $row;
- }
-
- /* Got Gallery? */
- if ( $components['gallery']['com_enabled'] AND $this->DB->checkForTable( 'gallery_upgrade_history' ) )
- {
- /* Fetch current version number */
- $version = $this->DB->buildAndFetch( array( 'select' => '*',
- 'from' => 'gallery_upgrade_history',
- 'order' => 'gallery_version_id DESC',
- 'limit' => array( 0, 1 ) ) );
-
- $apps['ips']['gallery']['_currentLong'] = $version['gallery_version_id'];
- $apps['ips']['gallery']['_currentHuman'] = $version['gallery_version_human'];
- }
-
- /* Got Blog? */
- if ( $components['blog']['com_enabled'] AND $this->DB->checkForTable( 'blog_upgrade_history' ) )
- {
- /* Fetch current version number */
- $version = $this->DB->buildAndFetch( array( 'select' => '*',
- 'from' => 'blog_upgrade_history',
- 'order' => 'blog_version_id DESC',
- 'limit' => array( 0, 1 ) ) );
-
- $apps['ips']['blog']['_currentLong'] = $version['blog_version_id'];
- $apps['ips']['blog']['_currentHuman'] = $version['blog_version_human'];
- }
-
- /* Got Downloads? */
- if ( $components['downloads']['com_enabled'] AND $this->DB->checkForTable( 'downloads_upgrade_history' ) )
- {
- /* Fetch current version number */
- $version = $this->DB->buildAndFetch( array( 'select' => '*',
- 'from' => 'downloads_upgrade_history',
- 'order' => 'idm_version_id DESC',
- 'limit' => array( 0, 1 ) ) );
-
- $apps['ips']['downloads']['_currentLong'] = $version['idm_version_id'];
- $apps['ips']['downloads']['_currentHuman'] = $version['idm_version_human'];
- }
-
- /* Others.. */
- $apps['core']['forums']['_currentLong'] = '30001';
- $apps['core']['forums']['_currentHuman'] = '3.0.0';
-
- $apps['core']['core']['_currentLong'] = '30001';
- $apps['core']['core']['_currentHuman'] = '3.0.0';
-
- $apps['core']['members']['_currentLong'] = '30001';
- $apps['core']['members']['_currentHuman'] = '3.0.0';
-
- $apps['ips']['portal']['_currentLong'] = '30003';
- $apps['ips']['portal']['_currentHuman'] = '3.0.0';
-
- //$apps['ips']['chat']['_currentLong'] = '30003';
- //$apps['ips']['chat']['_currentHuman'] = '3.0.0';
-
- /* If we are upgrading from 2.3 and did not upload the calendar files, we still need to insert
- the applications table entry, otherwise you won't be able to upgrade down the road. We will
- insert it as disabled, however, as calendar won't function since files are not available
- @link http://community.invisionpower.com/tracker/issue-33543-ipb2-upgrades */
- if( !isset($apps['ips']['calendar']['name']) )
- {
- $apps['ips']['calendar'] = array(
- 'name' => 'Calendar',
- 'public_name' => 'Calendar',
- 'description' => "",
- 'author' => "Invision Power Services, Inc.",
- 'hide_tab' => 0,
- 'key' => 'calendar',
- 'disabledatinstall' => 1,
- 'ipskey' => "fa038db69fa627d8e8e034d65f554d1f",
- '_locationkey' => 'ips',
- );
- }
-
- $apps['ips']['calendar']['_currentLong'] = '30003';
- $apps['ips']['calendar']['_currentHuman'] = '3.0.0';
-
- /* Now install them.. */
- $num = 0;
-
- foreach( $apps as $where => $data )
- {
- foreach( $apps[ $where ] as $dir => $appData )
- {
- //-----------------------------------------
- // Had Gallery (e.g.) but didn't upload updated files
- //-----------------------------------------
-
- if( !$appData['name'] )
- {
- continue;
- }
-
- $num++;
- $_protected = ( in_array( $appData['key'], array( 'core', 'forums', 'members' ) ) ) ? 1 : 0;
- $_enabled = ( $appData['disabledatinstall'] ) ? 0 : 1;
-
- if ( ! $appData['_currentLong'] )
- {
- continue;
- }
-
- $this->registry->output->addMessage("Adding application: {$appData['name']}....");
-
- $this->DB->insert( 'core_applications', array( 'app_title' => $appData['name'],
- 'app_public_title' => ( $appData['public_name'] ) ? $appData['public_name'] : '', // Allow blank in case it's an admin-only app
- 'app_description' => $appData['description'],
- 'app_author' => $appData['author'],
- 'app_hide_tab' => intval($appData['hide_tab']),
- 'app_version' => $appData['_currentHuman'],
- 'app_long_version' => $appData['_currentLong'],
- 'app_directory' => $appData['key'],
- 'app_added' => time(),
- 'app_position' => $num,
- 'app_protected' => $_protected,
- 'app_location' => $appData['_locationkey'] ? $appData['_locationkey'] : IPSLib::extractAppLocationKey( $appData['key'] ),
- 'app_enabled' => $_enabled,
- 'app_website' => $appData['website'],
- 'app_update_check' => $appData['update_check'],
- 'app_global_caches' => $appData['global_caches'],
- ) );
- }
- }
-
- /* Next Page */
- $this->request['workact'] = 'settings';
- }
-
- /**
- * Add Settings
- *
- * @return @e void
- */
- public function addSettings()
- {
- /* INIT */
- $known = array();
- $apps = array();
-
- /* Grab all known settings */
- $this->DB->build( array( 'select' => '*', 'from' => 'conf_settings' ) );
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- if ( $row['conf_value'] != '' )
- {
- $known[ $row['conf_key'] ] = $row['conf_value'];
- }
- }
-
- /* Brandon's bug report thingy #12516*/
- if ( ! $known['gb_char_set'] )
- {
- /* No charset, set - so we need to now ensure that iso-8859-1 is set */
- $known['gb_char_set'] = 'iso-8859-1';
- }
-
- /* Wipe out custom time/date settings */
- foreach( array( 'clock_short', 'clock_long', 'clock_tiny', 'clock_date', 'clock_joined', 'time_use_relative_format' ) as $setting )
- {
- unset( $known[ $setting ] );
- }
-
- /* Now we need to fix moderator groups who have permission to RC */
- $groups = array();
-
- $this->DB->build( array( 'select' => 'g_id', 'from' => 'groups', 'where' => 'g_access_cp=1 OR g_is_supmod=1' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $groups[] = $r['g_id'];
- }
-
- $known['report_mod_group_access'] = implode( ',', $groups );
-
- /* Load apps */
- $this->DB->build( array( 'select' => '*', 'from' => 'core_applications' ) );
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- $apps[ $row['app_directory'] ] = $row;
- }
-
- /* Add 'em */
- foreach( $apps as $dir => $data )
- {
- if ( is_file( IPSLib::getAppDir( $dir ) . '/xml/' . $dir . '_settings.xml' ) )
- {
- $classToLoad = IPSLib::loadActionOverloader( IPS_ROOT_PATH . 'applications/core/modules_admin/settings/settings.php', 'admin_core_settings_settings' );
- $settings = new $classToLoad();
- $settings->makeRegistryShortcuts( $this->registry );
-
- $this->request['app_dir'] = $dir;
- $settings->importAllSettings( 1, 1, $known );
-
- $this->registry->output->addMessage("Added settings for {$data['app_title']}....");
- }
- }
-
- /* Next Page */
- $this->request['workact'] = 'profile';
- }
-
- /**
- * Sort out profile fields
- *
- * @return @e void
- */
- public function addProfile()
- {
- /* INIT */
- $fields = array();
- $prefix = $this->registry->dbFunctions()->getPrefix();
- $sourceFile = '';
-
- /* Get DB driver file */
- require_once( IPSLib::getAppDir( 'core' ) . '/setup/versions/upg_30001/' . strtolower( $this->registry->dbFunctions()->getDriverType() ) . '_version_upgrade.php' );/*noLibHook*/
-
- /* First off, move all current profile fields to group ID 3 */
- $this->DB->update( 'pfields_data', array( 'pf_group_id' => 3 ), 'pf_group_id=0' );
-
- /* Grab all custom fields */
- $this->DB->build( array( 'select' => '*',
- 'from' => 'pfields_data' ) );
-
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- $fields[ $row['pf_id'] ] = $row;
- }
-
- foreach( $fields as $id => $data )
- {
- /* Now add any missing content fields */
- if ( ! $this->DB->checkForField( "field_$id", 'pfields_content' ) )
- {
- $this->DB->addField( 'pfields_content', "field_$id", 'text' );
- }
- }
-
- $this->DB->optimize( 'pfields_content' );
-
- /* Now make add a key */
- $this->DB->build( array( 'select' => '*',
- 'from' => 'pfields_data',
- 'where' => 'pf_group_id=3' ) );
-
- $o = $this->DB->execute();
-
- while( $row = $this->DB->fetch( $o ) )
- {
- /* Attempt basic conversion of data */
- if ( $row['pf_topic_format'] )
- {
- if ( $row['pf_topic_format'] == '{title}: {content} ' )
- {
- $row['pf_topic_format'] = '{title}: {content} ';
- }
- else if ( $row['pf_topic_format'] == '{title}: {key} ' )
- {
- $row['pf_topic_format'] = '{title}: {key} ';
- }
- }
-
- /* 2.3.x used 'text', 3.0.0 uses 'input'... */
- $row['pf_type'] = ( $row['pf_type'] == 'text' ) ? 'input' : $row['pf_type'];
-
- $this->DB->update( 'pfields_data', array( 'pf_type' => $row['pf_type'], 'pf_topic_format' => $row['pf_topic_format'], 'pf_key' => IPSText::makeSeoTitle( $row['pf_title'] ) ), 'pf_id=' . $row['pf_id'] );
- }
-
- /* Now, move profile data into the correct fields */
- foreach( array( 'aim_name' => 'aim',
- 'icq_number' => 'icq',
- 'website' => 'website',
- 'yahoo' => 'yahoo',
- 'interests' => 'interests',
- 'msnname' => 'msn',
- 'location' => 'location' ) as $old => $new )
- {
- $field = $this->DB->buildAndFetch( array( 'select' => '*',
- 'from' => 'pfields_data',
- 'where' => 'pf_key=\'' . $new . '\'' ) );
-
-
-
-
- $query = SQLVC::UpdateOne( $old, $field );
-
- if ( IPSSetUp::getSavedData('man') )
- {
- $query = trim( $query );
-
- /* Ensure the last character is a semi-colon */
- if ( substr( $query, -1 ) != ';' )
- {
- $query .= ';';
- }
-
- $output .= $query . "\n\n";
- }
- else
- {
- $this->DB->query( $query );
-
- if ( $this->DB->error )
- {
- $this->registry->output->addError( $query." ".$this->DB->error );
- }
- else
- {
- $this->registry->output->addMessage("Converted field: {$old}....");
- }
- }
- }
-
- /* Update gender */
- $gender = $this->DB->buildAndFetch( array( 'select' => '*',
- 'from' => 'pfields_data',
- 'where' => 'pf_key=\'gender\'' ) );
-
- if ( $gender['pf_id'] )
- {
- $queries = array( SQLVC::UpdateTwo( $gender ),
- SQLVC::UpdateThree( $gender ) );
-
- foreach( $queries as $query )
- {
- if ( IPSSetUp::getSavedData('man') )
- {
- $query = trim( $query );
-
- /* Ensure the last character is a semi-colon */
- if ( substr( $query, -1 ) != ';' )
- {
- $query .= ';';
- }
-
- $output .= $query . "\n\n";
- }
- else
- {
- $this->DB->query( $query );
-
- if ( $this->DB->error )
- {
- $this->registry->output->addError( $query." ".$this->DB->error );
- }
- else
- {
- $this->registry->output->addMessage("Converted Gender Field....");
- }
- }
- }
- }
-
- if ( IPSSetUp::getSavedData('man') AND $output )
- {
- /* Create source file */
- if ( $this->registry->dbFunctions()->getDriverType() == 'mysql' )
- {
- $sourceFile = IPSSetUp::createSqlSourceFile( $output, '30001', 'pf' );
- }
-
- $this->_output = $this->registry->output->template()->upgrade_manual_queries( $output, $sourceFile );
- }
-
- /* Next Page */
- $this->request['workact'] = 'permsAndBbcode';
- }
-
- /**
- * Sort out bbcode and permissions
- *
- * @return @e void
- */
- public function permsAndBbcode()
- {
- /* INIT */
- $options = IPSSetUp::getSavedData('custom_options');
- $rootAdmins = $options['core'][30001]['rootAdmins'];
-
- /* First off, import default BBCode */
- $apps = array();
- $bbcodeOld = array();
- $bbcodeNew = array();
-
- /* Load apps */
- $this->DB->build( array( 'select' => '*',
- 'from' => 'core_applications' ) );
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- $apps[ $row['app_directory'] ] = $row;
- }
-
- /* Load old codes */
- $this->DB->build( array( 'select' => '*',
- 'from' => 'custom_bbcode_old' ) );
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- $bbcodeOld[ $row['bbcode_tag'] ] = $row;
- }
-
- /* Add 'em */
- foreach( $apps as $dir => $data )
- {
- if ( is_file( IPSLib::getAppDir( $dir ) . '/xml/' . $dir . '_bbcode.xml' ) )
- {
- //-----------------------------------------
- // Continue
- //-----------------------------------------
-
- $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( IPSLib::getAppDir( $dir ) . '/xml/' . $dir . '_bbcode.xml' ) );
- }
-
- if ( is_file( IPSLib::getAppDir( $dir ) . '/xml/' . $dir . '_mediatag.xml' ) )
- {
- //-----------------------------------------
- // Continue
- //-----------------------------------------
-
- $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( IPSLib::getAppDir( $dir ) . '/xml/' . $dir . '_mediatag.xml' ) );
- }
- }
-
- /* Load current code */
- $this->DB->build( array( 'select' => '*',
- 'from' => 'custom_bbcode' ) );
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- $bbcodeCurrent[ $row['bbcode_tag'] ] = $row;
-
- //-----------------------------------------
- // Need to take into account aliases too!
- //-----------------------------------------
-
- if( $row['bbcode_aliases'] )
- {
- $aliases = explode( ',', $row['bbcode_aliases'] );
-
- if( count($aliases) )
- {
- foreach( $aliases as $alias )
- {
- $bbcodeCurrent[ $alias ] = $row;
- }
- }
- }
- }
-
- if ( count( $bbcodeOld ) )
- {
- foreach( $bbcodeOld as $tag => $row )
- {
- if ( ! $bbcodeCurrent[ $row['bbcode_tag'] ] )
- {
- $bbcodeNew[ $row['bbcode_tag'] ] = $row;
- }
- }
- }
-
- $this->registry->output->addMessage("BBCode tags upgraded....");
-
- /* Now see if there's anything we need to move back over */
- if ( count( $bbcodeNew ) )
- {
- foreach( $bbcodeNew as $tag => $data )
- {
- $bbarray = array(
- 'bbcode_title' => $data['bbcode_title'],
- 'bbcode_desc' => $data['bbcode_desc'],
- 'bbcode_tag' => $data['bbcode_tag'],
- 'bbcode_replace' => IPSText::safeslashes($data['bbcode_replace']),
- 'bbcode_useoption' => $data['bbcode_useoption'],
- 'bbcode_example' => $data['bbcode_example'],
- 'bbcode_switch_option' => $data['bbcode_switch_option'],
- 'bbcode_menu_option_text' => $data['bbcode_menu_option_text'],
- 'bbcode_menu_content_text' => $data['bbcode_menu_content_text'],
- 'bbcode_groups' => 'all',
- 'bbcode_sections' => 'all',
- 'bbcode_php_plugin' => '',
- 'bbcode_parse' => 2,
- 'bbcode_no_parsing' => 0,
- 'bbcode_optional_option' => 0,
- 'bbcode_aliases' => '',
- 'bbcode_image' => ''
- );
-
- $this->DB->insert( 'custom_bbcode', $bbarray );
- }
- }
-
- /* OK, now onto permissions... */
- /* Insert basic perms for profiles and help */
- $this->DB->insert( 'permission_index', array( 'app' => 'members',
- 'perm_type' => 'profile_view',
- 'perm_type_id' => 1,
- 'perm_view' => '*',
- 'perm_2' => '',
- 'perm_3' => '',
- 'perm_4' => '',
- 'perm_5' => '',
- 'perm_6' => '',
- 'perm_7' => '' ) );
-
- $this->DB->insert( 'permission_index', array( 'app' => 'core',
- 'perm_type' => 'help',
- 'perm_type_id' => 1,
- 'perm_view' => '*',
- 'perm_2' => '',
- 'perm_3' => '',
- 'perm_4' => '',
- 'perm_5' => '',
- 'perm_6' => '',
- 'perm_7' => '' ) );
-
- /* And now calendars */
- $this->DB->build( array( 'select' => '*',
- 'from' => 'cal_calendars' ) );
-
- $o = $this->DB->execute();
-
- while( $row = $this->DB->fetch( $o ) )
- {
- if ( strstr( $row['cal_permissions'], 'a:' ) )
- {
- $_perms = unserialize( stripslashes( $row['cal_permissions'] ) );
-
- if ( is_array( $_perms ) )
- {
- $_view = ( $_perms['perm_read'] ) ? ',' . implode( ',', explode( ',', $_perms['perm_read'] ) ) . ',' : '';
- $_start = ( $_perms['perm_post'] ) ? ',' . implode( ',', explode( ',', $_perms['perm_post'] ) ) . ',' : '';
- $_nomod = ( $_perms['perm_nomod'] ) ? ',' . implode( ',', explode( ',', $_perms['perm_nomod'] ) ). ',' : '';
-
- $this->DB->insert( 'permission_index', array( 'app' => 'calendar',
- 'perm_type' => 'calendar',
- 'perm_type_id' => $row['cal_id'],
- 'perm_view' => str_replace( ',*,', '*', $_view ),
- 'perm_2' => str_replace( ',*,', '*', $_start ),
- 'perm_3' => str_replace( ',*,', '*', $_nomod ),
- 'perm_4' => '',
- 'perm_5' => '',
- 'perm_6' => '',
- 'perm_7' => '' ) );
- }
- else
- {
- $this->DB->insert( 'permission_index', array( 'app' => 'calendar',
- 'perm_type' => 'calendar',
- 'perm_type_id' => $row['cal_id'],
- 'perm_view' => '',
- 'perm_2' => '',
- 'perm_3' => '',
- 'perm_4' => '',
- 'perm_5' => '',
- 'perm_6' => '',
- 'perm_7' => '' ) );
- }
- }
- else
- {
- $this->DB->insert( 'permission_index', array( 'app' => 'calendar',
- 'perm_type' => 'calendar',
- 'perm_type_id' => $row['cal_id'],
- 'perm_view' => '',
- 'perm_2' => '',
- 'perm_3' => '',
- 'perm_4' => '',
- 'perm_5' => '',
- 'perm_6' => '',
- 'perm_7' => '' ) );
- }
- }
-
- /* And now forums */
- $this->DB->build( array( 'select' => '*',
- 'from' => 'forums' ) );
-
- $o = $this->DB->execute();
-
- while( $row = $this->DB->fetch( $o ) )
- {
- /* Do we need to tidy up the title? */
- if ( strstr( $row['name'], '&' ) )
- {
- $row['name'] = preg_replace( "#& #", "& ", $row['name'] );
-
- $this->DB->update( 'forums', array( 'name' => $row['name'] ), 'id=' . $row['id'] );
- }
-
- if ( strstr( $row['permission_array'], 'a:' ) )
- {
- $_perms = unserialize( stripslashes( $row['permission_array'] ) );
-
- if ( is_array( $_perms ) )
- {
- $_view = ( $_perms['show_perms'] ) ? ',' . implode( ',', explode( ',', $_perms['show_perms'] ) ) . ',' : '';
- $_read = ( $_perms['read_perms'] ) ? ',' . implode( ',', explode( ',', $_perms['read_perms'] ) ) . ',' : '';
- $_reply = ( $_perms['reply_perms'] ) ? ',' . implode( ',', explode( ',', $_perms['reply_perms'] ) ) . ',' : '';
- $_start = ( $_perms['start_perms'] ) ? ',' . implode( ',', explode( ',', $_perms['start_perms'] ) ) . ',' : '';
- $_upload = ( $_perms['upload_perms'] ) ? ',' . implode( ',', explode( ',', $_perms['upload_perms'] ) ) . ',' : '';
- $_download = ( $_perms['download_perms'] ) ? ',' . implode( ',', explode( ',', $_perms['download_perms'] ) ) . ',' : '';
-
- $this->DB->insert( 'permission_index', array( 'app' => 'forums',
- 'perm_type' => 'forum',
- 'perm_type_id' => $row['id'],
- 'perm_view' => str_replace( ',*,', '*', $_view ),
- 'perm_2' => str_replace( ',*,', '*', $_read ),
- 'perm_3' => str_replace( ',*,', '*', $_reply ),
- 'perm_4' => str_replace( ',*,', '*', $_start ),
- 'perm_5' => str_replace( ',*,', '*', $_upload ),
- 'perm_6' => str_replace( ',*,', '*', $_download ),
- 'perm_7' => '' ) );
- }
- else
- {
- $this->DB->insert( 'permission_index', array( 'app' => 'forums',
- 'perm_type' => 'forum',
- 'perm_type_id' => $row['id'],
- 'perm_view' => '',
- 'perm_2' => '',
- 'perm_3' => '',
- 'perm_4' => '',
- 'perm_5' => '',
- 'perm_6' => '',
- 'perm_7' => '' ) );
-
- IPSSetUp::addLogMessage( "Skipped perms (no array) for forum id: " . $row['id'], '30001', 'core' );
- }
- }
- else
- {
- $this->DB->insert( 'permission_index', array( 'app' => 'forums',
- 'perm_type' => 'forum',
- 'perm_type_id' => $row['id'],
- 'perm_view' => '',
- 'perm_2' => '',
- 'perm_3' => '',
- 'perm_4' => '',
- 'perm_5' => '',
- 'perm_6' => '',
- 'perm_7' => '' ) );
-
- IPSSetUp::addLogMessage( "Skipped perms (no array) for forum id: " . $row['id'], '30001', 'core' );
- }
- }
-
- $this->registry->output->addMessage("Permission indexes built....");
-
- /* Fix up forum moderators */
- $this->DB->build( array( 'select' => '*',
- 'from' => 'moderators' ) );
-
- $o = $this->DB->execute();
-
- while( $r = $this->DB->fetch( $o ) )
- {
- $this->DB->update( 'moderators', array( 'forum_id' => ',' . IPSText::cleanPermString( $r['forum_id'] ) . ',' ), 'mid=' . $r['mid'] );
- }
-
- $this->registry->output->addMessage("Forum moderators updated....");
-
- /* Root admin reset? */
- if ( $rootAdmins )
- {
- /* Find all admin groups */
- $this->DB->build( array( 'select' => '*',
- 'from' => 'groups',
- 'where' => 'g_id != ' . $this->settings['admin_group'] . ' AND g_access_cp=1' ) );
-
- $o = $this->DB->execute();
-
- while( $row = $this->DB->fetch( $o ) )
- {
- /* Insert blank perm row */
- $this->DB->insert( 'admin_permission_rows', array( 'row_id' => $row['g_id'],
- 'row_id_type' => 'group',
- 'row_perm_cache' => serialize( array() ),
- 'row_updated' => time() ) );
- }
-
- $this->registry->output->addMessage("Non Root Admin groups restricted....");
- }
-
- /* Report center reset */
- $canReport = array();
- $canView = array();
-
- $this->DB->build( array( 'select' => 'g_id, g_view_board, g_access_cp, g_is_supmod',
- 'from' => 'groups' ) );
-
- $o = $this->DB->execute();
-
- while( $r = $this->DB->fetch( $o ) )
- {
- if( $r['g_access_cp'] OR $r['g_is_supmod'] )
- {
- $canView[] = $r['g_id'];
- }
-
- if( $r['g_view_board'] AND $r['g_id'] != $this->settings['guest_group'] )
- {
- $canReport[] = $r['g_id'];
- }
- }
-
- $this->DB->update( 'rc_classes', array( 'group_can_report' => ',' . implode( ',', $canReport ) . ',', 'mod_group_perm' => ',' . implode( ',', $canView ) . ',' ) );
-
- /* Next Page */
- $this->request['workact'] = 'skinlang';
- }
-
- /**
- * Export skin and languages
- *
- * @return @e void
- */
- public function exportSkinLang()
- {
- /* INIT */
- $start = intval( $this->request['st'] );
- $converted = 0;
- $options = IPSSetUp::getSavedData('custom_options');
- $_doSkin = $options['core'][30001]['exportSkins'];
- $_doLang = $options['core'][30001]['exportLangs'];
-
- /* Doing anything? */
- if ( ! $_doSkin AND ! $_doLang )
- {
- $this->registry->output->addMessage( "Nothing to export" );
-
- /* Next Page */
- $this->request['workact'] = 'pms';
- return;
- }
-
- /* Ok... */
- if ( ! $start )
- {
- /* Do langs.. */
- if ( $_doLang )
- {
- if ( ! is_dir( IPS_CACHE_PATH . 'cache/previousLangFiles' ) )
- {
- if ( @mkdir( IPS_CACHE_PATH . 'cache/previousLangFiles', IPS_FOLDER_PERMISSION ) )
- {
- @chmod( IPS_CACHE_PATH . 'cache/previousLangFiles', IPS_FOLDER_PERMISSION );
- }
- }
-
- try
- {
- foreach( new DirectoryIterator( IPS_CACHE_PATH . 'cache/lang_cache' ) as $file )
- {
- if ( ! $file->isDot() AND $file->isDir() )
- {
- $name = $file->getFilename();
-
- if ( substr( $name, 0, 1 ) != '.' )
- {
- $this->registry->output->addMessage( "Moved Language Directory: {$name}" );
-
- @rename( IPS_CACHE_PATH . 'cache/lang_cache/' . $name, IPS_CACHE_PATH . 'cache/previousLangFiles/' . $name );
- }
- }
- }
- } catch ( Exception $e ) {}
- }
- }
-
- /* Doing skins? */
- if ( $_doSkin )
- {
- $this->DB->build( array( 'select' => '*',
- 'from' => 'skin_sets',
- 'where' => 'set_skin_set_id > ' . $start,
- 'limit' => array( 0, 1 ),
- 'order' => 'set_skin_set_id ASC' ) );
-
- $this->DB->execute();
-
- $set = $this->DB->fetch();
-
- if ( ! $set )
- {
- $this->request['st'] = 0;
-
- /* All done.. */
- $this->registry->output->addMessage( "No more skin sets to export" );
-
- /* Next Page */
- $this->request['workact'] = 'pms';
- return;
- }
- else
- {
- if ( ! is_dir( IPS_CACHE_PATH . 'cache/previousSkinFiles' ) )
- {
- if ( @mkdir( IPS_CACHE_PATH . 'cache/previousSkinFiles', IPS_FOLDER_PERMISSION ) )
- {
- @chmod( IPS_CACHE_PATH . 'cache/previousSkinFiles', IPS_FOLDER_PERMISSION );
- }
- }
-
- $safeName = IPSText::alphanumericalClean( $set['set_name'] );
- $dirPath = IPS_CACHE_PATH . 'cache/previousSkinFiles/' . $safeName;
-
- if ( @mkdir( $dirPath, IPS_FOLDER_PERMISSION ) )
- {
- @chmod( $dirPath, IPS_FOLDER_PERMISSION );
- }
-
- if ( is_dir( $dirPath ) )
- {
- /* Export CSS */
- if ( @mkdir( $dirPath . '/css', IPS_FOLDER_PERMISSION ) )
- {
- @chmod( $dirPath . '/css', IPS_FOLDER_PERMISSION );
- }
-
- @file_put_contents( $dirPath . '/css/css.css', $set['set_cache_css'] );
-
- /* Export Wrapper */
- if ( @mkdir( $dirPath . '/wrapper', IPS_FOLDER_PERMISSION ) )
- {
- @chmod( $dirPath . '/wrapper', IPS_FOLDER_PERMISSION );
- }
-
- @file_put_contents( $dirPath . '/wrapper/wrapper.html', $set['set_wrapper'] );
-
- /* Export Templates */
- if ( @mkdir( $dirPath . '/templates', IPS_FOLDER_PERMISSION ) )
- {
- @chmod( $dirPath . '/templates', IPS_FOLDER_PERMISSION );
- }
-
- $this->DB->build( array( 'select' => '*',
- 'from' => 'skin_templates_old',
- 'where' => 'set_id=' . $set['set_skin_set_id'],
- 'order' => 'func_name ASC' ) );
-
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- $_groupName = IPSText::alphanumericalClean( $row['group_name'] );
- $_bitName = IPSText::alphanumericalClean( $row['func_name'] );
-
- /* Make section dir */
- if ( @mkdir( $dirPath . '/templates/' . $_groupName, IPS_FOLDER_PERMISSION ) )
- {
- @chmod( $dirPath . '/templates/' . $_groupName, IPS_FOLDER_PERMISSION );
- }
-
- @file_put_contents( $dirPath . '/templates/' . $_groupName . '/' . $_bitName . '.html', $row['section_content'] );
- }
- }
-
- /* Set ID */
- $this->request['st'] = $set['set_skin_set_id'];
-
- /* We did some, go check again.. */
- $this->registry->output->addMessage( $set['set_name'] . " Exported" );
-
- /* Next Page */
- $this->request['workact'] = 'skinlang';
- return;
- }
- }
-
- /* We did some, go check again.. */
- $this->registry->output->addMessage( 'No skins or languages to export' );
-
- /* Next Page */
- $this->request['workact'] = 'pms';
- return;
- }
-
- /**
- * Convert PMs
- *
- * @return @e void
- */
- public function convertPms()
- {
- /* INIT */
- $pergo = 200;
- $start = intval( $this->request['st'] );
- $converted = 0;
- $seen = 0;
-
- $options = IPSSetUp::getSavedData('custom_options');
- $skipPms = $options['core'][30001]['skipPms'];
-
- /* Skipping? */
- if ( $skipPms )
- {
- /* Update all members */
- $this->DB->update( 'members', array( 'msg_count_reset' => 1, 'msg_count_new' => 0 ) );
-
- /* add a message */
- $this->registry->output->addMessage( "Skipping PM Conversion" );
-
- $this->request['workact'] = 'contacts';
- $this->request['st'] = 0;
- 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; # Luke added that space. That's his first contribution to the code vaults at IPS.
- }
-
- /* 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();
-
- /* 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 );
- $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'];/*noLibHook*/
- }
-
- $_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->addMessage( "Checked " . $this->request['st'] . " PMs so far. This cycle: $converted Private Messages converted into conversations.." );
-
- /* Re-do Page */
- $this->request['workact'] = 'pms';
- }
- else
- {
- /* Update all members */
- $this->DB->update( 'members', array( 'msg_count_reset' => 1 ) );
-
- /* Nope, nothing to do - we're done! */
- /* Next Page */
- $this->request['workact'] = 'contacts';
- $this->request['st'] = 0;
- }
- }
-
- /**
- * Convert Block lists
- *
- * @return @e void
- */
- public function convertBlockLists()
- {
- /* INIT */
- $pergo = 200;
- $start = intval( $this->request['st'] );
- $options = IPSSetUp::getSavedData('custom_options');
- $skipPms = $options['core'][30001]['skipPms'];
- $converted = 0;
- $seen = 0;
-
- /* Skipping? */
- if ( $skipPms )
- {
- /* add a message */
- $this->registry->output->addMessage( "Skipping Block List Conversion" );
-
- $this->request['workact'] = 'pmblock';
- $this->request['st'] = 0;
- return;
- }
-
- $this->DB->build( array( 'select' => '*',
- 'from' => 'members',
- 'where' => method_exists( $this->DB, 'setTableIdentityInsert' ) ? 'ignored_users NOT LIKE \'\'' : $this->DB->buildLength('ignored_users') . ' > 0',
- 'order' => 'member_id ASC',
- 'limit' => array( $start, $pergo ) ) );
-
- $o = $this->DB->execute();
-
- while( $member = $this->DB->fetch( $o ) )
- {
- $seen++;
-
- /* Got anything? */
- if ( strstr( $member['ignored_users'], ',' ) )
- {
- $ignored = explode( ',', $member['ignored_users'] );
- }
-
- if ( ! is_array( $ignored ) )
- {
- continue;
- }
-
- /* Add it to the table */
- foreach( $ignored as $iid )
- {
- if ( ! $iid )
- {
- continue;
- }
-
- $this->DB->insert( 'ignored_users', array( 'ignore_owner_id' => $member['member_id'],
- 'ignore_ignore_id' => $iid,
- 'ignore_topics' => 1 ) );
- }
-
- $converted++;
- }
-
- /* What to do? */
- if ( $seen )
- {
- $this->request['st'] = $start + $pergo;
-
- /* We did some, go check again.. */
- $this->registry->output->addMessage( "$converted member's ignore list converted." );
-
- /* Re-do Page */
- $this->request['workact'] = 'contacts';
- }
- else
- {
- /* Nope, nothing to do - we're done! */
- /* Next Page */
- $this->request['workact'] = 'pmblock';
- $this->request['st'] = 0;
- }
- }
-
- /**
- * Convert Block lists
- *
- * @return @e void
- */
- public function convertPmBlockLists()
- {
- /* INIT */
- $pergo = 200;
- $start = intval( $this->request['st'] );
- $converted = 0;
- $seen = 0;
- $options = IPSSetUp::getSavedData('custom_options');
- $skipPms = $options['core'][30001]['skipPms'];
-
- /* Skipping? */
- if ( $skipPms )
- {
- /* add a message */
- $this->registry->output->addMessage( "Skipping PM Block List Conversion" );
-
- $this->request['workact'] = 'finish';
- $this->request['st'] = 0;
- return;
- }
-
- $this->DB->build( array( 'select' => '*',
- 'from' => 'contacts',
- 'where' => 'allow_msg=0',
- 'order' => 'id ASC',
- 'limit' => array( $start, $pergo ) ) );
-
- $o = $this->DB->execute();
-
- while( $contact = $this->DB->fetch( $o ) )
- {
- $seen++;
-
- /* Already got an entry for this contact? */
- $test = $this->DB->buildAndFetch( array( 'select' => '*',
- 'from' => 'ignored_users',
- 'where' => 'ignore_owner_id=' . intval( $contact['member_id'] ) ) );
-
- /* Got anything? */
- if ( $test['ignore_owner_id'] )
- {
- $this->DB->update( 'ignored_users', array( 'ignore_messages' => 1 ), 'ignore_id=' . $test['ignore_id'] );
- }
- else
- {
- $this->DB->insert( 'ignored_users', array( 'ignore_owner_id' => $contact['member_id'],
- 'ignore_ignore_id' => $contact['contact_id'],
- 'ignore_messages' => 1 ) );
- }
-
- $converted++;
- }
-
- /* What to do? */
- if ( $seen )
- {
- $this->request['st'] = $start + $pergo;
-
- /* We did some, go check again.. */
- $this->registry->output->addMessage( "$converted member's PM block list converted." );
-
- /* Re-do Page */
- $this->request['workact'] = 'pmblock';
- }
- else
- {
- /* Nope, nothing to do - we're done! */
- /* Next Page */
- $this->request['workact'] = 'finish';
- $this->request['st'] = 0;
- }
- }
-
- /**
- * Finish up conversion stuff
- *
- * @return @e void
- */
- public function finish()
- {
- $options = IPSSetUp::getSavedData('custom_options');
- $skipPms = $options['core'][30001]['skipPms'];
- $output = array();
-
- /* Emoticons */
- if ( file_exists( DOC_IPS_ROOT_PATH . 'style_emoticons/default' ) )
- {
- try
- {
- foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . 'style_emoticons/default' ) as $file )
- {
- if ( ! $file->isDot() )
- {
- $_name = $file->getFileName();
-
- /* Annoyingly, isDot doesn't match .svn, etc */
- if ( substr( $_name, 0, 1 ) == '.' )
- {
- continue;
- }
-
- if ( @copy( DOC_IPS_ROOT_PATH . 'style_emoticons/default/' . $_name, IPS_PUBLIC_PATH . 'style_emoticons/default/' . $_name ) )
- {
- $output[] = "Emoticon: Copying $_name...";
- }
- else
- {
- $output[] = "Could not copy $_name - move it manually post-installation";
- }
- }
- }
- } catch ( Exception $e ) {}
- }
-
- /* LOG IN METHODS */
- $this->DB->build( array( 'select' => '*',
- 'from' => 'login_methods' ) );
-
- $this->DB->execute();
-
- while( $row = $this->DB->fetch() )
- {
- $loginMethods[ $row['login_folder_name'] ] = $row;
- }
-
- $count = 6;
- $recount = array( 'internal' => 1,
- 'ipconverge' => 2,
- 'ldap' => 3,
- 'external' => 4 );
-
- /* Fetch XML */
- require_once( IPS_KERNEL_PATH . 'classXML.php' );/*noLibHook*/
- $xml = new classXML( IPSSetUp::charSet );
-
- $xml->load( IPS_ROOT_PATH . 'setup/xml/loginauth.xml' );
-
- foreach( $xml->fetchElements( 'login_methods' ) as $xmlelement )
- {
- $data = $xml->fetchElementsFromRecord( $xmlelement );
-
- $data['login_order'] = ( isset( $recount[ $data['login_folder_name'] ] ) ) ? $recount[ $data['login_folder_name'] ] : ++$count;
-
- unset( $data['login_id'] );
-
- if ( ! $loginMethods[ $data['login_folder_name'] ] )
- {
- $this->DB->insert( 'login_methods', $data );
- }
- else
- {
- $this->DB->update( 'login_methods', array( 'login_order' => $data['login_order'] ), 'login_folder_name=\'' . $data['login_folder_name'] . '\'' );
- }
- }
-
- /* Reset member languages and skins */
- $this->DB->update( 'members', array( 'language' => IPSLib::getDefaultLanguage(), 'skin' => 0 ) );
-
- /* Empty caches */
- $this->DB->delete( 'cache_store', "cs_key='forum_cache'");
- $this->DB->delete( 'cache_store', "cs_key='skin_id_cache'");
-
- /* Empty other tables */
- $this->DB->delete( 'skin_cache' );
- $this->DB->delete( 'skin_templates_cache' );
-
- /* Reset admin permissions */
- $this->DB->update( 'admin_permission_rows', array( 'row_perm_cache' => '' ) );
-
- /* Drop Tables */
- $this->DB->dropTable( 'contacts' );
- $this->DB->dropTable( 'skin_macro' );
- $this->DB->dropTable( 'skin_template_links' );
- $this->DB->dropTable( 'skin_templates_old' );
- $this->DB->dropTable( 'skin_sets' );
- $this->DB->dropTable( 'languages' );
- $this->DB->dropTable( 'topics_read' );
- $this->DB->dropTable( 'topic_markers' );
- $this->DB->dropTable( 'acp_help' );
- $this->DB->dropTable( 'members_converge' );
- $this->DB->dropTable( 'member_extra' );
- $this->DB->dropTable( 'custom_bbcode_old' );
- $this->DB->dropTable( 'admin_sessions' );
- $this->DB->dropTable( 'components' );
- $this->DB->dropTable( 'admin_permission_keys' );
- $this->DB->dropTable( 'conf_settings' );
- $this->DB->dropTable( 'conf_settings_titles' );
- $this->DB->dropTable( 'reg_antispam' );
-
- if ( ! $skipPms )
- {
- $this->DB->dropTable( 'message_text' );
- $this->DB->dropTable( 'message_topics_old' );
- }
-
- $message = ( is_array( $output ) AND count($output) ) ? implode( " ", $output ) . ' ' : '';
-
- $this->registry->output->addMessage( $message . "SQL clean up finished....");
-
- /* Last function, so unset workact */
- $this->request['workact'] = '';
- }
+Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class version_upgrade
+{
+ /**
+ * Custom HTML to show
+ *
+ * @var string
+ */
+ protected $_output = '';
+
+ /**
+ * fetchs output
+ *
+ * @return string
+ */
+ public function fetchOutput()
+ {
+ return $this->_output;
+ }
+
+ /**
+ * Execute selected method
+ *
+ * @param object Registry object
+ * @return @e void
+ */
+ 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->cache = $this->registry->cache();
+ $this->caches =& $this->registry->cache()->fetchCaches();
+
+ //--------------------------------
+ // What are we doing?
+ //--------------------------------
+
+ switch( $this->request['workact'] )
+ {
+ case 'sql':
+ case 'sql1':
+ $this->upgradeSql(1);
+ break;
+ case 'sql2':
+ $this->upgradeSql(2);
+ break;
+ case 'sql3':
+ $this->upgradeSql(3);
+ break;
+ case 'sql4':
+ $this->upgradeSql(4);
+ break;
+ case 'sql5':
+ $this->upgradeSql(5);
+ break;
+ case 'sql6':
+ $this->upgradeSql(6);
+ break;
+ case 'applications':
+ $this->addApplications();
+ break;
+ case 'settings':
+ $this->addSettings();
+ break;
+ case 'profile':
+ $this->addProfile();
+ break;
+ case 'permsAndBbcode':
+ $this->permsAndBbcode();
+ break;
+ case 'skinlang':
+ $this->exportSkinLang();
+ break;
+ case 'pms':
+ $this->convertPms();
+ break;
+ case 'contacts':
+ $this->convertBlockLists();
+ break;
+ case 'pmblock':
+ $this->convertPmBlockLists();
+ break;
+ case 'polls':
+ $this->rebuildPolls();
+ break;
+ case 'finish':
+ $this->finish();
+ break;
+
+ default:
+ $this->upgradeSql(1);
+ break;
+ }
+
+ /* Workact is set in the function, so if it has not been set, then we're done. The last function should unset it. */
+ if ( $this->request['workact'] )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ /**
+ * Run SQL files
+ *
+ * @param int
+ * @return @e void
+ */
+ public function upgradeSql( $id=1 )
+ {
+ $cnt = 0;
+ $SQL = array();
+ $file = '_updates_'.$id.'.php';
+ $output = "";
+ $path = IPSLib::getAppDir( 'core' ) . '/setup/versions/upg_30001/' . strtolower( $this->registry->dbFunctions()->getDriverType() ) . $file;
+ $prefix = $this->registry->dbFunctions()->getPrefix();
+ $sourceFile = '';
+
+ if ( is_file( $path ) )
+ {
+ require( $path );/*noLibHook*/
+
+ /* Set DB driver to return any errors */
+ $this->DB->return_die = 1;
+
+ foreach( $SQL as $query )
+ {
+ $this->DB->allow_sub_select = 1;
+ $this->DB->error = '';
+
+ $query = str_replace( "<%time%>", time(), $query );
+
+ if ( $this->settings['mysql_tbl_type'] )
+ {
+ if ( preg_match( "/^create table(.+?)/i", $query ) )
+ {
+ $query = preg_replace( "/^(.+?)\);$/is", "\\1) ENGINE={$this->settings['mysql_tbl_type']};", $query );
+ }
+ }
+
+ /* Need to tack on a prefix? */
+ if ( $prefix )
+ {
+ $query = IPSSetUp::addPrefixToQuery( $query, $prefix );
+ }
+
+ if( IPSSetUp::getSavedData('man') )
+ {
+ $query = trim( $query );
+
+ /* Ensure the last character is a semi-colon */
+ if ( substr( $query, -1 ) != ';' )
+ {
+ $query .= ';';
+ }
+
+ $output .= $query . "\n\n";
+ }
+ else
+ {
+ $this->DB->query( $query );
+
+ if ( $this->DB->error )
+ {
+ $this->registry->output->addError( " " . $query." ".$this->DB->error );
+ }
+ else
+ {
+ $cnt++;
+ }
+ }
+ }
+
+ $this->registry->output->addMessage("$cnt запросов выполнено....");
+ }
+
+ /* Next Page */
+ $this->request['st'] = 0;
+
+ if ( $id < 6 )
+ {
+ $nextid = $id + 1;
+ $this->request['workact'] = 'sql'.$nextid;
+ }
+ else
+ {
+ $this->request['workact'] = 'applications';
+ }
+
+ if ( IPSSetUp::getSavedData('man') AND $output )
+ {
+ /* Create source file */
+ if ( $this->registry->dbFunctions()->getDriverType() == 'mysql' )
+ {
+ $sourceFile = IPSSetUp::createSqlSourceFile( $output, '30001', $id );
+ }
+
+ $this->_output = $this->registry->output->template()->upgrade_manual_queries( $output, $sourceFile );
+ }
+ }
+
+
+ /**
+ * Add Applications
+ *
+ * @return @e void
+ */
+ public function addApplications()
+ {
+ /* Add applications.. */
+ $apps = array( 'core' => array(), 'ips' => array(), 'other' => array() );
+ $components = array();
+
+ foreach( array( 'applications', 'applications_addon/ips', 'applications_addon/other' ) as $_pBit )
+ {
+ $path = IPS_ROOT_PATH . $_pBit;
+ $handle = opendir( $path );
+
+ while ( ( $file = readdir( $handle ) ) !== FALSE )
+ {
+ if ( ! preg_match( "#^\.#", $file ) )
+ {
+ if ( is_dir( $path . '/' . $file ) )
+ {
+ //-----------------------------------------
+ // Get it!
+ //-----------------------------------------
+
+ if ( ! is_file( IPS_ROOT_PATH . $_pBit . '/' . $file . '/xml/information.xml' ) )
+ {
+ continue;
+ }
+
+ $data = IPSSetUp::fetchXmlAppInformation( $file );
+
+ switch( $_pBit )
+ {
+ case 'applications':
+ $apps['core'][ $file ] = $data;
+ break;
+ case 'applications_addon/ips':
+ $apps['ips'][ $file ] = $data;
+ break;
+ case 'applications_addon/other':
+ $apps['other'][ $file ] = $data;
+ break;
+ }
+ }
+ }
+ }
+
+ closedir( $handle );
+ }
+
+ /* Reorder the array so that core is first */
+ $new_array = array();
+ $new_array['core'] = $apps['core']['core'];
+
+ foreach( $apps['core'] as $app => $data )
+ {
+ if( $app == 'core' )
+ {
+ continue;
+ }
+
+ $new_array[$app] = $data;
+ }
+
+ $apps['core'] = $new_array;
+
+ /* Fetch data for current 'components' */
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'components' ) );
+
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $components[ $row['com_section'] ] = $row;
+ }
+
+ /* Got Gallery? */
+ if ( $components['gallery']['com_enabled'] AND $this->DB->checkForTable( 'gallery_upgrade_history' ) )
+ {
+ /* Fetch current version number */
+ $version = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'gallery_upgrade_history',
+ 'order' => 'gallery_version_id DESC',
+ 'limit' => array( 0, 1 ) ) );
+
+ $apps['ips']['gallery']['_currentLong'] = $version['gallery_version_id'];
+ $apps['ips']['gallery']['_currentHuman'] = $version['gallery_version_human'];
+ }
+
+ /* Got Blog? */
+ if ( $components['blog']['com_enabled'] AND $this->DB->checkForTable( 'blog_upgrade_history' ) )
+ {
+ /* Fetch current version number */
+ $version = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'blog_upgrade_history',
+ 'order' => 'blog_version_id DESC',
+ 'limit' => array( 0, 1 ) ) );
+
+ $apps['ips']['blog']['_currentLong'] = $version['blog_version_id'];
+ $apps['ips']['blog']['_currentHuman'] = $version['blog_version_human'];
+ }
+
+ /* Got Downloads? */
+ if ( $components['downloads']['com_enabled'] AND $this->DB->checkForTable( 'downloads_upgrade_history' ) )
+ {
+ /* Fetch current version number */
+ $version = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'downloads_upgrade_history',
+ 'order' => 'idm_version_id DESC',
+ 'limit' => array( 0, 1 ) ) );
+
+ $apps['ips']['downloads']['_currentLong'] = $version['idm_version_id'];
+ $apps['ips']['downloads']['_currentHuman'] = $version['idm_version_human'];
+ }
+
+ /* Others.. */
+ $apps['core']['forums']['_currentLong'] = '30001';
+ $apps['core']['forums']['_currentHuman'] = '3.0.0';
+
+ $apps['core']['core']['_currentLong'] = '30001';
+ $apps['core']['core']['_currentHuman'] = '3.0.0';
+
+ $apps['core']['members']['_currentLong'] = '30001';
+ $apps['core']['members']['_currentHuman'] = '3.0.0';
+
+ $apps['ips']['portal']['_currentLong'] = '30003';
+ $apps['ips']['portal']['_currentHuman'] = '3.0.0';
+
+ //$apps['ips']['chat']['_currentLong'] = '30003';
+ //$apps['ips']['chat']['_currentHuman'] = '3.0.0';
+
+ /* If we are upgrading from 2.3 and did not upload the calendar files, we still need to insert
+ the applications table entry, otherwise you won't be able to upgrade down the road. We will
+ insert it as disabled, however, as calendar won't function since files are not available
+ @link http://community.invisionpower.com/tracker/issue-33543-ipb2-upgrades */
+ if( !isset($apps['ips']['calendar']['name']) )
+ {
+ $apps['ips']['calendar'] = array(
+ 'name' => 'Calendar',
+ 'public_name' => 'Calendar',
+ 'description' => "",
+ 'author' => "Invision Power Services, Inc.",
+ 'hide_tab' => 0,
+ 'key' => 'calendar',
+ 'disabledatinstall' => 1,
+ 'ipskey' => "fa038db69fa627d8e8e034d65f554d1f",
+ '_locationkey' => 'ips',
+ );
+ }
+
+ $apps['ips']['calendar']['_currentLong'] = '30003';
+ $apps['ips']['calendar']['_currentHuman'] = '3.0.0';
+
+ /* Now install them.. */
+ $num = 0;
+
+ foreach( $apps as $where => $data )
+ {
+ foreach( $apps[ $where ] as $dir => $appData )
+ {
+ //-----------------------------------------
+ // Had Gallery (e.g.) but didn't upload updated files
+ //-----------------------------------------
+
+ if( !$appData['name'] )
+ {
+ continue;
+ }
+
+ $num++;
+ $_protected = ( in_array( $appData['key'], array( 'core', 'forums', 'members' ) ) ) ? 1 : 0;
+ $_enabled = ( $appData['disabledatinstall'] ) ? 0 : 1;
+
+ if ( ! $appData['_currentLong'] )
+ {
+ continue;
+ }
+
+ $this->registry->output->addMessage("Добавление приложения: {$appData['name']}....");
+
+ $this->DB->insert( 'core_applications', array( 'app_title' => $appData['name'],
+ 'app_public_title' => ( $appData['public_name'] ) ? $appData['public_name'] : '', // Allow blank in case it's an admin-only app
+ 'app_description' => $appData['description'],
+ 'app_author' => $appData['author'],
+ 'app_hide_tab' => intval($appData['hide_tab']),
+ 'app_version' => $appData['_currentHuman'],
+ 'app_long_version' => $appData['_currentLong'],
+ 'app_directory' => $appData['key'],
+ 'app_added' => time(),
+ 'app_position' => $num,
+ 'app_protected' => $_protected,
+ 'app_location' => $appData['_locationkey'] ? $appData['_locationkey'] : IPSLib::extractAppLocationKey( $appData['key'] ),
+ 'app_enabled' => $_enabled,
+ 'app_website' => $appData['website'],
+ 'app_update_check' => $appData['update_check'],
+ 'app_global_caches' => $appData['global_caches'],
+ ) );
+ }
+ }
+
+ /* Next Page */
+ $this->request['workact'] = 'settings';
+ }
+
+ /**
+ * Add Settings
+ *
+ * @return @e void
+ */
+ public function addSettings()
+ {
+ /* INIT */
+ $known = array();
+ $apps = array();
+
+ /* Grab all known settings */
+ $this->DB->build( array( 'select' => '*', 'from' => 'conf_settings' ) );
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ if ( $row['conf_value'] != '' )
+ {
+ $known[ $row['conf_key'] ] = $row['conf_value'];
+ }
+ }
+
+ /* Brandon's bug report thingy #12516*/
+ if ( ! $known['gb_char_set'] )
+ {
+ /* No charset, set - so we need to now ensure that iso-8859-1 is set */
+ $known['gb_char_set'] = 'utf-8';
+ }
+
+ /* Wipe out custom time/date settings */
+ foreach( array( 'clock_short', 'clock_long', 'clock_tiny', 'clock_date', 'clock_joined', 'time_use_relative_format' ) as $setting )
+ {
+ unset( $known[ $setting ] );
+ }
+
+ /* Now we need to fix moderator groups who have permission to RC */
+ $groups = array();
+
+ $this->DB->build( array( 'select' => 'g_id', 'from' => 'groups', 'where' => 'g_access_cp=1 OR g_is_supmod=1' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $groups[] = $r['g_id'];
+ }
+
+ $known['report_mod_group_access'] = implode( ',', $groups );
+
+ /* Load apps */
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_applications' ) );
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $apps[ $row['app_directory'] ] = $row;
+ }
+
+ /* Add 'em */
+ foreach( $apps as $dir => $data )
+ {
+ if ( is_file( IPSLib::getAppDir( $dir ) . '/xml/' . $dir . '_settings.xml' ) )
+ {
+ $classToLoad = IPSLib::loadActionOverloader( IPS_ROOT_PATH . 'applications/core/modules_admin/settings/settings.php', 'admin_core_settings_settings' );
+ $settings = new $classToLoad();
+ $settings->makeRegistryShortcuts( $this->registry );
+
+ $this->request['app_dir'] = $dir;
+ $settings->importAllSettings( 1, 1, $known );
+
+ $this->registry->output->addMessage("Добавление настроек для приложения {$data['app_title']}....");
+ }
+ }
+
+ /* Next Page */
+ $this->request['workact'] = 'profile';
+ }
+
+ /**
+ * Sort out profile fields
+ *
+ * @return @e void
+ */
+ public function addProfile()
+ {
+ /* INIT */
+ $fields = array();
+ $prefix = $this->registry->dbFunctions()->getPrefix();
+ $sourceFile = '';
+
+ /* Get DB driver file */
+ require_once( IPSLib::getAppDir( 'core' ) . '/setup/versions/upg_30001/' . strtolower( $this->registry->dbFunctions()->getDriverType() ) . '_version_upgrade.php' );/*noLibHook*/
+
+ /* First off, move all current profile fields to group ID 3 */
+ $this->DB->update( 'pfields_data', array( 'pf_group_id' => 3 ), 'pf_group_id=0' );
+
+ /* Grab all custom fields */
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'pfields_data' ) );
+
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $fields[ $row['pf_id'] ] = $row;
+ }
+
+ foreach( $fields as $id => $data )
+ {
+ /* Now add any missing content fields */
+ if ( ! $this->DB->checkForField( "field_$id", 'pfields_content' ) )
+ {
+ $this->DB->addField( 'pfields_content', "field_$id", 'text' );
+ }
+ }
+
+ $this->DB->optimize( 'pfields_content' );
+
+ /* Now make add a key */
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'pfields_data',
+ 'where' => 'pf_group_id=3' ) );
+
+ $o = $this->DB->execute();
+
+ while( $row = $this->DB->fetch( $o ) )
+ {
+ /* Attempt basic conversion of data */
+ if ( $row['pf_topic_format'] )
+ {
+ if ( $row['pf_topic_format'] == '{title}: {content} ' )
+ {
+ $row['pf_topic_format'] = '{title}: {content} ';
+ }
+ else if ( $row['pf_topic_format'] == '{title}: {key} ' )
+ {
+ $row['pf_topic_format'] = '{title}: {key} ';
+ }
+ }
+
+ /* 2.3.x used 'text', 3.0.0 uses 'input'... */
+ $row['pf_type'] = ( $row['pf_type'] == 'text' ) ? 'input' : $row['pf_type'];
+
+ $this->DB->update( 'pfields_data', array( 'pf_type' => $row['pf_type'], 'pf_topic_format' => $row['pf_topic_format'], 'pf_key' => IPSText::makeSeoTitle( $row['pf_title'] ) ), 'pf_id=' . $row['pf_id'] );
+ }
+
+ /* Now, move profile data into the correct fields */
+ foreach( array( 'aim_name' => 'aim',
+ 'icq_number' => 'icq',
+ 'website' => 'website',
+ 'yahoo' => 'yahoo',
+ 'interests' => 'interests',
+ 'msnname' => 'msn',
+ 'location' => 'location' ) as $old => $new )
+ {
+ $field = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'pfields_data',
+ 'where' => 'pf_key=\'' . $new . '\'' ) );
+
+
+
+
+ $query = SQLVC::UpdateOne( $old, $field );
+
+ if( is_null($query) )
+ {
+ continue;
+ }
+
+ if ( IPSSetUp::getSavedData('man') )
+ {
+ $query = trim( $query );
+
+ /* Ensure the last character is a semi-colon */
+ if ( substr( $query, -1 ) != ';' )
+ {
+ $query .= ';';
+ }
+
+ $output .= $query . "\n\n";
+ }
+ else
+ {
+ $this->DB->query( $query );
+
+ if ( $this->DB->error )
+ {
+ $this->registry->output->addError( $query." ".$this->DB->error );
+ }
+ else
+ {
+ $this->registry->output->addMessage("Конвертирование поля: {$old}....");
+ }
+ }
+ }
+
+ /* Update gender */
+ $gender = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'pfields_data',
+ 'where' => 'pf_key=\'gender\'' ) );
+
+ if ( $gender['pf_id'] )
+ {
+ $queries = array( SQLVC::UpdateTwo( $gender ),
+ SQLVC::UpdateThree( $gender ) );
+
+ foreach( $queries as $query )
+ {
+ if ( IPSSetUp::getSavedData('man') )
+ {
+ $query = trim( $query );
+
+ /* Ensure the last character is a semi-colon */
+ if ( substr( $query, -1 ) != ';' )
+ {
+ $query .= ';';
+ }
+
+ $output .= $query . "\n\n";
+ }
+ else
+ {
+ $this->DB->query( $query );
+
+ if ( $this->DB->error )
+ {
+ $this->registry->output->addError( $query." ".$this->DB->error );
+ }
+ else
+ {
+ $this->registry->output->addMessage("Конвертирование поля «Пол»....");
+ }
+ }
+ }
+ }
+
+ if ( IPSSetUp::getSavedData('man') AND $output )
+ {
+ /* Create source file */
+ if ( $this->registry->dbFunctions()->getDriverType() == 'mysql' )
+ {
+ $sourceFile = IPSSetUp::createSqlSourceFile( $output, '30001', 'pf' );
+ }
+
+ $this->_output = $this->registry->output->template()->upgrade_manual_queries( $output, $sourceFile );
+ }
+
+ /* Next Page */
+ $this->request['workact'] = 'permsAndBbcode';
+ }
+
+ /**
+ * Sort out bbcode and permissions
+ *
+ * @return @e void
+ */
+ public function permsAndBbcode()
+ {
+ /* INIT */
+ $options = IPSSetUp::getSavedData('custom_options');
+ $rootAdmins = $options['core'][30001]['rootAdmins'];
+
+ /* First off, import default BBCode */
+ $apps = array();
+ $bbcodeOld = array();
+ $bbcodeNew = array();
+
+ /* Load apps */
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'core_applications' ) );
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $apps[ $row['app_directory'] ] = $row;
+ }
+
+ /* Load old codes */
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'custom_bbcode_old' ) );
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $bbcodeOld[ $row['bbcode_tag'] ] = $row;
+ }
+
+ /* Add 'em */
+ foreach( $apps as $dir => $data )
+ {
+ if ( is_file( IPSLib::getAppDir( $dir ) . '/xml/' . $dir . '_bbcode.xml' ) )
+ {
+ //-----------------------------------------
+ // Continue
+ //-----------------------------------------
+
+ $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( IPSLib::getAppDir( $dir ) . '/xml/' . $dir . '_bbcode.xml' ) );
+ }
+
+ if ( is_file( IPSLib::getAppDir( $dir ) . '/xml/' . $dir . '_mediatag.xml' ) )
+ {
+ //-----------------------------------------
+ // Continue
+ //-----------------------------------------
+
+ $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( IPSLib::getAppDir( $dir ) . '/xml/' . $dir . '_mediatag.xml' ) );
+ }
+ }
+
+ /* Load current code */
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'custom_bbcode' ) );
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $bbcodeCurrent[ $row['bbcode_tag'] ] = $row;
+
+ //-----------------------------------------
+ // Need to take into account aliases too!
+ //-----------------------------------------
+
+ if( $row['bbcode_aliases'] )
+ {
+ $aliases = explode( ',', $row['bbcode_aliases'] );
+
+ if( count($aliases) )
+ {
+ foreach( $aliases as $alias )
+ {
+ $bbcodeCurrent[ $alias ] = $row;
+ }
+ }
+ }
+ }
+
+ if ( count( $bbcodeOld ) )
+ {
+ foreach( $bbcodeOld as $tag => $row )
+ {
+ if ( ! $bbcodeCurrent[ $row['bbcode_tag'] ] )
+ {
+ $bbcodeNew[ $row['bbcode_tag'] ] = $row;
+ }
+ }
+ }
+
+ $this->registry->output->addMessage("BB-коды обновлены....");
+
+ /* Now see if there's anything we need to move back over */
+ if ( count( $bbcodeNew ) )
+ {
+ foreach( $bbcodeNew as $tag => $data )
+ {
+ $bbarray = array(
+ 'bbcode_title' => $data['bbcode_title'],
+ 'bbcode_desc' => $data['bbcode_desc'],
+ 'bbcode_tag' => $data['bbcode_tag'],
+ 'bbcode_replace' => IPSText::safeslashes($data['bbcode_replace']),
+ 'bbcode_useoption' => $data['bbcode_useoption'],
+ 'bbcode_example' => $data['bbcode_example'],
+ 'bbcode_switch_option' => $data['bbcode_switch_option'],
+ 'bbcode_menu_option_text' => $data['bbcode_menu_option_text'],
+ 'bbcode_menu_content_text' => $data['bbcode_menu_content_text'],
+ 'bbcode_groups' => 'all',
+ 'bbcode_sections' => 'all',
+ 'bbcode_php_plugin' => '',
+ 'bbcode_parse' => 2,
+ 'bbcode_no_parsing' => 0,
+ 'bbcode_optional_option' => 0,
+ 'bbcode_aliases' => '',
+ 'bbcode_image' => ''
+ );
+
+ $this->DB->insert( 'custom_bbcode', $bbarray );
+ }
+ }
+
+ /* OK, now onto permissions... */
+ /* Insert basic perms for profiles and help */
+ $this->DB->insert( 'permission_index', array( 'app' => 'members',
+ 'perm_type' => 'profile_view',
+ 'perm_type_id' => 1,
+ 'perm_view' => '*',
+ 'perm_2' => '',
+ 'perm_3' => '',
+ 'perm_4' => '',
+ 'perm_5' => '',
+ 'perm_6' => '',
+ 'perm_7' => '' ) );
+
+ $this->DB->insert( 'permission_index', array( 'app' => 'core',
+ 'perm_type' => 'help',
+ 'perm_type_id' => 1,
+ 'perm_view' => '*',
+ 'perm_2' => '',
+ 'perm_3' => '',
+ 'perm_4' => '',
+ 'perm_5' => '',
+ 'perm_6' => '',
+ 'perm_7' => '' ) );
+
+ /* And now calendars */
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'cal_calendars' ) );
+
+ $o = $this->DB->execute();
+
+ while( $row = $this->DB->fetch( $o ) )
+ {
+ if ( strstr( $row['cal_permissions'], 'a:' ) )
+ {
+ $_perms = unserialize( stripslashes( $row['cal_permissions'] ) );
+
+ if ( is_array( $_perms ) )
+ {
+ $_view = ( $_perms['perm_read'] ) ? ',' . implode( ',', explode( ',', $_perms['perm_read'] ) ) . ',' : '';
+ $_start = ( $_perms['perm_post'] ) ? ',' . implode( ',', explode( ',', $_perms['perm_post'] ) ) . ',' : '';
+ $_nomod = ( $_perms['perm_nomod'] ) ? ',' . implode( ',', explode( ',', $_perms['perm_nomod'] ) ). ',' : '';
+
+ $this->DB->insert( 'permission_index', array( 'app' => 'calendar',
+ 'perm_type' => 'calendar',
+ 'perm_type_id' => $row['cal_id'],
+ 'perm_view' => str_replace( ',*,', '*', $_view ),
+ 'perm_2' => str_replace( ',*,', '*', $_start ),
+ 'perm_3' => str_replace( ',*,', '*', $_nomod ),
+ 'perm_4' => '',
+ 'perm_5' => '',
+ 'perm_6' => '',
+ 'perm_7' => '' ) );
+ }
+ else
+ {
+ $this->DB->insert( 'permission_index', array( 'app' => 'calendar',
+ 'perm_type' => 'calendar',
+ 'perm_type_id' => $row['cal_id'],
+ 'perm_view' => '',
+ 'perm_2' => '',
+ 'perm_3' => '',
+ 'perm_4' => '',
+ 'perm_5' => '',
+ 'perm_6' => '',
+ 'perm_7' => '' ) );
+ }
+ }
+ else
+ {
+ $this->DB->insert( 'permission_index', array( 'app' => 'calendar',
+ 'perm_type' => 'calendar',
+ 'perm_type_id' => $row['cal_id'],
+ 'perm_view' => '',
+ 'perm_2' => '',
+ 'perm_3' => '',
+ 'perm_4' => '',
+ 'perm_5' => '',
+ 'perm_6' => '',
+ 'perm_7' => '' ) );
+ }
+ }
+
+ /* And now forums */
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'forums' ) );
+
+ $o = $this->DB->execute();
+
+ while( $row = $this->DB->fetch( $o ) )
+ {
+ /* Do we need to tidy up the title? */
+ if ( strstr( $row['name'], '&' ) )
+ {
+ $row['name'] = preg_replace( "#& #", "& ", $row['name'] );
+
+ $this->DB->update( 'forums', array( 'name' => $row['name'] ), 'id=' . $row['id'] );
+ }
+
+ if ( strstr( $row['permission_array'], 'a:' ) )
+ {
+ $_perms = unserialize( stripslashes( $row['permission_array'] ) );
+
+ if ( is_array( $_perms ) )
+ {
+ $_view = ( $_perms['show_perms'] ) ? ',' . implode( ',', explode( ',', $_perms['show_perms'] ) ) . ',' : '';
+ $_read = ( $_perms['read_perms'] ) ? ',' . implode( ',', explode( ',', $_perms['read_perms'] ) ) . ',' : '';
+ $_reply = ( $_perms['reply_perms'] ) ? ',' . implode( ',', explode( ',', $_perms['reply_perms'] ) ) . ',' : '';
+ $_start = ( $_perms['start_perms'] ) ? ',' . implode( ',', explode( ',', $_perms['start_perms'] ) ) . ',' : '';
+ $_upload = ( $_perms['upload_perms'] ) ? ',' . implode( ',', explode( ',', $_perms['upload_perms'] ) ) . ',' : '';
+ $_download = ( $_perms['download_perms'] ) ? ',' . implode( ',', explode( ',', $_perms['download_perms'] ) ) . ',' : '';
+
+ $this->DB->insert( 'permission_index', array( 'app' => 'forums',
+ 'perm_type' => 'forum',
+ 'perm_type_id' => $row['id'],
+ 'perm_view' => str_replace( ',*,', '*', $_view ),
+ 'perm_2' => str_replace( ',*,', '*', $_read ),
+ 'perm_3' => str_replace( ',*,', '*', $_reply ),
+ 'perm_4' => str_replace( ',*,', '*', $_start ),
+ 'perm_5' => str_replace( ',*,', '*', $_upload ),
+ 'perm_6' => str_replace( ',*,', '*', $_download ),
+ 'perm_7' => '' ) );
+ }
+ else
+ {
+ $this->DB->insert( 'permission_index', array( 'app' => 'forums',
+ 'perm_type' => 'forum',
+ 'perm_type_id' => $row['id'],
+ 'perm_view' => '',
+ 'perm_2' => '',
+ 'perm_3' => '',
+ 'perm_4' => '',
+ 'perm_5' => '',
+ 'perm_6' => '',
+ 'perm_7' => '' ) );
+
+ IPSSetUp::addLogMessage( "Пропущены права доступа для форума ID: " . $row['id'], '30001', 'core' );
+ }
+ }
+ else
+ {
+ $this->DB->insert( 'permission_index', array( 'app' => 'forums',
+ 'perm_type' => 'forum',
+ 'perm_type_id' => $row['id'],
+ 'perm_view' => '',
+ 'perm_2' => '',
+ 'perm_3' => '',
+ 'perm_4' => '',
+ 'perm_5' => '',
+ 'perm_6' => '',
+ 'perm_7' => '' ) );
+
+ IPSSetUp::addLogMessage( "Пропущены права доступа для форума ID: " . $row['id'], '30001', 'core' );
+ }
+ }
+
+ $this->registry->output->addMessage("Права доступа обновлены....");
+
+ /* Fix up forum moderators */
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'moderators' ) );
+
+ $o = $this->DB->execute();
+
+ while( $r = $this->DB->fetch( $o ) )
+ {
+ $this->DB->update( 'moderators', array( 'forum_id' => ',' . IPSText::cleanPermString( $r['forum_id'] ) . ',' ), 'mid=' . $r['mid'] );
+ }
+
+ $this->registry->output->addMessage("Модераторы форумов обновлены....");
+
+ /* Root admin reset? */
+ if ( $rootAdmins )
+ {
+ /* Find all admin groups */
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'groups',
+ 'where' => 'g_id != ' . $this->settings['admin_group'] . ' AND g_access_cp=1' ) );
+
+ $o = $this->DB->execute();
+
+ while( $row = $this->DB->fetch( $o ) )
+ {
+ /* Insert blank perm row */
+ $this->DB->insert( 'admin_permission_rows', array( 'row_id' => $row['g_id'],
+ 'row_id_type' => 'group',
+ 'row_perm_cache' => serialize( array() ),
+ 'row_updated' => time() ) );
+ }
+
+ $this->registry->output->addMessage("Удалены вторичные группы администраторов....");
+ }
+
+ /* Report center reset */
+ $canReport = array();
+ $canView = array();
+
+ $this->DB->build( array( 'select' => 'g_id, g_view_board, g_access_cp, g_is_supmod',
+ 'from' => 'groups' ) );
+
+ $o = $this->DB->execute();
+
+ while( $r = $this->DB->fetch( $o ) )
+ {
+ if( $r['g_access_cp'] OR $r['g_is_supmod'] )
+ {
+ $canView[] = $r['g_id'];
+ }
+
+ if( $r['g_view_board'] AND $r['g_id'] != $this->settings['guest_group'] )
+ {
+ $canReport[] = $r['g_id'];
+ }
+ }
+
+ $this->DB->update( 'rc_classes', array( 'group_can_report' => ',' . implode( ',', $canReport ) . ',', 'mod_group_perm' => ',' . implode( ',', $canView ) . ',' ) );
+
+ /* Next Page */
+ $this->request['workact'] = 'skinlang';
+ }
+
+ /**
+ * Export skin and languages
+ *
+ * @return @e void
+ */
+ public function exportSkinLang()
+ {
+ /* INIT */
+ $start = intval( $this->request['st'] );
+ $converted = 0;
+ $options = IPSSetUp::getSavedData('custom_options');
+ $_doSkin = $options['core'][30001]['exportSkins'];
+ $_doLang = $options['core'][30001]['exportLangs'];
+
+ /* Doing anything? */
+ if ( ! $_doSkin AND ! $_doLang )
+ {
+ $this->registry->output->addMessage( "Нечего экспортировать" );
+
+ /* Next Page */
+ $this->request['workact'] = 'pms';
+ return;
+ }
+
+ /* Ok... */
+ if ( ! $start )
+ {
+ /* Do langs.. */
+ if ( $_doLang )
+ {
+ if ( ! is_dir( IPS_CACHE_PATH . 'cache/previousLangFiles' ) )
+ {
+ if ( @mkdir( IPS_CACHE_PATH . 'cache/previousLangFiles', IPS_FOLDER_PERMISSION ) )
+ {
+ @chmod( IPS_CACHE_PATH . 'cache/previousLangFiles', IPS_FOLDER_PERMISSION );
+ }
+ }
+
+ try
+ {
+ foreach( new DirectoryIterator( IPS_CACHE_PATH . 'cache/lang_cache' ) as $file )
+ {
+ if ( ! $file->isDot() AND $file->isDir() )
+ {
+ $name = $file->getFilename();
+
+ if ( substr( $name, 0, 1 ) != '.' )
+ {
+ $this->registry->output->addMessage( "Перенесена директория языка: {$name}" );
+
+ @rename( IPS_CACHE_PATH . 'cache/lang_cache/' . $name, IPS_CACHE_PATH . 'cache/previousLangFiles/' . $name );
+ }
+ }
+ }
+ } catch ( Exception $e ) {}
+ }
+ }
+
+ /* Doing skins? */
+ if ( $_doSkin )
+ {
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'skin_sets',
+ 'where' => 'set_skin_set_id > ' . $start,
+ 'limit' => array( 0, 1 ),
+ 'order' => 'set_skin_set_id ASC' ) );
+
+ $this->DB->execute();
+
+ $set = $this->DB->fetch();
+
+ if ( ! $set )
+ {
+ $this->request['st'] = 0;
+
+ /* All done.. */
+ $this->registry->output->addMessage( "Все стили обработаны" );
+
+ /* Next Page */
+ $this->request['workact'] = 'pms';
+ return;
+ }
+ else
+ {
+ if ( ! is_dir( IPS_CACHE_PATH . 'cache/previousSkinFiles' ) )
+ {
+ if ( @mkdir( IPS_CACHE_PATH . 'cache/previousSkinFiles', IPS_FOLDER_PERMISSION ) )
+ {
+ @chmod( IPS_CACHE_PATH . 'cache/previousSkinFiles', IPS_FOLDER_PERMISSION );
+ }
+ }
+
+ $safeName = IPSText::alphanumericalClean( $set['set_name'] );
+ $dirPath = IPS_CACHE_PATH . 'cache/previousSkinFiles/' . $safeName;
+
+ if ( @mkdir( $dirPath, IPS_FOLDER_PERMISSION ) )
+ {
+ @chmod( $dirPath, IPS_FOLDER_PERMISSION );
+ }
+
+ if ( is_dir( $dirPath ) )
+ {
+ /* Export CSS */
+ if ( @mkdir( $dirPath . '/css', IPS_FOLDER_PERMISSION ) )
+ {
+ @chmod( $dirPath . '/css', IPS_FOLDER_PERMISSION );
+ }
+
+ @file_put_contents( $dirPath . '/css/css.css', $set['set_cache_css'] );
+
+ /* Export Wrapper */
+ if ( @mkdir( $dirPath . '/wrapper', IPS_FOLDER_PERMISSION ) )
+ {
+ @chmod( $dirPath . '/wrapper', IPS_FOLDER_PERMISSION );
+ }
+
+ @file_put_contents( $dirPath . '/wrapper/wrapper.html', $set['set_wrapper'] );
+
+ /* Export Templates */
+ if ( @mkdir( $dirPath . '/templates', IPS_FOLDER_PERMISSION ) )
+ {
+ @chmod( $dirPath . '/templates', IPS_FOLDER_PERMISSION );
+ }
+
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'skin_templates_old',
+ 'where' => 'set_id=' . $set['set_skin_set_id'],
+ 'order' => 'func_name ASC' ) );
+
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $_groupName = IPSText::alphanumericalClean( $row['group_name'] );
+ $_bitName = IPSText::alphanumericalClean( $row['func_name'] );
+
+ /* Make section dir */
+ if ( @mkdir( $dirPath . '/templates/' . $_groupName, IPS_FOLDER_PERMISSION ) )
+ {
+ @chmod( $dirPath . '/templates/' . $_groupName, IPS_FOLDER_PERMISSION );
+ }
+
+ @file_put_contents( $dirPath . '/templates/' . $_groupName . '/' . $_bitName . '.html', $row['section_content'] );
+ }
+ }
+
+ /* Set ID */
+ $this->request['st'] = $set['set_skin_set_id'];
+
+ /* We did some, go check again.. */
+ $this->registry->output->addMessage( $set['set_name'] . " Exported" );
+
+ /* Next Page */
+ $this->request['workact'] = 'skinlang';
+ return;
+ }
+ }
+
+ /* We did some, go check again.. */
+ $this->registry->output->addMessage( 'Нет языков или стилей для экспорта' );
+
+ /* Next Page */
+ $this->request['workact'] = 'pms';
+ return;
+ }
+
+ /**
+ * Convert PMs
+ *
+ * @return @e void
+ */
+ public function convertPms()
+ {
+ /* INIT */
+ $pergo = 200;
+ $start = intval( $this->request['st'] );
+ $converted = 0;
+ $seen = 0;
+
+ $options = IPSSetUp::getSavedData('custom_options');
+ $skipPms = $options['core'][30001]['skipPms'];
+
+ /* Skipping? */
+ if ( $skipPms )
+ {
+ /* Update all members */
+ $this->DB->update( 'members', array( 'msg_count_reset' => 1, 'msg_count_new' => 0 ) );
+
+ /* add a message */
+ $this->registry->output->addMessage( "Пропускаем конвертирование ЛС" );
+
+ $this->request['workact'] = 'contacts';
+ $this->request['st'] = 0;
+ 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; # Luke added that space. That's his first contribution to the code vaults at IPS.
+ }
+
+ /* 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();
+
+ /* 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 );
+ $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'];/*noLibHook*/
+ }
+
+ $_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->addMessage( "Проверено " . $this->request['st'] . " личных сообщений. Сконвертировано за этот проход $converted." );
+
+ /* Re-do Page */
+ $this->request['workact'] = 'pms';
+ }
+ else
+ {
+ /* Update all members */
+ $this->DB->update( 'members', array( 'msg_count_reset' => 1 ) );
+
+ /* Nope, nothing to do - we're done! */
+ /* Next Page */
+ $this->request['workact'] = 'contacts';
+ $this->request['st'] = 0;
+ }
+ }
+
+ /**
+ * Convert Block lists
+ *
+ * @return @e void
+ */
+ public function convertBlockLists()
+ {
+ /* INIT */
+ $pergo = 200;
+ $start = intval( $this->request['st'] );
+ $options = IPSSetUp::getSavedData('custom_options');
+ $skipPms = $options['core'][30001]['skipPms'];
+ $converted = 0;
+ $seen = 0;
+
+ /* Skipping? */
+ if ( $skipPms )
+ {
+ /* add a message */
+ $this->registry->output->addMessage( "Skipping Block List Conversion" );
+
+ $this->request['workact'] = 'pmblock';
+ $this->request['st'] = 0;
+ return;
+ }
+
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'members',
+ 'where' => method_exists( $this->DB, 'setTableIdentityInsert' ) ? 'ignored_users NOT LIKE \'\'' : $this->DB->buildLength('ignored_users') . ' > 0',
+ 'order' => 'member_id ASC',
+ 'limit' => array( $start, $pergo ) ) );
+
+ $o = $this->DB->execute();
+
+ while( $member = $this->DB->fetch( $o ) )
+ {
+ $seen++;
+
+ /* Got anything? */
+ if ( strstr( $member['ignored_users'], ',' ) )
+ {
+ $ignored = explode( ',', $member['ignored_users'] );
+ }
+
+ if ( ! is_array( $ignored ) )
+ {
+ continue;
+ }
+
+ /* Add it to the table */
+ foreach( $ignored as $iid )
+ {
+ if ( ! $iid )
+ {
+ continue;
+ }
+
+ $this->DB->insert( 'ignored_users', array( 'ignore_owner_id' => $member['member_id'],
+ 'ignore_ignore_id' => $iid,
+ 'ignore_topics' => 1 ) );
+ }
+
+ $converted++;
+ }
+
+ /* What to do? */
+ if ( $seen )
+ {
+ $this->request['st'] = $start + $pergo;
+
+ /* We did some, go check again.. */
+ $this->registry->output->addMessage( "$converted списков игнорирования сконвертировано." );
+
+ /* Re-do Page */
+ $this->request['workact'] = 'contacts';
+ }
+ else
+ {
+ /* Nope, nothing to do - we're done! */
+ /* Next Page */
+ $this->request['workact'] = 'pmblock';
+ $this->request['st'] = 0;
+ }
+ }
+
+ /**
+ * Convert Block lists
+ *
+ * @return @e void
+ */
+ public function convertPmBlockLists()
+ {
+ /* INIT */
+ $pergo = 200;
+ $start = intval( $this->request['st'] );
+ $converted = 0;
+ $seen = 0;
+ $options = IPSSetUp::getSavedData('custom_options');
+ $skipPms = $options['core'][30001]['skipPms'];
+
+ /* Skipping? */
+ if ( $skipPms )
+ {
+ /* add a message */
+ $this->registry->output->addMessage( "Skipping PM Block List Conversion" );
+
+ $this->request['workact'] = 'finish';
+ $this->request['st'] = 0;
+ return;
+ }
+
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'contacts',
+ 'where' => 'allow_msg=0',
+ 'order' => 'id ASC',
+ 'limit' => array( $start, $pergo ) ) );
+
+ $o = $this->DB->execute();
+
+ while( $contact = $this->DB->fetch( $o ) )
+ {
+ $seen++;
+
+ /* Already got an entry for this contact? */
+ $test = $this->DB->buildAndFetch( array( 'select' => '*',
+ 'from' => 'ignored_users',
+ 'where' => 'ignore_owner_id=' . intval( $contact['member_id'] ) ) );
+
+ /* Got anything? */
+ if ( $test['ignore_owner_id'] )
+ {
+ $this->DB->update( 'ignored_users', array( 'ignore_messages' => 1 ), 'ignore_id=' . $test['ignore_id'] );
+ }
+ else
+ {
+ $this->DB->insert( 'ignored_users', array( 'ignore_owner_id' => $contact['member_id'],
+ 'ignore_ignore_id' => $contact['contact_id'],
+ 'ignore_messages' => 1 ) );
+ }
+
+ $converted++;
+ }
+
+ /* What to do? */
+ if ( $seen )
+ {
+ $this->request['st'] = $start + $pergo;
+
+ /* We did some, go check again.. */
+ $this->registry->output->addMessage( "$converted списков игнорирования личных сообщений сконвертировано." );
+
+ /* Re-do Page */
+ $this->request['workact'] = 'pmblock';
+ }
+ else
+ {
+ /* Nope, nothing to do - we're done! */
+ /* Next Page */
+ $this->request['workact'] = 'polls';
+ }
+ }
+
+ /**
+ * Rebuild polls
+ * Ensures that serialized polls are correctly converted to utf8
+ */
+ public function rebuildPolls()
+ {
+ $this->DB->build( array( 'select' => 'pid, choices', 'from' => 'polls' ) );
+ $o = $this->DB->execute();
+
+ while( $row = $this->DB->fetch( $o ) )
+ {
+ $row['choices'] = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $row['choices'] );
+ $this->DB->update( 'polls', array( 'choices' => $row['choices'] ), 'pid = ' . $row['pid'] );
+ }
+
+ $this->registry->output->addMessage( "Обновление опросов завершено." );
+ $this->request['workact'] = 'finish';
+ $this->request['st'] = 0;
+ }
+
+
+ /**
+ * Finish up conversion stuff
+ *
+ * @return @e void
+ */
+ public function finish()
+ {
+ $options = IPSSetUp::getSavedData('custom_options');
+ $skipPms = $options['core'][30001]['skipPms'];
+ $output = array();
+
+ /* Emoticons */
+ if ( file_exists( DOC_IPS_ROOT_PATH . 'style_emoticons/default' ) )
+ {
+ try
+ {
+ foreach( new DirectoryIterator( DOC_IPS_ROOT_PATH . 'style_emoticons/default' ) as $file )
+ {
+ if ( ! $file->isDot() )
+ {
+ $_name = $file->getFileName();
+
+ /* Annoyingly, isDot doesn't match .svn, etc */
+ if ( substr( $_name, 0, 1 ) == '.' )
+ {
+ continue;
+ }
+
+ if ( @copy( DOC_IPS_ROOT_PATH . 'style_emoticons/default/' . $_name, IPS_PUBLIC_PATH . 'style_emoticons/default/' . $_name ) )
+ {
+ $output[] = "Смайлики: скопирован $_name...";
+ }
+ else
+ {
+ $output[] = "Не удалось скопировать $_name - после обновления перенесите его самостоятельно";
+ }
+ }
+ }
+ } catch ( Exception $e ) {}
+ }
+
+ /* LOG IN METHODS */
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'login_methods' ) );
+
+ $this->DB->execute();
+
+ while( $row = $this->DB->fetch() )
+ {
+ $loginMethods[ $row['login_folder_name'] ] = $row;
+ }
+
+ $count = 6;
+ $recount = array( 'internal' => 1,
+ 'ipconverge' => 2,
+ 'ldap' => 3,
+ 'external' => 4 );
+
+ /* Fetch XML */
+ require_once( IPS_KERNEL_PATH . 'classXML.php' );/*noLibHook*/
+ $xml = new classXML( IPSSetUp::charSet );
+
+ $xml->load( IPS_ROOT_PATH . 'setup/xml/loginauth.xml' );
+
+ foreach( $xml->fetchElements( 'login_methods' ) as $xmlelement )
+ {
+ $data = $xml->fetchElementsFromRecord( $xmlelement );
+
+ $data['login_order'] = ( isset( $recount[ $data['login_folder_name'] ] ) ) ? $recount[ $data['login_folder_name'] ] : ++$count;
+
+ unset( $data['login_id'] );
+
+ if ( ! $loginMethods[ $data['login_folder_name'] ] )
+ {
+ $this->DB->insert( 'login_methods', $data );
+ }
+ else
+ {
+ $this->DB->update( 'login_methods', array( 'login_order' => $data['login_order'] ), 'login_folder_name=\'' . $data['login_folder_name'] . '\'' );
+ }
+ }
+
+ /* Reset member languages and skins */
+ $this->DB->update( 'members', array( 'language' => IPSLib::getDefaultLanguage(), 'skin' => 0 ) );
+
+ /* Empty caches */
+ $this->DB->delete( 'cache_store', "cs_key='forum_cache'");
+ $this->DB->delete( 'cache_store', "cs_key='skin_id_cache'");
+
+ /* Empty other tables */
+ $this->DB->delete( 'skin_cache' );
+ $this->DB->delete( 'skin_templates_cache' );
+
+ /* Reset admin permissions */
+ $this->DB->update( 'admin_permission_rows', array( 'row_perm_cache' => '' ) );
+
+ /* Drop Tables */
+ $this->DB->dropTable( 'contacts' );
+ $this->DB->dropTable( 'skin_macro' );
+ $this->DB->dropTable( 'skin_template_links' );
+ $this->DB->dropTable( 'skin_templates_old' );
+ $this->DB->dropTable( 'skin_sets' );
+ $this->DB->dropTable( 'languages' );
+ $this->DB->dropTable( 'topics_read' );
+ $this->DB->dropTable( 'topic_markers' );
+ $this->DB->dropTable( 'acp_help' );
+ $this->DB->dropTable( 'members_converge' );
+ $this->DB->dropTable( 'member_extra' );
+ $this->DB->dropTable( 'custom_bbcode_old' );
+ $this->DB->dropTable( 'admin_sessions' );
+ $this->DB->dropTable( 'components' );
+ $this->DB->dropTable( 'admin_permission_keys' );
+ $this->DB->dropTable( 'conf_settings' );
+ $this->DB->dropTable( 'conf_settings_titles' );
+ $this->DB->dropTable( 'reg_antispam' );
+
+ if ( ! $skipPms )
+ {
+ $this->DB->dropTable( 'message_text' );
+ $this->DB->dropTable( 'message_topics_old' );
+ }
+
+ $message = ( is_array( $output ) AND count($output) ) ? implode( " ", $output ) . ' ' : '';
+
+ $this->registry->output->addMessage( $message . "очистка SQL завершена...");
+
+ /* Last function, so unset workact */
+ $this->request['workact'] = '';
+ }
}
\ No newline at end of file
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 991ec1bf..fb89bc52 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,7 +1,7 @@
Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class version_upgrade
-{
- /**
- * Custom HTML to show
- *
- * @var string
- */
- protected $_output = '';
-
- /**
- * fetchs output
- *
- * @return string
- */
- public function fetchOutput()
- {
- return $this->_output;
- }
-
- /**
- * Execute selected method
- *
- * @param object Registry object
- * @return @e void
- */
- 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->cache = $this->registry->cache();
- $this->caches =& $this->registry->cache()->fetchCaches();
-
-
- /* Now make add a key */
- $this->DB->build( array( 'select' => '*',
- 'from' => 'pfields_data' ) );
-
- $o = $this->DB->execute();
-
- while( $row = $this->DB->fetch( $o ) )
- {
- /* Attempt conversion of dd / dt microformats */
- if ( stristr( $row['pf_topic_format'], '' ) OR stristr( $row['pf_topic_format'], ' ' ) )
- {
- $row['pf_topic_format'] = str_replace( ' ', "", $row['pf_topic_format'] );
- $row['pf_topic_format'] = str_replace( '', "", $row['pf_topic_format'] );
- $row['pf_topic_format'] = str_replace( array( ' ', '' ), "", $row['pf_topic_format'] );
-
- $this->DB->update( 'pfields_data', array( 'pf_topic_format' => $row['pf_topic_format'] ), 'pf_id=' . $row['pf_id'] );
- }
- }
-
- $this->registry->output->addMessage( "Updated custom profile fields");
-
- return true;
- }
-}
-
+Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class version_upgrade
+{
+ /**
+ * Custom HTML to show
+ *
+ * @var string
+ */
+ protected $_output = '';
+
+ /**
+ * fetchs output
+ *
+ * @return string
+ */
+ public function fetchOutput()
+ {
+ return $this->_output;
+ }
+
+ /**
+ * Execute selected method
+ *
+ * @param object Registry object
+ * @return @e void
+ */
+ 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->cache = $this->registry->cache();
+ $this->caches =& $this->registry->cache()->fetchCaches();
+
+
+ /* Now make add a key */
+ $this->DB->build( array( 'select' => '*',
+ 'from' => 'pfields_data' ) );
+
+ $o = $this->DB->execute();
+
+ while( $row = $this->DB->fetch( $o ) )
+ {
+ /* Attempt conversion of dd / dt microformats */
+ if ( stristr( $row['pf_topic_format'], '' ) OR stristr( $row['pf_topic_format'], ' ' ) )
+ {
+ $row['pf_topic_format'] = str_replace( ' ', "", $row['pf_topic_format'] );
+ $row['pf_topic_format'] = str_replace( '', "", $row['pf_topic_format'] );
+ $row['pf_topic_format'] = str_replace( array( ' ', '' ), "", $row['pf_topic_format'] );
+
+ $this->DB->update( 'pfields_data', array( 'pf_topic_format' => $row['pf_topic_format'] ), 'pf_id=' . $row['pf_id'] );
+ }
+ }
+
+ $this->registry->output->addMessage( "Обновление пользовательских полей профиля");
+
+ return true;
+ }
+}
+
?>
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_30009/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_30009/mysql_updates.php
index 13c9ddc4..4737fa2f 100644
--- a/upload/admin/applications/core/setup/versions/upg_30009/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_30009/mysql_updates.php
@@ -1,7 +1,7 @@
build( array( 'select' => '*',
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
index 264108bc..4360a72f 100644
--- a/upload/admin/applications/core/setup/versions/upg_31003/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_31003/mysql_updates.php
@@ -1,7 +1,7 @@
checkForField( 'replacement_master_key', 'skin_replacements' ) )
$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);";
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
index 7865f298..b97315d8 100644
--- a/upload/admin/applications/core/setup/versions/upg_31004/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_31004/mysql_updates.php
@@ -1,7 +1,7 @@
- * Invision Power Services
- * IP.Board v3.3.4
- * Upgrade Class
- *
- * Class to add options and notices for IP.Board upgrade
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
- *
- *
- * @author Matt Mecham
- * @version $Rev: 10914 $
- * @since 3.0
- * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.invisionpower.com/company/standards.php#license
- * @link http://www.invisionpower.com
- * @package IP.Board
- */
-
-class version_class_core_32000
-{
- /**
- * Constructor
- *
- * @param object $registry Registry object
- * @return @e 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->cache = $this->registry->cache();
- $this->caches =& $this->registry->cache()->fetchCaches();
- }
-
- /**
- * Add pre-upgrade options: Form
- *
- * @return string HTML block
- */
- public function preInstallOptionsForm()
- {
- $_wrapper = "";
- $_html = '';
- $posts = $this->DB->buildAndFetch( array( 'select' => 'count(*) as total', 'from' => 'posts' ) );
-
- /* Got more than 100K posts? */
- if( $posts['total'] > 100000 )
- {
-$_html .= <<
-
- Manually apply changes to the posts table? Your site has more than 100,000 posts. We strongly recommend that you enable this option and manually run the provided
- SQL query to alter your posts table in order to prevent timeouts in the web-based upgrader. If you uncheck this option, it is very possible the upgrader will timeout attempting to
- update your posts table.
-
-EOF;
- }
-
- if( $_html )
- {
- return sprintf( $_wrapper, $_html );
- }
- else
- {
- return '';
- }
- }
-
- /**
- * Add pre-upgrade options: Save
- *
- * Data will be saved in saved data array as: appOptions[ app ][ versionLong ] = ( key => value );
- *
- * @return array Key / value pairs to save
- */
- public function preInstallOptionsSave()
- {
- return array( 'manualPostsTableQuery' => intval( $_REQUEST['manualPostsTableQuery'] )
- );
- }
-
- /**
- * Return any post-installation notices
- *
- * @return array Array of notices
- */
- public function postInstallNotices()
- {
- return array();
- }
-
-
- /**
- * Return any pre-installation notices
- *
- * @return array Array of notices
- */
- public function preInstallNotices()
- {
- $notices = array();
-
- $notices[] = "All XML skins will be uninstalled during the upgrade.";
-
- return $notices;
-
- }
-}
-
+
+ * Invision Power Services
+ * IP.Board v3.4.5
+ * Upgrade Class
+ *
+ * Class to add options and notices for IP.Board upgrade
+ * Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
+ *
+ *
+ * @author Matt Mecham
+ * @version $Rev: 10721 $
+ * @since 3.0
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/company/standards.php#license
+ * @link http://www.invisionpower.com
+ * @package IP.Board
+ */
+
+class version_class_core_32000
+{
+ /**
+ * Constructor
+ *
+ * @param object $registry Registry object
+ * @return @e 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->cache = $this->registry->cache();
+ $this->caches =& $this->registry->cache()->fetchCaches();
+ }
+
+ /**
+ * Add pre-upgrade options: Form
+ *
+ * @return string HTML block
+ */
+ public function preInstallOptionsForm()
+ {
+ $_wrapper = "";
+ $_html = '';
+ $posts = $this->DB->buildAndFetch( array( 'select' => 'count(*) as total', 'from' => 'posts' ) );
+
+ /* Got more than 100K posts? */
+ if( $posts['total'] > 100000 )
+ {
+$_html .= <<
+
+ Внести изменение в структуру таблицы сообщений вручную? Ваш форум содержит более 100,000 сообщений. Мы крайне рекомендуем чтобы вы включили эту опцию для предотвращения возможных проблем при обновлении мастером обновления. В процессе обновления мастер на необходимом шаге выведет запросы, которые вы должны будете выполнить напрямую в базе данных, после чего вам достаточно будет обновить страницу и процесс будет продолжен.
+
+EOF;
+ }
+
+ if( $_html )
+ {
+ return sprintf( $_wrapper, $_html );
+ }
+ else
+ {
+ return '';
+ }
+ }
+
+ /**
+ * Add pre-upgrade options: Save
+ *
+ * Data will be saved in saved data array as: appOptions[ app ][ versionLong ] = ( key => value );
+ *
+ * @return array Key / value pairs to save
+ */
+ public function preInstallOptionsSave()
+ {
+ return array( 'manualPostsTableQuery' => intval( $_REQUEST['manualPostsTableQuery'] )
+ );
+ }
+
+ /**
+ * Return any post-installation notices
+ *
+ * @return array Array of notices
+ */
+ public function postInstallNotices()
+ {
+ return array();
+ }
+
+
+ /**
+ * Return any pre-installation notices
+ *
+ * @return array Array of notices
+ */
+ public function preInstallNotices()
+ {
+ $notices = array();
+
+ $notices[] = "При обновлении будут удалены все XML стили.";
+
+ return $notices;
+
+ }
+}
+
diff --git a/upload/admin/applications/core/setup/versions/upg_32000/version_upgrade.php b/upload/admin/applications/core/setup/versions/upg_32000/version_upgrade.php
index 2104d436..e3c9202f 100644
--- a/upload/admin/applications/core/setup/versions/upg_32000/version_upgrade.php
+++ b/upload/admin/applications/core/setup/versions/upg_32000/version_upgrade.php
@@ -1,940 +1,945 @@
-Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class version_upgrade
-{
- /**
- * Custom HTML to show
- *
- * @var string
- */
- protected $_output = '';
-
- /**
- * fetchs output
- *
- * @return string
- */
- public function fetchOutput()
- {
- return $this->_output;
- }
-
- /**
- * Execute selected method
- *
- * @param object Registry object
- * @return @e void
- */
- 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->cache = $this->registry->cache();
- $this->caches =& $this->registry->cache()->fetchCaches();
-
- //--------------------------------
- // What are we doing?
- //--------------------------------
-
- switch( $this->request['workact'] )
- {
- case 'sql':
- case 'sql1':
- default:
- $this->upgradeSql(1);
- break;
- case 'sql2':
- $this->upgradeSql(2);
- break;
- case 'sql3':
- $this->upgradeSql(3);
- break;
- case 'sql4':
- $this->upgradeSql(4);
- break;
- case 'sql5':
- $this->upgradeSql(5);
- break;
- case 'sql6':
- $this->upgradeSql(6);
- break;
-
- case 'logs':
- case 'logs1':
- $this->upgradeLogs(1);
- break;
- case 'logs2':
- $this->upgradeLogs(2);
- break;
- case 'logs3':
- $this->upgradeLogs(3);
- break;
- case 'logs4':
- $this->upgradeLogs(4);
- break;
- case 'logs5':
- $this->upgradeLogs(5);
- break;
- case 'logs6':
- $this->upgradeLogs(6);
- break;
- case 'logs7':
- $this->upgradeLogs(7);
- break;
- case 'logs8':
- $this->upgradeLogs(8);
- break;
- case 'logs9':
- $this->upgradeLogs(9);
- break;
- case 'logs10':
- $this->upgradeLogs(10);
- break;
-
- case 'forums':
- $this->fixArchiveForums();
- break;
-
- case 'loginmethods':
- $this->fixLoginMethods();
- break;
-
- case 'oldhooks':
- $this->removeOldHooks();
- break;
-
- case 'setdefaultskin':
- $this->setDefaultSkin();
- break;
-
- case 'hooks':
- $this->convertHooks();
- break;
-
- case 'photos':
- $this->convertPhotos();
- break;
- }
-
- /* Workact is set in the function, so if it has not been set, then we're done. The last function should unset it. */
- if ( $this->request['workact'] )
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-
- /**
- * Run SQL files
- *
- * @param int
- * @return @e void
- */
- public function upgradeSql( $id=1 )
- {
- $cnt = 0;
- $file = '_updates_'.$id.'.php';
- $output = "";
- $path = IPSLib::getAppDir( 'core' ) . '/setup/versions/upg_32000/' . strtolower( $this->registry->dbFunctions()->getDriverType() ) . $file;
- $prefix = $this->registry->dbFunctions()->getPrefix();
- $sourceFile = '';
- $options = IPSSetUp::getSavedData('custom_options');
- $postTable = $options['core'][32000]['manualPostsTableQuery'];
-
- if ( is_file( $path ) )
- {
- $SQL = array();
-
- require( $path );/*noLibHook*/
-
- /* Set DB driver to return any errors */
- $this->DB->return_die = 1;
-
- foreach( $SQL as $query )
- {
- $this->DB->allow_sub_select = 1;
- $this->DB->error = '';
-
- $query = str_replace( "<%time%>", time(), $query );
-
- if ( $this->settings['mysql_tbl_type'] )
- {
- if ( preg_match( "/^create table(.+?)/i", $query ) )
- {
- $query = preg_replace( "/^(.+?)\);$/is", "\\1) ENGINE={$this->settings['mysql_tbl_type']};", $query );
- }
- }
-
- /* Need to tack on a prefix? */
- if ( $prefix )
- {
- $query = IPSSetUp::addPrefixToQuery( $query, $prefix );
- }
-
- if( IPSSetUp::getSavedData('man') OR ( $id == 6 AND $postTable ) )
- {
- $query = trim( $query );
-
- /* Ensure the last character is a semi-colon */
- if ( substr( $query, -1 ) != ';' )
- {
- $query .= ';';
- }
-
- $output .= $query . "\n\n";
- }
- else
- {
- $this->DB->query( $query );
-
- if ( $this->DB->error )
- {
- $this->registry->output->addError( " " . $query . " " . $this->DB->error );
- }
- else
- {
- $cnt++;
- }
- }
- }
-
- $this->registry->output->addMessage("{$cnt} queries ran....");
- }
-
- /* Next Page */
- if ( $id < 6 )
- {
- $nextid = $id + 1;
- $this->request['workact'] = 'sql' . $nextid;
- }
- else
- {
- $this->request['workact'] = 'logs';
- }
-
- if ( $output )
- {
- /* Create source file */
- if ( $this->registry->dbFunctions()->getDriverType() == 'mysql' )
- {
- $sourceFile = IPSSetUp::createSqlSourceFile( $output, '32000', $id );
- }
-
- $this->_output = $this->registry->output->template()->upgrade_manual_queries( $output, $sourceFile );
- }
- }
-
- /**
- * Upgrade log file tables
- *
- * @param int
- * @return @e void
- */
- public function upgradeLogs( $id=1 )
- {
- /* Verify posts alter table query has run */
- if( $id == 1 )
- {
- if( !$this->DB->checkForField( 'post_bwoptions', 'posts' ) )
- {
- $this->_output = ' ';
- $this->registry->output->addError( "You must first run the query to alter the posts table before you can proceed. Once you have run this query, you can hit refresh to continue." );
- return;
- }
- }
-
- $cnt = 0;
- $file = '_updates_logs_'.$id.'.php';
- $output = "";
- $path = IPSLib::getAppDir( 'core' ) . '/setup/versions/upg_32000/' . strtolower( $this->registry->dbFunctions()->getDriverType() ) . $file;
- $prefix = $this->registry->dbFunctions()->getPrefix();
-
- if ( is_file( $path ) )
- {
- $SQL = array();
- $TABLE = '';
-
- require( $path );/*noLibHook*/
-
- /* Set DB driver to return any errors */
- $this->DB->return_die = 1;
-
- foreach( $SQL as $query )
- {
- $this->DB->allow_sub_select = 1;
- $this->DB->error = '';
-
- /* Need to tack on a prefix? */
- if ( $prefix )
- {
- $query = IPSSetUp::addPrefixToQuery( $query, $prefix );
- }
-
- /* Chose to prune and run? */
- if( $this->request['pruneAndRun'] )
- {
- $this->DB->delete( $TABLE );
-
- $man = false;
- }
- else
- {
- /* Show alter table / prune option? */
- $man = IPSSetUp::getSavedData('man');
-
- if( $TABLE )
- {
- $count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as logs', 'from' => $TABLE ) );
-
- if( $count['logs'] > 100000 )
- {
- $man = true;
- }
- }
- }
-
- /* Show option to run manually or prune ? */
- if( $man )
- {
- $query = trim( $query );
-
- /* Ensure the last character is a semi-colon */
- if ( substr( $query, -1 ) != ';' )
- {
- $query .= ';';
- }
-
- $output .= $query . "\n\n";
- }
- else
- {
- $this->DB->query( $query );
-
- if ( $this->DB->error )
- {
- $this->registry->output->addError( " " . $query . " " . $this->DB->error );
- }
- else
- {
- $cnt++;
- }
- }
- }
-
- $this->registry->output->addMessage("{$cnt} queries ran....");
- }
-
- /* Next Page */
- if ( $id < 10 )
- {
- $nextid = $id + 1;
- $this->request['workact'] = 'logs' . $nextid;
- }
- else
- {
- $this->request['workact'] = 'forums';
- }
-
- if ( $output )
- {
- $this->_output = $this->registry->output->template()->upgrade_manual_queries_logs( $output, $id, $TABLE );
- }
- }
-
- /**
- * Convert archive forums to read-only forums
- *
- * @return @e void
- */
- public function fixArchiveForums()
- {
- /* Update array for archive forums */
- $_total = 0;
- $_update = array(
- 'perm_3' => '',
- 'perm_4' => '',
- 'perm_5' => '',
- );
-
- /* Get 'archive' forums */
- $this->DB->build( array( 'select' => '*', 'from' => 'forums', 'where' => 'status=0' ) );
- $outer = $this->DB->execute();
-
- while( $r = $this->DB->fetch($outer) )
- {
- $this->DB->update( 'permission_index', $_update, "app='forums' AND perm_type='forum' AND perm_type_id={$r['id']}" );
-
- $_total++;
- }
-
- /* Now drop the status field in forums table */
- $this->DB->dropField( 'forums', 'status' );
-
- /* Message */
- $this->registry->output->addMessage("{$_total} forums with 'archive' status converted to read-only forums....");
-
- /* Next Page */
- $this->request['workact'] = 'loginmethods';
- }
-
- /**
- * Pull login method conf to DB
- *
- * @return @e void
- */
- public function fixLoginMethods()
- {
- /* Init */
- $_total = 0;
-
- if( !defined('IPS_PATH_CUSTOM_LOGIN') )
- {
- define( 'IPS_PATH_CUSTOM_LOGIN' , IPS_ROOT_PATH . 'sources/loginauth' );
- }
-
- /* Try to loop over all login methods to grab current configs */
- try
- {
- foreach( new DirectoryIterator( IPS_PATH_CUSTOM_LOGIN ) as $file )
- {
- if ( $file->isDir() )
- {
- if( is_file( $file->getPathname() . '/conf.php' ) )
- {
- $LOGIN_CONF = array();
-
- include( $file->getPathname() . '/conf.php' );/*noLibHook*/
-
- if( is_array($LOGIN_CONF) AND count($LOGIN_CONF) )
- {
- $this->DB->update( 'login_methods', array( 'login_custom_config' => @serialize($LOGIN_CONF) ), "login_folder_name='" . $this->DB->addSlashes( $file->getFilename() ) . "'" );
-
- $_total++;
- }
- }
- }
- }
- }
- catch( Exception $e )
- {
- }
-
- /* Message */
- $this->registry->output->addMessage("{$_total} login method configs imported....");
-
- /* Next Page */
- $this->request['workact'] = 'oldhooks';
- }
-
- /**
- * Remove old hooks
- *
- * @return @e void
- */
- public function removeOldHooks()
- {
- /* Hooks to remove */
- $hooks = array( 'watched_content', 'todays_top_posters', 'unread_notifications' );
- $_hookIds = array();
- $_total = 0;
-
- /* Get hook records */
- $this->DB->build( array( 'select' => 'hook_id', 'from' => 'core_hooks', 'where' => "hook_key IN('" . implode( "','", $hooks ) . "')" ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $_hookIds[] = $r['hook_id'];
- }
-
- /* Remove associated files */
- if( count($_hookIds) )
- {
- $this->DB->build( array( 'select' => 'hook_file_stored', 'from' => 'core_hooks_files', 'where' => 'hook_hook_id IN(' . implode( ',', $_hookIds ) . ')' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- @unlink( IPS_HOOKS_PATH . $r['hook_file_stored'] );
- }
-
- /* Remove hook records */
- $this->DB->delete( 'core_hooks_files', 'hook_hook_id IN(' . implode( ',', $_hookIds ) . ')' );
- $this->DB->delete( 'core_hooks', 'hook_id IN(' . implode( ',', $_hookIds ) . ')' );
-
- $_total++;
- }
-
- /* Message */
- $this->registry->output->addMessage("{$_total} outdated hook(s) uninstalled....");
-
- /* Next Page */
- $this->request['workact'] = 'setdefaultskin';
- }
-
- /**
- * Restore IPB default skin as default
- *
- * @return @e void
- */
- public function setDefaultSkin()
- {
- /* Get skin functions library */
- require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );/*noLibHook*/
- require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );/*noLibHook*/
-
- $skinFunctions = new skinCaching( $this->registry );
-
- /* Update members to use default skin */
- $this->DB->update( 'members', array( 'skin' => 0 ) );
-
- /* Update forums to use default skin */
- $this->DB->update( 'forums', array( 'skin_id' => 0 ) );
-
- /* Reset any default skin(s) */
- $this->DB->update( 'skin_collections', array( 'set_is_default' => 0 ) );
-
- /* Set IPB default skin as default */
- $this->DB->update( 'skin_collections', array( 'set_is_default' => 1 ), "set_key='default'" );
-
- /* Verify we have a skin set as default */
- $_check = $this->DB->buildAndFetch( array( 'select' => 'count(*) as total', 'from' => 'skin_collections', 'where' => 'set_is_default=1' ) );
-
- if( $_check['total'] < 1 )
- {
- $this->DB->build( array( 'update' => 'skin_collections', 'set' => 'set_is_default=1', 'where' => "set_output_format='html'", 'limit' => array( 0, 1 ) ) );
- $this->DB->execute();
- }
-
- /* Check for any modifications in IPB default skin */
- $_master = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'skin_collections', 'where' => "set_key='default'" ) );
- $_master['set_id'] = intval($_master['set_id']);
- $_modifiedTemplates = $this->DB->buildAndFetch( array( 'select' => 'count(*) as total', 'from' => 'skin_templates', 'where' => "template_set_id={$_master['set_id']} AND template_removable=1 OR template_user_edited=1" ) );
- $_modifiedCSS = $this->DB->buildAndFetch( array( 'select' => 'count(*) as total', 'from' => 'skin_css', 'where' => "css_set_id={$_master['set_id']} AND css_master_key=''" ) );
-
- if( $_modifiedTemplates['total'] OR $_modifiedCSS['total'] )
- {
- /* Create a new skin with IPB default as parent */
- $curPos = $skinFunctions->fetchHighestSetPosition();
-
- $_master['set_key'] = 'default_modified';
- $_master['set_parent_id'] = $_master['set_id'];
- $_master['set_is_default'] = 0;
- $_master['set_name'] = $_master['set_name'] . ' (Pre 3.2)';
- $_master['set_order'] = (int)$curPos++;
- unset($_master['set_id']);
-
- $this->DB->insert( 'skin_collections', $_master );
- $set_id = $this->DB->getInsertId();
-
- $this->DB->update( 'skin_templates', array( 'template_set_id' => $set_id ), "template_set_id={$_master['set_parent_id']} AND template_removable=1 OR template_user_edited=1" );
- $this->DB->update( 'skin_css', array( 'css_set_id' => $set_id ), "css_set_id={$_master['set_parent_id']} AND css_master_key=''" );
-
- $skinFunctions->rebuildSkinSetsCache();
- $skinFunctions->rebuildTreeInformation( $set_id );
- //$skinFunctions->flushSkinData();
-
- $skinFunctions->rebuildCSS( $set_id );
- $skinFunctions->rebuildPHPTemplates( $set_id );
- $skinFunctions->rebuildReplacementsCache( $set_id );
- }
-
- /* Message */
- $this->registry->output->addMessage("Default skin restored....");
-
- /* Next Page */
- $this->request['workact'] = 'hooks';
- }
-
- /**
- * Convert stored hook data
- *
- * @return @e void
- */
- public function convertHooks()
- {
- $_total = 0;
-
- /* Grab all hooks */
- $this->DB->build( array( 'select' => '*', 'from' => 'core_hooks' ) );
- $outer = $this->DB->execute();
-
- while( $hook = $this->DB->fetch($outer) )
- {
- $_extraData = unserialize($hook['hook_extra_data']);
-
- /* Fix setting groups */
- if( is_array($_extraData['settingGroups']) AND count($_extraData['settingGroups']) )
- {
- $_settingGroups = array();
-
- foreach( $_extraData['settingGroups'] as $_group )
- {
- if( intval($_group) == $_group )
- {
- $_settingGroups[ $_group ] = intval($_group);
- }
- }
-
- if( count($_settingGroups) )
- {
- $_extraData['settingGroups'] = array();
-
- $this->DB->build( array( 'select' => 'conf_title_id, conf_title_keyword', 'from' => 'core_sys_settings_titles' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- if( in_array( $r['conf_title_id'], $_settingGroups ) )
- {
- $_extraData['settingGroups'][] = $r['conf_title_keyword'];
- }
- }
- }
- }
-
- /* Fix settings */
- if( is_array($_extraData['settings']) AND count($_extraData['settings']) )
- {
- $_settings = array();
-
- foreach( $_extraData['settings'] as $_id )
- {
- if( intval($_id) == $_id )
- {
- $_settings[ $_id ] = intval($_id);
- }
- }
-
- if( count($_settings) )
- {
- $_extraData['settings'] = array();
-
- $this->DB->build( array( 'select' => 'conf_id, conf_key', 'from' => 'core_sys_conf_settings' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- if( in_array( $r['conf_id'], $_settings ) )
- {
- $_extraData['settings'][] = $r['conf_key'];
- }
- }
- }
- }
-
- /* Fix tasks */
- if( is_array($_extraData['tasks']) AND count($_extraData['tasks']) )
- {
- $_tasks = array();
-
- foreach( $_extraData['tasks'] as $_id )
- {
- if( intval($_id) == $_id )
- {
- $_tasks[ $_id ] = intval($_id);
- }
- }
-
- if( count($_tasks) )
- {
- $_extraData['tasks'] = array();
-
- $this->DB->build( array( 'select' => 'task_id, task_key', 'from' => 'task_manager' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- if( in_array( $r['task_id'], $_tasks ) )
- {
- $_extraData['tasks'][] = $r['task_key'];
- }
- }
- }
- }
-
- /* Fix help files */
- if( is_array($_extraData['help']) AND count($_extraData['help']) )
- {
- $_help = array();
-
- foreach( $_extraData['help'] as $_id )
- {
- if( intval($_id) == $_id )
- {
- $_help[ $_id ] = intval($_id);
- }
- }
-
- if( count($_help) )
- {
- $_extraData['help'] = array();
-
- $this->DB->build( array( 'select' => 'id, title', 'from' => 'faq' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- if( in_array( $r['id'], $_help ) )
- {
- $_extraData['help'][] = $r['title'];
- }
- }
- }
- }
-
- /* Fix modules */
- if( is_array($_extraData['modules']) AND count($_extraData['modules']) )
- {
- $_modules = array();
-
- foreach( $_extraData['modules'] as $_id )
- {
- if( intval($_id) == $_id )
- {
- $_modules[ $_id ] = intval($_id);
- }
- }
-
- if( count($_modules) )
- {
- $_extraData['modules'] = array();
-
- $this->DB->build( array( 'select' => 'sys_module_id, sys_module_admin, sys_module_application, sys_module_key', 'from' => 'core_sys_module' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- if( in_array( $r['sys_module_id'], $_modules ) )
- {
- $_extraData['modules'][] = ( $r['sys_module_admin'] ? 'admin' : 'public' ) . '-' . $r['sys_module_application'] . '-' . $r['sys_module_key'];
- }
- }
- }
- }
-
- /* Fix templates */
- if( is_array($_extraData['templates']) AND count($_extraData['templates']) )
- {
- $_newTemplates = array();
-
- foreach( $_extraData['templates'] as $file => $templates )
- {
- foreach( $templates as $template )
- {
- $_newTemplates[ $file ][ $template ] = $template;
- }
- }
-
- $_extraData['templates'] = $_newTemplates;
- }
-
- /* Fix CSS */
- if( is_array($_extraData['css']) AND count($_extraData['css']) )
- {
- $_css = array();
-
- foreach( $_extraData['css'] as $_id )
- {
- if( intval($_id) == $_id )
- {
- $_css[ $_id ] = intval($_id);
- }
- }
-
- if( count($_css) )
- {
- $_extraData['css'] = array();
-
- $this->DB->build( array( 'select' => 'css_group', 'from' => 'skin_css', 'where' => "css_id IN(" . implode( ',', $_css ) . ")" ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $_extraData['css'][ $r['css_group'] ] = $r['css_group'];
- }
- }
- }
-
- $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize( $_extraData ) ), 'hook_id=' . $hook['hook_id'] );
-
- $_total++;
- }
-
- /* Message */
- $this->registry->output->addMessage("{$_total} hooks updated....");
-
- /* Next Page */
- $this->request['workact'] = 'photos';
- }
-
- /**
- * Convert and rebuild photos
- *
- * @param int
- * @return @e void
- */
- public function convertPhotos()
- {
- /* Is this the first cycle? */
- if( !$this->request['from'] )
- {
- $this->_output = <<Profile Photo Conversion
-
- IP.Board 3.2 supports one image to identify each user. You can choose to retain your existing avatars or your existing profile photos for this image.
-
-
- Use avatars
- Use profile photos
-
-
- The image you save will need to be rebuilt. You can let the upgrader handle this now, or you can skip this step and complete it later from the ACP.
-
-
Rebuild thumbnails now
-
Skip this step and rebuild thumbnails from the ACP later
-EOF;
-
- return;
- }
-
- /* Our options */
- $convertFrom = $this->request['from'] == 'avatars' ? 'avatars' : 'photos';
- $skipRebuild = intval($this->request['skip']);
-
- /* Init */
- $st = intval($this->request['st']);
- $did = 0;
- $each = 200;
-
- require_once( IPS_ROOT_PATH . 'sources/classes/member/photo.php' );/*noLibHook*/
- $photo = new classes_member_photo( $this->registry );
-
- /* Loop over members */
- $this->DB->build( array( 'select' => '*', 'from' => 'profile_portal', 'order' => 'pp_member_id ASC', 'limit' => array( $st, $each ) ) );
- $outer = $this->DB->execute();
-
- while( $r = $this->DB->fetch($outer) )
- {
- $did++;
-
- $update = array();
-
- if( $r['fb_photo'] )
- {
- $update['pp_photo_type'] = 'facebook';
- }
- else if( $r['tc_photo'] )
- {
- $update['pp_photo_type'] = 'twitter';
- }
- else
- {
- if( $convertFrom == 'avatars' )
- {
- if( $r['avatar_type'] == 'upload' AND $r['avatar_location'] )
- {
- $update['pp_photo_type'] = 'custom';
- $update['pp_main_photo'] = $r['avatar_location'];
- $_dims = @getimagesize( $this->settings['upload_dir'] . '/' . $r['avatar_location'] );
- $update['pp_main_width'] = $_dims[0] ? $_dims[0] : 1;
- $update['pp_main_height'] = $_dims[1] ? $_dims[1] : 1;
- }
- else if( $r['avatar_type'] == 'gravatar' )
- {
- $update['pp_photo_type'] = 'gravatar';
- $update['pp_gravatar'] = $r['avatar_location'];
-
- $md5Gravatar = md5( $update['pp_gravatar'] );
-
- $_url = "http://www.gravatar.com";
-
- if( $this->registry->output->isHTTPS )
- {
- $_url = "https://secure.gravatar.com";
- }
-
- $update['pp_main_photo'] = $_url . "/avatar/" .$md5Gravatar . "?s=100";
- $update['pp_main_width'] = 100;
- $update['pp_main_height'] = 100;
- $update['pp_thumb_photo'] = $_url . "/avatar/" .$md5Gravatar . "?s=100";
- $update['pp_thumb_width'] = 100;
- $update['pp_thumb_height'] = 100;
- }
- }
- else
- {
- if( $r['pp_main_photo'] )
- {
- $update['pp_photo_type'] = 'custom';
- $update['pp_main_photo'] = $r['pp_main_photo'];
- }
- }
- }
-
- if( !$skipRebuild AND $update['pp_photo_type'] == 'custom' )
- {
- $info = $photo->buildSizedPhotos( str_replace( 'upload:', '', $update['pp_main_photo'] ), $r['pp_member_id'], true );
-
- $update['pp_main_width'] = intval( $info['final_width'] );
- $update['pp_main_height'] = intval( $info['final_height'] );
- $update['pp_thumb_photo'] = $info['t_final_location'] ? $info['t_final_location'] : $info['final_location'];
- $update['pp_thumb_width'] = intval( $info['t_final_width'] );
- $update['pp_thumb_height'] = intval( $info['t_final_height'] );
- }
-
- if( count($update) )
- {
- $this->DB->update( 'profile_portal', $update, 'pp_member_id=' . $r['pp_member_id'] );
- }
- }
-
- /* Show message and redirect */
- if( $did > 0 )
- {
- $this->request['st'] = ( $st + $did );
- $this->request['workact'] = 'photos';
-
- $message = $skipRebuild ? "Up to {$this->request['st']} profile photos converted ..." : "Up to {$this->request['st']} profile photos converted and rebuilt...";
- $this->registry->output->addMessage( $message );
-
- /* Yes, we are being sneaky here. Shhhhh */
- $this->request['st'] = $this->request['st'] . '&from=' . $this->request['from'] . '&skip=' . $skipRebuild;
- }
- else
- {
- $this->request['st'] = 0;
- $this->request['workact'] = '';
-
- $this->registry->output->addMessage( "All profile photos converted..." );
- }
-
- /* Next Page */
- return;
- }
+Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class version_upgrade
+{
+ /**
+ * Custom HTML to show
+ *
+ * @var string
+ */
+ protected $_output = '';
+
+ /**
+ * fetchs output
+ *
+ * @return string
+ */
+ public function fetchOutput()
+ {
+ return $this->_output;
+ }
+
+ /**
+ * Execute selected method
+ *
+ * @param object Registry object
+ * @return @e void
+ */
+ 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->cache = $this->registry->cache();
+ $this->caches =& $this->registry->cache()->fetchCaches();
+
+ //--------------------------------
+ // What are we doing?
+ //--------------------------------
+
+ switch( $this->request['workact'] )
+ {
+ case 'sql':
+ case 'sql1':
+ default:
+ $this->upgradeSql(1);
+ break;
+ case 'sql2':
+ $this->upgradeSql(2);
+ break;
+ case 'sql3':
+ $this->upgradeSql(3);
+ break;
+ case 'sql4':
+ $this->upgradeSql(4);
+ break;
+ case 'sql5':
+ $this->upgradeSql(5);
+ break;
+ case 'sql6':
+ $this->upgradeSql(6);
+ break;
+
+ case 'logs':
+ case 'logs1':
+ $this->upgradeLogs(1);
+ break;
+ case 'logs2':
+ $this->upgradeLogs(2);
+ break;
+ case 'logs3':
+ $this->upgradeLogs(3);
+ break;
+ case 'logs4':
+ $this->upgradeLogs(4);
+ break;
+ case 'logs5':
+ $this->upgradeLogs(5);
+ break;
+ case 'logs6':
+ $this->upgradeLogs(6);
+ break;
+ case 'logs7':
+ $this->upgradeLogs(7);
+ break;
+ case 'logs8':
+ $this->upgradeLogs(8);
+ break;
+ case 'logs9':
+ $this->upgradeLogs(9);
+ break;
+ case 'logs10':
+ $this->upgradeLogs(10);
+ break;
+
+ case 'forums':
+ $this->fixArchiveForums();
+ break;
+
+ case 'loginmethods':
+ $this->fixLoginMethods();
+ break;
+
+ case 'oldhooks':
+ $this->removeOldHooks();
+ break;
+
+ case 'setdefaultskin':
+ $this->setDefaultSkin();
+ break;
+
+ case 'hooks':
+ $this->convertHooks();
+ break;
+
+ case 'photos':
+ $this->convertPhotos();
+ break;
+ }
+
+ /* Workact is set in the function, so if it has not been set, then we're done. The last function should unset it. */
+ if ( $this->request['workact'] )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ /**
+ * Run SQL files
+ *
+ * @param int
+ * @return @e void
+ */
+ public function upgradeSql( $id=1 )
+ {
+ $cnt = 0;
+ $file = '_updates_'.$id.'.php';
+ $output = "";
+ $path = IPSLib::getAppDir( 'core' ) . '/setup/versions/upg_32000/' . strtolower( $this->registry->dbFunctions()->getDriverType() ) . $file;
+ $prefix = $this->registry->dbFunctions()->getPrefix();
+ $sourceFile = '';
+ $options = IPSSetUp::getSavedData('custom_options');
+ $postTable = $options['core'][32000]['manualPostsTableQuery'];
+
+ if ( is_file( $path ) )
+ {
+ $SQL = array();
+
+ require( $path );/*noLibHook*/
+
+ /* Set DB driver to return any errors */
+ $this->DB->return_die = 1;
+
+ foreach( $SQL as $query )
+ {
+ $this->DB->allow_sub_select = 1;
+ $this->DB->error = '';
+
+ $query = str_replace( "<%time%>", time(), $query );
+
+ if ( $this->settings['mysql_tbl_type'] )
+ {
+ if ( preg_match( "/^create table(.+?)/i", $query ) )
+ {
+ $query = preg_replace( "/^(.+?)\);$/is", "\\1) ENGINE={$this->settings['mysql_tbl_type']};", $query );
+ }
+ }
+
+ /* Need to tack on a prefix? */
+ if ( $prefix )
+ {
+ $query = IPSSetUp::addPrefixToQuery( $query, $prefix );
+ }
+
+ if( IPSSetUp::getSavedData('man') OR ( $id == 6 AND $postTable ) )
+ {
+ $query = trim( $query );
+
+ /* Ensure the last character is a semi-colon */
+ if ( substr( $query, -1 ) != ';' )
+ {
+ $query .= ';';
+ }
+
+ $output .= $query . "\n\n";
+ }
+ else
+ {
+ $this->DB->query( $query );
+
+ if ( $this->DB->error )
+ {
+ $this->registry->output->addError( "
" . $query . "
" . $this->DB->error );
+ }
+ else
+ {
+ $cnt++;
+ }
+ }
+ }
+
+ $this->registry->output->addMessage("{$cnt} запросов выполнено....");
+ }
+
+ /* Next Page */
+ if ( $id < 6 )
+ {
+ $nextid = $id + 1;
+ $this->request['workact'] = 'sql' . $nextid;
+ }
+ else
+ {
+ $this->request['workact'] = 'logs';
+ }
+
+ if ( $output )
+ {
+ /* Create source file */
+ if ( $this->registry->dbFunctions()->getDriverType() == 'mysql' )
+ {
+ $sourceFile = IPSSetUp::createSqlSourceFile( $output, '32000', $id );
+ }
+
+ $this->_output = $this->registry->output->template()->upgrade_manual_queries( $output, $sourceFile );
+ }
+ }
+
+ /**
+ * Upgrade log file tables
+ *
+ * @param int
+ * @return @e void
+ */
+ public function upgradeLogs( $id=1 )
+ {
+ /* Verify posts alter table query has run */
+ if( $id == 1 )
+ {
+ if( !$this->DB->checkForField( 'post_bwoptions', 'posts' ) )
+ {
+ $this->_output = ' ';
+ $this->registry->output->addError( "Вы должны выполнить запрос изменяющий таблицу posts. После того как вы выполните это, просто обновите данную страницу и обновление будет продолжено." );
+ return;
+ }
+ }
+
+ $cnt = 0;
+ $file = '_updates_logs_'.$id.'.php';
+ $output = "";
+ $path = IPSLib::getAppDir( 'core' ) . '/setup/versions/upg_32000/' . strtolower( $this->registry->dbFunctions()->getDriverType() ) . $file;
+ $prefix = $this->registry->dbFunctions()->getPrefix();
+
+ if ( is_file( $path ) )
+ {
+ $SQL = array();
+ $TABLE = '';
+
+ require( $path );/*noLibHook*/
+
+ /* Set DB driver to return any errors */
+ $this->DB->return_die = 1;
+
+ foreach( $SQL as $query )
+ {
+ $this->DB->allow_sub_select = 1;
+ $this->DB->error = '';
+
+ /* Need to tack on a prefix? */
+ if ( $prefix )
+ {
+ $query = IPSSetUp::addPrefixToQuery( $query, $prefix );
+ }
+
+ /* Chose to prune and run? */
+ if( $this->request['pruneAndRun'] )
+ {
+ $this->DB->delete( $TABLE );
+
+ $man = false;
+ }
+ else
+ {
+ /* Show alter table / prune option? */
+ $man = IPSSetUp::getSavedData('man');
+
+ if( $TABLE )
+ {
+ $count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as logs', 'from' => $TABLE ) );
+
+ if( $count['logs'] > 100000 )
+ {
+ $man = true;
+ }
+ }
+ }
+
+ /* Show option to run manually or prune ? */
+ if( $man )
+ {
+ $query = trim( $query );
+
+ /* Ensure the last character is a semi-colon */
+ if ( substr( $query, -1 ) != ';' )
+ {
+ $query .= ';';
+ }
+
+ $output .= $query . "\n\n";
+ }
+ else
+ {
+ $this->DB->query( $query );
+
+ if ( $this->DB->error )
+ {
+ $this->registry->output->addError( "
" . $query . "
" . $this->DB->error );
+ }
+ else
+ {
+ $cnt++;
+ }
+ }
+ }
+
+ $this->registry->output->addMessage("{$cnt} запросов выполнено....");
+ }
+
+ /* Next Page */
+ if ( $id < 10 )
+ {
+ $nextid = $id + 1;
+ $this->request['workact'] = 'logs' . $nextid;
+ }
+ else
+ {
+ $this->request['workact'] = 'forums';
+ }
+
+ if ( $output )
+ {
+ $this->_output = $this->registry->output->template()->upgrade_manual_queries_logs( $output, $id, $TABLE );
+ }
+ }
+
+ /**
+ * Convert archive forums to read-only forums
+ *
+ * @return @e void
+ */
+ public function fixArchiveForums()
+ {
+ /* Update array for archive forums */
+ $_total = 0;
+ $_update = array(
+ 'perm_3' => '',
+ 'perm_4' => '',
+ 'perm_5' => '',
+ );
+
+ /* Get 'archive' forums */
+ $this->DB->build( array( 'select' => '*', 'from' => 'forums', 'where' => 'status=0' ) );
+ $outer = $this->DB->execute();
+
+ while( $r = $this->DB->fetch($outer) )
+ {
+ $this->DB->update( 'permission_index', $_update, "app='forums' AND perm_type='forum' AND perm_type_id={$r['id']}" );
+
+ $_total++;
+ }
+
+ /* Now drop the status field in forums table */
+ $this->DB->dropField( 'forums', 'status' );
+
+ /* Message */
+ $this->registry->output->addMessage("{$_total} форумов со статусом 'архивный' переведено в форумы только для чтения....");
+
+ /* Next Page */
+ $this->request['workact'] = 'loginmethods';
+ }
+
+ /**
+ * Pull login method conf to DB
+ *
+ * @return @e void
+ */
+ public function fixLoginMethods()
+ {
+ /* Init */
+ $_total = 0;
+
+ if( !defined('IPS_PATH_CUSTOM_LOGIN') )
+ {
+ define( 'IPS_PATH_CUSTOM_LOGIN' , IPS_ROOT_PATH . 'sources/loginauth' );
+ }
+
+ /* Try to loop over all login methods to grab current configs */
+ try
+ {
+ foreach( new DirectoryIterator( IPS_PATH_CUSTOM_LOGIN ) as $file )
+ {
+ if ( $file->isDir() )
+ {
+ if( is_file( $file->getPathname() . '/conf.php' ) )
+ {
+ $LOGIN_CONF = array();
+
+ include( $file->getPathname() . '/conf.php' );/*noLibHook*/
+
+ if( is_array($LOGIN_CONF) AND count($LOGIN_CONF) )
+ {
+ $this->DB->update( 'login_methods', array( 'login_custom_config' => @serialize($LOGIN_CONF) ), "login_folder_name='" . $this->DB->addSlashes( $file->getFilename() ) . "'" );
+
+ $_total++;
+ }
+ }
+ }
+ }
+ }
+ catch( Exception $e )
+ {
+ }
+
+ /* Message */
+ $this->registry->output->addMessage("{$_total} login method configs imported....");
+
+ /* Next Page */
+ $this->request['workact'] = 'oldhooks';
+ }
+
+ /**
+ * Remove old hooks
+ *
+ * @return @e void
+ */
+ public function removeOldHooks()
+ {
+ /* Hooks to remove */
+ $hooks = array( 'watched_content', 'todays_top_posters', 'unread_notifications' );
+ $_hookIds = array();
+ $_total = 0;
+
+ /* Get hook records */
+ $this->DB->build( array( 'select' => 'hook_id', 'from' => 'core_hooks', 'where' => "hook_key IN('" . implode( "','", $hooks ) . "')" ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $_hookIds[] = $r['hook_id'];
+ }
+
+ /* Remove associated files */
+ if( count($_hookIds) )
+ {
+ $this->DB->build( array( 'select' => 'hook_file_stored', 'from' => 'core_hooks_files', 'where' => 'hook_hook_id IN(' . implode( ',', $_hookIds ) . ')' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ @unlink( IPS_HOOKS_PATH . $r['hook_file_stored'] );
+ }
+
+ /* Remove hook records */
+ $this->DB->delete( 'core_hooks_files', 'hook_hook_id IN(' . implode( ',', $_hookIds ) . ')' );
+ $this->DB->delete( 'core_hooks', 'hook_id IN(' . implode( ',', $_hookIds ) . ')' );
+
+ $_total++;
+ }
+
+ /* Message */
+ $this->registry->output->addMessage("{$_total} устаревших хуков удалено....");
+
+ /* Next Page */
+ $this->request['workact'] = 'setdefaultskin';
+ }
+
+ /**
+ * Restore IPB default skin as default
+ *
+ * @return @e void
+ */
+ public function setDefaultSkin()
+ {
+ /* Get skin functions library */
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );/*noLibHook*/
+ require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );/*noLibHook*/
+
+ $skinFunctions = new skinCaching( $this->registry );
+
+ /* Update members to use default skin */
+ $this->DB->update( 'members', array( 'skin' => 0 ) );
+
+ /* Update forums to use default skin */
+ $this->DB->update( 'forums', array( 'skin_id' => 0 ) );
+
+ /* Reset any default skin(s) */
+ $this->DB->update( 'skin_collections', array( 'set_is_default' => 0 ) );
+
+ /* Set IPB default skin as default */
+ $this->DB->update( 'skin_collections', array( 'set_is_default' => 1 ), "set_key='default'" );
+
+ /* Verify we have a skin set as default */
+ $_check = $this->DB->buildAndFetch( array( 'select' => 'count(*) as total', 'from' => 'skin_collections', 'where' => 'set_is_default=1' ) );
+
+ if( $_check['total'] < 1 )
+ {
+ $this->DB->build( array( 'update' => 'skin_collections', 'set' => 'set_is_default=1', 'where' => "set_output_format='html'", 'limit' => array( 0, 1 ) ) );
+ $this->DB->execute();
+ }
+
+ /* Check for any modifications in IPB default skin */
+ $_master = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'skin_collections', 'where' => "set_key='default'" ) );
+ $_master['set_id'] = intval($_master['set_id']);
+ $_modifiedTemplates = $this->DB->buildAndFetch( array( 'select' => 'count(*) as total', 'from' => 'skin_templates', 'where' => "template_set_id={$_master['set_id']} AND template_removable=1 OR template_user_edited=1" ) );
+ $_modifiedCSS = $this->DB->buildAndFetch( array( 'select' => 'count(*) as total', 'from' => 'skin_css', 'where' => "css_set_id={$_master['set_id']} AND css_master_key=''" ) );
+
+ if( $_modifiedTemplates['total'] OR $_modifiedCSS['total'] )
+ {
+ /* Create a new skin with IPB default as parent */
+ $curPos = $skinFunctions->fetchHighestSetPosition();
+
+ $_master['set_key'] = 'default_modified';
+ $_master['set_parent_id'] = $_master['set_id'];
+ $_master['set_is_default'] = 0;
+ $_master['set_name'] = $_master['set_name'] . ' (Pre 3.2)';
+ $_master['set_order'] = (int)$curPos++;
+ unset($_master['set_id']);
+
+ $this->DB->insert( 'skin_collections', $_master );
+ $set_id = $this->DB->getInsertId();
+
+ $this->DB->update( 'skin_templates', array( 'template_set_id' => $set_id ), "template_set_id={$_master['set_parent_id']} AND template_removable=1 OR template_user_edited=1" );
+ $this->DB->update( 'skin_css', array( 'css_set_id' => $set_id ), "css_set_id={$_master['set_parent_id']} AND css_master_key=''" );
+
+ $skinFunctions->rebuildSkinSetsCache();
+ $skinFunctions->rebuildTreeInformation( $set_id );
+ //$skinFunctions->flushSkinData();
+
+ $skinFunctions->rebuildCSS( $set_id );
+ $skinFunctions->rebuildPHPTemplates( $set_id );
+ $skinFunctions->rebuildReplacementsCache( $set_id );
+ }
+
+ /* Message */
+ $this->registry->output->addMessage("Восстановлен новый базовый стиль....");
+
+ /* Next Page */
+ $this->request['workact'] = 'hooks';
+ }
+
+ /**
+ * Convert stored hook data
+ *
+ * @return @e void
+ */
+ public function convertHooks()
+ {
+ $_total = 0;
+
+ /* Grab all hooks */
+ $this->DB->build( array( 'select' => '*', 'from' => 'core_hooks' ) );
+ $outer = $this->DB->execute();
+
+ while( $hook = $this->DB->fetch($outer) )
+ {
+ $_extraData = unserialize($hook['hook_extra_data']);
+
+ /* Fix setting groups */
+ if( is_array($_extraData['settingGroups']) AND count($_extraData['settingGroups']) )
+ {
+ $_settingGroups = array();
+
+ foreach( $_extraData['settingGroups'] as $_group )
+ {
+ if( intval($_group) == $_group )
+ {
+ $_settingGroups[ $_group ] = intval($_group);
+ }
+ }
+
+ if( count($_settingGroups) )
+ {
+ $_extraData['settingGroups'] = array();
+
+ $this->DB->build( array( 'select' => 'conf_title_id, conf_title_keyword', 'from' => 'core_sys_settings_titles' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ if( in_array( $r['conf_title_id'], $_settingGroups ) )
+ {
+ $_extraData['settingGroups'][] = $r['conf_title_keyword'];
+ }
+ }
+ }
+ }
+
+ /* Fix settings */
+ if( is_array($_extraData['settings']) AND count($_extraData['settings']) )
+ {
+ $_settings = array();
+
+ foreach( $_extraData['settings'] as $_id )
+ {
+ if( intval($_id) == $_id )
+ {
+ $_settings[ $_id ] = intval($_id);
+ }
+ }
+
+ if( count($_settings) )
+ {
+ $_extraData['settings'] = array();
+
+ $this->DB->build( array( 'select' => 'conf_id, conf_key', 'from' => 'core_sys_conf_settings' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ if( in_array( $r['conf_id'], $_settings ) )
+ {
+ $_extraData['settings'][] = $r['conf_key'];
+ }
+ }
+ }
+ }
+
+ /* Fix tasks */
+ if( is_array($_extraData['tasks']) AND count($_extraData['tasks']) )
+ {
+ $_tasks = array();
+
+ foreach( $_extraData['tasks'] as $_id )
+ {
+ if( intval($_id) == $_id )
+ {
+ $_tasks[ $_id ] = intval($_id);
+ }
+ }
+
+ if( count($_tasks) )
+ {
+ $_extraData['tasks'] = array();
+
+ $this->DB->build( array( 'select' => 'task_id, task_key', 'from' => 'task_manager' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ if( in_array( $r['task_id'], $_tasks ) )
+ {
+ $_extraData['tasks'][] = $r['task_key'];
+ }
+ }
+ }
+ }
+
+ /* Fix help files */
+ if( is_array($_extraData['help']) AND count($_extraData['help']) )
+ {
+ $_help = array();
+
+ foreach( $_extraData['help'] as $_id )
+ {
+ if( intval($_id) == $_id )
+ {
+ $_help[ $_id ] = intval($_id);
+ }
+ }
+
+ if( count($_help) )
+ {
+ $_extraData['help'] = array();
+
+ $this->DB->build( array( 'select' => 'id, title', 'from' => 'faq' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ if( in_array( $r['id'], $_help ) )
+ {
+ $_extraData['help'][] = $r['title'];
+ }
+ }
+ }
+ }
+
+ /* Fix modules */
+ if( is_array($_extraData['modules']) AND count($_extraData['modules']) )
+ {
+ $_modules = array();
+
+ foreach( $_extraData['modules'] as $_id )
+ {
+ if( intval($_id) == $_id )
+ {
+ $_modules[ $_id ] = intval($_id);
+ }
+ }
+
+ if( count($_modules) )
+ {
+ $_extraData['modules'] = array();
+
+ $this->DB->build( array( 'select' => 'sys_module_id, sys_module_admin, sys_module_application, sys_module_key', 'from' => 'core_sys_module' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ if( in_array( $r['sys_module_id'], $_modules ) )
+ {
+ $_extraData['modules'][] = ( $r['sys_module_admin'] ? 'admin' : 'public' ) . '-' . $r['sys_module_application'] . '-' . $r['sys_module_key'];
+ }
+ }
+ }
+ }
+
+ /* Fix templates */
+ if( is_array($_extraData['templates']) AND count($_extraData['templates']) )
+ {
+ $_newTemplates = array();
+
+ foreach( $_extraData['templates'] as $file => $templates )
+ {
+ foreach( $templates as $template )
+ {
+ $_newTemplates[ $file ][ $template ] = $template;
+ }
+ }
+
+ $_extraData['templates'] = $_newTemplates;
+ }
+
+ /* Fix CSS */
+ if( is_array($_extraData['css']) AND count($_extraData['css']) )
+ {
+ $_css = array();
+
+ foreach( $_extraData['css'] as $_id )
+ {
+ if( intval($_id) == $_id )
+ {
+ $_css[ $_id ] = intval($_id);
+ }
+ }
+
+ if( count($_css) )
+ {
+ $_extraData['css'] = array();
+
+ $this->DB->build( array( 'select' => 'css_group', 'from' => 'skin_css', 'where' => "css_id IN(" . implode( ',', $_css ) . ")" ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $_extraData['css'][ $r['css_group'] ] = $r['css_group'];
+ }
+ }
+ }
+
+ $this->DB->update( 'core_hooks', array( 'hook_extra_data' => serialize( $_extraData ) ), 'hook_id=' . $hook['hook_id'] );
+
+ $_total++;
+ }
+
+ /* Message */
+ $this->registry->output->addMessage("{$_total} хуков обновлено....");
+
+ /* Next Page */
+ $this->request['workact'] = 'photos';
+ }
+
+ /**
+ * Convert and rebuild photos
+ *
+ * @param int
+ * @return @e void
+ */
+ public function convertPhotos()
+ {
+ /* Is this the first cycle? */
+ if( !$this->request['from'] )
+ {
+ $this->_output = <<
Конвертация фотографий пользователей
+
+ IP.Board 3.2 теперь использует только одно изображение для идентификации пользователя. Вы должны выбрать, что именно (аватар или фотография из профиля) будет сохранено и использовано новой версией.
+
+
+ Использвать аватары
+ Использовать фотографии из профиля
+
+
+ В процессе конвертации также будут изменены размеры существующих изображений и созданы новые превью. Вы можете отложить этот процесс, отметив чекбокс. Процесс перестроения изображений может быть запущен вами после обновления в админ-центре форума.
+
+
Перестроить сейчас
+
Пропустить
+EOF;
+
+ return;
+ }
+
+ /* Our options */
+ $convertFrom = $this->request['from'] == 'avatars' ? 'avatars' : 'photos';
+ $skipRebuild = intval($this->request['skip']);
+
+ /* Init */
+ $st = intval($this->request['st']);
+ $did = 0;
+ $each = 200;
+
+ require_once( IPS_ROOT_PATH . 'sources/classes/member/photo.php' );/*noLibHook*/
+ $photo = new classes_member_photo( $this->registry );
+
+ /* Loop over members */
+ $this->DB->build( array( 'select' => '*', 'from' => 'profile_portal', 'order' => 'pp_member_id ASC', 'limit' => array( $st, $each ) ) );
+ $outer = $this->DB->execute();
+
+ while( $r = $this->DB->fetch($outer) )
+ {
+ $did++;
+
+ $update = array();
+
+ if( $r['fb_photo'] )
+ {
+ $update['pp_photo_type'] = 'facebook';
+ }
+ else if( $r['tc_photo'] )
+ {
+ $update['pp_photo_type'] = 'twitter';
+ }
+ else if( $r['vc_photo'] )
+ {
+ $update['pp_photo_type'] = 'vkontakte';
+ }
+
+ else
+ {
+ if( $convertFrom == 'avatars' )
+ {
+ if( $r['avatar_type'] == 'upload' AND $r['avatar_location'] )
+ {
+ $update['pp_photo_type'] = 'custom';
+ $update['pp_main_photo'] = $r['avatar_location'];
+ $_dims = @getimagesize( $this->settings['upload_dir'] . '/' . $r['avatar_location'] );
+ $update['pp_main_width'] = $_dims[0] ? $_dims[0] : 1;
+ $update['pp_main_height'] = $_dims[1] ? $_dims[1] : 1;
+ }
+ else if( $r['avatar_type'] == 'gravatar' )
+ {
+ $update['pp_photo_type'] = 'gravatar';
+ $update['pp_gravatar'] = $r['avatar_location'];
+
+ $md5Gravatar = md5( $update['pp_gravatar'] );
+
+ $_url = "http://www.gravatar.com";
+
+ if( $this->registry->output->isHTTPS )
+ {
+ $_url = "https://secure.gravatar.com";
+ }
+
+ $update['pp_main_photo'] = $_url . "/avatar/" .$md5Gravatar . "?s=100";
+ $update['pp_main_width'] = 100;
+ $update['pp_main_height'] = 100;
+ $update['pp_thumb_photo'] = $_url . "/avatar/" .$md5Gravatar . "?s=100";
+ $update['pp_thumb_width'] = 100;
+ $update['pp_thumb_height'] = 100;
+ }
+ }
+ else
+ {
+ if( $r['pp_main_photo'] )
+ {
+ $update['pp_photo_type'] = 'custom';
+ $update['pp_main_photo'] = $r['pp_main_photo'];
+ }
+ }
+ }
+
+ if( !$skipRebuild AND $update['pp_photo_type'] == 'custom' )
+ {
+ $info = $photo->buildSizedPhotos( str_replace( 'upload:', '', $update['pp_main_photo'] ), $r['pp_member_id'], true );
+
+ $update['pp_main_width'] = intval( $info['final_width'] );
+ $update['pp_main_height'] = intval( $info['final_height'] );
+ $update['pp_thumb_photo'] = $info['t_final_location'] ? $info['t_final_location'] : $info['final_location'];
+ $update['pp_thumb_width'] = intval( $info['t_final_width'] );
+ $update['pp_thumb_height'] = intval( $info['t_final_height'] );
+ }
+
+ if( count($update) )
+ {
+ $this->DB->update( 'profile_portal', $update, 'pp_member_id=' . $r['pp_member_id'] );
+ }
+ }
+
+ /* Show message and redirect */
+ if( $did > 0 )
+ {
+ $this->request['st'] = ( $st + $did );
+ $this->request['workact'] = 'photos';
+
+ $message = $skipRebuild ? "{$this->request['st']} фотографий сконвертировано ..." : "{$this->request['st']} фотографий сконвертировано и перестроено...";
+ $this->registry->output->addMessage( $message );
+
+ /* Yes, we are being sneaky here. Shhhhh */
+ $this->request['st'] = $this->request['st'] . '&from=' . $this->request['from'] . '&skip=' . $skipRebuild;
+ }
+ else
+ {
+ $this->request['st'] = 0;
+ $this->request['workact'] = '';
+
+ $this->registry->output->addMessage( "Все фотографии сконвертированы..." );
+ }
+
+ /* Next Page */
+ return;
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_32001/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_32001/mysql_updates.php
index 9f8d6e13..f5b2f928 100644
--- a/upload/admin/applications/core/setup/versions/upg_32001/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_32001/mysql_updates.php
@@ -1,7 +1,7 @@
Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
- exit();
-}
-
-class version_upgrade
-{
- /**
- * Custom HTML to show
- *
- * @var string
- */
- protected $_output = '';
-
- /**
- * fetchs output
- *
- * @return string
- */
- public function fetchOutput()
- {
- return $this->_output;
- }
-
- /**
- * Execute selected method
- *
- * @param object Registry object
- * @return @e void
- */
- 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->cache = $this->registry->cache();
- $this->caches =& $this->registry->cache()->fetchCaches();
-
- //--------------------------------
- // What are we doing?
- //--------------------------------
-
- switch( $this->request['workact'] )
- {
- default:
- case 'oldhooks':
- $this->removeOldHooks();
- break;
- }
-
- return true;
- }
-
- /**
- * Remove old hooks
- *
- * @return @e void
- */
- public function removeOldHooks()
- {
- /* Hooks to remove */
- $hooks = array( 'sharelinks', 'fb_like' );
- $_hookIds = array();
- $_total = 0;
-
- /* Get hook records */
- $this->DB->build( array( 'select' => 'hook_id', 'from' => 'core_hooks', 'where' => "hook_key IN('" . implode( "','", $hooks ) . "')" ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- $_hookIds[] = $r['hook_id'];
- }
-
- /* Remove associated files */
- if( count($_hookIds) )
- {
- $this->DB->build( array( 'select' => 'hook_file_stored', 'from' => 'core_hooks_files', 'where' => 'hook_hook_id IN(' . implode( ',', $_hookIds ) . ')' ) );
- $this->DB->execute();
-
- while( $r = $this->DB->fetch() )
- {
- @unlink( IPS_HOOKS_PATH . $r['hook_file_stored'] );
- }
-
- /* Remove hook records */
- $this->DB->delete( 'core_hooks_files', 'hook_hook_id IN(' . implode( ',', $_hookIds ) . ')' );
- $this->DB->delete( 'core_hooks', 'hook_id IN(' . implode( ',', $_hookIds ) . ')' );
-
- $_total++;
- }
-
- /* Message */
- $this->registry->output->addMessage("{$_total} outdated hook(s) uninstalled....");
-
- /* Next Page */
- $this->request['workact'] = '';
- }
+Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
+ exit();
+}
+
+class version_upgrade
+{
+ /**
+ * Custom HTML to show
+ *
+ * @var string
+ */
+ protected $_output = '';
+
+ /**
+ * fetchs output
+ *
+ * @return string
+ */
+ public function fetchOutput()
+ {
+ return $this->_output;
+ }
+
+ /**
+ * Execute selected method
+ *
+ * @param object Registry object
+ * @return @e void
+ */
+ 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->cache = $this->registry->cache();
+ $this->caches =& $this->registry->cache()->fetchCaches();
+
+ //--------------------------------
+ // What are we doing?
+ //--------------------------------
+
+ switch( $this->request['workact'] )
+ {
+ default:
+ case 'oldhooks':
+ $this->removeOldHooks();
+ break;
+ }
+
+ return true;
+ }
+
+ /**
+ * Remove old hooks
+ *
+ * @return @e void
+ */
+ public function removeOldHooks()
+ {
+ /* Hooks to remove */
+ $hooks = array( 'sharelinks', 'fb_like' );
+ $_hookIds = array();
+ $_total = 0;
+
+ /* Get hook records */
+ $this->DB->build( array( 'select' => 'hook_id', 'from' => 'core_hooks', 'where' => "hook_key IN('" . implode( "','", $hooks ) . "')" ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $_hookIds[] = $r['hook_id'];
+ }
+
+ /* Remove associated files */
+ if( count($_hookIds) )
+ {
+ $this->DB->build( array( 'select' => 'hook_file_stored', 'from' => 'core_hooks_files', 'where' => 'hook_hook_id IN(' . implode( ',', $_hookIds ) . ')' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ @unlink( IPS_HOOKS_PATH . $r['hook_file_stored'] );
+ }
+
+ /* Remove hook records */
+ $this->DB->delete( 'core_hooks_files', 'hook_hook_id IN(' . implode( ',', $_hookIds ) . ')' );
+ $this->DB->delete( 'core_hooks', 'hook_id IN(' . implode( ',', $_hookIds ) . ')' );
+
+ $_total++;
+ }
+
+ /* Message */
+ $this->registry->output->addMessage("{$_total} устаревших хуков удалено....");
+
+ /* Next Page */
+ $this->request['workact'] = '';
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_32002/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_32002/mysql_updates.php
index 4ae9cbef..e5d975aa 100644
--- a/upload/admin/applications/core/setup/versions/upg_32002/mysql_updates.php
+++ b/upload/admin/applications/core/setup/versions/upg_32002/mysql_updates.php
@@ -1,7 +1,7 @@
- * Invision Power Services
- * IP.Board v3.3.4
- * Upgrade Class
- *
- * Class to add options and notices for IP.Board upgrade
- * Last Updated: $Date: 2011-05-25 19:58:10 +0100 (Wed, 25 May 2011) $
- *
- *
- * @author Matt Mecham
- * @version $Rev: 8891 $
- * @since 3.0
- * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.invisionpower.com/company/standards.php#license
- * @link http://www.invisionpower.com
- * @package IP.Board
- */
-
-class version_class_core_33000
-{
- /**
- * Constructor
- *
- * @param object $registry Registry object
- * @return @e 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->cache = $this->registry->cache();
- $this->caches =& $this->registry->cache()->fetchCaches();
- }
-
- /**
- * Add pre-upgrade options: Form
- *
- * @return string HTML block
- */
- public function preInstallOptionsForm()
- {
- $_wrapper = "";
- $_html = '';
- $posts = $this->DB->buildAndFetch( array( 'select' => 'count(*) as total', 'from' => 'posts' ) );
-
- // Is 3.1?
- if ( IPSSetUp::is300plus() && ! IPSSetUp::is320plus() )
- {
- // Got more than 100K posts?
- if( $posts['total'] > 100000 && ! $this->DB->checkForField( 'post_field_int', 'posts' ) )
- {
-$_html .= <<
-
- Manually apply changes to the posts table? Your site has more than 100,000 posts. We strongly recommend that you enable this option and manually run the provided
- SQL query to alter your posts table in order to prevent timeouts in the web-based upgrader. If you uncheck this option, it is very possible the upgrader will timeout attempting to
- update your posts table.
-
-EOF;
- }
- }
-
- $_html .= <<
-
- Flag all members in the Banned member group as banned
- 3.3.0 removes the need for a specific Banned Group and uses the built in 'flag' on a per-member basis. However, unless you choose to update all
- members in the current Banned Group as 'banned' they may not appear when searching for banned members in the ACP.
- We recommend you keep this box ticked
-
-EOF;
-
- if( $_html )
- {
- return sprintf( $_wrapper, $_html );
- }
- else
- {
- return '';
- }
- }
-
- /**
- * Add pre-upgrade options: Save
- *
- * Data will be saved in saved data array as: appOptions[ app ][ versionLong ] = ( key => value );
- *
- * @return array Key / value pairs to save
- */
- public function preInstallOptionsSave()
- {
- return array( 'flagBanned' => intval( $_REQUEST['flagBanned'] ), 'manualPostsTableQuery' => intval( $_REQUEST['manualPostsTableQuery'] ) );
- }
-
- /**
- * Return any post-installation notices
- *
- * @return array Array of notices
- */
- public function postInstallNotices()
- {
- return array();
- }
-
- /**
- * Return any pre-installation notices
- *
- * @return array Array of notices
- */
- public function preInstallNotices()
- {
- return array();
- }
+
+ * Invision Power Services
+ * IP.Board v3.4.5
+ * Upgrade Class
+ *
+ * Class to add options and notices for IP.Board upgrade
+ * Last Updated: $Date: 2011-05-25 19:58:10 +0100 (Wed, 25 May 2011) $
+ *
+ *
+ * @author Matt Mecham
+ * @version $Rev: 8891 $
+ * @since 3.0
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/company/standards.php#license
+ * @link http://www.invisionpower.com
+ * @package IP.Board
+ */
+
+class version_class_core_33000
+{
+ /**
+ * Constructor
+ *
+ * @param object $registry Registry object
+ * @return @e 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->cache = $this->registry->cache();
+ $this->caches =& $this->registry->cache()->fetchCaches();
+ }
+
+ /**
+ * Add pre-upgrade options: Form
+ *
+ * @return string HTML block
+ */
+ public function preInstallOptionsForm()
+ {
+ $_wrapper = "";
+ $_html = '';
+ $posts = $this->DB->buildAndFetch( array( 'select' => 'count(*) as total', 'from' => 'posts' ) );
+
+ // Is 3.1?
+ if ( IPSSetUp::is300plus() && ! IPSSetUp::is320plus() )
+ {
+ // Got more than 100K posts?
+ if( $posts['total'] > 100000 && ! $this->DB->checkForField( 'post_field_int', 'posts' ) )
+ {
+$_html .= <<
+
+ Внести изменения в структуру таблицы Posts вручную? На вашем форуме более 100,000 сообщений. Мы настоятельно рекомендуем вам включить данную опцию и самостоятельно выполнить
+ SQL запросы для обновления таблицы сообщений. Если вы отключите данную опцию существует большая вероятность того, что мастер обновления не сможет обновить форум.
+
+EOF;
+ }
+ }
+
+ $_html .= <<
+
+ Отметить всех пользователей из группы "Забаненные", как забаненных
+ В 3.3.0 удалена отдельная группа для заблокированных, теперь проверка осуществляется на основе метки для каждого пользователя. Возможно, что часть пользователей, отмеченных как
+ забаненные, в результате такого переноса, не будут находится поиском в админ-центре при применении фильтра поиска по заблокированным.
+ Мы рекомендуем воспользоваться этой опцией.
+
+EOF;
+
+ if( $_html )
+ {
+ return sprintf( $_wrapper, $_html );
+ }
+ else
+ {
+ return '';
+ }
+ }
+
+ /**
+ * Add pre-upgrade options: Save
+ *
+ * Data will be saved in saved data array as: appOptions[ app ][ versionLong ] = ( key => value );
+ *
+ * @return array Key / value pairs to save
+ */
+ public function preInstallOptionsSave()
+ {
+ return array( 'flagBanned' => intval( $_REQUEST['flagBanned'] ), 'manualPostsTableQuery' => intval( $_REQUEST['manualPostsTableQuery'] ) );
+ }
+
+ /**
+ * Return any post-installation notices
+ *
+ * @return array Array of notices
+ */
+ public function postInstallNotices()
+ {
+ return array();
+ }
+
+ /**
+ * Return any pre-installation notices
+ *
+ * @return array Array of notices
+ */
+ public function preInstallNotices()
+ {
+ return array();
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_33000/version_upgrade.php b/upload/admin/applications/core/setup/versions/upg_33000/version_upgrade.php
index 2791ca60..d57aa350 100644
--- a/upload/admin/applications/core/setup/versions/upg_33000/version_upgrade.php
+++ b/upload/admin/applications/core/setup/versions/upg_33000/version_upgrade.php
@@ -155,7 +155,7 @@ class version_upgrade
}
}
- $this->registry->output->addMessage("{$cnt} queries ran... ");
+ $this->registry->output->addMessage("{$cnt} запросов выполнено... ");
}
/* Next Page */
diff --git a/upload/admin/applications/core/setup/versions/upg_33007/version_upgrade.php b/upload/admin/applications/core/setup/versions/upg_33007/version_upgrade.php
index dc59ac2e..83b1aa98 100644
--- a/upload/admin/applications/core/setup/versions/upg_33007/version_upgrade.php
+++ b/upload/admin/applications/core/setup/versions/upg_33007/version_upgrade.php
@@ -91,7 +91,7 @@ class version_upgrade
}
}
- $this->registry->output->addMessage( "XML Skin restored" );
+ $this->registry->output->addMessage( "XML стиль восстановлен" );
$this->request['workact'] = '';
}
diff --git a/upload/admin/applications/core/setup/versions/upg_33010/version_class.php b/upload/admin/applications/core/setup/versions/upg_33010/version_class.php
index 2aa3c860..a135f286 100644
--- a/upload/admin/applications/core/setup/versions/upg_33010/version_class.php
+++ b/upload/admin/applications/core/setup/versions/upg_33010/version_class.php
@@ -1,82 +1,82 @@
-
- * Invision Power Services
- * IP.Board v3.3.4
- * Upgrade Class
- *
- * Class to add options and notices for IP.Board upgrade
- * Last Updated: $Date: 2011-05-25 19:58:10 +0100 (Wed, 25 May 2011) $
- *
- *
- * @author Matt Mecham
- * @version $Rev: 8891 $
- * @since 3.0
- * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.invisionpower.com/company/standards.php#license
- * @link http://www.invisionpower.com
- * @package IP.Board
- */
-
-class version_class_core_33010
-{
- /**
- * Constructor
- *
- * @param object $registry Registry object
- * @return @e 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->cache = $this->registry->cache();
- $this->caches =& $this->registry->cache()->fetchCaches();
- }
-
- /**
- * Add pre-upgrade options: Form
- *
- * @return string HTML block
- */
- public function preInstallOptionsForm()
- {
- return '';
- }
-
- /**
- * Add pre-upgrade options: Save
- *
- * Data will be saved in saved data array as: appOptions[ app ][ versionLong ] = ( key => value );
- *
- * @return array Key / value pairs to save
- */
- public function preInstallOptionsSave()
- {
- return array();
- }
-
- /**
- * Return any post-installation notices
- *
- * @return array Array of notices
- */
- public function postInstallNotices()
- {
- return array();
- }
-
- /**
- * Return any pre-installation notices
- *
- * @return array Array of notices
- */
- public function preInstallNotices()
- {
- return array( "Please note: The OpenID login method will be removed in the 3.3.0 Beta 4 upgrade and all associated OpenID data removed from the database. This will not affect your board unless you configured your board to use OpenID as a log in method." );
- }
+
+ * Invision Power Services
+ * IP.Board v3.4.5
+ * Upgrade Class
+ *
+ * Class to add options and notices for IP.Board upgrade
+ * Last Updated: $Date: 2011-05-25 19:58:10 +0100 (Wed, 25 May 2011) $
+ *
+ *
+ * @author Matt Mecham
+ * @version $Rev: 8891 $
+ * @since 3.0
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/company/standards.php#license
+ * @link http://www.invisionpower.com
+ * @package IP.Board
+ */
+
+class version_class_core_33010
+{
+ /**
+ * Constructor
+ *
+ * @param object $registry Registry object
+ * @return @e 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->cache = $this->registry->cache();
+ $this->caches =& $this->registry->cache()->fetchCaches();
+ }
+
+ /**
+ * Add pre-upgrade options: Form
+ *
+ * @return string HTML block
+ */
+ public function preInstallOptionsForm()
+ {
+ return '';
+ }
+
+ /**
+ * Add pre-upgrade options: Save
+ *
+ * Data will be saved in saved data array as: appOptions[ app ][ versionLong ] = ( key => value );
+ *
+ * @return array Key / value pairs to save
+ */
+ public function preInstallOptionsSave()
+ {
+ return array();
+ }
+
+ /**
+ * Return any post-installation notices
+ *
+ * @return array Array of notices
+ */
+ public function postInstallNotices()
+ {
+ return array();
+ }
+
+ /**
+ * Return any pre-installation notices
+ *
+ * @return array Array of notices
+ */
+ public function preInstallNotices()
+ {
+ return array( "Внимание поддержка входа по OpenID удалена в 3.3.0 версии. Это недолжно отразиться на работе вашего форума, если вы не включали данный метод входа." );
+ }
}
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_33016/index.html b/upload/admin/applications/core/setup/versions/upg_33016/index.html
new file mode 100644
index 00000000..bae2d5ed
--- /dev/null
+++ b/upload/admin/applications/core/setup/versions/upg_33016/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_33016/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_33016/mysql_updates.php
new file mode 100644
index 00000000..b0ff1f03
--- /dev/null
+++ b/upload/admin/applications/core/setup/versions/upg_33016/mysql_updates.php
@@ -0,0 +1,19 @@
+getPrefix());
+$DB = ipsRegistry::DB();
+
+
+$SQL[] = "ALTER TABLE upgrade_history CHANGE upgrade_notes upgrade_notes TEXT NULL default NULL;";
+
+$SQL[] = "ALTER TABLE members_warn_logs ADD INDEX wl_expire ( wl_expire, wl_expire_date, wl_date );";
+
+/* Do we have an old binary 16 column perhaps? */
+$tableCheck = $DB->getTableSchematic('core_like');
+
+if ( stripos( $tableCheck['Create Table'], 'binary' ) !== FALSE )
+{
+ /* Iz that zo? Thiz iz no good! */
+ $SQL[] = "ALTER TABLE core_like CHANGE like_id like_id VARCHAR(32) NOT NULL DEFAULT '', CHANGE like_lookup_id like_lookup_id VARCHAR(32) NOT NULL DEFAULT '';";
+ $SQL[] = "UPDATE core_like SET like_id=MD5( CONCAT( like_app, ';', like_area, ';', like_rel_id, ';', like_member_id ) ), like_lookup_id=MD5( CONCAT( like_app, ';', like_area, ';', like_rel_id ) );";
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_34000/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_34000/mysql_updates.php
new file mode 100644
index 00000000..9e90901a
--- /dev/null
+++ b/upload/admin/applications/core/setup/versions/upg_34000/mysql_updates.php
@@ -0,0 +1,89 @@
+checkForTable( 'seo_meta' ) )
+{
+ $SQL[] = "CREATE TABLE seo_meta (
+ url varchar(255) NOT NULL DEFAULT '*',
+ name varchar(50) NOT NULL DEFAULT '',
+ content text NOT NULL
+ )";
+}
+
+if( !ipsRegistry::DB()->checkForTable( 'seo_acronyms' ) )
+{
+ $SQL[] = "CREATE TABLE seo_acronyms (
+ a_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+ a_short varchar(255) DEFAULT NULL,
+ a_long varchar(255) DEFAULT NULL,
+ a_semantic tinyint(1) DEFAULT NULL,
+ a_casesensitive tinyint(1) DEFAULT NULL,
+ PRIMARY KEY (a_id),
+ KEY a_short (a_short)
+ )";
+}
+
+//
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_34000/version_class.php b/upload/admin/applications/core/setup/versions/upg_34000/version_class.php
new file mode 100644
index 00000000..60e6fe69
--- /dev/null
+++ b/upload/admin/applications/core/setup/versions/upg_34000/version_class.php
@@ -0,0 +1,82 @@
+
+ * Invision Power Services
+ * IP.Board v3.4.5
+ * Upgrade Class
+ *
+ * Class to add options and notices for IP.Board upgrade
+ * Last Updated: $Date: 2013-01-29 14:15:42 -0500 (Tue, 29 Jan 2013) $
+ *
+ *
+ * @author Matt Mecham
+ * @version $Rev: 11913 $
+ * @since 3.0
+ * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
+ * @license http://www.invisionpower.com/company/standards.php#license
+ * @link http://www.invisionpower.com
+ * @package IP.Board
+ */
+
+class version_class_core_34000
+{
+ /**
+ * Constructor
+ *
+ * @param object $registry Registry object
+ * @return @e 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->cache = $this->registry->cache();
+ $this->caches =& $this->registry->cache()->fetchCaches();
+ }
+
+ /**
+ * Add pre-upgrade options: Form
+ *
+ * @return string HTML block
+ */
+ public function preInstallOptionsForm()
+ {
+ return '';
+ }
+
+ /**
+ * Add pre-upgrade options: Save
+ *
+ * Data will be saved in saved data array as: appOptions[ app ][ versionLong ] = ( key => value );
+ *
+ * @return array Key / value pairs to save
+ */
+ public function preInstallOptionsSave()
+ {
+ return array();
+ }
+
+ /**
+ * Return any post-installation notices
+ *
+ * @return array Array of notices
+ */
+ public function postInstallNotices()
+ {
+ return array();
+ }
+
+ /**
+ * Return any pre-installation notices
+ *
+ * @return array Array of notices
+ */
+ public function preInstallNotices()
+ {
+ return array( "Please note: 3rd party hooks will be temporarily disabled as part of this upgrade process. They can be re-enabled from the admin control panel at ACP > Applications & Modules > Manage Hooks." );
+ }
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_34000/version_upgrade.php b/upload/admin/applications/core/setup/versions/upg_34000/version_upgrade.php
new file mode 100644
index 00000000..728846b3
--- /dev/null
+++ b/upload/admin/applications/core/setup/versions/upg_34000/version_upgrade.php
@@ -0,0 +1,169 @@
+_output;
+ }
+
+ /**
+ * Execute selected method
+ *
+ * @param object Registry object
+ * @return @e void
+ */
+ 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->cache = $this->registry->cache();
+ $this->caches =& $this->registry->cache()->fetchCaches();
+
+ //--------------------------------
+ // What are we doing?
+ //--------------------------------
+
+ switch( $this->request['workact'] )
+ {
+ case 'system_templates':
+ $this->_writeSystemTemplates();
+ break;
+ case 'oldhooks':
+ $this->removeOldHooks();
+ break;
+ case 'seo':
+ default:
+ $this->_convertIPSeo();
+ break;
+ }
+
+ /* Workact is set in the function, so if it has not been set, then we're done. The last function should unset it. */
+ if ( $this->request['workact'] )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ /**
+ * Write system templayes
+ */
+ public function _writeSystemTemplates()
+ {
+ require_once( IPS_ROOT_PATH . 'sources/classes/output/systemTemplates.php' );/*noLibHook*/
+ $systemTemplates = new systemTemplates();
+ $systemTemplates->writeDefaults();
+
+ $this->registry->output->addMessage( "Запись шаблонов системы..." );
+ $this->request['workact'] = '';
+ }
+
+ /**
+ * Convert IP.SEO
+ */
+ public function _convertIPSeo()
+ {
+ if ( IPSLib::appIsInstalled('ipseo') )
+ {
+ if ( $this->settings['seo_index_md'] )
+ {
+ $this->DB->insert( 'seo_meta', array( 'url' => '', 'name' => 'description', 'content' => $this->settings['seo_index_md'] ) );
+ }
+ if ( $this->settings['seo_index_mk'] )
+ {
+ $this->DB->insert( 'seo_meta', array( 'url' => '', 'name' => 'keywords', 'content' => $this->settings['seo_index_mk'] ) );
+ }
+ if ( $this->settings['seo_index_title'] )
+ {
+ $this->DB->insert( 'seo_meta', array( 'url' => '', 'name' => 'title', 'content' => $this->settings['seo_index_title'] ) );
+ }
+ }
+
+ $this->DB->delete( 'core_sys_conf_settings', "conf_key IN( 'seo_index_md', 'seo_index_mk', 'seo_index_title', 'ipseo_ping_services', 'ipseo_guest_skin' )" );
+
+ $this->DB->delete( 'core_sys_settings_titles', "conf_title_keyword='ipseo'" );
+
+ if ( !$this->DB->checkForField( 'ipseo_priority', 'forums' ) )
+ {
+ $this->DB->addField( 'forums', 'ipseo_priority', 'varchar(3)', "''" );
+ }
+
+ $this->DB->delete( 'core_applications', "app_directory='ipseo'" );
+ $this->DB->delete( 'upgrade_history', "upgrade_app='ipseo'" );
+
+ $this->registry->output->addMessage( "Сконвертированы данные IP.SEO..." );
+ $this->request['workact'] = 'oldhooks';
+ }
+
+ /**
+ * Remove old hooks
+ *
+ * @return @e void
+ */
+ public function removeOldHooks()
+ {
+ /* Hooks to remove */
+ $hooks = array( 'ipseo_acronyms', 'ipseo_guest_skin', 'ipseo_meta', 'ipseo_ping_services', 'ipseo_tracking' );
+ $_hookIds = array();
+ $_total = 0;
+
+ /* Get hook records */
+ $this->DB->build( array( 'select' => 'hook_id', 'from' => 'core_hooks', 'where' => "hook_key IN('" . implode( "','", $hooks ) . "')" ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ $_hookIds[] = $r['hook_id'];
+ }
+
+ /* Remove associated files */
+ if( count($_hookIds) )
+ {
+ $this->DB->build( array( 'select' => 'hook_file_stored', 'from' => 'core_hooks_files', 'where' => 'hook_hook_id IN(' . implode( ',', $_hookIds ) . ')' ) );
+ $this->DB->execute();
+
+ while( $r = $this->DB->fetch() )
+ {
+ @unlink( IPS_HOOKS_PATH . $r['hook_file_stored'] );
+ }
+
+ /* Remove hook records */
+ $this->DB->delete( 'core_hooks_files', 'hook_hook_id IN(' . implode( ',', $_hookIds ) . ')' );
+ $this->DB->delete( 'core_hooks', 'hook_id IN(' . implode( ',', $_hookIds ) . ')' );
+
+ $_total++;
+ }
+
+ /* Message */
+ $this->registry->output->addMessage("{$_total} устаревших хуков удалено....");
+
+ /* Next Page */
+ $this->request['workact'] = 'system_templates';
+ }
+
+
+}
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_34005/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_34005/mysql_updates.php
new file mode 100644
index 00000000..75af02e5
--- /dev/null
+++ b/upload/admin/applications/core/setup/versions/upg_34005/mysql_updates.php
@@ -0,0 +1,34 @@
+checkForIndex( 'wl_expire', 'members_warn_logs' ) )
+{
+ $SQL[] = "ALTER TABLE members_warn_logs ADD INDEX wl_expire ( wl_expire, wl_expire_date, wl_date )";
+}
+
+if( !ipsRegistry::DB()->checkForTable( 'search_keywords' ) )
+{
+ $SQL[] = "CREATE TABLE search_keywords (
+ `keyword` varchar(250) NOT NULL,
+ `count` int(11) NOT NULL DEFAULT '0',
+ UNIQUE KEY `idx_keyword_unq` (`keyword`),
+ KEY `idx_kw_cnt` (`keyword`,`count`)
+ )";
+
+}
+
+if( !ipsRegistry::DB()->checkForTable( 'search_visitors' ) )
+{
+ $SQL[] = "CREATE TABLE search_visitors (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `member` int(11),
+ `date` int(11) NOT NULL DEFAULT '0',
+ `engine` varchar(50) NOT NULL,
+ `keywords` varchar(250) NOT NULL,
+ `url` varchar(2048) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `idx_date_engine` (`date`,`engine`)
+ )";
+}
+
+
+//
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_34007/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_34007/mysql_updates.php
new file mode 100644
index 00000000..e5727bd6
--- /dev/null
+++ b/upload/admin/applications/core/setup/versions/upg_34007/mysql_updates.php
@@ -0,0 +1,6 @@
+\' WHERE mediatag_name=\'YouTube\';';
+$SQL[] = 'UPDATE bbcode_mediatag SET mediatag_match=\'http://(www.)?youtu.be/([\\d\\w-_]+?)\', mediatag_replace=\'VIDEO \' WHERE mediatag_name=\'YouTu.be\';';
+
+$SQL[] = "ALTER TABLE members ADD COLUMN ipsconnect_revalidate_url TEXT NULL;";
+
+$SQL[] = "DELETE FROM core_sys_conf_settings WHERE conf_key = 'upload_domain';";
+$SQL[] = "UPDATE core_sys_settings_titles SET conf_title_noshow=0 WHERE conf_title_keyword='iphoneappsettings'";
+$SQL[] = "DELETE FROM task_manager WHERE task_key='mobile_notifications';";
+
+$SQL[] = "ALTER TABLE core_share_links ADD COLUMN share_groups TEXT NULL;";
+$SQL[] = "UPDATE core_share_links SET share_groups='*';";
+
+$SQL[] = "ALTER TABLE profile_portal ADD vc_photo TEXT;";
+
+$SQL[] = "DELETE FROM core_sys_settings_titles WHERE conf_title_keyword='vk';";
+//
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_34009/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_34009/mysql_updates.php
new file mode 100644
index 00000000..7f512f24
--- /dev/null
+++ b/upload/admin/applications/core/setup/versions/upg_34009/mysql_updates.php
@@ -0,0 +1,19 @@
+getPrefix());
+
+$SQL[] = "DELETE FROM core_sys_lang_words WHERE word_pack='public_cookies';";
+$SQL[] = "DELETE FROM core_sys_lang_words WHERE word_app='core' AND word_pack='public_cookie_view';";
+$SQL[] = "DELETE FROM core_sys_lang_words WHERE word_app='forums' AND word_pack='public_cookies';";
+$SQL[] = "DELETE FROM core_sys_lang_words WHERE word_app='forums' AND word_pack='public_printpage';";
+
+$SQL[] = "ALTER TABLE seo_meta CHANGE url url TEXT NULL";
+
+$SQL[] = "UPDATE bbcode_mediatag SET mediatag_replace='VIDEO ' WHERE mediatag_name='YouTube';";
+$SQL[] = "UPDATE bbcode_mediatag SET mediatag_replace='VIDEO ' WHERE mediatag_name='YouTu.be';";
+$SQL[] = "UPDATE bbcode_mediatag SET mediatag_replace='' WHERE mediatag_name='Vimeo';";
+
+# Ensure that members who can use HTML have HTML enabled when viewing and editing signatures
+$SQL[] = "UPDATE members SET members_bitoptions=members_bitoptions | 16384 WHERE member_group_id IN( SELECT g_id FROM `{$PRE}groups` WHERE g_dohtml=1 )";
+
+//
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_34010/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_34010/mysql_updates.php
new file mode 100644
index 00000000..228b6fa9
--- /dev/null
+++ b/upload/admin/applications/core/setup/versions/upg_34010/mysql_updates.php
@@ -0,0 +1,6 @@
+getPrefix());
+
+$SQL[] = "UPDATE custom_bbcode SET bbcode_replace=' ' where bbcode_tag='hr';";
+//
\ No newline at end of file
diff --git a/upload/admin/applications/core/setup/versions/upg_34011/mysql_updates.php b/upload/admin/applications/core/setup/versions/upg_34011/mysql_updates.php
new file mode 100644
index 00000000..30645ebc
--- /dev/null
+++ b/upload/admin/applications/core/setup/versions/upg_34011/mysql_updates.php
@@ -0,0 +1,18 @@
+getPrefix());
+
+$hook = ipsRegistry::DB()->buildAndFetch( array( 'select' => '*', 'from' => 'core_hooks', 'where'=> "hook_key = 'othRandomTopic'" ) );
+
+if( !$hook )
+{
+ $SQL[] = "DELETE FROM core_sys_conf_settings WHERE conf_key IN( 'oth_rand_topics_no_archived_plz', 'oth_rand_topic_fids', 'oth_rand_enabled' );";
+ $SQL[] = "DELETE FROM core_sys_settings_titles WHERE conf_title_keyword='othRandomTopic';";
+}
+
+$SQL[] = "ALTER TABLE forums ADD INDEX ( last_poster_id );";
+$SQL[] = "ALTER TABLE topics ADD INDEX ( last_poster_id );";
+
+$SQL[] = "ALTER TABLE core_hooks CHANGE hook_key hook_key VARCHAR( 128 ) NULL DEFAULT NULL;";
+
+$SQL[] = "ALTER TABLE core_like DROP INDEX like_lookup_area, ADD INDEX like_lookup_area ( like_lookup_area , like_visible , like_added );";
\ No newline at end of file
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 80fded1d..85d1f70b 100644
--- a/upload/admin/applications/core/skin_cp/cp_skin_adminlogs.php
+++ b/upload/admin/applications/core/skin_cp/cp_skin_adminlogs.php
@@ -2,19 +2,19 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* Admin log skin file
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2013-01-03 15:22:09 -0500 (Thu, 03 Jan 2013) $
*
*
- * @author $Author: bfarber $
+ * @author $Author: AndyMillne $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Core
* @link http://www.invisionpower.com
* @since Friday 19th May 2006 17:33
- * @version $Revision: 10914 $
+ * @version $Revision: 11780 $
*/
class cp_skin_adminlogs
@@ -185,7 +185,7 @@ $IPBHTML .= <<{$this->lang->words['sched_error_logs']}
{$this->lang->words['al_error_logs']}
{$this->lang->words['slog_spamlogs']}
- {$this->lang->words['mlog_mobilelogs']}
+
HTML;
if ( $this->registry->class_permissions->checkPermission( 'sqlerrorlogs_view' ) )
{
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 81eac510..ddda5600 100644
--- a/upload/admin/applications/core/skin_cp/cp_skin_api.php
+++ b/upload/admin/applications/core/skin_cp/cp_skin_api.php
@@ -2,9 +2,9 @@
/**
*
* Invision Power Services
- * IP.Board v3.3.4
+ * IP.Board v3.4.5
* API users skin file
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
+ * Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
*
*
* @author $Author: bfarber $
@@ -14,7 +14,7 @@
* @subpackage Core
* @link http://www.invisionpower.com
* @since Friday 19th May 2006 17:33
- * @version $Revision: 10914 $
+ * @version $Revision: 10721 $
*/
class cp_skin_api
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 11cf24fe..d5c73770 100644
--- a/upload/admin/applications/core/skin_cp/cp_skin_applications.php
+++ b/upload/admin/applications/core/skin_cp/cp_skin_applications.php
@@ -1,2889 +1,3269 @@
-
- * Invision Power Services
- * IP.Board v3.3.4
- * Applications skin file
- * Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
- *
- *
- * @author $Author: bfarber $
- * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- * @license http://www.invisionpower.com/company/standards.php#license
- * @package IP.Board
- * @subpackage Core
- * @link http://www.invisionpower.com
- * @since Friday 19th May 2006 17:33
- * @version $Revision: 10914 $
- */
-
-class cp_skin_applications
-{
- /**
- * Registry Object Shortcuts
- *
- * @var $registry
- * @var $DB
- * @var $settings
- * @var $request
- * @var $lang
- * @var $member
- * @var $memberData
- * @var $cache
- * @var $caches
- */
- protected $registry;
- protected $DB;
- protected $settings;
- protected $request;
- protected $lang;
- protected $member;
- protected $memberData;
- protected $cache;
- protected $caches;
-
- /**
- * Constructor
- *
- * @param object $registry Registry object
- * @return @e void
- */
- public function __construct( ipsRegistry $registry )
- {
- $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();
- $this->lang = $this->registry->class_localization;
- }
-/**
- * Add/edit module form
- *
- * @param array Form elements
- * @param string Form title
- * @param string Action code
- * @param string Button text
- * @param array Module information
- * @param array Application information
- * @return string HTML
- */
-public function module_form( $form, $title, $formcode, $button, $module, $application ) {
-
-$IPBHTML = "";
-//--starthtml--//
-
-$title = $formcode == 'module_edit_do' ? $this->lang->words['module_form_edit_title'] : $this->lang->words['module_form_add_title'];
-
-$IPBHTML .= <<
- {$title}
-
-
-