function resizeImage($origName, $destName, $maxWidth = false, $maxHeight = false, $quality = false) { //http://php.net/manual/en/function.imagecopyresampled.php if (!$maxWidth) { $maxWidth = bu::config('rc/maxWidth'); } if (!$maxHeight) { $maxHeight = bu::config('rc/maxHeight'); } if (!$quality) { $quality = bu::config('rc/quality'); } $width = $maxWidth; $height = $maxHeight; list($width_orig, $height_orig) = getimagesize($origName); $ratio_orig = $width_orig / $height_orig; if ($width_orig < $width and $height_orig < $height) { $width = $width_orig; $height = $height_orig; } elseif ($width / $height > $ratio_orig) { $width = $height * $ratio_orig; } else { $height = $width / $ratio_orig; } bu::lib('opt/smart_resize_image/smart_resize_image.function'); smart_resize_image($origName, $width, $height, false, $destName, false); }
public static function DoIt() { self::prepareHttpString(); ob_start(); try { $url = new BuUrl2(self::$httpString); bu::setBuUrlInstance($url); self::runController($url); } catch (Exception $e) { ob_end_clean(); $msg = 'Ошибка на сайте'; if (bu::config('rc/debug')) { $msg = get_class($e) . ': ' . $e->getMessage(); } $content = $msg; if (bu::config('rc/debug')) { $content .= sprintf('<br><b>%s</b><br>', get_class($e)); $content .= "<pre>"; foreach (array_reverse($e->getTrace()) as $v) { if (isset($v['line'])) { $content .= $v['line'] . ' ' . $v['file'] . "\n"; } } $content .= "</pre>"; } echo bu::view('layout/panic', array('content' => $content)); } }
private static function tryToPreloadConfig($path) { if (bu::config('cache/config') and BuCache::exists('etc/' . md5($path))) { self::$configArray[$path] = BuCache::get('etc/' . md5($path)); } else { self::$configArray[$path] = self::readConfigFromFiles($path); if (bu::config('cache/config')) { BuCache::set('etc/' . md5($path), self::$configArray[$path]); } } }
function is_need_cache($v = null) { if (!bu::config('rc/cache')) { return false; } static $r = false; if (!is_null($v)) { $r = $v; } return $r; }
private static function getRouteList() { if (!self::$route) { $config = bu::config('route'); $newRoute = array(); if ($config) { foreach ($config as $k => $v) { $newK = str_replace(':any', '.*', $k); $newK = str_replace(':num', '[0-9]+', $newK); $newRoute[$newK] = $v; } } self::$route = $newRoute; } return self::$route; }
public static function db($configName = 'default') { if (!isset(self::$_db[$configName])) { $config = bu::config('db/' . $configName); self::$_db[$configName] = new PDO($config['driver'] . ':host=' . $config['host'] . ';dbname=' . $config['database'], $config['user'], $config['password']); } return self::$_db[$configName]; }
<?php bu::lib('php-activerecord/ActiveRecord'); ActiveRecord\Config::initialize(function ($cfg) { $dbs = bu::config('db'); $connections = array(); foreach ($dbs as $k => $v) { $connections[$k] = sprintf('%s://%s:%s@%s/%s', $v['driver'], $v['user'], $v['password'], $v['host'], $v['database']); } $cfg->set_connections($connections); $cfg->set_default_connection('default'); });
public static function clear($path) { unset($_SESSION[bu::config('session/prefix')][$path]); }
<?php if (bu::config('rc/debugBar')) { BuStatistic::printa(); } $pages = bu::session('pages'); $pages['num_redirects'] = 0; bu::session('pages', $pages);
public static function lang($key) { return self::config('lang/' . bu::config('rc/language') . '/' . $key); }
<link href="/public/css/style.css" rel="stylesheet" type="text/css" media="screen, projection" /> <SCRIPT LANGUAGE="JavaScript"> <!-- //http://www.webreference.com/js/tips/991125.html function highlight(field) { field.focus(); field.select(); } // --> </SCRIPT> </head> <body> <div id='content'> <div id='wrapper'> <h1><?php echo bu::config('rc/siteName'); ?> </h1> <?php echo $content; ?> </div> </div> <a href='http://bubujka.ru'><img id='bu_logo' src='/public/bu_logo.png'></a> <?php echo bu::view('counter'); ?> </body> </html>
</p> <p> Возможно было сделано совсем не то, что задумывалось программистом. Может быть будет достаточно вернуться на страницу назад и попробовать сделать это "что-то" по другому. </p> <p> Если это не поможет, то напишите по адресу <a href='mailto:<?php echo bu::config('rc/adminEmail'); ?> '> <?php echo bu::config('rc/adminEmail'); ?> </a>. Этот человек вероятнее всего имеет отношение к этому сайту и может попытаться что-то сделать. </p> <?php if ($_POST) { ?> <p> Если до этого вы долго-долго что то писали и при отправке произошла эта ошибка, то это может оказаться здесь: <textarea><?php print_R($_POST); ?>
<?php require 'base.php'; $data = glob(bu::config('rc/uploadPath') . '/*/*/*'); $filteredData = array(); foreach ($data as $v) { $filteredData[] = str_replace(bu::config('rc/uploadPath'), '', $v); } $content = bu::view('all_photo', array('data' => $filteredData)); echo bu::view('index', array('title' => bu::lang('indexTitle'), 'content' => $content));