function publish_keywords() { global $option; $ids = JRequest::getVar("cid", array(), "", "array"); JArrayHelper::toInteger($ids); if (empty($ids)) { $this->setRedirect('index.php?option=' . $option . '&task=keywords', JText::_('MSG_INVALID_ID')); } else { $id = implode(',', $ids); $model =& $this->getModel('crosswords'); if ($model->set_keywords_status($id, "published", true)) { $keywords =& $model->get_keyword_submitters($id); foreach ($keywords as $keyword) { CrosswordsHelper::awardPoints($keyword->created_by, 1, $keyword->id, JText::_('TXT_AWARD_POINTS_NEW_QUESTION')); } } $this->setRedirect('index.php?option=' . $option . '&task=keywords', JText::_('MSG_COMPLETED')); } }
function check_crossword_result() { global $option; if (!CWAuthorization::authorize($option, 'access', 'crosswords', 'all')) { echo json_encode(array('error' => JText::_('MSG_NOT_AUTHORIZED'))); } else { $model =& $this->getModel('crosswords'); $failed = $model->check_result(); if ($failed === false) { echo json_encode(array('error' => $model->getError())); } else { if (empty($failed)) { $cid = JRequest::getVar("id", 0, "post", "int"); $crossword =& $model->get_crossword($cid, false); CrosswordsHelper::awardPoints($user->id, 2, $crossword, JText::_('TXT_AWARD_POINTS_SOLVED_CROSSWORD')); $app =& JFactory::getApplication(); $cwConfig = $app->getUserState(SESSION_CONFIG); if ($cwConfig[STREAM_SOLVED_CROSSWORD] == '1') { CrosswordsHelper::streamActivity(2, $crossword); } echo json_encode(array('message' => JText::_('MSG_CROSSWORD_SOLVED'))); } else { echo json_encode(array('failed' => $failed)); } } } jexit(); }