public function eventRmcommonXoopsCommonEnd() { global $xoopsConfig; // Get preloaders from current theme RMEvents::get()->load_extra_preloads(XOOPS_THEME_PATH . '/' . $xoopsConfig['theme_set'], ucfirst($xoopsConfig['theme_set'] . 'Theme')); $url = RMFunctions::current_url(); $p = parse_url($url); if (substr($p['path'], -11) == 'backend.php') { include_once RMCPATH . '/rss.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; } } }
/** * @desc Formulario para la creación de una nueva publicación **/ function formPublish() { global $xoopsModuleConfig, $xoopsUser, $xoopsTpl, $xoopsConfig; include 'header.php'; //Verificamos si existen permisos para crear un nuevo recurso if (!$xoopsModuleConfig['createres']) { redirect_header(RDFunctions::url(), 1, __('The creation of new Documents has been disabled by administrator.', 'docs')); die; } //Verificamos si usuario tiene permisos de crear nuevo recurso $res = new RDResource(); if (!RDFunctions::new_resource_allowed($xoopsUser ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS))) { redirect_header(RDFunctions::url(), 1, __('You can not create Documents.', 'docs')); die; } $xoopsTpl->assign('xoops_pagetitle', __('Create Document', 'docs')); $form = new RMForm(__('Create Document', 'docs'), 'frmres', RMFunctions::current_url()); $form->setExtra("enctype='multipart/form-data'"); $form->addElement(new RMFormText(__('Document title', 'docs'), 'title', 50, 150), true); $form->addElement(new RMFormTextArea(__('Description', 'docs'), 'desc', 5, 50), true); //editores de la publicación $form->addElement(new RMFormUser(__('Editors', 'docs'), 'editors', 1, $xoopsUser ? array($xoopsUser->uid()) : array(), 30)); //Grupos con permiso de acceso $form->addElement(new RMFormGroups(__('Groups that can read Document', 'docs'), 'groups', 1, 1, 1, array(1, 2)), true); $form->addElement(new RMFormYesno(__('Quick index', 'docs'), 'quick')); $form->addElement(new RMFormYesno(__('Show index to restricted users', 'docs'), 'showindex')); $form->addElement(new RMFormYesno(__('Show content in a single page', 'docs'), 'single')); $form->addElement(new RMFormLabel(__('Approved', 'docs'), $xoopsModuleConfig['approved'] ? __('Inmediatly', 'docs') : __('Wait for approval', 'docs'))); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', __('Publish Document'), 'submit'); $buttons->addButton('cancel', _CANCEL, 'button', 'onclick="history.go(-1);"'); $form->addElement($buttons); $form->addElement(new RMFormHidden('action', 'save')); $form->display(); RMTemplate::get()->add_style('forms.css', 'docs'); include 'footer.php'; }
/** * Create the comments form * You need to include the template 'rmc_comments_form.html' where * you wish to show this form * @param string Object name (eg. mywords, qpages, etc.) * @param string Params to be included in form * @param string Object type (eg. module, plugin, etc.) * @param string File path to get the methods to update comments */ public function comments_form($obj, $params, $type = 'module', $file = array()) { global $xoopsTpl, $xoopsRequestUri, $xoopsUser; $config = self::configs(); if (!$config['enable_comments']) { return; } if (!$xoopsUser && !$config['anonymous_comments']) { return; } if (!defined('COMMENTS_INCLUDED')) { define('COMMENTS_INCLUDED', 1); } $xoopsTpl->assign('enable_comments_form', 1); $form = array('show_name' => !$xoopsUser, 'lang_name' => __('Name', 'rmcommon'), 'show_email' => !$xoopsUser, 'lang_email' => __('Email address', 'rmcommon'), 'show_url' => !$xoopsUser, 'lang_url' => __('Web site', 'rmcommon'), 'lang_text' => __('Your comment', 'rmcommon'), 'lang_submit' => __('Submit Comment', 'rmcommon'), 'lang_title' => __('Submit a comment', 'rmcommon'), 'uri' => urlencode(RMFunctions::current_url()), 'actionurl' => RMCURL . '/post_comment.php', 'params' => urlencode($params), 'update' => urlencode(str_replace(XOOPS_ROOT_PATH, '', $file)), 'type' => $type, 'object' => $obj, 'action' => 'save'); // You can include new content into Comments form // eg. Captcha checker, etc $form = RMEvents::get()->run_event('rmcommon.comments.form', $form, $obj, $params, $type); RMTemplate::get()->add_jquery(); RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.validate.min.js'); RMTemplate::get()->add_head('<script type="text/javascript"> $(document).ready(function(){ $("#rmc-comment-form").validate({ messages: { comment_name: "' . __('Please specify your name', 'rmcommon') . '", comment_email: "' . __('Please specify a valid email', 'rmcommon') . '", comment_text: "' . __('Please write a message', 'rmcommon') . '", comment_url: "' . __('Please enter a valid URL', 'rmcommon') . '" } }); });</script>'); $xoopsTpl->assign('cf', $form); }
if (FALSE !== strpos($url, XOOPS_URL . '/modules/docs')) { header('location: ' . RDFunctions::url()); die; } // If friendly urls are activated $path = str_replace(XOOPS_URL, '', RMFunctions::current_url()); $path = str_replace($xoopsModuleConfig['htpath'], '', $path); $path = trim($path, '/'); if ($xoopsModuleConfig['subdomain'] != '') { $path = str_replace(rtrim($xoopsModuleConfig['subdomain'], '/'), '', $path); $path = trim($path, '/'); } $params = explode("/", $path); } else { // If friendly urls are disabled $path = parse_url(RMFunctions::current_url()); if (isset($path['query'])) { parse_str($path['query']); } if (!isset($page) || $page == '') { require 'mainpage.php'; die; } $file = $page . '.php'; if (!file_exists(XOOPS_ROOT_PATH . '/modules/docs/' . $file)) { RDfunctions::error_404(); } if (!$xoopsModuleConfig['standalone'] && isset($standalone)) { unset($standalone); } include $file;
/** * @desc Mostramos los detalles de una imágen */ function showImageDetails() { global $usr, $set, $img, $db, $xoopsModule, $mc, $xoopsModuleConfig, $xoopsConfig, $xoopsUser, $xoopsOption, $tpl; $user = new GSUser($usr); if ($user->isNew()) { redirect_header(GSFunctions::get_url(), 0, __('Specified user does not exists!', 'galleries')); die; } $image = new GSImage($img); if ($image->isNew()) { redirect_header(GSFunctions::get_url(), 0, __('Specified image does not exists!', 'galleries')); die; } $user = new GSUser($image->owner(), 1); //Verificamos la privacidad de la imagen if (!$image->isPublic()) { //Privada, Verificamos si el usuario es el dueño de la imagen if (!$xoopsUser || $xoopsUser->uid() != $image->owner()) { redirect_header(GSFunctions::get_url(), 1, __('You can not view this image!', 'galleries')); die; } } else { if ($image->isPublic() == 1) { //Privada y amigos if (!$xoopsUser || $xoopsUser->uid() != $image->owner()) { //Verificamos si es un amigo if (!$xoopsUser || !$user->isFriend($xoopsUser->uid())) { redirect_header(GSFunctions::get_url(), 1, __('You are not authorized to view this image!', 'galleries')); die; } } } } //Incrementamos las vistas de la imagen $image->addViews(); if (isset($set)) { $set = new GSSet($set); if ($set->isNew()) { redirect_header(GSFunctions::get_url(), 0, __('Specified album does not exists!', 'galleries')); die; } } if ($image->desc() != '') { global $xoTheme; $xoTheme->addMeta('meta', 'description', $image->desc()); } $xoopsOption['template_main'] = 'gs_imgdetails.html'; $xoopsOption['module_subpage'] = 'picsdetails'; include 'header.php'; GSFunctions::makeHeader(); $tpl->assign('user', array('id' => $user->id(), 'uname' => $user->uname(), 'link' => $user->userURL(), 'avatar' => $user->userVar('user_avatar') != '' ? XOOPS_URL . '/uploads/avatars/' . $user->userVar('user_avatar') : GS_URL . '/images/avatar.png')); $tpl->assign('user_link', $user->userURL()); $tpl->assign('lang_alsobelong', __('Also belongs to:', 'galleries')); $tpl->assign('lang_postcards', __('Send postcard', 'galleries')); $tpl->assign('lang_bookmark', __('+ Bookmark', 'galleries')); $tpl->assign('lang_photos', __('Pictures', 'galleries')); $tpl->assign('lang_toset', __('+ to Album', 'galleries')); $tpl->assign('lang_lastpic', __('This is the last picture', 'galleries')); $tpl->assign('lang_firstpic', __('This is the first picture', 'galleries')); $tpl->assign('toset_link', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/toset/ids/' . $image->id() . '/referer/' . base64_encode(RMFunctions::current_url()) . '/' : '?cp=toset&ids=' . $image->id() . '&referer=' . base64_encode(RMFunctions::current_url()))); $tpl->assign('edit_link', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/edit/id/' . $image->id() . '/referer/' . base64_encode(RMFunctions::current_url()) . '/' : '?cp=edit&id=' . $image->id() . '&referer=' . base64_encode(RMFunctions::current_url()))); $tpl->assign('bookmark_link', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/bookmarks/add/' . $image->id() . '/referer/' . base64_encode($_SERVER['REQUEST_URI']) : '?cpanel=bookmarks&add=' . $image->id() . '&referer=' . base64_encode($_SERVER['REQUEST_URI']))); $tpl->assign('postcard_link', GSFunctions::get_url() . ($mc['urlmode'] ? 'postcard/new/img/' . $image->id() . '/' : '?postcard=new&img=' . $image->id())); $tpl->assign('delete_link', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/delete/referer/' . base64_encode(RMFunctions::current_url()) . '/ids/' : '?cpanel=delete&referer=' . base64_encode(RMFunctions::current_url()) . '&ids=')); $tpl->assign('lang_confirmdel', sprintf(__('Dow you really want to delete this picture?\\n(%s)', 'galleries'), $image->title())); if ($xoopsUser && $xoopsUser->uid() == $image->owner()) { $tpl->assign('lang_edit', __('Edit', 'galleries')); $tpl->assign('lang_delete', __('Delete', 'galleries')); $tpl->assign('isowner', 1); } $tpl->assign('postcards', $mc['postcards']); $data = getimagesize($user->filesURL() . '/' . $image->image()); $tpl->assign('image', array('title' => $image->title(), 'id' => $image->id(), 'file' => $user->filesURL() . '/' . $image->image(), 'desc' => $image->desc(), 'width' => $data[0] + 2, 'height' => $data[1] + 2)); unset($data); //Verificamos si el usuario es dueño o amigo if ($xoopsUser && $xoopsUser->uid() == $user->uid()) { $public = ''; } else { if ($xoopsUser && $user->isFriend($xoopsUser->uid())) { $public = " AND public<>'0'"; } else { $public = " AND public='2'"; } } // Imágenes anterior y siguiente if (!isset($set)) { // Navigation as images if ($xoopsModuleConfig['navimages']) { $limit_n = $xoopsModuleConfig['navimages_num']; $limit_p = $xoopsModuleConfig['navimages_num']; // Count images $sql = "SELECT * FROM " . $db->prefix("gs_images") . " WHERE id_image>'" . $image->id() . "' AND owner='" . $user->uid() . "' {$public} ORDER BY id_image ASC LIMIT 0," . $xoopsModuleConfig['navimages_num']; $resultn = $db->query($sql); if ($db->getRowsNum($resultn) < $xoopsModuleConfig['navimages_num']) { $limit_p = $limit_p + ($xoopsModuleConfig['navimages_num'] - $db->getRowsNum($resultn)); } $sql = "SELECT * FROM " . $db->prefix("gs_images") . " WHERE id_image<'" . $image->id() . "' AND owner='" . $user->uid() . "' {$public} ORDER BY id_image DESC, created DESC LIMIT 0," . $limit_p; $resultp = $db->query($sql); if ($db->getRowsNum($resultp) < $xoopsModuleConfig['navimages_num']) { $limit_n = $limit_n + ($xoopsModuleConfig['navimages_num'] - $db->getRowsNum($resultp)); } if ($limit_n > $db->getRowsNum($resultn) && $limit_p == $xoopsModuleConfig['navimages_num']) { $sql = "SELECT * FROM " . $db->prefix("gs_images") . " WHERE id_image>'" . $image->id() . "' AND owner='" . $user->uid() . "' {$public} ORDER BY id_image ASC LIMIT 0," . $limit_n; $resultn = $db->query($sql); } // Previous Images while ($row = $db->fetchArray($resultp)) { $pn = new GSImage(); $pn->assignVars($row); $previous_images[] = array('link' => $user->userURL() . ($xoopsModuleConfig['urlmode'] ? 'img/' . $pn->id() . '/' : '&img=' . $pn->id()), 'id' => $pn->id(), 'title' => $pn->title(), 'file' => $user->filesURL() . '/ths/' . $pn->image()); } // Next Images while ($row = $db->fetchArray($resultn)) { $pn = new GSImage(); $pn->assignVars($row); $next_images[] = array('link' => $user->userURL() . ($xoopsModuleConfig['urlmode'] ? 'img/' . $pn->id() . '/' : '&img=' . $pn->id()), 'id' => $pn->id(), 'title' => $pn->title(), 'file' => $user->filesURL() . '/ths/' . $pn->image()); } } $tpl->assign('prevnext_title', sprintf(__('Pictures of %s'), $user->uname())); $tpl->assign('xoops_pagetitle', $image->title() . ' » ' . sprintf(__('Pictures of %s'), $user->uname()) . ' » ' . $xoopsModuleConfig['section_title']); $tpl->assign('title_link', $user->userURL()); $result = $db->query("SELECT COUNT(*) FROM " . $db->prefix("gs_images") . " WHERE owner='" . $user->uid() . "' {$public}"); list($num) = $db->fetchRow($result); $tpl->assign('pics_count', $num); // Tambien pertenece $tbl1 = $db->prefix("gs_sets"); $tbl2 = $db->prefix("gs_setsimages"); $sql = "SELECT a.* FROM {$tbl1} a, {$tbl2} b WHERE b.id_image='" . $image->id() . "' AND a.id_set=b.id_set"; $result = $db->query($sql); while ($row = $db->fetchArray($result)) { $oset = new GSSet(); $oset->assignVars($row); //Verificamos la privacidad del album if (!$oset->ispublic()) { if (!$xoopsUser) { continue; } if ($xoopsUser->uid() != $oset->owner()) { continue; } } else { if (!$xoopsUser && $oset->isPublic() == 1 && !$user->isFriend($xoopsUser->uid())) { continue; } } $tpl->append('sets', array('id' => $oset->id(), 'title' => $oset->title(), 'link' => $user->userURL() . ($xoopsModuleConfig['urlmode'] ? 'set/' . $oset->id() . '/' : '&set=' . $oset->id()))); } } else { // Imágen Siguiente $tbl1 = $db->prefix("gs_images"); $tbl2 = $db->prefix("gs_setsimages"); // Navigation as images if ($xoopsModuleConfig['navimages']) { $limit_n = $xoopsModuleConfig['navimages_num']; $limit_p = $xoopsModuleConfig['navimages_num']; // Count images $sql = "SELECT a.* FROM {$tbl1} a, {$tbl2} b WHERE b.id_set='" . $set->id() . "' AND a.id_image=b.id_image AND a.id_image>'" . $image->id() . "' AND a.owner='" . $user->uid() . "' {$public} ORDER BY a.id_image ASC LIMIT 0," . $xoopsModuleConfig['navimages_num']; $resultn = $db->query($sql); if ($db->getRowsNum($resultn) < $xoopsModuleConfig['navimages_num']) { $limit_p = $limit_p + ($xoopsModuleConfig['navimages_num'] - $db->getRowsNum($resultn)); } $sql = "SELECT a.* FROM {$tbl1} a, {$tbl2} b WHERE b.id_set='" . $set->id() . "' AND a.id_image=b.id_image AND a.id_image<'" . $image->id() . "' AND a.owner='" . $user->uid() . "' {$public} ORDER BY a.id_image DESC LIMIT 0,{$limit_p}"; $resultp = $db->query($sql); if ($db->getRowsNum($resultp) < $xoopsModuleConfig['navimages_num']) { $limit_n = $limit_n + ($xoopsModuleConfig['navimages_num'] - $db->getRowsNum($resultp)); } if ($limit_n > $db->getRowsNum($resultn) && $limit_p == $xoopsModuleConfig['navimages_num']) { $sql = "SELECT a.* FROM {$tbl1} a, {$tbl2} b WHERE b.id_set='" . $set->id() . "' AND a.id_image=b.id_image AND a.id_image>'" . $image->id() . "' AND a.owner='" . $user->uid() . "' {$public} ORDER BY a.id_image ASC LIMIT 0," . $limit_n; $resultn = $db->query($sql); } // Previous Images while ($row = $db->fetchArray($resultp)) { $pn = new GSImage(); $pn->assignVars($row); $previous_images[] = array('link' => $user->userURL() . ($xoopsModuleConfig['urlmode'] ? 'img/' . $pn->id() . '/set/' . $set->id() . '/' : '&img=' . $pn->id() . '&set=' . $set->id()), 'id' => $pn->id(), 'title' => $pn->title(), 'file' => $user->filesURL() . '/ths/' . $pn->image()); } // Next Images while ($row = $db->fetchArray($resultn)) { $pn = new GSImage(); $pn->assignVars($row); $next_images[] = array('link' => $user->userURL() . ($xoopsModuleConfig['urlmode'] ? 'img/' . $pn->id() . '/set/' . $set->id() . '/' : '&img=' . $pn->id() . '&set=' . $set->id()), 'id' => $pn->id(), 'title' => $pn->title(), 'file' => $user->filesURL() . '/ths/' . $pn->image()); } } $tpl->assign('prevnext_title', sprintf(__('Pictures in %s', 'galleries'), $set->title())); $tpl->assign('xoops_pagetitle', $image->title() . ' » ' . sprintf(__('Pictures in %s'), $set->title()) . ' » ' . $xoopsModuleConfig['section_title']); $tpl->assign('title_link', $user->userURL() . ($xoopsModuleConfig['urlmode'] ? 'set/' . $set->id() . '/' : '&set=' . $set->id())); $result = $db->query("SELECT COUNT(*) FROM {$tbl1} a, {$tbl2} b WHERE b.id_set='" . $set->id() . "' AND a.id_image=b.id_image AND a.owner='" . $user->uid() . "' {$public}"); list($num) = $db->fetchRow($result); $tpl->assign('pics_count', $num); // Tambien pertenece $tbl1 = $db->prefix("gs_sets"); $sql = "SELECT a.* FROM {$tbl1} a, {$tbl2} b WHERE b.id_set<>'" . $set->id() . "' AND b.id_image='" . $image->id() . "' AND a.id_set=b.id_set"; $result = $db->query($sql); $tpl->append('sets', array('id' => 0, 'title' => sprintf(__('Galleries of %s', 'galleries'), $user->uname()), 'link' => $user->userURL())); while ($row = $db->fetchArray($result)) { $oset = new GSSet(); $oset->assignVars($row); //Verificamos la privacidad del album if (!$oset->ispublic()) { if (!$xoopsUser) { continue; } if ($xoopsUser->uid() != $oset->owner()) { continue; } } else { if (!$xoopsUser && $oset->isPublic() == 1 && !$user->isFriend($xoopsUser->uid())) { continue; } } $tpl->append('sets', array('id' => $oset->id(), 'title' => $oset->title(), 'link' => $user->userURL() . 'set/' . $oset->id(), '/')); } } if (!empty($previous_images)) { $tpl->assign('prev', $previous_images[0]); $tpl->assign('previous_images', array_reverse($previous_images)); } else { $tpl->assign('is_first', 1); } if (!empty($next_images)) { $tpl->assign('next', $next_images[0]); $tpl->assign('next_images', $next_images); } else { $tpl->assign('is_last', 1); } $tpl->assign('current_image', array('title' => $image->title(), 'file' => $user->filesURL() . '/ths/' . $image->image())); // Etiquetas $tags = $image->tags(true, '*'); $link = GSFunctions::get_url() . ($mc['urlmode'] ? 'explore/tags/tag/' : "?explore=tags&tag="); foreach ($tags as $tag) { $tpl->append('tags', array('id' => $tag->id(), 'tag' => $tag->tag(), 'link' => $link . $tag->getVar('nameid'))); } // Comentarios $tpl->assign('users_link', GSFunctions::get_url() . ($mc['urlmode'] ? 'usr/' : '?usr='******'galleries', 'image=' . $image->id()); // Comments form RMFunctions::comments_form('galleries', 'image=' . $image->id(), 'module', GS_PATH . '/class/galleriescontroller.php'); include 'footer.php'; }
<?php // $Id$ // -------------------------------------------------------------- // MyGalleries // Module for advanced image galleries management // Author: Eduardo Cortés <*****@*****.**> // Email: i.bitcero@gmail.com // License: GPL 2.0 // -------------------------------------------------------------- if ($xoopsModuleConfig['urlmode']) { // Get parameters directly from URL when mod_rewrite is enabled $params = str_replace(XOOPS_URL, '', RMFunctions::current_url()); $params = str_replace($xoopsModuleConfig['urlbase'], '', $params); $params = trim($params, '/'); $params = explode("/", $params); foreach ($params as $i => $p) { switch ($p) { case 'cp': // Control Panel $cp = isset($params[$i + 1]) ? $params[$i + 1] : 'images'; break; case 'pag': // Page number $page = $params[$i + 1]; break; case 'usr': // User $usr = $params[$i + 1]; break; case 'explore':
<?php include RMTemplate::get()->get_template('rd_header.php', 'module', 'docs'); ?> <h1><?php $edit ? _e('Edit Page', 'docs') : _e('New Page', 'docs'); ?> </h1> <div class="form_container"> <form name="frmPage" id="frm-page" method="post" action="<?php echo RMFunctions::current_url(); ?> "> <label><?php _e('Document', 'docs'); ?> </label> <span><?php echo $res->getVar('title'); ?> </span> <label for="sec-title"><?php _e('Title', 'docs'); ?> </label> <input type="text" name="title" id="sec-title" value="<?php echo $edit ? $section->getVar('title') : ''; ?> " />
/** * This event save the current page if is neccesary */ public function eventRmcommonEndFlush($output) { global $xoopsUser, $xoopsConfig; $plugin = RMFunctions::load_plugin('booster'); if (!$plugin->get_config('enabled')) { return $output; } if (defined('BOOSTER_NOTSAVE')) { return $output; } $url = RMFunctions::current_url(); $path = parse_url($url); if ($plugin->is_excluded($url)) { return $output; } if ($xoopsUser) { $file = XOOPS_CACHE_PATH . '/booster/files/' . md5($url . session_id() . '|' . $xoopsConfig['language']); setcookie('booster_session', session_id() . '|' . $xoopsConfig['language'], 0, '/'); } else { $file = XOOPS_CACHE_PATH . '/booster/files/' . md5($url . $xoopsConfig['language']); } $data = array('uri' => $url, 'created' => time(), 'language' => $xoopsConfig['language']); $pos = strpos($output, '<div id="xo-logger-output">'); if ($pos !== FALSE) { file_put_contents($file . '.html', substr($output, 0, $pos) . '<!-- Cached by Booster -->'); } else { file_put_contents($file . '.html', $output . '<!-- Cached by Booster -->'); } file_put_contents($file . '.meta', json_encode($data)); $plugin->delete_expired(); return $output; }
<?php // $Id$ // -------------------------------------------------------------- // MyWords // Complete Blogging System // Author: BitC3R0 <*****@*****.**> // Email: i.bitcero@gmail.com // License: GPL 2.0 // -------------------------------------------------------------- include "../../mainfile.php"; $request = str_replace(XOOPS_URL, '', RMFunctions::current_url()); $request = str_replace("/modules/mywords/", '', $request); if ($xoopsModuleConfig['permalinks'] > 1 && $xoopsModuleConfig['basepath'] != '/') { $request = str_replace(rtrim($xoopsModuleConfig['basepath'], '/') . '/', '', rtrim($request, '/') . '/'); } $yesquery = false; if (substr($request, 0, 1) == '?') { $request = substr($request, 1); $yesquery = true; } if ($request == '' || $request == 'index.php') { require 'home.php'; die; } $params = explode("/", $request); if ($params[0] == 'page') { require 'home.php'; die; } $vars = array();
die; } redirect_header(ShopFunctions::get_url(), 1, __('Your message has been sent successfully!', 'shop')); } else { $xoopsOption['template_main'] = 'shop_contact.html'; include 'header.php'; $tf = new RMTimeFormatter(0, '%d%/%M%/%Y%'); // Product data $xoopsTpl->assign('product', array('name' => $product->getVar('name'), 'description' => $product->getVar('description'), 'price' => sprintf(__('Price: <strong>%s</strong>', 'shop'), sprintf($xoopsModuleConfig['format'], number_format($product->getVar('price'), 2))), 'type' => $product->getVar('type'), 'stock' => $product->getVar('available'), 'image' => $product->getVar('image'), 'created' => sprintf(__('Since: <strong>%s</strong>', 'shop'), $tf->format($product->getVar('created'))), 'updated' => $product->getVar('modified') > 0 ? sprintf(__("Updated: <strong>%s</strong>", 'shop'), $tf->format($product->getVar('modified'))) : '', 'link' => $product->permalink(), 'metas' => $product->get_meta(), 'images' => $product->get_images())); $categories = array(); ShopFunctions::categos_list($categories); array_walk($categories, 'shop_dashed'); $xoopsTpl->assign('categories_list', $categories); $xoopsTpl->assign('lang_selcat', __('Select category...', 'shop')); $xoopsTpl->assign('xoops_pagetitle', sprintf(__('Requesting information about %s', 'shop'), $product->getVar('name')) . ' » ' . $xoopsModuleConfig['modtitle']); $xoopsTpl->assign('lang_requesting_info', sprintf(__('Request Information for %s', 'shop'), $product->getVar('name'))); $xoopsTpl->assign('lang_yname', __('Your Name:', 'shop')); $xoopsTpl->assign('lang_ymail', __('Your Email:', 'shop')); $xoopsTpl->assign('lang_prod', __('Product:', 'shop')); $xoopsTpl->assign('lang_message', __('Message:', 'shop')); $xoopsTpl->assign('lang_send', __('Send Message', 'shop')); $xoopsTpl->assign('form_action', RMFunctions::current_url()); if ($xoopsUser) { $xoopsTpl->assign('shop_name', $xoopsUser->name()); $xoopsTpl->assign('shop_email', $xoopsUser->email()); } $captcha = RMEvents::get()->run_event('rmcommon.recaptcha.field'); $xoopsTpl->assign('captcha', $captcha); RMTemplate::get()->add_style('main.css', 'shop'); include 'footer.php'; }
/** * Get parameters from url */ public function url_params() { $mc = RMUtilities::module_config('shop'); $category = ''; $page = 1; $id = ''; $contact = ''; if ($mc['urlmode']) { $params = str_replace(XOOPS_URL, '', RMFunctions::current_url()); $params = str_replace($mc['htbase'], '', $params); $params = trim($params, '/'); $params = explode("/", $params); $fc = false; // Switch to category path foreach ($params as $i => $k) { switch ($k) { case 'category': $category = $params[$i + 1]; $fc = true; break; case 'page': $page = $params[$i + 1]; $fc = false; break; case 'contact': $contact = $params[$i + 1]; $fc = false; break; default: if ($category != '' && $category != $k && $fc) { $category .= '/' . $k; } $id = $category == '' && $page <= 1 && $contact == '' ? $params[0] : ''; break; } } } else { $category = rmc_server_var($_GET, 'cat', 0); $id = rmc_server_var($_GET, 'id', 0); $page = rmc_server_var($_GET, 'page', 0); $contact = rmc_server_var($_GET, 'contact', 0); } $ret['category'] = $category; $ret['page'] = $page; $ret['id'] = $id; $ret['contact'] = $contact; return $ret; }