public function sendEmail($template, $data = [], $to, $toName, $subject, $cc = null, $bcc = null, $replyTo = null)
 {
     $result = false;
     try {
         $config = new Config();
         $messageHeader = ['from' => $config->getValueByKey('address_sender_mail'), 'fromName' => $config->getValueByKey('display_name_send_mail'), 'to' => $to, 'toName' => $toName, 'cc' => $cc, 'bcc' => $bcc, 'replyTo' => $replyTo, 'subject' => $subject];
         \Mail::send($template, $data, function ($message) use($messageHeader) {
             $message->from($messageHeader['from'], $messageHeader['fromName']);
             $message->to($messageHeader['to'], $messageHeader['toName']);
             if (!is_null($messageHeader['cc'])) {
                 $message->cc($messageHeader['cc']);
             }
             if (!is_null($messageHeader['bcc'])) {
                 $message->bcc($messageHeader['bcc']);
             }
             if (!is_null($messageHeader['replyTo'])) {
                 $message->replyTo($messageHeader['replyTo']);
             }
             $message->subject($messageHeader['subject']);
         });
         $result = true;
     } catch (Exception $e) {
         $result = ['success' => false, 'message' => $e->getMessage()];
     }
     return \Response::json($result);
 }
示例#2
0
文件: page.php 项目: smith46102/koda
 public function init()
 {
     if (!User::$signed) {
         Response::redirect('/login');
     }
     return true;
 }
示例#3
0
文件: login.php 项目: smith46102/koda
 private function signOut()
 {
     if (User::signOut()) {
         Response::redirect('/login');
     }
     return true;
 }
示例#4
0
 /**
  * Show the form responses for a given slug.
  *
  * @param  string  $slug
  * @return Response
  */
 public function responses($slug)
 {
     die('@TODO: Not working yet.');
     $form = \App\Form::where('slug', '=', $slug)->firstOrFail();
     $responses = \App\Response::where('form_id', '=', $form->id)->get();
     return view('forms.responses', array('fields' => $form->fields, 'responses' => $responses));
 }
 function email($id)
 {
     $resp = Response::find($id);
     Mail::send('emails.feedBackClient', ['resp' => $resp], function ($m) use($resp) {
         $m->from('*****@*****.**', 'Team Eurekalabs');
         $m->to($resp->email, 'Test Client')->subject('Your Reminder!');
     });
 }
示例#6
0
 /**
  * The constructor
  * @param string $content The content of the response
  * @throws \InvalidArgumentException
  */
 function __construct($content = '')
 {
     if (!is_string($content)) {
         throw new \InvalidArgumentException('The content argument must be of type string');
     }
     parent::__construct($content);
     $this->setContentType('text/html');
 }
示例#7
0
 /**
  * The constructor 
  * @param string $filename The filename to output
  * @throws \InvalidArgumentException
  */
 function __construct($filename)
 {
     if (!is_string($filename)) {
         throw new \InvalidArgumentException('The filename argument must be of type string');
     }
     $this->filename = $filename;
     parent::__construct('');
 }
 /**
  * The constructor
  * @param string $content The content of the response
  * @throws \InvalidArgumentException
  */
 function __construct($content = 'Temporary Unavailable')
 {
     if (!is_string($content)) {
         throw new \InvalidArgumentException('The content argument must be of type string');
     }
     parent::__construct($content);
     $this->setContentType('text/plain');
     $this->setStatusCode(503);
 }
示例#9
0
 /**
  * The constructor
  * @param string $content The content of the response
  * @throws \InvalidArgumentException
  */
 function __construct($content = 'Not Found')
 {
     if (!is_string($content)) {
         throw new \InvalidArgumentException('The content argument must be of type string');
     }
     parent::__construct($content);
     $this->setContentType('text/plain');
     $this->setStatusCode(404);
 }
示例#10
0
文件: App.php 项目: x3m-bymer/www
 function __construct()
 {
     set_error_handler(array($this, 'ErrorCatcher'));
     $this->_config = $this->getDefaultSettings();
     $this->_request = \App\Request::getInstance();
     $this->_response = \App\Response::getInstance();
     //$this->_route = \App\Route::getInstance();
     $this->_logger = new \App\Log($this->_config['Logger']);
 }
 /**
  * The constructor
  * @param string $url The redirect url
  * @throws \InvalidArgumentException
  */
 function __construct($url)
 {
     if (!is_string($url)) {
         throw new \InvalidArgumentException('The url argument must be of type string');
     }
     parent::__construct('');
     $this->setContentType('text/plain');
     $this->setStatusCode(307);
     $this->headers['location'] = 'Location: ' . $url;
 }
 public function registerUserResponses(Request $request)
 {
     $responses = array();
     $error = 0;
     foreach ($request->data as $data) {
         $question_id = explode("-", $data[0]);
         $question_id = $question_id[1];
         $required = Question::where('id', $question_id)->first()->required;
         if ($required == 1) {
             if ($data[1] == "") {
                 $error = 1;
                 break;
             }
         }
         unset($data);
     }
     if ($error == 0) {
         $first_question_id = 0;
         foreach ($request->data as $data) {
             $question_id = explode("-", $data[0]);
             $question_id = $question_id[1];
             if ($first_question_id == 0) {
                 $first_question_id = $question_id;
             }
             $response = new Response();
             $response->question_id = $question_id;
             $response->response = $data[1];
             $response->applicant_id = Auth::user()->id;
             $response->save();
             unset($data);
         }
         $training_id = Question::where('id', $first_question_id)->first()->training_id;
         $applicant = new Applicant();
         $applicant->user_id = Auth::user()->id;
         $applicant->training_id = $training_id;
         $applicant->trainer_id = 0;
         $applicant->save();
         echo "Datele dvs. au fost preluate!";
     } else {
         echo "Intrebarile marcate cu * sunt obligatorii!";
     }
 }
示例#13
0
 public function run()
 {
     $modClass = '\\Modules\\' . str_replace('.', '\\', $this->module);
     Response::setJson();
     try {
         $module = new $modClass();
         if (!$module->havePermission()) {
             throw new \BadMethodCallException("you dont have permission to use this module");
         }
         if (!method_exists($module, $this->command)) {
             throw new \BadMethodCallException("can`t call method {$modClass} -> {$this->command}");
         }
         if (!$module->{$this->command}($_REQUEST)) {
             throw new \BadMethodCallException("module action fails");
         }
     } catch (\Exception $e) {
         Response::add(['status' => 'system_error', 'data' => $e->getMessage()]);
     }
     return true;
 }
示例#14
0
文件: index.php 项目: smith46102/koda
<?php

require_once 'engine/utils.php';
require_once 'engine/autoload.php';
Autoload::init('config/autoload.php');
use App\Config, App\Request, App\User, App\Route, App\View, App\Timer, App\Debug, App\Mysql, App\Response;
try {
    Config::load('config/settings.php');
    Config::applyHostSettings('config/hosts.php');
    Mysql::setHost(Config::get('dbConnection'));
    Timer::start();
    User::startSession();
    Request::parse();
    Route::add(['/dumper' => 'dumper', '/module' => 'module', '/login' => 'login', '/tasks' => 'page', '/profile' => 'page', '/projects' => 'page', '/workspace' => 'page', '/404' => 'error', '/' => 'page']);
    Route::go();
    Timer::showExecutionTime();
    Mysql::showResources();
    Response::out();
} catch (\Exception $e) {
    Debug::showException($e);
}
示例#15
0
use App\Response;
/** @var $data string */
if (!Permission::sufficient('staff') || !POST_REQUEST) {
    CoreUtils::notFound();
}
CSRFProtection::protect();
if (!preg_match(new RegExp('^([gs]et)/([a-z_]+)$'), CoreUtils::trim($data), $_match)) {
    Response::fail('Setting key invalid');
}
$getting = $_match[1] === 'get';
$key = $_match[2];
$currvalue = GlobalSettings::get($key);
if ($getting) {
    Response::done(array('value' => $currvalue));
}
if (!isset($_POST['value'])) {
    Response::fail('Missing setting value');
}
try {
    $newvalue = GlobalSettings::process($key);
} catch (Exception $e) {
    Response::fail('Preference value error: ' . $e->getMessage());
}
if ($newvalue === $currvalue) {
    Response::done(array('value' => $newvalue));
}
if (!GlobalSettings::set($key, $newvalue)) {
    Response::dbError();
}
Response::done(array('value' => $newvalue));
示例#16
0
 /**
  * 跳转
  *
  * @param string $url
  * @param array $params 参数
  * @return Response
  */
 protected function redirect($url = '', $params = array())
 {
     if (substr($url, 0, 4) !== 'http') {
         $url = $this->url($url, $params);
     }
     $response = Response::getInstance();
     $response->redirect($url);
     return $response;
 }
示例#17
0
 /**
  * Approves a specific post and optionally notifies it's author
  *
  * @param string $type         request/reservation
  * @param int    $id           post id
  * @param string $notifyUserID id of user to notify
  *
  * @return array
  */
 static function approve($type, $id, $notifyUserID = null)
 {
     global $Database;
     if (!$Database->where('id', $id)->update("{$type}s", array('lock' => true))) {
         Response::dbError();
     }
     $postdata = array('type' => $type, 'id' => $id);
     Logs::action('post_lock', $postdata);
     if (!empty($notifyUserID)) {
         Notifications::send($notifyUserID, 'post-approved', $postdata);
     }
     return $postdata;
 }
示例#18
0
$insert = array('preview' => $Image->preview, 'fullsize' => $Image->fullsize);
$season = Episodes::validateSeason(Episodes::ALLOW_MOVIES);
$episode = Episodes::validateEpisode();
$epdata = Episodes::getActual($season, $episode, Episodes::ALLOW_MOVIES);
if (empty($epdata)) {
    Response::fail("The specified episode (S{$season}E{$episode}) does not exist");
}
$insert['season'] = $epdata->season;
$insert['episode'] = $epdata->episode;
$ByID = $currentUser->id;
if (Permission::sufficient('developer')) {
    $username = Posts::validatePostAs();
    if (isset($username)) {
        $PostAs = Users::get($username, 'name', 'id,role');
        if (empty($PostAs)) {
            Response::fail('The user you wanted to post as does not exist');
        }
        if ($type === 'reservation' && !Permission::sufficient('member', $PostAs->role) && !isset($_POST['allow_nonmember'])) {
            Response::fail('The user you wanted to post as is not a club member, do you want to post as them anyway?', array('canforce' => true));
        }
        $ByID = $PostAs->id;
    }
}
$insert[$type === 'reservation' ? 'reserved_by' : 'requested_by'] = $ByID;
Posts::checkPostDetails($type, $insert);
$PostID = $Database->insert("{$type}s", $insert, 'id');
if (!$PostID) {
    Response::dbError();
}
Response::done(array('id' => $PostID));
示例#19
0
 public function assignRoleUser($rid)
 {
     // get the query string from the url
     $uid = Request::get('uid');
     // find the user and update the user role.
     $user = User::find($uid);
     $user->role_id = $rid;
     $user->save();
     //return response as JSON
     return Response::json($user);
 }
示例#20
0
 /**
  * Caches information about a deviation in the 'deviation_cache' table
  * Returns null on failure
  *
  * @param string      $ID
  * @param null|string $type
  * @param bool        $mass
  *
  * @return array|null
  */
 static function getCachedSubmission($ID, $type = 'fav.me', $mass = false)
 {
     global $Database, $FULLSIZE_MATCH_REGEX;
     if ($type === 'sta.sh') {
         $ID = CoreUtils::nomralizeStashID($ID);
     }
     $Deviation = $Database->where('id', $ID)->where('provider', $type)->getOne('deviation_cache');
     $cacheExhausted = self::$_MASS_CACHE_USED > self::$_MASS_CACHE_LIMIT;
     $cacheExpired = empty($Deviation['updated_on']) ? true : strtotime($Deviation['updated_on']) + Time::$IN_SECONDS['hour'] * 12 < time();
     $lastRequestSuccessful = !self::$_CACHE_BAILOUT;
     $localDataMissing = empty($Deviation);
     $massCachingWithinLimit = $mass && !$cacheExhausted;
     $notMassCachingAndCacheExpired = !$mass && $cacheExpired;
     if ($lastRequestSuccessful && ($localDataMissing || ($massCachingWithinLimit && $cacheExpired || $notMassCachingAndCacheExpired))) {
         try {
             $json = self::oEmbed($ID, $type);
             if (empty($json)) {
                 throw new \Exception();
             }
         } catch (\Exception $e) {
             if (!empty($Deviation)) {
                 $Database->where('id', $Deviation['id'])->update('deviation_cache', array('updated_on' => date('c', time() + Time::$IN_SECONDS['minute'])));
             }
             $ErrorMSG = "Saving local data for {$ID}@{$type} failed: " . $e->getMessage();
             if (!Permission::sufficient('developer')) {
                 trigger_error($ErrorMSG);
             }
             if (POST_REQUEST) {
                 Response::fail($ErrorMSG);
             } else {
                 echo "<div class='notice fail'><label>da_cache_deviation({$ID}, {$type})</label><p>{$ErrorMSG}</p></div>";
             }
             self::$_CACHE_BAILOUT = true;
             return $Deviation;
         }
         $insert = array('title' => preg_replace(new RegExp('\\\\\''), "'", $json['title']), 'preview' => URL::makeHttps($json['thumbnail_url']), 'fullsize' => URL::makeHttps(isset($json['fullsize_url']) ? $json['fullsize_url'] : $json['url']), 'provider' => $type, 'author' => $json['author_name'], 'updated_on' => date('c'));
         if (!preg_match($FULLSIZE_MATCH_REGEX, $insert['fullsize'])) {
             $fullsize_attempt = CoreUtils::getFullsizeURL($ID, $type);
             if (is_string($fullsize_attempt)) {
                 $insert['fullsize'] = $fullsize_attempt;
             }
         }
         if (empty($Deviation)) {
             $Deviation = $Database->where('id', $ID)->where('provider', $type)->getOne('deviation_cache');
         }
         if (empty($Deviation)) {
             $insert['id'] = $ID;
             $Database->insert('deviation_cache', $insert);
         } else {
             $Database->where('id', $Deviation['id'])->update('deviation_cache', $insert);
             $insert['id'] = $ID;
         }
         self::$_MASS_CACHE_USED++;
         $Deviation = $insert;
     } else {
         if (!empty($Deviation['updated_on'])) {
             $Deviation['updated_on'] = date('c', strtotime($Deviation['updated_on']));
             if (self::$_CACHE_BAILOUT) {
                 $Database->where('id', $Deviation['id'])->update('deviation_cache', array('updated_on' => $Deviation['updated_on']));
             }
         }
     }
     return $Deviation;
 }
示例#21
0
    if (!empty($search['hits']['hits'])) {
        $ids = [];
        foreach ($search['hits']['hits'] as $hit) {
            $ids[] = $hit['_id'];
        }
        $Ponies = $CGDb->where('id IN (' . implode(',', $ids) . ')')->orderBy('order', 'ASC')->get('appearances');
    }
}
if (!$elasticAvail) {
    $_EntryCount = $CGDb->where('ishuman', $EQG)->where('id != 0')->count('appearances');
    $Pagination = new Pagination('cg', $AppearancesPerPage, $_EntryCount);
    $Ponies = Appearances::get($EQG, $Pagination->getLimit());
}
if (isset($_REQUEST['GOFAST'])) {
    if (empty($Ponies[0]['id'])) {
        Response::fail('The search returned no results.');
    }
    Response::done(array('goto' => "{$CGPath}/v/{$Ponies[0]['id']}-" . Appearances::getSafeLabel($Ponies[0])));
}
CoreUtils::fixPath("{$CGPath}/{$Pagination->page}" . (!empty($Restrictions) ? "?q={$SearchQuery}" : ''));
$heading = ($EQG ? 'EQG ' : '') . "{$Color} Guide";
$title .= "Page {$Pagination->page} - {$heading}";
if (isset($_GET['js'])) {
    $Pagination->respond(Appearances::getHTML($Ponies, NOWRAP), '#list');
}
$settings = array('title' => $title, 'heading' => $heading, 'css' => array($do), 'js' => array('jquery.qtip', 'jquery.ctxmenu', $do, 'paginate'));
if (Permission::sufficient('staff')) {
    $settings['css'] = array_merge($settings['css'], $GUIDE_MANAGE_CSS);
    $settings['js'] = array_merge($settings['js'], $GUIDE_MANAGE_JS);
}
CoreUtils::loadPage($settings);
示例#22
0
 public function saveDiagnosisResponses(Request $request)
 {
     $eventId = $request->input('eventId');
     $patientId = $request->input('patientId');
     $value = $this->getAuthenticatedUser()->getData();
     $currentUser = $value->result;
     if ($currentUser->roleId != 5) {
         return response()->json(['error' => ['message' => 'Unauthorized Access', 'code' => 101]]);
     }
     $volunteerId = $currentUser->id;
     $result = $this->fetchScreening($eventId, $patientId, $volunteerId)->getData();
     if (property_exists($result, 'error')) {
         return $result;
     }
     $responses = $request->input('responses');
     $responseToSave = array();
     $data = array();
     DB::beginTransaction();
     foreach ($responses as $inputResponse) {
         $textAnswer = array_key_exists('textAnswer', $inputResponse) ? $inputResponse['textAnswer'] : null;
         $numberAnswer = array_key_exists('numberAnswer', $inputResponse) ? $inputResponse['numberAnswer'] : null;
         $boolAnswer = array_key_exists('boolAnswer', $inputResponse) ? $inputResponse['boolAnswer'] : null;
         $optionAnswer = array_key_exists('optionAnswer', $inputResponse) ? $inputResponse['optionAnswer'] : null;
         try {
             $response = Response::create(['screeningId' => $result->screening->id, 'queryId' => $inputResponse['queryId'], 'textAnswer' => $textAnswer, 'numberAnswer' => $numberAnswer, 'boolAnswer' => $boolAnswer]);
             if ($optionAnswer != null) {
                 $options = array();
                 $optionGroupId = $optionAnswer['groupId'];
                 $answers = $optionAnswer['answers'];
                 foreach ($answers as $answer) {
                     $option['responseId'] = $response['id'];
                     $option['optionGroupId'] = $optionGroupId;
                     $option['optionId'] = $answer;
                     $options[] = $option;
                 }
                 DB::table('option_response')->insert($options);
             }
         } catch (\Exception $e) {
             DB::rollback();
             $data = array('error' => ['message' => 'Could not save response', 'code' => 101]);
         }
     }
     DB::commit();
     if ($data) {
         return response()->json($data);
     } else {
         return response()->json(['result' => array('screeningId' => $result->screening->id)]);
     }
 }
示例#23
0
    /**
     * Check maximum simultaneous reservation count
     *
     * @param bool $return_as_bool
     *
     * @return bool|null
     */
    static function reservationLimitExceeded(bool $return_as_bool = false)
    {
        global $Database, $currentUser;
        $reservations = $Database->rawQuerySingle('SELECT
			(
				(SELECT
				 COUNT(*) as "count"
				 FROM reservations res
				 WHERE res.reserved_by = u.id && res.deviation_id IS NULL)
				+(SELECT
				  COUNT(*) as "count"
				  FROM requests req
				  WHERE req.reserved_by = u.id && req.deviation_id IS NULL)
			) as "count"
			FROM users u WHERE u.id = ?', array($currentUser->id));
        $overTheLimit = isset($reservations['count']) && $reservations['count'] >= 4;
        if ($return_as_bool) {
            return $overTheLimit;
        }
        if ($overTheLimit) {
            Response::fail("You've already reserved {$reservations['count']} images, and you can't have more than 4 pending reservations at a time. You can review your reservations on your <a href='/user'>Account page</a>, finish at least one of them before trying to reserve another image.");
        }
    }
示例#24
0
if (isset($_REQUEST['unlink']) || isset($_REQUEST['everywhere'])) {
    $col = 'user';
    $val = $currentUser->id;
    $username = Users::validateName('username', null, true);
    if (isset($username)) {
        if (!Permission::sufficient('staff') || isset($_REQUEST['unlink'])) {
            Response::fail();
        }
        /** @var $TargetUser User */
        $TargetUser = $Database->where('name', $username)->getOne('users', 'id,name');
        if (empty($TargetUser)) {
            Response::fail("Target user doesn't exist");
        }
        if ($TargetUser->id !== $currentUser->id) {
            $val = $TargetUser->id;
        } else {
            unset($TargetUser);
        }
    }
} else {
    $col = 'id';
    $val = $currentUser->Session['id'];
}
if (!$Database->where($col, $val)->delete('sessions')) {
    Response::fail('Could not remove information from database');
}
if (empty($TargetUser)) {
    Cookie::delete('access', Cookie::HTTPONLY);
}
Response::done();
示例#25
0
 static function safeMarkRead($NotifID, $action = null)
 {
     try {
         Notifications::markRead($NotifID, $action);
     } catch (ServerConnectionFailureException $e) {
         error_log("Notification server down!\n" . $e->getMessage());
         Response::fail('Notification server is down! Please <a class="send-feedback">let us know</a>.');
     } catch (\Exception $e) {
         error_log("SocketEvent Error\n" . $e->getMessage());
         Response::fail('SocketEvent Error: ' . $e->getMessage());
     }
 }
示例#26
0
                            Response::dbError('Episode tag creation failed');
                        }
                    }
                }
            }
        }
        if ($editing) {
            $logentry = array('target' => $Episode->formatTitle(AS_ARRAY, 'id'));
            $changes = 0;
            if (!empty($Episode->airs)) {
                $Episode->airs = date('c', strtotime($Episode->airs));
            }
            foreach (array('season', 'episode', 'twoparter', 'title', 'airs') as $k) {
                if (isset($insert[$k]) && $insert[$k] != $Episode->{$k}) {
                    $logentry["old{$k}"] = $Episode->{$k};
                    $logentry["new{$k}"] = $insert[$k];
                    $changes++;
                }
            }
            if ($changes > 0) {
                Logs::action('episode_modify', $logentry);
            }
        } else {
            Logs::action('episodes', array('action' => 'add', 'season' => $insert['season'], 'episode' => $insert['episode'], 'twoparter' => isset($insert['twoparter']) ? $insert['twoparter'] : 0, 'title' => $insert['title'], 'airs' => $insert['airs']));
        }
        if ($editing) {
            Response::done();
        }
        Response::done(array('url' => (new Episode($insert))->formatURL()));
        break;
}
示例#27
0
 /**
  * Checks if a deviation is in the club and stops execution if it isn't
  *
  * @param string $favme
  * @param bool   $throw If true an Exception will be thrown instead of responding
  */
 static function checkDeviationInClub($favme, $throw = false)
 {
     $Status = self::isDeviationInClub($favme);
     if ($Status !== true) {
         $errmsg = $Status === false ? "The deviation has not been submitted to/accepted by the group yet" : "There was an issue while checking the acceptance status (Error code: {$Status})";
         if ($throw) {
             throw new \Exception($errmsg);
         }
         Response::fail($errmsg);
     }
 }
示例#28
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     if (App::environment() === 'production') {
         exit('Do not seed in production environment');
     }
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     // disable foreign key constraints
     DB::table('response')->truncate();
     DB::table('option_response')->truncate();
     /**
      *  Do you smoke?
      */
     Response::create(['id' => 1, 'screeningId' => 1, 'queryId' => 1]);
     $option = array('responseId' => 1, 'optionGroupId' => 1, 'optionId' => 1);
     DB::table('option_response')->insert($option);
     /**
      *  Do you chew?
      */
     Response::create(['id' => 2, 'screeningId' => 1, 'queryId' => 2]);
     $option = array('responseId' => 2, 'optionGroupId' => 1, 'optionId' => 2);
     DB::table('option_response')->insert($option);
     /**
      *  Do you snuff?
      */
     Response::create(['id' => 3, 'screeningId' => 1, 'queryId' => 3]);
     $option = array('responseId' => 3, 'optionGroupId' => 1, 'optionId' => 2);
     DB::table('option_response')->insert($option);
     /**
      *  Do you take alcohol
      */
     Response::create(['id' => 4, 'screeningId' => 1, 'queryId' => 4]);
     $option = array('responseId' => 4, 'optionGroupId' => 1, 'optionId' => 3);
     DB::table('option_response')->insert($option);
     //Children of question 1
     /**
      * What was your age when you started this habit?
      */
     Response::create(['id' => 5, 'screeningId' => 1, 'queryId' => 5, 'numberAnswer' => 18]);
     /**
      * Mention quantity in a day?
      */
     Response::create(['id' => 6, 'screeningId' => 1, 'queryId' => 6, 'numberAnswer' => 3]);
     /**
      * What is(was) the duration of this habit in years?
      */
     Response::create(['id' => 7, 'screeningId' => 1, 'queryId' => 7, 'numberAnswer' => 4]);
     //Children of question 2 : Do you chew?
     // No children as answer is no
     //Children of question 3: Do you snuff?
     // No children as answer is no
     //Children of question 3: Do you take alcohol
     /**
      * What was your age when you started this habit?
      */
     Response::create(['id' => 8, 'screeningId' => 1, 'queryId' => 14, 'numberAnswer' => 18]);
     /**
      * Mention quantity in a day?
      */
     Response::create(['id' => 9, 'screeningId' => 1, 'queryId' => 15, 'numberAnswer' => 0.25]);
     /**
      * What is(was) the duration of this habit in years?
      */
     Response::create(['id' => 10, 'screeningId' => 1, 'queryId' => 16, 'numberAnswer' => 3]);
     /**
      *  What is your food preference?
      */
     Response::create(['id' => 11, 'screeningId' => 1, 'queryId' => 17]);
     $option = array('responseId' => 11, 'optionGroupId' => 2, 'optionId' => 2);
     DB::table('option_response')->insert($option);
     /**
      *  Choose non veg foods you consume?
      */
     Response::create(['id' => 12, 'screeningId' => 1, 'queryId' => 18]);
     $option = array('responseId' => 12, 'optionGroupId' => 3, 'optionId' => 6);
     $options[] = $option;
     $option = array('responseId' => 13, 'optionGroupId' => 3, 'optionId' => 7);
     $options[] = $option;
     $option = array('responseId' => 14, 'optionGroupId' => 3, 'optionId' => 8);
     $options[] = $option;
     $option = array('responseId' => 15, 'optionGroupId' => 3, 'optionId' => 9);
     $options[] = $option;
     DB::table('option_response')->insert($options);
     DB::statement('SET FOREIGN_KEY_CHECKS = 1');
     // enable foreign key constraints
 }
示例#29
0
 /**
  * Papers and others files will be returned to professor
  *
  * @return boolean
  */
 private function download($professorName, $filePath)
 {
     $headers = array('Content-Type: application/zip');
     return Response::download($filePath, $professorName + ".zip", $headers);
 }
示例#30
0
            if (Permission::sufficient('staff', $targetUser->role)) {
                Response::fail("You cannot {$action} people within the assistant or any higher group");
            }
            if ($action == 'banish' && $targetUser->role === 'ban' || $action == 'un-banish' && $targetUser->role !== 'ban') {
                Response::fail("This user has already been {$action}ed");
            }
            $reason = (new Input('reason', 'string', array(Input::IN_RANGE => [5, 255], Input::CUSTOM_ERROR_MESSAGES => array(Input::ERROR_MISSING => 'Please specify a reason', Input::ERROR_RANGE => 'Reason length must be between @min and @max characters'))))->out();
            $changes = array('role' => $action == 'banish' ? 'ban' : 'user');
            $Database->where('id', $targetUser->id)->update('users', $changes);
            Logs::action($action, array('target' => $targetUser->id, 'reason' => $reason));
            $changes['role'] = Permission::ROLES_ASSOC[$changes['role']];
            $changes['badge'] = Permission::labelInitials($changes['role']);
            if ($action == 'banish') {
                Response::done($changes);
            }
            Response::success("We welcome {$targetUser->name} back with open hooves!", $changes);
        } else {
            CoreUtils::notFound();
        }
    }
}
if (strtolower($data) === 'immortalsexgod') {
    $data = 'DJDavid98';
}
if (empty($data)) {
    if ($signedIn) {
        $un = $currentUser->name;
    } else {
        $MSG = 'Sign in to view your settings';
    }
} else {