/** * Returns the answer to life, universe and everything - in case you spend enough money, that is. * * @param int $money Optional. Money spent for an answer. Defaults to 0. * * @return string */ public function get_answer($money = 0) { if ((int) $money < 5) { return ''; } return $this->oracle->get_answer(); }
/** * добавляем точки к группе * * @param $groupId * @param $posIds */ public static function addDotsToGroup($groupId, $posIds) { if (empty($groupId) || empty($posIds)) { return Oracle::CODE_ERROR; } $db = Oracle::init(); $user = Auth::instance()->get_user(); $data = ['p_pos_group_id' => $groupId, 'p_action' => 1, 'p_pos_id' => [$posIds, SQLT_INT], 'p_manager_id' => $user['MANAGER_ID'], 'p_error_code' => 'out']; return $db->procedure('ctrl_pos_group_collection', $data); }
/** * отмечаем сообщения прочитанными * * @param bool $user */ public static function makeRead($params = [], $user = false) { $db = Oracle::init(); if (empty($user)) { $user = Auth::instance()->get_user(); } $data = ['p_note_guid' => $params['note_guid'], 'p_new_status' => self::MESSAGE_STATUS_READ, 'p_manager_id' => $user['MANAGER_ID'], 'p_error_code' => 'out']; $res = $db->procedure('notification_change_status', $data); if (!empty($res)) { return $res; } return true; }
public static function init() { if (is_null(self::$_instance)) { $config = Kohana::$config->load('database'); self::$_conn = oci_connect($config['name'], $config['password'], $config['db'], 'UTF8'); if (!self::$_conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } self::$_instance = new self(); } return self::$_instance; }
/** * добавляем новость * * @param $params */ public static function editNews($params) { if (empty($params)) { return false; } $db = Oracle::init(); $data = ['p_type_id' => 0, 'p_announce' => 'анонс', 'p_title' => $params['title'], 'p_content' => $params['text'], 'p_picture' => empty($params['image']) ? '' : $params['image'], 'p_is_published' => 1, 'p_error_code' => 'out']; if (!empty($params['id'])) { $preData = ['p_news_id' => $params['id']]; $res = $db->procedure('news_modify', array_merge($preData, $data)); } else { $user = Auth::instance()->get_user(); $preData = ['p_agent_id' => $user['AGENT_ID']]; $res = $db->procedure('news_add', array_merge($preData, $data)); } if ($res == Oracle::CODE_ERROR) { return false; } return true; }
/** * получаем список доступный клиентов по манагеру * * @param array $params * @return array */ public static function getClientsList($params = []) { $db = Oracle::init(); $user = Auth::instance()->get_user(); if (empty($params['manager_id'])) { $managerId = $user['MANAGER_ID']; } else { $managerId = $params['manager_id']; } if (empty($params['agent_id'])) { $agentId = $user['AGENT_ID']; } else { $agentId = $params['agent_id']; } $sql = "select *\n from " . Oracle::$prefix . "V_WEB_CLIENTS_LIST t \n where t.agent_id = " . $agentId . "\n and not exists\n (\n select 1 \n from " . Oracle::$prefix . "V_WEB_MANAGER_CLIENTS vwc \n where vwc.client_id = t.client_id and vwc.agent_id = t.agent_id and vwc.manager_id = " . $managerId . "\n )"; if (!empty($params['search'])) { $sql .= " and upper(t.NAME) like '%" . mb_strtoupper(Oracle::quote($params['search'])) . "%'"; } $sql .= " order by t.client_id desc "; return $db->query($sql); }
/** * созданеи ЛК для пользователя * * @param $params */ public static function createCabinet($params) { if (empty($params['client_id']) || empty($params['email_to'])) { return false; } $db = Oracle::init(); $user = Auth::instance()->get_user(); $client = Model_Client::getClient($params['client_id']); if (empty($client)) { return false; } $data = ['p_client_id' => $client['CLIENT_ID'], 'p_role_id' => $params['role'], 'p_login' => $client['EMAIL'], 'p_password' => null, 'p_email_to' => $params['email_to'], 'p_fl_send' => 0, 'p_manager_id' => $user['MANAGER_ID'], 'p_error_code' => 'out']; $res = $db->procedure('client_private_office', $data); switch ($res) { case Oracle::CODE_ERROR: case 3: return Oracle::CODE_ERROR; case 2: return 'Неверный email'; case 4: return 'Линчый кабинет уже создан'; case 5: return 'Не удалось отправить почту на указанный email'; default: return Oracle::CODE_SUCCESS; } }
/** * изъятие карты * * @param $params * @return bool|int */ public static function withdrawCard($params) { if (empty($params['contract_id']) || empty($params['card_id'])) { return false; } $db = Oracle::init(); $user = Auth::instance()->get_user(); $data = ['p_card_id' => $params['card_id'], 'p_contract_id' => $params['contract_id'], 'p_manager_id' => $user['MANAGER_ID'], 'p_error_code' => 'out']; $res = $db->procedure('card_contract_withdraw', $data); if (!empty($res)) { return $res; } return true; }
/** * редактируем группу точек * * @param $params */ public static function editDotsGroup($params, $action = self::DOTS_GROUP_ACTION_EDIT) { if (empty($params['group_id'])) { return Oracle::CODE_ERROR; } $db = Oracle::init(); $user = Auth::instance()->get_user(); $data = ['p_pos_group_id' => $params['group_id'], 'p_action' => $action, 'p_group_name' => !empty($params['name']) ? $params['name'] : '', 'p_pos_group_type' => 1, 'p_manager_id' => $user['MANAGER_ID'], 'p_error_code' => 'out']; return $db->procedure('ctrl_pos_group_edit', $data); }
/** * список поставщиков * * @param $search * @param ids * @return array|bool|int */ public static function getSuppliers($search, $ids = []) { if (empty($search) && empty($ids)) { return false; } $db = Oracle::init(); $user = Auth::instance()->get_user(); $sql = "select * from " . Oracle::$prefix . "V_WEB_SUPPLIERS_LIST t where t.agent_id = " . $user['AGENT_ID']; if (!empty($search)) { $sql .= " and upper(t.SUPPLIER_NAME) like '%" . mb_strtoupper(Oracle::quote($search)) . "%'"; } if (!empty($ids)) { $sql .= " and t.ID in (" . implode(',', $ids) . ")"; } return $db->query($db->limit($sql, 0, self::$limit)); }
/** * Test for the get_answer() method. * * @covers Oracle::get_answer() * * @return void */ public function test_get_answer() { $testee = new Oracle(); $this->assertSame('42', $testee->get_answer(), 'get_answer() should return the expected answer.'); }
date_default_timezone_set('UTC'); // global variable BASEDIR define('BASEDIR', __DIR__); include BASEDIR . '/Common/Loader.php'; // using PSR-0 coding standard spl_autoload_register('\\Common\\Loader::autoload'); // check user post data $check = new CommonAPI(); // $check->getFiles(); $check->check(); //print_r($check->params); //echo "hello"; // connect database try { // generate database handle $connect = Oracle::getInstance()->connect(); } catch (Exception $e) { throw new Exception("Database connection error: " . mysql_error()); } // test data // new object $ts = new SQL(); /* * For complaint table */ //$complaint['userid'] = "7fec24daf27dffbf18d188c7283bae58"; //$complaint['complaint'] = "This is man is so nice!"; //$ts->insertComplaint($connect,$complaint); /*****************************************************/ /* * For photo table
/** * при регенерации данных пользователя подтягиваем его роль и вызываем завершение авторизации */ public function regenerate_user_profile() { $user = Auth::instance()->get_user(); $db = Oracle::init(); $user = $db->row("select * from " . Oracle::$prefix . "V_WEB_MANAGERS where MANAGER_ID = " . $user['MANAGER_ID']); $user['role'] = $user['ROLE_ID']; self::complete_login($user); }
/** * получаем настройки для шаблона отчета * * @param $reportId */ public static function getReportTemplateSettings($reportId) { if (empty($reportId)) { return false; } $db = Oracle::init(); $sql = "select * from " . Oracle::$prefix . "V_WEB_REPORTS_FORM t where t.report_id = " . Oracle::quote($reportId); $settings = $db->tree($sql, 'PROPERTY_TYPE'); return $settings; }
/** * получение справочников */ public static function getReference() { $db = Oracle::init(); $sql = "select * from " . Oracle::$prefix . "V_WEB_TARIF_CONSTRUCT t"; return $db->tree($sql, 'CONDITION_ID'); }
array_shift($parts); } $need_auth = true; # Work around to allow beamline sample registration without CAS authentication if (sizeof($parts) >= 2) { if ($parts[0] == 'assign' && in_array($_SERVER["REMOTE_ADDR"], $blsr) || $parts[0] == 'shipment' && $parts[1] == 'containers' && in_array($_SERVER["REMOTE_ADDR"], $blsr) || $parts[0] == 'cal' && $parts[1] == 'ics' && $parts[2] == 'h' || $parts[0] == 'shipment' && $parts[1] == 'dewars' && in_array($_SERVER["REMOTE_ADDR"], $bcr)) { $need_auth = false; } } if ($need_auth) { require_once 'lib/CAS/CAS.php'; phpCAS::client(CAS_VERSION_2_0, 'liveauth.diamond.ac.uk', 443, '/cas'); //phpCAS::setCasServerCACert($cacert); phpCAS::setNoCasServerValidation(); phpCAS::forceAuthentication(); } date_default_timezone_set('Europe/London'); include_once 'includes/class.page.php'; include_once 'includes/class.db.php'; $db = new Oracle($isb['user'], $isb['pass'], $isb['db'], $app); register_shutdown_function(array(&$db, '__destruct')); require_once 'includes/class.user.php'; $login = class_exists('phpCAS') ? phpCAS::getUser() : null; $user = new User($login, $db, $app); if ($parts[0] == 'logout') { $db->pq("INSERT INTO log4stat (id,priority,log4jtimestamp,msg,detail) \n VALUES (s_log4stat.nextval, 'ISPYB2_STAT', SYSDATE, 'LOGOFF', :1)", array($login)); phpCAS::logout(); } include_once 'includes/class.type.php'; $type = new ProposalType($app, $db, $user); $type->get_type();