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


PHP Profile::update方法代码示例

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


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

示例1: add

 public function add()
 {
     # code...
     if (isset($_POST['addUserBtn']) || isset($_POST['editUserBtn'])) {
         $user = new Profile();
         $user->setUsername(Utils::sanitize($_POST['username']));
         $user->setPassword(Utils::sanitize($_POST['password']));
         $user->setShortcode(Utils::sanitize($_POST['shortcode']));
         $user->setSMSC(Utils::sanitize($_POST['smsc']));
         $user->setType('send_profile');
         // $user->save();
         isset($_POST['editUserBtn']) ? $user->update() : $user->save();
         $msg = isset($_POST['editUserBtn']) ? 'Profile Successfully Updated' : 'New Profile Added';
         $this->notifyBar('success', $msg);
         $u = Profile::getAll();
         $this->setVariable('users', $u);
         $this->setView('', 'list-user');
     } else {
         $this->setView('', 'add-new-user');
     }
 }
开发者ID:TM30,项目名称:seethru,代码行数:21,代码来源:UserController.class.php

示例2: initProfile

 /**
  * Init profiles during installation :
  * - add rights in profile table for the current user's profile
  * - current profile has all rights on the plugin
  */
 static function initProfile()
 {
     $pfProfile = new self();
     $profile = new Profile();
     $a_rights = $pfProfile->getAllRights();
     foreach ($a_rights as $data) {
         if (countElementsInTable("glpi_profilerights", "`name` = '" . $data['field'] . "'") == 0) {
             ProfileRight::addProfileRights(array($data['field']));
             $_SESSION['glpiactiveprofile'][$data['field']] = 0;
         }
     }
     // Add all rights to current profile of the user
     if (isset($_SESSION['glpiactiveprofile'])) {
         $dataprofile = array();
         $dataprofile['id'] = $_SESSION['glpiactiveprofile']['id'];
         $profile->getFromDB($_SESSION['glpiactiveprofile']['id']);
         foreach ($a_rights as $info) {
             if (is_array($info) && (!empty($info['itemtype']) || !empty($info['rights'])) && !empty($info['label']) && !empty($info['field'])) {
                 if (isset($info['rights'])) {
                     $rights = $info['rights'];
                 } else {
                     $rights = $profile->getRightsFor($info['itemtype']);
                 }
                 foreach ($rights as $right => $label) {
                     $dataprofile['_' . $info['field']][$right] = 1;
                     $_SESSION['glpiactiveprofile'][$data['field']] = $right;
                 }
             }
         }
         $profile->update($dataprofile);
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:37,代码来源:profile.class.php

示例3: testDeleteInvalidProfile

 /**
  * test deleting a Profile that does not exist
  *
  * @expectedException PDOException
  **/
 public function testDeleteInvalidProfile()
 {
     // create a Profile and try to delete it without actually inserting it
     $profile = new Profile(null, $this->VALID_ATHANDLE, $this->VALID_EMAIL, $this->VALID_PHONE);
     $profile->update($this->getPDO());
 }
开发者ID:jfindley2,项目名称:data-design,代码行数:11,代码来源:profile-test.php

示例4: connectToEncryptedMySQL

<?php

require_once "/etc/apache2/capstone-mysql/encrypted-config.php";
require_once "profile.php";
$pdo = connectToEncryptedMySQL("/etc/apache2/data-design/vhooker.ini");
$profile = new Profile(null, 1, "this is from PHP");
$profile->insert($pdo);
$profile->setProfile("now I changed the message");
$profile->update($pdo);
$profile->delete($pdo);
开发者ID:CreativeCorrie,项目名称:lynda,代码行数:10,代码来源:profile-shakedown.php

示例5: createAnonProfile

 static function createAnonProfile()
 {
     // Get the anon user's IP, and turn it into a nickname
     list($proxy, $ip) = common_client_ip();
     // IP + time + random number should help to avoid collisions
     $baseNickname = $ip . '-' . time() . '-' . common_good_rand(5);
     $profile = new Profile();
     $profile->nickname = $baseNickname;
     $id = $profile->insert();
     if (!$id) {
         // TRANS: Server exception.
         throw new ServerException(_m("Could not create anonymous user session."));
     }
     // Stick the Profile ID into the nickname
     $orig = clone $profile;
     $profile->nickname = 'anon-' . $id . '-' . $baseNickname;
     $result = $profile->update($orig);
     if (!$result) {
         // TRANS: Server exception.
         throw new ServerException(_m("Could not create anonymous user session."));
     }
     common_log(LOG_INFO, "AnonymousFavePlugin - created profile for anonymous user from IP: " . $ip . ', nickname = ' . $profile->nickname);
     return $profile;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:24,代码来源:AnonymousFavePlugin.php

示例6: strtolower

 function pre_deleteItem()
 {
     if ($this->getFromDB($this->fields["id"])) {
         $name = $this->fields['name'];
         $itemtype = $this->fields['itemtype'];
         //Delete all network ports
         self::deleteNetworking($itemtype);
         //Drop all dropdowns associated with itemtype
         self::deleteDropdownsForItemtype($itemtype);
         //Delete loans associated with this type
         self::deleteLoans($itemtype);
         //Delete loans associated with this type
         self::deleteUnicity($itemtype);
         //Delete reservations with this tyoe
         self::deleteReservations($itemtype);
         self::deleteReservationItems($itemtype);
         //Remove datainjection specific file
         self::deleteInjectionFile($name);
         //Delete profile informations associated with this type
         PluginGenericobjectProfile::deleteTypeFromProfile($itemtype);
         self::deleteTicketAssignation($itemtype);
         //Remove associations to simcards with this type
         self::deleteSimcardAssignation($itemtype);
         //Remove existing datainjection models
         self::removeDataInjectionModels($itemtype);
         //Delete specific locale directory
         self::deleteLocales($name, $itemtype);
         self::deleteItemtypeReferencesInGLPI($itemtype);
         self::deleteItemTypeFilesAndClasses($name, $this->getTable(), $itemtype);
         //self::deleteNotepad($itemtype);
         if (preg_match("/PluginGenericobject(.*)/", $itemtype, $results)) {
             $newrightname = 'plugin_genericobject_' . strtolower($results[1]) . 's';
             ProfileRight::deleteProfileRights(array($newrightname));
         }
         $prof = new Profile();
         $profiles = getAllDatasFromTable('glpi_profiles');
         foreach ($profiles as $profile) {
             $helpdesk_item_types = json_decode($profile['helpdesk_item_type'], true);
             if ($helpdesk_item_types !== null) {
                 $index = array_search($itemtype, $helpdesk_item_types);
                 if ($index) {
                     unset($helpdesk_item_types[$index]);
                     $tmp['id'] = $profile['id'];
                     $tmp['helpdesk_item_type'] = json_encode($helpdesk_item_types);
                     $prof->update($tmp);
                 }
             }
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:btry,项目名称:genericobject,代码行数:53,代码来源:type.class.php

示例7: Copyright

 You should have received a copy of the GNU General Public License
 along with Genericobject. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
 @package   genericobject
 @author    the genericobject plugin team
 @copyright Copyright (c) 2010-2011 Order plugin team
 @license   GPLv2+
            http://www.gnu.org/licenses/gpl.txt
 @link      https://forge.indepnet.net/projects/genericobject
 @link      http://www.glpi-project.org/
 @since     2009
 ---------------------------------------------------------------------- */
include "../../../inc/includes.php";
Session::checkRight("profile", UPDATE);
_log($_POST);
$prof = new Profile();
/* save profile */
if (isset($_POST['update_all_rights']) && isset($_POST['itemtype'])) {
    $profiles = array();
    foreach ($_POST as $key => $val) {
        if (preg_match("/^profile_/", $key)) {
            $id = preg_replace("/^profile_/", "", $key);
            $profiles[$id] = array("id" => $id, "_" . PluginGenericobjectProfile::getProfileNameForItemtype($_POST['itemtype']) => $val);
        }
    }
    _log($profiles);
    foreach ($profiles as $profile_id => $input) {
        $prof->update($input);
    }
}
Html::redirect($_SERVER['HTTP_REFERER']);
开发者ID:drTr0jan,项目名称:genericobject,代码行数:31,代码来源:profile.form.php

示例8: updateProfile

 public static function updateProfile(Profile $profile, ActivityObject $object, array $hints = array())
 {
     $orig = clone $profile;
     // Existing nickname is better than nothing.
     if (!array_key_exists('nickname', $hints)) {
         $hints['nickname'] = $profile->nickname;
     }
     $nickname = self::getActivityObjectNickname($object, $hints);
     if (!empty($nickname)) {
         $profile->nickname = $nickname;
     }
     if (!empty($object->title)) {
         $profile->fullname = $object->title;
     } else {
         if (array_key_exists('fullname', $hints)) {
             $profile->fullname = $hints['fullname'];
         }
     }
     if (!empty($object->link)) {
         $profile->profileurl = $object->link;
     } else {
         if (array_key_exists('profileurl', $hints)) {
             $profile->profileurl = $hints['profileurl'];
         } else {
             if (common_valid_http_url($object->id)) {
                 $profile->profileurl = $object->id;
             }
         }
     }
     $bio = self::getActivityObjectBio($object, $hints);
     if (!empty($bio)) {
         $profile->bio = $bio;
     }
     $location = self::getActivityObjectLocation($object, $hints);
     if (!empty($location)) {
         $profile->location = $location;
     }
     $homepage = self::getActivityObjectHomepage($object, $hints);
     if (!empty($homepage)) {
         $profile->homepage = $homepage;
     }
     if (!empty($object->geopoint)) {
         $location = ActivityContext::locationFromPoint($object->geopoint);
         if (!empty($location)) {
             $profile->lat = $location->lat;
             $profile->lon = $location->lon;
         }
     }
     // @todo FIXME: tags/categories
     // @todo tags from categories
     if ($profile->id) {
         common_log(LOG_DEBUG, "Updating OStatus profile {$profile->id} from remote info {$object->id}: " . var_export($object, true) . var_export($hints, true));
         $profile->update($orig);
     }
 }
开发者ID:faulteh,项目名称:gnu-social,代码行数:55,代码来源:Ostatus_profile.php

示例9: Profile

*/
include '../inc/includes.php';
Session::checkRight("profile", READ);
if (!isset($_GET['id'])) {
    $_GET['id'] = "";
}
$prof = new Profile();
if (isset($_POST["add"])) {
    $prof->check(-1, CREATE, $_POST);
    $ID = $prof->add($_POST);
    // We need to redirect to form to enter rights
    Html::redirect($CFG_GLPI["root_doc"] . "/front/profile.form.php?id={$ID}");
} else {
    if (isset($_POST["purge"])) {
        $prof->check($_POST['id'], PURGE);
        if ($prof->delete($_POST, 1)) {
            $prof->redirectToList();
        } else {
            Html::back();
        }
    } else {
        if (isset($_POST["update"]) || isset($_POST["interface"])) {
            $prof->check($_POST['id'], UPDATE);
            $prof->update($_POST);
            Html::back();
        }
    }
}
Html::header(Profile::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "admin", "profile");
$prof->display(array('id' => $_GET["id"]));
Html::footer();
开发者ID:glpi-project,项目名称:glpi,代码行数:31,代码来源:profile.form.php

示例10: Profile

<?php

require_once 'classes/profile.php';
$profile = new Profile();
if (isset($_POST['profile_edit'])) {
    // is user allowed to edit this data?
    $data['first_name'] = $_POST['first_name'];
    // secure
    $data['last_name'] = $_POST['last_name'];
    // secure
    $data['facebook'] = $_POST['facebook'];
    // secure
    $data['twitter'] = $_POST['twitter'];
    // secure
    $data['location'] = $_POST['location'];
    // secure
    $data['homepage'] = $_POST['homepage'];
    // secure
    $data['biography'] = $_POST['biography'];
    // secure
    $data['privacy'] = $_POST['privacy'];
    $profile->update($data, $_SESSION['userid']);
    $msg = 'You have updated your profile.';
}
if ($_GET['action'] == 'confirm_email') {
    // do something
}
开发者ID:vebnz,项目名称:lifelitup,代码行数:27,代码来源:profile.php

示例11: createFirstAccess

 public static function createFirstAccess($ID)
 {
     $talk_profile = new self();
     $profile = new Profile();
     $dataprofile = array('id' => $ID);
     $profile->getFromDB($ID);
     foreach ($talk_profile->getAllRights(true) as $talk_r) {
         $g_rights = $profile->getRightsFor($talk_r['itemtype']);
         foreach ($g_rights as $g_right => $label) {
             $dataprofile['_' . $talk_r['field']][$g_right . "_0"] = 1;
         }
     }
     $profile->update($dataprofile);
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:14,代码来源:profile.class.php

示例12: handle

 function handle($args)
 {
     parent::handle($args);
     if (common_logged_in()) {
         $this->clientError(_('You can use the local subscription!'));
         return;
     }
     $omb = $_SESSION['oauth_authorization_request'];
     if (!$omb) {
         $this->clientError(_('Not expecting this response!'));
         return;
     }
     common_debug('stored request: ' . print_r($omb, true), __FILE__);
     common_remove_magic_from_request();
     $req = OAuthRequest::from_request();
     $token = $req->get_parameter('oauth_token');
     # I think this is the success metric
     if ($token != $omb['token']) {
         $this->clientError(_('Not authorized.'));
         return;
     }
     $version = $req->get_parameter('omb_version');
     if ($version != OMB_VERSION_01) {
         $this->clientError(_('Unknown version of OMB protocol.'));
         return;
     }
     $nickname = $req->get_parameter('omb_listener_nickname');
     if (!$nickname) {
         $this->clientError(_('No nickname provided by remote server.'));
         return;
     }
     $profile_url = $req->get_parameter('omb_listener_profile');
     if (!$profile_url) {
         $this->clientError(_('No profile URL returned by server.'));
         return;
     }
     if (!Validate::uri($profile_url, array('allowed_schemes' => array('http', 'https')))) {
         $this->clientError(_('Invalid profile URL returned by server.'));
         return;
     }
     if ($profile_url == common_local_url('showstream', array('nickname' => $nickname))) {
         $this->clientError(_('You can use the local subscription!'));
         return;
     }
     common_debug('listenee: "' . $omb['listenee'] . '"', __FILE__);
     $user = User::staticGet('nickname', $omb['listenee']);
     if (!$user) {
         $this->clientError(_('User being listened to doesn\'t exist.'));
         return;
     }
     $other = User::staticGet('uri', $omb['listener']);
     if ($other) {
         $this->clientError(_('You can use the local subscription!'));
         return;
     }
     $fullname = $req->get_parameter('omb_listener_fullname');
     $homepage = $req->get_parameter('omb_listener_homepage');
     $bio = $req->get_parameter('omb_listener_bio');
     $location = $req->get_parameter('omb_listener_location');
     $avatar_url = $req->get_parameter('omb_listener_avatar');
     list($newtok, $newsecret) = $this->access_token($omb);
     if (!$newtok || !$newsecret) {
         $this->clientError(_('Couldn\'t convert request tokens to access tokens.'));
         return;
     }
     # XXX: possible attack point; subscribe and return someone else's profile URI
     $remote = Remote_profile::staticGet('uri', $omb['listener']);
     if ($remote) {
         $exists = true;
         $profile = Profile::staticGet($remote->id);
         $orig_remote = clone $remote;
         $orig_profile = clone $profile;
         # XXX: compare current postNotice and updateProfile URLs to the ones
         # stored in the DB to avoid (possibly...) above attack
     } else {
         $exists = false;
         $remote = new Remote_profile();
         $remote->uri = $omb['listener'];
         $profile = new Profile();
     }
     $profile->nickname = $nickname;
     $profile->profileurl = $profile_url;
     if (!is_null($fullname)) {
         $profile->fullname = $fullname;
     }
     if (!is_null($homepage)) {
         $profile->homepage = $homepage;
     }
     if (!is_null($bio)) {
         $profile->bio = $bio;
     }
     if (!is_null($location)) {
         $profile->location = $location;
     }
     if ($exists) {
         $profile->update($orig_profile);
     } else {
         $profile->created = DB_DataObject_Cast::dateTime();
         # current time
         $id = $profile->insert();
//.........这里部分代码省略.........
开发者ID:Br3nda,项目名称:laconica,代码行数:101,代码来源:finishremotesubscribe.php

示例13: save

 public function save()
 {
     // check if data posted
     $fields = $this->request['params']['profile'];
     // check errors
     $errors = [];
     $required = ['name', 'city', 'city_feed', 'professions'];
     foreach ($required as $r) {
         if (empty($fields[$r])) {
             $errors[] = $r;
         }
     }
     // update if no errors
     if (empty($errors)) {
         if (Profile::update($fields)) {
             // tell the application to refresh the session data
             Auth::updateUser();
             die(json_encode(array('success' => true, 'msg' => "Your profile is all set!")));
         }
         // update went wrong, show errors
         die(json_encode(array('success' => false, 'error' => $errors)));
     }
     // form errors! back to signup form
     die(json_encode(array('success' => false, 'error' => $errors)));
 }
开发者ID:tiger154,项目名称:prototype,代码行数:25,代码来源:ProfileController.php

示例14: connectToEncryptedMySQL

<?php

/**
 * Created by PhpStorm.
 * User: OldManVin
 * Date: 1/22/2016
 * Time: 12:01 PM
 */
require_once "/etc/apache2/capstone-mysql/encrypted -config.php";
$pdo = connectToEncryptedMySQL("/ect/apache2/data-design/dfontaine1/ini");
require_once "/etc/apache2/capstone-mysql/encrypted-config.php";
require_once "your-class-file.php";
//now use the PDO object normally
$tweet = new Profile(null, 1, "this is from php");
$tweet->insert($pdo);
$tweet->setProfile("now i change the message");
$tweet->update($pdo);
$tweet->delete($pdo);
开发者ID:Cuneo,项目名称:imgur,代码行数:18,代码来源:profile-shakedown.php

示例15: plugin_simcard_profileRightUpdate

/**
 * Update helpdesk_item_type in a profile if a ProfileRight changes or is created
 * 
 * Add or remove simcard item type to match the status of "associable to tickets" in simcard's right
 * 
 * @since 1.4.1
 */
function plugin_simcard_profileRightUpdate($item)
{
    if ($item->fields['name'] == PluginSimcardProfile::RIGHT_SIMCARD_SIMCARD) {
        $profile = new Profile();
        $profile->getFromDB($item->fields['profiles_id']);
        $helpdeskItemTypes = json_decode($profile->fields['helpdesk_item_type'], true);
        $index = array_search('PluginSimcardSimcard', $helpdeskItemTypes);
        if ($item->fields['rights'] & PluginSimcardProfile::SIMCARD_ASSOCIATE_TICKET) {
            if ($index === false) {
                $helpdeskItemTypes[] = 'PluginSimcardSimcard';
                if ($_SESSION['glpiactiveprofile']['id'] == $profile->fields['id']) {
                    $_SESSION['glpiactiveprofile']['helpdesk_item_type'][] = 'PluginSimcardSimcard';
                }
            }
        } else {
            if ($index !== false) {
                unset($helpdeskItemTypes[$index]);
                if ($_SESSION['glpiactiveprofile']['id'] == $profile->fields['id']) {
                    // Just in case this is not the same index in the session vars
                    $index = array_search('PluginSimcardSimcard', $_SESSION['glpiactiveprofile']['helpdesk_item_type']);
                    if ($index !== false) {
                        unset($_SESSION['glpiactiveprofile']['helpdesk_item_type'][$index]);
                    }
                }
            }
        }
        $tmp = array('id' => $profile->fields['id'], 'helpdesk_item_type' => json_encode($helpdeskItemTypes));
        $profile->update($tmp, false);
    }
}
开发者ID:NandyJoshu,项目名称:simcard,代码行数:37,代码来源:hook.php


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