Пример #1
0
 /**
  * Method "ngg.editGallery"
  * Edit a existing gallery
  * 
  * @since 1.7.0
  * 
  * @param array $args Method parameters.
  * 			- int blog_id
  *	    	- string username
  *	    	- string password
  *	    	- int gallery ID
  *	    	- string gallery name
  *	    	- string title
  *	    	- string description 
  *          - int ID of the preview picture 
  * @return true if success
  */
 function editGallery($args)
 {
     global $ngg;
     require_once dirname(dirname(__FILE__)) . '/admin/functions.php';
     // admin functions
     $this->escape($args);
     $blog_ID = (int) $args[0];
     $username = $args[1];
     $password = $args[2];
     $id = (int) $args[3];
     $name = $args[4];
     $title = $args[5];
     $description = $args[6];
     $previewpic = (int) $args[7];
     if (!($user = $this->login($username, $password))) {
         return $this->error;
     }
     if (!($gallery = nggdb::find_gallery($id))) {
         return new IXR_Error(404, __("Invalid gallery ID"));
     }
     if (!current_user_can('NextGEN Manage gallery') && !nggAdmin::can_manage_this_gallery($gallery->author)) {
         return new IXR_Error(401, __('Sorry, you must be able to manage this gallery'));
     }
     if (!empty($name)) {
         $result = nggdb::update_gallery($id, $name, false, $title, $description, false, $previewpic);
     }
     if (!$result) {
         return new IXR_Error(500, __('Sorry, could not update the gallery'));
     }
     return true;
 }