public function init() { // Initialize logger and translate actions $this->_logger = Zend_Registry::get("logger"); $this->_translate = Zend_Registry::get("translate"); // set the redirector to ignore the baseurl for redirections $this->_helper->redirector->setPrependBase(false); $this->_eventdispatcher = initializeSFEventDispatcher(); // load the application configuration loadConfig(); $this->view->referer = $this->getRequest()->getHeader('referer'); $this->view->viewurl = $_SERVER['REQUEST_URI']; // debugMessage($this->view->viewurl); // debugMessage($this->getRequest()); $isvalid = false; $host = giveHost($this->view->serverUrl()); // debugMessage($host); $this->view->domain = str_replace('http://', '', strtolower($host)); $subdomain = getSubdomain($this->view->serverUrl()); $this->view->subdomain = strtolower($subdomain); if ($subdomain == "www") { $this->_helper->redirector->gotoUrl('http://' . $host); exit; } // debugMessage('subdomain '.$subdomain); if (!isEmptyString($subdomain) && strtolower($host) == "hrmagic.ug") { $session = SessionWrapper::getInstance(); $session->setVar('companyid', ''); $company = new Company(); if ($company->isRenderable($subdomain)) { $isvalid = true; // debugMessage('valid'); } else { // debugMessage('invalid'); } if ($isvalid) { // if valid subdomain, set id to session $companyid = $company->findByUsername($subdomain); $session->setVar('cid', $companyid); } else { // subdomain not found. redirect to 404 page. $domain = str_replace($subdomain . '.', '', $this->view->serverUrl()); // debugMessage('d is '.$domain); $this->_helper->redirector->gotoUrl(stripUrl($domain) . '/index/error'); } } $url = array('http://www.domain.com', 'http://domain.com', 'https://domain.com', 'www.domain.com', 'domain.com', 'www.domain.com/some/path', 'http://sub.domain.com/domain.com', 'http://sub-domain.domain.net/domain.net', 'sub-domain.third-Level_DomaIN.domain.uk.co/domain.net'); /* foreach ($url as $u) { debugMessage(getSubdomain($u)); } */ // exit(); # set default timezone based on company in session # date_default_timezone_set(getTimeZine()); }
function GetDepFilesHTML($manifestroot, $fname, &$filenames, &$dcx, $folder) { $dcx->resetXpath(); $nlist = $dcx->nodeList("//img/@src | //link/@href | //script/@src | //a[not(starts-with(@href,'#'))]/@href"); $css_obj_array = array(); foreach ($nlist as $nl) { $item = $folder . $nl->nodeValue; $path_parts = pathinfo($item); $fname = $path_parts['basename']; $ext = array_key_exists('extension', $path_parts) ? $path_parts['extension'] : ''; if (!is_url($folder . $nl->nodeValue) && !is_url($nl->nodeValue)) { $path = $folder . $nl->nodeValue; $file = fullPath($path, "/"); toNativePath($file); if (file_exists($manifestroot . DIRECTORY_SEPARATOR . $file)) { $filenames[$file] = $file; } } if ($ext == 'css') { $css = new cssparser(); $css->Parse($dcx->filePath() . $nl->nodeValue); $css_obj_array[$item] = $css; } } $nlist = $dcx->nodeList("//*/@class"); foreach ($nlist as $nl) { $item = $folder . $nl->nodeValue; foreach ($css_obj_array as $csskey => $cssobj) { $bimg = $cssobj->Get($item, "background-image"); $limg = $cssobj->Get($item, "list-style-image"); $npath = pathinfo($csskey); if (!empty($bimg) && $bimg != 'none') { $value = stripUrl($bimg, $npath['dirname'] . '/'); $filenames[$value] = $value; } else { if (!empty($limg) && $limg != 'none') { $value = stripUrl($limg, $npath['dirname'] . '/'); $filenames[$value] = $value; } } } } $elems_to_check = array("body", "p", "ul", "h4", "a", "th"); $do_we_have_it = array(); foreach ($elems_to_check as $elem) { $do_we_have_it[$elem] = $dcx->nodeList("//" . $elem)->length > 0; } foreach ($elems_to_check as $elem) { if ($do_we_have_it[$elem]) { foreach ($css_obj_array as $csskey => $cssobj) { $sb = $cssobj->Get($elem, "background-image"); $sbl = $cssobj->Get($elem, "list-style-image"); $npath = pathinfo($csskey); if (!empty($sb) && $sb != 'none') { $value = stripUrl($sb, $npath['dirname'] . '/'); $filenames[$value] = $value; } else { if (!empty($sbl) && $sbl != 'none') { $value = stripUrl($sbl, $npath['dirname'] . '/'); $filenames[$value] = $value; } } } } } }