Changeset 852:969647a6c35e for inc/core
- Timestamp:
- 07/31/12 15:15:32 (13 years ago)
- Branch:
- sexy
- Location:
- inc/core
- Files:
-
- 2 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.auth.php
r851 r852 75 75 'publish' => __('publish entries and comments'), 76 76 'delete' => __('delete entries and comments'), 77 'contentadmin' => __('manage all entries and comments'), 78 'media' => __('manage their own media items'), 79 'media_admin' => __('manage all media items') 77 'contentadmin' => __('manage all entries and comments') 80 78 ); 81 79 } -
inc/core/class.dc.blog.php
r851 r852 361 361 $rs = $this->con->select($strReq); 362 362 $rs->core = $this->core; 363 $rs->_nb_media = array();364 363 $rs->extend('rsExtPost'); 365 364 -
inc/core/class.dc.core.php
r848 r852 35 35 public $wiki2xhtml; ///< <b>wiki2xhtml</b> wiki2xhtml object 36 36 public $plugins; ///< <b>dcModules</b> dcModules object 37 public $media; ///< <b>dcMedia</b> dcMedia object38 public $postmedia; ///< <b>dcPostMedia</b> dcPostMedia object39 37 public $rest; ///< <b>dcRestServer</b> dcRestServer object 40 38 public $log; ///< <b>dcLog</b> dcLog object … … 1202 1200 array('lang','string','en', 1203 1201 'Default blog language'), 1204 array('media_exclusion','string','/\.php$/i',1205 'File name exclusion pattern in media manager. (PCRE value)'),1206 array('media_img_m_size','integer',448,1207 'Image medium size in media manager'),1208 array('media_img_s_size','integer',240,1209 'Image small size in media manager'),1210 array('media_img_t_size','integer',100,1211 'Image thumbnail size in media manager'),1212 array('media_img_title_pattern','string','Title ;; Date(%b %Y) ;; separator(, )',1213 'Pattern to set image title when you insert it in a post'),1214 1202 array('nb_post_per_page','integer',20, 1215 1203 'Number of entries on home page and category pages'), -
inc/core/class.dc.rs.extensions.php
r851 r852 335 335 } 336 336 337 /**338 Returns post media count using a subquery.339 340 @param rs Invisible parameter341 @return <b>integer</b>342 */343 public static function countMedia($rs)344 {345 if (isset($rs->_nb_media[$rs->index()]))346 {347 return $rs->_nb_media[$rs->index()];348 }349 else350 {351 $strReq =352 'SELECT count(media_id) '.353 'FROM '.$rs->core->prefix.'post_media '.354 'WHERE post_id = '.(integer) $rs->post_id.' ';355 356 $res = (integer) $rs->core->con->select($strReq)->f(0);357 $rs->_nb_media[$rs->index()] = $res;358 return $res;359 }360 }361 337 } 362 338 -
inc/core/class.dc.xmlrpc.php
r851 r852 75 75 'List of most recent posts in the system'); 76 76 77 $this->addCallback('metaWeblog.newMediaObject',array($this,'mw_newMediaObject'),78 array('struct','string','string','string','struct'),79 'Upload a file on the web server');80 81 77 # MovableType methods 82 78 $this->addCallback('mt.getRecentPostTitles',array($this,'mt_getRecentPostTitles'), … … 573 569 574 570 return true; 575 }576 577 private function newMediaObject($blog_id,$user,$pwd,$file)578 {579 if (empty($file['name'])) {580 throw new Exception('No file name');581 }582 583 if (empty($file['bits'])) {584 throw new Exception('No file content');585 }586 587 $file_name = $file['name'];588 $file_bits = $file['bits'];589 590 $this->setUser($user,$pwd);591 $this->setBlog();592 593 $media = new dcMedia($this->core);594 595 $dir_name = path::clean(dirname($file_name));596 $file_name = basename($file_name);597 598 $dir_name = preg_replace('!^/!','',$dir_name);599 if ($dir_name != '')600 {601 $dir = explode('/',$dir_name);602 $cwd = './';603 foreach ($dir as $v)604 {605 $v = files::tidyFileName($v);606 $cwd .= $v.'/';607 $media->makeDir($v);608 $media->chdir($cwd);609 }610 }611 612 $media_id = $media->uploadBits($file_name,$file_bits);613 614 $f = $media->getFile($media_id);615 return array(616 'file' => $file_name,617 'url' => $f->file_url,618 'type' => files::getMimeType($file_name)619 );620 571 } 621 572 … … 940 891 } 941 892 942 public function mw_newMediaObject($blogid,$username,$password,$file)943 {944 return $this->newMediaObject($blogid,$username,$password,$file);945 }946 947 893 /* MovableType methods 948 894 --------------------------------------------------- */ … … 1024 970 { 1025 971 return $this->getTags($username,$password); 1026 }1027 1028 public function wp_uploadFile($blogid,$username,$password,$file)1029 {1030 return $this->newMediaObject($blogid,$username,$password,$file);1031 972 } 1032 973
Note: See TracChangeset
for help on using the changeset viewer.