Example #1
0
function fncdatetimeedit($datetime_value, $title, $token, $script = "", $datetime = "datetime")
{
    global $_CONF;
    global $LANG_CONFIG;
    global $_SCRIPTS;
    $pi_name = "assist";
    $tmplfld = assist_templatePath('admin', 'default', $pi_name);
    $tmpl = new Template($tmplfld);
    $tmpl->set_file(array('datetimeedit' => 'datetime.thtml'));
    // Loads jQuery UI datepicker
    if (version_compare(VERSION, '2.0.0') >= 0) {
        $_SCRIPTS->setJavaScriptLibrary('jquery.ui.datepicker');
        $_SCRIPTS->setJavaScriptLibrary('jquery-ui-i18n');
        $_SCRIPTS->setJavaScriptFile('datepicker', '/javascript/datepicker.js');
        $langCode = COM_getLangIso639Code();
        $toolTip = 'Click and select a date';
        // Should be translated
        $imgUrl = $_CONF['site_url'] . '/images/calendar.png';
        $_SCRIPTS->setJavaScript("jQuery(function () {" . "  geeklog.datepicker.set('datetime', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "});", TRUE, TRUE);
    }
    $datetime_month = date('m', $datetime_value);
    $datetime_day = date('d', $datetime_value);
    $datetime_year = date('Y', $datetime_value);
    $datetime_hour = date('H', $datetime_value);
    $datetime_minute = date('i', $datetime_value);
    //
    $month_options = COM_getMonthFormOptions($datetime_month);
    $day_options = COM_getDayFormOptions($datetime_day);
    $year_options = COM_getYearFormOptions($datetime_year);
    $hour_options = COM_getHourFormOptions($datetime_hour, 24);
    $minute_options = COM_getMinuteFormOptions($datetime_minute);
    $tmpl->set_var('site_url', $_CONF['site_url']);
    $tmpl->set_var('datetime_script', $script);
    $tmpl->set_var('datetime_title', $title);
    $tmpl->set_var('datetime', $datetime);
    $tmpl->set_var('datetime_year_options', $year_options);
    $tmpl->set_var('datetime_month_options', $month_options);
    $tmpl->set_var('datetime_day_options', $day_options);
    $tmpl->set_var('datetime_hour_options', $hour_options);
    $tmpl->set_var('datetime_minute_options', $minute_options);
    $tmpl->set_var('lang_yy', "年");
    $tmpl->set_var('lang_mm', "月");
    $tmpl->set_var('gltoken_name', CSRF_TOKEN);
    $tmpl->set_var('gltoken', $token);
    $tmpl->set_var('xhtml', XHTML);
    $tmpl->set_var('save_changes', $LANG_CONFIG['save_changes']);
    //
    $tmpl->parse('output', 'datetimeedit');
    $rt = $tmpl->finish($tmpl->get_var('output'));
    return $rt;
}
Example #2
0
/**
* Shows story editor
*
* Displays the story entry form
*
* @param    string      $sid            ID of story to edit
* @param    string      $mode           'preview', 'edit', 'editsubmission', 'clone'
* @param    string      $errormsg       a message to display on top of the page
* @return   string      HTML for story editor
*
*/
function storyeditor($sid = '', $mode = '', $errormsg = '')
{
    global $_CONF, $_TABLES, $_USER, $LANG24, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE, $_SCRIPTS, $LANG_DIRECTION, $LANG_MONTH, $LANG_WEEK;
    $display = '';
    if (!isset($_CONF['hour_mode'])) {
        $_CONF['hour_mode'] = 12;
    }
    if (!empty($errormsg)) {
        $display .= COM_showMessageText($errormsg, $LANG24[25]);
    }
    $story = new Story();
    if ($mode == 'preview') {
        // Handle Magic GPC Garbage:
        while (list($key, $value) = each($_POST)) {
            if (!is_array($value)) {
                $_POST[$key] = COM_stripslashes($value);
            } else {
                while (list($subkey, $subvalue) = each($value)) {
                    $value[$subkey] = COM_stripslashes($subvalue);
                }
            }
        }
        $result = $story->loadFromArgsArray($_POST);
        if ($_CONF['maximagesperarticle'] > 0) {
            $errors = $story->checkAttachedImages();
            if (count($errors) > 0) {
                $msg = $LANG24[55] . LB . '<ul>' . LB;
                foreach ($errors as $err) {
                    $msg .= '<li>' . $err . '</li>' . LB;
                }
                $msg .= '</ul>' . LB;
                $display .= COM_showMessageText($msg, $LANG24[54]);
            }
        }
    } else {
        $result = $story->loadFromDatabase($sid, $mode);
    }
    if ($result == STORY_PERMISSION_DENIED || $result == STORY_NO_ACCESS_PARAMS) {
        $display .= COM_showMessageText($LANG24[42], $LANG_ACCESS['accessdenied']);
        COM_accessLog("User {$_USER['username']} tried to illegally access story {$sid}.");
        return $display;
    } elseif ($result == STORY_EDIT_DENIED || $result == STORY_EXISTING_NO_EDIT_PERMISSION) {
        $display .= COM_showMessageText($LANG24[41], $LANG_ACCESS['accessdenied']);
        $display .= STORY_renderArticle($story, 'p');
        COM_accessLog("User {$_USER['username']} tried to illegally edit story {$sid}.");
        return $display;
    } elseif ($result == STORY_INVALID_SID) {
        if ($mode == 'editsubmission') {
            // that submission doesn't seem to be there any more (may have been
            // handled by another Admin) - take us back to the moderation page
            return COM_refresh($_CONF['site_admin_url'] . '/moderation.php');
        } else {
            return COM_refresh($_CONF['site_admin_url'] . '/story.php');
        }
    } elseif ($result == STORY_DUPLICATE_SID) {
        $display .= COM_showMessageText($LANG24[24]);
    }
    // Load HTML templates
    $story_templates = COM_newTemplate($_CONF['path_layout'] . 'admin/story');
    if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) {
        $story_templates->set_file(array('editor' => 'storyeditor_advanced.thtml'));
        $advanced_editormode = true;
        $story_templates->set_var('change_editormode', 'onchange="change_editmode(this);"');
        require_once $_CONF['path_system'] . 'classes/navbar.class.php';
        $story_templates->set_var('show_preview', 'none');
        $story_templates->set_var('lang_expandhelp', $LANG24[67]);
        $story_templates->set_var('lang_reducehelp', $LANG24[68]);
        $story_templates->set_var('lang_publishdate', $LANG24[69]);
        $story_templates->set_var('lang_toolbar', $LANG24[70]);
        $story_templates->set_var('toolbar1', $LANG24[71]);
        $story_templates->set_var('toolbar2', $LANG24[72]);
        $story_templates->set_var('toolbar3', $LANG24[73]);
        $story_templates->set_var('toolbar4', $LANG24[74]);
        $story_templates->set_var('toolbar5', $LANG24[75]);
        if ($story->EditElements('advanced_editor_mode') == 1 or $story->EditElements('postmode') == 'adveditor') {
            $story_templates->set_var('show_texteditor', 'none');
            $story_templates->set_var('show_htmleditor', '');
        } else {
            $story_templates->set_var('show_texteditor', '');
            $story_templates->set_var('show_htmleditor', 'none');
        }
    } else {
        $story_templates->set_file(array('editor' => 'storyeditor.thtml'));
        $advanced_editormode = false;
    }
    $story_templates->set_var('hour_mode', $_CONF['hour_mode']);
    if ($story->hasContent()) {
        $previewContent = STORY_renderArticle($story, 'p');
        if ($advanced_editormode and $previewContent != '') {
            $story_templates->set_var('preview_content', $previewContent);
        } elseif ($previewContent != '') {
            $display .= COM_startBlock($LANG24[26], '', COM_getBlockTemplate('_admin_block', 'header'));
            $display .= $previewContent;
            $display .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
        }
    }
    if ($advanced_editormode) {
        $navbar = new navbar();
        if (!empty($previewContent)) {
            $navbar->add_menuitem($LANG24[79], 'showhideEditorDiv("preview",0);return false;', true);
            $navbar->add_menuitem($LANG24[80], 'showhideEditorDiv("editor",1);return false;', true);
            $navbar->add_menuitem($LANG24[81], 'showhideEditorDiv("publish",2);return false;', true);
            $navbar->add_menuitem($LANG24[82], 'showhideEditorDiv("images",3);return false;', true);
            $navbar->add_menuitem($LANG24[83], 'showhideEditorDiv("archive",4);return false;', true);
            $navbar->add_menuitem($LANG24[84], 'showhideEditorDiv("perms",5);return false;', true);
            $navbar->add_menuitem($LANG24[85], 'showhideEditorDiv("all",6);return false;', true);
        } else {
            $navbar->add_menuitem($LANG24[80], 'showhideEditorDiv("editor",0);return false;', true);
            $navbar->add_menuitem($LANG24[81], 'showhideEditorDiv("publish",1);return false;', true);
            $navbar->add_menuitem($LANG24[82], 'showhideEditorDiv("images",2);return false;', true);
            $navbar->add_menuitem($LANG24[83], 'showhideEditorDiv("archive",3);return false;', true);
            $navbar->add_menuitem($LANG24[84], 'showhideEditorDiv("perms",4);return false;', true);
            $navbar->add_menuitem($LANG24[85], 'showhideEditorDiv("all",5);return false;', true);
        }
        if ($mode == 'preview') {
            $story_templates->set_var('show_preview', '');
            $story_templates->set_var('show_htmleditor', 'none');
            $story_templates->set_var('show_texteditor', 'none');
            $story_templates->set_var('show_submitoptions', 'none');
            $navbar->set_selected($LANG24[79]);
        } else {
            $navbar->set_selected($LANG24[80]);
        }
        $story_templates->set_var('navbar', $navbar->generate());
    }
    $oldsid = $story->EditElements('originalSid');
    if (!empty($oldsid) && $mode != 'clone') {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $story_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        $story_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
    }
    if ($mode == 'editsubmission' || $story->type == 'submission') {
        $story_templates->set_var('submission_option', '<input type="hidden" name="type" value="submission"' . XHTML . '>');
    }
    $story_templates->set_var('lang_author', $LANG24[7]);
    $storyauthor = COM_getDisplayName($story->EditElements('uid'));
    $story_templates->set_var('story_author', $storyauthor);
    $story_templates->set_var('author', $storyauthor);
    $story_templates->set_var('story_uid', $story->EditElements('uid'));
    // user access info
    $story_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
    $story_templates->set_var('lang_owner', $LANG_ACCESS['owner']);
    $ownername = COM_getDisplayName($story->EditElements('owner_id'));
    $story_templates->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', 'uid = ' . $story->EditElements('owner_id')));
    $story_templates->set_var('owner_name', $ownername);
    $story_templates->set_var('owner', $ownername);
    $story_templates->set_var('owner_id', $story->EditElements('owner_id'));
    $story_templates->set_var('lang_group', $LANG_ACCESS['group']);
    $story_templates->set_var('group_dropdown', SEC_getGroupDropdown($story->EditElements('group_id'), 3));
    $story_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']);
    $story_templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']);
    $story_templates->set_var('permissions_editor', SEC_getPermissionsHTML($story->EditElements('perm_owner'), $story->EditElements('perm_group'), $story->EditElements('perm_members'), $story->EditElements('perm_anon')));
    $story_templates->set_var('permissions_msg', $LANG_ACCESS['permmsg']);
    $story_templates->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']);
    $curtime = COM_getUserDateTimeFormat($story->EditElements('date'));
    $story_templates->set_var('lang_date', $LANG24[15]);
    $story_templates->set_var('publish_second', $story->EditElements('publish_second'));
    $publish_ampm = '';
    $publish_hour = $story->EditElements('publish_hour');
    if ($publish_hour >= 12) {
        if ($publish_hour > 12) {
            $publish_hour = $publish_hour - 12;
        }
        $ampm = 'pm';
    } else {
        $ampm = 'am';
    }
    $ampm_select = COM_getAmPmFormSelection('publish_ampm', $ampm);
    $story_templates->set_var('publishampm_selection', $ampm_select);
    $month_options = COM_getMonthFormOptions($story->EditElements('publish_month'));
    $story_templates->set_var('publish_month_options', $month_options);
    $day_options = COM_getDayFormOptions($story->EditElements('publish_day'));
    $story_templates->set_var('publish_day_options', $day_options);
    $year_options = COM_getYearFormOptions($story->EditElements('publish_year'));
    $story_templates->set_var('publish_year_options', $year_options);
    if ($_CONF['hour_mode'] == 24) {
        $hour_options = COM_getHourFormOptions($story->EditElements('publish_hour'), 24);
    } else {
        $hour_options = COM_getHourFormOptions($publish_hour);
    }
    $story_templates->set_var('publish_hour_options', $hour_options);
    $minute_options = COM_getMinuteFormOptions($story->EditElements('publish_minute'));
    $story_templates->set_var('publish_minute_options', $minute_options);
    $story_templates->set_var('publish_date_explanation', $LANG24[46]);
    $story_templates->set_var('story_unixstamp', $story->EditElements('unixdate'));
    $story_templates->set_var('expire_second', $story->EditElements('expire_second'));
    $expire_ampm = '';
    $expire_hour = $story->EditElements('expire_hour');
    if ($expire_hour >= 12) {
        if ($expire_hour > 12) {
            $expire_hour = $expire_hour - 12;
        }
        $ampm = 'pm';
    } else {
        $ampm = 'am';
    }
    $ampm_select = COM_getAmPmFormSelection('expire_ampm', $ampm);
    if (empty($ampm_select)) {
        // have a hidden field to 24 hour mode to prevent JavaScript errors
        $ampm_select = '<input type="hidden" name="expire_ampm" value=""' . XHTML . '>';
    }
    $story_templates->set_var('expireampm_selection', $ampm_select);
    $month_options = COM_getMonthFormOptions($story->EditElements('expire_month'));
    $story_templates->set_var('expire_month_options', $month_options);
    $day_options = COM_getDayFormOptions($story->EditElements('expire_day'));
    $story_templates->set_var('expire_day_options', $day_options);
    $year_options = COM_getYearFormOptions($story->EditElements('expire_year'));
    $story_templates->set_var('expire_year_options', $year_options);
    if ($_CONF['hour_mode'] == 24) {
        $hour_options = COM_getHourFormOptions($story->EditElements('expire_hour'), 24);
    } else {
        $hour_options = COM_getHourFormOptions($expire_hour);
    }
    $story_templates->set_var('expire_hour_options', $hour_options);
    $minute_options = COM_getMinuteFormOptions($story->EditElements('expire_minute'));
    $story_templates->set_var('expire_minute_options', $minute_options);
    $story_templates->set_var('expire_date_explanation', $LANG24[46]);
    $story_templates->set_var('story_unixstamp', $story->EditElements('expirestamp'));
    $atopic = DB_getItem($_TABLES['topics'], 'tid', "archive_flag = 1");
    $have_archive_topic = empty($atopic) ? false : true;
    if ($story->EditElements('statuscode') == STORY_ARCHIVE_ON_EXPIRE) {
        $story_templates->set_var('is_checked2', 'checked="checked"');
        $story_templates->set_var('is_checked3', 'checked="checked"');
        $js_showarchivedisabled = 'false';
        $have_archive_topic = true;
        // force display of auto archive option
    } elseif ($story->EditElements('statuscode') == STORY_DELETE_ON_EXPIRE) {
        $story_templates->set_var('is_checked2', 'checked="checked"');
        $story_templates->set_var('is_checked4', 'checked="checked"');
        if (!$have_archive_topic) {
            $story_templates->set_var('is_checked3', 'style="display:none;"');
        }
        $js_showarchivedisabled = 'false';
    } else {
        if (!$have_archive_topic) {
            $story_templates->set_var('is_checked3', 'style="display:none;"');
        }
        $js_showarchivedisabled = 'true';
    }
    $story_templates->set_var('lang_archivetitle', $LANG24[58]);
    $story_templates->set_var('lang_option', $LANG24[59]);
    $story_templates->set_var('lang_enabled', $LANG_ADMIN['enabled']);
    $story_templates->set_var('lang_story_stats', $LANG24[87]);
    if ($have_archive_topic) {
        $story_templates->set_var('lang_optionarchive', $LANG24[61]);
    } else {
        $story_templates->set_var('lang_optionarchive', '');
    }
    $story_templates->set_var('lang_optiondelete', $LANG24[62]);
    $story_templates->set_var('lang_title', $LANG_ADMIN['title']);
    $story_templates->set_var('story_title', $story->EditElements('title'));
    $story_templates->set_var('lang_page_title', $LANG_ADMIN['page_title']);
    $story_templates->set_var('page_title', $story->EditElements('page_title'));
    $story_templates->set_var('lang_metadescription', $LANG_ADMIN['meta_description']);
    $story_templates->set_var('meta_description', $story->EditElements('meta_description'));
    $story_templates->set_var('lang_metakeywords', $LANG_ADMIN['meta_keywords']);
    $story_templates->set_var('meta_keywords', $story->EditElements('meta_keywords'));
    if ($_CONF['meta_tags'] > 0) {
        $story_templates->set_var('hide_meta', '');
    } else {
        $story_templates->set_var('hide_meta', ' style="display:none;"');
    }
    $story_templates->set_var('lang_topic', $LANG_ADMIN['topic']);
    if ($mode == 'preview') {
        $tlist = TOPIC_getTopicSelectionControl('article', '', false, true, true);
    } else {
        $tlist = TOPIC_getTopicSelectionControl('article', $oldsid, false, true, true);
    }
    if (empty($tlist)) {
        $display .= COM_showMessage(101);
        return $display;
    }
    $story_templates->set_var('topic_selection', $tlist);
    $story_templates->set_var('lang_show_topic_icon', $LANG24[56]);
    if ($story->EditElements('show_topic_icon') == 1) {
        $story_templates->set_var('show_topic_icon_checked', 'checked="checked"');
    } else {
        $story_templates->set_var('show_topic_icon_checked', '');
    }
    $story_templates->set_var('lang_cachetime', $LANG24['cache_time']);
    $story_templates->set_var('lang_cachetime_desc', $LANG24['cache_time_desc']);
    $story_templates->set_var('cache_time', $story->EditElements('cache_time'));
    $story_templates->set_var('lang_draft', $LANG24[34]);
    if ($story->EditElements('draft_flag')) {
        $story_templates->set_var('is_checked', 'checked="checked"');
    }
    $story_templates->set_var('lang_mode', $LANG24[3]);
    $story_templates->set_var('status_options', COM_optionList($_TABLES['statuscodes'], 'code,name', $story->EditElements('statuscode')));
    $story_templates->set_var('comment_options', COM_optionList($_TABLES['commentcodes'], 'code,name', $story->EditElements('commentcode')));
    $story_templates->set_var('trackback_options', COM_optionList($_TABLES['trackbackcodes'], 'code,name', $story->EditElements('trackbackcode')));
    // comment expire
    $story_templates->set_var('lang_cmt_disable', $LANG24[63]);
    if ($story->EditElements('cmt_close')) {
        $story_templates->set_var('is_checked5', 'checked="checked"');
        $js_showcmtclosedisabled = 'false';
    } else {
        $js_showcmtclosedisabled = 'true';
    }
    $month_options = COM_getMonthFormOptions($story->EditElements('cmt_close_month'));
    $story_templates->set_var('cmt_close_month_options', $month_options);
    $day_options = COM_getDayFormOptions($story->EditElements('cmt_close_day'));
    $story_templates->set_var('cmt_close_day_options', $day_options);
    // ensure that the year dropdown includes the close year
    $endtm = mktime(0, 0, 0, date('m'), date('d') + $_CONF['article_comment_close_days'], date('Y'));
    $yoffset = date('Y', $endtm) - date('Y');
    $close_year = $story->EditElements('cmt_close_year');
    if ($yoffset < -1) {
        $year_options = COM_getYearFormOptions($close_year, $yoffset);
    } elseif ($yoffset > 5) {
        $year_options = COM_getYearFormOptions($close_year, -1, $yoffset);
    } else {
        $year_options = COM_getYearFormOptions($close_year);
    }
    $story_templates->set_var('cmt_close_year_options', $year_options);
    $cmt_close_ampm = '';
    $cmt_close_hour = $story->EditElements('cmt_close_hour');
    //correct hour
    if ($cmt_close_hour >= 12) {
        if ($cmt_close_hour > 12) {
            $cmt_close_hour = $cmt_close_hour - 12;
        }
        $ampm = 'pm';
    } else {
        $ampm = 'am';
    }
    $ampm_select = COM_getAmPmFormSelection('cmt_close_ampm', $ampm);
    if (empty($ampm_select)) {
        // have a hidden field to 24 hour mode to prevent JavaScript errors
        $ampm_select = '<input type="hidden" name="cmt_close_ampm" value=""' . XHTML . '>';
    }
    $story_templates->set_var('cmt_close_ampm_selection', $ampm_select);
    if ($_CONF['hour_mode'] == 24) {
        $hour_options = COM_getHourFormOptions($story->EditElements('cmt_close_hour'), 24);
    } else {
        $hour_options = COM_getHourFormOptions($cmt_close_hour);
    }
    $story_templates->set_var('cmt_close_hour_options', $hour_options);
    $minute_options = COM_getMinuteFormOptions($story->EditElements('cmt_close_minute'));
    $story_templates->set_var('cmt_close_minute_options', $minute_options);
    $story_templates->set_var('cmt_close_second', $story->EditElements('cmt_close_second'));
    if ($_CONF['onlyrootfeatures'] == 1 && SEC_inGroup('Root') or $_CONF['onlyrootfeatures'] !== 1) {
        $featured_options = "<select name=\"featured\">" . LB . COM_optionList($_TABLES['featurecodes'], 'code,name', $story->EditElements('featured')) . "</select>" . LB;
    } else {
        $featured_options = "<input type=\"hidden\" name=\"featured\" value=\"0\"" . XHTML . ">";
    }
    $story_templates->set_var('featured_options', $featured_options);
    $story_templates->set_var('frontpage_options', COM_optionList($_TABLES['frontpagecodes'], 'code,name', $story->EditElements('frontpage')));
    $story_templates->set_var('story_introtext', $story->EditElements('introtext'));
    $story_templates->set_var('story_bodytext', $story->EditElements('bodytext'));
    $story_templates->set_var('lang_introtext', $LANG24[16]);
    $story_templates->set_var('lang_bodytext', $LANG24[17]);
    $story_templates->set_var('lang_postmode', $LANG24[4]);
    $story_templates->set_var('lang_publishoptions', $LANG24[76]);
    $story_templates->set_var('noscript', COM_getNoScript(false, $LANG24[77], sprintf($LANG24[78], $_CONF['site_admin_url'], $sid)));
    $postmode = $story->EditElements('postmode');
    if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) {
        if ($story->EditElements('advanced_editor_mode') == 1 or $story->EditElements('postmode') == 'adveditor') {
            $postmode = '';
        }
    }
    $post_options = COM_optionList($_TABLES['postmodes'], 'code,name', $postmode);
    $postmode_list = 'plaintext,html';
    // If Advanced Mode - add post option and set default if editing story created with Advanced Editor
    if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) {
        $postmode_list .= ',adveditor';
        if ($story->EditElements('advanced_editor_mode') == 1 or $story->EditElements('postmode') == 'adveditor') {
            $post_options .= '<option value="adveditor" selected="selected">' . $LANG24[86] . '</option>';
        } else {
            $post_options .= '<option value="adveditor">' . $LANG24[86] . '</option>';
        }
    }
    if ($_CONF['wikitext_editor']) {
        $postmode_list .= ',wikitext';
        if ($story->EditElements('postmode') == 'wikitext') {
            $post_options .= '<option value="wikitext" selected="selected">' . $LANG24[88] . '</option>';
        } else {
            $post_options .= '<option value="wikitext">' . $LANG24[88] . '</option>';
        }
    }
    $story_templates->set_var('post_options', $post_options);
    $postmode_array = explode(',', $postmode_list);
    $allowed_html = '';
    foreach ($postmode_array as $pm) {
        $allowed_html .= COM_allowedHTML('story.edit', false, 1, $pm);
    }
    $allowed_tags = array('code', 'raw');
    if ($_CONF['allow_page_breaks'] == 1) {
        $allowed_tags = array_merge($allowed_tags, array('page_break'));
    }
    $allowed_html .= COM_allowedAutotags(false, $allowed_tags);
    $story_templates->set_var('lang_allowed_html', $allowed_html);
    $fileinputs = '';
    $saved_images = '';
    if ($_CONF['maximagesperarticle'] > 0) {
        $story_templates->set_var('lang_images', $LANG24[47]);
        $icount = DB_count($_TABLES['article_images'], 'ai_sid', $story->getSid());
        if ($icount > 0) {
            $result_articles = DB_query("SELECT * FROM {$_TABLES['article_images']} WHERE ai_sid = '" . $story->getSid() . "'");
            for ($z = 1; $z <= $icount; $z++) {
                $I = DB_fetchArray($result_articles);
                $saved_images .= $z . ') ' . COM_createLink($I['ai_filename'], $_CONF['site_url'] . '/images/articles/' . $I['ai_filename']) . '&nbsp;&nbsp;&nbsp;' . $LANG_ADMIN['delete'] . ': <input type="checkbox" name="delete[' . $I['ai_img_num'] . ']"' . XHTML . '><br' . XHTML . '>';
            }
        }
        $newallowed = $_CONF['maximagesperarticle'] - $icount;
        for ($z = $icount + 1; $z <= $_CONF['maximagesperarticle']; $z++) {
            $fileinputs .= $z . ') <input type="file" dir="ltr" name="file' . $z . '"' . XHTML . '>';
            if ($z < $_CONF['maximagesperarticle']) {
                $fileinputs .= '<br' . XHTML . '>';
            }
        }
        $fileinputs .= '<br' . XHTML . '>' . $LANG24[51];
        if ($_CONF['allow_user_scaling'] == 1) {
            $fileinputs .= $LANG24[27];
        }
        $fileinputs .= $LANG24[28] . '<br' . XHTML . '>';
    }
    // Add JavaScript
    $_SCRIPTS->setJavaScriptFile('story_editor', '/javascript/story_editor.js');
    if ($_CONF['titletoid']) {
        $_SCRIPTS->setJavaScriptFile('title_2_id', '/javascript/title_2_id.js');
        $story_templates->set_var('titletoid', true);
    }
    $_SCRIPTS->setJavaScriptFile('postmode_control', '/javascript/postmode_control.js');
    // Loads jQuery UI datepicker and timepicker-addon
    $_SCRIPTS->setJavaScriptLibrary('jquery.ui.slider');
    //    $_SCRIPTS->setJavaScriptLibrary('jquery.ui.button');
    $_SCRIPTS->setJavaScriptLibrary('jquery.ui.datepicker');
    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-i18n');
    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon');
    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon-i18n');
    //    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-slideraccess');
    $_SCRIPTS->setJavaScriptFile('datetimepicker', '/javascript/datetimepicker.js');
    $langCode = COM_getLangIso639Code();
    $toolTip = $MESSAGE[118];
    $imgUrl = $_CONF['site_url'] . '/images/calendar.png';
    $_SCRIPTS->setJavaScript("jQuery(function () {" . "  geeklog.hour_mode = {$_CONF['hour_mode']};" . "  geeklog.datetimepicker.set('publish', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "  geeklog.datetimepicker.set('expire', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "  geeklog.datetimepicker.set('cmt_close', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "});", TRUE, TRUE);
    // Setup Advanced Editor
    COM_setupAdvancedEditor('/javascript/storyeditor_adveditor.js');
    $story_templates->set_var('saved_images', $saved_images);
    $story_templates->set_var('image_form_elements', $fileinputs);
    $story_templates->set_var('lang_hits', $LANG24[18]);
    $story_templates->set_var('story_hits', $story->EditElements('hits'));
    $story_templates->set_var('lang_comments', $LANG24[19]);
    $story_templates->set_var('story_comments', $story->EditElements('comments'));
    $story_templates->set_var('lang_trackbacks', $LANG24[29]);
    $story_templates->set_var('story_trackbacks', $story->EditElements('trackbacks'));
    $story_templates->set_var('lang_emails', $LANG24[39]);
    $story_templates->set_var('story_emails', $story->EditElements('numemails'));
    if ($mode == 'clone') {
        $story_templates->set_var('story_id', COM_makesid());
    } else {
        $story_templates->set_var('story_id', $story->getSid());
        $story_templates->set_var('old_story_id', $story->EditElements('originalSid'));
    }
    $story_templates->set_var('lang_sid', $LANG24[12]);
    $story_templates->set_var('lang_save', $LANG_ADMIN['save']);
    $story_templates->set_var('lang_preview', $LANG_ADMIN['preview']);
    $story_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $story_templates->set_var('lang_delete', $LANG_ADMIN['delete']);
    $story_templates->set_var('gltoken_name', CSRF_TOKEN);
    $token = SEC_createToken();
    $story_templates->set_var('gltoken', $token);
    $story_templates->parse('output', 'editor');
    $display .= COM_startBlock($LANG24[5], '', COM_getBlockTemplate('_admin_block', 'header'));
    $display .= SEC_getTokenExpiryNotice($token, $LANG24[91]);
    $display .= $story_templates->finish($story_templates->get_var('output'));
    $display .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $display;
}
Example #3
0
    /**
     * Returns header code (JavaScript and CSS) to include in the Head of the webpage
     *
     * @return   string
     */
    public function getHeader()
    {
        global $_CONF, $MESSAGE, $LANG_DIRECTION;
        $this->header_set = true;
        $headercode = '';
        // Sort CSS Files based on priority
        $priority = array();
        foreach ($this->css_files as $k => $d) {
            $priority[$k] = $d['priority'];
        }
        array_multisort($priority, SORT_ASC, $this->css_files);
        // See if theme uses ETag, if so load first
        if ($_CONF['theme_etag']) {
            $csslink = '<link rel="stylesheet" type="text/css" href="' . $_CONF['layout_url'] . '/style.css.php?theme=' . $_CONF['theme'] . '&amp;dir=' . $LANG_DIRECTION . '" media="all"' . XHTML . '>' . LB;
            $headercode = $csslink . $headercode;
        }
        // Set CSS Files
        foreach ($this->css_files as $file) {
            $rel = 'stylesheet';
            if (!empty($file['rel'])) {
                $rel = $file['rel'];
            }
            $type = 'text/css';
            if (!empty($file['type'])) {
                $type = $file['type'];
            }
            $href = '';
            if (!empty($file['file'])) {
                $href = $_CONF['site_url'] . $file['file'];
            }
            if (!empty($file['href'])) {
                $href = $file['href'];
            }
            if ($file['load'] && !empty($href)) {
                $csslink = '<link rel="' . $rel . '" type="' . $type . '" href="' . $href . '"' . $file['extra'] . XHTML . '>' . LB;
                if (isset($file['name']) && $file['name'] == 'theme') {
                    // load theme css first
                    $headercode = $csslink . $headercode;
                } else {
                    $headercode .= $csslink;
                }
            }
        }
        // Set CSS
        if ($this->css_set) {
            $headercode .= '<style type="text/css">' . LB;
            foreach ($this->css as $css) {
                $headercode .= $css . LB;
            }
            $headercode .= '</style>' . LB;
        }
        // Set JavaScript Library files first incase other scripts need them
        if (!$this->library_files_footer) {
            // // Do we load jQuery now?
            $headercode .= $this->setJavaScriptLibraries();
        }
        // Set JavaScript Variables (do this before file in case variables are needed)
        $iso639Code = COM_getLangIso639Code();
        $lang = array('iso639Code' => $iso639Code, 'tooltip_loading' => $MESSAGE[116], 'tooltip_not_found' => $MESSAGE[117], 'tooltip_select_date' => $MESSAGE[118], 'tabs_more' => $MESSAGE[119], 'confirm_delete' => $MESSAGE[76], 'confirm_send' => $MESSAGE[120]);
        if (!empty($this->lang)) {
            $lang = array_merge($lang, $this->lang);
        }
        $src = array('site_url' => $_CONF['site_url'], 'site_admin_url' => $_CONF['site_admin_url'], 'layout_url' => $_CONF['layout_url'], 'xhtml' => XHTML, 'lang' => $lang, 'theme_options' => $_CONF['theme_options']);
        $str = $this->_array_to_jsobj($src);
        // Strip '{' and '}' from both ends of $str
        $str = substr($str, 1);
        $str = substr($str, 0, strlen($str) - 1);
        $headercode .= <<<EOD
<script type="text/javascript">
var geeklog = {
    doc: document,
    win: window,
    \$: function (id) {
        return this.doc.getElementById(id);
    },
    {$str}
};
</script>

EOD;
        if (isset($this->scripts['header'])) {
            foreach ($this->scripts['header'] as $script) {
                $headercode .= $script . LB;
            }
        }
        // Sort JavaScript Files based on priority (this is for both header and footer)
        $priority = array();
        foreach ($this->script_files as $k => $d) {
            $priority[$k] = $d['priority'];
        }
        array_multisort($priority, SORT_ASC, $this->script_files);
        // Set JavaScript Files
        foreach ($this->script_files as $file) {
            if (!$file['footer']) {
                $headercode .= '<script type="text/javascript" src="' . $_CONF['site_url'] . $file['file'] . '"></script>' . LB;
            }
        }
        return $headercode;
    }
Example #4
0
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;
    global $LANG_USERBOX;
    $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']);
        $defaulttemplatesdirectory = COM_applyFilter($_POST['defaulttemplatesdirectory']);
        //@@@@@@
        $draft_flag = COM_applyFilter($_POST['draft_flag'], true);
        $hits = COM_applyFilter($_POST['hits'], true);
        $comments = COM_applyFilter($_POST['comments'], true);
        $commentcode = COM_applyFilter($_POST['commentcode'], true);
        $trackbackcode = COM_applyFilter($_POST['trackbackcode'], true);
        $cache_time = COM_applyFilter($_POST['cache_time'], true);
        //@@@@@
        $comment_expire_flag = COM_applyFilter($_POST['comment_expire_flag'], true);
        if ($comment_expire_flag === 0) {
            $w = mktime(0, 0, 0, date('m'), date('d') + $_CONF['article_comment_close_days'], date('Y'));
            $comment_expire_year = date('Y', $w);
            $comment_expire_month = date('m', $w);
            $comment_expire_day = date('d', $w);
            $comment_expire_hour = 0;
            $comment_expire_minute = 0;
        } else {
            $comment_expire_month = COM_applyFilter($_POST['comment_expire_month'], true);
            $comment_expire_day = COM_applyFilter($_POST['comment_expire_day'], true);
            $comment_expire_year = COM_applyFilter($_POST['comment_expire_year'], true);
            $comment_expire_hour = COM_applyFilter($_POST['comment_expire_hour'], true);
            $comment_expire_minute = COM_applyFilter($_POST['comment_expire_minute'], true);
        }
        $meta_description = COM_applyFilter($_POST['meta_description']);
        $meta_keywords = COM_applyFilter($_POST['meta_keywords']);
        $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);
        $owner_id = COM_applyFilter($_POST['owner_id'], true);
        $group_id = COM_applyFilter($_POST['group_id'], true);
        //
        $array['perm_owner'] = $_POST['perm_owner'];
        $array['perm_group'] = $_POST['perm_group'];
        $array['perm_members'] = $_POST['perm_members'];
        $array['perm_anon'] = $_POST['perm_anon'];
        if (is_array($array['perm_owner']) || is_array($array['perm_group']) || is_array($array['perm_members']) || is_array($array['perm_anon'])) {
            list($perm_owner, $perm_group, $perm_members, $perm_anon) = SEC_getPermissionValues($array['perm_owner'], $array['perm_group'], $array['perm_members'], $array['perm_anon']);
        } else {
            $perm_owner = $array['perm_owner'];
            $perm_group = $array['perm_group'];
            $perm_members = $array['perm_members'];
            $perm_anon = $array['perm_anon'];
        }
        //編集日
        $modified_autoupdate = COM_applyFilter($_POST['modified_autoupdate'], true);
        $modified_month = COM_applyFilter($_POST['modified_month'], true);
        $modified_day = COM_applyFilter($_POST['modified_day'], true);
        $modified_year = COM_applyFilter($_POST['modified_year'], true);
        $modified_hour = COM_applyFilter($_POST['modified_hour'], true);
        $modified_minute = COM_applyFilter($_POST['modified_minute'], true);
        //公開日
        $released_month = COM_applyFilter($_POST['released_month'], true);
        $released_day = COM_applyFilter($_POST['released_day'], true);
        $released_year = COM_applyFilter($_POST['released_year'], true);
        $released_hour = COM_applyFilter($_POST['released_hour'], true);
        $released_minute = COM_applyFilter($_POST['released_minute'], true);
        //公開終了日
        $expired_available = COM_applyFilter($_POST['expired_available'], true);
        $expired_flag = COM_applyFilter($_POST['expired_flag'], true);
        if ($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_month = COM_applyFilter($_POST['expired_month'], true);
            $expired_day = COM_applyFilter($_POST['expired_day'], true);
            $expired_year = COM_applyFilter($_POST['expired_year'], true);
            $expired_hour = COM_applyFilter($_POST['expired_hour'], true);
            $expired_minute = COM_applyFilter($_POST['expired_minute'], true);
        }
        //作成日付
        $created = COM_applyFilter($_POST['created']);
        $created_un = COM_applyFilter($_POST['created_un']);
        $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 .= " ,t1.username";
        $sql .= " ,t1.fullname";
        $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 .= " 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']);
        $defaulttemplatesdirectory = COM_stripslashes($A['defaulttemplatesdirectory']);
        $hits = COM_stripslashes($A['hits']);
        $comments = COM_stripslashes($A['comments']);
        $comment_expire = COM_stripslashes($A['comment_expire']);
        if ($comment_expire === "0000-00-00 00:00:00") {
            $comment_expire_flag = 0;
            $w = mktime(0, 0, 0, date('m'), date('d') + $_CONF['article_comment_close_days'], date('Y'));
            $comment_expire_year = date('Y', $w);
            $comment_expire_month = date('m', $w);
            $comment_expire_day = date('d', $w);
            $comment_expire_hour = 0;
            $comment_expire_minute = 0;
        } else {
            $comment_expire_flag = 1;
            $wary = COM_getUserDateTimeFormat(COM_stripslashes($A['comment_expire_un']));
            $comment_expire = $wary[1];
            $comment_expire_year = date('Y', $comment_expire);
            $comment_expire_month = date('m', $comment_expire);
            $comment_expire_day = date('d', $comment_expire);
            $comment_expire_hour = date('H', $comment_expire);
            $comment_expire_minute = date('i', $comment_expire);
        }
        $commentcode = COM_stripslashes($A['commentcode']);
        $trackbackcode = COM_stripslashes($A['trackbackcode']);
        $cache_time = COM_stripslashes($A['cache_time']);
        $meta_description = COM_stripslashes($A['meta_description']);
        $meta_keywords = COM_stripslashes($A['meta_keywords']);
        $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 = strtotime(COM_stripslashes($A['modified']));
        $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 = strtotime(COM_stripslashes($A['released']));
        $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];
        if ($edt_flg == FALSE) {
            $delflg = true;
        }
    }
    //template フォルダ
    $tmplfld = DATABOX_templatePath('admin', 'default', $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file(array('editor' => 'profile_editor.thtml', 'row' => 'row.thtml', 'col' => "profile_col_detail.thtml"));
    // Add JavaScript geeklog >=2.1.0
    // Loads jQuery UI datepicker and timepicker-addon
    $_SCRIPTS->setJavaScriptLibrary('jquery.ui.slider');
    //    $_SCRIPTS->setJavaScriptLibrary('jquery.ui.button');
    $_SCRIPTS->setJavaScriptLibrary('jquery.ui.datepicker');
    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-i18n');
    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon');
    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon-i18n');
    //    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-slideraccess');
    $_SCRIPTS->setJavaScriptFile('datetimepicker', '/javascript/datetimepicker.js');
    $_SCRIPTS->setJavaScriptFile('datepicker', '/javascript/datepicker.js');
    $langCode = COM_getLangIso639Code();
    $toolTip = $MESSAGE[118];
    $imgUrl = $_CONF['site_url'] . '/images/calendar.png';
    $_SCRIPTS->setJavaScript("jQuery(function () {" . "  geeklog.hour_mode = {$_CONF['hour_mode']};" . "  geeklog.datetimepicker.set('comment_expire', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "  geeklog.datetimepicker.set('modified', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "  geeklog.datetimepicker.set('released', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "  geeklog.datetimepicker.set('expired', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "});", TRUE, TRUE);
    //--
    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('maxlength_meta_description', $_USERBOX_CONF['maxlength_meta_description']);
    $templates->set_var('maxlength_meta_keywords', $_USERBOX_CONF['maxlength_meta_keywords']);
    $templates->set_var('about_thispage', $LANG_USERBOX_ADMIN['about_admin_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_ref', $LANG_USERBOX_ADMIN['ref']);
    $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']);
    //ビューリンク@@@@@
    $url = $_CONF['site_url'] . "/userbox/profile.php";
    $url .= "?";
    if ($_USERBOX_CONF['datacode']) {
        $url .= "code=" . $A['username'];
        $url .= "&m=code";
    } else {
        $url .= "id=" . $A['id'];
        $url .= "&m=id";
    }
    $url = COM_buildUrl($url);
    $view = COM_createLink($LANG_USERBOX['view'], $url);
    $templates->set_var('view', $view);
    //
    $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);
    //下書
    $templates->set_var('lang_draft', $LANG_USERBOX_ADMIN['draft']);
    if ($draft_flag == 1) {
        $templates->set_var('draft_flag', "checked=checked");
    } else {
        $templates->set_var('draft_flag', "");
    }
    //
    $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);
    //$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_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);
    $templates->set_var('lang_defaulttemplatesdirectory', $LANG_USERBOX_ADMIN['defaulttemplatesdirectory']);
    $templates->set_var('defaulttemplatesdirectory', $defaulttemplatesdirectory);
    $select_defaulttemplatesdirectory = fnctemplatesdirectory($defaulttemplatesdirectory);
    $templates->set_var('select_defaulttemplatesdirectory', $select_defaulttemplatesdirectory);
    //@@@@@
    //meta_description
    $templates->set_var('lang_meta_description', $LANG_USERBOX_ADMIN['meta_description']);
    $templates->set_var('meta_description', $meta_description);
    //meta_keywords
    $templates->set_var('lang_meta_keywords', $LANG_USERBOX_ADMIN['meta_keywords']);
    $templates->set_var('meta_keywords', $meta_keywords);
    //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);
    //@@@@@
    //hits
    $templates->set_var('lang_hits', $LANG_USERBOX_ADMIN['hits']);
    $templates->set_var('hits', $hits);
    //comments
    $templates->set_var('lang_comments', $LANG_USERBOX_ADMIN['comments']);
    $templates->set_var('comments', $comments);
    //commentcode
    $templates->set_var('lang_commentcode', $LANG_USERBOX_ADMIN['commentcode']);
    $templates->set_var('commentcode', $commentcode);
    $optionlist_commentcode = COM_optionList($_TABLES['commentcodes'], 'code,name', $commentcode);
    $templates->set_var('optionlist_commentcode', $optionlist_commentcode);
    //trackbackcode
    $templates->set_var('lang_trackbackcode', $LANG_USERBOX_ADMIN['trackbackcode']);
    $templates->set_var('trackbackcode', $trackbackcode);
    $optionlist_trackbackcode = COM_optionList($_TABLES['trackbackcodes'], 'code,name', $trackbackcode);
    $templates->set_var('optionlist_trackbackcode', $optionlist_trackbackcode);
    $templates->set_var('lang_cache_time', $LANG_USERBOX_ADMIN['cache_time']);
    $templates->set_var('lang_cache_time_desc', $LANG_USERBOX_ADMIN['cache_time_desc']);
    $templates->set_var('cache_time', $cache_time);
    //comment_expire
    $templates->set_var('lang_enabled', $LANG_USERBOX_ADMIN['enabled']);
    if ($comment_expire_flag === 0) {
        $templates->set_var('show_comment_expire', 'false');
        $templates->set_var('is_checked_comment_expire', '');
    } else {
        $templates->set_var('show_comment_expire', 'true');
        $templates->set_var('is_checked_comment_expire', 'checked="checked"');
    }
    $templates->set_var('lang_comment_expire', $LANG_USERBOX_ADMIN['comment_expire']);
    $w = COM_convertDate2Timestamp($comment_expire_year . "-" . $comment_expire_month . "-" . $comment_expire_day, $comment_expire_hour . ":" . $comment_expire_minute . "::00");
    $datetime_comment_expire = DATABOX_datetimeedit($w, "LANG_USERBOX_ADMIN", "comment_expire");
    $templates->set_var('datetime_comment_expire', $datetime_comment_expire);
    //編集日
    $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_USERBOX_ADMIN", "modified");
    $templates->set_var('datetime_modified', $datetime_modified);
    //公開日
    $templates->set_var('lang_released', $LANG_USERBOX_ADMIN['released']);
    $w = COM_convertDate2Timestamp($released_year . "-" . $released_month . "-" . $released_day, $released_hour . ":" . $released_minute . "::00");
    $datetime_released = DATABOX_datetimeedit($w, "LANG_USERBOX_ADMIN", "released");
    $templates->set_var('datetime_released', $datetime_released);
    //公開終了日
    $templates->set_var('lang_expired', $LANG_USERBOX_ADMIN['expired']);
    //if ($expired=="0000-00-00 00:00:00"){
    if ($expired_flag == 0) {
        $templates->set_var('show_expired', 'false');
        $templates->set_var('is_checked_expired', '');
    } else {
        $templates->set_var('show_expired', 'true');
        $templates->set_var('is_checked_expired', 'checked="expired"');
    }
    $templates->set_var('lang_expired', $LANG_USERBOX_ADMIN['expired']);
    $w = COM_convertDate2Timestamp($expired_year . "-" . $expired_month . "-" . $expired_day, $expired_hour . ":" . $expired_minute . "::00");
    $datetime_expired = DATABOX_datetimeedit($w, "LANG_USERBOX_ADMIN", "expired");
    $templates->set_var('datetime_expired', $datetime_expired);
    //順序
    $templates->set_var('lang_orderno', $LANG_USERBOX_ADMIN['orderno']);
    $templates->set_var('orderno', $orderno);
    //koko
    //カテゴリ
    $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, 9999, $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);
    $templates->set_var('created_un', $created_un);
    //アクセス権
    $templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
    $templates->set_var('lang_owner', $LANG_ACCESS['owner']);
    $owner_name = COM_getDisplayName($owner_id);
    $templates->set_var('owner_name', $owner_name);
    $templates->set_var('owner_id', $owner_id);
    $templates->set_var('lang_group', $LANG_ACCESS['group']);
    $templates->set_var('group_dropdown', SEC_getGroupDropdown($group_id, 3));
    $templates->set_var('lang_permissions', $LANG_ACCESS['permissions']);
    $templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']);
    $templates->set_var('permissions_editor', SEC_getPermissionsHTML($perm_owner, $perm_group, $perm_members, $perm_anon));
    $templates->set_var('permissions_msg', $LANG_ACCESS['permmsg']);
    $templates->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']);
    // 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
    //$delflg=false;//@@@@@ 削除不可
    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'));
    return $retval;
}
Example #5
0
/**
* Shows event editor
*
* @param    string  $mode   Indicates if this is a submission or a regular entry
* @param    array   $A      array holding the event's details
* @param    string  $msg    an optional error message to display
* @return   string          HTML for event editor or error message
*
*/
function CALENDAR_editEvent($mode, $A, $msg = '')
{
    global $_CONF, $_GROUPS, $_TABLES, $_USER, $_CA_CONF, $LANG_CAL_1, $LANG_CAL_ADMIN, $LANG10, $LANG12, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE, $_SCRIPTS;
    // Loads jQuery UI datepicker and timepicker-addon
    $_SCRIPTS->setJavaScriptLibrary('jquery.ui.slider');
    $_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('datetimepicker', '/javascript/datetimepicker.js');
    // Add JavaScript
    $_SCRIPTS->setJavaScriptFile('postmode_control', '/javascript/postmode_control.js');
    $langCode = COM_getLangIso639Code();
    $toolTip = $MESSAGE[118];
    $imgUrl = $_CONF['site_url'] . '/images/calendar.png';
    $_SCRIPTS->setJavaScript("jQuery(function () {" . "  geeklog.hour_mode = {$_CONF['hour_mode']};" . "  geeklog.datetimepicker.options.stepMinute = 15;" . "  geeklog.datetimepicker.set('start', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "  geeklog.datetimepicker.set('end', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "});", TRUE, TRUE);
    $retval = '';
    if (!empty($msg)) {
        $retval .= COM_showMessageText($msg, $LANG_CAL_ADMIN[2]);
    }
    $event_templates = COM_newTemplate(CTL_plugin_templatePath('calendar', 'admin'));
    $event_templates->set_file('editor', 'eventeditor.thtml');
    $allowed = '';
    foreach (array('plaintext', 'html') as $pm) {
        $allowed .= COM_allowedHTML('calendar.edit', false, 1, $pm);
    }
    $allowed .= COM_allowedAutotags();
    $event_templates->set_var('lang_allowed_html', $allowed);
    $event_templates->set_var('lang_postmode', $LANG_CAL_ADMIN[3]);
    if ($mode != 'editsubmission' and !empty($A['eid'])) {
        // Get what level of access user has to this object
        $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']);
        if ($access == 0 or $access == 2) {
            // Uh, oh!  User doesn't have access to this object
            $retval .= COM_showMessageText($LANG_CAL_ADMIN[17], $LANG_ACCESS['accessdenied']);
            COM_accessLog("User {$_USER['username']} tried to illegally submit or edit event {$eid}.");
            return $retval;
        }
    } else {
        if (empty($A['owner_id'])) {
            $A['owner_id'] = $_USER['uid'];
        }
        if (isset($_GROUPS['Calendar Admin'])) {
            $A['group_id'] = $_GROUPS['Calendar Admin'];
        } else {
            $A['group_id'] = SEC_getFeatureGroup('calendar.edit');
        }
        SEC_setDefaultPermissions($A, $_CA_CONF['default_permissions']);
        $access = 3;
    }
    if ($mode == 'editsubmission') {
        $event_templates->set_var('post_options', COM_optionList($_TABLES['postmodes'], 'code,name', 'plaintext'));
    } else {
        if (!isset($A['postmode'])) {
            $A['postmode'] = $_CONF['postmode'];
        }
        $event_templates->set_var('post_options', COM_optionList($_TABLES['postmodes'], 'code,name', $A['postmode']));
    }
    $token = SEC_createToken();
    $retval .= COM_startBlock($LANG_CAL_ADMIN[1], '', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= SEC_getTokenExpiryNotice($token);
    if (!empty($A['eid'])) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $event_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        $event_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
        $event_templates->set_var('allow_delete', true);
        $event_templates->set_var('lang_delete', $LANG_ADMIN['delete']);
        $event_templates->set_var('confirm_message', $MESSAGE[76]);
        if ($mode == 'editsubmission') {
            $event_templates->set_var('submission_option', '<input type="hidden" name="type" value="submission"' . XHTML . '>');
        }
    } else {
        // new event
        $A['eid'] = COM_makesid();
        $A['title'] = '';
        $A['description'] = '';
        $A['url'] = '';
        $A['hits'] = 0;
        // in case a start date/time has been passed from the calendar,
        // pick it up for the end date/time
        if (empty($A['dateend'])) {
            $A['dateend'] = $A['datestart'];
        }
        if (empty($A['timeend'])) {
            $A['timeend'] = $A['timestart'];
        }
        $A['event_type'] = '';
        $A['location'] = '';
        $A['address1'] = '';
        $A['address2'] = '';
        $A['city'] = '';
        $A['state'] = '';
        $A['zipcode'] = '';
        $A['allday'] = 0;
    }
    $event_templates->set_var('lang_eventid', $LANG_CAL_ADMIN[34]);
    $event_templates->set_var('event_id', $A['eid']);
    $event_templates->set_var('lang_eventtitle', $LANG_ADMIN['title']);
    $A['title'] = str_replace('{', '&#123;', $A['title']);
    $A['title'] = str_replace('}', '&#125;', $A['title']);
    $A['title'] = str_replace('"', '&quot;', $A['title']);
    $event_templates->set_var('event_title', stripslashes($A['title']));
    $event_templates->set_var('lang_eventtype', $LANG_CAL_1[37]);
    $event_templates->set_var('lang_editeventtypes', $LANG12[50]);
    $event_templates->set_var('type_options', CALENDAR_eventTypeList($A['event_type']));
    $event_templates->set_var('lang_eventurl', $LANG_CAL_ADMIN[4]);
    $event_templates->set_var('max_url_length', 255);
    $event_templates->set_var('event_url', $A['url']);
    $event_templates->set_var('lang_includehttp', $LANG_CAL_ADMIN[9]);
    $event_templates->set_var('lang_eventstartdate', $LANG_CAL_ADMIN[5]);
    //$event_templates->set_var('event_startdate', $A['datestart']);
    $event_templates->set_var('lang_starttime', $LANG_CAL_1[30]);
    // Combine date/time for easier manipulation
    $A['datestart'] = trim($A['datestart'] . ' ' . $A['timestart']);
    if (empty($A['datestart'])) {
        $start_stamp = time();
    } else {
        $start_stamp = strtotime($A['datestart']);
    }
    $A['dateend'] = trim($A['dateend'] . ' ' . $A['timeend']);
    if (empty($A['dateend'])) {
        $end_stamp = time();
    } else {
        $end_stamp = strtotime($A['dateend']);
    }
    $start_month = date('m', $start_stamp);
    $start_day = date('d', $start_stamp);
    $start_year = date('Y', $start_stamp);
    $end_month = date('m', $end_stamp);
    $end_day = date('d', $end_stamp);
    $end_year = date('Y', $end_stamp);
    $start_hour = date('H', $start_stamp);
    $start_minute = intval(date('i', $start_stamp) / 15) * 15;
    if ($start_hour >= 12) {
        $startampm = 'pm';
    } else {
        $startampm = 'am';
    }
    $start_hour_24 = $start_hour % 24;
    if ($start_hour > 12) {
        $start_hour = $start_hour - 12;
    } else {
        if ($start_hour == 0) {
            $start_hour = 12;
        }
    }
    $end_hour = date('H', $end_stamp);
    $end_minute = intval(date('i', $end_stamp) / 15) * 15;
    if ($end_hour >= 12) {
        $endampm = 'pm';
    } else {
        $endampm = 'am';
    }
    $end_hour_24 = $end_hour % 24;
    if ($end_hour > 12) {
        $end_hour = $end_hour - 12;
    } else {
        if ($end_hour == 0) {
            $end_hour = 12;
        }
    }
    $month_options = COM_getMonthFormOptions($start_month);
    $event_templates->set_var('startmonth_options', $month_options);
    $month_options = COM_getMonthFormOptions($end_month);
    $event_templates->set_var('endmonth_options', $month_options);
    $day_options = COM_getDayFormOptions($start_day);
    $event_templates->set_var('startday_options', $day_options);
    $day_options = COM_getDayFormOptions($end_day);
    $event_templates->set_var('endday_options', $day_options);
    $year_options = COM_getYearFormOptions($start_year);
    $event_templates->set_var('startyear_options', $year_options);
    $year_options = COM_getYearFormOptions($end_year);
    $event_templates->set_var('endyear_options', $year_options);
    if (isset($_CA_CONF['hour_mode']) && $_CA_CONF['hour_mode'] == 24) {
        $hour_options = COM_getHourFormOptions($start_hour_24, 24);
        $event_templates->set_var('starthour_options', $hour_options);
        $hour_options = COM_getHourFormOptions($end_hour_24, 24);
        $event_templates->set_var('endhour_options', $hour_options);
        $event_templates->set_var('hour_mode', 24);
    } else {
        $hour_options = COM_getHourFormOptions($start_hour);
        $event_templates->set_var('starthour_options', $hour_options);
        $hour_options = COM_getHourFormOptions($end_hour);
        $event_templates->set_var('endhour_options', $hour_options);
        $event_templates->set_var('hour_mode', 12);
    }
    $event_templates->set_var('startampm_selection', COM_getAmPmFormSelection('start_ampm', $startampm));
    $event_templates->set_var('endampm_selection', COM_getAmPmFormSelection('end_ampm', $endampm));
    $event_templates->set_var('startminute_options', COM_getMinuteFormOptions($start_minute, 15));
    $event_templates->set_var('endminute_options', COM_getMinuteFormOptions($end_minute, 15));
    $event_templates->set_var('lang_enddate', $LANG12[13]);
    $event_templates->set_var('lang_eventenddate', $LANG_CAL_ADMIN[6]);
    $event_templates->set_var('event_enddate', $A['dateend']);
    $event_templates->set_var('lang_enddate', $LANG12[13]);
    $event_templates->set_var('lang_endtime', $LANG_CAL_1[29]);
    $event_templates->set_var('lang_alldayevent', $LANG_CAL_1[31]);
    if ($A['allday'] == 1) {
        $event_templates->set_var('allday_checked', 'checked="checked"');
    }
    $event_templates->set_var('lang_location', $LANG12[51]);
    $event_templates->set_var('event_location', stripslashes($A['location']));
    $event_templates->set_var('lang_addressline1', $LANG12[44]);
    $event_templates->set_var('event_address1', stripslashes($A['address1']));
    $event_templates->set_var('lang_addressline2', $LANG12[45]);
    $event_templates->set_var('event_address2', stripslashes($A['address2']));
    $event_templates->set_var('lang_city', $LANG12[46]);
    $event_templates->set_var('event_city', stripslashes($A['city']));
    $event_templates->set_var('lang_state', $LANG12[47]);
    $event_templates->set_var('state_options', '');
    $event_templates->set_var('event_state', stripslashes($A['state']));
    $event_templates->set_var('lang_zipcode', $LANG12[48]);
    $event_templates->set_var('event_zipcode', $A['zipcode']);
    $event_templates->set_var('lang_eventlocation', $LANG_CAL_ADMIN[7]);
    $event_templates->set_var('event_location', stripslashes($A['location']));
    $event_templates->set_var('lang_eventdescription', $LANG_CAL_ADMIN[8]);
    $event_templates->set_var('event_description', stripslashes($A['description']));
    $event_templates->set_var('lang_hits', $LANG10[30]);
    $event_templates->set_var('hits', COM_numberFormat($A['hits']));
    $event_templates->set_var('lang_save', $LANG_ADMIN['save']);
    $event_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    // user access info
    $event_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
    $event_templates->set_var('lang_owner', $LANG_ACCESS['owner']);
    $ownername = COM_getDisplayName($A['owner_id']);
    $event_templates->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}"));
    $event_templates->set_var('owner_name', $ownername);
    $event_templates->set_var('owner', $ownername);
    $event_templates->set_var('owner_id', $A['owner_id']);
    $event_templates->set_var('lang_group', $LANG_ACCESS['group']);
    $event_templates->set_var('group_dropdown', SEC_getGroupDropdown($A['group_id'], $access));
    $event_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']);
    $event_templates->set_var('lang_permissionskey', $LANG_ACCESS['permissionskey']);
    $event_templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']);
    $event_templates->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']));
    $event_templates->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']);
    $event_templates->set_var('gltoken_name', CSRF_TOKEN);
    $event_templates->set_var('gltoken', $token);
    $event_templates->parse('output', 'editor');
    $retval .= $event_templates->finish($event_templates->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
Example #6
0
$_FM_CONF = array('_comment' => 'IMPORTANT : go to the wiki page to know about options configuration https://github.com/simogeo/Filemanager/wiki/Filemanager-configuration-file', 'options' => array('culture' => 'en', 'lang' => 'php', 'theme' => 'flat-dark', 'defaultViewMode' => 'grid', 'autoload' => true, 'showFullPath' => false, 'showTitleAttr' => false, 'browseOnly' => false, 'showConfirmation' => true, 'showThumbs' => true, 'generateThumbnails' => true, 'searchBox' => true, 'listFiles' => true, 'fileSorting' => 'default', 'chars_only_latin' => true, 'dateFormat' => 'd M Y H:i', 'serverRoot' => true, 'fileRoot' => false, 'baseUrl' => false, 'logger' => false, 'capabilities' => array('select', 'download', 'rename', 'delete', 'replace'), 'plugins' => array()), 'security' => array('allowFolderDownload' => false, 'allowChangeExtensions' => false, 'allowNoExtension' => false, 'uploadPolicy' => 'DISALLOW_ALL', 'uploadRestrictions' => array('jpg', 'jpe', 'jpeg', 'gif', 'png', 'svg', 'txt', 'pdf', 'odp', 'ods', 'odt', 'rtf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'csv', 'ogv', 'mp4', 'webm', 'm4v', 'ogg', 'mp3', 'wav', 'zip', 'rar')), 'upload' => array('multiple' => true, 'number' => 5, 'overwrite' => false, 'imagesOnly' => false, 'fileSizeLimit' => 16), 'exclude' => array('unallowed_files' => array('.htaccess', 'web.config'), 'unallowed_dirs' => array('_thumbs', '.CDN_ACCESS_LOGS', 'cloudservers'), 'unallowed_files_REGEXP' => '/^\\./uis', 'unallowed_dirs_REGEXP' => '/^\\./uis'), 'images' => array('imagesExt' => array('jpg', 'jpe', 'jpeg', 'gif', 'png', 'svg'), 'resize' => array('enabled' => true, 'maxWidth' => 1280, 'maxHeight' => 1024)), 'videos' => array('showVideoPlayer' => true, 'videosExt' => array('ogv', 'mp4', 'webm', 'm4v'), 'videosPlayerWidth' => 400, 'videosPlayerHeight' => 222), 'audios' => array('showAudioPlayer' => true, 'audiosExt' => array('ogg', 'mp3', 'wav')), 'pdfs' => array('showPdfReader' => true, 'pdfsExt' => array('pdf', 'odp'), 'pdfsReaderWidth' => 640, 'pdfsReaderHeight' => 480), 'edit' => array('enabled' => true, 'lineNumbers' => true, 'lineWrapping' => true, 'codeHighlight' => false, 'theme' => 'elegant', 'editExt' => array('txt', 'csv')), 'customScrollbar' => array('enabled' => true, 'theme' => 'inset-2-dark', 'button' => true), 'extras' => array('extra_js' => array(), 'extra_js_async' => true), 'icons' => array('path' => 'images/fileicons/', 'directory' => '_Open.png', 'default' => 'default.png'), 'url' => 'https://github.com/simogeo/Filemanager', 'version' => '2.0.0-dev');
// Values to be overridden by Geeklog (system)
$relPaths = array('Image' => 'images/library/Image/', 'Flash' => 'images/library/Flash/', 'Media' => 'images/library/Media/', 'File' => 'images/library/File/', 'Root' => 'images/');
$type = isset($_GET['Type']) ? COM_applyFilter($_GET['Type']) : '';
if (!array_key_exists($type, $relPaths)) {
    $type = 'Image';
}
$fileRoot = $_CONF['path_html'] . $relPaths[$type];
$fileRoot = str_replace('\\', '/', $fileRoot);
if (preg_match('@\\Ahttps?://[^/]+(/.*/)filemanager/index\\.php@i', COM_getCurrentURL(), $match)) {
    $relPath = $match[1];
} else {
    $relPath = '/';
}
$relPath .= $relPaths[$type];
$_FM_CONF['options']['culture'] = COM_getLangIso639Code();
$_FM_CONF['options']['defaultViewMode'] = $_CONF['filemanager_default_view_mode'];
$_FM_CONF['options']['browseOnly'] = $_CONF['filemanager_browse_only'];
$_FM_CONF['options']['showConfirmation'] = $_CONF['filemanager_show_confirmation'];
$_FM_CONF['options']['showThumbs'] = $_CONF['filemanager_show_thumbs'];
$_FM_CONF['options']['generateThumbnails'] = $_CONF['filemanager_generate_thumbnails'];
$_FM_CONF['options']['searchBox'] = $_CONF['filemanager_search_box'];
$_FM_CONF['options']['fileSorting'] = $_CONF['filemanager_file_sorting'];
$_FM_CONF['options']['chars_only_latin'] = $_CONF['filemanager_chars_only_latin'];
$_FM_CONF['options']['dateFormat'] = $_CONF['filemanager_date_format'];
$_FM_CONF['options']['serverRoot'] = false;
$_FM_CONF['options']['fileRoot'] = $fileRoot;
$_FM_CONF['options']['baseUrl'] = $relPath;
$_FM_CONF['options']['logger'] = $_CONF['filemanager_logger'];
if ($_CONF['filemanager_logger']) {
    $_FM_CONF['options']['logfile'] = $_CONF['path'] . 'logs/error.log';
Example #7
0
function fncEdit($id, $edt_flg, $msg = '', $errmsg = "", $mode = "edit", $fieldset_id = 0, $template = "", $old_mode = "")
{
    $pi_name = "databox";
    global $_CONF;
    global $_TABLES;
    global $LANG_DATABOX_ADMIN;
    global $LANG_ADMIN;
    global $MESSAGE;
    global $LANG_ACCESS;
    global $_DATABOX_CONF;
    global $_USER;
    global $_SCRIPTS;
    $retval = '';
    $delflg = false;
    $addition_def = DATABOX_getadditiondef();
    //メッセージ表示
    if (!empty($msg)) {
        $retval .= COM_showMessage($msg, $pi_name);
        $retval .= $errmsg;
        // clean 'em up
        $code = COM_applyFilter($_POST['code']);
        $title = COM_stripslashes($_POST['title']);
        $page_title = COM_applyFilter($_POST['page_title']);
        $description = $_POST['description'];
        //COM_applyFilter($_POST['description']);
        $draft_flag = COM_applyFilter($_POST['draft_flag'], true);
        $cache_time = COM_applyFilter($_POST['cache_time'], 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 = COM_applyFilter($_POST['created']);
        $created_un = COM_applyFilter($_POST['created_un']);
        $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 {
        if (empty($id)) {
            $fieldset_name = DB_getItem($_TABLES['DATABOX_def_fieldset'], "name", "fieldset_id=" . $fieldset_id);
            $fieldset_name = COM_stripslashes($fieldset_name);
            $id = 0;
            $code = "";
            $title = "";
            $description = "";
            $language_id = "";
            $category = "";
            $additionfields = array();
            $additionfields_fnm = array();
            //@@@@@
            $additionfields_del = array();
            $additionfields_date = "";
            $additionfields = DATABOX_getadditiondatas(0, $pi_name);
            //
            $draft_flag = $_DATABOX_CONF['user_draft_default'];
            $cache_time = $_DATABOX_CONF['default_cache_time'];
            //作成日付
            $created = 0;
            $created_un = 0;
            $uuid = 0;
            $udatetime = "";
            //"";
            $defaulttemplatesdirectory = "";
        } else {
            $sql = "SELECT ";
            $sql .= " t.*" . LB;
            $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 .= " FROM ";
            $sql .= $_TABLES['DATABOX_base'] . " AS t " . LB;
            $sql .= "," . $_TABLES['DATABOX_def_fieldset'] . " AS t2 " . LB;
            $sql .= " WHERE " . LB;
            $sql .= " id = {$id}" . LB;
            $sql .= " AND t.fieldset_id = t2.fieldset_id" . LB;
            //編集権のないデータ はのぞく//@@@@@
            $sql .= COM_getPermSql('AND', 0, 3);
            $result = DB_query($sql);
            $A = DB_fetchArray($result);
            $A = array_map('stripslashes', $A);
            $fieldset_id = COM_stripslashes($A['fieldset_id']);
            $fieldset_name = COM_stripslashes($A['fieldset_name']);
            $code = COM_stripslashes($A['code']);
            $title = COM_stripslashes($A['title']);
            $page_title = COM_stripslashes($A['page_title']);
            $description = COM_stripslashes($A['description']);
            $language_id = COM_stripslashes($A['language_id']);
            $category = DATABOX_getdatas("category_id", $_TABLES['DATABOX_category'], "id = {$id}");
            //追加項目
            $additionfields = DATABOX_getadditiondatas($id, $pi_name);
            $additionfields_fnm = array();
            //@@@@@
            $additionfields_del = array();
            $additionfields_date = "";
            $draft_flag = COM_stripslashes($A['draft_flag']);
            $cache_time = COM_stripslashes($A['cache_time']);
            //編集日
            $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['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 ($_DATABOX_CONF['allow_data_delete']) {
                if ($edt_flg == FALSE) {
                    $delflg = true;
                }
            }
        }
    }
    if ($mode === "copy") {
        $id = 0;
        $draft_flag = $_DATABOX_CONF['user_draft_default'];
        $code = "";
        //作成日付
        $created = 0;
        $created_un = 0;
        //公開日
        $released_month = $modified_month;
        $released_day = $modified_day;
        $released_year = $modified_year;
        $released_hour = $modified_hour;
        $released_minute = $modified_minute;
        //公開終了日
        $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;
        //
        $delflg = false;
        $old_mode = "copy";
    }
    $chk_user = DATABOX_chkuser($group_id, $owner_id, "databox.admin");
    //template フォルダ
    if (is_null($template) or $template === "") {
        $set_defaulttemplatesdirectory = DB_getItem($_TABLES['DATABOX_def_fieldset'], "defaulttemplatesdirectory", "fieldset_id=" . $fieldset_id);
        if ($defaulttemplatesdirectory != "") {
            $template = $defaulttemplatesdirectory;
        } elseif ($set_defaulttemplatesdirectory != "") {
            $template = $set_defaulttemplatesdirectory;
        } else {
            $template = "default";
        }
    }
    $tmplfld = DATABOX_templatePath('mydata', $template, 'databox');
    $templates = new Template($tmplfld);
    $templates->set_file('editor', "data_editor.thtml");
    $templates->set_file(array('editor' => 'data_editor.thtml', 'row' => 'row.thtml', 'col' => "data_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('datetimepicker', '/javascript/datetimepicker.js');
    $_SCRIPTS->setJavaScriptFile('datepicker', '/javascript/datepicker.js');
    $langCode = COM_getLangIso639Code();
    $toolTip = $MESSAGE[118];
    $imgUrl = $_CONF['site_url'] . '/images/calendar.png';
    //--
    if ($_CONF['meta_tags'] > 0 && $_DATABOX_CONF['meta_tags'] > 0) {
        $templates->set_var('hide_meta', '');
    } else {
        $templates->set_var('hide_meta', ' style="display:none;"');
    }
    $templates->set_var('maxlength_description', $_DATABOX_CONF['maxlength_description']);
    $templates->set_var('about_thispage', $LANG_DATABOX_ADMIN['about_admin_data']);
    $templates->set_var('lang_must', $LANG_DATABOX_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_DATABOX_ADMIN['view']);
    $templates->set_var('dateformat', $_DATABOX_CONF['dateformat']);
    $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;
    $script .= "?template=" . $template;
    $templates->set_var('script', $script);
    //
    $templates->set_var('lang_link_admin', $LANG_DATABOX_ADMIN['link_admin']);
    $templates->set_var('lang_link_admin_top', $LANG_DATABOX_ADMIN['link_admin_top']);
    $templates->set_var('lang_link_public', $LANG_DATABOX_ADMIN['link_public']);
    $templates->set_var('lang_link_list', $LANG_DATABOX_ADMIN['link_list']);
    $templates->set_var('lang_link_detail', $LANG_DATABOX_ADMIN['link_detail']);
    //field_id
    $templates->set_var('lang_fieldset', $LANG_DATABOX_ADMIN['fieldset']);
    $templates->set_var('fieldset_id', $fieldset_id);
    $templates->set_var('fieldset_name', $fieldset_name);
    //id
    $templates->set_var('lang_id', $LANG_DATABOX_ADMIN['id']);
    //@@@@@ $templates->set_var('help_id', $LANG_DATABOX_ADMIN['help']);
    $templates->set_var('id', $id);
    //下書
    $templates->set_var('lang_draft', $LANG_DATABOX_ADMIN['draft']);
    if ($draft_flag == 1) {
        $templates->set_var('draft_flag', "checked=checked");
        $templates->set_var('draft_msg', $LANG_DATABOX_ADMIN['draft_msg']);
    } else {
        $templates->set_var('draft_flag', "");
        $templates->set_var('draft_msg', "");
    }
    //
    $templates->set_var('lang_field', $LANG_DATABOX_ADMIN['field']);
    $templates->set_var('lang_fields', $LANG_DATABOX_ADMIN['fields']);
    $templates->set_var('lang_content', $LANG_DATABOX_ADMIN['content']);
    $templates->set_var('lang_templatesetvar', $LANG_DATABOX_ADMIN['templatesetvar']);
    //基本項目
    $templates->set_var('lang_basicfields', $LANG_DATABOX_ADMIN['basicfields']);
    //コード&タイトル&説明&テンプレートセット値
    $templates->set_var('lang_code', $LANG_DATABOX_ADMIN['code']);
    if ($_DATABOX_CONF['datacode']) {
        $templates->set_var('lang_must_code', $LANG_DATABOX_ADMIN['must']);
    } else {
        $templates->set_var('lang_must_code', "");
    }
    $templates->set_var('code', $code);
    $templates->set_var('lang_title', $LANG_DATABOX_ADMIN['title']);
    $templates->set_var('title', $title);
    $templates->set_var('lang_page_title', $LANG_DATABOX_ADMIN['page_title']);
    $templates->set_var('page_title', $page_title);
    $templates->set_var('lang_description', $LANG_DATABOX_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_DATABOX_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_DATABOX_ADMIN['modified_autoupdate']);
    $templates->set_var('lang_modified', $LANG_DATABOX_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_DATABOX_ADMIN['category']);
    $checklist_category = DATABOX_getcategoriesinp($category, $fieldset_id, "databox");
    $templates->set_var('checklist_category', $checklist_category);
    //追加項目
    $templates->set_var('lang_additionfields', $LANG_DATABOX_ADMIN['additionfields']);
    $rt = DATABOX_getaddtionfieldsEdit($additionfields, $addition_def, $templates, $chk_user, $pi_name, $additionfields_fnm, $additionfields_del, $fieldset_id, $additionfields_date);
    //$rt=DATABOX_getaddtionfieldsJS($additionfields,$addition_def,$chk_user,$pi_name);
    //保存日時
    $templates->set_var('lang_udatetime', $LANG_DATABOX_ADMIN['udatetime']);
    $templates->set_var('udatetime', $udatetime);
    $templates->set_var('lang_uuid', $LANG_DATABOX_ADMIN['uuid']);
    $templates->set_var('uuid', $uuid);
    //作成日付
    $templates->set_var('lang_created', $LANG_DATABOX_ADMIN['created']);
    $templates->set_var('created', $created);
    $templates->set_var('created_un', $created_un);
    // 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('old_mode', $old_mode);
    //
    $templates->parse('output', 'editor');
    $retval .= $templates->finish($templates->get_var('output'));
    return $retval;
}
Example #8
0
function fncEdit($message = "", $wkymlmguserflg = false)
{
    global $_CONF;
    global $_TABLES;
    global $LANG_ASSIST_ADMIN;
    global $LANG_ADMIN;
    global $_ASSIST_CONF;
    global $LANG_ASSIST_INTROBODY;
    global $LANG_ASSIST_TOENV;
    global $LANG31;
    global $_SCRIPTS;
    $retval = '';
    //メッセージ表示
    if (!empty($message)) {
        $retval .= COM_startBlock($LANG_ASSIST_ADMIN['msg'], '', COM_getBlockTemplate('_msg_block', 'header'));
        $retval .= $message;
        $retval .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
        // clean 'em up
        $fromname = COM_applyFilter($_POST['fromname']);
        $replyto = COM_applyFilter($_POST['replyto']);
        $sprefix = COM_applyFilter($_POST['sprefix']);
        $sid = COM_applyFilter($_POST['sid']);
        $testto = COM_applyFilter($_POST['testto']);
        $uidfrom = COM_applyFilter($_POST['uidfrom'], true);
        $uidto = COM_applyFilter($_POST['uidto'], true);
        // hiroron start 2010/07/13
        $dt_year = COM_applyFilter($_POST['datetime_year'], true);
        $dt_month = COM_applyFilter($_POST['datetime_month'], true);
        $dt_day = COM_applyFilter($_POST['datetime_day'], true);
        $dt_hour = COM_applyFilter($_POST['datetime_hour'], true);
        $dt_minute = COM_applyFilter($_POST['datetime_minute'], true);
        $datetime_value = COM_convertDate2Timestamp($dt_year . '-' . $dt_month . '-' . $dt_day, $dt_hour . ':' . $dt_minute . ':00');
        // 冒頭文 本文 introbody
        $introbody = COM_applyFilter($_POST['introbody'], true);
        //送信先環境
        $toenv = COM_applyFilter($_POST['toenv'], true);
        //送信先グループ
        $selectgroup = COM_applyFilter($_POST['selectgroup'], true);
        // ユーザの受信許可設定を無視して送る
        $overstyr = COM_applyFilter($_POST['overstyr'], true);
        //一括予約
        $bulkmm = COM_applyFilter($_POST['bulkmm'], true);
        $bulkcnt = COM_applyFilter($_POST['bulkcnt'], true);
    } else {
        $fromname = DB_getItem($_TABLES['vars'], 'value', "name = 'assist_fromname'");
        $fromname = COM_stripslashes($fromname);
        if ($fromname == "") {
            $fromname = $_CONF['site_name'];
        }
        $replyto = DB_getItem($_TABLES['vars'], 'value', "name = 'assist_replyto'");
        $replyto = COM_stripslashes($replyto);
        if ($replyto == "") {
            $replyto = $_CONF['site_mail'];
        }
        $sprefix = DB_getItem($_TABLES['vars'], 'value', "name = 'assist_sprefix'");
        $sprefix = COM_stripslashes($sprefix);
        $sid = DB_getItem($_TABLES['vars'], 'value', "name = 'assist_sid'");
        $sid = COM_stripslashes($sid);
        $testto = DB_getItem($_TABLES['vars'], 'value', "name = 'assist_testto'");
        $testto = COM_stripslashes($testto);
        $uidfrom = DB_getItem($_TABLES['vars'], 'value', "name = 'assist_uidfrom'");
        $uidfrom = COM_stripslashes($uidfrom);
        $uidto = DB_getItem($_TABLES['vars'], 'value', "name = 'assist_uidto'");
        $uidto = COM_stripslashes($uidto);
        // hiroron start 2010/07/13
        $datetime_value = DB_getItem($_TABLES['vars'], 'value', "name = 'assist_re_datetime'");
        // 冒頭文 本文 introbody
        $introbody = DB_getItem($_TABLES['vars'], 'value', "name = 'assist_introbody'");
        //送信先環境
        $toenv = DB_getItem($_TABLES['vars'], 'value', "name = 'assist_toenv'");
        //送信先グループ
        $selectgroup = DB_getItem($_TABLES['vars'], 'value', "name = 'assist_selectgroup'");
        // ユーザの受信許可設定を無視して送る
        $overstyr = DB_getItem($_TABLES['vars'], 'value', "name = 'assist_overstyr'");
        $bulkmm = DB_getItem($_TABLES['vars'], 'value', "name = 'assist_bulkmm'");
        $bulkcnt = DB_getItem($_TABLES['vars'], 'value', "name = 'assist_bulkcnt'");
    }
    $retval .= COM_startBlock($LANG_ASSIST_ADMIN['edit'], '', COM_getBlockTemplate('_admin_block', 'header'));
    $pi_name = "assist";
    $tmplfld = assist_templatePath('admin', 'default', $pi_name);
    $templates = new Template($tmplfld);
    // Loads jQuery UI datepicker
    if (version_compare(VERSION, '2.0.0') >= 0) {
        $_SCRIPTS->setJavaScriptLibrary('jquery.ui.datepicker');
        $_SCRIPTS->setJavaScriptLibrary('jquery-ui-i18n');
        $_SCRIPTS->setJavaScriptFile('datepicker', '/javascript/datepicker.js');
        $langCode = COM_getLangIso639Code();
        $toolTip = 'Click and select a date';
        // Should be translated
        $imgUrl = $_CONF['site_url'] . '/images/calendar.png';
        $_SCRIPTS->setJavaScript("jQuery(function () {" . "  geeklog.datepicker.set('datetime', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "});", TRUE, TRUE);
    }
    $templates->set_file('editor', "newsletter.thtml");
    //--
    $templates->set_var('lang_must', $LANG_ASSIST_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_PLUGIN . "/" . THIS_SCRIPT);
    //-----
    $w = "";
    $logfile = $_CONF['path_log'] . 'assist_newsletter.log';
    if (!file_exists($logfile)) {
        $w .= sprintf($LANG_ASSIST_ADMIN['mail_logfile'], $logfile);
    } else {
        if (!is_writable($logfile)) {
            $w .= sprintf($LANG_ASSIST_ADMIN['mail_logfile'], $logfile);
        }
    }
    $tid = $_ASSIST_CONF['newsletter_tid'];
    $topicname = DB_getItem($_TABLES['topics'], 'topic', "tid = '{$tid}'");
    if ($topicname == "") {
        $topicname = $tid;
    }
    $w .= sprintf($LANG_ASSIST_ADMIN['mail_msg'], $topicname);
    $templates->set_var('mail_msg', $w);
    $templates->set_var('mail_msg1', $LANG_ASSIST_ADMIN['mail_msg1']);
    $templates->set_var('mail_msg2', $LANG_ASSIST_ADMIN['mail_msg2']);
    $templates->set_var('mail_msg3', $LANG_ASSIST_ADMIN['mail_msg3']);
    $templates->set_var('mail_msg4', $LANG_ASSIST_ADMIN['mail_msg4']);
    $templates->set_var('lang_fromname', $LANG_ASSIST_ADMIN['fromname']);
    //@@@@@ $templates->set_var('help_fromname', $LANG_ASSIST_ADMIN['help']);
    $templates->set_var('fromname', $fromname);
    //replyto
    $templates->set_var('lang_replyto', $LANG_ASSIST_ADMIN['replyto']);
    $templates->set_var('replyto', $replyto);
    //subject_prefix
    $templates->set_var('lang_sprefix', $LANG_ASSIST_ADMIN['sprefix']);
    $templates->set_var('sprefix', $sprefix);
    //sid
    $templates->set_var('lang_sid', $LANG_ASSIST_ADMIN['sid']);
    $templates->set_var('sid', $sid);
    //FOR GL2.0.0
    if (COM_versionCompare(VERSION, "2.0.0", '>=')) {
        //$where ="s.sid = t.id AND t.tid=\"".$tid."\"";
        //$tables="{$_TABLES['stories']} AS s ,{$_TABLES['topic_assignments']} AS ta";
        $topics = TOPIC_getChildList($tid);
        $where = "s.sid = ta.id ";
        if ($topics == "") {
            $where .= " AND tid=\"" . $tid . "\"";
        } else {
            $where .= " AND ta.tid IN ({$topics})";
        }
        $tables = "{$_TABLES['stories']} AS s ";
        $tables .= " ,{$_TABLES['topic_assignments']} AS ta";
        $optionlist_sid = "<option value=''>{$LANG_ASSIST_ADMIN['select_sid']}</option>" . LB;
        $optionlist_sid .= COM_optionList($tables, 'distinct s.sid,s.title,s.date*-1', $sid, 2, $where);
    } else {
        $where = "tid=\"" . $tid . "\"";
        $optionlist_sid = "<option value=''>{$LANG_ASSIST_ADMIN['select_sid']}</option>" . LB;
        $optionlist_sid .= COM_optionList($_TABLES['stories'], 'sid,title,date*-1', $sid, 2, $where);
    }
    $templates->set_var('optionlist_sid', $optionlist_sid);
    // 冒頭文 本文 introbody
    $templates->set_var('lang_introbody', $LANG_ASSIST_ADMIN['introbody']);
    $list_introbody = assist_getradiolist($LANG_ASSIST_INTROBODY, "introbody", $introbody);
    $templates->set_var('list_introbody', $list_introbody);
    //送信先環境
    $templates->set_var('lang_toenv', $LANG_ASSIST_ADMIN['toenv']);
    $list_toenv = assist_getradiolist($LANG_ASSIST_TOENV, "toenv", $toenv);
    $templates->set_var('list_toenv', $list_toenv);
    //送信先グループ
    $thisUsersGroups = SEC_getUserGroups();
    uksort($thisUsersGroups, 'strcasecmp');
    $optionlist_selectgroup = '';
    if ($wkymlmguserflg == true) {
        $optionlist_selectgroup .= '<option value="' . 99999 . '"';
        if ($selectgroup > 0 && $selectgroup == "99999") {
            $optionlist_selectgroup .= ' selected="selected"';
        }
        $optionlist_selectgroup .= '>' . $LANG_ASSIST_ADMIN['wkymlmguser_user'] . '</option>' . LB;
    }
    foreach ($thisUsersGroups as $groupName => $groupID) {
        if ($groupName != 'All Users') {
            $optionlist_selectgroup .= '<option value="' . $groupID . '"';
            if ($selectgroup > 0 && $selectgroup == $groupID) {
                $optionlist_selectgroup .= ' selected="selected"';
            }
            $optionlist_selectgroup .= '>' . ucwords($groupName) . '</option>' . LB;
        }
    }
    $templates->set_var('lang_selectgroup', $LANG_ASSIST_ADMIN['selectgroup']);
    $templates->set_var('optionlist_selectgroup', $optionlist_selectgroup);
    // ユーザの受信許可設定を無視して送る
    $templates->set_var('lang_overstyr', $LANG31['14']);
    if ($overstyr == 0) {
        $templates->set_var('is_checked_overstyr', '');
    } else {
        $templates->set_var('is_checked_overstyr', 'checked="checked"');
    }
    //testto
    $templates->set_var('lang_testto', $LANG_ASSIST_ADMIN['testto']);
    $templates->set_var('testto', $testto);
    //uidfrom-to
    $templates->set_var('lang_sendto', $LANG_ASSIST_ADMIN['sendto']);
    $templates->set_var('lang_uidfrom', $LANG_ASSIST_ADMIN['uidfrom']);
    $templates->set_var('uidfrom', $uidfrom);
    $templates->set_var('lang_uidto', $LANG_ASSIST_ADMIN['uidto']);
    $templates->set_var('uidto', $uidto);
    $templates->set_var('lang_sendto_remarks', $LANG_ASSIST_ADMIN['sendto_remarks']);
    if ($wkymlmguserflg == true) {
        $templates->set_var('user_wkymlmguser', $LANG_ASSIST_ADMIN['wkymlmguser_on']);
    } else {
        $templates->set_var('user_wkymlmguser', $LANG_ASSIST_ADMIN['wkymlmguser_off']);
    }
    // hiroron start 2010/07/13
    if ($datetime_value === "") {
        $datetime_value = time();
    }
    $datetime_month = date('m', $datetime_value);
    $datetime_day = date('d', $datetime_value);
    $datetime_year = date('Y', $datetime_value);
    $datetime_hour = date('H', $datetime_value);
    $datetime_minute = date('i', $datetime_value);
    $month_options = COM_getMonthFormOptions($datetime_month);
    $day_options = COM_getDayFormOptions($datetime_day);
    $year_options = COM_getYearFormOptions($datetime_year);
    $hour_options = COM_getHourFormOptions($datetime_hour, 24);
    $minute_options = COM_getMinuteFormOptions($datetime_minute);
    $templates->set_var('lang_reserv_datetime', $LANG_ASSIST_ADMIN['reserv_datetime']);
    $templates->set_var('datetime', 'datetime');
    $templates->set_var('datetime_year_options', $year_options);
    $templates->set_var('datetime_month_options', $month_options);
    $templates->set_var('datetime_day_options', $day_options);
    $templates->set_var('datetime_hour_options', $hour_options);
    $templates->set_var('datetime_minute_options', $minute_options);
    $templates->set_var('lang_yy', $LANG_ASSIST_ADMIN['yy']);
    $templates->set_var('lang_mm', $LANG_ASSIST_ADMIN['mm']);
    $templates->set_var('lang_dd', $LANG_ASSIST_ADMIN['dd']);
    // hiroron end 2010/07/13
    $templates->set_var('lang_reserv_datetime_remarks', $LANG_ASSIST_ADMIN['reserv_datetime_remarks']);
    //予約送信
    //$templates->set_var( 'lang_bulkbooking', $LANG_ASSIST_ADMIN['mail_bulkbooking']);
    $templates->set_var('minute', $LANG_ASSIST_ADMIN['minute']);
    $templates->set_var('every', $LANG_ASSIST_ADMIN['every']);
    $templates->set_var('increments', $LANG_ASSIST_ADMIN['increments']);
    $templates->set_var('bulkmm', $bulkmm);
    $templates->set_var('bulkcnt', $bulkcnt);
    // SAVE、CANCEL ボタン
    $templates->set_var('lang_save', $LANG_ADMIN['save']);
    $templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $templates->set_var('lang_testsend', $LANG_ASSIST_ADMIN['mail_test']);
    $templates->set_var('lang_send', $LANG_ASSIST_ADMIN['mail_send']);
    // hiroron start 2010/07/13
    $templates->set_var('lang_reserv', $LANG_ASSIST_ADMIN['mail_reserv']);
    // hiroron end 2010/07/13
    // hiroron start 2010/07/15
    $templates->set_var('list_reserv', fncListReserv());
    // hiroron end 2010/07/15
    //
    $templates->parse('output', 'editor');
    $retval .= $templates->finish($templates->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
 /**
  * Show the downloads editor
  */
 function showEditor($mode = 'edit')
 {
     global $_CONF, $_TABLES, $_USER, $_GROUPS, $_SCRIPTS, $LANG01, $LANG12, $LANG24, $MESSAGE, $_DLM_CONF, $LANG_DLM, $LANG_ACCESS;
     $retval = '';
     $this->initCatTree();
     $p = COM_applyFilter($_GET['p']);
     if (!empty($p)) {
         $this->_page = $p;
     }
     $lc = COM_applyFilter($_GET['cid']);
     if (!empty($lc)) {
         $this->_listing_cid = $lc;
     }
     if (!empty($this->_editor_mode)) {
         $mode = $this->_editor_mode;
     } else {
         $this->_editor_mode = $mode;
     }
     if ($mode == 'edit' || $mode == 'clone') {
         if ($this->_retry == true) {
             $this->_loadFromArgs($_POST);
         } else {
             $this->_lid = COM_applyFilter($_GET['lid']);
             $this->_loadFromDatabase($this->_lid);
         }
     }
     if ($mode == 'create' || $mode == 'submit') {
         if ($this->_retry == true) {
             $this->_loadFromArgs($_POST);
         } else {
             $this->_initVars();
             $homepage = DB_getItem($_TABLES['users'], 'homepage', "uid = '" . addslashes($this->_owner_id) . "'");
             $this->_homepage = DLM_htmlspecialchars(stripslashes($homepage));
         }
     }
     if ($mode != 'create' && $mode != 'submit') {
         $this->_checkHasAccess();
     }
     if ($mode == 'editsubmission') {
         if ($this->_retry == true) {
             $this->_loadFromArgs($_POST);
         } else {
             $this->_lid = COM_applyFilter($_GET['id']);
             $this->_loadSubmission($this->_lid);
         }
     }
     $ja = $_CONF['language'] == 'japanese_utf-8';
     $T = new Template($_DLM_CONF['path_layout']);
     $T->set_file(array('t_mod_download' => 'mod_download.thtml', 't_mod_newfile' => 'mod_newfile.thtml', 't_mod_newfile2' => 'mod_newfile2.thtml', 't_mod_newfileshot' => 'mod_newfileshot.thtml', 't_mod_submit_delete' => 'mod_submit_delete.thtml', 't_mod_submit_cancel' => 'mod_submit_cancel.thtml', 't_mod_submit_preview' => 'mod_submit_preview.thtml', 't_mod_file_id' => 'mod_file_id.thtml', 't_mod_dl_file_name' => 'mod_dl_file_name.thtml', 't_mod_file_size' => 'mod_file_size.thtml', 't_mod_votes' => 'mod_votes.thtml', 't_mod_submitter' => 'mod_submitter.thtml', 't_mod_tempfile' => 'mod_tempfile.thtml', 't_mod_logourl' => 'mod_logourl.thtml', 't_mod_tempsnap' => 'mod_tempsnap.thtml', 't_mod_date' => 'mod_date' . ($ja ? '_ja' : '') . '.thtml', 't_mod_mg_autotag' => 'mod_mg_autotag.thtml'));
     if ($mode == 'submit') {
         $T->set_file(array('t_mod_newfile' => 'mod_newfilesubmit.thtml', 't_mod_newfileshot' => 'mod_newfileshotsubmit.thtml'));
     }
     DLM_setDefaultTemplateVars($T);
     $lang = array('main', 'fileid', 'filetitle', 'dlfilename', 'replfilename', 'homepage', 'ver', 'filesize', 'bytes', 'description', 'detail', 'category', 'shotimage', 'addshotimage', 'replshotimage', 'released', 'listing', 'yes', 'no', 'submit', 'delete', 'cancel', 'confirm_delete', 'submitter', 'release_date', 'postmode', 'comment_mode', 'project', 'toolbar', 'toolbar1', 'toolbar2', 'toolbar3', 'toolbar5', 'md5', 'mg_autotag', 'mg_autotag_info', 'upload', 'tags', 'preview');
     foreach ($lang as $v) {
         $T->set_var('lang_' . $v, $LANG_DLM[$v]);
     }
     $action = 'index.php';
     switch ($mode) {
         case 'edit':
             $op = 'saveDownload';
             break;
         case 'create':
             $T->set_var('lang_submit', $LANG_DLM['add']);
             $T->set_var('lang_replfilename', $LANG_DLM['addfilename']);
             $T->set_var('lang_replshotimage', $LANG_DLM['addshotimage']);
             $op = 'add';
             break;
         case 'clone':
             $T->set_var('lang_submit', $LANG_DLM['add']);
             $op = 'add';
             break;
         case 'editsubmission':
             $T->set_var('lang_submit', $LANG_DLM['approve']);
             $op = 'approve';
             break;
         case 'submit':
             $T->set_var('lang_submit', $LANG12[8]);
             $T->set_var('lang_replfilename', $LANG_DLM['addfilename']);
             $op = 'submit';
             $action = 'submit.php?type=downloads';
             break;
     }
     $categorylist = $this->_cat_tree->makeSelBox('title', 'corder', $this->_cid, 0, 'cid');
     if ($mode == 'edit' || $mode == 'clone' || $mode == 'editsubmission') {
         if (empty($this->_old_lid)) {
             $this->_old_lid = $this->_lid;
         }
         $this->_title = DLM_htmlspecialchars(stripslashes($this->_title));
         $this->_project = DLM_htmlspecialchars(stripslashes($this->_project));
         $pathstring = $this->_cat_tree->getNicePathFromId($cid, "title", "{$_CONF['site_url']}/downloads/index.php?op=");
         $this->_url = DLM_htmlspecialchars(stripslashes($this->_url));
         $this->_logourl = DLM_htmlspecialchars(stripslashes($this->_logourl));
         $this->_mg_autotag = DLM_htmlspecialchars(stripslashes($this->_mg_autotag));
         $this->_tags = DLM_htmlspecialchars(stripslashes($this->_tags));
         $this->_homepage = DLM_htmlspecialchars(stripslashes($this->_homepage));
         $this->_version = DLM_htmlspecialchars($this->_version);
         $this->_size = DLM_htmlspecialchars($this->_size);
         $this->_md5 = DLM_htmlspecialchars(stripslashes($this->_md5));
     }
     if ($mode == 'editsubmission') {
         $tempfileurl = $_CONF['site_url'] . '/admin/plugins/downloads/tmpfile.php?id=' . $this->_lid;
         $tempsnapurl = '';
         if (!empty($this->_logourl)) {
             $tempsnapurl = $_DLM_CONF['snapstore_url'] . '/tmp' . date('YmdHis', $this->_date) . DLM_createSafeFileName($this->_logourl);
         }
         $T->set_var('lang_tempfile', $LANG_DLM['tempfile']);
         $T->set_var('tempsnapurl', $tempsnapurl);
         $T->set_var('tempfileurl', $tempfileurl);
     }
     if ($mode == 'clone') {
         if ($this->_retry != true && !empty($this->_lid)) {
             $this->_lid = $this->_createID($this->_lid . '_');
             if (strlen($this->_lid) > 40) {
                 $this->_lid = $this->_createID();
             }
         }
     }
     if (version_compare(VERSION, '2.1.0') >= 0) {
         require_once $_CONF['path_system'] . 'classes/gltext.class.php';
         $description = GLText::getEditText($this->_description, $this->_postmode, 2);
         $detail = GLText::getEditText($this->_detail, $this->_postmode, 2);
         $file_description = GLText::getPreviewText($this->_description, $this->_postmode, 'story.edit', 2);
         $file_detail = GLText::getPreviewText($this->_detail, $this->_postmode, 'story.edit', 2);
     } else {
         require_once $_CONF['path'] . 'plugins/downloads/include/gltext.class.php';
         $gltext = new GLPText();
         $description = $gltext->getEditText($this->_description, $this->_postmode);
         $detail = $gltext->getEditText($this->_detail, $this->_postmode);
         $file_description = $gltext->getDisplayText($this->_description, $this->_postmode);
         $file_detail = $gltext->getDisplayText($this->_detail, $this->_postmode);
     }
     list($year, $month, $day, $hour, $minute, $second) = explode(',', date('Y,m,d,H,i,s', $this->_date));
     $enabled_adv_editor = $_CONF['advanced_editor'] && $_USER['advanced_editor'];
     $show_texteditor = '';
     $show_htmleditor = 'none';
     if ($enabled_adv_editor && $this->_postmode == 'adveditor') {
         $show_texteditor = 'none';
         $show_htmleditor = '';
     }
     $allowed_html = '';
     if (version_compare(VERSION, '2.1.0') >= 0) {
         $postmode_list = 'plaintext,html';
         if ($enabled_adv_editor) {
             $postmode_list .= ',adveditor';
         }
         if ($_CONF['wikitext_editor']) {
             $postmode_list .= ',wikitext';
         }
         $postmode_array = explode(',', $postmode_list);
         foreach ($postmode_array as $pm) {
             $allowed_html .= COM_allowedHTML('story.edit', false, 1, $pm);
         }
         $allowed_html .= COM_allowedAutotags(false, array('code', 'raw'));
     } else {
         $allowed_html = COM_allowedHTML();
         $allowed_html = str_replace('[page_break], ', '', $allowed_html);
         // No support [page_break]
     }
     $T->set_var('lang_allowed_html', $allowed_html);
     if (version_compare(VERSION, '2.1.0') >= 0) {
         // Loads jQuery UI datepicker and timepicker-addon
         $_SCRIPTS->setJavaScriptLibrary('jquery.ui.slider');
         $_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('datetimepicker', '/javascript/datetimepicker.js');
         $langCode = COM_getLangIso639Code();
         $toolTip = $MESSAGE[118];
         $imgUrl = $_CONF['site_url'] . '/images/calendar.png';
         $_SCRIPTS->setJavaScript("jQuery(function () {" . "  geeklog.hour_mode = 24;" . "  geeklog.datetimepicker.set('release', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "});", TRUE, TRUE);
     }
     if ($enabled_adv_editor) {
         // Add JavaScript
         if (version_compare(VERSION, '2.1.0') >= 0) {
             $_SCRIPTS->setJavaScriptFile('postmode_control', '/javascript/postmode_control.js');
             COM_setupAdvancedEditor('/downloads/adveditor.js', 'story.edit');
         } else {
             if (version_compare(VERSION, '2.0.0') < 0) {
                 $js = 'geeklogEditorBasePath = "' . $_CONF['site_url'] . '/fckeditor/";';
                 $_SCRIPTS->setJavaScript($js, true);
             }
             $_SCRIPTS->setJavaScriptFile('fckeditor', '/fckeditor/fckeditor.js');
             $_SCRIPTS->setJavaScriptFile('downloadeditor_fckeditor', '/downloads/downloadeditor_fckeditor.js');
         }
     }
     if (empty($this->_postmode)) {
         $this->_postmode = $_DLM_CONF['postmode'];
     }
     $post_options = COM_optionList($_TABLES['postmodes'], 'code,name', $this->_postmode);
     if ($enabled_adv_editor) {
         if ($this->_postmode == 'adveditor') {
             $post_options .= '<option value="adveditor" ' . UC_SELECTED . '>' . $LANG24[86] . '</option>';
         } else {
             $post_options .= '<option value="adveditor">' . $LANG24[86] . '</option>';
         }
     }
     if ($_CONF['wikitext_editor']) {
         if ($this->_postmode == 'wikitext') {
             $post_options .= '<option value="wikitext" ' . UC_SELECTED . '>' . $LANG24[88] . '</option>';
         } else {
             $post_options .= '<option value="wikitext">' . $LANG24[88] . '</option>';
         }
     }
     $hidden_values = $this->_makeForm_hidden('owner_id', $this->_owner_id);
     $hidden_values .= $this->_makeForm_hidden('editor_mode', $this->_editor_mode);
     $hidden_values .= $this->_makeForm_hidden('page', $this->_page);
     if (!empty($this->_listing_cid) && $this->_listing_cid != ROOTID) {
         $hidden_values .= $this->_makeForm_hidden('listing_cid', $this->_listing_cid);
     }
     $T->set_var('show_texteditor', $show_texteditor);
     $T->set_var('show_htmleditor', $show_htmleditor);
     $T->set_var('post_options', $post_options);
     $T->set_var('action', $action);
     $T->set_var('op', $op);
     $T->set_var('lid', $this->_lid);
     $T->set_var('old_lid', $this->_old_lid);
     $T->set_var('pathstring', $pathstring);
     $T->set_var('title', $this->_title);
     $T->set_var('url', $this->_url);
     $T->set_var('homepage', $this->_homepage);
     $T->set_var('version', $this->_version);
     $T->set_var('size', $this->_size);
     $T->set_var('md5', $this->_md5);
     $T->set_var('logourl', $this->_logourl);
     $T->set_var('mg_autotag', $this->_mg_autotag);
     $T->set_var('tags', $this->_tags);
     $T->set_var('description', $description);
     $T->set_var('detail', $detail);
     $T->set_var('project', $this->_project);
     $T->set_var('snapstore_url', $_DLM_CONF['snapstore_url']);
     $T->set_var('categorylist', $categorylist);
     $T->set_var('val_is_released_1', $this->_is_released ? UC_SELECTED : '');
     $T->set_var('val_is_released_0', !$this->_is_released ? UC_SELECTED : '');
     $T->set_var('val_is_listing_1', $this->_is_listing ? UC_SELECTED : '');
     $T->set_var('val_is_listing_0', !$this->_is_listing ? UC_SELECTED : '');
     $T->set_var('shot_autotag', $this->_makeForm_shot_mg_autotag());
     $T->set_var('shot', $this->_makeForm_shot());
     $T->set_var('year_options', COM_getYearFormOptions($year));
     $T->set_var('month_options', DLM_getMonthFormOptions($month));
     $T->set_var('day_options', COM_getDayFormOptions($day));
     $T->set_var('hour_options', COM_getHourFormOptions($hour, 24));
     $T->set_var('minute_options', COM_getMinuteFormOptions($minute, 1));
     $T->set_var('second_options', COM_getMinuteFormOptions($second, 1));
     $T->set_var('old_date', $this->_date);
     $T->set_var('comment_options', COM_optionList($_TABLES['commentcodes'], 'code,name', $this->_commentcode));
     $T->set_var('gltoken_name', CSRF_TOKEN);
     $T->set_var('gltoken', SEC_createToken());
     $T->set_var('submitter', $this->_owner_id);
     $T->set_var('displayName', COM_getDisplayName($this->_owner_id));
     if ($mode == 'submit') {
         $T->set_var('lang_commentoption', $LANG_DLM['commentoption']);
         $T->set_var('val_commentoption_1', UC_SELECTED);
         $T->set_var('val_commentoption_0', '');
     }
     $T->parse('mod_submitter', 't_mod_submitter');
     if ($mode == 'editsubmission' || $mode == 'submit') {
         $T->set_var('mod_mg_autotag', '');
         $hidden_values .= $this->_makeForm_hidden('mg_autotag', $this->_mg_autotag);
     } else {
         if ($_DLM_CONF['enabled_mg_autotag'] == 1) {
             $T->parse('mod_mg_autotag', 't_mod_mg_autotag');
         } else {
             $T->set_var('mod_mg_autotag', '');
             $hidden_values .= $this->_makeForm_hidden('mg_autotag', $this->_mg_autotag);
         }
     }
     $T->set_var('hidden_values', $hidden_values);
     if ($mode == 'edit' || $mode == 'clone') {
         $T->parse('mod_newfile', 't_mod_newfile');
         $T->parse('mod_newfileshot', 't_mod_newfileshot');
         if ($mode == 'edit') {
             $T->parse('mod_submit_delete', 't_mod_submit_delete');
         }
         $T->parse('mod_submit_cancel', 't_mod_submit_cancel');
         $T->parse('mod_file_size', 't_mod_file_size');
     }
     if ($mode == 'editsubmission') {
         $T->parse('mod_dl_file_name', 't_mod_dl_file_name');
         $T->parse('mod_tempfile', 't_mod_tempfile');
         $T->parse('mod_file_size', 't_mod_file_size');
         $T->set_var('mod_tempsnap', '');
         if ($tempsnapurl != '') {
             $T->parse('mod_tempsnap', 't_mod_tempsnap');
         }
         $T->parse('mod_logourl', 't_mod_logourl');
         $T->parse('mod_submit_delete', 't_mod_submit_delete');
         $T->parse('mod_submit_cancel', 't_mod_submit_cancel');
     }
     if ($mode == 'create') {
         $T->parse('mod_newfile', 't_mod_newfile2');
         $T->parse('mod_newfileshot', 't_mod_newfileshot');
         $T->parse('mod_submit_cancel', 't_mod_submit_cancel');
     }
     if ($mode == 'submit') {
         $T->parse('mod_newfile', 't_mod_newfile');
         $T->parse('mod_newfileshot', 't_mod_newfileshot');
     }
     if ($_DLM_CONF['enabled_preview_on_upload'] === false && ($mode == 'create' || $mode == 'submit')) {
         $T->set_var('mod_submit_preview', '');
     } else {
         $T->parse('mod_submit_preview', 't_mod_submit_preview');
     }
     $T->parse('mod_file_id', 't_mod_file_id');
     $T->parse('mod_date', 't_mod_date');
     $T->parse('output', 't_mod_download');
     $blocktitle = $LANG_DLM['moddl'];
     if ($mode == 'editsubmission') {
         $blocktitle = $LANG_DLM['dlswaiting'];
     }
     if ($mode == 'create') {
         $blocktitle = $LANG_DLM['addnewfile'];
     }
     if ($mode == 'clone') {
         $blocktitle = $LANG_DLM['addnewfile'];
     }
     if ($mode == 'submit') {
         $blocktitle = $LANG_DLM['uploadtitle'];
     }
     $retval .= $this->_showMessage();
     $retval .= COM_startBlock($blocktitle, '', COM_getBlockTemplate('_admin_block', 'header'));
     $retval .= $T->finish($T->get_var('output'));
     $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
     if (!empty($file_description) || !empty($file_detail)) {
         // Display Preview Block
         $T2 = new Template($_DLM_CONF['path_layout']);
         $T2->set_file('t_mod_preview', 'mod_preview.thtml');
         $T2->set_var('file_description', $file_description);
         $T2->set_var('file_detail', $file_detail);
         $T2->parse('output', 't_mod_preview');
         $blocktitle = $LANG_DLM['preview'];
         $retval .= COM_startBlock($blocktitle, '', COM_getBlockTemplate('_admin_block', 'header'));
         $retval .= $T2->finish($T2->get_var('output'));
         $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
     }
     if ($mode == 'edit') {
         // Display File Voting Information
         $retval .= $this->_showVotes_reguser($this->_lid);
         $retval .= $this->_showVotes_anon($this->_lid);
     }
     if ($mode != 'submit' || $this->_retry == true) {
         $retval = DLM_createHTMLDocument($retval, array('pagetitle' => $blocktitle));
     }
     return $retval;
 }