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


PHP Storage::validateFileId方法代码示例

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


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

示例1: handle_uploaded_avatar_pic

 function handle_uploaded_avatar_pic()
 {
     if (isset($_POST['user_filename'])) {
         $_POST['user_filename'] = Storage::validateFileId($_POST['user_filename']);
     }
     if (!empty($_FILES['userfile']['name'])) {
         // process uploaded image file
         $myUploadobj = new FileUploader();
         $file = $myUploadobj->upload_file(PA::$upload_path, 'userfile', true, true, 'image');
         if (!$file) {
             throw new PAException(FILE_NOT_UPLOADED, $myUploadobj->error);
         }
     } else {
         // download given image url
         $avatar_url = trim(@$_REQUEST['avatar_url']);
         if (!empty($avatar_url) && preg_match("|http://(.*?)/(.*)|", $avatar_url, $m)) {
             list(, $uf_server, $uf_path) = $m;
             $file = Storage::save($avatar_url, basename($uf_path), "critical", "image");
             if (!$file) {
                 throw new PAException(FILE_NOT_UPLOADED, sprintf(__("Could not retrieve file from URL: %s"), $avatar_url));
             }
         }
     }
     if (@$file) {
         $_POST['user_filename'] = $file;
         $_POST['avatar_url'] = '';
     }
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:28,代码来源:RegistrationPage.php

示例2: register


//.........这里部分代码省略.........
     }
     if ($this->error != TRUE) {
         $this->newuser->login_name = $login_name;
         //TODO: change to md5
         $this->newuser->password = $password;
         $this->newuser->first_name = $first_name;
         $this->newuser->last_name = $last_name;
         $this->newuser->email = $email;
         if ($date_created) {
             // for users inserted via import accounts script!
             $this->newuser->created = $date_created;
         }
         if ($this->api_call == true) {
             $this->newuser->core_id = $core_id;
             if ($picture != null && $picture != '') {
                 $this->newuser->picture = $picture;
                 $this->newuser->picture_dimensions = $picture_dimensions;
             } else {
                 $this->newuser->picture_dimensions = User::image_dimensions_to_array(0, 0);
             }
             if ($avatar != null && $avatar != '') {
                 $this->newuser->avatar = $avatar;
                 $this->newuser->avatar_dimensions = $avatar_dimensions;
             } else {
                 $this->newuser->avatar_dimensions = User::image_dimensions_to_array(0, 0);
             }
             if ($avatar_small != null && $avatar_small != '') {
                 $this->newuser->avatar_small = $avatar_small;
                 $this->newuser->avatar_small_dimensions = $avatar_small_dimensions;
             } else {
                 $this->newuser->avatar_small_dimensions = User::image_dimensions_to_array(0, 0);
             }
         } else {
             $this->newuser->picture = Storage::validateFileId(@$params['user_filename']);
         }
     }
     if ($this->error != TRUE) {
         try {
             $save_error = FALSE;
             $extra = unserialize($network_info->extra);
             if ($mother_extra['email_validation'] == NET_NO || $this->api_call == true) {
                 // if email validation not required
                 $this->newuser->is_active = ACTIVE;
             } else {
                 $this->newuser->is_active = UNVERIFIED;
             }
             $this->newuser->save();
             if ($this->newuser->picture) {
                 Storage::link($this->newuser->picture, array("role" => "avatar", "user" => $this->newuser->user_id));
             }
             /* The following code should now be obsolete as this is done in User->save() */
             // saving data in user profile data also -- for searching making more easier
             $data_array = array(array('uid' => $this->newuser->user_id, 'name' => 'first_name', 'value' => $this->newuser->first_name, 'type' => BASIC, 'perm' => 1), array('uid' => $this->newuser->user_id, 'name' => 'last_name', 'value' => $this->newuser->last_name, 'type' => BASIC, 'perm' => 1));
             $this->newuser->save_user_profile($data_array, BASIC);
             // saving default notification for user from network notification setting
             $user_notification = array();
             $profile = array();
             $user_notification = $extra['notify_members'];
             $user_notification['msg_waiting_blink'] = $extra['msg_waiting_blink'];
             $profile['settings']['name'] = 'settings';
             $profile['settings']['value'] = serialize($user_notification);
             $this->newuser->save_profile_section($profile, 'notifications');
             // default notification for user ends
             $desktop_images = User_Registration::get_default_desktopimage($this->newuser->user_id, $network_info);
             // code for adding default desktop image for user
             if ($desktop_images == "") {
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:67,代码来源:CNUserRegistration.php

示例3: __

        if (!$file) {
            $msg = $myUploadobj->error;
            $error = TRUE;
        } else {
            $msg = __('Successfully updated');
            Storage::link($file, array("role" => "tour_img"));
        }
    }
    $data = array();
    if ($_POST["userfile_url_0"]) {
        $data[0]['url'] = $_POST["userfile_url_0"];
    }
    if ($_POST['caption'][0]) {
        $data[0]['title'] = $_POST['caption'][0];
    }
    $data[0]['file_name'] = Storage::validateFileId($file ? $file : $_POST['userimage_0']);
    $data = serialize($data);
    $id = 2;
    // stands for the Update for Take Tour
    if (!$error) {
        ModuleData::update($data, $id);
    }
}
//render the page
$page = new PageRenderer("setup_module", PAGE_MANAGE_TAKETOUR, "Manage Take A Tour", 'container_two_column.tpl', 'header.tpl', PRI, HOMEPAGE, PA::$network_info);
if (!empty($msg)) {
    $msg_tpl = new Template(CURRENT_THEME_FSPATH . "/display_message.tpl");
    $msg_tpl->set('message', $msg);
    $m = $msg_tpl->fetch();
    $page->add_module("middle", "top", $m);
}
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:31,代码来源:manage_taketour.php


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