本文整理汇总了PHP中C::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP C::getConfig方法的具体用法?PHP C::getConfig怎么用?PHP C::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C
的用法示例。
在下文中一共展示了C::getConfig方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendMessage
protected function sendMessage($data)
{
$config = C::getConfig('application');
if ($config['contacts']['enable']) {
$to = $config['contacts']['email'];
$subject = "Биржа благотворительности Lovechernivtsi";
$message = '
<html>
<head>
<title>You have new feedback message!</title>
</head>
<body>
<p>Name: ' . $data['name'] . '</p>
<p>Email: ' . $data['email'] . '</p>
<p>Subject: ' . $data['subject'] . '</p>
<p>Text: ' . $data['text'] . '</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);
}
}
}
示例2: init
public function init()
{
$res = true;
$this->img_conf = C::getConfig('img');
$this->_def_width = 25;
$this->_def_height = 25;
$this->_def_img_name = 'default.jpg';
$this->_def_img_directory = 'images';
$this->_operation_arr = array('res', 'crop', 'cropr', 'cropg');
$this->_pic_path = realpath(APPLICATION_PATH . '/../' . C::pub_dir . '/images');
$params = array();
$params['name'] = Fw_Request::get('name', '');
$params['size'] = Fw_Request::get('size', '');
if (!empty($params['name'])) {
$this->_img_name = $params['name'];
} else {
$res = false;
}
if (!empty($params['size'])) {
$p_arr = explode('_', $params['size']);
if (!empty($p_arr[0]) && in_array($p_arr[0], $this->_operation_arr)) {
$this->_operation = $p_arr[0];
if (!empty($p_arr[1]) && in_array($p_arr[1], $this->img_conf['size'])) {
$size_arr = explode('x', $p_arr[1]);
if (is_numeric($size_arr[0]) && is_numeric($size_arr[1])) {
$this->_size[0] = (int) $size_arr[0];
$this->_size[1] = (int) $size_arr[1];
}
} else {
$res = false;
}
} else {
$res = false;
}
} else {
$res = false;
}
if (!$res) {
header("Status: 404 Not Found");
exit;
}
}
示例3: langAction
public function langAction()
{
$this->view->const = array();
if (Fw_Request::post('save', false)) {
$data = Fw_Request::post('data', NULL);
$html = array();
foreach ($data as $lang => $consts) {
$html[] = '[' . $lang . ']';
foreach ($consts as $const => $value) {
$html[] = $const . ' = "' . stripslashes(str_replace(array('"'), array("'"), html_entity_decode($value, ENT_QUOTES, "UTF-8"))) . '"';
}
}
C::saveConfig('language', implode("\n", $html));
}
$langs = C::getConfig('language', false);
foreach ($langs as $lang => $value) {
foreach ($value as $const => $translate) {
$this->view->const[$const][$lang] = htmlentities($translate, ENT_QUOTES, "UTF-8");
}
if (!in_array($lang, $this->view->langs)) {
$this->view->langs[] = $lang;
}
}
$this->view->render();
}
示例4: 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);
}
}
}
示例5: 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();
//.........这里部分代码省略.........