/** * Put any upgrade commands here, usually database table related * * @see libraries/EfrontModule#onUpgrade() */ public function onUpgrade() { try { eF_executeQuery("ALTER TABLE module_vLab_data change timestamp timestamp int(11) default 0"); } catch (Exception $e) { /*the table was already upgraded*/ } return true; }
function sendEmailToAdministrators($subject, $body) { //Set headers for emails $headers = "From: quota_store\r\n"; //$headers .= "Reply-To: " . strip_tags($_POST['req-email']) . "\r\n"; //$headers .= "CC: susan@example.com\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $admin = user_array(eF_executeQuery("select * from users where login='******'")); //is fixed, the below lines must be removed. // This is just a temporary fix. $content = '<html>'; $content .= ' <body>'; $salutation = '<p>Dear ' . $admin['name'] . ' ' . $admin['surname'] . '</p>'; $footer = '<p><em>This is an automated message by the Quota Store.</em></p>'; $content .= $salutation . $body . $footer; $content .= ' </body>'; $content .= '</html>'; $myEmail = '*****@*****.**'; /* echo "about to send email to Dr. Sadjadi: " . $myEmail . PHP_EOL; echo "subject: " .PHP_EOL; var_dump($subject); echo "content: ".PHP_EOL; var_dump($content); echo "headers: ".PHP_EOL; var_dump($headers); mail($myEmail, $subject, $content, $headers); */ // TODO This fucntion does not return any admins. It needs to be fixed. $admins = db_getAdministrators_new(); foreach ($admins as $admin) { $content = '<html>'; $content .= ' <body>'; $salutation = '<p>Dear ' . $admin['name'] . ' ' . $admin['surname'] . '</p>'; $footer = '<p><em>This is an automated message by the Quota Store.</em></p>'; $content .= $salutation . $body . $footer; $content .= ' </body>'; $content .= '</html>'; /* echo "about to send email to admin: " . $admin['email'] .PHP_EOL; echo "subject: " .PHP_EOL; var_dump($subject); echo "content: ".PHP_EOL; var_dump($content); echo "headers: ".PHP_EOL; var_dump($headers); */ mail($admin['email'], $subject, $content, $headers); } }
function getPackagesWithItems($items) { $values = "("; foreach ($items as $item) { $values .= $item['id'] . ","; } $values = substr($values, 0, -1); $values .= ")"; $sql = "SELECT DISTINCT * FROM module_vlabs_shoppingcart_store_inventory WHERE active = 1 and id IN "; $sql .= "(SELECT DISTINCT packageid FROM module_vlabs_shoppingcart_package_summary WHERE itemid IN " . $values . ")"; $packages = eF_executeQuery($sql); $filteredPackages = array(); foreach ($packages as $p) { $addPackage = true; $summary = refactored_db_getPackageSummary($p['id']); foreach ($summary as $s) { $elegible = false; foreach ($items as $item) { if ($s['itemid'] == $item['id']) { $elegible = true; break; } } if (!$elegible) { $addPackage = false; break; } } if ($addPackage) { array_push($filteredPackages, $p); } } return $filteredPackages; }
function db_getModules() { $sql = "SELECT * FROM module_vlabs_shoppingcart_dbadmin"; $modules_array = array(); $modules = eF_executeQuery($sql); if ($modules != null) { foreach ($modules as $m) { $m_array = array($m['id'], $m['module'], $m['description']); array_push($modules_array, $m_array); } return $modules_array; } else { } return $modules; }
<?php require_once 'db/db.php'; require_once 'packages.php'; require_once 'transactions.php'; //header("Content-type: text/x-json"); if (isset($_POST['action'])) { $action = $_POST['action']; } else { $action = ""; } if ($action == "reload") { $sql = 'SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = "efront" AND table_name = "module_vlabs_shoppingcart_order"'; $tcount = eF_executeQuery($sql); //echo "checking if orders table exists: " . PHP_EOL; //var_dump($tcount); foreach ($tcount as $t) { if ($t['COUNT(*)'] < 1) { echo json_encode(array()); return; } } $preassignments = db_getPreassignments(); //refactored db call : ) $formattedPreasssignments = array(); foreach ($preassignments as $p) { $item = refactored_db_getItem($p['itemid']); //echo '<script type="text/javascript">alert("foreach loop, preassignment.php source itemid: '. $itemid . '")</script>'; $course = db_getCourseById($p['courseid']); $course_id = ""; $course_shortn = "";
/** * Put any uninstallation operations here, usually deleting database tables * * @see libraries/EfrontModule#onUninstall() */ public function onUninstall() { eF_executeQuery("drop table if exists module_shared_files"); return true; }
if ($result == null) { return "fail"; return; } eF_executeQuery("drop table if exists module_vlabs_shoppingcart_package_summary"); if ($result == null) { return "fail"; return; } eF_executeQuery("drop table if exists module_vlabs_shoppingcart_preassignment"); if ($result == null) { return "fail"; return; } eF_executeQuery("drop table if exists module_vlabs_shoppingcart_store_inventory"); if ($result == null) { return "fail"; return; } eF_executeQuery("drop table if exists module_vlabs_shoppingcart_order"); if ($result == null) { return "fail"; return; } eF_executeQuery("drop table if exists module_vlabs_shoppingcart_log"); if ($result == null) { return "fail"; return; } echo "pass"; }