function testEditIotd() { edit_iotd($this->iotd_id, 'Thank you', 'Caption ?', 'images/yahoo.jpg', 'yahoo.com', 0, 0, 0, 'Notes'); $this->assertTrue('yahoo.com' == $GLOBALS['SITE_DB']->query_value('iotd', 'url', array('id' => $this->iotd_id))); }
/** * Standard aed_module edit actualiser. * * @param ID_TEXT The entry being edited */ function edit_actualisation($_id) { $id = intval($_id); $rows = $GLOBALS['SITE_DB']->query_select('iotd', array('is_current', 'submitter'), array('id' => $id), '', 1); if (!array_key_exists(0, $rows)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } $is_current = $rows[0]['is_current']; $submitter = $rows[0]['submitter']; require_code('uploads'); check_edit_permission($is_current == 1 ? 'high' : 'mid', $submitter); $urls = get_url('url', 'file', 'uploads/iotds', 0, OCP_UPLOAD_IMAGE, true, 'thumb_url', 'file2'); if ($urls[0] == '' || $urls[1] == '') { warn_exit(do_lang_tempcode('IMPROPERLY_FILLED_IN_UPLOAD')); } $url = $urls[0]; $thumb_url = $urls[1]; if (substr($urls[0], 0, 8) != 'uploads/' && $urls[0] != '' && is_null(http_download_file($urls[0], 0, false)) && !is_null($GLOBALS['HTTP_MESSAGE_B'])) { attach_message($GLOBALS['HTTP_MESSAGE_B'], 'warn'); } $allow_rating = post_param_integer('allow_rating', 0); $allow_comments = post_param_integer('allow_comments', 0); $notes = post_param('notes', ''); $allow_trackbacks = post_param_integer('allow_trackbacks', 0); $current = post_param_integer('validated', 0); $title = post_param('title'); if ($current == 1 && $GLOBALS['SITE_DB']->query_value('iotd', 'is_current', array('id' => $id)) == 0) { $submitter = $GLOBALS['SITE_DB']->query_value('iotd', 'submitter', array('id' => $id)); if (has_actual_page_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), 'iotds')) { syndicate_described_activity('iotds:ACTIVITY_ADD_IOTD', $title, '', '', '_SEARCH:iotds:view:' . strval($id), '', '', 'iotds', 1, NULL); } } edit_iotd($id, $title, post_param('caption'), $thumb_url, $url, $allow_rating, $allow_comments, $allow_trackbacks, $notes); if ($current == 1) { if ($is_current == 0) { if (!has_specific_permission(get_member(), 'choose_iotd')) { log_hack_attack_and_exit('BYPASS_VALIDATION_HACK'); } set_iotd($id); } } }