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

PHP proc_run函数代码示例

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

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



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

示例1: post

 function post()
 {
     if (!local_channel()) {
         return;
     }
     if (\App::$argc != 2) {
         return;
     }
     $contact_id = intval(\App::$argv[1]);
     $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($contact_id), intval(local_channel()));
     if (!count($r)) {
         notice(t('Contact not found.') . EOL);
         return;
     }
     $contact = $r[0];
     $new_contact = intval($_POST['suggest']);
     $hash = random_string();
     $note = escape_tags(trim($_POST['note']));
     if ($new_contact) {
         $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($new_contact), intval(local_channel()));
         if (count($r)) {
             $x = q("INSERT INTO `fsuggest` ( `uid`,`cid`,`name`,`url`,`request`,`photo`,`note`,`created`)\n\t\t\t\t\tVALUES ( %d, %d, '%s','%s','%s','%s','%s','%s')", intval(local_channel()), intval($contact_id), dbesc($r[0]['name']), dbesc($r[0]['url']), dbesc($r[0]['request']), dbesc($r[0]['photo']), dbesc($hash), dbesc(datetime_convert()));
             $r = q("SELECT `id` FROM `fsuggest` WHERE `note` = '%s' AND `uid` = %d LIMIT 1", dbesc($hash), intval(local_channel()));
             if (count($r)) {
                 $fsuggest_id = $r[0]['id'];
                 q("UPDATE `fsuggest` SET `note` = '%s' WHERE `id` = %d AND `uid` = %d", dbesc($note), intval($fsuggest_id), intval(local_channel()));
                 proc_run('php', 'include/notifier.php', 'suggest', $fsuggest_id);
             }
             info(t('Friend suggestion sent.') . EOL);
         }
     }
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:32,代码来源:Fsuggest.php


示例2: user_allow

function user_allow($hash)
{
    $a = get_app();
    $register = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1", dbesc($hash));
    if (!count($register)) {
        return false;
    }
    $user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($register[0]['uid']));
    if (!count($user)) {
        killme();
    }
    $r = q("DELETE FROM `register` WHERE `hash` = '%s'", dbesc($register[0]['hash']));
    $r = q("UPDATE `user` SET `blocked` = 0, `verified` = 1 WHERE `uid` = %d", intval($register[0]['uid']));
    $r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default` = 1", intval($user[0]['uid']));
    if (count($r) && $r[0]['net-publish']) {
        $url = $a->get_baseurl() . '/profile/' . $user[0]['nickname'];
        if ($url && strlen(get_config('system', 'directory'))) {
            proc_run('php', "include/directory.php", "{$url}");
        }
    }
    push_lang($register[0]['language']);
    send_register_open_eml($user[0]['email'], $a->config['sitename'], $a->get_baseurl(), $user[0]['username'], $register[0]['password']);
    pop_lang();
    if ($res) {
        info(t('Account approved.') . EOL);
        return true;
    }
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:28,代码来源:regmod.php


示例3: user_allow

function user_allow($hash)
{
    $a = get_app();
    $register = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1", dbesc($hash));
    if (!count($register)) {
        return false;
    }
    $user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($register[0]['uid']));
    if (!count($user)) {
        killme();
    }
    $r = q("DELETE FROM `register` WHERE `hash` = '%s' LIMIT 1", dbesc($register[0]['hash']));
    $r = q("UPDATE `user` SET `blocked` = 0, `verified` = 1 WHERE `uid` = %d LIMIT 1", intval($register[0]['uid']));
    $r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default` = 1", intval($user[0]['uid']));
    if (count($r) && $r[0]['net-publish']) {
        $url = $a->get_baseurl() . '/profile/' . $user[0]['nickname'];
        if ($url && strlen(get_config('system', 'directory_submit_url'))) {
            proc_run('php', "include/directory.php", "{$url}");
        }
    }
    push_lang($register[0]['language']);
    $email_tpl = get_intltext_template("register_open_eml.tpl");
    $email_tpl = replace_macros($email_tpl, array('$sitename' => $a->config['sitename'], '$siteurl' => $a->get_baseurl(), '$username' => $user[0]['username'], '$email' => $user[0]['email'], '$password' => $register[0]['password'], '$uid' => $user[0]['uid']));
    $res = mail($user[0]['email'], sprintf(t('Registration details for %s'), $a->config['sitename']), $email_tpl, 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-transfer-encoding: 8bit');
    pop_lang();
    if ($res) {
        info(t('Account approved.') . EOL);
        return true;
    }
}
开发者ID:robhell,项目名称:friendica,代码行数:30,代码来源:regmod.php


示例4: follow_init

function follow_init(&$a)
{
    if (!local_channel()) {
        return;
    }
    $uid = local_channel();
    $url = notags(trim($_REQUEST['url']));
    $return_url = $_SESSION['return_url'];
    $confirm = intval($_REQUEST['confirm']);
    $result = new_contact($uid, $url, $a->get_channel(), true, $confirm);
    if ($result['success'] == false) {
        if ($result['message']) {
            notice($result['message']);
        }
        goaway($return_url);
    }
    info(t('Channel added.') . EOL);
    $clone = array();
    foreach ($result['abook'] as $k => $v) {
        if (strpos($k, 'abook_') === 0) {
            $clone[$k] = $v;
        }
    }
    unset($clone['abook_id']);
    unset($clone['abook_account']);
    unset($clone['abook_channel']);
    build_sync_packet(0, array('abook' => array($clone)));
    // If we can view their stream, pull in some posts
    if ($result['abook']['abook_their_perms'] & PERMS_R_STREAM || $result['abook']['xchan_network'] === 'rss') {
        proc_run('php', 'include/onepoll.php', $result['abook']['abook_id']);
    }
    goaway(z_root() . '/connedit/' . $result['abook']['abook_id'] . '?f=&follow=1');
}
开发者ID:msooon,项目名称:hubzilla,代码行数:33,代码来源:follow.php


示例5: directory_run

/**
 * @brief
 *
 * @param array $argv
 * @param array $argc
 */
function directory_run($argv, $argc)
{
    cli_startup();
    if ($argc < 2) {
        return;
    }
    $force = false;
    $pushall = true;
    if ($argc > 2) {
        if ($argv[2] === 'force') {
            $force = true;
        }
        if ($argv[2] === 'nopush') {
            $pushall = false;
        }
    }
    logger('directory update', LOGGER_DEBUG);
    $dirmode = get_config('system', 'directory_mode');
    if ($dirmode === false) {
        $dirmode = DIRECTORY_MODE_NORMAL;
    }
    $x = q("select * from channel where channel_id = %d limit 1", intval($argv[1]));
    if (!$x) {
        return;
    }
    $channel = $x[0];
    if ($dirmode != DIRECTORY_MODE_NORMAL) {
        // this is an in-memory update and we don't need to send a network packet.
        local_dir_update($argv[1], $force);
        q("update channel set channel_dirdate = '%s' where channel_id = %d", dbesc(datetime_convert()), intval($channel['channel_id']));
        // Now update all the connections
        if ($pushall) {
            proc_run('php', 'include/notifier.php', 'refresh_all', $channel['channel_id']);
        }
        return;
    }
    // otherwise send the changes upstream
    $directory = find_upstream_directory($dirmode);
    $url = $directory['url'] . '/post';
    // ensure the upstream directory is updated
    $packet = zot_build_packet($channel, $force ? 'force_refresh' : 'refresh');
    $z = zot_zot($url, $packet);
    // re-queue if unsuccessful
    if (!$z['success']) {
        /** @FIXME we aren't updating channel_dirdate if we have to queue
         * the directory packet. That means we'll try again on the next poll run.
         */
        $hash = random_string();
        q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) \n\t\t\tvalues ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )", dbesc($hash), intval($channel['channel_account_id']), intval($channel['channel_id']), dbesc('zot'), dbesc($url), intval(1), dbesc(datetime_convert()), dbesc(datetime_convert()), dbesc($packet), dbesc(''));
    } else {
        q("update channel set channel_dirdate = '%s' where channel_id = %d", dbesc(datetime_convert()), intval($channel['channel_id']));
    }
    // Now update all the connections
    if ($pushall) {
        proc_run('php', 'include/notifier.php', 'refresh_all', $channel['channel_id']);
    }
}
开发者ID:msooon,项目名称:hubzilla,代码行数:63,代码来源:directory.php


示例6: migrator_update_directory

function migrator_update_directory(&$a, $channel_hash)
{
    $channel_id = get_channel_id($channel_hash);
    if (!$channel_id) {
        json_error_die(404, 'Not Found', 'No such channel ' . $channel_hash);
    }
    proc_run('php', 'include/notifier.php', 'location', $channel_id);
    proc_run('php', 'include/directory.php', $channel_id);
    json_return_and_die(array("status" => 'OK', 'channel_hash' => $channel_hash, 'channel_id' => $channel_id));
}
开发者ID:kenrestivo,项目名称:migrator-plugin,代码行数:10,代码来源:migrator_import.php


示例7: poormancron_hook

function poormancron_hook(&$a, &$b)
{
    $now = time();
    $lastupdate = get_config('poormancron', 'lastupdate');
    // 300 secs, 5 mins
    if (!$lastupdate || $now - $lastupdate > 300) {
        set_config('poormancron', 'lastupdate', $now);
        proc_run('php', "include/poller.php");
    }
}
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:10,代码来源:poormancron.php


示例8: cronhooks_run

function cronhooks_run(&$argv, &$argc)
{
    global $a, $db;
    if (is_null($a)) {
        $a = new App();
    }
    if (is_null($db)) {
        @(include ".htconfig.php");
        require_once "include/dba.php";
        $db = new dba($db_host, $db_user, $db_pass, $db_data);
        unset($db_host, $db_user, $db_pass, $db_data);
    }
    require_once 'include/session.php';
    require_once 'include/datetime.php';
    require_once 'include/pidfile.php';
    load_config('config');
    load_config('system');
    $maxsysload = intval(get_config('system', 'maxloadavg'));
    if ($maxsysload < 1) {
        $maxsysload = 50;
    }
    if (function_exists('sys_getloadavg')) {
        $load = sys_getloadavg();
        if (intval($load[0]) > $maxsysload) {
            logger('system: load ' . $load . ' too high. Poller deferred to next scheduled run.');
            return;
        }
    }
    $lockpath = get_lockpath();
    if ($lockpath != '') {
        $pidfile = new pidfile($lockpath, 'cronhooks');
        if ($pidfile->is_already_running()) {
            logger("cronhooks: Already running");
            if ($pidfile->running_time() > 19 * 60) {
                $pidfile->kill();
                logger("cronhooks: killed stale process");
                // Calling a new instance
                proc_run('php', 'include/cronhooks.php');
            }
            exit;
        }
    }
    $a->set_baseurl(get_config('system', 'url'));
    load_hooks();
    logger('cronhooks: start');
    $d = datetime_convert();
    call_hooks('cron', $d);
    logger('cronhooks: end');
    return;
}
开发者ID:jzacman,项目名称:friendica,代码行数:50,代码来源:cronhooks.php


示例9: frphotos_init

function frphotos_init(&$a)
{
    if (!local_channel()) {
        return;
    }
    if (intval(get_pconfig(local_channel(), 'frphotos', 'complete'))) {
        return;
    }
    $channel = $a->get_channel();
    $fr_server = $_REQUEST['fr_server'];
    $fr_username = $_REQUEST['fr_username'];
    $fr_password = $_REQUEST['fr_password'];
    $cookies = 'store/[data]/frphoto_cookie_' . $channel['channel_address'];
    if ($fr_server && $fr_username && $fr_password) {
        $ch = curl_init($fr_server . '/api/friendica/photos/list');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies);
        curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies);
        curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
        curl_setopt($ch, CURLOPT_USERPWD, $fr_username . ':' . $fr_password);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($ch, CURLOPT_USERAGENT, 'Hubzilla');
        $output = curl_exec($ch);
        curl_close($ch);
        $j = json_decode($output, true);
        //		echo print_r($j,true);
        $total = 0;
        if (count($j)) {
            foreach ($j as $jj) {
                $r = q("select uid from photo where resource_id = '%s' and uid = %d limit 1", dbesc($jj), intval($channel['channel_id']));
                if ($r) {
                    continue;
                }
                $total++;
                proc_run('php', 'addon/frphotos/frphotohelper.php', $jj, $channel['channel_address'], urlencode($fr_server));
                sleep(3);
            }
        }
        if ($total) {
            set_pconfig(local_channel(), 'frphotos', 'complete', '1');
        }
        @unlink($cookies);
        goaway(z_root() . '/photos/' . $channel['channel_address']);
    }
}
开发者ID:royalterra,项目名称:hubzilla-addons,代码行数:46,代码来源:frphotos.php


示例10: locs_post

/** @file */
function locs_post(&$a)
{
    if (!local_channel()) {
        return;
    }
    $channel = $a->get_channel();
    if ($_REQUEST['primary']) {
        $hubloc_id = intval($_REQUEST['primary']);
        if ($hubloc_id) {
            $r = q("select hubloc_id from hubloc where hubloc_id = %d and hubloc_hash = '%s' limit 1", intval($hubloc_id), dbesc($channel['channel_hash']));
            if (!$r) {
                notice(t('Location not found.') . EOL);
                return;
            }
            $r = q("update hubloc set hubloc_primary = 0 where hubloc_primary = 1 and hubloc_hash = '%s' ", dbesc($channel['channel_hash']));
            $r = q("update hubloc set hubloc_primary = 1 where hubloc_id = %d and hubloc_hash = '%s'", intval($hubloc_id), dbesc($channel['channel_hash']));
            proc_run('php', 'include/notifier.php', 'location', $channel['channel_id']);
            return;
        }
    }
    if ($_REQUEST['drop']) {
        $hubloc_id = intval($_REQUEST['drop']);
        if ($hubloc_id) {
            $r = q("select * from hubloc where hubloc_id = %d and hubloc_url != '%s' and hubloc_hash = '%s' limit 1", intval($hubloc_id), dbesc(z_root()), dbesc($channel['channel_hash']));
            if (!$r) {
                notice(t('Location not found.') . EOL);
                return;
            }
            if (intval($r[0]['hubloc_primary'])) {
                $x = q("select hubloc_id from hubloc where hubloc_primary = 1 and hubloc_hash = '%s'", dbesc($channel['channel_hash']));
                if (!$x) {
                    notice(t('Location lookup failed.'));
                    return;
                }
                if (count($x) == 1) {
                    notice(t('Please select another location to become primary before removing the primary location.') . EOL);
                    return;
                }
            }
            $r = q("update hubloc set hubloc_deleted = 1 where hubloc_id = %d and hubloc_hash = '%s'", intval($hubloc_id), dbesc($channel['channel_hash']));
            proc_run('php', 'include/notifier.php', 'location', $channel['channel_id']);
            return;
        }
    }
}
开发者ID:kenrestivo,项目名称:hubzilla,代码行数:46,代码来源:locs.php


示例11: user_remove

function user_remove($uid)
{
    if (!$uid) {
        return;
    }
    $a = get_app();
    logger('Removing user: ' . $uid);
    $r = q("select * from user where uid = %d limit 1", intval($uid));
    call_hooks('remove_user', $r[0]);
    // save username (actually the nickname as it is guaranteed
    // unique), so it cannot be re-registered in the future.
    q("insert into userd ( username ) values ( '%s' )", $r[0]['nickname']);
    // don't delete yet, will be done later when contacts have deleted my stuff
    // q("DELETE FROM `contact` WHERE `uid` = %d", intval($uid));
    q("DELETE FROM `gcign` WHERE `uid` = %d", intval($uid));
    q("DELETE FROM `group` WHERE `uid` = %d", intval($uid));
    q("DELETE FROM `group_member` WHERE `uid` = %d", intval($uid));
    q("DELETE FROM `intro` WHERE `uid` = %d", intval($uid));
    q("DELETE FROM `event` WHERE `uid` = %d", intval($uid));
    q("DELETE FROM `item` WHERE `uid` = %d", intval($uid));
    q("DELETE FROM `item_id` WHERE `uid` = %d", intval($uid));
    q("DELETE FROM `mail` WHERE `uid` = %d", intval($uid));
    q("DELETE FROM `mailacct` WHERE `uid` = %d", intval($uid));
    q("DELETE FROM `manage` WHERE `uid` = %d", intval($uid));
    q("DELETE FROM `notify` WHERE `uid` = %d", intval($uid));
    q("DELETE FROM `photo` WHERE `uid` = %d", intval($uid));
    q("DELETE FROM `attach` WHERE `uid` = %d", intval($uid));
    q("DELETE FROM `profile` WHERE `uid` = %d", intval($uid));
    q("DELETE FROM `profile_check` WHERE `uid` = %d", intval($uid));
    q("DELETE FROM `pconfig` WHERE `uid` = %d", intval($uid));
    q("DELETE FROM `search` WHERE `uid` = %d", intval($uid));
    q("DELETE FROM `spam` WHERE `uid` = %d", intval($uid));
    // don't delete yet, will be done later when contacts have deleted my stuff
    // q("DELETE FROM `user` WHERE `uid` = %d", intval($uid));
    q("UPDATE `user` SET `account_removed` = 1, `account_expires_on` = UTC_TIMESTAMP() WHERE `uid` = %d", intval($uid));
    proc_run('php', "include/notifier.php", "removeme", $uid);
    // Send an update to the directory
    proc_run('php', "include/directory.php", $r[0]['url']);
    if ($uid == local_user()) {
        unset($_SESSION['authenticated']);
        unset($_SESSION['uid']);
        goaway($a->get_baseurl());
    }
}
开发者ID:strk,项目名称:friendica,代码行数:44,代码来源:Contact.php


示例12: remove_obsolete_hublocs

function remove_obsolete_hublocs()
{
    logger('remove_obsolete_hublocs', LOGGER_DEBUG);
    // Get rid of any hublocs which are ours but aren't valid anymore -
    // e.g. they point to a different and perhaps transient URL that we aren't using.
    // I need to stress that this shouldn't happen. fix_system_urls() fixes hublocs
    // when it discovers the URL has changed. So it's unclear how we could end up
    // with URLs pointing to the old site name. But it happens. This may be an artifact
    // of an old bug or maybe a regression in some newer code. In any event, they
    // mess up communications and we have to take action if we find any.
    // First make sure we have any hublocs (at all) with this URL and sitekey.
    // We don't want to perform this operation while somebody is in the process
    // of renaming their hub or installing certs.
    $r = q("select hubloc_id from hubloc where hubloc_url = '%s' and hubloc_sitekey = '%s'", dbesc(z_root()), dbesc(get_config('system', 'pubkey')));
    if (!$r || !count($r)) {
        return;
    }
    $channels = array();
    // Good. We have at least one *valid* hubloc.
    // Do we have any invalid ones?
    $r = q("select hubloc_id from hubloc where hubloc_sitekey = '%s' and hubloc_url != '%s'", dbesc(get_config('system', 'pubkey')), dbesc(z_root()));
    $p = q("select hubloc_id from hubloc where hubloc_sitekey != '%s' and hubloc_url = '%s'", dbesc(get_config('system', 'pubkey')), dbesc(z_root()));
    if (is_array($r) && is_array($p)) {
        $r = array_merge($r, $p);
    }
    if (!$r) {
        return;
    }
    // We've got invalid hublocs. Get rid of them.
    logger('remove_obsolete_hublocs: removing ' . count($r) . ' hublocs.');
    $interval = get_config('system', 'delivery_interval') !== false ? intval(get_config('system', 'delivery_interval')) : 2;
    foreach ($r as $rr) {
        q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_id = %d", intval(HUBLOC_FLAGS_DELETED), intval($rr['hubloc_id']));
        $x = q("select channel_id from channel where channel_hash = '%s' limit 1", dbesc($rr['hubloc_hash']));
        if ($x) {
            proc_run('php', 'include/notifier.php', 'location', $x[0]['channel_id']);
            if ($interval) {
                @time_sleep_until(microtime(true) + (double) $interval);
            }
        }
    }
}
开发者ID:redmatrix,项目名称:red,代码行数:42,代码来源:hubloc.php


示例13: pumpio_sync_run

function pumpio_sync_run(&$argv, &$argc)
{
    global $a, $db;
    if (is_null($a)) {
        $a = new App();
    }
    if (is_null($db)) {
        @(include ".htconfig.php");
        require_once "include/dba.php";
        $db = new dba($db_host, $db_user, $db_pass, $db_data);
        unset($db_host, $db_user, $db_pass, $db_data);
    }
    require_once "addon/pumpio/pumpio.php";
    require_once "include/pidfile.php";
    $maxsysload = intval(get_config('system', 'maxloadavg'));
    if ($maxsysload < 1) {
        $maxsysload = 50;
    }
    if (function_exists('sys_getloadavg')) {
        $load = sys_getloadavg();
        if (intval($load[0]) > $maxsysload) {
            logger('system: load ' . $load[0] . ' too high. Pumpio sync deferred to next scheduled run.');
            return;
        }
    }
    $lockpath = get_lockpath();
    if ($lockpath != '') {
        $pidfile = new pidfile($lockpath, 'pumpio_sync');
        if ($pidfile->is_already_running()) {
            logger("Already running");
            if ($pidfile->running_time() > 9 * 60) {
                $pidfile->kill();
                logger("killed stale process");
                // Calling a new instance
                proc_run('php', 'addon/pumpio/pumpio_sync.php');
            }
            exit;
        }
    }
    pumpio_sync($a);
}
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:41,代码来源:pumpio_sync.php


示例14: init

 function init()
 {
     if (!local_channel()) {
         return;
     }
     $uid = local_channel();
     $url = notags(trim($_REQUEST['url']));
     $return_url = $_SESSION['return_url'];
     $confirm = intval($_REQUEST['confirm']);
     $channel = \App::get_channel();
     // Warning: Do not edit the following line. The first symbol is UTF-8 &#65312;
     $url = str_replace('@', '@', $url);
     $result = new_contact($uid, $url, $channel, true, $confirm);
     if ($result['success'] == false) {
         if ($result['message']) {
             notice($result['message']);
         }
         goaway($return_url);
     }
     info(t('Channel added.') . EOL);
     $clone = array();
     foreach ($result['abook'] as $k => $v) {
         if (strpos($k, 'abook_') === 0) {
             $clone[$k] = $v;
         }
     }
     unset($clone['abook_id']);
     unset($clone['abook_account']);
     unset($clone['abook_channel']);
     $abconfig = load_abconfig($channel['channel_hash'], $clone['abook_xchan']);
     if ($abconfig) {
         $clone['abconfig'] = $abconfig;
     }
     build_sync_packet(0, array('abook' => array($clone)));
     // If we can view their stream, pull in some posts
     if ($result['abook']['abook_their_perms'] & PERMS_R_STREAM || $result['abook']['xchan_network'] === 'rss') {
         proc_run('php', 'include/onepoll.php', $result['abook']['abook_id']);
     }
     goaway(z_root() . '/connedit/' . $result['abook']['abook_id'] . '?f=&follow=1');
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:40,代码来源:Follow.php


示例15: pubsubpublish_run

function pubsubpublish_run(&$argv, &$argc)
{
    global $a, $db;
    if (is_null($a)) {
        $a = new App();
    }
    if (is_null($db)) {
        @(include ".htconfig.php");
        require_once "include/dba.php";
        $db = new dba($db_host, $db_user, $db_pass, $db_data);
        unset($db_host, $db_user, $db_pass, $db_data);
    }
    require_once 'include/items.php';
    require_once 'include/pidfile.php';
    load_config('config');
    load_config('system');
    $lockpath = get_lockpath();
    if ($lockpath != '') {
        $pidfile = new pidfile($lockpath, 'pubsubpublish');
        if ($pidfile->is_already_running()) {
            logger("Already running");
            if ($pidfile->running_time() > 9 * 60) {
                $pidfile->kill();
                logger("killed stale process");
                // Calling a new instance
                proc_run('php', "include/pubsubpublish.php");
            }
            return;
        }
    }
    $a->set_baseurl(get_config('system', 'url'));
    load_hooks();
    if ($argc > 1) {
        $pubsubpublish_id = intval($argv[1]);
    } else {
        $pubsubpublish_id = 0;
    }
    handle_pubsubhubbub();
    return;
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:40,代码来源:pubsubpublish.php


示例16: prate_post

function prate_post(&$a)
{
    if (!local_channel()) {
        return;
    }
    $channel = App::get_channel();
    $target = trim($_REQUEST['target']);
    if (!$target) {
        return;
    }
    if ($target === $channel['channel_hash']) {
        return;
    }
    $rating = intval($_POST['rating']);
    if ($rating < -10) {
        $rating = -10;
    }
    if ($rating > 10) {
        $rating = 10;
    }
    $rating_text = trim(escape_tags($_REQUEST['rating_text']));
    $signed = $target . '.' . $rating . '.' . $rating_text;
    $sig = base64url_encode(rsa_sign($signed, $channel['channel_prvkey']));
    $z = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 1 limit 1", dbesc($channel['channel_hash']), dbesc($target));
    if ($z) {
        $record = $z[0]['xlink_id'];
        $w = q("update xlink set xlink_rating = '%d', xlink_rating_text = '%s', xlink_sig = '%s', xlink_updated = '%s'\n\t\t\twhere xlink_id = %d", intval($rating), dbesc($rating_text), dbesc($sig), dbesc(datetime_convert()), intval($record));
    } else {
        $w = q("insert into xlink ( xlink_xchan, xlink_link, xlink_rating, xlink_rating_text, xlink_sig, xlink_updated, xlink_static ) values ( '%s', '%s', %d, '%s', '%s', '%s', 1 ) ", dbesc($channel['channel_hash']), dbesc($target), intval($rating), dbesc($rating_text), dbesc($sig), dbesc(datetime_convert()));
        $z = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 1 limit 1", dbesc($channel['channel_hash']), dbesc($orig_record[0]['abook_xchan']));
        if ($z) {
            $record = $z[0]['xlink_id'];
        }
    }
    if ($record) {
        proc_run('php', 'include/ratenotif.php', 'rating', $record);
    }
    json_return_and_die(array('result' => true));
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:39,代码来源:prate.php


示例17: locs_post

/** @file */
function locs_post(&$a)
{
    if (!local_channel()) {
        return;
    }
    $channel = $a->get_channel();
    if ($_REQUEST['primary']) {
        $hubloc_id = intval($_REQUEST['primary']);
        if ($hubloc_id) {
            $r = q("select hubloc_id from hubloc where hubloc_id = %d and hubloc_hash = '%s' limit 1", intval($hubloc_id), dbesc($channel['channel_hash']));
            if (!$r) {
                notice(t('Location not found.') . EOL);
                return;
            }
            $r = q("update hubloc set hubloc_flags = (hubloc_flags - %d) where (hubloc_flags & %d)>0 and hubloc_hash = '%s' ", intval(HUBLOC_FLAGS_PRIMARY), intval(HUBLOC_FLAGS_PRIMARY), dbesc($channel['channel_hash']));
            $r = q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_id = %d and hubloc_hash = '%s'", intval(HUBLOC_FLAGS_PRIMARY), intval($hubloc_id), dbesc($channel['channel_hash']));
            proc_run('php', 'include/notifier.php', 'location', $channel['channel_id']);
            return;
        }
    }
    if ($_REQUEST['drop']) {
        $hubloc_id = intval($_REQUEST['drop']);
        if ($hubloc_id) {
            $r = q("select hubloc_id, hubloc_flags from hubloc where hubloc_id = %d and hubloc_url != '%s' and hubloc_hash = '%s' limit 1", intval($hubloc_id), dbesc(z_root()), dbesc($channel['channel_hash']));
            if (!$r) {
                notice(t('Location not found.') . EOL);
                return;
            }
            if ($r[0]['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) {
                notice(t('Primary location cannot be removed.') . EOL);
                return;
            }
            $r = q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_id = %d and hubloc_hash = '%s'", intval(HUBLOC_FLAGS_DELETED), intval($hubloc_id), dbesc($channel['channel_hash']));
            proc_run('php', 'include/notifier.php', 'location', $channel['channel_id']);
            return;
        }
    }
}
开发者ID:redmatrix,项目名称:red,代码行数:39,代码来源:locs.php


示例18: follow_init

function follow_init(&$a)
{
    if (!local_channel()) {
        return;
    }
    $uid = local_channel();
    $url = notags(trim($_REQUEST['url']));
    $return_url = $_SESSION['return_url'];
    $confirm = intval($_REQUEST['confirm']);
    $result = new_contact($uid, $url, $a->get_channel(), true, $confirm);
    if ($result['success'] == false) {
        if ($result['message']) {
            notice($result['message']);
        }
        goaway($return_url);
    }
    info(t('Channel added.') . EOL);
    // If we can view their stream, pull in some posts
    if ($result['abook']['abook_their_perms'] & PERMS_R_STREAM || $result['abook']['xchan_network'] === 'rss') {
        proc_run('php', 'include/onepoll.php', $result['abook']['abook_id']);
    }
    goaway(z_root() . '/connedit/' . $result['abook']['abook_id'] . '?f=&follow=1');
}
开发者ID:redmatrix,项目名称:red,代码行数:23,代码来源:follow.php


示例19: connect_post

function connect_post(&$a)
{
    if (!array_key_exists('channel', $a->data)) {
        return;
    }
    $edit = local_user() && local_user() == $a->data['channel']['channel_id'] ? true : false;
    if ($edit) {
        $has_premium = $a->data['channel']['channel_pageflags'] & PAGE_PREMIUM ? 1 : 0;
        $premium = $_POST['premium'] ? intval($_POST['premium']) : 0;
        $text = escape_tags($_POST['text']);
        if ($has_premium != $premium) {
            $r = q("update channel set channel_pageflags = ( channel_pageflags ^ %d ) where channel_id = %d limit 1", intval(PAGE_PREMIUM), intval(local_user()));
            proc_run('php', 'include/notifier.php', 'refresh_all', $a->data['channel']['channel_id']);
        }
        set_pconfig($a->data['channel']['channel_id'], 'system', 'selltext', $text);
        // reload the page completely to get fresh data
        goaway(z_root() . '/' . $a->query_string);
    }
    $url = '';
    $observer = $a->get_observer();
    if ($observer && $_POST['submit'] === t('Continue')) {
        if ($observer['xchan_follow']) {
            $url = sprintf($observer['xchan_follow'], urlencode($a->data['channel']['channel_address'] . '@' . $a->get_hostname()));
        }
        if (!$url) {
            $r = q("select * from hubloc where hubloc_hash = '%s' order by hubloc_id desc limit 1", dbesc($observer['xchan_hash']));
            if ($r) {
                $url = $r[0]['hubloc_url'] . '/follow?f=&url=' . urlencode($a->data['channel']['channel_address'] . '@' . $a->get_hostname());
            }
        }
    }
    if ($url) {
        goaway($url . '&confirm=1');
    } else {
        notice('Unable to connect to your home hub location.');
    }
}
开发者ID:Mauru,项目名称:red,代码行数:37,代码来源:connect.php


示例20: get

 function get()
 {
     if (!local_channel()) {
         notice(t('Permission denied.') . EOL);
         return;
     }
     $channel = \App::get_channel();
     if ($_REQUEST['sync']) {
         proc_run('php', 'include/notifier.php', 'location', $channel['channel_id']);
         info(t('Syncing locations') . EOL);
         goaway(z_root() . '/locs');
     }
     $r = q("select * from hubloc where hubloc_hash = '%s'", dbesc($channel['channel_hash']));
     if (!$r) {
         notice(t('No locations found.') . EOL);
         return;
     }
     for ($x = 0; $x < count($r); $x++) {
         $r[$x]['primary'] = intval($r[$x]['hubloc_primary']) ? true : false;
         $r[$x]['deleted'] = intval($r[$x]['hubloc_deleted']) ? true : false;
     }
     $o = replace_macros(get_markup_template('locmanage.tpl'), array('$header' => t('Manage Channel Locations'), '$loc' => t('Location'), '$addr' => t('Address'), '$mkprm' => t('Primary'), '$drop' => t('Drop'), '$submit' => t('Submit'), '$sync' => t('Sync Now'), '$sync_text' => t('Please wait several minutes between consecutive operations.'), '$drop_text' => t('When possible, drop a location by logging into that website/hub and removing your channel.'), '$last_resort' => t('Use this form to drop the location if the hub is no longer operating.'), '$hubs' => $r));
     return $o;
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:24,代码来源:Locs.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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