当前位置: 首页>>代码示例>>PHP>>正文


PHP xfieldsload函数代码示例

本文整理汇总了PHP中xfieldsload函数的典型用法代码示例。如果您正苦于以下问题:PHP xfieldsload函数的具体用法?PHP xfieldsload怎么用?PHP xfieldsload使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了xfieldsload函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: die

 Данный код защищен авторскими правами
=====================================================
 Файл: show.custom.php
-----------------------------------------------------
 Назначение: вывод новостей
=====================================================
*/
if (!defined('DATALIFEENGINE')) {
    die("Hacking attempt!");
}
$i = 0;
if (isset($cstart)) {
    $i = $cstart;
}
$news_found = FALSE;
$xfields = xfieldsload();
$tpl->load_template($custom_template . '.tpl');
$sql_result = $db->query($sql_select);
while ($row = $db->get_row($sql_result)) {
    $news_found = TRUE;
    $attachments[] = $row['id'];
    $row['date'] = strtotime($row['date']);
    $i++;
    if (!$row['category']) {
        $my_cat = "---";
        $my_cat_link = "---";
    } else {
        $my_cat = array();
        $my_cat_link = array();
        $cat_list = explode(',', $row['category']);
        if (count($cat_list) == 1) {
开发者ID:Zzepish,项目名称:IvanShikalovWebSIte,代码行数:31,代码来源:show.custom.php

示例2: xfieldsload

 if ($row['user'] == $member_id['user_id'] and !$row['pm_read'] and $row['folder'] == "inbox") {
     $db->query("UPDATE " . USERPREFIX . "_users SET pm_unread=pm_unread-1  WHERE user_id='{$member_id['user_id']}'");
     if ($row['sendid']) {
         $addwhere = " OR id='{$row['sendid']}'";
     } else {
         $addwhere = "";
     }
     $db->query("UPDATE " . USERPREFIX . "_pm SET pm_read='1'  WHERE id='{$row['id']}'{$addwhere}");
 }
 if (strpos($tpl->copy_template, "[xfvalue_") !== false) {
     $xfound = true;
 } else {
     $xfound = false;
 }
 if ($xfound) {
     $xfields = xfieldsload(true);
     $xfieldsdata = xfieldsdataload($row['xfields']);
     foreach ($xfields as $value) {
         $preg_safe_name = preg_quote($value[0], "'");
         if ($value[5] != 1 or $member_id['user_group'] == 1 or $is_logged and $member_id['name'] == $row['user_from']) {
             if (empty($xfieldsdata[$value[0]])) {
                 $tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template);
             } else {
                 $tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "\\1", $tpl->copy_template);
             }
             $tpl->copy_template = preg_replace("'\\[xfvalue_{$preg_safe_name}\\]'i", stripslashes($xfieldsdata[$value[0]]), $tpl->copy_template);
         } else {
             $tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template);
             $tpl->copy_template = preg_replace("'\\[xfvalue_{$preg_safe_name}\\]'i", "", $tpl->copy_template);
         }
     }
开发者ID:Banych,项目名称:SiteCreate,代码行数:31,代码来源:pm.php

示例3: build_comments

 function build_comments($template, $area, $allow_cache = false, $re_url = false)
 {
     global $config, $tpl, $is_logged, $member_id, $user_group, $lang, $ajax_adds, $dle_tree_comments, $dle_login_hash;
     $tpl->load_template($template);
     if ($area == "news" or $area == 'ajax' and !isset($ajax_adds)) {
         $build_full_news = true;
     } else {
         $build_full_news = false;
     }
     $tpl->copy_template = "<div id='comment-id-{id}'>" . $tpl->copy_template . "</div>";
     $tpl->template = "<div id='comment-id-{id}'>" . $tpl->template . "</div>";
     if (strpos($tpl->copy_template, "[xfvalue_") !== false) {
         $this->xfound = true;
     } else {
         $this->xfound = false;
     }
     if ($this->xfound) {
         $this->xfields = xfieldsload(true);
     }
     $rows = false;
     if ($allow_cache) {
         $rows = dle_cache("comm_" . $allow_cache, $this->query);
     }
     if ($rows) {
         $rows = unserialize($rows);
         if (!is_array($rows)) {
             die("Cache data not correct");
         }
         $full_cache = true;
     } else {
         $rows = array();
         if ($build_full_news) {
             $sql_result = $this->db->query($this->query);
         } else {
             $sql_result = $this->db->query($this->query . " LIMIT " . $this->cstart . "," . $this->comments_per_pages);
         }
         while ($row = $this->db->get_row($sql_result)) {
             $rows[$row['id']] = array();
             foreach ($row as $key => $value) {
                 if ($key == "parent" and $value == 0) {
                     $value = false;
                 }
                 $rows[$row['id']][$key] = $value;
             }
         }
         $this->db->free($sql_result);
         unset($row);
         if ($build_full_news and $config['tree_comments']) {
             $rows = $this->build_tree($rows);
             if ($config['comm_msort'] == "DESC") {
                 $rows = array_reverse($rows, true);
             }
         }
         if ($allow_cache) {
             create_cache("comm_" . $allow_cache, serialize($rows), $this->query);
         }
     }
     if ($build_full_news and count($rows)) {
         $this->total_comments = count($rows);
         if ($this->cstart < $this->total_comments) {
             $rows = array_slice($rows, $this->cstart, $this->comments_per_pages, true);
         } else {
             $rows = array();
         }
     }
     if (count($rows)) {
         if ($build_full_news and $config['tree_comments']) {
             $dle_tree_comments = 1;
             $tpl->result['comments'] = "<ol class=\"comments-tree-list\">" . $this->compile_tree($rows, $area) . "</ol>";
         } else {
             $tpl->result['comments'] = $this->compile_comments($rows, $area);
         }
     } else {
         if ($config['seo_control'] and $_GET['cstart'] and $re_url) {
             $re_url = str_replace($config['http_home_url'], "/", $re_url);
             header("HTTP/1.0 301 Moved Permanently");
             header("Location: {$re_url}");
             die("Redirect");
         }
         $tpl->result['comments'] = "";
     }
     $tpl->clear();
     if ($area != 'ajax') {
         $tpl->result['comments'] = "<a name=\"comment\"></a>" . $tpl->result['comments'];
     }
     if ($config['comments_lazyload'] and $area != 'ajax' and $this->total_comments > $this->comments_per_pages) {
         $tpl->result['comments'] .= "\n<div class=\"ajax_comments_area\"><div class=\"ajax_loaded_comments\"></div><div class=\"ajax_comments_next\"></div></div>\n";
     }
     if ($area == 'news' and $config['comm_msort'] == "DESC") {
         $tpl->result['comments'] = "\n<div id=\"dle-ajax-comments\"></div>\n" . $tpl->result['comments'];
     }
     if ($area == 'news' and $config['comm_msort'] == "ASC") {
         $tpl->result['comments'] .= "\n<div id=\"dle-ajax-comments\"></div>\n";
     }
     if ($area != 'ajax' and $user_group[$member_id['user_group']]['del_allc'] and !$user_group[$member_id['user_group']]['edit_limit']) {
         $tpl->result['comments'] .= "\n<div class=\"mass_comments_action\">{$lang['mass_comments']}&nbsp;<select name=\"mass_action\"><option value=\"\">{$lang['edit_selact']}</option><option value=\"mass_combine\">{$lang['edit_selcomb']}</option><option value=\"mass_delete\">{$lang['edit_seldel']}</option></select>&nbsp;&nbsp;<input type=\"submit\" class=\"bbcodes\" value=\"{$lang['b_start']}\" /></div>\n<input type=\"hidden\" name=\"do\" value=\"comments\" /><input type=\"hidden\" name=\"dle_allow_hash\" value=\"{$dle_login_hash}\" /><input type=\"hidden\" name=\"area\" value=\"{$area}\" />";
     }
     if ($area != 'ajax') {
         $tpl->result['comments'] = "<form method=\"post\" action=\"\" name=\"dlemasscomments\" id=\"dlemasscomments\"><div id=\"dle-comments-list\">\n" . $tpl->result['comments'] . "</div></form>\n";
     }
//.........这里部分代码省略.........
开发者ID:Gordondalos,项目名称:union,代码行数:101,代码来源:comments.class.php

示例4: build_comments

 function build_comments($template, $area, $allow_cache = false)
 {
     global $config, $tpl, $is_logged, $member_id, $user_group, $lang, $dle_login_hash, $_TIME, $allow_comments_ajax, $ajax_adds;
     $tpl->load_template($template);
     $tpl->copy_template = "<div id='comment-id-{id}'>" . $tpl->copy_template . "</div>";
     $tpl->template = "<div id='comment-id-{id}'>" . $tpl->template . "</div>";
     if (strpos($tpl->copy_template, "[xfvalue_") !== false) {
         $xfound = true;
     } else {
         $xfound = false;
     }
     if ($xfound) {
         $xfields = xfieldsload(true);
     }
     if ($area != 'ajax' and $config['comm_msort'] == "DESC") {
         $tpl->copy_template = "\n<div id=\"dle-ajax-comments\"></div>\n" . $tpl->copy_template;
     }
     if ($area != 'ajax') {
         $tpl->copy_template = "<form method=\"post\" action=\"\" name=\"dlemasscomments\" id=\"dlemasscomments\"><div id=\"dle-comments-list\">\n" . $tpl->copy_template;
     }
     if ($area != 'ajax') {
         $tpl->copy_template = "<a name=\"comment\"></a>" . $tpl->copy_template;
     }
     $rows = false;
     if ($allow_cache) {
         $rows = dle_cache("comm_" . $allow_cache, $this->query . " LIMIT " . $this->cstart . "," . $this->comments_per_pages);
     }
     if ($rows) {
         $rows = unserialize($rows);
         $full_cache = true;
     } else {
         $rows = $this->db->super_query($this->query . " LIMIT " . $this->cstart . "," . $this->comments_per_pages, true);
         if ($allow_cache) {
             create_cache("comm_" . $allow_cache, serialize($rows), $this->query . " LIMIT " . $this->cstart . "," . $this->comments_per_pages);
         }
     }
     if (count($rows)) {
         foreach ($rows as $row) {
             $this->intern_count++;
             $row['date'] = strtotime($row['date']);
             $row['gast_name'] = stripslashes($row['gast_name']);
             $row['gast_email'] = stripslashes($row['gast_email']);
             $row['name'] = stripslashes($row['name']);
             if (!$row['is_register'] or $row['name'] == '') {
                 if ($row['gast_email'] != "") {
                     $tpl->set('{author}', "<a href=\"mailto:" . htmlspecialchars($row['gast_email'], ENT_QUOTES) . "\">" . $row['gast_name'] . "</a>");
                 } else {
                     $tpl->set('{author}', $row['gast_name']);
                 }
                 $tpl->set('{login}', $row['gast_name']);
                 $tpl->set('[profile]', "");
                 $tpl->set('[/profile]', "");
             } else {
                 if ($config['allow_alt_url'] == "yes") {
                     $go_page = $config['http_home_url'] . "user/" . urlencode($row['name']) . "/";
                     $tpl->set('[profile]', "<a href=\"" . $config['http_home_url'] . "user/" . urlencode($row['name']) . "/\">");
                 } else {
                     $go_page = "{$PHP_SELF}?subaction=userinfo&user=" . urlencode($row['name']);
                     $tpl->set('[profile]', "<a href=\"{$PHP_SELF}?subaction=userinfo&amp;user=" . urlencode($row['name']) . "\">");
                 }
                 $go_page = "onclick=\"ShowProfile('" . urlencode($row['name']) . "', '" . htmlspecialchars($go_page) . "', '" . $user_group[$member_id['user_group']]['admin_editusers'] . "'); return false;\"";
                 if ($config['allow_alt_url'] == "yes") {
                     $tpl->set('{author}', "<a {$go_page} href=\"" . $config['http_home_url'] . "user/" . urlencode($row['name']) . "/\">" . $row['name'] . "</a>");
                 } else {
                     $tpl->set('{author}', "<a {$go_page} href=\"{$PHP_SELF}?subaction=userinfo&amp;user=" . urlencode($row['name']) . "\">" . $row['name'] . "</a>");
                 }
                 $tpl->set('{login}', $row['name']);
                 $tpl->set('[/profile]', "</a>");
             }
             if ($is_logged and $member_id['user_group'] == '1') {
                 $tpl->set('{ip}', "IP: <a onclick=\"return dropdownmenu(this, event, IPMenu('" . $row['ip'] . "', '" . $lang['ip_info'] . "', '" . $lang['ip_tools'] . "', '" . $lang['ip_ban'] . "'), '190px')\" href=\"https://www.nic.ru/whois/?ip={$row['ip']}\" target=\"_blank\">{$row['ip']}</a>");
             } else {
                 $tpl->set('{ip}', '');
             }
             $edit_limit = false;
             if (!$user_group[$member_id['user_group']]['edit_limit']) {
                 $edit_limit = true;
             } elseif ($row['date'] + $user_group[$member_id['user_group']]['edit_limit'] * 60 > $_TIME) {
                 $edit_limit = true;
             }
             if ($is_logged and $edit_limit and ($member_id['name'] == $row['name'] and $row['is_register'] and $user_group[$member_id['user_group']]['allow_editc'] or $user_group[$member_id['user_group']]['edit_allc'])) {
                 $tpl->set('[com-edit]', "<a onclick=\"ajax_comm_edit('" . $row['id'] . "', '" . $area . "'); return false;\" href=\"" . $config['http_home_url'] . "index.php?do=comments&amp;action=comm_edit&amp;id=" . $row['id'] . "&amp;area=" . $area . "\">");
                 $tpl->set('[/com-edit]', "</a>");
                 $allow_comments_ajax = true;
             } else {
                 $tpl->set_block("'\\[com-edit\\](.*?)\\[/com-edit\\]'si", "");
             }
             if ($is_logged and $edit_limit and ($member_id['name'] == $row['name'] and $row['is_register'] and $user_group[$member_id['user_group']]['allow_delc'] or $member_id['user_group'] == '1' or $user_group[$member_id['user_group']]['del_allc'])) {
                 $tpl->set('[com-del]', "<a href=\"javascript:DeleteComments('{$row['id']}', '{$dle_login_hash}')\">");
                 $tpl->set('[/com-del]', "</a>");
             } else {
                 $tpl->set_block("'\\[com-del\\](.*?)\\[/com-del\\]'si", "");
             }
             if ($user_group[$member_id['user_group']]['del_allc'] and !$user_group[$member_id['user_group']]['edit_limit']) {
                 $tpl->set('{mass-action}', "<input name=\"selected_comments[]\" value=\"{$row['id']}\" type=\"checkbox\" />");
             } else {
                 $tpl->set('{mass-action}', "");
             }
             if ($area == 'lastcomments') {
                 $tpl->set_block("'\\[fast\\](.*?)\\[/fast\\]'si", "");
//.........这里部分代码省略.........
开发者ID:Hadryan,项目名称:L2LWEB,代码行数:101,代码来源:comments.class.php

示例5: runBlockPro


//.........这里部分代码省略.........
			}

			
			/**
			 * Service function - take params from table
			 * @param $table string - название таблицы
			 * @param $fields string - необходимые поля через запятйю или * для всех
			 * @param $where string - условие выборки
			 * @param $multirow bool - забирать ли один ряд или несколько
			 * @param $start int - начальное значение выборки
			 * @param $limit int - количество записей для выборки, 0 - выбрать все
			 * @param $sort string - поле, по которому осуществляется сортировка
			 * @param $sort_order - направление сортировки
			 * @return array с данными или false если mysql вернуль 0 рядов
			 */
			//$news = $this->load_table (PREFIX."_post", $fields = "*", $where = '1', $multirow = false, $start = 0, $limit = 10, $sort = '', $sort_order = 'desc');

			$news = $this->load_table (PREFIX . '_post p LEFT JOIN ' . PREFIX . '_post_extras e ON (p.id=e.news_id)', $selectRows, $where, true, $this->config['start_from'], $this->config['limit'], $sort, $ordering);


			if(empty($news)) $news = array();

			// Задаём переменную, в котоую будем всё складывать
			$output = '';

			// Если в выборке нет новостей - сообщаем об этом
			if (empty($news)) {
				$output .= '<span style="color: #f00">По заданным критериям материалов нет, попробуйте изменить параметры строки подключения</span>';
				return;
			}
			// Пробегаем по массиву с новостями и формируем список
			foreach ($news as $newsItem) 
			{
				$xfields = xfieldsload();
				$newsItem['date'] = strtotime($newsItem['date']);

				// Формируем ссылки на категории и иконки категорий
				$my_cat = array();
				$my_cat_icon = array();
				$my_cat_link = array();
				$cat_list = explode(',', $newsItem['category']);
				foreach($cat_list as $element) {
					if(isset($this->cat_info[$element])) {
						$my_cat[] = $this->cat_info[$element]['name'];
						if ($this->cat_info[$element]['icon'])
							$my_cat_icon[] = '<img class="bp-cat-icon" src="'.$this->cat_info[$element]['icon'].'" alt="'.$this->cat_info[$element]['name'].'" />';
						else
							$my_cat_icon[] = '<img class="bp-cat-icon" src="{THEME}/blockpro/'.$this->config['noicon'].'" alt="'.$this->cat_info[$element]['name'].'" />';
						if( $this->dle_config['allow_alt_url'] == 'yes' ) 
							$my_cat_link[] = '<a href="'.$this->dle_config['http_home_url'].get_url($element).'/">'.$this->cat_info[$element]['name'].'</a>';
						else 
							$my_cat_link[] = '<a href="'.$PHP_SELF.'?do=cat&category='.$this->cat_info[$element]['alt_name'].'">'.$this->cat_info[$element]['name'].'</a>';
					}
				}
				$categoryUrl = ($newsItem['category']) ? $this->dle_config['http_home_url'] . get_url(intval($newsItem['category'])) . '/' : '/' ;

				// Ссылка на профиль  юзера
				if( $this->dle_config['allow_alt_url'] == 'yes' ) {
					$go_page = $config['http_home_url'].'user/'.urlencode($newsItem['autor']).'/';
				} else {
					$go_page = $PHP_SELF.'?subaction=userinfo&amp;user='.urlencode($newsItem['autor']);
				}

				// Выводим картинку
				switch($this->config['image'])
				{
开发者ID:n0wheremany,项目名称:Block.Pro.3,代码行数:67,代码来源:block.pro.3.php


注:本文中的xfieldsload函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。