Esempio n. 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);
 }
Esempio n. 2
0
 function push($queryString)
 {
     global $locationHistoryLimit;
     if (!isset($_SESSION["locations"])) {
         LocationHistory::reset();
     }
     if (end($_SESSION["locations"]) !== $queryString && !preg_match("/\\.(css|ico|js|jpg|gif|png)\$/i", $queryString)) {
         array_push($_SESSION["locations"], $queryString);
     }
     if (count($_SESSION["locations"]) > $locationHistoryLimit) {
         array_shift($_SESSION["locations"]);
     }
 }
Esempio n. 3
0
 function makeSearchQueryAdvanced($fromInstall = FALSE)
 {
     global $gorumroll;
     if ($fromInstall) {
         $cid = $this->cid;
     } elseif ($gorumroll->method == "modify") {
         $cid = $this->cid = isset($_POST["cid"]) ? $_POST["cid"] : 0;
     } elseif ($gorumroll->method == "create") {
         $cid = $this->cid = $gorumroll->rollid;
     } else {
         $cid = $this->cid = 0;
     }
     $fields = $this->activateVariableFields();
     // az install soran nem form submit reven hivodik a create - ezert initClassVars-ra nincs szukseg:
     if (!$fromInstall) {
         $this->initClassVars();
         LocationHistory::savePost($this);
     }
     $condition = array();
     if ($word = @quoteSQL($this->str)) {
         if ($cid) {
             $condition[] = "(" . implode(" OR ", $this->getSimpleCustomFieldConditions($word, $cid)) . ")";
         } elseif ($simpleCond = $this->makeSearchQuerySimple()) {
             $condition[] = $simpleCond;
         }
     }
     $condition = array_merge($condition, $this->getAdvancedCustomFieldConditions($fields));
     if ($cid) {
         list($recursive, $wholeName) = G::getAttr($cid, "appcategory", "recursive", "wholeName");
         $cidCond = $recursive ? "wholeName LIKE '" . quoteSQL($wholeName) . "%'" : "cid='" . quoteSQL($cid) . "'";
     } else {
         $cidCond = "";
     }
     if ($this->relationBetweenFields == search_allFields) {
         if ($cid) {
             $condition[] = $cidCond;
         }
         return implode(" AND ", $condition);
     } elseif (count($condition)) {
         if ($cid) {
             return "({$cidCond} AND (" . implode(" OR ", $condition) . "))";
         } else {
             return "(" . implode(" OR ", $condition) . ")";
         }
     } else {
         return $cidCond;
     }
 }
Esempio n. 4
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);
     }
 }
Esempio n. 5
0
 function generForm($elementName = "")
 {
     global $gorumview;
     /* if( !Roll::isPreviousFormSubmitInvalid() )  */
     LocationHistory::resetPost();
     $formPresentationClassName = G::getSetting($this->getTypeInfo(TRUE), "formPresentationClassName");
     $temp =& new $formPresentationClassName($this);
     return $temp->gener($gorumview->addElement($elementName));
 }
Esempio n. 6
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;
     }
 }
Esempio n. 7
0
 /**
  * Gets a location history object with the given parameters
  */
 private function _getLocationHistory($empNum, $subDivisionCode, $locationName, $startDate, $endDate)
 {
     if (!empty($startDate)) {
         $startDate = date(LocaleUtil::STANDARD_TIMESTAMP_FORMAT, strtotime($startDate));
     }
     if (!empty($endDate)) {
         $endDate = date(LocaleUtil::STANDARD_TIMESTAMP_FORMAT, strtotime($endDate));
     }
     $locationHis = new LocationHistory();
     $locationHis->setEmpNumber($empNum);
     $locationHis->setCode($subDivisionCode);
     $locationHis->setName($locationName);
     $locationHis->setStartDate($startDate);
     $locationHis->setEndDate($endDate);
     return $locationHis;
 }
Esempio n. 8
0
 function modifyForm()
 {
     global $gorumroll, $lll;
     $_EC = EComm::createObject();
     $this->id = $gorumroll->rollid;
     LocationHistory::saveGorumCategory($this->getCid());
     $this->activateVariableFields();
     //csak emiatt kellett feluldefinialn
     $this->initClassVars();
     if (!Roll::isPreviousFormSubmitInvalid()) {
         $ret = $this->load();
         if ($ret) {
             $txt = $lll["not_found_in_db"];
             handleError($txt);
         }
         $old =& $this;
     } else {
         G::load($old, $this->id, "item");
     }
     $this->hasObjectRights($hasRight, "modify", TRUE);
     if (isset($this->expirationTime) && !$this->expirationTime->isEmpty()) {
         $this->expiration = round($this->expirationTime->getDayDiff());
         if ($this->expirationTime->isPast()) {
             $this->expiration = "-{$this->expiration}";
         }
     }
     $this->addDeletePictureStuff();
     $this->addDeleteMediaStuff();
     $_EC->confirmRules($this->cid, $old);
     $this->cName = $this->getCatName();
     $this->catPermaLink = $this->getCatPermaLink();
     $this->generForm();
 }
 public function parseEditData($postArr)
 {
     $historyItems = array();
     $empNum = trim($postArr['txtEmpID']);
     // Get job title history
     if (isset($postArr['jobTitleHisId'])) {
         $jobTitleIds = $postArr['jobTitleHisId'];
         $jobTitleCodes = $postArr['jobTitleHisCode'];
         $jobTitleFromDates = $postArr['jobTitleHisFromDate'];
         $jobTitleToDates = $postArr['jobTitleHisToDate'];
         for ($i = 0; $i < count($jobTitleIds); $i++) {
             $history = new JobTitleHistory();
             $id = $jobTitleIds[$i];
             $code = $jobTitleCodes[$i];
             $startDate = LocaleUtil::getInstance()->convertToStandardDateFormat($jobTitleFromDates[$i]);
             $endDate = LocaleUtil::getInstance()->convertToStandardDateFormat($jobTitleToDates[$i]);
             $history->setId($id);
             $history->setCode($code);
             $history->setEmpNumber($empNum);
             $history->setStartDate($startDate);
             $history->setEndDate($endDate);
             $historyItems[] = $history;
         }
     }
     // Get sub division history
     if (isset($postArr['subDivHisId'])) {
         $subDivIds = $postArr['subDivHisId'];
         $subDivCodes = $postArr['subDivHisCode'];
         $subDivFromDates = $postArr['subDivHisFromDate'];
         $subDivToDates = $postArr['subDivHisToDate'];
         for ($i = 0; $i < count($subDivIds); $i++) {
             $history = new SubDivisionHistory();
             $id = $subDivIds[$i];
             $code = $subDivCodes[$i];
             $startDate = LocaleUtil::getInstance()->convertToStandardDateFormat($subDivFromDates[$i]);
             $endDate = LocaleUtil::getInstance()->convertToStandardDateFormat($subDivToDates[$i]);
             $history->setId($id);
             $history->setCode($code);
             $history->setEmpNumber($empNum);
             $history->setStartDate($startDate);
             $history->setEndDate($endDate);
             $historyItems[] = $history;
         }
     }
     // Get location history
     if (isset($postArr['locHisId'])) {
         $locIds = $postArr['locHisId'];
         $locCodes = $postArr['locHisCode'];
         $locFromDates = $postArr['locHisFromDate'];
         $locToDates = $postArr['locHisToDate'];
         for ($i = 0; $i < count($locIds); $i++) {
             $history = new LocationHistory();
             $id = $locIds[$i];
             $startDate = LocaleUtil::getInstance()->convertToStandardDateFormat($locFromDates[$i]);
             $endDate = LocaleUtil::getInstance()->convertToStandardDateFormat($locToDates[$i]);
             $history->setId($id);
             $code = $locCodes[$i];
             $history->setCode($code);
             $history->setEmpNumber($empNum);
             $history->setStartDate($startDate);
             $history->setEndDate($endDate);
             $historyItems[] = $history;
         }
     }
     return $historyItems;
 }
Esempio n. 10
0
 /**
  * Remove given location from employee
  *
  * @param int $empNumber Employee number
  * @param string $locationCode Location code to remove
  *
  * @return boolean true if successfully assigned, false otherwise
  */
 public function removeLocation($empNumber, $locationCode)
 {
     $result = false;
     $auth = new authorize($_SESSION['empID'], $_SESSION['isAdmin']);
     /* Only allow admins and supervisors of the given employee to assign locations */
     if ($auth->isAdmin() || $auth->isSupervisor() && $auth->isTheSupervisor($empNumber)) {
         $empLocation = new EmpLocation($empNumber, $locationCode);
         try {
             $empLocation->delete();
             $result = true;
             $history = new LocationHistory();
             $history->updateHistory($empNumber, $locationCode, true);
         } catch (EmpLocationException $e) {
         }
     }
     return $result;
 }
Esempio n. 11
0
 function showInfoText()
 {
     global $infoText;
     $s = "";
     if (!empty($infoText)) {
         $s = $infoText;
     } else {
         $s = LocationHistory::getInfoText();
     }
     if ($s && is_callable(array("ThemeConfig", "showInfoText"))) {
         ThemeConfig::showInfoText($s);
     }
     return $s;
 }
Esempio n. 12
0
 function create()
 {
     global $gorumuser, $gorumauthlevel;
     $this->activateVariableFields();
     LocationHistory::resetPost();
     $this->initClassVars();
     LocationHistory::savePost($this);
     if (!$this->validRegistration()) {
         return FALSE;
     }
     unset($this->isAdm);
     $this->active = FALSE;
     // Majd az elso bejelentkezes utan lesz true
     $plainPassword = $this->generatePassword();
     $this->setDefaultsOfFieldsThatDontAppearInForm();
     if ($gorumauthlevel == Loginlib_GuestLevel) {
         // don't create a new user, only updating the current
         // nameless user with the newly registered username and
         // password:
         $this->id = $gorumuser->id;
         modify($this);
         if (Roll::isFormInvalid()) {
             return;
         }
     } else {
         if ($gorumauthlevel == Loginlib_BasicLevel || $gorumauthlevel == Loginlib_LowLevel) {
             generateRandomId($randomId);
             $this->id = $randomId;
             create($this);
             if (Roll::isFormInvalid()) {
                 return;
             }
         }
     }
     $this->storeAttachment();
     load($this);
     // hogy a notification minden mezot tartalmazhasson
     $this->sendPassword($plainPassword, Notification_initialPassword, "youWillGetAEmailCheckEmail");
     return $plainPassword;
 }
Esempio n. 13
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"));
 }
Esempio n. 14
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("/"));
}
Esempio n. 15
0
 function sortFieldForm($elementName = "")
 {
     global $gorumroll;
     parent::sortFieldForm($elementName);
     if ($gorumroll->rollid) {
         LocationHistory::saveGorumCategory($gorumroll->rollid);
         $ctrl =& new AppController("fieldset/create_form/{$gorumroll->rollid}");
         $gorumroll->processMethod($ctrl, $elementName);
     }
 }