/*
[Discuz!] (C)2001-2006 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$RCSfile: passport.inc.php,v $
$Revision: 1.4 $
$Date: 2006/03/01 01:21:42 $
*/
if(!defined('IN_DISCUZ') || !isset($PHP_SELF) || !preg_match("/[\/\\\\]admincp\.php$/", $PHP_SELF)) {
exit('Access Denied');
}
cpheader();
if(!in_array($action, array('passport', 'siteengine', 'shopex'))) {
cpmsg('undefined_action');
}
$query = $db->query("SELECT * FROM {$tablepre}settings WHERE variable LIKE 'passport_%'");
while($setting = $db->fetch_array($query)) {
$settings[$setting['variable']] = $setting['value'];
}
if($settings['passport_status'] && $settings['passport_status'] != $action) {
cpmsg('passport_notmatch');
}
if(!submitcheck('ppsubmit')) {
?>
$passportcredits = '';
for($i = 0; $i $passportcredits .= ''.($i ? 'extcredits'.$i.(!empty($extcredits[$i]['title']) ? ' ('.$extcredits[$i]['title'].')' : '') : $lang['passport_extcredits_none']).'';
}
$passportcredits .= '';
showtype('passport_settings', 'top');
showsetting('passport_status', 'settingsnew[passport_status]', $settings['passport_status'] == $action, 'radio');
showsetting('passport_url', 'settingsnew[passport_url]', $settings['passport_url'], 'text');
showsetting('passport_key', 'settingsnew[passport_key]', $settings['passport_key'], 'text');
showsetting('passport_expire', 'settingsnew[passport_expire]', $settings['passport_expire'], 'text');
if($action == 'siteengine') {
echo ''.
''.
'';
} elseif($action == 'shopex') {
echo ''.
''.
'';
} else {
showsetting('passport_register_url', 'settingsnew[passport_register_url]', $settings['passport_register_url'], 'text');
showsetting('passport_login_url', 'settingsnew[passport_login_url]', $settings['passport_login_url'], 'text');
showsetting('passport_logout_url', 'settingsnew[passport_logout_url]', $settings['passport_logout_url'], 'text');
}
showsetting('passport_extcredits', '', '', $passportcredits);
showtype('', 'bottom');
echo '';
} else {
if($settingsnew['passport_status']) {
if(!$settingsnew['passport_url'] || !$settingsnew['passport_register_url'] || !$settingsnew['passport_login_url'] || !$settingsnew['passport_logout_url']) {
cpmsg('passport_url_invalid');
} elseif(strlen($settingsnew['passport_key']) < 10) {
cpmsg('passport_key_invalid');
}
$settingsnew['passport_status'] = $action;
$settingsnew['passport_expire'] = $settingsnew['passport_expire'] < 0 ? 0 : $settingsnew['passport_expire'];
if(substr(($settingsnew['passport_url'] = trim($settingsnew['passport_url'])), -1) != '/') {
$settingsnew['passport_url'] = $settingsnew['passport_url'].'/';
}
} else {
$settingsnew['passport_status']
= $settingsnew['passport_register_url']
= $settingsnew['passport_login_url']
= $settingsnew['passport_logout_url']
= '';
}
foreach($settingsnew as $key => $val) {
if(isset($settings[$key]) && $settings[$key] != $val) {
$db->query("REPLACE INTO {$tablepre}settings (variable, value)
VALUES ('$key', '$val')");
}
}
updatecache('settings');
cpmsg('passport_update_succeed');
}
?>