smtech /
canvashack
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | require_once __DIR__ . '/vendor/autoload.php'; |
||
| 4 | |||
| 5 | use smtech\CanvasHack\Toolbox; |
||
| 6 | use smtech\ReflexiveCanvasLTI\LTI\ToolProvider; |
||
| 7 | use Battis\DataUtilities; |
||
| 8 | |||
| 9 | define('CONFIG_FILE', __DIR__ . '/config.xml'); |
||
| 10 | define('CANVAS_INSTANCE_URL', 'canvasInstanceUrl'); |
||
| 11 | |||
| 12 | @session_start(); // TODO I don't feel good about suppressing warnings |
||
|
0 ignored issues
–
show
|
|||
| 13 | |||
| 14 | /* prepare the toolbox */ |
||
| 15 | if (empty($_SESSION[Toolbox::class])) { |
||
| 16 | $_SESSION[Toolbox::class] =& Toolbox::fromConfiguration(CONFIG_FILE); |
||
| 17 | } |
||
| 18 | $toolbox =& $_SESSION[Toolbox::class]; |
||
| 19 | $toolbox->smarty_prependTemplateDir(__DIR__ . '/templates', basename(__DIR__)); |
||
| 20 | $toolbox->smarty_assign([ |
||
| 21 | 'category' => DataUtilities::titleCase(preg_replace('/[\-_]+/', ' ', basename(__DIR__))) |
||
| 22 | ]); |
||
| 23 | |||
| 24 | /* |
||
| 25 | * FIXME convience variables until plugins are all updated |
||
| 26 | */ |
||
| 27 | $api =& $toolbox->getAPI(); |
||
| 28 | $sql =& $toolbox->getMySQL(); |
||
| 29 | $smarty =& $toolbox->getSmarty(); |
||
| 30 | |||
| 31 | /* set the Tool Consumer's instance URL, if present */ |
||
| 32 | if (empty($_SESSION[CANVAS_INSTANCE_URL]) && |
||
| 33 | !empty($_SESSION[ToolProvider::class]['canvas']['api_domain']) |
||
| 34 | ) { |
||
| 35 | $_SESSION[CANVAS_INSTANCE_URL] = 'https://' . $_SESSION[ToolProvider::class]['canvas']['api_domain']; |
||
| 36 | } |
||
| 37 |
If you suppress an error, we recommend checking for the error condition explicitly: