本文整理汇总了PHP中C::uri方法的典型用法代码示例。如果您正苦于以下问题:PHP C::uri方法的具体用法?PHP C::uri怎么用?PHP C::uri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C
的用法示例。
在下文中一共展示了C::uri方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setAction
public function setAction()
{
$query = Fw_Request::post('query', null);
if (!is_null($query)) {
Fw_Request::redirect(C::uri(array('search', urlencode($query))));
}
$param_0 = Fw_Request::get(0, null);
$param_1 = Fw_Request::get(1, null);
if (is_null($param_0)) {
return true;
}
if (method_exists($this, $param_0 . 'Action')) {
$this->actionName = $param_0;
return true;
}
if (!is_null($param_0) && !method_exists($this, $param_0 . 'Action')) {
if (!is_null($param_1) && $param_1 !== 'error') {
throw new Fw_Exception('[f:"' . __FILE__ . '", l:"' . __LINE__ . '"] Страница не найдена', 404);
}
$search_query = urldecode($param_0);
if (preg_match("/^[\\p{L}\\d\\-_\\.\\,\\?\\!\\s]+\$/Sui", $search_query)) {
Fw_Request::setGet('search_query', $search_query);
Fw_Request::setGet('error', false);
return true;
} else {
Fw_Request::setGet('search_query', $search_query);
Fw_Request::setGet('error', true);
if ($param_1 !== 'error') {
Fw_Request::redirect(C::uri(array('search', urlencode($search_query), 'error')));
die;
}
return true;
}
}
}
示例2: sendConfirmationMail
private function sendConfirmationMail($data)
{
$config = C::getConfig('application');
if ($config['contacts']['enable']) {
$to = $data['email'];
$subject = "No replay. Подтверждение регистрации на бирже LoveChernivtsi";
$link_confirm = C::site_host . C::uri(array('user', 'confirm', base64_encode($data['email'] . "_" . sha1($data['email'] . $data['login'] . C::site_host))));
$message = '
<html>
<head>
<title>Вы зарегистрировались на бирже благотворительности LoveChernivtsi</title>
</head>
<body>
<p>Для подтверждения регистрации пройдите по ссылке указанной ниже:</p>
<p><a href="' . $link_confirm . '">' . $link_confirm . '</a></p>
<p>Если ссылка не открывается скопируйте ее и вставьте в адресную строку браузера.</p>
<p style="font-size: 10px;">Если вы не регистрировались на данном ресурсе, игнорируйте письмо.</p>
</body>
</html>';
$headers = "Content-type: text/html; charset=UTF-8 \r\n";
$headers .= "From: Love Chernivtsy <" . $config['contacts']['admin_email'] . ">\r\n";
if (!mail($to, $subject, $message, $headers)) {
Log::add('Can\'t send email!', 500);
}
}
}
示例3: indexAction
public function indexAction()
{
$id = Fw_Request::get('id', null);
$alias = Fw_Request::get('alias', null);
if (!is_null($id)) {
$this->view->setLayout('projects', 'project');
$this->view->data = $this->model->getProject($id);
if (!isset($this->view->data['pl_alias']) || $this->view->data['pl_alias'] !== $alias) {
throw new Fw_Exception('[f:"' . __FILE__ . '", l:"' . __LINE__ . '"] Страница не найдена', 404);
}
if ($this->view->data['p_current'] >= $this->view->data['p_need']) {
Fw_Request::redirect(C::uri(array('done', $this->view->data['p_id'] . '-' . $this->view->data['pl_alias'])), 301);
}
$this->view->ru_lang_url = '/ru/projects/' . $this->view->data['p_id'] . '-' . $this->view->data['ru_alias'] . '/';
$this->view->ua_lang_url = '/projects/' . $this->view->data['p_id'] . '-' . $this->view->data['ua_alias'] . '/';
$this->view->donors_data = $this->model->getDonorsByProject($id, 0);
$this->view->setHead('title', array(), $this->view->data['pl_title'], true);
$this->view->setHead('meta', array('name' => 'description', 'content' => $this->view->data['pl_description']), '', false);
$this->view->setHead('meta', array('name' => 'keywords', 'content' => $this->view->data['pl_keywords']), '', false);
$breadcrumb = unserialize(Fw_Model::getInstance()->getModel('blocks')->getBreadCrumbs($this->name, $this->actionName));
array_push($breadcrumb, array('name' => $this->view->data['pl_title']));
$this->view->setBlocks(array('breadcrumbs' => array('data' => serialize($breadcrumb))));
} else {
$this->view->data = $this->model->getOrderProjects('new', 0, 10);
$this->view->setBlocks(array('breadcrumbs'));
}
$this->view->render();
}
示例4: indexAction
public function indexAction()
{
$id = Fw_Request::get('id', null);
if (!is_null($id)) {
$this->view->setLayout('donors', 'donor');
$this->view->data = $this->model->getDonor($id);
if (!isset($this->view->data['u_id']) || !is_numeric($this->view->data['u_id'])) {
throw new Fw_Exception('[f:"' . __FILE__ . '", l:"' . __LINE__ . '"] Страница не найдена', 404);
}
$name_bread = $this->view->data['u_surname'] . ' ' . $this->view->data['u_name'];
if (Fw_Auth::isValid() && Fw_Auth::get('id') == $id) {
$this->view->error = array();
$data = array();
$name = Fw_Request::post('u_name', null);
$antispam = Fw_Request::post('antispam', null);
$surname = Fw_Request::post('u_surname', null);
$address = Fw_Request::post('u_address', null);
$img = Fw_Request::getFile('u_img', null);
$information = Fw_Request::postNoHtml('u_information', 0, 1500);
if (!is_null($antispam)) {
if (!preg_match("/^[\\p{L}]{2,100}\$/ui", $name)) {
$this->view->error['u_name'] = C::getLanguageString('registration_only_chars_name');
}
$data['u_name'] = $name;
if (!preg_match("/^[\\p{L}]{2,100}\$/ui", $surname)) {
$this->view->error['u_surname'] = C::getLanguageString('registration_only_chars_surname');
}
$data['u_surname'] = $surname;
if (!empty($address)) {
if (!preg_match("/^[^\\s][\\.\\p{L}\\d\\,\\-\\s]{0,100}\$/ui", $address)) {
$this->view->error['u_address'] = C::getLanguageString('registration_only_chars_name');
}
$data['u_address'] = $address;
} else {
$data['u_address'] = '';
}
$data['u_information'] = !is_null($information) ? $information : '';
if (!is_null($img) && isset($img['name']) && !empty($img['name'])) {
$type = array_pop(explode(".", $img['name']));
if (in_array(strtolower($type), array('png', 'jpeg', 'jpg', 'gif'))) {
if ($img['size'] > 1024 * 1024 * 2) {
$this->view->error['u_img'] = C::getLanguageString('wrong_file_size');
} else {
$new_file_name = $data['u_img'] = sha1($img['name'] . time()) . '.' . $type;
$to_path = realpath(APPLICATION_PATH . '/../' . C::pub_dir . '/images') . C::ds . $new_file_name;
if (move_uploaded_file($img['tmp_name'], $to_path) === false) {
throw new Fw_Exception('[f:"' . __FILE__ . '", l:"' . __LINE__ . '"] Ошибка загрузки аватара', 500);
}
if (!empty($this->view->data['u_img']) && $this->view->data['u_img'] !== 'anonim_donor.jpg') {
$config = C::getConfig('img');
$del_file = realpath(APPLICATION_PATH . '/../' . C::pub_dir . '/images') . C::ds . $this->view->data['u_img'];
if (is_file($del_file)) {
unlink($del_file);
}
foreach ($config['size'] as $sizes) {
$del_file = realpath(APPLICATION_PATH . '/../' . C::pub_dir . '/images/cropr_' . $sizes) . C::ds . $this->view->data['u_img'];
if (is_file($del_file)) {
unlink($del_file);
}
}
}
}
} else {
$this->view->error['u_img'] = C::getLanguageString('wrong_file_format');
}
}
if (empty($this->view->error)) {
if (!Fw_Model::getInstance()->getModel('user')->updateUserData($data)) {
throw new Fw_Exception('[f:"' . __FILE__ . '", l:"' . __LINE__ . '"] Ошибка обновления данных пользователя', 500);
}
Fw_Request::redirect(C::uri(array('donors', $id)));
}
}
$this->view->antispam = base64_encode(time());
}
if (!empty($this->view->data['pl_description'])) {
$description = strip_tags($this->view->data['pl_description']);
$description = trim($description);
if (!empty($description)) {
if (mb_strlen($description, 'UTF-8') > 240) {
$description = substr($description, 0, 240) . '...';
}
$this->view->setHead('meta', array('name' => 'description', 'content' => $description), '', false);
}
}
$this->view->ru_lang_url = '/ru/donors/' . $this->view->data['u_id'] . DS;
$this->view->ua_lang_url = '/ua/donors/' . $this->view->data['u_id'] . DS;
$this->view->projects_data = $this->model->getProjectsByDonor($id);
$this->view->setHead('title', array(), $name_bread . ' ' . C::getLanguageString('donor_h1'), true);
$this->view->setHead('meta', array('name' => 'keywords', 'content' => strtolower(C::getLanguageString('donor')) . ', ' . $name_bread), '', false);
$breadcrumb = unserialize(Fw_Model::getInstance()->getModel('blocks')->getBreadCrumbs($this->name, $this->actionName));
if ($breadcrumb) {
array_push($breadcrumb, array('name' => $name_bread));
$this->view->setBlocks(array('breadcrumbs' => array('data' => serialize($breadcrumb))));
}
} else {
$this->view->data = $this->model->getOrderDonors('new', 0, 10);
$this->view->setBlocks(array('breadcrumbs'));
}
$this->view->render();
//.........这里部分代码省略.........