本文整理汇总了PHP中eF_updateTableData函数的典型用法代码示例。如果您正苦于以下问题:PHP eF_updateTableData函数的具体用法?PHP eF_updateTableData怎么用?PHP eF_updateTableData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eF_updateTableData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setcookie
setcookie('c_request', htmlspecialchars_decode(basename($_SERVER['REQUEST_URI'])), time() + 300, false, false, false, true);
}
eF_redirect("index.php?ctg=expired");
exit;
}
if (isset($_SESSION['s_index_comply'])) {
eF_redirect("index.php?ctg=" . $_SESSION['s_index_comply']);
exit;
}
if (!isset($_GET['ajax']) && !isset($_GET['postAjaxRequest']) && !isset($popup) && !isset($_GET['tabberajax'])) {
$_SESSION['previousMainUrl'] = $_SERVER['REQUEST_URI'];
}
if (isset($_GET['toggle_mode'])) {
//EfrontConfiguration::setValue('simple_mode', !$GLOBALS['configuration']['simple_mode']);
$mode = eF_getTableData("users", "simple_mode", "login='" . $_SESSION['s_login'] . "'");
eF_updateTableData("users", array('simple_mode' => !$mode[0]['simple_mode']), "login='" . $_SESSION['s_login'] . "'");
}
if (isset($_COOKIE['c_request']) && $_COOKIE['c_request']) {
setcookie('c_request', '', time() - 86400);
if (mb_strpos($_COOKIE['c_request'], '.php') !== false) {
$urlParts = parse_url($_COOKIE['c_request']);
if (basename($urlParts['path']) == 'professor.php') {
eF_redirect($_COOKIE['c_request']);
}
} else {
eF_redirect($_SESSION['s_type'] . '.php?' . $_COOKIE['c_request']);
}
}
$roles = EfrontLessonUser::getLessonsRoles();
try {
if (isset($_GET['view_unit']) || isset($_GET['package_ID'])) {
示例2: setValue
/**
* Set configuration value
*
* This function is used to set a configuration value. Given a name/value pair,
* this function first checks if it exists in the 'configuration' database table.
* If so, it updates the variable with the new value, otherwise it inserts a new
* entry.
* <br/>Example:
* <code>
* $defaultConfig = EfrontConfiguration :: setValue('smtp_host', 'localhost'); //Set the configuration parameter 'smtp_host' to 'localhost'
* </code>
*
* @param string $name The variable name
* @param string $value The variable value
* @return boolean The query result
* @access public
* @since 3.0
* @static
*/
public static function setValue($name, $value)
{
$value = trim($value);
try {
eF_insertTableData("configuration", array('name' => $name, 'value' => $value));
} catch (Exception $e) {
//If exists, update it
eF_updateTableData("configuration", array('value' => $value), "name = '{$name}'");
}
$GLOBALS['configuration'][$name] = $value;
EfrontCache::getInstance()->deleteCache('configuration');
return true;
}
示例3: basename
$smarty->assign('T_RENAME_CERTIFICATE_TEMPLATE_REDIRECT', $redirectUrl);
}
$tid = $_GET['template_id'];
$postTarget = basename($_SERVER['PHP_SELF']) . '?' . $baseUrl . '&op=rename_certificate_template&template_id=' . $tid;
$form = new HTML_QuickForm("rename_certificate_template_form", "post", $postTarget, "", null, true);
$form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
// Register this rule for checking user input with eF_checkParameter
$form->addElement('text', 'certificate_name', _CERTIFICATENAME, 'class="inputText"');
$form->addRule('certificate_name', _THEFIELD . ' "' . _CERTIFICATENAME . '" ' . _ISMANDATORY, 'required', null, 'client');
$form->addElement('submit', 'rename_certificate_template', _SAVE, 'class="flatButton"');
$renameTemplate = eF_getTableData("certificate_templates", "certificate_name", "id=" . $tid);
$form->setDefaults(array('certificate_name' => $renameTemplate[0]['certificate_name']));
if ($form->isSubmitted() && $form->validate()) {
$formValues = $form->exportValues();
$dbFields = array("certificate_name" => $formValues['certificate_name']);
if (eF_updateTableData("certificate_templates", $dbFields, "id=" . $tid)) {
$message = _SUCCESSFULLYRENAMECERTIFICATETEMPLATE;
$message_type = 'success';
} else {
$message = _PROBLEMRENAMECERTIFICATETEMPLATE;
$message_type = 'failure';
}
$redirectUrl = "" . basename($_SERVER['PHP_SELF']) . "?" . $baseUrl . "&op=format_certificate&message=" . urlencode($message);
$redirectUrl .= "&message_type=" . $message_type . "&reset_popup=1&tid=" . $tid;
$smarty->assign('T_RENAME_CERTIFICATE_TEMPLATE_REDIRECT', $redirectUrl);
}
$renderer = prepareFormRenderer($form);
$smarty->assign('T_RENAME_CERTIFICATE_TEMPLATE_FORM', $renderer->toArray());
}
#cpp#endif
} else {
示例4: array_merge
}
$editLesson->lesson = array_merge($editLesson->lesson, $fields_update);
if ($values['price'] && $values['recurring'] && in_array($values['recurring'], array_keys($recurringOptions))) {
$editLesson->options['recurring'] = $values['recurring'];
if ($editLesson->options['recurring']) {
$editLesson->options['recurring_duration'] = $form->exportValue($editLesson->options['recurring'] . '_duration');
}
} else {
unset($editLesson->options['recurring']);
}
try {
$editLesson->persist();
$lesson_forum = eF_getTableData("f_forums", "id", "lessons_ID=" . $_GET['edit_lesson']);
//update lesson's forum names as well
if (sizeof($lesson_forum) > 0) {
eF_updateTableData("f_forums", array('title' => $values['name']), "id=" . $lesson_forum[0]['id']);
}
eF_redirect(basename(basename($_SERVER['PHP_SELF'])) . '?ctg=lessons&message=' . urlencode(_LESSONUPDATED) . '&message_type=success');
} catch (Exception $e) {
$smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
$message = _SOMEPROBLEMOCCURED . ': ' . $e->getMessage() . ' (' . $e->getCode() . ') <a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
$message_type = 'failure';
}
}
}
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
//Create a smarty renderer
$renderer->setRequiredTemplate('{$html}{if $required}
<span class = "formRequired">*</span>
{/if}');
示例5: eF_redirect
$message_type = 'failure';
eF_redirect('' . basename($_SERVER['PHP_SELF']) . '?ctg=reset_pwd&message=' . urlencode($message) . '&message_type=' . $message_type);
}
} elseif (isset($_GET['id']) && isset($_GET['login'])) {
//Second stage, user received the email and clicked on the link
$login = $_GET['login'];
if (!eF_checkParameter($login, 'login')) {
//Possible hacking attempt: malformed user
$message = _INVALIDUSER;
$message_type = 'failure';
} else {
$user = eF_getTableData("users", "email, name", "login='" . $login . "'");
if (strcmp($_GET['id'], EfrontUser::createPassword($login)) == 0 && sizeof($user) > 0) {
$password = implode("", array_map(create_function('$v', 'return chr($v);'), array_rand(array_flip(array_merge(range(48, 57), range(64, 90), range(97, 122))), 10)));
$password_encrypted = EfrontUser::createPassword($password);
eF_updateTableData("users", array('password' => $password_encrypted), "login='{$login}'");
EfrontEvent::triggerEvent(array("type" => EfrontEvent::SYSTEM_NEW_PASSWORD_REQUEST, "users_LOGIN" => $login, "entity_name" => $password));
$message = _EMAILWITHPASSWORDSENT;
eF_redirect('' . basename($_SERVER['PHP_SELF']) . '?message=' . urlencode($message) . '&message_type=success');
} else {
$message = _INVALIDUSER;
$message_type = 'failure';
}
}
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$renderer->setRequiredTemplate('{$html}{if $required}
<span class = "formRequired">*</span>
{/if}');
$form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
$form->setRequiredNote(_REQUIREDNOTE);
示例6: HTML_QuickForm_Renderer_ArraySmarty
$form->setDefaults(array('topic_description' => $topic[0]['title']));
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$renderer->setRequiredTemplate('{$html}{if $required}
<span class = "formRequired">*</span>
{/if}');
//LESSONTIMELINE DATA SUBMISSION
if ($form->isSubmitted()) {
if ($form->validate()) {
$topic_content = array('title' => $form->exportValue('topic_description'), 'lessons_ID' => $currentLesson->lesson['id']);
if (isset($_GET['add_topic'])) {
eF_insertTableData("lessons_timeline_topics", $topic_content);
$message = _SUCCESSFULLYCREATEDLESSONTIMELINETOPIC;
$message_type = 'success';
} elseif (isset($_GET['edit_topic'])) {
eF_updateTableData("lessons_timeline_topics", $topic_content, "id = '" . $_GET['edit_topic'] . "'");
$message = _LESSONTIMELINETOPICDATAUPDATED;
$message_type = 'success';
}
// Return to previous url stored in a hidden - that way, after the insertion we can immediately return to where we were
echo "<script>!/\\?/.test(parent.location) ? parent.location = '" . basename($form->exportValue('previous_url')) . "&message=" . urlencode($message) . "&message_type=" . $message_type . "' : parent.location = '" . basename($form->exportValue('previous_url')) . "&message=" . urlencode($message) . "&message_type=" . $message_type . "';</script>";
//eF_redirect("".$form->exportValue('previous_url')."&message=". $message . "&message_type=" . $message_type . "&tab=skills");
exit;
}
}
$form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
$form->setRequiredNote(_REQUIREDNOTE);
$form->accept($renderer);
$smarty->assign('T_LESSONTIMELINE_TOPIC_FORM', $renderer->toArray());
}
}
示例7: eF_getTableData
echo "</xml>";
}
} else {
echo "<xml>";
echo "<status>error</status>";
echo "<message>Invalid token</message>";
echo "</xml>";
}
break;
case 'deactivate_user_course':
if (isset($_GET['token']) && checkToken($_GET['token'])) {
if (isset($_GET['login']) && isset($_GET['course'])) {
$update['from_timestamp'] = 0;
$courses = eF_getTableData("lessons_to_courses", "lessons_id", "courses_ID=" . $_GET['course']);
for ($i = 0; $i < sizeof($courses); $i++) {
if (eF_updateTableData("users_to_lessons", $update, "users_LOGIN='" . $_GET['login'] . "' and lessons_ID=" . $courses[$i]['lessons_id'])) {
$cacheKey = "user_lesson_status:lesson:" . $courses[$i]['lessons_id'] . "user:" . $_GET['login'];
EfrontCache::getInstance()->deleteCache($cacheKey);
}
}
echo "<xml>";
echo "<status>ok</status>";
echo "</xml>";
} else {
echo "<xml>";
echo "<status>error</status>";
echo "<message>Incomplete arguments</message>";
echo "</xml>";
}
} else {
echo "<xml>";
示例8: setCache
public function setCache($key, $data, $timeout = null)
{
$key = self::_encode($parameters);
$values = array("cache_key" => $key, "value" => serialize($data), "timestamp" => time());
if ($timeout && eF_checkParameter($timeout, 'int')) {
$values['timeout'] = $timeout;
}
if (sizeof(eF_getTableData("cache", "value", "cache_key='" . $key . "'")) > 0) {
$result = eF_updateTableData("cache", $values, "cache_key='{$key}'");
} else {
$result = eF_insertTableData("cache", $values);
}
return $result;
}
示例9: getSmartyTpl
public function getSmartyTpl()
{
$smarty = $this->getSmartyVar();
$smarty->assign("T_RSS_MODULE_BASEURL", $this->moduleBaseUrl);
$smarty->assign("T_RSS_MODULE_BASELINK", $this->moduleBaseLink);
$smarty->assign("T_RSS_PROVIDED_FEEDS_MODES", $this->feedProviderModes);
$smarty->assign("T_RSS_PROVIDED_FEEDS_TYPES", $this->providedFeeds);
$smarty->assign("T_RSS_PROVIDED_FEEDS_LESSON_TYPES", $this->lessonProvidedFeeds);
if (isset($_GET['delete_feed']) && eF_checkParameter($_GET['delete_feed'], 'id')) {
try {
if ($_GET['type'] == 'provider') {
eF_deleteTableData("module_rss_provider", "id=" . $_GET['delete_feed']);
} else {
eF_deleteTableData("module_rss_feeds", "id=" . $_GET['delete_feed']);
}
} catch (Exception $e) {
handleAjaxExceptions($e);
}
exit;
} elseif (isset($_GET['deactivate_feed']) && eF_checkParameter($_GET['deactivate_feed'], 'id')) {
try {
if ($_GET['type'] == 'provider') {
eF_updateTableData("module_rss_provider", array("active" => 0), "id=" . $_GET['deactivate_feed']);
} else {
eF_updateTableData("module_rss_feeds", array("active" => 0), "id=" . $_GET['deactivate_feed']);
}
echo 0;
} catch (Exception $e) {
handleAjaxExceptions($e);
}
exit;
} elseif (isset($_GET['activate_feed']) && eF_checkParameter($_GET['activate_feed'], 'file')) {
//Although db operations do not support exceptions (yet), we leave this here for future support
try {
if ($_GET['type'] == 'provider') {
eF_updateTableData("module_rss_provider", array("active" => 1), "id=" . $_GET['activate_feed']);
} else {
eF_updateTableData("module_rss_feeds", array("active" => 1), "id=" . $_GET['activate_feed']);
}
echo 1;
} catch (Exception $e) {
handleAjaxExceptions($e);
}
exit;
} else {
if (isset($_GET['add_feed']) || isset($_GET['edit_feed']) && eF_checkParameter($_GET['edit_feed'], 'id')) {
if ($_SESSION['s_lesson_user_type']) {
$type = $_SESSION['s_lesson_user_type'];
} else {
$type = $this->getCurrentUser()->getType();
}
$smarty->assign("T_RSS_USERTYPE", $type);
$feeds = $this->getFeeds();
$lessons = array(-1 => _RSS_NONE, 0 => _ALLLESSONS);
$result = EfrontLesson::getLessons();
foreach ($result as $key => $lesson) {
$lessons[$key] = $lesson['name'];
}
isset($_GET['add_feed']) ? $postTarget = "&add_feed=1" : ($postTarget = "&edit_feed=" . $_GET['edit_feed']);
$form = new HTML_QuickForm("add_feed_form", "post", $this->moduleBaseUrl . $postTarget, "", null, true);
$form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
$form->addElement('text', 'title', _RSS_FEEDTITLE, 'class = "inputText"');
$form->addElement('text', 'url', _RSS_FEEDURL, 'class = "inputText"');
$form->addElement('select', 'lessons_ID', _LESSON, $lessons);
if ($type != 'administrator' && $_SESSION['s_lessons_ID']) {
$form->setDefaults(array('lessons_ID' => $_SESSION['s_lessons_ID']));
$form->freeze(array('lessons_ID'));
}
$form->addElement("advcheckbox", "active", _RSS_ACTIVE, null, 'class = "inputCheckBox"', array(0, 1));
$form->setDefaults(array('active' => 1));
$form->addElement("advcheckbox", "only_summary", _RSS_ONLYSUMMARY, null, 'class = "inputCheckBox"', array(0, 1));
$form->addRule('title', _THEFIELD . ' "' . _RSS_FEEDTITLE . '" ' . _ISMANDATORY, 'required', null, 'client');
$form->addRule('url', _THEFIELD . ' "' . _RSS_FEEDURL . '" ' . _ISMANDATORY, 'required', null, 'client');
$form->addRule('title', _INVALIDFIELDDATA, 'checkParameter', 'text');
$form->addElement('submit', 'submit', _SUBMIT, 'class = "flatButton"');
if (isset($_GET['edit_feed'])) {
$editFeed = $feeds[$_GET['edit_feed']];
$form->setDefaults($editFeed);
}
if ($form->isSubmitted() && $form->validate()) {
//If the form is submitted and validated
$values = $form->exportValues();
$fields = array("title" => $values['title'], "url" => $values['url'], "active" => $values['active'], "only_summary" => $values['only_summary'], "lessons_ID" => $values['lessons_ID']);
if (isset($_GET['add_feed'])) {
eF_insertTableData("module_rss_feeds", $fields);
$smarty->assign("T_RSS_RSS_MESSAGE", _RSS_SUCCESSFULLYADDEDFEED);
} else {
eF_updateTableData("module_rss_feeds", $fields, "id=" . $_GET['edit_feed']);
$smarty->assign("T_RSS_RSS_MESSAGE", _RSS_SUCCESSFULLYEDITEDFEED);
EfrontCache::getInstance()->deleteCache('rss_cache:' . $_GET['edit_feed']);
}
}
$smarty->assign("T_RSS_ADD_RSS_FORM", $form->toArray());
} else {
if (isset($_GET['add_feed_provider']) || isset($_GET['edit_feed_provider']) && eF_checkParameter($_GET['edit_feed_provider'], 'id')) {
if ($_SESSION['s_lesson_user_type']) {
$type = $_SESSION['s_lesson_user_type'];
} else {
$type = $this->getCurrentUser()->getType();
}
//.........这里部分代码省略.........
示例10: persist
/**
* Persist group values
*
* This function is used to persist any changes made to the current
* group.
* <br/>Example:
* <code>
* $group = new EfrontGroup(3); //Instantiate group with id 3
* $group -> group['name'] = 'new name'; //Change a group's value
* $group -> persist(); //Store changes values to the database
* </code>
*
* @return boolean True if everything is ok
* @since 3.5.0
* @access public
*/
public function persist()
{
// Remove the current default group
if ($this->group['is_default']) {
eF_updateTableData("groups", array("is_default" => 0), "1=1");
}
$ok = eF_updateTableData("groups", $this->group, "id=" . $this->group['id']);
return $ok;
}
示例11: reset2
/**
* Experimental function for merging lessons and courses to the main tree
*
*/
public function reset2()
{
$directions = eF_getTableData("directions", "*", "", "name");
$result = eF_getTableData("lessons", "*");
$lessons = array();
foreach ($result as $value) {
$lessons[$value['directions_ID']][] = new EfrontLesson($value);
}
$result = eF_getTableData("courses", "*");
$courses = array();
foreach ($result as $value) {
$courses[$value['directions_ID']][] = new EfrontCourse($value);
}
if (sizeof($directions) == 0) {
$this->tree = new RecursiveArrayIterator(array());
return;
}
foreach ($directions as $node) {
//Assign previous direction ids as keys to the previousNodes array, which will be used for sorting afterwards
$nodes[$node['id']] = new EfrontDirection($node);
//We convert arrays to array objects, which is best for manipulating data through iterators
$nodes[$node['id']]['lessons'] = $lessons[$node['id']];
$nodes[$node['id']]['courses'] = $lessons[$node['id']];
}
$rejected = array();
$tree = $nodes;
$count = 0;
//$count is used to prevent infinite loops
while (sizeof($tree) > 1 && $count++ < 1000) {
//We will merge all branches under the main tree branch, the 0 node, so its size will become 1
foreach ($nodes as $key => $value) {
if ($value['parent_direction_ID'] == 0 || in_array($value['parent_direction_ID'], array_keys($nodes))) {
//If the unit parent is in the $nodes array keys - which are the unit ids- or it is 0, then it is valid
$parentNodes[$value['parent_direction_ID']][] = $value;
//Find which nodes have children and assign them to $parentNodes
$tree[$value['parent_direction_ID']][$value['id']] = array();
//We create the "slots" where the node's children will be inserted. This way, the ordering will not be lost
} else {
$rejected = $rejected + array($value['id'] => $value);
//Append units with invalid parents to $rejected list
unset($nodes[$key]);
//Remove the invalid unit from the units array, as well as from the parentUnits, in case a n entry for it was created earlier
unset($parentNodes[$value['parent_direction_ID']]);
}
}
if (isset($parentNodes)) {
//If the unit was rejected, there won't be a $parentNodes array
$leafNodes = array_diff(array_keys($nodes), array_keys($parentNodes));
//Now, it's easy to see which nodes are leaf nodes, just by subtracting $parentNodes from the whole set
foreach ($leafNodes as $leaf) {
$parent_id = $nodes[$leaf]['parent_direction_ID'];
//Get the leaf's parent
$tree[$parent_id][$leaf] = $tree[$leaf];
//Append the leaf to its parent's tree branch
unset($tree[$leaf]);
//Remove the leaf from the main tree branch
unset($nodes[$leaf]);
//Remove the leaf from the nodes set
}
unset($parentNodes);
//Reset $parentNodes; new ones will be calculated at the next loop
}
}
if (sizeof($tree) > 0 && !isset($tree[0])) {
//This is a special case, where only one node exists in the tree
$tree = array($tree);
}
foreach ($tree as $key => $value) {
if ($key != 0) {
$rejected[$key] = $value;
}
}
if (sizeof($rejected) > 0) {
//Append rejected nodes to the end of the tree array, updating their parent/previous information
foreach ($rejected as $key => $value) {
eF_updateTableData("directions", array("parent_direction_ID" => 0), "id=" . $key);
$value['parent_direction_ID'] = 0;
$tree[0][] = $value;
}
}
$this->tree = new RecursiveArrayIterator($tree[0]);
}
示例12: unset
//@todo: remove package_ID from $_SESSION, beware package_ID is needed in lms_commit
if (isset($_SESSION['package_ID']) && !$_GET['commit_lms']) {
unset($_SESSION['package_ID']);
}
try {
if (isset($_GET['view_unit']) && eF_checkParameter($_GET['view_unit'], 'id')) {
$currentContent = new EfrontContentTree($currentLesson);
//Initialize content
$currentContent->markSeenNodes($currentUser);
if ($currentLesson->lesson['access_limit']) {
$result = eF_getTableData("users_to_lessons", "access_counter", "users_LOGIN='" . $currentUser->user['login'] . "' and lessons_ID='" . $currentLesson->lesson['id'] . "'");
if ($result[0]['access_counter'] >= $currentLesson->lesson['access_limit']) {
eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=lessons&message=" . urlencode(_ACCESSDEPLETED) . "&message_type=failure");
} else {
if (!$_SESSION['visited_lesson'][$currentLesson->lesson['id']]) {
eF_updateTableData("users_to_lessons", array('access_counter' => $result[0]['access_counter'] + 1), "users_LOGIN='" . $currentUser->user['login'] . "' and lessons_ID='" . $currentLesson->lesson['id'] . "'");
$_SESSION['visited_lesson'][$currentLesson->lesson['id']] = 1;
}
}
}
if ($currentUser->coreAccess['content'] == 'hidden') {
eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
}
if (!$currentLesson || !$currentContent) {
eF_redirect("" . basename($_SERVER['PHP_SELF']));
}
$currentUnit = $currentContent->seekNode($_GET['view_unit']);
//Initialize current unit
//The content tree does not hold data, so assign this unit its data
$unitData = new EfrontUnit($_GET['view_unit']);
//$_SESSION['s_time_target'] = array($_GET['view_unit'] => 'unit');
示例13: getModule
//.........这里部分代码省略.........
$form->addElement('submit', 'submit_recheck', _MODULE_SECURITY_RECHECKFILES, 'class = "flatButton" ');
$form->addElement('submit', 'reset_ignore_list', _MODULE_SECURITY_RESETIGNORELIST, 'class = "flatButton" ');
$form->addElement('submit', 'ignore_changed_all', _MODULE_SECURITY_IGNOREALL, 'class = "flatButton" ');
break;
case 'new_files':
list($changed_files, $new_files) = $this->checksumCheck();
if (isset($_GET['download']) && in_array($_GET['download'], array_keys($new_files)) && $_GET['download'] != 'libraries/configuration.php') {
try {
$file = new EfrontFile(G_ROOTPATH . $_GET['download']);
$file->sendFile(true);
exit;
} catch (Exception $e) {
$this->setMessageVar(_MODULE_SECURITY_FILECOULDNOTBEDELETED, 'failure');
}
} else {
if (isset($_GET['ignore']) && in_array($_GET['ignore'], array_keys($new_files))) {
$this->addToIgnoreList($_GET['ignore']);
} else {
if (isset($_GET['delete']) && in_array($_GET['delete'], array_keys($new_files))) {
try {
$file = new EfrontFile(G_ROOTPATH . $_GET['delete']);
$file->delete();
} catch (Exception $e) {
}
$file = new EfrontFile($this->getLocalListName());
$file->delete();
list($changed_files, $new_files) = $this->checksumCheck();
}
}
}
$smarty->assign("T_NEW_FILES", $new_files);
$form->addElement('submit', 'submit_recheck', _MODULE_SECURITY_RECHECKFILES, 'class = "flatButton" ');
$form->addElement('submit', 'reset_ignore_list', _MODULE_SECURITY_RESETIGNORELIST, 'class = "flatButton" ');
$form->addElement('submit', 'ignore_new_all', _MODULE_SECURITY_IGNOREALL, 'class = "flatButton" ');
break;
default:
$smarty->assign("T_SECURITY_FEEDS", $this->getRssFeeds());
try {
$smarty->assign("T_LOCAL_ISSUES", $this->checkLocalIssues());
} catch (Exception $e) {
$this->setMessageVar($e->getMessage(), 'failure');
}
break;
}
if ($form->isSubmitted() && $form->validate()) {
try {
$values = $form->exportValues();
if ($values['submit_recheck']) {
$file = new EfrontFile($this->getLocalListName());
$file->delete();
eF_redirect($this->moduleBaseUrl . '&type=' . $_GET['type'] . '&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success');
} else {
if ($values['submit_delete_install']) {
file_get_contents(G_SERVERNAME . 'index.php?delete_install=1');
eF_redirect($this->moduleBaseUrl . '&type=' . $_GET['type'] . '&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success');
} else {
if ($values['submit_deactivate']) {
$result = eF_updateTableData("users", array('active' => 0), "(login = 'student' and password = '04aed36b7da8d1b5d8c892cf91486cdb') or (login = 'professor' and password = 'da18be534843cf9f9edd60c89de6a8e7')");
eF_redirect($this->moduleBaseUrl . '&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success');
} else {
if ($values['reset_ignore_list']) {
try {
$file = new EfrontFile($this->getIgnoreListName());
$file->delete();
eF_redirect($this->moduleBaseUrl . '&type=' . $_GET['type'] . '&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success');
} catch (Exception $e) {
$this->setMessageVar(_MODULE_SECURITY_THELISTISEMTPY, 'failure');
}
} else {
if ($values['ignore_new_all']) {
list($changed_files, $new_files) = $this->checksumCheck();
foreach ($new_files as $key => $value) {
$this->addToIgnoreList($key);
}
eF_redirect($this->moduleBaseUrl . '&type=new_files&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success');
} else {
if ($values['ignore_changed_all']) {
list($changed_files, $new_files) = $this->checksumCheck();
foreach ($changed_files as $key => $value) {
$this->addToIgnoreList($key);
}
eF_redirect($this->moduleBaseUrl . '&type=changed_files&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success');
}
}
}
}
}
}
} 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>';
$this->setMessageVar($message, 'failure');
}
}
$renderer = prepareFormRenderer($form);
$smarty->assign('T_SECURITY_FORM', $renderer->toArray());
//$feeds = $this->getRssFeeds(true, false);
//$smarty->assign("T_SECURITY_FEEDS", $feeds);
return true;
}
示例14: getModule
public function getModule()
{
$currentLesson = $this->getCurrentLesson();
$smarty = $this->getSmartyVar();
$smarty->assign("T_LESSON_ID", $currentLesson->lesson['id']);
if (isset($_GET['delete_link']) && eF_checkParameter($_GET['delete_link'], 'id')) {
eF_deleteTableData("module_links", "id=" . $_GET['delete_link']);
$this->setMessageVar(_LINKS_SUCCESFULLYDELETEDLINK, 'success');
eF_redirect("" . $this->moduleBaseUrl . "&message=" . urlencode($message) . "&message_type={$message_type}");
} else {
if (isset($_GET['add_link']) || isset($_GET['edit_link']) && eF_checkParameter($_GET['edit_link'], 'id')) {
$form = new HTML_QuickForm("link_entry_form", "POST", $_SERVER['REQUEST_URI'], "");
$form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
//Register this rule for checking user input with our function, eF_checkParameter
$form->addElement('text', 'display', null);
$form->addElement('text', 'link', null);
$form->addElement('textarea', 'description', null);
$form->addElement('submit', 'submit_link', _SUBMIT, 'class = "flatButton"');
$element =& $form->getElement('display');
$element->setSize(50);
$element =& $form->getElement('link');
$element->setSize(50);
$element =& $form->getElement('description');
$element->setCols(50);
if (isset($_GET['edit_link'])) {
$link_entry = eF_getTableData("module_links", "*", "id=" . $_GET['edit_link']);
$form->setDefaults(array('display' => $link_entry[0]['display'], 'link' => $link_entry[0]['link'], 'description' => $link_entry[0]['description']));
} else {
$form->setDefaults(array('link' => "http://"));
}
if ($form->isSubmitted() && $form->validate()) {
$fields = array('lessons_ID' => $_SESSION['s_lessons_ID'], 'display' => $form->exportValue('display'), 'link' => $form->exportValue('link'), 'description' => $form->exportValue('description'));
if (isset($_GET['edit_link'])) {
if (eF_updateTableData("module_links", $fields, "id=" . $_GET['edit_link'])) {
$message = _LINKS_SUCCESFULLYUPDATEDLINKENTRY;
$message_type = 'success';
eF_redirect("" . $_SERVER['PHP_SELF'] . "?ctg=module&op=module_links&message=" . urlencode($message) . "&message_type={$message_type}");
} else {
$message = _LINKS_PROBLEMUPDATINGLINKENTRY;
$message_type = 'failure';
eF_redirect("" . $_SERVER['PHP_SELF'] . "?ctg=module&op=module_links&message=" . urlencode($message) . "&message_type={$message_type}");
}
} else {
if (eF_insertTableData("module_links", $fields)) {
$message = _LINKS_SUCCESFULLYINSERTEDLINKENTRY;
$message_type = 'success';
eF_redirect("" . $_SERVER['PHP_SELF'] . "?ctg=module&op=module_links&message=" . urlencode($message) . "&message_type={$message_type}");
} else {
$message = _LINKS_PROBLEMINSERTINGLINKENTRY;
$message_type = 'failure';
eF_redirect("" . $_SERVER['PHP_SELF'] . "?ctg=module&op=module_links&message=" . urlencode($message) . "&message_type={$message_type}");
}
}
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$form->accept($renderer);
$smarty->assign('T_LINKS_FORM', $renderer->toArray());
} else {
$links = eF_getTableDataFlat("module_links", "*", "lessons_ID = " . $_SESSION['s_lessons_ID']);
$smarty->assign("T_LINKS", $links);
}
}
return true;
}
示例15: eF_getTableData
}
}
}
if ($currentUnit['options']['complete_unit_setting'] == EfrontUnit::COMPLETION_OPTIONS_ACCEPTTERMSCOMPLETION) {
$accept_term_message = _ACCEPTTERMCOMPLETIONMESSAGE;
if ($accept_term_message) {
$smarty->assign("T_ACCEPT_TERM_COMPLETION_MESSAGE", $accept_term_message);
$res = eF_getTableData("users_to_content", "pending", "users_LOGIN='" . $currentUser->user['login'] . "' and content_ID=" . $currentUnit['id']);
if (sizeof($_POST) > 0) {
try {
if ($_POST['accept_terms'] === 'true') {
$currentUser->setSeenUnit($currentUnit, $currentLesson, true);
echo 'accept';
} elseif ($_POST['accept_terms'] === 'false') {
if (sizeof($res) > 0) {
eF_updateTableData("users_to_content", array('pending' => 1), "users_LOGIN='" . $currentUser->user['login'] . "' and content_ID=" . $currentUnit['id']);
} else {
eF_insertTableData("users_to_content", array("pending" => 1, "users_LOGIN" => $currentUser->user['login'], "content_ID" => $currentUnit['id'], "lessons_ID" => $currentLesson->lesson['id']));
}
}
} catch (Exception $e) {
//handleAjaxExceptions($e);
}
exit;
} elseif (in_array($currentUnit['id'], array_keys($seenContent))) {
$smarty->assign("T_ACCEPT_TERM_COMPLETION_CHECKED", 'accepted');
} elseif ($res[0]['pending']) {
$smarty->assign("T_ACCEPT_TERM_COMPLETION_CHECKED", 'rejected');
}
}
}