public function shared_files()
 {
     $this->setDataType("list");
     $this->setActionType("view");
     if ($this->ifNotXmlMode()) {
         return $this->doData();
     }
     $per_page = 20;
     $curr_page = getRequest('p');
     $hierarchyTypes = umiHierarchyTypesCollection::getInstance();
     $hierarchy_type_id = $hierarchyTypes->getTypeByName("filemanager", "shared_file")->getId();
     $sel = new umiSelection();
     $sel->addLimit($per_page, $curr_page);
     $sel->addElementType($hierarchy_type_id);
     $this->autoDetectAllFilters($sel);
     $sel->addPermissions();
     $result = umiSelectionsParser::runSelection($sel);
     $total = umiSelectionsParser::runSelectionCounts($sel);
     $this->setDataType("list");
     $this->setActionType("view");
     $this->setDataRange($per_page, $curr_page * $per_page);
     $data = $this->prepareData($result, "pages");
     $this->setData($data, $total);
     return $this->doData();
 }
 public function import_subscriber($email, $fname, $lname)
 {
     if (!$email) {
         return false;
     }
     $oSbsSelection = new umiSelection();
     $oSbsSelection->setObjectTypeFilter();
     $iSbsHierarchyTypeId = umiHierarchyTypesCollection::getInstance()->getTypeByName("dispatches", "subscriber")->getId();
     $iSbsTypeId = umiObjectTypesCollection::getInstance()->getTypeByHierarchyTypeId($iSbsHierarchyTypeId);
     $oSbsType = umiObjectTypesCollection::getInstance()->getType($iSbsTypeId);
     $oSbsSelection->addObjectType($iSbsTypeId);
     $oSbsSelection->setNamesFilter();
     $oSbsSelection->addNameFilterEquals($email);
     $arrSbsSelResults = umiSelectionsParser::runSelection($oSbsSelection);
     if (sizeof($arrSbsSelResults)) {
         list($object_id) = $arrSbsSelResults;
     } else {
         $object_id = umiObjectsCollection::getInstance()->addObject($email, $iSbsTypeId);
     }
     if ($oSubscriber = umiObjectsCollection::getInstance()->getObject($object_id)) {
         $oSubscriber->setName($email);
         $oSubscriber->setValue('fname', $fname);
         $oSubscriber->setValue('lname', $lname);
         $oCurrDate = new umiDate(time());
         $oSubscriber->setValue('subscribe_date', $oCurrDate);
         $oSubscriber->setValue('subscriber_dispatches', $this->getAllDispatches());
         $oSubscriber->commit();
     } else {
         return false;
     }
     return $object_id;
 }
 /**
  * Gets news with specified type. Uses paging.
  *
  * @param int $type Id of type (rubric)
  * @param int $limit Limit for output
  * @param int $page Current page for calculate offset
  * @return array
  */
 public function getList($type, $limit, $page = 1)
 {
     $config = parse_ini_file("./config/config.ini", true);
     $page -= 1;
     $hierarchyTypeId = umiHierarchyTypesCollection::getInstance()->getTypeByName("news", "item")->getId();
     $objectTypeId = umiObjectTypesCollection::getInstance()->getBaseType("news", "item");
     $objectType = umiObjectTypesCollection::getInstance()->getType($objectTypeId);
     $publishTimeFieldId = $objectType->getFieldId('publish_time');
     $publishToAppFieldId = $objectType->getFieldId('publish_to_app');
     $sel = new umiSelection();
     $sel->addElementType($hierarchyTypeId);
     $sel->addHierarchyFilter($type, 0, true);
     if ($config["umi"]["ignore-publish-flag"] != 1) {
         $sel->addPropertyFilterEqual($publishToAppFieldId, true);
     }
     $sel->setOrderByProperty($publishTimeFieldId, false);
     $sel->addLimit($limit, $page);
     $result = umiSelectionsParser::runSelection($sel);
     $items = array();
     $size = sizeof($result);
     for ($i = 0; $i < $size; $i++) {
         $elementId = $result[$i];
         $element = umiHierarchy::getInstance()->getElement($elementId);
         if (!$element) {
             continue;
         }
         $items[] = array("id" => $elementId, "header" => $element->getValue("h1"), "date" => $element->getValue("publish_time")->getFormattedDate("d.m.Y"), "image" => "http://" . $_SERVER['HTTP_HOST'] . $element->getValue("anons_pic"), "original_link" => "http://" . $_SERVER['HTTP_HOST'] . umiHierarchy::getInstance()->getPathById($elementId));
     }
     return $items;
 }
Пример #4
0
 public function count_users()
 {
     $typeId = umiObjectTypesCollection::getInstance()->getBaseType("users", "user");
     $type = umiObjectTypesCollection::getInstance()->getType($typeId);
     $isActiveField = $type->getFieldId('is_activated');
     $sel = new umiSelection();
     $sel->addObjectType($typeId);
     $sel->addPropertyFilterEqual($isActiveField, true);
     return umiSelectionsParser::runSelectionCounts($sel);
     $total;
 }
Пример #5
0
 public function import_comments($from, $to, $fromHTypeId, $toHTypeId)
 {
     $selection = new umiSelection();
     $selection->addElementType($fromHTypeId);
     $selection->addHierarchyFilter($from);
     $commentList = umiSelectionsParser::runSelection($selection);
     foreach ($commentList as $commentId) {
         $newCommentId = $this->makeElementFromExisting($commentId, $to, $toHTypeId);
         $this->import_comments($commentId, $newCommentId, $fromHTypeId, $toHTypeId);
     }
 }
Пример #6
0
 public static function getDatabaseStatus()
 {
     $result = array();
     $v1723bdd4ee51910267a625cae41ced8a = umiHierarchyTypesCollection::getInstance();
     $v9b81909fd0da3add2602a8d0ede0e4e7 = umiObjectTypesCollection::getInstance();
     $v3527525cd11a98e16f6c1d31fe7d89dd = $v1723bdd4ee51910267a625cae41ced8a->getTypesList();
     foreach ($v3527525cd11a98e16f6c1d31fe7d89dd as $v89b0b9deff65f8b9cd1f71bc74ce36ba) {
         $vacf567c9c3d6cf7c6e2cc0ce108e0631 = $v89b0b9deff65f8b9cd1f71bc74ce36ba->getId();
         $v4aa3988e15afb9618423a0c2961a469f = self::checkIfBranchedByHierarchyTypeId($vacf567c9c3d6cf7c6e2cc0ce108e0631);
         $v8be74552df93e31bbdd6b36ed74bdb6a = new umiSelection();
         $v8be74552df93e31bbdd6b36ed74bdb6a->addElementType($vacf567c9c3d6cf7c6e2cc0ce108e0631);
         $ve2942a04780e223b215eb8b663cf5353 = umiSelectionsParser::runSelectionCounts($v8be74552df93e31bbdd6b36ed74bdb6a);
         $result[] = array('id' => $vacf567c9c3d6cf7c6e2cc0ce108e0631, 'isBranched' => $v4aa3988e15afb9618423a0c2961a469f, 'count' => $ve2942a04780e223b215eb8b663cf5353);
     }
     return $result;
 }
Пример #7
0
 public function cronUnpublishPage($oEvent)
 {
     $object_type = umiObjectTypesCollection::getInstance()->getTypeByGUID('root-pages-type');
     $field_id = $object_type->getFieldId("expiration_date");
     $sel = new umiSelection();
     $sel->addPropertyFilterLess($field_id, time());
     $sel->addPropertyFilterNotEqual($field_id, 0);
     $sel->addActiveFilter(true);
     $sel->forceHierarchyTable(true);
     $result = umiSelectionsParser::runSelection($sel);
     $res = array();
     foreach ($result as $key => $page_id) {
         $ePage = umiHierarchy::getInstance()->getElement($page_id, true);
         $ePage->setIsActive(false);
         $pageObject = $ePage->getObject();
         $pageObject->setValue("publish_status", $this->getPageStatusIdByStatusSid("page_status_unpublish"));
         $pageObject->commit();
         $ePage->commit();
         if (!($publishComments = $ePage->getValue("publish_comments"))) {
             $publishComments = "Отсутствуют.";
         }
         $user_id = $ePage->getObject()->getOwnerId();
         $oUser = umiObjectsCollection::getInstance()->getObject($user_id);
         if ($oUser instanceof umiObject && ($user_email = $oUser->getValue("e-mail"))) {
             //Составляем и посылаем сообщение пользователю
             $mail_message = new umiMail();
             $from = regedit::getInstance()->getVal("//settings/email_from");
             $mail_message->setFrom($from);
             $mail_message->setPriorityLevel("high");
             $mail_message->setSubject(getLabel('label-notification-expired-mail-header'));
             list($body) = def_module::loadTemplatesForMail("mail/expired", "body");
             $block['notify_header'] = getLabel('label-notification-expired-mail-header');
             $block['page_header'] = $ePage->getName();
             $block['publish_comments'] = $publishComments;
             $domain = domainsCollection::getInstance()->getDomain($ePage->getDomainId());
             $page_host = "http://" . $domain->getHost() . umiHierarchy::getInstance()->getPathById($page_id);
             $block['page_link'] = $page_host;
             $mail_html = def_module::parseTemplateForMail($body, $block, $page_id);
             $mail_message->addRecipient($user_email);
             $mail_message->setContent($mail_html);
             $mail_message->commit();
             $mail_message->send();
         }
     }
 }
Пример #8
0
 public static function getSubscriberByUserId($v7ad6e70c936a7223ff2f1663258f4a0a)
 {
     $va5a928b6b6b19de8a18398c7b29f47d7 = false;
     $vf7b7708e49b5e697e01291fdbb169c31 = umiHierarchyTypesCollection::getInstance()->getTypeByName("dispatches", "subscriber")->getId();
     $v3ec9f372b2dad35356b9884c89cf0ef2 = umiObjectTypesCollection::getInstance()->getTypeByHierarchyTypeId($vf7b7708e49b5e697e01291fdbb169c31);
     $vff500849b1c1163f66c899c7aec17813 = umiObjectTypesCollection::getInstance()->getType($v3ec9f372b2dad35356b9884c89cf0ef2);
     $v18ea1849dbf10a18b2dfd4ed0eb3a231 = new umiSelection();
     $v18ea1849dbf10a18b2dfd4ed0eb3a231->setObjectTypeFilter();
     $v18ea1849dbf10a18b2dfd4ed0eb3a231->addObjectType($v3ec9f372b2dad35356b9884c89cf0ef2);
     $v18ea1849dbf10a18b2dfd4ed0eb3a231->setPropertyFilter();
     $v18ea1849dbf10a18b2dfd4ed0eb3a231->addPropertyFilterEqual($vff500849b1c1163f66c899c7aec17813->getFieldId('uid'), $v7ad6e70c936a7223ff2f1663258f4a0a);
     $v2cf58721416a170aa34368186d661d4b = umiSelectionsParser::runSelection($v18ea1849dbf10a18b2dfd4ed0eb3a231);
     if (is_array($v2cf58721416a170aa34368186d661d4b) && count($v2cf58721416a170aa34368186d661d4b)) {
         $va5a928b6b6b19de8a18398c7b29f47d7 = $v2cf58721416a170aa34368186d661d4b[0];
     } else {
         $v5a459b4b428788e52383cf8fae051ef7 = umiObjectsCollection::getInstance()->getObject($v7ad6e70c936a7223ff2f1663258f4a0a);
         $vaddc9cff9d125716db26235ce1c09240 = $v5a459b4b428788e52383cf8fae051ef7->getValue("e-mail");
         $v2430d439812ab308abec75d804810a30 = $v5a459b4b428788e52383cf8fae051ef7->getValue("lname");
         $vd9c6a1a67112c4d88c9a572ac9cad3f5 = $v5a459b4b428788e52383cf8fae051ef7->getValue("fname");
         $vaa876bbb2f0018ef7348fccc805794af = $v5a459b4b428788e52383cf8fae051ef7->getValue("father_name");
         $vf572db796146381f0522cb8ba4a636e0 = $v5a459b4b428788e52383cf8fae051ef7->getValue("gender");
         $vf7b7708e49b5e697e01291fdbb169c31 = umiHierarchyTypesCollection::getInstance()->getTypeByName("dispatches", "subscriber")->getId();
         $v3ec9f372b2dad35356b9884c89cf0ef2 = umiObjectTypesCollection::getInstance()->getTypeByHierarchyTypeId($vf7b7708e49b5e697e01291fdbb169c31);
         $va5a928b6b6b19de8a18398c7b29f47d7 = umiObjectsCollection::getInstance()->addObject($vaddc9cff9d125716db26235ce1c09240, $v3ec9f372b2dad35356b9884c89cf0ef2);
         $vf674b89869b81fcedca2243c18bbcdd1 = umiObjectsCollection::getInstance()->getObject($va5a928b6b6b19de8a18398c7b29f47d7);
         if ($vf674b89869b81fcedca2243c18bbcdd1 instanceof umiObject) {
             $vf674b89869b81fcedca2243c18bbcdd1->setName($vaddc9cff9d125716db26235ce1c09240);
             $vf674b89869b81fcedca2243c18bbcdd1->setValue('lname', $v2430d439812ab308abec75d804810a30);
             $vf674b89869b81fcedca2243c18bbcdd1->setValue('fname', $vd9c6a1a67112c4d88c9a572ac9cad3f5);
             $vf674b89869b81fcedca2243c18bbcdd1->setValue('father_name', $vaa876bbb2f0018ef7348fccc805794af);
             $v61a9cd46c360819bab753cd29ccea4c4 = new umiDate(time());
             $vf674b89869b81fcedca2243c18bbcdd1->setValue('subscribe_date', $v61a9cd46c360819bab753cd29ccea4c4);
             $vf674b89869b81fcedca2243c18bbcdd1->setValue('gender', $vf572db796146381f0522cb8ba4a636e0);
             $vf674b89869b81fcedca2243c18bbcdd1->setValue('uid', $v7ad6e70c936a7223ff2f1663258f4a0a);
         }
         $vf674b89869b81fcedca2243c18bbcdd1->commit();
     }
     return $va5a928b6b6b19de8a18398c7b29f47d7;
 }
Пример #9
0
 public function subscribers_list()
 {
     // input
     $iDispId = $_REQUEST['param0'];
     // set tab
     $this->sheets_set_active("subscribers_list");
     //input:
     $this->load_forms();
     $iCurrPage = (int) $_REQUEST['p'];
     $params = array();
     // gen banners list
     $params['rows'] = "";
     //
     $oSbsSelection = new umiSelection();
     $oSbsSelection->setObjectTypeFilter();
     $oSbsSelection->setLimitFilter();
     $oSbsSelection->addLimit($this->per_page, $iCurrPage);
     $iHierarchyTypeId = umiHierarchyTypesCollection::getInstance()->getTypeByName("dispatches", "subscriber")->getId();
     $iSbsTypeId = umiObjectTypesCollection::getInstance()->getTypeByHierarchyTypeId($iHierarchyTypeId);
     $oSbsType = umiObjectTypesCollection::getInstance()->getType($iSbsTypeId);
     $oSbsSelection->addObjectType($iSbsTypeId);
     // add curr dispatch filter
     if ($iDispId) {
         $oDispObj = umiObjectsCollection::getInstance()->getObject($iDispId);
         if ($oDispObj instanceof umiObject) {
             $oSbsSelection->setPropertyFilter();
             $oSbsSelection->addPropertyFilterEqual($oSbsType->getFieldId('subscriber_dispatches'), $iDispId);
         }
     }
     $arrSelResults = umiSelectionsParser::runSelection($oSbsSelection);
     $iCountResults = umiSelectionsParser::runSelectionCounts($oSbsSelection);
     $iSbsNum = $this->per_page * $iCurrPage;
     for ($iI = 0; $iI < count($arrSelResults); $iI++) {
         $params['rows'] .= self::renderSubscriber($arrSelResults[$iI], ++$iSbsNum);
     }
     $params['pages'] = $this->generateNumPage($iCountResults, $this->per_page, $iCurrPage);
     return $this->parse_form("subscribers_list", $params);
 }
Пример #10
0
 public function getPagesByBaseTypeList($module, $method)
 {
     $hierarchyTypesCollection = umiHierarchyTypesCollection::getInstance();
     $hierarchy = umiHierarchy::getInstance();
     $type = $hierarchyTypesCollection->getTypeByName($module, $method);
     if ($type instanceof iUmiHierarchyType) {
         $type_id = $type->getId();
     } else {
         throw new publicException("Hierarchy type {$module}::{$method} doesn't exists");
     }
     $sel = new umiSelection();
     $sel->addElementType($type_id);
     $sel->addPermissions();
     $result = umiSelectionsParser::runSelection($sel);
     $pages = array();
     foreach ($result as $element_id) {
         $element = $hierarchy->getElement($element_id);
         if ($element instanceof umiHierarchyElement) {
             $pages[] = $element;
         }
     }
     return array("pages" => array("nodes:page" => $pages));
 }
Пример #11
0
 public function renderCurrencyChooser($v66f6181bcb4cff4cd38fbc804a036db6 = "default")
 {
     if (!$v66f6181bcb4cff4cd38fbc804a036db6) {
         $v66f6181bcb4cff4cd38fbc804a036db6 = "default";
     }
     list($v33049bc9918b68289df6a5ec64f07f47) = def_module::loadTemplates("eshop/basket/" . $v66f6181bcb4cff4cd38fbc804a036db6, "currency_choose");
     $v7f5cbfbf72c13c3428b35837dff582f8 = umiObjectTypesCollection::getInstance()->getBaseType("eshop", "currency");
     $v4101a5fdf0ed40cbaf9bea2e125182cb = umiObjectTypesCollection::getInstance()->getType($v7f5cbfbf72c13c3428b35837dff582f8);
     $v01155f9f4e569970e4eef4e39fdbf559 = $v4101a5fdf0ed40cbaf9bea2e125182cb->getFieldId("use_in_eshop");
     $v8be74552df93e31bbdd6b36ed74bdb6a = new umiSelection();
     $v8be74552df93e31bbdd6b36ed74bdb6a->addObjectType($v7f5cbfbf72c13c3428b35837dff582f8);
     $v8be74552df93e31bbdd6b36ed74bdb6a->addPropertyFilterEqual($v01155f9f4e569970e4eef4e39fdbf559, true);
     $result = umiSelectionsParser::runSelection($v8be74552df93e31bbdd6b36ed74bdb6a);
     $vea963809ed3a54d0c863508f546b2bae = array("subnodes:currency_items" => "");
     if (count($result) < 2) {
         return false;
     }
     foreach ($result as $vf82265ccceac13b2f40ccd9e81cbd263) {
         $vea963809ed3a54d0c863508f546b2bae['subnodes:currency_items'] .= $this->renderCurrencyItem($vf82265ccceac13b2f40ccd9e81cbd263);
     }
     return def_module::parseTemplate($v33049bc9918b68289df6a5ec64f07f47, $vea963809ed3a54d0c863508f546b2bae);
 }
Пример #12
0
 protected function getStoreIdByName($vfc19ae0e7cb9076cc4077381bbe0b168)
 {
     $v87306dd4235ed712ebc07fe169b76f83 = umiObjectTypesCollection::getInstance()->getBaseType("eshop", "store");
     $v8be74552df93e31bbdd6b36ed74bdb6a = new umiSelection();
     $v8be74552df93e31bbdd6b36ed74bdb6a->setObjectTypeFilter();
     $v8be74552df93e31bbdd6b36ed74bdb6a->addObjectType($v87306dd4235ed712ebc07fe169b76f83);
     $v8be74552df93e31bbdd6b36ed74bdb6a->setPropertyFilter();
     $v8be74552df93e31bbdd6b36ed74bdb6a->addNameFilterEquals($vfc19ae0e7cb9076cc4077381bbe0b168);
     $result = umiSelectionsParser::runSelection($v8be74552df93e31bbdd6b36ed74bdb6a);
     return isset($result[0]) ? (int) $result[0] : false;
 }
Пример #13
0
 public function makeAdminOutputList($s_data_action, $s_items_type, $o_selection, $i_limit, $i_offset)
 {
     // process selection
     $arr_result = umiSelectionsParser::runSelection($o_selection);
     $i_total = umiSelectionsParser::runSelectionCounts($o_selection);
     // Устанавливаем тип для вывода данных в "list" - список
     $this->setDataType("list");
     // Устанавливаем действие над списокм
     $this->setActionType($s_data_action);
     // Указываем диапозон данных
     $this->setDataRange($i_limit, $i_offset);
     // Подготавливаем данные, чтобы потом корректно их вывести
     $data = $this->prepareData($arr_result, $s_items_type);
     // Завершаем вывод
     $this->setData($data, $i_total);
     return $this->doData();
 }
Пример #14
0
 public function search_do($template = "default", $search_string = "", $search_types = "", $search_branches = "", $per_page = 0)
 {
     list($template_block, $template_line, $template_empty_result, $template_line_quant) = self::loadTemplates("search/" . $template, "search_block", "search_block_line", "search_empty_result", "search_block_line_quant");
     // поисковая фраза :
     if (!$search_string) {
         $search_string = (string) getRequest('search_string');
     }
     $block_arr = array();
     $block_arr['last_search_string'] = $search_string;
     $search_string = urldecode($search_string);
     $search_string = htmlspecialchars($search_string);
     $search_string = str_replace(".", " ", $search_string);
     $search_string = trim($search_string, " \t\r\n%");
     $search_string = str_replace(array('"', "'"), "", $search_string);
     $orMode = (bool) getRequest('search-or-mode');
     if (!$search_string) {
         return $this->insert_form($template);
     }
     // если запрошен поиск только по определенным веткам :
     $arr_search_by_rels = array();
     if (!$search_branches) {
         $search_branches = (string) getRequest('search_branches');
     }
     $search_branches = trim(rawurldecode($search_branches));
     if (strlen($search_branches)) {
         $arr_branches = preg_split("/[\\s,]+/", $search_branches);
         foreach ($arr_branches as $i_branch => $v_branch) {
             $arr_branches[$i_branch] = $this->analyzeRequiredPath($v_branch);
         }
         $arr_branches = array_map('intval', $arr_branches);
         $arr_search_by_rels = array_merge($arr_search_by_rels, $arr_branches);
         $o_selection = new umiSelection();
         $o_selection->addHierarchyFilter($arr_branches, 100, true);
         $o_result = umiSelectionsParser::runSelection($o_selection);
         $sz = sizeof($o_result);
         for ($i = 0; $i < $sz; $i++) {
             $arr_search_by_rels[] = intval($o_result[$i]);
         }
     }
     // если запрошен поиск только по определенным типам :
     if (!$search_types) {
         $search_types = (string) getRequest('search_types');
     }
     $search_types = rawurldecode($search_types);
     if (strlen($search_types)) {
         $search_types = preg_split("/[\\s,]+/", $search_types);
         $search_types = array_map('intval', $search_types);
     }
     $lines = array();
     $result = searchModel::getInstance()->runSearch($search_string, $search_types, $arr_search_by_rels, $orMode);
     $p = (int) getRequest('p');
     $total = sizeof($result);
     // если запрошена нетипичная постраничка
     if (!$per_page) {
         $per_page = intval(getRequest('per_page'));
     }
     if (!$per_page) {
         $per_page = $this->per_page;
     }
     $result = array_slice($result, $per_page * $p, $per_page);
     $i = $per_page * $p;
     foreach ($result as $num => $element_id) {
         $line_arr = array();
         $element = umiHierarchy::getInstance()->getElement($element_id);
         if (!$element) {
             continue;
         }
         $line_arr['void:num'] = ++$i;
         $line_arr['attribute:id'] = $element_id;
         $line_arr['attribute:name'] = $element->getName();
         $line_arr['attribute:link'] = umiHierarchy::getInstance()->getPathById($element_id);
         $line_arr['xlink:href'] = "upage://" . $element_id;
         $line_arr['node:context'] = searchModel::getInstance()->getContext($element_id, $search_string);
         $line_arr['void:quant'] = $num < count($result) - 1 ? self::parseTemplate($template_line_quant, array()) : "";
         $lines[] = self::parseTemplate($template_line, $line_arr, $element_id);
         $this->pushEditable(false, false, $element_id);
         umiHierarchy::getInstance()->unloadElement($element_id);
     }
     $block_arr['subnodes:items'] = $block_arr['void:lines'] = $lines;
     $block_arr['total'] = $total;
     $block_arr['per_page'] = $per_page;
     return self::parseTemplate($total > 0 ? $template_block : $template_empty_result, $block_arr);
 }
Пример #15
0
 public function album($path = false, $template = "default", $limit = false, $ignore_paging = false)
 {
     $curr_page = (int) getRequest('p');
     $per_page = $limit ? $limit : $this->per_page;
     if ($ignore_paging) {
         $curr_page = 0;
     }
     $element_id = $this->analyzeRequiredPath($path);
     if ($element_id === false && $path != KEYWORD_GRAB_ALL) {
         throw new publicException(getLabel('error-page-does-not-exist', null, $path));
     }
     list($template_block, $template_block_empty, $template_line) = def_module::loadTemplates("photoalbum/" . $template, "album_block", "album_block_empty", "album_block_line");
     $block_arr = array();
     $hierarchy_type_id = umiHierarchyTypesCollection::getInstance()->getTypeByName("photoalbum", "photo")->getId();
     $sel = new umiSelection();
     $sel->addElementType($hierarchy_type_id);
     if ($path != KEYWORD_GRAB_ALL) {
         $sel->addHierarchyFilter($element_id);
     }
     $sel->addPermissions();
     $sel->addLimit($per_page, $curr_page);
     $result = umiSelectionsParser::runSelection($sel);
     $total = umiSelectionsParser::runSelectionCounts($sel);
     $block_arr['id'] = $block_arr['void:album_id'] = $element_id;
     $lines = array();
     if ($total > 0) {
         foreach ($result as $photo_element_id) {
             $line_arr = array();
             $photo_element = umiHierarchy::getInstance()->getElement($photo_element_id);
             if (!$photo_element) {
                 continue;
             }
             $line_arr['attribute:id'] = $photo_element_id;
             $line_arr['attribute:link'] = umiHierarchy::getInstance()->getPathById($photo_element_id);
             $line_arr['xlink:href'] = "upage://" . $photo_element_id;
             $line_arr['node:name'] = $photo_element->getName();
             $this->pushEditable("photoalbum", "photo", $photo_element_id);
             $lines[] = self::parseTemplate($template_line, $line_arr, $photo_element_id);
         }
     } else {
         return self::parseTemplate($template_block_empty, $block_arr, $element_id);
     }
     $block_arr['subnodes:items'] = $block_arr['void:lines'] = $lines;
     $block_arr['total'] = $total;
     $block_arr['per_page'] = $per_page;
     $block_arr['link'] = umiHierarchy::getInstance()->getPathById($element_id);
     return self::parseTemplate($template_block, $block_arr, $element_id);
 }
 public static function objectsByValue($v0f728ec6147eaec54f5f45e37bce8ddd, $v2ef4385ee1f18f02679161fef2b094d9 = NULL, $v95fc2db4375309c569794b723adc3972 = false, $vf80384e7987156531edaa3afd549957d = true, $v8ef57923ab3049b18fb75541ff476ff7 = NULL)
 {
     $v30a7d3f52b5af853f2a7bba352210a34 = array();
     if (!(is_null($v2ef4385ee1f18f02679161fef2b094d9) || is_array($v2ef4385ee1f18f02679161fef2b094d9) || intval($v2ef4385ee1f18f02679161fef2b094d9) === -1 || strval($v2ef4385ee1f18f02679161fef2b094d9) === 'all' || strval($v2ef4385ee1f18f02679161fef2b094d9) == 'Все')) {
         $v2ef4385ee1f18f02679161fef2b094d9 = array($v2ef4385ee1f18f02679161fef2b094d9);
     }
     $v9effabcdaed14aab9cb00acddfa00fc9 = NULL;
     if ($v95fc2db4375309c569794b723adc3972) {
         if (is_null($v8ef57923ab3049b18fb75541ff476ff7)) {
             $v9effabcdaed14aab9cb00acddfa00fc9 = array(cmsController::getInstance()->getCurrentDomain()->getId());
         } elseif (intval($v8ef57923ab3049b18fb75541ff476ff7) === -1 || strval($v8ef57923ab3049b18fb75541ff476ff7) === 'all' || strval($v8ef57923ab3049b18fb75541ff476ff7) == 'Все') {
             $v9effabcdaed14aab9cb00acddfa00fc9 = array();
         } elseif (is_array($v8ef57923ab3049b18fb75541ff476ff7)) {
             $v9effabcdaed14aab9cb00acddfa00fc9 = array_map('intval', $v8ef57923ab3049b18fb75541ff476ff7);
         } else {
             $v9effabcdaed14aab9cb00acddfa00fc9 = array(intval($v8ef57923ab3049b18fb75541ff476ff7));
         }
     }
     $v06e3d36fa30cea095545139854ad1fb9 = umiFieldsCollection::getInstance()->getField($v0f728ec6147eaec54f5f45e37bce8ddd);
     if ($v06e3d36fa30cea095545139854ad1fb9 instanceof umiField) {
         $v5fd6df40d7c4dd7f503475344d8c145c = $v06e3d36fa30cea095545139854ad1fb9->getFieldType()->getDataType();
         $v8ae9391858dfdc11dbd8f15cf9b04a26 = umiFieldType::getDataTypeDB($v5fd6df40d7c4dd7f503475344d8c145c);
     } else {
         throw new coreException("Field #{$v945100186b119048837b9859c2c46410} not found");
     }
     $v6301cee35ea764a1e241978f93f01069 = umiSelectionsParser::getObjectTypeByFieldId($v0f728ec6147eaec54f5f45e37bce8ddd);
     $v80071f37861c360a27b7327e132c911a = umiBranch::getBranchedTableByTypeId($v6301cee35ea764a1e241978f93f01069);
     $v01b41e749613a642fc384ed8af3245fc = "{$v80071f37861c360a27b7327e132c911a} `o`";
     if ($v95fc2db4375309c569794b723adc3972) {
         $v01b41e749613a642fc384ed8af3245fc .= ", cms3_hierarchy `h`";
     }
     if ($v95fc2db4375309c569794b723adc3972) {
         $v7dd0d06edf4c4299ce1a5978eb469fd8 = "h.id";
     } else {
         $v7dd0d06edf4c4299ce1a5978eb469fd8 = "o.obj_id";
     }
     $vc3a74cf64b6ccb62fa49a21123cbc72f = $v95fc2db4375309c569794b723adc3972 ? " AND h.obj_id = o.obj_id AND h.is_active=1 AND h.is_deleted=0" : "";
     if ($v95fc2db4375309c569794b723adc3972 && is_array($v9effabcdaed14aab9cb00acddfa00fc9) && count($v9effabcdaed14aab9cb00acddfa00fc9)) {
         $vc3a74cf64b6ccb62fa49a21123cbc72f .= " AND h.domain_id IN ('" . implode("', '", $v9effabcdaed14aab9cb00acddfa00fc9) . "')";
     }
     $v86f6d00b1c7dbb44f4cd5edf49c29aa0 = "";
     if (!(intval($v2ef4385ee1f18f02679161fef2b094d9) === -1 || strval($v2ef4385ee1f18f02679161fef2b094d9) === 'all' || strval($v2ef4385ee1f18f02679161fef2b094d9) === 'Âñå')) {
         $v86f6d00b1c7dbb44f4cd5edf49c29aa0 = " AND o.{$v8ae9391858dfdc11dbd8f15cf9b04a26} " . (is_null($v2ef4385ee1f18f02679161fef2b094d9) ? "IS NULL" : "IN ('" . implode("', '", $v2ef4385ee1f18f02679161fef2b094d9) . "')");
     }
     if ($vf80384e7987156531edaa3afd549957d) {
         $vf3e7552257b4e44beacffb073506f43d = "SELECT o." . $v8ae9391858dfdc11dbd8f15cf9b04a26 . " as `value`, COUNT(" . $v7dd0d06edf4c4299ce1a5978eb469fd8 . ") as `items` FROM " . $v01b41e749613a642fc384ed8af3245fc . " WHERE o.field_id = " . $v0f728ec6147eaec54f5f45e37bce8ddd . $v86f6d00b1c7dbb44f4cd5edf49c29aa0 . $vc3a74cf64b6ccb62fa49a21123cbc72f . " GROUP BY o." . $v8ae9391858dfdc11dbd8f15cf9b04a26 . " ORDER BY `items`";
     } else {
         $vf3e7552257b4e44beacffb073506f43d = "SELECT DISTINCT " . $v7dd0d06edf4c4299ce1a5978eb469fd8 . " as `item` FROM " . $v01b41e749613a642fc384ed8af3245fc . " WHERE o.field_id = " . $v0f728ec6147eaec54f5f45e37bce8ddd . $v86f6d00b1c7dbb44f4cd5edf49c29aa0 . $vc3a74cf64b6ccb62fa49a21123cbc72f;
     }
     $ve7d010371cfd5717d3d0b7d8e4c87803 = array();
     $v98291d7af1e21c41194125137e4f90ec = l_mysql_query($vf3e7552257b4e44beacffb073506f43d);
     $ved05f7aecf3d274bef532a3ade31ad02 = mysql_errno();
     $v89d8e64b77430ce4f0fe8ead989285bd = l_mysql_error();
     if ($v98291d7af1e21c41194125137e4f90ec === false || $ved05f7aecf3d274bef532a3ade31ad02) {
         throw new coreException("Error executing db query (errno " . $ved05f7aecf3d274bef532a3ade31ad02 . ", error " . $v89d8e64b77430ce4f0fe8ead989285bd . ", query " . $vf3e7552257b4e44beacffb073506f43d . ")");
     } else {
         while ($v7b93a31f8c7688c32c5a551b0e4937ee = mysql_fetch_assoc($v98291d7af1e21c41194125137e4f90ec)) {
             $ve7d010371cfd5717d3d0b7d8e4c87803[] = $v7b93a31f8c7688c32c5a551b0e4937ee;
         }
     }
     if ($vf80384e7987156531edaa3afd549957d) {
         $v30a7d3f52b5af853f2a7bba352210a34['values'] = array();
         $vae886317ab0305e3e6a1638659ea03fa = 0;
         $v663ccf380acaf3f549f1612654dc109d = 0;
         foreach ($ve7d010371cfd5717d3d0b7d8e4c87803 as $vabd12a9143f26fa85e562e69c01c48db) {
             $v97023380f9705264978115e6ce880ca5 = intval($vabd12a9143f26fa85e562e69c01c48db['items']);
             $v30a7d3f52b5af853f2a7bba352210a34['values'][] = array('value' => $vabd12a9143f26fa85e562e69c01c48db['value'], 'cnt' => $v97023380f9705264978115e6ce880ca5);
             if ($v97023380f9705264978115e6ce880ca5 > $vae886317ab0305e3e6a1638659ea03fa) {
                 $vae886317ab0305e3e6a1638659ea03fa = $v97023380f9705264978115e6ce880ca5;
             }
             $v663ccf380acaf3f549f1612654dc109d += $v97023380f9705264978115e6ce880ca5;
         }
         $v30a7d3f52b5af853f2a7bba352210a34['max'] = $vae886317ab0305e3e6a1638659ea03fa;
         $v30a7d3f52b5af853f2a7bba352210a34['sum'] = $v663ccf380acaf3f549f1612654dc109d;
     } else {
         foreach ($ve7d010371cfd5717d3d0b7d8e4c87803 as $vabd12a9143f26fa85e562e69c01c48db) {
             $v30a7d3f52b5af853f2a7bba352210a34[] = $vabd12a9143f26fa85e562e69c01c48db['item'];
         }
     }
     return $v30a7d3f52b5af853f2a7bba352210a34;
 }
Пример #17
0
		public function getObjectsByTypeId($objectTypeId) {
			$objects = umiObjectsCollection::getInstance();

			$sel = new umiSelection;
			$sel->addObjectType($objectTypeId);
			$result = umiSelectionsParser::runSelection($sel);

			$items_arr = Array();
			foreach($result as $objectId) {
				$object = $objects->getObject($objectId);
				if($object instanceof umiObject) {
					$items_arr[] = $object;
				}
			}
			$block_arr = Array("items" => Array("nodes:item" => $items_arr));
			return $block_arr;
		}
Пример #18
0
 public function collectAllChanges($module, $method, $parentElementId = false)
 {
     $endTime = time();
     $beginTime = $endTime - 3600 * 24 * 30;
     $hierarchy_type_id = umiHierarchyTypesCollection::getInstance()->getTypeByName($module, $method)->getId();
     $object_type_id = umiObjectTypesCollection::getInstance()->getBaseType($module, $method);
     $object_type = umiObjectTypesCollection::getInstance()->getType($object_type_id);
     $publish_time_field_id = $object_type->getFieldId('publish_time');
     $sel = new umiSelection();
     $sel->setElementTypeFilter();
     $sel->addElementType($hierarchy_type_id);
     $sel->setPermissionsFilter();
     $sel->addPermissions();
     $sel->setOrderFilter();
     $sel->setOrderByProperty($publish_time_field_id, false);
     $sel->setPropertyFilter();
     $sel->addPropertyFilterBetween($publish_time_field_id, $beginTime, $endTime);
     if ($parentElementId !== false) {
         if (!is_numeric($parentElementId)) {
             $parentElementId = umiHierarchy::getInstance()->getIdByPath($parentElementId);
         }
         $sel->setHierarchyFilter();
         $sel->addHierarchyFilter($parentElementId);
     }
     $result = umiSelectionsParser::runSelection($sel);
     $total = umiSelectionsParser::runSelectionCounts($sel);
     $res = array();
     foreach ($result as $elementId) {
         $childs = sizeof(umiHierarchy::getInstance()->getChilds($elementId));
         $res[] = array("id" => $elementId, "childs" => $childs);
     }
     return array("result" => $res, "total" => $total);
 }
Пример #19
0
		public function activate($template = "default") {
			if ($this->is_auth()) $this->redirect("/");

			if(!$template) $template = "default";

			list($template_block, $template_block_failed) = def_module::loadTemplates("users/register/".$template, "activate_block", "activate_block_failed");

			$block_arr = Array();

			$activate_code = (string) getRequest('param0');

			if(!$activate_code || strlen($activate_code) != 32) {
				throw new publicException("%error_activation_code_failed%");
				$template = $template_block_failed;
			}

			$typesCollection = umiObjectTypesCollection::getInstance();

			$object_type_id = $typesCollection->getBaseType("users", "user");
			$object_type = $typesCollection->getType($object_type_id);
			$childTypes = $typesCollection->getChildClasses($object_type_id);


			$activate_code_field_id = $object_type->getFieldId("activate_code");

			$sel = new umiSelection;
			$sel->addLimit(1);
			$sel->addObjectType($object_type_id);
			$sel->addObjectType($childTypes);
			$sel->addPropertyFilterEqual($activate_code_field_id, $activate_code);

			$result = umiSelectionsParser::runSelection($sel);

			if($result) {
				list($user_id) = $result;

				$user = umiObjectsCollection::getInstance()->getObject($user_id);
				$user->setValue("is_activated", 1);
				$user->setValue("activate_code", md5(uniqid(rand(), true)));
				$user->commit();

				permissionsCollection::getInstance()->loginAsUser($result);

				$oEventPoint = new umiEventPoint("users_activate");
				$oEventPoint->setMode("after");
				$oEventPoint->setParam("user_id", $user_id);
				$this->setEventPoint($oEventPoint);

				$template = $template_block;
			} else {
				throw new publicException("%error_activation_code_failed%");
				$template = $template_block_failed;
			}

			return def_module::parseTemplate($template, $block_arr);
		}
Пример #20
0
 public function tryPreAuth()
 {
     $v870fd5468174f846789cb0d56d95bed7 = "";
     $v61b14997da4f52f41ee7b0d90f09e670 = "";
     $ve218c54eefdbe103350435489a6595cb = "";
     $v2b2dccfdbf6e767de8512d66da6d18ca = 'u-login';
     $vad1ffbcb1d643a30a5f6cc9950526e81 = 'u-password';
     $ve57492e1c3bb8975edf9399351741cf8 = 'u-password-md5';
     $v0a7cb1c6ec211bc445c36725ebfb7bab = 'u-session-id';
     $v50b6116b0f49a6cb34e310d17da0ccc4 = ini_get("session.name");
     if ($v870fd5468174f846789cb0d56d95bed7 = getCookie($v2b2dccfdbf6e767de8512d66da6d18ca)) {
         if ($v61b14997da4f52f41ee7b0d90f09e670 = getCookie($vad1ffbcb1d643a30a5f6cc9950526e81)) {
             $v61b14997da4f52f41ee7b0d90f09e670 = md5($v61b14997da4f52f41ee7b0d90f09e670);
         } else {
             $v61b14997da4f52f41ee7b0d90f09e670 = getCookie($ve57492e1c3bb8975edf9399351741cf8);
         }
     }
     if (function_exists('apache_request_headers')) {
         $v47722c9511693b9a32d48982e48a7b9b = apache_request_headers();
         if (isset($v47722c9511693b9a32d48982e48a7b9b[$v2b2dccfdbf6e767de8512d66da6d18ca])) {
             $v870fd5468174f846789cb0d56d95bed7 = umiObjectProperty::filterInputString(str_replace(chr(0), "", $v47722c9511693b9a32d48982e48a7b9b[$v2b2dccfdbf6e767de8512d66da6d18ca]));
         }
         if (isset($v47722c9511693b9a32d48982e48a7b9b[$ve57492e1c3bb8975edf9399351741cf8])) {
             $v61b14997da4f52f41ee7b0d90f09e670 = umiObjectProperty::filterInputString(str_replace(chr(0), "", $v47722c9511693b9a32d48982e48a7b9b[$ve57492e1c3bb8975edf9399351741cf8]));
         } elseif (isset($v47722c9511693b9a32d48982e48a7b9b[$vad1ffbcb1d643a30a5f6cc9950526e81])) {
             $v61b14997da4f52f41ee7b0d90f09e670 = md5(umiObjectProperty::filterInputString(str_replace(chr(0), "", $v47722c9511693b9a32d48982e48a7b9b[$vad1ffbcb1d643a30a5f6cc9950526e81])));
         }
         if (isset($v47722c9511693b9a32d48982e48a7b9b[$v0a7cb1c6ec211bc445c36725ebfb7bab])) {
             $ve218c54eefdbe103350435489a6595cb = umiObjectProperty::filterInputString(str_replace(chr(0), "", $v47722c9511693b9a32d48982e48a7b9b[$v0a7cb1c6ec211bc445c36725ebfb7bab]));
         }
     }
     if (isset($_POST[$v2b2dccfdbf6e767de8512d66da6d18ca])) {
         $v870fd5468174f846789cb0d56d95bed7 = umiObjectProperty::filterInputString(str_replace(chr(0), "", $_POST[$v2b2dccfdbf6e767de8512d66da6d18ca]));
     }
     if (isset($_POST[$ve57492e1c3bb8975edf9399351741cf8])) {
         $v61b14997da4f52f41ee7b0d90f09e670 = umiObjectProperty::filterInputString(str_replace(chr(0), "", $_POST[$ve57492e1c3bb8975edf9399351741cf8]));
     } elseif (isset($_POST[$vad1ffbcb1d643a30a5f6cc9950526e81])) {
         $v61b14997da4f52f41ee7b0d90f09e670 = md5(umiObjectProperty::filterInputString(str_replace(chr(0), "", $_POST[$vad1ffbcb1d643a30a5f6cc9950526e81])));
     }
     if (isset($_POST[$v0a7cb1c6ec211bc445c36725ebfb7bab])) {
         $ve218c54eefdbe103350435489a6595cb = umiObjectProperty::filterInputString(str_replace(chr(0), "", $_POST[$v0a7cb1c6ec211bc445c36725ebfb7bab]));
     }
     if (isset($_GET[$v2b2dccfdbf6e767de8512d66da6d18ca])) {
         $v870fd5468174f846789cb0d56d95bed7 = umiObjectProperty::filterInputString(str_replace(chr(0), "", $_GET[$v2b2dccfdbf6e767de8512d66da6d18ca]));
     }
     if (isset($_GET[$ve57492e1c3bb8975edf9399351741cf8])) {
         $v61b14997da4f52f41ee7b0d90f09e670 = umiObjectProperty::filterInputString(str_replace(chr(0), "", $_GET[$ve57492e1c3bb8975edf9399351741cf8]));
     } elseif (isset($_GET[$vad1ffbcb1d643a30a5f6cc9950526e81])) {
         $v61b14997da4f52f41ee7b0d90f09e670 = md5(umiObjectProperty::filterInputString(str_replace(chr(0), "", $_GET[$vad1ffbcb1d643a30a5f6cc9950526e81])));
     }
     if (isset($_GET[$v0a7cb1c6ec211bc445c36725ebfb7bab])) {
         $ve218c54eefdbe103350435489a6595cb = umiObjectProperty::filterInputString(str_replace(chr(0), "", $_GET[$v0a7cb1c6ec211bc445c36725ebfb7bab]));
     }
     if (strlen($v870fd5468174f846789cb0d56d95bed7) && strlen($v61b14997da4f52f41ee7b0d90f09e670)) {
         $vf5b788937450a693e6cbec05d8b8b13f = umiObjectTypesCollection::getInstance()->getBaseType("users", "user");
         $v8636cb7e3d45cd4e1e8e863d3286393e = umiObjectTypesCollection::getInstance()->getType($vf5b788937450a693e6cbec05d8b8b13f);
         $v8f671407d6df210b2670166a82e0fc1a = $v8636cb7e3d45cd4e1e8e863d3286393e->getFieldId("login");
         $v98fc9fb0068cf0cdca3ce2e0cb0843d6 = $v8636cb7e3d45cd4e1e8e863d3286393e->getFieldId("password");
         $v713d1619aba4eeb6679aec2b499e1b33 = $v8636cb7e3d45cd4e1e8e863d3286393e->getFieldId("is_activated");
         $v8be74552df93e31bbdd6b36ed74bdb6a = new umiSelection();
         $v8be74552df93e31bbdd6b36ed74bdb6a->setLimitFilter();
         $v8be74552df93e31bbdd6b36ed74bdb6a->addLimit(1);
         $v8be74552df93e31bbdd6b36ed74bdb6a->setObjectTypeFilter();
         $v8be74552df93e31bbdd6b36ed74bdb6a->addObjectType($vf5b788937450a693e6cbec05d8b8b13f);
         $v8be74552df93e31bbdd6b36ed74bdb6a->setPropertyFilter();
         $v8be74552df93e31bbdd6b36ed74bdb6a->addPropertyFilterEqual($v8f671407d6df210b2670166a82e0fc1a, $v870fd5468174f846789cb0d56d95bed7);
         $v8be74552df93e31bbdd6b36ed74bdb6a->addPropertyFilterEqual($v98fc9fb0068cf0cdca3ce2e0cb0843d6, $v61b14997da4f52f41ee7b0d90f09e670);
         $v8be74552df93e31bbdd6b36ed74bdb6a->addPropertyFilterEqual($v713d1619aba4eeb6679aec2b499e1b33, 1);
         $result = umiSelectionsParser::runSelection($v8be74552df93e31bbdd6b36ed74bdb6a);
         if (sizeof($result) === 1) {
             $vbc8a7343779d62b3f0dc86f78848bde1 = intval($result[0]);
             if (!session_id()) {
                 session_start();
             }
             $vc87c62534434262e1d1c1348215684ef = session_id();
             system_runSession();
             if (strlen($vc87c62534434262e1d1c1348215684ef) && isset($_SESSION) && isset($_SESSION['cms_login']) && isset($_SESSION['cms_pass']) && isset($_SESSION['user_id']) && $_SESSION['cms_login'] === $v870fd5468174f846789cb0d56d95bed7 && $_SESSION['cms_pass'] === $v61b14997da4f52f41ee7b0d90f09e670 && $_SESSION['user_id'] === $vbc8a7343779d62b3f0dc86f78848bde1) {
                 $_SESSION['starttime'] = time();
                 return self::PREAUTH_ALREADY;
             }
             if (strlen($ve218c54eefdbe103350435489a6595cb)) {
                 if (strlen($vc87c62534434262e1d1c1348215684ef)) {
                     session_destroy();
                 }
                 session_id($ve218c54eefdbe103350435489a6595cb);
                 session_start();
                 $_SESSION['starttime'] = time();
                 if (!(isset($_SESSION['cms_login']) && isset($_SESSION['cms_pass']) && isset($_SESSION['user_id']) && $_SESSION['cms_login'] === $v870fd5468174f846789cb0d56d95bed7 && $_SESSION['cms_pass'] === $v61b14997da4f52f41ee7b0d90f09e670 && $_SESSION['user_id'] === $vbc8a7343779d62b3f0dc86f78848bde1)) {
                     session_destroy();
                 } else {
                     $vd69634a59b2cc5df7d632e48474afc94 = new umiEventPoint("users_prelogin_successfull");
                     $vd69634a59b2cc5df7d632e48474afc94->setParam("prelogin_mode", self::PREAUTH_SUCCESS_RESTORE);
                     $vd69634a59b2cc5df7d632e48474afc94->setParam("user_id", $vbc8a7343779d62b3f0dc86f78848bde1);
                     umiEventsController::getInstance()->callEvent($vd69634a59b2cc5df7d632e48474afc94);
                     return self::PREAUTH_SUCCESS_RESTORE;
                 }
             } else {
                 @session_start();
                 $_SESSION['cms_login'] = $v870fd5468174f846789cb0d56d95bed7;
                 $_SESSION['cms_pass'] = $v61b14997da4f52f41ee7b0d90f09e670;
                 $_SESSION['user_id'] = $vbc8a7343779d62b3f0dc86f78848bde1;
                 $v41275a535677f79ff347e01bc530c176 = permissionsCollection::getInstance();
                 if ($v41275a535677f79ff347e01bc530c176->isSv($vbc8a7343779d62b3f0dc86f78848bde1)) {
                     $_SESSION['user_is_sv'] = true;
                 }
                 session_commit();
                 session_start();
                 $_SESSION['starttime'] = time();
                 $vd69634a59b2cc5df7d632e48474afc94 = new umiEventPoint("users_prelogin_successfull");
                 $vd69634a59b2cc5df7d632e48474afc94->setParam("prelogin_mode", self::PREAUTH_SUCCESS_NEW);
                 $vd69634a59b2cc5df7d632e48474afc94->setParam("user_id", $vbc8a7343779d62b3f0dc86f78848bde1);
                 umiEventsController::getInstance()->callEvent($vd69634a59b2cc5df7d632e48474afc94);
                 if (isset($_REQUEST['u-login-store']) && (intval($_REQUEST['u-login-store']) || strtoupper($_REQUEST['u-login-store']) === 'ON')) {
                     setcookie($v2b2dccfdbf6e767de8512d66da6d18ca, $v870fd5468174f846789cb0d56d95bed7, time() + 60 * 60 * 24 * 31, "/");
                     setcookie($ve57492e1c3bb8975edf9399351741cf8, $v61b14997da4f52f41ee7b0d90f09e670, time() + 60 * 60 * 24 * 31, "/");
                 }
                 return self::PREAUTH_SUCCESS_NEW;
             }
         }
     }
     return self::PREAUTH_INVALID;
 }
Пример #21
0
 public function getGroupUsersCount($groupId = false)
 {
     $objectTypes = umiObjectTypesCollection::getInstance();
     $userObjectTypeId = $objectTypes->getBaseType('users', 'user');
     $userObjectType = $objectTypes->getType($userObjectTypeId);
     if ($userObjectType instanceof umiObjectType == false) {
         throw new publicException("Can't load user object type");
     }
     $sel = new umiSelection();
     $sel->addObjectType($userObjectTypeId);
     if ($groupId !== false) {
         if ($groupId != 0) {
             $sel->addPropertyFilterEqual($userObjectType->getFieldId('groups'), $groupId);
         } else {
             $sel->addPropertyFilterIsNull($userObjectType->getFieldId('groups'));
         }
     }
     return umiSelectionsParser::runSelectionCounts($sel);
 }
Пример #22
0
	public function projects($template = "default", $limit = false, $ignore_paging = false) {
		list($template_block, $template_block_empty, $template_line) = def_module::loadTemplates("faq/".$template, "projects_block", "projects_block_empty", "projects_block_line");

		$hierarchy_type_id = umiHierarchyTypesCollection::getInstance()->getTypeByName("faq", "project")->getId();

		$per_page = ($limit) ? $limit : $this->per_page;
		$curr_page = (int) getRequest('p');
		if($ignore_paging) $curr_page = 0;

		$sel = new umiSelection;
		$sel->addElementType($hierarchy_type_id);
		$sel->addLimit($per_page, $curr_page);
		$sel->addPermissions();
		$result = umiSelectionsParser::runSelection($sel);
		$total = umiSelectionsParser::runSelectionCounts($sel);

		if(($sz = sizeof($result)) > 0) {
			$block_arr = Array();

			$lines = Array();
			for($i = 0; $i < $sz; $i++) {
				if ($i < $limit || $limit === false) {
					$element_id = $result[$i];
					$element = umiHierarchy::getInstance()->getElement($element_id);

					if(!$element) continue;

					$line_arr = Array();
					$line_arr['attribute:id'] = $element_id;
					$line_arr['attribute:name'] = $line_arr['void:text'] = $element->getName();
					$line_arr['void:alt_name'] = $element->getAltName();
					$line_arr['attribute:link'] = $element->link;
					$line_arr['xlink:href'] = "upage://" . $element_id;

					$this->pushEditable("faq", "project", $element_id);
					$lines[] = self::parseTemplate($template_line, $line_arr, $element_id);
				}
			}

			$block_arr['subnodes:lines'] = $lines;
			$block_arr['total'] = $total;
			$block_arr['per_page'] = $per_page;

			return self::parseTemplate($template_block, $block_arr);
		} else {
			return $template_block_empty;
		}
	}
Пример #23
0
 public function lastlents($elementPath, $template = "default", $per_page = false, $ignore_paging = false)
 {
     if (!$per_page) {
         $per_page = $this->per_page;
     }
     list($template_block, $template_block_empty, $template_line, $template_archive) = def_module::loadTemplates("news/" . $template, "listlents_block", "listlents_block_empty", "listlents_item", "listlents_archive");
     $curr_page = (int) getRequest('p');
     if ($ignore_paging) {
         $curr_page = 0;
     }
     $parent_id = $this->analyzeRequiredPath($elementPath);
     if ($parent_id === false) {
         throw new publicException(getLabel('error-page-does-not-exist', null, $elementPath));
     }
     $hierarchy_type_id = umiHierarchyTypesCollection::getInstance()->getTypeByName("news", "rubric")->getId();
     $sel = new umiSelection();
     $sel->addElementType($hierarchy_type_id);
     $sel->addHierarchyFilter($parent_id, 0, true);
     $sel->addPermissions();
     $sel->addLimit($per_page, $curr_page);
     $result = umiSelectionsParser::runSelection($sel);
     $total = umiSelectionsParser::runSelectionCounts($sel);
     if (($sz = sizeof($result)) > 0) {
         $block_arr = array();
         $lines = array();
         for ($i = 0; $i < $sz; $i++) {
             $line_arr = array();
             $element_id = $result[$i];
             $element = umiHierarchy::getInstance()->getElement($element_id);
             $line_arr['attribute:id'] = $element_id;
             $line_arr['attribute:link'] = umiHierarchy::getInstance()->getPathById($element_id);
             $line_arr['xlink:href'] = "upage://" . $element_id;
             $line_arr['void:header'] = $lines_arr['name'] = $element->getName();
             $line_arr['node:name'] = $element->getName();
             $lines[] = self::parseTemplate($template_line, $line_arr, $element_id);
             $this->pushEditable("news", "rubric", $element_id);
         }
         if (is_array($parent_id)) {
             list($parent_id) = $parent_id;
         }
         $block_arr['subnodes:items'] = $block_arr['void:lines'] = $lines;
         $block_arr['total'] = $total;
         $block_arr['per_page'] = $per_page;
         return self::parseTemplate($template_block, $block_arr, $parent_id);
     } else {
         return $template_block_empty;
     }
 }
 /**
  * Установка активности поля в зависимости от набранных фильтров
  */
 protected function setState(&$arField)
 {
     $bNeedRestoreFields = $bNeedRestoreKFields = false;
     $fields_filter = isset($_REQUEST['fields_filter']) ? $_REQUEST['fields_filter'] : array();
     $k_fields_filter = isset($_REQUEST['k_fields_filter']) ? $_REQUEST['k_fields_filter'] : array();
     $field_name = $arField['name'];
     if (isset($fields_filter[$field_name])) {
         $bNeedRestoreFields = $fields_filter[$field_name];
         unset($_REQUEST['fields_filter'][$field_name]);
     }
     if (isset($k_fields_filter[$field_name])) {
         $bNeedRestoreKFields = $k_fields_filter[$field_name];
         unset($_REQUEST['k_fields_filter'][$field_name]);
     }
     $iFieldId = $arField['id'];
     switch ($arField['type']) {
         case "boolean":
             $sel = $this->getCurrentCountSelection();
             $sel->addPropertyFilterEqual($iFieldId, 1);
             $sqls = umiSelectionsParser::parseSelection($sel);
             $query_key = trim(str_replace(array("\n", "\r", "\t", " "), "", $sqls['count']));
             $count = 0;
             //Count of goods with this value, with selected filters but without filering on this field
             if ($query_key) {
                 $oCache = kFilters::getInstance($this->catalogId)->getCache();
                 //try load from cache
                 $count = $oCache->getQuery($query_key, $this->catalogId);
                 if (is_null($count)) {
                     $count = umiSelectionsParser::runSelectionCounts($sel);
                     //save to cache
                     $oCache->saveQuery($count, $query_key, $this->catalogId);
                 }
             }
             if ($count == 0) {
                 $arField['active'] = false;
             } else {
                 $arField['active'] = true;
             }
             break;
         case "option":
             $arValues = $arField['values'];
             foreach ($arValues as $i => $arValue) {
                 $sel = $this->getCurrentCountSelection();
                 $sel->addPropertyFilterEqual($iFieldId, $arValue['id']);
                 $sqls = umiSelectionsParser::parseSelection($sel);
                 $query_key = trim(str_replace(array("\n", "\r", "\t", " "), "", $sqls['count']));
                 $count = 0;
                 //Count of goods with this value, with selected filters but without filering on this field
                 if ($query_key) {
                     $oCache = kFilters::getInstance($this->catalogId)->getCache();
                     //try load from cache
                     $count = $oCache->getQuery($query_key, $this->catalogId);
                     if (is_null($count)) {
                         $count = umiSelectionsParser::runSelectionCounts($sel);
                         //save to cache
                         $oCache->saveQuery($count, $query_key, $this->catalogId);
                     }
                 }
                 if ($count == 0) {
                     $arField['values'][$i]['active'] = false;
                 } else {
                     $arField['values'][$i]['active'] = true;
                 }
             }
             break;
     }
     if ($bNeedRestoreFields !== false) {
         $_REQUEST['fields_filter'][$field_name] = $bNeedRestoreFields;
     }
     if ($bNeedRestoreKFields !== false) {
         $_REQUEST['k_fields_filter'][$field_name] = $bNeedRestoreKFields;
     }
 }
Пример #25
0
	public function is_auth() {
		static $is_auth;

		if($is_auth === false || $is_auth === true) {
			return $is_auth;
		}

		$guest_id = umiObjectsCollection::getInstance()->getObjectIdByGUID('system-guest');

		$user_id = getSession('user_id');
		$login = getSession('cms_login');
		$pass = getSession('cms_pass');

		$this->user_login = "******";
		$this->user_fullname = "%users_anonymous_fullname%";

		if($user_id) {
			if($user_id == $guest_id) {
				$this->user_id = $user_id;
				return $is_auth = false;
			} else {
				$user = umiObjectsCollection::getInstance()->getObject($user_id);
				if($user instanceof umiObject) {
					if($pass != $user->getValue('password')) {
						unset($_SESSION['user_id']);
						$this->user_id = $guest_id;
						return $is_auth = false;
					}

					$login = $user->getValue('login');
					$fname = $user->getValue('fname');
					$lname = $user->getValue('lname');
					$groups = $user->getValue('groups');

					$this->groups = $groups;
					$this->user_id = $user_id;

					$this->user_login = $login;
					$this->user_fullname = "{$fname} {$lname}";

					$this->updateUserLastRequestTime($user_id);

					system_runSession();

					return $is_auth = true;
				}
			}
		}


		if($login && $pass) {
			$objectTypes = umiObjectTypesCollection::getInstance();

			$object_type_id = $objectTypes->getBaseType("users", "user");
			$object_type = $objectTypes->getType($object_type_id);
			$login_field_id = $object_type->getFieldId("login");
			$password_field_id = $object_type->getFieldId("password");

			$sel = new umiSelection;
			$sel->addLimit(1);
			$sel->addObjectType($objectTypes->getChildClasses($object_type_id));
			$sel->addPropertyFilterEqual($login_field_id, $login);
			$sel->addPropertyFilterEqual($password_field_id, $pass);

			$result = umiSelectionsParser::runSelection($sel);
		} else {
			$result = Array();
		}

		if(sizeof($result) == 1) {
			$user_id = $result[0];
			$user_object = umiObjectsCollection::getInstance()->getObject($user_id);

			$login = $user_object->getValue("login");
			$fname = $user_object->getValue("fname");
			$lname = $user_object->getValue("lname");

			$this->updateUserLastRequestTime($user_id);

			$groups = $user_object->getValue("groups");

			$this->groups = $groups;
			$this->user_id = $user_id;

			$this->user_login = $login;
			$this->user_fullname = "{$fname} {$lname}";

			$_SESSION['user_id'] = $user_id;

			system_runSession();

			return $is_auth = true;
		} else {
			$this->user_id = $guest_id;

			$_SESSION['user_id'] = $guest_id;

			return $is_auth = false;
		}
	}
Пример #26
0
 public function count()
 {
     return umiSelectionsParser::runSelectionCounts($this);
 }
Пример #27
0
<?php

if (!defined('DB_DRIVER') || DB_DRIVER != 'xml') {
    $oCollection = umiObjectsCollection::getInstance();
    $iTypeId = umiObjectTypesCollection::getInstance()->getBaseType('webforms', 'address');
    $sSQL = 'SELECT `id`, `email`, `descr` FROM cms_webforms';
    $rResult = l_mysql_query($sSQL);
    while ($aRow = mysql_fetch_assoc($rResult)) {
        $iId = $oCollection->addObject($aRow['id'], $iTypeId);
        $oObject = $oCollection->getObject($iId);
        $oObject->setValue('address_description', $aRow['descr']);
        $oObject->setValue('address_list', $aRow['email']);
        $oObject->setValue('insert_id', $aRow['id']);
        $oObject->commit();
    }
    l_mysql_query('TRUNCATE TABLE cms_webforms');
}
$oPCollection = permissionsCollection::getInstance();
$iUserTypeID = umiObjectTypesCollection::getInstance()->getBaseType('users', 'user');
$oSelection = new umiSelection();
$oSelection->addObjectType($iUserTypeID);
$aUIDs = umiSelectionsParser::runSelection($oSelection);
if (is_array($aUIDs) && !empty($aUIDs)) {
    foreach ($aUIDs as $iUserID) {
        $oPCollection->setModulesPermissions($iUserID, 'webforms', 'add');
    }
}
Пример #28
0
 public function searchRelationValues($field, $value)
 {
     if (is_array($value)) {
         $result = array();
         foreach ($value as $sval) {
             $result[] = $this->searchRelationValues($field, $sval);
         }
         return $result;
     }
     $guideId = $field->getGuideId();
     if ($guideId) {
         if (is_numeric($value)) {
             return $value;
         } else {
             $sel = new umiSelection();
             $sel->addObjectType($guideId);
             $sel->searchText($value);
             $result = umiSelectionsParser::runSelection($sel);
             return sizeof($result) ? $result : array(-1);
         }
     } else {
         return $value;
     }
 }
Пример #29
0
 public function rename()
 {
     $s_path = $this->getCurrentPath();
     if (defined("CURRENT_VERSION_LINE") && CURRENT_VERSION_LINE == "demo") {
         $this->chooseRedirect('/admin/filemanager/directory_list/?dir=' . base64_encode($s_path));
         return false;
     }
     $s_old_name = getRequest('old_name');
     $s_new_name = getRequest('new_name');
     if (!$this->checkIsAllowedPath($s_path . "/" . $s_old_name)) {
         throw new publicAdminException(getLabel('error-fs-not-allowed'));
     }
     $s_new_name_arr = explode(".", $s_new_name);
     foreach ($s_new_name_arr as &$sn) {
         $sn = translit::convert($sn);
     }
     $s_new_name = implode(".", $s_new_name_arr);
     if (strlen($s_path) && strlen($s_old_name) && strlen($s_new_name)) {
         if (file_exists($s_path . "/" . $s_old_name) && !file_exists($s_path . "/" . $s_new_name)) {
             // try rename
             if (@rename($s_path . "/" . $s_old_name, $s_path . "/" . $s_new_name) === false) {
                 throw new publicAdminException(getLabel('error-cant-rename-dir'));
             } else {
                 $typesCollection = umiObjectTypesCollection::getInstance();
                 $objectsCollection = umiObjectsCollection::getInstance();
                 $selection = new umiSelection();
                 $typeId = $typesCollection->getBaseType("filemanager", "shared_file");
                 $type = $typesCollection->getType($typeId);
                 $selection->addObjectType($typeId);
                 $selection->addPropertyFilterLike($type->getFieldId('fs_file'), './' . $s_path . "/" . $s_old_name);
                 $sfiles = umiSelectionsParser::runSelection($selection);
                 foreach ($sfiles as $sfileId) {
                     if ($file = $objectsCollection->getObject($sfileId)) {
                         $file->setValue('fs_file', new umiFile('./' . $s_path . "/" . $s_new_name));
                     }
                 }
             }
         }
     }
     $this->chooseRedirect('/admin/filemanager/directory_list/?dir=' . base64_encode($s_path));
 }
 /**
  * Сбросить настройки прав до дефолтных для страницы (класс umiHierarchyElement) $element_id
  * @param Integer $element_id id страницы (класс umiHierarchyElement)
  * @return Boolean false если произошла ошибка
  */
 public function setDefaultPermissions($element_id)
 {
     $element_id = (int) $element_id;
     if (!umiHierarchy::getInstance()->isExists($element_id)) {
         return false;
     }
     l_mysql_query("START TRANSACTION");
     $sql = "DELETE FROM cms3_permissions WHERE rel_id = '{$element_id}'";
     l_mysql_query($sql);
     $element = umiHierarchy::getInstance()->getElement($element_id, true, true);
     $hierarchy_type_id = $element->getTypeId();
     $hierarchy_type = umiHierarchyTypesCollection::getInstance()->getType($hierarchy_type_id);
     $module = $hierarchy_type->getName();
     $method = $hierarchy_type->getExt();
     //Getting outgroup users
     $type_id = umiObjectTypesCollection::getInstance()->getBaseType("users", "user");
     $sel = new umiSelection();
     $sel->setObjectTypeFilter();
     $sel->addObjectType($type_id);
     $group_field_id = umiObjectTypesCollection::getInstance()->getType($type_id)->getFieldId("groups");
     $sel->setPropertyFilter();
     $sel->addPropertyFilterIsNull($group_field_id);
     $users = umiSelectionsParser::runSelection($sel);
     //Getting groups list
     $object_type_id = umiObjectTypesCollection::getInstance()->getBaseType("users", "users");
     $sel = new umiSelection();
     $sel->setObjectTypeFilter();
     $sel->addObjectType($object_type_id);
     $groups = umiSelectionsParser::runSelection($sel);
     $objects = array_merge($users, $groups);
     //Let's get element's ownerId and his groups (if user)
     $owner_id = $element->getObject()->getOwnerId();
     if ($owner = umiObjectsCollection::getInstance()->getObject($owner_id)) {
         if ($owner_groups = $owner->getValue("groups")) {
             $owner_arr = $owner_groups;
         } else {
             $owner_arr = array($owner_id);
         }
     } else {
         $owner_arr = array();
     }
     foreach ($objects as $ugid) {
         if ($ugid == SV_GROUP_ID) {
             continue;
         }
         if ($module == "content") {
             $method == "page";
         }
         if ($this->isAllowedMethod($ugid, $module, $method)) {
             if (in_array($ugid, $owner_arr) || $ugid == SV_GROUP_ID || $this->isAllowedMethod($ugid, $module, $method . ".edit")) {
                 $level = permissionsCollection::E_READ_ALLOWED_BIT + permissionsCollection::E_EDIT_ALLOWED_BIT + permissionsCollection::E_CREATE_ALLOWED_BIT + permissionsCollection::E_DELETE_ALLOWED_BIT + permissionsCollection::E_MOVE_ALLOWED_BIT;
             } else {
                 $level = permissionsCollection::E_READ_ALLOWED_BIT;
             }
             $sql = "INSERT INTO cms3_permissions (rel_id, owner_id, level) VALUES('{$element_id}', '{$ugid}', '{$level}')";
             l_mysql_query($sql);
         }
     }
     l_mysql_query("COMMIT");
     l_mysql_query("SET AUTOCOMMIT=1");
     $this->cleanupElementPermissions($element_id);
     if (isset($this->elementsCache[$element_id])) {
         unset($this->elementsCache[$element_id]);
     }
     $cache_key = $this->getUserId() . "." . $element_id;
     cacheFrontend::getInstance()->saveSql($cache_key, array(true, true));
 }