コード例 #1
0
/**
 * 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
0
ファイル: global.html.php プロジェクト: atarubi/nuke-viet
 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
0
ファイル: functions.php プロジェクト: lzhao18/nukeviet
/**
 * 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
0
    $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
0
ファイル: comment.php プロジェクト: atarubi/nuke-viet
             $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 . "&amp;" . NV_OP_VARIABLE . "=" . $op . "&amp;edit=1&amp;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
0
ファイル: edit_plan.php プロジェクト: nukeplus/nuke
        $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
0
ファイル: theme.php プロジェクト: anhtunguyen/vietnamguide
/**
 * 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 . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . 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 . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=');
    $xtpl->assign('URL_MODULE', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . 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');
                    }
                } 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.field.loop.select.loop');
                    }
                    $xtpl->parse('main.field.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.field.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));
                        $xtpl->parse('main.field.loop.checkbox');
                    }
                } elseif ($row['field_type'] == 'multiselect') {
                    $valueselect = !empty($row['value']) ? explode(',', $row['value']) : array();
                    foreach ($row['field_choices'] as $key => $value) {
                        $xtpl->assign('FIELD_CHOICES', array('key' => $key, 'selected' => in_array($key, $valueselect) ? ' selected="selected"' : '', 'value' => $value));
                        $xtpl->parse('main.field.loop.multiselect.loop');
                    }
                    $xtpl->parse('main.field.loop.multiselect');
                }
                $xtpl->parse('main.field.loop');
            }
        }
        $xtpl->parse('main.field');
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}
コード例 #8
0
ファイル: main.php プロジェクト: syphuonglam/creative-portal
            } 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
0
ファイル: cat.php プロジェクト: syphuonglam/creative-portal
            } 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
0
            } 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
0
                 $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
0
ファイル: content.php プロジェクト: nukeviet/nukeviet
    }
} 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
0
ファイル: functions.php プロジェクト: nukeviet/nukeviet
/**
 * 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
0
ファイル: main.php プロジェクト: syphuonglam/creative-portal
             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
0
ファイル: theme.php プロジェクト: hongoctrien/nukeviet
/**
 * user_info()
 *
 * @param mixed $data
 * @param mixed $array_field_config
 * @param mixed $custom_fields
 * @param mixed $types
 * @param mixed $data_questions
 * @param mixed $data_openid
 * @param mixed $groups
 * @param mixed $pass_empty
 * @return
 */
function user_info($data, $array_field_config, $custom_fields, $types, $data_questions, $data_openid, $groups, $pass_empty)
{
    global $module_info, $module_file, $global_config, $lang_global, $lang_module, $module_name, $op;
    $xtpl = new XTemplate('info.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    if (defined('ACCESS_EDITUS')) {
        //trường hợp trưởng nhóm truy cập sửa thông tin member
        $xtpl->assign('EDITINFO_FORM', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=editinfo/' . $data['group_id'] . '/' . $data['userid']);
    } else {
        $xtpl->assign('EDITINFO_FORM', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=editinfo');
    }
    $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
    $xtpl->assign('NV_LANG_INTERFACE', NV_LANG_INTERFACE);
    $xtpl->assign('AVATAR_DEFAULT', NV_BASE_SITEURL . 'themes/' . $module_info['template'] . '/images/' . $module_file . '/no_avatar.png');
    $xtpl->assign('URL_AVATAR', nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=avatar/src', true));
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('GLANG', $lang_global);
    $xtpl->assign('NICK_MAXLENGTH', NV_UNICKMAX);
    $xtpl->assign('NICK_MINLENGTH', NV_UNICKMIN);
    $xtpl->assign('PASS_MAXLENGTH', NV_UPASSMAX);
    $xtpl->assign('PASS_MINLENGTH', NV_UPASSMIN);
    $xtpl->assign('URL_HREF', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=');
    $xtpl->assign('URL_MODULE', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name);
    $xtpl->assign('DATA', $data);
    if ($pass_empty) {
        $xtpl->assign('FORM_HIDDEN', ' hidden');
    }
    $xtpl->assign(strtoupper($data['type']) . '_ACTIVE', 'active');
    $xtpl->assign(strtoupper('TAB_' . $data['type']) . '_ACTIVE', 'in active');
    $xtpl->parse('main.name_show_' . $global_config['name_show']);
    foreach ($data['gender_array'] as $gender) {
        $xtpl->assign('GENDER', $gender);
        $xtpl->parse('main.gender_option');
    }
    foreach ($data_questions as $array_question_i) {
        $xtpl->assign('QUESTION', $array_question_i['title']);
        $xtpl->parse('main.frquestion');
    }
    if (in_array('username', $types)) {
        if ($pass_empty) {
            $xtpl->parse('main.tab_edit_username.username_empty_pass');
        }
        $xtpl->parse('main.edit_username');
        $xtpl->parse('main.tab_edit_username');
    }
    if (in_array('password', $types)) {
        if (!$pass_empty and !defined('ACCESS_PASSUS')) {
            $xtpl->parse('main.tab_edit_password.is_old_pass');
        }
        $xtpl->parse('main.edit_password');
        $xtpl->parse('main.tab_edit_password');
    }
    if (in_array('email', $types)) {
        if ($pass_empty) {
            $xtpl->parse('main.tab_edit_email.email_empty_pass');
        }
        $xtpl->parse('main.edit_email');
        $xtpl->parse('main.tab_edit_email');
    }
    if (in_array('openid', $types)) {
        if (!empty($data_openid)) {
            $openid_del_al = 0;
            foreach ($data_openid as $openid) {
                $xtpl->assign('OPENID_LIST', $openid);
                if (!$openid['disabled']) {
                    $xtpl->parse('main.tab_edit_openid.openid_not_empty.openid_list.is_act');
                    ++$openid_del_al;
                } else {
                    $xtpl->parse('main.tab_edit_openid.openid_not_empty.openid_list.disabled');
                }
                $xtpl->parse('main.tab_edit_openid.openid_not_empty.openid_list');
            }
            if ($openid_del_al) {
                if ($openid_del_al > 1) {
                    $xtpl->parse('main.tab_edit_openid.openid_not_empty.checkAll');
                }
                $xtpl->parse('main.tab_edit_openid.openid_not_empty.button');
            }
            $xtpl->parse('main.tab_edit_openid.openid_not_empty');
        }
        foreach ($global_config['openid_servers'] as $server) {
            $assigns = array();
            $assigns['href'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=oauth&amp;server=' . $server;
            $assigns['title'] = ucfirst($server);
            $assigns['img_src'] = NV_BASE_SITEURL . 'themes/' . $module_info['template'] . '/images/' . $module_file . '/' . $server . '.png';
            $assigns['img_width'] = $assigns['img_height'] = 24;
            $xtpl->assign('OPENID', $assigns);
            $xtpl->parse('main.tab_edit_openid.server');
        }
        $xtpl->parse('main.edit_openid');
        $xtpl->parse('main.tab_edit_openid');
    }
    if (in_array('group', $types)) {
        $group_check_all_checked = 1;
        $count = 0;
        foreach ($groups as $group) {
            $group['status'] = $lang_module['group_status_' . $group['status']];
            $group['group_type'] = $lang_module['group_type_' . $group['group_type']];
            $xtpl->assign('GROUP_LIST', $group);
            if ($group['is_leader']) {
                $xtpl->assign('URL_IS_LEADER', nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=groups/' . $group['group_id'], true));
                $xtpl->parse('main.tab_edit_group.group_list.is_leader');
                $xtpl->parse('main.tab_edit_group.group_list.is_disable_checkbox');
            }
            $xtpl->parse('main.tab_edit_group.group_list');
            if (empty($group['checked'])) {
                $group_check_all_checked = 0;
            }
            $count++;
        }
        if ($count > 1) {
            if ($group_check_all_checked) {
                $xtpl->assign('CHECK_ALL_CHECKED', ' checked="checked"');
            }
            $xtpl->parse('main.tab_edit_group.checkAll');
        }
        $xtpl->parse('main.edit_group');
        $xtpl->parse('main.tab_edit_group');
    }
    if (in_array('others', $types) and !empty($array_field_config)) {
        // Parse custom fields
        $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));
                    $xtpl->parse('main.tab_edit_others.loop.checkbox.loop');
                }
                $xtpl->parse('main.tab_edit_others.loop.checkbox');
            } elseif ($row['field_type'] == 'multiselect') {
                $valueselect = !empty($row['value']) ? explode(',', $row['value']) : array();
                foreach ($row['field_choices'] as $key => $value) {
                    $xtpl->assign('FIELD_CHOICES', array('key' => $key, 'selected' => in_array($key, $valueselect) ? ' selected="selected"' : '', 'value' => $value));
                    $xtpl->parse('main.tab_edit_others.loop.multiselect.loop');
                }
                $xtpl->parse('main.tab_edit_others.loop.multiselect');
            }
            $xtpl->parse('main.tab_edit_others.loop');
        }
        if (defined('CKEDITOR')) {
            $xtpl->parse('main.tab_edit_others.ckeditor');
        }
        $xtpl->parse('main.edit_others');
        $xtpl->parse('main.tab_edit_others');
    }
    if (in_array('avatar', $types)) {
        $xtpl->parse('main.edit_avatar');
        $xtpl->parse('main.tab_edit_avatar');
    }
    if (in_array('question', $types)) {
        if ($pass_empty) {
            $xtpl->parse('main.question_empty_pass');
        }
        $xtpl->parse('main.edit_question');
        $xtpl->parse('main.tab_edit_question');
    }
    if (in_array('safemode', $types)) {
        if ($pass_empty) {
            $xtpl->parse('main.safemode_empty_pass');
        }
        $xtpl->parse('main.edit_safemode');
        $xtpl->parse('main.tab_edit_safemode');
    }
    $_lis = $module_info['funcs'];
    $_alias = $module_info['alias'];
    foreach ($_lis as $_li) {
        if ($_li['show_func']) {
            if ($_li['func_name'] == $op or $_li['func_name'] == 'avatar' or $_li['func_name'] == 'groups') {
                continue;
            }
            if ($_li['func_name'] == 'register' and !$global_config['allowuserreg']) {
                continue;
            }
            $href = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $_alias[$_li['func_name']];
            $li = array('href' => $href, 'title' => $_li['func_name'] == 'main' ? $lang_module['user_info'] : $_li['func_custom_name']);
            $xtpl->assign('NAVBAR', $li);
            $xtpl->parse('main.navbar');
        }
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}
コード例 #16
0
ファイル: blog-content.php プロジェクト: hoangvtien/blog
// Goi js
$BL->callFrameWorks('ui.sortable', 'tipsy', 'autosize', 'ui.autocomplete', 'ui.datepicker', 'shadowbox');
$page_title = $BL->lang('blogManager');
// Lay va khoi tao cac bien
$error = "";
$complete = false;
$id = $nv_Request->get_int('id', 'get, post', 0);
// Xu ly
if ($id) {
    $sql = "SELECT * FROM " . $BL->table_prefix . "_rows WHERE id=" . $id;
    $result = $db->query($sql);
    if ($result->rowCount() != 1) {
        nv_info_die($BL->glang('error_404_title'), $BL->glang('error_404_title'), $BL->glang('error_404_content'));
    }
    $row = $result->fetch();
    $array_old = $array = array("postid" => (int) $row['postid'], "postgoogleid" => $row['postgoogleid'], "sitetitle" => $row['sitetitle'], "title" => $row['title'], "alias" => $row['alias'], "keywords" => $row['keywords'], "images" => $row['images'], "mediatype" => (int) $row['mediatype'], "mediaheight" => (int) $row['mediaheight'], "mediavalue" => $row['mediavalue'], "hometext" => nv_br2nl($row['hometext']), "bodytext" => $row['bodytext'], "bodyhtml" => '', "posttype" => (int) $row['posttype'], "fullpage" => (int) $row['fullpage'], "inhome" => (int) $row['inhome'], "catids" => $BL->string2array($row['catids']), "tagids" => $BL->string2array($row['tagids']), "numwords" => (int) $row['numwords'], "pubtime" => (int) $row['pubtime'], "pubtime_h" => date("G", $row['pubtime']), "pubtime_m" => (int) date("i", $row['pubtime']), "exptime" => (int) $row['exptime'], "exptime_h" => $row['exptime'] ? date("G", $row['exptime']) : 0, "exptime_m" => $row['exptime'] ? (int) date("i", $row['exptime']) : 0, "expmode" => (int) $row['expmode'], "status" => (int) $row['status']);
    $sql = "SELECT * FROM " . $BL->table_prefix . "_data_" . ceil($id / 4000) . " WHERE id=" . $id;
    $result = $db->query($sql);
    if ($result->rowCount()) {
        $row = $result->fetch();
        $array_old['bodyhtml'] = $array['bodyhtml'] = $row['bodyhtml'];
    }
    $form_action = NV_BASE_ADMINURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=" . $op . "&amp;id=" . $id;
    $table_caption = $BL->lang('blogEdit');
    // Gui email den cac email dang ky nhan tin
    $newsletters = 0;
    $isAutoKeywords = 0;
} else {
    $form_action = NV_BASE_ADMINURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=" . $op;
    $table_caption = $BL->lang('blogAdd');
    $array = array("postid" => $admin_info['userid'], "postgoogleid" => $BL->setting['sysGoogleAuthor'], "sitetitle" => '', "title" => '', "alias" => '', "keywords" => '', "images" => '', "mediatype" => $BL->setting['initMediaType'], "mediaheight" => $BL->setting['initMediaHeight'], "mediavalue" => '', "hometext" => '', "bodytext" => '', "bodyhtml" => '', "posttype" => $BL->setting['initPostType'], "fullpage" => 0, "inhome" => 1, "catids" => array(), "tagids" => array(), "numwords" => 0, "pubtime" => NV_CURRENTTIME, "pubtime_h" => date("G", NV_CURRENTTIME), "pubtime_m" => (int) date("i", NV_CURRENTTIME), "exptime" => 0, "exptime_h" => 0, "exptime_m" => 0, "expmode" => $BL->setting['initPostExp'], "status" => -2);
コード例 #17
0
ファイル: main.php プロジェクト: lzhao18/nukeviet
$sql = $db->sql();
$sth = $db->prepare($sql);
if (strpos($sql, ':content')) {
    $sth->bindValue(':content', '%' . $from['q'] . '%', PDO::PARAM_STR);
}
if (strpos($sql, ':post_name')) {
    $sth->bindValue(':post_name', '%' . $from['q'] . '%', PDO::PARAM_STR);
}
if (strpos($sql, ':post_email')) {
    $sth->bindValue(':post_email', '%' . $from['q'] . '%', PDO::PARAM_STR);
}
$sth->execute();
$array = array();
while (list($cid, $module, $area, $id, $content, $userid, $post_name, $email, $status) = $sth->fetch(3)) {
    if ($userid > 0) {
        $email = '<a href="' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=users&amp;' . NV_OP_VARIABLE . '=edit&amp;userid=' . $userid . '"> ' . $email . '</a>';
    }
    $content = nv_br2nl($content);
    $row = array('cid' => $cid, 'post_name' => $post_name, 'email' => $email, 'title' => nv_clean60($content, 255), 'content' => $content, 'module' => $module, 'link' => NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module . '&amp;' . NV_OP_VARIABLE . '=view&amp;area=' . $area . '&amp;id=' . $id, 'active' => $status ? 'checked="checked"' : '', 'status' => $status == 1 ? 'check' : 'circle-o', 'linkedit' => NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=edit&amp;cid=' . $cid, 'linkdelete' => NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=del&amp;list=' . $cid);
    $xtpl->assign('ROW', $row);
    $xtpl->parse('main.loop');
}
if (!empty($generate_page)) {
    $xtpl->assign('GENERATE_PAGE', $generate_page);
    $xtpl->parse('main.generate_page');
}
$xtpl->parse('main');
$contents = $xtpl->text('main');
include NV_ROOTDIR . '/includes/header.php';
echo nv_admin_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
コード例 #18
0
    $value .= $row_bpn['width'] . "x" . $row_bpn['height'] . "px";
    $value .= ")";
    $sel = $row['xbanner'] == $row_bpn['id'] ? ' selected' : '';
    $contents .= "<option value=\"" . $row_bpn['id'] . "\" " . $sel . ">" . $value . "</option>\n";
}
$contents .= "</select></td>\n";
$contents .= "</tr>\n";
$contents .= "</tbody>\n";
$showstype = $row['type'] == 'html' ? "" : " style='display:none' ";
$contents .= "<tbody " . $showstype . " id='html'>\n";
$contents .= "<tr>\n";
$contents .= "<td colspan='2'>" . $lang_module['block_content'] . ":<br />\n";
if (defined('NV_EDITOR')) {
    require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
}
$row['xhtml'] = defined('NV_EDITOR') ? nv_editor_br2nl($row['xhtml']) : nv_br2nl($row['xhtml']);
$row['xhtml'] = nv_htmlspecialchars($row['xhtml']);
if (defined('NV_EDITOR') and function_exists('nv_aleditor')) {
    $contents .= nv_aleditor("htmlcontent", '700px', '150px', $row['xhtml']);
} else {
    $contents .= "<textarea style=\"width: 700px\" name=\"htmlcontent\" id=\"htmlcontent\" cols=\"20\" rows=\"8\">" . $row['xhtml'] . "</textarea>";
}
$contents .= "</td>\n";
$contents .= "</tr>\n";
$contents .= "</tbody>\n";
$showstype = $row['type'] == 'rss' ? "" : " style='display:none' ";
$contents .= "<tbody " . $showstype . " id='rss'>\n";
$contents .= "<tr>\n";
$contents .= "<td>" . $lang_module['block_rss_url'] . ":</td>\n";
$contents .= "<td><input name=\"xrss\" type=\"text\" value=\"" . $row['xrss'] . "\" style=\"width:500px\"/></td>\n";
$contents .= "</tr>\n";
コード例 #19
0
ファイル: edit.php プロジェクト: syphuonglam/creative-portal
                }
                $file_name = str_replace(NV_ROOTDIR . "/", "", $upload_info['name']);
                $sql = "UPDATE `" . NV_USERS_GLOBALTABLE . "` SET `photo`=" . $db->dbescape($file_name) . " WHERE `userid`=" . $userid;
                $db->sql_query($sql);
            }
        }
        Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name);
        exit;
    }
} else {
    $_user = $row;
    $_user['password1'] = $_user['password2'] = "";
    $_user['birthday'] = !empty($_user['birthday']) ? date("d.m.Y", $_user['birthday']) : "";
    $_user['in_groups'] = !empty($_user['in_groups']) ? explode(",", $_user['in_groups']) : array();
    if (!empty($_user['sig'])) {
        $_user['sig'] = nv_br2nl($_user['sig']);
    }
}
$genders = array('N' => array('key' => 'N', 'title' => $lang_module['NA'], 'selected' => ''), 'M' => array('key' => 'M', 'title' => $lang_module['male'], 'selected' => $_user['gender'] == "M" ? " selected=\"selected\"" : ""), 'F' => array('key' => 'F', 'title' => $lang_module['female'], 'selected' => $_user['gender'] == "F" ? " selected=\"selected\"" : ""));
$_user['view_mail'] = $_user['view_mail'] ? " checked=\"checked\"" : "";
if (!empty($_user['sig'])) {
    $_user['sig'] = nv_htmlspecialchars($_user['sig']);
}
$groups = array();
if (!empty($groups_list)) {
    foreach ($groups_list as $group_id => $grtl) {
        $groups[] = array('id' => $group_id, 'title' => $grtl, 'checked' => (!empty($_user['in_groups']) and in_array($group_id, $_user['in_groups'])) ? " checked=\"checked\"" : "");
    }
}
$xtpl = new XTemplate("user_edit.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file);
$xtpl->assign('LANG', $lang_module);
コード例 #20
0
 function nv_block_form_content($block_config)
 {
     global $db, $site_mods, $module_info, $module_name, $lang_module, $my_head, $user_info;
     $module = $block_config['module'];
     $filled = false;
     $answer_info = $old_answer_info = $form_info = array();
     $form_info = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . ' WHERE status = 1 AND id = ' . $block_config['formid'])->fetch();
     if (!empty($form_info)) {
         if ($form_info['start_time'] > NV_CURRENTTIME or $form_info['end_time'] > 0 and $form_info['end_time'] < NV_CURRENTTIME or !nv_user_in_groups($form_info['groups_view'])) {
             return '';
         } else {
             // Lấy thông tin câu hỏi
             $question_info = $db->query("SELECT * FROM " . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . "_question WHERE fid = " . $block_config['formid'] . " AND status = 1 ORDER BY weight")->fetchAll();
             // Trạng thái trả lời
             if (defined('NV_IS_USER')) {
                 $sql = "SELECT * FROM " . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . "_answer WHERE fid = " . $block_config['formid'] . " AND who_answer = " . $user_info['userid'];
                 $_rows = $db->query($sql)->fetch();
                 if ($_rows) {
                     $filled = true;
                     $form_info['filled'] = true;
                     $answer_info = unserialize($_rows['answer']);
                 }
                 if (!empty($answer_info) and !$block_config['dis_form_answered']) {
                     return '';
                 }
             }
             if (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $site_mods[$module]['module_file'] . '/block_form_content.tpl')) {
                 $block_theme = $module_info['template'];
             } else {
                 $block_theme = 'default';
             }
             if ($module != $module_name) {
                 $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/jquery/jquery.validate.min.js\"></script>\n";
                 $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/language/jquery.validator-" . NV_LANG_INTERFACE . ".js\"></script>\n";
                 $my_head .= "<script type=\"text/javascript\">\n";
                 $my_head .= "\$(document).ready(function(){\n\t\t\t\t\t\t\t\t\$('#question_form').validate({\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t });";
                 $my_head .= " </script>\n";
                 if (file_exists(NV_ROOTDIR . '/modules/' . $site_mods[$module]['module_file'] . '/language/' . NV_LANG_DATA . '.php')) {
                     require_once NV_ROOTDIR . '/modules/' . $site_mods[$module]['module_file'] . '/language/' . NV_LANG_DATA . '.php';
                 }
             } else {
                 return '';
             }
             $xtpl = new XTemplate('block_form_content.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $site_mods[$module]['module_file']);
             $xtpl->assign('LANG', $lang_module);
             $xtpl->assign('FORM', $form_info);
             $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
             $xtpl->assign('FORM_ACTION', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module . '/' . $form_info['id'] . '-' . $form_info['alias']);
             if ($block_config['dis_form_info']) {
                 $xtpl->parse('main.form_info');
             }
             if ($form_info['question_display'] == 'question_display_left') {
                 $xtpl->assign('FORM_LEFT', 'class="form-horizontal"');
             }
             foreach ($question_info as $row) {
                 $row['value'] = isset($answer_info[$row['qid']]) ? $answer_info[$row['qid']] : '';
                 $row['required'] = $row['required'] ? 'required' : '';
                 $xtpl->assign('QUESTION', $row);
                 if ($row['required']) {
                     $xtpl->parse('main.loop.required');
                 }
                 if ($row['question_type'] == 'textbox' or $row['question_type'] == 'number') {
                     if ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) {
                         $row['readonly'] = 'readonly="readonly"';
                     }
                     $xtpl->assign('QUESTION', $row);
                     $xtpl->parse('main.loop.textbox');
                 } elseif ($row['question_type'] == 'date') {
                     $row['value'] = empty($row['value']) ? '' : date('d/m/Y', $row['value']);
                     $row['datepicker'] = ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) ? '' : 'datepicker';
                     $xtpl->assign('QUESTION', $row);
                     $xtpl->parse('main.loop.date');
                 } elseif ($row['question_type'] == 'textarea') {
                     if ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) {
                         $row['readonly'] = 'readonly';
                     }
                     $row['value'] = nv_htmlspecialchars(nv_br2nl($row['value']));
                     $xtpl->assign('QUESTION', $row);
                     $xtpl->parse('main.loop.textarea');
                 } elseif ($row['question_type'] == 'editor') {
                     if (defined('NV_EDITOR')) {
                         require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
                     } elseif (!nv_function_exists('nv_aleditor') and file_exists(NV_ROOTDIR . '/' . NV_EDITORSDIR . '/ckeditor/ckeditor_php5.php')) {
                         define('NV_EDITOR', true);
                         define('NV_IS_CKEDITOR', true);
                         require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/ckeditor/ckeditor_php5.php';
                         function nv_aleditor($textareaname, $width = '100%', $height = '450px', $val = '')
                         {
                             // Create class instance.
                             $editortoolbar = array(array('Link', 'Unlink', 'Image', 'Table', 'Font', 'FontSize', 'RemoveFormat'), array('Bold', 'Italic', 'Underline', 'StrikeThrough', '-', 'Subscript', 'Superscript', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', 'OrderedList', 'UnorderedList', '-', 'Outdent', 'Indent', 'TextColor', 'BGColor', 'Source'));
                             $CKEditor = new CKEditor();
                             // Do not print the code directly to the browser, return it instead
                             $CKEditor->returnOutput = true;
                             $CKEditor->config['skin'] = 'kama';
                             $CKEditor->config['entities'] = false;
                             // $CKEditor->config['enterMode'] = 2;
                             $CKEditor->config['language'] = NV_LANG_INTERFACE;
                             $CKEditor->config['toolbar'] = $editortoolbar;
                             // Path to CKEditor directory, ideally instead of relative dir, use an
                             // absolute path:
                             // $CKEditor->basePath = '/ckeditor/'
                             // If not set, CKEditor will try to detect the correct path.
                             $CKEditor->basePath = NV_BASE_SITEURL . NV_EDITORSDIR . '/ckeditor/';
                             // Set global configuration (will be used by all instances of CKEditor).
                             if (!empty($width)) {
                                 $CKEditor->config['width'] = strpos($width, '%') ? $width : intval($width);
                             }
                             if (!empty($height)) {
                                 $CKEditor->config['height'] = strpos($height, '%') ? $height : intval($height);
                             }
                             // Change default textarea attributes
                             $CKEditor->textareaAttributes = array('cols' => 80, 'rows' => 10);
                             $val = nv_unhtmlspecialchars($val);
                             return $CKEditor->editor($textareaname, $val);
                         }
                     }
                     if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
                         $row['value'] = nv_htmlspecialchars(nv_editor_br2nl($row['value']));
                         $edits = nv_aleditor('question[' . $row['qid'] . ']', '100%', '350px', $row['value']);
                         $xtpl->assign('EDITOR', $edits);
                         $xtpl->parse('main.loop.editor');
                     } else {
                         $row['value'] = nv_htmlspecialchars(nv_br2nl($row['value']));
                         $row['class'] = '';
                         $xtpl->assign('QUESTION', $row);
                         $xtpl->parse('main.loop.textarea');
                     }
                 } elseif ($row['question_type'] == 'select') {
                     $row['question_choices'] = unserialize($row['question_choices']);
                     foreach ($row['question_choices'] as $key => $value) {
                         $xtpl->assign('QUESTION_CHOICES', array('key' => $key, 'selected' => $key == $row['value'] ? ' selected="selected"' : '', "value" => $value));
                         $xtpl->parse('main.loop.select.loop');
                     }
                     if ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) {
                         $row['readonly'] = 'readonly="readonly"';
                     }
                     $xtpl->assign('QUESTION', $row);
                     $xtpl->parse('main.loop.select');
                 } elseif ($row['question_type'] == 'radio') {
                     $number = 0;
                     $row['question_choices'] = unserialize($row['question_choices']);
                     foreach ($row['question_choices'] as $key => $value) {
                         $row['readonly'] = '';
                         if ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) {
                             $row['readonly'] = 'onclick="return false;"';
                         }
                         $xtpl->assign('QUESTION_CHOICES', array('id' => $row['qid'] . '_' . $number++, 'key' => $key, 'checked' => $key == $row['value'] ? ' checked="checked"' : '', 'readonly' => $row['readonly'], "value" => $value));
                         $xtpl->parse('main.loop.radio');
                     }
                 } elseif ($row['question_type'] == 'checkbox') {
                     $row['readonly'] = '';
                     if ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) {
                         $row['readonly'] = 'onclick="return false;"';
                     }
                     $number = 0;
                     $row['question_choices'] = unserialize($row['question_choices']);
                     $valuecheckbox = !empty($row['value']) ? explode(',', $row['value']) : array();
                     foreach ($row['question_choices'] as $key => $value) {
                         $xtpl->assign('QUESTION_CHOICES', array('id' => $row['qid'] . '_' . $number++, 'key' => $key, 'checked' => in_array($key, $valuecheckbox) ? ' checked="checked"' : '', 'readonly' => $row['readonly'], "value" => $value));
                         $xtpl->parse('main.loop.checkbox');
                     }
                 } elseif ($row['question_type'] == 'multiselect') {
                     $valueselect = !empty($row['value']) ? explode(',', $row['value']) : array();
                     $row['question_choices'] = unserialize($row['question_choices']);
                     foreach ($row['question_choices'] as $key => $value) {
                         $xtpl->assign('QUESTION_CHOICES', array('key' => $key, 'selected' => in_array($key, $valueselect) ? ' selected="selected"' : '', "value" => $value));
                         $xtpl->parse('main.loop.multiselect.loop');
                     }
                     if ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) {
                         $row['readonly'] = 'readonly="readonly"';
                     }
                     $xtpl->assign('QUESTION', $row);
                     $xtpl->parse('main.loop.multiselect');
                 }
                 if ($form_info['question_display'] == 'question_display_left') {
                     $xtpl->assign('LEFT', array('label' => 'class="col-sm-6 control-label"', 'div' => 'class="col-sm-18"'));
                 }
                 $xtpl->parse('main.loop');
             }
             $xtpl->parse('main');
             return $xtpl->text('main');
         }
     }
 }
コード例 #21
0
/**
 * nv_show_custom_form()
 *
 * @param mixed $is_edit
 * @param mixed $form
 * @param mixed $array_custom
 * @param mixed $array_custom_lang
 * @return
 */
function nv_show_custom_form($is_edit, $form, $array_custom)
{
    global $db, $db_config, $lang_module, $lang_global, $module_name, $module_data, $op, $global_array_shops_cat, $global_config, $module_file;
    $xtpl = new XTemplate('cat_form_' . $form . '.tpl', NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('GLANG', $lang_global);
    $xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL);
    $xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE);
    $xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE);
    $xtpl->assign('MODULE_NAME', $module_name);
    $xtpl->assign('OP', $op);
    if (preg_match('/^[a-zA-Z0-9\\-\\_]+$/', $form) and file_exists(NV_ROOTDIR . '/modules/' . $module_file . '/admin/cat_form_' . $form . '.php')) {
        require_once NV_ROOTDIR . '/modules/' . $module_file . '/admin/cat_form_' . $form . '.php';
    }
    if (defined('NV_EDITOR')) {
        require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
    }
    $array_custom_lang = array();
    $idtemplate = $db->query('SELECT id FROM ' . $db_config['prefix'] . '_' . $module_data . '_template where alias = "' . preg_replace("/[\\_]/", "-", $form) . '"')->fetchColumn();
    if ($idtemplate) {
        $array_tmp = array();
        $result = $db->query('SELECT * FROM ' . $db_config['prefix'] . '_' . $module_data . '_field');
        while ($row = $result->fetch()) {
            $listtemplate = explode('|', $row['listtemplate']);
            if (in_array($idtemplate, $listtemplate)) {
                if (!$is_edit) {
                    if ($row['field_type'] == 'date') {
                        $array_custom[$row['field']] = $row['field_choices']['current_date'] ? NV_CURRENTTIME : $row['default_value'];
                    } elseif ($row['field_type'] == 'number') {
                        $array_custom[$row['field']] = $row['default_value'];
                    } else {
                        $temp = array_keys($row['field_choices']);
                        $tempkey = intval($row['default_value']) - 1;
                        $array_custom[$row['field']] = isset($temp[$tempkey]) ? $temp[$tempkey] : '';
                    }
                } elseif (!empty($row['field_choices'])) {
                    $row['field_choices'] = unserialize($row['field_choices']);
                } elseif (!empty($row['sql_choices'])) {
                    $row['sql_choices'] = explode('|', $row['sql_choices']);
                    $query = 'SELECT ' . $row['sql_choices'][2] . ', ' . $row['sql_choices'][3] . ' FROM ' . $row['sql_choices'][1];
                    $result_sql = $db->query($query);
                    $weight = 0;
                    while (list($key, $val) = $result_sql->fetch(3)) {
                        $row['field_choices'][$key] = $val;
                    }
                }
                if ($row['field_type'] == 'date') {
                    $array_custom[$row['field']] = empty($array_custom[$row['field']]) ? '' : date('d/m/Y', $array_custom[$row['field']]);
                } elseif ($row['field_type'] == 'textarea') {
                    $array_custom[$row['field']] = nv_htmlspecialchars(nv_br2nl($array_custom[$row['field']]));
                } elseif ($row['field_type'] == 'editor') {
                    $array_custom[$row['field']] = htmlspecialchars(nv_editor_br2nl($array_custom[$row['field']]));
                    if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
                        $row['class'] = explode('@', $row['class']);
                        $edits = nv_aleditor('custom[' . $row['field'] . ']', $row['class'][0], $row['class'][1], $array_custom[$row['field']]);
                        $array_custom[$row['field']] = $edits;
                    } else {
                        $row['class'] = '';
                    }
                } elseif ($row['field_type'] == 'select') {
                    foreach ($row['field_choices'] as $key => $value) {
                        $xtpl->assign('OPTION', array('key' => $key, 'selected' => $key == $array_custom[$row['field']] ? ' selected="selected"' : '', 'title' => $value));
                        $xtpl->parse('main.select_' . $row['field']);
                    }
                } elseif ($row['field_type'] == 'radio' or $row['field_type'] == 'checkbox') {
                    $number = 0;
                    foreach ($row['field_choices'] as $key => $value) {
                        $xtpl->assign('OPTION', array('id' => $row['fid'] . '_' . $number++, 'key' => $key, 'checked' => $key == $array_custom[$row['field']] ? ' checked="checked"' : '', 'title' => $value));
                        $xtpl->parse('main.' . $row['field_type'] . '_' . $row['field']);
                    }
                } elseif ($row['field_type'] == 'multiselect') {
                    foreach ($row['field_choices'] as $key => $value) {
                        $xtpl->assign('OPTION', array('key' => $key, 'selected' => $key == $array_custom[$row['field']] ? ' selected="selected"' : '', 'title' => $value));
                        $xtpl->parse('main.' . $row['field']);
                    }
                }
                // Du lieu hien thi tieu de
                $array_tmp[$row['field']] = unserialize($row['language']);
            }
        }
        if (!empty($array_tmp)) {
            foreach ($array_tmp as $f_key => $field) {
                foreach ($field as $key_lang => $lang_data) {
                    if ($key_lang == NV_LANG_DATA) {
                        $array_custom_lang[$f_key] = array('title' => $lang_data[0], 'description' => isset($lang_data[1]) ? $lang_data[1] : '');
                    }
                }
            }
        }
    }
    $xtpl->assign('ROW', $array_custom);
    $xtpl->assign('CUSTOM_LANG', $array_custom_lang);
    foreach ($array_custom_lang as $k_lang => $custom_lang) {
        if (!empty($custom_lang['description'])) {
            $xtpl->parse('main.' . $k_lang . '_description');
        }
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}
コード例 #22
0
ファイル: edit.php プロジェクト: volong1012/nukeviet
        $count = $stmt->rowCount();
    }
    if ($count) {
        nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['edit_title'] . ': ' . $row['module'] . ', id: ' . $row['id'] . ', cid: ' . $row['cid'], $row['content'], $admin_info['userid']);
        if (isset($site_mods[$row['module']])) {
            $mod_info = $site_mods[$row['module']];
            if (file_exists(NV_ROOTDIR . '/modules/' . $mod_info['module_file'] . '/comment.php')) {
                include NV_ROOTDIR . '/modules/' . $mod_info['module_file'] . '/comment.php';
                nv_del_moduleCache($row['module']);
            }
        }
    }
    header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name);
    die;
}
$row['content'] = nv_htmlspecialchars(nv_br2nl($row['content']));
$row['status'] = $row['status'] ? 'checked="checked"' : '';
$xtpl = new XTemplate('edit.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('GLANG', $lang_global);
$xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL);
$xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE);
$xtpl->assign('MODULE_NAME', $module_name);
$xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE);
$xtpl->assign('OP', $op);
$xtpl->assign('CID', $cid);
$xtpl->assign('ROW', $row);
$xtpl->parse('main');
$contents = $xtpl->text('main');
include NV_ROOTDIR . '/includes/header.php';
echo nv_admin_theme($contents);
コード例 #23
0
ファイル: global.login.php プロジェクト: nukeviet/nukeviet
 /**
  * nv_block_login()
  *
  * @param mixed $block_config
  * @return void
  */
 function nv_block_login($block_config)
 {
     global $client_info, $global_config, $module_name, $user_info, $lang_global, $my_head, $admin_info, $blockID, $db, $module_info, $site_mods, $db_config;
     $content = '';
     if ($global_config['allowuserlogin']) {
         if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/users/block.login.tpl')) {
             $block_theme = $global_config['module_theme'];
         } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/users/block.login.tpl')) {
             $block_theme = $global_config['site_theme'];
         } else {
             $block_theme = 'default';
         }
         $xtpl = new XTemplate('block.login.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/users');
         if (file_exists(NV_ROOTDIR . '/modules/users/language/' . NV_LANG_DATA . '.php')) {
             include NV_ROOTDIR . '/modules/users/language/' . NV_LANG_DATA . '.php';
         } else {
             include NV_ROOTDIR . '/modules/users/language/vi.php';
         }
         $xtpl->assign('LANG', $lang_module);
         $xtpl->assign('GLANG', $lang_global);
         $xtpl->assign('BLOCKID', $blockID);
         if (defined('NV_IS_USER')) {
             if (file_exists(NV_ROOTDIR . '/' . $user_info['photo']) and !empty($user_info['photo'])) {
                 $avata = NV_BASE_SITEURL . $user_info['photo'];
             } else {
                 $avata = NV_BASE_SITEURL . 'themes/' . $block_theme . '/images/users/no_avatar.png';
             }
             $user_info['current_login_txt'] = nv_date('d/m, H:i', $user_info['current_login']);
             $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
             $xtpl->assign('NV_LANG_VARIABLE', NV_LANG_VARIABLE);
             $xtpl->assign('NV_LANG_DATA', NV_LANG_DATA);
             $xtpl->assign('URL_LOGOUT', defined('NV_IS_ADMIN') ? 'nv_admin_logout' : 'bt_logout');
             $xtpl->assign('MODULENAME', $module_info['custom_title']);
             $xtpl->assign('AVATA', $avata);
             $xtpl->assign('USER', $user_info);
             $xtpl->assign('WELCOME', defined('NV_IS_ADMIN') ? $lang_global['admin_account'] : $lang_global['your_account']);
             $xtpl->assign('LEVEL', defined('NV_IS_ADMIN') ? $admin_info['level'] : 'user');
             $xtpl->assign('URL_MODULE', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=users');
             $xtpl->assign('URL_AVATAR', nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=users&amp;' . NV_OP_VARIABLE . '=avatar/upd', true));
             $xtpl->assign('URL_HREF', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=users&amp;' . NV_OP_VARIABLE . '=');
             if (defined('NV_OPENID_ALLOWED')) {
                 $xtpl->parse('signed.allowopenid');
             }
             if (defined('NV_IS_ADMIN')) {
                 $new_drag_block = defined('NV_IS_DRAG_BLOCK') ? 0 : 1;
                 $lang_drag_block = $new_drag_block ? $lang_global['drag_block'] : $lang_global['no_drag_block'];
                 $xtpl->assign('NV_ADMINDIR', NV_ADMINDIR);
                 $xtpl->assign('URL_DBLOCK', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;drag_block=' . $new_drag_block);
                 $xtpl->assign('LANG_DBLOCK', $lang_drag_block);
                 $xtpl->assign('URL_ADMINMODULE', NV_BASE_SITEURL . NV_ADMINDIR . '/index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name);
                 $xtpl->assign('URL_AUTHOR', NV_BASE_SITEURL . NV_ADMINDIR . '/index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=authors&amp;id=' . $admin_info['admin_id']);
                 if (defined('NV_IS_SPADMIN')) {
                     $xtpl->parse('signed.admintoolbar.is_spadadmin');
                 }
                 if (defined('NV_IS_MODADMIN') and !empty($module_info['admin_file'])) {
                     $xtpl->parse('signed.admintoolbar.is_modadmin');
                 }
                 $xtpl->parse('signed.admintoolbar');
             }
             $xtpl->parse('signed');
             $content = $xtpl->text('signed');
         } else {
             $xtpl->assign('USER_LOGIN', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=users&amp;' . NV_OP_VARIABLE . '=login');
             $xtpl->assign('USER_REGISTER', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=users&amp;' . NV_OP_VARIABLE . '=register');
             $xtpl->assign('USER_LOSTPASS', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=users&amp;' . NV_OP_VARIABLE . '=lostpass');
             $xtpl->assign('NICK_MAXLENGTH', NV_UNICKMAX);
             $xtpl->assign('NICK_MINLENGTH', NV_UNICKMIN);
             $xtpl->assign('PASS_MAXLENGTH', NV_UPASSMAX);
             $xtpl->assign('PASS_MINLENGTH', NV_UPASSMIN);
             $xtpl->assign('GFX_WIDTH', NV_GFX_WIDTH);
             $xtpl->assign('GFX_HEIGHT', NV_GFX_HEIGHT);
             $xtpl->assign('GFX_MAXLENGTH', NV_GFX_NUM);
             $xtpl->assign('N_CAPTCHA', $lang_global['securitycode']);
             $xtpl->assign('CAPTCHA_REFRESH', $lang_global['captcharefresh']);
             $xtpl->assign('SRC_CAPTCHA', NV_BASE_SITEURL . 'index.php?scaptcha=captcha&t=' . NV_CURRENTTIME);
             $xtpl->assign('NV_HEADER', '');
             $xtpl->assign('NV_REDIRECT', '');
             $username_rule = empty($global_config['nv_unick_type']) ? sprintf($lang_global['username_rule_nolimit'], NV_UNICKMIN, NV_UNICKMAX) : sprintf($lang_global['username_rule_limit'], $lang_global['unick_type_' . $global_config['nv_unick_type']], NV_UNICKMIN, NV_UNICKMAX);
             $password_rule = empty($global_config['nv_upass_type']) ? sprintf($lang_global['password_rule_nolimit'], NV_UPASSMIN, NV_UPASSMAX) : sprintf($lang_global['password_rule_limit'], $lang_global['upass_type_' . $global_config['nv_upass_type']], NV_UPASSMIN, NV_UPASSMAX);
             $display_layout = empty($block_config['display_mode']) ? 'display_form' : 'display_button';
             $xtpl->assign('USERNAME_RULE', $username_rule);
             $xtpl->assign('PASSWORD_RULE', $password_rule);
             if (in_array($global_config['gfx_chk'], array(2, 4, 5, 7))) {
                 $xtpl->parse('main.' . $display_layout . '.captcha');
             }
             if (in_array($global_config['gfx_chk'], array(3, 4, 6, 7))) {
                 $xtpl->parse('main.allowuserreg.reg_captcha');
             }
             if (defined('NV_OPENID_ALLOWED')) {
                 foreach ($global_config['openid_servers'] as $server) {
                     $assigns = array();
                     $assigns['href'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=users&amp;' . NV_OP_VARIABLE . '=oauth&amp;server=' . $server . '&amp;nv_redirect=' . nv_redirect_encrypt($client_info['selfurl']);
                     $assigns['title'] = $lang_global['openid_login'] . ' ' . ucfirst($server);
                     $assigns['img_src'] = NV_BASE_SITEURL . 'themes/' . $block_theme . '/images/users/' . $server . '.png';
                     $assigns['img_width'] = $assigns['img_height'] = 24;
                     $xtpl->assign('OPENID', $assigns);
                     $xtpl->parse('main.' . $display_layout . '.openid.server');
                 }
                 $xtpl->parse('main.' . $display_layout . '.openid');
             }
             if ($global_config['allowuserreg']) {
                 if (empty($block_config['popup_register'])) {
                     !empty($block_config['display_mode']) ? $xtpl->parse('main.' . $display_layout . '.allowuserreg_link') : $xtpl->parse('main.' . $display_layout . '.allowuserreg_linkform');
                 } else {
                     $data_questions = array();
                     $sql = "SELECT qid, title FROM " . $db_config['prefix'] . "_" . $site_mods[$block_config['module']]['module_data'] . "_question WHERE lang='" . NV_LANG_DATA . "' ORDER BY weight ASC";
                     $result = $db->query($sql);
                     while ($row = $result->fetch()) {
                         $data_questions[$row['qid']] = array('qid' => $row['qid'], 'title' => $row['title']);
                     }
                     foreach ($data_questions as $array_question_i) {
                         $xtpl->assign('QUESTION', $array_question_i['title']);
                         $xtpl->parse('main.allowuserreg.frquestion');
                     }
                     $datepicker = false;
                     $array_field_config = array();
                     $result_field = $db->query('SELECT * FROM ' . $db_config['prefix'] . '_' . $site_mods[$block_config['module']]['module_data'] . '_field ORDER BY weight ASC');
                     while ($row_field = $result_field->fetch()) {
                         $language = unserialize($row_field['language']);
                         $row_field['title'] = isset($language[NV_LANG_DATA]) ? $language[NV_LANG_DATA][0] : $row['field'];
                         $row_field['description'] = isset($language[NV_LANG_DATA]) ? nv_htmlspecialchars($language[NV_LANG_DATA][1]) : '';
                         if (!empty($row_field['field_choices'])) {
                             $row_field['field_choices'] = unserialize($row_field['field_choices']);
                         } elseif (!empty($row_field['sql_choices'])) {
                             $row_field['sql_choices'] = explode('|', $row_field['sql_choices']);
                             $query = 'SELECT ' . $row_field['sql_choices'][2] . ', ' . $row_field['sql_choices'][3] . ' FROM ' . $row_field['sql_choices'][1];
                             $result = $db->query($query);
                             $weight = 0;
                             while (list($key, $val) = $result->fetch(3)) {
                                 $row_field['field_choices'][$key] = $val;
                             }
                         }
                         $array_field_config[] = $row_field;
                     }
                     if (!empty($array_field_config)) {
                         $userid = 0;
                         foreach ($array_field_config as $_k => $row) {
                             $row['customID'] = $_k;
                             if ($row['show_register'] and $userid == 0 or $userid > 0) {
                                 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.allowuserreg.field.loop.required');
                                 }
                                 if ($row['field_type'] == 'textbox' or $row['field_type'] == 'number') {
                                     $xtpl->parse('main.allowuserreg.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.allowuserreg.field.loop.date');
                                     $datepicker = true;
                                 } elseif ($row['field_type'] == 'textarea') {
                                     $row['value'] = nv_htmlspecialchars(nv_br2nl($row['value']));
                                     $xtpl->assign('FIELD', $row);
                                     $xtpl->parse('main.allowuserreg.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.allowuserreg.field.loop.editor');
                                     } else {
                                         $row['class'] = '';
                                         $xtpl->assign('FIELD', $row);
                                         $xtpl->parse('main.allowuserreg.field.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.allowuserreg.field.loop.select.loop');
                                     }
                                     $xtpl->parse('main.allowuserreg.field.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.allowuserreg.field.loop.radio.loop');
                                     }
                                     $xtpl->parse('main.allowuserreg.field.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));
                                         $xtpl->parse('main.allowuserreg.field.loop.checkbox.loop');
                                     }
                                     $xtpl->parse('main.allowuserreg.field.loop.checkbox');
                                 } elseif ($row['field_type'] == 'multiselect') {
                                     $valueselect = !empty($row['value']) ? explode(',', $row['value']) : array();
                                     foreach ($row['field_choices'] as $key => $value) {
                                         $xtpl->assign('FIELD_CHOICES', array('key' => $key, 'selected' => in_array($key, $valueselect) ? ' selected="selected"' : '', 'value' => $value));
                                         $xtpl->parse('main.allowuserreg.field.loop.multiselect.loop');
                                     }
                                     $xtpl->parse('main.allowuserreg.field.loop.multiselect');
                                 }
                                 $xtpl->parse('main.allowuserreg.field.loop');
                             }
                         }
                         $xtpl->parse('main.allowuserreg.field');
                     }
                     $xtpl->parse('main.allowuserreg');
                     !empty($block_config['display_mode']) ? $xtpl->parse('main.' . $display_layout . '.allowuserreg2') : $xtpl->parse('main.' . $display_layout . '.allowuserreg2_form');
                     if ($datepicker) {
                         $xtpl->parse('main.datepicker');
                     }
                 }
             }
             $xtpl->parse('main.' . $display_layout);
             $xtpl->parse('main');
             $content = $xtpl->text('main');
         }
     }
     return $content;
 }
コード例 #24
0
ファイル: edit.php プロジェクト: lzhao18/nukeviet
 } 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.edit_user.field.loop.required');
 }
 if ($row['field_type'] == 'textbox' or $row['field_type'] == 'number') {
     $xtpl->parse('main.edit_user.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.edit_user.field.loop.date');
 } elseif ($row['field_type'] == 'textarea') {
     $row['value'] = nv_htmlspecialchars(nv_br2nl($row['value']));
     $xtpl->assign('FIELD', $row);
     $xtpl->parse('main.edit_user.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.edit_user.field.loop.editor');
     } else {
         $row['class'] = '';
         $xtpl->assign('FIELD', $row);
         $xtpl->parse('main.edit_user.field.loop.textarea');
     }
 } elseif ($row['field_type'] == 'select') {
コード例 #25
0
ファイル: data.php プロジェクト: hongoctrien/module-videos
        $nv_Request->set_Cookie($module_name . '_song' . $i, $tmp);
    }
    $numprev = $num - 1;
    $nv_Request->set_Cookie($module_name . '_numlist', $numprev);
    die($contents);
}
// Luu playlist
if ($nv_Request->isset_request('savealbum', 'post')) {
    if (!defined('NV_IS_AJAX')) {
        die('Wrong URL');
    }
    $difftimeout = 180;
    $name = filter_text_input('name', 'post', '');
    $keyname = change_alias($name);
    $singer = filter_text_input('singer', 'post', '');
    $message = nv_br2nl(filter_text_textarea('message', '', NV_ALLOWED_HTML_TAGS));
    if (defined('NV_IS_USER')) {
        $username = $user_info['username'];
        $userid = $user_info['userid'];
    } else {
        $username = "";
        $userid = 0;
    }
    $num = $nv_Request->get_int($module_name . '_numlist', 'cookie', 0);
    $songdata = array();
    for ($i = 1; $i <= $num; $i++) {
        $tmp = $nv_Request->get_int($module_name . '_song' . $i, 'cookie', 0);
        $songdata[] = $tmp;
    }
    $timeout = $nv_Request->get_int($module_name . '_' . $userid, 'cookie', 0);
    if ($timeout == 0 or NV_CURRENTTIME - $timeout > $difftimeout) {
コード例 #26
0
ファイル: cat.php プロジェクト: nukeplus/shops
    if ($lev_i > 0) {
        $xtitle_i .= '&nbsp;';
        for ($i = 1; $i <= $lev_i; $i++) {
            $xtitle_i .= '---';
        }
    }
    $xtitle_i .= $title_i;
    $array_cat_list[] = array($catid_i, $xtitle_i);
}
$lang_global['title_suggest_max'] = sprintf($lang_global['length_suggest_max'], 65);
$lang_global['description_suggest_max'] = sprintf($lang_global['length_suggest_max'], 160);
if (!empty($data['image']) and file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/' . $data['image'])) {
    $data['image'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $data['image'];
    $currentpath = dirname($data['image']);
}
$data['description'] = nv_br2nl($data['description']);
if ($pro_config['point_active']) {
    if ($data['cat_allow_point']) {
        $data['cat_number_point_dis'] = '';
        $data['cat_number_product_dis'] = '';
        $data['cat_allow_point'] = 'checked="checked"';
    } else {
        $data['cat_number_point_dis'] = 'readonly="readonly"';
        $data['cat_number_product_dis'] = 'readonly="readonly"';
        $data['cat_allow_point'] = '';
    }
    $data['cat_number_point'] = !empty($data['cat_number_point']) ? $data['cat_number_point'] : '';
    $data['cat_number_product'] = !empty($data['cat_number_product']) ? $data['cat_number_product'] : '';
}
if ($data['parentid']) {
    $lang_module['setting_group_price_space_note_cat'] = sprintf($lang_module['setting_group_price_space_note_cat_1'], $data['parent_title']);
コード例 #27
0
ファイル: theme.php プロジェクト: hoangvtien/module-nvform
/**
 * nv_theme_nvform_main()
 *
 * @param mixed $form_info
 * @param mixed $question
 * @return
 */
function nv_theme_nvform_main($form_info, $question_info, $answer_info, $info)
{
    global $global_config, $module_name, $module_file, $lang_module, $module_config, $module_info, $op, $my_head;
    $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/jquery/jquery.validate.min.js\"></script>\n";
    $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/language/jquery.validator-" . NV_LANG_INTERFACE . ".js\"></script>\n";
    $my_head .= "<script type=\"text/javascript\">\n";
    $my_head .= "\$(document).ready(function(){\n\t\t\t\t\t\$('#question').validate({\n\t\t\t\t\t});\n\t\t\t\t });";
    $my_head .= " </script>\n";
    if (!empty($form_info['end_time'])) {
        $form_info['close_info'] = sprintf($lang_module['form_close_info'], date('d/m/Y H:i'));
    }
    $xtpl = new XTemplate($op . '.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('FORM', $form_info);
    $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
    if ($form_info['question_display'] == 'question_display_left') {
        $xtpl->assign('FORM_LEFT', 'class="form-horizontal"');
    }
    foreach ($question_info as $row) {
        $row['value'] = isset($answer_info[$row['qid']]) ? $answer_info[$row['qid']] : '';
        $row['required'] = $row['required'] ? 'required' : '';
        $xtpl->assign('QUESTION', $row);
        if ($row['required']) {
            $xtpl->parse('main.loop.required');
        }
        if ($row['question_type'] == 'textbox' or $row['question_type'] == 'number') {
            if ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) {
                $row['readonly'] = 'readonly="readonly"';
            }
            $xtpl->assign('QUESTION', $row);
            $xtpl->parse('main.loop.textbox');
        } elseif ($row['question_type'] == 'date') {
            $row['value'] = empty($row['value']) ? '' : date('d/m/Y', $row['value']);
            $row['datepicker'] = ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) ? '' : 'datepicker';
            $xtpl->assign('QUESTION', $row);
            $xtpl->parse('main.loop.date');
        } elseif ($row['question_type'] == 'textarea') {
            if ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) {
                $row['readonly'] = 'readonly';
            }
            $row['value'] = nv_htmlspecialchars(nv_br2nl($row['value']));
            $xtpl->assign('QUESTION', $row);
            $xtpl->parse('main.loop.textarea');
        } elseif ($row['question_type'] == 'editor') {
            if (defined('NV_EDITOR')) {
                require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
            } elseif (!nv_function_exists('nv_aleditor') and file_exists(NV_ROOTDIR . '/' . NV_EDITORSDIR . '/ckeditor/ckeditor_php5.php')) {
                define('NV_EDITOR', true);
                define('NV_IS_CKEDITOR', true);
                require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/ckeditor/ckeditor_php5.php';
                function nv_aleditor($textareaname, $width = '100%', $height = '450px', $val = '')
                {
                    // Create class instance.
                    $editortoolbar = array(array('Link', 'Unlink', 'Image', 'Table', 'Font', 'FontSize', 'RemoveFormat'), array('Bold', 'Italic', 'Underline', 'StrikeThrough', '-', 'Subscript', 'Superscript', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', 'OrderedList', 'UnorderedList', '-', 'Outdent', 'Indent', 'TextColor', 'BGColor', 'Source'));
                    $CKEditor = new CKEditor();
                    // Do not print the code directly to the browser, return it instead
                    $CKEditor->returnOutput = true;
                    $CKEditor->config['skin'] = 'kama';
                    $CKEditor->config['entities'] = false;
                    // $CKEditor->config['enterMode'] = 2;
                    $CKEditor->config['language'] = NV_LANG_INTERFACE;
                    $CKEditor->config['toolbar'] = $editortoolbar;
                    // Path to CKEditor directory, ideally instead of relative dir, use an
                    // absolute path:
                    // $CKEditor->basePath = '/ckeditor/'
                    // If not set, CKEditor will try to detect the correct path.
                    $CKEditor->basePath = NV_BASE_SITEURL . NV_EDITORSDIR . '/ckeditor/';
                    // Set global configuration (will be used by all instances of CKEditor).
                    if (!empty($width)) {
                        $CKEditor->config['width'] = strpos($width, '%') ? $width : intval($width);
                    }
                    if (!empty($height)) {
                        $CKEditor->config['height'] = strpos($height, '%') ? $height : intval($height);
                    }
                    // Change default textarea attributes
                    $CKEditor->textareaAttributes = array('cols' => 80, 'rows' => 10);
                    $val = nv_unhtmlspecialchars($val);
                    return $CKEditor->editor($textareaname, $val);
                }
            }
            if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
                $row['value'] = nv_htmlspecialchars(nv_editor_br2nl($row['value']));
                $edits = nv_aleditor('question[' . $row['qid'] . ']', '100%', '350px', $row['value']);
                $xtpl->assign('EDITOR', $edits);
                $xtpl->parse('main.loop.editor');
            } else {
                $row['value'] = nv_htmlspecialchars(nv_br2nl($row['value']));
                $row['class'] = '';
                $xtpl->assign('QUESTION', $row);
                $xtpl->parse('main.loop.textarea');
            }
        } elseif ($row['question_type'] == 'select') {
            $row['question_choices'] = unserialize($row['question_choices']);
            foreach ($row['question_choices'] as $key => $value) {
                $xtpl->assign('QUESTION_CHOICES', array('key' => $key, 'selected' => $key == $row['value'] ? ' selected="selected"' : '', "value" => $value));
                $xtpl->parse('main.loop.select.loop');
            }
            if ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) {
                $row['readonly'] = 'readonly="readonly"';
            }
            $xtpl->assign('QUESTION', $row);
            $xtpl->parse('main.loop.select');
        } elseif ($row['question_type'] == 'radio') {
            $number = 0;
            $row['question_choices'] = unserialize($row['question_choices']);
            foreach ($row['question_choices'] as $key => $value) {
                $row['readonly'] = '';
                if ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) {
                    $row['readonly'] = 'onclick="return false;"';
                }
                $xtpl->assign('QUESTION_CHOICES', array('id' => $row['qid'] . '_' . $number++, 'key' => $key, 'checked' => $key == $row['value'] ? ' checked="checked"' : '', 'readonly' => $row['readonly'], "value" => $value));
                $xtpl->parse('main.loop.radio');
            }
        } elseif ($row['question_type'] == 'checkbox') {
            $row['readonly'] = '';
            if ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) {
                $row['readonly'] = 'onclick="return false;"';
            }
            $number = 0;
            $row['question_choices'] = unserialize($row['question_choices']);
            $valuecheckbox = !empty($row['value']) ? explode(',', $row['value']) : array();
            foreach ($row['question_choices'] as $key => $value) {
                $xtpl->assign('QUESTION_CHOICES', array('id' => $row['qid'] . '_' . $number++, 'key' => $key, 'checked' => in_array($key, $valuecheckbox) ? ' checked="checked"' : '', 'readonly' => $row['readonly'], "value" => $value));
                $xtpl->parse('main.loop.checkbox');
            }
        } elseif ($row['question_type'] == 'multiselect') {
            $valueselect = !empty($row['value']) ? explode(',', $row['value']) : array();
            $row['question_choices'] = unserialize($row['question_choices']);
            foreach ($row['question_choices'] as $key => $value) {
                $xtpl->assign('QUESTION_CHOICES', array('key' => $key, 'selected' => in_array($key, $valueselect) ? ' selected="selected"' : '', "value" => $value));
                $xtpl->parse('main.loop.multiselect.loop');
            }
            if ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) {
                $row['readonly'] = 'readonly="readonly"';
            }
            $xtpl->assign('QUESTION', $row);
            $xtpl->parse('main.loop.multiselect');
        }
        if ($form_info['question_display'] == 'question_display_left') {
            $xtpl->assign('LEFT', array('label' => 'class="col-sm-6 control-label"', 'div' => 'class="col-sm-18"'));
        }
        $xtpl->parse('main.loop');
    }
    if (!empty($info)) {
        $xtpl->assign('INFO', $info);
        $xtpl->parse('main.info');
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}
コード例 #28
0
$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('playlists.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('GLANG', $lang_global);
$xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL);
$xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE);
$xtpl->assign('MODULE_NAME', $module_name);
$xtpl->assign('OP', $op);
$page = 1;
$xtpl->assign('PLAYLIST_CAT_LIST', nv_show_playlist_cat_list($page));
$xtpl->assign('PLAYLIST_ID', $playlist_id);
$xtpl->assign('title', $title);
$xtpl->assign('alias', $alias);
$xtpl->assign('keywords', $keywords);
$xtpl->assign('description', nv_htmlspecialchars(nv_br2nl($description)));
if (!empty($image) and file_exists(NV_UPLOADS_REAL_DIR . "/" . $module_upload . "/img/" . $image)) {
    $image = NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . $module_upload . "/img/" . $image;
}
$xtpl->assign('image', $image);
$xtpl->assign('UPLOAD_CURRENT', NV_UPLOADS_DIR . '/' . $module_upload . "/img/playlists/");
foreach ($array_status as $key => $val) {
    $xtpl->assign('STATUS', array('key' => $key, 'title' => $val, 'selected' => $key == $status ? ' selected="selected"' : ''));
    $xtpl->parse('main.status');
}
foreach ($array_private_mode as $key => $val) {
    $xtpl->assign('PRIVATE_MODE', array('key' => $key, 'title' => $val, 'selected' => $key == $private_mode ? ' selected="selected"' : ''));
    $xtpl->parse('main.private_mode');
}
if (!empty($error)) {
    $xtpl->assign('ERROR', $error);
コード例 #29
0
    $data_content['url'] = $url;
    $data_content['title'] = $title;
    $data_content['urlimg'] = $image;
    $data_content['description'] = $description;
} elseif ($id > 0) {
    $sql = $db->sql_query("SELECT * FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `id`=" . $id);
    $data_content = $db->sql_fetchrow($sql);
    if ($data_content['id'] > 0) {
        $page_title = $lang_module['weblink_edit_link'];
    }
}
if (empty($data_content['id'])) {
    $page_title = $lang_module['weblink_add_link'];
}
// dung de lay data tu CSDL
$data_content['description'] = defined('NV_EDITOR') ? nv_editor_br2nl($data_content['description']) : nv_br2nl($data_content['description']);
// dung de dua vao editor
$data_content['description'] = nv_htmlspecialchars($data_content['description']);
if (!empty($data_content['urlimg']) and !nv_is_url($data_content['urlimg'])) {
    $data_content['urlimg'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . $data_content['urlimg'];
}
// Set editor
if (defined('NV_EDITOR')) {
    require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
}
if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
    $edits = nv_aleditor('description', '100%', '300px', $data_content['description']);
} else {
    $edits = "<textarea style=\"width: 100%\" name=\"description\" id=\"bodytext\" cols=\"20\" rows=\"15\">" . $data_content['description'] . "</textarea>";
}
// Get catid