NAD
//-----------------------------------------
// Add the cblock
//-----------------------------------------
$cb_id = intval( $this->request['cbid'] );
/* Default cBlocks Record */
$this->DB->build( array( 'select' => '*',
'from' => 'blog_default_cblocks',
'where' => 'cbdef_default=1 and cbdef_id IN(' . $cb_id . ')' ) );
$o = $this->DB->execute();
while( $row = $this->DB->fetch( $o ) )
{
if ( $row['cbdef_id'] )
{
$this->DB->insert( 'blog_cblocks', array( 'blog_id' => $this->blog['blog_id'],
'member_id' => $this->memberData['member_id'],
'cblock_order' => 999,
'cblock_show' => 0,
'cblock_type' => 'default',
'cblock_ref_id' => $cb_id ) );
$this->request['cbid'] = $this->DB->getInsertId();
}
}
//-----------------------------------------
// And then enable..
//-----------------------------------------
$this->_enableCblock();
}
/**
* Display Content Block (return Block HTML)
*
* @access public
* @param integer $cb_id
* @return void
*/
public function _displayCblock( $cb_id )
{
$this->settings[ 'blog_inline_edit'] = 1 ;
//-----------------------------------------
// Load the Content Block lib
//-----------------------------------------
require_once( IPSLib::getAppDir('blog') . '/sources/classes/contentblocks/blocks.php' );
$cblock_lib = new contentBlocks( $this->registry );
$html = $cblock_lib->get_cblock_html( $cb_id );
if ( !$html )
{
$this->returnJsonError( 'no_html' );
}
$content = array( 'cb_id' => $cb_id, 'cb_html' => $html );
$this->returnJsonArray( $content );
}
}
TUTAJ LINIA 554:
:getAppDir('core') . '/sources/classes/attach/class_attach.php' );
POD
$class_attach = new class_attach( $this->registry );
$class_attach->type = 'blogcblock';
$class_attach->init();
$class_attach->bulkRemoveAttachment( array( $cblock['cbcus_id'] ) );
$this->DB->delete( 'blog_custom_cblocks', "cbcus_id = {$cblock['cbcus_id']}" );
$this->DB->delete( 'blog_cblocks', "cblock_id = {$cblock['cblock_id']}" );
/* Update cache */
require_once( IPSLib::getAppDir('blog') . '/sources/classes/contentblocks/blocks.php' );
$cblock_lib = new contentBlocks( $this->registry );
$cblock_lib->recacheAllBlocks( $this->blog['blog_id'] );
$this->returnString( $cblock['cbcus_name'] );
}
else
{
$this->returnString( "error" );
}
}
/**
* Enable a custom block
*
* @access private
* @return void
*/
private function _enableCblock()
{
//-----------------------------------------
// Enable the cblock
//-----------------------------------------