initial commit

This commit is contained in:
Ben Ramey
2017-03-02 21:36:05 -06:00
commit e85327b977
1953 changed files with 176586 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
<?php
include '../php/classes/page.php';
$page = new Page();
$page->init_user();
# make sure the user is logged in before he has access to the
# admin section
if(!$page->user()->check_role('admin'))
{
$page->addMessage('You must login to use the administrator pages.');
$page->display('menu',false);
$page->content('admin/login.php');
}
else
$page->content('admin/index.php');
$page->attr('title','Discipling the Nations: Administrator Area');
$page->menu('admin/menu.php');
$page->addCSSFile('admin.css');
$page->process();
?>

View File

@@ -0,0 +1,38 @@
<?php
include '../php/classes/page.php';
$page = new Page();
$page->init_user();
# validate the login info if the user is trying to login
if(isset($_POST['login']))
{
if($page->user()->login($_POST['username'],$_POST['password']))
{
$page->addMessage('Login successful.');
$page->content("admin/index.php");
}
else
{
$page->addError('Invalid username/password combination. Please try again.');
$page->display('menu',false);
$page->content('admin/login.php');
}
}
# if the user is already logged in
else if($page->user()->check_role('admin'))
$page->content('admin/index.php');
else
{
$page->addMessage('You must login to use the administrator pages.');
$page->display('menu',false);
$page->content('admin/login.php');
}
$page->attr('title','Discipling the Nations: Administrator Area');
$page->menu('admin/menu.php');
$page->addCSSFile('admin.css');
$page->process();
?>

View File

@@ -0,0 +1,18 @@
<?php
include '../php/classes/page.php';
$page = new Page();
$page->init_user();
# log the user out
$page->user()->logout();
$page->addMessage('Logout successful.');
$page->attr('title','Discipling the Nations: Administrator Area');
$page->display('menu',false);
$page->content('admin/login.php');
$page->addCSSFile('admin.css');
$page->process();
?>

View File

@@ -0,0 +1,314 @@
<?php
include '../php/classes/page.php';
include 'functions/func_file.php';
include 'functions/func_xml.php';
$page = new Page();
$page->init_user();
# make sure the user is logged in before he has access to the
# admin section
if(!$page->user()->check_role('admin'))
{
$page->addMessage('You must login to use the administrator pages.');
$page->display('menu',false);
$page->content('admin/login.php');
}
else
{
# get the page element parameter that we want to edit
# if it doesn't exist, we just display the list of options
# below
$what_to_edit = isset($_REQUEST['what']) ? $_REQUEST['what'] : null;
# gather the appropriate data to send to the template
# and show the right template based on what page data we're editing
switch($what_to_edit)
{
case 'shorttermopportunities':
work_shorttermopportunities();
break;
case 'travelinfo':
work_travelinfo();
break;
default:
$page->content('admin/missionandtravel.php');
}
}
$page->attr('title','Discipling the Nations: Administrator Area: Mission and Travel');
$page->menu('admin/menu.php');
$page->addCSSFile('admin.css');
$page->process();
######################################## FUNCTION: work_shorttermopportunities #
function work_shorttermopportunities()
{
global $DOCROOT, $page;
$file_path = $DOCROOT.'/site/data/missionandtravel/shorttermopportunities.xml';
$opps = xml_get_from_file($file_path);
# get commands from get, if there is nothing there, get
# them from the post
$do = isset($_REQUEST['do']) ? $_REQUEST['do'] : null;
$which = isset($_REQUEST['which']) ? $_REQUEST['which'] : null;
# add, edit and delete just display a form or other template page
# so we can just lump them all together here
if($do == 'add' || $do == 'edit' || $do == 'delete')
{
# if we are editing or deleting, the template needs the opportunity data
if($do != 'add')
{
$c = 0;
while(($opps->opportunity[$c]['id'] != $_GET['which'])
&& isset($opps->opportunity[$c]))
$c++;
$page->data('opportunity',$opps->opportunity[$c]);
}
$page->content('admin/missionandtravel/shorttermopportunities/'.$do.'.php');
}
# add the opportunity and return to the list
else if($do == 'doadd')
{
# make sure the file gets uploaded and moved correctly
if(isset($_POST['title']))
{
# get the last id from the file
$last_id = $opps->opportunity[count($opps->opportunity) - 1]['id'];
if(is_null($last_id))
$last_id = 0;
$new_opportunity = $opps->addChild('opportunity');
$new_opportunity->addChild('title',$_POST['title']);
$new_opportunity->addChild('description',$_POST['description']);
$new_opportunity->addAttribute('id',$last_id + 1);
file_put_contents($file_path,$opps->asXML());
$page->addMessage('Short term opportunity successfully added.');
$page->data('opps',$opps);
$page->content('admin/missionandtravel/shorttermopportunities/list.php');
}
else
{
$page->addError('You cannot leave the title blank.');
$page->content('admin/missionandtravel/shorttermopportunities/add.php');
}
}
# edit the opportunity and return to the list
else if($do == 'doedit')
{
# find the opportunity with the right id
$opp_found = null;
$c = 0;
while(is_null($opp_found) && isset($opps->opportunity[$c]))
{
if((int)$opps->opportunity[$c]['id'] == $_POST['which'])
{
$opp_found = true;
break;
}
$c++;
}
# make sure we found the one and didn't just stop at the last one!
if(is_null($opp_found))
{
$page->addError('Short term opportunity was not found. No deletion has occurred!');
$page->data('opps',$opps);
$page->content('admin/missionandtravel/shorttermopportunities/list.php');
return;
}
elseif(!empty($_POST['title']))
{
$opps->opportunity[$c]->title = $_POST['title'];
$opps->opportunity[$c]->description = $_POST['description'];
file_put_contents($file_path,$opps->asXML());
$page->addMessage('Short term opportunity successfully edited.');
$page->data('opps',$opps);
$page->content('admin/missionandtravel/shorttermopportunities/list.php');
}
else
{
$page->addError('You cannot leave the title blank.');
$page->content('admin/missionandtravel/shorttermopportunities/edit.php');
}
}
# perform the deletion of the specified opportunity
else if($do == 'dodelete')
{
# find the opportunity with the right id
$opp_found = null;
$c = 0;
while(is_null($opp_found) && isset($opps->opportunity[$c]))
{
if((int)$opps->opportunity[$c]['id'] == $_POST['which'])
{
$opp_found = true;
break;
}
$c++;
}
# make sure we found the one and didn't just stop at the last one!
if(is_null($opp_found))
{
$page->addError('Short term opportunity was not found. No deletion has occurred!');
$page->data('opps',$opps);
$page->content('admin/missionandtravel/shorttermopportunities/list.php');
return;
}
unset($opps->opportunity[$c]);
file_put_contents($file_path,$opps->asXML());
$page->addMessage('Short term opportunity successfully deleted.');
$page->data('opps',$opps);
$page->content('admin/missionandtravel/shorttermopportunities/list.php');
}
# display the list of opps
else
{
$page->data('opps',$opps);
$page->content('admin/missionandtravel/shorttermopportunities/list.php');
}
}
#################################################### FUNCTION: work_travelinfo #
function work_travelinfo()
{
global $DOCROOT, $page;
$file_path = $DOCROOT.'/site/data/missionandtravel/travelinfo.xml';
$infos = xml_get_from_file($file_path);
# get commands from get, if there is nothing there, get
# them from the post
$do = isset($_REQUEST['do']) ? $_REQUEST['do'] : null;
$which = isset($_REQUEST['which']) ? $_REQUEST['which'] : null;
# add, edit and delete just display a form or other template page
# so we can just lump them all together here
if($do == 'add' || $do == 'edit' || $do == 'delete')
{
# if we are editing or deleting, the template needs the information data
if($do != 'add')
{
$c = 0;
while(($infos->information[$c]['id'] != $_GET['which'])
&& isset($infos->information[$c]))
$c++;
$page->data('information',$infos->information[$c]);
}
$page->content('admin/missionandtravel/travelinfo/'.$do.'.php');
}
# add the information and return to the list
else if($do == 'doadd')
{
# make sure the file gets uploaded and moved correctly
if(isset($_POST['title']))
{
# get the last id from the file
$last_id = $infos->information[count($infos->information) - 1]['id'];
if(is_null($last_id))
$last_id = 0;
$new_information = $infos->addChild('information');
$new_information->addChild('title',$_POST['title']);
$new_information->addChild('description',$_POST['description']);
$new_information->addAttribute('id',$last_id + 1);
file_put_contents($file_path,$infos->asXML());
$page->addMessage('Travel info successfully added.');
$page->data('infos',$infos);
$page->content('admin/missionandtravel/travelinfo/list.php');
}
else
{
$page->addError('You cannot leave the title blank.');
$page->content('admin/missionandtravel/travelinfo/add.php');
}
}
# edit the information and return to the list
else if($do == 'doedit')
{
# find the information with the right id
$info_found = null;
$c = 0;
while(is_null($info_found) && isset($infos->information[$c]))
{
if((int)$infos->information[$c]['id'] == $_POST['which'])
{
$info_found = true;
break;
}
$c++;
}
# make sure we found the one and didn't just stop at the last one!
if(is_null($info_found))
{
$page->addError('Travel info was not found. No deletion has occurred!');
$page->data('infos',$infos);
$page->content('admin/missionandtravel/travelinfo/list.php');
return;
}
elseif(!empty($_POST['title']))
{
$infos->information[$c]->title = $_POST['title'];
$infos->information[$c]->description = $_POST['description'];
file_put_contents($file_path,$infos->asXML());
$page->addMessage('Travel info successfully edited.');
$page->data('infos',$infos);
$page->content('admin/missionandtravel/travelinfo/list.php');
}
else
{
$page->addError('You cannot leave the title blank.');
$page->content('admin/missionandtravel/travelinfo/edit.php');
}
}
# perform the deletion of the specified information
else if($do == 'dodelete')
{
# find the information with the right id
$info_found = null;
$c = 0;
while(is_null($info_found) && isset($infos->information[$c]))
{
if((int)$infos->information[$c]['id'] == $_POST['which'])
{
$info_found = true;
break;
}
$c++;
}
# make sure we found the one and didn't just stop at the last one!
if(is_null($info_found))
{
$page->addError('Travel info was not found. No deletion has occurred!');
$page->data('infos',$infos);
$page->content('admin/missionandtravel/travelinfo/list.php');
return;
}
unset($infos->information[$c]);
file_put_contents($file_path,$infos->asXML());
$page->addMessage('Travel info successfully deleted.');
$page->data('infos',$infos);
$page->content('admin/missionandtravel/travelinfo/list.php');
}
# display the list of infos
else
{
$page->data('infos',$infos);
$page->content('admin/missionandtravel/travelinfo/list.php');
}
}
?>

View File

@@ -0,0 +1,587 @@
<?php
include '../php/classes/page.php';
include 'functions/func_file.php';
include 'functions/func_filesystem.php';
include 'functions/func_xml.php';
$page = new Page();
$page->init_user();
# make sure the user is logged in before he has access to the
# admin section
if(!$page->user()->check_role('admin'))
{
$page->addMessage('You must login to use the administrator pages.');
$page->display('menu',false);
$page->content('admin/login.php');
}
else
{
# get the page element parameter that we want to edit
# if it doesn't exist, we just display the list of options
# below
$what_to_edit = isset($_REQUEST['what']) ? $_REQUEST['what'] : null;
# gather the appropriate data to send to the template
# and show the right template based on what page data we're editing
switch($what_to_edit)
{
case 'photos':
work_photos();
break;
case 'videos':
work_videos();
break;
default:
$page->content('admin/photosandvideos.php');
}
}
$page->attr('title','Discipling the Nations: Administrator Area: Photos and Videos');
$page->menu('admin/menu.php');
$page->addCSSFile('admin.css');
$page->process();
###################################################### FUNCTION: work_toolsfor #
function work_photos()
{
global $DOCROOT, $page;
$file_path = $DOCROOT."/site/data/photosandvideos/albums.xml";
$albums = xml_get_from_file($file_path);
$photos = array();
# get a list of all the photos in each album
foreach($albums->album as $album)
{
$album_photos = filesys_get_wanted_children($DOCROOT.'/site/data/photosandvideos/albums/'.$album->imagefolder,'folder',"/^thumb_.*\.(jpg|JPG)$/");
foreach($album_photos as $photo)
$photos[(int)$album['id']][] = str_replace('thumb_','',$photo);
}
# get commands from get, if there is nothing there, get
# them from the post
$do = isset($_REQUEST['do']) ? $_REQUEST['do'] : null;
$which = isset($_REQUEST['which']) ? $_REQUEST['which'] : null;
# take the appropriate action according to what we are "doing"
if($do == 'addalbum' || $do == 'addphoto')
{
$page->data('albums',$albums);
$page->content("admin/photosandvideos/photos/$do.php");
}
else if($do == 'deletealbum' || $do == 'editalbum')
{
# find the album with the right id
$found = null;
$c = 0;
while(is_null($found) && isset($albums->album[$c]))
{
if((int)$albums->album[$c]['id'] == $_REQUEST['which'])
{
$found = true;
break;
}
$c++;
}
if($found)
{
$page->data('album',$albums->album[$c]);
$page->content("admin/photosandvideos/photos/$do.php");
}
else
{
$page->addError('No such album exists.');
$page->content('admin/photosandvideos/photos/list.php');
}
}
else if($do == 'deletephoto')
{
# find the album with the right id
$found = null;
$c = 0;
while(is_null($found) && isset($albums->album[$c]))
{
if((int)$albums->album[$c]['id'] == $_REQUEST['album'])
{
$found = true;
break;
}
$c++;
}
if($found)
{
$page->data('album',$albums->album[$c]);
$page->data('photo',$_GET['which']);
$page->content("admin/photosandvideos/photos/deletephoto.php");
}
else
{
$page->addError('No such album exists.');
$page->content('admin/photosandvideos/photos/list.php');
}
}
# add the album and return to the list
else if($do == 'doaddalbum')
{
$last_id = $albums->album[count($albums->album) - 1]['id'];
$new_album = $albums->addChild('album');
$new_album->addAttribute('id',$last_id + 1);
$new_album->addChild('name',$_POST['name']);
$new_album->addChild('subalbumof',$_POST['subalbumof']);
$new_album->addChild('subalbums');
$folder_name = preg_replace("/[^A-Za-z0-9]+/",'_',$new_album->name);
$new_album->addChild('imagefolder',$folder_name);
if(file_put_contents($file_path,$albums->asXML()))
{
mkdir($DOCROOT.'/site/data/photosandvideos/albums/'.$folder_name);
$page->addMessage('Album added successfully.');
$page->content("admin/photosandvideos/photos/list.php");
}
else
{
$page->addError('Could not add album.');
$page->content("admin/photosandvideos/photos/addalbum.php");
}
}
else if($do == 'doaddphoto')
{
# find the album with the right id
$found = null;
$c = 0;
while(is_null($found) && isset($albums->album[$c]))
{
if((int)$albums->album[$c]['id'] == $_REQUEST['which'])
{
$found = true;
break;
}
$c++;
}
if($found)
{
# make sure the files gets uploaded and moved correctly
if($new_photos = file_process_upload('file',$DOCROOT.'/site/data/photosandvideos/albums/'.$albums->album[$c]->imagefolder))
{
if(!is_array($new_photos))
$new_photos = array($new_photos);
$photo_path = $DOCROOT.'/site/data/photosandvideos/albums/'.$albums->album[$c]->imagefolder;
foreach($new_photos as $new_photo)
{
// Get new dimensions
list($width, $height) = getimagesize($photo_path."/$new_photo");
$ratio_orig = $width/$height;
# max widths and heights for thumbnail images and small images
$thumb_w = 100;
$thumb_h = 100;
$small_w = 400;
$small_h = 400;
# get right width/heigh for thumbnail
if ($thumb_w/$thumb_h > $ratio_orig) {
$thumb_w = $thumb_h*$ratio_orig;
} else {
$thumb_h = $thumb_w/$ratio_orig;
}
#get right width/height for small image
if ($small_w/$small_h > $ratio_orig) {
$small_w = $small_h*$ratio_orig;
} else {
$small_h = $small_w/$ratio_orig;
}
// Resample
$thumb_img = imagecreatetruecolor($thumb_w, $thumb_h);
$small_img = imagecreatetruecolor($small_w, $small_h);
$original = imagecreatefromjpeg($photo_path."/$new_photo");
imagecopyresampled($thumb_img, $original, 0, 0, 0, 0, $thumb_w, $thumb_h, $width, $height);
imagecopyresampled($small_img, $original, 0, 0, 0, 0, $small_w, $small_h, $width, $height);
// Output
imagejpeg($thumb_img, $photo_path."/thumb_$new_photo", 100);
imagejpeg($small_img, $photo_path."/small_$new_photo", 100);
# get the update set of photos in this album
if(!isset($photos[(int)$albums->album[$c]['id']]))
$photos[(int)$albums->album[$c]['id']] = array();
array_push($photos[(int)$albums->album[$c]['id']],$new_photo);
}
$page->addMessage('Photo successfully added.');
$page->content("admin/photosandvideos/photos/list.php");
}
else
{
$page->addError('An error occurred while uploading the photo. Please try again.');
$page->content("admin/photosandvideos/photos/addphoto.php");
}
}
else
{
$page->addError('Album does not exist.');
$page->content("admin/photosandvideos/photos/list.php");
}
}
# edit the article and return to the list
else if($do == 'doeditalbum')
{
# find the album with the right id
$found = null;
$c = 0;
while(is_null($found) && isset($albums->album[$c]))
{
if((int)$albums->album[$c]['id'] == $_REQUEST['which'])
{
$found = true;
break;
}
$c++;
}
if(empty($_POST['name']))
{
$page->addError('You cannot leave the album name blank.');
$page->data('album',$albums->album[$c]);
$page->content("admin/photosandvideos/photos/deletealbum.php");
}
else if($found)
{
# do the following of the new name is different than the old
if((string)$albums->album[$c]->name != $_POST['name'])
{
# update the folder with the new name
$old_folder_name = (string)$albums->album[$c]->imagefolder;
$new_folder_name = preg_replace("/[^A-Za-z0-9]+/",'_',$_POST['name']);
$albums->album[$c]->imagefolder = $new_folder_name;
# rename the folder
rename($DOCROOT.'/site/data/photosandvideos/albums/'.$old_folder_name,
$DOCROOT.'/site/data/photosandvideos/albums/'.$new_folder_name);
# update the name
$albums->album[$c]->name = $_POST['name'];
}
# if the album has been placed under a different parent album
# has been updated
if((int)$albums->album[$c]->subalbumof != $_POST['subalbumof'])
{
$previous_parent_id = $albums->album[$c]->subalbumof;
# find the previous parent
for($k = 0; $k < count($albums->album); $k++)
{
if((int)$albums->album[$k]['id'] == $previous_parent_id)
{
# now find the subalbum entry that is now invalid and delete it
for($j = 0; $j < count($albums->album[$k]->subalbums->subalbum); $j++)
{
if((int)$albums->album[$k]->subalbums->subalbum[$j] == (int)$albums->album[$c]['id'])
{
unset($albums->album[$k]->subalbums->subalbum[$j]);
break;
}
}
break;
}
}
# find the new parent and add a new subalbum entry
for($k = 0; $k < count($albums->album); $k++)
{
if((int)$albums->album[$k]['id'] == $_POST['subalbumof'])
{
$albums->album[$k]->subalbums->addChild('subalbum',$albums->album[$c]['id']);
break;
}
}
$albums->album[$c]->subalbumof = $_POST['subalbumof'];
}
file_put_contents($file_path,$albums->asXML());
$page->addMessage('Album successfully updated.');
$page->content("admin/photosandvideos/photos/list.php");
}
else
{
$page->addError('Album does not exist.');
$page->contents("admin/photosandvideos/photos/list.php");
}
}
# perform the deletion of a file from a album
else if($do == 'dodeletephoto')
{
# find the album with the right id
$found = null;
$c = 0;
while(is_null($found) && isset($albums->album[$c]))
{
if((int)$albums->album[$c]['id'] == $_REQUEST['album'])
{
$found = true;
break;
}
$c++;
}
# if we can unlink the file
if($found)
{
$photo_path = $DOCROOT.'/site/data/photosandvideos/albums/'.$albums->album[$c]->imagefolder.'/';
if(unlink($photo_path.$_POST['which']))
{
unlink($photo_path.'thumb_'.$_POST['which']);
unlink($photo_path.'small_'.$_POST['which']);
# remove the photo from the photos array
$key = array_search($_POST['which'],$photos[(int)$albums->album[$c]['id']]);
unset($photos[(int)$albums->album[$c]['id']][$key]);
$page->addMessage('Photo successfully deleted.');
}
else
$page->addError('Could not delete photo.');
}
$page->content("admin/photosandvideos/photos/list.php");
}
# perform the deletion of the specified article
else if($do == 'dodeletealbum')
{
# find the album with the right id
$found = null;
$c = 0;
while(is_null($found) && isset($albums->album[$c]))
{
if((int)$albums->album[$c]['id'] == $_REQUEST['which'])
{
$found = true;
break;
}
$c++;
}
if($found)
{
# delete each of the files in this album
$photo_path = $DOCROOT.'/site/data/photosandvideos/albums/'.$albums->album[$c]->imagefolder.'/';
foreach($photos[(int)$albums->album[$c]['id']] as $file)
{
unlink($photo_path.$file);
unlink($photo_path.'thumb_'.$file);
unlink($photo_path.'small_'.$file);
}
# delete the folder
rmdir($DOCROOT.'/site/data/photosandvideos/albums/'.$albums->album[$c]->imagefolder);
# if we can successfully unset the album, then print a success message
unset($albums->album[$c]);
if(!isset($albums->album[$c]))
{
$page->addMessage('Album successfully deleted.');
file_put_contents($file_path,$albums->asXML());
}
else
{
$page->addError('Could not delete this album.');
}
}
$page->content("admin/photosandvideos/photos/list.php");
}
# display the list of book albums
else
{
$page->content("admin/photosandvideos/photos/list.php");
}
$page->data('photos',$photos);
$page->data('albums',$albums);
}
######################################################## FUNCTION: work_videos #
function work_videos()
{
global $DOCROOT, $page;
$file_path = $DOCROOT.'/site/data/photosandvideos/videos.xml';
$videos = xml_get_from_file($file_path);
# get commands from get, if there is nothing there, get
# them from the post
$do = isset($_REQUEST['do']) ? $_REQUEST['do'] : null;
$which = isset($_REQUEST['which']) ? $_REQUEST['which'] : null;
# add, edit and delete just display a form or other template page
# so we can just lump them all together here
if($do == 'add' || $do == 'edit' || $do == 'delete')
{
# if we are editing or deleting, the template needs the video data
if($do != 'add')
{
# find the video with the right id
$found = null;
$c = 0;
while(is_null($found) && isset($videos->video[$c]))
{
if((int)$videos->video[$c]['id'] == $_POST['which'])
{
$found = true;
break;
}
$c++;
}
$page->data('video',$videos->video[$c]);
}
$page->content('admin/photosandvideos/videos/'.$do.'.php');
}
# add the video and return to the list
else if($do == 'doadd')
{
# make sure the file gets uploaded and moved correctly
if($new_file = file_process_upload('videofile',$DOCROOT.'/site/data/photosandvideos/videos'))
{
# get the last id from the file
$last_id = $videos->video[count($videos->video) - 1]['id'];
$new_name = isset($_POST['name']) ? $_POST['name'] : $_FILES['videofile']['name'];
$new_video = $videos->addChild('video');
$new_video->addChild('name',$new_name);
$new_video->addChild('file',$new_file);
# try to save the image file, otherwise set the new image to the default
if(!empty($_FILES['imagefile']['tmp_name']))
if($new_imagefile = file_process_upload('imagefile',$DOCROOT.'/site/graphics/photosandvideos/video_thumbs'))
$new_video->addChild('image',$new_imagefile);
else
$new_video->addChild('image','default.jpg');
$new_video->addAttribute('id',$last_id + 1);
file_put_contents($file_path,$videos->asXML());
$page->addMessage('Video successfully added.');
$page->data('videos',$videos);
$page->content('admin/photosandvideos/videos/list.php');
}
else
{
$page->addError('An error occurred while uploading the video file. Please try again.');
$page->content('admin/photosandvideos/videos/add.php');
}
}
# edit the video and return to the list
else if($do == 'doedit')
{
# find the video with the right id
$found = null;
$c = 0;
while(is_null($found) && isset($videos->video[$c]))
{
if((int)$videos->video[$c]['id'] == $_POST['which'])
{
$found = true;
break;
}
$c++;
}
# don't try anything if we couldn't find the video with the right id
if(is_null($found))
{
$page->addError('Video was not found.');
$page->data('videos',$videos);
$page->content('admin/photosandvideos/videos/list.php');
return;
}
# if a new file is specified then delete the old one and replace
# the new one
else if(!empty($_FILES['videofile']['name']))
{
# delete old file
unlink($DOCROOT.'/site/data/photosandvideos/videos/'.$videos->video[$c]->file);
# try to upload the new file
if($new_file = file_process_upload('videofile',$DOCROOT.'/site/data/photosandvideos/videos'))
{
$videos->video[$c]->name = isset($_POST['name']) ? $_POST['name'] : $_FILES['videofile']['name'];
$videos->video[$c]->file = $new_file;
# if the image file is being updated too
if($_FILES['imagefile']['name'] !== '')
{
if((string)$videos->video[$c]->image !== 'default.jpg')
unlink($DOCROOT.'/site/graphics/photosandvideos/video_thumbs/'.$videos->video[$c]->image);
if($new_imagefile = file_process_upload('file',$DOCROOT.'/site/graphics/photosandvideos/video_thumbs'))
$videos->video[$c]->image = $new_imagefile;
else
$videos->video[$c]->image = 'default.jpg';
}
file_put_contents($file_path,$videos->asXML());
$page->addMessage('Video successfully edited.');
$page->data('videos',$videos);
$page->content('admin/photosandvideos/videos/list.php');
}
else
{
$page->addError('An error occurred while uploading the video file. Please try again.');
$page->content('admin/photosandvideos/videos/edit.php');
}
}
# if no new file is uploaded
else
{
if($_POST['name'] !== '')
$videos->video[$c]->name = $_POST['name'];
# if the image file is being updated too
if(!empty($_FILES['imagefile']['name']))
{
if((string)$videos->video[$c]->image !== 'default.jpg')
unlink($DOCROOT.'/site/graphics/photosandvideos/video_thumbs/'.$videos->video[$c]->image);
if($new_imagefile = file_process_upload('imagefile',$DOCROOT.'/site/graphics/photosandvideos/video_thumbs'))
$videos->video[$c]->image = $new_imagefile;
else
$videos->video[$c]->image = 'default.jpg';
}
file_put_contents($file_path,$videos->asXML());
$page->addMessage('Video successfully edited.');
$page->data('videos',$videos);
$page->content('admin/photosandvideos/videos/list.php');
}
}
# perform the deletion of the specified video
else if($do == 'dodelete')
{
# find the video with the right id
$found = null;
$c = 0;
while(is_null($found) && isset($videos->video[$c]))
{
if((int)$videos->video[$c]['id'] == $_POST['which'])
{
$found = true;
break;
}
$c++;
}
$file_name = $DOCROOT.'/site/data/photosandvideos/videos/'.$videos->video[$c]->file;
if(unlink($file_name))
{
# delete the thumbnail image
unlink($DOCROOT.'/site/graphics/photosandvideos/video_thumbs/'.$videos->video[$c]->image);
unset($videos->video[$c]);
file_put_contents($file_path,$videos->asXML());
$page->addMessage('Video successfully deleted.');
}
else
{
$page->addError('Could not delete video.');
}
$page->data('videos',$videos);
$page->content('admin/photosandvideos/videos/list.php');
}
# display the list of videos
else
{
$page->data('videos',$videos);
$page->content('admin/photosandvideos/videos/list.php');
}
}
?>

View File

@@ -0,0 +1,447 @@
<?php
include '../php/classes/page.php';
include 'functions/func_file.php';
include 'functions/func_xml.php';
$page = new Page();
$page->init_user();
# make sure the user is logged in before he has access to the
# admin section
if(!$page->user()->check_role('admin'))
{
$page->addMessage('You must login to use the administrator pages.');
$page->display('menu',false);
$page->content('admin/login.php');
}
else
{
# get the page element parameter that we want to edit
# if it doesn't exist, we just display the list of options
# below
$what_to_edit = isset($_REQUEST['what']) ? $_REQUEST['what'] : null;
# gather the appropriate data to send to the template
# and show the right template based on what page data we're editing
switch($what_to_edit)
{
case 'missionarymoments':
work_missionarymoments();
break;
case 'emailupdates':
work_emailupdates();
break;
case 'prayerletters':
work_prayerletters();
break;
default:
$page->content('admin/prayerrequests.php');
}
}
$page->attr('title','Discipling the Nations: Administrator Area: Prayer Requests');
$page->menu('admin/menu.php');
$page->addCSSFile('admin.css');
$page->process();
############################################# FUNCTION: work_missionarymoments #
function work_missionarymoments()
{
global $DOCROOT, $page;
$file_path = $DOCROOT.'/site/data/missionarymoments.xml';
$moments = xml_get_from_file($file_path);
# get commands from get, if there is nothing there, get
# them from the post
$do = isset($_REQUEST['do']) ? $_REQUEST['do'] : null;
$which = isset($_REQUEST['which']) ? $_REQUEST['which'] : null;
# add, edit and delete just display a form or other template page
# so we can just lump them all together here
if($do == 'add' || $do == 'edit' || $do == 'delete')
{
# if we are editing or deleting, the template needs the moment data
if($do != 'add')
{
$c = 0;
while(($moments->moment[$c]['id'] != $_GET['which'])
&& isset($moments->moment[$c]))
$c++;
$page->data('moment',$moments->moment[$c]);
}
$page->content('admin/missionarymoments/'.$do.'.php');
}
# add the moment and return to the list
else if($do == 'doadd')
{
# make sure the file gets uploaded and moved correctly
if($new_link = file_process_upload('file',$DOCROOT.'/site/data/missionarymoments'))
{
# get the last id from the file
$last_id = $moments->moment[count($moments->moment) - 1]['id'];
$new_title = isset($_POST['title']) ? $_POST['title'] : $_FILES['file']['name'];
$new_moment = $moments->addChild('moment');
$new_moment->addChild('title',$new_title);
$new_moment->addChild('date',$_POST['date']);
$new_moment->addChild('file',$new_link);
$new_moment->addChild('summary',$_POST['summary']);
$new_moment->addAttribute('id',$last_id + 1);
file_put_contents($file_path,$moments->asXML());
$page->addMessage('Missionary moment successfully added.');
$page->data('moments',$moments);
$page->content('admin/missionarymoments/list.php');
}
else
{
$page->addError('An error occurred while uploading the file. Please try again.');
$page->content('admin/missionarymoments/add.php');
}
}
# edit the moment and return to the list
else if($do == 'doedit')
{
# find the moment with the right id
$c = 0;
while(isset($moments->moment[$c])
&& ($moments->moment[$c]['id'] != $_POST['which']))
$c++;
# if a new file is specified then delete the old one and replace
# the new one
if($_FILES['file']['name'] !== '')
{
# delete old file
unlink($DOCROOT.'/site/data/missionarymoments/'.$moments->moment[$c]->file);
# try to upload the new file
if($new_link = file_process_upload('file',$DOCROOT.'/site/data/missionarymoments'))
{
$moments->moment[$c]->title = isset($_POST['title']) ? $_POST['title'] : $_FILES['file']['name'];
$moments->moment[$c]->file = $new_link;
$moments->moment[$c]->date = $_POST['date'];
$moments->moment[$c]->summary = $_POST['summary'];
file_put_contents($file_path,$moments->asXML());
$page->addMessage('Missionary moment successfully edited.');
$page->data('moments',$moments);
$page->content('admin/missionarymoments/list.php');
}
else
{
$page->addError('An error occurred while uploading the file. Please try again.');
$page->content('admin/missionarymoments/edit.php');
}
}
# if no new file is uploaded
else
{
if($_POST['title'] !== '')
$moments->moment[$c]->title = $_POST['title'];
$moments->moment[$c]->date = $_POST['date'];
$moments->moment[$c]->summary = $_POST['summary'];
file_put_contents($file_path,$moments->asXML());
$page->addMessage('Missionary moment successfully edited.');
$page->data('moments',$moments);
$page->content('admin/missionarymoments/list.php');
}
}
# perform the deletion of the specified moment
else if($do == 'dodelete')
{
# find the moment with the right id
$c = 0;
while(($moments->moment[$c]['id'] != $_POST['which'])
&& isset($moments->moment[$c]))
$c++;
$file_name = $DOCROOT.'/site/data/missionarymoments/'.$moments->moment[$c]->file;
if(unlink($file_name))
{
unset($moments->moment[$c]);
file_put_contents($file_path,$moments->asXML());
$page->addMessage('Missionary moment successfully deleted.');
}
else
{
$page->addError('Could not delete missionary moment.');
}
$page->data('moments',$moments);
$page->content('admin/missionarymoments/list.php');
}
# display the list of moments
else
{
$page->data('moments',$moments);
$page->content('admin/missionarymoments/list.php');
}
}
################################################## FUNCTION: work_emailupdates #
function work_emailupdates()
{
global $DOCROOT, $page;
$file_path = $DOCROOT.'/site/data/prayerrequests/emailupdates.xml';
$updates = xml_get_from_file($file_path);
# get commands from get, if there is nothing there, get
# them from the post
$do = isset($_REQUEST['do']) ? $_REQUEST['do'] : null;
$which = isset($_REQUEST['which']) ? $_REQUEST['which'] : null;
# add, edit and delete just display a form or other template page
# so we can just lump them all together here
if($do == 'add' || $do == 'edit' || $do == 'delete')
{
# if we are editing or deleting, the template needs the update data
if($do != 'add')
{
$c = 0;
while(($updates->emailupdate[$c]['id'] != $_GET['which'])
&& isset($updates->emailupdate[$c]))
$c++;
$page->data('update',$updates->emailupdate[$c]);
}
$page->content('admin/prayerrequests/emailupdates/'.$do.'.php');
}
# add the update and return to the list
else if($do == 'doadd')
{
# make sure the file gets uploaded and moved correctly
if($new_link = file_process_upload('file',$DOCROOT.'/site/data/prayerrequests/emailupdates'))
{
# get the last id from the file
$last_id = $updates->emailupdate[count($updates->emailupdate) - 1]['id'];
$new_title = isset($_POST['title']) ? $_POST['title'] : $_FILES['file']['name'];
$new_update = $updates->addChild('emailupdate');
$new_update->addChild('title',$new_title);
$new_update->addChild('date',$_POST['date']);
$new_update->addChild('file',$new_link);
$new_update->addAttribute('id',$last_id + 1);
file_put_contents($file_path,$updates->asXML());
$page->addMessage('E-mail update successfully added.');
$page->data('updates',$updates);
$page->content('admin/prayerrequests/emailupdates/list.php');
}
else
{
$page->addError('An error occurred while uploading the file. Please try again.');
$page->content('admin/prayerrequests/emailupdates/add.php');
}
}
# edit the update and return to the list
else if($do == 'doedit')
{
# find the update with the right id
$c = 0;
while(isset($updates->emailupdate[$c])
&& ($updates->emailupdate[$c]['id'] != $_POST['which']))
$c++;
# if a new file is specified then delete the old one and replace
# the new one
if($_FILES['file']['name'] !== '')
{
# delete old file
unlink($DOCROOT.'/site/data/prayerrequests/emailupdates/'.$updates->emailupdate[$c]->file);
# try to upload the new file
if($new_link = file_process_upload('file',$DOCROOT.'/site/data/prayerrequests/emailupdates'))
{
$updates->emailupdate[$c]->title = isset($_POST['title']) ? $_POST['title'] : $_FILES['file']['name'];
$updates->emailupdate[$c]->file = $new_link;
$updates->emailupdate[$c]->date = $_POST['date'];
file_put_contents($file_path,$updates->asXML());
$page->addMessage('Update successfully edited.');
$page->data('updates',$updates);
$page->content('admin/prayerrequests/emailupdates/list.php');
}
else
{
$page->addError('An error occurred while uploading the file. Please try again.');
$page->content('admin/prayerrequests/emailupdates/edit.php');
}
}
# if no new file is uploaded
else
{
if($_POST['title'] !== '')
$updates->emailupdate[$c]->title = $_POST['title'];
$updates->emailupdate[$c]->date = $_POST['date'];
file_put_contents($file_path,$updates->asXML());
$page->addMessage('Update successfully edited.');
$page->data('updates',$updates);
$page->content('admin/prayerrequests/emailupdates/list.php');
}
}
# perform the deletion of the specified update
else if($do == 'dodelete')
{
# find the update with the right id
$c = 0;
while(($updates->emailupdate[$c]['id'] != $_POST['which'])
&& isset($updates->emailupdate[$c]))
$c++;
$file_name = $DOCROOT.'/site/data/prayerrequests/emailupdates/'.$updates->emailupdate[$c]->file;
if(unlink($file_name))
{
unset($updates->emailupdate[$c]);
file_put_contents($file_path,$updates->asXML());
$page->addMessage('Update successfully deleted.');
}
else
{
$page->addError('Could not delete update.');
}
$page->data('updates',$updates);
$page->content('admin/prayerrequests/emailupdates/list.php');
}
# display the list of updates
else
{
$page->data('updates',$updates);
$page->content('admin/prayerrequests/emailupdates/list.php');
}
}
################################################# FUNCTION: work_prayerletters #
function work_prayerletters()
{
global $DOCROOT, $page;
$file_path = $DOCROOT.'/site/data/prayerrequests/prayerletters.xml';
$letters = xml_get_from_file($file_path);
# get commands from get, if there is nothing there, get
# them from the post
$do = isset($_REQUEST['do']) ? $_REQUEST['do'] : null;
$which = isset($_REQUEST['which']) ? $_REQUEST['which'] : null;
# add, edit and delete just display a form or other template page
# so we can just lump them all together here
if($do == 'add' || $do == 'edit' || $do == 'delete')
{
# if we are editing or deleting, the template needs the letter data
if($do != 'add')
{
$c = 0;
while(($letters->prayerletter[$c]['id'] != $_GET['which'])
&& isset($letters->prayerletter[$c]))
$c++;
$page->data('letter',$letters->prayerletter[$c]);
}
$page->content('admin/prayerrequests/prayerletters/'.$do.'.php');
}
# add the letter and return to the list
else if($do == 'doadd')
{
# make sure the file gets uploaded and moved correctly
if($new_link = file_process_upload('file',$DOCROOT.'/site/data/prayerrequests/prayerletters'))
{
# get the last id from the file
$last_id = $letters->prayerletter[count($letters->prayerletter) - 1]['id'];
$new_title = isset($_POST['title']) ? $_POST['title'] : $_FILES['file']['name'];
$new_letter = $letters->addChild('prayerletter');
$new_letter->addChild('title',$new_title);
$new_letter->addChild('date',$_POST['date']);
$new_letter->addChild('file',$new_link);
$new_letter->addAttribute('id',$last_id + 1);
file_put_contents($file_path,$letters->asXML());
$page->addMessage('Prayer letter successfully added.');
$page->data('letters',$letters);
$page->content('admin/prayerrequests/prayerletters/list.php');
}
else
{
$page->addError('An error occurred while uploading the file. Please try again.');
$page->content('admin/prayerrequests/prayerletters/add.php');
}
}
# edit the letter and return to the list
else if($do == 'doedit')
{
# find the letter with the right id
$c = 0;
while(isset($letters->prayerletter[$c])
&& ($letters->prayerletter[$c]['id'] != $_POST['which']))
$c++;
# if a new file is specified then delete the old one and replace
# the new one
if($_FILES['file']['name'] !== '')
{
# delete old file
unlink($DOCROOT.'/site/data/prayerrequests/prayerletters/'.$letters->prayerletter[$c]->file);
# try to upload the new file
if($new_link = file_process_upload('file',$DOCROOT.'/site/data/prayerrequests/prayerletters'))
{
$letters->prayerletter[$c]->title = isset($_POST['title']) ? $_POST['title'] : $_FILES['file']['name'];
$letters->prayerletter[$c]->file = $new_link;
$letters->prayerletter[$c]->date = $_POST['date'];
file_put_contents($file_path,$letters->asXML());
$page->addMessage('Prayer letter successfully edited.');
$page->data('letters',$letters);
$page->content('admin/prayerrequests/prayerletters/list.php');
}
else
{
$page->addError('An error occurred while uploading the file. Please try again.');
$page->content('admin/prayerrequests/prayerletters/edit.php');
}
}
# if no new file is uploaded
else
{
if($_POST['title'] !== '')
$letters->prayerletter[$c]->title = $_POST['title'];
$letters->prayerletter[$c]->date = $_POST['date'];
file_put_contents($file_path,$letters->asXML());
$page->addMessage('Prayer letter successfully edited.');
$page->data('letters',$letters);
$page->content('admin/prayerrequests/prayerletters/list.php');
}
}
# perform the deletion of the specified letter
else if($do == 'dodelete')
{
# find the letter with the right id
$c = 0;
while(($letters->prayerletter[$c]['id'] != $_POST['which'])
&& isset($letters->prayerletter[$c]))
$c++;
$file_name = $DOCROOT.'/site/data/prayerrequests/prayerletters/'.$letters->prayerletter[$c]->file;
if(unlink($file_name))
{
unset($letters->prayerletter[$c]);
file_put_contents($file_path,$letters->asXML());
$page->addMessage('Prayer letter successfully deleted.');
}
else
{
$page->addError('Could not delete letter.');
}
$page->data('letters',$letters);
$page->content('admin/prayerrequests/prayerletters/list.php');
}
# display the list of letters
else
{
$page->data('letters',$letters);
$page->content('admin/prayerrequests/prayerletters/list.php');
}
}
?>

View File

@@ -0,0 +1,764 @@
<?php
include '../php/classes/page.php';
include 'functions/func_file.php';
include 'functions/func_xml.php';
$page = new Page();
$page->init_user();
# make sure the user is logged in before he has access to the
# admin section
if(!$page->user()->check_role('admin'))
{
$page->addMessage('You must login to use the administrator pages.');
$page->display('menu',false);
$page->content('admin/login.php');
}
else
{
# get the page element parameter that we want to edit
# if it doesn't exist, we just display the list of options
# below
$what_to_edit = isset($_REQUEST['what']) ? $_REQUEST['what'] : null;
# gather the appropriate data to send to the template
# and show the right template based on what page data we're editing
switch($what_to_edit)
{
case 'articles':
work_articles();
break;
case 'books':
work_books();
break;
case 'onleadership':
work_onleadership();
break;
case 'teachingoutlines':
work_teachingoutlines();
break;
case 'toolsforministry':
work_toolsfor('ministry');
break;
case 'toolsforpersonal':
work_toolsfor('personal');
break;
default:
$page->content('admin/resources.php');
}
}
$page->attr('title','Discipling the Nations: Administrator Area: Resources');
$page->menu('admin/menu.php');
$page->addCSSFile('admin.css');
$page->process();
###################################################### FUNCTION: work_articles #
function work_articles()
{
global $DOCROOT, $page;
$file_path = $DOCROOT.'/site/data/resources/articles.xml';
$articles = xml_get_from_file($file_path);
# get commands from get, if there is nothing there, get
# them from the post
$do = isset($_REQUEST['do']) ? $_REQUEST['do'] : null;
$which = isset($_REQUEST['which']) ? $_REQUEST['which'] : null;
# add, edit and delete just display a form or other template page
# so we can just lump them all together here
if($do == 'add' || $do == 'edit' || $do == 'delete')
{
# if we are editing or deleting, the template needs the article data
if($do != 'add')
{
$c = 0;
while(($articles->article[$c]['id'] != $_GET['which'])
&& isset($articles->article[$c]))
$c++;
$page->data('article',$articles->article[$c]);
}
$page->content('admin/resources/articles/'.$do.'.php');
}
# add the article and return to the list
else if($do == 'doadd')
{
# make sure the file gets uploaded and moved correctly
if($new_link = file_process_upload('file',$DOCROOT.'/site/data/resources/articles'))
{
# get the last id from the file
$last_id = $articles->article[count($articles->article) - 1]['id'];
$new_title = isset($_POST['title']) ? $_POST['title'] : $_FILES['file']['name'];
$new_article = $articles->addChild('article');
$new_article->addChild('title',$new_title);
$new_article->addChild('link',$new_link);
$new_article->addAttribute('id',$last_id + 1);
file_put_contents($file_path,$articles->asXML());
$page->addMessage('Article successfully added.');
$page->data('articles',$articles);
$page->content('admin/resources/articles/list.php');
}
else
{
$page->addError('An error occurred while uploading the file. Please try again.');
$page->content('admin/resources/articles/add.php');
}
}
# edit the article and return to the list
else if($do == 'doedit')
{
# find the article with the right id
$c = 0;
while(isset($articles->article[$c])
&& ($articles->article[$c]['id'] != $_POST['which']))
$c++;
# if a new file is specified then delete the old one and replace
# the new one
if($_FILES['file']['name'] !== '')
{
# delete old file
unlink($DOCROOT.'/site/data/resources/articles/'.$articles->article[$c]->link);
# try to upload the new file
if($new_link = file_process_upload('file',$DOCROOT.'/site/data/resources/articles'))
{
$articles->article[$c]->title = isset($_POST['title']) ? $_POST['title'] : $_FILES['file']['name'];
$articles->article[$c]->link = $new_link;
file_put_contents($file_path,$articles->asXML());
$page->addMessage('Article successfully edited.');
$page->data('articles',$articles);
$page->content('admin/resources/articles/list.php');
}
else
{
$page->addError('An error occurred while uploading the file. Please try again.');
$page->content('admin/resources/articles/edit.php');
}
}
# if no new file is uploaded
else
{
if($_POST['title'] !== '')
$articles->article[$c]->title = $_POST['title'];
file_put_contents($file_path,$articles->asXML());
$page->addMessage('Article successfully edited.');
$page->data('articles',$articles);
$page->content('admin/resources/articles/list.php');
}
}
# perform the deletion of the specified article
else if($do == 'dodelete')
{
# find the article with the right id
$c = 0;
while(($articles->article[$c]['id'] != $_POST['which'])
&& isset($articles->article[$c]))
$c++;
$file_name = $DOCROOT.'/site/data/resources/articles/'.$articles->article[$c]->link;
if(unlink($file_name))
{
unset($articles->article[$c]);
file_put_contents($file_path,$articles->asXML());
$page->addMessage('Article successfully deleted.');
}
else
{
$page->addError('Could not delete article.');
}
$page->data('articles',$articles);
$page->content('admin/resources/articles/list.php');
}
# display the list of articles
else
{
$page->data('articles',$articles);
$page->content('admin/resources/articles/list.php');
}
}
######################################################### FUNCTION: work_books #
function work_books()
{
global $DOCROOT, $page;
$file_path = $DOCROOT.'/site/data/resources/books.xml';
$categories = xml_get_from_file($file_path);
# get commands from get, if there is nothing there, get
# them from the post
$do = isset($_REQUEST['do']) ? $_REQUEST['do'] : null;
$which = isset($_REQUEST['which']) ? $_REQUEST['which'] : null;
# take the appropriate action according to what we are "doing"
if($do == 'addcat')
$page->content('admin/resources/books/addcat.php');
else if($do == 'addfile')
{
$page->data('categories',$categories);
$page->content('admin/resources/books/addfile.php');
}
else if($do == 'deletecat' || $do == 'editcat')
{
$c = 0;
while(($categories->category[$c]['id'] != $_GET['which'])
&& isset($categories->category[$c]))
$c++;
$page->data('category',$categories->category[$c]);
$page->content('admin/resources/books/'.$do.'.php');
}
else if($do == 'deletefile')
{
$c = 0;
while(($categories->category[$c]['id'] != $_GET['cat'])
&& isset($categories->category[$c]))
$c++;
$page->data('category',$categories->category[$c]);
$page->data('file',$_GET['which']);
$page->content('admin/resources/books/deletefile.php');
}
# add the category and return to the list
else if($do == 'doaddcat')
{
$last_id = $categories->category[count($categories->category) - 1]['id'];
$new_cat = $categories->addChild('category');
$new_cat->addAttribute('id',$last_id + 1);
$new_cat->addChild('name',$_POST['name']);
if(file_put_contents($file_path,$categories->asXML()))
{
$page->addMessage('Category added successfully.');
$page->data('categories',$categories);
$page->content('admin/resources/books/list.php');
}
else
{
$page->addError('Could not add category.');
$page->content('admin/resources/books/addcat.php');
}
}
else if($do == 'doaddfile')
{
# make sure the file gets uploaded and moved correctly
if($new_link = file_process_upload('file',$DOCROOT.'/site/data/resources/books'))
{
$c = 0;
while(($categories->category[$c]['id'] != $_POST['which'])
&& isset($categories->category[$c]))
$c++;
$new_file = $categories->category[$c]->addChild('file',$new_link);
if(file_put_contents($file_path,$categories->asXML()))
{
$page->addMessage('File successfully added.');
$page->content('admin/resources/books/list.php');
}
}
else
{
$page->addError('An error occurred while uploading the file. Please try again.');
$page->content('admin/resources/books/addfile.php');
}
$page->data('categories',$categories);
}
# edit the article and return to the list
else if($do == 'doeditcat')
{
# find the article with the right id
$c = 0;
while(($categories->category[$c]['id'] != $_POST['which'])
&& isset($categories->category[$c]))
$c++;
if(empty($_POST['name']))
{
$page->addError('You cannot leave the category name blank.');
$page->data('category',$categories->category[$c]);
$page->content('admin/books/deletecat.php');
}
else
{
$categories->category[$c]->name = $_POST['name'];
file_put_contents($file_path,$categories->asXML());
$page->addMessage('Category successfully updated.');
$page->data('categories',$categories);
$page->content('admin/resources/books/list.php');
}
}
# perform the deletion of a file from a category
else if($do == 'dodeletefile')
{
# find the category with the right id
$c = 0;
while(($categories->category[$c]['id'] != $_POST['cat'])
&& isset($categories->category[$c]))
$c++;
# if we can unlink the file
if(unlink($DOCROOT.'/site/data/resources/books/'.$_POST['which']))
{
# find the file in the category and delete it
$k = 0;
while(($categories->category[$c]->file[$k] != $_POST['which'])
&& isset($categories->category[$c]->file[$k]))
$k++;
# make sure we only delete the file if it's found
if($categories->category[$c]->file[$k] == $_POST['which'])
unset($categories->category[$c]->file[$k]);
file_put_contents($file_path,$categories->asXML());
$page->addMessage('File successfully deleted.');
}
else
$page->addError('Could not delete file.');
$page->data('categories',$categories);
$page->content('admin/resources/books/list.php');
}
# perform the deletion of the specified article
else if($do == 'dodeletecat')
{
# find the category with the right id
$c = 0;
while(($categories->category[$c]['id'] != $_POST['which'])
&& isset($categories->category[$c]))
$c++;
# delete each of the files in this category
foreach($categories->category[$c]->file as $file)
{
if(!unlink($DOCROOT.'/site/data/resources/books/'.$file))
$page->addError('File could not be deleted: '.$file);
}
# if we can successfully unset the category, then print a success message
unset($categories->category[$c]);
if(!isset($categories->category[$c]))
{
$page->addMessage('Category successfully deleted.');
file_put_contents($file_path,$categories->asXML());
}
else
{
$page->addError('Could not delete this category.');
}
$page->data('categories',$categories);
$page->content('admin/resources/books/list.php');
}
# display the list of book categories
else
{
$page->data('categories',$categories);
$page->content('admin/resources/books/list.php');
}
}
################################################## FUNCTION: work_onleadership #
function work_onleadership()
{
global $DOCROOT, $page;
$file_path = $DOCROOT.'/site/data/resources/onleadership.xml';
$files = xml_get_from_file($file_path);
# get commands from get, if there is nothing there, get
# them from the post
$do = isset($_REQUEST['do']) ? $_REQUEST['do'] : null;
$which = isset($_REQUEST['which']) ? $_REQUEST['which'] : null;
# add, edit and delete just display a form or other template page
# so we can just lump them all together here
if($do == 'add' || $do == 'delete')
{
# if we are deleting, the template needs the file data
if($do != 'add')
{
$c = 0;
while(($files->file[$c]['id'] != $_GET['which'])
&& isset($files->file[$c]))
$c++;
$page->data('file',$files->file[$c]);
}
$page->content('admin/resources/onleadership/'.$do.'.php');
}
# add the file and return to the list
else if($do == 'doadd')
{
# make sure the file gets uploaded and moved correctly
if($new_link = file_process_upload('file',$DOCROOT.'/site/data/resources/onleadership'))
{
# get the last id from the file
$last_id = $files->file[count($files->file) - 1]['id'];
$new_file = $files->addChild('file',$new_link);
$new_file->addAttribute('id',$last_id + 1);
file_put_contents($file_path,$files->asXML());
$page->addMessage('File successfully added.');
$page->data('files',$files);
$page->content('admin/resources/onleadership/list.php');
}
else
{
$page->addError('An error occurred while uploading the file. Please try again.');
$page->content('admin/resources/onleadership/add.php');
}
}
# perform the deletion of the specified file
else if($do == 'dodelete')
{
# find the file with the right id
$c = 0;
while(($files->file[$c]['id'] != $_POST['which'])
&& isset($files->file[$c]))
$c++;
$file_name = $DOCROOT.'/site/data/resources/onleadership/'.$files->file[$c];
if(unlink($file_name))
{
unset($files->file[$c]);
file_put_contents($file_path,$files->asXML());
$page->addMessage('File successfully deleted.');
}
else
{
$page->addError('Could not delete file.');
}
$page->data('files',$files);
$page->content('admin/resources/onleadership/list.php');
}
# display the list of files
else
{
$page->data('files',$files);
$page->content('admin/resources/onleadership/list.php');
}
}
############################################## FUNCTION: work_teachingoutlines #
function work_teachingoutlines()
{
global $DOCROOT, $page;
$file_path = $DOCROOT.'/site/data/resources/teachingoutlines.xml';
$files = xml_get_from_file($file_path);
# get commands from get, if there is nothing there, get
# them from the post
$do = isset($_REQUEST['do']) ? $_REQUEST['do'] : null;
$which = isset($_REQUEST['which']) ? $_REQUEST['which'] : null;
# add, edit and delete just display a form or other template page
# so we can just lump them all together here
if($do == 'add' || $do == 'delete')
{
# if we are deleting, the template needs the file data
if($do != 'add')
{
$c = 0;
while(($files->file[$c]['id'] != $_GET['which'])
&& isset($files->file[$c]))
$c++;
$page->data('file',$files->file[$c]);
}
$page->content('admin/resources/teachingoutlines/'.$do.'.php');
}
# add the file and return to the list
else if($do == 'doadd')
{
# make sure the file gets uploaded and moved correctly
if($new_link = file_process_upload('file',$DOCROOT.'/site/data/resources/teachingoutlines'))
{
# get the last id from the file
$last_id = $files->file[count($files->file) - 1]['id'];
$new_file = $files->addChild('file',$new_link);
$new_file->addAttribute('id',$last_id + 1);
file_put_contents($file_path,$files->asXML());
$page->addMessage('File successfully added.');
$page->data('files',$files);
$page->content('admin/resources/teachingoutlines/list.php');
}
else
{
$page->addError('An error occurred while uploading the file. Please try again.');
$page->content('admin/resources/teachingoutlines/add.php');
}
}
# perform the deletion of the specified file
else if($do == 'dodelete')
{
# find the file with the right id
$c = 0;
while(($files->file[$c]['id'] != $_POST['which'])
&& isset($files->file[$c]))
$c++;
$file_name = $DOCROOT.'/site/data/resources/teachingoutlines/'.$files->file[$c];
if(unlink($file_name))
{
unset($files->file[$c]);
file_put_contents($file_path,$files->asXML());
$page->addMessage('File successfully deleted.');
}
else
{
$page->addError('Could not delete file.');
}
$page->data('files',$files);
$page->content('admin/resources/teachingoutlines/list.php');
}
# display the list of files
else
{
$page->data('files',$files);
$page->content('admin/resources/teachingoutlines/list.php');
}
}
###################################################### FUNCTION: work_toolsfor #
function work_toolsfor($type)
{
global $DOCROOT, $page;
$file_path = $DOCROOT."/site/data/resources/toolsfor$type.xml";
$categories = xml_get_from_file($file_path);
# get commands from get, if there is nothing there, get
# them from the post
$do = isset($_REQUEST['do']) ? $_REQUEST['do'] : null;
$which = isset($_REQUEST['which']) ? $_REQUEST['which'] : null;
# take the appropriate action according to what we are "doing"
if($do == 'addcat')
$page->content("admin/resources/toolsfor$type/addcat.php");
else if($do == 'addfile')
{
$page->data('categories',$categories);
$page->content("admin/resources/toolsfor$type/addfile.php");
}
else if($do == 'deletecat' || $do == 'editcat')
{
$c = 0;
while(($categories->category[$c]['id'] != $_GET['which'])
&& isset($categories->category[$c]))
$c++;
if($do == 'editcat')
$page->data('categories',$categories);
$page->data('category',$categories->category[$c]);
$page->content("admin/resources/toolsfor$type/$do.php");
}
else if($do == 'deletefile')
{
$c = 0;
while(($categories->category[$c]['id'] != $_GET['cat'])
&& isset($categories->category[$c]))
$c++;
$page->data('category',$categories->category[$c]);
$page->data('file',$_GET['which']);
$page->content("admin/resources/toolsfor$type/deletefile.php");
}
# add the category and return to the list
else if($do == 'doaddcat')
{
$last_id = $categories->category[count($categories->category) - 1]['id'];
$new_cat = $categories->addChild('category');
$new_cat->addAttribute('id',$last_id + 1);
$new_cat->addChild('name',$_POST['name']);
$new_cat->addChild('subcategoryof',$_POST['subcategoryof']);
$new_cat->addChild('subcategories');
$folder_name = preg_replace("/[^A-Za-z0-9]+/",'_',$new_cat->name);
$new_cat->addChild('folder',$folder_name);
if(file_put_contents($file_path,$categories->asXML()))
{
mkdir($DOCROOT.'/site/data/resources/toolsfor'.$type.'/'.$folder_name);
$page->addMessage('Category added successfully.');
$page->data('categories',$categories);
$page->content("admin/resources/toolsfor$type/list.php");
}
else
{
$page->addError('Could not add category.');
$page->content("admin/resources/toolsfor$type/addcat.php");
}
}
else if($do == 'doaddfile')
{
$c = 0;
while(($categories->category[$c]['id'] != $_POST['which'])
&& isset($categories->category[$c]))
$c++;
# make sure the file gets uploaded and moved correctly
if($new_link = file_process_upload('file',$DOCROOT.'/site/data/resources/toolsfor'.$type.'/'.$categories->category[$c]->folder))
{
$new_file = $categories->category[$c]->addChild('file',$new_link);
if(file_put_contents($file_path,$categories->asXML()))
{
$page->addMessage('File successfully added.');
$page->content("admin/resources/toolsfor$type/list.php");
}
}
else
{
$page->addError('An error occurred while uploading the file. Please try again.');
$page->content("admin/resources/toolsfor$type/addfile.php");
}
$page->data('categories',$categories);
}
# edit the article and return to the list
else if($do == 'doeditcat')
{
# find the article with the right id
$c = 0;
while(($categories->category[$c]['id'] != $_POST['which'])
&& isset($categories->category[$c]))
$c++;
if(empty($_POST['name']))
{
$page->addError('You cannot leave the category name blank.');
$page->data('category',$categories->category[$c]);
$page->content("admin/resources/toolsfor'.$type.'/deletecat.php");
}
else
{
# do the following of the new name is different than the old
if((string)$categories->category[$c]->name != $_POST['name'])
{
# update the folder with the new name
$old_folder_name = (string)$categories->category[$c]->folder;
$new_folder_name = preg_replace("/[^A-Za-z0-9]+/",'_',$_POST['name']);
$categories->category[$c]->folder = $new_folder_name;
# rename the folder
rename($DOCROOT.'/site/data/resources/toolsfor'.$type.'/'.$old_folder_name,
$DOCROOT.'/site/data/resources/toolsfor'.$type.'/'.$new_folder_name);
# update the name
$categories->category[$c]->name = $_POST['name'];
}
# if the category has been placed under a different parent category
# has been updated
if((int)$categories->category[$c]->subcategoryof != $_POST['subcategoryof'])
{
$previous_parent_id = $categories->category[$c]->subcategoryof;
# find the previous parent
for($k = 0; $k < count($categories->category); $k++)
{
if((int)$categories->category[$k]['id'] == $previous_parent_id)
{
# now find the subcategory entry that is now invalid and delete it
for($j = 0; $j < count($categories->category[$k]->subcategories->subcategory); $j++)
{
if((int)$categories->category[$k]->subcategories->subcategory[$j] == (int)$categories->category[$c]['id'])
{
unset($categories->category[$k]->subcategories->subcategory[$j]);
break;
}
}
break;
}
}
# find the new parent and add a new subcategory entry
for($k = 0; $k < count($categories->category); $k++)
{
if((int)$categories->category[$k]['id'] == $_POST['subcategoryof'])
{
$categories->category[$k]->subcategories->addChild('subcategory',$categories->category[$c]['id']);
break;
}
}
$categories->category[$c]->subcategoryof = $_POST['subcategoryof'];
}
file_put_contents($file_path,$categories->asXML());
$page->addMessage('Category successfully updated.');
$page->data('categories',$categories);
$page->content("admin/resources/toolsfor$type/list.php");
}
}
# perform the deletion of a file from a category
else if($do == 'dodeletefile')
{
# find the category with the right id
$c = 0;
while(($categories->category[$c]['id'] != $_POST['cat'])
&& isset($categories->category[$c]))
$c++;
# if we can unlink the file
if(unlink($DOCROOT.'/site/data/resources/toolsfor'.$type.'/'.$categories->category[$c]->folder.'/'.$_POST['which']))
{
# find the file in the category and delete it
$k = 0;
while(($categories->category[$c]->file[$k] != $_POST['which'])
&& isset($categories->category[$c]->file[$k]))
$k++;
# make sure we only delete the file if it's found
if($categories->category[$c]->file[$k] == $_POST['which'])
unset($categories->category[$c]->file[$k]);
file_put_contents($file_path,$categories->asXML());
$page->addMessage('File successfully deleted.');
}
else
$page->addError('Could not delete file.');
$page->data('categories',$categories);
$page->content("admin/resources/toolsfor$type/list.php");
}
# perform the deletion of the specified article
else if($do == 'dodeletecat')
{
# find the category with the right id
$c = 0;
while(($categories->category[$c]['id'] != $_POST['which'])
&& isset($categories->category[$c]))
$c++;
# delete each of the files in this category
foreach($categories->category[$c]->file as $file)
{
if(!unlink($DOCROOT.'/site/data/resources/toolsfor'.$type.'/'.$categories->category[$c]->folder.'/'.$file))
$page->addError('File could not be deleted: '.$file);
}
# delete the folder
rmdir($DOCROOT.'/site/data/resources/toolsfor'.$type.'/'.$categories->category[$c]->folder);
# if we can successfully unset the category, then print a success message
unset($categories->category[$c]);
if(!isset($categories->category[$c]))
{
$page->addMessage('Category successfully deleted.');
file_put_contents($file_path,$categories->asXML());
}
else
{
$page->addError('Could not delete this category.');
}
$page->data('categories',$categories);
$page->content("admin/resources/toolsfor$type/list.php");
}
# display the list of book categories
else
{
$page->data('categories',$categories);
$page->content("admin/resources/toolsfor$type/list.php");
}
}
?>

View File

@@ -0,0 +1,24 @@
<?php
include '../php/classes/page.php';
$page = new Page();
$page->init_user();
# make sure the user is logged in before he has access to the
# admin section
if(!$page->user()->check_role('admin'))
{
$page->addMessage('You must login to use the administrator pages.');
$page->display('menu',false);
$page->content('admin/login.php');
}
else
$page->content('admin/whoweare.php');
$page->attr('title','Discipling the Nations: Administrator Area: Who We Are');
$page->menu('admin/menu.php');
$page->addCSSFile('admin.css');
$page->process();
?>

72
production/album.php Normal file
View File

@@ -0,0 +1,72 @@
<?php
include 'php/classes/page.php';
include 'functions/func_filesystem.php';
$page = new Page();
# gather album data and which album we want to display
$albums_xml_path = $DOCROOT.'/site/data/photosandvideos/albums.xml';
$albums = new SimpleXMLElement(file_get_contents($albums_xml_path));
$requested_album = null;
$album_data = null;
$first_photo = null;
$subalbums = array();
$thumbs = array();
if(isset($_GET['which']))
{
$requested_album = $_GET['which'];
# find the data for the requested album
foreach($albums->album as $album)
{
if((int)$album['id'] == $requested_album)
{
$album_data = $album;
break;
}
}
# if album_data is still empty then we never found a matching album!
if(is_null($album_data))
$page->addError('Album does not exist!');
else
{
# get the sub albums for this album
foreach($albums->album as $album)
{
if((int)$album->subalbumof == $requested_album)
array_push($subalbums,$album);
}
# get the thumbnails for this albums
$thumbs_path = $DOCROOT.'/site/data/photosandvideos/albums/'.$album_data->imagefolder;
$thumbs = filesys_get_wanted_children($thumbs_path,'folders','/^thumb_.*\.(jpg|JPG)$/');
# get the first photo that is initially displayed in the album window
$first_photo = str_replace('thumb_','small_',reset($thumbs));
}
}
else
{
$page->addError('Album does not exist.');
}
$page->attr('title','Discipling the Nations Album: '.$album->name);
$page->content('album.php');
$page->display('header',false);
$page->display('footer',false);
$page->display('menu',false);
$page->useCSSFile('album.css');
$page->useJSFile('photosandvideos.js');
# pass data to template
$page->data('album',$album_data);
$page->data('subalbums',$subalbums);
$page->data('thumbs',$thumbs);
$page->data('first_photo',$first_photo);
$page->data('num_photos',count($thumbs));
$page->process();
?>

13
production/index.php Normal file
View File

@@ -0,0 +1,13 @@
<?php
include 'php/classes/page.php';
$page = new Page();
$page->attr('title','Discipling the Nations: Home');
$page->content('intro.php');
$page->display('menu',false);
$page->useCSSFile('intro_menu.css');
$page->process();
?>

13
production/menu.php Normal file
View File

@@ -0,0 +1,13 @@
<?php
include 'php/classes/page.php';
$page = new Page();
$page->attr('title','Discipling the Nations: Main Menu');
$page->content('graphical_menu.php');
$page->display('menu',false);
$page->useCSSFile('intro_menu.css');
$page->process();
?>

View File

@@ -0,0 +1,38 @@
<?php
include 'php/classes/page.php';
include 'functions/func_xml.php';
$page = new Page();
$page->init_user();
# log the user in if required
if(isset($_POST['login']))
{
if($page->user()->login($_POST['username'],$_POST['password']))
$page->addMessage('Login successful. You can now view the travel info below.');
else
$page->addError('Invalid username/password combination. Please try again.');
}
else if(isset($_GET['logout']))
{
$page->user()->logout();
$page->addMessage('Logout successful.');
}
$page->attr('title','Discipling the Nations: Mission and Travel');
$page->content('missionandtravel.php');
$page->addCSSFile('missionandtravel.css');
$page->addJSFile('ssm.js','ssmItems.js','ssmItems_missionandtravel.js');
# get the random verse and pass it to the template
$page->data('verse',xml_random_child($FILES['verses']));
# get missionary moments to display here
$xml['missionarymoments'] = new SimpleXMLElement(file_get_contents($DOCROOT.'/site/data/missionarymoments.xml'));
$xml['shorttermopportunities'] = new SimpleXMLElement(file_get_contents($DOCROOT.'/site/data/missionandtravel/shorttermopportunities.xml'));
$xml['travelinfo'] = new SimpleXMLElement(file_get_contents($DOCROOT.'/site/data/missionandtravel/travelinfo.xml'));
$page->data('xml',$xml);
$page->process();
?>

View File

@@ -0,0 +1,28 @@
<?php
include 'php/classes/page.php';
include 'functions/func_xml.php';
$page = new Page();
$page->attr('title','Discipling the Nations: Photos and Videos');
$page->content('photosandvideos.php');
$page->addCSSFile('photosandvideos.css');
$page->addJSFile('ssm.js','ssmItems.js','ssmItems_photosandvideos.js');
# get the random verse and pass it to the template
$page->data('verse',xml_random_child($FILES['verses']));
# get the photos and video data from xml files
$xml = array();
$files = array('albums','videos');
$path = $DOCROOT.'/site/data/photosandvideos';
foreach($files as $key => $value)
{
$xml[$value] = new SimpleXMLElement(file_get_contents($path.'/'.$value.'.xml'));
unset($xml[$key]);
}
$page->data('xml',$xml);
$page->process();
?>

1
production/php/.htaccess Normal file
View File

@@ -0,0 +1 @@
Options -indexes

337
production/php/classes/page.php Executable file
View File

@@ -0,0 +1,337 @@
<?php
# start a session
session_start();
# we set the PHP error handler to use this function
set_error_handler("page_errors");
# only care about errors normally
error_reporting(E_ERROR | E_USER_ERROR);
#error_reporting(E_ALL);
# set the include path so that our templates can always include
# relative to the root template folder
$DOCROOT = str_replace($_SERVER['SCRIPT_NAME'],'',$_SERVER['SCRIPT_FILENAME']) . '/disciplingthenations';
$templates_path = $DOCROOT.'/site';
$php_path = $DOCROOT.'/php';
set_include_path(get_include_path() . PATH_SEPARATOR . $templates_path . PATH_SEPARATOR . $php_path);
# include configuration options
include_once 'includes/config.php';
# require the user class to handle users
require_once 'classes/user.php';
class Page
{
################################################################################
# PRIVATE DATA
private $title,$pageName, $lang;
private $cssFiles = array(),$jsFiles = array();
private $header, $footer, $content, $menu;
private $display,$data;
private $absPath,$absURL,$site,$templates,$js,$css,$graphics;
private $messages = array(),$errors = array();
private $user;
################################################################################
# PUBLIC FUNCTIONS
# constructor
public function __construct()
{
# set our paths
$this->absPath = str_replace($_SERVER['SCRIPT_NAME'],'',$_SERVER['SCRIPT_FILENAME']).'/disciplingthenations/';
$this->absURL = preg_replace('/^(.*)\/\w+\.php$/','$1',$_SERVER['SCRIPT_NAME']).'/';
$this->site = 'site/';
$this->templates = $this->absPath.$this->site;
$this->js = '/'.$this->site . 'javascript/';
$this->css = '/'.$this->site . 'css/';
$this->graphics = '/'.$this->site . 'graphics/';
# the page language is automatically pulled from a language
# cookie names 'lang'
if(isset($_GET['lang']))
{
$this->lang = $_GET['lang'];
setcookie('lang',$_GET['lang'],time() + 60*60*24*365);
# if the lang parameter is empty, we want to get rid of the cookie
if(empty($_GET['lang']))
unset($_COOKIE['lang']);
}
else if(isset($_COOKIE['lang']) && !empty($_COOKIE['lang']))
$this->lang = $_COOKIE['lang'];
else
$this->lang = 'en';
$this->templates .= $this->lang .'/';
$this->graphics .= $this->lang .'/';
# default values for title and pageName
$this->title = 'Welcome!';
$this->pageName = preg_replace('/^.*\/(\w+)\.php$/','$1',$_SERVER['SCRIPT_NAME']);
# elements of our page
$this->header = $this->templates . 'header.php';
$this->footer = $this->templates . 'footer.php';
$this->content = $this->templates . 'home.php';
$this->menu = $this->templates . 'menu.php';
# by default, the header, footer and content are all displayed
$this->display = array(
'header' => true,
'footer' => true,
'content' => true,
'menu' => true
);
# load default css and js files
array_push($this->cssFiles,$this->css . 'default.css');
array_push($this->jsFiles,$this->js . 'default.js');
}
# automatically load all css files from folder
public function autoloadCSS()
{
# find all CSS files in css folder
$this->cssFiles = preg_grep('/\.css$/',scandir($this->absPath . $this->css));
# make each path relative to absURL
foreach($this->cssFiles as $key => $value)
$this->cssFiles[$key] = $this->css . $value;
}
# automatically load all javascript files from folder
public function autoloadJS()
{
# find all js files in javascript folder
$this->jsFiles = preg_grep('/\.js$/',scandir($this->absPath . $this->js));
# make each path relative to absURL
foreach($this->jsFiles as $key => $value)
$this->jsFiles[$key] = $this->js . $value;
}
# processes all or part of the page
public function process($part = NULL)
{
# it is possible to process the header or footer by
# itself or just the content, or the entire page
if($part == 'header')
$this->_processHeader();
else if($part == 'footer')
$this->_processFooter();
else if($part == 'content')
$this->_processContent();
else
$this->_processPage();
}
# adds a js file to ones already pulled from standard
# folder
public function addJSFile($new_file)
{
# a list of files can be passed to add several js files at once
if(func_num_args() > 1)
{
$files = func_get_args();
foreach($files as $js_file)
{
array_push($this->jsFiles, $this->js . $js_file);
}
}
# add single file with relative path
else
{
array_push($this->jsFiles, $this->js . $new_file);
}
}
# replaces all other js files with this one
public function useJSFile($new_file)
{
$this->jsFiles = array($this->js . $new_file);
}
# adds a css file to ones already pulled from standard folder
public function addCSSFile($new_file)
{
# a list of files can be passed to add several CSS files at once
if(func_num_args() > 1)
{
$files = func_get_args();
foreach($files as $css_file)
{
array_push($this->cssFiles, $this->css . $css_file);
}
}
# add file with relative path
else
{
array_push($this->cssFiles, $this->css . $new_file);
}
}
# replaces all other css files with this one
public function useCSSFile($new_file)
{
$this->cssFiles = array($this->css . $new_file);
}
# adds an error message to the array
public function addError($err)
{
array_push($this->errors,$err);
}
# adds non-error message to the array
public function addMessage($msg)
{
array_push($this->messages,$msg);
}
################################################################################
# SETTERS/GETTERS
# return the user object
public function init_user()
{
$this->user = new User($this->absPath.$this->site);
}
public function user()
{
if(empty($this->user))
$this->init_user();
return $this->user;
}
# you can pass data to the template via this variable
public function data($key,&$value = NULL)
{
if(!is_null($value))
$this->data[$key] = $value;
else
return($this->data[$key]);
}
# you can turn off parts of the page by setting it's
# corresponding display element to false
public function display($page_element,$value = NULL)
{
if(!is_null($value))
$this->display[$page_element] = $value;
else
return($this->display[$page_element]);
}
# setter/getter for header file
public function header($new_header = NULL)
{
if(!is_null($new_header))
$this->header = $this->templates . $new_header;
else
return $this->header;
}
# setter/getter for footer file
public function footer($new_footer = NULL)
{
if(!is_null($new_footer))
$this->footer = $this->templates . $new_footer;
else
return $this->footer;
}
# setter/getter for content file
public function content($new_content = NULL)
{
if(!is_null($new_content))
$this->content = $this->templates . $new_content;
else
return $this->content;
}
# setter/getter for menu file
public function menu($new_menu = NULL)
{
if(!is_null($new_menu))
$this->menu = $this->templates . $new_menu;
else
return $this->menu;
}
# accessor/modifier for page attributes
public function attr($attr,$value = NULL)
{
# the case when we are setting an attribute
if(!is_null($value))
{
switch($attr)
{
case 'lang':
$this->lang = $value;
$this->templates = $this->site;
$this->templates .= $this->lang .'/';
$this->graphics .= $this->lang .'/';
$this->header = $this->templates . 'header.php';
$this->footer = $this->templates . 'footer.php';
$this->content = $this->templates . 'home.php';
break;
case 'title':
$this->title = $value;
break;
default:
break;
}
}
# the case when we are getting an attribute
else
{
switch($attr)
{
case 'lang':
return $this->lang;
break;
case 'title':
return $this->title;
break;
default:
break;
}
}
}
################################################################################
# PRIVATE FUNCTIONS
private function _processPage()
{
include $this->absPath . $this->site . 'layout/html.php';
}
private function _processHeader()
{
include $this->header;
}
private function _processFooter()
{
include $this->footer;
}
private function _processContent()
{
include $this->content;
}
}
################################################################## page_errors #
function page_errors($errno, $errstr, $errfile, $errline, $errcontext)
{
global $page;
# don't do anything with the message if error_reporting
# is too low for this type of error
if(!(error_reporting() & $errno))
return true;
switch($errno)
{
case E_USER_ERROR:
$page->addError($errstr);
break;
case E_NOTICE:
case E_WARNING:
case E_USER_WARNING:
case E_USER_NOTICE:
$page->addMessage($errstr.$errno.$errfile.$errline);
break;
default:
$page->addError("$errno: $errstr on $errline in $errfile");
break;
}
return true;
}
?>

View File

@@ -0,0 +1,94 @@
<?php
class User
{
##############################################################################
# PRIVATE DATA
private $password, $username, $loggedin, $role;
private $user_data;
##############################################################################
# PUBLIC FUNCTIONS
public function __construct($site_path)
{
$this->user_data = simplexml_load_file($site_path.'data/users/users.xml');
$this->username = $_SESSION['username'];
$this->loggedin = $_SESSION['_loggedin'];
$this->role = $_SESSION['userrole'];
}
public function __destruct()
{
# save the session data when the object goes out of context
$_SESSION['username'] = $this->username;
$_SESSION['_loggedin'] = $this->loggedin;
$_SESSION['userrole'] = $this->role;
}
# see if a user is logged in
public function user_exists()
{
return $this->loggedin;
}
# check if the user has a role equal to what is passed
public function check_role($role_to_check)
{
$role_to_check = strtolower($role_to_check);
if(($role_to_check == $this->role) && $this->loggedin)
return true;
else
return false;
}
public function login($username,$password)
{
foreach($this->user_data->user as $user)
{
if($username == (string)$user->username)
{
$hash = sha1($password);
if($hash == (string)$user->password)
{
$this->username = $username;
$this->password = $hash;
$this->loggedin = true;
$this->role = (string)$user->role;
return true;
}
return false;
}
}
return false;
}
# log the user out
public function logout()
{
# delete cookie
setcookie('PHPSESSID','',time()-3600);
# delete the session entirely
session_unset();
# reset object vars
$this->loggedin = false;
$this->username = NULL;
$this->password = NULL;
$this->role = NULL;
return true;
}
##############################################################################
# SETTERS/GETTERS
public function username($new_username = NULL)
{
if(!is_null($new_username))
$this->username = $new_username;
else
return $this->username;
}
public function role()
{
return $this->role;
}
##############################################################################
# PRIVATE FUNCTIONS
}
?>

View File

@@ -0,0 +1,58 @@
<?php
################################################ FUNCTION: file_process_upload #
function file_process_upload($input_name,$save_path,$overwrite = false,$replace_regex = "/[^A-Za-z0-9]+/")
{
$no_errs = true;
$clean_names = array();
if(!is_dir($save_path))
{
trigger_error('Path is not a directory.',E_USER_ERROR);
return false;
}
if(!is_array($_FILES[$input_name]['tmp_name']))
{
foreach($_FILES[$input_name] as $key => $value)
$_FILES[$input_name][$key] = array($_FILES[$input_name][$key]);
}
foreach($_FILES[$input_name]['tmp_name'] as $key => $value)
{
if(!is_uploaded_file($_FILES[$input_name]['tmp_name'][$key]))
{
$no_errs = false;
trigger_error('File "'.$_FILES[$input_name]['name'][$key].'" is not an uploaded file.',E_USER_ERROR);
}
$clean_name = $_FILES[$input_name]['name'][$key];
# find the extension
preg_match("/(\.\S+)$/",$clean_name,$matches);
$ext = $matches[1];
# take the extension off of the file name
$clean_name = str_replace($ext,'',$clean_name);
$clean_name = preg_replace($replace_regex,'_',$clean_name);
# move the uploaded file to the new location, unless a file with the same name
# is already there
if(file_exists($save_path.'/'.$clean_name.$ext) and !$overwrite)
{
$no_errs = false;
trigger_error('File "'.$_FILES[$input_name]['name'][$key].'" already exists.', E_USER_ERROR);
}
if(move_uploaded_file($_FILES[$input_name]['tmp_name'][$key],$save_path.'/'.$clean_name.$ext))
array_push($clean_names,$clean_name.$ext);
else
{
$no_errs = false;
trigger_error('File "'.$_FILES[$input_name]['name'][$key].'" could not be moved to permanent location.', E_USER_ERROR);
}
}
if(count($clean_names) == 1)
return($clean_names[0]);
else
return($clean_names);
}
?>

View File

@@ -0,0 +1,150 @@
<?php
#################################################################################
# #
# written by benjamin ramey #
# bsr@rameydesign.net #
# #
# This file contains: #
# Functions that perform various filesystem tasks such as removing #
# unwanted types of files/folders from an array of files and folders #
# in a folder #
# #
#################################################################################
############################################# FUNCTION: filesys_get_folder_tree #
# returns: html of folder tree
# parameters: path to root folder
function filesys_get_folder_tree($path)
{
global $_DOC_ROOT,$_SCRIPT_FOLDER;
# variable that will hold all the HTML for the folder
$folderhtml = '';
# get folder contents in alphabetical order
$folder_contents = scandir($path);
# the url is used so that people can download/look at these files through
# the browser, a doc_root path wouldn't work, of course
$url = str_replace($_DOC_ROOT,"$_SCRIPT_FOLDER",$path);
# one by one, set $element to a file or folder inside the passed folder
foreach($folder_contents as $element)
{
# ignore current and parent folders
if( ($element != '.') and ($element != '..') )
{
# make sure each is_dir call is not using cached information
# from last is_dir check
clearstatcache();
# if $element is a folder, call this function recursively and
# create HTML for this subfolder
if( is_dir("$path/$element") )
{
$folderhtml .= "
<div class='folder_name' id='${element}_name'
onclick='ExpandFolder(this)'
onmouseover='ChangeFolderNameBG(this,0)'
onmouseout='ChangeFolderNameBG(this,1)'>
+ $element
</div>
<div class='sub_folder' id='${element}_folder'>";
$folderhtml .= filesys_get_folder_tree("$path/$element");
$folderhtml .= "
</div>\n\n";
}
else
{
# get the size of this file in kilobytes
$file_size_kb = intval(filesize($path.'/'.$element) / 1024);
$folderhtml .= "
+ <a href='/$url/$element'>$element</a>
($file_size_kb Kb)<br />\n";
}
}
}
return $folderhtml;
}
################################################ FUNCTION: filesys_dirs_present #
# returns: true or false
# parameters: path to directory to inspect, pattern to match directory name
# against
function filesys_dirs_present($path,$pattern = "/.*/")
{
# make sure the path passed here is really a directory we can't
# check anything but a directory, since only directory will contain
# other directories, duh
$handle = is_dir($path) ? opendir($path) : NULL ;
if(empty($handle))
{ return(NULL); }
# set through each child in this directory and see if the child
# is directory but not the parent or current directory
# readdir returns FALSE when no children are left to inspect
while($child = readdir($handle) and $child !== false)
{
# make sure each is_dir call is not using cached information
# from last is_dir check
clearstatcache();
# check if this child is directory and whether it
# matches the user given pattern or not
if(is_dir($path.'/'.$child)
and ($child !== '..')
and ($child !== '.')
and (preg_match($pattern,$child)) )
{
# we can return true with the first matching folder we find
# this is an OR operation
return(true);
}
}
# if we get here, no matching folders were found, so none exist
# so we return false
return(false);
}
######################################### FUNCTION: filesys_get_wanted_children #
# returns: array of wanted dir children
# parameters: 1) path to directory; 2) command to remove [files,folders]
# 3) a pattern to match folder/file names against
function filesys_get_wanted_children($path,$exclude,$pattern = "/.*/")
{
# the cmd can be passed as either all cap or not, so conform it
# here to lower case
$exclude = strtolower($exclude);
# fill an array full of the directory children, but only, of course if
# the passed path is really to a directory
$children = is_dir($path) ? scandir($path) : NULL ;
if(empty($children))
{ return(NULL); }
# remove the current and parent directories
$children = preg_grep("/^\.{1,2}$/",$children,PREG_GREP_INVERT);
# get only the children that match the pattern
$children = preg_grep($pattern,$children);
# if files are to be removed, remove them
if($exclude == 'files')
{
foreach($children as $key => $value)
{
if(!is_dir($path.'/'.$value))
unset($children[$key]);
}
}
# if folders are to be removed, remove them
else if($exclude == 'folders')
{
foreach($children as $key => $value)
{
if(is_dir($path.'/'.$value))
unset($children[$key]);
}
}
# return the array of directory children, free of the bad little ones
return($children);
}
?>

View File

@@ -0,0 +1,25 @@
<?php
################################################### FUNCTION: xml_random_child #
function xml_random_child($xml_file)
{
$xml = xml_get_from_file($xml_file);
$children = $xml->children();
$count = count($children);
return($children[rand(0,$count-1)]);
}
################################################## FUNCTION: xml_get_from_file #
function xml_get_from_file($file_path)
{
if(!file_exists($file_path))
{
trigger_error('XML file "'.$file_path.'" does not exist!');
return NULL;
}
return simplexml_load_file($file_path);
}
?>

View File

@@ -0,0 +1,7 @@
<?php
$FILES = array(
'verses' => $DOCROOT.'/site/data/verses.xml'
);
?>

View File

@@ -0,0 +1,36 @@
<?php
include 'php/classes/page.php';
include 'functions/func_xml.php';
$page = new Page();
$page->attr('title','Discipling the Nations: Prayer Requests');
$page->content('prayerrequests.php');
$page->addCSSFile('prayerrequests.css');
$page->addJSFile('ssm.js','ssmItems.js','ssmItems_prayerrequests.js');
# get the ministry moments data
$xml = array();
$res_files = array('emailupdates','prayerletters');
$res_path = $DOCROOT.'/site/data/prayerrequests';
foreach($res_files as $key => $value)
{
$xml[$value] = new SimpleXMLElement(file_get_contents($res_path.'/'.$value.'.xml'));
unset($xml[$key]);
}
# get the missionary moments separately since it's not in the
# prayerrequest's data folder
$xml['missionarymoments'] = new SimpleXMLElement(file_get_contents($DOCROOT.'/site/data/missionarymoments.xml'));
// # get the latest prayer letter
// $num_letters = count($xml['prayerletters']->prayerletter);
// if($num_letters > 0)
// $page->data('latestprayerletter',$xml['prayerletters']->prayerletter[$num_letters - 1]);
# get the random verse and pass it to the template
$page->data('verse',xml_random_child($FILES['verses']));
$page->data('xml',$xml);
$page->process();
?>

29
production/resources.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
include 'php/classes/page.php';
include 'functions/func_xml.php';
$page = new Page();
$page->attr('title','Discipling the Nations: Resources');
$page->content('resources.php');
$page->addCSSFile('resources.css');
$page->addJSFile('ssm.js','ssmItems.js','ssmItems_resources.js');
# get the random verse and pass it to the template
$page->data('verse',xml_random_child($FILES['verses']));
# get the resources data from xml files
$xml = array();
$res_files = array('articles','books','links','onleadership','teachingoutlines',
'toolsforministry','toolsforpersonal');
$res_path = $DOCROOT.'/site/data/resources';
foreach($res_files as $key => $value)
{
$xml[$value] = new SimpleXMLElement(file_get_contents($res_path.'/'.$value.'.xml'));
unset($xml[$key]);
}
$page->data('xml',$xml);
$page->process();
?>

View File

@@ -0,0 +1 @@
Options -indexes

View File

@@ -0,0 +1,178 @@
h1 {
text-indent: 10px;
}
h2 {
color: black;
border-color: black;
}
/*******************************
Major page division styles specific to this page
*****************************/
div#header {
background: #333333 url(/site/graphics/whoweare/second_strip_top.gif) repeat-x bottom center;
}
div#content {
margin: 0;
background: #999966;
border: 0;
padding: 10px;
}
div#footer {
background: #333333 url(/site/graphics/whoweare/second_strip_bottom.gif) repeat-x top center;
}
div#dtn_logo {
display: none;
}
div#page_symbol {
display: none;
}
div#messages, div#errors {
margin: 0;
}
/*******************************
Admin menu styles
*****************************/
div#menu {
text-align: left;
padding: 2px 0 10px 0;
background: #999966;
}
div#menu ul {
list-style: none;
margin: 0;
padding: 0;
font-size: 1em;
}
div#menu ul li {
position: relative;
z-index: 10;
display: inline;
margin: 0;
padding: 0px 4px;
}
div#menu ul li a {
display: inline;
padding: 4px;
text-decoration: none;
color: black;
font-size: 0.8em;
border: 1px #999966 solid;
}
div#menu ul li:hover a {
background: #cccc99;
color: black;
text-decoration: none;
border: 1px #333 solid;
}
/*******************************
Admin form styles
*****************************/
div.new_photos {
margin-bottom: 10px;
}
div.new_photos input {
margin: 2px 0;
}
/*******************************
Active page link styles
*****************************/
body#whoweare li#mi_whoweare a.menu_header,
body#resources li#mi_resources a.menu_header,
body#prayerrequests li#mi_prayerrequests a.menu_header,
body#missionandtravel li#mi_missionandtravel a.menu_header,
body#photosandvideos li#mi_photosandvideos a.menu_header {
background: #cccc99;
color: black;
text-decoration: none;
border: 1px #333 solid;
}
/*******************************
Admin drop-down menu styles
*****************************/
div#menu ol.sub_menu {
position: absolute;
display: none;
top: 26px;
left: 4px;
margin: 0pt;
padding: 0pt;
background: #cccc99;
border: solid #333333;
border-width: 0 0 1px;
font-size: 1em;
}
div#menu ol.sub_menu li {
margin: 0;
padding: 0;
display: block;
text-align: left;
}
div#menu ol.sub_menu li a {
display: block;
width: 150px;
border: #333 solid;
border-width: 1px 1px 0;
}
div#menu ol.sub_menu li:hover a {
background: #fff;
}
div#menu ul li:hover ol.sub_menu {
display: block;
}
div#menu ul li ol.sub_menu:hover {
display: block;
}
/*li#mi_whoweare ol.sub_menu { left: 10px; top: 44px; }
li#mi_resources ol.sub_menu { left: 94px; top: 44px; }
li#mi_prayerrequests ol.sub_menu { left: 175px; top: 44px; }
li#mi_missionandtravel ol.sub_menu { left: 288px; top: 44px; }
li#mi_photosandvideos ol.sub_menu { left: 413px; top: 44px; }*/
/*******************************
Data table styles
*****************************/
a.action {
display: inline;
padding: 2px 6px;
border: 1px #333 solid;
background: #ccc;
color: black;
text-decoration: none;
}
a.action:hover {
background: #333;
color: white;
}
table {
margin: 10px 0 10px 20px;
font-size: .8em;
}
table td {
padding: 8px 8px;
vertical-align: top;
}
table thead {
background: #333;
color: #ccc;
font-weight: bold;
}
textarea {
width: 400px;
height: 100px;
}
tr.alt_row {
background-color: #cccc99;
}
td.subcatname {
text-align: right;
}
td.actions {
width: 100px;
}
td div.photos_cell {
max-height: 150px;
overflow: auto;
}

View File

@@ -0,0 +1,77 @@
body {
background: black;
color: #cccccc;
font-family: Arial, sans-serif;
}
h1 {
font-size: 1.2em;
}
a {
color: #ccc;
}
img {
border: 0;
margin: 4px 0;
}
div#sub_album_list,div#sub_album_list_big {
width: 100%;
overflow: auto;
}
div#sub_album_list div.album {
float: left;
text-align: center;
font-size: 0.6em;
margin: 10px 20px;
}
div#sub_album_list div.album img {
width: 40px;
}
div#sub_album_list_big div.album {
float: left;
text-align: center;
font-size: 0.8em;
margin: 10px 40px;
}
div#thumbnails {
float: right;
padding: 6px;
border: 1px solid #666666;
height: 400px;
width: 120px;
overflow: auto;
}
div#thumbnails img {
margin: 4 auto;
}
div#current_picture {
float: left;
margin: 0 20px;
padding: 6px;
border: 1px solid #666666;
}
p.photo_count {
position: absolute;
bottom: 0;
clear: both;
text-align: center;
}
p.small {
margin: 4px;
font-size: 0.8em;
}
div#errors {
width: 100%;
border-width: 4px 0;
border-style: solid;
border-color: black;
background: red;
color: white;
}
div#messages {
width: 100%;
border-width: 4px 0;
border-style: solid;
border-color: black;
background: yellow;
color: black;
}

View File

@@ -0,0 +1,228 @@
body {
margin: 0px;
padding: 0px;
font-family: Arial,Helvetica,sans-serif;
background: #333333;
}
h1 {
text-indent: -10000px;
margin: 0;
background: left center no-repeat;
}
h1 a {
display: block;
height: 90px;
width: 515px;
}
h2 {
clear: both;
color: #B0111F;
margin: 0 10px;
padding: 20px 0 4px 8px;
font-size: 1.2em;
font-weight: normal;
border-bottom: 2px solid #B0111F;
}
h3 {
font-size: 0.9em;
margin: 10px 20px;
}
h4 {
font-size: 0.9em;
margin: 10px 20px;
}
p {
margin: 10px 22px;
font-size: 0.8em;
}
p.ssm {
margin: auto auto;
}
p.random_verse {
font-size: 0.8em;
font-style: italic;
color: #333333;
}
p.random_verse span {
font-style: normal;
}
ul, ol {
font-size: 0.8em;
}
ul p, ol p {
font-size: 1em;
margin-left: 0;
margin-right: 0;
}
ul ul, ol ol {
font-size: 1em;
}
ul.page_toc {
list-style: none;
margin: 15px;
border: solid #B0111F;
border-width: 1px 0;
text-align: center;
padding: 6px;
text-transform: uppercase;
font-size: 0.7em;
}
ul.page_toc li {
display: inline;
margin: 4px 0;
padding: 0 6px 0 4px;
border-right: 1px solid #333333;
}
ul.page_toc li.last {
border: 0;
}
ul.page_toc a {
text-decoration: none;
color: #B0111F;
}
ul.page_toc a:hover {
text-decoration: underline;
}
ol.alpha_list {
list-style: lower-alpha;
}
.red_em1 {
color: #990000;
font-weight: bold;
font-size: 1.1em;
margin: 10px 30px;
}
.red_em2 {
color: #990000;
font-size: 0.8em;
font-style: italic;
}
img {
border: 0;
}
form {
font-size: 0.8em;
margin: 10px 20px;
}
form div.field {
position: relative;
display: block;
width: 120px;
margin: 15px 0;
}
form div.field label {
position: relative;
top: 4px;
}
form div.field input, form div.field select {
position: absolute;
left: 100%;
}
form div.field input.oneofmany {
position: relative;
left: 0;
}
form div.field textarea {
position: relative;
margin-left: 120px;
top: -15px;
}
/*******************************
Sliding menu link styles
*****************************/
a.ssmItems {
color: black;
text-decoration:none;
}
a.ssmItems:active {
color: white;
}
a.ssmItems:visited {
color: black;
}
/*******************************
Major page division styles
*****************************/
div#header {
height: 24px;
background-color: #333333;
}
div#content {
margin: 4px 10px 10px 195px;
border: #333333 3px solid;
}
div#footer {
clear: both;
width: 100%;
text-align: center;
padding: 12px 0;
font-size: 0.6em;
color: #999999;
background-color: #333333;
}
div#footer a {
color: #999999;
}
div#dtn_logo {
position: absolute;
z-index: 2;
left: 0;
top: 42px;
width: 195px;
height: 200px;
}
div#page_symbol {
position: absolute;
z-index: 1;
left: 0;
top: 200px;
width: 195px;
height: 157px;
}
div#errors {
margin: 4px 0px 0px 196px;
width: 100%;
border-width: 1px 0;
border-style: solid;
border-color: black;
background: red;
color: white;
}
div#messages {
margin: 4px 0px 0px 196px;
width: 100%;
border-width: 1px 0;
border-style: solid;
border-color: black;
background: yellow;
color: black;
}
/*******************************
Menu styles at top of each page
*****************************/
div#menu {
text-align: right;
padding-right: 10px;
}
div#menu ul {
list-style: none;
margin: 0;
font-size: 1em;
}
div#menu ul li {
display: inline;
margin: 0;
padding: 2px 4px;
}
div#menu a {
text-decoration: none;
color: #333333;
font-size: 0.8em;
}
div#menu a.active {
border-bottom: 2px #333333 solid;
}
div#menu a:hover {
color: #cccccc;
text-decoration: underline;
}

View File

@@ -0,0 +1,249 @@
body {
margin: 0px;
padding: 0px;
font-family: Arial,Helvetica,sans-serif;
background: #333333;
}
div#header {
height: 30px;
background: url(/site/graphics/second_strip_top_index.gif) repeat-x bottom center;
}
div#left_column {
display: none;
}
div#content {
background: #D2D1A5;
}
div#footer {
text-align: center;
padding: 12px 0;
background: url(/site/graphics/second_strip_bottom_index.gif) repeat-x top center;
font-size: 0.6em;
color: #999999;
}
div#footer a {
color: #999999;
}
div#dtn_logo {
display: none;
}
div#page_symbol {
display: none;
}
div#collage, div#menu {
position: relative;
width: 700px;
height: 400px;
margin: 0 auto;
}
/*******************************
Collage (intro) page styles
*****************************/
div#collage {
background: url(/site/graphics/austria_map_bg_index.jpg) center center no-repeat;
}
div#collage #leftside {
position: absolute;
top: 20px;
left: 150px;
width: 188px;
height: 356px;
background: url(/site/graphics/collage_leftside.gif) center center no-repeat;
}
div#collage #leftside #moto {
position: relative;
left: 72px;
top: 130px;
}
div#collage #rightside {
position: absolute;
background: url(/site/graphics/collage_rightside.gif) center center no-repeat;
width: 208px;
height: 285px;
left: 340px;
top: 25px;
}
div#collage #enter_connecting_line {
position: absolute;
left: 448px;
top: 310px;
border-width: 0px 1px 0px 0px;
border-color: #990000;
border-style: solid;
width: 2px;
height: 20px;
}
div#collage #enter_btn {
position: absolute;
left: 412px;
top: 330px;
border: 1px #990000 solid;
}
div#collage #enter_btn a {
display: block;
padding: 4px 14px;
text-decoration: none;
color: #333333;
background: #cccccc;
letter-spacing: 2px;
}
div#collage #enter_btn a:hover {
background: #8f98bf;
}
/*******************************
Menu (home) page styles
*****************************/
div#menu {
background: url(/site/graphics/austria_map_bg_home.jpg) center center no-repeat;
height: 450px;
}
ul#graphic_menu {
list-style: none;
margin: 0;
padding: 0;
}
ul#graphic_menu li a {
display: block;
position: absolute;
width: 100px;
height: 100px;
text-indent: -10000px;
}
/*******************************
Styles for the table of contents
*****************************/
div#menu div#toc {
position: absolute;
background: black;
color: #999999;
padding: 10px;
width: 160px;
font-size: 0.9em;
left: 450px;
top: 165px;
border: solid black;
border-width: 2px 1px;
}
div#toc p {
margin: 6px 0px;
}
div#menu div#toc_tab {
position: absolute;
top: 165px;
left: 630px;
background: url(/site/graphics/toc_tab.gif) no-repeat center center;
width: 25px;
height: 93px;
}
div#toc ul {
min-height: 100px;
display: none;
}
div#toc ul {
padding: 0 0 0 4px;
margin: 0;
list-style: none;
}
div#toc li a {
position: relative;
text-indent: 0px;
color: #cccccc;
font-size: 0.9em;
font-weight: normal;
}
div#toc li.toc_header a {
font-size: 1.2em;
}
div#toc_openingmsg {
position: relative;
display: block;
font-weight: bold;
}
div#toc_whoweare, div#toc_resources, div#toc_prayerrequest,
div#toc_missionandtravel, div#toc_photosandvideos {
position: relative;
visibility: hidden;
background: white;
border: 2px yellow solid;
color: black;
}
/*******************************
Styles for graphical menu
*****************************/
div#menu div#logo a {
display: block;
background: url(/site/graphics/dtn_logo.gif) center center no-repeat;
width: 114px;
height: 114px;
position: absolute;
left: 302px;
top: 165px;
text-indent: -10000px;
}
div#menu li#whoweare a {
background: url(/site/graphics/home_wwa_btn1.gif) no-repeat center center;
left: 310px;
top: 31px;
}
div#menu li#whoweare a:hover {
background: url(/site/graphics/home_wwa_btn2.gif) no-repeat center center;
}
div#menu li#resources a {
background: url(/site/graphics/home_res_btn1.gif) no-repeat center center;
left: 190px;
top: 71px;
}
div#menu li#resources a:hover {
background: url(/site/graphics/home_res_btn2.gif) no-repeat center center;
}
div#menu li#prayerrequests a {
background: url(/site/graphics/home_prayer_btn1.gif) no-repeat center center;
left: 120px;
top: 173px;
}
div#menu li#prayerrequests a:hover {
background: url(/site/graphics/home_prayer_btn2.gif) no-repeat center center;
}
div#menu li#missionandtravel a {
background: url(/site/graphics/home_travel_btn1.gif) no-repeat center center;
left: 191px;
top: 275px;
}
div#menu li#missionandtravel a:hover {
background: url(/site/graphics/home_travel_btn2.gif) no-repeat center center;
}
div#menu li#photosandvideos a {
background: url(/site/graphics/home_media_btn1.gif) no-repeat center center;
left: 310px;
top: 319px;
}
div#menu li#photosandvideos a:hover {
background: url(/site/graphics/home_media_btn2.gif) no-repeat center center;
}
/*******************************
Styles for text links in footer
*****************************/
div#menu div#text_menu {
position: absolute;
text-align: center;
top: 430px;
width: 100%;
}
div#text_menu ul {
list-style: none;
margin: 0;
padding: 0;
}
div#text_menu li {
display: inline;
padding: 0px 6px;
}
div#text_menu li a {
display: inline;
position: relative;
color: #333333;
font-size: 0.8em;
}
div#text_menu li a:hover {
color: #999999;
}

View File

@@ -0,0 +1,34 @@
body {
background: #558000 url(/site/graphics/missionandtravel/sidebar_bg.gif) top left repeat-y;
}
h1 {
background-image: url(/site/graphics/missionandtravel/missionandtravel_title.gif);
}
/*******************************
Major page division styles specific to this page
*****************************/
div#header {
background: #333333 url(/site/graphics/missionandtravel/second_strip_top.gif) repeat-x bottom center;
}
div#content {
background: #c4d79d;
}
div#footer {
background: #333333 url(/site/graphics/missionandtravel/second_strip_bottom.gif) repeat-x top center;
}
div#menu {
background: #558000;
}
/*******************************
Other specific styles for this page
*****************************/
div#dtn_logo {
background: url(/site/graphics/missionandtravel/sidebar_dtn_logo.gif) no-repeat center center;
}
div#page_symbol {
background: url(/site/graphics/missionandtravel/sidebar_missionandtravel.gif) no-repeat center center;
}
img#europe_map {
display: block;
margin: 0 auto;
}

View File

@@ -0,0 +1,41 @@
body {
background: #b36600 url(/site/graphics/photosandvideos/sidebar_bg.gif) top left repeat-y;
}
h1 {
background-image: url(/site/graphics/photosandvideos/photosandvideos_title.gif);
}
/*******************************
Major page division styles specific to this page
*****************************/
div#header {
background: #333333 url(/site/graphics/photosandvideos/second_strip_top.gif) repeat-x bottom center;
}
div#content {
background: #fbe276;
}
div#footer {
background: #333333 url(/site/graphics/photosandvideos/second_strip_bottom.gif) repeat-x top center;
}
div#menu {
background: #b36600;
}
/*******************************
Other specific styles for this page
*****************************/
div#dtn_logo {
background: url(/site/graphics/photosandvideos/sidebar_dtn_logo.gif) no-repeat center center;
}
div#page_symbol {
background: url(/site/graphics/photosandvideos/sidebar_photosandvideos.gif) no-repeat center center;
}
div.album, div.video {
float: left;
font-size: 0.8em;
margin: 10px 20px;
text-align: center;
}
div.spacer {
display: block;
width: 100%;
clear: both;
}

View File

@@ -0,0 +1,30 @@
body {
background: #68799d url(/site/graphics/prayerrequests/sidebar_bg.gif) top left repeat-y;
}
h1 {
background-image: url(/site/graphics/prayerrequests/prayerrequests_title.gif);
}
/*******************************
Major page division styles specific to this page
*****************************/
div#header {
background: #333333 url(/site/graphics/prayerrequests/second_strip_top.gif) repeat-x bottom center;
}
div#content {
background: #a6b0c4;
}
div#footer {
background: #333333 url(/site/graphics/prayerrequests/second_strip_bottom.gif) repeat-x top center;
}
div#menu {
background: #68799d;
}
/*******************************
Other specific styles for this page
*****************************/
div#dtn_logo {
background: url(/site/graphics/prayerrequests/sidebar_dtn_logo.gif) no-repeat center center;
}
div#page_symbol {
background: url(/site/graphics/prayerrequests/sidebar_prayerrequests.gif) no-repeat center center;
}

View File

@@ -0,0 +1,30 @@
body {
background: #999999 url(/site/graphics/resources/sidebar_bg.gif) top left repeat-y;
}
h1 {
background-image: url(/site/graphics/resources/resources_title.gif);
}
/*******************************
Major page division styles specific to this page
*****************************/
div#header {
background: #333333 url(/site/graphics/resources/second_strip_top.gif) repeat-x bottom center;
}
div#content {
background: #cccccc;
}
div#footer {
background: #333333 url(/site/graphics/resources/second_strip_bottom.gif) repeat-x top center;
}
div#menu {
background: #999999;
}
/*******************************
Other specific styles for this page
*****************************/
div#dtn_logo {
background: url(/site/graphics/resources/sidebar_dtn_logo.gif) no-repeat center center;
}
div#page_symbol {
background: url(/site/graphics/resources/sidebar_resources.gif) no-repeat center center;
}

View File

@@ -0,0 +1,12 @@
body {
background: black;
color: #cccccc;
font-family: Arial, sans-serif;
}
h1 {
font-size: 1.2em;
}
div.video {
margin: 10px auto;
width: 100%;
}

View File

@@ -0,0 +1,34 @@
body {
background: #999966 url(/site/graphics/whoweare/sidebar_bg.gif) top left repeat-y;
}
h1 {
background-image: url(/site/graphics/whoweare/whoweare_title.gif);
}
/*******************************
Major page division styles specific to this page
*****************************/
div#header {
background: #333333 url(/site/graphics/whoweare/second_strip_top.gif) repeat-x bottom center;
}
div#content {
background: #cccc99;
}
div#footer {
background: #333333 url(/site/graphics/whoweare/second_strip_bottom.gif) repeat-x top center;
}
div#menu {
background: #999966;
}
/*******************************
Other specific styles for this page
*****************************/
div#dtn_logo {
background: url(/site/graphics/whoweare/sidebar_dtn_logo.gif) no-repeat center center;
}
div#page_symbol {
background: url(/site/graphics/whoweare/sidebar_whoweare.gif) no-repeat center center;
}
img#under_three_circle {
position: relative;
left: 90px;
}

View File

@@ -0,0 +1,2 @@
Order deny,allow
Deny from all

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<shorttermopportunities>
</shorttermopportunities>

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<travelinfo>
</travelinfo>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<missionarymoments>
<moment id="1">
<title>Missionary Moments from 13.3.04</title>
<date>13.3.04</date>
<file>13.3.04.htm</file>
<summary> dearest family, warm greetings to you from Austria, in the precious name of our Lord this will be a short prayer request about an exciting up-coming ministry opportunity for Leanne ... she's just written her sister to ask her to pray, and I asked if we could send it out to all of you for...&#13;
</summary>
</moment>
<moment id="2">
<title>Missionary Moments from 9.Feb.04</title>
<date>9.Feb.04</date>
<file>9.Feb.04.htm</file>
<summary>dear ones, this will be a short note to you all, with a number of strategic ministry events for you to pray for: Tues, 10.Feb a.m. meeting for our city reaching ministry team [Pray Vienna] p.m. meet with our local pastor to encourage him Leanne's a.m. leadership...&#13;
</summary>
</moment>
<moment id="3">
<title>Missionary Moments from 18.Jan.04</title>
<date>18.Jan.04</date>
<file>18.Jan.04.htm</file>
<summary>
welcome to a new year partners, and thanks for your faithfulness in praying during 2003! without your prayers, only God knows what might have happened to this ministry and our family -- but we rejoice with you that He has allowed us to be very fruitful for His Kingdom one more year this...
</summary>
</moment>
<moment id="4">
<title>Missionary Moments from 19.11.03</title>
<date>19.11.03</date>
<file>19.11.03.htm</file>
<summary>
warmest greetings from Austria, to all our prayer partners, in the name of our Lord &amp; Saviour ! so much has happened since we last wrote, and many miles (kilometers) under our belts since then 15.-19.Oct European Evangelical Alliance + Hope for Europe Round Table meetings...
</summary>
</moment>
</missionarymoments>

View File

@@ -0,0 +1,19 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Disciple the Nations :: Carter's Ministry Moments</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="background-color: #CCCCCC; border-style: solid; border-width: 5px; border-color: #FFFFFF; margin: 0px; padding: 10px;">
<div align="left">
<b style="text-decoration: underline">Carter's Ministry Moments from 13.3.04</b>
<br /> <br />
dearest family, warm greetings to you from Austria, in the precious name of our Lord
<br />
<br />this will be a short prayer request about an exciting up-coming ministry opportunity for Leanne ... she's just written her sister to ask her to pray, and I asked if we could send it out to all of you for your prayer support -- this is part of what she said:
<br />
<br />I just finished writing a teaching outline for a church in Poland. I will travel from 22.-26.April to speak at a women's conference on what God does with pain and woundedness. It is material arising out of one of the women's ministries I help lead, but I am redirecting it to the present day/ tense, just to give people an overview of how the Lord works and what the Bible says on the subject. I am hoping that God will work in their hearts on these issues, and that He who begins a good work in them will be faithful to complete it! Please pray for God to make a way for these women, to prepare them for their longer-term love 'n' care, to keep in-check that which cannot be dealt with in one weekend, for a good working relationship with the pastor's wife who invited me to speak, and that all the logistics/ details will fall into place in a manner that will be pleasing to the Lord.
<br />
<br />thanks for laboring with us in this work

View File

@@ -0,0 +1,19 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Disciple the Nations :: Carter's Ministry Moments</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="background-color: #CCCCCC; border-style: solid; border-width: 5px; border-color: #FFFFFF; margin: 0px; padding: 10px;">
<div align="left">
<b style="text-decoration: underline">Carter's Ministry Moments from 18.Jan.04</b>
<br /> <br />
welcome to a new year partners, and thanks for your faithfulness in praying during 2003! without your prayers, only God knows what might have happened to this ministry and our family -- but we rejoice with you that He has allowed us to be very fruitful for His Kingdom one more year
<br />
<br />this year saw us go through several "once-in-a-lifetime" type of transitions, e.g. -- adopting David, finishing well with IT after 15-20 years of service, starting an exciting new ministry, watching the Lord provide a new home and ministry center here in Austria ... whew, I'm getting exhausted just typing out these top 5 !! but God has equipped, empowered, and provided for our every need -- for which we are very thankful to our Father ... and to you for praying us through
<br />
<br />tomorrow I leave on a 4-day trip for the "Hope for Europe" working group, and would appreciate your prayers for effective ministry and planning time
<br />
<br />last week-end Leanne helped kick-off the first few sessions for a new women's group she is organizing for "Hope for the Wounded" -- it was a tremendous success, and she's looking forward to the next 12 weeks with these women ... pray that the Lord would continue to move and work in their midst

View File

@@ -0,0 +1,19 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Disciple the Nations :: Carter's Ministry Moments</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="background-color: #CCCCCC; border-style: solid; border-width: 5px; border-color: #FFFFFF; margin: 0px; padding: 10px;">
<div align="left">
<b style="text-decoration: underline">Carter's Ministry Moments from 19.11.03</b>
<br /> <br />
warmest greetings from Austria, to all our prayer partners, in the name of our Lord & Saviour !
<br />
<br />so much has happened since we last wrote, and many miles (kilometers) under our belts since then
<br />
<br />15.-19.Oct
<br />European Evangelical Alliance + Hope for Europe Round Table meetings -- these were busy days in Budapest, with many relationships strengthened and some new ones established -- on the last day, I helped lead the plenary session in an hour of prayer
<br />

View File

@@ -0,0 +1,19 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Disciple the Nations :: Carter's Ministry Moments</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="background-color: #CCCCCC; border-style: solid; border-width: 5px; border-color: #FFFFFF; margin: 0px; padding: 10px;">
<div align="left">
<b style="text-decoration: underline">Carter's Ministry Moments from 9.Feb.04</b>
<br /> <br />
dear ones, this will be a short note to you all, with a number of strategic ministry events for you to pray for:
<br />
<br />Tues, 10.Feb
<br />a.m. meeting for our city reaching ministry team [Pray Vienna]
<br />
<br />p.m. meet with our local pastor to encourage him
<br />

View File

@@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8"?>
<albums>
<album id="1">
<name>Carter Family</name>
<imagefolder>carter_family</imagefolder>
<subalbumof>0</subalbumof>
<subalbums>
<subalbum>2</subalbum>
<subalbum>3</subalbum>
<subalbum>4</subalbum>
<subalbum>5</subalbum>
<subalbum>6</subalbum>
<subalbum>7</subalbum>
</subalbums>
</album>
<album id="2">
<name>12-03 Prayer Letter</name>
<imagefolder>12-03_prayer_letter</imagefolder>
<subalbumof>1</subalbumof>
<subalbums/>
</album>
<album id="3">
<name>2003</name>
<imagefolder>2003</imagefolder>
<subalbumof>1</subalbumof>
<subalbums/>
</album>
<album id="4">
<name>2004</name>
<imagefolder>2004</imagefolder>
<subalbumof>1</subalbumof>
<subalbums/>
</album>
<album id="5">
<name>2005</name>
<imagefolder>2005</imagefolder>
<subalbumof>1</subalbumof>
<subalbums/>
</album>
<album id="6">
<name>3-04 Prayer Letter</name>
<imagefolder>3-04_prayer_letter</imagefolder>
<subalbumof>1</subalbumof>
<subalbums/>
</album>
<album id="7">
<name>Friends and Neighbors</name>
<imagefolder>friends_and_neighbors</imagefolder>
<subalbumof>1</subalbumof>
<subalbums/>
</album>
<album id="8">
<name>DtN Family</name>
<imagefolder>dtn_family</imagefolder>
<subalbumof>0</subalbumof>
<subalbums/>
</album>
<album id="9">
<name>Leanne: Women's Ministry</name>
<imagefolder>leanne</imagefolder>
<subalbumof>0</subalbumof>
<subalbums>
<subalbum>10</subalbum>
<subalbum>11</subalbum>
<subalbum>12</subalbum>
</subalbums>
</album>
<album id="10">
<name>Other Ministry</name>
<imagefolder>other_ministry</imagefolder>
<subalbumof>9</subalbumof>
<subalbums/>
</album>
<album id="11">
<name>Teaching English</name>
<imagefolder>teaching_english</imagefolder>
<subalbumof>9</subalbumof>
<subalbums/>
</album>
<album id="12">
<name>Women's Ministry</name>
<imagefolder>womens_ministry</imagefolder>
<subalbumof>9</subalbumof>
<subalbums/>
</album>
<album id="13">
<name>Mentoring</name>
<imagefolder>mentoring</imagefolder>
<subalbumof>0</subalbumof>
<subalbums/>
</album>
<album id="14">
<name>Prayer Summits</name>
<imagefolder>prayer_summits</imagefolder>
<subalbumof>0</subalbumof>
<subalbums/>
</album>
<album id="15">
<name>Teaching</name>
<imagefolder>teaching</imagefolder>
<subalbumof>0</subalbumof>
<subalbums>
<subalbum>16</subalbum>
<subalbum>17</subalbum>
<subalbum>18</subalbum>
<subalbum>19</subalbum>
</subalbums>
</album>
<album id="16">
<name>Austria</name>
<imagefolder>austria</imagefolder>
<subalbumof>15</subalbumof>
<subalbums/>
</album>
<album id="17">
<name>Czech Republic</name>
<imagefolder>czech_rep</imagefolder>
<subalbumof>15</subalbumof>
<subalbums/>
</album>
<album id="18">
<name>Europe-wide</name>
<imagefolder>europe_wide</imagefolder>
<subalbumof>15</subalbumof>
<subalbums/>
</album>
<album id="19">
<name>Poland</name>
<imagefolder>poland</imagefolder>
<subalbumof>15</subalbumof>
<subalbums/>
</album>
<album id="20">
<name>Tribuswinkel, Austria DtN Ministry Center</name>
<imagefolder>tribuswinkel</imagefolder>
<subalbumof>0</subalbumof>
<subalbums/>
</album>
</albums>

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 828 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Some files were not shown because too many files have changed in this diff Show More