• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP file_can_view_bug_attachments函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: print_column_attachment_count

/**
 * Print column content for column attachment count
 *
 * @param BugData $p_bug bug object
 * @param int $p_columns_target see COLUMNS_TARGET_* in constant_inc.php
 * @return null
 * @access public
 */
function print_column_attachment_count($p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE)
{
    global $t_icon_path;
    # Check for attachments
    $t_attachment_count = 0;
    if (file_can_view_bug_attachments($p_bug->id, null)) {
        $t_attachment_count = file_bug_attachment_count($p_bug->id);
    }
    echo '<td class="column-attachments">';
    if ($t_attachment_count > 0) {
        $t_href = string_get_bug_view_url($p_bug->id) . '#attachments';
        $t_href_title = sprintf(lang_get('view_attachments_for_issue'), $t_attachment_count, $p_bug->id);
        echo "<a href=\"{$t_href}\" title=\"{$t_href_title}\">{$t_attachment_count}</a>";
    } else {
        echo ' &#160; ';
    }
    echo "</td>\n";
}
开发者ID:N0ctrnl,项目名称:mantisbt,代码行数:26,代码来源:columns_api.php


示例2: file_get_visible_attachments

/**
 * Gets an array of attachments that are visible to the currently logged in user.
 * Each element of the array contains the following:
 * display_name - The attachment display name (i.e. file name dot extension)
 * size - The attachment size in bytes.
 * date_added - The date where the attachment was added.
 * can_download - true: logged in user has access to download the attachment, false: otherwise.
 * diskfile - The name of the file on disk.  Typically this is a hash without an extension.
 * download_url - The download URL for the attachment (only set if can_download is true).
 * exists - Applicable for DISK attachments.  true: file exists, otherwise false.
 * can_delete - The logged in user can delete the attachments.
 * preview - true: the attachment should be previewable, otherwise false.
 * type - Can be "image", "text" or empty for other types.
 * alt - The alternate text to be associated with the icon.
 * icon - array with icon information, contains 'url' and 'alt' elements.
 * @param integer $p_bug_id A bug identifier.
 * @return array
 */
function file_get_visible_attachments($p_bug_id)
{
    $t_attachment_rows = bug_get_attachments($p_bug_id);
    $t_visible_attachments = array();
    $t_attachments_count = count($t_attachment_rows);
    if ($t_attachments_count === 0) {
        return $t_visible_attachments;
    }
    $t_attachments = array();
    $t_preview_text_ext = config_get('preview_text_extensions');
    $t_preview_image_ext = config_get('preview_image_extensions');
    $t_image_previewed = false;
    for ($i = 0; $i < $t_attachments_count; $i++) {
        $t_row = $t_attachment_rows[$i];
        if (!file_can_view_bug_attachments($p_bug_id, (int) $t_row['user_id'])) {
            continue;
        }
        $t_id = $t_row['id'];
        $t_filename = $t_row['filename'];
        $t_filesize = $t_row['filesize'];
        $t_diskfile = file_normalize_attachment_path($t_row['diskfile'], bug_get_field($p_bug_id, 'project_id'));
        $t_date_added = $t_row['date_added'];
        $t_attachment = array();
        $t_attachment['id'] = $t_id;
        $t_attachment['display_name'] = file_get_display_name($t_filename);
        $t_attachment['size'] = $t_filesize;
        $t_attachment['date_added'] = $t_date_added;
        $t_attachment['diskfile'] = $t_diskfile;
        $t_attachment['can_download'] = file_can_download_bug_attachments($p_bug_id, (int) $t_row['user_id']);
        $t_attachment['can_delete'] = file_can_delete_bug_attachments($p_bug_id, (int) $t_row['user_id']);
        if ($t_attachment['can_download']) {
            $t_attachment['download_url'] = 'file_download.php?file_id=' . $t_id . '&type=bug';
        }
        if ($t_image_previewed) {
            $t_image_previewed = false;
        }
        $t_attachment['exists'] = config_get('file_upload_method') != DISK || file_exists($t_diskfile);
        $t_attachment['icon'] = file_get_icon_url($t_attachment['display_name']);
        $t_attachment['preview'] = false;
        $t_attachment['type'] = '';
        $t_ext = strtolower(pathinfo($t_attachment['display_name'], PATHINFO_EXTENSION));
        $t_attachment['alt'] = $t_ext;
        if ($t_attachment['exists'] && $t_attachment['can_download'] && $t_filesize != 0 && $t_filesize <= config_get('preview_attachments_inline_max_size')) {
            if (in_array($t_ext, $t_preview_text_ext, true)) {
                $t_attachment['preview'] = true;
                $t_attachment['type'] = 'text';
            } else {
                if (in_array($t_ext, $t_preview_image_ext, true)) {
                    $t_attachment['preview'] = true;
                    $t_attachment['type'] = 'image';
                }
            }
        }
        $t_attachments[] = $t_attachment;
    }
    return $t_attachments;
}
开发者ID:martijnveen,项目名称:mantisbt,代码行数:75,代码来源:file_api.php


示例3: print_column_attachment

function print_column_attachment($p_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE)
{
    global $t_icon_path;
    $t_show_attachments = config_get('show_attachment_indicator');
    # Check for attachments
    $t_attachment_count = 0;
    if (ON == $t_show_attachments && file_can_view_bug_attachments($p_row['id'])) {
        $t_attachment_count = file_bug_attachment_count($p_row['id']);
    }
    if (ON == $t_show_attachments) {
        echo "\t<td>";
        if (0 < $t_attachment_count) {
            echo '<a href="' . string_get_bug_view_url($p_row['id']) . '#attachments">';
            echo '<img border="0" src="' . $t_icon_path . 'attachment.png' . '"';
            echo ' alt="' . lang_get('attachment_alt') . '"';
            echo ' title="' . $t_attachment_count . ' ' . lang_get('attachments') . '"';
            echo ' />';
            echo '</a>';
        } else {
            echo ' &nbsp; ';
        }
        echo "</td>\n";
    }
}
开发者ID:centaurustech,项目名称:BenFund,代码行数:24,代码来源:columns_api.php


示例4: mark_time

<?php 
mark_time('begin loop');
# -- Loop over bug rows and create $v_* variables --
for ($i = 0; $i < sizeof($rows); $i++) {
    # prefix bug data with v_
    extract($rows[$i], EXTR_PREFIX_ALL, 'v');
    $t_summary = string_attribute($v_summary);
    $t_last_updated = date(config_get('normal_date_format'), $v_last_updated);
    # choose color based on status
    $status_color = get_status_color($v_status);
    # grab the bugnote count
    # @@@ thraxisp - not used???
    #		$bugnote_info = bug_get_bugnote_stats( $v_id );
    # Check for attachments
    $t_attachment_count = 0;
    if (file_can_view_bug_attachments($v_id)) {
        $t_attachment_count = file_bug_attachment_count($v_id);
    }
    # grab the project name
    $project_name = project_get_field($v_project_id, 'name');
    ?>

<tr bgcolor="<?php 
    echo $status_color;
    ?>
">
	<?php 
    # -- Bug ID and details link + Pencil shortcut --
    ?>
	<td class="center" valign="top" width ="0" nowrap>
		<span class="small">
开发者ID:jin255ff,项目名称:company_website,代码行数:31,代码来源:my_view_inc.php


示例5: mci_issue_get_attachments

/**
 * Get the attachments of an issue.
 *
 * @param integer $p_issue_id The id of the issue to retrieve the attachments for.
 * @return array that represents an AttachmentData structure
 */
function mci_issue_get_attachments($p_issue_id)
{
    $t_attachment_rows = bug_get_attachments($p_issue_id);
    if ($t_attachment_rows == null) {
        return array();
    }
    $t_result = array();
    foreach ($t_attachment_rows as $t_attachment_row) {
        if (!file_can_view_bug_attachments($p_issue_id, (int) $t_attachment_row['user_id'])) {
            continue;
        }
        $t_attachment = array();
        $t_attachment['id'] = $t_attachment_row['id'];
        $t_attachment['filename'] = $t_attachment_row['filename'];
        $t_attachment['size'] = $t_attachment_row['filesize'];
        $t_attachment['content_type'] = $t_attachment_row['file_type'];
        $t_attachment['date_submitted'] = SoapObjectsFactory::newDateTimeVar($t_attachment_row['date_added']);
        $t_attachment['download_url'] = mci_get_mantis_path() . 'file_download.php?file_id=' . $t_attachment_row['id'] . '&amp;type=bug';
        $t_attachment['user_id'] = $t_attachment_row['user_id'];
        $t_result[] = $t_attachment;
    }
    return $t_result;
}
开发者ID:elmarculino,项目名称:mantisbt,代码行数:29,代码来源:mc_issue_api.php


示例6: count

# -- Loop over bug rows and create $v_* variables --
$t_count = count($rows);
if ($t_count == 0) {
    echo '<tr><td>&#160;</td></tr>';
}
for ($i = 0; $i < $t_count; $i++) {
    $t_bug = $rows[$i];
    $t_summary = string_display_line_links($t_bug->summary);
    $t_last_updated = date(config_get('normal_date_format'), $t_bug->last_updated);
    # choose color based on status
    $status_label = html_get_status_css_class($t_bug->status, auth_get_current_user_id(), $t_bug->project_id);
    # Check for attachments
    $t_attachment_count = 0;
    # TODO: factor in the allow_view_own_attachments configuration option
    # instead of just using a global check.
    if (file_can_view_bug_attachments($t_bug->id, null)) {
        $t_attachment_count = file_bug_attachment_count($t_bug->id);
    }
    # grab the project name
    $project_name = project_get_field($t_bug->project_id, 'name');
    if (VS_PRIVATE == $t_bug->view_state) {
        $t_bug_class = 'my-buglist-private';
    } else {
        $t_bug_class = '';
    }
    ?>

<tr class="my-buglist-bug <?php 
    echo $t_bug_class;
    ?>
 <?php 
开发者ID:N0ctrnl,项目名称:mantisbt,代码行数:31,代码来源:my_view_inc.php


示例7: print_column_attachment_count

/**
 *
 * @param BugData $p_bug bug obect
 * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php
 * @return null
 * @access public
 */
function print_column_attachment_count( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) {
	global $t_icon_path;

	# Check for attachments
	# TODO: factor in the allow_view_own_attachments configuration option
	# instead of just using a global check.
	$t_attachment_count = 0;
	if( file_can_view_bug_attachments( $p_bug->id, null ) ) {
		$t_attachment_count = file_bug_attachment_count( $p_bug->id );
	}

	echo '<td class="center column-attachments">';

	if ( $t_attachment_count > 0 ) {
		$t_href = string_get_bug_view_url( $p_bug->id ) . '#attachments';
		$t_href_title = sprintf( lang_get( 'view_attachments_for_issue' ), $t_attachment_count, $p_bug->id );
		if ( config_get( 'show_attachment_indicator' ) ) {
			$t_alt_text = $t_attachment_count . lang_get( 'word_separator' ) . lang_get( 'attachments' );
			echo "<a href=\"$t_href\" title=\"$t_href_title\"><img src=\"${t_icon_path}attachment.png\" alt=\"$t_alt_text\" title=\"$t_alt_text\" /></a>";
		} else {
			echo "<a href=\"$t_href\" title=\"$t_href_title\">$t_attachment_count</a>";
		}
	} else {
		echo ' &#160; ';
	}

	echo "</td>\n";
}
开发者ID:rombert,项目名称:mantisbt,代码行数:35,代码来源:columns_api.php


示例8: print_column_attachment_count

/**
 *
 * @param BugData $p_bug bug obect
 * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php
 * @return null
 * @access public
 */
function print_column_attachment_count($p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE)
{
    global $t_icon_path;
    # Check for attachments
    $t_attachment_count = 0;
    if (file_can_view_bug_attachments($p_bug->id)) {
        $t_attachment_count = file_bug_attachment_count($p_bug->id);
    }
    echo '<td class="center column-attachments">';
    if ($t_attachment_count > 0) {
        $t_href = string_get_bug_view_url($p_bug->id) . '#attachments';
        $t_href_title = sprintf(lang_get('view_attachments_for_issue'), $t_attachment_count, $p_bug->id);
        if (config_get('show_attachment_indicator')) {
            $t_alt_text = $t_attachment_count . lang_get('word_separator') . lang_get('attachments');
            echo "<a href=\"{$t_href}\" title=\"{$t_href_title}\"><img src=\"{$t_icon_path}attachment.png\" alt=\"{$t_alt_text}\" title=\"{$t_alt_text}\" /></a>";
        } else {
            echo "<a href=\"{$t_href}\" title=\"{$t_href_title}\">{$t_attachment_count}</a>";
        }
    } else {
        echo ' &nbsp; ';
    }
    echo "</td>\n";
}
开发者ID:kaos,项目名称:mantisbt,代码行数:30,代码来源:columns_api.php


示例9: csv_format_attachment_count

/**
 * return the attachment count for an issue
 * @param BugData $p_bug A BugData object.
 * @return string
 * @access public
 */
function csv_format_attachment_count(BugData $p_bug)
{
    # Check for attachments
    $t_attachment_count = 0;
    if (file_can_view_bug_attachments($p_bug->id, null)) {
        $t_attachment_count = file_bug_attachment_count($p_bug->id);
    }
    return csv_escape_string($t_attachment_count);
}
开发者ID:spring,项目名称:spring-website,代码行数:15,代码来源:csv_api.php


示例10: bug_get_attachments

/**
 * Get array of attachments associated with the specified bug id.  The array will be
 * sorted in terms of date added (ASC).  The array will include the following fields:
 * id, title, diskfile, filename, filesize, file_type, date_added.
 * @param int p_bug_id integer representing bug id
 * @return array array of results or null
 * @access public
 * @uses database_api.php
 * @uses file_api.php
 */
function bug_get_attachments($p_bug_id)
{
    if (!file_can_view_bug_attachments($p_bug_id)) {
        return;
    }
    $c_bug_id = db_prepare_int($p_bug_id);
    $t_bug_file_table = db_get_table('bug_file');
    $query = "SELECT id, title, diskfile, filename, filesize, file_type, date_added\n\t\t                FROM {$t_bug_file_table}\n\t\t                WHERE bug_id=" . db_param() . "\n\t\t                ORDER BY date_added";
    $db_result = db_query_bound($query, array($c_bug_id));
    $num_files = db_num_rows($db_result);
    $t_result = array();
    for ($i = 0; $i < $num_files; $i++) {
        $t_result[] = db_fetch_array($db_result);
    }
    return $t_result;
}
开发者ID:kaos,项目名称:mantisbt,代码行数:26,代码来源:bug_api.php


示例11: excel_format_attachment_count

/**
 * Gets the attachment count for an issue
 * @param BugData $p_bug A bug object.
 * @return string
 * @access public
 */
function excel_format_attachment_count(BugData $p_bug)
{
    # Check for attachments
    $t_attachment_count = 0;
    if (file_can_view_bug_attachments($p_bug->id, null)) {
        $t_attachment_count = file_bug_attachment_count($p_bug->id);
    }
    return excel_prepare_number($t_attachment_count);
}
开发者ID:spring,项目名称:spring-website,代码行数:15,代码来源:excel_api.php


示例12: bug_get_attachments

function bug_get_attachments($p_bug_id)
{
    if (!file_can_view_bug_attachments($p_bug_id)) {
        return;
    }
    $c_bug_id = db_prepare_int($p_bug_id);
    $t_bug_file_table = config_get('mantis_bug_file_table');
    $query = "SELECT id, title, diskfile, filename, filesize, file_type, date_added\r\n\t\t                FROM {$t_bug_file_table}\r\n\t\t                WHERE bug_id='{$c_bug_id}'\r\n\t\t                ORDER BY date_added";
    $db_result = db_query($query);
    $num_notes = db_num_rows($db_result);
    $t_result = array();
    for ($i = 0; $i < $num_notes; $i++) {
        $t_result[] = db_fetch_array($db_result);
    }
    return $t_result;
}
开发者ID:amjadtbssm,项目名称:website,代码行数:16,代码来源:bug_api.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP file_check函数代码示例发布时间:2022-05-15
下一篇:
PHP file_bug_attachment_count函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap