Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Keyword Tracking
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 27 Mar 2017
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\activitystats;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Keyword Tracking
|
||||
*/
|
||||
class _keywords extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'keywords_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
/* Show button to adjust settings */
|
||||
\IPS\Output::i()->sidebar['actions']['settings'] = array(
|
||||
'icon' => 'cog',
|
||||
'primary' => TRUE,
|
||||
'title' => 'manage_keywords',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=activitystats&controller=keywords&do=settings' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('settings') )
|
||||
);
|
||||
|
||||
/* Determine minimum date */
|
||||
$minimumDate = NULL;
|
||||
|
||||
if( \IPS\Settings::i()->stats_keywords_prune )
|
||||
{
|
||||
$minimumDate = \IPS\DateTime::create()->sub( new \DateInterval( 'P' . \IPS\Settings::i()->stats_keywords_prune . 'D' ) );
|
||||
}
|
||||
|
||||
/* Draw a chart */
|
||||
$options = json_decode( \IPS\Settings::i()->stats_keywords, true );
|
||||
|
||||
if( !is_array( $options ) )
|
||||
{
|
||||
$options = array();
|
||||
}
|
||||
|
||||
$chart = new \IPS\Helpers\Chart\Database(
|
||||
\IPS\Http\Url::internal( 'app=core&module=activitystats&controller=keywords' ),
|
||||
'core_statistics',
|
||||
'time',
|
||||
'',
|
||||
array(
|
||||
'isStacked' => TRUE,
|
||||
'backgroundColor' => '#ffffff',
|
||||
'colors' => array( '#10967e', '#ea7963', '#de6470', '#6b9dde', '#b09be4', '#eec766', '#9fc973', '#e291bf', '#55c1a6', '#5fb9da' ),
|
||||
'hAxis' => array( 'gridlines' => array( 'color' => '#f5f5f5' ) ),
|
||||
'lineWidth' => 1,
|
||||
'areaOpacity' => 0.4
|
||||
),
|
||||
'LineChart',
|
||||
'daily',
|
||||
array( 'start' => \IPS\DateTime::create()->sub( new \DateInterval( 'P90D' ) ), 'end' => \IPS\DateTime::ts( time() ) ),
|
||||
array(),
|
||||
'',
|
||||
$minimumDate
|
||||
);
|
||||
$chart->where = array( array( 'type=?', 'keyword' ) );
|
||||
$chart->groupBy = 'value_4';
|
||||
|
||||
if ( is_array( $options ) )
|
||||
{
|
||||
foreach( $options as $k => $v )
|
||||
{
|
||||
$chart->addSeries( $v, 'number', 'COUNT(*)' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$chart->title = \IPS\Member::loggedIn()->language()->addToStack('keyword_usage_chart');
|
||||
$chart->availableTypes = array( 'AreaChart', 'ColumnChart', 'BarChart' );
|
||||
|
||||
\IPS\Output::i()->output = (string) $chart;
|
||||
|
||||
if( \IPS\Request::i()->noheader AND \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Create the table */
|
||||
$table = new \IPS\Helpers\Table\Db( 'core_statistics', \IPS\Http\Url::internal( 'app=core&module=activitystats&controller=keywords' ), array( array( 'type=?', 'keyword' ) ) );
|
||||
$table->langPrefix = 'keywordstats_';
|
||||
$table->quickSearch = 'value_4';
|
||||
|
||||
/* Columns we need */
|
||||
$table->include = array( 'value_4', 'extra_data', 'author', 'time' );
|
||||
$table->mainColumn = 'value_4';
|
||||
$table->noSort = array( 'extra_data' );
|
||||
|
||||
$table->sortBy = $table->sortBy ?: 'time';
|
||||
$table->sortDirection = $table->sortDirection ?: 'desc';
|
||||
|
||||
/* Custom parsers */
|
||||
$table->parsers = array(
|
||||
'time' => function( $val, $row )
|
||||
{
|
||||
return \IPS\DateTime::ts( $val )->localeDate();
|
||||
},
|
||||
'author' => function( $val, $row )
|
||||
{
|
||||
$data = json_decode( $row['extra_data'], TRUE );
|
||||
|
||||
try
|
||||
{
|
||||
$class = $data['class'];
|
||||
$item = $class::load( $data['id'] );
|
||||
|
||||
return $item->author()->link();
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'unknown' );
|
||||
}
|
||||
},
|
||||
'extra_data' => function( $val, $row )
|
||||
{
|
||||
$data = json_decode( $val, TRUE );
|
||||
|
||||
try
|
||||
{
|
||||
$class = $data['class'];
|
||||
$item = $class::load( $data['id'] );
|
||||
|
||||
return \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->basicUrl( $item->url(), TRUE, ( $item instanceof \IPS\Content\Comment ) ? $item->item()->mapped('title') : $item->mapped('title'), TRUE );
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'content_deleted' );
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_activitystats_keywords');
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global', 'core' )->block( 'title', (string) $table );
|
||||
}
|
||||
|
||||
/**
|
||||
* Prune Settings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function settings()
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\Stack( 'stats_keywords', \IPS\Settings::i()->stats_keywords ? json_decode( \IPS\Settings::i()->stats_keywords, true ) : array(), FALSE, array( 'stackFieldType' => 'Text' ), NULL, NULL, NULL, 'stats_keywords' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'stats_keywords_prune', \IPS\Settings::i()->stats_keywords_prune, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), \IPS\Member::loggedIn()->language()->addToStack('days') ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$values['stats_keywords'] = json_encode( $values['stats_keywords'] );
|
||||
|
||||
$form->saveAsSettings( $values );
|
||||
\IPS\Session::i()->log( 'acplog__statskeywords_settings' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=activitystats&controller=keywords' ), 'saved' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('settings');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('global')->block( 'settings', $form, FALSE );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief memberactivity
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 23 Mar 2017
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\activitystats;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* memberactivity
|
||||
*/
|
||||
class _memberactivity extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'memberactivity_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a graph of user activity
|
||||
*
|
||||
* @return void
|
||||
* @note Activity includes posting, following, reacting
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
$chart = new \IPS\Helpers\Chart\Callback(
|
||||
\IPS\Http\Url::internal( 'app=core&module=activitystats&controller=memberactivity' ),
|
||||
array( $this, 'getResults' ),
|
||||
'',
|
||||
array(
|
||||
'isStacked' => TRUE,
|
||||
'backgroundColor' => '#ffffff',
|
||||
'colors' => array( '#10967e', '#ea7963' ),
|
||||
'hAxis' => array( 'gridlines' => array( 'color' => '#f5f5f5' ) ),
|
||||
'lineWidth' => 1,
|
||||
'areaOpacity' => 0.4
|
||||
),
|
||||
'AreaChart',
|
||||
'weekly',
|
||||
array( 'start' => \IPS\DateTime::create()->sub( new \DateInterval( 'P90D' ) ), 'end' => \IPS\DateTime::ts( time() ) )
|
||||
);
|
||||
$chart->addSeries( \IPS\Member::loggedIn()->language()->addToStack('activity'), 'number', FALSE );
|
||||
$chart->title = \IPS\Member::loggedIn()->language()->addToStack('member_activity_timeperiod');
|
||||
$chart->availableTypes = array( 'AreaChart', 'ColumnChart', 'BarChart' );
|
||||
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->output = (string) $chart;
|
||||
return;
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_activitystats_memberactivity');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'stats' )->activitymessage();
|
||||
\IPS\Output::i()->output .= (string) $chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the results
|
||||
*
|
||||
* @param \IPS\Helpers\Chart\Callback $chart Chart object
|
||||
* @return array
|
||||
*/
|
||||
public function getResults( $chart )
|
||||
{
|
||||
/* Get results */
|
||||
$results = array();
|
||||
|
||||
$results = array_replace_recursive( $results, $this->getSqlResults( 'core_search_index', 'index_date_updated', 'index_author', $chart ) );
|
||||
$results = array_replace_recursive( $results, $this->getSqlResults( 'core_reputation_index', 'rep_date', 'member_id', $chart ) );
|
||||
$results = array_replace_recursive( $results, $this->getSqlResults( 'core_follow', 'follow_added', 'follow_member_id', $chart ) );
|
||||
|
||||
/* Reformat now */
|
||||
$finalResults = array();
|
||||
|
||||
foreach( $results as $date => $members )
|
||||
{
|
||||
$finalResults[ $date ] = array( 'time' => $date, \IPS\Member::loggedIn()->language()->get('activity') => count( $members ) );
|
||||
}
|
||||
|
||||
return $finalResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SQL query/results
|
||||
*
|
||||
* @note Consolidated to reduce duplicated code
|
||||
* @param string $table Database table
|
||||
* @param string $date Date column
|
||||
* @param string $author Author column
|
||||
* @param object $chart Chart
|
||||
* @return array
|
||||
*/
|
||||
protected function getSqlResults( $table, $date, $author, $chart )
|
||||
{
|
||||
/* What's our SQL time? */
|
||||
switch ( $chart->timescale )
|
||||
{
|
||||
case 'daily':
|
||||
$timescale = '%Y-%c-%e';
|
||||
break;
|
||||
|
||||
case 'weekly':
|
||||
$timescale = '%Y-%u';
|
||||
break;
|
||||
|
||||
case 'monthly':
|
||||
$timescale = '%Y-%c';
|
||||
break;
|
||||
}
|
||||
|
||||
$results = array();
|
||||
$where = array( array( "{$date}>?", 0 ) );
|
||||
$where[] = array( "{$author}>?", 0 );
|
||||
if ( $chart->start )
|
||||
{
|
||||
$where[] = array( "{$date}>?", $chart->start->getTimestamp() );
|
||||
}
|
||||
if ( $chart->end )
|
||||
{
|
||||
$where[] = array( "{$date}<?", $chart->end->getTimestamp() );
|
||||
}
|
||||
|
||||
/* First we need to get search index activity */
|
||||
$fromUnixTime = "FROM_UNIXTIME( IFNULL( {$date}, 0 ) )";
|
||||
if ( !$chart->timezoneError and \IPS\Member::loggedIn()->timezone and in_array( \IPS\Member::loggedIn()->timezone, \DateTimeZone::listIdentifiers() ) )
|
||||
{
|
||||
$fromUnixTime = "CONVERT_TZ( {$fromUnixTime}, @@session.time_zone, '" . \IPS\Db::i()->escape_string( \IPS\Member::loggedIn()->timezone ) . "' )";
|
||||
}
|
||||
|
||||
$stmt = \IPS\Db::i()->select( "DATE_FORMAT( {$fromUnixTime}, '{$timescale}' ) AS time, {$author}", $table, $where, 'time ASC', NULL, array( $author, 'time' ) );
|
||||
|
||||
foreach( $stmt as $row )
|
||||
{
|
||||
$results[ $row['time'] ][ $row[ $author ] ] = 1;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief API Splash Page
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 03 Dec 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\applications;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief API Keys
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 03 Dec 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\applications;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief API Logs
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 04 Dec 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\applications;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief API Reference
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 03 Dec 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\applications;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Application & Module Management Controller
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 18 Feb 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\applications;
|
||||
@@ -163,7 +162,7 @@ class _applications extends \IPS\Node\Controller
|
||||
$buttons['delete'] = array(
|
||||
'icon' => 'times-circle',
|
||||
'title' => 'uninstall',
|
||||
'link' => $baseUrl->setQueryString( array( 'do' => 'delete', 'id' => $k, 'deleteNode' => 1 ) ),
|
||||
'link' => $baseUrl->setQueryString( array( 'do' => 'delete', 'id' => $k ) ),
|
||||
'data' => array( 'delete' => '' ),
|
||||
'hotkey'=> 'd'
|
||||
);
|
||||
@@ -190,7 +189,7 @@ class _applications extends \IPS\Node\Controller
|
||||
$buttons['delete'] = array(
|
||||
'icon' => 'times-circle',
|
||||
'title' => 'uninstall',
|
||||
'link' => $baseUrl->setQueryString( array( 'do' => 'delete', 'id' => $key, 'deleteNode' => 1 ) ),
|
||||
'link' => $baseUrl->setQueryString( array( 'do' => 'delete', 'id' => $key ) ),
|
||||
'data' => array( 'delete' => '' ),
|
||||
'hotkey'=> 'd'
|
||||
);
|
||||
@@ -282,7 +281,8 @@ class _applications extends \IPS\Node\Controller
|
||||
{
|
||||
$buttons = parent::_getRootButtons();
|
||||
|
||||
$buttons['install'] = array(
|
||||
\IPS\Output::i()->sidebar['actions']['install'] = array(
|
||||
'primary' => true,
|
||||
'icon' => 'upload',
|
||||
'title' => 'install',
|
||||
'link' => \IPS\Http\Url::internal( "app=core&module=applications&controller=applications&do=upload" ),
|
||||
@@ -873,7 +873,10 @@ class _applications extends \IPS\Node\Controller
|
||||
function()
|
||||
{
|
||||
/* IPS Cloud Sync */
|
||||
\IPS\IPS::resyncIPSCloud();
|
||||
\IPS\IPS::resyncIPSCloud('Upgraded application in ACP');
|
||||
|
||||
/* Invalidate disk templates */
|
||||
\IPS\Theme::resetAllCacheKeys();
|
||||
|
||||
/* And redirect back to the overview screen */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=applications&controller=applications' ), 'application_now_updated' );
|
||||
@@ -1077,8 +1080,11 @@ class _applications extends \IPS\Node\Controller
|
||||
/* Clear caches so templates can rebuild and so on */
|
||||
\IPS\Data\Store::i()->clearAll();
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
\IPS\IPS::resyncIPSCloud();
|
||||
|
||||
\IPS\IPS::resyncIPSCloud('Installed application in ACP');
|
||||
|
||||
/* Invalidate disk templates */
|
||||
\IPS\Theme::resetAllCacheKeys();
|
||||
|
||||
/* And redirect back to the overview screen */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=applications&controller=applications' ), 'application_now_installed' );
|
||||
}
|
||||
@@ -1181,7 +1187,7 @@ class _applications extends \IPS\Node\Controller
|
||||
{
|
||||
$form = new \IPS\Helpers\Form();
|
||||
$form->hiddenValues['wasConfirmed'] = 1;
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'new_default_app', NULL, false, array(
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'new_default_app', NULL, TRUE, array(
|
||||
'class' => 'IPS\Application',
|
||||
'subnodes' => false,
|
||||
'permissionCheck' => function( $app ) use ( $node )
|
||||
@@ -1353,13 +1359,20 @@ class _applications extends \IPS\Node\Controller
|
||||
$application = new \PharData( $values['application_file'], 0, NULL, \Phar::TAR );
|
||||
|
||||
/* Get app directory */
|
||||
$appdata = json_decode( file_get_contents( "phar://" . $values['application_file'] . '/data/application.json' ), TRUE );
|
||||
$appdata = json_decode( file_get_contents( "phar://" . $values['application_file'] . '/data/application.json' ), TRUE );
|
||||
|
||||
/* Make sure that the app data is valid */
|
||||
if( !isset( $appdata['app_directory'] ) )
|
||||
{
|
||||
throw new \UnexpectedValueException;
|
||||
}
|
||||
|
||||
$appDirectory = $appdata['app_directory'];
|
||||
|
||||
/* Extract */
|
||||
$application->extractTo( \IPS\ROOT_PATH . "/applications/" . $appDirectory, NULL, TRUE );
|
||||
$this->_checkChmod( \IPS\ROOT_PATH . '/applications/' . $appDirectory );
|
||||
\IPS\IPS::resyncIPSCloud();
|
||||
\IPS\IPS::resyncIPSCloud('Uploaded new application in ACP');
|
||||
}
|
||||
catch( \PharException $e )
|
||||
{
|
||||
@@ -1504,8 +1517,8 @@ class _applications extends \IPS\Node\Controller
|
||||
{
|
||||
$list[ (string) \IPS\DateTime::ts( $version['upgrade_date'] ) ] = \IPS\Member::loggedIn()->language()->addToStack('app_version_string', FALSE, array( 'sprintf' => array( $version['upgrade_version_human'], $version['upgrade_version_id'] ) ) );
|
||||
}
|
||||
|
||||
return ( count( $upgrades ) ) ? \IPS\Theme::i()->getTemplate( 'global' )->definitionTable( $list ) : \IPS\Member::loggedIn()->language()->addToStack('app_no_upgrade_history');
|
||||
|
||||
return ( count( $upgrades ) ) ? \IPS\Theme::i()->getTemplate( 'global' )->definitionTable( $list ) : \IPS\Theme::i()->getTemplate( 'global' )->paddedBlock( \IPS\Member::loggedIn()->language()->addToStack('app_no_upgrade_history') );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1543,7 +1556,10 @@ class _applications extends \IPS\Node\Controller
|
||||
{
|
||||
/* Clear templates to rebuild automatically */
|
||||
\IPS\Theme::deleteCompiledTemplate();
|
||||
|
||||
|
||||
/* Invalidate disk templates */
|
||||
\IPS\Theme::resetAllCacheKeys();
|
||||
|
||||
parent::enableToggle();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Developer Center Controller
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 18 Feb 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\applications;
|
||||
@@ -161,7 +160,7 @@ class _developer extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->error( 'dev_could_not_write_controller', '1C103/I', 403, '' );
|
||||
}
|
||||
|
||||
/* delete all the other stuff http://community.invisionpower.com/resources/bugs.html/_/4-0-0/1019-deleting-a-controller-does-not-delete-its-menu-entry-r48752 */
|
||||
/* delete all the other stuff */
|
||||
|
||||
$restrictions = $this->_getJson( \IPS\ROOT_PATH . "/applications/{$this->application->directory}/data/acprestrictions.json" );
|
||||
if (isset ( $restrictions[ \IPS\Request::i()->root ][ mb_substr(\IPS\Request::i()->delete,0 ,-4 )] ) )
|
||||
@@ -2023,18 +2022,35 @@ class _developer extends \IPS\Dispatcher\Controller
|
||||
$schema[ $definition['name'] ]['columns'][ $save['name'] ] = $save;
|
||||
}
|
||||
|
||||
if( $column AND $save['name'] !== $column['name'] AND isset( $schema[ $definition['name'] ]['indexes'] ) )
|
||||
/* Did we rename the column? */
|
||||
if( $column AND $save['name'] !== $column['name'] )
|
||||
{
|
||||
foreach( $schema[ $definition['name'] ]['indexes'] as $indexName => $indexDefinition )
|
||||
/* Fix references to the column name in indexes */
|
||||
if( isset( $schema[ $definition['name'] ]['indexes'] ) )
|
||||
{
|
||||
foreach( $indexDefinition['columns'] as $_idx => $columnName )
|
||||
foreach( $schema[ $definition['name'] ]['indexes'] as $indexName => $indexDefinition )
|
||||
{
|
||||
if( $columnName == $column['name'] )
|
||||
foreach( $indexDefinition['columns'] as $_idx => $columnName )
|
||||
{
|
||||
$schema[ $definition['name'] ]['indexes'][ $indexName ]['columns'][ $_idx ] = $save['name'];
|
||||
if( $columnName == $column['name'] )
|
||||
{
|
||||
$schema[ $definition['name'] ]['indexes'][ $indexName ]['columns'][ $_idx ] = $save['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Fix references to the column name in inserts */
|
||||
if( isset( $schema[ $definition['name'] ]['inserts'] ) )
|
||||
{
|
||||
foreach( $schema[ $definition['name'] ]['inserts'] as $_idx => $insert )
|
||||
{
|
||||
$insert[ $save['name'] ] = $insert[ $column['name'] ];
|
||||
unset( $insert[ $column['name'] ] );
|
||||
|
||||
$schema[ $definition['name'] ]['inserts'][ $_idx ] = $insert;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->_writeSchema( $schema );
|
||||
@@ -2346,23 +2362,23 @@ class _developer extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
elseif ( in_array( $column['type'], array( 'CHAR', 'VARCHAR', 'BINARY', 'VARBINARY' ) ) )
|
||||
{
|
||||
$element = new \IPS\Helpers\Form\Text( $column['name'], $data ? $data[ $column['name'] ] : $column['default'], FALSE, $column['allow_null'] ? array( 'nullLang' => 'NULL' ) : array() );
|
||||
$element = new \IPS\Helpers\Form\Text( $column['name'], ( $data AND isset( $data[ $column['name'] ] ) ) ? $data[ $column['name'] ] : $column['default'], FALSE, $column['allow_null'] ? array( 'nullLang' => 'NULL' ) : array() );
|
||||
}
|
||||
elseif ( in_array( $column['type'], array( 'TEXT', 'MEDIUMTEXT', 'BIGTEXT', 'TINYBLOB', 'BLOB', 'MEDIUMBLOB', 'BIGBLOB' ) ) )
|
||||
{
|
||||
$element = new \IPS\Helpers\Form\TextArea( $column['name'], $data ? $data[ $column['name'] ] : $column['default'], FALSE, $column['allow_null'] ? array( 'nullLang' => 'NULL' ) : array() );
|
||||
$element = new \IPS\Helpers\Form\TextArea( $column['name'], ( $data AND isset( $data[ $column['name'] ] ) ) ? $data[ $column['name'] ] : $column['default'], FALSE, $column['allow_null'] ? array( 'nullLang' => 'NULL' ) : array() );
|
||||
}
|
||||
elseif ( $column['type'] === 'ENUM' )
|
||||
{
|
||||
$element = new \IPS\Helpers\Form\Select( $column['name'], $data ? $data[ $column['name'] ] : $column['default'], FALSE, array( 'options' => array_combine( $column['values'], $column['values'] ) ) );
|
||||
$element = new \IPS\Helpers\Form\Select( $column['name'], ( $data AND isset( $data[ $column['name'] ] ) ) ? $data[ $column['name'] ] : $column['default'], FALSE, array( 'options' => array_combine( $column['values'], $column['values'] ) ) );
|
||||
}
|
||||
elseif ( $column['type'] === 'SET' )
|
||||
{
|
||||
$element = new \IPS\Helpers\Form\Select( $column['name'], $data ? $data[ $column['name'] ] : $column['default'], FALSE, array( 'options' => array_combine( $column['values'], $column['values'] ), 'multiple' => TRUE ) );
|
||||
$element = new \IPS\Helpers\Form\Select( $column['name'], ( $data AND isset( $data[ $column['name'] ] ) ) ? explode( ',', $data[ $column['name'] ] ) : explode( ',', $column['default'] ), FALSE, array( 'options' => array_combine( $column['values'], $column['values'] ), 'multiple' => TRUE ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$element = new \IPS\Helpers\Form\Text( $column['name'], $data ? $data[ $column['name'] ] : $column['default'], FALSE, $column['allow_null'] ? array( 'nullLang' => 'NULL' ) : array() );
|
||||
$element = new \IPS\Helpers\Form\Text( $column['name'], ( $data AND isset( $data[ $column['name'] ] ) ) ? $data[ $column['name'] ] : $column['default'], FALSE, $column['allow_null'] ? array( 'nullLang' => 'NULL' ) : array() );
|
||||
}
|
||||
|
||||
$element->label = $column['name'];
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Community Enhancements
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 17 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\applications;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Menu Manager
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 29 Jun 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\applications;
|
||||
@@ -46,15 +45,6 @@ class _menu extends \IPS\Dispatcher\Controller
|
||||
protected function manage()
|
||||
{
|
||||
/* Buttons */
|
||||
\IPS\Output::i()->sidebar['actions']['publish'] = array(
|
||||
'icon' => 'cloud-upload',
|
||||
'link' => \IPS\Http\Url::internal('app=core&module=applications&controller=menu&do=publish'),
|
||||
'title' => 'menu_manager_publish',
|
||||
'class' => ( isset( \IPS\Data\Store::i()->frontNavigation ) && \IPS\Data\Store::i()->frontNavigation == \IPS\core\FrontNavigation::frontNavigation( TRUE ) ) ? 'ipsButton_disabled' : '',
|
||||
'data' => array(
|
||||
'action' => 'publishMenu'
|
||||
)
|
||||
);
|
||||
\IPS\Output::i()->sidebar['actions']['restore'] = array(
|
||||
'icon' => 'refresh',
|
||||
'link' => \IPS\Http\Url::internal('app=core&module=applications&controller=menu&do=restore'),
|
||||
@@ -74,12 +64,19 @@ class _menu extends \IPS\Dispatcher\Controller
|
||||
if ( !$item['is_menu_child'] )
|
||||
{
|
||||
$class = 'IPS\\' . $item['app'] . '\extensions\core\FrontNavigation\\' . $item['extension'];
|
||||
$items[ intval( $item['parent'] ) ][ $item['id'] ] = new $class( json_decode( $item['config'], TRUE ), $item['id'], $item['permissions'] );
|
||||
if ( class_exists( $class ) )
|
||||
{
|
||||
$items[ intval( $item['parent'] ) ][ $item['id'] ] = new $class( json_decode( $item['config'], TRUE ), $item['id'], $item['permissions'] );
|
||||
}
|
||||
}
|
||||
if ( $item['app'] == 'core' and $item['extension'] == 'Menu' )
|
||||
{
|
||||
$class = 'IPS\\' . $item['app'] . '\extensions\core\FrontNavigation\\' . $item['extension'];
|
||||
$menus[ $item['id'] ] = new $class( json_decode( $item['config'], TRUE ), $item['id'], $item['permissions'] );
|
||||
|
||||
if ( class_exists( $class ) )
|
||||
{
|
||||
$menus[ $item['id'] ] = new $class( json_decode( $item['config'], TRUE ), $item['id'], $item['permissions'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -388,6 +385,7 @@ class _menu extends \IPS\Dispatcher\Controller
|
||||
protected function reorder()
|
||||
{
|
||||
$positions = array();
|
||||
|
||||
foreach ( \IPS\Request::i()->menu_order as $id => $parentId )
|
||||
{
|
||||
if ( !isset( $positions[ $parentId ] ) )
|
||||
@@ -407,7 +405,7 @@ class _menu extends \IPS\Dispatcher\Controller
|
||||
$parent = \IPS\Db::i()->select( '*', 'core_menu', array( 'id=?', $parentId ) )->first();
|
||||
$save['parent'] = $parent['id'];
|
||||
|
||||
if ( $parent['app'] === 'core' and $parent['extension'] === 'Menu' )
|
||||
if ( $parent['app'] === 'core' and $parent['extension'] === 'Menu' && isset( \IPS\Request::i()->reorderDropdown ) )
|
||||
{
|
||||
$save['is_menu_child'] = TRUE;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Plugins
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @since 25 Jul 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 25 Jul 2013␍
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\applications;
|
||||
@@ -388,6 +387,12 @@ class _plugins extends \IPS\Node\Controller
|
||||
|
||||
/* Write contents */
|
||||
\file_put_contents( \IPS\ROOT_PATH . "/plugins/{$plugin->location}/hooks/{$filename}.php", preg_replace( '/class hook(\d+?) extends _HOOK_CLASS_/', "class hook{$insertId} extends _HOOK_CLASS_", $xml->readString() ) );
|
||||
|
||||
/* Clear zend opcache if enabled */
|
||||
if ( function_exists( 'opcache_invalidate' ) )
|
||||
{
|
||||
@opcache_invalidate( \IPS\ROOT_PATH . "/plugins/{$plugin->location}/hooks/{$filename}.php" );
|
||||
}
|
||||
|
||||
/* If that was a skin hook, trash our compiled version of that template */
|
||||
if ( $xml->getAttribute('type') == 'S' )
|
||||
@@ -445,6 +450,12 @@ class _plugins extends \IPS\Node\Controller
|
||||
/* Settings code */
|
||||
case 'settingsCode':
|
||||
\file_put_contents( \IPS\ROOT_PATH . "/plugins/{$plugin->location}/settings.php", $xml->readString() );
|
||||
|
||||
/* Clear zend opcache if enabled */
|
||||
if ( function_exists( 'opcache_invalidate' ) )
|
||||
{
|
||||
@opcache_invalidate( \IPS\ROOT_PATH . "/plugins/{$plugin->location}/settings.php" );
|
||||
}
|
||||
break;
|
||||
|
||||
/* Tasks */
|
||||
@@ -478,6 +489,12 @@ class _plugins extends \IPS\Node\Controller
|
||||
|
||||
/* Write contents */
|
||||
\file_put_contents( \IPS\ROOT_PATH . "/plugins/{$plugin->location}/tasks/{$key}.php", $xml->readString() );
|
||||
|
||||
/* Clear zend opcache if enabled */
|
||||
if ( function_exists( 'opcache_invalidate' ) )
|
||||
{
|
||||
@opcache_invalidate( \IPS\ROOT_PATH . "/plugins/{$plugin->location}/tasks/{$key}.php" );
|
||||
}
|
||||
|
||||
/* Move onto next */
|
||||
$xml->read();
|
||||
@@ -681,6 +698,12 @@ class _plugins extends \IPS\Node\Controller
|
||||
case 'uninstall':
|
||||
/* Write contents */
|
||||
\file_put_contents( \IPS\ROOT_PATH . "/plugins/{$plugin->location}/uninstall.php", $xml->readString() );
|
||||
|
||||
/* Clear zend opcache if enabled */
|
||||
if ( function_exists( 'opcache_invalidate' ) )
|
||||
{
|
||||
@opcache_invalidate( \IPS\ROOT_PATH . "/plugins/{$plugin->location}/uninstall.php" );
|
||||
}
|
||||
break;
|
||||
|
||||
/* Sidebar Widgets */
|
||||
@@ -737,6 +760,12 @@ class _plugins extends \IPS\Node\Controller
|
||||
$contents = str_replace( '<{ID}>', $plugin->id, $contents );
|
||||
$contents = str_replace( '<{LOCATION}>', $plugin->location, $contents );
|
||||
\file_put_contents( \IPS\ROOT_PATH . "/plugins/{$plugin->location}/widgets/{$key}.php", $contents );
|
||||
|
||||
/* Clear zend opcache if enabled */
|
||||
if ( function_exists( 'opcache_invalidate' ) )
|
||||
{
|
||||
@opcache_invalidate( \IPS\ROOT_PATH . "/plugins/{$plugin->location}/widgets/{$key}.php" );
|
||||
}
|
||||
|
||||
/* Move onto next */
|
||||
$xml->read();
|
||||
@@ -888,7 +917,10 @@ class _plugins extends \IPS\Node\Controller
|
||||
$plugin->save();
|
||||
|
||||
/* IPS Cloud Sync */
|
||||
\IPS\IPS::resyncIPSCloud();
|
||||
\IPS\IPS::resyncIPSCloud('Installed plugin');
|
||||
|
||||
/* Invalidate disk templates */
|
||||
\IPS\Theme::resetAllCacheKeys();
|
||||
|
||||
/* All done */
|
||||
return NULL;
|
||||
@@ -923,7 +955,14 @@ class _plugins extends \IPS\Node\Controller
|
||||
|
||||
/* Build form */
|
||||
$form = new \IPS\Helpers\Form;
|
||||
eval( file_get_contents( \IPS\ROOT_PATH . '/plugins/' . $plugin->location . '/settings.php' ) );
|
||||
try
|
||||
{
|
||||
eval( file_get_contents( \IPS\ROOT_PATH . '/plugins/' . $plugin->location . '/settings.php' ) );
|
||||
}
|
||||
catch ( \ParseError $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'plugin_parse_error', '3C145/L', 500, '', array(), $e->getMessage() );
|
||||
}
|
||||
|
||||
/* Display */
|
||||
if ( $form->values() )
|
||||
@@ -1358,7 +1397,7 @@ class _plugins extends \IPS\Node\Controller
|
||||
foreach ( array_reverse( $json, TRUE ) as $long => $human )
|
||||
{
|
||||
$exploded = explode( '.', $human );
|
||||
$defaults['human'] = "{$exploded[0]}.{$exploded[1]}." . ( $exploded[2] + 1 );
|
||||
$defaults['human'] = "{$exploded[0]}.{$exploded[1]}." . ( intval( $exploded[2] ) + 1 );
|
||||
$defaults['long'] = $long + 1;
|
||||
break;
|
||||
}
|
||||
@@ -1630,6 +1669,7 @@ class _plugins extends \IPS\Node\Controller
|
||||
\IPS\Theme::removeTemplates( 'core', 'global', 'plugins', $plugin->id );
|
||||
\IPS\Theme::removeCss( 'core', 'front', 'custom', $plugin->id );
|
||||
\IPS\Theme::removeResources( 'core', 'global', 'plugins', $plugin->id );
|
||||
\IPS\Db::i()->delete( 'core_javascript', array( 'javascript_plugin=?', $plugin->id ) );
|
||||
|
||||
/* Get HTML, CSS, JS, Resources */
|
||||
foreach ( array( 'html' => 'phtml', 'css' => 'css', 'js' => 'js', 'resources' => '*' ) as $k => $ext )
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Bulk mail handler
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 18 Jun 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\bulkmail;
|
||||
@@ -91,8 +90,9 @@ class _bulkmail extends \IPS\Dispatcher\Controller
|
||||
/* Specify the buttons */
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'bulkmail', 'bulkmail_add' ) )
|
||||
{
|
||||
$table->rootButtons = array(
|
||||
\IPS\Output::i()->sidebar['actions'] = array(
|
||||
'add' => array(
|
||||
'primary' => TRUE,
|
||||
'icon' => 'plus',
|
||||
'title' => 'bulkmail_add',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=bulkmail&controller=bulkmail&do=form' ),
|
||||
@@ -155,7 +155,7 @@ class _bulkmail extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('manage_bulk_mail');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'title', (string) $table );
|
||||
\IPS\Output::i()->output = (string) $table;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -462,13 +462,13 @@ class _bulkmail extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Start the form */
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->class = 'ipsForm_vertical';
|
||||
$form->addTab( 'bulkmail__main' );
|
||||
$form->class = '';
|
||||
$form->addTab( 'bulkmail__main', NULL, NULL, 'ipsForm_vertical' );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'mail_subject', $mail->subject, TRUE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Editor( 'mail_body', $mail->content ?: '', TRUE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'bulkmail' . ( $mail->id ? '-' . $mail->id : '' ), 'tags' => $tags, 'attachIds' => array( $mail->id, NULL, 'bulkmail' ) ) ) );
|
||||
|
||||
/* Add the filters tab and the "generic filters" header */
|
||||
$form->addTab( 'bulkmail__filters' );
|
||||
$form->addTab( 'bulkmail__filters', NULL, NULL, 'ipsForm_horizontal' );
|
||||
$form->addHeader( 'generic_bm_filters' );
|
||||
|
||||
$lastApp = 'core';
|
||||
@@ -476,7 +476,7 @@ class _bulkmail extends \IPS\Dispatcher\Controller
|
||||
/* Now grab bulk mail extensions */
|
||||
foreach ( \IPS\Application::allExtensions( 'core', 'MemberFilter', TRUE, 'core' ) as $key => $extension )
|
||||
{
|
||||
if( method_exists( $extension, 'getSettingField' ) )
|
||||
if( method_exists( $extension, 'getSettingField' ) AND $extension->availableIn( 'bulkmail' ) )
|
||||
{
|
||||
/* See if we need a new form header - one per app */
|
||||
$_key = explode( '_', $key );
|
||||
@@ -512,7 +512,7 @@ class _bulkmail extends \IPS\Dispatcher\Controller
|
||||
/* Loop over bulk mail extensions to format the options */
|
||||
foreach ( \IPS\Application::allExtensions( 'core', 'MemberFilter', TRUE, 'core' ) as $key => $extension )
|
||||
{
|
||||
if( method_exists( $extension, 'save' ) )
|
||||
if( method_exists( $extension, 'save' ) AND $extension->availableIn( 'bulkmail' ) )
|
||||
{
|
||||
/* Grab our fields and add to the form */
|
||||
$_value = $extension->save( $values );
|
||||
|
||||
@@ -0,0 +1,570 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Clubs
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 21 Feb 2017
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\clubs;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clubs
|
||||
*/
|
||||
class _clubs extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'clubs_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_clubs_clubs');
|
||||
|
||||
if ( \IPS\Settings::i()->clubs )
|
||||
{
|
||||
/* Create the table */
|
||||
$table = new \IPS\Helpers\Table\Db( 'core_clubs', \IPS\Http\Url::internal( 'app=core&module=clubs&controller=clubs' ) );
|
||||
$table->include = array( 'name', 'type', 'members', 'owner', 'created' );
|
||||
$table->langPrefix = 'club_';
|
||||
$table->parsers = array(
|
||||
'type' => function( $value ) {
|
||||
return \IPS\Theme::i()->getTemplate('clubs')->privacy( $value );
|
||||
},
|
||||
'created' => function( $value ) {
|
||||
return \IPS\DateTime::ts( $value );
|
||||
},
|
||||
'members' => function( $value, $row ) {
|
||||
|
||||
$link = \IPS\Http\Url::internal( "app=core&module=clubs&controller=view&id={$row['id']}&do=members", 'front', 'clubs_view', array( \IPS\Http\Url\Friendly::seoTitle( $row['name'] ) ) );
|
||||
return \IPS\Theme::i()->getTemplate('clubs')->members( $value, $link );
|
||||
},
|
||||
'owner' => function( $value ) {
|
||||
return \IPS\Theme::i()->getTemplate('clubs')->owner( \IPS\Member::load( $value ) );
|
||||
}
|
||||
);
|
||||
$table->noSort = array( 'privacy', 'owner' );
|
||||
$table->sortBy = $table->sortBy ?: 'members';
|
||||
$table->filters = array(
|
||||
'club_type_' . \IPS\Member\Club::TYPE_PUBLIC => array( 'type=?', \IPS\Member\Club::TYPE_PUBLIC ),
|
||||
'club_type_' . \IPS\Member\Club::TYPE_OPEN => array( 'type=?', \IPS\Member\Club::TYPE_OPEN ),
|
||||
'club_type_' . \IPS\Member\Club::TYPE_CLOSED => array( 'type=?', \IPS\Member\Club::TYPE_CLOSED ),
|
||||
'club_type_' . \IPS\Member\Club::TYPE_PRIVATE => array( 'type=?', \IPS\Member\Club::TYPE_PRIVATE )
|
||||
);
|
||||
$table->quickSearch = 'name';
|
||||
$table->advancedSearch = array(
|
||||
'name' => \IPS\Helpers\Table\SEARCH_QUERY_TEXT,
|
||||
'members' => \IPS\Helpers\Table\SEARCH_NUMERIC,
|
||||
'owner' => \IPS\Helpers\Table\SEARCH_MEMBER,
|
||||
'created' => \IPS\Helpers\Table\SEARCH_DATE_RANGE,
|
||||
);
|
||||
$table->rowButtons = function( $row ) {
|
||||
$return = array(
|
||||
'open' => array(
|
||||
'title' => 'view',
|
||||
'icon' => 'search',
|
||||
'link' => \IPS\Http\Url::internal( "app=core&module=clubs&controller=view&id={$row['id']}", 'front', 'clubs_view', array( \IPS\Http\Url\Friendly::seoTitle( $row['name'] ) ) ),
|
||||
'target'=> '_blank'
|
||||
)
|
||||
);
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'clubs', 'clubs_edit' ) )
|
||||
{
|
||||
$return['edit'] = array(
|
||||
'title' => 'edit',
|
||||
'icon' => 'pencil',
|
||||
'link' => \IPS\Http\Url::internal("app=core&module=clubs&controller=clubs&do=edit&id={$row['id']}")
|
||||
);
|
||||
}
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'clubs', 'clubs_delete' ) )
|
||||
{
|
||||
$return['delete'] = array(
|
||||
'title' => 'delete',
|
||||
'icon' => 'times-circle',
|
||||
'link' => \IPS\Http\Url::internal("app=core&module=clubs&controller=clubs&do=delete&id={$row['id']}"),
|
||||
'data' => \IPS\Db::i()->select( 'COUNT(*)', 'core_clubs_node_map', array( 'club_id=?', $row['id'] ) )->first() ? array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('delete') ) : array( 'delete' => '' )
|
||||
);
|
||||
}
|
||||
return $return;
|
||||
};
|
||||
|
||||
/* Settings Button */
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'clubs', 'fields_manage' ) )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions']['settings'] = array(
|
||||
'icon' => 'cog',
|
||||
'title' => 'clubs_custom_fields',
|
||||
'link' => \IPS\Http\Url::internal( "app=core&module=clubs&controller=clubs&controller=fields" ),
|
||||
);
|
||||
}
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'clubs', 'clubs_settings_manage' ) )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions']['fields'] = array(
|
||||
'icon' => 'cog',
|
||||
'title' => 'settings',
|
||||
'link' => \IPS\Http\Url::internal( "app=core&module=clubs&controller=clubs&controller=settings" ),
|
||||
);
|
||||
}
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->output = (string) $table;
|
||||
}
|
||||
else
|
||||
{
|
||||
$availableTypes = array();
|
||||
foreach ( \IPS\Member\Club::availableNodeTypes( NULL ) as $class )
|
||||
{
|
||||
$availableTypes[] = \IPS\Member::loggedIn()->language()->addToStack( $class::clubAcpTitle() );
|
||||
}
|
||||
|
||||
$availableTypes = \IPS\Member::loggedIn()->language()->formatList( $availableTypes );
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'clubs' )->disabled( $availableTypes );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function enable()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'clubs_settings_manage' );
|
||||
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => TRUE ), array( 'conf_key=?', 'clubs' ) );
|
||||
\IPS\Settings::i()->clubs = TRUE;
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
|
||||
\IPS\Db::i()->update( 'core_tasks', array( 'enabled' => 1 ), array( '`key`=?', 'clubrebuild' ) );
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__club_settings' );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=core&module=clubs&controller=clubs') );
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function edit()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'clubs_edit' );
|
||||
|
||||
/* Load Club */
|
||||
try
|
||||
{
|
||||
$club = \IPS\Member\Club::load( \IPS\Request::i()->id );
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2C352/1', 404, '' );
|
||||
}
|
||||
$editUrl = \IPS\Http\Url::internal("app=core&module=clubs&controller=clubs&do=edit&id={$club->id}");
|
||||
|
||||
/* Tabs */
|
||||
$tabs = array( 'settings' => 'settings' );
|
||||
foreach ( \IPS\Member\Club::availableNodeTypes( \IPS\Member::loggedIn() ) as $class )
|
||||
{
|
||||
$tabs[ str_replace( '\\', '-', preg_replace( '/^IPS\\\/', '', $class ) ) ] = $class::clubAcpTitle();
|
||||
}
|
||||
$activeTab = ( isset( \IPS\Request::i()->tab ) and array_key_exists( \IPS\Request::i()->tab, $tabs ) ) ? \IPS\Request::i()->tab : 'settings';
|
||||
|
||||
/* Settings */
|
||||
if ( $activeTab === 'settings' )
|
||||
{
|
||||
if ( $form = $club->form( TRUE ) )
|
||||
{
|
||||
$activeTabContents = (string) $form;
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal("app=core&module=clubs&controller=clubs"), "saved" );
|
||||
}
|
||||
}
|
||||
|
||||
/* Node List */
|
||||
else
|
||||
{
|
||||
$nodeClass = 'IPS\\' . str_replace( '-', '\\', \IPS\Request::i()->tab );
|
||||
$this->nodeClass = $nodeClass;
|
||||
$this->club = $club;
|
||||
|
||||
$tree = new \IPS\Helpers\Tree\Tree( $editUrl->setQueryString( 'tab', \IPS\Request::i()->tab ), 'x', array( $this, '_getNodeRows' ), array( $this, '_getNodeRow' ), function() { return NULL; }, function() { return array(); }, function() use( $nodeClass ) {
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'clubs', 'clubs_add_nodes' ) )
|
||||
{
|
||||
return array(
|
||||
'create' => array(
|
||||
'title' => 'add',
|
||||
'icon' => 'plus',
|
||||
'link' => \IPS\Http\Url::internal("app=core&module=clubs&controller=clubs&do=nodeForm&club={$this->club->id}&nodeClass={$nodeClass}" ),
|
||||
'data' => array(
|
||||
'ipsDialog' => '',
|
||||
'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack( $nodeClass::clubAcpTitle() )
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
return array();
|
||||
} );
|
||||
|
||||
$activeTabContents = $tree;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->output = $activeTabContents;
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->title = $club->name;
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->tabs( $tabs, $activeTab, $activeTabContents, $editUrl );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function delete()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'clubs_delete' );
|
||||
|
||||
/* Load Club */
|
||||
try
|
||||
{
|
||||
$club = \IPS\Member\Club::load( \IPS\Request::i()->id );
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2C352/7', 404, '' );
|
||||
}
|
||||
|
||||
/* Ask what to do with each node */
|
||||
$nodes = $club->nodes();
|
||||
if ( count( $nodes ) )
|
||||
{
|
||||
$form = new \IPS\Helpers\Form( 'form', 'delete' );
|
||||
$form->addMessage( 'club_delete_blurb' );
|
||||
foreach ( $nodes as $data )
|
||||
{
|
||||
try
|
||||
{
|
||||
$field = new \IPS\Helpers\Form\Node( 'node_' . str_replace( '\\', '-', preg_replace( '/^IPS\\\/', '', $data['node_class'] ) ) . '_' . $data['node_id'], 0, TRUE, array( 'class' => $data['node_class'], 'disabled' => array( $data['node_id'] ), 'disabledLang' => 'node_move_delete', 'zeroVal' => 'node_delete_content', 'subnodes' => FALSE, 'permissionCheck' => function( $node )
|
||||
{
|
||||
return array_key_exists( 'add', $node->permissionTypes() );
|
||||
}, 'clubs' => TRUE ) );
|
||||
$field->label = $data['name'];
|
||||
$form->add( $field );
|
||||
}
|
||||
catch ( \Exception $e ) {}
|
||||
}
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
foreach ( $values as $k => $v )
|
||||
{
|
||||
$exploded = explode( '_', $k );
|
||||
$nodeClass = 'IPS\\' . str_replace( '-', '\\', $exploded[1] );
|
||||
|
||||
try
|
||||
{
|
||||
$node = $nodeClass::load( $exploded[2] );
|
||||
|
||||
$nodesToQueue = array( $node );
|
||||
$nodeToCheck = $node;
|
||||
while( $nodeToCheck->hasChildren( NULL ) )
|
||||
{
|
||||
foreach ( $nodeToCheck->children( NULL ) as $nodeToCheck )
|
||||
{
|
||||
$nodesToQueue[] = $nodeToCheck;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $nodesToQueue as $_node )
|
||||
{
|
||||
if ( $v )
|
||||
{
|
||||
\IPS\Task::queue( 'core', 'DeleteOrMoveContent', array( 'class' => $nodeClass, 'id' => $_node->_id, 'moveToClass' => $nodeClass, 'moveTo' => $v->_id, 'deleteWhenDone' => TRUE, 'additional' => array() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Task::queue( 'core', 'DeleteOrMoveContent', array( 'class' => $nodeClass, 'id' => $_node->_id, 'deleteWhenDone' => TRUE, 'additional' => array() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( \Exception $e ) {}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->output = $form;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Request::i()->confirmedDelete();
|
||||
}
|
||||
|
||||
/* Delete it */
|
||||
\IPS\Session::i()->log( 'acplog__club_deleted', array( $club->name => FALSE ) );
|
||||
$club->delete();
|
||||
\IPS\Db::i()->delete( 'core_clubs_memberships', array( 'club_id=?', $club->id ) );
|
||||
\IPS\Db::i()->delete( 'core_clubs_node_map', array( 'club_id=?', $club->id ) );
|
||||
\IPS\Db::i()->delete( 'core_clubs_fieldvalues', array( 'club_id=?', $club->id ) );
|
||||
|
||||
/* Boink */
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->json( "OK" );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=core&module=clubs&controller=clubs'), 'deleted' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit Node
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function nodeForm()
|
||||
{
|
||||
/* Load Club */
|
||||
try
|
||||
{
|
||||
$club = \IPS\Member\Club::load( \IPS\Request::i()->club );
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2C352/2', 404, '' );
|
||||
}
|
||||
|
||||
/* Load Node */
|
||||
$nodeClass = \IPS\Request::i()->nodeClass;
|
||||
if ( isset( \IPS\Request::i()->nodeId ) )
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'clubs_edit_nodes' );
|
||||
|
||||
try
|
||||
{
|
||||
$node = $nodeClass::load( \IPS\Request::i()->nodeId );
|
||||
$nodeClub = $node->club();
|
||||
if ( !$nodeClub or $nodeClub->id !== $club->id )
|
||||
{
|
||||
throw new \Exception;
|
||||
}
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2C352/3', 404, '' );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'clubs_add_nodes' );
|
||||
$node = new $nodeClass;
|
||||
}
|
||||
|
||||
/* Build Form */
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$node->clubForm( $form );
|
||||
|
||||
/* Handle submissions */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$node->saveClubForm( $club, $values );
|
||||
\IPS\Session::i()->log( 'acplog__node_edited_club', array( $nodeClass::$nodeTitle => TRUE, $node->titleForLog() => FALSE, $club->name => FALSE ) );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=clubs&controller=clubs&do=edit&id={$club->id}&tab=" . str_replace( '\\', '-', preg_replace( '/^IPS\\\/', '', $nodeClass ) ) ) );
|
||||
}
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->title = $node->_title;
|
||||
\IPS\Output::i()->output = $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Node
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function deleteNode()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'clubs_delete_nodes' );
|
||||
|
||||
/* Load Club */
|
||||
try
|
||||
{
|
||||
$club = \IPS\Member\Club::load( \IPS\Request::i()->club );
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2C352/4', 404, '' );
|
||||
}
|
||||
|
||||
/* Load Node */
|
||||
$nodeClass = \IPS\Request::i()->nodeClass;
|
||||
try
|
||||
{
|
||||
$node = $nodeClass::load( \IPS\Request::i()->nodeId );
|
||||
$nodeClub = $node->club();
|
||||
if ( !$nodeClub or $nodeClub->id !== $club->id )
|
||||
{
|
||||
throw new \Exception;
|
||||
}
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2C352/5', 404, '' );
|
||||
}
|
||||
$targetUrl = \IPS\Http\Url::internal( "app=core&module=clubs&controller=clubs&do=edit&id={$club->id}&tab=" . str_replace( '\\', '-', preg_replace( '/^IPS\\\/', '', $nodeClass ) ) );
|
||||
|
||||
/* Do we have any children or content? */
|
||||
if ( $node->hasChildren( NULL, NULL, TRUE ) or $node->showDeleteOrMoveForm() )
|
||||
{
|
||||
$form = $node->deleteOrMoveForm( FALSE, TRUE );
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
\IPS\Db::i()->delete( 'core_clubs_node_map', array( 'club_id=? AND node_class=? AND node_id=?', $club->id, $nodeClass, $node->_id ) );
|
||||
$node->deleteOrMoveFormSubmit( $values );
|
||||
\IPS\Output::i()->redirect( $targetUrl );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Show form */
|
||||
\IPS\Output::i()->output = $form;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make sure the user confirmed the deletion */
|
||||
\IPS\Request::i()->confirmedDelete();
|
||||
}
|
||||
|
||||
/* Delete it */
|
||||
\IPS\Db::i()->delete( 'core_clubs_node_map', array( 'club_id=? AND node_class=? AND node_id=?', $club->id, $nodeClass, $node->_id ) );
|
||||
\IPS\Session::i()->log( 'acplog__node_deleted_club', array( $nodeClass::$nodeTitle => TRUE, $node->titleForLog() => FALSE, $club->name => FALSE ) );
|
||||
$node->delete();
|
||||
|
||||
/* Boink */
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->json( "OK" );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( $targetUrl );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Node Rows
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function _getNodeRows()
|
||||
{
|
||||
$nodeClass = $this->nodeClass;
|
||||
$rows = array();
|
||||
foreach( $nodeClass::roots( NULL, NULL, array( $nodeClass::$databasePrefix . $nodeClass::clubIdColumn() . '=?', $this->club->id ) ) as $node )
|
||||
{
|
||||
$rows[ $node->_id ] = $this->_getNodeRow( $node );
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Node Row
|
||||
*
|
||||
* @param mixed $id May be ID number (or key) or an \IPS\Node\Model object
|
||||
* @param bool $root Format this as the root node?
|
||||
* @param bool $noSort If TRUE, sort options will be disabled (used for search results)
|
||||
* @return string
|
||||
*/
|
||||
public function _getNodeRow( $id, $root=FALSE, $noSort=FALSE )
|
||||
{
|
||||
$nodeClass = $this->nodeClass;
|
||||
|
||||
if ( $id instanceof \IPS\Node\Model )
|
||||
{
|
||||
$node = $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
$node = $nodeClass::load( $id );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2C352/6', 404, '' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$buttons = array(
|
||||
'open' => array(
|
||||
'title' => 'view',
|
||||
'icon' => 'search',
|
||||
'link' => $node->url(),
|
||||
'target'=> '_blank',
|
||||
)
|
||||
);
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'clubs', 'clubs_edit_nodes' ) )
|
||||
{
|
||||
$buttons['edit'] = array(
|
||||
'title' => 'edit',
|
||||
'icon' => 'pencil',
|
||||
'link' => \IPS\Http\Url::internal("app=core&module=clubs&controller=clubs&do=nodeForm&club={$this->club->id}&nodeClass={$nodeClass}&nodeId={$node->_id}"),
|
||||
'data' => array(
|
||||
'ipsDialog' => '',
|
||||
'ipsDialog-title' => $node->_title
|
||||
)
|
||||
);
|
||||
}
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'clubs', 'clubs_delete_nodes' ) )
|
||||
{
|
||||
$buttons['delete'] = array(
|
||||
'title' => 'delete',
|
||||
'icon' => 'times-circle',
|
||||
'link' => \IPS\Http\Url::internal("app=core&module=clubs&controller=clubs&do=deleteNode&club={$this->club->id}&nodeClass={$nodeClass}&nodeId={$node->_id}"),
|
||||
'data' => ( $node->hasChildren( NULL, NULL, TRUE ) or $node->showDeleteOrMoveForm() ) ? array( 'ipsDialog' => '', 'ipsDialog-title' => $node->_title ) : array( 'delete' => '' ),
|
||||
);
|
||||
}
|
||||
|
||||
return \IPS\Theme::i()->getTemplate( 'trees', 'core' )->row(
|
||||
NULL,
|
||||
$node->_id,
|
||||
$node->_title,
|
||||
FALSE,
|
||||
$buttons,
|
||||
$node->description
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief fields
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
|
||||
* @since 03 Mar 2017
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\clubs;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* fields
|
||||
*/
|
||||
class _fields extends \IPS\Node\Controller
|
||||
{
|
||||
/**
|
||||
* Node Class
|
||||
*/
|
||||
protected $nodeClass = 'IPS\Member\Club\CustomField';
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'fields_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Clubs Settings
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 20 Feb 2017
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\clubs;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clubs Settings
|
||||
*/
|
||||
class _settings extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'clubs_settings_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage Club Settings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'clubs_enabled_setting', \IPS\Settings::i()->clubs, FALSE, array( 'togglesOn' => array( 'clubs_default_sort', 'clubs_header', 'clubs_locations', 'clubs_modperms', 'clubs_require_approval' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'clubs_default_sort', \IPS\Settings::i()->clubs_default_sort, FALSE, array( 'options' => array(
|
||||
'last_activity' => 'clubs_sort_last_activity',
|
||||
'members' => 'clubs_sort_members',
|
||||
'content' => 'clubs_sort_content',
|
||||
'created' => 'clubs_sort_created',
|
||||
'name' => 'clubs_sort_name'
|
||||
) ), NULL, NULL, NULL, 'clubs_default_sort' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'clubs_header', \IPS\Settings::i()->clubs_header, FALSE, array( 'options' => array(
|
||||
'full' => 'clubs_header_full',
|
||||
'sidebar' => 'clubs_header_sidebar',
|
||||
) ), NULL, NULL, NULL, 'clubs_header' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'clubs_locations', \IPS\Settings::i()->clubs_locations, FALSE, array(), NULL, NULL, NULL, 'clubs_locations' ) );
|
||||
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'clubs_modperms', explode( ',', \IPS\Settings::i()->clubs_modperms ), FALSE, array( 'options' => array(
|
||||
'pin' => 'club_modperm_pin',
|
||||
'unpin' => 'club_modperm_unpin',
|
||||
'edit' => 'club_modperm_edit',
|
||||
'hide' => 'club_modperm_hide',
|
||||
'unhide' => 'club_modperm_unhide',
|
||||
'view_hidden' => 'club_modperm_view_hidden',
|
||||
'future_publish' => 'club_modperm_future_publish',
|
||||
'view_future' => 'club_modperm_view_future',
|
||||
'move' => 'club_modperm_move',
|
||||
'lock' => 'club_modperm_lock',
|
||||
'unlock' => 'club_modperm_unlock',
|
||||
'reply_to_locked' => 'club_modperm_reply_to_locked',
|
||||
'delete' => 'club_modperm_delete',
|
||||
'split_merge' => 'club_modperm_split_merge',
|
||||
) ), NULL, NULL, NULL, 'clubs_modperms' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'clubs_require_approval', \IPS\Settings::i()->clubs_require_approval, FALSE, array(), NULL, NULL, NULL, 'clubs_require_approval' ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$values['clubs'] = $values['clubs_enabled_setting'];
|
||||
unset( $values['clubs_enabled_setting'] );
|
||||
$values['clubs_modperms'] = implode( ',', $values['clubs_modperms'] );
|
||||
$form->saveAsSettings( $values );
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__club_settings' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=core&module=clubs&controller=clubs') );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_clubs_settings');
|
||||
\IPS\Output::i()->output = $form;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Customization AJAX actions
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 07 May 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\customization;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Email template management
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 02 Jul 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\customization;
|
||||
@@ -50,9 +49,22 @@ class _emails extends \IPS\Dispatcher\Controller
|
||||
$table->limit = 100;
|
||||
|
||||
/* Default sort options */
|
||||
$table->sortBy = $table->sortBy ?: 'template_name';
|
||||
$table->noSort = array( 'template_name' );
|
||||
$table->sortDirection = $table->sortDirection ?: 'desc';
|
||||
|
||||
$table->quickSearch = function( $val )
|
||||
{
|
||||
$matches = \IPS\Member::loggedIn()->language()->searchCustom( 'emailtpl_', $val, TRUE );
|
||||
if ( count( $matches ) )
|
||||
{
|
||||
return '(' . \IPS\Db::i()->in( '`template_name`', array_keys( $matches ) ) . " OR `template_name` LIKE '%{$val}%')";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "`template_name` LIKE '%{$val}%'";
|
||||
}
|
||||
};
|
||||
|
||||
/* Custom parsers */
|
||||
$table->parsers = array(
|
||||
'template_name' => function( $val, $row )
|
||||
@@ -113,7 +125,7 @@ class _emails extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('emailtpl_header');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'title', (string) $table );
|
||||
\IPS\Output::i()->output = (string) $table;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -302,7 +314,7 @@ class _emails extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Output */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('emailtpl_edit');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'emailtpl_edit', $form );
|
||||
\IPS\Output::i()->output = $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'customization', 'core', 'admin' ) ), 'email' ) );;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief themes
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 15 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\customization;
|
||||
@@ -74,6 +73,14 @@ class _themes extends \IPS\Node\Controller
|
||||
);
|
||||
}
|
||||
|
||||
\IPS\Output::i()->sidebar['actions']['add'] = array(
|
||||
'primary' => true,
|
||||
'icon' => 'plus',
|
||||
'title' => 'theme_set_add_button',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=customization&controller=themes&do=add' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('theme_set_add_button') )
|
||||
);
|
||||
|
||||
parent::manage();
|
||||
}
|
||||
|
||||
@@ -84,14 +91,7 @@ class _themes extends \IPS\Node\Controller
|
||||
*/
|
||||
public function _getRootButtons()
|
||||
{
|
||||
$nodeClass = $this->nodeClass;
|
||||
|
||||
return array( 'add' => array(
|
||||
'icon' => 'plus',
|
||||
'title' => 'theme_set_add_button',
|
||||
'link' => \IPS\Http\Url::internal( "app=core&module=customization&controller=themes&do=add" ),
|
||||
'data' => ( $nodeClass::$modalForms ? array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('theme_set_add_button') ) : array() )
|
||||
) );
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -655,13 +655,12 @@ class _themes extends \IPS\Node\Controller
|
||||
$table->sortDirection = $table->sortDirection ?: 'asc';
|
||||
|
||||
/* Root Buttons */
|
||||
$table->rootButtons = array(
|
||||
'add' => array(
|
||||
'icon' => 'plus',
|
||||
'title' => 'core_theme_resources_add',
|
||||
'data' => array(),
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=customization&controller=themes&do=resourceForm&set_id=' ) . $setId,
|
||||
)
|
||||
\IPS\Output::i()->sidebar['actions']['add'] = array(
|
||||
'primary' => true,
|
||||
'icon' => 'plus',
|
||||
'title' => 'core_theme_resources_add',
|
||||
'data' => array(),
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=customization&controller=themes&do=resourceForm&set_id=' ) . $setId,
|
||||
);
|
||||
|
||||
/* Row buttons */
|
||||
@@ -693,7 +692,7 @@ class _themes extends \IPS\Node\Controller
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'customization/themes.css', 'core', 'admin' ) );
|
||||
$title = \IPS\Member::loggedIn()->language()->addToStack('theme_custom_resources_page_title', FALSE, array( 'sprintf' => array( $set->_title ) ) );
|
||||
\IPS\Output::i()->title = $title;
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global' )->block( $title, (string) $table );
|
||||
\IPS\Output::i()->output .= (string) $table;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1068,15 +1067,7 @@ class _themes extends \IPS\Node\Controller
|
||||
{
|
||||
if ( $xml->name == 'theme' )
|
||||
{
|
||||
$groups = array();
|
||||
|
||||
foreach( \IPS\Member\Group::groups() as $group )
|
||||
{
|
||||
if( $group->g_access_cp )
|
||||
{
|
||||
$groups[] = $group->g_id;
|
||||
}
|
||||
}
|
||||
$groups = array_keys( \IPS\Member::administrators()['g'] );
|
||||
|
||||
$set->saveSet( array(
|
||||
'set_name' => $xml->getAttribute('name'),
|
||||
@@ -1087,7 +1078,7 @@ class _themes extends \IPS\Node\Controller
|
||||
'set_long_version' => ( $xml->getAttribute('long_version') ) ? $xml->getAttribute('long_version') : \IPS\Application::load('core')->long_version,
|
||||
'set_is_default' => $set->is_default,
|
||||
'set_is_acp_default' => $set->is_acp_default,
|
||||
'set_permissions' => $set->id ? $set->permissions : implode( ',', $groups )
|
||||
'set_permissions' => implode( ',', $groups )
|
||||
) );
|
||||
|
||||
if ( $xml->getAttribute('editor_skin') )
|
||||
@@ -1708,13 +1699,12 @@ class _themes extends \IPS\Node\Controller
|
||||
throw new \InvalidArgumentException( 'form_bad_value' );
|
||||
}
|
||||
|
||||
$location = ( \IPS\Request::i()->theme_css_location_type == 'existing' ) ? \IPS\Request::i()->theme_css_location_existing : \IPS\Request::i()->theme_css_location_new;
|
||||
$path = ( \IPS\Request::i()->theme_css_group_type == 'existing' ) ? \IPS\Request::i()->theme_css_group_existing : \IPS\Request::i()->theme_css_group_new;
|
||||
$path = ( \IPS\Request::i()->theme_css_group_type == 'existing' ) ? \IPS\Request::i()->theme_css_group_existing : \IPS\Request::i()->theme_css_group_new;
|
||||
|
||||
/* Make sure key is unique */
|
||||
try
|
||||
{
|
||||
$row = \IPS\Db::i()->select( '*', 'core_theme_css', array( \IPS\Db::i()->in( 'css_set_id', array( 0, \IPS\Request::i()->id ) ) . " AND css_app=? AND css_path=? AND css_location=? AND css_name=?", \IPS\Request::i()->theme_css_app, $path, $location, $val ) )->first();
|
||||
$row = \IPS\Db::i()->select( '*', 'core_theme_css', array( \IPS\Db::i()->in( 'css_set_id', array( 0, \IPS\Request::i()->id ) ) . " AND css_app=? AND css_path=? AND css_location=? AND css_name=?", \IPS\Request::i()->theme_css_app, $path, \IPS\Request::i()->theme_css_location, $val ) )->first();
|
||||
|
||||
if ( isset( $row['css_id'] ) )
|
||||
{
|
||||
@@ -1744,16 +1734,8 @@ class _themes extends \IPS\Node\Controller
|
||||
{
|
||||
$apps[ $key ] = $data->_title;
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'theme_css_location_type', 'existing', FALSE, array(
|
||||
'options' => array( 'existing' => 'theme_css_location_o_existing',
|
||||
'new' => 'theme_css_location_o_new' ),
|
||||
'toggles' => array( 'existing' => array( 'location_existing' ),
|
||||
'new' => array( 'location_new' ) )
|
||||
) ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'theme_css_location_new', NULL, FALSE, array( 'regex' => '/^([a-z0-9_]+?)?$/' ), NULL, NULL, NULL, 'location_new' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'theme_css_location_existing', NULL, FALSE, array( 'options' => $locations ), NULL, NULL, NULL, 'location_existing' ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'theme_css_location', NULL, FALSE, array( 'options' => $locations ), NULL, NULL, NULL, 'theme_css_location' ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'theme_css_group_type', 'existing', FALSE, array(
|
||||
'options' => array( 'existing' => 'theme_css_group_o_existing',
|
||||
@@ -1776,7 +1758,7 @@ class _themes extends \IPS\Node\Controller
|
||||
{
|
||||
$id = intval( \IPS\Request::i()->id );
|
||||
$save = array( 'app' => $values['theme_css_app'],
|
||||
'location' => ( $values['theme_css_location_type'] == 'existing' ) ? $values['theme_css_location_existing'] : $values['theme_css_location_new'],
|
||||
'location' => $values['theme_css_location'],
|
||||
'path' => ( $values['theme_css_group_type'] == 'existing' ) ? $values['theme_css_group_existing'] : $values['theme_css_group_new'],
|
||||
'name' => $values['theme_css_name'],
|
||||
'added_to' => $id,
|
||||
@@ -2317,14 +2299,13 @@ class _themes extends \IPS\Node\Controller
|
||||
{
|
||||
throw new \InvalidArgumentException( 'form_bad_value' );
|
||||
}
|
||||
|
||||
$location = ( \IPS\Request::i()->theme_template_location_type == 'existing' ) ? \IPS\Request::i()->theme_template_location_existing : \IPS\Request::i()->theme_template_location_new;
|
||||
$group = ( \IPS\Request::i()->theme_template_group_type == 'existing' ) ? \IPS\Request::i()->theme_template_group_existing : \IPS\Request::i()->theme_template_group_new;
|
||||
|
||||
$group = ( \IPS\Request::i()->theme_template_group_type == 'existing' ) ? \IPS\Request::i()->theme_template_group_existing : \IPS\Request::i()->theme_template_group_new;
|
||||
|
||||
/* Make sure key is unique */
|
||||
try
|
||||
{
|
||||
$row = \IPS\Db::i()->select( '*', 'core_theme_templates', array( "template_set_id=? AND template_app=? AND template_group=? AND template_location=? AND template_name=?", 0, \IPS\Request::i()->theme_template_app, $group, $location, $val ) )->first();
|
||||
$row = \IPS\Db::i()->select( '*', 'core_theme_templates', array( "template_set_id=? AND template_app=? AND template_group=? AND template_location=? AND template_name=?", 0, \IPS\Request::i()->theme_template_app, $group, \IPS\Request::i()->theme_template_location, $val ) )->first();
|
||||
|
||||
if ( isset( $row['template_id'] ) )
|
||||
{
|
||||
@@ -2357,15 +2338,7 @@ class _themes extends \IPS\Node\Controller
|
||||
$apps[ $key ] = $data->_title;
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'theme_template_location_type', 'existing', FALSE, array(
|
||||
'options' => array( 'existing' => 'theme_template_location_o_existing',
|
||||
'new' => 'theme_template_location_o_new' ),
|
||||
'toggles' => array( 'existing' => array( 'location_existing' ),
|
||||
'new' => array( 'location_new' ) )
|
||||
) ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'theme_template_location_new', NULL, FALSE, array( 'regex' => '/^([A-Z][A-Z0-9]+?)$/i' ), NULL, NULL, NULL, 'location_new' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'theme_template_location_existing', NULL, FALSE, array( 'options' => $locations ), NULL, NULL, NULL, 'location_existing' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'theme_template_location', NULL, FALSE, array( 'options' => $locations ), NULL, NULL, NULL, 'location' ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'theme_template_group_type', 'existing', FALSE, array(
|
||||
'options' => array( 'existing' => 'theme_template_group_o_existing',
|
||||
@@ -2388,8 +2361,8 @@ class _themes extends \IPS\Node\Controller
|
||||
{
|
||||
$id = intval( \IPS\Request::i()->id );
|
||||
$save = array( 'app' => $values['theme_template_app'],
|
||||
'location' => ( $values['theme_template_location_type'] == 'existing' ) ? $values['theme_template_location_existing'] : $values['theme_template_location_new'],
|
||||
'group' => ( $values['theme_template_group_type'] == 'existing' ) ? $values['theme_template_group_existing'] : $values['theme_template_group_new'],
|
||||
'location' => $values['theme_template_location'],
|
||||
'group' => ( $values['theme_template_group_type'] == 'existing' ) ? $values['theme_template_group_existing'] : $values['theme_template_group_new'],
|
||||
'name' => $values['theme_template_name'],
|
||||
'added_to' => $id,
|
||||
'content' => $values['theme_template_content'],
|
||||
@@ -2910,13 +2883,13 @@ class _themes extends \IPS\Node\Controller
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->responsive = FALSE;
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('theme_editing_title', FALSE, array( 'sprintf' => array( $themeSet->_title ) ) );
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'codemirror/diff_match_patch.js', 'core', 'interface' ) );
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'codemirror/codemirror.js', 'core', 'interface' ) );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'codemirror/codemirror.css', 'core', 'interface' ) );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'customization/templates.css', 'core', 'admin' ) );
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'admin_templates.js', 'core' ) );
|
||||
|
||||
|
||||
$name = 'core_theme_set_title_' . $id;
|
||||
|
||||
/* Display */
|
||||
@@ -2930,7 +2903,7 @@ class _themes extends \IPS\Node\Controller
|
||||
\IPS\Member::loggedIn()->language()->addToStack( $name )
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'customization' )->templateEditor( $themeSet, $templateNames, $templateBit, array( 'app' => $t_app, 'location' => $t_location, 'group' => $t_group, 'template' => $t_template, 'type' => $t_type, 'item_id' => $itemId ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief theme Settings
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 17 May 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\customization;
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief rss
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 13 Oct 2016
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\discovery;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Search settings
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 14 Apr 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\discovery;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief streams
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 01 Jul 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\discovery;
|
||||
@@ -119,22 +118,23 @@ class _streams extends \IPS\Node\Controller
|
||||
$types = array( 'register', 'follow_member', 'follow_content', 'photo' );
|
||||
if ( \IPS\Settings::i()->reputation_enabled )
|
||||
{
|
||||
if ( \IPS\Settings::i()->reputation_point_types == 'like' )
|
||||
$types[] = 'like';
|
||||
}
|
||||
if ( \IPS\Settings::i()->clubs )
|
||||
{
|
||||
$types[] = 'clubs';
|
||||
}
|
||||
|
||||
/* Extensions */
|
||||
foreach ( \IPS\Application::allExtensions( 'core', 'StreamItems', TRUE, 'core' ) as $key => $extension )
|
||||
{
|
||||
$extensionKey = mb_strtolower( $key );
|
||||
$settingKey = "all_activity_{$extensionKey}";
|
||||
|
||||
/* Only add the option if a setting for it exists - the setting must be defined by the application the extension is for. */
|
||||
if( isset( \IPS\Settings::i()->$settingKey ) )
|
||||
{
|
||||
$types[] = 'like';
|
||||
}
|
||||
elseif ( \IPS\Settings::i()->reputation_point_types == 'both' )
|
||||
{
|
||||
$types[] = 'like';
|
||||
$types[] = 'rep_neg';
|
||||
}
|
||||
elseif ( \IPS\Settings::i()->reputation_point_types == 'positive' )
|
||||
{
|
||||
$types[] = 'like';
|
||||
}
|
||||
elseif ( \IPS\Settings::i()->reputation_point_types == 'negative' )
|
||||
{
|
||||
$types[] = 'rep_neg';
|
||||
$types[] = mb_strtolower( $key );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ class _streams extends \IPS\Node\Controller
|
||||
{
|
||||
$currentValuesStream[] = $k;
|
||||
}
|
||||
$options[ $k ] = ( $k == 'like' and \IPS\Settings::i()->reputation_point_types != 'like' ) ? 'all_activity_rep_pos' : $key;
|
||||
$options[ $k ] = ( $k == 'like' and !\IPS\Content\Reaction::isLikeMode() ) ? 'all_activity_react' : $key;
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Emoticons
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 02 May 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\editor;
|
||||
@@ -43,7 +42,7 @@ class _emoticons extends \IPS\Dispatcher\Controller
|
||||
protected function manage()
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_editor_emoticons');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'menu__core_editor_emoticons', \IPS\Theme::i()->getTemplate( 'customization' )->emoticons( $this->_getEmoticons() ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'customization' )->emoticons( $this->_getEmoticons() );
|
||||
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'editor', 'emoticons_edit' ) )
|
||||
{
|
||||
@@ -53,6 +52,7 @@ class _emoticons extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions'] = array(
|
||||
'add' => array(
|
||||
'primary' => TRUE,
|
||||
'icon' => 'plus-circle',
|
||||
'title' => 'emoticons_add',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=editor&controller=emoticons&do=add' ),
|
||||
@@ -225,7 +225,8 @@ class _emoticons extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
$emoticons = $this->_getEmoticons( TRUE );
|
||||
$emoticons = $this->_getEmoticons( TRUE );
|
||||
$setPos = 1;
|
||||
|
||||
foreach ( $emoticons as $group => $emos )
|
||||
{
|
||||
@@ -233,10 +234,12 @@ class _emoticons extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
foreach( \IPS\Request::i()->$group as $id )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_emoticons', array( 'emo_position' => $i, 'emo_set' => str_replace( 'core_emoticon_group_', '', $group ) ), array( 'id=?', $id ) );
|
||||
\IPS\Db::i()->update( 'core_emoticons', array( 'emo_position' => $i, 'emo_set_position' => $setPos, 'emo_set' => str_replace( 'core_emoticon_group_', '', $group ) ), array( 'id=?', $id ) );
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$setPos++;
|
||||
}
|
||||
}
|
||||
unset( \IPS\Data\Store::i()->emoticons );
|
||||
@@ -379,6 +382,7 @@ class _emoticons extends \IPS\Dispatcher\Controller
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'emoticons_edit' );
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->class = 'ipsForm_vertical ipsForm_fullWidth';
|
||||
$form->add( new \IPS\Helpers\Form\Translatable( 'emoticons_add_newgroup', NULL, FALSE, array( 'app' => 'core', 'key' => \IPS\Request::i()->key ), NULL, NULL, NULL, 'emoticons_add_newgroup' ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief settings
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 13 Aug 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\editor;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Editor Toolbars
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 30 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\editor;
|
||||
@@ -263,7 +262,7 @@ class _toolbar extends \IPS\Dispatcher\Controller
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
/* IPS Cloud Sync */
|
||||
\IPS\IPS::resyncIPSCloud();
|
||||
\IPS\IPS::resyncIPSCloud('Updated editor configuration');
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=core&module=editor&controller=toolbar') );
|
||||
}
|
||||
@@ -322,7 +321,7 @@ class _toolbar extends \IPS\Dispatcher\Controller
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
/* IPS Cloud Sync */
|
||||
\IPS\IPS::resyncIPSCloud();
|
||||
\IPS\IPS::resyncIPSCloud('Added custom editor button');
|
||||
|
||||
/* Redirect */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=editor&controller=toolbar' ), 'saved' );
|
||||
@@ -469,7 +468,7 @@ class _toolbar extends \IPS\Dispatcher\Controller
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
/* IPS Cloud Sync */
|
||||
\IPS\IPS::resyncIPSCloud();
|
||||
\IPS\IPS::resyncIPSCloud('Added CKEditor plugin');
|
||||
|
||||
/* Redirect */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=editor&controller=toolbar' ), 'saved' );
|
||||
@@ -799,7 +798,7 @@ JS;
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
/* IPS Cloud Sync */
|
||||
\IPS\IPS::resyncIPSCloud();
|
||||
\IPS\IPS::resyncIPSCloud('Deleted editor plugin');
|
||||
|
||||
/* Redirect */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=editor&controller=toolbar' ), 'saved' );
|
||||
@@ -861,7 +860,7 @@ JS;
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
/* IPS Cloud Sync */
|
||||
\IPS\IPS::resyncIPSCloud();
|
||||
\IPS\IPS::resyncIPSCloud('Reverted editor configuration');
|
||||
|
||||
/* Redirect */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=editor&controller=toolbar" ), 'saved' );
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief languages
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 25 Jun 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\languages;
|
||||
@@ -349,7 +348,8 @@ class _languages extends \IPS\Node\Controller
|
||||
$table = new \IPS\Helpers\Table\Db( 'core_sys_lang_words', \IPS\Http\Url::internal( 'app=core&module=languages&controller=languages&do=translate&id=' . \IPS\Request::i()->id ), $where );
|
||||
$table->langPrefix = 'lang_';
|
||||
$table->classes = array( 'cTranslateTable' );
|
||||
|
||||
$table->rowClasses = array( 'word_default' => array( 'ipsTable_wrap' ) );
|
||||
|
||||
$table->include = array( 'word_app', 'word_plugin', 'word_theme', 'word_key', 'word_default', 'word_custom' );
|
||||
|
||||
$table->parsers = array(
|
||||
@@ -656,7 +656,7 @@ class _languages extends \IPS\Node\Controller
|
||||
|
||||
/* Finish */
|
||||
$xml->endDocument();
|
||||
\IPS\Output::i()->sendOutput( $xml->outputMemory(), 200, 'application/xml', array( 'Content-Disposition' => \IPS\Output::getContentDisposition( 'attachment', $lang->title . '.xml' ) ) );
|
||||
\IPS\Output::i()->sendOutput( $xml->outputMemory(), 200, 'application/xml', array( 'Content-Disposition' => \IPS\Output::getContentDisposition( 'attachment', $lang->title . '.xml' ) ), FALSE, FALSE, FALSE );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -940,7 +940,7 @@ class _languages extends \IPS\Node\Controller
|
||||
{
|
||||
\IPS\Member::updateAllMembers( array( 'language' => \IPS\Request::i()->id ) );
|
||||
}
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__members_language_reset', array( \IPS\Lang::load( \IPS\Request::i()->id )->title => FALSE ) );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=languages&controller=languages' ), 'reset' );
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Device Tools
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 11 Mar 2017
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\members;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Device Tools
|
||||
*/
|
||||
class _devices extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'membertools_ip' );
|
||||
return parent::execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* View Device Details
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function device()
|
||||
{
|
||||
/* Load */
|
||||
$member = \IPS\Member::load( \IPS\Request::i()->member );
|
||||
try
|
||||
{
|
||||
$device = \IPS\Member\Device::loadAndAuthenticate( \IPS\Request::i()->key, $member );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2C355/1', 404, '' );
|
||||
}
|
||||
$url = \IPS\Http\Url::internal( "app=core&module=members&controller=devices&do=device&key={$device->device_key}&member={$member->member_id}" );
|
||||
|
||||
/* Set title and breadcrumb */
|
||||
$userAgent = $device->userAgent();
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'member_names_device', FALSE, array( 'sprintf' => array( $member->name, $userAgent->platform ) ) );
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( "app=core&module=members&controller=members" ), 'members' );
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( "app=core&module=members&controller=members&do=edit&id={$member->member_id}" ), $member->name );
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( "app=core&module=members&controller=devices&do=member&id={$member->member_id}" ), 'members_devices' );
|
||||
\IPS\Output::i()->breadcrumb[] = array( NULL, $userAgent );
|
||||
|
||||
/* Define table */
|
||||
$activeTabContents = '';
|
||||
$tabs = array(
|
||||
'info' => 'device_info',
|
||||
'member' => \IPS\Member::loggedIn()->language()->addToStack( 'device_ips_from_member', FALSE, array( 'sprintf' => array( $member->name ) ) ),
|
||||
'others' => 'device_other_members'
|
||||
);
|
||||
$activeTab = ( isset( \IPS\Request::i()->tab ) and array_key_exists( \IPS\Request::i()->tab, $tabs ) ) ? \IPS\Request::i()->tab : 'info';
|
||||
|
||||
if ( $activeTab === 'info' )
|
||||
{
|
||||
$activeTabContents = \IPS\Theme::i()->getTemplate( 'members' )->deviceInfo( $device );
|
||||
}
|
||||
elseif ( $activeTab === 'member' )
|
||||
{
|
||||
$table = new \IPS\Helpers\Table\Db( 'core_members_known_ip_addresses', $url->setQueryString( 'tab', 'member' ), array( 'device_key=? AND member_id=?', $device->device_key, $member->member_id ) );
|
||||
$table->langPrefix = 'device_table_';
|
||||
$table->include = array( 'ip_address', 'location', 'last_seen' );
|
||||
$table->sortBy = $table->sortBy ?: 'last_seen';
|
||||
$table->parsers = array(
|
||||
'location' => function( $val, $row ) {
|
||||
try
|
||||
{
|
||||
return \IPS\GeoLocation::getByIp( $row['ip_address'] );
|
||||
}
|
||||
catch ( \BadFunctionCallException $e )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('geolocation_enable_service');
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('unknown');
|
||||
}
|
||||
},
|
||||
'last_seen' => function( $val ) {
|
||||
return \IPS\DateTime::ts( $val );
|
||||
}
|
||||
);
|
||||
$table->rowButtons = function( $row ) {
|
||||
return array(
|
||||
'view' => array(
|
||||
'title' => 'view',
|
||||
'icon' => 'search',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=members&controller=ip' )->setQueryString( 'ip', $row['ip_address'] ),
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
$activeTabContents = \IPS\Theme::i()->getTemplate( 'forms' )->blurb( \IPS\Member::loggedIn()->language()->addToStack( 'device_ips_from_member_info', FALSE, array( 'sprintf' => array( $member->name, \IPS\Http\Url::internal( "app=core&module=members&controller=members&do=ip&id={$member->member_id}" ) ) ) ), TRUE, TRUE ) . $table . \IPS\Theme::i()->getTemplate( 'members' )->geoipDisclaimer();
|
||||
}
|
||||
else
|
||||
{
|
||||
$table = new \IPS\Helpers\Table\Db( 'core_members_known_devices', $url->setQueryString( 'tab', 'others' ), array( 'device_key=? AND member_id<>?', $device->device_key, $member->member_id ) );
|
||||
$table->langPrefix = 'device_table_';
|
||||
$table->include = array( 'member_id', 'last_seen' );
|
||||
$table->sortBy = $table->sortBy ?: 'last_seen';
|
||||
$table->parsers = array(
|
||||
'member_id' => function( $val ) {
|
||||
$member = \IPS\Member::load( $val );
|
||||
if ( $member->member_id )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'global', 'core' )->userPhoto( $member, 'tiny' ) . \IPS\Theme::i()->getTemplate( 'global', 'core' )->userLink( $member, 'tiny' );
|
||||
}
|
||||
else
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('deleted_member');
|
||||
}
|
||||
},
|
||||
'last_seen' => function( $val ) {
|
||||
return \IPS\DateTime::ts( $val );
|
||||
}
|
||||
);
|
||||
$table->rowButtons = function( $row ) {
|
||||
return array(
|
||||
'view' => array(
|
||||
'title' => 'view',
|
||||
'icon' => 'search',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=members&controller=members&do=edit' )->setQueryString( 'id', $row['member_id'] ),
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
$activeTabContents = \IPS\Theme::i()->getTemplate( 'forms' )->blurb( 'device_other_members_info', TRUE, TRUE ) . $table;
|
||||
}
|
||||
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->output = $activeTabContents;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $device->login_key )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions']['deauthorize'] = array(
|
||||
'icon' => 'times',
|
||||
'title' => 'sign_out',
|
||||
'link' => \IPS\Http\Url::internal( "app=core&module=members&controller=devices&do=deauthorize" )->setQueryString( array( 'device' => $device->device_key, 'member' => $member->member_id, 'r' => 'device' ) )
|
||||
);
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->tabs( $tabs, $activeTab, $activeTabContents, $url );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* View Devices used by a member
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function member()
|
||||
{
|
||||
/* Load */
|
||||
$member = \IPS\Member::load( \IPS\Request::i()->id );
|
||||
if ( !$member->member_id )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2C355/1', 404, '' );
|
||||
}
|
||||
|
||||
/* Build table */
|
||||
$table = new \IPS\Helpers\Table\Db( 'core_members_known_devices', \IPS\Http\Url::internal("app=core&module=members&controller=devices&do=member&id={$member->member_id}"), array( 'member_id=?', $member->member_id ) );
|
||||
$table->langPrefix = 'device_table_';
|
||||
$table->include = array( 'user_agent', 'login_key', 'login_handler', 'last_seen', 'other_members' );
|
||||
$table->noSort = array( 'login_key', 'other_members' );
|
||||
$table->sortBy = $table->sortBy ?: 'last_seen';
|
||||
$table->parsers = array(
|
||||
'user_agent' => function( $val ) {
|
||||
return (string) \IPS\Http\UserAgent::parse( $val );
|
||||
},
|
||||
'login_key' => function( $val, $row ) {
|
||||
return \IPS\Theme::i()->getTemplate('members')->deviceAuthorization( (bool) $val, $row['last_seen'] >= ( new \IPS\DateTime )->sub( new \DateInterval( \IPS\Member\Device::LOGIN_KEY_VALIDITY ) )->getTimestamp(), $row['anonymous'] );
|
||||
},
|
||||
'login_handler' => function( $val, $row ) {
|
||||
return \IPS\Theme::i()->getTemplate('members')->deviceHandler( $val );
|
||||
},
|
||||
'last_seen' => function( $val ) {
|
||||
return \IPS\DateTime::ts( $val );
|
||||
},
|
||||
'other_members' => function( $val, $row ) {
|
||||
if ( \IPS\Db::i()->select( 'COUNT(*)', 'core_members_known_devices', array( 'device_key=? AND member_id<>?', $row['device_key'], $row['member_id'] ) )->first() )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate('members')->deviceDuplicate();
|
||||
}
|
||||
return '';
|
||||
},
|
||||
);
|
||||
$table->rowButtons = function( $row )
|
||||
{
|
||||
$return = array(
|
||||
'view' => array(
|
||||
'title' => 'view',
|
||||
'icon' => 'search',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=members&controller=devices&do=device' )->setQueryString( 'key', $row['device_key'] )->setQueryString( 'member', $row['member_id'] ),
|
||||
),
|
||||
);
|
||||
|
||||
if ( $row['login_key'] )
|
||||
{
|
||||
$return['deauthorize'] = array(
|
||||
'title' => 'sign_out',
|
||||
'icon' => 'times',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=members&controller=devices&do=deauthorize' )->setQueryString( array(
|
||||
'device' => $row['device_key'],
|
||||
'member' => $row['member_id']
|
||||
) ),
|
||||
);
|
||||
}
|
||||
|
||||
return $return;
|
||||
};
|
||||
|
||||
/* Output */
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'members' )->deviceTable( $table );
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'member_names_devices', FALSE, array( 'sprintf' => array( $member->name ) ) );
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( "app=core&module=members&controller=members" ), 'members' );
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( "app=core&module=members&controller=members&do=edit&id={$member->member_id}" ), $member->name );
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( "app=core&module=members&controller=devices&do=member&id={$member->member_id}" ), 'members_devices' );
|
||||
}
|
||||
|
||||
/**
|
||||
* De-Authorize a Device
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function deauthorize()
|
||||
{
|
||||
try
|
||||
{
|
||||
$device = \IPS\Member\Device::loadAndAuthenticate( \IPS\Request::i()->device, \IPS\Member::load( \IPS\Request::i()->member ) );
|
||||
$device->login_key = NULL;
|
||||
$device->save();
|
||||
|
||||
\IPS\Db::i()->delete( 'core_sessions', array( 'member_id=? AND browser=?', $device->member_id, $device->user_agent ) );
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
|
||||
if ( isset( \IPS\Request::i()->r ) and \IPS\Request::i()->r === 'device' )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal("app=core&module=members&controller=devices&do=device")->setQueryString( array( 'key' => \IPS\Request::i()->device, 'member' => \IPS\Request::i()->member ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal("app=core&module=members&controller=devices&do=member")->setQueryString( 'id', \IPS\Request::i()->member ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Groups
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 25 Mar 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\members;
|
||||
@@ -82,14 +81,14 @@ class _groups extends \IPS\Dispatcher\Controller
|
||||
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'members', 'groups_add' ) )
|
||||
{
|
||||
$table->rootButtons = array(
|
||||
'add' => array(
|
||||
'icon' => 'plus',
|
||||
'title' => 'groups_add',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=members&controller=groups&do=form' ),
|
||||
)
|
||||
\IPS\Output::i()->sidebar['actions']['add'] = array(
|
||||
'primary' => true,
|
||||
'icon' => 'plus',
|
||||
'title' => 'groups_add',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=members&controller=groups&do=form' ),
|
||||
);
|
||||
}
|
||||
|
||||
$table->rowButtons = function( $row )
|
||||
{
|
||||
$return = array();
|
||||
@@ -147,7 +146,7 @@ class _groups extends \IPS\Dispatcher\Controller
|
||||
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('groups');
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global' )->block( 'groups', (string) $table );
|
||||
\IPS\Output::i()->output .= (string) $table;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -385,8 +384,12 @@ class _groups extends \IPS\Dispatcher\Controller
|
||||
/* Any members in it? */
|
||||
if ( \IPS\Db::i()->select( 'COUNT(*)', 'core_members', array( 'member_group_id=?', $group->g_id ) )->first() )
|
||||
{
|
||||
/* Create the options, but don't let the admin move members in the group back into this same group */
|
||||
$groupOptions = \IPS\Member\Group::groups( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'members', 'member_move_admin2' ), FALSE );
|
||||
unset( $groupOptions[ $group->g_id ] );
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'form', 'delete' );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'delete_group_move_to', NULL, TRUE, array( 'options' => \IPS\Member\Group::groups( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'members', 'member_move_admin2' ), FALSE ), 'parse' => 'normal' ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'delete_group_move_to', NULL, TRUE, array( 'options' => $groupOptions, 'parse' => 'normal' ) ) );
|
||||
$form->hiddenValues['wasConfirmed'] = 1;
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief IP Address Tools
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 19 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\members;
|
||||
@@ -115,7 +114,7 @@ class _ip extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'members', 'core', 'global' )->ipLookup( $url, $geolocation, $map, $hostName, array_merge( $otherCounts, $contentCounts ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core', 'admin' )->block( '', \IPS\Theme::i()->getTemplate( 'members', 'core', 'global' )->ipLookup( $url, $geolocation, $map, $hostName, array_merge( $otherCounts, $contentCounts ) ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Manage Members
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 21 Mar 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\members;
|
||||
@@ -43,6 +42,7 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
$table->include = array( 'photo', 'name', 'email', 'joined', 'group_name', 'ip_address' );
|
||||
$table->mainColumn = 'name';
|
||||
$table->noSort = array( 'photo' );
|
||||
$table->rowClasses = array( 'email' => array( 'ipsTable_wrap' ), 'group_name' => array( 'ipsTable_wrap' ) );
|
||||
|
||||
/* Default sort options */
|
||||
$table->sortBy = $table->sortBy ?: 'joined';
|
||||
@@ -211,7 +211,7 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
},
|
||||
'photo' => function( $val, $row )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'global', 'core' )->userPhoto( \IPS\Member::constructFromData( $row ), 'mini' );
|
||||
return \IPS\Theme::i()->getTemplate( 'global', 'core' )->userPhoto( \IPS\Member::constructFromData( $row ), 'tiny' );
|
||||
},
|
||||
'joined' => function( $val, $row )
|
||||
{
|
||||
@@ -264,7 +264,7 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$title = \IPS\Member::loggedIn()->language()->addToStack( 'banned' );
|
||||
}
|
||||
return "<a href='" . \IPS\Http\Url::internal( 'app=core&module=members&controller=members&do=edit&id=' ) . $row['member_id'] . "'>" . htmlentities( $val, \IPS\HTMLENTITIES, 'UTF-8', FALSE ) . "</a> <span class='ipsBadge ipsBadge_negative'>" . $title ."</span> ";
|
||||
return "<a href='" . \IPS\Http\Url::internal( 'app=core&module=members&controller=members&do=edit&id=' ) . $row['member_id'] . "'>" . htmlentities( $val, \IPS\HTMLENTITIES, 'UTF-8', FALSE ) . "</a> <span class='ipsBadge ipsBadge_negative'>" . $title ."</span> ";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -277,13 +277,12 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
/* Specify the buttons */
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'members', 'member_add' ) )
|
||||
{
|
||||
$table->rootButtons = array(
|
||||
'add' => array(
|
||||
'icon' => 'plus',
|
||||
'title' => 'members_add',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=members&controller=members&do=add' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('members_add') )
|
||||
)
|
||||
\IPS\Output::i()->sidebar['actions']['add'] = array(
|
||||
'primary' => true,
|
||||
'icon' => 'plus',
|
||||
'title' => 'members_add',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=members&controller=members&do=add' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('members_add') )
|
||||
);
|
||||
}
|
||||
$table->rowButtons = function( $row )
|
||||
@@ -401,14 +400,14 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'members', 'member_delete' ) OR \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'members', 'member_edit' ) )
|
||||
{
|
||||
$query = array(
|
||||
'members_name' => \IPS\Request::i()->quicksearch ?: NULL,
|
||||
'members_name' => \IPS\Request::i()->quicksearch ?: \IPS\Request::i()->members_name,
|
||||
//'members_member_id' => ( \IPS\Request::i()->members_member_id[0] != 'any' ) ? \IPS\Request::i()->members_member_id[1] : 0,
|
||||
'members_member_id' => \IPS\Request::i()->members_member_id,
|
||||
'members_email' => \IPS\Request::i()->members_email,
|
||||
'members_ip_address' => \IPS\Request::i()->members_ip_address,
|
||||
'members_member_group_id' => \IPS\Request::i()->members_member_group_id,
|
||||
'members_joined' => \IPS\Request::i()->members_joined,
|
||||
'members_last_post' => \IPS\Request::i()->members_last_post,
|
||||
'members_last_post' => \IPS\Request::i()->members_member_last_post,
|
||||
'members_last_visit' => \IPS\Request::i()->members_last_visit,
|
||||
'members_posts' => \IPS\Request::i()->members_member_posts,
|
||||
'filter' => \IPS\Request::i()->filter,
|
||||
@@ -454,7 +453,7 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('members');
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global' )->block( 'members', (string) $table );
|
||||
\IPS\Output::i()->output .= (string) $table;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -479,7 +478,31 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
|
||||
if ( \IPS\Request::i()->members_name )
|
||||
{
|
||||
$where[] = array( "name LIKE CONCAT( '%', ?, '%' )", \IPS\Request::i()->members_name );
|
||||
if ( is_array( \IPS\Request::i()->members_name ) )
|
||||
{
|
||||
if ( \IPS\Request::i()->members_name[1] )
|
||||
{
|
||||
switch( \IPS\Request::i()->members_name[0] )
|
||||
{
|
||||
case 'c':
|
||||
$operator = "LIKE CONCAT( '%', ?, '%' )";
|
||||
break;
|
||||
|
||||
case 'bw':
|
||||
$operator = "LIKE CONCAT( ?, '%' )";
|
||||
break;
|
||||
|
||||
case 'eq':
|
||||
$operator = "=?";
|
||||
break;
|
||||
}
|
||||
$where[] = array( 'name ' . $operator , \IPS\Request::i()->members_name[1] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$where[] = array( "name LIKE CONCAT( '%', ?, '%' )", \IPS\Request::i()->members_name );
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( \IPS\Request::i()->members_member_id ) AND isset( \IPS\Request::i()->members_member_id[1] ) AND \IPS\Request::i()->members_member_id[1] )
|
||||
@@ -510,14 +533,7 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
|
||||
if ( \IPS\Request::i()->members_member_group_id )
|
||||
{
|
||||
$adminGroups = array();
|
||||
foreach( \IPS\Member\Group::groups( TRUE, FALSE ) AS $k => $group )
|
||||
{
|
||||
if ( $group->g_access_cp )
|
||||
{
|
||||
$adminGroups[] = $group->g_id;
|
||||
}
|
||||
}
|
||||
$adminGroups = array_keys( \IPS\Member::administrators()['g'] );
|
||||
|
||||
/* We do a generic permissions check here, then later on when the process is actually running, we check each individual one to make sure we don't do something we shouldn't do */
|
||||
if
|
||||
@@ -543,38 +559,43 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
$where[] = array( '( member_group_id=? OR FIND_IN_SET( ?, mgroup_others ) )', (int) \IPS\Request::i()->members_member_group_id,(int) \IPS\Request::i()->members_member_group_id );
|
||||
}
|
||||
}
|
||||
|
||||
if ( \IPS\Request::i()->members_joined['start'] AND \IPS\Request::i()->members_joined['end'] )
|
||||
|
||||
foreach ( array( 'joined', 'last_post', 'last_visit' ) as $k )
|
||||
{
|
||||
$start = new \IPS\DateTime( \IPS\Helpers\Form\Date::_convertDateFormat( \IPS\Request::i()->members_joined['start'] ) );
|
||||
$start = $start->setTime( 0, 0, 0 );
|
||||
|
||||
$end = new \IPS\DateTime( \IPS\Helpers\Form\Date::_convertDateFormat( \IPS\Request::i()->members_joined['end'] ) );
|
||||
$end = $end->setTime( 23, 59, 59 );
|
||||
|
||||
$where[] = array( 'joined BETWEEN ? AND ?', $start->getTimestamp(), $end->getTimestamp() );
|
||||
}
|
||||
|
||||
if ( \IPS\Request::i()->members_last_post['start'] AND \IPS\Request::i()->members_last_post['end'] )
|
||||
{
|
||||
$start = new \IPS\DateTime( \IPS\Helpers\Form\Date::_convertDateFormat( \IPS\Request::i()->members_last_post['start'] ) );
|
||||
$start = $start->setTime( 0, 0, 0 );
|
||||
|
||||
$end = new \IPS\DateTime( \IPS\Helpers\Form\Date::_convertDateFormat( \IPS\Request::i()->members_last_post['end'] ) );
|
||||
$end = $end->setTime( 23, 59, 59 );
|
||||
|
||||
$where[] = array( 'member_last_post BETWEEN ? AND ?', $start->getTimestamp(), $end->getTimestamp() );
|
||||
}
|
||||
|
||||
if ( \IPS\Request::i()->members_last_visit['start'] AND isset( \IPS\Request::i()->members_last_visit['end'] ) )
|
||||
{
|
||||
$start = new \IPS\DateTime( \IPS\Helpers\Form\Date::_convertDateFormat( \IPS\Request::i()->members_last_visit['start'] ) );
|
||||
$start = $start->setTime( 0, 0, 0 );
|
||||
|
||||
$end = new \IPS\DateTime( \IPS\Helpers\Form\Date::_convertDateFormat( \IPS\Request::i()->members_last_visit['end'] ) );
|
||||
$end = $end->setTime( 23, 59, 59 );
|
||||
|
||||
$where[] = array( 'last_visit BETWEEN ? AND ?', $start->getTimestamp(), $end->getTimestamp() );
|
||||
$requestKey = "members_{$k}";
|
||||
if ( $k === 'last_post' )
|
||||
{
|
||||
$k = 'member_last_post';
|
||||
}
|
||||
|
||||
if ( \IPS\Request::i()->$requestKey['start'] or \IPS\Request::i()->$requestKey['end'] )
|
||||
{
|
||||
$start = NULL;
|
||||
$end = NULL;
|
||||
if ( \IPS\Request::i()->$requestKey['start'] )
|
||||
{
|
||||
$start = new \IPS\DateTime( \IPS\Helpers\Form\Date::_convertDateFormat( \IPS\Request::i()->$requestKey['start'] ) );
|
||||
$start = $start->setTime( 0, 0, 0 );
|
||||
}
|
||||
if ( \IPS\Request::i()->$requestKey['end'] )
|
||||
{
|
||||
$end = new \IPS\DateTime( \IPS\Helpers\Form\Date::_convertDateFormat( \IPS\Request::i()->$requestKey['end'] ) );
|
||||
$end = $end->setTime( 23, 59, 59 );
|
||||
}
|
||||
|
||||
if ( $start and $end )
|
||||
{
|
||||
$where[] = array( "{$k} BETWEEN ? AND ?", $start->getTimestamp(), $end->getTimestamp() );
|
||||
}
|
||||
elseif ( $start )
|
||||
{
|
||||
$where[] = array( "{$k}>?", $start->getTimestamp() );
|
||||
}
|
||||
elseif ( $end )
|
||||
{
|
||||
$where[] = array( "{$k}<?", $start->getTimestamp() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ( isset( \IPS\Request::i()->members_posts[0] ) AND \IPS\Request::i()->members_posts[0] != 'any' ) AND isset( \IPS\Request::i()->members_posts[1] ) )
|
||||
@@ -720,7 +741,7 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$group = \IPS\Member\Group::load( $values['move_to_group'] );
|
||||
|
||||
if ( $group->g_access_cp AND !\IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'members', 'member_move_admin2' ) )
|
||||
if ( in_array( $group->g_id, array_keys( \IPS\Member::administrators()['g'] ) ) AND !\IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'members', 'member_move_admin2' ) )
|
||||
{
|
||||
\IPS\Output::i()->error( 'member_move_admin_group', '2C114/H', 403, '' );
|
||||
}
|
||||
@@ -976,12 +997,8 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'admin_members.js', 'core' ) );
|
||||
|
||||
\IPS\Output::i()->title = $member->name;
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('members')->editMember(
|
||||
$member,
|
||||
$form,
|
||||
( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'members', 'member_photo' ) and ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'members', 'member_photo_admin' ) or !$member->isAdmin() ) ),
|
||||
\IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'members', 'membertools_ip' )
|
||||
);
|
||||
\IPS\Output::i()->customHeader = \IPS\Theme::i()->getTemplate( 'members' )->editMemberHeader( $member, \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'members', 'membertools_ip' ) );
|
||||
\IPS\Output::i()->output = $form;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1036,6 +1053,7 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
catch( \BadMethodCallException $e ){}
|
||||
}
|
||||
$member->invalidateSessionsAndLogins( TRUE, \IPS\Session::i()->id );
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__members_edited', array( $member->name => FALSE ) );
|
||||
|
||||
@@ -1096,7 +1114,8 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Build Form */
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'pp_photo_type', $member->pp_photo_type, TRUE, array( 'options' => $options, 'toggles' => $toggles ) ) );
|
||||
$form->ajaxOutput = TRUE;
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'pp_photo_type', ( $member->pp_photo_type == 'letter' ) ? 'none' : $member->pp_photo_type, TRUE, array( 'options' => $options, 'toggles' => $toggles ) ) );
|
||||
$customVal = NULL;
|
||||
if ( $member->pp_photo_type === 'custom' )
|
||||
{
|
||||
@@ -1130,16 +1149,18 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
break;
|
||||
|
||||
case 'url':
|
||||
$member->pp_photo_type = 'custom';
|
||||
$member->pp_main_photo = NULL;
|
||||
$member->pp_main_photo = (string) $values['member_photo_url'];
|
||||
$member->pp_photo_type = 'custom';
|
||||
$member->pp_main_photo = NULL;
|
||||
$member->pp_thumb_photo = NULL;
|
||||
$member->pp_main_photo = (string) $values['member_photo_url'];
|
||||
$member->photo_last_update = time();
|
||||
break;
|
||||
|
||||
case 'none':
|
||||
$member->pp_main_photo = NULL;
|
||||
$member->pp_thumb_photo = NULL;
|
||||
$member->members_bitoptions['bw_disable_gravatar'] = 1;
|
||||
$member->photo_last_update = NULL;
|
||||
$member->photo_last_update = NULL;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1193,6 +1214,7 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
$table->mainColumn = 'ip';
|
||||
$table->sortBy = $table->sortBy ?: 'last';
|
||||
$table->quickSearch = 'ip';
|
||||
$table->include = array( 'ip', 'location', 'count', 'first', 'last' );
|
||||
|
||||
/* Parsers */
|
||||
$table->parsers = array(
|
||||
@@ -1204,6 +1226,20 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
return \IPS\DateTime::ts( $val )->localeDate();
|
||||
},
|
||||
'location' => function( $val, $row ) {
|
||||
try
|
||||
{
|
||||
return \IPS\GeoLocation::getByIp( $row['ip'] );
|
||||
}
|
||||
catch ( \BadFunctionCallException $e )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('geolocation_enable_service');
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('unknown');
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
/* Buttons */
|
||||
@@ -1220,8 +1256,10 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->title = $member->name;
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal("app=core&module=members&controller=members&do=edit")->setQueryString("id", $member->member_id), $member->name );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('global')->block( 'menu__core_members_ip', (string) $table );
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( "app=core&module=members&controller=members" ), 'members' );
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( "app=core&module=members&controller=members&do=edit&id={$member->member_id}" ), $member->name );
|
||||
\IPS\Output::i()->breadcrumb[] = array( NULL, 'ip_addresses' );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'forms' )->blurb( \IPS\Member::loggedIn()->language()->addToStack( 'members_ips_info', FALSE, array( 'sprintf' => array( $member->name ) ) ), TRUE, TRUE ) . $table . \IPS\Theme::i()->getTemplate( 'members' )->geoipDisclaimer();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1336,17 +1374,19 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2C114/D', 404, '' );
|
||||
}
|
||||
|
||||
$table = new \IPS\Helpers\Table\Db( 'core_dnames_change', \IPS\Http\Url::internal( "app=core&module=members&controller=members&do=viewDnameHistory&id={$member->member_id}" ), array( 'dname_member_id=?', (int) $member->member_id ) );
|
||||
$table->include = array( 'dname_previous', 'dname_current', 'dname_date', 'dname_ip_address' );
|
||||
$table->noSort = array( 'dname_previous', 'dname_current', 'dname_date', 'dname_ip_address' );
|
||||
$table->parsers = array(
|
||||
'dname_date' => function( $value )
|
||||
|
||||
$table = new \IPS\Member\History( $member->acpUrl()->setQueryString( array( 'do' => 'viewDnameHistory' ) ), array( array( 'log_member=? AND log_app=? AND log_type=?', $member->member_id, 'core', 'display_name' ) ) );
|
||||
$table->tableTemplate = array( \IPS\Theme::i()->getTemplate( 'members', 'core', 'global' ), 'nameHistoryTable' );
|
||||
$table->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'members', 'core', 'global' ), 'nameHistoryRows' );
|
||||
$table->sortBy = 'log_date';
|
||||
$table->sortDirection = 'desc';
|
||||
|
||||
$table->parsers = array(
|
||||
'log_data' => function( $val )
|
||||
{
|
||||
return \IPS\DateTime::ts( $value )->localeDate();
|
||||
},
|
||||
return json_decode( $val, TRUE );
|
||||
}
|
||||
);
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'members' )->viewDnameHistory( (string) $table, $member );
|
||||
}
|
||||
|
||||
@@ -1366,7 +1406,7 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->error( 'node_error', '2C114/C', 404, '' );
|
||||
}
|
||||
|
||||
\IPS\Db::i()->delete( 'core_dnames_change', array( 'dname_member_id=?', (int) $member->member_id ) );
|
||||
\IPS\Db::i()->delete( 'core_member_history', array( 'log_member=? AND log_app=? AND log_type=?', $member->member_id, 'core', 'display_name' ) );
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
@@ -1835,28 +1875,43 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Make sure the user confirmed the deletion */
|
||||
\IPS\Request::i()->confirmedDelete();
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'deletiontype', 'continue' );
|
||||
$form->hiddenValues['wasConfirmed'] = 1;
|
||||
$options = array(
|
||||
'keep_name' => 'keep_name',
|
||||
'remove_name' => 'remove_name'
|
||||
);
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'member_deletion_keep_name', 'keep_name', FALSE, array( 'options' => $options ) ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
|
||||
/* If they have content, ask what to do with it */
|
||||
if ( $member->member_posts )
|
||||
{
|
||||
/* Build Form */
|
||||
$form = new \IPS\Helpers\Form( 'deletiontype', 'continue' );
|
||||
$form->hiddenValues['wasConfirmed'] = 1;
|
||||
$options = array(
|
||||
'keep_name' => 'keep_name',
|
||||
'remove_name' => 'remove_name'
|
||||
);
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'member_deletion_keep_name', 'keep_name', FALSE, array( 'options' => $options ) ) );
|
||||
\IPS\Member::loggedIn()->language()->words['keep_name'] = sprintf( \IPS\Member::loggedIn()->language()->get('keep_name'), $member->name );
|
||||
\IPS\Member::loggedIn()->language()->words['member_deletion_keep_name_desc'] = sprintf( \IPS\Member::loggedIn()->language()->get('member_deletion_keep_name_desc'), $member->member_id );
|
||||
|
||||
/* Handle Submissions */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
\IPS\Session::i()->log( 'acplog__members_deleted', array( $member->name => FALSE ) );
|
||||
$member->delete( TRUE, ( $values['member_deletion_keep_name'] == 'keep_name' ) );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal("app=core&module=members&controller=members"), 'deleted' );
|
||||
}
|
||||
|
||||
/* Display Form */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'delete' );
|
||||
\IPS\Output::i()->output = $form;
|
||||
}
|
||||
|
||||
/* Otherwise just do it */
|
||||
else
|
||||
{
|
||||
/* Delete */
|
||||
\IPS\Session::i()->log( 'acplog__members_deleted', array( $member->name => FALSE ) );
|
||||
$member->delete( TRUE, ( $values['member_deletion_keep_name'] == 'keep_name' ) );
|
||||
$member->delete( TRUE, FALSE );
|
||||
|
||||
/* Boink */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal("app=core&module=members&controller=members"), 'deleted' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'member_deletion_title' );
|
||||
\IPS\Output::i()->output = $form;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1901,6 +1956,13 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
catch( \BadMethodCallException $e ) {}
|
||||
}
|
||||
|
||||
/* Invalidate sessions except this one */
|
||||
\IPS\Member::loggedIn()->invalidateSessionsAndLogins( TRUE, \IPS\Session::i()->id );
|
||||
if( isset( \IPS\Request::i()->cookie['login_key'] ) )
|
||||
{
|
||||
\IPS\Member\Device::loadOrCreate( \IPS\Member::loggedIn() )->updateAfterAuthentication( TRUE );
|
||||
}
|
||||
|
||||
/* Log */
|
||||
\IPS\Session::i()->log( 'acplogs__admin_pass_updated' );
|
||||
|
||||
@@ -1938,6 +2000,13 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
/* Invalidate sessions except this one */
|
||||
\IPS\Member::loggedIn()->invalidateSessionsAndLogins( TRUE, \IPS\Session::i()->id );
|
||||
if( isset( \IPS\Request::i()->cookie['login_key'] ) )
|
||||
{
|
||||
\IPS\Member\Device::loadOrCreate( \IPS\Member::loggedIn() )->updateAfterAuthentication( TRUE );
|
||||
}
|
||||
|
||||
/* Log */
|
||||
\IPS\Session::i()->log( 'acplogs__admin_email_updated' );
|
||||
|
||||
@@ -1996,6 +2065,29 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
/* redirect */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=members&controller=members&do=edit&id={$member->member_id}" ), 'saved' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Recount Reputation Count
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeReputation()
|
||||
{
|
||||
/* Check permission */
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'member_edit' );
|
||||
|
||||
/* Load Member */
|
||||
$member = \IPS\Member::load( \IPS\Request::i()->id );
|
||||
|
||||
if( isset( \IPS\Request::i()->type ) and in_array( \IPS\Request::i()->type, array( 'given', 'received' ) ) )
|
||||
{
|
||||
/* Rebuild */
|
||||
$member->removeReputation( \IPS\Request::i()->type );
|
||||
}
|
||||
|
||||
/* redirect */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=members&controller=members&do=edit&id={$member->member_id}" ), 'saved' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Import
|
||||
@@ -2663,7 +2755,7 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
'secondary_group_names' => 'import_secondary_group_name',
|
||||
'member_posts' => 'members_member_posts',
|
||||
'joined' => 'import_joined_date',
|
||||
'ip_address' => 'ip_address',
|
||||
'ip_address' => 'members_ip_address',
|
||||
'timezone' => 'timezone',
|
||||
'last_visit' => 'import_last_visit_date',
|
||||
'last_post' => 'last_post',
|
||||
@@ -3040,4 +3132,46 @@ class _members extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('members_export');
|
||||
\IPS\Output::i()->output = $wizard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Member History
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function history()
|
||||
{
|
||||
/* Check permission */
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'member_history' );
|
||||
|
||||
/* Member */
|
||||
$member = \IPS\Member::load( \IPS\Request::i()->id );
|
||||
|
||||
if ( !$member->member_id )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2C114/N', 404, '' );
|
||||
}
|
||||
|
||||
$title = 'member_account';
|
||||
$link = $member->acpUrl();
|
||||
|
||||
/* Viewer came from commerce customer page */
|
||||
if( \IPS\Application::appIsEnabled( 'nexus' ) AND \IPS\Request::i()->nexus_return )
|
||||
{
|
||||
$title = 'view_account';
|
||||
$link = \IPS\nexus\Customer::load( $member->member_id )->acpUrl();
|
||||
}
|
||||
|
||||
/* History */
|
||||
$history = new \IPS\Member\History( $member->acpUrl()->setQueryString( 'do', 'history' ), array( array( 'log_member=?', $member->member_id ) ) );
|
||||
|
||||
/* Output */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('member_history_member', FALSE, array( 'sprintf' => array( $member->name ) ) );
|
||||
\IPS\Output::i()->output = $history;
|
||||
|
||||
\IPS\Output::i()->sidebar['actions'][] = array(
|
||||
'icon' => 'arrow-left',
|
||||
'title' => $title,
|
||||
'link' => $link
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief promotions
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 04 Apr 2017
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\members;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* promotions
|
||||
*/
|
||||
class _promotions extends \IPS\Node\Controller
|
||||
{
|
||||
/**
|
||||
* Node Class
|
||||
*/
|
||||
protected $nodeClass = '\IPS\Member\GroupPromotion';
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'promotions_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function manage()
|
||||
{
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('forms')->blurb( \IPS\Application::appIsEnabled('nexus') ? 'group_promotion_blurb_commerce' : 'group_promotion_blurb' );
|
||||
parent::manage();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Recount and Reset Tools
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 24 Oct 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\members;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief ban
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 12 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\membersettings;
|
||||
@@ -51,6 +50,7 @@ class _ban extends \IPS\Dispatcher\Controller
|
||||
|
||||
$table->include = array( 'ban_type', 'ban_content', 'ban_reason', 'ban_date' );
|
||||
$table->mainColumn = 'ban_content';
|
||||
$table->rowClasses = array( 'ban_reason' => array( 'ipsTable_wrap' ) );
|
||||
|
||||
$table->sortBy = $table->sortBy ?: 'ban_date';
|
||||
$table->sortDirection = $table->sortDirection ?: 'asc';
|
||||
@@ -109,8 +109,9 @@ class _ban extends \IPS\Dispatcher\Controller
|
||||
};
|
||||
|
||||
/* Specify the buttons */
|
||||
$table->rootButtons = array(
|
||||
\IPS\Output::i()->sidebar['actions'] = array(
|
||||
'add' => array(
|
||||
'primary' => TRUE,
|
||||
'icon' => 'plus',
|
||||
'title' => 'ban_filter_add',
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('ban_filter_add') ),
|
||||
@@ -119,9 +120,8 @@ class _ban extends \IPS\Dispatcher\Controller
|
||||
);
|
||||
|
||||
/* Display */
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_membersettings_ban');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'menu__core_membersettings_ban', (string) $table );
|
||||
\IPS\Output::i()->output = (string) $table;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Notification Settings
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 23 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\membersettings;
|
||||
@@ -53,7 +52,7 @@ class _notifications extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
if ( mb_substr( $key, 0, -7 ) === 'new_likes' )
|
||||
{
|
||||
if ( \IPS\Settings::i()->reputation_point_types === 'like' )
|
||||
if ( \IPS\Content\Reaction::isLikeMode() )
|
||||
{
|
||||
return 'notifications__new_likes_like';
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Profile Fields and Settings
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 09 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\membersettings;
|
||||
@@ -55,65 +54,13 @@ class _profiles extends \IPS\Node\Controller
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'membersettings', 'profiles_manage' ) )
|
||||
{
|
||||
$tabs['settings'] = 'profile_settings';
|
||||
$tabs['completion'] = 'profile_completion';
|
||||
}
|
||||
|
||||
/* Get contents */
|
||||
if ( $activeTab == 'fields' )
|
||||
{
|
||||
parent::manage();
|
||||
$activeTabContents = \IPS\Output::i()->output;
|
||||
}
|
||||
else
|
||||
$method = '_tab' . ucwords( $activeTab );
|
||||
if ( method_exists( $this, $method ) )
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'profiles_manage' );
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
|
||||
$form->addHeader( 'photos' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'allow_gravatars', \IPS\Settings::i()->allow_gravatars ) );
|
||||
$form->addHeader( 'usernames' );
|
||||
$form->add( new \IPS\Helpers\Form\Custom( 'user_name_length', array( \IPS\Settings::i()->min_user_name_length, \IPS\Settings::i()->max_user_name_length ), FALSE, array(
|
||||
'getHtml' => function( $field ) {
|
||||
return \IPS\Theme::i()->getTemplate('members')->usernameLengthSetting( $field->name, $field->value );
|
||||
}
|
||||
),
|
||||
function( $val )
|
||||
{
|
||||
if ( $val[0] < 1 )
|
||||
{
|
||||
throw new \DomainException('user_name_length_too_low');
|
||||
}
|
||||
if ( $val[1] > 255 )
|
||||
{
|
||||
throw new \DomainException('user_name_length_too_high');
|
||||
}
|
||||
if ( $val[0] > $val[1] )
|
||||
{
|
||||
throw new \DomainException('user_name_length_no_match');
|
||||
}
|
||||
} ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'username_characters', \IPS\Settings::i()->username_characters, FALSE, array( 'max' => 255 ) ) );
|
||||
$form->addHeader( 'signatures' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'signatures_enabled', \IPS\Settings::i()->signatures_enabled ) );
|
||||
$form->addHeader( 'statuses_profile_comments' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'profile_comments', \IPS\Settings::i()->profile_comments, FALSE, array( 'togglesOn' => array( 'profile_comment_approval' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'profile_comment_approval', \IPS\Settings::i()->profile_comment_approval, FALSE, array(), NULL, NULL, NULL, 'profile_comment_approval' ) );
|
||||
$form->addHeader( 'profile_settings_birthdays' );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'profile_birthday_type', \IPS\Settings::i()->profile_birthday_type, TRUE, array(
|
||||
'options' => array( 'public' => 'profile_birthday_type_public', 'private' => 'profile_birthday_type_private', 'none' => 'profile_birthday_type_none' )
|
||||
), NULL, NULL, NULL, 'profile_birthday_type' ) );
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$values['min_user_name_length'] = $values['user_name_length'][0];
|
||||
$values['max_user_name_length'] = $values['user_name_length'][1];
|
||||
unset( $values['user_name_length'] );
|
||||
|
||||
$form->saveAsSettings( $values );
|
||||
\IPS\Session::i()->log( 'acplog__profile_settings' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=profiles&tab=settings' ), 'saved' );
|
||||
}
|
||||
|
||||
$activeTabContents = (string) $form;
|
||||
$activeTabContents = (string) $this->$method();
|
||||
}
|
||||
|
||||
/* Display */
|
||||
@@ -127,4 +74,270 @@ class _profiles extends \IPS\Node\Controller
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->tabs( $tabs, $activeTab, $activeTabContents, \IPS\Http\Url::internal( "app=core&module=membersettings&controller=profiles" ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fields Tab
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _tabFields()
|
||||
{
|
||||
parent::manage();
|
||||
return \IPS\Output::i()->output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings Tab
|
||||
*
|
||||
* @return \IPS\Helpers\Form
|
||||
*/
|
||||
protected function _tabSettings()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'profiles_manage' );
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
|
||||
$form->addHeader( 'photos' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'allow_gravatars', \IPS\Settings::i()->allow_gravatars ) );
|
||||
|
||||
if( \IPS\Image::canWriteText() )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'letter_photos', \IPS\Settings::i()->letter_photos, FALSE, array( 'options' => array( 'default' => 'letterphoto_default', 'letters' => 'letterphoto_letters' ) ) ) );
|
||||
}
|
||||
|
||||
$form->addHeader( 'usernames' );
|
||||
$form->add( new \IPS\Helpers\Form\Custom( 'user_name_length', array( \IPS\Settings::i()->min_user_name_length, \IPS\Settings::i()->max_user_name_length ), FALSE, array(
|
||||
'getHtml' => function( $field ) {
|
||||
return \IPS\Theme::i()->getTemplate('members')->usernameLengthSetting( $field->name, $field->value );
|
||||
}
|
||||
),
|
||||
function( $val )
|
||||
{
|
||||
if ( $val[0] < 1 )
|
||||
{
|
||||
throw new \DomainException('user_name_length_too_low');
|
||||
}
|
||||
if ( $val[1] > 255 )
|
||||
{
|
||||
throw new \DomainException('user_name_length_too_high');
|
||||
}
|
||||
if ( $val[0] > $val[1] )
|
||||
{
|
||||
throw new \DomainException('user_name_length_no_match');
|
||||
}
|
||||
} ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'username_characters', \IPS\Settings::i()->username_characters, FALSE, array( 'max' => 255 ) ) );
|
||||
$form->addHeader( 'signatures' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'signatures_enabled', \IPS\Settings::i()->signatures_enabled ) );
|
||||
$form->addHeader( 'statuses_profile_comments' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'profile_comments', \IPS\Settings::i()->profile_comments, FALSE, array( 'togglesOn' => array( 'profile_comment_approval' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'profile_comment_approval', \IPS\Settings::i()->profile_comment_approval, FALSE, array(), NULL, NULL, NULL, 'profile_comment_approval' ) );
|
||||
$form->addHeader( 'profile_settings_birthdays' );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'profile_birthday_type', \IPS\Settings::i()->profile_birthday_type, TRUE, array(
|
||||
'options' => array( 'public' => 'profile_birthday_type_public', 'private' => 'profile_birthday_type_private', 'none' => 'profile_birthday_type_none' )
|
||||
), NULL, NULL, NULL, 'profile_birthday_type' ) );
|
||||
|
||||
if( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'profiles', 'member_history_prune' ) )
|
||||
{
|
||||
$form->addHeader( 'profile_member_history' );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'prune_member_history', \IPS\Settings::i()->prune_member_history, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), \IPS\Member::loggedIn()->language()->addToStack('days'), 'prune_member_history' ) );
|
||||
}
|
||||
|
||||
$form->addHeader( 'profile_settings_ignore' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'ignore_system_on', \IPS\Settings::i()->ignore_system_on, FALSE, array(), NULL, NULL, NULL, 'ignore_system_on' ) );
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$values['min_user_name_length'] = $values['user_name_length'][0];
|
||||
$values['max_user_name_length'] = $values['user_name_length'][1];
|
||||
unset( $values['user_name_length'] );
|
||||
|
||||
$form->saveAsSettings( $values );
|
||||
\IPS\Session::i()->log( 'acplog__profile_settings' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=profiles&tab=settings' ), 'saved' );
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Completion Tab
|
||||
*
|
||||
* @return \IPS\Helpers\Form
|
||||
*/
|
||||
protected function _tabCompletion()
|
||||
{
|
||||
/* Is the quick register function disabled? */
|
||||
if ( ! \IPS\Settings::i()->quick_register )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'members' )->quickRegisterDisabled();
|
||||
}
|
||||
|
||||
$table = new \IPS\Helpers\Table\Db( 'core_profile_steps', \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=profiles&tab=completion' ) );
|
||||
$table->langPrefix = 'profile_acp_table_';
|
||||
$table->include = array( 'step_extension', 'step_required' );
|
||||
$table->rootButtons = array(
|
||||
array(
|
||||
'icon' => 'plus',
|
||||
'title' => 'add',
|
||||
'link' => \IPS\Http\Url::internal( "app=core&module=membersettings&controller=profiles&do=step" )
|
||||
)
|
||||
);
|
||||
$table->parsers = array(
|
||||
'step_extension' => function( $val, $row )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'members' )->profileCompleteTitle( $row );
|
||||
},
|
||||
'step_required' => function( $val ) {
|
||||
if ( $val )
|
||||
{
|
||||
return '✓';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '✗';
|
||||
}
|
||||
}
|
||||
);
|
||||
$table->rowButtons = function( $row )
|
||||
{
|
||||
return array(
|
||||
'edit' => array(
|
||||
'title' => 'edit',
|
||||
'icon' => 'pencil',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=profiles&do=step&id=' . $row['step_id'] )
|
||||
),
|
||||
'delete' => array(
|
||||
'title' => 'delete',
|
||||
'icon' => 'times-circle',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=profiles&do=deleteStep&id=' . $row['step_id'] ),
|
||||
'data' => array( 'delete' => '' )
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
return \IPS\Theme::i()->getTemplate( 'members' )->profileCompleteBlurb() . $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable quick registration
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function enableQuickRegister()
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => 1 ), array( 'conf_key=?', 'quick_register' ) );
|
||||
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=profiles&tab=completion' ), 'profile_complete_quick_register_off_enabled' );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Step Form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function step()
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
if ( isset( \IPS\Request::i()->id ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$step = \IPS\Member\ProfileStep::load( \IPS\Request::i()->id );
|
||||
}
|
||||
catch( \OutOFRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2C360/1', 404, '' );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$step = new \IPS\Member\ProfileStep;
|
||||
}
|
||||
|
||||
$step->form( $form );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$values = $step->formatFormValues( $values );
|
||||
|
||||
$step->extension = \IPS\Member\ProfileStep::findExtensionFromAction( $values['step_completion_act'] );
|
||||
if ( isset( $values['step_required'] ) )
|
||||
{
|
||||
$step->required = $values['step_required'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$step->required = FALSE;
|
||||
}
|
||||
$step->completion_act = $values['step_completion_act'];
|
||||
$step->subcompletion_act = $values['step_subcompletion_act'];
|
||||
$step->save();
|
||||
|
||||
$step->postSaveForm( $values );
|
||||
|
||||
if ( method_exists( $step->extension, 'postAcpSave' ) )
|
||||
{
|
||||
$step->extension->postAcpSave( $step, $values );
|
||||
}
|
||||
|
||||
\IPS\Member::updateAllMembers( array( "members_bitoptions2 = members_bitoptions2 & ~" . \IPS\Member::$bitOptions['members_bitoptions']['members_bitoptions2']['profile_completed'] ) );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=membersettings&controller=profiles&tab=completion" ), 'saved' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=profiles&tab=completion' ), \IPS\Member::loggedIn()->language()->addToStack('profile_completion') );
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'profile_completion' );
|
||||
\IPS\Output::i()->output = $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Step
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteStep()
|
||||
{
|
||||
try
|
||||
{
|
||||
$step = \IPS\Member\ProfileStep::load( \IPS\Request::i()->id );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2C360/2', 404, '' );
|
||||
}
|
||||
|
||||
/* Make sure the user confirmed the deletion */
|
||||
\IPS\Request::i()->confirmedDelete();
|
||||
|
||||
$step->delete();
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=membersettings&controller=profiles&tab=completion" ), 'deleted' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Root Buttons
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function _getRootButtons()
|
||||
{
|
||||
$nodeClass = $this->nodeClass;
|
||||
|
||||
if ( $nodeClass::canAddRoot() )
|
||||
{
|
||||
$add = array(
|
||||
'icon' => 'plus',
|
||||
'title' => 'add',
|
||||
'link' => $this->url->setQueryString( 'do', 'form' ),
|
||||
'data' => ( $nodeClass::$modalForms ? array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('add') ) : array() )
|
||||
);
|
||||
|
||||
|
||||
return array( 'add' => $add );
|
||||
}
|
||||
return array();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief ranks
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 10 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\membersettings;
|
||||
@@ -74,13 +73,14 @@ class _ranks extends \IPS\Dispatcher\Controller
|
||||
/* Root Buttons */
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'membersettings', 'ranks_manage' ) )
|
||||
{
|
||||
$table->rootButtons = array(
|
||||
'add' => array(
|
||||
'icon' => 'plus',
|
||||
'title' => 'member_ranks_add',
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('member_ranks_add') ),
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=ranks&do=form' ),
|
||||
)
|
||||
\IPS\Output::i()->sidebar['actions'] = array(
|
||||
'add' => array(
|
||||
'primary' => TRUE,
|
||||
'icon' => 'plus',
|
||||
'title' => 'member_ranks_add',
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('member_ranks_add') ),
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=ranks&do=form' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ class _ranks extends \IPS\Dispatcher\Controller
|
||||
/* Display */
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('ranks');
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global' )->block( 'ranks', (string) $table );
|
||||
\IPS\Output::i()->output .= (string) $table;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Registration
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 18 Jul 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\membersettings;
|
||||
@@ -41,26 +40,21 @@ class _registration extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
|
||||
$form->addHeader('registration');
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'allow_reg', \IPS\Settings::i()->allow_reg, FALSE, array( 'togglesOn' => array( 'new_reg_notify', 'reg_auth_type', 'form_header_coppa', 'use_coppa' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'new_reg_notify', \IPS\Settings::i()->new_reg_notify, FALSE, array(), NULL, NULL, NULL, 'new_reg_notify' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'reg_auth_type', \IPS\Settings::i()->reg_auth_type, TRUE, array(
|
||||
'options' => array( 'user' => 'reg_auth_type_user', 'admin' => 'reg_auth_type_admin', 'admin_user' => 'reg_auth_type_admin_user', 'none' => 'reg_auth_type_none' ),
|
||||
'toggles' => array( 'user' => array( 'validate_day_prune' ), 'admin_user' => array( 'validate_day_prune' ) )
|
||||
), NULL, NULL, NULL, 'reg_auth_type' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'validate_day_prune', \IPS\Settings::i()->validate_day_prune, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), \IPS\Member::loggedIn()->language()->addToStack('days'), 'validate_day_prune' ) );
|
||||
|
||||
$form->addHeader('age_requirements');
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'minimum_age', \IPS\Settings::i()->minimum_age, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'any_age' ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'use_coppa', \IPS\Settings::i()->use_coppa, FALSE, array( 'togglesOn' => array( 'coppa_fax', 'coppa_address' ) ), NULL, NULL, NULL, 'use_coppa' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Tel( 'coppa_fax', \IPS\Settings::i()->coppa_fax, FALSE, array(), NULL, NULL, NULL, 'coppa_fax' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Address( 'coppa_address', \IPS\GeoLocation::buildFromJson( \IPS\Settings::i()->coppa_address ), FALSE, array(), NULL, NULL, NULL, 'coppa_address' ) );
|
||||
|
||||
if ( $form->values() )
|
||||
$form = $this->getSettingsForm();
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$form->saveAsSettings();
|
||||
if ( isset( $values['allowed_reg_email'] ) and is_array( $values['allowed_reg_email'] ) )
|
||||
{
|
||||
$values['allowed_reg_email'] = implode( ',', $values['allowed_reg_email'] );
|
||||
}
|
||||
|
||||
if ( $values['use_coppa'] OR $values['minimum_age'] )
|
||||
{
|
||||
$values['quick_register'] = 0;
|
||||
}
|
||||
|
||||
$form->saveAsSettings( $values );
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
@@ -71,4 +65,33 @@ class _registration extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('membersettings_registration_title');
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global' )->block( 'membersettings_registration_title', $form );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the settings form
|
||||
*
|
||||
* @return \IPS\Helpers\Form
|
||||
*/
|
||||
protected function getSettingsForm()
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
|
||||
$form->addHeader('registration');
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'allow_reg', \IPS\Settings::i()->allow_reg, FALSE, array( 'togglesOn' => array( 'quick_register', 'new_reg_notify', 'reg_auth_type', 'form_header_coppa', 'use_coppa' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'quick_register', \IPS\Settings::i()->quick_register, FALSE, array(), NULL, NULL, NULL, 'quick_register' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'new_reg_notify', \IPS\Settings::i()->new_reg_notify, FALSE, array(), NULL, NULL, NULL, 'new_reg_notify' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'reg_auth_type', \IPS\Settings::i()->reg_auth_type, TRUE, array(
|
||||
'options' => array( 'user' => 'reg_auth_type_user', 'admin' => 'reg_auth_type_admin', 'admin_user' => 'reg_auth_type_admin_user', 'none' => 'reg_auth_type_none' ),
|
||||
'toggles' => array( 'user' => array( 'validate_day_prune' ), 'admin_user' => array( 'validate_day_prune' ) )
|
||||
), NULL, NULL, NULL, 'reg_auth_type' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'validate_day_prune', \IPS\Settings::i()->validate_day_prune, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), \IPS\Member::loggedIn()->language()->addToStack('days'), 'validate_day_prune' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Stack( 'allowed_reg_email', explode( ',', \IPS\Settings::i()->allowed_reg_email ), FALSE, array(), NULL, NULL, NULL ) );
|
||||
|
||||
$form->addHeader('age_requirements');
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'minimum_age', \IPS\Settings::i()->minimum_age, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'any_age', 'unlimitedToggles' => array( 'quick_register' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'use_coppa', \IPS\Settings::i()->use_coppa, FALSE, array( 'togglesOn' => array( 'coppa_fax', 'coppa_address' ), 'togglesOff' => array( 'quick_register' ) ), NULL, NULL, NULL, 'use_coppa' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Tel( 'coppa_fax', \IPS\Settings::i()->coppa_fax, FALSE, array(), NULL, NULL, NULL, 'coppa_fax' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Address( 'coppa_address', \IPS\GeoLocation::buildFromJson( \IPS\Settings::i()->coppa_address ), FALSE, array(), NULL, NULL, NULL, 'coppa_address' ) );
|
||||
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Reputation
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 27 Mar 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\membersettings;
|
||||
@@ -21,8 +20,18 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
/**
|
||||
* reputation
|
||||
*/
|
||||
class _reputation extends \IPS\Dispatcher\Controller
|
||||
class _reputation extends \IPS\Node\Controller
|
||||
{
|
||||
/**
|
||||
* Node Class
|
||||
*/
|
||||
protected $nodeClass = '\IPS\Content\Reaction';
|
||||
|
||||
/**
|
||||
* Title can contain HTML?
|
||||
*/
|
||||
public $_titleHtml = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
@@ -41,7 +50,7 @@ class _reputation extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('reputation');
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('reputation_title');
|
||||
|
||||
/* Init */
|
||||
$activeTab = \IPS\Request::i()->tab ?: NULL;
|
||||
@@ -52,6 +61,17 @@ class _reputation extends \IPS\Dispatcher\Controller
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'membersettings', 'reps_settings' ) )
|
||||
{
|
||||
$tabs['settings'] = 'reputation_settings';
|
||||
}
|
||||
|
||||
/* Reactions */
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'membersettings', 'reactions_manage' ) )
|
||||
{
|
||||
$tabs['reactions'] = 'reactions';
|
||||
}
|
||||
|
||||
/* Leaderboard */
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'membersettings', 'reps_settings' ) )
|
||||
{
|
||||
$tabs['leaderboard'] = 'reputation_leaderboard';
|
||||
}
|
||||
|
||||
@@ -73,7 +93,13 @@ class _reputation extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Do it */
|
||||
if ( $activeTab === 'settings' )
|
||||
if ( $activeTab === 'reactions' )
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'reactions_manage' );
|
||||
parent::manage();
|
||||
$activeTabContents = \IPS\Theme::i()->getTemplate( 'global' )->paddedBlock( \IPS\Output::i()->output );
|
||||
}
|
||||
else if ( $activeTab === 'settings' )
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'reps_settings' );
|
||||
|
||||
@@ -119,26 +145,12 @@ class _reputation extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Build Form */
|
||||
$form = new \IPS\Helpers\Form();
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'reputation_enabled', \IPS\Settings::i()->reputation_enabled, FALSE, array( 'togglesOn' => array( 'reputation_point_types', 'reputation_protected_groups', 'reputation_can_self_vote', 'reputation_highlight', 'reputation_show_profile' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'reputation_point_types', \IPS\Settings::i()->reputation_point_types, FALSE, array(
|
||||
'options' => array(
|
||||
'like' => \IPS\Theme::i()->getTemplate( 'settings' )->reputationLike( $blurb ),
|
||||
'both' => \IPS\Theme::i()->getTemplate( 'settings' )->reputationNormal( TRUE, TRUE ),
|
||||
'positive' => \IPS\Theme::i()->getTemplate( 'settings' )->reputationNormal( TRUE, FALSE ),
|
||||
'negative' => \IPS\Theme::i()->getTemplate( 'settings' )->reputationNormal( FALSE, TRUE ),
|
||||
),
|
||||
'toggles' => array(
|
||||
'both' => array( 'reputation_show_content' ),
|
||||
'positive' => array( 'reputation_show_content' ),
|
||||
'negative' => array( 'reputation_show_content' )
|
||||
),
|
||||
'parse' => 'raw'
|
||||
), NULL, NULL, NULL, 'reputation_point_types' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'reputation_show_content', \IPS\Settings::i()->reputation_show_content, FALSE, array(), NULL, NULL, NULL, 'reputation_show_content' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'reputation_enabled', \IPS\Settings::i()->reputation_enabled, FALSE, array( 'togglesOn' => array( 'reputation_point_types', 'reputation_protected_groups', 'reputation_can_self_vote', 'reputation_highlight', 'reputation_show_profile', 'overall_reaction_count' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'reputation_protected_groups', explode( ',', \IPS\Settings::i()->reputation_protected_groups ), FALSE, array( 'options' => \IPS\Member\Group::groups( TRUE, FALSE ), 'parse' => 'normal', 'multiple' => TRUE ), NULL, NULL, NULL, 'reputation_protected_groups' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'reputation_can_self_vote', \IPS\Settings::i()->reputation_can_self_vote, FALSE, array(), NULL, NULL, NULL, 'reputation_can_self_vote' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'reputation_highlight', \IPS\Settings::i()->reputation_highlight, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('reputation_highlight_prefix'), \IPS\Member::loggedIn()->language()->addToStack('reputation_highlight_suffix'), 'reputation_highlight' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'reputation_show_profile', \IPS\Settings::i()->reputation_show_profile, FALSE, array(), NULL, NULL, NULL, 'reputation_show_profile' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'reaction_count_display', \IPS\Settings::i()->reaction_count_display, FALSE, array( 'options' => array( 'individual' => 'individual_reactions', 'count' => 'overall_reaction_count' ) ) ) );
|
||||
|
||||
/* Save */
|
||||
if ( $form->saveAsSettings() )
|
||||
@@ -156,31 +168,31 @@ class _reputation extends \IPS\Dispatcher\Controller
|
||||
else if ( $activeTab === 'leaderboard' )
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'reps_settings' );
|
||||
|
||||
/* Get available filters */
|
||||
$topMemberFilters = \IPS\Member::topMembersOptions();
|
||||
|
||||
/* Build Form */
|
||||
$form = new \IPS\Helpers\Form();
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'reputation_leaderboard_on', \IPS\Settings::i()->reputation_leaderboard_on, FALSE, array( 'togglesOn' => array( 'reputation_timezone', 'reputation_show_days_won_trophy', 'reputation_leaderboard_default_tab', 'reputation_max_members' ) ), NULL, NULL, NULL, 'reputation_leaderboard_on' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'reputation_show_days_won_trophy', \IPS\Settings::i()->reputation_show_days_won_trophy, FALSE, array( 'togglesOn' => array() ), NULL, NULL, NULL, 'reputation_show_days_won_trophy' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'reputation_leaderboard_on', \IPS\Settings::i()->reputation_leaderboard_on, FALSE, array( 'togglesOn' => array( 'reputation_leaderboard_default_tab', 'form_header_leaderboard_tabs_leaderboard', 'reputation_show_days_won_trophy', 'reputation_timezone', 'form_header_leaderboard_tabs_members', 'reputation_top_members_overview', 'reputation_overview_max_members', 'reputation_top_members_filters', 'reputation_max_members' ) ), NULL, NULL, NULL, 'reputation_leaderboard_on' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'reputation_leaderboard_default_tab', \IPS\Settings::i()->reputation_leaderboard_default_tab, FALSE, array( 'options' => array( 'leaderboard' => 'leaderboard_tabs_leaderboard', 'history' => 'leaderboard_tabs_history', 'members' => 'leaderboard_tabs_members' ) ), NULL, NULL, NULL, 'reputation_leaderboard_default_tab' ) );
|
||||
$form->addHeader('leaderboard_tabs_leaderboard');
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'reputation_show_days_won_trophy', \IPS\Settings::i()->reputation_show_days_won_trophy, FALSE, array( 'togglesOn' => array() ), NULL, NULL, NULL, 'reputation_show_days_won_trophy' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Timezone( 'reputation_timezone', \IPS\Settings::i()->reputation_timezone, FALSE, array(), NULL, NULL, NULL, 'reputation_timezone' ) );
|
||||
$form->addHeader('leaderboard_tabs_members');
|
||||
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'reputation_top_members_overview', explode( ',', \IPS\Settings::i()->reputation_top_members_overview ), FALSE, array( 'options' => $topMemberFilters ), NULL, NULL, NULL, 'reputation_max_members' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'reputation_overview_max_members', \IPS\Settings::i()->reputation_overview_max_members, FALSE, array( 'min' => 3, 'max' => 100 ), NULL, NULL, NULL, 'reputation_overview_max_members' ) );
|
||||
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'reputation_top_members_filters', \IPS\Settings::i()->reputation_top_members_filters == '*' ? array_keys( $topMemberFilters ) : explode( ',', \IPS\Settings::i()->reputation_top_members_filters ), FALSE, array( 'options' => $topMemberFilters ), NULL, NULL, NULL, 'reputation_top_members_filters' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'reputation_max_members', \IPS\Settings::i()->reputation_max_members, FALSE, array( 'min' => 3, 'max' => '100' ), NULL, NULL, NULL, 'reputation_max_members' ) );
|
||||
|
||||
$timezones = array();
|
||||
foreach ( \DateTimeZone::listIdentifiers() as $tz )
|
||||
{
|
||||
if ( $pos = mb_strpos( $tz, '/' ) )
|
||||
{
|
||||
$timezones[ 'timezone__' . mb_substr( $tz, 0, $pos ) ][ $tz ] = 'timezone__' . $tz;
|
||||
}
|
||||
else
|
||||
{
|
||||
$timezones[ $tz ] = 'timezone__' . $tz;
|
||||
}
|
||||
}
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'reputation_timezone', \IPS\Settings::i()->reputation_timezone, FALSE, array( 'options' => $timezones, 'sort' => TRUE ), NULL, NULL, NULL, 'reputation_timezone' ) );
|
||||
|
||||
/* Save */
|
||||
if ( $form->saveAsSettings() )
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
/* Save */
|
||||
$values['reputation_top_members_overview'] = implode( ',', $values['reputation_top_members_overview'] );
|
||||
$values['reputation_top_members_filters'] = $values['reputation_top_members_filters'] == array_keys( $topMemberFilters ) ? '*' : implode( ',', $values['reputation_top_members_filters'] );
|
||||
$form->saveAsSettings( $values );
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
@@ -227,7 +239,7 @@ class _reputation extends \IPS\Dispatcher\Controller
|
||||
'add' => array(
|
||||
'title' => 'add',
|
||||
'icon' => 'plus',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=reputation&do=form' ),
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=reputation&do=levelForm' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('add') )
|
||||
),
|
||||
);
|
||||
@@ -237,21 +249,23 @@ class _reputation extends \IPS\Dispatcher\Controller
|
||||
'edit' => array(
|
||||
'title' => 'edit',
|
||||
'icon' => 'pencil',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=reputation&do=form&id=' ) . $row['level_id'],
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=reputation&do=levelForm&id=' ) . $row['level_id'],
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('edit') )
|
||||
),
|
||||
'delete' => array(
|
||||
'title' => 'delete',
|
||||
'icon' => 'times-circle',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=reputation&do=delete&id=' ) . $row['level_id'],
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=reputation&do=deleteLevel&id=' ) . $row['level_id'],
|
||||
'data' => array( 'delete' => '' )
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
/* Display */
|
||||
$activeTabContents = \IPS\Theme::i()->getTemplate( 'forms' )->blurb( 'reputation_levels_blurb', TRUE, TRUE ) . (string) $table;
|
||||
$activeTabContents = (string) $table;
|
||||
}
|
||||
|
||||
$activeTabContents = \IPS\Theme::i()->getTemplate( 'forms' )->blurb( 'rep_' . $activeTab . '_blurb', TRUE, TRUE ) . $activeTabContents;
|
||||
|
||||
/* Display */
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
@@ -269,7 +283,7 @@ class _reputation extends \IPS\Dispatcher\Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function form()
|
||||
public function levelForm()
|
||||
{
|
||||
$current = NULL;
|
||||
if ( \IPS\Request::i()->id )
|
||||
@@ -320,7 +334,7 @@ class _reputation extends \IPS\Dispatcher\Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function delete()
|
||||
public function deleteLevel()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'reps_delete' );
|
||||
|
||||
@@ -364,4 +378,114 @@ class _reputation extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=reputation&tab=leaderboard' ), 'reputation_leaderboard_rebuilding' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to execute after nodes are reordered. Do nothing by default but plugins can extend.
|
||||
*
|
||||
* @param array $order The new ordering that was saved
|
||||
* @return void
|
||||
*/
|
||||
protected function _afterReorder( $order )
|
||||
{
|
||||
unset( \IPS\Data\Store::i()->reactions );
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect after save
|
||||
*
|
||||
* @param \IPS\Node\Model $old A clone of the node as it was before or NULL if this is a creation
|
||||
* @param \IPS\Node\Model $new The node now
|
||||
* @param string $lastUsedTab The tab last used in the form
|
||||
* @return void
|
||||
*/
|
||||
protected function _afterSave( \IPS\Node\Model $old = NULL, \IPS\Node\Model $new, $lastUsedTab = FALSE )
|
||||
{
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->json( array() );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( isset( \IPS\Request::i()->save_and_reload ) )
|
||||
{
|
||||
$buttons = $new->getButtons( $this->url, !( $new instanceof $this->nodeClass ) );
|
||||
|
||||
\IPS\Output::i()->redirect( ( $lastUsedTab ? $buttons['edit']['link']->setQueryString('activeTab', $lastUsedTab ) : $buttons['edit']['link'] ), 'saved' );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( $this->url->setQueryString( array( 'root' => ( $new->parent() ? $new->parent()->_id : '' ), 'tab' => 'reactions' ) ), 'saved' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function delete()
|
||||
{
|
||||
/* Get node */
|
||||
$nodeClass = $this->nodeClass;
|
||||
if ( \IPS\Request::i()->subnode )
|
||||
{
|
||||
$nodeClass = $nodeClass::$subnodeClass;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$node = call_user_func( "{$nodeClass}::load", \IPS\Request::i()->id );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2S101/J', 404, '' );
|
||||
}
|
||||
|
||||
/* Permission check */
|
||||
if( !$node->canDelete() )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_noperm_delete', '2S101/H', 403, '' );
|
||||
}
|
||||
|
||||
/* Do we have any children or content? */
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'existing_reactions', NULL, TRUE, array( 'options' => array( 'change' => 'change_new_reaction', 'delete' => 'delete' ), 'toggles' => array( 'change' => array( 'new_reaction' ) ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'new_reaction', NULL, TRUE, array( 'class' => 'IPS\Content\Reaction', 'permissionCheck' => function( $row ) use ( $node ) {
|
||||
if ( $row->_id == $node->_id )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
} ), NULL, NULL, NULL, 'new_reaction' ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
if ( $values['existing_reactions'] == 'change' AND array_key_exists( 'new_reaction', $values ) )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_reputation_index', array( 'reaction' => $values['new_reaction']->_id ), array( "reaction=?", $node->_id ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Db::i()->delete( 'core_reputation_index', array( "reaction=?", $node->_id ) );
|
||||
}
|
||||
|
||||
/* Delete it */
|
||||
\IPS\Session::i()->log( 'acplog__node_deleted', array( $this->title => TRUE, $node->titleForLog() => FALSE ) );
|
||||
$node->delete();
|
||||
|
||||
/* Boink */
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->json( "OK" );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( $this->url->setQueryString( array( 'root' => ( $node->parent() ? $node->parent()->_id : '' ) ) ), 'deleted' );
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = $form;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Spam Prevention Settings
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 18 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\membersettings;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Warnings
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 23 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\membersettings;
|
||||
|
||||
+15
-9
@@ -1,15 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Messenger Stats
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 3 June 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\stats;
|
||||
namespace IPS\core\modules\admin\messengerstats;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
@@ -33,13 +32,20 @@ class _pmstats extends \IPS\Dispatcher\Controller
|
||||
/* Check permission */
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'messages_manage', 'core', 'members' );
|
||||
|
||||
$chart = new \IPS\Helpers\Chart\Dynamic( \IPS\Http\Url::internal( 'app=core&module=stats&controller=pmstats' ), 'core_message_posts', 'msg_date', '', array( 'isStacked' => TRUE ) );
|
||||
$chart = new \IPS\Helpers\Chart\Database( \IPS\Http\Url::internal( 'app=core&module=messengerstats&controller=pmstats' ), 'core_message_posts', 'msg_date', '', array(
|
||||
'isStacked' => TRUE,
|
||||
'backgroundColor' => '#ffffff',
|
||||
'colors' => array( '#10967e', '#ea7963' ),
|
||||
'hAxis' => array( 'gridlines' => array( 'color' => '#f5f5f5' ) ),
|
||||
'lineWidth' => 1,
|
||||
'areaOpacity' => 0.4
|
||||
) );
|
||||
$chart->addSeries( \IPS\Member::loggedIn()->language()->addToStack('new_conversations'), 'number', 'SUM(msg_is_first_post)' );
|
||||
$chart->addSeries( \IPS\Member::loggedIn()->language()->addToStack('mt_replies'), 'number', '( COUNT(*) - SUM(msg_is_first_post) )' );
|
||||
$chart->title = \IPS\Member::loggedIn()->language()->addToStack('stats_messages_title');
|
||||
$chart->availableTypes = array( 'LineChart', 'ColumnChart', 'BarChart' );
|
||||
$chart->availableTypes = array( 'AreaChart', 'ColumnChart', 'BarChart' );
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_stats_pmstats');
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_messengerstats_pmstats');
|
||||
\IPS\Output::i()->output = (string) $chart;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief ACP Dashboard
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 2 July 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\overview;
|
||||
@@ -201,11 +200,9 @@ class _dashboard extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Get new core update available data */
|
||||
$update = \IPS\Application::load( 'core' )->availableUpgrade( TRUE );
|
||||
|
||||
/* Don't show the ACP header bar */
|
||||
\IPS\Output::i()->hiddenElements[] = 'acpHeader';
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('dashboard');
|
||||
\IPS\Output::i()->customHeader = \IPS\Theme::i()->getTemplate( 'dashboard' )->dashboardHeader( $info, $blocks );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'dashboard' )->dashboard( $update, $toShow, $blocks, $info, $bulletins, $warnings );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief File Settings
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 06 May 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\overview;
|
||||
@@ -563,6 +562,11 @@ class _files extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$key = mb_substr( $f, 0, -4 );
|
||||
|
||||
if ( \IPS\CIC and $key === 'FileSystem' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$handlers[ $key ] = 'filehandler__' . $key;
|
||||
|
||||
$class = 'IPS\File\\' . $key;
|
||||
@@ -598,7 +602,7 @@ class _files extends \IPS\Dispatcher\Controller
|
||||
$form->addMessage( 'files_edit_existing_and_used', 'ipsMessage ipsMessage_info' );
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'filestorage_method', $current ? $current['method'] : 'FileSystem', TRUE, array( 'options' => $handlers, 'toggles' => $toggles ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'filestorage_method', $current ? $current['method'] : ( \IPS\CIC ? 'Amazon' : 'FileSystem' ), TRUE, array( 'options' => $handlers, 'toggles' => $toggles ) ) );
|
||||
foreach ( $handlerSettings as $handlerKey => $settings )
|
||||
{
|
||||
foreach ( $settings as $setting )
|
||||
@@ -831,7 +835,7 @@ class _files extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( "&app=core&module=overview&controller=files&do=settings&tab=configurations" ), 'filestorage_settings' );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->block( $title, (string) $table );
|
||||
\IPS\Output::i()->output = (string) $table;
|
||||
\IPS\Output::i()->title = $title;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Security Settings
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 11 Jun 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\overview;
|
||||
@@ -157,7 +156,7 @@ class _security extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* ACP Password Protection */
|
||||
if ( ! is_file( \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY . '/.htaccess' ) AND !\IPS\NO_WRITES )
|
||||
if ( ! is_file( \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY . '/.htaccess' ) AND !\IPS\NO_WRITES AND !\IPS\CIC )
|
||||
{
|
||||
$content[] = array(
|
||||
'title' => \IPS\Member::loggedIn()->language()->addToStack('admin_pass_title'),
|
||||
@@ -168,7 +167,7 @@ class _security extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('security_center');
|
||||
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'system/security.css', 'core', 'admin' ) );
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'overview' )->security( $content );
|
||||
}
|
||||
|
||||
@@ -181,25 +180,26 @@ class _security extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'security_remove_acp_link', !\IPS\Settings::i()->security_remove_acp_link, FALSE ) );
|
||||
|
||||
/* IP Addresses */
|
||||
$form->addHeader( 'security_header_ips' );
|
||||
if ( !\IPS\CIC )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'xforward_matching', \IPS\Settings::i()->xforward_matching, FALSE ) );
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'match_ipaddress', \IPS\Settings::i()->match_ipaddress, FALSE ) );
|
||||
|
||||
/* If we are overriding IP address checking for the ACP, show a warning */
|
||||
if( \IPS\BYPASS_ACP_IP_CHECK === TRUE )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['match_ipaddress_warning'] = \IPS\Member::loggedIn()->language()->addToStack('ip_override_warn');
|
||||
}
|
||||
|
||||
/* Account Security */
|
||||
$form->addHeader( 'security_header_accounts' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'device_management', \IPS\Settings::i()->device_management, FALSE ) );
|
||||
|
||||
/* Password Strength */
|
||||
$form->addHeader( 'security_header_passwords' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'password_strength_meter', \IPS\Settings::i()->password_strength_meter, FALSE, array( 'togglesOn' => array( 'password_strength_meter_enforce' ) ), NULL, NULL, NULL, 'password_strength_meter' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'password_strength_meter_enforce', \IPS\Settings::i()->password_strength_meter_enforce, FALSE, array( 'togglesOn' => array( 'password_strength_option' ) ), NULL, NULL, NULL, 'password_strength_meter_enforce' ) );
|
||||
|
||||
$strengthOptions = array(
|
||||
'3' => 'strength_3',
|
||||
'4' => 'strength_4',
|
||||
@@ -207,6 +207,11 @@ class _security extends \IPS\Dispatcher\Controller
|
||||
);
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'password_strength_option', \IPS\Settings::i()->password_strength_option, FALSE, array( 'options' => $strengthOptions ), NULL, NULL, NULL, 'password_strength_option' ) );
|
||||
|
||||
/* ACP Link */
|
||||
$form->addHeader( 'security_header_admincp' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'security_remove_acp_link', !\IPS\Settings::i()->security_remove_acp_link, FALSE ) );
|
||||
|
||||
/* Handle Submissions */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$values['security_remove_acp_link'] = $values['security_remove_acp_link'] ? FALSE : TRUE;
|
||||
@@ -357,7 +362,7 @@ EOF;
|
||||
/* See this for an explanation why ErrorDocument is needed: http://www.myriadinteractive.com/blog/view/id/29/conflict-between-apache-url-rewriting-and-basic-authentication */
|
||||
$htaccess_auth = "ErrorDocument 401 \"Unauthorized Access\"\n"
|
||||
. "AuthType Basic\n"
|
||||
. "AuthName \"IPS Community Suite AdminCP\"\n"
|
||||
. "AuthName \"Invision Community AdminCP\"\n"
|
||||
. 'AuthUserFile "' . \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY . "/.htpasswd\"\n"
|
||||
. "Require valid-user\n";
|
||||
|
||||
@@ -376,7 +381,7 @@ EOF;
|
||||
$done = TRUE;
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__security_acp_password' );
|
||||
\IPS\IPS::resyncIPSCloud();
|
||||
\IPS\IPS::resyncIPSCloud('Added htaccess protection to ACP');
|
||||
}
|
||||
|
||||
/* All Done */
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Advertisements
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 24 Sep 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\promotion;
|
||||
@@ -46,8 +45,8 @@ class _advertisements extends \IPS\Dispatcher\Controller
|
||||
$table->langPrefix = 'ads_';
|
||||
|
||||
/* Columns we need */
|
||||
$table->include = array( 'word_custom', 'ad_html', 'ad_impressions', 'ad_clicks', 'ad_start', 'ad_end', 'ad_maximum_value', 'ad_active' );
|
||||
$table->mainColumn = 'ad_html';
|
||||
$table->include = array( 'word_custom', 'ad_html', 'ad_impressions', 'ad_clicks', 'ad_active' );
|
||||
$table->mainColumn = 'word_custom';
|
||||
$table->noSort = array( 'ad_images', 'ad_html' );
|
||||
$table->joins = array(
|
||||
array( 'select' => 'w.word_custom', 'from' => array( 'core_sys_lang_words', 'w' ), 'where' => "w.word_key=CONCAT( 'core_advert_', core_advertisements.ad_id ) AND w.lang_id=" . \IPS\Member::loggedIn()->language()->id )
|
||||
@@ -57,7 +56,7 @@ class _advertisements extends \IPS\Dispatcher\Controller
|
||||
$table->sortBy = $table->sortBy ?: 'ad_start';
|
||||
$table->sortDirection = $table->sortDirection ?: 'desc';
|
||||
|
||||
$table->quickSearch = 'ad_html';
|
||||
$table->quickSearch = 'word_custom';
|
||||
$table->advancedSearch = array(
|
||||
'ad_html' => \IPS\Helpers\Table\SEARCH_CONTAINS_TEXT,
|
||||
'ad_start' => \IPS\Helpers\Table\SEARCH_DATE_RANGE,
|
||||
@@ -111,44 +110,17 @@ class _advertisements extends \IPS\Dispatcher\Controller
|
||||
'ad_clicks' => function( $val, $row )
|
||||
{
|
||||
return $row['ad_html'] ? \IPS\Theme::i()->getTemplate( 'global' )->shortMessage( 'unavailable', array( 'ipsType_light' ) ) : $val;
|
||||
},
|
||||
'ad_start' => function( $val, $row )
|
||||
{
|
||||
return \IPS\DateTime::ts( $val )->localeDate();
|
||||
},
|
||||
'ad_end' => function( $val, $row )
|
||||
{
|
||||
return $val ? \IPS\DateTime::ts( $val )->localeDate() : \IPS\Theme::i()->getTemplate( 'global' )->shortMessage( 'never', array( 'ipsType_light' ) );
|
||||
},
|
||||
'ad_maximum_value' => function( $val, $row )
|
||||
{
|
||||
if( $row['ad_maximum_value'] == '-1' )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'global' )->shortMessage( 'unlimited', array( 'ipsType_light' ) );
|
||||
}
|
||||
|
||||
if( $row['ad_maximum_unit'] == 'c' )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'ad_maximum_value_c', FALSE, array( 'pluralize' => array( $row['ad_maximum_value'] ) ) );
|
||||
}
|
||||
else if( $row['ad_maximum_unit'] == 'i' )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('ad_maximum_value_i', FALSE, array( 'pluralize' => array( $row['ad_maximum_value'] ) ) );
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
);
|
||||
|
||||
/* Specify the buttons */
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'promotion', 'advertisements_add' ) )
|
||||
{
|
||||
$table->rootButtons = array(
|
||||
'add' => array(
|
||||
'icon' => 'plus',
|
||||
'title' => 'add',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=promotion&controller=advertisements&do=form' ),
|
||||
)
|
||||
\IPS\Output::i()->sidebar['actions']['add'] = array(
|
||||
'primary' => TRUE,
|
||||
'icon' => 'plus',
|
||||
'title' => 'add',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=promotion&controller=advertisements&do=form' )
|
||||
);
|
||||
}
|
||||
|
||||
@@ -190,13 +162,11 @@ class _advertisements extends \IPS\Dispatcher\Controller
|
||||
};
|
||||
|
||||
/* Action Buttons */
|
||||
\IPS\Output::i()->sidebar['actions'] = array(
|
||||
'settings' => array(
|
||||
'title' => 'ad_settings',
|
||||
'icon' => 'cog',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=promotion&controller=advertisements&do=settings' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('ad_settings') )
|
||||
)
|
||||
\IPS\Output::i()->sidebar['actions']['settings'] = array(
|
||||
'title' => 'ad_settings',
|
||||
'icon' => 'cog',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=promotion&controller=advertisements&do=settings' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('ad_settings') )
|
||||
);
|
||||
|
||||
/* If Nexus is not installed, show message */
|
||||
@@ -208,7 +178,7 @@ class _advertisements extends \IPS\Dispatcher\Controller
|
||||
/* Display */
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'promotion/advertisements.css', 'core', 'admin' ) );
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('advertisements');
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global' )->block( 'advertisements', (string) $table );
|
||||
\IPS\Output::i()->output .= (string) $table;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Analytics
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 03 Nov 2016
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\promotion;
|
||||
|
||||
@@ -0,0 +1,522 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief promote
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 14 Feb 2017
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\promotion;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* promote
|
||||
*/
|
||||
class _promote extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Active tab
|
||||
*/
|
||||
protected $activeTab = '';
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'promote_manage' );
|
||||
|
||||
/* Get tab content */
|
||||
$this->activeTab = \IPS\Request::i()->tab ?: 'facebook';
|
||||
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Promote Settings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
/* Work out output */
|
||||
$activeTabContents = call_user_func( array( $this, '_manage' . ucfirst( $this->activeTab ) ) );
|
||||
|
||||
/* If this is an AJAX request, just return it */
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->output = $activeTabContents;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Build tab list */
|
||||
$tabs = array();
|
||||
|
||||
$tabs['facebook'] = 'promote_tab_facebook';
|
||||
$tabs['twitter'] = 'promote_tab_twitter';
|
||||
$tabs['links'] = 'promote_tab_links';
|
||||
$tabs['schedule'] = 'promote_tab_schedule';
|
||||
$tabs['permissions'] = 'promote_tab_permissions';
|
||||
$tabs['internal'] = 'promote_tab_internal';
|
||||
|
||||
/* Buttons for logs */
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'promotion', 'promote_logs' ) )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions']['actionLogs'] = array(
|
||||
'title' => 'promote_logs',
|
||||
'icon' => 'search',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=promotion&controller=promote&do=logs' ),
|
||||
);
|
||||
}
|
||||
|
||||
/* Display */
|
||||
if ( $activeTabContents )
|
||||
{
|
||||
$output = \IPS\Theme::i()->getTemplate( 'forms', 'core' )->blurb( \IPS\Member::loggedIn()->language()->addToStack( 'promote_acp_blurb' ) );
|
||||
|
||||
/* Put up a little warning about permissions */
|
||||
$enabledServices = \IPS\Db::i()->select( 'count(*)', 'core_social_promote_sharers', array( 'sharer_enabled=1' ) );
|
||||
|
||||
if ( $enabledServices and ! \IPS\core\Promote::canPromote() )
|
||||
{
|
||||
/* We do not have permission to promote, so lets show a notice about that */
|
||||
$output .= \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->message( 'promote_no_permission_acp', 'info' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_promotion_promote');
|
||||
\IPS\Output::i()->output = $output . \IPS\Theme::i()->getTemplate( 'global' )->tabs( $tabs, $this->activeTab, $activeTabContents, \IPS\Http\Url::internal( "app=core&module=promotion&controller=promote" ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage Links
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _manageLinks()
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'bitly_enabled', \IPS\Settings::i()->bitly_enabled, FALSE, array( 'togglesOn' => array( 'bitly_token' ) ), NULL, NULL, NULL, 'bitly_enabled' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'bitly_token', \IPS\Settings::i()->bitly_token, FALSE, array(), function( $val )
|
||||
{
|
||||
try
|
||||
{
|
||||
$response = \IPS\Http\Url::external( "https://api-ssl.bitly.com/v3/shorten" )->setQueryString( array( 'access_token' => $val, 'longUrl' => 'https://www.invisioncommunity.com' ) )->request()->get()->decodeJson();
|
||||
|
||||
if ( $response['status_code'] !== 200 )
|
||||
{
|
||||
throw new \DomainException("bitly_auth_failed");
|
||||
}
|
||||
}
|
||||
catch ( \IPS\Http\Request\Exception $e )
|
||||
{
|
||||
throw new \DomainException("bitly_auth_failed");
|
||||
}
|
||||
}, NULL, \IPS\Member::loggedIn()->language()->addToStack('bitly_generate_token'), 'bitly_token' ) );
|
||||
|
||||
/* Are we saving? */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$form->saveAsSettings();
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__promote_save', array( "acplogs__promote_changed_links" => true ) );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=promotion&controller=promote&tab=" . \IPS\Request::i()->tab ), 'saved' );
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage Links
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _manageSchedule()
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Stack( 'promote_scheduled', explode( ',', \IPS\Settings::i()->promote_scheduled ), FALSE, array( 'stackFieldType' => 'Text', 'placeholder' => 'HH:MM' ), NULL, NULL, NULL, 'promote_scheduled' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Timezone( 'promote_tz', \IPS\Settings::i()->promote_tz, FALSE, array(), NULL, NULL, NULL, 'promote_tz' ) );
|
||||
|
||||
/* Are we saving? */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$form->saveAsSettings();
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__promote_save', array( "acplogs__promote_changed_schedule" => true ) );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=promotion&controller=promote&tab=" . \IPS\Request::i()->tab ), 'saved' );
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage Permissions
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _managePermissions()
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$groups = array();
|
||||
|
||||
foreach( \IPS\Member\Group::groups() as $group )
|
||||
{
|
||||
if ( $group->g_bitoptions['gbw_promote'] )
|
||||
{
|
||||
$groups[] = \IPS\Theme::i()->getTemplate( 'promote' )->groupLink( $group->g_id, $group->name );
|
||||
}
|
||||
}
|
||||
|
||||
$output = \IPS\Theme::i()->getTemplate( 'promote' )->permissionBlurb( $groups );
|
||||
$form->add( new \IPS\Helpers\Form\Member( 'promote_members', \IPS\Settings::i()->promote_members ? array_map( array( 'IPS\Member', 'load' ), explode( "\n", \IPS\Settings::i()->promote_members ) ) : NULL, FALSE, array( 'multiple' => NULL ), NULL, NULL, NULL, 'promote_twitter_members' ) );
|
||||
|
||||
/* Are we saving? */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$form->saveAsSettings();
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__promote_save', array( "acplogs__promote_changed_permissions" => true ) );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=promotion&controller=promote&tab=" . \IPS\Request::i()->tab ), 'saved' );
|
||||
}
|
||||
|
||||
return $output . $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage Internal
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _manageInternal()
|
||||
{
|
||||
$account = \IPS\core\Promote::getPromoter('Internal')->setMember( \IPS\Member::loggedIn() );
|
||||
$output = \IPS\Theme::i()->getTemplate( 'promote' )->internalBlurb();
|
||||
$form = new \IPS\Helpers\Form;
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'promote_internal_enabled', $account->enabled, FALSE, array(), NULL, NULL, NULL, 'promote_internal_enabled' ) );
|
||||
|
||||
/* Are we saving? */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$account->enabled = $values['promote_internal_enabled'];
|
||||
$account->save();
|
||||
|
||||
$form->saveAsSettings( array( 'promote_community_enabled' => $account->enabled ) );
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__promote_save', array( "acplogs__promote_changed_community" => true ) );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=promotion&controller=promote&tab=" . \IPS\Request::i()->tab ), 'saved' );
|
||||
}
|
||||
|
||||
return $output . $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage Twitter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _manageTwitter()
|
||||
{
|
||||
$twitter = \IPS\Login::getHandler('Twitter');
|
||||
$account = \IPS\core\Promote::getPromoter('Twitter')->setMember( \IPS\Member::loggedIn() );
|
||||
|
||||
/* Have we set up Facebook yet? */
|
||||
if ( ! $twitter->settings['consumer_key'] )
|
||||
{
|
||||
/* Nope, so lets do that first... */
|
||||
return \IPS\Theme::i()->getTemplate( 'promote' )->warningNoTwitterApp();
|
||||
}
|
||||
|
||||
/* Have we linked to a Twitter account? */
|
||||
if ( ! $account->settings['token'] )
|
||||
{
|
||||
/* Nope, so lets do that now... */
|
||||
return \IPS\Theme::i()->getTemplate( 'promote' )->warningNoTwitterUser();
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
|
||||
if ( isset( \IPS\Request::i()->clear ) and \IPS\Request::i()->clear === 'true' )
|
||||
{
|
||||
/* We want to clear settings */
|
||||
$account->saveSettings( array(
|
||||
'token' => NULL,
|
||||
'secret' => NULL,
|
||||
'owner' => NULL,
|
||||
'name' => NULL
|
||||
) );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=promotion&controller=promote&tab=twitter" ) );
|
||||
}
|
||||
|
||||
$owner = \IPS\Member::load( $account->settings['owner'] );
|
||||
$output = '';
|
||||
|
||||
if ( $account->settings['owner'] and $account->settings['name'] )
|
||||
{
|
||||
try
|
||||
{
|
||||
$output = \IPS\Theme::i()->getTemplate( 'promote' )->twitterOwnedBy( $owner, $account->settings['name'] );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
/* Member no longer exists, so clear settings */
|
||||
$account->saveSettings( array(
|
||||
'token' => NULL,
|
||||
'secret' => NULL,
|
||||
'owner' => NULL,
|
||||
'name' => NULL
|
||||
) );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=promotion&controller=promote&tab=twitter" ) );
|
||||
}
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'promote_twitter_enabled', $account->enabled, FALSE, array( 'togglesOn' => array() ), NULL, NULL, NULL, 'promote_twitter_enabled' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Stack( 'promote_twitter_tags', $account->settings['tags'], FALSE, array( 'stackFieldType' => 'Text' ), NULL, NULL, NULL, 'promote_twitter_tags' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'promote_twitter_tags_method', $account->settings['tags_method'], FALSE, array( 'options' => array(
|
||||
'fill' => 'promote_twitter_tags_method_fill',
|
||||
'trim' => 'promote_twitter_tags_method_trim'
|
||||
) ), NULL, NULL, NULL, 'promote_twitter_tags_method' ) );
|
||||
|
||||
/* Are we saving? */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
if ( is_array( $values['promote_twitter_tags'] ) )
|
||||
{
|
||||
array_walk( $values['promote_twitter_tags'], function( &$value )
|
||||
{
|
||||
$value = str_replace( '#', '', $value );
|
||||
} );
|
||||
}
|
||||
|
||||
$account->enabled = $values['promote_twitter_enabled'];
|
||||
$save = array(
|
||||
'tags' => $values['promote_twitter_tags'],
|
||||
'tags_method' => $values['promote_twitter_tags_method']
|
||||
);
|
||||
|
||||
$account->saveSettings( $save );
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__promote_save', array( "acplogs__promote_changed_twitter" => true ) );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=promotion&controller=promote&tab=" . \IPS\Request::i()->tab ), 'saved' );
|
||||
}
|
||||
|
||||
return $output . $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage Facebook
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _manageFacebook()
|
||||
{
|
||||
$facebook = \IPS\Login::getHandler('Facebook');
|
||||
$account = \IPS\core\Promote::getPromoter('Facebook')->setMember( \IPS\Member::loggedIn() );
|
||||
|
||||
/* Have we set up Facebook yet? */
|
||||
if ( ! $facebook->settings['app_id'] )
|
||||
{
|
||||
/* Nope, so lets do that first... */
|
||||
return \IPS\Theme::i()->getTemplate( 'promote' )->warningNoFacebookApp();
|
||||
}
|
||||
|
||||
/* Have we synchronized our user account with Facebook? */
|
||||
if ( ! $account->connected() )
|
||||
{
|
||||
/* Nope, so lets do that now... */
|
||||
return \IPS\Theme::i()->getTemplate( 'promote' )->warningNoFacebookUser();
|
||||
}
|
||||
|
||||
/* Do we have post to page permissions? */
|
||||
$response = $account->canPostToPage();
|
||||
if ( $response !== TRUE )
|
||||
{
|
||||
/* Nope, so lets do that now... */
|
||||
return \IPS\Theme::i()->getTemplate( 'promote' )->warningNoFacebookPostToPagePermission( $response );
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
|
||||
if ( isset( \IPS\Request::i()->clear ) and \IPS\Request::i()->clear === 'true' )
|
||||
{
|
||||
/* We want to clear settings */
|
||||
$account->saveSettings( array(
|
||||
'token' => NULL,
|
||||
'owner' => NULL,
|
||||
'page_name' => NULL,
|
||||
'enabled' => NULL,
|
||||
'page' => NULL
|
||||
) );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=promotion&controller=promote&tab=facebook" ) );
|
||||
}
|
||||
|
||||
/* We're all set, so show the form! */
|
||||
$pages = $account->getPages();
|
||||
$options = array();
|
||||
|
||||
foreach( $pages as $id => $data )
|
||||
{
|
||||
$options[ $id ] = $data[0];
|
||||
}
|
||||
|
||||
$output = '';
|
||||
$owner = \IPS\Member::load( $account->settings['owner'] );
|
||||
|
||||
if ( $account->settings['owner'] and $account->settings['page_name'] )
|
||||
{
|
||||
try
|
||||
{
|
||||
$output = \IPS\Theme::i()->getTemplate( 'promote' )->facebookOwnedBy( $owner, $account->settings['page'], $account->settings['page_name'] );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
/* Member no longer exists, so clear settings */
|
||||
$account->saveSettings( array(
|
||||
'token' => NULL,
|
||||
'owner' => NULL,
|
||||
'page_name' => NULL
|
||||
) );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=promotion&controller=promote&tab=facebook" ) );
|
||||
}
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'promote_facebook_enabled', $account->enabled, FALSE, array( 'togglesOn' => array( 'promote_facebook_page', 'promote_facebook_groups', 'promote_facebook_members', 'promote_facebook_tags' ) ), NULL, NULL, NULL, 'promote_facebook_enabled' ) );
|
||||
|
||||
if ( ! $account->settings['owner'] or ( \IPS\Member::loggedIn()->member_id == $account->settings['owner'] ) )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'promote_facebook_page', $account->settings['page'], FALSE, array( 'options' => $options ), NULL, NULL, NULL, 'promote_facebook_page' ) );
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Stack( 'promote_facebook_tags', $account->settings['tags'], FALSE, array( 'stackFieldType' => 'Text' ), NULL, NULL, NULL, 'promote_facebook_tags' ) );
|
||||
|
||||
/* Are we saving? */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
if ( is_array( $values['promote_facebook_tags'] ) )
|
||||
{
|
||||
array_walk( $values['promote_facebook_tags'], function( &$value )
|
||||
{
|
||||
$value = str_replace( '#', '', $value );
|
||||
} );
|
||||
}
|
||||
|
||||
$account->enabled = $values['promote_facebook_enabled'];
|
||||
|
||||
/* If we have page data, then we are the page owner and can have extra special things */
|
||||
if ( $values['promote_facebook_page'] )
|
||||
{
|
||||
/* Get a non-expiring page token */
|
||||
$save['token'] = $facebook->exchangeToken( $pages[ $values['promote_facebook_page'] ][1] );
|
||||
$save['owner'] = \IPS\Member::loggedIn()->member_id;
|
||||
$save['page_name'] = $pages[ $values['promote_facebook_page'] ][0];
|
||||
$save['page'] = $values['promote_facebook_page'];
|
||||
$save['tags'] = $values['promote_facebook_tags'];
|
||||
}
|
||||
|
||||
$account->saveSettings( $save );
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__promote_save', array( "acplogs__promote_changed_facebook" => true ) );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=promotion&controller=promote&tab=" . \IPS\Request::i()->tab ), 'saved' );
|
||||
}
|
||||
|
||||
return $output . $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Response Logs
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function logs()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'restrictions_acploginlogs' );
|
||||
|
||||
/* Create the table */
|
||||
$table = new \IPS\Helpers\Table\Db( 'core_social_promote_content', \IPS\Http\Url::internal( 'app=core&module=promotion&controller=promote&do=logs' ), array( array( "response_promote_key != 'internal'" ) ) );
|
||||
$table->langPrefix = 'promote_logs_';
|
||||
$table->sortBy = $table->sortBy ?: 'response_date';
|
||||
$table->sortDirection = $table->sortDirection ?: 'DESC';
|
||||
$table->include = array( 'response_promote_id', 'response_promote_key', 'response_json', 'response_failed', 'response_date' );
|
||||
$table->widths['response_json'] = '40';
|
||||
|
||||
/* Search */
|
||||
$table->quickSearch = 'response_json';
|
||||
|
||||
/* Filters */
|
||||
$table->filters = array(
|
||||
'promote_logs_success' => 'response_failed = 0',
|
||||
'promote_logs_unsuccessful' => 'response_failed = 1',
|
||||
);
|
||||
|
||||
/* Custom parsers */
|
||||
$table->parsers = array(
|
||||
'response_date' => function( $val, $row )
|
||||
{
|
||||
return \IPS\DateTime::ts( $val );
|
||||
},
|
||||
'response_failed' => function( $val, $row )
|
||||
{
|
||||
return ( ! $val ) ? "<i class='fa fa-check'></i>" : "<i class='fa fa-times'></i>";
|
||||
},
|
||||
'response_promote_id' => function( $val, $row )
|
||||
{
|
||||
try
|
||||
{
|
||||
$promote = \IPS\core\Promote::load( $val );
|
||||
|
||||
return $promote->objectTitle . ' (' . $val . ')';
|
||||
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
},
|
||||
'response_promote_key' => function( $val, $row )
|
||||
{
|
||||
return \ucfirst( $val );
|
||||
},
|
||||
'response_json' => function( $val, $row )
|
||||
{
|
||||
$val = json_decode( $val, true );
|
||||
return '<div data-ipstruncate data-ipstruncate-type="hide" data-ipstruncate-size="3 lines" class="ipsType_break">' . var_export( $val, true ) . "</div>";
|
||||
}
|
||||
);
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( 'app=core&module=promotion&controller=promote' ), \IPS\Member::loggedIn()->language()->addToStack( 'menu__core_promotion_promote' ) );
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('promote_logs');
|
||||
\IPS\Output::i()->output = (string) $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reschedule things
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function reschedule()
|
||||
{
|
||||
\IPS\core\Promote::rescheduleQueue();
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=promotion&controller=promote&tab=schedule" ), 'promote_rescheduled_done' );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief SEO
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 07 Jun 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\promotion;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Share Link Services
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 10 Jun 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\promotion;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Advanced Settings
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 10 June 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\settings;
|
||||
@@ -338,8 +337,26 @@ class _advanced extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['task_method_cron_warning'] = sprintf( \IPS\Member::loggedIn()->language()->get( 'task_method_cron_warning', FALSE ), PHP_BINDIR . '/php -d memory_limit=-1 -d max_execution_time=0 ' . \IPS\ROOT_PATH . '/applications/core/interface/task/task.php ' . \IPS\Settings::i()->task_cron_key );
|
||||
\IPS\Member::loggedIn()->language()->words['task_method_web_warning'] = sprintf( \IPS\Member::loggedIn()->language()->get( 'task_method_web_warning', FALSE ), \IPS\Http\Url::internal( 'applications/core/interface/task/web.php?key=' . \IPS\Settings::i()->task_cron_key, 'none' ) );
|
||||
$cronCommand = PHP_BINDIR . '/php -d memory_limit=-1 -d max_execution_time=0 ' . \IPS\ROOT_PATH . '/applications/core/interface/task/task.php ' . \IPS\Settings::i()->task_cron_key;
|
||||
try
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['task_method_cron_warning'] = sprintf( \IPS\Member::loggedIn()->language()->get( 'task_method_cron_warning', FALSE ), $cronCommand );
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['task_method_cron_warning'] = $cronCommand;
|
||||
}
|
||||
|
||||
$webCronUrl = (string) \IPS\Http\Url::internal( 'applications/core/interface/task/web.php?key=' . \IPS\Settings::i()->task_cron_key, 'none' );
|
||||
try
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['task_method_web_warning'] = sprintf( \IPS\Member::loggedIn()->language()->get( 'task_method_web_warning', FALSE ), $webCronUrl );
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['task_method_web_warning'] = $webCronUrl;
|
||||
}
|
||||
|
||||
$options = array(
|
||||
'options' => array(
|
||||
'normal' => 'task_method_normal',
|
||||
@@ -366,17 +383,20 @@ class _advanced extends \IPS\Dispatcher\Controller
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'widget_cache_ttl', ( isset( \IPS\Settings::i()->widget_cache_ttl ) ) ? \IPS\Settings::i()->widget_cache_ttl : 60, FALSE, array( 'min' => 60 ), NULL, \IPS\Member::loggedIn()->language()->addToStack('for'), \IPS\Member::loggedIn()->language()->addToStack('seconds') ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'auto_polling_enabled', \IPS\Settings::i()->auto_polling_enabled, FALSE ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'theme_disk_cache_templates', \IPS\Settings::i()->theme_disk_cache_templates, FALSE, array( 'togglesOn' => array( 'theme_disk_cache_path' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'theme_disk_cache_path', \IPS\Settings::i()->theme_disk_cache_path ? \IPS\Settings::i()->theme_disk_cache_path : \IPS\ROOT_PATH . '/uploads', FALSE, array(), function( $val )
|
||||
if ( ! \IPS\CIC )
|
||||
{
|
||||
if ( \IPS\Request::i()->theme_disk_cache_templates_checkbox )
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'theme_disk_cache_templates', \IPS\Settings::i()->theme_disk_cache_templates, FALSE, array( 'togglesOn' => array( 'theme_disk_cache_path' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'theme_disk_cache_path', \IPS\Settings::i()->theme_disk_cache_path ? \IPS\Settings::i()->theme_disk_cache_path : \IPS\ROOT_PATH . '/uploads', FALSE, array(), function( $val )
|
||||
{
|
||||
if ( ! is_dir( \IPS\Request::i()->theme_disk_cache_path ) or ! is_readable( \IPS\Request::i()->theme_disk_cache_path ) or ! is_writable( \IPS\Request::i()->theme_disk_cache_path ) )
|
||||
if ( \IPS\Request::i()->theme_disk_cache_templates_checkbox )
|
||||
{
|
||||
throw new \InvalidArgumentException( 'theme_disk_cache_path_wrong' );
|
||||
if ( ! is_dir( \IPS\Request::i()->theme_disk_cache_path ) or ! is_readable( \IPS\Request::i()->theme_disk_cache_path ) or ! is_writable( \IPS\Request::i()->theme_disk_cache_path ) )
|
||||
{
|
||||
throw new \InvalidArgumentException( 'theme_disk_cache_path_wrong' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}, NULL, NULL, 'theme_disk_cache_path' ) );
|
||||
}, NULL, NULL, 'theme_disk_cache_path' ) );
|
||||
}
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief contactus
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 29 Sep 2016
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\settings;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief email
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 17 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\settings;
|
||||
@@ -285,7 +284,7 @@ class _email extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('emailerrorlogs');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'title', (string) $table );
|
||||
\IPS\Output::i()->output = (string) $table;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief general
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 17 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\settings;
|
||||
@@ -48,6 +47,7 @@ class _general extends \IPS\Dispatcher\Controller
|
||||
) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Editor( 'site_offline_message', \IPS\Settings::i()->site_offline_message, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'onlineoffline', 'attachIds' => array( NULL, NULL, 'site_offline_message' ) ), NULL, NULL, NULL, 'site_offline_message_id' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Address( 'site_address', \IPS\GeoLocation::buildFromJson( \IPS\Settings::i()->site_address ), FALSE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Stack( 'site_social_profiles', \IPS\Settings::i()->site_social_profiles ? json_decode( \IPS\Settings::i()->site_social_profiles, true ) : array(), FALSE, array( 'stackFieldType' => '\IPS\core\Form\SocialProfiles', 'maxItems' => 50, 'key' => array( 'placeholder' => 'http://example.com', 'size' => 20 ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Translatable( 'copyright_line', NULL, FALSE, array( 'app' => 'core', 'key' => 'copyright_line_value', 'placeholder' => \IPS\Member::loggedIn()->language()->addToStack('copyright_line_placeholder') ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Stack( 'upgrade_email', explode( ',', \IPS\Settings::i()->upgrade_email ), FALSE, array( 'stackFieldType' => 'Email', 'maxItems' => 5 ) ) );
|
||||
// $form->add( new \IPS\Helpers\Form\YesNo( 'diagnostics_reporting', \IPS\Settings::i()->diagnostics_reporting ) );
|
||||
@@ -56,8 +56,13 @@ class _general extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
\IPS\Lang::saveCustom( 'core', "copyright_line_value", $values['copyright_line'] );
|
||||
unset( $values['copyright_line'] );
|
||||
|
||||
$values['site_social_profiles'] = json_encode( array_filter( $values['site_social_profiles'], function( $value ) {
|
||||
return (bool) $value['key'];
|
||||
} ) );
|
||||
$values['site_address'] = json_encode( $values['site_address'] );
|
||||
|
||||
$form->saveAsSettings();
|
||||
$form->saveAsSettings( $values );
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
@@ -67,5 +72,6 @@ class _general extends \IPS\Dispatcher\Controller
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_settings_general');
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global' )->block( 'menu__core_settings_general', $form );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'settings/general.css', 'core', 'admin' ) );
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief licensekey
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 17 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\settings;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Login Handlers
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 15 Mar 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\settings;
|
||||
@@ -78,7 +77,7 @@ class _login extends \IPS\Node\Controller
|
||||
*/
|
||||
protected function forceLogout()
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_members', array( 'member_login_key' => '' ) );
|
||||
\IPS\Db::i()->update( 'core_members_known_devices', array( 'login_key' => NULL ) );
|
||||
\IPS\Db::i()->delete( 'core_sessions' );
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__logout_force' );
|
||||
@@ -142,6 +141,7 @@ class _login extends \IPS\Node\Controller
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'ipb_bruteforce_period', \IPS\Settings::i()->ipb_bruteforce_period, FALSE, array( 'min' => 0, 'max' => 10000, 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), \IPS\Member::loggedIn()->language()->addToStack('minutes'), 'ipb_bruteforce_period' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_bruteforce_unlock', \IPS\Settings::i()->ipb_bruteforce_unlock, FALSE, array(), NULL, NULL, NULL, 'ipb_bruteforce_unlock' ) );
|
||||
$form->addHeader( 'login_settings' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'new_device_email', \IPS\Settings::i()->new_device_email, FALSE ) );
|
||||
|
||||
/* Check if the site works over HTTPS before we allow them to change that */
|
||||
$httpsValue = \IPS\Settings::i()->logins_over_https;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Multi-Factor Authentication
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 30 Nov 2016
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\settings;
|
||||
@@ -100,7 +99,7 @@ class _mfa extends \IPS\Dispatcher\Controller
|
||||
\IPS\Member::loggedIn()->language()->addToStack("mfa_{$key}_desc"),
|
||||
NULL,
|
||||
NULL,
|
||||
TRUE,
|
||||
FALSE,
|
||||
$handler->isEnabled()
|
||||
);
|
||||
}
|
||||
@@ -152,16 +151,9 @@ class _mfa extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=settings&controller=mfa" ) );
|
||||
}
|
||||
}
|
||||
catch ( \LogicException $e )
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->error( $e->getMessage(), $e->getCode() );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=applications&controller=enhancements&do=edit&id=" . \IPS\Request::i()->id ) );
|
||||
}
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=settings&controller=mfa&tab=handlers&do=settings&key=" . $key ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Manage Posting Settings
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 20 Jun 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\settings;
|
||||
@@ -105,6 +104,9 @@ class _posting extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Build Form */
|
||||
$form = new \IPS\Helpers\Form;
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'admin_settings.js', 'core', 'admin' ) );
|
||||
$form->attributes['data-controller'] = 'core.admin.settings.posting';
|
||||
$form->hiddenValues['rebuildImageProxy'] = \IPS\Request::i()->rebuildImageProxy ?: 0;
|
||||
$form->addHeader('posting_attachments');
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'attach_allowed_types', \IPS\Settings::i()->attach_allowed_types, FALSE, array(
|
||||
'options' => array( 'all' => 'attach_allowed_types_all', 'images' => 'attach_allowed_types_images', 'none' => 'attach_allowed_types_none' ),
|
||||
@@ -168,6 +170,8 @@ class _posting extends \IPS\Dispatcher\Controller
|
||||
) ) );
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'dellog_retention_period', \IPS\Settings::i()->dellog_retention_period, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'immediately' ), NULL, NULL, \IPS\Member::loggedIn()->language()->addToStack('dellog_days_after_deleted') ) );
|
||||
|
||||
/* Save values */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
@@ -182,6 +186,34 @@ class _posting extends \IPS\Dispatcher\Controller
|
||||
return ltrim( $val, '.' );
|
||||
}, $values['attach_allowed_extensions'] ) ) ) : '';
|
||||
$values['max_video_width_css'] = ( $values['max_video_width'] ) ? $values['max_video_width'] . 'px' : 'none';
|
||||
|
||||
/* Run the image proxy rebuild tasks */
|
||||
if( $values['rebuildImageProxy'] )
|
||||
{
|
||||
/* Remove any existing rebuilds */
|
||||
\IPS\Db::i()->delete( 'core_queue', array( '`key`=? OR `key`=?', 'RebuildImageProxy', 'RebuildImageProxyNonContent' ) );
|
||||
|
||||
/* Unset task datastore */
|
||||
unset( \IPS\Data\Store::i()->currentImageProxyRebuild );
|
||||
|
||||
$enableDisable = $values['remote_image_proxy'] ? TRUE : FALSE;
|
||||
foreach ( \IPS\Content::routedClasses( FALSE, TRUE ) as $class )
|
||||
{
|
||||
try
|
||||
{
|
||||
\IPS\Task::queue( 'core', 'RebuildImageProxy', array( 'class' => $class, 'status' => $enableDisable ), 5 );
|
||||
}
|
||||
catch( \OutOfRangeException $ex ) { }
|
||||
}
|
||||
|
||||
foreach( \IPS\Application::allExtensions( 'core', 'EditorLocations', FALSE, NULL, NULL, TRUE, TRUE ) as $_key => $extension )
|
||||
{
|
||||
if( method_exists( $extension, 'rebuildImageProxy' ) )
|
||||
{
|
||||
\IPS\Task::queue( 'core', 'RebuildImageProxyNonContent', array( 'extension' => $_key, 'status' => $enableDisable ), 5 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$form->saveAsSettings( $values );
|
||||
|
||||
@@ -258,7 +290,7 @@ class _posting extends \IPS\Dispatcher\Controller
|
||||
) ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Stack( 'ipb_url_whitelist', \IPS\Settings::i()->ipb_url_whitelist ? explode( ",", \IPS\Settings::i()->ipb_url_whitelist ) : array(), FALSE, array(), NULL, NULL, NULL, 'ipb_url_whitelist' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Stack( 'ipb_url_blacklist', \IPS\Settings::i()->ipb_url_blacklist ? explode( ",", \IPS\Settings::i()->ipb_url_blacklist ) : array(), FALSE, array(), NULL, NULL, NULL, 'ipb_url_blacklist' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Stack( 'ipb_url_blacklist', \IPS\Settings::i()->ipb_url_blacklist ? explode( ",", \IPS\Settings::i()->ipb_url_blacklist ) : array(), TRUE, array(), NULL, NULL, NULL, 'ipb_url_blacklist' ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'url_filter_action', \IPS\Settings::i()->url_filter_action, FALSE, array(
|
||||
'options' => array(
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Security Questions
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 26 Aug 2016
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\settings;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Manage Terms & Privacy Policy
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 07 Jun 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\settings;
|
||||
@@ -90,7 +89,7 @@ class _terms extends \IPS\Dispatcher\Controller
|
||||
foreach ( array( 'gl_guidelines' => 'guidelines_value', 'privacy_text' => 'privacy_text_value', 'reg_rules' => 'reg_rules_value', 'guest_terms_bar_text' => 'guest_terms_bar_text_value' ) as $k => $v )
|
||||
{
|
||||
/* Guest terms bar text has special replacements that need to be swapped to sprintf parameters */
|
||||
if ( $k == 'guest_terms_bar_text' )
|
||||
if ( $k == 'guest_terms_bar_text' and $values['guest_terms_bar'] )
|
||||
{
|
||||
foreach( $values[ $k ] AS $lang_id => $text )
|
||||
{
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Admin CP Restrictions
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 04 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\staff;
|
||||
@@ -78,8 +77,9 @@ class _admin extends \IPS\Dispatcher\Controller
|
||||
/* Buttons */
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'staff', 'restrictions_add_member' ) or \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'staff', 'restrictions_add_group' ) )
|
||||
{
|
||||
$table->rootButtons = array(
|
||||
\IPS\Output::i()->sidebar['actions'] = array(
|
||||
'add' => array(
|
||||
'primary' => TRUE,
|
||||
'icon' => 'plus',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=staff&controller=admin&do=add' ),
|
||||
'title' => 'acprestrictions_add',
|
||||
@@ -167,7 +167,7 @@ class _admin extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('acprestrictions');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'acprestrictions', (string) $table );
|
||||
\IPS\Output::i()->output = (string) $table;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -483,12 +483,17 @@ class _admin extends \IPS\Dispatcher\Controller
|
||||
$table->sortDirection = $table->sortDirection ?: 'desc';
|
||||
|
||||
/* Search */
|
||||
$table->quickSearch = array( array( 'note', 'word_custom', 'word_default' ), 'note' );
|
||||
$table->advancedSearch = array(
|
||||
'member_id' => \IPS\Helpers\Table\SEARCH_MEMBER,
|
||||
'ip_address' => \IPS\Helpers\Table\SEARCH_CONTAINS_TEXT,
|
||||
'ctime' => \IPS\Helpers\Table\SEARCH_DATE_RANGE,
|
||||
);
|
||||
|
||||
|
||||
$table->joins = array(
|
||||
array( 'from' => array( 'core_sys_lang_words', 'w' ), 'where' => "w.word_key=lang_key AND w.lang_id=" . \IPS\Member::loggedIn()->language()->id )
|
||||
);
|
||||
|
||||
/* Add a button for settings */
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'staff', 'restrictions_adminlogs_prune' ) )
|
||||
{
|
||||
@@ -505,7 +510,7 @@ class _admin extends \IPS\Dispatcher\Controller
|
||||
/* Display */
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( 'app=core&module=staff&controller=admin&do=actionLogs' ), \IPS\Member::loggedIn()->language()->addToStack( 'acplogs' ) );
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('acplogs');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'acplogs', (string) $table );
|
||||
\IPS\Output::i()->output = (string) $table;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -588,7 +593,7 @@ class _admin extends \IPS\Dispatcher\Controller
|
||||
/* Display */
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( 'app=core&module=staff&controller=admin&do=loginLogs' ), \IPS\Member::loggedIn()->language()->addToStack( 'adminloginlogs' ) );
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('adminloginlogs');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'adminloginlogs', (string) $table );
|
||||
\IPS\Output::i()->output = (string) $table;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Staff directory management
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 18 Sep 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\staff;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief moderators
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 24 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\staff;
|
||||
@@ -76,8 +75,9 @@ class _moderators extends \IPS\Dispatcher\Controller
|
||||
/* Buttons */
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'staff', 'moderators_add_member' ) or \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'staff', 'moderators_add_group' ) )
|
||||
{
|
||||
$table->rootButtons = array(
|
||||
\IPS\Output::i()->sidebar['actions'] = array(
|
||||
'add' => array(
|
||||
'primary' => TRUE,
|
||||
'icon' => 'plus',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=staff&controller=moderators&do=add' ),
|
||||
'title' => 'add_moderator',
|
||||
@@ -140,7 +140,7 @@ class _moderators extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('moderators');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'moderators', (string) $table );
|
||||
\IPS\Output::i()->output = (string) $table;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -249,7 +249,7 @@ class _moderators extends \IPS\Dispatcher\Controller
|
||||
$currentPermissions = ( $current['perms'] === '*' ) ? '*' : ( $current['perms'] ? json_decode( $current['perms'], TRUE ) : array() );
|
||||
|
||||
/* Define content field toggles */
|
||||
$toggles = array( 'view_future' => array(), 'future_publish' => array(), 'pin' => array(), 'unpin' => array(), 'feature' => array(), 'unfeature' => array(), 'edit' => array(), 'hide' => array(), 'unhide' => array(), 'view_hidden' => array(), 'move' => array(), 'lock' => array(), 'unlock' => array(), 'reply_to_locked' => array(), 'delete' => array(), 'split_merge' => array() );
|
||||
$toggles = array( 'view_future' => array(), 'future_publish' => array(), 'pin' => array(), 'unpin' => array(), 'feature' => array(), 'unfeature' => array(), 'edit' => array(), 'hide' => array(), 'unhide' => array(), 'view_hidden' => array(), 'move' => array(), 'lock' => array(), 'unlock' => array(), 'reply_to_locked' => array(), 'delete' => array(), 'split_merge' => array(), 'feature_comments' => array(), 'unfeature_comments' => array(), 'add_item_message' => array(), 'edit_item_message' => array(), 'delete_item_message' => array() );
|
||||
foreach ( \IPS\Application::allExtensions( 'core', 'ModeratorPermissions', FALSE ) as $k => $ext )
|
||||
{
|
||||
if ( $ext instanceof \IPS\Content\ModeratorPermissions )
|
||||
@@ -596,12 +596,17 @@ class _moderators extends \IPS\Dispatcher\Controller
|
||||
$table->sortDirection = $table->sortDirection ?: 'desc';
|
||||
|
||||
/* Search */
|
||||
$table->quickSearch = array( array( 'note', 'word_custom', 'word_default' ), 'action' );
|
||||
$table->advancedSearch = array(
|
||||
'member_id' => \IPS\Helpers\Table\SEARCH_MEMBER,
|
||||
'ip_address' => \IPS\Helpers\Table\SEARCH_CONTAINS_TEXT,
|
||||
'ctime' => \IPS\Helpers\Table\SEARCH_DATE_RANGE,
|
||||
'ctime' => \IPS\Helpers\Table\SEARCH_DATE_RANGE
|
||||
);
|
||||
|
||||
|
||||
$table->joins = array(
|
||||
array( 'from' => array( 'core_sys_lang_words', 'w' ), 'where' => "w.word_key=lang_key AND w.lang_id=" . \IPS\Member::loggedIn()->language()->id )
|
||||
);
|
||||
|
||||
/* Add a button for settings */
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'staff', 'restrictions_moderatorlogs_prune' ) )
|
||||
{
|
||||
@@ -618,7 +623,7 @@ class _moderators extends \IPS\Dispatcher\Controller
|
||||
/* Display */
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( 'app=core&module=staff&controller=moderators&do=actionLogs' ), \IPS\Member::loggedIn()->language()->addToStack( 'modlogs' ) );
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'modlogs' );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'modlogs', (string) $table );
|
||||
\IPS\Output::i()->output = (string) $table;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Member visit statistics
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 23 Mar 2017
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\stats;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Member visit statistics
|
||||
*/
|
||||
class _membervisits extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'membervisits_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Member visit statistics
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
$count = NULL;
|
||||
$table = NULL;
|
||||
$start = NULL;
|
||||
$end = NULL;
|
||||
|
||||
$defaults = array( 'start' => \IPS\DateTime::create()->setDate( date('Y'), date('m'), 1 ), 'end' => new \IPS\DateTime );
|
||||
|
||||
if( isset( \IPS\Request::i()->visitDateStart ) AND isset( \IPS\Request::i()->visitDateEnd ) )
|
||||
{
|
||||
$defaults = array( 'start' => \IPS\DateTime::ts( \IPS\Request::i()->visitDateStart ), 'end' => \IPS\DateTime::ts( \IPS\Request::i()->visitDateEnd ) );
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'visits', 'continue' );
|
||||
$form->add( new \IPS\Helpers\Form\DateRange( 'visit_date', $defaults, TRUE ) );
|
||||
|
||||
if( $values = $form->values() )
|
||||
{
|
||||
/* Determine start and end time */
|
||||
$startTime = $values['visit_date']['start']->getTimestamp();
|
||||
$endTime = $values['visit_date']['end']->getTimestamp();
|
||||
|
||||
$start = $values['visit_date']['start']->html();
|
||||
$end = $values['visit_date']['end']->html();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Determine start and end time */
|
||||
$startTime = $defaults['start']->getTimestamp();
|
||||
$endTime = $defaults['end']->getTimestamp();
|
||||
|
||||
$start = $defaults['start']->html();
|
||||
$end = $defaults['end']->html();
|
||||
}
|
||||
|
||||
/* Do we have our date ranges? */
|
||||
if( $start AND $end )
|
||||
{
|
||||
/* Get the count */
|
||||
$count = \IPS\Db::i()->select( 'COUNT(*)', 'core_members', array( 'last_visit BETWEEN ? AND ?', $startTime, $endTime ) )->first();
|
||||
|
||||
/* And now build the table */
|
||||
$table = new \IPS\Helpers\Table\Db( 'core_members', \IPS\Request::i()->url()->setQueryString( array( 'visitDateStart' => $startTime, 'visitDateEnd' => $endTime ) ), array( array( 'last_visit BETWEEN ? AND ?', $startTime, $endTime ) ) );
|
||||
|
||||
$table->include = array( 'name', 'last_visit' );
|
||||
$table->mainColumn = 'name';
|
||||
$table->langPrefix = 'visits_';
|
||||
|
||||
/* Default sort options */
|
||||
$table->sortBy = $table->sortBy ?: 'last_visit';
|
||||
$table->sortDirection = $table->sortDirection ?: 'desc';
|
||||
|
||||
/* Custom parsers */
|
||||
$table->parsers = array(
|
||||
'name' => function( $val, $row )
|
||||
{
|
||||
$member = \IPS\Member::constructFromData( $row );
|
||||
return \IPS\Theme::i()->getTemplate( 'global', 'core' )->userPhoto( $member, 'tiny' ) . ' ' . $member->link();
|
||||
},
|
||||
'last_visit' => function( $val, $row )
|
||||
{
|
||||
return \IPS\DateTime::ts( $val )->html();
|
||||
},
|
||||
);
|
||||
|
||||
$table->extraHtml = \IPS\Theme::i()->getTemplate( 'stats' )->tableheader( $start, $end, $count );
|
||||
}
|
||||
|
||||
$formHtml = $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'stats' ) ), 'visitsFormTemplate' ) );
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_stats_membervisits');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'stats' )->membervisits( $formHtml, $count, $table );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief onlineusers
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 23 Mar 2017
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\stats;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* onlineusers
|
||||
*/
|
||||
class _onlineusers extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'onlineusers_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Online users activity chart
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
/* Show button to adjust settings */
|
||||
\IPS\Output::i()->sidebar['actions']['settings'] = array(
|
||||
'icon' => 'cog',
|
||||
'title' => 'prunesettings',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=stats&controller=onlineusers&do=settings' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('prunesettings') )
|
||||
);
|
||||
|
||||
/* Determine minimum date */
|
||||
$minimumDate = NULL;
|
||||
|
||||
if( \IPS\Settings::i()->stats_online_users_prune )
|
||||
{
|
||||
$minimumDate = \IPS\DateTime::create()->sub( new \DateInterval( 'P' . \IPS\Settings::i()->stats_online_users_prune . 'D' ) );
|
||||
}
|
||||
|
||||
/* We can't retrieve any stats prior to the new tracking being implemented */
|
||||
try
|
||||
{
|
||||
$oldestLog = \IPS\Db::i()->select( 'MIN(time)', 'core_statistics', array( 'type=?', 'online_users' ) )->first();
|
||||
|
||||
if( !$minimumDate OR $oldestLog < $minimumDate->getTimestamp() )
|
||||
{
|
||||
$minimumDate = \IPS\DateTime::ts( $oldestLog );
|
||||
}
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
/* We have nothing tracked, set minimum date to today */
|
||||
$minimumDate = \IPS\DateTime::create();
|
||||
}
|
||||
|
||||
$chart = new \IPS\Helpers\Chart\Callback(
|
||||
\IPS\Http\Url::internal( 'app=core&module=stats&controller=onlineusers' ),
|
||||
array( $this, 'getResults' ),
|
||||
'',
|
||||
array(
|
||||
'isStacked' => TRUE,
|
||||
'backgroundColor' => '#ffffff',
|
||||
'colors' => array( '#10967e', '#ea7963' ),
|
||||
'hAxis' => array( 'gridlines' => array( 'color' => '#f5f5f5' ) ),
|
||||
'lineWidth' => 1,
|
||||
'areaOpacity' => 0.4
|
||||
),
|
||||
'AreaChart',
|
||||
'none',
|
||||
array( 'start' => \IPS\DateTime::ts( time() - ( 60 * 60 * 24 * 30 ) ), 'end' => \IPS\DateTime::create() ),
|
||||
'',
|
||||
$minimumDate
|
||||
);
|
||||
|
||||
$chart->addSeries( \IPS\Member::loggedIn()->language()->addToStack('members'), 'number' );
|
||||
$chart->addSeries( \IPS\Member::loggedIn()->language()->addToStack('guests'), 'number' );
|
||||
|
||||
$chart->title = \IPS\Member::loggedIn()->language()->addToStack('stats_onlineusers_title');
|
||||
$chart->availableTypes = array( 'AreaChart', 'ColumnChart', 'BarChart' );
|
||||
$chart->showIntervals = FALSE;
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_stats_onlineusers');
|
||||
\IPS\Output::i()->output = (string) $chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prune Settings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function settings()
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'stats_online_users_prune', \IPS\Settings::i()->stats_online_users_prune, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), \IPS\Member::loggedIn()->language()->addToStack('days'), 'prune_log_moderator' ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$form->saveAsSettings();
|
||||
\IPS\Session::i()->log( 'acplog__statsonlineusers_settings' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=stats&controller=onlineusers' ), 'saved' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('prunesettings');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('global')->block( 'prunesettings', $form, FALSE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the results
|
||||
*
|
||||
* @param \IPS\Helpers\Chart\Callback $chart Chart object
|
||||
* @return array
|
||||
*/
|
||||
public function getResults( $chart )
|
||||
{
|
||||
$where = array( array( 'type=?', 'online_users' ), array( "time>?", 0 ) );
|
||||
|
||||
if ( $chart->start )
|
||||
{
|
||||
$where[] = array( "time>?", $chart->start->getTimestamp() );
|
||||
}
|
||||
if ( $chart->end )
|
||||
{
|
||||
$where[] = array( "time<?", $chart->end->getTimestamp() );
|
||||
}
|
||||
|
||||
$results = array();
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_statistics', $where, 'time ASC' ) as $row )
|
||||
{
|
||||
if( !isset( $results[ $row['time'] ] ) )
|
||||
{
|
||||
$results[ $row['time'] ] = array(
|
||||
'time' => $row['time'],
|
||||
\IPS\Member::loggedIn()->language()->get('members') => 0,
|
||||
\IPS\Member::loggedIn()->language()->get('guests') => 0
|
||||
);
|
||||
}
|
||||
|
||||
if( $row['value_4'] == 'members' )
|
||||
{
|
||||
$results[ $row['time'] ][ \IPS\Member::loggedIn()->language()->get('members') ] = $row['value_1'];
|
||||
}
|
||||
|
||||
if( $row['value_4'] == 'guests' )
|
||||
{
|
||||
$results[ $row['time'] ][ \IPS\Member::loggedIn()->language()->get('guests') ] = $row['value_1'];
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Registration Stats
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 3 June 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\stats;
|
||||
@@ -33,10 +32,17 @@ class _registrationstats extends \IPS\Dispatcher\Controller
|
||||
/* Check permission */
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'registrations_manage', 'core', 'members' );
|
||||
|
||||
$chart = new \IPS\Helpers\Chart\Dynamic( \IPS\Http\Url::internal( 'app=core&module=stats&controller=registrationstats' ), 'core_members', 'joined', '', array( 'isStacked' => FALSE ) );
|
||||
$chart = new \IPS\Helpers\Chart\Database( \IPS\Http\Url::internal( 'app=core&module=stats&controller=registrationstats' ), 'core_members', 'joined', '', array(
|
||||
'isStacked' => FALSE,
|
||||
'backgroundColor' => '#ffffff',
|
||||
'colors' => array( '#10967e' ),
|
||||
'hAxis' => array( 'gridlines' => array( 'color' => '#f5f5f5' ) ),
|
||||
'lineWidth' => 1,
|
||||
'areaOpacity' => 0.4
|
||||
) );
|
||||
$chart->addSeries( \IPS\Member::loggedIn()->language()->addToStack('stats_new_registrations'), 'number', 'COUNT(*)', FALSE );
|
||||
$chart->title = \IPS\Member::loggedIn()->language()->addToStack('stats_registrations_title');
|
||||
$chart->availableTypes = array( 'LineChart', 'ColumnChart', 'BarChart' );
|
||||
$chart->availableTypes = array( 'AreaChart', 'ColumnChart', 'BarChart' );
|
||||
|
||||
/* fetch only successful registered members ; if this needs to be changed, please review the other areas where we have the name<>? AND email<>? condition */
|
||||
$chart->where[] = array( '( name<>? AND email<>? )', '', '' );
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Error Logs
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 06 Aug 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\support;
|
||||
@@ -47,6 +46,7 @@ class _errorLogs extends \IPS\Dispatcher\Controller
|
||||
$table->include = array( 'log_error_code', 'log_error', 'log_ip_address', 'log_request_uri', 'log_member', 'log_date' );
|
||||
$table->mainColumn = 'log_error_code';
|
||||
$table->widths = array( 'log_error_code' => 10, 'log_ip_address' => 10, 'log_request_uri' => 30, 'log_date' => 10, 'log_member' => 10 );
|
||||
$table->rowClasses = array( 'log_error' => array( 'ipsTable_wrap' ), 'log_request_uri' => array( 'ipsTable_wrap' ) );
|
||||
$table->parsers = array(
|
||||
'log_member' => function( $val )
|
||||
{
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief hookedFiles
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
|
||||
* @since 11 Nov 2016
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\support;
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief recovery
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
|
||||
* @since 03 Nov 2016
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\support;
|
||||
@@ -137,7 +136,7 @@ class _recovery extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}, function()
|
||||
{
|
||||
\IPS\IPS::resyncIPSCloud();
|
||||
\IPS\IPS::resyncIPSCloud('Enabled recovery mode');
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=support&controller=recovery&do=done' ) );
|
||||
} );
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief sql
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 22 May 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\support;
|
||||
@@ -86,7 +85,7 @@ class _sql extends \IPS\Dispatcher\Controller
|
||||
$form->add( new \IPS\Helpers\Form\TextArea( 'sql_toolbox_query', NULL, TRUE, array( 'class' => 'ipsField_codeInput' ) ) );
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->output .= $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'support' ) ), 'queryFormTemplate' ) ) . \IPS\Theme::i()->getTemplate( 'global', 'core' )->block( 'title', (string) $table );
|
||||
\IPS\Output::i()->output .= $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'support' ) ), 'queryFormTemplate' ) ) . (string) $table;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Support Wizard
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 21 May 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\support;
|
||||
@@ -83,7 +82,7 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
public function _typeOfProblem( $data )
|
||||
{
|
||||
$form = new \IPS\Helpers\Form( 'form', 'continue' );
|
||||
$form->class = 'ipsForm_horizontal ipsPad';
|
||||
$form->class = 'ipsForm_horizontal';
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'type_of_problem_select', NULL, TRUE, array(
|
||||
'options' => array( 'advice' => 'type_of_problem_advice', 'issue' => 'type_of_problem_issue' ),
|
||||
'toggles' => array( 'advice' => array( 'support_advice_search' ) )
|
||||
@@ -207,7 +206,7 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
/**
|
||||
* Step 2: Self Service - Check for Uprade / known issues
|
||||
*
|
||||
* @return bool|string
|
||||
* @return bool|array
|
||||
*/
|
||||
protected function _upgradeCheck()
|
||||
{
|
||||
@@ -315,7 +314,7 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
/**
|
||||
* Step 2: Self Service - Check advice and look for recommendations
|
||||
*
|
||||
* @param array $requirements Requirements to check
|
||||
* @param array $check Requirements to check
|
||||
* @return array Necessary changes
|
||||
*/
|
||||
protected function _adviceChecker( $check )
|
||||
@@ -479,8 +478,7 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
/* Loop Apps */
|
||||
foreach ( $this->_thirdPartyApps() as $app )
|
||||
{
|
||||
$app->enabled = FALSE;
|
||||
$app->save();
|
||||
\IPS\Db::i()->update( 'core_applications', array( 'app_enabled' => 0 ), array( 'app_id=?', $app->id ) );
|
||||
|
||||
$disabledApps[] = $app->directory;
|
||||
$disabledAppNames[ $app->directory ] = $app->_title;
|
||||
@@ -489,12 +487,21 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
/* Look Plugins */
|
||||
foreach ( $this->_thirdPartyPlugins() as $plugin )
|
||||
{
|
||||
$plugin->enabled = FALSE;
|
||||
$plugin->save();
|
||||
\IPS\Db::i()->update( 'core_plugins', array( 'plugin_enabled' => 0 ), array( 'plugin_id=?', $plugin->id ) );
|
||||
|
||||
$disabledPlugins[] = $plugin->id;
|
||||
$disabledPluginNames[ $plugin->id ] = $plugin->_title;
|
||||
}
|
||||
|
||||
if( count( $this->_thirdPartyApps() ) )
|
||||
{
|
||||
\IPS\Application::postToggleEnable();
|
||||
}
|
||||
|
||||
if( count( $this->_thirdPartyPlugins() ) )
|
||||
{
|
||||
\IPS\Plugin::postToggleEnable( TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
/* Do we need to restore the default theme? */
|
||||
@@ -595,9 +602,7 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
try
|
||||
{
|
||||
$app = \IPS\Application::load( $app );
|
||||
$app->enabled = TRUE;
|
||||
$app->save();
|
||||
\IPS\Db::i()->update( 'core_applications', array( 'app_enabled' => 1 ), array( 'app_directory=?', $app ) );
|
||||
}
|
||||
catch ( \Exception $e ) {}
|
||||
}
|
||||
@@ -607,12 +612,20 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
try
|
||||
{
|
||||
$plugin = \IPS\Plugin::load( $plugin );
|
||||
$plugin->enabled = TRUE;
|
||||
$plugin->save();
|
||||
\IPS\Db::i()->update( 'core_plugins', array( 'plugin_enabled' => 1 ), array( 'plugin_id=?', $plugin ) );
|
||||
}
|
||||
catch ( \Exception $e ) {}
|
||||
}
|
||||
|
||||
if( \IPS\Request::i()->enableApps )
|
||||
{
|
||||
\IPS\Application::postToggleEnable();
|
||||
}
|
||||
|
||||
if( \IPS\Request::i()->enablePlugins )
|
||||
{
|
||||
\IPS\Plugin::postToggleEnable( TRUE );
|
||||
}
|
||||
|
||||
/* Editor Plugins */
|
||||
if ( isset( \IPS\Request::i()->restoreEditor ) and \IPS\Request::i()->restoreEditor )
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief System Logs
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 29 Mar 2016
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\support;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief utf8mb4 Converter
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 15 April 2016
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\support;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Core AJAX Responders
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 13 Mar 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\system;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Background processes 'Run Now'
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 28 Jan 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\system;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Editor AJAX functions Controller
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 29 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\system;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Language Changer
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 7 Oct 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\system;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief ACP Live Search
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 18 Sep 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\system;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Admin CP Login
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 13 Mar 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\system;
|
||||
@@ -101,7 +100,7 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
$upgradeError = FALSE;
|
||||
if ( !\IPS\IN_DEV and !isset( \IPS\Request::i()->noWarning ) )
|
||||
{
|
||||
if( \IPS\Application::load('core')->long_version < \IPS\Application::getAvailableVersion('core') )
|
||||
if( \IPS\Application::load('core')->long_version < \IPS\Application::getAvailableVersion('core') and \IPS\Application::load('core')->version != \IPS\Application::getAvailableVersion( 'core', TRUE ) )
|
||||
{
|
||||
$upgradeError = \IPS\Application::getAvailableVersion( 'core', TRUE );
|
||||
}
|
||||
@@ -116,9 +115,10 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
/**
|
||||
* MFA
|
||||
*
|
||||
* @param string $mfaOutput If coming from _doLogin, the existing MFA output
|
||||
* @return void
|
||||
*/
|
||||
protected function mfa()
|
||||
protected function mfa( $mfaOutput=NULL )
|
||||
{
|
||||
/* Have we logged in? */
|
||||
$member = NULL;
|
||||
@@ -126,7 +126,7 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$member = \IPS\Member::load( $_SESSION['processing2FA']['memberId'] );
|
||||
}
|
||||
if ( !$member->member_id )
|
||||
if ( !$member AND !$member->member_id )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( '', 'admin' ) );
|
||||
}
|
||||
@@ -143,7 +143,7 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Have we already done 2FA? */
|
||||
$output = \IPS\MFA\MFAHandler::accessToArea( 'core', 'AuthenticateAdmin', $url, $member );
|
||||
$output = $mfaOutput ?: \IPS\MFA\MFAHandler::accessToArea( 'core', 'AuthenticateAdmin', $url, $member );
|
||||
if ( !$output )
|
||||
{
|
||||
$this->_doLogin( $member, TRUE );
|
||||
@@ -163,21 +163,23 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
protected function _doLogin( $member, $bypass2FA = FALSE )
|
||||
{
|
||||
/* Set the referer in the URL */
|
||||
$url = \IPS\Http\Url::internal( 'app=core&module=system&controller=login&do=mfa', 'admin', 'login' );
|
||||
if ( isset( \IPS\Request::i()->ref ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'ref', \IPS\Request::i()->ref );
|
||||
}
|
||||
if ( isset( \IPS\Request::i()->auth ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'auth', \IPS\Request::i()->auth );
|
||||
}
|
||||
|
||||
/* Do we need to do 2FA? */
|
||||
if ( !$bypass2FA and $output = \IPS\MFA\MFAHandler::accessToArea( 'core', 'AuthenticateAdmin', \IPS\Http\Url::internal( '' ), $member ) )
|
||||
if ( !$bypass2FA and $output = \IPS\MFA\MFAHandler::accessToArea( 'core', 'AuthenticateAdmin', $url, $member ) )
|
||||
{
|
||||
$_SESSION['processing2FA'] = array( 'memberId' => $member->member_id );
|
||||
|
||||
$url = \IPS\Http\Url::internal( 'app=core&module=system&controller=login&do=mfa', 'admin', 'login' );
|
||||
if ( isset( \IPS\Request::i()->ref ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'ref', \IPS\Request::i()->ref );
|
||||
}
|
||||
if ( isset( \IPS\Request::i()->auth ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'auth', \IPS\Request::i()->auth );
|
||||
}
|
||||
\IPS\Output::i()->redirect( $url );
|
||||
|
||||
return $this->mfa( $output );
|
||||
}
|
||||
|
||||
/* Set the member */
|
||||
@@ -220,7 +222,7 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
protected function logout()
|
||||
{
|
||||
session_destroy();
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=system&controller=login" ) );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=system&controller=login&_fromLogout=1" )->csrf() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Theme Changer
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 7 Oct 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\system;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief upgrade
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 28 Jul 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\system;
|
||||
@@ -29,10 +28,11 @@ class _upgrade extends \IPS\Dispatcher\Controller
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
protected function manage()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'upgrade_manage' );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::external( "http://ipbmafia.ru/files/file/1560-ips-community-suite-41-nulled/" ) );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Visual Language Editor
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 27 Jun 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\system;
|
||||
|
||||
@@ -0,0 +1,314 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Clubs List
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 13 Feb 2017
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\front\clubs;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clubs List
|
||||
*/
|
||||
class _directory extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
/* Permission check */
|
||||
if ( !\IPS\Settings::i()->clubs )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_module_permission', '2C349/2', 403, '' );
|
||||
}
|
||||
|
||||
/* CSS */
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/clubs.css', 'core', 'front' ) );
|
||||
if ( \IPS\Theme::i()->settings['responsive'] )
|
||||
{
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/clubs_responsive.css', 'core', 'front' ) );
|
||||
}
|
||||
|
||||
/* JS */
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_clubs.js', 'core', 'front' ) );
|
||||
|
||||
/* Location for online list */
|
||||
\IPS\Session::i()->setLocation( \IPS\Http\Url::internal( 'app=core&module=clubs&controller=directory', 'front', 'clubs_list' ), array(), 'loc_clubs_directory' );
|
||||
|
||||
/* Pass up */
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* List
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
$baseUrl = \IPS\Http\Url::internal( 'app=core&module=clubs&controller=directory', 'front', 'clubs_list' );
|
||||
|
||||
/* All Clubs: Sort */
|
||||
$sortOption = \IPS\Settings::i()->clubs_default_sort;
|
||||
if ( isset( \IPS\Request::i()->sort ) and in_array( \IPS\Request::i()->sort, array( 'last_activity', 'members', 'content', 'created', 'name' ) ) )
|
||||
{
|
||||
$sortOption = \IPS\Request::i()->sort;
|
||||
}
|
||||
|
||||
/* All Clubs: Filters */
|
||||
$filters = array();
|
||||
$mineOnly = FALSE;
|
||||
if ( isset( \IPS\Request::i()->filter ) and \IPS\Request::i()->filter === 'mine' )
|
||||
{
|
||||
$mineOnly = TRUE;
|
||||
$baseUrl = $baseUrl->setQueryString( 'filter', 'mine' );
|
||||
}
|
||||
foreach ( \IPS\Member\Club\CustomField::fields() as $field )
|
||||
{
|
||||
$k = "f{$field->id}";
|
||||
if ( $field->filterable and isset( \IPS\Request::i()->$k ) )
|
||||
{
|
||||
switch ( $field->type )
|
||||
{
|
||||
case 'Checkbox':
|
||||
case 'YesNo':
|
||||
if ( in_array( \IPS\Request::i()->$k, array( 0, 1 ) ) )
|
||||
{
|
||||
$filters[ $field->id ] = \IPS\Request::i()->$k;
|
||||
$baseUrl = $baseUrl->setQueryString( 'f' . $field->id, \IPS\Request::i()->$k );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'CheckboxSet':
|
||||
case 'Radio':
|
||||
case 'Select':
|
||||
$options = json_decode( $field->extra, TRUE );
|
||||
foreach ( \IPS\Request::i()->$k as $id )
|
||||
{
|
||||
if ( isset( $options[ $id ] ) )
|
||||
{
|
||||
$filters[ $field->id ][ $id ] = $options[ $id ];
|
||||
}
|
||||
}
|
||||
$baseUrl = $baseUrl->setQueryString( 'f' . $field->id, array_keys( $filters[ $field->id ] ) );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Get Featured Clubs */
|
||||
$featuredClubs = \IPS\Member\Club::clubs( \IPS\Member::loggedIn(), NULL, 'RAND()', FALSE, array(), 'featured=1' );
|
||||
|
||||
/* Get All Clubs */
|
||||
$perPage = 24;
|
||||
$page = isset( \IPS\Request::i()->page ) ? intval( \IPS\Request::i()->page ) : 1;
|
||||
$allClubs = \IPS\Member\Club::clubs( \IPS\Member::loggedIn(), array( ( $page - 1 ) * $perPage, $perPage ), $sortOption, $mineOnly, $filters );
|
||||
$pagination = \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->pagination( $baseUrl, ceil( $allClubs->count( TRUE ) / $perPage ), $page, $perPage );
|
||||
|
||||
/* Get my clubs */
|
||||
$myClubsActivity = NULL;
|
||||
if ( \IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
$myClubsActivity = \IPS\Content\Search\Query::init()->filterByClub( \IPS\Member::loggedIn()->clubs() )->setLimit(6)->setOrder( \IPS\Content\Search\Query::ORDER_NEWEST_UPDATED )->search();
|
||||
}
|
||||
|
||||
/* Build Map */
|
||||
$mapMarkers = NULL;
|
||||
if ( \IPS\Settings::i()->googlemaps and \IPS\Settings::i()->google_maps_api_key )
|
||||
{
|
||||
$mapMarkers = array();
|
||||
|
||||
$where = array( array( 'location_lat IS NOT NULL' ) );
|
||||
if ( !\IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
$where[] = array( "type<>?", \IPS\Member\Club::TYPE_PRIVATE );
|
||||
}
|
||||
elseif ( !\IPS\Member::loggedIn()->modPermission('can_access_all_clubs') )
|
||||
{
|
||||
$where[] = array( "( type<>? OR status IN('" . \IPS\Member\Club::STATUS_MEMBER . "','" . \IPS\Member\Club::STATUS_MODERATOR . "','" . \IPS\Member\Club::STATUS_LEADER . "') )", \IPS\Member\Club::TYPE_PRIVATE );
|
||||
}
|
||||
|
||||
$select = \IPS\Db::i()->select( array( 'id', 'name', 'location_lat', 'location_long' ), 'core_clubs', $where );
|
||||
if ( \IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
$select->join( 'core_clubs_memberships', array( 'club_id=id AND member_id=?', \IPS\Member::loggedIn()->member_id ) );
|
||||
}
|
||||
|
||||
foreach ( $select as $club )
|
||||
{
|
||||
$mapMarkers[ $club['id'] ] = array(
|
||||
'lat' => floatval( $club['location_lat'] ),
|
||||
'long' => floatval( $club['location_long'] ),
|
||||
'title' => $club['name']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( \IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['contextual'] = \IPS\Theme::i()->getTemplate('clubs')->myClubsSidebar( \IPS\Member\Club::clubs( \IPS\Member::loggedIn(), 10, 'last_activity', TRUE ), $myClubsActivity );
|
||||
}
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('module__core_clubs');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clubs')->directory( $featuredClubs, $allClubs, $pagination, $baseUrl, $sortOption, $myClubsActivity, $mapMarkers );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter Form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function filters()
|
||||
{
|
||||
$fields = \IPS\Member\Club\CustomField::roots();
|
||||
|
||||
$form = new \IPS\Helpers\Form('filter', 'filter');
|
||||
|
||||
if ( \IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'club_filter_type', isset( \IPS\Request::i()->filter ) ? \IPS\Request::i()->filter : 'all', TRUE, array( 'options' => array(
|
||||
'all' => 'all_clubs',
|
||||
'mine' => 'my_clubs'
|
||||
) ) ) );
|
||||
}
|
||||
|
||||
foreach ( $fields as $field )
|
||||
{
|
||||
if ( $field->filterable )
|
||||
{
|
||||
$k = "f{$field->id}";
|
||||
switch ( $field->type )
|
||||
{
|
||||
case 'Checkbox':
|
||||
case 'YesNo':
|
||||
$input = new \IPS\Helpers\Form\CheckboxSet( 'field_' . $field->id, isset( \IPS\Request::i()->$k ) ? \IPS\Request::i()->$k : array( 1, 0 ), FALSE, array( 'options' => array(
|
||||
1 => 'yes',
|
||||
0 => 'no',
|
||||
) ) );
|
||||
$input->label = $field->_title;
|
||||
$form->add( $input );
|
||||
break;
|
||||
|
||||
case 'CheckboxSet':
|
||||
case 'Radio':
|
||||
case 'Select':
|
||||
$options = json_decode( $field->extra, TRUE );
|
||||
$input = new \IPS\Helpers\Form\CheckboxSet( 'field_' . $field->id, isset( \IPS\Request::i()->$k ) ? \IPS\Request::i()->$k : array_keys( $options ), FALSE, array( 'options' => $options ) );
|
||||
$input->label = $field->_title;
|
||||
$form->add( $input );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$url = \IPS\Http\Url::internal( 'app=core&module=clubs&controller=directory', 'front', 'clubs_list' );
|
||||
|
||||
if ( \IPS\Member::loggedIn()->member_id and $values['club_filter_type'] === 'mine' )
|
||||
{
|
||||
$url = $url->setQueryString( 'filter', 'mine' );
|
||||
}
|
||||
|
||||
foreach ( $fields as $field )
|
||||
{
|
||||
if ( $field->filterable )
|
||||
{
|
||||
switch ( $field->type )
|
||||
{
|
||||
case 'Checkbox':
|
||||
case 'YesNo':
|
||||
if ( count( $values[ 'field_' . $field->id ] ) === 1 )
|
||||
{
|
||||
$url = $url->setQueryString( 'f' . $field->id, array_pop( $values[ 'field_' . $field->id ] ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'CheckboxSet':
|
||||
case 'Radio':
|
||||
case 'Select':
|
||||
$options = json_decode( $field->extra, TRUE );
|
||||
if ( count( $values[ 'field_' . $field->id ] ) > 0 and count( $values[ 'field_' . $field->id ] ) < count( $options ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'f' . $field->id, $values[ 'field_' . $field->id ] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( $url );
|
||||
}
|
||||
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->output = $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'forms', 'core' ) ), 'popupTemplate' ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->output = $form;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function create()
|
||||
{
|
||||
$availableTypes = array();
|
||||
foreach ( explode( ',', \IPS\Member::loggedIn()->group['g_create_clubs'] ) as $type )
|
||||
{
|
||||
if ( $type !== '' )
|
||||
{
|
||||
$availableTypes[ $type ] = 'club_type_' . $type;
|
||||
}
|
||||
}
|
||||
if ( !$availableTypes )
|
||||
{
|
||||
\IPS\Output::i()->error( \IPS\Member::loggedIn()->member_id ? 'no_module_permission' : 'no_module_permission_guest', '2C349/1', 403, '' );
|
||||
}
|
||||
|
||||
$club = new \IPS\Member\Club;
|
||||
if ( $form = $club->form( FALSE, TRUE, $availableTypes ) )
|
||||
{
|
||||
$form->class = 'ipsForm_vertical';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !$club->approved and \IPS\Member::loggedIn()->modPermission('can_access_all_clubs') )
|
||||
{
|
||||
$club->approved = TRUE;
|
||||
$club->save();
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( $club->url() );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('create_club');
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->output = $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'forms', 'core' ) ), 'popupTemplate' ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'clubs' )->create( $form );
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Contact Form
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 12 Nov 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\front\contact;
|
||||
@@ -30,7 +29,7 @@ class _contact extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
if ( !static::canUseContactUs() )
|
||||
if ( !\IPS\Member::loggedIn()->canUseContactUs() )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_permission', '2S333/1', 403, '' );
|
||||
}
|
||||
@@ -48,7 +47,8 @@ class _contact extends \IPS\Dispatcher\Controller
|
||||
/* Get extensions */
|
||||
$extensions = \IPS\Application::allExtensions( 'core', 'ContactUs', FALSE, 'core', 'InternalEmail', TRUE );
|
||||
|
||||
|
||||
/* Don't let robots index this page, it has no value */
|
||||
\IPS\Output::i()->metaTags['robots'] = 'noindex';
|
||||
\IPS\Output::i()->sidebar['enabled'] = FALSE;
|
||||
\IPS\Output::i()->bodyClasses[] = 'ipsLayout_minimal';
|
||||
|
||||
@@ -100,46 +100,15 @@ class _contact extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is the current user allowed to use the contact us form
|
||||
* Can Use Contact Us
|
||||
*
|
||||
* @return bool
|
||||
* @return bool
|
||||
* @deprecated 4.3
|
||||
*/
|
||||
public static function canUseContactUs()
|
||||
{
|
||||
try
|
||||
{
|
||||
$module = \IPS\Application\Module::get( 'core', 'contact' );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( !\IPS\Member::loggedIn()->canAccessModule( $module ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* If all groups have access, we can */
|
||||
if( \IPS\Settings::i()->contact_access != '*' )
|
||||
{
|
||||
/* Check member */
|
||||
$member = \IPS\Member::loggedIn();
|
||||
$memberGroups = array_merge( array( $member->member_group_id ), array_filter( explode( ',', $member->mgroup_others ) ) );
|
||||
$accessGroups = explode( ',', \IPS\Settings::i()->contact_access );
|
||||
|
||||
/* Are we in an allowed group? */
|
||||
if( count( array_intersect( $accessGroups, $memberGroups ) ) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return \IPS\Member::loggedIn()->canUseContactUs();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Popular things
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 21 Oct 2016
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\front\discover;
|
||||
@@ -83,120 +82,44 @@ class _popular extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
protected function members()
|
||||
{
|
||||
$filters = array(
|
||||
'reputation' => array( 'pp_reputation_points', \IPS\Member::loggedIn()->language()->addToStack('leaderboard_tab_reputation') ),
|
||||
'posts' => array( 'member_posts', \IPS\Member::loggedIn()->language()->addToStack('leaderboard_tab_posts') )
|
||||
);
|
||||
|
||||
$classes = array();
|
||||
foreach ( \IPS\Application::allExtensions( 'core', 'ContentRouter', TRUE ) as $object )
|
||||
/* Get filters */
|
||||
$filters = array_merge( array( 'overview' => \IPS\Member::loggedIn()->language()->addToStack('overview') ), \IPS\Member::topMembersOptions( \IPS\Member::TOP_MEMBERS_FILTERS ) );
|
||||
$activeFilter = 'overview';
|
||||
if ( isset( \IPS\Request::i()->filter ) )
|
||||
{
|
||||
$classes = array_merge( $object->classes, $classes );
|
||||
}
|
||||
|
||||
foreach( $classes as $item )
|
||||
{
|
||||
$commentClass = NULL;
|
||||
|
||||
if ( isset( $item::$commentClass ) )
|
||||
if ( array_key_exists( \IPS\Request::i()->filter, $filters ) )
|
||||
{
|
||||
$commentClass = $item::$commentClass;
|
||||
$activeFilter = \IPS\Request::i()->filter;
|
||||
}
|
||||
|
||||
if ( $item::$firstCommentRequired and isset( $commentClass::$databaseColumnMap['author'] ) )
|
||||
else
|
||||
{
|
||||
$filters[ 'app_' . $item::$application . '_' . $item::$module ] = array(
|
||||
$commentClass,
|
||||
\IPS\Member::loggedIn()->language()->addToStack('leaderboard_tab_x', NULL, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->addToStack("{$commentClass::$title}_pl_lc") ) ) ),
|
||||
\IPS\Member::loggedIn()->language()->addToStack("{$commentClass::$title}_pl")
|
||||
);
|
||||
}
|
||||
else if ( isset( $item::$databaseColumnMap['author'] ) )
|
||||
{
|
||||
$filters[ 'app_' . $item::$application . '_' . $item::$module ] = array(
|
||||
$item,
|
||||
\IPS\Member::loggedIn()->language()->addToStack('leaderboard_tab_x', NULL, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->addToStack("{$item::$title}_pl_lc") ) ) ),
|
||||
\IPS\Member::loggedIn()->language()->addToStack("{$item::$title}_pl")
|
||||
);
|
||||
$possibleFilter = 'IPS\\' . str_replace( '_', '\\', \IPS\Request::i()->filter );
|
||||
if ( array_key_exists( $possibleFilter, $filters ) )
|
||||
{
|
||||
$activeFilter = $possibleFilter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$activeFilter = ( isset( \IPS\Request::i()->filter ) and isset( $filters[ \IPS\Request::i()->filter ] ) ) ? \IPS\Request::i()->filter : 'reputation';
|
||||
$members = array();
|
||||
|
||||
/* Get the members */
|
||||
if ( mb_substr( $activeFilter, 0, 4 ) == 'app_' )
|
||||
/* Get results */
|
||||
if ( $activeFilter == 'overview' )
|
||||
{
|
||||
$storeKey = 'store_' . $activeFilter;
|
||||
$recache = true;
|
||||
$memberIds = NULL;
|
||||
|
||||
if ( isset( \IPS\Data\Store::i()->$storeKey ) )
|
||||
{
|
||||
$cache = \IPS\Data\Store::i()->$storeKey;
|
||||
|
||||
if ( isset( $cache['time'] ) and isset( $cache['memberIds'] ) and ( time() - $cache['time'] < 300 ) )
|
||||
{
|
||||
$memberIds = $cache['memberIds'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Nothing returned from the cache, so fetch and store */
|
||||
if ( $memberIds === NULL )
|
||||
{
|
||||
$class = $filters[ $activeFilter ][0];
|
||||
$authorField = $class::$databasePrefix . $class::$databaseColumnMap['author'];
|
||||
$memberIds = array();
|
||||
$where = NULL;
|
||||
|
||||
if ( isset( $class::$databaseColumnMap['hidden'] ) )
|
||||
{
|
||||
$where = array( $class::$databasePrefix . $class::$databaseColumnMap['hidden'] . '=0' );
|
||||
}
|
||||
else if ( isset( $class::$databaseColumnMap['approved'] ) )
|
||||
{
|
||||
$where = array( $class::$databasePrefix . $class::$databaseColumnMap['approved'] . '=1' );
|
||||
}
|
||||
|
||||
/* Get member IDS */
|
||||
foreach( \IPS\Db::i()->select( 'COUNT(*) as count, ' . $class::$databaseTable . '.' . $authorField, $class::$databaseTable, $where, 'count DESC', array( 0, \IPS\Settings::i()->reputation_max_members ), $authorField ) as $row )
|
||||
{
|
||||
$memberIds[ $row[ $authorField ] ] = array( $row['count'] . '.' . $row[ $authorField ], $row['count'] );
|
||||
}
|
||||
|
||||
\IPS\Data\Store::i()->$storeKey = array( 'time' => time(), 'memberIds' => $memberIds );
|
||||
}
|
||||
|
||||
if ( count( $memberIds ) )
|
||||
{
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_members', array( \IPS\Db::i()->in( 'member_id', array_keys( $memberIds ) ) ) ) as $member )
|
||||
{
|
||||
$members[ $memberIds[ $member['member_id'] ][0] ] = \IPS\Member::constructFromData( array_merge( $member, array( 'custom_count' => $memberIds[ $member['member_id'] ][1] ) ) );
|
||||
}
|
||||
|
||||
krsort( $members );
|
||||
}
|
||||
$output = \IPS\Theme::i()->getTemplate('popular')->topMembersOverview( \IPS\Member::topMembersOptions( \IPS\Member::TOP_MEMBERS_OVERVIEW ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$members = iterator_to_array( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_members', array( "name IS NOT NULL AND name != '' AND temp_ban != -1 AND email != '' AND " . $filters[ $activeFilter ][0] . " > 0" ), $filters[ $activeFilter ][0] . ' DESC', array( 0, \IPS\Settings::i()->reputation_max_members ) ), '\IPS\Member' ) );
|
||||
$output = \IPS\Theme::i()->getTemplate('popular')->topMembersResults( $activeFilter, NULL, \IPS\Member::topMembers( $activeFilter, \IPS\Settings::i()->reputation_max_members ) );
|
||||
}
|
||||
|
||||
$contentLabel = 'members_member_posts';
|
||||
$contentCount = 'member_posts';
|
||||
if ( isset( $filters[ $activeFilter ][2] ) )
|
||||
{
|
||||
$contentLabel = $filters[ $activeFilter ][2];
|
||||
$contentCount = 'custom_count';
|
||||
}
|
||||
|
||||
|
||||
/* Output */
|
||||
\IPS\Output::i()->linkTags['canonical'] = (string) \IPS\Http\Url::internal( "app=core&module=discover&controller=popular&tab=members", 'front', 'leaderboard_members' );
|
||||
if ( \IPS\Request::i()->isAjax() and \IPS\Request::i()->topMembers )
|
||||
{
|
||||
\IPS\Output::i()->json( array( 'rows' => \IPS\Theme::i()->getTemplate('popular')->membersWrapper( $members, $contentLabel, $contentCount ), 'extraHtml' => $filters[ $activeFilter ][1] ) );
|
||||
\IPS\Output::i()->json( array( 'rows' => $output, 'extraHtml' => $filters[ $activeFilter ] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate('popular')->members( $members, $filters, $activeFilter, \IPS\Http\Url::internal( "app=core&module=discover&controller=popular&tab=members", 'front', 'leaderboard_members' ), $contentLabel, $contentCount );
|
||||
return \IPS\Theme::i()->getTemplate('popular')->topMembers( \IPS\Http\Url::internal( 'app=core&module=discover&controller=popular&tab=members', 'front', 'leaderboard_members' ), $filters, $activeFilter, $output );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,7 +167,7 @@ class _popular extends \IPS\Dispatcher\Controller
|
||||
return \IPS\DateTime::ts( $val )->setTimezone( new \DateTimeZone( \IPS\Settings::i()->reputation_timezone ) );
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->blankTemplate( $table ), 200, 'text/html', \IPS\Output::i()->httpHeaders );
|
||||
@@ -277,111 +200,111 @@ class _popular extends \IPS\Dispatcher\Controller
|
||||
$dates = array();
|
||||
$timezone = new \DateTimeZone( \IPS\Settings::i()->reputation_timezone );
|
||||
$endDate = \IPS\DateTime::ts( time() )->setTimezone( $timezone );
|
||||
|
||||
|
||||
$firstRepDate = \IPS\Db::i()->select( 'MIN(rep_date)', 'core_reputation_index' )->first();
|
||||
$firstIndexDate = \IPS\Db::i()->select( 'MIN(index_date_updated)', 'core_search_index' )->first();
|
||||
$appWhere = null;
|
||||
$descApp = \IPS\Member::loggedIn()->language()->addToStack('leaderboard_in_all_apps');
|
||||
|
||||
$dates['oldest'] = \IPS\DateTime::ts( ( $firstRepDate > $firstIndexDate ) ? $firstRepDate : $firstIndexDate );
|
||||
$oldestStamp = $dates['oldest']->getTimeStamp();
|
||||
$date = $dates['oldest'];
|
||||
|
||||
$descApp = \IPS\Member::loggedIn()->language()->addToStack( 'leaderboard_in_all_apps' );
|
||||
|
||||
$dates[ 'oldest' ] = \IPS\DateTime::ts( ( $firstRepDate > $firstIndexDate ) ? $firstRepDate : $firstIndexDate );
|
||||
$oldestStamp = $dates[ 'oldest' ]->getTimeStamp();
|
||||
$date = $dates[ 'oldest' ];
|
||||
|
||||
$aYearAgo = \IPS\DateTime::create()->setTimezone( $timezone )->sub( new \DateInterval( 'P1Y' ) );
|
||||
$month = \IPS\DateTime::create()->setTimezone( $timezone )->sub( new \DateInterval( 'P1M' ) )->setTime( 0, 0 );
|
||||
$week = \IPS\DateTime::create()->setTimezone( $timezone )->sub( new \DateInterval( 'P7D' ) )->setTime( 0, 0 );
|
||||
$today = \IPS\DateTime::create()->setTimezone( $timezone )->setTime( 0, 0 );
|
||||
|
||||
|
||||
if ( $aYearAgo->getTimeStamp() > $oldestStamp )
|
||||
{
|
||||
$dates['year'] = $aYearAgo;
|
||||
$dates[ 'year' ] = $aYearAgo;
|
||||
}
|
||||
|
||||
|
||||
if ( $month->getTimeStamp() > $oldestStamp )
|
||||
{
|
||||
$dates['month'] = $month;
|
||||
$dates[ 'month' ] = $month;
|
||||
}
|
||||
|
||||
|
||||
if ( $week->getTimeStamp() > $oldestStamp )
|
||||
{
|
||||
$dates['week'] = $week;
|
||||
$dates[ 'week' ] = $week;
|
||||
}
|
||||
|
||||
|
||||
if ( $today->getTimeStamp() > $oldestStamp )
|
||||
{
|
||||
$dates['today'] = $today;
|
||||
$dates[ 'today' ] = $today;
|
||||
}
|
||||
|
||||
|
||||
/* Got a date? */
|
||||
if ( isset( \IPS\Request::i()->time ) and isset( $dates[ \IPS\Request::i()->time ] ) )
|
||||
{
|
||||
$date = $dates[ \IPS\Request::i()->time ];
|
||||
}
|
||||
else if ( isset( $dates['month'] ) )
|
||||
else if ( isset( $dates[ 'month' ] ) )
|
||||
{
|
||||
/* Set the default to month */
|
||||
\IPS\Request::i()->time = 'month';
|
||||
$date = $dates['month'];
|
||||
$date = $dates[ 'month' ];
|
||||
}
|
||||
|
||||
|
||||
/* Applications */
|
||||
$classes = array();
|
||||
foreach ( \IPS\Application::allExtensions( 'core', 'ContentRouter', TRUE ) as $object )
|
||||
{
|
||||
$classes = array_merge( $object->classes, $classes );
|
||||
}
|
||||
|
||||
|
||||
$areas = array();
|
||||
foreach( $classes as $item )
|
||||
foreach ( $classes as $item )
|
||||
{
|
||||
$commentClass = NULL;
|
||||
$reviewClass = NULL;
|
||||
|
||||
if ( in_array( 'IPS\Content\Reputation', class_implements( $item ) ) and isset( $item::$reputationType ) )
|
||||
|
||||
if ( \IPS\IPS::classUsesTrait( $item, 'IPS\Content\Reactable' ) )
|
||||
{
|
||||
$areas[ $item::$application . '-' . $item::$reputationType ] = array( $item, \IPS\Member::loggedIn()->language()->addToStack("{$item::$title}_pl") );
|
||||
$areas[ $item::$application . '-' . $item::reactionType() ] = array( $item, \IPS\Member::loggedIn()->language()->addToStack( "{$item::$title}_pl" ) );
|
||||
}
|
||||
|
||||
if ( isset( $item::$commentClass ) )
|
||||
{
|
||||
$commentClass = $item::$commentClass;
|
||||
if ( in_array( 'IPS\Content\Reputation', class_implements( $commentClass ) ) and isset( $commentClass::$reputationType ) )
|
||||
if ( \IPS\IPS::classUsesTrait( $commentClass, 'IPS\Content\Reactable' ) )
|
||||
{
|
||||
$areas[ $item::$application . '-' . $commentClass::$reputationType ] = array( $commentClass, \IPS\Member::loggedIn()->language()->addToStack("{$commentClass::$title}_pl") );
|
||||
$areas[ $item::$application . '-' . $commentClass::reactionType() ] = array( $commentClass, \IPS\Member::loggedIn()->language()->addToStack( "{$commentClass::$title}_pl" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( isset( $item::$reviewClass ) )
|
||||
{
|
||||
$reviewClass = $item::$reviewClass;
|
||||
if ( in_array( 'IPS\Content\Reputation', class_implements( $reviewClass ) ) and isset( $reviewClass::$reputationType ) )
|
||||
if ( \IPS\IPS::classUsesTrait( $reviewClass, 'IPS\Content\Reactable' ) )
|
||||
{
|
||||
$areas[ $item::$application . '-' . $reviewClass::$reputationType ] = array( $reviewClass, \IPS\Member::loggedIn()->language()->addToStack("{$reviewClass::$title}_pl") );
|
||||
$areas[ $item::$application . '-' . $reviewClass::reactionType() ] = array( $reviewClass, \IPS\Member::loggedIn()->language()->addToStack( "{$reviewClass::$title}_pl" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form('popular_date', 'continue');
|
||||
$form = new \IPS\Helpers\Form( 'popular_date', 'continue' );
|
||||
$form->class = 'ipsForm_vertical';
|
||||
$customStart = isset( \IPS\Request::i()->custom_date_start ) ? \IPS\Request::i()->custom_date_start : NULL;
|
||||
$customEnd = isset( \IPS\Request::i()->custom_date_end ) ? \IPS\Request::i()->custom_date_end : NULL;
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\DateRange( 'custom_date', array( 'start' => $customStart, 'end' => $customEnd ), FALSE, array( 'start' => array( 'min' => $dates['oldest'], 'time' => false ) ) ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\DateRange( 'custom_date', array( 'start' => $customStart, 'end' => $customEnd ), FALSE, array( 'start' => array( 'min' => $dates[ 'oldest' ], 'time' => false ) ) ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$url = \IPS\Request::i()->url()->stripQueryString('time');
|
||||
|
||||
if ( isset( $values['custom_date']['start'] ) and $values['custom_date']['start'] instanceof \IPS\DateTime )
|
||||
$url = \IPS\Request::i()->url()->stripQueryString( 'time' );
|
||||
|
||||
if ( isset( $values[ 'custom_date' ][ 'start' ] ) and $values[ 'custom_date' ][ 'start' ] instanceof \IPS\DateTime )
|
||||
{
|
||||
$url = $url->setQueryString( 'custom_date_start', $values['custom_date']['start']->getTimeStamp() );
|
||||
$url = $url->setQueryString( 'custom_date_start', $values[ 'custom_date' ][ 'start' ]->getTimeStamp() );
|
||||
}
|
||||
|
||||
if ( isset( $values['custom_date']['end'] ) and $values['custom_date']['end'] instanceof \IPS\DateTime )
|
||||
|
||||
if ( isset( $values[ 'custom_date' ][ 'end' ] ) and $values[ 'custom_date' ][ 'end' ] instanceof \IPS\DateTime )
|
||||
{
|
||||
$url = $url->setQueryString( 'custom_date_end', $values['custom_date']['end']->getTimeStamp() );
|
||||
$url = $url->setQueryString( 'custom_date_end', $values[ 'custom_date' ][ 'end' ]->getTimeStamp() );
|
||||
}
|
||||
|
||||
|
||||
\IPS\Output::i()->redirect( $url );
|
||||
}
|
||||
else
|
||||
@@ -390,20 +313,30 @@ class _popular extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$date = \IPS\DateTime::ts( $customStart )->setTimezone( $timezone )->setTime( 0, 0, 1 );
|
||||
}
|
||||
|
||||
|
||||
if ( $customEnd )
|
||||
{
|
||||
$endDate = \IPS\DateTime::ts( $customEnd )->setTimezone( $timezone )->setTime( 23, 59, 59 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Got an app? */
|
||||
$appWhere = '';
|
||||
|
||||
if ( isset( \IPS\Request::i()->in ) and isset( $areas[ \IPS\Request::i()->in ] ) )
|
||||
{
|
||||
$appWhere = " AND rep_class='" . \IPS\Db::i()->escape_string( $areas[ \IPS\Request::i()->in ][0] ) . "'";
|
||||
$descApp = \IPS\Member::loggedIn()->language()->addToStack('leaderboard_in_app', NULL, array( 'sprintf' => array( $areas[ \IPS\Request::i()->in ][1] ) ) );
|
||||
$appWhere = " AND rep_class='" . \IPS\Db::i()->escape_string( $areas[ \IPS\Request::i()->in ][ 0 ] ) . "'";
|
||||
$descApp = \IPS\Member::loggedIn()->language()->addToStack( 'leaderboard_in_app', NULL, array( 'sprintf' => array( $areas[ \IPS\Request::i()->in ][ 1 ] ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$repAreas = array();
|
||||
foreach( $areas as $area )
|
||||
{
|
||||
$repAreas[] = $area[0] ;
|
||||
}
|
||||
|
||||
$appWhere = " AND " . \IPS\Db::i()->in( 'rep_class', $repAreas );
|
||||
}
|
||||
|
||||
$storeKey = NULL;
|
||||
@@ -432,27 +365,16 @@ class _popular extends \IPS\Dispatcher\Controller
|
||||
\IPS\Data\Store::i()->$storeKey = array( 'time' => time(), 'hashes' => array() );
|
||||
}
|
||||
|
||||
$testFirst = iterator_to_array( \IPS\Db::i()->select( 'class_type_id_hash', 'core_reputation_index', array( 'rep_date BETWEEN ' . $date->getTimeStamp() . ' AND ' . $endDate->getTimeStamp() . $appWhere ), NULL, NULL, 'class_type_id_hash' ) );
|
||||
$searchWhere = array( array( "( si.index_permissions = '*' OR " . \IPS\Db::i()->findInSet( 'si.index_permissions', \IPS\Member::loggedIn()->groups ) . ' AND si.index_hidden=0 )' ) );
|
||||
/* Get rep hashes */
|
||||
$inner = \IPS\Db::i()->select( 'class_type_id_hash, SUM(rep_rating) as total_rep', array( 'core_reputation_index', 'x' ), array( 'rep_date BETWEEN ' . $date->getTimeStamp() . ' AND ' . $endDate->getTimeStamp() . $appWhere ), NULL, NULL, 'class_type_id_hash' );
|
||||
$repHashes = iterator_to_array( \IPS\Db::i()->select( 'class_type_id_hash, total_rep', $inner, NULL, 'x.total_rep desc', array( 0, 500 ) )->setKeyField('class_type_id_hash') );
|
||||
|
||||
/* Now filter through permissions */
|
||||
$searchHashes = iterator_to_array( \IPS\Db::i()->select( 'index_class_type_id_hash', array( 'core_search_index', 'si' ), array( array( "( si.index_permissions = '*' OR " . \IPS\Db::i()->findInSet( 'si.index_permissions', \IPS\Member::loggedIn()->groups ) . ' AND si.index_hidden=0 )' ), array( \IPS\Db::i()->in( 'si.index_class_type_id_hash', array_keys( $repHashes ) ) ) ) )->setKeyField('index_class_type_id_hash') );
|
||||
|
||||
if ( count( $testFirst ) < 501 )
|
||||
{
|
||||
/* We can use an IN() to make this a bit more efficient */
|
||||
$repQuery = \IPS\Db::i()->select( 'class_type_id_hash, SUM(rep_rating) as total_rep', 'core_reputation_index', \IPS\Db::i()->in( 'class_type_id_hash', array_values( $testFirst ) ), NULL, NULL, 'class_type_id_hash' );
|
||||
|
||||
$searchWhere[] = array( \IPS\Db::i()->in( 'si.index_class_type_id_hash', array_values( $testFirst ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$repQuery = \IPS\Db::i()->select( 'class_type_id_hash, SUM(rep_rating) as total_rep', 'core_reputation_index', array( 'rep_date BETWEEN ' . $date->getTimeStamp() . ' AND ' . $endDate->getTimeStamp() . $appWhere ), NULL, NULL, 'class_type_id_hash' );
|
||||
}
|
||||
/* Filter out rep hashes not in search results */
|
||||
$hashes = array_slice( array_intersect_key( $repHashes, $searchHashes ), 0, 50 );
|
||||
|
||||
$searchQuery = \IPS\Db::i()->select( 'index_class_type_id_hash', array( 'core_search_index', 'si' ), $searchWhere );
|
||||
|
||||
$hashes = iterator_to_array(
|
||||
\IPS\Db::i()->select( 'class_type_id_hash, total_rep', array( $repQuery, 'ri' ), array( 'class_type_id_hash IN(?)', $searchQuery ), 'total_rep DESC', array( 0, 50 ) )->setKeyField('class_type_id_hash')
|
||||
);
|
||||
|
||||
if ( $storeKey )
|
||||
{
|
||||
\IPS\Data\Store::i()->$storeKey = array( 'time' => time(), 'hashes' => $hashes );
|
||||
@@ -557,6 +479,8 @@ class _popular extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
catch( \Exception $ex ) { }
|
||||
|
||||
\IPS\Output::i()->linkTags['canonical'] = (string) \IPS\Http\Url::internal( "app=core&module=discover&controller=popular&tab=leaderboard", 'front', 'leaderboard_leaderboard' );
|
||||
|
||||
/* Display */
|
||||
return \IPS\Theme::i()->getTemplate('popular')->popularWrapper( $results, $areas, $topContributors, $dates, $description, $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'forms', 'core' ) ), 'popupTemplate' ) ), $tzOffsetDifference );
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief rss
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
|
||||
* @since 13 Oct 2016
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\front\discover;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief streams
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 02 Jul 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\front\discover;
|
||||
@@ -178,6 +177,7 @@ class _streams extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Start with a blank stream */
|
||||
$stream = \IPS\core\Stream::allActivityStream();
|
||||
$stream->default_view = "expanded";
|
||||
|
||||
/* Set the title to "All Activity" */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('all_activity');
|
||||
@@ -187,7 +187,7 @@ class _streams extends \IPS\Dispatcher\Controller
|
||||
/* but only if we haven't submitted the form on this request */
|
||||
if( !\IPS\Request::i()->stream_submitted )
|
||||
{
|
||||
$streamFields = array( 'include_comments', 'classes', 'ownership', 'custom_members', 'read', 'follow', 'followed_types', 'date_type', 'date_start', 'date_end', 'date_relative_days', 'sort', 'tags', 'unread_links' );
|
||||
$streamFields = array( 'include_comments', 'classes', 'clubs', 'ownership', 'custom_members', 'read', 'follow', 'followed_types', 'date_type', 'date_start', 'date_end', 'date_relative_days', 'sort', 'tags', 'unread_links' );
|
||||
|
||||
/* Build and format field values */
|
||||
$_values = array();
|
||||
@@ -220,6 +220,11 @@ class _streams extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $_values['stream_club_filter'] ) and !isset( $_values['stream_club_select'] ) )
|
||||
{
|
||||
$_values['stream_club_select'] = 'select';
|
||||
}
|
||||
|
||||
$formattedValues = $stream->formatFormValues( $_values );
|
||||
|
||||
/* Overwrite stream config if present in the request */
|
||||
@@ -227,7 +232,7 @@ class _streams extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$requestKey = 'stream_' . $k;
|
||||
|
||||
if ( isset( \IPS\Request::i()->$requestKey ) )
|
||||
if ( isset( \IPS\Request::i()->$requestKey ) or ( $k === 'clubs' and ( isset( \IPS\Request::i()->stream_club_select ) or isset( \IPS\Request::i()->stream_club_filter ) ) ) )
|
||||
{
|
||||
if ( $stream->$k != $formattedValues[ $k ] )
|
||||
{
|
||||
@@ -341,7 +346,7 @@ class _streams extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/* Is anything turned on? */
|
||||
$extra = array();
|
||||
foreach ( array( 'register', 'follow_member', 'follow_content', 'photo', 'like', 'rep_neg' ) as $k )
|
||||
foreach ( array( 'register', 'follow_member', 'follow_content', 'photo', 'like', 'react', 'clubs' ) as $k )
|
||||
{
|
||||
$key = "all_activity_{$k}";
|
||||
if ( \IPS\Settings::i()->$key )
|
||||
@@ -594,7 +599,7 @@ class _streams extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$url = $stream ? $stream->baseUrl->setQueryString( 'className', $class ) : \IPS\Request::i()->url()->setQueryString( 'className', $class );
|
||||
$containerClass = $class::$containerNodeClass;
|
||||
$field = new \IPS\Helpers\Form\Node( 'stream_containers_' . $class::$title, isset( $currentContainers[ $class ] ) ? $currentContainers[ $class ] : array(), NULL, array( 'url' => $url, 'class' => $class::$containerNodeClass, 'multiple' => TRUE, 'permissionCheck' => $containerClass::searchableNodesPermission() ), NULL, NULL, NULL, 'stream_containers_' . $class::$title );
|
||||
$field = new \IPS\Helpers\Form\Node( 'stream_containers_' . $class::$title, isset( $currentContainers[ $class ] ) ? $currentContainers[ $class ] : array(), NULL, array( 'url' => $url, 'class' => $class::$containerNodeClass, 'multiple' => TRUE, 'permissionCheck' => $containerClass::searchableNodesPermission(), 'clubs' => \IPS\IPS::classUsesTrait( $containerClass, 'IPS\Content\ClubContainer' ) ), NULL, NULL, NULL, 'stream_containers_' . $class::$title );
|
||||
$field->label = \IPS\Member::loggedIn()->language()->addToStack( 'stream_narrow_by_container_label', NULL, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->addToStack( $containerClass::$nodeTitle ) ) ) );
|
||||
|
||||
return \IPS\Output::i()->json( array( 'node' => \IPS\Theme::i()->getTemplate('streams')->filterFormContentTypeContent( $field, $class, \IPS\Request::i()->key ) ) );
|
||||
@@ -604,6 +609,47 @@ class _streams extends \IPS\Dispatcher\Controller
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the club selector form element HTML
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getClubElement()
|
||||
{
|
||||
$clubOptions = array();
|
||||
foreach ( \IPS\Member\Club::clubs( \IPS\Member::loggedIn(), NULL, 'name', TRUE ) as $club )
|
||||
{
|
||||
$clubOptions[ "c{$club->id}" ] = $club->name;
|
||||
}
|
||||
|
||||
if ( isset( \IPS\Request::i()->stream_club_select ) )
|
||||
{
|
||||
switch ( \IPS\Request::i()->stream_club_select )
|
||||
{
|
||||
case 'all':
|
||||
$value = 0;
|
||||
break;
|
||||
|
||||
case 'none':
|
||||
$value = array();
|
||||
break;
|
||||
|
||||
default:
|
||||
$value = explode( ',', \IPS\Request::i()->stream_club_filter );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$value = 0;
|
||||
}
|
||||
|
||||
$field = new \IPS\Helpers\Form\Select( 'stream_club_filter_dummy', $value, FALSE, array( 'options' => $clubOptions, 'parse' => 'normal', 'multiple' => TRUE, 'noDefault' => TRUE, 'unlimited' => 0, 'unlimitedLang' => 'stream_club_select_all' ), NULL, NULL, NULL, 'stream_club_filter' );
|
||||
$field->label = \IPS\Member::loggedIn()->language()->addToStack('stream_club_filter');
|
||||
|
||||
return \IPS\Output::i()->json( array( 'field' => \IPS\Theme::i()->getTemplate('streams')->filterFormClubs( $field ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Build form
|
||||
*
|
||||
@@ -650,7 +696,7 @@ class _streams extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$formattedValues = $stream->formatFormValues( $values );
|
||||
|
||||
foreach ( array( 'include_comments', 'classes', 'containers', 'ownership', 'custom_members', 'read', 'follow', 'followed_types', 'date_type', 'date_start', 'date_end', 'date_relative_days', 'sort', 'tags', 'unread_links' ) as $k )
|
||||
foreach ( array( 'include_comments', 'classes', 'containers', 'clubs', 'ownership', 'custom_members', 'read', 'follow', 'followed_types', 'date_type', 'date_start', 'date_end', 'date_relative_days', 'sort', 'tags', 'unread_links' ) as $k )
|
||||
{
|
||||
$requestKey = 'stream_' . $k;
|
||||
if ( isset( $formattedValues[ $k ] ) AND $stream->$k != $formattedValues[ $k ] )
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Profile
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 19 Jul 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\front\members;
|
||||
@@ -171,6 +170,12 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
|
||||
/* What tabs are available? */
|
||||
$tabs = array( 'activity' => 'users_activity_feed' );
|
||||
|
||||
if ( \IPS\Settings::i()->clubs )
|
||||
{
|
||||
$tabs['clubs'] = 'users_clubs';
|
||||
}
|
||||
|
||||
foreach( $mainFields as $group => $fields )
|
||||
{
|
||||
foreach( $fields as $field => $value )
|
||||
@@ -262,6 +267,27 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
|
||||
$tabContents = \IPS\Theme::i()->getTemplate( 'profile' )->profileActivity( $this->member, $latestActivity, $statusForm );
|
||||
}
|
||||
elseif ( $tab == 'clubs' )
|
||||
{
|
||||
if ( !\IPS\Settings::i()->clubs )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_module_permission', '2C138/J', 403, '' );
|
||||
}
|
||||
|
||||
/* Get All User Clubs */
|
||||
$baseUrl = \IPS\Request::i()->url()->setQueryString('tab', 'clubs');
|
||||
$perPage = 24;
|
||||
$page = isset( \IPS\Request::i()->page ) ? intval( \IPS\Request::i()->page ) : 1;
|
||||
$allClubs = \IPS\Member\Club::clubs( \IPS\Member::loggedIn(), array( ( $page - 1 ) * $perPage, $perPage ), 'last_activity', $this->member );
|
||||
$pagination = \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->pagination( $baseUrl, ceil( $allClubs->count( TRUE ) / $perPage ), $page, $perPage );
|
||||
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/clubs.css', 'core', 'front' ) );
|
||||
if ( \IPS\Theme::i()->settings['responsive'] )
|
||||
{
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/clubs_responsive.css', 'core', 'front' ) );
|
||||
}
|
||||
$tabContents = \IPS\Theme::i()->getTemplate( 'profile' )->profileClubs( $this->member, $allClubs, $pagination );
|
||||
}
|
||||
elseif ( mb_substr( $tab, 0, 6 ) == 'field_' )
|
||||
{
|
||||
$fieldId = mb_substr( $tab, 6 );
|
||||
@@ -344,6 +370,39 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
{
|
||||
$addWarningUrl = $addWarningUrl->setQueryString( 'ref', \IPS\Request::i()->wr );
|
||||
}
|
||||
|
||||
/* Set JSON-LD output */
|
||||
\IPS\Output::i()->jsonLd['profile'] = array(
|
||||
'@context' => "http://schema.org",
|
||||
'@type' => "ProfilePage",
|
||||
'url' => (string) $this->member->url(),
|
||||
'name' => htmlspecialchars( $this->member->name, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
|
||||
'primaryImageOfPage' => array(
|
||||
'@type' => "ImageObject",
|
||||
'contentUrl' => (string) $this->member->get_photo(),
|
||||
'representativeOfPage' => true,
|
||||
'thumbnail' => array(
|
||||
'@type' => "ImageObject",
|
||||
'contentUrl' => (string) $this->member->get_photo( TRUE ),
|
||||
)
|
||||
),
|
||||
'thumbnailUrl' => (string) $this->member->get_photo( TRUE ),
|
||||
'image' => (string) $this->member->get_photo(),
|
||||
'relatedLink' => (string) \IPS\Http\Url::internal( "app=core&module=members&controller=profile&do=content&id={$this->member->member_id}", "front", "profile_content", array( $this->member->members_seo_name ) ),
|
||||
'dateCreated' => $this->member->joined->format( \IPS\DateTime::ISO8601 ),
|
||||
'interactionStatistic' => array(
|
||||
array(
|
||||
"@type" => "InteractionCounter",
|
||||
"interactionType" => "http://schema.org/CommentAction",
|
||||
'userInteractionCount' => $this->member->member_posts
|
||||
),
|
||||
array(
|
||||
"@type" => "InteractionCounter",
|
||||
"interactionType" => "http://schema.org/ViewAction",
|
||||
'userInteractionCount' => $this->member->members_profile_views
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
/* Output */
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_profile.js', 'core' ) );
|
||||
@@ -507,7 +566,8 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
else
|
||||
{
|
||||
/* Display */
|
||||
$title = ( isset( \IPS\Request::i()->page ) and \IPS\Request::i()->page > 1 ) ? \IPS\Member::loggedIn()->language()->addToStack( 'title_with_page_number', FALSE, array( 'sprintf' => array( $this->member->name, \IPS\Request::i()->page ) ) ) : $this->member->name;
|
||||
$profileTitle = \IPS\Member::loggedIn()->language()->addToStack( 'members_content', FALSE, array( 'sprintf' => array( $this->member->name ) ) );
|
||||
$title = ( isset( \IPS\Request::i()->page ) and \IPS\Request::i()->page > 1 ) ? \IPS\Member::loggedIn()->language()->addToStack( 'title_with_page_number', FALSE, array( 'sprintf' => array( $profileTitle, \IPS\Request::i()->page ) ) ) : $profileTitle;
|
||||
\IPS\Output::i()->title = $title;
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/statuses.css' ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'profile' )->userContent( $this->member, $types, $currentAppModule, $currentType, (string) $output );
|
||||
@@ -533,22 +593,22 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
{
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'profile.css', $class::$application ) );
|
||||
|
||||
if ( in_array( 'IPS\Content\Reputation', class_implements( $class ) ) )
|
||||
if ( \IPS\IPS::classUsesTrait( $class, 'IPS\Content\Reactable' ) )
|
||||
{
|
||||
$types[ $class::$application . '_' . $class::$module ][ mb_strtolower( str_replace( '\\', '_', mb_substr( $class, 4 ) ) ) ] = $class;
|
||||
}
|
||||
|
||||
if ( isset( $class::$commentClass ) and in_array( 'IPS\Content\Reputation', class_implements( $class::$commentClass ) ) )
|
||||
if ( isset( $class::$commentClass ) and \IPS\IPS::classUsesTrait( $class::$commentClass, 'IPS\Content\Reactable' ) )
|
||||
{
|
||||
$types[ $class::$application . '_' . $class::$module ][ mb_strtolower( str_replace( '\\', '_', mb_substr( $class::$commentClass, 4 ) ) ) ] = $class::$commentClass;
|
||||
}
|
||||
|
||||
if ( isset( $class::$reviewClass ) and in_array( 'IPS\Content\Reputation', class_implements( $class::$reviewClass ) ) )
|
||||
if ( isset( $class::$reviewClass ) and \IPS\IPS::classUsesTrait( $class::$reviewClass, 'IPS\Content\Reactable' ) )
|
||||
{
|
||||
$types[ $class::$application . '_' . $class::$module ][ mb_strtolower( str_replace( '\\', '_', mb_substr( $class::$reviewClass, 4 ) ) ) ] = $class::$reviewClass;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* What type are we looking at? */
|
||||
$currentAppModule = NULL;
|
||||
$currentType = NULL;
|
||||
@@ -589,9 +649,9 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
$table->sortBy = 'rep_date';
|
||||
$table->joins = array(
|
||||
array(
|
||||
'select' => "core_reputation_index.id AS rep_id, core_reputation_index.rep_date, core_reputation_index.rep_rating, core_reputation_index.member_received as rep_member_received, core_reputation_index.member_id as rep_member",
|
||||
'select' => "core_reputation_index.id AS rep_id, core_reputation_index.rep_date, core_reputation_index.rep_rating, core_reputation_index.member_received as rep_member_received, core_reputation_index.member_id as rep_member, core_reputation_index.reaction as rep_reaction",
|
||||
'from' => 'core_reputation_index',
|
||||
'where' => array( "core_reputation_index.type_id=" . $currentClass::$databaseTable . "." . $currentClass::$databasePrefix . $currentClass::$databaseColumnId . " AND ( core_reputation_index.member_id=? OR core_reputation_index.member_received=? ) AND core_reputation_index.app=? AND core_reputation_index.type=?", $this->member->member_id, $this->member->member_id, $currentClass::$application, $currentClass::$reputationType ),
|
||||
'where' => array( "core_reputation_index.type_id=" . $currentClass::$databaseTable . "." . $currentClass::$databasePrefix . $currentClass::$databaseColumnId . " AND ( core_reputation_index.member_id=? OR core_reputation_index.member_received=? ) AND core_reputation_index.app=? AND core_reputation_index.type=?", $this->member->member_id, $this->member->member_id, $currentClass::$application, $currentClass::reactionType() ),
|
||||
'type' => 'INNER'
|
||||
)
|
||||
);
|
||||
@@ -728,8 +788,12 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
|
||||
/* Set Session Location */
|
||||
\IPS\Session::i()->setLocation( $this->member->url(), array(), 'loc_editing_profile', array( $this->member->name => FALSE ) );
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
|
||||
if( !count( $form->elements ) )
|
||||
{
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->genericBlock( \IPS\Member::loggedIn()->language()->addToStack( 'profile_nothing_to_edit' ), NULL, 'ipsPad' );
|
||||
}
|
||||
else if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->output = $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'forms', 'core' ) ), 'popupTemplate' ) );
|
||||
}
|
||||
@@ -754,7 +818,16 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
|
||||
/* The basics */
|
||||
$form->addTab( 'profile_edit_basic_tab', 'user');
|
||||
$form->addHeader( 'profile_edit_basic_header' );
|
||||
|
||||
$canChangeTitle = ( \IPS\Settings::i()->post_titlechange != -1 and ( isset( \IPS\Settings::i()->post_titlechange ) and $this->member->member_posts >= \IPS\Settings::i()->post_titlechange ) );
|
||||
$canChangeBirthday = ( \IPS\Settings::i()->profile_birthday_type !== 'none' );
|
||||
$canEnableDisableStatuses = ( \IPS\Settings::i()->profile_comments and $this->member->canAccessModule( \IPS\Application\Module::get( 'core', 'status' ) ) AND !$this->member->members_bitoptions['bw_no_status_update'] );
|
||||
|
||||
if( $canChangeTitle or $canChangeBirthday or $canEnableDisableStatuses )
|
||||
{
|
||||
$form->addHeader( 'profile_edit_basic_header' );
|
||||
}
|
||||
|
||||
if( \IPS\Settings::i()->post_titlechange != -1 and ( isset( \IPS\Settings::i()->post_titlechange ) and $this->member->member_posts >= \IPS\Settings::i()->post_titlechange ) )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'member_title', $this->member->member_title, FALSE, array( 'maxLength' => 64 ) ) );
|
||||
@@ -770,7 +843,22 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
'YY' => \IPS\Theme::i()->getTemplate( 'members', 'core', 'global' )->bdayForm_year( $element->name, $element->value, $element->error ),
|
||||
'YYYY' => \IPS\Theme::i()->getTemplate( 'members', 'core', 'global' )->bdayForm_year( $element->name, $element->value, $element->error ),
|
||||
) );
|
||||
} ) ) );
|
||||
} ), function( $val )
|
||||
{
|
||||
$date = $val['day'];
|
||||
$month = $val['month'];
|
||||
$year = $val['year'];
|
||||
|
||||
try
|
||||
{
|
||||
new \IPS\DateTime( $year."-".$month."-" . $date );
|
||||
}
|
||||
catch ( \Exception $e)
|
||||
{
|
||||
throw new \InvalidArgumentException( 'invalid_bdate') ;
|
||||
}
|
||||
}
|
||||
) );
|
||||
if ( \IPS\Settings::i()->profile_birthday_type == 'private' )
|
||||
{
|
||||
$form->addMessage( 'profile_birthday_display_private', 'ipsMessage ipsMessage_info' );
|
||||
@@ -933,6 +1021,9 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
$this->member->signature = $values['signature'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Reset Profile Complete flag in case this was an optional step */
|
||||
$this->member->members_bitoptions['profile_completed'] = FALSE;
|
||||
|
||||
/* Save */
|
||||
\IPS\Db::i()->replace( 'core_pfields_content', $profileFields );
|
||||
@@ -959,7 +1050,7 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
$toggles = array( 'custom' => array( 'member_photo_upload' ), 'url' => array( 'member_photo_url' ) );
|
||||
$extra = array();
|
||||
$options = array();
|
||||
$defaultType = $this->member->pp_photo_type;
|
||||
$defaultType = ( $this->member->pp_photo_type == 'letter' ) ? 'none' : $this->member->pp_photo_type;
|
||||
|
||||
/* Can we upload? */
|
||||
if ( $photoVars[0] )
|
||||
@@ -996,8 +1087,21 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
}
|
||||
}
|
||||
|
||||
/* And of course we can always not have a photo */
|
||||
$options['none'] = 'member_photo_none';
|
||||
/* And of course we can always not have a photo... except when we can't */
|
||||
$photoRequired = FALSE;
|
||||
foreach( \IPS\Member\ProfileStep::loadAll() AS $step )
|
||||
{
|
||||
if ( $step->completion_act === 'photo' AND $step->required )
|
||||
{
|
||||
$photoRequired = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $photoRequired === FALSE )
|
||||
{
|
||||
$options['none'] = 'member_photo_none';
|
||||
}
|
||||
|
||||
/* iOS doesn't like upload forms being hidden by a toggle; and it makes sense if we do not have a profile photo to show the upload as the selected option */
|
||||
if ( $defaultType == 'none' and $photoVars[0] )
|
||||
@@ -1084,6 +1188,7 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
break;
|
||||
|
||||
case 'none':
|
||||
$this->member->pp_photo_type = NULL;
|
||||
$this->member->pp_main_photo = NULL;
|
||||
$this->member->members_bitoptions['bw_disable_gravatar'] = 1;
|
||||
$this->member->photo_last_update = NULL;
|
||||
@@ -1101,6 +1206,9 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
$obj->save( array( 'profilesync_photo' => TRUE ) );
|
||||
}
|
||||
}
|
||||
|
||||
/* Reset Profile Complete flag in case this was an optional step */
|
||||
$this->member->members_bitoptions['profile_completed'] = FALSE;
|
||||
|
||||
$this->member->save();
|
||||
|
||||
@@ -1273,31 +1381,42 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Rep Status/Comment
|
||||
* React to a status / comment
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function rep()
|
||||
{
|
||||
protected function react()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
try
|
||||
{
|
||||
$item = ( \IPS\Request::i()->type == 'status' ) ? \IPS\core\Statuses\Status::load( \IPS\Request::i()->status ) : \IPS\core\Statuses\Reply::load( \IPS\Request::i()->reply );
|
||||
|
||||
$type = intval( \IPS\Request::i()->rep ) === 1 ? 1 : -1;
|
||||
$item->giveReputation( $type );
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
|
||||
if ( !isset( \IPS\Request::i()->reaction ) )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->reputationMini( $item->reputation(), $item->canGiveReputation( 1 ), $item->canGiveReputation( -1 ), $item->url('showRep'), $item->url('rep') ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->reputationMini( $item );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( $item->url() );
|
||||
$item->react( \IPS\Content\Reaction::load( \IPS\Request::i()->reaction ) );
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->json( array(
|
||||
'status' => 'ok',
|
||||
'count' => count( $item->reactions() ),
|
||||
'score' => $item->reactionCount(),
|
||||
'blurb' => ( \IPS\Settings::i()->reaction_count_display == 'count' ) ? '' : \IPS\Theme::i()->getTemplate( 'global', 'core' )->reactionBlurb( $item )
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( $item->url() );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( \DomainException $e )
|
||||
catch( \DomainException $e )
|
||||
{
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
@@ -1305,27 +1424,100 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->error( $e->getMessage(), '1C138/2', 403, '' );
|
||||
\IPS\Output::i()->error( $e->getMessage(), '1C138/H', 403, '' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show Comment/Review Rep
|
||||
* Unreact to a status / comment
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function showRep()
|
||||
protected function unreact()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
try
|
||||
{
|
||||
$item = ( \IPS\Request::i()->type == 'status' ) ? \IPS\core\Statuses\Status::load( \IPS\Request::i()->status ) : \IPS\core\Statuses\Reply::load( \IPS\Request::i()->reply );
|
||||
$item->removeReaction();
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->json( array(
|
||||
'status' => 'ok',
|
||||
'count' => count( $item->reactions() ),
|
||||
'score' => $item->reactionCount(),
|
||||
'blurb' => ( \IPS\Settings::i()->reaction_count_display == 'count' ) ? '' : \IPS\Theme::i()->getTemplate( 'global', 'core' )->reactionBlurb( $item )
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( $item->url() );
|
||||
}
|
||||
}
|
||||
catch( \DomainException $e )
|
||||
{
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->json( array( 'error' => \IPS\Member::loggedIn()->language()->addToStack( $e->getMessage() ) ), 403 );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->error( $e->getMessage(), '1C138/I', 403, '' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show Reactions
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function showReactions()
|
||||
{
|
||||
try
|
||||
{
|
||||
$item = ( \IPS\Request::i()->type == 'status' ) ? \IPS\core\Statuses\Status::load( \IPS\Request::i()->status ) : \IPS\core\Statuses\Reply::load( \IPS\Request::i()->reply );
|
||||
|
||||
\IPS\Output::i()->output = $item->reputationTable();
|
||||
|
||||
$tabs = array();
|
||||
$tabs['all'] = \IPS\Member::loggedIn()->language()->addToStack('all');
|
||||
foreach( \IPS\Content\Reaction::roots() AS $reaction )
|
||||
{
|
||||
$tabs[ $reaction->id ] = $reaction->_title;
|
||||
}
|
||||
|
||||
$activeTab = 'all';
|
||||
if ( isset( \IPS\Request::i()->reaction ) )
|
||||
{
|
||||
$activeTab = \IPS\Request::i()->reaction;
|
||||
}
|
||||
|
||||
$url = $item->url('showReactions');
|
||||
$url = $url->setQueryString( 'changed', 1 );
|
||||
|
||||
if ( $activeTab !== 'all' )
|
||||
{
|
||||
$url = $url->setQueryString( 'reaction', $activeTab );
|
||||
}
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() AND isset( \IPS\Request::i()->changed ) )
|
||||
{
|
||||
\IPS\Output::i()->output = $item->reactionTable( $activeTab !== 'all' ? $activeTab : NULL, $url, 'reaction', FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->tabs( $tabs, $activeTab, $item->reactionTable( $activeTab !== 'all' ? $activeTab : NULL ), $url, 'reaction', FALSE );
|
||||
}
|
||||
}
|
||||
catch ( \LogicException $e )
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'cannot_view_reputation', '2C138/8', 403, '' );
|
||||
\IPS\Output::i()->error( 'node_error', '2S136/18', 404, '' );
|
||||
}
|
||||
catch( \DomainException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_module_permission', '2S136/19', 403, '' );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1442,6 +1634,10 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
|
||||
$this->member->pp_cover_photo = (string) $photo->file;
|
||||
$this->member->pp_cover_offset = (int) $photo->offset;
|
||||
|
||||
/* Reset Profile Complete flag in case this was an optional step */
|
||||
$this->member->members_bitoptions['profile_completed'] = FALSE;
|
||||
|
||||
$this->member->save();
|
||||
}
|
||||
|
||||
@@ -1454,12 +1650,20 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_module_permission', '1C138/G', 403, '' );
|
||||
}
|
||||
$table = new \IPS\Helpers\Table\Db( 'core_dnames_change', $this->member->url()->setQueryString( 'do', 'namehistory' ), array( 'dname_member_id=?', $this->member->member_id ) );
|
||||
$table->tableTemplate = array( \IPS\Theme::i()->getTemplate( 'profile' ), 'nameHistoryTable' );
|
||||
$table->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'profile' ), 'nameHistoryRows' );
|
||||
$table->sortBy = 'dname_date';
|
||||
|
||||
$table = new \IPS\Helpers\Table\Db( 'core_member_history', $this->member->url()->setQueryString( 'do', 'namehistory' ), array( 'log_member=? AND log_app=? AND log_type=?', $this->member->member_id, 'core', 'display_name' ) );
|
||||
$table->tableTemplate = array( \IPS\Theme::i()->getTemplate( 'members', 'core', 'global' ), 'nameHistoryTable' );
|
||||
$table->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'members', 'core', 'global' ), 'nameHistoryRows' );
|
||||
$table->sortBy = 'log_date';
|
||||
$table->sortDirection = 'desc';
|
||||
|
||||
$table->parsers = array(
|
||||
'log_data' => function( $val )
|
||||
{
|
||||
return json_decode( $val, TRUE );
|
||||
}
|
||||
);
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addtoStack( 'members_dname_history', FALSE, array( 'sprintf' => ( $this->member->name ) ) );
|
||||
\IPS\Output::i()->output = $table;
|
||||
|
||||
@@ -1474,4 +1678,26 @@ class _profile extends \IPS\Helpers\CoverPhoto\Controller
|
||||
{
|
||||
return $this->member->coverPhoto();
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide a status reply or status update
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function hide()
|
||||
{
|
||||
\IPS\Request::i()->action = 'hide';
|
||||
return $this->moderate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a status reply or status update
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function delete()
|
||||
{
|
||||
\IPS\Request::i()->action = 'delete';
|
||||
return $this->moderate();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Messenger
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 5 Jul 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\front\messaging;
|
||||
@@ -233,9 +232,9 @@ class _messenger extends \IPS\Content\Controller
|
||||
{
|
||||
$where[] = array( 'core_message_topic_user_map.map_has_unread=1' );
|
||||
}
|
||||
|
||||
|
||||
/* Add a folder filter */
|
||||
if ( !isset( \IPS\Request::i()->overview ) )
|
||||
if ( isset( \IPS\Request::i()->folder ) or !is_null( $folder ) )
|
||||
{
|
||||
if ( !is_null( $folder ) AND isset( $folders[ $folder ] ) )
|
||||
{
|
||||
@@ -248,11 +247,13 @@ class _messenger extends \IPS\Content\Controller
|
||||
}
|
||||
|
||||
/* If we're searching, get the results */
|
||||
$perPage = 25;
|
||||
$iterator = array();
|
||||
|
||||
$perPage = 25;
|
||||
$iterator = array();
|
||||
|
||||
if ( \IPS\Request::i()->q )
|
||||
{
|
||||
$subQuery = \IPS\Db::i()->select( 'map_topic_id', array( 'core_message_topic_user_map', 'core_message_topic_user_map' ), $where );
|
||||
$where = array( array( 'core_message_posts.msg_topic_id IN (?)', $subQuery ) );
|
||||
$query = array();
|
||||
if ( isset( \IPS\Request::i()->search ) and $searchValues = \IPS\Request::i()->valueFromArray('search') )
|
||||
{
|
||||
@@ -275,7 +276,7 @@ class _messenger extends \IPS\Content\Controller
|
||||
|
||||
if ( count( $query ) )
|
||||
{
|
||||
$where[] = '(' . implode( ' OR ', $query ) . ')';
|
||||
$where[] = array( '(' . implode( ' OR ', $query ) . ')' );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -477,7 +478,7 @@ class _messenger extends \IPS\Content\Controller
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=messaging&controller=messenger&folder=' . \IPS\Request::i()->move_message_to, 'front', 'messenger' ) );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=messaging&controller=messenger&folder=' . \IPS\Request::i()->move_message_to, 'front', 'messaging' ) );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = 'messenger_move';
|
||||
@@ -690,7 +691,7 @@ class _messenger extends \IPS\Content\Controller
|
||||
|
||||
if ( isset( \IPS\Request::i()->member_names ) )
|
||||
{
|
||||
foreach ( explode( ',', \IPS\Request::i()->member_names ) as $name )
|
||||
foreach ( explode( "\n", \IPS\Request::i()->member_names ) as $name )
|
||||
{
|
||||
/* We have to html_entity_decode because the javascript code sends the encoded name here */
|
||||
$memberToAdd = \IPS\Member::load( html_entity_decode( $name, ENT_QUOTES, 'UTF-8' ), 'name' );
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Moderator Control Panel
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 24 Oct 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\front\modcp;
|
||||
@@ -123,6 +122,10 @@ class _modcp extends \IPS\Dispatcher\Controller
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
$approvalQueueCount = \IPS\Content\Search\Query::init()->setHiddenFilter( \IPS\Content\Search\Query::HIDDEN_UNAPPROVED )->count();
|
||||
if ( \IPS\Settings::i()->clubs and \IPS\Settings::i()->clubs_require_approval and \IPS\Member::loggedIn()->modPermission('can_access_all_clubs') )
|
||||
{
|
||||
$approvalQueueCount += \IPS\Db::i()->select( 'COUNT(*)', 'core_clubs', 'approved=0' )->first();
|
||||
}
|
||||
\IPS\Data\Cache::i()->storeWithExpire( 'modCpApprovalQueueCount_' . \IPS\Member::loggedIn()->member_id, $approvalQueueCount, \IPS\DateTime::create()->add( new \DateInterval( 'PT15M' ) ), TRUE );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Online Users
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 21 Aug 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\front\online;
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Promote Items
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 1 Feb 2017
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\front\promote;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Curated "Our Picks" listing. (Very technical description there)
|
||||
*/
|
||||
class _ourpicks extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* List promoted internally promoted items
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
if ( ! \IPS\Settings::i()->promote_community_enabled )
|
||||
{
|
||||
\IPS\Output::i()->error( 'promote_no_permission', '2C356/9', 403, '' );
|
||||
}
|
||||
|
||||
/* Create the table */
|
||||
$table = new \IPS\core\Promote\PublicTable( \IPS\Http\Url::internal( 'app=core&module=promote&controller=ourpicks', 'front', 'promote_show' ) );
|
||||
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/promote.css' ) );
|
||||
|
||||
if ( \IPS\Theme::i()->settings['responsive'] )
|
||||
{
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/promote_responsive.css' ) );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->breadcrumb['module'] = array( \IPS\Http\Url::internal( "app=core&module=promote&controller=ourpicks", 'front', 'promote_show' ), \IPS\Member::loggedIn()->language()->addToStack('promoted_items_title') );
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('promote_table_header');
|
||||
\IPS\Output::i()->output = $table;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,514 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Promote Items
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 1 Feb 2017
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\front\promote;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Promote things. (Very technical description there)
|
||||
*/
|
||||
class _promote extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Edit internal data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function edit()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
try
|
||||
{
|
||||
$promote = \IPS\core\Promote::load( \IPS\Request::i()->promote_id );
|
||||
$id = $promote->class_id;
|
||||
$class = $promote->class;
|
||||
}
|
||||
catch( \OutOfRangeException $ex )
|
||||
{
|
||||
\IPS\Output::i()->error( 'page_not_found', '2C356/5', 404, '' );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$object = $class::load( $id );
|
||||
}
|
||||
catch ( \Exception $ex )
|
||||
{
|
||||
\IPS\Output::i()->error( 'page_not_found', '2C356/6', 404, '' );
|
||||
}
|
||||
|
||||
/* Do we have viewing perms? */
|
||||
if ( ! \IPS\core\Promote::objectCanView( $object ) )
|
||||
{
|
||||
\IPS\Output::i()->error( 'page_not_found', '2C356/7', 404, '' );
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'form', 'save' );
|
||||
$form->class = 'ipsForm_vertical cPromoteDialog';
|
||||
$form->add( new \IPS\Helpers\Form\TextArea( 'promote_internal_text', $promote->getText('internal'), FALSE, array( 'rows' => 10 ) ) );
|
||||
|
||||
/* Saving? */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$promote->setText( 'internal', $values['promote_internal_text'] );
|
||||
$promote->save();
|
||||
|
||||
\IPS\Db::i()->update( 'core_tasks', array( 'enabled' => 1 ), array( '`key`=?', 'promote' ) );
|
||||
|
||||
/* Redirect back to the list */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=promote&controller=promote&do=view', 'front', 'promote_manage' ), 'saved' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('promote_internal_edit');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'promote' )->edit( $form );
|
||||
}
|
||||
|
||||
/**
|
||||
* View sent history
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function history()
|
||||
{
|
||||
/* Guests can't promote things */
|
||||
if( ! \IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_module_permission_guest', '2C356/1', 403, '' );
|
||||
}
|
||||
|
||||
if ( ! \IPS\core\Promote::canPromote() )
|
||||
{
|
||||
\IPS\Output::i()->error( 'promote_no_permission', '2C356/2', 403, '' );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$promote = \IPS\core\Promote::load( \IPS\Request::i()->promote_id );
|
||||
}
|
||||
catch( \OutOfRangeException $ex )
|
||||
{
|
||||
\IPS\Output::i()->error( 'page_not_found', '2C356/5', 404, '' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('promote_view_history');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'promote' )->history( $promote->history() );
|
||||
}
|
||||
|
||||
/**
|
||||
* List promoted items for moderators
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function view()
|
||||
{
|
||||
/* Guests can't promote things */
|
||||
if( ! \IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_module_permission_guest', '2C356/1', 403, '' );
|
||||
}
|
||||
|
||||
if ( ! \IPS\core\Promote::canPromote() )
|
||||
{
|
||||
\IPS\Output::i()->error( 'promote_no_permission', '2C356/2', 403, '' );
|
||||
}
|
||||
|
||||
/* Create the table */
|
||||
$table = new \IPS\core\Promote\Table( \IPS\Http\Url::internal( 'app=core&module=promote&controller=promote&do=view', 'front', 'promote_manage' ) );
|
||||
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_promote.js', 'core' ) );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/promote.css' ) );
|
||||
|
||||
if ( \IPS\Theme::i()->settings['responsive'] )
|
||||
{
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/promote_responsive.css' ) );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->breadcrumb['module'] = array( \IPS\Http\Url::internal( "app=core&module=promote&controller=promote&do=view", 'front', 'promote_manage' ), \IPS\Member::loggedIn()->language()->addToStack('promote_manage_link') );
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('promote_manage_link');
|
||||
\IPS\Output::i()->output = $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a promote item
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function delete()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
if ( ! \IPS\core\Promote::canPromote() )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_promote_permission', '2C356/B', 403, '' );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$item = \IPS\core\Promote::load( \IPS\Request::i()->promote_id );
|
||||
$item->delete();
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=promote&controller=promote&do=view', 'front', 'promote_manage' ), 'promote_item_deleted' );
|
||||
}
|
||||
catch( \OutOfRangeException $ex )
|
||||
{
|
||||
\IPS\Output::i()->error( 'page_not_found', '2C356/3', 404, '' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Promote dialog
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
$promote = NULL;
|
||||
$existing = NULL;
|
||||
|
||||
/* Guests can't promote things */
|
||||
if( !\IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_module_permission_guest', '2C356/4', 403, '' );
|
||||
}
|
||||
|
||||
/* Can we promote anything at all? */
|
||||
if ( ! \IPS\core\Promote::canPromote() )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_promote_permission', '2S356/A', 403, '' );
|
||||
}
|
||||
|
||||
/* Editing? */
|
||||
if ( isset( \IPS\Request::i()->promote_id ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$promote = \IPS\core\Promote::load( \IPS\Request::i()->promote_id );
|
||||
$id = $promote->class_id;
|
||||
$class = $promote->class;
|
||||
|
||||
if ( isset( \IPS\Request::i()->repromote ) )
|
||||
{
|
||||
$promote->skipCloneDuplication = TRUE;
|
||||
$existing = clone $promote;
|
||||
|
||||
/* We're repromoting, so reset the scheduled data so we don't pre-fill an old date */
|
||||
$promote->schedule_auto = 0;
|
||||
$promote->scheduled = NULL;
|
||||
}
|
||||
}
|
||||
catch( \OutOfRangeException $ex )
|
||||
{
|
||||
\IPS\Output::i()->error( 'page_not_found', '2C356/5', 404, '' );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Nope... */
|
||||
$class = \IPS\Request::i()->class;
|
||||
$id = intval( \IPS\Request::i()->id );
|
||||
|
||||
/* Do we have an existing promotion waiting to be sent? */
|
||||
$existing = \IPS\core\Promote::loadByClassAndId( $class, $id );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$object = $class::load( $id );
|
||||
}
|
||||
catch ( \Exception $ex )
|
||||
{
|
||||
\IPS\Output::i()->error( 'page_not_found', '2C356/6', 404, '' );
|
||||
}
|
||||
|
||||
/* Do we have viewing perms? */
|
||||
if ( ! \IPS\core\Promote::objectCanView( $object ) )
|
||||
{
|
||||
\IPS\Output::i()->error( 'page_not_found', '2C356/7', 404, '' );
|
||||
}
|
||||
|
||||
/* Links */
|
||||
$normalLink = $object->url();
|
||||
$shortLink = NULL;
|
||||
$images = NULL;
|
||||
|
||||
try
|
||||
{
|
||||
$shortLink = \IPS\core\Promote::shortenUrl( $normalLink );
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
|
||||
/* Do we have access to any share services? */
|
||||
if ( $services = \IPS\core\Promote::promoteServices() )
|
||||
{
|
||||
$form = new \IPS\Helpers\Form( 'form', 'promote_submit' );
|
||||
$form->class = 'ipsForm_horizontal cPromoteDialog';
|
||||
$form->attributes = array( 'data-controller' => 'core.front.system.promote' );
|
||||
|
||||
$form->addTab('promote_links');
|
||||
$form->addHtml( \IPS\Theme::i()->getTemplate( 'promote' )->promoteDialogLinks( $normalLink, $shortLink ) );
|
||||
|
||||
$form->addTab('promote_content');
|
||||
foreach( $services as $service )
|
||||
{
|
||||
$text = \IPS\core\Promote::objectTitle( $object );
|
||||
$content = \IPS\core\Promote::objectContent( $object );
|
||||
|
||||
if ( $promote )
|
||||
{
|
||||
$service->promote = $promote;
|
||||
$promoteText = $promote->text;
|
||||
$text = isset( $promoteText[ mb_strtolower( $service->key ) ] ) ? $promoteText[ mb_strtolower( $service->key ) ] : '';
|
||||
|
||||
foreach( $service->form( $text ) as $element )
|
||||
{
|
||||
if ( ! ( $element instanceof \IPS\Helpers\Form\FormAbstract ) )
|
||||
{
|
||||
$form->addHtml( $element );
|
||||
}
|
||||
else
|
||||
{
|
||||
$form->add( $element );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach( $service->form( $text, ( $shortLink ?: $normalLink ), $content ) as $element )
|
||||
{
|
||||
if ( ! ( $element instanceof \IPS\Helpers\Form\FormAbstract ) )
|
||||
{
|
||||
$form->addHtml( $element );
|
||||
}
|
||||
else
|
||||
{
|
||||
$form->add( $element );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$form->addTab( 'promote_meta' );
|
||||
|
||||
/* Existing media */
|
||||
try
|
||||
{
|
||||
if ( $images = $object->contentImages( 20 ) )
|
||||
{
|
||||
$form->addHtml( \IPS\Theme::i()->getTemplate( 'promote' )->promoteDialogImages( $images, $promote ) );
|
||||
}
|
||||
}
|
||||
catch( \BadMethodCallException $e ) { }
|
||||
|
||||
/* Upload box */
|
||||
$existingMedia = array();
|
||||
if ( $promote )
|
||||
{
|
||||
foreach( $promote->media as $file )
|
||||
{
|
||||
try
|
||||
{
|
||||
$existingMedia[] = \IPS\File::get( 'core_Promote', $file );
|
||||
}
|
||||
catch ( \OutOfRangeException $e ) { }
|
||||
}
|
||||
}
|
||||
|
||||
$uploader = new \IPS\Helpers\Form\Upload( 'promote_media', $existingMedia, FALSE, array(
|
||||
'multiple' => TRUE,
|
||||
'storageExtension' => 'core_Promote',
|
||||
'maxFiles' => 10,
|
||||
'image' => TRUE,
|
||||
'maxFileSize' => 3,
|
||||
'template' => "promote.imageUpload",
|
||||
) );
|
||||
|
||||
$uploader->template = array( \IPS\Theme::i()->getTemplate( 'promote', 'core', 'front' ), 'promoteAttachments' );
|
||||
$form->add( $uploader );
|
||||
|
||||
/* Scheduling */
|
||||
$form->addTab('promote_schedule');
|
||||
$schedule = 'now';
|
||||
|
||||
if ( $promote )
|
||||
{
|
||||
if ( ! isset( \IPS\Request::i()->repromote ) )
|
||||
{
|
||||
if ( $promote->schedule_auto )
|
||||
{
|
||||
$schedule = 'auto';
|
||||
}
|
||||
else
|
||||
{
|
||||
$schedule = 'custom';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Member::loggedIn()->language()->words['promote_custom_schedule_desc'] = sprintf( \IPS\Member::loggedIn()->language()->get('promote_custom_schedule__desc'), \IPS\Member::loggedIn()->language()->get( 'timezone__' . \IPS\Settings::i()->promote_tz ) );
|
||||
|
||||
/* Sort out some language strings */
|
||||
if ( $promote and $promote->schedule_auto )
|
||||
{
|
||||
$currentSlot = \IPS\DateTime::ts( $promote->scheduled )->setTimezone( new \DateTimeZone( \IPS\Settings::i()->promote_tz ) );
|
||||
|
||||
/* Keep the current slot */
|
||||
\IPS\Member::loggedIn()->language()->words['promote_auto_schedule_desc'] = sprintf( \IPS\Member::loggedIn()->language()->get('promote_auto_schedule__desc'), $currentSlot->html() . ' ' . $currentSlot->localeTime( FALSE ), \IPS\Settings::i()->promote_tz );
|
||||
}
|
||||
else
|
||||
{
|
||||
$nextAuto = \IPS\core\Promote::getNextAutoSchedule();
|
||||
if ( $nextAuto )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['promote_auto_schedule_desc'] = sprintf( \IPS\Member::loggedIn()->language()->get('promote_auto_schedule__desc'), $nextAuto->html() . ' ' . $nextAuto->localeTime( FALSE ), \IPS\Settings::i()->promote_tz );
|
||||
}
|
||||
}
|
||||
|
||||
$dateOptions = array(
|
||||
'now' => 'promote_send_now',
|
||||
'auto' => 'promote_auto_schedule',
|
||||
'custom' => 'promote_custom_schedule'
|
||||
);
|
||||
|
||||
if ( ! \IPS\Settings::i()->promote_scheduled )
|
||||
{
|
||||
unset( $dateOptions['auto'] );
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'promote_schedule', $schedule, FALSE, array(
|
||||
'options' => $dateOptions
|
||||
) ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Date( 'promote_custom_date', ( ( $promote and ! $promote->schedule_auto and $promote->scheduled ) ? \IPS\DateTime::ts( $promote->scheduled )->setTimezone( new \DateTimeZone( \IPS\Settings::i()->promote_tz ) ) : NULL ), FALSE, array( 'time' => true, 'timezone' => new \DateTimeZone( \IPS\Settings::i()->promote_tz ) ), NULL, NULL, NULL, 'promote_custom_date' ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->error( 'promote_no_permission', '2C266/1', 403, '' ); //error code needed
|
||||
}
|
||||
|
||||
/* Saving? */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$text = array();
|
||||
$shareTo = array();
|
||||
foreach( $services as $service )
|
||||
{
|
||||
$key = mb_strtolower( $service->key );
|
||||
if ( isset( $values[ 'promote_social_content_' . $key ] ) and $values[ 'promote_social_content_' . $key ] )
|
||||
{
|
||||
$text[ $key ] = $values[ 'promote_social_content_' . $key ];
|
||||
$shareTo[] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$media = array();
|
||||
if ( is_array( $values['promote_media'] ) )
|
||||
{
|
||||
foreach( $values['promote_media'] as $key => $file )
|
||||
{
|
||||
$media[] = (string) $file;
|
||||
}
|
||||
}
|
||||
|
||||
$scheduled = time();
|
||||
$scheduleAuto = 0;
|
||||
|
||||
if ( $values['promote_schedule'] == 'custom' )
|
||||
{
|
||||
$scheduled = $values['promote_custom_date']->getTimestamp();
|
||||
}
|
||||
else if ( $values['promote_schedule'] == 'auto' )
|
||||
{
|
||||
$scheduleAuto = 1;
|
||||
|
||||
if ( $promote and $promote->schedule_auto )
|
||||
{
|
||||
$scheduled = $promote->scheduled;
|
||||
}
|
||||
else
|
||||
{
|
||||
$scheduled = \IPS\core\Promote::getNextAutoSchedule()->getTimestamp();
|
||||
}
|
||||
}
|
||||
|
||||
/* Content images */
|
||||
$saveImages = array();
|
||||
if ( $images )
|
||||
{
|
||||
foreach( $images as $image )
|
||||
{
|
||||
foreach( $image as $extension => $path )
|
||||
{
|
||||
if ( \IPS\Request::i()->attach_files and in_array( $path, array_keys( \IPS\Request::i()->attach_files ) ) )
|
||||
{
|
||||
$saveImages[] = array( $extension => $path );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $promote )
|
||||
{
|
||||
$promote = new \IPS\core\Promote;
|
||||
$promote->class = $class;
|
||||
$promote->class_id = $id;
|
||||
$promote->added_by = \IPS\Member::loggedIn()->member_id;
|
||||
}
|
||||
|
||||
$promote->internal = ( in_array( 'internal', $shareTo ) ? 1 : 0 );
|
||||
$promote->text = $text;
|
||||
$promote->short_link = $shortLink ?: $normalLink;
|
||||
$promote->images = $saveImages;
|
||||
$promote->media = $media;
|
||||
$promote->added = time();
|
||||
$promote->scheduled = $scheduled;
|
||||
$promote->schedule_auto = $scheduleAuto;
|
||||
$promote->share_to = $shareTo;
|
||||
$promote->failed = 0; # Reset the failed flag if we're re-promoting
|
||||
$promote->sent = 0;
|
||||
$promote->save();
|
||||
|
||||
if ( isset( \IPS\Request::i()->promote_id ) )
|
||||
{
|
||||
/* Redirect back to the list */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=promote&controller=promote&do=view', 'front', 'promote_manage' ), 'saved' );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Show a we're done page */
|
||||
$output = \IPS\Theme::i()->getTemplate( 'promote' )->promoteScheduled( $promote );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = \IPS\Theme::i()->getTemplate( 'promote' )->promoteDialog( \IPS\Member::loggedIn()->language()->addToStack('promote_social_title'), $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'promote', 'core' ) ), 'promoteDialogTemplate' ) ), $existing, $object );
|
||||
}
|
||||
|
||||
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_promote.js', 'core' ) );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/promote.css' ) );
|
||||
|
||||
if ( \IPS\Theme::i()->settings['responsive'] )
|
||||
{
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/promote_responsive.css' ) );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('promote_social_button');
|
||||
\IPS\Output::i()->output = $output;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Search
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 18 Apr 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\front\search;
|
||||
@@ -209,6 +208,23 @@ class _search extends \IPS\Dispatcher\Controller
|
||||
$where[] = \IPS\Db::i()->in( 'core_members.member_group_id', $groups );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$exclude = array();
|
||||
/* Groups not specified but we still want to omit non searchable groups */
|
||||
foreach( \IPS\Member\Group::groups() as $group )
|
||||
{
|
||||
if ( $group->g_bitoptions['gbw_hide_group'] )
|
||||
{
|
||||
$exclude[] = $group->g_id;
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $exclude ) )
|
||||
{
|
||||
$where[] = \IPS\Db::i()->in( 'core_members.member_group_id', $exclude, TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
/* Figure out member custom field filters */
|
||||
foreach ( \IPS\core\ProfileFields\Field::fields( array(), \IPS\core\ProfileFields\Field::SEARCH ) as $group => $fields )
|
||||
@@ -412,6 +428,34 @@ class _search extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
/* Filter by club */
|
||||
if ( isset( \IPS\Request::i()->club ) )
|
||||
{
|
||||
$clubIds = array();
|
||||
$clubNames = array();
|
||||
|
||||
foreach ( explode( ',', \IPS\Request::i()->club ) as $clubId )
|
||||
{
|
||||
try
|
||||
{
|
||||
$club = \IPS\Member\Club::load( ltrim( $clubId, 'c' ) );
|
||||
if ( $club->canRead() )
|
||||
{
|
||||
$clubIds[] = $club->id;
|
||||
$clubNames[] = $club->name;
|
||||
}
|
||||
}
|
||||
catch ( \OutOfRangeException $e ) { }
|
||||
}
|
||||
|
||||
if ( count( $clubIds ) )
|
||||
{
|
||||
$query->filterByClub( $clubIds );
|
||||
$baseUrl = $baseUrl->setQueryString( 'club', \IPS\Request::i()->club );
|
||||
$titleConditions[] = \IPS\Member::loggedIn()->language()->addToStack( 'search_blurb_club', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->formatList( $clubNames, \IPS\Member::loggedIn()->language()->get('or_list_format') ) ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
/* Set time cutoffs */
|
||||
foreach ( array( 'start' => 'filterByCreateDate', 'updated' => 'filterByLastUpdatedDate' ) as $k => $method )
|
||||
{
|
||||
@@ -649,7 +693,7 @@ class _search extends \IPS\Dispatcher\Controller
|
||||
$contentTypes = $this->_contentTypes();
|
||||
$contentToggles = array();
|
||||
$typeFields = array();
|
||||
$typeFieldToggles = array('' => array() );
|
||||
$typeFieldToggles = array('' => array( 'club' ) );
|
||||
$haveCommentClass = FALSE;
|
||||
$haveReplyClass = FALSE;
|
||||
$haveReviewClass = FALSE;
|
||||
@@ -730,6 +774,19 @@ class _search extends \IPS\Dispatcher\Controller
|
||||
/* Author */
|
||||
$form->add( new \IPS\Helpers\Form\Member( 'author', NULL, FALSE, array(), NULL, NULL, NULL, 'author' ), NULL, 'search_tab_content' );
|
||||
|
||||
/* Club */
|
||||
$clubs = \IPS\Member\Club::clubs( \IPS\Member::loggedIn(), NULL, 'name', TRUE );
|
||||
if ( count( $clubs ) )
|
||||
{
|
||||
$clubOptions = array();
|
||||
foreach ( $clubs as $club )
|
||||
{
|
||||
$clubOptions[ "c{$club->id}" ] = $club->name;
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'club', NULL, FALSE, array( 'options' => $clubOptions, 'parse' => 'normal', 'multiple' => TRUE, 'noDefault' => TRUE, 'class' => 'ipsContained' ), NULL, NULL, NULL, 'club' ), NULL, 'search_tab_content' );
|
||||
}
|
||||
|
||||
/* Dates */
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'startDate', ( isset( \IPS\Request::i()->start_before ) or ( isset( \IPS\Request::i()->start_after ) and is_numeric( \IPS\Request::i()->start_after ) ) ) ? 'custom' : \IPS\Request::i()->start_after, FALSE, array( 'options' => $dateOptions, 'toggles' => array( 'custom' => array( 'elCustomDate_startDate' ) ) ), NULL, NULL, NULL, 'startDate' ), NULL, 'search_tab_content' );
|
||||
$form->add( new \IPS\Helpers\Form\DateRange( 'startDateCustom', array( 'start' => ( isset( \IPS\Request::i()->start_after ) and is_numeric( \IPS\Request::i()->start_after ) ) ? \IPS\DateTime::ts( \IPS\Request::i()->start_after ) : NULL, 'end' => isset( \IPS\Request::i()->start_before ) ? \IPS\DateTime::ts( \IPS\Request::i()->start_before ) : NULL ) ), NULL, 'search_tab_content' );
|
||||
@@ -746,7 +803,7 @@ class _search extends \IPS\Dispatcher\Controller
|
||||
if ( isset( $class::$containerNodeClass ) )
|
||||
{
|
||||
$nodeClass = $class::$containerNodeClass;
|
||||
$field = new \IPS\Helpers\Form\Node( $k . '_node', ( isset( \IPS\Request::i()->nodes ) ) ? \IPS\Request::i()->nodes : NULL, FALSE, array( 'class' => $nodeClass, 'multiple' => TRUE, 'permissionCheck' => $nodeClass::searchableNodesPermission(), 'forceOwner' => FALSE ), NULL, NULL, NULL, $k . '_node' );
|
||||
$field = new \IPS\Helpers\Form\Node( $k . '_node', ( isset( \IPS\Request::i()->nodes ) ) ? \IPS\Request::i()->nodes : NULL, FALSE, array( 'class' => $nodeClass, 'multiple' => TRUE, 'permissionCheck' => $nodeClass::searchableNodesPermission(), 'forceOwner' => FALSE, 'clubs' => \IPS\IPS::classUsesTrait( $nodeClass, 'IPS\Content\ClubContainer' ) ), NULL, NULL, NULL, $k . '_node' );
|
||||
$field->label = \IPS\Member::loggedIn()->language()->addToStack( $nodeClass::$nodeTitle );
|
||||
$form->add( $field, NULL, 'search_tab_nodes' );
|
||||
}
|
||||
@@ -893,6 +950,10 @@ class _search extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$url = $url->setQueryString( 'author', $values['author']->name );
|
||||
}
|
||||
if ( isset( $values['club'] ) and $values['club'] )
|
||||
{
|
||||
$url = $url->setQueryString( 'club', $values['club'] );
|
||||
}
|
||||
|
||||
if ( isset( $values['group'] ) and $values['group'] )
|
||||
{
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Print out sitemap
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 30 Aug 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\front\sitemap;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Staff directory
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 19 Sep 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\front\staffdirectory;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Status Updates Feed
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 15 Aug 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief AJAX actions
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 04 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\front\system;
|
||||
@@ -91,7 +90,7 @@ class _ajax extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$result = array( 'result' => 'fail', 'message' => \IPS\Member::loggedIn()->language()->addToStack( 'form_maxlength', FALSE, array( 'pluralize' => array( \IPS\Settings::i()->max_user_name_length ) ) ) );
|
||||
}
|
||||
elseif ( \IPS\Settings::i()->username_characters and !preg_match( '/^[' . str_replace( '\-', '-', preg_quote( \IPS\Settings::i()->username_characters, '/' ) ) . ']*$/i', $name ) )
|
||||
elseif ( \IPS\Settings::i()->username_characters and !preg_match( '/^[' . str_replace( '\-', '-', preg_quote( \IPS\Settings::i()->username_characters, '/' ) ) . ']*$/iu', $name ) )
|
||||
{
|
||||
$result = array( 'result' => 'fail', 'message' => \IPS\Member::loggedIn()->language()->addToStack('form_bad_value') );
|
||||
}
|
||||
@@ -187,6 +186,26 @@ class _ajax extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
/* Check it's an allowed domain */
|
||||
if ( \IPS\Settings::i()->allowed_reg_email !== '' AND $allowedEmailDomains = explode( ',', \IPS\Settings::i()->allowed_reg_email ) )
|
||||
{
|
||||
$matched = FALSE;
|
||||
foreach ( $allowedEmailDomains AS $domain )
|
||||
{
|
||||
if( \mb_stripos( $email, "@" . $domain ) !== FALSE )
|
||||
{
|
||||
$matched = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $allowedEmailDomains ) AND !$matched )
|
||||
{
|
||||
$result = array( 'result' => 'fail', 'message' => $email );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
\IPS\Output::i()->json( $result );
|
||||
}
|
||||
|
||||
@@ -378,4 +397,20 @@ class _ajax extends \IPS\Dispatcher\Controller
|
||||
|
||||
\IPS\Output::i()->json( $response );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show information about chart timezones
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function chartTimezones()
|
||||
{
|
||||
$mysqlTimezone = \IPS\Db::i()->query( "SELECT TIMEDIFF( NOW(), CONVERT_TZ( NOW(), @@session.time_zone, '+00:00' ) );" )->fetch_row()[0];
|
||||
if ( preg_match( '/^(-?)(\d{2}):00:00/', $mysqlTimezone, $matches ) )
|
||||
{
|
||||
$mysqlTimezone = "GMT" . ( ( $matches[2] == 0 ) ? '' : ( ( $matches[1] ?: '+' ) . intval( $matches[2] ) ) );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->chartTimezoneInfo( $mysqlTimezone );
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Announcement
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 09 Oct 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\front\system;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief My Attachments Controller
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 22 Jul 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\front\system;
|
||||
|
||||
Loaded 100 of 2074 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user