本文整理汇总了PHP中deleteAll函数的典型用法代码示例。如果您正苦于以下问题:PHP deleteAll函数的具体用法?PHP deleteAll怎么用?PHP deleteAll使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了deleteAll函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __deleteAll
function __deleteAll($directory, $empty = false)
{
if (substr($directory, -1) == "/") {
$directory = substr($directory, 0, -1);
}
if (!file_exists($directory) || !is_dir($directory)) {
return false;
} elseif (!is_readable($directory)) {
return false;
} else {
$directoryHandle = opendir($directory);
while ($contents = readdir($directoryHandle)) {
if ($contents != '.' && $contents != '..') {
$path = $directory . "/" . $contents;
if (is_dir($path)) {
deleteAll($path);
} else {
unlink($path);
}
}
}
closedir($directoryHandle);
if ($empty == false) {
if (!rmdir($directory)) {
return false;
}
}
return true;
}
}
示例2: deleteAll
function deleteAll($data_parent, $connection)
{
$query = mysql_query("select * from files where data_parent='{$data_parent}'", $connection);
while ($tableRow = mysql_fetch_assoc($query)) {
$data_parent = $tableRow["data_id"];
mysql_query("DELETE FROM files WHERE data_id='{$data_parent}'", $connection);
unlink("./files/" . $tableRow["data_id"]);
deleteAll($data_parent, $connection);
}
}
示例3: insertEnt
function insertEnt($t_vat_registration_id, $item_potensi)
{
$dbConn = new clsDBConnSIKP();
$sql = "insert into t_vat_reg_dtl_entertaintment (" . "t_vat_reg_dtl_entertaintment_id,t_vat_registration_id,entertainment_desc,service_charge_wd," . "service_charge_we,seat_qty,room_qty,clerk_qty,booking_hour,f_and_b,portion_person,creation_date," . "created_by,updated_date,updated_by ) values ( " . "generate_id('sikp','t_vat_reg_dtl_entertaintment','t_vat_reg_dtl_entertaintment_id')," . $t_vat_registration_id . ",'" . $item_potensi['entertainment_desc'] . "'," . $item_potensi['service_charge_wd'] . "," . $item_potensi['service_charge_we'] . "," . $item_potensi['seat_qty'] . "," . $item_potensi['room_qty'] . "," . $item_potensi['clerk_qty'] . "," . $item_potensi['booking_hour'] . "," . $item_potensi['f_and_b'] . "," . $item_potensi['portion_person'] . ",sysdate()," . "'ADMIN',sysdate(),'ADMIN'" . ")";
if ($dbConn->query($sql)) {
} else {
deleteAll($t_vat_registration_id);
throw new Exception($dbConn->Errors->Errors[0]);
}
}
示例4: require_capability
// Delete a selected recording, after confirmation
if ($delete and confirm_sesskey()) {
require_capability('mod/virtualclass:recordingdelete', $context);
//require_capability('mod/virtualclass:addinstance', $context);
$record = $DB->get_record('virtualclass_files', array('id' => $delete), '*', MUST_EXIST);
if ($confirm != md5($delete)) {
echo $OUTPUT->header();
echo $OUTPUT->heading($strdelete . " " . $virtualclass->name);
$optionsyes = array('delete' => $delete, 'confirm' => md5($delete), 'sesskey' => sesskey());
echo $OUTPUT->confirm(get_string('deletecheckfull', '', "'{$record->vcsessionname}'"), new moodle_url($returnurl, $optionsyes), $returnurl);
echo $OUTPUT->footer();
die;
} else {
if (data_submitted()) {
$filepath = $CFG->dataroot . "/virtualclass/" . $record->courseid . "/" . $record->vcid . "/" . $record->vcsessionkey;
if (deleteAll($filepath)) {
$DB->delete_records('virtualclass_files', array('id' => $record->id));
\core\session\manager::gc();
// Remove stale sessions.
redirect($returnurl);
} else {
\core\session\manager::gc();
// Remove stale sessions.
echo $OUTPUT->notification($returnurl, get_string('deletednot', '', $record->vcsessionname));
}
}
}
}
echo $OUTPUT->header();
echo $OUTPUT->heading($virtualclass->name);
// If vidya.io API key missing.
示例5: deleteOutlet
function deleteOutlet($id)
{
$result = delete('outlets', $id);
deleteAll('outlet_category_map', array('outlet_id' => $id));
echo $result;
}
示例6: updateOffer
function updateOffer()
{
$request = Slim::getInstance()->request();
$body = $request->getBody();
$body = json_decode($body);
unset($body->date);
if (!empty($body->image)) {
file_put_contents('./voucher_images/' . $body->image->filename, base64_decode($body->image->base64));
$body->image = $body->image->filename;
} else {
unset($body->image);
}
$id = $body->id;
if (isset($body->image_url)) {
unset($body->image_url);
}
if (isset($body->id)) {
unset($body->id);
}
if (isset($body->weekdays)) {
$weekdays = $body->weekdays;
unset($body->weekdays);
}
if (isset($body->category_id)) {
$categories = $body->category_id;
unset($body->category_id);
}
if (isset($body->outlet_id)) {
$outlets = $body->outlet_id;
unset($body->outlet_id);
}
if (isset($body->restaurant_id)) {
$restaurants = $body->restaurant_id;
unset($body->restaurant_id);
}
if (!empty($body->item_start_hour)) {
$body->item_start_hour = date('H:i:s', strtotime($body->item_start_hour));
}
if (!empty($body->item_end_hour)) {
$body->item_end_hour = date('H:i:s', strtotime($body->item_end_hour));
}
$body->offer_to_date = $body->offer_to_date . ' 23:59:59';
$allinfo['save_data'] = $body;
//$allinfo['save_data']['offer_to_date'] = $body->offer_to_date.' 23:59:59';
//$allinfo['save_data']['offer_to_date'] = date('Y-m-d H:i:s', strtotime($allinfo['save_data']['offer_to_date'].' 23:59:59'));
$coupon_details = edit(json_encode($allinfo), 'offers', $id);
if (!empty($coupon_details)) {
$offers = json_decode($coupon_details);
deleteAll('offer_category_map', array('offer_id' => $offers->id));
if (!empty($categories)) {
foreach ($categories as $category) {
$temp = array();
$temp['offer_id'] = $offers->id;
$temp['category_id'] = $category->id;
add(json_encode(array('save_data' => $temp)), 'offer_category_map');
}
}
if (!empty($outlets)) {
deleteAll('offer_outlet_map', array('offer_id' => $offers->id));
foreach ($outlets as $outlet) {
$temp = array();
$temp['offer_id'] = $offers->id;
$temp['outlet_id'] = $outlet->id;
add(json_encode(array('save_data' => $temp)), 'offer_outlet_map');
}
}
if (!empty($restaurants)) {
deleteAll('offer_restaurent_map', array('offer_id' => $offers->id));
foreach ($restaurants as $restaurant) {
$temp = array();
$temp['offer_id'] = $offers->id;
$temp['restaurent_id'] = $restaurant->id;
add(json_encode(array('save_data' => $temp)), 'offer_restaurent_map');
}
}
if (!empty($weekdays)) {
deleteAll('offer_days_map', array('offer_id' => $offers->id));
foreach ($weekdays as $weekday) {
$temp = array();
$temp['offer_id'] = $offers->id;
$temp['day'] = $weekday->id;
add(json_encode(array('save_data' => $temp)), 'offer_days_map');
}
}
$result = '{"type":"success","message":"Changed Succesfully"}';
} else {
$result = '{"type":"error","message":"Not Changed"}';
}
echo $result;
}
示例7: deleteAll
/**
* @brief Deletes all files and folders recursively within a directory
* @param $directory The directory whose contents will be deleted
* @param $empty Flag indicating whether directory will be emptied
* @returns true/false
*
* @note By default the directory specified by $directory will be
* deleted together with its contents. To avoid this set $empty to true
*/
public function deleteAll($directory, $empty = false)
{
// strip leading slash
if (substr($directory, 0, 1) == "/") {
$directory = substr($directory, 1);
}
// strip trailing slash
if (substr($directory, -1) == "/") {
$directory = substr($directory, 0, -1);
}
if (!$this->file_exists(\OCP\USER::getUser() . '/' . $directory) || !$this->is_dir(\OCP\USER::getUser() . '/' . $directory)) {
return false;
} elseif (!$this->is_readable(\OCP\USER::getUser() . '/' . $directory)) {
return false;
} else {
$directoryHandle = $this->opendir(\OCP\USER::getUser() . '/' . $directory);
while ($contents = readdir($directoryHandle)) {
if ($contents != '.' && $contents != '..') {
$path = $directory . "/" . $contents;
if ($this->is_dir($path)) {
deleteAll($path);
} else {
$this->unlink(\OCP\USER::getUser() . '/' . $path);
// TODO: make unlink use same system path as is_dir
}
}
}
//$this->closedir( $directoryHandle ); // TODO: implement closedir in OC_FSV
if ($empty == false) {
if (!$this->rmdir($directory)) {
return false;
}
}
return true;
}
}
示例8: hesk_cleanExit
function hesk_cleanExit()
{
global $results;
// Delete the temporary files
deleteAll($results['tempdir']);
// Return NULL
return NULL;
}
示例9: updateBanner
function updateBanner($id)
{
$request = Slim::getInstance()->request();
$body = json_decode($request->getBody());
$outlets = '';
//print_r($body);exit;
$id = $body->id;
if (isset($body->id)) {
unset($body->id);
}
if (isset($body->outlet_id)) {
$outlets = $body->outlet_id;
}
unset($body->outlet_id);
if (isset($body->image_url)) {
unset($body->image_url);
}
if (!empty($body->image)) {
$body->image->filename = time() . $body->image->filename;
file_put_contents('./banner_images/' . $body->image->filename, base64_decode($body->image->base64));
$body->image = $body->image->filename;
} else {
unset($body->image);
}
//unset($body->image);
$allinfo['save_data'] = $body;
$location_details = edit(json_encode($allinfo), 'banners', $id);
if (!empty($location_details)) {
$restaurant_details = json_decode($location_details);
deleteAll('banners_outlet_map', array('banner_id' => $id));
if (!empty($outlets)) {
foreach ($outlets as $outlet) {
$temp = array();
$temp['banner_id'] = $id;
$temp['outlet_id'] = $outlet->id;
$data = add(json_encode(array('save_data' => $temp)), 'banners_outlet_map');
//echo $data;
}
}
//var_dump($location_details);
//exit;
$result = '{"type":"success","message":"Updated Succesfully"}';
} else {
$result = '{"type":"error","message":"Not Updated. Please try again."}';
}
echo $result;
}
示例10: updateEvent
function updateEvent($id)
{
$request = Slim::getInstance()->request();
$body = $request->getBody();
$body = json_decode($body);
$user_id = $id;
if (!empty($body->eventdata->from_date)) {
$body->eventdata->from_date = date('Y-m-d H:i:s', strtotime($body->eventdata->from_date));
}
if (!empty($body->eventdata->to_date)) {
$body->eventdata->to_date = date('Y-m-d H:i:s', strtotime($body->eventdata->to_date));
}
if (isset($body->eventdata->id)) {
unset($body->eventdata->id);
}
//print_r($body);
//exit;
if (empty($body->eventdata->image)) {
unset($body->eventdata->image);
}
if (isset($body->eventdata->imageurl)) {
unset($body->eventdata->imageurl);
}
$allinfo['save_data'] = $body->eventdata;
//print_r($allinfo);
//exit;
$result = edit(json_encode($allinfo), 'events', $id);
if ($result) {
deleteAll('event_location_map', array('event_id' => $id));
if (!empty($body->areadata)) {
foreach ($body->areadata as $areadata) {
$temp['save_data'] = array('event_id' => $id, 'location_id' => $areadata->id);
add(json_encode($temp), 'event_location_map');
}
}
deleteAll('event_category_map', array('event_id' => $id));
if (!empty($body->typedata)) {
foreach ($body->typedata as $typedata) {
//print_r($typedata);
$temp['save_data'] = array('event_id' => $id, 'category_id' => $typedata->id);
$s = add(json_encode($temp), 'event_category_map');
//var_dump
}
}
}
/*if(!empty($user_details)){
$result = '{"type":"success","message":"Updated Succesfully"}';
}else{
$result = '{"type":"error","message":"Try Again"}';
}*/
$result = '{"type":"success","message":"Updated Succesfully"}';
echo $result;
}
示例11: updateMerchantNews
function updateMerchantNews()
{
$request = Slim::getInstance()->request();
$body = json_decode($request->getBody());
$restaurants = array();
if (!empty($body->restaurants_ids)) {
$restaurants = $body->restaurants_ids;
unset($body->restaurants_ids);
}
$id = $body->id;
if (isset($body->id)) {
unset($body->id);
}
if ($body->featured_event) {
$body->featured_event = 1;
} else {
$body->featured_event = 0;
}
if ($body->special_event) {
$body->special_event = 1;
} else {
$body->special_event = 0;
}
if ($body->post_to_public) {
$body->post_to_public = 1;
} else {
$body->post_to_public = 0;
}
$body->date = date('Y-m-d H:i:s');
$body->published_date = date('Y-m-d', strtotime($body->published_date));
if (isset($body->imageurl)) {
unset($body->imageurl);
}
$allinfo['save_data'] = $body;
//print_r($allinfo);
//$allinfo['unique_data'] = $unique_field;
$cat_details = edit(json_encode($allinfo), 'news', $id);
//echo $cat_details;
//exit;
if (!empty($cat_details)) {
$ret_details = json_decode($cat_details);
deleteAll('news_restaurant_map', array('news_id' => $ret_details->id));
if (!empty($restaurants) && !empty($ret_details->id)) {
foreach ($restaurants as $restaurant) {
$temp = array();
$temp['news_id'] = $ret_details->id;
$temp['restaurant_id'] = $restaurant->id;
$s = add(json_encode(array('save_data' => $temp)), 'news_restaurant_map');
}
}
$result = '{"type":"success","message":"Added Succesfully"}';
} else {
$result = '{"type":"error","message":"Not Added"}';
}
echo $result;
exit;
}
示例12: updateMerchantOutlet
function updateMerchantOutlet()
{
$rarray = array();
$request = Slim::getInstance()->request();
$body = json_decode($request->getBody());
$locations = '';
//$categories = $body->category_id;
$outlet_id = $body->id;
unset($body->id);
if (isset($body->imageurl)) {
unset($body->imageurl);
}
if (isset($body->category_id)) {
unset($body->category_id);
}
if (isset($body->location_id)) {
$locations = $body->location_id;
unset($body->location_id);
}
//$body->restaurant_id = $body->restaurant_id;
$allinfo['save_data'] = $body;
$restaurant = findByIdArray($body->restaurant_id, 'merchantrestaurants');
//print_r($restaurant);
//exit;
if (!empty($restaurant)) {
$body->user_id = $restaurant['user_id'];
$cat_details = edit(json_encode($allinfo), 'merchantoutlets', $outlet_id);
//var_dump($cat_details);
//exit;
if (!empty($cat_details)) {
$cat_details = json_decode($cat_details);
if (!empty($locations)) {
deleteAll('outlet_location_map', array('outlet_id' => $outlet_id));
foreach ($locations as $location) {
$temp = array();
$temp['outlet_id'] = $outlet_id;
$temp['location_id'] = $location->id;
$data = add(json_encode(array('save_data' => $temp)), 'merchantoutlet_location_map');
}
}
$rarray = array('type' => 'success', 'message' => 'Updated Succesfully');
#$result = '{"type":"success","message":"Added Succesfully"}';
} else {
$rarray = array('type' => 'error', 'message' => 'Internal server error.');
}
} else {
$rarray = array('type' => 'error', 'message' => 'No restaurant found');
}
echo json_encode($rarray);
exit;
}
示例13: editOrganization
public function editOrganization()
{
global $myconn;
$private_key = $this->private_key;
$opOrg = $myconn->prepare("SELECT * FROM " . db_table_pref . "organizations WHERE ID=?") or die(mysqli_error($myconn));
$opOrg->bind_param('i', $this->OID);
$opOrg->execute();
$opOrg->store_result();
if ($opOrg->num_rows == 0) {
echo errMod('* ' . letheglobal_record_not_found . '', 'danger');
} else {
$sr = new Statement_Result($opOrg);
$opOrg->fetch();
}
$this->errPrint = '';
# Remove Organization
if (!$sr->Get('isPrimary')) {
if (isset($_POST['del']) && $_POST['del'] == 'YES') {
# Remove Folder
deleteAll(LETHE_RESOURCE . DIRECTORY_SEPARATOR . $sr->Get('orgTag'));
# Remove Blacklist
$myconn->query("DELETE FROM " . db_table_pref . "blacklist WHERE OID=" . $this->OID . "") or die(mysqli_error($myconn));
# Remove Autoresponder Actions
$myconn->query("DELETE FROM " . db_table_pref . "campaign_ar WHERE OID=" . $this->OID . "") or die(mysqli_error($myconn));
# Remove Campaign Groups
$myconn->query("DELETE FROM " . db_table_pref . "campaign_groups WHERE OID=" . $this->OID . "") or die(mysqli_error($myconn));
# Remove Campaigns
$myconn->query("DELETE FROM " . db_table_pref . "campaigns WHERE OID=" . $this->OID . "") or die(mysqli_error($myconn));
# Remove Organization Settings
$myconn->query("DELETE FROM " . db_table_pref . "organization_settings WHERE OID=" . $this->OID . "") or die(mysqli_error($myconn));
# Remove Organization
$myconn->query("DELETE FROM " . db_table_pref . "organizations WHERE ID=" . $this->OID . "") or die(mysqli_error($myconn));
# Reports
$myconn->query("DELETE FROM " . db_table_pref . "reports WHERE OID=" . $this->OID . "") or die(mysqli_error($myconn));
# Short Codes
$myconn->query("DELETE FROM " . db_table_pref . "short_codes WHERE OID=" . $this->OID . "") or die(mysqli_error($myconn));
# Form Fields
$myconn->query("DELETE FROM " . db_table_pref . "subscribe_form_fields WHERE OID=" . $this->OID . "") or die(mysqli_error($myconn));
# Forms
$myconn->query("DELETE FROM " . db_table_pref . "subscribe_forms WHERE OID=" . $this->OID . "") or die(mysqli_error($myconn));
# Subscriber Groups
$myconn->query("DELETE FROM " . db_table_pref . "subscriber_groups WHERE OID=" . $this->OID . "") or die(mysqli_error($myconn));
# Subscribers
$myconn->query("DELETE FROM " . db_table_pref . "subscribers WHERE OID=" . $this->OID . "") or die(mysqli_error($myconn));
# Tasks
$myconn->query("DELETE FROM " . db_table_pref . "tasks WHERE OID=" . $this->OID . "") or die(mysqli_error($myconn));
# Templates
$myconn->query("DELETE FROM " . db_table_pref . "templates WHERE OID=" . $this->OID . "") or die(mysqli_error($myconn));
# Unsubscribes
$myconn->query("DELETE FROM " . db_table_pref . "unsubscribes WHERE OID=" . $this->OID . "") or die(mysqli_error($myconn));
# User Permissions
$myconn->query("DELETE FROM " . db_table_pref . "user_permissions WHERE OID=" . $this->OID . "") or die(mysqli_error($myconn));
# Users
$myconn->query("DELETE FROM " . db_table_pref . "users WHERE OID=" . $this->OID . "") or die(mysqli_error($myconn));
# Remove Cron Tasks
include_once LETHE_ADMIN . DIRECTORY_SEPARATOR . 'classes/class.chronos.php';
$letChr = new Crontab();
$opCron = $myconn->query("SELECT * FROM " . db_table_pref . "chronos WHERE OID=" . $this->OID . "") or die(mysqli_error($myconn));
while ($opCronRs = $opCron->fetch_assoc()) {
$letChr->removeJob($opCronRs['cron_command']);
}
$opCron->free();
# Remove Crons
$myconn->query("DELETE FROM " . db_table_pref . "chronos WHERE OID=" . $this->OID . "") or die(mysqli_error($myconn));
# Done!
header('Location: ?p=organizations/organization');
return false;
die;
}
}
if (!isset($_POST['org_name']) || empty($_POST['org_name'])) {
$this->errPrint .= '* ' . organizations_please_enter_a_organization_name . '<br>';
}
if (LETHE_AUTH_MODE == 2 && PRO_MODE) {
if (!isset($_POST['org_max_user']) || !is_numeric($_POST['org_max_user'])) {
$this->errPrint .= '* ' . organizations_please_enter_a_maximum_user_limit . '<br>';
}
if (!isset($_POST['org_max_newsletter']) || !is_numeric($_POST['org_max_newsletter'])) {
$this->errPrint .= '* ' . organizations_please_enter_a_maximum_newsletter_limit . '<br>';
}
if (!isset($_POST['org_max_autoresponder']) || !is_numeric($_POST['org_max_autoresponder'])) {
$this->errPrint .= '* ' . organizations_please_enter_a_maximum_autoresponder_limit . '<br>';
}
if (!isset($_POST['org_max_subscriber']) || !is_numeric($_POST['org_max_subscriber'])) {
$this->errPrint .= '* ' . organizations_please_enter_a_maximum_subscriber_limit . '<br>';
}
if (!isset($_POST['org_max_subscriber_group']) || !is_numeric($_POST['org_max_subscriber_group'])) {
$this->errPrint .= '* ' . organizations_please_enter_a_maximum_subscriber_group_limit . '<br>';
}
if (!isset($_POST['org_max_subscribe_form']) || !is_numeric($_POST['org_max_subscribe_form'])) {
$this->errPrint .= '* ' . organizations_please_enter_a_maximum_subscribe_form_limit . '<br>';
}
if (!isset($_POST['org_max_blacklist']) || !is_numeric($_POST['org_max_blacklist'])) {
$this->errPrint .= '* ' . organizations_please_enter_a_maximum_black_list_limit . '<br>';
}
if (!isset($_POST['org_max_template']) || !is_numeric($_POST['org_max_template'])) {
$this->errPrint .= '* ' . organizations_please_enter_a_maximum_template_limit . '<br>';
}
if (!isset($_POST['org_max_shortcode']) || !is_numeric($_POST['org_max_shortcode'])) {
$this->errPrint .= '* ' . organizations_please_enter_maximum_short_code_limit . '<br>';
//.........这里部分代码省略.........
示例14: header
if ($_GET['act'] == 'delete') {
$file = $db->get_row("SELECT * FROM `" . MAI_PREFIX . "files` WHERE `id`='{$fid}'");
if (!$file) {
header("Location: {$set->url}");
exit;
}
$plugins->run_hook("admin_actions_delete_top");
if ($file->size > 0) {
$links[] = mai_img("arr.gif") . " <a href='{$set->url}/data/file/{$file->id}/" . mai_converturl($file->name) . ".html'>{$file->name} </a>";
} else {
$links[] = mai_img("arr.gif") . " <a href='{$set->url}/data/{$file->id}/" . mai_converturl($file->name) . ".html'>{$file->name} </a>";
}
$links[] = mai_img("arr.gif") . " {$lang->delete} ";
if ($_POST['yes']) {
if (is_dir(".." . $file->path)) {
deleteAll(".." . $file->path);
$db->query("DELETE FROM `" . MAI_PREFIX . "files` WHERE `path` LIKE '{$file->path}%'");
$plugins->run_hook("admin_actions_delete_a");
} else {
@unlink(".." . $file->path);
$db->query("DELETE FROM `" . MAI_PREFIX . "files` WHERE `id`='{$file->id}'");
$plugins->run_hook("admin_actions_delete_b");
}
$form = "<div class='green'>{$lang->data_gone}</div>";
} else {
$form .= "<form action='#' method='post'>\n\t\t{$lang->are_you_sure} <br/>\n\t\t\t<input type='submit' name='yes' value='{$lang->yes}'> <a href='{$set->url}'> {$lang->no} </a>\n\t\t</form>";
}
$plugins->run_hook("admin_actions_delete_end");
}
include "../header.php";
$tpl->grab("admin_actions.tpl", "admin_actions");
示例15: array_push
{
array_push($_SESSION['player_results'], $this);
}
function getAll()
{
return $_SESSION['player_results'];
}
function deleteAll()
{
$_SESSION['player_results'] = array();
}
use Symfony\Component\Debug\Debug;
Debug::enable();
$app = new Silex\Application();
$app['debug'] = true;
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . "/../views"));
$app->get("/", function () use($app) {
deleteAll();
return $app['twig']->render('home.html.twig');
});
$app->post("/player2", function () use($app) {
save($_POST);
return $app['twig']->render('player2.html.twig', getAll($_SESSION['player_results']));
});
$app->post("/results", function () use($app) {
save($_POST);
$results = new RockPaperScissors();
$results_array = $results->rockPaperScissorsGame($_SESSION['player_results'][0]['player1'], $_SESSION['player_results'][1]['player2']);
return $app['twig']->render('results.html.twig', array('results' => $results_array));
});
return $app;