Ejemplo n.º 1
0
 public static function authenticate($username = "", $password = "")
 {
     $database = cbSQLConnect::connect('object');
     if (isset($database)) {
         $sql = "SELECT *  ";
         $sql .= "FROM  `user`  ";
         $sql .= "WHERE (";
         $sql .= "`username` =  :username ";
         $sql .= "OR  `email` =  :username";
         $sql .= ") ";
         $sql .= "AND  `password` =  :password ";
         $sql .= "AND  `valid` =  '1';";
         $params = array(':password' => $password, ':username' => $username);
         array_unshift($params, '');
         unset($params[0]);
         $results_array = $database->QueryForObject($sql, $params);
         return !empty($results_array) ? array_shift($results_array) : false;
     }
 }
Ejemplo n.º 2
0
<?php

include "connect.php";
$database = new cbSQLConnect($databaseSetup, cbSQLConnectVar::FETCH_ASSOC);
// Get my bookmarks
$datas = $database->QuerySingle("SELECT * FROM bookmarks WHERE estado = '1' ORDER BY orden DESC ");
$var = '';
foreach ($datas as $value) {
    $var .= "\n\t\t<li class='ui-state-default' id='order-" . $value['id'] . "'>\n\t\t<input type='checkbox' class='checkbox' id='cb-" . $value['id'] . "'>\n\t\t<a href='" . $value['url'] . "' target='_blank'>" . $value['url'] . "</a>\n\t\t<img class='edit-ico' id='img-" . $value['id'] . "' src='img/edit-icon.png'>\n\t\t</li>";
}
echo $var;
Ejemplo n.º 3
0
 public function delete()
 {
     $database = cbSQLConnect::adminConnect('object');
     if (isset($database)) {
         return $database->SQLDelete(self::$table_name, 'id', $this->id);
     }
 }
Ejemplo n.º 4
0
<?php

include "connect.php";
$database = new cbSQLConnect($databaseSetup, cbSQLConnectVar::FETCH_ASSOC);
$data = $_POST["choices"];
$newarray = explode("&", $data[0]);
$i = count($newarray);
foreach ($newarray as $key => $value) {
    $ides = explode("=", $value);
    $database->SQLUpdate("bookmarks", "orden", $i, "id", (int) $ides[1]);
    $i--;
}
//print_r($data[0]);
Ejemplo n.º 5
0
<?php

include "connect.php";
$database = new cbSQLConnect($databaseSetup, cbSQLConnectVar::FETCH_ASSOC);
$data = $_POST["choices"];
foreach ($data as $value) {
    $newid = str_replace('cb-', '', $value);
    $database->SQLUpdate("bookmarks", "estado", "0", "id", (int) $newid);
}
echo $var;
Ejemplo n.º 6
0
function savePlaces($place, $table, $id, $group)
{
    $database = cbSQLConnect::connect('object');
    if (isset($database)) {
        $fields = array();
        $fields['name'] = $place;
        $fields['ftable'] = $table;
        $fields['fid'] = $id;
        $fields['category'] = $group;
        // return data
        $insert = $database->SQLInsert($fields, "places");
        // return true if sucess or false
        if ($insert) {
            return $insert;
        } else {
            return "Insert didn't compute";
        }
    }
}
Ejemplo n.º 7
0
        //    else
        //    {
        //       echo "STDCLASS OBJ";
        //    }
        // }
        //    echo "\n";
        // print_r($search_result);
        // echo "</pre>";
        // echo count($search_result);
    }
    exit;
}
if ($action = 'getFilteredData') {
    //    error_reporting(E_ALL);
    // ini_set('display_errors', '1');
    $database = cbSQLConnect::connect('array');
    $search_query = getRequest("key");
    $search_result_data = array();
    $search_result_tags = array();
    $results = array();
    if (isset($database) && !empty($search_query)) {
        $data = $database->QuerySingle("SELECT *, MATCH(title, author, comments) AGAINST('" . $search_query . "*' IN BOOLEAN MODE) AS score FROM `file` WHERE MATCH(title, author, comments) AGAINST('" . $search_query . "*' IN BOOLEAN MODE) ORDER BY score DESC");
        //$results[] = $data;
        if (count($data) == 0) {
            //echo "Search found nothing in File\n";
        } else {
            foreach ($data as $instance) {
                $temp = recast("File", arrayToObject($instance));
                if ($temp->comments !== null) {
                    $results[] = $temp->comments;
                }
Ejemplo n.º 8
0
<?php

include "connect.php";
$database = new cbSQLConnect($databaseSetup, cbSQLConnectVar::FETCH_ASSOC);
$date = date('Y-m-d H:i:s');
$id = str_replace('img-', '', $_POST["id"]);
$url = $_POST["url"];
if (!empty($id)) {
    $database->SQLUpdate("bookmarks", "url", $url, "id", $id);
} else {
    // Count rows for order
    $count = $database->QuerySingle("SELECT count(*) AS total FROM bookmarks");
    $insert = $database->SQLInsert(array(array('id' => null, 'url' => $url, 'fecha' => $date, 'orden' => (int) $count[0]['total'] + 1, 'estado' => '1')), "bookmarks");
    // return true if sucess or false
    echo $insert;
}
Ejemplo n.º 9
0
 public function delete()
 {
     $database = cbSQLConnect::adminConnect('object');
     if (isset($database)) {
         return $database->SQLDelete('favorites', 'id', $this->id);
     }
 }
Ejemplo n.º 10
0
 public function delete()
 {
     $database = cbSQLConnect::adminConnect('object');
     if (isset($database)) {
         $tags = $this->getTagListById($this->id);
         foreach ($tags as $tag) {
             $temp = recast('Tag', $tag);
             $temp->delete();
         }
         return $database->SQLDelete(self::$table_name, 'id', $this->id);
     }
 }
Ejemplo n.º 11
0
     exit;
     exit;
 }
 // this will get us the list of individuals
 if ($action == 'getIndividuals') {
     $people = Person::getIndividuals();
     if ($people) {
         echo json_encode($people);
     } else {
         echo "failed";
     }
     exit;
 }
 // this will get us the list of individuals
 if ($action == 'getPlaces') {
     $database = cbSQLConnect::connect('object');
     $result = array();
     if (isset($database)) {
         $places = $database->QuerySingle("SELECT DISTINCT `id`, `name`, `ftable`, `fid`, `category` FROM `places`  GROUP BY `name`");
         if ($places) {
             foreach ($places as $aplace) {
                 $temp = array();
                 $temp[] = $aplace->id;
                 $temp[] = $aplace->name;
                 $temp[] = $aplace->ftable;
                 $temp[] = $aplace->fid;
                 $temp[] = $aplace->category;
                 $result[] = $temp;
             }
         } else {
             return "none";