static function processException($e) { $msg = core_log::logException($e); if (app::getConfig('app/echo_exception')) { echo nl2br($msg); } }
public function addTradePointAction() { try { $tpData = array('name' => $this->getRequest()->getParam('spn'), 'address' => $this->getRequest()->getParam('adr'), 'long' => $this->getRequest()->getParam('long'), 'lat' => $this->getRequest()->getParam('lat'), 'contact_person ' => $this->getRequest()->getParam('con'), 'phone' => $this->getRequest()->getParam('tel'), 'personal_count' => $this->getRequest()->getParam('per'), 'rate' => $this->getRequest()->getParam('ppr'), 'web' => $this->getRequest()->getParam('web'), 'email' => $this->getRequest()->getParam('eml'), 'info' => $this->getRequest()->getParam('inf'), 'is_light_box' => $this->getRequest()->getParam('ilb'), 'is_panel' => $this->getRequest()->getParam('ipl'), 'shelf' => $this->getRequest()->getParam('slf'), 'competitor_id' => $this->getRequest()->getParam('competitor_id')); $img_64 = $this->getRequest()->getParam('img'); $uniqid = uniqid('tp'); $file_path = app::getConfig("dir/sd") . 'tp' . DS . 'img' . DS . date('Y') . DS . date('m') . DS . date('d') . DS . $uniqid . '.jpg'; $file_url = 'sd' . DS . 'tp' . DS . 'img' . DS . date('Y') . DS . date('m') . DS . date('d') . DS . $uniqid . '.jpg'; core_fs::createDirIfNotExists(dirname($file_path)); $this->_saveRequestImage($file_path, $img_64); $tpData['image'] = $file_url; $trade_point = new manage_model_tradepoint(); $trade_point->setData($tpData); $trade_point->save(); core_log::log($trade_point->getData(), 'tp/' . date('d-m-Y') . 'trade_points.added.log'); $request = $_REQUEST; unset($request['img']); $request['img'] = $file_path; core_log::log($request, 'tp/' . date('d-m-Y') . 'trade_point.request.log'); $this->_xhrOk(); } catch (Exception $e) { $request = $_REQUEST; unset($request['img']); $request['img'] = $file_path; core_log::logException($e); core_log::log($request, 'tp/' . date('d-m-Y') . 'trade_point.request.log'); core_log::log($e->getMessage(), 'tp/' . date('d-m-Y') . 'trade_point.error.log'); $this->_xhrErr('err: see exception log'); } }