Example #1
0
    function updArtlFormHlr($title = false, $sef = false, $category_id = false, $description = false, $content = false, $meta_key_words = false, $meta_description = false, $stamp = false)
    {
        $prs = compact("title", "sef", "category_id", "description", "content", "meta_key_words", "meta_description");
        foreach ($prs as $k => $p) {
            if ($p === false) {
                $prs[$k] = $_REQUEST['my_' . $k];
            }
        }
        if ($prs['sef'] == '') {
            $prs['sef'] = $prs['title'];
        }
        $prs['sef'] = get_sef_title($prs['sef']);
        $prs['sef'] = strtolower(mysql_escape_string($prs['sef']));
        $prs['id'] = intval($_REQUEST['id']);
        if ($stamp === false) {
            $prs['stamp'] = cvr_date2stamp();
        }
        // CUT
        $more = cvr_get_flag($prs['content'], '<!--more-->');
        $pagebreaker = cvr_get_flag($prs['content'], '<div style="page-break-after: always;">
	<span style="display: none;">&nbsp;</span></div>');
        if ($more !== false) {
            $prs['description'] = substr($prs['content'], 0, $more);
        } elseif ($pagebreaker !== false) {
            $prs['description'] = substr($prs['content'], 0, $pagebreaker);
        }
        if (strpos(strtolower($prs['content']), "</pre>") !== false) {
            $prs['pre_content'] = $prs['content'];
            if (GESHI) {
                $prs['content'] = preg_replace_callback("!<pre lang=\"(.*?)\">(.*?)</pre>!si", geshi_syntax, $prs['content']);
            }
        } else {
            $prs['pre_content'] = '';
        }
        //Обработчики
        foreach ($prs as $k => $p) {
            $prs[$k] = mysql_escape_string(killMagic($p));
        }
        $prs['category_id'] = intval($prs['category_id']);
        $prs['id'] = intval($prs['id']);
        return $prs;
    }
Example #2
0
         // Отправляем письма в цикле по получателям.
         foreach ($tos as $to) {
             // Заменяем элементы шаблона.
             $mail = $tpl;
             $mail = strtr($mail, array("{TO}" => trim($to['email']), "{TEXT}" => $text, "{CODE}" => $to['id']));
             $mail = mailenc($mail);
             mailx($mail);
         }
         $mes = my_lang('adm_sub_success');
         //Сохраняем выпуск в БД
         $arch = $stor->make('subarch');
         $reg = Registry::instance();
         $u = $reg->get('hamster_info');
         $args = array();
         $args['text'] = mysql_escape_string(killMagic($text));
         $args['stamp'] = cvr_date2stamp();
         $args['author_id'] = $u['id'];
         $arch->setProps($args);
         $r = $arch->add();
     }
 }
 // редактор шаблона рассылки
 if ($_REQUEST['actmf'] == "re_sub_tmpl") {
     $loot = $stor->make('loot');
     $loot->setProperty('suptitle', 'sub_tmpl');
     $args = array();
     $args = array('suptext' => mysql_escape_string(killMagic($_REQUEST['new_sub_tmpl'])));
     $loot->setProps($args);
     $r_upd = $loot->upd($args);
     if ($r_upd) {
         $mes = my_lang('adm_sub_t3');