本文整理汇总了PHP中cmsActions类的典型用法代码示例。如果您正苦于以下问题:PHP cmsActions类的具体用法?PHP cmsActions怎么用?PHP cmsActions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了cmsActions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mod_actions
function mod_actions(array $mod, $cfg)
{
$inDB = cmsDatabase::getInstance();
$inActions = cmsActions::getInstance();
global $_LANG;
if (!isset($cfg['show_target'])) {
$cfg['show_target'] = 1;
}
if (!isset($cfg['limit'])) {
$cfg['limit'] = 15;
}
if (!isset($cfg['show_link'])) {
$cfg['show_link'] = 1;
}
if (!isset($cfg['action_types'])) {
echo $_LANG['MODULE_NOT_CONFIGURED'];
return true;
}
if (!$cfg['show_target']) {
$inActions->showTargets(false);
}
$inActions->onlySelectedTypes($cfg['action_types']);
$inDB->limitIs($cfg['limit']);
$actions = $inActions->getActionsLog();
if (!$actions) {
return false;
}
cmsPage::initTemplate('modules', $cfg['tpl'])->assign('actions', $actions)->assign('cfg', $cfg)->assign('user_id', cmsUser::getInstance()->id)->display($cfg['tpl']);
return true;
}
示例2: deleteQuest
public function deleteQuest($id)
{
$inCore = cmsCore::getInstance();
$this->inDB->query("DELETE FROM cms_armedlist_quests WHERE id={$id}");
$inCore->deleteComments('armedlist', $id);
cmsActions::removeObjectLog('add_quest', $id);
return true;
}
示例3: deleteItem
public function deleteItem($id)
{
$imageurl = $this->getItemImageUrl($id);
@chmod(PATH . "/images/catalog/{$imageurl}", 0777);
@chmod(PATH . "/images/catalog/small/{$imageurl}", 0777);
@chmod(PATH . "/images/catalog/medium/{$imageurl}", 0777);
@unlink(PATH . '/images/catalog/' . $imageurl);
@unlink(PATH . '/images/catalog/small/' . $imageurl);
@unlink(PATH . '/images/catalog/medium/' . $imageurl);
$this->inDB->query("DELETE FROM cms_uc_items WHERE id= '{$id}'");
$this->inDB->query("DELETE FROM cms_tags WHERE target='catalog' AND item_id = '{$id}'");
$this->inDB->query("DELETE FROM cms_uc_ratings WHERE item_id = '{$id}'");
cmsActions::removeObjectLog('add_catalog', $id);
cmsCore::deleteComments('catalog', $id);
}
示例4: install_component_calendar
function install_component_calendar()
{
$inCore = cmsCore::getInstance();
$inDB = cmsDatabase::getInstance();
$inConf = cmsConfig::getInstance();
include PATH . '/includes/dbimport.inc.php';
dbRunSQL(PATH . '/components/calendar/install.sql', $inConf->db_prefix);
if (!cmsActions::getAction('add_event')) {
cmsActions::registerAction('calendar', array('name' => 'add_event', 'title' => 'Добавление события', 'message' => 'добавляет %s| %s'));
}
if (!cmsActions::getAction('add_signup')) {
cmsActions::registerAction('calendar', array('name' => 'add_signup', 'title' => 'Присоединение к встрече', 'message' => 'будет учавствовать в %s|'));
}
if (!cmsActions::getAction('del_signup')) {
cmsActions::registerAction('calendar', array('name' => 'del_signup', 'title' => 'Отказ от участия во встрече', 'message' => 'не будет учавствовать в %s|'));
}
return true;
}
示例5: mod_actions_new
function mod_actions_new($module_id)
{
$inCore = cmsCore::getInstance();
$inUser = cmsUser::getInstance();
$inDB = cmsDatabase::getInstance();
global $_LANG;
$cfg = $inCore->loadModuleConfig($module_id);
if (!isset($cfg['show_target'])) {
$cfg['show_target'] = 1;
}
if (!isset($cfg['limit'])) {
$cfg['limit'] = 15;
}
if (!isset($cfg['show_link'])) {
$cfg['show_link'] = 1;
}
if (!isset($cfg['action_types'])) {
echo $_LANG['MODULE_NOT_CONFIGURED'];
return true;
}
$inActions = cmsActions::getInstance();
if (!$cfg['show_target']) {
$inActions->showTargets(false);
}
$inActions->onlySelectedTypes($cfg['action_types']);
$inActions->limitIs($cfg['limit']);
$actions = $inActions->getActionsLog();
$new_actions = array();
foreach ($actions as $action) {
$user = $inUser->getuserByLogin($action['user_login']);
$user_id = $user['id'];
$action['user_online'] = $inUser->isOnline($user['id']);
$action['user_ava'] = $inDB->get_field('cms_user_profiles', "user_id={$user_id}", 'imageurl');
$new_actions[] = $action;
}
$smarty = $inCore->initSmarty('modules', 'mod_actions_new.tpl');
$smarty->assign('actions', $new_actions);
$smarty->assign('cfg', $cfg);
$smarty->display('mod_actions_new.tpl');
return true;
}
示例6: install_component_calendar
function install_component_calendar()
{
$inCore = cmsCore::getInstance();
$inDB = cmsDatabase::getInstance();
$inConf = cmsConfig::getInstance();
$inDB->query("CREATE TABLE `cms_events` (\n\t\t `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t `author_id` int(11) NOT NULL,\n\t\t `type` varchar(128) NOT NULL,\n\t\t `category_id` int(11) NOT NULL,\n\t\t `start_time` int(11) NOT NULL,\n\t\t `end_time` int(11) NOT NULL,\n\t\t `title` varchar(128) NOT NULL,\n\t\t `content` longtext NOT NULL,\n\t\t `parent_id` int(11) NOT NULL,\n\t\t `hide` int(1) NOT NULL,\n\t\t PRIMARY KEY (`id`)\n\t\t ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1");
$inDB->query("CREATE TABLE `cms_events_category` (\n\t\t `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t `name` text NOT NULL,\n\t\t `bg` text NOT NULL,\n\t\t `tx` text NOT NULL,\n\t\t PRIMARY KEY (`id`)\n\t\t ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1");
$inDB->query("CREATE TABLE `cms_events_signup` (\n\t\t `event_id` int(11) NOT NULL,\n\t\t `user_id` int(11) NOT NULL,\n\t\t `time` int(11) NOT NULL\n\t\t ) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=utf8");
$inDB->query("CREATE TABLE IF NOT EXISTS `cms_fotolib` (\n\t\t `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t `user_id` int(11) NOT NULL,\n\t\t `type` text NOT NULL,\n\t\t `photo_id` int(11) NOT NULL,\n\t\t `name` text NOT NULL,\n\t\t `time` text NOT NULL,\n\t\t PRIMARY KEY (`id`)\n\t\t ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1");
$inDB->query("INSERT INTO cms_comment_targets (target, component, title)\n\t\t VALUES ('calendar', 'calendar', 'Календарь')");
if (!cmsActions::getAction('add_event')) {
cmsActions::registerAction('calendar', array('name' => 'add_event', 'title' => 'Добавление события', 'message' => 'добавляет %s| %s'));
}
if (!cmsActions::getAction('add_signup')) {
cmsActions::registerAction('calendar', array('name' => 'add_signup', 'title' => 'Присоединение к встрече', 'message' => 'будет учавствовать в %s|'));
}
if (!cmsActions::getAction('del_signup')) {
cmsActions::registerAction('calendar', array('name' => 'del_signup', 'title' => 'Отказ от участия во встрече', 'message' => 'не будет учавствовать в %s|'));
}
return true;
}
示例7: clubs
//.........这里部分代码省略.........
display();
cmsCore::jsonOutput(array('error' => false,
'can_create' => (bool)$can_create,
'html' => ob_get_clean()));
}
if (cmsCore::inRequest('create')){
if (!$can_create){ return false; }
$title = $inCore->request('title', 'str');
$clubtype = $inCore->request('clubtype', 'str');
if (!$title || !in_array($clubtype, array('public','private'))){
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['CLUB_REQ_TITLE']));
}
if ($inDB->get_field('cms_clubs', "LOWER(title) = '".mb_strtolower($title)."'", 'id')){
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['CLUB_EXISTS']));
}
if(!cmsUser::checkCsrfToken()) { return false; }
$club_id = $model->addClub(array('admin_id'=>$inUser->id,
'title'=>$title,
'clubtype'=>$clubtype,
'create_karma'=>$inUser->karma,
'enabled_blogs'=>$model->config['enabled_blogs'],
'enabled_photos'=>$model->config['enabled_photos']));
if($club_id){
//регистрируем событие
cmsActions::log('add_club', array(
'object' => $title,
'object_url' => '/clubs/'.$club_id,
'object_id' => $club_id,
'target' => '',
'target_url' => '',
'target_id' => 0,
'description' => ''
));
}
cmsCore::addSessionMessage($_LANG['CLUB_IS_CREATED'], 'success');
cmsCore::jsonOutput(array('error' => false,
'club_id' => $club_id));
}
}
///////////////////////// НАСТРОЙКИ КЛУБА //////////////////////////////////////
if ($do == 'config'){
if (!$inUser->id){ return false; }
$club = $model->getClub($id);
if (!$club){ return false; }
// Инициализируем участников клуба
$model->initClubMembers($club['id']);
// настраивать клуб могут только администраторы
$is_admin = $inUser->is_admin || ($inUser->id == $club['admin_id']);
if (!$is_admin){ return false; }
示例8: applet_users
function applet_users() {
$inCore = cmsCore::getInstance();
cmsCore::loadClass('actions');
cmsCore::loadModel('users');
$model = new cms_model_users();
// подключаем язык компонента регистрации
cmsCore::loadLanguage('components/registration');
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/users', $adminAccess)) { cpAccessDenied(); }
cmsCore::c('page')->setTitle($_LANG['AD_USERS']);
cpAddPathway($_LANG['AD_USERS'], 'index.php?view=users');
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', 0);
if ($do == 'list') {
$toolmenu = array(
array( 'icon' => 'useradd.gif', 'title' => $_LANG['AD_USER_ADD'], 'link' => '?view=users&do=add' ),
array( 'icon' => 'useredit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link' => "javascript:checkSel('?view=users&do=edit&multiple=1');" ),
array( 'icon' => 'userdelete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:if(confirm('". $_LANG['AD_IF_USERS_SELECT_REMOVE'] ."')) { checkSel('?view=users&do=delete&multiple=1'); }" ),
array( 'icon' => 'usergroup.gif', 'title' => $_LANG['AD_USERS_GROUP'], 'link' => '?view=usergroups' ),
array( 'icon' => 'userbanlist.gif', 'title' => $_LANG['AD_BANLIST'], 'link' => '?view=userbanlist' ),
array( 'icon' => 'user_go.png', 'title' => $_LANG['AD_USERS_SELECT_ACTIVATE'], 'link' => "javascript:if(confirm('". $_LANG['AD_IF_USERS_SELECT_ACTIVATE'] ."')) { checkSel('?view=users&do=activate&multiple=1'); }" ),
array( 'icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=help&topic=users' )
);
cpToolMenu($toolmenu);
$fields = array(
array( 'title' => 'id', 'field' => 'id', 'width' => '40' ),
array( 'title' => $_LANG['LOGIN'], 'field' => 'login', 'width' => '100', 'link' => '?view=users&do=edit&id=%id%', 'filter' => 12 ),
array( 'title' => $_LANG['NICKNAME'], 'field' => 'nickname', 'width' => '', 'link' => '?view=users&do=edit&id=%id%', 'filter' => 12 ),
array( 'title' => $_LANG['AD_RATING'], 'field' => array( 'rating', 'id' ), 'width' => '70', 'prc' => 'setRating' ),
array( 'title' => $_LANG['AD_GROUP'], 'field' => 'group_id', 'width' => '110', 'prc' => 'cpGroupById', 'filter' => 1, 'filterlist' => cpGetList('cms_user_groups') ),
array( 'title' => $_LANG['EMAIL'], 'field' => 'email', 'width' => '120' ),
array( 'title' => $_LANG['AD_REGISTRATION_DATE'], 'field' => 'regdate', 'width' => '100' ),
array( 'title' => $_LANG['AD_LAST_LOGIN'], 'field' => 'logdate', 'width' => '100' ),
array( 'title' => $_LANG['AD_LAST_IP'], 'field' => 'last_ip', 'width' => '90', 'prc' => 'getIpLink' ),
array( 'title' => $_LANG['AD_IS_LOCKED'], 'field' => 'is_locked', 'width' => '110', 'prc' => 'viewAct' ),
array( 'title' => $_LANG['AD_IS_DELETED'], 'field' => 'is_deleted', 'width' => '80', 'prc' => 'viewDel' )
);
$actions = array(
array( 'title' => $_LANG['AD_PROFILE'], 'icon' => 'profile.gif', 'link' => '/users/%login%' ),
array( 'title' => $_LANG['AD_BANNED'], 'icon' => 'ban.gif', 'link' => '?view=userbanlist&do=add&to=%id%' ),
array( 'title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_IS_USER_DELETE'], 'link' => '?view=users&do=delete&id=%id%' ),
array( 'title' => $_LANG['AD_FOREVER_USER_DELETE'], 'icon' => 'off.gif', 'confirm' => $_LANG['AD_IF_FOREVER_USER_DELETE'], 'link' => '?view=users&do=delete_full&id=%id%' )
);
cpListTable('cms_users', $fields, $actions, '1=1', 'regdate DESC');
}
if ($do == 'rerating') {
$user_id = cmsCore::request('user_id', 'int');
if (!$user_id) { cmsCore::redirectBack(); }
$rating = cmsUser::getRating($user_id);
$user_sql = "UPDATE cms_users
SET rating = ". $rating ."
WHERE id = '". $user_id ."'";
cmsCore::c('db')->query($user_sql);
cmsCore::redirectBack();
}
if ($do == 'activate') {
$user_ids = cmsCore::request('item', 'array_int');
if (!$user_ids) { cmsCore::redirectBack(); }
foreach ($user_ids as $user_id) {
$code = cmsCore::c('db')->get_field('cms_users_activate', "user_id = '". $user_id ."'", 'code');
$sql = "UPDATE cms_users SET is_locked = 0 WHERE id = '". $user_id ."'";
cmsCore::c('db')->query($sql);
$sql = "DELETE FROM cms_users_activate WHERE code = '". $code ."'";
cmsCore::c('db')->query($sql);
cmsCore::callEvent('USER_ACTIVATED', $user_id);
// Регистрируем событие
cmsActions::log(
'add_user',
array(
'object' => '',
'user_id' => $user_id,
'object_url' => '',
'object_id' => $user_id,
'target' => '',
'target_url' => '',
'target_id' => 0,
'description' => ''
)
);
//.........这里部分代码省略.........
示例9: 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();
}
示例10: deletePost
/**
* Удаляет пост в блоге
* @param int $post_id
* @return bool
*/
public function deletePost($post_id)
{
cmsCore::callEvent('DELETE_POST', $post_id);
$post = $this->getPost($post_id);
if (!$post) {
return false;
}
// пересчитываем рейтинг блога
$this->inDB->query("UPDATE cms_blogs SET rating = rating - ({$post['rating']}) WHERE id = '{$post['blog_id']}'");
$this->inDB->delete('cms_blog_posts', "id = '{$post_id}'", 1);
cmsCore::deleteRatings($this->getTarget('rating'), $post_id);
cmsCore::deleteComments($this->getTarget('comments'), $post_id);
cmsClearTags($this->getTarget('tags'), $post_id);
cmsCore::deleteUploadImages($post_id, 'blog_post');
cmsActions::removeObjectLog($this->getTarget('actions_post'), $post_id);
return true;
}
示例11: 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));
//.........这里部分代码省略.........
示例12: deleteAlbum
/**
* Удаляет альбом
* @param int $album_id
* @param str $differ
* @param obj $inUploadPhoto
* @return bool
*/
public function deleteAlbum($album_id, $differ = '', $inUploadPhoto) {
$album = cmsCore::c('db')->getNsCategory('cms_photo_albums', $album_id, $differ);
if(!$album) { return false; }
cmsCore::callEvent('DELETE_ALBUM', $album_id);
//устанавливаем нужный альбом и все вложенные
$this->whereThisAndNestedCats($album['NSLeft'], $album['NSRight']);
cmsCore::c('db')->addJoin("INNER JOIN cms_photo_albums a ON a.id = f.album_id AND a.NSDiffer = '{$differ}'");
$photos = $this->getPhotos(true);
if ($photos){
foreach($photos as $photo){
$this->deletePhoto($photo, $inUploadPhoto);
}
}
cmsCore::deleteComments($this->getTarget('comments_album'), $album_id);
cmsActions::removeTargetLog($this->getTarget('actions_photo'), $album_id);
return cmsCore::c('db')->deleteNS('cms_photo_albums', $album_id, $differ);
}
示例13: users
//.........这里部分代码省略.........
cmsCore::addSessionMessage($_LANG['MESS_ALL_DEL_OK'], 'info');
cmsCore::redirectBack();
}
//============================================================================//
//============================= Загрузка аватара ============================//
//============================================================================//
if ($do == 'avatar') {
if (!$inUser->id || $inUser->id && $inUser->id != $id) {
cmsCore::error404();
}
$inPage->setTitle($_LANG['LOAD_AVATAR']);
$inPage->addPathway($inUser->nickname, cmsUser::getProfileURL($inUser->login));
$inPage->addPathway($_LANG['LOAD_AVATAR']);
if (cmsCore::inRequest('upload')) {
cmsCore::loadClass('upload_photo');
$inUploadPhoto = cmsUploadPhoto::getInstance();
// Выставляем конфигурационные параметры
$inUploadPhoto->upload_dir = PATH . '/images/';
$inUploadPhoto->dir_medium = 'users/avatars/';
$inUploadPhoto->dir_small = 'users/avatars/small/';
$inUploadPhoto->small_size_w = $model->config['smallw'];
$inUploadPhoto->medium_size_w = $model->config['medw'];
$inUploadPhoto->medium_size_h = $model->config['medh'];
$inUploadPhoto->is_watermark = false;
$inUploadPhoto->input_name = 'picture';
$file = $inUploadPhoto->uploadPhoto($inUser->orig_imageurl);
if (!$file) {
cmsCore::addSessionMessage('<strong>' . $_LANG['ERROR'] . ':</strong> ' . cmsCore::uploadError() . '!', 'error');
cmsCore::redirect('/users/' . $id . '/avatar.html');
}
$sql = "UPDATE cms_user_profiles SET imageurl = '{$file['filename']}' WHERE user_id = '{$id}' LIMIT 1";
$inDB->query($sql);
// очищаем предыдущую запись о смене аватара
cmsActions::removeObjectLog('add_avatar', $id);
// выводим сообщение в ленту
cmsActions::log('add_avatar', array('object' => '', 'object_url' => '', 'object_id' => $id, 'target' => '', 'target_url' => '', 'description' => '<a href="' . cmsUser::getProfileURL($inUser->login) . '" class="act_usr_ava">
<img border="0" src="/images/users/avatars/small/' . $file['filename'] . '">
</a>'));
cmsCore::redirect(cmsUser::getProfileURL($inUser->login));
} else {
cmsPage::initTemplate('components', 'com_users_avatar_upload')->assign('id', $id)->display('com_users_avatar_upload.tpl');
}
}
//============================================================================//
//============================= Библиотека аватаров =========================//
//============================================================================//
if ($do == 'select_avatar') {
if (!$inUser->id || $inUser->id && $inUser->id != $id) {
cmsCore::error404();
}
$avatars_dir = PATH . "/images/users/avatars/library";
$avatars_dir_rel = "/images/users/avatars/library";
$avatars_dir_handle = opendir($avatars_dir);
$avatars = array();
while ($nextfile = readdir($avatars_dir_handle)) {
if ($nextfile != '.' && $nextfile != '..' && (mb_strstr($nextfile, '.gif') || mb_strstr($nextfile, '.jpg') || mb_strstr($nextfile, '.jpeg') || mb_strstr($nextfile, '.png'))) {
$avatars[] = $nextfile;
}
}
closedir($avatars_dir_handle);
if (!cmsCore::inRequest('set_avatar')) {
$inPage->setTitle($_LANG['SELECT_AVATAR']);
$inPage->addPathway($inUser->nickname, cmsUser::getProfileURL($inUser->login));
$inPage->addPathway($_LANG['SELECT_AVATAR']);
$perpage = 20;
$total = sizeof($avatars);
示例14: applet_main
//.........这里部分代码省略.........
<td><img src="images/icons/hmenu/users.png" width="16" height="16" /></td>
<td><?php
echo $_LANG['AD_NEW_USERS_THEES_MONTH'];
?>
— <?php
echo (int) $inDB->get_field('cms_users', "regdate >= DATE_SUB(NOW(), INTERVAL 1 MONTH)", 'COUNT(id)');
?>
</td>
</tr>
</table>
</div>
</div>
<div class="small_box">
<div class="small_title"><strong><?php
echo $_LANG['AD_USERS_ONLINE'];
?>
</strong></div>
<div style="font-size:10px;margin:8px;">
<?php
echo cpWhoOnline();
?>
</div>
</div>
</td>
<td width="" valign="top" style="">
<div class="small_box">
<div class="small_title"><strong><?php
echo $_LANG['AD_LATEST_EVENTS'];
?>
</strong></div>
<div id="actions_box">
<div id="actions">
<?php
$inActions = cmsActions::getInstance();
$inActions->showTargets(true);
$inDB->limitPage(1, 30);
$actions = $inActions->getActionsLog();
$tpl_file = 'admin/actions.php';
$tpl_dir = file_exists(TEMPLATE_DIR . $tpl_file) ? TEMPLATE_DIR : DEFAULT_TEMPLATE_DIR;
include $tpl_dir . $tpl_file;
?>
</div>
</div>
</div>
</td>
<td width="325" valign="top" style=""><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="100" valign="top">
<?php
$new_quests = $inDB->rows_count('cms_faq_quests', 'published=0');
$new_content = $inDB->rows_count('cms_content', 'published=0 AND is_arhive = 0');
$new_catalog = $inDB->rows_count('cms_uc_items', 'on_moderate=1');
?>
<?php
if ($new_quests || $new_content || $new_catalog) {
?>
<div class="small_box">
<div class="small_title">
<span class="attention">
<strong><?php
echo $_LANG['AD_FROM_MODERATION'];
?>
</strong>
</span>
</div>
示例15: 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);
}