function rmmfSave() { global $db, $myts; $nombre = rmc_server_var($_POST, 'nombre', ''); $parent = rmc_server_var($_POST, 'parent', 0); $desc = rmc_server_var($_POST, 'desc', ''); $orden = rmc_server_var($_POST, 'orden', 0); if ($nombre == '') { redirectMsg('categos.php?op=new', __('You must provide a name for this category', 'admin_myfolder'), 1); die; } $tbl = $db->prefix("rmmf_categos"); list($num) = $db->fetchRow($db->query("SELECT COUNT(*) FROM {$tbl} WHERE nombre='{$nombre}' AND parent='{$parent}'")); if ($num > 0) { redirectMsg('categos.php?op=new', __('A category with same name already exists!', 'admin_myfolder'), 1); die; } $desc = $myts->makeTareaData4Save($desc); $sql = "INSERT INTO {$tbl} (`nombre`,`orden`,`desc`,`parent`) VALUES\n\t\t\t('{$nombre}','{$orden}','{$desc}','{$parent}')"; $db->query($sql); if ($db->error() != '') { redirectMsg('categos.php?op=new', __('There was some errors while trying to update database!', 'admin_myfolder') . '<br />' . $db->error()); die; } else { redirectMsg('categos.php', __('Database updated successfully!', 'admin_myfolder')); die; } }
/** * @desc Envía correo de aprobación de publicación * @param Object $res Publicación **/ function mail_approved(RDResource &$res) { global $xoopsModuleConfig, $xoopsConfig; $config_handler =& xoops_gethandler('config'); $mconfig = $config_handler->getConfigsByCat(XOOPS_CONF_MAILER); $errors = ''; $user = new XoopsUser($res->getVar('owner')); $member_handler =& xoops_gethandler('member'); $method = $user->getVar('notify_method'); $mailer = new RMMailer('text/plain'); $mailer->add_xoops_users($user); $mailer->set_subject(sprintf(__('Publication <%s> approved!', 'docs'), $res->getVar('title'))); $mailer->assign('dear_user', $user->getVar('name') != '' ? $user->getVar('name') : $user->getVar('uname')); $mailer->assign('link_to_resource', $res->permalink()); $mailer->assign('site_name', $xoopsConfig['sitename']); $mailer->assign('resource_name', $res->getVar('title')); $mailer->template(RMTemplate::get()->get_template('mail/resource_approved.php', 'module', 'docs')); switch ($method) { case '1': $mailer->set_from_xuser($mconfig['fromuid']); $ret = $mailer->send_pm(); break; case '2': $ret = $mailer->send(); break; } $page = rmc_server_var($_POST, 'page', 1); return $ret; }
function show_rss_content() { global $xoopsConfig; include_once $GLOBALS['xoops']->path('class/template.php'); $tpl = new XoopsTpl(); $module = rmc_server_var($_GET, 'mod', ''); if ($module == '') { redirect_header('backend.php', 1, __('Choose an option to see its feed', 'rmcommon')); die; } if (!file_exists(XOOPS_ROOT_PATH . '/modules/' . $module . '/rss.php')) { redirect_header('backend.php', 1, __('This module does not support rss feeds', 'rmcommon')); die; } $GLOBALS['xoopsLogger']->activated = false; if (function_exists('mb_http_output')) { mb_http_output('pass'); } header('Content-Type:text/xml; charset=utf-8'); include XOOPS_ROOT_PATH . '/modules/' . $module . '/rss.php'; if (!isset($rss_channel['image'])) { $rmc_config = RMFunctions::configs(); $rss_channel['image']['url'] = $rmc_config['rssimage']; $dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.png'); $rss_channel['image']['width'] = $dimention[0] > 144 ? 144 : $dimention[0]; $rss_channel['image']['height'] = $dimention[1] > 400 ? 400 : $dimention[1]; } include RMTemplate::get()->get_template('rmc_rss.php', 'module', 'rmcommon'); }
function search_resources() { global $xoopsConfig, $xoopsUser, $page, $xoopsTpl; $keyword = rmc_server_var($_GET, 'keyword', ''); $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT COUNT(*) FROM " . $db->prefix("rd_resources") . " WHERE (title LIKE '%{$keyword}%' OR description LIKE '%{$keyword}%') AND public=1 AND approved=1"; list($num) = $db->fetchRow($db->query($sql)); $page = rmc_server_var($_GET, 'page', 1); $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(RDFunctions::make_link('search') . '?keyword=' . $keyword . '&page={PAGE_NUM}'); $sql = "SELECT * FROM " . $db->prefix("rd_resources") . " WHERE (title LIKE '%{$keyword}%' OR description LIKE '%{$keyword}%') AND public=1 AND approved=1 LIMIT {$start}, {$limit}"; $result = $db->query($sql); $resources = array(); while ($row = $db->fetchArray($result)) { $res = new RDResource(); $res->assignVars($row); $resources[] = array('id' => $res->id(), 'title' => $res->getVar('title'), 'desc' => TextCleaner::truncate($res->getVar('description'), 100), 'link' => $res->permalink(), 'created' => $res->getVar('created'), 'owner' => $res->getVar('owner'), 'uname' => $res->getVar('owname'), 'reads' => $res->getVar('reads')); } RDFunctions::breadcrumb(); RMBreadCrumb::get()->add_crumb(__('Browsing recent Documents', 'docs')); RMTemplate::get()->add_style('docs.css', 'docs'); include 'header.php'; $xoopsTpl->assign('xoops_pagetitle', sprintf(__('Search results for "%s"', 'docs'), $keyword)); include RMEvents::get()->run_event('docs.template.search', RMTemplate::get()->get_template('rd_search.php', 'module', 'docs')); include 'footer.php'; }
/** * Create the module toolbar. This function must be called only from rmcommon module administration */ public static function create_toolbar() { if (RMCLOCATION == 'users') { RMTemplate::get()->add_tool(__('Users', 'rmcommon'), 'users.php', 'icon icon-users', 'allusers', array('class' => 'cu-tool tool-users-list')); RMTemplate::get()->add_tool(__('Add', 'rmcommon'), 'users.php?action=new', 'icon icon-plus', 'newuser', array('class' => 'cu-tool tool-user-add')); } elseif (RMCLOCATION == 'groups') { RMTemplate::get()->add_tool(__('Groups', 'rmcommon'), 'groups.php', 'icon icon-users', 'allgroups', array('class' => 'cu-tool tool-groups')); RMTemplate::get()->add_tool(__('Add', 'rmcommon'), '#', 'icon icon-plus', 'newgroup', array('class' => 'cu-tool tool-group-add', 'data-action' => 'load-remote-dialog', 'data-url' => 'groups.php?action=new-group', 'data-parameters' => '{action: \'new-group\'}')); /* * Next buttons are available only when groups list is shown */ RMTemplate::get()->add_tool(__('Edit', 'rmcommon'), '#', 'icon icon-pencil', 'editgroup', array('class' => 'cu-tool tool-group-edit', 'data-activator' => 'groups-list', 'data-oncount' => '== 1', 'data-action' => 'load-remote-dialog', 'data-retriever' => 'groupsController.retrieveSingle', 'data-url' => 'groups.php?action=new-group', 'disabled' => 'disabled', 'title' => __('Edit Group', 'rmcommon'))); RMTemplate::get()->add_tool(__('Delete', 'rmcommon'), '#', 'icon icon-bin', 'deletegroup', array('class' => 'cu-tool tool-group-delete', 'data-activator' => 'groups-list', 'data-oncount' => '> 0', 'disabled' => 'disabled', 'title' => __('Delete Groups', 'rmcommon'), 'data-action' => 'groupsController.delete')); } elseif (RMCLOCATION == 'imgmanager') { RMTemplate::get()->add_tool(__('Categories', 'rmcommon'), 'images.php?action=showcats', '', 'showcategories', array('class' => 'cu-tool tool-categories-images')); RMTemplate::get()->add_tool(__('New', 'rmcommon'), 'images.php?action=newcat', '', 'newcategory', array('class' => 'cu-tool tool-category-add')); $cat = rmc_server_var($_REQUEST, 'category', 0); if ($cat > 0) { RMTemplate::get()->add_tool(__('Images', 'rmcommon'), 'images.php?category=' . $cat, '', 'showimages', array('class' => 'cu-tool tool-images')); } RMTemplate::get()->add_tool(__('Add', 'rmcommon'), 'images.php?action=new' . ($cat > 0 ? "&category={$cat}" : ''), '', 'addimages', array('class' => 'cu-tool tool-images-add')); } else { RMTemplate::get()->add_tool(__('Dashboard', 'rmcommon'), 'index.php', '', 'dashboard', array('class' => 'cu-tool tool-dashboard')); RMTemplate::get()->add_tool(__('Modules', 'rmcommon'), 'modules.php', '', 'modules', array('class' => 'cu-tool tool-modules')); RMTemplate::get()->add_tool(__('Blocks', 'rmcommon'), 'blocks.php', '', 'blocks', array('class' => 'cu-tool tool-blocks')); RMTemplate::get()->add_tool(__('Groups', 'rmcommon'), 'groups.php', '', 'groups', array('class' => 'cu-tool tool-groups')); RMTemplate::get()->add_tool(__('Users', 'rmcommon'), 'users.php', '', 'users', array('class' => 'cu-tool tool-users')); RMTemplate::get()->add_tool(__('Images', 'rmcommon'), 'images.php', '', 'imgmanager', array('class' => 'cu-tool tool-images')); RMTemplate::get()->add_tool(__('Comments', 'rmcommon'), 'comments.php', '', 'comments', array('class' => 'cu-tool tool-comments')); RMTemplate::get()->add_tool(__('Plugins', 'rmcommon'), 'plugins.php', '', 'plugins', array('class' => 'cu-tool tool-plugins')); RMTemplate::get()->add_tool(__('Updates', 'rmcommon'), 'updates.php', '', 'updates', array('class' => 'cu-tool tool-updates')); } RMEvents::get()->run_event('rmcommon.create.toolbar'); }
/** * 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; }
/** * To prevent errors when upload images with closed site */ public function eventCoreIncludeCommonLanguage() { global $xoopsConfig; if ($xoopsConfig['cpanel'] != 'redmexico') { $db = XoopsDatabaseFactory::getDatabaseConnection(); $db->queryF("UPDATE " . $db->prefix("config") . " SET conf_value='redmexico' WHERE conf_modid=0 AND conf_catid=1 AND conf_name='cpanel'"); } /** * Check before to a rmcommon native module be installed */ $fct = RMHttpRequest::get('fct', 'string', ''); $op = RMHttpRequest::get('op', 'string', ''); if ('modulesadmin' == $fct && 'install' == $op) { $dirname = RMHttpRequest::get('module', 'string', ''); if ('' != $dirname) { $module = new XoopsModule(); $module->loadInfoAsVar($dirname); if ($module->getInfo('rmnative')) { RMUris::redirect_with_message(__('Please install %s using the modules manager from Common Utilities to prevent errors during install.', 'rmcommon'), RMCURL . '/modules.php?action=install&dir=' . $dirname, RMMSG_WARN); } } } if (RMUris::current_url() == RMCURL . '/include/upload.php' && $xoopsConfig['closesite']) { $security = rmc_server_var($_POST, 'rmsecurity', 0); $data = TextCleaner::getInstance()->decrypt($security, true); $data = explode("|", $data); // [0] = referer, [1] = session_id(), [2] = user, [3] = token $xoopsUser = new XoopsUser($data[0]); if ($xoopsUser->isAdmin()) { $xoopsConfig['closesite'] = 0; } } RMEvents::get()->run_event('rmcommon.include.common.language'); }
function rd_save_page() { $page = rmc_server_var($_POST, 'homepage', ''); if (file_put_contents(XOOPS_CACHE_PATH . '/rd_homepage.html', $page)) { redirectMsg('hpage.php', __('Page saved successfully!', 'docs'), 0); } else { redirectMsg('hpage.php', __('Page could not be saved!', 'docs'), 1); } }
public function eventRmcommonLoadRightWidgets($widgets) { if (!defined('RMCLOCATION')) { return; } include_once RMCPATH . '/include/right_widgets.php'; global $xoopsModule; if (RMCLOCATION == 'modules' && $xoopsModule->dirname() == 'rmcommon' && rmc_server_var($_REQUEST, 'action', '') == '') { $widgets[] = rmc_available_mods(); } return $widgets; }
public function eventRmcommonXoopsCommonEnd() { global $xoopsConfig; $designia = rmc_server_var($_REQUEST, 'designia', ''); if ($designia == '') { return; } switch ($designia) { case 'settings': include_once RMCPATH . '/themes/designia/include/settings.php'; die; } }
/** * To prevent errors when upload images with closed site */ public function eventCoreIncludeCommonLanguage() { global $xoopsConfig; if (RMFunctions::current_url() == RMCURL . '/include/upload.php' && $xoopsConfig['closesite']) { $security = rmc_server_var($_POST, 'rmsecurity', 0); $data = TextCleaner::getInstance()->decrypt($security, true); $data = explode("|", $data); // [0] = referer, [1] = session_id(), [2] = user, [3] = token $xoopsUser = new XoopsUser($data[0]); if ($xoopsUser->isAdmin()) { $xoopsConfig['closesite'] = 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'; }
/** * @desc Formulario de características **/ function dt_form_features($edit = 0) { global $xoopsModule, $xoopsConfig, $functions, $tpl; define('RMCSUBLOCATION', 'newfeature'); $id = rmc_server_var($_REQUEST, 'id', 0); $item = rmc_server_var($_REQUEST, 'item', 0); //Verificamos que el software sea válido if ($item <= 0) { redirectMsg('items.php', __('Download item ID not provided!', 'dtransport'), RMMSG_WARN); } //Verificamos que el software exista $sw = new DTSoftware($item); if ($sw->isNew()) { redirectMsg('items.php', __('Specified download item does not exists!', 'dtransport'), RMMSG_ERROR); } if ($edit) { if ($id <= 0) { redirectMsg('features.php?item=' . $item, __('Feature ID not specified!', 'dtransport'), RMMSG_WARN); } //Verificamos que la característica exista $ft = new DTFeature($id); if ($ft->isNew()) { redirectMsg('features.php?item=' . $item, __('Specified feature does not exists!', 'dtransport'), RMMSG_ERROR); } } $functions->toolbar(); //styles $tpl->add_style('admin.css', 'dtransport'); //scripts include_once DT_PATH . '/include/js_strings.php'; xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='items.php'>" . __('Downloads', 'dtransport') . "</a> » " . ($edit ? __('Edit Feature', 'dtransport') : __('New Feature', 'dtransport'))); xoops_cp_header(); $form = new RMForm($edit ? sprintf(__('Editing feature of "%s"', 'dtransport'), $sw->getVar('name')) : sprintf(__('New feature for "%s"', 'dtransport'), $sw->getVar('name')), 'frmfeat', 'features.php'); $form->addElement(new RMFormLabel(__('Download item', 'dtransport'), $sw->getVar('name'))); $form->addElement(new RMFormText(__('Feature title', 'dtransport'), 'title', 50, 200, $edit ? $ft->title() : ''), true); $form->addElement(new RMFormText(__('Short name', 'dtransport'), 'nameid', 50, 200, $edit ? $ft->nameId() : '')); $form->addElement(new RMFormEditor(__('Feature content', 'dtransport'), 'content', '90%', '350px', $edit ? $ft->content() : ''), true); $functions->meta_form('feat', $edit ? $ft->id() : 0, $form); $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save')); $form->addElement(new RMFormHidden('id', $id)); $form->addElement(new RMFormHidden('item', $item)); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', _SUBMIT, 'submit'); $buttons->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'features.php?item=' . $item . '\';"'); $form->addElement($buttons); $form->display(); xoops_cp_footer(); }
/** * Show the form to edit or create a category * @param int edit */ function m_categories_form($edit = 0) { global $mc, $xoopsModule, $db; MCHFunctions::toolbar(); RMTemplate::get()->assign('xoops_pagetitle', $edit ? __('Edit Category', 'match') : __('Add Category', 'match')); xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> » \n <a href='categories.php'>" . __('Categories', 'match') . '</a> » ' . ($edit ? __('Edit Category', 'match') : __('Add Category', 'match'))); xoops_cp_header(); $id = rmc_server_var($_REQUEST, 'id', 0); if ($edit) { //Verificamos si la categoría es válida if ($id <= 0) { redirectMsg('./categories.php', __('Provide a category ID!', 'match'), 1); die; } //Verificamos si la categoría existe $cat = new MCHCategory($id); if ($cat->isNew()) { redirectMsg('./categories.php', __('Specified category was not found!', 'match'), 1); die; } } $form = new RMForm($edit ? __('Edit Category', 'match') : __('Add Category', 'match'), 'frmNew', 'categories.php'); $form->addElement(new RMFormText(__('Name', 'match'), 'name', 50, 150, $edit ? $cat->getVar('name') : ''), true); if ($edit) { $form->addElement(new RMFormText(__('Short name', 'match'), 'nameid', 50, 150, $cat->getVar('nameid')), true); } $form->addElement(new RMFormEditor(__('Description', 'match'), 'desc', '100%', '250px', $edit ? $cat->getVar('description', 'e') : '')); $sel_cats = new RMFormSelect(__('Parent category:', 'match'), 'parent', 0, $edit ? $cat->getVar('parent') : 0); $categories = array(); MCHFunctions::categories_tree($categories, 0, 0, true, $edit ? $cat->id() : 0, '`name` ASC'); $sel_cats->addOption(0, __('Select category...', 'match'), $edit ? $cat->getVar('parent') == 0 ? 1 : 0 : 1); foreach ($categories as $catego) { $sel_cats->addOption($catego['id'], str_repeat('—', $catego['indent']) . ' ' . $catego['name']); } $form->addElement($sel_cats); $form->addElement(new RMFormYesNo(__('Enable category', 'match'), 'active', $edit ? $cat->getVar('active') : 1)); $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $cat->id())); } $ele = new RMFormButtonGroup(); $ele->addButton('sbt', $edit ? __('Save Changes!', 'match') : __('Add Now!', 'match'), 'submit'); $ele->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'categos.php\';"'); $form->addElement($ele); $form = RMEvents::get()->run_event('match.form.categories', $form); $form->display(); xoops_cp_footer(); }
/** * Save the items of created menus */ function xt_save_menus() { global $xtAssembler, $xtFunctions, $xoopsConfig, $xoopsLogger; $xoopsLogger->activated = false; $xoopsLogger->renderingEnabled = false; $params = rmc_server_var($_POST, 'params', ''); if (get_magic_quotes_gpc() == 1) { $params = stripslashes($params); } $params = json_decode($params, true); if (empty($params)) { xt_response(__('Menu not found!', 'xthemes'), 1, RMMSG_WARN); } $theme_menus = $xtAssembler->rootMenus(); // Errors container $errors = array(); // Menus container $menus = array(); foreach ($params as $menu) { $id = $menu['id']; if (!isset($theme_menus[$id])) { // If menu does not exists in theme then we will return an error $errors[] = sprintf(__('Current theme "%s" does not have any menu identified as "%s"', 'xthemes'), $xtAssembler->theme()->getInfo("name"), $id); } else { $menus[$menu['id']] = $menu['content']; } } if (!empty($errors)) { xt_response(__('There was some errors while trying to save menus:', 'xthemes') . '<br />' . implode("<br />", $errors), 1, RMMSG_ERROR); } $db = XoopsDatabaseFactory::getDatabaseConnection(); foreach ($menus as $id => $content) { if (!$xtAssembler->menu($id)) { if (!$db->queryF("INSERT INTO " . $db->prefix("xt_menus") . " (`theme`,`menu`,`content`) VALUES ('" . $xtAssembler->theme()->id() . "','" . $id . "','" . serialize($content) . "')")) { $errors[] = $db->error(); } } else { if (!$db->queryF("UPDATE " . $db->prefix("xt_menus") . " SET `content`='" . serialize($content) . "' WHERE `theme`='" . $xtAssembler->theme()->id() . "' AND `menu`='" . $id . "'")) { $errors[] = $db->error(); } } } if (!empty($errors)) { xt_response(__('There was some errors while trying to save menus:', 'xthemes') . '<br />' . implode("<br />", $errors), 1, RMMSG_ERROR); } xt_response(__('Menu saved successfully!', 'xthemes'), 0, RMMSG_SAVED); }
function send_message() { global $xoopsModule, $xoopsModuleConfig, $xoopsUser; $name = rmc_server_var($_POST, 'name', ''); $email = rmc_server_var($_POST, 'email', ''); $company = rmc_server_var($_POST, 'company', ''); $phone = rmc_server_var($_POST, 'phone', ''); $subject = rmc_server_var($_POST, 'subject', ''); $message = rmc_server_var($_POST, 'message', ''); if ($name == '' || $email == '' || !checkEmail($email) || $subject == '' || $message == '') { redirect_header($xoopsModuleConfig['url'], 1, __('Please fill all required fileds before to send this message!', 'contact')); die; } // Recaptcha check if (!RMEvents::get()->run_event('rmcommon.captcha.check', true)) { redirect_header($xoopsModuleConfig['url'], 1, __('Please check the security words and write it correctly!', 'contact')); die; } $xoopsMailer =& getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setBody($message . "\n--------------\n" . __('Message sent with ContactMe!', 'contact') . "\n" . $xoopsModuleConfig['url']); $xoopsMailer->setToEmails($xoopsModuleConfig['mail']); $xoopsMailer->setFromEmail($email); $xoopsMailer->setFromName($name); $xoopsMailer->setSubject($subject); if (!$xoopsMailer->send(true)) { redirect_header($xoopsModuleConfig['url'], 1, __('Message could not be delivered. Please try again.', 'contact')); die; } // Save message on database for further use $msg = new CTMessage(); $msg->setVar('subject', $subject); $msg->setVar('ip', $_SERVER['REMOTE_ADDR']); $msg->setVar('email', $email); $msg->setVar('name', $name); $msg->setVar('org', $company); $msg->setVar('body', $message); $msg->setVar('phone', $phone); $msg->setVar('register', $xoopsUser ? 1 : 0); if ($xoopsUser) { $msg->setVar('xuid', $xoopsUser->uid()); } $msg->setVar('date', time()); $msg->save(); redirect_header(XOOPS_URL, 1, __('Your message has been sent successfully!', 'contact')); }
/** * Generate a Table of Contents for an specific section */ function rd_generate_toc() { $id = rmc_server_var($_GET, 'id', 0); $number = rmc_server_var($GLOBALS, 'rd_section_number', 0); if ($id <= 0) { return; } $sec = new RDSection($id); if ($sec->isNew()) { return; } $toc = RDFunctions::get_section_tree($id, new RDResource($sec->getVar('id_res')), $number); ob_start(); include RMEvents::get()->run_event('docs.template.toc', RMTemplate::get()->get_template('specials/rd_toc.php', 'module', 'docs')); $ret = ob_get_clean(); return $ret; }
function rm_change_theme() { global $xoopsModule; $theme = rmc_server_var($_GET, 'theme', ''); if (is_file(RMCPATH . '/themes/' . $theme . '/admin_gui.php')) { $db = Database::getInstance(); $sql = "UPDATE " . $db->prefix("config") . " SET conf_value='{$theme}' WHERE conf_name='theme' AND conf_modid='" . $xoopsModule->mid() . "'"; if ($db->queryF($sql)) { redirectMsg('index.php', __('Theme changed successfully!', 'rmcommon'), 0); die; } else { redirectMsg('index.php', __('Theme could not be changed!', 'rmcommon') . '<br />' . $db->error(), 0); die; } } redirectMsg('index.php', __('Specified theme does not exist!', 'rmcommon'), 1); die; }
function mch_ranking_bkshow($options) { include_once XOOPS_ROOT_PATH . '/modules/match/class/mchfunctions.php'; RMTemplate::get()->add_xoops_style('blocks.css', 'match'); $ch = rmc_server_var($_GET, 'champ', $options[0]); $champ = $ch <= 0 ? MCHFunctions::current_championship() : new MCHChampionship($ch); if (!is_object($champ)) { $champ = MCHFunctions::last_championship(); } $ch = rmc_server_var($_GET, 'cat', $options[1]); $category = $ch <= 0 ? MCHFunctions::first_category() : new MCHCategory($ch); // Ranking $ranking = MCHFunctions::get_ranking($champ->id(), $category->id()); $block = array(); $block['ranking'] = $ranking; $block['limit'] = $options[2] <= 0 ? 6 : $options[2]; $block['lang_wons'] = __('Wons:', 'match'); return $block; }
/** * @des Visualiza todas las pantallas existentes **/ function showScreens() { global $xoopsModule, $xoopsSecurity, $tpl, $functions, $xoopsModule, $xoopsModuleConfig, $xoopsUser, $xoopsConfig; define('RMCSUBLOCATION', 'screenshots'); if ($xoopsConfig['closesite']) { showMessage(__('Screenshop uploader does not work when site is closed. Before to start uploding, please change this configuration.', 'rmcommon'), RMMSG_WARN); } $db = XoopsDatabaseFactory::getDatabaseConnection(); $tc = TextCleaner::getInstance(); $item = rmc_server_var($_REQUEST, 'item', 0); if ($item <= 0) { redirectMsg('items.php', __('Download item ID not provided!', 'dtransport'), RMMSG_WARN); } $sw = new DTSoftware($item); $sql = "SELECT * FROM " . $db->prefix('dtrans_screens') . " WHERE id_soft={$item}"; $result = $db->queryF($sql); while ($rows = $db->fetchArray($result)) { $sc = new DTScreenshot(); $sc->assignVars($rows); $screens[] = array('id' => $sc->id(), 'title' => $sc->title(), 'desc' => substr($tc->clean_disabled_tags($sc->desc()), 0, 80) . "...", 'image' => XOOPS_UPLOAD_URL . '/screenshots/' . date('Y', $sc->date()) . '/' . date('m', $sc->date()) . '/ths/' . $sc->image()); } // CSS Styles $tpl->add_style('admin.css', 'dtransport'); $tpl->add_style('screens.css', 'dtransport'); $tpl->add_style('uploadify.css', 'rmcommon'); // Javascripts $tpl->add_local_script('swfobject.js', 'rmcommon', 'include'); $tpl->add_local_script('jquery.uploadify.js', 'rmcommon', 'include'); $tpl->add_local_script('screens.js', 'dtransport'); $tc = TextCleaner::getInstance(); $rmf = RMFunctions::get(); ob_start(); include DT_PATH . '/js/screenshots.js'; $script = ob_get_clean(); $tpl->add_head_script($script); $functions->toolbar(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='items.php'>" . __('Downloads', 'dtransport') . "</a> » " . __('Screenshots Management', 'dtransport')); $tpl->assign('xoops_pagetitle', sprintf(__("%s Screenshots", 'dtransport'), $sw->getVar('name'))); include DT_PATH . '/include/js_strings.php'; xoops_cp_header(); include $tpl->get_template('admin/dtrans_screens.php', 'module', 'dtransport'); xoops_cp_footer(); }
public function eventRmcommonLoadRightWidgets($widgets) { global $xoopsModule; if (!isset($xoopsModule) || $xoopsModule->getVar('dirname') != 'system' && $xoopsModule->getVar('dirname') != 'dtransport') { return $widgets; } if (defined("RMCSUBLOCATION") && RMCSUBLOCATION == 'newitem') { include_once '../widgets/dt_items.php'; $action = rmc_server_var($_GET, 'action', ''); $edit = $action == 'edit' ? 1 : 0; $widgets[] = dt_widget_information($edit); $widgets[] = dt_widget_defimg($edit); $widgets[] = dt_widget_options($edit); //$widgets[] = dt_widget_alert($edit); //$widgets[] = dt_widget_credits($edit); // Other widgets $widgets = RMEvents::get()->run_event('dtransport.load.items.widgets', $widgets, $action, $edit); } return $widgets; }
/** * @desc Visualiza todos los usuarios existentes **/ function showUsers() { global $xoopsModule, $db, $tpl, $xoopsSecurity; $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1; $limit = 15; $search = rmc_server_var($_REQUEST, 'search', ''); $db = XoopsDatabaseFactory::getDatabaseConnection(); //Barra de Navegación $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_users'); $sql1 = ''; $search = trim($search); if ($search && strlen($search) > 2) { $sql1 .= $sql1 == '' ? " WHERE (uname LIKE '%{$search}%')" : " OR (uname LIKE '%{$search}%')"; } list($num) = $db->fetchRow($db->query($sql . $sql1)); $start = $num <= 0 ? 0 : ($page - 1) * $limit; $tpages = ceil($num / $limit); $nav = new RMPageNav($num, $limit, $page, 5); $nav->target_url("users.php?page={PAGE_NUM}&search={$search}"); $showmax = $start + $limit; $showmax = $showmax > $num ? $num : $showmax; //Fin de barra de navegación $sql = "SELECT * FROM " . $db->prefix('gs_users'); $sql2 = " LIMIT {$start},{$limit}"; $result = $db->query($sql . $sql1 . $sql2); while ($rows = $db->fetchArray($result)) { $uname = eregi_replace("({$search})", "<span class='searchResalte'>\\1</span>", $rows['uname']); $user = new GSUser(); $user->assignVars($rows); $users[] = array('id' => $user->id(), 'uid' => $user->uid(), 'uname' => $uname, 'quota' => RMUtilities::formatBytesSize($user->quota()), 'blocked' => $user->blocked(), 'used' => GSFunctions::makeQuota($user), 'pics' => $user->pics(), 'sets' => $user->sets(), 'date' => formatTimeStamp($user->date(), 'custom'), 'url' => $user->userUrl()); } GSFunctions::toolbar(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . __('Users management', 'galleries')); RMTemplate::get()->assign('xoops_pagetitle', __('Users management', 'galleries')); RMTemplate::get()->add_script('../include/js/gsscripts.php?file=sets&form=frm-users'); RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js'); RMTemplate::get()->add_head("<script type='text/javascript'>\nvar delete_warning='" . __('Do you really wish to delete selected users?', 'galleries') . "';\n</script>"); xoops_cp_header(); include RMTemplate::get()->get_template("admin/gs_users.php", 'module', 'galleries'); xoops_cp_footer(); }
function cache_delete_file() { global $xoopsSecurity; if (!$xoopsSecurity->check()) { redirectMsg('plugins.php?p=booster&action=view', __('Session token expired!', 'booster'), 1); die; } $file = rmc_server_var($_POST, 'file', ''); if ($file == '') { redirectMsg('plugins.php?p=booster&action=view', __('You must specify a file to delete!', 'booster'), 1); die; } $path = XOOPS_CACHE_PATH . '/booster/files/'; if (!file_exists($path . $file . '.html')) { redirectMsg('plugins.php?p=booster&action=view', __('Selected file does not exists!', 'booster'), 1); die; } @unlink($path . $file . '.html'); @unlink($path . $file . '.meta'); redirectMsg('plugins.php?p=booster&action=view', __('File deleted successfully!', 'booster'), 0); }
function mch_role_bkshow($options) { include_once XOOPS_ROOT_PATH . '/modules/match/class/mchfunctions.php'; RMTemplate::get()->add_xoops_style('blocks.css', 'match'); $ch = rmc_server_var($_GET, 'champ', $options[0]); $champ = $ch <= 0 ? MCHFunctions::current_championship() : new MCHChampionship($ch); if (!is_object($champ)) { $champ = MCHFunctions::last_championship(); } $ch = rmc_server_var($_GET, 'cat', $options[1]); $category = $ch <= 0 ? MCHFunctions::first_category() : new MCHCategory($ch); // Role $data = MCHFunctions::next_matches($category->id(), $champ->id(), $options[2]); $block = array(); $block['role'] = $data; $mc = RMUtilities::module_config('match'); $block['link'] = $mc['urlmode'] ? XOOPS_URL . '/' . $mc['htbase'] : XOOPS_URL . '/modules/match'; $block['lang_viewrol'] = __('View full roleplay »'); $block['category'] = $category->id(); return $block; }
function m_set_score() { global $xoopsSecurity; $id = rmc_server_var($_POST, 'id', 0); $token = rmc_server_var($_POST, 'token', 0); $local = rmc_server_var($_POST, 'local', 0); $visitor = rmc_server_var($_POST, 'visitor', 0); $other = rmc_server_var($_POST, 'other', 0); $comments = rmc_server_var($_POST, 'comments', 0); $win = rmc_server_var($_POST, 'win', 0); $champ = rmc_server_var($_POST, 'win', 0); if ($id <= 0) { response_error(__('No role item has been specified!', 'match')); } if (!$xoopsSecurity->check(true, $token)) { response_error(__('Session token expired!', 'match')); } $item = new MCHRoleItem($id); if ($item->isNew()) { response_error(__('Specified role item does not exists', 'match')); } $score = new MCHScoreItem(); $score->byRole($item->id()); $score->setVar('item', $id); $score->setVar('local', $local); $score->setVar('visitor', $visitor); $score->setVar('other', $other); $score->setVar('comments', $comments); $score->setVar('win', $local > $visitor ? $item->getVar('local') : ($visitor > $local ? $item->getVar('visitor') : $win)); $score->setVAr('champ', $item->getVar('champ')); if ($score->save()) { $ret = array('done' => 1); echo json_encode($ret); die; } else { response_error($score->errors()); } }
function m_show_ranking() { global $xoopsModule; $champ = rmc_server_var($_REQUEST, 'champ', 0); $category = rmc_server_var($_REQUEST, 'category', 0); $champs = MCHFunctions::all_championships(); $categories = array(); MCHFunctions::categories_tree($categories); if ($champ > 0 && $category > 0) { $ranking = MCHFunctions::get_ranking($champ, $category); } MCHFunctions::toolbar(); xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> » " . __('Coaches', 'match')); RMTemplate::get()->assign('xoops_pagetitle', __('Coaches', 'match')); RMTemplate::get()->add_style('admin.css', 'match'); RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js'); RMTemplate::get()->add_local_script('admin_match.js', 'match'); RMTemplate::get()->add_head("<script type='text/javascript'>\nvar mch_message='" . __('Do you really want to delete selected coaches?', 'match') . "';\n\n var mch_select_message = '" . __('You must select some coach before to execute this action!', 'match') . "';</script>"); xoops_cp_header(); $match_extra_options = RMEvents::get()->run_event('match.more.options'); include RMTemplate::get()->get_template("admin/mch_ranking.php", 'module', 'match'); xoops_cp_footer(); }
function delete_mw_trackbacks() { global $xoopsSecurity; $tbs = rmc_server_var($_POST, 'tbs', array()); if (empty($tbs) || !is_array($tbs)) { redirectMsg('trackbacks.php', __('Select one trackback at least!', 'mw_categories'), 1); die; } if (!$xoopsSecurity->check()) { redirectMsg('trackbacks.php', __('Session token expired!', 'mywords'), 1); die; } // Event RMEvents::get()->run_event('mywords.before.delete.trackback', $tbs); foreach ($tbs as $id) { $trac = new MWTrackbackObject($id); if ($trac->isNew()) { continue; } $trac->delete(); } redirectMsg('trackbacks.php', __('Trackbacks deleted successfully', 'mywords'), 0); }
/** * @desc Elimina Reportes **/ function deleteReports() { global $xoopsModule, $xoopsUser, $xoopsSecurity; $ids = rmc_server_var($_POST, 'ids', array()); $show = rmc_server_var($_POST, 'show', array()); //Verificamos si los reportes son válidos if (empty($ids)) { redirectMsg('reports.php?show=' . $show, __('Select at least one report!', 'bxpress'), 1); die; } if (!$xoopsSecurity->check()) { redirectMsg('reports.php?show=' . $show, __('Session token expired!', 'bxpress'), 1); die; } $errors = ''; foreach ($ids as $id) { //Verificamos si el reporte es válido if ($id <= 0) { $errors .= sprintf(__('ID %s is not valid!', 'bxpress'), $id); continue; } $report = new bXReport($id); //Comprobamos si el reporte existe if ($report->isNew()) { $errors .= sprintf(__('Report with ID %s does not exists!', 'bxpress'), $id); continue; } if (!$report->delete()) { $errors .= sprintf(__('Report %s could dot be deleted!', 'bxpress'), $id); } } if ($errors != '') { redirectMsg('reports.php?show=' . $show, __('Errors ocurred while trying to delete selected reports.', 'bxpress') . "<br />" . $errors, 1); } else { redirectMsg('./reports.php?show=' . $show, __('Reports deleted successfully!', 'bxpress'), 0); } }
/** * Create the module toolbar. This function must be called only from rmcommon module administration */ public function create_toolbar() { if (RMCLOCATION == 'users') { RMTemplate::get()->add_tool(__('Users List', 'rmcommon'), 'users.php', 'images/users.png', 'allusers'); RMTemplate::get()->add_tool(__('Add User', 'rmcommon'), 'users.php?action=new', 'images/user_add.png', 'newuser'); } elseif (RMCLOCATION == 'imgmanager') { RMTemplate::get()->add_tool(__('Categories List', 'rmcommon'), 'images.php?action=showcats', 'images/category.png', 'showcategories'); RMTemplate::get()->add_tool(__('Add Category', 'rmcommon'), 'images.php?action=newcat', 'images/category_add.png', 'newcategory'); $cat = rmc_server_var($_REQUEST, 'category', 0); if ($cat > 0) { RMTemplate::get()->add_tool(__('Images', 'rmcommon'), 'images.php?category=' . $cat, 'images/image.png', 'showimages'); } RMTemplate::get()->add_tool(__('Add Images', 'rmcommon'), 'images.php?action=new' . ($cat > 0 ? "&category={$cat}" : ''), 'images/image_add.png', 'addimages'); } else { RMTemplate::get()->add_tool(__('Dashboard', 'rmcommon'), 'index.php', 'images/dashboard.png', 'dashboard'); RMTemplate::get()->add_tool(__('Modules', 'rmcommon'), 'modules.php', 'images/modules.png', 'modules'); RMTemplate::get()->add_tool(__('Blocks', 'rmcommon'), 'blocks.php', 'images/blocks.png', 'blocks'); RMTemplate::get()->add_tool(__('Users', 'rmcommon'), 'users.php', 'images/users.png', 'users'); RMTemplate::get()->add_tool(__('Images', 'rmcommon'), 'images.php', 'images/images.png', 'imgmanager'); RMTemplate::get()->add_tool(__('Comments', 'rmcommon'), 'comments.php', 'images/comments.png', 'comments'); RMTemplate::get()->add_tool(__('Plugins', 'rmcommon'), 'plugins.php', 'images/plugin.png', 'plugins'); } RMEvents::get()->run_event('rmcommon.create.toolbar'); }
/** * Insert extra headers in theme */ public function extra_headers() { global $xoopsModule; if ($xoopsModule->dirname() == 'rmcommon' && RMCLOCATION == 'modules' && rmc_server_var($_REQUEST, 'action', '') == '') { include DESIGNIA_PATH . '/include/sorter.inc'; } }