<?php
function elements_modsnippet_37($scriptProperties= array()) {
global $modx;
if (is_array($scriptProperties)) {
extract($scriptProperties, EXTR_SKIP);
}
$ctxs = !empty($ctxs) ? $ctxs : $modx->context->get('key');
if (!is_array($ctxs)) $ctxs = explode(',',$ctxs);

$url = $modx->makeUrl(22);

if (!$modx->user->hasSessionContext($ctxs)) {
  $modx->sendRedirect($url);
}
$trosk = $modx->getService('trosk','Trosk',$modx->getOption('doodles.core_path',null,$modx->getOption('core_path').'components/trosk/').'model/trosk/',$scriptProperties);
if (!($trosk instanceof Trosk)) return '';
$projectId=$_REQUEST['proj_id'];
if(!empty($projectId)){
	$project=$modx->getObject('projects',$projectId);
	if($modx->user->id!=$project->createdby) $modx->sendRedirect($url);
	$editId=$_REQUEST['edit_id'];
	if(!empty($editId)){
		$item=$modx->getObject('items',$editId);
		if($item->project_id!=$project->id) $modx->sendRedirect($url);
	}
}

return '';
}
