コード例 #1
0
ファイル: view.php プロジェクト: mistgrass/geeklog-ivywe
function fncview($uid, $template)
{
    $pi_name = "userbox";
    global $_CONF;
    global $LANG_USERBOX_ADMIN;
    //template フォルダ
    $tmplfld = DATABOX_templatePath('admin', 'default', $pi_name);
    $tmpl = new Template($tmplfld);
    $tmpl->set_file(array('view' => 'view.thtml'));
    //--
    $tmpl->set_var('site_admin_url', $_CONF['site_admin_url']);
    if ($template === "") {
        $tmpl->set_var('about_thispage', $LANG_USERBOX_ADMIN['about_admin_view']);
    } else {
        $tmpl->set_var('about_thispage', "");
    }
    $tmpl->parse('output', 'view');
    $view = $tmpl->finish($tmpl->get_var('output'));
    $information = array();
    $retval = userbox_profile($uid, $template, "", "view");
    $layout = $retval['layout'];
    $information['headercode'] = $retval['headercode'];
    $information['pagetitle'] = $retval['title'];
    $display = $view;
    $display .= $retval['display'];
    $display = DATABOX_displaypage($pi_name, $layout, $display, $information);
    COM_output($display);
}
コード例 #2
0
function fncDisply($pi_name)
{
    global $_CONF;
    global $LANG_DATABOX_ADMIN;
    $tmplfld = DATABOX_templatePath('admin', 'default', $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file(array('list' => 'backuprestore.thtml'));
    $templates->set_var('about_thispage', $LANG_DATABOX_ADMIN['about_admin_backuprestore']);
    $templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $token = SEC_createToken();
    $retval .= SEC_getTokenExpiryNotice($token);
    $templates->set_var('gltoken_name', CSRF_TOKEN);
    $templates->set_var('gltoken', $token);
    $templates->set_var('xhtml', XHTML);
    $templates->set_var('script', THIS_SCRIPT);
    $templates->set_var('config', $LANG_DATABOX_ADMIN['config']);
    $templates->set_var('config_backup', $LANG_DATABOX_ADMIN['config_backup']);
    $templates->set_var('config_init', $LANG_DATABOX_ADMIN['config_init']);
    $templates->set_var('config_restore', $LANG_DATABOX_ADMIN['config_restore']);
    $templates->set_var('config_update', $LANG_DATABOX_ADMIN['config_update']);
    $templates->set_var('config_backup_help', $LANG_DATABOX_ADMIN['config_backup_help']);
    $templates->set_var('config_init_help', $LANG_DATABOX_ADMIN['config_init_help']);
    $templates->set_var('config_restore_help', $LANG_DATABOX_ADMIN['config_restore_help']);
    $templates->set_var('config_update_help', $LANG_DATABOX_ADMIN['config_update_help']);
    $templates->set_var('datamaster', $LANG_DATABOX_ADMIN['datamaster']);
    $templates->set_var('data_clear', $LANG_DATABOX_ADMIN['data_clear']);
    $templates->set_var('data_allclear', $LANG_DATABOX_ADMIN['data_allclear']);
    $templates->set_var('data_backup', $LANG_DATABOX_ADMIN['data_backup']);
    $templates->set_var('data_restore', $LANG_DATABOX_ADMIN['data_restore']);
    $err_backup_file = "";
    if (file_exists($_CONF["path_data"] . "databoxconfig_bak.php")) {
        $templates->set_var('restore_disable', "");
        if (is_writable($_CONF["path_data"] . "databoxconfig_bak.php")) {
        } else {
            $err_backup_file = $LANG_DATABOX_ADMIN['err_backup_file_non_writable'];
        }
    } else {
        $templates->set_var('restore_disabled', "disabled");
        $err_backup_file = $LANG_DATABOX_ADMIN['err_backup_file_not_exist'];
    }
    $templates->set_var('err_backup_file', $err_backup_file);
    $templates->parse('output', 'list');
    $content = $templates->finish($templates->get_var('output'));
    $retval .= $content;
    return $retval;
}
コード例 #3
0
function fncDisplay()
{
    global $_CONF;
    global $LANG_ADMIN;
    global $LANG_DATABOX_ADMIN;
    global $LANG_DATABOX_INFORMATION_HELP;
    global $_DATABOX_CONF;
    $retval = "";
    $pi_name = "databox";
    $menu_arr[] = array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']);
    $function = "plugin_geticon_" . $pi_name;
    $icon = $function();
    $retval .= ADMIN_createMenu($menu_arr, $LANG_DATABOX_ADMIN['about_admin_information'], $icon);
    $tmplfld = DATABOX_templatePath('admin', 'default', $pi_name);
    $T = new Template($tmplfld);
    $lang = COM_getLanguageName();
    $path = 'admin/plugins/databox/docs/';
    if (!file_exists($_CONF['path_html'] . $path . $lang . '/')) {
        $lang = 'japanese';
        //'english';
    }
    $document_url = $_CONF['site_url'] . '/' . $path . $lang . '/';
    $T->set_file('admin', 'information.thtml');
    $T->set_var('pi_name', $pi_name);
    $T->set_var('version', $_DATABOX_CONF['version']);
    $T->set_var('piname', $LANG_DATABOX_ADMIN['piname']);
    $T->set_var('lang_document', $LANG_DATABOX_ADMIN['document']);
    $T->set_var('document_url', $document_url);
    $T->set_var('online', $LANG_DATABOX_ADMIN['online']);
    $T->set_var('lang_configuration', $LANG_DATABOX_ADMIN['configuration']);
    $T->set_var('lang_autotags', $LANG_DATABOX_ADMIN['autotags']);
    $T->set_var('lang_templatesetvars', $LANG_DATABOX_ADMIN['templatesetvars']);
    $T->set_var('lang_install', $LANG_DATABOX_ADMIN['install']);
    $T->set_var('lang_autotags', $LANG_DATABOX_ADMIN['autotags']);
    $T->set_var('lang_files', $LANG_DATABOX_ADMIN['files']);
    $T->set_var('lang_tables', $LANG_DATABOX_ADMIN['tables']);
    $T->set_var('lang_input', $LANG_DATABOX_ADMIN['input']);
    $T->set_var('site_url', $_CONF['site_url']);
    $T->set_var('site_admin_url', $_CONF['site_admin_url']);
    $T->parse('output', 'admin');
    $retval .= $T->finish($T->get_var('output'));
    return $retval;
}
コード例 #4
0
ファイル: view.php プロジェクト: mistgrass/geeklog-ivywe
function fncview($pi_name, $id)
{
    global $_CONF;
    global $LANG_USERBOX_ADMIN;
    //template フォルダ
    $tmplfld = DATABOX_templatePath('mydata', 'default', $pi_name);
    $tmpl = new Template($tmplfld);
    $tmpl->set_file(array('view' => 'view.thtml'));
    //--
    //$tmpl->set_var('site_admin_url', $_CONF['site_admin_url']);
    $tmpl->set_var('about_thispage', $LANG_USERBOX_ADMIN['about_admin_view']);
    $tmpl->parse('output', 'view');
    $view = $tmpl->finish($tmpl->get_var('output'));
    $retval = "";
    $retval .= $view;
    $ret = databox_data($id, "", "", "view");
    $retval .= $ret['display'];
    return $retval;
}
コード例 #5
0
ファイル: lib_group.php プロジェクト: mistgrass/geeklog-ivywe
function LIB_Edit($pi_name, $id, $edt_flg, $msg = '', $errmsg = "", $mode = "edit")
{
    global $_CONF;
    global $_TABLES;
    global $LANG_ADMIN;
    global $MESSAGE;
    global $LANG_ACCESS;
    global $_USER;
    $lang_box_admin = "LANG_" . strtoupper($pi_name) . "_ADMIN";
    global ${$lang_box_admin};
    $lang_box_admin = ${$lang_box_admin};
    $lang_box = "LANG_" . strtoupper($pi_name);
    global ${$lang_box};
    $lang_box = ${$lang_box};
    $lang_box_noyes = "LANG_" . strtoupper($pi_name) . "_NOYES";
    global ${$lang_box_noyes};
    $lang_box_noyes = ${$lang_box_noyes};
    $lang_box_inputtype = "LANG_" . strtoupper($pi_name) . "_INPUTTYPE";
    global ${$lang_box_inputtype};
    $lang_box_inputtype = ${$lang_box_inputtype};
    $table = $_TABLES[strtoupper($pi_name) . '_def_group'];
    $table1 = $_TABLES[strtoupper($pi_name) . '_def_category'];
    $table2 = $_TABLES[strtoupper($pi_name) . '_def_field'];
    //        $cur_year = date( 'Y' );
    //        $year_startoffset=1990 - $cur_year +1;
    //        $year_endoffset=0;
    $retval = '';
    $delflg = false;
    //メッセージ表示
    if (!empty($msg)) {
        $retval .= COM_showMessage($msg, $pi_name);
        $retval .= $errmsg;
        // clean 'em up
        $code = COM_applyFilter($_POST['code']);
        $name = COM_applyFilter($_POST['name']);
        $description = $_POST['description'];
        //COM_applyFilter($_POST['description']);
        $orderno = COM_applyFilter($_POST['orderno']);
        $parent_flg = COM_applyFilter($_POST['parent_flg'], true);
        $input_type = COM_applyFilter($_POST['input_type'], true);
        $uuid = $_USER['uid'];
    } else {
        if (empty($id)) {
            $id = 0;
            $code = "";
            $name = "";
            $description = "";
            $orderno = "";
            $parent_flg = 0;
            $uuid = 0;
            $udatetime = "";
            //"";
        } else {
            $sql = "SELECT ";
            $sql .= " *";
            $sql .= " ,UNIX_TIMESTAMP(udatetime) AS udatetime_un" . LB;
            $sql .= " FROM ";
            $sql .= $table;
            $sql .= " WHERE ";
            $sql .= " group_id = {$id}";
            $result = DB_query($sql);
            $A = DB_fetchArray($result);
            $code = COM_stripslashes($A['code']);
            $name = COM_stripslashes($A['name']);
            $description = COM_stripslashes($A['description']);
            $orderno = COM_stripslashes($A['orderno']);
            $parent_flg = COM_stripslashes($A['parent_flg']);
            $input_type = COM_stripslashes($A['input_type']);
            $uuid = COM_stripslashes($A['uuid']);
            $wary = COM_getUserDateTimeFormat(COM_stripslashes($A['udatetime_un']));
            $udatetime = $wary[0];
            if ($edt_flg == FALSE) {
                $delflg = true;
            }
        }
    }
    if ($mode === "copy") {
        $id = 0;
        //作成日付
        $created = 0;
        $created_month = 0;
        $created_day = 0;
        $created_year = 0;
        $created_hour = 0;
        $created_minute = 0;
        //
        $delflg = false;
    }
    $retval .= COM_startBlock($lang_box_admin['edit'], '', COM_getBlockTemplate('_admin_block', 'header'));
    $tmplfld = DATABOX_templatePath('admin', 'default', $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file('editor', "group_editor.thtml");
    //--
    $templates->set_var('about_thispage', $lang_box_admin['about_admin_group']);
    $templates->set_var('lang_must', $lang_box_admin['must']);
    $templates->set_var('site_url', $_CONF['site_url']);
    $templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $token = SEC_createToken();
    $retval .= SEC_getTokenExpiryNotice($token);
    $templates->set_var('gltoken_name', CSRF_TOKEN);
    $templates->set_var('gltoken', $token);
    $templates->set_var('xhtml', XHTML);
    $templates->set_var('script', THIS_SCRIPT);
    //
    $templates->set_var('lang_link_admin', $lang_box_admin['link_admin']);
    $templates->set_var('lang_link_admin_top', $lang_box_admin['link_admin_top']);
    //id
    $templates->set_var('lang_group_id', $lang_box_admin['group_id']);
    $templates->set_var('id', $id);
    //コード、名前&説明
    $templates->set_var('lang_code', $lang_box_admin['code']);
    $templates->set_var('code', $code);
    $templates->set_var('lang_name', $lang_box_admin['name']);
    $templates->set_var('name', $name);
    $templates->set_var('lang_description', $lang_box_admin['description']);
    $templates->set_var('description', $description);
    //順番
    $templates->set_var('lang_orderno', $lang_box_admin['orderno']);
    $templates->set_var('orderno', $orderno);
    //親ブループ?
    $templates->set_var('lang_parent_flg', $lang_box_admin['parent_flg']);
    $list_parent_flg = DATABOX_getradiolist($lang_box_noyes, "parent_flg", $parent_flg);
    $templates->set_var('list_parent_flg', $list_parent_flg);
    //入力タイプ
    $templates->set_var('lang_input_type', $lang_box_admin['input_type']);
    $list_input_type = DATABOX_getradiolist($lang_box_inputtype, "input_type", $input_type);
    $templates->set_var('list_input_type', $list_input_type);
    //保存日時
    $templates->set_var('lang_udatetime', $lang_box_admin['udatetime']);
    $templates->set_var('udatetime', $udatetime);
    $templates->set_var('lang_uuid', $lang_box_admin['uuid']);
    $templates->set_var('uuid', $uuid);
    // SAVE、CANCEL ボタン
    $templates->set_var('lang_save', $LANG_ADMIN['save']);
    $templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $templates->set_var('lang_preview', $LANG_ADMIN['preview']);
    //delete_option
    if ($delflg) {
        $wkcnt = DB_count($table1, "categorygroup_id", $id);
        if ($wkcnt > 0) {
            $templates->set_var('lang_delete_help', $lang_box_admin['delete_help_group']);
        } else {
            $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s>';
            $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
            $templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        }
    }
    //
    $templates->parse('output', 'editor');
    $retval .= $templates->finish($templates->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
コード例 #6
0
ファイル: profile.php プロジェクト: mistgrass/geeklog-ivywe
function fncChangeSet()
{
    global $_CONF;
    global $LANG_USERBOX_ADMIN;
    global $LANG_ADMIN;
    global $_TABLES;
    $pi_name = "userbox";
    $retval = '';
    $id = COM_applyFilter($_REQUEST['id'], true);
    //-----
    if ($id == 0) {
        $actionname = $LANG_USERBOX_ADMIN['registset'];
    } else {
        $actionname = $LANG_USERBOX_ADMIN["changeset"];
    }
    $tmplfld = DATABOX_templatePath('admin', 'default', $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file('editor', "changeset.thtml");
    $templates->set_var('site_url', $_CONF['site_url']);
    $templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $token = SEC_createToken();
    $retval .= SEC_getTokenExpiryNotice($token);
    $templates->set_var('gltoken_name', CSRF_TOKEN);
    $templates->set_var('gltoken', $token);
    $templates->set_var('xhtml', XHTML);
    $templates->set_var('script', THIS_SCRIPT);
    $templates->set_var('actionname', $actionname);
    $templates->set_var('id', $id);
    if ($id == 0) {
        $inst = $LANG_USERBOX_ADMIN['inst_changeset0'];
        $templates->set_var('lang_changeset', $LANG_USERBOX_ADMIN['registset']);
    } else {
        $inst = DB_getItem($_TABLES['users'], "username", "uid=" . $id);
        //@@@@@@
        $inst .= $LANG_USERBOX_ADMIN['inst_changesetx'];
        $templates->set_var('lang_changeset', $LANG_USERBOX_ADMIN['changeset']);
    }
    $inst .= $LANG_USERBOX_ADMIN['inst_changeset'];
    $templates->set_var('lang_inst_changeset', $inst);
    //fieldset_id
    $fieldset_id = 0;
    $templates->set_var('lang_fieldset', $LANG_USERBOX_ADMIN['fieldset']);
    $list_fieldset = DATABOX_getoptionlist("fieldset", $fieldset_id, 0, $pi_name, "", 0);
    $templates->set_var('list_fieldset', $list_fieldset);
    $templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $templates->parse('output', 'editor');
    $retval .= $templates->finish($templates->get_var('output'));
    return $retval;
}
コード例 #7
0
ファイル: lib_field.php プロジェクト: mistgrass/geeklog-ivywe
function LIB_Edit($pi_name, $id, $edt_flg, $msg = '', $errmsg = "", $mode = "edit")
{
    global $_CONF;
    global $_TABLES;
    global $LANG_ADMIN;
    global $MESSAGE;
    global $LANG_ACCESS;
    global $_USER;
    $box_conf = "_" . strtoupper($pi_name) . "_CONF";
    global ${$box_conf};
    $box_conf = ${$box_conf};
    $lang_box_admin = "LANG_" . strtoupper($pi_name) . "_ADMIN";
    global ${$lang_box_admin};
    $lang_box_admin = ${$lang_box_admin};
    $lang_box = "LANG_" . strtoupper($pi_name);
    global ${$lang_box};
    $lang_box = ${$lang_box};
    $lang_box_noyes = "LANG_" . strtoupper($pi_name) . "_NOYES";
    global ${$lang_box_noyes};
    $lang_box_noyes = ${$lang_box_noyes};
    $lang_box_type = "LANG_" . strtoupper($pi_name) . "_TYPE";
    global ${$lang_box_type};
    $lang_box_type = ${$lang_box_type};
    $lang_box_allow_display = "LANG_" . strtoupper($pi_name) . "_ALLOW_DISPLAY";
    global ${$lang_box_allow_display};
    $lang_box_allow_display = ${$lang_box_allow_display};
    $lang_box_allow_edit = "LANG_" . strtoupper($pi_name) . "_ALLOW_EDIT";
    global ${$lang_box_allow_edit};
    $lang_box_allow_edit = ${$lang_box_allow_edit};
    $lang_box_textcheck = "LANG_" . strtoupper($pi_name) . "_TEXTCHECK";
    global ${$lang_box_textcheck};
    $lang_box_textcheck = ${$lang_box_textcheck};
    $lang_box_textconv = "LANG_" . strtoupper($pi_name) . "_TEXTCONV";
    global ${$lang_box_textconv};
    $lang_box_textconv = ${$lang_box_textconv};
    $table = $_TABLES[strtoupper($pi_name) . '_def_field'];
    //        $cur_year = date( 'Y' );
    //        $year_startoffset=1990 - $cur_year +1;
    //        $year_endoffset=0;
    $retval = '';
    $delflg = false;
    //メッセージ表示
    if (!empty($msg)) {
        $retval .= COM_showMessage($msg, $pi_name);
        $retval .= $errmsg;
        // clean 'em up
        $name = COM_applyFilter($_POST['name']);
        $templatesetvar = COM_applyFilter($_POST['templatesetvar']);
        $type = COM_applyFilter($_POST['type']);
        $description = COM_applyFilter($_POST['description']);
        $allow_display = COM_applyFilter($_POST['allow_display'], true);
        $allow_edit = COM_applyFilter($_POST['allow_edit'], true);
        $textcheck = COM_applyFilter($_POST['textcheck'], true);
        $textconv = COM_applyFilter($_POST['textconv'], true);
        $searchtarget = COM_applyFilter($_POST['searchtarget'], true);
        $initial_value = COM_applyFilter($_POST['initial_value']);
        $range_start = COM_applyFilter($_POST['range_start']);
        $range_end = COM_applyFilter($_POST['range_end']);
        $dfid = COM_applyFilter($_POST['dfid'], true);
        $selection = COM_applyFilter($_POST['selection']);
        $selectlist = COM_applyFilter($_POST['selectlist']);
        $checkrequried = COM_applyFilter($_POST['checkrequried']);
        $size = COM_applyFilter($_POST['size'], true);
        $maxlength = COM_applyFilter($_POST['maxlength'], true);
        $rows = COM_applyFilter($_POST['rows'], true);
        $br = COM_applyFilter($_POST['br'], true);
        $orderno = COM_applyFilter($_POST['orderno']);
        $uuid = $_USER['uid'];
    } else {
        if (empty($id)) {
            $id = 0;
            $name = "";
            $templatesetvar = "";
            $description = "";
            $allow_display = "";
            $allow_edit = "";
            $textcheck = "";
            $textconv = "";
            $searchtarget = "";
            $initial_value = "";
            $range_start = "";
            $range_end = "";
            $dfid = 0;
            $type = "";
            $selection = "";
            $selectlist = "";
            $checkrequried = "";
            $size = 60;
            $maxlength = 500;
            $rows = 3;
            $br = 0;
            $orderno = "";
            $uuid = 0;
            $udatetime = "";
            //"";
        } else {
            $sql = "SELECT ";
            $sql .= " *";
            $sql .= " ,UNIX_TIMESTAMP(udatetime) AS udatetime_un" . LB;
            $sql .= " FROM ";
            $sql .= $table;
            $sql .= " WHERE ";
            $sql .= " field_id = {$id}";
            $result = DB_query($sql);
            $A = DB_fetchArray($result);
            $name = COM_stripslashes($A['name']);
            $templatesetvar = COM_stripslashes($A['templatesetvar']);
            $description = $A['description'];
            //COM_stripslashes($A['description']);
            $allow_edit = COM_stripslashes($A['allow_edit']);
            $allow_display = COM_stripslashes($A['allow_display']);
            $textcheck = COM_stripslashes($A['textcheck']);
            $textconv = COM_stripslashes($A['textconv']);
            $searchtarget = COM_stripslashes($A['searchtarget']);
            $initial_value = COM_stripslashes($A['initial_value']);
            $range_start = COM_stripslashes($A['range_start']);
            $range_end = COM_stripslashes($A['range_end']);
            $dfid = COM_stripslashes($A['dfid']);
            $type = COM_stripslashes($A['type']);
            $selection = COM_stripslashes($A['selection']);
            $selectlist = COM_stripslashes($A['selectlist']);
            $checkrequried = COM_stripslashes($A['checkrequried']);
            $size = COM_stripslashes($A['size']);
            $maxlength = COM_stripslashes($A['maxlength']);
            $rows = COM_stripslashes($A['rows']);
            $br = COM_stripslashes($A['br']);
            $orderno = COM_stripslashes($A['orderno']);
            $uuid = COM_stripslashes($A['uuid']);
            $wary = COM_getUserDateTimeFormat(COM_stripslashes($A['udatetime_un']));
            $udatetime = $wary[0];
            if ($edt_flg == FALSE) {
                $delflg = true;
            }
        }
    }
    if ($mode === "copy") {
        $id = 0;
        //作成日付
        $created = 0;
        //
        $delflg = false;
    }
    $tmplfld = DATABOX_templatePath('admin', 'default', $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file('editor', "field_editor.thtml");
    //--
    $templates->set_var('about_thispage', $lang_box_admin['about_admin_field']);
    $templates->set_var('lang_must', $lang_box_admin['must']);
    $templates->set_var('site_url', $_CONF['site_url']);
    $templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $token = SEC_createToken();
    $retval .= SEC_getTokenExpiryNotice($token);
    $templates->set_var('gltoken_name', CSRF_TOKEN);
    $templates->set_var('gltoken', $token);
    $templates->set_var('xhtml', XHTML);
    $templates->set_var('script', THIS_SCRIPT);
    //
    $templates->set_var('lang_link_admin', $lang_box_admin['link_admin']);
    $templates->set_var('lang_link_admin_top', $lang_box_admin['link_admin_top']);
    //id
    $templates->set_var('lang_field_id', $lang_box_admin['field_id']);
    $templates->set_var('id', $id);
    //document link
    $lang = COM_getLanguageName();
    $path = 'admin/plugins/' . strtolower($pi_name) . '/docs/';
    if (!file_exists($_CONF['path_html'] . $path . $lang . '/')) {
        $lang = 'japanese';
        //'english';
    }
    $document_url = $_CONF['site_url'] . '/' . $path . $lang . '/';
    $templates->set_var('document_url', $document_url);
    $templates->set_var('lang_document', $LANG_DATABOX_ADMIN['document']);
    //名前&テンプレート変数&説明
    $templates->set_var('lang_name', $lang_box_admin['name']);
    $templates->set_var('name', $name);
    $templates->set_var('lang_templatesetvar', $lang_box_admin['templatesetvar']);
    $templates->set_var('templatesetvar', $templatesetvar);
    $templates->set_var('lang_description', $lang_box_admin['description']);
    $templates->set_var('description', $description);
    $templates->set_var('lang_allow_display', $lang_box_admin['allow_display']);
    $list_allow_display = DATABOX_getoptionlistary($lang_box_allow_display, "allow_display", $allow_display, $pi_name);
    $templates->set_var('list_allow_display', $list_allow_display);
    $templates->set_var('lang_allow_edit', $lang_box_admin['allow_edit']);
    $list_allow_edit = DATABOX_getoptionlistary($lang_box_allow_edit, "allow_edit", $allow_edit, $pi_name);
    $templates->set_var('list_allow_edit', $list_allow_edit);
    //textcheck
    $templates->set_var('lang_textcheck', $lang_box_admin['textcheck']);
    $list_textcheck = DATABOX_getoptionlistary($lang_box_textcheck, "textcheck", $textcheck, $pi_name);
    $templates->set_var('list_textcheck', $list_textcheck);
    //textconv
    $templates->set_var('lang_textconv', $lang_box_admin['textconv']);
    $list_textconv = DATABOX_getoptionlistary($lang_box_textconv, "textconv", $textconv, $pi_name);
    $templates->set_var('list_textconv', $list_textconv);
    //searchtarget
    $templates->set_var('lang_searchtarget', $lang_box_admin['searchtarget']);
    $list_searchtarget = DATABOX_getradiolist($lang_box_noyes, "searchtarget", $searchtarget);
    $templates->set_var('list_searchtarget', $list_searchtarget);
    //初期値 範囲 日時フォーマット initial value range dfid
    $templates->set_var('lang_initial_value', $lang_box_admin['initial_value']);
    $templates->set_var('help_initial_value', $lang_box_admin['help_initial_value']);
    $templates->set_var('initial_value', $initial_value);
    $templates->set_var('lang_range', $lang_box_admin['range']);
    $templates->set_var('help_range', $lang_box_admin['help_range']);
    $templates->set_var('range_start', $range_start);
    $templates->set_var('range_end', $range_end);
    $templates->set_var('lang_dfid', $lang_box_admin['dfid']);
    $templates->set_var('help_dfid', $lang_box_admin['help_dfid']);
    //$list_dfid=DATABOX_getoptionlistary ($lang_box_textcheck,"textcheck",$textcheck,$pi_name);
    $list_dfid = '<select id="dfid" name="dfid">' . LB . COM_optionList($_TABLES['dateformats'], 'dfid,description', $dfid) . '</select>';
    $templates->set_var('list_dfid', $list_dfid);
    //type
    $templates->set_var('lang_type', $lang_box_admin['type']);
    $list_type = DATABOX_getoptionlistary($lang_box_type, "type", $type, $pi_name);
    $templates->set_var('list_type', $list_type);
    //checkrequried
    $templates->set_var('lang_checkrequried', $lang_box_admin['checkrequried']);
    $list_checkrequried = DATABOX_getradiolist($lang_box_noyes, "checkrequried", $checkrequried);
    $templates->set_var('list_checkrequried', $list_checkrequried);
    //size maxlength rows br
    $templates->set_var('lang_size', $lang_box_admin['size']);
    $templates->set_var('size', $size);
    $templates->set_var('lang_maxlength', $lang_box_admin['maxlength']);
    $templates->set_var('maxlength', $maxlength);
    $templates->set_var('lang_rows', $lang_box_admin['rows']);
    $templates->set_var('rows', $rows);
    $templates->set_var('lang_br', $lang_box_admin['br']);
    $templates->set_var('help_br', $lang_box_admin['help_br']);
    $templates->set_var('br', $br);
    //selection
    $templates->set_var('lang_selection', $lang_box_admin['selection']);
    $templates->set_var('selection', $selection);
    //selectlist
    $templates->set_var('lang_selectlist', $lang_box_admin['selectlist']);
    $list_selectlist = DATABOX_getoptionlist("selectlist", $selectlist, 0, $pi_name);
    $templates->set_var('list_selectlist', $list_selectlist);
    //順序
    $templates->set_var('lang_orderno', $lang_box_admin['orderno']);
    $templates->set_var('orderno', $orderno);
    //保存日時
    $templates->set_var('lang_udatetime', $lang_box_admin['udatetime']);
    $templates->set_var('udatetime', $udatetime);
    $templates->set_var('lang_uuid', $lang_box_admin['uuid']);
    $templates->set_var('uuid', $uuid);
    // SAVE、CANCEL ボタン
    $templates->set_var('lang_save', $LANG_ADMIN['save']);
    $templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $templates->set_var('lang_preview', $LANG_ADMIN['preview']);
    //delete_option
    if ($delflg) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        //
        $templates->set_var('lang_delete_help', $lang_box_admin['delete_help_field']);
    }
    //
    $templates->parse('output', 'editor');
    $retval .= $templates->finish($templates->get_var('output'));
    return $retval;
}
コード例 #8
0
ファイル: lib_field.php プロジェクト: mistgrass/geeklog-ivywe
function LIB_Edit($pi_name, $id, $edt_flg, $msg = '', $errmsg = "", $mode = "edit")
{
    global $_CONF;
    global $_TABLES;
    global $LANG_ADMIN;
    global $MESSAGE;
    global $LANG_ACCESS;
    global $_USER;
    $box_conf = "_" . strtoupper($pi_name) . "_CONF";
    global ${$box_conf};
    $box_conf = ${$box_conf};
    $lang_box_admin = "LANG_" . strtoupper($pi_name) . "_ADMIN";
    global ${$lang_box_admin};
    $lang_box_admin = ${$lang_box_admin};
    $lang_box = "LANG_" . strtoupper($pi_name);
    global ${$lang_box};
    $lang_box = ${$lang_box};
    $lang_box_noyes = "LANG_" . strtoupper($pi_name) . "_NOYES";
    global ${$lang_box_noyes};
    $lang_box_noyes = ${$lang_box_noyes};
    $lang_box_type = "LANG_" . strtoupper($pi_name) . "_TYPE";
    global ${$lang_box_type};
    $lang_box_type = ${$lang_box_type};
    $lang_box_allow_display = "LANG_" . strtoupper($pi_name) . "_ALLOW_DISPLAY";
    global ${$lang_box_allow_display};
    $lang_box_allow_display = ${$lang_box_allow_display};
    $lang_box_allow_edit = "LANG_" . strtoupper($pi_name) . "_ALLOW_EDIT";
    global ${$lang_box_allow_edit};
    $lang_box_allow_edit = ${$lang_box_allow_edit};
    $table = $_TABLES[strtoupper($pi_name) . '_def_field'];
    //        $cur_year = date( 'Y' );
    //        $year_startoffset=1990 - $cur_year +1;
    //        $year_endoffset=0;
    $retval = '';
    $delflg = false;
    //メッセージ表示
    if (!empty($msg)) {
        $retval .= COM_showMessage($msg, $pi_name);
        $retval .= $errmsg;
        // clean 'em up
        $name = COM_applyFilter($_POST['name']);
        $templatesetvar = COM_applyFilter($_POST['templatesetvar']);
        $fieldgroup_id = COM_applyFilter($_POST['group'], true);
        $type = COM_applyFilter($_POST['type']);
        $description = COM_applyFilter($_POST['description']);
        $allow_display = COM_applyFilter($_POST['allow_display'], true);
        $allow_edit = COM_applyFilter($_POST['allow_edit'], true);
        $selection = COM_applyFilter($_POST['selection']);
        $selectlist = COM_applyFilter($_POST['selectlist']);
        $checkrequried = COM_applyFilter($_POST['checkrequried']);
        $size = COM_applyFilter($_POST['size'], true);
        $maxlength = COM_applyFilter($_POST['maxlength'], true);
        $rows = COM_applyFilter($_POST['rows'], true);
        $orderno = COM_applyFilter($_POST['orderno']);
        $uuid = $_USER['uid'];
    } else {
        if (empty($id)) {
            $id = 0;
            $name = "";
            $templatesetvar = "";
            $description = "";
            $allow_display = "";
            $allow_edit = "";
            $type = "";
            $selection = "";
            $selectlist = "";
            $checkrequried = "";
            $size = 60;
            $maxlength = 160;
            $rows = 2;
            $br = 0;
            $fieldgroup_id = "";
            $orderno = "";
            $uuid = 0;
            $udatetime = "";
            //"";
        } else {
            $sql = "SELECT ";
            $sql .= " *";
            $sql .= " FROM ";
            $sql .= $table;
            $sql .= " WHERE ";
            $sql .= " field_id = {$id}";
            $result = DB_query($sql);
            $A = DB_fetchArray($result);
            $name = COM_stripslashes($A['name']);
            $templatesetvar = COM_stripslashes($A['templatesetvar']);
            $description = $A['description'];
            //COM_stripslashes($A['description']);
            $allow_edit = COM_stripslashes($A['allow_edit']);
            $allow_display = COM_stripslashes($A['allow_display']);
            $type = COM_stripslashes($A['type']);
            $fieldgroup_id = COM_stripslashes($A['fieldgroup_id']);
            $selection = COM_stripslashes($A['selection']);
            $selectlist = COM_stripslashes($A['selectlist']);
            $checkrequried = COM_stripslashes($A['checkrequried']);
            $br = COM_stripslashes($A['br']);
            $size = COM_stripslashes($A['size']);
            $maxlength = COM_stripslashes($A['maxlength']);
            $rows = COM_stripslashes($A['rows']);
            $br = COM_stripslashes($A['br']);
            $orderno = COM_stripslashes($A['orderno']);
            $uuid = COM_stripslashes($A['uuid']);
            $udatetime = COM_stripslashes($A['udatetime']);
            if ($edt_flg == FALSE) {
                $delflg = true;
            }
        }
    }
    if ($mode === "copy") {
        $id = 0;
        //作成日付
        $created = 0;
        $created_month = 0;
        $created_day = 0;
        $created_year = 0;
        $created_hour = 0;
        $created_minute = 0;
        //
        $delflg = false;
    }
    $retval .= COM_startBlock($lang_box_admin['edit'], '', COM_getBlockTemplate('_admin_block', 'header'));
    $tmplfld = DATABOX_templatePath('admin', 'default', $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file('editor', "field_editor.thtml");
    //--
    $templates->set_var('about_thispage', $lang_box_admin['about_admin_field']);
    $templates->set_var('lang_must', $lang_box_admin['must']);
    $templates->set_var('site_url', $_CONF['site_url']);
    $templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $token = SEC_createToken();
    $retval .= SEC_getTokenExpiryNotice($token);
    $templates->set_var('gltoken_name', CSRF_TOKEN);
    $templates->set_var('gltoken', $token);
    $templates->set_var('xhtml', XHTML);
    $templates->set_var('script', THIS_SCRIPT);
    //
    $templates->set_var('lang_link_admin', $lang_box_admin['link_admin']);
    $templates->set_var('lang_link_admin_top', $lang_box_admin['link_admin_top']);
    //id
    $templates->set_var('lang_field_id', $lang_box_admin['field_id']);
    $templates->set_var('id', $id);
    //名前&テンプレート変数&説明
    $templates->set_var('lang_name', $lang_box_admin['name']);
    $templates->set_var('name', $name);
    $templates->set_var('lang_templatesetvar', $lang_box_admin['templatesetvar']);
    $templates->set_var('templatesetvar', $templatesetvar);
    $templates->set_var('lang_description', $lang_box_admin['description']);
    $templates->set_var('description', $description);
    $templates->set_var('lang_allow_display', $lang_box_admin['allow_display']);
    $list_allow_display = DATABOX_getradiolist($lang_box_allow_display, "allow_display", $allow_display, "<br/>");
    $templates->set_var('list_allow_display', $list_allow_display);
    $templates->set_var('lang_allow_edit', $lang_box_admin['allow_edit']);
    $list_allow_edit = DATABOX_getradiolist($lang_box_allow_edit, "allow_edit", $allow_edit, "<br/>");
    $templates->set_var('list_allow_edit', $list_allow_edit);
    //type
    $templates->set_var('lang_type', $lang_box_admin['type']);
    $list_type = DATABOX_getradiolist($lang_box_type, "type", $type, "<br/>");
    $templates->set_var('list_type', $list_type);
    //checkrequried
    $templates->set_var('lang_checkrequried', $lang_box_admin['checkrequried']);
    $list_checkrequried = DATABOX_getradiolist($lang_box_noyes, "checkrequried", $checkrequried);
    $templates->set_var('list_checkrequried', $list_checkrequried);
    //size maxlength rows br
    $templates->set_var('lang_size', $lang_box_admin['size']);
    $templates->set_var('size', $size);
    $templates->set_var('lang_maxlength', $lang_box_admin['maxlength']);
    $templates->set_var('maxlength', $maxlength);
    $templates->set_var('lang_rows', $lang_box_admin['rows']);
    $templates->set_var('rows', $rows);
    $templates->set_var('lang_br', $lang_box_admin['br']);
    $list_br = DATABOX_getradiolist($lang_box_noyes, "br", $br);
    $templates->set_var('list_br', $list_br);
    //selection
    $templates->set_var('lang_selection', $lang_box_admin['selection']);
    $templates->set_var('selection', $selection);
    //selectlist
    $templates->set_var('lang_selectlist', $lang_box_admin['selectlist']);
    $list_selectlist = DATABOX_getoptionlist("selectlist", $selectlist, 0, $pi_name);
    $templates->set_var('list_selectlist', $list_selectlist);
    //group
    $templates->set_var('lang_group', $lang_box_admin['group']);
    $list_group = DATABOX_getoptionlist("group", $fieldgroup_id, 0, $pi_name, "", 0);
    $templates->set_var('list_group', $list_group);
    //順序
    $templates->set_var('lang_orderno', $lang_box_admin['orderno']);
    $templates->set_var('orderno', $orderno);
    //保存日時
    $templates->set_var('lang_udatetime', $lang_box_admin['udatetime']);
    $templates->set_var('udatetime', $udatetime);
    $templates->set_var('lang_uuid', $lang_box_admin['uuid']);
    $templates->set_var('uuid', $uuid);
    // SAVE、CANCEL ボタン
    $templates->set_var('lang_save', $LANG_ADMIN['save']);
    $templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $templates->set_var('lang_preview', $LANG_ADMIN['preview']);
    //delete_option
    if ($delflg) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        //
        $templates->set_var('lang_delete_help', $lang_box_admin['delete_help_field']);
    }
    //
    $templates->parse('output', 'editor');
    $retval .= $templates->finish($templates->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
コード例 #9
0
ファイル: category.php プロジェクト: mistgrass/geeklog-ivywe
function fnclist($pi_name, $template, $group_id, $perpage, $page, $order, $gcode)
{
    global $_CONF;
    global $_TABLES;
    global $_DATABOX_CONF;
    global $perpage;
    global $LANG_DATABOX;
    global $LANG_DATABOX_ADMIN;
    if ($group_id === "") {
        if ($gcode != "") {
            $group_id = DATABOX_codetoid($gcode, 'DATABOX_def_group', "group_id");
        }
    }
    //-----
    if ($page == 0) {
        $page = 1;
    }
    //-----
    $tbl1 = $_TABLES['DATABOX_category'];
    $tbl2 = $_TABLES['DATABOX_base'];
    $tbl3 = $_TABLES['DATABOX_def_category'];
    $tbl4 = $_TABLES['DATABOX_def_group'];
    //@@@@@
    //-----
    $sql = "SELECT " . LB;
    $sql .= " t1.category_id " . LB;
    $sql .= " ,t3.name " . LB;
    $sql .= " ,t3.code " . LB;
    $sql .= " ,t3.description " . LB;
    $sql .= " ,Count(t1.id) AS count" . LB;
    $sql .= " ,t4.name AS group_name " . LB;
    $sql .= " ,t4.group_id " . LB;
    $sql .= " ,t4.code AS group_code " . LB;
    $sql .= " FROM " . LB;
    $sql .= " {$tbl1} AS t1 " . LB;
    $sql .= " ,{$tbl2} AS t2 " . LB;
    $sql .= " ,{$tbl3} AS t3 " . LB;
    $sql .= " ,{$tbl4} AS t4 " . LB;
    $sql .= " WHERE " . LB;
    $sql .= " t1.id = t2.id " . LB;
    $sql .= " AND t1.category_id = t3.category_id " . LB;
    if ($group_id != "") {
        $sql .= " AND t3.categorygroup_id = " . $group_id . LB;
    }
    $sql .= " AND t3.categorygroup_id = t4.group_id " . LB;
    //管理者の時,下書データも含む
    //if ( SEC_hasRights('databox.admin')) {
    //}else{
    $sql .= " AND t2.draft_flag=0" . LB;
    //}
    //アクセス権のないデータ はのぞく
    $sql .= COM_getPermSql('AND', 0, 2, "t2") . LB;
    //公開日以前のデータはのぞく
    $sql .= " AND (released <= NOW())" . LB;
    //公開終了日を過ぎたデータはのぞく
    $sql .= " AND (expired=0 OR expired > NOW())" . LB;
    $sql .= " GROUP BY " . LB;
    $sql .= " t1.category_id" . LB;
    $sql .= " ORDER BY " . LB;
    $sql .= " t4.orderno,t3.orderno" . LB;
    $result = DB_query($sql);
    $cnt = DB_numRows($result);
    $pages = 0;
    if ($perpage > 0) {
        $pages = ceil($cnt / $perpage);
    }
    //ヘッダ、左ブロック
    if ($page > 1) {
        $page_title = sprintf('%s (%d)', $LANG_DATABOX['category_top'], $page);
    } else {
        $page_title = sprintf('%s ', $LANG_DATABOX['category_top']);
    }
    $headercode = "<title>" . $_CONF['site_name'] . " - " . $page_title . "</title>";
    // Meta Tags
    $headercode .= DATABOX_getheadercode("category", $template, $pi_name, 0, $_CONF['site_name'], $_CONF['meta_description'], $_CONF['smeta_keywords'], $_CONF['meta_description']);
    $retval .= DATABOX_siteHeader($pi_name, '', $page_title, $headercode);
    //
    $tmplfld = DATABOX_templatePath('category', $template, $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file(array('list' => 'list.thtml', 'nav' => 'navigation.thtml', 'row' => 'row.thtml', 'col' => "col.thtml", 'grp' => "grp.thtml", 'pagenav' => 'pagenavigation.thtml'));
    $languageid = COM_getLanguageId();
    $language = COM_getLanguage();
    $templates->set_var('languageid', $languageid);
    $templates->set_var('language', $language);
    if ($languageid != "") {
        $templates->set_var('_languageid', "_" . $languageid);
    } else {
        $templates->set_var('_languageid', "");
    }
    //
    $templates->set_var('site_url', $_CONF['site_url']);
    $templates->set_var('this_script', THIS_SCRIPT);
    $templates->set_var('home', $LANG_DATABOX['home']);
    if ($group_id != "") {
        $group_name = DB_getItem($tbl4, 'name', "group_id = " . $group_id);
        $templates->set_var('lang_category_list_h2', $group_name . $LANG_DATABOX['category_top']);
    } else {
        $templates->set_var('lang_category_list_h2', $LANG_DATABOX['category_top']);
    }
    //page
    $offset = ($page - 1) * $perpage;
    $sql .= " LIMIT {$offset}, {$perpage}";
    $lin1 = $offset + 1;
    $lin2 = $lin1 + $perpage - 1;
    if ($lin2 > $cnt) {
        $lin2 = $cnt;
    }
    $templates->set_var('lang_view', $LANG_DATABOX['view']);
    $templates->set_var('lin', $lin1 . "-" . $lin2);
    $templates->set_var('cnt', $cnt);
    $templates->set_var('lang_name', $LANG_DATABOX_ADMIN['name']);
    $templates->set_var('lang_count', $LANG_DATABOX['count']);
    $result = DB_query($sql);
    $numrows = DB_numRows($result);
    $old_group_name = "";
    if ($numrows > 0) {
        for ($i = 0; $i < $numrows; $i++) {
            $A = DB_fetchArray($result);
            $A = array_map('stripslashes', $A);
            $group_name = COM_applyFilter($A['group_name']);
            $name = COM_applyFilter($A['name']);
            $description = COM_applyFilter($A['description']);
            $url = $_CONF['site_url'] . "/" . THIS_SCRIPT;
            $url .= "?";
            //コード使用の時
            if ($_DATABOX_CONF['categorycode']) {
                $url .= "code=" . $A['code'];
                $url .= "&amp;m=code";
            } else {
                $url .= "id=" . $A['category_id'];
                $url .= "&amp;m=id";
            }
            $url = COM_buildUrl($url);
            $link = COM_createLink($name, $url);
            $templates->set_var('category_link', $link);
            $templates->set_var('category_name', $name);
            $templates->set_var('category_description', $description);
            $templates->set_var('category_url', $url);
            $templates->set_var('count', $A['count']);
            $templates->set_var('category_id', $A['category_id']);
            $templates->set_var('category_code', $A['code']);
            //=====
            if ($old_group_name != $group_name) {
                $url = $_CONF['site_url'] . "/" . THIS_SCRIPT;
                $url .= "?";
                //コード使用の時
                if ($_DATABOX_CONF['groupcode']) {
                    $url .= "gcode=" . $A['group_code'];
                    //@@@@@
                    $url .= "&amp;m=gcode";
                } else {
                    $url .= "gid=" . $A['group_id'];
                    //@@@@@
                    $url .= "&amp;m=gid";
                }
                $url = COM_buildUrl($url);
                $link = COM_createLink($group_name, $url);
                $templates->set_var('group_link', $link);
                $templates->set_var('group_name', $group_name);
                $templates->parse('grp_var', 'grp', true);
                $old_group_name = $group_name;
            }
            $templates->parse('col_var', 'col', true);
            $templates->parse('row_var', 'row', true);
            $templates->set_var('grp_var', '');
            $templates->set_var('col_var', '');
        }
        // Call to plugins to set template variables in the databox
        PLG_templateSetVars('databox', $templates);
        //ページなび
        //$url = $_CONF['site_url']  . '/'.THIS_SCRIPT."?m=".$m;//."?order=$order";
        $url = $_CONF['site_url'] . '/' . THIS_SCRIPT;
        $templates->set_var('page_navigation', COM_printPageNavigation($url, $page, $pages));
        //------------
        $templates->parse('nav_var', 'nav', true);
        $templates->set_var('blockfooter', COM_endBlock());
        $templates->set_var('msg', "");
        $templates->parse('output', 'list');
        $school_content = $templates->finish($templates->get_var('output'));
        $retval .= $school_content;
    } else {
        $templates->set_var('msg', $LANG_DATABOX["nohit"]);
        $templates->parse('output', 'list');
        $content = $templates->finish($templates->get_var('output'));
        $retval .= $content;
    }
    $retval = PLG_replacetags($retval);
    return $retval;
}
コード例 #10
0
ファイル: data.php プロジェクト: mistgrass/geeklog-ivywe
function fncNew($template)
{
    global $_CONF;
    global $LANG_DATABOX_ADMIN;
    global $LANG_ADMIN;
    $pi_name = "databox";
    $retval = '';
    //-----
    $tmplfld = DATABOX_templatePath('mydata', $template, $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file('editor', "selectset.thtml");
    $templates->set_var('site_url', $_CONF['site_url']);
    $templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $token = SEC_createToken();
    $retval .= SEC_getTokenExpiryNotice($token);
    $templates->set_var('gltoken_name', CSRF_TOKEN);
    $templates->set_var('gltoken', $token);
    $templates->set_var('xhtml', XHTML);
    $script = THIS_SCRIPT;
    if ($template != "") {
        $script .= "?template=" . $template;
    }
    $templates->set_var('script', $script);
    //fieldset_id
    $fieldset_id = 0;
    $templates->set_var('lang_fieldset', $LANG_DATABOX_ADMIN['fieldset']);
    $list_fieldset = DATABOX_getoptionlist("fieldset", $fieldset_id, 0, $pi_name, "", 0);
    $templates->set_var('list_fieldset', $list_fieldset);
    $templates->set_var('lang_inst_newdata', $LANG_DATABOX_ADMIN['inst_newdata']);
    $templates->set_var('lang_new', $LANG_DATABOX_ADMIN['new']);
    $templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $templates->parse('output', 'editor');
    $retval .= $templates->finish($templates->get_var('output'));
    return $retval;
}
コード例 #11
0
ファイル: profile.php プロジェクト: mistgrass/geeklog-ivywe
function fncEdit($id, $edt_flg, $msg = '', $errmsg = "", $mode = "edit")
{
    $pi_name = "userbox";
    global $_CONF;
    global $_TABLES;
    global $LANG_ADMIN;
    global $MESSAGE;
    global $LANG_ACCESS;
    global $_USER;
    global $LANG28;
    global $_SCRIPTS;
    global $_USERBOX_CONF;
    global $LANG_USERBOX_ADMIN;
    $retval = '';
    $delflg = false;
    $addition_def = DATABOX_getadditiondef($pi_name);
    //メッセージ表示
    if (!empty($msg)) {
        $retval .= COM_showMessage($msg, $pi_name);
        $retval .= $errmsg;
        // clean 'em up
        $code = COM_applyFilter($_POST['code']);
        $title = COM_applyFilter($_POST['title']);
        $username = COM_applyFilter($_POST['username']);
        //@@@@@
        $fullname = COM_applyFilter($_POST['fullname']);
        //@@@@@
        $page_title = COM_applyFilter($_POST['page_title']);
        $description = $_POST['description'];
        //COM_applyFilter($_POST['description']);
        $draft_flag = COM_applyFilter($_POST['draft_flag'], true);
        $language_id = COM_applyFilter($_POST['language_id']);
        $category = $_POST['category'];
        $additionfields = $_POST['afield'];
        $additionfields_fnm = $_POST['afield_fnm'];
        //@@@@@
        $additionfields_del = $_POST['afield_del'];
        $additionfields_date = array();
        $additionfields_alt = $_POST['afield_alt'];
        $additionfields = DATABOX_cleanaddtiondatas($additionfields, $addition_def, $additionfields_fnm, $additionfields_del, $additionfields_date, $additionfields_alt, false);
        //作成日付
        $created_month = COM_applyFilter($_POST['created_month'], true);
        $created_day = COM_applyFilter($_POST['created_day'], true);
        $created_year = COM_applyFilter($_POST['created_year'], true);
        $created_hour = COM_applyFilter($_POST['created_hour'], true);
        $created_minute = COM_applyFilter($_POST['created_minute'], true);
        $created = COM_applyFilter($_POST['created']);
        $orderno = COM_applyFilter($_POST['orderno']);
        $uuid = $_USER['uid'];
        $udatetime = COM_applyFilter($_POST['udatetime']);
        //"";
        $fieldset_id = COM_applyFilter($_POST['fieldset'], true);
        //"";
        $fieldset_name = COM_applyFilter($_POST['fieldset_name']);
        //"";
    } else {
        $sql = "SELECT ";
        $sql .= " t.*";
        $sql .= " ,t2.name AS fieldset_name" . LB;
        $sql .= " ,UNIX_TIMESTAMP(t.modified) AS modified_un" . LB;
        $sql .= " ,UNIX_TIMESTAMP(t.released) AS released_un" . LB;
        $sql .= " ,UNIX_TIMESTAMP(t.comment_expire) AS comment_expire_un" . LB;
        $sql .= " ,UNIX_TIMESTAMP(t.expired) AS expired_un" . LB;
        $sql .= " ,UNIX_TIMESTAMP(t.udatetime) AS udatetime_un" . LB;
        $sql .= " ,UNIX_TIMESTAMP(t.created) AS created_un" . LB;
        $sql .= " ,t1.username";
        $sql .= " ,t1.fullname";
        $sql .= " ,unix_timestamp(modified) AS modified_u ";
        $sql .= " FROM ";
        $sql .= $_TABLES['USERBOX_base'] . " AS t";
        $sql .= "," . $_TABLES['users'] . " AS t1";
        $sql .= "," . $_TABLES['USERBOX_def_fieldset'] . " AS t2 " . LB;
        $sql .= " WHERE ";
        $sql .= " t.id = {$id}";
        $sql .= " AND t.id = t1.uid";
        $sql .= " AND t.fieldset_id = t2.fieldset_id" . LB;
        $result = DB_query($sql);
        $A = DB_fetchArray($result);
        $fieldset_id = COM_stripslashes($A['fieldset_id']);
        $fieldset_name = COM_stripslashes($A['fieldset_name']);
        $code = COM_stripslashes($A['code']);
        $title = COM_stripslashes($A['title']);
        $username = COM_stripslashes($A['username']);
        //@@@@@
        $fullname = COM_stripslashes($A['fullname']);
        //@@@@@
        $page_title = COM_stripslashes($A['page_title']);
        $description = COM_stripslashes($A['description']);
        $language_id = COM_stripslashes($A['language_id']);
        $owner_id = COM_stripslashes($A['owner_id']);
        $group_id = COM_stripslashes($A['group_id']);
        $perm_owner = COM_stripslashes($A['perm_owner']);
        $perm_group = COM_stripslashes($A['perm_group']);
        $perm_members = COM_stripslashes($A['perm_members']);
        $perm_anon = COM_stripslashes($A['perm_anon']);
        $category = DATABOX_getdatas("category_id", $_TABLES['USERBOX_category'], "id = {$id}");
        //追加項目
        $additionfields = DATABOX_getadditiondatas($id, $pi_name);
        $additionfields_fnm = array();
        //@@@@@
        $additionfields_del = array();
        $additionfields_date = "";
        $draft_flag = COM_stripslashes($A['draft_flag']);
        //編集日
        $wary = COM_getUserDateTimeFormat(COM_stripslashes($A['modified_un']));
        $modified = $wary[1];
        $modified_month = date('m', $modified);
        $modified_day = date('d', $modified);
        $modified_year = date('Y', $modified);
        $modified_hour = date('H', $modified);
        $modified_minute = date('i', $modified);
        //公開日
        $wary = COM_getUserDateTimeFormat(COM_stripslashes($A['released_un']));
        $released = $wary[1];
        $released_month = date('m', $released);
        $released_day = date('d', $released);
        $released_year = date('Y', $released);
        $released_hour = date('H', $released);
        $released_minute = date('i', $released);
        //公開終了日
        $expired = COM_stripslashes($A['expired']);
        if ($expired === "0000-00-00 00:00:00") {
            $expired_flag = 0;
            $w = mktime(0, 0, 0, date('m'), date('d') + $_CONF['article_comment_close_days'], date('Y'));
            $expired_year = date('Y', $w);
            $expired_month = date('m', $w);
            $expired_day = date('d', $w);
            $expired_hour = 0;
            $expired_minute = 0;
        } else {
            $expired_flag = 1;
            $wary = COM_getUserDateTimeFormat(COM_stripslashes($A['expired_un']));
            $expired = $wary[1];
            $expired_year = date('Y', $expired);
            $expired_month = date('m', $expired);
            $expired_day = date('d', $expired);
            $expired_hour = date('H', $expired);
            $expired_minute = date('i', $expired);
        }
        //作成日付
        $wary = COM_getUserDateTimeFormat(COM_stripslashes($A['created_un']));
        $created = $wary[0];
        $created_un = $wary[1];
        $orderno = COM_stripslashes($A['orderno']);
        $uuid = COM_stripslashes($A['uuid']);
        $wary = COM_getUserDateTimeFormat(COM_stripslashes($A['udatetime_un']));
        $udatetime = $wary[0];
        $defaulttemplatesdirectory = $A['defaulttemplatesdirectory'];
        if ($_CONF['allow_account_delete']) {
            if ($edt_flg == FALSE) {
                $delflg = true;
            }
        }
    }
    $chk_user = DATABOX_chkuser($group_id, $owner_id, "userbox.admin");
    //-----
    $retval .= COM_startBlock($LANG_USERBOX_ADMIN['edit'], '', COM_getBlockTemplate('_admin_block', 'header'));
    //template フォルダ
    if (is_null($template) or $template === "") {
        $set_defaulttemplatesdirectory = DB_getItem($_TABLES['USERBOX_def_fieldset'], "defaulttemplatesdirectory", "fieldset_id=" . $fieldset_id);
        if ($defaulttemplatesdirectory != "") {
            $template = $defaulttemplatesdirectory;
        } elseif ($set_defaulttemplatesdirectory != "") {
            $template = $set_defaulttemplatesdirectory;
        } else {
            $template = "default";
        }
    }
    $tmplfld = DATABOX_templatePath('myprofile', 'default', $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file(array('editor' => 'profile_editor.thtml', 'row' => 'row.thtml', 'col' => "profile_col_detail.thtml"));
    // Loads jQuery UI datepicker geeklog >=2.1.0
    $_SCRIPTS->setJavaScriptLibrary('jquery.ui.datepicker');
    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-i18n');
    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon');
    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon-i18n');
    $_SCRIPTS->setJavaScriptFile('datepicker', '/javascript/datepicker.js');
    $_SCRIPTS->setJavaScriptFile('datetimepicker', '/javascript/datetimepicker.js');
    $langCode = COM_getLangIso639Code();
    $toolTip = $MESSAGE[118];
    $imgUrl = $_CONF['site_url'] . '/images/calendar.png';
    //--
    if ($_CONF['meta_tags'] > 0 && $_USERBOX_CONF['meta_tags'] > 0) {
        $templates->set_var('hide_meta', '');
    } else {
        $templates->set_var('hide_meta', ' style="display:none;"');
    }
    $templates->set_var('maxlength_description', $_USERBOX_CONF['maxlength_description']);
    $templates->set_var('about_thispage', $LANG_USERBOX_ADMIN['about_myprofile_profile']);
    $templates->set_var('lang_must', $LANG_USERBOX_ADMIN['must']);
    $templates->set_var('site_url', $_CONF['site_url']);
    $templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $templates->set_var('lang_view', $LANG_USERBOX_ADMIN['view']);
    $token = SEC_createToken();
    $retval .= SEC_getTokenExpiryNotice($token);
    $templates->set_var('gltoken_name', CSRF_TOKEN);
    $templates->set_var('gltoken', $token);
    $templates->set_var('xhtml', XHTML);
    $templates->set_var('script', THIS_SCRIPT);
    $templates->set_var('dateformat', $_USERBOX_CONF['dateformat']);
    //
    $templates->set_var('lang_link_admin', $LANG_USERBOX_ADMIN['link_admin']);
    $templates->set_var('lang_link_admin_top', $LANG_USERBOX_ADMIN['link_admin_top']);
    $templates->set_var('lang_link_public', $LANG_USERBOX_ADMIN['link_public']);
    $templates->set_var('lang_link_list', $LANG_USERBOX_ADMIN['link_list']);
    $templates->set_var('lang_link_detail', $LANG_USERBOX_ADMIN['link_detail']);
    //fieldset_id
    $templates->set_var('lang_fieldset', $LANG_USERBOX_ADMIN['fieldset']);
    $templates->set_var('fieldset_id', $fieldset_id);
    $templates->set_var('fieldset_name', $fieldset_name);
    //id
    $templates->set_var('lang_id', $LANG_USERBOX_ADMIN['id']);
    //@@@@@ $templates->set_var('help_id', $LANG_USERBOX_ADMIN['help']);
    $templates->set_var('id', $id);
    //$LANG28 = array(
    //    2 => 'ユーザID',
    //    3 => 'ユーザ名', username
    //    4 => '氏名', fullname
    $templates->set_var('lang_uid', $LANG28['2']);
    $templates->set_var('lang_username', $LANG28['3']);
    $templates->set_var('username', $username);
    $templates->set_var('lang_fullname', $LANG28['4']);
    $templates->set_var('fullname', $fullname);
    //下書
    $templates->set_var('lang_draft', $LANG_USERBOX_ADMIN['draft']);
    if ($draft_flag == 1) {
        $templates->set_var('draft_flag', "checked=checked");
        $templates->set_var('draft_msg', $LANG_USERBOX_ADMIN['draft_msg']);
    } else {
        $templates->set_var('draft_flag', "");
        $templates->set_var('draft_msg', "");
    }
    //
    $templates->set_var('lang_field', $LANG_USERBOX_ADMIN['field']);
    $templates->set_var('lang_fields', $LANG_USERBOX_ADMIN['fields']);
    $templates->set_var('lang_content', $LANG_USERBOX_ADMIN['content']);
    $templates->set_var('lang_templatesetvar', $LANG_USERBOX_ADMIN['templatesetvar']);
    //基本項目
    $templates->set_var('lang_basicfields', $LANG_USERBOX_ADMIN['basicfields']);
    //コード&タイトル&説明&テンプレートセット値
    $templates->set_var('lang_code', $LANG_USERBOX_ADMIN['code']);
    if ($_USERBOX_CONF['datacode']) {
        $templates->set_var('lang_must_code', $LANG_USERBOX_ADMIN['must']);
    } else {
        $templates->set_var('lang_must_code', "");
    }
    $templates->set_var('code', $code);
    $templates->set_var('lang_title', $LANG_USERBOX_ADMIN['title']);
    $templates->set_var('title', $title);
    $templates->set_var('lang_page_title', $LANG_USERBOX_ADMIN['page_title']);
    $templates->set_var('page_title', $page_title);
    $templates->set_var('lang_description', $LANG_USERBOX_ADMIN['description']);
    $templates->set_var('description', $description);
    //language_id
    if (is_array($_CONF['languages'])) {
        $templates->set_var('hide_language_id', '');
        $select_language_id = DATABOX_getoptionlist("language_id", $language_id, 0, $pi_name, "", 0);
    } else {
        $templates->set_var('hide_language_id', ' style="display:none;"');
        $select_language_id = "";
    }
    $templates->set_var('lang_language_id', $LANG_USERBOX_ADMIN['language_id']);
    $templates->set_var('language_id', $language_id);
    $templates->set_var('select_language_id', $select_language_id);
    //@@@@@
    //編集日
    $templates->set_var('lang_modified_autoupdate', $LANG_USERBOX_ADMIN['modified_autoupdate']);
    $templates->set_var('lang_modified', $LANG_USERBOX_ADMIN['modified']);
    $w = COM_convertDate2Timestamp($modified_year . "-" . $modified_month . "-" . $modified_day, $modified_hour . ":" . $modified_minute . "::00");
    $datetime_modified = DATABOX_datetimeedit($w, "LANG_DATABOX_ADMIN", "modified");
    $templates->set_var('datetime_modified', $datetime_modified);
    //カテゴリ
    $templates->set_var('lang_category', $LANG_USERBOX_ADMIN['category']);
    $checklist_category = DATABOX_getcategoriesinp($category, $fieldset_id, $pi_name);
    $templates->set_var('checklist_category', $checklist_category);
    //追加項目
    $templates->set_var('lang_additionfields', $LANG_USERBOX_ADMIN['additionfields']);
    $rt = DATABOX_getaddtionfieldsEdit($additionfields, $addition_def, $templates, $chk_user, $pi_name, $additionfields_fnm, $additionfields_del, $fieldset_id, $additionfields_date);
    //保存日時
    $templates->set_var('lang_udatetime', $LANG_USERBOX_ADMIN['udatetime']);
    $templates->set_var('udatetime', $udatetime);
    $templates->set_var('lang_uuid', $LANG_USERBOX_ADMIN['uuid']);
    $templates->set_var('uuid', $uuid);
    //作成日付
    $templates->set_var('lang_created', $LANG_USERBOX_ADMIN['created']);
    $templates->set_var('created', $created);
    // SAVE、CANCEL ボタン
    $templates->set_var('lang_save', $LANG_ADMIN['save']);
    $templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $templates->set_var('lang_preview', $LANG_ADMIN['preview']);
    //delete_option
    if ($delflg) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
    }
    //
    $templates->parse('output', 'editor');
    $retval .= $templates->finish($templates->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
コード例 #12
0
function LIB_Edit($pi_name, $id, $edt_flg, $msg = '', $errmsg = "", $mode = "edit")
{
    global $_CONF;
    global $_TABLES;
    global $LANG_ADMIN;
    global $MESSAGE;
    global $LANG_ACCESS;
    global $_USER;
    $lang_box_admin = "LANG_" . strtoupper($pi_name) . "_ADMIN";
    global ${$lang_box_admin};
    $lang_box_admin = ${$lang_box_admin};
    $lang_box = "LANG_" . strtoupper($pi_name);
    global ${$lang_box};
    $lang_box = ${$lang_box};
    $table = $_TABLES[strtoupper($pi_name) . '_def_category'];
    $table2 = $_TABLES[strtoupper($pi_name) . '_category'];
    //$lang_box_noyes="LANG_".strtoupper($pi_name)."_NOYES";
    //global $$lang_box_noyes;
    //$lang_box_noyes=$$lang_box_noyes;
    $retval = '';
    $delflg = false;
    $wkcnt = DB_count($table2, "category_id", $id);
    if (!empty($msg)) {
        $retval .= COM_showMessage($msg, $pi_name);
        $retval .= $errmsg;
        // clean 'em up
        $code = COM_applyFilter($_POST['code']);
        $name = COM_applyFilter($_POST['name']);
        $description = COM_applyFilter($_POST['description']);
        $defaulttemplatesdirectory = COM_applyFilter($_POST['defaulttemplatesdirectory']);
        //@@@@@@
        $parent_id = COM_applyFilter($_POST['parent_id'], true);
        $categorygroup_id = COM_applyFilter($_POST['group'], true);
        //@@@@@@
        $orderno = COM_applyFilter($_POST['orderno']);
        $uuid = $_USER['uid'];
    } else {
        if (empty($id)) {
            $id = 0;
            $code = "";
            $name = "";
            $description = "";
            $defaulttemplatesdirectory = "";
            $categorygroup_id = "";
            $parent_id = "";
            $orderno = "";
            $uuid = 0;
            $udatetime = "";
            //"";
        } else {
            $sql = "SELECT ";
            $sql .= " *";
            $sql .= " FROM ";
            $sql .= $table;
            $sql .= " WHERE ";
            $sql .= " category_id = {$id}";
            $result = DB_query($sql);
            $A = DB_fetchArray($result);
            $code = COM_stripslashes($A['code']);
            $name = COM_stripslashes($A['name']);
            $description = COM_stripslashes($A['description']);
            $defaulttemplatesdirectory = COM_stripslashes($A['defaulttemplatesdirectory']);
            $parent_id = COM_stripslashes($A['parent_id']);
            $categorygroup_id = COM_stripslashes($A['categorygroup_id']);
            $orderno = COM_stripslashes($A['orderno']);
            $uuid = COM_stripslashes($A['uuid']);
            $udatetime = COM_stripslashes($A['udatetime']);
            // データがあれば削除させない
            if ($edt_flg == FALSE) {
                $delflg = true;
            }
        }
    }
    if ($mode === "copy") {
        $id = 0;
        //作成日付
        $created = 0;
        $created_month = 0;
        $created_day = 0;
        $created_year = 0;
        $created_hour = 0;
        $created_minute = 0;
        //
        $delflg = false;
    }
    $retval .= COM_startBlock($lang_box_admin['edit'], '', COM_getBlockTemplate('_admin_block', 'header'));
    $tmplfld = DATABOX_templatePath('admin', 'default', $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file('editor', "category_editor.thtml");
    //--
    $templates->set_var('about_thispage', $lang_box_admin['about_admin_category']);
    $templates->set_var('lang_must', $lang_box_admin['must']);
    $templates->set_var('site_url', $_CONF['site_url']);
    $templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    //--
    $token = SEC_createToken();
    $retval .= SEC_getTokenExpiryNotice($token);
    $templates->set_var('gltoken_name', CSRF_TOKEN);
    $templates->set_var('gltoken', $token);
    $templates->set_var('xhtml', XHTML);
    $templates->set_var('script', THIS_SCRIPT);
    //
    $templates->set_var('lang_link_admin', $lang_box_admin['link_admin']);
    $templates->set_var('lang_link_admin_top', $lang_box_admin['link_admin_top']);
    //id
    $templates->set_var('lang_category_id', $lang_box_admin['category_id']);
    $templates->set_var('id', $id);
    //コード、名前&説明
    $templates->set_var('lang_code', $lang_box_admin['code']);
    $templates->set_var('code', $code);
    $templates->set_var('lang_name', $lang_box_admin['name']);
    $templates->set_var('name', $name);
    $templates->set_var('lang_description', $lang_box_admin['description']);
    $templates->set_var('description', $description);
    //
    $templates->set_var('lang_defaulttemplatesdirectory', $lang_box_admin['defaulttemplatesdirectory']);
    $templates->set_var('defaulttemplatesdirectory', $defaulttemplatesdirectory);
    $select_defaulttemplatesdirectory = LIB_templatesdirectory($pi_name, $defaulttemplatesdirectory);
    $templates->set_var('select_defaulttemplatesdirectory', $select_defaulttemplatesdirectory);
    //parent
    $templates->set_var('lang_parent', $lang_box_admin['parent']);
    if ($wkcnt > 0) {
        $disabled = "disabled";
    } else {
        $disabled = "";
    }
    $list_parent = DATABOX_getoptionlist("parent", $parent_id, 0, $pi_name, $disabled);
    $templates->set_var('list_parent', $list_parent);
    //group
    $templates->set_var('lang_group', $lang_box_admin['group']);
    $list_group = DATABOX_getoptionlist("group", $categorygroup_id, 0, $pi_name, "", 0);
    //@@@@@
    $templates->set_var('list_group', $list_group);
    //順序
    $templates->set_var('lang_orderno', $lang_box_admin['orderno']);
    $templates->set_var('orderno', $orderno);
    //保存日時
    $templates->set_var('lang_udatetime', $lang_box_admin['udatetime']);
    $templates->set_var('udatetime', $udatetime);
    $templates->set_var('lang_uuid', $lang_box_admin['uuid']);
    $templates->set_var('uuid', $uuid);
    // SAVE、CANCEL ボタン
    $templates->set_var('lang_save', $LANG_ADMIN['save']);
    $templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $templates->set_var('lang_preview', $LANG_ADMIN['preview']);
    //delete_option
    if ($delflg) {
        if ($wkcnt > 0) {
            $templates->set_var('lang_delete_help', $lang_box_admin['delete_help_category']);
        } else {
            $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s>';
            $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
            $templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        }
    }
    //
    $templates->parse('output', 'editor');
    $retval .= $templates->finish($templates->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
コード例 #13
0
ファイル: attribute.php プロジェクト: mistgrass/geeklog-ivywe
function fnclist($id, $template)
{
    global $_CONF;
    global $_TABLES;
    global $_USER_CONF;
    global $perpage;
    global $LANG_USERBOX;
    global $LANG_USERBOX_ADMIN;
    global $LANG_USERBOX_NOYES;
    //-----
    $page = COM_applyFilter($_REQUEST['page'], true);
    if (!isset($page) or $page == 0) {
        $page = 1;
    }
    $pi_name = "userbox";
    $field_def = DATABOX_getadditiondef($pi_name);
    //-----
    $tbl1 = $_TABLES['USERBOX_addition'];
    $tbl2 = $_TABLES['USERBOX_base'];
    $tbl3 = $_TABLES['USERBOX_def_field'];
    $tbl5 = $_TABLES['users'];
    //-----
    $sql = "SELECT " . LB;
    $sql .= " t1.field_id " . LB;
    $sql .= " ,t1.value " . LB;
    $sql .= " ,t3.name " . LB;
    $sql .= " ,t3.templatesetvar" . LB;
    $sql .= " ,t3.description " . LB;
    $sql .= " ,Count(t1.id) AS count" . LB;
    $sql .= " FROM " . LB;
    $sql .= " {$tbl1} AS t1 " . LB;
    $sql .= " ,{$tbl2} AS t2 " . LB;
    $sql .= " ,{$tbl3} AS t3 " . LB;
    $sql .= " ,{$tbl5} AS t5 " . LB;
    $sql .= " WHERE " . LB;
    $sql .= " t1.value <>''" . LB;
    $sql .= " AND t1.id = t2.id " . LB;
    $sql .= " AND t1.id = t5.uid " . LB;
    $sql .= " AND t1.field_id = t3.field_id " . LB;
    //TYPE[0] = '一行テキストフィールド';
    //TYPE[2] = 'いいえ/はい';
    //TYPE[3] = '日付 (date picker対応)';
    //TYPE[7] = 'オプションリスト';
    //TYPE[8] = 'ラジオボタンリスト';
    //TYPE[9] = 'オプションリスト(マスタ) (既定リスト)';
    $sql .= " AND t3.type IN (0,2,3,4,7,8,9,16) " . LB;
    //ALLOW_DISPLAY[0] ='表示する(orderに指定可能)';
    //ALLOW_DISPLAY[1] ='ログインユーザのみ表示する';
    if (COM_isAnonUser()) {
        $sql .= " AND t3.allow_display=0 " . LB;
    } else {
        $sql .= " AND t3.allow_display IN (0,1) " . LB;
    }
    if ($id != 0) {
        $sql .= " AND t1.field_id = " . $id . LB;
    }
    //管理者の時,下書データも含む
    //if ( SEC_hasRights('userbox.admin')) {
    //}else{
    $sql .= " AND t2.draft_flag=0" . LB;
    //}
    //アクセス権のないデータ はのぞく
    $sql .= COM_getPermSql('AND', 0, 2, "t2") . LB;
    //公開日以前のデータはのぞく
    $sql .= " AND (released <= NOW())" . LB;
    //公開終了日を過ぎたデータはのぞく
    $sql .= " AND (expired=0 OR expired > NOW())" . LB;
    $sql .= " GROUP BY " . LB;
    $sql .= " t1.field_id , t1.value" . LB;
    $sql .= " ORDER BY " . LB;
    $sql .= " t1.field_id,t1.value" . LB;
    $result = DB_query($sql);
    $cnt = DB_numRows($result);
    $pages = 0;
    if ($perpage > 0) {
        $pages = ceil($cnt / $perpage);
    }
    //ヘッダ、左ブロック
    //@@@@@@ 修正要
    if ($id == 0) {
        $w = $LANG_USERBOX['attribute_top'];
        $attribute_top = $w;
        $field_top = "";
        $col = "col.thtml";
    } else {
        $url = $_CONF['site_url'] . "/userbox/attribute.php";
        $attribute_top = ":<a href='" . $url . "'>" . $LANG_USERBOX['attribute_top'] . "</a>";
        $w = $field_def[$id]['name'] . $LANG_USERBOX['countlist'];
        $field_top = $w;
        $col = "col2.thtml";
    }
    if ($page > 1) {
        $page_title = sprintf('%s (%d)', $w, $page);
    } else {
        $page_title = sprintf('%s ', $w);
    }
    $headercode .= DATABOX_getheadercode("attribute", $template, $pi_name, 0, $_CONF['site_name'], $_CONF['meta_description'], $_CONF['meta_keywords'], $_CONF['meta_description']);
    $retval .= DATABOX_siteHeader($pi_name, '', $page_title, $headercode);
    //
    $tmplfld = DATABOX_templatePath('attribute', $template, $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file(array('list' => 'list.thtml', 'nav' => 'navigation.thtml', 'row' => 'row.thtml', 'col' => $col, 'pagenav' => 'pagenavigation.thtml'));
    $languageid = COM_getLanguageId();
    $language = COM_getLanguage();
    $templates->set_var('languageid', $languageid);
    $templates->set_var('language', $language);
    if ($languageid != "") {
        $templates->set_var('_languageid', "_" . $languageid);
    } else {
        $templates->set_var('_languageid', "");
    }
    //
    $templates->set_var('site_url', $_CONF['site_url']);
    $templates->set_var('this_script', THIS_SCRIPT);
    $templates->set_var('home', $LANG_USERBOX['home']);
    $templates->set_var('attribute_top', $attribute_top);
    $templates->set_var('field_top', $field_top);
    //page
    $offset = ($page - 1) * $perpage;
    $lin1 = $offset + 1;
    $lin2 = $lin1 + $perpage - 1;
    if ($lin2 > $cnt) {
        $lin2 = $cnt;
    }
    $templates->set_var('lang_view', $LANG_USERBOX['view']);
    $templates->set_var('lin', $lin1 . "-" . $lin2);
    $templates->set_var('cnt', $cnt);
    //
    $templates->set_var('lang_name', $LANG_USERBOX_ADMIN['name']);
    $templates->set_var('lang_count', $LANG_USERBOX['count']);
    $sql .= " LIMIT {$offset}, {$perpage}";
    $result = DB_query($sql);
    $numrows = DB_numRows($result);
    if ($numrows > 0) {
        for ($i = 0; $i < $numrows; $i++) {
            $A = DB_fetchArray($result);
            $name = COM_applyFilter($A['name']);
            $description = COM_applyFilter($A['description']);
            $fid = $A["field_id"];
            $value = $A["value"];
            $fieldvalue = DATABOX_getfieldvalue($value, $field_def[$fid]['type'], $field_def[$fid]['selectionary'], $LANG_USERBOX_NOYES, $field_def[$fid]['selectlist'], $pi_name);
            $url = $_CONF['site_url'] . "/" . THIS_SCRIPT;
            $url .= "?";
            $url .= "id=" . $A['field_id'];
            $url .= "&amp;m=id";
            $url2 = $url . "&value=" . $A['value'];
            $url = COM_buildUrl($url);
            $link = COM_createLink($name, $url);
            $url2 = COM_buildUrl($url2);
            $link2 = COM_createLink($fieldvalue, $url2);
            $templates->set_var('field_link', $link);
            $templates->set_var('value_link', $link2);
            $templates->set_var('field_description', $description);
            $templates->set_var('field_name', $name);
            $templates->set_var('field_url', $url);
            $templates->set_var('value_url', $url2);
            $templates->set_var('value', $fieldvalue);
            $templates->set_var('count', $A['count']);
            //=====
            $templates->parse('col_var', 'col', true);
            $templates->parse('row_var', 'row', true);
            $templates->set_var('col_var', '');
        }
        // Call to plugins to set template variables in the databox
        PLG_templateSetVars('userbox', $templates);
        //ページなび
        //$url = $_CONF['site_url']  . '/'.THIS_SCRIPT."?m=".$m;//."?order=$order";
        $url = $_CONF['site_url'] . '/' . THIS_SCRIPT;
        $templates->set_var('page_navigation', COM_printPageNavigation($url, $page, $pages));
        //------------
        $templates->parse('nav_var', 'nav', true);
        $templates->set_var('blockfooter', COM_endBlock());
        $templates->set_var('msg', "");
        $templates->parse('output', 'list');
        $school_content = $templates->finish($templates->get_var('output'));
        $retval .= $school_content;
    } else {
        $templates->set_var('msg', $LANG_USERBOX["nohit"]);
        $templates->parse('output', 'list');
        $content = $templates->finish($templates->get_var('output'));
        $retval .= $content;
    }
    $retval = PLG_replacetags($retval);
    return $retval;
}
コード例 #14
0
function LIB_editgroups($pi_name, $id)
{
    global $_CONF;
    global $_TABLES;
    global $LANG_ADMIN;
    global $LANG09;
    $lang_box_admin = "LANG_" . strtoupper($pi_name) . "_ADMIN";
    global ${$lang_box_admin};
    $lang_box_admin = ${$lang_box_admin};
    $lang_box = "LANG_" . strtoupper($pi_name);
    global ${$lang_box};
    $lang_box = ${$lang_box};
    //global  $_USER;
    global $LANG_ACCESS;
    global $LANG28;
    require_once $_CONF['path_system'] . 'lib-admin.php';
    $retval = '';
    $table = $_TABLES[strtoupper($pi_name) . '_def_fieldset'];
    $fieldset_name = DB_getItem($table, 'name', "fieldset_id = {$id}");
    $fieldset_listing_url = $_CONF['site_admin_url'] . "/plugins/" . THIS_SCRIPT;
    //MENU1:管理画面
    $url2 = $_CONF['site_url'] . '/admin/plugins/' . $pi_name . '/fieldset.php';
    $menu_arr[] = array('url' => $url2, 'text' => $lang_box_admin['fieldsetlist']);
    $menu_arr[] = array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']);
    $retval .= COM_startBlock($lang_box_admin['admin_list'] . " - {$fieldset_name}", '', COM_getBlockTemplate('_admin_block', 'header'));
    $function = "plugin_geticon_" . $pi_name;
    $icon = $function();
    $retval .= ADMIN_createMenu($menu_arr, $lang_box_admin['inst_fieldsetgroups'], $icon);
    $tmplfld = DATABOX_templatePath('admin', 'default', $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file('editor', "fieldset_groups.thtml");
    //--
    $templates->set_var('site_url', $_CONF['site_url']);
    $templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $token = SEC_createToken();
    $retval .= SEC_getTokenExpiryNotice($token);
    $templates->set_var('gltoken_name', CSRF_TOKEN);
    $templates->set_var('gltoken', $token);
    $templates->set_var('xhtml', XHTML);
    $templates->set_var('script', THIS_SCRIPT);
    //
    $templates->set_var('lang_link_admin', $lang_box_admin['link_admin']);
    $templates->set_var('lang_link_admin_top', $lang_box_admin['link_admin_top']);
    $templates->set_var('LANG_fieldsetgroups', $lang_box_admin['fieldsetgroupsregistered']);
    $templates->set_var('fieldsetgroups', LIB_selectGroups($pi_name, $id, true));
    $templates->set_var('LANG_grouplist', $lang_box_admin['grouplist']);
    $templates->set_var('group_list', LIB_selectGroups($pi_name, $id));
    $templates->set_var('LANG_add', $LANG_ACCESS['add']);
    $templates->set_var('LANG_remove', $LANG_ACCESS['remove']);
    $templates->set_var('lang_save', $LANG_ADMIN['save']);
    $templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $templates->set_var('id', $id);
    $templates->parse('output', 'editor');
    $retval .= $templates->finish($templates->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
コード例 #15
0
ファイル: lib_mst.php プロジェクト: mistgrass/geeklog-ivywe
function LIB_Edit($pi_name, $id, $edt_flg, $msg = '', $errmsg = "", $mode = "edit")
{
    global $_CONF;
    global $_TABLES;
    global $LANG_ADMIN;
    global $MESSAGE;
    global $LANG_ACCESS;
    global $_USER;
    $lang_box_admin = "LANG_" . strtoupper($pi_name) . "_ADMIN";
    global ${$lang_box_admin};
    $lang_box_admin = ${$lang_box_admin};
    $lang_box = "LANG_" . strtoupper($pi_name);
    global ${$lang_box};
    $lang_box = ${$lang_box};
    $table = $_TABLES[strtoupper($pi_name) . '_mst'];
    $table2 = $_TABLES[strtoupper($pi_name) . '_def_field'];
    $retval = '';
    $delflg = false;
    if (!empty($msg)) {
        $retval .= COM_showMessage($msg, $pi_name);
        $retval .= $errmsg;
        // clean 'em up
        $kind = COM_applyFilter($_POST['kind']);
        $no = COM_applyFilter($_POST['no'], true);
        $value = COM_applyFilter($_POST['value']);
        $value2 = COM_applyFilter($_POST['value2']);
        $disp = COM_applyFilter($_POST['disp']);
        $orderno = COM_applyFilter($_POST['orderno'], true);
        $relno = COM_applyFilter($_POST['relno'], true);
        $uuid = $_USER['uid'];
    } else {
        if (empty($id)) {
            $id = 0;
            $kind = "";
            $no = "";
            $value = "";
            $value2 = "";
            $disp = "";
            $orderno = "";
            $relno = "";
            $uuid = 0;
            $udatetime = "";
            //"";
        } else {
            $sql = "SELECT ";
            $sql .= " *";
            $sql .= " ,UNIX_TIMESTAMP(udatetime) AS udatetime_un" . LB;
            $sql .= " FROM ";
            $sql .= $table;
            $sql .= " WHERE ";
            $sql .= " id = {$id}";
            $result = DB_query($sql);
            $A = DB_fetchArray($result);
            $kind = COM_stripslashes($A['kind']);
            $no = COM_stripslashes($A['no']);
            $value = COM_stripslashes($A['value']);
            $value2 = COM_stripslashes($A['value2']);
            $disp = COM_stripslashes($A['disp']);
            $orderno = COM_stripslashes($A['orderno']);
            $relno = COM_stripslashes($A['relno']);
            $uuid = COM_stripslashes($A['uuid']);
            $wary = COM_getUserDateTimeFormat(COM_stripslashes($A['udatetime_un']));
            $udatetime = $wary[0];
            // データがあれば削除させない
            if ($edt_flg == FALSE) {
                $delflg = true;
            }
        }
    }
    if ($mode === "copy") {
        $id = 0;
        //作成日付
        $created = 0;
        $created_month = 0;
        $created_day = 0;
        $created_year = 0;
        $created_hour = 0;
        $created_minute = 0;
        //
        $delflg = false;
    }
    $tmplfld = DATABOX_templatePath('admin', 'default', $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file('editor', "mst_editor.thtml");
    //--
    $templates->set_var('about_thispage', $lang_box_admin['about_admin_mst']);
    $templates->set_var('lang_must', $lang_box_admin['must']);
    $templates->set_var('site_url', $_CONF['site_url']);
    $templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    //--
    $token = SEC_createToken();
    $retval .= SEC_getTokenExpiryNotice($token);
    $templates->set_var('gltoken_name', CSRF_TOKEN);
    $templates->set_var('gltoken', $token);
    $templates->set_var('xhtml', XHTML);
    $templates->set_var('script', THIS_SCRIPT);
    //
    $templates->set_var('lang_link_admin', $lang_box_admin['link_admin']);
    $templates->set_var('lang_link_admin_top', $lang_box_admin['link_admin_top']);
    //id
    $templates->set_var('lang_id', $lang_box_admin['id']);
    $templates->set_var('id', $id);
    //コード、名前&説明
    $templates->set_var('lang_kind', $lang_box_admin['kind']);
    $templates->set_var('kind', $kind);
    $templates->set_var('lang_no', $lang_box_admin['no']);
    $templates->set_var('no', $no);
    $templates->set_var('lang_value', $lang_box_admin['value']);
    $templates->set_var('value', $value);
    $templates->set_var('lang_value2', $lang_box_admin['value2']);
    $templates->set_var('value2', $value2);
    $templates->set_var('lang_disp', $lang_box_admin['disp']);
    $templates->set_var('disp', $disp);
    $templates->set_var('lang_relno', $lang_box_admin['relno']);
    $templates->set_var('relno', $relno);
    //順序
    $templates->set_var('lang_orderno', $lang_box_admin['orderno']);
    $templates->set_var('orderno', $orderno);
    //保存日時
    $templates->set_var('lang_udatetime', $lang_box_admin['udatetime']);
    $templates->set_var('udatetime', $udatetime);
    $templates->set_var('lang_uuid', $lang_box_admin['uuid']);
    $templates->set_var('uuid', $uuid);
    // SAVE、CANCEL ボタン
    $templates->set_var('lang_save', $LANG_ADMIN['save']);
    $templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $templates->set_var('lang_preview', $LANG_ADMIN['preview']);
    //delete_option
    $wkcnt = DB_count($table2, "selectlist", $kind);
    if ($delflg) {
        if ($wkcnt > 0) {
            $templates->set_var('lang_delete_help', $lang_box_admin['delete_help_mst']);
        } else {
            $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s>';
            $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
            $templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        }
    }
    //
    $templates->parse('output', 'editor');
    $retval .= $templates->finish($templates->get_var('output'));
    return $retval;
}
コード例 #16
0
function fncEdit($msg = "")
{
    $pi_name = "userbox";
    global $_CONF;
    global $_TABLES;
    global $LANG_ADMIN;
    global $LANG_ACCESS;
    global $_USER;
    global $LANG28;
    global $LANG_USERBOX_ADMIN;
    $uid = $_USER['uid'];
    $username = $_USER['username'];
    require_once $_CONF['path_system'] . 'lib-admin.php';
    $groupsforuser = fncGetGroupsForUser();
    if ($groupsforuser == "") {
        return $LANG_USERBOX_ADMIN['err_group_not_exist'];
    }
    $retval = '';
    //    $delflg=false;
    if (!empty($msg)) {
        $retval .= COM_showMessage($msg, $pi_name);
    }
    //-----
    $retval .= COM_startBlock($LANG_USERBOX_ADMIN['edit'], '', COM_getBlockTemplate('_admin_block', 'header'));
    //template フォルダ
    $tmplfld = DATABOX_templatePath('myprofile', 'default', $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file(array('editor' => 'securitygroup_editor.thtml', 'groupedit' => 'securitygroup_group.thtml'));
    //--
    $templates->set_var('about_thispage', $LANG_USERBOX_ADMIN['about_myprofile_securitygroup']);
    $templates->set_var('site_url', $_CONF['site_url']);
    $templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $token = SEC_createToken();
    $retval .= SEC_getTokenExpiryNotice($token);
    $templates->set_var('gltoken_name', CSRF_TOKEN);
    $templates->set_var('gltoken', $token);
    $templates->set_var('xhtml', XHTML);
    $templates->set_var('script', THIS_SCRIPT);
    // SAVE、CANCEL ボタン
    $templates->set_var('lang_save', $LANG_ADMIN['save']);
    $templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    //$LANG28 = array(
    //    2 => 'ユーザID',
    //    3 => 'ユーザ名', username
    $templates->set_var('lang_uid', $LANG28['2']);
    $templates->set_var('uid', $uid);
    $templates->set_var('lang_username', $LANG28['3']);
    $templates->set_var('username', $username);
    //-----------
    //ヘッダ:編集~
    $header_arr[] = array('text' => $LANG28[86], 'field' => 'checkbox', 'sort' => false);
    $header_arr[] = array('text' => $LANG_ACCESS['groupname'], 'field' => 'grp_name', 'sort' => true);
    $header_arr[] = array('text' => $LANG_ACCESS['description'], 'field' => 'grp_descr', 'sort' => true);
    //
    $form_url = $_CONF['site_url'] . "/plugins/" . THIS_SCRIPT;
    $text_arr = array('has_menu' => false, 'title' => '', 'instructions' => '', 'icon' => '', 'form_url' => $form_url, 'inline' => true);
    //
    $whereGroups = 'grp_id IN (' . implode(',', $groupsforuser) . ')';
    $usergroups = SEC_getUserGroups($uid);
    if (is_array($usergroups) && !empty($uid)) {
        $selected = implode(' ', $usergroups);
    } else {
        $selected = '';
    }
    //Query
    $sql = "SELECT ";
    $sql .= " grp_id";
    $sql .= " , grp_name";
    $sql .= " , grp_descr ";
    $sql .= " FROM {$_TABLES['groups']} ";
    $sql .= " WHERE ";
    $sql .= $whereGroups;
    $query_arr = array('table' => 'groups', 'sql' => $sql, 'query_fields' => array('grp_name'), 'default_filter' => '', 'query' => '', 'query_limit' => 0);
    //デフォルトソート項目:
    $defsort_arr = array('field' => 'grp_name', 'direction' => 'asc');
    //List 取得
    //ADMIN_list(
    //       $component, $fieldfunction, $header_arr, $text_arr,
    //       $query_arr, $menu_arr, $defsort_arr, $filter = '', $extra = '', $options = '')
    $groupoptions = ADMIN_list('userbox', "fncGetListField", $header_arr, $text_arr, $query_arr, $defsort_arr, '', explode(' ', $selected));
    $templates->set_var('group_options', $groupoptions);
    $templates->parse('group_edit', 'groupedit', true);
    //??
    //
    $templates->parse('output', 'editor');
    $retval .= $templates->finish($templates->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}