function LIB_datetimeedit($datetime_value, $lang, $datetime_name = "datetime", $mode = "datetime") { global $_CONF; $var = $lang; global ${$var}; $lang_ary = ${$var}; $datetime_year = date('Y', $datetime_value); $datetime_month = date('m', $datetime_value); $datetime_day = date('d', $datetime_value); // $datetime_hour = date('H', $datetime_value); $datetime_minute = date('i', $datetime_value); $rt = ""; //Year $year_options = COM_getYearFormOptions($datetime_year); $rt .= "<select name=\"" . $datetime_name . "_year\">" . LB; $rt .= $year_options . LB; $rt .= "</select>" . $lang_ary['yy'] . LB; //month $month_options = COM_getMonthFormOptions($datetime_month); $rt .= "<select name=\"" . $datetime_name . "_month\">" . LB; $rt .= $month_options . LB; $rt .= "</select>" . $lang_ary['mm'] . LB; //day $day_options = COM_getDayFormOptions($datetime_day); $rt .= "<select name=\"" . $datetime_name . "_day\">" . LB; $rt .= $day_options . LB; $rt .= "</select>" . $lang_ary['dd'] . LB; //hour if ($mode === "datetime") { if ($_CONF['hour_mode'] == 24) { $hour_options = COM_getHourFormOptions($datetime_hour, 24); } else { $datetime_hour_wk = $datetime_hour; if ($datetime_hour_wk >= 12) { if ($datetime_hour_wk > 12) { $datetime_hour_wk = $datetime_hour_wk - 12; } $ampm = 'pm'; } else { $ampm = 'am'; } $ampm_select = COM_getAmPmFormSelection($datetime_name . '_ampm', $ampm); if (empty($ampm_select)) { $ampm_select = '<input type="hidden" name="cmt_close_ampm" value=""' . XHTML . '>'; } $rt .= $ampm_select; $hour_options = COM_getHourFormOptions($datetime_hour_wk); } $rt .= "<select name=\"" . $datetime_name . "_hour\">" . LB; $rt .= $hour_options . LB; $rt .= "</select>:" . LB; //minute $minute_options = COM_getMinuteFormOptions($datetime_minute); $rt .= "<select name=\"" . $datetime_name . "_minute\">" . LB; $rt .= $minute_options . LB; $rt .= "</select>" . LB; } return $rt; }
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; }
/** * 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']) . ' ' . $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; }
/** * Allows user to edit a personal calendar event * * @param array $A Record to display * @return string HTML for event editor * */ function editpersonalevent($A) { global $_CONF, $_CAJP_CONF, $LANG_CALJP_1; $ja = $_CONF['language'] == 'japanese_utf-8'; $cal_templates = COM_newTemplate($_CONF['path'] . 'plugins/calendarjp/templates/'); $cal_templates->set_file('form', 'editpersonalevent' . ($ja ? '_ja' : '') . '.thtml'); $cal_templates->set_var('lang_title', $LANG_CALJP_1[28]); $title = stripslashes($A['title']); $title = str_replace('{', '{', $title); $title = str_replace('}', '}', $title); $title = str_replace('"', '"', $title); $cal_templates->set_var('event_title', $title); $cal_templates->set_var('lang_eventtype', $LANG_CALJP_1[37]); $type_options = CALENDARJP_eventTypeList($A['event_type']); $cal_templates->set_var('type_options', $type_options); // Handle start date/time $cal_templates->set_var('lang_startdate', $LANG_CALJP_1[21]); $cal_templates->set_var('lang_starttime', $LANG_CALJP_1[30]); $A['startdate'] = $A['datestart'] . ' ' . $A['timestart']; $start_month = date('n', strtotime($A['startdate'])); $month_options = CALENDARJP_getMonthFormOptions($start_month); $cal_templates->set_var('startmonth_options', $month_options); $start_day = date('j', strtotime($A['startdate'])); $day_options = COM_getDayFormOptions($start_day); $cal_templates->set_var('startday_options', $day_options); $start_year = date('Y', strtotime($A['startdate'])); $year_options = COM_getYearFormOptions($start_year); $cal_templates->set_var('startyear_options', $year_options); if (isset($_CAJP_CONF['hour_mode']) && $_CAJP_CONF['hour_mode'] == 24) { $start_hour = date('H', strtotime($A['startdate'])); $hour_options = COM_getHourFormOptions($start_hour, 24); $cal_templates->set_var('starthour_options', $hour_options); } else { $start_hour = date('g', strtotime($A['startdate'])); $hour_options = COM_getHourFormOptions($start_hour); $cal_templates->set_var('starthour_options', $hour_options); } $startmin = intval(date('i', strtotime($A['startdate'])) / 15) * 15; $cal_templates->set_var('startminute_options', COM_getMinuteFormOptions($startmin, 15)); $ampm = date('a', strtotime($A['startdate'])); $cal_templates->set_var('startampm_selection', CALENDARJP_getAmPmFormSelection('startampm_selection', $ampm)); // Handle end date/time $cal_templates->set_var('lang_enddate', $LANG_CALJP_1[18]); $cal_templates->set_var('lang_endtime', $LANG_CALJP_1[29]); $A['enddate'] = $A['dateend'] . ' ' . $A['timeend']; $end_month = date('n', strtotime($A['enddate'])); $month_options = CALENDARJP_getMonthFormOptions($end_month); $cal_templates->set_var('endmonth_options', $month_options); $end_day = date('j', strtotime($A['enddate'])); $day_options = COM_getDayFormOptions($end_day); $cal_templates->set_var('endday_options', $day_options); $end_year = date('Y', strtotime($A['enddate'])); $year_options = COM_getYearFormOptions($end_year); $cal_templates->set_var('endyear_options', $year_options); if (isset($_CAJP_CONF['hour_mode']) && $_CAJP_CONF['hour_mode'] == 24) { $end_hour = date('H', strtotime($A['enddate'])); $hour_options = COM_getHourFormOptions($end_hour, 24); $cal_templates->set_var('endhour_options', $hour_options); } else { $end_hour = date('g', strtotime($A['enddate'])); $hour_options = COM_getHourFormOptions($end_hour); $cal_templates->set_var('endhour_options', $hour_options); } $endmin = intval(date('i', strtotime($A['enddate'])) / 15) * 15; $cal_templates->set_var('endminute_options', COM_getMinuteFormOptions($endmin, 15)); $ampm = date('a', strtotime($A['enddate'])); $cal_templates->set_var('endampm_selection', CALENDARJP_getAmPmFormSelection('endampm_selection', $ampm)); $cal_templates->set_var('lang_alldayevent', $LANG_CALJP_1[31]); if ($A['allday'] == 1) { $cal_templates->set_var('allday_checked', 'checked="checked"'); } else { $cal_templates->set_var('allday_checked', ''); } $cal_templates->set_var('lang_tail_year', $LANG_CALJP_1['tail_year']); $cal_templates->set_var('lang_tail_month', $LANG_CALJP_1['tail_month']); $cal_templates->set_var('lang_tail_day', $LANG_CALJP_1['tail_day']); $cal_templates->set_var('lang_location', $LANG_CALJP_1[39]); $cal_templates->set_var('event_location', stripslashes($A['location'])); $cal_templates->set_var('lang_addressline1', $LANG_CALJP_1[32]); $cal_templates->set_var('event_address1', stripslashes($A['address1'])); $cal_templates->set_var('lang_addressline2', $LANG_CALJP_1[33]); $cal_templates->set_var('event_address2', stripslashes($A['address2'])); $cal_templates->set_var('lang_city', $LANG_CALJP_1[34]); $cal_templates->set_var('event_city', stripslashes($A['city'])); $cal_templates->set_var('lang_state', $LANG_CALJP_1[35]); $cal_templates->set_var('state_options', ''); $cal_templates->set_var('event_state', stripslashes($A['state'])); $cal_templates->set_var('lang_zipcode', $LANG_CALJP_1[36]); $cal_templates->set_var('event_zipcode', $A['zipcode']); $cal_templates->set_var('lang_link', $LANG_CALJP_1[43]); $cal_templates->set_var('event_url', $A['url']); $cal_templates->set_var('lang_description', $LANG_CALJP_1[5]); $cal_templates->set_var('event_description', COM_nl2br(stripslashes($A['description']))); $cal_templates->set_var('lang_htmlnotallowed', $LANG_CALJP_1[44]); $cal_templates->set_var('lang_submit', $LANG_CALJP_1[45]); $cal_templates->set_var('lang_delete', $LANG_CALJP_1[51]); $cal_templates->set_var('eid', $A['eid']); $cal_templates->set_var('uid', $A['uid']); if (isset($_CAJP_CONF['hour_mode']) && $_CAJP_CONF['hour_mode'] == 24) { $cal_templates->set_var('hour_mode', 24); } else { $cal_templates->set_var('hour_mode', 12); } $cal_templates->set_var('gltoken_name', CSRF_TOKEN); $cal_templates->set_var('gltoken', SEC_createToken()); return $cal_templates->parse('output', 'form'); }
/** * Builds Quick Add form * */ function getQuickAdd($tpl, $month, $day, $year, $token) { global $_CAJP_CONF, $LANG_CALJP_2; $tpl->set_var('month_options', CALENDARJP_getMonthFormOptions($month)); $tpl->set_var('day_options', COM_getDayFormOptions($day)); $tpl->set_var('year_options', COM_getYearFormOptions($year)); $cur_hour = date('H', time()); if ($cur_hour >= 12) { $ampm = 'pm'; } else { $ampm = 'am'; } $cur_hour_24 = $cur_hour % 24; if ($cur_hour > 12) { $cur_hour = $cur_hour - 12; } else { if ($cur_hour == 0) { $cur_hour = 12; } } if (isset($_CAJP_CONF['hour_mode']) && $_CAJP_CONF['hour_mode'] == 24) { $tpl->set_var('hour_mode', 24); $tpl->set_var('hour_options', COM_getHourFormOptions($cur_hour_24, 24)); } else { $tpl->set_var('hour_mode', 12); $tpl->set_var('hour_options', COM_getHourFormOptions($cur_hour)); } $tpl->set_var('startampm_selection', CALENDARJP_getAmPmFormSelection('start_ampm', $ampm)); $cur_min = intval(date('i') / 15) * 15; $tpl->set_var('minute_options', COM_getMinuteFormOptions($cur_min, 15)); $tpl->set_var('lang_event', $LANG_CALJP_2[32]); $tpl->set_var('lang_date', $LANG_CALJP_2[33]); $tpl->set_var('lang_time', $LANG_CALJP_2[34]); $tpl->set_var('lang_add', $LANG_CALJP_2[31]); $tpl->set_var('lang_quickadd', $LANG_CALJP_2[35]); $tpl->set_var('lang_submit', $LANG_CALJP_2[36]); $tpl->set_var('gltoken_name', CSRF_TOKEN); $tpl->set_var('gltoken', $token); $tpl->parse('quickadd_form', 'quickadd', true); return $tpl; }
/** * 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('{', '{', $A['title']); $A['title'] = str_replace('}', '}', $A['title']); $A['title'] = str_replace('"', '"', $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; }
/** * Shows event editor * * @param string $action action we are performing: 'edit', 'clone' or 'moderate' * @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_edit($action, $A, $msg = '') { global $_CONF, $_USER, $_GROUPS, $_TABLES, $_USER, $_CA_CONF, $LANG_CAL_1, $LANG_CAL_ADMIN, $LANG10, $LANG12, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE; USES_lib_admin(); $retval = ''; $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/plugins/calendar/index.php', 'text' => $LANG_CAL_ADMIN[40]), array('url' => $_CONF['site_admin_url'] . '/moderation.php', 'text' => $LANG_ADMIN['submissions']), array('url' => $_CONF['site_admin_url'] . '/plugins/calendar/index.php?batchadmin=x', 'text' => $LANG_CAL_ADMIN[38]), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home'])); switch ($action) { case 'edit': case 'clone': $blocktitle = $LANG_CAL_ADMIN[1]; // Event Editor $saveoption = $LANG_ADMIN['save']; // Save break; case 'moderate': $blocktitle = $LANG_CAL_ADMIN[37]; // Moderate Event $saveoption = $LANG_ADMIN['moderate']; // Save & Approve break; } if (!empty($msg)) { $retval .= COM_showMessageText($msg, $LANG_CAL_ADMIN[2], true); } $event_templates = new Template($_CONF['path'] . 'plugins/calendar/templates/admin'); $event_templates->set_file('editor', 'eventeditor.thtml'); $event_templates->set_var('lang_allowed_html', COM_allowedHTML(SEC_getUserPermissions(), false, 'calendar', 'description')); $event_templates->set_var('lang_postmode', $LANG_CAL_ADMIN[3]); if (!isset($A['perm_owner'])) { $A['perm_owner'][0] = "0"; } if (!isset($A['perm_group'])) { $A['perm_group'][0] = "0"; } if (!isset($A['perm_members'])) { $A['perm_members'][0] = "0"; } if (!isset($A['perm_anon'])) { $A['perm_anon'][0] = "0"; } if ($action != 'moderate' 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'], true); COM_accessLog("User {$_USER['username']} tried to illegally submit or edit event {$eid}."); return $retval; } } else { if (!isset($A['owner_id']) || $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 ($action == 'moderate') { $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'])); } $retval .= COM_startBlock($blocktitle, '', COM_getBlockTemplate('_admin_block', 'header')); $retval .= ADMIN_createMenu($menu_arr, $LANG_CAL_ADMIN[41], plugin_geticon_calendar()); if (!empty($A['eid'])) { $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="delete"%s/>'; $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"'; $event_templates->set_var('lang_delete_confirm', $MESSAGE[76]); $event_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm)); $event_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, '')); if ($action == 'moderate') { $event_templates->set_var('submission_option', '<input type="hidden" name="type" value="submission"/>'); } } else { // new event $A['eid'] = COM_makesid(); $A['status'] = 1; $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('event_id', $A['eid']); $event_templates->set_var('lang_eventtitle', $LANG_ADMIN['title']); $A['title'] = str_replace('{', '{', $A['title']); $A['title'] = str_replace('}', '}', $A['title']); $A['title'] = str_replace('"', '"', $A['title']); $event_templates->set_var('event_title', $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('status_checked', $A['status'] == 1 ? ' checked="checked"' : ''); $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', CALENDAR_getAmPmFormSelection('start_ampm', $startampm, 'update_ampm()')); $event_templates->set_var('endampm_selection', CALENDAR_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', $A['location']); $event_templates->set_var('lang_addressline1', $LANG12[44]); $event_templates->set_var('event_address1', $A['address1']); $event_templates->set_var('lang_addressline2', $LANG12[45]); $event_templates->set_var('event_address2', $A['address2']); $event_templates->set_var('lang_city', $LANG12[46]); $event_templates->set_var('event_city', $A['city']); $event_templates->set_var('lang_state', $LANG12[47]); $event_templates->set_var('state_options', ''); $event_templates->set_var('event_state', $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', $A['location']); $event_templates->set_var('lang_eventdescription', $LANG_CAL_ADMIN[8]); $event_templates->set_var('event_description', $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', $saveoption); $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('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon'])); $event_templates->set_var('gltoken_name', CSRF_TOKEN); $event_templates->set_var('gltoken', SEC_createToken()); $event_templates->parse('output', 'editor'); $retval .= $event_templates->finish($event_templates->get_var('output')); $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')); return $retval; }
function LIB_datetimeedit_R($datetime_ary, $lang, $datetime_name = "datetime") { global $_CONF; $var = $lang; global ${$var}; $lang_ary = ${$var}; if (!is_array($datetime_ary)) { return ""; } $rt = ""; //Year $year_options = COM_getYearFormOptions($datetime_ary['year']); $rt .= "<select name=\"" . $datetime_name . "_year\">" . LB; $rt .= $year_options . LB; $rt .= "</select>" . $lang_ary['yy'] . LB; //month $month_options = COM_getMonthFormOptions($datetime_ary['month']); $rt .= "<select name=\"" . $datetime_name . "_month\">" . LB; $rt .= $month_options . LB; $rt .= "</select>" . $lang_ary['mm'] . LB; //day $day_options = COM_getDayFormOptions($datetime_ary['day']); $rt .= "<select name=\"" . $datetime_name . "_day\">" . LB; $rt .= $day_options . LB; $rt .= "</select>" . $lang_ary['dd'] . LB; //hour if ($datetime_ary['hour'] != "") { if ($_CONF['hour_mode'] == 24) { $hour_options = COM_getHourFormOptions($datetime_ary['hour'], 24); } else { $ampm_select = COM_getAmPmFormSelection($datetime_name . '_ampm', $datetime_ary['ampm']); if (empty($ampm_select)) { $ampm_select = '<input type="hidden" name="cmt_close_ampm" value=""' . XHTML . '>'; } $rt .= $ampm_select; $hour_options = COM_getHourFormOptions($datetime_ary['hour']); } $rt .= "<select name=\"" . $datetime_name . "_hour\">" . LB; $rt .= $hour_options . LB; $rt .= "</select>:" . LB; //minute $minute_options = COM_getMinuteFormOptions($datetime_ary['minute']); $rt .= "<select name=\"" . $datetime_name . "_minute\">" . LB; $rt .= $minute_options . LB; $rt .= "</select>" . LB; } return $rt; }
/** * Shows story editor * * Displays the story entry form * * @param string $sid ID of story to edit * @param string $action 'preview', 'edit', 'moderate', 'draft' * @param string $errormsg a message to display on top of the page * @param string $currenttopic topic selection for drop-down menu * @return string HTML for story editor * */ function STORY_edit($sid = '', $action = '', $errormsg = '', $currenttopic = '') { global $_CONF, $_GROUPS, $_TABLES, $_USER, $LANG24, $LANG33, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE, $_IMAGE_TYPE; USES_lib_admin(); $display = ''; switch ($action) { case 'clone': case 'edit': case 'preview': case 'error': $title = $LANG24[5]; $saveoption = $LANG_ADMIN['save']; $submission = false; break; case 'moderate': $title = $LANG24[90]; $saveoption = $LANG_ADMIN['moderate']; $submission = true; break; case 'draft': $title = $LANG24[91]; $saveoption = $LANG_ADMIN['save']; $submission = true; $action = 'edit'; break; default: $title = $LANG24[5]; $saveoption = $LANG_ADMIN['save']; $submission = false; $action = 'edit'; break; } // Load HTML templates $story_templates = new Template($_CONF['path_layout'] . 'admin/story'); $story_templates->set_file(array('editor' => 'storyeditor.thtml')); if (!isset($_CONF['hour_mode'])) { $_CONF['hour_mode'] = 12; } if (!empty($errormsg)) { $display .= COM_showMessageText($errormsg, $LANG24[25], true); } if (!empty($currenttopic)) { $allowed = DB_getItem($_TABLES['topics'], 'tid', "tid = '" . DB_escapeString($currenttopic) . "'" . COM_getTopicSql('AND')); if ($allowed != $currenttopic) { $currenttopic = ''; } } $story = new Story(); if ($action == 'preview' || $action == 'error') { while (list($key, $value) = each($_POST)) { if (!is_array($value)) { $_POST[$key] = $value; } else { while (list($subkey, $subvalue) = each($value)) { $value[$subkey] = $subvalue; } } } $result = $story->loadFromArgsArray($_POST); } else { $result = $story->loadFromDatabase($sid, $action); } if ($result == STORY_PERMISSION_DENIED || $result == STORY_NO_ACCESS_PARAMS) { $display .= COM_showMessageText($LANG24[42], $LANG_ACCESS['accessdenied'], true); COM_accessLog("User {$_USER['username']} tried to access story {$sid}. - STORY_PERMISSION_DENIED or STORY_NO_ACCESS_PARAMS - " . $result); return $display; } elseif ($result == STORY_EDIT_DENIED || $result == STORY_EXISTING_NO_EDIT_PERMISSION) { $display .= COM_showMessageText($LANG24[41], $LANG_ACCESS['accessdenied'], true); $display .= STORY_renderArticle($story, 'p'); COM_accessLog("User {$_USER['username']} tried to illegally edit story {$sid}. - STORY_EDIT_DENIED or STORY_EXISTING_NO_EDIT_PERMISSION"); return $display; } elseif ($result == STORY_INVALID_SID) { if ($action == 'moderate') { // that submission doesn't seem to be there any more (may have been // handled by another Admin) - take us back to the moderation page echo COM_refresh($_CONF['site_admin_url'] . '/moderation.php'); } else { echo COM_refresh($_CONF['site_admin_url'] . '/story.php'); } } elseif ($result == STORY_DUPLICATE_SID) { $story_templates->set_var('error_message', $LANG24[24]); } elseif ($result == STORY_EMPTY_REQUIRED_FIELDS) { $story_templates->set_var('error_message', $LANG24[31]); } if (empty($currenttopic) && $story->EditElements('tid') == '') { $story->setTid(DB_getItem($_TABLES['topics'], 'tid', 'is_default = 1' . COM_getPermSQL('AND'))); } else { if ($story->EditElements('tid') == '') { $story->setTid($currenttopic); } } if (SEC_hasRights('story.edit')) { $allowedTopicList = COM_topicList('tid,topic', $story->EditElements('tid'), 1, true, 0); $allowedAltTopicList = '<option value="">' . $LANG33[44] . '</option>' . COM_topicList('tid,topic', $story->EditElements('alternate_tid'), 1, true, 0); } else { $allowedTopicList = COM_topicList('tid,topic', $story->EditElements('tid'), 1, true, 3); $allowedAltTopicList = '<option value="">' . $LANG33[44] . '</option>' . COM_topicList('tid,topic', $story->EditElements('alternate_tid'), 1, true, 3); } if ($allowedTopicList == '') { $display .= COM_showMessageText($LANG24[42], $LANG_ACCESS['accessdenied'], true); COM_accessLog("User {$_USER['username']} tried to illegally access story {$sid}. No allowed topics."); return $display; } $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/story.php', 'text' => $LANG_ADMIN['story_list']), array('url' => $_CONF['site_admin_url'] . '/moderation.php', 'text' => $LANG_ADMIN['submissions'])); if (SEC_inGroup('Root')) { $menu_arr[] = array('url' => $_CONF['site_admin_url'] . '/story.php?global=x', 'text' => 'Global Settings'); } $menu_arr[] = array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']); require_once $_CONF['path_system'] . 'classes/navbar.class.php'; $story_templates->set_var('hour_mode', $_CONF['hour_mode']); if ($story->hasContent()) { $previewContent = STORY_renderArticle($story, 'p'); if ($previewContent != '') { $story_templates->set_var('preview_content', $previewContent); } } $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 ($action == '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('show_preview', 'none'); } $story_templates->set_var('navbar', $navbar->generate()); $story_templates->set_var('start_block', COM_startBlock($title, '', COM_getBlockTemplate('_admin_block', 'header'))); // start generating the story editor block $story_templates->set_var('block_start', COM_startBlock($title, '', COM_getBlockTemplate('_admin_block', 'header'))); $oldsid = $story->EditElements('originalSid'); if (!empty($oldsid)) { $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="deletestory"%s/>'; $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, '')); $story_templates->set_var('lang_delete_confirm', $MESSAGE[76]); } if ($submission || $story->type == 'submission') { $story_templates->set_var('submission_option', '<input type="hidden" name="type" value="submission"/>'); } $story_templates->set_var('admin_menu', ADMIN_createMenu($menu_arr, $LANG24[92], $_CONF['layout_url'] . '/images/icons/story.' . $_IMAGE_TYPE)); $story_templates->set_var('lang_author', $LANG24[7]); $storyauthor = COM_getDisplayName($story->EditElements('uid')); $storyauthor_select = COM_optionList($_TABLES['users'], 'uid,username', $story->EditElements('uid')); $story_templates->set_var('story_author', $storyauthor); $story_templates->set_var('story_author_select', $storyauthor_select); $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 = ' . (int) $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')); if (SEC_hasRights('story.edit')) { $story_templates->set_var('owner_dropdown', COM_buildOwnerList('owner_id', $story->EditElements('owner_id'))); } else { $ownerInfo = '<input type="hidden" name="owner_id" value="' . $story->editElements('owner_id') . '" />' . $ownername; $story_templates->set_var('owner_dropdown', $ownerInfo); } $story_templates->set_var('lang_group', $LANG_ACCESS['group']); if (SEC_inGroup($story->EditElements('group_id'))) { $story_templates->set_var('group_dropdown', SEC_getGroupDropdown($story->EditElements('group_id'), 3)); } else { $gdrpdown = '<input type="hidden" name="group_id" value="' . $story->EditElements('group_id') . '"/>'; $grpddown .= DB_getItem($_TABLES['groups'], 'grp_name', 'grp_id=' . (int) $story->EditElements('group_id')); $story_templates->set_var('group_dropdown', $grpddown); } $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']); $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=""/>'; } $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')); if ($story->EditElements('statuscode') == STORY_ARCHIVE_ON_EXPIRE) { $story_templates->set_var('is_checked2', 'checked="checked"'); $story_templates->set_var('is_checked3', 'checked="checked"'); $story_templates->set_var('showarchivedisabled', 'false'); } elseif ($story->EditElements('statuscode') == STORY_DELETE_ON_EXPIRE) { $story_templates->set_var('is_checked2', 'checked="checked"'); $story_templates->set_var('is_checked4', 'checked="checked"'); $story_templates->set_var('showarchivedisabled', 'false'); } else { $story_templates->set_var('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]); $story_templates->set_var('lang_optionarchive', $LANG24[61]); $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('story_subtitle', $story->EditElements('subtitle')); $story_templates->set_var('lang_topic', $LANG_ADMIN['topic']); $story_templates->set_var('lang_alt_topic', $LANG_ADMIN['alt_topic']); $story_templates->set_var('topic_options', $allowedTopicList); $story_templates->set_var('alt_topic_options', $allowedAltTopicList); $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('story_image_url', $story->EditElements('story_image')); $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('unpublished_selected', 'selected="selected"'); } else { $story_templates->set_var('published_selected', 'selected="selected"'); } $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"'); //check box if enabled $story_templates->set_var('showcmtclosedisabled', 'false'); } else { $story_templates->set_var('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); $year_options = COM_getYearFormOptions($story->EditElements('cmt_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="" />'; } $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; $featured_options_data = COM_optionList($_TABLES['featurecodes'], 'code,name', $story->EditElements('featured')); $story_templates->set_var('featured_options_data', $featured_options_data); } else { $featured_options = "<input type=\"hidden\" name=\"featured\" value=\"0\"/>"; $story_templates->unset_var('featured_options_data'); } $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('lang_publishdate', $LANG24[69]); $story_templates->set_var('lang_nojavascript', $LANG24[77]); $story_templates->set_var('postmode', $story->EditElements('postmode')); if ($story->EditElements('postmode') == 'plaintext' || $story->EditElements('postmode') == 'text') { $allowedHTML = ''; } else { $allowedHTML = COM_allowedHTML(SEC_getUserPermissions(), false, 'glfusion', 'story') . '<br/>'; } $allowedHTML .= COM_allowedAutotags(SEC_getUserPermissions(), false, 'glfusion', 'story'); $story_templates->set_var('lang_allowed_html', $allowedHTML); $fileinputs = ''; $saved_images = ''; if ($_CONF['maximagesperarticle'] > 0) { $story_templates->set_var('lang_images', $LANG24[47]); $icount = DB_count($_TABLES['article_images'], 'ai_sid', DB_escapeString($story->getSid())); if ($icount > 0) { $result_articles = DB_query("SELECT * FROM {$_TABLES['article_images']} WHERE ai_sid = '" . DB_escapeString($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']) . ' ' . $LANG_ADMIN['delete'] . ': <input type="checkbox" name="delete[' . $I['ai_img_num'] . ']" /><br />'; } } $newallowed = $_CONF['maximagesperarticle'] - $icount; for ($z = $icount + 1; $z <= $_CONF['maximagesperarticle']; $z++) { $fileinputs .= $z . ') <input type="file" dir="ltr" name="file[]' . '" />'; if ($z < $_CONF['maximagesperarticle']) { $fileinputs .= '<br />'; } } $fileinputs .= '<br />' . $LANG24[51]; if ($_CONF['allow_user_scaling'] == 1) { $fileinputs .= $LANG24[27]; } $fileinputs .= $LANG24[28] . '<br />'; } $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 ($_CONF['rating_enabled']) { $rating = @number_format($story->EditElements('rating'), 2); $votes = $story->EditElements('votes'); $story_templates->set_var('rating', $rating); $story_templates->set_var('votes', $votes); } $story_templates->set_var('attribution_url', $story->EditElements('attribution_url')); $story_templates->set_var('attribution_name', $story->EditElements('attribution_name')); $story_templates->set_var('attribution_author', $story->EditElements('attribution_author')); $story_templates->set_var('lang_attribution_url', $LANG24[105]); $story_templates->set_var('lang_attribution_name', $LANG24[106]); $story_templates->set_var('lang_attribution_author', $LANG24[107]); $story_templates->set_var('lang_attribution', $LANG24[108]); $sec_token_name = CSRF_TOKEN; $sec_token = SEC_createToken(); $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', $saveoption); $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('lang_timeout', $LANG_ADMIN['timeout_msg']); $story_templates->set_var('gltoken_name', CSRF_TOKEN); $story_templates->set_var('gltoken', $sec_token); $story_templates->set_var('security_token', $sec_token); $story_templates->set_var('security_token_name', $sec_token_name); $story_templates->set_var('end_block', COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'))); PLG_templateSetVars('storyeditor', $story_templates); if ($story->EditElements('postmode') != 'html') { $story_templates->unset_var('wysiwyg'); } SEC_setCookie($_CONF['cookie_name'] . 'adveditor', SEC_createTokenGeneral('advancededitor'), time() + 1200, $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure'], false); $story_templates->parse('output', 'editor'); $display .= $story_templates->finish($story_templates->get_var('output')); return $display; }
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; }