<?php
/**
 * [Discuz!] (C)2001-2099 Discuz! Team
 * This is NOT a freeware, use is subject to license terms
 * https://license.discuz.vip
 */
if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

if(!($_G['setting']['creditspolicy']['promotion_visit'] || $_G['setting']['creditspolicy']['promotion_register'])) {
	showmessage('action_closed', NULL);
}

loadcache('creditrule');

$visit = $_G['cache']['creditrule']['promotion_visit'];
$register = $_G['cache']['creditrule']['promotion_register'];
$copystr = lang('spacecp', 'invite_you_to_visit', ['user' => $_G['username'], 'bbname' => daddslashes($_G['setting']['bbname'])]);

$visitstr = $regstr = '';
foreach($_G['setting']['extcredits'] as $key => $credit) {
	$creditkey = 'extcredits'.$key;
	if($visit[$creditkey]) {
		$visitstr .= $credit['title'].($visit[$creditkey] > 0 ? '+'.$visit[$creditkey] : $visit[$creditkey]).'&nbsp;';
	}
	if($register[$creditkey]) {
		$regstr .= $credit['title'].($register[$creditkey] > 0 ? '+'.$register[$creditkey] : $register[$creditkey]).'&nbsp;';
	}
}

include_once template('home/spacecp_promotion');
