@@ -1,22 +1,22 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once __DIR__ . '/vendor/autoload.php'; |
|
| 3 | +require_once __DIR__.'/vendor/autoload.php'; |
|
| 4 | 4 | |
| 5 | 5 | use smtech\StMarksReflexiveCanvasLTIExample\Toolbox; |
| 6 | 6 | use smtech\ReflexiveCanvasLTI\LTI\ToolProvider; |
| 7 | 7 | use Battis\DataUtilities; |
| 8 | 8 | |
| 9 | -define('CONFIG_FILE', __DIR__ . '/config.xml'); |
|
| 9 | +define('CONFIG_FILE', __DIR__.'/config.xml'); |
|
| 10 | 10 | define('CANVAS_INSTANCE_URL', 'canvas_instance_url'); |
| 11 | 11 | |
| 12 | 12 | @session_start(); // TODO I don't feel good about suppressing warnings |
| 13 | 13 | |
| 14 | 14 | /* prepare the toolbox */ |
| 15 | 15 | if (empty($_SESSION[Toolbox::class])) { |
| 16 | - $_SESSION[Toolbox::class] =& Toolbox::fromConfiguration(CONFIG_FILE); |
|
| 16 | + $_SESSION[Toolbox::class] = & Toolbox::fromConfiguration(CONFIG_FILE); |
|
| 17 | 17 | } |
| 18 | -$toolbox =& $_SESSION[Toolbox::class]; |
|
| 19 | -$toolbox->smarty_prependTemplateDir(__DIR__ . '/templates', basename(__DIR__)); |
|
| 18 | +$toolbox = & $_SESSION[Toolbox::class]; |
|
| 19 | +$toolbox->smarty_prependTemplateDir(__DIR__.'/templates', basename(__DIR__)); |
|
| 20 | 20 | $toolbox->smarty_assign([ |
| 21 | 21 | 'category' => DataUtilities::titleCase(preg_replace('/[\-_]+/', ' ', basename(__DIR__))) |
| 22 | 22 | ]); |
@@ -25,5 +25,5 @@ discard block |
||
| 25 | 25 | if (empty($_SESSION[CANVAS_INSTANCE_URL]) && |
| 26 | 26 | !empty($_SESSION[ToolProvider::class]['canvas']['api_domain']) |
| 27 | 27 | ) { |
| 28 | - $_SESSION[CANVAS_INSTANCE_URL] = 'https://' . $_SESSION[ToolProvider::class]['canvas']['api_domain']; |
|
| 28 | + $_SESSION[CANVAS_INSTANCE_URL] = 'https://'.$_SESSION[ToolProvider::class]['canvas']['api_domain']; |
|
| 29 | 29 | } |
@@ -13,8 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | /* store any requested actions for future handling */ |
| 15 | 15 | $action = (empty($_REQUEST['action']) ? |
| 16 | - ACTION_UNSPECIFIED : |
|
| 17 | - strtolower($_REQUEST['action']) |
|
| 16 | + ACTION_UNSPECIFIED : strtolower($_REQUEST['action']) |
|
| 18 | 17 | ); |
| 19 | 18 | |
| 20 | 19 | /* action requests only come from outside the LTI! */ |
@@ -32,7 +31,7 @@ discard block |
||
| 32 | 31 | /* if authenticated LTI launch, get the current user profile */ |
| 33 | 32 | if (!empty($_SESSION[ToolProvider::class]['canvas'])) { |
| 34 | 33 | try { |
| 35 | - $profile = $toolbox->api_get('users/' . $_SESSION[ToolProvider::class]['canvas']['user_id'] . '/profile'); |
|
| 34 | + $profile = $toolbox->api_get('users/'.$_SESSION[ToolProvider::class]['canvas']['user_id'].'/profile'); |
|
| 36 | 35 | } catch (Exception $e) { |
| 37 | 36 | $toolbox->smarty_addMessage( |
| 38 | 37 | 'Error', |
@@ -49,8 +48,7 @@ discard block |
||
| 49 | 48 | /* if not authenticated, default to showing credentials */ |
| 50 | 49 | } else { |
| 51 | 50 | $action = (empty($action) ? |
| 52 | - ACTION_CONFIG : |
|
| 53 | - $action |
|
| 51 | + ACTION_CONFIG : $action |
|
| 54 | 52 | ); |
| 55 | 53 | } |
| 56 | 54 | |
@@ -59,7 +57,7 @@ discard block |
||
| 59 | 57 | /* reset cached install data from config file */ |
| 60 | 58 | case ACTION_INSTALL: |
| 61 | 59 | $_SESSION['toolbox'] = Toolbox::fromConfiguration(CONFIG_FILE, true); |
| 62 | - $toolbox =& $_SESSION['toolbox']; |
|
| 60 | + $toolbox = & $_SESSION['toolbox']; |
|
| 63 | 61 | |
| 64 | 62 | /* test to see if we can connect to the API */ |
| 65 | 63 | try { |
@@ -10,21 +10,21 @@ |
||
| 10 | 10 | $smarty->assign([ |
| 11 | 11 | 'content' => '<h3>Course Calendar ICS Feed</h3> |
| 12 | 12 | <p>You can subscribe to the calendar for <a href="https://' . |
| 13 | - $_SESSION[CANVAS_INSTANCE_URL] . '/courses/' . $courseId . |
|
| 14 | - '">' . $course['name'] . '</a> at <a href="' . |
|
| 15 | - $webcalFeed . '">' . $webcalFeed . |
|
| 13 | + $_SESSION[CANVAS_INSTANCE_URL].'/courses/'.$courseId. |
|
| 14 | + '">'.$course['name'].'</a> at <a href="'. |
|
| 15 | + $webcalFeed.'">'.$webcalFeed. |
|
| 16 | 16 | '</a> in any calendar application that supports external ICS feeds.</p>' |
| 17 | 17 | ]); |
| 18 | 18 | } else { |
| 19 | 19 | $messages[] = array( |
| 20 | 20 | 'class' => 'error', |
| 21 | 21 | 'title' => 'Canvas API Error', |
| 22 | - 'content' => 'The course you requested could not be accessed.<pre>' . print_r($json, false) . '</pre>' |
|
| 22 | + 'content' => 'The course you requested could not be accessed.<pre>'.print_r($json, false).'</pre>' |
|
| 23 | 23 | ); |
| 24 | 24 | } |
| 25 | 25 | } else { |
| 26 | 26 | $smarty->assign('content', ' |
| 27 | - <form method="post" action="' . $_SERVER['PHP_SELF'] . '"> |
|
| 27 | + <form method="post" action="' . $_SERVER['PHP_SELF'].'"> |
|
| 28 | 28 | <label for="course_url">Course URL <span class="comment">The URL to the course whose calendar you would like to export as an ICS feed</span></label> |
| 29 | 29 | <input id="course_url" name="course_url" type="text" /> |
| 30 | 30 | <input type="submit" value="Generate ICS Feed" /> |
@@ -1,20 +1,20 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once __DIR__ . '/vendor/autoload.php'; |
|
| 3 | +require_once __DIR__.'/vendor/autoload.php'; |
|
| 4 | 4 | |
| 5 | 5 | use smtech\StMarksSmarty\StMarksSmarty; |
| 6 | 6 | use Battis\ConfigXML; |
| 7 | 7 | use Battis\HierarchicalSimpleCache; |
| 8 | 8 | |
| 9 | 9 | $smarty = StMarksSmarty::getSmarty(); |
| 10 | -$smarty->addTemplateDir(__DIR__ . '/templates'); |
|
| 10 | +$smarty->addTemplateDir(__DIR__.'/templates'); |
|
| 11 | 11 | |
| 12 | 12 | if (empty($_REQUEST['url'])) { |
| 13 | 13 | $smarty->display('visualize-form.tpl'); |
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -$config = new ConfigXML(__DIR__ . '/secrets.xml'); |
|
| 17 | +$config = new ConfigXML(__DIR__.'/secrets.xml'); |
|
| 18 | 18 | |
| 19 | 19 | $sql = $config->newInstanceOf(mysqli::class, 'mysql'); |
| 20 | 20 | |
@@ -33,5 +33,5 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $smarty->assign('ics', $ics); |
| 36 | -$smarty->assign('veventProperties', array('unique' => array('CLASS','CREATED','SUMMARY','DESCRIPTION','DTSTART','X-CURRENT-DTSTART','DTEND','X-CURRENT-DTEND','DURATION','GEO','LAST-MOD','LOCATION','ORGANIZER','PRIORITY','DTSTAMP','SEQ','STATUS','TRANSP','UID','URL','RECURID'),'multiple'=>array('ATTACH','ATTENDEE','CATEGORIES','COMMENT','CONTACT','EXDATE','EXRULE','RSTATUS','RELATED','RESOURCES','RDATE','RRULE','X-PROP'))); |
|
| 36 | +$smarty->assign('veventProperties', array('unique' => array('CLASS', 'CREATED', 'SUMMARY', 'DESCRIPTION', 'DTSTART', 'X-CURRENT-DTSTART', 'DTEND', 'X-CURRENT-DTEND', 'DURATION', 'GEO', 'LAST-MOD', 'LOCATION', 'ORGANIZER', 'PRIORITY', 'DTSTAMP', 'SEQ', 'STATUS', 'TRANSP', 'UID', 'URL', 'RECURID'), 'multiple'=>array('ATTACH', 'ATTENDEE', 'CATEGORIES', 'COMMENT', 'CONTACT', 'EXDATE', 'EXRULE', 'RSTATUS', 'RELATED', 'RESOURCES', 'RDATE', 'RRULE', 'X-PROP'))); |
|
| 37 | 37 | $smarty->display('visualize.tpl'); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | // TODO: it would probably be better to look up users by email address than URL |
| 36 | 36 | /* get the context (user, course or group) for the canvas URL */ |
| 37 | 37 | $canvasContext = array(); |
| 38 | - if (preg_match('%(https?://)?(' . parse_url($metadata['CANVAS_INSTANCE_URL'], PHP_URL_HOST) . '/((about/(\d+))|(courses/(\d+)(/groups/(\d+))?)|(accounts/\d+/groups/(\d+))))%', $_REQUEST['canvas_url'], $matches)) { |
|
| 38 | + if (preg_match('%(https?://)?('.parse_url($metadata['CANVAS_INSTANCE_URL'], PHP_URL_HOST).'/((about/(\d+))|(courses/(\d+)(/groups/(\d+))?)|(accounts/\d+/groups/(\d+))))%', $_REQUEST['canvas_url'], $matches)) { |
|
| 39 | 39 | $canvasContext['canonical_url'] = "https://{$matches[2]}"; // https://stmarksschool.instructure.com/courses/953 |
| 40 | 40 | |
| 41 | 41 | // course or account groups |
@@ -106,14 +106,14 @@ discard block |
||
| 106 | 106 | if ($canvasObject = $api->get($canvasContext['verification_url'])) { |
| 107 | 107 | /* calculate the unique pairing ID of this ICS feed and canvas object */ |
| 108 | 108 | $pairingHash = $toolbox->getPairingHash($_REQUEST['cal'], $canvasContext['canonical_url']); |
| 109 | - $log = Log::singleton('file', __DIR__ . "/logs/$pairingHash.log"); |
|
| 109 | + $log = Log::singleton('file', __DIR__."/logs/$pairingHash.log"); |
|
| 110 | 110 | postMessage('Sync started', getSyncTimestamp(), NotificationMessage::INFO); |
| 111 | 111 | |
| 112 | 112 | /* tell users that it's started and to cool their jets */ |
| 113 | 113 | if (php_sapi_name() != 'cli') { |
| 114 | 114 | $smarty->assign([ |
| 115 | 115 | 'content' => '<h3>Calendar Import Started</h3> |
| 116 | - <p>The calendar import that you requested has begun. You may leave this page at anytime. You can see the progress of the import by visiting <a target="_blank" href="' . $_SESSION[CANVAS_INSTANCE_URL] . "/calendar?include_contexts={$canvasContext['context']}_{$canvasObject['id']}\">this calendar</a> in Canvas.</p>" |
|
| 116 | + <p>The calendar import that you requested has begun. You may leave this page at anytime. You can see the progress of the import by visiting <a target="_blank" href="' . $_SESSION[CANVAS_INSTANCE_URL]."/calendar?include_contexts={$canvasContext['context']}_{$canvasObject['id']}\">this calendar</a> in Canvas.</p>" |
|
| 117 | 117 | ]); |
| 118 | 118 | $smarty->display('page.tpl'); |
| 119 | 119 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $sql->query(" |
| 142 | 142 | UPDATE `calendars` |
| 143 | 143 | SET |
| 144 | - `synced` = '" . getSyncTimestamp() . "' |
|
| 144 | + `synced` = '" . getSyncTimestamp()."' |
|
| 145 | 145 | WHERE |
| 146 | 146 | `id` = '$pairingHash' |
| 147 | 147 | "); |
@@ -160,13 +160,13 @@ discard block |
||
| 160 | 160 | ) |
| 161 | 161 | VALUES ( |
| 162 | 162 | '$pairingHash', |
| 163 | - '" . $sql->real_escape_string($ics->getProperty('X-WR-CALNAME')) . "', |
|
| 163 | + '".$sql->real_escape_string($ics->getProperty('X-WR-CALNAME'))."', |
|
| 164 | 164 | '{$_REQUEST['cal']}', |
| 165 | 165 | '{$canvasContext['canonical_url']}', |
| 166 | - '" . getSyncTimestamp() . "', |
|
| 167 | - '" . ($_REQUEST['enable_regexp_filter'] == VALUE_ENABLE_REGEXP_FILTER) . "', |
|
| 168 | - " . ($_REQUEST['enable_regexp_filter'] == VALUE_ENABLE_REGEXP_FILTER ? "'" . $sql->real_escape_string($_REQUEST['include_regexp']) . "'" : 'NULL') . ", |
|
| 169 | - " . ($_REQUEST['enable_regexp_filter'] == VALUE_ENABLE_REGEXP_FILTER ? "'" . $sql->real_escape_string($_REQUEST['exclude_regexp']) . "'" : 'NULL') . " |
|
| 166 | + '".getSyncTimestamp()."', |
|
| 167 | + '" . ($_REQUEST['enable_regexp_filter'] == VALUE_ENABLE_REGEXP_FILTER)."', |
|
| 168 | + " . ($_REQUEST['enable_regexp_filter'] == VALUE_ENABLE_REGEXP_FILTER ? "'".$sql->real_escape_string($_REQUEST['include_regexp'])."'" : 'NULL').", |
|
| 169 | + " . ($_REQUEST['enable_regexp_filter'] == VALUE_ENABLE_REGEXP_FILTER ? "'".$sql->real_escape_string($_REQUEST['exclude_regexp'])."'" : 'NULL')." |
|
| 170 | 170 | ) |
| 171 | 171 | "); |
| 172 | 172 | } |
@@ -186,10 +186,10 @@ discard block |
||
| 186 | 186 | // TODO:0 the best window for syncing would be the term of the course in question, right? issue:12 |
| 187 | 187 | // TODO:0 Arbitrarily selecting events in for a year on either side of today's date, probably a better system? issue:12 |
| 188 | 188 | foreach ($ics->selectComponents( |
| 189 | - date('Y')-1, // startYear |
|
| 189 | + date('Y') - 1, // startYear |
|
| 190 | 190 | date('m'), // startMonth |
| 191 | 191 | date('d'), // startDay |
| 192 | - date('Y')+1, // endYEar |
|
| 192 | + date('Y') + 1, // endYEar |
|
| 193 | 193 | date('m'), // endMonth |
| 194 | 194 | date('d'), // endDay |
| 195 | 195 | 'vevent', // cType |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | $sql->query(" |
| 223 | 223 | UPDATE `events` |
| 224 | 224 | SET |
| 225 | - `synced` = '" . getSyncTimestamp() . "' |
|
| 225 | + `synced` = '" . getSyncTimestamp()."' |
|
| 226 | 226 | WHERE |
| 227 | 227 | `id` = '{$eventCache['id']}' |
| 228 | 228 | "); |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | '{$calendarCache['id']}', |
| 264 | 264 | '{$calendarEvent['id']}', |
| 265 | 265 | '$eventHash', |
| 266 | - '" . getSyncTimestamp() . "' |
|
| 266 | + '".getSyncTimestamp()."' |
|
| 267 | 267 | ) |
| 268 | 268 | "); |
| 269 | 269 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | SELECT * FROM `events` |
| 279 | 279 | WHERE |
| 280 | 280 | `calendar` = '{$calendarCache['id']}' AND |
| 281 | - `synced` != '" . getSyncTimestamp() . "' |
|
| 281 | + `synced` != '".getSyncTimestamp()."' |
|
| 282 | 282 | "); |
| 283 | 283 | while ($deletedEventCache = $deletedEventsResponse->fetch_assoc()) { |
| 284 | 284 | try { |
@@ -297,13 +297,13 @@ discard block |
||
| 297 | 297 | } catch (Pest_ClientError $e) { |
| 298 | 298 | postMessage( |
| 299 | 299 | 'API Client Error', |
| 300 | - '<pre>' . print_r(array( |
|
| 300 | + '<pre>'.print_r(array( |
|
| 301 | 301 | 'Status' => $PEST->lastStatus(), |
| 302 | 302 | 'Error' => $PEST->lastBody(), |
| 303 | 303 | 'Verb' => $verb, |
| 304 | 304 | 'URL' => $url, |
| 305 | 305 | 'Data' => $data |
| 306 | - ), false) . '</pre>', |
|
| 306 | + ), false).'</pre>', |
|
| 307 | 307 | NotificationMessage::ERROR |
| 308 | 308 | ); |
| 309 | 309 | if (php_sapi_name() != 'cli') { |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | $sql->query(" |
| 324 | 324 | UPDATE `schedules` |
| 325 | 325 | SET |
| 326 | - `synced` = '" . getSyncTimestamp() . "' |
|
| 326 | + `synced` = '" . getSyncTimestamp()."' |
|
| 327 | 327 | WHERE |
| 328 | 328 | `id` = '{$_REQUEST['schedule']}' |
| 329 | 329 | "); |
@@ -357,8 +357,8 @@ discard block |
||
| 357 | 357 | "); |
| 358 | 358 | /* we're the last one, delete it from crontab */ |
| 359 | 359 | if ($schedulesResponse->num_rows == 0) { |
| 360 | - $crontabs = preg_replace("%^.*{$schedule['schedule']}.*" . PHP_EOL . '%', '', shell_exec('crontab -l')); |
|
| 361 | - $filename = md5(getSyncTimestamp()) . '.txt'; |
|
| 360 | + $crontabs = preg_replace("%^.*{$schedule['schedule']}.*".PHP_EOL.'%', '', shell_exec('crontab -l')); |
|
| 361 | + $filename = md5(getSyncTimestamp()).'.txt'; |
|
| 362 | 362 | file_put_contents("/tmp/$filename", $crontabs); |
| 363 | 363 | shell_exec("crontab /tmp/$filename"); |
| 364 | 364 | postMessage('Unused schedule', "removed schedule '{$schedule['schedule']}' from crontab", NotificationMessage::INFO); |
@@ -367,8 +367,8 @@ discard block |
||
| 367 | 367 | $sql->query(" |
| 368 | 368 | UPDATE `schedules` |
| 369 | 369 | SET |
| 370 | - `schedule` = '" . $shellArguments[INDEX_SCHEDULE] . "', |
|
| 371 | - `synced` = '" . getSyncTimestamp() . "' |
|
| 370 | + `schedule` = '" . $shellArguments[INDEX_SCHEDULE]."', |
|
| 371 | + `synced` = '" . getSyncTimestamp()."' |
|
| 372 | 372 | WHERE |
| 373 | 373 | `calendar` = '{$calendarCache['id']}' |
| 374 | 374 | "); |
@@ -383,8 +383,8 @@ discard block |
||
| 383 | 383 | ) |
| 384 | 384 | VALUES ( |
| 385 | 385 | '{$calendarCache['id']}', |
| 386 | - '" . $shellArguments[INDEX_SCHEDULE] . "', |
|
| 387 | - '" . getSyncTimestamp() . "' |
|
| 386 | + '".$shellArguments[INDEX_SCHEDULE]."', |
|
| 387 | + '" . getSyncTimestamp()."' |
|
| 388 | 388 | ) |
| 389 | 389 | "); |
| 390 | 390 | } |
@@ -403,25 +403,25 @@ discard block |
||
| 403 | 403 | } else { |
| 404 | 404 | postMessage( |
| 405 | 405 | 'Canvas Object Not Found', |
| 406 | - 'The object whose URL you submitted could not be found.<pre>' . print_r(array( |
|
| 406 | + 'The object whose URL you submitted could not be found.<pre>'.print_r(array( |
|
| 407 | 407 | 'Canvas URL' => $_REQUEST['canvas_url'], |
| 408 | 408 | 'Canvas Context' => $canvasContext, |
| 409 | 409 | 'Canvas Object' => $canvasObject |
| 410 | - ), false) . '</pre>', |
|
| 410 | + ), false).'</pre>', |
|
| 411 | 411 | NotificationMessage::ERROR |
| 412 | 412 | ); |
| 413 | 413 | } |
| 414 | 414 | } else { |
| 415 | 415 | postMessage( |
| 416 | 416 | 'ICS feed Not Found', |
| 417 | - 'The calendar whose URL you submitted could not be found.<pre>' . $_REQUEST['cal'] . '</pre>', |
|
| 417 | + 'The calendar whose URL you submitted could not be found.<pre>'.$_REQUEST['cal'].'</pre>', |
|
| 418 | 418 | NotificationMessage::ERROR |
| 419 | 419 | ); |
| 420 | 420 | } |
| 421 | 421 | } else { |
| 422 | 422 | postMessage( |
| 423 | 423 | 'Invalid Canvas URL', |
| 424 | - 'The Canvas URL you submitted could not be parsed.<pre>' . $_REQUEST['canvas_url'] . '</pre>', |
|
| 424 | + 'The Canvas URL you submitted could not be parsed.<pre>'.$_REQUEST['canvas_url'].'</pre>', |
|
| 425 | 425 | NotificationMessage::ERROR |
| 426 | 426 | ); |
| 427 | 427 | if (php_sapi_name() != 'cli') $smarty->display('page.tpl'); |
@@ -424,7 +424,9 @@ |
||
| 424 | 424 | 'The Canvas URL you submitted could not be parsed.<pre>' . $_REQUEST['canvas_url'] . '</pre>', |
| 425 | 425 | NotificationMessage::ERROR |
| 426 | 426 | ); |
| 427 | - if (php_sapi_name() != 'cli') $smarty->display('page.tpl'); |
|
| 427 | + if (php_sapi_name() != 'cli') { |
|
| 428 | + $smarty->display('page.tpl'); |
|
| 429 | + } |
|
| 428 | 430 | exit; |
| 429 | 431 | } |
| 430 | 432 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $api->delete( |
| 21 | 21 | "calendar_events/{$event['id']}", |
| 22 | 22 | [ |
| 23 | - 'cancel_reason' => $metadata['APP_NAME'] . " course_url={$_REQUEST['course_url']}" |
|
| 23 | + 'cancel_reason' => $metadata['APP_NAME']." course_url={$_REQUEST['course_url']}" |
|
| 24 | 24 | ] |
| 25 | 25 | ); |
| 26 | 26 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | ]); |
| 32 | 32 | } else { |
| 33 | 33 | $smarty->assign([ |
| 34 | - 'content' => '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"><label for="course_url">Course URL <input id="course_url" name="course_url" type="text" /><input type="submit" value="Purge All Calendar Events" /></form>' |
|
| 34 | + 'content' => '<form action="'.$_SERVER['PHP_SELF'].'" method="post"><label for="course_url">Course URL <input id="course_url" name="course_url" type="text" /><input type="submit" value="Purge All Calendar Events" /></form>' |
|
| 35 | 35 | ]); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | SELECT * |
| 10 | 10 | FROM `schedules` |
| 11 | 11 | WHERE |
| 12 | - `schedule` = '" . $sql->real_escape_string($argv[1]) . "' |
|
| 12 | + `schedule` = '" . $sql->real_escape_string($argv[1])."' |
|
| 13 | 13 | ORDER BY |
| 14 | 14 | `synced` ASC |
| 15 | 15 | "); |
@@ -22,6 +22,6 @@ discard block |
||
| 22 | 22 | `id` = '{$schedule['calendar']}' |
| 23 | 23 | "); |
| 24 | 24 | if ($calendar = $calendarResponse->fetch_assoc()) { |
| 25 | - echo shell_exec('php ' . __DIR__ . '/import.php ' . $calendar['ics_url'] . ' ' . $calendar['canvas_url'] . ' ' . $schedule['id']); |
|
| 25 | + echo shell_exec('php '.__DIR__.'/import.php '.$calendar['ics_url'].' '.$calendar['canvas_url'].' '.$schedule['id']); |
|
| 26 | 26 | } |
| 27 | 27 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | public function setEnabled($enabled) |
| 33 | 33 | { |
| 34 | - $this->enabled = (boolean) $enabled; |
|
| 34 | + $this->enabled = (boolean)$enabled; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function isEnabled() |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function setIncludeExpression($regex) |
| 43 | 43 | { |
| 44 | - $this->include = (string) $regex; |
|
| 44 | + $this->include = (string)$regex; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public function getIncludeExpression() |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | public function setExcludeExpression($regex) |
| 56 | 56 | { |
| 57 | - $this->exclude = (string) $regex; |
|
| 57 | + $this->exclude = (string)$regex; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | public function getExcludeExpression() |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | ( |
| 75 | 75 | ( // if filtering is on, and there's an include pattern test that pattern... |
| 76 | 76 | $this->getIncludeExpression() && |
| 77 | - preg_match('%' . $this->getIncludeExpression() . '%', $event->getProperty('SUMMARY')) |
|
| 77 | + preg_match('%'.$this->getIncludeExpression().'%', $event->getProperty('SUMMARY')) |
|
| 78 | 78 | ) |
| 79 | 79 | ) && |
| 80 | 80 | !( // if there is an exclude pattern, make sure that this event is NOT excluded |
| 81 | 81 | $this->getExcludeExpression() && |
| 82 | - preg_match('%' . $this->getExcludeExpression() . '%', $event->getProperty('SUMMARY')) |
|
| 82 | + preg_match('%'.$this->getExcludeExpression().'%', $event->getProperty('SUMMARY')) |
|
| 83 | 83 | ) |
| 84 | 84 | ) |
| 85 | 85 | ); |
@@ -14,11 +14,11 @@ |
||
| 14 | 14 | if (empty($this->syncTimestamp)) { |
| 15 | 15 | $timestamp = new DateTime(); |
| 16 | 16 | $this->syncTimestamp = |
| 17 | - $timestamp->format(Constants::SYNC_TIMESTAMP_FORMAT) . |
|
| 18 | - Constants::SEPARATOR . md5( |
|
| 17 | + $timestamp->format(Constants::SYNC_TIMESTAMP_FORMAT). |
|
| 18 | + Constants::SEPARATOR.md5( |
|
| 19 | 19 | (php_sapi_name() == 'cli' ? |
| 20 | 20 | 'cli' : $_SERVER['REMOTE_ADDR'] |
| 21 | - ) . time() |
|
| 21 | + ).time() |
|
| 22 | 22 | ); |
| 23 | 23 | } |
| 24 | 24 | return $this->syncTimestamp; |