Location: PHPKode > scripts > Kemana Directory > msg.php
<?php
// part of qEngine
require "./includes/user_init.php";

// convert -_ into bullet
function bullet_msg ($msg)
{
	$msg = str_replace ('-_', "</li>\n<li>", $msg);
	$msg = "<ul><li>$msg</li></ul>";
	return $msg;
}


// convert -_ into comma
function comma_msg ($msg)
{
	$msg = str_replace ('-_', ',', $msg);
	return $msg;
}

$popup = get_param ('popup');
$admin = get_param ('admin');
$url = get_param ('url');
$r = get_param ('r');
$id = strtoupper (get_param ('id'));
$msg = stripslashes (safe_receive (get_param ('msg')));
$mini = FALSE;	// if true indicates that popup message should using mini popup, which is: very simple (no whistles, etc), and disappear in 1 second, aka unobtrusive message box) -- see OK case

// get msg from db
$f = ip_config_value ('system_msg');
$foo = explode ('|', $f);
if (!empty ($foo) && ($foo[0] == 'MSG'))
{
	if (empty ($msg) && !empty ($foo[1])) $msg = stripslashes (safe_receive ($foo[1]));
	if (empty ($url) && !empty ($foo[2])) $url = urldecode ($foo[2]);
}

// if loop -> go to front page.
if ($r) redir ($config['site_url']);

if (empty ($url))
{
	if (empty ($_SERVER['HTTP_REFERER']))
	{
		if ($admin)
			$url = $config['site_url'].'/admin/index.php';
		else
			$url = $config['site_url'].'/index.php';
	}
	else
		$url = $_SERVER['HTTP_REFERER'];
}

// add loop tag
if (strpos ($url, '?')) $repeat = '&r=1'; else $repeat = '?r=1';
if (strpos ($url, '&r=1') || strpos ($url, '?r=1')) $repeat = '';

if (empty ($id) && !empty ($msg)) $id = 'ECHO';

switch ($id)
{
	case 'NO_SLOT':
	 $txt['title'] = 'Failed!';
	 $txt['message'] = 'Sorry, our sponsored slot has been full. Please try again next time, or contact us for more information.';
	break;

	case 'UPGRADE_ERR':
	 $txt['title'] = 'Failed!';
	 $txt['message'] = 'You can\'t upgrade this item now. Wait until it\'s approved!';
	break;
	
	case 'ITEM_ID_NOT_FOUND':
	 $txt['title'] = 'Not Found!';
	 $txt['message'] = 'The link is not found, may be it needs to be approved first.';
	break;
	
	case 'NO_EDIT':
	 $txt['title'] = 'Not Editable!';
	 $txt['message'] = 'The link is not editable!';
	break;
	
	case 'INVALID_PASSWD':
	 $txt['title'] = 'Wrong Password!';
	 $txt['message'] = 'The supplied password doesn\'t match. Please try again.';
	break;

	case 'CF_ERR':
	 $msg .= '-_Notes: you can\'t upload some file types. See FAQ.';
	 $txt['title'] = 'Failed!';
	 $txt['message'] = 'Your submission can\'t be procceed, some fields are missing or invalid:'.bullet_msg ($msg);
	break;

	case 'ADD_ERR':
	 $txt['title'] = 'Failed!';
	 $txt['message'] = 'Your submission can\'t be procceed: '.bullet_msg ($msg);
	break;

	case 'ADD_OK':
	 $txt['title'] = 'Success!';
	 $txt['message'] = 'Your submission has been accepted. We will review your submission, and will inform you our decision. Thank you';
	break;	

// modules
	case 'INSTALL_OK':
	 $txt['title'] = 'Installation Complete';
	 $txt['message'] = 'You may need to <a href="#" onclick="top.location.reload(true)">refresh your browser</a> to display the new module menu.';
	break;
	
	case 'UNINSTALL_OK':
	 $txt['title'] = 'Uninstalled';
	 $txt['message'] = 'You may need to <a href="#" onclick="top.location.reload(true)">refresh browser</a> to remove module menu.<br />'.
	                   'You may also need to remove some files/folders manually.';
	break;
	
	case 'NO_CONFIG':
	 $txt['title'] = 'No Configurable Options';
	 $txt['message'] = 'This module/plugin has no options that you can configure.';
	break;

// admin messages
	case 'CACHE':
	 $txt['title'] = 'Please Rebuild System Cache';
	 $txt['message'] = 'If you have made some changes, then you should <a href="cache.php"> rebuild your system cache</a>. This makes your site run more efficiently.';
	break;
	
	case 'TPL_ONLY':
	 $txt['title'] = 'Cannot Open File!';
	 $txt['message'] = 'You are about to open a file that is not a recognised skin-file. (*.tpl) files are skin files and are used to make your site look as it does';
	break;

	case 'SA_ONLY';
	 $txt['title'] = 'Whoops!';
	 $txt['message'] = 'This feature is for staff only!';
	break;

	case 'NO_LEVEL';
	 $txt['title'] = 'You Don\'t Have Permission!';
	 $txt['message'] = 'This feature requires that you have a higher administrator level.';
	break;

	case 'QADMIN_EMAIL_OK':
	 $txt['title'] = 'Complete!';
	 $txt['message'] = 'Your changes have been saved. An email has also been sent to your address with form values.';
	break;
	
	case 'QADMIN_REQUIRED_ERR':
	 $txt['title'] = 'Empty Fields!';
	 $txt['message'] = 'Please fill the following: '.bullet_msg ($msg);
	break;
	
	case 'ADMIN_ERROR':
	case 'ADMIN_ERR':
	 $txt['title'] = 'FAILED!';
	 $txt['message'] = 'Please try again.';
	break;

	case 'ADMIN_OK':
	case 'SQL_OK':
	case 'OK':
	 if ($admin) $mini = TRUE;	// please make sure you only mini mode in ACP, you can easily add mini mode to UI skins, but, no reason to do that (?)
	 $txt['title'] = 'Complete!';
	 $txt['message'] = 'Your changes have been saved';
	 if ($config['demo_mode']) $txt['message'] .= '<p align="center">Demo mode, you can\'t upload files in demo mode!</p>';
	break;
	
	case 'EMAIL_OK':
	 if ($admin) $mini = TRUE;	// please make sure you only mini mode in ACP, you can easily add mini mode to UI skins, but, no reason to do that (?)
	 $txt['title'] = 'Email Sent!';
	 $txt['message'] = 'An email has been sent to the recipient.';
	break;

// login / register / passwd	
	case 'RESET_ERROR':
	 $txt['title'] = 'Password Reset Failed!';
	 $txt['message'] = 'Make sure you have entered valid username, reset code and new password!';
	break;

	case 'ACT_ERROR':
	 $txt['title'] = 'Activation Failed!';
	 $txt['message'] = bullet_msg ($msg);
	break;
	
	case 'USER_ACT':
	 $txt['title'] = 'User Activation Required!';
	 $txt['message'] = 'We require all new members to activate their account before they can login.<br />'
	                  .'Please check your emails for more information and to verify your email address';
	break;

	case 'CONTACT_ERR':
	 $txt['title'] = 'Can not send the information';
	 $txt['message'] = 'This is why:'.bullet_msg ($msg);
	break;

	case 'CONTACT_OK':
	 $txt['title'] = 'Complete';
	 $txt['message'] = 'Your message has been sent. Thank you.';
	break;

	case 'PASSWD_CHANGED':
	 $txt['title'] = 'Password Changed!';
	 $txt['message'] = 'Your password has been changed. You may need to logout of your account and login again.';
	break;
	
	case 'REGISTER_ERROR':
	 $txt['title'] = 'Register Error!';
	 $txt['message'] = 'Error in:'.bullet_msg ($msg);
	break;

	case 'UPDATE_ERROR':
	 $txt['title'] = 'Profile Error!';
	 $txt['message'] = 'Error in:'.bullet_msg ($msg);
	break;

	case 'LOST_ERROR':
	 $txt['title'] = 'Password Retrival Failed!';
	 $txt['message'] = 'Your username/email address could not be found in our database.';
	break;

	case 'LOST_OK':
	 $txt['title'] = 'Password Retrival Success!';
	 $txt['message'] = 'An email has been sent to you containing information regarding your username &amp; password. Please check your inbox.';
	break;

	case 'BAD_LOGIN':
	 $txt['title'] = 'Unable to Login!';
	 $txt['message'] = 'Incorrect username or password. Please try again or contact us for assistance';
	break;

// common messages
	case 'EZFORM_OK':
	 $txt['title'] = 'Form Has Been Submitted!';
	 $txt['message'] = 'Thank you!';
	break;

	case 'EZFORM_REQUIRED_ERR':
	 $txt['title'] = 'Form Can\'t Be Submitted!';
	 $txt['message'] = bullet_msg ($msg);
	break;
	
	case 'EMAIL_ERR':
	 $txt['title'] = 'Invalid Email Address!';
	 $txt['message'] = 'The email address you just entered does not appear to be valid. Please ensure you have entered it correctly or enter an alternative email address';
	break;

	case 'UNSUB_OK':
	 $txt['title'] = 'Subscription Changes Made!';
	 $txt['message'] = 'Your email address has now been removed from our database and you will not receive any more correspondance from us.';
	break;

	case 'SUB_OK':
	 $txt['title'] = 'Subscription Success!';
	 $txt['message'] = 'Thanks for subscribing at our site. Check your inbox soon for notifications from us.';
	break;

	case 'SITE_CLOSED':
	 $txt['title'] = 'Temporarily Closed!';
	 $txt['message'] = $config['site_name'].' is temporarily closed as we are updating our site.<br />Please try visiting us again soon!.';
	break;

	case 'TELL_ERROR':
	 $txt['title'] = 'Whoops!';
	 $txt['message'] = 'It looks like you missed out some of the information that was required. Please try again.';
	break;

	case 'TELL_OK':
	 $txt['title'] = 'Complete';
	 $txt['message'] = 'An email has been sent to '.$msg.'. Thank you.';
	break;
	
	case 'DEMO_MODE':
	 $txt['title'] = 'Demo Mode!';
	 $txt['message'] = 'Currently running in demo mode.<br />Your changes have not been saved!';
	break;

	case 'MINIMUM_3':
	 $txt['title'] = 'Minimum Three Characters!';
	 $txt['message'] = 'Unable to search using the information you have just given. Minimum 3 characters needed for site searches!';
	break;

	case 'NOT_MEMBER':
	 $txt['title'] = 'Members Only!';
	 $txt['message'] = 'This page is for members only!';
	break;

	case 'USERNAME_NOT_FOUND':
	 $txt['title'] = 'Username Not Available!';
	 $txt['message'] = 'Username can not be found or is no longer available!';
	break;
	
	case 'SQL_ERROR':
	 $txt['title'] = 'Database Error';
	 $txt['message'] = $msg;
	break;

	case 'ECHO':
	 $txt['title'] = 'Notice!';
	 $txt['message'] = $msg;
	break;
	
	case 'MSG_ABOUT':
	 $txt['title'] = 'Copyright(c)2007-10, qEngine';
	 $txt['message'] = 'This software is powered by <a href="http://www.c97.net">qEngine</a>. '
	                  .'Removal of this copyright information or any other credits is strictly prohibited';
	break;

	default:
	 $txt['title'] = 'For your Attention...';
	 $txt['message'] = 'Message ID: '.$id;
	 if ($msg) $txt['message'] .= '<BR>Additional Message: '.$msg;
	 $txt['url'] .= "<br /><a href=\"mailto:\">Contact C97net</a> (www.c97.net) for more information";
	break;
}


// redirection
$url = str_replace ('&amp;', '&', $url);
if (is_numeric ($url))
	$url = '';
else
	$url = $url.$repeat;

// to avoid redirectoin for site_closed message
if ($id == 'SITE_CLOSED')
{
	require ('./includes/admin_func.php');
	$tpl_mode = 'user';
	echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
	echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"$lang[l_language_short]\" xml:lang=\"$lang[l_language_short]\" dir=\"$lang[l_direction]\">\n";
	echo "<head><title>Site Temporary Closed</title>\n</head>\n";
	echo "<body>\n";
	echo "<div style=\"margin:auto; border:solid 2px #000; background:yellow; width:500px\">\n";
	echo quick_tpl (load_tpl ('msg.tpl'), $txt);
	echo "</div>\n</body>\n</html>";
	die;
}

// flush
if ($admin)
{
	$tpl_mode = 'admin';
	$output = quick_tpl (load_tpl ('adm', 'msg.tpl'), $txt);
	ip_config_update ('system_msg', $mini ? 'mini//'.addslashes ($output) : addslashes ($output));
	redir ($url);
}
elseif ($popup)
{
	$tpl_mode = 'popup';
	// echo quick_tpl (load_tpl ('popup.tpl'), $txt);
	$output = quick_tpl (load_tpl ('msg.tpl'), $txt);
	ip_config_update ('system_msg', $mini ? 'mini//'.addslashes ($output) : addslashes ($output));
	redir ();
}
else
{
	$tpl_mode = 'user';
	$output = quick_tpl (load_tpl ('msg.tpl'), $txt);
	ip_config_update ('system_msg', $mini ? 'mini//'.addslashes ($output) : addslashes ($output));
	redir ($url);
}
?>
Return current item: Kemana Directory