本文整理汇总了PHP中nv_br2nl函数的典型用法代码示例。如果您正苦于以下问题:PHP nv_br2nl函数的具体用法?PHP nv_br2nl怎么用?PHP nv_br2nl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nv_br2nl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: BoldKeywordInStr
/**
* BoldKeywordInStr()
*
* @param mixed $str
* @param mixed $keyword
* @return
*/
function BoldKeywordInStr($str, $keyword, $logic)
{
global $db;
$str = nv_br2nl($str);
$str = nv_nl2br($str, " ");
$str = nv_unhtmlspecialchars(strip_tags(trim($str)));
$str = $db->unfixdb($str);
$pos = false;
if ($logic == 'AND') {
$array_keyword = array($keyword, nv_EncString($keyword));
} else {
$keyword .= " " . nv_EncString($keyword);
$array_keyword = explode(" ", $keyword);
$array_keyword = array_unique($array_keyword);
}
foreach ($array_keyword as $k) {
unset($matches);
if (preg_match("/^(.*?)" . preg_quote($k) . "/uis", $str, $matches)) {
$strlen = nv_strlen($str);
$kstrlen = nv_strlen($k);
$residual = $strlen - 300;
if ($residual > 0) {
$lstrlen = nv_strlen($matches[1]);
$rstrlen = $strlen - $lstrlen - $kstrlen;
$medium = round((300 - $kstrlen) / 2);
if ($lstrlen <= $medium) {
$str = nv_clean60($str, 300);
} elseif ($rstrlen <= $medium) {
$str = nv_substr($str, $residual, 300);
$str = nv_substr_clean($str, 'l');
} else {
$str = nv_substr($str, $lstrlen - $medium, $strlen - $lstrlen + $medium);
$str = nv_substr($str, 0, 300);
$str = nv_substr_clean($str, 'lr');
}
}
$pos = true;
break;
}
}
if (!$pos) {
return nv_clean60($str, 300);
}
$pattern = array();
foreach ($array_keyword as $k) {
$pattern[] = "/(" . preg_quote($k) . ")/uis";
}
$str = preg_replace($pattern, "{\\1}", $str);
$str = str_replace(array("{", "}"), array("<span class=\"keyword\">", "</span>"), $str);
return $str;
}
示例2: nv_block_data_config_html
function nv_block_data_config_html($module, $data_block, $lang_block)
{
global $lang_module;
if (defined('NV_EDITOR')) {
require NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
}
$htmlcontent = defined('NV_EDITOR') ? nv_editor_br2nl($data_block['htmlcontent']) : nv_br2nl($data_block['htmlcontent']);
$htmlcontent = nv_htmlspecialchars($htmlcontent);
if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
$html = nv_aleditor("htmlcontent", '100%', '150px', $htmlcontent);
} else {
$html = "<textarea style=\"width: 100%\" name=\"htmlcontent\" id=\"htmlcontent\" cols=\"20\" rows=\"8\">" . $htmlcontent . "</textarea>";
}
return '<tr><td colspan="2">' . $lang_block['htmlcontent'] . '<br>' . $html . '</td></tr>';
}
示例3: BoldKeywordInStr
/**
* BoldKeywordInStr()
*
* @param mixed $str
* @param mixed $keyword
* @return
*/
function BoldKeywordInStr($str, $keyword, $logic)
{
$str = nv_br2nl($str);
$str = nv_nl2br($str, ' ');
$str = nv_unhtmlspecialchars(strip_tags(trim($str)));
$pos = false;
if ($logic == 'AND') {
$array_keyword = array($keyword, nv_EncString($keyword));
} else {
$keyword .= ' ' . nv_EncString($keyword);
$array_keyword = explode(' ', $keyword);
$array_keyword = array_unique($array_keyword);
}
foreach ($array_keyword as $k) {
if (preg_match('/^(.*?)' . nv_preg_quote($k) . '/uis', $str, $matches)) {
$strlen = nv_strlen($str);
$kstrlen = nv_strlen($k);
$residual = $strlen - 300;
if ($residual > 0) {
$lstrlen = nv_strlen($matches[1]);
$rstrlen = $strlen - $lstrlen - $kstrlen;
$medium = round((300 - $kstrlen) / 2);
if ($lstrlen <= $medium) {
$str = nv_clean60($str, 300);
} elseif ($rstrlen <= $medium) {
$str = nv_substr($str, $residual, 300);
$str = nv_substr_clean($str, 'l');
} else {
$str = nv_substr($str, $lstrlen - $medium, $strlen - $lstrlen + $medium);
$str = nv_substr($str, 0, 300);
$str = nv_substr_clean($str, 'lr');
}
}
$pos = true;
break;
}
}
if (!$pos) {
return nv_clean60($str, 300);
}
$pattern = array();
foreach ($array_keyword as $k) {
$pattern[] = '/(' . nv_preg_quote($k) . ')/uis';
}
$str = preg_replace($pattern, '{\\1}', $str);
$str = str_replace(array('{', '}'), array('<span class="keyword">', '</span>'), $str);
return $str;
}
示例4: elseif
$rowcat['id'] = $id;
$rowcat['url'] = $url;
$rowcat['title'] = $title;
$rowcat['urlimg'] = $image;
$rowcat['description'] = $description;
} elseif ($id > 0) {
$query = $db->sql_query("SELECT * FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `id`=" . $id . "");
$rowcat = $db->sql_fetchrow($query);
if ($rowcat['id'] > 0) {
$page_title = $lang_module['weblink_edit_link'];
}
}
if (empty($rowcat['id'])) {
$page_title = $lang_module['weblink_add_link'];
}
$rowcat['description'] = defined('NV_EDITOR') ? nv_editor_br2nl($rowcat['description']) : nv_br2nl($rowcat['description']);
// dung de lay data tu CSDL
$rowcat['description'] = nv_htmlspecialchars($rowcat['description']);
// dung de dua vao editor
if (!empty($rowcat['urlimg']) and !nv_is_url($rowcat['urlimg'])) {
$rowcat['urlimg'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . $rowcat['urlimg'];
}
if (defined('NV_EDITOR')) {
require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
}
$contents = "";
if ($error != "") {
$contents .= "<div class=\"quote\" style=\"width:780px;\">\n";
$contents .= "<blockquote class=\"error\"><span>" . $error . "</span></blockquote>\n";
$contents .= "</div>\n";
$contents .= "<div class=\"clear\"></div>\n";
示例5: nv_del_moduleCache
$array['admin_id'] = $admin_info['admin_id'];
}
$sql = "UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_comments` SET \n `subject`=" . $db->dbescape($array['subject']) . ", \n `comment`=" . $db->dbescape($array['comment']) . ", \n `admin_reply`=" . $db->dbescape($array['admin_reply']) . ", \n `admin_id`=" . $array['admin_id'] . " \n WHERE `id`=" . $id;
$result = $db->sql_query($sql);
if (!$result) {
$is_error = true;
$error = $lang_module['file_error1'];
} else {
nv_del_moduleCache($module_name);
Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=comment&status=" . $row['status']);
exit;
}
}
} else {
$array['subject'] = $row['subject'];
$array['comment'] = nv_br2nl($row['comment']);
$array['admin_reply'] = $row['admin_reply'];
$array['admin_id'] = (int) $row['admin_id'];
}
if (!empty($array['comment'])) {
$array['comment'] = nv_htmlspecialchars($array['comment']);
}
$xtpl = new XTemplate("comment_edit.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file);
$xtpl->assign('FORM_ACTION', NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $op . "&edit=1&id=" . $id);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('DATA', $array);
if ($is_error) {
$xtpl->assign('ERROR', $error);
$xtpl->parse('main.error');
}
$xtpl->parse('main');
示例6: nv_fix_banner_weight
$stmt->bindParam(':title', $title, PDO::PARAM_STR);
$stmt->bindParam(':description', $description, PDO::PARAM_STR);
$stmt->bindParam(':form', $form, PDO::PARAM_STR);
$stmt->execute();
if ($form_old != $form or $blang_old != $blang) {
nv_fix_banner_weight($id);
}
nv_insert_logs(NV_LANG_DATA, $module_name, 'log_edit_plan', 'planid ' . $id, $admin_info['userid']);
nv_CreateXML_bannerPlan();
Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=info_plan&id=' . $id);
die;
}
} else {
$blang = $row['blang'];
$title = $row['title'];
$description = nv_br2nl($row['description']);
$form = $row['form'];
$width = $row['width'];
$height = $row['height'];
}
if (!empty($description)) {
$description = nv_htmlspecialchars($description);
}
if (empty($form)) {
$form = 'sequential';
}
if (empty($width)) {
$width = 50;
}
if (empty($height)) {
$height = 50;
示例7: user_info
/**
* user_info()
*
* @param mixed $data
* @return
*/
function user_info($data, $array_field_config, $custom_fields, $error)
{
global $module_info, $module_file, $global_config, $lang_global, $lang_module, $module_name;
$groups_list = nv_groups_list_pub();
$xtpl = new XTemplate('info.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
$xtpl->assign('EDITINFO_FORM', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=editinfo');
$xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
$xtpl->assign('NV_LANG_INTERFACE', NV_LANG_INTERFACE);
$xtpl->assign('LANG', $lang_module);
if (!empty($error)) {
$xtpl->assign('ERROR', $error);
$xtpl->parse('main.error');
}
$xtpl->assign('URL_HREF', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=');
$xtpl->assign('URL_MODULE', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name);
if (defined('NV_OPENID_ALLOWED')) {
$xtpl->parse('main.allowopenid');
}
if (!empty($groups_list) and $global_config['allowuserpublic'] == 1) {
$xtpl->parse('main.regroups');
}
$xtpl->assign('DATA', $data);
if ($data['allowloginchange']) {
$xtpl->assign('NICK_MAXLENGTH', NV_UNICKMAX);
$xtpl->parse('main.username_change');
} else {
$xtpl->parse('main.username_no_change');
}
if ($data['allowmailchange']) {
$xtpl->parse('main.email_change');
} else {
$xtpl->parse('main.email_no_change');
}
foreach ($data['gender_array'] as $gender) {
$xtpl->assign('GENDER', $gender);
$xtpl->parse('main.gender_option');
}
// Parse photo
if (!empty($data['photo'])) {
$xtpl->parse('main.photo');
} else {
$xtpl->parse('main.add_photo');
}
$xtpl->parse('main.name_show_' . $global_config['name_show']);
// Parse custom fields
if (!empty($array_field_config)) {
$a = 0;
$userid = 0;
foreach ($array_field_config as $row) {
if ($row['show_register'] and $userid == 0 or $userid > 0) {
$row['tbodyclass'] = $a % 2 ? ' class="second"' : '';
if ($userid == 0 and empty($custom_fields)) {
if (!empty($row['field_choices'])) {
if ($row['field_type'] == 'date') {
$row['value'] = $row['field_choices']['current_date'] ? NV_CURRENTTIME : $row['default_value'];
} elseif ($row['field_type'] == 'number') {
$row['value'] = $row['default_value'];
} else {
$temp = array_keys($row['field_choices']);
$tempkey = intval($row['default_value']) - 1;
$row['value'] = isset($temp[$tempkey]) ? $temp[$tempkey] : '';
}
} else {
$row['value'] = $row['default_value'];
}
} else {
$row['value'] = isset($custom_fields[$row['field']]) ? $custom_fields[$row['field']] : $row['default_value'];
}
$row['required'] = $row['required'] ? 'required' : '';
$xtpl->assign('FIELD', $row);
if ($row['required']) {
$xtpl->parse('main.field.loop.required');
}
if ($row['field_type'] == 'textbox' or $row['field_type'] == 'number') {
$xtpl->parse('main.field.loop.textbox');
} elseif ($row['field_type'] == 'date') {
$row['value'] = empty($row['value']) ? '' : date('d/m/Y', $row['value']);
$xtpl->assign('FIELD', $row);
$xtpl->parse('main.field.loop.date');
} elseif ($row['field_type'] == 'textarea') {
$row['value'] = nv_htmlspecialchars(nv_br2nl($row['value']));
$xtpl->assign('FIELD', $row);
$xtpl->parse('main.field.loop.textarea');
} elseif ($row['field_type'] == 'editor') {
$row['value'] = htmlspecialchars(nv_editor_br2nl($row['value']));
if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
$array_tmp = explode('@', $row['class']);
$edits = nv_aleditor('custom_fields[' . $row['field'] . ']', $array_tmp[0], $array_tmp[1], $row['value']);
$xtpl->assign('EDITOR', $edits);
$xtpl->parse('main.field.loop.editor');
} else {
$row['class'] = '';
$xtpl->assign('FIELD', $row);
$xtpl->parse('main.field.loop.textarea');
//.........这里部分代码省略.........
示例8: array
} else {
$module_config[$c_module][$c_config_name] = $c_config_value;
}
}
}
}
$theme_array = array();
$theme_array_file = nv_scandir(NV_ROOTDIR . "/themes", $global_config['check_theme']);
$sql = "SELECT DISTINCT `theme` FROM `" . NV_PREFIXLANG . "_modthemes` WHERE `func_id`=0";
$result = $db->sql_query($sql);
while (list($theme) = $db->sql_fetchrow($result)) {
if (in_array($theme, $theme_array_file)) {
$theme_array[] = $theme;
}
}
$global_config['disable_site_content'] = nv_br2nl($global_config['disable_site_content']);
// dung de lay data tu CSDL
$global_config['disable_site_content'] = nv_htmlspecialchars($global_config['disable_site_content']);
$value_setting[] = array("sitename" => $global_config['site_name'], "site_logo" => $global_config['site_logo'], "description" => $global_config['site_description'], "disable_content" => $global_config['disable_site_content']);
$module_array = array();
$sql = "SELECT title, custom_title FROM `" . NV_MODULES_TABLE . "` WHERE `act`=1 ORDER BY `weight` ASC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$module_array[] = $row;
}
$xtpl = new XTemplate("main.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file . "");
$xtpl->assign('LANG', $lang_module);
foreach ($value_setting as $value_setting_i) {
$xtpl->assign('VALUE', $value_setting_i);
}
foreach ($theme_array as $folder) {
示例9: nv_show_cat_list
} else {
$error = $lang_module['errorsave'];
}
$db->sql_freeresult();
}
}
}
global $array_cat, $numcat;
$contents = "<div id=\"module_show_list\">";
$contents .= nv_show_cat_list($array_cat, $numcat);
$contents .= "</div><br>\n";
$catid = isset($_GET['catid']) ? intval($_GET['catid']) : 0;
if ($catid > 0) {
list($catid, $parentid, $title, $catimage, $alias, $description, $keywords) = $db->sql_fetchrow($db->sql_query("SELECT `catid`, `parentid`, `title`, `catimage`, `alias`, `description`, `keywords` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_cat` where `catid`=" . $catid . ""));
$caption = $lang_module['edit_cat'];
$description = nv_br2nl($description);
} else {
$catimage = '';
$caption = $lang_module['add_cat'];
$parentid = 0;
}
$description = nv_htmlspecialchars($description);
if ($error != "") {
$contents .= "<div class=\"quote\" style=\"width:780px;\">\n";
$contents .= "<blockquote class=\"error\"><span>" . $error . "</span></blockquote>\n";
$contents .= "</div>\n";
$contents .= "<div class=\"clear\"></div>\n";
}
$contents .= "<form action=\"" . NV_BASE_ADMINURL . "index.php\" method=\"post\">";
$contents .= "<input type=\"hidden\" name =\"" . NV_NAME_VARIABLE . "\"value=\"" . $module_name . "\" />";
$contents .= "<input type=\"hidden\" name =\"" . NV_OP_VARIABLE . "\"value=\"" . $op . "\" />";
示例10: redriect
} else {
$url = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
$msg1 = $lang_module['content_saveok'];
$msg2 = $lang_module['content_main'] . ' ' . $module_info['custom_title'];
redriect($msg1, $msg2, $url, $module_data . '_bodyhtml');
}
}
} else {
$url = 'javascript: history.go(-1)';
$msg1 = implode('<br />', $error);
$msg2 = $lang_module['content_back'];
redriect($msg1, $msg2, $url, $module_data . '_bodyhtml', 'back');
}
$id_block_content = $id_block_content_post;
}
$rowcontent['hometext'] = nv_htmlspecialchars(nv_br2nl($rowcontent['hometext']));
$rowcontent['bodyhtml'] = htmlspecialchars(nv_editor_br2nl($rowcontent['bodyhtml']));
if (!empty($rowcontent['homeimgfile']) and file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/img/' . $rowcontent['homeimgfile'])) {
$rowcontent['homeimgfile'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/img/' . $rowcontent['homeimgfile'];
}
if (!empty($rowcontent['vid_path']) and file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/vid/' . $rowcontent['vid_path'])) {
$rowcontent['vid_path'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/vid/' . $rowcontent['vid_path'];
}
$array_catid_in_row = explode(',', $rowcontent['listcatid']);
$sql = 'SELECT sourceid, title FROM ' . NV_PREFIXLANG . '_' . $module_data . '_sources ORDER BY weight ASC';
$result = $db->query($sql);
$array_source_module = array();
$array_source_module[0] = $lang_module['sources_sl'];
while (list($sourceid_i, $title_i) = $result->fetch(3)) {
$array_source_module[$sourceid_i] = $title_i;
}
示例11: nv_del_moduleCache
$fileimage = NV_UPLOADS_DIR . $row['fileimage'];
if (file_exists(NV_ROOTDIR . '/' . $fileimage)) {
@nv_deletefile(NV_ROOTDIR . '/' . $fileimage);
}
}
$db->query('DELETE FROM ' . NV_PREFIXLANG . '_' . $module_data . '_tmp WHERE id=' . $id);
nv_del_moduleCache($module_name);
Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=filequeue');
exit;
}
}
} else {
$array['catid'] = (int) $row['catid'];
$array['title'] = $row['title'];
$array['description'] = nv_editor_br2nl($row['description']);
$array['introtext'] = nv_br2nl($row['introtext']);
$array['user_name'] = $row['user_name'];
$array['author_name'] = $row['author_name'];
$array['author_email'] = $row['author_email'];
$array['author_url'] = $row['author_url'];
$array['fileupload'] = $row['fileupload'];
$array['fileupload2'] = array();
$array['linkdirect'] = $row['linkdirect'];
$array['version'] = $row['version'];
$array['filesize'] = (int) $row['filesize'];
$array['fileimage'] = $row['fileimage'];
$array['fileimage2'] = '';
$array['copyright'] = $row['copyright'];
$array['groups_view'] = $array['groups_download'] = '6';
$array['groups_comment'] = $module_config[$module_name]['setcomm'];
$array['fileupload'] = !empty($array['fileupload']) ? explode('[NV]', $array['fileupload']) : array();
示例12: elseif
}
} elseif (empty($id)) {
$row['image'] = '';
$row['imagealt'] = '';
$row['imageposition'] = 0;
$row['layout_func'] = '';
$row['description'] = '';
$row['bodytext'] = '';
$row['activecomm'] = $module_config[$module_name]['setcomm'];
$row['socialbutton'] = 1;
$row['gid'] = 0;
}
if (defined('NV_EDITOR')) {
require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
}
$row['description'] = nv_htmlspecialchars(nv_br2nl($row['description']));
$row['bodytext'] = htmlspecialchars(nv_editor_br2nl($row['bodytext']));
if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
$row['bodytext'] = nv_aleditor('bodytext', '100%', '300px', $row['bodytext']);
} else {
$row['bodytext'] = '<textarea style="width:100%;height:300px" name="bodytext">' . $row['bodytext'] . '</textarea>';
}
if (!empty($row['image']) and is_file(NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/' . $row['image'])) {
$row['image'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $row['image'];
}
$lang_global['title_suggest_max'] = sprintf($lang_global['length_suggest_max'], 65);
$lang_global['description_suggest_max'] = sprintf($lang_global['length_suggest_max'], 160);
$xtpl = new XTemplate('content.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('GLANG', $lang_global);
$xtpl->assign('FORM_ACTION', $action);
示例13: nv_editor_br2nl
/**
* nv_editor_br2nl()
*
* @param mixed $text
* @return
*/
function nv_editor_br2nl($text)
{
if (empty($text)) {
return '';
}
if (defined('NV_EDITOR')) {
return $text;
}
return nv_br2nl($text);
}
示例14: nv_update_keywords
if (!$db->sql_query_insert_id($sql)) {
$is_error = true;
$error = $lang_module['faq_error_notResult2'];
} else {
nv_update_keywords($array['catid']);
Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name);
exit;
}
}
}
} else {
if (defined('IS_EDIT')) {
$array['catid'] = (int) $row['catid'];
$array['title'] = $row['title'];
$array['answer'] = nv_editor_br2nl($row['answer']);
$array['question'] = nv_br2nl($row['question']);
} else {
$array['catid'] = 0;
$array['title'] = $array['answer'] = $array['question'] = "";
}
}
if (!empty($array['answer'])) {
$array['answer'] = nv_htmlspecialchars($array['answer']);
}
if (!empty($array['question'])) {
$array['question'] = nv_htmlspecialchars($array['question']);
}
$listcats = nv_listcats($array['catid']);
if (empty($listcats)) {
Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=cat&add=1");
exit;
示例15: user_info
//.........这里部分代码省略.........
$a = 0;
$userid = 0;
foreach ($array_field_config as $row) {
$row['tbodyclass'] = $a % 2 ? ' class="second"' : '';
if ($userid == 0 and empty($custom_fields)) {
if (!empty($row['field_choices'])) {
if ($row['field_type'] == 'date') {
$row['value'] = $row['field_choices']['current_date'] ? NV_CURRENTTIME : $row['default_value'];
} elseif ($row['field_type'] == 'number') {
$row['value'] = $row['default_value'];
} else {
$temp = array_keys($row['field_choices']);
$tempkey = intval($row['default_value']) - 1;
$row['value'] = isset($temp[$tempkey]) ? $temp[$tempkey] : '';
}
} else {
$row['value'] = $row['default_value'];
}
} else {
$row['value'] = isset($custom_fields[$row['field']]) ? $custom_fields[$row['field']] : $row['default_value'];
}
$row['required'] = $row['required'] ? 'required' : '';
$xtpl->assign('FIELD', $row);
if ($row['required']) {
$xtpl->parse('main.tab_edit_others.loop.required');
}
if ($row['field_type'] == 'textbox' or $row['field_type'] == 'number') {
$xtpl->parse('main.tab_edit_others.loop.textbox');
} elseif ($row['field_type'] == 'date') {
$row['value'] = empty($row['value']) ? '' : date('d/m/Y', $row['value']);
$xtpl->assign('FIELD', $row);
$xtpl->parse('main.tab_edit_others.loop.date');
} elseif ($row['field_type'] == 'textarea') {
$row['value'] = nv_htmlspecialchars(nv_br2nl($row['value']));
$xtpl->assign('FIELD', $row);
$xtpl->parse('main.tab_edit_others.loop.textarea');
} elseif ($row['field_type'] == 'editor') {
$row['value'] = htmlspecialchars(nv_editor_br2nl($row['value']));
if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
$array_tmp = explode('@', $row['class']);
$edits = nv_aleditor('custom_fields[' . $row['field'] . ']', $array_tmp[0], $array_tmp[1], $row['value'], 'Basic');
$xtpl->assign('EDITOR', $edits);
$xtpl->parse('main.tab_edit_others.loop.editor');
} else {
$row['class'] = '';
$xtpl->assign('FIELD', $row);
$xtpl->parse('main.tab_edit_others.loop.textarea');
}
} elseif ($row['field_type'] == 'select') {
foreach ($row['field_choices'] as $key => $value) {
$xtpl->assign('FIELD_CHOICES', array('key' => $key, 'selected' => $key == $row['value'] ? ' selected="selected"' : '', 'value' => $value));
$xtpl->parse('main.tab_edit_others.loop.select.loop');
}
$xtpl->parse('main.tab_edit_others.loop.select');
} elseif ($row['field_type'] == 'radio') {
$number = 0;
foreach ($row['field_choices'] as $key => $value) {
$xtpl->assign('FIELD_CHOICES', array('id' => $row['fid'] . '_' . $number++, 'key' => $key, 'checked' => $key == $row['value'] ? ' checked="checked"' : '', 'value' => $value));
$xtpl->parse('main.tab_edit_others.loop.radio.loop');
}
$xtpl->parse('main.tab_edit_others.loop.radio');
} elseif ($row['field_type'] == 'checkbox') {
$number = 0;
$valuecheckbox = !empty($row['value']) ? explode(',', $row['value']) : array();
foreach ($row['field_choices'] as $key => $value) {
$xtpl->assign('FIELD_CHOICES', array('id' => $row['fid'] . '_' . $number++, 'key' => $key, 'checked' => in_array($key, $valuecheckbox) ? ' checked="checked"' : '', 'value' => $value));