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


PHP PMA_strlen函数代码示例

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


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

示例1: PMA_STR_charIsEscaped

/**
 * Checks if a given character position in the string is escaped or not
 *
 * @uses    PMA_strlen()
 * @uses    PMA_substr()
 * @uses    max()
 * @uses    intval()
 * @param   string   string to check for
 * @param   integer  the character to check for
 * @param   integer  starting position in the string
 * @return  boolean  whether the character is escaped or not
 */
function PMA_STR_charIsEscaped($string, $pos, $start = 0)
{
    $pos = max(intval($pos), 0);
    $start = max(intval($start), 0);
    $len = PMA_strlen($string);
    // Base case:
    // Check for string length or invalid input or special case of input
    // (pos == $start)
    if ($pos <= $start || $len <= max($pos, $start)) {
        return false;
    }
    $pos--;
    $escaped = false;
    while ($pos >= $start && PMA_substr($string, $pos, 1) == '\\') {
        $escaped = !$escaped;
        $pos--;
    }
    // end while
    return $escaped;
}
开发者ID:alecbenson,项目名称:TurnoutWeb-Patches,代码行数:32,代码来源:string.lib.php

示例2: PMA_displayTableBody


//.........这里部分代码省略.........
                            if (!empty($bs_tables) && strlen($db) > 0) {
                                $bs_tables = $bs_tables[$db];
                                if (isset($bs_tables)) {
                                    $allBSTablesExist = TRUE;
                                    // check if BS tables exist for given database
                                    foreach ($bs_tables as $table_key => $bs_tbl) {
                                        if (!$bs_tables[$table_key]['Exists']) {
                                            $allBSTablesExist = FALSE;
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    // if necessary BS tables exist
                    if ($allBSTablesExist) {
                        $bs_reference_exists = PMA_BS_ReferenceExists($row[$i], $db);
                    }
                    // if valid BS reference exists
                    if ($bs_reference_exists) {
                        $blobtext = PMA_BS_CreateReferenceLink($row[$i], $db);
                    } else {
                        $blobtext = PMA_handle_non_printable_contents('BLOB', isset($row[$i]) ? $row[$i] : '', $transform_function, $transform_options, $default_function, $meta);
                    }
                    $vertical_display['data'][$row_no][$i] = '    <td align="left"' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">' . $blobtext . '</td>';
                    unset($blobtext);
                    // not binary:
                } else {
                    if (!isset($row[$i]) || is_null($row[$i])) {
                        $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
                    } elseif ($row[$i] != '') {
                        // garvin: if a transform function for blob is set, none of these replacements will be made
                        if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P') {
                            $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
                        }
                        // loic1: displays all space characters, 4 space
                        // characters for tabulations and <cr>/<lf>
                        $row[$i] = $default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta);
                        $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">' . $row[$i] . '</td>' . "\n";
                    } else {
                        $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">&nbsp;</td>' . "\n";
                    }
                }
                // n o t   n u m e r i c   a n d   n o t   B L O B
            } else {
                if (!isset($row[$i]) || is_null($row[$i])) {
                    $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
                } elseif ($row[$i] != '') {
                    // loic1: support blanks in the key
                    $relation_id = $row[$i];
                    // nijel: Cut all fields to $GLOBALS['cfg']['LimitChars']
                    // lem9: (unless it's a link-type transformation)
                    if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P' && !strpos($transform_function, 'link') === true) {
                        $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
                    }
                    // loic1: displays special characters from binaries
                    $field_flags = PMA_DBI_field_flags($dt_result, $i);
                    if (isset($meta->_type) && $meta->_type === MYSQLI_TYPE_BIT) {
                        $row[$i] = PMA_printable_bit_value($row[$i], $meta->length);
                    } elseif (stristr($field_flags, 'BINARY') && $meta->type == 'string') {
                        if ($_SESSION['tmp_user_values']['display_binary'] || isset($GLOBALS['is_analyse']) && $GLOBALS['is_analyse']) {
                            // user asked to see the real contents of BINARY
                            // fields, or we detected a PROCEDURE ANALYSE in
                            // the query (results are reported as being
                            // binary strings)
开发者ID:kolbermoorer,项目名称:edugame,代码行数:67,代码来源:display_tbl.lib.php

示例3: PMA_displayTableBody


//.........这里部分代码省略.........
                }
                //  b l o b
            } elseif ($GLOBALS['cfg']['ShowBlob'] == false && stristr($meta->type, 'BLOB')) {
                // loic1 : PMA_mysql_fetch_fields returns BLOB in place of
                // TEXT fields type, however TEXT fields must be displayed
                // even if $GLOBALS['cfg']['ShowBlob'] is false -> get the true type
                // of the fields.
                $field_flags = PMA_DBI_field_flags($dt_result, $i);
                if (stristr($field_flags, 'BINARY')) {
                    $blobtext = '[BLOB';
                    if (!isset($row[$i]) || is_null($row[$i])) {
                        $blobtext .= ' - NULL';
                        $blob_size = 0;
                    } elseif (isset($row[$i])) {
                        $blob_size = strlen($row[$i]);
                        $display_blob_size = PMA_formatByteDown($blob_size, 3, 1);
                        $blobtext .= ' - ' . $display_blob_size[0] . ' ' . $display_blob_size[1];
                        unset($display_blob_size);
                    }
                    $blobtext .= ']';
                    if (strpos($transform_function, 'octetstream')) {
                        $blobtext = $row[$i];
                    }
                    if ($blob_size > 0) {
                        $blobtext = $default_function != $transform_function ? $transform_function($blobtext, $transform_options, $meta) : $default_function($blobtext, array(), $meta);
                    }
                    unset($blob_size);
                    $vertical_display['data'][$row_no][$i] = '    <td align="left"' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">' . $blobtext . '</td>';
                } else {
                    if (!isset($row[$i]) || is_null($row[$i])) {
                        $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
                    } elseif ($row[$i] != '') {
                        // garvin: if a transform function for blob is set, none of these replacements will be made
                        if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $dontlimitchars != 1) {
                            $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
                        }
                        // loic1: displays all space characters, 4 space
                        // characters for tabulations and <cr>/<lf>
                        $row[$i] = $default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta);
                        $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">' . $row[$i] . '</td>' . "\n";
                    } else {
                        $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">&nbsp;</td>' . "\n";
                    }
                }
            } else {
                if (!isset($row[$i]) || is_null($row[$i])) {
                    $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
                } elseif ($row[$i] != '') {
                    // loic1: support blanks in the key
                    $relation_id = $row[$i];
                    // nijel: Cut all fields to $GLOBALS['cfg']['LimitChars']
                    // lem9: (unless it's a link-type transformation)
                    if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $dontlimitchars != 1 && !strpos($transform_function, 'link') === true) {
                        $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
                    }
                    // loic1: displays special characters from binaries
                    $field_flags = PMA_DBI_field_flags($dt_result, $i);
                    if (stristr($field_flags, 'BINARY')) {
                        $row[$i] = str_replace("", '\\0', $row[$i]);
                        $row[$i] = str_replace("", '\\b', $row[$i]);
                        $row[$i] = str_replace("\n", '\\n', $row[$i]);
                        $row[$i] = str_replace("\r", '\\r', $row[$i]);
                        $row[$i] = str_replace("", '\\Z', $row[$i]);
                        $row[$i] = $default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta);
                    } else {
                        $row[$i] = $default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta);
开发者ID:a195474368,项目名称:ejiawang,代码行数:67,代码来源:display_tbl.lib.php

示例4: htmlspecialchars

         $hcount = 0;
         $odd_row = true;
     }
     $key_ordered_current_key = $keys[$key_ordered_current_row];
     $key_ordered_current_val = $values[$key_ordered_current_row];
     $val_ordered_current_key = $keys[$val_ordered_current_row];
     $val_ordered_current_val = $values[$val_ordered_current_row];
     $val_ordered_current_row++;
     if (PMA_strlen($val_ordered_current_val) <= $cfg['LimitChars']) {
         $val_ordered_current_val = htmlspecialchars($val_ordered_current_val);
         $val_ordered_current_val_title = '';
     } else {
         $val_ordered_current_val_title = htmlspecialchars($val_ordered_current_val);
         $val_ordered_current_val = htmlspecialchars(PMA_substr($val_ordered_current_val, 0, $cfg['LimitChars']) . '...');
     }
     if (PMA_strlen($key_ordered_current_val) <= $cfg['LimitChars']) {
         $key_ordered_current_val = htmlspecialchars($key_ordered_current_val);
         $key_ordered_current_val_title = '';
     } else {
         $key_ordered_current_val_title = htmlspecialchars($key_ordered_current_val);
         $key_ordered_current_val = htmlspecialchars(PMA_substr($key_ordered_current_val, 0, $cfg['LimitChars']) . '...');
     }
     if (!empty($data)) {
         $val_ordered_current_equals_data = $val_ordered_current_key == $data;
         $key_ordered_current_equals_data = $key_ordered_current_key == $data;
     }
     ?>
 <tr class="noclick <?php 
     echo $odd_row ? 'odd' : 'even';
     $odd_row = !$odd_row;
     ?>
开发者ID:htom78,项目名称:project,代码行数:31,代码来源:browse_foreigners.php

示例5: PMA_SQP_parse

 /**
  * Parses the SQL queries
  *
  * @param  string   The SQL query list
  *
  * @return mixed    Most of times, nothing...
  *
  * @global array    The current PMA configuration
  * @global array    MySQL column attributes
  * @global array    MySQL reserved words
  * @global array    MySQL column types
  * @global array    MySQL function names
  * @global integer  MySQL column attributes count
  * @global integer  MySQL reserved words count
  * @global integer  MySQL column types count
  * @global integer  MySQL function names count
  * @global array    List of available character sets
  * @global array    List of available collations
  * @global integer  Character sets count
  * @global integer  Collations count
  *
  * @access public
  */
 function PMA_SQP_parse($sql)
 {
     global $cfg;
     global $PMA_SQPdata_column_attrib, $PMA_SQPdata_reserved_word, $PMA_SQPdata_column_type, $PMA_SQPdata_function_name, $PMA_SQPdata_column_attrib_cnt, $PMA_SQPdata_reserved_word_cnt, $PMA_SQPdata_column_type_cnt, $PMA_SQPdata_function_name_cnt;
     global $mysql_charsets, $mysql_collations_flat, $mysql_charsets_count, $mysql_collations_count;
     global $PMA_SQPdata_forbidden_word, $PMA_SQPdata_forbidden_word_cnt;
     // rabus: Convert all line feeds to Unix style
     $sql = str_replace("\r\n", "\n", $sql);
     $sql = str_replace("\r", "\n", $sql);
     $len = PMA_strlen($sql);
     if ($len == 0) {
         return array();
     }
     $sql_array = array();
     $sql_array['raw'] = $sql;
     $count1 = 0;
     $count2 = 0;
     $punct_queryend = ';';
     $punct_qualifier = '.';
     $punct_listsep = ',';
     $punct_level_plus = '(';
     $punct_level_minus = ')';
     $digit_floatdecimal = '.';
     $digit_hexset = 'x';
     $bracket_list = '()[]{}';
     $allpunct_list = '-,;:!?/.^~\\*&%+<=>|';
     $allpunct_list_pair = array(0 => '!=', 1 => '&&', 2 => ':=', 3 => '<<', 4 => '<=', 5 => '<=>', 6 => '<>', 7 => '>=', 8 => '>>', 9 => '||');
     $allpunct_list_pair_size = 10;
     //count($allpunct_list_pair);
     $quote_list = '\'"`';
     $arraysize = 0;
     while ($count2 < $len) {
         $c = PMA_substr($sql, $count2, 1);
         $count1 = $count2;
         if ($c == "\n") {
             $count2++;
             PMA_SQP_arrayAdd($sql_array, 'white_newline', '', $arraysize);
             continue;
         }
         // Checks for white space
         if (PMA_STR_isSpace($c)) {
             $count2++;
             continue;
         }
         // Checks for comment lines.
         // MySQL style #
         // C style /* */
         // ANSI style --
         if ($c == '#' || $count2 + 1 < $len && $c == '/' && PMA_substr($sql, $count2 + 1, 1) == '*' || $count2 + 2 == $len && $c == '-' && PMA_substr($sql, $count2 + 1, 1) == '-' || $count2 + 2 < $len && $c == '-' && PMA_substr($sql, $count2 + 1, 1) == '-' && PMA_substr($sql, $count2 + 2, 1) <= ' ') {
             $count2++;
             $pos = 0;
             $type = 'bad';
             switch ($c) {
                 case '#':
                     $type = 'mysql';
                 case '-':
                     $type = 'ansi';
                     $pos = $GLOBALS['PMA_strpos']($sql, "\n", $count2);
                     break;
                 case '/':
                     $type = 'c';
                     $pos = $GLOBALS['PMA_strpos']($sql, '*/', $count2);
                     $pos += 2;
                     break;
                 default:
                     break;
             }
             // end switch
             $count2 = $pos < $count2 ? $len : $pos;
             $str = PMA_substr($sql, $count1, $count2 - $count1);
             PMA_SQP_arrayAdd($sql_array, 'comment_' . $type, $str, $arraysize);
             continue;
         }
         // end if
         // Checks for something inside quotation marks
         if (PMA_STR_strInStr($c, $quote_list)) {
             $startquotepos = $count2;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:101,代码来源:sqlparser.lib.php

示例6: foreach

echo $strBinLogServerId;
?>
&nbsp;</th>
        <th>&nbsp;<?php 
echo $strBinLogOriginalPosition;
?>
&nbsp;</th>
        <th>&nbsp;<?php 
echo $strBinLogInfo;
?>
&nbsp;</th>
    </tr>
<?php 
$useBgcolorOne = TRUE;
foreach ($serverProcesses as $value) {
    if (empty($full) && PMA_strlen($value['Info']) > $GLOBALS['cfg']['LimitChars']) {
        $value['Info'] = PMA_substr($value['Info'], 0, $GLOBALS['cfg']['LimitChars']) . '...';
    }
    ?>
    <tr>
        <td bgcolor="<?php 
    echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
    ?>
">&nbsp;<?php 
    echo $value['Log_name'];
    ?>
&nbsp;</td>
        <td bgcolor="<?php 
    echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
    ?>
" align="right">&nbsp;<?php 
开发者ID:dapfru,项目名称:gladiators,代码行数:31,代码来源:server_binlog.php

示例7: __

</th>
    <th><?php 
echo __('Original position');
?>
</th>
    <th><?php 
echo __('Information');
?>
</th>
</tr>
</thead>
<tbody>
<?php 
$odd_row = true;
while ($value = PMA_DBI_fetch_assoc($result)) {
    if (!$dontlimitchars && PMA_strlen($value['Info']) > $GLOBALS['cfg']['LimitChars']) {
        $value['Info'] = PMA_substr($value['Info'], 0, $GLOBALS['cfg']['LimitChars']) . '...';
    }
    ?>
<tr class="noclick <?php 
    echo $odd_row ? 'odd' : 'even';
    ?>
">
    <td>&nbsp;<?php 
    echo $value['Log_name'];
    ?>
&nbsp;</td>
    <td align="right">&nbsp;<?php 
    echo $value['Pos'];
    ?>
&nbsp;</td>
开发者ID:zseand,项目名称:kloxo,代码行数:31,代码来源:server_binlog.php

示例8: PMA_STR_charIsEscaped

/**
 * Checks if a given character position in the string is escaped or not
 *
 * @param   string   string to check for
 * @param   integer  the character to check for
 * @param   integer  starting position in the string
 *
 * @return  boolean  whether the character is escaped or not
 */
function PMA_STR_charIsEscaped($string, $pos, $start = 0)
{
    $len = PMA_strlen($string);
    // Base case:
    // Check for string length or invalid input or special case of input
    // (pos == $start)
    if ($pos == $start || $len <= $pos) {
        return FALSE;
    }
    $p = $pos - 1;
    $escaped = FALSE;
    while ($p >= $start && $string[$p] == '\\') {
        $escaped = !$escaped;
        $p--;
    }
    // end while
    if ($pos < $start) {
        // throw error about strings
    }
    return $escaped;
}
开发者ID:dapfru,项目名称:gladiators,代码行数:30,代码来源:string.lib.php

示例9: PMA__foreignDropdownBuild

/**
 * Prepares the dropdown for one mode
 *
 * @param array  $foreign the keys and values for foreigns
 * @param string $data    the current data of the dropdown
 * @param string $mode    the needed mode
 *
 * @return  array   the <option value=""><option>s
 *
 * @access  protected
 */
function PMA__foreignDropdownBuild($foreign, $data, $mode)
{
    $reloptions = array();
    // id-only is a special mode used when no foreign display column
    // is available
    if ($mode == 'id-content' || $mode == 'id-only') {
        // sort for id-content
        if ($GLOBALS['cfg']['NaturalOrder']) {
            uksort($foreign, 'strnatcasecmp');
        } else {
            ksort($foreign);
        }
    } elseif ($mode == 'content-id') {
        // sort for content-id
        if ($GLOBALS['cfg']['NaturalOrder']) {
            natcasesort($foreign);
        } else {
            asort($foreign);
        }
    }
    foreach ($foreign as $key => $value) {
        if (PMA_strlen($value) <= $GLOBALS['cfg']['LimitChars']) {
            $vtitle = '';
            $value = htmlspecialchars($value);
        } else {
            $vtitle = htmlspecialchars($value);
            $value = htmlspecialchars(substr($value, 0, $GLOBALS['cfg']['LimitChars']) . '...');
        }
        $reloption = '<option value="' . htmlspecialchars($key) . '"';
        if ($vtitle != '') {
            $reloption .= ' title="' . $vtitle . '"';
        }
        if ((string) $key == (string) $data) {
            $reloption .= ' selected="selected"';
        }
        if ($mode == 'content-id') {
            $reloptions[] = $reloption . '>' . $value . '&nbsp;-&nbsp;' . htmlspecialchars($key) . '</option>';
        } elseif ($mode == 'id-content') {
            $reloptions[] = $reloption . '>' . htmlspecialchars($key) . '&nbsp;-&nbsp;' . $value . '</option>';
        } elseif ($mode == 'id-only') {
            $reloptions[] = $reloption . '>' . htmlspecialchars($key) . '</option>';
        }
    }
    // end foreach
    return $reloptions;
}
开发者ID:AmberWish,项目名称:laba_web,代码行数:57,代码来源:relation.lib.php

示例10: PMA_foreignDropdownBuild

/**
 * Prepares the dropdown for one mode
 *
 * @param   array    the keys and values for foreigns
 * @param   string   the current data of the dropdown
 * @param   string   the needed mode
 *
 * @global  array    global phpMyAdmin configuration
 *
 * @return  array   the <option value=""><option>s
 *
 * @access  private
 */
function PMA_foreignDropdownBuild($foreign, $data, $mode)
{
    global $cfg;
    $reloptions = array();
    foreach ($foreign as $key => $value) {
        if (PMA_strlen($value) <= $cfg['LimitChars']) {
            $vtitle = '';
            $value = htmlspecialchars($value);
        } else {
            $vtitle = htmlspecialchars($value);
            $value = htmlspecialchars(substr($value, 0, $cfg['LimitChars']) . '...');
        }
        $reloption = '                <option value="' . htmlspecialchars($key) . '"';
        if ($vtitle != '') {
            $reloption .= ' title="' . $vtitle . '"';
        }
        if ((string) $key == (string) $data) {
            $reloption .= ' selected="selected"';
        }
        if ($mode == 'content-id') {
            $reloptions[] = $reloption . '>' . $value . '&nbsp;-&nbsp;' . htmlspecialchars($key) . '</option>' . "\n";
        } else {
            $reloptions[] = $reloption . '>' . htmlspecialchars($key) . '&nbsp;-&nbsp;' . $value . '</option>' . "\n";
        }
    }
    // end foreach
    return $reloptions;
}
开发者ID:hoogle,项目名称:ttt,代码行数:41,代码来源:relation.lib.php

示例11: PMA_displayTableBody


//.........这里部分代码省略.........
                    $nowrap = ' nowrap';
                    $where_comparison = ' = ' . $row[$i];
                    $vertical_display['data'][$row_no][$i] = '<td align="right"' . PMA_prepare_row_data($class, $condition_field, $analyzed_sql, $meta, $map, $row[$i], $transform_function, $default_function, $nowrap, $where_comparison, $transform_options, $is_field_truncated);
                } else {
                    $vertical_display['data'][$row_no][$i] = PMA_buildEmptyDisplay($class, $condition_field, $meta, 'align="right"');
                }
                //  b l o b
            } elseif (stristr($meta->type, 'BLOB')) {
                // PMA_mysql_fetch_fields returns BLOB in place of
                // TEXT fields type so we have to ensure it's really a BLOB
                $field_flags = PMA_DBI_field_flags($dt_result, $i);
                // remove 'inline_edit' from $class as we can't edit binary data.
                $class = str_replace('inline_edit', '', $class);
                if (stristr($field_flags, 'BINARY')) {
                    if (!isset($row[$i]) || is_null($row[$i])) {
                        $vertical_display['data'][$row_no][$i] = PMA_buildNullDisplay($class, $condition_field, $meta);
                    } else {
                        // for blobstreaming
                        // if valid BS reference exists
                        if (PMA_BS_IsPBMSReference($row[$i], $db)) {
                            $blobtext = PMA_BS_CreateReferenceLink($row[$i], $db);
                        } else {
                            $blobtext = PMA_handle_non_printable_contents('BLOB', isset($row[$i]) ? $row[$i] : '', $transform_function, $transform_options, $default_function, $meta, $_url_params);
                        }
                        $vertical_display['data'][$row_no][$i] = PMA_buildValueDisplay($class, $condition_field, $blobtext);
                        unset($blobtext);
                    }
                    // not binary:
                } else {
                    if (!isset($row[$i]) || is_null($row[$i])) {
                        $vertical_display['data'][$row_no][$i] = PMA_buildNullDisplay($class, $condition_field, $meta);
                    } elseif ($row[$i] != '') {
                        // if a transform function for blob is set, none of these replacements will be made
                        if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P') {
                            $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
                            $is_field_truncated = true;
                        }
                        // displays all space characters, 4 space
                        // characters for tabulations and <cr>/<lf>
                        $row[$i] = $default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta);
                        $vertical_display['data'][$row_no][$i] = PMA_buildValueDisplay($class, $condition_field, $row[$i]);
                    } else {
                        $vertical_display['data'][$row_no][$i] = PMA_buildEmptyDisplay($class, $condition_field, $meta);
                    }
                }
                // g e o m e t r y
            } elseif ($meta->type == 'geometry') {
                $geometry_text = PMA_handle_non_printable_contents('GEOMETRY', isset($row[$i]) ? $row[$i] : '', $transform_function, $transform_options, $default_function, $meta);
                // remove 'inline_edit' from $class as we can't edit geometry data.
                $class = str_replace('inline_edit', '', $class);
                $vertical_display['data'][$row_no][$i] = PMA_buildValueDisplay($class, $condition_field, $geometry_text);
                unset($geometry_text);
                // n o t   n u m e r i c   a n d   n o t   B L O B
            } else {
                if (!isset($row[$i]) || is_null($row[$i])) {
                    $vertical_display['data'][$row_no][$i] = PMA_buildNullDisplay($class, $condition_field, $meta);
                } elseif ($row[$i] != '') {
                    // support blanks in the key
                    $relation_id = $row[$i];
                    // Cut all fields to $GLOBALS['cfg']['LimitChars']
                    // (unless it's a link-type transformation)
                    if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P' && !strpos($transform_function, 'link') === true) {
                        $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
                        $is_field_truncated = true;
                    }
                    // displays special characters from binaries
开发者ID:anmolview,项目名称:yiidemos,代码行数:67,代码来源:display_tbl.lib.php

示例12: PMA_SQP_parse

/**
 * Parses the SQL queries
 *
 * @param string $sql The SQL query list
 *
 * @return mixed Most of times, nothing...
 *
 * @global array    The current PMA configuration
 * @global array    MySQL column attributes
 * @global array    MySQL reserved words
 * @global array    MySQL column types
 * @global array    MySQL function names
 * @global array    List of available character sets
 * @global array    List of available collations
 *
 * @access public
 */
function PMA_SQP_parse($sql)
{
    static $PMA_SQPdata_column_attrib, $PMA_SQPdata_reserved_word;
    static $PMA_SQPdata_column_type;
    static $PMA_SQPdata_function_name, $PMA_SQPdata_forbidden_word;
    global $mysql_charsets, $mysql_collations_flat;
    // Convert all line feeds to Unix style
    $sql = str_replace("\r\n", "\n", $sql);
    $sql = str_replace("\r", "\n", $sql);
    $len = PMA_strlen($sql);
    if ($len == 0) {
        return array();
    }
    // Create local hashtables
    if (!isset($PMA_SQPdata_column_attrib)) {
        $PMA_SQPdata_column_attrib = array_flip($GLOBALS['PMA_SQPdata_column_attrib']);
        $PMA_SQPdata_function_name = array_flip($GLOBALS['PMA_SQPdata_function_name']);
        $PMA_SQPdata_reserved_word = array_flip($GLOBALS['PMA_SQPdata_reserved_word']);
        $PMA_SQPdata_forbidden_word = array_flip($GLOBALS['PMA_SQPdata_forbidden_word']);
        $PMA_SQPdata_column_type = array_flip($GLOBALS['PMA_SQPdata_column_type']);
    }
    $sql_array = array();
    $sql_array['raw'] = $sql;
    $count1 = 0;
    $count2 = 0;
    $punct_queryend = ';';
    $punct_qualifier = '.';
    $punct_listsep = ',';
    $punct_level_plus = '(';
    $punct_level_minus = ')';
    $punct_user = '@';
    $digit_floatdecimal = '.';
    $digit_hexset = 'x';
    $bracket_list = '()[]{}';
    $allpunct_list = '-,;:!?/.^~\\*&%+<=>|';
    $allpunct_list_pair = array('!=' => 1, '&&' => 1, ':=' => 1, '<<' => 1, '<=' => 1, '<=>' => 1, '<>' => 1, '>=' => 1, '>>' => 1, '||' => 1, '==' => 1);
    $quote_list = '\'"`';
    $arraysize = 0;
    $previous_was_space = false;
    $this_was_space = false;
    $previous_was_bracket = false;
    $this_was_bracket = false;
    $previous_was_punct = false;
    $this_was_punct = false;
    $previous_was_listsep = false;
    $this_was_listsep = false;
    $previous_was_quote = false;
    $this_was_quote = false;
    while ($count2 < $len) {
        $c = PMA_substr($sql, $count2, 1);
        $count1 = $count2;
        $previous_was_space = $this_was_space;
        $this_was_space = false;
        $previous_was_bracket = $this_was_bracket;
        $this_was_bracket = false;
        $previous_was_punct = $this_was_punct;
        $this_was_punct = false;
        $previous_was_listsep = $this_was_listsep;
        $this_was_listsep = false;
        $previous_was_quote = $this_was_quote;
        $this_was_quote = false;
        if ($c == "\n") {
            $this_was_space = true;
            $count2++;
            PMA_SQP_arrayAdd($sql_array, 'white_newline', '', $arraysize);
            continue;
        }
        // Checks for white space
        if (PMA_STR_isSpace($c)) {
            $this_was_space = true;
            $count2++;
            continue;
        }
        // Checks for comment lines.
        // MySQL style #
        // C style /* */
        // ANSI style --
        $next_c = PMA_substr($sql, $count2 + 1, 1);
        if ($c == '#' || $count2 + 1 < $len && $c == '/' && $next_c == '*' || $count2 + 2 == $len && $c == '-' && $next_c == '-' || $count2 + 2 < $len && $c == '-' && $next_c == '-' && PMA_substr($sql, $count2 + 2, 1) <= ' ') {
            $count2++;
            $pos = 0;
            $type = 'bad';
            switch ($c) {
//.........这里部分代码省略.........
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:101,代码来源:sqlparser.lib.php

示例13: _getDataCellForNonNumericAndNonBlobColumns

 /**
  * Get data cell for non numeric and non blob type fields
  *
  * @param string  $column                the relavent column in data row
  * @param string  $class                 the html class for column
  * @param object  $meta                  the meta-information about the field
  * @param array   $map                   the list of relations
  * @param array   $_url_params           the parameters for generate url
  * @param boolean $condition_field       the column should highlighted
  *                                       or not
  * @param string  $transformation_plugin the name of transformation function
  * @param string  $default_function      the default transformation function
  * @param string  $transform_options     the transformation parameters
  * @param boolean $is_field_truncated    the condition for blob data
  *                                       replacements
  * @param array   $analyzed_sql          the analyzed query
  * @param integer &$dt_result            the link id associated to the query
  *                                        which results have to be displayed
  * @param integer $col_index             the column index
  *
  * @return  string  $cell               the prepared data cell, html content
  *
  * @access  private
  *
  * @see     _getTableBody()
  */
 private function _getDataCellForNonNumericAndNonBlobColumns($column, $class, $meta, $map, $_url_params, $condition_field, $transformation_plugin, $default_function, $transform_options, $is_field_truncated, $analyzed_sql, &$dt_result, $col_index)
 {
     $is_analyse = $this->__get('_is_analyse');
     $field_flags = PMA_DBI_field_flags($dt_result, $col_index);
     if (stristr($field_flags, self::BINARY_FIELD) && ($GLOBALS['cfg']['ProtectBinary'] == 'all' || $GLOBALS['cfg']['ProtectBinary'] == 'noblob')) {
         $class = str_replace('grid_edit', '', $class);
     }
     if (!isset($column) || is_null($column)) {
         $cell = $this->_buildNullDisplay($class, $condition_field, $meta);
     } elseif ($column != '') {
         // Cut all fields to $GLOBALS['cfg']['LimitChars']
         // (unless it's a link-type transformation)
         if (PMA_strlen($column) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == self::DISPLAY_PARTIAL_TEXT && gettype($transformation_plugin) == "object" && !strpos($transformation_plugin::getName(), 'Link') === true) {
             $column = PMA_substr($column, 0, $GLOBALS['cfg']['LimitChars']) . '...';
             $is_field_truncated = true;
         }
         $formatted = false;
         if (isset($meta->_type) && $meta->_type === MYSQLI_TYPE_BIT) {
             $column = $this->getCommonFunctions()->printableBitValue($column, $meta->length);
             // some results of PROCEDURE ANALYSE() are reported as
             // being BINARY but they are quite readable,
             // so don't treat them as BINARY
         } elseif (stristr($field_flags, self::BINARY_FIELD) && $meta->type == self::STRING_FIELD && !(isset($is_analyse) && $is_analyse)) {
             if ($_SESSION['tmp_user_values']['display_binary']) {
                 // user asked to see the real contents of BINARY
                 // fields
                 if ($_SESSION['tmp_user_values']['display_binary_as_hex'] && $this->getCommonFunctions()->containsNonPrintableAscii($column)) {
                     $column = bin2hex($column);
                 } else {
                     $column = htmlspecialchars($this->getCommonFunctions()->replaceBinaryContents($column));
                 }
             } else {
                 // we show the BINARY message and field's size
                 // (or maybe use a transformation)
                 $column = $this->_handleNonPrintableContents(self::BINARY_FIELD, $column, $transformation_plugin, $transform_options, $default_function, $meta, $_url_params);
                 $formatted = true;
             }
         }
         if ($formatted) {
             $cell = $this->_buildValueDisplay($class, $condition_field, $column);
         } else {
             // transform functions may enable no-wrapping:
             $function_nowrap = 'applyTransformationNoWrap';
             $bool_nowrap = $default_function != $transformation_plugin && function_exists($transformation_plugin->{$function_nowrap}()) ? $transformation_plugin->{$function_nowrap}($transform_options) : false;
             // do not wrap if date field type
             $nowrap = preg_match('@DATE|TIME@i', $meta->type) || $bool_nowrap ? ' nowrap' : '';
             $where_comparison = ' = \'' . $this->getCommonFunctions()->sqlAddSlashes($column) . '\'';
             $cell = $this->_getRowData($class, $condition_field, $analyzed_sql, $meta, $map, $column, $transformation_plugin, $default_function, $nowrap, $where_comparison, $transform_options, $is_field_truncated);
         }
     } else {
         $cell = $this->_buildEmptyDisplay($class, $condition_field, $meta);
     }
     return $cell;
 }
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:80,代码来源:DisplayResults.class.php

示例14: PMA_foreignDropdown

/**
* Outputs dropdown with values of foreign fields
*
* @param   string   the query of the foreign keys
* @param   string   the foreign field
* @param   string   the foreign field to display
* @param   string   the current data of the dropdown
*
* @return  string   the <option value=""><option>s
*
* @access  public
*/
function PMA_foreignDropdown($disp, $foreign_field, $foreign_display, $data, $max = 100)
{
    global $cfg;
    $ret = '<option value=""></option>' . "\n";
    $reloptions = array('content-id' => array(), 'id-content' => array());
    foreach ($disp as $disp_key => $relrow) {
        $key = $relrow[$foreign_field];
        // if the display field has been defined for the foreign table
        if ($foreign_display) {
            if (PMA_strlen($relrow[$foreign_display]) <= $cfg['LimitChars']) {
                $value = htmlspecialchars($relrow[$foreign_display]);
                $vtitle = '';
            } else {
                $vtitle = htmlspecialchars($relrow[$foreign_display]);
                $value = htmlspecialchars(substr($vtitle, 0, $cfg['LimitChars']) . '...');
            }
        } else {
            $vtitle = $value = '';
        }
        // end if ($foreign_display)
        $reloption = '<option value="' . htmlspecialchars($key) . '"';
        if ($vtitle != '') {
            $reloption .= ' title="' . $vtitle . '"';
        }
        if ($key == $data) {
            $reloption .= ' selected="selected"';
        }
        // end if
        $reloptions['id-content'][] = $reloption . '>' . $value . '&nbsp;-&nbsp;' . htmlspecialchars($key) . '</option>' . "\n";
        $reloptions['content-id'][] = $reloption . '>' . htmlspecialchars($key) . '&nbsp;-&nbsp;' . $value . '</option>' . "\n";
    }
    // end while
    // the list of keys looks better if not sorted by description
    if ($cfg['NaturalOrder']) {
        natsort($reloptions['content-id']);
    } else {
        asort($reloptions['content-id']);
    }
    if ($max == -1 || count($reloptions['content-id']) < $max) {
        $ret .= implode('', $reloptions['content-id']);
        if (count($reloptions['content-id']) > 0) {
            $ret .= '<option value=""></option>' . "\n";
            $ret .= '<option value=""></option>' . "\n";
        }
    }
    $ret .= implode('', $reloptions['id-content']);
    return $ret;
}
开发者ID:lifecom,项目名称:test,代码行数:60,代码来源:relation.lib.php

示例15: echo

</td>
        <td bgcolor="<?php 
        echo $bgcolor;
        ?>
"><?php 
        echo ($key_equals_data ? '<b>' : '') . '<a href="#" title="' . $strUseThisValue . ($vtitle != '' ? ': ' . $vtitle : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . htmlspecialchars($key) . '\'); return false;">' . $value . '</a>' . ($key_equals_data ? '</b>' : '');
        ?>
</td>
        <td width="20%"><img src="<?php 
        echo $GLOBALS['pmaThemeImage'] . 'spacer.png';
        ?>
" alt="" width="1" height="1"></td>
<?php 
        $key = key($mysql_key_relrow[$i]);
        $val = $mysql_key_relrow[$i][$key];
        if (PMA_strlen($val) <= $cfg['LimitChars']) {
            $value = htmlspecialchars($val);
            $vtitle = '';
        } else {
            $vtitle = htmlspecialchars($val);
            $value = htmlspecialchars(PMA_substr($val, 0, $cfg['LimitChars']) . '...');
        }
        $key_equals_data = isset($data) && $key == $data;
        ?>
        <td bgcolor="<?php 
        echo $bgcolor;
        ?>
"><?php 
        echo ($key_equals_data ? '<b>' : '') . '<a href="#" title="' . $strUseThisValue . ($vtitle != '' ? ': ' . $vtitle : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . htmlspecialchars($key) . '\'); return false;">' . $value . '</a>' . ($key_equals_data ? '</b>' : '');
        ?>
</td>
开发者ID:lifecom,项目名称:test,代码行数:31,代码来源:browse_foreigners.php


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