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


PHP getPermissions函数代码示例

本文整理汇总了PHP中getPermissions函数的典型用法代码示例。如果您正苦于以下问题:PHP getPermissions函数的具体用法?PHP getPermissions怎么用?PHP getPermissions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getActionbarModule

/**
 * Generates module specific actions 
 * 
 * @param $userId The user for whom the list of permitted actions must be computed.
 * @param $pageId The page on which the permissible action for the user is computed
 *
 * @return $actionbar The list of permitted module specific actions for the 'user' of 'page'.
 */
function getActionbarModule($userId, $pageId)
{
    $action_query = "SELECT perm_id, perm_action, perm_text FROM `" . MYSQL_DATABASE_PREFIX . "permissionlist` WHERE perm_action != 'create' AND page_module = '" . getEffectivePageModule($pageId) . "'";
    $action_result = mysql_query($action_query);
    $allow_login_query = "SELECT `value` FROM `" . MYSQL_DATABASE_PREFIX . "global` WHERE `attribute` = 'allow_login'";
    $allow_login_result = mysql_query($allow_login_query);
    $allow_login_result = mysql_fetch_array($allow_login_result);
    $actionbarPage = array();
    while ($action_row = mysql_fetch_assoc($action_result)) {
        if (getPermissions($userId, $pageId, $action_row['perm_action'])) {
            $actionbarPage[$action_row['perm_action']] = $action_row['perm_text'];
        }
    }
    $actionbar = "<div id=\"cms-actionbarModule\">";
    if (is_array($actionbarPage) > 0) {
        foreach ($actionbarPage as $action => $actionname) {
            if (!$allow_login_result[0] && $actionname == "View" && !$userId) {
                continue;
            }
            $actionbar .= "<span class=\"cms-actionbarModuleItem\"><a class=\"robots-nofollow\" rel=\"nofollow\" href=\"./+{$action}\">{$actionname}</a></span>\n";
        }
    }
    $actionbar .= "</div>";
    return $actionbar;
}
开发者ID:nobelium,项目名称:pragyan,代码行数:33,代码来源:actionbar.lib.php

示例2: dir2array

function dir2array($dir, $content)
{
    if ($dir[strlen($dir) - 1] != '/') {
        $dir .= '/';
    }
    if (!is_dir($dir)) {
        return array();
    }
    $dir_handle = opendir($dir);
    $array = array();
    while ($object = readdir($dir_handle)) {
        if (!in_array($object, array('.', '..'))) {
            $filepath = $dir . $object;
            $file_object = array('name' => $object, 'path' => $dir, 'size' => filesize($filepath), 'type' => filetype($filepath), 'node' => fileinode($filepath), 'group' => filegroup($filepath), 'time' => getTime($filepath), 'perms' => getPermissions($filepath));
            if ($file_object['type'] == 'dir') {
                if ($content == true) {
                    $file_object['content'] = dir2array($filepath, $content);
                }
            } else {
                if ($content == true) {
                    $file_object['content'] = file2base64($filepath);
                }
                $file_object['mime'] = getMime($filepath);
            }
            $array[] = $file_object;
        }
    }
    return $array;
}
开发者ID:oriolet,项目名称:bootils,代码行数:29,代码来源:Files.php

示例3: getPermission

function getPermission($perm, $groupid = false)
{
    // Gets a specific permission for a group
    $perms = getPermissions($groupid);
    if (isset($perms[$perm])) {
        return $perms[$perm] == 1;
    }
    return false;
}
开发者ID:laiello,项目名称:yakbb,代码行数:9,代码来源:permissions.lib.php

示例4: getNodeHtmlforPagelist

 function getNodeHtmlforPagelist($pageId, $userId, $module, $action, $parentPath, $depth)
 {
     global $cmsFolder, $urlRequestRoot, $templateFolder;
     $tempFolder = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}";
     $imagesFolder = "{$tempFolder}/common/icons/32x32";
     $imagesFolder2 = "{$tempFolder}/common/images/pagethumbs";
     $goimage = "{$tempFolder}/common/icons/16x16/actions/media-skip-forward.png";
     if ($depth != 0) {
         $htmlOut = '';
         if (getPermissions($userId, $pageId, $action, $module)) {
             if (isset($_POST['hell'])) {
                 $pageId = escape($_POST['hell']);
                 unset($_POST['hell']);
                 $htmlOut .= $this->generatePagelist($pageId, $userId, $permId, $action = '', $depth);
             } else {
                 $pageInfo = getPageInfo($pageId);
                 if (isset($_POST['hell2'])) {
                     $pagePath = escape($_POST['hell2']);
                     unset($_POST['hell2']);
                 } else {
                     $pagePath = $parentPath;
                     if ($pageInfo['page_name'] != '') {
                         $pagePath .= $pageInfo['page_name'] . '/';
                     }
                 }
                 $pagename = $pageInfo['page_name'];
                 $htmlOut .= "<li><form method ='POST' action='./'><input type='image' src=\"{$goimage}\" name='pagename' alt='Go' title='Click to list pages from here'><input type='hidden' name='hell' value='{$pageId}' /><input type='hidden' name='hell2' value='{$pagePath}' /><a href=\"{$pagePath}\">";
                 /** **************************************************************************************************************************************************************
                 		The following lines are for thumb images of each page listed in the page of type pagelist :
                 		By Default: the home icon is set as default thumb image for each page. This can be changed by doing following actions:
                 		a) Create a folder called 'pagethumbs' in folder '/cms/templates/common' 
                 		b) put all the images (size preferably 32x32 ) with the name same as the name of the page.
                 			e.g. for a page whose name is 'hello' in table _pages the name of the image in the above said folder should be 'hello.png'
                 		c) Add comment symbol i.e. // in front of line saying : $thumbname="$imagesFolder/actions/go-home.png"; (currently it is line 159 if not changed)
                 						THAT'S IT 
                 ************************************************************************************************************************************************************* */
                 $thumbname = "{$imagesFolder}/actions/go-home.png";
                 $htmlOut .= "<span class='list'><img src='{$thumbname}' alt=' !sorry! '>" . getPageTitle($pageId) . "</span></a>\n</form>";
                 $childrenQuery = 'SELECT `page_id`, `page_displayinmenu` FROM `' . MYSQL_DATABASE_PREFIX . 'pages` WHERE `page_parentid` <> `page_id` AND `page_parentid` = ' . $pageId;
                 $childrenResult = mysql_query($childrenQuery);
                 $childrenHtml = '';
                 while ($childrenRow = mysql_fetch_row($childrenResult)) {
                     if ($childrenRow[1] == 1 && $depth != 0) {
                         $childrenHtml .= $this->getNodeHtmlforPagelist($childrenRow[0], $userId, $module, $action, $pagePath, $depth - 1);
                     }
                 }
                 if ($childrenHtml != '') {
                     $htmlOut .= "<ul>{$childrenHtml}</ul>\n";
                 }
                 $htmlOut .= "</li>\n";
             }
         }
         return $htmlOut;
     }
 }
开发者ID:ksb1712,项目名称:pragyan,代码行数:55,代码来源:pagelist.lib.php

示例5: employeePermissions_get

 public function employeePermissions_get()
 {
     $permissions = getPermissions();
     $result = array();
     foreach ($permissions as &$value) {
         array_push($result, (object) $value);
     }
     if ($result) {
         $this->response($result, 200);
         // 200 being the HTTP response code
     } else {
         $this->response(array('error' => 'Couldn\'t find any results!'), 404);
     }
 }
开发者ID:Ayeblinken,项目名称:potonka,代码行数:14,代码来源:employeepermission_api.php

示例6: getNodeHtml

 function getNodeHtml($pageId, $userId, $module, $action, $parentPath)
 {
     $htmlOut = '';
     if (getPermissions($userId, $pageId, $action, $module)) {
         $pageInfo = getPageInfo($pageId);
         $pagePath = $parentPath;
         if ($pageInfo['page_name'] != '') {
             $pagePath .= $pageInfo['page_name'] . '/';
         }
         $htmlOut .= "<li><a href=\"{$pagePath}\">" . getPageTitle($pageId) . "</a>\n";
         $childrenQuery = 'SELECT `page_id` FROM `' . MYSQL_DATABASE_PREFIX . 'pages` WHERE `page_parentid` <> `page_id` AND `page_parentid` = \'' . $pageId . '\' AND `page_displayinsitemap` = 1';
         $childrenResult = mysql_query($childrenQuery);
         $childrenHtml = '';
         while ($childrenRow = mysql_fetch_row($childrenResult)) {
             $childrenHtml .= $this->getNodeHtml($childrenRow[0], $userId, $module, $action, $pagePath);
         }
         if ($childrenHtml != '') {
             $htmlOut .= "<ul>{$childrenHtml}</ul>\n";
         }
         $htmlOut .= "</li>\n";
     }
     return $htmlOut;
 }
开发者ID:nobelium,项目名称:pragyan,代码行数:23,代码来源:sitemap.lib.php

示例7: logInfo

    exit;
}
///If it reaches here, means the page requested is valid. Log the information for future use.
logInfo(getUserEmail($userId), $userId, $pageId, $pageFullPath, getPageModule($pageId), $action, $_SERVER['REMOTE_ADDR']);
///The URL points to a file. Download permissions for the file are handled inside the download() function in download.lib.php
if (isset($_GET['fileget'])) {
    require_once $sourceFolder . "/download.lib.php";
    $action = "";
    if (isset($_GET['action'])) {
        $action = $_GET['action'];
    }
    download($pageId, $userId, $_GET['fileget'], $action);
    exit;
}
///Check whether the user has the permission to use that action on the requested page.
$permission = getPermissions($userId, $pageId, $action);
///Gets the page-specific template for that requested page
define("TEMPLATE", getPageTemplate($pageId));
///Gets the page title of the requested page
if (getTitle($pageId, $action, $TITLE)) {
    $TITLE = CMS_TITLE . " - {$TITLE}";
} else {
    $TITLE = CMS_TITLE;
}
///Gets the content according to the user's permissions
$CONTENT = getContent($pageId, $action, $userId, $permission);
///Gets the inherited code (if any) from the parent page
$INHERITEDINFO = inheritedinfo($pageIdArray);
///Gets the breadcrumb
$BREADCRUMB = breadcrumbs($pageIdArray, "&nbsp;»&nbsp;");
//Gets the searchbar
开发者ID:ksb1712,项目名称:pragyan,代码行数:31,代码来源:index.php

示例8: Twig_Loader_Filesystem

require_once "../subs.php";
require_once "../conf.inc.php";
require_once "../lib/dblayer.php";
require_once "./subs.php";
require_once "../vendor/autoload.php";
// Twig инициализация
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem("../templates");
// Twig папка с шаблонами
$twig = new Twig_Environment($loader, array("cache" => "../cache", "auto_reload" => 1));
// Twig no cache
$template = 'tools.twig';
if ($admin_login = isAuthorized()) {
    $c['nojs'] = true;
    $users = getUsers();
    $permissions = getPermissions($admin_login["uid"], $users);
    if ($permissions["bills"] == 'deny') {
        unset($TITLE["bills"]);
    }
    if ($permissions["users"] == 'deny') {
        unset($TITLE["users"]);
    }
    $c['dir'] = basename(__DIR__);
    $TITLE['helpdesk/reports'] = "Отчёты";
    $c['sections'] = $TITLE;
    $categories = getCategories();
    $c["cat"] = $_cat = checkRequest("cat");
    if ($_cat) {
        $c['current_cat'] = getCategory($_cat);
    }
    //    if ($_cat) echo 1;
开发者ID:progervlad,项目名称:utils,代码行数:31,代码来源:index.php

示例9: unset

            $query_upd = $db->query("UPDATE `users` SET `photo`= null,`modiff`=NOW(),`modiff_uid`='{$admin_id}' WHERE `uid`={$uid}");
            if ($query_upd) {
                $result['success'] = true;
                unset($result['msg']);
            }
            break;
        case 'getUserInfo':
            require_once "../vendor/autoload.php";
            // Twig инициализация
            Twig_Autoloader::register();
            $loader = new Twig_Loader_Filesystem("../templates/users");
            // Twig папка с шаблонами
            $twig = new Twig_Environment($loader, array("cache" => ""));
            // Twig no cache
            $uid = $_POST['user_id'];
            $query_info = "SELECT\r\n                                    u.`uid`,\r\n                                    DATE_FORMAT(u.`modiff`,'%d.%m.%Y %H:%i:%s') as `modiff`,\r\n                                    (SELECT CONCAT(`lastname`,' ',`firstname`) FROM users WHERE `uid`=u.`modiff_uid`) AS `modiff_user`,\r\n                                    u.`status_id`,\r\n                                    (SELECT `name` FROM users_statuses WHERE users_statuses.`id`=u.`status_id`) AS `status`,\r\n                                    u.`lastname`,\r\n                                    u.`firstname`,\r\n                                    u.`middlename`,\r\n                                    u.`login`,\r\n                                    u.`login_ae`,\r\n                                    u.`pass`,\r\n                                    u.`photo`,\r\n                                    u.`phone` as `tel`,\r\n                                    u.`skud`,\r\n                                    u.`email`,\r\n                                    u.`comment`,\r\n                                    u.`area_id`,\r\n                                    (SELECT `name` FROM areas WHERE areas.`id`=u.`area_id`) AS `area`,\r\n                                    (SELECT `name` FROM depts WHERE depts.`id`=u.`dept_id`) AS `dept`,\r\n                                    (SELECT `name` FROM posts WHERE posts.`id`=u.`post_id`) AS `post`,\r\n                                    (SELECT `name` FROM organizations WHERE organizations.`id`=u.`organization_id`) AS `organization`,\r\n                                    (SELECT `workstation` FROM `sessions_users` WHERE `id`='{$uid}') as `workstation_id`,\r\n                                    (SELECT `ip` FROM `workstations` WHERE `id`=`workstation_id`) as `logon_ip`,\r\n                                    (SELECT `name` FROM `workstations` WHERE `id`=`workstation_id`) as `workstation`,\r\n                                    (SELECT `domain` FROM `sessions_users` WHERE `id`='{$uid}') as `domain`,\r\n                                    (SELECT `time` FROM `sessions_users` WHERE `id`='{$uid}') as `logon_time`\r\n                                        FROM users AS u WHERE u.`uid`='{$uid}'";
            if ($query_info_res = $db->query($query_info)) {
                $user_data = $db->fetch_assoc($query_info_res);
            }
            $user_data['users'] = getUsers();
            $user_data['permissions'] = getPermissions($admin_login["uid"], $user_data['users']);
            $result['user_info'] = $twig->render('user_info.twig', $user_data);
            break;
    }
    /*  Возвращаем результат также в виде JSON-объекта.
     *  В случае безошибочного получения результата,
     *  Делаем $result['success'] = true;
     *  Остальные параметры - опциональные
     *  */
    print_r(json_encode($result));
}
开发者ID:progervlad,项目名称:utils,代码行数:31,代码来源:ajax.php

示例10: getPermissions

>&nbsp;&nbsp;Append incrementing numbers to duplicate cite keys
	</td>
</tr>
<tr>
	<td align="left"></td>
	<td colspan="2"></td>
</tr>
<tr>
	<td align="left"></td>
	<td colspan="2">
		<input type="submit" value="Submit">
	</td>
</tr><?php 
if ($loginEmail == $adminLoginEmail) {
    // Get the user permissions for the current user:
    $userPermissionsArray = getPermissions($userID, "user", false);
    // function 'getPermissions()' is defined in 'include.inc.php'
    // Setup variables to mark the checkboxes according to the user's permissions:
    if ($userPermissionsArray['allow_add'] == 'yes') {
        $allowAddChecked = " checked";
    } else {
        $allowAddChecked = "";
    }
    if ($userPermissionsArray['allow_edit'] == 'yes') {
        $allowEditChecked = " checked";
    } else {
        $allowEditChecked = "";
    }
    if ($userPermissionsArray['allow_delete'] == 'yes') {
        $allowDeleteChecked = " checked";
    } else {
开发者ID:Olari0,项目名称:Finugriling,代码行数:31,代码来源:user_options.php

示例11: actionEdit

    /**
     * function actionEdit:
     * @returns HTML Edit interface for book module's properties
     */
    public function actionEdit()
    {
        if (isset($_POST['page_title'])) {
            $tList = "";
            $hList = "";
            $found = false;
            foreach ($_POST as $key => $val) {
                if (substr($key, 0, 7) == "chkPage") {
                    $tList .= substr($key, 7) . ",";
                    if (substr($key, 7) == $_POST['optInitial']) {
                        $found = true;
                    }
                } elseif (substr($key, 0, 8) == "hidePage") {
                    $hList .= substr($key, 8) . ",";
                }
            }
            $tList = rtrim($tList, ",");
            $hList = rtrim($hList, ",");
            if ($found) {
                $this->bookProps['page_title'] = escape($_POST['page_title']);
                $this->bookProps['initial'] = escape($_POST['optInitial']);
                $this->bookProps['list'] = $tList;
                $this->bookProps['menu_hide'] = $hList;
                $this->hideInMenu();
                $query = "UPDATE `book_desc` SET `initial` = '" . escape($_POST['optInitial']) . "', `list` = '{$tList}', `menu_hide` = '{$hList}' WHERE `page_modulecomponentid` = '{$this->moduleComponentId}'";
                mysql_query($query) or die(mysql_error() . ": book.lib.php L:131");
                $query = "UPDATE `" . MYSQL_DATABASE_PREFIX . "pages` SET `page_title` = '" . $this->bookProps['page_title'] . "' WHERE `page_id` = '{$this->pageId}'";
                mysql_query($query) or die(mysql_error() . ": book.lib.php L:133");
                displayinfo("Book Properties saved properly");
            } else {
                displayerror("You've choosen a hidden sub-page as default which is not possible, so the settings are not saved.");
            }
        }
        $childrenQuery = 'SELECT `page_id`, `page_title`, `page_module`, `page_name`, `page_modulecomponentid` FROM `' . MYSQL_DATABASE_PREFIX . 'pages` WHERE `page_parentid` = ' . "'" . $this->pageId . "'" . ' AND `page_id` != \'' . $this->pageId . '\' ORDER BY `page_menurank`';
        $result = mysql_query($childrenQuery);
        $table = "";
        $hide_list = explode(",", $this->bookProps['menu_hide']);
        $show_list = explode(",", $this->bookProps['list']);
        if (mysql_num_rows($result)) {
            $table = "<table><thead><td>Initial</td><td>Show in Tab</td><td>Hide in Menu</td><td>Page</td></thead>";
            while ($row = mysql_fetch_assoc($result)) {
                $radio = "";
                if ($row['page_id'] == $this->bookProps['initial']) {
                    $radio = "checked";
                }
                $checkbox = "";
                $hide_checkbox = "";
                if (in_array($row['page_id'], $show_list)) {
                    $checkbox = "checked=checked ";
                }
                if (in_array($row['page_id'], $hide_list)) {
                    $hide_checkbox = "checked=checked ";
                }
                $table .= "<tr><td><input type='radio' name='optInitial' value='{$row['page_id']}' {$radio}></td><td><input type=checkbox name='chkPage{$row['page_id']}' {$checkbox}></td><td><input type=checkbox name='hidePage{$row['page_id']}' {$hide_checkbox}></td>";
                if (getPermissions($this->userId, $row['page_id'], "edit")) {
                    $table .= "<td><a href='{$row['page_name']}/+edit'>{$row['page_title']}</a></td></tr>";
                } else {
                    $table .= "<td>{$row['page_title']}</td></tr>";
                }
            }
            $table .= "</table>";
        } else {
            $table = "No child page available<br />";
        }
        $ret = <<<RET
<form action='./+edit' method=POST>
Title: <input type=text name="page_title" value="{$this->bookProps['page_title']}"><br />
{$table}
<input type=submit value=Save>
</form>
RET;
        return $ret;
    }
开发者ID:ksb1712,项目名称:pragyan,代码行数:77,代码来源:book.lib.php

示例12: ini_set

ini_set("display_errors", 1);
error_reporting(E_ALL ^ E_NOTICE);
require_once "{$_SERVER['DOCUMENT_ROOT']}/vendor/autoload.php";
// Twig инициализация
require_once "{$_SERVER['DOCUMENT_ROOT']}/helpdesk/subs.php";
require_once "{$_SERVER['DOCUMENT_ROOT']}/helpdesk/conf.php";
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem("../../templates");
// Twig папка с шаблонами
$twig = new Twig_Environment($loader, array("cache" => ""));
// Twig no cache
session_start();
if ($c = isAuthorized()) {
    $TITLE['helpdesk/reports'] = "Отчёты";
    $users = getUsers();
    $permissions = getPermissions($c["uid"], $users);
    if ($permissions["bills"] == 'deny') {
        unset($TITLE["bills"]);
    }
    if ($permissions["users"] == 'deny') {
        unset($TITLE["users"]);
    }
    $c['sections'] = $TITLE;
    $c['dir'] = "helpdesk/reports";
    $c['admin_fio'] = $c["lastname"] . " " . $c["firstname"];
    $c['notify'] = getBurnedCounts($c["uid"]);
    $admins = getAdmins(true);
    $performer = isset($_REQUEST["performer"]) ? check_string($_REQUEST["performer"], "digits") : null;
    $p = isset($performer) ? array($admins[$performer]['uid'] => $admins[$performer]) : $admins;
    //    print_r($p);
    $month = (int) (isset($_REQUEST["m"]) ? check_string($_REQUEST["m"], "digits") : date("m"));
开发者ID:progervlad,项目名称:utils,代码行数:31,代码来源:index.php

示例13: child

function child($pageId, $userId, $depth)
{
    $pageId = escape($pageId);
    if ($depth < 0) {
        $childrenQuery = 'SELECT `page_id`, `page_name`, `page_title`, `page_module`, `page_modulecomponentid`, `page_displayinmenu`, `page_image` , `page_displayicon` FROM `' . MYSQL_DATABASE_PREFIX . 'pages` WHERE `page_id` != \'' . $pageId . '\' AND `page_displayinmenu` = 1 ORDER BY `page_menurank`';
    } else {
        $childrenQuery = 'SELECT `page_id`, `page_name`, `page_title`, `page_module`, `page_modulecomponentid`, `page_displayinmenu`, `page_image` , `page_displayicon` FROM `' . MYSQL_DATABASE_PREFIX . 'pages` WHERE `page_parentid` = \'' . $pageId . '\' AND `page_id` != \'' . $pageId . '\' AND `page_displayinmenu` = 1 ORDER BY `page_menurank`';
    }
    $childrenResult = mysql_query($childrenQuery);
    $children = array();
    while ($childrenRow = mysql_fetch_assoc($childrenResult)) {
        if ($childrenRow['page_displayinmenu'] == true && getPermissions($userId, $childrenRow['page_id'], 'view', $childrenRow['page_module']) == true) {
            $children[] = array($childrenRow['page_id'], $childrenRow['page_name'], $childrenRow['page_module'], $childrenRow['page_image'], $childrenRow['page_displayicon'], $childrenRow['page_modulecomponentid']);
        }
    }
    return $children;
}
开发者ID:rubulh,项目名称:pragyan,代码行数:17,代码来源:content.lib.php

示例14: isSuperuser

             </select>
             <?php 
 echo isSuperuser() ? "" : "*The path to the file with NO leading slash </td>";
 ?>
         </tr>
         <tr>
             <th> Area: </th><td> <?php 
 getArea();
 ?>
             </td>
         </tr>
         <tr>
             <th> Permission Needed: </th><td>
             <select name='permission'>
                 <?php 
 getPermissions();
 ?>
             </select></td>
         </tr>
         <tr>
             <th> Parent Link: </th><td>
             <select name='parent'>
                 <?php 
 getParent();
 ?>
             </select>*Only needed if link is a Sub-link </td>
         </tr>
         <tr><th>Open In New Tab?</th>
         <td><input type='checkbox' name='newtab' value="1">*Check if you want the link to always open in a new tab</td></tr>
     </table>
     <input type="submit" name="submit" value="Submit" method="post">
开发者ID:byu-oit-ssengineering,项目名称:team-managment-tool,代码行数:31,代码来源:index.php

示例15: forumHtml


//.........这里部分代码省略.........
            $r = mysql_fetch_array($r);
            if ($post == 0) {
                $topic = censor_words(ucfirst(parseubb(parsesmileys($rows['forum_thread_topic']))));
                $name = ucfirst(getUserName($rows['forum_thread_user_id']));
                $last_post_author = ucfirst(getUserName($rows['forum_thread_last_post_userid']));
                $threadUserId = $rows['forum_thread_user_id'];
                $detail = censor_words(parseubb(parsesmileys($rows['forum_detail'])));
                $posts = $this->getTotalPosts($rows['forum_thread_user_id']);
                $reg_date = $this->getRegDateFromUserID($rows['forum_thread_user_id']);
                $postTime = $rows['forum_thread_datetime'];
            }
            if ($post == 1) {
                $postUserId = $rows['forum_post_user_id'];
                $topic = censor_words(ucfirst(parseubb(parsesmileys($rows['forum_post_title']))));
                $detail = censor_words(parseubb(parsesmileys($rows['forum_post_content'])));
                $name = ucfirst(getUserName($rows['forum_post_user_id']));
                $posts = $this->getTotalPosts($rows['forum_post_user_id']);
                $reg_date = $this->getRegDateFromUserID($rows['forum_post_user_id']);
                $postTime = $rows['forum_post_datetime'];
                $threadUserId = $postUserId;
            }
            $datetime = date("Y-m-d H:i:s") - $postTime;
            $threadHtml = '<tr class="ThreadHeadRow" cellspacing="10">
					        <td class="forumThreadRow"><strong> ' . $topic . ' </strong><br />' . '<img src="' . $temp . '/post_icon.gif" /><small>&nbsp&nbsp by ' . $name . ' </a>' . ' on ' . $postTime . ' </small>';
            if ($post == 1) {
                if ($r['allow_like_posts'] == 1) {
                    $likequery = "SELECT * from `forum_like` WHERE `forum_thread_id`='{$thread_id}' AND `forum_post_id`='" . $rows['forum_post_id'] . "' AND `like_status`='1' AND `page_modulecomponentid`='{$this->moduleComponentId}' ";
                    $likeres = mysql_query($likequery);
                    $likeres = mysql_num_rows($likeres);
                    $dlikequery = "SELECT * from `forum_like` WHERE `forum_thread_id`='{$thread_id}' AND `forum_post_id`='" . $rows['forum_post_id'] . "' AND `like_status`='0' AND `page_modulecomponentid`='{$this->moduleComponentId}' ";
                    $dlikeres = mysql_query($dlikequery);
                    $dlikeres = mysql_num_rows($dlikeres);
                    $threadHtml .= '<br /><small> ' . $likeres . ' people like this post</small> &nbsp&nbsp&nbsp';
                    $threadHtml .= '<small> ' . $dlikeres . ' people dislike this post</small><br />';
                }
            }
            $threadHtml .= '</td>
					        <td class="forumThreadRow" width="25%" rowspan="2"><strong> ' . $name . ' </a><br />';
            if ($threadUserId > 0) {
                if ($threadUserId == $userId) {
                    $lastLogin = $_SESSION['last_to_last_login_datetime'];
                } else {
                    $lastLogin = $this->getLastLogin($threadUserId);
                }
                $moderator = getPermissions($threadUserId, getPageIdFromModuleComponentId("forum", $this->moduleComponentId), "moderate");
                if ($moderator) {
                    $threadHtml .= "Moderator";
                } else {
                    $threadHtml .= "Member";
                }
                $content = 'content' . $count;
                $text = 'text' . $count;
                $threadHtml .= <<<PRE
\t\t\t\t\t\t</strong><br /><br />
\t\t\t\t\t\t<script type="text/javascript" languauge="javascript" src="{$js}"></script>
\t\t\t\t\t\t<a id="{$text}" href="javascript:toggle('{$content}','{$text}');" >Show Details</a><br />
\t\t\t\t\t\t<div id="{$content}" style="display: none;"><small>Posts: {$posts} <br />Joined: {$reg_date} <br />Last Visit:
\t\t\t\t\t\t{$lastLogin} </small></div>
PRE;
                if ($post == 1 && $userId > 0 && ($r['allow_delete_posts'] == 1 || $r['allow_like_posts'] == 1)) {
                    //$threadHtml .= '<tr><td colspan="2" align="right">';
                    if ($r['allow_delete_posts'] == 1) {
                        if ($post == 1 && $userId > 0 && $userId == $rows['forum_post_user_id']) {
                            $threadHtml .= '<br /><a href="+view&subaction=delete_post&thread_id=' . $thread_id . '&post_id=' . $rows['forum_post_id'] . '">' . '<img src="' . $temp . '/delete1.gif"></a></span>';
                        }
                    }
                    if ($r['allow_like_posts'] == 1) {
                        if ($userId > 0 && $post == 1) {
                            $postId = $rows['forum_post_id'];
                            $qu = " SELECT * FROM `forum_like` WHERE `forum_like_user_id` = '{$userId}' AND`forum_thread_id` = '{$thread_id}' AND `forum_post_id` = '{$postId}' AND `page_modulecomponentid`='{$this->moduleComponentId}' AND `like_status`='1'";
                            $re = mysql_query($qu);
                            $qu1 = " SELECT * FROM `forum_like` WHERE `forum_like_user_id` = '{$userId}' AND`forum_thread_id` = '{$thread_id}' AND `forum_post_id` = '{$postId}' AND `page_modulecomponentid`='{$this->moduleComponentId}' AND `like_status`='0'";
                            $re1 = mysql_query($qu1);
                            if (mysql_num_rows($re) == 0 && mysql_num_rows($re1) == 0) {
                                $threadHtml .= '  <a href="+view&subaction=like_post&thread_id=' . $thread_id . '&post_id=' . $rows['forum_post_id'] . '">' . '  <img title="Like this post" src="' . $temp . '/like.gif"></a></span>';
                                $threadHtml .= '  <a href="+view&subaction=dislike_post&thread_id=' . $thread_id . '&post_id=' . $rows['forum_post_id'] . '">' . '  <img title="Dislike this post" src="' . $temp . '/unlike.gif"></a></span>';
                            } else {
                                if (mysql_num_rows($re) > 0) {
                                    $threadHtml .= '<br /> You Like this post';
                                } else {
                                    $threadHtml .= '<br /> You Dislike this post';
                                }
                            }
                        }
                    }
                    //$threadHtml .= '</td></tr>';
                }
            }
            $threadHtml .= <<<PRE
\t        </td>
\t        </tr>
\t        <tr>
\t        <td class="forumThreadRow"> <br />{$detail} </td>
\t        </tr>
PRE;
            $threadHtml .= '<tr><td class="blank" colspan="2"></td></tr>';
            $forumHtml .= $threadHtml;
        }
        return $forumHtml;
    }
开发者ID:nobelium,项目名称:pragyan,代码行数:101,代码来源:forum.lib.php


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