_getCatalogStructure(); $categories = []; foreach ($s['base'] as $cat_id=>$v){ $categories[] = ''.Category::getName($v).''; } /* /**/ $offers = []; $info = static::$SHOP->_getItems(); $cats_items = static::$SHOP->_getItemCategories(array_keys($info['items'])); foreach ($info['items'] as $v){ $img = \Site::sectionUrl( substr( static::$SHOP->_autologo($v[Image::$URL]), 1), true); $id = $v[Item::$ID]; $cat_id = $cats_items[$id][0]; if(!$s['base'][$cat_id]) continue; $descr = ( $c = $v[Item::$TEXT] ) ? $c :'Нет описания'; $offers[] = ' '.Item::getName($v).' '.\Site::sectionUrl(substr(static::getItemLinkForTurboShop($v),1),true).' '.$v['price'].' RUR '.$cat_id.' true '.$img.' '.($descr?' ':'').' '; } $res = ''."\n". ' '.static::getNameForTurboShop().' '.static::getCompanyForTurboShop().' '.\Site::sectionUrl('',true).' '.implode($categories).' '.implode($offers).' '; return $res; } static function echoMerchant(){ $info = static::$SHOP->_getItems(); $res = []; $isUpdate = boolval($_GET['update']); if ($isUpdate) { $res []= "id\tavailability\tprice"; } else { $res []= "id\ttitle\tdescription\tlink\timage_link\tavailability\tcondition\tprice"; } $prepare = function($t){ return '"'.strip_tags(str_replace(array("
",","),array(" ","."),$t)).'"'; }; foreach ($info['items'] as $v){ $code = "item".$v[Item::$ID]; if($isUpdate){ $res[] = implode("\t",[ $code, "in stock", $v['price'].' RUB' ]); } else { $img = Image::imageResize($v[Image::$URL],1000,0,95); $res[] = implode("\t",[ $code, $prepare( Item::getName($v) ), $prepare( $v[Item::$TEXT]?:'Описание отсутствует' ), \Site::sectionUrl(substr(static::getItemLinkForMerchant($v),1),true), \Site::sectionUrl(substr($img,1),true), "in stock", "new", $v['price'].' RUB' ]); } } echo implode("\n",$res); } static function echoMerchantXML(){ $info = static::$SHOP->_getItems(); $res = []; $items = ''; $title = static::getNameForGoogleMerchant(); $structure = static::$SHOP->_getCatalogStructure(); foreach ($info['items'] as $v){ $code = "item".$v[Item::$ID]; $img = Image::imageResize($v[Image::$URL],1000,0,95); $link = static::getItemLinkForMerchant($v); $url = explode("/",$link); array_pop($url); array_pop($url); array_shift($url); $cat = static::$SHOP->_getCategoryByURL($url); $path = static::$SHOP->_getCategoryPath($cat[Category::$ID]); $crumbs = ['Главная']; foreach ($path as $part){ $crumbs[] = Category::getName($structure['base'][$part]); } $items.=' item'.$v[Item::$ID].' '.Item::getName($v).' '.strip_tags($v[Item::$TEXT]).' '.\Site::sectionUrl(substr($link,1),true).' '.\Site::sectionUrl(substr($img,1),true).' new in stock '.$v['price'].' RUB'.' 2899 '.implode(">",$crumbs).' '.$title.' Анна '; } $res = ' '.$title.' '.\Site::$domen.' '.static::getDescriptionForGoogleMerchant().' '.$items.' '; //* header("Content-Type: text/xml"); //header("Expires: Thu, 19 Feb 1998 13:24:18 GMT"); header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Cache-Control: post-check=0,pre-check=0"); header("Cache-Control: max-age=0"); header("Pragma: no-cache"); echo $res; /**/ } static function sitemap():array{return [];} static function getSitemap(){ $a = static::sitemap(); $res = ''; foreach ($a as $v){ $imgs = ''; if($v['images']){ foreach ($v['images'] as $img){ $img = trim($img); if($img) { $imgs .= '' . $img . ''; } } } $res .= '' .(($c = $v['link'])? ''.$c.'' :'') .(($c = $v['date'])? ''.$c.'' :'') .(($c = $v['change'])? ''.$c.'' :'') .(($c = $v['prior'])? ''.$c.'' :'') .$imgs .''; } return ''.$res.''; } static function getProfileAuthHash($acc){return null;} static function getCashbackPercent($order_id):float{ $res = 0; if(static::$SHOP){ $group_id = intval(static::$SHOP->data_for_theme[Shop::$CASHBACK_GROUP]); if($group_id and IF_PROFILE){ $cashback = CashbackProfile::get(PID,$group_id); if($cashback) { $res = cfloatval($cashback[Cashback::$PERCENT])/100; } } else { $res = floatval(static::$SHOP->data_for_theme[Shop::$CASHBACK_VALUE]) / 100; } } return $res; } static function getLastReactJSPath(){ $path = \Core::$FOLDER.( $res = \Site::$themeAbsPath.'js/react/' ); $handle = opendir($path); $LAST_JS = 0; $folders = []; if ($handle){ while(false !== ($file = readdir($handle))) { if(is_numeric($file)) { $int = intval($file); $LAST_JS = max( $LAST_JS, $int ); $folders[] = $int; } } } foreach ($folders as $v){ $p = $path.$v.'/'; if($v!=$LAST_JS) { $handle = opendir($p); while(false !== ($file = readdir($handle))) { $f = $p.$file; if(is_file($f)) { unlink($f); } } rmdir($p); } } return $res.$LAST_JS.'/'; } static function getProfileHash($key,$profile) {return md5($key.SALT.$profile[\Profile::$PASSWORD].SALT.static::$themeUrl); } static function checkRemind($profile_id,$key,$hash){ $res = null; $profile_id = intval($profile_id); $profile = \Profile::getByID($profile_id); $key = intval($key); $hash2 = static::getProfileHash($key,$profile); if($key + 60*60*24 < time()){ $res = 'В целях безопасности время на смену пароля ограничено и действие подтверждающих данных уже истекло. Начните восстановление пароля заново.'; } else if(strcmp($hash,$hash2)!=0) { $res = 'Неверные подтверждающие коды.'; } return $res; } static function getRemindLink($profile){ $key = time(); $id = $profile[\Profile::$ID]; $hash = static::getProfileHash($key,$profile); return \Site::sectionUrl(static::PAGE_PROFILE.'/'.static::PAGE_NEWS_PASS.'/'.$id.'/'.$key.'/'.$hash.'/', true); } static function checkGoogleCaptcha($google_token){ $res = ['e'=>0,'m'=>'']; if($_SERVER['HTTP_HOST']=='julliflo.in') return $res; if(static::$google_captcha_secret and !$google_token) { $res = ['e'=>1,'m'=>'Не прислан гугл токен капчи']; } if(static::$google_captcha_secret and $google_token){ if ($curl = curl_init()) { $url = 'https://www.google.com/recaptcha/api/siteverify'; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, [ 'secret' => static::$google_captcha_secret, 'response' => $google_token, ]); $out = curl_exec($curl); curl_close($curl); $r = json_decode($out, true); if ($r['success']) { if ($r['score'] < 0.7) { sendEasyMail('Google Captcha', 'no-reply@'.$_SERVER['HTTP_HOST'], 'Виктор', '79175032799@ya.ru', 'UTF-8', 'UTF-8', 'Google Captcha Error', json_encode($_GET).'
'.json_encode($_POST).'
'.json_encode($_REQUEST).'
'.json_encode($r),'html'); $res['e'] = 1; $res['m'] = 'Не пройдена гугл капча'; $f = fopen(dirname(__FILE__).'/captcha.txt','a+'); fwrite($f,date('Y.m.d H:i:s')."\n".json_encode($_GET)."\n".json_encode($_POST)."\n".json_encode($_SERVER)."\n".json_encode($r)."\n\n"); fclose($f); } } else { $res['e'] = 1; $res['m'] = 'Не пройдена гугл капча'; } $res['google'] = $r; } } return $res; } static function getEmailWrap():string { return ''; } static function sendEmailRemind($profile){ Email::sendRemindPassword( static::$EMAIL_REMIND_PASSWORD->id_for_theme, $profile, static::getRemindLink($profile), static::getEmailWrap(), $profile[\Profile::$LOGIN], $profile[\Profile::$NAME] ); } // Получение различных списков для формы настроек static function getEmailsForForm(){ $r = Email::select([ \Query::WHERE => new \Where(\Where::_operator(Email::$ACCOUNT,'=',UID)) ],false); $emails = []; while($l = \DB::fetch($r)){ $emails[ $l[Email::$TYPE] ][ $l[Email::$ID] ] = Email::getName($l); } return $emails; } static function getBlogsForForm(){ return Blog::getNameList([ \Query::WHERE => new \Where(\Where::_operator(Blog::$ACCOUNT,'=',UID)) ]); } static function getKbaseForForm(){ return Kbase::getNameList([ \Query::WHERE => new \Where(\Where::_operator(Kbase::$ACCOUNT,'=',UID)) ]); } static function getDomainsGroupForForm(){ return ModerationDomainsGroup::getNameList([ \Query::WHERE => new \Where(\Where::_operator(ModerationDomainsGroup::$ACCOUNT,'=',UID)) ]); } static function prepare() { $data = static::$data; $a = static::getOptions(); foreach ($a as $k=>$v){ $x = strtoupper($k); if($v[eThemeOption::CONTROLLER]) { if( $id = intval( $data[$k] ) ) { switch ($v[eThemeOption::CONTROLLER]){ case 'common\image': if($data[$k]) static::$$x = Image::getByID($data[$k]); break; default: static::$$x = new $v[eThemeOption::CONTROLLER]; static::$$x->id_for_theme = $id; static::$$x->owner_id = static::$owner_id; static::$$x->data_for_theme = $v[eThemeOption::CONTROLLER]::getByID(intval($id)); } } } else { static::$$x = $data[$k]; } } } static function getForm(){return [];} static function getOptions():array{return [];} static function getSystemLangValues():array{return [];} function __construct($data=[]) { static::$data = $data; //static::prepare(); } static function getYML():string{return '';} static function getTurbo():YandexTurbo{ return new YandexTurbo(); } static function sendEmailRegistration($id){} static function favicon($img){ $path = \Site::$themeAbsPath.'favicon'.$img[Image::$ID].".ico"; $full_path = \Core::$FOLDER.$path; if(!file_exists($full_path) and $img) { $ico_lib = new \PHP_ICO( \Core::$FOLDER.$img[Image::$ORIGINAL], array(array(16, 16), array(24, 24), array(32, 32), array(48, 48))); $r = $ico_lib->save_ico($full_path); } return $path; } static function init($theme_id,$data=[],$owner_id = 0):Theme{ static::$START_INIT = microtime(true); static::$data = $data; static::$owner_id = intval($owner_id); switch ($theme_id) { case eThemes::KADIGARDEN: $res = new Kadigarden($data); break; case eThemes::TEST: $res = new Test($data); break; case eThemes::LASHBELONG: $res = new Lashbelong($data); break; case eThemes::KBASE: $res = new KnowledgeBase($data); break; case eThemes::ACADEMY: $res = new AcademyTheme($data); break; case eThemes::FIXGARDEN: $res = new Fixgarden($data); break; case eThemes::LANDING: $res = new Lander($data); break; case eThemes::INSTAPLANNER: $res = new InstaPlanner($data); break; case eThemes::PAPOROTNIK: $res = new Paporotnik($data); break; case eThemes::OPR: $res = new Opr($data); break; case eThemes::DSEK: $res = new Dsek($data); break; case eThemes::MODULEBZ: $res = new Modulebz($data); break; case eThemes::COMPARE: $res = new Compare($data); break; case eThemes::SOVA: $res = new Sova($data); break; case eThemes::BERGAMOT: $res = new Bergamot($data); break; case eThemes::ROOTS_SCHOOL: $res = new RootsSchool($data); break; case eThemes::KPTRACKING: $res = new KPTracking($data); break; case eThemes::MYBOOKS: $res = new MyBooks($data); break; case eThemes::EVENTHUNT: $res = new EventHunt($data); break; case eThemes::BOUQUET: $res = new Bouquet($data); break; case eThemes::PROJECTMAN: $res = new Projectman($data); break; case eThemes::JULLIFLO: $res = new Julliflo($data); break; case eThemes::ARZUANOV: $res = new Arzumanov($data); break; case eThemes::FIXGARDEN_FIR: $res = new Fixgarden_Fir($data); break; case eThemes::MSTOME: $res = new Mstome($data); break; case eThemes::VARUS: $res = new Varus($data); break; case eThemes::ROTARBLOG: $res = new RotarBlog($data); break; case eThemes::CIRCLEOFLIGHT: $res = new CircleOfLight($data); break; case eThemes::APICLUB: $res = new ApiClub($data); break; case eThemes::JULLIFLOCRM: $res = new JullifloCRM($data); break; case eThemes::MERAKOM: $res = new Merakom($data); break; case eThemes::THEPIROG: $res = new ThePirog($data); break; case eThemes::GVOZDIKOV: $res = new Gvozdikov($data); break; case eThemes::STRATEGYFOUND: $res = new StrategyFound($data); break; case eThemes::TIMER: $res = new Timer($data); break; case eThemes::STRATEGYFORUM: $res = new StrategyForum($data); break; case eThemes::TASKCRM: $res = new TaskCRM($data); break; case eThemes::DAILYBOUQUET: $res = new DailyBouquet($data); break; case eThemes::VEDSTAT: $res = new VedStat($data); break; case eThemes::COVID2019: $res = new Covid2019($data); break; case eThemes::ROOTS: $res = new Roots($data); break; case eThemes::ROOTS_CRM: $res = new RootsCRM($data); break; case eThemes::COSMO: $res = new Cosmo($data); break; case eThemes::CHANGE_BLOG: $res = new ChangeBlog($data); break; case eThemes::BBFLOWERS: $res = new BBFlowers($data); break; case eThemes::ABOK_SCHOOL: $res = new ABOKSchool($data); break; case eThemes::ACTIVE_USER: $res = new ActiveUser($data); break; case eThemes::STEPCOURSE: $res = new StepCourse($data); break; case eThemes::JIVAYA_SREDA: $res = new JivayaSreda($data); break; case eThemes::KABOYASHI: $res = new Kaboyashi($data); break; case eThemes::MERAKOM_RU: $res = new MerakomRu($data); break; case eThemes::PETRALINE: $res = new Petraline($data); break; case eThemes::GULMARKET: $res = new Gulmarket($data); break; case eThemes::SOLIST: $res = new Solist($data); break; case eThemes::BEAUTY_MARKET: $res = new BeautyMarket($data); break; case eThemes::AZBUKA_PERIL : $res = new AzbukaPeril($data); break; case eThemes::MONTELUXE : $res = new MonteLuxe($data); break; case eThemes::STREETGURU : $res = new StreetGuru($data); break; case eThemes::MINICOURSE : $res = new MiniCourse($data); break; case eThemes::FIXGARDENCRM : $res = new FixgardenCRM($data); break; case eThemes::HEADWAY : $res = new Headway($data); break; case eThemes::ELECTROSIEMENS : $res = new ElectroSiemens($data); break; case eThemes::SENSE_FLOWERS : $res = new SenseFlowers($data); break; case eThemes::ZLATOMEBEL : $res = new ZlatoMebel($data); break; case eThemes::VHL : $res = new VHL($data); break; case eThemes::ALEX_SHADOW : $res = new AlexShadow($data); break; case eThemes::METAL_BASE : $res = new MetalBase($data); break; case eThemes::MANY_QUESTS : $res = new ManyQuests($data); break; case eThemes::TOMSKY : $res = new Tomsky($data); break; case eThemes::ALSOR : $res = new Alsor($data); break; case eThemes::FNEWS : $res = new Fnews($data); break; case eThemes::MERAKOM_BASE : $res = new MerakomBase($data); break; case eThemes::MERAKOM_IS : $res = new Merakomis($data); break; case eThemes::FLAVOMARKET : $res = new FlavoMarket($data); break; case eThemes::MESOIGLI : $res = new MesoIgli($data); break; case eThemes::VEDRATING : $res = new VedRating($data); break; case eThemes::FIXGARDEN_GAZON: $res = new Fixgarden_Gazon($data); break; case eThemes::PHOTOFIX : $res = new Photofix($data); break; case eThemes::FIXGARDEN_ECOFIR : $res = new Fixgarden_Ecofir($data); break; case eThemes::FIXGARDEN_SNOW : $res = new Fixgarden_Snow($data); break; case eThemes::BURPAR : $res = new BurPar($data); break; case eThemes::GEEKAPP : $res = new GeekApp($data); break; case eThemes::SARKKO : $res = new Sarkko($data); break; case eThemes::FIXGARDEN_DESIGN :$res = new Fixgarden_Design($data); break; case eThemes::FIXGARDEN_WATER :$res = new Fixgarden_Water($data); break; case eThemes::IQPRO :$res = new Iqpro($data); break; default: $res = new Theme($data); } static::$self = $res; static::$options = static::getOptions(); return static::$self; } static function install(){ foreach (self::$modules as $v){ /** @var msModuleTable $class */ $class = static::$module_prefix.'\\'.$v; $class::install(); } static::migrate(); } static function migrate(){ foreach (static::$modules as $v){ /** @var msModuleTable $class */ $class = static::$module_prefix.'\\'.$v; $class::createTable(); $class::checkColumns(true); $class::installLangValues($class::getSystemLangValues(),['isUpdate'=>true]); $class::installUniques(); } $s = static::getSystemLangValues(); \Module::installLangValues(static::getSystemLangValues(),['isUpdate'=>true]); } }