read()) { if (!is_dir($boxes_directory . $file)) { if (substr($file, strrpos($file, '.')) == $file_extension) { if ($file != 'empty.txt') { $directory_array[] = $file; } } } } if (sizeof($directory_array)) { sort($directory_array); } $dir->close(); } // Check all exisiting boxes are in the current template /sideboxes/template_dir $dir_check= $directory_array; $boxes_directory = DIR_FS_CATALOG_MODULES . 'sideboxes/' . $template_dir . '/'; $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.')); if ($dir = @dir($boxes_directory)) { while ($file = $dir->read()) { if (!is_dir($boxes_directory . $file)) { if (in_array($file, $dir_check, TRUE)) { // skip name exists } else { if ($file != 'empty.txt') { $directory_array[] = $file; } } } } sort($directory_array); $dir->close(); } $warning_new_box=''; $installed_boxes = array(); for ($i = 0, $n = sizeof($directory_array); $i < $n; $i++) { $file = $directory_array[$i]; // Verify Definitions $definitions = $db->Execute("select layout_box_name from " . TABLE_LAYOUT_BOXES . " where layout_box_name='" . $file . "' and layout_template='" . $template_dir . "'"); if ($definitions->EOF) { if (!strstr($file, 'ezpages_bar')) { $warning_new_box .= $file . ' '; } else { // skip ezpage sideboxes // $warning_new_box .= $file . ' - HIDDEN '; } $db->Execute("insert into " . TABLE_LAYOUT_BOXES . " (layout_template, layout_box_name, layout_box_status, layout_box_location, layout_box_sort_order, layout_box_sort_order_single, layout_box_status_single) values ('" . $template_dir . "', '" . $file . "', 0, 0, 0, 0, 0)"); } } //////////////////////////////////// if ($_GET['action']) { switch ($_GET['action']) { case 'insert': $layout_box_name = zen_db_prepare_input($_POST['layout_box_name']); $layout_box_status = zen_db_prepare_input($_POST['layout_box_status']); $layout_box_location = zen_db_prepare_input($_POST['layout_box_location']); $layout_box_sort_order = zen_db_prepare_input($_POST['layout_box_sort_order']); $layout_box_sort_order_single = zen_db_prepare_input($_POST['layout_box_sort_order_single']); $layout_box_status_single = zen_db_prepare_input($_POST['layout_box_status_single']); $db->Execute("insert into " . TABLE_LAYOUT_BOXES . " (layout_box_name, layout_box_status, layout_box_location, layout_box_sort_order, layout_box_sort_order_single, layout_box_status_single) values ('" . zen_db_input($layout_box_name) . "', '" . zen_db_input($layout_box_status) . "', '" . zen_db_input($layout_box_location) . "', '" . zen_db_input($layout_box_sort_order) . "', '" . zen_db_input($layout_box_sort_order_single) . "', '" . zen_db_input($layout_box_status_single) . "')"); $messageStack->add_session(SUCCESS_BOX_ADDED . $_GET['layout_box_name'], 'success'); zen_redirect(zen_href_link(FILENAME_LAYOUT_CONTROLLER)); break; case 'save': $box_id = zen_db_prepare_input($_GET['cID']); // $layout_box_name = zen_db_prepare_input($_POST['layout_box_name']); $layout_box_status = zen_db_prepare_input($_POST['layout_box_status']); $layout_box_location = zen_db_prepare_input($_POST['layout_box_location']); $layout_box_sort_order = zen_db_prepare_input($_POST['layout_box_sort_order']); $layout_box_sort_order_single = zen_db_prepare_input($_POST['layout_box_sort_order_single']); $layout_box_status_single = zen_db_prepare_input($_POST['layout_box_status_single']); $db->Execute("update " . TABLE_LAYOUT_BOXES . " set layout_box_status = '" . zen_db_input($layout_box_status) . "', layout_box_location = '" . zen_db_input($layout_box_location) . "', layout_box_sort_order = '" . zen_db_input($layout_box_sort_order) . "', layout_box_sort_order_single = '" . zen_db_input($layout_box_sort_order_single) . "', layout_box_status_single = '" . zen_db_input($layout_box_status_single) . "' where layout_id = '" . zen_db_input($box_id) . "'"); $messageStack->add_session(SUCCESS_BOX_UPDATED . $_GET['layout_box_name'], 'success'); zen_redirect(zen_href_link(FILENAME_LAYOUT_CONTROLLER, 'page=' . $_GET['page'] . '&cID=' . $box_id)); break; case 'deleteconfirm': $box_id = zen_db_prepare_input($_GET['cID']); $db->Execute("delete from " . TABLE_LAYOUT_BOXES . " where layout_id = '" . zen_db_input($box_id) . "'"); $messageStack->add_session(SUCCESS_BOX_DELETED . $_GET['layout_box_name'], 'success'); zen_redirect(zen_href_link(FILENAME_LAYOUT_CONTROLLER, 'page=' . $_GET['page'])); break; case 'reset_defaults': $reset_boxes = $db->Execute("select * from " . TABLE_LAYOUT_BOXES . " where layout_template= 'default_template_settings'"); while (!$reset_boxes->EOF) { $db->Execute("update " . TABLE_LAYOUT_BOXES . " set layout_box_status= '" . $reset_boxes->fields['layout_box_status'] . "', layout_box_location= '" . $reset_boxes->fields['layout_box_location'] . "', layout_box_sort_order='" . $reset_boxes->fields['layout_box_sort_order'] . "', layout_box_sort_order_single='" . $reset_boxes->fields['layout_box_sort_order_single'] . "', layout_box_status_single='" . $reset_boxes->fields['layout_box_status_single'] . "' where layout_box_name='" . $reset_boxes->fields['layout_box_name'] . "' and layout_template='" . $template_dir . "'"); $reset_boxes->MoveNext(); } $messageStack->add_session(SUCCESS_BOX_RESET . $template_dir, 'success'); zen_redirect(zen_href_link(FILENAME_LAYOUT_CONTROLLER, 'page=' . $_GET['page'])); break; } } ?> > <?php echo TITLE; ?>
layout_box_status) { case '0': $layout_box_status_status_on = false; $layout_box_status_status_off = true; break; case '1': default: $layout_box_status_status_on = true; $layout_box_status_status_off = false; } switch ($bInfo->layout_box_status_single) { case '0': $layout_box_status_single_on = false; $layout_box_status_single_off = true; break; case '1': default: $layout_box_status_single_on = true; $layout_box_status_single_off = false; } switch ($_GET['action']) { case 'new': $heading[] = array('text' => '' . TEXT_INFO_HEADING_NEW_BOX . ''); $contents = array('form' => zen_draw_form('column_controller', FILENAME_LAYOUT_CONTROLLER, 'page=' . $_GET['page'] . '&action=insert')); $contents[] = array('text' => TEXT_INFO_INSERT_INTRO); $contents[] = array('text' => '
' . TEXT_INFO_LAYOUT_BOX_NAME . '
' . zen_draw_input_field('layout_box_name')); $contents[] = array('text' => '
' . TEXT_INFO_LAYOUT_BOX_STATUS . '
' . zen_draw_input_field('layout_box_status')); $contents[] = array('text' => '
' . TEXT_INFO_LAYOUT_BOX_LOCATION . '
' . zen_draw_input_field('layout_box_location')); $contents[] = array('text' => '
' . TEXT_INFO_LAYOUT_BOX_SORT_ORDER . '
' . zen_draw_input_field('layout_box_sort_order')); $contents[] = array('text' => '
' . TEXT_INFO_LAYOUT_BOX_SORT_ORDER_SINGLE . '
' . zen_draw_input_field('layout_box_sort_order_single')); $contents[] = array('text' => '
' . TEXT_INFO_LAYOUT_BOX_STATUS_SINGLE . '
' . zen_draw_input_field('layout_box_status_single')); $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_insert.gif', IMAGE_INSERT) . ' ' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; case 'edit': switch ($bInfo->layout_box_status) { case '0': $in_status = false; $out_status = true; break; case '1': $in_status = true; $out_status = false; break; default: $in_status = true; $out_status = false; } switch ($bInfo->layout_box_location) { case '0': $left_status = true; $right_status = false; break; case '1': $left_status = false; $right_status = true; break; default: $left_status = false; $right_status = true; } switch ($bInfo->layout_box_status_single) { case '0': $in_status_single = false; $out_status_single = true; break; case '1': $in_status_single = true; $out_status_single = false; break; default: $in_status_single = true; $out_status_single = false; } $heading[] = array('text' => '' . TEXT_INFO_HEADING_EDIT_BOX . ''); $contents = array('form' => zen_draw_form('column_controller', FILENAME_LAYOUT_CONTROLLER, 'page=' . $_GET['page'] . '&cID=' . $bInfo->layout_id . '&action=save' . '&layout_box_name=' . $bInfo->layout_box_name)); $contents[] = array('text' => TEXT_INFO_EDIT_INTRO); $contents[] = array('text' => TEXT_INFO_LAYOUT_BOX_NAME . ' ' . $bInfo->layout_box_name); $contents[] = array('text' => '
' . TEXT_INFO_LAYOUT_BOX_STATUS . '
' . zen_draw_radio_field('layout_box_status', '1', $in_status) . TEXT_ON . zen_draw_radio_field('layout_box_status', '0', $out_status) . TEXT_OFF); $contents[] = array('text' => '
' . TEXT_INFO_LAYOUT_BOX_LOCATION . '
' . zen_draw_radio_field('layout_box_location', '0', $left_status) . TEXT_LEFT . zen_draw_radio_field('layout_box_location', '1', $right_status) . TEXT_RIGHT); $contents[] = array('text' => '
' . TEXT_INFO_LAYOUT_BOX_SORT_ORDER . '
' . zen_draw_input_field('layout_box_sort_order', $bInfo->layout_box_sort_order,'size="4"')); $contents[] = array('text' => '
' . TEXT_INFO_LAYOUT_BOX_SORT_ORDER_SINGLE . '
' . zen_draw_input_field('layout_box_sort_order_single', $bInfo->layout_box_sort_order_single,'size="4"')); $contents[] = array('text' => '
' . TEXT_INFO_LAYOUT_BOX_STATUS_SINGLE . '
' . zen_draw_radio_field('layout_box_status_single', '1', $in_status_single) . TEXT_ON . zen_draw_radio_field('layout_box_status_single', '0', $out_status_single) . TEXT_OFF); $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . ' ' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; case 'delete': $heading[] = array('text' => '' . TEXT_INFO_HEADING_DELETE_BOX . ''); $contents = array('form' => zen_draw_form('column_controller', FILENAME_LAYOUT_CONTROLLER, 'page=' . $_GET['page'] . '&cID=' . $bInfo->layout_id . '&action=deleteconfirm' . '&layout_box_name=' . $bInfo->layout_box_name)); $contents[] = array('text' => TEXT_INFO_DELETE_INTRO); $contents[] = array('text' => '
' . $bInfo->layout_box_name . ''); $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_delete.gif', IMAGE_UPDATE) . ' ' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; default: if (is_object($bInfo)) { $heading[] = array('text' => '' . TEXT_INFO_LAYOUT_BOX . $bInfo->layout_box_name . ''); $contents[] = array('align' => 'left', 'text' => '' . zen_image_button('button_edit.gif', IMAGE_EDIT) . ''); $contents[] = array('text' => '' . TEXT_INFO_BOX_DETAILS . ''); $contents[] = array('text' => TEXT_INFO_LAYOUT_BOX_NAME . ' ' . $bInfo->layout_box_name); $contents[] = array('text' => TEXT_INFO_LAYOUT_BOX_STATUS . ' ' . ($bInfo->layout_box_status=='1' ? TEXT_ON : TEXT_OFF) ); $contents[] = array('text' => TEXT_INFO_LAYOUT_BOX_LOCATION . ' ' . ($bInfo->layout_box_location=='0' ? TEXT_LEFT : TEXT_RIGHT) ); $contents[] = array('text' => TEXT_INFO_LAYOUT_BOX_SORT_ORDER . ' ' . $bInfo->layout_box_sort_order); $contents[] = array('text' => TEXT_INFO_LAYOUT_BOX_SORT_ORDER_SINGLE . ' ' . $bInfo->layout_box_sort_order_single); $contents[] = array('text' => TEXT_INFO_LAYOUT_BOX_STATUS_SINGLE . ' ' . ($bInfo->layout_box_status_single=='1' ? TEXT_ON : TEXT_OFF) ); if (!(file_exists($boxes_directory . $bInfo->layout_box_name) or file_exists($boxes_directory_template . $bInfo->layout_box_name))) { $contents[] = array('align' => 'left', 'text' => '
' . TEXT_INFO_DELETE_MISSING_LAYOUT_BOX . '
' . $template_dir . '
'); $contents[] = array('align' => 'left', 'text' => TEXT_INFO_DELETE_MISSING_LAYOUT_BOX_NOTE . '' . $bInfo->layout_box_name . ''); $contents[] = array('align' => 'left', 'text' => '' . zen_image_button('button_delete.gif', IMAGE_DELETE) . ''); } } break; } if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { echo "\n" . '
' . "\n"; } ?>
Boxes Path:  '; ?>
Execute("select layout_id, layout_box_name, layout_box_status, layout_box_location, layout_box_sort_order, layout_box_sort_order_single, layout_box_status_single from " . TABLE_LAYOUT_BOXES . " where (layout_template='" . $template_dir . "' and layout_box_name NOT LIKE '%ezpages_bar%') order by layout_box_location, layout_box_sort_order"); while (!$column_controller->EOF) { // if (((!$_GET['cID']) || (@$_GET['cID'] == $column_controller->fields['layout_id'])) && (!$bInfo) && (substr($_GET['action'], 0, 3) != 'new')) { if ((!isset($_GET['cID']) || (isset($_GET['cID']) && ($_GET['cID'] == $column_controller->fields['layout_id']))) && !isset($bInfo) && (substr($action, 0, 3) != 'new')) { $bInfo = new objectInfo($column_controller->fields); } // if ( (is_object($bInfo)) && ($column_controller->fields['layout_id'] == $bInfo->layout_id) ) { if (isset($bInfo) && is_object($bInfo) && ($column_controller->fields['layout_id'] == $bInfo->layout_id)) { echo ' ' . "\n"; } else { echo ' ' . "\n"; } ?> fields['layout_box_location']; $column_controller->MoveNext(); if (($column_controller->fields['layout_box_location'] != $last_box_column) and !$column_controller->EOF) { ?>
 
fields['layout_box_name']) ? '' . ereg_replace(DIR_FS_CATALOG_MODULES, '', $boxes_directory_template) . '' . $column_controller->fields['layout_box_name'] : ereg_replace(DIR_FS_CATALOG_MODULES, '', $boxes_directory) . $column_controller->fields['layout_box_name']); ?> fields['layout_box_status']=='1' ? TEXT_ON : '' . TEXT_OFF .''); ?> fields['layout_box_location']=='0' ? TEXT_LEFT : TEXT_RIGHT); ?> fields['layout_box_sort_order']; ?> fields['layout_box_sort_order_single']; ?> fields['layout_box_status_single']=='1' ? TEXT_ON : '' . TEXT_OFF . ''); ?> fields['layout_box_name']) or file_exists($boxes_directory_template . $column_controller->fields['layout_box_name'])) ? TEXT_GOOD_BOX : TEXT_BAD_BOX) ; ?>fields['layout_id'] . '&action=edit') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', IMAGE_EDIT) . ''; ?> fields['layout_box_name']) or file_exists($boxes_directory_template . $column_controller->fields['layout_box_name'])) ? TEXT_GOOD_BOX : TEXT_BAD_BOX) ; ?>fields['layout_id'] == $bInfo->layout_id) ) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . ''; } ?> 
' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo '
' . TEXT_INFO_RESET_TEMPLATE_SORT_ORDER . '' . $template_dir . ''; ?>
' . zen_image_button('button_reset.gif', IMAGE_RESET) . ''; ?>