+++ /dev/null
-<?php\r
-/*==============================================================\r
- Photo Album\r
- ==============================================================\r
- Copyright (c) 2006 by Dylan Cheon & Kelvin Wong\r
- Institute for Assistive Technology / University of Victoria\r
- http://www.canassist.ca/ \r
- \r
- This program is free software. You can redistribute it and/or\r
- modify it under the terms of the GNU General Public License \r
- as published by the Free Software Foundation. \r
- ==============================================================\r
- */\r
-// $Id:\r
-\r
-/**\r
- * @desc This file installs the photo album module\r
- * @author Dylan Cheon & Kelvin Wong\r
- * @copyright 2006, Institute for Assistive Technology / University of Victoria \r
- * @link http://www.canassist.ca/ \r
- * @license GNU\r
- */\r
- \r
-/**\r
- * @desc the line below safe-guards this file from being accessed directly from a web browser. It will only execute if required from within an ATutor script, in our case the Module::install() method.\r
- */\r
-if (!defined('AT_INCLUDE_PATH')) { exit; }\r
-if (!defined('AT_MODULE_PATH')) { exit; }\r
-//define('AT_MODULE_PATH', realpath(AT_INCLUDE_PATH.'../mods') . DIRECTORY_SEPARATOR);\r
-\r
-/**\r
- * Note: the many options for these variables are used to decrease confusion.\r
- * TRUE | FALSE | 1 will be the convention.\r
- *\r
- * $_course_privilege\r
- * specifies the type of instructor privilege this module uses.\r
- * set to empty | FALSE | 0 to disable any privileges.\r
- * set to 1 | AT_PRIV_ADMIN to use the instructor only privilege.\r
- * set to TRUE | 'new' to create a privilege specifically for this module:\r
- * will make this module available as a student privilege.\r
- *\r
- * $_admin_privilege\r
- * specifies the type of ATutor administrator privilege this module uses.\r
- * set to FALSE | AT_ADMIN_PRIV_ADMIN to use the super administrator only privilege.\r
- * set to TRUE | 'new' to create a privilege specifically for this module:\r
- * will make this module available as an administrator privilege.\r
- */\r
-$_course_privilege = TRUE; // possible values: FALSE | AT_PRIV_ADMIN | TRUE\r
-$_admin_privilege = TRUE; // possible values: FALSE | TRUE\r
-\r
-\r
-/**\r
- * the following code is used for creating a module-specific directory.\r
- * it generates appropriate error messages to aid in its creation.\r
- */\r
-$pa_array[0]=AT_CONTENT_DIR.'photo_album';\r
-\r
-// check if the directory is writeable\r
-foreach ($pa_array as $directory){\r
- if (!is_dir($directory) && !@mkdir($directory)) {\r
- $msg->addError(array('MODULE_INSTALL', '<li>'.$directory.' does not exist. Please create it.</li>'));\r
- } else if (!is_writable($directory) && @chmod($directory, 0777)) {\r
- $msg->addError(array('MODULE_INSTALL', '<li>'.$directory.' is not writeable. On Unix issue the command <kbd>chmod a+rw</kbd>.</li>'));\r
- }\r
-}\r
-\r
-/**\r
- * check if GD is installed and is version 2 or higher\r
- */\r
-if (! extension_loaded('gd')) {\r
- $msg->addError(array('MODULE_INSTALL', '<li>This module requires the GD Library. Please <a href="http://www.boutell.com/gd/" title="Link to GD web site">install it</a>.</li>'));\r
-} else {\r
- if (function_exists('gd_info')) {\r
- // use gd_info if possible...\r
- $gd_ver_info = gd_info();\r
- preg_match('/\d/', $gd_ver_info['GD Version'], $match);\r
- if ($match[0] < 2) {\r
- $msg->addError(array('MODULE_INSTALL', '<li>This module requires GD version 2 or higher. Please <a href="http://www.boutell.com/gd/" title="Link to GD web site">install it</a>.</li>'));\r
- }\r
- } else {\r
- // ...otherwise use phpinfo().\r
- ob_start();\r
- phpinfo(8);\r
- $info = ob_get_contents();\r
- ob_end_clean();\r
- $info = stristr($info, 'gd version');\r
- preg_match('/\d/', $info, $match);\r
- if ($match[0] < 2) {\r
- $msg->addError(array('MODULE_INSTALL', '<li>This module requires the GD Library version 2 or higher. Please <a href="http://www.boutell.com/gd/" title="Link to GD web site">install it</a>.</li>'));\r
- }\r
- }\r
-}\r
-\r
-/**\r
- * the following code checks if there are any errors (generated previously)\r
- * then uses the SqlUtility to run any database queries it needs, ie. to create\r
- * its own tables.\r
- */\r
-if (!$msg->containsErrors() && file_exists(dirname(__FILE__) . '/module.sql')) {\r
- // deal with the SQL file:\r
- require(AT_INCLUDE_PATH . 'classes/sqlutility.class.php');\r
- $sqlUtility =& new SqlUtility();\r
-\r
- /**\r
- * the SQL file could be stored anywhere, and named anything, "module.sql" is simply\r
- * a convention we're using.\r
- */\r
- $sqlUtility->queryFromFile(dirname(__FILE__) . '/module.sql', TABLE_PREFIX);\r
-}\r
-\r
-?>\r