/** * Draws the menu to edit a menu item */ function _EDIT() { global $id; if (!$id) { $cid = josGetArrayInts('cid'); $id = $cid[0]; } $menutype = strval(mosGetParam($_REQUEST, 'menutype', 'mainmenu')); mosMenuBar::startTable(); if (!$id) { $link = 'index2.php?option=com_menus&menutype=' . $menutype . '&task=new&hidemainmenu=1&' . josSpoofValue() . '=1'; mosMenuBar::back('Back', $link); mosMenuBar::spacer(); } mosMenuBar::save(); mosMenuBar::spacer(); mosMenuBar::apply(); mosMenuBar::spacer(); if ($id) { // for existing content items the button is renamed `close` mosMenuBar::cancel('cancel', 'Close'); } else { mosMenuBar::cancel(); } mosMenuBar::spacer(); mosMenuBar::help('screen.menus.edit'); mosMenuBar::endTable(); }
function saveMenu($option, $task) { global $database; $params = mosGetParam($_POST, 'params', ''); $secids = josGetArrayInts('secid'); $secid = implode(',', $secids); $params['sectionid'] = $secid; if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['params'] = mosParameters::textareaHandling($txt); } $row = new mosMenu($database); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (count($secids) == 1 && $secids[0] != '') { $row->link = str_replace('id=0', 'id=' . $secids[0], $row->link); $row->componentid = $secids[0]; } if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->checkin(); $row->updateOrder("menutype = " . $database->Quote($row->menutype) . " AND parent = " . (int) $row->parent); $msg = 'Iten de menu salvo'; switch ($task) { case 'apply': mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype . '&task=edit&id=' . $row->id, $msg); break; case 'save': default: mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype, $msg); break; } }
* Joomla! is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ // no direct access defined('_VALID_MOS') or die('Restricted access'); // ensure user has access to this function if (!$acl->acl_check('administration', 'manage', 'users', $my->usertype, 'components', 'com_trash')) { mosRedirect('index2.php', _NOT_AUTH); } require_once $mainframe->getPath('admin_html'); require_once $mainframe->getPath('class', 'com_frontpage'); $mid = josGetArrayInts('mid'); $cid = josGetArrayInts('cid'); switch ($task) { case 'deleteconfirm': viewdeleteTrash($cid, $mid, $option); break; case 'delete': deleteTrash($cid, $option); break; case 'restoreconfirm': viewrestoreTrash($cid, $mid, $option); break; case 'restore': restoreTrash($cid, $option); break; default: viewTrash($option);
function saveOrder(&$cid) { global $database; josSpoofCheck(); $total = count($cid); $order = josGetArrayInts('order'); $row = new mosContent($database); $conditions = array(); // update ordering values for ($i = 0; $i < $total; $i++) { $row->load((int) $cid[$i]); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // if // remember to updateOrder this group $condition = "catid=" . (int) $row->catid . " AND state >= 0"; $found = false; foreach ($conditions as $cond) { if ($cond[1] == $condition) { $found = true; break; } } // if if (!$found) { $conditions[] = array($row->id, $condition); } } // if } // for // execute updateOrder for each group foreach ($conditions as $cond) { $row->load($cond[0]); $row->updateOrder($cond[1]); } // foreach // clean any existing cache files mosCache::cleanCache('com_content'); $msg = 'New ordering saved'; mosRedirect('index2.php?option=com_typedcontent', $msg); }
<?php /** * joomla_lms.conference.php * (c) JoomaLMS eLearning Software http://www.joomlalms.com/ **/ // no direct access defined('_JLMS_EXEC') or die('Restricted access'); $course_id = intval(mosGetParam($_REQUEST, 'course_id', 0)); $task = mosGetParam($_REQUEST, 'task', ''); $mode = mosGetParam($_REQUEST, 'mode', ''); $cid = josGetArrayInts('cid', $_POST); if (!is_array($cid)) { $cid = array(0); } require_once _JOOMLMS_FRONT_HOME . "/joomla_lms.conference.html.php"; //otrisovivaem head menu if ($mode != 'conference_room' && $mode != 'upload_popup' && $mode != 'conference_playback' && $mode != 'params' && $mode != 'save_period' && $mode != 'display_file') { global $JLMS_CONFIG; $course_id = $JLMS_CONFIG->get('course_id', 0); $pathway = array(); $pathway[] = array('name' => _JLMS_PATHWAY_HOME, 'link' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}"), 'is_home' => true); $pathway[] = array('name' => $JLMS_CONFIG->get('course_name'), 'link' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=details_course&id={$course_id}"), 'is_course' => true); $pathway[] = array('name' => _JLMS_TOOLBAR_CONF, 'link' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=conference&id={$course_id}")); JLMSAppendPathWay($pathway); JLMS_ShowHeading(); } switch ($task) { case 'conference': JLMS_show_conference($course_id, $option, $mode); break;
function saveTemplateAssign($option, $client) { global $database; josSpoofCheck(); $menus = josGetArrayInts('selections'); $template = stripslashes(strval(mosGetParam($_POST, 'template', ''))); $query = "DELETE FROM #__templates_menu" . "\n WHERE client_id = 0" . "\n AND template = " . $database->Quote($template) . "\n AND menuid != 0"; $database->setQuery($query); $database->query(); if (!in_array('', $menus)) { foreach ($menus as $menuid) { $menuid = (int) $menuid; // If 'None' is not in array if ($menuid != -999) { // check if there is already a template assigned to this menu item $query = "DELETE FROM #__templates_menu" . "\n WHERE client_id = 0" . "\n AND menuid = " . (int) $menuid; $database->setQuery($query); $database->query(); $query = "INSERT INTO #__templates_menu" . "\n SET client_id = 0, template = " . $database->Quote($template) . ", menuid = " . (int) $menuid; $database->setQuery($query); $database->query(); } } } mosRedirect('index2.php?option=' . $option . '&client=' . $client); }
function JLMS_saveCertificate($course_id, $option, $crtf_type, $redirect_url = '') { global $my, $JLMS_DB, $Itemid; $JLMS_ACL =& JLMSFactory::getACL(); $crtf_id = 0; /*echo '<pre>'; print_r($_REQUEST);*/ if ($course_id && $JLMS_ACL->CheckPermissions('docs', 'view')) { $crtf_name = isset($_REQUEST['crtf_name']) ? $_REQUEST['crtf_name'] : ''; $crtf_name = get_magic_quotes_gpc() ? stripslashes($crtf_name) : $crtf_name; $crtf_name = ampReplace(strip_tags($crtf_name)); $crtf_name = $JLMS_DB->GetEscaped($crtf_name); $crtf_text = isset($_REQUEST['crtf_text']) ? $_REQUEST['crtf_text'] : ''; $crtf_text = get_magic_quotes_gpc() ? stripslashes($crtf_text) : $crtf_text; $crtf_text = ampReplace(strip_tags($crtf_text)); $crtf_text = $JLMS_DB->GetEscaped($crtf_text); $crtf_align = intval(mosGetParam($_REQUEST, 'crtf_align', 0)); $published = intval(mosGetParam($_REQUEST, 'published', 1)); $crtf_shadow = intval(mosGetParam($_REQUEST, 'crtf_shadow', 0)); $crtf_font = strval(mosGetParam($_REQUEST, 'crtf_font', 0)); if (!preg_match("/^[a-zA-Z0-9\\-\\_\\s]+\\.ttf\$/", $crtf_font)) { $crtf_font = 'arial.ttf'; } if ($crtf_shadow) { $crtf_shadow = 1; } if (!in_array($crtf_align, array(0, 1, 2))) { $crtf_align = 0; } $text_x = intval(mosGetParam($_REQUEST, 'text_x', 0)); $text_y = intval(mosGetParam($_REQUEST, 'text_y', 0)); $text_size = intval(mosGetParam($_REQUEST, 'text_size', 0)); $new_file = false; $file_id = 0; if (isset($_FILES['userfile']) && !empty($_FILES['userfile']['name'])) { $file_id = JLMS_uploadFile($course_id); $new_file = true; } $add_query = ''; $crtf_id = 0; if ($crtf_type == 2) { $crtf_id = intval(mosGetParam($_REQUEST, 'crtf_id', 0)); $add_query = " AND id = '" . $crtf_id . "'"; } $query = "SELECT * FROM #__lms_certificates WHERE course_id = '" . $course_id . "' AND crtf_type = '" . $crtf_type . "' AND parent_id = 0" . $add_query; $JLMS_DB->SetQuery($query); $old_crt = $JLMS_DB->LoadObjectList(); if (count($old_crt)) { $old_file = $old_crt[0]->file_id; if ($old_file && $new_file) { $files = array(); $files[] = $old_file; JLMS_deleteFiles($files); } $crtf_id = $old_crt[0]->id; $query = "UPDATE #__lms_certificates SET published = {$published}, crtf_name = '" . $crtf_name . "', crtf_text = '" . $crtf_text . "', crtf_align = {$crtf_align}, crtf_shadow = {$crtf_shadow}, text_x = '" . $text_x . "', text_y = '" . $text_y . "', text_size = '" . $text_size . "', crtf_font = " . $JLMS_DB->quote($crtf_font) . "" . ($new_file ? ", file_id = '" . $file_id . "'" : '') . " WHERE course_id = '" . $course_id . "' AND crtf_type = '" . $crtf_type . "' AND parent_id = 0" . $add_query; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); } else { $query = "INSERT INTO #__lms_certificates (parent_id, course_id, published, crtf_name, crtf_text, crtf_align, crtf_shadow, text_x, text_y, text_size" . ($new_file ? ", file_id" : '') . ", crtf_type, crtf_font) VALUES ( 0, '" . $course_id . "', '" . $published . "', '" . $crtf_name . "', '" . $crtf_text . "', {$crtf_align}, {$crtf_shadow}, '" . $text_x . "', '" . $text_y . "', '" . $text_size . "'" . ($new_file ? ",'" . $file_id . "'" : '') . ", '" . $crtf_type . "', " . $JLMS_DB->quote($crtf_font) . ")"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); $crtf_id = $JLMS_DB->insertid(); } $crtf_id = intval($crtf_id); /* 23 october 2007 - (DEN) */ /* handle custom text fields */ $ctxt_mes_ids = josGetArrayInts('ctxt_mes_id', $_REQUEST); $ctxt_mes_text = isset($_REQUEST['ctxt_mes_text']) ? $_REQUEST['ctxt_mes_text'] : array(); $ctxt_mes_shadow_hid = mosGetParam($_REQUEST, 'ctxt_mes_shadow_hid', array()); $ctxt_mes_x = mosGetParam($_REQUEST, 'ctxt_mes_x', array()); $ctxt_mes_y = mosGetParam($_REQUEST, 'ctxt_mes_y', array()); $ctxt_mes_h = mosGetParam($_REQUEST, 'ctxt_mes_h', array()); $ctxt_mes_font = mosGetParam($_REQUEST, 'ctxt_mes_font', array()); $p_ids = array(); $i = 0; $add_cmes_ids = array(); /*print_r($ctxt_mes_ids);*/ foreach ($ctxt_mes_ids as $cmid) { if (isset($ctxt_mes_text[$i]) && isset($ctxt_mes_x[$i]) && isset($ctxt_mes_y[$i]) && isset($ctxt_mes_h[$i]) && isset($ctxt_mes_font[$i]) && isset($ctxt_mes_shadow_hid[$i]) && $ctxt_mes_text[$i]) { $crtf_shadow = $ctxt_mes_shadow_hid[$i] ? 1 : 0; $crtf_font = ''; $text_x = intval($ctxt_mes_x[$i]); if ($text_x < 0) { $text_x = 0; } $text_y = intval($ctxt_mes_y[$i]); if ($text_y < 0) { $text_y = 0; } $text_size = intval($ctxt_mes_h[$i]); if ($text_size < 0) { $text_size = 0; } $crtf_text = $ctxt_mes_text[$i]; $crtf_text = get_magic_quotes_gpc() ? stripslashes($crtf_text) : $crtf_text; $crtf_text = ampReplace(strip_tags($crtf_text)); $crtf_text = $JLMS_DB->GetEscaped($crtf_text); $crtf_font = strval($ctxt_mes_font[$i]); if (!preg_match("/^[a-zA-Z0-9\\-\\_\\s]+\\.ttf\$/", $crtf_font)) { $crtf_font = 'arial.ttf'; } if (!$cmid) { $query = "INSERT INTO #__lms_certificates (parent_id, course_id, crtf_name, crtf_text, crtf_align, crtf_shadow, text_x, text_y, text_size, crtf_type, crtf_font) VALUES ( {$crtf_id}, '" . $course_id . "', '', '" . $crtf_text . "', " . $i . ", {$crtf_shadow}, '" . $text_x . "', '" . $text_y . "', '" . $text_size . "', '-2', " . $JLMS_DB->quote($crtf_font) . ")"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); $crtf_cmes_id = $JLMS_DB->insertid(); /*echo $JLMS_DB->geterrormsg();*/ $add_cmes_ids[] = $crtf_cmes_id; } else { $query = "UPDATE #__lms_certificates SET crtf_text = '" . $crtf_text . "', crtf_align = {$i}, crtf_shadow = {$crtf_shadow}, text_x = '" . $text_x . "', text_y = '" . $text_y . "', text_size = '" . $text_size . "', crtf_font = " . $JLMS_DB->quote($crtf_font) . " WHERE course_id = '" . $course_id . "' AND crtf_type = '-2' AND parent_id = {$crtf_id} AND id = {$cmid}"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); $add_cmes_ids[] = $cmid; } } $i++; } if (empty($add_cmes_ids)) { $add_cmes_ids = array(0); } /*print_r($add_cmes_ids);*/ $add_cmes_ids_t = implode(',', $add_cmes_ids); $query = "DELETE FROM #__lms_certificates WHERE course_id = {$course_id} AND parent_id = {$crtf_id} AND crtf_type = '-2' AND id NOT IN ({$add_cmes_ids_t})"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); /*die;*/ /* end of 'custom text fields' mod */ if ($crtf_id) { $JLMS_ACL =& JLMSFactory::getACL(); $lroles = $JLMS_ACL->GetSystemRolesIds(1); $add_certificates = josGetArrayInts('certificate_types', $_REQUEST); $types = array(); if (!empty($add_certificates)) { foreach ($add_certificates as $add_cert) { if ($add_cert && in_array($add_cert, $lroles)) { $certificate_default = intval(mosGetParam($_REQUEST, 'certificate_default_' . $add_cert, 0)); if (!$certificate_default) { $crtf_text = isset($_REQUEST['crtf_text_' . $add_cert]) ? $_REQUEST['crtf_text_' . $add_cert] : ''; $crtf_text = get_magic_quotes_gpc() ? stripslashes($crtf_text) : $crtf_text; $crtf_text = ampReplace(strip_tags($crtf_text)); $crtf_text = $JLMS_DB->GetEscaped($crtf_text); $crtf_align = intval(mosGetParam($_REQUEST, 'crtf_align_' . $add_cert, 0)); $crtf_shadow = intval(mosGetParam($_REQUEST, 'crtf_shadow_' . $add_cert, 0)); $crtf_font = strval(mosGetParam($_REQUEST, 'crtf_font_' . $add_cert, 0)); if (!preg_match("/^[a-zA-Z0-9\\-\\_\\s]+\\.ttf\$/", $crtf_font)) { $crtf_font = 'arial.ttf'; } if ($crtf_shadow) { $crtf_shadow = 1; } if (!in_array($crtf_align, array(0, 1, 2))) { $crtf_align = 0; } $text_x = intval(mosGetParam($_REQUEST, 'text_x_' . $add_cert, 0)); $text_y = intval(mosGetParam($_REQUEST, 'text_y_' . $add_cert, 0)); $text_size = intval(mosGetParam($_REQUEST, 'text_size_' . $add_cert, 0)); $new_file = false; $file_id = 0; if (isset($_FILES['userfile_' . $add_cert]) && !empty($_FILES['userfile_' . $add_cert]['name'])) { $file_id = JLMS_uploadFile($course_id, 'userfile_' . $add_cert); $new_file = true; } $query = "SELECT * FROM #__lms_certificates WHERE course_id = '" . $course_id . "' AND crtf_type = '" . $add_cert . "' AND parent_id = {$crtf_id}"; $JLMS_DB->SetQuery($query); $old_crt = $JLMS_DB->LoadObjectList(); if (count($old_crt)) { $old_file = $old_crt[0]->file_id; if ($old_file && $new_file) { $files = array(); $files[] = $old_file; JLMS_deleteFiles($files); } $crtf_id_c = $old_crt[0]->id; $query = "UPDATE #__lms_certificates SET crtf_name = '" . $crtf_name . "', crtf_text = '" . $crtf_text . "', crtf_align = {$crtf_align}, crtf_shadow = {$crtf_shadow}, text_x = '" . $text_x . "', text_y = '" . $text_y . "', text_size = '" . $text_size . "', crtf_font = " . $JLMS_DB->quote($crtf_font) . "" . ($new_file ? ", file_id = '" . $file_id . "'" : '') . " WHERE course_id = '" . $course_id . "' AND crtf_type = '" . $add_cert . "' AND parent_id = {$crtf_id}"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); } else { $query = "INSERT INTO #__lms_certificates (parent_id, course_id, crtf_name, crtf_text, crtf_align, crtf_shadow, text_x, text_y, text_size" . ($new_file ? ", file_id" : '') . ", crtf_type, crtf_font) VALUES ( {$crtf_id}, '" . $course_id . "', '" . $crtf_name . "', '" . $crtf_text . "', {$crtf_align}, {$crtf_shadow}, '" . $text_x . "', '" . $text_y . "', '" . $text_size . "'" . ($new_file ? ",'" . $file_id . "'" : '') . ", '" . $add_cert . "', " . $JLMS_DB->quote($crtf_font) . ")"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); $crtf_id_c = $JLMS_DB->insertid(); } /* 23 october 2007 - (DEN) */ /* handle custom text fields */ $ctxt_mes_ids = josGetArrayInts('ctxt_mes_id_' . $add_cert, $_REQUEST); $ctxt_mes_text = isset($_REQUEST['ctxt_mes_text_' . $add_cert]) ? $_REQUEST['ctxt_mes_text_' . $add_cert] : array(); $ctxt_mes_shadow_hid = mosGetParam($_REQUEST, 'ctxt_mes_shadow_hid_' . $add_cert, array()); $ctxt_mes_x = mosGetParam($_REQUEST, 'ctxt_mes_x_' . $add_cert, array()); $ctxt_mes_y = mosGetParam($_REQUEST, 'ctxt_mes_y_' . $add_cert, array()); $ctxt_mes_h = mosGetParam($_REQUEST, 'ctxt_mes_h_' . $add_cert, array()); $ctxt_mes_font = mosGetParam($_REQUEST, 'ctxt_mes_font_' . $add_cert, array()); $p_ids = array(); $i = 0; $add_cmes_ids = array(); foreach ($ctxt_mes_ids as $cmid) { if (isset($ctxt_mes_text[$i]) && isset($ctxt_mes_x[$i]) && isset($ctxt_mes_y[$i]) && isset($ctxt_mes_h[$i]) && isset($ctxt_mes_font[$i]) && isset($ctxt_mes_shadow_hid[$i]) && $ctxt_mes_text[$i]) { $crtf_shadow = $ctxt_mes_shadow_hid[$i] ? 1 : 0; $crtf_font = ''; $text_x = intval($ctxt_mes_x[$i]); if ($text_x < 0) { $text_x = 0; } $text_y = intval($ctxt_mes_y[$i]); if ($text_y < 0) { $text_y = 0; } $text_size = intval($ctxt_mes_h[$i]); if ($text_size < 0) { $text_size = 0; } $crtf_text = $ctxt_mes_text[$i]; $crtf_text = get_magic_quotes_gpc() ? stripslashes($crtf_text) : $crtf_text; $crtf_text = ampReplace(strip_tags($crtf_text)); $crtf_text = $JLMS_DB->GetEscaped($crtf_text); $crtf_font = strval($ctxt_mes_font[$i]); if (!preg_match("/^[a-zA-Z0-9\\-\\_\\s]+\\.ttf\$/", $crtf_font)) { $crtf_font = 'arial.ttf'; } if (!$cmid) { $query = "INSERT INTO #__lms_certificates (parent_id, course_id, crtf_name, crtf_text, crtf_align, crtf_shadow, text_x, text_y, text_size, crtf_type, crtf_font) VALUES ( {$crtf_id_c}, '" . $course_id . "', '', '" . $crtf_text . "', " . $i . ", {$crtf_shadow}, '" . $text_x . "', '" . $text_y . "', '" . $text_size . "', '-2', " . $JLMS_DB->quote($crtf_font) . ")"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); $crtf_cmes_id = $JLMS_DB->insertid(); $add_cmes_ids[] = $crtf_cmes_id; } else { $query = "UPDATE #__lms_certificates SET crtf_text = '" . $crtf_text . "', crtf_align = {$i}, crtf_shadow = {$crtf_shadow}, text_x = '" . $text_x . "', text_y = '" . $text_y . "', text_size = '" . $text_size . "', crtf_font = " . $JLMS_DB->quote($crtf_font) . " WHERE course_id = '" . $course_id . "' AND crtf_type = '-2' AND parent_id = {$crtf_id_c} AND id = {$cmid}"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); $add_cmes_ids[] = $cmid; } } $i++; } if (empty($add_cmes_ids)) { $add_cmes_ids = array(0); } $add_cmes_ids_t = implode(',', $add_cmes_ids); $query = "DELETE FROM #__lms_certificates WHERE course_id = {$course_id} AND parent_id = {$crtf_id_c} AND crtf_type = '-2' AND id NOT IN ({$add_cmes_ids_t})"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); /* end of 'custom text fields' mod */ $types[] = $add_cert; } } } } if (empty($types)) { $types = array(-2); } else { $types[] = -2; } /*print_r($types);*/ $types_str = implode(',', $types); $query = "SELECT id, file_id FROM #__lms_certificates WHERE course_id = '" . $course_id . "' AND crtf_type NOT IN ({$types_str}) AND parent_id = {$crtf_id}"; $JLMS_DB->SetQuery($query); $old_sec_certs = $JLMS_DB->LoadObjectList(); $old_files = array(); $old_sec_cert_ids = array(); if (!empty($old_sec_certs)) { foreach ($old_sec_certs as $osc) { $old_files[] = $osc->file_id; $old_sec_cert_ids[] = $osc->id; } JLMS_deleteFiles($old_files); } $query = "DELETE FROM #__lms_certificates WHERE course_id = '" . $course_id . "' AND crtf_type NOT IN ({$types_str}) AND parent_id = {$crtf_id}"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); if (!empty($old_sec_cert_ids)) { $osc_t = implode(',', $old_sec_cert_ids); $query = "DELETE FROM #__lms_certificates WHERE course_id = '" . $course_id . "' AND crtf_type = '-2' AND parent_id IN ({$osc_t})"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); } } } /*die;*/ if (!$redirect_url) { $redirect_url = "index.php?option={$option}&Itemid={$Itemid}&task=gb_certificates&id={$course_id}"; } JLMSRedirect(sefRelToAbs(str_replace('{id}', $crtf_id, $redirect_url))); }
function saveOrder(&$cid) { global $database; josSpoofCheck(); $total = count($cid); $order = josGetArrayInts('order'); for ($i = 0; $i < $total; $i++) { $query = "UPDATE #__content_frontpage" . "\n SET ordering = " . (int) $order[$i] . "\n WHERE content_id = " . (int) $cid[$i]; $database->setQuery($query); if (!$database->query()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // update ordering $row = new mosFrontPage($database); $row->load((int) $cid[$i]); $row->updateOrder(); } // clean any existing cache files mosCache::cleanCache('com_content'); $msg = 'New ordering saved'; mosRedirect('index2.php?option=com_frontpage', $msg); }
function saveOrder(&$cid, $client) { global $database; josSpoofCheck(); $total = count($cid); $order = josGetArrayInts('order'); $row = new mosModule($database); $conditions = array(); // update ordering values for ($i = 0; $i < $total; $i++) { $row->load((int) $cid[$i]); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // if // remember to updateOrder this group $condition = "position = " . $database->Quote($row->position) . " AND client_id = " . (int) $row->client_id; $found = false; foreach ($conditions as $cond) { if ($cond[1] == $condition) { $found = true; break; } } // if if (!$found) { $conditions[] = array($row->id, $condition); } } // if } // for // execute updateOrder for each group foreach ($conditions as $cond) { $row->load($cond[0]); $row->updateOrder($cond[1]); } // foreach mosCache::cleanCache('com_content'); $msg = 'Nova ordenação salva'; mosRedirect('index2.php?option=com_modules&client=' . $client, $msg); }
function saveOrder(&$cid, $menutype) { global $database; josSpoofCheck(); $total = count($cid); $order = josGetArrayInts('order'); $row = new mosMenu($database); $conditions = array(); // update ordering values for ($i = 0; $i < $total; $i++) { $row->load((int) $cid[$i]); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // remember to updateOrder this group $condition = "menutype = " . $database->Quote($menutype) . " AND parent = " . (int) $row->parent . " AND published >= 0"; $found = false; foreach ($conditions as $cond) { if ($cond[1] == $condition) { $found = true; break; } } if (!$found) { $conditions[] = array($row->id, $condition); } } } // execute updateOrder for each group foreach ($conditions as $cond) { $row->load($cond[0]); $row->updateOrder($cond[1]); } // clean any existing cache files mosCache::cleanCache('com_content'); $msg = 'Nova ordenação salva'; mosRedirect('index2.php?option=com_menus&menutype=' . $menutype, $msg); }
/** * Copies a complete menu, all its items and creates a new module, using the name speified */ function copyMenu($option, $cid, $type) { global $database; josSpoofCheck(); $menu_name = stripslashes(strval(mosGetParam($_POST, 'menu_name', 'New Menu'))); $module_name = stripslashes(strval(mosGetParam($_POST, 'module_name', 'New Module'))); // check for unique menutype for new menu copy $query = "SELECT params" . "\n FROM #__modules" . "\n WHERE module = 'mod_mainmenu'"; $database->setQuery($query); $menus = $database->loadResultArray(); foreach ($menus as $menu) { $params = mosParseParams($menu); if ($params->menutype == $menu_name) { echo "<script> alert('A menu already exists with that name - you must enter a unique Menu Name'); window.history.go(-1); </script>\n"; exit; } } // copy the menu items $mids = josGetArrayInts('mids'); $total = count($mids); $copy = new mosMenu($database); $original = new mosMenu($database); sort($mids); $a_ids = array(); foreach ($mids as $mid) { $original->load($mid); $copy = $original; $copy->id = NULL; $copy->parent = $a_ids[$original->parent]; $copy->menutype = $menu_name; if (!$copy->check()) { echo "<script> alert('" . $copy->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$copy->store()) { echo "<script> alert('" . $copy->getError() . "'); window.history.go(-1); </script>\n"; exit; } $a_ids[$original->id] = $copy->id; } // create the module copy $row = new mosModule($database); $row->load(0); $row->title = $module_name; $row->iscore = 0; $row->published = 1; $row->position = 'left'; $row->module = 'mod_mainmenu'; $row->params = 'menutype=' . $menu_name; if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->checkin(); $row->updateOrder('position=' . $database->Quote($row->position)); // module assigned to show on All pages by default // ToDO: Changed to become a Joomla! db-object $query = "INSERT INTO #__modules_menu VALUES ( " . (int) $row->id . ", 0 )"; $database->setQuery($query); if (!$database->query()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // clean any existing cache files mosCache::cleanCache('com_content'); $msg = 'Copy of Menu `' . $type . '` created, consisting of ' . $total . ' items'; mosRedirect('index2.php?option=' . $option, $msg); }
function ALF_saveItem($id, $option, $page) { $db =& JFactory::getDbo(); $row = new JLMS_forum_item($db); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $msg = ''; $forum_type = intval(mosGetParam($_REQUEST, 'forum_type', 0)); $forum_moderators_str = strval(mosGetParam($_REQUEST, 'forum_moderators', '')); $moderators_ids_pre = array(); if ($forum_moderators_str) { $forum_moderators = explode(',', $forum_moderators_str); $f_mods = ''; foreach ($forum_moderators as $fm) { $fm = intval($fm); if ($fm && !in_array($fm, $moderators_ids_pre)) { $moderators_ids_pre[] = $fm; } } if (!empty($moderators_ids_pre)) { $moderators_ids_str = implode(',', $moderators_ids_pre); $query = "SELECT distinct id FROM #__users WHERE id IN ({$moderators_ids_str})"; $db->SetQuery($query); $mds = $db->LoadResultArray(); if (!empty($mds)) { $f_mods = implode(',', $mds); } } $row->forum_moderators = $f_mods; } if ($forum_type == 1) { $row->forum_level = 1; $row->user_level = 0; } elseif ($forum_type == 2) { $row->forum_level = 0; $row->user_level = 1; } elseif ($forum_type == 3) { $row->forum_level = 0; $row->user_level = 2; } else { $row->forum_level = 0; $row->user_level = 0; } if ($row->forum_access) { $forum_permissions = josGetArrayInts('forum_permissions', $_REQUEST); if (empty($forum_permissions)) { $row->forum_permissions = ''; } else { $row->forum_permissions = implode(',', $forum_permissions); } } else { $row->forum_permissions = ''; } if ($row->parent_forum) { $query = "SELECT parent_forum, user_level, forum_level FROM #__lms_forums WHERE id = {$row->parent_forum}"; $db->SetQuery($query); $parent = $db->LoadObject(); if (is_object($parent)) { if ($parent->parent_forum) { $row->parent_forum = 0; } elseif ($parent->forum_level && $row->forum_level != $parent->forum_level) { $row->parent_forum = 0; } elseif ($parent->user_level && $row->user_level != $parent->user_level) { $row->parent_forum = 0; } } else { $row->parent_forum = 0; } } $forum_name_post = isset($_REQUEST['forum_name']) ? strval($_REQUEST['forum_name']) : ''; $forum_name_post = get_magic_quotes_gpc() ? stripslashes($forum_name_post) : $forum_name_post; $row->forum_name = $forum_name_post; $forum_desc_post = isset($_REQUEST['forum_desc']) ? strval($_REQUEST['forum_desc']) : ''; $forum_desc_post = get_magic_quotes_gpc() ? stripslashes($forum_desc_post) : $forum_desc_post; $row->forum_desc = $forum_desc_post; if ($row->id) { $old_id = $row->id; $old_row = new JLMS_forum_item($db); $old_row->load($old_id); if ($old_row->forum_level != $row->forum_level || $old_row->user_level != $row->user_level) { $row->forum_level = $old_row->forum_level; $row->user_level = $old_row->user_level; $msg = "You cannot change type of the forum board.<br />"; } if ($old_row->forum_name != $row->forum_name || $old_row->forum_desc != $row->forum_desc || $old_row->forum_moderators != $row->forum_moderators || $old_row->moderated != $row->moderated) { $query = "UPDATE #__lms_forum_details SET need_update = 1 WHERE board_type = " . intval($row->id); $db->SetQuery($query); $db->query(); } //TODO: // 1) implement `old_moderators` functionality ????? } if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if ($page == 'apply') { mosRedirect("index.php?option=com_joomla_lms&task=lms_forums&page=editA&id={$id}", $msg); } else { mosRedirect("index.php?option=com_joomla_lms&task=lms_forums", $msg); } }
function saveOrder(&$cid) { global $database; josSpoofCheck(); $total = count($cid); $order = josGetArrayInts('order'); $row = new mosMambot($database); $conditions = array(); // update ordering values for ($i = 0; $i < $total; $i++) { $row->load((int) $cid[$i]); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // if // remember to updateOrder this group $condition = "folder = " . $database->Quote($row->folder) . " AND ordering > -10000 AND ordering < 10000 AND client_id = " . (int) $row->client_id; $found = false; foreach ($conditions as $cond) { if ($cond[1] == $condition) { $found = true; break; } } // if if (!$found) { $conditions[] = array($row->id, $condition); } } // if } // for // execute updateOrder for each group foreach ($conditions as $cond) { $row->load($cond[0]); $row->updateOrder($cond[1]); } // foreach $msg = 'New ordering saved'; mosRedirect('index2.php?option=com_mambots', $msg); }
function saveOrder(&$cid) { global $database; josSpoofCheck(); $total = count($cid); $redirect = mosGetParam($_POST, 'redirect', 0); $rettask = strval(mosGetParam($_POST, 'returntask', '')); $order = josGetArrayInts('order'); $row = new mosContent($database); $conditions = array(); // update ordering values for ($i = 0; $i < $total; $i++) { $row->load((int) $cid[$i]); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // if // remember to updateOrder this group $condition = "catid = " . (int) $row->catid . " AND state >= 0"; $found = false; foreach ($conditions as $cond) { if ($cond[1] == $condition) { $found = true; break; } } // if if (!$found) { $conditions[] = array($row->id, $condition); } } // if } // for // execute updateOrder for each group foreach ($conditions as $cond) { $row->load($cond[0]); $row->updateOrder($cond[1]); } // foreach // clean any existing cache files mosCache::cleanCache('com_content'); $msg = 'Nova ordenação salva'; switch ($rettask) { case 'showarchive': mosRedirect('index2.php?option=com_content&task=showarchive§ionid=' . $redirect, $msg); break; default: mosRedirect('index2.php?option=com_content§ionid=' . $redirect, $msg); break; } // switch }