This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class QuizzesController extends AppController | |
{ | |
var $helpers = array('Form'); | |
public function index() { | |
$this->set('description', 'Et xml/flash quiz værktøj'); | |
} | |
public function save($id = 1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$this->Quiz->saveAll($this->data['Quiz'], array('validate' => 'first')); | |
$quizId = $this->Quiz->id; | |
foreach($this->data['QuizQuestion'] as $data){ | |
$data['quiz_id'] = $quizId; | |
$this->Quiz->QuizQuestion->saveAll($data, array('validate' => 'first')); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DownloaderComponent extends Object | |
{ | |
public function sendFileHeaders($path) | |
{ | |
$handle = finfo_open(FILEINFO_MIME_TYPE); | |
$contentType = finfo_file($handle, $path); | |
$extension = path_info($path, PATHINFO_EXTENSION); //Better way to get the extension | |
header("Pragma: public"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function checkEmail($email) { | |
// checks proper syntax | |
if(preg_match("/^([a-z])([a-z0-9._])+([a-z0-9])\@([a-z0-9])*([a-z])+(-[a-z])*([a-z0-9])*(\.([a-z0-9])*([a-z])+(-[a-z])*([a-z0-9])*)+$/i" , $email)) { | |
// gets domain name | |
list($username, $domain) = split('@', $email); | |
// checks for if MX records in the DNS | |
if(checkdnsrr($domain, 'MX')) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Symfony\Bundle\FrameworkBundle\Command; | |
use Symfony\Component\Console\Input\InputArgument; | |
use Symfony\Component\Console\Input\InputOption; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\Console\Output\Output; | |
use Symfony\Bundle\FrameworkBundle\Util\Filesystem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
def mysql_installed? | |
`which mysql_config`.length > 0 | |
end | |
class Php <Formula | |
url 'http://www.php.net/get/php-5.3.5.tar.gz/from/this/mirror' | |
homepage 'http://php.net/' | |
md5 'fb727a3ac72bf0ce37e1a20468a7bb81' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
security: | |
acl: ~ | |
access_control: | |
- { path: /admin/.*, roles: [ROLE_ADMIN] } | |
- { path: /.*, roles: [IS_AUTHENTICATED_ANONYMOUSLY, ROLE_USER] } | |
encoders: | |
admin: { algorithm: sha1, class: Sas\CoreBundle\Entity\Account } | |
providers: | |
fos_user: | |
id: fos_user.user_manager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Doctrine\ORM\EntityManager, | |
Doctrine\ORM\Configuration, | |
Doctrine\ORM\Mapping\ClassMetadata; | |
/** | |
* Active Entity trait | |
* | |
* Limitations: a class can only ever be assocaited with ONE active entity manager. Multiple entity managers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error.accept.already={{RED}}This vote has not been initialized or you already accepted it | |
error.accept.unknown={{RED}}There is no such vote command | |
error.permissions={{RED}}You do not have permissions to use this command | |
error.force.permissions={{RED}}You do not have the permissions to use this command. Generally it is an admin command | |
error.notonserver={{RED}}{{PLAYER}} is not on this server | |
force.success={{GREEN}} Forcing event | |
muted=You are muted! | |
mute.broadcast={{PLAYER}} has been muted | |
mute.notmuted={{PLAYER}} is not muted | |
unmute.broadcast={{PLAYER}} has been unmuted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\Translation\TranslatorInterface; | |
function format(\DateTime $date, TranslatorInterface $translator) | |
{ | |
$diff = date_create()->diff($date); | |
$seconds = $diff->days * 86400 + $diff->h * 3600 + $diff->i * 60 + $diff->s; | |
$format = $translator->transChoice('reldate', $seconds); |
OlderNewer