Beispiel #1
0
 /**
  * Basic delete. It returns false if the keys from $where doesn't
  * match with the fields defined in the construct
  * 
  * @access public
  * @since unknown
  * @param array $where
  * @return mixed It returns the number of affected rows if the delete has been 
  * correct or false if an error happended
  */
 function delete($where)
 {
     if (!$this->checkFieldKeys(array_keys($where))) {
         return false;
     }
     $this->dao->from($this->getTableName());
     $this->dao->where($where);
     return $this->dao->delete();
 }
Beispiel #2
0
function seo_get_row($itemID)
{
    $conn = DBConnectionClass::newInstance();
    $c_db = $conn->getOsclassDb();
    $comm = new DBCommandClass($c_db);
    $comm->select();
    $comm->from(SEO_PLUGIN_ITEM_META_TABLE);
    $comm->where('fk_i_item_id', $itemID);
    $rs = $comm->get();
    if ($rs === false) {
        return false;
    }
    if ($rs->numRows() != 1) {
        return false;
    }
    return $detail = $rs->row();
}
Beispiel #3
0
function osc_search_footer_links()
{
    if (!osc_rewrite_enabled()) {
        return array();
    }
    $categoryID = osc_search_category_id();
    if (!empty($categoryID)) {
        if (Category::newInstance()->isRoot(current($categoryID))) {
            $cat = Category::newInstance()->findSubcategories(current($categoryID));
            if (count($cat) > 0) {
                $categoryID = array();
                foreach ($cat as $c) {
                    $categoryID[] = $c['pk_i_id'];
                }
            }
        }
    }
    if (osc_search_city() != '') {
        return array();
    }
    $regionID = '';
    if (osc_search_region() != '') {
        $aRegion = Region::newInstance()->findByName(osc_search_region());
        if (isset($aRegion['pk_i_id'])) {
            $regionID = $aRegion['pk_i_id'];
        }
    }
    $conn = DBConnectionClass::newInstance();
    $data = $conn->getOsclassDb();
    $comm = new DBCommandClass($data);
    $comm->select('i.fk_i_category_id');
    $comm->select('l.*');
    $comm->select('COUNT(*) AS total');
    $comm->from(DB_TABLE_PREFIX . 't_item as i');
    $comm->from(DB_TABLE_PREFIX . 't_item_location as l');
    if (!empty($categoryID)) {
        $comm->whereIn('i.fk_i_category_id', $categoryID);
    }
    $comm->where('i.pk_i_id = l.fk_i_item_id');
    $comm->where('i.b_enabled = 1');
    $comm->where('i.b_active = 1');
    $comm->where(sprintf("dt_expiration >= '%s'", date('Y-m-d H:i:s')));
    $comm->where('l.fk_i_region_id IS NOT NULL');
    $comm->where('l.fk_i_city_id IS NOT NULL');
    if ($regionID != '') {
        $comm->where('l.fk_i_region_id', $regionID);
        $comm->groupBy('l.fk_i_city_id');
    } else {
        $comm->groupBy('l.fk_i_region_id');
    }
    $rs = $comm->get();
    if (!$rs) {
        return array();
    }
    return $rs->result();
}