function redirect($value, $sendHTTP301 = false) { $value = removeDoubleSlashes($value); if ($value == 'login.php') { session_unset(); session_destroy(); } if ($sendHTTP301 == true) { header('HTTP/1.1 301 Moved Permanently'); } header('Location: ' . $value); die('Please allow redirection settings'); }
} $include = 'passwordrecovery.tpl'; } else { $serviceProviders = getServiceProviders(); $serviceProvider = (string) $ui->w('serviceProvider', 255, 'get'); if ($serviceProvider and file_exists(EASYWIDIR . '/third_party/hybridauth/Hybrid/Providers/' . $serviceProvider . '.php')) { $_SERVER = $ui->server; $pageUrl = ''; $query = $sql->prepare("SELECT `pageurl`,`seo`,`registration` FROM `page_settings` WHERE `resellerid`=0 LIMIT 1"); $query->execute(); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $pageUrl = $row['pageurl']; $seo = $row['seo']; $registration = $row['registration']; } $serviceProviderConfig = array('base_url' => removeDoubleSlashes($pageUrl . '/login.php?endpoint=1'), 'debug_mode' => (isset($dbConnect['debug']) and $dbConnect['debug'] == 1) ? true : false, 'debug_file' => EASYWIDIR . '/third_party/hybridauth/log/hybridauth.log', 'providers' => array()); $query = $sql->prepare("SELECT `serviceProviderID`,`filename`,`identifier`,`token` FROM `userdata_social_providers` WHERE `resellerID`=0 AND `active`='Y'"); $query->execute(); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $serviceProviderConfig['providers'][$row['filename']] = array('internalID' => $row['serviceProviderID'], 'enabled' => true); if (strlen($row['identifier']) > 0) { $serviceProviderConfig['providers'][$row['filename']]['keys']['id'] = $row['identifier']; } if (strlen($row['token']) > 0) { $serviceProviderConfig['providers'][$row['filename']]['keys']['secret'] = $row['token']; } } } if (isset($serviceProviderConfig['providers'][$serviceProvider]) and $ui->id('loginUserId', 10, 'get')) { if (isset($_SESSION['loginUserAllowed'][$ui->id('loginUserId', 10, 'get')])) { $query = $sql->prepare("SELECT `id`,`accounttype`,`cname`,`active`,`security`,`resellerid`,`mail`,`salt`,`externalID` FROM `userdata` WHERE `id`=? LIMIT 1");
public function getDefaultUrl() { return removeDoubleSlashes($this->defaultUrl); }
function getImagePath($fileUrl, $smarty) { // Store the image url $paths['fileUrl'] = $fileUrl; // The name of the file: image.jpg $paths['fileName'] = basename($fileUrl); // The paths to the document we are working with $scriptName = $smarty->_supers['server']['SCRIPT_NAME']; $paths['docPath'] = removeFileFromPath(removeDoubleSlashes(str_replace($smarty->_supers['server']['SCRIPT_NAME'], '', $smarty->_supers['server']['SCRIPT_FILENAME']) . '/' . $smarty->_supers['server']['REQUEST_URI'])); // The relative path to the document $docUri = $smarty->_supers['server']['REDIRECT_URL'] ? $smarty->_supers['server']['REDIRECT_URL'] : dirname($smarty->_supers['server']['SCRIPT_NAME']); $docUri = removeDoubleSlashes('/' . $docUri . '/'); // If we've got an absolute image url...make it relative! $fileUri = str_replace('http://' . $smarty->_supers['server']['HTTP_HOST'], '', $fileUrl); $fileUri = str_replace('https://' . $smarty->_supers['server']['HTTP_HOST'], '', $fileUri); if (substr($fileUri, 0, 1) == DIRECTORY_SEPARATOR) { $docSegments = explode(DIRECTORY_SEPARATOR, $docUri); $fileSegments = explode(DIRECTORY_SEPARATOR, $fileUri); // Cycle through the url segments, working back from the current url to the image url while (count($docSegments) || count($fileSegments)) { $docSegment = array_shift($docSegments); $fileSegment = array_shift($fileSegments); if ($docSegment != $fileSegment || $up) { $up = $docSegment ? '../' : ''; $relativeUri = $up . $relativeUri . $fileSegment . '/'; } } $fileUrl = rtrim($relativeUri, '/'); } // Get the actual path to the file on the server $filePath = '/' . get_absolute_path(removeDoubleSlashes($paths['docPath'] . '/' . $fileUrl)); // Make sure there is actually an image at that path if (!is_readable($filePath)) { echo "<!-- Imagesizer Error: Could not find the file {$filePath} -->"; return false; } // Calculate all the other paths we will need $pathInfo = pathinfo($filePath); $paths['filePath'] = $pathInfo['dirname']; $paths['fileExt'] = $pathInfo['extension']; $paths['fileBasename'] = $pathInfo['filename'] ? $pathInfo['filename'] : substr($paths['fileName'], 0, strrpos($paths['fileName'], '.')); $paths['fileSrc'] = removeDoubleSlashes($paths['filePath'] . '/' . $paths['fileName']); $paths['cachePath'] = removeDoubleSlashes($paths['filePath'] . '/cache/'); // Make sure the cache folder exists if (!is_dir($paths['cachePath'])) { // Try to create it if (!@mkdir($paths['cachePath'], 0777)) { echo "<!-- Imagesizer Error: Could not create cache directory. Please create {$paths['cachePath']} manually and try again. -->"; return false; } // Make sure it's really writable if (!is_writable($paths['cachePath'])) { echo '<!-- Imagesizer Error: The cache directory is not writeable -->'; return false; } } // The url to the cached image $paths['cacheUrl'] = removeDoubleSlashes('/' . get_absolute_path($docUri . '/' . dirname($fileUrl)) . '/cache/'); return $paths; }