Esempio n. 1
0
    case "delete":
        $id = $_GET["id"];
        delete_contact($id);
        header("Location: /contacts.php?action=list");
        break;
    case "edit":
        $id = $_GET["id"];
        if ($method === "GET") {
            contacts::displayEditContactForm($id);
        } elseif ($method === "POST") {
            contacts::handleEditContact($id);
        }
        break;
    case "view":
        $id = $_GET["id"];
        contacts::viewContact($id);
        break;
}
class contacts
{
    /*
    	lists contacts of current user with action buttons
    */
    public static function listContacts()
    {
        global $smarty, $user;
        $contacts = get_contact_list($user["id"]);
        $smarty->assign("contacts", $contacts);
        $smarty->display("contacts.list.tpl.html");
    }
    public static function displayAddContactForm($vars = array())