add_session(ERROR_ADMIN_DEMO, 'caution'); zen_redirect(zen_href_link(FILENAME_ADMIN)); break; //------------------------------------------------------------------------------------------------------------------------- case 'insert': case 'save': case 'reset': $error = false; if ( ($action == 'insert') || ($action == 'reset') ){ $password_new = zen_db_prepare_input($_POST['password_new']); $password_confirmation = zen_db_prepare_input($_POST['password_confirmation']); if (strlen($password_new) < ENTRY_PASSWORD_MIN_LENGTH) { $error = true; $messageStack->add(ENTRY_PASSWORD_NEW_ERROR, 'error'); } if ($password_new != $password_confirmation) { $error = true; $messageStack->add(ENTRY_PASSWORD_NEW_ERROR_NOT_MATCHING, 'error'); } } if ($error == false) { if (isset($_GET['adminID'])) $admins_id = zen_db_prepare_input($_GET['adminID']); $admin_name = zen_db_prepare_input($_POST['admin_name']); $admin_email = zen_db_prepare_input($_POST['admin_email']); $password_new = zen_db_prepare_input($password_new); $admin_level = zen_db_prepare_input($_POST['admin_level']); $password_new = zen_db_prepare_input($password_new); $sql_data_array = array( 'admin_name' => $admin_name, 'admin_email' => $admin_email, 'admin_level' => (int)$admin_level ); if ($action == 'insert') { $insert_sql_data = array('admin_pass' => zen_encrypt_password($password_new)); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); zen_db_perform(TABLE_ADMIN, $sql_data_array); $new_admin_id = zen_db_insert_id(); $admins_id = $new_admin_id; } elseif ($action == 'save') { zen_db_perform(TABLE_ADMIN, $sql_data_array, 'update', "admin_id = '" . (int)$admins_id . "'"); $db->Execute("UPDATE " . TABLE_CONFIGURATION . " set configuration_value='" . (int)$_POST['demo_status'] . "' where configuration_key='ADMIN_DEMO'"); } elseif ($action == 'reset') { $update_sql_data = array('admin_pass' => zen_encrypt_password($password_new)); $sql_data_array = array_merge($sql_data_array, $update_sql_data); zen_db_perform(TABLE_ADMIN, $sql_data_array, 'update', "admin_id = '" . (int)$admins_id . "'"); } // end action check zen_redirect(zen_href_link(FILENAME_ADMIN, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'adminID=' . $admins_id)); } // end error check //echo $action; // zen_redirect(zen_href_link(FILENAME_ADMIN, (isset($_GET['page']) ? 'page=' . '&' : '') . 'adminID=' . $admins_id)); break; //------------------------------------------------------------------------------------------------------------------------- case 'deleteconfirm': $new_admin_id = zen_db_prepare_input($_GET['adminID']); $db->Execute("delete from " . TABLE_ADMIN . " where admin_id = '" . (int)$new_admin_id . "'"); zen_redirect(zen_href_link(FILENAME_ADMIN, 'page=' . $_GET['page'])); break; //------------------------------------------------------------------------------------------------------------------------- } // end switch } // end zen_not_null ?> > <?php echo TITLE; ?>
'' . TEXT_HEADING_NEW_ADMIN . ''); $contents = array('form' => zen_draw_form('new_admin', FILENAME_ADMIN, 'action=insert', 'post', 'enctype="multipart/form-data"')); $contents[] = array('text' => TEXT_NEW_INTRO); $contents[] = array('text' => '
' . TEXT_ADMINS_NAME . '
' . zen_draw_input_field('admin_name', '', zen_set_field_length(TABLE_ADMIN, 'admin_name', $max=30)) ); $contents[] = array('text' => '
' . TEXT_ADMINS_EMAIL . '
' . zen_draw_input_field('admin_email', '', zen_set_field_length(TABLE_ADMIN, 'admin_email', $max=30)) ); $contents[] = array('text' => '
' . TEXT_ADMINS_PASSWORD . '
' . zen_draw_password_field('password_new', '', zen_set_field_length(TABLE_ADMIN, 'admin_pass', $max=20)) ); $contents[] = array('text' => '
' . TEXT_ADMINS_CONFIRM_PASSWORD . '
' . zen_draw_password_field('password_confirmation', '', zen_set_field_length(TABLE_ADMIN, 'admin_pass', $max=20)) ); $contents[] = array('text' => zen_draw_hidden_field('admin_level', '1') ); $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_save.gif', IMAGE_SAVE) . '' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; //------------------------------------------------------------------------------------------------------------------------- case 'edit': $heading[] = array('text' => '' . TEXT_HEADING_EDIT_ADMIN . ''); $contents = array('form' => zen_draw_form('edit_admin', FILENAME_ADMIN, 'page=' . $_GET['page'] . '&adminID=' . $adminInfo->admin_id . '&action=save', 'post', 'enctype="multipart/form-data"')); $contents[] = array('text' => TEXT_EDIT_INTRO); $contents[] = array('text' => '
' . $adminInfo->admin_id . ' - ' . $adminInfo->admin_name . ''); $contents[] = array('text' => '
' . TEXT_ADMINS_NAME . '
' . zen_draw_input_field('admin_name', $adminInfo->admin_name, zen_set_field_length(TABLE_ADMIN, 'admin_name', $max=30)) ); $contents[] = array('text' => '
' . TEXT_ADMINS_EMAIL . '
' . zen_draw_input_field('admin_email', $adminInfo->admin_email, zen_set_field_length(TABLE_ADMIN, 'admin_email', $max=30)) ); $admin_current = $db->Execute("select admin_level from " . TABLE_ADMIN . " where admin_id='" . $_SESSION['admin_id'] . "'"); /* if ($admin_current->fields['admin_level'] == '1') { $contents[] = array('text' => '
' . TEXT_ADMIN_LEVEL_INSTRUCTIONS); $contents[] = array( 'text' => '' . TEXT_ADMINS_LEVEL . '
' . zen_draw_input_field('admin_level', $adminInfo->admin_level, zen_set_field_length(TABLE_ADMIN, 'admin_level')) ); */ $demo_status= zen_get_configuration_key_value('ADMIN_DEMO'); switch ($demo_status) { case '0': $on_status = false; $off_status = true; break; case '1': $on_status = true; $off_status = false; break; default: $on_status = false; $off_status = true; break; } if ($on_status == true) { $contents[] = array('text' => '
' . TEXT_ADMIN_DEMO); $contents[] = array('text' => '' . TEXT_DEMO_STATUS . '
' . zen_draw_radio_field('demo_status', '1', $on_status) . ' ' . TEXT_DEMO_ON . ' ' . zen_draw_radio_field('demo_status', '0', $off_status) . ' ' . TEXT_DEMO_OFF); } else { $contents[] = array('text' => zen_draw_hidden_field('demo_status', 0) ); } $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_save.gif', IMAGE_SAVE) . '' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; //------------------------------------------------------------------------------------------------------------------------- case 'resetpassword': $heading[] = array('text' => '' . TEXT_HEADING_RESET_PASSWORD . ''); $contents = array('form' => zen_draw_form('reset_password', FILENAME_ADMIN, 'page=' . $_GET['page'] . '&adminID=' . $adminInfo->admin_id . '&action=reset', 'post', 'enctype="multipart/form-data"') . zen_draw_hidden_field('admin_name', $adminInfo->admin_name) . zen_draw_hidden_field('admin_email', $adminInfo->admin_email) . zen_draw_hidden_field('admin_level', $adminInfo->admin_level)); $contents[] = array('text' => TEXT_EDIT_INTRO); $contents[] = array('text' => '
' . $adminInfo->admin_id . ' - ' . $adminInfo->admin_name . ''); $contents[] = array('text' => '
' . TEXT_ADMINS_PASSWORD . '
' . zen_draw_password_field('password_new', '', zen_set_field_length(TABLE_ADMIN, 'admin_pass', $max=25)) ); $contents[] = array('text' => '
' . TEXT_ADMINS_CONFIRM_PASSWORD . '
' . zen_draw_password_field('password_confirmation', '', zen_set_field_length(TABLE_ADMIN, 'admin_pass', $max=25)) ); $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_save.gif', IMAGE_SAVE) . '' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; //------------------------------------------------------------------------------------------------------------------------- case 'delete': $heading[] = array('text' => '' . TEXT_HEADING_DELETE_ADMIN . ''); $contents = array('form' => zen_draw_form('delete_admin', FILENAME_ADMIN, 'page=' . $_GET['page'] . '&adminID=' . $adminInfo->admin_id . '&action=deleteconfirm')); $contents[] = array('text' => TEXT_DELETE_INTRO); $contents[] = array('text' => '
' . $adminInfo->admin_name . ''); $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . '' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; //------------------------------------------------------------------------------------------------------------------------- default: //------------------------------------------------------------------------------------------------------------------------- if (isset($adminInfo) && is_object($adminInfo)) { $heading[] = array('text' => '' . $adminInfo->admin_name . ''); $contents[] = array('align' => 'center', 'text' => '' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '' . zen_image_button('button_reset_pwd.gif', IMAGE_RESET) . '' . zen_image_button('button_delete.gif', IMAGE_DELETE) . ''); } break; //------------------------------------------------------------------------------------------------------------------------- } // end switch action if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { echo '' . "\n"; } ?>
Execute($admins_query_raw); while (!$admins->EOF) { if ((!isset($_GET['adminID']) || (isset($_GET['adminID']) && ($_GET['adminID'] == $admins->fields['admin_id']))) && !isset($adminInfo) && (substr($action, 0, 3) != 'new')) { $adminInfo = new objectInfo($admins->fields); } if (isset($adminInfo) && is_object($adminInfo) && ($admins->fields['admin_id'] == $adminInfo->admin_id)) { echo '' . "\n"; } else { echo '' . "\n"; } ?> MoveNext(); } ?>
 
fields['admin_id']; ?> fields['admin_name']; ?> fields['admin_email']; ?> fields['admin_id'] . '&action=edit') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . ''; ?> fields['admin_id'] . '&action=delete') . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . ''; ?> fields['admin_id'] . '&action=resetpassword') . '">' . zen_image(DIR_WS_IMAGES . 'icon_reset.gif', ICON_RESET) . ''; ?>
display_count($admins_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_ADMINS); ?> display_links($admins_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?>
admin_id . '&action=new') . '">' . zen_image_button('button_insert.gif', IMAGE_INSERT) . ''; ?>
' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo '