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


PHP Photo::delete方法代码示例

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


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

示例1: delete

 public function delete()
 {
     # Check dependencies
     self::dependencies(isset($this->database, $this->albumIDs));
     # Call plugins
     $this->plugins(__METHOD__, 0, func_get_args());
     # Init vars
     $error = false;
     # Execute query
     $stmt = $this->database->prepare("SELECT id FROM " . LYCHEE_TABLE_PHOTOS . " WHERE album IN (?)");
     $result = $stmt->execute(array($this->albumIDs));
     if ($result === FALSE) {
         Log::error($this->database, __METHOD__, __LINE__, print_r($this->database->errorInfo(), TRUE));
         return false;
     }
     # For each album delete photo
     while ($row = $stmt->fetchObject()) {
         $photo = new Photo($this->database, $this->plugins, null, $row->id);
         if (!$photo->delete($row->id)) {
             $error = true;
         }
     }
     # Delete albums
     $stmt = $this->database->prepare("DELETE FROM " . LYCHEE_TABLE_ALBUMS . " WHERE id IN (?)");
     $result = $stmt->execute(array($this->albumIDs));
     # Call plugins
     $this->plugins(__METHOD__, 1, func_get_args());
     if (!$result) {
         Log::error($this->database, __METHOD__, __LINE__, print_r($this->database->errorInfo(), TRUE));
         return false;
     }
     if ($error) {
         return false;
     }
     return true;
 }
开发者ID:rssc,项目名称:Lychee,代码行数:36,代码来源:Album.php

示例2: deletePhoto

 private function deletePhoto()
 {
     Module::dependencies(isset($_POST['photoIDs']));
     $photo = new Photo($this->database, $this->plugins, null, $_POST['photoIDs']);
     echo $photo->delete();
 }
开发者ID:fredrikcarno,项目名称:Lychee,代码行数:6,代码来源:Admin.php

示例3: delete

 public function delete()
 {
     # Check dependencies
     self::dependencies(isset($this->database, $this->albumIDs));
     # Call plugins
     $this->plugins(__METHOD__, 0, func_get_args());
     # Init vars
     $error = false;
     # Execute query
     $query = Database::prepare($this->database, "SELECT id FROM ? WHERE album IN (?)", array(LYCHEE_TABLE_PHOTOS, $this->albumIDs));
     $photos = $this->database->query($query);
     # For each album delete photo
     while ($row = $photos->fetch_object()) {
         $photo = new Photo($this->database, $this->plugins, null, $row->id);
         if (!$photo->delete($row->id)) {
             $error = true;
         }
     }
     # Delete albums
     $query = Database::prepare($this->database, "DELETE FROM ? WHERE id IN (?)", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
     $result = $this->database->query($query);
     # Call plugins
     $this->plugins(__METHOD__, 1, func_get_args());
     if ($error) {
         return false;
     }
     if (!$result) {
         Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
         return false;
     }
     return true;
 }
开发者ID:jonsychen,项目名称:docker-picture-gallery,代码行数:32,代码来源:Album.php

示例4: _copyAvatar

 /**
  * Копирует аватар пользователя из Vkontakte в систему
  */
 protected function _copyAvatar($avatarUrl)
 {
     //Читаем картинку и сохраняем в jpeg в нужную дирректорию
     $im = @imagecreatefromjpeg($avatarUrl);
     //JPEG:
     if ($im == false) {
         $im = @imagecreatefromgif($avatarUrl);
     }
     //GIF
     if ($im == false) {
         $im = @imagecreatefrompng($avatarUrl);
     }
     //png
     if ($im == false) {
         return;
     }
     // Определяем мета-данные картинки
     $usersService = ZendExtra_Controller_Action_Helper_Service::get('Users', 'users');
     $user = $usersService->getCurrentUser();
     $defaultService = ZendExtra_Controller_Action_Helper_Service::get('Default', 'default');
     $extension = $defaultService->getExtensionFromUrl($avatarUrl);
     $imageData = array('user_id' => $user['id'], 'object_type' => ObjectToItem::OBJECT_TYPE_USER, 'object_id' => $user['id'], 'width' => imagesx($im), 'height' => imagesy($im), 'mime_type' => $defaultService->getMimeTypeFromExtension($extension), 'type' => Photo::TYPE_AVATAR);
     $image = new Photo();
     $image->fromArray($imageData);
     if ($image->save() != FALSE) {
         return false;
     }
     // Копируем картинку
     $savePath = ROOT_PATH . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'pictures' . DIRECTORY_SEPARATOR . ObjectToItem::OBJECT_TYPE_USER . DIRECTORY_SEPARATOR . $image['id'] . '.' . $extension;
     if (!imagejpeg($im, $savePath)) {
         ImageDestroy($im);
         $image->delete();
         return false;
     }
     ImageDestroy($im);
     return true;
 }
开发者ID:netandreus,项目名称:exlibris,代码行数:40,代码来源:Twitter.php

示例5: get

 public function get()
 {
     $this->loadContact();
     switch ($_GET['cop']) {
         case 'logout':
             unset($_SESSION['Contact_User']);
             \PHPWS_Core::home();
             break;
         case 'edit_property':
             $this->checkPermission();
             $this->loadProperty($this->contact->id);
             $this->editProperty($this->contact->id);
             break;
         case 'view_properties':
             $this->checkPermission();
             $this->title = "Properties list";
             $this->propertiesList($this->contact->id);
             break;
         case 'photo_form':
             $photo = new Photo();
             echo $photo->form();
             exit;
             break;
         case 'activate_property':
             $this->checkPermission();
             $this->loadProperty();
             $this->property->setActive(true);
             $this->property->save();
             \PHPWS_Core::goBack();
             break;
         case 'deactivate_property':
             $this->checkPermission();
             $this->loadProperty();
             $this->property->setActive(false);
             $this->property->save();
             \PHPWS_Core::goBack();
             break;
         case 'edit_contact':
             $this->checkPermission();
             $this->editContact();
             break;
         case 'delete_photo':
             // called via ajax
             $this->checkPermission();
             ob_start();
             $photo = new Photo($_GET['id']);
             $photo->delete();
             echo Photo::getThumbs($photo->pid);
             exit;
             break;
         case 'delete_property':
             $this->checkPermission();
             $this->loadProperty();
             // double security
             if ($this->property->contact_id == $this->contact->id) {
                 $this->property->delete();
             }
             \PHPWS_Core::goBack();
             break;
         case 'make_main':
             $photo = new Photo($_GET['id']);
             $photo->makeMain();
             exit;
             break;
         case 'update':
             $this->checkPermission();
             $this->loadProperty();
             $this->property->update();
             \PHPWS_Core::goBack();
             break;
     }
     $this->display();
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:73,代码来源:Contact_User.php

示例6: get

 public function get()
 {
     if (!\Current_User::allow('properties')) {
         \Current_User::disallow('Action not allowed.');
     }
     switch ($_GET['aop']) {
         case 'delete_contact':
             if (!\Current_User::authorized('properties')) {
                 \Current_User::disallow();
             } else {
                 $this->loadContact();
                 try {
                     $this->contact->delete();
                 } catch (\Exception $e) {
                     \PHPWS_Error::log($e->getMessage());
                     $this->message = 'An error occurred when trying to delete a contact.';
                 }
             }
         case 'update':
             $this->loadProperty();
             $this->property->update();
             \PHPWS_Core::goBack();
             break;
         case 'show_properties':
             $this->panel->setCurrentTab('properties');
             $this->loadContact();
             $this->contactPropertiesList($_GET['cid']);
             break;
         case 'contacts':
             $this->title = 'Contacts list';
             $this->contactList();
             break;
         case 'photo_form':
             $photo = new Photo();
             echo $photo->form();
             exit;
             break;
         case 'edit_contact':
             $this->loadContact();
             $this->editContact();
             break;
         case 'edit_property':
             $this->loadProperty();
             if (isset($_GET['cid'])) {
                 $this->property->contact_id = $_GET['cid'];
             }
             $this->editProperty();
             break;
         case 'email_contacts':
             $this->emailContacts();
             break;
         case 'activate_contact':
             if (!\Current_User::authorized('properties')) {
                 \Current_User::disallow();
             }
             $this->loadContact();
             $this->contact->setActive(true);
             $this->contact->save();
             \PHPWS_Core::goBack();
             break;
         case 'show_blocked':
             $_SESSION['prop_show_blocked'] = 1;
             $this->viewReported();
             break;
         case 'hide_blocked':
             unset($_SESSION['prop_show_blocked']);
             $this->viewReported();
             break;
         case 'deactivate_contact':
             if (!\Current_User::authorized('properties')) {
                 \Current_User::disallow();
             }
             $this->loadContact();
             $this->contact->setActive(false);
             $this->contact->save();
             \PHPWS_Core::goBack();
             break;
         case 'activate_property':
             if (!\Current_User::authorized('properties')) {
                 \Current_User::disallow();
             }
             $this->loadProperty();
             $this->property->setActive(true);
             $this->property->save();
             \PHPWS_Core::goBack();
             break;
         case 'reported':
             $this->viewReported();
             break;
         case 'deactivate_property':
             if (!\Current_User::authorized('properties')) {
                 \Current_User::disallow();
             }
             $this->loadProperty();
             $this->property->setActive(false);
             $this->property->save();
             \PHPWS_Core::goBack();
             break;
         case 'delete_photo':
             // called via ajax
//.........这里部分代码省略.........
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:101,代码来源:Admin.php

示例7: delPhoto

function delPhoto($param)
{
    $name = clearTextData($param['name']);
    $num_deleted = Photo::delete($name);
    echo $name;
}
开发者ID:alex731,项目名称:m12private,代码行数:6,代码来源:ajax.php

示例8: deletePhoto

 private function deletePhoto()
 {
     Module::dependencies(isset($_POST['photoIDs']));
     $photo = new Photo(null, $_POST['photoIDs']);
     echo $photo->delete();
 }
开发者ID:waitman,项目名称:Lychee,代码行数:6,代码来源:Admin.php

示例9: get

 public function get()
 {
     $this->loadContact();
     switch ($_GET['cop']) {
         case 'logout':
             unset($_SESSION['Contact_User']);
             \PHPWS_Core::home();
             break;
         case 'manager_sign_up':
             if (!self::allowNewUserSignup()) {
                 $this->title = 'Sorry';
                 $this->content = '<p>New manager sign ups are not permitted at this time.</p>';
             } else {
                 $this->newManagerSetup();
             }
             break;
         case 'edit_property':
             $this->checkPermission();
             $this->loadProperty($this->contact->id);
             $this->editProperty($this->contact->id);
             break;
         case 'view_properties':
             $this->checkPermission();
             $this->title = "Properties list";
             $this->propertiesList($this->contact->id);
             break;
         case 'photo_form':
             $photo = new Photo();
             echo $photo->form();
             exit;
             break;
         case 'activate_property':
             $this->checkPermission();
             $this->loadProperty();
             $this->property->setActive(true);
             $this->property->save();
             \PHPWS_Core::goBack();
             break;
         case 'deactivate_property':
             $this->checkPermission();
             $this->loadProperty();
             $this->property->setActive(false);
             $this->property->save();
             \PHPWS_Core::goBack();
             break;
         case 'edit_contact':
             $this->checkPermission();
             $this->editContact();
             break;
         case 'delete_photo':
             // called via ajax
             $this->checkPermission();
             ob_start();
             $photo = new Photo($_GET['id']);
             $photo->delete();
             echo Photo::getThumbs($photo->pid);
             exit;
             break;
         case 'delete_property':
             $this->checkPermission();
             $this->loadProperty();
             // double security
             if ($this->property->contact_id == $this->contact->id) {
                 $this->property->delete();
             }
             \PHPWS_Core::goBack();
             break;
         case 'make_main':
             $photo = new Photo($_GET['id']);
             $photo->makeMain();
             exit;
             break;
         case 'update':
             $this->checkPermission();
             $this->loadProperty();
             $this->property->update();
             \PHPWS_Core::goBack();
             break;
         case 'checkUsername':
             $this->checkUsername();
             exit;
         case 'checkEmail':
             $this->checkEmail();
             exit;
     }
     $this->display();
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:87,代码来源:Contact_User.php


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