Example #1
0
 public function actionAdd($isFancy = 0)
 {
     $model = new Reviews();
     if (isset($_POST[$this->modelName])) {
         $model->attributes = $_POST[$this->modelName];
         if ($model->validate()) {
             if ($model->save(false)) {
                 $model->name = CHtml::encode($model->name);
                 $model->body = CHtml::encode($model->body);
                 $notifier = new Notifier();
                 $notifier->raiseEvent('onNewReview', $model);
                 if (Yii::app()->user->getState('isAdmin')) {
                     Yii::app()->user->setFlash('success', tt('success_send_not_moderation'));
                 } else {
                     Yii::app()->user->setFlash('success', tt('success_send'));
                 }
                 $this->redirect(array('index'));
             }
             $model->unsetAttributes(array('name', 'body', 'verifyCode'));
         } else {
             Yii::app()->user->setFlash('error', tt('failed_send'));
         }
         $model->unsetAttributes(array('verifyCode'));
     }
     if ($isFancy) {
         $this->excludeJs();
         $this->renderPartial('add', array('model' => $model), false, true);
     } else {
         $this->render('add', array('model' => $model));
     }
 }
Example #2
0
 public function index()
 {
     // Load dependencies
     $this->load->model('catalog/category');
     $this->load->model('common/log');
     $data = array();
     $this->document->setTitle(tt('Page not found'));
     // Generate categories menu
     $categories = $this->model_catalog_category->getCategories(null, $this->language->getId());
     $data['categories'] = array();
     foreach ($categories as $category) {
         // Get child categories
         $child = array();
         $child_categories = $this->model_catalog_category->getCategories($category->category_id, $this->language->getId(), true);
         foreach ($child_categories as $child_category) {
             if ($child_category->total_products) {
                 $child[] = array('category_id' => $child_category->category_id, 'title' => $child_category->title, 'href' => $this->url->link('catalog/category', 'category_id=' . $child_category->category_id), 'child' => array());
             }
         }
         // Get parent categories
         if ($child) {
             $data['categories'][] = array('category_id' => $category->category_id, 'title' => $category->title, 'href' => $this->url->link('catalog/category', 'category_id=' . $category->category_id), 'child' => $child);
         }
     }
     // Add error to the log
     $this->model_common_log->createLog404($this->auth->getId(), $this->request->getRequestString(), $this->request->getRequestReferrer());
     $data['footer'] = $this->load->controller('common/footer');
     $data['header'] = $this->load->controller('common/header');
     $data['href_common_information_faq'] = $this->url->link('common/information/faq');
     $data['href_catalog_search'] = $this->url->link('catalog/search');
     $data['module_breadcrumbs'] = $this->load->controller('module/breadcrumbs', array(array('name' => tt('Home'), 'href' => $this->url->link('common/home'), 'active' => true)));
     $this->response->addHeader($this->request->getServerProtocol() . '/1.1 404 Not Found');
     $this->response->setOutput($this->load->view('error/not_found.tpl', $data));
 }
Example #3
0
 public function team()
 {
     $this->document->setTitle(tt('Team'));
     $data['footer'] = $this->load->controller('common/footer');
     $data['header'] = $this->load->controller('common/header');
     $data['module_breadcrumbs'] = $this->load->controller('module/breadcrumbs', array(array('name' => tt('Home'), 'href' => $this->url->link('common/home'), 'active' => false), array('name' => tt('Team'), 'href' => $this->url->link('common/information/team'), 'active' => true)));
     // Contributors list
     $github = curl_init(GITHUB_API_URL_CONTRIBUTORS);
     curl_setopt($github, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
     curl_setopt($github, CURLOPT_USERAGENT, PROJECT_NAME);
     curl_setopt($github, CURLOPT_RETURNTRANSFER, true);
     $contributors = curl_exec($github);
     $data['contributions'] = 0;
     $data['contributors'] = array();
     if ($contributors) {
         foreach (json_decode($contributors, true) as $contributor) {
             if (isset($contributor['id'])) {
                 $data['contributions'] += $contributor['contributions'];
                 $data['contributors'][] = array('username' => $contributor['login'], 'href_avatar' => $contributor['avatar_url'], 'href_profile' => $contributor['html_url'], 'contributions' => $contributor['contributions']);
             } else {
                 if (isset($contributor['message'])) {
                     $this->security_log->write($contributor['message']);
                 }
             }
         }
     }
     $this->response->setOutput($this->load->view('common/information/team.tpl', $data));
 }
Example #4
0
 public function actionSaveSort()
 {
     $objTypeId = Yii::app()->request->getParam('id', NULL);
     $sort = Yii::app()->request->getParam('sort');
     if (count($sort) >= param('searchMaxField', 15)) {
         HAjax::jsonError(tt('Search max field ') . param('searchMaxField', 3));
     }
     if ($objTypeId !== NULL && $sort && is_array($sort)) {
         $elements = SearchForm::getSearchFields();
         $sql = "DELETE FROM {{search_form}} WHERE obj_type_id=:id AND status!=:status";
         Yii::app()->db->createCommand($sql)->execute(array(':id' => $objTypeId, ':status' => SearchFormModel::STATUS_NOT_REMOVE));
         $i = 3;
         foreach ($sort as $field) {
             if (!isset($elements[$field])) {
                 continue;
             }
             $search = new SearchFormModel();
             $search->attributes = array('obj_type_id' => $objTypeId, 'field' => $field, 'status' => $elements[$field]['status'], 'sorter' => $i, 'formdesigner_id' => isset($elements[$field]['formdesigner_id']) ? $elements[$field]['formdesigner_id'] : 0);
             $search->save();
             $i++;
         }
         // delete assets js cache
         ConfigurationModel::clearGenerateJSAssets();
         HAjax::jsonOk();
     }
     HAjax::jsonError();
 }
Example #5
0
 public function index()
 {
     $this->document->setTitle(tt('BitsyBay - Sell and Buy Digital Content with BitCoin'), false);
     if (isset($this->request->get['route'])) {
         $this->document->addLink(HTTP_SERVER, 'canonical');
     }
     if ($this->auth->isLogged()) {
         $data['title'] = sprintf(tt('Welcome, %s!'), $this->auth->getUsername());
         $data['user_is_logged'] = true;
     } else {
         $data['title'] = tt('Welcome to the BitsyBay store!');
         $data['user_is_logged'] = false;
     }
     $total_products = $this->model_catalog_product->getTotalProducts(array());
     $data['total_products'] = sprintf(tt('%s %s'), $total_products, plural($total_products, array(tt('offer'), tt('offers'), tt('offers'))));
     $total_categories = $this->model_catalog_category->getTotalCategories();
     $data['total_categories'] = sprintf(tt('%s %s'), $total_categories, plural($total_categories, array(tt('category'), tt('categories'), tt('categories'))));
     $total_sellers = $this->model_account_user->getTotalSellers();
     $data['total_sellers'] = sprintf(tt('%s %s'), $total_sellers, plural($total_sellers, array(tt('seller'), tt('sellers'), tt('sellers'))));
     $total_buyers = $this->model_account_user->getTotalUsers();
     $data['total_buyers'] = sprintf(tt('%s %s'), $total_buyers, plural($total_buyers, array(tt('buyer'), tt('buyers'), tt('buyers'))));
     $redirect = base64_encode($this->url->getCurrentLink($this->request->getHttps()));
     $data['login_action'] = $this->url->link('account/account/login', 'redirect=' . $redirect, 'SSL');
     $data['href_account_create'] = $this->url->link('account/account/create', 'redirect=' . $redirect, 'SSL');
     $data['module_search'] = $this->load->controller('module/search', array('class' => 'col-lg-8 col-lg-offset-2'));
     $data['module_latest'] = $this->load->controller('module/latest', array('limit' => 8));
     $data['footer'] = $this->load->controller('common/footer');
     $data['header'] = $this->load->controller('common/header');
     $this->response->setOutput($this->load->view('common/home.tpl', $data));
 }
Example #6
0
 public function actionAdd($isFancy = 0)
 {
     $model = new Vacancy();
     if (isset($_POST[$this->modelName]) && BlockIp::checkAllowIp(Yii::app()->controller->currentUserIpLong)) {
         $model->attributes = $_POST[$this->modelName];
         if ($model->validate()) {
             $model->user_ip = Yii::app()->controller->currentUserIp;
             $model->user_ip_ip2_long = Yii::app()->controller->currentUserIpLong;
             if ($model->save(false)) {
                 $model->name = CHtml::encode($model->name);
                 $model->body = CHtml::encode($model->body);
                 $notifier = new Notifier();
                 $notifier->raiseEvent('onNewReview', $model);
                 if (Yii::app()->user->checkAccess('vacancy_admin')) {
                     Yii::app()->user->setFlash('success', tt('success_send_not_moderation'));
                 } else {
                     Yii::app()->user->setFlash('success', tt('success_send'));
                 }
                 $this->redirect(array('index'));
             }
             $model->unsetAttributes(array('name', 'body', 'verifyCode'));
         } else {
             Yii::app()->user->setFlash('error', tt('failed_send'));
         }
         $model->unsetAttributes(array('verifyCode'));
     }
     if ($isFancy) {
         $this->excludeJs();
         $this->renderPartial('add', array('model' => $model), false, true);
     } else {
         $this->render('add', array('model' => $model));
     }
 }
Example #7
0
 public function actionSearch($type = 'all')
 {
     if (!param('useShowUserInfo')) {
         throw new CHttpException(403, tt('Displays information about the users is disabled by the administrator', 'users'));
     }
     $usersListPage = Menu::model()->findByPk(Menu::USERS_LIST_ID);
     if ($usersListPage) {
         if ($usersListPage->active == 0) {
             throw404();
         }
     }
     $this->showSearchForm = false;
     $existTypes = User::getTypeList('withAll');
     $criteria = new CDbCriteria();
     $type = in_array($type, array_keys($existTypes)) ? $type : 'all';
     //$criteria->compare('active', 1);
     if ($type != 'all') {
         $criteria->compare('type', $type);
     }
     //$criteria->compare('isAdmin', 0);
     $criteria->with = array('countAdRel');
     $sort = new CSort();
     $sort->sortVar = 'sort';
     $sort->defaultOrder = 'date_created DESC';
     $sort->multiSort = true;
     $sort->attributes = array('username' => array('label' => tc('by username'), 'default' => 'desc'), 'date_created' => array('label' => tc('by date of registration'), 'default' => 'desc'));
     $dataProvider = new CActiveDataProvider(User::model()->active(), array('criteria' => $criteria, 'sort' => $sort, 'pagination' => array('pageSize' => 12)));
     $this->render('search', array('dataProvider' => $dataProvider, 'type' => $type));
 }
Example #8
0
 public function actionCreate()
 {
     $model = new FormDesigner();
     $model->scenario = 'advanced';
     $model->type = FormDesigner::TYPE_TEXT;
     $translate = new TranslateMessage();
     if (isset($_POST['FormDesigner'])) {
         $model->attributes = $_POST['FormDesigner'];
         if ($model->validate()) {
             // magic begin
             $this->fieldName = translit($model->getStrByLang('label'), '_', true);
             $this->fieldName = substr($this->fieldName, 0, 12);
             if ($this->setFieldInTable($_POST['FormDesigner']['type'])) {
                 $model->field = $this->fieldName;
                 $translate->attributes = $_POST['TranslateMessage'];
                 $translate->category = 'common';
                 $translate->message = 'Search by ' . $this->fieldName;
                 if ($translate->save()) {
                     $model->save();
                     Yii::app()->cache->flush();
                     Yii::app()->user->setFlash('success', tt('The new field is successfully created.'));
                     $this->redirect(Yii::app()->createUrl('/formdesigner/backend/main/admin'));
                 }
             } else {
                 $model->addError('', tt('Failed to create field'));
             }
         }
     }
     $this->render('create', array('model' => $model, 'translate' => $translate));
 }
 public function doEditAppInfo()
 {
     $id = I('post.app_id', null);
     if (!is_null(I('post.app_title', null))) {
         $data['app_title'] = tt(I('post.app_title'));
     }
     if (!is_null('post.app_author', null)) {
         $data['app_author'] = tt(I('post.app_author'));
     }
     if (!is_null('post.app_admin_layout', null)) {
         $data['app_admin_layout'] = intval(I('post.app_admin_layout'));
     }
     if (!is_null('post.app_admin_entrance', null)) {
         $data['app_admin_entrance'] = tt(I('post.app_admin_entrance'));
     }
     if (!is_null('post.app_version', null)) {
         $data['app_version'] = tt(I('post.app_version'));
     }
     if (!is_null('post.app_desc', null)) {
         $data['app_desc'] = tt(I('post.app_desc'));
     }
     $data['app_id'] = intval(I('post.app_id'));
     $res = D('Admin/App')->save($data);
     if (!$res) {
         $this->error(L('ERR_SAVE_FAIL'));
     } else {
         $this->success(L('MSG_SAVE_SUCCESS'), U('Admin/Admin/dispApps'));
     }
 }
Example #10
0
 /**
  * @brief Channels admin page.
  *
  * @param App &$a
  */
 function post()
 {
     $channels = x($_POST, 'channel') ? $_POST['channel'] : array();
     check_form_security_token_redirectOnErr('/admin/channels', 'admin_channels');
     $xor = db_getfunc('^');
     if (x($_POST, 'page_channels_block')) {
         foreach ($channels as $uid) {
             q("UPDATE channel SET channel_pageflags = ( channel_pageflags {$xor} %d ) where channel_id = %d", intval(PAGE_CENSORED), intval($uid));
             \Zotlabs\Daemon\Master::Summon(array('Directory', $uid, 'nopush'));
         }
         notice(sprintf(tt("%s channel censored/uncensored", "%s channels censored/uncensored", count($channels)), count($channels)));
     }
     if (x($_POST, 'page_channels_code')) {
         foreach ($channels as $uid) {
             q("UPDATE channel SET channel_pageflags = ( channel_pageflags {$xor} %d ) where channel_id = %d", intval(PAGE_ALLOWCODE), intval($uid));
         }
         notice(sprintf(tt("%s channel code allowed/disallowed", "%s channels code allowed/disallowed", count($channels)), count($channels)));
     }
     if (x($_POST, 'page_channels_delete')) {
         foreach ($channels as $uid) {
             channel_remove($uid, true);
         }
         notice(sprintf(tt("%s channel deleted", "%s channels deleted", count($channels)), count($channels)));
     }
     goaway(z_root() . '/admin/channels');
 }
Example #11
0
 public function index()
 {
     $this->document->setTitle(tt('BitsyBay - Sell and Buy Digital Creative with BitCoin'), false);
     $this->document->setDescription(tt('BTC Marketplace for royalty-free photos, arts, templates, codes, books and other digital creative with BitCoin. Only quality and legal content from them authors. Free seller fee up to 2016!'));
     $this->document->setKeywords(tt('bitsybay, bitcoin, btc, indie, marketplace, store, buy, sell, royalty-free, photos, arts, illustrations, 3d, templates, codes, extensions, books, content, digital, creative, quality, legal'));
     if (isset($this->request->get['route'])) {
         $this->document->addLink(URL_BASE, 'canonical');
     }
     if ($this->auth->isLogged()) {
         $data['title'] = sprintf(tt('Welcome, %s!'), $this->auth->getUsername());
         $data['user_is_logged'] = true;
     } else {
         $data['title'] = tt('Welcome to the BitsyBay store!');
         $data['user_is_logged'] = false;
     }
     $total_products = $this->model_catalog_product->getTotalProducts(array());
     $data['total_products'] = sprintf(tt('%s %s'), $total_products, plural($total_products, array(tt('offer'), tt('offers'), tt('offers'))));
     $total_categories = $this->model_catalog_category->getTotalCategories();
     $data['total_categories'] = sprintf(tt('%s %s'), $total_categories, plural($total_categories, array(tt('category'), tt('categories'), tt('categories'))));
     $total_sellers = $this->model_account_user->getTotalSellers();
     $data['total_sellers'] = sprintf(tt('%s %s'), $total_sellers, plural($total_sellers, array(tt('sellers'), tt('sellers'), tt('sellers'))));
     $total_buyers = $this->model_account_user->getTotalUsers();
     $data['total_buyers'] = sprintf(tt('%s %s'), $total_buyers, plural($total_buyers, array(tt('buyers'), tt('buyers'), tt('buyers'))));
     $redirect = base64_encode($this->url->getCurrentLink());
     $data['login_action'] = $this->url->link('account/account/login', 'redirect=' . $redirect);
     $data['href_account_create'] = $this->url->link('account/account/create', 'redirect=' . $redirect);
     $data['module_search'] = $this->load->controller('module/search', array('class' => 'col-lg-8 col-lg-offset-2'));
     $data['module_latest'] = $this->load->controller('module/latest', array('limit' => 4));
     $data['footer'] = $this->load->controller('common/footer');
     $data['header'] = $this->load->controller('common/header');
     $this->response->setOutput($this->load->view('common/home.tpl', $data));
 }
Example #12
0
 public function actionCreate()
 {
     $this->setActiveMenu('add_ad');
     $this->modelName = 'Apartment';
     $model = new $this->modelName();
     $user = User::model()->findByPk(Yii::app()->user->id);
     if (preg_match("/null\\.io/i", $user->email)) {
         Yii::app()->user->setFlash('error', tt('You can not add listings till you specify your valid email.', 'socialauth'));
         $this->redirect(array('/usercpanel/main/index', 'from' => 'userads'));
     } elseif (!$user->phone) {
         Yii::app()->user->setFlash('error', tt('You can not add listings till you specify your phone number.', 'socialauth'));
         $this->redirect(array('/usercpanel/main/index', 'from' => 'userads'));
     }
     $model->active = Apartment::STATUS_DRAFT;
     $model->owner_active = Apartment::STATUS_ACTIVE;
     if (issetModule('tariffPlans') && issetModule('paidservices')) {
         $return = TariffPlans::checkAllowUserActivateAd(Yii::app()->user->id, true, '>=');
         if ($return === false) {
             $model->owner_active = Apartment::STATUS_INACTIVE;
         }
     }
     $model->setDefaultType();
     $model->save(false);
     $this->redirect(array('update', 'id' => $model->id));
 }
Example #13
0
 public static function getLocationArray()
 {
     $locations = Location::model()->findAll();
     $list = CHtml::listData($locations, 'id', 'name');
     $chooseTranslate = tt("Choose location", 'apartments');
     array_unshift($list, $chooseTranslate);
     return $list;
 }
Example #14
0
 public function faq()
 {
     $this->document->setTitle(tt('General F.A.Q'));
     $data['footer'] = $this->load->controller('common/footer');
     $data['header'] = $this->load->controller('common/header');
     $data['module_breadcrumbs'] = $this->load->controller('module/breadcrumbs', array(array('name' => tt('Home'), 'href' => $this->url->link('common/home'), 'active' => false), array('name' => tt('General F.A.Q'), 'href' => $this->url->link('common/information/faq'), 'active' => true)));
     $this->response->setOutput($this->load->view('common/information/faq.tpl', $data));
 }
 public function logoutrecover()
 {
     if (Session::get('fpwd_timestamp', null) === null) {
         tt('No direct access.. Go back');
     }
     Session::forget('fpwd_userinfo');
     Session::forget('fpwd_timestamp');
     return Redirect::route('home');
 }
Example #16
0
 public function time2()
 {
     echo tt();
     //outer,优先类外的和系统的
     echo '<br/>';
     echo $this->tt();
     //inner,限制在类里的func
     echo '<br/>';
 }
Example #17
0
 public static function apTypes()
 {
     $result = Apartment::getApTypes();
     if (Yii::app()->theme->name == 'atlas') {
         $types = array(0 => Yii::t('common', 'Type of listing'));
     } else {
         $types = array(0 => Yii::t('common', 'Please select'));
     }
     if (param('useTypeSale', 1)) {
         if (in_array(Apartment::PRICE_SALE, $result)) {
             $types[Apartment::PRICE_SALE] = utf8_ucfirst(tt('Sale', 'apartments'));
         }
     }
     if (param('useTypeBuy', 1)) {
         if (in_array(Apartment::PRICE_BUY, $result)) {
             $types[Apartment::PRICE_BUY] = utf8_ucfirst(tt('Buy a', 'apartments'));
         }
     }
     if (param('useTypeRenting', 1)) {
         if (in_array(Apartment::PRICE_RENTING, $result)) {
             $types[Apartment::PRICE_RENTING] = utf8_ucfirst(tt('Rent a', 'apartments'));
         }
     }
     if (param('useTypeChange', 1)) {
         if (in_array(Apartment::PRICE_CHANGE, $result)) {
             $types[Apartment::PRICE_CHANGE] = utf8_ucfirst(tt('Exchange', 'apartments'));
         }
     }
     if (param('useTypeRentDay', 1)) {
         if (in_array(Apartment::PRICE_PER_DAY, $result)) {
             $types[Apartment::PRICE_PER_DAY] = utf8_ucfirst(tc('rent by the day'));
         }
     }
     if (param('useTypeRentHour', 1)) {
         if (in_array(Apartment::PRICE_PER_HOUR, $result)) {
             $types[Apartment::PRICE_PER_HOUR] = utf8_ucfirst(tc('rent by the hour'));
         }
     }
     if (param('useTypeRentMonth', 1)) {
         if (in_array(Apartment::PRICE_PER_MONTH, $result)) {
             $types[Apartment::PRICE_PER_MONTH] = utf8_ucfirst(tc('rent by the month'));
         }
     }
     if (param('useTypeRentWeek', 1)) {
         if (in_array(Apartment::PRICE_PER_WEEK, $result)) {
             $types[Apartment::PRICE_PER_WEEK] = utf8_ucfirst(tc('rent by the week'));
         }
     }
     $return['propertyType'] = $types;
     if (issetModule('selecttoslider') && param('usePriceSlider') == 1) {
         $return['currencyTitle'] = array(Yii::t('common', 'Price range') . ':', Yii::t('common', 'Price range') . ':', Yii::t('common', 'Price range') . ':', Yii::t('common', 'Price range') . ':', Yii::t('common', 'Price range') . ':', Yii::t('common', 'Price range') . ':');
     } else {
         $return['currencyTitle'] = array(Yii::t('common', 'Payment to'), Yii::t('common', 'Payment to'), Yii::t('common', 'Fee up to'), Yii::t('common', 'Fee up to'), Yii::t('common', 'Fee up to'), Yii::t('common', 'Fee up to'));
     }
     return $return;
 }
Example #18
0
 public function index()
 {
     $data = array();
     $data['alert_warning'] = false;
     // Verification required
     if (!$this->auth->isApproved()) {
         $data['alert_warning'] = $this->load->controller('common/alert/warning', tt('You need to verify your email address. Please, check your new mailbox and follow the link below to complete.'));
     }
     return $this->load->view('module/verification.tpl', $data);
 }
Example #19
0
 function removethreadsForEntity($entity_id, $entity_type)
 {
     try {
         $num_deleted = db_delete('soc_comments')->condition('entity_id', $entity_id)->condition('entity_type', $entity_type)->execute();
         // fail silently if no record/s found
     } catch (Exception $e) {
         drupal_set_message(tt(' We could not delete the comments for this %1$s', t_type($entity_type)) . (_DEBUG ? $ex->getMessage() : ''), 'error');
         return FALSE;
     }
 }
Example #20
0
 public function quickView($id)
 {
     $msg = Message::where('id', '=', $id);
     $msgx = $msg->where('to', '=', Auth::user()->id)->get()->toArray();
     $msgx = empty($msgx) ? tt('Access denied to this message') : $msgx[0];
     //tt($msg->get()->toArray());
     $msg->update(array('checked' => 1));
     //tt($msg);
     $data['msg'] = $msgx;
     return View::make('quickview_messagealert', $data);
 }
Example #21
0
 public function processPayment(Payments $payment)
 {
     $user = User::model()->findByPk($payment->user_id);
     if (!$user || $user->balance < $payment->amount) {
         return array('status' => Paysystem::RESULT_ERROR, 'message' => tt('Payment error', 'payment'));
     }
     if ($user->deductBalance($payment->amount) && $payment->complete()) {
         return array('status' => Paysystem::RESULT_OK, 'message' => tt('The payment is successfully completed. The paid service has been activated.', 'payment'));
     }
     return array('status' => Paysystem::RESULT_ERROR, 'message' => tt('Payment error', 'payment'));
 }
Example #22
0
 public function processPayment(Payments $payment)
 {
     $payment->status = Payments::STATUS_WAITOFFLINE;
     $payment->update(array('status'));
     try {
         $notifier = new Notifier();
         $notifier->raiseEvent('onOfflinePayment', $payment);
     } catch (CHttpException $e) {
     }
     return array('status' => Paysystem::RESULT_OK, 'message' => tt('Thank you! Notification of your payment sent to the administrator.', 'payment'));
 }
Example #23
0
 public function actionDelete($id)
 {
     if ($id == InfoPages::MAIN_PAGE_ID || $id == InfoPages::LICENCE_PAGE_ID) {
         Yii::app()->user->setFlash('error', tt('backend_menumanager_main_admin_noDeleteSystemItem', 'menumanager'));
         $this->redirect('admin');
     }
     if (Yii::app()->cache->get('menu')) {
         Yii::app()->cache->delete('menu');
     }
     parent::actionDelete($id);
 }
Example #24
0
 function post()
 {
     if (!local_channel()) {
         notice(t('Permission denied.') . EOL);
         return;
     }
     check_form_security_token_redirectOnErr('/', 'send_invite');
     $max_invites = intval(get_config('system', 'max_invites'));
     if (!$max_invites) {
         $max_invites = 50;
     }
     $current_invites = intval(get_pconfig(local_channel(), 'system', 'sent_invites'));
     if ($current_invites > $max_invites) {
         notice(t('Total invitation limit exceeded.') . EOL);
         return;
     }
     $recips = x($_POST, 'recipients') ? explode("\n", $_POST['recipients']) : array();
     $message = x($_POST, 'message') ? notags(trim($_POST['message'])) : '';
     $total = 0;
     if (get_config('system', 'invitation_only')) {
         $invonly = true;
         $x = get_pconfig(local_channel(), 'system', 'invites_remaining');
         if (!$x && !is_site_admin()) {
             return;
         }
     }
     foreach ($recips as $recip) {
         $recip = trim($recip);
         if (!$recip) {
             continue;
         }
         if (!valid_email($recip)) {
             notice(sprintf(t('%s : Not a valid email address.'), $recip) . EOL);
             continue;
         } else {
             $nmessage = $message;
         }
         $account = \App::get_account();
         $res = mail($recip, sprintf(t('Please join us on $Projectname'), \App::$config['sitename']), $nmessage, "From: " . $account['account_email'] . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-transfer-encoding: 8bit');
         if ($res) {
             $total++;
             $current_invites++;
             set_pconfig(local_channel(), 'system', 'sent_invites', $current_invites);
             if ($current_invites > $max_invites) {
                 notice(t('Invitation limit exceeded. Please contact your site administrator.') . EOL);
                 return;
             }
         } else {
             notice(sprintf(t('%s : Message delivery failed.'), $recip) . EOL);
         }
     }
     notice(sprintf(tt("%d message sent.", "%d messages sent.", $total), $total) . EOL);
     return;
 }
Example #25
0
 public function actionDeleteImg($id)
 {
     $model = $this->loadModel($id);
     $model->delImage();
     $model->bg_image = '';
     if ($model->update('bg_image')) {
         Yii::app()->user->setFlash('success', tt('Image successfully deleted', 'themes'));
     } else {
         Yii::app()->user->setFlash('error', HAjax::implodeModelErrors($model));
     }
     $this->redirect(array('update', 'id' => $id));
 }
Example #26
0
function findpeople_widget()
{
    $a = get_app();
    $inv = $a->config['register_policy'] != REGISTER_CLOSED ? t('Invite Friends') : '';
    if (get_config('system', 'invitation_only')) {
        $x = get_pconfig(local_user(), 'system', 'invites_remaining');
        if ($x || is_site_admin()) {
            $a->page['aside'] .= '<div class="side-link" id="side-invite-remain">' . sprintf(tt('%d invitation available', '%d invitations available', $x), $x) . '</div>' . $inv;
        }
    }
    return replace_macros(get_markup_template('peoplefind.tpl'), array('$findpeople' => t('Find People'), '$desc' => t('Enter name or interest'), '$label' => t('Connect/Follow'), '$hint' => t('Examples: Robert Morgenstein, Fishing'), '$findthem' => t('Find'), '$suggest' => t('Friend Suggestions'), '$similar' => t('Similar Interests'), '$inv' => $inv));
}
Example #27
0
 public static function getClientsStatesArray($withAll = false)
 {
     $state = array();
     if ($withAll) {
         $state[''] = Yii::t('common', 'All');
     }
     $state[self::STATE_WITH_OUR_HELP] = tt('Live with our help', 'clients');
     $state[self::STATE_ACCOMMODATING] = tt('Accommodating', 'clients');
     $state[self::STATE_INDEPENDENTLY] = tt('Independently', 'clients');
     $state[self::STATE_IGNORE] = tt('Ignore', 'clients');
     return $state;
 }
Example #28
0
 public function index()
 {
     $this->document->setTitle(tt('BitsyBay - Be Your Own Bitcoin Marketplace. Shop Directly.'), false);
     $this->document->setDescription(tt('BTC Marketplace for royalty-free photos, arts, templates, codes, books and other digital creative with BitCoin. Only quality and legal content from them authors. Buy with Bitcoin. Sell online. Open your own virtual store.'));
     $this->document->setKeywords(tt('bitsybay, bitcoin, btc, indie, marketplace, store, buy, sell, royalty-free, photos, arts, illustrations, 3d, templates, codes, extensions, books, content, digital, creative, quality, legal'));
     $this->document->addLink($this->url->link('common/home'), 'canonical');
     if ($this->auth->isLogged()) {
         $data['title'] = sprintf(tt('Welcome, %s!'), $this->auth->getUsername());
         $data['user_is_logged'] = true;
     } else {
         $data['title'] = tt('Welcome to the BitsyBay store!');
         $data['user_is_logged'] = false;
     }
     // Show SEO description for guests (and search engines)
     if (!$this->auth->isLogged()) {
         // Get tags
         $tags = array();
         foreach ($this->model_catalog_tag->getTags(array('limit' => 15, 'order' => 'RAND()'), $this->language->getId()) as $category_tag) {
             $tags[$category_tag->name] = $category_tag->name;
         }
         // Get active categories
         $categories = array();
         foreach ($this->model_catalog_category->getCategories(null, $this->language->getId()) as $category) {
             $categories[$category->title] = mb_strtolower($category->title);
             // Get child categories
             foreach ($this->model_catalog_category->getCategories($category->category_id, $this->language->getId(), true) as $child_category) {
                 if ($child_category->total_products) {
                     $categories[$child_category->title] = mb_strtolower($child_category->title);
                 }
             }
         }
         $data['description'] = sprintf(tt('%s is a simple and minimalistic marketplace to help you buy and or sell creative digital products with cryptocurrency like BitCoin. %s provides only high-quality offers from verified authors. It\'s include a BTC marketplace for %s about %s. Buy or sell original content with Bitcoin fast, directly and safely from any country without compromises!'), PROJECT_NAME, PROJECT_NAME, implode(', ', $categories), implode(', ', $tags));
     } else {
         $data['description'] = false;
     }
     $total_products = $this->model_catalog_product->getTotalProducts(array());
     $data['total_products'] = sprintf(tt('%s %s'), $total_products, plural($total_products, array(tt('original high-quality offer'), tt('original high-quality offers'), tt('original high-quality offers '))));
     $total_categories = $this->model_catalog_category->getTotalCategories();
     $data['total_categories'] = sprintf(tt('%s %s'), $total_categories, plural($total_categories, array(tt('category'), tt('categories'), tt('categories '))));
     $total_sellers = $this->model_account_user->getTotalSellers();
     $data['total_sellers'] = sprintf(tt('%s %s'), $total_sellers, plural($total_sellers, array(tt('verified seller'), tt('verified sellers'), tt('verified sellers '))));
     $total_buyers = $this->model_account_user->getTotalUsers();
     $data['total_buyers'] = sprintf(tt('%s %s'), $total_buyers, plural($total_buyers, array(tt('buyer'), tt('buyers'), tt('buyers '))));
     $redirect = urlencode($this->url->getCurrentLink());
     $data['login_action'] = $this->url->link('account/account/login', 'redirect=' . $redirect);
     $data['href_account_create'] = $this->url->link('account/account/create', 'redirect=' . $redirect);
     $data['module_search'] = $this->load->controller('module/search', array('class' => 'col-lg-8 col-lg-offset-2'));
     $data['module_latest'] = $this->load->controller('module/latest', array('limit' => 4));
     $data['footer'] = $this->load->controller('common/footer');
     $data['header'] = $this->load->controller('common/header');
     $this->response->setOutput($this->load->view('common/home.tpl', $data));
 }
Example #29
0
 public function actionDeleteComment()
 {
     $return['status'] = 0;
     $id = Yii::app()->request->getPost('id');
     $model = $this->loadModel($id);
     if (!$model || $model->owner_id != Yii::app()->user->id && !Yii::app()->user->checkAccess('backend_access')) {
         $return['message'] = tt('commentNotFound', 'comments');
     } else {
         $model->delete();
         $return['status'] = 1;
     }
     echo CJavaScript::jsonEncode($return);
 }
Example #30
0
 private function _validatePost()
 {
     if (!isset($this->request->post['email']) || empty($this->request->post['email'])) {
         $this->_error['email'] = tt('Email is required');
     }
     if (!isset($this->request->post['subject']) || empty($this->request->post['subject'])) {
         $this->_error['subject'] = tt('Subject is required');
     }
     if (!isset($this->request->post['message']) || empty($this->request->post['message'])) {
         $this->_error['message'] = tt('Message is required');
     }
     return !$this->_error;
 }