本文整理汇总了PHP中josGetArrayInts函数的典型用法代码示例。如果您正苦于以下问题:PHP josGetArrayInts函数的具体用法?PHP josGetArrayInts怎么用?PHP josGetArrayInts使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了josGetArrayInts函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _EDIT
/**
* 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();
}
示例2: saveMenu
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;
}
}
示例3: defined
* 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);
示例4: saveOrder
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);
}
示例5: defined
<?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;
示例6: saveTemplateAssign
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);
}
示例7: JLMS_saveCertificate
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)) {
//.........这里部分代码省略.........
示例8: saveOrder
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);
}
示例9: saveOrder
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);
}
示例10: saveOrder
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);
}
示例11: copyMenu
/**
* 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);
}
示例12: ALF_saveItem
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";
//.........这里部分代码省略.........
示例13: saveOrder
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);
}
示例14: saveOrder
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
}