0 and ! order by !",array($where,$sort[$sort_ind])); } function getAllLimitCollection($start, $limit, $sort_ind=0, $sort_dir=0, $search_field='', $search_param='') { $d=($sort_dir)?' DESC':''; $sort=array("user_login{$d}", "user_role_id{$d},user_login{$d}", "name1{$d},name2{$d},user_login{$d}", "country{$d},user_login{$d}", "email{$d}", "phone{$d},user_login{$d}", "register_date{$d},user_login{$d}" ); if ($search_field=='user_login') $where="user_login like '{$search_param}%'"; elseif ($search_field=='name') $where="(name1 like '{$search_param}%' or name2 like '{$search_param}%')"; elseif ($search_field=='country') $where="country like '{$search_param}%'"; elseif ($search_field=='email') $where="email like '{$search_param}%'"; elseif ($search_field=='phone') $where="phone like '{$search_param}%'"; else $where='1'; $res=NPear::getAllAssoc("select *, date_format(register_date,'%d.%m.%Y') as date_create, concat(name1,' ',name2) as name from users where ! order by ! limit !,!",array($where,$sort[$sort_ind],$start,$limit)); for($i=0;$i?", array($login,$uid)); return $cnt>0; } function isEmailExists($email,$uid=0) { $cnt = NPear::getOne("select count(*) from users where email=? and user_id<>?", array($email,$uid)); return $cnt>0; } function insert($user) { NPear::query("insert into users set user_role_id=?, register_date=?, user_login=?, user_passwd=MD5(?), email=?, country=?, company=?, name1=?, name2=?, phone=?, fax=?, address=?", array($user["user_role_id"], date('Ymd'), $user["user_login"], $user["user_passwd"], $user["email"], $user["country"], $user["company"], $user["name1"], $user["name2"], $user["phone"], $user["fax"], $user["address"])); return NPear::getOne("SELECT LAST_INSERT_ID()"); } function update($user, $uid) { NPear::query("update users set user_role_id=?, user_login=?, email=?, country=?, company=?, name1=?, name2=?, phone=?, fax=?, address=? where user_id=? ", array($user["user_role_id"], $user["user_login"], $user["email"], $user["country"], $user["company"], $user["name1"], $user["name2"], $user["phone"], $user["fax"], $user["address"], $uid)); } function updatePassword($newpassw, $uid) { NPear::query("update users set user_passwd=MD5(?) where user_id=?", array($newpassw, $uid)); } function getIdByLoginAndPassword($f) { return NPear::getOne("select user_id from users where user_login=? and user_passwd=MD5(?)", array($f["login"],$f["password"])); } function getRole($uid) { return NPear::getOne("select user_role_id from users where user_id=?",array($uid)); } function checkAdmin($uid) { return NPear::getOne("select user_role_id from users where user_id=?",array($uid))==0; } function getCountryList() { return NPear::getCol('select distinct country from users order by country'); } } ?> $op) { $k=0; foreach($car['photos'] as $photo) if ($op['url']==$photo['url']) { $k=1; break; } if ($k) continue; CarsEntity::deletePhoto($op,$cid); } NPear::query("delete from photos where car_id=?",array($cid)); foreach($car['photos'] as $photo) { NPear::query("insert into photos set car_id=?, num=?, url=?",array($cid,$photo['num'],$photo['url'])); if (!$photo['old']) rename('../photos/tmp/'.$photo['url'], '../photos/'.$cid.'/'.$photo['url']); } } } function getPictLink($id,$p_no=0) { if (!$p_no) $p_no=NPear::getOne('select min(num) from photos where car_id=?',array($id)); $fn=NPear::getOne('select url from photos where car_id=? and num=?',array($id,$p_no)); return "photos/{$id}/{$fn}"; } function addOption($cid,$oid) { NPear::query("replace into options set car_id=?, option_id=?",array($cid,$oid)); } function deleteOption($cid,$oid) { NPear::query("delete from options where car_id=? and option_id=?",array($cid,$oid)); } function addViewed($cid,$uid) { $cnt=NPear::getOne("select cnt from viewed where car_id=? and user_id=?",array($cid,$uid))+1; NPear::query("replace into viewed set car_id=?, user_id=?, cnt=?",array($cid,$uid,$cnt)); } function addSaved($cid,$uid) { NPear::query("replace into saved set car_id=?, user_id=?",array($cid,$uid)); } function deleteSaved($cid,$uid) { NPear::query("delete from saved where car_id=? and user_id=?",array($cid,$uid)); } function addPhoto($photo,$cid) { $photo["num"]=NPear::getOne("select max(num)+1 from photos where car_id=?",array($cid)); if (!isset($photo["num"])) $photo["num"]=1; NPear::query("insert into photos set car_id=?, num=?, url=?",array($cid,$photo['num'],$photo['url'])); } function deletePhoto($photo,$cid) { if (file_exists('../photos/'.$cid.'/'.$photo['url'])) unlink('../photos/'.$cid.'/'.$photo['url']); NPear::query("delete from photos where car_id=? and num=?",array($cid,$photo['num'])); } function moveUpPhoto($photo,$cid) { if ($photo["num"]==1) return; $pm["num"]=NPear::getOne("select max(num) from photos where num0")<4; } function isMoreTop6() { return NPear::getOne("select count(*) from cars where top6>0")<5; } function insertOptionList($opt) { NPear::query("insert into options_list set sygn=?, fullname=?", array($opt["sygn"], $opt["fullname"])); return NPear::getOne("SELECT LAST_INSERT_ID()"); } function updateOptionList($opt,$oid) { NPear::query("update options_list set sygn=?, fullname=? where option_id=?", array($opt["sygn"], $opt["fullname"],$oid)); } function deleteOptionList($oid) { NPear::query("delete from options_list where option_id=?",array($oid)); } function getOptionList($oid) { return NPear::getARow("select * from options_list where option_id=?",array($oid)); } function getAllOptionsList($start=0, $limit=0) { if (!$start&&!$limit) return NPear::getAllAssoc("select * from options_list order by sygn"); else { $res=NPear::getAllAssoc("select * from options_list order by sygn limit !,!",array($start,$limit)); for ($i=0;$i0 group by c.car_id order by !",array($sort[$sort_ind])); for($i=0;$i0"); } function getTop6Collection($sort_ind=0, $sort_dir=0) { global $user_id; $d=($sort_dir)?' DESC':''; $sort=array("c.id{$d}", "c.stock{$d},c.id{$d}", "mk.name{$d},ml.name{$d},c.id{$d}", "ml.name{$d},c.id{$d}", "c.year{$d},c.id{$d}", "c.added{$d},c.id{$d}" ); $res=NPear::getAllAssoc("select c.*, date_format(c.added,'%d.%m.%Y') as date_create, mk.name as make, ml.name as model, sum(v.cnt) as viewed from cars c left join makes mk on mk.make_id=c.make_id left join models ml on ml.model_id=c.model_id left join viewed v on v.car_id=c.car_id where c.top6>0 group by c.car_id order by !",array($sort[$sort_ind])); for($i=0;$i0"); } function getSavedCollection($start, $limit, $sort_ind=0, $sort_dir=0, $make_id=0, $model_id=0, $reserved=0) { global $user_id; $d=($sort_dir)?' DESC':''; $sort=array("c.id{$d}", "c.stock{$d},c.id{$d}", "mk.name{$d},ml.name{$d},c.id{$d}", "ml.name{$d},c.id{$d}", "c.year{$d},c.id{$d}", "c.added{$d},c.id{$d}", "c.top4{$d},c.id{$d}", "c.top6{$d},c.id{$d}" ); $where=1; if ($make_id) $where='c.make_id='.$make_id; if ($model_id) $where='c.model_id='.$model_id; if ($reserved==-1) $where.=''; elseif ($reserved) $where.=' and c.reserved_id='.$reserved; else $where.=' and c.reserved_id is null'; $res=NPear::getAllAssoc("select c.*, date_format(c.added,'%d.%m.%Y') as date_create, mk.name as make, ml.name as model, sum(v.cnt) as viewed, date_format(c.reserved_date,'%d.%m.%Y') as reserved_date, concat(u.name1,' ',u.name2) as reserved_user, o.user_id from saved s left join cars c on s.car_id=c.car_id left join makes mk on mk.make_id=c.make_id left join models ml on ml.model_id=c.model_id left join viewed v on v.car_id=c.car_id left join users u on u.user_id=c.reserved_id left join orders o on o.car_id=c.car_id where s.user_id=? and ! group by c.car_id order by ! limit !,!",array($user_id,$where,$sort[$sort_ind],$start,$limit)); for($i=0;$i1; $show_limit=$cnt>10; if ($show_paging) { $start=$page_limit*($page_no-1); $end=(($start+$page_limit)>$cnt)?$cnt:($start+$page_limit); } else { $start=0; $end=$cnt; } NTemplate::assign("page_no", $page_no); NTemplate::assign("page_limit", $page_limit); NTemplate::assign("page_cnt", $page_cnt); NTemplate::assign("cnt", $cnt); NTemplate::assign("start", $start); NTemplate::assign("end", $end); NTemplate::assign("show_paging", $show_paging); NTemplate::assign("show_limit", $show_limit); NTemplate::assign("paging", UtilsEntity::getPaging($page_no,$page_cnt)); return $start; } function getPaging($page_no,$page_cnt) { $res=''; if ($page_no>1) $res.="<<   <  "; else $res.="<<   <  "; if (($page_no>5)&&($page_cnt>9)) { $st=$page_no-4; if ($st+9>$page_cnt) $st=$page_cnt-8; $res.="... "; } else $st=1; if (($page_no+4<$page_cnt)&&($page_cnt>9)) { $end=$page_no+4; if ($end<9) $end=9; } else $end=$page_cnt; for ($i=$st;$i<=$end;$i++) { if ($i==$page_no) $res.="{$i} "; else $res.="{$i} "; } if ($end<$page_cnt) $res.="... "; if ($page_no<$page_cnt) $res.=" >   >>"; else $res.=" >   >>"; return $res; } function correctBox($box) { $conv=''; for($i=0;$i='A')&&($box{$i}<='Z'))|| (($box{$i}>='a')&&($box{$i}<='z'))|| (($box{$i}>='0')&&($box{$i}<='9'))) $conv.=$box{$i}; return $conv; } function correctGrade($grade) { $conv=''; for($i=0;$i='A')&&($grade{$i}<='Z'))|| (($grade{$i}>='a')&&($grade{$i}<='z'))|| (($grade{$i}>='0')&&($grade{$i}<='9'))|| ($grade{$i}=='-')||($grade{$i}==' ')) $conv.=$grade{$i}; return trim($conv); } function convertJapan($str,$codepage="UTF-8") { $res=mb_convert_encoding($str,"HTML-ENTITIES",$codepage); return UtilsEntity::han_kaku_to_jen_kaku_he($res); } function arrayToCol($aArray,$col=4,$alph=false) { if(!sizeof($aArray)) return array(); $res=array(); if (sizeof($aArray)==2) { $res[0][0]=$aArray[0]; $res[1][0]=$aArray[1]; return($res); } if (sizeof($aArray)==3) { $res[0][0]=$aArray[0]; $res[0][1]=$aArray[2]; $res[1][0]=$aArray[1]; return($res); } if (sizeof($aArray)==4) { $res[0][0]=$aArray[0]; $res[0][1]=$aArray[2]; $res[1][0]=$aArray[1]; $res[1][1]=$aArray[3]; return($res); } $len=(int) ceil(sizeof($aArray)/$col); for($i=0;$i<$len;$i++) for($j=0;$j<$col;$j++) if(isset($aArray[$j*$len+$i])) $res[$i][$j]=$aArray[$j*$len+$i]; return $res; } function arrayToColRev($aArray,$col=4) { if(!sizeof($aArray)) return array(); $res=array(); if (sizeof($aArray)==2) { $res[0][0]=$aArray[0]; $res[0][1]=$aArray[1]; return($res); } if (sizeof($aArray)==3) { $res[0][0]=$aArray[0]; $res[0][1]=$aArray[1]; $res[0][2]=$aArray[2]; return($res); } if (sizeof($aArray)==4) { $res[0][0]=$aArray[0]; $res[0][1]=$aArray[1]; $res[0][2]=$aArray[2]; $res[0][3]=$aArray[3]; return($res); } $len=(int) ceil(sizeof($aArray)/$col); for($i=0;$i<$len;$i++) for($j=0;$j<$col;$j++) if(isset($aArray[$i*$col+$j])) $res[$i][$j]=$aArray[$i*$col+$j]; return $res; } function getAlphabetList($aArray,$key_field){ if (!sizeof($aArray)) return $res; $res=array(); $letter=''; foreach($aArray as $inp) { $str=$inp[$key_field]; if ($letter!=strtoupper($str{0})) { if (($str{0}<'A')&&($letter=='0')) { $res[]=$inp; continue; } $letter=strtoupper($str{0}); if ($letter<'A') $letter='0'; $res[]=array($key_field=>$letter,'alphabet'=>1); } $res[]=$inp; } return $res; } function getEnumValues($table,$col) { $res=NPear::getARow("SHOW COLUMNS FROM `!` LIKE ?",array($table,$col)); preg_match_all("/'(.*?)'/", $res['Type'], $matches); return $matches[1]; } function getWeekdays() { return array('','','','','','',''); } function getMonthes() { return array('','','','','','','','','','','',''); } function getEWeekdays() { return array('Mon','Tue','Wed','Thu','Fri','Sat','Sun'); } function getEMonthes() { return array('January','February','March','April','May','June','July','August','September','October','November','December'); } function translit($st) { $st=strtr($st,"_", "abvgdeeziyklmnoprstufh'iei"); $st=strtr($st,"Ũ_", "ABVGDEEZIYKLMNOPRSTUFH'IEI"); $st=strtr($st, array( ""=>"zh", ""=>"ts", ""=>"ch", ""=>"sh", ""=>"shch",""=>"", ""=>"yu", ""=>"ya", ""=>"ZH", ""=>"TS", ""=>"CH", ""=>"SH", ""=>"SHCH",""=>"", ""=>"YU", ""=>"YA", ""=>"i", ""=>"Yi", ""=>"ie", ""=>"Ye" ) ); return $st; } function han_kaku_to_jen_kaku_he($str){ $replace_of = array('ヴ','ガ','ギ','グ', 'ゲ','ゴ','ザ','ジ', 'ズ','ゼ','ゾ','ダ', 'ヂ','ヅ','デ','ド', 'バ','ビ','ブ','ベ', 'ボ','パ','ピ','プ','ペ','ポ'); $replace_by = array('ヴ','ガ','ギ','グ', 'ゲ','ゴ','ザ','ジ', 'ズ','ゼ','ゾ','ダ', 'ヂ','ヅ','デ','ド', 'バ','ビ','ブ','ベ', 'ボ','パ','ピ','プ','ペ','ポ'); $_result = str_replace($replace_of, $replace_by, $str); $replace_of = array('ア','イ','ウ','エ','オ', 'カ','キ','ク','ケ','コ', 'サ','シ','ス','セ','ソ', 'タ','チ','ツ','テ','ト', 'ナ','ニ','ヌ','ネ','ノ', 'ハ','ヒ','フ','ヘ','ホ', 'マ','ミ','ム','メ','モ', 'ヤ','ユ','ヨ','ラ','リ', 'ル','レ','ロ','ワ','ヲ', 'ン','ァ','ィ','ゥ','ェ', 'ォ','ヵ','ヶ','ャ','ュ', 'ョ','ッ','、','。','ー', '「','」','゙','゚'); $replace_by = array('ア','イ','ウ','エ','オ', 'カ','キ','ク','ケ','コ', 'サ','シ','ス','セ','ソ', 'タ','チ','ツ','テ','ト', 'ナ','ニ','ヌ','ネ','ノ', 'ハ','ヒ','フ','ヘ','ホ', 'マ','ミ','ム','メ','モ', 'ヤ','ユ','ヨ','ラ','リ', 'ル','レ','ロ','ワ','ヲ', 'ン','ァ','ィ','ゥ','ェ', 'ォ','ヶ','ヶ','ャ','ュ', 'ョ','ッ','、','。','ー', '「','」','”',''); $_result = str_replace($replace_of, $replace_by, $_result); $replace_of=array(); $replace_by=array(); for($i=0;$i<94;$i++) { $replace_of[]='&#'.(65281+$i).';'; $replace_by[]=chr(33+$i); } $_result = str_replace($replace_of,$replace_by,$_result); return $_result; } function getCountyList() { return array( 'Afghanistan', 'Albania', 'Algeria', 'American Samoa', 'Andorra', 'Angola', 'Anguilla', 'Antarctica', 'Antigua and Barbuda', 'Argentina', 'Armenia', 'Aruba', 'Ashmore and Cartier Islands', 'Australia', 'Austria', 'Azerbaijan', 'Bahamas', 'Bahrain', 'Baker Island', 'Bangladesh', 'Barbados', 'Bassas da India', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bermuda', 'Bhutan', 'Bolivia', 'Bosnia and Herzegovina', 'Botswana', 'Bouvet Island', 'Brazil', 'British Virgin Islands', 'Brunei', 'Bulgaria', 'Burkina Faso', 'Burundi', 'Cambodia', 'Cameroon', 'Canada', 'Cape Verde', 'Cayman Islands', 'Central African Republic', 'Chad', 'Chile', 'China', 'Christmas Island', 'Clipperton Island', 'Cocos Islands', 'Colombia', 'Comoros', 'Cook Islands', 'Coral Sea Islands', 'Costa Rica', 'Cote d\'Ivoire', 'Croatia', 'Cuba', 'Cyprus', 'Czech Republic', 'Denmark', 'Democratic Republic of the Congo', 'Djibouti', 'Dominica', 'Dominican Republic', 'East Timor', 'Ecuador', 'Egypt', 'El Salvador', 'Equatorial Guinea', 'Eritrea', 'Estonia', 'Ethiopia', 'Europa Island', 'Falkland Islands (Islas Malvinas)', 'Faroe Islands', 'Fiji', 'Finland', 'France', 'French Guiana', 'French Polynesia', 'French Southern and Antarctic Lands', 'Gabon', 'Gambia', 'Gaza Strip', 'Georgia', 'Germany', 'Ghana', 'Gibraltar', 'Glorioso Islands', 'Greece', 'Greenland', 'Grenada', 'Guadeloupe', 'Guam', 'Guatemala', 'Guernsey', 'Guinea', 'Guinea-Bissau', 'Guyana', 'Haiti', 'Heard Island and McDonald Islands', 'Honduras', 'Hong Kong', 'Howland Island', 'Hungary', 'Iceland', 'India', 'Indonesia', 'Iran', 'Iraq', 'Ireland', 'Isle of Man', 'Israel', 'Italy', 'Jamaica', 'Jan Mayen', 'Japan', 'Jarvis Island', 'Jersey', 'Johnston Atoll', 'Jordan', 'Juan de Nova Island', 'Kazakhstan', 'Kenya', 'Kingman Reef', 'Kiribati', 'Kerguelen Archipelago', 'Kosovo', 'Kuwait', 'Kyrgyzstan', 'Laos', 'Latvia', 'Lebanon', 'Lesotho', 'Liberia', 'Libya', 'Liechtenstein', 'Lithuania', 'Luxembourg', 'Macau', 'Macedonia', 'Madagascar', 'Malawi', 'Malaysia', 'Maldives', 'Mali', 'Malta', 'Marshall Islands', 'Martinique', 'Mauritania', 'Mauritius', 'Mayotte', 'Mexico', 'Micronesia', 'Midway Islands', 'Moldova', 'Monaco', 'Mongolia', 'Montenegro', 'Montserrat', 'Morocco', 'Mozambique', 'Myanmar', 'Namibia', 'Nauru', 'Navassa Island', 'Nepal', 'Netherlands', 'Netherlands Antilles', 'New Caledonia', 'New Zealand', 'Nicaragua', 'Niger', 'Nigeria', 'Niue', 'Norfolk Island', 'North Korea', 'North Sea', 'Northern Mariana Islands', 'Norway', 'Oman', 'Pakistan', 'Palau', 'Palmyra Atoll', 'Panama', 'Papua New Guinea', 'Paracel Islands', 'Paraguay', 'Peru', 'Philippines', 'Pitcairn Islands', 'Poland', 'Portugal', 'Puerto Rico', 'Qatar', 'Reunion', 'Republic of the Congo', 'Romania', 'Russia', 'Rwanda', 'Saint Helena', 'Saint Kitts and Nevis', 'Saint Lucia', 'Saint Pierre and Miquelon', 'Saint Vincent and the Grenadines', 'Samoa', 'San Marino', 'Sao Tome and Principe', 'Saudi Arabia', 'Senegal', 'Serbia', 'Seychelles', 'Sierra Leone', 'Singapore', 'Slovakia', 'Slovenia', 'Solomon Islands', 'Somalia', 'South Africa', 'South Georgia and the South Sandwich Islands', 'South Korea', 'Spain', 'Spratly Islands', 'Sri Lanka', 'Sudan', 'Suriname', 'Svalbard', 'Swaziland', 'Sweden', 'Switzerland', 'Syria', 'Taiwan', 'Tajikistan', 'Tanzania', 'Thailand', 'Togo', 'Tokelau', 'Tonga', 'Trinidad and Tobago', 'Tromelin Island', 'Tunisia', 'Turkey', 'Turkmenistan', 'Turks and Caicos Islands', 'Tuvalu', 'Uganda', 'Ukraine', 'United Arab Emirates', 'United Kingdom', 'USA', 'Uruguay', 'Uzbekistan', 'Vanuatu', 'Venezuela', 'Viet Nam', 'Virgin Islands', 'Wake Island', 'Wallis and Futuna', 'West Bank', 'Western Sahara', 'Yemen', 'Yugoslavia', 'Zambia', 'Zimbabwe' ); } function generatePassword ($PwdLength=8, $PwdType='standard') { // $PwdType can be one of these: // test .. .. .. always returns the same password = "test" // any .. .. .. returns a random password, which can contain strange characters // alphanum . .. returns a random password containing alphanumerics only // standard . .. same as alphanum, but not including l10O (lower L, one, zero, upper O) // $Ranges=''; if('test'==$PwdType) return 'test'; elseif('standard'==$PwdType) $Ranges='65-78,80-90,97-107,109-122,50-57'; elseif('alphanum'==$PwdType) $Ranges='65-90,97-122,48-57'; elseif('any'==$PwdType) $Ranges='40-59,61-91,93-126'; if ($Ranges<>'') { $Range=explode(',',$Ranges); $NumRanges=count($Range); mt_srand(time()); $p=''; for ($i = 1; $i <= $PwdLength; $i++) { $r=mt_rand(0,$NumRanges-1); list($min,$max)=explode('-',$Range[$r]); $p.=chr(mt_rand($min,$max)); } return $p; } } } ?> Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/dealing.co.jp/httpdocs/application/entity/user.php:88) in /var/www/vhosts/dealing.co.jp/httpdocs/_loader.php on line 21 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/vhosts/dealing.co.jp/httpdocs/application/entity/user.php:88) in /var/www/vhosts/dealing.co.jp/httpdocs/application/components/NSession/NSession.php on line 42 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/vhosts/dealing.co.jp/httpdocs/application/entity/user.php:88) in /var/www/vhosts/dealing.co.jp/httpdocs/application/components/NSession/NSession.php on line 42 Fatal error: Class 'CarsEntity' not found in /var/www/vhosts/dealing.co.jp/httpdocs/_loader.php on line 121