예제 #1
0
 * @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
 * @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);
예제 #2
0
include __DIR__ . '/header.php';
// Get main instance
$xoops = Xoops::getInstance();
$helper = Avatars::getInstance();
$xoops_upload_path = \XoopsBaseConfig::get('uploads-path');
$xoops_upload_url = \XoopsBaseConfig::get('uploads-url');
// Get avatar handler
$avatar_Handler = $helper->getHandlerAvatar();
// Parameters
$nb_avatars = $helper->getConfig('avatars_pager');
$mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png');
$upload_size = $helper->getConfig('avatars_imagefilesize');
$width = $helper->getConfig('avatars_imagewidth');
$height = $helper->getConfig('avatars_imageheight');
// Get Action type
$op = Request::getCmd('op', 'list');
// Call Header
$xoops->header('admin:avatars/avatars_admin_custom.tpl');
$admin_page = new \Xoops\Module\Admin();
$admin_page->renderNavigation('avatar_custom.php');
$info_msg = array(sprintf(AvatarsLocale::ALERT_INFO_MIMETYPES, implode(", ", $mimetypes)), sprintf(AvatarsLocale::ALERT_INFO_MAXFILE, $upload_size / 1000), sprintf(AvatarsLocale::ALERT_INFO_PIXELS, $width, $height));
switch ($op) {
    case 'list':
    default:
        // Add Scripts
        $xoops->theme()->addScript('media/xoops/xoops.js');
        // Define Stylesheet
        $xoops->theme()->addStylesheet('modules/avatars/css/admin.css');
        $admin_page->addTips(AvatarsLocale::CUSTOM_TIPS);
        $admin_page->renderTips();
        // Get start pager
예제 #3
0
 * @author          Laurent JEN (aka DuGris)
 * @version         $Id$
 */
use Xoops\Core\Request;
$helper = Xoops\Module\Helper::getHelper('xlanguage');
if (!$helper) {
    ob_end_flush();
    return;
}
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');
    $lang = $helper->getHandlerLanguage()->create();
    $lang->CleanVarsForDB();
    if ($helper->getHandlerLanguage()->insert($lang)) {
        $helper->getHandlerLanguage()->createConfig();
        $xoops->redirect('xoops_xlanguage.php', 2, _AM_XLANGUAGE_SAVED);
    }
}
// check user/group
$groups = $xoops->getUserGroups();
$gperm_handler = $xoops->getHandlerGroupPermission();
예제 #4
0
 * User configs
 *
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package         userconfigs
 * @version         $Id$
 */
include dirname(dirname(__DIR__)) . '/mainfile.php';
$xoops = Xoops::getInstance();
$helper = Userconfigs::getInstance();
if (!$xoops->isUser()) {
    $xoops->redirect($xoops->url('index.php'), 3, _MD_USERCONFIGS_NOACCESS);
}
$mid = Request::getInt('mid', 0);
$uid = $xoops->user->getVar('uid');
$op = Request::getCmd('op', 'show');
$xoops->header('module:userconfigs/list.tpl');
$xoops->tpl()->assign('welcome', sprintf(_MD_USERCONFIGS_WELCOME, XoopsUserUtility::getUnameFromId($xoops->user->getVar('uid'), true)));
//Display part
switch ($op) {
    case 'showmod':
        if (!$mid) {
            $xoops->redirect($xoops->url('index.php'), 3, _MD_USERCONFIGS_NOMOD);
        }
        $module = $xoops->getModuleById($mid);
        /* @var $plugin UserconfigsPluginInterface */
        if (!($plugin = \Xoops\Module\Plugin::getPlugin($module->getVar('dirname'), 'userconfigs'))) {
            $xoops->redirect($xoops->url('index.php'), 3, _MD_USERCONFIGS_NOPLUGIN);
        }
        $config_handler = $helper->getHandlerConfig();
        $criteria = new CriteriaCompo();
예제 #5
0
 * @version         $Id$
 */
include __DIR__ . '/mainfile.php';
$xoops = Xoops::getInstance();
$xoops->logger()->quiet();
$xoops_url = \XoopsBaseConfig::get('url');
$xoops_upload_url = \XoopsBaseConfig::get('uploads-url');
$action = Request::getCmd('action', '');
$type = Request::getCmd('type', '');
if ($action == "showpopups") {
    $xoops->simpleHeader(false);
    // show javascript close button?
    $closebutton = 1;
    switch ($type) {
        case "friend":
            $op = Request::getCmd('op', 'sendform');
            $tpl = new XoopsTpl();
            if (!$xoops->security()->check() || $op == "sendform") {
                if ($xoops->isUser()) {
                    $yname = $xoops->user->getVar("uname", 'e');
                    $ymail = $xoops->user->getVar("email", 'e');
                    $fname = "";
                    $fmail = "";
                } else {
                    $yname = "";
                    $ymail = "";
                    $fname = "";
                    $fmail = "";
                }
                $form = new Xoops\Form\ThemeForm(XoopsLocale::RECOMMEND_SITE_TO_FRIEND, 'form_id', 'misc.php', 'post', true);
                $form->addElement(new Xoops\Form\Text(XoopsLocale::C_YOUR_NAME, 'yname', 6, 255, $yname), true);
예제 #6
0
파일: item.php 프로젝트: ming-hai/XoopsCore
*/
use Xoops\Core\Request;
use Xoops\Core\XoopsTpl;
/**
 * @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>
 */
include_once __DIR__ . '/admin_header.php';
$xoops = Xoops::getInstance();
$itemid = Request::getInt('itemid');
$op = $itemid > 0 || isset($_POST['editor']) ? 'mod' : '';
$op = Request::getCmd('op', $op);
if (isset($_POST['additem'])) {
    $op = 'additem';
} else {
    if (isset($_POST['del'])) {
        $op = 'del';
    }
}
// Where shall we start ?
$submittedstartitem = Request::getInt('submittedstartitem');
$publishedstartitem = Request::getInt('publishedstartitem');
$offlinestartitem = Request::getInt('offlinestartitem');
$rejectedstartitem = Request::getInt('rejectedstartitem');
switch ($op) {
    case "clone":
        if ($itemid == 0) {
예제 #7
0
 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 . '&amp;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] . '&amp;';
                         // 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 . '&amp;com_order=' . $order . '&amp;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 . '&amp;com_order=' . $order . '&amp;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;
         }
     }
 }
예제 #8
0
$xoops->loadLanguage('user');
$email = Request::getEmail('email', null, 'GET');
$email = Request::getEmail('email', $email, 'POST');
if (empty($email)) {
    $xoops->redirect("user.php", 2, XoopsLocale::NO_);
    exit;
}
$userHandler = Xoops::getInstance()->getHandlerUser();
$getuser = $userHandler->getObjects(new Criteria('email', $email));
if (empty($getuser)) {
    $msg = XoopsLocale::E_NO_USER_FOUND;
    $xoops->redirect("user.php", 2, $msg);
} else {
    $userObject = $getuser[0];
    // what if there was more than one?
    $code = Request::getCmd('code', '', 'GET');
    $areyou = substr(md5($userObject->getVar("pass")), 0, 5);
    if ($code != '' && $areyou == $code) {
        $newpass = $xoops->makePass();
        $xoopsMailer = $xoops->getMailer();
        $xoopsMailer->useMail();
        $xoopsMailer->setTemplate("lostpass2.tpl");
        $xoopsMailer->assign("SITENAME", $xoops->getConfig('sitename'));
        $xoopsMailer->assign("ADMINMAIL", $xoops->getConfig('adminmail'));
        $xoopsMailer->assign("SITEURL", $xoops_url . "/");
        $xoopsMailer->assign("IP", $_SERVER['REMOTE_ADDR']);
        $xoopsMailer->assign("NEWPWD", $newpass);
        $xoopsMailer->setToUsers($userObject);
        $xoopsMailer->setFromEmail($xoops->getConfig('adminmail'));
        $xoopsMailer->setFromName($xoops->getConfig('sitename'));
        $xoopsMailer->setSubject(sprintf(XoopsLocale::F_NEW_PASSWORD_REQUEST_AT, \XoopsBaseConfig::get('url')));
예제 #9
0
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package         core
 * @since           2.0.0
 */
use Xoops\Core\Request;
include __DIR__ . '/mainfile.php';
$xoops = Xoops::getInstance();
$xoops->preload()->triggerEvent('core.edituser.start');
$xoops->loadLanguage('user');
// If not a user, redirect
if (!$xoops->isUser()) {
    $xoops->redirect('index.php', 3, XoopsLocale::E_NO_ACTION_PERMISSION);
    exit;
}
// initialize $op variable
$op = Request::getCmd('op', 'editprofile');
$myts = \Xoops\Core\Text\Sanitizer::getInstance();
if ($op === 'saveuser') {
    if (!$xoops->security()->check()) {
        $xoops->redirect('index.php', 3, XoopsLocale::E_NO_ACTION_PERMISSION . "<br />" . implode('<br />', $xoops->security()->getErrors()));
        exit;
    }
    $uid = Request::getInt('uid', 0);
    if (empty($uid) || $xoops->user->getVar('uid') != $uid) {
        $xoops->redirect('index.php', 3, XoopsLocale::E_NO_ACTION_PERMISSION);
        exit;
    }
    $errors = array();
    $email = '';
    if ($xoops->getConfig('allow_chgmail') == 1) {
        $email = Request::getString('email', '');
예제 #10
0
 * Template sets Manager
 *
 * @copyright   XOOPS Project (http://xoops.org)
 * @license     GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @author      Maxime Cointin (AKA Kraven30)
 * @package     system
 */
include dirname(dirname(__DIR__)) . '/header.php';
$xoops = Xoops::getInstance();
$xoops->logger()->quiet();
if (!$xoops->isUser() || !$xoops->isModule() || !$xoops->user->isAdmin($xoops->module->mid())) {
    exit(XoopsLocale::E_NO_ACCESS_PERMISSION);
}
include_once $xoops->path('modules/system/functions.php');
$xoops->loadLocale('system');
$op = Request::getCmd('op', 'default');
switch ($op) {
    // Display tree folder
    case "tpls_display_folder":
        $_REQUEST['dir'] = urldecode($_REQUEST['dir']);
        $root = \XoopsBaseConfig::get('themes-path');
        if (XoopsLoad::fileExists($root . $_REQUEST['dir'])) {
            $files = scandir($root . $_REQUEST['dir']);
            natcasesort($files);
            if (count($files) > 2) {
                /* The 2 accounts for . and .. */
                echo "<ul class=\"jqueryFileTree\" style=\"display: none;\">";
                // All dirs
                foreach ($files as $file) {
                    if (XoopsLoad::fileExists($root . $_REQUEST['dir'] . $file) && $file !== '.' && $file !== '..' && is_dir($root . $_REQUEST['dir'] . $file)) {
                        //retirer .svn
예제 #11
0
 /**
  * @covers Xoops\Core\Request::getCmd
  */
 public function testGetCmd()
 {
     $varname = 'RequestTest';
     $_REQUEST[$varname] = 'Lorem';
     $this->assertEquals('lorem', Request::getCmd($varname));
     $_REQUEST[$varname] = 'Lorem ipsum 88 59';
     $this->assertEquals('loremipsum8859', Request::getCmd($varname));
     $_REQUEST[$varname] = '.99 Lorem_ipsum @%&';
     $this->assertEquals('.99lorem_ipsum', Request::getCmd($varname), Request::getCmd($varname));
 }