+++ /dev/null
-<?php\r
-/*******\r
- * the line below safe-guards this file from being accessed directly from\r
- * a web browser. It will only execute if required from within an ATutor script,\r
- * in our case the Module::install() method.\r
- */\r
-if (!defined('AT_INCLUDE_PATH')) { exit; }\r
-require(AT_INCLUDE_PATH.'lib/constants.inc.php');\r
-\r
-$_course_privilege = TRUE; // possible values: FALSE | AT_PRIV_ADMIN | TRUE\r
-$_admin_privilege = TRUE; // possible values: FALSE | TRUE\r
-$_cron_interval = 0; // disable\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
- \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
- * The following core files are changed: \r
- * \r
- * editor/add_news.php: \r
- *\r
- */ \r
-\r
-/******\r
- * Open editor/add_news.php, check if changes need to be made, make them if neccessary\r
- */ \r
-\r
-$installed=FALSE;\r
-$needle = "if (!\$msg->containsErrors() && (!isset(\$_POST['setvisual']) || isset(\$_POST['submit']))) {";\r
-$changes = "\n\t/***** \r
-\t* Added by announcement_subscription: Send mail to announcement subscribers \r
-\t*/\n\r
-\t \$subscriberMod =& \$moduleFactory->getModule('announcement_subscription'); \r
-\t if (\$subscriberMod->isEnabled() && !\$subscriberMod->isMissing()) { \r
-\t\t include_once(AT_MODULE_PATH . 'announcement_subscription/sendmail.php'); \r
-\t } \n\r
-\t/***** \r
-\t* End announcement_subscription \r
-\t*/ \n ";\r
-\r
-\r
-$filename=('../../editor/add_news.php');\r
-if(!is_writable($filename)){\r
-$msg->addError('ANOUNCEMENTSUB_INSTALL_UNWRITE');\r
-}else{\r
- $data = file($filename);\r
- foreach($data as $line){\r
- $newfile .= (strpos($line,$needle))? $line . "\n" . $changes . "\n": $line;\r
- if(strpos($line,'announcement_subscription/sendmail.php')){\r
- $msg->addInfo('ANNOUNCEMENTSUB_ALREADYINSTALLED_ADDNEWS');\r
- $installed=TRUE;\r
- }\r
- }\r
- \r
- if (!$installed) {\r
- $file = fopen('$filename','w');\r
- if(fwrite($file,$newfile)){\r
- $msg->addFeedback('ANNOUNCEMENTSUB_INSTALL_ADDNEWS');\r
- }else{\r
- $msg->addError('ANNOUNCEMENTSUB_INSTALL_ADDNEWS');\r
- }\r
- fclose($file);\r
- }\r
-}\r
-\r
-?>\r