Пример #1
0
function uptest()
{
    checkPerm('view', false, 'storage');
    $lang =& DoceboLanguage::createInstance('test');
    if (trim($_POST['title']) == '') {
        $_POST['title'] = $lang->def('_NOTITLE');
    }
    $id_test = importVar('idTest', true, 0);
    $back_url = urldecode(importVar('back_url'));
    $url_encode = htmlentities(urlencode($back_url));
    $mod_query = "\r\n\tUPDATE " . $GLOBALS['prefix_lms'] . "_test\r\n\tSET title = '" . $_POST['title'] . "', \r\n\t\tdescription = '" . $_POST['textof'] . "' \r\n\tWHERE idTest = '" . $id_test . "'";
    if (!sql_query($mod_query)) {
        errorCommunication($lang->def('_OPERATION_FAILURE') . getBackUi('index.php?modname=test&op=modtest&idTest=' . $id_test . '&back_url=' . $url_encode));
        return;
    }
    require_once $GLOBALS['where_lms'] . '/class.module/track.object.php';
    Track_Object::updateObjectTitle($id_test, 'test', $_POST['title']);
    Util::jump_to('index.php?modname=test&op=modtestgui&idTest=' . $id_test . '&back_url=' . $url_encode);
}
Пример #2
0
 function uppage()
 {
     checkPerm('view', false, 'storage');
     $back_url = urldecode($_POST['back_url']);
     $insert_query = "\r\n\tUPDATE " . $GLOBALS['prefix_lms'] . "_htmlpage\r\n\tSET title = '" . (trim($_POST['title']) == '' ? Lang::t('_NOTITLE', 'htmlpage', 'lms') : $_POST['title']) . "',\r\n\t\ttextof = '" . $_POST['textof'] . "'\r\n\tWHERE idPage = '" . (int) $_POST['idPage'] . "'";
     if (!sql_query($insert_query)) {
         $_SESSION['last_error'] = Lang::t('_OPERATION_FAILURE', 'htmlpage', 'lms');
         Util::jump_to($back_url . '&mod_result=0');
     }
     if ($_FILES) {
         $n = 0;
         foreach ($_FILES as $_FILE) {
             $n++;
             $file = save_file($_FILE);
             if ($file) {
                 $insert_query = "INSERT INTO " . $GLOBALS['prefix_lms'] . "_htmlpage_attachment SET file = '" . $file . "', title = '" . trim($_FILE['name']) . "', idpage = " . (int) $_POST['idPage'];
                 sql_query($insert_query);
             }
         }
     }
     if ($_POST['iddelattachment'] != '') {
         $ids = explode(';', $_POST['iddelattachment']);
         foreach ($ids as $id) {
             if ($id) {
                 $query = "DELETE FROM learning_htmlpage_attachment WHERE id = " . $id;
                 mysql_query($query);
             }
         }
     }
     require_once $GLOBALS['where_lms'] . '/class.module/track.object.php';
     Track_Object::updateObjectTitle($_POST['idPage'], 'htmlpage', $_POST['title']);
     Util::jump_to($back_url . '&id_lo=' . $_POST['idPage'] . '&mod_result=1');
 }
Пример #3
0
 function upglossary()
 {
     checkPerm('view', false, 'storage');
     $back_url = urldecode($_POST['back_url']);
     $back_coded = htmlentities(urlencode($back_url));
     if ($_POST['title'] == "") {
         $_POST['title'] = Lang::t('_NOTITLE', 'glossary');
     }
     if (!sql_query("\r\n\tUPDATE " . $GLOBALS['prefix_lms'] . "_glossary \r\n\tSET title='" . $_POST['title'] . "',\r\n\tdescription='" . $_POST['description'] . "'\r\n\tWHERE idGlossary='" . (int) $_POST['idGlossary'] . "'")) {
         //error while inserting
         $GLOBALS['page']->add(getErrorUi(Lang::t('_OPERATION_FAILURE', 'glossary') . getBackUi('index.php?modname=glossary&op=modglossarygui&idGlossary=' . (int) $_POST['idGlossary'] . '&back_url=' . $back_coded, Lang::t('_BACK'))), 'content');
         return;
     }
     require_once $GLOBALS['where_lms'] . '/class.module/track.object.php';
     Track_Object::updateObjectTitle($_POST['idGlossary'], 'glossary', $_POST['title']);
     Util::jump_to('index.php?modname=glossary&op=modglossarygui&idGlossary=' . (int) $_POST['idGlossary'] . '&back_url=' . $back_coded);
 }
Пример #4
0
 function uplinkcat()
 {
     checkPerm('view', false, 'storage');
     $lang =& DoceboLanguage::createInstance('link');
     $back_url = urldecode(importVar('back_url'));
     $back_coded = htmlentities(urlencode($back_url));
     $query_ins = "\r\n\tUPDATE " . $GLOBALS['prefix_lms'] . "_link_cat\r\n\tSET title = '" . (trim($_POST['title']) == '' ? $lang->def('_NOTITLE') : $_POST['title']) . "',\r\n\t\tdescription = '" . $_POST['description'] . "' \r\n\tWHERE idCategory = '" . (int) $_POST['idCategory'] . "'";
     if (!sql_query($query_ins)) {
         $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE') . getBackUi('index.php?modname=link&op=modlinkgui&idCategory=' . (int) $_POST['idCategory'] . '&back_url=' . $back_coded, $lang->def('_BACK'))), 'content');
         return;
     }
     require_once $GLOBALS['where_lms'] . '/class.module/track.object.php';
     Track_Object::updateObjectTitle($_POST['idCategory'], 'link', $_POST['title']);
     Util::jump_to('index.php?modname=link&op=modlinkgui&idCategory=' . (int) $_POST['idCategory'] . '&back_url=' . $back_coded);
 }
Пример #5
0
 function upitem()
 {
     //checkPerm('view', false, 'storage');
     require_once _base_ . '/lib/lib.upload.php';
     $back_url = urldecode($_POST['back_url']);
     //scanning title
     if (trim($_POST['title']) == "") {
         $_POST['title'] = Lang::t('_NOTITLE', 'item', 'lms');
     }
     //save file
     if ($_FILES['attach']['name'] != '') {
         $path = '/appLms/' . Get::sett('pathlesson');
         // retrive and delte ld file --------------------------------------------------
         list($old_file) = sql_fetch_row(sql_query("\r\n\t\tSELECT path \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_materials_lesson \r\n\t\tWHERE idLesson = '" . (int) $_POST['idItem'] . "'"));
         $size = Get::file_size($GLOBALS['where_files_relative'] . $path . $old_file);
         if (!sl_unlink($path . $old_file)) {
             sl_close_fileoperations();
             $_SESSION['last_error'] = Lang::t('_OPERATION_FAILURE', 'item', 'lms');
             Util::jump_to($back_url . '&id_lo=' . (int) $_POST['idItem'] . '&mod_result=0');
         }
         $GLOBALS['course_descriptor']->subFileToUsedSpace(false, $size);
         // control course quota ---------------------------------------------------
         $quota = $GLOBALS['course_descriptor']->getQuotaLimit();
         $used = $GLOBALS['course_descriptor']->getUsedSpace();
         if (Util::exceed_quota($_FILES['attach']['tmp_name'], $quota, $used)) {
             $_SESSION['last_error'] = Lang::t('_QUOTA_EXCEDED');
             Util::jump_to($back_url . '&create_result=0');
         }
         // save new file ------------------------------------------------------------
         sl_open_fileoperations();
         $savefile = $_SESSION['idCourse'] . '_' . mt_rand(0, 100) . '_' . time() . '_' . $_FILES['attach']['name'];
         if (!file_exists($GLOBALS['where_files_relative'] . $path . $savefile)) {
             if (!sl_upload($_FILES['attach']['tmp_name'], $path . $savefile)) {
                 sl_close_fileoperations();
                 $_SESSION['last_error'] = Lang::t('_ERROR_UPLOAD', 'item', 'lms');
                 Util::jump_to($back_url . '&id_lo=' . (int) $_POST['idItem'] . '&mod_result=0');
             }
             sl_close_fileoperations();
         } else {
             $_SESSION['last_error'] = Lang::t('_ERROR_UPLOAD', 'item', 'lms');
             Util::jump_to($back_url . '&id_lo=' . (int) $_POST['idItem'] . '&mod_result=0');
         }
         $new_file = ", path = '" . $savefile . "'";
     }
     $insert_query = "\r\n\tUPDATE " . $GLOBALS['prefix_lms'] . "_materials_lesson \r\n\tSET author = '" . getLogUserId() . "',\r\n\t\ttitle = '" . $_POST['title'] . "',\r\n\t\tdescription = '" . $_POST['description'] . "'\r\n\t\t{$new_file}\r\n\tWHERE idLesson = '" . (int) $_POST['idItem'] . "'";
     if (!sql_query($insert_query)) {
         sl_unlink($path . $savefile);
         $_SESSION['last_error'] = Lang::t('_OPERATION_FAILURE', 'item', 'lms');
         Util::jump_to($back_url . '&id_lo=' . (int) $_POST['idItem'] . '&mod_result=0');
     }
     if (isset($_SESSION['idCourse']) && defined("LMS")) {
         $GLOBALS['course_descriptor']->addFileToUsedSpace($GLOBALS['where_files_relative'] . $path . $savefile);
         require_once $GLOBALS['where_lms'] . '/class.module/track.object.php';
         Track_Object::updateObjectTitle($_POST['idItem'], 'item', $_POST['title']);
     }
     Util::jump_to($back_url . '&id_lo=' . (int) $_POST['idItem'] . '&mod_result=1');
 }
Пример #6
0
 function upfaqcat()
 {
     checkPerm('view', false, 'storage');
     $back_url = urldecode(importVar('back_url'));
     $back_coded = htmlentities(urlencode($back_url));
     $query_ins = "\r\n\tUPDATE " . $GLOBALS['prefix_lms'] . "_faq_cat\r\n\tSET title = '" . (trim($_POST['title']) == '' ? Lang::t('_NOTITLE', 'faq') : $_POST['title']) . "',\r\n\t\tdescription = '" . $_POST['description'] . "' \r\n\tWHERE idCategory = '" . (int) $_POST['idCategory'] . "'";
     if (!sql_query($query_ins)) {
         $GLOBALS['page']->add(getBackUi(def('_OPERATION_FAILURECAT', 'faq', 'lms') . getBackUi('index.php?modname=faq&op=modfaqgui&idCategory=' . (int) $_POST['idCategory'] . '&back_url=' . $back_coded, Lang::t('_BACK', 'faq', 'lms'))), 'content');
         return;
     }
     require_once $GLOBALS['where_lms'] . '/class.module/track.object.php';
     Track_Object::updateObjectTitle($_POST['idCategory'], 'faq', trim($_POST['title']) == '' ? Lang::t('_NOTITLE', 'faq') : $_POST['title']);
     Util::jump_to('index.php?modname=faq&op=modfaqgui&idCategory=' . (int) $_POST['idCategory'] . '&back_url=' . $back_coded);
 }