當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Portfolio::insert方法代碼示例

本文整理匯總了PHP中Portfolio::insert方法的典型用法代碼示例。如果您正苦於以下問題:PHP Portfolio::insert方法的具體用法?PHP Portfolio::insert怎麽用?PHP Portfolio::insert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Portfolio的用法示例。


在下文中一共展示了Portfolio::insert方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addPortfolio

 static function addPortfolio($fields)
 {
     extract($fields);
     $portfolio = new Portfolio();
     $portfolio->name = $name;
     $portfolio->owner = $owner;
     $portfolio->created = common_sql_now();
     $portfolio->modified = common_sql_now();
     $result = $portfolio->insert();
     if (!$result) {
         common_log_db_error($portfolio, 'INSERT', __FILE__);
         return false;
     }
     return $portfolio;
 }
開發者ID:himmelex,項目名稱:NTW,代碼行數:15,代碼來源:Portfolio.php

示例2: Uploader

<?php

require __DIR__ . '/../../autoload.php';
$title = $_POST['name'];
$img = $_FILES['image'];
$description = $_POST['description'];
$uploaddir = __DIR__ . "/../../img";
/*upload img*/
$name_file = 'image';
$img = '/../../img/' . $_FILES['image']['name'];
if (!empty($img) && !empty($title) && !empty($description)) {
    $uploads = new Uploader($name_file);
    $uploads->upload($uploaddir);
    $portfolio = new Portfolio();
    $portfolio->insert($title, $img, $description);
}
header("Location: ../../admin.php");
開發者ID:Alexandr1987,項目名稱:PHP1,代碼行數:17,代碼來源:PorfolioInsert.php

示例3: register

 /**
  * Register a new user account and profile and set up default subscriptions.
  * If a new-user welcome message is configured, this will be sent.
  *
  * @param array $fields associative array of optional properties
  *              string 'bio'
  *              string 'email'
  *              bool 'email_confirmed' pass true to mark email as pre-confirmed
  *              string 'fullname'
  *              string 'homepage'
  *              string 'location' informal string description of geolocation
  *              float 'lat' decimal latitude for geolocation
  *              float 'lon' decimal longitude for geolocation
  *              int 'location_id' geoname identifier
  *              int 'location_ns' geoname namespace to interpret location_id
  *              string 'nickname' REQUIRED
  *              string 'password' (may be missing for eg OpenID registrations)
  *              string 'code' invite code
  *              ?string 'uri' permalink to notice; defaults to local notice URL
  * @return mixed User object or false on failure
  */
 static function register($fields)
 {
     // MAGICALLY put fields into current scope
     extract($fields);
     $profile = new Profile();
     if (!empty($email)) {
         $email = common_canonical_email($email);
     }
     $nickname = common_canonical_nickname($nickname);
     $profile->nickname = $nickname;
     if (!User::allowed_nickname($nickname)) {
         common_log(LOG_WARNING, sprintf("Attempted to register a nickname that is not allowed: %s", $profile->nickname), __FILE__);
         return false;
     }
     $profile->profileurl = common_profile_url($nickname);
     if (!empty($fullname)) {
         $profile->fullname = $fullname;
     }
     if (!empty($homepage)) {
         $profile->homepage = $homepage;
     }
     if (!empty($bio)) {
         $profile->bio = $bio;
     }
     if (!empty($location)) {
         $profile->location = $location;
         $loc = Location::fromName($location);
         if (!empty($loc)) {
             $profile->lat = $loc->lat;
             $profile->lon = $loc->lon;
             $profile->location_id = $loc->location_id;
             $profile->location_ns = $loc->location_ns;
         }
     }
     $profile->created = common_sql_now();
     $user = new User();
     $user->nickname = $nickname;
     $user->type = $type;
     // Users who respond to invite email have proven their ownership of that address
     if (!empty($code)) {
         $invite = Invitation::staticGet($code);
         if ($invite && $invite->address && $invite->address_type == 'email' && $invite->address == $email) {
             $user->email = $invite->address;
         }
     }
     if (isset($email_confirmed) && $email_confirmed) {
         $user->email = $email;
     }
     // This flag is ignored but still set to 1
     $user->inboxed = 1;
     $user->created = common_sql_now();
     if (Event::handle('StartUserRegister', array(&$user, &$profile))) {
         $profile->query('BEGIN');
         $id = $profile->insert();
         if (empty($id)) {
             common_log_db_error($profile, 'INSERT', __FILE__);
             return false;
         }
         $user->id = $id;
         $user->uri = common_user_uri($user);
         if (!empty($password)) {
             // may not have a password for OpenID users
             $user->password = common_munge_password($password, $id);
         }
         $result = $user->insert();
         if (!$result) {
             common_log_db_error($user, 'INSERT', __FILE__);
             return false;
         }
         // Everyone gets an inbox
         $inbox = new Inbox();
         $inbox->user_id = $user->id;
         $inbox->notice_ids = '';
         $result = $inbox->insert();
         if (!$result) {
             common_log_db_error($inbox, 'INSERT', __FILE__);
             return false;
         }
         //creat default portfolio
//.........這裏部分代碼省略.........
開發者ID:himmelex,項目名稱:NTW,代碼行數:101,代碼來源:User.php


注:本文中的Portfolio::insert方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。