当前位置: 首页>>代码示例>>PHP>>正文


PHP checkResult函数代码示例

本文整理汇总了PHP中checkResult函数的典型用法代码示例。如果您正苦于以下问题:PHP checkResult函数的具体用法?PHP checkResult怎么用?PHP checkResult使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了checkResult函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PMA_RTN_createRoutine

/**
 * Create the routine
 *
 * @param string $routine_query    Query to create routine
 * @param string $create_routine   Query to restore routine
 * @param array  $privilegesBackup Privileges backup
 *
 * @return array
 */
function PMA_RTN_createRoutine($routine_query, $create_routine, $privilegesBackup)
{
    $result = $GLOBALS['dbi']->tryQuery($routine_query);
    if (!$result) {
        $errors = array();
        $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($routine_query)) . '<br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
        // We dropped the old routine,
        // but were unable to create the new one
        // Try to restore the backup query
        $result = $GLOBALS['dbi']->tryQuery($create_routine);
        $errors = checkResult($result, __('Sorry, we failed to restore' . ' the dropped routine.'), $create_routine, $errors);
        return array($errors, null);
    }
    // Default value
    $resultAdjust = false;
    if ($GLOBALS['proc_priv'] && $GLOBALS['is_reload_priv']) {
        // Insert all the previous privileges
        // but with the new name and the new type
        foreach ($privilegesBackup as $priv) {
            $adjustProcPrivilege = 'INSERT INTO ' . Util::backquote('mysql') . '.' . Util::backquote('procs_priv') . ' VALUES("' . $priv[0] . '", "' . $priv[1] . '", "' . $priv[2] . '", "' . $_REQUEST['item_name'] . '", "' . $_REQUEST['item_type'] . '", "' . $priv[5] . '", "' . $priv[6] . '", "' . $priv[7] . '");';
            $resultAdjust = $GLOBALS['dbi']->query($adjustProcPrivilege);
        }
    }
    $message = PMA_RTN_flushPrivileges($resultAdjust);
    return array(array(), $message);
}
开发者ID:wp-cloud,项目名称:phpmyadmin,代码行数:35,代码来源:rte_routines.lib.php

示例2: PMA_RTN_handleEditor

/**
 * Handles editor requests for adding or editing an item
 *
 * @return void
 */
function PMA_RTN_handleEditor()
{
    global $_GET, $_POST, $_REQUEST, $GLOBALS, $db, $errors;
    if (!empty($_REQUEST['editor_process_add']) || !empty($_REQUEST['editor_process_edit'])) {
        /**
         * Handle a request to create/edit a routine
         */
        $sql_query = '';
        $routine_query = PMA_RTN_getQueryFromRequest();
        if (!count($errors)) {
            // set by PMA_RTN_getQueryFromRequest()
            // Execute the created query
            if (!empty($_REQUEST['editor_process_edit'])) {
                $isProcOrFunc = in_array($_REQUEST['item_original_type'], array('PROCEDURE', 'FUNCTION'));
                if (!$isProcOrFunc) {
                    $errors[] = sprintf(__('Invalid routine type: "%s"'), htmlspecialchars($_REQUEST['item_original_type']));
                } else {
                    // Backup the old routine, in case something goes wrong
                    $create_routine = $GLOBALS['dbi']->getDefinition($db, $_REQUEST['item_original_type'], $_REQUEST['item_original_name']);
                    if (!defined('PMA_DRIZZLE') || !PMA_DRIZZLE) {
                        if (isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv'] && isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']) {
                            // Backup the Old Privileges before dropping
                            // if $_REQUEST['item_adjust_privileges'] set
                            $privilegesBackup = array();
                            if (isset($_REQUEST['item_adjust_privileges']) && !empty($_REQUEST['item_adjust_privileges'])) {
                                $privilegesBackupQuery = 'SELECT * FROM ' . PMA_Util::backquote('mysql') . '.' . PMA_Util::backquote('procs_priv') . ' where Routine_name = "' . $_REQUEST['item_original_name'] . '" AND Routine_type = "' . $_REQUEST['item_original_type'] . '";';
                                $privilegesBackup = $GLOBALS['dbi']->fetchResult($privilegesBackupQuery, 0);
                            }
                        }
                    }
                    $drop_routine = "DROP {$_REQUEST['item_original_type']} " . PMA_Util::backquote($_REQUEST['item_original_name']) . ";\n";
                    $result = $GLOBALS['dbi']->tryQuery($drop_routine);
                    if (!$result) {
                        $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($drop_routine)) . '<br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
                    } else {
                        $result = $GLOBALS['dbi']->tryQuery($routine_query);
                        if (!$result) {
                            $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($routine_query)) . '<br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
                            // We dropped the old routine,
                            // but were unable to create the new one
                            // Try to restore the backup query
                            $result = $GLOBALS['dbi']->tryQuery($create_routine);
                            $errors = checkResult($result, __('Sorry, we failed to restore' . ' the dropped routine.'), $create_routine, $errors);
                        } else {
                            // Default value
                            $resultAdjust = false;
                            if (!defined('PMA_DRIZZLE') || !PMA_DRIZZLE) {
                                if (isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv'] && isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']) {
                                    // Insert all the previous privileges
                                    // but with the new name and the new type
                                    foreach ($privilegesBackup as $priv) {
                                        $adjustProcPrivilege = 'INSERT INTO ' . PMA_Util::backquote('mysql') . '.' . PMA_Util::backquote('procs_priv') . ' VALUES("' . $priv[0] . '", "' . $priv[1] . '", "' . $priv[2] . '", "' . $_REQUEST['item_name'] . '", "' . $_REQUEST['item_type'] . '", "' . $priv[5] . '", "' . $priv[6] . '", "' . $priv[7] . '");';
                                        $resultAdjust = $GLOBALS['dbi']->query($adjustProcPrivilege);
                                    }
                                }
                            }
                            if ($resultAdjust) {
                                // Flush the Privileges
                                $flushPrivQuery = 'FLUSH PRIVILEGES;';
                                $GLOBALS['dbi']->query($flushPrivQuery);
                                $message = PMA_Message::success(__('Routine %1$s has been modified. Privileges have been adjusted.'));
                            } else {
                                $message = PMA_Message::success(__('Routine %1$s has been modified.'));
                            }
                            $message->addParam(PMA_Util::backquote($_REQUEST['item_name']));
                            $sql_query = $drop_routine . $routine_query;
                        }
                    }
                }
            } else {
                // 'Add a new routine' mode
                $result = $GLOBALS['dbi']->tryQuery($routine_query);
                if (!$result) {
                    $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($routine_query)) . '<br /><br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
                } else {
                    $message = PMA_Message::success(__('Routine %1$s has been created.'));
                    $message->addParam(PMA_Util::backquote($_REQUEST['item_name']));
                    $sql_query = $routine_query;
                }
            }
        }
        if (count($errors)) {
            $message = PMA_Message::error(__('One or more errors have occurred while' . ' processing your request:'));
            $message->addString('<ul>');
            foreach ($errors as $string) {
                $message->addString('<li>' . $string . '</li>');
            }
            $message->addString('</ul>');
        }
        $output = PMA_Util::getMessage($message, $sql_query);
        if ($GLOBALS['is_ajax_request']) {
            $response = PMA_Response::getInstance();
            if ($message->isSuccess()) {
                $routines = $GLOBALS['dbi']->getRoutines($db, $_REQUEST['item_type'], $_REQUEST['item_name']);
                $routine = $routines[0];
//.........这里部分代码省略.........
开发者ID:shorifulislam00,项目名称:phpmyadmin,代码行数:101,代码来源:rte_routines.lib.php

示例3: checkIndividually

function checkIndividually()
{
    #----------------------------------------------------------------------
    global $competitionCondition, $chosenWhich;
    echo "<hr /><p>Checking <b>" . $chosenWhich . " individual results</b>... (wait for the result message box at the end)</p>\n";
    #--- Get all results (id, values, format, round).
    $dbResult = mysql_query("\n    SELECT\n      result.id, formatId, roundId, personId, competitionId, eventId, result.countryId,\n      value1, value2, value3, value4, value5, best, average\n    FROM Results result, Competitions competition\n    WHERE competition.id = competitionId\n      {$competitionCondition}\n    ORDER BY formatId, competitionId, eventId, roundId, result.id\n  ") or die("<p>Unable to perform database query.<br/>\n(" . mysql_error() . ")</p>\n");
    #--- Build id sets
    $countryIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Countries")));
    $competitionIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Competitions")));
    $eventIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Events")));
    $formatIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Formats")));
    $roundIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Rounds")));
    #--- Process the results.
    $badIds = array();
    echo "<pre>\n";
    while ($result = mysql_fetch_array($dbResult)) {
        if ($error = checkResult($result, $countryIdSet, $competitionIdSet, $eventIdSet, $formatIdSet, $roundIdSet)) {
            extract($result);
            echo "Error: {$error}\nid:{$id} format:{$formatId} round:{$roundId}";
            echo " ({$value1},{$value2},{$value3},{$value4},{$value5}) best+average({$best},{$average})\n";
            echo "{$personId}   {$countryId}   {$competitionId}   {$eventId}\n\n";
            $badIds[] = $id;
        }
    }
    echo "</pre>";
    #--- Free the results.
    mysql_free_result($dbResult);
    #--- Tell the result.
    noticeBox2(!count($badIds), "All checked results pass our checking procedure successfully.<br />" . wcaDate(), count($badIds) . " errors found. Get them with this:<br /><br />SELECT * FROM Results WHERE id in (" . implode(', ', $badIds) . ")");
}
开发者ID:Baiqiang,项目名称:worldcubeassociation.org,代码行数:31,代码来源:check_results.php

示例4: PMA_EVN_handleEditor

/**
 * Handles editor requests for adding or editing an item
 *
 * @return void
 */
function PMA_EVN_handleEditor()
{
    global $_REQUEST, $_POST, $errors, $db;
    if (!empty($_REQUEST['editor_process_add']) || !empty($_REQUEST['editor_process_edit'])) {
        $sql_query = '';
        $item_query = PMA_EVN_getQueryFromRequest();
        if (!count($errors)) {
            // set by PMA_RTN_getQueryFromRequest()
            // Execute the created query
            if (!empty($_REQUEST['editor_process_edit'])) {
                // Backup the old trigger, in case something goes wrong
                $create_item = $GLOBALS['dbi']->getDefinition($db, 'EVENT', $_REQUEST['item_original_name']);
                $drop_item = "DROP EVENT " . PMA\libraries\Util::backquote($_REQUEST['item_original_name']) . ";\n";
                $result = $GLOBALS['dbi']->tryQuery($drop_item);
                if (!$result) {
                    $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($drop_item)) . '<br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
                } else {
                    $result = $GLOBALS['dbi']->tryQuery($item_query);
                    if (!$result) {
                        $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($item_query)) . '<br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
                        // We dropped the old item, but were unable to create
                        // the new one. Try to restore the backup query
                        $result = $GLOBALS['dbi']->tryQuery($create_item);
                        $errors = checkResult($result, __('Sorry, we failed to restore the dropped event.'), $create_item, $errors);
                    } else {
                        $message = PMA\libraries\Message::success(__('Event %1$s has been modified.'));
                        $message->addParam(PMA\libraries\Util::backquote($_REQUEST['item_name']));
                        $sql_query = $drop_item . $item_query;
                    }
                }
            } else {
                // 'Add a new item' mode
                $result = $GLOBALS['dbi']->tryQuery($item_query);
                if (!$result) {
                    $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($item_query)) . '<br /><br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
                } else {
                    $message = PMA\libraries\Message::success(__('Event %1$s has been created.'));
                    $message->addParam(PMA\libraries\Util::backquote($_REQUEST['item_name']));
                    $sql_query = $item_query;
                }
            }
        }
        if (count($errors)) {
            $message = PMA\libraries\Message::error('<b>' . __('One or more errors have occurred while processing your request:') . '</b>');
            $message->addString('<ul>');
            foreach ($errors as $string) {
                $message->addString('<li>' . $string . '</li>');
            }
            $message->addString('</ul>');
        }
        $output = PMA\libraries\Util::getMessage($message, $sql_query);
        if ($GLOBALS['is_ajax_request']) {
            $response = PMA\libraries\Response::getInstance();
            if ($message->isSuccess()) {
                $events = $GLOBALS['dbi']->getEvents($db, $_REQUEST['item_name']);
                $event = $events[0];
                $response->addJSON('name', htmlspecialchars(mb_strtoupper($_REQUEST['item_name'])));
                $response->addJSON('new_row', PMA_EVN_getRowForList($event));
                $response->addJSON('insert', !empty($event));
                $response->addJSON('message', $output);
            } else {
                $response->setRequestStatus(false);
                $response->addJSON('message', $message);
            }
            exit;
        }
    }
    /**
     * Display a form used to add/edit a trigger, if necessary
     */
    if (count($errors) || empty($_REQUEST['editor_process_add']) && empty($_REQUEST['editor_process_edit']) && (!empty($_REQUEST['add_item']) || !empty($_REQUEST['edit_item']) || !empty($_REQUEST['item_changetype']))) {
        // FIXME: this must be simpler than that
        $operation = '';
        if (!empty($_REQUEST['item_changetype'])) {
            $operation = 'change';
        }
        // Get the data for the form (if any)
        if (!empty($_REQUEST['add_item'])) {
            $title = PMA_RTE_getWord('add');
            $item = PMA_EVN_getDataFromRequest();
            $mode = 'add';
        } else {
            if (!empty($_REQUEST['edit_item'])) {
                $title = __("Edit event");
                if (!empty($_REQUEST['item_name']) && empty($_REQUEST['editor_process_edit']) && empty($_REQUEST['item_changetype'])) {
                    $item = PMA_EVN_getDataFromName($_REQUEST['item_name']);
                    if ($item !== false) {
                        $item['item_original_name'] = $item['item_name'];
                    }
                } else {
                    $item = PMA_EVN_getDataFromRequest();
                }
                $mode = 'edit';
            }
        }
//.........这里部分代码省略.........
开发者ID:rclakmal,项目名称:phpmyadmin,代码行数:101,代码来源:rte_events.lib.php

示例5: checkResult

        checkResult($res, 'usage_balance', 'error_loc', &$buy_message);
    } elseif ($_POST['issuer'] != '') {
        $res = $client->issuer($common_type, $issuer_orig, $issuer_dest, &$url);
        checkResult($res, 'status', 'status', &$issuer_message);
    } elseif ($_POST['touch'] != '') {
        $res = $client->touch($common_type, $touch_loc, &$url);
        checkResult($res, 'value', 'error_loc', &$touch_message);
    } elseif ($_POST['look'] != '') {
        $res = $client->look($common_type, $look_hash, &$url);
        checkResult($res, 'value', 'error_loc', &$look_message);
    } elseif ($_POST['move'] != '') {
        $res = $client->move($common_type, $move_qty, $move_orig, $move_dest, &$url);
        checkResult($res, 'value_dest', 'error_qty', &$move_message);
    } elseif ($_POST['move_back'] != '') {
        $res = $client->move($common_type, $move_qty, $move_dest, $move_orig, &$url);
        checkResult($res, 'value_orig', 'error_qty', &$move_message);
    }
} else {
    if ($page == 'archive') {
        if ($_POST['look_archive'] != '') {
            $res = $client->look_archive($look_hash, &$url);
            if ($res != '') {
                $content = htmlspecialchars($res['content']);
            }
        } elseif ($_POST['touch_archive'] != '') {
            $res = $client->touch_archive($touch_loc, &$url);
            if ($res != '') {
                $content = htmlspecialchars($res['content']);
                if ($res['hash'] != '') {
                    $look_hash = $res['hash'];
                }
开发者ID:billstclair,项目名称:loomclient,代码行数:31,代码来源:grid-tutorial.php

示例6: PMA_RTN_handleEditor

/**
 * Handles editor requests for adding or editing an item
 *
 * @return void
 */
function PMA_RTN_handleEditor()
{
    global $_GET, $_POST, $_REQUEST, $GLOBALS, $db, $errors;
    if (!empty($_REQUEST['editor_process_add']) || !empty($_REQUEST['editor_process_edit'])) {
        /**
         * Handle a request to create/edit a routine
         */
        $sql_query = '';
        $routine_query = PMA_RTN_getQueryFromRequest();
        if (!count($errors)) {
            // set by PMA_RTN_getQueryFromRequest()
            // Execute the created query
            if (!empty($_REQUEST['editor_process_edit'])) {
                $isProcOrFunc = in_array($_REQUEST['item_original_type'], array('PROCEDURE', 'FUNCTION'));
                if (!$isProcOrFunc) {
                    $errors[] = sprintf(__('Invalid routine type: "%s"'), htmlspecialchars($_REQUEST['item_original_type']));
                } else {
                    // Backup the old routine, in case something goes wrong
                    $create_routine = $GLOBALS['dbi']->getDefinition($db, $_REQUEST['item_original_type'], $_REQUEST['item_original_name']);
                    $drop_routine = "DROP {$_REQUEST['item_original_type']} " . PMA_Util::backquote($_REQUEST['item_original_name']) . ";\n";
                    $result = $GLOBALS['dbi']->tryQuery($drop_routine);
                    if (!$result) {
                        $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($drop_routine)) . '<br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
                    } else {
                        $result = $GLOBALS['dbi']->tryQuery($routine_query);
                        if (!$result) {
                            $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($routine_query)) . '<br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
                            // We dropped the old routine,
                            // but were unable to create the new one
                            // Try to restore the backup query
                            $result = $GLOBALS['dbi']->tryQuery($create_routine);
                            $errors = checkResult($result, __('Sorry, we failed to restore' . ' the dropped routine.'), $create_routine, $errors);
                        } else {
                            $message = PMA_Message::success(__('Routine %1$s has been modified.'));
                            $message->addParam(PMA_Util::backquote($_REQUEST['item_name']));
                            $sql_query = $drop_routine . $routine_query;
                        }
                    }
                }
            } else {
                // 'Add a new routine' mode
                $result = $GLOBALS['dbi']->tryQuery($routine_query);
                if (!$result) {
                    $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($routine_query)) . '<br /><br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
                } else {
                    $message = PMA_Message::success(__('Routine %1$s has been created.'));
                    $message->addParam(PMA_Util::backquote($_REQUEST['item_name']));
                    $sql_query = $routine_query;
                }
            }
        }
        if (count($errors)) {
            $message = PMA_Message::error(__('One or more errors have occurred while' . ' processing your request:'));
            $message->addString('<ul>');
            foreach ($errors as $string) {
                $message->addString('<li>' . $string . '</li>');
            }
            $message->addString('</ul>');
        }
        $output = PMA_Util::getMessage($message, $sql_query);
        if ($GLOBALS['is_ajax_request']) {
            $response = PMA_Response::getInstance();
            if ($message->isSuccess()) {
                $columns = "`SPECIFIC_NAME`, `ROUTINE_NAME`, `ROUTINE_TYPE`," . " `DTD_IDENTIFIER`, `ROUTINE_DEFINITION`";
                $where = "ROUTINE_SCHEMA " . PMA_Util::getCollateForIS() . "=" . "'" . PMA_Util::sqlAddSlashes($db) . "' " . "AND ROUTINE_NAME='" . PMA_Util::sqlAddSlashes($_REQUEST['item_name']) . "'" . "AND ROUTINE_TYPE='" . PMA_Util::sqlAddSlashes($_REQUEST['item_type']) . "'";
                $routine = $GLOBALS['dbi']->fetchSingleRow("SELECT {$columns} FROM `INFORMATION_SCHEMA`.`ROUTINES`" . " WHERE {$where};");
                $response->addJSON('name', htmlspecialchars(mb_strtoupper($_REQUEST['item_name'])));
                $response->addJSON('new_row', PMA_RTN_getRowForList($routine));
                $response->addJSON('insert', !empty($routine));
                $response->addJSON('message', $output);
            } else {
                $response->isSuccess(false);
                $response->addJSON('message', $output);
            }
            exit;
        }
    }
    /**
     * Display a form used to add/edit a routine, if necessary
     */
    // FIXME: this must be simpler than that
    if (count($errors) || empty($_REQUEST['editor_process_add']) && empty($_REQUEST['editor_process_edit']) && (!empty($_REQUEST['add_item']) || !empty($_REQUEST['edit_item']) || !empty($_REQUEST['routine_addparameter']) || !empty($_REQUEST['routine_removeparameter']) || !empty($_REQUEST['routine_changetype']))) {
        // Handle requests to add/remove parameters and changing routine type
        // This is necessary when JS is disabled
        $operation = '';
        if (!empty($_REQUEST['routine_addparameter'])) {
            $operation = 'add';
        } else {
            if (!empty($_REQUEST['routine_removeparameter'])) {
                $operation = 'remove';
            } else {
                if (!empty($_REQUEST['routine_changetype'])) {
                    $operation = 'change';
                }
            }
//.........这里部分代码省略.........
开发者ID:Sorekk,项目名称:cvillecouncilus,代码行数:101,代码来源:rte_routines.lib.php

示例7: PMA_TRI_handleEditor

/**
 * Handles editor requests for adding or editing an item
 *
 * @return void
 */
function PMA_TRI_handleEditor()
{
    global $_REQUEST, $_POST, $errors, $db, $table;
    if (!empty($_REQUEST['editor_process_add']) || !empty($_REQUEST['editor_process_edit'])) {
        $sql_query = '';
        $item_query = PMA_TRI_getQueryFromRequest();
        if (!count($errors)) {
            // set by PMA_RTN_getQueryFromRequest()
            // Execute the created query
            if (!empty($_REQUEST['editor_process_edit'])) {
                // Backup the old trigger, in case something goes wrong
                $trigger = PMA_TRI_getDataFromName($_REQUEST['item_original_name']);
                $create_item = $trigger['create'];
                $drop_item = $trigger['drop'] . ';';
                $result = $GLOBALS['dbi']->tryQuery($drop_item);
                if (!$result) {
                    $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($drop_item)) . '<br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
                } else {
                    $result = $GLOBALS['dbi']->tryQuery($item_query);
                    if (!$result) {
                        $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($item_query)) . '<br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
                        // We dropped the old item, but were unable to create the
                        // new one. Try to restore the backup query.
                        $result = $GLOBALS['dbi']->tryQuery($create_item);
                        $errors = checkResult($result, __('Sorry, we failed to restore the dropped trigger.'), $create_item, $errors);
                    } else {
                        $message = PMA\libraries\Message::success(__('Trigger %1$s has been modified.'));
                        $message->addParam(PMA\libraries\Util::backquote($_REQUEST['item_name']));
                        $sql_query = $drop_item . $item_query;
                    }
                }
            } else {
                // 'Add a new item' mode
                $result = $GLOBALS['dbi']->tryQuery($item_query);
                if (!$result) {
                    $errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($item_query)) . '<br /><br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
                } else {
                    $message = PMA\libraries\Message::success(__('Trigger %1$s has been created.'));
                    $message->addParam(PMA\libraries\Util::backquote($_REQUEST['item_name']));
                    $sql_query = $item_query;
                }
            }
        }
        if (count($errors)) {
            $message = PMA\libraries\Message::error('<b>' . __('One or more errors have occurred while processing your request:') . '</b>');
            $message->addHtml('<ul>');
            foreach ($errors as $string) {
                $message->addHtml('<li>' . $string . '</li>');
            }
            $message->addHtml('</ul>');
        }
        $output = PMA\libraries\Util::getMessage($message, $sql_query);
        if ($GLOBALS['is_ajax_request']) {
            $response = PMA\libraries\Response::getInstance();
            if ($message->isSuccess()) {
                $items = $GLOBALS['dbi']->getTriggers($db, $table, '');
                $trigger = false;
                foreach ($items as $value) {
                    if ($value['name'] == $_REQUEST['item_name']) {
                        $trigger = $value;
                    }
                }
                $insert = false;
                if (empty($table) || $trigger !== false && $table == $trigger['table']) {
                    $insert = true;
                    $response->addJSON('new_row', PMA_TRI_getRowForList($trigger));
                    $response->addJSON('name', htmlspecialchars(mb_strtoupper($_REQUEST['item_name'])));
                }
                $response->addJSON('insert', $insert);
                $response->addJSON('message', $output);
            } else {
                $response->addJSON('message', $message);
                $response->setRequestStatus(false);
            }
            exit;
        }
    }
    /**
     * Display a form used to add/edit a trigger, if necessary
     */
    if (count($errors) || empty($_REQUEST['editor_process_add']) && empty($_REQUEST['editor_process_edit']) && (!empty($_REQUEST['add_item']) || !empty($_REQUEST['edit_item']))) {
        // Get the data for the form (if any)
        if (!empty($_REQUEST['add_item'])) {
            $title = PMA_RTE_getWord('add');
            $item = PMA_TRI_getDataFromRequest();
            $mode = 'add';
        } else {
            if (!empty($_REQUEST['edit_item'])) {
                $title = __("Edit trigger");
                if (!empty($_REQUEST['item_name']) && empty($_REQUEST['editor_process_edit'])) {
                    $item = PMA_TRI_getDataFromName($_REQUEST['item_name']);
                    if ($item !== false) {
                        $item['item_original_name'] = $item['item_name'];
                    }
                } else {
//.........这里部分代码省略.........
开发者ID:phpmyadmin,项目名称:phpmyadmin,代码行数:101,代码来源:rte_triggers.lib.php

示例8: officerWork

function officerWork($id, $pp_kod)
{
    ?>
  <div class="row">
  <?php 
    if ($id == 2) {
        ?>
    <div class="alert alert-sm alert-border-left alert-primary"><b>Comment from Lab Admin</b></div>
  <?php 
    } elseif ($id == 5 || $id == 6) {
        ?>
    <div class="alert alert-sm alert-border-left alert-primary"><b>Assign Lab</b></div>
  <?php 
    } elseif ($id == 8 or evaluate($pp_kod) == 2) {
        ?>
    <div class="alert alert-sm alert-border-left alert-primary"><b>Result</b></div>
  <?php 
    } elseif (evaluate($pp_kod) == 1) {
        ?>
    <div class="alert alert-sm alert-border-left alert-primary"><b>Assign Pharmacist</b></div>
  <?php 
    } elseif (evaluate($pp_kod) == 0 and $id != 31) {
        ?>
    <div class="alert alert-sm alert-border-left alert-primary"><b>Evaluator Comment</b></div>
  <?php 
    }
    ?>
  </div>
  <?php 
    if ($id == 5 || $id == 6) {
        ?>
  <div class="col-md-2">Lab List</div>
  <div class="col-md-1">:</div>
  <div class="col-md-5">
    <select id="txt_lab" class="form-control">
        <option value='0'>-- Please Select --</option>
        <?php 
        getLab();
        ?>
    </select>
  </div>
  <div class="col-md-4">
    <button class="btn btn-primary" onclick="assignTest('<?php 
        echo $pp_kod;
        ?>
')"><i class="fa fa-flask"></i> Assign Lab</button>
  </div>
  <div class="col-md-12">&nbsp;</div>
  <?php 
    } elseif ($id == 8 or evaluate($pp_kod) == 2) {
        ?>
  <div class="col-md-2">Result</div>
  <div class="col-md-1">:</div>
  <div class="col-md-9">
    <label for="comply_01" class="option">
      <input type="radio" name="comply" id="comply_01" <?php 
        checkResult($pp_kod, 1);
        ?>
 disabled>
      <span class="radio"></span>Accepted
    </label>
    <label for="comply_02" class="option">
      <input type="radio" name="comply" id="comply_02" <?php 
        checkResult($pp_kod, 2);
        ?>
 disabled>
      <span class="radio"></span>Unaccepted
    </label>
  </div>
  <div class="col-md-12">&nbsp;</div>
  <div class="col-md-2">Evaluate by</div>
  <div class="col-md-1">:</div>
  <div class="col-md-4">
    <label class="field prepend-icon">
      <?php 
        $query = "SELECT la_us_id FROM lab_assign\n                  WHERE la_pp_kod='{$pp_kod}' AND la_ru_kod='" . $_SESSION['ru_kod'] . "'";
        $result = selQuery($query);
        $row = mysqli_fetch_assoc($result);
        ?>
      <input type="hidden" id="pharmacist_id" value="<?php 
        echo $row['la_us_id'];
        ?>
"/>
      <input type="text" id="txt_pharmacist" class="gui-input" readonly value="<?php 
        echo getUsername($row['la_us_id']);
        ?>
">
      <label for="txt_pharmacist" class="field-icon">
        <i class="fa fa-user-md"></i>
      </label>
    </label>
  </div>
  <div class="col-md-2">
    <button class="btn btn-primary" onclick="viewPharma('protocol')"><i class="fa fa-exchange"></i> Change</button>
  </div>
  <div class="col-md-12">&nbsp;</div>
  <?php 
    } elseif (evaluate($pp_kod) == 1) {
        ?>
  <div class="col-md-2">Pharmacist</div>
//.........这里部分代码省略.........
开发者ID:syafiqazwan,项目名称:pharmaco,代码行数:101,代码来源:pkk.php

示例9: checkResult

    $thmb->save($result . '.gif');
    checkResult($t, 200, 200, 'image/gif');
    $t->diag('creates image from string');
    $thmb = new sfThumbnail(200, 200, false, true, 75, $adapter, array());
    $blob = file_get_contents($data['blob']);
    $thmb->loadData($blob, 'image/jpeg');
    $thmb->save($result . '.jpg', 'image/jpeg');
    checkResult($t, 200, 200, 'image/jpeg');
    // imagemagick-specific tests
    if ($adapter == 'sfImageMagickAdapter') {
        $t = new my_lime_test($tests_imagemagick, new lime_output_color());
        $t->diag('creates thumbnail from pdf', $adapter);
        $thmb = new sfThumbnail(150, 150, true, true, 75, $adapter, array('extract' => 1));
        $thmb->loadFile($data['document/pdf']);
        $thmb->save($result . '.jpg');
        checkResult($t, 150, 116, 'image/jpeg');
    }
}
function checkResult($t, $width, $height, $mime)
{
    global $mimeMap;
    $result = getResultPath();
    $result .= '.' . $mimeMap[$mime];
    // check generated thumbnail for expected results
    // use getimagesize() when possible, otherwise use 'identify'
    $imgData = @getimagesize($result);
    if ($imgData) {
        $res_width = $imgData[0];
        $res_height = $imgData[1];
        $res_mime = $imgData['mime'];
    } else {
开发者ID:nixilla,项目名称:sfThumbnailPlugin,代码行数:31,代码来源:sfThumbnailTest.php

示例10: score

function score($question_id, $answer_opt_id)
{
    (int) ($score = checkResult($question_id, $answer_opt_id));
    $_SESSION['isScored' . $question_id . ''] = $score;
    $_SESSION['result'] = (int) $_SESSION['result'] + $score;
}
开发者ID:uchechukwudim,项目名称:testandtreatmalaria,代码行数:6,代码来源:getQuestions.php

示例11: getFreezers

include 'thermo_includes.php';
print "<pre>";
$myarray = getFreezers($datafile);
$rec_count = count($myarray);
print "Fetching last 30 minutes for {$rec_count} receivers.\n";
$j = 0;
foreach ($myarray as $receiver => $array_of_freezers) {
    print "Receiver: {$receiver}\n";
    foreach ($array_of_freezers as $id => $freezer_array) {
        $db_name = $freezer_array[1];
        $label = $freezer_array[2];
        print "{$label} \t : {$db_name} \t : ";
        $result = getTempAvg($db_name);
        if ($result != 999) {
            print ": \tAVG: {$result} \t";
            $check = checkResult($result, $threshold);
            if (!$check) {
                // Check for a lockfile
                $filename = $label . ".lock";
                if (file_exists($filename)) {
                    print " Lock file detected. No alert sent.";
                } else {
                    sendAlert($result, $threshold, $db_name, $label, $graphname[$receiver], $contactfile);
                    $mylock = fopen($filename, "w");
                    if ($mylock == false) {
                        print "Could not creat lock file {$filename}";
                    } else {
                        fwrite($mylock, "Locked");
                        fclose($mylock);
                    }
                }
开发者ID:nicost,项目名称:freezer_monitor,代码行数:31,代码来源:cronwatch-v1.php

示例12: my_lime_test

    if ($adapter == 'sfImageMagickAdapter') {
        $t = new my_lime_test($tests_imagemagick, new lime_output_color());
        $t->diag('creates thumbnail from pdf', $adapter);
        $thmb = new sfThumbnail(150, 150, true, true, 75, $adapter, array('extract' => 1));
        $thmb->loadFile($data['document/pdf']);
        $thmb->save($result . '.jpg');
        checkResult($t, 150, 116, 'image/jpeg');
    }
    // gd specific tests (imagemagick does not currently support loadData())
    if ($adapter == 'sfGDAdapter') {
        $t->diag('creates image from string');
        $thmb = new sfThumbnail(200, 200, false, true, 75, $adapter, array());
        $blob = file_get_contents($data['blob']);
        $thmb->loadData($blob, 'image/jpeg');
        $thmb->save($result . '.jpg', 'image/jpeg');
        checkResult($t, 200, 200, 'image/jpeg');
    }
}
function checkResult($t, $width, $height, $mime)
{
    global $mimeMap;
    $result = getResultPath();
    $result .= '.' . $mimeMap[$mime];
    // check generated thumbnail for expected results
    // use getimagesize() when possible, otherwise use 'identify'
    $imgData = @getimagesize($result);
    if ($imgData) {
        $res_width = $imgData[0];
        $res_height = $imgData[1];
        $res_mime = $imgData['mime'];
    } else {
开发者ID:silky,项目名称:littlesis,代码行数:31,代码来源:sfThumbnailTest.php


注:本文中的checkResult函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。