getSubtype() == "news" && $news->canEdit()) { if (get_input("frontpage")) { // get frontpage news, newest before $frontpage_news = get_entities_from_metadata("frontpage", "1", "object", "news"); // three news can be in frontpage if (is_array($frontpage_news) && sizeof($frontpage_news) >= 3) { // remove oldest one $arraycount = count($frontpage_news); for ($i=2; $i<$arraycount; $i++) { $oldnews = $frontpage_news[$i]; $oldnews->frontpage = 0; $oldnews->save(); } } // add chosen news to frontpage $news->frontpage = 1; $news->save(); forward($CONFIG->wwwroot . "pg/info"); } else { $news->frontpage = 0; $news->save(); forward($CONFIG->wwwroot . "pg/info"); } } forward($CONFIG->wwwroot . "pg/info/readnews/" . $guid); ?>