Example #1
0
 /**
  * Updates the homestead.yaml file to include the new folder.
  *
  * @param $group
  */
 protected function updateHomesteadConfig($group)
 {
     $config = $this->yaml->parse($this->filesystem->get(setting('userDir') . '/.homestead/Homestead.yaml'));
     // Add the group to the folder config
     $config['folders'][] = ['map' => $group->starting_path, 'to' => vagrantDirectory($group->starting_path)];
     app(Homestead::class)->saveHomesteadConfig($config);
 }
Example #2
0
/**
* Registration Form Template Plugin
*
* Assists in the creation of registration forms
*
* @param string $return The relative or absolute URL to return to after registering
*/
function smarty_block_registration_form($params, $tagdata, &$smarty, &$repeat)
{
    if (!isset($params['var'])) {
        show_error('You must specify a "var" parameter for template {registration_form} calls.  This parameter specifies the variable name for the returned array.');
    } else {
        $variables = array();
        // get return URL
        if (isset($params['return']) and !empty($params['return'])) {
            $variables['return'] = query_value_encode($params['return']);
        } else {
            $variables['return'] = '';
        }
        // form action
        $variables['form_action'] = site_url('users/post_registration');
        if (setting('ssl_certificate') == '1') {
            $variables['form_action'] = secure($variables['form_action']);
        }
        // populated values
        $variables['first_name'] = $smarty->CI->input->post('firstname');
        $variables['last_name'] = $smarty->CI->input->post('last_name');
        $variables['email'] = $smarty->CI->input->post('email');
        $variables['username'] = $smarty->CI->input->post('username');
        $custom_fields = $smarty->CI->user_model->get_custom_fields(array('registration_form' => TRUE, 'not_in_admin' => TRUE));
        $variables['custom_fields'] = $custom_fields;
        if (is_array($custom_fields)) {
            foreach ($custom_fields as $field) {
                $variables[$field['name']] = $smarty->CI->input->post($field['name']);
            }
        }
        $smarty->assign($params['var'], $variables);
        echo $tagdata;
    }
}
 /**
  * Send email for contact form
  *
  * @param array $data
  */
 public function contact(array $data)
 {
     $email = setting('email.support');
     $subject = 'Contact: ' . $data['subject'];
     $view = 'emails.contact';
     $this->send($view, $data, $subject, $email);
 }
 public function unexpire($register_key)
 {
     $this->_database->set('timeout', date('Y-m-d H:i:s', strtotime('+' . setting('Register.Email Activation Expire') . ' minutes')));
     $this->_database->set('expired', 0);
     $this->_database->where('register_key', $register_key);
     return $this->_database->update($this->table);
 }
Example #5
0
    /**
     * Output Admin
     *
     * Returns the field with it's <label> in an <li> suitable for the admin forms.
     *
     * @return string $return The HTML to be included in a form
     */
    function output_admin()
    {
        $attributes = $this->output_shared();
        $this->help = 'Maximum filesize for web upload: ' . setting('upload_max') . '.  ' . $this->help;
        $help = '<div class="help">' . $this->help . '</div>';
        // create text that appears after the upload box
        $after_box = '<input type="button" class="button" onclick="javascript:$(\'#ftp_notes_' . $this->name . '\').modal(); void(0);" name="" value="Upload via FTP" />';
        // show current file
        if (!empty($this->value)) {
            if (in_array(file_extension($this->value), array('jpg', 'jpeg', 'gif', 'bmp', 'png'))) {
                $this->CI->load->helper('image_thumb');
                $after_box .= '<br /><a href="' . site_url($this->value) . '"><img style="margin-left: 150px" src="' . image_thumb(FCPATH . $this->value, 100, 100) . '" alt="preview" /></a>';
            } else {
                $after_box .= '&nbsp;&nbsp;&nbsp;<a href="' . site_url($this->value) . '">current file</a>';
            }
            $after_box .= '<br /><input style="margin-left: 150px" type="checkbox" name="delete_file_' . $this->name . '" value="1" /> <span style="font-style: italic; color: #ff6464">Delete current ' . $this->label . '</span>';
        }
        // build HTML
        // we can track an already-uploaded filename with a hidden field so, if we
        // don't have a new upload, we stick with the file we already have
        $return = '<li>
						<label for="' . $this->name . '">' . $this->label . '</label>
						<input type="hidden" name="' . $this->name . '_uploaded" value="' . $this->value . '" />
						<input type="hidden" name="' . $this->name . '_ftp" value="" />
						<input ' . $attributes . ' /> ' . $after_box . '
						' . $help . '
						
						<!-- hidden modal window for assigning FTP filenames -->
							<div class="modal" style="height:200px" id="ftp_notes_' . $this->name . '">
							<script type="text/javascript">
								$(document).ready(function() {
									$(\'input[name="' . $this->name . '_ftp_input"]\').keyup(function () {
										$(\'input[name="' . $this->name . '_ftp"]\').val($(this).val());
									});
								});
							</script>
							<h3>Upload File via FTP</h3>
								<ul class="form">
									<li>
										To upload your file via FTP, follow the directions below:
									</li>
									<li>
										<b>1)</b> Connect to your FTP server with your favourite <a class="tooltip" title="An FTP client, such as \'FileZilla\', is an application you download on your computer that connects to FTP server and uploads/downloads files." href="javascript:void(0)">FTP client</a>.
									</li>
									<li>
										<b>2)</b> Upload your file to <span class="code">' . $this->upload_directory . '</span>.
									</li>
									<li>
										<b>3)</b> Enter your uploaded filename here: <input type="text" name="' . $this->name . '_ftp_input" /> (e.g., "myfile.pdf").
									</li>
									<li>
										<b>4)</b> Close this window
									</li>
								</ul>
							</div>
						<!-- end hidden modal window -->
						
					</li>';
        return $return;
    }
 public function get_variables($extra = [])
 {
     ci()->load->model('c_snippet_model');
     $variables_set_b = setting('paths');
     $variables_set_a = $this->c_snippet_model->catalog('name', 'value');
     return array_merge($variables_set_b, $variables_set_a, ['base_url' => trim(base_url(), '/'), 'year' => date('Y')], (array) $extra);
 }
Example #7
0
 /**
  * Saves a new image
  * @param string $imageName
  * @param string $imageData
  * @param string $type
  * @param int $uploadedTo
  * @return Image
  * @throws ImageUploadException
  */
 private function saveNew($imageName, $imageData, $type, $uploadedTo = 0)
 {
     $storage = $this->getStorage();
     $secureUploads = setting('app-secure-images');
     $imageName = str_replace(' ', '-', $imageName);
     if ($secureUploads) {
         $imageName = str_random(16) . '-' . $imageName;
     }
     $imagePath = '/uploads/images/' . $type . '/' . Date('Y-m-M') . '/';
     if ($this->isLocal()) {
         $imagePath = '/public' . $imagePath;
     }
     while ($storage->exists($imagePath . $imageName)) {
         $imageName = str_random(3) . $imageName;
     }
     $fullPath = $imagePath . $imageName;
     try {
         $storage->put($fullPath, $imageData);
         $storage->setVisibility($fullPath, 'public');
     } catch (Exception $e) {
         throw new ImageUploadException('Image Path ' . $fullPath . ' is not writable by the server.');
     }
     if ($this->isLocal()) {
         $fullPath = str_replace_first('/public', '', $fullPath);
     }
     $imageDetails = ['name' => $imageName, 'path' => $fullPath, 'url' => $this->getPublicUrl($fullPath), 'type' => $type, 'uploaded_to' => $uploadedTo];
     if (user()->id !== 0) {
         $userId = user()->id;
         $imageDetails['created_by'] = $userId;
         $imageDetails['updated_by'] = $userId;
     }
     $image = Image::forceCreate($imageDetails);
     return $image;
 }
Example #8
0
 function index()
 {
     require APPPATH . 'modules/twitter/libraries/twitteroauth.php';
     /* If the oauth_token is old redirect to the connect page. */
     if ($this->input->get('oauth_token') && $this->session->userdata('twitter_oauth_token') !== $this->input->get('oauth_token')) {
         return redirect('admincp/twitter');
     }
     /* Create TwitteroAuth object with app key/secret and token key/secret from default phase */
     $connection = new TwitterOAuth(setting('twitter_consumer_key'), setting('twitter_consumer_secret'), $this->session->userdata('twitter_oauth_token'), $this->session->userdata('twitter_oauth_token_secret'));
     /* Request access tokens from twitter */
     $access_token = $connection->getAccessToken($this->input->get('oauth_verifier'));
     /* Save the access tokens. Normally these would be saved in a database for future use. */
     $this->settings_model->update_setting('twitter_oauth_token', $access_token['oauth_token']);
     $this->settings_model->update_setting('twitter_oauth_token_secret', $access_token['oauth_token_secret']);
     /* Remove no longer needed request tokens */
     $this->session->unset_userdata('twitter_oauth_token');
     $this->session->unset_userdata('twitter_oauth_token_secret');
     /* If HTTP response is 200 continue otherwise send to connect page to retry */
     if (200 == $connection->http_code) {
         $this->notices->SetNotice('OAuthorization retrieved successfully.');
         return redirect('admincp/twitter');
     } else {
         $this->notices->SetError('Error making connection in OAuth callback.');
         return redirect('admincp/twitter');
     }
 }
Example #9
0
 public function getServerId()
 {
     if (!setting('cdn_enabled')) {
         return 0;
     }
     return 1;
 }
Example #10
0
 public function checkout(Adtype $adtype, AdtypePurchaseRequest $request)
 {
     $user = $this->user;
     $quantity = $request->get('quantity');
     $transaction = ['gatewayId' => $request->get('gateway'), 'userId' => $user->id, 'command' => '\\ZEDx\\Jobs\\purchaseAdtype', 'item' => ['id' => $adtype->id, 'amount' => number_format($adtype->price * $quantity, 2, '.', ''), 'name' => 'Annonce ' . $adtype->title, 'description' => 'Annonce ' . $adtype->title, 'currency' => setting('currency'), 'quantity' => $quantity]];
     Payment::purchase($transaction);
 }
Example #11
0
 function index()
 {
     // are we doing a search?
     $searching = FALSE;
     $query = FALSE;
     $pagination = FALSE;
     $results = FALSE;
     $num_results = FALSE;
     $title = 'Search ' . setting('site_name');
     if ($this->input->get('q', TRUE) != FALSE) {
         // have we waited long enough before searches?
         if (setting('search_delay') != 0 and $this->session->userdata('last_search') != FALSE and time() - $this->session->userdata('last_search') < setting('search_delay')) {
             die(show_error('You must wait ' . setting('search_delay') . ' seconds between searches.  <a href="javascript:location.reload(true)">Refresh and try again</a>.'));
         }
         $searching = TRUE;
         $query = $this->input->get('q', TRUE);
         $this->load->library('search/search_results');
         $page = $this->input->get('page') ? $this->input->get('page') : 0;
         $results = $this->search_results->search($query, $page);
         $num_results = $this->search_results->get_total_results();
         $pagination = $this->search_results->get_pagination(site_url('search/?q=' . urlencode($query)));
         $title = 'Search Results for "' . $query . '"';
         // record latest search time
         $this->session->set_userdata('last_search', time());
     }
     // display
     $this->smarty->assign('searching', $searching);
     $this->smarty->assign('query', $query);
     $this->smarty->assign('pagination', $pagination);
     $this->smarty->assign('num_results', $num_results);
     $this->smarty->assign('results', $results);
     $this->smarty->assign('title', $title);
     return $this->smarty->display('search.thtml');
 }
Example #12
0
 /**
  * Send mail to user.
  *
  * @param Ad      $ad
  * @param Request $request
  *
  * @return bool
  */
 protected function sendMailToUser(Ad $ad, BaseRequest $request)
 {
     $mailer = new AdMail();
     $dataSubject = ['ad_title' => $ad->content->title, 'website_title' => setting()->website_title];
     $dataMessage = ['message' => $request->message, 'sender_name' => $request->name, 'sender_email' => $request->email, 'sender_phone' => $request->phone, 'ad_title' => $ad->content->title, 'website_title' => setting()->website_title, 'ad_url' => route('ad.show', [$ad->id, str_slug($ad->content->title)])];
     return $mailer->user()->contactUser($ad->user, ['data' => $dataMessage], $dataSubject);
 }
Example #13
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     $notifications = Notification::visible()->recents();
     $notifications = $this->filterNotificationsByDateRange($request, $notifications)->paginate(20);
     $currency = setting('currency');
     return view_backend('notification.index', compact('notifications', 'currency'));
 }
Example #14
0
 function index()
 {
     $this->load->library('custom_fields/form_builder');
     $shortname = $this->form_builder->add_field('text')->name('disqus_shortname')->label('Disqus Shortname')->validators(array('alpha_numeric', 'trim'))->value(setting('disqus_shortname'))->help('Don\'t have a shortname?  Register your site at <a href="http://www.disqus.com">Disqus</a>.')->required(TRUE);
     $data = array('form_title' => 'Disqus Configuration', 'form_action' => site_url('admincp/disqus/post_config'), 'form' => $this->form_builder->output_admin(), 'form_button' => 'Save Configuration', 'disqus_shortname' => setting('disqus_shortname'));
     $this->load->view('generic', $data);
 }
 public function indexAction()
 {
     if (setting('application', 'Refresh Profile in Dashboard')) {
         $this->auth->refresh_userdata();
     }
     $this->page->build();
 }
 /**
  * Update setting items.
  *
  * @param $inputs
  */
 public function update($inputs)
 {
     foreach ($inputs as $key => $value) {
         setting()->set($key, $value);
     }
     setting()->update();
 }
Example #17
0
 public function default()
 {
     $default = ['limit' => 1, 'level' => 0];
     $this->merge_defaults($default);
     ci()->load->model('c_page_model');
     /* get the page model table prefix so this will be cleared when the model is flushed */
     $model_cache_prefix = ci()->c_page_model->get_cache_prefix();
     /* create our cache key using that prefix */
     $cache_key = $model_cache_prefix . '.menu.special.catalog';
     /* do we have this cached? */
     if (!($data = ci()->cache->get($cache_key))) {
         $records = ci()->c_page_model->get_menus($this->option('level'), $this->option('limit'));
         $data = '<ul class="nav navbar-nav">';
         foreach ($records as $idx => $rec) {
             $record->idx = $idx;
             if ($rec->in_menu) {
                 $url = $rec->url == '/' . setting('cms-page.Home Page', 'home-page') ? '/' : $rec->url;
                 $data .= '<li><a href="' . str_replace('*', '', $url) . '">' . $rec->title . '</a></li>';
             }
         }
         $data .= '</ul>';
         ci()->cache->save($cache_key, $data);
     }
     return $data;
 }
 public static function nav($left_menu = null, $right_menu = null, $filter_empty = true)
 {
     $hidden_on = setting('Orange Theme', 'Hidden Menubar On');
     $left_root_menu = $right_menu ? $right_menu : setting('Orange Theme', 'Backend Left Menu', 1);
     $right_root_menu = $left_menu ? $left_menu : setting('Orange Theme', 'Backend Right Menu', 2);
     /* hidden on must contain something */
     $hidden_on = empty($hidden_on) ? '*ALL*' : $hidden_on;
     /*
     get all the menus this user has access to in parent / child order
     this is cached by the model based on the user access record ids
     */
     $menus = ci()->o_menubar_model->get_menus_ordered_by_parent_ids(array_keys(ci()->user->access));
     /* now we build the bootstrap menubar */
     $nav = '';
     if (!empty($hidden_on) && ci()->page->data('hide_menubar') !== true) {
         if (!preg_match('@,' . str_replace('*', '[^,]*', $hidden_on) . '@', ',/' . ci()->uri->uri_string(), $matches)) {
             $navbar = setting('Orange Themer', 'NavBar Inverse');
             $navbar = !empty($navbar) ? $navbar : 'inverse';
             $nav .= '<nav class="navbar navbar-' . $navbar . ' navbar-fixed-top">';
             $nav .= '<div class="container">';
             $nav .= '<div class="navbar-header"><button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">';
             $nav .= '<span class="sr-only">Toggle</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>';
             $nav .= '</div><div id="navbar" class="navbar-collapse collapse"><ul class="nav navbar-nav">';
             $nav .= self::build('left', $left_root_menu, $menus, $filter_empty);
             $nav .= '</ul><ul class="nav navbar-nav navbar-right">';
             $nav .= self::build('right', $right_root_menu, $menus, $filter_empty);
             $nav .= '</ul></div></div></nav>';
         }
     }
     /* here you go! */
     return $nav;
 }
Example #19
0
/**
 * Queries the database settings table for a particular setting, and returns its value
/**/
function get_backend_setting($setting, $host = null)
{
    if (is_null($host)) {
        $host = '%';
    }
    return setting($setting, $host);
}
Example #20
0
 /**
  * Ticket listing.
  */
 public function indexAction()
 {
     // Only get the current projects tickets
     $tickets = ticketQuery()->where('t.project_id = ?')->setParameter(0, $this->currentProject['id']);
     // Sort tickets by the projects sorting setting or by the users selection
     $this->sortTickets($tickets);
     // Filter tickets
     $filter = new TicketFilterQuery($tickets, $this->getFilters());
     $queryString = $filter->query;
     // Paginate tickets
     $pagination = new Pagination(Request::$query->get('page', 1), setting('tickets_per_page'), $tickets->execute()->rowCount(), $filter->query);
     if ($pagination->paginate) {
         $tickets->setFirstResult($pagination->limit);
         $tickets->setMaxResults(setting('tickets_per_page'));
     }
     // Fetch all tickets
     $tickets = $tickets->execute()->fetchAll();
     return $this->respondTo(function ($format) use($filter, $tickets, $pagination) {
         if ($format == 'html') {
             return $this->render('ticket_listing/index.phtml', ['filters' => $filter->filters, 'columns' => $this->getColumns(), 'tickets' => $tickets, 'pagination' => $pagination]);
         } elseif ($format == 'json') {
             return $this->jsonResponse(['page' => (int) $pagination->page, 'total_pages' => (int) $pagination->totalPages, 'filters' => $filter->filters, 'tickets' => $tickets]);
         }
     });
 }
Example #21
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (setting('registration', true) == 'no') {
         return redirect()->guest('auth/login')->with('error', 'Registration is administratively disabled.');
     }
     return $next($request);
 }
Example #22
0
 /**
  * Make Writeable Folder
  *
  * This function creates a writeable folder and places a blank index.html file into it
  * It throws errors upon failure.
  *
  * @param string $path The filepath
  * @param boolean $no_access Set to TRUE to write a .htaccess file which will deny all access to this folder directly
  *
  * @return boolean
  */
 function make_writeable_folder($path = '', $no_access = FALSE)
 {
     if (!is_dir($path)) {
         if (mkdir($path, setting('write_mode'))) {
             if (!chmod($path, setting('write_mode'))) {
                 die(show_error('Failed to CHMOD: ' . $path));
             }
             $this->load->helper('file');
             if (!is_writable($path)) {
                 die(show_error('Folder appeared to get created but it\'s not writable: ' . $path));
             }
             if ($no_access == TRUE) {
                 write_file($path . '/index.html', '');
                 write_file($path . '/.htaccess', "<Files *>\nDeny from all\n</Files>");
             }
         } else {
             die(show_error('Cannot create folder: ' . $path));
         }
     }
     if (!is_writable($path)) {
         die(show_error('Despite our best efforts, this folder could not be created or written to: ' . $path));
     } else {
         return TRUE;
     }
 }
Example #23
0
function frm($name)
{
    if (form_post("submit")) {
        $message = "";
        foreach ($_REQUEST as $key => $value) {
            if (str_beg($key, "cb_")) {
                $message .= "{$value}\r\n";
            }
            if (str_beg($key, "f_")) {
                $caption = $_REQUEST["c_" . str_replace("f_", "", $key)];
                $message .= "{$caption}:\r\n{$value}\r\n\r\n";
            }
        }
        $from = "no-reply-site-form@" . $_SERVER['HTTP_HOST'];
        $to = setting("admin_email");
        $subject = form_post("subject");
        $local = $_SERVER['REMOTE_ADDR'] == "127.0.0.1";
        if (form_file_uploaded("uploadedfile")) {
            $tmp = $_FILES['uploadedfile']['tmp_name'];
            $fname = $_FILES['uploadedfile']['name'];
            /*           if($local) {
                         die("<pre>$message tmp[$tmp] fname[$fname]</pre>");
            		   } else {*/
            mail_attach($from, $to, $subject, $message, $tmp, $fname);
            //		   }
        } else {
            /*           if($local) {
                         die("<pre>$message</pre>");
            		   } else*/
            mail_from($to, $subject, $message, $from);
        }
        return form_post("success");
    }
    return template("form_email", "content", template("form_email_" . $name));
}
Example #24
0
 /**
  * Autneticat
  *
  * @param $provider
  * @return bool
  */
 public function authenticate($provider)
 {
     $socialUser = $this->social->with($provider)->stateless()->user();
     if (!$socialUser) {
         return false;
     }
     $identity = $this->oauth->findByProviderNameAndId($socialUser->id, $provider);
     if ($identity) {
         $this->oauth->update($identity, ['token' => $socialUser->token]);
         $this->auth->loginUsingId($identity->user_id, true);
         return true;
     }
     $user = $this->user->findByEmail($socialUser->email);
     if (!is_null($user)) {
         $this->oauth->create(['provider_id' => $socialUser->id, 'provider' => $provider, 'user_id' => $user->id, 'token' => $socialUser->token]);
         $this->user->update($user, ['status' => 1]);
         $this->auth->login($user, true);
         return true;
     }
     if (!setting('registration', true)) {
         return false;
     }
     // Just create the user
     $newUser = $this->user->create(['name' => $this->emailToName($socialUser->email), 'email' => $socialUser->email, 'password' => '', 'status' => 1, 'avatar' => $socialUser->avatar]);
     event(new UserCreatedThroughOAuth($newUser));
     $this->oauth->create(['provider_id' => $socialUser->id, 'provider' => $provider, 'user_id' => $newUser->id, 'token' => $socialUser->token]);
     $this->auth->login($newUser, true);
     return true;
 }
Example #25
0
 public function route($uri)
 {
     $uri = '/' . uri_string();
     /* if it's the home page then change url to /home-page */
     if ($uri == '/') {
         $uri = '/' . setting('cms-page.Home Page', 'home-page');
     }
     ci()->load->model('c_page_model');
     /* catalog caches the data */
     $catalog = ci()->c_page_model->active_urls();
     $record = null;
     $routes = array_keys($catalog);
     foreach ($routes as $route) {
         $pattern = '#^' . str_replace('*', '(.*)', $route) . '$#';
         if (preg_match($pattern, $uri)) {
             $record = $catalog[$route];
             break;
         }
     }
     if (!$record) {
         show_404($uri, true);
     }
     /* load the template model so we can find the templates html */
     ci()->load->model('c_templates_model');
     ci()->load->library('lex_plugin');
     ci()->load->helper('cms');
     /* we send it into the lex parser */
     $parser = new Lex\Parser();
     /* final output */
     ci()->output->set_output($parser->parse(ci()->c_templates_model->get_by_id($record->template_id), ci()->load->get_vars(), 'lex_plugin::_callback'));
 }
 /**
  * Get rules for this request
  *
  * @return array
  */
 public function rules()
 {
     $rules = ['name' => 'required|min:3', 'email' => 'required|email|max:255', 'subject' => 'required|min:4', 'text' => 'required', 'g-recaptcha-response' => 'required|captcha'];
     if (!setting('captcha.secret')) {
         unset($rules['g-recaptcha-response']);
     }
     return $rules;
 }
 public function PriceTreshold()
 {
     $setting = setting();
     // Produk harga jual dibawah ambang batas prosentase laba
     $produkLabaWarning = Produk::allWithStokAndPrice()->having('laba_procentage', '<', $setting->laba_procentage_warning)->get();
     $data = ['data' => $produkLabaWarning];
     return view(config('app.template') . '.dashboard.price', $data);
 }
Example #28
0
 public function handle($id)
 {
     $site = $this->site->find($id);
     $this->filesystem->delete(setting('nginx') . '/sites-enabled/' . $site->uuid);
     $site->delete();
     $this->envoy->run('nginx --cmd="reload"');
     return true;
 }
Example #29
0
 /**
  * Check whether the provider exists and enabled.
  *
  * @param string $providerName
  *
  * @return bool
  */
 protected function validProvider($providerName)
 {
     $providers = json_decode(setting('social_auths'));
     if (!$providers->{$providerName}) {
         return false;
     }
     return $providers->{$providerName}->enabled;
 }
Example #30
0
 /**
  * Handle adtype purchase events.
  */
 public function onAdtypePurchase($event)
 {
     $is_visible = in_array(setting('tell_me_payment_ads'), [2, 3]);
     $is_admin_mail = in_array(setting('tell_me_payment_ads'), [1, 3]);
     $is_user_mail = in_array(setting('tell_client_ad_type_changed'), [1, 3]);
     $this->notification($event, 'purchase', $is_visible);
     $this->sendMail($event, 'purchased', $is_user_mail, $is_admin_mail);
 }