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


PHP cmsActions::updateLog方法代码示例

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


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

示例1: blogs


//.........这里部分代码省略.........
                if ($ownertype=='single' && (cmsCore::c('user')->karma < cmsCore::m('blogs')->config['min_karma_private'])){
                    cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['BLOG_YOU_NEED'].' <a href="/users/'.cmsCore::c('user')->id.'/karma.html">'.$_LANG['BLOG_KARMS'].'</a> '.$_LANG['FOR_CREATE_PERSON_BLOG'].' &mdash; '.cmsCore::m('blogs')->config['min_karma_private'].', '.$_LANG['BLOG_HEAVING'].' &mdash; '.cmsCore::c('user')->karma));

                }
                
                // если коллективный блог
                if ($ownertype=='multi' && (cmsCore::c('user')->karma < cmsCore::m('blogs')->config['min_karma_public'])){
                    cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['BLOG_YOU_NEED'].' <a href="/users/'.cmsCore::c('user')->id.'/karma.html">'.$_LANG['BLOG_KARMS'].'</a> '.$_LANG['FOR_CREATE_TEAM_BLOG'].' &mdash; '.cmsCore::m('blogs')->config['min_karma_public'].', '.$_LANG['BLOG_HEAVING'].' &mdash; '.cmsCore::c('user')->karma));
                }
            }

            if(!cmsUser::checkCsrfToken()) { cmsCore::halt(); }

            //сохраняем авторов
            cmsCore::c('blog')->updateBlogAuthors($blog['id'], $authors);

            //сохраняем настройки блога
            $blog['seolink_new'] = cmsCore::c('blog')->updateBlog($blog['id'], array(
                'title'     => $title,
                'pagetitle' => $page_title,
                'meta_keys' => $meta_keys,
                'meta_desc' => $meta_desc,
                'allow_who' => $allow_who,
                'showcats'  => $showcats,
                'ownertype' => $ownertype,
                'premod'    => $premod,
                'forall'    => $forall
            ), cmsCore::m('blogs')->config['update_seo_link_blog']);

            $blog['seolink'] = $blog['seolink_new'] ? $blog['seolink_new'] : $blog['seolink'];

            if(stripslashes($title) != $blog['title']){
                // обновляем записи постов
                cmsActions::updateLog('add_post', array('target' => $title, 'target_url' => cmsCore::m('blogs')->getBlogURL($blog['seolink'])), 0, $blog['id']);
                // обновляем запись добавления блога
                cmsActions::updateLog('add_blog', array('object' => $title, 'object_url' => cmsCore::m('blogs')->getBlogURL($blog['seolink'])), $blog['id']);
            }

            cmsCore::jsonOutput(array('error' => false, 'redirect'  => cmsCore::m('blogs')->getBlogURL($blog['seolink'])));
        }
    }
    
    ////////// СПИСОК БЛОГОВ ///////////////////////////////////////////////////
    if ($inCore->do=='view_blogs'){
        // rss в адресной строке
        cmsCore::c('page')->addHead('<link rel="alternate" type="application/rss+xml" title="'.$_LANG['BLOGS'].'" href="'.HOST.'/rss/blogs/all/feed.rss">');

        // тип блога
        if($ownertype && $ownertype != 'all'){
            cmsCore::c('blog')->whereOwnerTypeIs($ownertype);
        }

        // всего блогов
        $total = cmsCore::c('blog')->getBlogsCount();

        //устанавливаем сортировку
        cmsCore::c('db')->orderBy('b.rating', 'DESC');

        cmsCore::c('db')->limitPage($page, cmsCore::m('blogs')->config['perpage_blog']);

        //Получаем список блогов
        $blogs = cmsCore::c('blog')->getBlogs(cmsCore::m('blogs'));
        if(!$blogs && $page > 1){ cmsCore::error404(); }

        //Генерируем панель со страницами и устанавливаем заголовки страниц и глубиномера
        switch ($ownertype){
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:67,代码来源:frontend.php

示例2: clubs


//.........这里部分代码省略.........
    $is_admin = $inUser->is_admin || ($inUser->id == $club['admin_id']);
    if (!$is_admin){ return false; }

    if (cmsCore::inRequest('save')){

        if (!cmsUser::checkCsrfToken()) { return false; }

        $description = cmsCore::badTagClear(cmsCore::request('description', 'html', ''));
        $new_club['description']      = $inDB->escape_string($description);
        $new_club['title']            = cmsCore::request('title', 'str', $club['title']);
        $new_club['clubtype']         = cmsCore::request('clubtype', 'str', 'public');
        $new_club['maxsize']          = cmsCore::request('maxsize', 'int', 0);
        $new_club['blog_min_karma']   = cmsCore::request('blog_min_karma', 'int', 0);
        $new_club['photo_min_karma']  = cmsCore::request('photo_min_karma', 'int', 0);
        $new_club['album_min_karma']  = cmsCore::request('album_min_karma', 'int', 0);
        $new_club['blog_premod']      = cmsCore::request('blog_premod', 'int', 0);
        $new_club['photo_premod']     = cmsCore::request('photo_premod', 'int', 0);
        $new_club['join_karma_limit'] = cmsCore::request('join_karma_limit', 'int', 0);
        $new_club['join_min_karma']   = cmsCore::request('join_min_karma', 'int', 0);
        if ($model->config['seo_user_access'] || $inUser->is_admin) {
            $new_club['pagetitle'] = cmsCore::request('pagetitle', 'str', '');
            $new_club['meta_keys'] = cmsCore::request('meta_keys', 'str', '');
            $new_club['meta_desc'] = cmsCore::request('meta_desc', 'str', '');
        }

        // загружаем изображение клуба
        $new_imageurl = $model->uploadClubImage($club['imageurl']);
        $new_club['imageurl'] = @$new_imageurl['filename'] ? $new_imageurl['filename'] : $club['imageurl'];

        // Сохраняем
        $model->updateClub($club['id'], $new_club);

        // Обновляем ленту активности
        cmsActions::updateLog('add_club', array('object' => $new_club['title']), $club['id']);
        cmsActions::updateLog('add_club_user', array('object' => $new_club['title']), $club['id']);

        if ($inUser->is_admin && IS_BILLING){
            $is_vip    = cmsCore::request('is_vip', 'int', 0);
            $join_cost = cmsCore::request('join_cost', 'int', 0);
            $model->setVip($club['id'], $is_vip, $join_cost);
        }

        $moders  = cmsCore::request('moderslist', 'array_int', array());
        $members = cmsCore::request('memberslist', 'array_int', array());

        $all_users = array_merge($members, $moders);

        // Сохраняем пользователей
        $model->clubSaveUsers($club['id'], $all_users);
        $model->clubSetRole($club['id'], $moders, 'moderator');

        // Кешируем количество
        $model->setClubMembersCount($club['id']);

        cmsCore::addSessionMessage($_LANG['CONFIG_SAVE_OK'], 'info');

        cmsCore::redirect('/clubs/'.$club['id']);

    }

    if (!cmsCore::inRequest('save')){

        // Заголовки и пафвей
        $inPage->addPathway($club['title'], '/clubs/'.$club['id']);
        $inPage->addPathway($_LANG['CONFIG_CLUB']);
        $inPage->setTitle($_LANG['CONFIG_CLUB']);
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:67,代码来源:frontend.php

示例3: comments


//.........这里部分代码省略.........
        if ($model->config['email']) {
            $mailmsg = str_replace(array('{sitename}', '{date}', '{from}', '{subjtitle}', '{targetlink}', '{content}'), array($inConf->sitename, date('d/m/Y (H:i)'), $from_nick, stripslashes($comment['target_title']), $targetlink, strip_tags($comment['content'])), cmsCore::getLanguageTextFile('newcomment_admin'));
            $inCore->mailText($model->config['email'], '', $mailmsg);
        }
        //отправляем автору уведомление на e-mail
        if ($author && $comment['published']) {
            if ($model->isAuthorNeedMail($author['id']) && $inUser->id != $author['id']) {
                $letter = cmsCore::getLanguageTextFile('newpostcomment');
                $letter = str_replace('{sitename}', $inConf->sitename, $letter);
                $letter = str_replace('{subj}', $target['subj'], $letter);
                $letter = str_replace('{subjtitle}', stripslashes($comment['target_title']), $letter);
                $letter = str_replace('{targetlink}', $targetlink, $letter);
                $letter = str_replace('{date}', date('d/m/Y H:i:s'), $letter);
                $letter = str_replace('{from}', $from_nick, $letter);
                $inCore->mailText($author['email'], '', $letter);
            }
        }
        if (!$comment['published']) {
            $message = str_replace(array('%user%', '%targetlink%'), array($from_nick, $targetlink), $_LANG['COMM_PREMODER_ADMIN_TEXT']);
            cmsUser::sendMessage(USER_UPDATER, 1, $message);
        }
        cmsCore::jsonOutput(array('error' => false, 'target' => $comment['target'], 'target_id' => $comment['target_id'], 'is_premod' => $comment['published'] ? 0 : $_LANG['COMM_PREMODER_TEXT'], 'comment_id' => $comment_id));
    }
    //========================================================================================================================//
    //========================================================================================================================//
    if ($do == 'edit') {
        if (!cmsCore::isAjax()) {
            cmsCore::error404();
        }
        $comment = $model->getComment(cmsCore::request('comment_id', 'int', 0));
        if (!$comment) {
            die;
        }
        // редактировать могут авторы (если время редактирования есть)
        // модераторы и администраторы
        if (!$model->is_can_moderate && !$inUser->is_admin && !($inUser->id == $comment['user_id'] && $comment['is_editable'])) {
            cmsCore::error404();
        }
        if ($model->is_can_bbcode) {
            $content = cmsCore::request('content', 'html', '');
            $com_new['content_bbcode'] = $inDB->escape_string($content);
            $com_new['content'] = $inDB->escape_string(cmsCore::parseSmiles($content, true));
        } else {
            $com_new['content'] = cmsCore::request('content', 'str', '');
            $com_new['content_bbcode'] = $com_new['content'];
            $com_new['content'] = str_replace(array('\\r', '\\n'), '<br>', $com_new['content']);
        }
        // Текст комментраия отсутствует
        if (!$com_new['content']) {
            cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['ERR_COMMENT_TEXT']));
        }
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        //Если ошибок не было,
        //обновляем комментарий в базе
        $model->updateComment($comment['id'], $com_new);
        // Обновляем в ленте активности
        $content_short = mb_substr(strip_tags($com_new['content']), 0, 140);
        cmsActions::updateLog('add_comment', array('description' => $content_short), $comment['id']);
        $com_new['content'] = stripslashes(str_replace(array('\\r', '\\n'), ' ', $com_new['content']));
        $com_new = cmsCore::callEvent('GET_COMMENT', $com_new);
        cmsCore::jsonOutput(array('error' => false, 'text' => $com_new['content'], 'comment_id' => $comment['id']));
    }
    //========================================================================================================================//
    //========================================================================================================================//
    if ($do == 'delete') {
        if (!cmsCore::isAjax()) {
            cmsCore::error404();
        }
        $comment = $model->getComment($id);
        if (!$comment) {
            cmsCore::error404();
        }
        if (!$inUser->id && !($model->is_can_delete && $inUser->id == $comment['user_id']) && !$model->is_can_moderate && !$inUser->is_admin) {
            cmsCore::error404();
        }
        //узнаем ответственный компонент из cms_comment_targets
        $target = $inDB->get_fields('cms_comment_targets', "target='{$comment['target']}'", '*');
        if (!$target) {
            cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['ERR_UNKNOWN_TARGET'] . ' #1'));
        }
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $model->deleteComment($id);
        //подключим модель этого компонента
        if (cmsCore::loadModel($target['component'])) {
            $model_class = 'cms_model_' . $target['component'];
            if (class_exists($model_class)) {
                $target_model = new $model_class();
                // Пересчитываем количество комментариев у цели если нужно
                if (method_exists($target_model, 'updateCommentsCount')) {
                    $target_model->updateCommentsCount($comment['target'], $comment['target_id']);
                }
            }
        }
        cmsCore::jsonOutput(array('error' => false, 'target' => $comment['target'], 'target_id' => $comment['target_id']));
    }
}
开发者ID:vicktorwork,项目名称:cms1,代码行数:101,代码来源:frontend.php

示例4: content


//.........这里部分代码省略.........
            $inUploadPhoto->thumbsqr = $model->config['img_sqr'];
            $inUploadPhoto->is_watermark = $model->config['watermark'];
            $inUploadPhoto->input_name = 'picture';
            $inUploadPhoto->filename = $file;
            // Процесс загрузки фото
            $inUploadPhoto->uploadPhoto();
            // операции после добавления/редактирования статьи
            // добавление статьи
            if ($do == 'addarticle') {
                // Получаем добавленную статью
                $article = $model->getArticle($article_id);
                if (!$article['published']) {
                    cmsCore::addSessionMessage($_LANG['ARTICLE_PREMODER_TEXT'], 'info');
                    // отсылаем уведомление администраторам
                    $link = '<a href="' . $model->getArticleURL(null, $article['seolink']) . '">' . $article['title'] . '</a>';
                    $message = str_replace('%user%', cmsUser::getProfileLink($inUser->login, $inUser->nickname), $_LANG['MSG_ARTICLE_SUBMIT']);
                    $message = str_replace('%link%', $link, $message);
                    cmsUser::sendMessageToGroup(USER_UPDATER, cmsUser::getAdminGroups(), $message);
                } else {
                    //регистрируем событие
                    cmsActions::log('add_article', array('object' => $article['title'], 'object_url' => $model->getArticleURL(null, $article['seolink']), 'object_id' => $article['id'], 'target' => $article['cat_title'], 'target_url' => $model->getCategoryURL(null, $article['catseolink']), 'target_id' => $article['category_id'], 'description' => ''));
                    if (IS_BILLING) {
                        $category_cost = $article['cost'] === '' ? false : (int) $article['cost'];
                        cmsBilling::process('content', 'add_content', $category_cost);
                    }
                    cmsUser::checkAwards($inUser->id);
                }
                cmsCore::addSessionMessage($_LANG['ARTICLE_SAVE'], 'info');
                cmsCore::redirect('/my.html');
            }
            // Редактирование статьи
            if ($do == 'editarticle') {
                $model->updateArticle($item['id'], $article, true);
                cmsActions::updateLog('add_article', array('object' => $article['title']), $item['id']);
                if (!$article['published']) {
                    $link = '<a href="' . $model->getArticleURL(null, $item['seolink']) . '">' . $article['title'] . '</a>';
                    $message = str_replace('%user%', cmsUser::getProfileLink($inUser->login, $inUser->nickname), $_LANG['MSG_ARTICLE_EDITED']);
                    $message = str_replace('%link%', $link, $message);
                    cmsUser::sendMessageToGroup(USER_UPDATER, cmsUser::getAdminGroups(), $message);
                }
                $mess = $article['published'] ? $_LANG['ARTICLE_SAVE'] : $_LANG['ARTICLE_SAVE'] . ' ' . $_LANG['ARTICLE_PREMODER_TEXT'];
                cmsCore::addSessionMessage($mess, 'info');
                cmsCore::redirect($model->getArticleURL(null, $item['seolink']));
            }
        }
    }
    ///////////////////////// PUBLISH ARTICLE /////////////////////////////////////////////////////////////////////////////
    if ($do == 'publisharticle') {
        if (!$inUser->id) {
            cmsCore::error404();
        }
        $article = $model->getArticle($id);
        if (!$article) {
            cmsCore::error404();
        }
        // Редактор с правами на добавление без модерации или администраторы могут публиковать
        if (!($article['modgrp_id'] == $inUser->group_id && cmsUser::isUserCan('content/autoadd')) && !$inUser->is_admin) {
            cmsCore::error404();
        }
        $inDB->setFlag('cms_content', $article['id'], 'published', 1);
        cmsCore::callEvent('ADD_ARTICLE_DONE', $article);
        if (IS_BILLING) {
            $author = $inDB->get_fields('cms_users', "id='{$article['user_id']}'", '*');
            $category_cost = $article['cost'] === '' ? false : (int) $article['cost'];
            cmsBilling::process('content', 'add_content', $category_cost, $author);
        }
开发者ID:deltas1,项目名称:icms1,代码行数:67,代码来源:frontend.php

示例5: unset

    $album_id = cmsCore::request('album_id', 'int', '');
    $album = $model->getPhotoAlbum('private', $album_id);
    if (!$album) {
        cmsCore::error404();
    }
    if ($album['user_id'] != $inUser->id && !$inUser->is_admin) {
        cmsCore::error404();
    }
    unset($album);
    $album['title'] = cmsCore::request('album_title', 'str', $_LANG['PHOTOALBUM'] . ' ' . date('d.m.Y'));
    $album['allow_who'] = cmsCore::request('album_allow_who', 'str', 'all');
    $album['description'] = cmsCore::request('description', 'str', '');
    $album['id'] = $album_id;
    $model->updatePhotoAlbum($album);
    cmsActions::updateLog('add_user_photo', array('target' => $album['title']), 0, $album_id);
    cmsActions::updateLog('add_user_photo_multi', array('target' => $album['title']), 0, $album_id);
    cmsCore::redirect('/users/' . $usr['login'] . '/photos/private' . $album_id . '.html');
}
/////////////////////////////// PHOTO EDIT /////////////////////////////////////////////////////////////////////////////////////////
if ($pdo == 'editphoto') {
    $usr = cmsUser::getShortUserData($id);
    if (!$usr) {
        cmsCore::error404();
    }
    $photo = $model->getPhoto(cmsCore::request('photoid', 'int', ''));
    if (!$photo) {
        cmsCore::error404();
    }
    if ($photo['user_id'] != $inUser->id && !$inUser->is_admin) {
        cmsCore::error404();
    }
开发者ID:vicktorwork,项目名称:cms1,代码行数:31,代码来源:photos.php

示例6: array

			}

		}

		//...или сохраняем пост после редактирования
		if ($bdo=='editpost') {
                    $mod['edit_times'] = (int)$post['edit_times']+1;

                    if (!$is_admin && !$is_moder) {
                        $mod['published'] = !$club['blog_premod'] ? 1 : 0;
                    }

                    $inBlog->updatePost($post['id'], $mod);

                    cmsActions::updateLog($inBlog->getTarget('actions_post'), array('object' => $mod['title']), $post['id']);

                    if (!($is_admin || $is_moder) && !$mod['published']) {
                        $message = str_replace('%user%', cmsUser::getProfileLink($inUser->login, $inUser->nickname), $_LANG['MSG_CLUB_POST_UPDATE']);
                        $message = str_replace('%post%', '<a href="'.$model->getPostURL($club['id'], $post['seolink']).'">'.$mod['title'].'</a>', $message);
                        $message = str_replace('%club%', '<a href="/clubs/'.$club['id'].'">'.$club['title'].'</a>', $message);

                        cmsUser::sendMessage(USER_UPDATER, $club['admin_id'], $message);

                        cmsCore::addSessionMessage($_LANG['POST_PREMODER_TEXT'], 'info');
                    } else {
                        cmsCore::addSessionMessage($_LANG['POST_UPDATED'], 'success');
                    }

                    cmsCore::redirect($model->getPostURL($club['id'], $post['seolink']));
		}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:30,代码来源:club_blogs.php

示例7: photos


//.........这里部分代码省略.........
        if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
            cmsCore::halt();
        }
        if (!$inUser->id) {
            cmsCore::halt();
        }
        // получаем фото
        $photo = cmsCore::callEvent('GET_PHOTO', $inPhoto->getPhoto($id));
        if (!$photo) {
            cmsCore::halt();
        }
        if (mb_strstr($photo['NSDiffer'], 'club')) {
            cmsCore::halt();
        }
        $is_author = $photo['user_id'] == $inUser->id && $inUser->id;
        if (!$inUser->is_admin && !$is_author) {
            cmsCore::halt();
        }
        if (cmsCore::inRequest('edit_photo')) {
            $mod['title'] = cmsCore::request('title', 'str', '');
            $mod['title'] = $mod['title'] ? $mod['title'] : $photo['title'];
            $mod['description'] = cmsCore::request('description', 'str', '');
            $mod['tags'] = cmsCore::request('tags', 'str', '');
            $mod['comments'] = $inUser->is_admin ? cmsCore::request('comments', 'int') : $photo['comments'];
            if ($model->config['seo_user_access'] || $inUser->is_admin) {
                $mod['pagetitle'] = cmsCore::request('pagetitle', 'str', '');
                $mod['meta_keys'] = cmsCore::request('meta_keys', 'str', '');
                $mod['meta_desc'] = cmsCore::request('meta_desc', 'str', '');
            }
            $file = $model->initUploadClass($inDB->getNsCategory('cms_photo_albums', $photo['album_id']))->uploadPhoto($photo['file']);
            $mod['file'] = $file['filename'] ? $file['filename'] : $photo['file'];
            $inPhoto->updatePhoto($mod, $photo['id']);
            $description = '<a href="/photos/photo' . $photo['id'] . '.html" class="act_photo"><img src="/images/photos/small/' . $mod['file'] . '" alt="' . htmlspecialchars(stripslashes($mod['title'])) . '" /></a>';
            cmsActions::updateLog('add_photo', array('object' => $mod['title'], 'description' => $description), $photo['id']);
            cmsCore::addSessionMessage($_LANG['PHOTO_SAVED'], 'success');
            cmsCore::jsonOutput(array('error' => false, 'redirect' => '/photos/photo' . $photo['id'] . '.html'));
        } else {
            $photo['tags'] = cmsTagLine('photo', $photo['id'], false);
            cmsPage::initTemplate('components', 'com_photos_edit')->assign('photo', $photo)->assign('form_action', '/photos/editphoto' . $photo['id'] . '.html')->assign('no_tags', false)->assign('is_admin', $inUser->is_admin)->assign('cfg', $model->config)->display('com_photos_edit.tpl');
            cmsCore::jsonOutput(array('error' => false, 'html' => ob_get_clean()));
        }
    }
    /////////////////////////////// PHOTO MOVE /////////////////////////////////////////////////////////////////////////////////////////
    if ($do == 'movephoto') {
        if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
            cmsCore::halt();
        }
        if (!$inUser->id) {
            cmsCore::halt();
        }
        $photo = cmsCore::callEvent('GET_PHOTO', $inPhoto->getPhoto($id));
        if (!$photo) {
            cmsCore::halt();
        }
        if (mb_strstr($photo['NSDiffer'], 'club')) {
            cmsCore::halt();
        }
        if (!$inUser->is_admin) {
            cmsCore::halt();
        }
        if (!cmsCore::inRequest('move_photo')) {
            cmsPage::initTemplate('components', 'com_photos_move')->assign('form_action', '/photos/movephoto' . $photo['id'] . '.html')->assign('html', $inPhoto->getAlbumsOption('', $photo['album_id']))->display('com_photos_move.tpl');
            cmsCore::jsonOutput(array('error' => false, 'html' => ob_get_clean()));
        } else {
            $album = cmsCore::callEvent('GET_PHOTO_ALBUM', $inDB->getNsCategory('cms_photo_albums', cmsCore::request('album_id', 'int')));
            if (!$album) {
开发者ID:deltas1,项目名称:icms1,代码行数:67,代码来源:frontend.php

示例8: board


//.........这里部分代码省略.........
            $errors = true;
        }
        if (!$update['content']) {
            cmsCore::addSessionMessage($_LANG['NEED_TEXT_ADV'], 'error');
            $errors = true;
        }
        if (!$update['city']) {
            cmsCore::addSessionMessage($_LANG['NEED_CITY'], 'error');
            $errors = true;
        }

        // Проверяем значения формы
        foreach ($form_input['errors'] as $field_error) {
            if ($field_error) {
                cmsCore::addSessionMessage($field_error, 'error');
                $errors = true;
            }
        }

        if ($errors) {
            $inCore->redirect('/board/edit'. $item['id'] .'.html');
        }

        if ($cat['is_photos']) {
            // Загружаем фото
            $file = cmsCore::m('board')->uploadPhoto($item['file'], $cat);
        }

        $update['file'] = $file['filename'] ? $file['filename'] : $item['file'];

        // обновляем объявление
        cmsCore::m('board')->updateRecord($item['id'], $update);
        // обновляем запись в ленте активности
        cmsActions::updateLog('add_board', array('object' => $update['obtype'] .' '. $update['title']), $item['id']);
        $vipdays = cmsCore::request('vipdays', 'int', 0);

        if (cmsCore::c('user')->is_admin) {
            if ($vipdays > 0) {
                cmsCore::m('board')->setVip($item['id'], $vipdays);
            }
            if ($vipdays == -1) {
                cmsCore::m('board')->deleteVip($item['id']);
            }
        }

        if (IS_BILLING) {
            if (cmsCore::m('board')->config['vip_enabled'] && cmsCore::m('board')->config['vip_prolong'] && $vipdays && cmsCore::m('board')->config['vip_day_cost']) {
                if ($vipdays > cmsCore::m('board')->config['vip_max_days']) {
                    $vipdays = cmsCore::m('board')->config['vip_max_days'];
                }

                $summ = $vipdays * cmsCore::m('board')->config['vip_day_cost'];

                if (cmsCore::c('user')->balance >= $summ) {
                    cmsBilling::pay(cmsCore::c('user')->id, $summ, $_LANG['VIP_ITEM']);
                    cmsCore::m('board')->setVip($item['id'], $vipdays);
                }
            }
        }

        cmsUser::sessionClearAll();

        if (!$update['published']) {
            $link = '<a href="/board/read'. $item['id'] .'.html">'. $update['obtype'] .' '. $update['title'] .'</a>';
            $user = '<a href="'. cmsUser::getProfileURL(cmsCore::c('user')->login) .'">'. cmsCore::c('user')->nickname .'</a>';
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:66,代码来源:frontend.php

示例9: array

    cmsCore::redirectBack();
}
if ($opt == 'update_blog') {
    if (!cmsUser::checkCsrfToken()) {
        cmsCore::error404();
    }
    $blog = $inBlog->getBlog(cmsCore::request('item_id', 'int', 0));
    if (!$blog) {
        cmsCore::error404();
    }
    $title = cmsCore::request('title', 'str', $blog['title']);
    $seolink_new = $inBlog->updateBlog($blog['id'], array('title' => $title), true);
    $blog['seolink'] = $seolink_new ? $seolink_new : $blog['seolink'];
    if (stripslashes($title) != $blog['title']) {
        cmsActions::updateLog('add_post', array('target' => $title, 'target_url' => $model->getBlogURL($blog['seolink'])), 0, $blog['id']);
        cmsActions::updateLog('add_blog', array('object' => $title, 'object_url' => $model->getBlogURL($blog['seolink'])), $blog['id']);
    }
    cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'] . '.  ' . $_LANG['AD_SAVE_SUCCESS'], 'success');
    if (empty($_SESSION['editlist'])) {
        cmsCore::redirect('?view=components&do=config&link=blogs&opt=list_blogs');
    } else {
        cmsCore::redirect('?view=components&do=config&link=blogs&opt=edit_blog');
    }
}
if ($opt == 'config') {
    require '../includes/jwtabs.php';
    $GLOBALS['cp_page_head'][] = jwHeader();
    cpAddPathway($_LANG['AD_SETTINGS']);
    $toolmenu[] = array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:document.optform.submit();');
    $toolmenu[] = array('icon' => 'listblogs.gif', 'title' => $_LANG['AD_BLOGS'], 'link' => '?view=components&do=config&link=blogs&opt=list_blogs');
    $toolmenu[] = array('icon' => 'config.gif', 'title' => $_LANG['AD_SETTINGS'], 'link' => '?view=components&do=config&link=blogs&opt=config');
开发者ID:r2git,项目名称:icms1,代码行数:31,代码来源:backend.php

示例10: forum


//.........这里部分代码省略.........
                    cmsUser::sendUpdateNotify('forum', $thread['id'], array('link' => '/forum/thread' . $thread['id'] . '-' . $total_pages . '.html#' . $post_id, 'title' => stripslashes($thread['title']), 'letter_file' => 'newforumpost', 'author' => $inUser->nickname));
                }
                // Подписываемся сами если нужно
                if (cmsCore::inRequest('subscribe')) {
                    cmsUser::subscribe($inUser->id, 'forum', $thread['id']);
                }
                // Если пост не в скрытый форум и не в объедненный с предыдущим, добавляем в ленту
                if (!$thread['is_hidden'] && $thread_post_count > $thread['post_count']) {
                    if ($do == 'newthread') {
                        cmsActions::log('add_thread', array('object' => $thread['title'], 'object_url' => '/forum/thread' . $thread['id'] . '-1.html', 'object_id' => $thread['id'], 'target' => $forum['title'], 'target_url' => '/forum/' . $forum['id'], 'target_id' => $forum['id'], 'description' => $message_post));
                    } else {
                        cmsActions::log('add_fpost', array('object' => $_LANG['MESSAGE'], 'object_url' => '/forum/thread' . $thread['id'] . '-' . $total_pages . '.html#' . $post_id, 'object_id' => $post_id, 'target' => $thread['title'], 'target_url' => '/forum/thread' . $thread['id'] . '.html', 'target_id' => $thread['id'], 'description' => $message_post));
                    }
                }
                // Для новой темы прикрепляем опрос если нужно
                if ($do == 'newthread') {
                    $model->addPoll(cmsCore::request('poll', 'array', array()), $thread['id']);
                    $last_poll_error = $model->getLastAddPollError();
                    if ($last_poll_error) {
                        cmsCore::addSessionMessage($last_poll_error, 'error');
                        cmsCore::redirect('/forum/editpost' . $post_id . '-1.html');
                    }
                }
                cmsCore::redirect('/forum/thread' . $thread['id'] . '-' . $total_pages . '.html#' . $post_id);
            } elseif ($do == 'editpost') {
                $model->updatePost(array('content' => $message_bb, 'content_html' => $message_html, 'edittimes' => $last_post['edittimes'] + 1, 'editdate' => date("Y-m-d H:i:s")), $last_post['id']);
                if ($model->config['fa_on'] && cmsCore::checkContentAccess($model->config['group_access'])) {
                    $file_error = $model->addUpdatePostAttachments($last_post['id']);
                    if ($file_error === false) {
                        cmsCore::addSessionMessage($_LANG['CHECK_SIZE_TYPE_FILE'] . $model->config['fa_max'], 'error');
                    }
                }
                if ($first_post_id == $last_post['id']) {
                    cmsActions::updateLog('add_thread', array('description' => $message_post), $thread['id']);
                    if ($thread_poll) {
                        $model->updatePoll(cmsCore::request('poll', 'array', array()), $thread_poll);
                    } else {
                        $model->addPoll(cmsCore::request('poll', 'array', array()), $thread['id']);
                    }
                    $last_poll_error = $model->getLastAddPollError();
                    if ($last_poll_error) {
                        cmsUser::sessionPut('thread', $thread);
                        cmsUser::sessionPut('post_content', stripcslashes($message_bb));
                        cmsCore::addSessionMessage($last_poll_error, 'error');
                        cmsCore::redirectBack();
                    }
                } else {
                    cmsActions::updateLog('add_fpost', array('description' => $message_post), $last_post['id']);
                }
                $model->updateForumCache($thread['NSLeft'], $thread['NSRight'], true);
                cmsCore::redirect('/forum/thread' . $thread['id'] . '-' . $page . '.html#' . $last_post['id']);
            }
        }
    }
    ///////////////////////////// DELETE POST /////////////////////////////////////////////////////////////////////////////////////////////////
    if ($do == 'deletepost') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        if (!$inUser->id) {
            cmsCore::error404();
        }
        $post = $model->getPost($id);
        if (!$post) {
            cmsCore::error404();
        }
开发者ID:deltas1,项目名称:icms1,代码行数:67,代码来源:frontend.php

示例11: catalog


//.........这里部分代码省略.........
            $item['imageurl'] = $file['filename'];
        }

        if ($opt=='add'){

            $item['pubdate'] = date('Y-m-d H:i');
            $item['user_id'] = $inUser->id;

            $item['id'] = $model->addItem($item);

            if (IS_BILLING){
                if ($cat['cost']=='') { $cat['cost'] = false; }
                cmsBilling::process('catalog', 'add_catalog_item', $cat['cost']);
            }

            if (!$cfg['premod'] || $inUser->is_admin) {

                cmsCore::callEvent('ADD_CATALOG_DONE', $item);

                //регистрируем событие
                cmsActions::log('add_catalog', array(
                    'object' => $item['title'],
                    'object_url' => '/catalog/item'.$item['id'].'.html',
                    'object_id' => $item['id'],
                    'target' => $cat['title'],
                    'target_url' => '/catalog/'.$cat['id'],
                    'target_id' => $cat['id'],
                    'description' => ''
                ));
            }
		}
        if ($opt=='edit'){
			$model->updateItem($item['id'], $item);
			cmsActions::updateLog('add_catalog', array('object' => $item['title']), $item['id']);
		}

        if ($inUser->id != 1 && $cfg['premod'] && $cfg['premod_msg']){

            $link = '<a href="/catalog/item'.$item['id'].'.html">'.$item['title'].'</a>';
            $user = '<a href="'.cmsUser::getProfileURL($inUser->login).'">'.$inUser->nickname.'</a>';

            if ($opt=='add')  { $message = $_LANG['MSG_ITEM_SUBMIT']; }
            if ($opt=='edit') { $message = $_LANG['MSG_ITEM_EDITED']; }
            $message = str_replace('%user%', $user, $message);
            $message = str_replace('%link%', $link, $message);

            cmsUser::sendMessage(USER_UPDATER, 1, $message);

            cmsCore::addSessionMessage($_LANG['ITEM_PREMOD_NOTICE'], 'info');

            cmsCore::redirect('/catalog/'.$item['category_id']);

        }

        cmsCore::redirect('/catalog/item'.$item['id'].'.html');

    }

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////

    if ($do == 'accept_item'){

        $item_id = cmsCore::request('item_id', 'int');

        $item = $inDB->get_fields('cms_uc_items', "id='{$item_id}'", 'title, user_id, category_id');
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:67,代码来源:frontend.php

示例12: blog


//.........这里部分代码省略.........
            if (!cmsCore::validateForm()) {
                cmsCore::halt();
            }
            //Получаем настройки
            $title = cmsCore::request('title', 'str');
            $allow_who = cmsCore::request('allow_who', 'str', 'all');
            $ownertype = cmsCore::request('ownertype', 'str', 'single');
            $premod = cmsCore::request('premod', 'int', 0);
            $forall = cmsCore::request('forall', 'int', 1);
            $showcats = cmsCore::request('showcats', 'int', 1);
            $authors = cmsCore::request('authorslist', 'array_int', array());
            //Проверяем настройки
            if (mb_strlen($title) < 5) {
                $title = $blog['title'];
            }
            //Проверяем ограничения по карме (для смены типа блога)
            if ($model->config['min_karma'] && !$inUser->is_admin) {
                // если персональный блог
                if ($ownertype == 'single' && $inUser->karma < $model->config['min_karma_private']) {
                    cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['BLOG_YOU_NEED'] . ' <a href="/users/' . $inUser->id . '/karma.html">' . $_LANG['BLOG_KARMS'] . '</a> ' . $_LANG['FOR_CREATE_PERSON_BLOG'] . ' &mdash; ' . $model->config['min_karma_private'] . ', ' . $_LANG['BLOG_HEAVING'] . ' &mdash; ' . $inUser->karma));
                }
                // если коллективный блог
                if ($ownertype == 'multi' && $inUser->karma < $model->config['min_karma_public']) {
                    cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['BLOG_YOU_NEED'] . ' <a href="/users/' . $inUser->id . '/karma.html">' . $_LANG['BLOG_KARMS'] . '</a> ' . $_LANG['FOR_CREATE_TEAM_BLOG'] . ' &mdash; ' . $model->config['min_karma_public'] . ', ' . $_LANG['BLOG_HEAVING'] . ' &mdash; ' . $inUser->karma));
                }
            }
            //сохраняем авторов
            $inBlog->updateBlogAuthors($blog['id'], $authors);
            //сохраняем настройки блога
            $blog['seolink_new'] = $inBlog->updateBlog($blog['id'], array('title' => $title, 'allow_who' => $allow_who, 'showcats' => $showcats, 'ownertype' => $ownertype, 'premod' => $premod, 'forall' => $forall), $model->config['update_seo_link_blog']);
            $blog['seolink'] = $blog['seolink_new'] ? $blog['seolink_new'] : $blog['seolink'];
            if (stripslashes($title) != $blog['title']) {
                // обновляем записи постов
                cmsActions::updateLog('add_post', array('target' => $title, 'target_url' => $model->getBlogURL()), 0, $blog['id']);
                // обновляем запись добавления блога
                cmsActions::updateLog('add_blog', array('object' => $title, 'object_url' => $model->getBlogURL()), $blog['id']);
            }
            // Очищаем токен
            cmsUser::clearCsrfToken();
            cmsCore::jsonOutput(array('error' => false, 'redirect' => $model->getBlogURL()));
        }
    }
    ////////// ПРОСМОТР БЛОГА ////////////////////////////////////////////////////////////////////////////////////////
    if ($do == 'blog') {
        // получаем блог
        $blog = $inBlog->getBlog($blog_id);
        if (!$blog) {
            cmsCore::error404();
        }
        // Права доступа
        $myblog = $inUser->id && $inUser->id == $blog['user_id'];
        // автор блога
        $is_writer = $inBlog->isUserBlogWriter($blog, $inUser->id);
        // может ли пользователь писать в блог
        // Заполняем head страницы
        $inPage->setTitle($blog['title']);
        //$inPage->addPathway($blog['title'], $model->getBlogURL($blog['seolink']));
        $inPage->setDescription($blog['title']);
        // rss в адресной строке
        $inPage->addHead('<link rel="alternate" type="application/rss+xml" title="' . htmlspecialchars(strip_tags($blog['title'])) . '" href="' . HOST . '/rss/blogs/' . $blog['id'] . '/feed.rss">');
        if ($myblog || $inUser->is_admin) {
            $inPage->addHeadJS('components/blog/js/blog.js');
        }
        //Если доступа нет, возвращаемся и выводим сообщение об ошибке
        if (!cmsUser::checkUserContentAccess($blog['allow_who'], $blog['user_id'])) {
            cmsCore::addSessionMessage($_LANG['CLOSED_BLOG'] . '<br>' . $_LANG['CLOSED_BLOG_TEXT'], 'error');
开发者ID:4uva4ek,项目名称:svato,代码行数:67,代码来源:frontend.php


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