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

PHP has_permissions函数代码示例

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

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



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

示例1: fix_private_photos

function fix_private_photos($s, $uid, $item = null, $cid = 0)
{
    $a = get_app();
    logger('fix_private_photos', LOGGER_DEBUG);
    $site = substr($a->get_baseurl(), strpos($a->get_baseurl(), '://'));
    $orig_body = $s;
    $new_body = '';
    $img_start = strpos($orig_body, '[zmg');
    $img_st_close = $img_start !== false ? strpos(substr($orig_body, $img_start), ']') : false;
    $img_len = $img_start !== false ? strpos(substr($orig_body, $img_start + $img_st_close + 1), '[/zmg]') : false;
    while ($img_st_close !== false && $img_len !== false) {
        $img_st_close++;
        // make it point to AFTER the closing bracket
        $image = substr($orig_body, $img_start + $img_st_close, $img_len);
        logger('fix_private_photos: found photo ' . $image, LOGGER_DEBUG);
        if (stristr($image, $site . '/photo/')) {
            // Only embed locally hosted photos
            $replace = false;
            $i = basename($image);
            $x = strpos($i, '-');
            if ($x) {
                $res = substr($i, $x + 1);
                $i = substr($i, 0, $x);
                $r = q("SELECT * FROM `photo` WHERE `resource_id` = '%s' AND `scale` = %d AND `uid` = %d", dbesc($i), intval($res), intval($uid));
                if (count($r)) {
                    // Check to see if we should replace this photo link with an embedded image
                    // 1. No need to do so if the photo is public
                    // 2. If there's a contact-id provided, see if they're in the access list
                    //    for the photo. If so, embed it.
                    // 3. Otherwise, if we have an item, see if the item permissions match the photo
                    //    permissions, regardless of order but first check to see if they're an exact
                    //    match to save some processing overhead.
                    if (has_permissions($r[0])) {
                        if ($cid) {
                            $recips = enumerate_permissions($r[0]);
                            if (in_array($cid, $recips)) {
                                $replace = true;
                            }
                        } elseif ($item) {
                            if (compare_permissions($item, $r[0])) {
                                $replace = true;
                            }
                        }
                    }
                    if ($replace) {
                        $data = $r[0]['data'];
                        $type = $r[0]['type'];
                        // If a custom width and height were specified, apply before embedding
                        if (preg_match("/\\[zmg\\=([0-9]*)x([0-9]*)\\]/is", substr($orig_body, $img_start, $img_st_close), $match)) {
                            logger('fix_private_photos: scaling photo', LOGGER_DEBUG);
                            $width = intval($match[1]);
                            $height = intval($match[2]);
                            $ph = photo_factory($data, $type);
                            if ($ph->is_valid()) {
                                $ph->scaleImage(max($width, $height));
                                $data = $ph->imageString();
                                $type = $ph->getType();
                            }
                        }
                        logger('fix_private_photos: replacing photo', LOGGER_DEBUG);
                        $image = 'data:' . $type . ';base64,' . base64_encode($data);
                        logger('fix_private_photos: replaced: ' . $image, LOGGER_DATA);
                    }
                }
            }
        }
        $new_body = $new_body . substr($orig_body, 0, $img_start + $img_st_close) . $image . '[/zmg]';
        $orig_body = substr($orig_body, $img_start + $img_st_close + $img_len + strlen('[/zmg]'));
        if ($orig_body === false) {
            $orig_body = '';
        }
        $img_start = strpos($orig_body, '[zmg');
        $img_st_close = $img_start !== false ? strpos(substr($orig_body, $img_start), ']') : false;
        $img_len = $img_start !== false ? strpos(substr($orig_body, $img_start + $img_st_close + 1), '[/zmg]') : false;
    }
    $new_body = $new_body . $orig_body;
    return $new_body;
}
开发者ID:einervonvielen,项目名称:redmatrix,代码行数:78,代码来源:items.php


示例2: taskhrefedit

<?php

//TODO: Move these to a helper as they'll be shared here and with the tasks page
function taskhrefedit($nr, $date)
{
    echo "<a href=\"/tasks/char/{$date}/{$nr}\" title=\"Click to see tasks for this Character\">";
}
function editqueuehrefedit($nr)
{
    echo "<a href=\"/queue/edit/{$nr}\" title=\"Click to edit this Queue\">";
}
function itemhrefedit($nr)
{
    echo "<a href=\"/item/view/{$nr}\" title=\"Click to open Database\">";
}
$rights = has_permissions($permissions, "Administrator,EditQueue");
?>
<div class="tytul">Corporate Queue <?php 
echo $year . "-" . $month;
?>
</div>
<?php 
switch ($month) {
    case 1:
        $NEXTMONTH = str_pad(2, 2, "0", STR_PAD_LEFT);
        $NEXTYEAR = $year;
        $PREVMONTH = 12;
        $PREVYEAR = $year - 1;
        break;
    case 12:
        $NEXTMONTH = str_pad(1, 2, "0", STR_PAD_LEFT);
开发者ID:maurerit,项目名称:lmeve-ci,代码行数:31,代码来源:queue.php


示例3: fault

function fault()
{
    exit;
}
if (!isset($_GET["file"])) {
    fault();
}
$name = $_GET["file"];
if (substr($name, 0, 4) == "auth") {
    fault();
}
if (!preg_match("/^[a-zA-Z0-9-. _]*\$/i", $name)) {
    fault();
}
$file = $datafolder . $name;
if (!file_exists($file)) {
    if (!has_permissions()) {
        fault();
    }
    $file = $datafolder . "auth-" . $name;
    if (!file_exists($file)) {
        fault();
    }
}
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == filemtime($file)) {
    header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($file)) . ' GMT', true, 304);
} else {
    header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($file)) . ' GMT', true, 200);
    header('Content-Length: ' . filesize($file));
    echo file_get_contents($file);
}
开发者ID:Timvde,项目名称:arewefastyet,代码行数:31,代码来源:data.php


示例4: session_start

<?php

/*
############################################
##  MIDDIX FILE LIBRARY                   ##
##  By Alex                               ##
##  Directory delete by lixlpixel         ##
############################################
*/
session_start();
include "../Core/filepermissions.php";
if ($_SESSION["User_Loggedin"]) {
    $action = $_REQUEST["a"];
    $filepath = urldecode($_REQUEST["f"]);
    $fileperms = has_permissions($filepath);
    $filepath = "../." . $fileperms[1];
    if ($fileperms[0][0]) {
        $ufilepath = $filepath;
    } else {
        $ufilepath = "\$";
    }
    if (!$fileperms[0][1]) {
        $filepath = "///";
    }
    if ($action == "md") {
        mkdir($filepath);
    }
    if ($action == "w") {
        $contents = str_replace("&#43;", "+", urldecode($_REQUEST["c"]));
        file_put_contents($filepath, stripslashes($contents));
    }
开发者ID:alexscarp,项目名称:middix,代码行数:31,代码来源:file.php


示例5: fix_private_photos

function fix_private_photos($s, $uid, $item = null, $cid = 0)
{
    $a = get_app();
    logger('fix_private_photos', LOGGER_DEBUG);
    $site = substr($a->get_baseurl(), strpos($a->get_baseurl(), '://'));
    if (preg_match("/\\[img(.*?)\\](.*?)\\[\\/img\\]/is", $s, $matches)) {
        $image = $matches[2];
        logger('fix_private_photos: found photo ' . $image, LOGGER_DEBUG);
        if (stristr($image, $site . '/photo/')) {
            $replace = false;
            $i = basename($image);
            $i = str_replace('.jpg', '', $i);
            $x = strpos($i, '-');
            if ($x) {
                $res = substr($i, $x + 1);
                $i = substr($i, 0, $x);
                $r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `scale` = %d AND `uid` = %d", dbesc($i), intval($res), intval($uid));
                if (count($r)) {
                    // Check to see if we should replace this photo link with an embedded image
                    // 1. No need to do so if the photo is public
                    // 2. If there's a contact-id provided, see if they're in the access list
                    //    for the photo. If so, embed it.
                    // 3. Otherwise, if we have an item, see if the item permissions match the photo
                    //    permissions, regardless of order but first check to see if they're an exact
                    //    match to save some processing overhead.
                    // Currently we only embed one private photo per message so as not to hit import
                    // size limits at the receiving end.
                    // To embed multiples, we would need to parse out the embedded photos on message
                    // receipt and limit size based only on the text component. Would also need to
                    // ignore all photos during bbcode translation and item localisation, as these
                    // will hit internal regex backtrace limits.
                    if (has_permissions($r[0])) {
                        if ($cid) {
                            $recips = enumerate_permissions($r[0]);
                            if (in_array($cid, $recips)) {
                                $replace = true;
                            }
                        } elseif ($item) {
                            if (compare_permissions($item, $r[0])) {
                                $replace = true;
                            }
                        }
                    }
                    if ($replace) {
                        logger('fix_private_photos: replacing photo', LOGGER_DEBUG);
                        $s = str_replace($image, 'data:image/jpg;base64,' . base64_encode($r[0]['data']), $s);
                        logger('fix_private_photos: replaced: ' . $s, LOGGER_DATA);
                    }
                }
            }
        }
    }
    return $s;
}
开发者ID:robhell,项目名称:friendica,代码行数:54,代码来源:items.php


示例6: number_format

                echo $point->hrsPerPoint;
                echo "</a>";
            }
            ?>
                                        </td></tr>
                                <?php 
        }
        ?>
                            </table>

                            <strong>1 point = <?php 
        echo number_format($ONEPOINT, 2, $DECIMAL_SEP, $THOUSAND_SEP);
        ?>
 ISK</strong>
                            <?php 
        if (has_permissions($permissions, "Administrator")) {
            ?>
                                <input type="button" value="Edit" onclick="location.href = '?id=5&id2=0';">
                            <?php 
        }
        ?>
                            <br/>
                            <?php 
        $pointsDisplayed = true;
    }
    ?>

                    </td><td width="60%" style="vertical-align: top;">

                        <?php 
    $sumstat = 0.0;
开发者ID:maurerit,项目名称:lmeve-ci,代码行数:31,代码来源:timesheet.php


示例7: loadMenu

 public function loadMenu($menuConfigs)
 {
     $this->benchmark->mark('LMeveControllerLoadMenu_start');
     $menu = '';
     foreach ($menuConfigs as $menuConfig) {
         $class = 'menu';
         if ($this->getName() === strtolower($menuConfig['name'])) {
             $class = 'menua';
         }
         if (has_permissions($this->data['permissions'], "Administrator," . $menuConfig['rootPerm'])) {
             $menu = $menu . '<td class="' . $class . '"> <a href="' . $menuConfig['path'] . '">' . $menuConfig['name'] . '</a><br></td>';
         }
     }
     $this->data['menu'] = $menu;
     $this->benchmark->mark('LMeveControllerLoadMenu_end');
 }
开发者ID:maurerit,项目名称:lmeve-ci,代码行数:16,代码来源:LMeve_Controller.php


示例8: SimpleUnzip

            $destination_folder = $destination_folder . '/';
        }
        $vzip = new SimpleUnzip($filename);
        foreach ($vzip->Entries as $extr) {
            $path = $extr->Path;
            $path_folder = explode('/', $path);
            $new_path = '';
            foreach ($path_folder as $folder) {
                $new_path .= $folder . '/';
                $to_create = $destination_folder . $new_path;
                if (substr($to_create, -1) == '/') {
                    $to_create = substr($to_create, 0, strlen($to_create) - 1);
                }
                @mkdir($to_create, 0777);
            }
            $new_path = '';
            $filev = fopen($destination_folder . $extr->Path . '/' . $extr->Name, 'w');
            fwrite($filev, $extr->Data);
            fclose($filev);
        }
    }
    $filepath = urldecode($_REQUEST["t"]);
    $fileperms = has_permissions($filepath);
    $filepath = $fileperms[1];
    $zippath = urldecode($_REQUEST["z"]);
    $zipperms = has_permissions($zippath);
    $zippath = $zipperms[1];
    if ($fileperms[0][1] && $zipperms[0][0]) {
        unzipFile("../../" . $zippath, "../../" . $filepath);
    }
}
开发者ID:alexscarp,项目名称:middix,代码行数:31,代码来源:zip.php


示例9:

                <form method="get" action="/database/orechart.html">
                    <input type="submit" value="Ore Chart" />
                </form>
            </td>
        <?php 
}
?>
        <?php 
if (has_permissions($permissions, "Administrator,ViewProfitCalc")) {
    ?>
            <td>
                <form method="get" action="/database/profitexplorer.html">
                    <input type="submit" value="Profit Explorer" />
                </form>
            </td>
        <?php 
}
?>
        <?php 
if (has_permissions($permissions, "Administrator,ViewProfitCalc")) {
    ?>
            <td>
                <form method="get" action="/database/profitchart.html">
                    <input type="submit" value="Profit Chart" title="WARNING: it can take a very long time to load!"/>
                </form>
            </td>
        <?php 
}
?>
    </tr>
</table>
开发者ID:maurerit,项目名称:lmeve-ci,代码行数:31,代码来源:database_main.php


示例10: requireViewQueue

 private function requireViewQueue()
 {
     if (!has_permissions($this->data['permissions'], 'Administrator,ViewQueue')) {
         $this->template->load('layout', 'unauthorized');
     }
 }
开发者ID:maurerit,项目名称:lmeve-ci,代码行数:6,代码来源:queue.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP has_post_format函数代码示例发布时间:2022-05-15
下一篇:
PHP has_permission函数代码示例发布时间: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