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


PHP cmsUser::userIsAdmin方法代码示例

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


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

示例1: getUsersArray

function getUsersArray($result, $cfg, $inDB)
{
    $users = array();
    while ($usr = $inDB->fetch_assoc($result)) {
        if ($cfg['admin_editor']) {
            if (cmsUser::userIsAdmin($usr['id'])) {
                $usr['genderlink'] = cmsUser::getGenderLink($usr['id'], $usr['nickname'], $usr['gender'], $usr['login'], "color:{$cfg['color_admin']}");
            } elseif (cmsUser::userIsEditor($usr['id'])) {
                $usr['genderlink'] = cmsUser::getGenderLink($usr['id'], $usr['nickname'], $usr['gender'], $usr['login'], "color:{$cfg['color_editor']}");
            } else {
                $usr['genderlink'] = cmsUser::getGenderLink($usr['id'], $usr['nickname'], $usr['gender'], $usr['login']);
            }
        } else {
            $usr['genderlink'] = cmsUser::getGenderLink($usr['id'], $usr['nickname'], $usr['gender'], $usr['login']);
        }
        $users[] = $usr['genderlink'];
    }
    return $users;
}
开发者ID:4uva4ek,项目名称:svato,代码行数:19,代码来源:module.php

示例2: applet_userbanlist

function applet_userbanlist()
{
    $inCore = cmsCore::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();
    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/users', $adminAccess)) {
        cpAccessDenied();
    }
    $GLOBALS['cp_page_title'] = $_LANG['AD_BANLIST'];
    cpAddPathway($_LANG['AD_USERS'], 'index.php?view=users');
    cpAddPathway($_LANG['AD_BANLIST'], 'index.php?view=userbanlist');
    $do = cmsCore::request('do', 'str', 'list');
    $id = cmsCore::request('id', 'int', -1);
    $to = cmsCore::request('to', 'int', 0);
    // для редиректа обратно в профиль на сайт
    if ($to) {
        cmsUser::sessionPut('back_url', cmsCore::getBackURL());
    }
    if ($do == 'list') {
        $toolmenu[] = array('icon' => 'useradd.gif', 'title' => $_LANG['AD_TO_BANLIST_ADD'], 'link' => '?view=userbanlist&do=add');
        $toolmenu[] = array('icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link' => "javascript:checkSel('?view=userbanlist&do=edit&multiple=1');");
        $toolmenu[] = array('icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=userbanlist&do=delete&multiple=1');");
        cpToolMenu($toolmenu);
        $fields[] = array('title' => 'id', 'field' => 'id', 'width' => '30');
        $fields[] = array('title' => $_LANG['AD_IS_ACTIVE'], 'field' => 'status', 'width' => '55', 'prc' => 'cpYesNo');
        $fields[] = array('title' => $_LANG['AD_BANLIST_USER'], 'field' => 'user_id', 'width' => '120', 'filter' => '12', 'prc' => 'cpUserNick');
        $fields[] = array('title' => $_LANG['AD_BANLIST_IP'], 'field' => 'ip', 'width' => '100', 'link' => '?view=userbanlist&do=edit&id=%id%', 'filter' => '12');
        $fields[] = array('title' => $_LANG['DATE'], 'field' => 'bandate', 'width' => '', 'fdate' => '%d/%m/%Y %H:%i:%s', 'filter' => '12');
        $fields[] = array('title' => $_LANG['AD_BANLIST_TIME'], 'field' => 'int_num', 'width' => '55');
        $fields[] = array('title' => '', 'field' => 'int_period', 'width' => '70');
        $fields[] = array('title' => $_LANG['AD_AUTOREMOVE'], 'field' => 'autodelete', 'width' => '90', 'prc' => 'cpYesNo');
        $actions[] = array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=userbanlist&do=edit&id=%id%');
        $actions[] = array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_REMOVE_RULE'], 'link' => '?view=userbanlist&do=delete&id=%id%');
        cpListTable('cms_banlist', $fields, $actions, '1=1', 'ip DESC');
    }
    if ($do == 'delete') {
        if (!isset($_REQUEST['item'])) {
            if ($id >= 0) {
                dbDelete('cms_banlist', $id);
            }
        } else {
            dbDeleteList('cms_banlist', cmsCore::request('item', 'array_int', array()));
        }
        cmsCore::redirect('?view=userbanlist');
    }
    if ($do == 'submit' || $do == 'update') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $types = array('user_id' => array('user_id', 'int', 0), 'ip' => array('ip', 'str', ''), 'cause' => array('cause', 'str', ''), 'autodelete' => array('autodelete', 'int', 0), 'int_num' => array('int_num', 'int', 0), 'int_period' => array('int_period', 'str', '', create_function('$p', 'if(!in_array($p, array("MONTH","DAY","HOUR","MINUTE"))){ $p = "MINUTE"; } return $p;')));
        $items = cmsCore::getArrayFromRequest($types);
        $error = false;
        if (!$items['ip']) {
            $error = true;
            cmsCore::addSessionMessage($_LANG['AD_NEED_IP'], 'error');
        }
        if ($items['ip'] == $_SERVER['REMOTE_ADDR'] || $items['user_id'] == $inUser->id) {
            $error = true;
            cmsCore::addSessionMessage($_LANG['AD_ITS_YOUR_IP'], 'error');
        }
        if (cmsUser::userIsAdmin($items['user_id'])) {
            $error = true;
            cmsCore::addSessionMessage($_LANG['AD_ITS_ADMIN'], 'error');
        }
        if ($error) {
            cmsCore::redirectBack();
        }
        if ($do == 'update') {
            $inDB->update('cms_banlist', $items, $id);
            if (empty($_SESSION['editlist'])) {
                cmsCore::redirect('?view=userbanlist');
            } else {
                cmsCore::redirect('?view=userbanlist&do=edit');
            }
        }
        $inDB->insert('cms_banlist', $items);
        $back_url = cmsUser::sessionGet('back_url');
        cmsUser::sessionDel('back_url');
        cmsCore::redirect($back_url ? $back_url : '?view=userbanlist');
    }
    if ($do == 'add' || $do == 'edit') {
        $GLOBALS['cp_page_head'][] = '<script language="JavaScript" type="text/javascript" src="/admin/js/banlist.js"></script>';
        $toolmenu[] = array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:document.addform.submit();');
        $toolmenu[] = array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'javascript:history.go(-1);');
        cpToolMenu($toolmenu);
        if ($do == 'add') {
            echo '<h3>' . $_LANG['AD_TO_BANLIST_ADD'] . '</h3>';
            cpAddPathway($_LANG['AD_TO_BANLIST_ADD']);
        } else {
            if (isset($_REQUEST['multiple'])) {
                if (isset($_REQUEST['item'])) {
                    $_SESSION['editlist'] = cmsCore::request('item', 'array_int', array());
                } else {
                    cmsCore::addSessionMessage($_LANG['AD_NO_SELECT_OBJECTS'], 'error');
                    cmsCore::redirectBack();
                }
            }
            $ostatok = '';
//.........这里部分代码省略.........
开发者ID:deltas1,项目名称:icms1,代码行数:101,代码来源:userbanlist.php

示例3: 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

示例4: round

    $inPage->addPathway($_LANG['PHOTOALBUMS'], '/users/' . $usr['id'] . '/photoalbum.html');
    $inPage->addPathway($photo['album'], '/users/' . $usr['login'] . '/photos/private' . $photo['album_id'] . '.html');
    $inPage->addPathway($photo['title']);
    $photo['pubdate'] = cmsCore::dateFormat($photo['pubdate'], true, false, false);
    $photo['genderlink'] = cmsUser::getGenderLink($usr['id'], $usr['nickname'], $photo['gender'], $usr['login']);
    $photo['filesize'] = round(filesize(PATH . '/images/users/photos/medium/' . $photo['imageurl']) / 1024, 2);
    //ссылки на предыдущую и следующую фотографии
    $previd = $inDB->get_fields('cms_user_photos', "id>'{$photo['id']}' AND user_id = '{$usr['id']}' AND album_id='{$photo['album_id']}'", 'id, title, pubdate', 'id ASC');
    $nextid = $inDB->get_fields('cms_user_photos', "id<'{$photo['id']}' AND user_id = '{$usr['id']}' AND album_id='{$photo['album_id']}'", 'id, title, pubdate', 'id DESC');
    // Проверяем права доступа
    $is_allow = cmsUser::checkUserContentAccess($photo['allow_who'], $id);
    // Если видим фото, обновляем просмотры
    if ($is_allow) {
        $inDB->query("UPDATE cms_user_photos SET hits = hits + 1 WHERE id = " . $photo['id']);
    }
    cmsPage::initTemplate('components', 'com_users_photos_view')->assign('photo', $photo)->assign('bbcode', '[IMG]' . HOST . '/images/users/photos/medium/' . $photo['imageurl'] . '[/IMG]')->assign('previd', $previd)->assign('nextid', $nextid)->assign('usr', $usr)->assign('myprofile', $myprofile)->assign('is_admin', cmsUser::userIsAdmin($inUser->id))->assign('is_allow', $is_allow)->assign('tagbar', $is_allow ? cmsTagBar('userphoto', $photo['id']) : '')->display('com_users_photos_view.tpl');
    if ($inCore->isComponentInstalled('comments') && $is_allow) {
        cmsCore::includeComments();
        comments('userphoto', $photo['id']);
    }
}
//============================================================================//
//============================ Один фотоальбом ===============================//
//============================================================================//
if ($pdo == 'viewalbum') {
    if (!$inUser->id && !$model->config['sw_guest']) {
        cmsUser::goToLogin();
    }
    $usr = cmsUser::getShortUserData($login);
    if (!$usr) {
        cmsCore::error404();
开发者ID:vicktorwork,项目名称:cms1,代码行数:31,代码来源:photos.php

示例5: applet_userbanlist

function applet_userbanlist()
{
    $inCore = cmsCore::getInstance();
    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/users', $adminAccess)) {
        cpAccessDenied();
    }
    cmsCore::c('page')->setTitle($_LANG['AD_BANLIST']);
    cpAddPathway($_LANG['AD_USERS'], 'index.php?view=users');
    cpAddPathway($_LANG['AD_BANLIST'], 'index.php?view=userbanlist');
    $do = cmsCore::request('do', 'str', 'list');
    $id = cmsCore::request('id', 'int', -1);
    $to = cmsCore::request('to', 'int', 0);
    // для редиректа обратно в профиль на сайт
    if ($to) {
        cmsUser::sessionPut('back_url', cmsCore::getBackURL());
    }
    if ($do == 'list') {
        $toolmenu = array(array('icon' => 'useradd.gif', 'title' => $_LANG['AD_TO_BANLIST_ADD'], 'link' => '?view=userbanlist&do=add'), array('icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link' => "javascript:checkSel('?view=userbanlist&do=edit&multiple=1');"), array('icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=userbanlist&do=delete&multiple=1');"));
        cpToolMenu($toolmenu);
        $fields = array(array('title' => 'id', 'field' => 'id', 'width' => '40'), array('title' => $_LANG['AD_IS_ACTIVE'], 'field' => 'status', 'width' => '65', 'prc' => 'cpYesNo'), array('title' => $_LANG['AD_BANLIST_USER'], 'field' => 'user_id', 'width' => '120', 'filter' => '12', 'prc' => 'cpUserNick'), array('title' => $_LANG['AD_BANLIST_IP'], 'field' => 'ip', 'width' => '100', 'link' => '?view=userbanlist&do=edit&id=%id%', 'filter' => '12'), array('title' => $_LANG['DATE'], 'field' => 'bandate', 'width' => '', 'fdate' => '%d/%m/%Y %H:%i:%s', 'filter' => '12'), array('title' => $_LANG['AD_BANLIST_TIME'], 'field' => 'int_num', 'width' => '55'), array('title' => '', 'field' => 'int_period', 'width' => '70'), array('title' => $_LANG['AD_AUTOREMOVE'], 'field' => 'autodelete', 'width' => '100', 'prc' => 'cpYesNo'));
        $actions = array(array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=userbanlist&do=edit&id=%id%'), array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_REMOVE_RULE'], 'link' => '?view=userbanlist&do=delete&id=%id%'));
        cpListTable('cms_banlist', $fields, $actions, '1=1', 'ip DESC');
    }
    if ($do == 'delete') {
        if (!cmsCore::inRequest('item')) {
            if ($id >= 0) {
                dbDelete('cms_banlist', $id);
            }
        } else {
            dbDeleteList('cms_banlist', cmsCore::request('item', 'array_int', array()));
        }
        cmsCore::redirect('?view=userbanlist');
    }
    if ($do == 'submit' || $do == 'update') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $types = array('user_id' => array('user_id', 'int', 0), 'ip' => array('ip', 'str', ''), 'cause' => array('cause', 'str', ''), 'autodelete' => array('autodelete', 'int', 0), 'int_num' => array('int_num', 'int', 0), 'int_period' => array('int_period', 'str', '', create_function('$p', 'if(!in_array($p, array("MONTH","DAY","HOUR","MINUTE"))){ $p = "MINUTE"; } return $p;')));
        $items = cmsCore::getArrayFromRequest($types);
        $error = false;
        if (!$items['ip']) {
            $error = true;
            cmsCore::addSessionMessage($_LANG['AD_NEED_IP'], 'error');
        }
        if ($items['ip'] == $_SERVER['REMOTE_ADDR'] || $items['user_id'] == cmsCore::c('user')->id) {
            $error = true;
            cmsCore::addSessionMessage($_LANG['AD_ITS_YOUR_IP'], 'error');
        }
        if (cmsUser::userIsAdmin($items['user_id'])) {
            $error = true;
            cmsCore::addSessionMessage($_LANG['AD_ITS_ADMIN'], 'error');
        }
        if ($error) {
            cmsCore::redirectBack();
        }
        if ($do == 'update') {
            cmsCore::c('db')->update('cms_banlist', $items, $id);
            if (empty($_SESSION['editlist'])) {
                cmsCore::redirect('?view=userbanlist');
            } else {
                cmsCore::redirect('?view=userbanlist&do=edit');
            }
        }
        cmsCore::c('db')->insert('cms_banlist', $items);
        $back_url = cmsUser::sessionGet('back_url');
        cmsUser::sessionDel('back_url');
        cmsCore::redirect($back_url ? $back_url : '?view=userbanlist');
    }
    if ($do == 'add' || $do == 'edit') {
        cmsCore::c('page')->addHeadJS('admin/js/banlist.js');
        $toolmenu = array(array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:document.addform.submit();'), array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'javascript:history.go(-1);'));
        cpToolMenu($toolmenu);
        if ($do == 'add') {
            echo '<h3>' . $_LANG['AD_TO_BANLIST_ADD'] . '</h3>';
            cpAddPathway($_LANG['AD_TO_BANLIST_ADD']);
        } else {
            if (cmsCore::inRequest('multiple')) {
                if (cmsCore::inRequest('item')) {
                    $_SESSION['editlist'] = cmsCore::request('item', 'array_int', array());
                } else {
                    cmsCore::addSessionMessage($_LANG['AD_NO_SELECT_OBJECTS'], 'error');
                    cmsCore::redirectBack();
                }
            }
            $ostatok = '';
            if (isset($_SESSION['editlist'])) {
                $item_id = array_shift($_SESSION['editlist']);
                if (count($_SESSION['editlist']) == 0) {
                    unset($_SESSION['editlist']);
                } else {
                    $ostatok = '(' . $_LANG['AD_NEXT_IN'] . count($_SESSION['editlist']) . ')';
                }
            } else {
                $item_id = cmsCore::request('id', 'int', 0);
            }
            $mod = cmsCore::c('db')->get_fields('cms_banlist', "id = '" . $item_id . "'", '*');
            if (!$mod) {
                cmsCore::error404();
//.........这里部分代码省略.........
开发者ID:CMS-RuDi,项目名称:CMS-RuDi,代码行数:101,代码来源:userbanlist.php

示例6: faq


//.........这里部分代码省略.........
    $published      = ($inUser->is_admin || $cfg['publish']) ? 1 : 0;
    $is_submit      = $inCore->inRequest('message');

    if ($is_submit && !$inUser->id && !cmsCore::checkCaptchaCode()) { $error = $_LANG['ERR_CAPTCHA']; }

	if (!$is_submit || $error){

        if (IS_BILLING && $inUser->id){ cmsBilling::checkBalance('faq', 'add_quest'); }

		cmsPage::initTemplate('components', 'com_faq_add')->
                assign('catslist', $inCore->getListItems('cms_faq_cats', $category_id))->
                assign('user_id', $inUser->id)->
                assign('message', htmlspecialchars($inCore->request('message', 'html', '')))->
                assign('error', $error)->
                display();

	} else {

        //SAVE QUESTION
		$sql = "INSERT INTO cms_faq_quests (category_id, pubdate, published, quest, answer, user_id, answeruser_id, answerdate, hits)
				VALUES ('$category_id', NOW(), '$published', '$message', '', '{$inUser->id}', 0, NOW(), 0)";
		$inDB->query($sql);

		$quest_id = $inDB->get_last_id('cms_faq_quests');

        if (IS_BILLING && $inUser->id){ cmsBilling::process('faq', 'add_quest'); }

		$inPage->setTitle($_LANG['QUESTION_SEND']);
		$inPage->addPathway($_LANG['QUESTION_SEND']);

        if (!$published){
			echo '<div class="con_heading">'.$_LANG['QUESTION_SEND'].'</div>';
            echo '<div style="margin-top:10px">'.$_LANG['QUESTION_PREMODER'].'</div>';
			echo '<div style="margin-top:10px"><a href="/faq">'.$_LANG['CONTINUE'].'</a></div>';
        } elseif ($published) {
			$category = $inDB->get_field('cms_faq_cats', "id={$category_id}", 'title');
            //регистрируем событие
            cmsActions::log('add_quest', array(
                'object' => $_LANG['QUESTION'],
                'object_url' => '/faq/quest'.$quest_id.'.html',
                'object_id' => $quest_id,
                'target' => $category,
                'target_url' => '/faq/'.$category_id,
                'target_id' => $category_id,
                'description' => strip_tags( mb_strlen(strip_tags($message))>100 ? mb_substr($message, 0, 100) : $message )
            ));
            $inCore->redirect('/faq/quest'.$quest_id.'.html');
		} else { $inCore->redirect('/faq/quest'.$quest_id.'.html'); }

	}
}

///////////////////////////////////// DELETE QUEST ////////////////////////////////////////////////////////////////////////////////

if ($do=='delquest'){

    $quest_id 	= $inCore->request('quest_id', 'int', 0);
    $user_id    = $inUser->id;

	$sql    = "SELECT con.id, con.quest, con.category_id
				FROM cms_faq_quests con
				WHERE con.id = '$quest_id' LIMIT 1";

	$result = $inDB->query($sql);
	$quest  = $inDB->fetch_assoc($result);

    if (!$user_id || !$quest_id || !$quest) { $inCore->redirectBack(); }

    if ( !$inCore->inRequest('confirm') ) {

        if (cmsUser::userIsAdmin($user_id)){
			$inPage->setTitle($_LANG['DEL_QUES']);
			$inPage->addPathway($_LANG['DEL_QUES']);
            $confirm['title'] = $_LANG['DELETE_QUES'];
            $confirm['text']  = $_LANG['YOU_REALY_DELETE_QUES'].':<br> "<a href="/faq/quest'.$quest['id'].'.html">'.$quest['quest'].'</a>"<br><br>';
			$confirm['action']                  = $_SERVER['REQUEST_URI'];
			$confirm['yes_button']              = array();
			$confirm['yes_button']['type']      = 'submit';
			$confirm['yes_button']['name']  	= 'confirm';
            cmsPage::initTemplate('components', 'action_confirm')->
                    assign('confirm', $confirm)->
                    display();
        } else {
            $inCore->redirectBack();
        }
	}

    if ( $inCore->inRequest('confirm') ){

        if (cmsUser::userIsAdmin($user_id)){

            $model->deleteQuest($quest_id);

        }
        $inCore->redirect('/faq/'.$quest['category_id']);
    }

}

} //function
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:101,代码来源:frontend.php

示例7: assign

    //ссылки на предыдущую и следующую фотографии
    $previd = $inDB->get_fields('cms_user_photos', "id>'{$photo['id']}' AND user_id = '{$usr['id']}' AND album_id='{$photo['album_id']}'", 'id, title, pubdate', 'id ASC');
    $nextid = $inDB->get_fields('cms_user_photos', "id<'{$photo['id']}' AND user_id = '{$usr['id']}' AND album_id='{$photo['album_id']}'", 'id, title, pubdate', 'id DESC');
	// Проверяем права доступа
	$is_allow = cmsUser::checkUserContentAccess($photo['allow_who'], $id);
	// Если видим фото, обновляем просмотры
	if ($is_allow) { $inDB->query("UPDATE cms_user_photos SET hits = hits + 1 WHERE id = ".$photo['id']) ; }

    cmsPage::initTemplate('components', 'com_users_photos_view')->
            assign('photo', $photo)->
            assign('bbcode', '[IMG]'.HOST.'/images/users/photos/medium/'.$photo['imageurl'].'[/IMG]')->
            assign('previd', $previd)->
            assign('nextid', $nextid)->
            assign('usr', $usr)->
            assign('myprofile', $myprofile)->
            assign('is_admin', cmsUser::userIsAdmin($inUser->id))->
            assign('is_allow', $is_allow)->
            assign('tagbar', ($is_allow ? cmsTagBar('userphoto', $photo['id']) : ''))->
            display();

	if ($inCore->isComponentEnable('comments') && $is_allow){
            cmsCore::includeComments();
            comments('userphoto', $photo['id'], array(), $myprofile);
        }

}
//============================================================================//
//============================ Один фотоальбом ===============================//
//============================================================================//

if ($pdo=='viewalbum'){
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:31,代码来源:photos.php

示例8: forum


//.........这里部分代码省略.........
                }
                $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();
        }
        $thread = $model->getThread($post['thread_id']);
        if (!$thread) {
            cmsCore::error404();
        }
        $path_list = $inDB->getNsCategoryPath('cms_forums', $thread['NSLeft'], $thread['NSRight'], 'id, title, access_list, moder_list, NSLeft, NSRight');
        if ($path_list) {
            foreach ($path_list as $pcat) {
                if (!cmsCore::checkContentAccess($pcat['access_list'])) {
                    cmsCore::error404();
                }
            }
            $is_forum_moder = $model->isForumModerator($pcat['moder_list']);
        }
        $end_min = $model->checkEditTime($post['pubdate']);
        $is_author_can_edit = (is_bool($end_min) ? $end_min : $end_min > 0) && $post['user_id'] == $inUser->id;
        if (!$inUser->is_admin && !($is_forum_moder && !cmsUser::userIsAdmin($post['user_id'])) && !$is_author_can_edit) {
            cmsCore::error404();
        }
        $model->deletePost($post['id']);
        $model->updateThreadPostCount($post['thread_id']);
        $model->cacheThreadLastPost($post['thread_id']);
        if ($path_list) {
            $path_list = array_reverse($path_list);
            foreach ($path_list as $pcat) {
                $model->updateForumCache($pcat['NSLeft'], $pcat['NSRight']);
            }
        }
        cmsCore::addSessionMessage($_LANG['MSG_IS_DELETED'], 'info');
        $total_pages = ceil(($thread['post_count'] - 1) / $model->config['pp_thread']);
        if ($page > $total_pages) {
            $page = $total_pages;
        }
        cmsCore::jsonOutput(array('error' => false, 'redirect' => '/forum/thread' . $thread['id'] . '-' . $page . '.html'));
    }
    //============================================================================//
    //========================== Операции с темами ===============================//
    //============================================================================//
    if (in_array($do, array('movethread', 'renamethread', 'deletethread', 'close', 'pin', 'pin_post', 'move_post'))) {
        if (!$inUser->id) {
            cmsCore::error404();
        }
        $thread = $model->getThread($id);
        if (!$thread) {
            cmsCore::halt();
        }
        $path_list = $inDB->getNsCategoryPath('cms_forums', $thread['NSLeft'], $thread['NSRight'], 'id, title, access_list, moder_list, NSLeft, NSRight');
        if ($path_list) {
            foreach ($path_list as $pcat) {
开发者ID:deltas1,项目名称:icms1,代码行数:67,代码来源:frontend.php

示例9: getComments

 /**
  * Получаем комментарии по заданным параметрам
  * @return array
  */
 public function getComments($only_published = true, $is_tree = false, $from_module = false)
 {
     $inUser = cmsUser::getInstance();
     $comments = array();
     global $_LANG;
     $published = $only_published ? 'c.published = 1' : '1=1';
     $sql = "SELECT c.*,\r\n\t\t\t\t\t   IFNULL(u.nickname, 0) as nickname,\r\n\t\t\t\t\t   IFNULL(u.login, 0) as login,\r\n\t\t\t\t\t   IFNULL(u.is_deleted, 0) as is_deleted,\r\n\t\t\t\t\t   IFNULL(p.imageurl, 0) as imageurl,\r\n\t\t\t\t\t   IFNULL(p.gender, 0) as gender\r\n                FROM cms_comments c\r\n\t\t\t\tLEFT JOIN cms_users u ON u.id = c.user_id\r\n\t\t\t\tLEFT JOIN cms_user_profiles p ON p.user_id = u.id\r\n                WHERE {$published}\r\n\t\t\t\t\t{$this->inDB->where}\r\n\r\n                {$this->inDB->group_by}\r\n\r\n                {$this->inDB->order_by}\n";
     if ($this->inDB->limit) {
         $sql .= "LIMIT {$this->inDB->limit}";
     }
     $result = $this->inDB->query($sql);
     $this->inDB->resetConditions();
     if (!$this->inDB->num_rows($result)) {
         return array();
     }
     while ($comment = $this->inDB->fetch_assoc($result)) {
         $comment['level'] = 0;
         $comment['is_editable'] = $this->isEditable($comment['pubdate']);
         $comment['fpubdate'] = cmsCore::dateFormat($comment['pubdate'], true, true);
         if ($comment['guestname']) {
             $comment['author'] = $comment['guestname'];
             $comment['is_profile'] = false;
             $comment['ip'] = in_array($this->config['cmm_ip'], array(1, 2)) ? $comment['ip'] : '';
         } else {
             $comment['author']['nickname'] = $comment['nickname'];
             $comment['author']['login'] = $comment['login'];
             $comment['is_profile'] = true;
             $comment['user_image'] = cmsUser::getUserAvatarUrl($comment['user_id'], 'small', $comment['imageurl'], $comment['is_deleted']);
             $comment['ip'] = $this->config['cmm_ip'] == 2 && $comment['ip'] ? $comment['ip'] : '';
         }
         switch ($comment['gender']) {
             case 'm':
                 $comment['gender'] = $_LANG['COMMENTS_MALE'];
                 break;
             case 'f':
                 $comment['gender'] = $_LANG['COMMENTS_FEMALE'];
                 break;
             default:
                 $comment['gender'] = $_LANG['COMMENTS_GENDER'];
         }
         $comment['show'] = !$this->config['min_karma'] || $comment['rating'] >= $this->config['min_karma_show'] || cmsUser::userIsAdmin($comment['user_id']);
         $comment['is_my'] = $inUser->id == $comment['user_id'];
         if ($inUser->id) {
             $comment['is_voted'] = $comment['is_my'] ? true : cmsUser::isRateUser('comment', $inUser->id, $comment['id']);
         } else {
             $comment['is_voted'] = true;
         }
         $comments[] = $comment;
     }
     if ($is_tree) {
         $comments = $this->buildTree(0, 0, $comments);
     }
     return $from_module ? cmsCore::callEvent('GET_COMMENTS_MODULE', $comments) : cmsCore::callEvent('GET_COMMENTS', $comments);
 }
开发者ID:deltas1,项目名称:icms1,代码行数:58,代码来源:model.php

示例10: applet_userbanlist

function applet_userbanlist() {
    $inCore = cmsCore::getInstance();
    
    global $_LANG;
    global $adminAccess;
    
    if (!cmsUser::isAdminCan('admin/users', $adminAccess)) { cpAccessDenied(); }

    cmsCore::c('page')->setTitle($_LANG['AD_BANLIST']);
    cpAddPathway($_LANG['AD_USERS'], 'index.php?view=users');
    cpAddPathway($_LANG['AD_BANLIST'], 'index.php?view=userbanlist');

    $do = cmsCore::request('do', 'str', 'list');
    $id = cmsCore::request('id', 'int', -1);
    $to = cmsCore::request('to', 'int', 0);
    
    // для редиректа обратно в профиль на сайт
    if ($to) {
        cmsUser::sessionPut('back_url', cmsCore::getBackURL());
    }

    if ($do == 'list') {
        $toolmenu = array(
            array( 'icon' => 'useradd.gif', 'title' => $_LANG['AD_TO_BANLIST_ADD'], 'link' => '?view=userbanlist&do=add' ),
            array( 'icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link' => "javascript:checkSel('?view=userbanlist&do=edit&multiple=1');" ),
            array( 'icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=userbanlist&do=delete&multiple=1');" )
        );

        cpToolMenu($toolmenu);

        $fields = array(
            array( 'title' => 'id', 'field' => 'id', 'width' => '40' ),
            array( 'title' => $_LANG['AD_IS_ACTIVE'], 'field' => 'status', 'width' => '65', 'prc' => 'cpYesNo' ),
            array( 'title' => $_LANG['AD_BANLIST_USER'], 'field' => 'user_id', 'width' => '120', 'filter' => '12', 'prc' => 'cpUserNick' ),
            array( 'title' => $_LANG['AD_BANLIST_IP'], 'field' => 'ip', 'width' => '100', 'link' => '?view=userbanlist&do=edit&id=%id%', 'filter' => '12' ),
            array( 'title' => $_LANG['DATE'], 'field' => 'bandate', 'width' => '', 'fdate' => '%d/%m/%Y %H:%i:%s', 'filter' => '12' ),
            array( 'title' => $_LANG['AD_BANLIST_TIME'], 'field' => 'int_num', 'width' => '55' ),
            array( 'title' => '', 'field' => 'int_period', 'width' => '70' ),
            array( 'title' => $_LANG['AD_AUTOREMOVE'], 'field' => 'autodelete', 'width' => '100', 'prc' => 'cpYesNo' )
        );
        
        $actions = array(
            array( 'title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=userbanlist&do=edit&id=%id%' ),
            array( 'title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_REMOVE_RULE'], 'link' => '?view=userbanlist&do=delete&id=%id%' )
        );

        cpListTable('cms_banlist', $fields, $actions, '1=1', 'ip DESC');
    }

    if ($do == 'delete') {
        if (!cmsCore::inRequest('item')) {
            if ($id >= 0) { dbDelete('cms_banlist', $id); }
        } else {
            dbDeleteList('cms_banlist', cmsCore::request('item', 'array_int', array()));
        }
        cmsCore::redirect('?view=userbanlist');
    }

    if ($do == 'submit' || $do == 'update') {
        if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }

        $types = array(
            'user_id' => array( 'user_id', 'int', 0 ),
            'ip' => array( 'ip', 'str', '' ),
            'cause' => array( 'cause', 'str', '' ),
            'autodelete' => array( 'autodelete', 'int', 0 ),
            'int_num' => array( 'int_num', 'int', 0 ),
            'int_period' => array( 'int_period', 'str', '', create_function('$p', 'if(!in_array($p, array("MONTH","DAY","HOUR","MINUTE"))){ $p = "MINUTE"; } return $p;') )
        );

        $items = cmsCore::getArrayFromRequest($types);

        $error = false;

        if (!$items['ip']) {
            $error = true;
            cmsCore::addSessionMessage($_LANG['AD_NEED_IP'], 'error');
        }
        
        if ($items['ip'] == $_SERVER['REMOTE_ADDR'] ||
            $items['user_id'] == cmsCore::c('user')->id) {
            $error = true;
            cmsCore::addSessionMessage($_LANG['AD_ITS_YOUR_IP'], 'error');
        }

        if (cmsUser::userIsAdmin($items['user_id'])) {
            $error = true;
            cmsCore::addSessionMessage($_LANG['AD_ITS_ADMIN'], 'error');
        }

        if ($error) {
            cmsCore::redirectBack();
        }

        if ($do == 'update') {
            cmsCore::c('db')->update('cms_banlist', $items, $id);

            if (empty($_SESSION['editlist'])) {
                cmsCore::redirect('?view=userbanlist');
            } else {
//.........这里部分代码省略.........
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:101,代码来源:userbanlist.php


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