protected function _anynomousAllowed()
 {
     $result = array();
     $query = "SELECT id\n\t\t\t\t\t\t\tFROM #__kunena_categories\n\t\t\t\t\t\t\tWHERE allow_anonymous=1;";
     $this->_db->setQuery($query);
     $allow_anonymous = $this->_db->loadResultArray();
     if ($this->_db->getErrorNum()) {
         $result = array('status' => '-1', 'error' => KunenaError::getDatabaseError());
     } else {
         $result['status'] = '1';
         $result['allowed_anonymous'] = $allow_anonymous;
     }
     return $result;
 }
Beispiel #2
0
function jotcache_upgrade(JDatabase $db)
{
    $message = '';
    $query = $db->getQuery(true);
    $query->select('COUNT(*)')->from('#__jotcache_exclude')->where('type=1');
    $tplex_count = $db->setQuery($query)->loadResult();
    if ($tplex_count == 0) {
        return false;
    }
    $query->clear('where');
    $query->where('type=4');
    $count = $db->setQuery($query)->loadResult();
    if ($count == 0) {
        $query->clear('select')->clear('where');
        $query->select($db->quoteName('value'))->from($db->quoteName('#__template_styles', 's'))->where('name=s.id')->where('type=1')->order('s.home');
        $defs = $db->setQuery($query)->loadResultArray();
        $positions = array();
        foreach ($defs as $def) {
            $def_array = unserialize($def);
            $positions = array_merge($positions, $def_array);
        }
        $query->clear();
        $query->select('position')->from('#__modules')->where('client_id = 0')->where('published = 1')->where('position <>' . $db->quote(''))->group('position')->order('position');
        $db->setQuery($query);
        $items = $db->loadResultArray();
        $cleaned_positions = array();
        foreach ($items as $item) {
            if (array_key_exists($item, $positions)) {
                $cleaned_positions[$item] = $positions[$item];
            }
        }
        $defs = serialize($cleaned_positions);
        $query->clear();
        $query->insert('#__jotcache_exclude')->columns('name,value,type')->values('1,' . $db->quote($defs) . ',4');
        if ($db->setQuery($query)->query()) {
            $message = "TABLE #__jotcache_exclude has been upgraded. Check JotCache TPL exclude definitions for correct values.";
        } else {
            JError::raiseNotice(100, $db->getErrorMsg());
        }
        return $message;
    }
}
 /**
  * Load an array of single field results into an array
  */
 function loadResultArray($numinarray = 0)
 {
     if (checkJversion() >= 2) {
         $result = $this->_db->loadColumn($numinarray);
     } else {
         $result = $this->_db->loadResultArray($numinarray);
     }
     return $this->_nullToArray($result);
 }