public function search($queries, $andor, $limit, $start, $userid) { $xoops = Xoops::getInstance(); $alumni = Alumni::getInstance(); $myts = MyTextSanitizer::getInstance(); $by_cat = Request::getInt('by_cat', ''); $andor = Request::getWord('andor', 'AND'); $queries = array(); $query = Request::getString('query', ''); $start = Request::getInt('start', '0'); $helper = $xoops->getModuleHelper('alumni'); $module_id = $helper->getModule()->getVar('mid'); $listingHandler = $helper->getHandler('listing'); $groups = $xoops->getUserGroups(); $alumni_ids = $xoops->getHandlerGroupperm()->getItemIds('alumni_view', $groups, $module_id); $all_ids = implode(', ', $alumni_ids); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('valid', 1, '=')); // $criteria->add(new Criteria('date', time(), '<=')); $criteria->add(new Criteria('cid', '(' . $all_ids . ')', 'IN')); if ($userid != 0) { $criteria->add(new Criteria('usid', $userid, '=')); } if ($by_cat) { $criteria->add(new Criteria('cid', $by_cat, '=')); } $queries = array($query); $queries = implode('+', $queries); $count = 0; $i = 0; $criteria->add(new Criteria('name', '%' . $queries . '%', 'LIKE'), 'AND'); $criteria->add(new Criteria('mname', '%' . $queries . '%', 'LIKE'), 'OR'); $criteria->add(new Criteria('lname', '%' . $queries . '%', 'LIKE'), 'OR'); $criteria->add(new Criteria('school', '%' . $queries . '%', 'LIKE'), 'OR'); $criteria->add(new Criteria('year', '%' . $queries . '%', 'LIKE'), 'OR'); $criteria->setLimit($limit); $criteria->setSort('date'); $criteria->setOrder('DESC'); $criteria->setStart($start); $numrows = $listingHandler->getCount(); $this_search = $listingHandler->getall($criteria); $ret = array(); $k = 0; foreach ($this_search as $obj) { $ret[$k]['image'] = 'images/cat/default.gif'; $ret[$k]['link'] = 'listing.php?lid=' . $obj->getVar('lid') . ''; $ret[$k]['title'] = $obj->getVar('name') . ' ' . $obj->getVar('mname') . ' ' . $obj->getVar('lname') . ' --- ' . $obj->getVar('school') . ' --- ' . $obj->getVar('year'); $ret[$k]['time'] = $obj->getVar('date'); $ret[$k]['uid'] = $obj->getVar('usid'); $k++; } return $ret; }
if (in_array($extension_verif, $extensions)) { echo "<li class=\"file ext_{$ext}\"><a href=\"#\" onclick=\"tpls_edit_file('" . htmlentities($_REQUEST['dir'] . $file) . "', '" . htmlentities($_REQUEST['dir']) . "', '" . htmlentities($file) . "', '" . $ext . "');\" rel=\"tpls_edit_file('" . htmlentities($_REQUEST['dir'] . $file) . "', '" . htmlentities($_REQUEST['dir']) . "', '" . htmlentities($file) . "', '" . $ext . "');\">" . htmlentities($file) . "</a></li>"; } else { //echo "<li class=\"file ext_$ext\">" . htmlentities($file) . "</li>"; } } } echo "</ul>"; } } break; // Edit File // Edit File case 'tpls_edit_file': $clean_file = Request::getString('file', ''); $clean_path_file = Request::getString('path_file', ''); $path_file = realpath(XOOPS_ROOT_PATH . '/themes' . trim($clean_path_file)); $path_file = str_replace('\\', '/', $path_file); //Button restore if (XoopsLoad::fileExists($path_file . '.back')) { $restore = '<button class="ui-corner-all tooltip" type="button" onclick="tpls_restore(\'' . $path_file . '\')" value="' . XoopsLocale::A_RESTORE . '" title="' . XoopsLocale::A_RESTORE . '"> <img src="' . system_AdminIcons('revert.png') . '" alt="' . XoopsLocale::A_RESTORE . '" /> </button>'; } else { $restore = ''; } $file = XoopsFile::getHandler('file', $path_file); $content = $file->read(); if (empty($content)) { echo SystemLocale::EMPTY_FILE; }
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @package core * @since 2.0.0 * @author Kazumi Ono (AKA onokazu) * @author Taiwen Jiang <*****@*****.**> * @version $Id$ */ include dirname(dirname(__DIR__)) . '/mainfile.php'; $search = Search::getInstance(); if (!$search->getConfig('enable_search')) { header('Location: ' . XOOPS_URL . '/index.php'); exit; } $xoops = Xoops::getInstance(); $action = Request::getCmd('action', 'search'); $query = Request::getString('query', ''); $andor = Request::getWord('andor', 'AND'); $mid = Request::getInt('mid', 0); $uid = Request::getInt('uid', 0); $start = Request::getInt('start', 0); $mids = Request::getArray('mids', array()); $queries = array(); if ($action === "results") { if ($query == "") { $xoops->redirect("index.php", 1, _MD_SEARCH_PLZENTER); } } else { if ($action === "showall") { if ($query == "" || empty($mid)) { $xoops->redirect("index.php", 1, _MD_SEARCH_PLZENTER); }
if (!is_writable($compile_path)) { $error_msg[] = sprintf(XoopsLocale::EF_FOLDER_NOT_WRITABLE, $compile_path); } //www fits inside www_private, lets add a trailing slash to make sure it doesn't $xoops_path = $xbc->get('lib-path'); $xoops_root_path = $xbc->get('root-path'); if (strpos($xoops_path, $xoops_root_path) !== false || strpos($xoops_path, $_SERVER['DOCUMENT_ROOT']) !== false) { $error_msg[] = sprintf(XoopsLocale::EF_FOLDER_IS_INSIDE_DOCUMENT_ROOT, $xoops_path); } $var_path = $xoops->path('var'); if (strpos($var_path, $xoops_root_path) !== false || strpos($var_path, $_SERVER['DOCUMENT_ROOT']) !== false) { $error_msg[] = sprintf(XoopsLocale::EF_FOLDER_IS_INSIDE_DOCUMENT_ROOT, $var_path); } $xoops->tpl()->assign('error_msg', $error_msg); } $xoopsorgnews = Request::getString('xoopsorgnews', null, 'GET'); if (!empty($xoopsorgnews)) { // Multiple feeds $myts = MyTextSanitizer::getInstance(); $rssurl = array(); $rssurl[] = 'http://sourceforge.net/export/rss2_projnews.php?group_id=41586&rss_fulltext=1'; $rssurl[] = 'http://www.xoops.org/backend.php'; $rssurl = array_unique(array_merge($rssurl, XoopsLocale::getAdminRssUrls())); $rssfile = 'admin/rss/adminnews-' . $xoops->getConfig('locale'); $items = $xoops->cache()->cacheRead($rssfile, 'buildRssFeedCache', 24 * 60 * 60, $rssurl); if ($items != '') { $ret = '<table class="outer width100">'; foreach (array_keys($items) as $i) { $ret .= '<tr class="head"><td><a href="' . htmlspecialchars($items[$i]['link']) . '" rel="external">'; $ret .= htmlspecialchars($items[$i]['title']) . '</a> (' . htmlspecialchars($items[$i]['pubdate']) . ')</td></tr>'; if ($items[$i]['description'] != "") {
$obj = $related_Handler->get($related_id); $form = $helper->getForm($obj, 'page_related'); $xoops->tpl()->assign('form', $form->render()); break; case 'save': if (!$xoops->security()->check()) { $xoops->redirect('related.php', 3, implode(',', $xoops->security()->getErrors())); } $related_id = Request::getInt('related_id', 0); if ($related_id > 0) { $obj = $related_Handler->get($related_id); } else { $obj = $related_Handler->create(); } //main $obj->setVar('related_name', Request::getString('related_name', '')); $obj->setVar('related_domenu', Request::getInt('related_domenu', 1)); $obj->setVar('related_navigation', Request::getInt('related_navigation', 1)); if ($related_newid = $related_Handler->insert($obj)) { $related_id = $related_id != 0 ? $related_id : $related_newid; $datas = Request::getArray('datas'); $datas_exists = $link_Handler->getContentByRelated($related_newid); $datas_delete = array_diff(array_values($datas_exists), $datas); $datas_add = array_diff($datas, array_values($datas_exists)); // delete if (count($datas_delete) != 0) { $criteria = $criteria = new CriteriaCompo(); $criteria->add(new Criteria('link_related_id', $related_id)); $criteria->add(new Criteria('link_content_id', '(' . implode(', ', $datas_delete) . ')', 'IN')); $links_ids = $link_Handler->getIds($criteria); if (!$link_Handler->DeleteByIds($links_ids)) {
$xoops->header(); // FILES UPLOAD FORM $files_form = $publisher->getForm($fileObj, 'file'); $files_form->display(); break; case "modify": $fileid = isset($_POST['fileid']) ? (int) $_POST['fileid'] : 0; // Creating the file object if ($fileid != 0) { $fileObj = $publisher->getFileHandler()->get($fileid); } else { $xoops->redirect("index.php", 1, XoopsLocale::E_NO_ACCESS_PERMISSION); } // Putting the values in the file object $fileObj->setVar('name', Request::getString('name')); $fileObj->setVar('description', Request::getString('description')); $fileObj->setVar('status', Request::getInt('file_status')); // attach file if any if (isset($_FILES['item_upload_file']) && $_FILES['item_upload_file']['name'] != "") { $oldfile = $fileObj->getFilePath(); // Get available mimetypes for file uploading $allowed_mimetypes = $publisher->getMimetypeHandler()->getArrayByType(); // TODO : display the available mimetypes to the user $errors = array(); if ($publisher->getConfig('perm_upload') && is_uploaded_file($_FILES['item_upload_file']['tmp_name'])) { if ($fileObj->checkUpload('item_upload_file', $allowed_mimetypes, $errors)) { if ($fileObj->storeUpload('item_upload_file', $allowed_mimetypes, $errors)) { unlink($oldfile); } } }
* @version $Id$ */ include dirname(dirname(__DIR__)) . '/mainfile.php'; $xoops = Xoops::getInstance(); // Warning: code depending on Xoops\Core\HttpRequest may need to change $request = \Xoops\Core\HttpRequest::getInstance(); $xoops->header(); \Xoops\Utils::dumpVar(Request::get()); $result['id'] = Request::getInt('id', 13); $result['string'] = Request::getString('string', 'defaultValueHere'); $result['bool'] = Request::getBool('bool', false); $result['order'] = Request::getString('order', 'ASC'); $result['url'] = $request->getUrl(); $result['uri'] = $request->getUri(); $result['referer'] = $request->getReferer(); $result['phpsessid_cookie'] = Request::getString('PHPSESSID', '', 'cookie'); $result['ip'] = $request->getClientIp(); $result['isget'] = 'GET' === Request::getMethod(); $result['ispost'] = 'POST' === Request::getMethod(); $result['ismobile'] = $request->is('mobile'); $result['isrobot'] = $request->is('robot'); $result['files'] = Request::getArray('file_identifier', array(), 'files'); \Xoops\Utils::dumpVar($result); echo '<a href="?id=12&string=I love you&bool=everythingsistrue&order=DESC">Good uri</a>'; echo ' - <a href="?id=test&order=DESCENDING">Bad uri</a>'; // Form $form = new Xoops\Form\SimpleForm('', 'form_id', 'request.php?id=666', true); $form->setExtra('enctype="multipart/form-data"'); $code = new Xoops\Form\Text('String', 'string', 2, 25, '', 'string...'); $code->setDescription('Description text'); $code->setPattern('^.{3,}$', 'You need at least 3 characters');
of supporting developers from this source code or any supporting source code which is considered copyrighted (c) material of the original comment or credit authors. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ use Xoops\Core\Request; use Xoops\Core\XoopsTpl; /** * smilies module * * @copyright XOOPS Project (http://xoops.org) * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @package smilies * @since 2.6.0 * @author Mage Grégory (AKA Mage) */ include dirname(dirname(__DIR__)) . '/mainfile.php'; $xoops = Xoops::getInstance(); $xoops->logger()->quiet(); $target = Request::getString('target', ''); $xoops->simpleHeader(false); if ($target && preg_match('/^[0-9a-z_]*$/i', $target)) { $tpl = new XoopsTpl(); $tpl->assign('target', $target); $tpl->assign('smileys', $xoops->getModuleHandler('smiley', 'smilies')->getActiveSmilies(false)); $tpl->assign('closebutton', 1); $tpl->display('module:smilies/smilies_smiley.tpl'); } $xoops->simpleFooter();
/** * Read the user cookie * * @return array|false the cookie data as array(userid, series, token), or * false if cookie does not exist (or not configured) */ protected function readUserCookie() { $usercookie = $this->xoops->getConfig('usercookie'); if (empty($usercookie)) { return false; // remember me is not configured } $usercookie = $this->xoops->getConfig('usercookie'); $notFound = 'Nosuchcookie'; $cookieData = Request::getString($usercookie, $notFound, 'COOKIE'); if ($cookieData !== $notFound) { $temp = explode('-', $cookieData); if (count($temp) == 3) { $temp[0] = (int) $temp[0]; return $temp; } $this->clearUserCookie(); // clean up garbage cookie } return false; }
} $imgcat_id = Request::getInt('imgcat_id', 0); if (isset($imgcat_id) && $imgcat_id != 0) { $obj = $helper->getHandlerCategories()->get($imgcat_id); $isnew = false; } else { $obj = $helper->getHandlerCategories()->create(); $isnew = true; } $obj->setVar('imgcat_name', Request::getString('imgcat_name', '')); $obj->setVar('imgcat_maxsize', Request::getInt('imgcat_maxsize', 100000)); $obj->setVar('imgcat_maxwidth', Request::getInt('imgcat_maxwidth', 128)); $obj->setVar('imgcat_maxheight', Request::getInt('imgcat_maxheight', 128)); $obj->setVar('imgcat_display', Request::getBool('imgcat_display', 1)); $obj->setVar('imgcat_weight', Request::getInt('imgcat_weight', 0)); $obj->setVar('imgcat_storetype', Request::getString('imgcat_storetype', 'file')); $obj->setVar('imgcat_type', 'C'); if ($imgcat_id = $helper->getHandlerCategories()->insert($obj)) { // delete permissions if (!$isnew) { $criteria = new CriteriaCompo(new Criteria('gperm_itemid', $imgcat_id)); $criteria->add(new Criteria('gperm_modid', $xoops->module->getVar('mid'))); $criteria2 = new CriteriaCompo(new Criteria('gperm_name', 'imgcat_write')); $criteria2->add(new Criteria('gperm_name', 'imgcat_read'), 'OR'); $criteria->add($criteria2); $xoops->getHandlerGroupPermission()->deleteAll($criteria); } // Save permissions $permissions = array('readgroup' => 'imgcat_read', 'writegroup' => 'imgcat_write'); foreach ($permissions as $k => $permission) { $groups = Request::getArray($k, array(FixedGroups::ADMIN));
/** * The name says it all */ public function setVarsFromRequest() { $xoops = Xoops::getInstance(); //Required fields if (isset($_REQUEST['categoryid'])) { $this->setVar('categoryid', Request::getInt('categoryid')); } if (isset($_REQUEST['title'])) { $this->setVar('title', Request::getString('title')); } if (isset($_REQUEST['body'])) { $this->setVar('body', Request::getText('body')); } //Not required fields if (isset($_REQUEST['summary'])) { $this->setVar('summary', Request::getText('summary')); } if (isset($_REQUEST['subtitle'])) { $this->setVar('subtitle', Request::getString('subtitle')); } if (isset($_REQUEST['item_tag'])) { $this->setVar('item_tag', Request::getString('item_tag')); } if (isset($_REQUEST['image_featured'])) { $image_item = Request::getArray('image_item'); $image_featured = Request::getString('image_featured'); //Todo: get a better image class for xoops! //Image hack $image_item_ids = array(); $qb = \Xoops::getInstance()->db()->createXoopsQueryBuilder(); $qb->select('i.image_id', 'i.image_name')->fromPrefix('image', 'i')->orderBy('i.image_id'); $result = $qb->execute(); while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) { $image_name = $myrow['image_name']; $id = $myrow['image_id']; if ($image_name == $image_featured) { $this->setVar('image', $id); } if (in_array($image_name, $image_item)) { $image_item_ids[] = $id; } } $this->setVar('images', implode('|', $image_item_ids)); } if (isset($_REQUEST['uid'])) { $this->setVar('uid', Request::getInt('uid')); } elseif ($this->isNew()) { $this->setVar('uid', $xoops->isUser() ? $xoops->user->getVar('uid') : 0); } if (isset($_REQUEST['author_alias'])) { $this->setVar('author_alias', Request::getString('author_alias')); if ($this->getVar('author_alias') != '') { $this->setVar('uid', 0); } } if (isset($_REQUEST['datesub'])) { $this->setVar('datesub', strtotime($_REQUEST['datesub']['date']) + $_REQUEST['datesub']['time']); } elseif ($this->isNew()) { $this->setVar('datesub', time()); } if (isset($_REQUEST['item_short_url'])) { $this->setVar('short_url', Request::getString('item_short_url')); } if (isset($_REQUEST['item_meta_keywords'])) { $this->setVar('meta_keywords', Request::getString('item_meta_keywords')); } if (isset($_REQUEST['item_meta_description'])) { $this->setVar('meta_description', Request::getString('item_meta_description')); } if (isset($_REQUEST['weight'])) { $this->setVar('weight', Request::getInt('weight')); } if (isset($_REQUEST['allowcomments'])) { $this->setVar('cancomment', Request::getInt('allowcomments')); } elseif ($this->isNew()) { $this->setVar('cancoment', $this->publisher->getConfig('submit_allowcomments')); } if (isset($_REQUEST['status'])) { $this->setVar('status', Request::getInt('status')); } elseif ($this->isNew()) { $this->setVar('status', $this->publisher->getConfig('submit_status')); } if (isset($_REQUEST['dohtml'])) { $this->setVar('dohtml', Request::getInt('dohtml')); } elseif ($this->isNew()) { $this->setVar('dohtml', $this->publisher->getConfig('submit_dohtml')); } if (isset($_REQUEST['dosmiley'])) { $this->setVar('dosmiley', Request::getInt('dosmiley')); } elseif ($this->isNew()) { $this->setVar('dosmiley', $this->publisher->getConfig('submit_dosmiley')); } if (isset($_REQUEST['doxcode'])) { $this->setVar('doxcode', Request::getInt('doxcode')); } elseif ($this->isNew()) { $this->setVar('doxcode', $this->publisher->getConfig('submit_doxcode')); } if (isset($_REQUEST['doimage'])) { $this->setVar('doimage', Request::getInt('doimage')); } elseif ($this->isNew()) { $this->setVar('doimage', $this->publisher->getConfig('submit_doimage')); } if (isset($_REQUEST['dolinebreak'])) { $this->setVar('dobr', Request::getInt('dolinebreak')); } elseif ($this->isNew()) { $this->setVar('dobr', $this->publisher->getConfig('submit_dobr')); } if (isset($_REQUEST['notify'])) { $this->setVar('notifypub', Request::getInt('notify')); } }
$edituser->setVar('user_icq', Request::getString('user_icq', '')); $edituser->setVar('user_from', Request::getString('user_from', '')); $edituser->setVar('user_sig', XoopsLocale::substr(Request::getString('user_sig', ''), 0, 255)); $edituser->setVar('user_viewemail', Request::getBool('user_viewemail', 0)); $edituser->setVar('user_aim', Request::getString('user_aim', '')); $edituser->setVar('user_yim', Request::getString('user_yim', '')); $edituser->setVar('user_msnm', Request::getString('user_msnm', '')); $edituser->setVar('attachsig', Request::getBool('attachsig', 0)); $edituser->setVar('timezone', Request::getString('timezone', 'UTC')); $edituser->setVar('uorder', Request::getInt('uorder', 0)); $edituser->setVar('umode', Request::getString('umode', 'flat')); $edituser->setVar('notify_method', Request::getInt('notify_method', 1)); $edituser->setVar('notify_mode', Request::getInt('notify_mode', 1)); $edituser->setVar('bio', XoopsLocale::substr(Request::getString('bio', ''), 0, 255)); $edituser->setVar('user_occ', Request::getString('user_occ', '')); $edituser->setVar('user_intrest', Request::getString('user_intrest', '')); $edituser->setVar('user_mailok', Request::getBool('user_mailok', 0)); if (!$member_handler->insertUser($edituser)) { $xoops->header(); echo $edituser->getHtmlErrors(); $xoops->footer(); } else { $xoops->redirect('userinfo.php?uid=' . $uid, 1, XoopsLocale::S_YOUR_PROFILE_UPDATED); } exit; } } if ($op === 'editprofile') { $xoops->header('module:system/system_edituser.tpl'); $xoops->tpl()->assign('uid', $xoops->user->getVar("uid")); $xoops->tpl()->assign('editprofile', true);
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * @copyright XOOPS Project (http://xoops.org) * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @package include * @since 2.3.0 * @author Vinod <*****@*****.**> * @author Taiwen Jiang <*****@*****.**> * @version $Id$ */ use Xoops\Core\Request; include_once dirname(__DIR__) . '/mainfile.php'; $xoops = Xoops::getInstance(); $xoops->logger()->quiet(); $myts = \Xoops\Core\Text\Sanitizer::getInstance(); $content = Request::getString('text', ''); if (!$xoops->security()->validateToken(@$_POST['token'], false)) { $content = 'Direct access is not allowed!!!'; } $html = empty($_POST['html']) ? 0 : 1; $content = $myts->displayTarea($content, $html, 1, 1, 1, 1); //if (preg_match_all('/%u([[:alnum:]]{4})/', $content, $matches)) { // foreach ($matches[1] as $uniord) { // $utf = '&#x' . $uniord . ';'; // $content = str_replace('%u' . $uniord, $utf, $content); // } // $content = urldecode($content); //} if (!headers_sent()) { header('Content-Type:text/html; charset=UTF-8'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ use Xoops\Core\Request; /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license GNU GPL V2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @package Publisher * @since 1.0 * @author trabis <*****@*****.**> * @author The SmartFactory <www.smartfactory.ca> * @version $Id$ */ include_once __DIR__ . '/admin_header.php'; $xoops = Xoops::getInstance(); $op = Request::getString('op'); function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) { $publisher = Publisher::getInstance(); $xoops = Xoops::getInstance(); // if there is a parameter, and the id exists, retrieve data: we're editing a file if ($fileid != 0) { // Creating the File object /* @var $fileObj PublisherFile */ $fileObj = $publisher->getFileHandler()->get($fileid); if ($fileObj->notLoaded()) { $xoops->redirect("javascript:history.go(-1)", 1, _AM_PUBLISHER_NOFILESELECTED); } if ($showmenu) { //publisher_adminMenu(2, _AM_PUBLISHER_FILE . " > " . _AM_PUBLISHER_EDITING); }
$xoops->disableModuleCache(); $xoops->header('module:publisher/publisher_search.tpl'); $xoopsTpl = $xoops->tpl(); $module_info_search = $publisher->getModule()->getInfo("search"); XoopsLoad::loadFile($publisher->path($module_info_search["file"])); $limit = 10; //$publisher->getConfig('idxcat_perpage'); $uid = 0; $queries = array(); $andor = Request::getString('andor'); $start = Request::getInt('start'); $category = Request::getArray('category'); $username = Request::getString('uname'); $searchin = Request::getArray('searchin'); $sortby = Request::getString('sortby'); $term = Request::getString('term'); if (empty($category) || is_array($category) && in_array("all", $category)) { $category = array(); } else { $category = !is_array($category) ? explode(",", $category) : $category; $category = array_map("intval", $category); } $andor = in_array(strtoupper($andor), array("OR", "AND", "EXACT")) ? strtoupper($andor) : "OR"; $sortby = in_array(strtolower($sortby), array("itemid", "datesub", "title", "categoryid")) ? strtolower($sortby) : "itemid"; if (!(empty($_POST["submit"]) && empty($term))) { $next_search["category"] = implode(",", $category); $next_search["andor"] = $andor; $next_search["term"] = $term; $query = trim($term); if ($andor !== "EXACT") { $ignored_queries = array();
$photomax = $xoops->getModuleConfig('alumni_photomax'); $maxwide = $xoops->getModuleConfig('alumni_maxwide'); $maxhigh = $xoops->getModuleConfig('alumni_maxhigh'); $allowed_mimetypes = array('image/gif', 'image/jpg', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png'); $uploader2 = new XoopsMediaUploader($uploaddir2, $allowed_mimetypes, $photomax, $maxwide, $maxhigh); if ($uploader2->fetchMedia($_POST['xoops_upload_file'][1])) { $uploader2->setTargetFileName($date . '_' . $_FILES['photo2']['name']); $uploader2->fetchMedia($_POST['xoops_upload_file'][1]); if (!$uploader2->upload()) { $errors = $uploader2->getErrors(); $xoops->redirect('javascript:history.go(-1)', 3, $errors); } else { $obj->setVar('photo2', $uploader2->getSavedFileName()); } } else { $obj->setVar('photo2', Request::getString('photo2')); } } if ($new_id = $listingHandler->insert($obj)) { if ($xoops->getModuleConfig('alumni_moderated') == '1') { $xoops->redirect('index.php', 3, AlumniLocale::MODERATE); } else { $xoops->redirect('listing.php?lid=' . $new_id . '', 3, XoopsLocale::S_DATABASE_UPDATED); } //notifications if ($lid == 0 && $xoops->isActiveModule('notifications')) { $notification_handler = Notifications::getInstance()->getHandlerNotification(); $tags = array(); $tags['MODULE_NAME'] = 'alumni'; $tags['ITEM_NAME'] = Request::getInt('lname', ''); $tags['ITEM_URL'] = XOOPS_URL . '/modules/alumni/listing.php?lid=' . $new_id;
$obj->setVar("banner_htmlbanner", Request::getInt('htmlbanner', 0)); $obj->setVar("banner_htmlcode", Request::getString('htmlcode', '')); $uploader_banners_img = new XoopsMediaUploader($xoops_upload_path . '/banners', $mimetypes, $upload_size, null, null); if ($uploader_banners_img->fetchMedia("banners_imageurl")) { $uploader_banners_img->setPrefix("banner"); $uploader_banners_img->fetchMedia("banners_imageurl"); if (!$uploader_banners_img->upload()) { $error_msg .= $uploader_banners_img->getErrors(); } else { $obj->setVar("banner_imageurl", $xoops_upload_url . '/banners/' . $uploader_banners_img->getSavedFileName()); } } else { if ($_POST["banners_imageurl"] === 'blank.gif') { $obj->setVar("banner_imageurl", Request::getString('imageurl', '')); } else { $obj->setVar("banner_imageurl", $xoops_upload_url . '/banners/' . Request::getString('banners_imageurl', '')); } } if ($error_msg == '') { if ($banner_Handler->insert($obj)) { $xoops->redirect("banners.php", 2, XoopsLocale::S_ITEM_SAVED); } $error_msg .= $obj->getHtmlErrors(); } $admin_page->addItemButton(_AM_BANNERS_BANNERS_LIST, 'banners.php', 'application-view-detail'); $admin_page->renderButton(); $xoops->tpl()->assign('info_msg', $xoops->alert('info', $info_msg, _AM_BANNERS_ALERT_INFO_TITLE_UPLOADS)); $xoops->tpl()->assign('error_msg', $xoops->alert('error', $error_msg)); $form = $helper->getForm($obj, 'banner'); $xoops->tpl()->assign('form', $form->render()); break;
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ use Xoops\Core\Request; use Punic\Territory; /** * @author Richard Griffith <*****@*****.**> * @copyright 2014 XOOPS Project (http://xoops.org) * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @link http://xoops.org */ include dirname(dirname(__DIR__)) . '/mainfile.php'; $xoops = Xoops::getInstance(); $xoops->header(); $country = Request::getString('country', 'US'); $form = new Xoops\Form\ThemeForm('Show Flag for a Country', 'form_flag', '', 'post', false, 'horizontal'); $ccode = new Xoops\Form\SelectCountry('Country', 'country', $country); $form->addElement($ccode, false); $button = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'); $form->addElement($button); $form->display(); // demonstrate the CountryFlags service $img = $xoops->service('countryflag')->getImgTag($country)->getValue(); echo $img; // we can specify a size $img = $xoops->service('countryflag')->getImgTag($country, null, 'medium')->getValue(); echo $img; $img = $xoops->service('countryflag')->getImgTag($country, null, 'small')->getValue(); echo $img; echo '<br /><br />';
public function displayDelete() { $xoops = Xoops::getInstance(); $op = Request::getCmd('op', 'delete', 'POST'); $mode = Request::getString('com_mode', 'flat'); $order = Request::getString('com_order', COMMENTS_OLD1ST); $id = Request::getInt('com_id'); /* @var $comment CommentsComment */ /* @var $comment_handler CommentsCommentHandler */ $comment_handler = $this->getHandlerComment(); $comment = $comment_handler->get($id); if (!is_object($comment)) { $xoops->redirect(\XoopsBaseConfig::get('url'), 1, XoopsLocale::E_NO_ACCESS_PERMISSION); } $module = $xoops->getModuleById($comment->getVar('modid')); if (!is_object($module)) { $xoops->redirect(\XoopsBaseConfig::get('url'), 1, XoopsLocale::E_NO_ACCESS_PERMISSION); } if (!$xoops->isAdminSide && COMMENTS_APPROVENONE == $xoops->getModuleConfig('com_rule', $module->getVar('dirname')) || !$xoops->isUser() && !$xoops->getModuleConfig('com_anonpost', $module->getVar('dirname')) || !$xoops->isModule()) { $xoops->redirect(\XoopsBaseConfig::get('url'), 1, XoopsLocale::E_NO_ACCESS_PERMISSION); } $modid = $module->getVar('mid'); /* @var $plugin CommentsPluginInterface */ if ($plugin = \Xoops\Module\Plugin::getPlugin($module->getVar('dirname'), 'comments')) { if ($xoops->isAdminSide) { $redirect_page = $this->url('admin/main.php?com_modid=' . $modid . '&com_itemid'); } else { $redirect_page = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $plugin->pageName() . '?'); $comment_confirm_extra = array(); if (is_array($extraParams = $plugin->extraParams())) { foreach ($extraParams as $extra_param) { if (isset($_GET[$extra_param])) { $redirect_page .= $extra_param . '=' . $_GET[$extra_param] . '&'; // for the confirmation page $comment_confirm_extra[$extra_param] = $_GET[$extra_param]; } } } $redirect_page .= $plugin->itemName(); } $accesserror = false; if (!$xoops->isUser()) { $accesserror = true; } else { if (!$xoops->user->isAdmin($modid)) { $accesserror = true; } } if (false != $accesserror) { $ref = $xoops->getEnv('HTTP_REFERER'); if ($ref != '') { $xoops->redirect($ref, 2, XoopsLocale::E_NO_ACCESS_PERMISSION); } else { $xoops->redirect($redirect_page . '?' . $plugin->itemName() . '=' . (int) $id, 2, XoopsLocale::E_NO_ACCESS_PERMISSION); } } switch ($op) { case 'delete_one': if (!$comment_handler->delete($comment)) { $xoops->header(); echo $xoops->alert('error', _MD_COMMENTS_COMDELETENG . ' (ID: ' . $comment->getVar('id') . ')'); $xoops->footer(); } $itemid = $comment->getVar('itemid'); $criteria = new CriteriaCompo(new Criteria('modid', $modid)); $criteria->add(new Criteria('itemid', $itemid)); $criteria->add(new Criteria('status', COMMENTS_ACTIVE)); $comment_count = $comment_handler->getCount($criteria); $plugin->update($itemid, $comment_count); // update user posts if its not an anonymous post if ($comment->getVar('uid') != 0) { $member_handler = $xoops->getHandlerMember(); $poster = $member_handler->getUser($comment->getVar('uid')); if (is_object($poster)) { $member_handler->updateUserByField($poster, 'posts', $poster->getVar('posts') - 1); } } // get all comments posted later within the same thread $thread_comments = $comment_handler->getThread($comment->getVar('rootid'), $id); $xot = new XoopsObjectTree($thread_comments, 'id', 'pid', 'rootid'); $child_comments = $xot->getFirstChild($id); // now set new parent ID for direct child comments $new_pid = $comment->getVar('pid'); $errs = array(); foreach (array_keys($child_comments) as $i) { $child_comments[$i]->setVar('pid', $new_pid); // if the deleted comment is a root comment, need to change root id to own id if (false != $comment->isRoot()) { $new_rootid = $child_comments[$i]->getVar('id'); $child_comments[$i]->setVar('rootid', $child_comments[$i]->getVar('id')); if (!$comment_handler->insert($child_comments[$i])) { $errs[] = 'Could not change comment parent ID from <strong>' . $id . '</strong> to <strong>' . $new_pid . '</strong>. (ID: ' . $new_rootid . ')'; } else { // need to change root id for all its child comments as well $c_child_comments = $xot->getAllChild($new_rootid); $cc_count = count($c_child_comments); foreach (array_keys($c_child_comments) as $j) { $c_child_comments[$j]->setVar('rootid', $new_rootid); if (!$comment_handler->insert($c_child_comments[$j])) { $errs[] = 'Could not change comment root ID from <strong>' . $id . '</strong> to <strong>' . $new_rootid . '</strong>.'; } } } } else { if (!$comment_handler->insert($child_comments[$i])) { $errs[] = 'Could not change comment parent ID from <strong>' . $id . '</strong> to <strong>' . $new_pid . '</strong>.'; } } } if (count($errs) > 0) { $xoops->header(); echo $xoops->alert('error', $errs); $xoops->footer(); exit; } $xoops->redirect($redirect_page . '=' . $itemid . '&com_order=' . $order . '&com_mode=' . $mode, 1, _MD_COMMENTS_COMDELETED); break; case 'delete_all': $rootid = $comment->getVar('rootid'); // get all comments posted later within the same thread $thread_comments = $comment_handler->getThread($rootid, $id); // construct a comment tree $xot = new XoopsObjectTree($thread_comments, 'id', 'pid', 'rootid'); $child_comments = $xot->getAllChild($id); // add itself here $child_comments[$id] = $comment; $msgs = array(); $deleted_num = array(); $member_handler = $xoops->getHandlerMember(); foreach (array_keys($child_comments) as $i) { if (!$comment_handler->delete($child_comments[$i])) { $msgs[] = _MD_COMMENTS_COMDELETENG . ' (ID: ' . $child_comments[$i]->getVar('id') . ')'; } else { $msgs[] = _MD_COMMENTS_COMDELETED . ' (ID: ' . $child_comments[$i]->getVar('id') . ')'; // store poster ID and deleted post number into array for later use $poster_id = $child_comments[$i]->getVar('uid'); if ($poster_id > 0) { $deleted_num[$poster_id] = !isset($deleted_num[$poster_id]) ? 1 : $deleted_num[$poster_id] + 1; } } } foreach ($deleted_num as $user_id => $post_num) { // update user posts $poster = $member_handler->getUser($user_id); if (is_object($poster)) { $member_handler->updateUserByField($poster, 'posts', $poster->getVar('posts') - $post_num); } } $itemid = $comment->getVar('itemid'); $criteria = new CriteriaCompo(new Criteria('modid', $modid)); $criteria->add(new Criteria('itemid', $itemid)); $criteria->add(new Criteria('status', COMMENTS_ACTIVE)); $comment_count = $comment_handler->getCount($criteria); $plugin->update($itemid, $comment_count); $xoops->header(); echo $xoops->alert('info', $msgs); echo '<br /><a href="' . $redirect_page . '=' . $itemid . '&com_order=' . $order . '&com_mode=' . $mode . '">' . XoopsLocale::GO_BACK . '</a>'; $xoops->footer(); break; case 'delete': default: $xoops->header(); $comment_confirm = array('com_id' => $id, 'com_mode' => $mode, 'com_order' => $order, 'op' => array(_MD_COMMENTS_DELETEONE => 'delete_one', _MD_COMMENTS_DELETEALL => 'delete_all')); if (!empty($comment_confirm_extra) && is_array($comment_confirm_extra)) { $comment_confirm = $comment_confirm + $comment_confirm_extra; } echo $xoops->confirm($comment_confirm, 'comment_delete.php', _MD_COMMENTS_DELETESELECT); $xoops->footer(); break; } } }
if (!$xoops->security()->check()) { $xoops->redirect('images.php?imgcat_id=' . $imgcat_id, 3, implode('<br />', $xoops->security()->getErrors())); } $msg[] = _AM_IMAGES_IMG_SAVE; $category = $helper->getHandlerCategories()->get($imgcat_id); $image_id = Request::getInt('image_id', 0); if (isset($image_id) && $image_id != 0) { $obj = $helper->getHandlerImages()->get($image_id); $isnew = false; } else { $obj = $helper->getHandlerImages()->create(); $obj->setVar('image_name', 'blank.gif'); $obj->setVar('image_mimetype', 'image/gif'); $isnew = true; } $obj->setVar('image_nicename', Request::getString('image_nicename', '')); $obj->setVar('image_created', time()); $obj->setVar('image_display', Request::getInt('image_display', 1)); $obj->setVar('image_weight', Request::getInt('image_weight', 0)); $obj->setVar('imgcat_id', $imgcat_id); // Default value $image_body = ''; $error = true; $error_message = ''; $xoops_upload_file = Request::getArray('xoops_upload_file', array()); if ($_FILES[$xoops_upload_file[0]]['error'] === 0) { $uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH . '/images', $mimetypes, $category->getVar('imgcat_maxsize'), $category->getVar('imgcat_maxwidth'), $category->getVar('imgcat_maxheight')); if ($uploader->fetchMedia($xoops_upload_file[0])) { $uploader->setPrefix('img'); if (!$uploader->upload()) { $error_message .= $uploader->getErrors();
/** * Select Theme * * @return void */ public function themeSelect() { $xoopsThemeSelect = Request::getString('xoops_theme_select', '', 'POST'); if (!empty($xoopsThemeSelect) && in_array($xoopsThemeSelect, $this->getConfig('theme_set_allowed'))) { $this->setConfig('theme_set', $xoopsThemeSelect); $_SESSION['xoopsUserTheme'] = $xoopsThemeSelect; } else { if (!empty($_SESSION['xoopsUserTheme']) && in_array($_SESSION['xoopsUserTheme'], $this->getConfig('theme_set_allowed'))) { $this->setConfig('theme_set', $_SESSION['xoopsUserTheme']); } } }
$avatar_Handler->delete($avatars[0]); $xoops_upload_path = \XoopsBaseConfig::get('uploads-path'); $oldavatar_path = realpath($xoops_upload_path . '/' . $oldavatar); if (0 === strpos($oldavatar_path, realpath($xoops_upload_path)) && is_file($oldavatar_path)) { unlink($oldavatar_path); } } $sql = $xoops->db()->createXoopsQueryBuilder()->updatePrefix('system_user')->set('user_avatar', ':avatar')->where('uid = :uid')->setParameter(':uid', $xoops->user->getVar('uid'), \PDO::PARAM_INT)->setParameter(':avatar', 'avatars/' . $uploader_avatars_img->getSavedFileName(), \PDO::PARAM_STR)->execute(); $avatar_Handler->addUser($obj->getVar('avatar_id'), $xoops->user->getVar('uid')); $xoops->redirect($xoops->url('userinfo.php?uid=' . $uid), 2, XoopsLocale::S_ITEM_SAVED); } $error_msg .= $obj->getHtmlErrors(); } } } else { $user_avatar = Request::getString('user_avatar', 'blank.gif'); $oldavatar = $xoops->user->getVar('user_avatar'); $xoops->user->setVar('user_avatar', $user_avatar); $member_handler = $xoops->getHandlerMember(); if (!$member_handler->insertUser($xoops->user)) { echo $xoops->user->getHtmlErrors(); } $criteria = new CriteriaCompo(); $criteria->add(new Criteria('avatar_type', 'C')); $criteria->add(new Criteria('avatar_file', $oldavatar)); $avatars = $avatar_Handler->getObjects($criteria); if (!empty($avatars) && count($avatars) == 1 && is_object($avatars[0])) { $avatar_Handler->delete($avatars[0]); $xoops_upload_path = \XoopsBaseConfig::get('uploads-path'); $oldavatar_path = realpath($xoops_upload_path . '/' . $oldavatar); if (0 === strpos($oldavatar_path, realpath($xoops_upload_path)) && is_file($oldavatar_path)) {
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ use Xoops\Core\Request; /** * page module * * @copyright XOOPS Project (http://xoops.org) * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @package page * @since 2.6.0 * @author Mage Grégory (AKA Mage) * @version $Id$ */ include __DIR__ . '/header.php'; // Get Action type $op = Request::getString('op', 'global'); // Call header $xoops->header('admin:page/page_admin_permissions.tpl'); $admin_page = new \Xoops\Module\Admin(); $admin_page->renderNavigation('permissions.php'); $opform = new Xoops\Form\SimpleForm('', 'opform', 'permissions.php', 'get'); $op_select = new Xoops\Form\Select('', 'op', $op); $op_select->setExtra('onchange="document.forms.opform.submit()"'); $op_select->addOption('global', PageLocale::PERMISSIONS_RATE); $op_select->addOption('view', PageLocale::PERMISSIONS_VIEW); $opform->addElement($op_select); $xoops->tpl()->assign('form', $opform->render()); switch ($op) { case 'global': default: $global_perm_array = array('1' => PageLocale::PERMISSIONS_RATE);
$mail_mailok = Request::getInt('mail_mailok', 0); $mail_lastlog_min = Request::getString('mail_lastlog_min', ''); $mail_lastlog_max = Request::getString('mail_lastlog_max', ''); $mail_idle_more = Request::getInt('mail_idle_more', 0); $mail_idle_less = Request::getInt('mail_idle_less', 0); $mail_regd_min = Request::getString('mail_regd_min', ''); $mail_regd_max = Request::getString('mail_regd_max', ''); $mail_to_group = Request::getArray('mail_to_group', array()); $mail_to_group = array_map("intval", $mail_to_group); $mail_start = Request::getInt('mail_start', 0); $mail_to_user = Request::getArray('mail_to_user', array()); $mail_to_user = array_map("intval", $mail_to_user); $mail_fromname = Request::getString('mail_fromname'); $mail_fromemail = Request::getString('mail_fromemail'); $mail_subject = Request::getString('mail_subject'); $mail_body = Request::getString('mail_body'); $count_criteria = 0; // user count via criteria; if (!empty($mail_send_to)) { $added = array(); $added_id = array(); $criteria = array(); if ($mail_inactive) { $criteria[] = "level = 0"; } else { if ($mail_mailok) { $criteria[] = 'user_mailok = 1'; } if ($mail_lastlog_min) { $time = strtotime(trim($mail_lastlog_min)); if ($time > 0) {
require_once dirname(__FILE__) . '/../../../../../../mainfile.php'; $xoops = Xoops::getInstance(); $xoops->disableErrorReporting(); $xoops->simpleHeader(false); $helper->loadLanguage('admin'); $helper->loadLanguage('tinymce'); $op = Request::getCmd('op', ''); if ($op === 'save') { if (!$xoops->security()->check()) { $xoops->redirect('xoops_xlanguage.php', 2, implode(',', $xoops->security()->getErrors())); } XoopsLoad::load('system', 'system'); $msg[] = _AM_SMILIES_SAVE; $obj = $helper->getHandlerSmilies()->create(); $obj->setVar('smiley_code', Request::getString('smiley_code', '')); $obj->setVar('smiley_emotion', Request::getString('smiley_emotion', '')); $obj->setVar('smiley_display', Request::getBool('smiley_display', 1)); $obj->setVar('smiley_url', 'smilies/' . Request::getPath('smiley_url', '')); $xoops_upload_file = Request::getArray('xoops_upload_file', array()); $mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'); $upload_size = 500000; $uploader = new XoopsMediaUploader(\XoopsBaseConfig::get('uploads-path') . '/smilies', $mimetypes, $upload_size, null, null); if ($uploader->fetchMedia($xoops_upload_file[0])) { $uploader->setPrefix('smil'); if (!$uploader->upload()) { $msg[] = $uploader->getErrors(); $obj->setVar('smiley_url', 'blank.gif'); } else { $obj->setVar('smiley_url', 'smilies/' . $uploader->getSavedFileName()); } }
$obj->setVar('content_weight', Request::getInt('content_weight', 0)); } if ($error == true) { $xoops->tpl()->assign('error_message', $error_message); } else { if ($newcontent_id = $content_Handler->insert($obj)) { // update permissions $perm_id = $content_id > 0 ? $content_id : $newcontent_id; $groups_view_item = Request::getArray('groups_view_item', array()); $gperm_Handler->updatePerms($perm_id, $groups_view_item); //notifications if ($content_id == 0 && $xoops->isActiveModule('notifications')) { $notification_handler = Notifications::getInstance()->getHandlerNotification(); $tags = array(); $tags['MODULE_NAME'] = 'page'; $tags['ITEM_NAME'] = Request::getString('content_title', ''); $tags['ITEM_URL'] = \XoopsBaseConfig::get('url') . '/modules/page/viewpage.php?id=' . $newcontent_id; $notification_handler->triggerEvent('global', 0, 'newcontent', $tags); $notification_handler->triggerEvent('item', $newcontent_id, 'newcontent', $tags); } $xoops->redirect('content.php', 2, XoopsLocale::S_DATABASE_UPDATED); } echo $xoops->alert('error', $obj->getHtmlErrors()); } $form = $helper->getForm($obj, 'page_content'); $xoops->tpl()->assign('form', $form->render()); break; case 'delete': $admin_page->addItemButton(PageLocale::A_LIST_CONTENT, 'content.php', 'application-view-detail'); $admin_page->addItemButton(PageLocale::A_ADD_CONTENT, 'content.php?op=new', 'add'); $admin_page->renderButton();
$requete_pagenav .= '&user_msnm=' . htmlspecialchars($value) . '&user_msnm_match=' . $match; $requete_search .= 'msnm : ' . $value . ' and user_msnm_match=' . $match . '<br />'; } $value = Request::getString('user_from', ''); if (!empty($value)) { $criteria->add(new Criteria('user_from', '%' . $value . '%', 'LIKE')); $requete_pagenav .= '&user_from=' . htmlspecialchars($value); $requete_search .= 'from : ' . $value . '<br />'; } $value = Request::getString('user_intrest', ''); if (!empty($value)) { $criteria->add(new Criteria('user_intrest', '%' . $value . '%', 'LIKE')); $requete_pagenav .= '&user_intrest=' . htmlspecialchars($value); $requete_search .= 'interet : ' . $value . '<br />'; } $value = Request::getString('user_occ', ''); if (!empty($value)) { $criteria->add(new Criteria('user_occ', '%' . $value . '%', 'LIKE')); $requete_pagenav .= '&user_occ=' . htmlspecialchars($value); $requete_search .= 'location : ' . $value . '<br />'; } $value = (int) Request::getInt('user_lastlog_more', 0); if (!empty($value)) { $time = time() - 60 * 60 * 24 * $value; if ($time > 0) { $criteria->add(new Criteria('last_login', $time, '<')); $requete_pagenav .= '&user_lastlog_more=' . $value; $requete_search .= 'derniere connexion apres : ' . $value . '<br />'; } } $value = (int) Request::getInt('user_lastlog_less', 0);
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ use Xoops\Core\Request; /** * @author Richard Griffith <*****@*****.**> * @copyright 2013-2014 XOOPS Project (http://xoops.org) * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @link http://xoops.org */ // this is located in include, otherwise normal/anon users do not have authority to run include dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; $xoops = Xoops::getInstance(); $xoops->logger()->quiet(); $text = Request::getString('text', 'error'); $configs = $xoops->getModuleConfigs('qrcode'); $qrCode = new Endroid\QrCode\QrCode($text); $ecChar = $configs['qrcode_ecl']; switch (strtoupper($ecChar)) { case 'H': $ec = Endroid\QrCode\QrCode::LEVEL_HIGH; break; case 'Q': $ec = Endroid\QrCode\QrCode::LEVEL_QUARTILE; break; case 'M': $ec = Endroid\QrCode\QrCode::LEVEL_MEDIUM; break; case 'L': default:
} else { $obj->setVar("avatar_weight", Request::getInt('avatar_weight', 0)); } $obj->setVar('avatar_type', 'C'); if ($uploader_avatars_img->fetchMedia('avatar_file')) { $uploader_avatars_img->setPrefix('savt'); $uploader_avatars_img->fetchMedia('avatar_file'); if (!$uploader_avatars_img->upload()) { $error_msg .= $uploader_avatars_img->getErrors(); $obj->setVar('avatar_file', 'avatars/blank.gif'); } else { $obj->setVar('avatar_mimetype', $uploader_avatars_img->getMediaType()); $obj->setVar('avatar_file', 'avatars/' . $uploader_avatars_img->getSavedFileName()); } } else { $file = Request::getString('avatar_file', 'blank.gif'); $obj->setVar('avatar_file', 'avatars/' . $file); } if ($error_msg == '') { if ($avatar_Handler->insert($obj)) { $xoops->redirect('avatar_custom.php', 2, XoopsLocale::S_ITEM_SAVED); } $error_msg .= $obj->getHtmlErrors(); } $admin_page->addItemButton(AvatarsLocale::LIST_OF_AVATARS, 'avatar_custom.php', 'application-view-detail'); $admin_page->renderButton(); $xoops->tpl()->assign('info_msg', $xoops->alert('info', $info_msg, XoopsLocale::INFORMATION_FOR_UPLOADS)); $xoops->tpl()->assign('error_msg', $xoops->alert('error', $error_msg, XoopsLocale::ERRORS)); $form = $xoops->getModuleForm($obj, 'avatar'); $xoops->tpl()->assign('form', $form->render()); break;
/** * @param CommentsComment $obj */ public function __construct(CommentsComment $obj) { $xoops = Xoops::getInstance(); $helper = $xoops->getModuleHelper('comments'); $module = $xoops->getModuleById($obj->getVar('modid')); if (!is_object($module)) { $xoops->redirect(\XoopsBaseConfig::get('url'), 1, XoopsLocale::E_NO_ACCESS_PERMISSION); } $dirname = $module->getVar('dirname'); // create form if ($xoops->isAdminSide) { $url = $helper->url("admin/comment_post.php"); } else { $url = $helper->url("comment_post.php"); } parent::__construct(_MD_COMMENTS_POSTCOMMENT, "commentform", $url, "post", true); switch ($xoops->getModuleConfig('com_rule', $dirname)) { case Comments::APPROVE_ALL: $rule_text = _MD_COMMENTS_COMAPPROVEALL; break; case Comments::APPROVE_USER: $rule_text = _MD_COMMENTS_COMAPPROVEUSER; break; case Comments::APPROVE_ADMIN: default: $rule_text = _MD_COMMENTS_COMAPPROVEADMIN; break; } $this->addElement(new Xoops\Form\Label(_MD_COMMENTS_COMRULES, $rule_text)); $this->addElement(new Xoops\Form\Text(_MD_COMMENTS_TITLE, 'com_title', 50, 255, $obj->getVar('title', 'e')), true); $iconsRadio = new Xoops\Form\Radio(XoopsLocale::MESSAGE_ICON, 'com_icon', $obj->getVar('icon', 'e')); \Xoops\Core\Lists\SubjectIcon::setOptionsArray($iconsRadio); $this->addElement($iconsRadio); // editor $editor = $helper->getConfig('com_editor'); if (class_exists('Xoops\\Form\\Editor')) { $configs = array('name' => 'com_text', 'value' => $obj->getVar('text', 'e'), 'rows' => 25, 'cols' => 90, 'width' => '100%', 'height' => '400px', 'editor' => $editor); $this->addElement(new Xoops\Form\Editor(_MD_COMMENTS_MESSAGE, 'com_text', $configs, false, $onfailure = 'textarea')); } else { $this->addElement(new Xoops\Form\DhtmlTextArea(_MD_COMMENTS_MESSAGE, 'com_text', $obj->getVar('text', 'e'), 10, 50), true); } $option_tray = new Xoops\Form\ElementTray(XoopsLocale::OPTIONS, '<br />'); $buttonTray = new Xoops\Form\ElementTray('', ' '); if ($xoops->isUser()) { if ($xoops->getModuleConfig('com_anonpost', $dirname)) { $noname = $obj->getVar('noname', 'e') ? 1 : 0; $noname_checkbox = new Xoops\Form\Checkbox('', 'com_noname', $noname); $noname_checkbox->addOption(1, XoopsLocale::POST_ANONYMOUSLY); $option_tray->addElement($noname_checkbox); } if (false != $xoops->user->isAdmin($obj->getVar('modid'))) { // show status change box when editing (comment id is not empty) if ($obj->getVar('id', 'e')) { $status_select = new Xoops\Form\Select(_MD_COMMENTS_STATUS, 'com_status', $obj->getVar('status', 'e')); $status_select->addOptionArray(array(Comments::STATUS_PENDING => _MD_COMMENTS_PENDING, Comments::STATUS_ACTIVE => _MD_COMMENTS_ACTIVE, Comments::STATUS_HIDDEN => _MD_COMMENTS_HIDDEN)); $this->addElement($status_select); $buttonTray->addElement(new Xoops\Form\Button('', 'com_dodelete', XoopsLocale::A_DELETE, 'submit')); } if (isset($editor) && in_array($editor, array('textarea', 'dhtmltextarea'))) { $html_checkbox = new Xoops\Form\Checkbox('', 'com_dohtml', $obj->getVar('dohtml', 'e')); $html_checkbox->addOption(1, _MD_COMMENTS_DOHTML); $option_tray->addElement($html_checkbox); } } } if (isset($editor) && in_array($editor, array('textarea', 'dhtmltextarea'))) { //Yeah, what? } $smiley_checkbox = new Xoops\Form\Checkbox('', 'com_dosmiley', $obj->getVar('domsiley', 'e')); $smiley_checkbox->addOption(1, _MD_COMMENTS_DOSMILEY); $option_tray->addElement($smiley_checkbox); $xcode_checkbox = new Xoops\Form\Checkbox('', 'com_doxcode', $obj->getVar('doxcode', 'e')); $xcode_checkbox->addOption(1, _MD_COMMENTS_DOXCODE); $option_tray->addElement($xcode_checkbox); if (isset($editor) && in_array($editor, array('textarea', 'dhtmltextarea'))) { $br_checkbox = new Xoops\Form\Checkbox('', 'com_dobr', $obj->getVar('dobr', 'e')); $br_checkbox->addOption(1, _MD_COMMENTS_DOAUTOWRAP); $option_tray->addElement($br_checkbox); } else { $this->addElement(new Xoops\Form\Hidden('com_dohtml', 1)); $this->addElement(new Xoops\Form\Hidden('com_dobr', 0)); } $this->addElement($option_tray); if (!$xoops->isUser()) { $this->addElement(new Xoops\Form\Captcha()); } $this->addElement(new Xoops\Form\Hidden('com_modid', $obj->getVar('modid', 'e'))); $this->addElement(new Xoops\Form\Hidden('com_pid', $obj->getVar('pid', 'e'))); $this->addElement(new Xoops\Form\Hidden('com_rootid', $obj->getVar('rootid', 'e'))); $this->addElement(new Xoops\Form\Hidden('com_id', $obj->getVar('id', 'e'))); $this->addElement(new Xoops\Form\Hidden('com_itemid', $obj->getVar('itemid', 'e'))); $this->addElement(new Xoops\Form\Hidden('com_order', Request::getInt('com_order', $helper->getUserConfig('com_order')))); $this->addElement(new Xoops\Form\Hidden('com_mode', Request::getString('com_mode', $helper->getUserConfig('com_mode')))); // add module specific extra params if (!$xoops->isAdminSide) { /* @var $plugin CommentsPluginInterface */ $plugin = \Xoops\Module\Plugin::getPlugin($dirname, 'comments'); if (is_array($extraParams = $plugin->extraParams())) { foreach ($extraParams as $extra_param) { // This routine is included from forms accessed via both GET and POST if (isset($_POST[$extra_param])) { $hidden_value = $_POST[$extra_param]; } else { if (isset($_GET[$extra_param])) { $hidden_value = $_GET[$extra_param]; } else { $hidden_value = ''; } } $this->addElement(new Xoops\Form\Hidden($extra_param, $hidden_value)); } } } $buttonTray->addElement(new Xoops\Form\Button('', 'com_dopreview', XoopsLocale::A_PREVIEW, 'submit')); $buttonTray->addElement(new Xoops\Form\Button('', 'com_dopost', _MD_COMMENTS_POSTCOMMENT, 'submit')); $this->addElement($buttonTray); return $this; }