Example #1
0
         if (!$result) {
             $GLOBALS['Response']->addFeedback('error', $Language->getText('news_admin_index', 'group_update_err'));
         } else {
             $GLOBALS['Response']->addFeedback('info', $Language->getText('news_admin_index', 'project_newsbyte_updated'));
             // update/create  news permissions
             $qry1 = "SELECT * FROM news_bytes WHERE id=" . db_ei($id);
             $res1 = db_query($qry1);
             $forum_id = db_result($res1, 0, 'forum_id');
             $res2 = news_read_permissions($forum_id);
             if (db_numrows($res2) > 0) {
                 //permission on this news is already defined, have to be updated
                 news_update_permissions($forum_id, $is_private, $group_id);
             } else {
                 //permission of this news not yet defined
                 if ($is_private) {
                     news_insert_permissions($forum_id, $group_id);
                 }
             }
             // extract cross references
             $reference_manager =& ReferenceManager::instance();
             $reference_manager->extractCrossRef($request->get('summary'), $forum_id, ReferenceManager::REFERENCE_NATURE_NEWS, $group_id);
             $reference_manager->extractCrossRef($request->get('details'), $forum_id, ReferenceManager::REFERENCE_NATURE_NEWS, $group_id);
         }
     }
 }
 news_header(array('title' => $Language->getText('news_admin_index', 'title'), 'help' => 'NewsService.html'));
 echo '<H3>' . $Language->getText('news_admin_index', 'news_admin') . '</H3>';
 if (!$request->get('post_changes') && $request->get('approve')) {
     /*
     	Show the submit form
     */
Example #2
0
function news_submit($group_id, $summary, $details, $private_news, $send_news_to, $promote_news = 0)
{
    /*
    	Takes Summary and Details, and submit the corresponding news, in the right project, with the right permissions
    */
    $new_id = forum_create_forum($GLOBALS['sys_news_group'], $summary, 1, 0, '', $need_feedback = false);
    $sql = "INSERT INTO news_bytes (group_id,submitted_by,is_approved,date,forum_id,summary,details) \n          VALUES (" . db_ei($group_id) . ", '" . user_getid() . "', " . db_ei($promote_news) . ", '" . time() . "',\n                 '{$new_id}', '" . db_es(htmlspecialchars($summary)) . "', '" . db_es(htmlspecialchars($details)) . "')";
    $result = db_query($sql);
    if (!$result) {
        $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('news_submit', 'insert_err'));
    } else {
        // retrieve the id of the news
        $news_bytes_id = db_insertid($result);
        $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('news_submit', 'news_added'));
        // set permissions on this piece of news
        if ($private_news) {
            news_insert_permissions($new_id, $group_id);
        }
        if ($promote_news == 3) {
            // if the news is requested to be promoted, we notify the site admin about it
            news_notify_promotion_request($group_id, $news_bytes_id, $summary, $details);
        }
        if ($send_news_to) {
            news_send_to_ugroups($send_news_to, $summary, $details, $group_id);
        }
        // extract cross references
        $reference_manager =& ReferenceManager::instance();
        $reference_manager->extractCrossRef($summary, $new_id, ReferenceManager::REFERENCE_NATURE_NEWS, $group_id);
        $reference_manager->extractCrossRef($details, $new_id, ReferenceManager::REFERENCE_NATURE_NEWS, $group_id);
    }
}