本文整理汇总了PHP中fURL类的典型用法代码示例。如果您正苦于以下问题:PHP fURL类的具体用法?PHP fURL怎么用?PHP fURL使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了fURL类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: create
public function create()
{
try {
$profileId = UserHelper::getProfileId();
$msg = new Msg();
$msg->setSender($profileId);
$msg->setContent(trim(fRequest::get('msg-content')));
$re = trim(fRequest::get('dest', 'integer'));
$x = new Profile($re);
$msg->setReceiver($re);
if (strlen($msg->getContent()) < 1) {
throw new fValidationException('信息长度不能少于1个字符');
}
if (strlen($msg->getContent()) > 140) {
throw new fValidationException('信息长度不能超过140个字符');
}
$msg->store();
//Activity::fireNewTweet();
fMessaging::create('success', 'create msg', '留言成功!');
} catch (fNotFoundException $e) {
fMessaging::create('failure', 'create msg', '该用户名不存在!');
} catch (fException $e) {
fMessaging::create('failure', 'create msg', $e->getMessage());
}
fURL::redirect(SITE_BASE . '/profile/' . $re . '/msgs');
}
开发者ID:daerduoCarey,项目名称:xiaoyou,代码行数:26,代码来源:MsgController.php
示例2: email_plugin_notify
function email_plugin_notify($check,$check_result,$subscription,$alt_email=false) {
global $status_array;
$user = new User($subscription->getUserId());
$email = new fEmail();
// This sets up fSMTP to connect to the gmail SMTP server
// with a 5 second timeout. Gmail requires a secure connection.
$smtp = new fSMTP(sys_var('smtp_server'), sys_var('smtp_port'), TRUE, 5);
$smtp->authenticate(sys_var('smtp_user'), sys_var('smtp_pass'));
if ($alt_email) {
$email_address = usr_var('alt_email',$user->getUserId());
} else {
$email_address = $user->getEmail();
}
$email->addRecipient($email_address, $user->getUsername());
// Set who the email is from
$email->setFromEmail(sys_var('email_from'), sys_var('email_from_display'));
// Set the subject include UTF-8 curly quotes
$email->setSubject(str_replace('{check_name}', $check->prepareName(), sys_var('email_subject')));
// Set the body to include a string containing UTF-8
$state = $status_array[$check_result->getStatus()];
$email->setHTMLBody("<p>$state Alert for {$check->prepareName()} </p><p>The check returned {$check_result->prepareValue()}</p><p>Warning Threshold is : ". $check->getWarn() . "</p><p>Error Threshold is : ". $check->getError() . '</p><p>View Alert Details : <a href="' . fURL::getDomain() . '/' . CheckResult::makeURL('list',$check_result) . '">'.$check->prepareName()."</a></p>");
$email->setBody("
$state Alert for {$check->prepareName()}
The check returned {$check_result->prepareValue()}
Warning Threshold is : ". $check->getWarn() . "
Error Threshold is : ". $check->getError() . "
");
try {
$message_id = $email->send($smtp);
} catch ( fConnectivityException $e) {
fCore::debug("email send failed",FALSE);
}
}
开发者ID:nleskiw,项目名称:Graphite-Tattle,代码行数:33,代码来源:email_plugin.php
示例3: ensureLogin
function ensureLogin()
{
global $user;
if (!isset($user)) {
fURL::redirect("/login.php?forward={$_SERVER['REQUEST_URI']}");
}
}
开发者ID:increpare,项目名称:hackspace-foundation-sites,代码行数:7,代码来源:init.php
示例4: upload
/**
* Upload an image file for avatar
*/
public function upload()
{
try {
if (self::isImage($_FILES['avatar-file']) && move_uploaded_file($_FILES['avatar-file']['tmp_name'], $this->uploadfile)) {
fURL::redirect(SITE_BASE . '/avatar/edit');
} else {
throw new fValidationException('上传图片失败');
}
} catch (Exception $e) {
fMessaging::create('failure', 'upload avatar', $e->getMessage());
fURL::redirect(SITE_BASE . '/profile/' . UserHelper::getProfileId());
}
}
开发者ID:daerduoCarey,项目名称:xiaoyou,代码行数:16,代码来源:AvatarController.php
示例5: upload
public function upload()
{
$uploadfile = UPLOAD_DIR . basename($_FILES['userfile']['name']);
try {
if (self::validFile($uploadfile) && move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
fURL::redirect(SITE_BASE . '/manage');
} else {
throw new fValidationException('上传失败');
}
} catch (Exception $e) {
fMessaging::create('failure', 'upload file', $e->getMessage());
fURL::redirect(SITE_BASE . '/manage');
}
}
开发者ID:daerduoCarey,项目名称:xiaoyou,代码行数:14,代码来源:AdminController.php
示例6: show
public function show($id)
{
$this->cache_control('private', 2);
try {
$this->record = new Record($id);
if (!$this->record->isReadable()) {
throw new fAuthorizationException('You are not allowed to read this record.');
}
$this->nav_class = 'status';
$this->render('record/show');
} catch (fExpectedException $e) {
fMessaging::create('warning', $e->getMessage());
fURL::redirect(Util::getReferer());
} catch (fUnexpectedException $e) {
fMessaging::create('error', $e->getMessage());
fURL::redirect(Util::getReferer());
}
}
开发者ID:daerduoCarey,项目名称:oj,代码行数:18,代码来源:RecordController.php
示例7: reply
public function reply($id)
{
try {
$tweet = new Tweet($id);
$comment = new TweetComment();
$comment->setTweetId($tweet->getId());
$comment->setProfileId(UserHelper::getProfileId());
$comment->setContent(trim(fRequest::get('tweet-comment')));
if (strlen($comment->getContent()) < 1) {
throw new fValidationException('回复长度不能少于1个字符');
}
if (strlen($comment->getContent()) > 140) {
throw new fValidationException('回复长度不能超过140个字符');
}
$comment->store();
} catch (fException $e) {
// TODO
}
fURL::redirect(SITE_BASE . '/profile/' . $tweet->getProfileId() . '#tweet/' . $tweet->getId());
}
开发者ID:daerduoCarey,项目名称:xiaoyou,代码行数:20,代码来源:TweetController.php
示例8: create
public function create()
{
try {
$profileId = UserHelper::getProfileId();
$mail = new Mail();
$mail->setSender($profileId);
$mail->setContent(trim(fRequest::get('mail-content')));
$re = trim(fRequest::get('dest'));
if (empty($re)) {
$re = trim(fRequest::get('destre', 'integer'));
$pa = trim(fRequest::get('parent', 'integer', -1));
$x = new Profile($re);
$mail->setReceiver($re);
$mail->setParent($pa);
} else {
//$receiver=fRecordSet::build('Profile',array('login_name=' => $re ),array())->getRecord(0);
$receiver = fRecordSet::build('Profile', array('login_name=' => $re), array());
if ($receiver->count()) {
$receiver = $receiver->getRecord(0);
} else {
throw new fNotFoundException('user doesn\'t exist');
}
$mail->setReceiver($receiver->getId());
}
if (strlen($mail->getContent()) < 1) {
throw new fValidationException('信息长度不能少于1个字符');
}
if (strlen($mail->getContent()) > 140) {
throw new fValidationException('信息长度不能超过140个字符');
}
$mail->store();
//Activity::fireNewTweet();
fMessaging::create('success', 'create mail', '信息发送成功!');
} catch (fNotFoundException $e) {
fMessaging::create('failure', 'create mail', '该用户名不存在,或该用户没有创建个人资料!');
} catch (fException $e) {
fMessaging::create('failure', 'create mail', $e->getMessage());
}
fURL::redirect(SITE_BASE . '/inbox');
}
开发者ID:daerduoCarey,项目名称:xiaoyou,代码行数:40,代码来源:MailController.php
示例9: show
public function show($id)
{
if (fAuthorization::checkLoggedIn()) {
$this->cache_control('private', 30);
} else {
$this->cache_control('private', 60);
}
try {
$this->problem = new Problem($id);
if ($this->problem->isSecretNow()) {
if (!User::can('view-any-problem')) {
throw new fAuthorizationException('Problem is secret now.');
}
}
$this->nav_class = 'problems';
$this->render('problem/show');
} catch (fExpectedException $e) {
fMessaging::create('warning', $e->getMessage());
fURL::redirect(Util::getReferer());
} catch (fUnexpectedException $e) {
fMessaging::create('error', $e->getMessage());
fURL::redirect(Util::getReferer());
}
}
开发者ID:daerduoCarey,项目名称:oj,代码行数:24,代码来源:ProblemController.php
示例10: array
<?php
$title = 'Project Storage';
require './header.php';
$cards = fRecordSet::build('Card', array('uid=' => $_GET['cardid']));
if ($cards->count() == 0) {
fURL::redirect("/kiosk/addcard.php?cardid=" . $_GET['cardid']);
}
$card = $cards->getRecord(0);
$user = new User($card->getUserId());
$user->load();
if (isset($_POST['print'])) {
$project = new Project($_POST['print']);
$project->load();
if ($project->getUserId() != $user->getId()) {
print "Incorrect project ID";
exit;
}
$data = array('storage_id' => $project->getId(), 'name' => $project->getName(), 'ownername' => $user->getFullName(), 'more_info' => $project->getDescription(), 'completion_date' => $project->getToDate()->format('Y/m/d'), 'max_extention' => "14");
$data_string = json_encode($data);
$ch = curl_init('http://kiosk.london.hackspace.org.uk:12345/print/dnh');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data_string)));
$result = curl_exec($ch);
curl_close($ch);
echo "<p>Your sticker is being printed now.</p>";
}
$projects = fRecordSet::build('Project', array('state_id!=' => array('6', '7'), 'user_id=' => $user->getId()));
?>
开发者ID:increpare,项目名称:hackspace-foundation-sites,代码行数:31,代码来源:storage.php
示例11: htmlspecialchars
if ($newStatus != $project->getState() && $project->canTransitionStates($project->getState(), $newStatus)) {
$project->setState($newStatus);
$project->store();
if ($reason != '') {
$reason = ' with the reason \'' . $reason . "'";
}
// log the update
$project->submitLog('Status changed to ' . $project->getState() . $reason, $user->getId());
if ($project->getState() != 'Archived') {
// send to mailing list
$project->submitMailingList('Status changed to ' . $project->getState() . $reason . " by " . htmlspecialchars($user->getFullName()));
// inform the owner
$project->submitEmailToOwner("Dear {$projectUser->getFullName()},<br/><br/>" . "This is an automatic email to let you know your project {$project->getName()} has been updated with status {$project->getState()}{$reason}.<br/><br/>" . "If you have any questions or concerns regarding this change you can discuss this with members on the <a href=\"{$project->getMailingListURL()}\">Mailing List</a>.<br/><br/>" . "Best,<br/>Monkeys in the machine");
}
}
fURL::redirect("/storage/list.php");
} catch (fValidationException $e) {
echo $e->printMessage();
} catch (fSQLException $e) {
echo '<div class="alert alert-danger">An unexpected error occurred, please try again later</div>';
}
}
?>
<?php
if ($user->getId() == $project->getUserId() && ($project->getState() == 'Pending Approval' || $project->getState() == 'Unapproved')) {
?>
<small class="edit_bttn">
<a href="/storage/edit/<?php
echo $project->getId();
?>
开发者ID:increpare,项目名称:hackspace-foundation-sites,代码行数:31,代码来源:details.php
示例12: strpos
<meta property="og:title" content="Safecast" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://www.safecast.org" />
<meta property="og:image" content="http://www.safecast.org/images/logo.png" />
<meta property="og:site_name" content="Safecast" />
<meta property="fb:admins" content="595809984" />
<meta name="description" content="Safecast is a website that aggregates radioactivity data from throughout the world in order to provide real-time hyper-local information about the status of the Japanese nuclear crisis.">
<meta name="keywords" content="japan,fukushima,radiation,nuclear,reactor,geiger,counter,RDTN,Safecast">
<title><?php
echo $this->prepare('title');
echo strpos($this->get('title'), 'Safecast') === FALSE ? ' - Safecast' : '';
?>
</title>
<base href="<?php
echo fURL::getDomain() . URL_ROOT;
?>
" />
<link rel="stylesheet" type="text/css" href="style/reset.css" media="screen" />
<!--<link rel="stylesheet" type="text/css" href="style/base.css" media="screen" />-->
<?php
echo $this->place('css');
?>
<script type="text/javascript" src="script/jquery-1.5.1.min.js"></script>
<?php
echo $this->place('js', 'js');
?>
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="excanvas.min.js"></script><![endif]-->
<script type="text/javascript">
开发者ID:hicapacity,项目名称:safecast.org,代码行数:31,代码来源:header_headless.php
示例13: foreach
foreach ($subscriptions as $sub) {
$user_id = $sub['user_id'];
if (!in_array($user_id, $alt_ids) && $user_id != $id_user_session) {
$user = new User($sub['user_id']);
$recipients[] = array("mail" => $user->getEmail(), "name" => $user->getUsername());
}
}
if (!empty($recipients)) {
// Send the mail to everybody
notify_multiple_users($user_session, $recipients, $subject_mail, $content_mail);
fMessaging::create('success', fURL::get(), 'The mail "' . $subject_mail . '" was successfully sent to all the users who subscribe to "' . $check->getName() . '"');
} else {
fMessaging::create('error', fURL::get(), "Nobody subscribe to this check");
}
}
}
} catch (fNotFoundException $e) {
fMessaging::create('error', $manage_url, 'The check requested, ' . fHTML::encode($check_id) . ', could not be found');
fURL::redirect($manage_url);
} catch (fExpectedException $e) {
fMessaging::create('error', fURL::get(), $e->getMessage());
}
$page_num = fRequest::get('page', 'int', 1);
$url_redirect = CheckResult::makeURL('list', $check) . "&page=" . $page_num;
fURL::redirect($url_redirect);
} else {
$page_num = fRequest::get('page', 'int', 1);
$check_results = CheckResult::findAll($check_id, false, $GLOBALS['PAGE_SIZE'], $page_num);
include VIEW_PATH . '/list_check_results.php';
}
}
开发者ID:nagyist,项目名称:Tattle,代码行数:31,代码来源:result.php
示例14:
<?php
$tmpl->set('title', 'Log In');
$tmpl->set('no-nav', true);
$tmpl->place('header');
?>
<form action="<?php
echo fURL::get() . '?action=log_in';
?>
" method="post">
<div class="main" id="main">
<fieldset>
<div class="clearfix">
<label for="username">Username</label>
<div class="input">
<input id="username" type="text" name="username" value="<?php
echo fRequest::get('username');
?>
" />
</div>
</div><!-- /clearfix -->
<div class="clearfix">
<label for="password">Password</label>
<div class="input">
<input id="password" type="password" name="password" value="" />
</div>
</div><!-- /clearfix -->
<div class="actions">
<input class="btn" type="submit" value="Log In" />
<a class="btn" href="<?php
echo User::makeUrl('add');
开发者ID:rberger,项目名称:Graphite-Tattle,代码行数:31,代码来源:log_in.php
示例15: validateCSRFToken
/**
* Validates a request token generated by ::generateCSRFToken()
*
* This method takes a request token and ensures it is valid, otherwise
* it will throw an fValidationException.
*
* @throws fValidationException When the CSRF token specified is invalid
*
* @param string $token The request token to validate
* @param string $url The URL to validate the token for, default to the current page
* @return void
*/
public static function validateCSRFToken($token, $url = NULL)
{
if ($url === NULL) {
$url = fURL::get();
}
$key = __CLASS__ . '::' . $url . '::csrf_tokens';
$tokens = fSession::get($key, array());
if (!in_array($token, $tokens)) {
throw new fValidationException('The form submitted could not be validated as authentic, please try submitting it again');
}
$tokens = array_diff($tokens, array($token));
fSession::set($key, $tokens);
}
开发者ID:hibble,项目名称:printmaster,代码行数:25,代码来源:fRequest.php
示例16: array
$breadcrumbs[] = array('name' => $graph->prepareName(), 'url' => Graph::makeURL('edit',$graph),'active'=> false);
$breadcrumbs[] = array('name' => $page_title, 'url' => fURL::getWithQueryString(),'active'=> true);
$tmpl->set('breadcrumbs',$breadcrumbs);
$tmpl->place('header');
if (isset($line_id)) {
$query_string = "&line_id=$line_id";
} elseif (isset($graph_id)) {
$query_string = "&graph_id=$graph_id";
} else {
$query_string = '';
}
?>
<div class="row">
<div class="span6">
<form action="<?php
echo fURL::get();
?>
?action=<? echo $action.$query_string; ?>" method="post">
<div class="main" id="main">
<fieldset>
<div class="clearfix">
<label for="line-alias">Alias<em>*</em></label>
<div class="input">
<input id="line-alias" class="span3" type="text" size="30" name="alias" value="<?php
echo $line->encodeAlias();
?>
" />
</div>
</div><!-- /clearfix -->
<div class="clearfix">
<label for="line-target">Target<em>*</em></label>
开发者ID:rberger,项目名称:Graphite-Tattle,代码行数:31,代码来源:add_edit_line.php
示例17: showTemplatedLinks
/**
* Prints the links for a set of records
*
* @param string $template The template to use
* @param array $data The extra data to make available to the template
* @param integer $page The page of records being displayed
* @param integer $per_page The number of records being displayed on each page
* @param integer $total_records The total number of records
* @return void
*/
private static function showTemplatedLinks($template, $data, $page, $per_page, $total_records)
{
if ($total_records <= $per_page) {
return FALSE;
}
$total_pages = ceil($total_records / $per_page);
self::printPiece($template, 'start', array_merge(array('page' => $page, 'total_pages' => $total_pages, 'first_record' => ($page - 1) * $per_page + 1, 'last_record' => min($page * $per_page, $total_records), 'total_records' => $total_records), $data));
if ($page > 1) {
self::printPiece($template, 'prev', array_merge(array('page' => $page - 1, 'url' => fURL::replaceInQueryString('page', $page - 1)), $data));
} else {
self::printPiece($template, 'prev_disabled', $data);
}
$size = self::$templates[$template]['size'];
if (self::$templates[$template]['type'] == 'without_first_last') {
$start_page = max(1, $page - $size);
$end_page = min($total_pages, $page + $size);
} else {
$start_separator = TRUE;
$start_page = $page - ($size - 2);
if ($start_page <= 2) {
$start_separator = FALSE;
$start_page = 1;
}
$extra_end_pages = 0;
if ($page <= $size) {
$extra_end_pages = $size - $page + 1;
}
$end_separator = TRUE;
$end_page = $page + ($size - 2);
if ($end_page >= $total_pages - 1) {
$end_separator = FALSE;
$end_page = $total_pages;
}
$extra_start_pages = 0;
if ($page > $total_pages - $size) {
$extra_start_pages = $size - ($total_pages - $page);
}
$start_page -= $extra_start_pages;
if ($start_page <= 3) {
$start_separator = FALSE;
$start_page = 1;
}
$end_page += $extra_end_pages;
if ($end_page >= $total_pages - 2) {
$end_separator = FALSE;
$end_page = $total_pages;
}
}
if (self::$templates[$template]['type'] == 'with_first_last' && $start_separator) {
self::printPiece($template, 'page', array_merge(array('page' => 1, 'url' => fURL::replaceInQueryString('page', 1), 'first' => 'first', 'last' => '', 'current' => ''), $data));
self::printPiece($template, 'separator', $data);
}
for ($loop_page = $start_page; $loop_page <= $end_page; $loop_page++) {
self::printPiece($template, 'page', array_merge(array('page' => $loop_page, 'url' => fURL::replaceInQueryString('page', $loop_page), 'first' => $loop_page == 1 ? 'first' : '', 'last' => $loop_page == $total_pages ? 'last' : '', 'current' => $loop_page == $page ? 'current' : ''), $data));
}
if (self::$templates[$template]['type'] == 'with_first_last' && $end_separator) {
self::printPiece($template, 'separator', $data);
self::printPiece($template, 'page', array_merge(array('page' => $total_pages, 'url' => fURL::replaceInQueryString('page', $total_pages), 'first' => '', 'last' => 'last', 'current' => ''), $data));
}
if ($page < $total_pages) {
self::printPiece($template, 'next', array_merge(array('page' => $page + 1, 'url' => fURL::replaceInQueryString('page', $page + 1)), $data));
} else {
self::printPiece($template, 'next_disabled', $data);
}
self::printPiece($template, 'end', array_merge(array('page' => $page, 'total_pages' => $total_pages, 'first_record' => ($page - 1) * $per_page + 1, 'last_record' => min($page * $per_page, $total_records), 'total_records' => $total_records), $data));
return TRUE;
}
开发者ID:alandsidel,项目名称:flourish-classes,代码行数:77,代码来源:fPagination.php
示例18: _simplify
/**
* Can be used to convert strings such as textual labels into simpler strings suitable for use as an HTML statement's id.
**/
public static function _simplify($name)
{
//$o = wire()->sanitizer->pageName($name, true);
$o = fURL::makeFriendly($name);
return strtr($o, array('[]' => '', '-' => '_'));
}
开发者ID:netcarver,项目名称:fxForm,代码行数:9,代码来源:fxForm.php
示例19: count
</div>
</div>
<?php
}
?>
<div class="container-fluid">
<?php
$breadcrumbs = $this->get('breadcrumbs');
if (is_array($breadcrumbs)) {
echo '<ul class="breadcrumb">';
$crumb_count = count($breadcrumbs);
$crumb_counter = 1;
foreach ($breadcrumbs as $crumb) {
echo '<li' . (isset($crumb['class']) ? ' class="' . $crumb['class'] . '"' : ' class="active"') . '><a href="' . $crumb['url'] . '">' . $crumb['name'] . '</a>';
if ($crumb_counter < $crumb_count) {
echo '<span class="divider">/</span></li>';
}
$crumb_counter++;
}
echo '</ul>';
}
if (fMessaging::check('error', fURL::get())) {
echo '<div class="alert-message error">';
fMessaging::show('error', fURL::get());
echo '</div>';
}
if (fMessaging::check('success', fURL::get())) {
echo '<div class="alert-message success">';
fMessaging::show('success', fURL::get());
echo '</div>';
}
开发者ID:nleskiw,项目名称:Graphite-Tattle,代码行数:31,代码来源:header.php
示例20: Card
$page = 'cards';
$title = 'Add card';
$desc = '';
require '../header.php';
if (!isset($user)) {
fURL::redirect('/login.php?forward=/members/cards.php');
}
if (isset($_POST['submit'])) {
try {
fRequest::validateCSRFToken($_POST['token']);
$card = new Card();
$card->setUserId($user->getId());
$card->setAddedDate(time());
$card->setUid($_POST['uid']);
$card->store();
fURL::redirect('/members/cards.php');
exit;
} catch (fValidationException $e) {
echo "<p>" . $e->printMessage() . "</p>";
} catch (fSQLException $e) {
echo "<p>An unexpected error occurred, please try again later</p>";
trigger_error($e);
}
}
?>
<h2>Add card</h2>
<form method="POST">
<input type="hidden" name="token" value="<?php
echo fRequest::generateCSRFToken();
?>
开发者ID:russss,项目名称:hackspace-foundation-sites,代码行数:31,代码来源:addcard.php
注:本文中的fURL类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论