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


PHP channelx_by_n函数代码示例

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


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

示例1: init

 function init()
 {
     $ret = array();
     call_hooks('home_init', $ret);
     $splash = argc() > 1 && argv(1) === 'splash' ? true : false;
     $channel = \App::get_channel();
     if (local_channel() && $channel && $channel['xchan_url'] && !$splash) {
         $dest = $channel['channel_startpage'];
         if (!$dest) {
             $dest = get_pconfig(local_channel(), 'system', 'startpage');
         }
         if (!$dest) {
             $dest = get_config('system', 'startpage');
         }
         if (!$dest) {
             $dest = z_root() . '/network';
         }
         goaway($dest);
     }
     if (remote_channel() && !$splash && $_SESSION['atoken']) {
         $r = q("select * from atoken where atoken_id = %d", intval($_SESSION['atoken']));
         if ($r) {
             $x = channelx_by_n($r[0]['atoken_uid']);
             if ($x) {
                 goaway(z_root() . '/channel/' . $x['channel_address']);
             }
         }
     }
     if (get_account_id() && !$splash) {
         goaway(z_root() . '/new_channel');
     }
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:32,代码来源:Home.php

示例2: atoken_xchan

function atoken_xchan($atoken)
{
    $c = channelx_by_n($atoken['atoken_uid']);
    if ($c) {
        return ['atoken_id' => $atoken['atoken_id'], 'xchan_hash' => substr($c['channel_hash'], 0, 16) . '.' . $atoken['atoken_name'], 'xchan_name' => $atoken['atoken_name'], 'xchan_addr' => t('guest:') . $atoken['atoken_name'] . '@' . \App::get_hostname(), 'xchan_network' => 'unknown', 'xchan_url' => z_root(), 'xchan_hidden' => 1, 'xchan_photo_mimetype' => 'image/jpeg', 'xchan_photo_l' => get_default_profile_photo(300), 'xchan_photo_m' => get_default_profile_photo(80), 'xchan_photo_s' => get_default_profile_photo(48)];
    }
    return null;
}
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:8,代码来源:security.php

示例3: exec

 function exec()
 {
     $opts = $this->curlopts;
     $url = $this->url;
     if ($this->auth) {
         $opts['http_auth'] = $this->auth;
     }
     if ($this->magicauth) {
         $opts['cookiejar'] = 'store/[data]/cookie_' . $this->magicauth;
         $opts['cookiefile'] = 'store/[data]/cookie_' . $this->magicauth;
         $opts['cookie'] = 'PHPSESSID=' . trim(file_get_contents('store/[data]/cookien_' . $this->magicauth));
         $c = channelx_by_n($this->magicauth);
         if ($c) {
             $url = zid($this->url, channel_reddress($c));
         }
     }
     if ($this->custom) {
         $opts['custom'] = $this->custom;
     }
     if ($this->headers) {
         $opts['headers'] = $this->headers;
     }
     if ($this->upload) {
         $opts['upload'] = true;
         $opts['infile'] = $this->filehandle;
         $opts['infilesize'] = strlen($this->request_data);
         $opts['readfunc'] = [$this, 'curl_read'];
     }
     $recurse = 0;
     return z_fetch_url($this->url, true, $recurse, $opts ? $opts : null);
 }
开发者ID:phellmes,项目名称:hubzilla,代码行数:31,代码来源:SuperCurl.php

示例4: attach_move

/**
 * attach_move()
 * This function performs an in place directory-to-directory move of a stored attachment or photo.
 * The data is physically moved in the store/nickname storage location and the paths adjusted
 * in the attach structure (and if applicable the photo table). The new 'album name' is recorded
 * for photos and will show up immediately there.
 * This takes a channel_id, attach.hash of the file to move (this is the same as a photo resource_id), and
 * the attach.hash of the new parent folder, which must already exist. If $new_folder_hash is blank or empty,
 * the file is relocated to the root of the channel's storage area. 
 *
 * @fixme: this operation is currently not synced to clones !!
 */
function attach_move($channel_id, $resource_id, $new_folder_hash)
{
    $c = channelx_by_n($channel_id);
    if (!$c) {
        return false;
    }
    $r = q("select * from attach where hash = '%s' and uid = %d limit 1", dbesc($resource_id), intval($channel_id));
    if (!$r) {
        return false;
    }
    $oldstorepath = $r[0]['content'];
    if ($new_folder_hash) {
        $n = q("select * from attach where hash = '%s' and uid = %d limit 1", dbesc($new_folder_hash), intval($channel_id));
        if (!$n) {
            return;
        }
        $newdirname = $n[0]['filename'];
        $newstorepath = $n[0]['content'] . '/' . $resource_id;
    } else {
        $newstorepath = 'store/' . $c['channel_address'] . '/' . $resource_id;
    }
    rename($oldstorepath, $newstorepath);
    // duplicate detection. If 'overwrite' is specified, return false because we can't yet do that.
    $filename = $r[0]['filename'];
    $s = q("select filename, id, hash, filesize from attach where filename = '%s' and folder = '%s' ", dbesc($filename), dbesc($new_folder_hash));
    if ($s) {
        $overwrite = get_pconfig($channel_id, 'system', 'overwrite_dup_files');
        if ($overwrite) {
            // @fixme
            return;
        } else {
            if (strpos($filename, '.') !== false) {
                $basename = substr($filename, 0, strrpos($filename, '.'));
                $ext = substr($filename, strrpos($filename, '.'));
            } else {
                $basename = $filename;
                $ext = '';
            }
            $v = q("select filename from attach where ( filename = '%s' OR filename like '%s' ) and folder = '%s' ", dbesc($basename . $ext), dbesc($basename . '(%)' . $ext), dbesc($new_folder_hash));
            if ($v) {
                $x = 1;
                do {
                    $found = false;
                    foreach ($v as $vv) {
                        if ($vv['filename'] === $basename . '(' . $x . ')' . $ext) {
                            $found = true;
                            break;
                        }
                    }
                    if ($found) {
                        $x++;
                    }
                } while ($found);
                $filename = $basename . '(' . $x . ')' . $ext;
            } else {
                $filename = $basename . $ext;
            }
        }
    }
    $t = q("update attach set content = '%s', folder = '%s', filename = '%s' where id = %d", dbesc($newstorepath), dbesc($new_folder_hash), dbesc($filename), intval($r[0]['id']));
    if ($r[0]['is_photo']) {
        $t = q("update photo set album = '%s', filename = '%s' where resource_id = '%s' and uid = %d", dbesc($newdirname), dbesc($filename), dbesc($resource_id), intval($channel_id));
        $t = q("update photo set content = '%s' where resource_id = '%s' and uid = %d and imgscale = 0", dbesc($newstorepath), dbesc($resource_id), intval($channel_id));
    }
    return true;
}
开发者ID:phellmes,项目名称:hubzilla,代码行数:78,代码来源:attach.php

示例5: delete

 /**
  * @brief delete directory
  */
 public function delete()
 {
     logger('delete file ' . basename($this->red_path), LOGGER_DEBUG);
     if (!$this->auth->owner_id || !perm_is_allowed($this->auth->owner_id, $this->auth->observer, 'write_storage')) {
         throw new DAV\Exception\Forbidden('Permission denied.');
     }
     if ($this->auth->owner_id !== $this->auth->channel_id) {
         if ($this->auth->observer !== $this->data['creator'] || intval($this->data['is_dir'])) {
             throw new DAV\Exception\Forbidden('Permission denied.');
         }
     }
     attach_delete($this->auth->owner_id, $this->folder_hash);
     $ch = channelx_by_n($this->auth->owner_id);
     if ($ch) {
         $sync = attach_export_data($ch, $this->folder_hash, true);
         if ($sync) {
             build_sync_packet($ch['channel_id'], array('file' => array($sync)));
         }
     }
 }
开发者ID:phellmes,项目名称:hubzilla,代码行数:23,代码来源:Directory.php

示例6: channel_export_items

function channel_export_items($channel_id, $start, $finish)
{
    if (!$start) {
        return array();
    } else {
        $start = datetime_convert('UTC', 'UTC', $start);
    }
    $finish = datetime_convert('UTC', 'UTC', $finish ? $finish : 'now');
    if ($finish < $start) {
        return array();
    }
    $ret = array();
    $ch = channelx_by_n($channel_id);
    if ($ch) {
        $ret['relocate'] = ['channel_address' => $ch['channel_address'], 'url' => z_root()];
    }
    $r = q("select * from item where ( item_wall = 1 or item_type != %d ) and item_deleted = 0 and uid = %d and created >= '%s' and created < '%s'  and resource_type = '' order by created", intval(ITEM_TYPE_POST), intval($channel_id), dbesc($start), dbesc($finish));
    if ($r) {
        $ret['item'] = array();
        xchan_query($r);
        $r = fetch_post_tags($r, true);
        foreach ($r as $rr) {
            $ret['item'][] = encode_item($rr, true);
        }
    }
    return $ret;
}
开发者ID:phellmes,项目名称:hubzilla,代码行数:27,代码来源:channel.php

示例7: jappixmini_cron

function jappixmini_cron(&$a, $d)
{
    require_once 'include/Contact.php';
    // For autosubscribe/autoapprove, we need to maintain a list of jabber addresses of our contacts.
    set_config("jappixmini", "last_cron_execution", $d);
    // go through list of users with jabber enabled
    $users = q("SELECT uid FROM pconfig WHERE cat = 'jappixmini' AND ( k = 'autosubscribe' OR k = 'autoapprove') AND v = '1' group by uid ");
    logger("jappixmini: Update list of contacts' jabber accounts for " . count($users) . " users.");
    if (!count($users)) {
        return;
    }
    foreach ($users as $row) {
        $uid = $row["uid"];
        // for each user, go through list of contacts
        $rand = db_getfunc('rand');
        $contacts = q("SELECT * FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE `abook_channel`=%d AND not (abook_flags & %d) > 0 order by {$rand}", intval($uid), intval(ABOOK_FLAG_SELF));
        $channel = channelx_by_n($uid);
        if (!$channel || !$contacts) {
            continue;
        }
        foreach ($contacts as $contact_row) {
            $xchan_hash = $contact_row["abook_xchan"];
            $pubkey = $contact_row["xchan_pubkey"];
            // check if jabber address already present
            $present = get_pconfig($uid, "jappixmini", "id:" . $xchan_hash);
            $now = intval(time());
            if ($present) {
                // $present has format "timestamp:jabber_address"
                $p = strpos($present, ":");
                $timestamp = intval(substr($present, 0, $p));
                // do not re-retrieve jabber address if last retrieval
                // is not older than a week
                if ($now - $timestamp < 3600 * 24 * 7) {
                    continue;
                }
            }
            logger('jappixmini: checking ' . $contact_row['xchan_name'] . ' for channel ' . $channel['channel_name']);
            // construct base retrieval address
            $pos = strpos($contact_row['xchan_connurl'], "/poco/");
            if ($pos === false) {
                continue;
            }
            $url = substr($contact_row['xchan_connurl'], 0, $pos) . "/jappixmini?f=";
            // construct own address
            $username = get_pconfig($uid, 'jappixmini', 'username');
            if (!$username) {
                continue;
            }
            $server = get_pconfig($uid, 'jappixmini', 'server');
            if (!$server) {
                continue;
            }
            $address = $username . "@" . $server;
            // sign address
            $signed_address = "";
            openssl_private_encrypt($address, $signed_address, $channel['channel_prvkey']);
            // construct request url
            $signed_address_hex = base64url_encode($signed_address);
            $postvars = array('address' => $signed_address, 'requestor' => $channel['xchan_hash'], 'requestee' => $contact_row['xchan_hash']);
            try {
                // send request
                $answer_json = z_post_url($url, $postvars);
                logger('jappixmini: url response: ' . print_r($answer_json, true));
                if (!$answer_json['success']) {
                    logger('jappixmini: failed z_post_url ' . $url);
                    throw new Exception();
                }
                if ($answer_json['return_code'] == 404) {
                    logger('jappixmini: failed z_post_url (404)' . $url);
                    throw new Exception();
                }
                // parse answer
                $answer = json_decode($answer_json['body'], true);
                if ($answer['status'] != "ok") {
                    throw new Exception();
                }
                $address = base64url_decode($answer['address']);
                if (!$address) {
                    throw new Exception();
                }
                // decrypt address
                $decrypted_address = "";
                openssl_public_decrypt($address, $decrypted_address, $pubkey);
                if (!$decrypted_address) {
                    throw new Exception();
                }
            } catch (Exception $e) {
                $decrypted_address = "";
            }
            // save address
            set_pconfig($uid, "jappixmini", "id:" . $xchan_hash, "{$now}:{$decrypted_address}");
        }
    }
}
开发者ID:einervonvielen,项目名称:redmatrix-addons,代码行数:94,代码来源:jappixmini.php

示例8: init


//.........这里部分代码省略.........
             $cache_directive = 'no-cache';
             $status = 'no cookie';
         }
         $resolution = 0;
         if (strpos($photo, '.') !== false) {
             $photo = substr($photo, 0, strpos($photo, '.'));
         }
         if (substr($photo, -2, 1) == '-') {
             $resolution = intval(substr($photo, -1, 1));
             $photo = substr($photo, 0, -2);
             // If viewing on a high-res screen, attempt to serve a higher resolution image:
             if ($resolution == 2 && $cookie_value > 1) {
                 $resolution = 1;
             }
         }
         // If using resolution 1, make sure it exists before proceeding:
         if ($resolution == 1) {
             $r = q("SELECT uid FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1", dbesc($photo), intval($resolution));
             if (!$r) {
                 $resolution = 2;
             }
         }
         $r = q("SELECT uid FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1", dbesc($photo), intval($resolution));
         if ($r) {
             $allowed = $r[0]['uid'] ? perm_is_allowed($r[0]['uid'], $observer_xchan, 'view_storage') : true;
             $sql_extra = permissions_sql($r[0]['uid']);
             if (!$sql_extra) {
                 $sql_extra = ' and true ';
             }
             // Only check permissions on normal photos. Those photos we don't check includes
             // profile photos, xchan photos (which are also profile photos), 'thing' photos,
             // and cover photos
             $sql_extra = " and (( photo_usage = 0 {$sql_extra} ) or photo_usage != 0 )";
             $channel = channelx_by_n($r[0]['uid']);
             // Now we'll see if we can access the photo
             $r = q("SELECT * FROM photo WHERE resource_id = '%s' AND imgscale = %d {$sql_extra} LIMIT 1", dbesc($photo), intval($resolution));
             if ($r && $allowed) {
                 $data = dbunescbin($r[0]['content']);
                 $mimetype = $r[0]['mimetype'];
                 if (intval($r[0]['os_storage'])) {
                     $streaming = $data;
                 }
             } else {
                 // Does the picture exist? It may be a remote person with no credentials,
                 // but who should otherwise be able to view it. Show a default image to let
                 // them know permissions was denied. It may be possible to view the image
                 // through an authenticated profile visit.
                 // There won't be many completely unauthorised people seeing this because
                 // they won't have the photo link, so there's a reasonable chance that the person
                 // might be able to obtain permission to view it.
                 $r = q("SELECT * FROM `photo` WHERE `resource_id` = '%s' AND `imgscale` = %d LIMIT 1", dbesc($photo), intval($resolution));
                 if ($r) {
                     logger('mod_photo: forbidden. ' . \App::$query_string);
                     $observer = \App::get_observer();
                     logger('mod_photo: observer = ' . ($observer ? $observer['xchan_addr'] : '(not authenticated)'));
                     $data = file_get_contents('images/nosign.png');
                     $mimetype = 'image/png';
                     $prvcachecontrol = true;
                 }
             }
         }
     }
     if (!isset($data)) {
         if (isset($resolution)) {
             switch ($resolution) {
                 case 4:
开发者ID:phellmes,项目名称:hubzilla,代码行数:67,代码来源:Photo.php

示例9: delete

 /**
  * @brief Delete the file.
  *
  * This method checks the permissions and then calls attach_delete() function
  * to actually remove the file.
  *
  * @throw \Sabre\DAV\Exception\Forbidden
  */
 public function delete()
 {
     logger('delete file ' . basename($this->name), LOGGER_DEBUG);
     if (!$this->auth->owner_id || !perm_is_allowed($this->auth->owner_id, $this->auth->observer, 'write_storage')) {
         throw new DAV\Exception\Forbidden('Permission denied.');
     }
     if ($this->auth->owner_id !== $this->auth->channel_id) {
         if ($this->auth->observer !== $this->data['creator'] || intval($this->data['is_dir'])) {
             throw new DAV\Exception\Forbidden('Permission denied.');
         }
     }
     if (get_pconfig($this->auth->owner_id, 'system', 'os_delete_prohibit') && \App::$module == 'dav') {
         throw new DAV\Exception\Forbidden('Permission denied.');
     }
     attach_delete($this->auth->owner_id, $this->data['hash']);
     $ch = channelx_by_n($this->auth->owner_id);
     if ($ch) {
         $sync = attach_export_data($ch, $this->data['hash'], true);
         if ($sync) {
             build_sync_packet($ch['channel_id'], array('file' => array($sync)));
         }
     }
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:31,代码来源:File.php

示例10: widget_cover_photo

function widget_cover_photo($arr)
{
    require_once 'include/channel.php';
    $o = '';
    if (App::$module == 'channel' && $_REQUEST['mid']) {
        return '';
    }
    $channel_id = 0;
    if (array_key_exists('channel_id', $arr) && intval($arr['channel_id'])) {
        $channel_id = intval($arr['channel_id']);
    }
    if (!$channel_id) {
        $channel_id = App::$profile_uid;
    }
    if (!$channel_id) {
        return '';
    }
    $channel = channelx_by_n($channel_id);
    if (array_key_exists('style', $arr) && isset($arr['style'])) {
        $style = $arr['style'];
    } else {
        $style = 'width:100%; height: auto;';
    }
    // ensure they can't sneak in an eval(js) function
    if (strpbrk($style, '(\'"<>') !== false) {
        $style = '';
    }
    if (array_key_exists('title', $arr) && isset($arr['title'])) {
        $title = $arr['title'];
    } else {
        $title = $channel['channel_name'];
    }
    if (array_key_exists('subtitle', $arr) && isset($arr['subtitle'])) {
        $subtitle = $arr['subtitle'];
    } else {
        $subtitle = str_replace('@', '&#x40;', $channel['xchan_addr']);
    }
    $c = get_cover_photo($channel_id, 'html');
    if ($c) {
        $photo_html = $style ? str_replace('alt=', ' style="' . $style . '" alt=', $c) : $c;
        $o = replace_macros(get_markup_template('cover_photo_widget.tpl'), array('$photo_html' => $photo_html, '$title' => $title, '$subtitle' => $subtitle, '$hovertitle' => t('Click to show more')));
    }
    return $o;
}
开发者ID:einervonvielen,项目名称:hubzilla,代码行数:44,代码来源:widgets.php

示例11: status_editor

/**
 * This is our general purpose content editor. 
 * It was once nicknamed "jot" and you may see references to "jot" littered throughout the code.
 * They are referring to the content editor or components thereof. 
 */
function status_editor($a, $x, $popup = false)
{
    $o = '';
    $c = channelx_by_n($x['profile_uid']);
    if ($c && $c['channel_moved']) {
        return $o;
    }
    $plaintext = true;
    //	if(feature_enabled(local_channel(),'richtext'))
    //		$plaintext = false;
    $feature_voting = feature_enabled($x['profile_uid'], 'consensus_tools');
    if (x($x, 'hide_voting')) {
        $feature_voting = false;
    }
    $feature_expire = feature_enabled($x['profile_uid'], 'content_expire') && !$webpage ? true : false;
    if (x($x, 'hide_expire')) {
        $feature_expire = false;
    }
    $feature_future = feature_enabled($x['profile_uid'], 'delayed_posting') && !$webpage ? true : false;
    if (x($x, 'hide_future')) {
        $feature_future = false;
    }
    $geotag = $x['allow_location'] ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '';
    $setloc = t('Set your location');
    $clearloc = get_pconfig($x['profile_uid'], 'system', 'use_browser_location') ? t('Clear browser location') : '';
    if (x($x, 'hide_location')) {
        $geotag = $setloc = $clearloc = '';
    }
    $mimetype = x($x, 'mimetype') ? $x['mimetype'] : 'text/bbcode';
    $mimeselect = x($x, 'mimeselect') ? $x['mimeselect'] : false;
    if ($mimeselect) {
        $mimeselect = mimetype_select($x['profile_uid'], $mimetype);
    } else {
        $mimeselect = '<input type="hidden" name="mimetype" value="' . $mimetype . '" />';
    }
    $weblink = $mimetype === 'text/bbcode' ? t('Insert web link') : false;
    if (x($x, 'hide_weblink')) {
        $weblink = false;
    }
    $embedPhotos = t('Embed image from photo albums');
    $writefiles = $mimetype === 'text/bbcode' ? perm_is_allowed($x['profile_uid'], get_observer_hash(), 'write_storage') : false;
    if (x($x, 'hide_attach')) {
        $writefiles = false;
    }
    $layout = x($x, 'layout') ? $x['layout'] : '';
    $layoutselect = x($x, 'layoutselect') ? $x['layoutselect'] : false;
    if ($layoutselect) {
        $layoutselect = layout_select($x['profile_uid'], $layout);
    } else {
        $layoutselect = '<input type="hidden" name="layout_mid" value="' . $layout . '" />';
    }
    if (array_key_exists('channel_select', $x) && $x['channel_select']) {
        require_once 'include/channel.php';
        $id_select = identity_selector();
    } else {
        $id_select = '';
    }
    $webpage = x($x, 'webpage') ? $x['webpage'] : '';
    $tpl = get_markup_template('jot-header.tpl');
    App::$page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => z_root(), '$editselect' => $plaintext ? 'none' : '/(profile-jot-text|prvmail-text)/', '$pretext' => x($x, 'pretext') ? $x['pretext'] : '', '$geotag' => $geotag, '$nickname' => $x['nickname'], '$linkurl' => t('Please enter a link URL:'), '$term' => t('Tag term:'), '$whereareu' => t('Where are you right now?'), '$editor_autocomplete' => x($x, 'editor_autocomplete') ? $x['editor_autocomplete'] : '', '$bbco_autocomplete' => x($x, 'bbco_autocomplete') ? $x['bbco_autocomplete'] : '', '$modalchooseimages' => t('Choose images to embed'), '$modalchoosealbum' => t('Choose an album'), '$modaldiffalbum' => t('Choose a different album...'), '$modalerrorlist' => t('Error getting album list'), '$modalerrorlink' => t('Error getting photo link'), '$modalerroralbum' => t('Error getting album')));
    $tpl = get_markup_template('jot.tpl');
    $jotplugins = '';
    $preview = t('Preview');
    if (x($x, 'hide_preview')) {
        $preview = '';
    }
    $defexpire = ($z = get_pconfig($x['profile_uid'], 'system', 'default_post_expire')) && !$webpage ? $z : '';
    if ($defexpire) {
        $defexpire = datetime_convert('UTC', date_default_timezone_get(), $defexpire, 'Y-m-d H:i');
    }
    $defpublish = ($z = get_pconfig($x['profile_uid'], 'system', 'default_post_publish')) && !$webpage ? $z : '';
    if ($defpublish) {
        $defpublish = datetime_convert('UTC', date_default_timezone_get(), $defpublish, 'Y-m-d H:i');
    }
    $cipher = get_pconfig($x['profile_uid'], 'system', 'default_cipher');
    if (!$cipher) {
        $cipher = 'aes256';
    }
    call_hooks('jot_tool', $jotplugins);
    $o .= replace_macros($tpl, array('$return_path' => x($x, 'return_path') ? $x['return_path'] : App::$query_string, '$action' => z_root() . '/item', '$share' => x($x, 'button') ? $x['button'] : t('Share'), '$webpage' => $webpage, '$placeholdpagetitle' => x($x, 'ptlabel') ? $x['ptlabel'] : t('Page link name'), '$pagetitle' => x($x, 'pagetitle') ? $x['pagetitle'] : '', '$id_select' => $id_select, '$id_seltext' => t('Post as'), '$writefiles' => $writefiles, '$bold' => t('Bold'), '$italic' => t('Italic'), '$underline' => t('Underline'), '$quote' => t('Quote'), '$code' => t('Code'), '$attach' => t('Attach file'), '$weblink' => $weblink, '$embedPhotos' => $embedPhotos, '$embedPhotosModalTitle' => t('Embed an image from your albums'), '$embedPhotosModalCancel' => t('Cancel'), '$embedPhotosModalOK' => t('OK'), '$setloc' => $setloc, '$voting' => t('Toggle voting'), '$feature_voting' => $feature_voting, '$consensus' => 0, '$clearloc' => $clearloc, '$title' => x($x, 'title') ? htmlspecialchars($x['title'], ENT_COMPAT, 'UTF-8') : '', '$placeholdertitle' => x($x, 'placeholdertitle') ? $x['placeholdertitle'] : t('Title (optional)'), '$catsenabled' => feature_enabled($x['profile_uid'], 'categories') && !$webpage ? 'categories' : '', '$category' => x($x, 'category') ? $x['category'] : '', '$placeholdercategory' => t('Categories (optional, comma-separated list)'), '$permset' => t('Permission settings'), '$ptyp' => x($x, 'ptyp') ? $x['ptyp'] : '', '$content' => x($x, 'body') ? htmlspecialchars($x['body'], ENT_COMPAT, 'UTF-8') : '', '$attachment' => x($x, 'attachment') ? $x['attachment'] : '', '$post_id' => x($x, 'post_id') ? $x['post_id'] : '', '$defloc' => $x['default_location'], '$visitor' => $x['visitor'], '$lockstate' => $x['lockstate'], '$acl' => $x['acl'], '$mimeselect' => $mimeselect, '$layoutselect' => $layoutselect, '$showacl' => array_key_exists('showacl', $x) ? $x['showacl'] : true, '$bang' => $x['bang'], '$profile_uid' => $x['profile_uid'], '$preview' => $preview, '$source' => x($x, 'source') ? $x['source'] : '', '$jotplugins' => $jotplugins, '$defexpire' => $defexpire, '$feature_expire' => $feature_expire, '$expires' => t('Set expiration date'), '$defpublish' => $defpublish, '$feature_future' => $feature_future, '$future_txt' => t('Set publish date'), '$feature_encrypt' => feature_enabled($x['profile_uid'], 'content_encrypt') && !$webpage ? true : false, '$encrypt' => t('Encrypt text'), '$cipher' => $cipher, '$expiryModalOK' => t('OK'), '$expiryModalCANCEL' => t('Cancel'), '$expanded' => x($x, 'expanded') ? $x['expanded'] : false, '$bbcode' => x($x, 'bbcode') ? $x['bbcode'] : false));
    if ($popup === true) {
        $o = '<div id="jot-popup" style="display:none">' . $o . '</div>';
    }
    return $o;
}
开发者ID:einervonvielen,项目名称:hubzilla,代码行数:90,代码来源:conversation.php

示例12: q

    // already logged in user returning
    if (x($_SESSION, 'uid') || x($_SESSION, 'account_id')) {
        App::$session->return_check();
        $r = q("select * from account where account_id = %d limit 1", intval($_SESSION['account_id']));
        if ($r && ($r[0]['account_flags'] == ACCOUNT_OK || $r[0]['account_flags'] == ACCOUNT_UNVERIFIED)) {
            App::$account = $r[0];
            $login_refresh = false;
            if (!x($_SESSION, 'last_login_date')) {
                $_SESSION['last_login_date'] = datetime_convert('UTC', 'UTC');
            }
            if (strcmp(datetime_convert('UTC', 'UTC', 'now - 12 hours'), $_SESSION['last_login_date']) > 0) {
                $_SESSION['last_login_date'] = datetime_convert();
                App::$session->extend_cookie();
                $login_refresh = true;
            }
            $ch = $_SESSION['uid'] ? channelx_by_n($_SESSION['uid']) : null;
            authenticate_success($r[0], null, $ch, false, false, $login_refresh);
        } else {
            $_SESSION['account_id'] = 0;
            App::$session->nuke();
            goaway(z_root());
        }
    }
    // end logged in user returning
} else {
    if (isset($_SESSION)) {
        App::$session->nuke();
    }
    // handle a fresh login request
    if (x($_POST, 'password') && strlen($_POST['password'])) {
        $encrypted = hash('whirlpool', trim($_POST['password']));
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:31,代码来源:auth.php

示例13: menu_sync_packet

function menu_sync_packet($uid, $observer_hash, $menu_id, $delete = false)
{
    $r = menu_fetch_id($menu_id, $uid);
    $c = channelx_by_n($uid);
    if ($r) {
        $m = menu_fetch($r['menu_name'], $uid, $observer_hash);
        if ($m) {
            if ($delete) {
                $m['menu_delete'] = 1;
            }
            build_sync_packet($uid, array('menu' => array(menu_element($c, $m))));
        }
    }
}
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:14,代码来源:menu.php

示例14: htmlActionsPanel

 /**
  * @brief Creates a form to add new folders and upload files.
  *
  * @param \Sabre\DAV\INode $node
  * @param string &$output
  */
 public function htmlActionsPanel(DAV\INode $node, &$output, $path)
 {
     if (!$node instanceof DAV\ICollection) {
         return;
     }
     // We also know fairly certain that if an object is a non-extended
     // SimpleCollection, we won't need to show the panel either.
     if (get_class($node) === 'Sabre\\DAV\\SimpleCollection') {
         return;
     }
     require_once 'include/acl_selectors.php';
     $aclselect = null;
     $lockstate = '';
     if ($this->auth->owner_id) {
         $channel = channelx_by_n($this->auth->owner_id);
         if ($channel) {
             $acl = new \Zotlabs\Access\AccessList($channel);
             $channel_acl = $acl->get();
             $lockstate = $acl->is_private() ? 'lock' : 'unlock';
             $aclselect = local_channel() == $this->auth->owner_id ? populate_acl($channel_acl, false, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_storage')) : '';
         }
     }
     // Storage and quota for the account (all channels of the owner of this directory)!
     $limit = engr_units_to_bytes(service_class_fetch($owner, 'attach_upload_limit'));
     $r = q("SELECT SUM(filesize) AS total FROM attach WHERE aid = %d", intval($this->auth->channel_account_id));
     $used = $r[0]['total'];
     if ($used) {
         $quotaDesc = t('You are using %1$s of your available file storage.');
         $quotaDesc = sprintf($quotaDesc, userReadableSize($used));
     }
     if ($limit && $used) {
         $quotaDesc = t('You are using %1$s of %2$s available file storage. (%3$s&#37;)');
         $quotaDesc = sprintf($quotaDesc, userReadableSize($used), userReadableSize($limit), round($used / $limit, 1) * 100);
     }
     // prepare quota for template
     $quota = array();
     $quota['used'] = $used;
     $quota['limit'] = $limit;
     $quota['desc'] = $quotaDesc;
     $quota['warning'] = $limit && round($used / $limit, 1) * 100 >= 90 ? t('WARNING:') : '';
     // 10485760 bytes = 100MB
     $path = trim(str_replace('cloud/' . $this->auth->owner_nick, '', $path), '/');
     $output .= replace_macros(get_markup_template('cloud_actionspanel.tpl'), array('$folder_header' => t('Create new folder'), '$folder_submit' => t('Create'), '$upload_header' => t('Upload file'), '$upload_submit' => t('Upload'), '$quota' => $quota, '$channick' => $this->auth->owner_nick, '$aclselect' => $aclselect, '$allow_cid' => acl2json($channel_acl['allow_cid']), '$allow_gid' => acl2json($channel_acl['allow_gid']), '$deny_cid' => acl2json($channel_acl['deny_cid']), '$deny_gid' => acl2json($channel_acl['deny_gid']), '$lockstate' => $lockstate, '$return_url' => \App::$cmd, '$path' => $path, '$folder' => find_folder_hash_by_path($this->auth->owner_id, $path), '$dragdroptext' => t('Drop files here to immediately upload')));
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:50,代码来源:Browser.php

示例15: handle_feed

function handle_feed($uid, $abook_id, $url)
{
    require_once 'include/Contact.php';
    $channel = channelx_by_n($uid);
    if (!$channel) {
        return;
    }
    $x = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_channel = %d limit 1", dbesc($abook_id), intval($uid));
    $recurse = 0;
    $z = z_fetch_url($url, false, $recurse, array('novalidate' => true));
    //logger('handle_feed:' . print_r($z,true));
    if ($z['success']) {
        consume_feed($z['body'], $channel, $x[0], 0);
        consume_feed($z['body'], $channel, $x[0], 1);
    }
}
开发者ID:einervonvielen,项目名称:redmatrix,代码行数:16,代码来源:items.php


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