function test_feedId() { foreach ($this->files as $file) { $contents = file_get_contents($this->sample_dir . DIRECTORY_SEPARATOR . $file); $feed = new XML_Feed_Parser($contents); $entry = $feed->getEntryByOffset(0); $this->assertEquals($feed->id, $feed->id()); } }
if (!$products) { $products = array(); } $products_commasep = join(',', $products); $sprink = new Sprinkles(); $creds = $sprink->current_user_session(); if (!$creds) { $target_page = $preview_after_login ? 'submit.php' : 'handle-submit.php'; redirect('user-login.php?return=' . urlencode($target_page . '?' . $args)); exit(0); } $POST_URL = $api_root . 'companies/' . $sprink->company_sfnid . '/topics'; $req = $sprink->oauthed_request('POST', $POST_URL, $creds, null, array('topic[subject]' => $subject, 'topic[additional_detail]' => $details, 'topic[style]' => $style, 'topic[keywords]' => $tags, 'topic[products]' => $products_commasep, 'topic[emotitag][face]' => $face, 'topic[emotitag][feeling]' => $emotion)); $response_body = $req->getResponseBody(); try { $topic_feed = new XML_Feed_Parser($response_body); } catch (Exception $e) { error("Failed to post new topic; response was: " . $req->getResponseCode() . ", body: " . $response_body); throw new Exception($response_body); } if ($topic_feed->id()) { # FIXME: better error checking here. redirect('topic.php?id=' . $topic_feed->id()); exit(0); } else { print "An error occured"; } } catch (Exception $e) { error_log("Exception thrown while preparing page: " . $e->getMessage()); $smarty->display('error.t'); }