Esempio n. 1
0
 /**
  * Warn the user if the working copy has any untracked changes
  *
  * @param CommandRunner $cmd_runner  cmd runner object
  * @param string        $repo_path          location of the git repo
  * @param string        $upstream           upstream branch name
  **/
 function check($cmd_runner, $repo_path, $upstream)
 {
     $cmd_runner->run('git ls-files --exclude-standard --others');
     $output = $cmd_runner->getOutput();
     $untracked_files = array_filter(explode(PHP_EOL, $output));
     if (!empty($untracked_files)) {
         $msg = 'You have ';
         $msg .= count($untracked_files);
         $msg .= ' untracked files in your working copy' . PHP_EOL;
         $cmd_runner->warn($msg);
     }
 }
 public function gallery_grid()
 {
     $albums = CommandRunner::run('get-albums-for-index')->get('albums');
     $cell_counter = 0;
     $grid = "<table id='gallery-grid'>\n";
     $grid .= "<tr>\n";
     foreach ($albums as $album) {
         if (!$album->hasImages()) {
             continue;
         }
         $cell_counter++;
         $image = $album->getFeaturedImage();
         $grid .= "<td>\n\t\t\t\t\t\t<a href='{$this->url($album)}'><img src='{$image->getSource()}' /></a>\n\t\t\t\t\t\t<br /><span class='gallery-caption'>{$album->getTitle()}</span>\n\t\t\t\t\t</td>\n";
         if ($cell_counter % 3 == 0) {
             $grid .= "\n</tr>\n<tr>\n";
         }
     }
     $grid .= "</tr>\n";
     $grid .= "</table>";
     return $grid;
 }
Esempio n. 3
0
 /**
  * Warn the user if the changed files contain any blacklisted files
  *
  * @param CommandRunner $cmd_runner  cmd runner object
  * @param string        $repo_path          location of the git repo
  * @param string        $upstream           upstream branch name
  **/
 function check($cmd_runner, $repo_path, $upstream)
 {
     $cmd = 'git diff --name-only ' . $upstream;
     if ($this->staged) {
         $cmd .= ' --staged';
     }
     if (!empty($this->whitelist)) {
         $cmd .= ' ' . implode(' ', $this->whitelist);
     }
     $cmd_runner->run($cmd);
     $changed_files = $cmd_runner->getOutput();
     $blacklisted_changed_files = array();
     foreach (explode(PHP_EOL, $changed_files) as $file) {
         if (in_array($file, $this->blacklist)) {
             $blacklisted_changed_files[] = $file;
         }
     }
     if (!empty($blacklisted_changed_files)) {
         $msg = 'The diff you are trying to submit contains the following blacklisted file(s) : ';
         $msg .= implode(',', $blacklisted_changed_files);
         $cmd_runner->warn($msg);
     }
 }
Esempio n. 4
0
 /**
  * Check if we should run the GitCopyBehind pre-check for the local-branch
  *
  * @param CommandRunner $cmd_runner  cmd runner object
  * @return boolean true if we should run the GitCopyBehind check
  **/
 public function shouldRunCheck($cmd_runner)
 {
     $cmd_runner->run('git rev-parse --abbrev-ref HEAD');
     $local_branch = $cmd_runner->getOutput();
     return in_array($local_branch, $this->branches_to_check);
 }
 * Unfortunately this was my first time putting together an ajax heavy
 * admin panel, so this interface isn't partcularly clean.
 *
 * The code here simply accepts AJAX calls via POST, translates the values
 * into objects if required, runs a command based on whats specified in $_POST['action']
 * and then sends an object back in JSON if it's relevant to the command (rare).
 */
include '../../init.php';
//convert json objects to php objects, currently only supports one object
if (array_key_exists('obj', $_POST)) {
    $class = $_POST['type'];
    $_POST['type'] = isset($_POST['newseventtype']) ? $_POST['newseventtype'] : $_POST['type'];
    //to get around the javascript 'status' reserved word
    $_POST['status'] = isset($_POST['stat']) ? $_POST['stat'] : Content::STATUS_PENDING;
    if (isset($_POST['id'])) {
        $mapper = RequestRegistry::getMapper($class);
        $object = $mapper->find($_POST['id']);
    } else {
        $object = new $class();
    }
    $object->loadFromArray($_POST);
    $_POST[$class] = $object;
}
$context = CommandRunner::run($_POST['action'], $_POST);
$return = $context->getParamArray();
foreach ($return as $key => $value) {
    if ($value instanceof Content) {
        $return[$key] = $value->toArray();
    }
}
echo json_encode($return);
Esempio n. 6
0
<?php

include 'init.php';
$period = $_GET['period'];
$news = CommandRunner::run('get-news-for-archive')->get('news');
$view = RequestRegistry::getViewHelper(array('type' => 'news/archive'));
?>

<?php 
include 'inc/doctype.php';
?>
<html>
<head>
<link rel='stylesheet' type='text/css' href='/css/shared.css' />
<link rel='stylesheet' type='text/css' href='/css/pcs-default.css' />
<?php 
echo $view->pcs_stylesheet();
?>
<script type='text/javascript' src='/js/jquery-1.3.2.min.js'></script>
<script type='text/javascript' src='/js/jquery.dimensions.js'></script>
<script type='text/javascript' src='/js/jquery.tooltip.min.js'></script>
<script type='text/javascript' src='/js/font/cufon-yui.js'></script>
<script type='text/javascript' src='/js/font/Sanuk-Black_500.font.js'></script>
<script type='text/javascript' src='/js/font/Sanuk-Regular_500.font.js'></script>
<script type="text/javascript">
		Cufon.replace('h1', { fontFamily: 'Sanuk-Black'});
		Cufon.replace('li.page-nav-link>a', { fontFamily: 'Sanuk-Black'});
		Cufon.replace('li.nav-link>a', { fontFamily: 'Sanuk-Black'});
                Cufon.replace('li ul li', { fontFamily: 'Sanuk-Regular'});
                Cufon.replace("#tooltip *", { fontFamily: 'Sanuk-Black'});
                Cufon.replace("body div#main div#sidebar div.sidebar-links-title p", { fontFamily: 'Sanuk-Black'});
Esempio n. 7
0
<?php

include '../init.php';
$album = CommandRunner::run('get-album')->get('album');
if (isset($_POST['submit'])) {
    $image_mapper = RequestRegistry::getImageMapper();
    $image = new Image();
    $image->setAlbumId($_POST['album-id']);
    $image_mapper->insert($image);
    $filename = $image->getId() . '.jpg';
    //$target_path = '../img/photos/' . $filename; //*nix Mode
    $target_path = "..\\img\\photos\\" . $filename;
    //Windows Mode
    //var_dump($_FILES);
    //echo $target_path;
    $success = move_uploaded_file($_FILES['uploaded-file']['tmp_name'], $target_path);
    if ($success) {
        $image->setFileName($filename);
        $image_mapper->update($image);
        header('Location: /admin/gallery.php?album-id=' . $_POST['album-id']);
    } else {
        $error_message = "There was a problem with the upload, please try again.";
        $image_mapper->delete($image);
    }
}
include '../inc/doctype.php';
?>
<html>
        <head>
                <title>Immanuel College Admin Panel</title>
                <link rel='stylesheet' type='text/css' href='css/style.css' />
Esempio n. 8
0
//to start lets add a section for recently edited events and future events
$events = array('recently-edited-events' => CommandRunner::run('get-recently-modified-events')->get('events'));
//add a section each for the past three months
$thisMonth = date('n');
$threeMonthsFromNow = $thisMonth + 3;
$monthArray = $fh->getMonthArray();
while ($thisMonth < $threeMonthsFromNow) {
    $monthString = $monthArray[$thisMonth - 1]['name'];
    $events[$monthString] = CommandRunner::run('get-events-for-month', array('month' => $thisMonth))->get('events');
    $thisMonth++;
}
//add a section for each of the last ten years
$thisYear = date('Y');
$tenYearsAgo = $thisYear - 10;
while ($thisYear > $tenYearsAgo) {
    $events[$thisYear] = CommandRunner::run('get-events-for-year', array('year' => $thisYear))->get('events');
    $thisYear--;
}
//initialize fckeditor
$editor = $fh->getEditor('content', 'Basic', null, null, $newsevent->getText());
$dateInput = $fh->getDateInput($newsevent->getDateDisplayed());
include '../inc/doctype.php';
?>
<html>
 <head>
  <title>Immanuel College Admin Panel</title>
  <link rel='stylesheet' type='text/css' href='css/style.css' />
  <script type='text/javascript' src='js/jquery-1.3.2.min.js'></script>
  <script type='text/javascript' src='js/generic-functions.js'></script>
  <script type='text/javascript' src='js/events-functions.js'></script>
  <script type='text/javascript' src='js/font/cufon-yui.js'></script>
Esempio n. 9
0
 private function run($directory, $command)
 {
     $this->commandRunner->run("cd \"{$directory}\" && {$command}");
 }
Esempio n. 10
0
<?php

include 'init.php';
$period = $_GET['period'];
$events = CommandRunner::run('get-events-for-archive')->get('events');
$view = RequestRegistry::getViewHelper(array('type' => 'events/archive'));
?>

<?php 
include 'inc/doctype.php';
?>
<html>
<head>
<link rel='stylesheet' type='text/css' href='/css/shared.css' />
<link rel='stylesheet' type='text/css' href='/css/pcs-default.css' />
<?php 
echo $view->pcs_stylesheet();
?>
<script type='text/javascript' src='/js/jquery-1.3.2.min.js'></script>
<script type='text/javascript' src='/js/jquery.dimensions.js'></script>
<script type='text/javascript' src='/js/jquery.tooltip.min.js'></script>
<script type='text/javascript' src='/js/font/cufon-yui.js'></script>
<script type='text/javascript' src='/js/font/Sanuk-Black_500.font.js'></script>
<script type='text/javascript' src='/js/font/Sanuk-Regular_500.font.js'></script>
<script type="text/javascript">
		Cufon.replace('h1', { fontFamily: 'Sanuk-Black'});
		Cufon.replace('li.page-nav-link>a', { fontFamily: 'Sanuk-Black'});
		Cufon.replace('li.nav-link>a', { fontFamily: 'Sanuk-Black'});
                Cufon.replace('li ul li', { fontFamily: 'Sanuk-Regular'});
                Cufon.replace("#tooltip *", { fontFamily: 'Sanuk-Black'});
                Cufon.replace("body div#main div#sidebar div.sidebar-links-title p", { fontFamily: 'Sanuk-Black'});
Esempio n. 11
0
<?php

include '../init.php';
include 'inc/fckeditor/fckeditor.php';
//get page from $_GET
$context = CommandRunner::run('get-page', array('page-id' => $_GET['id']));
$page = $context->get('page');
$level2 = $page->getChildren();
//init fckeditor
$fh = RequestRegistry::getFormHelper();
$editor = $fh->getEditor('content', 'Basic', null, null, $page->getText());
$introEditor = $fh->getEditor('introduction', 'Basic', '100', null, $page->getIntroduction());
include '../inc/doctype.php';
?>
<html>
        <head>
                <title>Immanuel College Admin Panel</title>
                <link rel='stylesheet' type='text/css' href='css/style.css' />
                <script type='text/javascript' src='js/jquery-1.3.2.min.js'></script>
                <script type='text/javascript' src='js/generic-functions.js'></script>
                <script type='text/javascript' src='js/page-functions.js'></script>
                <script type='text/javascript' src='js/font/cufon-yui.js'></script>
                <script type='text/javascript' src='js/font/Sanuk-Black_500.font.js'></script>
                <script type='text/javascript' src='js/font/Sanuk-Regular_500.font.js'></script>
                <script type="text/javascript">
                        Cufon.replace('h1', { fontFamily: 'Sanuk-Black'});
                        Cufon.replace('li.page-nav-link>a', { fontFamily: 'Sanuk-Black'});
                        Cufon.replace('li.nav-link>a', { fontFamily: 'Sanuk-Black'});
                        Cufon.replace('div#home-show-links a', { fontFamily: 'Sanuk-Black'});
			var page = new Object();
			page.id = <?php 
Esempio n. 12
0
<?php

include 'init.php';
$slug = mysql_escape_string($_GET['slug']);
try {
    $album = CommandRunner::run('get-album', array('album-slug' => $slug))->get('album');
} catch (Exception $e) {
    //if there's a problem finding the album based on slug, redirect to the gallery index
    //comment this out to debug
    header('Location: /gallery/');
}
$view = RequestRegistry::getViewHelper($album);
?>

<?php 
include 'inc/doctype.php';
?>
<html>
<head>
<link rel='stylesheet' type='text/css' href='/css/shared.css' />
<link rel='stylesheet' type='text/css' href='/css/jquery.lightbox-0.5.css' />
<link rel='stylesheet' type='text/css' href='/css/pcs-default.css' />
<?php 
echo $view->pcs_stylesheet();
?>
<script type='text/javascript' src='/js/jquery-1.3.2.min.js'></script>
<script type='text/javascript' src='/js/jquery.dimensions.js'></script>
<script type='text/javascript' src='/js/jquery.tooltip.min.js'></script>
<script type='text/javascript' src='/js/jquery.lightbox-0.5.js'></script>
<script type='text/javascript' src='/js/font/cufon-yui.js'></script>
<script type='text/javascript' src='/js/font/Sanuk-Black_500.font.js'></script>
Esempio n. 13
0
<?php

include '../init.php';
$formHelper = RequestRegistry::getFormHelper();
$albums = RequestRegistry::getAlbumMapper()->findAll();
$_REQUEST['album-id'] = isset($_GET['album-id']) ? $_GET['album-id'] : 1;
$context = CommandRunner::run('get-album');
$thisAlbum = $context->get('album');
$editNewsHref = $thisAlbum->getNewsId() == 0 ? '#' : "/admin/list-news.php?newsevent-id={$thisAlbum->getNewsId()}";
$editEventHref = $thisAlbum->getEventId() == 0 ? '#' : "/admin/list-events.php?newsevent-id={$thisAlbum->getEventId()}";
$images = $thisAlbum->getImages();
include '../inc/doctype.php';
?>
<html>
        <head>
                <title>Immanuel College Admin Panel</title>
                <link rel='stylesheet' type='text/css' href='css/style.css' />
                <script type='text/javascript' src='js/jquery-1.3.2.min.js'></script>
                <script type='text/javascript' src='js/generic-functions.js'></script>
                <script type='text/javascript' src='js/font/cufon-yui.js'></script>
                <script type='text/javascript' src='js/font/Sanuk-Black_500.font.js'></script>
                <script type='text/javascript' src='js/font/Sanuk-Regular_500.font.js'></script>
                <script type="text/javascript">
                        Cufon.replace('h1', { fontFamily: 'Sanuk-Black'});
                        Cufon.replace('li.page-nav-link>a', { fontFamily: 'Sanuk-Black'});
                        Cufon.replace('li.nav-link>a', { fontFamily: 'Sanuk-Black'});
                        Cufon.replace('div#home-show-links a', { fontFamily: 'Sanuk-Black'});
                      
			var album_id = <?php 
echo $thisAlbum->getId();
?>
Esempio n. 14
0
//to start lets add sections for recently edited news and future news
$news = array('recently-edited-news' => CommandRunner::run('get-recently-modified-news')->get('news'), 'future-news' => CommandRunner::run('get-future-news')->get('news'));
//add a section each for the past three months
$thisMonth = date('n');
$threeMonthsAgo = $thisMonth - 3;
$monthArray = $fh->getMonthArray();
while ($thisMonth > $threeMonthsAgo) {
    $monthString = $monthArray[$thisMonth - 1]['name'];
    $news[$monthString] = CommandRunner::run('get-news-for-month', array('month' => $thisMonth))->get('news');
    $thisMonth--;
}
//add a section for each of the last ten years
$thisYear = date('Y');
$tenYearsAgo = $thisYear - 10;
while ($thisYear > $tenYearsAgo) {
    $news[$thisYear] = CommandRunner::run('get-news-for-year', array('year' => $thisYear))->get('news');
    $thisYear--;
}
//init fckeditor
$editor = $fh->getEditor('content', 'Basic', null, null, $newsevent->getText());
$dateInput = $fh->getDateInput($newsevent->getDateDisplayed());
include '../inc/doctype.php';
?>
<html>
 <head>
  <title>Immanuel College Admin Panel</title>
  <link rel='stylesheet' type='text/css' href='css/style.css' />
  <script type='text/javascript' src='js/jquery-1.3.2.min.js'></script>
  <script type='text/javascript' src='js/generic-functions.js'></script>
  <script type='text/javascript' src='js/news-functions.js'></script>
  <script type='text/javascript' src='js/font/cufon-yui.js'></script>