public function profile($template = "default", $user_id = false) { if (!$template) { $template = "default"; } list($template_block, $template_bad_user_block) = def_module::loadTemplates("users/profile/" . $template, "profile_block", "bad_user_block"); $block_arr = array(); if (!$user_id) { $user_id = (int) getRequest('param0'); } if (!$user_id) { $permissions = permissionsCollection::getInstance(); if ($permissions->isAuth()) { $user_id = $permissions->getUserId(); } } if ($user = selector::get('object')->id($user_id)) { $this->validateEntityByTypes($user, array('module' => 'users', 'method' => 'user')); $block_arr['xlink:href'] = "uobject://" . $user_id; $userTypeId = $user->getTypeId(); if ($userType = umiObjectTypesCollection::getInstance()->getType($userTypeId)) { $userHierarchyTypeId = $userType->getHierarchyTypeId(); if ($userHierarchyType = umiHierarchyTypesCollection::getInstance()->getType($userHierarchyTypeId)) { if ($userHierarchyType->getName() == "users" && $userHierarchyType->getExt() == "user") { $block_arr['id'] = $user_id; return def_module::parseTemplate($template_block, $block_arr, false, $user_id); } } } } else { throw new publicException(getLabel('error-object-does-not-exist', null, $user_id)); } return def_module::parseTemplate($template_bad_user_block, $block_arr); }
public function guide_items($guide_id = false, $per_page = false, $curr_page = 0) { $this->setDataType("list"); $this->setActionType("modify"); if(!$curr_page) $curr_page = (int) getRequest('p'); if(!$per_page) $per_page = getRequest('per_page_limit'); if(!$per_page) $per_page = $this->per_page; if(!$guide_id) $guide_id = (int) getRequest('param0'); $mode = (string) getRequest('param1'); if($guide = selector::get('object-type')->id($guide_id)) { $this->setHeaderLabel(getLabel('header-data-guide_items') . ' "' . $guide->getName() . '"'); } if($this->ifNotXmlMode()) return $this->doData(); $sel = new selector('objects'); $sel->types('object-type')->id($guide_id); $sel->limit($per_page * $curr_page, $per_page); selectorHelper::detectFilters($sel); if($mode == "do") { $params = array( "type_id" => $guide_id ); $this->saveEditedList("objects", $params); $this->chooseRedirect(); } $this->setDataRange($per_page, $curr_page * $per_page); $data = $this->prepareData($sel->result, "objects"); $this->setData($data, $sel->total); return $this->doData(); }
public function recalcCounts(iUmiHierarchyElement $element) { switch ($element->getMethod()) { case 'topic': $element->messages_count = $this->calculateCount($element, 'message'); $element->last_message = $this->calculateLastMessageId($element); $element->commit(); break; } $element = selector::get('page')->id($element->getRel()); if (!$element) { return false; } if (!defined('DISABLE_SEARCH_REINDEX')) { define('DISABLE_SEARCH_REINDEX', '1'); } switch ($element->getMethod()) { case 'conf': $element->messages_count = $this->calculateCount($element, 'message'); $element->topics_count = $this->calculateCount($element, 'topic'); $element->last_message = $this->calculateLastMessageId($element); $element->commit(); break; case 'topic': $element->messages_count = $this->calculateCount($element, 'message'); $element->last_message = $this->calculateLastMessageId($element); $element->commit(); $this->recalcCounts($element); break; } }
public function normalizeIn($v2063c1608d6e0baf80249c42e2be5804, $v16b2b26000987faccb260b9d39df1269 = false) { $vad5f82e879a9c5d6b5b442eb37e50551 = null; if (is_numeric($v2063c1608d6e0baf80249c42e2be5804)) { $vad5f82e879a9c5d6b5b442eb37e50551 = selector::get('domain')->id($v2063c1608d6e0baf80249c42e2be5804); } else { $vad5f82e879a9c5d6b5b442eb37e50551 = selector::get('domain')->host($v2063c1608d6e0baf80249c42e2be5804); } return $vad5f82e879a9c5d6b5b442eb37e50551 instanceof iDomain ? (int) $vad5f82e879a9c5d6b5b442eb37e50551->getId() : null; }
private static function checkPaymentProps(iUmiObject $object) { if($object->payment_type_id) { $types = umiObjectTypesCollection::getInstance(); $typeObject = selector::get('object')->id($object->payment_type_id); $typeId = $types->getTypeIdByGUID($typeObject->payment_type_guid); if($typeId != $object->getTypeId()) { $object->setTypeId($typeId); $object->commit(); } } }
public static function getClassPrefixByType($v16b2b26000987faccb260b9d39df1269) { static $v0fea6a13c52b4d4725368f24b045ca84 = array(); if (isset($v0fea6a13c52b4d4725368f24b045ca84[$v16b2b26000987faccb260b9d39df1269])) { return $v0fea6a13c52b4d4725368f24b045ca84[$v16b2b26000987faccb260b9d39df1269]; } $v6f65638723a69dfa99474478b83b7b17 = ''; $va8cfde6331bd59eb2ac96f8911c4b666 = selector::get('object')->id($v16b2b26000987faccb260b9d39df1269); if ($va8cfde6331bd59eb2ac96f8911c4b666 instanceof iUmiObject) { if ($va8cfde6331bd59eb2ac96f8911c4b666->class_name) { $v6f65638723a69dfa99474478b83b7b17 = $va8cfde6331bd59eb2ac96f8911c4b666->class_name; } } else { throw new coreException("Can't get class name prefix from object #{$v16b2b26000987faccb260b9d39df1269}"); } return $v0fea6a13c52b4d4725368f24b045ca84[$v16b2b26000987faccb260b9d39df1269] = $v6f65638723a69dfa99474478b83b7b17; }
public function tickets() { $mode = getRequest('param0'); $id = getRequest('param1'); $objects = umiObjectsCollection::getInstance(); $buffer = outputBuffer::current(); $buffer->contentType('text/javascript'); $buffer->option('generation-time', false); $buffer->clear(); $json = new jsonTranslator(); if ($mode == 'create') { $type = selector::get('object-type')->name('content', 'ticket'); $id = $objects->addObject(null, $type->getId()); } if ($id) { $ticket = selector::get('object')->id($id); $this->validateEntityByTypes($ticket, array('module' => 'content', 'method' => 'ticket')); } else { throw new publicException("Wrong params"); } if ($mode == 'delete') { $objects->delObject($id); $buffer->end(); } $ticket->x = (int) getRequest('x'); $ticket->y = (int) getRequest('y'); $ticket->width = (int) getRequest('width'); $ticket->height = (int) getRequest('height'); $ticket->message = $ticket->name = getRequest('message'); $url = getRequest('referer') ? getRequest('referer') : getServer('HTTP_REFERER'); $url = str_replace("%", "%", $url); if ($url) { $ticket->url = $url; } if ($mode == 'create') { $permissions = permissionsCollection::getInstance(); $ticket->user_id = $permissions->getUserId(); } $ticket->commit(); $data = array('id' => $ticket->id); $result = $json->translateToJson($data); $buffer->push($result); $buffer->end(); }
public function __call($vea9f6aca279138c58f705c8d4cb4b8ce, $args) { $vea9f6aca279138c58f705c8d4cb4b8ce = strtolower($vea9f6aca279138c58f705c8d4cb4b8ce); if (in_array($vea9f6aca279138c58f705c8d4cb4b8ce, $this->modes)) { $v2063c1608d6e0baf80249c42e2be5804 = sizeof($args) ? $args[0] : null; if ($v2063c1608d6e0baf80249c42e2be5804 instanceof iUmiEntinty) { $v2063c1608d6e0baf80249c42e2be5804 = $v2063c1608d6e0baf80249c42e2be5804->getId(); } if (isset($this->fieldId)) { $v06e3d36fa30cea095545139854ad1fb9 = selector::get('field')->id($this->fieldId); if ($v6b1a57fa235477758817df3c91158006 = $v06e3d36fa30cea095545139854ad1fb9->getRestrictionId()) { $v3dadfaeb46ec74762b37de11fea7605c = baseRestriction::get($v6b1a57fa235477758817df3c91158006); if ($v3dadfaeb46ec74762b37de11fea7605c instanceof iNormalizeInRestriction) { $v2063c1608d6e0baf80249c42e2be5804 = $v3dadfaeb46ec74762b37de11fea7605c->normalizeIn($v2063c1608d6e0baf80249c42e2be5804); } } if (is_numeric($v2063c1608d6e0baf80249c42e2be5804) && substr($v2063c1608d6e0baf80249c42e2be5804, 0, 1) !== "0") { $v2063c1608d6e0baf80249c42e2be5804 = (double) $v2063c1608d6e0baf80249c42e2be5804; } if ($v06e3d36fa30cea095545139854ad1fb9->getDataType() == 'relation' && is_string($v2063c1608d6e0baf80249c42e2be5804)) { if ($v52eb29c6d8ea0d3a5bb3654f49bbd7c7 = $v06e3d36fa30cea095545139854ad1fb9->getGuideId()) { $v8be74552df93e31bbdd6b36ed74bdb6a = new selector('objects'); $v8be74552df93e31bbdd6b36ed74bdb6a->types('object-type')->id($v52eb29c6d8ea0d3a5bb3654f49bbd7c7); $v8be74552df93e31bbdd6b36ed74bdb6a->where('*')->ilike($v2063c1608d6e0baf80249c42e2be5804); $v2fa47f7c65fec19cc163b195725e3844 = sizeof($v8be74552df93e31bbdd6b36ed74bdb6a->result); if ($v2fa47f7c65fec19cc163b195725e3844 > 0 && $v2fa47f7c65fec19cc163b195725e3844 < 100) { $v2063c1608d6e0baf80249c42e2be5804 = $v8be74552df93e31bbdd6b36ed74bdb6a->result; } } } if ($v06e3d36fa30cea095545139854ad1fb9->getDataType() == 'date' && is_string($v2063c1608d6e0baf80249c42e2be5804)) { $v5fc732311905cb27e82d67f4f6511f7f = new umiDate(); $v5fc732311905cb27e82d67f4f6511f7f->setDateByString(trim($v2063c1608d6e0baf80249c42e2be5804, ' %')); $v2063c1608d6e0baf80249c42e2be5804 = $v5fc732311905cb27e82d67f4f6511f7f->getDateTimeStamp(); } } $this->value = $v2063c1608d6e0baf80249c42e2be5804; $this->mode = $vea9f6aca279138c58f705c8d4cb4b8ce; } else { throw new selectorException("This property doesn't support \"{$vea9f6aca279138c58f705c8d4cb4b8ce}\" method"); } }
/** * Получить текущую валюту * @return iUmiObject текущая валюта */ public function getCurrentCurrency() { static $currency = null; if (!is_null($currency)) { return $currency; } if (permissionsCollection::getInstance()->isAuth()) { $customer = customer::get(); if ($customer->preffered_currency) { $currencyTypeId = umiObjectTypesCollection::getInstance()->getBaseType('emarket', 'currency'); $currency = selector::get('object')->id($customer->preffered_currency); if ($currency->typeId == $currencyTypeId) { return $currency; } } } else { if ($v = (int) getCookie('customer_currency')) { return $currency = selector::get('object')->id($v); } } $guest = umiObjectsCollection::getInstance()->getObjectByGUID('system-guest'); if ($v = $guest->getValue('preffered_currency')) { return $currency = selector::get('object')->id($v); } return $currency = $this->getDefaultCurrency(); }
protected function getLastMessageId($elementId) { $element = selector::get('page')->id($elementId); if ($element) { $lastMessage = $element->last_message; if (sizeof($lastMessage) && false) { $lastMessage = getArrayKey($lastMessage, 0); return $lastMessage instanceof iUmiHierarchyElement ? $lastMessage->id : false; } else { $lastMessage = $this->calculateLastMessageId($element); if ($lastMessage) { if (!defined('DISABLE_SEARCH_REINDEX')) { define('DISABLE_SEARCH_REINDEX', '1'); } $element->last_message = $lastMessage; $element->commit(); return $lastMessage->id; } } } return false; }
public function onOrderDelete(iUmiEventPoint $e) { if ($e->getMode() != 'before') { return; } $object = $e->getRef('object'); if ($object instanceof iUmiObject) { $type = selector::get('object-type')->id($object->getTypeId()); if ($type && $type->getMethod() == 'order') { $order = order::get($object->id); $order->unreserve(); $order->commit(); } } }
/** * Отрисовать покупателя * @param order $order * @return Array */ public function renderOrderCustomer(order $order, $template = 'default') { $customer = selector::get('object')->id($order->customer_id); if ($customer instanceof iUmiObject == false) { throw new publicException(getLabel('error-object-does-not-exist', null, $order->customer_id)); } list($tpl_user, $tpl_guest) = def_module::loadTemplates("emarket/customer/" . $template, "customer_user", "customer_guest"); $objectType = selector::get('object-type')->id($customer->typeId); $tpl = $objectType->getModule() == 'users' ? $tpl_user : $tpl_guest; return def_module::parseTemplate($tpl, array('full:object' => $customer), false, $customer->getId()); }
private static function getClassPrefix($objectTypeId) { static $cache = array(); if (isset($cache[$objectTypeId])) { return $cache[$objectTypeId]; } $objectType = selector::get('object-type')->id($objectTypeId); $prefixes = self::getClassPrefixes(); foreach ($prefixes as $prefix => $conds) { foreach ($conds as $type => $values) { foreach ($values as $value) { if ($type == 'fields' && $objectType->getFieldId($value)) { return $cache[$objectTypeId] = $prefix; } if ($type == 'groups' && $objectType->getFieldsGroupByName($value)) { return $cache[$objectTypeId] = $prefix; } } } } return $cache[$objectTypeId] = ''; }
private function renderOptioned(umiObjectProperty &$property, $template, $showNull = false) { $name = $property->getName(); $title = $property->getTitle(); $value = $property->getValue(); list($tpl_block, $tpl_block_empty, $tpl_item) = self::loadTemplates("data/" . $template, "optioned_block", "optioned_block_empty", "optioned_item"); if (empty($value) && !$showNull) { return $tpl_block_empty; } $items_arr = array(); foreach ($value as $info) { $objectId = getArrayKey($info, 'rel'); $elementId = getArrayKey($info, 'symlink'); $item_arr = array('int' => getArrayKey($info, 'int'), 'float' => getArrayKey($info, 'float'), 'text' => getArrayKey($info, 'text'), 'varchar' => getArrayKey($info, 'varchar'), 'field_name' => $name); if ($objectId) { if ($object = selector::get('object')->id($objectId)) { $item_arr['object-id'] = $object->id; $item_arr['object-name'] = $object->name; } } if ($elementId) { if ($element = selector::get('element')->id($elementId)) { $item_arr['element-id'] = $element->id; $item_arr['element-name'] = $element->name; $item_arr['element-link'] = $element->link; } } $items_arr[] = self::parseTemplate($tpl_item, $item_arr, false, $objectId); } $arr = array('field_id' => $property->getField()->getId(), 'field_name' => $name, 'name' => $name, 'title' => $title, 'subnodes:items' => $items_arr); return self::parseTemplate($tpl_block, $arr); }
public function calendarIndex($v7552cd149af7495ee7d8225974e50f80, $v972bf3f05d14ffbdb817bef60638ff00, $v84cdc76cabf41bd7c961f6ab12f117d8 = false, $v7436f942d5ea836cb84f1bb2527d8286 = false, $v12a055bf01a31369fe81ac35d85c7bc1 = 1, $v66f6181bcb4cff4cd38fbc804a036db6 = 'default') { list($v31912934b8f34be4364cc043cd8a0176, $v4aea309357d3d2b6db2d854df7b2cb21, $v965a7685c914026380d3c7016175e350, $vcd3886ae8293ea7c31578c12fc4e0b8a, $v38d22f83de5454f9463b73ef57e59183) = def_module::loadTemplates("./tpls/calendar/" . $v66f6181bcb4cff4cd38fbc804a036db6, 'calendar', 'week', 'day', 'day_a', 'day_null'); $vb3b32a2d422265cd25c3323ed0157f81 = new selector('pages'); $v7552cd149af7495ee7d8225974e50f80 = def_module::analyzeRequiredPath($v7552cd149af7495ee7d8225974e50f80); if (!$v7552cd149af7495ee7d8225974e50f80) { throw new publicException("Page #{$v7552cd149af7495ee7d8225974e50f80} not found"); } $vb81ca7c0ccaa77e7aa91936ab0070695 = umiHierarchy::getInstance(); $v6301cee35ea764a1e241978f93f01069 = $vb81ca7c0ccaa77e7aa91936ab0070695->getDominantTypeId($v7552cd149af7495ee7d8225974e50f80); if (!$v6301cee35ea764a1e241978f93f01069) { return; } $vb3b32a2d422265cd25c3323ed0157f81->types('object-type')->id($v6301cee35ea764a1e241978f93f01069); $vb3b32a2d422265cd25c3323ed0157f81->where('hierarchy')->page($v7552cd149af7495ee7d8225974e50f80)->childs($v12a055bf01a31369fe81ac35d85c7bc1); try { $v6a992d5529f459a44fee58c733255e86 = new calendarIndex($vb3b32a2d422265cd25c3323ed0157f81); $va0e7b2a565119c0a7ec3126a16016113 = $v6a992d5529f459a44fee58c733255e86->index($v972bf3f05d14ffbdb817bef60638ff00, $v84cdc76cabf41bd7c961f6ab12f117d8, $v7436f942d5ea836cb84f1bb2527d8286); } catch (baseException $ve1671797c52e15f763380b45e841ec32) { throw new publicException($ve1671797c52e15f763380b45e841ec32->getMessage()); } $vae60f11ab51860bdb22794a943335a34 = array(); $v659dfac5417796f5351cb780481795fe = ceil((sizeof($va0e7b2a565119c0a7ec3126a16016113['days']) + $va0e7b2a565119c0a7ec3126a16016113['first-day']) / 7); $vee21496299dbf88355a35db78a7c1e99 = $v659dfac5417796f5351cb780481795fe * 7; $v79f5fae92f4da5d4ad1eddea50cc575c = null; $v8e2dcfd7e7e24b1ca76c1193f645902b = selector::get('page')->id($v7552cd149af7495ee7d8225974e50f80); if ($v8e2dcfd7e7e24b1ca76c1193f645902b) { $v79f5fae92f4da5d4ad1eddea50cc575c = $v8e2dcfd7e7e24b1ca76c1193f645902b->link; } $vd56c863670800e22ac293bb8e275c1a3 = $v6a992d5529f459a44fee58c733255e86->timeStart; for ($v865c0c0b4ab0e063e5caa3387c1a8741 = 0; $v865c0c0b4ab0e063e5caa3387c1a8741 < $v659dfac5417796f5351cb780481795fe; $v865c0c0b4ab0e063e5caa3387c1a8741++) { $v44fdec47036f482b68b748f9d786801b = array(); for ($v363b122c528f54df4a0446b6bab05515 = 0; $v363b122c528f54df4a0446b6bab05515 < 7; $v363b122c528f54df4a0446b6bab05515++) { $vb1bc248a7ff2b2e95569f56de68615df = $v865c0c0b4ab0e063e5caa3387c1a8741 * 7 + $v363b122c528f54df4a0446b6bab05515 - $va0e7b2a565119c0a7ec3126a16016113['first-day'] + 1; if ($vb1bc248a7ff2b2e95569f56de68615df > sizeof($va0e7b2a565119c0a7ec3126a16016113['days']) || $vb1bc248a7ff2b2e95569f56de68615df <= 0) { $vb1bc248a7ff2b2e95569f56de68615df = false; $v4f2afc9c4099ee1f39c9f551123e54bd = $v38d22f83de5454f9463b73ef57e59183; $ve2942a04780e223b215eb8b663cf5353 = 0; } else { $ve2942a04780e223b215eb8b663cf5353 = (int) $va0e7b2a565119c0a7ec3126a16016113['days'][$vb1bc248a7ff2b2e95569f56de68615df]; $v4f2afc9c4099ee1f39c9f551123e54bd = $ve2942a04780e223b215eb8b663cf5353 ? $vcd3886ae8293ea7c31578c12fc4e0b8a : $v965a7685c914026380d3c7016175e350; } $v2a304a1348456ccd2234cd71a81bd338 = null; if ($ve2942a04780e223b215eb8b663cf5353) { $v83f1535f99ab0bf4e9d02dfd85d3e3f7 = $vd56c863670800e22ac293bb8e275c1a3 + 3600 * 24 * ($vb1bc248a7ff2b2e95569f56de68615df - 1); $v0f826a89cf68c399c5f4cf320c1a5842 = $v83f1535f99ab0bf4e9d02dfd85d3e3f7 + 3600 * 24; $v2a304a1348456ccd2234cd71a81bd338 = $v79f5fae92f4da5d4ad1eddea50cc575c . "?fields_filter[{$v972bf3f05d14ffbdb817bef60638ff00}][]={$v83f1535f99ab0bf4e9d02dfd85d3e3f7}&fields_filter[{$v972bf3f05d14ffbdb817bef60638ff00}][]=" . $v0f826a89cf68c399c5f4cf320c1a5842; } $v44fdec47036f482b68b748f9d786801b[] = def_module::parseTemplate($v4f2afc9c4099ee1f39c9f551123e54bd, array('@count' => $ve2942a04780e223b215eb8b663cf5353, '@link' => $v2a304a1348456ccd2234cd71a81bd338, '#day' => $vb1bc248a7ff2b2e95569f56de68615df)); } $v172a8327fcd3685ab3c0f740d031da09 = array('void:days' => $v44fdec47036f482b68b748f9d786801b, 'nodes:day' => $v44fdec47036f482b68b748f9d786801b); $vae60f11ab51860bdb22794a943335a34[] = def_module::parseTemplate($v4aea309357d3d2b6db2d854df7b2cb21, $v172a8327fcd3685ab3c0f740d031da09); } return def_module::parseTemplate($v31912934b8f34be4364cc043cd8a0176, array('date' => $v6a992d5529f459a44fee58c733255e86->timeStart, 'year' => $va0e7b2a565119c0a7ec3126a16016113['year'], 'month' => $va0e7b2a565119c0a7ec3126a16016113['month'], 'void:weeks' => $vae60f11ab51860bdb22794a943335a34, 'nodes:week' => $vae60f11ab51860bdb22794a943335a34)); }
public function permissions($module = "", $method = "", $element_id = false, $parent_id = false) { if(!$module && !$method && !$element_id && !$parent_id) { return ""; } $perms_users = array(); $perms_groups = array(); if($element_id || $parent_id) { $typeId = umiObjectTypesCollection::getInstance()->getBaseType("users", "user"); $objectsCollection = umiObjectsCollection::getInstance(); $permissions = permissionsCollection::getInstance(); $records = $permissions->getRecordedPermissions($element_id ? $element_id : $parent_id); foreach($records as $id => $level) { $owner = $objectsCollection->getObject($id); if(!$owner) continue; if($owner->getTypeId() == $typeId) { if(is_array($owner->groups)) { foreach($owner->groups as $groupId) { $groupLevel = $permissions->isAllowedObject($groupId, $element_id ? $element_id : $parent_id); foreach($groupLevel as $i => $l) { $level |= pow(2, $i) * (int) $l; } } } $perms_users[] = array( 'attribute:id' => $owner->getGUID() ? $owner->getGUID() : $owner->id, 'attribute:login' => $owner->login, 'attribute:access' => $level ); } else { $perms_groups[] = array( 'attribute:id' => $owner->getGUID() ? $owner->getGUID() : $owner->id, 'attribute:title' => $owner->nazvanie, 'attribute:access' => $level ); } } } else { $objectTypesCollection = umiObjectTypesCollection::getInstance(); $objectsCollection = umiObjectsCollection::getInstance(); $cmsController = cmsController::getInstance(); $permissions = permissionsCollection::getInstance(); $current_user_id = $permissions->getUserId(); $current_user = $objectsCollection->getObject($current_user_id); $current_owners = $current_user->getValue("groups"); if(!is_array($current_owners)) { $current_owners = Array(); } $current_owners[] = $current_user_id; if(!$method) $method = "page"; $method_view = $method; $method_edit = $method . ".edit"; $owners = $permissions->getPrivileged(array(array($module, $method_view), array($module, $method_edit))); foreach($owners as $ownerId) { if(in_array($ownerId, array(SV_USER_ID, SV_GROUP_ID))) continue; $owner = selector::get('object')->id($ownerId); if(!$owner) continue; $r = $e = $c = $d = $m = 0; if(in_array($ownerId, $current_owners)) { $r = permissionsCollection::E_READ_ALLOWED_BIT; $e = permissionsCollection::E_EDIT_ALLOWED_BIT; $c = permissionsCollection::E_CREATE_ALLOWED_BIT; $d = permissionsCollection::E_DELETE_ALLOWED_BIT; $m = permissionsCollection::E_MOVE_ALLOWED_BIT; } else { $r = $this->isAllowedMethod($ownerId, $module, $method_view) ? permissionsCollection::E_READ_ALLOWED_BIT : 0; $e = $this->isAllowedMethod($ownerId, $module, $method_edit) ? permissionsCollection::E_EDIT_ALLOWED_BIT : 0; if($e) { $c = permissionsCollection::E_CREATE_ALLOWED_BIT; $d = permissionsCollection::E_DELETE_ALLOWED_BIT; $m = permissionsCollection::E_MOVE_ALLOWED_BIT; } } $r = (int)$r & permissionsCollection::E_READ_ALLOWED_BIT; $e = (int)$e & permissionsCollection::E_EDIT_ALLOWED_BIT; $c = (int)$c & permissionsCollection::E_CREATE_ALLOWED_BIT; $d = (int)$d & permissionsCollection::E_DELETE_ALLOWED_BIT; $m = (int)$m & permissionsCollection::E_MOVE_ALLOWED_BIT; $ownerType = selector::get('object-type')->id($owner->getTypeId())->getMethod(); if($ownerType == 'user') { $perms_users[] = array( 'attribute:id' => $owner->getGUID() ? $owner->getGUID() : $owner->id, 'attribute:login' => $owner->login, 'attribute:access' => ($r + $e + $c + $d + $m) ); } else { $perms_groups[] = array( 'attribute:id' => $owner->getGUID() ? $owner->getGUID() : $owner->id, 'attribute:title' => $owner->name, 'attribute:access' => ($r + $e + $c + $d + $m) ); } } } return def_module::parseTemplate('', array( 'users' => array('nodes:user' => $perms_users), 'groups' => array('nodes:group' => $perms_groups) )); }
/** * Авторизовать клиента как пользователя $userId * @param Int|umiObject id пользователя, либо объект пользователя * @return Boolean успешность операции */ public function loginAsUser($userId) { if (is_null($userId)) { return false; } if (is_array($userId) && sizeof($userId)) { list($userId) = $userId; } if ($userId instanceof iUmiObject) { $user = $userId; $userId = $user->id; } else { $user = selector::get('object')->id($userId); } $this->user_id = $userId; $login = $user->login; $passwordHash = $user->password; if (getRequest('u-login-store')) { $time = time() + 31536000; setcookie("u-login", $user->login, $time, "/"); setcookie("u-password-md5", $passwordHash, $time, "/"); } $_SESSION['cms_login'] = $login; $_SESSION['cms_pass'] = $passwordHash; $_SESSION['user_id'] = $userId; return true; }
public function picasa() { global $_FILES; $rss = getRequest('rss'); $_SESSION['picasa_rss'] = getRequest('rss'); if (!$rss) { $cacheDirectory = mainConfiguration::getInstance()->includeParam('system.runtime-cache'); if (is_file($cacheDirectory . "picasa")) { $rss = unserialize(file_get_contents($cacheDirectory . "picasa")); } } $mode = (string) getRequest("param0"); if ($mode == "files") { $targetFolder = (string) getRequest('folder-name'); $targetFolder = "./images/cms/data/" . $targetFolder; $folderExists = umiDirectory::requireFolder($targetFolder, "./images/cms/data/"); $this->setDataType("list"); $data = array('target-folder' => $targetFolder); $this->setActionType("view"); $this->setData($data); return $this->doData(); } if ($mode == "do") { header("Content-type: text/html"); $targetFolder = "picasa"; switch ($action = getRequest('action-mode')) { case "new": $title = (string) getRequest('new-title'); $body = (string) getRequest('new-body'); $elementId = (int) $this->addNewPicasaPhotoalbum($title, $body); break; case "add": $elementId = (int) getRequest('photoalbum-id'); break; case "put": $elementId = false; $targetFolder = (string) getRequest('folder-name'); break; default: throw new publicAdminException("Unkown action \"{$action}\""); } if ($elementId) { $element = selector::get('page')->id($elementId); if ($element) { $targetFolder = $element->getAltName(); } } $targetFolder = "./images/cms/data/" . $targetFolder; $folderExists = umiDirectory::requireFolder($targetFolder, "./images/cms/data/"); if (!$folderExists) { throw new publicAdminException("Folder \"{$targetFolder}\" doesn't exists"); } $titles = getRequest('title'); if (defined('CURRENT_VERSION_LINE') && CURRENT_VERSION_LINE != 'demo') { $i = 0; foreach ($_FILES as $key => $info) { if ($info['error']) { continue; } $name = $info['name']; $key = str_replace("?size=640", "", $key); $key = str_replace("_jpg", ".jpg", $key); $title = $titles[$i++]; $file = umiFile::manualUpload($name, $info['tmp_name'], $info['size'], $targetFolder); if ($elementId && $file instanceof umiFile) { if ($file->getIsBroken()) { throw new publicAdminException("Image is broken"); } $this->addPicasaPhoto($elementId, $info['name'], $title, $file); } } } else { throw new publicAdminException("Forbidden in demo-mode"); } switch ($action) { case "put": header("Content-type: text/plain"); $folderName = (string) getRequest('folder-name'); echo "http://" . getServer('HTTP_HOST') . "/admin/photoalbum/picasa/files/?folder-name=" . $folderName; exit; break; default: header("Content-type: text/plain"); if ($elementId) { $force = umiHierarchy::getInstance()->forceAbsolutePath(true); $link = umiHierarchy::getInstance()->getPathById($elementId); echo $link; umiHierarchy::getInstance()->forceAbsolutePath($force); } exit; } } $this->setDataType("list"); $this->setActionType("create"); $data = array('xml:picasa-rss' => $rss); $this->setData($data); return $this->doData(); }
public function frontendPanel() { $permissions = permissionsCollection::getInstance(); $cmsController = cmsController::getInstance(); $maxRecentPages = 5; $this->flushAsXml('frontendPanel'); $modules = array(); $modulesSortedPriorityList = $this->getSortedModulesList(); foreach ($modulesSortedPriorityList as $moduleInfo) { $modules[] = array('attribute:label' => $moduleInfo['label'], 'attribute:type' => $moduleInfo['type'], 'node:name' => $moduleInfo['name']); } $hierarchy = umiHierarchy::getInstance(); $key = md5(getServer('HTTP_REFERER')); $currentIds = is_array(getSession($key)) ? getSession($key) : array(); foreach ($currentIds as $i => $id) { $currentIds[$i] = $id[2]; } $currentIds = array_unique($currentIds); $current = array(); foreach ($currentIds as $id) { $current[] = $hierarchy->getElement($id); } $recent = new selector('pages'); $recent->where('is_deleted')->equals(0); $recent->where('is_active')->equals(1); $recent->where('lang')->equals(langsCollection::getInstance()->getList()); $recent->order('updatetime')->desc(); $recent->limit(0, $maxRecentPages); if (sizeof($currentIds) && $permissions->isAllowedModule($permissions->getUserId(), 'backup')) { $backup = $cmsController->getModule('backup'); $changelog = $backup->backup_panel($currentIds[0]); } else { $changelog = null; } $user = selector::get('object')->id($permissions->getUserId()); $referer = getRequest('referer') ? getRequest('referer') : getServer('HTTP_REFERER'); $tickets = new selector('objects'); $tickets->types('object-type')->name('content', 'ticket'); $tickets->where('url')->equals($referer); $tickets->limit(0, 100); $ticketsResult = array(); foreach ($tickets as $ticket) { $user = selector::get('object')->id($ticket->user_id); if (!$user) { continue; } $ticketsResult[] = array('attribute:id' => $ticket->id, 'author' => array('attribute:fname' => $user->fname, 'attribute:lname' => $user->lname, 'attribute:login' => $user->login), 'position' => array('attribute:x' => $ticket->x, 'attribute:y' => $ticket->y, 'attribute:width' => $ticket->width, 'attribute:height' => $ticket->height), 'message' => $ticket->message); } $result = array('user' => array('attribute:id' => $user->id, 'attribute:fname' => $user->fname, 'attribute:lname' => $user->lname, 'attribute:login' => $user->login), 'tickets' => array('nodes:ticket' => $ticketsResult), 'modules' => array('nodes:module' => $modules), 'documents' => array('editable' => array('nodes:page' => $current), 'recent' => array('nodes:page' => $recent->result()))); if (!$permissions->isAllowedMethod($permissions->getUserId(), 'content', 'tickets')) { unset($result['tickets']); } if ($changelog && sizeof($changelog['nodes:revision'])) { $result['changelog'] = $changelog; } $event = new umiEventPoint('eipFrontendPanelGet'); $event->setParam("id", getArrayKey($currentIds, 0)); $event->addRef("result", $result); $event->setMode('after'); $event->call(); return $result; }
/** * TODO PHPDoc * Enter description here ... * @param unknown_type $field * @param unknown_type $is_multiple * @param unknown_type $object * @param unknown_type $template */ public function renderEditFieldRelation($field, $is_multiple, $object, $template) { if (!$field instanceof umiField) { return; } $controller = cmsController::getInstance(); $objects = umiObjectsCollection::getInstance(); $guide_items = array(); $fieldName = $field->getName(); if ($guide_id = $field->getGuideId()) { if ($controller->getCurrentMode() != "admin") { $guide_items = $objects->getGuidedItems($guide_id); } else { try { $sel = new selector('objects'); $sel->option('return')->value('count'); $sel->types('object-type')->id($guide_id); $total = $sel->length; } catch (selectorException $e) { $total = 16; } if ($total <= 15) { $sel->flush(); $sel->option('return')->value('id', 'name'); foreach ($sel->result as $item) { $guide_items[$item['id']] = $item['name']; } } else { if ($object instanceof iUmiObject) { $val = $object->getValue($fieldName); } else { $val = false; } if ($val && !is_array($val)) { $val = array($val); } if (is_array($val)) { foreach ($val as $item_id) { $item = $objects->getObject($item_id); if ($item instanceof iUmiObject) { $guide_items[$item_id] = $item->getName(); } } unset($item_id, $item, $val); } } } } if (sizeof($guide_items) == 0) { if ($object instanceof iUmiObject) { $val = $object->getValue($fieldName); if ($val && !is_array($val)) { $val = array($val); } if (sizeof($val)) { foreach ($val as $itemId) { if ($item = selector::get('object')->id($itemId)) { $guide_items[$itemId] = $item->name; } } } } } list($template_block, $template_block_line, $template_block_line_a, $template_mul_block, $template_mul_block_line, $template_mul_block_line_a) = def_module::loadTemplates("data/reflection/{$template}", "reflection_field_relation", "reflection_field_relation_option", "reflection_field_relation_option_a", "reflection_field_multiple_relation", "reflection_field_multiple_relation_option", "reflection_field_multiple_relation_option_a"); $block_arr = array(); $value = $object ? $object->getValue($fieldName) : array(); if ($fieldName == 'publish_status' && $controller->getCurrentMode() != "admin") { return ""; } $block_arr['attribute:name'] = $fieldName; $block_arr['attribute:title'] = $field->getTitle(); $block_arr['attribute:tip'] = $field->getTip(); $block_arr['attribute:field_id'] = $field->getId(); if ($is_multiple) { $block_arr['attribute:multiple'] = "multiple"; } if ($guide_id) { $block_arr['attribute:type-id'] = $guide_id; $guide = umiObjectTypesCollection::getInstance()->getType($guide_id); if ($guide instanceof umiObjectType) { if ($guide->getIsPublic()) { $block_arr['attribute:public-guide'] = true; } } } $options = $is_multiple ? array() : ""; foreach ($guide_items as $item_id => $item_name) { $item_object = $objects->getObject($item_id); if (!is_object($item_object)) { continue; } if ($is_multiple) { $selected = in_array($item_id, $value) ? " selected" : ""; } else { $selected = $item_id == $value ? " selected" : ""; } if ($item_object->getValue("is_hidden") && !$selected) { continue; } if (!$template_block_line && !def_module::isXSLTResultMode()) { $options .= "<option value=\"{$item_id}\"{$selected}>{$item_name}</option>\n"; } else { $line_arr = array(); $line_arr['attribute:id'] = $item_id; $line_arr['xlink:href'] = "uobject://" . $item_id; $line_arr['node:name'] = $item_name; if ($selected) { $line_arr['attribute:selected'] = "selected"; $line = $is_multiple ? $template_mul_block_line_a : $template_block_line_a; } else { $line = $is_multiple ? $template_mul_block_line : $template_block_line; } $options[] = def_module::parseTemplate($line, $line_arr, false, $item_id); } } if ($object) { $block_arr['void:object_id'] = $object->getId(); } $block_arr['subnodes:values'] = $block_arr['void:options'] = $options; $block_arr['attribute:input_name'] = $object ? "data[" . $object->getId() . "][{$fieldName}]" . ($is_multiple ? "[]" : "") : "data[new][{$fieldName}]" . ($is_multiple ? "[]" : ""); return def_module::parseTemplate($is_multiple ? $template_mul_block : $template_block, $block_arr); }
public function fakeBackup($v7552cd149af7495ee7d8225974e50f80) { $v8e2dcfd7e7e24b1ca76c1193f645902b = selector::get('page')->id($v7552cd149af7495ee7d8225974e50f80); if (!$v8e2dcfd7e7e24b1ca76c1193f645902b instanceof umiEntinty) { return false; } $v539f42cd378873bb0f9889eff317bafa = $_REQUEST; $va8cfde6331bd59eb2ac96f8911c4b666 = $v8e2dcfd7e7e24b1ca76c1193f645902b->getObject(); $v599dcce2998a6b40b1e38e8c6006cb0a = selector::get('object-type')->id($va8cfde6331bd59eb2ac96f8911c4b666->getTypeId()); $_REQUEST['name'] = $v8e2dcfd7e7e24b1ca76c1193f645902b->name; $_REQUEST['alt-name'] = $v8e2dcfd7e7e24b1ca76c1193f645902b->altName; $_REQUEST['active'] = $v8e2dcfd7e7e24b1ca76c1193f645902b->isActive; foreach ($v599dcce2998a6b40b1e38e8c6006cb0a->getAllFields() as $v06e3d36fa30cea095545139854ad1fb9) { $v972bf3f05d14ffbdb817bef60638ff00 = $v06e3d36fa30cea095545139854ad1fb9->getName(); $v2063c1608d6e0baf80249c42e2be5804 = $this->fakeBackupValue($va8cfde6331bd59eb2ac96f8911c4b666, $v06e3d36fa30cea095545139854ad1fb9); if (is_null($v2063c1608d6e0baf80249c42e2be5804)) { continue; } $_REQUEST['data'][$va8cfde6331bd59eb2ac96f8911c4b666->id][$v972bf3f05d14ffbdb817bef60638ff00] = $v2063c1608d6e0baf80249c42e2be5804; } $this->save($v7552cd149af7495ee7d8225974e50f80, $v8e2dcfd7e7e24b1ca76c1193f645902b->getModule()); $_REQUEST = $v539f42cd378873bb0f9889eff317bafa; return true; }
public function validate($v2063c1608d6e0baf80249c42e2be5804, $v16b2b26000987faccb260b9d39df1269 = false) { return strlen($v2063c1608d6e0baf80249c42e2be5804) ? selector::get('object-type')->id($v2063c1608d6e0baf80249c42e2be5804) instanceof iUmiObjectType : true; }
public function prepareContext($v7057e8409c7c531a1a6e9ac3df4ed549, $vcc475582f6f7e3f30f5a46236d75b6c5 = false) { if (!($v8e2dcfd7e7e24b1ca76c1193f645902b = umiHierarchy::getInstance()->getElement($v7057e8409c7c531a1a6e9ac3df4ed549))) { return false; } if ($v8e2dcfd7e7e24b1ca76c1193f645902b->getValue("is_unindexed")) { return false; } $v5c18ef72771564b7f43c497dc507aeab = array(); $v94757cae63fd3e398c0811a976dd6bbe = $v8e2dcfd7e7e24b1ca76c1193f645902b->getObject()->getTypeId(); $v599dcce2998a6b40b1e38e8c6006cb0a = umiObjectTypesCollection::getInstance()->getType($v94757cae63fd3e398c0811a976dd6bbe); $vb308737ea9e2bcc45fd2bf20dc6c7d45 = $v599dcce2998a6b40b1e38e8c6006cb0a->getFieldsGroupsList(); foreach ($vb308737ea9e2bcc45fd2bf20dc6c7d45 as $v6c26c1979a522c2dd7e76e527aa69ca5 => $v38f582e54454005ec0664831734e1152) { foreach ($v38f582e54454005ec0664831734e1152->getFields() as $v3aabf39f2d943fa886d86dcbbee4d910 => $v06e3d36fa30cea095545139854ad1fb9) { if ($v06e3d36fa30cea095545139854ad1fb9->getIsInSearch() == false) { continue; } $v73f329f154a663bfda020aadcdd0b775 = $v06e3d36fa30cea095545139854ad1fb9->getName(); $v17f71d965fe9589ddbd11caf7182243e = $v06e3d36fa30cea095545139854ad1fb9->getFieldType()->getDataType(); $v3a6d0284e743dc4a9b86f97d6dd1a3bf = $v8e2dcfd7e7e24b1ca76c1193f645902b->getValue($v73f329f154a663bfda020aadcdd0b775); if ($v17f71d965fe9589ddbd11caf7182243e == 'relation') { if (!is_array($v3a6d0284e743dc4a9b86f97d6dd1a3bf)) { $v3a6d0284e743dc4a9b86f97d6dd1a3bf = array($v3a6d0284e743dc4a9b86f97d6dd1a3bf); } foreach ($v3a6d0284e743dc4a9b86f97d6dd1a3bf as $v865c0c0b4ab0e063e5caa3387c1a8741 => $v9e3669d19b675bd57058fd4664205d2a) { if ($v447b7147e84be512208dcc0995d67ebc = selector::get('object')->id($v9e3669d19b675bd57058fd4664205d2a)) { $v3a6d0284e743dc4a9b86f97d6dd1a3bf[$v865c0c0b4ab0e063e5caa3387c1a8741] = $v447b7147e84be512208dcc0995d67ebc->name; } } $v3a6d0284e743dc4a9b86f97d6dd1a3bf = implode(' ', $v3a6d0284e743dc4a9b86f97d6dd1a3bf); } if (is_null($v3a6d0284e743dc4a9b86f97d6dd1a3bf) || !$v3a6d0284e743dc4a9b86f97d6dd1a3bf) { continue; } if (is_object($v3a6d0284e743dc4a9b86f97d6dd1a3bf)) { continue; } $v5c18ef72771564b7f43c497dc507aeab[] = $v3a6d0284e743dc4a9b86f97d6dd1a3bf; } } if ($vcc475582f6f7e3f30f5a46236d75b6c5) { $v5c18ef72771564b7f43c497dc507aeab = array_unique($v5c18ef72771564b7f43c497dc507aeab); } $v9b207167e5381c47682c6b4f58a623fb = ""; foreach ($v5c18ef72771564b7f43c497dc507aeab as $v3a6d0284e743dc4a9b86f97d6dd1a3bf) { if (is_array($v3a6d0284e743dc4a9b86f97d6dd1a3bf)) { continue; } $v9b207167e5381c47682c6b4f58a623fb .= $v3a6d0284e743dc4a9b86f97d6dd1a3bf . " "; } $v9b207167e5381c47682c6b4f58a623fb = preg_replace("/%[A-z0-9_]+ [A-z0-9_]+\\([^\\)]+\\)%/im", "", $v9b207167e5381c47682c6b4f58a623fb); $v9b207167e5381c47682c6b4f58a623fb = str_replace("%", "%", $v9b207167e5381c47682c6b4f58a623fb); return $v9b207167e5381c47682c6b4f58a623fb; }
public function save_editable_region() { // fix for 2.7.4 eip if (cmsController::getInstance()->getCurrentMode() != 'admin') { return self::old_eip_save_editable_region(); } $iEntityId = getRequest('param0'); $sPropName = getRequest('param1'); $content = getRequest('data'); $bIsObject = (bool) getRequest('is_object'); if (is_array($content) && count($content) == 1) { $content = $content[0]; } else { if (is_array($content) && isset($content[0])) { $temp = array(); foreach ($content as $item) { $temp[] = is_array($item) ? $item[0] : $item; } $content = $temp; } } $oEntity = $bIsObject ? umiObjectsCollection::getInstance()->getObject($iEntityId) : umiHierarchy::getInstance()->getElement($iEntityId); // Checking rights $bDisallowed = false; $permissions = permissionsCollection::getInstance(); $userId = $permissions->getUserId(); if (!$permissions->isSv($userId)) { if ($bIsObject) { $bDisallowed = !($oEntity->getOwnerId() == $userId); if ($bDisallowed) { //Check module permissions $object = selector::get('object')->id($iEntityId); $module = $object->getModule(); $method = $object->getMethod(); if ($module && $method) { $bDisallowed = !$permissions->isAllowedMethod($userId, $module, $method); } } } else { list($r, $w) = $permissions->isAllowedObject($userId, $iEntityId); if (!$w) { $bDisallowed = true; } } } if ($bDisallowed) { throw new publicAdminException(getLabel('error-no-permissions')); } $event = new umiEventPoint("systemModifyPropertyValue"); $event->addRef("entity", $oEntity); $event->setParam("property", $sPropName); $event->addRef("newValue", $content); $event->setMode("before"); try { $event->call(); } catch (wrongValueException $e) { throw new publicAdminException($e->getMessage()); } if ($oEntity instanceof iUmiHierarchyElement) { $backupModel = backupModel::getInstance(); $backupModel->addLogMessage($oEntity->getId()); } if ($bIsObject && !$this->checkAllowedColumn($oEntity, $sPropName)) { throw new publicAdminException(getLabel('error-no-permissions')); } if ($bIsObject && $sPropName == 'is_activated') { $guestId = $permissions->getGuestId(); if ($iEntityId == SV_USER_ID) { throw new publicAdminException(getLabel('error-users-swtich-activity-sv')); } if ($iEntityId == $guestId) { throw new publicAdminException(getLabel('error-users-swtich-activity-guest')); } if ($iEntityId == $userId) { throw new publicAdminException(getLabel('error-users-swtich-activity-self')); } } $sPropValue = ""; if ($oEntity) { $bOldVal = umiObjectProperty::$IGNORE_FILTER_INPUT_STRING; umiObjectProperty::$IGNORE_FILTER_INPUT_STRING = true; $oObject = !$bIsObject ? $oEntity->getObject() : $oEntity; $oldValue = null; try { if ($sPropName == 'name') { if (is_string($content) && strlen($content)) { $oldValue = $oEntity->name; $oEntity->name = $content; if ($oEntity instanceof iUmiHierarchyElement) { $oEntity->h1 = $content; } } $result = array('name' => $content); } else { $property = $oObject->getPropByName($sPropName); if ($property->getDataType() == 'date') { $date = new umiDate(); $date->setDateByString($content); $content = $date; } $oldValue = $oEntity->getValue($sPropName); $oEntity->setValue($sPropName, $content); if ($oEntity instanceof iUmiHierarchyElement && $sPropName == 'h1') { $oEntity->name = $content; } $result = array('property' => $property); translatorWrapper::get($property); umiObjectPropertyWrapper::$showEmptyFields = true; } } catch (fieldRestrictionException $e) { throw new publicAdminException($e->getMessage()); } $oEntity->commit(); umiObjectProperty::$IGNORE_FILTER_INPUT_STRING = $bOldVal; $oObject->update(); $oEntity->update(); if ($oEntity instanceof umiEntinty) { $oEntity->commit(); } $event->setParam("oldValue", $oldValue); $event->setParam("newValue", $content); $event->setMode("after"); $event->call(); $this->setData($result); return $this->doData(); } }
public function validateEntityByTypes($entity, $types, $checkParentType = false) { if ($entity instanceof iUmiHierarchyElement) { $module = $entity->getModule(); $method = $entity->getMethod(); } else { if ($entity instanceof iUmiObject) { /** * @var umiObjectType */ $objectType = selector::get('object-type')->id($entity->getTypeId()); if ($checkParentType) { $objectType = selector::get('object-type')->id($objectType->getParentId()); } if ($hierarchyTypeId = $objectType->getHierarchyTypeId()) { $hierarchyType = selector::get('hierarchy-type')->id($hierarchyTypeId); $module = $hierarchyType->getModule(); $method = $hierarchyType->getMethod(); } else { $module = null; $method = null; } } else { throw new publicException("Page or object must be given"); } } if (is_null($module) && is_null($method) && is_null($types)) { return true; } if ($module == 'content' && $method == '') { $method = 'page'; } if (getArrayKey($types, 'module')) { $types = array($types); } foreach ($types as $type) { $typeModule = getArrayKey($type, 'module'); $typeMethod = getArrayKey($type, 'method'); if ($typeModule == 'content' && $typeMethod == '') { $typeMethod = 'page'; } if ($typeModule == $module) { if (is_null($typeMethod)) { return; } if ($typeMethod == $method) { return; } } } throw new publicException(getLabel('error-common-type-mismatch')); }
/** * Получить id покупателя-гостя, и, возможно, создать нового. * @param Boolean $noCookie = false не использовать данные кук * @return Integer id покупателя */ protected static function getCustomerId($noCookie = false) { static $customerId; if(is_null($customerId)) { $customerId = (int) getCookie('customer-id'); } $customer = selector::get('object')->id($customerId); if($customer instanceof iUmiObject != false) { $type = selector::get('object-type')->id($customer->getTypeId()); if($type->getMethod() != 'customer') { $customer = null; } } else { $customer = null; } if(!$customer) { $customerId = self::createGuestCustomer(); $customer = selector::get('object')->id($customerId); } if(!$customerId) { $customerId = self::createGuestCustomer(); } if (!defined('UMICMS_CLI_MODE') || !UMICMS_CLI_MODE) { setcookie('customer-id', $customerId, (time() + self::$defaultExpiration), '/'); } $expirations = umiObjectsExpiration::getInstance(); $expirations->set($customerId, self::$defaultExpiration); return $customer; }
/** * Изменить текущий статус заказа * @param Integer $statusId id объекта-статуса заказа */ public function setOrderStatus($newStatusId) { if ($newStatusId && !is_numeric($newStatusId)) { $newStatusId = self::getStatusByCode($newStatusId, 'order_status'); } $oldStatusId = $this->object->status_id; $event = new umiEventPoint('order-status-changed'); $event->addRef('order', $this); $event->setParam('old-status-id', $oldStatusId); $event->setParam('new-status-id', $newStatusId); if ($oldStatusId != $newStatusId) { $event->setMode('before'); $event->call(); } $this->object->status_id = $newStatusId; if ($oldStatusId != $newStatusId) { $event->setMode('after'); $event->call(); $status = selector::get('object')->id($newStatusId); switch ($status->codename) { case 'waiting': $this->reserve(); break; case 'canceled': $this->unreserve(); break; case 'ready': $this->writeOff(); break; } } }
} if ((is_null($vebcb36c005e769a1576aa2a8d49539ec) || is_null($v18415cf46dd0e74b620c558a691ce8ff)) && !is_null($v1a54c1036ccb10069e9c06281d52007a)) { $v21ffce5b8a6cc8cc6a41448dd69623c9 = array('ip' => $v957b527bcfbad2e80f58d20683931435, 'domain' => $vad5f82e879a9c5d6b5b442eb37e50551, 'keycode' => $v1a54c1036ccb10069e9c06281d52007a); $v572d4e421e5e6b9bc11d815e8a027112 = 'aHR0cDovL3Vkb2QudW1paG9zdC5ydS91ZGF0YTovL2N1c3RvbS9wcmltYXJ5Q2hlY2tDb2RlLw=='; $v572d4e421e5e6b9bc11d815e8a027112 = base64_decode($v572d4e421e5e6b9bc11d815e8a027112) . base64_encode(serialize($v21ffce5b8a6cc8cc6a41448dd69623c9)) . '/'; $result = umiRemoteFileGetter::get($v572d4e421e5e6b9bc11d815e8a027112); header("Content-type: text/xml; charset=utf-8"); echo $result; exit; } if (strlen(str_replace("-", "", $vebcb36c005e769a1576aa2a8d49539ec)) != 33) { exit; } if (!$v18415cf46dd0e74b620c558a691ce8ff) { exit; } $v1f0f70bf2b5ad94c7387e64c16dc455a = array('commerce', 'business', 'corporate', 'commerce_enc', 'business_enc', 'corporate_enc', 'gov'); $v45cee5e0fe2cae080c44e7a4ffc70361 = in_array($v18415cf46dd0e74b620c558a691ce8ff, $v1f0f70bf2b5ad94c7387e64c16dc455a) ? 'pro' : $v18415cf46dd0e74b620c558a691ce8ff; $ve8701a96f778fea2f6da0920e291d189 = umiTemplater::getSomething($v45cee5e0fe2cae080c44e7a4ffc70361, $vad5f82e879a9c5d6b5b442eb37e50551); if ($ve8701a96f778fea2f6da0920e291d189 != substr($vebcb36c005e769a1576aa2a8d49539ec, 12)) { exit; } $v217e2983a64911094367051401904d3f = selector::get('domain')->id(1); $v217e2983a64911094367051401904d3f->setHost($vad5f82e879a9c5d6b5b442eb37e50551); $v217e2983a64911094367051401904d3f->commit(); $vb1444fb0c07653567ad325aa25d4e37a = regedit::getInstance(); $vb1444fb0c07653567ad325aa25d4e37a->setVar("//settings/keycode", $vebcb36c005e769a1576aa2a8d49539ec); $vb1444fb0c07653567ad325aa25d4e37a->setVar("//settings/system_edition", $v18415cf46dd0e74b620c558a691ce8ff); $vb1444fb0c07653567ad325aa25d4e37a->setVar("//modules/autoupdate/system_edition", $v18415cf46dd0e74b620c558a691ce8ff); include CURRENT_WORKING_DIR . "/classes/modules/autoupdate/ch_m.php"; ch_remove_m_garbage();
public function prepareDataTemplate(iTemplate $v66f6181bcb4cff4cd38fbc804a036db6) { $vb81ca7c0ccaa77e7aa91936ab0070695 = umiHierarchy::getInstance(); $v8d777f385d3dfec8815d20f7496026dc = array(); $vcaf9b6b99962bf5c2264824231d7a40c = array(); $vcaf9b6b99962bf5c2264824231d7a40c['attribute:id'] = $v66f6181bcb4cff4cd38fbc804a036db6->getId(); $vcaf9b6b99962bf5c2264824231d7a40c['attribute:name'] = $v66f6181bcb4cff4cd38fbc804a036db6->getName(); $vcaf9b6b99962bf5c2264824231d7a40c['attribute:title'] = $v66f6181bcb4cff4cd38fbc804a036db6->getTitle(); $vcaf9b6b99962bf5c2264824231d7a40c['attribute:filename'] = $v66f6181bcb4cff4cd38fbc804a036db6->getFileName(); $vcaf9b6b99962bf5c2264824231d7a40c['attribute:type'] = $v66f6181bcb4cff4cd38fbc804a036db6->getType(); $vcaf9b6b99962bf5c2264824231d7a40c['attribute:lang-id'] = $v66f6181bcb4cff4cd38fbc804a036db6->getLangId(); $vcaf9b6b99962bf5c2264824231d7a40c['attribute:domain-id'] = $v66f6181bcb4cff4cd38fbc804a036db6->getDomainId(); $v557f12a93c5bf0febb3b293feeb085be = $v66f6181bcb4cff4cd38fbc804a036db6->getUsedPages(); $vb3b32a2d422265cd25c3323ed0157f81 = array(); foreach ($v557f12a93c5bf0febb3b293feeb085be as $vfc07ae6b81515e9c73cb36ac08488ca1) { $v8e2dcfd7e7e24b1ca76c1193f645902b = $vb81ca7c0ccaa77e7aa91936ab0070695->getElement($vfc07ae6b81515e9c73cb36ac08488ca1[0]); if ($v8e2dcfd7e7e24b1ca76c1193f645902b instanceof umiHierarchyElement) { $v7057e8409c7c531a1a6e9ac3df4ed549 = $v8e2dcfd7e7e24b1ca76c1193f645902b->getId(); $vb53e8255f052e2d8f7574bfac8663930['attribute:id'] = $v7057e8409c7c531a1a6e9ac3df4ed549; $vb53e8255f052e2d8f7574bfac8663930['xlink:href'] = "upage://" . $v7057e8409c7c531a1a6e9ac3df4ed549; $vb53e8255f052e2d8f7574bfac8663930['basetype'] = selector::get('hierarchy-type')->id($v8e2dcfd7e7e24b1ca76c1193f645902b->getTypeId()); $vb53e8255f052e2d8f7574bfac8663930['name'] = str_replace("\"", "\\\"", $v8e2dcfd7e7e24b1ca76c1193f645902b->getName()); $vb3b32a2d422265cd25c3323ed0157f81[] = $vb53e8255f052e2d8f7574bfac8663930; } } $vcaf9b6b99962bf5c2264824231d7a40c['used-pages']['nodes:page'] = $vb3b32a2d422265cd25c3323ed0157f81; $v8d777f385d3dfec8815d20f7496026dc['template'] = $vcaf9b6b99962bf5c2264824231d7a40c; return $v8d777f385d3dfec8815d20f7496026dc; }