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


PHP cmsActions::log方法代码示例

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


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

示例1: blog

function blog()
{
    $inCore = cmsCore::getInstance();
    $inPage = cmsPage::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();
    cmsCore::loadClass('blog');
    $inBlog = cmsBlogs::getInstance();
    $inBlog->owner = 'site';
    global $_LANG;
    cmsCore::loadModel('blog');
    $model = new cms_model_blog();
    define('IS_BILLING', $inCore->isComponentInstalled('billing'));
    if (IS_BILLING) {
        cmsCore::loadClass('billing');
    }
    // Проверяем включени ли компонент
    if (!$model->config['component_enabled']) {
        cmsCore::error404();
    }
    //Получаем параметры
    $id = cmsCore::request('id', 'int', 0);
    $post_id = cmsCore::request('post_id', 'int', 0);
    $seolink = cmsCore::request('seolink', 'str', '');
    $do = cmsCore::request('do', 'str', 'blog');
    $page = cmsCore::request('page', 'int', 1);
    $cat_id = cmsCore::request('cat_id', 'int', 0);
    $ownertype = cmsCore::request('ownertype', 'str', '');
    $on_moderate = cmsCore::request('on_moderate', 'int', 0);
    $pagetitle = $inCore->menuTitle();
    $pagetitle = $pagetitle && $inCore->isMenuIdStrict() ? $pagetitle : $_LANG['RSS_BLOGS'];
    $inPage->addPathway($pagetitle, '/blog');
    $inPage->setTitle($pagetitle);
    $inPage->setDescription($pagetitle);
    $blog_id = 25;
    ////////// НАСТРОЙКИ БЛОГА ////////////////////////////////////////////////////////////////////////////////////////
    if ($do == 'config') {
        if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
            cmsCore::halt();
        }
        if (!$inUser->id) {
            cmsCore::halt();
        }
        // получаем блог
        $blog = $inBlog->getBlog($id);
        if (!$blog) {
            cmsCore::error404();
        }
        //Проверяем является пользователь хозяином блога или админом
        if ($blog['user_id'] != $inUser->id && !$inUser->is_admin) {
            cmsCore::halt();
        }
        //Если нет запроса на сохранение, показываем форму настроек блога
        if (!cmsCore::inRequest('goadd')) {
            //Получаем список авторов блога
            $authors = $inBlog->getBlogAuthors($blog['id']);
            $smarty = $inCore->initSmarty('components', 'com_blog_config.tpl');
            $smarty->assign('blog', $blog);
            $smarty->assign('form_action', '/blog/' . $blog['id'] . '/editblog.html');
            $smarty->assign('authors_list', cmsUser::getAuthorsList($authors));
            $smarty->assign('users_list', cmsUser::getUsersList(false, $authors));
            $smarty->assign('is_restrictions', !$inUser->is_admin && $model->config['min_karma']);
            $smarty->assign('cfg', $model->config);
            $smarty->display('com_blog_config.tpl');
            cmsCore::jsonOutput(array('error' => false, 'html' => ob_get_clean()));
        }
        //Если пришел запрос на сохранение
        if (cmsCore::inRequest('goadd')) {
            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']) {
//.........这里部分代码省略.........
开发者ID:4uva4ek,项目名称:svato,代码行数:101,代码来源:frontend.php

示例2: giveAward

 /**
  * Выдает награду
  * @param array $award
  * @param int $user_id
  * @return int $award_id
  */
 public static function giveAward($award, $user_id)
 {
     if (!$award || !$user_id) {
         return false;
     }
     global $_LANG;
     $inDB = cmsDatabase::getInstance();
     $user = self::getShortUserData($user_id);
     if (!$user) {
         return false;
     }
     if (!file_exists(PATH . '/images/users/awards/' . $award['imageurl'])) {
         return false;
     }
     $award = $inDB->escape_string($award);
     $sql = "INSERT INTO cms_user_awards (user_id, pubdate, title, description, imageurl, from_id, award_id)\n\t\t\t\tVALUES ('{$user_id}', NOW(), '{$award['title']}', '{$award['description']}', '{$award['imageurl']}', '{$award['from_id']}', '{$award['id']}')";
     $inDB->query($sql);
     $award_id = $inDB->get_last_id('cms_user_awards');
     if (!$award_id) {
         return false;
     }
     cmsActions::log('add_award', array('object' => '"' . $award['title'] . '"', 'user_id' => $user_id, 'object_url' => '', 'object_id' => $award['id'], 'target' => '', 'target_url' => '', 'target_id' => 0, 'description' => '<img src="/images/users/awards/' . $award['imageurl'] . '" border="0" alt="' . htmlspecialchars($award['description']) . '">'));
     self::sendMessage(USER_UPDATER, $user_id, '<b>' . $_LANG['RECEIVED_AWARD'] . ':</b> <a href="' . cmsUser::getProfileURL($user['login']) . '#upr_awards">' . $award['title'] . '</a>');
     return cmsCore::callEvent('GIVE_AWARD', $award_id);
 }
开发者ID:vicktorwork,项目名称:cms1,代码行数:31,代码来源:user.class.php

示例3: calendar

function calendar()
{
    $inCore = cmsCore::getInstance();
    $inPage = cmsPage::getInstance();
    $inUser = cmsUser::getInstance();
    $inCore->loadModel('calendar');
    $model = new cms_model_calendar();
    $do = $inCore->request('do', 'str', 'view');
    $cfg = $inCore->loadComponentConfig('calendar');
    if ($do == 'view') {
        $inPage->setTitle("Календарь событий");
        $smarty = $inCore->initSmarty('components', 'com_calendar_view.tpl');
        $guest = TRUE;
        if ($inUser->id == 0 and $cfg['calendar_access'] == "all") {
            $guest = FALSE;
        }
        if ($inUser->id != 0 and $cfg['calendar_access'] == "users") {
            $guest = FALSE;
        }
        if ($inUser->is_admin) {
            $guest = FALSE;
        }
        $catigories = $model->getAllCategories();
        $smarty->assign('guest', $guest);
        $smarty->assign('cfg', $cfg);
        $smarty->assign('catigories', $catigories);
        $smarty->assign('category', "all");
        $smarty->display('com_calendar_view.tpl');
        return;
    }
    if ($do == "category_view") {
        $category_id = $inCore->request('category_id', 'int', 0);
        $smarty = $inCore->initSmarty('components', 'com_calendar_view.tpl');
        $guest = TRUE;
        if ($inUser->id == 0 and $cfg['calendar_access'] == "all") {
            $guest = FALSE;
        }
        if ($inUser->id != 0 and $cfg['calendar_access'] == "users") {
            $guest = FALSE;
        }
        if ($inUser->is_admin) {
            $guest = FALSE;
        }
        $category = $model->getCategory($category_id);
        $catigories = $model->getAllCategories();
        if (!$category) {
            //$inCore->redirect("/calendar");
            print mysql_error();
        }
        $inPage->setTitle("Календарь событий:" . $category['title']);
        $smarty->assign('guest', $guest);
        $smarty->assign('cfg', $cfg);
        $smarty->assign('catigories', $catigories);
        $smarty->assign('category', $category_id);
        $smarty->display('com_calendar_view.tpl');
        return;
    }
    if ($do == 'add') {
        $guest = TRUE;
        if ($inUser->id == 0 and $cfg['calendar_access'] == "all") {
            $guest = FALSE;
        }
        if ($inUser->id != 0 and $cfg['calendar_access'] == "users") {
            $guest = FALSE;
        }
        if ($inUser->is_admin) {
            $guest = FALSE;
        }
        if ($guest) {
            $inCore->redirect('/');
            exit;
        }
        $is_send = $inCore->inRequest('title');
        if ($is_send) {
            $title = $inCore->request('title', 'str');
            $type_raw = $inCore->request('type', 'str');
            $date_start = $inCore->request('date_start', 'str');
            $date_end = $inCore->request('date_end', 'str');
            $hour_start = $inCore->request('hour_start', 'str');
            $hour_end = $inCore->request('hour_end', 'str');
            $min_start = $inCore->request('min_start', 'str');
            $min_end = $inCore->request('min_end', 'str');
            $content = $inCore->request('content', 'str');
            if (!$title || !$type_raw || !$date_start || !$hour_start || !$hour_end || !$min_start || !$min_end) {
                cmsCore::addSessionMessage('Ой, что то не было заполнено...', 'error');
                $inCore->redirectBack();
                exit;
            } else {
                $start_time = strtotime($date_start . ' ' . $hour_start . ':' . $min_start);
                $end_time = strtotime($date_end . ' ' . $hour_end . ':' . $min_end);
                if ($data_end == "" or $date_end < $date_start) {
                    $data_end = $data_start;
                }
                $type_data = explode("_", $type_raw);
                $type = $type_data[0];
                $apx = $type_data[1];
                $event_id = $model->addEvent($inUser->id, $type, $apx, $start_time, $end_time, $title, $content);
                if ($event_id) {
                    if ($type != "private") {
                        cmsActions::log('add_event', array('object' => 'событие', 'object_url' => '/calendar/event' . $event_id . '.html', 'object_id' => $event_id, 'target' => $title, 'target_url' => '/calendar/event' . $event_id . '.html', 'target_id' => '0', 'description' => $title));
//.........这里部分代码省略.........
开发者ID:ratmir-by,项目名称:icms-calendar,代码行数:101,代码来源:frontend.php

示例4: users

function users()
{
    header('X-Frame-Options: DENY');
    $inCore = cmsCore::getInstance();
    $inPage = cmsPage::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();
    global $_LANG;
    $model = new cms_model_users();
    // id пользователя
    $id = cmsCore::request('id', 'int', 0);
    // логин пользователя
    $login = cmsCore::strClear(urldecode(cmsCore::request('login', 'html', '')));
    $do = $inCore->do;
    $page = cmsCore::request('page', 'int', 1);
    $pagetitle = $inCore->getComponentTitle();
    if ($model->config['sw_search'] != 2) {
        $inPage->addPathway($pagetitle, '/users');
    }
    $inPage->setTitle($pagetitle);
    $inPage->setDescription($pagetitle);
    // js только авторизованным
    if ($inUser->id) {
        $inPage->addHeadJS('components/users/js/profile.js');
        $inPage->addHeadJsLang(array('CONFIRM_CLEAN_CAT', 'CHOOSE_RECIPIENT', 'SEND_TO_USER', 'FRIENDSHIP_OFFER', 'STOP_FRIENDLY', 'REALY_STOP_FRIENDLY', 'ENTER_STATUS', 'HAVE_JUST'));
    }
    //============================================================================//
    //========================= Список пользователей  ============================//
    //============================================================================//
    if ($do == 'view') {
        // если запрещен просмотр всех пользователей, 404
        if ($model->config['sw_search'] == 2) {
            cmsCore::error404();
        }
        //очищаем поисковые запросы если пришли со другой страницы
        if (!strstr(cmsCore::getBackURL(), '/users')) {
            cmsUser::sessionClearAll();
        }
        $stext = array();
        // Возможные входные переменные
        $name = cmsCore::getSearchVar('name');
        $city = cmsCore::getSearchVar('city');
        $hobby = cmsCore::getSearchVar('hobby');
        $gender = cmsCore::getSearchVar('gender');
        $orderby = cmsCore::request('orderby', array('karma', 'rating', 'regdate'), 'regdate');
        $orderto = cmsCore::request('orderto', array('asc', 'desc'), 'desc');
        $age_to = (int) cmsCore::getSearchVar('ageto', 'all');
        $age_fr = (int) cmsCore::getSearchVar('agefrom', 'all');
        $group_id = cmsCore::request('group_id', 'int', 0);
        // Флаг о показе только онлайн пользователей
        if (cmsCore::inRequest('online')) {
            cmsUser::sessionPut('usr_online', (bool) cmsCore::request('online', 'int'));
            $page = 1;
        }
        $only_online = cmsUser::sessionGet('usr_online');
        if ($only_online) {
            $stext[] = $_LANG['SHOWING_ONLY_ONLINE'];
        }
        ///////////////////////////////////////
        //////////Условия выборки//////////////
        ///////////////////////////////////////
        // группа
        if ($group_id) {
            $model->whereUserGroupIs($group_id);
            $link['group'] = '/users/group/' . $group_id;
            $_LANG['GROUP_SEARCH_NAME'] = cmsUser::getGroupTitle($group_id);
        }
        // Добавляем в выборку имя, если оно есть
        if ($name) {
            $model->whereNameIs($name);
            $stext[] = $_LANG['NAME'] . " &mdash; " . htmlspecialchars(stripslashes($name));
        }
        // Добавляем в выборку город, если он есть
        if ($city) {
            $model->whereCityIs($city);
            $stext[] = $_LANG['CITY'] . " &mdash; " . htmlspecialchars(stripslashes($city));
        }
        // Добавляем в выборку хобби, если есть
        if ($hobby) {
            $model->whereHobbyIs($hobby);
            $stext[] = $_LANG['HOBBY'] . " &mdash; " . htmlspecialchars(stripslashes($hobby));
        }
        // Добавляем в выборку пол, если есть
        if ($gender) {
            $model->whereGenderIs($gender);
            if ($gender == 'm') {
                $stext[] = $_LANG['MALE'];
            } else {
                $stext[] = $_LANG['FEMALE'];
            }
        }
        // Добавляем в выборку возраст, более
        if ($age_fr) {
            $model->whereAgeFrom($age_fr);
            $stext[] = $_LANG['NOT_YOUNG'] . " {$age_fr} " . $_LANG['YEARS'];
        }
        // Добавляем в выборку возраст, менее
        if ($age_to) {
            $model->whereAgeTo($age_to);
            $stext[] = $_LANG['NOT_OLD'] . " {$age_fr} " . $_LANG['YEARS'];
//.........这里部分代码省略.........
开发者ID:deltas1,项目名称:icms1,代码行数:101,代码来源:frontend.php

示例5: clubs


//.........这里部分代码省略.........
    $is_moder  = $model->checkUserRightsInClub('moderator');
    $is_member = $model->checkUserRightsInClub('member');

	// Приватный или публичный клуб
    $is_access = true;
    if ($club['clubtype']=='private' && (!$is_admin && !$is_moder && !$is_member)){
        $is_access = false;
    }

	// Общее количество участников
    $club['members'] = $model->club_total_members;
	// Общее количество участников
    $club['moderators'] = $model->club_total_moderators;

	// Массив членов клуба
	if($club['members']){
		$inDB->limit($model->config['club_perpage']);
		$club['members_list'] = $model->getClubMembers($club['id'], 'member');
	} else { $club['members_list'] =  array(); }

	// Массив модераторов клуба
	if($club['moderators']){
		$club['moderators_list'] = $model->getClubMembers($club['id'], 'moderator');
	}

	// Стена клуба
	// количество записей на стене берем из настроек
	$inDB->limitPage(1, $model->config['wall_perpage']);
    $club['wall_html'] = cmsUser::getUserWall($club['id'], 'clubs', ($is_moder || $is_admin), ($is_moder || $is_admin));

	/////////////////////////////////////////////
	//////////// ПОСТЫ БЛОГА КЛУБА //////////////
	/////////////////////////////////////////////
	if ($club['enabled_blogs']){

		$inBlog = $model->initBlog();

		$inBlog->whereBlogUserIs($club['id']);

		$club['total_posts'] = $inBlog->getPostsCount($is_admin || $is_moder);

		$inDB->addSelect('b.user_id as bloglink');

		$inDB->orderBy('p.pubdate', 'DESC');

		$inDB->limit($model->config['club_posts_perpage']);

		$club['blog_posts'] = $inBlog->getPosts(($is_admin || $is_moder), $model, true);

	}

	/////////////////////////////////////////////
	//////////// ФОТОАЛЬБОМЫ КЛУБА //////////////
	/////////////////////////////////////////////
	if ($club['enabled_photos']){

		// Общее количество альбомов
		$club['all_albums'] = $inDB->rows_count('cms_photo_albums', "NSDiffer = 'club{$club['id']}' AND user_id = '{$club['id']}' AND parent_id > 0");

		// получаем альбомы
		if($club['all_albums']){
			$inDB->limit($model->config['club_album_perpage']);
			$inDB->orderBy('f.pubdate', 'DESC');
			$club['photo_albums'] = $inPhoto->getAlbums(0, 'club'.$club['id']);
		} else {
			$club['photo_albums'] = array();
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:67,代码来源:frontend.php

示例6: registration

function registration()
{
    header('X-Frame-Options: DENY');
    $inCore = cmsCore::getInstance();
    $inPage = cmsPage::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();
    $inConf = cmsConfig::getInstance();
    $model = new cms_model_registration();
    cmsCore::loadModel('users');
    $users_model = new cms_model_users();
    global $_LANG;
    $do = $inCore->do;
    //============================================================================//
    if ($do == 'sendremind') {
        if ($inUser->id) {
            cmsCore::error404();
        }
        $inPage->setTitle($_LANG['REMINDER_PASS']);
        $inPage->addPathway($_LANG['REMINDER_PASS']);
        if (!cmsCore::inRequest('goremind')) {
            cmsPage::initTemplate('components', 'com_registration_sendremind')->display('com_registration_sendremind.tpl');
        } else {
            if (!cmsUser::checkCsrfToken()) {
                cmsCore::error404();
            }
            $email = cmsCore::request('email', 'email', '');
            if (!$email) {
                cmsCore::addSessionMessage($_LANG['ERR_EMAIL'], 'error');
                cmsCore::redirectBack();
            }
            $usr = cmsUser::getShortUserData($email);
            if (!$usr || $usr['is_locked'] || $usr['is_deleted']) {
                cmsCore::addSessionMessage($_LANG['ADRESS'] . ' "' . $email . '" ' . $_LANG['NOT_IN_OUR_BASE'], 'error');
                cmsCore::redirectBack();
            }
            if (cmsUser::userIsAdmin($usr['id'])) {
                cmsCore::addSessionMessage($_LANG['NOT_ADMIN_SENDREMIND'], 'error');
                cmsCore::redirectBack();
            }
            $usercode = md5($usr['id'] . '-' . uniqid() . '-' . microtime() . '-' . PATH);
            $sql = "INSERT cms_users_activate (pubdate, user_id, code)\n                VALUES (NOW(), '{$usr['id']}', '{$usercode}')";
            $inDB->query($sql);
            $newpass_link = HOST . '/registration/remind/' . $usercode;
            $mail_message = $_LANG['HELLO'] . ', ' . $usr['nickname'] . '!' . "\n\n";
            $mail_message .= $_LANG['REMINDER_TEXT'] . ' "' . $inConf->sitename . '".' . "\n\n";
            $mail_message .= $_LANG['YOUR_LOGIN'] . ': ' . $usr['login'] . "\n\n";
            $mail_message .= $_LANG['NEW_PASS_LINK'] . ":\n" . $newpass_link . "\n\n";
            $mail_message .= $_LANG['LINK_EXPIRES'] . "\n\n";
            $mail_message .= $_LANG['SIGNATURE'] . ', ' . $inConf->sitename . ' (' . HOST . ').' . "\n";
            $mail_message .= date('d-m-Y (H:i)');
            $inCore->mailText($email, $inConf->sitename . ' - ' . $_LANG['REMINDER_PASS'], $mail_message);
            cmsCore::addSessionMessage($_LANG['NEW_PAS_SENDED'], 'info');
            cmsCore::redirect('/login');
        }
    }
    //============================================================================//
    if ($do == 'remind') {
        if ($inUser->id) {
            cmsCore::error404();
        }
        $usercode = cmsCore::request('code', 'str', '');
        //проверяем формат кода
        if (!preg_match('/^[0-9a-f]{32}$/i', $usercode)) {
            cmsCore::error404();
        }
        // проверяем код
        $user_id = $inDB->get_field('cms_users_activate', "code = '{$usercode}'", 'user_id');
        if (!$user_id) {
            cmsCore::error404();
        }
        //получаем пользователя
        $user = $inDB->get_fields('cms_users', "id = '{$user_id}'", '*');
        if (!$user) {
            cmsCore::error404();
        }
        if (cmsUser::userIsAdmin($user['id'])) {
            cmsCore::error404();
        }
        if (cmsCore::inRequest('submit')) {
            if (!cmsUser::checkCsrfToken()) {
                cmsCore::error404();
            }
            $errors = false;
            $pass = cmsCore::request('pass', 'str', '');
            $pass2 = cmsCore::request('pass2', 'str', '');
            if (!$pass) {
                cmsCore::addSessionMessage($_LANG['TYPE_PASS'], 'error');
                $errors = true;
            }
            if ($pass && !$pass2) {
                cmsCore::addSessionMessage($_LANG['TYPE_PASS_TWICE'], 'error');
                $errors = true;
            }
            if ($pass && $pass2 && mb_strlen($pass) < 6) {
                cmsCore::addSessionMessage($_LANG['PASS_SHORT'], 'error');
                $errors = true;
            }
            if ($pass && $pass2 && $pass != $pass2) {
                cmsCore::addSessionMessage($_LANG['WRONG_PASS'], 'error');
//.........这里部分代码省略.........
开发者ID:vicktorwork,项目名称:cms1,代码行数:101,代码来源:frontend.php

示例7: createUser

 private function createUser($profile)
 {
     $inCore = cmsCore::getInstance();
     $inDB = cmsDatabase::getInstance();
     $inUser = cmsUser::getInstance();
     cmsCore::loadClass('actions');
     $nickname = $email = $birthdate = '';
     $advanced = array();
     // для вконтакте поолучаем большой аватар, статус и город
     if (strstr($profile->identity, '//vk.com')) {
         $vk = $this->callVk($profile->uid);
         if ($vk) {
             $advanced = array('city' => $vk->city->title, 'status' => $vk->status, 'photo' => $vk->photo_max_orig);
         }
     }
     if (!empty($profile->name->full_name)) {
         // указано полное имя
         $nickname = $profile->name->full_name;
     } elseif (!empty($profile->name->first_name)) {
         // указано имя и фамилия по-отдельности
         $nickname = $profile->name->first_name;
         if (!empty($profile->name->last_name)) {
             $nickname .= ' ' . $profile->name->last_name;
         }
     } elseif (preg_match('/^(http:\\/\\/)([a-zA-Z0-9\\-_]+)\\.([a-zA-Z0-9\\-_]+)\\.([a-zA-Z]{2,6})([\\/]?)$/i', $profile->identity)) {
         // не указано имя, но передан идентификатор в виде домена
         $nickname = parse_url($profile->identity, PHP_URL_HOST);
     }
     $nickname = cmsCore::strClear($nickname);
     $login = substr(str_replace('-', '', cmsCore::strToURL($nickname)), 0, 15);
     if (!$nickname || !$login) {
         // не указано вообще ничего
         $max = $inDB->get_fields('cms_users', 'id>0', 'id', 'id DESC');
         $nickname = $login = 'user' . ($max['id'] + 1);
     }
     // генерируем пароль
     $pass = md5(substr(md5(microtime() . uniqid()), 0, 8));
     if (!empty($profile->email)) {
         $email = cmsCore::strClear($profile->email);
         $already_email = $inDB->get_field('cms_users', "email='{$email}' AND is_deleted=0", 'email');
         if ($already_email == $email) {
             cmsCore::redirect('/auth/error.html');
         }
     }
     if (!empty($profile->dob)) {
         $birthdate = cmsCore::strClear($profile->dob);
     }
     // проверяем занятость логина
     if ($inDB->get_field('cms_users', "login='{$login}' AND is_deleted=0", 'login') == $login) {
         // если логин занят, добавляем к нему ID
         $max = $inDB->get_fields('cms_users', 'id>0', 'id', 'id DESC');
         $login .= $max['id'] + 1;
     }
     $user_array = cmsCore::callEvent('USER_BEFORE_REGISTER', array('status' => !empty($advanced['status']) ? $advanced['status'] : '', 'status_date' => date('Y-m-d H:i:s'), 'login' => $login, 'nickname' => $nickname, 'password' => $pass, 'email' => $email, 'birthdate' => $birthdate, 'group_id' => $this->reg_model->config['default_gid'], 'regdate' => date('Y-m-d H:i:s'), 'logdate' => date('Y-m-d H:i:s'), 'invited_by' => 0, 'openid' => md5($profile->identity)));
     $user_array['id'] = $user_id = $inDB->insert('cms_users', $user_array);
     // создаем профиль пользователя
     if ($user_id) {
         $filename = 'nopic.jpg';
         // если есть аватар, пробуем скачать
         if (!empty($profile->photo) || !empty($advanced['photo'])) {
             $photo_path = $this->downloadAvatar(!empty($advanced['photo']) ? $advanced['photo'] : $profile->photo);
             if ($photo_path) {
                 cmsCore::includeGraphics();
                 $uploaddir = PATH . '/images/users/avatars/';
                 $filename = md5($photo_path . '-' . $user_id . '-' . time()) . '.jpg';
                 $uploadavatar = $uploaddir . $filename;
                 $uploadthumb = $uploaddir . 'small/' . $filename;
                 $cfg = $inCore->loadComponentConfig('users');
                 @img_resize($photo_path, $uploadavatar, $cfg['medw'], $cfg['medh']);
                 @img_resize($photo_path, $uploadthumb, $cfg['smallw'], $cfg['smallw']);
                 @unlink($photo_path);
             }
         }
         $inUser->loadUserGeo();
         $inDB->insert('cms_user_profiles', array('city' => !empty($advanced['city']) ? $advanced['city'] : $inUser->city, 'user_id' => $user_id, 'imageurl' => $filename, 'gender' => !empty($profile->gender) ? strtolower($profile->gender) : 'm'));
         cmsCore::callEvent('USER_REGISTER', $user_array);
         cmsActions::log('add_user', array('object' => '', 'user_id' => $user_id, 'object_url' => '', 'object_id' => $user_id, 'target' => '', 'target_url' => '', 'target_id' => 0, 'description' => ''));
         if ($this->reg_model->config['send_greetmsg']) {
             $this->reg_model->sendGreetsMessage($user_id);
         }
         return $user_id;
     }
     return false;
 }
开发者ID:4uva4ek,项目名称:svato,代码行数:84,代码来源:plugin.php

示例8: content


//.........这里部分代码省略.........
        if ($do == 'editarticle') {
            // Получаем статью
            $item = $model->getArticle($id);
            if (!$item) {
                cmsCore::error404();
            }
            $pubcats = array();
            // доступ к редактированию админам, авторам и редакторам
            if (!$inUser->is_admin && $item['user_id'] != $inUser->id && !($item['modgrp_id'] == $inUser->group_id && cmsUser::isUserCan('content/autoadd'))) {
                cmsCore::error404();
            }
        }
        // Для добавления проверяем не вводили ли мы данные ранее
        if ($do == 'addarticle') {
            $item = cmsUser::sessionGet('article');
            if ($item) {
                cmsUser::sessionDel('article');
            }
            // Категории, в которые разрешено публиковать
            $pubcats = $model->getPublicCats();
            if (!$pubcats) {
                cmsCore::addSessionMessage($_LANG['ADD_ARTICLE_ERR_CAT'], 'error');
                cmsCore::redirectBack();
            }
        }
        // не было запроса на сохранение, показываем форму
        if (!cmsCore::inRequest('add_mod')) {
            $dynamic_cost = false;
            // Если добавляем статью
            if ($do == 'addarticle') {
                $pagetitle = $_LANG['ADD_ARTICLE'];
                $inPage->setTitle($pagetitle);
                $inPage->addPathway($_LANG['USERS'], '/' . str_replace('/', '', cmsUser::PROFILE_LINK_PREFIX));
                $inPage->addPathway($inUser->nickname, cmsUser::getProfileURL($inUser->login));
                $inPage->addPathway($_LANG['MY_ARTICLES'], '/content/my.html');
                $inPage->addPathway($pagetitle);
                // поддержка биллинга
                if (IS_BILLING) {
                    $action = cmsBilling::getAction('content', 'add_content');
                    foreach ($pubcats as $p => $pubcat) {
                        if ($pubcat['cost']) {
                            $dynamic_cost = true;
                        } else {
                            $pubcats[$p]['cost'] = $action['point_cost'][$inUser->group_id];
                        }
                    }
                    cmsBilling::checkBalance('content', 'add_content', $dynamic_cost);
                }
            }
            // Если редактируем статью
            if ($do == 'editarticle') {
                $pagetitle = $_LANG['EDIT_ARTICLE'];
                $inPage->setTitle($pagetitle);
                $inPage->addPathway($_LANG['USERS'], '/' . str_replace('/', '', cmsUser::PROFILE_LINK_PREFIX));
                if ($item['user_id'] != $inUser->id) {
                    $user = $inDB->get_fields('cms_users', "id='{$item['user_id']}'", 'login, nickname');
                    $inPage->addPathway($user['nickname'], cmsUser::getProfileURL($user['login']));
                } else {
                    $inPage->addPathway($inUser->nickname, cmsUser::getProfileURL($inUser->login));
                }
                $inPage->addPathway($_LANG['MY_ARTICLES'], '/content/my.html');
                $inPage->addPathway($pagetitle);
                $item['tags'] = cmsTagLine('content', $item['id'], false);
                $item['image'] = file_exists(PATH . '/images/photos/small/article' . $item['id'] . '.jpg') ? 'article' . $item['id'] . '.jpg' : '';
                if (!$is_auto_add) {
                    cmsCore::addSessionMessage($_LANG['ATTENTION'] . ': ' . $_LANG['EDIT_ARTICLE_PREMODER'], 'info');
开发者ID:deltas1,项目名称:icms1,代码行数:67,代码来源:frontend.php

示例9: forum


//.........这里部分代码省略.........
                    }
                }
                $post_id = $model->addPost(array('thread_id' => $thread['id'], 'user_id' => $inUser->id, 'pinned' => $post_pinned, 'content' => $message_bb, 'content_html' => $message_html, 'pubdate' => date("Y-m-d H:i:s"), 'editdate' => date("Y-m-d H:i:s")));
                // Обновляем количество постов в теме
                $thread_post_count = $model->updateThreadPostCount($thread['id']);
                // Закрываем тему если нужно
                $is_fixed = cmsCore::request('fixed', 'int', 0);
                if ($is_fixed && ($is_forum_moder || $inUser->is_admin || $thread['is_mythread'])) {
                    $model->closeThread($thread['id']);
                }
                // Загружаем аттачи
                if ($model->config['fa_on'] && cmsCore::checkContentAccess($model->config['group_access'])) {
                    $file_error = $model->addUpdatePostAttachments($post_id);
                    if ($file_error === false) {
                        cmsCore::addSessionMessage($_LANG['CHECK_SIZE_TYPE_FILE'] . $model->config['fa_max'], 'error');
                    }
                }
                // Обновляем кеши
                $model->updateForumCache($thread['NSLeft'], $thread['NSRight'], true);
                $total_pages = ceil($thread_post_count / $model->config['pp_thread']);
                // Проверяем награды
                cmsUser::checkAwards($inUser->id);
                // Рассылаем уведомления тем, кто подписан
                if ($do == 'newpost') {
                    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);
开发者ID:deltas1,项目名称:icms1,代码行数:67,代码来源:frontend.php

示例10: addWall

 public function addWall($item)
 {
     $club = $this->getClub($item['user_id']);
     if (!$club) {
         return false;
     }
     // добавляем запись
     $wall_id = $this->inDB->insert('cms_user_wall', cmsCore::callEvent('ADD_WALL', $item));
     if ($club['clubtype'] == 'private') {
         return $wall_id;
     }
     $message = strip_tags($item['content']);
     $message = mb_strlen($message) > 100 ? mb_substr($message, 0, 100) : $message;
     //регистрируем событие
     cmsActions::log('add_wall_club', array('object' => $club['title'], 'object_url' => '/clubs/' . $club['id'], 'object_id' => $wall_id, 'target' => '', 'target_url' => '', 'target_id' => 0, 'description' => $message));
     return $wall_id;
 }
开发者ID:4uva4ek,项目名称:svato,代码行数:17,代码来源:model.php

示例11: createForum

 private function createForum($article)
 {
     $forum_id = (int) $this->config['AF_ADDTREADFORUM_ID'];
     if (!$forum_id) {
         return false;
     }
     if (!$this->checkCatForAdd($article['category_id'])) {
         return false;
     }
     // если для статьи есть уже тема, выходим
     $forum_thread_id = $this->inDB->get_field('cms_forum_threads', "rel_to='content' AND rel_id='{$article['id']}'", 'id');
     if ($forum_thread_id) {
         return false;
     }
     cmsCore::loadModel('forum');
     $model_forum = new cms_model_forum();
     $post_html = $this->getHtmlPost($article);
     $post = $this->getBbtexPost($article);
     $threadlastid = $model_forum->addThread(array('forum_id' => $forum_id, 'user_id' => $article['user_id'], 'title' => $this->inDB->escape_string($article['title']), 'description' => '', 'is_hidden' => '0', 'rel_to' => 'content', 'hits' => 0, 'pubdate' => date("Y-m-d H:i:s"), 'rel_id' => $article['id']));
     $model_forum->addPost(array('thread_id' => $threadlastid, 'user_id' => $article['user_id'], 'content' => $post, 'content_html' => $post_html, 'pubdate' => date("Y-m-d H:i:s"), 'editdate' => date("Y-m-d H:i:s")));
     $forum = $this->inDB->get_fields('cms_forums', "id='{$forum_id}'", '*');
     $model_forum->updateThreadPostCount($threadlastid);
     cmsUser::checkAwards($article['user_id']);
     $model_forum->updateForumCache($forum['NSLeft'], $forum['NSRight'], true);
     cmsActions::log('add_thread', array('object' => $article['title'], 'user_id' => $article['user_id'], 'object_url' => '/forum/thread' . $threadlastid . '.html', 'object_id' => $threadlastid, 'target' => $this->inDB->escape_string($forum['title']), 'target_url' => '/forum/' . $forum_id, 'target_id' => $forum_id, 'description' => strip_tags($post_html)));
     return true;
 }
开发者ID:4uva4ek,项目名称:svato,代码行数:27,代码来源:plugin.php

示例12: catalog

function catalog(){

    $inCore = cmsCore::getInstance();
    $inPage = cmsPage::getInstance();
    $inDB   = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();

    global $_LANG;

    $model = new cms_model_catalog();

    define('IS_BILLING', $inCore->isComponentInstalled('billing'));
    if (IS_BILLING) { cmsCore::loadClass('billing'); }

    $pagetitle = $inCore->getComponentTitle();

	$inPage->addPathway($pagetitle, '/catalog');
	$inPage->setTitle($pagetitle);

	$inPage->setDescription($model->config['meta_desc'] ? $model->config['meta_desc'] : $pagetitle);
    $inPage->setKeywords($model->config['meta_keys'] ? $model->config['meta_keys'] : $pagetitle);

    $cfg = $inCore->loadComponentConfig('catalog');

    if (cmsCore::inRequest('cat_id')){
        $id = cmsCore::request('cat_id', 'int', 0);
    } else {
        $id = cmsCore::request('id', 'int', 0);
    }

    $do = $inCore->do;

    cmsCore::includeFile('components/catalog/includes/shopcore.php');

    //////////////////////////// RATING SUBMISSION ///////////////////////////////////////////////////////////////////
    if (cmsCore::inRequest('rating')){
        $points     = cmsCore::request('points', 'int', 0);
        $item_id    = cmsCore::request('item_id', 'int', 0);
        $ip         = $inUser->ip;
        if (!alreadyVoted($item_id)){
            $inDB->query("INSERT INTO cms_uc_ratings (item_id, points, ip) VALUES ($item_id, $points, '$ip')") ;
            $inDB->query("DELETE FROM cms_uc_ratings WHERE item_id = $item_id AND ip = '0.0.0.0'") ;
        }
    }

    //////////////////////////// SEARCH BY TAG ///////////////////////////////////////////////////////////////////////
    if ($do == 'tag') {

		$tag = $inCore->strClear(urldecode($inCore->request('tag', 'html', '')));

        $sql = "SELECT tag FROM cms_tags WHERE tag = '$tag' AND target='catalog' LIMIT 1";
        $result = $inDB->query($sql) ;
        if ($inDB->num_rows($result)==1){
            $item = $inDB->fetch_assoc($result);
            $query = $inCore->strClear($item['tag']);
            $findsql = "SELECT *
                        FROM cms_uc_items
                        WHERE category_id = '$id' AND published = 1 AND tags LIKE '%$query%'";
            $do = 'cat';
        } else { echo $_LANG['NO_MATCHING_FOUND']; }

    }
    //////////////////////////// ADVANCED SEARCH ////////////////////////////////////////////////////////////////////
    if ($do == 'search') {

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

            $fdata = cmsCore::request('fdata', 'array', array());
            $query = cmsCore::strClear(implode('%', $fdata));
            $title = cmsCore::request('title', 'str', '');
            $tags  = cmsCore::request('tags', 'str', '');

            if ($query || $title || $tags){

                $findsql = "SELECT i.* , IFNULL(AVG(r.points),0) AS rating
                            FROM cms_uc_items i
                            LEFT JOIN cms_uc_ratings r ON r.item_id = i.id
                            WHERE i.published = 1 AND i.category_id = '$id' ";

                if($query){
                    $findsql .= " AND i.fieldsdata LIKE '%{$query}%' ";
                }
                if($title){
                    $findsql .= " AND i.title LIKE '%$title%' ";
                }
                if($tags){
                    $findsql .= "AND (i.tags LIKE '%".$tags."%')";
                }

                $findsql .=	" GROUP BY i.id";
                $advsearch = 1;
            }
            $do = 'cat';
        } else {
            //show search form
            $sql = "SELECT * FROM cms_uc_cats WHERE id = '$id'";
            $result = $inDB->query($sql) ;

            if ($inDB->num_rows($result)==1){
                $cat = $inDB->fetch_assoc($result);
//.........这里部分代码省略.........
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:101,代码来源:frontend.php

示例13: array

}
// Загружаем фото
$file = $model->initUploadClass()->uploadPhoto();
if ($file) {
    if (!cmsCore::inRequest('upload')) {
        $last_id = $inDB->get_field('cms_photo_files', 'published=1 ORDER BY id DESC', 'id');
    }
    $photo['album_id'] = $album['id'];
    $photo['file'] = $file['filename'];
    $photo['title'] = $photo['title'] ? $photo['title'] . $last_id : $file['realfile'];
    $photo['published'] = $is_admin || $is_moder ? 1 : (int) (!$club['photo_premod']);
    $photo['owner'] = 'club' . $club['id'];
    $photo['user_id'] = $inUser->id;
    $photo_id = $inPhoto->addPhoto($photo);
    if ($photo['published']) {
        $description = $club['clubtype'] == 'private' ? '' : '<a href="/clubs/photo' . $photo_id . '.html" class="act_photo"><img border="0" src="/images/photos/small/' . $photo['file'] . '" /></a>';
        cmsActions::log('add_photo_club', array('object' => $photo['title'], 'object_url' => '/clubs/photo' . $photo_id . '.html', 'object_id' => $photo_id, 'target' => $club['title'], 'target_id' => $photo['album_id'], 'target_url' => '/clubs/' . $club['id'], 'description' => $description));
    }
    if (!$photo['published']) {
        $message = sprintf($_LANG['MSG_CLUB_PHOTO_SUBMIT'], cmsUser::getProfileLink($inUser->login, $inUser->nickname), '<a href="/clubs/photo' . $photo_id . '.html">' . $photo['title'] . '</a>', '<a href="/clubs/' . $club['id'] . '">' . $club['title'] . '</a>');
        cmsUser::sendMessage(USER_UPDATER, $club['admin_id'], $message);
        cmsCore::addSessionMessage($_LANG['PHOTO_PREMODER_TEXT'], 'info');
    }
    if (cmsCore::inRequest('upload')) {
        cmsCore::redirect('/clubs/uploaded' . $album['id'] . '.html');
    }
    echo "FILEID:" . $photo_id;
} else {
    header("HTTP/1.1 500 Internal Server Error");
    echo $inCore->uploadError();
}
开发者ID:deltas1,项目名称:icms1,代码行数:31,代码来源:upload_photo.php

示例14: photos


//.........这里部分代码省略.........
            cmsCore::error404();
        }
        $path_list = $inDB->getNsCategoryPath('cms_photo_albums', $photo['NSLeft'], $photo['NSRight'], 'id, title, NSLevel');
        if ($path_list) {
            foreach ($path_list as $pcat) {
                $inPage->addPathway($pcat['title'], '/photos/' . $pcat['id']);
            }
        }
        $inPage->addPathway($photo['title']);
        $inPage->setTitle($photo['pagetitle'] ? $photo['pagetitle'] : $photo['title']);
        $inPage->setKeywords($photo['meta_keys'] ? $photo['meta_keys'] : $photo['title']);
        if (!$photo['meta_desc']) {
            if ($photo['description']) {
                $inPage->setDescription(crop($photo['description']));
            } else {
                $inPage->setDescription($photo['title']);
            }
        } else {
            $inPage->setDescription($photo['meta_desc']);
        }
        // Обновляем количество просмотров фотографии
        if (!$is_author) {
            $inDB->setFlag('cms_photo_files', $photo['id'], 'hits', $photo['hits'] + 1);
        }
        //навигация
        if ($photo['album_nav']) {
            $nextid = $inDB->get_fields('cms_photo_files', 'id<' . $photo['id'] . ' AND album_id = ' . $photo['album_id'] . ' AND published=1', 'id, file', 'id DESC');
            $previd = $inDB->get_fields('cms_photo_files', 'id>' . $photo['id'] . ' AND album_id = ' . $photo['album_id'] . ' AND published=1', 'id, file', 'id ASC');
        } else {
            $previd = false;
            $nextid = false;
        }
        $photo['karma_buttons'] = cmsKarmaButtons('photo', $photo['id'], $photo['rating'], $is_author);
        $photo['genderlink'] = cmsUser::getGenderLink($photo['user_id'], $photo['nickname'], $photo['gender'], $photo['login']);
        cmsPage::initTemplate('components', 'com_photos_view_photo')->assign('photo', $photo)->assign('bbcode', '[IMG]' . HOST . '/images/photos/medium/' . $photo['file'] . '[/IMG]')->assign('previd', $previd)->assign('nextid', $nextid)->assign('cfg', $model->config)->assign('is_author', $is_author)->assign('is_admin', $inUser->is_admin)->assign('tagbar', $photo['a_tags'] ? cmsTagBar('photo', $photo['id']) : '')->display('com_photos_view_photo.tpl');
        //выводим комментарии, если они разрешены и фото опубликовано
        if ($photo['comments'] && $inCore->isComponentInstalled('comments')) {
            cmsCore::includeComments();
            comments('photo', $photo['id'], array(), $is_author);
        }
    }
    /////////////////////////////// PHOTO UPLOAD  ////////////////////////////////////////////////////////////////////////////////
    if ($do == 'addphoto') {
        // Неавторизованных просим авторизоваться
        if (!$inUser->id) {
            cmsUser::goToLogin();
        }
        $do_photo = cmsCore::request('do_photo', 'str', 'addphoto');
        // получаем альбом
        $album = $inDB->getNsCategory('cms_photo_albums', $id);
        if (!$album) {
            cmsCore::error404();
        }
        if (!$album['published'] && !$inUser->is_admin) {
            cmsCore::error404();
        }
        $album = cmsCore::callEvent('GET_PHOTO_ALBUM', $album);
        // права доступа
        // загружаем только в разрешенные альбомы
        if (!$album['public'] && !$inUser->is_admin) {
            cmsCore::error404();
        }
        // Смотрим ограничения загрузки в сутки
        $today_uploaded = $album['uplimit'] ? $model->loadedByUser24h($inUser->id, $album['id']) : 0;
        if (!$inUser->is_admin && $album['uplimit'] && $today_uploaded >= $album['uplimit']) {
            cmsCore::addSessionMessage('<strong>' . $_LANG['MAX_UPLOAD_IN_DAY'] . '</strong> ' . $_LANG['CAN_UPLOAD_TOMORROW'], 'error');
开发者ID:deltas1,项目名称:icms1,代码行数:67,代码来源:frontend.php

示例15: addWall

   public function addWall($item) {

		// проверяем есть ли пользователь, которому добавляем на стену
		$usr = cmsUser::getShortUserData($item['user_id']);
		if (!$usr) { return false; }

		// добавляем запись
		$wall_id = $this->inDB->insert('cms_user_wall', cmsCore::callEvent('ADD_WALL', $item));

		$message = strip_tags($item['content']);
		$message = mb_strlen($message)>100 ? mb_substr($message, 0, 100) : $message;

		if ($item['user_id'] == $item['author_id']){

			cmsActions::log('add_wall_my', array(
					'object' => '',
					'object_url' => '',
					'object_id' => $wall_id,
					'target' => '',
					'target_url' => '',
					'target_id' => 0,
					'description' => $message
			));

		} else {

			cmsActions::log('add_wall', array(
					'object' => $usr['nickname'],
					'object_url' => cmsUser::getProfileURL($usr['login']),
					'object_id' => $wall_id,
					'target' => '',
					'target_url' => '',
					'target_id' => 0,
					'description' => $message
			));

		}

		$usr['email_newmsg'] = $this->inDB->get_field('cms_user_profiles', "user_id='{$item['user_id']}'", 'email_newmsg');

		if ($usr['email_newmsg'] && $item['user_id'] != $item['author_id']){

			global $_LANG;

			$letter = cmsCore::getLanguageTextFile('newwallpost');
			$letter = str_replace('{sitename}', cmsConfig::getConfig('sitename'), $letter);
			$letter = str_replace('{profilelink}', HOST . cmsUser::getProfileURL($usr['login']), $letter);
			$letter = str_replace('{date}', date('d/m/Y H:i:s'), $letter);
			$letter = str_replace('{from}', $item['nickname'], $letter);
			cmsCore::getInstance()->mailText($usr['email'], $_LANG['NEW_POST_ON_WALL'].'! - '.cmsConfig::getConfig('sitename'), $letter);

		}

        return $wall_id;

   }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:56,代码来源:model.php


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