public static function mail($email, $mailroot, $data = array()) { if (!$email) { return 'Wrong email.'; } if (!$mailroot) { return; } //Когда нет указаний в конфиге... ничего такого... $tpl = '*user/user.mail.tpl'; $data['host'] = infra_view_getHost(); $data['path'] = infra_view_getRoot(); $data['email'] = $email; $data['time'] = time(); $data['site'] = $data['host'] . '/' . $data['path']; $subject = infra_template_parse($tpl, $data, $mailroot . '-subject'); $body = infra_template_parse($tpl, $data, $mailroot); return infra_mail_fromAdmin($subject, $email, $body); }
function yml_parse($data) { $gid = 0; $pid = 0; $gorups = array(); $poss = array(); $conf = infra_config(); if (!$conf['yml']) { die('Требуется конфиг yml'); } if (!$conf['yml']['name']) { die('В конфиге yml требуется указать name. Наименование компании без организационный формы'); } if (!$conf['yml']['company']) { die('В конфиге yml требуется указать company, название компании с организационной формой ООО и тп'); } xls_runPoss($data, function (&$pos) { $pos['Описание'] = yml_tostr($pos['Описание']); }); xls_runGroups($data, function (&$group, $i, &$parent) use(&$gid, &$groups) { $group['id'] = ++$gid; if ($parent) { $group['parentId'] = $parent['id']; } $groups[] =& $group; }); xls_runPoss($data, function (&$pos, $i, &$group) use(&$pid, &$poss) { $pos['id'] = ++$pid; $pos['categoryId'] = $group['id']; $poss[] =& $pos; }); $conf = infra_config(); $d = array("conf" => $conf, "site" => infra_view_getHost() . '/' . infra_view_getRoot(), "poss" => $poss, "groups" => $groups); $html = infra_template_parse('*yml/yml.tpl', $d); return $html; }
function infrajs_seo_init() { //Делается при каждой пробежки $store =& infrajs::store(); $store['seo'] = array(); $store['seolayer'] = array(); $conf = infra_config(); if (!$conf['seo']['seo']) { return; } if (!$conf['seo']['robots']) { return; } infra_admin_cache('infrajs_seo_init', function () { if (!infra_theme('robots.txt')) { $data = array(); $data['host'] = $_SERVER['HTTP_HOST']; $data['root'] = infra_view_getRoot(); $html = infra_template_parse('*seo/sitemap.tpl', $data, 'robots') . "\n"; $dirs = infra_dirs(); file_put_contents('robots.txt', $html); } }); }
$all = array(); $list = infrajs_seo_list(); foreach ($list as $name) { $seo = infrajs_seo_getSeo($name); $all = array_merge($all, $seo['all']); } $data['list'] = array(); foreach ($all as $k => $v) { if (!$k) { $data['list'][] = array('link' => $k); } else { $data['list'][] = array('link' => $k, 'q' => '?'); } } $data['host'] = $_SERVER['HTTP_HOST']; $data['root'] = infra_view_getRoot(); $data['date'] = time(); $html = infra_template_parse('*seo/sitemap.tpl', $data, 'sitemap'); return $html; }); header('content-type: application/xhtml+xml'); echo $html; exit; } } infra_admin(true); if ($submit) { infra_cache_no(); } if ($type == 'seo') { $list = infrajs_seo_list();
$data = array(); $seo = infra_loadJSON('*seo/seo.php?type=item&id=Главная страница'); infra_require('*files/files.inc.php'); if (!empty($seo['item']['title'])) { $data['title'] = $seo['item']['title']; } else { $data['title'] = 'Новостная лента ' . $_SERVER['HTTP_HOST']; } if (!empty($seo['item']['description'])) { $data['description'] = $seo['item']['description']; } else { $data['description'] = 'Новостная лента сайта ' . $_SERVER['HTTP_HOST']; } $data['time'] = infra_admin_time(); $data['link'] = 'http://' . infra_view_getHost() . '/' . infra_view_getRoot(); $conf = infra_config(); $exts = array('docx', 'tpl', 'mht', 'html'); $files = $conf['files']; $folders = array(array('dir' => $files['folder_blog'], 'link' => '?Блог/'), array('dir' => $files['folder_events'], 'link' => '?События/'), array('dir' => $files['folder_pages'], 'link' => '?')); $items = array(); infra_forr($folders, function ($fold) use($exts, &$items) { if (!$fold['dir']) { return; } $ar = files_list($fold['dir'], 0, 100, $exts); if (!$ar) { return; } $ar = array_values($ar); infra_forr($ar, function (&$itm) use($fold) {