public static function to($url = '', $scheme = false, $urlManager = null) { if (is_array($url)) { return static::toRoute($url, $scheme, $urlManager); } $url = Yii::getAlias($url); if ($url === '') { $url = Yii::$app->getRequest()->getUrl(); } if (!$scheme) { return $url; } if (strncmp($url, '//', 2) === 0) { // e.g. //hostname/path/to/resource return is_string($scheme) ? "{$scheme}:{$url}" : $url; } if (($pos = strpos($url, ':')) == false || !ctype_alpha(substr($url, 0, $pos))) { // turn relative URL into absolute $url = Yii::$app->getUrlManager()->getHostInfo() . '/' . ltrim($url, '/'); } if (is_string($scheme) && ($pos = strpos($url, ':')) !== false) { // replace the scheme with the specified one $url = $scheme . substr($url, $pos); } return $url; }
/** * {@inheritdoc} */ public function fix(\SplFileInfo $file, $content) { if (0 === strncmp($content, $this->BOM, 3)) { return substr($content, 3); } return $content; }
protected function getBaseHref() { if (strncmp($this->uri, '#', 1) === 0 || strncmp($this->uri, 'mailto:', 7) === 0) { return $this->uri; } return $this->controller->genUrl($this->uri); }
/** * @since 1.6 */ function display($tpl = null) { // Get data from the model $this->state = $this->get('State'); $this->changeSet = $this->get('Items'); $this->errors = $this->changeSet->check(); $this->results = $this->changeSet->getStatus(); $this->schemaVersion = $this->get('SchemaVersion'); $this->updateVersion = $this->get('UpdateVersion'); $this->filterParams = $this->get('DefaultTextFilters'); $this->schemaVersion = $this->schemaVersion ? $this->schemaVersion : JText::_('JNONE'); $this->updateVersion = $this->updateVersion ? $this->updateVersion : JText::_('JNONE'); $this->pagination = $this->get('Pagination'); $this->errorCount = count($this->errors); $errors = count($this->errors); if (!(strncmp($this->schemaVersion, JVERSION, 5) === 0)) { $this->errorCount++; } if (!$this->filterParams) { $this->errorCount++; } if ($this->updateVersion != JVERSION) { $this->errorCount++; } parent::display($tpl); }
/** * Depending on original file mime type call appropriate transcoder */ public function getFileUrl($mixedHandler) { $oStorageOriginal = BxDolStorage::getObjectInstance($this->_aObject['source_params']['object']); if (!$oStorageOriginal) { return false; } $aFile = $oStorageOriginal->getFile($mixedHandler); if (!$aFile) { return false; } $sTranscoder = ''; if (0 === strncmp($aFile['mime_type'], 'image/', 6) && !empty($this->_aObject['source_params']['image'])) { $sTranscoder = $this->_aObject['source_params']['image']; } elseif (0 === strncmp($aFile['mime_type'], 'video/', 6) && !empty($this->_aObject['source_params']['video_poster'])) { $sTranscoder = $this->_aObject['source_params']['video_poster']; // if additional video transcoders provided call it to force video conversion if (empty($this->_aObject['source_params']['video'])) { continue; } foreach ($this->_aObject['source_params']['video'] as $sVideoTranscoder) { if (!($oTranscoder = BxDolTranscoderImage::getObjectInstance($sVideoTranscoder))) { continue; } $oTranscoder->getFileUrl($mixedHandler); } } if (!$sTranscoder) { return false; } if (!($oTranscoder = BxDolTranscoderImage::getObjectInstance($sTranscoder))) { return false; } return $oTranscoder->getFileUrl($mixedHandler); }
function __jax__classAutoloadFindClassFile($class_name, $dir) { $cnlen = strlen($class_name); $anyProcessed = false; if (($dp = @opendir($dir)) !== false) { while (($fn = readdir($dp)) !== false) { if ($fn == '.' || $fn == '..') { continue; } $path = $dir . '/' . $fn; if (is_dir($path)) { if (($foundfn = __jax__classAutoloadFindClassFile($class_name, $path)) !== false) { return $foundfn; } } if (is_file($path)) { $fnlen = strlen($fn); if ($fnlen > $cnlen && strncmp($fn, $class_name, $cnlen) == 0 && ($cnlen + 10 == $fnlen && substr_compare($fn, '.class.php', $cnlen) == 0 || $cnlen + 14 == $fnlen && substr_compare($fn, '.interface.php', $cnlen) == 0)) { return $path; } } } closedir($dp); } return false; }
function get_content_dir($dir_path) { if (!is_dir($dir_path)) { throw new Exception($dir_path . ' should be a directory but isn\'t.'); } $numEntries = 0; $lastEntry = ""; foreach (new DirectoryIterator($dir_path) as $entry) { if (strncmp((string) $entry, '.', 1)) { $lastEntry = (string) $entry; $numEntries += 1; // echo $numEntries." \n".$lastEntry." \n\n"; } } // echo "Final " . $numEntries." \n".$lastEntry." \n\n"; if ($numEntries == 0) { //empty directory, just return it return $dir_path . '/' . (string) $lastEntry; } elseif ($numEntries == 1) { if (!is_dir($dir_path . '/' . (string) $lastEntry)) { //there is no directory below the current one. return $dir_path . '/'; } else { //there is only entry in this directory; //as it's a subfolder, recurse into it. //echo "recursion ".$lastEntry." \n"; return get_content_dir($dir_path . '/' . $lastEntry); } } else { // there is more than one entry in this directory. Stop. return $dir_path . '/'; } }
function smarty_core_is_secure($params, &$smarty) { if (!$smarty->security || $smarty->security_settings['INCLUDE_ANY']) { return true; } if ($params['resource_type'] == 'file') { $_rp = realpath($params['resource_name']); if (isset($params['resource_base_path'])) { foreach ((array) $params['resource_base_path'] as $curr_dir) { if (($_cd = realpath($curr_dir)) !== false && strncmp($_rp, $_cd, strlen($_cd)) == 0 && substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR) { return true; } } } if (!empty($smarty->secure_dir)) { foreach ((array) $smarty->secure_dir as $curr_dir) { if (($_cd = realpath($curr_dir)) !== false) { if ($_cd == $_rp) { return true; } elseif (strncmp($_rp, $_cd, strlen($_cd)) == 0 && substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR) { return true; } } } } } else { // resource is not on local file system return call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][2], array($params['resource_name'], &$smarty)); } return false; }
/** * Constructs absolute URL from Request object. * @return string|NULL */ public function constructUrl(Application\Request $appRequest, Nette\Http\Url $refUrl) { if ($this->flags & self::ONE_WAY) { return NULL; } $params = $appRequest->getParameters(); // presenter name $presenter = $appRequest->getPresenterName(); if (strncmp($presenter, $this->module, strlen($this->module)) === 0) { $params[self::PRESENTER_KEY] = substr($presenter, strlen($this->module)); } else { return NULL; } // remove default values; NULL values are retain foreach ($this->defaults as $key => $value) { if (isset($params[$key]) && $params[$key] == $value) { // intentionally == unset($params[$key]); } } $url = ($this->flags & self::SECURED ? 'https://' : 'http://') . $refUrl->getAuthority() . $refUrl->getPath(); $sep = ini_get('arg_separator.input'); $query = http_build_query($params, '', $sep ? $sep[0] : '&'); if ($query != '') { // intentionally == $url .= '?' . $query; } return $url; }
/** * @inheritDoc */ protected function identifyLine($lines, $current) { if (isset($lines[$current]) && strncmp($lines[$current], '```', 3) === 0) { return 'fencedCode'; } return parent::identifyLine($lines, $current); }
/** * Constructs absolute URL from Request object. * @return string|NULL */ public function constructUrl(Nette\Application\Request $appRequest, Nette\Http\Url $refUrl) { if ($this->cachedRoutes === NULL) { $this->warmupCache(); } if ($this->module) { if (strncmp($tmp = $appRequest->getPresenterName(), $this->module, strlen($this->module)) === 0) { $appRequest = clone $appRequest; $appRequest->setPresenterName(substr($tmp, strlen($this->module))); } else { return NULL; } } $presenter = $appRequest->getPresenterName(); if (!isset($this->cachedRoutes[$presenter])) { $presenter = '*'; } foreach ($this->cachedRoutes[$presenter] as $route) { $url = $route->constructUrl($appRequest, $refUrl); if ($url !== NULL) { return $url; } } return NULL; }
/** * @inheritdoc */ public function getAssetUrl($bundle, $asset) { if (($actualAsset = $this->resolveAsset($bundle, $asset)) !== false) { if (strncmp($actualAsset, '@web/', 5) === 0) { $asset = substr($actualAsset, 5); $basePath = Yii::getAlias("@webroot"); $baseUrl = Yii::getAlias("@web"); } else { $asset = Yii::getAlias($actualAsset); $basePath = $this->basePath; $baseUrl = $this->baseUrl; } } else { $basePath = $bundle->basePath; $baseUrl = $bundle->baseUrl; } if (!Url::isRelative($asset) || strncmp($asset, '/', 1) === 0) { return $asset; } if ($this->appendTimestamp) { foreach (['', '.gz'] as $appendExtension) { if (($timestamp = @filemtime("{$basePath}/{$asset}{$appendExtension}")) > 0) { return "{$baseUrl}/{$asset}?v={$timestamp}"; } } } return "{$baseUrl}/{$asset}"; }
private function _detect_uri() { if (!isset($_SERVER['REQUEST_URI']) or !isset($_SERVER['SCRIPT_NAME'])) { return ''; } $uri = $_SERVER['REQUEST_URI']; if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) { $uri = substr($uri, strlen($_SERVER['SCRIPT_NAME'])); } elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) { $uri = substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME']))); } if (strncmp($uri, '?/', 2) === 0) { $uri = substr($uri, 2); } $parts = preg_split('#\\?#i', $uri, 2); $uri = $parts[0]; if (isset($parts[1])) { $_SERVER['QUERY_STRING'] = $parts[1]; parse_str($_SERVER['QUERY_STRING'], $_GET); } else { $_SERVER['QUERY_STRING'] = ''; $_GET = array(); } if ($uri == '/' || empty($uri)) { return '/'; } $uri = parse_url($uri, PHP_URL_PATH); return str_replace(array('//', '../'), '/', trim($uri, '/')); }
public function createRequest() { $uri = $_SERVER['REQUEST_URI']; $basePath = $this->configuration->getBasePath(); if ($basePath && strncmp($uri, $basePath, strlen($basePath)) !== 0) { throw new ApiException("Invalid endpoint"); } $uri = substr($uri, strlen($basePath) - 1); if ($this->configuration->getPublicKey() !== trim($_SERVER['HTTP_X_API_KEY'])) { throw new AuthorizationException("Invalid API key"); } $hasBody = $this->hasBody(); $input = $hasBody ? file_get_contents('php://input') : ''; $signature = hash_hmac('sha256', $uri . $input, $this->configuration->getPrivateKey()); if ($signature !== trim($_SERVER['HTTP_X_API_SIGNATURE'])) { throw new AuthorizationException("Invalid signature"); } if ($hasBody) { $parameters = json_decode($input, JSON_OBJECT_AS_ARRAY); if ($parameters === NULL && $input !== '' && strcasecmp(trim($input, " \t\n\r"), 'null') !== 0) { $error = json_last_error(); throw new ApiException('JSON parsing error: ' . $error); } } else { $parameters = filter_input_array(INPUT_GET, FILTER_UNSAFE_RAW); } $name = ($a = strpos($uri, '?')) !== FALSE ? substr($uri, 0, $a) : $uri; return new Request(ltrim($name, '/'), $_SERVER['REQUEST_METHOD'], $parameters); }
protected function getTokens($code) { if ($this->lfLineEndings && false !== strpos($code, "\r")) { $code = str_replace("\r\n", "\n", $code); $code = strtr($code, "\r", "\n"); } if ($this->checkUtf8 && !preg_match('//u', $code)) { $this->setError("File encoding is not valid UTF-8", E_USER_WARNING); } if ($this->stripUtf8Bom && 0 === strncmp($code, "", 3)) { // substr_replace() is for mbstring overloading resistance $code = substr_replace($code, '', 0, 3); $this->setError("Stripping UTF-8 Byte Order Mark", E_USER_NOTICE); } if ('' === $code) { return array(); } $code = parent::getTokens($code); // Ensure that the first token is always a T_OPEN_TAG if (T_INLINE_HTML === $code[0][0]) { $a = $code[0][1]; $a = "\r" === $a[0] ? isset($a[1]) && "\n" === $a[1] ? '\\r\\n' : '\\r' : ("\n" === $a[0] ? '\\n' : ''); if ($a) { array_unshift($code, array(T_OPEN_TAG, '<?php '), array(T_ECHO, 'echo'), array(T_ENCAPSED_AND_WHITESPACE, "\"{$a}\""), array(T_CLOSE_TAG, '?>')); } else { array_unshift($code, array(T_OPEN_TAG, '<?php '), array(T_CLOSE_TAG, '?>')); } } // Ensure that the last valid PHP code position is tagged with a T_ENDPHP $a = array_pop($code); $code[] = T_CLOSE_TAG === $a[0] ? ';' : $a; T_INLINE_HTML === $a[0] && ($code[] = array(T_OPEN_TAG, '<?php ')); $code[] = array(T_ENDPHP, ''); return $code; }
protected function get_uri($prefix_slash = true) { if (isset($_SERVER['PATH_INFO'])) { $uri = $_SERVER['PATH_INFO']; } elseif (isset($_SERVER['REQUEST_URI'])) { $uri = $_SERVER['REQUEST_URI']; if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) { $uri = substr($uri, strlen($_SERVER['SCRIPT_NAME'])); } elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) { $uri = substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME']))); } // This section ensures that even on servers that require the URI to be in the query string (Nginx) a correct // URI is found, and also fixes the QUERY_STRING server var and $_GET array. if (strncmp($uri, '?/', 2) === 0) { $uri = substr($uri, 2); } $parts = preg_split('#\\?#i', $uri, 2); $uri = $parts[0]; if (isset($parts[1])) { $_SERVER['QUERY_STRING'] = $parts[1]; parse_str($_SERVER['QUERY_STRING'], $_GET); } else { $_SERVER['QUERY_STRING'] = ''; $_GET = array(); } $uri = parse_url($uri, PHP_URL_PATH); } else { // Couldn't determine the URI, so just return false return false; } // Do some final cleaning of the URI and return it return ($prefix_slash ? '/' : '') . str_replace(array('//', '../'), '/', trim($uri, '/')); }
/** * Page d'affichage des résultats de validation XML selon une DTD * * - l'argument var_url peut indiquer un fichier ou un repertoire * - l'argument ext peut valoir "php" ou "html" * -- Si "php", le script est execute et la page valide * -- Si "html", on suppose que c'est un squelette dont on devine les args * en cherchant les occurrences de Pile[0]. * * @example * ``` * ecrire?exec=valider_xml&var_url=exec&ext=php pour tester l'espace prive * ecrire?exec=valider_xml&var_url=../squelettes-dist&ext=html pour le public * ``` * * @uses valider_xml_ok() **/ function exec_valider_xml_dist() { if (!autoriser('sauvegarder')) { include_spip('inc/minipres'); echo minipres(); } else { $erreur = ""; // verifier que les var de l'URL sont conformes avant d'appeler la fonction $url = trim(_request('var_url')); if (strncmp($url, '/', 1) == 0) { $erreur = 'Chemin absolu interdit pour var_url'; } // on a pas le droit de remonter plus de 1 fois dans le path (pas 2 occurences de ../) if (($p = strpos($url, '../')) !== false and strpos($url, '../', $p + 3) !== false) { $erreur = 'Interdit de remonter en dehors de la racine'; } $ext = trim(_request('ext')); $ext = ltrim($ext, '.'); // precaution if (preg_match('/\\W/', $ext)) { $erreur = 'Extension invalide'; } if ($erreur) { include_spip('inc/minipres'); echo minipres($erreur); } else { valider_xml_ok($url, $ext, intval(_request('limit')), _request('recur')); } } }
/** * Constructor. Parses URL into sections. * @param string $url Incoming URL. * @access public */ function __construct($url = '') { list($x, $y) = $this->chompCoordinates($url); $this->setCoordinates($x, $y); $this->scheme = $this->chompScheme($url); if ($this->scheme === 'file') { // Unescaped backslashes not used in directory separator context // will get caught by this, but they should have been urlencoded // anyway so we don't care. If this ends up being a problem, the // host regexp must be modified to match for backslashes when // the scheme is file. $url = str_replace('\\', '/', $url); } list($this->username, $this->password) = $this->chompLogin($url); $this->host = $this->chompHost($url); $this->port = false; if (preg_match('/(.*?):(.*)/', $this->host, $host_parts)) { if ($this->scheme === 'file' && strlen($this->host) === 2) { // DOS drive was placed in authority; promote it to path. $url = '/' . $this->host . $url; $this->host = false; } else { $this->host = $host_parts[1]; $this->port = (int) $host_parts[2]; } } $this->path = $this->chompPath($url); $this->request = $this->parseRequest($this->chompRequest($url)); $this->fragment = strncmp($url, "#", 1) == 0 ? substr($url, 1) : false; $this->target = false; }
/** * reload the DB tables using the DB SQL dump found in config/zfdemo.<type>.sql */ public function resetAction() { // STAGE 3: Choose, create, and optionally update models using business logic. $registry = Zend_Registry::getInstance(); $db = $registry['db']; // if the DB is not configured to handle "large" queries, then we need to feed it bite-size queries $filename = $registry['configDir'] . 'zfdemo.' . $registry['config']->db->type . '.sql'; $statements = preg_split('/;\\n/', file_get_contents($filename, false)); foreach ($statements as $blocks) { $sql = ''; foreach (explode("\n", $blocks) as $line) { if (empty($line) || !strncmp($line, '--', 2)) { continue; } $sql .= $line . "\n"; } $sql = trim($sql); if (!empty($sql)) { $db->query($sql); } } // STAGE 4: Apply business logic to create a presentation model for the view. $this->view->filename = $filename; // STAGE 5: Choose view and submit presentation model to view. $this->renderToSegment('body'); }
/** * Closes an opening tag. * * Throws an ISE for incorrectly nested calls, e.g. * <code> * $w->startElement('name'); * $w->startComment(); * $w->endElement(); * </pre> * * @param string what * @throws lang.IllegalStateException */ protected function _close($what) { if (0 !== strncmp($what, $p = array_pop($this->stack), strlen($what))) { throw new \lang\IllegalStateException('Incorrect nesting, expecting ' . $what . '..., have ' . $p); } $this->stream->write($p); }
protected function catchMessage($line) { if (0 === strncmp(ltrim($this->bodyLine), '---', 3)) { $this->unregister(array(__FUNCTION__ => T_MAIL_BODY)); $this->register(array('catchMessageId' => T_MAIL_BODY)); } }
/** * Has a user effective access to the Resource? * @param User user * @param mixed resource * @param mixed privilege * @param mixed id * @return bool */ public function isAllowed($user, $resource = IAuthorizator::ALL, $privilege = IAuthorizator::ALL, $id = NULL) { $allowed = NULL; if (isset($this->resources[$resource])) { foreach ($this->resources[$resource]['relationships'] as $relation) { if (isset($this->simpleCache['resource'][$user->getId()][$resource][$id][$relation])) { if (!$this->simpleCache['resource'][$user->getId()][$resource][$id][$relation]) { continue; } } else { $this->simpleCache['resource'][$user->getId()][$resource][$id][$relation] = $this->resources[$resource]['cb']($user, $relation, $id); } if ($this->simpleCache['resource'][$user->getId()][$resource][$id][$relation]) { $acl = $this->getAcl($resource, $privilege, $id, [':acl_relation.name' => $relation]); try { foreach ($acl as $rule) { if ($rule->access !== NULL) { if ((bool) $rule->access === FALSE) { return (bool) $rule->access; } else { $allowed = (bool) $rule->access; } } } } catch (Nette\InvalidArgumentException $e) { if (strncmp($e->getMessage(), 'No reference found for', strlen('No reference found for')) !== 0) { throw $e; } } } } } return $allowed; }
public function extract($pathExtracted) { if (substr_compare($pathExtracted, '/', -1)) { $pathExtracted .= '/'; } $fileselector = array(); $list = array(); $count = $this->ziparchive->numFiles; if ($count === 0) { return 0; } for ($i = 0; $i < $count; $i++) { $entry = $this->ziparchive->statIndex($i); $filename = str_replace('\\', '/', $entry['name']); $parts = explode('/', $filename); if (!strncmp($filename, '/', 1) || array_search('..', $parts) !== false || strpos($filename, ':') !== false) { return 0; } $fileselector[] = $entry['name']; $list[] = array('filename' => $pathExtracted . $entry['name'], 'stored_filename' => $entry['name'], 'size' => $entry['size'], 'compressed_size' => $entry['comp_size'], 'mtime' => $entry['mtime'], 'index' => $i, 'crc' => $entry['crc']); } $res = $this->ziparchive->extractTo($pathExtracted, $fileselector); if ($res === false) { return 0; } return $list; }
private function _detect_uri() { if (!isset($_SERVER['REQUEST_URI'])) { return ''; } $uri = $_SERVER['REQUEST_URI']; if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) { $uri = substr($uri, strlen($_SERVER['SCRIPT_NAME'])); } elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) { $uri = substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME']))); } // This section ensures that even on servers that require the URI to be in the query string (Nginx) a correct // URI is found, and also fixes the QUERY_STRING server var and $_GET array. if (strncmp($uri, '?/', 2) === 0) { $uri = substr($uri, 2); } $parts = preg_split('#\\?#i', $uri, 2); $uri = $parts[0]; if (isset($parts[1])) { $_SERVER['QUERY_STRING'] = $parts[1]; parse_str($_SERVER['QUERY_STRING'], $_GET); } else { $_SERVER['QUERY_STRING'] = ''; $_GET = array(); } if ($uri == '/' || empty($uri)) { return '/'; } $uri = parse_url($uri, PHP_URL_PATH); // Do some final cleaning of the URI and return it return str_replace(array('//', '../'), '/', trim($uri, '/')); }
/** * Plugin SkelEditor * Editeur de squelette en ligne * (c) 2007-2010 erational * Licence GPL-v3 * */ function action_skeleditor_new_from_dist(){ $securiser_action = charger_fonction('securiser_action','inc'); $arg = $securiser_action(); // $arg est le fichier que l'on veut personaliser if (strncmp($arg,_DIR_RACINE,strlen(_DIR_RACINE)!==0)) $arg = _DIR_RACINE.$arg; include_spip('inc/skeleditor'); $file = skeleditor_nom_copie($arg); if ($file){ include_spip('inc/skeleditor'); $path_base = skeleditor_path_editable(); list($chemin,) = skeleditor_cree_chemin($path_base, $file); if ($chemin){ $file = basename($file); if (!file_exists($chemin . $file)) { lire_fichier($arg, $contenu); ecrire_fichier($chemin . $file, skeleditor_commente_copie($arg,$contenu)); } if (file_exists($f=$chemin.$file)) $GLOBALS['redirect'] = parametre_url(_request('redirect'),'f',$f); } } }
public function extract($pathExtracted) { $pathExtracted = str_replace('\\', '/', $pathExtracted); $list = $this->pclzip->listContent(); foreach($list as $entry) { $filename = str_replace('\\', '/', $entry['stored_filename']); $parts = explode('/', $filename); if(!strncmp($filename, '/', 1) || array_search('..', $parts) !== false || strpos($filename, ':') !== false) { return 0; } } // PCLZIP_CB_PRE_EXTRACT callback returns 0 to skip, 1 to resume, or 2 to abort return $this->pclzip->extract( PCLZIP_OPT_PATH, $pathExtracted, PCLZIP_OPT_STOP_ON_ERROR, PCLZIP_CB_PRE_EXTRACT, create_function( '$p_event, &$p_header', "return strncmp(\$p_header['filename'], '$pathExtracted', strlen('$pathExtracted')) ? 0 : 1;" ) ); }
function init($sA2Billing = null) { if ($sA2Billing) { $this->a2billing =& $sA2Billing; } else { $this->a2billing =& A2Billing::instance(); } if (isset($GLOBALS['FG_DEBUG'])) { $this->FG_DEBUG = $GLOBALS['FG_DEBUG']; } // Fill a local array with dirty versions of data.. if (!$this->prefix) { $this->_dirty_vars = array_merge($_GET, $_POST); } else { $tmp_arr = array_merge($_GET, $_POST); $tlen = strlen($this->prefix); $this->_dirty_vars = array(); // Find vars matching prefix and strip that! foreach ($tmp_arr as $key => $data) { if (strncmp($this->prefix, $key, $tlen) == 0) { $this->_dirty_vars[substr($key, $tlen)] = $data; } } } // set action, for a start: $this->action = $this->getpost_single('action'); if ($this->action == null) { $this->action = $this->action_ask; } }
function upgrade_module_0_9($module) { $module_path = $module->getLocalPath(); $img_folder_path = $module->getLocalPath() . 'img'; $fixture_img_path = $module->getLocalPath() . 'img' . DIRECTORY_SEPARATOR . 'fixtures'; if (!Tools::file_exists_cache($img_folder_path)) { mkdir($img_folder_path); } if (!Tools::file_exists_cache($fixture_img_path)) { mkdir($fixture_img_path); } $files = scandir($module->getLocalPath()); foreach ($files as $file) { if (strncmp($file, 'advertising', 11) == 0) { if ($file == 'advertising.jpg') { copy($module_path . $file, $fixture_img_path . DIRECTORY_SEPARATOR . $file); } else { copy($module_path . $file, $img_folder_path . DIRECTORY_SEPARATOR . $file); } unlink($module_path . $file); } } Tools::clearCache(Context::getContext()->smarty, $module->getTemplatePath('blockadvertising.tpl')); return true; }
function ShowCSS() { /** @global CMain $APPLICATION */ global $APPLICATION; $this->Init(); $arCSS = array_merge(array( ADMIN_THEMES_PATH.'/'.ADMIN_THEME_ID.'/compatible.css', //ADMIN_THEMES_PATH.'/'.ADMIN_THEME_ID.'/adminstyles.css', '/freetrix/panel/main/adminstyles_fixed.css', '/freetrix/panel/main/admin.css', ), $this->GetModulesCSS(), $APPLICATION->GetCSSArray() ); $s = ''; foreach($arCSS as $css) { $bExternalLink = (strncmp($css, 'http://', 7) == 0 || strncmp($css, 'https://', 8) == 0); if($bExternalLink || file_exists($_SERVER['DOCUMENT_ROOT'].$css)) $s .= '<link rel="stylesheet" type="text/css" href="'.($bExternalLink? $css : CUtil::GetAdditionalFileURL($css, true)).'">'."\n"; } return $s; }
function BindTimeStamp($d) { $d = ADOConnection::DBTimeStamp($d); if (strncmp($d,"'",1)) return $d; return substr($d,1,strlen($d)-2); }