示例#1
0
/**
 * Provides a widget to specify the default image for posts
 */
function mw_widget_image()
{
    global $xoopsSecurity, $xoopsModuleConfig, $xoopsUser, $rm_config;
    $id = rmc_server_var($_REQUEST, 'id', 0);
    $type = rmc_server_var($_REQUEST, 'type', '');
    $op = rmc_server_var($_REQUEST, 'op', '');
    $edit = $op == 'edit' ? 1 : 0;
    $widget = array();
    $widget['title'] = __('Default Image', 'mywords');
    $util = new RMUtilities();
    if ($edit) {
        //Verificamos que el software sea válido
        if ($id <= 0) {
            $params = '';
        }
        $post = new MWPost($id);
        if ($post->isNew()) {
            $params = '';
        } else {
            $params = $post->getVar('image');
        }
    } else {
        $params = '';
    }
    $widget['content'] = '<form name="frmDefimage" id="frm-defimage" method="post">';
    $widget['content'] .= $util->image_manager('image', $params);
    $widget['content'] .= '</form>';
    return $widget;
}
示例#2
0
function mw_post_form($edit = 0)
{
    global $xoopsConfig, $xoopsUser, $xoopsSecurity;
    if (!$xoopsUser) {
        redirect_header(MWFunctions::get_url(), 1, __('You are not allowed to do this action!', 'mywords'));
        die;
    }
    // Check if user is a editor
    $author = new MWEditor();
    if (!$author->from_user($xoopsUser->uid()) && !$xoopsUser->isAdmin()) {
        redirect_header(MWFunctions::get_url(), 1, __('You are not allowed to do this action!', 'mywords'));
        die;
    }
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.min.js');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery-ui.min.js');
    if ($edit) {
        $id = rmc_server_var($_GET, 'id', 0);
        if ($id <= 0) {
            redirect_header(MWFunctions::get_url(), __('Please, specify a valid post ID', 'mywords'), 1);
            die;
        }
        $post = new MWPost($id);
        if ($post->isNew()) {
            redirect_header(MWFunctions::get_url(), __('Specified post does not exists!', 'mywords'), 1);
            die;
        }
        // Check if user is the admin or a editor of this this post
        if ($author->id() != $post->getVar('author') && !$xoopsUser->isAdmin()) {
            redirect_header($post->permalink(), 1, __('You are not allowed to do this action!', 'mywords'));
            die;
        }
    }
    // Read privileges
    $perms = @$author->getVar('privileges');
    $perms = is_array($perms) ? $perms : array();
    $allowed_tracks = in_array("tracks", $perms) || $xoopsUser->isAdmin() ? true : false;
    $allowed_tags = in_array("tags", $perms) || $xoopsUser->isAdmin() ? true : false;
    $allowed_cats = in_array("cats", $perms) || $xoopsUser->isAdmin() ? true : false;
    $allowed_comms = in_array("comms", $perms) || $xoopsUser->isAdmin() ? true : false;
    $xoopsOption['module_subpage'] = 'submit';
    include 'header.php';
    $form = new RMForm('', '', '');
    $editor = new RMFormEditor('', 'content', '99%', '300px', $edit ? $post->getVar('content') : '');
    $meta_names = MWFunctions::get()->get_metas();
    RMTemplate::get()->add_xoops_style('submit.css', 'mywords');
    RMTemplate::get()->add_script(XOOPS_URL . '/modules/mywords/include/js/scripts.php?file=posts.js&front=1');
    include RMTemplate::get()->get_template('mywords_submit_form.php', 'module', 'mywords');
    include 'footer.php';
}
示例#3
0
 public function eventRmcommonImageInsertLinks($links, $image, $url)
 {
     if (FALSE === strpos($url, 'modules/mywords/admin/posts.php')) {
         return $links;
     }
     parse_str($url);
     if (!isset($id) || $id <= 0) {
         return $links;
     }
     xoops_load('mwpost.class', 'mywords');
     xoops_load('mwfunctions', 'mywords');
     $post = new MWPost($id);
     if ($post->isNew()) {
         return $links;
     }
     $links['post'] = array('caption' => __('Link to post', 'mywords'), 'value' => $post->permalink());
     return $links;
 }
示例#4
0
 public function eventRmcommonLoadingSingleEditorimgs($items, $url)
 {
     if (FALSE === strpos($url, 'modules/mywords/admin/posts.php')) {
         return $items;
     }
     parse_str($url);
     if (!isset($id) || $id <= 0) {
         return $items;
     }
     xoops_load('mwpost.class', 'mywords');
     xoops_load('mwfunctions', 'mywords');
     $post = new MWPost($id);
     if ($post->isNew()) {
         return $items;
     }
     $items['links']['post'] = array('caption' => __('Link to post', 'mywords'), 'value' => $post->permalink());
     return $items;
 }
示例#5
0
 public function get_item_url($params, $com)
 {
     static $posts;
     $params = urldecode($params);
     parse_str($params);
     if (!isset($post) || $post <= 0) {
         return '';
     }
     if (isset($posts[$post])) {
         $ret = $posts[$post]->permalink();
         return $ret;
     }
     include_once XOOPS_ROOT_PATH . '/modules/mywords/class/mwpost.class.php';
     include_once XOOPS_ROOT_PATH . '/modules/mywords/class/mwfunctions.php';
     $item = new MWPost($post);
     if ($item->isNew()) {
         return '';
     }
     $posts[$post] = $item;
     return $item->permalink();
 }
示例#6
0
/**
 * Muestra el formulario para la creación de un nuevo artículo
 */
function newForm($edit = 0)
{
    global $db, $xoopsModule, $myts, $util, $xoopsConfig, $tpl, $xoopsSecurity, $cuSettings;
    define('RMCSUBLOCATION', 'new_post');
    if ($edit) {
        $id = rmc_server_var($_GET, 'id', 0);
        if ($id <= 0) {
            redirectMsg('posts.php', __('Please, specify a valid post ID', 'mywords'), 1);
            die;
        }
        $post = new MWPost($id);
        if ($post->isNew()) {
            redirectMsg('posts.php', __('Specified post does not exists!', 'mywords'), 1);
            die;
        }
    }
    // Context help
    $tpl->add_help(__('Publish articles', 'mywords'), 'http://www.xoopsmexico.net/docs/mywords/publicar-entradas/');
    MWFunctions::include_required_files(false);
    RMBreadCrumb::get()->add_crumb(__('Posts', 'mywords'), 'posts.php');
    RMBreadCrumb::get()->add_crumb(__('Write post', 'mywords'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Write post', 'mywords'));
    $head = '<script type="text/javascript" src="' . MW_URL . '/include/forms_post.js"></script>';
    xoops_cp_header($head);
    include RMCPATH . '/class/form.class.php';
    /*include RMCPATH.'/class/fields/formelement.class.php';
      include RMCPATH.'/class/fields/editor.class.php';*/
    TinyEditor::getInstance()->add_config('elements', 'content_editor');
    //TinyEditor::getInstance()->add_config('theme_advanced_buttons1', 'bold,italic,strikethrough,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,|,link,unlink,|,spellchecker,fullscreen,|,exm_more,exm_adv', true);
    //TinyEditor::getInstance()->add_config('theme_advanced_buttons2','formatselect,underline,justifyfull,forecolor,|,pastetext,pasteword,removeformat,|,media,charmap,|,outdent,indent,|,undo,redo,|,exm_img,exm_icons,exm_page', true);
    //echo $post->getVar('content'); die();
    $editor = new RMFormEditor('', 'content', '100%', '350px', $edit ? $post->getVar('content', $cuSettings->editor_type == 'tiny' ? 's' : 'e') : '');
    // Get current metas
    $meta_names = MWFunctions::get()->get_metas();
    //RMTemplate::get()->add_script(RMCURL.'/include/js/jquery.validate.min.js');
    //RMTemplate::get()->add_script(RMCURL.'/include/js/forms.js');
    //RMTemplate::get()->add_head('<script type="text/javascript">$("form#mw-form-posts").validate();</script>');
    include '../templates/admin/mywords-formposts.php';
    xoops_cp_footer();
}
示例#7
0
 /**
  * Check if given post already exists
  * @param object MWPost object
  * @return bool
  */
 public function post_exists(MWPost &$post)
 {
     if ($post->getVar('title', 'n') == '') {
         return false;
     }
     // the pubdate
     if ($post->getVar('pubdate') <= 0) {
         $day = date('j', $post->getVar('schedule'));
         $month = date('n', $post->getVar('schedule'));
         $year = $day = date('Y', $post->getVar('schedule'));
         $bdate = mktime(0, 0, 0, $month, $day, $year);
         $tdate = mktime(23, 59, 59, $month, $day, $year);
     } else {
         $day = date('j', $post->getVar('pubdate'));
         $month = date('n', $post->getVar('pubdate'));
         $year = date('Y', $post->getVar('pubdate'));
         $bdate = mktime(0, 0, 0, $month, $day, $year);
         $tdate = $bdate + 86400;
     }
     $db = XoopsDatabaseFactory::getDatabaseConnection();
     $sql = "SELECT COUNT(*) FROM " . $db->prefix("mw_posts") . " WHERE (pubdate>={$bdate} AND pubdate<={$tdate}) AND \n        \t\t(title='" . $post->getVar('title', 'n') . "' OR shortname='" . $post->getVar('shortname', 'n') . "')";
     if (!$post->isNew()) {
         $sql .= " AND id_post<>" . $post->id();
     }
     list($num) = $db->fetchRow($db->query($sql));
     if ($num > 0) {
         return true;
     }
     return false;
 }
示例#8
0
// Email: i.bitcero@gmail.com
// License: GPL 2.0
// --------------------------------------------------------------
header('Content-Type: text/xml');
require '../../mainfile.php';
load_mod_locale('mywords');
global $xoopsLogger;
$xoopsLogger->renderingEnabled = false;
error_reporting(0);
$xoopsLogger->activated = false;
$id = rmc_server_var($_REQUEST, 'trackback', 0);
if ($id <= 0) {
    die;
}
$post = new MWPost($id);
if ($post->isNew()) {
    die;
}
$editor = new MWEditor($post->getVar('author'));
if ($editor->isNew()) {
    $user = new XoopsUser($post->getVar('author'));
}
$track = new MWTrackback($xoopsConfig['sitename'], $editor->getVar('name'));
$id = $track->post_id;
// The id of the item being trackbacked
$url = $track->url;
// The URL from which we got the trackback
$title = $track->title;
// Subject/title send by trackback
$excerpt = $track->excerpt;
// Short text send by trackback
/**
* Categories widget
*/
function mw_widget_categories()
{
    global $xoopsUser, $allowed_cats;
    $widget['title'] = __('Categories', 'admin_mywords');
    $widget['icon'] = '';
    $id = rmc_server_var($_REQUEST, 'id', 0);
    $postcat = array();
    $edit = false;
    if ($id > 0) {
        $post = new MWPost($id);
        if ($post->isNew()) {
            unset($post);
            $postcat = array();
        } else {
            $edit = true;
            $postcat = $post->get_categos(true);
        }
    }
    ob_start();
    ?>
<div class="rmc_widget_content_reduced">
<form id="mw-post-categos-form">
<div class="w_categories" id="w-categos-container">
<?php 
    $categories = array();
    MWFunctions::categos_list($categories);
    foreach ($categories as $catego) {
        ?>
<label class="cat_label" style="padding-left: <?php 
        echo $catego['indent'] * 10;
        ?>
px;"><input type="checkbox" name="categories[]" id="categories[]" value="<?php 
        echo $catego['id_cat'];
        ?>
"<?php 
        echo in_array($catego['id_cat'], $postcat) ? ' checked="checked"' : '';
        ?>
 /> <?php 
        echo $catego['name'];
        ?>
</label>
<?php 
    }
    ?>
</div>
<?php 
    if ($xoopsUser->isAdmin() || $allowed_cats) {
        ?>
<div class="w_catnew_container">
    <a href="javascript:;" id="a-show-new"><strong><?php 
        _e('+ Add Categories', 'admin_mywords');
        ?>
</strong></a>
    <div id="w-catnew-form">
    	<label class="error" style="display: none;" for="w-name"><?php 
        _e('Please provide a name', 'admin_mywords');
        ?>
</label>
    	<input type="text" name="name" id="w-name" value="" class="required" />
    	<select name="parent" id="w-parent">
    		<option value="0"><?php 
        _e('Parent category', 'admin_mywords');
        ?>
</option>
    		<?php 
        foreach ($categories as $catego) {
            ?>
    		<option value="<?php 
            _e($catego['id_cat']);
            ?>
"><?php 
            _e($catego['name']);
            ?>
</option>
    		<?php 
        }
        ?>
    	</select>
    	<input type="button" id="create-new-cat" value="<?php 
        _e('Add', 'admin_mywords');
        ?>
" />
    	<a href="javascript:;"><?php 
        _e('Cancel', 'admin_mywords');
        ?>
</a>
    </div>
</div>
<?php 
    }
    ?>
</form>
</div>
<?php 
    $widget['content'] = ob_get_clean();
    return $widget;
}
示例#10
0
/**
* Publish widget
* @return array
*/
function mw_widget_publish()
{
    global $xoopsUser;
    RMTemplate::get()->add_style('publish_widget.css', 'mywords');
    RMTemplate::get()->add_style('forms.css', 'rmcommon');
    RMTemplate::get()->add_style('jquery.css', 'rmcommon');
    RMTemplate::get()->add_script(XOOPS_URL . '/modules/mywords/include/js/scripts.php?file=posts.js');
    RMTemplate::get()->add_script(XOOPS_URL . '/modules/mywords/include/js/mktime.js');
    RMTemplate::get()->add_script(RMCURL . '/include/js/forms.js');
    $widget['title'] = __('Publish', 'mywords');
    $widget['icon'] = '';
    $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0;
    $edit = false;
    if ($id > 0) {
        $post = new MWPost($id);
        if ($post->isNew()) {
            unset($post);
        } else {
            $edit = true;
        }
    }
    if ($edit) {
        switch ($post->getVar('status')) {
            case 'draft':
                $status = __('Draft', 'mywords');
                break;
            case 'pending':
                $status = __('Pending review', 'mywords');
                break;
            case 'publish':
                $status = __('Published', 'mywords');
                break;
            case 'scheduled':
                $status = __('Scheduled', 'mywords');
                break;
        }
        $visibility = $post->getVar('visibility') == 'public' ? 'Public' : ($post->getVar('visibility') == 'password' ? 'Password Protected' : 'Private');
    } else {
        $status = 'Published';
        $visibility = 'Public';
    }
    ob_start();
    ?>
<div class="rmc_widget_content_reduced publish_container">
<form id="mw-post-publish-form">
<!-- Opciones de Publicación -->
<div class="publish_options">
<?php 
    _e('Status:', 'mywords');
    ?>
 <strong id="publish-status-legend"><?php 
    _e($status, 'mywords');
    ?>
</strong> &nbsp; <a href="javascript:;" id="edit-publish"><?php 
    _e('Edit', 'mywords');
    ?>
</a>
	<div id="publish-options" style="display: none;">
		<select name="status" id="status">
            <option value="publish"<?php 
    echo $edit && $post->getVar('status') == 'publish' ? 'selected="selected"' : ($edit ? '' : 'selected="selected"');
    ?>
><?php 
    _e('Published', 'mywords');
    ?>
</option>
			<option value="draft"<?php 
    echo $edit && $post->getVar('status') == 'draft' ? 'selected="selected"' : '';
    ?>
><?php 
    _e('Draft', 'mywords');
    ?>
</option>
			<option value="pending"<?php 
    echo $edit && $post->getVar('status') == 'pending' ? 'selected="selected"' : '';
    ?>
><?php 
    _e('Pending Review', 'mywords');
    ?>
</option>
		</select>
		<input type="button" name="publish-ok" id="publish-ok" class="button" value="<?php 
    _e('Apply', 'mywords');
    ?>
" /><br />
		<a href="javascript:;" onclick="$('#publish-options').slideUp('slow'); $('#edit-publish').show();"><?php 
    _e('Cancel', 'mywords');
    ?>
</a>
	</div>
</div>
<!-- //Opciones de Publicación -->
<!-- Visibilidad -->
<div class="publish_options">
<?php 
    _e('Visibility:', 'mywords');
    ?>
 <strong id="visibility-caption"><?php 
    _e($visibility, 'mywords');
    ?>
</strong> &nbsp; <a href="javascript:;" id="visibility-edit"><?php 
    _e('Edit', 'mywords');
    ?>
</a>
<?php 
    if (!$edit) {
        $visibility = 'public';
    } else {
        $visibility = $post->getVar('visibility');
    }
    ?>
    <div id="visibility-options">
        <input type="radio" name="visibility" value="public" id="visibility-public"<?php 
    echo $visibility == 'public' ? ' checked="checked"' : '';
    ?>
 /> <label for="visibility-public"><?php 
    _e('Public', 'mywords');
    ?>
</label><br />
        <input type="radio" name="visibility" value="password" id="visibility-password"<?php 
    echo $visibility == 'password' ? ' checked="checked"' : '';
    ?>
 /> <label for="visibility-password"><?php 
    _e('Password protected', 'mywords');
    ?>
</label><br />
        <span id="vis-password-text" style="<?php 
    _e($visibility == 'password' ? '' : 'display: none');
    ?>
">
            <label>
            <?php 
    _e('Password:'******'mywords');
    ?>
            <input type="text" name="vis_password" id="vis-password" value="<?php 
    echo $edit ? $post->getVar('password') : '';
    ?>
" class="options_input" />
            </label>
        <br /></span>
        <input type="radio" name="visibility" value="private" id="visibility-private"<?php 
    echo $visibility == 'private' ? ' checked="checked"' : '';
    ?>
 /> <label for="visibility-private"><?php 
    _e('Private', 'mywords');
    ?>
</label><br /><br />
        <input type="button" name="vis-button" id="vis-button" value="<?php 
    _e('Apply', 'mywords');
    ?>
" class="button" />
        <a href="javascript:;" id="vis-cancel"><?php 
    _e('Cancel', 'mywords');
    ?>
</a>
    </div>
</div>
<!-- /Visibilidad -->
<!-- Schedule -->
<div class="publish_options">
<?php 
    _e('Publish', 'mywords');
    ?>
 <strong id="schedule-caption"><?php 
    echo $edit ? $post->getVar('pubdate') > 0 ? __('Inmediatly', 'mywords') : date("d, M Y \\@ H:i", $post->getVar('schedule')) : __('Inmediatly', 'mywords');
    ?>
</strong> &nbsp; <a href="javascript:;" class="edit-schedule"><?php 
    _e('Edit', 'mywords');
    ?>
</a>
    <div class="schedule-options" style="display: none;">
        <?php 
    // Determinamos la fecha correcta
    $time = $edit ? $post->getVar('pubdate') > 0 ? $post->getVar('pubdate') : $post->getVar('schedule') : time();
    $day = date("d", $time);
    $month = date("n", $time);
    $year = date("Y", $time);
    $hour = date("H", $time);
    $minute = date("i", $time);
    $months = array(__('Jan', 'mywords'), __('Feb', 'mywords'), __('Mar', 'mywords'), __('Apr', 'mywords'), __('May', 'mywords'), __('Jun', 'mywords'), __('Jul', 'mywords'), __('Aug', 'mywords'), __('Sep', 'mywords'), __('Oct', 'mywords'), __('Nov', 'mywords'), __('Dec', 'mywords'));
    ?>
        <input type="text" name="schedule_day" id="schedule-day" size="2" maxlength="2" value="<?php 
    _e($day);
    ?>
" />
        <select name="schedule_month" id="schedule-month">
            <?php 
    for ($i = 1; $i <= 12; $i++) {
        ?>
                <option value="<?php 
        _e($i);
        ?>
" "<?php 
        if ($month == $i) {
            echo 'selected="selected"';
        }
        ?>
"><?php 
        _e($months[$i - 1]);
        ?>
</option>
            <?php 
    }
    ?>
        </select>
        <input type="text" name="schedule_year" id="schedule-year" size="2" maxlength="4" value="<?php 
    _e($year);
    ?>
" /> @
        <input type="text" name="schedule_hour" id="schedule-hour" size="2" maxlength="2" value="<?php 
    _e($hour);
    ?>
" /> :
        <input type="text" name="schedule_minute" id="schedule-minute" size="2" maxlength="2" value="<?php 
    _e($minute);
    ?>
" /><br /><br />
        <input type="button" class="button" name="schedule-ok" id="schedule-ok" value="<?php 
    _e('Apply', 'mywords');
    ?>
" />
        <a href="javascript:;" class="schedule-cancel"><?php 
    _e('Cancel', 'mywords');
    ?>
</a>
        <input type="hidden" name="schedule" id="schedule" value="<?php 
    _e("{$day}-{$month}-{$year}-{$hour}-{$minute}");
    ?>
" />
    </div>
</div>
<!-- /Shedule -->
<div class="publish_options no_border">
<?php 
    _e('Author:', 'mywords');
    $user = new RMFormUser('', 'author', 0, $edit ? array($post->getVar('author')) : array($xoopsUser->uid()));
    if (!$xoopsUser->isAdmin()) {
        $user->button(false);
    }
    echo $user->render();
    ?>
</div>
<div class="widget_button">


<input type="submit" value="<?php 
    _e($edit ? 'Update Post' : 'Publish', 'mywords');
    ?>
" class="button default" id="publish-submit" />
</div>


</form>
</div>
<?php 
    $widget['content'] = ob_get_clean();
    return $widget;
}
示例#11
0
/**
* Widget that show tags selection in a post form
*/
function mw_widget_addtags()
{
    global $xoopsModuleConfig, $xoopsUser, $allowed_tags;
    $widget['title'] = __('Add Tags', 'admin_mywords');
    RMTemplate::get()->add_script(XOOPS_URL . '/modules/mywords/include/js/scripts.php?file=tags.js');
    $widget['icon'] = '';
    $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0;
    $edit = false;
    if ($id > 0) {
        $post = new MWPost($id);
        if ($post->isNew()) {
            unset($post);
        } else {
            $edit = true;
        }
    }
    ob_start();
    ?>
<div class="rmc_widget_content_reduced">
<form id="mw-post-tags-form">
<?php 
    if ($xoopsUser->isAdmin() || $allowed_tags) {
        ?>
<div class="tags_box">
<input type="text" name="tagsm" id="tags-m" class="formInput wtLeftInput" />
<input type="button" name="tags-button" id="tags-button" class="button" value="<?php 
        _e('+ Add', 'admin_mywords');
        ?>
" /><br />
<span class="descriptions"><em><?php 
        _e('Separate multiple tags with commas', 'admin_mywords');
        ?>
</em></span>
</div>
<?php 
    }
    $tags = $edit ? $post->tags() : array();
    ?>
<div id="tags-container">
    <span class="tip_legends" style="<?php 
    echo empty($tags) ? 'display: none;' : '';
    ?>
">
        <?php 
    _e('Used Tags', 'admin_mywords');
    ?>
    </span>
    <?php 
    foreach ($tags as $tag) {
        ?>
    <label><input type='checkbox' name='tags[]' checked='checked' value='<?php 
        echo $tag['tag'];
        ?>
' /><?php 
        echo $tag['tag'];
        ?>
</label>
    <?php 
    }
    unset($tags);
    ?>
</div>
<a href="javascript:;" id="show-used-tags"><?php 
    _e('Choose between most populars tags', 'admin_mywords');
    ?>
</a>
<div id="popular-tags-container" style="display: none;">
    <?php 
    $tags = MWFunctions::get_tags('*', '', 'posts DESC', "0,{$xoopsModuleConfig['tags_widget_limit']}");
    foreach ($tags as $tag) {
        ?>
        <a href="javascript:;" id="tag-<?php 
        echo $tag['id_tag'];
        ?>
" class="add_tag" style="font-size: <?php 
        echo MWFunctions::get()->tag_font_size($tag['posts'], 2);
        ?>
em;"><?php 
        echo $tag['tag'];
        ?>
</a>
    <?php 
    }
    ?>
</div>
</form>
</div>
<?php 
    $widget['content'] = ob_get_clean();
    return $widget;
}
示例#12
0
/**
 * Muestra el formulario para la creación de un nuevo artículo
 */
function newForm($edit = 0)
{
    global $db, $xoopsModule, $myts, $util, $xoopsConfig, $tpl, $xoopsSecurity;
    define('RMCSUBLOCATION', 'new_post');
    if ($edit) {
        $id = rmc_server_var($_GET, 'id', 0);
        if ($id <= 0) {
            redirectMsg('posts.php', __('Please, specify a valid post ID', 'mywords'), 1);
            die;
        }
        $post = new MWPost($id);
        if ($post->isNew()) {
            redirectMsg('posts.php', __('Specified post does not exists!', 'mywords'), 1);
            die;
        }
    }
    MWFunctions::include_required_files();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> &raquo; ' . ($edit ? __('Editing post', 'mywords') : __('Creating a new post', 'mywords')));
    $head = '<script type="text/javascript" src="' . MW_URL . '/include/forms_post.js"></script>';
    xoops_cp_header($head);
    include RMCPATH . '/class/form.class.php';
    /*include RMCPATH.'/class/fields/formelement.class.php';
      include RMCPATH.'/class/fields/editor.class.php';*/
    TinyEditor::getInstance()->add_config('elements', 'content_editor');
    //TinyEditor::getInstance()->add_config('theme_advanced_buttons1', 'bold,italic,strikethrough,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,|,link,unlink,|,spellchecker,fullscreen,|,exm_more,exm_adv', true);
    //TinyEditor::getInstance()->add_config('theme_advanced_buttons2','formatselect,underline,justifyfull,forecolor,|,pastetext,pasteword,removeformat,|,media,charmap,|,outdent,indent,|,undo,redo,|,exm_img,exm_icons,exm_page', true);
    //echo $post->getVar('content'); die();
    $editor = new RMFormEditor('', 'content', '99%', '300px', $edit ? $post->getVar('content', $rmc_config['editor_type'] != 'tiny' ? 'e' : 's') : '');
    // Get current metas
    $meta_names = MWFunctions::get()->get_metas();
    //RMTemplate::get()->add_script(RMCURL.'/include/js/jquery.validate.min.js');
    //RMTemplate::get()->add_script(RMCURL.'/include/js/forms.js');
    //RMTemplate::get()->add_head('<script type="text/javascript">$("form#mw-form-posts").validate();</script>');
    include '../templates/admin/mywords_formposts.php';
    xoops_cp_footer();
}