Example #1
1
 |  Publisher       :(c)2016 Xaver Bauer                                          |
 |  Contact         :xaver65@gmail.com                                            |
 |  Desc            :PHP Classes to Control Sonos PLAY:3                          |
 |  port            :1400                                                         |
 |  base            :http://192.168.112.54:1400                                   |
 |  scpdurl         :/xml/device_description.xml                                  |
 |  modelName       :Sonos PLAY:3                                                 |
 |  deviceType      :urn:schemas-upnp-org:device:ZonePlayer:1                     |
 |  friendlyName    :192.168.112.54 - Sonos PLAY:3                                |
 |  manufacturer    :Sonos, Inc.                                                  |
 |  manufacturerURL :http://www.sonos.com                                         |
 |  modelNumber     :S3                                                           |
 |  modelURL        :http://www.sonos.com/products/zoneplayers/S3                 |
 |  UDN             :uuid:RINCON_B8E9373DABCE01400                                |
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
if (!DEFINED('RPC2SONOS_STATE_STOP')) {
    DEFINE('RPC2SONOS_STATE_STOP', 0);
    DEFINE('RPC2SONOS_STATE_PREV', 1);
    DEFINE('RPC2SONOS_STATE_PLAY', 2);
    DEFINE('RPC2SONOS_STATE_PAUSE', 3);
    DEFINE('RPC2SONOS_STATE_NEXT', 4);
    DEFINE('RPC2SONOS_STATE_TRANS', 5);
    DEFINE('RPC2SONOS_STATE_ERROR', 6);
}
class rpc2sonos extends RpcDevice
{
    protected $_boRepeat = false;
    protected $_boShuffle = false;
    protected $_boAll = false;
    // Name:string
    protected function GetServiceConnData($name)
Example #2
0
 public function __construct()
 {
     if (!DEFINED("EXT")) {
         define("EXT", ".php");
     }
     ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . APPPATH . 'third_party/Twig');
     require_once (string) "Autoloader" . EXT;
     // Fire off the Twig register bootstrap function...
     Twig_Autoloader::register();
     // Get CI instance
     $this->CI = get_instance();
     // Load the Twig config file
     $this->CI->config->load('twig');
     // Add in default Twig locations
     $this->add_template_location($this->CI->config->item('twig.locations'));
     // Get locations
     $this->_set_template_locations();
     $this->_twig_loader = new Twig_Loader_Filesystem($this->_template_directories);
     // Get environment config settings
     $environment = $this->CI->config->item("twig.environment");
     // Set our cache path or status
     $environment["cache"] = $environment["cache_status"] ? $environment["cache_location"] : FALSE;
     $twig_environment = array("cache" => $environment["cache"], "debug" => $environment["debug_mode"], "auto_reload" => $environment["auto_reload"], "autoescape" => $environment["autoescape"], "optimizations" => $environment["optimizations"]);
     $this->_twig = new Twig_Environment($this->_twig_loader, $twig_environment);
     if ($this->CI->config->item("twig.functions")) {
         foreach ($this->CI->config->item("twig.functions") as $function) {
             $this->register_function($function);
         }
     }
     if ($this->CI->config->item("twig.filters")) {
         foreach ($this->CI->config->item("twig.filters") as $filter) {
             $this->register_filter($filter);
         }
     }
 }
 public function GoogleAnalyticsInline()
 {
     if (DEFINED('GaTrackingCode')) {
         $gacode = @file_get_contents(dirname(dirname(__FILE__)) . '/javascript/gatracker.js') . $this->GoogleCode();
         $gacode = $this->Compress($gacode);
         Requirements::customScript($gacode);
     }
 }
Example #4
0
 public function __construct(Request $request)
 {
     $segments = $request->segments();
     $locales = LaravelLocalization::getSupportedLanguagesKeys();
     $non_locale_route = '';
     $lang = App::getLocale();
     foreach ($segments as $segment) {
         if (!in_array($segment, $locales)) {
             $non_locale_route .= '/' . $segment;
         }
     }
     DEFINED('NON_LOCALE_ROUTE') or DEFINE('NON_LOCALE_ROUTE', trim($non_locale_route, '/'));
     DEFINED('LANG') or DEFINE('LANG', $lang);
 }
Example #5
0
 static function dechiffre($texte, $cle = '')
 {
     // Récupération de la clé si elle n'est pas passée en paramètre.
     if (!$cle) {
         // On la récupère depuis une constante si possible.
         if (DEFINED("CLEAPPLI")) {
             $cle = CLEAPPLI;
         } else {
             $cle = "leJambonCtresbon";
         }
     }
     // A améliorer...........
     $temp = base64_decode($texte);
     return $temp;
 }
Example #6
0
 static function launch_model()
 {
     if (DEFINED(MODULES_APP)) {
         $inc = MODULES_PATH . SL . MODULES_APP . SL . 'models' . SL . ucfirst(CONTROLLER_APP) . 'Model.php';
         if (file_exists($inc) && is_readable($inc)) {
             /** @noinspection PhpIncludeInspection */
             include $inc;
         }
     } else {
         $inc = MODEL_PATH . SL . ucfirst(CONTROLLER_APP) . 'Model.php';
         if (file_exists($inc) && is_readable($inc)) {
             /** @noinspection PhpIncludeInspection */
             include $inc;
         }
     }
 }
Example #7
0
 static function launch_view($layout = null)
 {
     global $customLayout;
     if (DEFINED('MODULES_APP')) {
         foreach (glob(MODULES_PATH . SL . MODULES_APP . SL . 'viewHelpers' . SL . '*.php') as $file) {
             /** @noinspection PhpIncludeInspection */
             include_once $file;
         }
         if (isset($customLayout)) {
             $path = MODULES_PATH . SL . MODULES_APP . SL . 'view/layouts' . SL . $customLayout . '.php';
             if (file_exists($path) && is_readable($path)) {
                 /** @noinspection PhpIncludeInspection */
                 include_once $path;
             } else {
                 echo 'No Such Layout: ' . $customLayout . '!';
             }
         } else {
             if (file_exists(MODULES_PATH . SL . MODULES_APP . SL . 'views/layouts/' . LAYOUT) && is_readable(MODULES_PATH . SL . MODULES_APP . SL . 'views/layouts/' . LAYOUT)) {
                 /** @noinspection PhpIncludeInspection */
                 include_once MODULES_PATH . SL . MODULES_APP . SL . 'views/layouts/' . LAYOUT;
             } else {
                 echo 'No Such Layout: ' . MODULES_PATH . SL . MODULES_APP . SL . 'view/layouts/' . LAYOUT . '!';
             }
         }
     } else {
         foreach (glob(APP_PATH . SL . 'viewHelpers' . SL . '*.php') as $file) {
             /** @noinspection PhpIncludeInspection */
             include_once $file;
         }
         if (isset($customLayout)) {
             $path = LAYOUT_PATH . SL . $customLayout . '.php';
             if (file_exists($path) && is_readable($path)) {
                 /** @noinspection PhpIncludeInspection */
                 include_once $path;
             } else {
                 echo 'No Such Layout: ' . $customLayout . '!';
             }
         } else {
             if (file_exists(DEF_LAYOUT) && is_readable(DEF_LAYOUT)) {
                 /** @noinspection PhpIncludeInspection */
                 include_once DEF_LAYOUT;
             } else {
                 echo 'No Such Layout: ' . DEF_LAYOUT . '!';
             }
         }
     }
 }
 public function __construct()
 {
     $siteurl = trailingslashit(get_option('siteurl'));
     if (DEFINED('WP_PLUGIN_URL')) {
         $this->plugin_path = WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)) . '/';
     } else {
         if (DEFINED('WP_PLUGIN_DIR')) {
             $this->plugin_path = $siteurl . '/' . WP_PLUGIN_DIR . '/' . basename(dirname(__FILE__)) . '/';
         } else {
             $this->plugin_path = $siteurl . 'wp-content/plugins/' . basename(dirname(__FILE__)) . '/';
         }
     }
     if (is_ssl()) {
         $siteurl = str_replace('http:', 'https:', $siteurl);
         $this->plugin_path = str_replace('http:', 'https:', $this->plugin_path);
     }
     $this->plugin_path .= 'syntaxhighlight/';
 }
 public function __construct(Request $request)
 {
     $segments = $request->segments();
     $locales = LaravelLocalization::getSupportedLanguagesKeys();
     $non_locale_route = '';
     $lang = App::getLocale();
     foreach ($segments as $segment) {
         if (!in_array($segment, $locales)) {
             $non_locale_route .= '/' . $segment;
         }
     }
     DEFINED('NON_LOCALE_ROUTE') or DEFINE('NON_LOCALE_ROUTE', trim($non_locale_route, '/'));
     DEFINED('LANG') or DEFINE('LANG', $lang);
     $categories[1] = ProductCategory::getByBrand(5);
     $categories[2] = ProductCategory::getByBrand(6);
     $categories[3] = ProductCategory::getByBrand(7);
     $this->categories = $categories;
 }
Example #10
0
    define('APPPATH', BASEPATH . $application_folder . '/');
}
/*
|---------------------------------------------------------------
| LOAD THE FRONT CONTROLLER
|---------------------------------------------------------------
|
| And away we go...
|
*/
require "system/security.php";
require_once APPPATH . '/libraries/Smarty.class.php';
require_once APPPATH . '/libraries/system.php';
require APPPATH . "libraries/POT/OTS.php";
require_once BASEPATH . 'codeigniter/CodeIgniter' . EXT;
if (!DEFINED("SYSTEM_STOP")) {
    /* Check the server's compatybility with the engine. */
    if (!is_php($config['engine']['PHPversion'])) {
        show_error("Your server runs verion of PHP older than " . $config['engine']['PHPversion'] . ". Please update in order to use this system. Err code: 140704042010");
    }
    $contents = ob_get_contents();
    ob_end_clean();
    require_once APPPATH . 'config/database.php';
    /* Some basic actions */
    if (empty($_SESSION['logged'])) {
        $_SESSION['logged'] = 0;
    }
    $smarty = new Smarty();
    $smarty->template_dir = "templates/" . $template;
    $smarty->config_dir = ' configs';
    $smarty->cache_dir = 'cache';
Example #11
0
 public function processLogs($logs)
 {
     $app = Yii::app();
     $config = array();
     $ip = $app->request->getUserHostAddress();
     $allowed = false;
     foreach ($this->allowedIPs as $pattern) {
         // if found any char other than [0-9] and dot, treat pattern as a regexp
         if (preg_match('/[^0-9:\\.]/', $pattern)) {
             if (preg_match('/' . $pattern . '/', $ip)) {
                 $allowed = true;
                 break;
             }
         } else {
             if ($pattern === $ip) {
                 $allowed = true;
                 break;
             }
         }
     }
     if (!$allowed) {
         return;
     }
     foreach (explode(',', $this->config) as $value) {
         $value = trim($value);
         $config[$value] = true;
     }
     //Checking for an AJAX Requests
     if (!$app instanceof CWebApplication || $app->getRequest()->getIsAjaxRequest()) {
         return;
     }
     //Checking for an DEBUG mode of running app
     if (isset($config['runInDebug']) && (!DEFINED('YII_DEBUG') || YII_DEBUG == false)) {
         return;
     }
     $items = array();
     $items[] = yiiDebugConfig::getInfo($logs, $config);
     $items[] = yiiDebugMem::getInfo($logs);
     $items[] = yiiDebugTime::getInfo($logs);
     $items[] = yiiDebugDB::getInfo($logs);
     $items[] = yiiDebugTrace::getInfo($logs);
     $panel = new yiiDebugPanel();
     $panel->render($items, $config);
 }
Example #12
0
<?php

if (!DEFINED('haXMS_HERE')) {
    die;
}
if (!isset($_GET['act'])) {
    handle(IDX);
} else {
    handle($_GET['act']);
}
function handle($module)
{
    switch ($module) {
        case "login":
            //{
            $v = Engine::loadmod('login', 'login.class.php', 'Login');
            $v->fetchtemplate('login', 'index.php');
            //Module directory, template filename
            if (isset($_POST["login"])) {
                $username = $_POST["username"];
                $password = $_POST["password"];
                $han = $v->doLogin($username, $password);
                //sanitize and try to login
                if ($han == true) {
                    echo 'Login successful!';
                } else {
                    echo 'Login invalid!';
                }
                //$v->dx($username,$password);
            }
            //}
Example #13
0
 public function processLogs($logs)
 {
     $app = Yii::app();
     $config = array();
     if ($this->allowedIPs && !in_array($app->request->getUserHostAddress(), $this->allowedIPs)) {
         return;
     }
     foreach (explode(',', $this->config) as $value) {
         $value = trim($value);
         $config[$value] = true;
     }
     //Checking for an AJAX Requests
     if (!$app instanceof CWebApplication || $app->getRequest()->getIsAjaxRequest()) {
         return;
     }
     //Checking for an DEBUG mode of running app
     if (isset($config['runInDebug']) && (!DEFINED('YII_DEBUG') || YII_DEBUG == false)) {
         return;
     }
     $items = array();
     $items[] = yiiDebugConfig::getInfo($logs, $config);
     $items[] = yiiDebugMem::getInfo($logs);
     $items[] = yiiDebugTime::getInfo($logs);
     $items[] = yiiDebugDB::getInfo($logs);
     $items[] = yiiDebugTrace::getInfo($logs);
     $panel = new yiiDebugPanel();
     $panel->render($items, $config);
 }
 function convertImage($type)
 {
     /* check the converted image type availability,
        if it is not available, it will be casted to jpeg :) */
     $validtype = $this->validateType($type);
     if ($this->output) {
         /* show the image  */
         switch ($validtype) {
             case 'jpeg':
                 // Added jpe
             // Added jpe
             case 'jpe':
             case 'jpg':
                 header("Content-type: image/jpeg");
                 if ($this->imtype == 'gif' or $this->imtype == 'png') {
                     $image = $this->replaceTransparentWhite($this->im);
                     @imageJPEG($image);
                 } else {
                     @imageJPEG($this->im);
                 }
                 break;
             case 'gif':
                 header("Content-type: image/gif");
                 @imageGIF($this->im);
                 break;
             case 'png':
                 header("Content-type: image/png");
                 @imagePNG($this->im);
                 break;
             case 'wbmp':
                 header("Content-type: image/vnd.wap.wbmp");
                 @imageWBMP($this->im);
                 break;
             case 'swf':
                 header("Content-type: application/x-shockwave-flash");
                 $this->imageSWF($this->im);
                 break;
         }
     } else {
         // Added Support vor different directory
         if (DEFINED('V_TEMP_DIR')) {
             $this->newimname = V_TEMP_DIR . $this->imname . '.' . $validtype;
         } else {
             $this->newimname = $this->imname . '.' . $validtype;
         }
         /* save the image  */
         switch ($validtype) {
             case 'jpeg':
                 // Added jpe
             // Added jpe
             case 'jpe':
             case 'jpg':
                 if ($this->imtype == 'gif' or $this->imtype == 'png') {
                     /* replace transparent with white */
                     $image = $this->replaceTransparentWhite($this->im);
                     @imageJPEG($image, $this->newimname);
                 } else {
                     @imageJPEG($this->im, $this->newimname);
                 }
                 break;
             case 'gif':
                 @imageGIF($this->im, $this->newimname);
                 break;
             case 'png':
                 @imagePNG($this->im, $this->newimname);
                 break;
             case 'wbmp':
                 @imageWBMP($this->im, $this->newimname);
                 break;
             case 'swf':
                 $this->imageSWF($this->im, $this->newimname);
                 break;
         }
     }
 }
Example #15
0
<?php

/**************************************************************************************************
config.php
    This file defines variable constants for use
***************************************************************************************************/
DEFINED('DS') ? null : define('DS', DIRECTORY_SEPARATOR);
DEFINED('ROOT') ? null : define('ROOT', '..');
DEFINED('LIB') ? null : define('LIB', ROOT . DS . 'lib');
DEFINED('VIEW') ? null : define('VIEW', ROOT . DS . 'views');
DEFINED('DB_SERVER') ? null : define('DB_SERVER', '');
DEFINED('DB_USER') ? null : define('DB_USER', '');
DEFINED('DB_PASS') ? null : define('DB_PASS', '');
DEFINED('DB_NAME') ? null : define('DB_NAME', '');
DEFINED('MAILER_SMTP') ? null : define('MAILER_SMTP', '');
DEFINED('MAILER_NAME') ? null : define('MAILER_NAME', '');
DEFINED('MAILER_PW') ? null : define('MAILER_PW', '');
Example #16
0
<?php

/**************************************************************************************************
config.php
    This file contains constant variable definitions used by the other files.
    If constant is already defined, don't do anything.  Else, define it.
***************************************************************************************************/
\DEFINED('DS') ? null : define('DS', DIRECTORY_SEPARATOR);
DEFINED('ROOT') ? null : define('ROOT', '..');
DEFINED('LIB') ? null : define('LIB', ROOT . DS . 'lib');
DEFINED('DB_SERVER') ? null : define('DB_SERVER', '');
DEFINED('DB_USER') ? null : define('DB_USER', '');
DEFINED('DB_PASS') ? null : define('DB_PASS', '');
DEFINED('DB_NAME') ? null : define('DB_NAME', '');
function formbuilder_process_form($form_id, $data = false)
{
    global $wpdb;
    if (!defined('SID')) {
        define('SID', '');
    }
    $formBuilderTextStrings = formbuilder_load_strings();
    $siteurl = get_option('siteurl');
    $relative_path = str_replace(ABSOLUTE_PATH, "/", FORMBUILDER_PLUGIN_PATH);
    //$page_path = $siteurl . $relative_path;
    $page_path = plugin_dir_url(__DIR__);
    // Pull the form data from the db for the selected form ID.
    $sql = "SELECT * FROM " . FORMBUILDER_TABLE_FORMS . " WHERE id='{$form_id}';";
    $results = $wpdb->get_results($sql, ARRAY_A);
    if ($results) {
        $form = $results[0];
    }
    if (!isset($form) or !$form) {
        return "";
    }
    // Pass the form through a filter that converts all fields to proper htmlentities.
    $form = formbuilder_array_htmlentities($form);
    $allFields = array();
    // If no form action is defined, use a blank string.  (indicates standard process)
    if (!isset($form['action'])) {
        $form['action'] = "";
    }
    $module_status = false;
    // Load the Form Action module, if different than the standard.
    if ($form['action'] != "") {
        if (include_once FORMBUILDER_PLUGIN_PATH . "modules/" . $form['action']) {
            $startup_funcname = "formbuilder_startup_" . preg_replace("#\\..+#is", "", $form['action']);
            $processor_funcname = "formbuilder_process_" . preg_replace("#\\..+#is", "", $form['action']);
            if (function_exists("{$startup_funcname}")) {
                $module_status = $startup_funcname($form);
            }
        }
    } else {
        $module_status = true;
    }
    if (!isset($form['action_target'])) {
        $form['action_target'] = "";
    }
    $formID = clean_field_name($form['name']);
    $formCSSID = "formBuilderCSSID{$formID}";
    if (!$form['action_target'] or $form['action_target'] == "") {
        $form['action_target'] = $_SERVER['REQUEST_URI'] . "#{$formCSSID}";
    }
    $session_id = session_id();
    $sessName = session_name();
    if (SID != "" and strpos($form['action_target'], $sessName) === false) {
        if (strpos($form['action_target'], "?") === false) {
            $form['action_target'] .= "?" . htmlspecialchars(SID);
        } else {
            $form['action_target'] .= "&amp;" . htmlspecialchars(SID);
        }
    }
    if ($module_status !== false) {
        // Retrieve the tags for the form and use as additional CSS classes in order to allow forms with specific tags to use alternate stylesheets.
        $formTags = array();
        $sql = "SELECT * FROM " . FORMBUILDER_TABLE_TAGS . " WHERE form_id = '{$form_id}' ORDER BY tag ASC;";
        $results = $wpdb->get_results($sql, ARRAY_A);
        foreach ($results as $r) {
            $formTags[] = preg_replace('/[^a-z0-9_-]/isU', '', $r['tag']);
        }
        $formTags = implode(' ', $formTags);
        $formDisplay = "";
        $post_errors = '';
        $formDisplay = apply_filters('formbuilder_prepend_formDisplay', $formDisplay);
        $formDisplayID = "formBuilder{$formID}";
        $formDisplayID = apply_filters('formbuilder_formDisplayID', $formDisplayID);
        $formDisplay .= "\n<form class='formBuilderForm form-horizontal {$formTags}' id='{$formDisplayID}' " . "action='" . $form['action_target'] . "' method='" . strtolower($form['method']) . "' onsubmit='return fb_disableForm(this);'>" . "<input type='hidden' name='formBuilderForm[FormBuilderID]' value='" . $form_id . "' />";
        $formDisplay = apply_filters('formbuilder_formDisplay_formStart', $formDisplay);
        // Paged form related controls for CSS and Javascript
        $page_id = 1;
        $new_page = false;
        $formDisplay .= "<div id='formbuilder-{$form_id}-page-{$page_id}'>";
        $formDisplay .= '<script type="text/javascript">

function toggleVis(boxid)
{
	if(document.getElementById(boxid).isVisible == "true")
	{
		toggleVisOff(boxid);
	}
	else
	{
		toggleVisOn(boxid);
	}
}

function toggleVisOn(boxid) 
{
		document.getElementById(boxid).setAttribute("class", "formBuilderHelpTextVisible");
		document.getElementById(boxid).isVisible = "true";
}

function toggleVisOff(boxid) 
{
		document.getElementById(boxid).setAttribute("class", "formBuilderHelpTextHidden");
		document.getElementById(boxid).isVisible = "false";
}

			</script>';
        // The $module_status variable is considered to be an error, if it contains a string.
        if (is_string($module_status)) {
            $formDisplay .= $module_status;
        }
        // Get the fields for the form.
        $sql = "SELECT * FROM " . FORMBUILDER_TABLE_FIELDS . " WHERE form_id = '" . $form['id'] . "' ORDER BY display_order ASC;";
        $related = $wpdb->get_results($sql, ARRAY_A);
        // Filter the fields as needed.
        $related = apply_filters('formbuilder_filter_fields_processing', $related);
        $formDisplay = apply_filters('formbuilder_formDisplay_post_field_filter', $formDisplay);
        $submit_button_set = false;
        // Check for duplicate form submissions.
        if (isset($_POST['formBuilderForm']['FormBuilderID']) and $_POST['formBuilderForm']['FormBuilderID'] == $form_id) {
            $duplicate_check_hash = $form_id . formbuilder_get_hash();
            $old_hash = get_option('formBuilder_duplicate_hash');
            if ($duplicate_check_hash == $old_hash) {
                $post_errors = true;
                $tmp_msg = "\n<div class='formBuilderFailure alert alert-error'><h4>" . $formBuilderTextStrings['form_problem'] . "</h4><p>" . $formBuilderTextStrings['already_submitted'] . "</p>";
                $tmp_msg .= "\n</div>\n" . $formDisplay;
                $formDisplay = $tmp_msg;
            } else {
                update_option('formBuilder_duplicate_hash', $duplicate_check_hash);
            }
        }
        // Begin going through each field on the form and checking it against the submitted data.
        if (count($related) > 0) {
            foreach ($related as $field) {
                $error_msg = "";
                $divClass = "control-group formBuilderField " . preg_replace("#[^a-z0-9]#isU", "-", $field['field_type']);
                $divID = "formBuilderField" . clean_field_name($field['field_name']);
                $lb = "<br/>";
                $visibility = "";
                // Define short versions of the more used form variables.
                $field['name'] = "formBuilderForm[" . $field['field_name'] . "]";
                // If the field type is a checkbox with no predefined field value, give it a field value of "checked".
                if ($field['field_type'] == "checkbox" and $field['field_value'] == "") {
                    $field['field_value'] = "checked";
                }
                if ($field['field_type'] == "required checkbox" and $field['field_value'] == "") {
                    $field['field_value'] = "checked";
                }
                // Fill unset POST vars with empty strings.  Not sure what this was used for, but it is now disabled so as not to mess with other plugins that may also check _POST data. (James: Oct. 19, 2011)
                //if(!isset($_POST['formBuilderForm'][$field['field_name']])) $_POST['formBuilderForm'][$field['field_name']] = "";
                // Determine what submitted value to give to the field values.
                if ($field['field_type'] == 'system field') {
                    // Manually assign value to system fields before anything else.
                    $field['value'] = $field['field_value'];
                } elseif ($field['field_type'] == 'wp user id') {
                    // Manually assign value to system fields before anything else.
                    $wpuser = wp_get_current_user();
                    if ($wpuser->id != 0) {
                        $field['value'] = $wpuser->user_login;
                    }
                    $wpuser = null;
                } elseif (isset($_POST['formBuilderForm']['FormBuilderID']) and $_POST['formBuilderForm']['FormBuilderID'] == $form_id) {
                    // If there is a POST value, assign it to the field.
                    if (!isset($_POST['formBuilderForm'][$field['field_name']])) {
                        $field['value'] = '';
                    } else {
                        $field['value'] = htmlentities(stripslashes($_POST['formBuilderForm'][$field['field_name']]), ENT_QUOTES, get_option('blog_charset'));
                    }
                } elseif (isset($_GET[$field['field_name']])) {
                    // If there is a GET value, assign it to the field.
                    $field['value'] = htmlentities(stripslashes($_GET[$field['field_name']]), ENT_QUOTES, get_option('blog_charset'));
                } else {
                    // Required passwords should not display the default field value.
                    if ($field['field_type'] != 'required password') {
                        // In this case, there is neither a POST nor a GET value, therefore we assign the field value to be whatever the default value was for the field.
                        $field['value'] = $field['field_value'];
                    } else {
                        $field['value'] = "";
                    }
                }
                // Validate POST results against validators.
                if (isset($_POST['formBuilderForm']['FormBuilderID']) and $_POST['formBuilderForm']['FormBuilderID'] == $form_id) {
                    $duplicate_check_hash .= md5($field['value']);
                    if ($field['field_type'] == "spam blocker") {
                        // Check Spam Blocker for any submitted data.
                        if (trim($field['value']) != "") {
                            $post_errors = true;
                        }
                    } elseif ($field['field_type'] == "recipient selection") {
                        // Check to ensure we have been given a valid recipient selection
                        $options = explode("\n", $field['field_value']);
                        if (strpos($options[$field['value']], "|") !== false) {
                            list($option_value, $option_label) = explode("|", $options[$field['value']], 2);
                        } else {
                            $option_value = $option_label = $options[$field['value']];
                        }
                        if (!preg_match('#' . FORMBUILDER_PATTERN_EMAIL . '#isU', $option_value)) {
                            $error_msg = $field['error_message'];
                            $post_errors = true;
                            $missing_post_fields[$divID] = $field['field_label'];
                        }
                    } elseif ($field['field_type'] == "captcha field" and function_exists('imagecreate')) {
                        // Check CAPTCHA to ensure it is correct
                        if (isset($_SESSION['security_code']) and $_SESSION['security_code'] == $field['value'] && !empty($_SESSION['security_code'])) {
                            // Insert you code for processing the form here, e.g emailing the submission, entering it into a database.
                            unset($_SESSION['security_code']);
                        } else {
                            if (!isset($_SERVER['HTTP_COOKIE'])) {
                                $post_errors = true;
                                $missing_post_fields[$divID] = $formBuilderTextStrings['captcha_cookie_problem'];
                            } else {
                                // Insert your code for showing an error message here
                                $post_errors = true;
                                $error_msg = $field['error_message'];
                                $missing_post_fields[$divID] = $field['field_label'];
                            }
                        }
                    } elseif ($field['field_type'] == 'required password') {
                        if ($field['value'] != $field['field_value']) {
                            $post_errors = true;
                            if (!$field['error_message']) {
                                $field['error_message'] = __("The password you entered is incorrect.", 'formbuilder');
                            }
                            $error_msg = $field['error_message'];
                            $missing_post_fields[$divID] = $field['field_label'];
                        }
                    } else {
                        // Check the values of any other required fields.
                        if (!formbuilder_validate_field($field)) {
                            $error_msg = $field['error_message'];
                            $post_errors = true;
                            $missing_post_fields[$divID] = $field['field_label'];
                        }
                    }
                }
                // Prepopulate fields with user details if available
                if ($field['value'] == "") {
                    $wpuser = wp_get_current_user();
                    if ($wpuser->ID != 0) {
                        // User is logged in.  Prepopulate with data.
                        if (preg_match('#^(yourname|name|your_name|display_name|nickname)$#i', $field['field_name'], $regs)) {
                            $field['value'] = $wpuser->display_name;
                        }
                        if (preg_match('#^(firstname|first_name)$#i', $field['field_name'], $regs)) {
                            $field['value'] = $wpuser->first_name;
                        }
                        if (preg_match('#^(lastname|last_name)$#i', $field['field_name'], $regs)) {
                            $field['value'] = $wpuser->last_name;
                        }
                        if (preg_match('#^(email)$#i', $field['field_name'], $regs)) {
                            $field['value'] = $wpuser->user_email;
                        }
                        if (preg_match('#^(full_name|fullname)$#i', $field['field_name'], $regs)) {
                            $field['value'] = trim($wpuser->first_name . " " . $wpuser->last_name);
                        }
                    }
                    $wpuser = null;
                }
                // Display any necessary error msgs.
                if ($error_msg) {
                    $formError = "<div class='formBuilderError'>{$error_msg}</div>";
                } else {
                    $formError = "";
                }
                // Check for required fields, and change the class label details if necessary
                if (isset($field['required_data']) and $field['required_data'] != "none" and $field['required_data'] != "") {
                    $formLabelCSS = "formBuilderLabelRequired control-label";
                } else {
                    $formLabelCSS = "formBuilderLabel control-label";
                }
                // Determine if we need to show help text.
                if ($field['help_text']) {
                    if (DEFINED('FORMBUILDER_HELPTEXT_LABEL')) {
                        $formHelp = "<div class='formBuilderHelpText help-block' id='formBuilderHelpText{$divID}'>" . $field['help_text'] . "</div>";
                        $formHelpJava = "<a href='javascript:;' " . "class='formBuilderHelpTextToggle' " . "onClick='toggleVis(\"formBuilderHelpText{$divID}\");' " . ">" . FORMBUILDER_HELPTEXT_LABEL . "</a>{$formHelp}";
                    } else {
                        $formHelp = "<div class='formBuilderHelpText help-block' id='formBuilderHelpText{$divID}'>" . $field['help_text'] . "</div>";
                        $formHelpJava = "<a href='javascript:;' " . "class='formBuilderHelpTextToggle' " . "onClick='toggleVis(\"formBuilderHelpText{$divID}\");' " . ">?</a>{$formHelp}";
                    }
                } else {
                    $formHelpJava = "";
                    $formHelp = "";
                }
                // Display assorted form fields depending on the type of field.
                switch ($field['field_type']) {
                    case "comments area":
                        $formLabel = "";
                        $formInput = "<div class='formBuilderCommentsField controls'>" . decode_html_entities($field['field_value'], ENT_NOQUOTES, get_option('blog_charset')) . "</div> {$formHelpJava}";
                        $divClass = "formBuilderComment";
                        break;
                    case "hidden field":
                        $formLabel = "";
                        $formInput = "<div class='formBuilderHiddenField controls'><input type='hidden' name='" . $field['name'] . "' value='" . $field['value'] . "' /></div>";
                        $divClass = "formBuilderHidden";
                        break;
                    case "small text area":
                        $formLabel = "<div class='{$formLabelCSS}'>" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . " {$formHelpJava}</div>";
                        $formInput = "<div class='formBuilderSmallTextarea controls'><textarea name='" . $field['name'] . "' rows='4' cols='50' " . "id='field{$divID}' onblur=\"fb_ajaxRequest('" . $page_path . "php/formbuilder_parser.php', " . "'formid=" . $form['id'] . "&amp;fieldid=" . $field['id'] . "&amp;val='+document.getElementById('field{$divID}').value, 'formBuilderErrorSpace{$divID}')\" >" . $field['value'] . "</textarea></div>";
                        break;
                    case "large text area":
                        $formLabel = "<div class='{$formLabelCSS}'>" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . " {$formHelpJava}</div>";
                        $formInput = "<div class='formBuilderLargeTextarea controls'><textarea name='" . $field['name'] . "' rows='10' cols='80' " . "id='field{$divID}' onblur=\"fb_ajaxRequest('" . $page_path . "php/formbuilder_parser.php', " . "'formid=" . $form['id'] . "&amp;fieldid=" . $field['id'] . "&amp;val='+document.getElementById('field{$divID}').value, " . "'formBuilderErrorSpace{$divID}')\" >" . $field['value'] . "</textarea></div>";
                        break;
                    case "password box":
                        $formLabel = "<div class='{$formLabelCSS}'>" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . " </div>";
                        $formInput = "<div class='formBuilderInput controls'><input type='password' name='" . $field['name'] . "' value='" . $field['value'] . "' id='field{$divID}' onblur=\"fb_ajaxRequest('" . $page_path . "php/formbuilder_parser.php', 'formid=" . $form['id'] . "&amp;fieldid=" . $field['id'] . "&amp;val='+document.getElementById('field{$divID}').value, 'formBuilderErrorSpace{$divID}')\" /> {$formHelpJava}</div>";
                        break;
                    case "required password":
                        $formLabel = "<div class='formBuilderLabelRequired'>" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . " </div>";
                        $formInput = "<div class='formBuilderInput controls'><input type='password' name='" . $field['name'] . "' value='' id='field{$divID}' /> {$formHelpJava}</div>";
                        break;
                    case "checkbox":
                        if (isset($_POST['formBuilderForm'][$field['field_name']]) and htmlentities(stripslashes($_POST['formBuilderForm'][$field['field_name']]), ENT_NOQUOTES, get_option('blog_charset')) == $field['field_value']) {
                            $selected = "checked";
                        } else {
                            $selected = "";
                        }
                        $formLabel = "<div class='{$formLabelCSS}'><label for='field{$divID}'>" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . " </label></div>";
                        $formInput = "<div class='formBuilderInput controls'><input type='checkbox' name='" . $field['name'] . "' id='field{$divID}' value='" . $field['field_value'] . "' {$selected} /> <span class='formBuilderCheckboxDescription'>";
                        if ($field['field_value'] != "checked") {
                            $formInput .= "<label for='field{$divID}'>" . decode_html_entities($field['field_value'], ENT_NOQUOTES, get_option('blog_charset')) . "</label>";
                        }
                        $formInput .= "</span> {$formHelpJava}</div>";
                        break;
                    case "required checkbox":
                        if (isset($_POST['formBuilderForm'][$field['field_name']]) and htmlentities(stripslashes($_POST['formBuilderForm'][$field['field_name']]), ENT_NOQUOTES, get_option('blog_charset')) == $field['field_value']) {
                            $selected = "checked";
                        } else {
                            $selected = "";
                        }
                        $formLabel = "<div class='formBuilderLabelRequired'><label for='field{$divID}'>" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . " </label></div>";
                        $formInput = "<div class='formBuilderInput controls'><input type='checkbox' name='" . $field['name'] . "' id='field{$divID}' value='" . $field['field_value'] . "' {$selected} /> <span class='formBuilderCheckboxDescription'>";
                        if ($field['field_value'] != "checked") {
                            $formInput .= "<label for='field{$divID}'>" . decode_html_entities($field['field_value'], ENT_NOQUOTES, get_option('blog_charset')) . "</label>";
                        }
                        $formInput .= "</span> {$formHelpJava}</div>";
                        break;
                    case "radio buttons":
                        $options = explode("\n", $field['field_value']);
                        $formLabel = "<div class='{$formLabelCSS}'>" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . " {$formHelpJava}</div>";
                        $formInput = "<div class='formBuilderInput controls'>";
                        foreach ($options as $option_value => $roption) {
                            // Check for a pipe, and if it exists, split the value into value, label.
                            if (strpos($roption, "|") !== FALSE) {
                                list($option_original_value, $option_label) = explode("|", $roption, 2);
                            } else {
                                $option_label = $roption;
                            }
                            $option_label = trim(stripslashes($option_label));
                            $option_label = str_replace("<", "&lt;", $option_label);
                            $option_label = str_replace(">", "&gt;", $option_label);
                            if (isset($_POST['formBuilderForm'][$field['field_name']]) and htmlentities(stripslashes($_POST['formBuilderForm'][$field['field_name']]), ENT_QUOTES, get_option('blog_charset')) == $option_value) {
                                $selected = "checked";
                            } else {
                                $selected = "";
                            }
                            $formInput .= "<div class='formBuilderRadio'><label><input type='radio' name='" . $field['name'] . "' value='{$option_value}' {$selected} /> {$option_label}</label></div>";
                        }
                        $formInput .= "</div>";
                        break;
                    case "selection dropdown":
                        $options = explode("\n", $field['field_value']);
                        $formLabel = "<div class='{$formLabelCSS}'>" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . " </div>";
                        $formInput = "<div class='formBuilderSelect controls'>\n<select name='" . $field['name'] . "'>";
                        foreach ($options as $option_value => $roption) {
                            // Check for a pipe, and if it exists, split the value into value|label.
                            if (strpos($roption, "|") !== FALSE) {
                                list($option_original_value, $option_label) = explode("|", $roption, 2);
                            } else {
                                $option_label = $roption;
                            }
                            $option_label = trim(stripslashes($option_label));
                            $option_label = str_replace("<", "&lt;", $option_label);
                            $option_label = str_replace(">", "&gt;", $option_label);
                            // Check to see if the posted data is the same as the value.
                            if (isset($_POST['formBuilderForm'][$field['field_name']]) and htmlentities(stripslashes($_POST['formBuilderForm'][$field['field_name']]), ENT_QUOTES, get_option('blog_charset')) == $option_value) {
                                $selected = "selected = 'selected'";
                            } elseif ($field['value'] == $option_value) {
                                $selected = "selected = 'selected'";
                            } else {
                                $selected = "";
                            }
                            $formInput .= "\n<option value='{$option_value}' {$selected}>{$option_label}</option>";
                        }
                        $formInput .= "\n</select>\n {$formHelpJava}</div>";
                        break;
                    case "captcha field":
                        if (function_exists('imagecreate')) {
                            $formLabel = "<div class='{$formLabelCSS}'>" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . " </div>";
                            $formInput = "<div class='formBuilderInput controls'><div class='formBuilderCaptcha'>" . "<img src='" . FORMBUILDER_PLUGIN_URL . "captcha/display.php?" . SID . "' " . "alt='" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . "' />" . "<br/><input type='text' name='" . $field['name'] . "' value=''/> {$formHelpJava}</div></div>";
                        } else {
                            $formLabel = "<div class='{$formLabelCSS}'>" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . " </div>";
                            $formInput = "<div class='formBuilderInput'>" . $formBuilderTextStrings['captcha_unavailable'] . "</div>";
                        }
                        break;
                    case "spam blocker":
                        $formLabel = "<div class='{$formLabelCSS}'>" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . " </div>";
                        $formInput = "<div class='formBuilderInput controls'><input type='text' name='" . $field['name'] . "' value=''/> {$formHelpJava}</div>";
                        $divClass = get_option('formbuilder_spam_blocker');
                        break;
                    case "followup page":
                        $formLabel = "";
                        $formInput = "";
                        break;
                    case "recipient selection":
                        $formLabelCSS = "formBuilderLabelRequired";
                        $options = explode("\n", $field['field_value']);
                        $formLabel = "<div class='{$formLabelCSS}'>" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . " </div>";
                        $formInput = "<div class='formBuilderSelect controls'>\n<select name='" . $field['name'] . "'>";
                        foreach ($options as $option_value => $roption) {
                            // Check for a pipe, and if it exists, split the value into value|label.
                            if (strpos($roption, "|") !== FALSE) {
                                list($option_original_value, $option_label) = explode("|", $roption, 2);
                            } else {
                                $option_label = $roption;
                            }
                            $option_label = trim(stripslashes($option_label));
                            $option_label = str_replace("<", "&lt;", $option_label);
                            $option_label = str_replace(">", "&gt;", $option_label);
                            // Check to see if the posted data is the same as the value.
                            if (isset($_POST['formBuilderForm'][$field['field_name']]) and htmlentities(stripslashes($_POST['formBuilderForm'][$field['field_name']]), ENT_QUOTES, get_option('blog_charset')) == $option_value) {
                                $selected = "selected = 'selected'";
                            } elseif ($field['value'] == $option_value) {
                                $selected = "selected = 'selected'";
                            } else {
                                $selected = "";
                            }
                            $formInput .= "\n<option value='{$option_value}' {$selected}>{$option_label}</option>";
                        }
                        $formInput .= "\n</select>\n {$formHelpJava}</div>";
                        break;
                    case "page break":
                        $new_page = true;
                        $formLabel = "<div class='{$formLabelCSS}'>" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . " </div>";
                        $formInput = "<div class='formBuilderPageBreak'>";
                        $previous_page_insert = "";
                        if ($page_id > 1) {
                            $previous_page_insert = "<input type='button' name='formbuilder_page_break' value='" . $formBuilderTextStrings['previous'] . "' onclick=" . '"   fb_toggleLayer(\'formbuilder-' . $form_id . '-page-' . $page_id . '\');  fb_toggleLayer(\'formbuilder-' . $form_id . '-page-' . ($page_id - 1) . '\');  "' . " />";
                        }
                        $formInput .= "{$previous_page_insert} <input type='button' name='formbuilder_page_break' value='" . $formBuilderTextStrings['next'] . "' onclick=" . '"  fb_toggleLayer(\'formbuilder-' . $form_id . '-page-' . $page_id . '\');  fb_toggleLayer(\'formbuilder-' . $form_id . '-page-' . ($page_id + 1) . '\');  "' . " />" . "</div>";
                        $page_id++;
                        break;
                    case "reset button":
                        $formLabel = "";
                        $formInput = "<div class='formBuilderSubmit controls'>{$previous_page_insert}<input type='reset' name='" . $field['name'] . "' value='" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . "' /> {$formHelpJava}</div>";
                        break;
                    case "submit button":
                        $formLabel = "";
                        $previous_page_insert = "";
                        if ($page_id > 1) {
                            $previous_page_insert = "<input type='button' name='formbuilder_page_break' value='" . $formBuilderTextStrings['previous'] . "' onclick=" . '"   fb_toggleLayer(\'formbuilder-' . $form_id . '-page-' . $page_id . '\');  fb_toggleLayer(\'formbuilder-' . $form_id . '-page-' . ($page_id - 1) . '\');  "' . " />";
                        }
                        $formInput = "<div class='formBuilderSubmit controls'>{$previous_page_insert}<input type='submit' name='" . $field['name'] . "' value='" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . "' /> {$formHelpJava}</div>";
                        $submit_button_set = true;
                        break;
                    case "submit image":
                        $formLabel = "";
                        $previous_page_insert = "";
                        if ($page_id > 1) {
                            $previous_page_insert = "<input type='button' name='formbuilder_page_break' value='" . $formBuilderTextStrings['previous'] . "' onclick=" . '"   fb_toggleLayer(\'formbuilder-' . $form_id . '-page-' . $page_id . '\');  fb_toggleLayer(\'formbuilder-' . $form_id . '-page-' . ($page_id - 1) . '\');  "' . " /> {$formHelpJava}";
                        }
                        $formInput = "<div class='formBuilderSubmit controls'>{$previous_page_insert}<input type='image' name='" . $field['name'] . "' src='" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . "' value='" . $field['value'] . "' alt='" . $field['value'] . "' /></div>";
                        $submit_button_set = true;
                        break;
                    case "datestamp":
                        $formLabel = "<div class='{$formLabelCSS}'>" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . " </div>";
                        if (isset($calendar_loaded) and $calendar_loaded == true) {
                            $calendar_loading_code = "";
                        } else {
                            $calendar_loading_code = "<script src=\"" . $page_path . "js/calendar.js\" type=\"text/javascript\"></script>";
                            $calendar_loaded = true;
                        }
                        $formInput = "<div class='formBuilderDateStamp controls'><input type='text' name='" . $field['name'] . "' value='" . $field['value'] . "' id='field{$divID}' />\n\t\t\t\t\t\t\t\t{$calendar_loading_code}\n\t\t\t\t\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\t\t\tfb_calendar.set(\"field{$divID}\");\n\t\t\t\t\t\t\t\t</script> {$formHelpJava}\n\t\t\t\t\t\t\t</div>";
                        break;
                    case "unique id":
                        $unique = uniqid();
                        $formLabel = "";
                        $formInput = "<div class='formBuilderHiddenField'><input type='hidden' name='" . $field['name'] . "' value='" . uniqid() . "' /></div>";
                        $divClass = "formBuilderHidden";
                        break;
                    case "system field":
                        $formLabel = "";
                        $formInput = "";
                        break;
                    case "wp user id":
                        $formLabel = "";
                        $formInput = "";
                        break;
                    default:
                        $formLabel = "<div class='{$formLabelCSS}'>" . decode_html_entities($field['field_label'], ENT_NOQUOTES, get_option('blog_charset')) . " </div>";
                        $formInput = "<div class='formBuilderInput controls'><input type='text' " . "name='" . $field['name'] . "' " . "value='" . $field['value'] . "' " . "id='field{$divID}' " . "onblur=\"fb_ajaxRequest('" . $page_path . "php/formbuilder_parser.php', 'formid=" . $form['id'] . "&amp;fieldid=" . $field['id'] . "&amp;val='+document.getElementById('field{$divID}').value, 'formBuilderErrorSpace{$divID}')\"/> {$formHelpJava}</div>";
                        break;
                }
                // Additional processing of form fields
                $formFieldDisplay = '';
                $formFieldDisplay = apply_filters('formbuilder_display_field_filter', $formFieldDisplay, $field);
                if (empty($formFieldDisplay) && $field['field_type'] != 'system field' && $field['field_type'] != 'wp user id') {
                    $formFieldDisplay .= "\n<div class='{$divClass}' id='{$divID}' title='" . $field['error_message'] . "' {$visibility}><a name='{$divID}'></a>";
                    if (isset($_POST['formBuilderForm']['FormBuilderID']) and $_POST['formBuilderForm']['FormBuilderID'] == $form_id) {
                        $formFieldDisplay .= "\n<span id='formBuilderErrorSpace{$divID}'>{$formError}</span>";
                    } elseif (!isset($_GET['supress_errors']) and !isset($_GET['suppress_errors'])) {
                        $formFieldDisplay .= "\n<span id='formBuilderErrorSpace{$divID}'>{$formError}</span>";
                    }
                    $formFieldDisplay .= "\n{$formLabel}";
                    $formFieldDisplay .= "\n{$formInput}";
                    $formFieldDisplay .= "\n</div>";
                }
                // Allow for other methods of displaying the form field
                $formDisplay .= $formFieldDisplay;
                // Check for new page of form details.
                if ($new_page == true) {
                    $formDisplay .= "</div><div id='formbuilder-{$form_id}-page-{$page_id}' title='formbuilder-{$form_id}-page-{$page_id}' style='display:none;'>";
                }
                $new_page = false;
                $allFields[] = $field;
            }
        }
        $referrer_info = get_option('formBuilder_referrer_info');
        if ($referrer_info == 'Enabled') {
            // Hidden fields to include referer, and page uri
            $formDisplay .= "<input type='hidden' name='REFERER' value='" . __('Not Available', 'formbuilder') . "' />";
            if (isset($_SERVER['HTTP_HOST']) and isset($_SERVER['REQUEST_URI'])) {
                $formDisplay .= "<input type='hidden' name='PAGE' value='http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "' />";
            }
            // Using JavaScript to populate the referrer field, allows this to work even when pages are served from a cached location on the server.
            $formDisplay .= "\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\tfunction updateReferrerInfo()\n\t\t\t\t\t{\n\t\t\t\t\t\toFormObject = document.forms['formBuilder{$formID}'];\n\t\t\t\t\t\toFormElement = oFormObject.elements['REFERER'];\n\t\t\t\t\t\toFormElement.value = document.referrer;\n\t\t\t\t\t}\n\t\t\t\t</script>\n\t\t\t\t";
        }
        // Submit Button
        if (!$submit_button_set) {
            $previous_page_insert = "";
            if ($page_id > 1) {
                $previous_page_insert = "<input type='button' name='formbuilder_page_break' " . "value='" . $formBuilderTextStrings['previous'] . "' " . "onclick=" . '"   fb_toggleLayer(\'formbuilder-' . $form_id . '-page-' . $page_id . '\');  ' . '  fb_toggleLayer(\'formbuilder-' . $form_id . '-page-' . ($page_id - 1) . '\');  "' . " />";
            }
            $formDisplay .= "\n<div class='formBuilderSubmit form-actions'>{$previous_page_insert}<input type='submit' name='Submit' value='" . $formBuilderTextStrings['send'] . "' /></div>";
        } else {
            $formDisplay .= "";
        }
        $formDisplay .= "\n</div>\n</form>";
        // End of paged CSS
        $formDisplay = apply_filters('formbuilder_append_formDisplay', $formDisplay);
        // Check posted form data to ensure that we don't have any blacklisted material
        $blacklist_enabled = get_option('formbuilder_blacklist');
        if ($blacklist_enabled == "Enabled") {
            if (isset($_POST['formBuilderForm']['FormBuilderID'])) {
                foreach ($_POST['formBuilderForm'] as $key => $value) {
                    if (formbuilder_on_blacklist($value)) {
                        $post_errors = "There is a word in your form submission that the owners of this site deem to be probable spam.";
                        break;
                    }
                }
            }
        }
        // Check posted form data to ensure that we don't have any greylisted material
        $greylist_enabled = get_option('formbuilder_greylist');
        if ($greylist_enabled == "Enabled") {
            if (isset($_POST['formBuilderForm']['FormBuilderID'])) {
                foreach ($_POST['formBuilderForm'] as $key => $value) {
                    if (formbuilder_on_greylist($value)) {
                        $form['subject'] = "POSSIBLE SPAM: " . $form['subject'];
                        break;
                    }
                }
            }
        }
        // Check posted form data to ensure that we don't have any greylisted material
        $excessive_links_enabled = get_option('formbuilder_excessive_links');
        if ($excessive_links_enabled == "Enabled") {
            if (isset($_POST['formBuilderForm']['FormBuilderID'])) {
                foreach ($_POST['formBuilderForm'] as $key => $value) {
                    if (formbuilder_excessive_links($value)) {
                        $form['subject'] = "POSSIBLE SPAM: " . $form['subject'];
                        break;
                    }
                }
            }
        }
        // Check posted form data to ensure that we don't have any greylisted material
        $formbuilder_spammer_ip_checking = get_option('formbuilder_spammer_ip_checking');
        if ($formbuilder_spammer_ip_checking == "Enabled") {
            if (isset($_POST['formBuilderForm']['FormBuilderID'])) {
                $response = formbuilder_check_spammer_ip($_SERVER['REMOTE_ADDR']);
                if ($response > 0) {
                    $form['subject'] = "POSSIBLE SPAMMER IP: " . $form['subject'];
                }
            }
        }
        // Check posted form data for Akismet Spam
        $akismet_enabled = get_option('formbuilder_akismet');
        if ($akismet_enabled == "Enabled" and function_exists('akismet_http_post')) {
            if (isset($_POST['formBuilderForm']['FormBuilderID'])) {
                if (formbuilder_check_akismet($allFields) == 'true') {
                    $form['subject'] = "POSSIBLE AKISMET SPAM: " . $form['subject'];
                }
            }
        }
        // Create extended form variable.
        $extendedForm = $form;
        $extendedForm['allFields'] = $allFields;
        if (isset($_POST['formBuilderForm']['FormBuilderID']) && $_POST['formBuilderForm']['FormBuilderID'] == $form_id) {
            // Final check of fields before marking form as successfully submitted...
            $extendedForm = apply_filters('formbuilder_submit_final_check', $extendedForm);
            $post_errors = apply_filters('formbuilder_final_errors_filter', $post_errors);
        }
        // Process Form Results if necessary
        if (empty($post_errors) && isset($_POST['formBuilderForm']['FormBuilderID']) && $_POST['formBuilderForm']['FormBuilderID'] == $form_id) {
            // Apply filter to fields after successful form submission.
            $extendedForm = apply_filters('formbuilder_submit_success_pre_value_parsing', $extendedForm);
            // Convert numeric selection values to the real form values
            // Iterate through the form fields to add values to the email sent to the recipient.
            foreach ($extendedForm['allFields'] as $key => $field) {
                // If select box or radio buttons, we need to translate the posted value into the real value.
                if ($field['field_type'] == "recipient selection" or $field['field_type'] == "selection dropdown" or $field['field_type'] == "radio buttons") {
                    $options = explode("\n", $field['field_value']);
                    $roption = $options[$field['value']];
                    // Check for a pipe, and if it exists, split the value into value|label.
                    if (strpos($roption, "|") !== FALSE) {
                        list($option_value, $option_label) = explode("|", $roption, 2);
                    } else {
                        $option_value = $option_label = $roption;
                    }
                    $extendedForm['allFields'][$key]['value'] = trim($option_value);
                }
            }
            $extendedForm = apply_filters('formbuilder_submit_success_post_value_parsing', $extendedForm);
            $msg = "";
            // If enabled, put backup copies of the form data into a database.
            if (get_option('formbuilder_db_xml') != '0') {
                $msg = formbuilder_process_db($form, $extendedForm['allFields']);
            }
            // Check if an alternate form processing system is used.
            // Otherwise just use the default which sends an email to the recipiant.
            if ($form['action'] != "") {
                if (function_exists("{$processor_funcname}")) {
                    $msg = $processor_funcname($form, $extendedForm['allFields']);
                    $func_run = true;
                } else {
                    $msg = formbuilder_process_email($form, $extendedForm['allFields']);
                }
            } else {
                $msg = formbuilder_process_email($form, $extendedForm['allFields']);
            }
            // Check for and process any redirections at this point.
            if (!$msg) {
                formbuilder_check_redirection($form, $extendedForm['allFields']);
            }
            if (!isset($func_run)) {
                if (!$msg) {
                    if (!$form['thankyoutext']) {
                        $form['thankyoutext'] = "<h4>" . $formBuilderTextStrings['success'] . "</h4><p>" . $formBuilderTextStrings['send_success'] . "</p>";
                    }
                    // Populate ~variable~ tags in the autoresponse with values submitted by the user.
                    $txtAllFields = "";
                    foreach ($extendedForm['allFields'] as $field) {
                        if (trim($field['field_name']) != "" and $field['field_type'] != "recipient selection" and $field['field_type'] != "comments area" and $field['field_type'] != "followup page" and $field['field_type'] != "spam blocker" and $field['field_type'] != "page break" and $field['field_type'] != "reset button" and $field['field_type'] != "submit button" and $field['field_type'] != "submit image" and $field['field_type'] != "captcha field") {
                            $key = $field['field_name'];
                            $value = $field['value'];
                            $form['thankyoutext'] = str_replace("~" . $key . "~", $value, $form['thankyoutext']);
                            $txtAllFields .= $key . ": " . $value . "\n";
                        }
                    }
                    $form['thankyoutext'] = str_replace("~FullForm~", nl2br(trim($txtAllFields)), $form['thankyoutext']);
                    $formDisplay = "\n<div class='formBuilderSuccess alert alert-success'>" . decode_html_entities($form['thankyoutext'], ENT_QUOTES, get_option('blog_charset')) . "</div>";
                } else {
                    $formDisplay = "\n<div class='formBuilderFailure alert alert-error'><h4>" . $formBuilderTextStrings['failed'] . "</h4><p>" . $formBuilderTextStrings['send_failed'] . "<br/>{$msg}</p></div>";
                }
            } elseif ($msg) {
                // Only shown if the function returned some sort of failure.
                $formDisplay = "\n<div class='formBuilderFailure alert alert-error'><h4>" . $formBuilderTextStrings['failed'] . "</h4><p>{$msg}</p></div>{$formDisplay}";
            } else {
                $formDisplay = "\n<div class='formBuilderSuccess moduleSuccess alert alert-success'>" . decode_html_entities($form['thankyoutext'], ENT_QUOTES, get_option('blog_charset')) . "</div>";
            }
        } else {
            if (!empty($post_errors) and !empty($missing_post_fields)) {
                $msg = "\n<div class='formBuilderFailure alert alert-error'><h4>" . $formBuilderTextStrings['form_problem'] . "</h4><p>" . $formBuilderTextStrings['send_mistakes'] . "</p>";
                $msg .= "\n<ul>";
                foreach ($missing_post_fields as $idValue => $field_label) {
                    $msg .= "\n<li><a href='#{$idValue}'>{$field_label}</a></li>";
                }
                $msg .= "\n</ul></div>\n" . $formDisplay;
                $formDisplay = $msg;
            } elseif (!empty($post_errors) and is_string($post_errors)) {
                $msg = "\n<div class='formBuilderFailure alert alert-error'><h4>" . $formBuilderTextStrings['form_problem'] . "</h4>";
                $msg .= "\n<p>{$post_errors}</p></div>\n" . $formDisplay;
                $formDisplay = $msg;
            }
        }
        $formDisplay = apply_filters('formbuilder_formDisplay_final', $formDisplay);
        return "<div id='{$formCSSID}'>{$formDisplay}</div>";
    } else {
        return $formBuilderTextStrings['display_error'];
    }
}
Example #18
0
<?php

DEFINED('DS') or DEFINE('DS', DIRECTORY_SEPARATOR);
// Константа разделителя директорий
include_once '..' . DS . 'config' . DS . 'config.php';
// Инициализация настроек
include_once '..' . DS . 'config' . DS . 'db.php';
// Инициализация базы данных
include_once '..' . DS . 'library' . DS . 'mainFunctions.php';
// Основные функции
// получаем имена вызываемых контроллера и экшина
$controller = filter_input(INPUT_GET, 'controller');
$action = filter_input(INPUT_GET, 'action');
// определяем вызываемый контроллер
$controllerName = $controller ? ucfirst($controller) : 'Index';
// определяем вызываемую функцию
$actionName = $action ? $action : 'index';
loadPage($smarty, $controllerName, $actionName);
Example #19
0
/**
 *
 * Файл настроек
 *
 */
//> Константы для обращения к контроллерам
DEFINED('PathPrefix') or DEFINE('PathPrefix', '..' . DS . 'controllers' . DS);
DEFINED('PathPostfix') or DEFINE('PathPostfix', 'Controller.php');
//<
//> используемый шаблон
$template = 'default';
// пути к файлам шаблонов (*.tpl)
DEFINED('TemplatePrefix') or DEFINE('TemplatePrefix', '../views/' . $template . '/');
DEFINED('TemplatePostfix') or DEFINE('TemplatePostfix', '.tpl');
// пути к файлам шаблонов в веб пространстве
DEFINED('TemplateWebPath') or DEFINE('TemplateWebPath', '/templates/' . $template . '/');
//<
//> Инициализация шаблонизатора Smarty
// put full path to Smarty.class.php
require_once '..' . DS . 'library' . DS . 'Smarty' . DS . 'libs' . DS . 'Smarty.class.php';
$smarty = new Smarty();
$smarty->setTemplateDir(TemplatePrefix);
$smarty->setCompileDir('..' . DS . 'tmp' . DS . 'smarty' . DS . 'templates_c');
$smarty->setCacheDir('..' . DS . 'tmp' . DS . 'smarty' . DS . 'cache');
$smarty->setConfigDir('..' . DS . 'library' . DS . 'Smarty' . DS . 'configs');
$smarty->assign('templateWebPath', TemplateWebPath);
//<
//> Константы кодировок
DEFINED('DB_CHARSET') or DEFINE('DB_CHARSET', 'utf8');
//<
Example #20
0
<?php

/**
 * Project:     Bright framework
 * Author:      Jager Mesh (jagermesh@gmail.com)
 *
 * @version 1.1.0.0
 * @package Bright Core
 */
if (!DEFINED("E_STRICT")) {
    DEFINE("E_STRICT", 2048);
}
if (!DEFINED("E_DEPRECATED")) {
    DEFINE("E_DEPRECATED", 8192);
}
class BrErrorException extends ErrorException
{
    private $errorTypes = array(E_ERROR => "Error", E_WARNING => "Warning", E_PARSE => "Parsing Error", E_NOTICE => "Notice", E_CORE_ERROR => "Core Error", E_CORE_WARNING => "Core Warning", E_COMPILE_ERROR => "Compile Error", E_COMPILE_WARNING => "Compile Warning", E_USER_ERROR => "User Error", E_USER_WARNING => "User Warning", E_USER_NOTICE => "User Notice", E_STRICT => "Runtime Notice", E_DEPRECATED => "Deprecated");
    public function getType()
    {
        return isset($this->errorTypes[$this->getSeverity()]) ? $this->errorTypes[$this->getSeverity()] : 'Unknown Error';
    }
    public function isFatal()
    {
        return $this->getSeverity() == E_ERROR || $this->getSeverity() == E_USER_ERROR;
    }
}
class BrException extends Exception
{
}
class BrCallStackException extends BrException
Example #21
0
<?php

if (!DEFINED('BASEPATH')) {
    exit('No direct script access allowed');
}
class Note extends CI_Model
{
    public function get_all()
    {
        return $this->db->query("SELECT * FROM notes")->result_array();
    }
    public function add($title)
    {
        $query = "INSERT INTO notes (title, created_at, updated_at) VALUES (?, NOW(), NOW())";
        $this->db->query($query, $title);
        return $this->db->insert_id();
    }
    public function update($id, $description)
    {
        $query = "UPDATE notes SET description = ? WHERE id = ?";
        $values = array($description, $id);
        return $this->db->query($query, $values);
    }
    public function delete($id)
    {
        $query = "DELETE FROM notes WHERE id = ?";
        return $this->db->query($query, $id);
    }
}
Example #22
0
<?php

/**************************************************************************************************
config.php
    This file defines variable constants for use
***************************************************************************************************/
DEFINED('DS') ? null : define('DS', DIRECTORY_SEPARATOR);
DEFINED('ROOT') ? null : define('ROOT', '..');
DEFINED('LIB') ? null : define('LIB', ROOT . DS . 'lib');
DEFINED('VIEW') ? null : define('VIEW', ROOT . DS . 'views');
Example #23
0
<?php

error_reporting(0);
if (!DEFINED('ihere')) {
    die;
}
//slowly and painfully
function printerror($e)
{
    switch ($e) {
        case 'empty':
            die('One or more fields have been left blank. Please <a href="javascript:history.back();">try again</a>.');
            break;
        case 'dblogin':
            die('Could not connect to database. Please verify your information and
                 <a href="javascript:history.back();">try again</a>.');
            break;
        case 'dbsel':
            die('Could not connect to specified database. Login information seems good, DB seems inexistant.
                Please verify your information and <a href="javascript:history.back();">try again</a>.');
            break;
        default:
            die('Unexpected error. Please try again.');
            break;
    }
}
if (isset($_POST['install'])) {
    if (empty($_POST['title']) || empty($_POST['home']) || empty($_POST['login']) || empty($_POST['host']) || empty($_POST['database']) || empty($_POST['user']) || empty($_POST['pass']) || empty($_POST['passkey'])) {
        printerror('empty');
    } else {
        //we're good to go, yo.
Example #24
0
<?php

DEFINED('RND') or die;
class DB
{
    private static $INSTANCE = null;
    private static $result = null;
    const DATE_FORMAT = 'd-m-Y G:i:s';
    const TIMEZONE = 'Etc/GMT+0';
    public static function getInstance()
    {
        if (DB::$INSTANCE == null) {
            $dsn = "mysql:host=" . Config::DB_HOST . ";dbname=" . Config::DB_NAME;
            try {
                DB::$INSTANCE = new PDO($dsn, Config::DB_USER, Config::DB_PASS, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC));
            } catch (PDOException $e) {
                $str = "Cannot connect to database " . $e->getMessage();
                Utilities::log($str, Utilities::LOG_E);
                die;
            }
        }
        return DB::$INSTANCE;
    }
    public static function getTime()
    {
        $date = new DateTime('NOW', new DateTimeZone(self::TIMEZONE));
        return $date->format(DB::DATE_FORMAT) . '.' . substr(microtime(), 2, 3);
    }
    static function close()
    {
        //DB::getInstance()->close();
Example #25
0
// Ver:         $Id: gd_image.inc.php 1922 2010-01-11 11:42:50Z ljp $
//
// Copyright (c) Asial Corporation. All rights reserved.
//========================================================================
require_once 'jpgraph_rgb.inc.php';
require_once 'jpgraph_ttf.inc.php';
require_once 'imageSmoothArc.php';
// Line styles
define('LINESTYLE_SOLID', 1);
define('LINESTYLE_DOTTED', 2);
define('LINESTYLE_DASHED', 3);
define('LINESTYLE_LONGDASH', 4);
// The DEFAULT_GFORMAT sets the default graphic encoding format, i.e.
// PNG, JPG or GIF depending on what is installed on the target system
// in that order.
if (!DEFINED("DEFAULT_GFORMAT")) {
    define("DEFAULT_GFORMAT", "auto");
}
//========================================================================
// CLASS Image
// Description: The very coor image drawing class that encapsulates all
//              calls to the GD library
//              Note: The class used by the library is the decendant
//              class RotImage which extends the Image class with transparent
//              rotation.
//=========================================================================
class Image
{
    public $img = null;
    public $rgb = null;
    public $img_format;
Example #26
0
<?php

namespace Amenadiel\JpGraph\Graph;

use Amenadiel\JpGraph\Plot;
//=======================================================================
// File:        JPGRAPH_LEGEND.INC.PHP
// Description: Class to handle the legend box in the graph that gives
//              names on the data series. The number of rows and columns
//              in the legend are user specifyable.
// Created:     2001-01-08 (Refactored to separate file 2008-08-01)
// Ver:         $Id: jpgraph_legend.inc.php 1926 2010-01-11 16:33:07Z ljp $
//
// Copyright (c) Asial Corporation. All rights reserved.
//========================================================================
DEFINED('_DEFAULT_LPM_SIZE') || DEFINE('_DEFAULT_LPM_SIZE', 8);
// Default Legend Plot Mark size
//===================================================
// CLASS Legend
// Description: Responsible for drawing the box containing
// all the legend text for the graph
//===================================================
class Legend
{
    public $txtcol = array();
    public $font_family = FF_DEFAULT, $font_style = FS_NORMAL, $font_size = 8;
    // old. 12
    private $color = array(120, 120, 120);
    // Default frame color
    private $fill_color = array(245, 245, 245);
    // Default fill color
Example #27
0
function definePaths()
{
    global $boarddir, $cachedir, $extdir, $languagedir, $sourcedir;
    // Make sure the paths are correct... at least try to fix them.
    if (!file_exists($boarddir) && file_exists(dirname(__FILE__) . '/agreement.txt')) {
        $boarddir = dirname(__FILE__);
    }
    if (!file_exists($sourcedir . '/SiteDispatcher.class.php') && file_exists($boarddir . '/sources')) {
        $sourcedir = $boarddir . '/sources';
    }
    // Check that directories which didn't exist in past releases are initialized.
    if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) {
        $cachedir = $boarddir . '/cache';
    }
    if ((empty($extdir) || !file_exists($extdir)) && file_exists($sourcedir . '/ext')) {
        $extdir = $sourcedir . '/ext';
    }
    if ((empty($languagedir) || !file_exists($languagedir)) && file_exists($boarddir . '/themes/default/languages')) {
        $languagedir = $boarddir . '/themes/default/languages';
    }
    if (!DEFINED('BOARDDIR')) {
        DEFINE('BOARDDIR', $boarddir);
    }
    if (!DEFINED('CACHEDIR')) {
        DEFINE('CACHEDIR', $cachedir);
    }
    if (!DEFINED('EXTDIR')) {
        DEFINE('EXTDIR', $extdir);
    }
    if (!DEFINED('LANGUAGEDIR')) {
        DEFINE('LANGUAGEDIR', $languagedir);
    }
    if (!DEFINED('SOURCEDIR')) {
        DEFINE('SOURCEDIR', $sourcedir);
    }
    if (!DEFINED('ADMINDIR')) {
        DEFINE('ADMINDIR', $sourcedir . '/admin');
    }
    if (!DEFINED('CONTROLLERDIR')) {
        DEFINE('CONTROLLERDIR', $sourcedir . '/controllers');
    }
    if (!DEFINED('SUBSDIR')) {
        DEFINE('SUBSDIR', $sourcedir . '/subs');
    }
}
Example #28
0
<?php

DEFINED('SL') or DEFINE('SL', '/');
DEFINED('PATH') or DEFINE('PATH', realpath(dirname(__FILE__)));
DEFINED('APP_PATH') or DEFINE('APP_PATH', PATH . SL . 'app');
DEFINED('CONTROLLER_PATH') or DEFINE('CONTROLLER_PATH', APP_PATH . SL . 'controllers');
DEFINED('VIEW_PATH') or DEFINE('VIEW_PATH', APP_PATH . SL . 'views');
DEFINED('MODEL_PATH') or DEFINE('MODEL_PATH', APP_PATH . SL . 'models');
/** @noinspection PhpUndefinedClassInspection */
class CVM
{
    protected $Name;
    function __construct($Name)
    {
        $Name = strtolower($Name);
        $this->generate_controller(ucfirst($Name));
        $this->generate_view($Name);
        $this->generate_model(ucfirst($Name));
    }
    function generate_controller($Name)
    {
        $add = "Controller";
        $path = CONTROLLER_PATH . SL . $Name . $add . ".php";
        if (!file_exists($path)) {
            $Controller = fopen($path, "w") or die("Unable to open file!");
            $content = "<?php \n class " . $Name . "_" . $add . " {\n \t function indexAction(){\n\n \t } \n }";
            fwrite($Controller, $content);
            fclose($Controller);
            echo "Created controller: " . CONTROLLER_PATH . SL . $Name . $add . ".php<br/>";
        } else {
            echo "Controller Exist!<br/>";
 /**
  * Script to run when this class is loaded
  *
  * @since ADD MVC 0.8
  */
 public static function __add_loaded()
 {
     $class_reflection = new ReflectionClass(get_called_class());
     if (!$class_reflection->isAbstract()) {
         $table_constant = get_called_class() . '::TABLE';
         e_developer::assert(DEFINED($table_constant), "{$table_constant} is not declared");
     }
 }
Example #30
0
 private function _isLoggerAllowed()
 {
     $app = Yii::app();
     //Checking for an DEBUG mode of running app
     if (!empty($this->_config['runInDebug']) && (!DEFINED('YII_DEBUG') || YII_DEBUG == false)) {
         return false;
     }
     //Checking for an AJAX Requests
     if (!$app instanceof CWebApplication || $app->getRequest()->getIsAjaxRequest()) {
         return false;
     }
     //Checking IP
     $ip = $app->request->getUserHostAddress();
     foreach ($this->allowedIPs as $pattern) {
         // if found any char other than [0-9] and dot, treat pattern as a regexp
         if (preg_match('/[^0-9:\\.]/', $pattern)) {
             if (preg_match('/' . $pattern . '/', $ip)) {
                 return true;
             }
         } else {
             if ($pattern === $ip) {
                 return true;
             }
         }
     }
     return false;
 }