/** * Displays the Static Page Editor * * @param string $sp_id ID of static page to edit * @param string $mode Mode * @param string $editor Editor mode? (unused?) * @return string HTML for static pages editor * */ function staticpageeditor($sp_id, $mode = '', $editor = '') { global $_CONF, $_TABLES, $_USER, $LANG_ACCESS, $LANG_STATIC, $_SP_CONF; $retval = ''; if (!empty($sp_id) && $mode == 'edit') { $result = DB_query("SELECT *,UNIX_TIMESTAMP(modified) AS unixdate FROM {$_TABLES['staticpage']} WHERE sp_id = '{$sp_id}'" . COM_getPermSQL('AND', 0, 3)); if (DB_numRows($result) == 1) { $A = DB_fetchArray($result); $A['sp_old_id'] = $A['sp_id']; } } elseif ($mode == 'edit') { // check if a new sp_id has been suggested $sp_new_id = ''; if (isset($_GET['sp_new_id'])) { $sp_new_id = COM_applyFilter($_GET['sp_new_id']); } if (empty($sp_new_id)) { $A['sp_id'] = COM_makesid(); } else { $A['sp_id'] = $sp_new_id; } $A['owner_id'] = $_USER['uid']; $A['unixdate'] = time(); $A['sp_help'] = ''; $A['sp_old_id'] = ''; $A['commentcode'] = $_SP_CONF['comment_code']; $A['sp_where'] = 1; // default new pages to "top of page" $A['draft_flag'] = $_SP_CONF['draft_flag']; $A['cache_time'] = $_SP_CONF['default_cache_time']; $A['template_flag'] = ''; // Defaults to not a template $A['template_id'] = ''; // Defaults to None if ($_USER['advanced_editor'] == 1) { $A['postmode'] = 'adveditor'; } } elseif (!empty($sp_id) && $mode == 'clone') { $result = DB_query("SELECT *,UNIX_TIMESTAMP(modified) AS unixdate FROM {$_TABLES['staticpage']} WHERE sp_id = '{$sp_id}'" . COM_getPermSQL('AND', 0, 3)); if (DB_numRows($result) == 1) { $A = DB_fetchArray($result); $A['sp_id'] = COM_makesid(); $A['clone_sp_id'] = $sp_id; // need this so we can load the correct topics $A['owner_id'] = $_USER['uid']; $A['unixdate'] = time(); $A['sp_hits'] = 0; $A['sp_old_id'] = ''; $A['commentcode'] = $_SP_CONF['comment_code']; } } else { $A = $_POST; if (empty($A['unixdate'])) { $A['unixdate'] = time(); } $A['sp_content'] = COM_checkHTML(COM_checkWords($A['sp_content']), 'staticpages.edit'); } if (isset($A)) { if (isset($A['sp_title'])) { $A['sp_title'] = strip_tags($A['sp_title']); } if (isset($A['sp_page_title'])) { $A['sp_page_title'] = strip_tags($A['sp_page_title']); } if (isset($A['meta_description'])) { $A['meta_description'] = strip_tags($A['meta_description']); } if (isset($A['meta_keywords'])) { $A['meta_keywords'] = strip_tags($A['meta_keywords']); } $A['editor'] = $editor; $retval = staticpageeditor_form($A); } else { $retval = COM_showMessageText($LANG_STATIC['deny_msg'], $LANG_ACCESS['accessdenied']); } return $retval; }
/** * Displays the Static Page Editor * * @param string $sp_id ID of static page to edit * @param string $mode Mode * @param string $editor Editor mode? (unused?) * @return string HTML for static pages editor * */ function staticpageeditor($sp_id, $mode = '', $editor = '') { global $_CONF, $_TABLES, $_USER, $LANG_ACCESS, $LANG_STATIC; $retval = ''; if (!empty($sp_id) && $mode == 'edit') { $result = DB_query("SELECT *,UNIX_TIMESTAMP(sp_date) AS unixdate FROM {$_TABLES['staticpage']} WHERE sp_id = '{$sp_id}'" . COM_getPermSQL('AND', 0, 3)); if (DB_numRows($result) == 1) { $A = DB_fetchArray($result); $A['sp_old_id'] = $A['sp_id']; } } elseif ($mode == 'edit') { $A['sp_id'] = COM_makesid(); $A['sp_uid'] = $_USER['uid']; $A['unixdate'] = time(); $A['sp_help'] = ''; $A['sp_old_id'] = ''; $A['commentcode'] = $_CONF['comment_code']; $A['sp_where'] = 1; // default new pages to "top of page" } elseif (!empty($sp_id) && $mode == 'clone') { $result = DB_query("SELECT *,UNIX_TIMESTAMP(sp_date) AS unixdate FROM {$_TABLES['staticpage']} WHERE sp_id = '{$sp_id}'" . COM_getPermSQL('AND', 0, 3)); if (DB_numRows($result) == 1) { $A = DB_fetchArray($result); $A['sp_id'] = COM_makesid(); $A['sp_uid'] = $_USER['uid']; $A['unixdate'] = time(); $A['sp_hits'] = 0; $A['sp_old_id'] = ''; $A['commentcode'] = $_CONF['comment_code']; } } else { $A = $_POST; if (empty($A['unixdate'])) { $A['unixdate'] = time(); } $A['sp_content'] = COM_checkHTML(COM_checkWords($A['sp_content']), 'staticpages.edit'); } if (isset($A)) { if (isset($A['sp_title'])) { $A['sp_title'] = strip_tags($A['sp_title']); } if (isset($A['meta_description'])) { $A['meta_description'] = strip_tags($A['meta_description']); } if (isset($A['meta_keywords'])) { $A['meta_keywords'] = strip_tags($A['meta_keywords']); } $A['editor'] = $editor; $retval = staticpageeditor_form($A); } else { $retval = COM_startBlock($LANG_ACCESS['accessdenied'], '', COM_getBlockTemplate('_msg_block', 'header')) . $LANG_STATIC['deny_msg'] . COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer')); } return $retval; }