コード例 #1
0
 /**
  * @see \wcf\system\event\IEventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     $this->eventObj = $eventObj;
     // set variables required for the smartbanner feature
     $functionCallAfterWindowLoad = 0;
     $app_forum_name = WCF::getLanguage()->get(PAGE_TITLE);
     $board_url = WCF::getPath('wbb');
     $tapatalk_dir = WBB_TAPATALK_DIR;
     $tapatalk_dir_url = $board_url . $tapatalk_dir;
     $app_location_url = $this->getSchemeURL($page_type);
     $app_banner_message = defined('WBB_TAPATALK_APP_BANNER_MESSAGE') ? WBB_TAPATALK_APP_BANNER_MESSAGE : WCF::getLanguage()->get('wcf.user.3rdparty.tapatalk.app_banner_message');
     $app_ios_id = StringUtil::trim(defined('WBB_TAPATALK_APP_IOS_ID') ? WBB_TAPATALK_APP_IOS_ID : '');
     $app_android_id = StringUtil::trim(defined('WBB_TAPATALK_APP_ANDROID_ID') ? WBB_TAPATALK_APP_ANDROID_ID : '');
     $app_kindle_url = StringUtil::trim(defined('WBB_TAPATALK_APP_KINDLE_URL') ? WBB_TAPATALK_APP_KINDLE_URL : '');
     // for full view ads
     $api_key = StringUtil::trim(defined('WBB_TAPATALK_API_KEY') ? WBB_TAPATALK_API_KEY : '');
     $app_ads_enable = defined('WBB_TAPATALK_APP_FULL_BANNER') ? WBB_TAPATALK_APP_FULL_BANNER : 1;
     $app_banner_enable = defined('WBB_TAPATALK_APP_SMART_BANNER') ? WBB_TAPATALK_APP_SMART_BANNER : 1;
     $twitterfacebook_card_enabled = defined('WBB_TAPATALK_APP_FACEBOOK_TWITTER_DEEP_LINKING') ? WBB_TAPATALK_APP_FACEBOOK_TWITTER_DEEP_LINKING : 1;
     $banner_control = defined('WBB_TAPATALK_BANNER_CONTROL') ? WBB_TAPATALK_BANNER_CONTROL : 1;
     if (WBB_TAPATALK_BANNER_LAST_CHECK == 0 || TIME_NOW - WBB_TAPATALK_BANNER_LAST_CHECK > 1) {
         try {
             // fetch access_token
             $request = new HTTPRequest('https://tapatalk.com/get_forum_info.php', array(), array('key' => md5(StringUtil::trim(WBB_TAPATALK_API_KEY)), 'url' => $board_url));
             $request->execute();
             $reply = $request->getReply();
             $response = $reply['body'];
         } catch (\Exception $e) {
             die($e->getMessage());
         }
         if (!empty($response)) {
             $result = explode(':', $response);
             if ($result[0] == 'banner_control') {
                 if ($banner_control != $result[1]) {
                     $options = array('wbb_tapatalk_banner_last_check' => TIME_NOW, 'wbb_tapatalk_banner_control' => $banner_control);
                     OptionEditor::import($options);
                 }
             }
         }
     }
     if (!$banner_control) {
         $app_ads_enable = $app_banner_enable = 1;
     }
     if (file_exists(WBB_TAPATALK_DIR . '/smartbanner/head.inc.php')) {
         include WBB_TAPATALK_DIR . '/smartbanner/head.inc.php';
     }
     if (isset($app_head_include)) {
         // rebuild the output HTML since we must place the meta tags for Twitter somewhere else
         WCF::getTPL()->assign(array('tapatalkSmartbanner' => isset($app_banner_head) ? $app_banner_head : '', 'tapatalkTwitterAppCard' => isset($app_head_include) ? $app_head_include : ''));
     }
 }
コード例 #2
0
<?php

use wcf\data\option\OptionEditor;
/**
 * @author	Alexander Ebert
 * @copyright	2001-2015 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	com.woltlab.wcf
 * @category	Community Framework
 */
$options = array('cache_source_type' => CACHE_SOURCE_TYPE == 'no' ? 'disk' : CACHE_SOURCE_TYPE, 'last_update_time' => TIME_NOW, 'url_legacy_mode' => 1, 'url_to_lowercase' => 0, 'user_cleanup_notification_lifetime' => USER_CLEANUP_NOTIFICATION_LIFETIME == 60 ? 14 : USER_CLEANUP_NOTIFICATION_LIFETIME, 'wcf_uuid' => sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535)));
// clear recaptcha keys if public key and private key match WoltLab's OEM key
if (RECAPTCHA_PUBLICKEY === '6LfOlMYSAAAAADvo3s4puBAYDqI-6YK2ybe7BJE5' && RECAPTCHA_PRIVATEKEY === '6LfOlMYSAAAAAKR3m_EFxmDv1xS8PCfeaSZ2LdG9') {
    $options['recaptcha_publickey'] = '';
    $options['recaptcha_privatekey'] = '';
}
OptionEditor::import($options);
OptionEditor::resetCache();