예제 #1
0
/**
 * あしあとを付ける
 */
function db_ashiato_insert_c_ashiato($c_member_id_to, $c_member_id_from)
{
    // 同一人物の場合は記録しない
    if ($c_member_id_to == $c_member_id_from) {
        return false;
    }
    // 一定時間以内の連続アクセスは記録しない
    $wait = date('Y-m-d H:i:s', strtotime('-5 minute'));
    $sql = 'SELECT c_ashiato_id FROM c_ashiato WHERE r_datetime > ?' . ' AND c_member_id_to = ? AND c_member_id_from = ?';
    $params = array($wait, intval($c_member_id_to), intval($c_member_id_from));
    if (db_get_one($sql, $params, 'main')) {
        return false;
    }
    // 忍び足
    if (USE_SHINOBIASHI) {
        if (db_member_is_shinobiashi($c_member_id_from)) {
            return false;
        }
    }
    $data = array('c_member_id_from' => intval($c_member_id_from), 'c_member_id_to' => intval($c_member_id_to), 'r_datetime' => db_now(), 'r_date' => db_now());
    if (!db_insert('c_ashiato', $data)) {
        return false;
    }
    if ($ashiato_mail_num = db_ashiato_ashiato_mail_num4c_member_id($c_member_id_to)) {
        //総足あと数を取得
        $ashiato_num = db_ashiato_c_ashiato_num4c_member_id($c_member_id_to);
        //あしあとお知らせメールを送る
        if ($ashiato_num == $ashiato_mail_num) {
            do_common_send_ashiato_mail($c_member_id_to, $c_member_id_from);
        }
    }
    return true;
}
예제 #2
0
 function _getTable()
 {
     $sql = "SELECT value FROM c_admin_config WHERE name = 'admin_hashtable'";
     if ($v = db_get_one($sql)) {
         return unserialize($v);
     } else {
         return array();
     }
 }
function missing_contrib_amount($DB, $trans_id, $error_detected)
{
    if (is_numeric($trans_id)) {
        $total_amount = db_get_one($DB, "SELECT trans_amount\n\t\t\t\t\t\t\t  FROM " . PREFIX_DB . "transactions\n\t\t\t\t\t\t\t  WHERE trans_id={$trans_id}", $error_detected);
        $current_amount = $DB->GetOne("SELECT SUM(montant_cotis)\n\t\t\t\t\t\t\tFROM " . PREFIX_DB . "cotisations\n\t\t\t\t\t\t\tWHERE trans_id={$trans_id}");
        return $total_amount - $current_amount;
    }
    return 0;
}
예제 #4
0
 function insert_login_reject()
 {
     $sql = 'SELECT COUNT(*) FROM c_login_failure WHERE ip_addr = ?';
     $params = array($this->ip_addr);
     if (db_get_one($sql, $params) >= $this->check_num) {
         $data = array('ip_addr' => $this->ip_addr, 'expired_at' => date('Y-m-d H:i:s', time() + $this->reject_time));
         db_insert('c_login_reject', $data);
     }
 }
예제 #5
0
 function execute($requests)
 {
     // メンバー数が1の場合のみ表示する
     $sql = 'SELECT COUNT(*) FROM c_member';
     if (db_get_one($sql) > 1) {
         exit;
     }
     return 'success';
 }
예제 #6
0
/**
 * @copyright 2005-2008 OpenPNE Project
 * @license   http://www.php.net/license/3_01.txt PHP License 3.01
 */
function db_api_get_member_token($c_member_id)
{
    $sql = 'SELECT token FROM c_api_member WHERE c_member_id = ?';
    $params = array(intval($c_member_id));
    if ($token = db_get_one($sql, $params)) {
        return $token;
    } else {
        return db_api_insert_token($c_member_id);
    }
}
예제 #7
0
function smarty_resource_db_timestamp($tpl_name, &$tpl_timestamp, &$smarty)
{
    $sql = 'SELECT r_datetime FROM c_template WHERE name = ?';
    $params = array(strval($tpl_name));
    if ($res = db_get_one($sql, $params)) {
        $tpl_timestamp = strtotime($res);
        return true;
    } else {
        return false;
    }
}
function get_point($c_member_id)
{
    $sql = 'SELECT c_profile_id FROM c_profile WHERE name = \'PNE_POINT\'';
    if (!($c_profile_id = db_get_one($sql))) {
        return 0;
    }
    $sql = 'SELECT value FROM c_member_profile WHERE c_member_id = ? AND c_profile_id = ?';
    $params = array(intval($c_member_id), intval($c_profile_id));
    $point = db_get_one($sql, $params);
    return intval($point);
}
function session_set_user_projects()
{
    $tbl_project = PROJECT_TBL;
    $f_proj_id = $tbl_project . "." . PROJ_ID;
    $f_proj_name = $tbl_project . "." . PROJ_NAME;
    $f_proj_deleted = $tbl_project . "." . PROJ_DELETED;
    $tbl_user = USER_TBL;
    $f_user_id = $tbl_user . "." . USER_ID;
    $f_username = $tbl_user . "." . USER_UNAME;
    $f_tempest_admin = $tbl_user . "." . USER_ADMIN;
    $f_user_default_project = $tbl_user . "." . USER_DEFAULT_PROJECT;
    $tbl_proj_user_assoc = PROJECT_USER_ASSOC_TBL;
    $f_proj_user_proj_id = $tbl_proj_user_assoc . "." . PROJ_USER_PROJ_ID;
    $f_proj_user_user_id = $tbl_proj_user_assoc . "." . PROJ_USER_USER_ID;
    $username = session_get_username();
    global $db;
    $q = "\tSELECT\t{$f_tempest_admin}\n\t\t\tFROM\t{$tbl_user}\n\t\t\tWHERE\t{$f_username} = '{$username}'";
    # tempest administrator
    if (db_get_one($db, $q) == "Y") {
        $q = "\tSELECT\t{$f_proj_name}\n\t\t\t\tFROM\t{$tbl_project}\n\t\t\t\tWHERE {$f_proj_deleted} = 'N'\n\t\t\t\tORDER BY {$f_proj_name} ASC";
    } else {
        # tempest user
        $q = "\tSELECT\t{$f_proj_name}\n\t\t\t\tFROM\t{$tbl_project}\n\t\t\t\tINNER JOIN {$tbl_proj_user_assoc} ON {$f_proj_id} = {$f_proj_user_proj_id}\n\t\t\t\tINNER JOIN {$tbl_user} ON {$f_proj_user_user_id} = {$f_user_id}\n\t\t\t\tWHERE {$f_username} = '{$username}'\n\t\t\t\tAND {$f_proj_deleted} = 'N'\n\t\t\t\tORDER BY {$f_proj_name} ASC";
    }
    $rows = db_fetch_array($db, db_query($db, $q));
    $project_array = array();
    foreach ($rows as $row) {
        $project_array[] = $row[PROJ_NAME];
    }
    $_SESSION['s_user_projects'] = $project_array;
}
예제 #10
0
function db_point_get_next_rank_point4rank_id($c_rank_id)
{
    $pre_point = db_point_get_rank_point4rank_id($c_rank_id);
    $sql = 'SELECT point FROM c_rank WHERE point > ? ORDER BY point';
    $params = array(intval($pre_point));
    return db_get_one($sql, $params);
}
예제 #11
0
function test_get_projectid($testid)
{
    global $db;
    $f_project_id = TEST_PROJ_ID;
    $f_test_tbl = TEST_TBL;
    $f_test_id = TEST_ID;
    $error = "SELECT COUNT({$f_project_id}) FROM {$f_test_tbl} WHERE {$f_test_id} = {$testid}";
    $q = "SELECT DISTINCT {$f_project_id} FROM {$f_test_tbl} WHERE {$f_test_id} = {$testid}";
    $return_id = db_get_one($db, $q);
    $error_rs = db_get_one($db, $error);
    if ($error_rs > 0) {
        return $return_id;
    } else {
        return 0;
    }
}
 $db_testset_status = TS_TBL . "." . TS_STATUS;
 $db_testset_signoff_by = TS_TBL . "." . TS_SIGNOFF_BY;
 $db_testset_signoff_date = TS_TBL . "." . TS_SIGNOFF_DATE;
 $db_testset_comments = TS_TBL . "." . TS_SIGNOFF_COMMENTS;
 $db_testset_orderby = TS_TBL . "." . TS_ORDERBY;
 $db_testset_build_id = TS_TBL . "." . TS_BUILD_ID;
 $db_testset_lock_date = TS_TBL . "." . TS_LOCKCHANGE_DATE;
 $db_testset_lock_by = TS_TBL . "." . TS_LOCK_BY;
 $db_testset_lock_comment = TS_TBL . "." . TS_LOCK_COMMENT;
 $q = "SELECT {$db_testset_id}, {$db_testset_build_id}, {$db_testset_name}, {$db_testset_date_created}, {$db_testset_desc}, {$db_testset_status}, {$db_testset_signoff_by}, {$db_testset_signoff_date}, {$db_testset_comments}, {$db_testset_orderby}, {$db_testset_lock_by}, {$db_testset_lock_date}, {$db_testset_lock_comment} FROM {$testset_tbl} WHERE {$db_testset_build_id} = '{$s_properties['build_id']}' ORDER BY {$db_testset_orderby} ASC" . NEWLINE;
 $rs = db_query($db, $q);
 $num = db_num_rows($db, $rs);
 //print"$q". NEWLINE;
 # QUERY FOR THE MAX TestSetOrderBy. USED IN TABLE FORMATTING
 $q_orderby = "SELECT MAX({$db_testset_orderby}) FROM {$testset_tbl} WHERE {$db_testset_build_id} = '{$s_properties['build_id']}'" . NEWLINE;
 $max_orderby = db_get_one($db, $q_orderby);
 //->GetOne($q_orderby);
 //print"$q_orderby<br>". NEWLINE;
 if ($num > 0) {
     //print"<H3 align=center>Test Plan for Release: <B> $row_build[ReleaseName] </B> and Build:  <B> $row_build[BuildName] </B> </H3>". NEWLINE;
     print "<p> The following Test Plan lists the different types/ stages of testing that are required in order to ensure that the application is adequately tested. Each stage of testing should be signed off to provide assurance and traceability that the application is ready to be released.</p>" . NEWLINE;
     # simplify the url used later on the page for href
     $query_string = "release_id=" . $s_properties['release_id'] . "&amp;build_id=" . $s_properties['build_id'];
     print "<br>" . NEWLINE;
     print "<div align='center'>" . NEWLINE;
     print "<table class='width100' rules='cols'>" . NEWLINE;
     print "<tr class='tbl_header'>" . NEWLINE;
     html_tbl_print_header(lang_get('id'));
     if ($max_orderby > 1) {
         html_tbl_print_header(lang_get('up'));
         html_tbl_print_header(lang_get('down'));
예제 #13
0
function admin_build_name_exists($release_id, $build_name)
{
    global $db;
    $build_tbl = BUILD_TBL;
    $f_build_name = $build_tbl . "." . BUILD_NAME;
    $f_release_id = $build_tbl . "." . BUILD_REL_ID;
    $q = "SELECT COUNT({$f_build_name})\n\t\t  FROM {$build_tbl}\n\t\t  WHERE {$f_build_name} = '{$build_name}'\n\t\t  AND {$f_release_id} = '{$release_id}'";
    $result = db_get_one($db, $q);
    if (0 == $result) {
        return false;
    } else {
        return true;
    }
}
/**
 * 前日のメッセージ件数
 */
function _getMessageCountYesterday()
{
    $yesterday = date('Y-m-d H:i:s', mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')));
    $today = date('Y-m-d H:i:s', mktime(0, 0, 0, date('m'), date('d'), date('Y')));
    $sql = 'SELECT COUNT(*) FROM c_message WHERE r_datetime >= ? AND r_datetime < ? AND is_send = 1';
    $params = array($yesterday, $today);
    return db_get_one($sql, $params);
}
예제 #15
0
function user_reset_password($reset_link, $new_password)
{
    $tbl_reset_pass = RESET_PASS_TBL;
    $f_reset_pass_id = $tbl_reset_pass . "." . RESET_PASS_ID;
    $f_reset_pass_link = $tbl_reset_pass . "." . RESET_PASS_LINK;
    $f_reset_pass_user = $tbl_reset_pass . "." . RESET_PASS_USER;
    $f_reset_pass_used = $tbl_reset_pass . "." . RESET_PASS_RESET_USED;
    $f_reset_pass_expires = $tbl_reset_pass . "." . RESET_PASS_EXPIRES;
    $tbl_user = USER_TBL;
    $f_user_id = $tbl_user . "." . USER_ID;
    $f_username = $tbl_user . "." . USER_UNAME;
    $f_email = $tbl_user . "." . USER_EMAIL;
    $f_first_name = $tbl_user . "." . USER_FNAME;
    $f_last_name = $tbl_user . "." . USER_LNAME;
    $f_phone = $tbl_user . "." . USER_PHONE;
    $f_password = $tbl_user . "." . USER_PWORD;
    $f_tempest_admin = $tbl_user . "." . USER_ADMIN;
    $f_user_default_project = $tbl_user . "." . USER_DEFAULT_PROJECT;
    global $db;
    # fetch the users email address where the record has not expired,
    # and reset link has not already been accessed
    $current_date = date_get_short_dt();
    $q = "\tSELECT {$f_reset_pass_user}\n\t\t\tFROM {$tbl_reset_pass}\n\t\t\tWHERE {$f_reset_pass_link} = '{$reset_link}'\n\t\t\t\tAND {$f_reset_pass_expires} > '{$current_date}'\n\t\t\t\tAND {$f_reset_pass_used} = 'N'";
    $email = db_get_one($db, $q);
    # if a users email address was returned
    if ($email) {
        # mark the reset link as used
        $q = "\tUPDATE {$tbl_reset_pass}\n\t\t\t\tSET {$f_reset_pass_used} = 'Y'\n\t\t\t\tWHERE {$f_reset_pass_link} = '{$reset_link}'";
        db_query($db, $q);
        # encrypt password
        if (LOGIN_METHOD == 'MD5') {
            $new_password = auth_process_plain_password($new_password);
        }
        # change the users password
        $q = "\tUPDATE {$tbl_user}\n\t\t\t\tSET {$f_password} = '{$new_password}'\n\t\t\t\tWHERE {$f_email} = '{$email}'";
        db_query($db, $q);
    }
    return $email;
}
예제 #16
0
/**
 * あなたがフレンドリンクを要請しているメンバー数を取得(リンク承認待ち)
 *
 * @param int $c_member_id
 * @return int 要請しているメンバー数
 */
function db_friend_count_c_anataga_friend_confirm($c_member_id)
{
    $sql = 'SELECT COUNT(*) FROM c_friend_confirm WHERE c_member_id_from = ?';
    $params = array(intval($c_member_id));
    return db_get_one($sql, $params);
}
function results_calculate_remaining_duration($testset_id, $total_duration)
{
    global $db;
    $test_duration = 0;
    $remaining_duration = 0;
    $test_ts_tbl = TEST_TS_ASSOC_TBL;
    $f_testset_id = TEST_TS_ASSOC_TS_ID;
    $f_ts_test_id = TEST_TS_ASSOC_TEST_ID;
    $f_status = TEST_TS_ASSOC_STATUS;
    $test_tbl = TEST_TBL;
    $f_test_id = TEST_ID;
    $f_duration = TEST_DURATION;
    $q = "SELECT {$f_ts_test_id}, {$f_status}\n\t\t  FROM {$test_ts_tbl}\n\t\t  WHERE {$f_testset_id} = '{$testset_id}'";
    $rs = db_query($db, $q);
    while ($row = db_fetch_row($db, $rs)) {
        $test_id = $row[TEST_TS_ASSOC_TEST_ID];
        $test_status = $row[TEST_TS_ASSOC_STATUS];
        $q_duration = "SELECT {$f_duration}\n\t\t\t\t\t   FROM {$test_tbl}\n\t\t\t\t\t   WHERE {$f_test_id} = '{$test_id}'";
        $test_duration = db_get_one($db, $q_duration);
        if ($test_status == 'WIP' || $test_status == 'Not Started') {
            $remaining_duration += $test_duration;
        }
    }
    $time = split('\\.', $remaining_duration / 60);
    $hours = $time[0];
    $minutes = $remaining_duration % 60;
    $remaining_duration = $hours . " Hours - " . $minutes . " minutes";
    if ($total_duration == 'Duration Not Specified') {
        $remaining_duration = "Duration Not Specified";
    }
    return $remaining_duration;
}
function requirement_name_exists($project_id, $req_name)
{
    global $db;
    $tbl_req = REQ_TBL;
    $f_req_proj_id = $tbl_req . "." . REQ_PROJECT_ID;
    $f_req_id = $tbl_req . "." . REQ_ID;
    $f_req_filename = $tbl_req . "." . REQ_FILENAME;
    $query = "\tSELECT COUNT({$f_req_filename})\n\t\t\t\tFROM {$tbl_req}\n\t\t\t\tWHERE {$f_req_filename}='{$req_name}'\n\t\t\t\t\tAND {$f_req_proj_id}={$project_id}";
    $result = db_get_one($db, $query);
    if ($result == 0) {
        return false;
    } else {
        return true;
    }
}
예제 #19
0
function db_rss_is_updated_rss_cache($c_member_id, $link)
{
    $sql = 'SELECT c_rss_cache_id FROM c_rss_cache' . ' WHERE c_member_id = ? AND link = ?';
    $params = array(intval($c_member_id), $link);
    return db_get_one($sql, $params);
}
예제 #20
0
function db_action_get_point4c_action_id($c_action_id)
{
    $sql = "SELECT point FROM c_action WHERE c_action_id = ?";
    $params = array(intval($c_action_id));
    return db_get_one($sql, $params);
}
예제 #21
0
function file_delete_unlink_file($filename, $upload_path)
{
    global $db;
    $manual_test_version_tbl = MAN_TD_VER_TBL;
    $tbl_filename = MAN_TD_VER_FILENAME;
    $manual_test_tbl = MAN_TD_TBL;
    $man_test_id_ver = MAN_TD_VER_MANUAL_TEST_ID;
    $man_test_id = MAN_TD_MANUAL_TEST_ID;
    $hq = "select {$man_test_id_ver} from {$manual_test_version_tbl} \n\t\t\twhere {$tbl_filename} = '{$filename}'";
    $mtestid = db_get_one($db, $hq);
    $q1 = "select count({$tbl_filename}) from {$manual_test_version_tbl} \n\t\t\twhere {$man_test_id} = {$mtestid}";
    $count = db_get_one($db, $q1);
    if ($count <= 1) {
        $q = "delete from {$manual_test_tbl} \n\t\t\t\twhere {$man_test_id} = {$mtestid}";
        $db->Execute($q);
    }
    $q2 = "delete from {$manual_test_version_tbl}\n\t\t\twhere {$tbl_filename} = '{$filename}'";
    $db->Execute($q2);
    exec("rm -f " . $upload_path . $filename);
}
예제 #22
0
function db_review_c_review_id4asin($asin)
{
    $sql = 'SELECT c_review_id FROM c_review' . ' WHERE asin = ?';
    return db_get_one($sql, array($asin));
}
예제 #23
0
function html_browse_release_menu($db, $page, $project_id, $display_property_group = "", $show_build = true, $show_testset = true)
{
    $release_tbl = RELEASE_TBL;
    $f_release_id = RELEASE_TBL . "." . RELEASE_ID;
    $f_project_id = RELEASE_TBL . "." . PROJECT_ID;
    $f_release_name = RELEASE_TBL . "." . RELEASE_NAME;
    $f_release_archive = RELEASE_TBL . "." . RELEASE_ARCHIVE;
    $f_release_date = RELEASE_TBL . "." . RELEASE_DATE_RECEIVED;
    $build_tbl = BUILD_TBL;
    $f_build_id = BUILD_TBL . "." . BUILD_ID;
    $f_build_rel_id = BUILD_TBL . "." . BUILD_REL_ID;
    $f_build_name = BUILD_TBL . "." . BUILD_NAME;
    $f_build_archive = BUILD_TBL . "." . BUILD_ARCHIVE;
    $f_build_date = BUILD_TBL . "." . BUILD_DATE_REC;
    $testset_tbl = TS_TBL;
    $f_testset_id = TS_TBL . "." . TS_ID;
    $f_testset_name = TS_TBL . "." . TS_NAME;
    $f_testset_date = TS_TBL . "." . TS_DATE_CREATED;
    $test_tbl = TEST_TBL;
    $f_test_id = TEST_ID;
    $f_test_name = TEST_NAME;
    if (isset($_GET["{$display_property_group}" . "_release_id"])) {
        $release_id = $_GET["{$display_property_group}" . "_release_id"];
    }
    if (isset($_GET["{$display_property_group}" . "_build_id"])) {
        $build_id = $_GET["{$display_property_group}" . "_build_id"];
    }
    if (isset($_GET["{$display_property_group}" . "_testset_id"])) {
        $testset_id = $_GET["{$display_property_group}" . "_testset_id"];
    }
    if (empty($filter["release_id"])) {
        $show_all = true;
    } else {
        $show_all = false;
    }
    //<!--Table for holding all other tables-->
    print "<table class='hide100'>" . NEWLINE;
    print "<tr>" . NEWLINE;
    print "<td>" . NEWLINE;
    # Release Name
    print "<table align='left'>" . NEWLINE;
    print "<tr>" . NEWLINE;
    print "<td class='sub_menu' nowrap><b><a href='{$page}?{$display_property_group}" . "_release_id=all'>" . lang_get('release_name') . "</a></b></td>" . NEWLINE;
    print "</tr>" . NEWLINE;
    # if the user has not selected a release show all releases
    if (!isset($release_id) || $release_id == 'all') {
        $q = "SELECT DISTINCT {$f_release_name}, {$f_release_id} FROM {$release_tbl} WHERE {$f_project_id} = '{$project_id}' AND  {$f_release_archive} = 'N' ORDER BY {$f_release_id}";
        $rs = db_query($db, $q);
        $rows = db_fetch_array($db, $rs);
        if ($rows) {
            foreach ($rows as $row_release) {
                $rel_id = $row_release[RELEASE_ID];
                $rel_name = $row_release[RELEASE_NAME];
                print "<tr>" . NEWLINE;
                print "<td class='sub_menu'><a href='{$page}?_release_id={$rel_id}'>{$rel_name}</a></td>" . NEWLINE;
                print "</tr>" . NEWLINE;
            }
        } else {
            print "<tr>" . NEWLINE;
            print "<td class='error'>" . lang_get('no_releases_in_project') . "</td>" . NEWLINE;
            print "</tr>" . NEWLINE;
        }
        print "</table>" . NEWLINE;
    } else {
        # Show the selected release and the build information
        $q_rel_name = "\tSELECT {$f_release_name}\n        \t\t\t\tFROM {$release_tbl}\n        \t\t\t\tWHERE {$f_release_id} = {$release_id}";
        $release_name = db_get_one($db, $q_rel_name);
        print "<tr>" . NEWLINE;
        print "<td class='sub_menu' nowrap>{$release_name}</td>" . NEWLINE;
        print "</tr>" . NEWLINE;
        print "</table>" . NEWLINE;
        print "<table align='left'>" . NEWLINE;
        print "<tr>" . NEWLINE;
        print "<td class='sub_menu'>&nbsp;</td>" . NEWLINE;
        print "</tr>" . NEWLINE;
        print "</table>" . NEWLINE;
        if ($show_build) {
            $q_build = "SELECT DISTINCT {$f_build_name},\n\t\t\t\t\t\t\t\t\t\t{$f_build_id}\n\t\t\t\t\t\tFROM {$build_tbl}\n\t\t\t\t\t\tWHERE {$f_build_archive} = 'N'\n\t\t\t\t\t\t\tAND {$f_build_rel_id} = {$release_id}\n\t\t\t\t\t\tORDER BY {$f_build_date} ASC";
            $rs_build = db_query($db, $q_build);
            $num_build = db_num_rows($db, $rs_build);
            # Build Name
            print "<table align='left'>" . NEWLINE;
            print "<tr>" . NEWLINE;
            print "<td class='sub_menu' nowrap><b><a href='{$page}?{$display_property_group}" . "_release_id={$release_id}&amp;{$display_property_group}" . "_build_id=all'>" . lang_get('build_name') . "</a></b></td>" . NEWLINE;
            print "</tr>" . NEWLINE;
            # if the user has not selected a build, show all builds
            if ((!isset($build_id) || $build_id == 'all') && $show_all == true) {
                if ($num_build == 0) {
                    # if there are no builds display a message
                    print "<tr>" . NEWLINE;
                    print "<td class='sub_menu'>" . lang_get('builds_none') . "\t</td>" . NEWLINE;
                    print "</tr>" . NEWLINE;
                    print "</table>" . NEWLINE;
                } else {
                    # Show all builds associated to the selected release
                    while ($row_build = db_fetch_row($db, $rs_build)) {
                        $b_name = $row_build[BUILD_NAME];
                        $b_id = $row_build[BUILD_ID];
                        print "<tr>" . NEWLINE;
                        print "<td class='sub_menu'><a href='{$page}?{$display_property_group}" . "_release_id={$release_id}&amp;{$display_property_group}" . "_build_id={$b_id}'>{$b_name}</a></td>" . NEWLINE;
                        print "</tr>" . NEWLINE;
                    }
                    print "</table>" . NEWLINE;
                }
            } else {
                # show the selected build and testset information
                $q_build_name = "\tSELECT {$f_build_name}\n\t\t\t\t\t\t\t\t\tFROM {$build_tbl}\n\t\t\t\t\t\t\t\t\tWHERE {$f_build_id} = {$build_id}";
                $build_name = db_get_one($db, $q_build_name);
                print "<tr>" . NEWLINE;
                print "<td class='sub_menu'>{$build_name}</td>" . NEWLINE;
                print "</tr>" . NEWLINE;
                print "</table>";
                print "<table align='left'>" . NEWLINE;
                print "<tr>" . NEWLINE;
                print "<td class='sub_menu'>&nbsp;</td>" . NEWLINE;
                print "</tr>" . NEWLINE;
                print "</table>" . NEWLINE;
                if ($show_testset) {
                    # Testset Name
                    print "<table align='left'>" . NEWLINE;
                    print "<tr>" . NEWLINE;
                    print "<td class='sub_menu' nowrap><b><a href='{$page}?{$display_property_group}" . "_release_id={$release_id}&amp;{$display_property_group}" . "_build_id={$build_id}&amp;{$display_property_group}" . "_testset_id=all'>" . lang_get('testset_name') . "</a></b></td>" . NEWLINE;
                    print "</tr>" . NEWLINE;
                    if (isset($testset_id) && $testset_id != 'all') {
                        $q_testset_name = "\tSELECT {$f_testset_name}\n\t\t\t\t\t\t\t\t\t\t\tFROM {$testset_tbl}\n\t\t\t\t\t\t\t\t\t\t\tWHERE {$f_testset_id} = {$testset_id}";
                        $testset_name = db_get_one($db, $q_testset_name);
                        print "<tr>" . NEWLINE;
                        print "<td class='sub_menu'>{$testset_name}</td>" . NEWLINE;
                        print "</tr>" . NEWLINE;
                        print "</table>" . NEWLINE;
                    } else {
                        $testset_tbl = TS_TBL;
                        $db_testset_id = TS_TBL . "." . TS_ID;
                        $db_testset_name = TS_TBL . "." . TS_NAME;
                        $db_testset_build_id = TS_TBL . "." . TS_BUILD_ID;
                        $q = "\tSELECT \t{$db_testset_name},\n\t\t\t\t\t\t\t\t\t\t{$db_testset_id}\n\t\t\t\t\t\t\t\tFROM {$testset_tbl}\n\t\t\t\t\t\t\t\tWHERE {$db_testset_build_id} = {$build_id}\n\t\t\t\t\t\t\t\tORDER BY {$f_testset_date} ASC";
                        $rows = db_fetch_array($db, db_query($db, $q));
                        if ($rows) {
                            foreach ($rows as $row) {
                                $testset_name = $row[TS_NAME];
                                $testset_id = $row[TS_ID];
                                print "<tr>" . NEWLINE;
                                print "<td class='sub_menu'><a href='{$page}?{$display_property_group}" . "_release_id={$release_id}&amp;" . "{$display_property_group}" . "_build_id={$build_id}&amp;" . "{$display_property_group}" . "_testset_id={$testset_id}" . "'>{$testset_name}</a></td>" . NEWLINE;
                                print "</tr>" . NEWLINE;
                            }
                            print "</table>" . NEWLINE;
                        } else {
                            print "<tr>" . NEWLINE;
                            print "<td class='sub_menu'><br>";
                            echo "<p class='error'>" . lang_get('no_testsets') . "</p>" . NEWLINE;
                            print "</tr>" . NEWLINE;
                            print "</table>" . NEWLINE;
                        }
                    }
                }
            }
        }
    }
    print "</td>" . NEWLINE;
    print "</tr>" . NEWLINE;
    print "</table>" . NEWLINE;
}
예제 #24
0
function db_get_last_autoincrement_id($db)
{
    $q = "SELECT LAST_INSERT_ID()";
    return db_get_one($db, $q);
}
         $DB->StartTrans();
         $query = "SELECT field_type, field_index FROM {$field_types_table}\n\t\t\t\t\t  WHERE field_id={$field_id} AND field_form={$quoted_form_name}";
         $res = db_execute($DB, $query, $error_detected);
         if ($res != false && !$res->EOF) {
             $old_rank = $res->fields['field_index'];
             $query_list = array();
             if ($action == "del") {
                 $query_list[] = "UPDATE {$field_types_table}\n\t\t\t\t\t\t\t\t SET field_index=field_index-1\n\t\t\t\t\t\t\t\t WHERE field_index > {$old_rank} AND\n\t\t\t\t\t\t\t\t       field_form={$quoted_form_name}";
                 $query_list[] = "DELETE FROM {$fields_table}\n\t\t\t\t\t\t\t\t WHERE field_id={$field_id} AND\n\t\t\t\t\t\t\t\t       field_form={$quoted_form_name}";
                 $query_list[] = "DELETE FROM {$field_types_table}\n\t\t\t\t\t\t\t\t WHERE field_id={$field_id} AND\n\t\t\t\t\t\t\t\t       field_form={$quoted_form_name}";
                 if ($field_properties[$res->fields['field_type']]['fixed_values']) {
                     $contents_table = fixed_values_table_name($field_id);
                     $query_list[] = "DROP TABLE {$contents_table}";
                 }
                 $query = "SELECT field_name\n\t\t\t\t\t\t\t  FROM {$field_types_table}\n\t\t\t\t\t\t\t  WHERE field_id={$field_id}";
                 $field_name = db_get_one($DB, $query, $error_detected);
                 delete_dynamic_translation($DB, $field_name, $error_detected);
             } elseif ($action != "") {
                 $direction = $action == "up" ? -1 : 1;
                 $new_rank = $old_rank + $direction;
                 $query_list[] = "UPDATE {$field_types_table}\n\t\t\t\t\t\t\t\t SET field_index={$old_rank}\n\t\t\t\t\t\t\t\t WHERE field_index={$new_rank} AND\n\t\t\t\t\t\t\t\t       field_form={$quoted_form_name}";
                 $query_list[] = "UPDATE {$field_types_table}\n\t\t\t\t\t\t\t\t SET field_index={$new_rank}\n\t\t\t\t\t\t\t\t WHERE field_id={$field_id} AND\n\t\t\t\t\t\t\t\t       field_form={$quoted_form_name}";
             }
             foreach ($query_list as $query) {
                 db_execute($DB, $query, $error_detected);
             }
         }
         $DB->CompleteTrans();
     }
 }
 $query = "SELECT *\n\t\t\t  FROM {$field_types_table}\n\t\t\t  WHERE field_form={$quoted_form_name}\n\t\t\t  ORDER BY field_index";
예제 #26
0
 public function authGetInfo($email)
 {
     $sql = "SELECT * FROM {$this->table} WHERE email='" . $email . "'";
     //echo $sql;die;
     return db_get_one($sql);
 }
예제 #27
0
 /**
  * 一定時間内の連続アクセスかどうか判定する
  *
  * @param  int $c_member_id_to あしあとをつけるメンバーのID
  * @param  int $c_member_id_from あしあとをつけられるメンバーのID
  * @return bool
  */
 function op_ashiato_check_access_minute($c_member_id_to, $c_member_id_from)
 {
     $wait = date('Y-m-d H:i:s', strtotime('-5 minute'));
     $sql = 'SELECT c_ashiato_id FROM c_ashiato WHERE r_datetime > ?' . ' AND c_member_id_to = ? AND c_member_id_from = ?';
     $params = array($wait, intval($c_member_id_to), intval($c_member_id_from));
     if (db_get_one($sql, $params)) {
         return false;
     } else {
         return true;
     }
 }
예제 #28
0
/** Get the last autoincrement ID
*/
function db_last_insert_id()
{
    $r = db_get_one("SELECT LAST_INSERT_ID() AS id");
    if (is_null($r)) {
        return NULL;
    } else {
        return $r['id'];
    }
}
예제 #29
0
/**
 * メッセージページの「各月のメッセージ」用
 *
 * メッセージを最初に書いた月からスタートしてみる
 */
function db_message_month_list4c_member_id($c_member_id, $box)
{
    if ($box == 'inbox' || !$box) {
        $where = "c_member_id_to = ?" . " AND is_deleted_to = 0" . " AND is_send = 1";
    } elseif ($box == 'outbox') {
        $where = "c_member_id_from = ?" . " AND is_deleted_from = 0" . " AND is_send = 1";
    } else {
        return null;
    }
    $sql = "SELECT r_datetime FROM c_message" . " WHERE {$where}" . " ORDER BY r_datetime";
    $params = array(intval($c_member_id));
    if (!($first_datetime = db_get_one($sql, $params))) {
        return array();
    }
    $start_date = getdate(strtotime($first_datetime));
    $end_date = getdate();
    $date = array();
    $year = $start_date['year'];
    $month = $start_date['mon'];
    while (1) {
        $date[] = array('year' => $year, 'month' => $month);
        if ($end_date['year'] <= $year && $end_date['mon'] <= $month) {
            break;
        }
        $month++;
        if ($month > 12) {
            $month = 1;
            $year++;
        }
    }
    return array_reverse($date);
}
예제 #30
0
function biz_deleteGroup($group_id, $c_member_id)
{
    // 画像削除
    $sql = 'SELECT image_filename FROM biz_group ' . 'WHERE biz_group_id = ? ';
    $params = array(intval($group_id));
    $image_filename = db_get_one($sql, $params, 'main');
    db_image_data_delete($image_filename, $c_member_id);
    $sql = 'DELETE FROM biz_group_member WHERE biz_group_id = ?';
    $params = array(intval($group_id));
    $result = db_query($sql, $params);
    $sql = 'DELETE FROM biz_group WHERE biz_group_id = ?';
    $params = array(intval($group_id));
    $result = db_query($sql, $params);
    $sql = 'UPDATE biz_schedule SET public_flag = "private", biz_group_id = NULL WHERE biz_group_id = ?';
    db_query($sql, array(intval($group_id)));
    $sql = 'DELETE FROM biz_todo WHERE biz_group_id = ?';
    db_query($sql, array(intval($group_id)));
}