function post($data, $syntax, $ttl, $password, $cipher) { $template = $this->template; // This may be required if a user is dealing with a file that is so large that it takes more than 30 seconds set_time_limit(0); require_once __DIR__ . '/paste.class.php'; $pastes = new Paste(); // new post submission $paste = $pastes->add($data, $syntax, $ttl, $password, $cipher); // return our new ID to the user $output = array('id' => alphaID($paste, false)); $template->render(200, null, $output); }
public function testActiveDataCountActionShouldReturnSimplyACount() { $data = $this->getData(); $model = new Paste(); $ids = array(); for ($i = 0; $i < 5; ++$i) { $ids[] = $model->add($data); } $this->dispatch('/paste/active-data-count/format/ajax'); $content = $this->response->getBody(); $this->assertEquals(5, $content); }
require_once b1n_PATH_LIB . '/Paste.lib.php'; // Paste Lib // Configuration require_once b1n_PATH_CONFIG . '/config.php'; require_once b1n_PATH_CONFIG . '/setup.php'; // Setup // Session session_start(); // Include $inc = 'paste'; try { // Creating Database Connection $sql = new SQLLink(b1n_SQLCONFIG_FILE); $paste = new Paste($sql); if (Data::cmp($d['action'], 'add')) { if ($r = $paste->add($d)) { $inc = 'added'; } } elseif (Data::cmp($d['action'], 'list')) { $inc = 'list'; } elseif (Data::cmp($d['action'], 'text') && Data::checkFilled($d['id']) && ($r = $paste->getDataText($d))) { header("Content-type: text/plain"); require_once b1n_PATH_INC . '/text.inc.php'; exit; } elseif (Data::cmp($d['action'], 'random')) { $r = $paste->getDataRandom(); $inc = 'show'; } elseif (Data::checkFilled($d['id']) && ($r = $paste->getData($d))) { $inc = 'show'; } } catch (Exception $e) {