Ejemplo n.º 1
0
 function modify()
 {
     global $lll, $siteDemo, $allowedMethods;
     $found = FALSE;
     if ($siteDemo || !class_exists('rss')) {
         // It is disabled to save these attributes in the demo version:
         foreach (array("extraHead", "extraBody", "extraTopContent", "extraBottomContent", "extraFooter", "logoImage", "headerBackground") as $attr) {
             if (!empty($this->{$attr})) {
                 $found = TRUE;
                 $this->{$attr} = "";
             }
         }
     }
     foreach (array("homeLocation", "redirectFirstLogin", "redirectLogin", "redirectAdminLogin") as $attr) {
         $ctrl = new AppController();
         if ($this->{$attr}) {
             if (!$ctrl->init($this->{$attr}) || !isset($allowedMethods[$ctrl->method]) || !class_exists($ctrl->getClass())) {
                 return Roll::setFormInvalid("invalidInternalLink", $this->{$attr});
             }
         }
     }
     modify($this);
     $this->uploadImages();
     if ($found) {
         Roll::setInfoText("This feature is not available in the Lite (and demo) version of the program!");
     }
 }
Ejemplo n.º 2
0
 function create()
 {
     if (!$this->cid || !class_exists("response")) {
         return;
     }
     // ha veletlenul
     $this->nextAction =& new AppController("field/sortfield_form/{$this->cid}");
     ini_set("max_execution_time", 0);
     if ($this->deleteAll) {
         $this->deleteAll();
         $label = "deleteAll";
     } elseif ($this->cloneToSubcats) {
         $this->cloneToSubcats($this->getFields());
         $label = "cloneToSubcats";
     } elseif ($this->cloneToCats) {
         $this->cloneToCats($this->getFields());
         $label = "cloneToCats";
     } elseif ($this->cloneFromCat) {
         // visszavezetjuk az elozore:
         $this->cloneToCats = array($this->cid);
         $this->cloneToCats($this->getFields('cloneFromCat'));
         $label = "cloneFromCat";
     } else {
         return;
     }
     Roll::setInfoText("fieldset_{$label}_successful");
 }
Ejemplo n.º 3
0
 function create()
 {
     global $gorumuser, $search_typ;
     // a search nem mukodik cookie-k nelkul:
     if (!isset($_COOKIE["globalUserId"])) {
         return;
     }
     // eloszor kitoroljuk, ha mar letezik:
     $this->uid = $gorumuser->id;
     executeQuery(array("DELETE FROM @search WHERE uid=#uid# AND name=''", $this->uid));
     // TODO: valid
     $this->makeSearchQuery();
     unset($search_typ["attributes"]["creationtime"]);
     //var_dump($this);die();
     parent::create();
     $this->nextAction =& new AppController($this->getManagedTable() . "_search/list");
     Roll::setInfoText("");
 }
Ejemplo n.º 4
0
 function create()
 {
     global $siteDemo;
     ini_set("max_execution_time", 0);
     hasAdminRights($isAdm);
     if ($siteDemo) {
         Roll::setInfoText("Cloning is disabled in the site demo!");
     }
     if (!$isAdm || $siteDemo) {
         return;
     }
     G::load($category, $this->cid, "appcategory");
     if (empty($this->amount)) {
         $this->amount = 0;
     }
     $sortId = $category->sortId;
     for ($i = 1; $i <= $this->amount; $i++) {
         $category->name = sprintf($this->name, $i);
         $this->cloneCategory($category, $sortId + $i);
     }
     Roll::setInfoText("categoriesCloned");
     //LocationHistory::rollBack(new AppController("cat/organize_form"));
 }
Ejemplo n.º 5
0
 function delete()
 {
     global $gorumuser, $gorumroll, $gorumrecognised;
     hasAdminRights($isAdm);
     if (!empty($this->id)) {
         if ($isAdm) {
             delete($this);
         }
         // admin delete
     } else {
         $this->cid = $gorumroll->rollid;
         if (!empty($this->email)) {
             $this->unsub = TRUE;
             $this->subscribeAction();
         } elseif ($this->uid) {
             delete($this, array("cid", "uid"));
         } elseif ($gorumrecognised) {
             $this->uid = $gorumuser->id;
             delete($this, array("cid", "uid"));
         }
         $this->rollBackNum = 1;
         Roll::setInfoText("unsubscribed");
     }
 }
Ejemplo n.º 6
0
 function beforeAction(&$base)
 {
     global $lll;
     if (isset($_POST["gsubmit"]) && $_POST["gsubmit"] == $lll["cancel"]) {
         Roll::setInfoText("operation_cancelled");
         LocationHistory::saveInfoText();
         LocationHistory::rollBack(2);
     }
     $base->hasObjectRights($hasRight, $this->method, TRUE);
     LocationHistory::savePost($base);
 }
Ejemplo n.º 7
0
 function setInfoText($method)
 {
     global $lll, $infoText;
     if ($infoText) {
         return;
     }
     if (isset($lll[$this->get_class() . "_{$method}_completed"])) {
         Roll::setInfoText($this->get_class() . "_{$method}_completed");
     } elseif (isset($lll[$this->get_class()]) && isset($lll["{$method}_completed"])) {
         Roll::setInfoText("{$method}_completed", $lll[$this->get_class()]);
     }
 }
Ejemplo n.º 8
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;
     }
 }
Ejemplo n.º 9
0
 function recalculateAllItemNums($overridePermission = FALSE)
 {
     if (!$overridePermission) {
         hasAdminRights($isAdm);
         if (!$isAdm) {
             handleErrorPerm(__FILE__, __LINE__);
         }
     }
     $cats = new AppCategory();
     $query = "SELECT * FROM @category WHERE up=0";
     loadObjectsSql($cats, $query, $cats);
     foreach ($cats as $cat) {
         $cat->recalculateAllItemNumsCore();
     }
     Roll::setInfoText("itemNumbersRecalculated");
     $this->nextAction =& new AppController("/");
 }
Ejemplo n.º 10
0
 function deleteExpiredAds()
 {
     hasAdminRights($isAdm);
     if ($isAdm) {
         $count = deleteExpiredAds();
     }
     Roll::setInfoText("{$count} expired ads have been deleted.");
     $this->nextAction =& new AppController("/");
 }
Ejemplo n.º 11
0
 function create_csv($fileName, &$list, &$ads, &$columns)
 {
     global $gorumroll;
     if (!($f = fopen($fileName, "w"))) {
         return Roll::setInfoText($lll["couldntOpenExportFile"]);
     }
     $owner = new User();
     foreach ($ads as $ad) {
         $item = new FeedItem();
         $item->descriptionHtmlSyndicated = TRUE;
         $item->title = $ad->getTitle(FALSE);
         $ctrl = $this->getLinkCtrl($item->title);
         $item->link = $ctrl->makeUrl(TRUE);
         $item->description = $ad->getDescription(FALSE);
         // without htmlspecialchars()
         $item->date = (int) $ad->creationtime->getTimestamp();
         $item->additionalElements = array();
         foreach ($columns as $column) {
             if (isset($ad->{$column->columnIndex})) {
                 if ($column->userField) {
                     $owner->{$column->userColumnIndex} = $ad->{$column->columnIndex};
                     $content = $owner->showListVal($column->userColumnIndex, "", TRUE);
                 } else {
                     $content = $ad->showListVal($column->columnIndex, "", TRUE);
                 }
                 $item->additionalElements[$column->showListVal("name")] = array("html" => $column->allowHtml || $column->type == customfield_url || $column->type == customfield_picture || $column->type == customfield_media || $column->columnIndex == "cName" || $column->userColumnIndex == "email", "content" => $content);
             }
         }
         $ufc->addItem($item);
     }
     $ufc->saveFeed($list->xmlType, $fileName, FALSE);
 }
Ejemplo n.º 12
0
 function delete($includingRelatedCommonFields = TRUE)
 {
     if (load($this)) {
         return;
     }
     // ha mar nem letezik
     parent::delete();
     if ($this->isCommon && $includingRelatedCommonFields) {
         // ha egy common fieldet torlunk, az osszes azonos nevut torolni kell:
         executeQuery("DELETE FROM @customfield WHERE columnIndex=#ci# AND cid!=#cid# AND isCommon=1", $this->columnIndex, $this->cid);
         CacheManager::resetAllCache();
     }
     ItemSearch::deleteColumn($this);
     getDbCount($count, "SELECT COUNT(*) FROM @search WHERE uid=0");
     if ($count) {
         Roll::setInfoText("checkCustomLists");
         $this->nextAction =& new AppController("customlist/list");
     }
 }
Ejemplo n.º 13
0
function getAncestors(&$base, &$ancestors, $rootId = 0, $withOwn = 0)
{
    global $connectionLink;
    static $deep = 0;
    if ($deep == 0) {
        $ancestors = array();
    }
    if (!isset($base->up)) {
        handleError("up not set in getAncestors!");
    }
    $deep++;
    if ($deep > 10) {
        //too deep, may be error in structure!!!
        Roll::setInfoText("deep_struct");
        $deep--;
        return deep_struct;
    }
    if ($withOwn != 0) {
        $ancestors[] = $base;
    }
    if ($base->up == 0 || $base->up == $rootId) {
        $deep--;
        return ok;
    }
    $className = $base->get_class();
    $a = new $className();
    $a->id = $base->up;
    $ret = $a->load();
    if ($ret == not_found_in_db) {
        //up not found, we are on the top
        $deep--;
        Roll::setInfoText("no_father");
        return no_father;
    }
    if ($ret != ok) {
        $deep--;
        return $ret;
    }
    $ancestors[] = $a;
    if ($a->up == 0 || $a->id == $rootId) {
        $deep--;
        return ok;
    }
    $ret = getAncestors($a, $ancestors, $rootId);
    $deep--;
    return $ret;
}
Ejemplo n.º 14
0
 function changeAdmStatus()
 {
     hasAdminRights($isAdm);
     if (!$isAdm) {
         handleErrorPerm(__FILE__, __LINE__);
     }
     load($this);
     $this->isAdm = $this->isAdm ? FALSE : TRUE;
     modify($this);
     Roll::setInfoText("admstatchanged");
 }
Ejemplo n.º 15
0
 function organizeForm()
 {
     global $gorumroll, $lll, $jQueryLib, $curvyCorners, $lll, $siteDemo, $paginateCategoryOrganizerFromNumberOfCats, $infoText;
     hasAdminRights($isAdm);
     if (!$isAdm) {
         handleErrorPerm(__FILE__, __LINE__);
     }
     if (!class_exists('rss')) {
         return;
     }
     $_S =& new AppSettings();
     if ($gorumroll->rollid === "alternative" || $_S->alternativeOrganizer) {
         $this->organizeFormAlternative();
         return;
     }
     JavaScript::addInclude(GORUM_JS_DIR . $jQueryLib);
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/interface/iutil.js");
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/interface/idrag.js");
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/interface/idrop.js");
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/interface/isortables.js");
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/inestedsortable.js");
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.nestedsortablewidget.js");
     JavaScript::addCss(CSS_DIR . "/nestedsortablewidget.css");
     JavaScript::addCss(CSS_DIR . "/checkconf.css");
     if (!empty($curvyCorners)) {
         if ($infoText && !$siteDemo) {
             Roll::setInfoText("useDragAndDrop");
         } elseif ($siteDemo) {
             Roll::setInfoText("Use drag-and-drop to reorganize the categories!");
         }
     } else {
         Roll::setInfoText("");
     }
     if ($this->getCategoryCount() > $paginateCategoryOrganizerFromNumberOfCats) {
         $paginate = ", paginate: true, itemsPerPage: {$paginateCategoryOrganizerFromNumberOfCats}";
     } else {
         $paginate = "";
     }
     JavaScript::addOnload("\n        \$('#organize_widget').NestedSortableWidget({\n            loadUrl: '{$_SERVER['PHP_SELF']}',\n            loadUrlParams: {list: 'appcategory', method: 'get_json_tree'},\n            loadRequestType: 'POST',\n            saveUrl: 'index.php',\n            saveUrlParams: {list: 'appcategory', method: 'organize'},\n            colsWidth: [200,80,80,100],\n            padding: [4, 5, 4, 10],\n            whiteMargin: 1,\n            fadeOutHover: false,\n            onLoad: function(){\n                \$('.nsw-save-progress-wrap').eq(1).hide();\n            },\n            text: {\n                saveButton: '{$lll['organizeSaveButton']}',\n                saveMessage: '{$lll['organizeSaveMessage']}',\n                saveError: '{$lll['organizeSaveError']}',\n                nextPageDrop: '{$lll['organizeNextPageDrop']}',\n                previousPageDrop: '{$lll['organizePreviousPageDrop']}',\n                nextItems: '{$lll['organizeNextItems']}',\n                previousItems: '{$lll['organizePreviousItems']}',\n                loadError: '{$lll['organizeLoadError']}'\n            }\n            {$paginate}\n        });\n    ");
 }
Ejemplo n.º 16
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("/"));
}
Ejemplo n.º 17
0
 function modifyForm()
 {
     global $gorumroll, $customfield_typ;
     $this->id = $gorumroll->rollid;
     if (!Roll::isPreviousFormSubmitInvalid()) {
         if ($this->load()) {
             handleErrorNotFound($this, __FILE__, __LINE__);
         }
     }
     $this->hasObjectRights($hasRight, "modify", TRUE);
     $this->initializeMultipleSelectionFieldsAndDefaults();
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/json.js");
     JavaScript::addInclude(JS_DIR . "/propagate.js");
     JavaScript::addOnload('$.noah.submitOptionValueModificationStack();');
     if ($this->isFixField()) {
         $customfield_typ["attributes"]["values"][] = "form invisible";
     }
     $this->generForm();
     if ($this->isFixField()) {
         Roll::setInfoText("customfield_fixInfoText");
     }
 }
Ejemplo n.º 18
0
 function create()
 {
     global $gorumroll;
     $class = strstr($gorumroll->list, "user") ? "user" : "item";
     $this->valid();
     if (Roll::isFormInvalid()) {
         return;
     }
     if (!preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$/i', $this->youremail) || !preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$/i', $this->friendsemail)) {
         return Roll::setFormInvalid("invalidEmail");
     }
     G::load($n, Notification_adToAFriend, "notification");
     if ($n->active) {
         $obj = new $class();
         $obj->id = $gorumroll->rollid;
         $obj->getEmailParams($params);
         $params["message"] = $this->mess;
         $params["name"] = $this->yourname;
         $sp = new SendingParameters();
         $sp->to = $this->friendsemail;
         $sp->from = $this->youremail;
         $sp->replyTo = $this->youremail;
         $sp->replyToName = $this->yourname;
         $n->send($sp, $params);
     }
     //TODO: respnum increase
     Roll::setInfoText("mail_fr_sent_{$class}");
 }