function editCategory()
{
    global $option;
    $row =& JTable::getInstance('category', 'Table');
    $cid = JRequest::getVar('cid', array(0), '', 'array');
    $id = $cid[0];
    $row->load($id);
    HTML_classifieds::editCategory($row, $option);
}
Ejemplo n.º 2
0
function myAds($option)
{
    $query = "SELECT * FROM #__aard_config WHERE id ='1'";
    $db =& JFactory::getDBO();
    $db->setQuery($query);
    $rows = $db->loadObjectList();
    if ($db->getErrorNum()) {
        echo $db->stderr();
        return false;
    }
    foreach ($rows as $row) {
        $dayy = $row->days_shown;
        $currency = $row->currency;
    }
    $cat_name = JRequest::getVar('cat_name', 0);
    $user =& JFactory::getUser();
    $user_id = $user->get('id');
    $query = "SELECT a.id, a.impressions, a.ad_name, a.user_id, a.ad_state, a.contact_name, a.published, a.date_created, a.ad_img2small, a.ad_img1small, a.ad_price, a.ad_location, c.cat_name FROM #__aard_ads a, #__aard_cats c WHERE a.cat_id=c.id AND user_id = '" . $user_id . "'";
    $db->setQuery($query);
    $rows = $db->loadObjectList();
    if ($db->getErrorNum()) {
        echo $db->stderr();
        return false;
    }
    $query = "SELECT name FROM #__users WHERE id = '" . $user_id . "'";
    $db->setQuery($query);
    $names = $db->loadObjectList();
    $user =& JFactory::getUser();
    $user_id = $user->get('id');
    if ($user_id == 0) {
        echo ' <a href="index.php?option=com_user&view=login">Please log in.</a>';
    } else {
        HTML_classifieds::showmyAds($rows, $names, $dayy, $currency, $option);
    }
}