예제 #1
0
	public function guides() {
		$objectTypes = umiObjectTypesCollection::getInstance();

		if(isset($_REQUEST['search-all-text'][0])) {
			$searchAllText = array_extract_values($_REQUEST['search-all-text']);
			foreach($searchAllText as $i => $v) {
				$searchAllText[$i] = wa_strtolower($v);
			}
		} else {
			$searchAllText = false;
		}

		$rel = umiObjectTypesCollection::getInstance()->getTypeIdByGUID('root-guides-type');
		if(($rels = getRequest('rel')) && sizeof($rels)) {
			$rel = getArrayKey($rels, 0);
		}

		$per_page = getRequest('per_page_limit');
		$curr_page = (int) getRequest('p');

		$types = umiObjectTypesCollection::getInstance();
		$guides_list = $types->getGuidesList(true, $rel);

		$tmp = Array();
		foreach($guides_list as $typeId => $name) {
			if($searchAllText) {
				$match = false;
				foreach($searchAllText as $searchString) {
					if(strstr(wa_strtolower($name), $searchString) !== false) {
						$match = true;
					}
				}
				if(!$match) {
					continue;
				}
			}
			$tmp[$typeId] = $name;
		}

		if(isset($_REQUEST['order_filter']['name'])) {
			natsort($tmp);
			if($_REQUEST['order_filter']['name'] == "desc") {
				$tmp = array_reverse($tmp, true);
			}
		}
		$guides_list = array_keys($tmp);
		unset($tmp);
		$guides_list = $this->excludeNestedTypes($guides_list);

		$total = sizeof($guides_list);
		$guides = array_slice($guides_list, $per_page * $curr_page, $per_page);

		$this->setDataType("list");
		$this->setActionType("view");
		$this->setDataRange($per_page, $curr_page * $per_page);

		$data = $this->prepareData($guides, "types");
		$this->setData($data, $total);
		return $this->doData();
	}
예제 #2
0
 public function setMode($v15d61712450a686a7f365adf4fef581f = "process")
 {
     $v15d61712450a686a7f365adf4fef581f = wa_strtolower($v15d61712450a686a7f365adf4fef581f);
     if (!in_array($v15d61712450a686a7f365adf4fef581f, self::$modes)) {
         throw new coreException("Unknown eventPoint mode \"{$v15d61712450a686a7f365adf4fef581f}\"");
     }
     $this->mode = $v15d61712450a686a7f365adf4fef581f;
 }
예제 #3
0
		public function types() {
			$per_page = getRequest('per_page_limit');
			$curr_page = (int) getRequest('p');

			if(isset($_REQUEST['rel'][0])) {
				$parent_type_id = $this->expectObjectTypeId($_REQUEST['rel'][0], false, true);
			} else {
				$parent_type_id = $this->expectObjectTypeId('param0');
			}

			if(isset($_REQUEST['search-all-text'][0])) {
				$searchAllText = array_extract_values($_REQUEST['search-all-text']);
				foreach($searchAllText as $i => $v) {
					$searchAllText[$i] = wa_strtolower($v);
				}
			} else {
				$searchAllText = false;
			}

			$params = Array();

			$types = umiObjectTypesCollection::getInstance();
			if($searchAllText && !$parent_type_id) {
				$sub_types = $types->getChildClasses(0);
			} else {
				$sub_types = $types->getSubTypesList($parent_type_id);
			}

			$tmp = Array();
			foreach($sub_types as $typeId) {
				$type = $types->getType($typeId);
				if($type instanceof umiObjectType) {
					$name = $type->getName();

					if($searchAllText) {
						$match = false;
						foreach($searchAllText as $searchString) {
							if(strstr(wa_strtolower($name), $searchString) !== false) {
								$match = true;
							}
						}
						if(!$match) {
							continue;
						}
					}
					$tmp[$typeId] = $name;
				}
			}

			if(isset($_REQUEST['order_filter']['name'])) {
				natsort($tmp);
				if($_REQUEST['order_filter']['name'] == "desc") {
					$tmp = array_reverse($tmp, true);
				}
			}

			$sub_types = array_keys($tmp);
			unset($tmp);
			$sub_types = $this->excludeNestedTypes($sub_types);

			$total = sizeof($sub_types);
			$sub_types = array_slice($sub_types, $curr_page * $per_page, $per_page, false);

			$this->setDataType("list");
			$this->setActionType("view");
			$this->setDataRange($per_page, $curr_page * $per_page);

			$data = $this->prepareData($sub_types, "types");
			$this->setData($data, $total);
			return $this->doData();
		}
예제 #4
0
 public function forms()
 {
     $curr_page = (int) getRequest('p');
     $per_page = getRequest('per_page_limit');
     $oTypes = umiObjectTypesCollection::getInstance();
     $iBaseTID = $oTypes->getBaseType("webforms", "form");
     if ($iBaseTID === false) {
         throw new publicAdminException('No form base type was found');
     }
     if (isset($_REQUEST['search-all-text'][0])) {
         $searchAllText = array_extract_values($_REQUEST['search-all-text']);
         foreach ($searchAllText as $i => $v) {
             $searchAllText[$i] = wa_strtolower($v);
         }
     } else {
         $searchAllText = false;
     }
     $types = $oTypes;
     $sub_types = $types->getSubTypesList($iBaseTID);
     $tmp = array();
     foreach ($sub_types as $typeId) {
         $type = $types->getType($typeId);
         if ($type instanceof umiObjectType) {
             $name = $type->getName();
             if ($searchAllText) {
                 $match = false;
                 foreach ($searchAllText as $searchString) {
                     if (strstr(wa_strtolower($name), $searchString) !== false) {
                         $match = true;
                     }
                 }
                 if (!$match) {
                     continue;
                 }
             }
             $tmp[$typeId] = $name;
         }
     }
     if (isset($_REQUEST['order_filter']['name'])) {
         natsort($tmp);
         if ($_REQUEST['order_filter']['name'] == "desc") {
             $tmp = array_reverse($tmp, true);
         }
     }
     $sub_types = array_keys($tmp);
     unset($tmp);
     $sub_types = $this->excludeNestedTypes($sub_types);
     $total = sizeof($sub_types);
     $aTypes = array_slice($sub_types, $curr_page * $per_page, $per_page, false);
     $this->setDataType("list");
     $this->setActionType("view");
     $this->setDataRange($per_page, $per_page * $curr_page);
     $data = $this->prepareData($aTypes, "types");
     $data['nodes:basetype'] = array(array('attribute:id' => $iBaseTID));
     $this->setData($data, $total);
     return $this->doData();
 }
 protected function analyzeHeaders(umiObjectType $v726e8e4809d4c1b28a6549d86436a124, $v4340fd73e75df7a9d9e45902a59ba3a4)
 {
     $result = array();
     $vd05b6ed7d2345020440df396d6da7f73 = umiFieldsCollection::getInstance();
     $v865c0c0b4ab0e063e5caa3387c1a8741 = 0;
     foreach ($v4340fd73e75df7a9d9e45902a59ba3a4 as $vd5d3db1765287eef77d7927cc956f50a) {
         switch (wa_strtolower($vd5d3db1765287eef77d7927cc956f50a)) {
             case 'id':
                 $result['id'] = $vd5d3db1765287eef77d7927cc956f50a;
                 break;
             case wa_strtolower(getLabel('label-name')):
                 $result['name'] = $vd5d3db1765287eef77d7927cc956f50a;
                 break;
             case wa_strtolower(getLabel('label-alt-name')):
                 if ($this->mode == 'element') {
                     $result['alt-name'] = $vd5d3db1765287eef77d7927cc956f50a;
                     break;
                 }
             case wa_strtolower(getLabel('field-is_active')):
                 if ($this->mode == 'element') {
                     $result['is-active'] = $vd5d3db1765287eef77d7927cc956f50a;
                     break;
                 }
             default:
                 $v945100186b119048837b9859c2c46410 = $this->getFieldId($v726e8e4809d4c1b28a6549d86436a124, $vd5d3db1765287eef77d7927cc956f50a);
                 $v06e3d36fa30cea095545139854ad1fb9 = $vd05b6ed7d2345020440df396d6da7f73->getField($v945100186b119048837b9859c2c46410);
                 if ($v06e3d36fa30cea095545139854ad1fb9 instanceof umiField) {
                     $result[$v06e3d36fa30cea095545139854ad1fb9->getName()] = $vd5d3db1765287eef77d7927cc956f50a;
                 } else {
                     $result['unkonwn-field-' . ++$v865c0c0b4ab0e063e5caa3387c1a8741] = $vd5d3db1765287eef77d7927cc956f50a;
                 }
         }
     }
     return $result;
 }
예제 #6
0
 public function formatMessage($message, $b_split_long_mode = 0)
 {
     static $bb_from;
     static $bb_to;
     $oldResultTMode = $this->isXSLTResultMode(false);
     try {
         list($quote_begin, $quote_end) = $this->loadTemplates('quote/default', 'quote_begin', 'quote_end');
     } catch (publicException $e) {
         $quote_begin = "<div class='quote'>";
         $quote_end = "</div>";
     }
     if (self::isXSLTResultMode()) {
         $quote_begin = "<div class='quote'>";
         $quote_end = "</div>";
     }
     if (!(is_array($bb_from) && is_array($bb_to) && count($bb_from) === count($bb_to))) {
         try {
             list($bb_from, $bb_to) = $this->loadTemplates('bb/default', 'bb_from', 'bb_to');
             if (!(is_array($bb_from) && is_array($bb_to) && count($bb_from) === count($bb_to) && count($bb_to))) {
                 $bb_from = array("[b]", "[i]", "[/b]", "[/i]", "[quote]", "[/quote]", "[u]", "[/u]", "\r\n");
                 $bb_to = array("<strong>", "<em>", "</strong>", "</em>", $quote_begin, $quote_end, "<u>", "</u>", "<br />");
             }
         } catch (publicException $e) {
             $bb_from = array("[b]", "[i]", "[/b]", "[/i]", "[quote]", "[/quote]", "[u]", "[/u]", "\r\n");
             $bb_to = array("<strong>", "<em>", "</strong>", "</em>", $quote_begin, $quote_end, "<u>", "</u>", "<br />");
         }
     }
     $openQuoteCount = substr_count(wa_strtolower($message), "[quote]");
     $closeQuoteCount = substr_count(wa_strtolower($message), "[/quote]");
     if ($openQuoteCount > $closeQuoteCount) {
         $message .= str_repeat("[/quote]", $openQuoteCount - $closeQuoteCount);
     }
     if ($openQuoteCount < $closeQuoteCount) {
         $message = str_repeat("[quote]", $closeQuoteCount - $openQuoteCount) . $message;
     }
     $message = preg_replace("`((http)+(s)?:(//)|(www\\.))((\\w|\\.|\\-|_)+)(/)?([/|#|?|&|=|\\w|\\.|\\-|_]+)?`i", "[url]http\\3://\\5\\6\\8\\9[/url]", $message);
     $message = str_ireplace($bb_from, $bb_to, $message);
     $message = str_ireplace("</h4>", "</h4><p>", $message);
     $message = str_ireplace("</div>", "</p></div>", $message);
     $message = str_replace(".[/url]", "[/url].", $message);
     $message = str_replace(",[/url]", "[/url],", $message);
     $message = str_replace(array("[url][url]", "[/url][/url]"), array("[url]", "[/url]"), $message);
     // split long words
     if ($b_split_long_mode === 0) {
         // default
         $arr_matches = array();
         $b_succ = preg_match_all("/[^\\s^<^>]{70,}/u", $message, $arr_matches);
         if ($b_succ && isset($arr_matches[0]) && is_array($arr_matches[0])) {
             foreach ($arr_matches[0] as $str) {
                 $s = "";
                 if (strpos($str, "[url]") === false) {
                     for ($i = 0; $i < wa_strlen($str); $i++) {
                         $s .= wa_substr($str, $i, 1) . ($i % 30 === 0 ? " " : "");
                     }
                     $message = str_replace($str, $s, $message);
                 }
             }
         }
     } elseif ($b_split_long_mode === 1) {
         // TODU abcdef...asdf
     }
     if (preg_match_all("/\\[url\\]([^А-я^\r^\n^\t]*)\\[\\/url\\]/U", $message, $matches, PREG_SET_ORDER)) {
         for ($i = 0; $i < count($matches); $i++) {
             $s_url = $matches[$i][1];
             $i_length = strlen($s_url);
             if ($i_length > 40) {
                 $i_cutpart = ceil(($i_length - 40) / 2);
                 $i_center = ceil($i_length / 2);
                 $s_url = substr_replace($s_url, "...", $i_center - $i_cutpart, $i_cutpart * 2);
             }
             $message = str_replace($matches[$i][0], "<a href='/go-out.php?url=" . $matches[$i][1] . "' target='_blank' title='Ссылка откроется в новом окне'>" . $s_url . "</a>", $message);
         }
     }
     $message = str_replace("&", "&amp;", $message);
     $message = str_ireplace("[QUOTE][QUOTE]", "", $message);
     if (preg_match_all("/\\[smile:([^\\]]+)\\]/im", $message, $out)) {
         foreach ($out[1] as $smile_path) {
             $s = $smile_path;
             $smile_path = "images/forum/smiles/" . $smile_path . ".gif";
             if (file_exists($smile_path)) {
                 $message = str_replace("[smile:" . $s . "]", "<img src='/{$smile_path}' />", $message);
             }
         }
     }
     $message = preg_replace("/<p>(<br \\/>)+/", "<p>", $message);
     $message = nl2br($message);
     $message = str_replace("<<br />br /><br />", "", $message);
     $message = str_replace("<p<br />>", "<p>", $message);
     $message = str_replace("&amp;quot;", "\"", $message);
     $message = str_replace("&amp;quote;", "\"", $message);
     $message = html_entity_decode($message);
     $message = str_replace("%", "&#37;", $message);
     $message = $this->parseTPLMacroses($message);
     $this->isXSLTResultMode($oldResultTMode);
     return $message;
 }
예제 #7
0
    public function suggestions($vb45cffe084dd3d20d928bee85e7b0f21, $vaa9f73eea60a006820d0f8768bc8a3fc = 10)
    {
        $vb45cffe084dd3d20d928bee85e7b0f21 = trim($vb45cffe084dd3d20d928bee85e7b0f21);
        if (!$vb45cffe084dd3d20d928bee85e7b0f21) {
            return false;
        }
        $vb45cffe084dd3d20d928bee85e7b0f21 = wa_strtolower($vb45cffe084dd3d20d928bee85e7b0f21);
        $va04202c712aa415f47dbacb817a60397 = str_split('йцукенгшщзхъфывапролджэячсмитьбю');
        $v74e6a8b111ea7da1a7d0a596f4c35208 = str_split('qwertyuiop[]asdfghjkl;\'zxcvbnm,.');
        $v9c1b200500ea38c658ac7c81b10e85d2 = iconv("UTF-8", "CP1251", $vb45cffe084dd3d20d928bee85e7b0f21);
        $ve39cf8a95dc90270161317376387b25a = iconv("CP1251", "UTF-8", str_replace($va04202c712aa415f47dbacb817a60397, $v74e6a8b111ea7da1a7d0a596f4c35208, $v9c1b200500ea38c658ac7c81b10e85d2));
        $v67ae3d093b55e92227d0861222db0c6d = iconv("CP1251", "UTF-8", str_replace($v74e6a8b111ea7da1a7d0a596f4c35208, $va04202c712aa415f47dbacb817a60397, $v9c1b200500ea38c658ac7c81b10e85d2));
        $vd0c03a4c136b717b6ebc603966e26755 = $ve39cf8a95dc90270161317376387b25a != $vb45cffe084dd3d20d928bee85e7b0f21 ? $ve39cf8a95dc90270161317376387b25a : $v67ae3d093b55e92227d0861222db0c6d;
        $vb45cffe084dd3d20d928bee85e7b0f21 = l_mysql_real_escape_string($vb45cffe084dd3d20d928bee85e7b0f21);
        $vd0c03a4c136b717b6ebc603966e26755 = l_mysql_real_escape_string($vd0c03a4c136b717b6ebc603966e26755);
        $vaa9f73eea60a006820d0f8768bc8a3fc = (int) $vaa9f73eea60a006820d0f8768bc8a3fc;
        $vac5c74b64b4b8352ef2f181affb5ac2a = <<<SQL
SELECT `siw`.`word` as `word`, COUNT(`si`.`word_id`) AS `cnt`
\tFROM
\t\t`cms3_search_index_words` `siw`,
\t\t`cms3_search_index` `si`
\tWHERE
\t\t(
\t\t\t`siw`.`word` LIKE '{$vb45cffe084dd3d20d928bee85e7b0f21}%' OR
\t\t\t`siw`.`word` LIKE '{$vd0c03a4c136b717b6ebc603966e26755}%'
\t\t) AND
\t\t`si`.`word_id` = `siw`.`id`
\tGROUP BY
\t\t`siw`.`id`
\tORDER BY SUM(`si`.`tf`) DESC
\tLIMIT {$vaa9f73eea60a006820d0f8768bc8a3fc}
SQL;
        $v4717d53ebfdfea8477f780ec66151dcb = ConnectionPool::getInstance()->getConnection('search');
        return $v4717d53ebfdfea8477f780ec66151dcb->queryResult($vac5c74b64b4b8352ef2f181affb5ac2a);
    }
예제 #8
0
 private function renderImageFile(umiObjectProperty &$property, $template, $showNull = false)
 {
     $name = $property->getName();
     $title = $property->getTitle();
     $value = $property->getValue();
     if ($property->getIsMultiple() === false) {
         list($tpl, $tpl_empty) = self::loadTemplates("data/" . $template, "img_file", "img_file_empty");
         if (empty($value) && !$showNull) {
             return $tpl_empty;
         }
         $arr = array();
         $arr['field_id'] = $property->getField()->getId();
         $arr['name'] = $name;
         $arr['title'] = $title;
         $arr['size'] = $value->getSize();
         $arr['filename'] = $value->getFileName();
         $arr['filepath'] = $value->getFilePath();
         $arr['src'] = $value->getFilePath(true);
         $arr['ext'] = $value->getExt();
         if (wa_strtolower($value->getExt()) == "swf") {
             list($tpl) = self::loadTemplates("data/" . $template, "swf_file");
         }
         if ($value instanceof iUmiImageFile) {
             $arr['width'] = $value->getWidth();
             $arr['height'] = $value->getHeight();
         }
         $arr['template'] = $template;
         return self::parseTemplate($tpl, $arr);
     } else {
     }
 }