Skip to content

Instantly share code, notes, and snippets.

<?php
function updateSettingsFile($config_vars)
{
global $boarddir, $cachedir, $context;
// Updating the db_last_error, then don't mess around with Settings.php
if (count($config_vars) === 1 && isset($config_vars['db_last_error']))
{
updateDbLastError($config_vars['db_last_error']);
<tpl:container>
<tpl:template name="site:rounded"><tpl:if test="!isset({$header}) && !isset({$right})">
<div class="content no_header{tpl:if test="isset({$class})"} {$class}{/tpl:if}{tpl:if test="isset({$color})"} {$color}{/tpl:if}"{tpl:if test="isset({$id})"} id="{$id}"{/tpl:if}{tpl:if test="isset({$style})"} style="{$style}"{/tpl:if}><tpl:else />
<div class="content with_header{tpl:if test="isset({$class})"} {$class}{/tpl:if}{tpl:if test="isset({$color})"} {$color}{/tpl:if}"{tpl:if test="isset({$id})"} id="{$id}"{/tpl:if}{tpl:if test="isset({$style})"} style="{$style}"{/tpl:if}>
<div class="header">
<div><tpl:if test="isset({$right})">
<span class="floatright">{$right}</span></tpl:if>
<span><tpl:if test="isset({$header}) && !empty({$header})">{$header}<tpl:else />&nbsp;</tpl:if></span>
</div>
</div></tpl:if>
<!DOCTYPE html>
<html>
<head>
{% block head %}
<link rel="stylesheet" href="style.css" />
<title>{% block title %}{% endblock %} - My Webpage</title>
{% endblock %}
</head>
<body>
<div id="content">{% block content %}{% endblock %}</div>
[alias]
cm = commit -s
co = commit -s
ca = commit --amend -s
cas = commit --amend -s
commits = commit -s
<?php
namespace smCore\storage;
use smCore\storage\Storage, smCore\cache\Cache;
/**
* Database services concerning members. This class' methods allow us to retrieve, add and update
* information in/from the database about members.
* Every method deals with the necessary query/queries alone, as much as possible, thus allowing a single
* point where potential other Storage classes may override the query, for performance or other needs.
<?php
// in a file
function database()
{
return Storage::database();
}
...
<?php
class PDOConnection extends \PDO
{
// ... stuff
function fetch_all_as_whatever($query, $params)
{
// prepare, clean, whatnot
// retrieve a statement
@norv
norv / gist:2927930
Created June 14, 2012 04:04 — forked from mikemill/gist:2927915
Initial attempt at testing the user class. Still need to test user settings
<?php
namespace JawHare;
class UserTest extends \PHPUnit_Framework_TestCase
{
static protected $user;
protected $user_data = array(
'username' => 'PHPUnitTest',
'fullname' => 'PHP Unit Testing',
// If it hasn't been modified since the last time this attachement was retrieved, there's no need to display it again.
if (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE']))
{
list($modified_since) = explode(';', $_SERVER['HTTP_IF_MODIFIED_SINCE']);
if (strtotime($modified_since) >= filemtime($filename))
{
ob_end_clean();
// Answer the question - no, it hasn't been modified ;).
header('HTTP/1.1 304 Not Modified');
abstract class Controller
{
abstract function dispatch();
}
class BreezeSomething extends Controller
{
function dispatch()
{
// ...
}