Exemplo n.º 1
0
 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 = htmlspecialchars(nv_editor_br2nl($data_block['htmlcontent']));
     if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
         $html = nv_add_editor_js() . 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>';
 }
Exemplo n.º 2
0
        die(json_encode(array('status' => 'ok', 'input' => '', 'mess' => $lang_module['sendcontactok'])));
    }
    die(json_encode(array('status' => 'error', 'input' => '', 'mess' => $lang_module['sendcontactfailed'])));
}
$page_title = $module_info['custom_title'];
$key_words = $module_info['keywords'];
$mod_title = isset($lang_module['main_title']) ? $lang_module['main_title'] : $module_info['custom_title'];
$full_theme = true;
$base_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name;
if (!empty($alias_department)) {
    $base_url .= '&amp;' . NV_OP_VARIABLE . '=' . $alias_department;
    if (isset($array_op[1]) and $array_op[1] == 0) {
        $base_url .= '/0';
        $full_theme = false;
    }
}
$base_url_rewrite = nv_url_rewrite($base_url, true);
if ($_SERVER['REQUEST_URI'] == $base_url_rewrite) {
    $canonicalUrl = NV_MAIN_DOMAIN . $base_url_rewrite;
} elseif (NV_MAIN_DOMAIN . $_SERVER['REQUEST_URI'] != $base_url_rewrite) {
    Header('Location: ' . $base_url_rewrite);
    die;
} else {
    $canonicalUrl = $base_url_rewrite;
}
$array_content = array('fname' => $fname, 'femail' => $femail, 'fphone' => $fphone);
$array_content['bodytext'] = isset($module_config[$module_name]['bodytext']) ? nv_editor_br2nl($module_config[$module_name]['bodytext']) : '';
$contents = contact_main_theme($array_content, $array_department, $catsName, $base_url, NV_CHECK_SESSION);
include NV_ROOTDIR . '/includes/header.php';
echo nv_site_theme($contents, $full_theme);
include NV_ROOTDIR . '/includes/footer.php';
Exemplo n.º 3
0
if (!empty($error)) {
    $xtpl->assign('ERROR', $error);
    $xtpl->parse('main.error');
}
if (!empty($array_cat_list)) {
    if (empty($alias)) {
        $xtpl->parse('main.content.getalias');
    }
    foreach ($cat_listsub as $data) {
        $xtpl->assign('cat_listsub', $data);
        $xtpl->parse('main.content.cat_listsub');
    }
    foreach ($groups_views as $data) {
        $xtpl->assign('groups_views', $data);
        $xtpl->parse('main.content.groups_views');
    }
    $descriptionhtml = nv_htmlspecialchars(nv_editor_br2nl($descriptionhtml));
    if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
        $_uploads_dir = NV_UPLOADS_DIR . '/' . $module_upload;
        $descriptionhtml = nv_aleditor('descriptionhtml', '100%', '200px', $descriptionhtml, 'Basic', $_uploads_dir, $_uploads_dir);
    } else {
        $descriptionhtml = "<textarea style=\"width: 100%\" name=\"descriptionhtml\" id=\"descriptionhtml\" cols=\"20\" rows=\"15\">" . $descriptionhtml . "</textarea>";
    }
    $xtpl->assign('DESCRIPTIONHTML', $descriptionhtml);
    $xtpl->parse('main.content');
}
$xtpl->parse('main');
$contents .= $xtpl->text('main');
include NV_ROOTDIR . '/includes/header.php';
echo nv_admin_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
Exemplo n.º 4
0
    } else {
        $content = nv_editor_nl2br($content);
        if ($mode == "edit") {
            $query = "UPDATE `" . NV_USERS_GLOBALTABLE . "_config` SET \n            `content`=" . $db->dbescape($content) . ", \n            `edit_time`='" . NV_CURRENTTIME . "' \n            WHERE `config` ='siteterms_" . NV_LANG_DATA . "'";
        } else {
            $query = "INSERT INTO `" . NV_USERS_GLOBALTABLE . "_config` VALUES( \n            'siteterms_" . NV_LANG_DATA . "', " . $db->dbescape($content) . ", " . NV_CURRENTTIME . ")";
        }
        $db->sql_query($query);
        if ($db->sql_affectedrows() > 0) {
            $error = $lang_module['saveok'];
        } else {
            $error = $lang_module['errorsave'];
        }
    }
} else {
    $content = nv_editor_br2nl($row['content']);
}
if (!empty($content)) {
    $content = nv_htmlspecialchars($content);
}
$xtpl = new XTemplate("siteterms.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', NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=" . $op);
if (!empty($error)) {
    $xtpl->assign('ERROR', $error);
    $xtpl->parse('main.error');
}
if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
    $data = nv_aleditor("content", '100%', '300px', $content);
} else {
Exemplo n.º 5
0
// Cau hinh hien thi nguon tin
$array_config_source = array($lang_module['config_source_title'], $lang_module['config_source_link'], $lang_module['config_source_logo']);
foreach ($array_config_source as $key => $val) {
    $xtpl->assign('CONFIG_SOURCE', array('key' => $key, 'title' => $val, 'selected' => $key == $module_config[$module_name]['config_source'] ? ' selected="selected"' : ''));
    $xtpl->parse('main.config_source');
}
$array_imgposition = array(0 => $lang_module['imgposition_0'], 1 => $lang_module['imgposition_1'], 2 => $lang_module['imgposition_2']);
// position images
while (list($id_imgposition, $title_imgposition) = each($array_imgposition)) {
    $sl = $id_imgposition == $module_config[$module_name]['imgposition'] ? ' selected="selected"' : '';
    $xtpl->assign('id_imgposition', $id_imgposition);
    $xtpl->assign('title_imgposition', $title_imgposition);
    $xtpl->assign('posl', $sl);
    $xtpl->parse('main.looppos');
}
$copyright = nv_htmlspecialchars(nv_editor_br2nl($module_config[$module_name]['copyright']));
if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
    $_uploads_dir = NV_UPLOADS_DIR . '/' . $module_upload;
    $copyright = nv_aleditor('copyright', '100%', '100px', $copyright, 'Basic', $_uploads_dir, $_uploads_dir);
} else {
    $copyright = "<textarea style=\"width: 100%\" name=\"copyright\" id=\"copyright\" cols=\"20\" rows=\"15\">" . $copyright . "</textarea>";
}
$xtpl->assign('COPYRIGHTHTML', $copyright);
$xtpl->assign('PATH', defined('NV_IS_SPADMIN') ? "" : NV_UPLOADS_DIR . '/' . $module_upload);
$xtpl->assign('CURRENTPATH', defined('NV_IS_SPADMIN') ? "images" : NV_UPLOADS_DIR . '/' . $module_upload);
if (defined('NV_IS_ADMIN_FULL_MODULE') or !in_array('admins', $allow_func)) {
    $groups_list = nv_groups_list();
    unset($groups_list[6]);
    $savepost = $nv_Request->get_int('savepost', 'post', 0);
    if (!empty($savepost)) {
        $array_config = array();
Exemplo n.º 6
0
             die('OK');
         } else {
             die($lang_module['errorsave']);
         }
     }
     if ($nv_Request->isset_request('edit', 'get')) {
         $post = $groupsList[$post['id']];
         $post['content'] = nv_editor_br2nl($post['content']);
         $post['exp_time'] = !empty($post['exp_time']) ? date('d/m/Y', $post['exp_time']) : '';
         $post['publics'] = $post['publics'] ? ' checked="checked"' : '';
         $post['siteus'] = $post['siteus'] ? ' checked="checked"' : '';
     } else {
         $post['title'] = $post['content'] = $post['exp_time'] = '';
         $post['publics'] = '';
     }
     $post['content'] = htmlspecialchars(nv_editor_br2nl($post['content']));
     $xtpl->assign('DATA', $post);
     if (defined('NV_CONFIG_DIR') and empty($global_config['idsite'])) {
         $xtpl->parse('add.siteus');
     }
     if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
         $_cont = nv_aleditor('content', '100%', '300px', $post['content']);
     } else {
         $_cont = '<textarea style="width:100%;height:300px" name="content" id="content">' . $post['content'] . '</textarea>';
     }
     $xtpl->assign('CONTENT', $_cont);
     $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
     $xtpl->assign('NV_LANG_INTERFACE', NV_LANG_INTERFACE);
     $xtpl->parse('add');
     $contents = $xtpl->text('add');
 } else {
Exemplo n.º 7
0
} 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);
$xtpl->assign('UPLOADS_DIR_USER', NV_UPLOADS_DIR . '/' . $module_upload);
Exemplo n.º 8
0
     $xtpl->parse('main.layout');
 }
 foreach ($array_status as $key_i => $name_i) {
     $xtpl->assign('INHOME', array('key' => $key_i, 'name' => $name_i, 'selected' => $key_i == $data['inhome'] ? 'selected="selected"' : ''));
     $xtpl->parse('main.inhome');
 }
 foreach ($array_status as $key => $name) {
     $xtpl->assign('STATUS', array('key' => $key, 'name' => $name, 'selected' => $key == $data['status'] ? 'selected="selected"' : ''));
     $xtpl->parse('main.status');
 }
 $groups_view = explode(',', $data['groups_view']);
 foreach ($groups_list as $_group_id => $_title) {
     $xtpl->assign('GROUPS_VIEW', array('value' => $_group_id, 'checked' => in_array($_group_id, $groups_view) ? ' checked="checked"' : '', 'title' => $_title));
     $xtpl->parse('main.groups_view');
 }
 $data['description'] = htmlspecialchars(nv_editor_br2nl($data['description']));
 if (defined('NV_EDITOR') and function_exists('nv_aleditor')) {
     $edits = nv_aleditor('description', '100%', '150px', $data['description'], 'Basic');
 } else {
     $edits = "<textarea style=\"width: 100%\" name=\"description\" id=\"description\" cols=\"20\" rows=\"15\">" . $data['description'] . "</textarea>";
 }
 $xtpl->assign('edit_description', $edits);
 if (empty($data['alias'])) {
     $xtpl->parse('main.getalias');
 }
 $xtpl->parse('main');
 $contents = $xtpl->text('main');
 include NV_ROOTDIR . '/includes/header.php';
 echo nv_admin_theme($contents);
 include NV_ROOTDIR . '/includes/footer.php';
 exit;
Exemplo n.º 9
0
             $error = $lang_module['file_error1'];
         } else {
             if ($report and $array['is_del_report']) {
                 $sql = "DELETE FROM `" . NV_PREFIXLANG . "_" . $module_data . "_report` WHERE `fid`=" . $id;
                 $db->sql_query($sql);
             }
             nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['download_editfile'], $array['title'], $admin_info['userid']);
             Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name);
             exit;
         }
     }
     $array['fileupload'] = !empty($array['fileupload']) ? explode("[NV]", $array['fileupload']) : array();
 } else {
     $array['catid'] = (int) $row['catid'];
     $array['title'] = $row['title'];
     $array['description'] = nv_editor_br2nl($row['description']);
     $array['introtext'] = nv_br2nl($row['introtext']);
     $array['author_name'] = $row['author_name'];
     $array['author_email'] = $row['author_email'];
     $array['author_url'] = $row['author_url'];
     $array['fileupload'] = $row['fileupload'];
     $array['linkdirect'] = $row['linkdirect'];
     $array['version'] = $row['version'];
     $array['filesize'] = (int) $row['filesize'];
     $array['fileimage'] = $row['fileimage'];
     $array['copyright'] = $row['copyright'];
     $array['comment_allow'] = (int) $row['comment_allow'];
     $array['who_comment'] = (int) $row['who_comment'];
     $array['groups_comment'] = $row['groups_comment'];
     $array['who_view'] = (int) $row['who_view'];
     $array['groups_view'] = $row['groups_view'];
Exemplo n.º 10
0
        if ($mode == 'edit') {
            $stmt = $db->prepare("UPDATE " . NV_MOD_TABLE . "_config SET\n\t\t\t\tcontent= :content,\n\t\t\t\tedit_time='" . NV_CURRENTTIME . "'\n\t\t\t\tWHERE config ='siteterms_" . NV_LANG_DATA . "'");
            $stmt->bindParam(':content', $content, PDO::PARAM_STR, strlen($content));
            $stmt->execute();
        } else {
            $stmt = $db->prepare("INSERT INTO " . NV_MOD_TABLE . "_config VALUES (\n\t\t\t\t'siteterms_" . NV_LANG_DATA . "', :content, " . NV_CURRENTTIME . ")");
        }
        $stmt->bindParam(':content', $content, PDO::PARAM_STR, strlen($content));
        if ($stmt->execute()) {
            $error = $lang_module['saveok'];
        } else {
            $error = $lang_module['errorsave'];
        }
    }
}
$content = htmlspecialchars(nv_editor_br2nl($content));
$xtpl = new XTemplate('siteterms.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', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $op);
if (!empty($error)) {
    $xtpl->assign('ERROR', $error);
    $xtpl->parse('main.error');
}
if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
    $data = nv_aleditor('content', '100%', '300px', $content);
} else {
    $data = '<textarea style="width: 100%" name="content" id="content" cols="20" rows="8">' . $content . '</textarea>';
}
$xtpl->assign('DATA', $data);
$xtpl->parse('main');
Exemplo n.º 11
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');
}
Exemplo n.º 12
0
    $sth->bindParam(':config_value', $bodytext, PDO::PARAM_STR, strlen($bodytext));
    $sth->execute();
    $nv_Cache->delMod('settings');
    Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op);
    die;
}
$bodytext = isset($module_config[$module_name]['bodytext']) ? nv_editor_br2nl($module_config[$module_name]['bodytext']) : '';
$is_edit = $nv_Request->get_int('is_edit', 'get', 0);
if (empty($bodytext)) {
    $is_edit = 1;
}
$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);
if ($is_edit) {
    $bodytext = htmlspecialchars(nv_editor_br2nl($bodytext));
    $xtpl->assign('FORM_ACTION', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $op);
    if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
        $data = nv_aleditor('bodytext', '99%', '300px', $bodytext);
    } else {
        $data = "<textarea style=\"width: 99%\" name=\"bodytext\" id=\"bodytext\" cols=\"20\" rows=\"8\">" . $bodytext . "</textarea>";
    }
    $xtpl->assign('DATA', $data);
    $xtpl->parse('main.edit');
} else {
    $xtpl->assign('DATA', $bodytext);
    $xtpl->assign('URL_EDIT', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $op . '&amp;is_edit=1');
    $xtpl->parse('main.data');
}
$xtpl->parse('main');
$contents = $xtpl->text('main');
Exemplo n.º 13
0
}
$page_title = $lang_module['content'];
if (defined('NV_EDITOR')) {
    require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
}
$content_file = NV_ROOTDIR . '/' . NV_DATADIR . '/' . NV_LANG_DATA . '_' . $module_data . 'Content.txt';
if ($nv_Request->get_int('save', 'post') == '1') {
    $bodytext = nv_editor_filter_textarea('bodytext', '', NV_ALLOWED_HTML_TAGS, true);
    file_put_contents($content_file, $bodytext);
    Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $op);
    die;
}
$bodytext = "";
if (file_exists($content_file)) {
    $bodytext = file_get_contents($content_file);
    $bodytext = nv_editor_br2nl($bodytext);
}
$is_edit = $nv_Request->get_int('is_edit', 'get', 0);
if (empty($bodytext)) {
    $is_edit = 1;
}
$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);
if ($is_edit) {
    if (!empty($bodytext)) {
        $bodytext = nv_htmlspecialchars($bodytext);
    }
    $xtpl->assign('FORM_ACTION', NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=" . $op);
    if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
        $data = nv_aleditor("bodytext", '99%', '300px', $bodytext);
Exemplo n.º 14
0
/**
 * 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');
}
Exemplo n.º 15
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";
 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');
         }
     }
 }
Exemplo n.º 17
0
 if (!empty($groups_list)) {
     foreach ($groups_list as $key => $title) {
         $array['groups_view'][] = array('key' => $key, 'title' => $title, 'checked' => in_array($key, $groups_view) ? ' checked="checked"' : '');
     }
 }
 $groups_download = $array['groups_download'];
 $array['groups_download'] = array();
 if (!empty($groups_list)) {
     foreach ($groups_list as $key => $title) {
         $array['groups_download'][] = array('key' => $key, 'title' => $title, 'checked' => in_array($key, $groups_download) ? ' checked="checked"' : '');
     }
 }
 if (defined('NV_EDITOR')) {
     require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
 }
 $array['description'] = htmlspecialchars(nv_editor_br2nl($array['description']));
 if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
     $array['description'] = nv_aleditor('description', '100%', '300px', $array['description']);
 } else {
     $array['description'] = "<textarea style=\"width:100%; height:300px\" name=\"description\" id=\"description\">" . $array['description'] . "</textarea>";
 }
 if (!$array['filesize']) {
     $array['filesize'] = '';
 }
 $xtpl = new XTemplate('filequeue_edit.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
 $xtpl->assign('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;edit=1&amp;id=' . $id);
 $xtpl->assign('LANG', $lang_module);
 $xtpl->assign('DATA', $array);
 $xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL);
 $xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE);
 $xtpl->assign('IMG_DIR', NV_UPLOADS_DIR . '/' . $module_upload . '/images');
Exemplo n.º 18
0
 /**
  * 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;
 }
Exemplo n.º 19
0
if (!empty($mobile_theme_array)) {
    foreach ($mobile_theme_array as $folder) {
        $xtpl->assign('SELECTED', $global_config['mobile_theme'] == $folder ? ' selected="selected"' : '');
        $xtpl->assign('SITE_THEME', $folder);
        $xtpl->parse('main.mobile_theme.loop');
    }
    $xtpl->parse('main.mobile_theme');
}
$sql = "SELECT title, custom_title FROM " . NV_MODULES_TABLE . " WHERE act=1 AND title NOT IN ('menu', 'comment') ORDER BY weight ASC";
$mods = $db->query($sql);
foreach ($mods as $mod) {
    $xtpl->assign('SELECTED', $global_config['site_home_module'] == $mod['title'] ? ' selected="selected"' : '');
    $xtpl->assign('MODULE', $mod);
    $xtpl->parse('main.module');
}
$global_config['disable_site_content'] = htmlspecialchars(nv_editor_br2nl($global_config['disable_site_content']));
if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
    $disable_site_content = nv_aleditor('disable_site_content', '100%', '100px', $global_config['disable_site_content']);
} else {
    $disable_site_content = "<textarea style=\"width:100%;height:100px\" name=\"disable_site_content\" id=\"disable_site_content\">" . $global_config['disable_site_content'] . "</textarea>";
}
$xtpl->assign('DISABLE_SITE_CONTENT', $disable_site_content);
$xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL);
$xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE);
$xtpl->assign('SHOW_SSL_MODULES', intval($show_ssl_modules));
if (!$show_ssl_modules) {
    $xtpl->parse('main.ssl_https_modules_hide');
}
foreach ($site_mods as $_mod_title => $_mod_values) {
    $xtpl->assign('MOD_TITLE', $_mod_title);
    $xtpl->assign('MOD_CHECKED', in_array($_mod_title, $global_config['ssl_https_modules']) ? ' checked="checked"' : '');
Exemplo n.º 20
0
        } else {
            list($weight) = $db->sql_fetchrow($db->sql_query("SELECT MAX(`weight`) FROM `" . NV_PREFIXLANG . "_" . $module_data . "`"));
            $weight = intval($weight) + 1;
            $query = "INSERT INTO `" . NV_PREFIXLANG . "_" . $module_data . "` VALUES (\r\n            NULL, " . $db->dbescape($title) . ", " . $db->dbescape($alias) . ", " . $db->dbescape($bodytext) . ", '', \r\n            " . $weight . ", " . $admin_info['admin_id'] . ", " . NV_CURRENTTIME . ", " . NV_CURRENTTIME . ", 1);";
            nv_insert_logs(NV_LANG_DATA, $module_name, 'log_add_about', " ", $admin_info['userid']);
        }
        $db->sql_query($query);
        nv_del_moduleCache($module_name);
        Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=main");
        die;
    }
} else {
    if (defined('IS_EDIT')) {
        $title = $row['title'];
        $alias = $row['alias'];
        $bodytext = nv_editor_br2nl($row['bodytext']);
    } else {
        $title = $alias = $bodytext = "";
    }
}
if (!empty($bodytext)) {
    $bodytext = nv_htmlspecialchars($bodytext);
}
if (!empty($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=\"" . $action . "\" method=\"post\">\n";
$contents .= "<input name=\"save\" type=\"hidden\" value=\"1\" />\n";
Exemplo n.º 21
0
            die;
        } catch (PDOException $e) {
            $error = $lang_module['duplicate_alias'];
            trigger_error($e->getMessage());
        }
    }
} else {
    if ($id) {
        $full_name = $frow['full_name'];
        $alias = $frow['alias'];
        $phone = $frow['phone'];
        $fax = $frow['fax'];
        $email = $frow['email'];
        $yahoo = $frow['yahoo'];
        $skype = $frow['skype'];
        $note = nv_editor_br2nl($frow['note']);
        $admins_list = $frow['admins'];
        $admins_list = !empty($admins_list) ? array_map('trim', explode(';', $admins_list)) : array();
        $view_level = $reply_level = $obt_level = array();
        if (!empty($admins_list)) {
            foreach ($admins_list as $l) {
                if (preg_match('/^([0-9]+)\\/([0-1]{1})\\/([0-1]{1})\\/([0-1]{1})$/i', $l)) {
                    $l2 = array_map('intval', explode('/', $l));
                    $admid = intval($l2[0]);
                    if (isset($adms[$admid])) {
                        if ($adms[$admid]['level'] === 1) {
                            $view_level[] = $admid;
                            $reply_level[] = $admid;
                            if (isset($l2[3]) and $l2[3] === 1) {
                                $obt_level[] = $admid;
                            }
Exemplo n.º 22
0
/**
 * 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');
}
Exemplo n.º 23
0
 $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') {
     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.edit_user.field.loop.select.loop');
     }
Exemplo n.º 24
0
        } else {
            $check = '';
        }
        $xtpl->assign('CHECK', $check);
        $view['link_view'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $op . '&amp;parentid=' . $view['id'];
        $view['link_edit'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $op . '&amp;id=' . $view['id'];
        $view['link_delete'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $op . '&amp;delete_id=' . $view['id'] . '&amp;delete_checkss=' . md5($view['id'] . NV_CACHE_PREFIX . $client_info['session_id']);
        $xtpl->assign('VIEW', $view);
        $xtpl->parse('main.view.loop');
    }
    $xtpl->parse('main.view');
}
if (defined('NV_EDITOR')) {
    require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
}
$row['descriptionhtml'] = nv_htmlspecialchars(nv_editor_br2nl($row['descriptionhtml']));
if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
    $_uploads_dir = NV_UPLOADS_DIR . '/' . $module_upload;
    $descriptionhtml = nv_aleditor('descriptionhtml', '100%', '200px', $row['descriptionhtml'], 'Basic', $_uploads_dir, $_uploads_dir);
} else {
    $descriptionhtml = "<textarea style=\"width: 100%\" name=\"descriptionhtml\" id=\"descriptionhtml\" cols=\"20\" rows=\"15\">" . $descriptionhtml . "</textarea>";
}
$xtpl->assign('DESCRIPTIONHTML', $descriptionhtml);
foreach ($array_cat_list as $rows_i) {
    $sl = $rows_i[0] == $row['parentid'] ? ' selected="selected"' : '';
    $xtpl->assign('pid', $rows_i[0]);
    $xtpl->assign('ptitle', $rows_i[1]);
    $xtpl->assign('pselect', $sl);
    $xtpl->parse('main.parent_loop');
}
$groups_view = !empty($row['groups_view']) ? explode(',', $row['groups_view']) : array();
Exemplo n.º 25
0
foreach ($array_typeprice as $key => $value) {
    $ck = $data['typeprice'] == $key ? 'checked="checked"' : '';
    $xtpl->assign('TYPEPRICE', array('key' => $key, 'value' => $value, 'checked' => $ck));
    $xtpl->parse('main.typeprice_loop');
}
if ($pro_config['point_active']) {
    $xtpl->parse('main.point');
}
if (!empty($cat_form_exit)) {
    foreach ($cat_form_exit as $_form) {
        $xtpl->assign('CAT_FORM', array('value' => $_form, 'selected' => $data['form'] == $_form ? ' selected="selected"' : '', 'title' => $_form));
        $xtpl->parse('main.cat_form.loop');
    }
    $xtpl->parse('main.cat_form');
}
$descriptionhtml = nv_htmlspecialchars(nv_editor_br2nl($data[NV_LANG_DATA . '_descriptionhtml']));
if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
    $descriptionhtml = nv_aleditor('descriptionhtml', '100%', '200px', $descriptionhtml, 'Basic');
} else {
    $descriptionhtml = "<textarea style=\"width: 100%\" name=\"descriptionhtml\" id=\"descriptionhtml\" cols=\"20\" rows=\"15\">" . $descriptionhtml . "</textarea>";
}
$xtpl->assign('DESCRIPTIONHTML', $descriptionhtml);
for ($i = 0; $i <= 2; $i++) {
    $xtpl->assign('VIEWDESCRIPTION', array('value' => $i, 'checked' => $data['viewdescriptionhtml'] == $i ? ' checked="checked"' : '', 'title' => $lang_module['content_bodytext_display_' . $i]));
    $xtpl->parse('main.viewdescriptionhtml');
}
$xtpl->parse('main');
$contents = $xtpl->text('main');
include NV_ROOTDIR . '/includes/header.php';
echo nv_admin_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
Exemplo n.º 26
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";
Exemplo n.º 27
0
                $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;
}
$tdate = date('H|i', $rowcontent['publtime']);
Exemplo n.º 28
0
             $sql = "INSERT INTO `" . NV_PREFIXLANG . "_" . $module_data . "` VALUES (\r\n                NULL, \r\n                " . $array['catid'] . ", \r\n                " . $db->dbescape($array['title']) . ", \r\n                " . $db->dbescape($alias) . ", \r\n                " . $db->dbescape($array['question']) . ", \r\n                " . $db->dbescape($array['answer']) . ", \r\n                " . $new_weight . ", \r\n                1, " . NV_CURRENTTIME . ")";
             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");
Exemplo n.º 29
0
         $ok = $db->sql_query($query);
     } else {
         $query = "INSERT INTO `" . NV_GROUPS_GLOBALTABLE . "` \n                VALUES (NULL, " . $db->dbescape($post['title']) . ", \n                " . $db->dbescape($post['content']) . ", \n                " . NV_CURRENTTIME . ", \n                " . $post['exp_time'] . ", \n                '', " . $post['public'] . ", " . ($groupcount + 1) . ", 1);";
         $ok = $post['id'] = $db->sql_query_insert_id($query);
     }
     if ($ok) {
         nv_del_moduleCache($module_name);
         nv_insert_logs(NV_LANG_DATA, $module_name, $log_title, "Id: " . $post['id'], $admin_info['userid']);
         die("OK");
     } else {
         die($lang_module['errorsave']);
     }
 }
 if ($nv_Request->isset_request('edit', 'get')) {
     $post = $groupsList[$post['id']];
     $post['content'] = nv_editor_br2nl($post['content']);
     $post['exp_time'] = !empty($post['exp_time']) ? date("d.m.Y", $post['exp_time']) : "";
     $post['public'] = $post['public'] ? " checked=\"checked\"" : "";
 } else {
     $post['title'] = $post['content'] = $post['exp_time'] = "";
     $post['public'] = "";
 }
 if (!empty($post['content'])) {
     $post['content'] = nv_htmlspecialchars($post['content']);
 }
 $xtpl->assign('DATA', $post);
 if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
     $xtpl->parse('add.is_editor');
     $_cont = nv_aleditor('content', '100%', '300px', $post['content']);
 } else {
     $_cont = "<textarea style=\"width:100%;height:300px\" name=\"content\" id=\"content\">" . $post['content'] . "</textarea>";
Exemplo n.º 30
0
            $db->query("UPDATE " . $db_config['prefix'] . "_" . $module_data . "_orders SET transaction_status=" . $transaction_status . ", transaction_id=" . $transaction_id . ", transaction_count=transaction_count+1 WHERE order_id=" . $order_id);
            //Cap nhat diem tich luy
            UpdatePoint($data_content);
            nv_insert_logs(NV_LANG_DATA, $module_name, 'Log payment product', "Order code: " . $data_content['order_code'], $admin_info['userid']);
        }
        // Gửi mail xác nhận thanh toán
        $content = '';
        $email_contents_table = call_user_func('email_new_order_payment', $content, $data_content, $data_pro, true);
        $checkss = md5($order_id . $global_config['sitekey'] . session_id());
        $review_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=payment&order_id=' . $order_id . '&checkss=' . $checkss;
        $replace_data = array('order_code' => $data_content['order_code'], 'order_name' => $data_content['order_name'], 'order_email' => $data_content['order_email'], 'order_phone' => $data_content['order_phone'], 'order_address' => $data_content['order_address'], 'order_note' => $data_content['order_note'], 'order_total' => nv_number_format($data_content['order_total']), 'unit_total' => $data_content['unit_total'], 'dateup' => nv_date("d-m-Y", $data_content['order_time']), 'moment' => nv_date("H:i", $data_content['order_time']), 'review_url' => '<a href="' . $global_config['site_url'] . $review_url . '">' . $lang_module['here'] . '</a>', 'table_product' => $email_contents_table, 'site_url' => $global_config['site_url'], 'site_name' => $global_config['site_name']);
        $content_file = NV_ROOTDIR . '/' . NV_DATADIR . '/' . NV_LANG_DATA . '_' . $module_data . '_order_payment_content.txt';
        if (file_exists($content_file)) {
            $content = file_get_contents($content_file);
            if (empty($content)) {
                $content = $lang_module['order_email_payment'];
            }
            $content = nv_editor_br2nl($content);
        } else {
            $content = $lang_module['order_email_payment'];
        }
        foreach ($replace_data as $key => $value) {
            $content = str_replace('{' . $key . '}', $value, $content);
        }
        $email_contents = call_user_func('email_new_order_payment', $content, $data_content, $data_pro);
        nv_sendmail(array($global_config['site_name'], $global_config['site_email']), $data_content['order_email'], sprintf($lang_module['document_payment_email_order_payment'], $module_info['custom_title'], $data_content['order_code']), $email_contents);
        $contents = $lang_module['order_submit_pay_ok'];
        nv_del_moduleCache($module_name);
    }
}
die($contents);