public function __construct($path) { parent::__construct(); //echo "__construct path='".$path."'<br/>"; //normalize path string $path = trim($path, '/'); //set full path of object $this->path = $path; $this->fullPath = $this->dataPrefix . '/' . $path; //echo "this->path = '".$this->path."'<br/>"; //echo "this->fullPath = ".$this->fullPath."<br/>"; //determine type if (!is_dir($this->fullPath)) { $ex = $this->getExtension(); } if (is_dir($this->fullPath)) { $this->type = self::DIR; } else { if (in_array($ex, $this->video) && substr($this->getBaseName(), 0, 10) == 'converted_') { $this->type = self::VIDEO; } else { if (in_array($ex, $this->image)) { $this->type = self::IMAGE; } else { $this->type = self::UNKNOWN; } } } }
public function __construct($parentPage, $WordpressInsertPage, $selfPage) { parent::__construct($parentPage); $this->WordpressInsertPage = $WordpressInsertPage; $this->selfPage = $selfPage; $this->insertFacebookSDK(); }
public function __construct($mode = 'php', Misc $misc) { $this->mode = $mode; $this->misc = $misc; // Execute parent constructor parent::__construct(); // Check if PHP version is the minimum required if (version_compare(PHP_VERSION, '5.3.3') < 0) { $version_parts = explode('-', PHP_VERSION); $version = current($version_parts); throw new Exception('PHP ' . $version . ' is too old. Must be at least version 5.3.3.'); } // Check for Blowfish hashing support if ((defined('CRYPT_BLOWFISH') and CRYPT_BLOWFISH) === false) { throw new Exception('Failed to find CRYPT_BLOWFISH. Blowfish hashing support is required.'); } // Exit if notification email is set to the default if ($this->notificationEmail === '*****@*****.**') { throw new Exception('You must use a UNIQUE notification e-mail in ' . __FILE__); } // Exit if encryption key is set to the default if ($this->encryptionKey === '8CharKey') { throw new Exception('You must use a UNIQUE encryption key in ' . __FILE__); } // Exit if administrative password is set to the default if ($this->adminPassword === 'password') { throw new Exception('You must use a UNIQUE admin password in ' . __FILE__); } // Error if the script wasn't requested by this server if ($this->mode === 'javascript' and $this->refererCheck() === false) { throw new Exception('External use not allowed.'); } // Instantiate encryption class $this->encryption = new Encryption($this->encryptionKey); // Disable password if name is disabled if ($this->fieldOptions['name'] === false) { $this->fieldOptions['password'] = false; } // Disable login if name or password is disabled if ($this->fieldOptions['name'] === false or $this->fieldOptions['password'] === false) { $this->allowsLogin = false; } // Disable autologin if login is disabled if ($this->allowsLogin === false) { $this->usesAutoLogin = false; } // Check if visitor is on mobile device if (!empty($_SERVER['HTTP_USER_AGENT'])) { if (preg_match('/(android|blackberry|phone)/i', $_SERVER['HTTP_USER_AGENT'])) { // Adjust settings to accommodate $this->isMobile = true; $this->imageFormat = 'svg'; } } // Check for JSON settings file; parse it if it exists if (file_exists($this->rootDirectory . '/' . $this->JSONSettingsFile)) { $this->JSONSettings($this->rootDirectory . '/' . $this->JSONSettingsFile); } }
public function __construct($settingsPage, $GroupInsertPage, $selfPage) { parent::__construct($settingsPage); $this->GroupInsertPage = $GroupInsertPage; $this->sql = new sqlService(); $this->selfPage = $selfPage; $this->insertFacebookSDK(); }
public function __construct($name, $display_name, $path) { parent::__construct($name, $display_name, $path); $this->_smartyPath = PATH_SMARTY_TPL . '/web' . $path; }
public function __construct($settingsPage, $EventInsertPage) { parent::__construct($settingsPage); $this->EventInsertPage = $EventInsertPage; }
public function __construct($module) { parent::__construct(CONFIG_DIR . '/' . $module . '.json'); $this->name = $module; $this->config = $this->read(); }
public function __construct($mode = 'javascript', $page_url, $page_title = '') { parent::__construct(); // Check if PHP version is the minimum required if (version_compare(PHP_VERSION, '5.3.3') < 0) { $version_parts = explode('-', PHP_VERSION); $version = current($version_parts); exit($this->escapeOutput('<b>HashOver</b>: PHP ' . $version . ' is too old. Must be at least version 5.3.3.', 'single')); } // Check for Blowfish hashing support if ((defined('CRYPT_BLOWFISH') and CRYPT_BLOWFISH) === false) { exit($this->escapeOutput('<b>HashOver</b>: Failed to find CRYPT_BLOWFISH. Blowfish hashing support is required.', 'single')); } // Exit if encryption key is set to the default if ($this->encryptionKey === '8CharKey') { exit($this->escapeOutput('<b>HashOver</b>: You must use a UNIQUE encryption key in /hashover/scripts/settings.php', 'single')); } // Exit if notification email is set to the default if ($this->notificationEmail === '*****@*****.**') { exit($this->escapeOutput('<b>HashOver</b>: You must use a UNIQUE notification e-mail in /hashover/scripts/settings.php', 'single')); } // Exit if administrative nickname is set to the default if ($this->adminName === 'admin') { exit($this->escapeOutput('<b>HashOver</b>: You must use a UNIQUE admin nickname in /hashover/scripts/settings.php', 'single')); } // Exit if administrative password is set to the default if ($this->adminPassword === 'password') { exit($this->escapeOutput('<b>HashOver</b>: You must use a UNIQUE admin password in /hashover/scripts/settings.php', 'single')); } // Set mode $this->mode = $mode; // Set page URL if (!empty($page_url)) { $this->pageURL = $page_url; } else { // Error on failure exit($this->escapeOutput('<b>HashOver</b>: Failed to obtain page URL.', 'single')); } // Set page title if (!empty($page_title)) { $this->pageTitle = $page_title; } // Instantiate encryption class $this->encryption = new Encryption($this->encryptionKey); // Strip escape slashes from POST, GET, and COOKIE data if (get_magic_quotes_gpc()) { $_GET = array_map('stripslashes', $_GET); $_COOKIE = array_map('stripslashes', $_COOKIE); $_POST = array_map('stripslashes', $_POST); } // Cookie replacement search patterns $cookie_search = array('&', '<', '>', '"', "'", '/'); // Cookie replacement characters $cookie_replace = array('&', '<', '>', '"', ''', '/'); // Remove harmful characters from cookies foreach ($_COOKIE as $name => $value) { $_COOKIE[$name] = str_replace($cookie_search, $cookie_replace, $value); } // Setup user name via cookie if (!empty($_COOKIE['name']) and $_COOKIE['name'] !== $this->defaultName) { $this->userName = $_COOKIE['name']; } // Setup user password via cookie if (!empty($_COOKIE['password'])) { $this->userPassword = $_COOKIE['password']; } // Setup user e-mail via cookie if (!empty($_COOKIE['email'])) { $encrypted_email = trim(html_entity_decode($_COOKIE['email'], ENT_COMPAT, 'UTF-8'), " \r\n\t"); $encryption_keys = !empty($_COOKIE['encryption']) ? $_COOKIE['encryption'] : ''; $decrypted_email = $this->encryption->decrypt($encrypted_email, $encryption_keys); if (filter_var($decrypted_email, FILTER_VALIDATE_EMAIL)) { $this->userEmail = $decrypted_email; } } // Setup user website via cookie if (!empty($_COOKIE['website'])) { $this->userWebsite = $_COOKIE['website']; } // Check if user is logged in if (!empty($_COOKIE['hashover-login'])) { $this->userIsLoggedIn = true; // Check if user is logged in as admin if ($this->userName === $this->adminName) { if ($this->userPassword === $this->adminPassword) { $this->userIsAdmin = true; } } } // Turn page URL into array $this->parsedURL = parse_url($this->pageURL); // Set initial path if (empty($this->parsedURL['path']) or $this->parsedURL['path'] === '/') { $this->threadDirectory = 'index'; } else { // Remove starting slash $this->threadDirectory = substr($this->parsedURL['path'], 1); } if (!empty($this->parsedURL['query'])) { $this->parsedURL['query'] = explode('&', $this->parsedURL['query']); $ignore_queries = array('hashover_reply', 'hashover_edit'); $ignore_queries_file = $this->rootDirectory . '/ignore_queries.txt'; // Remove unwanted URL queries if (file_exists($ignore_queries_file)) { $ignore_queries_file = explode(PHP_EOL, file_get_contents($ignore_queries_file)); $ignore_queries = array_merge($ignore_queries, $ignore_queries_file); } for ($q = 0, $ql = count($this->parsedURL['query']); $q < $ql; $q++) { if (!in_array($this->parsedURL['query'][$q], $ignore_queries, true)) { $equals = explode('=', $this->parsedURL['query'][$q]); if (in_array($equals[0], $ignore_queries, true)) { $this->pageURL = str_replace($this->parsedURL['query'][$q], '', $this->pageURL); } else { $this->URLQueries .= ($q > 0 ? '&' : '') . $this->parsedURL['query'][$q]; } } } $this->pageURL = trim($this->pageURL, '?&'); $this->threadDirectory .= '-' . $this->URLQueries; } else { $this->parsedURL['query'] = array(); } // Characters that aren't allowed in directory names $reserved_chars = array('<', '>', ':', '"', '/', '\\', '|', '?', '&', '!', '*', '.', '=', '_', '+', ' '); // Replace reserved characters with dashes $this->threadDirectory = str_replace($reserved_chars, '-', $this->threadDirectory); // Remove multiple dashes if (strpos($this->threadDirectory, '--') !== false) { $this->threadDirectory = preg_replace('/-{2,}/', '-', $this->threadDirectory); } // Strip HTML tags from page URL $this->pageURL = strip_tags(html_entity_decode($this->pageURL, false, 'UTF-8')); // Encode HTML characters in page URL $this->pageURL = htmlspecialchars($this->pageURL, false, 'UTF-8', false); // Strip HTML tags from page title $this->pageTitle = strip_tags(html_entity_decode($this->pageTitle, false, 'UTF-8')); // Encode HTML characters in page title $this->pageTitle = htmlspecialchars($this->pageTitle, false, 'UTF-8', false); // Remove leading and trailing dashes $this->threadDirectory = trim($this->threadDirectory, '-'); // Final comment directory name $this->dir = $this->rootDirectory . '/pages/' . $this->threadDirectory; }
public function __construct() { $this->file = 'general.json'; parent::__construct(); }
public function __construct($settingsPage, $EventInsertPage) { parent::__construct($settingsPage); $this->EventInsertPage = $EventInsertPage; $this->insertFacebookSDK(); }