Beispiel #1
1
function dev_check_dupes($field, $value = '', $table, $message = '', $redirect = '')
{
    $href = dev_href($redirect);
    if ($message == '') {
        $message = "Sorry, but an entry already exists for field `{$field}` having value '{$value}'. Please try again with a new value";
    }
    $rows = new DevModel($table);
    $rows->clear();
    if ($value != '') {
        $rows->setCondition($field, '=', $value);
        if (count($rows->getRecordSet()) > 0) {
            if ($redirect != '') {
                dev_redirect($href, array('fld' => $field, 'msg' => $message));
            } else {
                return false;
            }
        }
    }
    return true;
}
Beispiel #2
0
 public function queryLog($file, $href = '', $ip = '', $limit = '', $interval = '')
 {
     $line = dev_read_log_r($file, "\t");
     if (is_array($line)) {
         $line = '';
         $href = dev_href($href);
         $ip = dev_is_null($ip) ? $this->remote() : $ip;
         $quit = false;
         while (list($a, $b) = $line || $quit) {
             if ($b[0] == $ip && $b[1] == $href) {
                 Boolean::opposite(&$quit);
             }
         }
         if ($b[3] >= $limit && dev_time_difference($b[2], $timestamp, 'minutes') <= $interval) {
             dev_ip_deny($ip);
         }
     } else {
         $status = $line;
     }
     return $status;
 }
function dev_base_href($href = '')
{
    $href = dev_href($href, false);
    $output = '<base href="' . $href . '">';
    $output .= "\n";
    return $output;
}
Beispiel #4
0
function dev_check_ip_log($file, $href = '', $ip = '', $limit = '', $interval = '')
{
    $line = dev_read_log_r($file, "\t");
    if (is_array($line)) {
        $line = '';
        $href = dev_href($href);
        $ip = dev_is_null($ip) ? dev_get_remote_ip() : $ip;
        $quit = false;
        while (list($a, $b) = $line || $quit) {
            if ($b[0] == $ip && $b[1] == $href) {
                dev_toggle_bool($quit);
            }
        }
        if ($b[3] >= $limit && dev_time_difference($b[2], $timestamp, 'minutes') <= $interval) {
            dev_ip_deny($ip);
        }
    } else {
        $status = $line;
    }
    return $status;
}
Beispiel #5
0
function dev_draw_form($action = '', $name = '', $method = '', $validate = true, $properties = '', $image_path = 'images/', $css_path = 'css/rte.css')
{
    $output = '';
    $action = dev_href($action);
    if (dev_is_null($method)) {
        $method = 'post';
    }
    $output .= '<form enctype="multipart/form-data" method="' . $method . '" onsubmit="return submitForm();"' . ($name != '' ? 'name="' . $name . '"' : '') . ' ' . ($action != '' ? 'action="' . $action . '"' : '') . ' ' . $properties . '>';
    $output .= "\r";
    /*
    $output .= '
    <script language="JavaScript" type="text/javascript">
    	<!--
    	function submitForm() {
    		//make sure hidden and iframe values are in sync before submitting form
    		//to sync only 1 rte, use updateRTE(rte)
    		//to sync all rtes, use updateRTEs
    		//updateRTE(\'rte1\');
    		updateRTEs();
    		
    		//change the following line to true to submit form
    		return true;
    	}
    	
    	//Usage: initRTE(imagesPath, includesPath, cssFile, genXHTML)
    	initRTE("' . $image_path . '", "", "", true);
    	//-->
    </script>
    <style type="text/css">
        @import url("'.$css_path.'");
        .rteImage {margin: 0px;}
    </style>
    ';
    */
    if ($validate) {
    }
    return $output;
}
function dev_list_dir($href = '', $type = '', $dir = '', $query_r = '', $show_table = true)
{
    $output = '';
    $href = dev_href($href, false);
    if ($dir == '') {
        $dir = getcwd() . '/';
    }
    $pattern = '';
    if (is_array($type)) {
        $pattern = "/\\" . implode('$|\\', $type) . "\$/i";
        $type = 'custom';
    }
    switch ($type) {
        //choose what type of documents we will be opening
        case 'template':
            $extensions = "/\\.emc\$/";
            break;
        case 'image':
            $extensions = "/\\.gif\$|\\.jpeg\$|\\.tif\$|\\.jpg\$|\\.tif\$|\\.png\$|\\.bmp\$/i";
            break;
        case 'document':
            $extensions = "/\\.pdf\$|\\.doc\$|\\.txt\$/i";
            break;
        default:
        case 'file':
            $extensions = '//';
            break;
        case 'web':
            $extensions = "/\\..\$|\\.htm\$|\\.html\$|\\.pl\$|\\.txt\$/i";
            break;
        case 'custom':
            $extensions = $pattern;
            break;
    }
    //'scandir()' function for PHP 5 (not compatible with PHP4)
    //$files = scandir($dir);
    //PHP 4 Alternative to 'scandir()'
    $dh = opendir($dir);
    $files = array();
    while (($filename = readdir($dh)) !== false) {
        if (preg_match($extensions, $filename)) {
            $filesize = filesize($dir . $filename);
            $files[] = array('f' => $filename, 'filename' => $filename, 'open' => '<a href="?dir=' . $dir . '&file=' . $filename . '&action=open">open</a>', 'edit' => '<a href="?dir=' . $dir . '&file=' . $filename . '&action=edit">edit</a>', 'delete' => '<a href="?dir=' . $dir . '&file=' . $filename . '&action=delete">delete</a>', 'filesize' => $filesize);
            //'open' => dev_link_file($filename, $dir)
        }
    }
    sort($files);
    if ($show_table) {
        $output .= dev_content_box($files, '', $href, $query_r, '#c0c0c0', '', 1, 1, $dir, $dir);
    } else {
        $output = $files;
    }
    closedir($dh);
    return $output;
}
Beispiel #7
0
function dev_email_form($href = '', $to = '', $additional_fields = '')
{
    $href = dev_href($href);
    $additional_fields = dev_value_to_array($additional_fields);
    $output = '';
    $output .= dev_draw_form() . dev_draw_form_field($to == '' ? 'text' : 'hidden', 'rcpt', 'To', '') . dev_draw_form_field('text', 'subject', 'Subject', '');
    foreach ($additional_fields as $a => $b) {
        $output .= dev_draw_form_field('text', $a, $b, '');
    }
    $output .= dev_draw_form_field('textarea', 'message', 'Message', '') . dev_draw_form_field('submit', 'submit', 'Send', 'Send') . dev_draw_form_field('reset', 'reset', 'Reset', 'Reset') . dev_close_form();
    return $output;
}
    function drawControl()
    {
        //Author: Devon .M. Scott
        //Database and file management vars.
        //$action = (isset($_POST['action']) && $_POST['action'] != '') ? $_POST['action'] : $_GET['action'];
        $view = isset($_POST['view']) && $_POST['view'] != '' ? $_POST['view'] : (isset($_GET['view']) && $_GET['view'] != '' ? $_GET['view'] : (isset($_COOKIE['view']) && $_COOKIE['view'] != '' ? $_COOKIE['view'] : 'select'));
        $file = isset($_POST['file']) && $_POST['file'] != '' ? $_POST['file'] : $_GET['file'];
        $dir = isset($_POST['dir']) && $_POST['dir'] != '' ? $_POST['dir'] : $_GET['dir'];
        $action = isset($_POST['action']) && $_POST['action'] != '' ? $_POST['action'] : $_GET['action'];
        $mode = isset($_POST['mode']) && $_POST['mode'] != '' ? $_POST['mode'] : $_GET['mode'];
        $options_on = $this->getOptionsOn();
        $href = dev_href($this->getHref($href));
        //$href = 'index.php';
        $output = '';
        $status = '';
        if (count($this->getOptions()) <= 0) {
            $option_list = new DevObject(DEV_OPTIONS);
            $option_list->clearMembers();
            $option_list->setCondition('option_enable', '=', '1');
            $option_list->setCondition('option_group', '=', $this->getTables());
            $options_set = array();
            foreach ($option_list->createMemberArray() as $a) {
                $options_set[] = $a['option_name'];
            }
        } else {
            $options_set = $this->getOptions();
        }
        if (!in_array($action, $options_set) && $options_on === true) {
            if ($action != '') {
                $output .= '<b>You do not have permission to take this action.</b><br /><br />';
            }
            $action = 'list';
        }
        $option = array();
        $image_dir = $this->getWSPath() . $this->getImageDir();
        $image_upload_dir = $this->getFSPath() . $this->getImageDir();
        $file_dir = $this->getWSPath() . $this->getFileDir();
        $file_upload_dir = $this->getFSPath() . $this->getFileDir();
        $query = array();
        //$filedir = 'filedir/';
        if ($dir != $file_upload_dir && $dir != '') {
            $query['d'] = $dir;
            $file_upload_dir = $dir;
        }
        $object = $this->getControlObject(0);
        $options = array();
        if ($this->getLogo() != '') {
            $output .= dev_print_image($this->getLogo());
        }
        if ($this->getTitle() != '') {
            $output .= "<h1>" . $this->getTitle() . "</h1>";
        }
        //$object->toggleActiveFieldsOn(true);
        $object->clearMembers();
        $object->setActiveFields($this->getFieldHeaders());
        $entry_id_var = $object->getPrimaryKey();
        ${$entry_id_var} = isset($_POST[$entry_id_var]) && $_POST[$entry_id_var] != '' ? $_POST[$entry_id_var] : $_GET[$entry_id_var];
        //$files = new DevObject('files');
        //$files->clearMembers();
        if ($action == 'edit' || $action == 'delete' || $action == 'manageimages' || $action == 'changeimages' || $action == 'upload' || $action == 'view' || $action == 'default') {
            //$object->loadFreshMembers();
            $object->clearMembers();
            $object->loadGetVars();
            $object->loadPostVars();
            if ($action == 'default' || $action == 'view') {
                $object->loadArrayVars($this->getFieldDefaults());
            }
            $object->loadMembers();
            foreach ($object->getMemberArray() as $a => $b) {
                global ${$a};
                ${$a} = $b;
            }
            //echo $object->getQuery();
        } elseif ($action == 'deletefile') {
            $files->loadFreshMembers();
            foreach ($files->getMemberArray() as $a => $b) {
                ${$a} = $b;
            }
        }
        $delete_form = '
	Really delete entry \'' . ${$entry_id_var} . '\' From the database? (Deletion is NOT undoable).<br />' . dev_draw_form_field('hidden', $entry_id_var, '', ${$entry_id_var}) . '<a href="' . $href . '?action=edit&' . $entry_id_var . '=' . ${$entry_id_var} . '">No, return to this entry</a><br /><br />' . '<input type="submit" value="Yes, Delete Forever" /><br />';
        //$options[] = '<a href="' . $href . '?action=edit&' . $entry_id_var . '=' . $$entry_id_var . '">No, return to this entry</a>';
        /*
        $delete_file_form = '
        Really delete file \'' . $files_document . '\'? (Deletion is NOT undoable).<br />' .
        dev_draw_form_field('hidden', $entry_id_var, '', $$entry_id_var) .
        dev_draw_form_field('hidden', 'files_id', '', $files_id) .
        '<a href="' . $href . '?action=managefiles&' . $entry_id_var . '=' . $$entry_id_var . '">No, return to this entry\'s files</a><br /><br />' . 
        '<input type="submit" value="Yes, Delete Forever" /><br />';
        */
        $delete_file_form .= "Really delete file '{$file}'? (Deletion is <b>NOT</b> undoable).<br />\n" . '<a href="' . $href . '?dir=' . $dir . '&file=' . $file . '&action=removefile">Yes, delete forever.</a><br /><br />' . '<a href="' . $href . '?dir=' . $dir . '&action=listfiles">Back to List</a><br /><br />';
        //$options[] = '<a href="' . $href . '?action=managefiles&' . $entry_id_var . '=' . $$entry_id_var . '">No, return to this entry\'s files</a>';
        $static_fields_r = array();
        foreach ($object->getFullFieldArray() as $a => $b) {
            $static_fields_r[$a] = 'static';
        }
        //$view_form = $this->drawManageForm($object, 'View Details', $static_fields_r, 'Edit', 'Reset');
        $view_form = dev_detail_box($object->getFullFieldArray());
        $edit_form = $this->drawManageForm($object, 'Manage Entry', $this->getFieldTypes(), 'Submit', 'Clear', $action == 'edit' || $action == 'new' || $action == 'post' ? true : false);
        $mail_form = $this->drawManageForm($object, 'Send Message', $this->getFieldTypes(), 'Send', 'Clear');
        //$options[] = '<a href="' . $href . '?action=new">Create New</a>';
        //$options[] = '<a href="' . $href . '?action=list">Back to List</a>';
        /*
        $upload_form = '<a href="' . $href . '?action=edit&' . $entry_id_var . '=' . $_GET[$entry_id_var] . '">Return to this entry</a><br /><br />' . 
        '<a href="' . $href . '?action=managefiles&' . $entry_id_var . '=' . $_GET[$entry_id_var] . '">Manage existing uploaded files</a><br /><br />' . 
        	'Upload files to associate to your entry<br />' . 
        	dev_draw_form_field('hidden', $entry_id_var, '', $_GET[$entry_id_var]) .
        	dev_draw_form_field('hidden', 'MAX_FILE_SIZE', '', '1024000000') .
        	dev_draw_form_field('text', 'project_program_title', 'Programs Title', $project_programs_title) .
        	dev_draw_form_field('file', 'program', 'Programs', $programs) .
        	dev_draw_form_field('text', 'project_minutes_title', 'Minutes Title', $project_minutes_title) .
        	dev_draw_form_field('file', 'minutes', 'Minutes', $minutes) .
        	dev_draw_form_field('text', 'project_notices_title', 'Notices Title', $project_notices_title) .
        	dev_draw_form_field('file', 'notices', 'Notices', $notices) .
        	dev_draw_form_field('text', 'project_images_title', 'Images Title', $project_images_title) .
        	dev_draw_form_field('file', 'images', 'Images', $images) .
        	dev_draw_form_field('text', 'project_misc_title', 'Miscellaneous Title', $project_misc_title) .
        	dev_draw_form_field('textarea', 'project_misc', 'Miscellaneous', $project_misc) .
        	'<input type="submit" value="Upload" />';
        */
        $upload_form = dev_draw_form_field('hidden', 'dir', '', $dir) . dev_draw_form_field('file', 'file', 'File') . dev_draw_form_field('submit', 'uploadfiles', 'Upload', 'Upload');
        $edit_file_form = '<a href="' . $href . '?dir=' . $dir . '&file=' . $file . '&action=edit&mode=richtext">Rich Text Mode</a><br /><br />';
        //dev_draw_form_field('hidden', 'action', '', 'savefile') .
        dev_edit_file($dir . $file);
        $view_file_form = dev_draw_form_field('hidden', 'dir', '', $dir) . dev_draw_form_field('static', 'file', 'Filename', $file) . dev_draw_form_field('static', 'data', 'Data', dev_view_file($dir . $file)) . dev_draw_form_field('submit', 'editfile', 'Edit', 'Edit');
        //$options[] = '<a href="' . $href . '?action=edit&' . $entry_id_var . '=' . $_GET[$entry_id_var] . '">Return to this entry</a>';
        //$options[] = '<a href="' . $href . '?action=managefiles&' . $entry_id_var . '=' . $_GET[$entry_id_var] . '">Manage existing uploaded files</a>';
        $output .= dev_draw_form();
        switch ($action) {
            case 'remove':
                if ($_POST[$entry_id_var] != '' && $_POST[$entry_id_var] > 0) {
                    $object->clearMembers();
                    $object->loadPostVars();
                    $status .= $object->deleteObject() ? "Successfully Deleted Entry " : "Deletion Failed";
                    $object->clearMembers();
                }
            default:
            case 'list':
                //$object->setSortOrder('entry_name', 'ASC');
                $action = 'edit';
                $field_names = array_values($this->getFieldHeaders());
                if (is_array($field_names)) {
                    $object->setSortOrder($field_names[1], 'ASC');
                }
                $object->loadPostVars();
                $object->setDistinction($entry_id_var);
                $options['new'] = '<a href="' . $href . '?action=new">' . $this->getIcon('new') . 'Create New</a>';
                $options['search'] = '<a href="' . $href . '?action=search">' . $this->getIcon('search') . 'Search</a>';
                $query_r = array('action' => 'view');
                //$output .= dev_content_box($object->createMemberArray(), '', $href, $query_r, '#c0c0c0', '', '1', true, '../forum/');
                //$output .= dev_list_results($object->createMemberArray(), 'begin', 'end', $href, true, 1, $query_r, '', $image_dir, $file_dir, $this->getFieldHeaders());
                $output .= 'View: <a href="' . $href . '?view=icon">icons</a> | <a href="' . $href . '?view=search">list</a> | <a href="' . $href . '?view=select">selection</a><br />';
                $output .= dev_display_box($object->createMemberArray(), $view, $href, $query_r, '#c0c0c0', $this->getFieldHeaders(), '1', true, $image_dir, $file_dir, '', 15);
                break;
            case 'advancedsearch':
                //if ($action == 'advancedsearch') {
                $options['search'] = '<a href="' . $href . '?action=search">' . $this->getIcon('search') . 'Basic Search</a>';
                $options['new'] = '<a href="' . $href . '?action=new">' . $this->getIcon('new') . 'Create New</a>';
                $options['list'] = '<a href="' . $href . '?action=list">' . $this->getIcon('list') . 'Back to List</a>';
                //$output .= dev_draw_form() .
                $action = 'list';
                $output .= dev_draw_form_field('hidden', 'view', '', 'search') . $object->drawForm($field_types) . dev_draw_form_field('submit', 'submit', 'Finding...', 'Find');
                //dev_close_form();
                //}
                break;
            case 'search':
                //if ($action == 'search') {
                $options['advancedsearch'] = '<a href="' . $href . '?action=advancedsearch">' . $this->getIcon('advancedsearch') . 'Advanced Search</a>';
                $options['new'] = '<a href="' . $href . '?action=new">' . $this->getIcon('new') . 'Create New</a>';
                $options['list'] = '<a href="' . $href . '?action=list">' . $this->getIcon('list') . 'Back to List</a>';
                $field_names = array_values($this->getFieldHeaders());
                //$object->setDistinction($entry_id_var);
                //$object->setSortOrder('entry_location', 'ASC');
                $action = 'list';
                $output .= '<table>' . dev_draw_form_field('hidden', 'view', '', 'search') . $object->formField($field_names[1]) . '</table>' . dev_draw_form_field('submit', 'submit', 'Finding...', 'Find');
                //dev_close_form();
                //}
                break;
                //OBJECT ACTION CASES
            //OBJECT ACTION CASES
            case 'save':
                $action = 'save';
                $object->loadPostVars();
                $success = dev_save_file($file, $view_form, $mode);
                $options['back'] = strpos($success, 'successful') === false ? ' <a class="dev_option" href="javascript:history.back(1)">' . $this->getIcon('back') . 'Go back</a>' : '';
                break;
            case 'cookie':
                $action = 'cookie';
                $object->loadPostVars();
                foreach ($object->getMemberArray() as $a => $b) {
                    $success .= dev_set_cookie($a, $b);
                }
                $options['back'] = !$success ? ' <a class="dev_option" href="javascript:history.back(1)">' . $this->getIcon('back') . 'Go back</a>' : '';
                break;
            case 'session':
                $action = 'save';
                $object->loadPostVars();
                foreach ($object->getMemberArray() as $a => $b) {
                    $success .= dev_set_session($a, $b);
                }
                $options['back'] = !$success ? ' <a class="dev_option" href="javascript:history.back(1)">' . $this->getIcon('back') . 'Go back</a>' : '';
                break;
            case 'sendmail':
                $action = 'semdmail';
                $sucess = dev_send_email($rcpt, $from, $subject, $message, $cc, $bcc, $html, $headers_r, $additional);
                $options['back'] = strpos($success, 'successful') === false ? ' <a class="dev_option" href="javascript:history.back(1)">' . $this->getIcon('back') . 'Go back</a>' : '';
            case 'mail':
                $action = 'sendmail';
                $output .= $mail_form;
                break;
            case 'post':
                $action = 'post';
                $object->loadPostVars();
                foreach ($_FILES as $a => $b) {
                    if ($b['size'] > 0) {
                        $b['name'] = str_replace(' ', '_', $b['name']);
                        $object->{$a} = $b['name'];
                        $status .= dev_upload_file($b, 1, $image_upload_dir);
                    }
                }
                $success .= $object->writeObject();
                $options['back'] = strpos($object->getStatusMessage(), 'Unsuccessful') !== false ? ' <a class="dev_option" href="javascript:history.back(1)">' . $this->getIcon('back') . 'Go back</a>' : '';
            case 'new':
                $options['new'] = '<a href="' . $href . '?action=new">' . $this->getIcon('new') . 'Create New</a>';
                $options['list'] = '<a href="' . $href . '?action=list">' . $this->getIcon('list') . 'Back to List</a>';
                $action = 'post';
                $output .= "<h5>Create New Entry</h5><br />";
                $output .= $edit_form;
                break;
            case 'uploadfiles':
                $options['listfiles'] = '<a href="' . $href . '?action=listfiles&dir=' . $dir . '">' . $this->getIcon('listfiles') . 'Back to List</a>';
                $options['choosefile'] = '<a href="' . $href . '?action=choosefile&dir=' . $dir . '">' . $this->getIcon('choosefile') . 'Upload Another File</a>';
                $output .= dev_upload_file($_FILES['file'], 0, getcwd() . '/' . $dir);
                break;
            case 'removefile':
                $files->loadPostVars();
                //$output .= ($files->deleteObject()) ? "Successfully Deleted Entry<br />" : "Deletion Failed<br />";
                $output .= dev_delete_file($file, true) ? "Successfully Deleted Entry<br />" : "Deletion Failed<br />";
            case 'listfiles':
                //$output .= dev_list_dir('file.php', 'document', $file_upload_dir, $query);
                $options['newfile'] = '<a href="' . $href . '?action=newfile&dir=' . $dir . '">' . $this->getIcon('newfile') . 'Create New File</a>';
                $options['choosefile'] = '<a href="' . $href . '?action=choosefile&dir=' . $dir . '">' . $this->getIcon('choosefile') . 'Upload New File</a>';
                $output .= dev_list_dir('file.php', '', $file_upload_dir, $query);
            case 'choosefile':
                $options['listfiles'] = '<a href="' . $href . '?action=listfiles&dir=' . $dir . '">' . $this->getIcon('listfiles') . 'Back to List</a>';
                $output .= $upload_form;
                break;
            case 'savefile':
                $options['listfiles'] = '<a href="' . $href . '?action=listfiles&dir=' . $dir . '">' . $this->getIcon('listfiles') . 'Back to List</a>';
                $output .= dev_save_file($file, $data);
            case 'openfile':
                $options['listfiles'] = '<a href="' . $href . '?action=listfiles&dir=' . $dir . '">' . $this->getIcon('listfiles') . 'Back to List</a>';
                $options['editfile'] = '<a href="' . $href . '?action=editfile&dir=' . $dir . '&file=' . $file . '">' . $this->getIcon('editfile') . 'Back to List</a>';
                $output .= $view_file_form;
                break;
            case 'newfile':
            case 'editfile':
                $output .= $edit_file_form;
                break;
            case 'upload':
                //Case following special "files" case
                //$object_files->loadPostVars();
                //$files = new DevObject('files');
                foreach ($_FILES as $a => $b) {
                    if ($b['size'] > 0) {
                        $files->clearMembers();
                        $files->loadPostVars();
                        $status .= dev_upload_file($b, 1, $image_upload_dir);
                        $object->writeObject();
                    }
                }
            case 'default':
            case 'view':
                $action = 'edit';
                //$output .= "<h5>View Existing Entry</h5><br />";
                $options['list'] = '<a href="' . $href . '?action=list">' . $this->getIcon('list') . 'Back to List</a>';
                $options['edit'] = '<a href="' . $href . '?action=edit&' . $entry_id_var . '=' . ${$entry_id_var} . '">' . $this->getIcon('edit') . 'Edit</a>';
                $options['delete'] = '<a href="' . $href . '?action=delete&' . $entry_id_var . '=' . ${$entry_id_var} . '">' . $this->getIcon('delete') . 'Delete this entry</a>';
                $options['files'] = '<a href="' . $href . '?action=files&' . $entry_id_var . '=' . ${$entry_id_var} . '">' . $this->getIcon('files') . 'Upload files for this entry</a>';
                $options['manageimages'] = '<a href="' . $href . '?action=manageimages&' . $entry_id_var . '=' . ${$entry_id_var} . '">' . $this->getIcon('manageimages') . 'Manage Images</a>';
                $output .= $view_form;
                break;
            case 'edit':
                $action = 'post';
                $output .= "<h5>Edit Existing Entry</h5><br />";
                $options['list'] = '<a href="' . $href . '?action=list">' . $this->getIcon('list') . 'Back to List</a>';
                $options['delete'] = '<a href="' . $href . '?action=delete&' . $entry_id_var . '=' . ${$entry_id_var} . '">' . $this->getIcon('delete') . 'Delete this entry</a>';
                $options['files'] = '<a href="' . $href . '?action=files&' . $entry_id_var . '=' . ${$entry_id_var} . '">' . $this->getIcon('files') . 'Upload files for this entry</a>';
                $options['manageimages'] = '<a href="' . $href . '?action=manageimages&' . $entry_id_var . '=' . ${$entry_id_var} . '">' . $this->getIcon('manageimages') . 'Manage Images</a>';
                //$output .= $object->formField($entry_id_var, '', '', 'hidden');
                $output .= $edit_form;
                break;
            case 'delete':
                $action = 'remove';
                $options['edit'] = '<a href="' . $href . '?action=edit&' . $entry_id_var . '=' . ${$entry_id_var} . '">' . $this->getIcon('edit') . 'No, return to this entry</a>';
                $output .= "<h5>Delete Existing Entry</h5><br />";
                $output .= $delete_form;
                break;
            case 'files':
                //Special case for minutes and programs
                $options['edit'] = '<a href="' . $href . '?action=edit&' . $entry_id_var . '=' . $_GET[$entry_id_var] . '">' . $this->getIcon('edit') . 'Return to this entry</a>';
                $options['managefiles'] = '<a href="' . $href . '?action=managefiles&' . $entry_id_var . '=' . $_GET[$entry_id_var] . '">' . $this->getIcon('managefiles') . 'Manage existing uploaded files</a>';
                $files = new DevObject($tables);
                $files->loadFreshMembers();
                $action = 'upload';
                $output .= $upload_form;
                break;
            case 'managefiles':
                //$object->setSortOrder('entry_name', 'ASC');
                $files->loadGetVars();
                $files->setSortOrder('files_document', 'ASC');
                $files->setCondition('files_id', '>=', '1');
                $options['edit'] = '<a href="' . $href . '?action=edit&' . $entry_id_var . '=' . ($_GET[$entry_id_var] == '' ? $_POST[$entry_id_var] : $_GET[$entry_id_var]) . '">' . $this->getIcon('edit') . 'Return to this entry</a><br />';
                $output .= '<table width="100%" border="1">';
                $output .= '<tr>
			<td>File Name</td>
			<td>File Type</td>
			<td>Delete</td>
		</tr>' . "\n";
                foreach ($files->createMemberArray() as $a) {
                    $output .= '<tr>
			<td><a href="' . DOMAIN . SITE_ROOT . 'files/' . $a['files_document'] . '" target="_blank">' . $a['files_document'] . '</a></td>
			<td>' . $a['files_type'] . '</td>
			<td><a href="' . $href . '?action=deletefile&files_id=' . $a['files_id'] . '">Remove</a></td>
		</tr>' . "\n";
                }
                $output .= '</table>';
                $output .= dev_list_dir();
                break;
            case 'deletefile':
                $options['managefiles'] = '<a href="' . $href . '?action=managefiles&' . $entry_id_var . '=' . ${$entry_id_var} . '">' . $this->getIcon('managefiles') . 'No, return to this entry\'s files</a>';
                $action = 'removefile';
                $output .= "<h5>Delete Existing Document</h5><br />";
                $output .= $delete_file_form;
                break;
            case 'changeimages':
                $old_image = new DevObject($table);
                $old_image->clearMembers();
                $old_image->{$entry_id_var} = $_POST[$entry_id_var];
                $old_image->loadMembers();
                foreach ($old_image->getMemberArray() as $a => $b) {
                    if ($_POST[$a] == 'NULL') {
                        $old_image->{$a} = '';
                    }
                }
                $success .= $old_image->writeObject(1);
            case 'manageimages':
                //$object->loadFreshMembers();
                $action = 'changeimages';
                $options['new'] = '<a href="' . $href . '?action=new">' . $this->getIcon('new') . 'Create New</a>';
                $options['edit'] = '<a href="' . $href . '?action=edit&' . $entry_id_var . '=' . ${$entry_id_var} . '">' . $this->getIcon('edit') . 'Return to this entry</a>';
                $output .= '<span style="font-size: 11px; color: #ff0000; font-family: arial, helvitica, sans-serif;">
	Select the checkbox to remove the image from this entry.
	</span><br />' . dev_draw_form_field('hidden', $entry_id_var, '', ${$entry_id_var}) . dev_draw_form_field('checkbox', 'entry_image', 'Main Image: ' . $entry_image, '') . dev_draw_form_field('checkbox', 'entry_image_1', 'Additional Image 1: ' . $entry_image_1, 'NULL') . dev_draw_form_field('checkbox', 'entry_image_2', 'Additional Image 2: ' . $entry_image_2, 'NULL') . dev_draw_form_field('checkbox', 'entry_image_3', 'Additional Image 3: ' . $entry_image_3, 'NULL') . dev_draw_form_field('checkbox', 'entry_image_4', 'Additional Image 4: ' . $entry_image_4, 'NULL') . dev_draw_form_field('checkbox', 'entry_image_5', 'Additional Image 5: ' . $entry_image_5, 'NULL') . dev_draw_form_field('checkbox', 'entry_image_6', 'Additional Image 6: ' . $entry_image_6, 'NULL') . dev_draw_form_field('checkbox', 'entry_image_7', 'Additional Image 7: ' . $entry_image_7, 'NULL') . dev_draw_form_field('checkbox', 'entry_image_8', 'Additional Image 8: ' . $entry_image_8, 'NULL') . '<input type="submit" value="Remove" />';
                break;
        }
        $output .= dev_draw_form_field('hidden', 'action', '', $action);
        $output .= dev_close_form();
        $status .= $object->getStatusMessage() != '' ? '<span class="dev_status">' . $object->getStatusMessage() . '</span><br />' : '';
        $option_types = array_keys($options);
        if ($options_on === true) {
            foreach ($option_types as $a) {
                if (!in_array($a, $options_set)) {
                    unset($options[$a]);
                }
            }
        }
        $options_str = implode(' ', $options);
        $this->setStatus($status);
        $this->setTasks($options_str);
        $this->setOutput($output);
        $output = "{$status}{$options_str}<br />{$output}";
        //echo $object->getQuery();
        return $output;
    }