本文整理汇总了PHP中Link::dbinsert方法的典型用法代码示例。如果您正苦于以下问题:PHP Link::dbinsert方法的具体用法?PHP Link::dbinsert怎么用?PHP Link::dbinsert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Link
的用法示例。
在下文中一共展示了Link::dbinsert方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Link
/**
* Add new link to owner User
*
* @param integer file ID
* @param integer link position ( 'teaser', 'aftermore' )
* @param int order of the link
*/
function add_link($file_ID, $position, $order = 1)
{
global $current_User;
$edited_Link = new Link();
$edited_Link->set('usr_ID', $this->User->ID);
$edited_Link->set('file_ID', $file_ID);
$edited_Link->set('position', $position);
$edited_Link->set('order', $order);
if (empty($current_User)) {
// Current User not is set because probably we are creating links from upgrade script. Set the owner as creator and last editor.
$edited_Link->set('creator_user_ID', $this->User->ID);
$edited_Link->set('lastedit_user_ID', $this->User->ID);
}
$edited_Link->dbinsert();
}
示例2: Link
/**
* Add new link to owner Comment
*
* @param integer file ID
* @param integer link position ( 'teaser', 'aftermore' )
* @param int order of the link
* @param boolean true to update owner last touched timestamp after link was created, false otherwise
* @return integer|boolean Link ID on success, false otherwise
*/
function add_link($file_ID, $position = NULL, $order = 1, $update_owner = true)
{
if (is_null($position)) {
// Use default link position
$position = $this->get_default_position($file_ID);
}
$edited_Link = new Link();
$edited_Link->set('cmt_ID', $this->Comment->ID);
$edited_Link->set('file_ID', $file_ID);
$edited_Link->set('position', $position);
$edited_Link->set('order', $order);
if ($edited_Link->dbinsert()) {
$FileCache =& get_FileCache();
$File = $FileCache->get_by_ID($file_ID, false, false);
$file_name = empty($File) ? '' : $File->get_name();
syslog_insert(sprintf('File %s was linked to %s with ID=%s', '<b>' . $file_name . '</b>', $this->type, $this->link_Object->ID), 'info', 'file', $file_ID);
if ($update_owner) {
// Update last touched date of the Comment & Item
$this->update_last_touched_date();
}
return $edited_Link->ID;
}
return false;
}
示例3: Link
/**
* Add new link to owner User
*
* @param integer file ID
* @param integer link position ( 'teaser', 'aftermore' )
* @param int order of the link
* @return integer|boolean Link ID on success, false otherwise
*/
function add_link($file_ID, $position = NULL, $order = 1)
{
global $current_User;
if (is_null($position)) {
// Use default link position
$position = $this->get_default_position($file_ID);
}
$edited_Link = new Link();
$edited_Link->set('usr_ID', $this->User->ID);
$edited_Link->set('file_ID', $file_ID);
$edited_Link->set('position', $position);
$edited_Link->set('order', $order);
if (empty($current_User)) {
// Current User not is set because probably we are creating links from upgrade script. Set the owner as creator and last editor.
$edited_Link->set('creator_user_ID', $this->User->ID);
$edited_Link->set('lastedit_user_ID', $this->User->ID);
}
if ($edited_Link->dbinsert()) {
if (!is_null($this->Links)) {
// If user Links were already loaded update its content
$this->Links[$edited_Link->ID] =& $edited_Link;
}
$FileCache =& get_FileCache();
$File = $FileCache->get_by_ID($file_ID, false, false);
$file_name = empty($File) ? '' : $File->get_name();
syslog_insert(sprintf('File %s was linked to %s with ID=%s', '<b>' . $file_name . '</b>', $this->type, $this->link_Object->ID), 'info', 'file', $file_ID);
return $edited_Link->ID;
}
return false;
}
示例4: Link
}
$DB->begin('SERIALIZABLE');
// INSERT NEW POST INTO DB:
if ($edited_Item->dbinsert()) {
// echo '<br>file meta: '.$l_File->meta;
if ($l_File->meta == 'notfound') {
// That file has no meta data yet, create it now!
$l_File->dbsave();
}
// Let's make the link!
$edited_Link = new Link();
$edited_Link->set('itm_ID', $edited_Item->ID);
$edited_Link->set('file_ID', $l_File->ID);
$edited_Link->set('position', 'teaser');
$edited_Link->set('order', 1);
$edited_Link->dbinsert();
$DB->commit();
$Messages->add(sprintf(T_('«%s» has been posted.'), $l_File->dget('name')), 'success');
$fileNum++;
} else {
$DB->rollback();
$Messages->add(sprintf(T_('«%s» couldn\'t be posted.'), $l_File->dget('name')), 'error');
}
}
// Note: we redirect without restoring filter. This should allow to see the new files.
// &filter=restore
header_redirect($dispatcher . '?ctrl=items&blog=' . $blog);
// Will save $Messages
// Note: we should have EXITED here. In case we don't (error, or sth...)
// Reset stuff so it doesn't interfere with upcomming display
unset($edited_Item);
示例5: pbm_process_messages
//.........这里部分代码省略.........
if ($hasRelated) {
pbm_process_attachments($content, $parsedMIME['Related'], $mediadir, $pbmBlog->get_media_url(), true, 'related');
}
} else {
pbm_msg(T_('Unable to access media directory. No attachments processed.'), true);
}
} else {
pbm_msg(T_('Files module is disabled or missing!'), true);
}
}
// CHECK and FORMAT content
global $Plugins;
$renderer_params = array('Blog' => &$pbmBlog, 'setting_name' => 'coll_apply_rendering');
$renderers = $Plugins->validate_renderer_list($Settings->get('eblog_renderers'), $renderer_params);
pbm_msg('Applying the following text renderers: ' . implode(', ', $renderers));
// Do some optional filtering on the content
// Typically stuff that will help the content to validate
// Useful for code display
// Will probably be used for validation also
$Plugins_admin =& get_Plugins_admin();
$params = array('object_type' => 'Item', 'object_Blog' => &$pbmBlog);
$Plugins_admin->filter_contents($post_title, $content, $renderers, $params);
pbm_msg('Filtered post content: <pre style="font-size:10px">' . htmlspecialchars($content) . '</pre>');
$context = $Settings->get('eblog_html_tag_limit') ? 'commenting' : 'posting';
$post_title = check_html_sanity($post_title, $context, $pbmUser);
$content = check_html_sanity($content, $context, $pbmUser);
global $Messages;
if ($Messages->has_errors()) {
// Make it easier for user to find and correct the errors
pbm_msg("\n" . sprintf(T_('Processing message: %s'), $post_title), true);
pbm_msg($Messages->get_string(T_('Cannot post, please correct these errors:'), 'error'), true);
$Messages->clear();
rmdir_r($tmpDirMIME);
continue;
}
if ($test_mode_on) {
// Test mode
pbm_msg('<b class="green">It looks like the post can be successfully saved in the database. However we will not do it in test mode.</b>');
} else {
load_class('items/model/_item.class.php', 'Item');
global $pbm_items, $DB, $localtimenow;
$post_status = 'published';
pbm_msg(sprintf('<h4>Saving item "%s" in the database</h4>', $post_title));
// INSERT NEW POST INTO DB:
$edited_Item = new Item();
$edited_Item->set_creator_User($pbmUser);
$edited_Item->set($edited_Item->lasteditor_field, $pbmUser->ID);
$edited_Item->set('title', $post_title);
$edited_Item->set('content', $content);
$edited_Item->set('datestart', $post_date);
$edited_Item->set('datemodified', date('Y-m-d H:i:s', $localtimenow));
$edited_Item->set('main_cat_ID', $main_cat_ID);
$edited_Item->set('extra_cat_IDs', $extra_cat_IDs);
$edited_Item->set('status', $post_status);
$edited_Item->set('locale', $pbmUser->locale);
$edited_Item->set('renderers', $renderers);
// INSERT INTO DB:
$edited_Item->dbinsert('through_email');
pbm_msg(sprintf('Item created?: ' . (isset($edited_Item->ID) ? 'yes' : 'no')));
// Execute or schedule notifications & pings:
$edited_Item->handle_post_processing(true);
if (!empty($pbm_item_files)) {
// Attach files
$FileCache =& get_FileCache();
$order = 1;
foreach ($pbm_item_files as $filename) {
pbm_msg(sprintf('Saving file "%s" in the database', $filename));
$pbmFile =& $FileCache->get_by_root_and_path('collection', $pbmBlog->ID, $filename);
$pbmFile->meta = 'notfound';
// Save time and don't try to load meta from DB, it's not there anyway
$pbmFile->dbsave();
pbm_msg(sprintf('File saved?: ' . (isset($pbmFile->ID) ? 'yes' : 'no')));
pbm_msg(sprintf('Attaching file "%s" to the post', $filename));
// Let's make the link!
$pbmLink = new Link();
$pbmLink->set('itm_ID', $edited_Item->ID);
$pbmLink->set('file_ID', $pbmFile->ID);
$pbmLink->set('position', 'aftermore');
$pbmLink->set('order', $order++);
$pbmLink->dbinsert();
pbm_msg(sprintf('File attached?: ' . (isset($pbmLink->ID) ? 'yes' : 'no')));
}
}
// Save posted items sorted by author user for reports
$pbm_items['user_' . $pbmUser->ID][] = $edited_Item;
++$post_cntr;
}
pbm_msg('Message posting successful');
// Delete temporary directory
rmdir_r($tmpDirMIME);
if (!$test_mode_on && $Settings->get('eblog_delete_emails')) {
pbm_msg('Marking message for deletion from inbox: ' . $index);
imap_delete($mbox, $index);
++$del_cntr;
}
}
// Expunge messages marked for deletion
imap_expunge($mbox);
return true;
}
示例6: Link
/**
* Add new link to owner Comment
*
* @param integer file ID
* @param integer link position ( 'teaser', 'aftermore' )
* @param int order of the link
*/
function add_link($file_ID, $position, $order)
{
$edited_Link = new Link();
$edited_Link->set('cmt_ID', $this->Comment->ID);
$edited_Link->set('file_ID', $file_ID);
$edited_Link->set('position', $position);
$edited_Link->set('order', $order);
$edited_Link->dbinsert();
// Update last touched date of the Item
$this->item_update_last_touched_date();
}
示例7: Link
/**
* Add new link to owner Item
*
* @param integer file ID
* @param integer link position ( 'teaser', 'teaserperm', 'teaserlink', 'aftermore', 'inline', 'fallback' )
* @param int order of the link
* @param boolean true to update owner last touched timestamp after link was created, false otherwise
* @return integer|boolean Link ID on success, false otherwise
*/
function add_link($file_ID, $position = NULL, $order = 1, $update_owner = true)
{
if (is_null($position)) {
// Use default link position
$position = $this->get_default_position($file_ID);
}
$edited_Link = new Link();
$edited_Link->set('itm_ID', $this->Item->ID);
$edited_Link->set('file_ID', $file_ID);
$edited_Link->set('position', $position);
$edited_Link->set('order', $order);
if ($edited_Link->dbinsert()) {
// New link was added to the item, invalidate blog's media BlockCache
BlockCache::invalidate_key('media_coll_ID', $this->Item->get_blog_ID());
$FileCache =& get_FileCache();
$File = $FileCache->get_by_ID($file_ID, false, false);
$file_name = empty($File) ? '' : $File->get_name();
syslog_insert(sprintf('File %s was linked to %s with ID=%s', '<b>' . $file_name . '</b>', $this->type, $this->link_Object->ID), 'info', 'file', $file_ID);
if ($update_owner) {
// Update last touched date of the Item
$this->update_last_touched_date();
}
// Reset the Links
$this->Links = NULL;
$this->load_Links();
return $edited_Link->ID;
}
return false;
}