Exemplo n.º 1
0
    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;
    }
Exemplo n.º 2
0
 /**
  * @covers Xoops\Core\Request::getInt
  */
 public function testGetInt()
 {
     $varname = 'RequestTest';
     $_REQUEST[$varname] = '9';
     $this->assertEquals(9, Request::getInt($varname));
     $_REQUEST[$varname] = '123fred5';
     $this->assertEquals(123, Request::getInt($varname));
     $_REQUEST[$varname] = '-123.45';
     $this->assertEquals(-123, Request::getInt($varname));
     $_REQUEST[$varname] = 'notanumber';
     $this->assertEquals(0, Request::getInt($varname));
     $this->assertEquals(0, Request::getInt($varname . 'no-such-key'));
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
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;
/**
 * @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 <*****@*****.**>
 * @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'));
Exemplo n.º 5
0
 * @subpackage      Action
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @author          Sina Asghari (AKA stranger) <*****@*****.**>
 * @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);
Exemplo n.º 6
0
        }
        echo $obj->getHtmlErrors();
        $form = $xoops->getModuleForm($obj, 'listing');
        $form->display();
        break;
    case 'edit_listing':
        $lid = Request::getInt('lid', 0);
        $listingHandler = $xoops->getModuleHandler('listing', 'alumni');
        $obj = $listingHandler->get($lid);
        $form = $xoops->getModuleForm($obj, 'listing');
        $form->display();
        break;
    case 'delete_listing':
        $listingHandler = $xoops->getModuleHandler('listing', 'alumni');
        $lid = Request::getInt('lid', 0);
        $ok = Request::getInt('ok', 0);
        $obj = $listingHandler->get($lid);
        if ($ok == 1) {
            if (!$xoops->security()->check()) {
                $xoops->redirect('index.php', 3, implode(',', $xoops->security()->getErrors()));
            }
            if ($listingHandler->delete($obj)) {
                $xoops->redirect('index.php', 3, XoopsLocale::S_DATABASE_UPDATED);
            } else {
                echo $xoops->alert('error', $obj->getHtmlErrors());
            }
        } else {
            echo $xoops->confirm(array('ok' => 1, 'lid' => $lid, 'op' => 'delete_listing'), 'listing.php', XoopsLocale::Q_ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_ITEM . '<br /><span class="red">' . $obj->getvar('lname') . '<span>');
        }
        break;
}
Exemplo n.º 7
0
        $xoopsMailer->useMail();
        $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . "/modules/{$moduleDirName}/language/english/mail_template/");
        $xoopsMailer->setTemplate('listing_send_friend.tpl');
        $xoopsMailer->setFromEmail($ymail);
        $xoopsMailer->setToEmails($fmail);
        $xoopsMailer->setSubject($subject);
        //    $xoopsMailer->$xoops->multimailer;
        $xoopsMailer->assign($tags);
        $xoopsMailer->send();
        echo $xoopsMailer->getErrors();
        $xoops->redirect('index.php', 3, AlumniLocale::ALUM_SEND);
        exit;
    }
} else {
    global $xoops;
    $lid = Request::getInt('lid', 0);
    $xoops->header('alumni_sendfriend.tpl');
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    $listingHandler = $xoops->getModuleHandler('listing', 'alumni');
    $listing_2_send = $listingHandler->get($lid);
    $listing_2_send->getVar('name');
    $listing_2_send->getVar('mname');
    $listing_2_send->getVar('lname');
    ob_start();
    $form = new Xoops\Form\ThemeForm(AlumniLocale::SENDTO, 'sendfriend_form', 'sendfriend.php');
    $form->setExtra('enctype="multipart/form-data"');
    //    $GLOBALS['xoopsGTicket']->addTicketXoopsFormElement($form, __LINE__, 1800, 'token');
    $form->addElement(new Xoops\Form\Label(AlumniLocale::LISTING_SEND, $listing_2_send->getVar('name') . ' ' . $listing_2_send->getVar('mname') . ' ' . $listing_2_send->getVar('lname') . ''));
    if ($xoopsUser) {
        $idd = $xoopsUser->getVar('name', 'E');
        $idde = $xoopsUser->getVar('email', 'E');
Exemplo n.º 8
0
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) {
Exemplo n.º 9
0
function publisher_editCat($showmenu = false, $categoryid = 0, $nb_subcats = 4, $categoryObj = null)
{
    $xoops = Xoops::getInstance();
    $publisher = Publisher::getInstance();
    /* @var $categoryObj PublisherCategory */
    // if there is a parameter, and the id exists, retrieve data: we're editing a category
    if ($categoryid != 0) {
        // Creating the category object for the selected category
        $categoryObj = $publisher->getCategoryHandler()->get($categoryid);
        if ($categoryObj->notLoaded()) {
            $xoops->redirect("category.php", 1, _AM_PUBLISHER_NOCOLTOEDIT);
        }
    } else {
        if (!$categoryObj) {
            $categoryObj = $publisher->getCategoryHandler()->create();
        }
    }
    if ($categoryid != 0) {
        if ($showmenu) {
            //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES . " > " . _AM_PUBLISHER_EDITING);
        }
        echo "<br />\n";
        PublisherUtils::openCollapsableBar('edittable', 'edittableicon', _AM_PUBLISHER_EDITCOL, _AM_PUBLISHER_CATEGORY_EDIT_INFO);
    } else {
        if ($showmenu) {
            //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES . " > " . _AM_PUBLISHER_CREATINGNEW);
        }
        PublisherUtils::openCollapsableBar('createtable', 'createtableicon', _AM_PUBLISHER_CATEGORY_CREATE, _AM_PUBLISHER_CATEGORY_CREATE_INFO);
    }
    /* @var $sform PublisherCategoryForm */
    $sform = $publisher->getForm($categoryObj, 'category');
    $sform->setSubCatsCount($nb_subcats);
    $sform->display();
    if (!$categoryid) {
        PublisherUtils::closeCollapsableBar('createtable', 'createtableicon');
    } else {
        PublisherUtils::closeCollapsableBar('edittable', 'edittableicon');
    }
    //Added by fx2024
    if ($categoryid) {
        $sel_cat = $categoryid;
        PublisherUtils::openCollapsableBar('subcatstable', 'subcatsicon', _AM_PUBLISHER_SUBCAT_CAT, _AM_PUBLISHER_SUBCAT_CAT_DSC);
        // Get the total number of sub-categories
        $categoriesObj = $publisher->getCategoryHandler()->get($sel_cat);
        $totalsubs = $publisher->getCategoryHandler()->getCategoriesCount($sel_cat);
        // creating the categories objects that are published
        $subcatsObj = $publisher->getCategoryHandler()->getCategories(0, 0, $categoriesObj->getVar('categoryid'));
        echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
        echo "<tr>";
        echo "<td width='60' class='bg3' align='left'><strong>" . _AM_PUBLISHER_CATID . "</strong></td>";
        echo "<td width='20%' class='bg3' align='left'><strong>" . _AM_PUBLISHER_CATCOLNAME . "</strong></td>";
        echo "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_SUBDESCRIPT . "</strong></td>";
        echo "<td width='60' class='bg3' align='right'><strong>" . _AM_PUBLISHER_ACTION . "</strong></td>";
        echo "</tr>";
        if ($totalsubs > 0) {
            /* @var $subcat PublisherCategory */
            foreach ($subcatsObj as $subcat) {
                $modify = "<a href='category.php?op=mod&amp;categoryid=" . $subcat->getVar('categoryid') . "'><img src='" . \XoopsBaseConfig::get('url') . "/modules/" . $publisher->getModule()->dirname() . "/images/links/edit.gif' title='" . _AM_PUBLISHER_MODIFY . "' alt='" . _AM_PUBLISHER_MODIFY . "' /></a>";
                $delete = "<a href='category.php?op=del&amp;categoryid=" . $subcat->getVar('categoryid') . "'><img src='" . \XoopsBaseConfig::get('url') . "/modules/" . $publisher->getModule()->dirname() . "/images/links/delete.png' title='" . _AM_PUBLISHER_DELETE . "' alt='" . _AM_PUBLISHER_DELETE . "' /></a>";
                echo "<tr>";
                echo "<td class='head' align='left'>" . $subcat->getVar('categoryid') . "</td>";
                echo "<td class='even' align='left'><a href='" . \XoopsBaseConfig::get('url') . "/modules/" . $publisher->getModule()->dirname() . "/category.php?categoryid=" . $subcat->getVar('categoryid') . "&amp;parentid=" . $subcat->getVar('parentid') . "'>" . $subcat->getVar('name') . "</a></td>";
                echo "<td class='even' align='left'>" . $subcat->getVar('description') . "</td>";
                echo "<td class='even' align='right'> {$modify} {$delete} </td>";
                echo "</tr>";
            }
        } else {
            echo "<tr>";
            echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOSUBCAT . "</td>";
            echo "</tr>";
        }
        echo "</table>\n";
        echo "<br />\n";
        PublisherUtils::closeCollapsableBar('subcatstable', 'subcatsicon');
        PublisherUtils::openCollapsableBar('bottomtable', 'bottomtableicon', _AM_PUBLISHER_CAT_ITEMS, _AM_PUBLISHER_CAT_ITEMS_DSC);
        $startitem = Request::getInt('startitem');
        // Get the total number of published ITEMS
        $totalitems = $publisher->getItemHandler()->getItemsCount($sel_cat, array(_PUBLISHER_STATUS_PUBLISHED));
        // creating the items objects that are published
        $itemsObj = $publisher->getItemHandler()->getAllPublished($publisher->getConfig('idxcat_perpage'), $startitem, $sel_cat);
        $totalitemsOnPage = count($itemsObj);
        $allcats = $publisher->getCategoryHandler()->getObjects(null, true);
        echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
        echo "<tr>";
        echo "<td width='40' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ITEMID . "</strong></td>";
        echo "<td width='20%' class='bg3' align='left'><strong>" . _AM_PUBLISHER_ITEMCOLNAME . "</strong></td>";
        echo "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_ITEMDESC . "</strong></td>";
        echo "<td width='90' class='bg3' align='center'><strong>" . _AM_PUBLISHER_CREATED . "</strong></td>";
        echo "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . "</strong></td>";
        echo "</tr>";
        if ($totalitems > 0) {
            for ($i = 0; $i < $totalitemsOnPage; ++$i) {
                $categoryObj = $allcats[$itemsObj[$i]->getVar('categoryid')];
                $modify = "<a href='item.php?op=mod&amp;itemid=" . $itemsObj[$i]->getVar('itemid') . "'><img src='" . \XoopsBaseConfig::get('url') . "/modules/" . $publisher->getModule()->dirname() . "/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITITEM . "' alt='" . _AM_PUBLISHER_EDITITEM . "' /></a>";
                $delete = "<a href='item.php?op=del&amp;itemid=" . $itemsObj[$i]->getVar('itemid') . "'><img src='" . \XoopsBaseConfig::get('url') . "/modules/" . $publisher->getModule()->dirname() . "/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'/></a>";
                echo "<tr>";
                echo "<td class='head' align='center'>" . $itemsObj[$i]->getVar('itemid') . "</td>";
                echo "<td class='even' align='left'>" . $categoryObj->getVar('name') . "</td>";
                echo "<td class='even' align='left'>" . $itemsObj[$i]->getitemLink() . "</td>";
                echo "<td class='even' align='center'>" . $itemsObj[$i]->datesub('s') . "</td>";
                echo "<td class='even' align='center'> {$modify} {$delete} </td>";
                echo "</tr>";
            }
        } else {
            echo "<tr>";
            echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOITEMS . "</td>";
            echo "</tr>";
        }
        echo "</table>\n";
        echo "<br />\n";
        $parentid = Request::getInt('parentid');
        $pagenav_extra_args = "op=mod&categoryid={$sel_cat}&parentid={$parentid}";
        $pagenav = new XoopsPageNav($totalitems, $publisher->getConfig('idxcat_perpage'), $startitem, 'startitem', $pagenav_extra_args);
        echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>';
        echo "<input type='button' name='button' onclick=\"location='item.php?op=mod&categoryid=" . $sel_cat . "'\" value='" . _AM_PUBLISHER_CREATEITEM . "'>&nbsp;&nbsp;";
        echo "</div>";
    }
    //end of fx2024 code
}
Exemplo n.º 10
0
 *
 * @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;
        }
Exemplo n.º 11
0
            }
        } 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();
Exemplo n.º 12
0
     break;
     // Send
 // Send
 case 'send':
     $mail_send_to = Request::getArray('mail_send_to', array('mail'));
     $mail_inactive = Request::getInt('mail_inactive', 0);
     $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 {
Exemplo n.º 13
0
 *
 * @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')) {
Exemplo n.º 14
0
         $xoops_upload_url = \XoopsBaseConfig::get('uploads-url');
         $warning_msg .= "<img src='" . $xoops_upload_url . '/' . $oldavatar . "' alt='&nbsp;' />";
         $xoops->tpl()->assign('warning_msg', $xoops->alert('warning', $warning_msg, XoopsLocale::WARNING));
     }
     // Create form
     $obj = $avatar_Handler->create();
     $form = $xoops->getModuleForm($obj, 'avatar_user');
     // Assign form
     $xoops->tpl()->assign('form', $form->render());
     break;
 case "save":
     // Check security
     if (!$xoops->security()->check()) {
         $xoops->redirect('/index.php', 3, implode('<br />', $xoops->security()->getErrors()));
     }
     $uid = Request::getInt('uid', 0);
     if (empty($uid) || $xoops->user->getVar('uid') != $uid) {
         $xoops->redirect('/index.php', 3, XoopsLocale::E_NO_ACCESS_PERMISSION);
         exit;
     }
     $uploader_avatars_img = new XoopsMediaUploader(\XoopsBaseConfig::get('uploads-path') . '/avatars', $mimetypes, $upload_size, $width, $height);
     $obj = $avatar_Handler->create();
     $error_msg = '';
     if ($uploader_avatars_img->fetchMedia('user_avatar')) {
         $uploader_avatars_img->setPrefix('savt');
         $uploader_avatars_img->fetchMedia('user_avatar');
         if (!$uploader_avatars_img->upload()) {
             $error_msg .= $uploader_avatars_img->getErrors();
             $obj->setVar('avatar_file', 'avatars/blank.gif');
         } else {
             $obj->setVar('avatar_name', $xoops->user->getVar('uname'));
Exemplo n.º 15
0
                 }
                 $xoops->redirect('images.php?imgcat_id=' . $imgcat_id, 2, XoopsLocale::S_DATABASE_UPDATED);
             }
         } else {
             $category = $helper->getHandlerCategories()->get($obj->getVar('imgcat_id'));
             if ($category->getVar('imgcat_storetype') == 'db') {
                 $img = \XoopsBaseConfig::get('url') . '/image.php?id=' . $image_id;
             } else {
                 $img = \XoopsBaseConfig::get('uploads-url') . '/' . $obj->getVar('image_name');
             }
             echo $xoops->confirm(array('op' => 'del', 'ok' => 1, 'image_id' => $image_id, 'imgcat_id' => $obj->getVar('imgcat_id')), \XoopsBaseConfig::get('url') . '/modules/images/admin/images.php', sprintf(_AM_IMAGES_IMG_DELETE, $obj->getVar('image_nicename')) . '<br /><br /><img src="' . $img . '" /><br />');
         }
     }
     break;
 case 'display':
     $image_id = Request::getInt('image_id', 0);
     if ($image_id > 0) {
         $obj = $helper->getHandlerImages()->get($image_id);
         $old = $obj->getVar('image_display');
         $obj->setVar('image_display', !$old);
         if (!$helper->getHandlerImages()->insert($obj)) {
             $error = true;
         }
     }
     break;
 case 'list':
 default:
     // Get rights
     $imgcat_write = $gperm_handler->checkRight('imgcat_write', $imgcat_id, $groups, $xoops->module->mid());
     if ($imgcat_write) {
         $admin_page->addItemButton(_AM_IMAGES_IMG_ADD, 'images.php?op=add&imgcat_id=' . $imgcat_id, 'add');
Exemplo n.º 16
0
         }
     }
     break;
 case 'save':
     if (!$xoops->security()->check()) {
         $xoops->redirect('xoops_images.php?imgcat_id=' . $imgcat_id, 3, implode('<br />', $xoops->security()->getErrors()));
     }
     $mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png');
     $msg[] = _AM_IMAGES_IMG_SAVE;
     $category = $helper->getHandlerCategories()->get($imgcat_id);
     $image_id = Request::getInt('image_id', 0);
     $obj = $helper->getHandlerImages()->create();
     $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);
     $xoops_upload_file = Request::getArray('xoops_upload_file', array());
     $uploader = new XoopsMediaUploader(\XoopsBaseConfig::get('uploads-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()) {
             $msg[] = $uploader->getErrors();
             $obj->setVar('image_name', 'blank.gif');
             $obj->setVar('image_mimetype', 'image/gif');
         } else {
             $obj->setVar('image_mimetype', $uploader->getMediaType());
             if ($category->getVar('imgcat_storetype') === 'db') {
                 $fp = @fopen($uploader->getSavedDestination(), 'rb');
                 $fbinary = @fread($fp, filesize($uploader->getSavedDestination()));
                 @fclose($fp);
Exemplo n.º 17
0
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
 * @subpackage      Action
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @author          The SmartFactory <www.smartfactory.ca>
 */
include_once __DIR__ . '/header.php';
$xoops = Xoops::getInstance();
$publisher = Publisher::getInstance();
$fileid = Request::getInt('fileid');
// Creating the item object for the selected item
/* @var $fileObj PublisherFile */
$fileObj = $publisher->getFileHandler()->get($fileid);
if ($fileObj->getVar('status' != _PUBLISHER_STATUS_FILE_ACTIVE)) {
    $xoops->redirect("javascript:history.go(-1)", 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
/* @var $itemObj PublisherItem */
$itemObj = $publisher->getItemHandler()->get($fileObj->getVar('itemid'));
// Check user permissions to access this file
if (!$itemObj->accessGranted()) {
    $xoops->redirect("javascript:history.go(-1)", 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
// Creating the category object that holds the selected ITEM
$categoryObj = $itemObj->category();
$fileObj->updateCounter();
Exemplo n.º 18
0
                        $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();
Exemplo n.º 19
0
$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) {
            $totalcategories = $publisher->getCategoryHandler()->getCategoriesCount(-1);
            if ($totalcategories == 0) {
                $xoops->redirect("category.php?op=mod", 3, _AM_PUBLISHER_NEED_CATEGORY_ITEM);
            }
        }
        PublisherUtils::cpHeader();
        publisher_editItem(true, $itemid, true);
        break;
    case "mod":
        if ($itemid == 0) {
            $totalcategories = $publisher->getCategoryHandler()->getCategoriesCount(-1);
            if ($totalcategories == 0) {
Exemplo n.º 20
0
     // 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);
                 }
             }
         }
     }
Exemplo n.º 21
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
 * @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);
Exemplo n.º 22
0
use Xoops\Core\Request;
/**
 * 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);
        }
Exemplo n.º 23
0
 */
// ######################################################################
// # 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();
Exemplo n.º 24
0
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__ . '/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
Exemplo n.º 25
0
 $value = (int) Request::getInt('user_reg_less', 0);
 if (!empty($value)) {
     $time = time() - 60 * 60 * 24 * $value;
     if ($time > 0) {
         $criteria->add(new Criteria('user_regdate', $time, '>'));
         $requete_pagenav .= '&amp;user_reg_less=' . $value;
         $requete_search .= 'enregistre avant : ' . $value . '<br />';
     }
 }
 $value = (int) Request::getInt('user_posts_more', 0);
 if (!empty($value)) {
     $criteria->add(new Criteria('posts', $value, '>'));
     $requete_pagenav .= '&amp;user_posts_more=' . $value;
     $requete_search .= 'posts plus de : ' . $value . '<br />';
 }
 $value = (int) Request::getInt('user_posts_less', 0);
 if (!empty($value)) {
     $criteria->add(new Criteria('posts', $value, '<'));
     $requete_pagenav .= '&amp;user_posts_less=' . $value;
     $requete_search .= 'post moins de : ' . $value . '<br />';
 }
 $value = Request::getWord('user_mailok', '');
 if (!empty($value) && $value !== 'both') {
     $ok = $value == 'mailok' ? 1 : 0;
     $criteria->add(new Criteria('user_mailok', $ok));
     $requete_pagenav .= '&amp;user_mailok=' . $value;
     $requete_search .= 'accept email : ' . $value . '<br />';
 }
 $user_type = Request::getWord('user_type', '');
 if (!empty($user_type) && $user_type !== 'both') {
     if ($user_type == 'inactv') {
Exemplo n.º 26
0
 /**
  * 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'));
     }
 }
Exemplo n.º 27
0
 * @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);
        }
    } else {
        if ($action === "showallbyuser") {
            if (empty($mid) || empty($uid)) {
                $xoops->redirect("index.php", 1, _MD_SEARCH_PLZENTER);
Exemplo n.º 28
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;
         }
     }
 }
Exemplo n.º 29
0
                $result = $query->execute();
                $xoops->redirect("avatar_custom.php", 2, XoopsLocale::S_ITEM_SAVED);
            } else {
                echo $xoops->alert('error', $obj->getHtmlErrors());
            }
        } else {
            if ($avatar_id > 0) {
                // Define Stylesheet
                $xoops->theme()->addStylesheet('modules/system/css/admin.css');
                $msg = '<div class="spacer"><img src="' . $xoops_upload_url . '/' . $obj->getVar('avatar_file', 's') . '" alt="" /></div><div class="txtcenter bold">' . $obj->getVar('avatar_name', 's') . '</div>' . XoopsLocale::Q_ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_ITEM;
                // Display message
                echo $xoops->confirm(array('ok' => 1, 'op' => 'delete', 'avatar_id' => $avatar_id), 'avatar_custom.php', $msg);
            } else {
                $xoops->redirect('avatar_custom.php', 1, XoopsLocale::E_DATABASE_NOT_UPDATED);
            }
        }
        break;
    case "update_display":
        $avatar_id = Request::getInt('avatar_id', 0);
        if ($avatar_id > 0) {
            $obj = $avatar_Handler->get($avatar_id);
            $old = $obj->getVar('avatar_display');
            $obj->setVar('avatar_display', !$old);
            if ($avatar_Handler->insert($obj)) {
                exit;
            }
            echo $obj->getHtmlErrors();
        }
        break;
}
$xoops->footer();
Exemplo n.º 30
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
use Xoops\Core\Request;
/**
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @author          trabis <*****@*****.**>
 * @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>';