Example #1
0
 function showHtmlList()
 {
     global $lll;
     $_S =& new AppSettings();
     hasAdminRights($isAdm);
     if (!$isAdm) {
         LocationHistory::rollBack(new AppController("/"));
     }
     JavaScript::addCss(CSS_DIR . "/category.css");
     $catArr = array();
     $adminsettCtrl =& new AppController("settings/modify_form");
     $contentManagementCtrl =& new AppController("content/modify_form");
     $usersCtrl =& new AppController("user/list");
     $NotificationsCtrl =& new AppController("notification/list");
     $checkconfCtrl =& new AppController("checkconf/show");
     $checkUpdatesCtrl =& new AppController("checkconf/updates");
     $customListsCtrl =& new AppController("customlist/list");
     $rssCtrl =& new AppController("rss/modify_form/1");
     $purchaseItemCtrl =& new AppController("purchaseitem/sortfield_form");
     $pendingPurchaseItemsCtrl =& new AppController("purchaseitem/list");
     $ecommSettingsCtrl =& new AppController("ecommsettings/modify_form");
     $creditRulesCtrl =& new AppController("creditrule/list");
     $paymentRulesCtrl =& new AppController("paymentrule/list");
     $subscription_ttitleCtrl =& new AppController("subscription/list");
     $itemfield_ttitle_globalCtrl =& new AppController("field/sortfield_form/0");
     $items = array("adminsett", "contentManagement", "users", "Notifications", "customLists", "itemfield_ttitle_global", "checkUpdates");
     if (class_exists("rss")) {
         $items[] = "rss";
     }
     if ($_S->subscriptionType) {
         $items[] = "subscription_ttitle";
     }
     if ($_S->ecommerceEnabled()) {
         $_ES =& new ECommSettings();
         $items[] = "ecommSettings";
         if ($_ES->model == ecomm_advanced) {
             $items[] = "creditRules";
             $items[] = "purchaseItem";
         } else {
             $items[] = "paymentRules";
             $items[] = "pendingPurchaseItems";
         }
     }
     $i = 0;
     foreach ($items as $item) {
         $catArr[$i]->title = $lll[$item];
         $catArr[$i]->description = $lll["{$item}Description"];
         $catArr[$i]->link = ${$item . "Ctrl"}->makeUrl();
         $catArr[$i]->picture = "";
         $catArr[$i]->title = $lll[$item];
         $i++;
     }
     View::assign("categories", $catArr);
 }
Example #2
0
 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);
     }
 }
Example #3
0
 function doUpdate()
 {
     global $gorumroll, $gorumuser, $noahsUpdateScript, $noahsHost;
     ini_set("max_execution_time", 0);
     hasAdminRights($isAdm);
     if (!$isAdm) {
         LocationHistory::rollBack(new AppController("/"));
     }
     $_GS = new GlobalStat();
     if (!$_GS->reg) {
         $_GS->reg = md5(uniqid(rand(), true));
     }
     $data = "id=" . $_GS->reg;
     $data .= "&version=" . urlencode($_GS->instver);
     if (isset($_POST["automatic"])) {
         if (($result = $this->getVersionInfo($noahsHost, "POST", $noahsUpdateScript, $data)) === FALSE) {
             Roll::setInfoText("unableToConnectNoah");
         } else {
             $result = explode("Data-Start:", $result);
             eval($result[1]);
             if ($latestVersion != $_GS->instver) {
                 $f = fopen("u.php", "w");
                 if (!$f) {
                     Roll::setInfoText("updateFailed");
                 } else {
                     fwrite($f, $updateFile);
                     fclose($f);
                     include_once NOAH_BASE . "/u.php";
                 }
             }
         }
         $this->nextAction =& new AppController("checkconf/updates");
     } else {
         ob_start();
         if (($fp = @fsockopen($noahsHost, 80, $errno, $errstr, 20)) === FALSE || $errno) {
             Roll::setInfoText("unableToConnectNoah");
             $this->nextAction =& new AppController("checkconf/updates");
             while (@ob_end_clean()) {
             }
             // clears all output buffers
             return;
             // unable to connect
         }
         $branch = $this->getBranch();
         $source = "update-from-{$_GS->instver}-{$branch}." . (isset($_POST["manualZip"]) ? "zip" : "tgz");
         $path = "/versioninfo/get_file.php";
         $data .= "&file=" . urlencode($source);
         fputs($fp, "POST {$path} HTTP/1.1\r\n");
         fputs($fp, "Host: {$noahsHost}\r\n");
         fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
         fputs($fp, "Content-length: " . strlen($data) . "\r\n");
         fputs($fp, "Connection: close\r\n\r\n");
         fputs($fp, $data);
         if (feof($fp) || ($size = $this->getChunkSize($fp)) <= 3) {
             Roll::setInfoText("downloadFileNotExists", $source);
             $this->nextAction =& new AppController("checkconf/updates");
             while (@ob_end_clean()) {
             }
             // clears all output buffers
             return FALSE;
             // not exists
         }
         while (@ob_end_clean()) {
         }
         // clears all output buffers
         //filenames in IE containing dots will screw up the
         //filename unless we add this
         if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
             $source = preg_replace('/\\./', '%2e', $source, substr_count($source, '.') - 1);
         }
         // required for IE, otherwise Content-disposition is ignored
         if (ini_get('zlib.output_compression')) {
             ini_set('zlib.output_compression', 'Off');
         }
         header("Pragma: public");
         header("Expires: 0");
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         header("Cache-Control: private", false);
         header("Content-Description: File Download");
         header("Content-type: application/download");
         header("Content-Disposition: attachment; filename=\"{$source}\"");
         header("Content-Transfer-Encoding: binary");
         header("Content-Length: {$size}");
         while ($size > 0 && !feof($fp)) {
             $length = min(1024, $size);
             if ($buf = fgets($fp, $length)) {
                 echo $buf;
             } else {
                 break;
             }
             flush();
             $size -= strlen($buf);
         }
         fclose($fp);
         die;
     }
 }
Example #4
0
 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];
 }
Example #5
0
 function organizeAlternative()
 {
     ini_set("max_execution_time", 0);
     $ao = empty($_POST["alternativeOrganizer"]) ? 0 : 1;
     executeQuery("UPDATE @settings SET alternativeOrganizer={$ao}");
     $cats = array();
     foreach ($_POST["up"] as $id => $up) {
         $cat = array('id' => $id, 'up' => $up, 'name' => $_POST["name"][$id], 'oldUp' => $_POST["oldUp"][$id], 'sortId' => $_POST["sortId"][$id]);
         if (isset($cats[$up])) {
             $cats[$up][] = $cat;
         } else {
             $cats[$up] = array($cat);
         }
     }
     foreach ($cats as $up => $level) {
         usort($cats[$up], create_function('$a, $b', 'return $a["sortId"]<$b["sortId"] ? -1 : 1;'));
     }
     //FP::log($cats, "Cats");
     $modifiedTree = array("count" => count($_POST["up"]), "firstIndex" => "0", "items" => array());
     foreach ($cats[0] as $cat) {
         $this->addToModifiedTree($modifiedTree['items'], $cats, $cat);
     }
     //FP::log($modifiedTree, "modifiedTree");
     $hierarchyChanged = FALSE;
     $sortId = 100;
     $firstIndex = 0;
     $cidsInBlocksSoFar = array();
     $this->updateOrderIter($modifiedTree, $sortId, $firstIndex, $hierarchyChanged, $cidsInBlocksSoFar);
     if ($hierarchyChanged) {
         $this->recalculateAllItemNums(TRUE);
     }
     LocationHistory::rollBack(new AppController("cat/organize_form/alternative"));
 }
Example #6
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("/"));
}