本文整理汇总了PHP中loader::model方法的典型用法代码示例。如果您正苦于以下问题:PHP loader::model方法的具体用法?PHP loader::model怎么用?PHP loader::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类loader
的用法示例。
在下文中一共展示了loader::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _doLogin
protected function _doLogin()
{
$rules = array('email' => array('label' => __('email', 'users'), 'rules' => array('trim', 'required', 'max_length' => 255, 'callback__is_valid_login')), 'password' => array('label' => __('password', 'users'), 'rules' => array('trim', 'required', 'min_length' => 4, 'max_length' => 128)), 'remember' => array('label' => __('remember_me', 'users')));
if (uri::segment(4) == 'license' && !input::demo(0, '', false)) {
$rules['license'] = array('label' => __('license_new', 'system_license'), 'rules' => array('trim', 'required', 'callback__is_valid_license'));
}
validate::setRules($rules);
if (!validate::run()) {
return false;
}
if (!($user = $this->users_model->getUser(input::post('email'), false, false))) {
validate::setFieldError('email', __((strpos(input::post('email'), '@') === false ? 'username' : 'email') . '_invalid', 'users_signup'));
return false;
}
if (!$this->users_model->verifyPassword(input::post('password'), $user['password'], $user['user_id'])) {
validate::setFieldError('password', __('password_invalid', 'users_signup'));
return false;
}
if (uri::segment(4) == 'license' && !input::demo(0, '', false)) {
$access = $this->users_model->getPermissions($user['group_id'], 'system', 'license_manage');
if ($access) {
loader::model('system/license');
$this->license_model->changeLicense(input::post('license'));
}
}
$this->users_model->login($user['user_id'], input::post('remember'), $user);
if (uri::segment(4) == 'license') {
router::redirect('cp/help/license');
} else {
router::redirect('cp');
}
}
示例2: getTimeline
public static function getTimeline($user = array(), $privacy = 2, $template = 'timeline/helpers/timeline')
{
loader::model('timeline/timeline');
// Get actions
$actions = codebreeder::instance()->timeline_model->getActions($user ? $user['user_id'] : 0, true, 0, config::item('actions_per_page', 'timeline'));
$ratings = array();
// Do we have actions and are we logged in?
if ($actions && users_helper::isLoggedin()) {
foreach ($actions as $action) {
if ($action['rating']) {
$ratings[$action['relative_resource']][] = $action['item_id'];
} else {
$ratings['timeline'][] = $action['action_id'];
}
}
// Load votes and like models
loader::model('comments/votes');
loader::model('comments/likes');
// Get likes and votes
$likes = codebreeder::instance()->likes_model->getMultiLikes($ratings);
$votes = codebreeder::instance()->votes_model->getMultiVotes($ratings);
$ratings = $likes + $votes;
}
// Can we post messages?
$post = session::permission('messages_post', 'timeline') && codebreeder::instance()->users_model->getPrivacyAccess($user['user_id'], $privacy, false) ? true : false;
view::assign(array('actions' => $actions, 'user' => $user, 'post' => $post, 'ratings' => $ratings), '', $template);
// Update comments pagination
config::set('comments_per_page', config::item('comments_per_page', 'timeline'), 'comments');
return view::load($template, array(), 1);
}
示例3: view
public function view()
{
// Get URI vars
$newsID = (int) uri::segment(3);
// Get news entry
if (!$newsID || !($news = $this->news_model->getEntry($newsID, 'in_view')) || !$news['active']) {
error::show404();
}
// Do we have views enabled?
if (config::item('news_views', 'news')) {
// Update views counter
$this->news_model->updateViews($newsID);
}
// Load ratings
if (config::item('news_rating', 'news') == 'stars') {
// Load votes model
loader::model('comments/votes');
// Get votes
$news['user_vote'] = $this->votes_model->getVote('news', $newsID);
} elseif (config::item('news_rating', 'news') == 'likes') {
// Load likes model
loader::model('comments/likes');
// Get likes
$news['user_vote'] = $this->likes_model->getLike('news', $newsID);
}
// Assign vars
view::assign(array('newsID' => $newsID, 'news' => $news));
// Set title
view::setTitle($news['data_title']);
// Set meta tags
view::setMetaDescription($news['data_meta_description']);
view::setMetaKeywords($news['data_meta_keywords']);
// Load view
view::load('news/view');
}
示例4: deleteComments
public function deleteComments($resource, $itemID, $limit = false)
{
// Get resource ID
if (!($resourceID = config::item('resources', 'core', $resource, 'resource_id')) || !$itemID) {
return false;
}
if (!is_array($itemID)) {
$itemID = array($itemID);
}
$commentIDs = array();
// Get comment IDs
$result = $this->db->query("SELECT * FROM `:prefix:core_comments` WHERE `resource_id`=? AND `item_id` IN (?)", array($resourceID, $itemID))->result();
foreach ($result as $comment) {
$commentIDs[] = $comment['comment_id'];
}
// Delete reports
loader::model('reports/reports');
$this->reports_model->deleteReports('comment', $commentIDs);
// Delete comments
if ($retval = $this->db->delete('core_comments', array('resource_id' => $resourceID, 'item_id' => $itemID), $limit)) {
// Action hook
hook::action('comments/delete_multiple', $resourceID, $itemID);
}
return $retval;
}
示例5: fetch
function fetch($file, $templateid = null, $tpldir = null)
{
global $base_path;
$output =& loader::lib('output');
$params = $output->getAll();
extract($params);
if (!$templateid) {
$templateid = TEMPLATEID;
}
$style_path = $base_path . TPLDIR . '/';
$setting =& loader::model('setting');
$theme_config = $setting->get_conf('theme_' . $templateid, array());
if (isset($_config)) {
if ($theme_config) {
$_config = array_merge($_config, $theme_config);
}
} else {
$_config = $theme_config;
}
$footer = '<script src="' . $statics_path . 'js/common.js" type="text/javascript"></script>';
if (isset($loggedin) && $loggedin) {
$footer .= '<script src="' . $statics_path . 'js/admin.js" type="text/javascript"></script>';
}
$footer .= 'Pow' . 'ered by <a href="http://mei' . 'upic.m' . 'eiu.cn/" target="_blank">Mei' . 'uPic ' . MPIC_VERSION . '</a> ';
$footer .= safe_invert($setting->get_conf('site.footer'), true);
$show_process_info = $setting->get_conf('system.show_process_info');
ob_start();
include $this->template($file, $templateid, $tpldir);
$content = ob_get_clean();
return $content;
}
示例6: postBlog
public function postBlog($items, $users)
{
$stream = array();
loader::model('blogs/blogs');
$params = array('select_users' => false);
// Get blogs
$columns = array('`b`.`blog_id` IN (' . implode(',', array_keys($items)) . ')');
$blogs = codebreeder::instance()->blogs_model->getBlogs('in_list', $columns, array(), false, count($items), $params);
foreach ($items as $itemID => $data) {
if (isset($blogs[$itemID]) && isset($users[$blogs[$itemID]['user_id']])) {
foreach ($data as $actionID => $item) {
$stream[$itemID][$actionID]['html'] = view::load('blogs/timeline/blog', array('user' => $users[$blogs[$itemID]['user_id']], 'blog' => $blogs[$itemID], 'params' => $item['params']), true);
$stream[$itemID][$actionID]['rating']['total_votes'] = $blogs[$itemID]['total_votes'];
$stream[$itemID][$actionID]['rating']['total_score'] = $blogs[$itemID]['total_score'];
$stream[$itemID][$actionID]['rating']['total_rating'] = $blogs[$itemID]['total_rating'];
$stream[$itemID][$actionID]['rating']['total_likes'] = $blogs[$itemID]['total_likes'];
$stream[$itemID][$actionID]['rating']['type'] = config::item('blog_rating', 'blogs');
$stream[$itemID][$actionID]['comments']['total_comments'] = $blogs[$itemID]['total_comments'];
$stream[$itemID][$actionID]['comments']['privacy'] = $blogs[$itemID]['comments'];
$stream[$itemID][$actionID]['comments']['post'] = $blogs[$itemID]['comments'] && codebreeder::instance()->users_model->getPrivacyAccess($blogs[$itemID]['user_id'], $blogs[$itemID]['comments'], false, $users[$blogs[$itemID]['user_id']]['friends'] ? 1 : 0) ? true : false;
}
}
}
return $stream;
}
示例7: getPictures
public static function getPictures($params = array())
{
if (!session::permission('users_groups_browse', 'users') && !session::permission('users_types_browse', 'users')) {
return '';
}
loader::model('pictures/pictures');
$template = isset($params['template']) ? $params['template'] : 'pictures/helpers/pictures';
$user = isset($params['user']) && $params['user'] ? $params['user'] : array();
$userID = $user ? $user['user_id'] : (isset($params['user_id']) ? $params['user_id'] : 0);
$params['albums'] = true;
if ($userID) {
$params['join_columns'][] = '`p`.`user_id`=' . $userID;
}
if (!$userID || $userID != session::item('user_id')) {
if ($userID) {
$params['privacy'] = $userID;
} else {
$params['join_columns'][] = '`a`.`public`=1';
$params['join_columns'][] = '`u`.`verified`=1';
$params['join_columns'][] = '`u`.`active`=1';
$params['join_columns'][] = '`u`.`group_id` IN (' . implode(',', session::permission('users_groups_browse', 'users')) . ')';
$params['join_columns'][] = '`u`.`type_id` IN (' . implode(',', session::permission('users_types_browse', 'users')) . ')';
}
}
$params['limit'] = isset($params['limit']) ? $params['limit'] : 10;
$params['order'] = isset($params['order']) ? $params['order'] : '';
$pictures = codebreeder::instance()->pictures_model->getPictures('in_list', $params['join_columns'], array(), $params['order'], $params['limit'], $params);
view::assign(array('pictures' => $pictures, 'user' => $user, 'params' => $params), '', $template);
return view::load($template, array(), 1);
}
示例8: deleteEntry
public function deleteEntry($newsID, $news)
{
// Delete entry
$retval = $this->fields_model->deleteValues('news', $newsID);
if ($retval) {
// Delete comments
if ($news['total_comments']) {
loader::model('comments/comments');
$this->comments_model->deleteComments('news', $newsID, $news['total_comments']);
}
// Delete likes
if ($news['total_likes']) {
loader::model('comments/likes');
$this->likes_model->deleteLikes('news', $newsID, $news['total_likes']);
}
// Delete votes
if ($news['total_votes']) {
loader::model('comments/votes');
$this->votes_model->deleteVotes('news', $newsID, $news['total_votes']);
}
// Action hook
hook::action('news/delete', $newsID, $news);
}
return $retval;
}
示例9: copyselectedurl
function copyselectedurl($config = array())
{
need_login('ajax_page');
global $base_root;
$ids = $this->getPost('sel_id');
if (!$ids || count($ids) == 0) {
ajax_box(lang('copyimg:pls_sel_photo_want_to_copy'));
} else {
$site_url = $this->setting->get_conf('site.url');
$mdl_photo =& loader::model('photo');
$ids = array_keys($ids);
$html = '';
$urls = '';
$ubb = '';
foreach ($ids as $id) {
$pic = $mdl_photo->get_info($id);
$img_path = img_path($pic['path']);
$html_code = $config['tpl'];
$html_code = str_replace('{thumbpath}', img_path($pic['thumb']), $html_code);
$html_code = str_replace('{imgpath}', $img_path, $html_code);
$html_code = str_replace('{imgname}', $pic['name'], $html_code);
$html_code = str_replace('{detailurl}', $base_root . site_link('photos', 'view', array('id' => $pic['id'])), $html_code);
$html .= $html_code . $config['split'];
$urls .= $img_path . "\r\n";
$ubb .= '[IMG]' . $img_path . "[/IMG]\r\n";
}
$this->output->set('img_url', $urls);
$this->output->set('img_html', $html);
$this->output->set('img_ubb', $ubb);
loader::view('copyimg:copyurlall');
}
}
示例10: sendTemplate
public function sendTemplate($keyword, $email, $tags = array(), $language = '')
{
loader::model('system/emailtemplates');
if (!$language) {
$language = config::item('language_id', 'system');
}
if (is_numeric($language)) {
$language = config::item('languages', 'core', 'keywords', $language);
} elseif (!in_array($language, config::item('languages', 'core', 'keywords'))) {
return false;
}
if (!($template = config::item($keyword . '_' . $language, '_system_emails_cache'))) {
if (!($template = $this->cache->item('core_email_template_' . $keyword . '_' . $language))) {
$template = $this->emailtemplates_model->prepareTemplate($keyword, $language);
if (count($template) == 3) {
if ($template[$keyword]['active']) {
$template = array('subject' => $template[$keyword]['subject'], 'message_html' => utf8::trim($template['header']['message_html'] . $template[$keyword]['message_html'] . $template['footer']['message_html']), 'message_text' => utf8::trim($template['header']['message_text'] . "\n\n" . $template[$keyword]['message_text'] . "\n\n" . $template['footer']['message_text']));
} else {
$template = 'none';
}
} else {
error::show('Could not fetch email template from the database: ' . $keyword);
}
$this->cache->set('core_email_template_' . $keyword . '_' . $language, $template, 60 * 60 * 24 * 30);
}
config::set(array($keyword . '_' . $language => $template), '', '_system_emails_cache');
}
$retval = true;
if (is_array($template) && $template) {
$retval = $this->sendEmail($email, $template['subject'], $template['message_text'], $template['message_html'], $tags);
}
return $retval;
}
示例11: _savePluginSettings
protected function _savePluginSettings($keyword, $value)
{
// Toggle news
if ($keyword == 'news_active') {
loader::model('system/lists');
$this->lists_model->toggleItemStatus('news', 'site_bottom_nav', 'site/news', $value);
}
}
示例12: usersSignup
public function usersSignup($userID, $user)
{
if (config::item('credits_signup_bonus', 'billing') && (!isset($user['total_credits']) || $user['total_credits'] == 0)) {
loader::model('billing/credits');
$this->credits_model->addCredits($userID, config::item('credits_signup_bonus', 'billing'));
}
return true;
}
示例13: cronRun
public function cronRun()
{
$this->counters_model->cleanup();
$this->search_model->cleanup();
loader::model('system/requests');
$this->requests_model->cleanup();
return true;
}
示例14: __construct
public function __construct()
{
parent::__construct();
if (!config::item('timeline_active', 'timeline') || !users_helper::isLoggedin()) {
error::show404();
}
loader::model('timeline/notices', array(), 'timeline_notices_model');
}
示例15: cronRun
public function cronRun()
{
if (config::item('notices_cleanup_delay', 'timeline')) {
loader::model('timeline/notices', array(), 'timeline_notices_model');
$this->timeline_notices_model->cleanup();
}
return true;
}