[Ищу] Oxy Classifieds Доска объявлений

Hi,

How can i fix this error?

Fatal error: Call to undefined function fetchRow() in /home/edvard/public_html/classifields/classes/languages.php on line 39

PHP:
<?php
 
class languages
{
 
    public function languages( )
    {
    }
 
    public function getcurrent( )
    {
        global $crt_lang;
        if ( isset( $crt_lang ) && $crt_lang && languages::languageExistsEnabled( $crt_lang ) )
        {
            $lang = $crt_lang;
        }
        else if ( isset( $_COOKIE['default_lang'] ) && $_COOKIE['default_lang'] && languages::languageExistsEnabled( $_COOKIE['default_lang'] ) )
        {
            $lang = $_COOKIE['default_lang'];
        }
        else
        {
            $lang = languages::getDefault( );
        }
        return $lang;
    }
 
    public function getlanguage( $id )
    {
        global $db;
        $array = fetchAssoc( "select * from ".TABLE_LANGUAGES." where id='{$id}'" );
        $array['characters_map_array'] = explode( ",", $array['characters_map'] );
        return $array;
    }
 
    public function getdefault( )
    {
        global $db;
        $default = fetchRow( "select `id` from ".TABLE_LANGUAGES." where `default`=1 limit 1" );
        if ( !$default )
        {
            $default = fetchRow( "select `id` from ".TABLE_LANGUAGES." limit 1" );
        }
        return $default;
    }
 
    public function getactivelanguages( )
    {
        global $db;
        $array = fetchAssocList( "select * from ".TABLE_LANGUAGES." where enabled=1 order by `order_no`" );
        return $array;
    }
 
    public function languageexistsenabled( $lang )
    {
        global $db;
        $no = fetchRow( "select id from ".TABLE_LANGUAGES." where id='{$lang}' and enabled=1" );
        if ( $no )
        {
            return 1;
        }
        return 0;
    }
 
    public function getlanguages( )
    {
        global $db;
        $array = fetchAssocList( "select * from ".TABLE_LANGUAGES." order by `order_no`" );
        $result = array( );
        $i = 0;
        foreach ( $array as $row )
        {
            $result[$i] = $row;
            $result[$i]['last'] = 0;
            ++$i;
        }
        if ( $i )
        {
            $result[$i - 1]['last'] = 1;
        }
        return $result;
    }
 
    public function getlanguageslist( )
    {
        global $db;
        $result = fetchRowList( "select id from ".TABLE_LANGUAGES." where `enabled`=1 order by `order_no`" );
        return $result;
    }
 
    public function getname( $id )
    {
        global $db;
        $name = fetchRow( "select `name` from ".TABLE_LANGUAGES." where `id` like '{$id}'" );
        return $name;
    }
 
    public function getflag( $id )
    {
        global $db;
        $flag = fetchRow( "select `image` from ".TABLE_LANGUAGES." where `id` like '{$id}'" );
        return $flag;
    }
 
    public function translatefieldselements( $result, $type )
    {
        global $crt_lang;
        $Var_120->languages( );
        $language = $Var_120;
        $lang_array = getLanguagesList( );
        if ( in_array( $result['language'], $lang_array ) )
        {
            $el_fields = array( "menu", "radio", "radio_group", "checkbox_group", "multiselect" );
            $Var_504->fields( $type );
            $fields = $Var_504;
            $fields_array = getFieldsLang( );
            foreach ( $fields_array as $f )
            {
                if ( $f[$crt_lang]['type'] == "depending" )
                {
                    $Var_1008->depending_fields( );
                    $dep = $Var_1008;
                    $dep_id = $f[$crt_lang]['dep_id'];
                    $dep_field = getDependingField( $dep_id );
                    $lang_from = $result['language'];
                    $lang_to = $crt_lang;
                    $d = 1;
                    while ( $d <= $dep_field['no'] )
                    {
                        $caption = $dep_field["caption".$d];
                        if ( isset( $result[$caption] ) )
                        {
                            $result[$caption] = translateField( $dep_id, $caption, $lang_from, $lang_to, escape( $result[$caption] ) );
                        }
                        ++$d;
                    }
                    continue;
                }
                if ( in_array( $f[$crt_lang]['type'], $el_fields ) && $result[$f[$crt_lang]['caption']] )
                {
                    $listing_lang_elem = $f[$result['language']]['elements'];
                    $listing_lang_arr = explode( "|", $listing_lang_elem );
                    $crt_lang_elem = $f[$crt_lang]['elements'];
                    $crt_lang_arr = explode( "|", $crt_lang_elem );
                    $old_elem = $result[$f[$crt_lang]['caption']];
                    $new_elem = array( );
                    if ( $f[$crt_lang]['type'] == "checkbox_group" || $f[$crt_lang]['type'] == "multiselect" )
                    {
                        $i = 0;
                        if ( !is_array( $old_elem ) )
                        {
                            $old_elem_exp = explode( "|", $old_elem );
                        }
                        else
                        {
                            $old_elem_exp = $old_elem;
                        }
                        foreach ( $listing_lang_arr as $el )
                        {
                            if ( in_array( $el, $old_elem_exp ) )
                            {
                                array_push( $new_elem, $crt_lang_arr[$i] );
                            }
                            ++$i;
                        }
                    }
                    else
                    {
                        $i = 0;
                        $c = count( $crt_lang_arr );
                        foreach ( $listing_lang_arr as $el )
                        {
                            if ( $el == $old_elem && $i < $c )
                            {
                                $new_elem = $crt_lang_arr[$i];
                                break;
                            }
                            ++$i;
                        }
                        if ( !$new_elem )
                        {
                            $new_elem = $old_elem;
                        }
                    }
                    $result[$f[$crt_lang]['caption']] = $new_elem;
                }
            }
        }
        return $result;
    }
 
}
 
?>


Thanks guys :)
 
Hi,

How can i fix this error?

Fatal error: Call to undefined function fetchRow() in /home/edvard/public_html/classifields/classes/languages.php on line 39

PHP:
<?php
 
class languages
{
 
    public function languages( )
    {
    }
 
    public function getcurrent( )
    {
        global $crt_lang;
        if ( isset( $crt_lang ) && $crt_lang && languages::languageExistsEnabled( $crt_lang ) )
        {
            $lang = $crt_lang;
        }
        else if ( isset( $_COOKIE['default_lang'] ) && $_COOKIE['default_lang'] && languages::languageExistsEnabled( $_COOKIE['default_lang'] ) )
        {
            $lang = $_COOKIE['default_lang'];
        }
        else
        {
            $lang = languages::getDefault( );
        }
        return $lang;
    }
 
    public function getlanguage( $id )
    {
        global $db;
        $array = fetchAssoc( "select * from ".TABLE_LANGUAGES." where id='{$id}'" );
        $array['characters_map_array'] = explode( ",", $array['characters_map'] );
        return $array;
    }
 
    public function getdefault( )
    {
        global $db;
        $default = fetchRow( "select `id` from ".TABLE_LANGUAGES." where `default`=1 limit 1" );
        if ( !$default )
        {
            $default = fetchRow( "select `id` from ".TABLE_LANGUAGES." limit 1" );
        }
        return $default;
    }
 
    public function getactivelanguages( )
    {
        global $db;
        $array = fetchAssocList( "select * from ".TABLE_LANGUAGES." where enabled=1 order by `order_no`" );
        return $array;
    }
 
    public function languageexistsenabled( $lang )
    {
        global $db;
        $no = fetchRow( "select id from ".TABLE_LANGUAGES." where id='{$lang}' and enabled=1" );
        if ( $no )
        {
            return 1;
        }
        return 0;
    }
 
    public function getlanguages( )
    {
        global $db;
        $array = fetchAssocList( "select * from ".TABLE_LANGUAGES." order by `order_no`" );
        $result = array( );
        $i = 0;
        foreach ( $array as $row )
        {
            $result[$i] = $row;
            $result[$i]['last'] = 0;
            ++$i;
        }
        if ( $i )
        {
            $result[$i - 1]['last'] = 1;
        }
        return $result;
    }
 
    public function getlanguageslist( )
    {
        global $db;
        $result = fetchRowList( "select id from ".TABLE_LANGUAGES." where `enabled`=1 order by `order_no`" );
        return $result;
    }
 
    public function getname( $id )
    {
        global $db;
        $name = fetchRow( "select `name` from ".TABLE_LANGUAGES." where `id` like '{$id}'" );
        return $name;
    }
 
    public function getflag( $id )
    {
        global $db;
        $flag = fetchRow( "select `image` from ".TABLE_LANGUAGES." where `id` like '{$id}'" );
        return $flag;
    }
 
    public function translatefieldselements( $result, $type )
    {
        global $crt_lang;
        $Var_120->languages( );
        $language = $Var_120;
        $lang_array = getLanguagesList( );
        if ( in_array( $result['language'], $lang_array ) )
        {
            $el_fields = array( "menu", "radio", "radio_group", "checkbox_group", "multiselect" );
            $Var_504->fields( $type );
            $fields = $Var_504;
            $fields_array = getFieldsLang( );
            foreach ( $fields_array as $f )
            {
                if ( $f[$crt_lang]['type'] == "depending" )
                {
                    $Var_1008->depending_fields( );
                    $dep = $Var_1008;
                    $dep_id = $f[$crt_lang]['dep_id'];
                    $dep_field = getDependingField( $dep_id );
                    $lang_from = $result['language'];
                    $lang_to = $crt_lang;
                    $d = 1;
                    while ( $d <= $dep_field['no'] )
                    {
                        $caption = $dep_field["caption".$d];
                        if ( isset( $result[$caption] ) )
                        {
                            $result[$caption] = translateField( $dep_id, $caption, $lang_from, $lang_to, escape( $result[$caption] ) );
                        }
                        ++$d;
                    }
                    continue;
                }
                if ( in_array( $f[$crt_lang]['type'], $el_fields ) && $result[$f[$crt_lang]['caption']] )
                {
                    $listing_lang_elem = $f[$result['language']]['elements'];
                    $listing_lang_arr = explode( "|", $listing_lang_elem );
                    $crt_lang_elem = $f[$crt_lang]['elements'];
                    $crt_lang_arr = explode( "|", $crt_lang_elem );
                    $old_elem = $result[$f[$crt_lang]['caption']];
                    $new_elem = array( );
                    if ( $f[$crt_lang]['type'] == "checkbox_group" || $f[$crt_lang]['type'] == "multiselect" )
                    {
                        $i = 0;
                        if ( !is_array( $old_elem ) )
                        {
                            $old_elem_exp = explode( "|", $old_elem );
                        }
                        else
                        {
                            $old_elem_exp = $old_elem;
                        }
                        foreach ( $listing_lang_arr as $el )
                        {
                            if ( in_array( $el, $old_elem_exp ) )
                            {
                                array_push( $new_elem, $crt_lang_arr[$i] );
                            }
                            ++$i;
                        }
                    }
                    else
                    {
                        $i = 0;
                        $c = count( $crt_lang_arr );
                        foreach ( $listing_lang_arr as $el )
                        {
                            if ( $el == $old_elem && $i < $c )
                            {
                                $new_elem = $crt_lang_arr[$i];
                                break;
                            }
                            ++$i;
                        }
                        if ( !$new_elem )
                        {
                            $new_elem = $old_elem;
                        }
                    }
                    $result[$f[$crt_lang]['caption']] = $new_elem;
                }
            }
        }
        return $result;
    }
 
}
 
?>


Thanks guys :)
Which version you are using?
 
Which version you are using?

Version: 7.05

And this error:
Fatal error: Call to a member function depending_fields() on a non-object in /home/gintaras/public_html/skelbimai/classes/fields.php on line 209

PHP:
public function getsearch( $type, $post_arr = "", $set = "" )
    {
        global $db;
        global $crt_lang;
        if ( $type == "quick" )
        {
            $where_str = " and `quick_search` = 1";
        }
        else
        {
            $where_str = " and `advanced_search` = 1";
        }
        if ( $set )
        {
            $where_str .= " and ( `fieldset` REGEXP '\\[\\[:<:\\]\\]{$set}\\[\\[:>:\\]\\]'  or `fieldset` = 0 ) ";
        }
        else if ( $type == "advanced" )
        {
            $where_str .= " and `fieldset` = 0 ";
        }
        $array = $db->fetchAssocList( "select * from `".$this->table."` LEFT JOIN `".$this->table."_lang` on `".$this->table."`.`id` = `".$this->table."_lang`.`id` where `lang_id` = '{$crt_lang}' and `active` = 1".$where_str." order by `order_no`" );
        $i = 0;
        $arr = array( );
        $this->multi_depending = "";
        foreach ( $array as $row )
        {
            foreach ( $row as $key => $value )
            {
                $row[$key] = clean( $row[$key] );
            }
            $arr[$i] = $row;
            $arr[$i]['size'] = str_replace( "x", "X", $arr[$i]['size'] );
            if ( strstr( $arr[$i]['size'], "X" ) )
            {
                $arr_size = explode( "X", $arr[$i]['size'] );
                $arr[$i]['cols'] = $arr_size[0];
                $arr[$i]['rows'] = $arr_size[1];
            }
            if ( trim( $row['elements'] ) )
            {
                $arr[$i]['elements_array'] = explode( "|", trim( $row['elements'] ) );
                $a = 0;
                while ( $a < count( $arr[$i]['elements_array'] ) )
                {
                    $arr[$i]['elements_array'][$a] = trim( $arr[$i]['elements_array'][$a] );
                    ++$a;
                }
            }
            if ( trim( $row['search_elements'] ) )
            {
                $arr[$i]['search_elements_array'] = explode( "|", trim( $row['search_elements'] ) );
                $a = 0;
                while ( $a < count( $arr[$i]['search_elements_array'] ) )
                {
                    $arr[$i]['search_elements_array'][$a] = trim( $arr[$i]['search_elements_array'][$a] );
                    ++$a;
                }
            }
            if ( $arr[$i]['type'] == "depending" )
            {
                $Var_4800->depending_fields( );
                $dep = $Var_4800;
                $depending = getDependingField( $arr[$i]['dep_id'] );
                $arr[$i]['depending'] = $depending;
                $arr[$i]['depending']['elements'] = getTable( $arr[$i]['depending']['table1'], $set );
                if ( strstr( $arr[$i]['fieldset'], "," ) || is_numeric( $arr[$i]['fieldset'] ) && $arr[$i]['fieldset'] != 0 )
                {
                    if ( $this->multi_depending )
                    {
                        $this->multi_depending .= ",";
                    }
                    $this->multi_depending .= $arr[$i]['dep_id'];
                }
                if ( isset( $post_arr[$arr[$i]['depending']['caption1']] ) && $post_arr[$arr[$i]['depending']['caption1']] )
                {
                    $fieldset = 0;
                    if ( $post_arr['category'] )
                    {
                        $fieldset = categories::getFieldset( $post_arr['category'] );
                    }
                    $dep_id1 = getIdByName( $arr[$i]['depending']['table1'], escape( $post_arr[$arr[$i]['depending']['caption1']] ), " and ( `set_id` REGEXP '\\[\\[:<:\\]\\]{$fieldset}\\[\\[:>:\\]\\]'  or `set_id` = 0 )" );
                    $arr[$i]['depending']['elements2'] = getSecondTable( $arr[$i]['depending']['table2'], $dep_id1 );
                }
                if ( 2 < $depending['no'] && isset( $post_arr[$arr[$i]['depending']['caption2']] ) && $post_arr[$arr[$i]['depending']['caption2']] )
                {
                    $dep_id2 = getIdByName( $arr[$i]['depending']['table2'], escape( $post_arr[$arr[$i]['depending']['caption2']] ), " and `dep`='{$dep_id1}'" );
                    $arr[$i]['depending']['elements3'] = getSecondTable( $arr[$i]['depending']['table3'], $dep_id2 );
                }
                if ( 3 < $depending['no'] && isset( $post_arr[$arr[$i]['depending']['caption3']] ) && $post_arr[$arr[$i]['depending']['caption3']] )
                {
                    $dep_id3 = getIdByName( $arr[$i]['depending']['table3'], escape( $post_arr[$arr[$i]['depending']['caption3']] ), " and `dep`='{$dep_id2}'" );
                    $arr[$i]['depending']['elements4'] = getSecondTable( $arr[$i]['depending']['table4'], $dep_id3 );
                }
            }
            if ( $arr[$i]['type'] == "date" )
            {
                $arr[$i]['date_format_standard'] = convertdateformat( $arr[$i]['date_format'] );
            }
            ++$i;
        }
        return $arr;
    }

Thanks guys for help ;)
 
How can i fix that: $auth = new $ && _11941478( ); and $dep = new $ && _11942840( ); ?? Version: 7.05

PHP:
  public function getall ( $set = "" ) {
        global $db;
        global $crt_lang;

    $auth = new $ && _11941478( );
    if ($auth->adminLoggedIn())
    {
        $is_admin = 1;
    }
    else
    {
        $is_admin = 0;
    }
    $where_str = "";
    if ( $set && $this->type == "cf" )
    {
        $where_str .= " and ( fieldset REGEXP '\\[\\[:<:\\]\\]{$set}\\[\\[:>:\\]\\]'  or fieldset = 0 ) ";
    }
    if ( $set == 0 - 1 && $this->type == "uf" )
    {
        $where_str .= " and `groups` = {$set}";
    }
    if ( $set && $set != 0 - 1 && $this->type == "uf" )
    {
        $where_str .= " and ( (`groups` REGEXP '\\[\\[:<:\\]\\]{$set}\\[\\[:>:\\]\\]' and `groups`!=-1)  or `groups` = 0 )";
    }
    if ( !$is_admin && $this->edit )
    {
        $where_str .= " and `editable` = 1";
    }
    $array = fetchAssocList( "select * from `".$this->table."` LEFT JOIN `".$this->table."_lang` on `".$this->table."`.`id` = `".$this->table."_lang`.`id` where `lang_id` = '{$crt_lang}'".$where_str." and `active` = 1 order by `order_no`" );
    $i = 0;
    $arr = array( );
    foreach ( $array as $row )
    {
        foreach ( $row as $key => $value )
        {
            $arr[$i][$key] = clean( $row[$key] );
        }
        if ( $this->type == "uf" )
        {
            $arr_gr = explode( ",", trim( $row['groups'] ) );
        }
        if ( $this->type == "cf" || $this->type == "uf" && ( !$set || $row['groups'] == 0 || in_array( $set, $arr_gr ) ) )
        {
            $arr[$i] = $row;
            $arr[$i]['size'] = str_replace( "x", "X", $arr[$i]['size'] );
            if ( strstr( $arr[$i]['size'], "X" ) )
            {
                $arr_size = explode( "X", $arr[$i]['size'] );
                $arr[$i]['cols'] = $arr_size[0];
                $arr[$i]['rows'] = $arr_size[1];
            }
            if ( trim( $row['elements'] ) )
            {
                $arr[$i]['elements_array'] = explode( "|", trim( $row['elements'] ) );
                $a = 0;
                while ( $a < count( $arr[$i]['elements_array'] ) )
                {
                    $arr[$i]['elements_array'][$a] = trim( $arr[$i]['elements_array'][$a] );
                    if ( $row['type'] == "checkbox_group" || $row['type'] == "multiselect" )
                    {
                        $arr[$i]['extra_elements_array'][$a]['name'] = $arr[$i]['elements_array'][$a];
                        $arr[$i]['extra_elements_array'][$a]['input_name'] = $arr[$i]['caption']."_".fields::clean_element( characters_map( $arr[$i]['elements_array'][$a] ) );
                    }
                    ++$a;
                }
            }
            if ( $this->type == "cf" && trim( $row['search_elements'] ) )
            {
                $arr[$i]['search_elements_array'] = explode( "|", trim( $row['search_elements'] ) );
                $a = 0;
                while ( $a < count( $arr[$i]['search_elements_array'] ) )
                {
                    $arr[$i]['search_elements_array'][$a] = trim( $arr[$i]['search_elements_array'][$a] );
                    ++$a;
                }
            }
            if ( $arr[$i]['type'] == "depending" )
            {
                $dep = new $ && _11942840( );
                $depending = getDependingField( $arr[$i]['dep_id'] );
                $arr[$i]['depending'] = $depending;
                $arr[$i]['depending']['elements'] = getTable( $arr[$i]['depending']['table1'], $set );
            }
            if ( $this->type == "uf" )
            {
                $arr[$i]['groups_array'] = explode( ",", trim( $row['groups'] ) );
                $a = 0;
                while ( $a < count( $arr[$i]['groups_array'] ) )
                {
                    $arr[$i]['groups_array'][$a] = trim( $arr[$i]['groups_array'][$a] );
                    ++$a;
                }
            }
            ++$i;
        }
    }
    return $arr;
}

Thangs for help ! ;)
 
I am not good in decoding :( But you can use above files to run your script properly...
 
What i need whatnge with $Var_72 ????? Please help guys ;(
$Var_72->auth( );
$auth = $Var_72;

Fatal error: Call to a member function auth() on a non-object in /home/heh/public_html/repo/classes/listings.php on line 1565


PHP:
  public function getnofavourites( )
    {
        global $db;
        $Var_72->auth( );
        $auth = $Var_72;
        if ( $user_id = crtUserId( ) )
        {
            $no = fetchRow( "select count(*) from ".TABLE_FAVOURITES." where user_id={$user_id}" );
        }
        else
        {
            $no = count( $_SESSION['favourites'] );
        }
        return $no;
    }
 
Hi, cant login to my user account it says: Invalid username or password! but when i change auth.php file with encode auth.php its working. Someone can help me? :) i thing something wrong with : public function haslogin( )?

PHP:
<?php
 
class auth
{
 
    public function auth( )
    {
    }
 
    public function haslogin( )
    {
        $this->username = $_POST[$this->post_index['user']];
        if ( $_POST[$this->post_index['pass']] )
        {
          $this->passhash = users::encode( $_POST[$this->post_index['pass']] );
        }
        $this->username = $this->_stripslashes( $this->username );
        $this->passhash = $this->_stripslashes( $this->passhash );
        return $this->checklogin( $this->username, $this->passhash );
    }
 
    public function checklogin( $user = null, $passhash = null )
    {
        if ( $user === null )
        {
            $user = $this->username;
        }
        if ( $passhash === null )
        {
            $passhash = $this->passhash;
        }
        global $config_abs_path;
        require_once( $config_abs_path."/classes/users.php" );
        $usr = new users( );
        return $usr->validAccount( $user, $passhash );
    }
 
    public function checkidentity( $user = null, $identity = null )
    {
        if ( $user === null )
        {
            $user = $this->username;
        }
        global $config_abs_path;
        require_once( $config_abs_path."/classes/users.php" );
        $usr = new users( );
        return $usr->checkIdentity( $user, $identity );
    }
 
    public function savelogin( $ip, $uid = null, $provider = null )
    {
        global $db;
        $_SESSION[$this->session_index['user']] = $this->username;
        $_SESSION[$this->session_index['pass']] = $this->passhash;
        if ( $uid )
        {
            $_SESSION[$this->session_index['user']] = $uid;
        }
        if ( $provider )
        {
            $this->username = $uid;
            $_SESSION[$this->session_index['user']] = $uid;
            $_SESSION[$this->session_index['pass']] = users::encode( $provider );
            $_SESSION['provider'] = $provider;
        }
        else
        {
            $_SESSION['provider'] = null;
            $_SESSION['identity'] = null;
        }
        $timestamp = date( "Y-m-d H:i:s" );
        $res = $db->query( "insert into ".TABLE_LOGIN_HISTORY." set username='{$this->username}', date_login = '{$timestamp}', ip = '{$ip}', succeeded = 1" );
        $this->admin_clearlogin( );
    }
 
    public function saveidentitylogin( $ip, $username, $auth_provider, $identity )
    {
        global $db;
        $arr = users::getUserPassWithIdentity( $identity, $auth_provider );
        $this->username = $arr['username'];
        $_SESSION[$this->session_index['user']] = $arr['username'];
        $_SESSION[$this->session_index['pass']] = $arr['password'];
        $_SESSION['provider'] = $auth_provider;
        $_SESSION['identity'] = $identity;
        $timestamp = date( "Y-m-d H:i:s" );
        $res = $db->query( "insert into ".TABLE_LOGIN_HISTORY." set username='{$this->username}', date_login = '{$timestamp}', ip = '{$ip}', succeeded = 1" );
        $this->admin_clearlogin( );
    }
 
    public function savefailedlogin( $ip )
    {
        global $db;
        $timestamp = date( "Y-m-d H:i:s" );
        $res = $db->query( "insert into ".TABLE_LOGIN_HISTORY." set username = '{$this->username}', date_login = '{$timestamp}', `ip` = '{$ip}', succeeded = 0" );
    }
 
    public function autologin( $user_id )
    {
        $usr = new users( );
        $username = $usr->getUsername( $user_id );
        $passhash = $usr->getPassHash( $user_id );
        $_SESSION[$this->session_index['user']] = $username;
        $_SESSION[$this->session_index['pass']] = $passhash;
        global $db;
        $external = $db->fetchAssoc( "select `identity`, `auth_provider` from ".TABLE_USERS." where id='{$user_id}'" );
        if ( $external )
        {
            $_SESSION[$this->session_index['pass']] = $passhash;
            if ( isset( $external['provider'] ) )
            {
                $_SESSION['provider'] = $external['provider'];
            }
            if ( isset( $external['identity'] ) )
            {
                $_SESSION['identity'] = $external['identity'];
            }
        }
        else
        {
            $_SESSION['provider'] = null;
            $_SESSION['identity'] = null;
        }
    }
 
    public function expire( $time )
    {
        $this->expire = $time;
        session_cache_limiter( "private" );
        session_cache_expire( $time / 60 );
    }
 
    public function clearlogin( )
    {
        unset( $_SESSION[$this->session_index['user']] );
        unset( $_SESSION[$this->session_index['pass']] );
    }
 
    public function _stripslashes( $text )
    {
        if ( get_magic_quotes_gpc( ) )
        {
            $text = stripslashes( $text );
        }
        return $text;
    }
 
    public function loggedin( )
    {
        if ( !isset( $_SESSION[$this->session_index['user']] ) || !isset( $_SESSION[$this->session_index['pass']] ) )
        {
            return 0;
        }
        if ( !$this->checklogin( $_SESSION[$this->session_index['user']], $_SESSION[$this->session_index['pass']] ) )
        {
            return 0;
        }
        return $_SESSION[$this->session_index['user']];
    }
 
    public function crtuser( )
    {
        return $_SESSION[$this->session_index['user']];
    }
 
    public function crtuserid( )
    {
        global $config_abs_path;
        require_once( $config_abs_path."/classes/users.php" );
        if ( !isset( $_SESSION[$this->session_index['user']] ) )
        {
            return 0;
        }
        $username = $_SESSION[$this->session_index['user']];
        $identity = $_SESSION['identity'];
        $usr = new users( );
        $user_id = $usr->getUserId( $username, $identity );
        return $user_id;
    }
 
    public function admin_haslogin( )
    {
        $this->username = $_POST[$this->admin_post_index['user']];
        $this->passhash = settings::encode( $_POST[$this->admin_post_index['pass']] );
        $this->username = $this->_stripslashes( $this->username );
        $this->passhash = $this->_stripslashes( $this->passhash );
        return $this->admin_checklogin( $this->username, $this->passhash );
    }
 
    public function admin_checklogin( $user = null, $passhash = null )
    {
        if ( $user === null )
        {
            $user = $this->username;
        }
        if ( $passhash === null )
        {
            $passhash = $this->passhash;
        }
        if ( !$user || !$passhash )
        {
            return 0;
        }
        global $settings;
        $admin_user = $settings['admin_username'];
        $admin_password = $settings['admin_password'];
        if ( $admin_user == $user && $admin_password == $passhash )
        {
            return 1;
        }
        return 0;
    }
 
    public function admin_savelogin( $ip )
    {
        global $db;
        $_SESSION[$this->admin_session_index['user']] = $this->username;
        $_SESSION[$this->admin_session_index['pass']] = $this->passhash;
        $_SESSION['provider'] = null;
        $_SESSION['identity'] = null;
        $timestamp = date( "Y-m-d H:i:s" );
        $res = $db->query( "insert into ".TABLE_LOGIN_HISTORY." set username = '{$this->username}', date_login = '{$timestamp}', `ip` = '{$ip}', succeeded = 1" );
        $this->clearlogin( );
    }
 
    public function adminloggedin( )
    {
        if ( !isset( $_SESSION[$this->admin_session_index['user']] ) || !isset( $_SESSION[$this->admin_session_index['pass']] ) )
        {
            return 0;
        }
        if ( !$this->admin_checklogin( $_SESSION[$this->admin_session_index['user']], $_SESSION[$this->admin_session_index['pass']] ) )
        {
            return 0;
        }
        return 1;
    }
 
    public function admin_clearlogin( )
    {
        if ( isset( $_SESSION[$this->admin_session_index['user']] ) )
        {
            unset( $_SESSION[$this->admin_session_index['user']] );
        }
        if ( isset( $_SESSION[$this->admin_session_index['pass']] ) )
        {
            unset( $_SESSION[$this->admin_session_index['pass']] );
        }
    }
 
    public function getlastlogin( $username )
    {
        global $db;
        global $appearance_settings;
        $date_format = $appearance_settings['date_format_long'];
        $arr = array( );
        $arr = $db->fetchAssoc( "select date_format(date_login, '{$date_format}') as date_login_nice, ip from ".TABLE_LOGIN_HISTORY." where username like '{$username}' and succeeded = 1 order by date_login desc limit 1" );
        return $arr;
    }
 
    public function getloginbefore( $username )
    {
        global $db;
        global $appearance_settings;
        $date_format = $appearance_settings['date_format_long'];
        $arr = array( );
        $arr = $db->fetchAssoc( "select date_format(date_login, '{$date_format}') as date_login_nice, ip from ".TABLE_LOGIN_HISTORY." where username like '{$username}' and succeeded = 1 order by date_login desc limit 1,1 " );
        return $arr;
    }
 
    public function authcount( $user )
    {
        global $db;
        $count = $db->fetchRow( "select count(*) from ".TABLE_LOGIN_HISTORY." where username like '{$user}'" );
        return $count;
    }
 
    public function getnoauthpages( $user, $no_per_page )
    {
        $total = $this->authCount( $user );
        if ( $total == 0 )
        {
            return 1;
        }
        return ceil( $total / $no_per_page );
    }
 
    public function getloginhistory( $user, $page, $no_per_page )
    {
        $start = ( $page - 1 ) * $no_per_page;
        global $appearance_settings;
        global $db;
        $date_format = $appearance_settings['date_format_long'];
        $arr = $db->fetchAssocList( "select *, date_format(date_login, '{$date_format}') as date_login_nice from ".TABLE_LOGIN_HISTORY." where username like '{$user}' order by date_login desc limit {$start}, {$no_per_page}" );
        $i = 0;
        $array = array( );
        foreach ( $arr as $result )
        {
            $array[$i] = $result;
            if ( $i % 2 )
            {
                $array[$i]['style'] = "_odd";
            }
            else
            {
                $array[$i]['style'] = "_even";
            }
            ++$i;
        }
        return $array;
    }
 
    public function deleteloginhistory( $user )
    {
        global $db;
        $db->query( "delete from ".TABLE_LOGIN_HISTORY." where username like '{$user}'" );
        return 1;
    }
 
    public function geterror( )
    {
        return $this->error;
    }
 
    public function adderror( $str )
    {
        $this->error .= $str;
    }
 
    public function seterror( $str )
    {
        $this->error = $str;
    }
 
}
 
?>
 
Не знаете как решить проблему с уведомлениями на майл. Мне ничего не приходить при публикации объявления.
 
Назад
Сверху