Ejemplo n.º 1
0
 function update($id, $fields, $values = false, $ignore_cache = false)
 {
     $id = sqlescape($id);
     // Turn a key => value array into pairs
     if ($values === false && is_array($fields)) {
         $values = $fields;
         $fields = array_keys($fields);
     }
     // Multiple columns to update
     if (is_array($fields)) {
         $query_parts = array();
         foreach ($fields as $key) {
             $val = current($values);
             if (is_array($val)) {
                 $val = BigTree::json(BigTree::translateArray($val));
             } else {
                 $val = BigTreeAdmin::autoIPL($val);
             }
             $query_parts[] = "`{$key}` = '" . sqlescape($val) . "'";
             next($values);
         }
         sqlquery("UPDATE `" . $this->Table . "` SET " . implode(", ", $query_parts) . " WHERE id = '{$id}'");
         // Single column to update
     } else {
         if (is_array($values)) {
             $val = json_encode(BigTree::translateArray($values));
         } else {
             $val = BigTreeAdmin::autoIPL($values);
         }
         sqlquery("UPDATE `" . $this->Table . "` SET `{$fields}` = '" . sqlescape($val) . "' WHERE id = '{$id}'");
     }
     if (!$ignore_cache) {
         BigTreeAutoModule::recacheItem($id, $this->Table);
     }
 }
Ejemplo n.º 2
0
<?php

if (is_numeric($id)) {
    BigTreeAutoModule::recacheItem($id, $table);
} else {
    BigTreeAutoModule::recacheItem(substr($id, 1), $table, true);
}
Ejemplo n.º 3
0
    $email .= $address["city"] . ", " . $address["state"] . " " . $address["zip"] . "\n";
    $email .= $address["country"];
    $email .= "\n\n";
    $email .= "Credit Card Info:\n";
    $email .= $card["type"] . "\n";
    $email .= "**** **** **** " . $pg->Last4CC . "\n";
    $email .= "Expires " . $card["month"] . "/" . $card["year"];
    $email .= "\n\n";
    $email .= "Total Charged: \$" . number_format($total, 2);
}
// Get rid of saved data or errors.
unset($_SESSION["form_builder"]);
// Add the entry to the entries table.
BigTreeAutoModule::createItem("btx_form_builder_entries", array("form" => $form["id"], "data" => $entry, "created_at" => "NOW()"));
// Update the totals for the form and recache it.
sqlquery("UPDATE btx_form_builder_forms SET entries = (entries + 1), last_entry = NOW(), total_collected = (total_collected + " . round($total, 2) . ") WHERE id = '" . $form["id"] . "'");
BigTreeAutoModule::recacheItem($form["id"], "btx_form_builder_forms");
// Get the no-reply domain
$no_reply_domain = str_replace(array("http://www.", "https://www.", "http://", "https://"), "", DOMAIN);
$email_title = $page_header ? $page_header : $bigtree["page"]["nav_title"];
$email = $email_title . ' - Form Submission
' . str_repeat("=", strlen($email_title)) . '==================

' . $email;
// Send out email alerts
$emails = explode(",", $emails);
foreach ($emails as $e) {
    $e = trim($e);
    mail($e, $email_title . " - Form Submission", $email, "From: no-reply@{$no_reply_domain}");
}
BigTree::redirect($page_link . "thanks/");
Ejemplo n.º 4
0
<?php

// Update the count
sqlquery("UPDATE btx_form_builder_forms SET entries = (entries - 1) WHERE id = '" . sqlescape($_POST["form"]) . "'");
BigTreeAutoModule::recacheItem($_POST["form"], "btx_form_builder_forms");
// Delete the entry
BigTreeAutoModule::deleteItem("btx_form_builder_entries", $_POST["id"]);
// Show the growl and update the table
header("Content-type: text/javascript");
?>
BigTree.growl("Form Builder","Deleted Entry");
$("#row_<?php 
echo $_POST["id"];
?>
").remove();
Ejemplo n.º 5
0
<?php

$change = $admin->getPendingChange($_POST["id"]);
// See if we have permission.
$item_id = $change["item_id"] ? $change["item_id"] : "p" . $change["id"];
if ($change["module"]) {
    // It's a module. Check permissions on this.
    $data = BigTreeAutoModule::getPendingItem($change["table"], $item_id);
    $permission_level = $admin->getAccessLevel($admin->getModule($change["module"]), $data["item"], $change["table"]);
} else {
    if ($change["item_id"]) {
        $permission_level = $admin->getPageAccessLevel($page);
    } else {
        $f = $admin->getPendingChange($change["id"]);
        $permission_level = $admin->getPageAccessLevel($f["changes"]["parent"]);
    }
}
// If they're not a publisher, they have no business here.
if ($permission_level != "p") {
    die;
}
$admin->deletePendingChange($change["id"]);
if (!is_numeric($item_id)) {
    BigTreeAutoModule::uncacheItem($item_id, $change["table"]);
} else {
    BigTreeAutoModule::recacheItem($item_id, $change["table"]);
}