public static function updateListFromEdit($listId, $status, $new, $listType = 1) { $my = JFactory::getUser(); $mainframe = JFactory::getApplication(); if (version_compare(JVERSION, '1.6.0', '>=')) { //j16 $usergid = JAccess::getGroupsByUser($my->id, false); $my->gid = $usergid[0]; } $listUpdated = new stdClass(); $total = 0; $listUpdated->id = $listId; $issue_nb = JRequest::getVar('issue_nb', '0'); $listUpdated->list_name = JRequest::getVar('list_name', '', 'request', 'string', JREQUEST_ALLOWRAW); $listUpdated->list_desc = JRequest::getVar('list_desc', '', 'request', 'string', JREQUEST_ALLOWRAW); $listUpdated->sendername = addslashes(JRequest::getVar('sendername', '')); $listUpdated->senderemail = JRequest::getVar('senderemail', ''); $listUpdated->bounceadres = JRequest::getVar('bounceadres', ''); $listUpdated->layout = JRequest::getVar('layout', '', 'request', 'string', JREQUEST_ALLOWRAW); $listUpdated->template = JRequest::getInt('templatelist', 0); $listUpdated->subscribemessage = JRequest::getVar('subscribemessage', '', 'request', 'string', JREQUEST_ALLOWRAW); $listUpdated->unsubscribemessage = JRequest::getVar('unsubscribemessage', '', 'request', 'string', JREQUEST_ALLOWRAW); $listUpdated->notifyadminmsg = JRequest::getVar('notifyadminmsg', '', 'request', 'string', JREQUEST_ALLOWRAW); $listUpdated->unsubscribesend = JRequest::getVar('unsubscribesend', 1); $listUpdated->unsubscribenotifyadmin = JRequest::getVar('unsubscribenotifyadmin', 1); $listUpdated->subnotifysend = JRequest::getVar('subnotifysend', 1); $listUpdated->subnotifymsg = JRequest::getVar('subnotifymsg', '', 'request', 'string', JREQUEST_ALLOWRAW); $listUpdated->html = JRequest::getVar('html', 1); $listUpdated->hidden = JRequest::getVar('hidden', 0); $listUpdated->list_type = $listType; $listUpdated->auto_add = JRequest::getVar('auto_add', 0); $listUpdated->user_choose = JRequest::getVar('user_choose', 0); $listUpdated->cat_id = implode(',', JRequest::getVar('cat_id', array())); $listUpdated->delay_min = JRequest::getVar('delay_min', 0); $listUpdated->delay_max = JRequest::getVar('delay_max', 0); $listUpdated->follow_up = JRequest::getVar('follow_up', 0); $listUpdated->notify_id = $listUpdated->list_type == '7' ? JRequest::getVar('notify_id', 0) : 0; if ($mainframe->isAdmin()) { $listUpdated->acc_level = JRequest::getVar('acc_level', '25,24,8,7'); } else { $listUpdated->acc_level = JRequest::getVar('acc_level', $my->gid); } $listUpdated->acc_id = JRequest::getVar('acc_id', 'all'); $listUpdated->footer = JRequest::getVar('footer', 1); $listUpdated->start_date = JRequest::getVar('start_date', ''); $listUpdated->next_date = JRequest::getVar('next_date', 0); $listUpdated->owner = $my->id; $listUpdated->notification = 0; if ($status == '') { $listUpdated->published = JRequest::getVar('published', 0); } else { $listUpdated->published = $status; } if ($listUpdated->published == 0 and ($listUpdated->list_type == 2 or $listUpdated->list_type == 3)) { $published = 0; } else { $published = $listUpdated->published; } if (!empty($listUpdated->hidden)) { $visible = $listUpdated->hidden; } else { $visible = 0; } if ($new) { $published = $listUpdated->published; } if (!jNews_Lists::updateList($listId, $listUpdated, $listUpdated->published, $new)) { return false; } $allMainListA = JRequest::getVar('aca_mailing_addto', array()); if ($listUpdated->list_type == 2 && !empty($allMainListA)) { //auto-responder $db = JFactory::getDBO(); $query = 'DELETE FROM `#__jnews_followup` WHERE `followup_id` = ' . $listId; $db->setQuery($query); $db->query(); $runQuery = false; $query = 'INSERT INTO `#__jnews_followup` (`followup_id`, `list_id`) VALUES '; foreach ($allMainListA as $oneMainList => $checked) { if ($checked) { $query .= '(' . $listId . ',' . $oneMainList . '),'; $runQuery = true; } } //endofreach if ($runQuery) { $query = rtrim($query, ','); $db->setQuery($query); $db->query(); } } return true; }