function get_user_avatar($email, $s = 80, $class = '', $d = 'mm', $r = 'g', $img = false) { $url = 'http://www.gravatar.com/avatar/'; $url .= md5(strtolower(trim($email))); $url .= "?s=200&d={$d}&r={$r}"; $avatarsize = getimagesize($url); $avatar = '<img src="' . $url . '" ' . imgResize($avatarsize[1], $avatarsize[1], $s) . ' class="' . $class . '" />'; return Hooks::apply_filter('user_avatar', $avatar, $email, $s); }
public function runRole($data) { $roleID = $data['roleID']; $roleName = $data['roleName']; $rolePerm = Hooks::maybe_serialize($data['permission']); $strSQL = DB::inst()->query(sprintf("REPLACE INTO `role` SET `ID` = %u, `roleName` = '%s', `permission` = '%s'", $roleID, $roleName, $rolePerm)); redirect(BASE_URL . 'role/'); }
function tp_authenticate_cookie($cookie, $cookiehash, $user_id = '') { $hasher = new \tinyPHP\Classes\Libraries\PasswordHash(8, TRUE); $check = $hasher->CheckPassword($cookie, $cookiehash); return Hooks::apply_filter('authenticate_cookie', $check, $cookie, $cookiehash, $user_id); }
/** * Writes cache data to be read * * @access public * @since 4.3 * @param string (required) $data Data that should be cached * @param string (required) $filename Name of the cache file * @return mixed */ public function writeCache($fileName, $data) { $this->_cachefile = $this->_cachepath . $fileName . $this->_extension; $fp = fopen($this->_cachefile, 'w'); if ($fp) { $values = Hooks::maybe_serialize($data); fwrite($fp, $values); fclose($fp); } else { return $this->addLog('Could not read filename: ' . $fileName . ' data: ' . $data); } }
* Site Root * * PHP 5 * * tinyPHP(tm) : Simple & Lightweight MVC Framework (http://tinyphp.us/) * Copyright 2012, 7 Media Web Solutions, LLC (http://www.7mediaws.org/) * * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * * @copyright Copyright 2012, 7 Media Web Solutions, LLC (http://www.7mediaws.org/) * @link http://tinyphp.us/ tinyPHP(tm) Project * @since tinyPHP(tm) v 0.1 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ defined('DS') or define('DS', DIRECTORY_SEPARATOR); defined('BASE_PATH') or define('BASE_PATH', __DIR__ . DS); defined('APP_FOLDER') or define('APP_FOLDER', 'Application'); defined('SYS_PATH') or define('SYS_PATH', BASE_PATH . 'tinyPHP' . DS); defined('APP_PATH') or define('APP_PATH', SYS_PATH . APP_FOLDER . DS); defined('LOCALE_DIR') or define('LOCALE_DIR', SYS_PATH . 'Locale'); defined('DEFAULT_LOCALE') or define('DEFAULT_LOCALE', ''); defined('ENCODING') or define('ENCODING', 'UTF-8'); defined('CURRENT_VERSION') or define('CURRENT_VERSION', '1.0.0'); require SYS_PATH . 'application.php'; $cookieDomain = new \tinyPHP\Classes\Libraries\Cookies(); defined('COOKIE_EXPIRE') or define('COOKIE_EXPIRE', time() + \tinyPHP\Classes\Libraries\Hooks::get_option('cookieexpire')); defined('COOKIE_PATH') or define('COOKIE_PATH', \tinyPHP\Classes\Libraries\Hooks::get_option('cookiepath')); defined('COOKIE_DOMAIN') or define('COOKIE_DOMAIN', $cookieDomain->cookieDomain()); defined('DEFAULT_LOCALE') or define('DEFAULT_LOCALE', Hooks::get_option('core_locale')); $app = new \tinyPHP\Classes\Core\Bootstrap();
function version() { Hooks::do_action('version'); }
/** * Returns cookie domain * * @since 1.0.0 * @return mixed * */ public function cookieDomain() { /* Use to set cookie session for domain. */ $parts = explode('.', $_SERVER['SERVER_NAME']); $cookiedomain = $_SERVER['SERVER_NAME']; $cookiedomain = str_replace('www.', '', $cookiedomain); if (count($parts) == 3) { if ($parts[0] == 'www' || $parts[0] == '') { return Hooks::apply_filter('cookie_domain', $cookiedomain); } } }