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

Secure PHP Development- P85 ppsx

5 350 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 120,92 KB

Nội dung

◆ It creates a theme template object called $themeTemplate. ◆ The user’s theme template is loaded into the $themeTemplate object. ◆ This method is called with a parameter called $output, which will be shown with the theme template. This $output is set into in the ‘CONTENT_BLOCK’ block. ◆ Then it parses all the blocks and shows the final output. authorize() This method authorizes everyone on the intranet to view the resource manager and, therefore, always returns TRUE. sortByResourceTitle() This method is used to sort resources by their titles according to alphabetical order. It takes two arrays as inputs and compares their RESOURCE_TITLE element using the strcmp() method. sortByResourceAddedBy() This method is used to sort resources by its creator name according to alphabetical order. It takes two arrays as input and compares their ‘RESOURCE_ADDED_BY’ element using the strcmp() method. sortByResourceRating() This method is used to sort resources by their rating. It takes two arrays as input and compares their ‘RESOURCE_RATING’ element. If the first array’s resource rating is greater than the second one then it returns –1; if they are equal, it returns 0; oth- erwise, it returns 1. sortByResourceVisitor() This method is used to sort resources by their visitor numbers. It takes two arrays as input and compares them. If the first array’s visitor number is greater than the second one, then it returns –1; if they are equal, then it returns 0; otherwise, it returns 1. Installing an IRM on Your Intranet Here we will assume that you’re using a Linux system with MySQL and Apache server installed. The following installation process assumes the following: Chapter 11: Internet Resource Manager 391 14 549669 ch11.qxd 4/4/03 9:25 AM Page 391 ◆ Your intranet Web server document root directory is /evoknow/intranet/ htdocs . Of course, if you have a different path, which is likely, you should change this path whenever you see it in a configuration file or instruction in this chapter. During the installation process, I will refer to this directory as %DocumentRoot%. ◆ Finally I also assume that You have installed the PHPLIB and PEAR library. Normally, these gets installed during PHP installation. For your convenience, I have provided these in the lib/phplib.tar.gz and lib/pear.tar.gz directories on the CD-ROM. In these sample installation steps, we will assume that these are installed in the /%DocumentRoot%/phplib and /%DocumentRoot%/pear directories. Because your installation locations for these libraries are likely to differ, make sure you replace these paths in the configuration files. Here is how you can get your IRM applications up and running: ◆ Install Base Intranet Applications. If you haven’t yet installed the base intranet user home application and the messaging system discussed in Chapter 7, you must do so before proceeding further. ◆ Install Intranet Calendar Database Tables. I make the assumption that you have already installed the INTRANET database (see Chapter 7 for details). You need to install the ch11/sql/irm.sql database. The quickest way to create the database is to run the following commands: mysqladmin –u root –p create IRM mysql –u root –p –D IRM < irm.sql ◆ Install IRM Applications. Now from the ch11 directory on the CD-ROM, extract ch11.tar.gz in %DocuemntRoot%. This will create irm in your document root. Configure %DocumentRoot%/irm/apps/irm.conf for path and database settings. The applications are installed in the %DocumentRoot%/ irm/apps directory and the templates are stored in %DocumentRoot%/irm/ apps/templates . Your MySQL server is hosted on the intranet Web server and, therefore, it can be accessed via localhost. However, if this is not the case, you can easily modify the database URLs in each application’s configuration files. For example, the home.conf file has a MySQL database access URLs such as the following: $INTRA_DB_URL = ‘mysql://root:foobar@localhost/INTRANET’; $IRM_DB_URL = ‘mysql://root:foobar@localhost/CALENDAR’; $APP_DB_URL = ‘mysql://root:foobar@localhost/auth’; 392 Part II: Developing Intranet Solutions 14 549669 ch11.qxd 4/4/03 9:25 AM Page 392 Say your database server is called db.domain.com and the user name and password to access the INTRANET and auth databases (which you will create during this installation process) are admin and db123. In such a case, you would modify the database access URLs throughout each configuration file as follows: $INTRA_DB_URL = ‘mysql://admin:db123@db.domain.com/INTRANET’; $IRM_DB_URL = ‘mysql://admin:db123@db.domain.com/IRM’; $APP_DB_URL = ‘mysql://admin:db123@db.domain.com/auth’; ◆ Add IRM to the Theme Navigation Bar. You need to update your theme navigation bar files stored in %DocumentRoot%/themes/%theme%/ home_left_nav.html , whenever you add a new application. For example, to update the std_blue theme, you need to update the %DocumentRoot%/ themes/std_blue/home_left_nav.html file to include the following line in the HTML table: <tr><td width=”100%”><font size=2><a href=”/irm/apps/ irm_search_mngr.php”>IRM</a></font></td> </tr> This will create a new row in the left navigation bar created with the HTML table. ◆ Set File/Directory Permissions. Make sure you have changed file and directory permissions such that your intranet Web server can access all the files. After you’ve performed the preceding steps, you’re ready to test your IRM applications. Testing IRM Log in to your intranet via http://yourserver/index.php or http://yourserver/ home/home.php . Click on the Calendar link on the left navigation bar of your intranet home page, or point your Web browser to http://yourserver/irm/apps/irm_search_mngr. php after you’re logged in to the intranet. This will show you the IRM search interface as shown in Figure 11-3. You will notice that there are no resources set up, because we haven’t yet set up categories. To set up categories, click on the Category Manager as an administrative user. You will see a screen similar to Figure 11-4. Chapter 11: Internet Resource Manager 393 14 549669 ch11.qxd 4/4/03 9:25 AM Page 393 Figure 11-3: The IRM search interface. Figure 11-4: The Category Manager. 394 Part II: Developing Intranet Solutions 14 549669 ch11.qxd 4/4/03 9:25 AM Page 394 Click on the Add Category button and you will see a screen similar to Figure 11-5. Figure 11-5: Adding a new category. Enter a new category name. If this is a subcategory of an existing category, select the parent category from the available categories. Finally, click on the Add Category button to add the new category. As mentioned in the functionality requirements, the Internet resources are only added in subcategories. There can be only one-level subcategories for each main category. So you should add at least one subcategory per main category. Figure 11-6 shows a new category called Languages with the PHP subcategory. Keep adding categories and subcategories as you need. Figure 11-7 shows a list of categories with subcategories that we’ve created for this test. Chapter 11: Internet Resource Manager 395 14 549669 ch11.qxd 4/4/03 9:25 AM Page 395 . that You have installed the PHPLIB and PEAR library. Normally, these gets installed during PHP installation. For your convenience, I have provided these in the lib/phplib.tar.gz and lib/pear.tar.gz directories. applications. Testing IRM Log in to your intranet via http://yourserver/index .php or http://yourserver/ home/home .php . Click on the Calendar link on the left navigation bar of your intranet home. table: <tr><td width=”100%”><font size=2><a href=”/irm/apps/ irm_search_mngr .php >IRM</a></font></td> </tr> This will create a new row in the left

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

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

TÀI LIỆU LIÊN QUAN