Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -1,28 +0,0 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class cms_hook_Database extends _HOOK_CLASS_
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Gets stores which are always needed to save individual queries
|
||||
*
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->initLoad[] = 'cms_menu';
|
||||
$this->initLoad[] = 'cms_databases';
|
||||
$this->initLoad[] = 'pages_page_urls';
|
||||
|
||||
/* Hand over to normal method */
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class cms_hook_Forum extends _HOOK_CLASS_
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* [Node] Get buttons to display in tree
|
||||
*
|
||||
* @param string $url Base URL
|
||||
* @param bool $subnode Is this a subnode?
|
||||
* @return array
|
||||
*/
|
||||
public function getButtons( $url, $subnode=FALSE )
|
||||
{
|
||||
$buttons = parent::getButtons( $url, $subnode );
|
||||
|
||||
if ( isset( $buttons['delete'] ) AND $this->isUsedByCms() )
|
||||
{
|
||||
unset( $buttons['delete']['data'] );
|
||||
}
|
||||
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this Forum used by any cms category for record/comment topics?
|
||||
*
|
||||
@return bool|\IPS\cms\Databases
|
||||
*/
|
||||
public function isUsedByCms()
|
||||
{
|
||||
foreach ( \IPS\cms\Databases::databases() as $database )
|
||||
{
|
||||
if ( $database->forum_record and $database->forum_forum and $database->forum_forum == $this->id )
|
||||
{
|
||||
return $database;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,172 +0,0 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class cms_hook_FriendlyUrl extends _HOOK_CLASS_
|
||||
{
|
||||
/**
|
||||
* Get FURL Definition
|
||||
*
|
||||
* @param bool $revert If TRUE, ignores all customisations and reloads from json
|
||||
* @return array
|
||||
*/
|
||||
public static function furlDefinition( $revert=FALSE )
|
||||
{
|
||||
return array_merge( parent::furlDefinition( $revert ), array( 'content_page_path' => static::buildFurlDefinition( 'app=cms&module=pages&controller=page', 'app=cms&module=pages&controller=page', NULL, FALSE, NULL, FALSE, 'IPS\cms\Pages\Router' ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a friendly URL from a full URL, working out friendly URL data
|
||||
*
|
||||
* This is overridden so that when we are examing a raw URL (such as from \IPS\Http\Url::createFromString()), Pages
|
||||
* can appropriately claim the URL as belonging to it
|
||||
*
|
||||
* @param array $components An array of components as returned by componentsFromUrlString()
|
||||
* @param string $potentialFurl The potential FURL slug (e.g. "topic/1-test")
|
||||
* @return \IPS\Http\Url\Friendly|NULL
|
||||
*/
|
||||
public static function createFriendlyUrlFromComponents( $components, $potentialFurl )
|
||||
{
|
||||
/* If the normal URL handling has it, or this is the root page, use normal handling, unless Pages is the default app, in which case we'll fallback to it */
|
||||
if ( $return = parent::createFriendlyUrlFromComponents( $components, $potentialFurl ) or !$potentialFurl )
|
||||
{
|
||||
if ( !\IPS\Application::load('cms')->default OR $potentialFurl )
|
||||
{
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Try to find a page */
|
||||
try
|
||||
{
|
||||
list( $pagePath, $pageNumber ) = \IPS\cms\Pages\Page::getStrippedPagePath( $potentialFurl );
|
||||
try
|
||||
{
|
||||
$page = \IPS\cms\Pages\Page::loadFromPath( $pagePath );
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
/* Try from furl */
|
||||
try
|
||||
{
|
||||
$page = \IPS\cms\Pages\Page::load( \IPS\Db::i()->select( 'store_current_id', 'cms_url_store', array( 'store_type=? and store_path=?', 'page', $pagePath ) )->first() );
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
}
|
||||
|
||||
return static::createFromComponents( $components[ static::COMPONENT_HOST ], $components[ static::COMPONENT_SCHEME ], $components[ static::COMPONENT_PATH ], $components[ static::COMPONENT_QUERY ], $components[ static::COMPONENT_PORT ], $components[ static::COMPONENT_USERNAME ], $components[ static::COMPONENT_PASSWORD ], $components[ static::COMPONENT_FRAGMENT ] )
|
||||
->setFriendlyUrlData( 'content_page_path', array( $potentialFurl ), array( 'path' => $potentialFurl ), $potentialFurl );
|
||||
}
|
||||
/* Couldn't find one? Don't accept responsibility */
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
return $return;
|
||||
}
|
||||
/* The table may not yet exist if we're using the parser in an upgrade */
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
if( $e->getCode() == 1146 )
|
||||
{
|
||||
return $return;
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a friendly URL from a query string with known friendly URL data
|
||||
*
|
||||
* @param string $queryString The query string
|
||||
* @param string $seoTemplate The key for making this a friendly URL
|
||||
* @param string|array $seoTitles The title(s) needed for the friendly URL
|
||||
* @param int $protocol Protocol (one of the PROTOCOL_* constants)
|
||||
* @return \IPS\Http\Url\Friendly
|
||||
* @throws \IPS\Http\Url\Exception
|
||||
*/
|
||||
public static function friendlyUrlFromQueryString( $queryString, $seoTemplate, $seoTitles, $protocol )
|
||||
{
|
||||
if ( $seoTemplate === 'content_page_path' )
|
||||
{
|
||||
/* Get the friendly URL component */
|
||||
$friendlyUrlComponent = static::buildFriendlyUrlComponentFromData( $queryString, $seoTemplate, $seoTitles );
|
||||
|
||||
/* Return */
|
||||
return static::friendlyUrlFromComponent( $protocol, $friendlyUrlComponent, $queryString )->setFriendlyUrlData( $seoTemplate, $seoTitles, array( 'path' => $friendlyUrlComponent ), $friendlyUrlComponent );
|
||||
}
|
||||
|
||||
return parent::friendlyUrlFromQueryString( $queryString, $seoTemplate, $seoTitles, $protocol );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set friendly URL data
|
||||
*
|
||||
* This is overriden so when we are creating a friendly URL with known data (such as from \IPS\Http\Url::internal()),
|
||||
* Pages can set the data for it's URLs properly
|
||||
*
|
||||
* @param string $seoTemplate The key for making this a friendly URL
|
||||
* @param string|array $seoTitles The title(s) needed for the friendly URL
|
||||
* @param array $matchedParams The values for hidden query string properties
|
||||
* @param string $friendlyUrlComponent The friendly URL component, which may be for the path or the query string (e.g. "topic/1-test")
|
||||
* @return \IPS\Http\Url\Friendly
|
||||
* @throws \IPS\Http\Url\Exception
|
||||
*/
|
||||
protected function setFriendlyUrlData( $seoTemplate, $seoTitles, $matchedParams=array(), string $friendlyUrlComponent = '')
|
||||
{
|
||||
if ( $seoTemplate === 'content_page_path' )
|
||||
{
|
||||
/* Set basic properties */
|
||||
$this->seoTemplate = 'content_page_path';
|
||||
$this->seoTitles = \is_string( $seoTitles ) ? array( $seoTitles ) : $seoTitles;
|
||||
$this->friendlyUrlComponent = $friendlyUrlComponent;
|
||||
$this->seoPagination = true;
|
||||
|
||||
/* Set hidden query string */
|
||||
$this->hiddenQueryString = array( 'app' => 'cms', 'module' => 'pages', 'controller' => 'page' ) + $matchedParams;
|
||||
|
||||
/* Return */
|
||||
return $this;
|
||||
}
|
||||
|
||||
return parent::setFriendlyUrlData( $seoTemplate, $seoTitles, $matchedParams, $friendlyUrlComponent );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get friendly URL data from a query string and SEO template
|
||||
*
|
||||
* This is overriden so when we are creating a friendly URL with known data (such as from \IPS\Http\Url::internal()),
|
||||
* Pages can set the data for it's URLs properly
|
||||
*
|
||||
* @param string $queryString The query string - is passed by reference and any parts used are removed, which can be used to detect extraneous parts
|
||||
* @param string $seoTemplate The key for making this a friendly URL
|
||||
* @param string|array $seoTitles The title(s) needed for the friendly URL
|
||||
* @return string
|
||||
* @throws \IPS\Http\Url\Exception
|
||||
*/
|
||||
public static function buildFriendlyUrlComponentFromData( &$queryString, $seoTemplate, $seoTitles )
|
||||
{
|
||||
if ( $seoTemplate === 'content_page_path' )
|
||||
{
|
||||
parse_str( $queryString, $queryString );
|
||||
unset( $queryString['app'] );
|
||||
unset( $queryString['module'] );
|
||||
unset( $queryString['controller'] );
|
||||
unset( $queryString['page'] );
|
||||
|
||||
$return = $queryString['path'];
|
||||
unset( $queryString['path'] );
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
return parent::buildFriendlyUrlComponentFromData( $queryString, $seoTemplate, $seoTitles );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class cms_hook_InternalUrl extends _HOOK_CLASS_
|
||||
{
|
||||
/**
|
||||
* Get the friendly URL for this URL if there is one
|
||||
*
|
||||
* @return mixed The friendly URL if there is one, TRUE if there isn't, or NULL if not sure
|
||||
*/
|
||||
public function correctFriendlyUrl()
|
||||
{
|
||||
/* Check what the normal handling thinks... */
|
||||
$return = parent::correctFriendlyUrl();
|
||||
|
||||
/* If it it thinks it belongs to "pages", we might be able to be more accurate */
|
||||
if ( $return instanceof \IPS\Http\Url\Friendly and $return->seoTemplate === 'content_page_path' and isset( $this->queryString['path'] ) )
|
||||
{
|
||||
/* Try to find a page */
|
||||
try
|
||||
{
|
||||
/* Create it */
|
||||
$correctUrl = \IPS\cms\Pages\Router::loadFromUrl( $this )->url();
|
||||
|
||||
/* Set extra stuff in our query string */
|
||||
$paramsToSet = array();
|
||||
foreach ( $this->queryString as $k => $v )
|
||||
{
|
||||
if ( !array_key_exists( $k, $correctUrl->queryString ) and !array_key_exists( $k, $correctUrl->hiddenQueryString ) )
|
||||
{
|
||||
$paramsToSet[ $k ] = $v;
|
||||
}
|
||||
}
|
||||
if ( \count( $paramsToSet ) )
|
||||
{
|
||||
$correctUrl = $correctUrl->setQueryString( $paramsToSet );
|
||||
}
|
||||
|
||||
/* Return */
|
||||
return $correctUrl;
|
||||
}
|
||||
/* Couldn't find one? Don't accept responsibility */
|
||||
catch ( \OutOfRangeException $e ){}
|
||||
}
|
||||
|
||||
/* Return */
|
||||
return $return;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class cms_hook_Lang extends _HOOK_CLASS_
|
||||
{
|
||||
/**
|
||||
* Set words
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function languageInit()
|
||||
{
|
||||
/* Language, is it? */
|
||||
parent::languageInit();
|
||||
|
||||
/* Don't do this during setup */
|
||||
if ( \IPS\Dispatcher::hasInstance() AND \IPS\Dispatcher::i()->controllerLocation == 'setup' )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ensure applications set up correctly before task is executed. Pages, for example, needs to set up spl autoloaders first */
|
||||
\IPS\Application::applications();
|
||||
|
||||
/* Add in the database specific language bits and bobs */
|
||||
foreach( \IPS\cms\Databases::getStore() as $database )
|
||||
{
|
||||
$this->words['__indefart_content_record_comments_title_' . $database['database_id'] ] = $this->addToStack( '__indefart_content_record_comments_title' );
|
||||
$this->words['__indefart_content_record_reviews_title_' . $database['database_id'] ] = $this->addToStack( '__indefart_content_record_reviews_title' );
|
||||
$this->words['__indefart_content_db_lang_su_' . $database['database_id'] ] = $this->addToStack( 'content_db_lang_ia_' . $database['database_id'] );
|
||||
$this->words['__defart_content_record_comments_title_' . $database['database_id'] ] = $this->addToStack( '__defart_content_record_comments_title' );
|
||||
$this->words['__defart_content_record_reviews_title_' . $database['database_id'] ] = $this->addToStack( '__defart_content_record_reviews_title' );
|
||||
$this->words['__defart_content_db_lang_su_' . $database['database_id'] ] = $this->addToStack( 'content_db_lang_sl_' . $database['database_id'] );
|
||||
|
||||
$this->words['content_record_comments_title_' . $database['database_id'] ] = $this->addToStack( 'content_record_comment_title', FALSE, array( 'sprintf' => array( $this->recordWord( 1, TRUE, $database['database_id'] ) ) ) );
|
||||
$this->words['content_record_reviews_title_' . $database['database_id'] ] = $this->addToStack( 'content_record_review_title', FALSE, array( 'sprintf' => array( $this->recordWord( 1, TRUE, $database['database_id'] ) ) ) );
|
||||
$this->words['content_record_comments_title_' . $database['database_id'] . '_pl' ] = $this->addToStack( 'content_record_comments_title', FALSE, array( 'sprintf' => array( $this->recordWord( 1, TRUE, $database['database_id'] ) ) ) );
|
||||
$this->words['content_record_comments_title_' . $database['database_id'] . '_pl_lc' ] = $this->addToStack( 'content_record_comments_title_lc', FALSE, array( 'sprintf' => array( $this->recordWord( 1, FALSE, $database['database_id'] ) ) ) );
|
||||
$this->words['content_record_comments_title_' . $database['database_id'] . '_lc' ] = $this->addToStack( 'content_record_comments_title_lc', FALSE, array( 'sprintf' => array( $this->recordWord( 1, FALSE, $database['database_id'] ) ) ) );
|
||||
$this->words['content_record_reviews_title_' . $database['database_id'] . '_pl' ] = $this->addToStack( 'content_record_reviews_title', FALSE, array( 'sprintf' => array( $this->recordWord( 1, TRUE, $database['database_id'] ) ) ) );
|
||||
$this->words['content_record_reviews_title_' . $database['database_id'] . '_pl_lc' ] = $this->addToStack( 'content_record_reviews_title_lc', FALSE, array( 'sprintf' => array( $this->recordWord( 1, FALSE, $database['database_id'] ) ) ) );
|
||||
$this->words['content_record_reviews_title_' . $database['database_id'] . '_lc' ] = $this->addToStack( 'content_record_reviews_title_lc', FALSE, array( 'sprintf' => array( $this->recordWord( 1, FALSE, $database['database_id'] ) ) ) );
|
||||
|
||||
$this->words['content_db_lang_su_' . $database['database_id'] . '_pl' ] = $this->addToStack( 'content_db_lang_pu_' . $database['database_id'] );
|
||||
$this->words['content_db_lang_su_' . $database['database_id'] . '_pl_lc' ] = $this->addToStack( 'content_db_lang_pl_' . $database['database_id'] );
|
||||
$this->words['content_db_lang_sl_' . $database['database_id'] . '_pl_lc' ] = $this->addToStack( 'content_db_lang_pl_' . $database['database_id'] );
|
||||
|
||||
$fieldsClass = '\IPS\cms\Fields' . $database['database_id'];
|
||||
$customFields = $fieldsClass::databaseFieldIds();
|
||||
|
||||
foreach ( $customFields AS $id )
|
||||
{
|
||||
$this->words['sort_field_' . $id] = $this->addToStack( 'content_field_' . $id );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* "Records" / "Record" word
|
||||
*
|
||||
* @param int $number Number
|
||||
* @param bool $upper ucfirst string
|
||||
* @return string
|
||||
*/
|
||||
public function recordWord( $number, $upper, $databaseId )
|
||||
{
|
||||
$case = $upper ? 'u' : 'l';
|
||||
return $number == 1 ? $this->addToStack("content_db_lang_s{$case}_{$databaseId}") : $this->addToStack("content_db_lang_p{$case}_{$databaseId}");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class cms_hook_Output extends _HOOK_CLASS_
|
||||
{
|
||||
/**
|
||||
* Display Error Screen
|
||||
*
|
||||
* @param string $message language key for error message
|
||||
* @param mixed $code Error code
|
||||
* @param int $httpStatusCode HTTP Status Code
|
||||
* @param string $adminMessage language key for error message to show to admins
|
||||
* @param array $httpHeaders Additional HTTP Headers
|
||||
* @param string $extra Additional information (such backtrace or API error) which will be shown to admins
|
||||
* @param int|string|NULL $faultyAppOrHookId The 3rd party application or the hook id, which caused this error, NULL if it was a core application
|
||||
*/
|
||||
public function error( $message, $code, $httpStatusCode=500, $adminMessage=NULL, $httpHeaders=array(), $extra=NULL, $faultyAppOrHookId=NULL )
|
||||
{
|
||||
if ( ! isset( \IPS\Settings::i()->cms_error_page ) or ! \IPS\Settings::i()->cms_error_page )
|
||||
{
|
||||
parent::error( $message, $code, $httpStatusCode, $adminMessage, $httpHeaders, $extra, $faultyAppOrHookId );
|
||||
}
|
||||
|
||||
/* When we log out, the user is taken back to the page they were just on. If this is producing a "no permission" error, redirect them to the index instead */
|
||||
if ( isset( \IPS\Request::i()->_fromLogout ) )
|
||||
{
|
||||
// _fromLogout=1 indicates that they came from log out. To make sure that we don't cause an infinite redirect (which
|
||||
// would happen if guests cannot view the index page) we need to change _fromLogout, but we can't unset it because _fromLogout={anything}
|
||||
// will clear the autosave content on next load (by Javascript), which we need to do on log out for security reasons... so, _fromLogout=2
|
||||
// is used here which will clear the autosave, but *not* redirect them again
|
||||
if ( \IPS\Request::i()->_fromLogout != 2 )
|
||||
{
|
||||
$this->redirect( \IPS\Http\Url::internal('')->stripQueryString()->setQueryString( '_fromLogout', 2 ) );
|
||||
}
|
||||
}
|
||||
|
||||
/* If we're in an external script, just show a simple message */
|
||||
if ( !\IPS\Dispatcher::hasInstance() )
|
||||
{
|
||||
\IPS\Session\Front::i();
|
||||
|
||||
$this->sendOutput( \IPS\Member::loggedIn()->language()->get( $message ), $httpStatusCode, 'text/html', $httpHeaders, FALSE );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( \IPS\Dispatcher::i()->controllerLocation !== 'front' )
|
||||
{
|
||||
parent::error( $message, $code, $httpStatusCode, $adminMessage, $httpHeaders, $extra );
|
||||
}
|
||||
|
||||
/* Work out the title */
|
||||
$title = "{$httpStatusCode}_error_title";
|
||||
$title = \IPS\Member::loggedIn()->language()->checkKeyExists( $title ) ? \IPS\Member::loggedIn()->language()->addToStack( $title ) : \IPS\Member::loggedIn()->language()->addToStack( 'error_title' );
|
||||
|
||||
/* Which message are we showing? */
|
||||
if( \IPS\Member::loggedIn()->isAdmin() and $adminMessage )
|
||||
{
|
||||
$message = $adminMessage;
|
||||
}
|
||||
if ( \IPS\Member::loggedIn()->language()->checkKeyExists( $message ) )
|
||||
{
|
||||
$message = \IPS\Member::loggedIn()->language()->addToStack( $message );
|
||||
}
|
||||
|
||||
/* Replace language stack keys with actual content */
|
||||
\IPS\Member::loggedIn()->language()->parseOutputForDisplay( $message );
|
||||
|
||||
/* Log */
|
||||
$level = \intval( \substr( $code, 0, 1 ) );
|
||||
if( !\IPS\Session::i()->userAgent->bot )
|
||||
{
|
||||
if( $code and \IPS\Settings::i()->error_log_level and $level >= \IPS\Settings::i()->error_log_level )
|
||||
{
|
||||
\IPS\Db::i()->insert( 'core_error_logs', array(
|
||||
'log_member' => \IPS\Member::loggedIn()->member_id ?: 0,
|
||||
'log_date' => time(),
|
||||
'log_error' => $message,
|
||||
'log_error_code' => $code,
|
||||
'log_ip_address' => \IPS\Request::i()->ipAddress(),
|
||||
'log_request_uri' => $_SERVER['REQUEST_URI'],
|
||||
) );
|
||||
|
||||
\IPS\core\AdminNotification::send( 'core', 'Error', NULL, TRUE, array( $code, $message ) );
|
||||
}
|
||||
}
|
||||
|
||||
/* If this is an AJAX request, send a JSON response */
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
$this->json( $message, $httpStatusCode );
|
||||
}
|
||||
|
||||
/* Send output */
|
||||
\IPS\cms\Pages\Page::errorPage( $title, $message, $code, $httpStatusCode, $httpHeaders );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class cms_hook_Parser extends _HOOK_CLASS_
|
||||
{
|
||||
/**
|
||||
* Get URL bases (whout schema) that we'll allow iframes from
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function allowedIFrameBases()
|
||||
{
|
||||
$return = parent::allowedIFrameBases();
|
||||
|
||||
/* If the CMS root URL is not inside the IPS4 directory, then embeds will fails as the src will not be allowed */
|
||||
if ( \IPS\Settings::i()->cms_root_page_url )
|
||||
{
|
||||
$pages = iterator_to_array( \IPS\Db::i()->select( 'database_page_id', 'cms_databases', array( 'database_page_id > 0' ) ) );
|
||||
|
||||
foreach ( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'cms_pages', array( \IPS\Db::i()->in( 'page_id', $pages ) ) ), 'IPS\cms\Pages\Page' ) as $page )
|
||||
{
|
||||
$return[] = str_replace( array( 'http://', 'https://' ), '', $page->url() );
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class cms_hook_Post extends _HOOK_CLASS_
|
||||
{
|
||||
/**
|
||||
* Can edit?
|
||||
*
|
||||
* @param \IPS\Member|NULL $member The member to check for (NULL for currently logged in member)
|
||||
* @return bool
|
||||
*/
|
||||
public function canEdit( $member=NULL )
|
||||
{
|
||||
if ( $this->isFirst() AND \IPS\cms\Records::getLinkedRecord( $this->item() ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return parent::canEdit( $member );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create comment
|
||||
*
|
||||
* @param \IPS\Content\Item $item The content item just created
|
||||
* @param string $comment The comment
|
||||
* @param bool $first Is the first comment?
|
||||
* @param string $guestName If author is a guest, the name to use
|
||||
* @param bool|NULL $incrementPostCount Increment post count? If NULL, will use static::incrementPostCount()
|
||||
* @param \IPS\Member|NULL $member The author of this comment. If NULL, uses currently logged in member.
|
||||
* @param \IPS\DateTime|NULL $time The time
|
||||
* @param string|NULL $ipAddress The IP address or NULL to detect automatically
|
||||
* @param int|NULL $hiddenStatus NULL to set automatically or override: 0 = unhidden; 1 = hidden, pending moderator approval; -1 = hidden (as if hidden by a moderator)
|
||||
* @param int|NULL $anonymous NULL for no value, 0 or 1 for a value (0=no, 1=yes)
|
||||
* @return static
|
||||
*/
|
||||
public static function create( $item, $comment, $first=FALSE, $guestName=NULL, $incrementPostCount=NULL, $member=NULL, \IPS\DateTime $time=NULL, $ipAddress=NULL, $hiddenStatus=NULL, $anonymous=NULL )
|
||||
{
|
||||
$comment = parent::create( $item, $comment, $first, $guestName, $incrementPostCount, $member, $time, $ipAddress, $hiddenStatus, $anonymous );
|
||||
|
||||
static::recordSync( $item );
|
||||
|
||||
return $comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Post
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
parent::delete();
|
||||
|
||||
/* It is possible to delete a post that is orphaned, so let's try to protect against that */
|
||||
try
|
||||
{
|
||||
static::recordSync( $this->item() );
|
||||
}
|
||||
catch( \OutOfRangeException $e ){}
|
||||
}
|
||||
|
||||
/**
|
||||
* Syncing to run when hiding
|
||||
*
|
||||
* @param \IPS\Member|NULL|FALSE $member The member doing the action (NULL for currently logged in member, FALSE for no member)
|
||||
* @return void
|
||||
*/
|
||||
public function onHide( $member )
|
||||
{
|
||||
parent::onHide( $member );
|
||||
|
||||
static::recordSync( $this->item() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Syncing to run when unhiding
|
||||
*
|
||||
* @param bool $approving If true, is being approved for the first time
|
||||
* @param \IPS\Member|NULL|FALSE $member The member doing the action (NULL for currently logged in member, FALSE for no member)
|
||||
* @return void
|
||||
*/
|
||||
public function onUnhide( $approving, $member )
|
||||
{
|
||||
parent::onUnhide( $approving, $member );
|
||||
|
||||
static::recordSync( $this->item() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync up the topic
|
||||
*
|
||||
* @param \IPS\forums\Topic $item Topic object
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function recordSync( $item )
|
||||
{
|
||||
$synced = array();
|
||||
|
||||
/* We used to restrict by forum ID in these two queries, but if you move a topic to a new forum then the counts no longer sync properly */
|
||||
foreach( \IPS\Db::i()->select( '*', 'cms_database_categories', array( 'category_forum_record=? AND category_forum_comments=?', 1, 1 ) ) as $category )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( ! \in_array( $category['category_database_id'], $synced ) )
|
||||
{
|
||||
$class = '\IPS\cms\Records' . $category['category_database_id'];
|
||||
if( class_exists( $class ) )
|
||||
{
|
||||
$object = $class::load( $item->tid, 'record_topicid' );
|
||||
$object->syncRecordFromTopic( $item );
|
||||
|
||||
/* Successful sync (no exception thrown, so lets skip this database from now on */
|
||||
$synced[] = $category['category_database_id'];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch( \Exception $ex )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'cms_databases', array( 'database_forum_record=? AND database_forum_comments=?', 1, 1 ) ) as $database )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( ! \in_array( $database['database_id'], $synced ) )
|
||||
{
|
||||
$class = '\IPS\cms\Records' . $database['database_id'];
|
||||
if( class_exists( $class ) )
|
||||
{
|
||||
$object = $class::load( $item->tid, 'record_topicid' );
|
||||
$object->syncRecordFromTopic( $item );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( \Exception $ex )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class cms_hook_Theme extends _HOOK_CLASS_
|
||||
{
|
||||
/**
|
||||
* This method is executed when theme settings have changed from saveForm()
|
||||
*
|
||||
* @param int $setId Theme set id
|
||||
* @erturn void
|
||||
*/
|
||||
public static function themeSettingsHaveChanged( $setId )
|
||||
{
|
||||
\IPS\cms\Pages\Page::deleteCachedIncludes();
|
||||
|
||||
parent::themeSettingsHaveChanged( $setId );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class cms_hook_Topic extends _HOOK_CLASS_
|
||||
{
|
||||
/**
|
||||
* Can view?
|
||||
*
|
||||
* @param \IPS\Member|NULL $member The member to check for or NULL for the currently logged in member
|
||||
* @return bool
|
||||
*/
|
||||
public function canView( $member=NULL )
|
||||
{
|
||||
$canView = parent::canView( $member );
|
||||
$member = $member ? $member : \IPS\Member::loggedIn();
|
||||
|
||||
/* Whitelist which types of do we allow */
|
||||
$do = array( 'editComment' );
|
||||
|
||||
if ( ! $canView )
|
||||
{
|
||||
/* Check to see if it's attached to a database record and we are not a guest */
|
||||
if ( isset( \IPS\Request::i()->do ) and \in_array( \IPS\Request::i()->do, $do ) and $record = \IPS\cms\Records::getLinkedRecord( $this ) and $member->member_id )
|
||||
{
|
||||
return $record->canView();
|
||||
}
|
||||
}
|
||||
|
||||
return $canView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can edit?
|
||||
*
|
||||
* @param \IPS\Member|NULL $member The member to check for (NULL for currently logged in member)
|
||||
* @return bool
|
||||
*/
|
||||
public function canEdit( $member=NULL )
|
||||
{
|
||||
if ( \IPS\cms\Records::getLinkedRecord( $this ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return parent::canEdit( $member );
|
||||
}
|
||||
|
||||
/**
|
||||
* Do Moderator Action
|
||||
*
|
||||
* @param string $action The action
|
||||
* @param \IPS\Member|NULL $member The member doing the action (NULL for currently logged in member)
|
||||
* @param string|NULL $reason Reason (for hides)
|
||||
* @param bool $immediately Delete immediately
|
||||
* @return void
|
||||
* @throws \OutOfRangeException|\InvalidArgumentException|\RuntimeException
|
||||
*/
|
||||
public function modAction( $action, \IPS\Member $member = NULL, $reason = NULL, $immediately = FALSE )
|
||||
{
|
||||
if ( $action === 'delete' )
|
||||
{
|
||||
/* We used to restrict by forum ID but if you move a topic to a new forum then the forum ID will no longer match */
|
||||
foreach( \IPS\Db::i()->select( '*', 'cms_database_categories', array( 'category_forum_record=? AND category_forum_comments=?', 1, 1 ) ) as $category )
|
||||
{
|
||||
try
|
||||
{
|
||||
$class = '\IPS\cms\Records' . $category['category_database_id'];
|
||||
|
||||
if( class_exists( $class ) )
|
||||
{
|
||||
$class::load( $this->tid, 'record_topicid' );
|
||||
|
||||
$database = \IPS\cms\Databases::load( $category['category_database_id'] );
|
||||
\IPS\Member::loggedIn()->language()->words['cms_delete_linked_topic'] = sprintf( \IPS\Member::loggedIn()->language()->get('cms_delete_linked_topic'), $database->recordWord( 1 ) );
|
||||
|
||||
\IPS\Output::i()->error( 'cms_delete_linked_topic', '1T281/1', 403, '' );
|
||||
}
|
||||
|
||||
}
|
||||
catch( \Exception $ex ) { }
|
||||
}
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'cms_databases', array( 'database_forum_record=? AND database_forum_comments=?', 1, 1 ) ) as $database )
|
||||
{
|
||||
try
|
||||
{
|
||||
$class = '\IPS\cms\Records' . $database['database_id'];
|
||||
|
||||
$class::load( $this->tid, 'record_topicid' );
|
||||
|
||||
$database = \IPS\cms\Databases::constructFromData( $database );
|
||||
\IPS\Member::loggedIn()->language()->words['cms_delete_linked_topic'] = sprintf( \IPS\Member::loggedIn()->language()->get('cms_delete_linked_topic'), $database->recordWord( 1 ) );
|
||||
|
||||
\IPS\Output::i()->error( 'cms_delete_linked_topic', '1T281/1', 403, '' );
|
||||
}
|
||||
catch( \Exception $ex ) { }
|
||||
}
|
||||
}
|
||||
|
||||
parent::modAction( $action, $member, $reason, $immediately );
|
||||
|
||||
if ( $action === 'lock' or $action === 'unlock' )
|
||||
{
|
||||
foreach( \IPS\Db::i()->select( '*', 'cms_databases', array( 'database_forum_record=? AND database_forum_comments=?', 1, 1 ) ) as $database )
|
||||
{
|
||||
try
|
||||
{
|
||||
$class = '\IPS\cms\Records' . $database['database_id'];
|
||||
$record = $class::load( $this->tid, 'record_topicid' );
|
||||
|
||||
$record->record_locked = ( $action === 'lock' ) ? 1 : 0;
|
||||
$record->save();
|
||||
}
|
||||
catch( \Exception $ex ) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Can merge?
|
||||
*
|
||||
* @param \IPS\Member|NULL $member The member to check for (NULL for currently logged in member)
|
||||
* @return bool
|
||||
*/
|
||||
public function canMerge( $member=NULL )
|
||||
{
|
||||
if ( \IPS\cms\Records::topicIsLinked( $this ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return parent::canMerge( $member );
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class cms_hook_Url extends _HOOK_CLASS_
|
||||
{
|
||||
/**
|
||||
* Create from string
|
||||
*
|
||||
* This is overridden so that when we are examing a raw URL the "Gateway File" feature
|
||||
* can appropriately claim the URL as belonging to it
|
||||
*
|
||||
* @param string $url A valid URL as per our definition (see phpDoc on class)
|
||||
* @param bool $couldBeFriendly If the URL is known to not be friendly, FALSE can be passed here to save the performance implication of checking the URL
|
||||
* @param bool $autoEncode If true, any invalid components will be automatically encoded rather than an exception thrown - useful if the entire link is user-provided
|
||||
* @return \IPS\Http\Url
|
||||
*/
|
||||
public static function createFromString( $url, $couldBeFriendly=TRUE, $autoEncode=FALSE )
|
||||
{
|
||||
/* See what normal handling makes of it... */
|
||||
$return = parent::createFromString( $url, $couldBeFriendly, $autoEncode );
|
||||
|
||||
/* If the normal handling doesn't recognise it as an internal URL and we
|
||||
have a gateway file, check that */
|
||||
if ( !( $return instanceof \IPS\Http\Url\Internal ) and \IPS\Settings::i()->cms_root_page_url )
|
||||
{
|
||||
/* Decode it */
|
||||
$components = static::componentsFromUrlString( $url, $autoEncode );
|
||||
|
||||
/* Is it underneath the gateway? */
|
||||
$gatewayUrlComponents = static::componentsFromUrlString( \IPS\Settings::i()->cms_root_page_url );
|
||||
if ( $components[ static::COMPONENT_HOST ] === $gatewayUrlComponents[ static::COMPONENT_HOST ] and
|
||||
$components[ static::COMPONENT_USERNAME ] === $gatewayUrlComponents[ static::COMPONENT_USERNAME ] and
|
||||
$components[ static::COMPONENT_PASSWORD ] === $gatewayUrlComponents[ static::COMPONENT_PASSWORD ] and
|
||||
$components[ static::COMPONENT_PORT ] === $gatewayUrlComponents[ static::COMPONENT_PORT ] and
|
||||
mb_substr( $components[ static::COMPONENT_PATH ], 0, mb_strlen( $gatewayUrlComponents[ static::COMPONENT_PATH ] ) ) === $gatewayUrlComponents[ static::COMPONENT_PATH ]
|
||||
)
|
||||
{
|
||||
$pathFromGatewayUrl = mb_substr( $components[ static::COMPONENT_PATH ], mb_strlen( $gatewayUrlComponents[ static::COMPONENT_PATH ] ) );
|
||||
$fallback = FALSE;
|
||||
if ( !$pathFromGatewayUrl or $pathFromGatewayUrl === 'index.php' )
|
||||
{
|
||||
if ( !$pathFromGatewayUrl )
|
||||
{
|
||||
$fallback = TRUE;
|
||||
}
|
||||
$queryString = \IPS\Http\Url::convertQueryAsArrayToString( $components[ static::COMPONENT_QUERY ] );
|
||||
$pathFromGatewayUrl = trim( mb_substr( $queryString, 0, mb_strpos( $queryString, '&' ) ?: NULL ), '/' );
|
||||
}
|
||||
|
||||
/* Try to find a page */
|
||||
$page = NULL;
|
||||
try
|
||||
{
|
||||
$page = \IPS\cms\Pages\Page::loadFromPath( $pathFromGatewayUrl );
|
||||
return \IPS\Http\Url\Friendly::createFromComponents( $components[ static::COMPONENT_HOST ], $components[ static::COMPONENT_SCHEME ], $components[ static::COMPONENT_PATH ], $components[ static::COMPONENT_QUERY ], $components[ static::COMPONENT_PORT ], $components[ static::COMPONENT_USERNAME ], $components[ static::COMPONENT_PASSWORD ], $components[ static::COMPONENT_FRAGMENT ] )
|
||||
->setFriendlyUrlData( 'content_page_path', array( $pathFromGatewayUrl ), array( 'path' => $pathFromGatewayUrl ), $pathFromGatewayUrl );
|
||||
}
|
||||
/* Couldn't find one? Don't accept responsibility, unless there was no $pathFromGatewayUrl and this is the gateway URL */
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
if ( $fallback and (string) $return->stripQueryString() === \IPS\Settings::i()->cms_root_page_url )
|
||||
{
|
||||
try
|
||||
{
|
||||
$page = \IPS\cms\Pages\Page::loadFromPath( '' );
|
||||
return \IPS\Http\Url\Friendly::createFromComponents( $components[ static::COMPONENT_HOST ], $components[ static::COMPONENT_SCHEME ], $components[ static::COMPONENT_PATH ], $components[ static::COMPONENT_QUERY ], $components[ static::COMPONENT_PORT ], $components[ static::COMPONENT_USERNAME ], $components[ static::COMPONENT_PASSWORD ], $components[ static::COMPONENT_FRAGMENT ] )
|
||||
->setFriendlyUrlData( 'content_page_path', array( '' ), array( 'path' => '' ), '' );
|
||||
}
|
||||
catch ( \OutOfRangeException $e ) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Return */
|
||||
return $return;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
abstract class cms_hook_Widget extends _HOOK_CLASS_
|
||||
{
|
||||
/**
|
||||
* Delete caches
|
||||
*
|
||||
* @param String $key Widget key
|
||||
* @param String $app Parent application
|
||||
* @param String $plugin Parent plugin
|
||||
* @return void
|
||||
*/
|
||||
static public function deleteCaches( $key=NULL, $app=NULL, $plugin=NULL )
|
||||
{
|
||||
\IPS\cms\Widget::deleteCachesForBlocks( $key, $app, $plugin );
|
||||
|
||||
/* Hand over to normal method */
|
||||
parent::deleteCaches( $key, $app, $plugin );
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class cms_hook_apiForum extends _HOOK_CLASS_
|
||||
{
|
||||
/**
|
||||
* Delete
|
||||
*
|
||||
* @param int $id ID Number
|
||||
* @param int|NULL $deleteChildrenOrMove -1 to delete all child nodes, or the new parent node ID to move the children to
|
||||
* @throws 2F363/7 The node ID does not exist
|
||||
* @throws 2F363/6 The target node cannot be deleted because it is in use by a CMS Database
|
||||
* @return \IPS\Api\Response
|
||||
*/
|
||||
protected function _delete( $id, $deleteChildrenOrMove = NULL )
|
||||
{
|
||||
$nodeClass = $this->class;
|
||||
|
||||
try
|
||||
{
|
||||
$node = $nodeClass::load( $id );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\Exception( 'INVALID_ID', '2F363/7', 404 );
|
||||
}
|
||||
|
||||
/* isUsedByCms in cms/hooks/Forum.php */
|
||||
if ( $db = $node->isUsedByCms() )
|
||||
{
|
||||
throw new \IPS\Api\Exception( 'FORUM_USED_BY_DATABASE', '2F363/6', 403 );
|
||||
}
|
||||
else
|
||||
{
|
||||
return parent::_delete( $id, $deleteChildrenOrMove );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class cms_hook_forums extends _HOOK_CLASS_
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Delete
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function delete()
|
||||
{
|
||||
/* Load forum and verify that it is not used for comments */
|
||||
$nodeClass = $this->nodeClass;
|
||||
if ( \IPS\Request::i()->subnode )
|
||||
{
|
||||
$nodeClass = $nodeClass::$subnodeClass;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$node = $nodeClass::load( \IPS\Request::i()->id );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2S101/J', 404, '' );
|
||||
}
|
||||
|
||||
/* Is any database synced with this forum? */
|
||||
if ( $db = $node->isUsedByCms() )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['cms_forum_used'] = sprintf( \IPS\Member::loggedIn()->language()->get('cms_forum_used'), $db->recordWord( 1 ) );
|
||||
|
||||
\IPS\Output::i()->error( 'cms_forum_used', '1T371/1', 403, '' );
|
||||
}
|
||||
|
||||
return parent::delete();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class cms_hook_topics extends _HOOK_CLASS_
|
||||
{
|
||||
|
||||
/* !Hook Data - DO NOT REMOVE */
|
||||
public static function hookData() {
|
||||
return array_merge_recursive( array (
|
||||
'topic' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'selector' => '#elTopicActions_menu',
|
||||
'type' => 'add_inside_start',
|
||||
'content' => '{{if $topic->hidden() != -2 and \IPS\Member::loggedIn()->modPermission( \'can_copy_topic_database\' )}}
|
||||
<li class=\'ipsMenu_item\'>
|
||||
<a href=\'{url="app=cms&module=database&controller=topic&id=$topic->tid&_new=1" base="front" seoTemplate="topic_copy" seoTitle="$topic->title_seo"}\' data-ipsDialog data-ipsDialog-size=\'narrow\' data-ipsDialog-remoteVerify=\'false\' data-ipsDialog-title=\'{lang="copy_select_database"}\'>{lang="copy_topic_to_database"}</a>
|
||||
</li>
|
||||
{{endif}}',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'selector' => '#elTopicActionsBottom_menu',
|
||||
'type' => 'add_inside_start',
|
||||
'content' => '{{if $topic->hidden() != -2 and \IPS\Member::loggedIn()->modPermission( \'can_copy_topic_database\' )}}
|
||||
<li class=\'ipsMenu_item\'>
|
||||
<a href=\'{url="app=cms&module=database&controller=topic&id=$topic->tid&_new=1" base="front" seoTemplate="topic_copy" seoTitle="$topic->title_seo"}\' data-ipsDialog data-ipsDialog-size=\'narrow\' data-ipsDialog-remoteVerify=\'false\' data-ipsDialog-title=\'{lang="copy_select_database"}\'>{lang="copy_topic_to_database"}</a>
|
||||
</li>
|
||||
{{endif}}',
|
||||
),
|
||||
),
|
||||
), parent::hookData() );
|
||||
}
|
||||
/* End Hook Data */
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user