/** * Process given string using the htmLawed algorithm. Deny risky HTML content. * @see <http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/> * @param String $input The text to process * @param Boolean $safemode Use builtin 'safe' configuration * @param Mixed $config Custom configuration array (extends default configuration) * @return String The processed text */ public static function htmLawed($input, $safemode = true, $config = null) { $localConfig = array(); if ($safemode) { $localConfig['safe'] = 1; $localConfig['deny_attribute'] = 'style'; $localConfig['balance'] = 0; } if ($config != null && is_array($config)) { array_merge($localConfig, $config); } try { include_once Context::getLibsPath('htmLawed.php'); return htmLawed($input, $localConfig); } catch (\Exception $e) { if (\Orion::isDebug()) { throw $e; } else { throw new Security\Exception('An exception occured while trying to run security parsing using htmLawed.', self::E_HTMLAWED_FAIL); } } }
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.</p> * * * @author Thibaut Despoulain * @copyright 2010-2012, Thibaut Despoulain * @link http://orionphp.org/ * @version 0.11.12 beta1 */ session_start(); error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED); //error_reporting(-1); require_once 'orion/orion.php'; try { $orion = new Orion('orion/'); $orion->configure('main'); //$orion->debug(); $orion->run(); } catch (Exception $e) { $html = "<!DOCTYPE html><html lang=en><head><meta charset=utf-8><title>Oops, something wrong happened</title><style>*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKsAAADVCAMAAAAfHvCaAAAAGFBMVEVYn%2BH%2F%2F%2F%2Bex%2B3U5vd7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HHqjisgVLLPE%2F8rXYD7UCrVsXzxN%2Bq4uAGrFj8gPhTXRzKwGprmh8Qf2rlot2AvSp%2BQvyl1nikAlprh58Qf0lqolGBarX8iPhLZWBVqnVsfkb8pTaHcru61PyM%2BEtrDq2UW8sPib%2FUChBvbIcfEn%2FKxWGrpeWnxJ9qVYDyVPgp8bfa2qRmmh8Tf21lq5qfE38uveE3%2FAdr385%2FSVd%2FMAAAAABJRU5ErkJggg%3D%3D) 100% 5px no-repeat;margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{padding-right:205px}p{margin:22px 0 0;overflow:hidden}ins,#g{text-decoration:none}ins{color:#777}a img{border:0}#g{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAAA3CAMAAADZn0ObAAABgFBMVEX%2F%2F%2F%2Fy1pHuLjfMm2W4yfA1TrPukgZDats3V8fwTEypjWy8u7oPsSWVsOoBdwwClhI%2FZdlasGjpOUOVlJjx0c20CyZpea36pAdIdebyu7COlqpYaql2hLH40Gn59vayuMlZiOunpqjYGy9wiNLd5PRqlOzzcmz%2Fwi4FpRrqsDisbm7O2O%2FKycrGfHmdo7CFmdPs7Ozz8%2FPIDSvcFC%2BTR0vCw8Xj5OTc3Nynvu7l6%2FfVjyw7Xc%2FSMT%2FZbgbT09NDbuHKz9BKf1Hr5ubiHTLt8vz%2Btxj1%2BOrT1txYedhLcNfwjYjTES6yq6r27Oqnq7NJZsiykpDNEiyxUVOTptiys7LNs6%2FhegO3p5L46MRveZiXcHBFXbY5dkLUysj0Pj9OfOjRS1JVZZzMrZGoXWCzKjn%2BrgpcdsflfIKh26frpKHJGzIqxDe4cC2AoOnOXl%2FYaWx204D4XVWsPEjRXwXqoRqYFSnN5dBhfMwZjipRaLvUmpk3x0SualZBXcJIV5A9nk5h34NHAAAJe0lEQVRo3u1YC1fa2BYGBBJA2lSeRjzyUKmQQgJNAoYhlJciiKJYHx2hYm2rre2140zHmem9f%2F3uE16JOpVZpcuuu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k1c%2BGDp%2BAFTKJF%2FzufdnZtz7PrrevDZ03GPAaJDjbRA8dGsW6X6cgNmAhSEG%2FUiY%2Fsfiv02O7iVu1LunAAAAAElFTkSuQmCC);display:block;height:55px;margin:0 0 -7px;width:150px}* > #g{margin-left:-2px}#g img{visibility:hidden}* html #g img{visibility:visible}*+html #g img{visibility:visible}</style></head>\n <body><p><b>Exception found !</b><br><ins>But it's OK, no kittens were harmed in the process.</ins>\n <p>" . $e->__toString() . "</p><p><ins>That's all we know.</ins></p>"; if (\Orion::isDebug()) { $html .= "<h3>Traceback</h3><p>" . nl2br($e->getTraceAsString()) . "</p>"; } $html .= "</body></html>"; die($html); exit(1); }
/** * Write redirect header * @param mixed $url Either a redirect code or an URL */ public static function redirect($url) { if ($url == 404) { if (\Orion::isDebug()) { die('Requested URL failed. Components were : ' . self::$MODULE_EXT . ' : ' . self::$MODULE_NAME . ' : ' . self::$MODULE_URI); } else { $links = \Orion::config()->get('URL_404'); if (!array_key_exists(\Orion::getMode(), $links)) { $mode = 'default'; } else { $mode = \Orion::getMode(); } self::setHeaderCode(404); die(file_get_contents($links[$mode])); $exit(1); } } else { die(header('Location: ' . $url)); } }
/** * Try loging the user in. * <ul> * <li>Checks if already logged in session var</li> * <li>If not, check for post data from login module</li> * <li>Otherwise, redirect to login module</li> * </ul> * <p>If user if found and password/login match, user data is stored into * $this->user attributes, that you can access using Core\Auth->user()->name; * for example.</p> * <p>If login fails, a redirection occurs toward login module * , using /error/err_code routing.</p> */ public static function login($noredirect = false) { if (isset($_SESSION['orionauth'])) { $session = new Models\Auth\User(); $session->fromArray($_SESSION['orionauth']); if (\Orion::isDebug()) { var_dump($session); } self::$user = $session; return true; } else { if (isset($_POST['auth']) && isset($_POST['login']) && isset($_POST['password'])) { $data = Models\Auth\User::get()->where('login', Query::EQUAL, $_POST['login'])->limit(1)->fetch(); if ($data != false) { if (Models\Auth\User::hasField('verified') && $data->verified == 0) { if ($noredirect) { return false; } else { Context::redirect(Context::genModuleURL(\Orion::config()->get('AUTH_MODULE'), 'error-' . self::E_NOT_VERIFIED), 'default'); } } if (Models\Auth\User::hasField('banned') && $data->banned == 1) { if ($noredirect) { return false; } else { Context::redirect(Context::genModuleURL(\Orion::config()->get('AUTH_MODULE'), 'error-' . self::E_BANNED), 'default'); } } $hash = Security::saltedHash($_POST['password'], $_POST['login']); if ($hash == $data->password) { $session = new Models\Auth\User(); $session->login = $data->login; $session->level = $data->level; $session->name = $data->name; $session->surname = $data->surname; $session->id = $data->id; self::$user = $session; $_SESSION['orionauth'] = $session->toArray(); return true; } else { if ($noredirect) { return false; } else { Context::redirect(Context::genModuleURL(\Orion::config()->get('AUTH_MODULE'), 'error-' . self::E_PASSWORD_MISMATCH), 'default'); } } } else { if ($noredirect) { return false; } else { Context::redirect(Context::genModuleURL(\Orion::config()->get('AUTH_MODULE'), 'error-' . self::E_LOGIN_MISMATCH), 'default'); } } } else { $_SESSION['orion_auth_target'] = Context::getFullURL(); if ($noredirect) { return false; } else { Context::redirect(Context::genModuleURL(\Orion::config()->get('AUTH_MODULE'), 'do/login', 'default')); } } } }
/** * Get current query string * @return string current query string */ public function getQuery() { if ($this->_TABLE == null) { throw new Core\Exception('Unable to perform query, no table provided.'); } if ($this->hasModel()) { $this->unsetTable(); } if ($this->_MWHERE != null) { $where = $this->_MWHERE; } else { if (!empty($this->_WHERE) && is_array($this->_WHERE)) { $where = implode(' ', $this->_WHERE); if (!empty($this->_AWHERE)) { foreach ($this->_AWHERE as $andClause) { $where .= ' AND ' . implode(' ', $andClause); } } if (!empty($this->_OWHERE)) { foreach ($this->_OWHERE as $orClause) { $where .= ' OR ' . implode(' ', $orClause); } } } else { $where = null; } } switch ($this->_TYPE) { case 'select': $query = "SELECT "; if ($this->_DISTINCT) { $query .= 'DISTINCT '; } $query .= implode(', ', $this->_COLUMNS); foreach ($this->_JOIN_COLUMNS as $col) { $query .= ", " . implode(' AS ', $col); } $query .= " FROM " . $this->antiQuote($this->_TABLE); if (!empty($this->_JOIN)) { if (!$this->hasModel()) { throw new Core\Exception('Trying to execute a join query with no model bound.'); } else { $model = $this->model; } } foreach ($this->_JOIN as $key => $data) { $query .= " " . strtoupper($data[1]) . " JOIN " . $this->antiQuote($data[0]) . " ON " . $this->tablePrefix($model::getField($key)->getBinding()) . "=" . $this->tablePrefix($model::getField($key)->getRightfield(), false, $data[0]); } foreach ($this->_JOIN_TABLE as $table => $data) { $query .= " " . strtoupper($data[2]) . " JOIN " . $this->antiQuote($table) . " ON " . $this->tablePrefix($data[0]) . "=" . $this->tablePrefix($data[1], false, $table); } if ($where != null) { $query .= " WHERE " . $where; } if ($this->_GROUPBY != null) { $query .= " GROUP BY " . $this->_GROUPBY; } if (!empty($this->_ORDER)) { $order = array(); foreach ($this->_ORDER as $field => $mode) { $order[] = $field . ' ' . $mode; } $query .= " ORDER BY " . implode(', ', $order); } if ($this->_LIMIT != null) { $query .= " LIMIT " . $this->_LIMIT; } if ($this->_OFFSET != null) { $query .= " OFFSET " . $this->_OFFSET; } break; case 'insert': if (empty($this->_DATA)) { throw new Core\Exception('Missing row data in insert query.'); } $query = "INSERT INTO `" . $this->_TABLE . "`"; $keys = array_keys($this->_DATA); $values = array_values($this->_DATA); $query .= " (" . implode(', ', $keys) . ") VALUES (" . implode(', ', $values) . ")"; break; case 'update': if (empty($this->_DATA)) { throw new Core\Exception('Missing row data in update query.'); } $query = "UPDATE `" . $this->_TABLE . "`"; $sets = array(); foreach ($this->_DATA as $key => $value) { $sets[] = $key . '=' . $value; } $query .= " SET " . implode(', ', $sets); if ($where == null) { throw new Core\Exception('Update query must have a where clause.'); } else { $query .= " WHERE " . $where; } if ($this->_LIMIT != null) { $query .= " LIMIT " . $this->_LIMIT; } break; case 'delete': $query = "DELETE FROM `" . $this->_TABLE . "`"; if ($where == null) { throw new Core\Exception('Delete query must have a where clause.', E_USER_WARNING, get_class($this)); } else { $query .= " WHERE " . $where; } if ($this->_LIMIT != null) { $query .= " LIMIT " . $this->_LIMIT; } break; default: throw new Core\Exception('Unknown query type.', E_USER_WARNING, get_class($this)); break; } $this->_QUERY_STRING = $query; if (\Orion::isDebug()) { echo 'SQL_QUERY: ' . $query . '<br />'; } return $query . ';'; }