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


PHP argc函数代码示例

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


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

示例1: init

 function init()
 {
     if (argc() != 3 || !in_array(argv(1), ['post', 'status_message', 'reshare'])) {
         http_status_exit(404, 'Not found');
     }
     $guid = argv(2);
     // Fetch the item
     $item = q("SELECT * from item where mid = '%s' and item_private = 0 and mid = parent_mid limit 1", dbesc($guid));
     if (!$item) {
         http_status_exit(404, 'Not found');
     }
     xchan_query($item);
     $item = fetch_post_tags($item, true);
     $channel = channelx_by_hash($item[0]['author_xchan']);
     if (!$channel) {
         $r = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($item[0]['author_xchan']));
         if ($r) {
             $url = $r[0]['xchan_url'];
             if (strpos($url, z_root()) === false) {
                 $m = parse_url($url);
                 goaway($m['scheme'] . '://' . $m['host'] . ($m['port'] ? ':' . $m['port'] : '') . '/fetch/' . argv(1) . '/' . argv(2));
             }
         }
         http_status_exit(404, 'Not found');
     }
     $status = diaspora_build_status($item[0], $channel);
     header("Content-type: application/magic-envelope+xml; charset=utf-8");
     echo diaspora_magic_env($channel, $status);
     killme();
 }
开发者ID:phellmes,项目名称:hubzilla-addons,代码行数:30,代码来源:Mod_Fetch.php

示例2: setup_init

/**
 * @brief Initialisation for the setup module.
 *
 * @param[in,out] App &$a
 */
function setup_init(&$a)
{
    // Ensure that if somebody hasn't read the install documentation and doesn't have all
    // the required modules or has a totally borked shared hosting provider and they can't
    // figure out what the hell is going on - that we at least spit out an error message which
    // we can inquire about when they write to tell us that our software doesn't work.
    // The worst thing we can do at this point is throw a white screen of death and rely on
    // them knowing about servers and php modules and logfiles enough so that we can guess
    // at the source of the problem. As ugly as it may be, we need to throw a technically worded
    // PHP error message in their face. Once installation is complete application errors will
    // throw a white screen because these error messages divulge information which can
    // potentially be useful to hackers.
    error_reporting(E_ERROR | E_WARNING | E_PARSE);
    ini_set('log_errors', '0');
    ini_set('display_errors', '1');
    // $baseurl/setup/testrwrite to test if rewite in .htaccess is working
    if (argc() == 2 && argv(1) == "testrewrite") {
        echo 'ok';
        killme();
    }
    global $install_wizard_pass;
    if (x($_POST, 'pass')) {
        $install_wizard_pass = intval($_POST['pass']);
    }
}
开发者ID:HaakonME,项目名称:redmatrix,代码行数:30,代码来源:setup.php

示例3: init

 function init()
 {
     if (argc() > 1) {
         $which = argv(1);
     } else {
         notice(t('Requested profile is not available.') . EOL);
         \App::$error = 404;
         return;
     }
     $profile = '';
     $channel = \App::get_channel();
     if (local_channel() && argc() > 2 && argv(2) === 'view') {
         $which = $channel['channel_address'];
         $profile = argv(1);
         $r = q("select profile_guid from profile where id = %d and uid = %d limit 1", intval($profile), intval(local_channel()));
         if (!$r) {
             $profile = '';
         }
         $profile = $r[0]['profile_guid'];
     }
     \App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n";
     if (!$profile) {
         $x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1", dbesc(argv(1)));
         if ($x) {
             \App::$profile = $x[0];
         }
     }
     profile_load($a, $which, $profile);
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:29,代码来源:Profile.php

示例4: uexport_init

function uexport_init(&$a)
{
    if (!local_channel()) {
        killme();
    }
    if (argc() > 1) {
        $channel = App::get_channel();
        require_once 'include/identity.php';
        if (argc() > 1 && intval(argv(1)) > 1900) {
            $year = intval(argv(1));
        }
        if (argc() > 2 && intval(argv(2)) > 0 && intval(argv(2)) <= 12) {
            $month = intval(argv(2));
        }
        header('content-type: application/octet_stream');
        header('content-disposition: attachment; filename="' . $channel['channel_address'] . ($year ? '-' . $year : '') . ($month ? '-' . $month : '') . '.json"');
        if ($year) {
            echo json_encode(identity_export_year(local_channel(), $year, $month));
            killme();
        }
        if (argc() > 1 && argv(1) === 'basic') {
            echo json_encode(identity_basic_export(local_channel()));
            killme();
        }
        // FIXME - this basically doesn't work in the wild with a channel more than a few months old due to memory and execution time limits.
        // It probably needs to be built at the CLI and offered to download as a tarball.  Maybe stored in the members dav.
        if (argc() > 1 && argv(1) === 'complete') {
            echo json_encode(identity_basic_export(local_channel(), true));
            killme();
        }
    }
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:32,代码来源:uexport.php

示例5: update_public_content

function update_public_content(&$a)
{
    $profile_uid = intval($_GET['p']) ? intval($_GET['p']) : -1;
    $load = argc() > 1 && argv(1) == 'load' ? 1 : 0;
    header("Content-type: text/html");
    echo "<!DOCTYPE html><html><body>\r\n";
    echo array_key_exists('msie', $_GET) && $_GET['msie'] == 1 ? '<div>' : '<section>';
    $text = public_content($a, $profile_uid, $load);
    $pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
    $replace = "<img\${1} dst=\"\${2}\"";
    //        $text = preg_replace($pattern, $replace, $text);
    /*
    		if(! $load) {
    			$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
        	    $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
            	$text = preg_replace($pattern, $replace, $text);
    	        $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
        	    $text = preg_replace($pattern, $replace, $text);
            	$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
    	        $text = preg_replace($pattern, $replace, $text);
        	    $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
            	$text = preg_replace($pattern, $replace, $text);
    		}
    */
    echo str_replace("\t", '       ', $text);
    echo array_key_exists('msie', $_GET) && $_GET['msie'] == 1 ? '</div>' : '</section>';
    echo "</body></html>\r\n";
    killme();
}
开发者ID:TamirAl,项目名称:hubzilla,代码行数:29,代码来源:update_public.php

示例6: pdledit_content

function pdledit_content(&$a)
{
    if (!local_channel()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    if (argc() > 1) {
        $module = 'mod_' . argv(1) . '.pdl';
    } else {
        $o .= '<h1>' . t('Edit System Page Description') . '</h1>';
        $files = glob('mod/*');
        if ($files) {
            foreach ($files as $f) {
                $name = basename($f, '.php');
                $x = theme_include('mod_' . $name . '.pdl');
                if ($x) {
                    $o .= '<a href="pdledit/' . $name . '" >' . $name . '</a><br />';
                }
            }
        }
        // list module pdl files
        return $o;
    }
    $t = get_pconfig(local_channel(), 'system', $module);
    if (!$t) {
        $t = file_get_contents(theme_include($module));
    }
    if (!$t) {
        notice(t('Layout not found.') . EOL);
        return '';
    }
    $o = replace_macros(get_markup_template('pdledit.tpl'), array('$header' => t('Edit System Page Description'), '$mname' => t('Module Name:'), '$help' => t('Layout Help'), '$module' => argv(1), '$content' => htmlspecialchars($t, ENT_COMPAT, 'UTF-8'), '$submit' => t('Submit')));
    return $o;
}
开发者ID:bashrc,项目名称:hubzilla,代码行数:34,代码来源:pdledit.php

示例7: init

 function init()
 {
     $result = null;
     $cmd = argc() > 1 ? argv(1) : '';
     // Provide a stored request for somebody desiring a connection
     // when they first need to register someplace. Once they've
     // created a channel, we'll try to revive the connection request
     // and process it.
     if ($_REQUEST['connect']) {
         $_SESSION['connect'] = $_REQUEST['connect'];
     }
     switch ($cmd) {
         case 'invite_check.json':
             $result = check_account_invite($_REQUEST['invite_code']);
             break;
         case 'email_check.json':
             $result = check_account_email($_REQUEST['email']);
             break;
         case 'password_check.json':
             $result = check_account_password($_REQUEST['password']);
             break;
         default:
             break;
     }
     if ($result) {
         json_return_and_die($result);
     }
 }
开发者ID:einervonvielen,项目名称:hubzilla,代码行数:28,代码来源:Register.php

示例8: get

 function get()
 {
     $args = '';
     $l = '';
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         if (isset($_POST['chord']) && strlen($_POST['chord'])) {
             $args .= escapeshellarg(ucfirst(trim($_POST['chord'])));
         }
         if (strlen($args) && isset($_POST['tuning']) && strlen($_POST['tuning'])) {
             $args .= ' ' . escapeshellarg($_POST['tuning']);
         }
         if (strlen($args) && isset($_POST['lefty'])) {
             $args .= ' lefty';
         }
     }
     if (!$_POST['chord'] && argc() > 1) {
         $_REQUEST['chord'] = argv(1);
         $args = escapeshellarg(ucfirst(basename(argv(1))));
     }
     $tunings = ['' => 'Em11 [Standard] (EADGBE)', 'openg' => 'G/D [Drop D] (DGDGBD)', 'opene' => 'Open E (EBEG#BE)', 'dadgad' => 'Dsus4 (DADGAD'];
     if (strlen($args)) {
         $chords = '<pre>';
         $chords .= shell_exec("addon/chords/chord " . $args);
         $chords .= '</pre>';
     }
     $p1 = t('This is a fairly comprehensive and complete guitar chord dictionary which will list most of the available ways to play a certain chord, starting from the base of the fingerboard up to a few frets beyond the twelfth fret (beyond which everything repeats). A couple of non-standard tunings are provided for the benefit of slide players, etc.');
     $p2 = t('Chord names start with a root note (A-G) and may include sharps (#) and flats (b). This software will parse most of the standard naming conventions such as maj, min, dim, sus(2 or 4), aug, with optional repeating elements.');
     $p3 = t('Valid examples include  A, A7, Am7, Amaj7, Amaj9, Ammaj7, Aadd4, Asus2Add4, E7b13b11 ...');
     $o .= replace_macros(get_markup_template('chords.tpl', 'addon/chords'), ['$header' => t('Guitar Chords'), '$desc' => t('The complete online chord dictionary'), '$p1' => $p1, '$p2' => $p2, '$p3' => $p3, '$chords' => $chords, '$tuning' => ['tuning', t('Tuning'), $_POST['tuning'], '', $tunings], '$chord' => ['chord', t('Chord name: example: Em7'), $_REQUEST['chord'], ''], '$lefty' => ['lefty', t('Show for left handed stringing'), $_POST['lefty'], ''], '$submit' => t('Submit')]);
     return $o;
 }
开发者ID:phellmes,项目名称:hubzilla-addons,代码行数:31,代码来源:Mod_Chords.php

示例9: get

 function get()
 {
     $profile_uid = intval($_GET['p']);
     if (!$profile_uid) {
         $profile_uid = -1;
     }
     $load = argc() > 1 && argv(1) == 'load' ? 1 : 0;
     header("Content-type: text/html");
     echo "<!DOCTYPE html><html><body>\r\n";
     echo $_GET['msie'] == 1 ? '<div>' : '<section>';
     $mod = new Display();
     $text = $mod->get($profile_uid, $load);
     $pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
     $replace = "<img\${1} dst=\"\${2}\"";
     //	$text = preg_replace($pattern, $replace, $text);
     /*
     	if(! $load) {
     		$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
             $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
             $text = preg_replace($pattern, $replace, $text);
             $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
             $text = preg_replace($pattern, $replace, $text);
             $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
             $text = preg_replace($pattern, $replace, $text);
             $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
             $text = preg_replace($pattern, $replace, $text);
     	}
     */
     echo str_replace("\t", '       ', $text);
     echo $_GET['msie'] == 1 ? '</div>' : '</section>';
     echo "</body></html>\r\n";
     //	logger('update_display: ' . $text);
     killme();
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:34,代码来源:Update_display.php

示例10: init

 function init()
 {
     $starred = 0;
     if (!local_channel()) {
         killme();
     }
     if (argc() > 1) {
         $message_id = intval(argv(1));
     }
     if (!$message_id) {
         killme();
     }
     $r = q("SELECT item_flags FROM item WHERE uid = %d AND id = %d LIMIT 1", intval(local_channel()), intval($message_id));
     if (!count($r)) {
         killme();
     }
     $item_starred = intval($r[0]['item_starred']) ? 0 : 1;
     $r = q("UPDATE item SET item_starred = %d WHERE uid = %d and id = %d", intval($item_starred), intval(local_channel()), intval($message_id));
     $r = q("select * from item where id = %d", intval($message_id));
     if ($r) {
         xchan_query($r);
         $sync_item = fetch_post_tags($r);
         build_sync_packet(local_channel(), ['item' => [encode_item($sync_item[0], true)]]);
     }
     header('Content-type: application/json');
     echo json_encode(array('result' => $item_starred));
     killme();
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:28,代码来源:Starred.php

示例11: regmod_content

function regmod_content(&$a)
{
    global $lang;
    $_SESSION['return_url'] = $a->cmd;
    if (!local_channel()) {
        info(t('Please login.') . EOL);
        $o .= '<br /><br />' . login($a->config['system']['register_policy'] == REGISTER_CLOSED ? 0 : 1);
        return $o;
    }
    if (!is_site_admin()) {
        notice(t('Permission denied.') . EOL);
        return '';
    }
    if (argc() != 3) {
        killme();
    }
    $cmd = argv(1);
    $hash = argv(2);
    if ($cmd === 'deny') {
        if (!user_deny($hash)) {
            killme();
        }
    }
    if ($cmd === 'allow') {
        if (!user_allow($hash)) {
            killme();
        }
    }
}
开发者ID:TamirAl,项目名称:hubzilla,代码行数:29,代码来源:regmod.php

示例12: attach_init

function attach_init(&$a)
{
    if (argc() < 2) {
        notice(t('Item not available.') . EOL);
        return;
    }
    $r = attach_by_hash(argv(1), argc() > 2 ? intval(argv(2)) : 0);
    if (!$r['success']) {
        notice($r['message'] . EOL);
        return;
    }
    $c = q("select channel_address from channel where channel_id = %d limit 1", intval($r['data']['uid']));
    if (!$c) {
        return;
    }
    $unsafe_types = array('text/html', 'text/css', 'application/javascript');
    if (in_array($r['data']['filetype'], $unsafe_types)) {
        header('Content-type: text/plain');
    } else {
        header('Content-type: ' . $r['data']['filetype']);
    }
    header('Content-disposition: attachment; filename="' . $r['data']['filename'] . '"');
    if ($r['data']['flags'] & ATTACH_FLAG_OS) {
        $istream = fopen('store/' . $c[0]['channel_address'] . '/' . $r['data']['data'], 'rb');
        $ostream = fopen('php://output', 'wb');
        if ($istream && $ostream) {
            pipe_streams($istream, $ostream);
            fclose($istream);
            fclose($ostream);
        }
    } else {
        echo $r['data']['data'];
    }
    killme();
}
开发者ID:redmatrix,项目名称:red,代码行数:35,代码来源:attach.php

示例13: viewsrc_content

function viewsrc_content(&$a)
{
    $o = '';
    $item_id = argc() > 1 ? intval(argv(1)) : 0;
    $json = argc() > 2 && argv(2) === 'json' ? true : false;
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
    }
    if (!$item_id) {
        $a->error = 404;
        notice(t('Item not found.') . EOL);
    }
    if (local_user() && $item_id) {
        $r = q("select item_flags, body from item where item_restrict = 0 and uid = %d and id = %d limit 1", intval(local_user()), intval($item_id));
        if ($r) {
            if ($r[0]['item_flags'] & ITEM_OBSCURED) {
                $r[0]['body'] = crypto_unencapsulate(json_decode($r[0]['body'], true), get_config('system', 'prvkey'));
            }
            $o = $json ? json_encode($r[0]['body']) : str_replace("\n", '<br />', $r[0]['body']);
        }
    }
    if (is_ajax()) {
        echo $o;
        killme();
    }
    return $o;
}
开发者ID:Mauru,项目名称:red,代码行数:27,代码来源:viewsrc.php

示例14: contactgroup_content

function contactgroup_content(&$a)
{
    if (!local_user()) {
        killme();
    }
    if (argc() > 2 && intval(argv(1)) && argv(2)) {
        $r = q("SELECT abook_xchan from abook where abook_xchan = '%s' and abook_channel = %d and not ( abook_flags & %d ) limit 1", dbesc(argv(2)), intval(local_user()), intval(ABOOK_FLAG_SELF));
        if ($r) {
            $change = $r[0]['abook_xchan'];
        }
    }
    if (argc() > 1 && intval(argv(1))) {
        $r = q("SELECT * FROM `groups` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1", intval(argv(1)), intval(local_user()));
        if (!$r) {
            killme();
        }
        $group = $r[0];
        $members = group_get_members($group['id']);
        $preselected = array();
        if (count($members)) {
            foreach ($members as $member) {
                $preselected[] = $member['xchan_hash'];
            }
        }
        if ($change) {
            if (in_array($change, $preselected)) {
                group_rmv_member(local_user(), $group['name'], $change);
            } else {
                group_add_member(local_user(), $group['name'], $change);
            }
        }
    }
    killme();
}
开发者ID:Mauru,项目名称:red,代码行数:34,代码来源:contactgroup.php

示例15: channel_init

function channel_init(&$a)
{
    $which = null;
    if (argc() > 1) {
        $which = argv(1);
    }
    if (!$which) {
        if (local_user()) {
            $channel = $a->get_channel();
            if ($channel && $channel['channel_address']) {
                $which = $channel['channel_address'];
            }
        }
    }
    if (!$which) {
        notice(t('You must be logged in to see this page.') . EOL);
        return;
    }
    $profile = 0;
    $channel = $a->get_channel();
    if (local_user() && argc() > 2 && argv(2) === 'view') {
        $which = $channel['channel_address'];
        $profile = argv(1);
    }
    $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which . '" />' . "\r\n";
    // Run profile_load() here to make sure the theme is set before
    // we start loading content
    profile_load($a, $which, $profile);
}
开发者ID:Mauru,项目名称:red,代码行数:29,代码来源:channel.php


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