Version 3.4.5
This commit is contained in:
1 parent
fb6b5baabc
commit
e4478369d8
1360 files changed
+228921
-179445
No files matched your search
@@ -0,0 +1,295 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Admin Bookmarks Model
|
||||
* Last Updated: $Date: 2012-05-10 21:10:13 +0100 (Thu, 10 May 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @copyright (c) 2001 - 2012 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since Tue. 7th August 2012
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Bookmarks model
|
||||
* @author matt
|
||||
*
|
||||
*/
|
||||
class classes_admin_bookmarks
|
||||
{
|
||||
private $Member = array();
|
||||
private $Bookmarks = array();
|
||||
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
/* Make objects */
|
||||
$this->registry = ipsRegistry::instance();
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->lang = $this->registry->getClass('class_localization');
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
|
||||
if ( $this->memberData['member_id'] )
|
||||
{
|
||||
$this->setMember( $this->memberData );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a member for the scope of this class
|
||||
* @param mixed
|
||||
*/
|
||||
public function setMember( $member )
|
||||
{
|
||||
if ( is_numeric( $member ) )
|
||||
{
|
||||
$this->Member = IPSMember::load( $member );
|
||||
}
|
||||
else if ( is_array( $member ) && ! empty( $member['member_id'] ) )
|
||||
{
|
||||
$this->Member = $member;
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error("Member data incorrect", E_USER_ERROR);
|
||||
}
|
||||
|
||||
/* Load bookmarks */
|
||||
$bookmarks = array();
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'core_sys_bookmarks',
|
||||
'where' => 'bookmark_member_id=' . intval( $this->Member['member_id'] ),
|
||||
'order' => 'bookmark_pos ASC' ) );
|
||||
$b = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $b ) )
|
||||
{
|
||||
$bookmarks[$row['bookmark_id']] = $row;
|
||||
}
|
||||
|
||||
$this->Bookmarks = $bookmarks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the home URL
|
||||
*/
|
||||
public function getHomeUrl()
|
||||
{
|
||||
$url = false;
|
||||
|
||||
if ( is_array( $this->Bookmarks ) && count( $this->Bookmarks ) )
|
||||
{
|
||||
foreach( $this->Bookmarks as $id => $data )
|
||||
{
|
||||
if ( $data['bookmark_home'] )
|
||||
{
|
||||
$url = $data['bookmark_url'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the bookmark
|
||||
* @param int Id
|
||||
* @param array array( title, position )
|
||||
*/
|
||||
public function update( $id, $data=array() )
|
||||
{
|
||||
if ( $id && count( $data ) )
|
||||
{
|
||||
$save = array();
|
||||
|
||||
if ( ! empty( $data['title'] ) )
|
||||
{
|
||||
$save['bookmark_title'] = $this->DB->addSlashes( $data['title'] );
|
||||
}
|
||||
|
||||
if ( isset( $data['position'] ) )
|
||||
{
|
||||
$save['bookmark_pos'] = intval( $data['position'] );
|
||||
}
|
||||
|
||||
$this->DB->update( 'core_sys_bookmarks', $save, 'bookmark_id=' . intval( $id ) . ' AND bookmark_member_id=' . $this->Member['member_id'] );
|
||||
}
|
||||
|
||||
$this->setMember( $this->Member );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bookmarks
|
||||
* @param int
|
||||
*/
|
||||
public function getBookmarks()
|
||||
{
|
||||
return $this->Bookmarks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a bookmark
|
||||
* @param int bookmark id
|
||||
*/
|
||||
public function removeBookmark( $id )
|
||||
{
|
||||
$this->DB->delete( 'core_sys_bookmarks', 'bookmark_member_id=' . $this->Member['member_id'] . ' AND bookmark_id=' . intval( $id ) );
|
||||
|
||||
/* Reset stored markers */
|
||||
$this->setMember( $this->Member );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a bookmark
|
||||
* @param int memberId
|
||||
* @param string URL
|
||||
* @param string Title
|
||||
* @param boolean asHome
|
||||
*/
|
||||
public function addBookmark( $url, $title, $asHome=false )
|
||||
{
|
||||
$url = $this->cleanUrl( $url );
|
||||
|
||||
if ( ! $url || ! $title )
|
||||
{
|
||||
throw new Exception("Data missing");
|
||||
}
|
||||
|
||||
/* Already stored? */
|
||||
if ( $this->hasBookmarked( $url ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->DB->insert( 'core_sys_bookmarks', array( 'bookmark_member_id' => $this->Member['member_id'],
|
||||
'bookmark_title' => $title,
|
||||
'bookmark_url' => $url,
|
||||
'bookmark_home' => $asHome,
|
||||
'bookmark_pos' => count( $this->Bookmarks ) ) );
|
||||
|
||||
$insertId = $this->DB->getInsertId();
|
||||
|
||||
if ( $asHome )
|
||||
{
|
||||
$this->setAsHome( $insertId );
|
||||
}
|
||||
|
||||
/* Reset stored markers */
|
||||
$this->setMember( $this->Member );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an ID as home
|
||||
* @param int $id
|
||||
*/
|
||||
public function setAsHome( $id )
|
||||
{
|
||||
$this->DB->update( 'core_sys_bookmarks', array( 'bookmark_home' => 0 ), 'bookmark_member_id=' . $this->Member['member_id'] );
|
||||
|
||||
if ( ! empty( $id ) )
|
||||
{
|
||||
$this->DB->update( 'core_sys_bookmarks', array( 'bookmark_home' => 1 ), 'bookmark_member_id=' . $this->Member['member_id'] . ' AND bookmark_id=' . intval( $id ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to see if the URL has already been bookmarked
|
||||
* @param string $url
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasBookmarked( $url )
|
||||
{
|
||||
$url = $this->cleanUrl( $url );
|
||||
|
||||
if ( is_array( $this->Bookmarks ) && count( $this->Bookmarks ) )
|
||||
{
|
||||
foreach( $this->Bookmarks as $id => $data )
|
||||
{
|
||||
if ( $data['bookmark_url'] == $url )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return bookmarks as Bob, er, I mean, Json.
|
||||
*/
|
||||
public function asJson()
|
||||
{
|
||||
$bob = array();
|
||||
|
||||
if ( is_array( $this->Bookmarks ) && count( $this->Bookmarks ) )
|
||||
{
|
||||
foreach( $this->Bookmarks as $id => $data )
|
||||
{
|
||||
$bob[ $id ] = array( 'url' => $data['bookmark_url'],
|
||||
'title' => $data['bookmark_title'],
|
||||
'home' => $data['bookmark_home'] );
|
||||
}
|
||||
}
|
||||
|
||||
return json_encode( $bob );
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up the URL, remove encoded &s, missing key=value pairs, etc
|
||||
* @param string
|
||||
* @return string
|
||||
*/
|
||||
public function cleanUrl( $url )
|
||||
{
|
||||
if ( strstr( $url, 'adsess=' ) )
|
||||
{
|
||||
preg_match( '#^(?:.+?)?adsess=(?:[\d\w]{32})(?:&|&)(.*)$#', $url, $matches );
|
||||
|
||||
if ( $matches[1] )
|
||||
{
|
||||
$url = $matches[1];
|
||||
}
|
||||
}
|
||||
|
||||
$url = str_replace( '&', '&', $url );
|
||||
|
||||
parse_str( $url, $array );
|
||||
|
||||
if ( ! count( $array ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Remove empty elements */
|
||||
foreach( $array as $k => $v )
|
||||
{
|
||||
if ( ! is_array( $v ) && ! strlen( $v ) )
|
||||
{
|
||||
unset( $array[ $k ] );
|
||||
}
|
||||
}
|
||||
|
||||
return http_build_query( $array );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Advertisements
|
||||
* </pre>
|
||||
*
|
||||
@@ -12,7 +12,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 17th February 2010
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*/
|
||||
|
||||
class IPSAdCode extends IPSAdCodeDefault
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Archive: Reader
|
||||
* By Matt Mecham
|
||||
* </pre>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Archive: Writer
|
||||
* By Matt Mecham
|
||||
* </pre>
|
||||
@@ -104,6 +104,7 @@ class classes_archive_reader_sql extends classes_archive_reader
|
||||
* forumId Get posts matching the (array) forum ids, (int) forum ID
|
||||
* notForumId Get posts NOT matching the (array) forum ids, (int) forum ID
|
||||
* postId Get posts matching the (array) post ids, (int) post id
|
||||
* postDate Get posts matching the (array) post dates, (int) post date
|
||||
* memberData Set memberData (this->memberData is used otherwise)
|
||||
* onlyViewable Set whether this member can view them or not. (default is true ) NOTE: Will not check to see if parent topic is viewable!
|
||||
* onlyVisible Set whether to skip unapproved posts where permission allows (default is true)
|
||||
@@ -134,7 +135,14 @@ class classes_archive_reader_sql extends classes_archive_reader
|
||||
$filters['postId'] = ( ! is_array( $filters['postId'] ) ) ? array( $filters['postId'] ) : $filters['postId'];
|
||||
$where[] = "p.archive_id IN (" . implode( ',',$filters['postId'] ) . ")";
|
||||
}
|
||||
|
||||
|
||||
/* Posts */
|
||||
if ( ! empty( $filters['postDate'] ) )
|
||||
{
|
||||
$filters['postDate'] = ( ! is_array( $filters['postDate'] ) ) ? array( $filters['postDate'] ) : $filters['postDate'];
|
||||
$where[] = "p.archive_content_date IN (" . implode( ',',$filters['postDate'] ) . ")";
|
||||
}
|
||||
|
||||
/* Topics */
|
||||
if ( ! empty( $filters['topicId'] ) )
|
||||
{
|
||||
|
||||
@@ -1,416 +1,442 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* Archive: Reader
|
||||
* By Matt Mecham
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @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 18th November 2011
|
||||
* @version $Revision: 8644 $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Restores topics that are either manually flagged or via settings
|
||||
* from the Admin CP.
|
||||
*
|
||||
* Manually flagged topics are always restored first.
|
||||
* @author matt
|
||||
*
|
||||
*/
|
||||
class classes_archive_restore
|
||||
{
|
||||
/**#@+
|
||||
* Registry objects
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $registry;
|
||||
protected $DB;
|
||||
protected $settings;
|
||||
protected $request;
|
||||
protected $lang;
|
||||
protected $member;
|
||||
protected $memberData;
|
||||
protected $cache;
|
||||
protected $caches;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Set current app
|
||||
*/
|
||||
private $_app = '';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
/* Make registry objects */
|
||||
$this->registry = ipsRegistry::instance();
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->lang = $this->registry->getClass('class_localization');
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
|
||||
/* Check for class_forums */
|
||||
if ( ipsRegistry::isClassLoaded('class_forums') !== TRUE )
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums' );
|
||||
$this->registry->setClass( 'class_forums', new $classToLoad( $this->registry ) );
|
||||
$this->registry->class_forums->forumsInit();
|
||||
}
|
||||
|
||||
/* Language class */
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_global' ), 'core' );
|
||||
|
||||
/* Fetch engine class */
|
||||
$this->settings['archive_engine'] = ( $this->settings['archive_engine'] ) ? $this->settings['archive_engine'] : 'sql';
|
||||
|
||||
/* Load up archive class */
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/archive/restore/' . $this->settings['archive_engine'] . '.php', 'classes_archive_restore_' . $this->settings['archive_engine'] );
|
||||
$this->engine = new $classToLoad();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current application
|
||||
* @param string $app
|
||||
*/
|
||||
public function setApp( $app )
|
||||
{
|
||||
$this->_app = $app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the application
|
||||
* @return string
|
||||
*/
|
||||
public function getApp()
|
||||
{
|
||||
return $this->_app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore posts to the topic
|
||||
* @param array INTS
|
||||
*/
|
||||
public function restore( $pids=array() )
|
||||
{
|
||||
if ( ! count( $pids ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$topics = array();
|
||||
$forumIds = array();
|
||||
$completedTopics = array();
|
||||
$workingTopics = array();
|
||||
$maxes = array();
|
||||
|
||||
/* Load the attachments stuff */
|
||||
$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->init();
|
||||
|
||||
/* Load the attachments stuff */
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/topics.php', 'app_forums_classes_topics' );
|
||||
$topicClass = new $classToLoad( $this->registry );
|
||||
|
||||
/* Fetch data based on PIDs */
|
||||
$posts = $topicClass->getPosts( array( 'postId' => $pids,
|
||||
'sortField' => 'pid',
|
||||
'sortOrder' => 'asc',
|
||||
'isArchivedTopic' => true ) );
|
||||
|
||||
foreach( $posts as $pid => $post )
|
||||
{
|
||||
/* Write it */
|
||||
$this->engine->set( $post );
|
||||
|
||||
/* Collect some data */
|
||||
if ( ! in_array( $post['tid'], $topics ) )
|
||||
{
|
||||
$post['_pids'] = 1;
|
||||
$post['_lowPid'] = $post['archive_id'];
|
||||
$post['_maxPid'] = $post['archive_id'];
|
||||
$post['_topicCount'] = ( intval( $post['posts'] ) + intval( $post['topic_deleted_posts'] ) + intval( $post['topic_queuedposts'] ) + 1 );
|
||||
$topics[ $post['tid'] ] = $post;
|
||||
}
|
||||
else
|
||||
{
|
||||
$topics[ $post['tid'] ]['_maxPid'] = $post['archive_id'];
|
||||
$topics[ $post['tid'] ]['_pids']++;
|
||||
}
|
||||
|
||||
/* Collect fids */
|
||||
$forums[ $post['forum_id'] ] = $post['forum_id'];
|
||||
}
|
||||
|
||||
/* Get the maxes */
|
||||
$this->DB->build( array( 'select' => 'topic_id, MAX(pid) as i',
|
||||
'from' => 'posts',
|
||||
'where' => 'topic_id IN (' . implode( ',', array_keys( $topics ) ) . ')',
|
||||
'group' => 'topic_id' ) );
|
||||
|
||||
$o = $this->DB->execute();
|
||||
|
||||
while( $t = $this->DB->fetch( $o ) )
|
||||
{
|
||||
$maxes[ $t['topic_id'] ] = intval( $t['i'] );
|
||||
}
|
||||
|
||||
/* Figure out how many topics have been completed */
|
||||
foreach( $topics as $tid => $data )
|
||||
{
|
||||
/* First pid matches topic first pid, so we have the first post in the topic
|
||||
* but have we got all the posts in this topic?
|
||||
*/
|
||||
if ( $maxes[ $tid ] == $data['_maxPid'] )
|
||||
{
|
||||
$completedTopics[] = $data['tid'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$workingTopics[] = $data['tid'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Update completed */
|
||||
if ( count( $completedTopics ) )
|
||||
{
|
||||
$this->DB->update( 'topics', array( 'topic_archive_status' => $this->registry->class_forums->fetchTopicArchiveFlag( 'exclude' ) ), 'tid IN(' . implode( ',', $completedTopics ) . ')' );
|
||||
|
||||
/* Archive attachments */
|
||||
$class_attach->bulkUnarchive( $completedTopics, 'attach_parent_id' );
|
||||
|
||||
/* Remove posts */
|
||||
$this->engine->removePostsByTids( $completedTopics );
|
||||
}
|
||||
|
||||
/* Flag as archived */
|
||||
$this->engine->setAsRestoredByPids( $pids );
|
||||
|
||||
/* Do forums */
|
||||
foreach( $forums as $id )
|
||||
{
|
||||
$this->registry->class_forums->forumRebuild( $id );
|
||||
}
|
||||
|
||||
/* Log it */
|
||||
$this->log( $pids, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a batch. Genius.
|
||||
* $options is an array of keys and values:
|
||||
* process - INT - number of items to process in this batch
|
||||
* @return int count of topics archived
|
||||
*/
|
||||
public function processBatch( $options=array() )
|
||||
{
|
||||
$restoreData = $this->getRestoreData();
|
||||
$topics = array();
|
||||
$forums = array();
|
||||
$pids = array();
|
||||
|
||||
/* Fix up options */
|
||||
$options['process'] = ( is_numeric( $options['process'] ) && $options['process'] > 0 ) ? $options['process'] : 250;
|
||||
|
||||
if ( ! $restoreData['restore_min_tid'] && ! $restoreData['restore_max_tid'] && ! count( $restoreData['restore_manual_tids'] ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Any manually flagged? */
|
||||
if ( count( $restoreData['restore_manual_tids'] ) )
|
||||
{
|
||||
/* Select remaining Pids */
|
||||
$pids = $this->engine->getPidsInTids( IPSLib::cleanIntArray( array_keys( $restoreData['restore_manual_tids'] ) ), $options['process'] );
|
||||
|
||||
/* Did we complete topics? */
|
||||
foreach( $restoreData['restore_manual_tids'] as $tid => $maxPid )
|
||||
{
|
||||
if ( in_array( $maxPid, array_keys( $pids ) ) )
|
||||
{
|
||||
$this->deleteManualId( $tid );
|
||||
}
|
||||
}
|
||||
|
||||
/* All done? */
|
||||
if ( ! count( $pids ) )
|
||||
{
|
||||
$restoreData['restore_manual_tids'] = array();
|
||||
|
||||
$this->setRestoreData( $restoreData );
|
||||
}
|
||||
|
||||
/* Update process for below */
|
||||
$options['process'] -= count( $pids );
|
||||
}
|
||||
|
||||
/* Now fetch the max/min if archiver is on */
|
||||
if ( $this->settings['archive_on'] && $options['process'] > 0 && $restoreData['restore_min_tid'] && $restoreData['restore_max_tid'] )
|
||||
{
|
||||
$date = IPS_UNIX_TIME_NOW - ( 86400 * intval( $this->settings['archive_restore_days'] ) );
|
||||
|
||||
$pids = $this->engine->getPidsBetweenTidsAndDate( $restoreData['restore_min_tid'], $restoreData['restore_max_tid'], $date, $options['process'] );
|
||||
|
||||
/* All done? */
|
||||
if ( ! count( $pids ) )
|
||||
{
|
||||
$restoreData['restore_min_tid'] = 0;
|
||||
$restoreData['restore_max_tid'] = 0;
|
||||
|
||||
$this->setRestoreData( $restoreData );
|
||||
}
|
||||
}
|
||||
|
||||
/* Process */
|
||||
$this->restore( $pids );
|
||||
|
||||
return count( $pids );
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag an item for manual unarchive
|
||||
* @param int $id
|
||||
*/
|
||||
public function setManualUnarchive( $id )
|
||||
{
|
||||
/* Init */
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . "/sources/classes/topics.php", 'app_forums_classes_topics', 'forums' );
|
||||
$topicClass = new $classToLoad( $this->registry );
|
||||
|
||||
$topic = $topicClass->getTopicById( $id );
|
||||
|
||||
if ( $topic['tid'] && $this->registry->class_forums->fetchArchiveTopicType( $topic ) == 'archived' )
|
||||
{
|
||||
$topicClass->updateTopic( $topic['tid'], array( 'topic_archive_status' => $this->registry->class_forums->fetchTopicArchiveFlag('restore') ) );
|
||||
|
||||
$this->insertManualId( $id );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an ID to the manual restore filter
|
||||
*/
|
||||
public function insertManualId( $id )
|
||||
{
|
||||
$data = $this->getRestoreData();
|
||||
$max = $this->engine->getMaxPidInTid( $id );
|
||||
|
||||
$data['restore_manual_tids'][ $id ] = $max;
|
||||
|
||||
$this->setRestoreData( $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an ID from the manual restore filter
|
||||
*/
|
||||
public function deleteManualId( $id )
|
||||
{
|
||||
$data = $this->getRestoreData();
|
||||
|
||||
if ( in_array( $id, array_keys( $data['restore_manual_tids'] ) ) )
|
||||
{
|
||||
unset( $data['restore_manual_tids'][ $id ] );
|
||||
|
||||
$this->setRestoreData( $data );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get restore data
|
||||
*/
|
||||
public function getRestoreData()
|
||||
{
|
||||
$data = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'core_archive_restore' ) );
|
||||
|
||||
if ( IPSLib::isSerialized( $data['restore_manual_tids'] ) )
|
||||
{
|
||||
$data['restore_manual_tids'] = unserialize( $data['restore_manual_tids'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['restore_manual_tids'] = array();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set restore data
|
||||
* @param array
|
||||
*/
|
||||
public function setRestoreData( $data )
|
||||
{
|
||||
if ( is_array( $data['restore_manual_tids'] ) )
|
||||
{
|
||||
$data['restore_manual_tids'] = serialize( $data['restore_manual_tids'] );
|
||||
}
|
||||
|
||||
$data['restore_min_tid'] = intval( $data['restore_min_tid'] );
|
||||
$data['restore_max_tid'] = intval( $data['restore_max_tid'] );
|
||||
|
||||
$this->DB->delete( 'core_archive_restore');
|
||||
$this->DB->insert( 'core_archive_restore', $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Take an archive row and returned native friendly array
|
||||
* @param array $post
|
||||
* @return array
|
||||
*/
|
||||
public function archiveToNativeFields( $post )
|
||||
{
|
||||
$native = array( 'pid' => intval( $post['archive_id'] ),
|
||||
'author_id' => intval( $post['archive_author_id'] ),
|
||||
'author_name' => $post['archive_author_name'],
|
||||
'ip_address' => $post['archive_ip_address'],
|
||||
'post_date' => intval( $post['archive_content_date'] ),
|
||||
'post' => $post['archive_content'],
|
||||
'queued' => $post['archive_queued'],
|
||||
'topic_id' => intval( $post['archive_topic_id'] ),
|
||||
'new_topic' => intval( $post['archive_is_first'] ),
|
||||
'post_bwoptions' => $post['archive_bwoptions'],
|
||||
'post_key' => $post['archive_attach_key'],
|
||||
'post_htmlstate' => $post['archive_html_mode'],
|
||||
'use_sig' => $post['archive_show_signature'],
|
||||
'use_emo' => $post['archive_show_emoticons'],
|
||||
'append_edit' => $post['archive_show_edited_by'],
|
||||
'edit_time' => $post['archive_edit_time'],
|
||||
'edit_name' => $post['archive_edit_name'],
|
||||
'post_edit_reason' => $post['archive_edit_reason'] );
|
||||
|
||||
return $native;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs archive action
|
||||
* @param array $ids
|
||||
*/
|
||||
public function log( $ids )
|
||||
{
|
||||
$this->DB->insert( 'core_archive_log', array( 'archlog_date' => IPS_UNIX_TIME_NOW,
|
||||
'archlog_app' => $this->getApp(),
|
||||
'archlog_ids' => serialize( $ids ),
|
||||
'archlog_is_restore' => 1,
|
||||
'archlog_count' => count( $ids ) ) );
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Archive: Reader
|
||||
* By Matt Mecham
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @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 18th November 2011
|
||||
* @version $Revision: 8644 $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Restores topics that are either manually flagged or via settings
|
||||
* from the Admin CP.
|
||||
*
|
||||
* Manually flagged topics are always restored first.
|
||||
* @author matt
|
||||
*
|
||||
*/
|
||||
class classes_archive_restore
|
||||
{
|
||||
/**#@+
|
||||
* Registry objects
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $registry;
|
||||
protected $DB;
|
||||
protected $settings;
|
||||
protected $request;
|
||||
protected $lang;
|
||||
protected $member;
|
||||
protected $memberData;
|
||||
protected $cache;
|
||||
protected $caches;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Set current app
|
||||
*/
|
||||
private $_app = '';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
/* Make registry objects */
|
||||
$this->registry = ipsRegistry::instance();
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->lang = $this->registry->getClass('class_localization');
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
|
||||
/* Check for class_forums */
|
||||
if ( ipsRegistry::isClassLoaded('class_forums') !== TRUE )
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums' );
|
||||
$this->registry->setClass( 'class_forums', new $classToLoad( $this->registry ) );
|
||||
$this->registry->class_forums->forumsInit();
|
||||
}
|
||||
|
||||
/* Language class */
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_global' ), 'core' );
|
||||
|
||||
/* Fetch engine class */
|
||||
$this->settings['archive_engine'] = ( $this->settings['archive_engine'] ) ? $this->settings['archive_engine'] : 'sql';
|
||||
|
||||
/* Load up archive class */
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/archive/restore/' . $this->settings['archive_engine'] . '.php', 'classes_archive_restore_' . $this->settings['archive_engine'] );
|
||||
$this->engine = new $classToLoad();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current application
|
||||
* @param string $app
|
||||
*/
|
||||
public function setApp( $app )
|
||||
{
|
||||
$this->_app = $app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the application
|
||||
* @return string
|
||||
*/
|
||||
public function getApp()
|
||||
{
|
||||
return $this->_app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore posts to the topic
|
||||
* @param array INTS
|
||||
*/
|
||||
public function restore( $pids=array() )
|
||||
{
|
||||
if ( ! count( $pids ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$topics = array();
|
||||
$forumIds = array();
|
||||
$completedTopics = array();
|
||||
$workingTopics = array();
|
||||
$maxes = array();
|
||||
|
||||
/* Load the attachments stuff */
|
||||
$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->init();
|
||||
|
||||
/* Load the attachments stuff */
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/topics.php', 'app_forums_classes_topics' );
|
||||
$topicClass = new $classToLoad( $this->registry );
|
||||
|
||||
/* Fetch data based on PIDs */
|
||||
$posts = $topicClass->getPosts( array( 'postId' => $pids,
|
||||
'sortField' => 'pid',
|
||||
'sortOrder' => 'asc',
|
||||
'isArchivedTopic' => true ,
|
||||
'skipForumCheck' => true,
|
||||
'postType' => array('sdelete', 'visible', 'hidden', 'pdeleted')
|
||||
|
||||
) );
|
||||
foreach( $posts as $pid => $post )
|
||||
{
|
||||
/* Write it */
|
||||
$this->engine->set( $post );
|
||||
|
||||
/* Collect some data */
|
||||
if ( ! in_array( $post['tid'], $topics ) )
|
||||
{
|
||||
$post['_pids'] = 1;
|
||||
$post['_lowPid'] = $post['archive_id'];
|
||||
$post['_maxPid'] = $post['archive_id'];
|
||||
$post['_topicCount'] = ( intval( $post['posts'] ) + intval( $post['topic_deleted_posts'] ) + intval( $post['topic_queuedposts'] ) + 1 );
|
||||
$topics[ $post['tid'] ] = $post;
|
||||
}
|
||||
else
|
||||
{
|
||||
$topics[ $post['tid'] ]['_maxPid'] = $post['archive_id'];
|
||||
$topics[ $post['tid'] ]['_pids']++;
|
||||
}
|
||||
|
||||
/* Collect fids */
|
||||
$forums[ $post['forum_id'] ] = $post['forum_id'];
|
||||
}
|
||||
|
||||
/* Get the maxes */
|
||||
/* junk!!!
|
||||
$this->DB->build( array( 'select' => 'topic_id, MAX(pid) as i',
|
||||
'from' => 'posts',
|
||||
'where' => 'topic_id IN (' . implode( ',', array_keys( $topics ) ) . ')',
|
||||
'group' => 'topic_id' ) );
|
||||
|
||||
$o = $this->DB->execute();
|
||||
|
||||
while( $t = $this->DB->fetch( $o ) )
|
||||
{
|
||||
$maxes[ $t['topic_id'] ] = intval( $t['i'] );
|
||||
}
|
||||
*/
|
||||
foreach( array_keys( $topics ) as $t )
|
||||
{
|
||||
$maxes[ $t ] = intval( $this->engine->getMaxPidInTid( $t ) );
|
||||
}
|
||||
/* Figure out how many topics have been completed */
|
||||
foreach( $topics as $tid => $data )
|
||||
{
|
||||
/* First pid matches topic first pid, so we have the first post in the topic
|
||||
* but have we got all the posts in this topic?
|
||||
*/
|
||||
if ( $maxes[ $tid ] == $data['_maxPid'] )
|
||||
{
|
||||
$completedTopics[] = $data['tid'];
|
||||
}
|
||||
else if ( $maxes[ $tid ] > $data['_maxPid'] )
|
||||
{
|
||||
/* If this is true, the local post table has a higher PID than the archive table
|
||||
and this should never happen, so lets investigate */
|
||||
$_topic = $this->DB->buildAndFetch( array( 'select' => 'posts', 'from' => 'topics', 'where' => 'tid=' . intval( $tid ) ) );
|
||||
$_post = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count', 'from' => 'posts', 'where' => 'topic_id=' . intval( $tid ) ) );
|
||||
|
||||
/* Local database has all the data.. so lets call it done */
|
||||
if ( ( $_topic['posts'] + 1 ) == $_post['count'] )
|
||||
{
|
||||
$completedTopics[] = $data['tid'];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Be cautious */
|
||||
$workingTopics[] = $data['tid'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$workingTopics[] = $data['tid'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Update completed */
|
||||
if ( count( $completedTopics ) )
|
||||
{
|
||||
$this->DB->update( 'topics', array( 'topic_archive_status' => $this->registry->class_forums->fetchTopicArchiveFlag( 'exclude' ) ), 'tid IN(' . implode( ',', $completedTopics ) . ')' );
|
||||
|
||||
/* Archive attachments */
|
||||
$class_attach->bulkUnarchive( $completedTopics, 'attach_parent_id' );
|
||||
|
||||
/* Remove posts */
|
||||
$this->engine->removePostsByTids( $completedTopics );
|
||||
}
|
||||
|
||||
/* Flag as archived */
|
||||
$this->engine->setAsRestoredByPids( array_keys ( $posts ) );
|
||||
|
||||
/* Do forums */
|
||||
foreach( $forums as $id )
|
||||
{
|
||||
$this->registry->class_forums->forumRebuild( $id );
|
||||
}
|
||||
|
||||
/* Log it */
|
||||
$this->log( array_keys ( $posts ), true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a batch. Genius.
|
||||
* $options is an array of keys and values:
|
||||
* process - INT - number of items to process in this batch
|
||||
* @return int count of topics archived
|
||||
*/
|
||||
public function processBatch( $options=array() )
|
||||
{
|
||||
$restoreData = $this->getRestoreData();
|
||||
$topics = array();
|
||||
$forums = array();
|
||||
$pids = array();
|
||||
|
||||
/* Fix up options */
|
||||
$options['process'] = ( is_numeric( $options['process'] ) && $options['process'] > 0 ) ? $options['process'] : 250;
|
||||
|
||||
if ( ! $restoreData['restore_min_tid'] && ! $restoreData['restore_max_tid'] && ! count( $restoreData['restore_manual_tids'] ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Any manually flagged? */
|
||||
if ( count( $restoreData['restore_manual_tids'] ) )
|
||||
{
|
||||
/* Select remaining Pids */
|
||||
$pids = $this->engine->getPidsInTids( IPSLib::cleanIntArray( array_keys( $restoreData['restore_manual_tids'] ) ), $options['process'] );
|
||||
|
||||
/* Did we complete topics? */
|
||||
foreach( $restoreData['restore_manual_tids'] as $tid => $maxPid )
|
||||
{
|
||||
if ( in_array( $maxPid, array_keys( $pids ) ) )
|
||||
{
|
||||
$this->deleteManualId( $tid );
|
||||
}
|
||||
}
|
||||
|
||||
/* All done? */
|
||||
if ( ! count( $pids ) )
|
||||
{
|
||||
$restoreData['restore_manual_tids'] = array();
|
||||
|
||||
$this->setRestoreData( $restoreData );
|
||||
}
|
||||
|
||||
/* Update process for below */
|
||||
$options['process'] -= count( $pids );
|
||||
}
|
||||
|
||||
/* Now fetch the max/min if archiver is on */
|
||||
if ( $this->settings['archive_on'] && $options['process'] > 0 && $restoreData['restore_min_tid'] && $restoreData['restore_max_tid'] )
|
||||
{
|
||||
$date = IPS_UNIX_TIME_NOW - ( 86400 * intval( $this->settings['archive_restore_days'] ) );
|
||||
|
||||
$pids = $this->engine->getPidsBetweenTidsAndDate( $restoreData['restore_min_tid'], $restoreData['restore_max_tid'], $date, $options['process'] );
|
||||
|
||||
/* All done? */
|
||||
if ( ! count( $pids ) )
|
||||
{
|
||||
$restoreData['restore_min_tid'] = 0;
|
||||
$restoreData['restore_max_tid'] = 0;
|
||||
|
||||
$this->setRestoreData( $restoreData );
|
||||
}
|
||||
}
|
||||
|
||||
/* Process */
|
||||
$this->restore( $pids );
|
||||
|
||||
return count( $pids );
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag an item for manual unarchive
|
||||
* @param int $id
|
||||
*/
|
||||
public function setManualUnarchive( $id )
|
||||
{
|
||||
/* Init */
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . "/sources/classes/topics.php", 'app_forums_classes_topics', 'forums' );
|
||||
$topicClass = new $classToLoad( $this->registry );
|
||||
|
||||
$topic = $topicClass->getTopicById( $id );
|
||||
|
||||
if ( $topic['tid'] && $this->registry->class_forums->fetchArchiveTopicType( $topic ) == 'archived' )
|
||||
{
|
||||
$topicClass->updateTopic( $topic['tid'], array( 'topic_archive_status' => $this->registry->class_forums->fetchTopicArchiveFlag('restore') ) );
|
||||
|
||||
$this->insertManualId( $id );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an ID to the manual restore filter
|
||||
*/
|
||||
public function insertManualId( $id )
|
||||
{
|
||||
$data = $this->getRestoreData();
|
||||
$max = $this->engine->getMaxPidInTid( $id );
|
||||
|
||||
$data['restore_manual_tids'][ $id ] = $max;
|
||||
|
||||
$this->setRestoreData( $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an ID from the manual restore filter
|
||||
*/
|
||||
public function deleteManualId( $id )
|
||||
{
|
||||
$data = $this->getRestoreData();
|
||||
|
||||
if ( in_array( $id, array_keys( $data['restore_manual_tids'] ) ) )
|
||||
{
|
||||
unset( $data['restore_manual_tids'][ $id ] );
|
||||
|
||||
$this->setRestoreData( $data );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get restore data
|
||||
*/
|
||||
public function getRestoreData()
|
||||
{
|
||||
$data = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'core_archive_restore' ) );
|
||||
|
||||
if ( IPSLib::isSerialized( $data['restore_manual_tids'] ) )
|
||||
{
|
||||
$data['restore_manual_tids'] = unserialize( $data['restore_manual_tids'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['restore_manual_tids'] = array();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set restore data
|
||||
* @param array
|
||||
*/
|
||||
public function setRestoreData( $data )
|
||||
{
|
||||
if ( is_array( $data['restore_manual_tids'] ) )
|
||||
{
|
||||
$data['restore_manual_tids'] = serialize( $data['restore_manual_tids'] );
|
||||
}
|
||||
|
||||
$data['restore_min_tid'] = intval( $data['restore_min_tid'] );
|
||||
$data['restore_max_tid'] = intval( $data['restore_max_tid'] );
|
||||
|
||||
$this->DB->delete( 'core_archive_restore');
|
||||
$this->DB->insert( 'core_archive_restore', $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Take an archive row and returned native friendly array
|
||||
* @param array $post
|
||||
* @return array
|
||||
*/
|
||||
public function archiveToNativeFields( $post )
|
||||
{
|
||||
$native = array( 'pid' => intval( $post['archive_id'] ),
|
||||
'author_id' => intval( $post['archive_author_id'] ),
|
||||
'author_name' => $post['archive_author_name'],
|
||||
'ip_address' => $post['archive_ip_address'],
|
||||
'post_date' => intval( $post['archive_content_date'] ),
|
||||
'post' => $post['archive_content'],
|
||||
'queued' => $post['archive_queued'],
|
||||
'topic_id' => intval( $post['archive_topic_id'] ),
|
||||
'new_topic' => intval( $post['archive_is_first'] ),
|
||||
'post_bwoptions' => $post['archive_bwoptions'],
|
||||
'post_key' => $post['archive_attach_key'],
|
||||
'post_htmlstate' => $post['archive_html_mode'],
|
||||
'use_sig' => $post['archive_show_signature'],
|
||||
'use_emo' => $post['archive_show_emoticons'],
|
||||
'append_edit' => $post['archive_show_edited_by'],
|
||||
'edit_time' => $post['archive_edit_time'],
|
||||
'edit_name' => $post['archive_edit_name'],
|
||||
'post_edit_reason' => $post['archive_edit_reason'] );
|
||||
|
||||
return $native;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs archive action
|
||||
* @param array $ids
|
||||
*/
|
||||
public function log( $ids )
|
||||
{
|
||||
$this->DB->insert( 'core_archive_log', array( 'archlog_date' => IPS_UNIX_TIME_NOW,
|
||||
'archlog_app' => $this->getApp(),
|
||||
'archlog_ids' => serialize( $ids ),
|
||||
'archlog_is_restore' => 1,
|
||||
'archlog_count' => count( $ids ) ) );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,175 +1,175 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* Archive: Restore
|
||||
* By Matt Mecham
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @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 17th February 2010
|
||||
* @version $Revision: 8644 $
|
||||
*/
|
||||
|
||||
class classes_archive_restore_sql extends classes_archive_restore
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
/* Make registry objects */
|
||||
$this->registry = ipsRegistry::instance();
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->lang = $this->registry->getClass('class_localization');
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
|
||||
/* Do we have a remote DB? */
|
||||
if ( $this->settings['archive_remote_sql_database'] && $this->settings['archive_remote_sql_user'] )
|
||||
{
|
||||
if ( ! is_object( $this->registry->dbFunctions()->getDB('remoteArchive') ) )
|
||||
{
|
||||
|
||||
$this->registry->dbFunctions()->setDB( 'mysql', 'remoteArchive', array( 'sql_database' => $this->settings['archive_remote_sql_database'],
|
||||
'sql_user' => $this->settings['archive_remote_sql_user'],
|
||||
'sql_pass' => $this->settings['archive_remote_sql_pass'],
|
||||
'sql_host' => $this->settings['archive_remote_sql_host'],
|
||||
'sql_charset' => $this->settings['archive_remote_sql_charset'],
|
||||
'sql_tbl_prefix' => $this->settings['sql_tbl_prefix'],
|
||||
'catchConnectionError' => true ) );
|
||||
|
||||
|
||||
$this->remoteDB = $this->registry->dbFunctions()->getDB('remoteArchive');
|
||||
|
||||
/* Check for connection issue */
|
||||
if ( $this->remoteDB->error )
|
||||
{
|
||||
$this->connectError = $this->remoteDB->error;
|
||||
$this->remoteDB = null;
|
||||
|
||||
$this->registry->dbFunctions()->unsetDB('remoteArchive');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->remoteDB = $this->registry->dbFunctions()->getDB('remoteArchive');
|
||||
|
||||
/* Check for connection issue */
|
||||
if ( $this->remoteDB->error )
|
||||
{
|
||||
$this->connectError = $this->remoteDB->error;
|
||||
$this->remoteDB = null;
|
||||
|
||||
$this->registry->dbFunctions()->unsetDB('remoteArchive');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->remoteDB = $this->DB;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get max PID in a TID
|
||||
*/
|
||||
public function getMaxPidInTid( $tid )
|
||||
{
|
||||
$max = $this->remoteDB->buildAndFetch( array( 'select' => 'MAX(archive_id) as i', 'from' => 'forums_archive_posts', 'where' => 'archive_topic_id=' . intval( $tid ) ) );
|
||||
|
||||
return $max['i'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch by TIDS
|
||||
*/
|
||||
public function getPidsInTids( array $tids, $limit=50 )
|
||||
{
|
||||
$pids = array();
|
||||
|
||||
/* Select remaining Pids */
|
||||
$this->remoteDB->build( array( 'select' => 'archive_id',
|
||||
'from' => 'forums_archive_posts',
|
||||
'where' => 'archive_topic_id IN(' . implode( ',', $tids ) . ') AND archive_restored=0',
|
||||
'order' => 'archive_topic_id ASC, archive_id ASC',
|
||||
'limit' => array( 0, $limit ) ) );
|
||||
|
||||
$o = $this->remoteDB->execute();
|
||||
|
||||
while( $post = $this->remoteDB->fetch( $o ) )
|
||||
{
|
||||
$pids[ $post['archive_id'] ] = $post['archive_id'];
|
||||
}
|
||||
|
||||
return $pids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch between TIDS and date
|
||||
*
|
||||
*/
|
||||
public function getPidsBetweenTidsAndDate( $min, $max, $date=0, $limit=50 )
|
||||
{
|
||||
$this->remoteDB->build( array( 'select' => 'archive_id',
|
||||
'from' => 'forums_archive_posts',
|
||||
'where' => 'archive_content_date > ' . $date . ' AND archive_topic_id BETWEEN ' . intval( $min ) . ' AND ' . intval( $max ),
|
||||
'order' => 'archive_topic_id ASC, archive_id ASC',
|
||||
'limit' => array( 0, $limit ) ) );
|
||||
|
||||
$o = $this->remoteDB->execute();
|
||||
|
||||
while( $post = $this->remoteDB->fetch( $o ) )
|
||||
{
|
||||
$pids[ $post['archive_id'] ] = $post['archive_id'];
|
||||
}
|
||||
|
||||
return $pids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove posts by TIDs
|
||||
* @param array TIDS
|
||||
*/
|
||||
public function removePostsByTids( array $tids )
|
||||
{
|
||||
if ( count( $tids ) )
|
||||
{
|
||||
$this->remoteDB->delete( 'forums_archive_posts', 'archive_topic_id IN(' . implode( ',', $tids ) . ')' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove posts by PIDs
|
||||
* @param array PIDs
|
||||
*/
|
||||
public function setAsRestoredByPids( array $pids )
|
||||
{
|
||||
if ( count( $pids ) )
|
||||
{
|
||||
$this->DB->update( 'forums_archive_posts', array( 'archive_restored' => 1 ), 'archive_id IN (' . implode( ',', $pids ) .')' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write single entry to DB
|
||||
* @param array INTS
|
||||
*/
|
||||
public function set( $data=array() )
|
||||
{
|
||||
if ( ! count( $data ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->DB->replace( 'posts', $this->archiveToNativeFields( $data ), array( 'pid' ) );
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Archive: Restore
|
||||
* By Matt Mecham
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @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 17th February 2010
|
||||
* @version $Revision: 8644 $
|
||||
*/
|
||||
|
||||
class classes_archive_restore_sql extends classes_archive_restore
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
/* Make registry objects */
|
||||
$this->registry = ipsRegistry::instance();
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->lang = $this->registry->getClass('class_localization');
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
|
||||
/* Do we have a remote DB? */
|
||||
if ( $this->settings['archive_remote_sql_database'] && $this->settings['archive_remote_sql_user'] )
|
||||
{
|
||||
if ( ! is_object( $this->registry->dbFunctions()->getDB('remoteArchive') ) )
|
||||
{
|
||||
|
||||
$this->registry->dbFunctions()->setDB( 'mysql', 'remoteArchive', array( 'sql_database' => $this->settings['archive_remote_sql_database'],
|
||||
'sql_user' => $this->settings['archive_remote_sql_user'],
|
||||
'sql_pass' => $this->settings['archive_remote_sql_pass'],
|
||||
'sql_host' => $this->settings['archive_remote_sql_host'],
|
||||
'sql_charset' => $this->settings['archive_remote_sql_charset'],
|
||||
'sql_tbl_prefix' => $this->settings['sql_tbl_prefix'],
|
||||
'catchConnectionError' => true ) );
|
||||
|
||||
|
||||
$this->remoteDB = $this->registry->dbFunctions()->getDB('remoteArchive');
|
||||
|
||||
/* Check for connection issue */
|
||||
if ( $this->remoteDB->error )
|
||||
{
|
||||
$this->connectError = $this->remoteDB->error;
|
||||
$this->remoteDB = null;
|
||||
|
||||
$this->registry->dbFunctions()->unsetDB('remoteArchive');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->remoteDB = $this->registry->dbFunctions()->getDB('remoteArchive');
|
||||
|
||||
/* Check for connection issue */
|
||||
if ( $this->remoteDB->error )
|
||||
{
|
||||
$this->connectError = $this->remoteDB->error;
|
||||
$this->remoteDB = null;
|
||||
|
||||
$this->registry->dbFunctions()->unsetDB('remoteArchive');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->remoteDB = $this->DB;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get max PID in a TID
|
||||
*/
|
||||
public function getMaxPidInTid( $tid )
|
||||
{
|
||||
$max = $this->remoteDB->buildAndFetch( array( 'select' => 'MAX(archive_id) as i', 'from' => 'forums_archive_posts', 'where' => 'archive_topic_id=' . intval( $tid ) ) );
|
||||
|
||||
return $max['i'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch by TIDS
|
||||
*/
|
||||
public function getPidsInTids( array $tids, $limit=50 )
|
||||
{
|
||||
$pids = array();
|
||||
|
||||
/* Select remaining Pids */
|
||||
$this->remoteDB->build( array( 'select' => 'archive_id',
|
||||
'from' => 'forums_archive_posts',
|
||||
'where' => 'archive_topic_id IN(' . implode( ',', $tids ) . ') AND archive_restored=0',
|
||||
'order' => 'archive_topic_id ASC, archive_id ASC',
|
||||
'limit' => array( 0, $limit ) ) );
|
||||
|
||||
$o = $this->remoteDB->execute();
|
||||
|
||||
while( $post = $this->remoteDB->fetch( $o ) )
|
||||
{
|
||||
$pids[ $post['archive_id'] ] = $post['archive_id'];
|
||||
}
|
||||
|
||||
return $pids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch between TIDS and date
|
||||
*
|
||||
*/
|
||||
public function getPidsBetweenTidsAndDate( $min, $max, $date=0, $limit=50 )
|
||||
{
|
||||
$this->remoteDB->build( array( 'select' => 'archive_id',
|
||||
'from' => 'forums_archive_posts',
|
||||
'where' => 'archive_content_date > ' . $date . ' AND archive_topic_id BETWEEN ' . intval( $min ) . ' AND ' . intval( $max ) . ' AND archive_restored = 0',
|
||||
'order' => 'archive_topic_id ASC, archive_id ASC',
|
||||
'limit' => array( 0, $limit ) ) );
|
||||
|
||||
$o = $this->remoteDB->execute();
|
||||
|
||||
while( $post = $this->remoteDB->fetch( $o ) )
|
||||
{
|
||||
$pids[ $post['archive_id'] ] = $post['archive_id'];
|
||||
}
|
||||
|
||||
return $pids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove posts by TIDs
|
||||
* @param array TIDS
|
||||
*/
|
||||
public function removePostsByTids( array $tids )
|
||||
{
|
||||
if ( count( $tids ) )
|
||||
{
|
||||
$this->remoteDB->delete( 'forums_archive_posts', 'archive_topic_id IN(' . implode( ',', $tids ) . ')' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove posts by PIDs
|
||||
* @param array PIDs
|
||||
*/
|
||||
public function setAsRestoredByPids( array $pids )
|
||||
{
|
||||
if ( count( $pids ) )
|
||||
{
|
||||
$this->DB->update( 'forums_archive_posts', array( 'archive_restored' => 1 ), 'archive_id IN (' . implode( ',', $pids ) .')' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write single entry to DB
|
||||
* @param array INTS
|
||||
*/
|
||||
public function set( $data=array() )
|
||||
{
|
||||
if ( ! count( $data ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->DB->replace( 'posts', $this->archiveToNativeFields( $data ), array( 'pid' ) );
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Archive: Writer
|
||||
* By Matt Mecham
|
||||
* </pre>
|
||||
|
||||
@@ -0,0 +1,742 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Back Up Model
|
||||
* Last Updated: $Date: 2012-05-10 21:10:13 +0100 (Thu, 10 May 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since Tue. 15th June 2012
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Back up model
|
||||
* @author matt
|
||||
*
|
||||
*/
|
||||
class ipsBackup
|
||||
{
|
||||
/**
|
||||
* Holds the back-up variables
|
||||
* @var array
|
||||
*/
|
||||
private $Vars = array();
|
||||
|
||||
/**
|
||||
* DB tables and primary keys
|
||||
* @var array
|
||||
*/
|
||||
private $Keys = array();
|
||||
/**
|
||||
* Contains list of tables NOT to gather.
|
||||
* @var array
|
||||
*/
|
||||
private $BlackList = array();
|
||||
|
||||
/**
|
||||
* Contains list of tables ONLY to gather.
|
||||
* @var array
|
||||
*/
|
||||
private $WhiteList = array();
|
||||
|
||||
/**
|
||||
* Contains all the schematic info. Use wisely, it can be 'uuuge (700k+)
|
||||
*/
|
||||
private $SchematicData = array();
|
||||
|
||||
/**
|
||||
* Limits for the batches
|
||||
* @var array
|
||||
*/
|
||||
private $Limits = array( 'rows' => 0, 'bytes' => 0 );
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
/* Make objects */
|
||||
$this->registry = ipsRegistry::instance();
|
||||
$this->DB = $this->registry->DB();
|
||||
|
||||
/* Fetch *lists */
|
||||
$this->BlackList = $this->_getBlackList();
|
||||
$this->Whitelist = $this->_getWhiteList();
|
||||
|
||||
/* Fetch data variables */
|
||||
$this->Vars = $this->_getVars();
|
||||
|
||||
/* Fetch db table pkeys */
|
||||
$this->Keys = $this->_getKeys();
|
||||
|
||||
/* Set default limits for the batch pulling */
|
||||
$this->setLimits( 'rows', 10000 );
|
||||
$this->setLimits( 'bytes', 20 * 1024 * 1024 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an insert/delete/update/replace query to our log
|
||||
* @param string $query
|
||||
* @param string $table
|
||||
*/
|
||||
public function addRawQueryToLog( $query, $table )
|
||||
{
|
||||
/* This would be LOLs */
|
||||
if ( $this->backUpRunning() && ! stristr( 'insert into ' . $this->registry->dbFunctions()->getPrefix() . 'backup_queue', $query ) )
|
||||
{
|
||||
$this->DB->insert( 'backup_queue', array( 'queue_entry_date' => IPS_UNIX_TIME_NOW,
|
||||
'queue_entry_type' => 5,
|
||||
'queue_entry_table' => $this->_stripPrefix( $table ),
|
||||
'queue_entry_sql' => $query ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the back up system ready to process queries?
|
||||
*
|
||||
*/
|
||||
public function backUpRunning()
|
||||
{
|
||||
return ( $this->Vars['populate_all_done'] > 0 ) ? true : false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Does it need to reset?
|
||||
*
|
||||
*/
|
||||
public function checkForRestart()
|
||||
{
|
||||
/* Eventually we'll expand the system so it can be pinged to see if a restart is needed but for now... */
|
||||
return ( ! $this->Vars['populate_all_done'] ) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send batch to the backup server
|
||||
*/
|
||||
public function sendBatch()
|
||||
{
|
||||
/* Fetch kernel class */
|
||||
require_once( IPS_KERNEL_PATH . 'classFileManagement.php' );
|
||||
$cfm = new classFileManagement();
|
||||
|
||||
/* Fetch DB data */
|
||||
$tables = $this->_getDatabaseSchematics();
|
||||
$sqlRows = array();
|
||||
$touchedTables = array();
|
||||
$bytesUsed = '';
|
||||
$topId = 0;
|
||||
$delIds = array();
|
||||
|
||||
/* Do we need to restart? */
|
||||
if ( $this->checkForRestart() )
|
||||
{
|
||||
$this->populateLogWithAllTables();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Little short cut */
|
||||
$p = $this->registry->dbFunctions()->getPrefix();
|
||||
|
||||
/* Start looping on the table */
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'backup_queue',
|
||||
'order' => 'queue_id',
|
||||
'limit' => array( 0, $this->Limits['rows'] ) ) );
|
||||
|
||||
$o = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $o ) )
|
||||
{
|
||||
$tbl = $this->_stripPrefix( $row['queue_entry_table'] );
|
||||
$sql = '';
|
||||
$fields = array();
|
||||
|
||||
$touchedTables[ $tbl ] = $tbl;
|
||||
|
||||
if ( $row['queue_entry_sql'] )
|
||||
{
|
||||
$sql = $row['queue_entry_sql'];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Get fields */
|
||||
foreach( $tables[ $row['queue_entry_table'] ]['cols'] as $col )
|
||||
{
|
||||
$fields[] = $col['Field'];
|
||||
}
|
||||
|
||||
if ( ! count( $fields ) )
|
||||
{
|
||||
/* Empty - so remove this queue row or we'll never progress */
|
||||
$delIds[] = $row['queue_id'];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
/* INSERT */
|
||||
if ( $row['queue_entry_type'] == 1 )
|
||||
{
|
||||
/* Get data */
|
||||
$pKey = $row['queue_entry_key'];
|
||||
$pKeyVal = ( $this->_isConcat( $pKey ) ) ? addslashes( $row['queue_entry_value'] ) : $row['queue_entry_value'];
|
||||
$data = array();
|
||||
$vals = array();
|
||||
|
||||
$data = $this->DB->buildAndFetch( array( 'select' => '`' . implode( "`, `", $fields ) . '`',
|
||||
'from' => $tbl,
|
||||
'where' => $pKey . "='" . $pKeyVal . "'" ) );
|
||||
|
||||
if ( ! is_array( $data ) OR ! count( $data ) )
|
||||
{
|
||||
/* Empty - so remove this queue row or we'll never progress */
|
||||
$delIds[] = $row['queue_id'];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach( $data as $k => $v )
|
||||
{
|
||||
$vals[] = $this->_makeValueSafeForQuery( $v );
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO " . $p . $tbl . "(`" . implode( "`, `", $fields ). "`) " .
|
||||
"VALUES( '" . implode( "', '", $vals ) . "');";
|
||||
}
|
||||
}
|
||||
|
||||
/* Got anything? */
|
||||
if ( ! $sql )
|
||||
{
|
||||
/* Empty - so remove this queue row or we'll never progress */
|
||||
$delIds[] = $row['queue_id'];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
/* check size */
|
||||
$bytesUsed += IPSLib::strlenToBytes( strlen( $sql ) );
|
||||
|
||||
/* Truth time! */
|
||||
if ( $bytesUsed >= $this->Limits['bytes'] )
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sqlRows[] = $sql;
|
||||
|
||||
/* top id to remove */
|
||||
$topId = $row['queue_id'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Anything to delete? */
|
||||
if ( count( $delIds ) )
|
||||
{
|
||||
$this->DB->delete( 'backup_queue', 'queue_id IN (' . implode( ',', array_values( $delIds ) ) . ')' );
|
||||
}
|
||||
|
||||
/* What do we have? */
|
||||
if ( $topId && count( $sqlRows ) )
|
||||
{
|
||||
$dataToSend = $this->_createTextToSend( $sqlRows, array_keys( $touchedTables ) );
|
||||
|
||||
$returnedData = $cfm->postFileContents( $this->_getBackupServerUrl(), array( 'backup_data' => @gzcompress( $dataToSend ), 'lkey' => ipsRegistry::$settings['ipb_reg_number'] ) );
|
||||
|
||||
$test = json_decode( trim( $returnedData ), true );
|
||||
|
||||
if ( is_array( $test ) && $test['status'] == 'ok' )
|
||||
{
|
||||
$this->DB->delete( 'backup_queue', 'queue_id <= ' . intval( $topId ) );
|
||||
$this->_addLog( intval( $test['rows'] ), $test['status'] );
|
||||
|
||||
$this->Vars['rows_sent'] = intval( $this->Vars['rows_sent'] ) + count( $sqlRows );
|
||||
$this->Vars['rows_total'] = $this->_getStoredRowCount();
|
||||
$this->_setVars();
|
||||
}
|
||||
else
|
||||
{
|
||||
# Fail lol
|
||||
$this->_addLog( 0, $test['status'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the first run
|
||||
* This will reset the system and re-populate the entire log table - USE WITH CAUTION!
|
||||
*/
|
||||
public function populateLogWithAllTables( $tablesToIndex=300 )
|
||||
{
|
||||
$lastTable = $this->Vars['populate_all_last_table'];
|
||||
$lastProc = '';
|
||||
|
||||
/* Reset the system if not middle of processing */
|
||||
if ( ! $lastTable )
|
||||
{
|
||||
$this->_resetSystem();
|
||||
}
|
||||
|
||||
/* Little short cut */
|
||||
$p = $this->registry->dbFunctions()->getPrefix();
|
||||
|
||||
/* Lets go */
|
||||
foreach( $this->Keys as $table => $pKey )
|
||||
{
|
||||
/* Seek to the first unindexed table */
|
||||
if ( ! $lastProc )
|
||||
{
|
||||
if ( $lastTable and $table != $lastTable )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ( $lastTable == $table ) || ! $lastTable )
|
||||
{
|
||||
$lastProc = $table;
|
||||
}
|
||||
}
|
||||
|
||||
$this->DB->allow_sub_select = 1;
|
||||
|
||||
$pKeyText = ( $this->_isConcat( $pKey ) ) ? addslashes( $pKey ) : $pKey;
|
||||
|
||||
/* Fetch, then */
|
||||
$this->DB->query( 'INSERT INTO ' . $p . 'backup_queue (queue_entry_date, queue_entry_type, queue_entry_table, queue_entry_key, queue_entry_value, queue_entry_sql)' .
|
||||
"( SELECT UNIX_TIMESTAMP(), 1, '" . $table . "', '" . $pKeyText . "', " . $pKey . ", '' FROM " . $table . " )" );
|
||||
|
||||
$this->Vars['populate_all_last_table'] = $table;
|
||||
$this->_setVars();
|
||||
}
|
||||
|
||||
/* We are all done */
|
||||
if ( ( $lastTable && $lastProc == $this->Vars['populate_all_last_table'] ) OR ! $lastProc OR ( $tablesToIndex >= count( $this->Keys ) ) )
|
||||
{
|
||||
$this->Vars['rows_sent'] = 0;
|
||||
$this->Vars['rows_total'] = $this->_getStoredRowCount();
|
||||
$this->Vars['populate_all_done'] = IPS_UNIX_TIME_NOW;
|
||||
$this->Vars['populate_all_last_table'] = '';
|
||||
$this->_setVars();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ok to fetch the table data?
|
||||
* @param string $table
|
||||
*/
|
||||
public function isOkToGetThisTableData( $table )
|
||||
{
|
||||
$table = $this->_stripPrefix( $table );
|
||||
|
||||
if ( count( $this->Whitelist ) )
|
||||
{
|
||||
if ( in_array( $table, $this->Whitelist ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return ( $this->_isBlackListTable( $table ) ) ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuilds the cache file so we can find out a little about the database structure
|
||||
*/
|
||||
public function rebuildPrimaryKeyCacheFile()
|
||||
{
|
||||
$cache = array();
|
||||
$schematic = $this->_getDatabaseSchematics();
|
||||
|
||||
foreach( $schematic as $table => $data )
|
||||
{
|
||||
$hasKey = false;
|
||||
|
||||
if ( count( $data['idx'] ) )
|
||||
{
|
||||
foreach( $data['idx'] as $idx )
|
||||
{
|
||||
if ( $idx['Key_name'] == 'PRIMARY' )
|
||||
{
|
||||
$cache[ $table ] = $idx['Column_name'];
|
||||
$hasKey = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $hasKey )
|
||||
{
|
||||
/* Lets make a key */
|
||||
$c = 0;
|
||||
$concat = array();
|
||||
|
||||
foreach( $data['cols'] as $col )
|
||||
{
|
||||
if ( strtolower( $col['Type'] ) != 'mediumtext' )
|
||||
{
|
||||
if ( stristr( strtolower( $col['Type'] ), 'int(' ) )
|
||||
{
|
||||
$concat[] = $col['Field'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$concat[] = 'SUBSTR(' . $col['Field'] . ', 1, 32)';
|
||||
}
|
||||
|
||||
$c++;
|
||||
}
|
||||
|
||||
if ( $c > 5 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$cache[ $table ] = 'CONCAT_WS( \',\', ' . implode( ',', $concat ) . ' )';
|
||||
}
|
||||
}
|
||||
|
||||
$contents = '<' . "?php\n" . '$keyCache = ' . var_export( $cache, true ) . ';' . "\n?" . '>';
|
||||
|
||||
if ( ! file_put_contents( $this->_getBackUpKeyCacheFilename(), $contents ) )
|
||||
{
|
||||
trigger_error( 'Не удалось записать файл кэша системы резервного копиования' );
|
||||
}
|
||||
|
||||
/* Reset table pkeys */
|
||||
$this->Keys = $this->_getKeys();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a per batch limit
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
*/
|
||||
public function setLimits( $key, $value )
|
||||
{
|
||||
switch( $key )
|
||||
{
|
||||
case 'row':
|
||||
case 'pergo':
|
||||
case 'rows':
|
||||
$this->Limits['rows'] = $value;
|
||||
break;
|
||||
case 'bytes':
|
||||
case 'b':
|
||||
$this->Limits['bytes'] = $value;
|
||||
break;
|
||||
case 'kb':
|
||||
$this->Limits['bytes'] = $value * 1024;
|
||||
break;
|
||||
case 'mb':
|
||||
$this->Limits['bytes'] = $value * 1024 * 1024;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of rows in the queue table
|
||||
* @return int, yo
|
||||
*/
|
||||
private function _getStoredRowCount()
|
||||
{
|
||||
$count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as tnuoc', 'from' => 'backup_queue' ) );
|
||||
|
||||
return $count['tnuoc'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the system and preps for re-logging all
|
||||
*/
|
||||
private function _resetSystem()
|
||||
{
|
||||
/* Reset */
|
||||
$this->Vars['populate_all_start'] = IPS_UNIX_TIME_NOW;
|
||||
$this->Vars['populate_all_done'] = 0;
|
||||
$this->Vars['populate_all_last_table'] = '';
|
||||
|
||||
$this->_setVars();
|
||||
|
||||
/* Delete current logs */
|
||||
$this->DB->delete('backup_queue');
|
||||
$this->DB->delete('backup_log');
|
||||
|
||||
/* Rebuild cache file */
|
||||
$this->rebuildPrimaryKeyCacheFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the database keys
|
||||
* @return array
|
||||
*/
|
||||
private function _getKeys()
|
||||
{
|
||||
$keyCache = array();
|
||||
|
||||
if ( ! is_file( $this->_getBackUpKeyCacheFilename() ) )
|
||||
{
|
||||
$this->rebuildPrimaryKeyCacheFile();
|
||||
}
|
||||
|
||||
include( $this->_getBackUpKeyCacheFilename() );
|
||||
|
||||
return $keyCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vars from the deebee
|
||||
* @return array:
|
||||
*/
|
||||
private function _getVars()
|
||||
{
|
||||
$vars = array();
|
||||
|
||||
$db = $this->DB->buildAndFetchAll( array( 'select' => '*',
|
||||
'from' => 'backup_vars' ) );
|
||||
|
||||
if ( is_array( $db ) )
|
||||
{
|
||||
foreach( $db as $var )
|
||||
{
|
||||
$vars[ $var['backup_var_key'] ] = $var['backup_var_value'];
|
||||
}
|
||||
}
|
||||
|
||||
if( !isset($vars['populate_all_done']) )
|
||||
{
|
||||
$vars['populate_all_done'] = 0;
|
||||
}
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the variables
|
||||
*/
|
||||
private function _setVars()
|
||||
{
|
||||
foreach( $this->Vars as $k => $v )
|
||||
{
|
||||
$this->DB->replace( 'backup_vars',array( 'backup_var_key' => $k, 'backup_var_value' => $v ), array( 'backup_var_key' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes table prefix if one exists
|
||||
* @param string $table
|
||||
* @return string
|
||||
*/
|
||||
private function _stripPrefix( $table )
|
||||
{
|
||||
if ( $this->registry->dbFunctions()->getPrefix() && preg_match( "/^" . $this->registry->dbFunctions()->getPrefix() ."/i", $table ) )
|
||||
{
|
||||
$table = preg_replace( "/^" . $this->registry->dbFunctions()->getPrefix() ."(.*)$/i", '\1', $table );
|
||||
}
|
||||
|
||||
return $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns ignored tables
|
||||
*/
|
||||
private function _getWhiteList()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns ignored tables
|
||||
*/
|
||||
private function _getBlackList()
|
||||
{
|
||||
/* @todo abstract this puppy */
|
||||
return array( 'admin_login_logs',
|
||||
'admin_logs',
|
||||
'api_log',
|
||||
'backup_log',
|
||||
'backup_queue',
|
||||
'backup_vars',
|
||||
'blog_askimet_logs',
|
||||
'blog_trackback_spamlogs',
|
||||
'blog_views',
|
||||
'chat_log_archive',
|
||||
'content_cache_posts',
|
||||
'content_cache_sigs',
|
||||
'core_editor_autosave',
|
||||
'core_item_markers',
|
||||
'core_like_cache',
|
||||
'core_share_links_caches',
|
||||
'core_share_links_log',
|
||||
'core_tags_cache',
|
||||
'error_logs',
|
||||
'gallery_image_views',
|
||||
'mail_error_logs',
|
||||
'moderator_logs',
|
||||
'profile_friends_flood',
|
||||
'profile_portal_views',
|
||||
'reputation_cache',
|
||||
'search_sessions',
|
||||
'sessions',
|
||||
'skin_cache',
|
||||
'skin_templates_cache',
|
||||
'spam_service_log',
|
||||
'spider_logs',
|
||||
'task_logs',
|
||||
'topic_views' );
|
||||
}
|
||||
/**
|
||||
* Return database schematic information
|
||||
*/
|
||||
private function _getDatabaseSchematics()
|
||||
{
|
||||
if ( count( $this->SchematicData ) )
|
||||
{
|
||||
return $this->SchematicData;
|
||||
}
|
||||
|
||||
$this->DB->query( "SHOW TABLE STATUS FROM `" . $this->registry->dbFunctions()->getDatabaseName() . "`" );
|
||||
|
||||
/* Loop through the results */
|
||||
$this->SchematicData = array();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
/* Check to ensure it's a table for this install... */
|
||||
if ( $this->registry->dbFunctions()->getPrefix() && ! preg_match( "/^" . $this->registry->dbFunctions()->getPrefix() ."/i", $row['Name'] ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! $this->isOkToGetThisTableData( $row['Name'] ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Add to output array */
|
||||
$this->SchematicData[ $row['Name'] ] = array( 'cols' => array(), 'idx' => array(), 'data' => $row );
|
||||
}
|
||||
|
||||
/* Now fetch table information */
|
||||
foreach( $this->SchematicData as $name => $data )
|
||||
{
|
||||
/* Fetch data */
|
||||
$this->DB->query( "DESCRIBE " . $name );
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
$this->SchematicData[ $name ]['cols'][] = $row;
|
||||
}
|
||||
|
||||
/* Fetch index data */
|
||||
$this->DB->query( "SHOW INDEX FROM `" . $this->registry->dbFunctions()->getDatabaseName() . "`.`" . $name . "`" );
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
$this->SchematicData[ $name ]['idx'][] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->SchematicData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if this is an ignored table
|
||||
* @param string $table
|
||||
*/
|
||||
private function _isBlackListTable( $table )
|
||||
{
|
||||
return ( in_array( $table, $this->BlackList ) ) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add slashes to single quotes to stop sql breaks
|
||||
*
|
||||
* @param string $value String to add slashes too
|
||||
* @return string
|
||||
*/
|
||||
private function _makeValueSafeForQuery( $value )
|
||||
{
|
||||
return $this->DB->addSlashes( $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $str
|
||||
* @return boolean
|
||||
*/
|
||||
private function _isConcat( $str )
|
||||
{
|
||||
return ( substr( $str, 0, 10 ) == 'CONCAT_WS(' ) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the post text
|
||||
* @param string $sqlData
|
||||
*/
|
||||
private function _createTextToSend( $sqlData, $touchedTables=null )
|
||||
{
|
||||
$tables = $this->_getDatabaseSchematics();
|
||||
$tblsToSend = array();
|
||||
$tblsToCreate = array();
|
||||
$schematic = '';
|
||||
|
||||
/* Little short cut */
|
||||
$p = $this->registry->dbFunctions()->getPrefix();
|
||||
|
||||
if ( is_array( $touchedTables ) )
|
||||
{
|
||||
foreach( $touchedTables as $tbl )
|
||||
{
|
||||
/* $touchedTables has no prefix */
|
||||
$tblsToSend[ $p . $tbl ] = $tables[ $p . $tbl ];
|
||||
|
||||
$this->DB->query( "SHOW CREATE TABLE " . $p . $tbl );
|
||||
$_f = $this->DB->fetch();
|
||||
|
||||
$tblsToCreate[] = str_replace( array( "\n", "\r" ), "\n", $_f['Create Table'] );
|
||||
}
|
||||
}
|
||||
|
||||
$document = serialize( array( 'tableData' => $tblsToSend, 'createTables' => $tblsToCreate, 'sql' => $sqlData, 'vars' => $this->Vars ) );
|
||||
|
||||
return $document;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should be face-smashingly obvious.
|
||||
* @return string
|
||||
*/
|
||||
private function _getBackUpKeyCacheFilename()
|
||||
{
|
||||
return IPS_CACHE_PATH . 'cache/backUpKeyCache.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the backup server URL (clearly)
|
||||
* @return string
|
||||
*/
|
||||
private function _getBackupServerUrl()
|
||||
{
|
||||
return 'http://gateway.backuptest.lw.ipslink.com/index.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a log to the back up system
|
||||
* @param int $rows
|
||||
* @param string $status
|
||||
*/
|
||||
private function _addLog( $rows, $status )
|
||||
{
|
||||
$this->DB->insert( 'backup_log', array( 'log_row_count' => $rows, 'log_result' => $status ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,339 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Back Up Model
|
||||
* Last Updated: $Date: 2012-05-10 21:10:13 +0100 (Thu, 10 May 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since Tue. 15th June 2012
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Back up database class
|
||||
* @author matt
|
||||
*
|
||||
*/
|
||||
class ipsBackup_db extends db_driver_mysql
|
||||
{
|
||||
/* Current DB method */
|
||||
private $_method = '';
|
||||
|
||||
/* Current table */
|
||||
private $_table = '';
|
||||
|
||||
/* Back up class */
|
||||
private $Backup = '';
|
||||
|
||||
/* Shut down queries */
|
||||
private $_shutDownData = array();
|
||||
|
||||
private $_isMysqli = false;
|
||||
|
||||
private $_insertId = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_isMysqli = ( extension_loaded('mysqli') AND ! defined( 'FORCE_MYSQL_ONLY' ) ) ? true : false;
|
||||
|
||||
return parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Can't load back-up class at INIT because it requires
|
||||
* that ipsRegistry is set up
|
||||
*/
|
||||
private function _backup()
|
||||
{
|
||||
if ( ! is_object( $this->Backup ) )
|
||||
{
|
||||
/* Fetch back up class */
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/backup.php' );
|
||||
$this->Backup = new ipsBackup();
|
||||
}
|
||||
|
||||
return $this->Backup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete data from a table
|
||||
*
|
||||
* @param string Table name
|
||||
* @param string [Optional] Where clause
|
||||
* @param string [Optional] Order by
|
||||
* @param array [Optional] Limit clause
|
||||
* @param boolean [Optional] Run on shutdown
|
||||
* @return @e resource
|
||||
*/
|
||||
public function delete( $table, $where='', $orderBy='', $limit=array(), $shutdown=false )
|
||||
{
|
||||
$this->_table = '';
|
||||
$this->_method = '';
|
||||
|
||||
/* Want to capture? */
|
||||
if ( $this->_backup()->isOkToGetThisTableData( $table ) )
|
||||
{
|
||||
$this->_table = $table;
|
||||
$this->_method = 'delete';
|
||||
}
|
||||
|
||||
parent::delete( $table, $where, $orderBy, $limit, $shutdown );
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert data into a table
|
||||
*
|
||||
* @param string Table name
|
||||
* @param array Array of field => values
|
||||
* @param boolean Run on shutdown
|
||||
* @return @e resource
|
||||
*/
|
||||
public function insert( $table, $set, $shutdown=false )
|
||||
{
|
||||
$this->_table = '';
|
||||
$this->_method = '';
|
||||
|
||||
/* Want to capture? */
|
||||
if ( $this->_backup()->isOkToGetThisTableData( $table ) )
|
||||
{
|
||||
$this->_table = $table;
|
||||
$this->_method = 'insert';
|
||||
}
|
||||
|
||||
if ( $table !== 'backup_queue' )
|
||||
{
|
||||
/* Reset insert ID ready for next query
|
||||
unless we're adding to the queue table
|
||||
in which case we want to preserve insertID from preceeding query */
|
||||
$this->_insertId = null;
|
||||
}
|
||||
|
||||
return parent::insert( $table, $set, $shutdown );
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert record into table if not present, otherwise update existing record
|
||||
*
|
||||
* @param string Table name
|
||||
* @param array Array of field => values
|
||||
* @param array Array of fields to check
|
||||
* @param boolean [Optional] Run on shutdown
|
||||
* @return @e resource
|
||||
*/
|
||||
public function replace( $table, $set, $where, $shutdown=false )
|
||||
{
|
||||
$this->_table = '';
|
||||
$this->_method = '';
|
||||
|
||||
/* Want to capture? */
|
||||
if ( $this->_backup()->isOkToGetThisTableData( $table ) )
|
||||
{
|
||||
$this->_table = $table;
|
||||
$this->_method = 'replace';
|
||||
}
|
||||
|
||||
return parent::replace( $table, $set, $where, $shutdown );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update data in a table
|
||||
*
|
||||
* @param string Table name
|
||||
* @param mixed Array of field => values, or pre-formatted "SET" clause
|
||||
* @param string [Optional] Where clause
|
||||
* @param boolean [Optional] Run on shutdown
|
||||
* @param boolean [Optional] $set is already pre-formatted
|
||||
* @return @e resource
|
||||
*/
|
||||
public function update( $table, $set, $where='', $shutdown=false, $preformatted=false, $debug=false )
|
||||
{
|
||||
$this->_table = '';
|
||||
$this->_method = '';
|
||||
|
||||
/* Want to capture? */
|
||||
if ( $this->_backup()->isOkToGetThisTableData( $table ) )
|
||||
{
|
||||
$this->_table = $table;
|
||||
$this->_method = 'update';
|
||||
}
|
||||
|
||||
return parent::update( $table, $set, $where, $shutdown, $preformatted, $debug );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates and executes SQL query, and returns the all results in an array
|
||||
*
|
||||
* @param array Set commands (select, from, where, order, limit, etc)
|
||||
* @param string Key to index array on (member_id, for example)
|
||||
* @return @e array
|
||||
*/
|
||||
public function buildAndFetchAll( $data, $arrayIndex=null )
|
||||
{
|
||||
if ( substr( $data['from'], 0, 7 ) == 'backup_' )
|
||||
{
|
||||
$this->_method = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
return parent::buildAndFetchAll( $data, $arrayIndex );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a query based on template from cache file
|
||||
*
|
||||
* @param string Name of query file method to use
|
||||
* @param array Optional arguments to be parsed inside query function
|
||||
* @param string Optional class name
|
||||
* @return @e void
|
||||
*/
|
||||
public function buildFromCache( $method, $args=array(), $class='sql_queries' )
|
||||
{
|
||||
$backup = $this->_backup();
|
||||
|
||||
parent::buildFromCache( $method, $args, $class );
|
||||
|
||||
if ( $this->cur_query )
|
||||
{
|
||||
if ( preg_match( '#^(?:insert|update|replace|delete|truncate)#i', $this->cur_query ) )
|
||||
{
|
||||
/* Ghetto ->query() method used */
|
||||
preg_match( '#^(TRUNCATE TABLE|DELETE FROM|INSERT INTO|UPDATE|REPLACE INTO)(?:\s+?)?(\S+)(\s+?)?#i', $this->cur_query, $matches );
|
||||
|
||||
if ( count( $matches ) && ! empty( $matches[1] ) )
|
||||
{
|
||||
$this->_method = trim( str_replace( array( 'table', 'from', 'into' ), '', strtolower( $matches[1] ) ) );
|
||||
$this->_table = trim( $matches[2] );
|
||||
|
||||
if ( $this->_backup()->isOkToGetThisTableData( $this->_table ) )
|
||||
{
|
||||
/* Do this now if query ran OK */
|
||||
$this->_backup()->addRawQueryToLog( $the_query, $this->_table );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a direct database query
|
||||
*
|
||||
* @param string Database query
|
||||
* @param boolean [Optional] Do not convert table prefix
|
||||
* @return @e resource
|
||||
*/
|
||||
public function query( $the_query, $bypass=false )
|
||||
{
|
||||
$val = parent::query( $the_query, $bypass );
|
||||
|
||||
if ( $this->_isShutDown && in_array( md5( $the_query ), array_keys( $this->_shutDownData ) ) )
|
||||
{
|
||||
$_data = $this->_shutDownData[ md5( $the_query ) ];
|
||||
|
||||
if ( $this->_backup()->isOkToGetThisTableData( $_data[1] ) )
|
||||
{
|
||||
$this->_method = $_data[0];
|
||||
$this->_table = $_data[1];
|
||||
}
|
||||
}
|
||||
|
||||
if ( $this->_method )
|
||||
{
|
||||
/* Fetch real insert ID */
|
||||
$this->_insertId = null;
|
||||
$this->_insertId = $this->getInsertId();
|
||||
|
||||
/* Clear method now or it will retain the current table when query log is run below */
|
||||
$this->_method = '';
|
||||
|
||||
/* Do this now if query ran OK */
|
||||
$this->_backup()->addRawQueryToLog( $the_query, $this->_table );
|
||||
}
|
||||
else if ( preg_match( '#^(?:insert|update|replace|delete|truncate)#i', $the_query ) )
|
||||
{
|
||||
/* Ghetto ->query() method used */
|
||||
preg_match( '#^(TRUNCATE TABLE|DELETE FROM|INSERT INTO|UPDATE|REPLACE INTO)(?:\s+?)?(\S+)(\s+?)?#i', $the_query, $matches );
|
||||
|
||||
if ( count( $matches ) && ! empty( $matches[1] ) )
|
||||
{
|
||||
$this->_method = trim( str_replace( array( 'table', 'from', 'into' ), '', strtolower( $matches[1] ) ) );
|
||||
$this->_table = trim( $matches[2] );
|
||||
|
||||
if ( $this->_backup()->isOkToGetThisTableData( $this->_table ) )
|
||||
{
|
||||
/* Fetch real insert ID */
|
||||
$this->_insertId = null;
|
||||
$this->_insertId = $this->getInsertId();
|
||||
|
||||
/* Do this now if query ran OK */
|
||||
$this->_backup()->addRawQueryToLog( $the_query, $this->_table );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->_method = '';
|
||||
$this->_table = '';
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve latest autoincrement insert id
|
||||
*
|
||||
* @return @e integer
|
||||
*/
|
||||
public function getInsertId()
|
||||
{
|
||||
if ( $this->_insertId === null )
|
||||
{
|
||||
$this->_insertId = parent::getInsertId();
|
||||
}
|
||||
|
||||
return $this->_insertId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if query is shutdown and run it
|
||||
*
|
||||
* @param string Query
|
||||
* @param boolean [Optional] Run on shutdown
|
||||
* @return @e mixed
|
||||
*/
|
||||
protected function _determineShutdownAndRun( $query, $shutdown=false )
|
||||
{
|
||||
if ( $shutdown && $this->obj['use_shutdown'] )
|
||||
{
|
||||
/* store data for later execution */
|
||||
$this->_shutDownData[ md5($query ) ] = array( $this->_method, $this->_table );
|
||||
|
||||
/* Prevent it from storing attributes that won't be cleared as query isn't run */
|
||||
$this->_method = '';
|
||||
$this->_table = '';
|
||||
}
|
||||
|
||||
return parent::_determineShutdownAndRun( $query, $shutdown );
|
||||
}
|
||||
|
||||
/* Have to define this as inherited class */
|
||||
public function _getErrorString()
|
||||
{
|
||||
return parent::_getErrorString();
|
||||
}
|
||||
|
||||
public function _getErrorNumber()
|
||||
{
|
||||
return parent::_getErrorNumber();
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* IP.Content custom bbcode
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2012-06-01 13:11:08 -0400 (Fri, 01 Jun 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $author$
|
||||
@@ -12,7 +12,7 @@
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Content
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10914 $
|
||||
* @version $Rev: 10855 $
|
||||
*/
|
||||
|
||||
if( !class_exists('bbcode_parent_class') )
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+3
-3
@@ -3,9 +3,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Simple caching class
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* Original Author: Matt Mecham
|
||||
@@ -14,7 +14,7 @@
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10914 $
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Control Panel Functions
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2012-11-21 14:26:15 -0500 (Wed, 21 Nov 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -13,7 +13,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since Tue. 17th August 2004
|
||||
* @version $Rev: 10914 $
|
||||
* @version $Rev: 11628 $
|
||||
*
|
||||
*/
|
||||
class adminFunctions
|
||||
@@ -79,6 +79,15 @@ class adminFunctions
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Exection order is a beatch
|
||||
*/
|
||||
public function postOutputInit()
|
||||
{
|
||||
/* Init tab keys */
|
||||
$this->registry->output->initTabKeys();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch mod_rewrite rules
|
||||
*
|
||||
@@ -97,9 +106,8 @@ class adminFunctions
|
||||
$rules .= "Options -MultiViews\n";
|
||||
$rules .= "RewriteEngine On\n";
|
||||
$rules .= "RewriteBase $_root\n";
|
||||
$rules .= "RewriteCond %{REQUEST_FILENAME} .*\.(jpeg|jpg|gif|png)$\n";
|
||||
$rules .= "RewriteCond %{REQUEST_FILENAME} !-f\n";
|
||||
$rules .= "RewriteRule . {$_root}public/404.php [L]\n\n";
|
||||
$rules .= "RewriteRule \.(jpeg|jpg|gif|png)\$ {$_root}public/404.php [NC,L]\n\n";
|
||||
$rules .= "RewriteCond %{REQUEST_FILENAME} !-f\n" .
|
||||
"RewriteCond %{REQUEST_FILENAME} !-d\n" .
|
||||
"RewriteRule . {$_root}index.php [L]\n";
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -3,18 +3,18 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* ACP Restrictions
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2013-01-22 16:10:36 -0500 (Tue, 22 Jan 2013) $
|
||||
* </pre>
|
||||
*
|
||||
* @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
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 1st march 2002
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 11883 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -110,6 +110,9 @@ class class_permissions
|
||||
// Get restrictions
|
||||
//-----------------------------------------
|
||||
|
||||
$primaryGroupIsRestricted = FALSE;
|
||||
$memberIsRestricted = FALSE;
|
||||
|
||||
$groups[] = $this->memberData['member_group_id'];
|
||||
|
||||
if( $this->memberData['mgroup_others'] )
|
||||
@@ -130,12 +133,39 @@ class class_permissions
|
||||
{
|
||||
$this->restrictions_row = unserialize($r['row_perm_cache']);
|
||||
$this->restricted = true;
|
||||
$memberIsRestricted = TRUE;
|
||||
break;
|
||||
}
|
||||
elseif ( $r['row_id'] == $this->memberData['member_group_id'] )
|
||||
{
|
||||
$primaryGroupIsRestricted = TRUE;
|
||||
}
|
||||
|
||||
$this->restrictions_row = array_merge( $this->restrictions_row, unserialize($r['row_perm_cache']) );
|
||||
$this->restricted = true;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// The primary group may not be restricted
|
||||
// but it may not be able to access ACP either
|
||||
//-----------------------------------------
|
||||
|
||||
$cache = ipsRegistry::cache()->getCache('group_cache');
|
||||
|
||||
if( ! $cache[$this->memberData['member_group_id']]['g_access_cp'] )
|
||||
{
|
||||
$primaryGroupIsRestricted = TRUE;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// If the primary group is unrestricted
|
||||
// then we don't have any restrictions
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$primaryGroupIsRestricted and !$memberIsRestricted )
|
||||
{
|
||||
$this->restricted = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add in permissions for change my details, if we have restrictions, but not acess to that module */
|
||||
@@ -248,6 +278,11 @@ class class_permissions
|
||||
|
||||
$auto_access = array( 'ajax', 'api', 'search', 'palette', 'login' );
|
||||
|
||||
if ( IN_ACP )
|
||||
{
|
||||
$auto_access[] = 'attach';
|
||||
}
|
||||
|
||||
if ( in_array( $module, $auto_access ) )
|
||||
{
|
||||
return TRUE;
|
||||
@@ -439,7 +474,7 @@ class class_permissions
|
||||
{
|
||||
$tmp = $this->return;
|
||||
$this->return = false;
|
||||
|
||||
|
||||
$this->checkPermission( $key, $app, $module );
|
||||
|
||||
$this->return = $tmp;
|
||||
@@ -515,7 +550,7 @@ class class_permissions
|
||||
//-----------------------------------------
|
||||
// Returning.. or...
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
if ( $this->return )
|
||||
{
|
||||
return $return;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Manages public permissions
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author Joshua Williams
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Facilitates reputation plugins
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2013-03-05 09:42:55 -0500 (Tue, 05 Mar 2013) $
|
||||
* </pre>
|
||||
*
|
||||
* @author Joshua Williams <josh@invisionpower.com>
|
||||
@@ -192,6 +192,14 @@ class classReputationCache
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Does the rep item exist? */
|
||||
if( ! $this->likeItemExists( $app, $type, $type_id ) )
|
||||
{
|
||||
/* See ticket #845557 - item may not exist when not in LIKE mode. Need to add functionalty so each app can return boolean if item exists in native tables */
|
||||
//$this->error_message = $this->lang->words['reputation_invalid'];
|
||||
//return false;
|
||||
}
|
||||
|
||||
/* Check for existing rating */
|
||||
$currentRating = $this->getCurrentMemberRating( array( 'app' => $app, 'type' => $type, 'id' => $type_id, 'memberId' => $this->memberData['member_id'] ) );
|
||||
|
||||
@@ -328,7 +336,7 @@ class classReputationCache
|
||||
/* Get authors current rep */
|
||||
$author_points = $this->DB->buildAndFetch( array( 'select' => 'pp_reputation_points',
|
||||
'from' => 'profile_portal',
|
||||
'where' => "pp_member_id={$member_id}" ) );
|
||||
'where' => "pp_member_id=" . intval($member_id) ) );
|
||||
|
||||
/* Figure out new rep */
|
||||
if( $currentRating['rep_rating'] == -1 )
|
||||
@@ -824,4 +832,13 @@ class classReputationCache
|
||||
{
|
||||
return ( $this->settings['reputation_point_types'] == 'like' ) ? true : false;
|
||||
}
|
||||
|
||||
public function likeItemExists( $app, $type, $type_id )
|
||||
{
|
||||
$data = $this->DB->buildAndFetch( array( 'select' => 'id',
|
||||
'from' => 'reputation_cache',
|
||||
'where' => "app='{$app}' AND type='$type' AND type_id='$type_id'" ) );
|
||||
|
||||
return ( count( $data ) ) ? TRUE : FALSE;
|
||||
}
|
||||
}
|
||||
@@ -3,17 +3,17 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Task Manager Library
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2012-09-18 10:15:15 -0400 (Tue, 18 Sep 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @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
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10914 $
|
||||
* @version $Rev: 11344 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -96,7 +96,7 @@ class class_taskmanager
|
||||
* @return @e void
|
||||
*/
|
||||
public function runTask()
|
||||
{
|
||||
{
|
||||
if ( ( ipsRegistry::$request['ck'] ) AND ipsRegistry::$request['ck'] )
|
||||
{
|
||||
if ( ipsRegistry::$request['ck'] == 'all' )
|
||||
@@ -206,7 +206,7 @@ class class_taskmanager
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( $this_task['task_application'] ) . '/tasks/' . $this_task['task_file'], 'task_item', $this_task['task_application'] );
|
||||
$myobj = new $classToLoad( $this->registry, $this, $this_task );
|
||||
$myobj->runTask();
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Any shutdown queries
|
||||
//-----------------------------------------
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package Core
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10914 $
|
||||
* @version $Rev: 12266 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -96,7 +96,8 @@ abstract class classes_comments_renderer
|
||||
* @param array
|
||||
*/
|
||||
protected $_settings;
|
||||
|
||||
protected $parser = null;
|
||||
|
||||
/**
|
||||
* CONSTRUCTOR
|
||||
*
|
||||
@@ -132,6 +133,17 @@ abstract class classes_comments_renderer
|
||||
$this->request['selectedpids'] = IPSCookie::get( 'commentmodpids' );
|
||||
$this->request['selectedpidcount'] = intval( count( preg_split( "/,/", $this->request['commentmodpids'], -1, PREG_SPLIT_NO_EMPTY ) ) );
|
||||
IPSCookie::set('commentmodpids', '', 0);
|
||||
|
||||
/* Load parser */
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser' );
|
||||
$this->parser = new $classToLoad();
|
||||
|
||||
/* set up parser */
|
||||
$this->parser->set( array( 'memberData' => $this->memberData,
|
||||
'parseBBCode' => 1,
|
||||
'parseHtml' => 0,
|
||||
'parseEmoticons' => 1,
|
||||
'parseArea' => 'comments' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -254,9 +266,13 @@ abstract class classes_comments_renderer
|
||||
$data['captcha'] = $this->getCaptcha();
|
||||
|
||||
/* Got a reply? */
|
||||
if ( !empty( $this->request['_rcid'] ) )
|
||||
if ( !empty( $this->request['_rcid'] ) && is_array( $this->request['_rcid'] ) )
|
||||
{
|
||||
$preReply = $this->fetchReply( $parent['parent_id'], $this->request['_rcid'], $this->memberData );
|
||||
$preReply = '';
|
||||
foreach ( $this->request['_rcid'] as $_rcid )
|
||||
{
|
||||
$preReply .= $this->fetchReply( $parent['parent_id'], $_rcid, $this->memberData );
|
||||
}
|
||||
}
|
||||
|
||||
/* Give plugin a chance to adjust */
|
||||
@@ -402,7 +418,7 @@ abstract class classes_comments_renderer
|
||||
$this->_unpackRepCache();
|
||||
|
||||
/* Joins */
|
||||
$_post_joins = array( array( 'select' => 'm.*',
|
||||
$_post_joins = array( array( 'select' => 'm.member_id as my_member_id, m.*',
|
||||
'where' => 'm.member_id=c.' . $_remap['comment_author_id'],
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'type' => 'left', ),
|
||||
@@ -452,11 +468,8 @@ abstract class classes_comments_renderer
|
||||
}
|
||||
|
||||
/* Set up parser */
|
||||
IPSText::getTextClass('bbcode')->parse_html = 0;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
|
||||
IPSText::getTextClass('bbcode')->parsing_section = $this->bbcodeSection();
|
||||
|
||||
$this->parser->set( array( 'parseArea' => $this->bbcodeSection() ) );
|
||||
|
||||
/* Allow plugin to add additional where clauses, or modify existing ones */
|
||||
$query = array( 'select' => 'c.*',
|
||||
'from' => array( $this->table() => 'c' ),
|
||||
@@ -478,10 +491,14 @@ abstract class classes_comments_renderer
|
||||
{
|
||||
/* Reset member ID */
|
||||
$row['member_id'] = $row[ $_remap['comment_author_id'] ];
|
||||
|
||||
if( !$row['member_id'] AND $row['my_member_id'] )
|
||||
{
|
||||
$row['member_id'] = $row['my_member_id'];
|
||||
}
|
||||
|
||||
/* Set up parser */
|
||||
IPSText::getTextClass('bbcode')->parsing_mgroup = $row['member_group_id'];
|
||||
IPSText::getTextClass('bbcode')->parsing_mgroup_others = $row['mgroup_others'];
|
||||
$this->parser->set( array( 'memberData' => $row ) );
|
||||
|
||||
/* Remap */
|
||||
$row = $this->remapFromLocal( $row );
|
||||
@@ -493,7 +510,7 @@ abstract class classes_comments_renderer
|
||||
$row['_db_comment'] = $row['comment_text'];
|
||||
|
||||
/* Parse for display */
|
||||
$row['comment_text'] = IPSText::getTextClass('bbcode')->preDisplayParse( $row['comment_text'] );
|
||||
$row['comment_text'] = $this->parser->display( $row['comment_text'] );
|
||||
|
||||
/* Can moderate? */
|
||||
if ( $this->can( 'moderate', array( 'comment_parent_id' => $parent['parent_id'] ) ) )
|
||||
@@ -525,9 +542,12 @@ abstract class classes_comments_renderer
|
||||
{
|
||||
$row['pp_reputation_points'] = $row['pp_reputation_points'] ? $row['pp_reputation_points'] : 0;
|
||||
$row['has_given_rep'] = $row['has_given_rep'] ? $row['has_given_rep'] : 0;
|
||||
$row['rep_points'] = $row['rep_points'] ? $row['rep_points'] : 0;
|
||||
$row['rep_points'] = $this->registry->repCache->getRepPoints( array( 'app' => $app, 'type' => $_remap['comment_id'], 'type_id' => $row['comment_id'], 'rep_points' => $row['rep_points'] ) );
|
||||
}
|
||||
|
||||
/* View */
|
||||
$row['_canView'] = ( $this->can('view', $row) === true ) ? 1 : 0;
|
||||
|
||||
/* Edit button */
|
||||
$row['_canEdit'] = ( $this->can('edit', $row) === true ) ? 1 : 0;
|
||||
|
||||
@@ -835,20 +855,18 @@ abstract class classes_comments_renderer
|
||||
{
|
||||
throw new Exception( 'NO_PERMISSION' );
|
||||
}
|
||||
|
||||
/* Format comment */
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = $this->bbcodeSection();
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite' );
|
||||
$editor = new $classToLoad();
|
||||
$editor->setBbcodeSection( $this->bbcodeSection() );
|
||||
$editor->setLegacyMode(false);
|
||||
|
||||
$comment = $editor->process( $post );
|
||||
|
||||
if ( !trim( $comment ) )
|
||||
{
|
||||
throw new Exception( 'NO_COMMENT' );
|
||||
}
|
||||
|
||||
$comment = IPSText::getTextClass( 'bbcode' )->preDbParse( $comment );
|
||||
|
||||
/* Build insert data */
|
||||
$array = array( 'comment_author_id' => intval( $memberData['member_id'] ),
|
||||
@@ -972,18 +990,15 @@ abstract class classes_comments_renderer
|
||||
throw new Exception( $can );
|
||||
}
|
||||
|
||||
/* Format post */
|
||||
IPSText::getTextClass('bbcode')->parse_html = 0;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_smilies = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
|
||||
IPSText::getTextClass('bbcode')->parsing_section = $this->bbcodeSection();
|
||||
/* Set up parser */
|
||||
$this->parser->set( array( 'parseArea' => $this->bbcodeSection() ) );
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite' );
|
||||
$editor = new $classToLoad();
|
||||
$editor->setBbcodeSection( $this->bbcodeSection() );
|
||||
$editor->setLegacyMode(false);
|
||||
|
||||
$comment = $editor->process( $post );
|
||||
$comment = IPSText::getTextClass( 'bbcode' )->preDbParse( $comment );
|
||||
|
||||
/* Update array */
|
||||
$array = array( 'comment_edit_date' => time(),
|
||||
@@ -1008,17 +1023,8 @@ abstract class classes_comments_renderer
|
||||
{
|
||||
$editor->removeAutoSavedContent( array( 'member_id' => $this->memberData['member_id'], 'autoSaveKey' => 'comment-' . $this->table() . '-c' . $commentId ) );
|
||||
}
|
||||
|
||||
/* Format and return */
|
||||
IPSText::getTextClass('bbcode')->parse_html = 0;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_smilies = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
|
||||
IPSText::getTextClass('bbcode')->parsing_section = $this->bbcodeSection();
|
||||
IPSText::getTextClass('bbcode')->parsing_mgroup = $this->memberData['member_group_id'];
|
||||
IPSText::getTextClass('bbcode')->parsing_mgroup_others = $this->memberData['mgroup_others'];
|
||||
|
||||
return IPSText::getTextClass('bbcode')->preDisplayParse( $comment );
|
||||
return $this->parser->display( $comment );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1074,7 +1080,7 @@ abstract class classes_comments_renderer
|
||||
else if ( is_array( $commentId ) )
|
||||
{
|
||||
/* Permission test */
|
||||
$can = $this->can('moderate', array( 'comment_parent_id' => $parentId ) );
|
||||
$can = $this->can('delete', array( 'comment_parent_id' => $parentId ) );
|
||||
|
||||
if ( $can !== true )
|
||||
{
|
||||
@@ -1263,11 +1269,11 @@ abstract class classes_comments_renderer
|
||||
|
||||
if ( $this->settings['strip_quotes'] )
|
||||
{
|
||||
$comment['comment']['comment_text'] = IPSText::getTextClass( 'bbcode' )->stripQuotes( $comment['comment']['_db_comment'] );
|
||||
$comment['comment']['comment_text'] = $this->parser->stripQuotes( $comment['comment']['_db_comment'] );
|
||||
}
|
||||
|
||||
$reply = "[quote name='" . IPSText::getTextClass('bbcode')->makeQuoteSafe( $comment['author']['members_display_name'] ) . "' timestamp='" . $comment['comment']['comment_date'] . "']<br />{$comment['comment']['comment_text']}<br />[/quote]<br /><br />";
|
||||
|
||||
$reply = $this->parser->buildQuoteTag( $comment['comment']['comment_text'], $comment['author']['members_display_name'], $comment['comment']['comment_date'] );
|
||||
|
||||
/* Throw, fetch and wag tail */
|
||||
return $reply;
|
||||
}
|
||||
@@ -1317,11 +1323,8 @@ abstract class classes_comments_renderer
|
||||
throw new Exception( $can );
|
||||
}
|
||||
|
||||
IPSText::getTextClass('bbcode')->parse_html = 0;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_smilies = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
|
||||
IPSText::getTextClass('bbcode')->parsing_section = $this->bbcodeSection();
|
||||
/* Set up parser */
|
||||
$this->parser->set( array( 'parseArea' => $this->bbcodeSection() ) );
|
||||
|
||||
/* Ayjacks? */
|
||||
if ( $type == 'ajax' )
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
* Invision Power Services
|
||||
* IP.Board v3.2.0
|
||||
* Custom Profile Fields
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2012-09-21 10:15:19 -0400 (Fri, 21 Sep 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @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
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10914 $
|
||||
* @version $Rev: 11360 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -208,7 +208,7 @@ class customProfileFields
|
||||
* @param bool $mlist Whether this is the memberlist or not
|
||||
* @return @e void
|
||||
*/
|
||||
public function initData( $type='view', $mlist=0 )
|
||||
public function initData( $type='view', $mlist=0, $attributes=array() )
|
||||
{
|
||||
/* Store Type */
|
||||
$this->type = $type;
|
||||
@@ -322,6 +322,18 @@ class customProfileFields
|
||||
'format' => isset( $v['pf_input_format'] ) ? $v['pf_input_format'] : '',
|
||||
'urlfilter' => isset( $v['pf_filtering'] ) ? $v['pf_filtering'] : '',
|
||||
);
|
||||
|
||||
if ( !empty( $attributes ) )
|
||||
{
|
||||
if ( !isset( $this->cache_data[$k]['attributes'] ) )
|
||||
{
|
||||
$this->cache_data[$k]['attributes'] = $attributes;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->cache_data[$k]['attributes'] = array_merge( $this->cache_data[$k]['attributes'], $attributes );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Kernel profile field class */
|
||||
@@ -331,7 +343,7 @@ class customProfileFields
|
||||
|
||||
IPSDebug::setMemoryDebugFlag( "Get CustomFields Kernel Class", $_NOW );
|
||||
|
||||
$this->cfields_obj = new $classToLoad( $this->cache_data, $type );
|
||||
$this->cfields_obj = new $classToLoad( $this->cache_data, $type, $attributes );
|
||||
$this->cfields = $this->cfields_obj->cfields;
|
||||
|
||||
$this->init = 1;
|
||||
@@ -549,7 +561,7 @@ class customProfileFields
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$this->out_fields[ $id ] = $field->getValue();
|
||||
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Editor Library: Core Class
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -14,7 +14,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 9th March 2005 11:03
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*
|
||||
* EXAMPLE USAGE
|
||||
* <code>
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Editor Library: RTE (WYSIWYG) Class
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -14,7 +14,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 9th March 2005 11:03
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
@@ -962,7 +962,7 @@ class class_editor_module extends class_editor
|
||||
|
||||
while ( $tag_begin_loc !== FALSE )
|
||||
{
|
||||
$lowtext = strtolower($text);
|
||||
$lowtext = mb_strtolower($text);
|
||||
$tag_begin_loc = @strpos( $lowtext, $open_tag, $start_search_pos );
|
||||
$lentext = strlen($text);
|
||||
$quoted = '';
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Editor Library: Standard Class
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -14,7 +14,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 9th March 2005 11:03
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -2,19 +2,19 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Parse Incoming Emails
|
||||
* Last Updated: $Date: 2012-06-01 11:18:06 -0400 (Fri, 01 Jun 2012) $
|
||||
* Last Updated: $Date: 2013-05-08 17:43:20 -0400 (Wed, 08 May 2013) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: mark $
|
||||
* @author $Author: bfarber $
|
||||
* @copyright © 2010 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @subpackage Kernel
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 25th June 2010
|
||||
* @version $Revision: 10854 $
|
||||
* @version $Revision: 12240 $
|
||||
*/
|
||||
|
||||
class incomingEmail
|
||||
@@ -35,7 +35,7 @@ class incomingEmail
|
||||
/**
|
||||
* Debug Mode
|
||||
*/
|
||||
protected $debug_mode = FALSE;
|
||||
protected $debug_mode = false;
|
||||
|
||||
/**
|
||||
* Preferred order for alterative parts
|
||||
@@ -64,7 +64,7 @@ class incomingEmail
|
||||
$this->DB->execute();
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$this->types[ $r['atype_mimetype'] ][] = $r;
|
||||
$this->types[ $r['atype_extension'] ] = $r;
|
||||
}
|
||||
|
||||
/* Set our preferred format */
|
||||
@@ -97,8 +97,8 @@ class incomingEmail
|
||||
//-----------------------------------------
|
||||
|
||||
// It raises strict warnings
|
||||
@error_reporting( E_NONE );
|
||||
@ini_set( 'display_errors', 'off' );
|
||||
//@error_reporting( E_NONE );
|
||||
//@ini_set( 'display_errors', 'off' );
|
||||
|
||||
require_once ( IPS_KERNEL_PATH . 'PEAR/Mail/mimeDecode.php' );/*noLibHook*/
|
||||
$decoder = new Mail_mimeDecode( $email );
|
||||
@@ -107,7 +107,7 @@ class incomingEmail
|
||||
'decode_bodies' => TRUE,
|
||||
'decode_headers' => TRUE,
|
||||
) );
|
||||
|
||||
|
||||
//--------------------------------------
|
||||
// Parse Headers
|
||||
//--------------------------------------
|
||||
@@ -188,11 +188,11 @@ class incomingEmail
|
||||
{
|
||||
if ( preg_match( "/.+? <(.+?)>/", $_cc, $matches ) )
|
||||
{
|
||||
$cc[] = htmlentities( $matches[1] );
|
||||
$cc[] = $matches[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
$cc[] = htmlentities( trim( $_cc, '<> ' ) );
|
||||
$cc[] = trim( $_cc, '<> ' );
|
||||
}
|
||||
}
|
||||
$obj->cc = str_replace( array( '>', '<' ), '', implode( ',', $cc ) );
|
||||
@@ -201,14 +201,14 @@ class incomingEmail
|
||||
// Ignore?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$obj->debug_mode )
|
||||
if ( !$obj->debug_mode and !$doNotRoute )
|
||||
{
|
||||
$escapedFrom = $obj->DB->addSlashes( $obj->from );
|
||||
$log = $obj->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_incoming_email_log', 'where' => "log_email='{$escapedFrom}'" ) );
|
||||
if ( $log['log_id'] )
|
||||
{
|
||||
$oneMinuteAgo = time() - 60;
|
||||
if ( $log['log_time'] > $oneMinuteAgo )
|
||||
if ( $log['log_time'] > $oneMinuteAgo && $this->settings['sixty_second_rule'] )
|
||||
{
|
||||
$ignore = TRUE;
|
||||
}
|
||||
@@ -229,29 +229,34 @@ class incomingEmail
|
||||
//-----------------------------------------
|
||||
// Now destruct the message
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$obj->message = '';
|
||||
$obj->_parsePart( $mail );
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Purify It
|
||||
//-----------------------------------------
|
||||
|
||||
// sometimes breaks
|
||||
$obj->message = str_replace( ' ', ' ', $obj->message );
|
||||
|
||||
|
||||
/* Load */
|
||||
require_once( IPS_KERNEL_PATH . 'HTMLPurifier/HTMLPurifier.auto.php' );
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
|
||||
|
||||
/* Set Configuration */
|
||||
$config->set( 'AutoFormat.Linkify', TRUE );
|
||||
$config->set( 'Core.Encoding', IPS_DOC_CHAR_SET );
|
||||
$config->set( 'HTML.TargetBlank', TRUE );
|
||||
$config->set( 'URI.Munge', ipsRegistry::getClass('output')->buildUrl('app=nexus&module=support§ion=redirect&url=%s&key=%t&resource=%r', 'public' ) );
|
||||
$config->set( 'URI.Munge', ipsRegistry::getClass('output')->buildUrl('app=nexus&module=support§ion=redirect&url=%s&key=%t&resource=%r', 'publicNoSession' ) );
|
||||
$config->set( 'URI.MungeResources', TRUE );
|
||||
$config->set( 'URI.MungeSecretKey', md5( ipsRegistry::$settings['sql_pass'] . ipsRegistry::$settings['board_url'] . ipsRegistry::$settings['sql_database'] ) );
|
||||
|
||||
|
||||
/* Retain collapse data attribute */
|
||||
$def = $config->getHTMLDefinition(true);
|
||||
$def->addAttribute( 'blockquote', 'data-author', 'CDATA' );
|
||||
$def->addAttribute( 'blockquote', 'data-collapsed', 'Number' );
|
||||
|
||||
/* Purify */
|
||||
$purifier = new HTMLPurifier( $config );
|
||||
$obj->message = $purifier->purify( $obj->message );
|
||||
@@ -381,6 +386,13 @@ class incomingEmail
|
||||
/* Some clients use uppercase, but we check by lowercase */
|
||||
$part->ctype_primary = strtolower( $part->ctype_primary );
|
||||
$part->ctype_secondary = strtolower( $part->ctype_secondary );
|
||||
|
||||
/* Make sure .txt files get attached as .txt files */
|
||||
if ( $part->ctype_primary == 'text' and $part->disposition == 'attachment' )
|
||||
{
|
||||
$part->ctype_primary = 'unknown';
|
||||
$part->ctype_secondary = 'unknown';
|
||||
}
|
||||
|
||||
/* What is this? */
|
||||
switch ( $part->ctype_primary )
|
||||
@@ -448,7 +460,7 @@ class incomingEmail
|
||||
|
||||
/* Text */
|
||||
case 'text':
|
||||
|
||||
|
||||
$body = $part->body;
|
||||
$this->original_message .= $body;
|
||||
|
||||
@@ -474,9 +486,10 @@ class incomingEmail
|
||||
}
|
||||
|
||||
// Convert
|
||||
//$body = IPSText::convertCharsets( $body, $part->ctype_parameters['charset'], IPS_DOC_CHAR_SET );
|
||||
$body = IPSText::convertCharsets( $body, $part->ctype_parameters['charset'], IPS_DOC_CHAR_SET );
|
||||
$part->ctype_parameters['charset'] = IPS_DOC_CHAR_SET;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse > style quotes
|
||||
//-----------------------------------------
|
||||
@@ -515,7 +528,7 @@ class incomingEmail
|
||||
if ( $quotableLine )
|
||||
{
|
||||
$this->message = substr( $this->message, 0, strrpos( $this->message, $quotableLine ) );
|
||||
$this->message .= "[quote collapse='{$quotableLine}']";
|
||||
$this->message .= "[quote collapse='1' name='" . str_replace( array( "\r", "\n" ), ' ', $quotableLine ) . "']";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -546,48 +559,48 @@ class incomingEmail
|
||||
//-----------------------------------------
|
||||
// Parse HTML block quotes
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
/* Loop */
|
||||
preg_match_all( '/<blockquote.+?>/s', $this->message, $matches );
|
||||
while ( !empty( $matches ) and !empty( $matches[0] ) )
|
||||
{
|
||||
$m = $matches[0][0];
|
||||
|
||||
|
||||
// Get all the content before the quote
|
||||
$stripped = substr( $this->message, 0, strpos( $this->message, $m ) );
|
||||
|
||||
|
||||
// Knock off any breaks or closed divs after it
|
||||
$stripped = preg_replace( '/<br.+?>/s', '', $stripped );
|
||||
$stripped = str_replace( '</div>', '', $stripped );
|
||||
|
||||
$stripped = trim( str_replace( '</div>', '', $stripped ) );
|
||||
$stripped = preg_replace( '/((<br(\s*\/)?>| )*$)/s', '', $stripped );
|
||||
|
||||
// Now scan back until we hit some other html
|
||||
$pos = strrpos( $stripped, '>' ) + 1;
|
||||
$stripped = trim( substr( $stripped, $pos ) );
|
||||
|
||||
|
||||
// If it's an acceptable header, use it
|
||||
if ( substr( $stripped, -1, 1 ) == ':' )
|
||||
{
|
||||
// Chop it out
|
||||
$this->message = substr_replace( $this->message, '', strpos( $this->message, $stripped ), strlen( $stripped ) );
|
||||
|
||||
|
||||
// We have to encode the header so future tags don't replace it
|
||||
$stripped = '{{QUOTE-ENCODE:' . base64_encode( $stripped ) . '}}';
|
||||
|
||||
// Replace the blockquote
|
||||
$this->message = substr_replace( $this->message, "[quote collapse='{$stripped}']", strpos( $this->message, $m ), strlen( $m ) );
|
||||
$this->message = substr_replace( $this->message, "[quote collapse='1' name='{$stripped}']", strpos( $this->message, $m ), strlen( $m ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Replace the blockquote
|
||||
// Replace the blockquote
|
||||
$this->message = substr_replace( $this->message, "[quote collapse='1']", strpos( $this->message, $m ), strlen( $m ) );
|
||||
}
|
||||
|
||||
// Do the scan again
|
||||
preg_match_all( '/<blockquote.+?>/s', $this->message, $matches );
|
||||
}
|
||||
|
||||
|
||||
/* Decode the quote headers we made */
|
||||
$this->message = preg_replace_callback( '/{{QUOTE-ENCODE:(.+?)}}/', create_function( '$m', 'return base64_decode( $m[1] );' ), $this->message );
|
||||
$this->message = preg_replace_callback( '/{{QUOTE-ENCODE:(.+?)}}/', create_function( '$m', 'return str_replace( array( "\r", "\n" ), " ", base64_decode( $m[1] ) );' ), $this->message );
|
||||
|
||||
/* Add in closing [/quote] tags */
|
||||
$this->message = preg_replace( '/<\/blockquote>/', '[/quote]', $this->message );
|
||||
@@ -608,49 +621,139 @@ class incomingEmail
|
||||
|
||||
if ( preg_match( '/-{10,}\s+(.+?)\s-{10,}/', $this->message, $matches ) )
|
||||
{
|
||||
$this->message = str_replace( $matches[0], "[quote collapse='{$matches[1]}']", $this->message );
|
||||
$this->message = str_replace( $matches[0], "[quote collapse='1']", $this->message );
|
||||
$this->message .= '[/quote]';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Look for common quote encapsulation methods
|
||||
//-----------------------------------------
|
||||
|
||||
if( strpos( $this->message, 'OLK_SRC_BODY_SECTION' ) !== false )
|
||||
{
|
||||
if ( preg_match( '/<span id=["\']OLK_SRC_BODY_SECTION[\'"]>/ims', $this->message, $matches ) )
|
||||
{
|
||||
$this->message = str_replace( $matches[0], "[quote collapse='1']{$matches[0]}", $this->message );
|
||||
|
||||
if( strpos( $this->message, '</body>' ) !== false )
|
||||
{
|
||||
$this->message = str_replace( '</body>', "[/quote]</body>", $this->message );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->message .= '[/quote]';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( strpos( $this->message, 'MsoNormal' ) !== false ) // This must be from Outlook
|
||||
{
|
||||
if ( preg_match( '/<div style=["\'].+?border-top:.+?[\'"]>.*?<p class=["\']MsoNormal["\']>(.+)<\/div>/ims', $this->message, $matches ) )
|
||||
{
|
||||
$this->message = str_replace( $matches[0], "[quote collapse='1']{$matches[0]}[/quote]", $this->message );
|
||||
}
|
||||
}
|
||||
|
||||
// This code does work, however:
|
||||
// --Differing email clients have differing formats, so it's not reliable
|
||||
// --There can be cases where you have [quote collapse='1' name='On date, at time, so and so wrote:'] already, which results in [quote name='[quote ...]'], breaking the parsing
|
||||
/*if( preg_match( '/\bon\s+?.+?,\s*?at.+?,\s*?' . $this->settings['board_name'] . '.+?' . $this->settings['email_out'] . '.+?wrote:/ims', $this->message, $matches ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// If there's an opening <div> right after this, go there instead
|
||||
// but only if we're not going to strip quotes (otherwise we get a stray "blah blah said:" line)
|
||||
//-----------------------------------------
|
||||
|
||||
if( strpos( $this->message, "<div>", strpos( $this->message, $matches[0] ) ) !== false )
|
||||
{
|
||||
$matches[0] = substr( $this->message, strpos( $this->message, $matches[0] ), strpos( $this->message, "<div>", strpos( $this->message, $matches[0] ) ) - strpos( $this->message, $matches[0] ) + 5 );
|
||||
|
||||
$this->message = str_replace( $matches[0], "{$matches[0]}[quote collapse='1']", $this->message );
|
||||
$this->message = preg_replace( "/<\/div>\s*?<\/body>/", "[/quote]</div></body>", $this->message );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->message = str_replace( $matches[0], "{$matches[0]}[quote collapse='1']", $this->message );
|
||||
|
||||
if( strpos( $this->message, '</body>' ) !== false )
|
||||
{
|
||||
$this->message = str_replace( '</body>', "[/quote]</body>", $this->message );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->message .= '[/quote]';
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/* Are we missing any closing tags? */
|
||||
$_opening = substr_count( $this->message, '[quote ' );
|
||||
$_closing = substr_count( $this->message, '[/quote]' );
|
||||
|
||||
if( $_opening > $_closing )
|
||||
{
|
||||
for( $i = $_opening; $i < $_closing; $i++ )
|
||||
{
|
||||
$this->message .= '[/quote]';
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse the quote tag
|
||||
//-----------------------------------------
|
||||
|
||||
//$this->message = preg_replace( "/\[quote collapse='(.*?)'\]/ims", "<blockquote class='ipsBlockquote' data-collapsed='\\1'>", $this->message );
|
||||
//$this->message = str_replace( "[/quote]", "</blockquote>", $this->message );
|
||||
|
||||
/* Parse BBCode */
|
||||
IPSText::getTextClass('bbcode')->parse_html = 0;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_smilies = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
|
||||
IPSText::getTextClass('bbcode')->parsing_section = 'support';
|
||||
|
||||
$this->message = IPSText::getTextClass('bbcode')->parseSingleBbcodes( $this->message, 'display', 'quote' );
|
||||
|
||||
return;
|
||||
|
||||
/* Attachments */
|
||||
default:
|
||||
|
||||
if ( $part->ctype_primary == '_text' )
|
||||
{
|
||||
$part->ctype_primary = 'text';
|
||||
}
|
||||
|
||||
$mime = "{$part->ctype_primary}/{$part->ctype_secondary}";
|
||||
|
||||
$content = "{ATTACHMENT WITH INCOMPATIBLE MIME TYPE: {$mime}}";
|
||||
$name = $part->ctype_parameters['name'] ? $part->ctype_parameters['name'] : $part->d_parameters['filename'];
|
||||
$name_parts = explode( '.', $name );
|
||||
$ext = array_pop( $name_parts );
|
||||
|
||||
if ( isset( $this->types[ $mime ] ) )
|
||||
$content = "{ATTACHMENT WITH EXTENSION: {$ext}}";
|
||||
|
||||
if ( isset( $this->types[ $ext ] ) and $this->types[ $ext ]['atype_post'] )
|
||||
{
|
||||
foreach ( $this->types[ $mime ] as $data )
|
||||
/* Create the file */
|
||||
$masked_name = md5( uniqid( 'email' ) ) . "-{$name}";
|
||||
while ( is_file( $this->settings['upload_dir'] . "/{$masked_name}" ) )
|
||||
{
|
||||
$name_parts = explode( '.', $part->ctype_parameters['name'] );
|
||||
$ext = array_pop( $name_parts );
|
||||
if ( strtolower( $data['atype_extension'] ) == strtolower( $ext ) and $data['atype_post'] )
|
||||
{
|
||||
/* Create the file */
|
||||
$masked_name = md5( uniqid( 'email' ) ) . "-{$part->ctype_parameters['name']}";
|
||||
while ( is_file( $this->settings['upload_dir'] . "/{$masked_name}" ) )
|
||||
{
|
||||
$masked_name = md5( uniqid( 'email' ) . microtime() ) . "-{$part->ctype_parameters['name']}";
|
||||
}
|
||||
file_put_contents( $this->settings['upload_dir'] . "/{$masked_name}", $part->body );
|
||||
|
||||
/* Store attachment data */
|
||||
$this->akey++;
|
||||
$this->attachments[ $this->akey ] = array(
|
||||
'attach_ext' => $ext,
|
||||
'attach_file' => $part->ctype_parameters['name'],
|
||||
'attach_location' => $masked_name,
|
||||
'attach_is_image' => ( $part->ctype_primary == 'image' ) ? 1 : 0,
|
||||
'attach_date' => time(),
|
||||
'attach_filesize' => $part->d_parameters['size'],
|
||||
);
|
||||
$content = "{ATTACHMENT:{$this->akey}}";
|
||||
break;
|
||||
}
|
||||
$masked_name = md5( uniqid( 'email' ) . microtime() ) . "-{$name}";
|
||||
}
|
||||
file_put_contents( $this->settings['upload_dir'] . "/{$masked_name}", $part->body );
|
||||
|
||||
/* Store attachment data */
|
||||
$this->akey++;
|
||||
$this->attachments[ $this->akey ] = array(
|
||||
'attach_ext' => $ext,
|
||||
'attach_file' => $name,
|
||||
'attach_location' => $masked_name,
|
||||
'attach_is_image' => ( $part->ctype_primary == 'image' ) ? 1 : 0,
|
||||
'attach_date' => time(),
|
||||
'attach_filesize' => $part->d_parameters['size'],
|
||||
);
|
||||
$content = "{ATTACHMENT:{$this->akey}}";
|
||||
break;
|
||||
}
|
||||
|
||||
$addedContent = FALSE;
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Item Marking
|
||||
* Owner: Matt "Oh Lord, why did I get assigned this?" Mecham
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2012-11-06 15:14:35 -0500 (Tue, 06 Nov 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 9th March 2005 11:03
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 11565 $
|
||||
*
|
||||
* @todo [Future] Perhaps find more ways to reduce the size of items_read
|
||||
* @todo [Future] Maybe add an IN_DEV tool to warn when markers have been cancelled out / size drastically reduced
|
||||
@@ -230,7 +230,7 @@ class classItemMarking
|
||||
/* Clean up */
|
||||
if ( $this->_cookie[ 'itemMarking_' . $_app . '_items'] )
|
||||
{
|
||||
$_items = ( is_array( $this->_cookie[ 'itemMarking_' . $_app . '_items'] ) ) ? $this->_cookie[ 'itemMarking_' . $_app . '_items'] : unserialize( $this->_cookie[ 'itemMarking_' . $_app . '_items'] );
|
||||
$_items = ( is_array( $this->_cookie[ 'itemMarking_' . $_app . '_items'] ) ) ? $this->_cookie[ 'itemMarking_' . $_app . '_items'] : json_decode( $this->_cookie[ 'itemMarking_' . $_app . '_items'], true );
|
||||
|
||||
$this->_cookieCounter = 0;
|
||||
arsort( $_items, SORT_NUMERIC );
|
||||
@@ -241,10 +241,10 @@ class classItemMarking
|
||||
|
||||
IPSDebug::addMessage( 'Cookie loaded: itemMarking_' . $_app . '_items' . ' - ' . serialize( $_newData ) );
|
||||
IPSDebug::addMessage( 'Cookie loaded: itemMarking_' . $_app . ' - ' . serialize( $_value ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IPSDebug::setMemoryDebugFlag( "Topic markers initialized", $_NOW );
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ class classItemMarking
|
||||
{
|
||||
if ( is_array( $data ) )
|
||||
{
|
||||
$data = serialize( $data );
|
||||
$data = json_encode( $data );
|
||||
}
|
||||
|
||||
$data = strtr( base64_encode( addslashes( @gzcompress( $data ) ) ), '+/=', '-_,' );
|
||||
@@ -278,7 +278,7 @@ class classItemMarking
|
||||
* @return string Uncompressed data
|
||||
*/
|
||||
protected function _inflateCookie( $data )
|
||||
{
|
||||
{
|
||||
/* already inflated? */
|
||||
if ( ! $data OR is_array( $data ) )
|
||||
{
|
||||
@@ -288,11 +288,8 @@ class classItemMarking
|
||||
if ( $this->_canCompressCookies )
|
||||
{
|
||||
$data = @gzuncompress( stripslashes( base64_decode( strtr( $data, '-_,', '+/=' ) ) ) );
|
||||
|
||||
if ( substr( $data, 0, 2 ) == 'a:' )
|
||||
{
|
||||
$data = unserialize( $data );
|
||||
}
|
||||
|
||||
$data = json_decode( $data, true );
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
@@ -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: ips_terabyte $
|
||||
* $Author: bfarber $
|
||||
* @since 11th October 2010
|
||||
* $LastChangedDate: 2012-06-18 11:11:25 -0400 (Mon, 18 Jun 2012) $
|
||||
* @version v3.3.4
|
||||
* $Revision: 10937 $
|
||||
* $LastChangedDate: 2013-05-17 19:05:15 -0400 (Fri, 17 May 2013) $
|
||||
* @version v3.4.5
|
||||
* $Revision: 12259 $
|
||||
*
|
||||
* <b>Example Usage:</b>
|
||||
* @code
|
||||
@@ -166,6 +166,67 @@ class classes_like_registry
|
||||
trigger_error( "Member ID missing in " . __CLASS__ . '::' . __FUNCTION__, E_USER_WARNING );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build key for SQL query
|
||||
*
|
||||
*
|
||||
* @param integer $relId Relationship ID
|
||||
* @param string $memberField Member Field or value
|
||||
* @return @e binary Binary key
|
||||
*/
|
||||
static public function getKeyForSql( $relId, $memberField=NULL )
|
||||
{
|
||||
/* Check */
|
||||
if ( empty( $relId ) AND empty( $memberField ) )
|
||||
{
|
||||
//var_dump(IPSDebug::prettifyBackTrace(debug_backtrace()));exit;
|
||||
trigger_error( "Relationship ID missing in " . __CLASS__ . '::' . __FUNCTION__, E_USER_WARNING );
|
||||
}
|
||||
|
||||
if ( $memberField === null )
|
||||
{
|
||||
/* For relative item only */
|
||||
return ipsRegistry::DB()->buildMd5Statement( ipsRegistry::DB()->buildConcat( array(
|
||||
array( self::$app, 'string' ),
|
||||
array( ';', 'string' ),
|
||||
array( self::$area, 'string' ),
|
||||
array( ';', 'string' ),
|
||||
array( $relId, 'string' ),
|
||||
) ) );
|
||||
}
|
||||
else if ( ! empty( $memberField ) )
|
||||
{
|
||||
if ( $relId === null )
|
||||
{
|
||||
/* For member speciifc relative item */
|
||||
return ipsRegistry::DB()->buildMd5Statement( ipsRegistry::DB()->buildConcat( array(
|
||||
array( self::$app, 'string' ),
|
||||
array( ';', 'string' ),
|
||||
array( self::$area, 'string' ),
|
||||
array( ';', 'string' ),
|
||||
array( $memberField ),
|
||||
) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* For member speciifc relative item */
|
||||
return ipsRegistry::DB()->buildMd5Statement( ipsRegistry::DB()->buildConcat( array(
|
||||
array( self::$app, 'string' ),
|
||||
array( ';', 'string' ),
|
||||
array( self::$area, 'string' ),
|
||||
array( ';', 'string' ),
|
||||
array( $relId, 'string' ),
|
||||
array( ';', 'string' ),
|
||||
array( $memberField ),
|
||||
) ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error( "Member ID missing in " . __CLASS__ . '::' . __FUNCTION__, E_USER_WARNING );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -406,6 +467,14 @@ abstract class classes_like_composite
|
||||
*/
|
||||
protected $_area;
|
||||
|
||||
/**
|
||||
* Can bypass permission checks
|
||||
*
|
||||
* @var $_area
|
||||
*/
|
||||
protected $_bypassPermissionChecks = false;
|
||||
|
||||
|
||||
/**
|
||||
* Init all. Yes, it is.
|
||||
*
|
||||
@@ -549,6 +618,16 @@ abstract class classes_like_composite
|
||||
trigger_error( "Data missing in " . __CLASS__ . '::' . __FUNCTION__, E_USER_WARNING );
|
||||
}
|
||||
|
||||
if ( isset( $notificationOpts['notification_bypass_permission_checks'] ) && $notificationOpts['notification_bypass_permission_checks'] === true )
|
||||
{
|
||||
$this->_bypassPermissionChecks = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make sure this is reset (Not used currently) */
|
||||
$this->_bypassPermissionChecks = false;
|
||||
}
|
||||
|
||||
$type = is_array($type) ? $type : array( $type );
|
||||
|
||||
/* Use session expiration, unless it is longer than 1 hour, then limit to 1 hour */
|
||||
@@ -630,10 +709,10 @@ abstract class classes_like_composite
|
||||
|
||||
/* Add in unsubscribe link */
|
||||
$key = $row['like_app'] . ';' . $row['like_area'] . ';' . $row['like_rel_id'] . ';' . $row['like_member_id'] . ';' . $row['member_id'] . ';' . $row['email'];
|
||||
$buildMessage['UNSUBCRIBE_URL'] = $this->registry->output->buildSEOUrl( 'app=core&module=global&section=like&do=unsubscribe&key=' . IPSText::base64_encode_urlSafe( $key ), 'public', 'unsubscribe', 'likeunsubscribe' );
|
||||
$buildMessage['UNSUBCRIBE_URL'] = $this->registry->output->buildSEOUrl( 'app=core&module=global&section=like&do=unsubscribe&key=' . IPSText::base64_encode_urlSafe( $key ), 'publicNoSession', 'unsubscribe', 'likeunsubscribe' );
|
||||
|
||||
IPSText::getTextClass('email')->setPlainTextTemplate( IPSText::getTextClass('email')->getTemplate( $notificationOpts['email_template'], $row['language'], trim($notificationOpts['email_lang_file']), trim($notificationOpts['email_lang_app']) ) );
|
||||
IPSText::getTextClass('email')->buildMessage( $buildMessage );
|
||||
IPSText::getTextClass('email')->buildPlainTextContent( $buildMessage );
|
||||
|
||||
$notifyLibrary->setMember( $row );
|
||||
$notifyLibrary->setFrom( $notificationOpts['from'] ? $notificationOpts['from'] : $this->memberData );
|
||||
@@ -641,6 +720,7 @@ abstract class classes_like_composite
|
||||
$notifyLibrary->setNotificationUrl( $notificationOpts['notification_url'] );
|
||||
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->getPlainTextContent() );
|
||||
$notifyLibrary->setNotificationTitle( $notificationOpts['email_subject'] ? $notificationOpts['email_subject'] : IPSText::getTextClass('email')->subject );
|
||||
$notifyLibrary->setNotificationHtml( IPSText::getTextClass('email')->buildHtmlContent( $buildMessage ) );
|
||||
|
||||
if ( ! empty( $notificationOpts['email_only_subject'] ) && $notificationOpts['email_only_subject'] != IPSText::getTextClass('email')->subject )
|
||||
{
|
||||
@@ -672,12 +752,13 @@ abstract class classes_like_composite
|
||||
* @see allowedFrequencies()
|
||||
*/
|
||||
public function sendDigestNotifications( $type, $sendMax=null )
|
||||
{
|
||||
{
|
||||
/* Fetch data */
|
||||
$blackhole = time(); // mktime( 0, 0 ); - http://community.invisionpower.com/tracker/issue-35320-daily-digests-every-2-days
|
||||
$time = ( $type == 'daily' ) ? $blackhole - ( 86400 ) : $blackhole - ( 86400 * 7 );
|
||||
// The below has been changed based on troubleshooting in a ticket, 10.17.2012. With the code below not commented out, for a weekly digest we grab 15-7 days ago, rather than 8-0 days ago to send.
|
||||
$time = $blackhole; //( $type == 'daily' ) ? $blackhole - ( 86400 ) : $blackhole - ( 86400 * 7 );
|
||||
$data = $this->getDataByAreaAndLastSentOlderThanDate( $time, array( $type ), false, $sendMax );
|
||||
|
||||
|
||||
if ( ! count( $data ) )
|
||||
{
|
||||
return false;
|
||||
@@ -699,7 +780,8 @@ abstract class classes_like_composite
|
||||
|
||||
if ( $oldestPossDate )
|
||||
{
|
||||
$this->DB->update( 'core_like', array( 'like_notify_sent' => IPS_UNIX_TIME_NOW ), 'like_notify_sent < ' . $oldestPossDate );
|
||||
$this->DB->update( 'core_like', array( 'like_notify_sent' => IPS_UNIX_TIME_NOW ),
|
||||
'like_app=\'' . classes_like_registry::getApp() . '\' AND like_area=\'' . classes_like_registry::getArea() . '\' AND like_notify_sent < ' . $oldestPossDate . " AND like_notify_freq='{$type}'" );
|
||||
}
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
|
||||
@@ -729,7 +811,7 @@ abstract class classes_like_composite
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$buildMessage = array();
|
||||
|
||||
if ( is_array( $notificationOpts['build_message_array'] ) and count( $notificationOpts['build_message_array'] ) )
|
||||
@@ -744,23 +826,28 @@ abstract class classes_like_composite
|
||||
$buildMessage[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add in unsubscribe link */
|
||||
$key = $row['like_app'] . ';' . $row['like_area'] . ';' . $row['like_rel_id'] . ';' . $row['like_member_id'] . ';' . $row['member_id'] . ';' . $row['email'];
|
||||
$buildMessage['UNSUBCRIBE_URL'] = $this->registry->output->buildSEOUrl( 'app=core&module=global&section=like&do=unsubscribe&key=' . IPSText::base64_encode_urlSafe( $key ), 'publicNoSession', 'unsubscribe', 'likeunsubscribe' );
|
||||
|
||||
IPSText::getTextClass('email')->setPlainTextTemplate( IPSText::getTextClass('email')->getTemplate( $notificationOpts['email_template'], $row['language'], trim($notificationOpts['email_lang_file']), trim($notificationOpts['email_lang_app']) ) );
|
||||
IPSText::getTextClass('email')->buildPlainTextContent( $buildMessage );
|
||||
|
||||
IPSText::getTextClass('email')->getTemplate( $notificationOpts['email_template'], $row['language'], trim($notificationOpts['email_lang_file']), trim($notificationOpts['email_lang_app']) );
|
||||
IPSText::getTextClass('email')->buildMessage( $buildMessage );
|
||||
|
||||
$notifyLibrary->setMember( $row );
|
||||
$notifyLibrary->setFrom( $notificationOpts['from'] ? $notificationOpts['from'] : $this->memberData );
|
||||
$notifyLibrary->setNotificationKey( $notificationOpts['notification_key'] );
|
||||
$notifyLibrary->setNotificationUrl( $notificationOpts['notification_url'] );
|
||||
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->message );
|
||||
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->getPlainTextContent() );
|
||||
$notifyLibrary->setNotificationTitle( $notificationOpts['email_subject'] ? $notificationOpts['email_subject'] : IPSText::getTextClass('email')->subject );
|
||||
$notifyLibrary->setNotificationHtml( IPSText::getTextClass('email')->buildHtmlContent( $buildMessage ) );
|
||||
|
||||
try
|
||||
{
|
||||
$notifyLibrary->sendNotification();
|
||||
}
|
||||
catch( Exception $e ){ }
|
||||
|
||||
|
||||
/* Update sent timestamp */
|
||||
$this->DB->update( 'core_like', array( 'like_notify_sent' => IPS_UNIX_TIME_NOW ), 'like_id=\'' . classes_like_registry::getKey( $row['like_rel_id'], $row['like_member_id'] ) . '\'' );
|
||||
}
|
||||
@@ -923,7 +1010,7 @@ abstract class classes_like_composite
|
||||
/* Do it? */
|
||||
if ( count( $dupes ) )
|
||||
{
|
||||
$this->DB->delete( 'core_like' , "like_cache IN('" . implode( "','", array_map( 'addslashes', $dupes ) ) . "')" );
|
||||
$this->DB->delete( 'core_like' , "like_id IN('" . implode( "','", array_map( 'addslashes', $dupes ) ) . "')" );
|
||||
}
|
||||
|
||||
/* Now re-update so that hashes are correct */
|
||||
@@ -1227,23 +1314,31 @@ abstract class classes_like_composite
|
||||
$members = array();
|
||||
$rows = array();
|
||||
$followType = is_array( $followType ) ? $followType : array( $followType );
|
||||
$_isAnon = $skipAnon ? 'AND like_is_anon=0' : '';
|
||||
$_whereB = $this->memberData['member_id'] ? " OR like_id='" . classes_like_registry::getKey( $relId, $this->memberData['member_id'] ) . "'" : '';
|
||||
|
||||
|
||||
/* Determine where clause */
|
||||
$where = array( "like_visible=1", "like_is_anon" . ( $skipAnon ? '=0' : ' IN(0,1)' ) );
|
||||
|
||||
/*if( $this->memberData['member_id'] )
|
||||
{
|
||||
$where[] = "(like_lookup_id='" . classes_like_registry::getKey( $relId ) . "' OR like_id='" . classes_like_registry::getKey( $relId, $this->memberData['member_id'] ) . "')";
|
||||
}
|
||||
else
|
||||
{*/
|
||||
$where[] = "like_lookup_id='" . classes_like_registry::getKey( $relId ) . "'";
|
||||
//}
|
||||
|
||||
/* Add in follow type */
|
||||
if ( count( $followType ) )
|
||||
{
|
||||
$_whereB .= " AND like_notify_freq IN ('" . implode( "','", $followType ) ."')";
|
||||
$where[] = "like_notify_freq IN ('" . implode( "','", $followType ) ."')";
|
||||
}
|
||||
|
||||
/* Fetch data */
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'core_like',
|
||||
'where' => "((like_lookup_id='" . classes_like_registry::getKey( $relId ) . "' {$_isAnon}) {$_whereB}) AND like_visible=1",
|
||||
'where' => implode( " AND ", $where ),
|
||||
'order' => 'like_added DESC',
|
||||
'limit' => array( 0, 500 ) ) );
|
||||
|
||||
|
||||
$o = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $o ) )
|
||||
@@ -1329,18 +1424,16 @@ abstract class classes_like_composite
|
||||
|
||||
if ( in_array( 'weekly', $types ) )
|
||||
{
|
||||
/* Grab 8 days to account for timezone differences */
|
||||
$oldestPossDate = $date - ( 86400 * 8 );
|
||||
$oldestPossDate = $date - ( 86400 * 7 );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Grab 2 days to account for timezone differences */
|
||||
$oldestPossDate = $date - ( 86400 * 2 );
|
||||
$oldestPossDate = $date - ( 86400 );
|
||||
}
|
||||
|
||||
if ( $oldestPossDate )
|
||||
{
|
||||
$where .= ' AND ( CASE WHEN l.like_notify_sent > 0 THEN l.like_notify_sent ELSE l.like_added END ) > ' . intval( $oldestPossDate );
|
||||
$where .= ' AND ( CASE WHEN l.like_notify_sent > 0 THEN l.like_notify_sent ELSE l.like_added END ) < ' . intval( $oldestPossDate );
|
||||
}
|
||||
|
||||
/* Fetch data */
|
||||
@@ -1351,6 +1444,7 @@ abstract class classes_like_composite
|
||||
'limit' => array( 0, $sendMax ),
|
||||
'add_join' => $joins ) );
|
||||
|
||||
|
||||
$o = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $o ) )
|
||||
@@ -1361,7 +1455,10 @@ abstract class classes_like_composite
|
||||
/* Need to apply secondary groups and grab g_perm_id if $parseMembers is false (default)
|
||||
@link http://community.invisionpower.com/tracker/issue-34691-digest-notifications-not-going-out/ */
|
||||
$row['mgroup_others'] = ($row['mgroup_others'] != '') ? IPSText::cleanPermString($row['mgroup_others']) : '';
|
||||
//by denchu
|
||||
if (is_array($this->caches['group_cache'][ $row['member_group_id'] ])){
|
||||
$row = array_merge( $row, $this->caches['group_cache'][ $row['member_group_id'] ] );
|
||||
}
|
||||
$row = $this->registry->member()->setUpSecondaryGroups( $row );
|
||||
|
||||
if( $row['topic_last_post'] )
|
||||
@@ -1372,7 +1469,7 @@ abstract class classes_like_composite
|
||||
/* @link http://community.invisionpower.com/tracker/issue-32204-dailyweekly-notifications */
|
||||
$data[ $row['like_member_id'] ][ $row['like_id'] ] = $row;
|
||||
}
|
||||
|
||||
|
||||
/* Just the one? */
|
||||
if ( $parseMembers && count($mids) )
|
||||
{
|
||||
@@ -1647,6 +1744,52 @@ abstract class classes_like_composite
|
||||
|
||||
return $langString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace all likes on one item with another
|
||||
* Used when merging two items
|
||||
*
|
||||
* @param int $id1 The ID of the item being deleted
|
||||
* @param int $id2 The ID of the item being kept
|
||||
*/
|
||||
public function merge( $id1, $id2 )
|
||||
{
|
||||
/* We need to tell the driver not to escape our md5 compilation statements */
|
||||
$_fieldEncapsulate = $this->DB->fieldEncapsulate;
|
||||
$this->DB->fieldEncapsulate = '';
|
||||
$this->DB->manual_addslashes = TRUE;
|
||||
|
||||
/* Run the query - this looks a bit nuts, but basically we're setting any records for
|
||||
likes on the old item to now be likes on the new, unelss the user has already liked
|
||||
the new, in which case do nothing and we'll delete the left-overs in a minute */
|
||||
$this->DB->update(
|
||||
array( 'core_like' => 'a' ),
|
||||
$this->DB->compileUpdateString( array(
|
||||
'a.like_id' => classes_like_registry::getKeyForSql( $id2, 'a.like_member_id' ),
|
||||
'a.like_lookup_id' => classes_like_registry::getKeyForSql( $id2 ),
|
||||
'a.like_lookup_area'=> classes_like_registry::getKeyForSql( null, 'a.like_member_id' ),
|
||||
'a.like_rel_id' => intval( $id2 ),
|
||||
) ),
|
||||
"a.like_app='{$this->_app}' AND a.like_area='{$this->_area}' AND a.like_rel_id={$id1} AND b.like_id " . $this->DB->buildIsNull(),
|
||||
false,
|
||||
true,
|
||||
array( array(
|
||||
'from' => array( 'core_like' => 'b' ),
|
||||
'where' => "b.like_app='{$this->_app}' AND b.like_area='{$this->_area}' AND b.like_rel_id={$id2}",
|
||||
) )
|
||||
);
|
||||
|
||||
/* Reset the DB driver */
|
||||
$this->DB->manual_addslashes = FALSE;
|
||||
$this->DB->fieldEncapsulate = $_fieldEncapsulate;
|
||||
|
||||
/* Remove any stragglers (would happen if user was subscribed to both topics */
|
||||
$this->remove( $id1 );
|
||||
|
||||
/* Reset the cache */
|
||||
classes_like_cache::getInstance()->isNowStale( $id1 );
|
||||
classes_like_cache::getInstance()->isNowStale( $id2 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1836,7 +1979,7 @@ class classes_like_cache
|
||||
'where' => 'like_lookup_id=\'' . classes_like_registry::getKey( $relId ) . '\' AND like_is_anon=0 AND like_visible=1',
|
||||
'order' => 'like_added DESC',
|
||||
'limit' => array( 0, 5 ) ) );
|
||||
|
||||
|
||||
$o = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch($o) )
|
||||
@@ -1844,7 +1987,7 @@ class classes_like_cache
|
||||
$items[ $row['like_rel_id'] ] = $row;
|
||||
$mids[ $row['like_member_id'] ] = $row['like_member_id'];
|
||||
}
|
||||
|
||||
|
||||
/* Load members */
|
||||
$members = IPSMember::load( $mids, 'core' );
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Generic Mapping Class
|
||||
* Owner: Matt Mecham
|
||||
* 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 $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
@@ -14,7 +14,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 9th March 2005 11:03
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Bing mapping class
|
||||
* Owner: Matt Mecham
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2013-04-30 21:56:42 -0400 (Tue, 30 Apr 2013) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
@@ -14,7 +14,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 9th March 2005 11:03
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 12209 $
|
||||
*/
|
||||
|
||||
class classes_mapping_bing extends classes_mapping_composite
|
||||
@@ -204,13 +204,17 @@ class classes_mapping_bing extends classes_mapping_composite
|
||||
|
||||
/* Try from cache */
|
||||
$images = $this->_getImagesFromCache( $lat, $lon, $size );
|
||||
|
||||
|
||||
/* Lets do it. */
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classFileManagement.php', 'classFileManagement' );
|
||||
$file = new $classToLoad();
|
||||
|
||||
if ( $images === false )
|
||||
{
|
||||
/* Fetch live */
|
||||
if ( $_data_0 = @file_get_contents( $image0 ) )
|
||||
if ( $_data_0 = $file->getFileContents( $image0 ) )
|
||||
{
|
||||
$_data_1 = @file_get_contents( $image1 );
|
||||
$_data_1 = $file->getFileContents( $image1 );
|
||||
|
||||
/* Attempt to write cache */
|
||||
if ( $this->_setImageCache( $lat, $lon, $size, 0, $_data_0 ) !== false )
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Bing mapping class
|
||||
* Owner: Matt Mecham
|
||||
* 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 $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
@@ -14,7 +14,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 9th March 2005 11:03
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*/
|
||||
|
||||
class classes_mapping_google extends classes_mapping_composite
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -3,18 +3,18 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Notification library
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2012-10-30 18:24:46 -0400 (Tue, 30 Oct 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $ (Original: bfarber)
|
||||
* @author $Author: AndyMillne $ (Original: bfarber)
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since Thursday Jan 7, 2010
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 11530 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -89,7 +89,8 @@ class notifications
|
||||
*/
|
||||
protected $_notificationText_forDisplay = '';
|
||||
protected $_notificationText_forEmails = '';
|
||||
|
||||
protected $_notificationHtml = '';
|
||||
|
||||
/**
|
||||
* Notification title
|
||||
*
|
||||
@@ -275,6 +276,15 @@ class notifications
|
||||
$this->_notificationText_forEmails = $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set notification HTML for emails
|
||||
* @param string $html
|
||||
*/
|
||||
public function setNotificationHtml( $html )
|
||||
{
|
||||
$this->_notificationHtml = $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set notification text
|
||||
*
|
||||
@@ -640,7 +650,7 @@ class notifications
|
||||
}
|
||||
|
||||
$_config = $this->getMemberNotificationConfig( $r );
|
||||
|
||||
|
||||
/* update msg show notification for inline pop-up */
|
||||
if ( in_array( $this->_notificationKey, $this->_showInlinePopUp ) )
|
||||
{
|
||||
@@ -752,15 +762,16 @@ class notifications
|
||||
}
|
||||
|
||||
$subject = ( ! empty( $this->_emailTitle ) ) ? strip_tags( $this->_emailTitle ) : strip_tags( $this->_notificationTitle );
|
||||
|
||||
|
||||
/* Add to mail queue */
|
||||
$this->DB->insert( 'mail_queue', array( 'mail_to' => $to,
|
||||
'mail_cc' => ( count($cc) ? implode( ',', $cc ) : '' ),
|
||||
'mail_from' => $this->settings['email_out'],
|
||||
'mail_date' => time(),
|
||||
'mail_html_on' => intval( $this->_mail_html_on ),
|
||||
'mail_subject' => $subject,
|
||||
'mail_content' => $this->_notificationText_forEmails ) );
|
||||
$this->DB->insert( 'mail_queue', array( 'mail_to' => $to,
|
||||
'mail_cc' => ( count($cc) ? implode( ',', $cc ) : '' ),
|
||||
'mail_from' => $this->settings['email_out'],
|
||||
'mail_date' => time(),
|
||||
'mail_html_on' => intval( $this->_mail_html_on ),
|
||||
'mail_subject' => $subject,
|
||||
'mail_content' => $this->_notificationText_forEmails,
|
||||
'mail_html_content' => ( $this->_notificationHtml ) ? $this->_notificationHtml : '' ) );
|
||||
|
||||
$cache = $this->cache->getCache('systemvars');
|
||||
$cache['mail_queue'] += 1;
|
||||
@@ -827,8 +838,14 @@ class notifications
|
||||
|
||||
if ( ! $hidden )
|
||||
{
|
||||
$this->DB->update( 'members', 'notification_cnt=notification_cnt+1', 'member_id=' . $member['member_id'], true, true );
|
||||
}
|
||||
// Do we have a notification limit?
|
||||
$_limit = $this->getGroupLimit( $member );
|
||||
|
||||
if( $_limit > $member['notification_cnt'] || !$_limit )
|
||||
{
|
||||
$this->DB->update( 'members', 'notification_cnt=notification_cnt+1', 'member_id=' . $member['member_id'], true, true );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -846,35 +863,8 @@ class notifications
|
||||
// Determine member's limit first
|
||||
//-----------------------------------------
|
||||
|
||||
$groups = array( $member['member_group_id'] );
|
||||
$_limit = $this->getGroupLimit( $member );
|
||||
|
||||
if( $member['mgroup_others'] )
|
||||
{
|
||||
$_others = IPSText::cleanPermString( $member['mgroup_others'] );
|
||||
$groups = ( is_array( $groups ) AND is_array( $_others ) ) ? array_merge( $_others, $groups ) : array();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// 0 is best, otherwise higher is better
|
||||
//-----------------------------------------
|
||||
|
||||
$_limit = 0;
|
||||
|
||||
foreach( $groups as $_group )
|
||||
{
|
||||
$_thisLimit = $this->caches['group_cache'][ $_group ]['g_max_notifications'];
|
||||
|
||||
if( !$_thisLimit )
|
||||
{
|
||||
$_limit = 0;
|
||||
break;
|
||||
}
|
||||
else if( $_thisLimit > $_limit )
|
||||
{
|
||||
$_limit = $_thisLimit;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// We have a limit
|
||||
//-----------------------------------------
|
||||
@@ -1104,6 +1094,8 @@ class notifications
|
||||
|
||||
$detail['member_PhotoTag'] = IPSMember::buildPhotoTag( $author, 'mini' );
|
||||
|
||||
$detail['member_HoverCard'] = $this->registry->getClass('output')->getTemplate('global')->userHoverCard( $author );
|
||||
|
||||
/* Slap on the URL */
|
||||
$detail['url'] = $latest['notify_url'];
|
||||
|
||||
@@ -1292,6 +1284,45 @@ class notifications
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine member's notification limit
|
||||
* @return int $_limit
|
||||
*/
|
||||
public function getGroupLimit( $member )
|
||||
{
|
||||
|
||||
$groups = array( $member['member_group_id'] );
|
||||
|
||||
if( $member['mgroup_others'] )
|
||||
{
|
||||
$_others = explode( ",", IPSText::cleanPermString( $member['mgroup_others'] ) );
|
||||
$groups = ( is_array( $groups ) AND is_array( $_others ) ) ? array_merge( $_others, $groups ) : array();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// 0 is best, otherwise higher is better
|
||||
//-----------------------------------------
|
||||
|
||||
$_limit = 0;
|
||||
|
||||
foreach( $groups as $_group )
|
||||
{
|
||||
$_thisLimit = $this->caches['group_cache'][ $_group ]['g_max_notifications'];
|
||||
|
||||
if( !$_thisLimit )
|
||||
{
|
||||
$_limit = 0;
|
||||
break;
|
||||
}
|
||||
else if( $_thisLimit > $_limit )
|
||||
{
|
||||
$_limit = $_thisLimit;
|
||||
}
|
||||
}
|
||||
|
||||
return intval( $_limit );
|
||||
}
|
||||
|
||||
/**
|
||||
* Do we have an application class?
|
||||
* @return boolean
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -3,7 +3,7 @@
|
||||
* <pre>
|
||||
* Status Updates Class
|
||||
* Holds various functions
|
||||
* Last Updated: $Date: 2012-06-21 10:57:38 -0400 (Thu, 21 Jun 2012) $
|
||||
* Last Updated: $Date: 2013-02-13 11:25:39 -0500 (Wed, 13 Feb 2013) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $author$
|
||||
@@ -12,7 +12,7 @@
|
||||
* @package IP.Board
|
||||
* @author MattMecham
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10966 $
|
||||
* @version $Rev: 11985 $
|
||||
*
|
||||
* Example: Create new status update
|
||||
* <code>
|
||||
@@ -300,6 +300,7 @@ class memberStatus
|
||||
* The 'friends_only' flag will only fetch status updates from authors friends
|
||||
* The 'type' flag can contain 'all', 'mine', 'theirs' - default is 'mine'.
|
||||
* The 'isApproved' flag can contain true, false or null (true, approved only, false, unapproved only, null both)
|
||||
* The 'ignorePermissions' flag can be set to true (do not verify we can view) or false (pull only statuses we can see based on other filters), defaulting to false
|
||||
* getCount - returns a count of all matches without the limit
|
||||
*
|
||||
* @param mixed [Array of member data OR member ID INT for member updating their status - will use ->getAuthor() if null]
|
||||
@@ -385,6 +386,22 @@ class memberStatus
|
||||
|
||||
$where[] = "s.status_member_id IN (" . implode( ",", $friends ) . ")";
|
||||
}
|
||||
|
||||
/* Don't return statuses we can't see */
|
||||
if ( !isset( $filters['ignorePermissions'] ) || $filters['ignorePermissions'] != true )
|
||||
{
|
||||
if ( ! $author['g_is_supmod'] )
|
||||
{
|
||||
if( IPSMember::isOnModQueue( $author['member_id'] ) )
|
||||
{
|
||||
$where[] = "s.status_approved=1";
|
||||
}
|
||||
else
|
||||
{
|
||||
$where[] = "(s.status_approved=1 OR s.status_member_id=" . $author['member_id'] . ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sort_dir = ( isset( $filters['sort_dir'] ) AND $filters['sort_dir'] == 'asc' ) ? 'asc' : 'desc';
|
||||
$sort_field = ( isset( $filters['sort_field'] ) ) ? $filters['sort_field'] : 'status_date';
|
||||
@@ -438,6 +455,7 @@ class memberStatus
|
||||
$row['_canUnlock'] = $this->canUnlockStatus( $author, $row );
|
||||
$row['_creatorImg'] = $this->creatorImage( $row );
|
||||
$row['_creatorText'] = $this->creatorText( $row );
|
||||
$row['_canApprove'] = $this->canApproveStatus( $author, $row );
|
||||
|
||||
/* For someone else? */
|
||||
if ( $row['status_member_id'] != $row['status_author_id'] )
|
||||
@@ -590,7 +608,7 @@ class memberStatus
|
||||
/* Already imported this one */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
$data = array( 'status_member_id' => $owner['member_id'],
|
||||
'status_author_id' => $author['member_id'],
|
||||
'status_date' => time(),
|
||||
@@ -598,7 +616,7 @@ class memberStatus
|
||||
'status_hash' => $hash,
|
||||
'status_replies' => 0,
|
||||
'status_author_ip' => $this->member->ip_address,
|
||||
'status_approved' => $this->getIsApproved(),
|
||||
'status_approved' => ( ( $owner['pp_setting_moderate_comments'] && $owner['member_id'] != $author['member_id'] ) || IPSMember::isOnModQueue( $author['member_id'] ) ) ? 0 : $this->getIsApproved(),
|
||||
'status_imported' => intval( $this->_internalData['IsImport'] ),
|
||||
'status_creator' => trim( addslashes( $this->_internalData['Creator'] ) ),
|
||||
'status_last_ids' => '' );
|
||||
@@ -650,7 +668,7 @@ class memberStatus
|
||||
}
|
||||
}
|
||||
|
||||
if( count($friends) )
|
||||
if( count($friends) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Notifications library
|
||||
@@ -661,31 +679,44 @@ class memberStatus
|
||||
|
||||
$friends = IPSMember::load( $friends );
|
||||
|
||||
$statusUrl = $this->registry->output->buildSEOUrl( 'app=members&module=profile&section=status&type=single&status_id=' . $status_id, 'publicNoSession', 'true', 'members_status_single' );
|
||||
$statusUrl = $this->registry->output->buildSEOUrl( 'app=members&module=profile&section=status&type=single&status_id=' . $status_id, 'publicNoSession', array( $owner['member_id'], $owner['members_seo_name'] ), 'members_status_single' );
|
||||
|
||||
/* Build message as few times as possible */
|
||||
$ndata = array( 'NAME' => '#friend.name#',
|
||||
'OWNER' => $owner['members_display_name'],
|
||||
'STATUS' => $data['status_content'],
|
||||
'URL' => $this->registry->output->buildSEOUrl( 'app=core&module=usercp&tab=core&area=notifications', 'publicNoSession' ) );
|
||||
|
||||
/* Get languages */
|
||||
$langMessages = array();
|
||||
|
||||
foreach( $friends as $friend )
|
||||
{
|
||||
$ndata = array( 'NAME' => $friend['members_display_name'],
|
||||
'OWNER' => $owner['members_display_name'],
|
||||
'STATUS' => $data['status_content'],
|
||||
'URL' => $this->registry->output->buildSEOUrl( 'app=core&module=usercp&tab=core&area=notifications', 'publicNoSession' ) );
|
||||
|
||||
IPSText::getTextClass('email')->getTemplate( 'new_status', $friend['language'] );
|
||||
IPSText::getTextClass('email')->buildMessage( $ndata );
|
||||
|
||||
IPSText::getTextClass('email')->subject = sprintf(
|
||||
IPSText::getTextClass('email')->subject,
|
||||
$this->registry->output->buildSEOUrl( 'showuser=' . $owner['member_id'], 'publicNoSession', $owner['members_seo_name'], 'showuser' ),
|
||||
$owner['members_display_name'],
|
||||
$statusUrl
|
||||
);
|
||||
|
||||
if ( ! isset( $langMessages[ $friend['language'] ] ) )
|
||||
{
|
||||
IPSText::getTextClass('email')->getTemplate( 'new_status', $friend['language'] );
|
||||
IPSText::getTextClass('email')->buildMessage( $ndata );
|
||||
|
||||
$_subject = sprintf( IPSText::getTextClass('email')->subject,
|
||||
$this->registry->output->buildSEOUrl( 'showuser=' . $owner['member_id'], 'publicNoSession', $owner['members_seo_name'], 'showuser' ),
|
||||
$owner['members_display_name'],
|
||||
$statusUrl );
|
||||
|
||||
$langMessages[ $friend['language'] ] = array( 'subject' => $_subject, 'message' => IPSText::getTextClass('email')->message );
|
||||
}
|
||||
}
|
||||
|
||||
foreach( $friends as $friend )
|
||||
{
|
||||
$message = $langMessages[ $friend['language'] ]['message'];
|
||||
$message = str_replace( '#friend.name#', $friend['members_display_name'], $message );
|
||||
|
||||
$notifyLibrary->setMember( $friend );
|
||||
$notifyLibrary->setFrom( $author );
|
||||
$notifyLibrary->setNotificationKey( 'friend_status_update' );
|
||||
$notifyLibrary->setNotificationUrl( $statusUrl );
|
||||
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->message );
|
||||
$notifyLibrary->setNotificationTitle( IPSText::getTextClass('email')->subject );
|
||||
$notifyLibrary->setNotificationText( $message );
|
||||
$notifyLibrary->setNotificationTitle( $langMessages[ $friend['language'] ]['subject'] );
|
||||
|
||||
try
|
||||
{
|
||||
@@ -756,7 +787,7 @@ class memberStatus
|
||||
* @todo [Future] At some point it could be expanded into a mini framework with plugins
|
||||
*/
|
||||
protected function _triggerExternalUpdates( $updates, $status_id=0, $author=null, $content=null )
|
||||
{
|
||||
{
|
||||
$author = ( $author === null ) ? $this->getAuthor() : $author;
|
||||
$content = ( $content ) ? $this->_cleanContent( $content ) : $this->_cleanContent( $this->getContent() );
|
||||
|
||||
@@ -766,8 +797,8 @@ class memberStatus
|
||||
return false;
|
||||
}
|
||||
|
||||
$url = $this->registry->output->buildSEOUrl( 'app=members&module=profile&section=status&type=single&status_id=' . $status_id, 'publicNoSession', 'true', 'members_status_single' );
|
||||
|
||||
$url = $this->registry->output->buildSEOUrl( 'app=members&module=profile&section=status&type=single&status_id=' . $status_id, 'publicNoSession', array( $author['member_id'], $author['members_seo_name'] ), 'members_status_single' );
|
||||
|
||||
/* Twitter */
|
||||
if ( $updates['twitter'] )
|
||||
{
|
||||
@@ -822,7 +853,7 @@ class memberStatus
|
||||
/* Init vars */
|
||||
$_ids = array();
|
||||
$members = array();
|
||||
$statusUrl = $this->registry->output->buildSEOUrl( 'app=members&module=profile&section=status&type=single&status_id=' . $status['status_id'], 'publicNoSession', 'true', 'members_status_single' );
|
||||
$statusUrl = $this->registry->output->buildSEOUrl( 'app=members&module=profile&section=status&type=single&status_id=' . $status['status_id'], 'publicNoSession', array( $_owner['member_id'], $_owner['members_seo_name'] ), 'members_status_single' );
|
||||
|
||||
/* Did the status owner want an email? */
|
||||
if ( $_owner['member_id'] != $_replier['member_id'] )
|
||||
@@ -1066,6 +1097,35 @@ class memberStatus
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Approve status
|
||||
*
|
||||
* @param array [Array of member data for member updating their status - will use ->getAuthor() if null]
|
||||
* @param array [Array of status information OR status ID OR uses $this->_internalData['StatusData'] if none]
|
||||
* @return boolean
|
||||
*/
|
||||
public function approveStatus( $author=null, $status=null )
|
||||
{
|
||||
$author = ( $author === null ) ? $this->getAuthor() : $author;
|
||||
$status = ( $status === null ) ? $this->_internalData['StatusData'] : ( ( is_array( $status ) ) ? $status : $this->_loadStatus( $status ) );
|
||||
|
||||
if ( $status['status_id'] )
|
||||
{
|
||||
if ( $this->canApproveStatus( $author, $status ) )
|
||||
{
|
||||
/* Update status */
|
||||
$this->DB->update( 'member_status_updates', array( 'status_approved' => 1 ), 'status_id=' . $status['status_id'] );
|
||||
|
||||
/* Rebuild latest */
|
||||
$this->rebuildOwnerLatest( $author );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all user's status'
|
||||
@@ -1468,6 +1528,11 @@ class memberStatus
|
||||
{
|
||||
$author = ( $author === null ) ? $this->getAuthor() : $author;
|
||||
|
||||
if ( $author['restrict_post'] )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( $owner !== null AND $author['member_id'] != $owner['member_id'] )
|
||||
{
|
||||
/* Not a new status by user */
|
||||
@@ -1500,7 +1565,7 @@ class memberStatus
|
||||
* @return bool
|
||||
*/
|
||||
public function canComment( $author=null, $owner=null, $status=null )
|
||||
{
|
||||
{
|
||||
$author = ( $author === null ) ? $this->getAuthor() : $author;
|
||||
$owner = ( $owner === null ) ? $this->_internalData['StatusOwner'] : $owner;
|
||||
|
||||
@@ -1529,15 +1594,10 @@ class memberStatus
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$_you_are_being_ignored = explode( ",", $owner['ignored_users'] );
|
||||
|
||||
if ( is_array( $_you_are_being_ignored ) and count( $_you_are_being_ignored ) )
|
||||
|
||||
if ( IPSMember::checkIgnoredStatus( $author['member_id'], $owner['member_id'], 'messages' ) )
|
||||
{
|
||||
if ( in_array( $author['member_id'], $_you_are_being_ignored ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1691,6 +1751,51 @@ class memberStatus
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perm Check: Can approve a status
|
||||
*
|
||||
* @param array [Array of author data, uses getAuthor if none]
|
||||
* @param array [Array of status information OR status ID OR uses $this->_internalData['StatusData'] if none]
|
||||
* @return bool
|
||||
*/
|
||||
public function canApproveStatus( $author=null, $status=null )
|
||||
{
|
||||
$author = ( $author === null ) ? $this->getAuthor() : $author;
|
||||
$status = ( $status === null ) ? $this->_internalData['StatusData'] : ( ( is_array( $status ) ) ? $status : $this->_loadStatus( $status ) );
|
||||
|
||||
if ( ! $author['member_id'] OR ! $status['status_id'] )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( ! $this->isEnabled() )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( ! $author['g_is_supmod'] )
|
||||
{
|
||||
if ( $author['member_id'] == $status['status_member_id'] && !IPSMember::isOnModQueue( $author['member_id'] ))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/* is left by someone else */
|
||||
if ( ( $status['status_member_id'] != $status['status_author_id'] ) && $status['status_member_id'] != $author['member_id'] )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perm Check: Can lock a status
|
||||
* status_is_locked: 1 means user lock, so owner can unlock, 2 means admin lock, so cannot unlock.
|
||||
@@ -2078,14 +2183,9 @@ class memberStatus
|
||||
}
|
||||
|
||||
/* Member is ignoring you! */
|
||||
$_you_are_being_ignored = explode( ",", $owner['ignored_users'] );
|
||||
|
||||
if ( is_array( $_you_are_being_ignored ) and count( $_you_are_being_ignored ) )
|
||||
if ( IPSMember::checkIgnoredStatus( $author['member_id'], $owner['member_id'], 'messages' ) )
|
||||
{
|
||||
if ( in_array( $author['member_id'], $_you_are_being_ignored ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Mobile iOS App image class
|
||||
* Owner: Matt Mecham
|
||||
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Navigation Builder
|
||||
* Owner: Matt Mecham
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author Matt Mecham
|
||||
@@ -15,7 +15,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 17th March 2011
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,10 +0,0 @@
|
||||
<html>
|
||||
<head><title>IP.Board - Bulletin Board System</title></head>
|
||||
<body>
|
||||
<h1>403: IP.Board -> Forbidden</h1>
|
||||
<hr>
|
||||
You have reached this page in error, please use your back button to return to the forum.
|
||||
<hr>
|
||||
<a href="http://www.invisionpower.com">IP.Board</a>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,17 +3,17 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Admin Output Library
|
||||
* Last Updated: $LastChangedDate: 2012-07-03 10:29:35 -0400 (Tue, 03 Jul 2012) $
|
||||
* Last Updated: $LastChangedDate: 2013-05-20 16:38:23 -0400 (Mon, 20 May 2013) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 11026 $
|
||||
* @version $Rev: 12261 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -31,8 +31,8 @@ class adminOutput extends output
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
public $global_template = '';
|
||||
|
||||
public $global_template = '';
|
||||
|
||||
/**#@+
|
||||
* HTML variables
|
||||
*
|
||||
@@ -90,7 +90,15 @@ class adminOutput extends output
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $tabKeys = array( 'core', 'forums', 'members', 'lookfeel', 'support', 'reports', 'other' );
|
||||
private $tabKeys = array();
|
||||
private $otherTabKeys = array();
|
||||
private $tabPrefs = array();
|
||||
|
||||
/**
|
||||
* Is bookmarkable
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_canBookmark = true;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -108,6 +116,10 @@ class adminOutput extends output
|
||||
$this->settings['base_url'] = $this->settings['_original_base_url'];
|
||||
$this->settings['public_url'] = $this->settings['_original_base_url'] . '/index.php?';
|
||||
$this->settings['public_dir'] = $this->settings['_original_base_url'] . '/' . PUBLIC_DIRECTORY . '/';
|
||||
|
||||
$this->settings['public_cdn_url'] = rtrim( $this->settings['ipb_img_url'] ? $this->settings['ipb_img_url'] : $this->settings['_original_base_url'], '/' ) . '/' . PUBLIC_DIRECTORY . '/';
|
||||
$this->settings['css_base_url'] = rtrim( $this->settings['ipb_css_url'] ? $this->settings['ipb_css_url'] : $this->settings['_original_base_url'], '/' ) . '/' . PUBLIC_DIRECTORY . '/';
|
||||
$this->settings['js_base_url'] = rtrim( $this->settings['ipb_js_url'] ? $this->settings['ipb_js_url'] : $this->settings['_original_base_url'], '/' ) . '/' . PUBLIC_DIRECTORY . '/';
|
||||
|
||||
$this->settings['base_acp_url'] = $this->settings['base_url'] . '/' . CP_DIRECTORY;
|
||||
$this->settings['skin_acp_url'] = $this->settings['base_url'] . '/' . CP_DIRECTORY . "/skin_cp";
|
||||
@@ -139,6 +151,234 @@ class adminOutput extends output
|
||||
$this->settings['extraJsModules'] = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Called in admin function constructor to prevent output init clashes
|
||||
*/
|
||||
public function initTabKeys()
|
||||
{
|
||||
/* Get tab prefs first */
|
||||
$this->tabPrefs = $this->registry->adminFunctions->staffGetCookie( 'tabPrefs' );
|
||||
|
||||
/* Set up default tab keys */
|
||||
$this->getMainTabKeys();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns keys for use in the main tab bar
|
||||
* @return array:
|
||||
*/
|
||||
public function getMainTabKeys()
|
||||
{
|
||||
if ( ! count( $this->tabKeys ) )
|
||||
{
|
||||
if ( isset( $this->tabPrefs['tabBar'] ) && is_array( $this->tabPrefs['tabBar'] ) && count( $this->tabPrefs['tabBar'] ) )
|
||||
{
|
||||
$this->tabKeys = array_values( $this->tabPrefs['tabBar'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tabKeys = array( 'core', 'forums', 'members', 'lookfeel', 'support', 'reports', 'other' );
|
||||
}
|
||||
}
|
||||
|
||||
return $this->tabKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns keys for use in the other apps menu
|
||||
* @return array:
|
||||
*/
|
||||
public function getOtherTabKeys()
|
||||
{
|
||||
$tmp = $this->registry->getClass('class_permissions')->return;
|
||||
$this->registry->getClass('class_permissions')->return = TRUE; // We have to do this to stop the checkForAppAccess call below to end up sending a showError screen
|
||||
|
||||
$mainTabKeys = $this->getMainTabKeys();
|
||||
|
||||
if ( ! count( $this->otherTabKeys ) )
|
||||
{
|
||||
if ( isset( $this->tabPrefs['otherMenu'] ) && is_array( $this->tabPrefs['otherMenu'] ) && count( $this->tabPrefs['otherMenu'] ) )
|
||||
{
|
||||
$this->otherTabKeys = array_values( $this->tabPrefs['otherMenu'] );
|
||||
|
||||
/* Got all apps? Some could have been added after we last re-arranged tabs */
|
||||
foreach( ipsRegistry::$applications as $app_dir => $app_data )
|
||||
{
|
||||
if ( $this->registry->getClass('class_permissions')->checkForAppAccess( $app_data['app_directory'] ) !== TRUE || ! $app_data['app_enabled'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! in_array( $app_dir, $mainTabKeys ) && ! in_array( $app_dir, $this->otherTabKeys ) )
|
||||
{
|
||||
$this->otherTabKeys[] = $app_data['app_directory'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach( ipsRegistry::$applications as $app_dir => $app_data )
|
||||
{
|
||||
if ( in_array( $app_data['app_directory'], array( 'core', 'forums', 'members' ) ) || in_array( $app_data['app_directory'], $mainTabKeys ) || $this->registry->getClass('class_permissions')->checkForAppAccess( $app_data['app_directory'] ) !== TRUE || ! $app_data['app_enabled'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->otherTabKeys[] = $app_data['app_directory'];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->registry->getClass('class_permissions')->return = $tmp;
|
||||
|
||||
return $this->otherTabKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tab data from keys
|
||||
* @param array Array of keys to fetch data from
|
||||
*/
|
||||
public function getTabDataFromKeys( $keys )
|
||||
{
|
||||
$tmp = $this->registry->getClass('class_permissions')->return;
|
||||
$this->registry->getClass('class_permissions')->return = TRUE; // We have to do this to stop the checkForAppAccess call below to end up sending a showError screen
|
||||
|
||||
$fakeApps = $this->fetchFakeApps();
|
||||
$applications = ipsRegistry::$applications;
|
||||
$defaultFakeApp = array();
|
||||
$tabs = array();
|
||||
$fakeActive = false;
|
||||
|
||||
/* Set up fake apps stuff */
|
||||
foreach( $fakeApps as $fa => $data )
|
||||
{
|
||||
$_active = false;
|
||||
|
||||
$fakeAppAccess[ $fa ] = false;
|
||||
$fakeAppActive[ $fa ] = false;
|
||||
|
||||
foreach( $data as $appData )
|
||||
{
|
||||
if ( ! $defaultFakeApp[ $fa ] )
|
||||
{
|
||||
$defaultFakeApp[ $fa ] = $appData['app'];
|
||||
$defaultFakeModule[ $fa ] = $appData['module'];
|
||||
}
|
||||
|
||||
if ( ! $fakeAppAccess[ $fa ] and ipsRegistry::getClass('class_permissions')->checkForModuleAccess( $appData['app'], $appData['module'] ) )
|
||||
{
|
||||
$fakeAppAccess[ $fa ] = true;
|
||||
}
|
||||
|
||||
if ( $appData['app'] == ipsRegistry::$current_application && $appData['module'] == ipsRegistry::$current_module )
|
||||
{
|
||||
$fakeAppActive[ $fa ] = true;
|
||||
|
||||
$fakeActive = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach( $keys as $tabkey )
|
||||
{
|
||||
$gotIt = false;
|
||||
|
||||
/* Try 'other' first */
|
||||
if ( $tabkey == 'other' )
|
||||
{
|
||||
$gotIt = true;
|
||||
|
||||
$tabs[ $tabkey ] = array( 'title' => $this->lang->words['other_applications'],
|
||||
'active' => false,
|
||||
'appDir' => false,
|
||||
'isEnabled' => true,
|
||||
'permCheck' => true,
|
||||
'url' => "{$this->settings['_base_url']}app=core&module=applications&section=applications&do=applications_overview" );
|
||||
}
|
||||
|
||||
/* Try fake apps first */
|
||||
foreach( $fakeApps as $fa => $data )
|
||||
{
|
||||
if ( $fa == $tabkey )
|
||||
{
|
||||
$gotIt = true;
|
||||
|
||||
switch( $fa )
|
||||
{
|
||||
case 'lookfeel':
|
||||
$title = $this->lang->words['gl_lookandfeel'];
|
||||
$link = "{$this->settings['_base_url']}app={$defaultFakeApp['lookfeel']}&module={$defaultFakeModule['lookfeel']}";
|
||||
break;
|
||||
|
||||
case 'support':
|
||||
$title = $this->lang->words['gl_support'];
|
||||
$link = "{$this->settings['_base_url']}app=core&module=diagnostics";
|
||||
break;
|
||||
|
||||
case 'reports':
|
||||
$title = $this->lang->words['gl_reportsmenu'];
|
||||
$link = "{$this->settings['_base_url']}app={$defaultFakeApp['reports']}&module={$defaultFakeModule['reports']}";
|
||||
break;
|
||||
}
|
||||
|
||||
$tabs[ $tabkey ] = array( 'title' => $title,
|
||||
'permCheck' => $fakeAppAccess[ $fa ],
|
||||
'active' => $fakeAppActive[ $fa ],
|
||||
'appDir' => $defaultFakeApp[ $fa ],
|
||||
'isEnabled' => true,
|
||||
'url' => $link );
|
||||
}
|
||||
}
|
||||
|
||||
/* Try normal apps next */
|
||||
if ( $gotIt === false )
|
||||
{
|
||||
/* Loop */
|
||||
foreach( $applications as $app_dir => $app_data )
|
||||
{
|
||||
switch( $app_data['app_directory'] )
|
||||
{
|
||||
case 'core':
|
||||
$app_data['app_title'] = $this->lang->words['gl_system'];
|
||||
break;
|
||||
|
||||
case 'forums':
|
||||
$app_data['app_title'] = $this->lang->words['gl_forums'];
|
||||
break;
|
||||
|
||||
case 'members':
|
||||
$app_data['app_title'] = $this->lang->words['gl_members'];
|
||||
break;
|
||||
}
|
||||
|
||||
if ( $tabkey == $app_data['app_directory'] )
|
||||
{
|
||||
$tabs[ $tabkey ] = array( 'title' => $app_data['app_title'],
|
||||
'active' => ( $fakeActive === false && ipsRegistry::$current_application == $app_data['app_directory'] ) ? true : false,
|
||||
'permCheck' => ipsRegistry::getClass('class_permissions')->checkForAppAccess( $app_data['app_directory'] ),
|
||||
'isEnabled' => (boolean) $app_data['app_enabled'],
|
||||
'appDir' => $app_data['app_directory'],
|
||||
'url' => "{$this->settings['_base_url']}app={$app_data['app_directory']}" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->registry->getClass('class_permissions')->return = $tmp;
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can bookmark this page
|
||||
* @param boolean
|
||||
*/
|
||||
public function canBookmark( $bool )
|
||||
{
|
||||
$this->_canBookmark = (boolean) $bool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a global message to be used
|
||||
*
|
||||
@@ -184,13 +424,42 @@ class adminOutput extends output
|
||||
|
||||
IPSDebug::setMemoryDebugFlag( "CORE: Template Loaded ({$classToLoad})", $_pre_load );
|
||||
|
||||
return new $classToLoad( $this->registry );
|
||||
$class = new $classToLoad( $this->registry );
|
||||
|
||||
$this->compiled_templates[ $app . '.' . $template ] = $class;
|
||||
|
||||
return $class;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->showError( sprintf( $this->lang->words['notemplatefiletoload'], $template ), 4100, true );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a template class; loading if required
|
||||
*
|
||||
* @access public
|
||||
* @param string template name
|
||||
* @param boolean [Test only, TRUE for yes, FALSE for no]
|
||||
* @return mixed Object, or null
|
||||
*/
|
||||
public function getXTemplate( $groupName )
|
||||
{
|
||||
if ( ! isset( $this->compiled_templates[ $groupName ] ) || ! is_object( $this->compiled_templates[ $groupName ] ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Using self:: so that we can load public
|
||||
// skins inside ACP when necessary
|
||||
//-----------------------------------------
|
||||
|
||||
list( $app, $template ) = explode( '.', $groupName );
|
||||
|
||||
self::loadTemplate( $template, $app );
|
||||
}
|
||||
|
||||
return isset( $this->compiled_templates[ $groupName ] ) ? $this->compiled_templates[ $groupName ] : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a download dialog box
|
||||
@@ -387,7 +656,7 @@ class adminOutput extends output
|
||||
* @param string Text to display
|
||||
* @return @e void
|
||||
*/
|
||||
public function multipleRedirectFinish($text='Completed!')
|
||||
public function multipleRedirectFinish($text='Завершено!')
|
||||
{
|
||||
print $this->global_template->global_redirect_done( $text );
|
||||
exit();
|
||||
@@ -403,7 +672,7 @@ class adminOutput extends output
|
||||
* @param integer Header code to send (ignored for ACP)
|
||||
* @return @e void
|
||||
*/
|
||||
public function showError( $message, $code=0, $logError=FALSE, $logExtra='', $header=500 )
|
||||
public function showError( $message, $code=0, $logError=FALSE, $logExtra='', $header=401 )
|
||||
{
|
||||
$this->_sendOutputSetUp( 'error' );
|
||||
|
||||
@@ -433,7 +702,7 @@ class adminOutput extends output
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Log the error, if needed
|
||||
//-----------------------------------------
|
||||
@@ -449,13 +718,13 @@ class adminOutput extends output
|
||||
|
||||
$this->logErrorMessage( $_logMessage, $code );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Send notification if needed
|
||||
//-----------------------------------------
|
||||
|
||||
$this->sendErrorNotification( $message, $code );
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Finally, output
|
||||
//-----------------------------------------
|
||||
@@ -474,6 +743,15 @@ class adminOutput extends output
|
||||
public function sendOutput( $return=false )
|
||||
{
|
||||
$this->_sendOutputSetUp( 'normal' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Hang on, is IP.SEO still installed?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( IPSLib::appIsInstalled('ipseo') and !in_array( ipsRegistry::$request['section'], array( 'upgrade', 'applications' ) ) )
|
||||
{
|
||||
$this->silentRedirect( $this->settings['_base_url'] . 'app=core&module=seo&section=upgrade' );
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
// INIT
|
||||
@@ -494,7 +772,7 @@ class adminOutput extends output
|
||||
$this->printPopupWindow();
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Debug?
|
||||
//-----------------------------------------
|
||||
@@ -541,19 +819,31 @@ class adminOutput extends output
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add in bookmarkables
|
||||
*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/admin/bookmarks.php' );
|
||||
$bookmarks = new classes_admin_bookmarks();
|
||||
|
||||
$_bookmarkData = array( 'url' => $bookmarks->cleanUrl( $this->settings['query_string_safe'] ),
|
||||
'can' => ( $this->_canBookmark ? 'true' : 'false' ),
|
||||
'has' => ( $bookmarks->hasBookmarked( $this->settings['query_string_safe'] ) ? 'true' : 'false' ),
|
||||
'jsn' => $bookmarks->asJson() );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get tab order
|
||||
//-----------------------------------------
|
||||
|
||||
$applications = ipsRegistry::$applications;
|
||||
$mainTabs = $this->registry->output->getMainTabKeys();
|
||||
$otherTabs = $this->registry->output->getOtherTabKeys();
|
||||
|
||||
$mainTabData = $this->registry->output->getTabDataFromKeys( $mainTabs );
|
||||
$otherTabData = $this->registry->output->getTabDataFromKeys( $otherTabs );
|
||||
|
||||
$_tabOrder = ipsRegistry::getClass('adminFunctions')->staffGetCookie( 'tabOrder' );
|
||||
|
||||
if( !count($_tabOrder) OR !is_array($_tabOrder) )
|
||||
{
|
||||
$_tabOrder = $this->tabKeys;
|
||||
}
|
||||
|
||||
$gbl_sub_menu = $this->_buildGlobalSubMenu();
|
||||
$html = str_replace( '<%CONTENT%>', $this->html_main, $this->global_template->global_main_wrapper( IPS_DOC_CHAR_SET, $this->_css, $gbl_sub_menu, $_tabOrder ) );
|
||||
|
||||
$html = str_replace( '<%CONTENT%>', $this->html_main, $this->global_template->global_main_wrapper( IPS_DOC_CHAR_SET, $this->_css, $gbl_sub_menu, $mainTabData, $otherTabData, $_bookmarkData ) );
|
||||
|
||||
//------------------------------------------------
|
||||
// Message in a bottle?
|
||||
@@ -700,9 +990,12 @@ class adminOutput extends output
|
||||
//-----------------------------------------
|
||||
// Last thing, the nav element...
|
||||
//-----------------------------------------
|
||||
|
||||
$html = str_replace( "<%PAGE_NAV%>", $_last_nav['title'], $html );
|
||||
|
||||
|
||||
if ( isset( $_last_nav['title'] ) )
|
||||
{
|
||||
$html = str_replace( "<%PAGE_NAV%>", $_last_nav['title'], $html );
|
||||
}
|
||||
|
||||
$query_html = "";
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -775,7 +1068,7 @@ class adminOutput extends output
|
||||
}
|
||||
|
||||
$html = str_replace( "<%QUERIES%>" , $query_html , $html );
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Got BODY EXTRA?
|
||||
//-----------------------------------------
|
||||
@@ -791,6 +1084,9 @@ class adminOutput extends output
|
||||
|
||||
$html = str_replace( "<#EMO_DIR#>" , 'default' , $html );
|
||||
|
||||
/* Remove any public side hooks */
|
||||
$html = preg_replace( '#<!--hook\.([^\>]+?)-->#', '', $html );
|
||||
|
||||
//-----------------------------------------
|
||||
// Gzip?
|
||||
//-----------------------------------------
|
||||
@@ -1111,7 +1407,7 @@ class adminOutput extends output
|
||||
|
||||
if ( IN_DEV )
|
||||
{
|
||||
ipsRegistry::cache()->updateCacheWithoutSaving( 'app_menu_cache', array() );
|
||||
//ipsRegistry::cache()->updateCacheWithoutSaving( 'app_menu_cache', array() );
|
||||
}
|
||||
|
||||
if ( ! is_array( ipsRegistry::cache()->getCache('app_menu_cache') ) OR ! count( ipsRegistry::cache()->getCache('app_menu_cache') ) )
|
||||
@@ -1236,7 +1532,7 @@ class adminOutput extends output
|
||||
{
|
||||
if( !$this->ignoreCoreNav )
|
||||
{
|
||||
$this->core_nav[] = array( $this->settings['base_url'] . 'module=' . $_current_module . '&section=' . $item['section'], $module_data['title'] );
|
||||
$this->core_nav[] = array( $this->settings['base_url'] . 'module=' . $_current_module . '&section=' . $item['section'], $item['title'] );
|
||||
}
|
||||
|
||||
$_nav_main_done = 1;
|
||||
@@ -1260,11 +1556,11 @@ class adminOutput extends output
|
||||
}
|
||||
}
|
||||
|
||||
/* Reset */
|
||||
$_ok = 0;
|
||||
|
||||
if ( $item['url'] )
|
||||
{
|
||||
/* Reset */
|
||||
$_ok = 0;
|
||||
|
||||
/* Trying something a little different with the nav */
|
||||
$_url = explode( '=', $item['url'] );
|
||||
|
||||
@@ -1338,7 +1634,7 @@ class adminOutput extends output
|
||||
|
||||
if ( IN_DEV )
|
||||
{
|
||||
ipsRegistry::cache()->updateCacheWithoutSaving( 'app_menu_cache', array() );
|
||||
//ipsRegistry::cache()->updateCacheWithoutSaving( 'app_menu_cache', array() );
|
||||
}
|
||||
|
||||
if ( ! is_array( ipsRegistry::cache()->getCache('app_menu_cache') ) OR ! count( ipsRegistry::cache()->getCache('app_menu_cache') ) )
|
||||
@@ -1980,7 +2276,7 @@ class adminOutput extends output
|
||||
$yes = "<span class='yesno_yes {$css}'><input type='radio' name='{$name}' value='1' {$y_js}{$id_yes} /><label for='{$id}_yes'>{$this->lang->words['yesno_yes']}</label></span>";
|
||||
$no = "<span class='yesno_no {$css}'><input type='radio' name='{$name}' value='0' {$n_js}{$id_no} /><label for='{$id}_no'>{$this->lang->words['yesno_no']}</label></span>";
|
||||
|
||||
if ( $default_val == 1 )
|
||||
if ( $default_val == "1" )
|
||||
{
|
||||
$yes = "<span class='yesno_yes {$css}'><input type='radio'{$id_yes} name='{$name}' value='1' {$y_js} checked='checked' /><label for='{$id}_yes'>{$this->lang->words['yesno_yes']}</label></span>";
|
||||
}
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Ouput format: HTML
|
||||
* (Matt Mecham)
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2013-03-12 16:14:42 -0400 (Tue, 12 Mar 2013) $
|
||||
* </pre>
|
||||
*
|
||||
* @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
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 9th March 2005 11:03
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 12075 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -230,6 +230,10 @@ class coreOutput
|
||||
$this->_headerStatus = 'Moved Temporarily';
|
||||
break;
|
||||
|
||||
case 401:
|
||||
$this->_headerStatus = 'Unauthorized';
|
||||
break;
|
||||
|
||||
case 403:
|
||||
$this->_headerStatus = 'Forbidden';
|
||||
break;
|
||||
@@ -308,7 +312,7 @@ class coreOutput
|
||||
{
|
||||
$encode = ( $encode === FALSE ) ? FALSE : TRUE;
|
||||
$trimLen = ( $trimLen - 3 );
|
||||
$tag = strtolower($tag); // 'ROBOTS' should overwrite 'robots'
|
||||
$tag = trim( strtolower( $tag ) ); // 'ROBOTS' should overwrite 'robots'
|
||||
|
||||
switch( $tag )
|
||||
{
|
||||
@@ -330,13 +334,17 @@ class coreOutput
|
||||
$content = IPSText::truncate( $content, $trimLen );
|
||||
break;
|
||||
case 'keywords':
|
||||
/* @link http://community.invisionpower.com/resources/bugs.html/_/ip-board/seo-meta-keyworks-doesnt-work-correctly-r38420
|
||||
@link http://community.invisionpower.com/resources/bugs.html/_/ip-board/meta-issues-r39358
|
||||
When encode is passed as true, we should assume the block of text has not been formatted, and that we need to convert spaces to commas basically.
|
||||
When encode is passed as false, we should assume that the keywords coming in have been explicitly set (with commas) and not change that */
|
||||
if ( $encode === TRUE )
|
||||
{
|
||||
$content = IPSText::stripAttachTag( $content );
|
||||
|
||||
|
||||
//Bug #15323 breaks accented characters, etc
|
||||
//$content = strtolower( preg_replace( "/[^0-9a-zA-Z ]/", "", preg_replace( "/&([^;]+?);/", "", $content ) ) );
|
||||
$content = str_replace( array( '.', ',', '!', ':', ';', "'", '"', '@', '%', '*', '(', ')' ), '', preg_replace( "/&([^;]+?);/", "", $content ) );
|
||||
$content = str_replace( array( '.', '!', ':', ';', ',', '"', '@', '%', '*', '(', ')' ), '', preg_replace( "/&([^;]+?);/", "", $content ) );
|
||||
//Also breaks accented characters
|
||||
//$_vals = preg_split( '/\s+?/', $content, -1, PREG_SPLIT_NO_EMPTY );
|
||||
$_vals = explode( ' ', $content );
|
||||
@@ -367,15 +375,15 @@ class coreOutput
|
||||
}
|
||||
else
|
||||
{
|
||||
$content = str_replace( array( '.', ',', '!', ':', ';', "'", '"', '@', '%', '*', '(', ')' ), '', preg_replace( "/&([^;]+?);/", "", $content ) );
|
||||
$content = str_replace( array( '.', '!', ':', ';', "'", '"', '@', '%', '*', '(', ')' ), '', preg_replace( "/&([^;]+?);/", "", $content ) );
|
||||
}
|
||||
|
||||
$content = IPSText::truncate( $content, $trimLen );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$this->_metaTags[ $tag ] = ( $encode === TRUE ) ? $this->encodeMetaTagContent( preg_replace( '/&#(\d+?);/', "&#\\1;", htmlspecialchars( $content ) ) ) : $content;
|
||||
|
||||
$this->_metaTags[ $tag ][0] = ( $encode === TRUE ) ? preg_replace( '#&(amp|gt|lt|quot);#', '&\1;', $this->encodeMetaTagContent(preg_replace( '/&#(\d+?);/', "&#\\1;", htmlspecialchars( $content ) ) ) ) : preg_replace( '#&(amp|gt|lt|quot);#', '&\1;', $content );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -529,6 +537,13 @@ class coreOutput
|
||||
{
|
||||
$link .= "&module={$tab['module']}";
|
||||
}
|
||||
|
||||
/* http://community.invisionpower.com/resources/bugs.html/_/ip-board/ips-default-public-app-and-navigation-r41028 */
|
||||
if ( $tab['app'] == IPS_DEFAULT_PUBLIC_APP )
|
||||
{
|
||||
$link = "";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Ouput format: HTML
|
||||
* (Matt Mecham)
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 9th March 2005 11:03
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*
|
||||
*/
|
||||
$config = array();
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -3,10 +3,10 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Ouput format: XML
|
||||
* (Matt Mecham)
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 9th March 2005 11:03
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Ouput format: HTML
|
||||
* (Matt Mecham)
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 9th March 2005 11:03
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,245 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* System Templates
|
||||
* Last Updated: $Date: 2012-05-10 21:10:13 +0100 (Thu, 10 May 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author Mark Wade
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 5th September 2012
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* System Templates
|
||||
*/
|
||||
class systemTemplates
|
||||
{
|
||||
/**
|
||||
* Get Templates
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getList()
|
||||
{
|
||||
$templates = array();
|
||||
|
||||
$directoryIterator = new DirectoryIterator( IPS_CACHE_PATH . 'cache/skin_cache/system' );
|
||||
foreach ( $directoryIterator as $file )
|
||||
{
|
||||
if ( !$file->isDot() and $file->isFile() and substr( $file, -4 ) === '.php' )
|
||||
{
|
||||
require_once $file->getPathName();
|
||||
|
||||
$className = substr( $file, 0, -4 );
|
||||
if ( class_exists( $className ) )
|
||||
{
|
||||
$class = new $className;
|
||||
if ( $class instanceof systemTemplate )
|
||||
{
|
||||
$templates[ $className ] = $className;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Class
|
||||
*
|
||||
* @param string Key
|
||||
* @return systemTemplate
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getClass( $key )
|
||||
{
|
||||
/* If IPS_CACHE_PATH isn't set up quite yet */
|
||||
if ( ! defined( 'IPS_CACHE_PATH' ) )
|
||||
{
|
||||
define( 'IPS_CACHE_PATH', IPS_TEMP_CACHE_PATH );
|
||||
}
|
||||
|
||||
$file = IPS_CACHE_PATH . 'cache/skin_cache/system/' . $key . '.php';
|
||||
if ( !file_exists( $file ) )
|
||||
{
|
||||
$this->writeDefaults();
|
||||
|
||||
if( !file_exists( $file ) )
|
||||
{
|
||||
throw new Exception('NO_FILE');
|
||||
}
|
||||
}
|
||||
|
||||
require_once $file;
|
||||
if ( !class_exists( $key ) )
|
||||
{
|
||||
throw new Exception('NO_CLASS');
|
||||
}
|
||||
|
||||
$class = new $key;
|
||||
if ( !( $class instanceof systemTemplate ) )
|
||||
{
|
||||
throw new Exception('BAD_TEMPLATE');
|
||||
}
|
||||
|
||||
if ( !method_exists( $class, 'getTemplate' ) )
|
||||
{
|
||||
throw new Exception( 'NO_GETTEMPLATE_METHOD' );
|
||||
}
|
||||
|
||||
return $class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write
|
||||
*
|
||||
* @param string Key
|
||||
* @param array Param Names
|
||||
* @param string Content
|
||||
* @return int|false Data written
|
||||
*/
|
||||
public function write( $key, $paramNames, $content )
|
||||
{
|
||||
$implodedParamNames = implode( ', ', $paramNames );
|
||||
|
||||
$fileContents = <<<CONTENT
|
||||
<?php
|
||||
|
||||
class {$key} extends systemTemplate
|
||||
{
|
||||
public function getTemplate( {$implodedParamNames} )
|
||||
{
|
||||
return <<<EOF
|
||||
{$content}
|
||||
EOF;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
CONTENT;
|
||||
|
||||
if ( ! defined('IPS_CACHE_PATH') )
|
||||
{
|
||||
define( 'IPS_CACHE_PATH', DOC_IPS_ROOT_PATH );
|
||||
}
|
||||
|
||||
return file_put_contents( IPS_CACHE_PATH . 'cache/skin_cache/system/' . $key . '.php', $fileContents );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Revert
|
||||
*
|
||||
* @param string Key
|
||||
* @return int|false Data written
|
||||
*/
|
||||
public function revert( $key )
|
||||
{
|
||||
$defaultTemplates = file_get_contents( IPS_ROOT_PATH . 'setup/xml/system_templates.xml' );
|
||||
|
||||
require_once IPS_KERNEL_PATH . 'classXML.php';
|
||||
$xml = new classXML( 'utf-8' );
|
||||
$xml->loadXML( $defaultTemplates );
|
||||
|
||||
$array = $xml->fetchXMLAsArray();
|
||||
|
||||
foreach ( $array['system_templates']['template'] as $template )
|
||||
{
|
||||
if ( $template['key']['#alltext'] == $key )
|
||||
{
|
||||
$params = array();
|
||||
foreach ( $template['params']['param'] as $p )
|
||||
{
|
||||
$params[] = $p['#alltext'];
|
||||
}
|
||||
|
||||
return $this->write( $key, $params, $template['content']['#alltext'] );
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception('NO_DEFAULT_VALUE');
|
||||
}
|
||||
|
||||
/**
|
||||
* Write Default Values
|
||||
*/
|
||||
public function writeDefaults()
|
||||
{
|
||||
$defaultTemplates = file_get_contents( IPS_ROOT_PATH . 'setup/xml/system_templates.xml' );
|
||||
|
||||
if ( !class_exists( 'classXML' ) )
|
||||
{
|
||||
require_once IPS_KERNEL_PATH . 'classXML.php';
|
||||
}
|
||||
$xml = new classXML( 'utf-8' );
|
||||
$xml->loadXML( $defaultTemplates );
|
||||
|
||||
$array = $xml->fetchXMLAsArray();
|
||||
|
||||
foreach ( $array['system_templates']['template'] as $template )
|
||||
{
|
||||
$params = array();
|
||||
foreach ( $template['params']['param'] as $p )
|
||||
{
|
||||
$params[] = $p['#alltext'];
|
||||
}
|
||||
|
||||
$this->write( $template['key']['#alltext'], $params, $template['content']['#alltext'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract System Template Class
|
||||
*/
|
||||
abstract class systemTemplate
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Passthrough variable for displaying in templates
|
||||
*/
|
||||
class fakeArray implements ArrayAccess
|
||||
{
|
||||
public function __construct( $name )
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function offsetExists ( $offset )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function offsetGet ( $offset )
|
||||
{
|
||||
return '{$'.$this->name.'[\'' . $offset . '\']}';
|
||||
}
|
||||
|
||||
public function offsetSet ( $offset , $value )
|
||||
{
|
||||
}
|
||||
|
||||
public function offsetUnset ( $offset )
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* RSS Import
|
||||
* Owner: Matt Mecham
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2013-05-16 11:23:35 -0400 (Thu, 16 May 2013) $
|
||||
* </pre>
|
||||
*
|
||||
* @author Matt Mecham
|
||||
@@ -15,7 +15,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 24th November 2009
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 12255 $
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -219,7 +219,26 @@ class rss_import
|
||||
|
||||
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'public_global' ), 'core' );
|
||||
|
||||
$this->_settings['LinkBack'] = "<a href=\"{url}\">" . $this->registry->getClass('class_localization')->words['_rssimportsource'] . "</a>";
|
||||
/* Are we checking for external links */
|
||||
$rels = array();
|
||||
$rel = '';
|
||||
|
||||
if( ipsRegistry::$settings['posts_add_nofollow'] )
|
||||
{
|
||||
$rels[] = "nofollow";
|
||||
}
|
||||
|
||||
if( ipsRegistry::$settings['links_external'] )
|
||||
{
|
||||
$rels[] = "external";
|
||||
}
|
||||
|
||||
if( count($rels) )
|
||||
{
|
||||
$rel = " rel='" . implode( ' ', $rels ) . "'";
|
||||
}
|
||||
|
||||
$this->_settings['LinkBack'] = "<a href=\"{url}\" {$rel}>" . $this->registry->getClass('class_localization')->words['_rssimportsource'] . "</a>";
|
||||
|
||||
/* Reset class */
|
||||
$this->_reset();
|
||||
@@ -278,7 +297,7 @@ class rss_import
|
||||
* Build a RSS import query
|
||||
*
|
||||
* @access public
|
||||
* @param array Data
|
||||
* @param mixed False on error/no entries, or an array of imported entries
|
||||
*/
|
||||
public function build( $data )
|
||||
{
|
||||
@@ -376,7 +395,7 @@ class rss_import
|
||||
if ( ! count( $check_guids ) )
|
||||
{
|
||||
$rss_error[] = $this->lang->words['im_noitems'];
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->DB->build( array( 'select' => 'rss_guid',
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Sabre classes by Matt Mecham
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -13,7 +13,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since Friday 18th March 2011
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*/
|
||||
|
||||
class sabre_directory_groups extends Sabre_DAV_Directory
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Sabre classes by Matt Mecham
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -13,7 +13,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since Friday 18th March 2011
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*/
|
||||
|
||||
class sabre_directory_templates extends Sabre_DAV_Directory
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Sabre classes by Matt Mecham
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -13,7 +13,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since Friday 18th March 2011
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*/
|
||||
|
||||
class sabre_file_templates extends Sabre_DAV_File
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Sabre classes by Matt Mecham
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -13,7 +13,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since Friday 18th March 2011
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*/
|
||||
|
||||
class sabre_lock_nolocks extends Sabre_DAV_Locks_Backend_Abstract
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Sabre classes by Matt Mecham
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -13,7 +13,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since Friday 18th March 2011
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*/
|
||||
|
||||
class sabre_root_skins extends Sabre_DAV_Directory
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Global Search
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2012-10-09 12:16:32 -0400 (Tue, 09 Oct 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -13,7 +13,7 @@
|
||||
* @package IP.Board
|
||||
* @subpackage Core
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10914 $
|
||||
* @version $Rev: 11427 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
@@ -198,7 +198,7 @@ class IPSSearch
|
||||
if ( ! is_file( IPS_ROOT_PATH . 'sources/classes/search/engines/' . $this->_engine . '.php' ) )
|
||||
{
|
||||
/* Try SQL */
|
||||
if ( ! $this->_engine != 'sql' )
|
||||
if ( $this->_engine != 'sql' )
|
||||
{
|
||||
$this->_engine = 'sql';
|
||||
|
||||
@@ -232,6 +232,8 @@ class IPSSearch
|
||||
if ( ! is_file( IPSLib::getAppDir( $this->_app ) . '/extensions/search/engines/' . $this->_engine . '.php' ) )
|
||||
{
|
||||
$this->_engine = 'sql';
|
||||
|
||||
IPSSearchRegistry::set( 'global.engine', $this->_engine );
|
||||
|
||||
if ( ! is_file( IPSLib::getAppDir( $this->_app ) . '/extensions/search/engines/' . $this->_engine . '.php' ) )
|
||||
{
|
||||
@@ -615,7 +617,7 @@ class IPSSearch
|
||||
|
||||
/* Run the search */
|
||||
$results = $this->SEARCH->viewNewContent();
|
||||
|
||||
|
||||
/* Set data */
|
||||
$this->_count = intval( $results['count'] );
|
||||
$this->_results = $this->_rawResults = $results['resultSet'];
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Global Search
|
||||
* Last Updated: $Date: 2012-06-21 12:05:17 -0400 (Thu, 21 Jun 2012) $
|
||||
* Last Updated: $Date: 2012-12-03 14:03:02 -0500 (Mon, 03 Dec 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: AndyMillne $
|
||||
@@ -13,7 +13,7 @@
|
||||
* @package IP.Board
|
||||
* @subpackage Core
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10967 $
|
||||
* @version $Rev: 11673 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
@@ -212,7 +212,10 @@ class search_engine
|
||||
}
|
||||
else
|
||||
{
|
||||
$removedTerms[] = $_w;
|
||||
if( $_w )
|
||||
{
|
||||
$removedTerms[] = $_w;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Global Search
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2012-12-03 14:03:02 -0500 (Mon, 03 Dec 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @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: 11673 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
@@ -199,7 +199,10 @@ class search_engine
|
||||
}
|
||||
else
|
||||
{
|
||||
$removedTerms[] = $_w;
|
||||
if( $_w )
|
||||
{
|
||||
$removedTerms[] = $_w;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -217,7 +220,7 @@ class search_engine
|
||||
$search_term = '+' . preg_replace( '/\s+(?!-|~)/', " +", $search_term );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return array( 'search_term' => $search_term, 'removed' => $removedTerms );
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Global Search
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @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' ) )
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Admin session handler
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2012-08-21 11:56:40 -0400 (Tue, 21 Aug 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @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
|
||||
* @link http://www.invisionpower.com
|
||||
* @since Who knows...
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 11239 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -236,7 +236,7 @@ class adminSessions extends ips_MemberRegistry
|
||||
//------------------------------
|
||||
|
||||
else if ( IPB_ACP_IP_MATCH )
|
||||
{
|
||||
{
|
||||
if (
|
||||
$session_data['session_ip_address'] != self::instance()->ip_address
|
||||
or
|
||||
|
||||
@@ -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: mmecham $
|
||||
* @since Friday 12th November 2010 16:58
|
||||
* $LastChangedDate: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* @version v3.3.4
|
||||
* $Revision: 10914 $
|
||||
* $LastChangedDate: 2012-08-22 05:05:53 -0400 (Wed, 22 Aug 2012) $
|
||||
* @version v3.4.5
|
||||
* $Revision: 11245 $
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -348,7 +348,7 @@ class session_api
|
||||
}
|
||||
|
||||
/**
|
||||
* Log user in remotely.
|
||||
* Log user in remotely if user is not logged in.
|
||||
* @param array Array of member data (member_id, etc) or Id
|
||||
*/
|
||||
public function logGuestInAsMember( $member )
|
||||
@@ -359,17 +359,31 @@ class session_api
|
||||
}
|
||||
|
||||
/* Check for existing session */
|
||||
$ip = ipsRegistry::member()->ip_address;
|
||||
$ip = ipsRegistry::member()->ip_address;
|
||||
$_session = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'sessions',
|
||||
'where' => "ip_address='{$ip}'" ) );
|
||||
|
||||
if ( !$_session['id'] or !$_session['member_id'] )
|
||||
if ( ! $_session['id'] or ! $_session['member_id'] )
|
||||
{
|
||||
$this->_getSessionClass()->convertGuestToMember( $member, $member );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log user in remotely overwriting a different accounts log in if need be.
|
||||
* @param array Array of member data (member_id, etc) or Id
|
||||
*/
|
||||
public function logInAsMember( $member )
|
||||
{
|
||||
if ( is_numeric( $member ) )
|
||||
{
|
||||
$member = IPSMember::load( $member );
|
||||
}
|
||||
|
||||
$this->_getSessionClass()->convertGuestToMember( $member, $member );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load session class if not loaded
|
||||
*/
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* This class overrides parent publicSessions to prevent construct being called
|
||||
* It doesn't do anything else...
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @subpackage IP.Converge
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 22nd May 2008 11:15 AM
|
||||
* @version $Revision: 10914 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class convergeSessions extends publicSessions
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct( $registry )
|
||||
{
|
||||
/* Make object */
|
||||
$this->registry = ipsRegistry::instance();
|
||||
$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();
|
||||
$this->_member = self::instance();
|
||||
$this->_memberData =& self::instance()->fetchMemberData();
|
||||
|
||||
$this->_userAgent = substr( $this->_member->user_agent, 0, 200 );
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up app / section / module
|
||||
//-----------------------------------------
|
||||
|
||||
$this->current_appcomponent = IPS_APP_COMPONENT;
|
||||
$this->current_module = IPSText::alphanumericalClean( $this->request['module'] );
|
||||
$this->current_section = IPSText::alphanumericalClean( $this->request['section'] );
|
||||
|
||||
$this->settings['session_expiration'] = ( $this->settings['session_expiration'] ) ? $this->settings['session_expiration'] : 60;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a member session
|
||||
*
|
||||
* @access public
|
||||
* @return string Session id
|
||||
*/
|
||||
public function createMemberSession()
|
||||
{
|
||||
parent::_createMemberSession();
|
||||
|
||||
return $this->session_data['id'];
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -3,9 +3,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Sample SSO Class
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -14,7 +14,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 22nd Septmeber 2009
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Sample Mobile App SSO Class
|
||||
* Last Updated: $Date: 2012-05-10 21:10:13 +0100 (Thu, 10 May 2012) $
|
||||
* </pre>
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Share links library.
|
||||
* Created by Matt Mecham
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2013-05-08 13:48:52 -0400 (Wed, 08 May 2013) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -13,7 +13,7 @@
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10914 $
|
||||
* @version $Rev: 12239 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -96,6 +96,13 @@ class share_links
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Permission Check */
|
||||
$cache = isset( $this->caches['sharelinks'] ) ? $this->caches['sharelinks'] : ipsRegistry::cache()->getCache('sharelinks');
|
||||
if ( $cache[ $this->_pluginKey ]['share_groups'] != '*' and !IPSMember::isInGroup( $this->memberData, explode( ',', $cache[ $this->_pluginKey ]['share_groups'] ) ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Ensure title is correctly de-html-ized */
|
||||
$title = IPSText::UNhtmlspecialchars( $title );
|
||||
|
||||
@@ -267,56 +274,6 @@ class share_links
|
||||
'log_data_primary_id' => intval($urlParts['data_primary_id']),
|
||||
'log_data_secondary_id' => intval($urlParts['data_secondary_id']) ) );
|
||||
|
||||
/* Rebuild caches */
|
||||
$this->rebuildCaches();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build some caches of stuff.
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
*/
|
||||
public function rebuildCaches()
|
||||
{
|
||||
/* INIT */
|
||||
$caches = array( 'mostitems' => array(), 'mostrecent' => array() );
|
||||
|
||||
/* Delete caches */
|
||||
$this->DB->delete( 'core_share_links_caches', "cache_key IN ('mostitems', 'mostrecent')" );
|
||||
|
||||
/* Most shared */
|
||||
$this->DB->build( array( 'select' => 'COUNT(*) as count, log_data_app, log_data_type, log_data_primary_id',
|
||||
'from' => 'core_share_links_log',
|
||||
'group' => 'log_data_app, log_data_type, log_data_primary_id',
|
||||
'order' => 'count DESC',
|
||||
'limit' => array( 0, 10 ) ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
$caches['mostitems'][] = $row;
|
||||
}
|
||||
|
||||
/* Most recent shares */
|
||||
$this->DB->build( array( 'select' => 'log_id, log_data_app, log_data_type, log_data_primary_id',
|
||||
'from' => 'core_share_links_log',
|
||||
'order' => 'log_date DESC',
|
||||
'limit' => array( 0, 10 ) ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
$caches['mostrecent'][] = $row;
|
||||
}
|
||||
|
||||
/* Save 'em */
|
||||
foreach( $caches as $key => $data )
|
||||
{
|
||||
$this->DB->insert( 'core_share_links_caches', array( 'cache_key' => $key, 'cache_date' => time(), 'cache_data' => serialize( $data ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -382,13 +339,11 @@ class share_links
|
||||
$_urlBits = array();
|
||||
$_toTest = $url;
|
||||
$templates = array();
|
||||
|
||||
/* Grab FURL data... */
|
||||
if ( ! IN_DEV AND is_file( DOC_IPS_ROOT_PATH . 'cache/furlCache.php' ) )
|
||||
|
||||
if ( is_file( FURL_CACHE_PATH ) )
|
||||
{
|
||||
$templates = array();
|
||||
include( DOC_IPS_ROOT_PATH . 'cache/furlCache.php' );/*noLibHook*/
|
||||
|
||||
require( FURL_CACHE_PATH );/*noLibHook*/
|
||||
$_seoTemplates = $templates;
|
||||
}
|
||||
else
|
||||
@@ -400,7 +355,9 @@ class share_links
|
||||
{
|
||||
IPSLib::cacheFurlTemplates();
|
||||
}
|
||||
catch( Exception $e ) {}
|
||||
catch( Exception $e )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_array( $_seoTemplates ) AND count( $_seoTemplates ) )
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Blog This plug in for share links library.
|
||||
*
|
||||
* Created by Mark Wade
|
||||
@@ -17,7 +17,7 @@
|
||||
* @version $Rev: 8644 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
class sl_blogthis
|
||||
{
|
||||
/**
|
||||
@@ -77,7 +77,16 @@ class sl_blogthis
|
||||
|
||||
foreach ( ipsRegistry::$applications as $app )
|
||||
{
|
||||
$_file = IPSLib::getAppDir( $app['app_directory'] ) . '/extensions/furlTemplates.php';
|
||||
$furltemplatesfile = IPSLib::getAppDir( $app['app_directory'] );
|
||||
if(IPB_USE_ONLY_ID_FURL && is_file( $furltemplatesfile.'/extensions/furlTemplatesID.php'))
|
||||
{
|
||||
$furltemplatesfile.='/extensions/furlTemplatesID.php';
|
||||
}
|
||||
else
|
||||
{
|
||||
$furltemplatesfile.='/extensions/furlTemplates.php';
|
||||
}
|
||||
$_file = $furltemplatesfile;
|
||||
|
||||
if ( is_file( $_file ) )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.0 Beta 2
|
||||
* Bobrdobr plug in for share links library.
|
||||
* This is just the basic fallback bobrdobr share, the front end has JS to do something more fancy
|
||||
*
|
||||
* Created by Matt Mecham
|
||||
* Last Updated: $Date: 2010-01-25 13:21:25 +0000 (Mon, 25 Jan 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: matt $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 5746 $
|
||||
*
|
||||
*/
|
||||
|
||||
/* Class name must be in the format of:
|
||||
sl_{key}
|
||||
Where {key}, place with the value of: core_share_links.share_key
|
||||
*/
|
||||
class sl_bobrdobr
|
||||
{
|
||||
/**#@+
|
||||
* Registry Object Shortcuts
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $DB;
|
||||
protected $settings;
|
||||
protected $lang;
|
||||
protected $member;
|
||||
protected $memberData;
|
||||
protected $cache;
|
||||
protected $caches;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
* @access public
|
||||
* @param object Registry
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( $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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires a permission check
|
||||
*
|
||||
* @access public
|
||||
* @param array Data array
|
||||
* @return boolean
|
||||
*/
|
||||
public function requiresPermissionCheck( $array )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to Twitter
|
||||
* Exciting, isn't it.
|
||||
*
|
||||
* @access private
|
||||
* @param string Plug in
|
||||
*/
|
||||
public function share( $title, $url )
|
||||
{
|
||||
$title = IPSText::convertCharsets( $title, IPS_DOC_CHAR_SET, 'utf-8' );
|
||||
$url = "http://bobrdobr.ru/addext.html?url=" . urlencode( $url ) . '&title=' . urlencode( $title );
|
||||
|
||||
$this->registry->output->silentRedirect( $url );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -2,12 +2,12 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Twitter plug in for share links library.
|
||||
* This is just the basic fallback twitter share, the front end has JS to do something more fancy
|
||||
*
|
||||
* Created by Matt Mecham
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10914 $
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Twitter plug in for share links library.
|
||||
* This is just the basic fallback twitter share, the front end has JS to do something more fancy
|
||||
*
|
||||
* Created by Matt Mecham
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10914 $
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Twitter plug in for share links library.
|
||||
* This is just the basic fallback twitter share, the front end has JS to do something more fancy
|
||||
*
|
||||
* Created by Matt Mecham
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10914 $
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Twitter plug in for share links library.
|
||||
* This is just the basic fallback twitter share, the front end has JS to do something more fancy
|
||||
*
|
||||
* Created by Matt Mecham
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2013-02-25 17:56:34 -0500 (Mon, 25 Feb 2013) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10914 $
|
||||
* @version $Rev: 12023 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -86,9 +86,10 @@ class sl_download
|
||||
{
|
||||
$title = IPSText::convertCharsets( $title, IPS_DOC_CHAR_SET, 'utf-8' );
|
||||
|
||||
$_qmCount = substr_count( $url, '?' );
|
||||
$_qmCount = substr_count( $url, '?' );
|
||||
$_count = ( $this->settings['url_type'] == 'query_string' ) ? 1 : 0;
|
||||
|
||||
if ( $_qmCount > 0 )
|
||||
if ( $_qmCount > $_count )
|
||||
{
|
||||
#?/furl?s=xxxx
|
||||
$url .= '&forceDownload=1';
|
||||
@@ -99,7 +100,7 @@ class sl_download
|
||||
}
|
||||
|
||||
$url .= '&_k=' . $this->member->form_hash;
|
||||
|
||||
|
||||
$this->registry->output->silentRedirect( $url );
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,12 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Twitter plug in for share links library.
|
||||
* This is just the basic fallback twitter share, the front end has JS to do something more fancy
|
||||
*
|
||||
* Created by Matt Mecham
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10914 $
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Twitter plug in for share links library.
|
||||
* This is just the basic fallback twitter share, the front end has JS to do something more fancy
|
||||
*
|
||||
* Created by Matt Mecham
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10914 $
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* $Author: ips_terabyte $
|
||||
* @since -
|
||||
* $LastChangedDate: 2010-10-14 13:11:17 -0400 (Thu, 14 Oct 2010) $
|
||||
* @version v3.3.4
|
||||
* @version v3.4.5
|
||||
* $Revision: 477 $
|
||||
*/
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.0 Beta 2
|
||||
* Memori plug in for share links library.
|
||||
* This is just the basic fallback memori share, the front end has JS to do something more fancy
|
||||
*
|
||||
* Created by Matt Mecham
|
||||
* Last Updated: $Date: 2010-01-25 13:21:25 +0000 (Mon, 25 Jan 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: matt $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 5746 $
|
||||
*
|
||||
*/
|
||||
|
||||
/* Class name must be in the format of:
|
||||
sl_{key}
|
||||
Where {key}, place with the value of: core_share_links.share_key
|
||||
*/
|
||||
class sl_memori
|
||||
{
|
||||
/**#@+
|
||||
* Registry Object Shortcuts
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $DB;
|
||||
protected $settings;
|
||||
protected $lang;
|
||||
protected $member;
|
||||
protected $memberData;
|
||||
protected $cache;
|
||||
protected $caches;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
* @access public
|
||||
* @param object Registry
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( $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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires a permission check
|
||||
*
|
||||
* @access public
|
||||
* @param array Data array
|
||||
* @return boolean
|
||||
*/
|
||||
public function requiresPermissionCheck( $array )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to Twitter
|
||||
* Exciting, isn't it.
|
||||
*
|
||||
* @access private
|
||||
* @param string Plug in
|
||||
*/
|
||||
public function share( $title, $url )
|
||||
{
|
||||
$title = IPSText::convertCharsets( $title, IPS_DOC_CHAR_SET, 'utf-8' );
|
||||
$url = "http://memori.ru/link/?sm=1&u_data[url]=" . urlencode( $url ) . '&u_data[name]=' . urlencode( $title );
|
||||
|
||||
$this->registry->output->silentRedirect( $url );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -2,12 +2,12 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Twitter plug in for share links library.
|
||||
* This is just the basic fallback twitter share, the front end has JS to do something more fancy
|
||||
*
|
||||
* Created by Matt Mecham
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2013-02-25 17:56:34 -0500 (Mon, 25 Feb 2013) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10914 $
|
||||
* @version $Rev: 12023 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -86,9 +86,10 @@ class sl_print
|
||||
{
|
||||
$title = IPSText::convertCharsets( $title, IPS_DOC_CHAR_SET, 'utf-8' );
|
||||
|
||||
$_qmCount = substr_count( $url, '?' );
|
||||
$_qmCount = substr_count( $url, '?' );
|
||||
$_count = ( $this->settings['url_type'] == 'query_string' ) ? 1 : 0;
|
||||
|
||||
if ( $_qmCount > 0 )
|
||||
if ( $_qmCount > $_count )
|
||||
{
|
||||
#?/furl?s=xxxx
|
||||
$url .= '&forcePrint=1';
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Twitter plug in for share links library.
|
||||
* This is just the basic fallback twitter share, the front end has JS to do something more fancy
|
||||
*
|
||||
* Created by Matt Mecham
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10914 $
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Twitter plug in for share links library.
|
||||
* This is just the basic fallback twitter share, the front end has JS to do something more fancy
|
||||
*
|
||||
* Created by Matt Mecham
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10914 $
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Twitter plug in for share links library.
|
||||
* This is just the basic fallback twitter share, the front end has JS to do something more fancy
|
||||
*
|
||||
* Created by Matt Mecham
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2013-02-05 09:14:37 -0500 (Tue, 05 Feb 2013) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10914 $
|
||||
* @version $Rev: 11937 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -80,11 +80,22 @@ class sl_twitter
|
||||
*
|
||||
* @access private
|
||||
* @param string Plug in
|
||||
* @note Removed utf8_encode() call around the title due to the linked bug report
|
||||
* @link http://community.invisionpower.com/resources/bugs.html/_/ip-board/twitter-share-buttonbox-r41010
|
||||
*/
|
||||
public function share( $title, $url )
|
||||
{
|
||||
$title = IPSText::convertCharsets( $title, IPS_DOC_CHAR_SET, 'utf-8' );
|
||||
$url = "http://twitter.com/intent/tweet?status=" . urlencode( $title ) . '%20-%20' . urlencode( $url );
|
||||
$title = IPSText::convertCharsets( $title, IPS_DOC_CHAR_SET, 'utf-8' );
|
||||
$hashMan = $this->settings['twitter_hashtag'];
|
||||
|
||||
if ( $hashMan && substr( $hashMan, 0, 1 ) != '#' )
|
||||
{
|
||||
$hashMan = urlencode('#' . $hashMan);
|
||||
}
|
||||
|
||||
$hashMan = ( $hashMan ) ? '%20' . $hashMan : '';
|
||||
|
||||
$url = "http://twitter.com/intent/tweet?status=" . urlencode( $title ) . '%20-%20' . urlencode( $url ) . $hashMan;
|
||||
|
||||
$this->registry->output->silentRedirect( $url );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.0 Beta 2
|
||||
* Vkontakte plug in for share links library.
|
||||
* This is just the basic fallback vkontakte share, the front end has JS to do something more fancy
|
||||
*
|
||||
* Created by Matt Mecham
|
||||
* Last Updated: $Date: 2010-01-25 13:21:25 +0000 (Mon, 25 Jan 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: matt $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 5746 $
|
||||
*
|
||||
*/
|
||||
|
||||
/* Class name must be in the format of:
|
||||
sl_{key}
|
||||
Where {key}, place with the value of: core_share_links.share_key
|
||||
*/
|
||||
class sl_vkontakte
|
||||
{
|
||||
/**#@+
|
||||
* Registry Object Shortcuts
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $DB;
|
||||
protected $settings;
|
||||
protected $lang;
|
||||
protected $member;
|
||||
protected $memberData;
|
||||
protected $cache;
|
||||
protected $caches;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
* @access public
|
||||
* @param object Registry
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( $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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires a permission check
|
||||
*
|
||||
* @access public
|
||||
* @param array Data array
|
||||
* @return boolean
|
||||
*/
|
||||
public function requiresPermissionCheck( $array )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to VK
|
||||
* Exciting, isn't it.
|
||||
*
|
||||
* @access private
|
||||
* @param string Plug in
|
||||
*/
|
||||
public function share( $title, $url )
|
||||
{
|
||||
$title = IPSText::convertCharsets( $title, IPS_DOC_CHAR_SET, 'utf-8' );
|
||||
$url = "http://vk.com/share.php?url=" . urlencode( $url ) . '&title=' . urlencode( $title );
|
||||
|
||||
$this->registry->output->silentRedirect( $url );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,19 +3,19 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Skin Caching Functions
|
||||
* Last Updated: $Date: 2012-06-22 07:55:48 -0400 (Fri, 22 Jun 2012) $
|
||||
* Last Updated: $Date: 2013-05-20 16:38:23 -0400 (Mon, 20 May 2013) $
|
||||
* </pre>
|
||||
*
|
||||
* Owner: Matt
|
||||
* @author $Author: ips_terabyte $
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 9th July 2008
|
||||
* @version $Revision: 10969 $
|
||||
* @version $Revision: 12261 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -573,7 +573,7 @@ EOF;
|
||||
continue;
|
||||
}
|
||||
|
||||
$_path = DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_css/css_' . $_setID;
|
||||
$_path = IPS_PUBLIC_PATH . 'style_css/css_' . $_setID;
|
||||
|
||||
if ( is_dir( $_path ) )
|
||||
{
|
||||
@@ -748,7 +748,7 @@ EOF;
|
||||
* @return boolean
|
||||
*/
|
||||
public function rebuildCSSCache( $setID, $forceRebuild=FALSE )
|
||||
{
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
@@ -878,7 +878,7 @@ EOF;
|
||||
|
||||
/* Recache skin sets */
|
||||
$this->rebuildSkinSetsCache();
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -943,9 +943,9 @@ EOF;
|
||||
|
||||
$replacements = array();
|
||||
include( $dir . '/_replacements.inc' );/*noLibHook*/
|
||||
|
||||
|
||||
if ( !is_array($replacements) || !count($replacements) )
|
||||
{
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -968,7 +968,7 @@ EOF;
|
||||
foreach( $replacements as $k => $v )
|
||||
{
|
||||
$messages[] = $this->lang->words['basicimportedpre'] . $k;
|
||||
|
||||
|
||||
$this->DB->insert( 'skin_replacements', array( 'replacement_key' => $k,
|
||||
'replacement_content' => $v,
|
||||
'replacement_master_key' => $set_key,
|
||||
@@ -995,7 +995,7 @@ EOF;
|
||||
{
|
||||
/* Set directory */
|
||||
$setId = is_numeric( $setId ) ? intval( $setId ) : trim( $setId );
|
||||
$cssDir = DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_css/' . $this->remapData['css'][ $setId ];
|
||||
$cssDir = IPS_PUBLIC_PATH . 'style_css/' . $this->remapData['css'][ $setId ];
|
||||
$messages = array();
|
||||
$css = array();
|
||||
|
||||
@@ -1450,8 +1450,7 @@ EOF;
|
||||
* @return boolean
|
||||
*/
|
||||
public function __rebuildSkinSetsCache()
|
||||
{
|
||||
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
@@ -1478,6 +1477,18 @@ EOF;
|
||||
|
||||
$this->cache->setCache( 'skinsets', $cache, array( 'array' => 1, 'donow' => 1 ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Set that it's done
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->update( 'skin_collections', array( 'set_updated' => time() ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Flush IPS CDN
|
||||
//-----------------------------------------
|
||||
|
||||
$this->flushipscdn();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1538,7 +1549,7 @@ EOF;
|
||||
{
|
||||
/* Set directory */
|
||||
$css = array();
|
||||
$cssDir = DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_css/' . $dir;
|
||||
$cssDir = IPS_PUBLIC_PATH . 'style_css/' . $dir;
|
||||
$messages = array();
|
||||
|
||||
if ( ! is_dir( $cssDir ) )
|
||||
@@ -1622,7 +1633,7 @@ EOF;
|
||||
|
||||
$setData = $this->fetchSkinData( $id );
|
||||
|
||||
$path = DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_css/' . $dir;
|
||||
$path = IPS_PUBLIC_PATH . 'style_css/' . $dir;
|
||||
$msgs = array();
|
||||
|
||||
if ( ! isset( $setData['set_id'] ) )
|
||||
@@ -1956,34 +1967,34 @@ EOF;
|
||||
{
|
||||
$good_to_go = 1;
|
||||
|
||||
if ( is_writeable( DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_css/' ) === TRUE )
|
||||
if ( is_writeable( IPS_PUBLIC_PATH . 'style_css/' ) === TRUE )
|
||||
{
|
||||
$good_to_go = 1;
|
||||
|
||||
if ( ! is_dir( DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_css/css_' . $setID ) )
|
||||
if ( ! is_dir( IPS_PUBLIC_PATH . 'style_css/css_' . $setID ) )
|
||||
{
|
||||
if ( ! @ mkdir( DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_css/css_' . $setID, IPS_FOLDER_PERMISSION ) )
|
||||
if ( ! @ mkdir( IPS_PUBLIC_PATH . 'style_css/css_' . $setID, IPS_FOLDER_PERMISSION ) )
|
||||
{
|
||||
$this->_addErrorMessage( sprintf( $this->lang->words['couldnotcreatecssdir'], $setID ) );
|
||||
return $this->_errorMsgs;
|
||||
}
|
||||
else
|
||||
{
|
||||
@file_put_contents( DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_css/css_' . $setID . '/index.html', '' );
|
||||
@chmod( DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_css/css_'.$setID, IPS_FOLDER_PERMISSION );
|
||||
@file_put_contents( IPS_PUBLIC_PATH . 'style_css/css_' . $setID . '/index.html', '' );
|
||||
@chmod( IPS_PUBLIC_PATH . 'style_css/css_'.$setID, IPS_FOLDER_PERMISSION );
|
||||
$good_to_go = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( is_writable( DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_css/css_' . $setID ) !== TRUE )
|
||||
if ( is_writable( IPS_PUBLIC_PATH . 'style_css/css_' . $setID ) !== TRUE )
|
||||
{
|
||||
$this->_addErrorMessage( sprintf( $this->lang->words['cssdirnotwritaaaable'], $setID ) );
|
||||
$good_to_go = 0;
|
||||
}
|
||||
else if ( is_file( DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_css/css_'.$setID.'/'.$css_group.'.css' ) )
|
||||
else if ( is_file( IPS_PUBLIC_PATH . 'style_css/css_'.$setID.'/'.$css_group.'.css' ) )
|
||||
{
|
||||
if ( is_writable( DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_css/css_'.$setID.'/'.$css_group.'.css' ) !== TRUE )
|
||||
if ( is_writable( IPS_PUBLIC_PATH . 'style_css/css_'.$setID.'/'.$css_group.'.css' ) !== TRUE )
|
||||
{
|
||||
$this->_addErrorMessage( sprintf( $this->lang->words['cssfilenotwriteable'], $setID, $css_group ) );
|
||||
$good_to_go = 0;
|
||||
@@ -2017,11 +2028,11 @@ EOF;
|
||||
|
||||
if ( $good_to_go )
|
||||
{
|
||||
if ( $FH = @fopen( DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_css/css_'.$setID.'/'.$css_group.'.css', 'w' ) )
|
||||
if ( $FH = @fopen( IPS_PUBLIC_PATH . 'style_css/css_'.$setID.'/'.$css_group.'.css', 'w' ) )
|
||||
{
|
||||
fwrite( $FH, $css_content, strlen($css_content) );
|
||||
fclose( $FH );
|
||||
@chmod( DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_css/css_'.$setID.'/'.$css_group.'.css', IPS_FILE_PERMISSION );
|
||||
@chmod( IPS_PUBLIC_PATH . 'style_css/css_'.$setID.'/'.$css_group.'.css', IPS_FILE_PERMISSION );
|
||||
|
||||
$this->_addMessage( $this->lang->words['basicwrittenpre']. "skin_cache/css_{$setID}/{$css_group}.css" );
|
||||
}
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Skin Functions
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2012-11-30 10:02:12 -0500 (Fri, 30 Nov 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* Owner: Matt
|
||||
* @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
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 9th March 2005 11:03
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 11668 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Skin Functions
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2013-05-07 22:02:49 -0400 (Tue, 07 May 2013) $
|
||||
* </pre>
|
||||
*
|
||||
* Owner: Matt
|
||||
@@ -15,7 +15,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 9th March 2005 11:03
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 12236 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -222,7 +222,7 @@ class skinFunctions
|
||||
else
|
||||
{
|
||||
$REMAP = array();
|
||||
require( DOC_IPS_ROOT_PATH . 'cache/skin_cache/masterMap.php' );/*noLibHook*/
|
||||
require( IPS_CACHE_PATH . 'cache/skin_cache/masterMap.php' );/*noLibHook*/
|
||||
|
||||
if ( is_array($REMAP) && count($REMAP) )
|
||||
{
|
||||
@@ -1541,6 +1541,9 @@ class skinFunctions
|
||||
//-----------------------------------------
|
||||
|
||||
$this->rebuildCSS( $setID );
|
||||
|
||||
/* Flush CDN */
|
||||
$this->flushipscdn();
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove dead-uns?
|
||||
@@ -1643,6 +1646,9 @@ class skinFunctions
|
||||
|
||||
$this->rebuildCSS( $setID );
|
||||
|
||||
/* Flush CDN */
|
||||
$this->flushipscdn();
|
||||
|
||||
//-----------------------------------------
|
||||
// Grab the next template bit inline...
|
||||
//-----------------------------------------
|
||||
@@ -2263,7 +2269,7 @@ class skinFunctions
|
||||
//-----------------------------------------
|
||||
|
||||
$this->rebuildPHPTemplates( $setID, $template['template_group'] );
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Return
|
||||
//-----------------------------------------
|
||||
@@ -2739,6 +2745,9 @@ class skinFunctions
|
||||
$this->rebuildPHPTemplates( $setId );
|
||||
}
|
||||
|
||||
/* Flush CDN */
|
||||
$this->flushipscdn();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2981,4 +2990,18 @@ class skinFunctions
|
||||
$this->DB->update( 'skin_collections', array( 'set_locked_uagent' => serialize( $old ) ), "set_key='mobile'" );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush IPS CDN Cache
|
||||
*/
|
||||
public function flushipscdn()
|
||||
{
|
||||
if ( ipsRegistry::$settings['ips_cdn'] )
|
||||
{
|
||||
require_once IPS_KERNEL_PATH . 'classFileManagement.php';
|
||||
$cfm = new classFileManagement();
|
||||
$cfm->timeout = 1;
|
||||
$cfm->getFileContents( "http://license.invisionpower.com/?a=cdnflush&key=" . ipsRegistry::$settings['ipb_reg_number'] . "&version=" . IPB_LONG_VERSION );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Skin Functions
|
||||
* Last Updated: $Date: 2011-05-05 12:03:47 +0100 (Thu, 05 May 2011) $
|
||||
* </pre>
|
||||
@@ -109,277 +109,7 @@ class skinGenerator extends skinCaching
|
||||
*/
|
||||
public function buildLocalJsonCache()
|
||||
{
|
||||
/* Now fetch JSON data from the server and write it */
|
||||
require_once( IPS_KERNEL_PATH . 'classFileManagement.php' );/*noLibHook*/
|
||||
|
||||
$json = <<<_D_a_rk_
|
||||
var IPS_SKIN_GEN_DATA = {
|
||||
"skinGroups": {
|
||||
"app_calendar": ["App: Calendar", ["app_calendar_td_selected", "app_calendar_td_hover", "app_calendar_td_blank", "app_calendar_td_today"]],
|
||||
"app_gallery": ["App: Gallery", ["albumDetailTable_td"]],
|
||||
"global": ["Global Styles", ["body", "a", "content", "desc", "desclighter"]],
|
||||
"tables": ["Table Content", ["row1", "row2", "unread", "unreadalt", "tableheader", "tableheader_a", "ipb_table"]],
|
||||
"other": ["Other Styles", ["ipsbox", "Bar Header", "postblock", "NoMessages", "fieldsetSubmit", "general_box", "general_box_h3", "ipsboxcontainer", "maintitle", "sideMenuActive", "ipsVerticalTabbed_tabs_li", "ipsVerticalTabbed_tabs_li_a", "ipsVerticalTabbed_tabs_li_a_hover", "ipsVerticalTabbed_tabs_li_active", "ipsfilterbar_item", "ipsfilterbar_active"]],
|
||||
"buttons": ["Button Styles", ["but_submit", "but_submit_alt", "but_topic", "but_secondary"]],
|
||||
"header": ["Header Elements", ["registerLink", "header", "primarynav", "primarynav_inactive", "primarynav_active", "searchbutton"]],
|
||||
"pagination": ["Pagination", ["paginationBackForward", "paginationBackForwardHover", "paginationBackActive"]],
|
||||
"sidebar": ["Sidebar", ["ipsSideBlock", "ipsSideBlock_h3"]],
|
||||
"profiles": ["Profile Page", ["statusupdate"]],
|
||||
"app_blog": ["App: Blog", ["entry_header"]]
|
||||
},
|
||||
"colorizeGroups": {
|
||||
"base": ["app_calendar_td_selected", "app_calendar_td_hover", "app_calendar_td_blank", "app_calendar_td_today", "albumDetailTable_td", "body", "content", "row1", "row2", "unread", "unreadalt", "ipsbox", "Bar Header", "tableheader", "tableheader_a", "postblock", "NoMessages", "but_submit_alt", "fieldsetSubmit", "registerLink", "header", "primarynav", "primarynav_inactive", "primarynav_active", "general_box", "general_box_h3", "ipsboxcontainer", "maintitle", "desc", "desclighter", "ipb_table", "ipsVerticalTabbed_tabs_li", "ipsVerticalTabbed_tabs_li_a", "ipsVerticalTabbed_tabs_li_a_hover", "ipsVerticalTabbed_tabs_li_active", "ipsfilterbar_item", "ipsfilterbar_active", "but_secondary", "paginationBackForward", "ipsSideBlock", "ipsSideBlock_h3", "statusupdate", "entry_header"],
|
||||
"text": ["a"],
|
||||
"secondary": ["but_submit", "searchbutton", "but_topic"],
|
||||
"tertiary": ["sideMenuActive", "paginationBackForwardHover", "paginationBackActive"]
|
||||
},
|
||||
"classes": {
|
||||
"app_calendar_td_selected": ["#calendar_table td.selected", "Calendar Selected Cell", "Used for selected cells in the monthly calendar",
|
||||
{
|
||||
"background": ["#E2E9F0", ""],
|
||||
"shadow": ["#E2E9F0", ""]
|
||||
}],
|
||||
"app_calendar_td_hover": ["#calendar_table td.normal:hover", "Calendar Cell Hover", "Used for hovering over cells in the monthly calendar",
|
||||
{
|
||||
"background": ["#EDF1F5", ""]
|
||||
}],
|
||||
"app_calendar_td_blank": ["#calendar_table td.blank", "Calendar Blank Cell", "Used for blank cells in the monthly calendar",
|
||||
{
|
||||
"background": ["#dbe2e8", ""],
|
||||
"border": ["#dbe2e8", ""]
|
||||
}],
|
||||
"app_calendar_td_today": ["#calendar_table td.today", "Calendar Today Cell", "Used for todays cell in the monthly calendar",
|
||||
{
|
||||
"background": ["#f1f6ec", ""],
|
||||
"border": ["#6f8f52", ""],
|
||||
"color": ["#6f8f52", ""]
|
||||
}],
|
||||
"albumDetailTable_td": ["#albumDetailTable td", "Album Detail Table", "Thick border for detail table",
|
||||
{
|
||||
"border": ["#ebf0f3", ""]
|
||||
}],
|
||||
"body": ["html, body", "Body", "The page background",
|
||||
{
|
||||
"background": ["#d8dde8", ""],
|
||||
"color": ["#5a5a5a", ""]
|
||||
}],
|
||||
"a": ["a", "Links", "Basic links",
|
||||
{
|
||||
"color": ["#225985", ""]
|
||||
}],
|
||||
"content": ["#content", "Main Content Area", "The area that contains all page content",
|
||||
{
|
||||
"background": ["#fff", ""]
|
||||
}],
|
||||
"row1": [".row1, .post_block.row1", "Table Row 1", "Generic table row color 1",
|
||||
{
|
||||
"background": ["#fff", ""]
|
||||
}],
|
||||
"row2": [".row2, .post_block.row2", "Table Row 2", "Generic table row color 2",
|
||||
{
|
||||
"background": ["#f1f6f9", ""]
|
||||
}],
|
||||
"unread": [".unread", "Unread Row", "Unread row colour",
|
||||
{
|
||||
"background": ["#f7fbfc", ""]
|
||||
}],
|
||||
"unreadalt": [".unread .altrow, .unread.altrow", "Unread Row (Alt)", "Darker version of unread row, used to highlight certain table columns",
|
||||
{
|
||||
"background": ["#E2E9F0", ""]
|
||||
}],
|
||||
"ipsbox": [".ipsBox", "Content Box", "Used to wrap most content sections",
|
||||
{
|
||||
"background": ["#ebf0f3", ""]
|
||||
}],
|
||||
"Bar Header": [".bar", "Bar Header", "Used in post forms, etc",
|
||||
{
|
||||
"background": ["#eff4f7", ""]
|
||||
}],
|
||||
"tableheader": [".header", "Table Header", "Used for table headings",
|
||||
{
|
||||
"background": ["#b6c7db", ""],
|
||||
"color": ["#1d3652", ""]
|
||||
}],
|
||||
"tableheader_a": ["body .ipb_table .header a,\tbody .topic_options a", "Table Header Link", "Used for links in table headings",
|
||||
{
|
||||
"color": ["#1d3652", ""]
|
||||
}],
|
||||
"postblock": [".post_block", "Post Block", "An individual post wrapper",
|
||||
{
|
||||
"background": ["#fff", ""],
|
||||
"border": ["#D6E2EB", ""]
|
||||
}],
|
||||
"NoMessages": [".no_messages", "No Messages Box", "Box for 'no data' type messages",
|
||||
{
|
||||
"background": ["#f6f8fa", ""],
|
||||
"border": false
|
||||
}],
|
||||
"but_submit": [".input_submit", "Submit Button", "The primary button that submits forms",
|
||||
{
|
||||
"background": ["#212121", ""],
|
||||
"border": ["#5c5c5c", ""],
|
||||
"color": ["#fff", ""],
|
||||
"boxshadow": ["#5c5c5c", " inset 0 1px 0 0 "]
|
||||
}],
|
||||
"but_submit_alt": [".input_submit.alt", "Alternate Submit Button", "Secondary buttons for forms",
|
||||
{
|
||||
"background": ["#e2e9f0", ""],
|
||||
"border": ["#dae2ea", ""],
|
||||
"color": ["#464646", ""],
|
||||
"boxshadow": ["#eff3f8", " inset 0 1px 0 0 "]
|
||||
}],
|
||||
"fieldsetSubmit": ["body#ipboard_body fieldset.submit,body#ipboard_body p.submit", "Submit\/Button Strip", "Used in forms where the submit buttons are located",
|
||||
{
|
||||
"background": ["#d1ddea", ""]
|
||||
}],
|
||||
"registerLink": ["#user_navigation #register_link", "Create Account Link", "The create accoun tbutton",
|
||||
{
|
||||
"background": ["#7ba60d", ""],
|
||||
"border": ["#7ba60d", ""],
|
||||
"color": ["#fff", ""],
|
||||
"boxshadow": false
|
||||
}],
|
||||
"header": ["#branding", "Header Bar", "Bar containing logo, global search etc.",
|
||||
{
|
||||
"background": ["#0f3854", ""],
|
||||
"border": ["#1b3759", ""]
|
||||
}],
|
||||
"primarynav": ["#primary_nav", "Primary Nav Bar", "Primary navigation bar (with app tabs)",
|
||||
{
|
||||
"background": ["#204066", ""]
|
||||
}],
|
||||
"primarynav_inactive": ["#primary_nav a", "Inactive App Tab", "An inactive tab in the Primary Nav bar",
|
||||
{
|
||||
"background": ["#1c3b5f", ""],
|
||||
"color": ["#c5d5e2", ""]
|
||||
}],
|
||||
"primarynav_active": ["#primary_nav .active a", "Active App Tab", "An active tab in the Primary Nav bar",
|
||||
{
|
||||
"background": ["#fff", ""],
|
||||
"color": ["#0b5794", ""]
|
||||
}],
|
||||
"searchbutton": ["#search .submit_input", "Search Button", "The submit button for the global search bar",
|
||||
{
|
||||
"background": ["#7ba60d", ""],
|
||||
"border": ["#7ba60d", ""]
|
||||
}],
|
||||
"general_box": [".general_box", "General Box Container", "Used to contain contents of general boxes such as used on profile page",
|
||||
{
|
||||
"background": ["#fcfcfc", ""]
|
||||
}],
|
||||
"general_box_h3": [".general_box h3", "General Box Container H3", "Used to contain contents of general boxes title",
|
||||
{
|
||||
"background": ["#DBE2EC", ""],
|
||||
"color": ["#204066", ""]
|
||||
}],
|
||||
"ipsboxcontainer": [".ipsBox_container", "Content Box Container", "Used to contain contents of Content Box",
|
||||
{
|
||||
"background": ["#fff", ""],
|
||||
"border": ["#dbe4ef", ""]
|
||||
}],
|
||||
"maintitle": [".maintitle", "Main Title", "Bar used for block titles, filter bars etc.",
|
||||
{
|
||||
"background": ["#2c5687", ""],
|
||||
"color": ["#fff", ""],
|
||||
"border": ["#528cbc", ""],
|
||||
"boxshadow": ["#528cbc", " inset 0px 1px 0 "]
|
||||
}],
|
||||
"desc": [".desc, .desc.blend_links a, p.posted_info", "Description text", "Used for small text throughout",
|
||||
{
|
||||
"color": ["#777777", ""]
|
||||
}],
|
||||
"desclighter": [".desc.lighter, .desc.lighter.blend_links a", "Description text (lighter)", "Used for small lighter text throughout",
|
||||
{
|
||||
"color": ["#a4a4a4", ""]
|
||||
}],
|
||||
"ipb_table": ["table.ipb_table td", "Tabular Data Rows", "Used where there is tabular data",
|
||||
{
|
||||
"border": ["#f3f3f3", ""]
|
||||
}],
|
||||
"sideMenuActive": [".ipsSideMenu ul li.active a", "Side Menu Active", "A selected entry in a side menu",
|
||||
{
|
||||
"background": ["#af286d", ""],
|
||||
"color": ["#fff", ""]
|
||||
}],
|
||||
"ipsVerticalTabbed_tabs_li": [".ipsVerticalTabbed_tabs li", "Vertical Tab", "Used on profile page and other UserCP when veritcal tabs are needed",
|
||||
{
|
||||
"background": ["#f6f8fb", ""],
|
||||
"color": ["#808080", ""],
|
||||
"border": ["#DBE4EF", ""]
|
||||
}],
|
||||
"ipsVerticalTabbed_tabs_li_a": [".ipsVerticalTabbed_tabs li a", "Vertical Tab Link", "Link on a vertical tab",
|
||||
{
|
||||
"color": ["#8d8d8d", ""]
|
||||
}],
|
||||
"ipsVerticalTabbed_tabs_li_a_hover": [".ipsVerticalTabbed_tabs li a:hover", "Vertical Tab Link Hover", "Hover over a vertical tab",
|
||||
{
|
||||
"background": ["#eaeff5", ""],
|
||||
"color": ["#808080", ""]
|
||||
}],
|
||||
"ipsVerticalTabbed_tabs_li_active": [".ipsVerticalTabbed_tabs li.active a", "Vertical Tab Active", "An active tab",
|
||||
{
|
||||
"background": ["#fff", ""],
|
||||
"color": ["#353535", ""],
|
||||
"border": ["#fff", ""]
|
||||
}],
|
||||
"ipsfilterbar_item": [".ipsFilterbar li a", "Filter Bar Item", "Used for tabs in a filter bar",
|
||||
{
|
||||
"color": ["#fff", ""]
|
||||
}],
|
||||
"ipsfilterbar_active": [".ipsFilterbar li.active a", "Filter Bar Active Item", "Used for active tabs in a filter bar",
|
||||
{
|
||||
"background": ["#244156", ""],
|
||||
"color": ["#fff", ""]
|
||||
}],
|
||||
"but_topic": [".topic_buttons li.important a, .topic_buttons li.important span, .ipsButton .important,.topic_buttons li a, .topic_buttons li span, .ipsButton", "Primary Button", "Button used for main actions, such as New Topic",
|
||||
{
|
||||
"background": ["#212121", ""],
|
||||
"border": ["#212121", ""],
|
||||
"color": ["#fff", ""],
|
||||
"boxshadow": ["#5c5c5c", " inset 0 1px 0 0 "]
|
||||
}],
|
||||
"but_secondary": [".ipsButton_secondary", "Secondary Button", "Secondary button, used normally for Follow actions",
|
||||
{
|
||||
"background": ["#f6f6f6", ""],
|
||||
"border": ["#dbdbdb", ""],
|
||||
"color": ["#616161", ""]
|
||||
}],
|
||||
"paginationBackForward": [".pagination .back a,.pagination .forward a", "Pagination Next\/Foward", "Next, back, forward buttons",
|
||||
{
|
||||
"background": ["#eaeaea", ""],
|
||||
"color": ["#5a5a5a", ""]
|
||||
}],
|
||||
"paginationBackForwardHover": [".pagination .back a:hover,\t.pagination .forward a:hover", "Pagination Next\/Foward Hover", "Next, back, forward buttons when hovered",
|
||||
{
|
||||
"background": ["#af286d", ""],
|
||||
"color": ["#fff", ""]
|
||||
}],
|
||||
"paginationBackActive": [".pagination .pages li.active", "Pagination Page Active", "Selected page",
|
||||
{
|
||||
"background": ["#7BA60D", ""],
|
||||
"color": ["#fff", ""]
|
||||
}],
|
||||
"ipsSideBlock": [".ipsSideBlock", "Sidebar Block", "Sidebar block background color",
|
||||
{
|
||||
"background": ["#F7FBFC", ""]
|
||||
}],
|
||||
"ipsSideBlock_h3": [".ipsSideBlock h3", "Sidebar Block Header", "Sidebar block Header",
|
||||
{
|
||||
"background": ["#DBE2EC", ""],
|
||||
"color": ["#204066", ""]
|
||||
}],
|
||||
"statusupdate": [".status_update", "Status Update Block", "Status update background",
|
||||
{
|
||||
"background": ["#71a5c9", ""],
|
||||
"color": ["#fff", ""]
|
||||
}],
|
||||
"entry_header": [".entry.featured .entry_header, .entry.featured .entry_footer", "Blog Entry Header\/Footer\/Featured", "Header for blog entry",
|
||||
{
|
||||
"background": ["#f5faf7", ""]
|
||||
}]
|
||||
}
|
||||
}
|
||||
_D_a_rk_;
|
||||
$json = darkLAE::getVisualSkinEditorJsonData();
|
||||
|
||||
if ( $json )
|
||||
{
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Skin Functions
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2012-11-27 20:31:18 -0500 (Tue, 27 Nov 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* Owner: Matt
|
||||
@@ -15,7 +15,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 9th March 2005 11:03
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 11650 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -595,7 +595,7 @@ class skinImportExport extends skinCaching
|
||||
$new_items['templates'][] = $existing_id;
|
||||
$this->DB->update( 'skin_templates', array( 'template_content' => $template['template_content'],
|
||||
'template_data' => $template['template_data'],
|
||||
'template_updated' => $template['template_updated'],
|
||||
'template_updated' => ( $template['template_updated'] ) ? $template['template_updated'] : IPS_UNIX_TIME_NOW,
|
||||
'template_removable' => 1,
|
||||
'template_user_edited' => 1,
|
||||
'template_user_added' => $isAdded,
|
||||
@@ -608,7 +608,7 @@ class skinImportExport extends skinCaching
|
||||
'template_content' => $template['template_content'],
|
||||
'template_name' => $template['template_name'],
|
||||
'template_data' => $template['template_data'],
|
||||
'template_updated' => $template['template_updated'],
|
||||
'template_updated' => ( $template['template_updated'] ) ? $template['template_updated'] : IPS_UNIX_TIME_NOW,
|
||||
'template_removable' => 1,
|
||||
'template_user_edited' => 1,
|
||||
'template_user_added' => $isAdded,
|
||||
@@ -1098,7 +1098,7 @@ class skinImportExport extends skinCaching
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/useragents/userAgentFunctions.php', 'userAgentFunctions' );
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/useragents/userAgentFunctions.php', 'userAgentFunctions' );
|
||||
$userAgentFunctions = new $classToLoad( $this->registry );
|
||||
|
||||
$skins = array();
|
||||
@@ -1569,6 +1569,7 @@ class skinImportExport extends skinCaching
|
||||
unset( $templateData['template_id'] );
|
||||
unset( $templateData['template_set_id'] );
|
||||
unset( $templateData['template_added_to'] );
|
||||
unset( $templateData['template_updated'] );
|
||||
|
||||
$xml->addElementAsRecord( 'templategroup', 'template', $templateData );
|
||||
$added++;
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Tagging: Abstract class
|
||||
* Matt Mecham
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2013-05-16 21:35:15 -0400 (Thu, 16 May 2013) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 24 Feb 2011
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 12257 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -75,6 +75,9 @@ abstract class classes_tag_abstract
|
||||
{
|
||||
switch( $this->errorMsg )
|
||||
{
|
||||
case 'no_good_tags':
|
||||
return sprintf( $this->lang->words['no_good_tags'], $this->_getMinLen(), $this->_getMaxLen() );
|
||||
break;
|
||||
case 'too_few_tags':
|
||||
return sprintf( $this->lang->words['too_few_tags'], $this->_getMinTags() );
|
||||
break;
|
||||
@@ -171,6 +174,11 @@ abstract class classes_tag_abstract
|
||||
|
||||
if ( $tags === false )
|
||||
{
|
||||
if ( $this->settings['tags_min'] and $this->settings['tags_min_req'] )
|
||||
{
|
||||
$this->setErrorMsg('too_few_tags');
|
||||
}
|
||||
|
||||
/* Error message is populated at this point */
|
||||
return false;
|
||||
}
|
||||
@@ -254,6 +262,37 @@ abstract class classes_tag_abstract
|
||||
$this->_addCache( $where );
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset prefix ID for meta_id by earliest prefix
|
||||
* @param int Meta ID
|
||||
* @param boolean Recache tags
|
||||
*/
|
||||
public function resetPrefix( $metaId, $recache=true )
|
||||
{
|
||||
$tags = $this->getRawTagsByMetaId( $metaId );
|
||||
$sortedMate = array();
|
||||
|
||||
foreach( $tags as $id => $tag )
|
||||
{
|
||||
$sortedMate[ $tag['tag_added'] . '.' . $tag['tag_id'] ] = $id;
|
||||
}
|
||||
|
||||
ksort( $sortedMate );
|
||||
|
||||
$tagId = array_shift( $sortedMate );
|
||||
|
||||
if ( $tagId )
|
||||
{
|
||||
$this->DB->update( 'core_tags', array( 'tag_prefix' => 0 ), 'tag_meta_app=\'' . $this->getApp() . '\' AND tag_meta_area=\'' . $this->getArea() . '\' AND tag_meta_id=' . intval( $metaId ) );
|
||||
$this->DB->update( 'core_tags', array( 'tag_prefix' => 1 ), 'tag_meta_app=\'' . $this->getApp() . '\' AND tag_meta_area=\'' . $this->getArea() . '\' AND tag_id=' . intval( $tagId ) );
|
||||
}
|
||||
|
||||
if ( $recache )
|
||||
{
|
||||
$this->rebuildCache( array( 'meta_id' => $metaId ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add tags to the dee bee
|
||||
* @param mixed Array of tag text or string (tag, tag, tag)
|
||||
@@ -570,8 +609,10 @@ abstract class classes_tag_abstract
|
||||
*/
|
||||
public function moveTagsByMetaId( $oldMetaIds, $newMetaId )
|
||||
{
|
||||
$keys = array();
|
||||
$newKey = $this->_getKey( array( 'meta_id' => $newMetaId ) );
|
||||
$keys = array();
|
||||
$newKey = $this->_getKey( array( 'meta_id' => $newMetaId ) );
|
||||
$raw = array();
|
||||
$hasPrefix = false;
|
||||
|
||||
/* Basic */
|
||||
if ( ! is_array( $oldMetaIds ) )
|
||||
@@ -582,11 +623,27 @@ abstract class classes_tag_abstract
|
||||
/* Fetch keys */
|
||||
foreach( $oldMetaIds as $id )
|
||||
{
|
||||
$keys[] = $this->_getKey( array( 'meta_id' => $id ) );
|
||||
$raw[ $id ] = $this->getRawTagsByMetaId( $id );
|
||||
$keys[] = $this->_getKey( array( 'meta_id' => $id ) );
|
||||
$this->_deleteStoredPermissionDataByMetaId( $id );
|
||||
$this->_deleteCache( array( 'meta_id' => $id ) );
|
||||
}
|
||||
|
||||
/* Figure out if we have a prefix or not */
|
||||
if ( count( $raw ) )
|
||||
{
|
||||
foreach( $raw as $_id => $array )
|
||||
{
|
||||
foreach( $raw[ $_id ] as $id => $tag )
|
||||
{
|
||||
if ( $tag['tag_prefix'] )
|
||||
{
|
||||
$hasPrefix = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Update tags */
|
||||
$this->DB->update( 'core_tags', array( 'tag_meta_id' => $newMetaId,
|
||||
'tag_aai_lookup' => $newKey ), 'tag_aai_lookup IN (\'' . implode( "','", $keys ) . '\')' );
|
||||
@@ -602,6 +659,16 @@ abstract class classes_tag_abstract
|
||||
'permission_string' => $permissions,
|
||||
'meta_visible' => $isVisible ) );
|
||||
|
||||
/* Get new tags to remove dupes */
|
||||
$tags = $this->getTagsByMetaId( $newMetaId );
|
||||
$this->registry->tags->replace( $tags['tags'], array( 'meta_id' => $newMetaId ) );
|
||||
|
||||
/* Reset prefix ID */
|
||||
if ( $hasPrefix )
|
||||
{
|
||||
$this->resetPrefix( $newMetaId );
|
||||
}
|
||||
|
||||
/* Rebuild cache */
|
||||
$this->_addCache( array( 'meta_id' => $newMetaId, 'meta_parent_id' => $parent ) );
|
||||
}
|
||||
@@ -767,6 +834,17 @@ abstract class classes_tag_abstract
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild cache
|
||||
* @param array $where
|
||||
* @return void
|
||||
*/
|
||||
public function rebuildCache( $where )
|
||||
{
|
||||
$this->_deleteCache( $where );
|
||||
$this->_addCache( $where );
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for tags
|
||||
* @param mixed $tags Array or string
|
||||
@@ -1168,7 +1246,7 @@ abstract class classes_tag_abstract
|
||||
$tags = array( $this->_stripHtml( ( $this->_forceLower() ? IPSText::mbstrtolower( $tags ) : $tags ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* So.. got tags to parse? */
|
||||
if ( count( $tags ) )
|
||||
{
|
||||
@@ -1249,7 +1327,7 @@ abstract class classes_tag_abstract
|
||||
/* Generic catch all in case min/max tags aren't set up. */
|
||||
if ( ! count( $tags ) )
|
||||
{
|
||||
$this->setErrorMsg('too_few_tags');
|
||||
$this->setErrorMsg('no_good_tags');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Tagging: Bootstrap
|
||||
* Matt Mecham
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 24 Feb 2011
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Tagging: Cloud class - is it bird? is it a cloud? No it's a.. nope, it's a cloud. Sorry for that.
|
||||
* Matt Mecham
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 24 Feb 2011
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Tagging: Default extensions file
|
||||
* Matt Mecham
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 24 Feb 2011
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Tagging: Bootstrap
|
||||
* Matt Mecham
|
||||
* 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) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
@@ -15,7 +15,7 @@
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 24 Feb 2011
|
||||
* @version $Revision: 10914 $
|
||||
* @version $Revision: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Global Search
|
||||
* Last Updated: $Date: 2012-06-21 12:05:17 -0400 (Thu, 21 Jun 2012) $
|
||||
* Last Updated: $Date: 2013-03-01 10:07:43 -0500 (Fri, 01 Mar 2013) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: AndyMillne $
|
||||
* @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: 10967 $
|
||||
* @version $Rev: 12051 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
@@ -121,21 +121,33 @@ class classes_tags_search_sphinx
|
||||
}
|
||||
|
||||
if ( isset( $tags ) )
|
||||
{
|
||||
{
|
||||
if ( is_array( $tags ) )
|
||||
{
|
||||
foreach ( $tags as $key => $tag )
|
||||
{
|
||||
$tags[$key] = $this->sphinxClient->EscapeString( $tag );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$tags = $this->sphinxClient->EscapeString( $tags );
|
||||
}
|
||||
|
||||
if ( isset( $options['match'] ) AND $options['match'] == 'loose' )
|
||||
{
|
||||
$query .= ' @tag_text (' . ( ( is_array( $tags ) ) ? implode( " | ", $tags ) : $tags ) . ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$query .= ' @tag_text ^' . ( ( is_array( $tags ) ) ? implode( "$ | ^", $tags ) : $tags ) . '$';
|
||||
$query .= ' @tag_text "^' . ( ( is_array( $tags ) ) ? implode( '$" | "^', $tags ) : $tags ) . '$"';
|
||||
}
|
||||
}
|
||||
|
||||
/* Did we add in perm check? */
|
||||
if ( ! empty( $options['isViewable'] ) )
|
||||
{
|
||||
$query .= ' @tag_perm_text ,"' . implode( '," | ",', $this->member->perm_id_array ) . ',"';
|
||||
$query .= ' @tag_perm_text ",' . implode( '," | ",', $this->member->perm_id_array ) . ',"';
|
||||
|
||||
$this->sphinxClient->SetFilter( 'tag_perm_visible', array( 1 ) );
|
||||
}
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* IP.Board v3.4.5
|
||||
* Global Search
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* Last Updated: $Date: 2012-09-06 10:21:14 -0400 (Thu, 06 Sep 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @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: 11324 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
@@ -54,7 +54,7 @@ class classes_tags_search_sql
|
||||
public function run( array $tags, array $options )
|
||||
{
|
||||
$where = array();
|
||||
$order = ( ! empty( $options['sortKey'] ) ) ? $options['sortKey'] : 'tg.tag_id';
|
||||
$order = ( ! empty( $options['sortKey'] ) ) ? $options['sortKey'] : 'tg.tag_meta_id';
|
||||
$dir = ( ! empty( $options['sortOrder'] ) ) ? $options['sortOrder'] : 'desc';
|
||||
$return = array();
|
||||
|
||||
@@ -150,6 +150,12 @@ class classes_tags_search_sql
|
||||
|
||||
$options['limit'] = ( $options['limit'] > 0 && $options['limit'] < 5000 ) ? $options['limit'] : 250;
|
||||
|
||||
/* we need to make an exception if filtering by date */
|
||||
if( class_exists( 'IPSSearchRegistry' ) && ( IPSSearchRegistry::get('in.search_date_start') || IPSSearchRegistry::get('in.search_date_end') ) )
|
||||
{
|
||||
$options['limit'] = 10000000000;
|
||||
}
|
||||
|
||||
$this->DB->allow_sub_select = true;
|
||||
|
||||
$this->DB->query( 'SELECT tg.* ' . $_select . ' FROM ' . $prefix . 'core_tags tg ' . $join . ' WHERE ' . implode( ' AND ', $where ) . ' AND tg.tag_aai_lookup IN ('
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* IP.Content custom bbcode
|
||||
* Last Updated: $Date: 2012-06-01 13:11:08 -0400 (Fri, 01 Jun 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Content
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10855 $
|
||||
*/
|
||||
|
||||
if( !class_exists('bbcode_parent_main_class') )
|
||||
{
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/text/parser/bbcode/defaults.php' );/*noLibHook*/
|
||||
}
|
||||
|
||||
class bbcode_plugin_page extends bbcode_parent_main_class
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry object
|
||||
* @param object Parent
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry, $_parent=null )
|
||||
{
|
||||
$this->currentBbcode = 'page';
|
||||
|
||||
parent::__construct( $registry, $_parent );
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the actual replacement
|
||||
*
|
||||
* @access protected
|
||||
* @param string $txt Parsed text from database to be edited
|
||||
* @return string BBCode content, ready for editing
|
||||
*/
|
||||
protected function _replaceText( $txt )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$tag = '[' . $this->currentBbcode . ']';
|
||||
$_curPage = $this->request['pg'] ? $this->request['pg'] : 1;
|
||||
$_ttlPages = 1;
|
||||
$_ttlPages += substr_count( $txt, $tag );
|
||||
|
||||
if( $this->caches['pagination_url'] )
|
||||
{
|
||||
$_reconstructed = rtrim( $this->caches['pagination_url'], '/' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$_requestUri = rtrim( $_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : @getenv('REQUEST_URI'), '/' );
|
||||
$_reconstructed = ( ( $_SERVER['HTTPS'] and $_SERVER['HTTPS'] != 'off' ) ? "https://" : "http://" ) . $_SERVER['HTTP_HOST'] . ( substr( $_requestUri, 0, 1 ) == '/' ? $_requestUri : '/' . $_requestUri );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get rid of existing pg= params
|
||||
//-----------------------------------------
|
||||
|
||||
$_reconstructed = preg_replace( "/pg=(\d+)/", '', $_reconstructed );
|
||||
|
||||
$_reconstructed = rtrim($_reconstructed, '?&' );
|
||||
|
||||
$_reconstructed = str_replace( '&', '&', $_reconstructed );
|
||||
|
||||
//-----------------------------------------
|
||||
// Add on the parameter separator
|
||||
//-----------------------------------------
|
||||
|
||||
if( $this->settings['url_type'] == 'query_string' )
|
||||
{
|
||||
if( substr_count( $_reconstructed, '?' ) > 1 )
|
||||
{
|
||||
$_reconstructed .= '&';
|
||||
}
|
||||
else
|
||||
{
|
||||
$_reconstructed .= '?';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( strpos( $_reconstructed, '?' ) !== false )
|
||||
{
|
||||
$_reconstructed .= '&';
|
||||
}
|
||||
else
|
||||
{
|
||||
$_reconstructed .= '?';
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// If no pages, no need to have links
|
||||
//-----------------------------------------
|
||||
|
||||
if( $_ttlPages < 2 )
|
||||
{
|
||||
return $txt;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Do replacements
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$_curPage )
|
||||
{
|
||||
$txt = substr( $txt, 0, strpos( $txt, $tag ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$bits = explode( $tag, $txt );
|
||||
|
||||
$txt = $bits[ $_curPage - 1 ];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Clean up leading <br /> tags
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = trim($txt);
|
||||
|
||||
if( substr( $txt, 0, 15 ) == '~~~~~_____~~~~~' )
|
||||
{
|
||||
$txt = substr( $txt, 15 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// And start generating output
|
||||
//-----------------------------------------
|
||||
|
||||
$txt .= $this->registry->output->getTemplate('ccs_global')->articlePages( $_ttlPages, $_curPage, $_reconstructed );
|
||||
|
||||
return $txt;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Text Parsing: LEGACY CR..STUFF
|
||||
* Last Updated: $Date: 2012-06-08 09:28:02 +0100 (Fri, 08 Jun 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: mmecham $
|
||||
* @copyright (c) 2001 - 2012 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 9th March 2005 11:03
|
||||
* @version $Revision: 10894 $
|
||||
*
|
||||
* Revised in 3.4 by Matt Mecham
|
||||
* Refactored into a text parsing module
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class class_text_parser_legacy extends classes_text_parser
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry object
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
return parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes data from the editor (HTML) and makes it BBCode
|
||||
* @param string $content
|
||||
*/
|
||||
public function postEditor( $content )
|
||||
{
|
||||
$content = $this->_postPurifyCodeBoxes( $content );
|
||||
|
||||
/* Restore preserved newlines */
|
||||
$content = str_replace( "<!-preserve.newline-->", "\n", $content );
|
||||
|
||||
if ( self::$Perms['parseHtml'] !== true )
|
||||
{
|
||||
$content = $this->HtmlToBBCode( $content );
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes stuff given and makes it all lovely for the editor
|
||||
* @param string $content
|
||||
*/
|
||||
public function preEditor( $content )
|
||||
{
|
||||
$content = $this->_postPurifyCodeBoxes( $content );
|
||||
|
||||
/* Restore preserved newlines */
|
||||
$content = str_replace( "<!-preserve.newline-->", "\n", $content );
|
||||
|
||||
$content = $this->BBCodeToHtml( $content );
|
||||
|
||||
/* Fix up old PRE tags */
|
||||
$content = preg_replace( '#<pre class=(["\'])prettyprint#', '<pre class=\1_prettyXprint', $content );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional methods for preDbParse
|
||||
*/
|
||||
public function preDbParse( $content )
|
||||
{
|
||||
$content = $this->_postPurifyCodeBoxes( $content );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check and make safe embedded codes (removes mark-up HTML purify might have added)
|
||||
* @param array $matches
|
||||
*/
|
||||
protected function _postPurifyCodeBoxes( $content )
|
||||
{
|
||||
/* Fetch paired opening and closing tags */
|
||||
$data = $this->getTagPositions( $content, 'CODE', array( '[', ']') );
|
||||
|
||||
if ( is_array( $data ) && count( $data ) )
|
||||
{
|
||||
foreach( $data['open'] as $id => $val )
|
||||
{
|
||||
$o = $data['open'][ $id ];
|
||||
$c = $data['close'][ $id ] - $o;
|
||||
|
||||
$slice = substr( $content, $o, $c );
|
||||
|
||||
$_origLen = strlen( $slice );
|
||||
|
||||
$slice = IPSText::stripTags( $slice, '<pre>,<br>' );
|
||||
$slice = str_replace( "<br />" , "\n", $slice );
|
||||
$slice = str_replace( "\n" , "<!-preserve.newline-->", $slice );
|
||||
|
||||
$slice = preg_replace( '#(https|http|ftp)://#' , '\1://', $slice );
|
||||
|
||||
$content = substr_replace( $content, $slice, $o, $c );
|
||||
|
||||
$_newLen = strlen( $slice );
|
||||
|
||||
if ( $_newLen != $_origLen )
|
||||
{
|
||||
/* Bump up next */
|
||||
foreach( $data['open'] as $_id => $_val )
|
||||
{
|
||||
$_o = $data['open'][ $_id ];
|
||||
|
||||
/* Ascii face alert */
|
||||
if ( $_o > $o )
|
||||
{
|
||||
$data['open'][ $_id ] += ( $_newLen - $_origLen );
|
||||
$data['close'][ $_id ] += ( $_newLen - $_origLen );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
}
|
||||
Loaded 100 of 1360 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user