trytofly
Писатель
- Регистрация
- 12 Июн 2012
- Сообщения
- 0
- Реакции
- 0
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
Thanks guys
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