Example #1
0
function print_favorites()
{
    global $gbl, $sgbl, $login, $ghtml;
    $back = $login->getSkinDir();
    $list = get_favorite("ndskshortcut");
    $vvar_list = array('_t_image', 'url', 'target', '__t_identity', 'ac_descr', 'str', 'tag');
    $res = null;
    foreach ((array) $list as $l) {
        foreach ($vvar_list as $vvar) {
            ${$vvar} = $l[$vvar];
        }
        $res .= "<tr valign=top style=\"border-width:1; background:url({$back}/a.gif);\"> <td > <span title=\"{$ac_descr['2']} for {$__t_identity}\"> <img width=16 height=16 src={$_t_image}> <a href={$url} target={$target}>  {$str} {$tag}</a></span></td> </tr>";
    }
    return $res;
}
Example #2
0
 function print_toolbar()
 {
     $list = get_favorite("ndskshortcut");
     foreach ((array) $list as $l) {
         if ($l['ttype'] === 'separator') {
             print "<td nowrap width=20> </td>";
             continue;
         }
         print "<td  valign='middle'  align='left' width=5>";
         print '<form>';
         $l['ac_descr']['desc'] = "{$l['fullstr']} {$l['tag']}";
         $this->print_div_for_divbutton_on_header($l['url'], $l['target'], null, true, true, $l['url'], $l['__t_identity'], $l['_t_image'], $l['ac_descr']);
         print '</form>';
         print "</td >";
     }
 }
<?php

$db = new mysqli('localhost', 'root', 'root', 'realestate_db');
// <-- Toggle
//$db = new mysqli('localhost','root','','realestate_db'); // <-- Toggle
$query = make_query();
$userid = test_input($_POST["userid"]);
$result = $db->query($query);
$json = '{"properties": [';
$first = True;
if ($result) {
    while ($row = $result->fetch_assoc()) {
        $photo = get_photo($row['pid']);
        $favorite = get_favorite($row['pid']);
        $verified = get_verified($row['sellerID']);
        if ($first) {
            $json .= '{"pid": "' . $row['pid'] . '", "addr": "' . $row['addr'] . '", "city": "' . $row['city'] . '", "state": "' . $row['state'] . '", "price": "' . $row['price'] . '", "photo": "' . $photo . '", "favorite": "' . $favorite . '", "verified": "' . $verified . '"}';
            $first = False;
        } else {
            $json .= ',{"pid": "' . $row['pid'] . '", "addr": "' . $row['addr'] . '", "city": "' . $row['city'] . '", "state": "' . $row['state'] . '", "price": "' . $row['price'] . '", "photo": "' . $photo . '", "favorite": "' . $favorite . '", "verified": "' . $verified . '"}';
        }
    }
    $result->free();
}
$json .= ']}';
echo $json;
function make_query()
{
    $params = array();
    $query = "SELECT * FROM PROPERTY";
    $first = True;