Skip to content

Commit

Permalink
Changes from our local development merged back to the community.
Browse files Browse the repository at this point in the history
  • Loading branch information
warkior committed Aug 7, 2012
1 parent 951e1e0 commit ba72663
Show file tree
Hide file tree
Showing 8 changed files with 368 additions and 14 deletions.
123 changes: 123 additions & 0 deletions class/Object.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?php

if(!class_exists('Object')) {
class Object {

var $creation_time;

function debug($msg = '', $forced = false)
{
$run_time = microtime(true) - $this->creation_time;
$otype = get_class($this);

ob_start();
if($msg)
print_r($msg);
$result = ob_get_contents();
ob_end_clean();

echo "<pre>$otype DEBUG [$run_time]: ";
echo htmlentities($result);
echo "\n</pre>";

}

/**
* Function to allow setting of internal object values.
*/
function vset( $variable, $value = '' )
{
if(!isset($this->$variable))
return(false);
else {
if($this->$variable !== $value)
{
$this->$variable = $value;
}
return(true);
}
}

/**
* Function to return or print the current object as a string.
*/
function toString($print = true)
{
$result = "";

if(ob_start())
{
$this->debug($this);
$result = ob_get_contents();
ob_end_clean();
}
else
{
foreach($this as $key=>$value)
{
$result .= $key . ": " . $value . "\n";
}
}

if($print) echo $result;
return($result);
}

function copyToObj( $target )
{
foreach($this as $property=>$value)
{
$target->$property = $value;
}
return(true);
}

function error($msg)
{
trigger_error($msg, E_USER_ERROR);
}

function warning($msg)
{
trigger_error($msg, E_USER_WARNING);
}

/**
* Standard PHP5 Constructor
*/
function __construct()
{
$this->creation_time = microtime(true);
# $this->debug('Created New ' . get_class($this));
}

/**
* Standard PHP5 Destructor
*/
function __destruct()
{
}

/**
* PHP4 style constructor
*
* This PHP4 style constructor will only be called by a system running PHP4. It will register the
* PHP5 style destructor for running on shutdown, and will proceed to run the PHP5 style constructor
* manually.
*
*/
function Object() {
// register __destruct method as shutdown function
if(function_exists('register_shutdown_function'))
register_shutdown_function(array(&$this, "__destruct"));
else
trigger_error("Shutdown function does not exist.", E_USER_ERROR);

return($this->__construct());
}

}
}


?>
32 changes: 29 additions & 3 deletions extensions/formbuilder_xml_db_results.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,30 @@ function resend_email($email_id)
if(!$error)
{
$email_msg = '';
$email_from = '';
foreach($form_data['form'] as $key=>$value)
{
$email_msg .= strtoupper($key) . ": " . $value . "\n\n";
if($key != 'FormSubject'
&& $key != 'FormRecipient'
&& !$email_from
&& preg_match('#' . FORMBUILDER_PATTERN_EMAIL . '#isU', $value))
{
$email_from = $value;
}
}
if(!$email_from) $email_from = get_option('admin_email');
$email_subject = $form_data['form']['FormSubject'];
$email_to = $form_data['form']['FormRecipient'];
$email_headers='From: ' . get_option('admin_email');
$email_headers='From: ' . $email_from;

$debg = array(
'$email_from'=>$email_from,
'$email_subject'=>$email_subject,
'$email_to'=>$email_to,
'$email_headers'=>$email_headers,
);
# echo '<pre>', htmlentities(print_r( $debg, true )), '</pre>';
$result = formbuilder_send_email($email_to, $email_subject, $email_msg, $email_headers);
if($result)
{
Expand Down Expand Up @@ -1055,7 +1073,9 @@ function export_csv()
}

echo "\r\n";


$currentTime = current_time('timestamp');
$offset = time() - $currentTime;

$i = 0;

Expand All @@ -1071,7 +1091,7 @@ function export_csv()

echo $result['id'];
echo ',' . $result['form_id'];
echo ',"' . date("F j, Y, g:i a", $result['timestamp']) . '"';
echo ',"' . date("F j, Y, g:i a", $result['timestamp'] - $offset) . '"';


if($specific_form == true AND $field_list)
Expand Down Expand Up @@ -1133,6 +1153,12 @@ function output_date($datestring, $endofday=false)
else
$timestamp = mktime(0, 0, 0, $datestring['month'], $datestring['day'], $datestring['year']);


$currentTime = current_time('timestamp');
$offset = time() - $currentTime;

$timestamp = $timestamp + $offset;

return($timestamp);
}

Expand Down
31 changes: 22 additions & 9 deletions html/options_default.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@
<input class='searchButton' name='Search' type="submit" value="Search" />
</form>

<p><?php _e('These are the forms that you currently have running on your blog.', 'formbuilder'); ?>
<a href="<?php echo FB_ADMIN_PLUGIN_PATH; ?>&fbaction=newForm"><?php printf(__('Click here%s to create a new form', 'formbuilder'), '</a>'); ?>.</p>
<p>
<?php _e('These are the forms that you currently have running on your blog.', 'formbuilder'); ?>
<a href="<?php echo FB_ADMIN_PLUGIN_PATH; ?>&fbaction=newForm"><?php printf(__('Click here%s to create a new form', 'formbuilder'), '</a>'); ?>.
<a href="<?php echo FB_ADMIN_PLUGIN_PATH; ?>&fbaction=importForm"><?php printf(__('Click here%s to %simport%s a form', 'formbuilder'), '</a>', '<strong>', '</strong>'); ?>.
</p>

<?php
// Get a list of any tags associated with the forms.
Expand Down Expand Up @@ -132,8 +135,12 @@
<th><?php _e('ID #', 'formbuilder'); ?></th>
<th><?php _e('Name', 'formbuilder'); ?></th>
<th><?php _e('Subject', 'formbuilder'); ?></th>
<th><?php _e('Recipient', 'formbuilder'); ?></th>
<th width='125' align='right' style='text-align: right;'><?php echo $nav; ?></th>
<th>
<?php _e('Recipient', 'formbuilder'); ?>
<div width='125' style='float: right; text-align: right;'>
<?php echo $nav; ?>
</span>
</th>
</tr>
<?php

Expand All @@ -155,16 +162,23 @@
$alt = false;
}
?>
<tr valign="top" class="<?php echo $class; ?> hoverlite">
<tr valign="top" class="<?php echo $class; ?> hoverlite" onClick="jQuery('#formRow<?php echo $form->id; ?>').show();">
<td><acronym title="<?php printf(__("Manually include this form with %s in the page/post content.", 'formbuilder'), "[formbuilder:" . $form->id . "]"); ?>"><?php echo $form->id; ?></acronym></td>
<td><?php echo $form->name; ?></td>
<td><?php echo $form->subject; ?></td>
<td><?php echo $form->recipient; ?></td>
<td><a href='javascript:;' onClick="jQuery('#formRow<?php echo $form->id; ?>').show();"><?php echo $form->name; ?></a></td>
<td><a href='javascript:;' onClick="jQuery('#formRow<?php echo $form->id; ?>').show();"><?php echo $form->subject; ?></a></td>
<td><a href='javascript:;' onClick="jQuery('#formRow<?php echo $form->id; ?>').show();"><?php echo $form->recipient; ?></a></td>
</tr>
<tr id="formRow<?php echo $form->id; ?>" style="display: none; background-color: #dddddd;">
<td>
<a href="javascript:;" onClick="jQuery('#formRow<?php echo $form->id; ?>').hide();">^</a>
</td>
<td colspan="3" style="padding-bottom: 20px;">
<a href="<?php echo formbuilder_build_url(array('fbaction'=>'editForm', 'fbid'=>$form->id), array('page')); ?>"><?php _e('Edit', 'formbuilder'); ?></a>
|
<a href="<?php echo formbuilder_build_url(array('fbaction'=>'copyForm', 'fbid'=>$form->id), array('page', 'fbtag', 'pageNumber')); ?>"><?php _e('Copy', 'formbuilder'); ?></a>
|
<a href="<?php echo formbuilder_build_url(array('fbaction'=>'exportForm', 'fbid'=>$form->id), array('page', 'fbtag', 'pageNumber')); ?>"><?php _e('Export', 'formbuilder'); ?></a>
|
<a href="<?php echo formbuilder_build_url(array('fbaction'=>'removeForm', 'fbid'=>$form->id), array('page', 'fbtag', 'pageNumber')); ?>" onclick="return(confirm('<?php _e('Are you sure you want to delete this form?', 'formbuilder'); ?>'));"><?php _e('Remove', 'formbuilder'); ?></a>
</td>
</tr>
Expand All @@ -174,7 +188,6 @@
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td width='125' align='right' style='text-align: right;'><?php echo $nav; ?></td>
</tr>

Expand Down
5 changes: 5 additions & 0 deletions html/options_export_form.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php formbuilder_admin_nav('export form'); ?>

<h3 class="info-box-title"><?php _e('Form Export', 'formbuilder'); ?></h3>
<p><?php _e('The following text contains the data required to move this form to another site. To move it, copy the entire text and paste it into the Import Form box on your secondary site.', 'formbuilder'); ?></p>
<textarea style="width: 700px; height: 500px;"><?php echo $formData; ?></textarea>
8 changes: 8 additions & 0 deletions html/options_import_form.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php formbuilder_admin_nav('import form'); ?>

<form name="formImport" method="POST" action="<?php echo FB_ADMIN_PLUGIN_PATH; ?>&fbaction=importForm">
<h3 class="info-box-title"><?php _e('Form Import', 'formbuilder'); ?></h3>
<p><?php _e('Enter the exported form data here and press Save.', 'formbuilder'); ?></p>
<textarea style="width: 700px; height: 500px;" name="formData"><?php echo $formData; ?></textarea>
<br/><input type="submit" name="submit" value="Save" />
</form>
8 changes: 8 additions & 0 deletions php/formbuilder_admin_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ function formbuilder_options_page($action=""){
formbuilder_options_editForm($_GET['fbid']);
break;

case "exportForm":
formbuilder_options_exportForm($_GET['fbid']);
break;

case "importForm":
formbuilder_options_importForm();
break;

case "editFormObject":
formbuilder_options_editFormObject($_GET['fbid']);
break;
Expand Down
Loading

0 comments on commit ba72663

Please sign in to comment.