Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
target-branch: develop
4 changes: 2 additions & 2 deletions generated-classes/TechWilk/Rota/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public function setPassword($v)

if (!password_verify($v, $this->password)) {
$bcrypt_options = [
'cost' => 12,
];
'cost' => 12,
];
$this->password = password_hash($v, PASSWORD_BCRYPT, $bcrypt_options);

$this->modifiedColumns[UserTableMap::COL_PASSWORD] = true;
Expand Down
44 changes: 22 additions & 22 deletions generated-conf/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,35 @@
$serviceContainer->setAdapterClass('default', 'mysql');
$manager = new \Propel\Runtime\Connection\ConnectionManagerSingle();
$manager->setConfiguration([
'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper',
'dsn' => 'mysql:host='.$config['db']['host'].';dbname='.$config['db']['dbname'],
'user' => $config['db']['user'],
'password' => $config['db']['pass'],
'attributes' => [
'ATTR_EMULATE_PREPARES' => false,
'ATTR_TIMEOUT' => 30,
],
'model_paths' => [
0 => 'src',
1 => 'vendor',
],
'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper',
'dsn' => 'mysql:host='.$config['db']['host'].';dbname='.$config['db']['dbname'],
'user' => $config['db']['user'],
'password' => $config['db']['pass'],
'attributes' => [
'ATTR_EMULATE_PREPARES' => false,
'ATTR_TIMEOUT' => 30,
],
'model_paths' => [
0 => 'src',
1 => 'vendor',
],
]);
$manager->setName('default');
$serviceContainer->setConnectionManager('default', $manager);

$serviceContainer->setAdapterClass('test', 'sqlite');
$manager = new \Propel\Runtime\Connection\ConnectionManagerSingle();
$manager->setConfiguration([
'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper',
'dsn' => 'sqlite:/var/tmp/test.db',
'attributes' => [
'ATTR_EMULATE_PREPARES' => false,
'ATTR_TIMEOUT' => 30,
],
'model_paths' => [
0 => 'src',
1 => 'vendor',
],
'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper',
'dsn' => 'sqlite:/var/tmp/test.db',
'attributes' => [
'ATTR_EMULATE_PREPARES' => false,
'ATTR_TIMEOUT' => 30,
],
'model_paths' => [
0 => 'src',
1 => 'vendor',
],
]);
$manager->setName('test');
$serviceContainer->setConnectionManager('test', $manager);
Expand Down
8 changes: 4 additions & 4 deletions generated-migrations/PropelMigration_1494860053.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function postDown(MigrationManager $manager)
public function getUpSQL()
{
return [
'default' => '
'default' => '
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;
Expand Down Expand Up @@ -160,7 +160,7 @@ public function getUpSQL()
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;
',
];
];
}

/**
Expand All @@ -172,7 +172,7 @@ public function getUpSQL()
public function getDownSQL()
{
return [
'default' => '
'default' => '
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;
Expand Down Expand Up @@ -270,6 +270,6 @@ public function getDownSQL()
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;
',
];
];
}
}
86 changes: 42 additions & 44 deletions public/api/v1/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,68 +17,66 @@ function isAdmin()
}
}

if (isAdmin()):
if (isAdmin()) {

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Start of API
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Start of API
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

require_once __DIR__.'/../../../vendor/autoload.php';
require_once __DIR__.'/../../../vendor/autoload.php';

require_once __DIR__.'/../../../generated-conf/config.php';
require_once __DIR__.'/../../../generated-conf/config.php';

// Create and configure Slim app
$app = new \Slim\App(['settings' => $config]);
// Create and configure Slim app
$app = new \Slim\App(['settings' => $config]);

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Containers for DI
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Containers for DI
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$container = $app->getContainer();
$container = $app->getContainer();

$container['db'] = function ($c) {
$db_config = $c['settings']['db'];
$db = new Database($db_config);
$container['db'] = function ($c) {
$db_config = $c['settings']['db'];
$db = new Database($db_config);

return $db;
};
return $db;
};

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Define app routes
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Define app routes
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

// ~~~~~~~~~~~~~~~ Series ~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~ Series ~~~~~~~~~~~~~~~

$app->post('/series', function ($request, $response, $args) {
$postData = $request->getParsedBody();
$app->post('/series', function ($request, $response, $args) {
$postData = $request->getParsedBody();

$name = filter_var($postData['name'], FILTER_SANITIZE_STRING);
$description = filter_var($postData['description'], FILTER_SANITIZE_STRING);
$name = filter_var($postData['name'], FILTER_SANITIZE_STRING);
$description = filter_var($postData['description'], FILTER_SANITIZE_STRING);

$series = new EventGroup();
$series->setName($name);
$series->setDescription($description);
$series->save();
$series = new EventGroup();
$series->setName($name);
$series->setDescription($description);
$series->save();

$data = [
'data' => [
'id' => $series->getId(),
'name' => $series->getName(),
'description' => $series->getDescription(),
],
];
$data = [
'data' => [
'id' => $series->getId(),
'name' => $series->getName(),
'description' => $series->getDescription(),
],
];

return $response->withJson($data);
});
return $response->withJson($data);
});

// Run app
$app->run();
// Run app
$app->run();

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// End of very very very basic auth
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

else:
http_response_code(401);

endif;
} else {
http_response_code(401);
}
2 changes: 1 addition & 1 deletion public/old/cr_daily.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
date >= CURDATE()
AND date_format( date , "%y-%m-%d" )
<= date_format( DATE_ADD(now(), INTERVAL '.$daysAlert.' DAY ) , "%y-%m-%d" )';
$resultEvents = mysqli_query(db(), $sqlEvents) or die(mysqli_error(db()));
$resultEvents = mysqli_query(db(), $sqlEvents) or exit(mysqli_error(db()));
$i = 0;
while ($rowEvents = mysqli_fetch_array($resultEvents, MYSQLI_ASSOC)) {
$usersNotified = notifyEveryoneForEvent($rowEvents['id']);
Expand Down
48 changes: 24 additions & 24 deletions public/old/createEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
(SELECT name FROM eventSubTypes WHERE eventSubTypes.id = events.subType) AS subtypename,
(SELECT name FROM eventGroups WHERE eventGroups.id = events.eventGroup) AS groupname
FROM events WHERE id = '$eventID'";
$result = mysqli_query(db(), $sql) or die(mysqli_error(db()));
$result = mysqli_query(db(), $sql) or exit(mysqli_error(db()));

while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
if ($action == 'edit') {
Expand Down Expand Up @@ -145,11 +145,11 @@
if ($action == 'edit') {
$sql = "UPDATE events SET date = '$date', rehearsalDate = '$rehersalDate', location = '$location',
rehearsal = '$norehearsal', type = '$type', subType = '$subType', name = '$eventName', eventGroup = '$eventGroup', sermonTitle = '$sermonTitle', bibleVerse = '$bibleVerse' WHERE id = '$id'";
mysqli_query(db(), $sql) or die(mysqli_error(db()));
mysqli_query(db(), $sql) or exit(mysqli_error(db()));
} else {
$sql = "INSERT INTO events (date, createdBy, rehearsalDate, type, subType, location, rehearsal, name, eventGroup, sermonTitle, bibleVerse)
VALUES ('$date', '$sessionUserID','$rehersalDate', '$type', '$subType', '$location', '$norehearsal', '$eventName', '$eventGroup', '$sermonTitle', '$bibleVerse')";
mysqli_query(db(), $sql) or die(mysqli_error(db()));
mysqli_query(db(), $sql) or exit(mysqli_error(db()));
$id = mysqli_insert_id(db());
$eventID = mysqli_insert_id(db());
}
Expand All @@ -172,7 +172,7 @@
//if ($userisBandAdmin) $sql = $sql . " AND userRoleId IN (SELECT id FROM userRoles WHERE groupid IN (2,3,4))";
//if ($userisEventEditor) $sql = $sql . " AND userRoleId IN (SELECT id FROM userRoles WHERE NOT (groupid IN (2,3,4)))";

$result = mysqli_query(db(), $sql) or die(mysqli_error(db()));
$result = mysqli_query(db(), $sql) or exit(mysqli_error(db()));

while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
// We're going to put it all in a nice array called membersArray
Expand Down Expand Up @@ -214,7 +214,7 @@
if ($userisEventEditor) {
$delete_all_sql = $delete_all_sql.' and skillID in (select skillID from skills where not (groupid in (2,3,4)))';
}
mysqli_query(db(), $delete_all_sql) or die(mysqli_error(db()));
mysqli_query(db(), $delete_all_sql) or exit(mysqli_error(db()));
}

// redirect
Expand Down Expand Up @@ -295,7 +295,7 @@
} ?></option>
<?php
$sql = 'SELECT id, name, description, defaultTime, defaultLocationId FROM eventTypes ORDER BY name';
$result = mysqli_query(db(), $sql) or die(mysqli_error(db()));
$result = mysqli_query(db(), $sql) or exit(mysqli_error(db()));
while ($ob = mysqli_fetch_object($result)) {
if (!(isset($type) && $ob->id == $type)) {
$defaultTime = strftime('%H:%M', strtotime($ob->defaultTime));
Expand All @@ -320,7 +320,7 @@
} ?></option>
<?php
$sql = 'SELECT * FROM eventSubTypes ORDER BY name';
$result = mysqli_query(db(), $sql) or die(mysqli_error(db()));
$result = mysqli_query(db(), $sql) or exit(mysqli_error(db()));

while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
if (isset($subtype) && $row['id'] == $subtype) {
Expand Down Expand Up @@ -348,7 +348,7 @@
} ?></option>
<?php
$sql = 'SELECT * FROM locations order by name';
$result = mysqli_query(db(), $sql) or die(mysqli_error(db()));
$result = mysqli_query(db(), $sql) or exit(mysqli_error(db()));

while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
if (isset($location) && $row['id'] == $location) {
Expand Down Expand Up @@ -479,7 +479,7 @@
<option value="<?php echo isset($eventGroup) ? $eventGroup : '' ?>"><?php echo isset($eventGroupName) ? $eventGroupName : '' ?></option>
<?php
$sql = 'SELECT * FROM eventGroups WHERE archived = false ORDER BY name';
$result = mysqli_query(db(), $sql) or die(mysqli_error(db()));
$result = mysqli_query(db(), $sql) or exit(mysqli_error(db()));

while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
if (isset($type) && $row['id'] == $type) {
Expand Down Expand Up @@ -543,38 +543,38 @@
}
$groups = GroupQuery::create()->joinWith('Group.Role')->joinWith('Role.UserRole')->find();

foreach ($groups as $group): ?>
foreach ($groups as $group) { ?>
<legend><?php echo $group->getName() ?></legend>
<?php foreach ($group->getRoles() as $role): ?>
<?php foreach ($group->getRoles() as $role) { ?>
<div class="form-group col-md-6">
<label><?php echo $role->getName() ?></label>
<select name="userRole[]" multiple="multiple" class="form-control multi" style="width:100%;" data-placeholder="Select people for <?php echo $role->getName() ?>">
<optgroup label="Regular">
<?php $countReserve = 0 ?>
<?php foreach ($role->getUserRoles() as $userRole): ?>
<?php if (!$userRole->getReserve()): ?>
<?php foreach ($role->getUserRoles() as $userRole) { ?>
<?php if (!$userRole->getReserve()) { ?>
<?php $isInEvent = in_array($userRole->getId(), $usersInEvent) ?>
<option value="<?php echo $userRole->getId() ?>" <?php echo $isInEvent ? 'selected="selected"' : '' ?>><?php echo $userRole->getUser()->getFirstName().' '.$userRole->getUser()->getLastName() ?></option>
<?php else: ?>
<?php } else { ?>
<?php $countReserve += 1 ?>
<?php endif //!userRole->getReserve?>
<?php endforeach //users?>
<?php } //!userRole->getReserve?>
<?php } //users?>
</optgroup>
<?php if ($countReserve > 0): ?>
<?php if ($countReserve > 0) { ?>
<optgroup label="Reserve">
<?php foreach ($role->getUserRoles() as $userRole): ?>
<?php if ($userRole->getReserve()): ?>
<?php foreach ($role->getUserRoles() as $userRole) { ?>
<?php if ($userRole->getReserve()) { ?>
<?php $isInEvent = in_array($userRole->getId(), $usersInEvent) ?>
<option value="<?php echo $userRole->getId() ?>" <?php echo $isInEvent ? 'selected="selected"' : '' ?>><?php echo $userRole->getUser()->getFirstName().' '.$userRole->getUser()->getLastName() ?></option>
<?php endif ?>
<?php endforeach //users?>
<?php } ?>
<?php } //users?>
</optgroup>
<?php endif //countReserve > 0?>
<?php } //countReserve > 0?>
</select>
</div>
<?php endforeach // roles?>
<?php } // roles?>

<?php endforeach // groups?>
<?php } // groups?>

<?php /*

Expand Down
Loading