本文整理汇总了PHP中info函数的典型用法代码示例。如果您正苦于以下问题:PHP info函数的具体用法?PHP info怎么用?PHP info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute(array $command)
{
$cwd = getcwd();
chdir(info()->rootDir());
$this->instance()->run(new ArrayInput($command), new NullOutput());
chdir($cwd);
}
示例2: uri
/**
* Page uri : lang/slug.
*
* @return \Illuminate\Http\Response | \Illuminate\Http\RedirectResponse
*/
public function uri($page = null)
{
$app = app();
if ($app->make('request')->path() != $page->uri() && !$page->is_home) {
return redirect($page->uri());
}
$app->instance('currentPage', $page);
if (!$page) {
abort('404');
}
if ($page->private && !Auth::check()) {
return redirect()->guest(route(config('app.locale') . '.login'));
}
if ($page->redirect) {
$childUri = $page->children->first()->uri();
return redirect($childUri);
}
// get submenu
$children = $this->repository->getSubMenu($page->uri);
$templateDir = 'pages::' . config('typicms.template_dir', 'public') . '.';
$template = $page->template ?: 'default';
if (!view()->exists($templateDir . $template)) {
info('Template ' . $template . ' not found, switching to default template.');
$template = 'default';
}
return response()->view($templateDir . $template, compact('children', 'page'));
}
示例3: tagrm_post
function tagrm_post(&$a)
{
if (!local_user()) {
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
}
if (x($_POST, 'submit') && $_POST['submit'] === t('Cancel')) {
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
}
$tag = x($_POST, 'tag') ? hex2bin(notags(trim($_POST['tag']))) : '';
$item = x($_POST, 'item') ? intval($_POST['item']) : 0;
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($item), intval(local_user()));
if (!count($r)) {
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
}
$arr = explode(',', $r[0]['tag']);
for ($x = 0; $x < count($arr); $x++) {
if ($arr[$x] === $tag) {
unset($arr[$x]);
break;
}
}
$tag_str = implode(',', $arr);
q("UPDATE `item` SET `tag` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1", dbesc($tag_str), intval($item), intval(local_user()));
info(t('Tag removed') . EOL);
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
// NOTREACHED
}
示例4: follow_post
function follow_post(&$a)
{
if (!local_user()) {
notice(t('Permission denied.') . EOL);
goaway($_SESSION['return_url']);
// NOTREACHED
}
if ($_REQUEST['cancel']) {
goaway($_SESSION['return_url']);
}
$uid = local_user();
$url = notags(trim($_REQUEST['url']));
$return_url = $_SESSION['return_url'];
// Makes the connection request for friendica contacts easier
// This is just a precaution if maybe this page is called somewhere directly via POST
$_SESSION["fastlane"] = $url;
$result = new_contact($uid, $url, true);
if ($result['success'] == false) {
if ($result['message']) {
notice($result['message']);
}
goaway($return_url);
} elseif ($result['cid']) {
goaway($a->get_baseurl() . '/contacts/' . $result['cid']);
}
info(t('Contact added') . EOL);
if (strstr($return_url, 'contacts')) {
goaway($a->get_baseurl() . '/contacts/' . $contact_id);
}
goaway($return_url);
// NOTREACHED
}
示例5: lostpass_content
function lostpass_content(&$a)
{
if (x($_GET, 'verify')) {
$verify = $_GET['verify'];
$hash = hash('whirlpool', $verify);
$r = q("SELECT * FROM `user` WHERE `pwdreset` = '%s' LIMIT 1", dbesc($hash));
if (!count($r)) {
notice(t("Request could not be verified. (You may have previously submitted it.) Password reset failed.") . EOL);
goaway(z_root());
return;
}
$uid = $r[0]['uid'];
$username = $r[0]['username'];
$email = $r[0]['email'];
$new_password = autoname(6) . mt_rand(100, 9999);
$new_password_encoded = hash('whirlpool', $new_password);
$r = q("UPDATE `user` SET `password` = '%s', `pwdreset` = '' WHERE `uid` = %d LIMIT 1", dbesc($new_password_encoded), intval($uid));
if ($r) {
$tpl = get_markup_template('pwdreset.tpl');
$o .= replace_macros($tpl, array('$lbl1' => t('Password Reset'), '$lbl2' => t('Your password has been reset as requested.'), '$lbl3' => t('Your new password is'), '$lbl4' => t('Save or copy your new password - and then'), '$lbl5' => '<a href="' . $a->get_baseurl() . '">' . t('click here to login') . '</a>.', '$lbl6' => t('Your password may be changed from the <em>Settings</em> page after successful login.'), '$newpass' => $new_password, '$baseurl' => $a->get_baseurl()));
info("Your password has been reset." . EOL);
$email_tpl = get_intltext_template("passchanged_eml.tpl");
$email_tpl = replace_macros($email_tpl, array('$sitename' => $a->config['sitename'], '$siteurl' => $a->get_baseurl(), '$username' => $username, '$email' => $email, '$new_password' => $new_password, '$uid' => $newuid));
$res = mail($email, "Your password has changed at {$a->config['sitename']}", $email_tpl, 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-transfer-encoding: 8bit');
return $o;
}
} else {
$tpl = get_markup_template('lostpass.tpl');
$o .= replace_macros($tpl, array('$title' => t('Forgot your Password?'), '$desc' => t('Enter your email address and submit to have your password reset. Then check your email for further instructions.'), '$name' => t('Nickname or Email: '), '$submit' => t('Reset')));
return $o;
}
}
示例6: get
function get()
{
if (!local_channel()) {
goaway(z_root() . '/' . $_SESSION['photo_return']);
// NOTREACHED
}
// remove tag on the fly if item and tag are provided
if (argc() == 4 && argv(1) === 'drop' && intval(argv(2))) {
$item = intval(argv(2));
$tag = argv(3);
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($item), intval(local_channel()));
if (!$r) {
goaway(z_root() . '/' . $_SESSION['photo_return']);
}
$r = fetch_post_tags($r, true);
$item = $r[0];
$new_tags = array();
if ($item['term']) {
for ($x = 0; $x < count($item['term']); $x++) {
if ($item['term'][$x]['term'] !== hex2bin($tag)) {
$new_tags[] = $item['term'][$x];
}
}
}
if ($new_tags) {
$item['term'] = $new_tags;
} else {
unset($item['term']);
}
item_store_update($item);
info(t('Tag removed') . EOL);
goaway(z_root() . '/' . $_SESSION['photo_return']);
}
//if we got only the item print a list of tags to select
if (argc() == 3 && argv(1) === 'drop' && intval(argv(2))) {
$o = '';
$item = intval(argv(2));
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($item), intval(local_channel()));
if (!$r) {
goaway(z_root() . '/' . $_SESSION['photo_return']);
}
$r = fetch_post_tags($r, true);
if (!count($r[0]['term'])) {
goaway(z_root() . '/' . $_SESSION['photo_return']);
}
$o .= '<h3>' . t('Remove Item Tag') . '</h3>';
$o .= '<p id="tag-remove-desc">' . t('Select a tag to remove: ') . '</p>';
$o .= '<form id="tagrm" action="tagrm" method="post" >';
$o .= '<input type="hidden" name="item" value="' . $item . '" />';
$o .= '<ul>';
foreach ($r[0]['term'] as $x) {
$o .= '<li><input type="checkbox" name="tag" value="' . bin2hex($x['term']) . '" >' . bbcode($x['term']) . '</input></li>';
}
$o .= '</ul>';
$o .= '<input id="tagrm-submit" type="submit" name="submit" value="' . t('Remove') . '" />';
$o .= '<input id="tagrm-cancel" type="submit" name="submit" value="' . t('Cancel') . '" />';
$o .= '</form>';
return $o;
}
}
示例7: regmod_content
function regmod_content(&$a)
{
global $lang;
$_SESSION['return_url'] = App::$cmd;
if (!local_channel()) {
info(t('Please login.') . EOL);
$o .= '<br /><br />' . login(App::$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 (!account_deny($hash)) {
killme();
}
}
if ($cmd === 'allow') {
if (!account_allow($hash)) {
killme();
}
}
}
示例8: candidatesArePeopleToo
function candidatesArePeopleToo()
{
global $FLAG_CAN_CHANGE_DB;
$s = mysql_query("\n SELECT q.id, q.name, count(*) as num\n FROM news_qualifiers AS q\n WHERE idperson=0\n GROUP BY name\n ORDER BY num DESC");
while ($r = mysql_fetch_array($s)) {
$name = $r['name'];
// Get the party
$idString = 'none now';
$persons = getPersonsByName($name, $idString, infoFunction);
// If I reached this point, I know for sure I either have one
// or zero matches, there are no ambiguities.
if (count($persons) == 0) {
$person = addPersonToDatabase($name, $r['name']);
} else {
$person = $persons[0];
mysql_query("UPDATE news_qualifiers " . "SET idperson={$person->id} " . "WHERE name='" . $r['name'] . "'");
}
info('<a href="/politica/api/add_person_update_qualifier.php?name=' . $r['name'] . '" target="_blank">add</a>');
// Locate these people and update them in several tables now.
// We're mainly interested in updating the ID to the new ID that
// will be in the People database, from the previous ID that was
// the senator's ID in the senators table.
if ($FLAG_CAN_CHANGE_DB) {
mysql_query("UPDATE news_qualifiers " . "SET idperson={$person->id} " . "WHERE name='" . $r['name'] . "'");
}
}
printJsCommitCookieScript();
}
示例9: post
function post()
{
if (!local_channel()) {
return;
}
if ($_POST['url']) {
$arr = array('uid' => intval($_REQUEST['uid']), 'url' => escape_tags($_REQUEST['url']), 'guid' => escape_tags($_REQUEST['guid']), 'author' => escape_tags($_REQUEST['author']), 'addr' => escape_tags($_REQUEST['addr']), 'name' => escape_tags($_REQUEST['name']), 'desc' => escape_tags($_REQUEST['desc']), 'photo' => escape_tags($_REQUEST['photo']), 'version' => escape_tags($_REQUEST['version']), 'price' => escape_tags($_REQUEST['price']), 'requires' => escape_tags($_REQUEST['requires']), 'system' => intval($_REQUEST['system']), 'sig' => escape_tags($_REQUEST['sig']), 'categories' => escape_tags($_REQUEST['categories']));
$_REQUEST['appid'] = Zlib\Apps::app_install(local_channel(), $arr);
if (Zlib\Apps::app_installed(local_channel(), $arr)) {
info(t('App installed.') . EOL);
}
return;
}
$papp = Zlib\Apps::app_decode($_POST['papp']);
if (!is_array($papp)) {
notice(t('Malformed app.') . EOL);
return;
}
if ($_POST['install']) {
Zlib\Apps::app_install(local_channel(), $papp);
if (Zlib\Apps::app_installed(local_channel(), $papp)) {
info(t('App installed.') . EOL);
}
}
if ($_POST['delete']) {
Zlib\Apps::app_destroy(local_channel(), $papp);
}
if ($_POST['edit']) {
return;
}
if ($_SESSION['return_url']) {
goaway(z_root() . '/' . $_SESSION['return_url']);
}
goaway(z_root() . '/apps');
}
示例10: redred_settings_post
function redred_settings_post($a, $post)
{
if (!local_channel()) {
return;
}
// don't check redred settings if redred submit button is not clicked
if (!x($_POST, 'redred-submit')) {
return;
}
$channel = App::get_channel();
// Don't let somebody post to their self channel. Since we aren't passing message-id this would be very very bad.
if (!trim($_POST['redred_channel'])) {
notice(t('Channel is required.') . EOL);
return;
}
if ($channel['channel_address'] === trim($_POST['redred_channel'])) {
notice(t('Invalid channel.') . EOL);
return;
}
set_pconfig(local_channel(), 'redred', 'baseapi', trim($_POST['redred_baseapi']));
set_pconfig(local_channel(), 'redred', 'username', trim($_POST['redred_username']));
set_pconfig(local_channel(), 'redred', 'password', z_obscure(trim($_POST['redred_password'])));
set_pconfig(local_channel(), 'redred', 'channel', trim($_POST['redred_channel']));
set_pconfig(local_channel(), 'redred', 'post', intval($_POST['redred_enable']));
set_pconfig(local_channel(), 'redred', 'post_by_default', intval($_POST['redred_default']));
info(t('redred Settings saved.') . EOL);
}
示例11: crepair_post
function crepair_post(&$a)
{
if (!local_user()) {
return;
}
$cid = $a->argc > 1 ? intval($a->argv[1]) : 0;
if ($cid) {
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($cid), intval(local_user()));
}
if (!count($r)) {
return;
}
$contact = $r[0];
$nick = x($_POST, 'nick') ? $_POST['nick'] : '';
$url = x($_POST, 'url') ? $_POST['url'] : '';
$request = x($_POST, 'request') ? $_POST['request'] : '';
$confirm = x($_POST, 'confirm') ? $_POST['confirm'] : '';
$notify = x($_POST, 'notify') ? $_POST['notify'] : '';
$poll = x($_POST, 'poll') ? $_POST['poll'] : '';
$attag = x($_POST, 'attag') ? $_POST['attag'] : '';
$photo = x($_POST, 'photo') ? $_POST['photo'] : '';
$r = q("UPDATE `contact` SET `nick` = '%s', `url` = '%s', `request` = '%s', `confirm` = '%s', `notify` = '%s', `poll` = '%s', `attag` = '%s' \n\t\tWHERE `id` = %d AND `uid` = %d LIMIT 1", dbesc($nick), dbesc($url), dbesc($request), dbesc($confirm), dbesc($notify), dbesc($poll), dbesc($attag), intval($contact['id']), local_user());
if ($photo) {
logger('mod-crepair: updating photo from ' . $photo);
require_once "Photo.php";
$photos = import_profile_photo($photo, local_user(), $contact['id']);
$x = q("UPDATE `contact` SET `photo` = '%s',\n\t\t\t`thumb` = '%s',\n\t\t\t`micro` = '%s',\n\t\t\t`name-date` = '%s',\n\t\t\t`uri-date` = '%s',\n\t\t\t`avatar-date` = '%s'\n\t\t\tWHERE `id` = %d LIMIT 1\n\t\t\t", dbesc($photos[0]), dbesc($photos[1]), dbesc($photos[2]), dbesc(datetime_convert()), dbesc(datetime_convert()), dbesc(datetime_convert()), intval($contact['id']));
}
if ($r) {
info(t('Contact settings applied.') . EOL);
} else {
notice(t('Contact update failed.') . EOL);
}
return;
}
示例12: importFile
function importFile($file_name, $college_letter_code)
{
global $startWith;
$data = file_get_contents($file_name);
$json = json_decode($data, true);
info("[---------------- starting with {$startWith} ----------------]");
for ($i = $startWith; $i < count($json); $i++) {
$college = $json[$i];
$num = (double) $college["coldep"] > 0 ? (double) $college["coldep"] : (double) $college["colsen"];
$college_name = ucwords(strtolower("{$college_letter_code}{$num} {$college["jud_lbl"]}"));
info("[---------------------------------------------------]");
info("[{$i}. {$college_name}]");
$parts = extractNameAndParty($college["USL"]);
addCandidateToCollege($college_name, $parts[0], $parts[1]);
$parts = extractNameAndParty($college["ARD"]);
addCandidateToCollege($college_name, $parts[0], $parts[1]);
addCandidateToCollege($college_name, $college["PP_DD"], "PP_DD");
addCandidateToCollege($college_name, $college["UDMR"], "UDMR");
if ($college_letter_code == "D") {
$others = explode(", ", $college["Alti_Candi"]);
} else {
$others = explode(", ", $college["Alti_candi"]);
}
foreach ($others as $other_candidate) {
$other_candidate = trim($other_candidate);
if ($other_candidate == "") {
continue;
}
$parts = extractNameAndParty($other_candidate);
addCandidateToCollege($college_name, $parts[0], $parts[1]);
}
$startWith = $i;
}
}
示例13: regmod_content
function regmod_content(&$a)
{
global $lang;
$_SESSION['return_url'] = $a->cmd;
if (!local_user()) {
info(t('Please login.') . EOL);
$o .= '<br /><br />' . login($a->config['system']['register_policy'] == REGISTER_CLOSED ? 0 : 1);
return $o;
}
if (!is_site_admin() || x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
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();
}
}
}
示例14: info
function info($data, $top)
{
global $protocols;
echo ' ', ip($data, 12), ' > ', ip($data, 16), ' protocol=';
if (!isset($protocols[$data[9]])) {
echo 'unknown(', $data[9], ')';
return;
}
echo $protocols[$data[9]];
if ($data[9] == 1) {
// ICMP
info_icmp(array_slice($data, 20));
if ($data[9] == 1 && $data[20] == 3) {
// ICMP Destination Unreachable
echo "\n\tdata: ";
// Print into on the contained packet
info(array_slice($data, 28), false);
}
} else {
if ($data[9] == 6) {
// TCP
info_tcp(array_slice($data, 20));
} else {
if ($data[9] == 17) {
// UDP
info_udp(array_slice($data, 20));
}
}
}
}
示例15: oexchange_content
function oexchange_content(&$a)
{
if (!local_user()) {
$o = login(false);
return $o;
}
if ($a->argc > 1 && $a->argv[1] === 'done') {
info(t('Post successful.') . EOL);
return;
}
$url = x($_GET, 'url') && strlen($_GET['url']) ? urlencode(notags(trim($_GET['url']))) : '';
$title = x($_GET, 'title') && strlen($_GET['title']) ? '&title=' . urlencode(notags(trim($_GET['title']))) : '';
$description = x($_GET, 'description') && strlen($_GET['description']) ? '&description=' . urlencode(notags(trim($_GET['description']))) : '';
$tags = x($_GET, 'tags') && strlen($_GET['tags']) ? '&tags=' . urlencode(notags(trim($_GET['tags']))) : '';
$s = fetch_url($a->get_baseurl() . '/parse_url?f=&url=' . $url . $title . $description . $tags);
if (!strlen($s)) {
return;
}
require_once 'include/html2bbcode.php';
$post = array();
$post['profile_uid'] = local_user();
$post['return'] = '/oexchange/done';
$post['body'] = html2bbcode($s);
$post['type'] = 'wall';
$_POST = $post;
require_once 'mod/item.php';
item_post($a);
}