function setAddress() { $billing = new billing(); $billing->billingmethod->setAddress($this->params['billing_address']); $ar = new expAjaxReply(200, 'ok', new address($billing->billingmethod->addresses_id), array('controller' => 'cart', 'action' => 'checkout')); $ar->send(); }
function update() { global $db, $user; $this->params['id'] = $db->selectValue('content_expRatings', 'expratings_id', "content_type='" . $this->params['content_type'] . "' AND subtype='" . $this->params['subtype'] . "' AND poster='" . $user->id . "'"); $rating = new expRating($this->params); // save the comment $rating->update($this->params); // attach the comment to the datatype it belongs to (blog, news, etc..); $obj->content_type = $this->params['content_type']; $obj->content_id = $this->params['content_id']; $obj->expratings_id = $rating->id; $obj->poster = $rating->poster; if (isset($this->params['subtype'])) { $obj->subtype = $this->params['subtype']; } $db->insertObject($obj, $rating->attachable_table); $ar = new expAjaxReply(200, gt('Thank you for your rating')); $ar->send(); // flash('message', $msg); // // expHistory::back(); }
public function searchNew() { global $db, $user; //$this->params['query'] = str_ireplace('-','\-',$this->params['query']); $sql = "select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid, "; $sql .= "match (p.title,p.model,p.body) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) as relevance, "; $sql .= "CASE when p.model like '" . $this->params['query'] . "%' then 1 else 0 END as modelmatch, "; $sql .= "CASE when p.title like '%" . $this->params['query'] . "%' then 1 else 0 END as titlematch "; $sql .= "from " . $db->prefix . "product as p INNER JOIN " . $db->prefix . "content_expFiles as cef ON p.id=cef.content_id INNER JOIN " . $db->prefix . "expFiles as f ON cef.expFiles_id = f.id WHERE "; if (!($user->is_admin || $user->is_acting_admin)) { $sql .= '(p.active_type=0 OR p.active_type=1) AND '; } $sql .= " match (p.title,p.model,p.body) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) AND p.parent_id=0 "; $sql .= " HAVING relevance > 0 "; //$sql .= "GROUP BY p.id "; $sql .= "order by modelmatch,titlematch,relevance desc LIMIT 10"; eDebug($sql); $res = $db->selectObjectsBySql($sql); eDebug($res, true); $ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res); $ar->send(); }
public function editShare() { global $user; $file = new expFile($this->params['id']); if (!isset($this->params['newValue'])) { $this->params['newValue'] = 0; } if ($user->id == $file->poster || $user->is_acting_admin == 1) { $file->shared = $this->params['newValue']; $file->save(); $ar = new expAjaxReply(200, gt('This file is now shared.'), $file); } else { $ar = new expAjaxReply(300, gt("You didn't create this file, so it's not yours to share.")); } $ar->send(); echo json_encode($file); }
public function search_external() { global $db, $user; $sql = "select DISTINCT(a.id) as id, a.source as source, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email "; $sql .= "from " . $db->prefix . "external_addresses as a "; //R JOIN " . //$db->prefix . "billingmethods as bm ON bm.addresses_id=a.id "; $sql .= " WHERE match (a.firstname,a.lastname,a.email,a.organization) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) "; $sql .= "order by match (a.firstname,a.lastname,a.email,a.organization) against ('" . $this->params['query'] . "*') ASC LIMIT 12"; $res = $db->selectObjectsBySql($sql); //eDebug($sql); $ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res); $ar->send(); }
public function autocomplete() { return; global $db; $mod = new $this->params['model'](); $srchcol = explode(",", $this->params['searchoncol']); /*for ($i=0; $i<count($srchcol); $i++) { if ($i>=1) $sql .= " OR "; $sql .= $srchcol[$i].' LIKE \'%'.$this->params['query'].'%\''; }*/ // $sql .= ' AND parent_id=0'; //eDebug($sql); //$res = $mod->find('all',$sql,'id',25); $sql = "select DISTINCT(p.id), p.title, model, sef_url, f.id as fileid from exponent_product as p INNER JOIN exponent_content_expfiles as cef ON p.id=cef.content_id INNER JOIN exponent_expfiles as f ON cef.expfiles_id = f.id where match (p.title,p.model,p.body) against ('" . $this->params['query'] . "') AND p.parent_id=0 order by match (p.title,p.model,p.body) against ('" . $this->params['query'] . "') desc LIMIT 25"; //$res = $db->selectObjectsBySql($sql); //$res = $db->selectObjectBySql('SELECT * FROM `exponent_product`'); $ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res); $ar->send(); }
function listPrices() { $shipping = new shipping(); $ar = new expAjaxReply(200, 'ok', $shipping->listPrices(), array('controller' => 'cart', 'action' => 'checkout')); $ar->send(); }