Building a Mailing List Manager CHAPTER 28 665 LISTING Continued = = = = = ‘change-password’; ‘account-settings’; ‘show-my-lists’; ‘show-other-lists’; ‘log-out’; $buttons[0] $buttons[1] $buttons[2] $buttons[3] $buttons[4] } else if(check_admin_user()) { // if an administrator $buttons[0] = ‘change-password’; $buttons[1] = ‘create-list’; $buttons[2] = ‘create-mail’; $buttons[3] = ‘view-mail’; $buttons[4] = ‘log-out’; $buttons[5] = ‘show-all-lists’; $buttons[6] = ‘show-my-lists’; $buttons[7] = ‘show-other-lists’; } else { // if not logged in at all $buttons[0] = ‘new-account’; $buttons[1] = ‘show-all-lists’; $buttons[4] = ‘log-in’; } if($action) { // display header with application name and description of page or action do_html_header(“Pyramid-MLM - “. format_action($action)); } else { // display header with just application name. | Building a Mailing List Manager 665 Chapter 28 Listing Continued buttons 0 change-password buttons 1 account-settings buttons 2 show-my-lists buttons 3 show-other-lists buttons 4 log-out else if check_admin_user if an administrator buttons 0 change-password buttons 1 create-list buttons 2 create-mail buttons 3 view-mail buttons 4 log-out buttons 5 show-all-lists buttons 6 show-my-lists buttons 7 show-other-lists else if not logged in at all buttons 0 new-account buttons 1 show-all-lists buttons 4 log-in if action display header with application name and description of page or action do_html_header Pyramid-MLM - . format_action action else display header with just application name do_html_header Pyramid-MLM display_toolbar buttons display any text generated by functions called before header echo status Section 3 perform action 28 Building a Mailing List Manager Building Practical PHP and MySQL Projects 666 Part V Listing Continued only these actions can be done if not logged in switch action case new-account unset normal_user unset admin_user display_account_form normal_user admin_user break case store-account if store_account normal_user admin_user HTTP_POST_VARS action if check_logged_in display_login_form action break case log-in case if check_logged_in display_login_form action break case show-all-lists display_items All Lists get_all_lists information show-archive break case show-archive display_items Archive For .get_list_name id get_archive id view-html view-text break case information display_information id break Building a Mailing List Manager 667 Chapter 28 Listing Continued all other actions require user to be logged in if check_logged_in switch action case account-settings display_account_form normal_user admin_user get_email get_real_name get_email get_mimetype get_email break case show-other-lists display_items Unsubscribed Lists get_unsubscribed_lists get_email information show-archive subscribe break case subscribe subscribe get_email