Example #1
0
 function find($id = null, $page = null, $perpage = null)
 {
     global $dba;
     if (is_numeric($id)) {
         $cond = "WHERE id = {$id}";
         $returnsingle = true;
     } elseif (is_array($id)) {
         $final = array();
         foreach ($id as $i) {
             array_push($final, $this->find($i));
         }
         return $final;
     } else {
         $cond = $id;
     }
     $this->get_table();
     if ($page != null && $perpage != null) {
         $limit = " LIMIT " . $page . "," . $perpage;
     } else {
         $limit = "";
     }
     $sql = "SELECT * from " . $this->tablename . " {$cond} {$limit} ";
     $sqlcount = "SELECT count(id) from " . $this->tablename . " {$cond}";
     $rscount = $dba->GetOne($sqlcount);
     $this->last_find_count = $rscount;
     if ($dba->debug || $dba->file_debug) {
         file_put_contents('logs/sql.log', "\n[" . date('m/d/y h:i:s A') . "] - " . $sql, FILE_APPEND);
     }
     $rs = $dba->GetAll($sql);
     $this->get_object_type();
     $obj_return = array();
     if (is_array($rs)) {
         foreach ($rs as $record) {
             $obj = new $this->obj_type();
             foreach ($record as $key => $value) {
                 $key = str_replace(" ", "_", $key);
                 $obj->{$key} = convert_smart_quotes(urldecode(stripslashes($value)));
                 if (substr($obj->{$key}, 0, 2) == 'a:') {
                     $obj->{$key} = unserialize($obj->{$key});
                     $obj->{$key} = strip_slashes_recursive($obj->{$key});
                 }
             }
             $obj->get_associated();
             $obj_return[] = $obj;
         }
     } else {
         return false;
     }
     if ($returnsingle) {
         return $obj_return[0];
     }
     return $obj_return;
 }
Example #2
0
function awpcp_display_the_classifieds_page_body($awpcppagename)
{
    global $hasregionsmodule;
    $output = '';
    if (!isset($awpcppagename) || empty($awpcppagename)) {
        $awpcppage = get_currentpagename();
        $awpcppagename = sanitize_title($awpcppage, $post_ID = '');
    }
    $output .= "<div id=\"classiwrapper\">";
    $uiwelcome = strip_slashes_recursive(get_awpcp_option('uiwelcome'));
    $output .= "<div class=\"uiwelcome\">{$uiwelcome}</div>";
    // Place the menu items
    $output .= awpcp_menu_items();
    if ($hasregionsmodule == 1) {
        $output .= awpcp_region_control_selector();
    }
    $output .= "<div class=\"classifiedcats\">";
    //Display the categories
    $params = array('show_in_columns' => get_awpcp_option('view-categories-columns'), 'show_empty_categories' => !get_awpcp_option('hide-empty-categories'), 'show_children_categories' => true, 'show_listings_count' => get_awpcp_option('showadcount'), 'show_sidebar' => true);
    $output .= awpcp_categories_list_renderer()->render($params);
    $output .= "</div>";
    $output .= "</div>";
    return $output;
}
Example #3
0
 public function get_option($name, $default = '', $reload = false)
 {
     // reload options
     if ($reload) {
         $this->load();
     }
     if (isset($this->options[$name])) {
         $value = $this->options[$name];
     } else {
         $value = $default;
     }
     // TODO: provide a method for filtering options and move there the code below.
     $strip_slashes_from = array('awpcpshowtheadlayout', 'sidebarwidgetaftertitle', 'sidebarwidgetbeforetitle', 'sidebarwidgetaftercontent', 'sidebarwidgetbeforecontent', 'adsense', 'displayadlayoutcode');
     if (in_array($name, $strip_slashes_from)) {
         $value = strip_slashes_recursive($value);
     }
     if (!is_array($value)) {
         $value = trim($value);
     }
     return $value;
 }
Example #4
0
function get_adtitle($adid)
{
    return strip_slashes_recursive(get_adfield_by_pk('ad_title', $adid));
}