⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 emailtemplates.php

📁 jsp程序开发系统
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php
// +-------------------------------------------------------------+
// | DeskPRO v [2.0.1 Production]
// | Copyright (C) 2001 - 2004 Headstart Solutions Limited
// | Supplied by WTN-WDYL
// | Nullified by WTN-WDYL
// | Distribution via WebForum, ForumRU and associated file dumps
// +-------------------------------------------------------------+
// | DESKPRO IS NOT FREE SOFTWARE
// +-------------------------------------------------------------+
// | License ID : Full Enterprise License =) ...
// | License Owner : WTN-WDYL Team
// +-------------------------------------------------------------+
// | $RCSfile: emailtemplates.php,v $
// | $Date: 2004/02/12 21:16:57 $
// | $Revision: 1.23 $
// +-------------------------------------------------------------+
// | File Details:
// | - E-mail template maintenance (administration interface)
// +-------------------------------------------------------------+

error_reporting(E_ALL & ~E_NOTICE);
require_once('./global.php');
//Nullify WTN-WDYL Team

require_once(INCLUDE_PATH . 'functions/conditional_functions.php');

// default do
$_REQUEST['do'] = trim($_REQUEST['do']);
if (!isset($_REQUEST['do']) or $_REQUEST['do'] == "") {
	$_REQUEST['do'] = "view_user";
}

// globalise variables
$global = array	(
			array('category'),
			array('id'),
			array('language')
);
rg($global);

// set language to 1 if not using languages
if (!$language) {
	$language = $settings[default_language];
}

/* email template categories:

	1 - USER EMAILS
	2 - TECH EMAILS

*/

########################################################################################
###############################     VIEW TECH TEMPLATES     ###############################
########################################################################################

if ($_REQUEST['do'] == "view_tech") {

	admin_header('Email Templates', 'View Email Templates');

	/***************************************************
					DEFAULT TEMPLATES
	***************************************************/

	// names of english templates
	$db->query("
			SELECT * FROM template_email 
			WHERE category = 'Tech Emails'
			AND backup = 0
			ORDER by custom, displayorder
	");
	
	while ($template = $db->row_array()) {

		if ($template[custom] == 1 AND !$y) {
			$table[] = table_midheader('Your Custom Templates');
			$y = true;
		}
		
		unset($word);
		if ($template[upgraded] == "1") {
			$word = "<font color=\"red\">CHANGED</font>";
		} elseif ($template[changed] == 1) {
			$word = "<font color=\"orange\">EDITED</font>";
		} 

		$table[] = array(
			"<b>$template[name]</b> $word",
			$template[description],	
			iff($template[changed] AND !$template[custom], jprompt('Are you sure you want to restore this template to its original?\\nAll your modifications will be lost', "emailtemplates.php?do=restore&id=$template[id]", 'Restore Default')),
			"<a href=\"emailtemplates.php?do=edit&id=$template[id]\">Edit</a>",
			iff($template[custom], jprompt('Confirm deletion of this template', "emailtemplates.php?do=delete&id=$template[id]", "Delete"))
		);
	}
		
	$columns = array('Name', 'Description', 'Restore Default', 'Edit', 'Delete');

	table_header("Default Templates");
	table_content($columns, $table, '', '', '', '', $width, $bottomline);
	table_footer();

	echo "<b>KEY:</b><ul>
		<li><font color=\"red\">CHANGED</font> : The template has been upgraded since you last changed it. You should find the changes made or revert the template.</li>
		<li><font color=\"orange\">EDITED</font> : You have made changes to this template.</li>
	</ul>
	";

}

########################################################################################
###############################     VIEW USER TEMPLATES     ###############################
########################################################################################

if ($_REQUEST['do'] == "view_user") {

	admin_header('Email Templates', 'View User Templates');

	/***************************************************
					PICK LANGUAGE
	***************************************************/

	/////////////// SELECT LANGUAGE ///////////////

	if ($settings[language_on] == "1") {

		$db->query("SELECT * FROM languages");
		while ($lang = $db->row_array()) {
			$languages[$lang[id]] = "$lang[name]";
		}

		$table[] = array(
			"<b>Currently viewing $languages[$language] templates:</b>", 
				form_select('language', $languages, '', $language) . '<input type="submit" name="submit" value="Change">'
			);
		
		echo form_hidden('do', 'view_user');
		echo "<form action=\"emailtemplates.php\" method=\"post\">";

		table_nohead($table);
		unset($table);
		echo '<br />';
	}

	/***************************************************
					DEFAULT TEMPLATES
	***************************************************/

	// details on current language
	$thislanguage = $db->query_return("SELECT * FROM languages WHERE id = $language");
	
	if ($thislanguage[custom] == "1") {
		$table = array('This language is a custom set of templates created by you. Changes made to these templates will have no corresponding updated icons that would appear on changes made to template sets downloaded with DeskPRO.');
		echo "<BR>";
		echo table_nohead($table);
		unset($table);
		echo "<br /><br />";	
	}

	// names of english templates
	$db->query("
			SELECT name FROM template_email 
			WHERE language = 1 
			AND custom != 1 
			AND category = 'User Emails'
			AND backup = 0
			ORDER by displayorder
	");

	while ($result = $db->row_array()) {
		$engtemplates_cat[] = $result[name];
	}

	// get default templates
	$db->query("
		SELECT * FROM template_email 
		WHERE language = '$language' 
		AND category = 'User Emails'
		AND backup = 0
		ORDER by category, displayorder
	");
	
	while ($template = $db->row_array()) {
		unset($word);

		$templates_temp[] = $template[name];

		if ($template[upgraded] == "1") {
			$word = "<font color=\"red\">CHANGED</font>";
		} elseif ($template[changed] == 1) {
			$word = "<font color=\"orange\">EDITED</font>";
		} 

		// restore link
		$bit = jprompt('Are you sure you want to restore this template to its original?\\nAll your modifications will be lost', "emailtemplates.php?do=restore&id=$template[id]", 'Restore Default');
		
		// set if we have a restore to default link
		if ($thislanguage[custom] != 1) {
			$table[] = array(
				"<b>$template[name]</b> $word",
				$template[description],	
				iff($template[changed], $bit, ''),
				"<a href=\"emailtemplates.php?do=edit&id=$template[id]\">Edit</a>"		
			);
		} else {
			$table[] = array(
				"<b>$template[name]</b> $word",
				$template[description],	
				"<a href=\"emailtemplates.php?do=edit&id=$template[id]\">Edit</a>",
			);
		}
	}

	// extra rows for uncreated templates
	if ($thislanguage[custom] == "1") {
		if (is_array($templates_temp)) {
			$notemplate = array_diff($engtemplates_cat, $templates_temp);
		} else {
			$notemplate = $engtemplates_cat;
		}
	}

	if (count($notemplate) > 0) {
		$uncreated = 1;
		$table[] = table_midheader('These are standard templates that you have not created for the ' . $thislanguage[name] . ' language');

		foreach($notemplate AS $key => $var) {
			$table[] = array(
				"<b><I>$var</I></b>", 
				'',
				'',
				"<a href=\"emailtemplates.php?name=$var&language=$language&do=newdefault\">Create</a>"
			);
		}

		// add any empty columns needed
		foreach ($table AS $key => $var) {
			if (count($var) == 3) {
				$table[$key][] = '';
			}
		}
	}

	if ($settings[language_on] AND $uncreated) {
		$columns = array('Name', 'Description', 'Edit', 'Create');
	} elseif ($thislanguage[custom] == 1) {
		$columns = array('Name', 'Description', 'Edit');
	} else {
		$columns = array('Name', 'Description', 'Restore Default', 'Edit');
	}

	table_header("Default Templates");
	table_content($columns, $table, '', '', '', '', $width, $bottomline);
	table_footer();

	unset($templates_temp, $table, $bottomline, $columns, $uncreated, $notemplate);

	/***************************************************
					CUSTOM TEMPLATES
	***************************************************/

	// get custom templates
	$db->query("SELECT * FROM template_email WHERE category = '$category' AND language = '$language' AND custom = 1");
	$count = $db->num_rows();
	
	while ($template = $db->row_array()) {

		$templates_temp[] = $template[name];

		// delete link (depends on language setting)
		if ($settings[language_on] == "1") {
			$bit = jprompt_multi('Are you sure you want to delete this custom template?', "Do you wish to delete this custom template for ALL languages?\\nCancel will only delete the $languages[$language] template", "emailtemplates.php?do=delete_all&id=$template[id]", "emailtemplates.php?do=delete&id=$template[id]",'Delete');
		} else {
			$bit = jprompt('Are you sure you want to delete this template?', "emailtemplates.php?do=restore&id=$template[id]", 'Delete');
		}

		$table[] = array(
			"<b>$template[name]</b>",
			$template[description],
			$bit,
			"<a href=\"emailtemplates.php?do=editcustom&id=$template[id]\">Edit</a>"	
		);
		
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -