1. Trang chủ
  2. » Công Nghệ Thông Tin

Secure PHP Development- P68 pot

5 258 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 99,03 KB

Nội dung

◆ getReminders(): This method returns all reminders for the given contact ID. It works as follows: ■ First it sets the given contact ID using the setContactID() method. ■ A SQL statement, $stmt, is created to select all the reminder informa- tion for the given contact ID. ■ The SQL statement is executed using $this->dbi->query(), and the result is stored in $result. ■ If there are more than zero rows in the $result object, each row is fetched in the $row variable. ■ All reminders found in the result set are stored in an array. ■ The method returns the array if the result set is not empty; otherwise, it returns null. ◆ getMails(): This method returns all e-mails for the given contact num- ber. This is how it works: ■ It sets the given contact ID using the setContactID() method. ■ A SQL statement, $stmt, is created to select all the e-mails sent to the given contact. ■ The SQL statement is executed using $this->dbi->query(), and the result is stored in $result. ■ If there are more than zero rows in the $result object, each row is fetched in the $row variable. ■ All e-mails found in the result set are stored in an array. ■ The method returns the array if the result set is not empty; otherwise, it returns null. Here are the other methods in this class: Method Description addKeywords() Adds new keywords for the given contact. It explodes the $keyword string passed as a parameter and stores the different keywords in an array; for each keyword in the array, it adds a new entry in the CONTACT_KEYWORD table. deleteKeywords() Deletes keywords for the given contact. It takes contact ID as the parameter. 306 Part II: Developing Intranet Solutions 12 549669 ch09.qxd 4/4/03 9:25 AM Page 306 Method Description modifyKeywords() Updates keyword information for the given contact. It uses deleteKeywords() to delete the previous keywords, and then uses addKeywords() to add the new keywords. This method takes the contact ID and the new keywords array as parameters. setContactID() Sets the contact ID. If the contact ID is passed to this method, it sets the member variable cid to the given contact ID. At the end it returns the contact ID. getColumnValue() Returns the value of the given column from the database for the current contact object. It takes the column name as a parameter. This method uses loadContactInfo() with the given contact ID to set all the attributes for the contact, and then returns the formatted value of the specified column. deleteRemindersByContactID() Deletes all reminders from the reminder table for a given contact ID. It takes the contact ID as the input and returns TRUE or FALSE, depending on the deletion status. deleteKeywordsByContactID() Deletes all keywords from the keyword table for a given contact ID. So it takes contact ID as the input and returns TRUE or FALSE, depending on the deletion status. addReminder() Adds new reminders to the reminder table for the given contact. It takes the contact ID, author ID, the remind note, the publish date, and the message ID as a parameter. Then it returns TRUE or FALSE, depending on the status of the operation. storeMail() Stores new mail in the database. Attributes such as contact ID, CC To, subject, body, and send time stamp are passed as parameters to this method. replaceCategory() Replaces the old category with the given new one. It takes the old and new category IDs as parameters and returns TRUE or FALSE, depending on the status of the operation. getMailDetails() Returns detailed information of the given mail ID. It takes the mail ID as a parameter and returns the details of it. Chapter 9: Intranet Contact Manager 307 12 549669 ch09.qxd 4/4/03 9:25 AM Page 307 The Application Configuration Files Like all other applications we’ve developed in this book, the intranet contact man- ager applications also use a standard set of configuration, message, and error files. These files are discussed in the following sections. The main configuration file The primary configuration file for the contact manager is called contact.conf. Table 9-2 discusses each configuration variable. TABLE 9-2 THE CONTACT.CONF VARIABLES Variable Purpose $PEAR_DIR Set to the directory containing the PEAR package; specifically the DB module needed for class.DBI.php in our application framework. $PHPLIB_DIR Set to the PHPLIB directory, which contains the PHPLIB packages; specifically the template.inc package needed for template manipulation. $APP_FRAMEWORK_DIR Set to our application framework directory. $PATH Set to the combined directory path consisting of the $PEAR_DIR, the $PHPLIB_DIR, and the $APP_FRAMEWORK_DIR. This path is used with the ini_set() method to redefine the php.ini entry for include_path to include $PATH ahead of the default path. This allows PHP to find our application framework, PHPLIB, and PEAR-related files. $AUTHENTICATION_URL Set to the central login application URL. $LOGOUT_URL Set to the central logout application URL. $HOME_URL Set to the top-most URL of the site. If the URL redirection application does not find a valid URL in the e-campaign database to redirect to for a valid request, it uses this URL as a default. $APPLICATION_NAME Internal name of the application. $DEFAULT_LANGUAGE Set to the default two-character language code. 308 Part II: Developing Intranet Solutions 12 549669 ch09.qxd 4/4/03 9:25 AM Page 308 Variable Purpose $ROOT_PATH Set to the root path of the application. $REL_ROOT_PATH Relative path to the root directory. $REL_APP_PATH Relative application path as seen from the web browser. $TEMPLATE_DIR The fully qualified path to the template directory. $THEME_TEMPLATE_DIR The fully qualified path to the theme template directory. $REL_PHOTO_DIR The Web-relative path to the photo directory used to store user photos. $PHOTO_DIR The fully qualified path to the photo directory. $DEFAULT_PHOTO Name of the default photo file, which is used when a user does not have a photo in the photo directory. $CLASS_DIR The fully qualified path to the class directory. $REL_TEMPLATE_DIR The Web-relative path to the template directory used. $CATEGORY_CLASS Name of the Category class file. $CONTACT_CLASS Name of the Contact class file. $MESSAGE_CLASS Name of the Message class file. This class was developed for the MOTD application discussed in Chapter 8. $CONTACT_MNGR Name of the application that shows the index page of the application with the contact search menu. $CONTACT_CAT_MNGR Name of the application that manipulates all functions related to contact category. $INTRANET_DB_URL The fully qualified URL for the database used to MOTD information. $CONTACT_DB_URL The fully qualified URL for the database used to store the contacts and categories. Continued Chapter 9: Intranet Contact Manager 309 12 549669 ch09.qxd 4/4/03 9:25 AM Page 309 TABLE 9-2 THE CONTACT.CONF VARIABLES (Continued) Variable Purpose $CONTACT_CATEGORY_TBL Name of the category table in the database. $CONTACT_INFO_TBL Name of the contact info table in the database. $CONTACT_KEYWORD_TBL Name of the contact keyword table in the database. $USER_PREFERENCE_TBL Name of the user preference table in the intranet database. $MESSAGE_TBL Name of the MOTD message table in the intranet database. $CONTACT_MAIL_TBL Name of the contact mail table in the database. $MSG_VIEWER_TBL Name of the message viewer list table in the intranet database. $AUTH_DB_TBL Name of the user authentication table in the auth database. $STATUS_TEMPLATE Name of the status template file used to display status messages. $CONTACT_HOME_TEMPLATE Name of the contact index template file. $CONTACT_CAT_HOME_TEMPLATE Name of the contact category index template file. $CONTACT_INFO_ADD_MOD_TEMPLATE Name of the add/modify contact entry form template file. $CONTACT_CAT_ADD_MOD_TEMPLATE Name of the add/modify category entry form template file. $CONTACT_DETAILS_TEMPLATE Name of the contact details template file. ODD_COLOR Color defined for odd rows when displaying tabular data. EVEN_COLOR Color defined for even rows when displaying tabular data. USER_DB_URL The fully qualified authentication database URL. 310 Part II: Developing Intranet Solutions 12 549669 ch09.qxd 4/4/03 9:25 AM Page 310 . specifically the DB module needed for class.DBI .php in our application framework. $PHPLIB_DIR Set to the PHPLIB directory, which contains the PHPLIB packages; specifically the template.inc package. $PHPLIB_DIR, and the $APP_FRAMEWORK_DIR. This path is used with the ini_set() method to redefine the php. ini entry for include_path to include $PATH ahead of the default path. This allows PHP. to include $PATH ahead of the default path. This allows PHP to find our application framework, PHPLIB, and PEAR-related files. $AUTHENTICATION_URL Set to the central login application URL. $LOGOUT_URL

Ngày đăng: 07/07/2014, 07:20