<?php

class URLListView extends Slot {

	var $ModuleID = 1;
	var $SectionID = 1;

	function __construct($pquery) {
		parent::__construct($pquery);
	}

	function init() {
		global $ROOT_PATH, $REGISTRY, $signature, $cities;
		$arr = array_keys($REGISTRY['VirtualSlotTarget']['main']);
		foreach($arr as $k => $v) {
			if($v=='?' || $v=='') unset($arr[$k]);
			else if(preg_match("/^(\/subdomains)/i", $v)) {
				$paths = explode('/',strtolower(preg_replace('/^\//i','',$v)));
				array_shift($paths);
				$arr[$k] = $paths[0].'.'.$signature['domain'][0].preg_replace('/^(\/subdomains\/'.$paths[0].')/i', '', $v);
			}
			else $arr[$k] = $signature['domain'][0].$v;
		}
		if(empty($cities)) $cities = $this->Db->SelectList('name_in_url','city',array('name_in_url'));
		$count = sizeof($cities);
		for($i = 0; $i < $count; $i++)
			$arr[] = $signature['domain'][0].'/cities/'.$cities[$i];
		$count = sizeof($arr);
		$this->TempFillEls['file'] = '';
		//sort($arr);
		for($i = 0; $i < $count; $i++)
			if(isset($arr[$i])) $this->TempFillEls['file'].= '<a target="_blank" href="http://'.$arr[$i].'">http://'.$arr[$i].'</a><br>';
	}

}
?>