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

📄 replace.php

📁 jsp程序开发系统
💻 PHP
字号:
<?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: replace.php,v $
// | $Date: 2004/02/10 01:34:25 $
// | $Revision: 1.12 $
// +-------------------------------------------------------------+
// | File Details:
// | - Replacement variable maintenance (administration interface)
// +-------------------------------------------------------------+

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

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

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

############################### ADD REPLACEMENT ###############################

if ($_REQUEST['do'] == "add" OR $_REQUEST['do'] == 'edit') {

	if ($_REQUEST['do'] == 'edit') {
		admin_header('Styles', 'Edit Replacement Variable');
		$replace = $db->query_return("SELECT * FROM template_replace WHERE id = '$id'");

	} else {
		admin_header('Styles', 'Add Replacement Variable');
	}

	$table[] = array('<b>Variable Name</b>', form_input('name', $replace[name]));
	$table[] = array('<b>Replace with</b>', form_textarea('value', 60, 4, $replace[value]));
	$table[] = array('<b>Description</b>', form_textarea('description', 60, 4, $replace[description]));

	if ($_REQUEST['do'] == 'edit') {
		table_header('Edit Variable', 'replace.php', array('do' => 'edit2', 'id' => $id));
		table_content('', $table);
		table_footer('Edit Variable');
	} else {
		table_header('Add New Variable', 'replace.php', array('do' => 'add2'));
		table_content('', $table);
		table_footer('Add Variable');
	}

}

############################### EDIT REPLACEMENT (2) ###############################

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

	if ($_REQUEST['name']) {
		$db->query("UPDATE template_replace SET
						name = '" . mysql_escape_string($_REQUEST['name']) . "',
						value = '" . mysql_escape_string($_REQUEST['value']) . "',
						description = '" . mysql_escape_string($_REQUEST['description']) . "',
						custom = 1
						WHERE id = '$id'
					");
		
		alert('Replacement variable updated');
	} else {
		alert('You did not enter a variable name');
	}

	$_REQUEST['do'] = 'view';

}

############################### ADD REPLACEMENT (2) ###############################

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

	if ($_REQUEST['name']) {
		$db->query("INSERT INTO template_replace SET
						name = '" . mysql_escape_string($_REQUEST['name']) . "',
						value = '" . mysql_escape_string($_REQUEST['value']) . "',
						description = '" . mysql_escape_string($_REQUEST['description']) . "',
						custom = 1
					");
		
		alert('Replacement variable added');

	} else {
		alert('You did not enter a variable name');
	}

	$_REQUEST['do'] = 'view';

}

############################### DELETE REPLACEMENT ###############################

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

	$db->query("DELETE FROM template_replace WHERE id = '$id'");
	alert('Replacement variable deleted');

	$_REQUEST['do'] = 'view';

}

############################### VIEW REPLACEMENTS ###############################

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

	admin_header('Styles', 'View Replacement Variable');

	$db->query("SELECT * FROM template_replace");
	while ($result = $db->row_array()) {

		$table[] = array(
			$result[name], 
			htmlspecialchars($result[value]), 
			$result[description], 
			"<a href=\"replace.php?do=edit&id=$result[id]\">edit</a>",
			jprompt('Please confirm you wish to delete this variable', "replace.php?do=delete&id=$result[id]", 'delete')
		);
	}

	$cols = array('Replace', 'Replacement Value', 'Description', 'Edit', 'Delete');
	table_header('Your Replacement Variables');
	table_content($cols, $table, '', '', '', '', array('50%', '25%', '25%'));
	table_footer();

}


⌨️ 快捷键说明

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