<?php include_once __DIR__ . "/config.php"; include_once __DIR__ . "/db_common.php"; /** * ログインチェック */ if (\Sop\Session::getSiteData('user_id') === NULL) { \Sop\Api::exitWithSessionExpired(); }
<?php include_once __DIR__ . "/login_check.php"; include_once __DIR__ . "/config.php"; include_once __DIR__ . "/../../src/db_common.php"; /** * プロジェクト検体サンプル一覧 */ $db = createDBConnection(); // --------------------- // parameters 取得 // --------------------- $grp_id = \Sop\Session::getSiteData('grp_id'); $user_id = \Sop\Session::getSiteData('user_id'); $pj_id = array_key_exists('pj_id', $_REQUEST) ? $_REQUEST['pj_id'] : ''; $start = array_key_exists('start', $_REQUEST) ? intval($_REQUEST['start']) : 0; $limit = array_key_exists('limit', $_REQUEST) ? intval($_REQUEST['limit']) : 25; // --------------------- // データ取得 // --------------------- $sel_sql = getSQLBaseForPjSmplList(); $sel_sql .= " WHERE pj_smpl.pj_id = :pj_id AND v_pj.grp_id = :grp_id"; $params = array(); $params[':pj_id'] = $pj_id; $params[':grp_id'] = $grp_id; // --- 件数取得 $sql = "SELECT count(*) cnt FROM ({$sel_sql}) as tmp"; $stmt = $db->prepare($sql); $stmt->execute($params); $cnt = 0; foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
<?php require_once __DIR__ . '/../../src/bootstrap.php'; \Sop\Database::setupRedBean(); use InoOicClient\Flow\Basic; // 既存の情報はリセットする。 unset($_SESSION[\Sop\Session::getSiteData('siteKey')]); if (\Sop\Config::get('debug_pseudo_sso')) { $userInfo = array('sub' => \Sop\Config::get('debug_pseudo_sso_user'), 'updated_at' => 1424903837, 'email' => '*****@*****.**', 'name' => 'test user', 'family_name' => 'YAMADA', 'given_name' => 'Taro'); $_SESSION[\Sop\Session::getSiteData('siteKey')]['sso_user_id'] = $userInfo['sub']; \Sop\SingleSignOn::registerInitialUser($userInfo); \Sop\SingleSignOn::updateUserData($userInfo); } else { $flow = new Basic(Sop\SingleSignOn::getConfig()); try { $userInfo = $flow->process(); if ($userInfo['sub']) { $_SESSION[\Sop\Session::getSiteData('siteKey')]['sso_user_id'] = $userInfo['sub']; } \Sop\SingleSignOn::registerInitialUser($userInfo); \Sop\SingleSignOn::updateUserData($userInfo); } catch (\Exception $e) { $_SESSION[\Sop\Session::getSiteData('siteKey')]['sso_errors'] = array('シングル・サインオンの認証でエラーが発生しました。もう一度ログインを試してみてください。', $e->getMessage()); } } session_write_close(); header('Location:' . \Sop\Session::getSiteData('pathname'));
/** * 手順書のHTMLに入力フォームを注入する。 * * @param string $html HTML * @param int $tpl_id tpl_id * @param int $file_id ユーザー入力値を設定したい場合に指定する。nullの場合、初期値は空になる。 * @param int $replace_special {%name%}などを置換するかどうか */ public static function replaceFormInjectionTag($html, $tpl_id, $file_id = null, $replace_special = false) { // ---------------------------------------- // 入力欄とデフォルト値の取得 $sql = getSQLBaseForFormList(); $sql .= " AND form.tpl_id = :tpl_id"; $form_list = R::getAll($sql, array(':tpl_id' => $tpl_id)); // 初期値の設定 $initial_values = array(); $vals = array(); if ($file_id !== null) { $sql = getSQLBaseForValList(); $vals = R::getAll($sql, array('file_id' => $file_id)); } if (empty($vals)) { // 入力値が無い場合はデフォルト値を使用 foreach ($form_list as $form) { $name = 'input_' . intval($form['form_id']); $value = $form['default_value']; if ($replace_special) { // デフォルト値の場合、{%name%}などを置換する $value = str_replace('{%name%}', Session::getSiteData('user_name'), $value); $value = str_replace('{%group%}', Session::getSiteData('grp_name'), $value); $value = str_replace('{%mail%}', Session::getSiteData('email'), $value); } $initial_values[$name] = $value; } } else { foreach ($vals as $v) { $initial_values[$v['val_name']] = $v['value']; } } // ---------------------------------------- // 入力欄の追加 $formhtml = ''; foreach ($form_list as $form) { $top = intval($form['y']); $left = intval($form['x']); $width = intval($form['width']); $height = intval($form['height']); $name = 'input_' . intval($form['form_id']); $formhtml .= '<div' . ' class="injected-input"' . ' style="z-index:999; display:none; position:absolute; top:0; left:0"' . ' data-original-top="' . $top . '"' . ' data-original-left="' . $left . '"' . ' >'; switch ($form['type']) { case 'textbox': if ($height > 80) { $formhtml .= '<textarea' . ' class="injected-input-resizable autosave"' . ' style="font-size: 14px; outline: 3px solid #FA9500;"' . ' name="' . $name . '"' . ' data-original-width="' . $width . '"' . ' data-original-height="' . $height . '"' . ' />'; if (isset($initial_values[$name])) { $formhtml .= htmlspecialchars($initial_values[$name]); } $formhtml .= '</textarea>'; } else { $formhtml .= '<input' . ' class="injected-input-resizable autosave"' . ' style="font-size: 14px; outline: 3px solid #FA9500;"' . ' name="' . $name . '"' . ' value="' . (isset($initial_values[$name]) ? htmlspecialchars($initial_values[$name]) : '') . '"' . ' data-original-width="' . $width . '"' . ' data-original-height="' . $height . '"' . ' />'; } break; case 'checkbox': $formhtml .= '<input type="hidden" name="' . $name . '" value="off" />'; $formhtml .= '<input' . ' type="checkbox"' . ' class="autosave"' . ' name="' . $name . '"' . ' value="on"' . (isset($initial_values[$name]) && $initial_values[$name] == 'on' ? 'checked="checked"' : '') . ' data-original-width="' . $width . '"' . ' data-original-height="' . $height . '"' . ' style="outline: 3px solid #FA9500;"' . ' />'; break; } $formhtml .= '</div>'; } return str_replace(Constant::FORM_INJECTION_TAG, $formhtml, $html); }
<?php include_once __DIR__ . "/config.php"; include_once __DIR__ . "/db_common.php"; \Sop\Session::destroy();
$params = array(); $params[':user_id'] = $user_id; $stmt = $db->prepare($sql); $stmt->execute($params); $cnt = 0; foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) { $cnt = (int) $row['cnt']; } if ($cnt == 0) { \Sop\Log::warning(__FILE__, __LINE__, 'User tried to delete non-existent user.'); $msg001 = "This usr already has been delted."; // このユーザーは既に削除されています \Sop\Api::exitWithError(array($msg001)); } // 自分自身は削除不可 if (\Sop\Session::getSiteData('user_id') == $user_id) { \Sop\Log::warning(__FILE__, __LINE__, 'User tried to delete oneself.'); $msg002 = "You can not delete oneself."; // 自分自身は削除できません。 \Sop\Api::exitWithError(array($msg002)); } // --------------------------- // データ削除 // --------------------------- $db->beginTransaction(); // --- TBL: user $rslt = delUser($db, $user_id); if (!$rslt) { \Sop\Log::error(__FILE__, __LINE__, 'Failed to delete user.'); $msg003 = "The delete failed.: user"; // 削除に失敗しました: user
<?php error_reporting(E_ALL); setlocale(LC_ALL, 'ja_JP.UTF-8'); date_default_timezone_set('Asia/Tokyo'); ini_set('display_errors', 0); ini_set('log_errors', 1); define('_MPDF_TEMP_PATH', __DIR__ . '/../../uploaded_files/tmp/mpdf_tmp'); if (!is_dir(_MPDF_TEMP_PATH)) { mkdir(_MPDF_TEMP_PATH); } require_once __DIR__ . '/autoload.php'; require_once __DIR__ . '/../vendor/autoload.php'; \Sop\Config::initialize(__DIR__ . '/../config'); function sop_exception_handler($exception) { \Sop\Log::error(__FILE__, __LINE__, 'exception ' . $exception->getMessage()); } set_exception_handler('sop_exception_handler'); if (isset($_SERVER['REMOTE_ADDR'])) { \Sop\Session::start(); }
<?php require_once __DIR__ . '/../../src/bootstrap.php'; use InoOicClient\Flow\Basic; if (!isset($_REQUEST['session_site_key']) || !isset($_REQUEST['pathname'])) { exit; } \Sop\Session::setSiteData('siteKey', $_REQUEST['session_site_key']); \Sop\Session::setSiteData('pathname', $_REQUEST['pathname']); if (\Sop\Config::get('debug_pseudo_sso')) { session_write_close(); header('Location:' . 'callback'); } else { $flow = new Basic(Sop\SingleSignOn::getConfig()); try { $uri = $flow->getAuthorizationRequestUri('openid email profile'); session_write_close(); header('Location: ' . $uri); } catch (\Exception $e) { printf("Exception during authorization URI creation: [%s] %s", get_class($e), $e->getMessage()); } }
if ($cnt == 0) { \Sop\Log::warning(__FILE__, __LINE__, 'Invalid group is specified.'); $msg004 = "This group already has been deleted."; // このグループは既に削除されています: \Sop\Api::exitWithError(array("{$msg004} {$grp_id}")); } //} // --- 権限 $role_aprv = $role_aprv == '' ? '0' : '1'; $role_upld = $role_upld == '' ? '0' : '1'; $role_user = $role_user == '' ? '0' : '1'; $role = "{$role_aprv}{$role_upld}{$role_user}"; // 承認、登録、一般 の順で連結 ※例)100:承認、001:一般、101:承認+一般 $admin_flag = $admin_flag != '' ? 1 : 0; // 自分の管理権限は変更不可 if (\Sop\Session::getSiteData('user_id') == $user_id && $admin_flag == 0) { \Sop\Log::warning(__FILE__, __LINE__, 'User tried to delete own admin role.'); $msg005 = "You can not undo the administrative permission by oneself."; // 自分自身の管理権限は外せません。 \Sop\Api::exitWithError(array($msg005)); } // --------------------------- // データ登録 // --------------------------- $db->beginTransaction(); if ($div == 'add') { //削除済みユーザー $sel_sql = getSQLDeletedBaseForOneUser(); $sel_sql .= " AND user_id = :user_id"; $sql = "SELECT count(*) deleted_cnt FROM ({$sel_sql}) as tmp"; $params = array();