コード例 #1
0
ファイル: custom.users.php プロジェクト: hiptc/custom-users
 function user_title($count, $title)
 {
     global $config;
     if ($count and dle_strlen($title, $config['charset']) > $count) {
         $title = dle_substr($title, 0, $count, $config['charset']);
         if ($temp_dmax = dle_strrpos($title, ' ', $config['charset'])) {
             $title = dle_substr($title, 0, $temp_dmax, $config['charset']);
         }
     }
     return $title;
 }
コード例 #2
0
 /**
  * @param        $data    - контент
  * @param        $limit
  * @param string $etc     - Окончание обрезанного текста
  * @param bool   $wordcut - жесткое ограничение символов
  *
  * @param string $charset
  *
  * @return string $data - обрезанный результат
  */
 public static function textLimit($data, $limit, $etc = '…', $wordcut = false, $charset = 'utf-8')
 {
     $data = strip_tags($data, '<br>');
     $data = trim(str_replace(['<br>', '<br />'], ' ', $data));
     if ($limit && dle_strlen($data, $charset) > $limit) {
         $data = dle_substr($data, 0, $limit, $charset) . $etc;
         if (!$wordcut && ($word_pos = dle_strrpos($data, ' ', $charset))) {
             $data = dle_substr($data, 0, $word_pos, $charset) . $etc;
         }
     }
     return $data;
 }
コード例 #3
0
ファイル: show.full.php プロジェクト: Gordondalos/union
             $tpl->copy_template = str_replace("[/xfgiven_{$value[0]}]", "", $tpl->copy_template);
         }
         $xfieldsdata[$value[0]] = stripslashes($xfieldsdata[$value[0]]);
         if ($config['allow_links'] and $value[3] == "textarea" and function_exists('replace_links')) {
             $xfieldsdata[$value[0]] = replace_links($xfieldsdata[$value[0]], $replace_links['news']);
         }
         $tpl->copy_template = str_replace("[xfvalue_{$value[0]}]", $xfieldsdata[$value[0]], $tpl->copy_template);
         if (preg_match("#\\[xfvalue_{$preg_safe_name} limit=['\"](.+?)['\"]\\]#i", $tpl->copy_template, $matches)) {
             $count = intval($matches[1]);
             $xfieldsdata[$value[0]] = str_replace("</p><p>", " ", $xfieldsdata[$value[0]]);
             $xfieldsdata[$value[0]] = strip_tags($xfieldsdata[$value[0]], "<br>");
             $xfieldsdata[$value[0]] = trim(str_replace("<br>", " ", str_replace("<br />", " ", str_replace("\n", " ", str_replace("\r", "", $xfieldsdata[$value[0]])))));
             if ($count and dle_strlen($xfieldsdata[$value[0]], $config['charset']) > $count) {
                 $xfieldsdata[$value[0]] = dle_substr($xfieldsdata[$value[0]], 0, $count, $config['charset']);
                 if ($temp_dmax = dle_strrpos($xfieldsdata[$value[0]], ' ', $config['charset'])) {
                     $xfieldsdata[$value[0]] = dle_substr($xfieldsdata[$value[0]], 0, $temp_dmax, $config['charset']);
                 }
             }
             $tpl->set($matches[0], $xfieldsdata[$value[0]]);
         }
     }
 }
 $category_id = $row['category'];
 $tpl->compile('content');
 if ($user_group[$member_id['user_group']]['allow_hide']) {
     $tpl->result['content'] = str_ireplace("[hide]", "", str_ireplace("[/hide]", "", $tpl->result['content']));
 } else {
     $tpl->result['content'] = preg_replace("#\\[hide\\](.+?)\\[/hide\\]#ims", "<div class=\"quote\">" . $lang['news_regus'] . "</div>", $tpl->result['content']);
 }
 if ($config['allow_banner'] and count($banner_in_news) and !$view_template) {
     foreach ($banner_in_news as $name) {
コード例 #4
0
ファイル: functions.inc.php プロジェクト: Hadryan/L2LWEB
function create_metatags($story)
{
    global $config, $db;
    $keyword_count = 20;
    $newarr = array();
    $headers = array();
    $quotes = array("\"", "`", "\t", '\\n', '\\r', "\n", "\r", '\\', ",", ".", "/", "¬", "#", ";", ":", "@", "~", "[", "]", "{", "}", "=", "-", "+", ")", "(", "*", "^", "%", "\$", "<", ">", "?", "!", '"');
    $fastquotes = array("\"", "`", "\t", "\n", "\r", '"', '\\r', '\\n', "\$", "{", "}", "[", "]", "<", ">");
    $story = preg_replace("#\\[hide\\](.+?)\\[/hide\\]#is", "", $story);
    $story = preg_replace("'\\[attachment=(.*?)\\]'si", "", $story);
    $story = preg_replace("'\\[page=(.*?)\\](.*?)\\[/page\\]'si", "", $story);
    $story = str_replace("{PAGEBREAK}", "", $story);
    $story = str_replace("&nbsp;", " ", $story);
    $story = str_replace('<br />', ' ', $story);
    $story = strip_tags($story);
    $story = preg_replace("#&(.+?);#", "", $story);
    $story = trim(str_replace(" ,", "", $story));
    if (trim($_REQUEST['meta_title']) != "") {
        $headers['title'] = trim(htmlspecialchars(strip_tags(stripslashes($_REQUEST['meta_title']))));
        $headers['title'] = $db->safesql(str_replace($fastquotes, '', $headers['title']));
    } else {
        $headers['title'] = "";
    }
    if (trim($_REQUEST['descr']) != "") {
        $headers['description'] = dle_substr(strip_tags(stripslashes($_REQUEST['descr'])), 0, 190, $config['charset']);
        $headers['description'] = $db->safesql(str_replace($fastquotes, '', $headers['description']));
    } else {
        $story = str_replace($fastquotes, '', $story);
        $headers['description'] = $db->safesql(dle_substr(stripslashes($story), 0, 190, $config['charset']));
    }
    if (trim($_REQUEST['keywords']) != "") {
        $headers['keywords'] = $db->safesql(str_replace($fastquotes, " ", strip_tags(stripslashes($_REQUEST['keywords']))));
    } else {
        $story = str_replace($quotes, ' ', $story);
        $arr = explode(" ", $story);
        foreach ($arr as $word) {
            if (dle_strlen($word, $config['charset']) > 4) {
                $newarr[] = $word;
            }
        }
        $arr = array_count_values($newarr);
        arsort($arr);
        $arr = array_keys($arr);
        $total = count($arr);
        $offset = 0;
        $arr = array_slice($arr, $offset, $keyword_count);
        $headers['keywords'] = $db->safesql(implode(", ", $arr));
    }
    return $headers;
}
コード例 #5
0
ファイル: categories.php プロジェクト: Hadryan/L2LWEB
HTML;
    echofooter();
    die;
} elseif ($action == "doedit") {
    if ($_REQUEST['user_hash'] == "" or $_REQUEST['user_hash'] != $dle_login_hash) {
        die("Hacking attempt! User not found");
    }
    $quotes = array("'", "\"", "`", "\t", "\n", "\r", '"');
    $cat_name = $db->safesql(htmlspecialchars(strip_tags(stripslashes($_POST['cat_name'])), ENT_QUOTES));
    $skin_name = trim(totranslit($_POST['skin_name'], false, false));
    $cat_icon = $db->safesql(htmlspecialchars(strip_tags(stripslashes($_POST['cat_icon'])), ENT_QUOTES));
    $alt_cat_name = totranslit(stripslashes($_POST['alt_cat_name']), true, false);
    $catid = intval($_POST['catid']);
    $parentid = intval($_POST['parentid']);
    $meta_title = $db->safesql(htmlspecialchars(strip_tags(stripslashes($_POST['meta_title']))));
    $description = $db->safesql(dle_substr(strip_tags(stripslashes($_POST['descr'])), 0, 200, $config['charset']));
    $keywords = $db->safesql(str_replace($quotes, " ", strip_tags(stripslashes($_POST['keywords']))));
    $short_tpl = totranslit(stripslashes(trim($_POST['short_tpl'])));
    $full_tpl = totranslit(stripslashes(trim($_POST['full_tpl'])));
    if (in_array($_POST['news_sort'], array("date", "rating", "news_read", "title"))) {
        $news_sort = $db->safesql($_POST['news_sort']);
    } else {
        $news_sort = "";
    }
    if (in_array($_POST['news_msort'], array("ASC", "DESC"))) {
        $news_msort = $db->safesql($_POST['news_msort']);
    } else {
        $news_msort = "";
    }
    if ($_POST['news_number'] > 0) {
        $news_number = intval($_POST['news_number']);
コード例 #6
0
		/**
		 * @param $data - контент
		 * @param $length - максимальный размер возвращаемого контента
		 * 
		 * @return $data - обрезанный результат 
		 */
		public function textLimit($data, $count)
		{
			if ($this->config['text_limit'] != '0') 
			{	
				$data = strip_tags($data, '<br>');
				$data = trim(str_replace( array('<br>','<br />'), ' ', $data));

				if($count && dle_strlen($data, $this->dle_config['charset'] ) > $count)
				{
					$data = dle_substr( $data, 0, $count, $this->dle_config['charset'] ). '&hellip;';					
					if( !$this->config['wordcut'] && ($word_pos = dle_strrpos( $data, ' ', $this->dle_config['charset'] )) ) 
						$data = dle_substr( $data, 0, $word_pos, $this->dle_config['charset'] ). '&hellip;';

				}
			}
			return $data;
		}
コード例 #7
0
ファイル: massactions.php プロジェクト: Hadryan/L2LWEB
        if ($old['autor'] != $row['name']) {
            $edit_articles++;
            $db->query("UPDATE " . PREFIX . "_post SET autor='{$row['name']}' WHERE id='{$id}'");
            $db->query("UPDATE " . PREFIX . "_post_extras SET user_id='{$row['user_id']}' WHERE news_id='{$id}'");
            $db->query("UPDATE " . PREFIX . "_images SET author='{$row['name']}' WHERE news_id='{$id}'");
            $db->query("UPDATE " . PREFIX . "_files SET author='{$row['name']}' WHERE news_id='{$id}'");
            $db->query("UPDATE " . USERPREFIX . "_users SET news_num=news_num+1 WHERE user_id='{$row['user_id']}'");
            $db->query("UPDATE " . USERPREFIX . "_users SET news_num=news_num-1 WHERE name='{$old['autor']}'");
        }
    }
    $db->query("INSERT INTO " . USERPREFIX . "_admin_logs (name, date, ip, action, extras) values ('" . $db->safesql($member_id['name']) . "', '{$_TIME}', '{$_IP}', '46', '')");
    clear_cache();
    msg("info", $lang['edit_selauthor_4'], $lang['edit_selauthor_4'] . " ({$edit_articles})", $_SESSION['admin_referrer']);
} elseif ($action == "do_mass_edit_symbol") {
    $edit_articles = 0;
    $catalog_url = $db->safesql(dle_substr(htmlspecialchars(strip_tags(stripslashes(trim($_POST['catalog_url'])))), 0, 3, $config['charset']));
    foreach ($selected_news as $id) {
        $edit_articles++;
        $id = intval($id);
        $db->query("UPDATE " . PREFIX . "_post SET symbol='{$catalog_url}' WHERE id='{$id}'");
    }
    $db->query("INSERT INTO " . USERPREFIX . "_admin_logs (name, date, ip, action, extras) values ('" . $db->safesql($member_id['name']) . "', '{$_TIME}', '{$_IP}', '46', '')");
    clear_cache();
    msg("info", $lang['mass_symbol_ok'], $lang['mass_symbol_ok'] . " ({$edit_articles})", $_SESSION['admin_referrer']);
} elseif ($action == "do_mass_edit_cloud") {
    $edit_articles = 0;
    if (@preg_match("/[\\||\\'|\\<|\\>|\"|\\!|\\?|\$|\\@|\\/|\\\\|\\&\\~\\*\\+]/", $_POST['tags'])) {
        $_POST['tags'] = "";
    } else {
        $_POST['tags'] = @$db->safesql(htmlspecialchars(strip_tags(stripslashes(trim($_POST['tags']))), ENT_QUOTES));
    }
コード例 #8
0
        }
        if (count($images)) {
            $i = 0;
            foreach ($images as $url) {
                $i++;
                $tpl->copy_template = str_replace('{image-' . $i . '}', $url, $tpl->copy_template);
                $tpl->copy_template = str_replace('[image-' . $i . ']', "", $tpl->copy_template);
                $tpl->copy_template = str_replace('[/image-' . $i . ']', "", $tpl->copy_template);
            }
        }
        $tpl->copy_template = preg_replace("#\\[image-(.+?)\\](.+?)\\[/image-(.+?)\\]#is", "", $tpl->copy_template);
        $tpl->copy_template = preg_replace("#\\{image-(.+?)\\}#i", "{THEME}/dleimages/no_image.jpg", $tpl->copy_template);
    }
    $tpl->set('{short-story}', $row['short_story']);
    if (preg_match("#\\{short-story limit=['\"](.+?)['\"]\\}#i", $tpl->copy_template, $matches)) {
        $count = intval($matches[1]);
        $row['short_story'] = str_replace("</p><p>", " ", $row['short_story']);
        $row['short_story'] = strip_tags($row['short_story'], "<br>");
        $row['short_story'] = trim(str_replace("<br>", " ", str_replace("<br />", " ", str_replace("\n", " ", str_replace("\r", "", $row['short_story'])))));
        if ($count and dle_strlen($row['short_story'], $config['charset']) > $count) {
            $row['short_story'] = dle_substr($row['short_story'], 0, $count, $config['charset']);
            if ($temp_dmax = dle_strrpos($row['short_story'], ' ', $config['charset'])) {
                $row['short_story'] = dle_substr($row['short_story'], 0, $temp_dmax, $config['charset']);
            }
        }
        $tpl->set($matches[0], $row['short_story']);
    }
    $tpl->compile('content');
}
$tpl->clear();
$db->free($sql_result);
コード例 #9
0
ファイル: social.class.php プロジェクト: Gordondalos/union
 function getuser()
 {
     global $config, $lang;
     if ($this->auth !== false) {
         $user = $this->auth->get_user($this->social_config);
         if (is_array($user) and $config['charset'] == "windows-1251") {
             if (function_exists('mb_convert_encoding')) {
                 $user['name'] = mb_convert_encoding($user['name'], "windows-1251", "UTF-8");
                 $user['nickname'] = mb_convert_encoding($user['nickname'], "windows-1251", "UTF-8");
             } elseif (function_exists('iconv')) {
                 $user['name'] = iconv("UTF-8", "windows-1251//IGNORE", $user['name']);
                 $user['nickname'] = iconv("UTF-8", "windows-1251//IGNORE", $user['nickname']);
             }
         }
         if (is_array($user)) {
             if (!$user['nickname']) {
                 $user['nickname'] = $user['name'];
             }
             $not_allow_symbol = array("\"", "`", "\t", '\\n', '\\r', "\n", "\r", '\\', ",", "/", "¬", "#", ";", ":", "~", "[", "]", "{", "}", ")", "(", "*", "^", "%", "\$", "<", ">", "?", "!", '"', "'", " ", "&");
             $user['email'] = str_replace($not_allow_symbol, '', $user['email']);
             $user['nickname'] = preg_replace("/[\\||\\'|\\<|\\>|\\[|\\]|\"|\\!|\\?|\$|\\@|\\#|\\/|\\\\|\\&\\~\\*\\{\\+]/", '', $user['nickname']);
             $user['nickname'] = str_ireplace(".php", ".ppp", $user['nickname']);
             $user['nickname'] = trim(htmlspecialchars($user['nickname'], ENT_QUOTES, $config['charset']));
             $user['name'] = trim(htmlspecialchars($user['name'], ENT_QUOTES, $config['charset']));
             if (dle_strlen($user['nickname'], $config['charset']) > 37) {
                 $user['nickname'] = dle_substr($user['nickname'], 37, $count, $config['charset']);
             }
         }
         return $user;
     } else {
         return $lang['social_err_2'];
     }
 }
コード例 #10
0
ファイル: functions.php プロジェクト: Hadryan/L2LWEB
function create_keywords($story)
{
    global $metatags, $config;
    $keyword_count = 20;
    $newarr = array();
    $quotes = array("\"", "`", "\t", "\n", "\r", ",", ".", "/", "¬", "#", ";", ":", "@", "~", "[", "]", "{", "}", "=", "-", "+", ")", "(", "*", "^", "%", "\$", "<", ">", "?", "!", '"');
    $fastquotes = array("\"", "`", "\t", "\n", "\r", '"', "\\", '\\r', '\\n', "/", "{", "}", "[", "]");
    $story = preg_replace("#\\[hide\\](.+?)\\[/hide\\]#is", "", $story);
    $story = preg_replace("'\\[attachment=(.*?)\\]'si", "", $story);
    $story = preg_replace("'\\[page=(.*?)\\](.*?)\\[/page\\]'si", "", $story);
    $story = str_replace("{PAGEBREAK}", "", $story);
    $story = str_replace("&nbsp;", " ", $story);
    $story = str_replace('<br />', ' ', $story);
    $story = strip_tags($story);
    $story = preg_replace("#&(.+?);#", "", $story);
    $story = trim(str_replace(" ,", "", stripslashes($story)));
    $story = str_replace($fastquotes, '', $story);
    $metatags['description'] = dle_substr($story, 0, 190, $config['charset']);
    $story = str_replace($quotes, ' ', $story);
    $arr = explode(" ", $story);
    foreach ($arr as $word) {
        if (dle_strlen($word, $config['charset']) > 4) {
            $newarr[] = $word;
        }
    }
    $arr = array_count_values($newarr);
    arsort($arr);
    $arr = array_keys($arr);
    $total = count($arr);
    $offset = 0;
    $arr = array_slice($arr, $offset, $keyword_count);
    $metatags['keywords'] = implode(", ", $arr);
}
コード例 #11
0
ファイル: pm_alert.php プロジェクト: Gordondalos/union
=====================================================
*/
if (!defined('DATALIFEENGINE')) {
    die("Hacking attempt!");
}
$row = $db->super_query("SELECT subj, text, user_from FROM " . USERPREFIX . "_pm WHERE user = '******'user_id']}' AND folder = 'inbox' ORDER BY pm_read ASC, date DESC LIMIT 0,1");
$lang['pm_alert'] = str_replace("{user}", $member_id['name'], str_replace("{num}", intval($member_id['pm_unread']), $lang['pm_alert']));
$row['subj'] = dle_substr(stripslashes($row['subj']), 0, 45, $config['charset']) . " ...";
if ($user_group[$member_id['user_group']]['allow_hide']) {
    $row['text'] = str_ireplace("[hide]", "", str_ireplace("[/hide]", "", $row['text']));
} else {
    $row['text'] = preg_replace("#\\[hide\\](.+?)\\[/hide\\]#ims", "", $row['text']);
}
$row['text'] = str_replace("<br />", " ", $row['text']);
$row['text'] = str_replace("{", "&#123;", $row['text']);
$row['text'] = dle_substr(strip_tags(stripslashes($row['text'])), 0, 340, $config['charset']) . " ...";
$pm_alert = <<<HTML
<div id="newpm" title="{$lang['pm_atitle']}" style="display:none;" >{$lang['pm_alert']}
<br /><br />
{$lang['pm_asub']} <b>{$row['subj']}</b><br />
{$lang['pm_from']} <b>{$row['user_from']}</b><br /><br /><i>{$row['text']}</i></div>
HTML;
$onload_scripts[] = <<<HTML
\$('#newpm').dialog({
\tautoOpen: true,
\tshow: 'fade',
\thide: 'fade',
\twidth: 450,
\tresizable: false,
\tdialogClass: "dle-popup-newpm",
\tbuttons: {
コード例 #12
0
ファイル: search.php プロジェクト: Banych/SiteCreate
     $row['story'] = preg_replace("'\\[PAGE=(.*?)\\](.*?)\\[/PAGE\\]'si", $replacepage, $row['story']);
 } else {
     $row['story'] = preg_replace("'\\[PAGE=(.*?)\\](.*?)\\[/PAGE\\]'si", "", $row['story']);
 }
 $row['story'] = str_replace('{ACCEPT-DECLINE}', "", $row['story']);
 $title = stripslashes(strip_tags($row['title']));
 if ($row['allow_template']) {
     $tpl->load_template('static.tpl');
     if ($config['allow_alt_url'] == "yes") {
         $static_descr = "<a title=\"" . $title . "\" href=\"" . $config['http_home_url'] . $row['static_name'] . ".html\" >" . $title . "</a>";
     } else {
         $static_descr = "<a title=\"" . $title . "\" href=\"{$PHP_SELF}?do=static&page=" . $row['static_name'] . "\" >" . $title . "</a>";
     }
     $tpl->set('{description}', $static_descr);
     if (dle_strlen($row['story'], $config['charset']) > 2000) {
         $row['story'] = dle_substr(strip_tags($row['story']), 0, 2000, $config['charset']) . " .... ";
         if ($config['allow_alt_url'] == "yes") {
             $row['story'] .= "( <a href=\"" . $config['http_home_url'] . $row['static_name'] . ".html\" >" . $lang['search_s_go'] . "</a> )";
         } else {
             $row['story'] .= "( <a href=\"{$PHP_SELF}?do=static&page=" . $row['static_name'] . "\" >" . $lang['search_s_go'] . "</a> )";
         }
     }
     $tpl->set('{static}', $row['story']);
     $tpl->set('{pages}', '');
     if (@date("Ymd", $row['date']) == date("Ymd", $_TIME)) {
         $tpl->set('{date}', $lang['time_heute'] . langdate(", H:i", $row['date']));
     } elseif (@date("Ymd", $row['date']) == date("Ymd", $_TIME - 86400)) {
         $tpl->set('{date}', $lang['time_gestern'] . langdate(", H:i", $row['date']));
     } else {
         $tpl->set('{date}', langdate($config['timestamp_active'], $row['date']));
     }
コード例 #13
0
ファイル: rssinform.php プロジェクト: Gordondalos/union
             $i++;
             $tpl->copy_template = str_replace('{image-' . $i . '}', $url, $tpl->copy_template);
             $tpl->copy_template = str_replace('[image-' . $i . ']', "", $tpl->copy_template);
             $tpl->copy_template = str_replace('[/image-' . $i . ']', "", $tpl->copy_template);
         }
     }
     $tpl->copy_template = preg_replace("#\\[image-(.+?)\\](.+?)\\[/image-(.+?)\\]#is", "", $tpl->copy_template);
     $tpl->copy_template = preg_replace("#\\{image-(.+?)\\}#i", "{THEME}/dleimages/no_image.jpg", $tpl->copy_template);
 }
 $content['description'] = strip_tags($content['description'], "<br>");
 $content['description'] = str_replace("<br>", " ", str_replace("<br />", " ", $content['description']));
 $content['description'] = trim($content['description']);
 if ($value['dmax'] and dle_strlen($content['description'], $config['charset']) > $value['dmax']) {
     $content['description'] = dle_substr($content['description'], 0, $value['dmax'], $config['charset']);
     if ($temp_dmax = dle_strrpos($content['description'], ' ', $config['charset'])) {
         $content['description'] = dle_substr($content['description'], 0, $temp_dmax, $config['charset']);
     }
     $content['description'] .= " ...";
 }
 $content['link'] = htmlspecialchars($content['link'], ENT_QUOTES, $config['charset']);
 $tpl->set('{title}', $content['title']);
 $tpl->set('{news}', $content['description']);
 $tpl->set('[link]', "<a href=\"{$content['link']}\" target=\"_blank\">");
 $tpl->set('[/link]', "</a>");
 $tpl->set('{link}', $content['link']);
 $tpl->set('{category}', $content['category']);
 $tpl->set('{author}', $content['author']);
 $tpl->set('{date}', langdate($value['rss_date_format'], $content['date']));
 $news_date = $content['date'];
 $tpl->copy_template = preg_replace_callback("#\\{date=(.+?)\\}#i", "formdate", $tpl->copy_template);
 $tpl->compile('rss_info');
コード例 #14
0
    $news_date = date('d-m-Y', $related['date']);
    if ($config['allow_alt_url'] == "yes") {
        if ($config['seo_type'] == 1 or $config['seo_type'] == 2) {
            if ($related['category'] and $config['seo_type'] == 2) {
                $full_link = $config['http_home_url'] . get_url($related['category']) . "/" . $related['id'] . "-" . $related['alt_name'] . ".html";
            } else {
                $full_link = $config['http_home_url'] . $related['id'] . "-" . $related['alt_name'] . ".html";
            }
        } else {
            $full_link = $config['http_home_url'] . date('Y/m/d/', $related['date']) . $related['alt_name'] . ".html";
        }
    } else {
        $full_link = $config['http_home_url'] . "index.php?newsid=" . $related['id'];
    }
    if (dle_strlen($related['title'], $config['charset']) > 65) {
        $related['title'] = dle_substr($related['title'], 0, 65, $config['charset']) . " ...";
    }
    if ($user_group[$member_id['user_group']]['allow_all_edit']) {
        $d_link = "<a href=\"?mod=editnews&action=editnews&id={$related['id']}\" target=\"_blank\"><img style=\"vertical-align: middle;border:none;\" alt=\"{$lang['edit_rel']}\" src=\"engine/skins/images/notepad.png\" /></a>&nbsp;&nbsp;<a onclick=\"confirmDelete('?mod=editnews&action=doeditnews&ifdelete=yes&id={$related['id']}&user_hash={$dle_login_hash}', '{$related['id']}'); return false;\" href=\"?mod=editnews&action=doeditnews&ifdelete=yes&id={$related['id']}&user_hash={$dle_login_hash}\" target=\"_blank\"><img style=\"vertical-align: middle;border:none;\" alt=\"{$lang['edit_seldel']}\" src=\"engine/skins/images/delete.png\" /></a>&nbsp;&nbsp;";
    } else {
        $d_link = "";
    }
    $buffer .= "<div style=\"padding:2px;\">{$d_link}{$news_date} - <a href=\"" . $full_link . "\" target=\"_blank\">" . stripslashes($related['title']) . "</a></div>";
}
$db->close();
@header("Content-type: text/html; charset=" . $config['charset']);
if ($buffer) {
    echo "<div style=\"width:600px; background: #ffc;border:1px solid #9E9E9E;padding: 5px;margin-top: 7px;margin-right: 10px;\">" . $buffer . "</div>";
} else {
    echo "<div style=\"width:542px;background: #ffc;border:1px solid #9E9E9E;padding: 5px;margin-top: 7px;margin-right: 10px;\">" . $lang['related_not_found'] . "</div>";
}
コード例 #15
0
ファイル: static.php プロジェクト: Gordondalos/union
     $tpl->set_block("'\\[yandex\\](.*?)\\[/yandex\\]'si", "");
     $tpl->set('{yandex_url}', '');
 }
 if (preg_match("#\\{text limit=['\"](.+?)['\"]\\}#i", $tpl->copy_template, $matches)) {
     $count = intval($matches[1]);
     $stext = preg_replace("#<!--TBegin(.+?)<!--TEnd-->#is", "", $template);
     $stext = preg_replace("#<!--MBegin(.+?)<!--MEnd-->#is", "", $stext);
     $stext = preg_replace("'\\[attachment=(.*?)\\]'si", "", $stext);
     $stext = preg_replace("#\\[hide\\](.+?)\\[/hide\\]#ims", "", $stext);
     $stext = str_replace("</p><p>", " ", $stext);
     $stext = strip_tags($stext, "<br>");
     $stext = trim(str_replace("<br>", " ", str_replace("<br />", " ", str_replace("\n", " ", str_replace("\r", "", $stext)))));
     if ($count and dle_strlen($stext, $config['charset']) > $count) {
         $stext = dle_substr($stext, 0, $count, $config['charset']);
         if ($temp_dmax = dle_strrpos($stext, ' ', $config['charset'])) {
             $stext = dle_substr($stext, 0, $temp_dmax, $config['charset']);
         }
     }
     $tpl->set($matches[0], $stext);
 }
 if (stripos($tpl->copy_template, "{image-") !== false) {
     $images = array();
     preg_match_all('/(img|src)=("|\')[^"\'>]+/i', $template, $media);
     $data = preg_replace('/(img|src)("|\'|="|=\')(.*)/i', "\$3", $media[0]);
     foreach ($data as $url) {
         $info = pathinfo($url);
         if (isset($info['extension'])) {
             if ($info['filename'] == "spoiler-plus" or $info['filename'] == "spoiler-plus") {
                 continue;
             }
             $info['extension'] = strtolower($info['extension']);
コード例 #16
0
     }
     $tplb->set($t_matches[0], $title);
 }
 if ($user_group[$member_id['user_group']]['allow_hide']) {
     $rowb['short_story'] = str_ireplace(array("[hide]", "[/hide]"), "", $rowb['short_story']);
 } else {
     $rowb['short_story'] = preg_replace("#\\[hide\\](.+?)\\[/hide\\]#ims", "<div class=\"quote\">" . $lang['news_regus'] . "</div>", $rowb['short_story']);
 }
 if (preg_match("#\\{text limit=['\"](.+?)['\"]\\}#i", $tplb->copy_template, $matches)) {
     $count = intval($matches[1]);
     $rowb['short_story'] = strip_tags($rowb['short_story'], "<br>");
     $rowb['short_story'] = trim(str_replace(array("<br>", '<br />'), " ", $rowb['short_story']));
     if ($count > 0 and dle_strlen($rowb['short_story'], $config['charset']) > $count) {
         $rowb['short_story'] = dle_substr($rowb['short_story'], 0, $count, $config['charset']) . "&hellip;";
         if (!$wordcut && ($word_pos = dle_strrpos($rowb['short_story'], ' ', $config['charset']))) {
             $rowb['short_story'] = dle_substr($rowb['short_story'], 0, $word_pos, $config['charset']) . "&hellip;";
         }
     }
     $tplb->set($matches[0], $rowb['short_story']);
 } else {
     $tplb->set('{text}', $rowb['short_story']);
 }
 $tplb->set('{full-link}', $full_link);
 $tplb->set('{comments-num}', $rowb['comm_num']);
 $tplb->set('{views}', $rowb['news_read']);
 if ($allow_userinfo and !$rowb['approve'] and ($member_id['name'] == $rowb['autor'] and !$user_group[$member_id['user_group']]['allow_all_edit'])) {
     $tplb->set('[edit]', "<a href=\"" . $config['http_home_url'] . "index.php?do=addnews&id=" . $rowb['id'] . "\" >");
     $tplb->set('[/edit]', "</a>");
 } elseif ($is_logged and ($member_id['name'] == $rowb['autor'] and $user_group[$member_id['user_group']]['allow_edit'] or $user_group[$member_id['user_group']]['allow_all_edit'])) {
     $_SESSION['referrer'] = $_SERVER['REQUEST_URI'];
     $tplb->set('[edit]', "<a onclick=\"return dropdownmenu(this, event, MenuNewsBuild('" . $rowb['id'] . "', 'short'), '170px')\" href=\"#\">");
コード例 #17
0
 public function lastTopics(dle_template $tpl)
 {
     if (!$this->config['allow_forum_block'] || !$this->config['allow_module']) {
         return '';
     }
     if ((int) $this->config['block_cache_time']) {
         $cache = dle_cache('xen_block_cache_time');
         if ($cache) {
             $cache = unserialize($cache);
             if (!empty($cache['time']) && $cache['time'] > time() - $this->config['block_cache_time']) {
                 return $cache['data'];
             }
         }
     }
     $forum_id = "";
     if ($this->config['bad_forum_for_block'] && !$this->config['good_forum_for_block']) {
         $forum_bad = explode(",", $this->config['bad_forum_for_block']);
         $forum_id = " AND t.node_id NOT IN('" . implode("','", $forum_bad) . "')";
     } elseif (!$this->config['bad_forum_for_block'] && $this->config['good_forum_for_block']) {
         $forum_good = explode(",", $this->config['good_forum_for_block']);
         $forum_id = " AND t.node_id IN('" . implode("','", $forum_good) . "')";
     }
     if (!(int) $this->config['count_post']) {
         $this->config['count_post'] = 10;
     }
     $sth = $this->db->query('SELECT t.title, t.thread_id, t.last_post_date, t.reply_count, t.view_count, f.title as forum_title, t.node_id, t.last_post_username, t.last_post_user_id
             FROM ' . F_PREFIX . 'thread AS t
             LEFT JOIN ' . F_PREFIX . 'node AS f
             ON f.node_id = t.node_id
             WHERE discussion_state="visible"' . $forum_id . ' 
             ORDER BY t.last_post_date DESC 
             LIMIT 0, ' . intval($this->config['count_post']));
     $forum_url = rtrim($this->options['boardUrl'], "/") . "/";
     if (!$this->config['block_rewrite_url']) {
         $forum_url .= "index.php?";
     }
     $tpl->load_template('block_forum_posts.tpl');
     preg_match("'\\[row\\](.*?)\\[/row\\]'si", $tpl->copy_template, $matches);
     $block_content = '';
     while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
         $short_name = $title = $this->_convert_encoding($row["title"], true);
         $row['last_post_username'] = $this->_convert_encoding($row['last_post_username'], true);
         if (!empty($this->config['length_name']) && dle_strlen($title, $this->DLEConfig['charset']) > $this->config['length_name']) {
             $short_name = dle_substr($title, 0, $this->config['length_name'], $this->DLEConfig['charset']) . " ...";
         }
         switch (date("d.m.Y", $row["last_post_date"])) {
             case date("d.m.Y"):
                 $date = date($this->lang['today_in'] . "H:i", $row["last_post_date"]);
                 break;
             case date("d.m.Y", time() - 86400):
                 $date = date($this->lang['yesterday_in'] . "H:i", $row["last_post_date"]);
                 break;
             default:
                 $date = date("d.m.Y H:i", $row["last_post_date"]);
         }
         $replace = array('{user}' => $this->_convert_encoding($row['last_post_username'], true), '{user_url}' => $forum_url . "members/" . $this->getTitleForUrl($row['last_post_username']) . "." . $row['last_post_user_id'] . "/", '{reply_count}' => $row["reply_count"], '{view_count}' => $row["view_count"], '{full_name}' => $title, '{post_url}' => $forum_url . "threads/" . $this->getTitleForUrl($row['title']) . "." . $row["thread_id"] . "/", '{shot_name_post}' => $short_name, '{forum_name}' => $this->_convert_encoding($row['forum_title'], true), '{forum_url}' => $forum_url . "forums/" . $this->getTitleForUrl($row['forum_title']) . "." . $row["node_id"] . "/", '{date}' => $date);
         $block_content .= strtr($matches[1], $replace);
     }
     $tpl->set_block("'\\[row\\](.*?)\\[/row\\]'si", $block_content);
     $tpl->compile('block_forum_posts');
     $tpl->clear();
     if ((int) $this->config['block_cache_time']) {
         create_cache('xen_block_cache_time', serialize(array('time' => time(), 'data' => $tpl->result['block_forum_posts'])));
     }
     return $tpl->result['block_forum_posts'];
 }
コード例 #18
0
ファイル: comm.php プロジェクト: hiptc/ShowComments
 public function Start($CommCfg)
 {
     $this->New_Cfg($CommCfg);
     // создаем новый конфиг
     $where = array();
     // проверка некоторых параметров конфига по версиях
     $allow_alt_url = $this->config['version_id'] >= '10.2' ? $this->config['allow_alt_url'] == '1' : $this->config['allow_alt_url'] == "yes";
     $allow_cache = $this->config['version_id'] >= '10.2' ? $this->config['allow_cache'] == '1' : $this->config['allow_cache'] == "yes";
     $allow_multi_category = $this->config['version_id'] >= '10.2' ? $this->config['allow_multi_category'] == '1' : $this->config['allow_multi_category'] == "yes";
     if ($this->config['version_id'] >= '10.4' and $this->comm_cfg['rating_comm']) {
         // рейтинг комментариев только для DLE 10.4 и выще
         $where[] = "c.rating > {$this->comm_cfg[rating_comm]}";
     }
     // работа с категориями
     if ($allow_multi_category) {
         if ($this->comm_cfg['stop_category']) {
             $where[] = "category NOT REGEXP '[[:<:]](" . $this->Explode_Category($this->comm_cfg['stop_category'], "multi") . ")[[:>:]]'";
         }
         if ($this->comm_cfg['from_category']) {
             $where[] = "category REGEXP '[[:<:]](" . $this->Explode_Category($this->comm_cfg['from_category'], "multi") . ")[[:>:]]'";
         }
     } else {
         if ($this->comm_cfg['stop_category']) {
             $where[] = "category NOT IN ('" . $this->Explode_Category($this->comm_cfg['stop_category']) . "')";
         }
         if ($this->comm_cfg['from_category']) {
             $where[] = "category IN ('" . $this->Explode_Category($this->comm_cfg['from_category']) . "')";
         }
     }
     if ($this->comm_cfg['news_xfield']) {
         // работа с доп полями новостей
         $where[] = $this->Explode_xField($this->comm_cfg['news_xfield'], "p.xfields");
     }
     if ($this->comm_cfg['user_xfield']) {
         // работа с доп полями пользователей
         $where[] = $this->Explode_xField($this->comm_cfg['user_xfield'], "u.xfields");
     }
     // работа с новостями
     if ($this->comm_cfg['stop_id']) {
         $where[] = $this->Explode_NewsID($this->comm_cfg['stop_id']);
     }
     if ($this->comm_cfg['from_id']) {
         $where[] = $this->Explode_NewsID($this->comm_cfg['from_id']);
     }
     if ($this->comm_cfg['ncomm']) {
         // выводим только с комментариями у новостей больше чем
         $where[] = "p.comm_num > {$this->comm_cfg[ncomm]}";
     }
     if ($this->comm_cfg['fixed']) {
         // выводим только с зафиксированых новостей
         $where[] = "p.fixed = 1";
     }
     if ($this->comm_cfg['tags']) {
         $t = explode(',', $this->comm_cfg['tags']);
         $t = implode('|', $t);
         $where[] = "p.tags regexp '[[:<:]](" . $t . ")[[:>:]]'";
     }
     if ($this->comm_cfg['news_read']) {
         // выводим только с комментариями у новостей больше чем
         $where[] = "e.news_read > {$this->comm_cfg[news_read]}";
     }
     if ($this->comm_cfg['rating_news']) {
         // выводим только с комментариями у новостей больше чем
         $where[] = "e.rating > {$this->comm_cfg[rating_news]}";
     }
     if ($this->comm_cfg['only_avatar']) {
         // выводим только с аватарами
         $where[] = "u.foto != ''";
     }
     if ($this->comm_cfg['only_news']) {
         // выводим только с новостями
         $where[] = "u.news_num > 0";
     }
     if ($this->comm_cfg['only_fav']) {
         // выводим только с закладками
         $where[] = "u.favorites != ''";
     }
     if ($this->comm_cfg['only_fullname']) {
         // выводим только с полным именем
         $where[] = "u.fullname != ''";
     }
     if ($this->comm_cfg['only_land']) {
         // выводим только с место жительством
         $where[] = "u.land != ''";
     }
     if ($this->comm_cfg['news_user']) {
         // выводим только если новостей больше чем
         $where[] = "u.news_num > {$this->comm_cfg[news_user]}";
     }
     if ($this->comm_cfg['comm']) {
         // выводим только если комментариев больше чем
         $where[] = "u.comm_num > {$this->comm_cfg[comm]}";
     }
     // префикс кэша
     $Comm_hash = md5($this->comm_cfg['max_comm'] . $this->comm_cfg['max_text'] . $this->comm_cfg['max_title'] . $this->comm_cfg['check_guest'] . $this->comm_cfg['stop_category'] . $this->comm_cfg['from_category'] . $this->comm_cfg['stop_id'] . $this->comm_cfg['from_id'] . $this->comm_cfg['only_avatar'] . $this->comm_cfg['only_news'] . $this->comm_cfg['news_user'] . $this->comm_cfg['comm'] . $this->comm_cfg['only_fav'] . $this->comm_cfg['only_fullname'] . $this->comm_cfg['only_land']);
     $is_change = false;
     if (!$allow_cache) {
         if ($this->config['version_id'] >= '10.2') {
             $this->config['allow_cache'] = '1';
         } else {
             $this->config['allow_cache'] = "yes";
         }
         $is_change = true;
     }
     $Comm = dle_cache("Comm_", $this->config['skin'] . $Comm_hash);
     // подгружаем из кэша
     if (!$Comm) {
         if (count($where) > 0) {
             $where = " AND " . implode(" AND ", $where);
         } else {
             $where = "";
         }
         $sql = $this->db->query("SELECT c.id as comid, c.post_id, c.date, c.user_id, c.is_register, c.text, c.autor, c.email, c.approve, p.id, p.date as newsdate, p.title, p.category, p.comm_num, p.alt_name, e.news_id, e.news_read, e.rating, u.foto, u.user_group, u.user_id FROM " . PREFIX . "_comments as c, " . PREFIX . "_post as p, " . PREFIX . "_post_extras as e, " . PREFIX . "_users as u WHERE p.id=c.post_id AND e.news_id=c.post_id AND c.approve = 1 AND c.user_id = u.user_id {$where} ORDER BY c.date DESC LIMIT 0, " . $this->comm_cfg['max_comm']);
         $tpl = new dle_template();
         $tpl->dir = TEMPLATE_DIR;
         $tpl->load_template('comm/comm.tpl');
         $count_rows = $sql->num_rows;
         if ($count_rows > 0) {
             while ($row = $this->db->get_row($sql)) {
                 $row['date'] = strtotime($row['date']);
                 $row['category'] = intval($row['category']);
                 // Обработка ссылки на комментарий
                 $on_page = FALSE;
                 if ($row['comm_num'] > $this->config['comm_nummers']) {
                     $on_page = 'page,1,' . ceil($row['comm_num'] / $this->config['comm_nummers']) . ',';
                 }
                 if ($allow_alt_url) {
                     if ($condition = $this->config['seo_type'] == 1 or $this->config['seo_type'] == 2) {
                         if ($row['category'] and $this->config['seo_type'] == 2) {
                             $full_link = $this->config['http_home_url'] . get_url($row['category']) . "/" . $on_page . $row['id'] . "-" . $row['alt_name'] . ".html";
                         } else {
                             $full_link = $this->config['http_home_url'] . $on_page . $row['id'] . "-" . $row['alt_name'] . ".html";
                         }
                     } else {
                         $full_link = $this->config['http_home_url'] . date('Y/m/d/', $row['date']) . $on_page . $row['alt_name'] . ".html";
                     }
                 } else {
                     $full_link = $this->config['http_home_url'] . "index.php?newsid=" . $row['id'];
                 }
                 $full_link = $full_link . '#comment-id-' . $row['comid'];
                 // Обработка текста комментария
                 if (dle_strlen($row['text'], $this->config['charset']) > $this->comm_cfg['max_text']) {
                     $text = stripslashes(dle_substr($row['text'], 0, $this->comm_cfg['max_text'], $this->config['charset']) . " ...");
                 } else {
                     $text = stripslashes($row['text']);
                 }
                 // Обработка заголовка новости (title)
                 if (dle_strlen($row['title'], $this->config['charset']) > $this->comm_cfg['max_title']) {
                     $title = stripslashes(dle_substr($row['title'], 0, $this->comm_cfg['max_title'], $this->config['charset']) . " ...");
                 } else {
                     $title = stripslashes($row['title']);
                 }
                 // Обработка ника автора комментария
                 if ($row['is_register'] == 1) {
                     if ($allow_alt_url) {
                         $go_page = $this->config['http_home_url'] . "user/" . urlencode($row['autor']) . "/";
                     } else {
                         $go_page = "{$PHP_SELF}?subaction=userinfo&amp;user="******"onclick=\"ShowProfile('" . urlencode($row['autor']) . "', '" . htmlspecialchars($go_page, ENT_QUOTES, $this->config['charset']) . "', '" . $this->group[$this->member['user_group']]['admin_editusers'] . "'); return false;\"";
                     } else {
                         $go_page = "onclick=\"ShowProfile('" . urlencode($row['autor']) . "', '" . $go_page . "'); return false;\"";
                     }
                     if ($allow_alt_url) {
                         $author = "<a {$go_page} href=\"" . $this->config['http_home_url'] . "user/" . urlencode($row['autor']) . "/\">" . $row['autor'] . "</a>";
                     } else {
                         $author = "<a {$go_page} href=\"{$PHP_SELF}?subaction=userinfo&amp;user="******"\">" . $row['autor'] . "</a>";
                     }
                 } else {
                     $author = strip_tags($row['autor']);
                 }
                 // Обработка фото автора комментария
                 if ($row['foto'] and $row['is_register'] == 1) {
                     if (count(explode("@", $row['foto'])) == 2) {
                         $tpl->set('{foto}', '//www.gravatar.com/avatar/' . md5(trim($row['foto'])) . '?s=' . intval($this->group[$row['user_group']]['max_foto']));
                     } else {
                         if ($this->config['version_id'] >= '10.5') {
                             if (strpos($row['foto'], "//") === 0) {
                                 $avatar = "http:" . $row['foto'];
                             } else {
                                 $avatar = $row['foto'];
                             }
                             $avatar = @parse_url($avatar);
                             if ($avatar['host']) {
                                 $tpl->set('{foto}', $row['foto']);
                             } else {
                                 $tpl->set('{foto}', $this->config['http_home_url'] . "uploads/fotos/" . $row['foto']);
                             }
                         } else {
                             if ($row['foto'] and file_exists(ROOT_DIR . "/uploads/fotos/" . $row['foto'])) {
                                 $tpl->set('{foto}', $this->config['http_home_url'] . "uploads/fotos/" . $row['foto']);
                             }
                         }
                     }
                 } else {
                     $tpl->set('{foto}', "{THEME}/dleimages/noavatar.png");
                 }
                 // Обработка ссылки автора комментария
                 if ($allow_alt_url) {
                     $user_url = $this->config['http_home_url'] . "user/" . urlencode($row['autor']) . "/";
                 } else {
                     $user_url = "{$PHP_SELF}?subaction=userinfo&amp;user="******", H:i", $row['date']));
                 } elseif (date('Ymd', $row['date']) == date('Ymd', $_TIME - 86400)) {
                     $tpl->set('{date}', $lang['time_gestern'] . langdate(", H:i", $row['date']));
                 } else {
                     $tpl->set('{date}', langdate($this->config['timestamp_active'], $row['date']));
                 }
                 $tpl->copy_template = preg_replace("#\\{date=(.+?)\\}#ie", "langdate('\\1', '{$row['date']}')", $tpl->copy_template);
                 $tpl->set('{text}', $text);
                 //текст комментария
                 $tpl->set('{user_url}', $user_url);
                 // ссылка на автора
                 $tpl->set('{user_name}', $row['autor']);
                 // просто ник автора
                 $tpl->set('[user_url]', "<a href=\"" . $user_url . "\">");
                 // оборачиваем в ссылку
                 $tpl->set('[/user_url]', "</a>");
                 // оборачиваем в ссылку
                 $tpl->set('{author}', $author);
                 // автор с ссылкой на профиль с модальным окном
                 $tpl->set('[color]', $this->group[$row['user_group']]['group_prefix']);
                 // префикс цвета группы
                 $tpl->set('[/color]', $this->group[$row['user_group']]['group_suffix']);
                 // суфикс цвета группы
                 $tpl->set('{title}', $title);
                 // укороченный заголовок
                 $tpl->set('{long_title}', stripslashes($row['title']));
                 // полный заголовок
                 $tpl->set('{rating}', $row['rating']);
                 // рейтинг новости
                 $tpl->set('{views}', $row['news_read']);
                 // просмотров новости
                 $tpl->set('{full_link}', $full_link);
                 // линк на комментарий
                 $tpl->set('{comm_num}', $row['comm_num']);
                 // кол-во комментариев новости
                 $tpl->set("{error}", "");
                 $tpl->set('[comm]', "");
                 $tpl->set('[/comm]', "");
                 $tpl->set_block("'\\[not-comm\\](.*?)\\[/not-comm\\]'si", "");
                 $tpl->compile('comm');
                 //компиляция шаблона
             }
             $this->db->free($sql);
             //очищаем от запросов
         } else {
             $tpl->set("{error}", "Комментариев нету!");
             $tpl->set_block("'\\[comm\\](.*?)\\[/comm\\]'si", "");
             $tpl->set('[not-comm]', "");
             $tpl->set('[/not-comm]', "");
             $tpl->compile('comm');
         }
         $tpl->clear();
         //очищаем шаблон
         $Comm = $tpl->result['comm'];
         if (preg_match_all('/<!--dle_spoiler(.*?)<!--\\/dle_spoiler-->/is', $Comm, $spoilers)) {
             foreach ($spoilers as $spoiler) {
                 $Comm = str_replace($spoiler, '<div class="quote">Для просмотра содержимого спойлера, перейдите к выбранному комментарию.</div>', $Comm);
             }
         }
         if ($this->group[$this->member['user_group']]['allow_hide']) {
             $Comm = preg_replace("'\\[hide\\](.*?)\\[/hide\\]'si", "\\1", $Comm);
         } else {
             $Comm = preg_replace("'\\[hide\\](.*?)\\[/hide\\]'si", "<div class=\"quote\"> Для вашей группы скрытый текст не виден </div>", $Comm);
         }
         create_cache("Comm_", $Comm, $this->config['skin'] . $Comm_hash);
         //создаем кэш
         if ($is_change) {
             $this->config['allow_cache'] = false;
         }
         //выключаем кэш принудительно (возвращаем назад)
     }
     echo '<div class="iComm" id="iComm"><ul class="lastcomm">' . $Comm . '</ul> <!-- .lastcomm --></div>';
 }
コード例 #19
0
ファイル: editvote.php プロジェクト: Gordondalos/union
 while ($row = $db->get_row()) {
     $item_id = $row['id'];
     $item_date = date("d.m.Y", strtotime($row['date']));
     $title = htmlspecialchars(stripslashes($row['title']), ENT_QUOTES, $config['charset']);
     if ($row['start']) {
         $start_date = date("d.m.Y H:i", $row['start']);
     } else {
         $start_date = "--";
     }
     if ($row['end']) {
         $end_date = date("d.m.Y H:i", $row['end']);
     } else {
         $end_date = "--";
     }
     if (dle_strlen($title, $config['charset']) > 74) {
         $title = dle_substr($title, 0, 70, $config['charset']) . " ...";
     }
     $item_num = $row['vote_num'];
     if (empty($row['category'])) {
         $my_cat = "<center>--</center>";
     } elseif ($row['category'] == "all") {
         $my_cat = $lang['edit_all'];
     } else {
         $my_cat = array();
         $cat_list = explode(',', $row['category']);
         foreach ($cat_list as $element) {
             if ($element) {
                 $my_cat[] = $cat[$element];
             }
         }
         $my_cat = implode(',<br />', $my_cat);
コード例 #20
0
ファイル: preview.php プロジェクト: Banych/SiteCreate
 }
 $tpl->copy_template = str_replace('[full-preview]', "", $tpl->copy_template);
 $tpl->copy_template = str_replace('[/full-preview]', "", $tpl->copy_template);
 $tpl->copy_template = preg_replace("'\\[short-preview\\](.*?)\\[/short-preview\\]'si", "", $tpl->copy_template);
 $tpl->copy_template = preg_replace("'\\[static-preview\\](.*?)\\[/static-preview\\]'si", "", $tpl->copy_template);
 if (strlen($full_story) < 10 and strpos($tpl->copy_template, "{short-story}") === false) {
     $full_story = $short_story;
 }
 $tpl->set('{title}', $title);
 if (preg_match("#\\{title limit=['\"](.+?)['\"]\\}#i", $tpl->copy_template, $matches)) {
     $count = intval($matches[1]);
     $title = strip_tags($title);
     if ($count and dle_strlen($title, $config['charset']) > $count) {
         $title = dle_substr($title, 0, $count, $config['charset']);
         if ($temp_dmax = dle_strrpos($title, ' ', $config['charset'])) {
             $title = dle_substr($title, 0, $temp_dmax, $config['charset']);
         }
     }
     $tpl->set($matches[0], $title);
 }
 if (!count($_REQUEST['category'])) {
     $_REQUEST['category'] = array();
     $_REQUEST['category'][] = '0';
 }
 $c_list = array();
 foreach ($_REQUEST['category'] as $value) {
     $c_list[] = intval($value);
 }
 $category_id = implode(',', $c_list);
 if (strpos($tpl->copy_template, "[catlist=") !== false) {
     $tpl->copy_template = preg_replace_callback("#\\[(catlist)=(.+?)\\](.*?)\\[/catlist\\]#is", "check_category", $tpl->copy_template);
コード例 #21
0
ファイル: editnews.php プロジェクト: Banych/SiteCreate
 if (trim($title) == "" and $ifdelete != "yes") {
     msg("error", $lang['cat_error'], $lang['addnews_alert'], "javascript:history.go(-1)");
 }
 if (dle_strlen($title, $config['charset']) > 255) {
     msg("error", $lang['cat_error'], $lang['addnews_ermax'], "javascript:history.go(-1)");
 }
 if (trim($_POST['alt_name']) == "" or !$_POST['alt_name']) {
     $alt_name = totranslit(stripslashes($title));
 } else {
     $alt_name = totranslit(stripslashes($_POST['alt_name']));
 }
 $title = $db->safesql($title);
 $metatags = create_metatags($short_story . $full_story);
 $catalog_url = $db->safesql(dle_substr(htmlspecialchars(strip_tags(stripslashes(trim($_POST['catalog_url']))), ENT_QUOTES, $config['charset']), 0, 3, $config['charset']));
 if ($config['create_catalog'] and !$catalog_url) {
     $catalog_url = $db->safesql(dle_substr(htmlspecialchars(strip_tags(stripslashes(trim($title))), ENT_QUOTES, $config['charset']), 0, 1, $config['charset']));
 }
 $editreason = $db->safesql(htmlspecialchars(strip_tags(stripslashes(trim($_POST['editreason']))), ENT_QUOTES, $config['charset']));
 if (@preg_match("/[\\||\\<|\\>|\"|\\!|\\?|\$|\\@|\\/|\\\\|\\&\\~\\*\\+]/", $_POST['tags'])) {
     $_POST['tags'] = "";
 } else {
     $_POST['tags'] = @$db->safesql(htmlspecialchars(strip_tags(stripslashes(trim($_POST['tags']))), ENT_COMPAT, $config['charset']));
 }
 if ($_POST['tags']) {
     $temp_array = array();
     $tags_array = array();
     $temp_array = explode(",", $_POST['tags']);
     if (count($temp_array)) {
         foreach ($temp_array as $value) {
             if (trim($value)) {
                 $tags_array[] = trim($value);
コード例 #22
0
ファイル: init.php プロジェクト: Zzepish/IvanShikalovWebSIte
}
if (isset($_GET['news_page'])) {
    $news_page = intval($_GET['news_page']);
} else {
    $news_page = 0;
}
if ($cstart > 9000000) {
    header("Location: " . str_replace("index.php", "", $_SERVER['PHP_SELF']));
    die;
}
if (isset($_GET['catalog'])) {
    $catalog = @strip_tags(str_replace('/', '', urldecode($_GET['catalog'])));
    if ($config['charset'] == "windows-1251" and $config['charset'] != detect_encoding($catalog)) {
        $catalog = iconv("UTF-8", "windows-1251//IGNORE", $catalog);
    }
    $catalog = $db->safesql(dle_substr($catalog, 0, 3, $config['charset']));
} else {
    $catalog = '';
}
if (isset($_GET['user'])) {
    $user = @strip_tags(str_replace('/', '', urldecode($_GET['user'])));
    if ($config['charset'] == "windows-1251" and $config['charset'] != detect_encoding($user)) {
        $user = iconv("UTF-8", "windows-1251//IGNORE", $user);
    }
    $user = $db->safesql($user);
    if (preg_match("/[\\||\\'|\\<|\\>|\"|\\!|\\?|\$|\\@|\\/|\\\\|\\&\\~\\*\\+]/", $user)) {
        $user = "";
    }
} else {
    $user = '';
}
コード例 #23
0
ファイル: rss.class.php プロジェクト: Gordondalos/union
 function pre_parse($date)
 {
     global $config;
     $i = 0;
     foreach ($this->content as $content) {
         $content_date = strtotime($content['date']);
         if ($date) {
             $this->content[$i]['date'] = time();
         } else {
             $this->content[$i]['date'] = $content_date;
         }
         if (!$i) {
             $this->lastdate = $content_date;
         }
         if ($i and $content_date > $this->lastdate) {
             $this->lastdate = $content_date;
         }
         if ($this->pre_lastdate != "" and $this->pre_lastdate >= $content_date) {
             unset($this->content[$i]);
             $i++;
             continue;
         }
         $this->content[$i]['description'] = trim($this->content[$i]['description']);
         $this->content[$i]['content'] = trim($this->content[$i]['content']);
         if ($this->content[$i]['content'] != '') {
             $this->content[$i]['description'] = $this->content[$i]['content'];
         }
         unset($this->content[$i]['content']);
         if (preg_match_all("#<div id=\\'news-id-(.+?)\\'>#si", $this->content[$i]['description'], $out)) {
             $this->content[$i]['description'] = preg_replace("#<div id=\\'news-id-(.+?)\\'>#si", "", $this->content[$i]['description']);
             $this->content[$i]['description'] = dle_substr($this->content[$i]['description'], 0, -6, $config['charset']);
         }
         $i++;
     }
 }
コード例 #24
0
    } else {
        $full_link = $config['http_home_url'] . "index.php?newsid=" . $row['id'];
    }
    $row['title'] = stripslashes($row['title']);
    if (dle_strlen($row['title'], $config['charset']) > 43) {
        $title = dle_substr($row['title'], 0, 43, $config['charset']) . " ...";
    } else {
        $title = $row['title'];
    }
    $row['short_story'] = trim(htmlspecialchars(strip_tags(stripslashes(str_replace(array("<br />", "&nbsp;"), " ", $row['short_story']))), ENT_QUOTES, $config['charset']));
    if ($user_group[$member_id['user_group']]['allow_hide']) {
        $row['short_story'] = str_ireplace("[hide]", "", str_ireplace("[/hide]", "", $row['short_story']));
    } else {
        $row['short_story'] = preg_replace("#\\[hide\\](.+?)\\[/hide\\]#is", "", $row['short_story']);
    }
    if (dle_strlen($row['short_story'], $config['charset']) > 150) {
        $description = dle_substr($row['short_story'], 0, 150, $config['charset']) . " ...";
    } else {
        $description = $row['short_story'];
    }
    $description = str_replace('&amp;', '&', $description);
    $description = preg_replace("'\\[attachment=(.*?)\\]'si", "", $description);
    $buffer .= "<a href=\"" . $full_link . "\"><span class=\"searchheading\">" . stripslashes($title) . "</span>";
    $buffer .= "<span>" . $description . "</span></a>";
}
if (!$buffer) {
    $buffer .= "<span class=\"notfound\">{$lang['related_not_found']}</span>";
}
$buffer .= '<span class="seperator"><a href="' . $config['http_home_url'] . '?do=search&amp;mode=advanced&amp;subaction=search&amp;story=' . $query . '">' . $lang['s_ffullstart'] . '</a></span><br class="break" />';
@header("Content-type: text/html; charset=" . $config['charset']);
echo $buffer;