0) {
$row = mysqli_fetch_array($res);
$text = $row[$field];
$text = str_replace("
","",$text);
$text = str_replace("
","",$text);
$text = str_replace("","",$text);
$text = str_replace("
","",$text);
$text = str_replace("","",$text);
$text = str_replace("","",$text);
return $text;
}
else {
return 'No data available';
}
}
static function getAdminName() {
return $_SESSION['admin_user']->admin_real_name;
}
static function getAdminAccessLevels($selected='') {
self::dbconnect();
global $conn;
$result = mysqli_query($conn,"select * from azonics_roles where role_status='1' order by role_name asc;");
$temp = '';
if (mysqli_num_rows($result)>0) {
while ($row = mysqli_fetch_array($result)) {
if ($_SESSION['access_level'] == 11) {
if ($selected==$row['role_id']) {
$temp.= '';
}
else {
$temp.= '';
}
}
else if ($_SESSION['access_level'] == 13) {
if ($row['role_id'] == 14) {
$temp.= '';
}
}
}
}
else {
$temp.= '';
}
return $temp;
}
static function getUserTypes($selected='') {
self::dbconnect();
global $conn;
$result = mysqli_query($conn,"select * from azonics_user_types where user_type_status='1' order by user_type_name asc;");
$temp = '';
if (mysqli_num_rows($result)>0) {
while ($row = mysqli_fetch_array($result)) {
if ($selected==$row['user_type_id']) {
$temp.= '';
}
else {
$temp.= '';
}
}
}
else {
$temp.= '';
}
return $temp;
}
static function getUserTypeName($type='') {
self::dbconnect();
global $conn;
if ($type!='') {
$result = mysqli_query($conn,"select * from azonics_user_types where user_type_id='".$type."';");
if (mysqli_num_rows($result)>0) {
$row = mysqli_fetch_array($result);
return ''.$row['user_type_name'].'';
}
else {
return false;
}
}
else {
return false;
}
}
static function getUserState($user_id='') {
self::dbconnect();
global $conn;
if ($user_id!='') {
$result = mysqli_query($conn,"select * from users where id='".$user_id."';");
if (mysqli_num_rows($result)>0) {
$row = mysqli_fetch_array($result);
if ($row['status']=='1') {
return ' checked';
}
else {
return '';
}
}
else {
return '';
}
}
else {
return '';
}
}
static function getUserName($user_id='') {
self::dbconnect();
global $conn;
if ($user_id!='') {
$result = mysqli_query($conn,"select * from azonics_users where user_id='".$user_id."';");
if (mysqli_num_rows($result)>0) {
$row = mysqli_fetch_array($result);
return $row['user_first_name']." ".$row['user_last_name'];
}
else {
return '';
}
}
else {
return '';
}
}
static function getUserDefaultMailerState($user_id='') {
self::dbconnect();
global $conn;
if ($user_id!='') {
$result = mysqli_query($conn,"select * from azonics_users where user_id='".$user_id."';");
if (mysqli_num_rows($result)>0) {
$row = mysqli_fetch_array($result);
if ($row['user_default_mailer_status']=='1') {
return ' checked';
}
else {
return '';
}
}
else {
return '';
}
}
else {
return '';
}
}
static function checkAdminAccessToModule($module='') {
self::dbconnect();
global $conn;
if ($module!='') {
$result = mysqli_query($conn,"select * from azonics_modules_role where "
. "modrole_role_id='".$_SESSION['admin_user']->admin_access_level."' and "
. "modrole_module_id='".$module."' and "
. "modrole_status='1';");
if (mysqli_num_rows($result)>0) {
return true;
}
else {
return false;
}
}
else {
return false;
}
}
static function getMenu($parent=0) {
self::dbconnect();
global $conn;
$result = mysqli_query($conn,"select * from azonics_modules where module_status='1' and module_display_parent='".$parent."' order by display_order asc;") or die(mysql_error());
$resultObjects = null;
if (mysqli_num_rows($result)>0) {
while($row = mysqli_fetch_object($result)) {
if (self::checkAdminAccessToModule($row->module_id)) {
$resultObjects[] = $row;
}
}
return $resultObjects;
}
else {
return $resultObjects;
}
}
static function checkMenuActive($slug='') {
if (stristr($_SERVER['REQUEST_URI'],$slug)) {
return ' active';
}
else {
return '';
}
}
static function checkSubmenuActive($moduleID='') {
self::dbconnect();
global $conn;
$temp = explode('/',$_SERVER['REQUEST_URI']);
$slug = $temp[2];
$res_check = mysqli_query($conn,"select * from azonics_modules where module_controller='".$slug."' and module_status='1';");
if (mysqli_num_rows($res_check)>0) {
$row_check = mysqli_fetch_array($res_check);
if ($row_check['module_display_parent']==$moduleID) {
return ' active';
}
else {
return '';
}
}
else {
return '';
}
}
static function reloadAccount() {
self::dbconnect();
global $conn;
if ($_SESSION['admin_user']->admin_id!='') {
$res = mysqli_query($conn,"select * from azonics_admin_users where admin_id='".$_SESSION['admin_user']->admin_id."';");
if (mysqli_num_rows($res)>0) {
$_SESSION['admin_user'] = mysqli_fetch_object($res);
return true;
}
else {
return false;
}
}
else {
return false;
}
}
static function isLanguageModuleEnabled($admin_id='') {
self::dbconnect();
global $conn;
if ($admin_id!='') {
$res_module_access = mysqli_query($conn,"select * from "
. "azonics_modules, "
. "azonics_modules_role, "
. "azonics_admin_users where "
. "module_controller='translator' and "
. "module_status='1' and "
. "admin_id='".$admin_id."' and "
. "admin_status<>'0' and "
. "modrole_role_id=admin_access_level and "
. "modrole_module_id=module_id and "
. "modrole_status='1';");
if (mysqli_num_rows($res_module_access)>0) {
return true;
}
else {
return false;
}
}
else {
return false;
}
}
static function loadSystemSettings() {
self::dbconnect();
global $conn;
$res = mysqli_query($conn,"select * from azonics_settings where setting_status='1';");
if (mysqli_num_rows($res)>0) {
while ($row = mysqli_fetch_object($res)) {
$hash = $row->setting_name;
$data[$hash] = $row;
}
return $data;
}
else {
return false;
}
}
static function getSystemParam($paramName='') {
self::dbconnect();
global $conn;
$res = mysqli_query($conn,"select * from azonics_settings where setting_name='".$paramName."';");
if (mysqli_num_rows($res)>0) {
$row = mysqli_fetch_object($res);
if ($_SESSION['admin_lang'] == 'hu') {
return $row->setting_value_text;
}
else {
return $row->setting_value_text;
}
}
else {
return false;
}
}
static function getAccessLevelName($level_id='') {
self::dbconnect();
global $conn;
if ($level_id!='') {
$res = mysqli_query($conn,"select * from azonics_roles where role_id='".$level_id."';");
if (mysqli_num_rows($res)>0) {
$row = mysqli_fetch_array($res);
return ''.$row['role_name'].'';
}
else {
return '';
}
}
else {
return '';
}
}
static function checkForUpdates() {
global $config;
$update_xml_file = file_get_contents('http://updates.kreatio.hu/updates.php?key='.$config['licence_key']);
$update_xml = file_get_contents($update_xml_file);
if ($update_xml!='') {
$dom = simplexml_load_string($update_xml);
$ftp = ftp_connect('ftp.kreatio.hu');
$login = ftp_login($ftp,'updates@kreatio.hu','zTaD[fIGpgCI');
foreach ($dom->file as $file) {
ftp_get($ftp,$file['path'],$file['path'],FTP_ASCII);
}
return $dom->message;
}
else {
return '';
}
}
static function getSiteName($default='') {
self::dbconnect();
global $conn;
$res = mysqli_query($conn,"select * from azonics_settings where setting_name='SITENAME' and setting_status='1';");
if (mysqli_num_rows($res)>0) {
$row = mysqli_fetch_array($res);
return $row['setting_value_text'];
}
else {
return $default;
}
}
static function getPageName() {
self::dbconnect();
global $conn;
$res = mysqli_query($conn,"select * from azonics_settings where setting_name='PAGENAME' and setting_status='1';");
if (mysqli_num_rows($res)>0) {
$row = mysqli_fetch_array($res);
return $row['setting_value_text'];
}
else {
return '';
}
}
static function getBaseColorScheme($default='') {
self::dbconnect();
global $conn;
$res = mysqli_query($conn,"select * from azonics_settings where setting_name='COLOR' and setting_status='1';");
if (mysqli_num_rows($res)>0) {
$row = mysqli_fetch_array($res);
return $row['setting_value_text'];
}
else {
return $default;
}
}
static function getSlogan($default='') {
self::dbconnect();
global $conn;
$res = mysqli_query($conn,"select * from azonics_settings where setting_name='SLOGAN' and setting_status='1';");
if (mysqli_num_rows($res)>0) {
$row = mysqli_fetch_array($res);
return $row['setting_value_text'];
}
else {
return $default;
}
}
static function userComboBox($sel='') {
self::dbconnect();
global $conn;
$res = mysqli_query($conn,"select * from azonics_users where user_status<>'0' order by user_nick asc;");
$result = '';
if (mysqli_num_rows($res)>0) {
while ($row = mysqli_fetch_array($res)) {
if ($sel==$row['user_id']) {
$result.= '';
}
else {
$result.= '';
}
}
}
return $result;
}
static function getUserNameByID($user_id='') {
self::dbconnect();
global $conn;
$user_id = mysql_real_escape_string($user_id);
$res = mysqli_query($conn,"select * from azonics_users where user_id='".$user_id."';");
if (mysqli_num_rows($res)>0) {
$row = mysqli_fetch_array($res);
return $row['user_first_name'].' '.$row['user_last_name'].' ('.$row['user_nick'].')';
}
else {
return false;
}
}
static function categoryComboBox($sel='') {
self::dbconnect();
global $conn;
$res = mysqli_query($conn,"select * from azonics_categories where category_status<>'0' order by category_name asc;");
$result = '';
if (mysqli_num_rows($res)>0) {
while ($row = mysqli_fetch_array($res)) {
if ($sel==$row['category_id']) {
$result.= '';
}
else {
$result.= '';
}
}
}
return $result;
}
static function getProfileCategory($id='') {
self::dbconnect();
global $conn;
if ($id!='') {
$res = mysqli_query($conn,"select * from azonics_categories where category_id='".$id."';");
$row = mysqli_fetch_array($res);
return $row['category_name'];
}
else {
return false;
}
}
static function getProductStatus($status='',$pid='') {
if ($status=='1') {
return ''
. ''
. ''
. ''
. '
';
}
else if ($status=='3') {
return ''
. ''
. ''
. ''
. '
';
}
}
static function getProfileStatus($status='',$pid='') {
if ($status=='1') {
return ''
. ''
. ''
. ''
. '
';
}
else if ($status=='2') {
return ''
. ''
. ''
. ''
. '
';
}
else if ($status=='3') {
return ''
. ''
. ''
. ''
. '
';
}
}
static function getMainImage($pid) {
self::dbconnect();
global $conn;
$res2 = mysqli_query($conn,"select * from azonics_galeries where "
. "galery_design_id='".$pid."' and "
. "galery_status='1' and galery_main_image='1';");
if (mysqli_num_rows($res2)>0) {
$row2 = mysqli_fetch_array($res2);
return '
';
}
else {
return '
';
}
}
static function battleTypesOptions($sel='') {
self::dbconnect();
global $conn;
$res_bt = mysqli_query($conn,"select * from azonics_battle_types where "
. "battle_type_status='1' "
. "order by battle_type_name asc;");
$temp = '';
if (mysqli_num_rows($res_bt)>0) {
while ($row_bt = mysqli_fetch_array($res_bt)) {
if ($sel==$row_bt['battle_type_id']) {
$temp.= '';
}
else {
$temp.= '';
}
}
}
return $temp;
}
static function battleAwardsOptions($sel='') {
self::dbconnect();
global $conn;
$res_bw = mysqli_query($conn,"select * from azonics_awards where "
. "award_status='1' "
. "order by award_name asc;");
$temp = '';
if (mysqli_num_rows($res_bw)>0) {
while ($row_bw = mysqli_fetch_array($res_bw)) {
if ($sel==$row_bw['award_id']) {
$temp.= '';
}
else {
$temp.= '';
}
}
}
return $temp;
}
static function getBattleType($type_id='') {
self::dbconnect();
global $conn;
if ($type_id!='') {
$res_type = mysqli_query($conn,"select * from azonics_battle_types where battle_type_id='".$type_id."';");
if (mysqli_num_rows($res_type)>0) {
$row_type = mysqli_fetch_array($res_type);
return $row_type['battle_type_name'];
}
else {
return false;
}
}
else {
return false;
}
}
static function getBattleAward($award_id='') {
self::dbconnect();
global $conn;
if ($award_id!='') {
$res_award = mysqli_query($conn,"select * from azonics_awards where award_id='".$award_id."';");
if (mysqli_num_rows($res_award)>0) {
$row_award = mysqli_fetch_array($res_award);
return $row_award['award_name'];
}
else {
return false;
}
}
else {
return false;
}
}
static function generateSlug($name='') {
if ($name!='') {
$text = preg_replace('~[^\\pL\d]+~u', '-', $text);
$text = trim($text, '-');
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
$text = strtolower($text);
$text = preg_replace('~[^-\w]+~', '', $text);
if (empty($text)) return time();
return $text;
}
else {
return time();
}
}
static function getProductTags($product_category='') {
$tags = explode(",",$product_category);
foreach ($tags as $tag) {
if ($tag!='') $list.= ''.$tag.' ';
}
return $list;
}
static function getProductMeta($product_id='') {
self::dbconnect();
global $conn;
$list = '';
if ($product_id!='') {
$res = mysqli_query($conn,"select * from azonics_product_meta where "
. "meta_pid='".$product_id."' and "
. "meta_status='1' order by meta_date asc;");
if (mysqli_num_rows($res)>0) {
while ($row = mysqli_fetch_array($res)) {
$list.= ''
. ''
. ' | '
. ' | '
. ' | '
. '
';
}
}
}
return $list;
}
static function bannerZones($selectedZone='') {
$temp = '';
if ($selectedZone=='zone1') {
$temp.= '';
}
else {
$temp.= '';
}
return $temp;
}
static function getBannerZoneName($zone_id) {
if ($zone_id=='zone1') {
return lang::_('Speciális kínálat');
}
else {
return lang::_('Rólunk mondták');
}
}
static function trim_url($url) {
if ($url!='') {
$url = str_replace("http://","",$url);
}
return $url;
}
static function add_url_prefix($url) {
if ($url!='') {
$url = "http://".$url;
}
return $url;
}
static function get_category_selector($selected) {
self::dbconnect();
global $conn;
$res = mysqli_query($conn,"select * from azonics_categories where category_status='0' order by category_name asc;");
$options = '';
if (mysqli_num_rows($res)>0) {
while ($row = mysqli_fetch_object($res)) {
if ($_SESSION['category']=='') $_SESSION['category'] = $row->category_id;
if ($selected==$row->category_id) {
$options.= '';
}
else {
$options.= '';
}
}
}
if ($_SESSION['category']=='') $_SESSION['category'] = '0';
$options.= '';
return $options;
}
static function getLendingStatusByID($status_id='1',$field='ls_name') {
self::dbconnect();
global $conn;
if ($status_id!='') {
$res_item = mysqli_query($conn,"select * from mingo_lending_status where ls_id='".$status_id."';");
$row_item = mysqli_fetch_array($res_item);
return $row_item[$field];
}
else {
return false;
}
}
static function getLendingStatusCombo($selected='1',$lending_id='') {
self::dbconnect();
global $conn;
$res = mysqli_query($conn,"select * from mingo_lending_status where ls_status='1' order by ls_id asc;");
if ($selected=='') $selected='1';
$result = '';
$result.= '';
$result.= '
';
return $result;
}
static function lendingStatusComboBox($selected='') {
self::dbconnect();
global $conn;
$res = mysqli_query($conn,"select * from mingo_lending_status where ls_status='1' order by ls_id asc;");
if (mysqli_num_rows($res)>0) {
while ($row = mysqli_fetch_array($res)) {
if ($selected==$row['ls_id']) {
$result.= '';
}
else {
$result.= '';
}
}
}
else {
$result.= '';
}
return $result;
}
static function get_todos($show_all='all',$uid=0,$lending_id=0,$limit=10,$orderby='todo_date',$order='asc',$comments=false,$finished=true) {
self::dbconnect();
global $conn;
if ($comments==true) {
$comments_selector = " and todo_date<>'NULL'";
}
else {
$comments_selector = '';
}
if ($finished==false) {
$finish = " and todo_finished<>'1'";
}
else {
$finish = "";
}
if ($show_all=='all') {
$res = mysqli_query($conn,"select * from mingo_todos where todo_status='1'".$comments_selector." and todo_admin_id='".$_SESSION['admin_user']->admin_id."'".$finish." order by ".$orderby." ".$order." limit 0,".$limit.";");
}
elseif ($show_all=='users') {
$res = mysqli_query($conn,"select * from mingo_todos where todo_status='1'".$comments_selector." and todo_user_id<>'0' and todo_admin_id='".$_SESSION['admin_user']->admin_id."'".$finish." order by ".$orderby." ".$order." limit 0,".$limit.";");
}
elseif ($show_all=='lendings') {
$res = mysqli_query($conn,"select * from mingo_todos where todo_status='1'".$comments_selector." and todo_lending_id<>'0' and todo_admin_id='".$_SESSION['admin_user']->admin_id."'".$finish." order by ".$orderby." ".$order." limit 0,".$limit.";");
}
elseif ($uid>0) {
$res = mysqli_query($conn,"select * from mingo_todos where todo_status='1'".$comments_selector." and todo_user_id='".$uid."' and todo_admin_id='".$_SESSION['admin_user']->admin_id."'".$finish." order by ".$orderby." ".$order." limit 0,".$limit.";");
}
elseif ($lending_id>0) {
$res = mysqli_query($conn,"select * from mingo_todos where todo_status='1'".$comments_selector." and todo_lending_id='".$lending_id."' and todo_admin_id='".$_SESSION['admin_user']->admin_id."'".$finish." order by ".$orderby." ".$order." limit 0,".$limit.";");
}
if (mysqli_num_rows($res)>0) {
while ($row = mysqli_fetch_object($res)) {
$result[] = $row;
}
return $result;
}
else {
return false;
}
}
function get_todo_object($id) {
self::dbconnect();
global $conn;
$res = mysqli_query($conn,"select * from mingo_todos where todo_id='".$id."';");
if (mysqli_num_rows($res)>0) {
return mysqli_fetch_object($res);
}
else {
return false;
}
}
function get_group_options($group,$selected='') {
self::dbconnect();
global $conn;
$res = mysqli_query($conn,"SELECT * FROM sc_variants WHERE variant_group='".$group."' AND variant_status='1' ORDER BY variant_name ASC;");
$result = '';
if (mysqli_num_rows($res)>0) {
while ($row = mysqli_fetch_array($res)) {
if ($selected==$row['variant_id']) {
$result.= '';
}
else {
$result.= '';
}
}
}
return $result;
}
function get_rajz($cikkszam='') {
self::dbconnect();
global $conn;
if ($cikkszam!='') {
$res = mysqli_query($conn,"select * from sc_rajzok where rajz_cikkszam='".$cikkszam."' and rajz_status='1';");
if (mysqli_num_rows($res)>0) {
$row = mysqli_fetch_array($res);
return $row['rajz_file'];
}
else {
return false;
}
}
else {
return false;
}
}
function has_rajz($cikkszam='') {
self::dbconnect();
global $conn;
if ($cikkszam!='') {
$res = mysqli_query($conn,"select * from sc_rajzok where rajz_cikkszam='".$cikkszam."' and rajz_status='1';");
if (mysqli_num_rows($res)>0) {
return true;
}
else {
return false;
}
}
else {
return false;
}
}
function has_document($id) {
self::dbconnect();
global $conn;
if ($id!='') {
$res = mysqli_query($conn,"select * from sc_beszerzes where beszer_id='".$id."';");
if (mysqli_num_rows($res)>0) {
$row = mysqli_fetch_array($res);
return $row['beszer_document'];
}
else {
return false;
}
}
else {
return false;
}
}
function has_bill_image($bill_number='') {
self::dbconnect();
global $conn;
if ($bill_number!='') {
$res = mysqli_query($conn,"select * from sc_bills where bill_number='".$bill_number."' and bill_status='1';");
if (mysqli_num_rows($res)>0) {
return true;
}
else {
return false;
}
}
else {
return false;
}
}
function get_bill_image($bill_number='') {
self::dbconnect();
global $conn;
if ($bill_number!='') {
$res = mysqli_query($conn,"select * from sc_bills where bill_number='".$bill_number."' and bill_status='1';");
if (mysqli_num_rows($res)>0) {
$row = mysqli_fetch_array($res);
return $row['bill_image'];
}
else {
return false;
}
}
else {
return false;
}
}
function check_admin_access_to_action() {
if ($_SESSION['admin_user']->admin_access_level=='1') {
return true;
}
else {
return false;
}
}
function get_modules_select($selected='') {
self::dbconnect();
global $conn;
$res = mysqli_query($conn,"SELECT * FROM azonics_modules WHERE module_status='1' ORDER BY display_order ASC;");
$result = '';
if (mysqli_num_rows($res)>0) {
while ($row = mysqli_fetch_array($res)) {
if ($selected==$row['module_controller']) {
$result.= '';
}
else {
$result.= '';
}
}
}
return $result;
}
static function get_product_data($pid) {
self::dbconnect();
global $conn;
if ($pid!=='') {
$res = mysqli_query($conn,"SELECT * FROM products_temp WHERE id='".$pid."';");
if (mysqli_num_rows($res)>0) {
$row = mysqli_fetch_object($res);
$result = 'Termék név: '.$row->name.'
Brand: '.$row->brand.'
Part.no.: '.$row->part_no.'
Short desc.: '.$row->short_description.'
Price: '.$row->price.'
Type: '.$row->type;
return $result;
}
else {
return false;
}
}
else {
return false;
}
}
static function get_product_image($pid,$type) {
self::dbconnect();
global $conn;
if ($pid!=='' && $type!=='') {
$res = mysqli_query($conn,"SELECT * FROM products_temp WHERE id='".$pid."';");
if (mysqli_num_rows($res)>0) {
$row = mysqli_fetch_object($res);
if ($row->$type!==NULL) {
$result = '
';
}
else {
$result = ' - ';
}
return $result;
}
else {
return false;
}
}
else {
return false;
}
}
static function get_ertekkeszlet($kategoria,$mezo) {
self::dbconnect();
global $conn;
if ($kategoria!=='' && $mezo!=='') {
$res = mysqli_query($conn,"SELECT * FROM azonics_codomains WHERE kategoria='".$kategoria."' AND mezo='".$mezo."' AND status='1' ORDER BY ertek ASC;");
if (mysqli_num_rows($res)>0) {
while ($row = mysqli_fetch_array($res)) {
$result[] = $row['ertek'];
}
return $result;
}
else {
return false;
}
}
else {
return false;
}
}
static function get_category_factor($category) {
self::dbconnect();
global $conn;
if ($category!='') {
$res = mysqli_query($conn,"SELECT * FROM azonics_category_price_factors WHERE category='".$category."' AND status='1';");
if (mysqli_num_rows($res)>0) {
return mysqli_fetch_object($res);
}
else {
return false;
}
}
else {
return false;
}
}
static function get_velemenyek_by_agent_id($agentid) {
self::dbconnect();
global $conn;
if ($agentid!='') {
$res = mysqli_query($conn,"SELECT * FROM velemenyek WHERE agent_id='".$agentid."';");
return mysqli_num_rows($res);
}
else {
return 0;
}
}
}