Skip to content

Commit

Permalink
Remove empty example files and escape output in example files.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoballred committed Feb 23, 2017
1 parent 63bcd7a commit 110c06f
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 33 deletions.
4 changes: 2 additions & 2 deletions Infusionsoft/examples/contact_tree.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function dumpObject($object, $indent = 0)
<tr><?
foreach ($object->getFields() as $field) {
?>
<th><?=$field?></th>
<th><?=htmlspecialchars($field)?></th>
<?
}
?></tr>
Expand All @@ -76,7 +76,7 @@ function dumpObject($object, $indent = 0)
<tr><?
foreach ($object->getFields() as $field) {
?>
<td><?=htmlentities($data[$field])?></td><?
<td><?=htmlspecialchars($data[$field])?></td><?
}
?></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion Infusionsoft/examples/create_order.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$recurringOrder->StartDate = date('Y-m-d H:i:s', strtotime("-1 month"));
$recurringOrder->PaidThruDate = date('Y-m-d H:i:s', strtotime("-1 month"));
$recurringOrder->save();
echo "<h1>Subscription Created: $recurring_order_id</h1>";
echo "<h1>Subscription Created: " . htmlspecialchars($recurring_order_id) . "</h1>";
}

?>
Expand Down
8 changes: 4 additions & 4 deletions Infusionsoft/examples/exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


$file_name = "../exports/" . $_GET['object'] . '_export_' . date('Ymd-h.i.s') . '.csv';
echo 'Creating csv file: ' . $file_name . '<br/>';
echo 'Creating csv file: ' . htmlspecialchars($file_name) . '<br/>';
$csv_file = fopen($file_name, 'w');

fputcsv($csv_file, $object->getFields(), ",", "\"");
Expand All @@ -50,7 +50,7 @@

echo 'Closing csv file. <br/>';
fclose($csv_file);
?><a href="<?=$file_name?>"><?=$file_name?></a><br/><br/><?
?><a href="<?=htmlspecialchars($file_name)?>"><?=htmlspecialchars($file_name)?></a><br/><br/><?

if($_GET['object'] == 'Template'){
echo 'Exporting email templates into files.' . "<br/>";
Expand All @@ -72,7 +72,7 @@
$template = Infusionsoft_APIEmailService::getEmailTemplate($result->Id);

$file_name = "../exports/" . $_GET['object'] . '_' . $result->Id . '_' . date('Ymd-h.i.s') . '.txt';
echo 'Creating file: ' . $file_name . '<br/>';
echo 'Creating file: ' . htmlspecialchars($file_name) . '<br/>';
$file = fopen($file_name, 'w');
fwrite($file, 'Title: ' . $template['pieceTitle'] . "\n");
fwrite($file, 'Categories: ' . $template['categories'] . "\n");
Expand Down Expand Up @@ -103,7 +103,7 @@
global $all_tables;
sort($all_tables);
foreach($all_tables as $table){
?><option value="<?php echo $table; ?>"><?php echo $table; ?></option><?php
?><option value="<?php echo htmlspecialchars($table); ?>"><?php echo htmlspecialchars($table); ?></option><?php
}
?>
</select><br/>
Expand Down
8 changes: 0 additions & 8 deletions Infusionsoft/examples/generate-code.php

This file was deleted.

6 changes: 3 additions & 3 deletions Infusionsoft/examples/get_invoices_for_contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<html>
<body>
<form method="post">
ContactId: <input type="text" name="ContactId" value="<?php if(isset($_POST['ContactId'])) echo $_POST['ContactId']; ?>"><br/>
ContactId: <input type="text" name="ContactId" value="<?php if(isset($_POST['ContactId'])) echo htmlspecialchars($_POST['ContactId']); ?>"><br/>
<input type="submit"/>
</form>

Expand All @@ -23,8 +23,8 @@
foreach($invoice->getFields() as $field){
?>
<tr>
<td><?php echo $field; ?></td>
<td><?php echo $invoice->$field; ?></td>
<td><?php echo htmlspecialchars($field); ?></td>
<td><?php echo htmlspecialchars($invoice->$field); ?></td>
</tr>
<?php
}
Expand Down
4 changes: 2 additions & 2 deletions Infusionsoft/examples/leadscoring.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<form>
ContactId: <input type="text" name="ContactId" value="<?php if(isset($_REQUEST['ContactId'])) echo $_REQUEST['ContactId']; ?>" />
ContactId: <input type="text" name="ContactId" value="<?php if(isset($_REQUEST['ContactId'])) echo htmlspecialchars($_REQUEST['ContactId']); ?>" />
<input type="submit"/>
</form><br/>
<?php
Expand All @@ -11,6 +11,6 @@
$contact->_LeadScore = $contact->_LeadScore + 1;
$contact->save();

echo 'Lead Score for Contact: ' . $contact->FirstName . ' ' . $contact->LastName . ' is now: ' . $contact->_LeadScore;
echo 'Lead Score for Contact: ' . htmlspecialchars($contact->FirstName) . ' ' . htmlspecialchars($contact->LastName) . ' is now: ' . htmlspecialchars($contact->_LeadScore);
}

4 changes: 2 additions & 2 deletions Infusionsoft/examples/list_objects.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
global $all_tables;
sort($all_tables);
foreach($all_tables as $table){
?><option value="<?php echo $table; ?>"><?php echo $table; ?></option><?php
?><option value="<?php echo htmlspecialchars($table); ?>"><?php echo htmlspecialchars($table); ?></option><?php
}
?>
</select><br/>
Expand All @@ -32,7 +32,7 @@
<tr>
<?php
foreach($object->getFields() as $field){
?><th><?=$field?></th><?php
?><th><?=htmlspecialchars($field)?></th><?php
}
?>
</tr>
Expand Down
12 changes: 6 additions & 6 deletions Infusionsoft/examples/object_editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
$object = new $class_name($_GET['Id']);
}
catch(Exception $e){
echo $e->getMessage();
echo htmlspecialchars($e->getMessage());
renderLoadForm();
return;
}
Expand All @@ -35,7 +35,7 @@
$object = new $class_name($_GET['Id']);
}
catch(Exception $e){
echo $e->getMessage();
echo htmlspecialchars($e->getMessage());
renderLoadForm();
return;
}
Expand All @@ -51,7 +51,7 @@ function renderLoadForm(){
global $all_tables;
sort($all_tables);
foreach($all_tables as $table){
?><option value="<?php echo $table; ?>"><?php echo $table; ?></option><?php
?><option value="<?php echo htmlspecialchars($table); ?>"><?php echo htmlspecialchars($table); ?></option><?php
}
?>
</select><br/>
Expand All @@ -65,12 +65,12 @@ function renderLoadForm(){
function renderObjectForm($object){
?>
<form method="post">
<input type="hidden" name="object" value="<?php echo $object->getTable();?>"/>
<input type="hidden" name="object" value="<?php echo htmlspecialchars($object->getTable());?>"/>
<?php
foreach($object->toArray() as $field=>$value){
?>
<?php echo $field; ?><br/>
<input type="text" name="<?php echo $field; ?>" value="<?php echo $value; ?>"><br/>
<?php echo htmlspecialchars($field); ?><br/>
<input type="text" name="<?php echo htmlspecialchars($field); ?>" value="<?php echo htmlspecialchars($value); ?>"><br/>
<?php
}
?>
Expand Down
4 changes: 2 additions & 2 deletions Infusionsoft/examples/subscription_tree.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function dumpObject($object, $indent = 0)
<tr><?
foreach ($object->getFields() as $field) {
?>
<th><?=$field?></th>
<th><?=htmlspecialchars($field)?></th>
<?
}
?></tr>
Expand All @@ -82,7 +82,7 @@ function dumpObject($object, $indent = 0)
<tr><?
foreach ($object->getFields() as $field) {
?>
<td><?=htmlentities($data[$field])?></td><?
<td><?=htmlspecialchars($data[$field])?></td><?
}
?></tr>
</tbody>
Expand Down
3 changes: 0 additions & 3 deletions Infusionsoft/examples/view_incomplete_orders.php

This file was deleted.

0 comments on commit 110c06f

Please sign in to comment.