作者:ming-ha
项目:XoopsCor
public static function eventCoreImagemanager($args)
{
$uri = '';
foreach (Request::get() as $k => $v) {
$uri .= urlencode($k) . '=' . urlencode($v) . '&';
}
Xoops::getInstance()->redirect("modules/images/imagemanager.php?{$uri}", 0);
}
作者:jlm6
项目:alumni-26
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;
}
作者:jlm6
项目:alumni-26
public function search($queryArray, $andor, $limit, $offset, $userid)
{
$xoops = Xoops::getInstance();
$helper = $xoops->getModuleHelper('alumni');
$module_id = $helper->getModule()->getVar('mid');
$listing_Handler = $helper->getHandler('listing');
$groups = $xoops->getUserGroups();
$alumni_ids = $xoops->getHandlerGroupPermission()->getItemIds('alumni_view', $groups, $module_id);
$all_ids = implode(', ', $alumni_ids);
$by_cat = Request::getInt('by_cat', 0);
$andor = strtolower($andor) == 'and' ? 'and' : 'or';
$qb = \Xoops::getInstance()->db()->createXoopsQueryBuilder();
$eb = $qb->expr();
$qb->select('DISTINCT *')->fromPrefix('alumni_listing')->where($eb->eq('valid', '1'))->orderBy('lname', 'DESC')->setFirstResult($offset)->setMaxResults($limit);
if (is_array($queryArray) && !empty($queryArray)) {
$queryParts = array();
foreach ($queryArray as $i => $q) {
$query = ':query' . $i;
$qb->setParameter($query, '%' . $q . '%', \PDO::PARAM_STR);
$queryParts[] = $eb->orX($eb->like('name', $query), $eb->like('mname', $query), $eb->like('lname', $query), $eb->like('school', $query), $eb->like('year', $query));
}
$qb->andWhere($eb->in('cid', array($all_ids)));
if ($by_cat) {
$qb->andWhere($eb->eq('cid', $by_cat));
}
if ($andor == 'and') {
$qb->andWhere(call_user_func_array(array($eb, "andX"), $queryParts));
} else {
$qb->andWhere(call_user_func_array(array($eb, "orX"), $queryParts));
}
} else {
$qb->setParameter(':uid', (int) $userid, \PDO::PARAM_INT);
$qb->andWhere($eb->eq('usid', ':uid'));
}
$myts = MyTextSanitizer::getInstance();
$items = array();
$result = $qb->execute();
while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) {
$items[] = array('title' => $myrow['name'] . " " . $myrow['mname'] . " " . $myrow['lname'] . " --- " . $myrow['school'] . " --- " . $myrow['year'], 'link' => "listing.php?lid=" . $myrow["lid"], 'time' => $myrow['date'], 'uid' => $myrow['usid'], 'image' => 'images/cat/default.gif');
}
return $items;
}
作者:ming-ha
项目:XoopsCor
$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());
}
}
if ($helper->getHandlerSmilies()->insert($obj)) {
$xoops->redirect('xoops_smilies.php', 2, implode('<br />', $msg));
}
作者:ming-ha
项目:XoopsCor
}
} else {
echo $xoops->confirm(array('ok' => 1, 'related_id' => $related_id, 'op' => 'delete'), 'related.php', XoopsLocale::Q_ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_ITEM . '<br /><span class="red">' . $obj->getvar('related_name') . '<span>');
}
break;
case 'update_status':
$related_id = Request::getInt('related_id', 0);
if ($related_id > 0) {
$obj = $related_Handler->get($related_id);
$old = $obj->getVar('related_domenu');
$obj->setVar('related_domenu', !$old);
if ($related_Handler->insert($obj)) {
exit;
}
echo $obj->getHtmlErrors();
}
break;
case 'view':
$related_id = Request::getInt('related_id', 0);
if ($related_id > 0) {
$obj = $related_Handler->get($related_id);
$old = $obj->getVar('related_domenu');
$obj->setVar('related_domenu', !$old);
if ($related_Handler->insert($obj)) {
exit;
}
echo $obj->getHtmlErrors();
}
break;
}
$xoops->footer();
作者:ming-ha
项目:XoopsCor
*
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @since 2.6.0
* @author Mage Grégory (AKA Mage)
* @version $Id$
*/
require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php';
XoopsLoad::load('system', 'system');
$xoops = Xoops::getInstance();
$system = System::getInstance();
$helper = Xoops\Module\Helper::getHelper('images');
// Get Action type
$op = Request::getCmd('op', 'list');
$start = Request::getInt('start', 0);
$imgcat_id = Request::getInt('imgcat_id', 0);
$redirect = basename($xoops->getEnv('SCRIPT_NAME'));
if (!$xoops->isUser() || !$xoops->isModule() || !$xoops->user->isAdmin($xoops->module->mid())) {
exit(XoopsLocale::E_NO_ACCESS_PERMISSION);
}
$gperm_handler = $xoops->getHandlerGroupPermission();
$groups = $xoops->getUserGroups();
// check WRITE right by category before continue
if (isset($imgcat_id) && ($op === 'addfile' || $op === 'editcat' || $op === 'updatecat' || $op === 'delcatok' || $op === 'delcat')) {
$imgcat_write = $gperm_handler->checkRight('imgcat_write', $imgcat_id, $groups, $xoops->module->mid());
if (!$imgcat_write) {
$xoops->redirect($redirect, 1);
}
}
// Only website administator can delete categories or images
if (!in_array(FixedGroups::ADMIN, $groups) && ($op === 'delfile' || $op === 'delfileok' || $op === 'delcatok' || $op === 'delcat')) {
作者:redmexic
项目:XoopsCor
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 <lusopoemas@gmail.com>
* @author The SmartFactory <www.smartfactory.ca>
* @version $Id$
*/
include_once __DIR__ . '/header.php';
$xoops = Xoops::getInstance();
$xoops->disableErrorReporting();
$itemid = Request::getInt('itemid');
if ($itemid == 0) {
$xoops->redirect("javascript:history.go(-1)", 1, _MD_PUBLISHER_NOITEMSELECTED);
}
// Creating the ITEM object for the selected ITEM
/* @var $itemObj PublisherItem */
$itemObj = $publisher->getItemHandler()->get($itemid);
// if the selected ITEM was not found, exit
if ($itemObj->notLoaded()) {
$xoops->redirect("javascript:history.go(-1)", 1, _MD_PUBLISHER_NOITEMSELECTED);
}
// Check user permissions to access that category of the selected ITEM
if (!$itemObj->accessGranted()) {
$xoops->redirect("javascript:history.go(-1)", 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
// Creating the category object that holds the selected ITEM
作者:ming-ha
项目:XoopsCor
*
* @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 DuGris (aka Laurent JEN)
* @version $Id$
*/
include_once 'header.php';
$xoops->logger()->quiet();
$ret['error'] = 1;
if ($xoops->security()->check()) {
$time = time();
if (!isset($_SESSION['page_rating' . $content_id]) || $_SESSION['page_rating' . $content_id] < $time) {
$content_id = Request::getInt('content_id', 0);
$option = Request::getInt('option', 0);
$_SESSION['page_rating' . $content_id] = $time + $interval;
// Test if the page exist
$contentObj = $content_Handler->get($content_id);
if (count($contentObj) == 0 || $contentObj->getVar('content_status') == 0 || $contentObj->getVar('content_dorating') == 0) {
echo json_encode($ret);
exit;
}
// Permission to view
$perm_view = $gperm_Handler->checkRight('page_view_item', $content_id, $groups, $module_id, false);
// Permission to vote
$perm_vote = $gperm_Handler->checkRight('page_global', 0, $groups, $module_id, false);
if (!$perm_view || !$perm_vote) {
echo json_encode($ret);
exit;
}
作者:redmexic
项目:XoopsCor
*/
// ######################################################################
// # Original version:
// # [11-may-2001] Kenneth Lee - http://www.nexgear.com/
// ######################################################################
include_once __DIR__ . '/header.php';
$xoops = Xoops::getInstance();
$publisher = Publisher::getInstance();
$xoops->header('module:publisher/publisher_archive.tpl');
$xoopsTpl = $xoops->tpl();
XoopsLoad::loadFile($publisher->path('footer.php'));
$lastyear = 0;
$lastmonth = 0;
$months_arr = array(1 => XoopsLocale::L_MONTH_JANUARY, 2 => XoopsLocale::L_MONTH_FEBRUARY, 3 => XoopsLocale::L_MONTH_MARCH, 4 => XoopsLocale::L_MONTH_APRIL, 5 => XoopsLocale::L_MONTH_MAY, 6 => XoopsLocale::L_MONTH_JUNE, 7 => XoopsLocale::L_MONTH_JULY, 8 => XoopsLocale::L_MONTH_AUGUST, 9 => XoopsLocale::L_MONTH_SEPTEMBER, 10 => XoopsLocale::L_MONTH_OCTOBER, 11 => XoopsLocale::L_MONTH_NOVEMBER, 12 => XoopsLocale::L_MONTH_DECEMBER);
$fromyear = Request::getInt('year');
$frommonth = Request::getInt('month');
$pgtitle = '';
if ($fromyear && $frommonth) {
$pgtitle = sprintf(" - %d - %d", $fromyear, $frommonth);
}
$dateformat = $publisher->getConfig('format_date');
if ($dateformat == '') {
$dateformat = 'm';
}
$myts = MyTextSanitizer::getInstance();
$xoopsTpl->assign('xoops_pagetitle', $myts->htmlSpecialChars(_MD_PUBLISHER_ARCHIVES) . $pgtitle . ' - ' . $myts->htmlSpecialChars($xoopsModule->getVar('name')));
$useroffset = '';
if ($xoops->isUser()) {
$timezone = $xoops->user->timezone();
if (isset($timezone)) {
$useroffset = $xoops->user->timezone();
作者:ming-ha
项目:XoopsCor
* @license GNU GPL V2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package Publisher
* @subpackage Action
* @since 1.0
* @author trabis <lusopoemas@gmail.com>
* @author The SmartFactory <www.smartfactory.ca>
* @version $Id$
*/
include_once __DIR__ . '/header.php';
$xoops = Xoops::getInstance();
$publisher = Publisher::getInstance();
$myts = \Xoops\Core\Text\Sanitizer::getInstance();
// At which record shall we start for the Categories
$catstart = Request::getInt('catstart');
// At which record shall we start for the ITEM
$start = Request::getInt('start');
// Number of categories at the top level
$totalCategories = $publisher->getCategoryHandler()->getCategoriesCount(0);
// if there ain't no category to display, let's get out of here
if ($totalCategories == 0) {
$xoops->redirect(\XoopsBaseConfig::get('url'), 2, _MD_PUBLISHER_NO_TOP_PERMISSIONS);
}
$xoops->header('module:publisher/publisher_display' . '_' . $publisher->getConfig('idxcat_items_display_type') . '.tpl');
$xoopsTpl = $xoops->tpl();
XoopsLoad::loadFile($publisher->path('footer.php'));
$gperm_handler = $xoops->getHandlerGroupPermission();
// Creating the top categories objects
$categoriesObj = $publisher->getCategoryHandler()->getCategories($publisher->getConfig('idxcat_cat_perpage'), $catstart);
// if no categories are found, exit
$totalCategoriesOnPage = count($categoriesObj);
if ($totalCategoriesOnPage == 0) {
作者:redmexic
项目:XoopsCor
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;
/**
* @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 <lusopoemas@gmail.com>
* @version $Id$
*/
include_once __DIR__ . '/header.php';
$xoops = Xoops::getInstance();
$uid = Request::getInt('uid');
if (!$uid) {
$xoops->redirect('index.php', 2, _CO_PUBLISHER_ERROR);
}
$member_handler = $xoops->getHandlerMember();
$thisuser = $member_handler->getUser($uid);
if (!is_object($thisuser)) {
$xoops->redirect('index.php', 2, _CO_PUBLISHER_ERROR);
}
if (!$publisher->getConfig('perm_author_items')) {
$xoops->redirect('index.php', 2, _CO_PUBLISHER_ERROR);
}
$myts = MyTextSanitizer::getInstance();
$xoops->header('publisher_author_items.tpl');
$xoopsTpl = $xoops->tpl();
XoopsLoad::loadFile($publisher->path('footer.php'));
作者:elite
项目:XoopsCor
/**
* 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']);
}
}
}
作者:ming-ha
项目:XoopsCor
$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');
$code->setDatalist(array('list 1', 'list 2', 'list 3'));
$form->addElement($code, true);
$select = new Xoops\Form\Select('Select', 'id', '', 1, false);
$select->addOption(1, 'Select 1');
$select->addOption(2, 'Select 2');
$select->addOption('somebad id here', 'Select with bad id');
作者:ming-ha
项目:XoopsCor
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>.';
//.........这里部分代码省略.........
作者:mambax
项目:publisher-2
// 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);
}
}
}
}
作者:ming-ha
项目:XoopsCor
$img .= "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/ swflash.cab#version=6,0,40,0\" width=\"468\" height=\"60\">";
$img .= "<param name=movie value=\"{$imageurl}\">";
$img .= "<embed src=\"{$imageurl}\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"468\" height=\"60\">";
$img .= "</embed>";
$img .= "</object>";
} else {
$img .= "<img src='" . $imageurl . "' alt='' />";
}
}
echo $xoops->confirm(array("ok" => 1, "bid" => $bid, "op" => "delete"), 'banners.php', XoopsLocale::Q_ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_ITEM . '<br \\>' . $img . '<br \\>');
}
} else {
$xoops->redirect('banners.php', 1, XoopsLocale::E_DATABASE_NOT_UPDATED);
}
break;
case 'reload':
$bid = Request::getInt('bid', 0);
$obj = $banner_Handler->get($bid);
$obj->setVar("banner_datestart", time());
$obj->setVar("banner_dateend", 0);
$obj->setVar("banner_imptotal", 0);
$obj->setVar("banner_impmade", 0);
$obj->setVar("banner_clicks", 0);
$obj->setVar("banner_status", 1);
if ($banner_Handler->insert($obj)) {
$xoops->redirect("banners.php", 2, _AM_BANNERS_DBUPDATED);
}
echo $xoops->alert('error', $obj->getHtmlErrors());
break;
}
$xoops->footer();
作者:redmexic
项目:XoopsCor
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package core
* @since 2.0.0
* @version $Id$
*/
include __DIR__ . '/mainfile.php';
$xoops = Xoops::getInstance();
$xoops->preload()->triggerEvent('core.readpmsg.start');
if (!$xoops->isUser()) {
$xoops->redirect("user.php", 2, XoopsLocale::E_YOU_ARE_NOT_REGISTERED);
}
$op = Request::getCmd('op', 'list');
$id = Request::getInt('msg_id', 0);
$start = Request::getInt('start', 0);
$total_messages = Request::getInt('total_messages', 0);
$pm_handler = $xoops->getHandlerPrivateMessage();
$xoops->header('module:system/system_readpmsg.tpl');
switch ($op) {
case 'list':
default:
$criteria = new CriteriaCompo(new Criteria('to_userid', $xoops->user->getVar('uid')));
if ($id > 0) {
$criteria->add(new Criteria('msg_id', $id));
} else {
$criteria->setStart($start);
}
$criteria->setLimit(1);
$criteria->setSort('msg_time');
$criteria->setOrder('DESC');
$pm_arr = $pm_handler->getObjects($criteria);
作者:elite
项目:XoopsCor
* @subpackage Action
* @since 1.0
* @author trabis <lusopoemas@gmail.com>
* @author Sina Asghari (AKA stranger) <stranger@impresscms.ir>
* @version $Id$
*/
include_once __DIR__ . '/header.php';
$xoops = Xoops::getInstance();
$xoops->disableErrorReporting();
if (!$xoops->service('htmltopdf')->isAvailable()) {
$xoops->redirect("javascript:history.go(-1)", 1, _MD_PUBLISHER_NOPDF);
}
$publisher = Publisher::getInstance();
$myts = \Xoops\Core\Text\Sanitizer::getInstance();
$itemid = Request::getInt('itemid');
$item_page_id = Request::getInt('page', -1);
if ($itemid == 0) {
$xoops->redirect("javascript:history.go(-1)", 1, _MD_PUBLISHER_NOITEMSELECTED);
}
// Creating the item object for the selected item
/* @var $itemObj PublisherItem */
$itemObj = $publisher->getItemHandler()->get($itemid);
// if the selected item was not found, exit
if (!$itemObj) {
$xoops->redirect("javascript:history.go(-1)", 1, _MD_PUBLISHER_NOITEMSELECTED);
}
// Creating the category object that holds the selected item
$categoryObj = $publisher->getCategoryHandler()->get($itemObj->getVar('categoryid'));
// Check user permissions to access that category of the selected item
if (!$itemObj->accessGranted()) {
$xoops->redirect("javascript:history.go(-1)", 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
作者:ming-ha
项目:XoopsCor
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_once 'header.php';
// Call header
$xoops->header('module:page/page_viewpage.tpl');
// Get ID
$content_id = Request::getInt('id', 0);
// Permission to view
$perm_view = $gperm_Handler->checkRight('page_view_item', $content_id, $groups, $module_id, false);
if (!$perm_view) {
$xoops->redirect('javascript:history.go(-1)', 2, XoopsLocale::E_NO_ACCESS_PERMISSION);
exit;
}
// Get content
$view_content = $content_Handler->get($content_id);
// Test if the page exist
if (count($view_content) == 0 || $view_content->getVar('content_status') == 0) {
$xoops->redirect('index.php', 3, PageLocale::E_NOT_EXIST);
exit;
}
// hits
if ($view_content->getVar('content_author') != $uid && $view_content->getVar('content_dohits') != false) {
作者:redmexic
项目:XoopsCor
if ($user_type == 'inactv') {
$criteria->add(new Criteria('level', 0, '='));
} elseif ($user_type == "actv") {
$criteria->add(new Criteria('level', 0, '>'));
}
$requete_search .= 'actif ou inactif : ' . $user_type . '<br />';
$requete_pagenav .= '&user_type=' . $user_type;
}
//$groups = empty($_REQUEST['selgroups']) ? array() : array_map("intval", $_REQUEST['selgroups']);
$validsort = array("uname", "email", "last_login", "user_regdate", "posts");
$sort = (string) Request::getWord('user_sort', 'user_regdate');
$sort = !in_array($sort, $validsort) ? "user_regdate" : $sort;
$requete_pagenav .= '&user_sort=' . $sort;
$requete_search .= 'order by : ' . $sort . '<br />';
$criteria->setSort($sort);
$order = (string) Request::getWord('user_order', 'DESC');
$requete_pagenav .= '&user_order=' . $order;
$requete_search .= 'tris : ' . $order . '<br />';
$criteria->setOrder($order);
$user_limit = $xoops->getModuleConfig('users_pager', 'system');
if (isset($_REQUEST['user_limit'])) {
$user_limit = $_REQUEST['user_limit'];
$requete_pagenav .= '&user_limit=' . htmlspecialchars($_REQUEST['user_limit']);
$requete_search .= 'limit : ' . $user_limit . '<br />';
} else {
$requete_pagenav .= '&user_limit=' . $xoops->getModuleConfig('users_pager', 'system');
$requete_search .= 'limit : ' . $user_limit . '<br />';
}
$start = !empty($_REQUEST['start']) ? (int) $_REQUEST['start'] : 0;
if (isset($_REQUEST['selgroups'])) {
if ($_REQUEST['selgroups'] != 0) {