public function view() { $dao = DAO::getDAO('UserDAO'); if (isset($this->params[0]) && trim($this->params[0]) == 'remove') { // ex: requesting: /user-list/delete/2 $id = trim(sanitizeString($this->params[1])); $dao->removeById($id); } else { if (isset($this->params[0]) && trim($this->params[0]) == 'add') { $randNum = mt_rand(0, 99999); $newUser = new User(array('firstName' => 'First', 'lastName' => 'LastName', 'username' => "test{$randNum}", 'email' => "test{$randNum}@example.com", 'createTime' => dbDateTime())); // #TODO: implement UserDao.create($newUser) instead. if ($dao->countAll() > 30) { // Demo mode: clean up if too many users $dao->execute("DELETE FROM user"); $dao->execute("vacuum"); } $dao->insertInto("firstName, lastName, username, email, createTime", $newUser->getFields()); } } $users = $dao->getAll(); $v = $this->smarty; $v->assign('title', 'User List'); $v->assign('inc_content', v('user_list.html')); $v->assign('users', $users); $v->assign('totalUsers', $dao->countAll()); $this->display($v, v('index.html')); }
public function view() { $dao = DAO::getDAO('SearchDAO'); if (isset($this->params[0]) && trim($this->params[0]) == 'remove') { // ex: requesting: /search/delete/2 $id = trim(sanitizeString($this->params[1])); $dao->removeById($id); } else { if (isset($this->params[0]) && trim($this->params[0]) == 'add') { $randNum = mt_rand(0, 99999); $newSearch = new Search(array('username' => "test{$randNum}", 'email' => "test{$randNum}@example.com", 'created' => dbDateTime())); // #TODO: implement UserDao.create($newUser) instead. if ($dao->countAll() > 30) { // Demo mode: clean up if too many searchs $dao->execute("DELETE FROM searchs"); $dao->execute("vacuum"); } $dao->insertInto("username, email, created", $newSearch->getFields()); } } $search = $dao->getAll(); $v = $this->smarty; $v->assign('title', 'Search List'); $v->assign('inc_content', v('search.html')); $v->assign('search', $search); $v->assign('totalSearch', $dao->countAll()); $this->display($v, v('index.html')); }
public function processPost() { parent::processPost(); // #TODO: User submitted data. Save it to DB, email, etc. copyArray($_POST, $v, '*'); $dao = DAO::getDAO('UserDAO'); $newUser = new User(array('firstName' => 'First', 'lastName' => 'LastName', 'username' => $v['username'], 'email' => $v['email'], 'password' => $v['password'], 'createTime' => dbDateTime())); $ret = $dao->insertInto('firstName, lastName, username, email, password, createTime', $newUser->getFields()); if ($ret[0] != '00000') { $err = "<span class='msgErr'>ERROR: {$ret['2']}</span>"; } $v = $this->smarty; $v->assign('title', 'Thank you!'); $v->assign('content', '<h2>Thank you!</h2><p>Thanks for your registration.</p><p>' . $err . '<p/><p><a href="/user-list">Check User List</a><p/>'); $v->assign('inc_content', 'blank.html'); $this->display($v, v('index.html')); }
<?php include 'utils.phpmailer.php'; include 'template.php'; include '../database/mysql.php'; // $to = "*****@*****.**"; // $body = templateNewUser(5, "asd", "123654789"); // $mail = createmailJO($to, "", $body); // if ($mail->SendAndClose()) { // echo "true"; // } else { // echo "false"; // } //echo "<pre>" . print_r($_SERVER) . "</pre>"; //echo print_r($_SERVER) ; echo dbDateTime(mktime(0, 0, 0, 0, 0, 0));
<?php require_once '../../includes/utils.php'; require_once rootPath('includes/sijo/html_header.php', 1); require_once rootPath('includes/sijo/master_header.php', 1); require_once rootPath('myacount/check_login.php', 1); //Salva a sugestão submetida if (isset($_POST["save"])) { $fields = array(); $fields['id_sugestao'] = -1; $fields['id_visitante'] = dbInteger($_POST['id_visitante']); $fields['tipo'] = dbString($_POST['tipo']); $fields['data'] = dbDateTime(new DateTime()); $fields['descricao'] = dbString($_POST['descricao']); sugestaoInsert($fields); ?> <div class="informationmsg">Obrigado pelo seu contributo!</div> <?php } ?> <h1 class="header_h1">Sugestões</h1> <form name="sugestao" action="index.php" method="post"> <input type="hidden" name="id_visitante" value="<?php echo $current_user['id_visitante']; ?> " /> <select id="sltTipo" name="tipo"> <option value="S" >Sugestão</option> <option value="C" >Comentário</option> <option value="R" >Reclamação</option> </select><br/>
} //$albums = $fb->api("/$gid?fields=albums"); foreach ($uids as $uid => $name) { $_user_id = $uid; $_name = $name ? $name : null; mysqli_stmt_execute($dbUser); } } } catch (FacebookApiException $e) { // TODO: more smartness here throw $e; } $_interval_start = FACEBOOK_ARCHIVE_METHOD == "graph" ? null : dbDateTime($start); $_interval_stop = FACEBOOK_ARCHIVE_METHOD == "graph" ? null : dbDateTime($stop); $_fetch_start = dbDateTime($fetchStart); $_fetch_stop = dbDateTime(time()); $_posts = $postCount ? $postCount : null; $_comments = $commentCount ? $commentCount : null; $_photos = $photoCount ? $photoCount : null; mysqli_stmt_execute($dbInterval); // move to the next interval $start -= FACEBOOK_ARCHIVE_INTERVAL; $stop -= FACEBOOK_ARCHIVE_INTERVAL; $i++; } while (FACEBOOK_ARCHIVE_METHOD != "graph" && ($postCount || $i == 1) && (FACEBOOK_ARCHIVE_MAX_INTERVALS == 0 || $i < FACEBOOK_ARCHIVE_MAX_INTERVALS)); } } // used if we're not authenticated, or have insufficient permissions to proceed $loginParams = array("scope" => "user_groups"); $loginUrl = $fb->getLoginUrl($loginParams); $loginHtml = '<p><a href="' . $loginUrl . '">Click here to log in with Facebook.</a></p>';
function getStatsByDate($start = null, $end = null) { $this->stats = array(); $date_limit = ''; if ($end != null) { $date_limit .= "&enddate=" . $end; } if ($start != null) { $date_limit .= "&startdate=" . $start; } $acc_tok = new OAuthToken($this->authToken, $this->authSecret); $req = OAuthRequest::from_consumer_and_token($this->consumer, $acc_tok, "GET", $this->base_url . $date_limit . "&userid=" . $this->userId); $req->sign_request($this->sig_method, $this->consumer, $acc_tok); $response = file_get_contents($req, FALSE, $this->context); if ($response === FALSE || $response == null || $response == '') { return false; } $response_array = json_decode($response); if ($response_array->status != 0) { logit(INFO, "Withings data error: status code " . $response_array->status); return false; } foreach ($response_array->body->measuregrps as $entry_group) { // continue if category is 2 - these are targets, not measurements. if ($entry_group->category == 2) { continue; } $date = $entry_group->date; foreach ($entry_group->measures as $entry) { $value = $entry->value; $type = $entry->type; if ($entry->unit != 0) { $value = $value * pow(10, $entry->unit); } // convert kilograms to pounds if ($type == $this->weight) { $value *= 2.20462; } $value = round($value, 2); $short_entry = new StdClass(); $short_entry->date = dbDate($date); $short_entry->datetime = dbDateTime($date); $short_entry->metric = $type; $short_entry->value = $value; $this->stats[] = $short_entry; } } return $this->stats; }
<?php require_once '../../includes/utils.php'; include_once rootPath('includes/sijo/html_header.php', 1); include_once rootPath('includes/sijo/master_header.php', 1); require_once rootPath('includes/mail/utils.phpmailer.php', 1); require_once rootPath('includes/mail/template.php', 1); if (isset($_POST['confirm'])) { $fields['id_bilhete'] = dbInteger(-1); $fields['acontecimento'] = dbString($_POST['acontecimento']); $fields['id_entidade'] = dbInteger($_POST['id_entidade']); $fields['id_visitante'] = dbInteger($_POST['id_visitante']); $fields['tipo'] = dbString($_POST['tipo']); $fields['status'] = dbString('I'); $fields['quantidade'] = dbInteger($_POST['quantidade']); $fields['preco'] = dbString($_POST['preco']); $fields['data'] = dbDateTime(new DateTime()); $fields['data_compra'] = dbDateTime(mktime(0, 0, 0, 0, 0, 0)); bilheteinsert($fields); $body = templatenewticket($fields['id_bilhete'], $current_user); $obj = createmailjo($current_user['email'], "bilheteira", $body); if ($obj->sendandclose()) { } else { bilhetedelete($fields['id_bilhete']); $erro = true; } } header('location: index.php'); exit; include_once rootPath('includes/sijo/master_footer.php', 1);