当前位置: 首页>>代码示例>>PHP>>正文


PHP Generic::getOption方法代码示例

本文整理汇总了PHP中Generic::getOption方法的典型用法代码示例。如果您正苦于以下问题:PHP Generic::getOption方法的具体用法?PHP Generic::getOption怎么用?PHP Generic::getOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Generic的用法示例。


在下文中一共展示了Generic::getOption方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: findEnabledMethods

 private function findEnabledMethods()
 {
     foreach ($this->socialMethods as $method => $color) {
         if (!parent::getOption('integration-' . $method . '-enable')) {
             unset($this->socialMethods[$method]);
         }
     }
 }
开发者ID:causefx,项目名称:MMHTPC-ManageMyHTPC,代码行数:8,代码来源:reports.class.php

示例2: resendKey

    private function resendKey()
    {
        $params = array(':username' => $this->user);
        $stmt = parent::query("SELECT `login_confirm`.`email`,  `login_confirm`.`username`, `login_confirm`.`key`, `login_users`.`name`\n\t\t\t\t\t\t\t\tFROM    `login_confirm`,          `login_users`\n\t\t\t\t\t\t\t\tWHERE   `login_confirm`.`username` = :username\n\t\t\t\t\t\t\t\tAND     `login_confirm`.`type`     = 'new_user'\n\t\t\t\t\t\t\t\tAND     `login_users`.`username`   = :username;", $params);
        $row = $stmt->fetch();
        $key = $row['key'];
        if (empty($key)) {
            $this->error = '<div class="alert alert-danger">' . _('You do not have an activation key!') . '</div>
						    <p>' . _('Please contact an admin: ') . address . '</p>';
            return false;
        }
        $shortcodes = array('site_address' => SITE_PATH, 'full_name' => $row['name'], 'username' => $this->user, 'activate' => SITE_PATH . "activate.php?key={$key}");
        $subj = parent::getOption('email-activate-resend-subj');
        $msg = parent::getOption('email-activate-resend-msg');
        $to = $row['email'];
        if (parent::sendEmail($to, $subj, $msg, $shortcodes)) {
            $this->error = '<div class="alert alert-success">' . _('Activation link resent to email.') . '</div>
					  <h5>' . _('What to do now?') . '</h5>' . _('Click the link in your email to activate your account.');
        } else {
            $this->error = _('ERROR. Mail not sent');
        }
    }
开发者ID:causefx,项目名称:MMHTPC-ManageMyHTPC,代码行数:22,代码来源:activate.php

示例3: deny_access

 /**
  * Message shown to users when access is denied.
  */
 private function deny_access()
 {
     if (!parent::getOption('block-msg-enable')) {
         parent::displayMessage(' ');
     }
     $error = "<div class='row'>\n\t\t\t\t\t<div class='col-md-12'>\n\t\t\t\t\t\t" . html_entity_decode(parent::getOption('block-msg')) . "\n\t\t\t\t\t</div>\n\t\t\t\t  </div>";
     parent::displayMessage($error);
 }
开发者ID:causefx,项目名称:MMHTPC-ManageMyHTPC,代码行数:11,代码来源:check.class.php

示例4: process

 private function process()
 {
     if (!empty($this->error)) {
         return false;
     }
     // Ticked the 'delete user' box?
     if (!empty($this->options['delete'])) {
         $params = array(':id' => $this->id);
         $sql = array();
         $sql[] = "DELETE FROM login_users WHERE user_id = :id;";
         $sql[] = "DELETE FROM login_integration WHERE user_id = :id;";
         $sql[] = "DELETE FROM login_profiles WHERE user_id = :id;";
         $sql[] = "DELETE FROM login_timestamps WHERE user_id = :id;";
         foreach ($sql as $do) {
             parent::query($do, $params);
         }
         $result = sprintf("<div class='alert alert-success'>" . _('User removed from the database:') . " <b>%s</b> (%s).</div>", $this->options['name'], $this->options['username']);
         parent::displayMessage($result);
     }
     if (!empty($this->options['password'])) {
         $params = array(':restrict' => $this->options['restricted'], ':name' => $this->options['name'], ':email' => $this->options['email'], ':level' => $this->options['user_level'], ':password' => parent::hashPassword($this->options['password']), ':id' => $this->id);
         $sql = "UPDATE `login_users` SET `restricted` = :restrict, `name` = :name, `email` = :email, `user_level` = :level, `password` = :password WHERE `user_id` = :id;";
         parent::query($sql, $params);
         $result = sprintf("<div class='alert alert-success'>" . _('User information (and password) updated for') . " <b>%s</b> (%s).</div>", $this->options['name'], $this->options['username']);
     } else {
         $params = array(':restrict' => $this->options['restricted'], ':name' => $this->options['name'], ':email' => $this->options['email'], ':level' => $this->options['user_level'], ':id' => $this->id);
         $format = array('%d', '%s', '%s', '%s', '%d');
         $sql = "UPDATE `login_users` SET `restricted` = :restrict, `name` = :name, `email` = :email, `user_level` = :level WHERE `user_id` = :id;";
         parent::query($sql, $params, $format);
         $result = sprintf("<div class='alert alert-success'>" . _('User information updated for') . " <b>%s</b> (%s).</div>", $this->options['name'], $this->options['username']);
     }
     // Checkbox handling
     $sql = "SELECT * FROM `login_profile_fields`;";
     $stmt = parent::query($sql);
     while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
         $name = 'p-' . $row['id'];
         if ($row['type'] == 'checkbox') {
             $this->options[$name] = !empty($this->options[$name]) ? 1 : 0;
         }
     }
     // Update profile fields
     foreach ($this->options as $field => $value) {
         if (strstr($field, 'p-')) {
             $field = str_replace('p-', '', $field);
             parent::updateOption($field, $value, true, $this->options['user_id']);
         }
     }
     /* Time to send our welcome email! */
     if (!empty($this->sendWelcome)) {
         $msg = parent::getOption('email-welcome-msg');
         $subj = parent::getOption('email-welcome-subj');
         $shortcodes = array('site_address' => SITE_PATH, 'full_name' => $this->options['name'], 'username' => $this->options['username'], 'email' => $this->options['email']);
         if (!parent::sendEmail($shortcodes['email'], $subj, $msg, $shortcodes)) {
             $this->error = _('ERROR. Mail not sent');
         }
     }
     return $result;
 }
开发者ID:causefx,项目名称:MMHTPC-ManageMyHTPC,代码行数:58,代码来源:edit_user.class.php

示例5: register

 private function register()
 {
     if (empty($this->error)) {
         /* See if the admin requires new users to activate */
         $requireActivate = parent::getOption('user-activation-enable');
         /* Log user in when they register */
         $_SESSION['jigowatt']['username'] = $this->settings[$this->username_type];
         /* Apply default user_level */
         $_SESSION['jigowatt']['user_level'] = unserialize(parent::getOption('default-level'));
         if ($requireActivate) {
             $_SESSION['jigowatt']['activate'] = 1;
         }
         $_SESSION['jigowatt']['gravatar'] = parent::get_gravatar($this->settings['email'], true, 26);
         /* Create their account */
         $sql = "INSERT INTO accounts (user_level, name, email, username, password)\n\t\t\t\t\t\tVALUES (:user_level, :name, :email, :{$this->username_type}, :password);";
         $params = array(':user_level' => parent::getOption('default-level'), ':name' => $this->settings['name'], ':email' => $this->settings['email'], ':username' => $this->settings['username'], ':password' => parent::hashPassword($this->settings['password']));
         if ($this->use_emails) {
             unset($params[':username']);
         }
         parent::query($sql, $params);
         $user_id = parent::$dbh->lastInsertId();
         $_SESSION['jigowatt']['user_id'] = $user_id;
         /* Social integration. */
         if (!empty($_SESSION['jigowatt']['facebookMisc'])) {
             $link = 'facebook';
             $id = $_SESSION['jigowatt']['facebookMisc']['id'];
         }
         if (!empty($_SESSION['jigowatt']['openIDMisc'])) {
             $link = $_SESSION['jigowatt']['openIDMisc']['type'];
             $id = $_SESSION['jigowatt']['openIDMisc'][$link];
         }
         if (!empty($_SESSION['jigowatt']['twitterMisc'])) {
             $link = 'twitter';
             $id = $_SESSION['jigowatt']['twitterMisc']['id'];
         }
         if (!empty($link)) {
             $params = array(':user_id' => $user_id, ':id' => $id);
             parent::query("INSERT INTO `login_integration` (`user_id`, `{$link}`) VALUES (:user_id, :id);", $params);
         }
         // Update profile fields
         foreach ($this->settings as $field => $value) {
             if (strstr($field, 'p-')) {
                 $field = str_replace('p-', '', $field);
                 parent::updateOption($field, $value, true, $user_id);
             }
         }
         /* Create the activation key */
         if ($requireActivate) {
             $key = md5(uniqid(mt_rand(), true));
             $sql = sprintf("INSERT INTO `login_confirm` (`username`, `key`, `email`, `type`)\n\t\t\t\t\t\t\t\tVALUES ('%s', '%s', '%s', '%s');", $this->settings[$this->username_type], $key, $this->settings['email'], 'new_user');
             parent::query($sql);
         }
         $disable_welcome_email = parent::getOption('email-welcome-disable');
         if (!$disable_welcome_email) {
             /* Send welcome email to new user. */
             $msg = parent::getOption('email-welcome-msg');
             $subj = parent::getOption('email-welcome-subj');
             $shortcodes = array('site_address' => SITE_PATH, 'full_name' => $this->settings['name'], 'username' => $this->settings[$this->username_type], 'email' => $this->settings['email'], 'activate' => $requireActivate ? SITE_PATH . "activate.php?key={$key}" : '');
             if (!parent::sendEmail($this->settings['email'], $subj, $msg, $shortcodes)) {
                 $this->error = _('ERROR. Mail not sent');
             }
         }
         /* Admin notification of new user. */
         $notifyNewUsers = parent::getOption('notify-new-user-enable');
         if (!empty($notifyNewUsers)) {
             $msg = parent::getOption('email-new-user-msg');
             $subj = parent::getOption('email-new-user-subj');
             unset($shortcodes['activate']);
             $userGroup = parent::getOption('notify-new-users');
             if (!empty($userGroup)) {
                 $userGroup = unserialize($userGroup);
                 /* Variable to store all the email addresses of each chosen group. */
                 $emails = array();
                 foreach ($userGroup as $level_id) {
                     /* Grab all users within the user group. */
                     $params = array(':level_id' => '%:"' . $level_id . '";%');
                     $sql = "SELECT * FROM `accounts` WHERE `user_level` LIKE :level_id";
                     $stmt = parent::query($sql, $params);
                     /* Send email to each user in group. */
                     while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
                         $emails[] = $row['email'];
                     }
                 }
                 /* Remove duplicates for users with multiple user groups. */
                 $emails = array_unique($emails);
                 if (!parent::sendEmail($emails, $subj, $msg, $shortcodes, true)) {
                     $this->error = _('ERROR. Mail not sent');
                 }
             }
         }
         unset($_SESSION['jigowatt']['referer'], $_SESSION['jigowatt']['token'], $_SESSION['jigowatt']['facebookMisc'], $_SESSION['jigowatt']['twitterMisc'], $_SESSION['jigowatt']['openIDMisc']);
         /* After registering, redirect to the page the admin has set in Settings > General > Redirect Options. */
         header('Location: ' . parent::getOption('new-user-redirect'));
         exit;
     }
 }
开发者ID:fliptechit,项目名称:kick-notify,代码行数:96,代码来源:signup.class.php

示例6: adduser

 private function adduser()
 {
     if (!empty($this->error)) {
         return false;
     }
     $params = array(':user_level' => parent::getOption('default-level'), ':name' => $this->name, ':email' => $this->email, ':username' => $this->username, ':password' => parent::hashPassword($this->password));
     parent::query("INSERT INTO `login_users` (`user_level`, `name`, `email`, `username`, `password`)\n\t\t\t\t\t\tVALUES (:user_level, :name, :email, :username, :password);", $params);
     $shortcodes = array('site_address' => SITE_PATH, 'full_name' => $this->name, 'username' => $this->username, 'email' => $this->email, 'password' => $this->password);
     $subj = parent::getOption('email-add-user-subj');
     $msg = parent::getOption('email-add-user-msg');
     if (!parent::sendEmail($this->email, $subj, $msg, $shortcodes)) {
         $this->error = _('ERROR. Mail not sent');
     }
     $this->result = "<div class='alert alert-success'>" . sprintf(_('Successfully added user <b>%s</b> to the database. Credentials sent to user.'), $this->username) . "</div>";
 }
开发者ID:causefx,项目名称:MMHTPC-ManageMyHTPC,代码行数:15,代码来源:add_user.class.php

示例7: returnLevels

    public function returnLevels($id = 'default-level')
    {
        $option = parent::getOption($id);
        $ids = !empty($option) ? unserialize($option) : array('');
        $placeholder = array_fill(0, count($ids), '?');
        $sql = "SELECT level_name, level_level FROM login_levels WHERE level_disabled != 1 AND level_level NOT IN (" . implode(',', $placeholder) . ")";
        $stmt2 = parent::query($sql, $ids);
        $sql = "SELECT level_name, level_level FROM login_levels WHERE level_level IN (" . implode(',', $placeholder) . ")";
        $stmt3 = parent::query($sql, $ids);
        ?>
		<select class="form-control chzn-select" data-placeholder="<?php 
        _e('Select your levels');
        ?>
" multiple="multiple" id="<?php 
        echo $id;
        ?>
" name="<?php 
        echo $id;
        ?>
[]">
			<?php 
        while ($level = $stmt3->fetch()) {
            ?>
			<?php 
            echo $level['level_level'];
            ?>
			<option selected="selected" value="<?php 
            echo $level['level_level'];
            ?>
"><?php 
            echo $level['level_name'];
            ?>
</option>
			<?php 
        }
        ?>
			<?php 
        while ($level = $stmt2->fetch()) {
            ?>
			<option value="<?php 
            echo $level['level_level'];
            ?>
"><?php 
            echo $level['level_name'];
            ?>
</option>
			<?php 
        }
        ?>
		</select>
		<?php 
    }
开发者ID:causefx,项目名称:MMHTPC-ManageMyHTPC,代码行数:52,代码来源:settings.class.php

示例8: process

 private function process()
 {
     $params = array(':name' => $this->settings['name'], ':username' => $this->username);
     parent::query("UPDATE `accounts` SET `name` = :name WHERE {$this->username_type} = :username", $params);
     $this->error = "<div class='alert alert-success'>" . _('User information updated for') . " <b>" . $this->settings['name'] . "</b> ({$this->username}).</div>";
     $params = array(':username' => $this->username);
     $stmt = parent::query("SELECT `email` FROM `accounts` WHERE {$this->username_type} = :username;", $params);
     $email = $stmt->fetch();
     $email = $email[0];
     if (!empty($this->settings['password']) || $this->settings['email'] != $email) {
         $key = md5(uniqid(mt_rand(), true));
         $params = array(':username' => $this->username, ':key' => $key, ':email' => $this->settings['email'], ':type' => 'update_emailPw', ':data' => empty($this->settings['password']) ? '' : parent::hashPassword($this->settings['password']));
         $sql = "INSERT INTO `login_confirm` (`username`, `key`, `email`, `type`, `data`)\n\t\t\t\t\tVALUES (:username, :key, :email, :type, :data);";
         parent::query($sql, $params);
         $shortcodes = array('site_address' => SITE_PATH, 'full_name' => $this->settings['name'], 'username' => $this->username, 'confirm' => SITE_PATH . "profile.php?key={$key}");
         $subj = parent::getOption('email-acct-update-subj');
         $msg = parent::getOption('email-acct-update-msg');
         // Send an email with key
         if (!parent::sendEmail($email, $subj, $msg, $shortcodes)) {
             $this->error = '<div class="alert alert-error">' . _('ERROR. Mail not sent') . '</div>';
         } else {
             $this->error = "<div class='alert alert-warning'>" . _('Check your email to confirm this change.') . '</div>';
         }
     }
     // Update profile fields
     foreach ($this->settings as $field => $value) {
         if (strstr($field, 'p-')) {
             $field = str_replace('p-', '', $field);
             parent::updateOption($field, $value, true, $this->settings['user_id']);
         }
     }
 }
开发者ID:fliptechit,项目名称:kick-notify,代码行数:32,代码来源:profile.class.php

示例9: link_account

 /**
  *
  * @param unknown $link
  * @param unknown $login (optional)
  * @return unknown
  */
 public function link_account($link, $login = false)
 {
     /** Make sure we only allow specific social links. */
     if (!in_array($link, self::$socialLogin)) {
         return false;
     }
     /** Check if user is already linked. */
     if (!empty($this->result[$link])) {
         if (!$login) {
             parent::displayMessage(sprintf('<div class="alert alert-warning">' . _('Your account is already linked with %s!') . '</div>', ucwords($link)), false);
         }
         return false;
     }
     require_once dirname(__FILE__) . '/integration/hybridauth/Hybrid/Auth.php';
     $config = array("base_url" => SITE_PATH . "classes/integration/hybridauth/", "providers" => array("OpenID" => array("enabled" => true), "Facebook" => array("enabled" => in_array($link, self::$socialLogin), "keys" => array("id" => parent::getOption('facebook-app-id'), "secret" => parent::getOption('facebook-app-secret')), "trustForwarded" => false), "Twitter" => array("enabled" => in_array($link, self::$socialLogin), "keys" => array("key" => parent::getOption('twitter-key'), "secret" => parent::getOption('twitter-secret')))), "debug_mode" => false);
     try {
         // create an instance for Hybridauth with the configuration file path as parameter
         $hybridauth = new Hybrid_Auth($config);
         switch ($link) {
             case 'facebook':
                 $provider = $hybridauth->authenticate("Facebook");
                 break;
             case 'twitter':
                 $provider = $hybridauth->authenticate("Twitter");
                 break;
             case 'yahoo':
                 $provider = $hybridauth->authenticate("OpenID", array("openid_identifier" => "https://me.yahoo.com/"));
                 break;
             case 'google':
                 $provider = $hybridauth->authenticate("OpenID", array("openid_identifier" => "https://www.google.com/accounts/o8/id"));
                 break;
         }
         // get the user profile
         $provider_user_profile = $provider->getUserProfile();
         if (!empty($provider_user_profile)) {
             $_SESSION['jigowatt'][$link . 'Misc'] = (array) $provider_user_profile;
             $_SESSION['jigowatt'][$link] = $provider_user_profile->identifier;
         }
         /** See if the link was successful. */
         if (!empty($_SESSION['jigowatt'][$link])) {
             if (!$login) {
                 $this->connect($link);
             }
         }
         $provider->logout();
     } catch (Exception $e) {
         // Display the recived error,
         // to know more please refer to Exceptions handling section on the userguide
         switch ($e->getCode()) {
             case 0:
                 parent::displayMessage(sprintf('<div class="alert alert-warning">' . _('Unspecified error with: %s') . '</div>', ucwords($link)), false);
                 break;
             case 1:
                 parent::displayMessage(sprintf('<div class="alert alert-warning">' . _('Hybriauth configuration error: %s') . '</div>', ucwords($link)), false);
                 break;
             case 2:
                 parent::displayMessage(sprintf('<div class="alert alert-warning">' . _('Provider not properly configured: %s') . '</div>', ucwords($link)), false);
                 break;
             case 3:
                 parent::displayMessage(sprintf('<div class="alert alert-warning">' . _('Unknown or disabled provider: %s') . '</div>', ucwords($link)), false);
                 break;
             case 4:
                 parent::displayMessage(sprintf('<div class="alert alert-warning">' . _('Missing provider application credentials for: %s') . '</div>', ucwords($link)), false);
                 break;
             case 5:
                 parent::displayMessage(sprintf('<div class="alert alert-warning">' . _('Authentification failed. The user has canceled the authentication or the provider refused the connection. %s') . '</div>', ucwords($link)), false);
                 break;
             case 6:
                 parent::displayMessage(sprintf('<div class="alert alert-warning">' . _('User profile request failed. Most likely the user is not connected to the provider and he should authenticate again. %s') . '</div>', ucwords($link)), false);
                 $provider->logout();
                 break;
             case 7:
                 parent::displayMessage(sprintf('<div class="alert alert-warning">' . _('User not connected to the provider.: %s') . '</div>', ucwords($link)), false);
                 $provider->logout();
                 break;
             case 8:
                 parent::displayMessage(sprintf('<div class="alert alert-warning">' . _('Provider does not support this feature. %s') . '</div>', ucwords($link)), false);
                 break;
         }
         // well, basically your should not display this to the end user, just give him a hint and move on..
         // echo "<br /><br /><b>Original error message:</b> " . $e->getMessage();
     }
 }
开发者ID:causefx,项目名称:MMHTPC-ManageMyHTPC,代码行数:89,代码来源:integration.class.php

示例10: modal_process

 public function modal_process()
 {
     if (isset($_POST['usernamemail'])) {
         $usernamemail = parent::secure($_POST['usernamemail']);
         // The input field wasn't filled out
         if (empty($usernamemail)) {
             $this->error = '<div class="alert alert-danger">' . _('Please enter your username or email address.') . '</div>';
         } else {
             $params = array(':usernameEmail' => $usernamemail);
             $stmt = parent::query("SELECT * FROM `login_users` WHERE `username` = :usernameEmail OR `email` = :usernameEmail;", $params);
             if ($stmt->rowCount() > 0) {
                 $row = $stmt->fetch();
                 // Reuse the email variable.
                 $email = $row['email'];
                 // Check that a recovery key doesn't already exist, if it does, remove it.
                 $params = array(':email' => $email);
                 $stmt = parent::query("SELECT * FROM `login_confirm` WHERE `email` = :email AND `type` = 'forgot_pw';", $params);
                 if ($stmt->rowCount() > 0) {
                     parent::query("DELETE FROM `login_confirm` WHERE email = :email AND `type` = 'forgot_pw';", $params);
                 }
                 // Generate a new recovery key
                 $key = md5(uniqid(mt_rand(), true));
                 $params = array(':email' => $email, ':key' => $key);
                 parent::query("INSERT INTO `login_confirm` (`email`, `key`, `type`) VALUES (:email, :key, 'forgot_pw');", $params);
                 $shortcodes = array('site_address' => SITE_PATH, 'full_name' => $row['name'], 'username' => $row['username'], 'reset' => SITE_PATH . "forgot.php?key={$key}");
                 $subj = parent::getOption('email-forgot-subj');
                 $msg = parent::getOption('email-forgot-msg');
                 // Send an email confirming their password reset
                 if (!parent::sendEmail($email, $subj, $msg, $shortcodes)) {
                     $this->error = '<div class="alert alert-danger">' . _('ERROR. Mail not sent') . '</div>';
                 } else {
                     $this->error = "<div class='alert alert-success'>" . _('We\'ve emailed you password reset instructions. Check your email.') . "</div>";
                 }
             } else {
                 $this->error = '<div class="alert alert-danger">' . _('This account does not exist.') . '</div>';
             }
         }
         echo $this->error;
     }
 }
开发者ID:causefx,项目名称:MMHTPC-ManageMyHTPC,代码行数:40,代码来源:forgot.class.php

示例11: upgrade_255

 private function upgrade_255()
 {
     parent::query("\n\t\t\tCREATE TABLE IF NOT EXISTS `login_confirm` (\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t  `data` varchar(255) NOT NULL,\n\t\t\t  `username` varchar(255) NOT NULL,\n\t\t\t  `email` varchar(255) NOT NULL,\n\t\t\t  `key` varchar(255) NOT NULL,\n\t\t\t  `type` varchar(25) NOT NULL,\n\t\t\t  PRIMARY KEY (`id`)\n\t\t\t) ENGINE=InnoDB  DEFAULT CHARSET=utf8;\n\t\t");
     parent::query("\n\t\t\tCREATE TABLE IF NOT EXISTS `login_profile_fields` (\n\t\t\t  `id` int(255) NOT NULL AUTO_INCREMENT,\n\t\t\t  `section` varchar(255) NOT NULL,\n\t\t\t  `type` varchar(25) NOT NULL,\n\t\t\t  `label` varchar(255) NOT NULL,\n\t\t\t  PRIMARY KEY (`id`)\n\t\t\t) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ;\n\t\t");
     parent::query("\n\t\t\tCREATE TABLE IF NOT EXISTS `login_integration` (\n\t\t\t  `user_id` int(255) NOT NULL,\n\t\t\t  `facebook` varchar(255) NOT NULL,\n\t\t\t  `twitter` varchar(255) NOT NULL,\n\t\t\t  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n\t\t\t  PRIMARY KEY (`user_id`)\n\t\t\t) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ;\n\t\t");
     parent::query("\n\t\t\tCREATE TABLE IF NOT EXISTS `login_timestamps` (\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t  `user_id` int(11) NOT NULL,\n\t\t\t  `ip` varchar(255) NOT NULL,\n\t\t\t  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n\t\t\t  PRIMARY KEY (`id`)\n\t\t\t) ENGINE=InnoDB  DEFAULT CHARSET=utf8;\n\t\t");
     /** Add a new column for redirecting certain levels. */
     parent::query("ALTER TABLE  `login_levels` ADD  `redirect` VARCHAR( 255 ) NULL");
     /** Unserialize all timestamps. */
     $sql = "SELECT * FROM `login_profiles` WHERE `profile_label` = 'p-timestamp'";
     $result = parent::query($sql);
     while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
         $timestamps = unserialize($row['profile_value']);
         foreach ($timestamps as $time => $location) {
             $sql = sprintf("INSERT INTO `login_timestamps` (`user_id` ,`ip` ,`timestamp`) VALUES ('%s',  '%s', '%s');", $row['user_id'], $location, date("Y-m-d H:i:s", $time));
             parent::query($sql);
         }
         $sql = "DELETE FROM `login_profiles` WHERE `profile_label` = 'p-timestamp'";
         parent::query($sql);
     }
     /** Unserialize all user profile fields. */
     $profileFields = unserialize(parent::getOption('profile-fields'));
     if (!empty($profileFields)) {
         foreach ($profileFields as $type => $label) {
             $sql = sprintf("INSERT INTO `login_profile_fields` (`section` ,`type` ,`label`) VALUES ('%s',  '%s', '%s');", "Profile", substr_replace($type, '', -3), $label);
             parent::query($sql);
         }
     }
     $sql = "DELETE FROM `login_settings` WHERE `option_name` = 'profile-fields'";
     parent::query($sql);
     /** Merge `login_activate` & `login_forgot` into `login_confirm`. */
     $sql = "SELECT * FROM `login_activate`";
     $result = parent::query($sql);
     while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
         $sql = sprintf("INSERT INTO `login_confirm` (`username`, `key`, `email`, `type`) VALUES ('%s', '%s', '%s', '%s');", $row['username'], $row['code'], $row['email'], 'new_user');
         parent::query($sql);
     }
     parent::query("DROP TABLE `login_activate`");
     $sql = "SELECT * FROM `login_forgot`";
     $result = parent::query($sql);
     while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
         $sql = sprintf("INSERT INTO `login_confirm` (`key`, `email`, `type`) VALUES ('%s', '%s', '%s');", $row['code'], $row['email'], 'forgot_pw');
         parent::query($sql);
     }
     parent::query("DROP TABLE `login_forgot`");
     /** Update db version. */
     parent::updateOption('phplogin_db_version', 1204160);
     parent::query("\n\t\t INSERT INTO `login_settings` (`option_name`, `option_value`) VALUES\n\t\t  ('guest-redirect', '" . SITE_PATH . "login.php?e=1'),\n\t\t  ('email-acct-update-subj', 'Confirm your account changes'),\n\t\t  ('email-acct-update-msg', 'Hi {{full_name}} !\r\n\r\nYou ( {{username}} ) requested a change to update your password or email. Click the link below to confirm this change.\r\n\r\n{{confirm}}\r\n\r\nThanks!\r\n{{site_address}}'),\n\t\t  ('email-acct-update-success-subj', 'Your account has been updated'),\n\t\t  ('signout-redirect-referrer-enable', 1),\n\t\t  ('signin-redirect-referrer-enable', 1),\n\t\t  ('email-acct-update-success-msg', 'Hello {{full_name}},\r\n\r\nYour account details at {{site_address}} has been updated. \r\n\r\nYour username: {{username}}\r\n\r\nSee you around!'),\n\t\t  ('default-level', 'a:1:{i:0;s:1:\"3\";}');");
 }
开发者ID:causefx,项目名称:MMHTPC-ManageMyHTPC,代码行数:49,代码来源:upgrade.class.php

示例12: twitter_url

 public function twitter_url()
 {
     if (!empty($_SESSION['jigowatt']['twitter'])) {
         return false;
     }
     $consumer_key = parent::getOption('twitter-key');
     $consumer_secret = parent::getOption('twitter-secret');
     $this->twitterObj = new EpiTwitter($consumer_key, $consumer_secret);
     if (!empty($_GET['oauth_token'])) {
         $this->twitterObj->setToken($_GET['oauth_token']);
         $token = $this->twitterObj->getAccessToken();
         $this->twitterObj->setToken($token->oauth_token, $token->oauth_token_secret);
         $twitterInfo = $this->twitterObj->get_accountVerify_credentials();
         $twitterInfo = $twitterInfo->response;
         $_SESSION['jigowatt']['twitter'] = $twitterInfo['id'];
         $_SESSION['jigowatt']['twitterMisc']['username'] = $twitterInfo['screen_name'];
         $_SESSION['jigowatt']['twitterMisc']['id'] = $twitterInfo['id'];
         $_SESSION['jigowatt']['twitterMisc']['name'] = $twitterInfo['name'];
     }
     return !empty($_SESSION['jigowatt']['twitter']) ? '#' : $this->twitterObj->getAuthenticateUrl(null, array('oauth_callback' => str_replace("www.", "", SITE_PATH) . basename($_SERVER['PHP_SELF']) . '?link=twitter'));
 }
开发者ID:fliptechit,项目名称:kick-notify,代码行数:21,代码来源:integration.class.php


注:本文中的Generic::getOption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。