public function run() { $attachedfiles = new attachedfiles(); $attachedfiles_session = $attachedfiles->getSession(); //Хеш безопасности целосности параметров формы //сейчас используется для загрузчика файлов $param_hash = tservices_helper::getOrderUrlHash(array((int) $this->order_id, $attachedfiles_session), $this->uid); //собираем шаблон $this->render('t-service-order-messages-form', array('order_id' => $this->order_id, 'param_hash' => $param_hash, 'is_scroll' => $this->is_scroll, 'attachedfiles_session' => $attachedfiles_session)); }
/** * Получить директорию для загружаемого файла. * * @param type $order_id * @param type $sess * @param type $uid * @param type $hash * * @return bool */ public static function getUploadPath($order_id, $sess, $uid, $hash) { require_once ABS_PATH . '/classes/tservices/tservices_helper.php'; $_hash = tservices_helper::getOrderUrlHash(array($order_id, $sess), $uid); //Если проверка принадлежности по хешу неудалась //то пробуем получить через БД if ($hash !== $_hash) { require_once ABS_PATH . '/tu/models/TServiceOrderModel.php'; $isMember = TServiceOrderModel::model()->isOrderMember($order_id, $uid); if (!$isMember) { return false; } } return sprintf(self::UPLOAD_FILE_PATH, '', $order_id); }
/** * Смена статуса заказа. */ public function actionStatus() { $params = empty($_POST) ? $_GET : $_POST; unset($params['action'], $params['hash']); $curhash = tservices_helper::getOrderUrlHash($params); $hash = __paramInit('string', 'hash', 'hash', null); if ($curhash !== $hash) { $this->redirect('/404.php'); } $order_id = __paramInit('int', 'order_id', 'order_id', 0); $new_status = __paramInit('string', 'status', 'status', null); $order = $this->order_model->getCard($order_id, $this->uid); if (!$order) { $this->redirect('/404.php'); } $this->order_model->changeStatus($order_id, $new_status, $this->is_emp); $url = tservices_helper::getOrderCardUrl($order_id); $this->redirect($url); }