Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Advertisements
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @since 24 Sep 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -46,9 +46,12 @@ class _advertisements extends \IPS\Dispatcher\Controller
|
||||
$table->langPrefix = 'ads_';
|
||||
|
||||
/* Columns we need */
|
||||
$table->include = array( 'ad_title', 'ad_html', 'ad_impressions', 'ad_clicks', 'ad_start', 'ad_end', 'ad_maximum_value', 'ad_active' );
|
||||
$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->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 )
|
||||
);
|
||||
|
||||
/* Default sort options */
|
||||
$table->sortBy = $table->sortBy ?: 'ad_start';
|
||||
@@ -65,8 +68,8 @@ class _advertisements extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Filters */
|
||||
$table->filters = array(
|
||||
'ad_filters_active' => 'ad_active=1',
|
||||
'ad_filters_inactive' => 'ad_active=0',
|
||||
'ad_filters_active' => array('ad_active=1 AND ( ad_end=0 OR ad_end > ? )', time() ),
|
||||
'ad_filters_inactive' => array('ad_active=0 OR ad_end<? ', time() ),
|
||||
);
|
||||
|
||||
/* If Nexus is installed, we get the pending filter too */
|
||||
@@ -77,7 +80,7 @@ class _advertisements extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Custom parsers */
|
||||
$table->parsers = array(
|
||||
'ad_title' => function( $val, $row )
|
||||
'word_custom' => function( $val, $row )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->checkKeyExists( "core_advert_{$row['ad_id']}" ) ? \IPS\Member::loggedIn()->language()->addToStack( "core_advert_{$row['ad_id']}" ) : \IPS\Theme::i()->getTemplate( 'global' )->shortMessage( 'ad_title_none', array( 'ipsType_light' ) );
|
||||
},
|
||||
@@ -243,6 +246,9 @@ class _advertisements extends \IPS\Dispatcher\Controller
|
||||
/* Permission check */
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'advertisements_delete' );
|
||||
|
||||
/* Make sure the user confirmed the deletion */
|
||||
\IPS\Request::i()->confirmedDelete();
|
||||
|
||||
/* Get our record */
|
||||
try
|
||||
{
|
||||
@@ -349,7 +355,7 @@ class _advertisements extends \IPS\Dispatcher\Controller
|
||||
/* Start the form */
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\Translatable( 'ad_title', NULL, TRUE, array( 'app' => 'core', 'key' => ( !$record->id ) ? NULL : "core_advert_{$record->id}" ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'ad_type', ( $record->id ) ? ( $record->html ? 'html' : 'image' ) : 'html', TRUE, array( 'options' => array( 'html' => 'ad_type_html', 'image' => 'ad_type_image' ), 'toggles' => array( 'html' => array( 'ad_html', 'ad_html_specify_https', 'ad_maximums_html' ), 'image' => array( 'ad_url', 'ad_image', 'ad_image_more', 'ad_clicks', 'ad_maximums_image' ) ) ), NULL, NULL, NULL, 'ad_type' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'ad_type', ( $record->id ) ? ( $record->html ? 'html' : 'image' ) : 'html', TRUE, array( 'options' => array( 'html' => 'ad_type_html', 'image' => 'ad_type_image' ), 'toggles' => array( 'html' => array( 'ad_html', 'ad_html_specify_https', 'ad_maximums_html' ), 'image' => array( 'ad_url', 'ad_new_window', 'ad_image', 'ad_image_more', 'ad_clicks', 'ad_maximums_image' ) ) ), NULL, NULL, NULL, 'ad_type' ) );
|
||||
|
||||
/* Show the fields for an HTML advertisement */
|
||||
$form->add( new \IPS\Helpers\Form\Codemirror( 'ad_html', ( $record->id ) ? $record->html : NULL, FALSE, array(), NULL, NULL, NULL, 'ad_html' ) );
|
||||
@@ -358,10 +364,11 @@ class _advertisements extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Show the fields for an image advertisement */
|
||||
$form->add( new \IPS\Helpers\Form\Url( 'ad_url', ( $record->id ) ? $record->link : NULL, FALSE, array(), NULL, NULL, NULL, 'ad_url' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Upload( 'ad_image', ( $record->id ) ? ( ( isset( $record->_images['large'] ) ) ? \IPS\File::get( 'core_Advertisements', $record->_images['large'] ) : NULL ) : NULL, FALSE, array( 'image' => TRUE, 'storageExtension' => 'core_Advertisements' ), NULL, NULL, NULL, 'ad_image' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'ad_image_more', ( $record->id ) ? ( ( isset( $record->_images['medium'] ) OR ( isset( $record->_images['small'] ) ) ) ? TRUE : FALSE ) : FALSE, FALSE, array( 'togglesOn' => array( 'ad_image_small', 'ad_image_medium' ) ), NULL, NULL, NULL, 'ad_image_more' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Upload( 'ad_image_small', ( $record->id ) ? ( ( isset( $record->_images['small'] ) ) ? \IPS\File::get( 'core_Advertisements', $record->_images['small'] ) : NULL ) : NULL, FALSE, array( 'image' => TRUE, 'storageExtension' => 'core_Advertisements' ), NULL, NULL, NULL, 'ad_image_small' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Upload( 'ad_image_medium', ( $record->id ) ? ( ( isset( $record->_images['medium'] ) ) ? \IPS\File::get( 'core_Advertisements', $record->_images['medium'] ) : NULL ) : NULL, FALSE, array( 'image' => TRUE, 'storageExtension' => 'core_Advertisements' ), NULL, NULL, NULL, 'ad_image_medium' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'ad_new_window', ( $record->id ) ? $record->new_window : FALSE, FALSE, array(), NULL, NULL, NULL, 'ad_new_window' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Upload( 'ad_image', ( $record->id ) ? ( ( isset( $record->_images['large'] ) and $record->_images['large'] ) ? \IPS\File::get( 'core_Advertisements', $record->_images['large'] ) : NULL ) : NULL, FALSE, array( 'image' => TRUE, 'storageExtension' => 'core_Advertisements' ), NULL, NULL, NULL, 'ad_image' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'ad_image_more', ( $record->id ) ? ( ( ( isset( $record->_images['medium'] ) and $record->_images['medium'] ) OR ( ( isset( $record->_images['small'] ) and $record->_images['small'] ) ) ) ? TRUE : FALSE ) : FALSE, FALSE, array( 'togglesOn' => array( 'ad_image_small', 'ad_image_medium' ) ), NULL, NULL, NULL, 'ad_image_more' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Upload( 'ad_image_small', ( $record->id ) ? ( ( isset( $record->_images['small'] ) and $record->_images['small'] ) ? \IPS\File::get( 'core_Advertisements', $record->_images['small'] ) : NULL ) : NULL, FALSE, array( 'image' => TRUE, 'storageExtension' => 'core_Advertisements' ), NULL, NULL, NULL, 'ad_image_small' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Upload( 'ad_image_medium', ( $record->id ) ? ( ( isset( $record->_images['medium'] ) and $record->_images['medium'] ) ? \IPS\File::get( 'core_Advertisements', $record->_images['medium'] ) : NULL ) : NULL, FALSE, array( 'image' => TRUE, 'storageExtension' => 'core_Advertisements' ), NULL, NULL, NULL, 'ad_image_medium' ) );
|
||||
|
||||
/* Add the location fields, remember to call extensions for additional locations.
|
||||
Array format: location => array of toggle fields to show */
|
||||
@@ -465,6 +472,7 @@ class _advertisements extends \IPS\Dispatcher\Controller
|
||||
$record->location = implode( ',', $locations );
|
||||
$record->html = ( $values['ad_type'] == 'html' ) ? $values['ad_html'] : NULL;
|
||||
$record->link = ( $values['ad_type'] == 'image' ) ? $values['ad_url'] : NULL;
|
||||
$record->new_window = ( $values['ad_type'] == 'image' ) ? $values['ad_new_window'] : 0;
|
||||
$record->impressions = ( isset( $values['ad_impressions'] ) ) ? $values['ad_impressions'] : 0;
|
||||
$record->clicks = ( $values['ad_type'] == 'image' AND isset( $values['ad_clicks'] ) ) ? $values['ad_clicks'] : 0;
|
||||
$record->active = ( $record->id ) ? $record->active : 1;
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
<?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
|
||||
* @since 03 Nov 2016
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Analytics
|
||||
*/
|
||||
class _analytics extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'analytics_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Analytics Settings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
$providers = array(
|
||||
'none' => 'analytics_provider_none',
|
||||
'ga' => 'analytics_provider_ga',
|
||||
'piwik' => 'analytics_provider_piwik',
|
||||
'custom' => 'analytics_provider_custom'
|
||||
);
|
||||
|
||||
$toggles = array(
|
||||
'ga' => array('analytics_ga'),
|
||||
'piwik' => array('analytics_piwik'),
|
||||
'custom' => array('analytics_custom', 'ipbseo_ga_paginatecode')
|
||||
);
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->addMessage('analytics_description');
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'ipbseo_ga_provider', \IPS\Settings::i()->ipbseo_ga_provider, FALSE, array( 'options' => $providers, 'toggles' => $toggles ) ) );
|
||||
|
||||
/* Add a CodeMirror element for each supported provider */
|
||||
foreach( $providers as $key => $provider )
|
||||
{
|
||||
if( $key == 'none' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Codemirror( 'analytics_' . $key, \IPS\Settings::i()->ipbseo_ga_provider == $key ? \IPS\Settings::i()->ipseo_ga : '', FALSE, array('height' => 150, 'mode' => 'javascript'), NULL, NULL, NULL, 'analytics_' . $key ) );
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Codemirror( 'ipbseo_ga_paginatecode', \IPS\Settings::i()->ipbseo_ga_paginatecode, FALSE, array('height' => 150, 'mode' => 'javascript'), NULL, NULL, NULL, 'ipbseo_ga_paginatecode' ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
/* Fix up values to ensure the correct snippet is saved */
|
||||
if ( !isset( $providers[ $values['ipbseo_ga_provider'] ] ) || $values['ipbseo_ga_provider'] == 'none' )
|
||||
{
|
||||
$values['ipbseo_ga_enabled'] = FALSE;
|
||||
$values['ipseo_ga'] = '';
|
||||
$values['ipbseo_ga_paginatecode'] = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$values['ipbseo_ga_enabled'] = TRUE;
|
||||
$values['ipseo_ga'] = $values['analytics_' . $values['ipbseo_ga_provider'] ];
|
||||
}
|
||||
|
||||
$form->saveAsSettings( $values );
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__analytics_edited' );
|
||||
\IPS\Output::i()->inlineMessage = \IPS\Member::loggedIn()->language()->addToStack('saved');
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_promotion_analytics');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'analytics', $form );
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief SEO
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @since 07 Jun 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -62,23 +62,24 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Build tab list */
|
||||
$tabs = array();
|
||||
$tabs['urls'] = 'seo_tab_furls';
|
||||
if ( !\IPS\CIC )
|
||||
{
|
||||
$tabs['urls'] = 'seo_tab_furls';
|
||||
}
|
||||
$tabs['sitemap'] = 'seo_tab_sitemap';
|
||||
$tabs['metatags'] = 'seo_tab_metatags';
|
||||
|
||||
/* Display */
|
||||
if ( $activeTabContents )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions']['ga'] = array(
|
||||
'title' => 'configure_google_analytics',
|
||||
'icon' => 'cogs',
|
||||
'link' => \IPS\Http\Url::internal( "app=core&module=applications&controller=enhancements&do=edit&id=core_GoogleAnalytics" ),
|
||||
);
|
||||
|
||||
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_promotion_seo');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->tabs( $tabs, $this->activeTab, $activeTabContents, \IPS\Http\Url::internal( "app=core&module=promotion&controller=seo" ) );
|
||||
}
|
||||
\IPS\Output::i()->sidebar['actions']['seo_visitors'] = array(
|
||||
'title' => 'Посетители с поисковых систем',
|
||||
'icon' => 'bar-chart-o',
|
||||
'link' => \IPS\Http\Url::internal( "app=core&module=promotion&controller=seovisitors" ),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,7 +103,8 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
try
|
||||
{
|
||||
$response = \IPS\Http\Url::external( \IPS\Settings::i()->base_url . 'login' )->request( 5, '1.1', FALSE )->get();
|
||||
$furlDefinition = \IPS\Http\Url::furlDefinition();
|
||||
$response = \IPS\Http\Url::external( \IPS\Settings::i()->base_url . $furlDefinition['login']['friendly'] )->request( NULL, NULL, FALSE )->get();
|
||||
if ( !in_array( mb_substr( $response->httpResponseCode, 0, 1 ), array( '2', '3' ) ) and ( \IPS\Settings::i()->site_online OR $response->httpResponseCode != 503 ) )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['htaccess_mod_rewrite_warning'] = \IPS\Member::loggedIn()->language()->get( $isApache ? 'htaccess_mod_rewrite_err' : 'htaccess_mod_rewrite_err_na' );
|
||||
@@ -122,6 +124,9 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
$form->saveAsSettings();
|
||||
\IPS\Member::clearCreateMenu();
|
||||
|
||||
/* Clear front navigation data store, otherwise it could still contain the non-rewrite furl for some items */
|
||||
unset( \IPS\Data\Store::i()->frontNavigation );
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
@@ -187,6 +192,11 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
|
||||
try
|
||||
{
|
||||
if( !( $values['sitemap_url'] instanceof \IPS\Http\Url ) )
|
||||
{
|
||||
throw new \RuntimeException;
|
||||
}
|
||||
|
||||
$response = $values['sitemap_url']->setQueryString( 'testsettings', 1 )->request()->get();
|
||||
|
||||
if ( $response->httpResponseCode != 200 or !mb_strpos( $values['sitemap_url'], "sitemap.php" ) )
|
||||
@@ -195,7 +205,7 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
}
|
||||
catch ( \IPS\Http\Request\Exception $e )
|
||||
catch ( \RuntimeException $e )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'form_url_bad' );
|
||||
}
|
||||
@@ -232,6 +242,9 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
/* Are we deleting? */
|
||||
if ( isset( \IPS\Request::i()->delete ) )
|
||||
{
|
||||
/* Make sure the user confirmed the deletion */
|
||||
\IPS\Request::i()->confirmedDelete();
|
||||
|
||||
if( isset( \IPS\Request::i()->root ) )
|
||||
{
|
||||
$meta = \IPS\Db::i()->select( '*', 'core_seo_meta', array( 'meta_id=?', (int) \IPS\Request::i()->root ) )->first();
|
||||
@@ -241,7 +254,7 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\DB::i()->delete( 'core_seo_meta', array( "meta_id=?", (int) \IPS\Request::i()->delete ) );
|
||||
\IPS\Db::i()->delete( 'core_seo_meta', array( "meta_id=?", (int) \IPS\Request::i()->delete ) );
|
||||
}
|
||||
|
||||
unset( \IPS\Data\Store::i()->metaTags );
|
||||
@@ -440,12 +453,12 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
$tags[ $data['name'] ] = $data['content'];
|
||||
}
|
||||
|
||||
\IPS\DB::i()->delete( 'core_seo_meta', array( 'meta_url=?', $url ) );
|
||||
\IPS\DB::i()->delete( 'core_seo_meta', array( 'meta_url=?', \IPS\Request::i()->original_url ) );
|
||||
\IPS\Db::i()->delete( 'core_seo_meta', array( 'meta_url=?', $url ) );
|
||||
\IPS\Db::i()->delete( 'core_seo_meta', array( 'meta_url=?', \IPS\Request::i()->original_url ) );
|
||||
|
||||
if( $title or count( $tags ) )
|
||||
{
|
||||
\IPS\DB::i()->insert( 'core_seo_meta', array( 'meta_url' => $url, 'meta_title' => $title, 'meta_tags' => json_encode( $tags ) ) );
|
||||
\IPS\Db::i()->insert( 'core_seo_meta', array( 'meta_url' => $url, 'meta_title' => $title, 'meta_tags' => json_encode( $tags ) ) );
|
||||
}
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__seo_metatag_settings' );
|
||||
@@ -484,7 +497,7 @@ Options -MultiViews
|
||||
RewriteEngine On
|
||||
RewriteBase {$dir}
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule \\.(js|css|jpeg|jpg|gif|png|ico)(\\?|$) {$dir}404error.php [L,NC]
|
||||
RewriteRule \\.(js|css|jpeg|jpg|gif|png|ico|map)(\\?|$) {$dir}404error.php [L,NC]
|
||||
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
<?php
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* SEO
|
||||
*/
|
||||
class _seovisitors extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
protected function manage()
|
||||
{
|
||||
|
||||
\IPS\Output::i()->title = 'Посетители с поисковых систем';
|
||||
|
||||
$table = new \IPS\Helpers\Table\Db( 'search_visitors', \IPS\Http\Url::internal('app=core&module=promotion&controller=seovisitors'));
|
||||
if(\IPS\Request::i()->filter) {
|
||||
if(\IPS\Request::i()->keywords) $table->baseUrl = $table->baseUrl->setQueryString('keywords',\IPS\Request::i()->keywords);
|
||||
if(\IPS\Request::i()->engine) $table->baseUrl = $table->baseUrl->setQueryString('engine',\IPS\Request::i()->engine);
|
||||
}
|
||||
$table->include = array('keywords','engine','url','name','date');
|
||||
$table->sortBy = $table->sortBy ?: 'date';
|
||||
$table->sortDirection = $table->sortDirection ?: 'desc';
|
||||
$table->langPrefix = 'seovisitors_';
|
||||
|
||||
|
||||
$table->joins = array(
|
||||
array(
|
||||
'select' => 'm.name',
|
||||
'from' => array( 'core_members', 'm' ),
|
||||
'where' => 'm.member_id=search_visitors.member'
|
||||
)
|
||||
);
|
||||
|
||||
$table->parsers = array(
|
||||
'date'=>function($val,$row) {
|
||||
return \IPS\DateTime::ts( $val )->relative();
|
||||
},
|
||||
'name' => function( $val, $row )
|
||||
{
|
||||
if($val) return "<a href='" . \IPS\Http\Url::internal( 'app=core&module=members&controller=members&do=edit&id=' ) . $row['member'] . "'>" . htmlentities( $val, \IPS\HTMLENTITIES, 'UTF-8', FALSE ) . "</a>";
|
||||
else return \IPS\Member::loggedIn()->language()->addToStack( 'guest' );
|
||||
},
|
||||
'keywords'=>function ($val,$row) {
|
||||
return "<a href='" . \IPS\Http\Url::internal( 'app=core&module=promotion&controller=seovisitors&filter=keywords&keywords=' ) . $val . "'>" . htmlentities( $val, \IPS\HTMLENTITIES, 'UTF-8', FALSE ) . "</a>";
|
||||
},
|
||||
'engine'=>function ($val,$row) {
|
||||
return "<a href='" . \IPS\Http\Url::internal( 'app=core&module=promotion&controller=seovisitors&filter=engine&engine=' ) . $val . "'>" . htmlentities( $val, \IPS\HTMLENTITIES, 'UTF-8', FALSE ) . "</a>";
|
||||
}
|
||||
);
|
||||
|
||||
$table->filters = array(
|
||||
'keywords'=>"keywords LIKE '".htmlentities( \IPS\Request::i()->keywords, \IPS\HTMLENTITIES, 'UTF-8', FALSE )."'",
|
||||
'engine'=>"engine LIKE '".htmlentities( \IPS\Request::i()->engine, \IPS\HTMLENTITIES, 'UTF-8', FALSE )."'"
|
||||
);
|
||||
|
||||
$table = preg_replace(array("/data-page='[0-9]*'/",'/data-action="tableFilter"/','/data-action="tableSort"/'), '', (string) $table);
|
||||
|
||||
\IPS\Member::loggedIn()->language()->parseOutputForDisplay($table);
|
||||
\IPS\Output::i()->output = str_replace(array(
|
||||
'seovisitors_keywords',
|
||||
'seovisitors_engine',
|
||||
'seovisitors_url',
|
||||
'seovisitors_name',
|
||||
'seovisitors_date'),
|
||||
array('Ключевики','Поисковик','Страница','Пользователь','Дата'),$table);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected static $engines = array(
|
||||
array( 'name' => 'Google', 'match' => '/http(s)?\:\/\/www\.google/', 'parser' => 'parseGoogleUrl' ),
|
||||
array( 'name' => 'Bing', 'match' => '/http\:\/\/www\.bing/', 'parser' => 'parseBingUrl' ),
|
||||
array( 'name' => 'Bing', 'match' => '/http\:\/\/www\.bing/', 'parser' => 'parseBingUrl' ),
|
||||
array( 'name' => 'Facebook', 'match' => '/http\:\/\/www\.facebook/', 'parser' => 'parseFacebookUrl' ),
|
||||
array( 'name' => 'Yandex', 'match' => '/http\:\/\/(www\.)?yandex/', 'parser' => 'parseYandexUrl'),
|
||||
array( 'name' => 'Rambler', 'match' => '/http\:\/\/(nova\.)?rambler/', 'parser' => 'parseRamblerUrl'),
|
||||
array( 'name' => 'Mail.ru', 'match' => '/http\:\/\/(go\.)?mail/', 'parser' => 'parseMailruUrl')
|
||||
);
|
||||
|
||||
|
||||
public static function track( $referrer, $queryString, $memberId )
|
||||
{
|
||||
|
||||
/*
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `search_visitors` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`member` int(11) DEFAULT NULL,
|
||||
`date` int(11) NOT NULL DEFAULT '0',
|
||||
`engine` varchar(50) NOT NULL,
|
||||
`keywords` varchar(250) NOT NULL,
|
||||
`url` varchar(2048) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_date_engine` (`date`,`engine`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
|
||||
*/
|
||||
|
||||
foreach( self::$engines as $engine )
|
||||
{
|
||||
if( preg_match( $engine['match'], $referrer ) )
|
||||
{
|
||||
|
||||
$obj = new self;
|
||||
|
||||
$keywords = trim( $obj->{$engine['parser']}( $referrer ) );
|
||||
if ( !empty( $keywords ) )
|
||||
{
|
||||
|
||||
\IPS\DB::i()->insert( 'search_visitors', array( 'date' => time(), 'member' => intval( $memberId ), 'engine' => $engine['name'], 'keywords' => $keywords, 'url' => $queryString ) );
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function parseGoogleUrl($url)
|
||||
{
|
||||
$matches = array();
|
||||
if(preg_match('/imgres/', $url) && preg_match('/prev\=([^\&]+)/', $url, $matches))
|
||||
{
|
||||
$url = urldecode($matches[1]);
|
||||
}
|
||||
|
||||
$matches = array();
|
||||
if(preg_match('/q\=([^\&]+)/', $url, $matches))
|
||||
{
|
||||
if(isset($matches[1]))
|
||||
{
|
||||
$keywords = $matches[1];
|
||||
$keywords = urldecode($keywords);
|
||||
$keywords = str_replace('+', ' ', $keywords);
|
||||
$keywords = str_replace('%20', ' ', $keywords);
|
||||
return $keywords;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function parseBingUrl($url)
|
||||
{
|
||||
$matches = array();
|
||||
if(preg_match('/q\=([^\&]+)/', $url, $matches))
|
||||
{
|
||||
if(isset($matches[1]))
|
||||
{
|
||||
$keywords = $matches[1];
|
||||
$keywords = urldecode($keywords);
|
||||
$keywords = str_replace('+', ' ', $keywords);
|
||||
$keywords = str_replace('%20', ' ', $keywords);
|
||||
return $keywords;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function parseYahooUrl($url)
|
||||
{
|
||||
$matches = array();
|
||||
if(preg_match('/p\=([^\&]+)/', $url, $matches))
|
||||
{
|
||||
if(isset($matches[1]))
|
||||
{
|
||||
$keywords = $matches[1];
|
||||
$keywords = urldecode($keywords);
|
||||
$keywords = str_replace('+', ' ', $keywords);
|
||||
$keywords = str_replace('%20', ' ', $keywords);
|
||||
return $keywords;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function parseFacebookUrl($url)
|
||||
{
|
||||
$matches = array();
|
||||
if(preg_match('/l\.php\?u\=([^\&]+)/', $url, $matches))
|
||||
{
|
||||
if(isset($matches[1]))
|
||||
{
|
||||
$keywords = $matches[1];
|
||||
$keywords = urldecode($keywords);
|
||||
$keywords = str_replace('http://', '', $keywords);
|
||||
$keywords = str_replace('https://', '', $keywords);
|
||||
$keywords = str_replace('+', ' ', $keywords);
|
||||
$keywords = str_replace('%20', ' ', $keywords);
|
||||
return $keywords;
|
||||
}
|
||||
}
|
||||
elseif(preg_match('/end\.php/', $url))
|
||||
{
|
||||
return 'Sponsored Ad';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
protected function parseYandexUrl($url)
|
||||
{
|
||||
$matches = array();
|
||||
if(preg_match('/text\=([^\&]+)/', $url, $matches))
|
||||
{
|
||||
if(isset($matches[1]))
|
||||
{
|
||||
$keywords = $matches[1];
|
||||
$keywords = urldecode($keywords);
|
||||
$keywords = str_replace('+', ' ', $keywords);
|
||||
$keywords = str_replace('%20', ' ', $keywords);
|
||||
return $keywords;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
protected function parseRamblerUrl($url)
|
||||
{
|
||||
$matches = array();
|
||||
if(preg_match('/query\=([^\&]+)/', $url, $matches))
|
||||
{
|
||||
if(isset($matches[1]))
|
||||
{
|
||||
$keywords = $matches[1];
|
||||
$keywords = urldecode($keywords);
|
||||
$keywords = str_replace('+', ' ', $keywords);
|
||||
$keywords = str_replace('%20', ' ', $keywords);
|
||||
return $keywords;
|
||||
}
|
||||
}
|
||||
if(preg_match('/words\=([^\&]+)/', $url, $matches))
|
||||
{
|
||||
if(isset($matches[1]))
|
||||
{
|
||||
$keywords = $matches[1];
|
||||
$keywords = urldecode($keywords);
|
||||
$keywords = str_replace('+', ' ', $keywords);
|
||||
$keywords = str_replace('%20', ' ', $keywords);
|
||||
return $keywords;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
protected function parseMailruUrl($url)
|
||||
{
|
||||
$matches = array();
|
||||
if(preg_match('/q\=([^\&]+)/', $url, $matches))
|
||||
{
|
||||
if(isset($matches[1]))
|
||||
{
|
||||
$keywords = $matches[1];
|
||||
$keywords = urldecode($keywords);
|
||||
$keywords = str_replace('+', ' ', $keywords);
|
||||
$keywords = str_replace('%20', ' ', $keywords);
|
||||
return $keywords;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Share Link Services
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @since 10 Jun 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -54,7 +54,7 @@ class _sharelinks extends \IPS\Node\Controller
|
||||
/* Now see if there are any new classes */
|
||||
foreach( new \DirectoryIterator( \IPS\ROOT_PATH . '/system/Content/ShareServices/' ) as $file )
|
||||
{
|
||||
if( $file->isDir() OR $file->isDot() OR $file == 'index.html' )
|
||||
if( $file->isDir() OR $file->isDot() OR $file->getExtension() !== 'php' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -104,6 +104,9 @@ class _sharelinks extends \IPS\Node\Controller
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
/* Make sure the user confirmed the deletion */
|
||||
\IPS\Request::i()->confirmedDelete();
|
||||
|
||||
\IPS\Db::i()->delete( 'core_share_links', array( 'share_id=?', (int) \IPS\Request::i()->id ) );
|
||||
|
||||
/* Clear guest page caches */
|
||||
|
||||
Reference in new issue
Block a user