vishwamano

source of vishwamano.com
git clone git://git.ricketyspace.net/vishwamano.git
Log | Files | Refs

commit 634175d19739f169ff571e5245287f36d7b96a0d
parent eeb6911f1d3d399d258f6ebb11232bf17318a053
Author: rsiddharth <rsiddharth@ninthfloor.org>
Date:   Tue, 30 Dec 2014 02:14:33 -0500

First version of upgraded frontpage ready (uses Smarty).

	new file:   doc-root.php
	new file:   index.php
	new file:   templating.php
	new file:   utils.php

Diffstat:
doc-root.php | 25+++++++++++++++++++++++++
index.php | 38++++++++++++++++++++++++++++++++++++++
templating.php | 35+++++++++++++++++++++++++++++++++++
utils.php | 37+++++++++++++++++++++++++++++++++++++
4 files changed, 135 insertions(+), 0 deletions(-)

diff --git a/doc-root.php b/doc-root.php @@ -0,0 +1,25 @@ +<?php + +/* Vishmano.com PHP Snafu + + Copyright (C) 2014 rsiddharth <rsiddharth@ninthfloor.org> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + COPYING contains the full text of the GNU Affero General Public + License. If you have not recieved a copy of the file along with + this program, see <http://www.gnu.org/licenses/>. + +*/ + +$doc_root = '/'; +$abs_path = $_SERVER['DOCUMENT_ROOT']; + diff --git a/index.php b/index.php @@ -0,0 +1,38 @@ +<?php + +/* Vishwamano.com PHP snafu. + + Copyright (C) 2014 rsiddharth <rsiddharth@ninthfloor.org> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + COPYING contains the full text of the GNU Affero General Public + License. If you have not recieved a copy of the file along with + this program, see <http://www.gnu.org/licenses/>. + +*/ + + +require_once('./templating.php'); +require_once($abs_path . '/utils.php'); + +$title = 'Vishwa Manoharan Photograhy'; +$meta_desc = 'Vishwa Manoharan is a Chennai Based Photographer offering Photography +Classes and Photography Services in Chennai'; + +$image_directory = $abs_path . '/images/carousel/'; +$images = get_images($image_directory); + +$smarty->assign('cimages', $images); +$smarty->assign('title', $title); +$smarty->assign('meta_description', $meta_desc); +$smarty->display('frontpage.tpl'); + diff --git a/templating.php b/templating.php @@ -0,0 +1,34 @@ +<?php + +/* SMSG -- Sales Management Simulation Game + + Copyright (C) 2014 7pmsales team. See AUTHORS. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + COPYING contains the full text of the GNU Affero General Public + License. If you have not recieved a copy of the file along with + this program, see <http://www.gnu.org/licenses/>. + +*/ + +require_once('doc-root.php'); +// put full path to Smarty.class.php +require_once($abs_path . '/smarty/Smarty-3.1.21/libs/Smarty.class.php'); + +$smarty = new Smarty(); + +$smarty->setTemplateDir($abs_path . '/themes/bs3/templates'); +$smarty->setCompileDir($abs_path . '/themes/bs3/templates_c'); +$smarty->setCacheDir($abs_path . '/themes/bs3/cache'); +$smarty->setConfigDir($abs_path . '/themes/bs3/configs'); + +$smarty->assign('doc_root', $doc_root);+ \ No newline at end of file diff --git a/utils.php b/utils.php @@ -0,0 +1,37 @@ +<?php + +/* Vishwamano.com PHP snafu. + + Copyright (C) 2014 rsiddharth <rsiddharth@ninthfloor.org> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + COPYING contains the full text of the GNU Affero General Public + License. If you have not recieved a copy of the file along with + this program, see <http://www.gnu.org/licenses/>. + +*/ + +function get_images($directory) { + + $img_pattern = "/.*(png|jpg|jpeg)/"; + $files = scandir($directory); + $images = array(); + + foreach($files as $file) { + if(preg_match($img_pattern, $file, $matches)) { + array_push($images, $file); + } + } + + return $images; +} +