Code:
<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers |
// | |
// | http://www.zen-cart.com/index.php |
// | |
// | Portions Copyright (c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | [email protected] so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// $Id: INFOPAGES2.php 2005-2-19
//
require('includes/application_top.php');
$action = (isset($_GET['action']) ? $_GET['action'] : '');
if (zen_not_null($action)) {
switch ($action) {
case 'setflag':
if ( ($_GET['flag'] == '0') || ($_GET['flag'] == '1') ) {
zen_set_page_status2($_GET['bID'], $_GET['flag']);
$messageStack->add_session(SUCCESS_PAGE_STATUS_UPDATED, 'success');
} else {
$messageStack->add_session(ERROR_UNKNOWN_STATUS_FLAG, 'error');
}
zen_redirect(zen_href_link(FILENAME_INFOPAGES2, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID']));
break;
case 'insert':
case 'update':
if (isset($_POST['pages_id'])) $pages_id = zen_db_prepare_input($_POST['pages_id']);
$pages_title = zen_db_prepare_input($_POST['pages_title']);
$pages_html_text = zen_db_prepare_input($_POST['pages_html_text']);
$alt_url = zen_db_prepare_input($_POST['alt_url']);
$pages_vertical_sort_order = (int)zen_db_prepare_input($_POST['vertical_sort_order']);
$pages_horizontal_sort_order = (int)zen_db_prepare_input($_POST['horizontal_sort_order']);
$page_error = false;
if (empty($pages_title)) {
$messageStack->add(ERROR_PAGE_TITLE_REQUIRED, 'error');
$page_error = true;
}
if (empty($pages_html_text)) {
}
if ($page_error == false) {
$sql_data_array = array('pages_title' => $pages_title,
'alt_url' => $alt_url,
'vertical_sort_order' => $pages_vertical_sort_order,
'horizontal_sort_order' => $pages_horizontal_sort_order,
'pages_html_text' => $pages_html_text);
if ($action == 'insert') {
// r.l. add into language beginn
$insert_sql_data = array('status' => '1',
'languages_id' => $_SESSION['languages_id']);
// r.l. add into language end
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
zen_db_perform(TABLE_INFOPAGES2, $sql_data_array);
$pages_id = zen_db_insert_id();
$messageStack->add_session(SUCCESS_PAGE_INSERTED, 'success');
} elseif ($action == 'update') {
zen_db_perform(TABLE_INFOPAGES2, $sql_data_array, 'update', "pages_id = '" . (int)$pages_id . "'");
$messageStack->add_session(SUCCESS_PAGE_UPDATED, 'success');
}
zen_redirect(zen_href_link(FILENAME_INFOPAGES2, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'bID=' . $pages_id));
} else {
$action = 'new';
}
break;
case 'deleteconfirm':
$pages_id = zen_db_prepare_input($_GET['bID']);
$db->Execute("delete from " . TABLE_INFOPAGES2 . " where pages_id = '" . (int)$pages_id . "'");
$messageStack->add_session(SUCCESS_PAGE_REMOVED, 'success');
zen_redirect(zen_href_link(FILENAME_INFOPAGES2, 'page=' . $_GET['page']));
break;
}
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
<script language="javascript" src="includes/menu.js"></script>
<script language="javascript" src="includes/general.js"></script>
<script type="text/javascript">
<!--
function init()
{
cssjsmenu('navbar');
if (document.getElementById)
{
var kill = document.getElementById('hoverJS');
kill.disabled = true;
}
if (typeof _editor_url == "string") HTMLArea.replaceAll();
}
// -->
</script>
<?php if (HTML_EDITOR_PREFERENCE=="FCKEDITOR") require(DIR_WS_INCLUDES.'fckeditor.php'); ?>
<?php if (HTML_EDITOR_PREFERENCE=="HTMLAREA") require(DIR_WS_INCLUDES.'htmlarea.php'); ?>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="init()">
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
<td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
</tr>
</table></td>
</tr>
<?php
if ($action == 'new') {
$form_action = 'insert';
$parameters = array('pages_title' => '',
'languages_id' => $_SESSION['languages_id'], // r.l. languages beginn , end
'pages_html_text' => '',
'alt_url' => '',
'vertical_sort_order' => '',
'horizontal_sort_order' => '',
'status' =>'');
$bInfo = new objectInfo($parameters);
if (isset($_GET['bID'])) {
$form_action = 'update';
$bID = zen_db_prepare_input($_GET['bID']);
$page_query = "select * from " . TABLE_INFOPAGES2 . " where pages_id = '" . $_GET['bID'] . "'";
$page = $db->Execute($page_query);
$bInfo->objectInfo($page->fields);
} elseif (zen_not_null($_POST)) {
$bInfo->objectInfo($_POST);
}
?>
<tr>
<td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr><?php echo zen_draw_form('new_page', FILENAME_INFOPAGES2, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'action=' . $form_action, 'post', 'enctype="multipart/form-data"'); if ($form_action == 'update') echo zen_draw_hidden_field('pages_id', $bID); ?>
<td><table border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="main"><?php echo TEXT_PAGES_TITLE; ?></td>
<td class="main"><?php echo zen_draw_input_field('pages_title', $bInfo->pages_title, '', true); ?></td>
</tr>
<tr>
<td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td valign="top" class="main"><?php echo TEXT_PAGES_HTML_TEXT; ?></td>
<td class="main"><?php echo zen_draw_textarea_field('pages_html_text', 'soft', '80', '20', $bInfo->pages_html_text); ?></td>
</tr>
<tr>
<td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_ALT_URL; ?></td>
<td class="main"><?php echo zen_draw_input_field('alt_url', $bInfo->alt_url);
echo '<br />' . TEXT_ALT_URL_EXPLAIN;
?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_VERTICAL_SORT_ORDER; ?></td>
<td class="main"><?php echo zen_draw_input_field('vertical_sort_order', $bInfo->vertical_sort_order);
echo '<br />' . TEXT_VSORT_ORDER_EXPLAIN;
?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_HORIZONTAL_SORT_ORDER; ?></td>
<td class="main"><?php echo zen_draw_input_field('horizontal_sort_order', $bInfo->horizontal_sort_order);
echo '<br />' . TEXT_HSORT_ORDER_EXPLAIN;
?></td>
</tr>
<tr>
<td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td colspan="2" class="main" align="left" valign="top" nowrap><?php echo (($form_action == 'insert') ? zen_image_submit('button_insert.gif', IMAGE_INSERT) : zen_image_submit('button_update.gif', IMAGE_UPDATE)). ' <a href="' . zen_href_link(FILENAME_INFOPAGES2, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . (isset($_GET['bID']) ? 'bID=' . $_GET['bID'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
</tr>
</table></td>
</form></tr>
<?php
} else {
?>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr class="dataTableHeadingRow" width="100%">
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PAGES; ?></td>
<td class="dataTableHeadingContent"></td>
<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>
<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_VSORT_ORDER; ?></td>
<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_HSORT_ORDER; ?></td>
</tr>
<?php
$pages_query_raw = "select pages_id, pages_title, status,vertical_sort_order,horizontal_sort_order from " . TABLE_INFOPAGES2 . " WHERE languages_id={$_SESSION['languages_id']} order by vertical_sort_order, horizontal_sort_order, pages_title";
$pages_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $pages_query_raw, $pages_query_numrows);
$pages = $db->Execute($pages_query_raw);
while (!$pages->EOF) {
if ((!isset($_GET['bID']) || (isset($_GET['bID']) && ($_GET['bID'] == $pages->fields['pages_id']))) && !isset($bInfo) && (substr($action, 0, 3) != 'new')) {
$bInfo_array = array_merge($pages->fields, $info);
$bInfo = new objectInfo($bInfo_array);
}
if (isset($bInfo) && is_object($bInfo) && ($pages->fields['pages_id'] == $bInfo->pages_id)) {
echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_INFOPAGES2, 'page=' . $_GET['page'] . '&bID=' . $pages->fields['pages_id']) . '\'">' . "\n";
} else {
echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_INFOPAGES2, 'page=' . $_GET['page'] . '&bID=' . $pages->fields['pages_id']) . '\'">' . "\n";
}
?>
<td class="dataTableContent"><?php echo ' ' . $pages->fields['pages_title']; ?></td>
<td class="dataTableContent" align="right"></td>
<td class="dataTableContent" align="center">
<?php
if ($pages->fields['status'] == '1') {
echo zen_image(DIR_WS_IMAGES . 'icon_status_green.gif', 'Active', 10, 10) . ' <a href="' . zen_href_link(FILENAME_INFOPAGES2, 'page=' . $_GET['page'] . '&bID=' . $pages->fields['pages_id'] . '&action=setflag&flag=0') . '">' . zen_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', 'Set Inactive', 10, 10) . '</a>';
} else {
echo '<a href="' . zen_href_link(FILENAME_INFOPAGES2, 'page=' . $_GET['page'] . '&bID=' . $pages->fields['pages_id'] . '&action=setflag&flag=1') . '">' . zen_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', 'Set Active', 10, 10) . '</a> ' . zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', 'Inactive', 10, 10);
}
?></td>
<td class="dataTableContent" align="center"><?php echo ' ' . $pages->fields['vertical_sort_order']; ?></td>
<td class="dataTableContent" align="center"><?php echo ' ' . $pages->fields['horizontal_sort_order']; ?></td>
</tr>
<?php
$pages->MoveNext();
}
?>
<tr>
<td class="smallText" valign="top"><?php echo $pages_split->display_count($pages_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_PAGES); ?></td>
<td class="smallText" align="right"><?php echo $pages_split->display_links($pages_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], zen_get_all_get_params(array('page', 'info', 'x', 'y', 'lID'))); ?></td>
</tr>
<tr>
<td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td align="right" colspan="2"><?php echo '<a href="' . zen_href_link(FILENAME_INFOPAGES2, 'action=new') . '">' . zen_image_button('button_new_file.gif', IMAGE_NEW_PAGE) . '</a>'; ?></td>
</tr>
</table></td>
</tr>
</table></td>
<?php
$heading = array();
$contents = array();
switch ($action) {
case 'delete':
$heading[] = array('text' => '<b>' . $bInfo->pages_title . '</b>');
$contents = array('form' => zen_draw_form('pages', FILENAME_INFOPAGES2, 'page=' . $_GET['page'] . '&bID=' . $bInfo->pages_id . '&action=deleteconfirm'));
$contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
$contents[] = array('text' => '<br><b>' . $bInfo->pages_title . '</b>');
$contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_INFOPAGES2, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
break;
default:
if (is_object($bInfo)) {
$heading[] = array('text' => '<b>' . $bInfo->pages_title . '</b>');
$contents[] = array('align' => 'center', 'text' => '<br><br><a href="' . zen_href_link(FILENAME_INFOPAGES2, 'page=' . $_GET['page'] . '&bID=' . $bInfo->pages_id . '&action=new') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_INFOPAGES2, 'page=' . $_GET['page'] . '&bID=' . $bInfo->pages_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a><br><br><br>');
if ($bInfo->date_scheduled) $contents[] = array('text' => '<br>' . sprintf(TEXT_PAGES_SCHEDULED_AT_DATE, zen_date_short($bInfo->date_scheduled)));
if ($bInfo->expires_date) {
$contents[] = array('text' => '<br>' . sprintf(TEXT_PAGES_EXPIRES_AT_DATE, zen_date_short($bInfo->expires_date)));
} elseif ($bInfo->expires_impressions) {
$contents[] = array('text' => '<br>' . sprintf(TEXT_PAGES_EXPIRES_AT_IMPRESSIONS, $bInfo->expires_impressions));
}
if ($bInfo->date_status_change) $contents[] = array('text' => '<br>' . sprintf(TEXT_PAGES_STATUS_CHANGE, zen_date_short($bInfo->date_status_change)));
}
break;
}
if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
echo ' <td width="25%" valign="top">' . "\n";
$box = new box;
echo $box->infoBox($heading, $contents);
echo ' </td>' . "\n";
}
?>
</tr>
</table></td>
</tr>
<?php
}
?>
</table></td>
<!-- body_text_eof //-->
</tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
I've had a brief look through the files in question, but it's all a bit incomprehensible to me.