Example #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>';
 }
Example #2
0
        } 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');
$contents = $xtpl->text('main');
include NV_ROOTDIR . '/includes/header.php';
echo nv_admin_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
Example #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';
Example #4
0
        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 {
    $data = "<textarea style=\"width: 100%\" name=\"content\" id=\"content\" cols=\"20\" rows=\"8\">" . $content . "</textarea>";
}
$xtpl->assign('DATA', $data);
$xtpl->parse('main');
$contents = $xtpl->text('main');
include NV_ROOTDIR . "/includes/header.php";
echo nv_admin_theme($contents);
include NV_ROOTDIR . "/includes/footer.php";
Example #5
0
    $mess_content .= "<br /><br />----------<br />Best regards,<br /><br />" . $admin_name . "<br />";
    if (!empty($admin_info['position'])) {
        $mess_content .= $admin_info['position'] . "<br />";
    }
    $mess_content .= "<br />";
    $mess_content .= "E-mail: " . $admin_info['email'] . "<br />";
    $mess_content .= "Website: " . $global_config['site_name'] . "<br />" . $global_config['site_url'] . "<br /><br />";
    $mess_content .= "--------------------------------------------------------------------------------<br />";
    $mess_content .= "<strong>From:</strong> " . $row['sender_name'] . " [mailto:" . $row['sender_email'] . "]<br />";
    $mess_content .= "<strong>Sent:</strong> " . date("r", $row['send_time']) . "<br />";
    $mess_content .= "<strong>To:</strong> " . $contact_allowed['view'][$row['cid']] . "<br />";
    $mess_content .= "<strong>Subject:</strong> " . $row['title'] . "<br /><br />";
    $mess_content .= $row['content'];
}
$mess_content = nv_htmlspecialchars($mess_content);
if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
    $mess_content = nv_aleditor("mess_content", '100%', '300px', $mess_content);
} else {
    $mess_content = "<textarea style=\"width:99%\" name=\"mess_content\" id=\"mess_content\" cols=\"20\" rows=\"8\">" . $mess_content . "</textarea>";
}
$xtpl->assign('FORM_ACTION', NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=" . $op . "&amp;id=" . $id);
$xtpl->assign('MESS_CONTENT', $mess_content);
if (!empty($error)) {
    $xtpl->assign('ERROR', $error);
    $xtpl->parse('main.error');
}
$xtpl->parse('main');
$contents = $xtpl->text('main');
include NV_ROOTDIR . "/includes/header.php";
echo nv_admin_theme($contents);
include NV_ROOTDIR . "/includes/footer.php";
Example #6
0
    $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();
        $array_group_id = $nv_Request->get_typed_array('array_group_id', 'post');
        $array_addcontent = $nv_Request->get_typed_array('array_addcontent', 'post');
        $array_postcontent = $nv_Request->get_typed_array('array_postcontent', 'post');
Example #7
0
            }
        }
    }
}
if (!empty($note)) {
    $note = nv_htmlspecialchars($note);
}
if (empty($row['alias'])) {
    $xtpl->parse('main.get_alias');
}
if (!empty($error)) {
    $xtpl->assign('ERROR', $error);
    $xtpl->parse('main.error');
}
if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
    $note = nv_aleditor('note', '100%', '150px', $note);
} else {
    $note = '<textarea style="width:100%;height:150px" name="note" id="note">' . $note . '</textarea>';
}
$xtpl->assign('DATA', array('full_name' => $full_name, 'alias' => $alias, 'phone' => $phone, 'fax' => $fax, 'email' => $email, 'yahoo' => $yahoo, 'skype' => $skype, 'note' => $note));
//list danh sách bộ phận liên hệ
$a = 0;
foreach ($adms as $admid => $values) {
    $xtpl->assign('ADMIN', array('login' => $values['login'], 'first_name' => $values['first_name'], 'last_name' => $values['last_name'], 'email' => $values['email'], 'admid' => $admid, 'view_level' => ($values['level'] === 1 or !empty($view_level) and in_array($admid, $view_level)) ? ' checked="checked"' : '', 'reply_level' => ($values['level'] === 1 or !empty($reply_level) and in_array($admid, $reply_level)) ? ' checked="checked"' : '', 'obt_level' => (!empty($obt_level) and in_array($admid, $obt_level)) ? ' checked="checked"' : '', 'disabled' => $values['level'] === 1 ? ' disabled="disabled"' : ''));
    $xtpl->parse('main.admin');
}
$xtpl->parse('main');
$contents = $xtpl->text('main');
include NV_ROOTDIR . '/includes/header.php';
echo nv_admin_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
Example #8
0
        $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"' : '');
    $xtpl->parse('main.ssl_https_modules');
}
    $select .= "<option value=\"" . $i . "\"" . ($i == $emin ? ' selected="selected"' : '') . ">" . str_pad($i, 2, "0", STR_PAD_LEFT) . "</option>\n";
}
$xtpl->assign('emin', $select);
// allowed comm
$allowed_comm = explode(',', $rowcontent['allowed_comm']);
foreach ($groups_list as $_group_id => $_title) {
    $xtpl->assign('ALLOWED_COMM', array('value' => $_group_id, 'checked' => in_array($_group_id, $allowed_comm) ? ' checked="checked"' : '', 'title' => $_title));
    $xtpl->parse('main.allowed_comm');
}
if ($module_config[$module_name]['allowed_comm'] != '-1') {
    $xtpl->parse('main.content_note_comm');
}
if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
    $edits = nv_aleditor('bodyhtml', '100%', '400px', $rowcontent['bodyhtml'], '', $uploads_dir_user, $currentpath);
    $edit_rule = nv_aleditor('rule', '100%', '400px', $rowcontent['rule'], '', $uploads_dir_user, $currentpath);
    $edit_content = nv_aleditor('content', '100%', '400px', $rowcontent['content'], '', $uploads_dir_user, $currentpath);
} else {
    $edits = "<textarea style=\"width: 100%\" name=\"bodyhtml\" id=\"bodyhtml\" cols=\"20\" rows=\"15\">" . $rowcontent['bodyhtml'] . "</textarea>";
    $edit_rule = "<textarea style=\"width: 100%\" name=\"rule\" id=\"rule\" cols=\"20\" rows=\"15\">" . $rowcontent['rule'] . "</textarea>";
    $edit_content = "<textarea style=\"width: 100%\" name=\"content\" id=\"content\" cols=\"20\" rows=\"15\">" . $rowcontent['content'] . "</textarea>";
}
$shtm = '';
if (!empty($rowcontent['keywords'])) {
    $keywords_array = explode(',', $rowcontent['keywords']);
    foreach ($keywords_array as $keywords) {
        $xtpl->assign('KEYWORDS', $keywords);
        $xtpl->parse('main.keywords');
    }
}
$archive_checked = $rowcontent['archive'] ? ' checked="checked"' : '';
$xtpl->assign('archive_checked', $archive_checked);
Example #10
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');
}
Example #11
0
function manager_theme($news_contents, $list_users, $array_keyword, $content_comment)
{
    global $global_config, $module_name, $module_file, $lang_module, $my_head, $module_info, $op, $global_array_fam, $global_array_location_city, $global_array_location_district, $global_array_location_ward;
    $xtpl = new XTemplate("manager-genealogy.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('NV_ACTION_FILE', nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $global_array_fam[$news_contents['fid']]['alias'] . '/' . $news_contents['alias'] . '/Manager' . $global_config['rewrite_exturl'], true));
    $xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE);
    $xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE);
    $xtpl->assign('MODULE_NAME', $module_name);
    $xtpl->assign('TEMPLATE', $module_info['template']);
    $xtpl->assign('OP', $op);
    foreach ($global_array_fam as $global_array_fam_i) {
        $global_array_fam_i['selected'] = $global_array_fam_i['fid'] == $news_contents['fid'] ? ' selected="selected"' : '';
        $xtpl->assign('FAMILY', $global_array_fam_i);
        $xtpl->parse('main.family');
    }
    foreach ($global_array_location_city as $global_array_city_i) {
        $global_array_city_i['selected'] = $global_array_city_i['city_id'] == $news_contents['cityid'] ? ' selected="selected"' : '';
        $xtpl->assign('CITY', $global_array_city_i);
        $xtpl->parse('main.city');
    }
    foreach ($global_array_location_district as $global_array_district_i) {
        $global_array_district_i['selected'] = $global_array_district_i['district_id'] == $news_contents['districtid'] ? ' selected="selected"' : '';
        $xtpl->assign('DISTRICT', $global_array_district_i);
        $xtpl->parse('main.district');
    }
    foreach ($global_array_location_ward as $global_array_ward_i) {
        $global_array_ward_i['selected'] = $global_array_ward_i['ward_id'] == $news_contents['wardid'] ? ' selected="selected"' : '';
        $xtpl->assign('WARD', $global_array_ward_i);
        $xtpl->parse('main.ward');
    }
    /*   
        $post['status_checked'] = ($post['status']) ? ' checked="checked"' : '';
    */
    $array_who_view = array(0 => $lang_module['who_view0'], 1 => $lang_module['who_view1'], 2 => $lang_module['who_view2']);
    foreach ($array_who_view as $key => $value) {
        $row = array('id' => $key, 'title' => $value, 'selected' => '');
        $xtpl->assign('WHO_VIEW', $row);
        $xtpl->parse('main.who_view');
    }
    if (nv_function_exists('nv_aleditor')) {
        $news_contents['bodytext'] = nv_aleditor('bodytext', '100%', '200px', $news_contents['bodytext']);
        $news_contents['rule'] = nv_aleditor('rule', '100%', '200px', $news_contents['rule']);
        $news_contents['content'] = nv_aleditor('content', '100%', '200px', $news_contents['content']);
    } else {
        $news_contents['bodytext'] = "<textarea style=\"width: 100%\" name=\"bodytext\" cols=\"20\" rows=\"15\">" . $news_contents['bodytext'] . "</textarea>";
        $news_contents['rule'] = "<textarea style=\"width: 100%\" name=\"rule\" cols=\"20\" rows=\"15\">" . $news_contents['rulet'] . "</textarea>";
        $news_contents['content'] = "<textarea style=\"width: 100%\" name=\"content\" cols=\"20\" rows=\"15\">" . $news_contents['content'] . "</textarea>";
    }
    $xtpl->assign('DATA', $news_contents);
    if (!empty($list_users)) {
        $xtpl->assign('DATATREE', nv_manager_viewdirtree_genealogy(0, 'manager-genealogy'));
        $xtpl->parse('main.foldertree');
        if (defined('NV_IS_GENEALOGY_MANAGER')) {
            $xtpl->parse('main.contextMenu');
        }
    } else {
        if (defined('NV_IS_GENEALOGY_MANAGER')) {
            $xtpl->parse('main.create_users');
        } else {
            $xtpl->parse('main.no_list');
        }
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}
Example #12
0
$contents .= "<form action=\"" . $action . "\" method=\"post\">\n";
$contents .= "<input name=\"save\" type=\"hidden\" value=\"1\" />\n";
$contents .= "<table summary=\"\" style=\"margin-top:8px;margin-bottom:8px;\">\n";
$contents .= "<col valign=\"top\" width=\"150px\" />\n";
$contents .= "<tr>\n";
$contents .= "<td>" . $lang_module['aabout2'] . ":</td>\n";
$contents .= "<td><input style=\"width:400px\" name=\"title\" id=\"title\" type=\"text\" value=\"" . $title . "\" maxlength=\"255\" /></td>\n";
$contents .= "</tr>\n";
$contents .= "<tr>\n";
$contents .= "<td>" . $lang_module['alias'] . ":</td>\n";
$contents .= "<td><input style=\"width:400px\" name=\"alias\" id=\"alias\" type=\"text\" value=\"" . $alias . "\" maxlength=\"255\" /></td>\n";
$contents .= "</tr>\n";
$contents .= "<tr>\n";
$contents .= "<td colspan=\"2\">" . $lang_module['aabout11'] . ":</td>\n";
$contents .= "</tr>\n";
$contents .= "<tr>\n";
$contents .= "<td colspan=\"2\">\n";
if (defined('NV_EDITOR') and function_exists('nv_aleditor')) {
    $contents .= nv_aleditor("bodytext", '750px', '300px', $bodytext);
} else {
    $contents .= "<textarea style=\"width:750px;height:300px\" name=\"bodytext\" id=\"bodytext\">" . $bodytext . "</textarea>";
}
$contents .= "</td>\n";
$contents .= "</tr>\n";
$contents .= "</table>\n";
$contents .= "<br>\n";
$contents .= "<div style=\"text-align:center\"><input name=\"submit1\" type=\"submit\" value=\"" . $lang_module['save'] . "\" /></div>\n";
$contents .= "</form>\n";
include NV_ROOTDIR . "/includes/header.php";
echo nv_admin_theme($contents);
include NV_ROOTDIR . "/includes/footer.php";
Example #13
0
$xtpl->assign('MODULE_UPLOAD', $module_upload);
$xtpl->assign('MODULE_FILE', $module_file);
$xtpl->assign('OP', $op);
$xtpl->assign('ROW', $row);
$array_cat[0] = array('id' => 0, 'title' => $lang_module['cat_none']);
if (!empty($array_cat)) {
    $i = 0;
    foreach ($array_cat as $cat) {
        $cat['checked'] = ($i == 0 or $row['catid'] == $cat['id']) ? 'checked="checked"' : '';
        $xtpl->assign('CAT', $cat);
        $xtpl->parse('main.cat');
        $i++;
    }
}
if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
    $editor = nv_aleditor('descriptionhtml', '100%', '250px', $row['descriptionhtml']);
} else {
    $editor = "<textarea style=\"width: 100%\" name=\"descriptionhtml\" id=\"descriptionhtml\" cols=\"20\" rows=\"15\">" . $row['descriptionhtml'] . "</textarea>";
}
$xtpl->assign('EDITOR', $editor);
if (!empty($error)) {
    $xtpl->assign('ERROR', implode('<br />', $error));
    $xtpl->parse('main.error');
}
if (empty($row['id'])) {
    $xtpl->parse('main.auto_get_alias');
}
$xtpl->parse('main');
$contents = $xtpl->text('main');
$page_title = $lang_module['content'];
include NV_ROOTDIR . '/includes/header.php';
Example #14
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;
 }
Example #15
0
        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);
}
$contents = "";
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=\"" . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=" . $op . "\" method=\"post\">";
$contents .= "<input type=\"hidden\" name =\"save\"value=\"1\" />";
if (defined('NV_EDITOR') and function_exists('nv_aleditor')) {
    $contents .= nv_aleditor("content", '780px', '300px', $content);
} else {
    $contents .= "<textarea style=\"width: 780px\" name=\"content\" id=\"content\" cols=\"20\" rows=\"8\">" . $content . "</textarea>";
}
$contents .= "<div style=\"text-align:center;padding-top:15px\"><input name=\"submit1\" type=\"submit\" value=\"" . $lang_global['save'] . "\" /></div>\n";
$contents .= "</form>\n";
include NV_ROOTDIR . "/includes/header.php";
echo nv_admin_theme($contents);
include NV_ROOTDIR . "/includes/footer.php";
Example #16
0
    }
} else {
    $row['id'] = 0;
    $row['name'] = '';
    $row['phone'] = '';
    $row['address'] = '';
    $row['logo'] = '';
    $row['description'] = '';
    $row['status'] = 0;
}
if (defined('NV_EDITOR')) {
    require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
}
$row['description'] = htmlspecialchars(nv_editor_br2nl($row['description']));
if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
    $row['description'] = nv_aleditor('description', '100%', '300px', $row['description'], 'Basic');
} else {
    $row['description'] = '<textarea style="width:100%;height:300px" name="description">' . $row['description'] . '</textarea>';
}
// Fetch Limit
$show_view = false;
if (!$nv_Request->isset_request('id', 'post,get')) {
    $show_view = true;
    $per_page = 5;
    $page = $nv_Request->get_int('page', 'post,get', 1);
    $db->sqlreset()->select('COUNT(*)')->from($db_config['prefix'] . '_' . $module_data . '_carrier');
    $sth = $db->prepare($db->sql());
    $sth->execute();
    $num_items = $sth->fetchColumn();
    $db->select('*')->order('weight ASC')->limit($per_page)->offset(($page - 1) * $per_page);
    $sth = $db->prepare($db->sql());
Example #17
0
    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;
}
/*show list category*/
Example #18
0
// Allowed comm
$allowed_comm = explode(',', $rowcontent['allowed_comm']);
foreach ($groups_list as $_group_id => $_title) {
    $xtpl->assign('ALLOWED_COMM', array('value' => $_group_id, 'checked' => in_array($_group_id, $allowed_comm) ? ' checked="checked"' : '', 'title' => $_title));
    $xtpl->parse('main.allowed_comm');
}
$rowcontent['hometext'] = htmlspecialchars(nv_editor_br2nl($rowcontent['hometext']));
if (defined('NV_EDITOR') and function_exists('nv_aleditor')) {
    $edits = nv_aleditor('hometext', '100%', '150px', $rowcontent['hometext'], 'Basic');
} else {
    $edits = "<textarea style=\"width: 100%\" name=\"hometext\" id=\"hometext\" cols=\"20\" rows=\"15\">" . $rowcontent['hometext'] . "</textarea>";
}
$xtpl->assign('edit_hometext', $edits);
$rowcontent['bodytext'] = htmlspecialchars(nv_editor_br2nl($rowcontent['bodytext']));
if (defined('NV_EDITOR') and function_exists('nv_aleditor')) {
    $edits = nv_aleditor('bodytext', '100%', '300px', $rowcontent['bodytext']);
} else {
    $edits = "<textarea style=\"width: 100%\" name=\"bodytext\" id=\"bodytext\" cols=\"20\" rows=\"15\">" . $rowcontent['bodytext'] . "</textarea>";
}
$xtpl->assign('edit_bodytext', $edits);
$shtm = '';
if (count($array_block_cat_module) > 0) {
    foreach ($array_block_cat_module as $bid_i => $bid_title) {
        $ch = in_array($bid_i, $id_block_content) ? " checked=\"checked\"" : "";
        $shtm .= "<input class=\"news_checkbox\" type=\"checkbox\" name=\"bids[]\" value=\"" . $bid_i . "\"" . $ch . ">" . $bid_title . "<br />\n";
    }
    $xtpl->assign('row_block', $shtm);
    $xtpl->parse('main.block_cat');
}
if (!empty($money_config)) {
    foreach ($money_config as $code => $info) {
Example #19
0
    $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);
$xtpl->assign('DATA', $row);
$xtpl->assign('BODYTEXT', $row['bodytext']);
Example #20
0
 } elseif ($contentid > 0) {
     $rowcontent = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_rows where id=' . $contentid)->fetch();
     if (empty($rowcontent['id'])) {
         Header('Location: ' . nv_url_rewrite(NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true));
         die;
     }
     $body_contents = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_bodyhtml_' . ceil($rowcontent['id'] / 2000) . ' where id=' . $rowcontent['id'])->fetch();
     $rowcontent = array_merge($rowcontent, $body_contents);
     unset($body_contents);
 }
 if (!empty($rowcontent['homeimgfile']) and file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/' . $rowcontent['homeimgfile'])) {
     $rowcontent['homeimgfile'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $rowcontent['homeimgfile'];
 }
 $rowcontent['bodyhtml'] = htmlspecialchars(nv_editor_br2nl($rowcontent['bodyhtml']));
 if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
     $htmlbodyhtml = nv_aleditor('bodyhtml', '100%', '300px', $rowcontent['bodyhtml'], 'Basic');
 } else {
     $htmlbodyhtml .= "<textarea class=\"textareaform\" name=\"bodyhtml\" id=\"bodyhtml\" cols=\"60\" rows=\"15\">" . $rowcontent['bodyhtml'] . "</textarea>";
 }
 if (!empty($error)) {
     $my_head .= "<script type=\"text/javascript\">\n";
     $my_head .= "\talert('" . $error . "')\n";
     $my_head .= "</script>\n";
 }
 $template = $module_info['template'];
 if (!file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file . '/content.tpl')) {
     $template = 'default';
 }
 $xtpl = new XTemplate('content.tpl', NV_ROOTDIR . '/themes/' . $template . '/modules/' . $module_file);
 $xtpl->assign('LANG', $lang_module);
 $xtpl->assign('DATA', $rowcontent);
Example #21
0
 }
 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');
     }
     $xtpl->parse('main.edit_user.field.loop.select');
 } elseif ($row['field_type'] == 'radio') {
     $number = 0;
Example #22
0
$contents .= '<input type="button" value="Browse Server" name="selectimg"/>
				<script type="text/javascript">
					$("input[name=selectimg]").click(function(){
						var area = "image";
						var path= "' . NV_UPLOADS_DIR . '/' . $module_name . '";						
						nv_open_browse_file("' . NV_BASE_ADMINURL . 'index.php?' . NV_NAME_VARIABLE . '=upload&popup=1&area=" + area+"&path="+path, "NVImg", "850", "500","resizable=no,scrollbars=no,toolbar=no,location=no,status=no");
						return false;
					});
				</script>	';
$contents .= "</td>";
$contents .= "</tr>";
$contents .= "<tr>";
$contents .= "<td align=\"right\">" . $lang_module['weblink_description'] . ": </td>\n";
$contents .= "<td>";
if (defined('NV_EDITOR') and function_exists('nv_aleditor')) {
    $contents .= nv_aleditor("description", '700px', '300px', $rowcat['description']);
} else {
    $contents .= "<textarea style=\"width: 650px\" name=\"description\" id=\"description\" cols=\"20\" rows=\"8\">" . $rowcat['description'] . "</textarea>";
}
$contents .= "</td>\n";
$contents .= "</tr>";
$contents .= "<tr>";
$contents .= "<td valign=\"top\" align=\"right\">" . $lang_module['weblink_inhome'] . ": </td>\n";
$checked = intval($rowcat['status']) == 1 ? 'checked' : '';
$contents .= "<td><label><input name=\"status\" type=\"checkbox\" value=\"1\" checked=\"" . $checked . "\" />" . $lang_module['weblink_yes'] . "</label></td>\n";
$contents .= "</tr>";
$contents .= "<tr>";
$contents .= "<td align=\"left\" colspan=\"2\"><input name=\"submit\" style=\"width:80px;margin-left:110px\" type=\"submit\" value=\"" . $lang_module['weblink_submit'] . "\" /></td>\n";
$contents .= "</tr>";
$contents .= "</table>";
$contents .= "</form>\n";
Example #23
0
/**
 * nv_edit_plan_theme()
 *
 * @param mixed $contents
 * @return
 */
function nv_edit_plan_theme($contents)
{
    global $global_config, $module_file;
    $xtpl = new XTemplate('edit_plan.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
    $xtpl->assign('CONTENTS', $contents);
    $xtpl->assign('CLASS', $contents['is_error'] ? ' class="error"' : '');
    foreach ($contents['blang'][3] as $key => $blang) {
        $xtpl->assign('BLANG', array('key' => $key, 'title' => $blang['name'], 'selected' => $key == $contents['blang'][4] ? ' selected="selected"' : ''));
        $xtpl->parse('main.blang');
    }
    foreach ($contents['form'][2] as $form) {
        $xtpl->assign('FORM', array('key' => $form, 'title' => $form, 'selected' => $form == $contents['form'][3] ? ' selected="selected"' : ''));
        $xtpl->parse('main.form');
    }
    if ($contents['description'][5] and nv_function_exists('nv_aleditor')) {
        $description = nv_aleditor($contents['description'][1], $contents['description'][3], $contents['description'][4], $contents['description'][2]);
    } else {
        $description = '<textarea name="' . $contents['description'][1] . '" id="' . $contents['description'][1] . '" style="width:' . $contents['description'][3] . ';height:' . $contents['description'][4] . '">' . $contents['description'][2] . '</textarea>\\n';
    }
    $xtpl->assign('DESCRIPTION', $description);
    $xtpl->parse('main');
    return $xtpl->text('main');
}
Example #24
0
 if (!empty($array['answer'])) {
     $array['answer'] = nv_htmlspecialchars($array['answer']);
 }
 if (!empty($array['question'])) {
     $array['question'] = nv_htmlspecialchars($array['question']);
 }
 $listcats = nv_listcats($array['catid']);
 if (empty($listcats)) {
     Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=cat&add=1");
     exit;
 }
 if (defined('NV_EDITOR')) {
     require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
 }
 if (defined('NV_EDITOR') and function_exists('nv_aleditor')) {
     $array['answer'] = nv_aleditor('answer', '100%', '300px', $array['answer']);
 } else {
     $array['answer'] = "<textarea style=\"width:100%; height:300px\" name=\"answer\" id=\"answer\">" . $array['answer'] . "</textarea>";
 }
 $xtpl = new XTemplate("content.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file);
 if (defined('IS_EDIT')) {
     $xtpl->assign('FORM_ACTION', NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;edit=1&amp;id=" . $id);
 } else {
     $xtpl->assign('FORM_ACTION', NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;add=1");
 }
 $xtpl->assign('LANG', $lang_module);
 $xtpl->assign('DATA', $array);
 if (!empty($error)) {
     $xtpl->assign('ERROR', $error);
     $xtpl->parse('main.error');
 }
Example #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';
 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');
         }
     }
 }
Example #27
0
foreach ($groups_list as $_group_id => $_title) {
    $xtpl->assign('ALLOWED_COMM', array('value' => $_group_id, 'checked' => in_array($_group_id, $allowed_comm) ? ' checked="checked"' : '', 'title' => $_title));
    $xtpl->parse('main.allowed_comm');
}
if ($module_config[$module_name]['allowed_comm'] != '-1') {
    $xtpl->parse('main.content_note_comm');
}
// source
$select = '';
while (list($sourceid_i, $source_title_i) = each($array_source_module)) {
    $source_sl = $sourceid_i == $rowcontent['sourceid'] ? ' selected="selected"' : '';
    $select .= "<option value=\"" . $sourceid_i . "\" " . $source_sl . ">" . $source_title_i . "</option>\n";
}
$xtpl->assign('sourceid', $select);
if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) {
    $edits = nv_aleditor('bodyhtml', '100%', '400px', $rowcontent['bodyhtml'], '', $uploads_dir_user, $currentpath);
} else {
    $edits = "<textarea style=\"width: 100%\" name=\"bodyhtml\" id=\"bodyhtml\" cols=\"20\" rows=\"15\">" . $rowcontent['bodyhtml'] . "</textarea>";
}
$shtm = '';
if (sizeof($array_block_cat_module)) {
    foreach ($array_block_cat_module as $bid_i => $bid_title) {
        $xtpl->assign('BLOCKS', array('title' => $bid_title, 'bid' => $bid_i, 'checked' => in_array($bid_i, $id_block_content) ? 'checked="checked"' : ''));
        $xtpl->parse('main.block_cat.loop');
    }
    $xtpl->parse('main.block_cat');
}
//Playlist
if (sizeof($array_playlist_cat_module)) {
    foreach ($array_playlist_cat_module as $playlist_id_i => $playlist_title) {
        $xtpl->assign('PLAYLISTS', array('title' => $playlist_title, 'playlist_id' => $playlist_id_i, 'selected' => in_array($playlist_id_i, $id_playlist_content) ? 'selected="selected"' : ''));
         $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');
 $xtpl->assign('FILES_DIR', NV_UPLOADS_DIR . '/' . $module_upload . '/files');
 if (!empty($error)) {
Example #29
0
    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>";
    }
    $xtpl->assign('CONTENT', $_cont);
    $xtpl->parse('add');
    $contents = $xtpl->text('add');
    $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/popcalendar/popcalendar.js\"></script>\n";
    include NV_ROOTDIR . "/includes/header.php";
    echo nv_admin_theme($contents);
    include NV_ROOTDIR . "/includes/footer.php";
    die;
}
//Danh sach nhom
if ($nv_Request->isset_request('list', 'get')) {
    $a = 0;
function nv_edit_plan_theme($contents)
{
    $return = "";
    $class = $contents['is_error'] ? " class=\"error\"" : "";
    $return .= "<div class=\"quote\" style=\"width:780px;\">\n";
    $return .= "<blockquote" . $class . "><span>" . $contents['info'] . "</span></blockquote>\n";
    $return .= "</div>\n";
    $return .= "<div class=\"clear\"></div>\n";
    $return .= "<form method=\"post\" action=\"" . $contents['action'] . "\">\n";
    $return .= "<div style=\"WIDTH:800px;\">\n";
    $return .= "<input type=\"hidden\" value=\"1\" name=\"save\" id=\"save\" />\n";
    $return .= "<table summary=\"" . $contents['info'] . "\" class=\"tab1\">\n";
    $return .= "<col style=\"width:200px;white-space:nowrap\" />\n";
    $return .= "<col valign=\"top\" width=\"10px\" />\n";
    $return .= "<tbody class=\"second\">\n";
    $return .= "<tr>\n";
    $return .= "<td>" . $contents['title'][0] . ":</td>\n";
    $return .= "<td><sup class=\"required\">&lowast;</sup></td>\n";
    $return .= "<td><input name=\"" . $contents['title'][1] . "\" id=\"" . $contents['title'][1] . "\" type=\"text\" value=\"" . $contents['title'][2] . "\" style=\"width:300px\" maxlength=\"" . $contents['title'][3] . "\" /></td>\n";
    $return .= "</tr>\n";
    $return .= "</tbody>\n";
    $return .= "<tbody>\n";
    $return .= "<tr>\n";
    $return .= "<td>" . $contents['size'] . ":</td>\n";
    $return .= "<td><sup class=\"required\">&lowast;</sup></td>\n";
    $return .= "<td>" . $contents['width'][0] . ": <input name=\"" . $contents['width'][1] . "\" id=\"" . $contents['width'][1] . "\" type=\"text\" value=\"" . $contents['width'][2] . "\" style=\"width:50px\" maxlength=\"" . $contents['width'][3] . "\" />\n";
    $return .= " " . $contents['height'][0] . ": <input name=\"" . $contents['height'][1] . "\" id=\"" . $contents['height'][1] . "\" type=\"text\" value=\"" . $contents['height'][2] . "\" style=\"width:50px\" maxlength=\"" . $contents['height'][3] . "\" /></td>\n";
    $return .= "</tr>\n";
    $return .= "</tbody>\n";
    $return .= "<tbody class=\"second\">\n";
    $return .= "<tr>\n";
    $return .= "<td>" . $contents['blang'][0] . ":</td>\n";
    $return .= "<td></td>\n";
    $return .= "<td><select name=\"" . $contents['blang'][1] . "\" id=\"" . $contents['blang'][1] . "\">un";
    $return .= "<option value=\"\">" . $contents['blang'][2] . "</option>\n";
    foreach ($contents['blang'][3] as $key => $blang) {
        $return .= "<option value=\"" . $key . "\"" . ($key == $contents['blang'][4] ? " selected=\"selected\"" : "") . ">" . $blang['name'] . "</option>\n";
    }
    $return .= "</select></td>\n";
    $return .= "</tr>\n";
    $return .= "</tbody>\n";
    $return .= "<tbody>\n";
    $return .= "<tr>\n";
    $return .= "<td>" . $contents['form'][0] . ":</td>\n";
    $return .= "<td></td>\n";
    $return .= "<td><select name=\"" . $contents['form'][1] . "\" id=\"" . $contents['form'][1] . "\">un";
    foreach ($contents['form'][2] as $form) {
        $return .= "<option value=\"" . $form . "\"" . ($form == $contents['form'][3] ? " selected=\"selected\"" : "") . ">" . $form . "</option>\n";
    }
    $return .= "</select></td>\n";
    $return .= "</tr>\n";
    $return .= "</tbody>\n";
    $return .= "<tbody class=\"second\">\n";
    $return .= "<tr>\n";
    $return .= "<td colspan=\"3\">" . $contents['description'][0] . ":</td>\n";
    $return .= "</tr>\n";
    $return .= "</tbody>\n";
    $return .= "</table>\n";
    $return .= "<div>\n";
    if ($contents['description'][5] and function_exists('nv_aleditor')) {
        $return .= nv_aleditor($contents['description'][1], $contents['description'][3], $contents['description'][4], $contents['description'][2]);
    } else {
        $return .= "<textarea name=\"" . $contents['description'][1] . "\" id=\"" . $contents['description'][1] . "\" style=\"width:" . $contents['description'][3] . ";height:" . $contents['description'][4] . "\">" . $contents['description'][2] . "</textarea>\n";
    }
    $return .= "</div>\n";
    $return .= "<div style=\"PADDING-TOP:10px;\">\n";
    $return .= "<input type=\"submit\" value=\"" . $contents['submit'] . "\" />\n";
    $return .= "</div>\n";
    $return .= "</div>\n";
    $return .= "</form>\n";
    return $return;
}