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

Secure PHP Development- P111 docx

5 156 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 90,08 KB

Nội dung

Creating a Campaign class The purpose of this class is to provide the Campaign object, which is needed to manipulate the campaign. An implementation of this class can be found in ch15/ apps/class/class.EcampaignCampaign.php file in the CDROM. This class imple- ments the methods discussed in the following sections. EcampaignCampaign() This method sets the member variable, ecampaign_tbl, to the $ECAMPAIGN_TBL configuration variable. The member variable, dbi, is set to $dbi, which is passed from the application. This method also sets the current campaign ID using the setCampaignID() method. setCampaignID() This method sets the current campaign ID to the campaign ID supplied. If no cam- paign ID is supplied as a parameter, the current campaign ID is returned. getCampaignInfo() This method returns campaign information about a given campaign or the current campaign. getAvailableCampaigns() This method returns the list of campaigns from the e-campaign database. The returned associative array is keyed with the campaign ID (CAMPAIGN_ID), and the values are set to campaign name (NAME). addCampaign() This method adds a campaign in the e-campaign database. deleteCampaign() This method deletes a campaign from the e-campaign database. modifyCampaign() This method updates a campaign in the e-campaign database. Creating a URL Tracking class The purpose of this class is to provide the URL Track object, which is needed to manipulate the URL track information. An implementation of this class can be found in ch15/apps/class/class.EcampaignTrack.php file in the CDROM. This class implements the methods discussed in the following sections. Chapter 15: E-campaign System 521 19 549669 ch15.qxd 4/4/03 9:26 AM Page 521 EcampaignTrack() This is the constructor method that sets a member variable, track_tbl, to e-campaign configuration variable $ECAMPAIGN_TRACK_TBL, which holds the URL track table name. This method also sets another member variable, dbi, to the DBI ($dbi) object, which is passed from the application. storeTrack() This method stores a URL track record in the URL track table. Creating an Unsubscription Tracking class The purpose of this class is to provide the Unsubscription Track object, which is needed to manipulate the unsubscription track information. An implementation of this class can be found in ch15/apps/class/class.EcampaignUnsub.php. This class implements the methods discussed in the following sections. EcampaignUnsub() This is the constructor method that sets a member variable, unsub_tbl, to $ECAMPAIGN_UNSUB_TBL, which is an ecampaign.conf configuration variable set to hold the unsubscription table name. This method also sets another member vari- able, dbi, to the DBI ($dbi) object, which is passed from the application. storeUnsub() This method stores an unsubscription record in the unsubscription track table. Creating a Report class The purpose of this class is to provide the Report object, which is needed to manip- ulate the report information. An implementation of this class can be found in ch15/apps/class/class.EcampaignReport.php file in the CDROM. This class implements the methods discussed in the following sections. EcampaignReport() This constructor method sets member variables ecampaign_tbl, track_tbl, unsub_tbl, and bounced_tbl to e-campaign configuration variables $ECAMPAIGN_ TBL , $ECAMPAIGN_TRACK_TBL, $ECAMPAIGN_UNSUB_TBL, and $ECAMPAIGN_BOUNCED_ TBL , respectively. The member variable, dbi, is set to the DBI object ($dbi), which is passed as a parameter from an application. Another member variable, campaign_id, is set to the campaign ID passed as a parameter from an application creating the report object. 522 Part III: Developing E-mail Solutions 19 549669 ch15.qxd 4/4/03 9:26 AM Page 522 setEcampaignCampaignID() This method sets the current campaign ID to the campaign ID parameter if it is not null and returns the current campaign ID. getURLResponse() This method returns URL click-through count for each tracked URL in a campaign. getUnsubResponse() This method returns the total unsubscription track for a campaign. getBounceResponse() This method returns the total number of immediate bounces for a given campaign. Creating Common Configuration and Resource Files Like all other applications you’ve developed in this book, the e-campaign applica- tions also use a standard set of configuration, message, and error files. These files are discussed in the following sections. Creating an e-campaign configuration file The primary configuration file for the entire e-campaign system is called ecampaign.conf, which can be found in ch15/apps directory in the CDROM. Table 15-2 discusses each configuration variable. TABLE 15-2 ecampaign.conf VARIABLES Configuration Variable Purpose $PEAR_DIR Set to the directory containing the PEAR package; specifically the DB module needed for class.DBI.php in the 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 the application framework directory. Continued Chapter 15: E-campaign System 523 19 549669 ch15.qxd 4/4/03 9:26 AM Page 523 TABLE 15-2 ecampaign.conf VARIABLES (Continued) Configuration Variable Purpose $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 the 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 topmost 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. $XMAILER_ID This is the X-Mailer mail header sent with each mail to identify what program was used to send mail. $DEFAULT_LANGUAGE Set to the default (two- digit) language code. $ROOT_PATH Set to the default (two-digit) language code. $REL_ROOT_PATH Relative path to the root directory. $REL_APP_PATH Relative application path as seen from the Web browser. $ECAMPAIGN_MENU_URL Relative URL path to the campaign manager interface application. $TEMPLATE_DIR Set to the template directory containing the ihtml template files needed for the user-management applications. $CLASS_DIR Set to the class directory where user-management- related class files are stored. $ECAMPAIGN_LIST_CLASS Name of the List class. $ECAMPAIGN_URL_CLASS Name of the URL class. 524 Part III: Developing E-mail Solutions 19 549669 ch15.qxd 4/4/03 9:26 AM Page 524 Configuration Variable Purpose $ECAMPAIGN_TRACK_CLASS Name of the URL Track class. $ECAMPAIGN_UNSUB_CLASS Name of the Unsubscription class. $ECAMPAIGN_CAMPAIGN_CLASS Name of the Campaign class. $ECAMPAIGN_MESSAGE_CLASS Name of the Message class. $ECAMPAIGN_REPORT_CLASS Name of the Report class. $ECAMPAIGN_MNGR Name of the campaign manager interface application. This application displays the primary user interface. $ECAMPAIGN_URL_MNGR Name of the URL manager application. $ECAMPAIGN_CAMPAIGN_MNGR Name of the campaign manager application. $ECAMPAIGN_LIST_MNGR Name of the list manager application. $ECAMPAIGN_MESSAGE_MNGR Name of the message manager application. $ECAMPAIGN_EXEC_MNGR Name of the campaign execution application. $ECAMPAIGN_REPORT_MNGR Name of the report manager application. $ECAMPAIGN_REDIR_MNGR Name of the URL redirection application. $ECAMPAIGN_UNSUB_MNGR Name of the unsubscription application. $REL_TEMPLATE_DIR Set to relative template directory. $ECAMPAIGN_DB_URL Set to campaign database URL. $MAX_DELIVERY_AT_A_TIME Set to maximum e-mail delivery count per run. Because the execution application cannot run the entire campaign in one shot due to browser timeout issues, it executes this number of e-mails at a time. The execution application calls itself after each run using the meta refresh method. $MAX_WAIT_PER_DELIVERY The number of seconds the campaign execution application waits before it restarts via the meta refresh tag. $SECRET A random number used in the checksum algorithm. $ECAMPAIGN_LIST_TBL Name of the list table. $ECAMPAIGN_URL_TBL Name of the URL table. Continued Chapter 15: E-campaign System 525 19 549669 ch15.qxd 4/4/03 9:26 AM Page 525 . package; specifically the DB module needed for class.DBI .php in the 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. information. An implementation of this class can be found in ch15/apps/class/class.EcampaignUnsub .php. This class implements the methods discussed in the following sections. EcampaignUnsub() This

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

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN