コード例 #1
0
 static function plugins_for_current_user()
 {
     global $current_user;
     global $wpdb;
     //		$wpdb->set_blog_id(1,1);
     $plugins = $wpdb->get_results($wpdb->prepare("SELECT `ID`,`post_title`,`post_name`,`post_excerpt`,`post_content` FROM {$wpdb->posts}  WHERE `post_type`='product' ORDER BY post_title ASC"));
     // AND `user`=%s",$current_user->ID));
     $memberships = Memberships::get_memberships_for_user($current_user->ID);
     foreach ($plugins as $i => $plugin) {
         $plugin->file = get_post_meta($plugin->ID, 'filename', true);
         $plugin->version = get_post_meta($plugin->ID, 'version', true);
         $group_access = get_post_meta($plugin->ID, 'group_access', true);
         $has_access = false;
         if (is_array($group_access)) {
             foreach ($group_access as $group_id => $extra) {
                 if (array_key_exists($group_id, $memberships)) {
                     $has_access = true;
                 }
             }
         }
         $plugin_access = $current_user->plugin_access;
         if (isset($plugin_access[$plugin->post_name])) {
             $plugin->key = $plugin_access[$plugin->post_name]['key'];
             $plugin->sites = $plugin_access[$plugin->post_name]['sites'];
         } else {
             if (!$has_access) {
                 unset($plugins[$i]);
             }
         }
     }
     return $plugins;
 }
コード例 #2
0
ファイル: class_forum.php プロジェクト: newbacknew/owloo.com
 public function __construct()
 {
     parent::__construct();
     if ($this->config['forum_enabled'] || !empty($this->permissions['admin']) && $this->permissions['admin']) {
         if (file_exists(SYSTEM_PATH . '/templates/class_template_forum.php')) {
             require_once SYSTEM_PATH . '/templates/class_template_forum.php';
             $this->_tmpl = new Template_forum($this);
         } else {
             die($this->lang['cl_admin_228']);
         }
     }
 }
コード例 #3
0
ファイル: Sku.php プロジェクト: mined-gatech/hubzero-cms
 public function setTimeToLive($ttl)
 {
     Memberships::checkTtl($ttl);
     $this->data->meta['ttl'] = $ttl;
 }
コード例 #4
0
ファイル: sidebar.php プロジェクト: brahmajiayatas/getweiss
<div class="upgrade_profile_details">
  <div class="credit_section">
   <span>AD SPACE</span> </div>
</div>
<?php 
$loginUserId = Yii::app()->user->getId();
$model = Memberships::model()->findByAttributes(array("Price" => 0));
$details = MembershipUsers::model()->findByAttributes(array("UserId" => $loginUserId, "MembershipId" => $model->Objid));
if (empty($details)) {
    ?>
<div class="upgrade_profile_details">
<div class="duration"><?php 
    echo $model->Duration;
    ?>
<span>Months</span></div>
<?php 
    echo CHtml::link('<img src="' . Yii::app()->theme->baseUrl . '/images/free-membership1.jpg"/>', array('upgradepack/free'));
    ?>
</div>
<?php 
}
コード例 #5
0
 public function actionFree()
 {
     $loginUserId = Yii::app()->user->getId();
     $loginUserMail = Profile::model()->findByPk($loginUserId)->EmailAddress;
     $model = Memberships::model()->findByAttributes(array("Price" => 0));
     $months = $model->Duration;
     $membserShipId = $model->Objid;
     $details = MembershipUsers::model()->findByAttributes(array("UserId" => $loginUserId, "MembershipId" => $membserShipId));
     if (empty($details)) {
         $freeMember = new MembershipUsers();
         $freeMember->UserId = $loginUserId;
         $freeMember->MembershipId = $membserShipId;
         $freeMember->TransactionId = "0";
         $freeMember->MembershipStart = date('Y-m-d H:i:s');
         $freeMember->MembershipEnd = date('Y-m-d H:i:s', strtotime("+ " . $months . " month"));
         if ($freeMember->save()) {
             $info = MembershipUsers::model()->findByPk($freeMember->Objid);
             $message = Messages::model()->mailHeader();
             $message .= '<p>Free Membership successfully activated.</p>';
             $message .= '<p><u>Membership type</u>: ' . $info->membership->MemberShipType . ' </p>';
             $message .= '<p>' . $info->membership->Description . '</p>';
             $message .= '<p><u>Membership Expired</u>: ' . $info->MembershipEnd . '</p>';
             $message .= Messages::model()->mailFooter();
             Messages::model()->sendMail('E Heart Match', 'Membership Details', Yii::app()->params['adminEmail'], $loginUserMail, $message);
             $this->render('success', array('details' => $info));
         }
     } else {
         throw new CHttpException(404, 'Page not found');
     }
 }
コード例 #6
0
ファイル: AuthController.php プロジェクト: JApfel/MarketDraft
 function providerSignupAction()
 {
     if ($this->request->isPost()) {
         $name = $this->request->getPost('name');
         $email = $this->request->getPost('email');
         $password = $this->request->getPost('password');
         $cpassword = $this->request->getPost('cpassword');
         $timezone = $this->request->getPost('timezone');
         $phone = $this->request->getPost('phone');
         $address = $this->request->getPost('address');
         $categories = $this->request->getPost('categories');
         $membership = $this->request->getPost('membership');
         $card_token = $this->request->getPost('card_token');
         $errors = array();
         $fields = array('name', 'email', 'password', 'cpassword', 'phone', 'address', 'membership', 'card_token');
         $fieldsEntered = 0;
         foreach ($fields as $field) {
             if (trim(${$field}) != '') {
                 $fieldsEntered++;
             }
         }
         if ($fieldsEntered < count($fields)) {
             array_push($errors, "Some fields were not entered.");
         }
         if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
             array_push($errors, "Email is invalid.");
         }
         if (strlen($password) < 6) {
             array_push($errors, "Password must be at least 6 characters long.");
         }
         if ($password != $cpassword) {
             array_push($errors, "Passwords don't match.");
         }
         if (!preg_match('/^\\(?[0-9]{3}\\)?|[0-9]{3}[-. ]? [0-9]{3}[-. ]?[0-9]{4}$/', $phone)) {
             array_push($errors, "Invalid phone number format.");
         }
         $apiLink = $this->config->maps->api_link;
         $geoData = file_get_contents($apiLink . urlencode($address));
         if ($geoData === FALSE) {
             array_push($errors, "Invalid address.");
         }
         $provider = Providers::findFirst("email = '{$email}'");
         if ($provider) {
             array_push($errors, "Email is already taken.");
         }
         if (!count($errors)) {
             $salt = bin2hex(openssl_random_pseudo_bytes(16, $cstrong));
             $provider = new Providers();
             $provider->name = $name;
             $provider->email = $email;
             $provider->salt = $salt;
             $provider->password = md5($salt . $password);
             $provider->timezone = $timezone;
             $provider->membership = $membership;
             require_once "../vendor/stripe-php-master/init.php";
             \Stripe\Stripe::setApiKey($this->config->stripe->secret_key);
             $plan = Memberships::findFirst("id = '{$membership}'");
             $amount = (int) $plan->total * 100;
             $duration = $plan->duration;
             $date = new DateTime(date());
             $date->add(new DateInterval('P' . $duration . 'M'));
             $provider->expiry_date = $date->format('Y-m-d H:i:s');
             $account = \Stripe\Account::create(array("managed" => true, "country" => "US"));
             $provider->stripe_account_token = $account->id;
             $customer = \Stripe\Customer::create(array("description" => $name, "email" => $email, "source" => $card_token));
             $provider->stripe_customer_token = $customer->id;
             $provider->stripe_card_token = $customer->default_source;
             $providerPhone = new ProviderPhones();
             $providerPhone->telephone = $phone;
             $provider->providerPhones = $providerPhone;
             $providerAddress = new ProviderAddresses();
             $geoJSON = json_decode($geoData);
             if ($geoJSON->status == "OK") {
                 $geometry = $geoJSON->results[0]->geometry->location;
                 $lat = $geometry->lat;
                 $lng = $geometry->lng;
             } else {
                 $lat = 0;
                 $lng = 0;
             }
             $providerAddress->latitude = $lat;
             $providerAddress->longitude = $lng;
             $providerAddress->address = $address;
             $provider->providerAddresses = $providerAddress;
             $providerCategories = array();
             foreach ($categories as $category) {
                 $providerCategory = new ProviderCategories();
                 $providerCategory->cid = $category;
                 array_push($providerCategories, $providerCategory);
             }
             $provider->providerCategories = $providerCategories;
             if ($provider->create()) {
                 \Stripe\Charge::create(array("amount" => $amount, "currency" => "usd", "customer" => $provider->stripe_customer_token, "source" => $provider->stripe_card_token, "description" => "{$plan->name} plan subscription"));
                 $this->response->redirect('/login?success');
                 $this->view->disable();
             } else {
                 array_push($errors, "An error occurred during the signup process.");
             }
         }
         $this->view->errors = $errors;
     }
     $timezones = (require "../app/config/timezones.php");
     $this->view->timezones = $timezones;
     $memberships = Memberships::find("id > 1");
     $this->view->memberships = $memberships;
     $categories = Categories::find();
     $this->view->categories = $categories;
     echo $this->view->render('auth', 'providerSignup');
 }
コード例 #7
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Memberships the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Memberships::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #8
0
 function plugin_file_shortcode($atts)
 {
     global $current_user;
     $secure = true;
     extract($atts);
     $plugin = Plugins::get_plugin($id);
     $file = array_pop($plugin->files);
     $plugin_access = get_usermeta($current_user->ID, 'plugin_access');
     $user_sites = $plugin_access[$id]['sites'];
     $has_access = false;
     $fileOptions = get_option($id);
     $groups = $fileOptions['groups'];
     foreach ($groups as $group_id) {
         if (Memberships::is_member_of_group($user->ID, $group_id)) {
             $plugin->has_access = true;
         }
     }
     include "app/views/shortcodes/plugin.php";
 }