Beispiel #1
0
/**
* @desc Muestra el formulario para agregar un nuevo sitio
*/
function edit_bookmark()
{
    global $xoopsModule, $xoopsConfig, $xoopsSecurity, $rmTpl;
    $id = rmc_server_var($_GET, 'id', 0);
    if ($id <= 0) {
        redirectMsg('bookmarks.php', __('Site ID not provided!', 'mywords'), 1);
        die;
    }
    $book = new MWBookmark($id);
    if ($book->isNew()) {
        redirectMsg('bookmarks.php', __('Social site not exists!', 'mywords'), 1);
        die;
    }
    $temp = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . '/modules/mywords/images/icons');
    foreach ($temp as $icon) {
        $icons[] = array('url' => XOOPS_URL . "/modules/mywords/images/icons/{$icon}", 'name' => $icon);
    }
    MWFunctions::include_required_files();
    RMBreadCrumb::get()->add_crumb(__('Social Sites', 'mywords'), 'bookmarks.php');
    RMBreadCrumb::get()->add_crumb(__('Edit Site', 'mywords'));
    xoops_cp_header();
    $show_edit = true;
    include $rmTpl->get_template('admin/mywords_bookmarks.php', 'module', 'mywords');
    $rmTpl->assign('xoops_pagetitle', __('Edit Social Site', 'mywords'));
    $rmTpl->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    $rmTpl->add_script('../include/js/scripts.php?file=bookmarks.js');
    xoops_cp_footer();
}
Beispiel #2
0
function show_mw_trackbacks()
{
    global $xoopsModule, $xoopsSecurity;
    $id = rmc_server_var($_GET, 'id', 0);
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("mw_trackbacks");
    if ($id > 0) {
        $sql .= "WHERE post={$id}";
    }
    list($num) = $db->fetchRow($db->query($sql));
    $page = rmc_server_var($_GET, 'page', 1);
    $limit = isset($limit) && $limit > 0 ? $limit : 15;
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('trackbacks.php?page={PAGE_NUM}' . ($id > 0 ? '&amp;id=' . $id : ''));
    $sql = str_replace("COUNT(*)", '*', $sql);
    $sql .= " ORDER BY `date` LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    $posts = array();
    // posts cache
    $trackbacks = array();
    // Get trackbacks data
    while ($row = $db->fetchArray($result)) {
        $trac = new MWTrackbackObject();
        $trac->assignVars($row);
        $posts[$trac->getVar('post')] = isset($posts[$trac->getVar('post')]) ? $posts[$trac->getVar('post')] : new MWPost($trac->getVar('post'));
        $trackbacks[] = array('tb' => $trac, 'post' => array('title' => $posts[$trac->getVar('post')]->getVar('title'), 'link' => $posts[$trac->getVar('post')]->isNew() ? '' : $posts[$trac->getVar('post')]->permalink()));
    }
    // Event
    $trackbacks = RMEvents::get()->run_event("mywords.trackbacks.list", $trackbacks);
    MWFunctions::include_required_files();
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_script(XOOPS_URL . '/modules/mywords/include/js/scripts.php?file=trackbacks.js');
    xoops_cp_header();
    xoops_cp_location('<a href="' . XOOPS_URL . '/modules/mywords/admin/">' . $xoopsModule->getVar('name') . '</a> &raquo; ' . __('Trackbacks', 'mywords'));
    include RMTemplate::get()->get_template('admin/mywords_trackbacks.php', 'module', 'mywords');
    xoops_cp_footer();
}
Beispiel #3
0
function edit_editor()
{
    global $xoopsModule, $xoopsSecurity;
    $id = rmc_server_var($_GET, 'id', 0);
    $page = rmc_server_var($_GET, 'page', 1);
    if ($id <= 0) {
        redirectMsg('editors.php?page=' . $page, __('Editor ID not provided!.', 'mywords'), 1);
        die;
    }
    $editor = new MWEditor($id);
    if ($editor->isNew()) {
        redirectMsg('editors.php?page=' . $page, __('Editor does not exists!', 'mywords'), 1);
        die;
    }
    include_once RMCPATH . '/class/form.class.php';
    MWFunctions::include_required_files();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> &raquo; <a href="editors.php">' . __('Editors', 'mywords') . '</a> &raquo; ' . __('Editing Editor', 'mywords'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Editing Editor', 'mywords'));
    xoops_cp_header();
    $show_edit = true;
    include RMTemplate::get()->get_template('admin/mywords_editors.php', 'module', 'mywords');
    xoops_cp_footer();
}
Beispiel #4
0
function edit_editor()
{
    global $xoopsModule, $xoopsSecurity;
    $id = rmc_server_var($_GET, 'id', 0);
    $page = rmc_server_var($_GET, 'page', 1);
    if ($id <= 0) {
        redirectMsg('editors.php?page=' . $page, __('Editor ID not provided!.', 'mywords'), 1);
        die;
    }
    $editor = new MWEditor($id);
    if ($editor->isNew()) {
        redirectMsg('editors.php?page=' . $page, __('Editor does not exists!', 'mywords'), 1);
        die;
    }
    include_once RMCPATH . '/class/form.class.php';
    MWFunctions::include_required_files();
    RMTemplate::get()->assign('xoops_pagetitle', __('Editing Editor', 'mywords'));
    RMBreadCrumb::get()->add_crumb(__('Editors Management', 'mywords'), 'editors.php');
    RMBreadCrumb::get()->add_crumb(__('Edit Editor', 'mywords'));
    xoops_cp_header();
    $show_edit = true;
    include RMTemplate::get()->get_template('admin/mywords-editors.php', 'module', 'mywords');
    xoops_cp_footer();
}
Beispiel #5
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();
}
Beispiel #6
0
function edit_form()
{
    global $xoopsModule, $xoopsSecurity;
    $id = rmc_server_var($_GET, 'id', 0);
    $page = rmc_server_var($_GET, 'page', 1);
    if ($id <= 0) {
        redirectMsg('tags.php?page=' . $page, __('Tag ID not provided!.', 'mywords'), 1);
        die;
    }
    $tag = new MWTag($id);
    if ($tag->isNew()) {
        redirectMsg('tags.php?page=' . $page, __('Tag does not exists!', 'mywords'), 1);
        die;
    }
    MWFunctions::include_required_files();
    RMBreadCrumb::get()->add_crumb(__('Tags management', 'mywords'), 'tags.php');
    RMBreadCrumb::get()->add_crumb(__('Edit tag', 'mywords'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Editing Tag', 'mywords'));
    xoops_cp_header();
    $show_edit = true;
    include RMTemplate::get()->get_template('admin/mywords-tags.php', 'module', 'mywords');
    xoops_cp_footer();
}
Beispiel #7
0
function edit_form()
{
    global $xoopsModule, $xoopsSecurity;
    $id = rmc_server_var($_GET, 'id', 0);
    $page = rmc_server_var($_GET, 'page', 1);
    if ($id <= 0) {
        redirectMsg('tags.php?page=' . $page, __('Tag ID not provided!.', 'mywords'), 1);
        die;
    }
    $tag = new MWTag($id);
    if ($tag->isNew()) {
        redirectMsg('tags.php?page=' . $page, __('Tag does not exists!', 'mywords'), 1);
        die;
    }
    MWFunctions::include_required_files();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> &raquo; <a href="tags.php">' . __('Tags', 'mywords') . '</a> &raquo; ' . __('Edit Tag', 'mywords'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Editing Tag', 'mywords'));
    xoops_cp_header();
    $show_edit = true;
    include RMTemplate::get()->get_template('admin/mywords_tags.php', 'module', 'mywords');
    xoops_cp_footer();
}
Beispiel #8
0
    $editors[] = array('id' => $editor->id(), 'name' => $editor->getVar('name'), 'link' => $editor->permalink(), 'total' => $row['counter']);
}
unset($editor, $result, $sql);
// URL rewriting
$rule = "RewriteRule ^" . trim($xoopsModuleConfig['basepath'], '/') . "/?(.*)\$ modules/mywords/index.php [L]";
if ($xoopsModuleConfig['permalinks'] > 1) {
    $ht = new RMHtaccess('mywords');
    $htResult = $ht->write($rule);
    if ($htResult !== true) {
        showMessage(__('An error ocurred while trying to write .htaccess file!', 'mywords'), RMMSG_ERROR);
    }
} else {
    $ht = new RMHtaccess('mywords');
    $ht->removeRule();
    $ht->write();
}
RMBreadCrumb::get()->add_crumb(__('Dashboard', 'mywords'));
include 'menu.php';
MWFunctions::include_required_files();
RMTemplate::get()->add_script('../include/js/scripts.php?file=dashboard.js');
RMTemplate::get()->add_help(__('MyWords Documentation', 'mywords'), 'http://www.xoopsmexico.net/docs/mywords/introduccion/');
// Other panels for dashboard
$dashboardPanels = [];
$dashboardPanels = RMEvents::get()->trigger('mywords.dashboard.panels', $dashboardPanels);
xoops_cp_header();
// Show Templates
RMTemplate::get()->add_body_class('dashboard');
//$tpl->header();
include RMtemplate::get()->get_template('admin/mywords-theindex.php', 'module', 'mywords');
//$tpl->footer();
xoops_cp_footer();
Beispiel #9
0
/**
 * Presenta un formulario para la creación de una nueva
 * categoría para los artículos
 */
function newForm()
{
    global $xoopsModule;
    $id = isset($_GET['id']) ? $_GET['id'] : 0;
    if ($id <= 0) {
        redirectMsg('categories.php', __('You must specify a valid category', 'mywords'), 1);
        die;
    }
    // Cargamos la categoría
    $catego = new MWCategory($id);
    // Si no existe entonces devolvemos un error
    if ($catego->isNew()) {
        redirectMsg('cats.php', __('Specified category not exists!', 'mywords'), 1);
        die;
    }
    MWFunctions::include_required_files();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> &raquo; ' . __('New Category', 'mywords'));
    xoops_cp_header();
    $cats = array();
    MWFunctions::categos_list($cats, 0, 0, true, $id);
    $form = new RMForm($edit ? __('Edit Category', 'mywords') : __('Edit Category', 'mywords'), 'frmNew', 'categories.php');
    $form->styles('width: 30%;', 'odd');
    $form->addElement(new RMFormText(__('Category name', 'mywords'), 'name', 50, 150, $catego->getVar('name')), true);
    $form->addElement(new RMFormText(__('Category slug', 'mywords'), 'shortname', '', '150', $catego->getVar('shortname', 'n')));
    $form->addElement(new RMFormTextArea(__('Category description', 'mywords'), 'desc', 5, 45, $catego->getVar('description', 'e')));
    $ele = new RMFormSelect(__('Category Parent', 'mywords'), 'parent');
    $ele->addOption(0, _SELECT, $catego->getVar('parent') == 0 ? 1 : 0);
    foreach ($cats as $k) {
        $ele->addOption($k['id_cat'], str_repeat("-", $k['indent']) . ' ' . $k['name'], $catego->getVar('parent') == $k['id_cat'] ? 1 : 0);
    }
    $form->addElement($ele);
    $form->addElement(new RMFormHidden('op', 'saveedit'));
    $form->addElement(new RMFormHidden('id', $id));
    $ele = new RMFormButtonGroup('', ' ');
    $ele->addButton('sbt', __('Update Category', 'mywords'), 'submit');
    $ele->addButton('cancel', __('Cancel', 'mywords'), 'button');
    $ele->setExtra('cancel', "onclick='history.go(-1);'");
    $form->addElement($ele);
    $form->display();
    xoops_cp_footer();
}
Beispiel #10
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();
}