public function ChangeIndexTabsAction() { $userModel = new UserModel(); $user = Project::getUser()->getDbUser(); $request = Project::getRequest(); $tabs_map = $this->tabs_map; $checkBoxes = $request->checkBoxes; if ($user) { $old_selected_tabs = unserialize($user->tabs_map); foreach ($checkBoxes as $tabActiveId) { $tabs_map['selected_tabs'][] = array('id' => $tabActiveId, 'selected' => true); } foreach ($old_selected_tabs as $old_tab) { if (!in_array($old_tab['id'], $checkBoxes)) { $tabs_map['selected_tabs'][] = array('id' => $old_tab['id'], 'selected' => false); } } if (!$checkBoxes) { $tabs_map['selected_tabs'][0]['selected'] = true; } $userModel->saveUserTabsMap($user->id, $tabs_map['selected_tabs']); } else { return; } $message['tabs_map'] = $tabs_map; $message['user_id'] = $user->id; $this->_view->returnTabs($message); $this->_view->ajax(); }
function init($autorization) { if ($autorization->needAutorization() === true) { $type = Project::getUser()->getDbUser()->getUserType(); } else { $this->_guest = true; $type = new UserTypeModel(); } // TODO:: need adding cache $right_model = new UserRightModel(); $list = $right_model->loadByUserType($type->id); foreach ($list as $item) { $controller_id = (int) $item['controller_id']; $action_id = (int) $item['action_id']; $subaction_id = (int) $item['subaction_id']; if (!isset($this->_accessList[$controller_id])) { $this->_accessList[$controller_id] = array(); } if (!isset($this->_accessList[$controller_id][$action_id]) && $subaction_id === 0 && (int) $item['access'] > 0) { $this->_accessList[$controller_id][$action_id] = true; } if ($subaction_id > 0) { if (!isset($this->_subactions[$action_id])) { $this->_subactions[$action_id] = array(); } if ((int) $item['access'] > 0) { $this->_subactions[$action_id][$subaction_id] = true; } } } }
public function getTabsPages($tabs_map) { $user = Project::getUser()->getDbUser(); $htmlStr = ""; foreach ($tabs_map['selected_tabs'] as $tab) { $tab_id = $tab['id']; $tab_name = $tabs_map['main_tabs'][$tab_id]['name']; switch ($tab_id) { case 0: $htmlPage = $this->viewNewsPage($user->id); break; case 1: $htmlPage = $this->viewArticlePage($user->id); break; case 2: $htmlPage = $this->viewAlbumPage($user->id); break; case 3: $htmlPage = $this->viewQuestionPage($user->id); break; default: $htmlPage = ""; break; } $htmlStr .= ' <div id="page' . $tab_id . '" class="tab-page"> ' . $htmlPage . ' </div> '; } return $htmlStr; }
public function run() { $autorize = Project::getSecurityManager()->getAutorize(); $controller_class = $autorize->getController()->name; $controller = new $controller_class(); $controller->init($autorize->getController(), $autorize->getAction()); $action_function = $autorize->getAction()->name . 'Action'; setcookie('PHPSESSID', session_id(), null, null, Project::getUser()->getDbUser()->login . '.next24.ru'); $controller->{$action_function}(); $this->_request_complete = true; // Сохраняем время пользователя на серваке $user = Project::getUser()->getDbUser(); if ($user->id) { $userModel = new UserModel(); $userModel->refreshUsersOnline(); if (!$userModel->isUserOnline($user->id)) { $userModel->addUserOnline($user->id); } else { $userModel->updateUserOnline($user->id); } $userModel = new UserModel(); $user = $userModel->getUserById($user->id); $userModel->checkForUserBans($user); } // END Сохраняем время пользователя на серваке return $controller; }
function add($user_id, $cause) { if (strlen(trim($cause))) { $userModel = new UserModel(); $currentUser = Project::getUser()->getDbUser(); $userModel->load($user_id); if ($userModel->id) { $banHistoryModel = new BanHistoryModel(); $paramModel = new ParamModel(); $n_warnings_to_ban = $paramModel->getParam("UserController", "N_WARNINGS_TO_BAN"); $t_ban_time_sec = $paramModel->getParam("UserController", "T_BAN_TIME_SEC"); $count_user_warnings = $this->getUserWarningCount($user_id); $this->clear(); $this->user_id = (int) $user_id; $this->cause = $cause; $warning_id = $this->save(); if ($userModel->warnings_fromlast_ban + 1 >= $n_warnings_to_ban) { // пора банить $subject = "Ваш аккаун заблокирован в системе Next24.ru"; $userModel->warnings_fromlast_ban = 0; $userModel->banned = 1; $userModel->banned_date = time(); $banHistoryModel->ban($user_id, $currentUser->id, $warning_id, date("Y-m-d H:i:s", time() + $t_ban_time_sec)); } else { $userModel->warnings_fromlast_ban = $userModel->warnings_fromlast_ban + 1; $subject = "Администратор Next24.ru установил Вам предупреждение"; } $userModel->save(); $url_referer = $_SERVER['HTTP_REFERER']; $this->sendMessage((int) $user_id, $subject, $cause, $url_referer); return $warning_id; } } return 0; }
public function __construct() { $view_class = "GroupsView"; parent::__construct($view_class); $this->request = Project::getRequest()->getKeys(); $this->session = Project::getSession()->getKeys(); $this->current_user_id = Project::getUser()->getDbUser()->id; }
function SaveAction() { $request = Project::getRequest(); $user_id = (int) Project::getUser()->getDbUser()->id; $model = new UserModel(); $model->load($request->id); $do_save = true; $this->_view->clearFlashMessages(); if (!strlen(trim($request->login))) { $this->_view->addFlashMessage(FM::ERROR, "Не заполнено поле логин"); $do_save = false; } if ($request->unbann) { $ban_model = new BanHistoryModel(); $ban_model->unban($request->id, $user_id); } if ($request->bann) { if (strlen($request->warning)) { $ban_date = $request->ban_date; if (strlen($ban_date) && strtotime($ban_date) > time()) { $warning_model = new WarningModel(); $warning_id = $warning_model->add($request->id, $request->warning); $ban_model = new BanHistoryModel(); $ban_model->ban($request->id, $user_id, $warning_id, $request->ban_date); } else { $this->_view->addFlashMessage(FM::ERROR, "Неверная дата бана"); $do_save = false; } } else { $this->_view->addFlashMessage(FM::ERROR, "Не заполнено предупреждение"); $do_save = false; } } if ($do_save) { $this->_view->clearFlashMessages(); $model->login = $request->login; $model->user_type_id = $request->user_group; if ($request->bann) { $model->banned = 1; $model->banned_date = strtotime($request->ban_date); } else { $model->banned = 0; } $ban_date = $request->ban_date; if (strlen($ban_date)) { //$ban_model = new Ban } $id = $model->save(); $model = new UserTypeModel(); $info = array(); $info['group_list'] = $model->loadAll(); $info['edit_controller'] = null; $info['edit_action'] = 'Edit'; $this->makeUserList($info); $this->_view->AjaxList($info); } $this->_view->ajax(); }
protected function BaseAdminData() { $router = Project::getRequest(); // TODO:: hardcoded menu $this->_view->assign('main_menu', array(array('link' => $router->createUrl('Admin', 'Desktop'), 'name' => 'Рабочий стол'), array('link' => $router->createUrl('AdminParameter', 'GroupList'), 'name' => 'Параметры системы'), array('link' => $router->createUrl('AdminUser', 'List'), 'name' => 'Пользователи'), array('link' => $router->createUrl('UserType', 'List'), 'name' => 'Группы и права доступа'), array('link' => $router->createUrl('BlogAdmin', 'CatalogList'), 'name' => 'Блоги'))); $this->_view->assign('title', $this->_action_model->page_title); $this->_view->assign('current_user', Project::getUser()->getDbUser()); // TODO:: read logged user information }
function __construct($view_class = null) { if ($view_class === null) { $view_class = "PlacesView"; } $this->session = Project::getSession(); parent::__construct($view_class); $this->_view->assign('tab_list', TabController::getOwnTabs(true)); $this->user = Project::getUser()->getShowedUser(); $this->_view->assign('user_profile', $this->user->data()); $this->_view->assign('session', $this->session); $this->_view->assign('user_default_avatar', $this->user->getUserAvatar($this->user->id)); }
function __construct() { $user = Project::getUser()->getShowedUser(); $this->assign('showed_user_profile', $user->data()); $this->_base_dir = 'site'; // $this -> _js_files=array('sys.js', 'tab.js','jquery-1.3.2.js','ui.core.js','ui.draggable.js','ui.droppable.js','dropdown.js'); // $this -> _js_files=array('jquery-1.3.2.js','ui.core.js','ui.draggable.js','ui.droppable.js'); // $this -> _js_files=array('dropdown.js'); // $this -> _js_files=array('sys.js'); // $this -> _js_files=array('jquery.js','dropdown.js'); // $this -> _js_files=array('sys.js', 'tab.js','jquery-1.3.2.min.js','ui.core.js','ui.draggable.js','ui.droppable.js','dropdown.js'); $this->_js_files = array('jquery.min.js', 'dropdown.js'); $this->_css_files = array('screen.css'); parent::__construct(); }
public function viewSelectSecureUserList($name, $key, $section, $style = '') { $user_id = Project::getUser()->getDbUser()->id; $users = $this->_stack['users']; $result = '<form ' . $style . ' name="usr_list' . $key . '" method="post" action="' . Project::getRequest()->createUrl('GTD', 'GTDAddSecureUser') . '">'; $result .= '<select name="' . $name . '" onchange="usr_list' . $key . '.submit();">'; $result .= '<option>Добавить пользователя...</option>'; foreach ($users as $id => $user) { if ($id != $user_id) { $result .= '<option value="' . $id . '">' . $user['full_name'] . '</option>'; } } $result .= '</select><input type="hidden" name="id" value="' . $key . '" /> <input type="hidden" name="section" value="' . $section . '" /> <input type="hidden" name="cid" value="' . $this->category_id . '" /> <input type="hidden" name="fid" value="' . $this->folder_id . '" /></form>'; return $result; }
public function showUserAvator($userAvator, $imgUrl) { $user = Project::getUser()->getDbUser()->getUserById($userAvator['user_id']); echo '<div class="avatar">'; echo '<a href="' . Project::getRequest()->createUrl('User', 'Profile', null, $user['login']) . '">'; if ($userAvator['path'] && $userAvator['path'] != 'no.png') { $src = $userAvator['path'] ? $imgUrl . 'avatar/' . $userAvator['path'] : $imgUrl . 'avatar/' . $userAvator['sys_path']; echo '<img src="' . $src . '" />'; } else { echo '<img src="' . $imgUrl . 'avatar/no90.jpg" />'; } echo '<span class="member-name">' . $user['login'] . '</span>'; echo '</a>'; echo '</div>'; echo '<ul class="controll clearfix"> <li><a href="' . Project::getRequest()->createUrl('User', 'Profile', null, $user['login']) . '" title="Написать сообщение"><i class="icon mail-icon"></i></a></li> <li><a href="' . Project::getRequest()->createUrl('User', 'Profile', null, $user['login']) . '" title="Статьи"><i class="icon mbook-icon"></i></a></li> <li><a href="' . Project::getRequest()->createUrl('User', 'Profile', null, $user['login']) . '" title="Добавить"><i class="icon adduser-icon"></i></a></li> <li><a href="' . Project::getRequest()->createUrl('User', 'Profile', null, $user['login']) . '" title="Комментарии"><i class="icon mcomm-icon"></i></a></li> </ul>'; }
public function AddComplaintAction() { $messagesModel = new MessagesModel(); $user = Project::getUser()->getDbUser(); $userModel = new UserModel(); $arbitrationModel = new ArbitrationModel(); $request = Project::getRequest(); $user_login = $request->user_login; $complaint_on_user = $userModel->getUserByLogin($user_login); if ($complaint_on_user) { $arbitrationModel->load(0); $arbitrationModel->user_id = $user->id; $arbitrationModel->complaint_on_user = $complaint_on_user['id']; $arbitrationModel->complaint_text = $_SERVER['HTTP_REFERER'] . " " . htmlspecialchars($request->complaint_text); $arbitrationModel->arbitration_group_id = $request->arbitration_group_id; $arbitrationModel->save(); $message['item_id'] = (int) $request->item_id; $this->_view->returnArbitrationAdded($message); $this->_view->ajax(); } }
function loadAll($userid, $logged_user_id, $sortName = 'a.creation_date', $sortOrder = 'DESC', $defaultSortName = "id", $filter_ids = array()) { $userid = (int) $userid; if (is_null($sortName)) { $sortName = $defaultSortName; } $DE = Project::getDatabase(); $this->checkPager(); $sortOrder = $this->getSortDirection($sortOrder); if ($userid > 0) { $om = 1; } else { $om = "a.is_onmain = 1"; } if ($userid > 0) { $u = "a.user_id = " . $userid; } else { $u = 1; } $sql = "SELECT " . "a.id as id," . "a.name as name," . "a.creation_date as creation_date," . "u.login as login," . "p.thumbnail as thumbnail," . "IF (rate.voices > 0, rate.rating/rate.voices, 0) as album_rating," . "a.user_id as user_id," . "a.access as access," . "a.is_onmain as is_onmain " . " FROM album as a " . " LEFT JOIN users u ON u.id=a.user_id " . " LEFT JOIN photo p ON p.id=a.thumbnail_id AND p.album_id=a.id " . " LEFT JOIN photo rate ON rate.album_id = a.id AND rate.is_rating > 0 " . " WHERE " . " " . $om . " " . " AND " . $u . " " . " AND ( (a.access=" . ACCESS::ALL . ") OR (?d AND a.access=" . ACCESS::FRIEND . ") OR (a.user_id=?d AND a.access=" . ACCESS::MYSELF . ") )" . " GROUP BY id " . " ORDER BY {$sortName} {$sortOrder} LIMIT ?d, ?d "; $result = $DE->selectPage($this->_countRecords, $sql, (int) Project::getUser()->isFriend(), $logged_user_id, $this->_pager->getStartLimit(), $this->_pager->getPageSize()); $this->updatePagerAmount(); return $result; }
public function createGroupsTree() { $groups = $this->_stack['groups']; $current_user_id = Project::getUser()->getDbUser()->id; foreach ($groups as $group) { if ($group['access_rule']) { if ($group['access_read']) { if ($group['id_user'] == $current_user_id) { $result .= '<br /><a href="' . Project::getRequest()->createUrl('Groups', 'subGroupView') . '/id:' . $group['id'] . '">' . $group['full_name'] . '</a> <a href="' . Project::getRequest()->createUrl('Groups', 'subGroupView') . '/id:' . $group['id'] . '"> <a href="' . Project::getRequest()->createUrl('Groups', 'groupsDelete') . '/id:' . $group['id'] . '">удалить</a> <a href="' . Project::getRequest()->createUrl('Groups', 'groupsAlter') . '/id:' . $group['id'] . '">изменить</a> <br />Метка группы : ' . $group['group_name'] . '<br />'; } else { $result .= '<br /><a href="' . Project::getRequest()->createUrl('Groups', 'subGroupView') . '/id:' . $group['id'] . '">' . $group['full_name'] . '</a> <br />Метка группы : ' . $group['group_name'] . '<br />'; } } else { if ($group['id_user'] == $current_user_id) { $result .= '<br /><a href="' . Project::getRequest()->createUrl('Groups', 'subGroupView') . '/id:' . $group['id'] . '">' . $group['full_name'] . '</a> <a href="' . Project::getRequest()->createUrl('Groups', 'subGroupView') . '/id:' . $group['id'] . '"> <a href="' . Project::getRequest()->createUrl('Groups', 'groupsDelete') . '/id:' . $group['id'] . '">удалить</a> <a href="' . Project::getRequest()->createUrl('Groups', 'groupsAlter') . '/id:' . $group['id'] . '">изменить</a> <br />Метка группы : ' . $group['group_name'] . '<br />'; } else { $result .= '<br />' . $group['full_name'] . ' <a href="' . Project::getRequest()->createUrl('Groups', 'subGroupView') . '/id:' . $group['id'] . '">подать заявку</a> <br />Метка группы : ' . $group['group_name'] . '<br />'; } } } else { $result .= '<br /><a href="' . Project::getRequest()->createUrl('Groups', 'subGroupView') . '/id:' . $group['id'] . '">' . $group['full_name'] . '</a>'; if ($group['id_user'] == $current_user_id) { $result .= ' <a href="' . Project::getRequest()->createUrl('Groups', 'groupsDelete') . '/id:' . $group['id'] . '">удалить</a> <a href="' . Project::getRequest()->createUrl('Groups', 'groupsAlter') . '/id:' . $group['id'] . '">изменить</a>'; } $result .= '<br />Метка группы : ' . $group['group_name'] . '<br />'; } } return $result; }
<?php include($this -> _include('../header.tpl.php')); ?> <?php include($this -> _include('../profile_line.tpl.php')); ?> <?php $user = Project::getUser()->getDbUser()->getUserById($this->showed_user_profile['id']); ?> <div class="columns-page clearfix"> <div class="main"><div class="wrap"> <h2 class="page-ttl"><a href="#">Фотоальбомы <?$name_usr = implode(' ',array($user['first_name'],$user['middle_name'])); if(!trim($name_usr)) echo 'Нет имени'; else echo $name_usr;?></a> <span class="spr">»</span> <?=$this->current_album_name;?></h2> <?php if ($this -> can_edit) { ?> <form class="main-form" action="<?php echo $this -> createUrl('Photo', 'Save'); ?>" method="post"> <?php } ?> <fieldset> <div class="item-edit-list"> <?php if(count($this->photo_list)) { ?> <ul class="clearfix"> <?php foreach($this->photo_list as $key => $item){ ?> <li class="it"> <div class="nm"> <?php if ($this -> can_edit) { ?> <input type="hidden" name="photo_id[<?php echo $item['id'];?>]" value="<?php echo $item['id'];?>" /> <input type="text" name="photo_name[<?php echo $item['id'];?>]" value="<?php echo $item['name'];?>" /> <?php } else { ?> <a href="<?php echo PhotoController::getPhotoUrl($item['id'], $item['login']);?>"><?php echo $item['name'];?></a> <?php } ?> </div> <div class="av"> <a href="<?php echo PhotoController::getPhotoUrl($item['id'], $item['login']);?>"> <img class="avatar" src="<?php echo ($item['thumbnail'] ===false)?$this -> image_url.'noimage.gif' :$item['thumbnail'];?>" /> </a> </div> <div class="meta">
/** * Action: Оценка соц.позиции */ public function SocialVoteAddAction() { $v_request = Project::getRequest(); $v_sp_id = $v_request->getKeyByNumber(0); if ((int) $v_sp_id > 0) { $this->_SetVote($v_sp_id, $v_request->inp_criteria_id_1, $v_request->inp_select_1); $this->_SetVote($v_sp_id, $v_request->inp_criteria_id_2, $v_request->inp_select_2); $this->_SetVote($v_sp_id, $v_request->inp_criteria_id_3, $v_request->inp_select_3); // = Запись в таблицу локировки голосования $v_sp_votes_model = new SocialVotesModel(); $v_sp_votes_model->social_pos_id = $v_sp_id; $v_sp_votes_model->user_id = (int) Project::getUser()->getDbUser()->id; $v_sp_votes_model->ip = $_SERVER['REMOTE_ADDR']; $v_sp_votes_model->save(); } Project::getResponse()->redirect($v_request->createUrl('Social', 'SocialView', array($v_sp_id))); }
/** * Обработка файла импорта */ protected function _ImportProcess($p_tmp_file_name) { if (file_exists($p_tmp_file_name)) { $v_fhandle = fopen($p_tmp_file_name, 'r'); // -- Проверка заголовка if ($this->_CheckCaptionFile($v_fhandle) == -1) { fclose($v_fhandle); return 1; // -- Заголовок не верен - файл не закладки } // -- Получение кодировки файла с которой работаем $v_encoding_charset = $this->_GetEncodingFile($v_fhandle); fseek($v_fhandle, 0); while ($str = fgets($v_fhandle)) { if (mb_strpos(mb_strtolower($str), '<a href') !== false) { $v_href = mb_strtolower($str); $v_href = mb_substr($v_href, mb_strpos($v_href, '<a href') + 9); $v_href = trim(mb_substr($v_href, 0, mb_strpos($v_href, '"'))); $v_name = $str; $v_name = mb_substr($v_name, mb_strpos(mb_strtolower($v_name), '<a href') + 10); $v_name = mb_substr($v_name, mb_strpos($v_name, '>') + 1); if (strtolower($v_encoding_charset) == 'utf-8') { $v_name = trim(mb_substr($v_name, 0, mb_strpos($v_name, '<'))); } else { // Win-1251 $v_name = trim(substr($v_name, 0, strpos($v_name, '<'))); $v_name = mb_convert_encoding($v_name, "UTF-8", $v_encoding_charset); } if ($v_name == '') { $v_name = '[Заполнить]'; } // -- INSERT закладок $v_bm_model = new BookmarksModel(); $v_bm_model->user_id = Project::getUser()->getDbUser()->id; // ID залогиненного пользователя $v_bm_model->bookmarks_tree_id = 0; $v_bm_model->url = $v_href; $v_bm_model->title = $v_name; $v_bm_model->description = $v_name; $v_bm_model->is_public = 0; $v_bm_model->creation_date = date("Y-m-d H:i:s"); $v_bm_id = $v_bm_model->save(); } } fclose($v_fhandle); } return 0; }
$avatar = Project::getUser()->getDbUser()->getUserAvatar($user['id']); $avPath = $avatar['path']; if(!$avPath || $avPath == 'no.png') $avPath = 'no25.jpg'; ?> <tr> <td class="qv"><a href="<?=$this->createUrl('Social', 'SocialView', array($item['id']))?>" title="<?=$item['name'];?>"><?=$item['name_cut'];?></a> <?php if($item['id_product']) {?> <?php echo '('.$item['full_name'].')'; ?> <span style="cursor:pointer;cursor:hand;" onclick="Ycoord = <?=$item['Ycoord'];?>; Xcoord = <?=$item['Xcoord'];?>; window.open('http://next24.home/popup.html','map','toolbar=0,width=520,height=350,location=0,menubar=0,resizable=0,status=map'); return false;">посмотреть на карте</span> <?php }?> </td> <td class="av"><a href="<?=$request->createUrl('Index','Index', null, $item['login']);?>" class="avatar-link"><img src="<?=$this->image_url.'avatar/'.$avPath;?>" alt="" style="width:25px;height:25px;" class="avatar" /><span class="t"><?=$item['login']; ?></span></a></td> <td class="an alt-an"><?=number_format($item['avg_rating'], 2, '.',' '); ?></td> <td class="an"><?=$item['count_comments']; ?></td> <td class="date"><?=date_format(new DateTime($item['creation_date']),'d.m.y H:i'); ?></td> <?php if($item['user_id'] == Project::getUser()->getDbUser()->id) { ?> <td> <a href=<?=$this->createUrl('Social','SocialDelete',array($item['id']))?>>[Удалить]</a> </td> <?php } else { ?> <td> - </td> <? } ?> </tr> <? } ?> </tbody> </table> <?php if (count($this->category_row) > 0) { ?> <!-- <b>Позиции категории:</b> <?=$this->category_row[0]['name']; ?> --> <?php if ($this->tag_name_selected !== null) { ?>
function getPost($post_id, $user_id, $request_user_id) { $isFriend = (int) Project::getUser()->isFriend(); $sql = "SELECT " . " blog_post.*, " . " blog.user_id as user_id" . " FROM blog_post " . " INNER JOIN ub_tree ubt ON ubt.id = blog_post.ub_tree_id " . " INNER JOIN blog ON blog.id = ubt.blog_id " . " LEFT JOIN blog_subscribe bs ON bs.user_id=" . (int) $user_id . " AND bs.ub_tree_id=ubt.id " . " WHERE " . " blog_post.id = " . (int) $post_id . " " . " AND ( " . " (blog.user_id = " . (int) $user_id . ") " . " OR (blog_post.access = " . ACCESS::ALL . ") " . " OR (" . $isFriend . " AND blog_post.access=" . ACCESS::FRIEND . ") " . " OR (ubt.id = bs.ub_tree_id AND blog_post.access=" . ACCESS::SUBSCRIBE . ") " . " )"; return Project::getDatabase()->selectRow($sql); }
</ul> </div> <!-- /info-entry --> </div> <div class="profile-info"> <div class="info-title"> <div class="more-act">[ <a href="<?php echo $this -> createUrl('Messages', 'Friend');?>">все друзья</a> ]</div> <i class="arrow-icon up-arrow"></i><strong>В друзьях</strong> <!-- (112) --> </div> <!-- /info-title --> <div class="info-entry"> <ul class="friends-profile-view clearfix"> <? if (is_array($this->in_friend_list_model)) { ?> <?php foreach ($this->in_friend_list_model as $value) { ?> <?php $loop_user = Project::getUser()->getDbUser()->getUserById($value['user_id']); $avatar = Project::getUser()->getDbUser()->getUserAvatar($value['user_id']); $avPath = $avatar['path']; if(!$avPath || $avPath == 'no.png') $avPath = 'no25.jpg'; ?> <li> <span class="av"><a href="<?php echo $this->createUrl('User','Profile',null,$loop_user['login']);?>"><img src="<?=$this->image_url.'avatar/'.$avPath;?>" alt="" style="width:25px;height:25px;" /></a></span> <a href="<?php echo $this->createUrl('User','Profile',null,$loop_user['login']);?>" class="nm"><?=$loop_user['first_name']; ?> <?=$loop_user['last_name']; ?></a> <span class="where"><?=$loop_user['country']?$loop_user['country'].' , ':''; ?><?=$loop_user['city'] ?></span> </li> <?php } ?> <? } ?> </ul> </div> <!-- /info-entry --> </div> <!-- /profile-info -->
<?php include $this->_include('../header.tpl.php'); $user = Project::getUser()->getDbUser()->getUserById($this->current_user->id); ?> <ul class="view-filter clearfix"> <li><a href="<?php echo $this->createUrl('User', 'Profile'); ?> "> <? $name_usr = implode(' ',array($user['last_name'],$user['first_name'],$user['middle_name'])); if(!trim($name_usr)) echo 'Нет имени'; else echo $name_usr;?></a></li> <li><strong>Настройки профиля<span></span></strong></li> </ul> <!-- /view-filter --> <div class="user-profile"> <div class="clearfix"> <dl class="main-info"> <dt><span class="user-status"><span class="online">online</span></span> <strong> <?if(!trim($name_usr)) echo 'Нет имени'; else echo $name_usr;?></strong> / <span class="nick"><?php echo $this->current_user->login; ?> </span> /</dt> <?php $avator_path = $this->user_default_avatar['sys_av_id'] ? $this->user_default_avatar['sys_path'] : $this->user_default_avatar['path']; if (!$avator_path || $avator_path == 'no.png') { $avator_path = $this->image_url . 'avatar/no90.jpg'; } else {
public function GTDAddSecureUserAction() { $model = new GTDModel(); $user_id = Project::getUser()->getDbUser()->id; $v_request = Project::getRequest(); $v_session = Project::getSession(); $request_keys = $v_request->getKeys(); $model->addSecureUser($request_keys['id'], $request_keys['section'], $request_keys['addusr']); switch ($request_keys['section']) { case 1: $this->GTDAction(); break; case 2: $this->GTDViewFoldersAction(); break; case 3: $this->GTDViewFilesAction(); break; } }
</div> </td> <td class="av"><a href="<?php echo $this->createUrl('User', 'Profile', null, $item['login']); ?> " class="avatar-link"><img src="<?php echo $this->image_url . 'avatar/' . $avPath; ?> " style="width:25px;height:25px;" alt="" class="avatar" /><span class="t"><?php echo $item['login']; ?> </span></a></td> <td class="an"><?php echo $item['votes']; ?> </td> <td class="date"><?php echo $item['creation_date']; ?> </td> <td> <? if($this->can_vote && $item['user_id'] != Project::getUser()->getDbUser()->id) { echo "<a href=".$this->createUrl('Article', 'SubjectVote', array($item['id'])).">Голосовать за тему</a></td>"; } else { echo " - "; } ?> </td> </tr> <?endforeach;?> </tbody> </table>
public function SaveSubjectAction() { $request = Project::getRequest(); $article_model = new ArticleModel(); if (count($article_model->loadByParentId(0, array(ARTICLE_COMPETITION_STATUS::NEW_ARTICLE), Project::getUser()->getDbUser()->id)) < 5) { $article_model->title = $request->title; $article_model->articles_tree_id = $request->parent_id; $article_model->user_id = Project::getUser()->getDbUser()->id; $article_model->rate_status = ARTICLE_COMPETITION_STATUS::NEW_ARTICLE; $article_model->creation_date = date("Y-m-d H:i:s"); $article_model->save(); } Project::getResponse()->redirect($request->createUrl('Article', 'CompetitionCatalog')); }
public function SocialUserListAction() { $v_request = Project::getRequest(); $data = array(); $this->_BaseSiteData($data); $data['action'] = 'SocialUserList'; $v_current_userID = (int) Project::getUser()->getDbUser()->id; // Номер выводимой страницы, определяется адресом bookmarks_list/0/1/ ...bookmarks_list/0/0/ // где bookmarks_list/{id_категории}/{номер страницы}/ $v_categoryID = $v_request->getKeyByNumber(0); $v_n_page = $v_request->getKeyByNumber(1); $this->_getData($data, 'SocialUserList', $v_categoryID, $v_n_page, $v_current_userID); $this->_view->Social_UserList($data); $this->_view->parse(); }
</div> <!-- /display-filter --> <table class="stat-table"> <thead> <tr> <th class="main-row">Вопросы</th> <th><a class="script-link" href="<?php echo $this->createUrl('QuestionAnswer', 'ListStat', null, false).((($request->inp_sort=='asc')&&($request->type=='author'))?'/inp_sort:desc/type:author':'/inp_sort:asc/type:author'); ?>"><span class="t">Кто спрашивает</span></a></th> <th><span class="sort-by-this"><a class="script-link" href="<?php echo $this->createUrl('QuestionAnswer', 'ListStat', null, false).((($request->inp_sort=='asc')&&($request->type=='answer'))?'/inp_sort:desc/type:answer':'/inp_sort:asc/type:answer'); ?>"><span class="t">Ответы</span><i class="arrow-icon"></i></a></span></th> <th><a class="script-link" href="<?php echo $this->createUrl('QuestionAnswer', 'ListStat', null, false).((($request->inp_sort=='asc')&&($request->type=='create'))?'/inp_sort:desc/type:create':'/inp_sort:asc/type:create'); ?>"><span class="t">Дата создания</span></a></th> </tr> </thead> <tbody> <?php foreach($this->question_list as $key => $item) { ?> <?php $user = Project::getUser()->getDbUser()->getUserByLogin($item['login']); $avatar = Project::getUser()->getDbUser()->getUserAvatar($user['id']); $avPath = $avatar['path']; if(!$avPath || $avPath == 'no.png') $avPath = 'no25.jpg'; ?> <tr> <td class="qv"> <a href="<?=$this->createUrl('QuestionAnswer', 'ViewQuestion', array($item['id']))?>"><?=$item['q_text']?></a> </td> <td class="av"><a href="<?=$request->createUrl('Index','Index', null, $item['login']);?>" class="avatar-link"><img src="<?=$this->image_url.'avatar/'.$avPath;?>" style="width:25px;height:25px;" alt="" class="avatar" /><span class="t"><?=$item['login'];?></span></a></td> <td class="an"><?=$item['a_count']?></td> <td class="date"><?=date_format(new DateTime($item['creation_date']),'Y.m.d H:i:s')?></td> </tr> <?php } ?> </tbody> </table> <ul class="pages-list clearfix">
public function checkAccessMessagesMod($id_group, $pid_group, $id_topic) { $current_user_id = Project::getUser()->getDbUser()->id; $sql = "SELECT id_user FROM groups WHERE pid=0 AND id={$id_group}"; $user_id = $this->db->selectCell($sql); $sql = "SELECT id_user FROM groups_topics WHERE id={$id_topic}"; $user_topic_id = $this->db->selectCell($sql); if ($current_user_id == $user_id || $current_user_id == $user_topic_id) { return true; } else { $sql = "SELECT mod_subgroup FROM groups_user_access WHERE id_group = {$pid_group} AND id_user = {$id_user}"; $result = $this->db->selectCell($sql); if ($result) { return true; } else { return false; } } }
function LastListAction($info = array()) { $this->BaseSiteData(); $info['tab_list'] = TabController::getMainAlbumTabs(false, true, false); $request_user_id = (int) Project::getUser()->getShowedUser()->id; $user_id = (int) Project::getUser()->getDbUser()->id; $album_id = isset($album_id) && (int) $album_id > 0 ? $album_id : (int) Project::getRequest()->getKeyByNumber(0); $this->BaseAlbumData($info, $album_id); $photo_model = new PhotoModel(); $pager = new DbPager(Project::getRequest()->getValueByNumber(1), $this->getParam('last_photo_per_page', self::DEFAULT_PHOTO_PER_PAGE)); $photo_model->setPager($pager); $list = $photo_model->loadAll($request_user_id, $album_id); $this->checkImages($list); $info['photo_list'] = $list; $info['list_pager'] = $photo_model->getPager(); $info['list_controller'] = 'Photo'; $info['list_action'] = 'Album'; $info['list_user'] = null; $this->_view->LastList($info); $this->_view->parse(); }
protected function BaseAlbumData(&$info, $album_id, $album_list = false) { $request_user_id = (int) Project::getUser()->getShowedUser()->id; $user_id = (int) Project::getUser()->getDbUser()->id; if (Project::getUser()->isMyArea()) { $v = new AlbumView(); $v->ControlPanel(); $info['control_panel'] = $v->parse(); } else { $info['control_panel'] = null; } if ($request_user_id > 0) { // $info['tab_list'] = TabController::getOwnTabs(false, true); $info['tab_list'] = TabController::getOwnTabs(false, false, true); } $tmp = array(); $album_model = new AlbumModel(); $tmp['album_menu_list'] = $album_model->loadByUser($request_user_id, $user_id); $tmp['album_id'] = $album_id; if (Project::getUser()->isMyArea()) { $tmp['album_owner'] = true; } $v = new AlbumView(); $v->AlbumMenu($tmp); $info['album_menu'] = $v->parse(); if ($album_list !== false) { $info[$album_list] = $tmp['album_menu_list']; } }