示例#1
0
文件: item.php 项目: alencarmo/OCF
 function getListSelect($retrieveSelectOnly = TRUE, $elementName = "")
 {
     global $item_typ, $gorumroll, $gorumuser, $lll;
     // hogy ne hivodjon meg ketszer foloslegesen a getCount miatt
     // Ha kulonbozo queryStringgel hivjuk, akkor viszont tobbszor is meghivodhat:
     $qs = $gorumroll->ctrl->makeQueryString();
     if (isset($this->select[$qs]) && $retrieveSelectOnly) {
         return $this->select[$qs];
     }
     CustomField::addCustomColumns("item");
     // Az adott user altal birtokolt itemek:
     if ($gorumroll->list == "item_my") {
         $owner = new User();
         $owner->name = $gorumroll->rollid;
         $userId = load($owner, array("name")) ? 0 : $owner->id;
         $search = new CustomList();
         $search->activateVariableFields();
         // az 2-es ID-ju custom list a 'My ads':
         loadSQL($search, "SELECT * FROM @search WHERE id=2");
         $search->setupCustomListAppearance($elementName);
         // mas hirdeteseibol csak az aktivakat lathatjuk:
         hasAdminRights($isAdm);
         if (!$isAdm && $userId != $gorumuser->id) {
             $search->query .= " AND status=1";
         }
         $this->select[$qs] = str_replace('#gorumuser#', $userId, $search->query);
         $lll["item_my_ttitle"] = sprintf($lll["item_my_ttitle"], $owner->showListVal("name"));
         $this->pageTitle = $this->pageDescription = strip_tags($lll["item_my_ttitle"]);
     } elseif ($gorumroll->list == "item_search" || $gorumroll->list == "export") {
         // normal search eseten, az 1-es ID-ju customlistet kell lekernunk:
         $clId = $gorumroll->rollid ? $gorumroll->rollid : 1;
         $search = new CustomList();
         $search->activateVariableFields();
         if (!loadSQL($search, array("SELECT * FROM @search WHERE id=#id#", $clId))) {
             $search->setupCustomListAppearance($elementName);
         } else {
             Roll::setInfoText("listNotFound");
             LocationHistory::saveInfoText();
             LocationHistory::rollBack(new AppController("/"));
         }
         if ($clId == 1) {
             loadSQL($search = new Search(), array("SELECT * FROM @search WHERE uid=#uid# AND name=''", $gorumuser->id));
             $this->activateVariableFields();
             if ($specialSortAttrs = $this->getSpecialSortAttrs($search->cid ? 0 : 1, $search->cid)) {
                 $search->query = str_replace("n.*", "n.* {$specialSortAttrs}", $search->query);
             }
         } else {
             $this->pageTitle = $search->listTitle;
             $this->pageDescription = $search->listDescription;
             $search->applyCategoryFilterToSearchQuery();
         }
         $this->select[$qs] = array($search->query, $gorumuser->id);
     } elseif ($gorumroll->list == "item_favorities") {
         $this->activateVariableFields();
         $this->select[$qs] = array("SELECT n.*, c.wholeName AS cName, " . "c.immediateAppear AS immediateAppear, c.permaLink AS catPermaLink " . "FROM @item AS n, @category AS c " . "WHERE c.id=n.cid AND FIND_IN_SET(n.id, #favorities#)!=0", $gorumuser->favorities);
     } else {
         list($recursive, $wholeName) = G::getAttr($gorumroll->rollid, "appcategory", "recursive", "wholeName");
         $userQueryPieces = ItemField::getUserQueryPieces($gorumroll->rollid);
         $cidCond = $recursive ? "wholeName LIKE '" . quoteSQL($wholeName) . "%'" : "cid='" . quoteSQL($gorumroll->rollid) . "'";
         $this->select[$qs] = "SELECT n.* " . $this->getSpecialSortAttrs(0, $gorumroll->rollid) . ", c.wholeName AS cName, c.permaLink AS catPermaLink, " . "c.immediateAppear AS immediateAppear {$userQueryPieces['as']} FROM @item AS n, @category AS c {$userQueryPieces['from']} " . "WHERE {$userQueryPieces['where']} {$cidCond} AND c.id=n.cid AND n.status='1'";
     }
     return $this->select[$qs];
 }
示例#2
0
文件: roll.php 项目: alencarmo/OCF
 function checkForPostMaxSizeError()
 {
     if (!isset($_SERVER['CONTENT_LENGTH'])) {
         return;
     }
     $POST_MAX_SIZE = byteStr2num(ini_get('post_max_size'));
     if ($POST_MAX_SIZE && $_SERVER['CONTENT_LENGTH'] > $POST_MAX_SIZE) {
         Roll::setFormInvalid("postMaxSizeExceeded", $POST_MAX_SIZE);
         LocationHistory::saveInfoText();
         LocationHistory::rollBack(2);
     }
 }
示例#3
0
function logout($noLocation = FALSE)
{
    global $cookiePath, $gorumuser;
    if ($_COOKIE["globalUserId"]) {
        setcookie("globalUserId", "", Loginlib_ExpirationDate, $cookiePath);
    }
    if ($_COOKIE["sessionUserId"]) {
        setcookie("sessionUserId", "", 0, $cookiePath);
    }
    if ($_COOKIE["usrPassword"]) {
        setcookie("usrPassword", "", Loginlib_ExpirationDate, $cookiePath);
    }
    $_COOKIE["globalUserId"] = 0;
    $_COOKIE["sessionUserId"] = 0;
    $_COOKIE["usrPassword"] = 0;
    Roll::setInfoText("goodbye", $gorumuser->name);
    LocationHistory::saveInfoText();
    $gorumuser->isAdm = FALSE;
    LocationHistory::rollBack(new AppController("/"));
}