本文整理汇总了PHP中eF_executeNew函数的典型用法代码示例。如果您正苦于以下问题:PHP eF_executeNew函数的具体用法?PHP eF_executeNew怎么用?PHP eF_executeNew使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eF_executeNew函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onUninstall
public function onUninstall()
{
// Drop tables and configuration values
$a = eF_executeNew("DROP TABLE `module_BBB`;");
$b = eF_executeNew("DROP TABLE `module_BBB_users_to_meeting`;");
$c = eF_executeNew("DELETE FROM `configuration` WHERE `name` = 'module_BBB_server';");
$d = eF_executeNew("DELETE FROM `configuration` WHERE `name` = 'module_BBB_salt';");
$e = eF_executeNew("DELETE FROM `configuration` WHERE `name` = 'module_BBB_server_version';");
return $a && $b && $c && $d && $e;
}
示例2: onUpgrade
public function onUpgrade()
{
$columns = mysql_query("show columns from `module_workbook_settings`");
$alter1 = true;
$found1 = false;
$alter2 = true;
$found2 = false;
if ($columns) {
while ($col = mysql_fetch_assoc($columns)) {
if ($col['Field'] == 'unit_to_complete') {
$found1 = true;
}
if ($col['Field'] == 'edit_answers') {
$found2 = true;
}
}
if ($found1 == false) {
$alter1 = eF_executeNew("ALTER TABLE `module_workbook_settings` ADD COLUMN `unit_to_complete` INT(11) NOT NULL DEFAULT '-1' AFTER `allow_export`");
}
if ($found2 == false) {
$alter2 = eF_executeNew("ALTER TABLE `module_workbook_settings` ADD COLUMN `edit_answers` tinyint(1) NOT NULL DEFAULT '1' AFTER `allow_export`");
}
}
return $columns && $alter1 && $alter2;
}
示例3: onPageFinishLoadingSmartyTpl
public function onPageFinishLoadingSmartyTpl()
{
if (!isset($_SESSION['lesson_rooms'])) {
$_SESSION['lesson_rooms'] = array();
}
$smarty = $this->getSmartyVar();
$mainScripts = array_merge(array('../modules/module_chat/js/chat'), getMainScripts());
$smarty->assign("T_HEADER_MAIN_SCRIPTS", implode(",", $mainScripts));
if ($this->isPopup()) {
$smarty->assign("T_CHAT_MODULE_STATUS", "OFF");
} else {
$smarty->assign("T_CHAT_MODULE_STATUS", "ON");
}
if (!$_SESSION['chatter']) {
$currentUser = $this->getCurrentUser();
$_SESSION['chatter'] = $currentUser->login;
$_SESSION['utype'] = $currentUser->getType();
$this->calculateCommonality($currentUser->login);
eF_executeNew("INSERT IGNORE INTO module_chat_users (username ,timestamp_) VALUES ('" . $_SESSION['chatter'] . "', CURRENT_TIMESTAMP);");
} else {
$currentUser = $this->getCurrentUser();
if ($_SESSION['chatter'] != $currentUser->login) {
$_SESSION['chatter'] = $currentUser->login;
$_SESSION['utype'] = $currentUser->getType();
$this->calculateCommonality($currentUser->login);
eF_executeNew("INSERT IGNORE INTO module_chat_users (username ,timestamp_) VALUES ('" . $_SESSION['chatter'] . "', CURRENT_TIMESTAMP);");
}
}
$smarty->assign("T_CHAT_MODULE_BASEURL", $this->moduleBaseUrl);
$smarty->assign("T_CHAT_MODULE_BASELINK", $this->moduleBaseLink);
$smarty->assign("T_CHAT_MODULE_BASEDIR", $this->moduleBaseDir);
$onlineUsers = EfrontUser::getUsersOnline();
$smarty->assign("T_CHAT_MODULE_ONLINEUSERS", $onlineUsers);
return $this->moduleBaseDir . "module_chat.tpl";
}
示例4: eF_getTableDataFlat
$all_users = eF_getTableDataFlat("users", "login", "user_type = 'student'");
}
if (empty($existing_test_users)) {
$non_existing_users = $all_users['login'];
} else {
$non_existing_users = array_diff($all_users['login'], $existing_test_users['users_LOGIN']);
}
foreach ($non_existing_users as $user_to_add) {
if (!$all_users_to_add) {
$all_users_to_add = "('" . $_GET['edit_test'] . "','" . $user_to_add . "' , '0')";
} else {
$all_users_to_add .= ",('" . $_GET['edit_test'] . "','" . $user_to_add . "' , '0')";
}
}
if (isset($all_users_to_add)) {
eF_executeNew("INSERT INTO users_to_skillgap_tests (tests_ID, users_LOGIN, solved) VALUES " . $all_users_to_add);
}
} else {
if (isset($_GET['removeAll'])) {
// Different management if a users' filter is set or not
if ($_GET['filter']) {
$all_current_users = eF_getTableData("users_to_skillgap_tests JOIN users ON users_LOGIN = login", "login, name, surname", "");
isset($_GET['filter']) ? $all_current_users = eF_filterData($all_current_users, $_GET['filter']) : null;
foreach ($all_current_users as $test_user) {
eF_deleteTableData("users_to_skillgap_tests", "tests_ID = '" . $_GET['edit_test'] . "' AND users_LOGIN = '" . $test_user['login'] . "' ");
}
} else {
eF_deleteTableData("users_to_skillgap_tests", "tests_ID = '" . $_GET['edit_test'] . "'");
}
}
}
示例5: restore
/**
* Restore system
*
* This function is used to restore a backup previously taken
* <br/>Example:
* <code>
* </code>
*
* @param EfrontFile $restoreFile The file restore from
* @param boolean $force Force restore even if versions are incompatible
* @since 3.5.2
* @access public
*/
public static function restore($restoreFile, $force = false)
{
if (!$restoreFile instanceof EfrontFile) {
$restoreFile = new EfrontFile($restoreFile);
}
$tempDir = G_BACKUPPATH . 'temp/';
if (is_dir($tempDir)) {
$dir = new EfrontDirectory($tempDir);
$dir->delete();
}
mkdir($tempDir, 0755);
$restoreFile = $restoreFile->copy($tempDir . '/');
$restoreFile->uncompress(false);
$filesystem = new FileSystemTree($tempDir);
$iterator = new EfrontFileOnlyFilterIterator(new RecursiveIteratorIterator($filesystem->tree, RecursiveIteratorIterator::SELF_FIRST));
foreach ($iterator as $key => $value) {
if (strpos($key, 'version.txt') !== false) {
$backupVersion = file_get_contents($key);
}
}
if (version_compare($backupVersion, G_VERSION_NUM) != 0 && !$force) {
throw new Exception(_INCOMPATIBLEVERSIONS . '<br/> ' . _BACKUPVERSION . ':' . $backupVersion . ' / ' . _CURRENTVERSION . ': ' . G_VERSION_NUM, EfrontSystemException::INCOMPATIBLE_VERSIONS);
}
$sql = file_get_contents($tempDir . 'db_backup/sql.txt');
$sql = explode(";\n", $sql);
$node = $filesystem->seekNode($tempDir . 'db_backup');
for ($i = 0; $i < sizeof($sql); $i += 2) {
preg_match("/drop table (.+)/", $sql[$i], $matches);
if ($matches[1]) {
$temp[$matches[1]] = array($sql[$i], $sql[$i + 1]);
}
}
$sql = $temp;
//For each one of the tables that have backup data, recreate its table and import data
$iterator = new EfrontFileOnlyFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($node), RecursiveIteratorIterator::SELF_FIRST));
$GLOBALS['db']->Execute("SET FOREIGN_KEY_CHECKS=0");
foreach ($iterator as $file => $value) {
$tableName = preg_replace("/\\.\\d+/", "", basename($file));
if (isset($sql[$tableName])) {
try {
eF_executeNew($sql[$tableName][0]);
} catch (Exception $e) {
/*Don't halt for missing tables that can't be deleted*/
}
eF_executeNew($sql[$tableName][1]);
unset($sql[$tableName]);
}
if (strpos($file, 'sql.txt') === false && strpos($file, 'version.txt') === false) {
$data = unserialize(file_get_contents($file));
$tableExists = false;
try {
$tableExists = eF_describeTable($tableName);
} catch (Exception $e) {
}
if ($tableExists !== false && !preg_match("/^\\w+_view\$/", $tableName)) {
eF_insertTableDataMultiple($tableName, $data);
}
}
}
$GLOBALS['db']->Execute("SET FOREIGN_KEY_CHECKS=1");
//Turn off foreign key checks in order to be able to run "drop table" queries
eF_executeNew("SET FOREIGN_KEY_CHECKS = 0;");
//For each one of the tables that don't have backup data, simply recreate
foreach ($sql as $tableName => $query) {
try {
eF_executeNew($query[0]);
} catch (Exception $e) {
/*Don't halt for missing tables that can't be deleted*/
}
eF_executeNew($query[1]);
}
eF_executeNew("SET FOREIGN_KEY_CHECKS = 1;");
if (is_dir(G_BACKUPPATH . 'temp/upload')) {
$dir = new EfrontDirectory(G_BACKUPPATH . 'temp/upload');
$dir->copy(G_ROOTPATH . 'upload', true);
}
if (is_dir(G_BACKUPPATH . 'temp/lessons')) {
$dir = new EfrontDirectory(G_BACKUPPATH . 'temp/lessons');
$dir->copy(G_CONTENTPATH . 'lessons', true);
}
if (is_dir(G_BACKUPPATH . 'temp/efront_root')) {
$dir = new EfrontDirectory(G_BACKUPPATH . 'temp/efront_root');
$dir->copy(G_ROOTPATH, true);
}
if (is_dir(G_BACKUPPATH . 'temp/certificate_templates')) {
$dir = new EfrontDirectory(G_BACKUPPATH . 'temp/certificate_templates');
$dir->copy(G_ROOTPATH . 'www/certificate_templates', true);
//.........这里部分代码省略.........
示例6: doChangeLogin
private function doChangeLogin()
{
$smarty = $this->getSmartyVar();
$currentUser = $this->getCurrentUser();
$form = new HTML_QuickForm("change_login_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=module&op=module_administrator_tools&do=user", "", null, true);
$form->addElement('static', 'sidenote', '<img id = "module_administrator_tools_busy" src = "images/16x16/clock.png" style="display:none;" alt = "' . _LOADING . '" title = "' . _LOADING . '"/>');
$form->addElement('text', 'selection_user', _MODULE_ADMINISTRATOR_TOOLS_SELECTUSERTOCHANGELOGINFOR, 'id = "module_administrator_tools_autocomplete_users" class = "autoCompleteTextBox" style = "width:400px"');
$form->addElement('static', 'autocomplete_note', _STARTTYPINGFORRELEVENTMATCHES);
$form->addElement('text', 'new_login', _MODULE_ADMINISTRATOR_TOOLS_NEWLOGIN, 'class = "inputText"');
$form->addElement('hidden', 'users_LOGIN', '', 'id="module_administrator_tools_users_LOGIN"');
$form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
$form->addRule('selection_user', _THEFIELD . ' "' . _USER . '" ' . _ISMANDATORY, 'required', null, 'client');
$form->addRule('users_LOGIN', _MODULE_ADMINISTRATOR_TOOLS_THISUSERWASNOTFOUND, 'required', null, 'client');
$form->addRule('new_login', _THEFIELD . ' ' . _MODULE_ADMINISTRATOR_TOOLS_NEWLOGIN . ' ' . _HASINVALIDCHARACTERS . '. ' . _ONLYALLOWEDCHARACTERSLOGIN, 'checkParameter', 'login');
$form->addElement('submit', 'submit', _SUBMIT, 'class = "flatButton"');
if ($form->isSubmitted() && $form->validate()) {
try {
$values = $form->exportValues();
if (!$values['new_login']) {
throw new Exception(_MODULE_ADMINISTRATOR_TOOLS_YOUMUSTDEFINEUSER);
}
$user = EfrontUserFactory::factory($values['users_LOGIN']);
try {
$existingUser = true;
if (strcasecmp($values['new_login'], $values['users_LOGIN']) === 0) {
//Allow changing same user, for case conversions etc
$existingUser = false;
} else {
$newUser = EfrontUserFactory::factory($values['new_login']);
}
} catch (Exception $e) {
$existingUser = false;
}
if ($existingUser) {
throw new Exception(_MODULE_ADMINISTRATOR_TOOLS_USERALREADYEXISTS);
}
$existingTables = $GLOBALS['db']->GetCol("show tables");
$views = $GLOBALS['db']->GetCol("show tables like '%_view'");
$errors = array();
foreach ($existingTables as $table) {
try {
if (!in_array($table, $views)) {
$this->changeLogin($table, $values['users_LOGIN'], $values['new_login']);
}
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
}
EfrontCache::getInstance()->deleteCache('usernames');
if (empty($errors)) {
$message = _OPERATIONCOMPLETEDSUCCESSFULLY;
$message_type = 'success';
} else {
$message = _MODULE_ADMINISTRATOR_TOOLS_OPERATIONCOMPLETEDSUCCESSFULLYBUTHEFOLLOWINGTABLESCOULDNOTBEUPDATED . ': <br>' . implode("<br>", $errors);
$message_type = 'failure';
}
} catch (Exception $e) {
$smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
$message = $e->getMessage() . ' (' . $e->getCode() . ') <a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
$message_type = 'failure';
}
$this->setMessageVar($message, $message_type);
}
$smarty->assign("T_TOOLS_FORM", $form->toArray());
try {
if (isset($_GET['ajax']) && isset($_GET['user']) && eF_checkParameter($_GET['user'], 'login')) {
$user = EfrontUserFactory::factory($_GET['user']);
echo json_encode(array('status' => 1, 'supervisors' => $supervisors, 'supervisor_names' => $supervisorNames));
exit;
} elseif (isset($_GET['ajax']) && $_GET['ajax'] == 'fix_case') {
$existingTables = $GLOBALS['db']->GetCol("show tables");
$views = $GLOBALS['db']->GetCol("show tables like '%_view'");
$users = eF_getTableDataFlat("users", "login");
$errors = array();
foreach ($existingTables as $table) {
$t = microtime(true);
try {
if (!in_array($table, $views)) {
$fields = $GLOBALS['db']->GetCol("describe {$table}");
foreach ($users['login'] as $key => $login) {
foreach ($fields as $value) {
if (stripos($value, 'login') !== false) {
eF_executeNew("update {$table} set {$value}='{$login}' where {$value}='{$login}'");
}
}
if ($table == 'f_personal_messages') {
eF_updateTableData($table, array("sender" => $login), "sender = '" . $login . "'");
}
if ($table == 'notifications' || $table == 'sent_notifications') {
eF_updateTableData($table, array("recipient" => $login), "recipient = '" . $login . "'");
}
if ($table == 'surveys' || $table == 'module_hcd_events') {
eF_updateTableData($table, array("author" => $login), "author = '" . $login . "'");
}
}
}
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
//pr("Time for $table: ".(microtime(true)-$t));flush();ob_flush();
//.........这里部分代码省略.........
示例7: onUnInstall
public function onUnInstall()
{
eF_executeNew("drop table module_rss_feeds");
return true;
}
示例8: onUninstall
public function onUninstall()
{
eF_executeNew("DROP TABLE module_links;");
return true;
}
示例9: onUninstall
public function onUninstall()
{
$res1 = eF_executeNew("DROP TABLE module_crossword_users;");
$res2 = eF_executeNew("DROP TABLE module_crossword_words;");
$res3 = eF_executeNew("DROP TABLE words;");
return $res1 && $res2 && $res3 && $res4;
}
示例10: onUpgrade
public function onUpgrade()
{
$t1 = eF_executeNew("CREATE TABLE IF NOT EXISTS `module_journal_settings` (\n\t\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t`name` varchar(45) NOT NULL,\n\t\t\t\t\t`value` tinyint(1) NOT NULL,\n\t\t\t\t\tPRIMARY KEY (`id`)\n\t\t\t\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8");
$resultNew = eF_getTableData("module_journal_settings", "*");
if (count($resultNew) == 0) {
$result = eF_getTableData("module_journal_allow_export", "*");
eF_insertTableData("module_journal_settings", array('name' => 'export', 'value' => $result[0]['allow']));
eF_insertTableData("module_journal_settings", array('name' => 'preview', 'value' => 1));
}
$t2 = eF_executeNew("DROP TABLE IF EXISTS `module_journal_allow_export`");
return $t1 && $t2;
}
示例11: onUninstall
public function onUninstall()
{
return eF_executeNew("DROP TABLE module_youtube;");
}
示例12: refreshLogin
/**
* Either refresh the 'time' field of the current user/session/entity, or create a new entry
* if the user just entered an entity during this session
*/
function refreshLogin()
{
if ($_SESSION['s_login']) {
$entity = getUserTimeTarget($_SERVER['REQUEST_URI']);
//Something like 'system', 'lesson' or 'unit'
//$entity = $_SESSION['s_time_target'];
$result = eF_getTableData("user_times", "time, timestamp_now", "session_expired=0 and session_custom_identifier = '" . $_SESSION['s_custom_identifier'] . "' and users_LOGIN='" . $_SESSION['s_login'] . "' and entity='" . current($entity) . "' and entity_id='" . key($entity) . "'");
$totalTimeSoFar = false;
if (!empty($result) && $result[0]['timestamp_now'] >= time() - 5 * $GLOBALS['configuration']['updater_period'] / 1000) {
//5 failed updates: reset
$totalTimeSoFar = true;
}
if ($totalTimeSoFar === false) {
//Nullify current entry for the same entity
eF_updateTableData("user_times", array("session_expired" => 1), "session_expired = 0 and session_custom_identifier = '" . $_SESSION['s_custom_identifier'] . "' and users_LOGIN = '" . $_SESSION['s_login'] . "'\n\t\t\t\t\t\t\t\t\t\t\tand entity = '" . current($entity) . "' and entity_id = '" . key($entity) . "'");
//Insert a new entry for this entity, to start counting time for
$fields = array("session_timestamp" => time(), "session_id" => session_id(), "session_custom_identifier" => $_SESSION['s_custom_identifier'], "session_expired" => 0, "users_LOGIN" => $_SESSION['s_login'], "timestamp_now" => time(), "time" => 0, "lessons_ID" => $_SESSION['s_lessons_ID'] ? $_SESSION['s_lessons_ID'] : null, "courses_ID" => $_SESSION['s_courses_ID'] ? $_SESSION['s_courses_ID'] : null, "entity" => current($entity), "entity_id" => key($entity));
eF_insertTableData("user_times", $fields);
} else {
//Update times for this entity
$result = eF_executeNew("update user_times set time=time+(" . time() . "-timestamp_now),timestamp_now=" . time() . "\n\t\t\t\t\t\t\t\t\twhere session_expired = 0 and session_custom_identifier = '" . $_SESSION['s_custom_identifier'] . "' and users_LOGIN = '" . $_SESSION['s_login'] . "'\n\t\t\t\t\t\t\t\t\t\tand entity = '" . current($entity) . "' and entity_id = '" . key($entity) . "'");
}
eF_updateTableData("user_times", array("session_expired" => 1), "session_expired = 0 and session_custom_identifier = '" . $_SESSION['s_custom_identifier'] . "' and users_LOGIN = '" . $_SESSION['s_login'] . "'\n\t\t\t\t\t\t\t\t\t\tand (entity != '" . current($entity) . "' or entity_id != '" . key($entity) . "')");
}
}
示例13: onUninstall
public function onUninstall()
{
$t1 = eF_executeNew("DROP TABLE IF EXISTS `module_gradebook_ranges`");
$t2 = eF_executeNew("DROP TABLE IF EXISTS `module_gradebook_objects`");
$t3 = eF_executeNew("DROP TABLE IF EXISTS `module_gradebook_grades`");
$t4 = eF_executeNew("DROP TABLE IF EXISTS `module_gradebook_users`");
return $t1 && $t2 && $t3 && $t4;
}
示例14: onUninstall
public function onUninstall()
{
$res1 = eF_executeNew("DROP TABLE module_flashcards_users_to_cards;");
$res2 = eF_executeNew("DROP TABLE module_flashcards_decks;");
return $res1 && $res2 && $res3 && $res4;
}
示例15: eF_execute
/**
* Execute code directly -- Changed to an alias of eF_executeNew
*
* @deprecated
* @param $sql
* @return unknown_type
*/
function eF_execute($sql)
{
return eF_executeNew($sql);
}