Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
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);
     }
 }
Ejemplo n.º 4
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);
 }
Ejemplo n.º 5
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;
 }
 /**
  * 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;
 }
 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;
 }
Ejemplo n.º 8
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));
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 10
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();
         }
     }
 }
Ejemplo n.º 11
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;
 }
 protected static function chooseContentTableName(umiSelection $vef5714e0519bfaa645cdff7d28843b70, $v945100186b119048837b9859c2c46410)
 {
     $v6942e8fa62b3cc9d93881a58210e2fd7 = $vef5714e0519bfaa645cdff7d28843b70->getElementTypeConds();
     $v0e8133eb006c0f85ed9444ae07a60842 = $vef5714e0519bfaa645cdff7d28843b70->getObjectTypeConds();
     if (!is_array($v6942e8fa62b3cc9d93881a58210e2fd7)) {
         $v6942e8fa62b3cc9d93881a58210e2fd7 = array();
     } else {
         $v6942e8fa62b3cc9d93881a58210e2fd7 = array_extract_values($v6942e8fa62b3cc9d93881a58210e2fd7);
     }
     if (!is_array($v0e8133eb006c0f85ed9444ae07a60842)) {
         $v0e8133eb006c0f85ed9444ae07a60842 = array();
     } else {
         $v0e8133eb006c0f85ed9444ae07a60842 = array_extract_values($v0e8133eb006c0f85ed9444ae07a60842);
     }
     if (sizeof($v6942e8fa62b3cc9d93881a58210e2fd7) == 1) {
         reset($v6942e8fa62b3cc9d93881a58210e2fd7);
         $vacf567c9c3d6cf7c6e2cc0ce108e0631 = current($v6942e8fa62b3cc9d93881a58210e2fd7);
         $v4aa3988e15afb9618423a0c2961a469f = umiBranch::checkIfBranchedByHierarchyTypeId($vacf567c9c3d6cf7c6e2cc0ce108e0631);
         return $v4aa3988e15afb9618423a0c2961a469f ? "cms3_object_content_{$vacf567c9c3d6cf7c6e2cc0ce108e0631}" : "cms3_object_content";
     }
     if (sizeof($v6942e8fa62b3cc9d93881a58210e2fd7) > 1) {
         $v6301cee35ea764a1e241978f93f01069 = self::getObjectTypeByFieldId($v945100186b119048837b9859c2c46410);
         return umiBranch::getBranchedTableByTypeId($v6301cee35ea764a1e241978f93f01069);
     }
     if (sizeof($v6942e8fa62b3cc9d93881a58210e2fd7) == 0) {
         if (sizeof($v0e8133eb006c0f85ed9444ae07a60842) == 1) {
             reset($v0e8133eb006c0f85ed9444ae07a60842);
             $v6301cee35ea764a1e241978f93f01069 = current($v0e8133eb006c0f85ed9444ae07a60842);
         } else {
             $v6301cee35ea764a1e241978f93f01069 = self::getObjectTypeByFieldId($v945100186b119048837b9859c2c46410);
         }
         return umiBranch::getBranchedTableByTypeId($v6301cee35ea764a1e241978f93f01069);
     }
     return "cms3_object_content";
 }
Ejemplo n.º 13
0
 public function getMessageLink($element_id = false)
 {
     $element_id = $this->analyzeRequiredPath($element_id);
     $per_page = $this->per_page;
     $curr_page = (int) getRequest('p');
     $element = umiHierarchy::getInstance()->getElement($element_id, true);
     if (!$element) {
         throw new publicException(getLabel('error-page-does-not-exist', null, ''));
     }
     $parent_id = $element->getParentId();
     $parent_element = umiHierarchy::getInstance()->getElement($parent_id);
     if (!$parent_element) {
         throw new publicException(getLabel('error-parent-does-not-exist', null, ''));
     }
     if ($element->getValue("publish_time")) {
         $publish_time = $element->getValue("publish_time")->getFormattedDate("U");
     }
     $sel = new umiSelection();
     $sel->setLimitFilter();
     $sel->addLimit($per_page, $curr_page);
     $sel->setElementTypeFilter();
     $topic_hierarchy_type_id = umiHierarchyTypesCollection::getInstance()->getTypeByName("forum", "message")->getId();
     $sel->addElementType($topic_hierarchy_type_id);
     $sel->setHierarchyFilter();
     $sel->addHierarchyFilter($parent_id);
     $object_type_id = umiObjectTypesCollection::getInstance()->getBaseType("forum", "message");
     $object_type = umiObjectTypesCollection::getInstance()->getType($object_type_id);
     $publish_time_field_id = $object_type->getFieldId('publish_time');
     $sel->setOrderFilter();
     $sel->setOrderByProperty($publish_time_field_id, true);
     $sel->setPropertyFilter();
     $sel->addPropertyFilterLess($publish_time_field_id, $publish_time);
     $sel->setPermissionsFilter();
     $sel->addPermissions();
     $total = umiSelectionsParser::runSelectionCounts($sel);
     $p = floor(($total - 1) / $this->per_page);
     if ($p < 0) {
         $p = 0;
     }
     return umiHierarchy::getInstance()->getPathById($parent_id) . "?p={$p}#" . $element_id;
 }
Ejemplo n.º 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);
 }
 /**
  * Сбросить настройки прав до дефолтных для страницы (класс 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));
 }
Ejemplo n.º 16
0
 public function insertlast($template = "default")
 {
     if (!$template) {
         $template = "default";
     }
     $type_id = umiObjectTypesCollection::getInstance()->getBaseType("vote", "poll");
     $type = umiObjectTypesCollection::getInstance()->getType($type_id);
     $time_field_id = $type->getFieldId("publish_time");
     $hierarchy_type_id = umiHierarchyTypesCollection::getInstance()->getTypeByName("vote", "poll")->getId();
     $sel = new umiSelection();
     $sel->setHierarchyFilter();
     $sel->addElementType($hierarchy_type_id);
     $sel->setLimitFilter();
     $sel->addLimit(1);
     $sel->setOrderFilter();
     $sel->setOrderByProperty($time_field_id, false);
     $sel->addPermissions();
     $sel->forceHierarchyTable();
     $result = umiSelectionsParser::runSelection($sel);
     if (sizeof($result)) {
         list($element_id) = $result;
     } else {
         $element_id = false;
     }
     if ($element_id) {
         return $this->poll($element_id, $template);
     }
 }
Ejemplo n.º 17
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;
		}
	}
Ejemplo n.º 18
0
 public function autoDetectFilters(umiSelection $sel, $object_type_id)
 {
     if (is_null(getRequest('search-all-text')) == false) {
         $searchStrings = getRequest('search-all-text');
         if (is_array($searchStrings)) {
             foreach ($searchStrings as $searchString) {
                 if ($searchString) {
                     $sel->searchText($searchString);
                 }
             }
         }
     }
     if (array_key_exists("fields_filter", $_REQUEST)) {
         $cmsController = cmsController::getInstance();
         $data_module = $cmsController->getModule("data");
         if (!$data_module) {
             throw new publicException("Need data module installed to use dynamic filters");
         }
         $sel->setPropertyFilter();
         $type = umiObjectTypesCollection::getInstance()->getType($object_type_id);
         $order_filter = getRequest('fields_filter');
         if (!is_array($order_filter)) {
             return false;
         }
         foreach ($order_filter as $field_name => $value) {
             if ($field_name == "name") {
                 $data_module->applyFilterName($sel, $value);
                 continue;
             }
             if ($field_id = $type->getFieldId($field_name)) {
                 $this->isSelectionFiltered = true;
                 $field = umiFieldsCollection::getInstance()->getField($field_id);
                 $field_type_id = $field->getFieldTypeId();
                 $field_type = umiFieldTypesCollection::getInstance()->getFieldType($field_type_id);
                 $data_type = $field_type->getDataType();
                 switch ($data_type) {
                     case "text":
                         $data_module->applyFilterText($sel, $field, $value);
                         break;
                     case "wysiwyg":
                         $data_module->applyFilterText($sel, $field, $value);
                         break;
                     case "string":
                         $data_module->applyFilterText($sel, $field, $value);
                         break;
                     case "tags":
                         $tmp = array_extract_values($value);
                         if (empty($tmp)) {
                             break;
                         }
                     case "boolean":
                         $data_module->applyFilterBoolean($sel, $field, $value);
                         break;
                     case "int":
                         $data_module->applyFilterInt($sel, $field, $value);
                         break;
                     case "symlink":
                     case "relation":
                         $data_module->applyFilterRelation($sel, $field, $value);
                         break;
                     case "float":
                         $data_module->applyFilterFloat($sel, $field, $value);
                         break;
                     case "price":
                         $emarket = $cmsController->getModule('emarket');
                         if ($emarket instanceof def_module) {
                             $defaultCurrency = $emarket->getDefaultCurrency();
                             $currentCurrency = $emarket->getCurrentCurrency();
                             $prices = $emarket->formatCurrencyPrice($value, $defaultCurrency, $currentCurrency);
                             foreach ($value as $index => $void) {
                                 $value[$index] = getArrayKey($prices, $index);
                             }
                         }
                         $data_module->applyFilterPrice($sel, $field, $value);
                         break;
                     case "file":
                     case "img_file":
                     case "swf_file":
                     case "boolean":
                         $data_module->applyFilterInt($sel, $field, $value);
                         break;
                     case "date":
                         $data_module->applyFilterDate($sel, $field, $value);
                         break;
                     default:
                         break;
                 }
             } else {
                 continue;
             }
         }
     } else {
         return false;
     }
 }
Ejemplo n.º 19
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');
    }
}
Ejemplo n.º 20
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);
 }
Ejemplo n.º 21
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;
 }
Ejemplo n.º 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;
		}
	}
Ejemplo n.º 23
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);
		}
Ejemplo n.º 24
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));
 }
Ejemplo n.º 25
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;
     }
 }
Ejemplo n.º 26
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);
 }
Ejemplo n.º 27
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;
		}
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 29
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;
 }
Ejemplo n.º 30
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);
 }