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


PHP cms_utils::get_search_module方法代码示例

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


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

示例1: delete_event

 public static function delete_event($event_id)
 {
     $event_id = (int) $event_id;
     $db = cmsms()->GetDb();
     $mod = cms_utils::get_module('CGCalendar');
     $events_table_name = $mod->events_table_name;
     $events_to_categories_table_name = $mod->events_to_categories_table_name;
     $event_field_values_table_name = $mod->event_field_values_table_name;
     if ($event_id < 1) {
         return FALSE;
     }
     $query = 'SELECT * FROM ' . $events_table_name . ' WHERE event_id = ? OR event_parent_id = ? ORDER BY event_parent_id DESC';
     $rows = $db->GetArray($query, array($event_id, $event_id));
     if (cmsms()->is_frontend_request()) {
         // userid has to match the owner
         $feu = cms_utils::get_module('FrontEndUsers');
         if (!$feu) {
             return;
         }
         $userid = $feu->LoggedInId();
         foreach ($rows as $row) {
             if ($row['event_created_by'] != $userid) {
                 // oops, we can't delete anything
                 audit($event_id, $mod->GetName(), "FEU user {$userid} attempted to delete an event owned by somebody else");
                 return FALSE;
             }
         }
     } else {
         // admin request.
         if (!$mod->CheckPermission('Modify Calendar')) {
             // userid has to match the owner.. and we have to have permission to edit my events
             if (!$mod->CheckPermission('Edit My Calendar Events')) {
                 $userid = get_userid(FALSE) * -1 - 100;
                 foreach ($rows as $row) {
                     if ($row['event_created_by'] != $userid) {
                         // oops. we can't delete this event.
                         audit($event_id, $mod->GetName(), "Admin user {$userid} attempted to delete an event owned by somebody else");
                         return FALSE;
                     }
                 }
             }
         }
     }
     $query1 = 'DELETE FROM ' . $event_field_values_table_name . ' WHERE event_id = ?';
     $query2 = 'DELETE FROM ' . $events_to_categories_table_name . ' WHERE event_id = ?';
     $query3 = 'DELETE FROM ' . $events_table_name . ' WHERE event_parent_id = ?';
     $query4 = 'DELETE FROM ' . $events_table_name . ' WHERE event_id = ?';
     foreach ($rows as $one) {
         $db->Execute($query1, array($event_id));
         $db->Execute($query2, array($event_id));
     }
     $db->Execute($query1, array($event_id));
     $db->Execute($query2, array($event_id));
     $db->Execute($query3, array($event_id));
     $db->Execute($query4, array($event_id));
     $mod->SendEvent('EventDeleted', array('event_id' => $event_id));
     $cgcal = cms_utils::get_module('CGCalendar');
     $search = cms_utils::get_search_module();
     if ($search) {
         $search->DeleteWords($cgcal->GetName(), $event_id);
     }
     return TRUE;
 }
开发者ID:rainbow-studio,项目名称:cmsms,代码行数:63,代码来源:class.cgcalendar_utils.php

示例2: cms_db_prefix

            // handle the custom fields
            $now = $db->DbTimeStamp(time());
            $query = 'INSERT INTO ' . cms_db_prefix() . "module_news_fieldvals\n                   (news_id, fielddef_id, value, create_date, modified_date)\n                  VALUES (?,?,?,{$now},{$now})";
            foreach ($params as $key => $value) {
                $value = trim($value);
                if (empty($value)) {
                    continue;
                }
                if (preg_match('/^news_customfield_/', $key)) {
                    $field_id = intval(substr($key, 17));
                    $db->Execute($query, array($articleid, $field_id, $value));
                }
            }
            // should've checked those errors too, but eh, I'm up for the odds.
            //Update search index
            $module = cms_utils::get_search_module();
            if (is_object($module)) {
                $module->AddWords($this->GetName(), $articleid, 'article', $content . ' ' . $summary . ' ' . $title . ' ' . $title, $useexp == 1 ? $enddate : NULL);
            }
            // Send an email
            $do_send_email = true;
            $do_redirect = true;
            // send an event
            @$this->SendEvent('NewsArticleAdded', array('news_id' => $articleid, 'category_id' => $category_id, 'title' => $title, 'content' => $content, 'summary' => $summary, 'status' => $status, 'start_time' => $startdate, 'end_time' => $enddate, 'useexp' => $useexp));
            // put mention into the admin log
            audit('', 'News Frontend Submit', 'Article added');
            // and we're done
            $smarty->assign('message', $this->Lang('articleadded'));
        }
    }
}
开发者ID:RTR-ITF,项目名称:usse-cms,代码行数:31,代码来源:action.fesubmit.php


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