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


PHP logged_user函数代码示例

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


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

示例1: closeAutoCheckedoutFilesByUser

 /**
  * Return all project files that were automatically checked out (on edit) by the user
  *
  * @param User $user 
  * @return array
  */
 static function closeAutoCheckedoutFilesByUser($user = null)
 {
     if (!$user) {
         $user = logged_user();
     }
     try {
         $condstr = 'checked_out_by_id = ' . $user->getId() . ' AND was_auto_checked_out = 1 AND checked_out_on <> \'' . EMPTY_DATETIME . '\'';
         $files = self::findAll(array('conditions' => $condstr));
         // findAll
         if ($files) {
             foreach ($files as $file) {
                 $file->setWasAutoCheckedAuto($autoCheckOut);
                 $file->setCheckedOutById(0);
                 $file->setCheckedOutOn(EMPTY_DATETIME);
                 $file->setMarkTimestamps(false);
                 $file->save();
             }
             return true;
         }
         return false;
     } catch (Exception $exc) {
         flash_error(lang('error checkin file'));
         return false;
     }
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:31,代码来源:ProjectFiles.class.php

示例2: loadPanels

 private function loadPanels($options)
 {
     if (!$this->panels) {
         $contact_pg_ids = ContactPermissionGroups::getPermissionGroupIdsByContactCSV(logged_user()->getId(), false);
         $this->panels = array();
         $sql = "\r\n\t\t\t\tSELECT * FROM " . TABLE_PREFIX . "tab_panels \r\n\t\t\t\tWHERE \r\n\t\t\t\t\tenabled = 1 AND\t\t\t\t\t\r\n\t\t\t\t\t( \t\r\n\t\t\t\t\t\tplugin_id IS NULL OR plugin_id=0 OR\r\n\t\t\t\t\t\tplugin_id IN (SELECT id FROM " . TABLE_PREFIX . "plugins WHERE is_installed = 1 AND is_activated = 1) \r\n\t\t\t\t\t)\r\n\t\t\t\t\tAND id IN (SELECT tab_panel_id FROM " . TABLE_PREFIX . "tab_panel_permissions WHERE permission_group_id IN ({$contact_pg_ids}))\r\n\t\t\t\tORDER BY ordering ASC ";
         $res = DB::execute($sql);
         while ($row = $res->fetchRow()) {
             $object = array("title" => lang($row['title']), "id" => $row['id'], "quickAddTitle" => lang($row['default_controller']), "refreshOnWorkspaceChange" => (bool) $row['refresh_on_context_change'], "defaultController" => $row['default_controller'], "defaultContent" => array("type" => "url", "data" => get_url($row['default_controller'], $row['default_action'])), "enabled" => $row['enabled'], "type" => $row['type'], "tabTip" => lang($row['title']));
             if (config_option('show_tab_icons')) {
                 $object["iconCls"] = $row['icon_cls'];
             }
             if ($row['initial_controller'] && $row['initial_action']) {
                 $object["initialContent"] = array("type" => "url", "data" => get_url($row['initial_controller'], $row['initial_action']));
             }
             if ($row['id'] == 'more-panel' && config_option('getting_started_step') >= 99) {
                 $object['closable'] = true;
                 if (!user_config_option('settings_closed')) {
                     $this->panels[] = $object;
                 }
             } else {
                 $this->panels[] = $object;
             }
         }
     }
     return $this->panels;
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:27,代码来源:PanelController.class.php

示例3: addPermissions

 /**
  * Add permissions for a contact on members
  * @param array $members_id  Array with the ids of members
  * @param array $rol_permissions Array with the permissions for the user type of the contact
  * @return null
  */
 function addPermissions($members_id, $rol_permissions)
 {
     //permissions
     $permissions = "";
     foreach ($rol_permissions as $permission) {
         if ($permissions != "") {
             $permissions .= ',';
         }
         $permissions .= '{"pg":"' . $this->getId() . '","o":' . $permission['object_type_id'] . ',"d":' . $permission['can_delete'] . ',"w":' . $permission['can_write'] . ',"r":1}';
     }
     $permissions = "[" . $permissions . "]";
     //members
     $members = array();
     foreach ($members_id as $member_id) {
         $mem = Members::findById($member_id);
         if (!$mem instanceof Member) {
             continue;
         }
         $members[] = $mem;
     }
     //save permissions
     foreach ($members as $member) {
         save_member_permissions_background(logged_user(), $member, $permissions);
     }
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:31,代码来源:PermissionGroup.class.php

示例4: tickets_dashboard_content

function tickets_dashboard_content($context)
{
    $tickets = ProjectTickets::getOpenTicketsByUser(logged_user());
    $context->assign('ticketsheader', lang('open tickets'));
    $context->assign('tickets', $tickets);
    $context->includeTemplate(get_template_path('dashboard', 'tickets'));
}
开发者ID:bahmany,项目名称:PythonPurePaperless,代码行数:7,代码来源:init.php

示例5: getWebpages

 function getWebpages($project, $tag = '', $page = 1, $webpages_per_page = 10, $orderBy = 'title', $orderDir = 'ASC', $archived = false)
 {
     $orderDir = strtoupper($orderDir);
     if ($orderDir != "ASC" && $orderDir != "DESC") {
         $orderDir = "ASC";
     }
     if ($page < 0) {
         $page = 1;
     }
     //$conditions = logged_user()->isMemberOfOwnerCompany() ? '' : ' `is_private` = 0';
     if ($tag == '' || $tag == null) {
         $tagstr = "1=1";
     } else {
         $tagstr = "(SELECT count(*) FROM `" . TABLE_PREFIX . "tags` WHERE `" . TABLE_PREFIX . "project_webpages`.`id` = `" . TABLE_PREFIX . "tags`.`rel_object_id` AND `" . TABLE_PREFIX . "tags`.`tag` = " . DB::escape($tag) . " AND `" . TABLE_PREFIX . "tags`.`rel_object_manager` = 'ProjectWebpages' ) > 0 ";
     }
     $permission_str = ' AND (' . permissions_sql_for_listings(ProjectWebpages::instance(), ACCESS_LEVEL_READ, logged_user()) . ')';
     if ($project instanceof Project) {
         $pids = $project->getAllSubWorkspacesCSV(true);
         $project_str = " AND " . self::getWorkspaceString($pids);
     } else {
         $project_str = "";
     }
     if ($archived) {
         $archived_cond = " AND `archived_by_id` <> 0";
     } else {
         $archived_cond = " AND `archived_by_id` = 0";
     }
     $conditions = $tagstr . $permission_str . $project_str . $archived_cond;
     return ProjectWebpages::paginate(array("conditions" => $conditions, 'order' => DB::escapeField($orderBy) . " {$orderDir}"), config_option('files_per_page', 10), $page);
     // paginate
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:31,代码来源:ProjectWebpages.class.php

示例6: createLog

 /**
  * Create new log entry and return it
  *
  * Delete actions are automatically marked as silent if $is_silent value is not provided (not NULL)
  *
  * @param ApplicationDataObject $object
  * @param Project $project
  * @param DataManager $manager
  * @param boolean $save Save log object before you save it
  * @return ApplicationReadLog
  */
 static function createLog(ApplicationDataObject $object, $workspaces, $action = null, $save = true, $log_data = '')
 {
     if (is_null($action)) {
         $action = self::ACTION_READ;
     }
     // if
     if (!self::isValidAction($action)) {
         throw new Error("'{$action}' is not valid log action");
     }
     // if
     try {
         Notifier::notifyAction($object, $action, $log_data);
     } catch (Exception $ex) {
     }
     $manager = $object->manager();
     if (!$manager instanceof DataManager) {
         throw new Error('Invalid object manager');
     }
     // if
     $log = new ApplicationReadLog();
     if (logged_user() instanceof Contact) {
         $log->setTakenById(logged_user()->getId());
     } else {
         $log->setTakenById(0);
     }
     $log->setRelObjectId($object->getObjectId());
     $log->setAction($action);
     if ($save) {
         $log->save();
     }
     // if
     return $log;
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:44,代码来源:ApplicationReadLogs.class.php

示例7: login_check

function login_check()
{
    global $options;
    if ($options['login']) {
        function logged_user($ul)
        {
            foreach ($ul as $user => $pass) {
                if ($_SERVER['PHP_AUTH_USER'] == $user && isset($_SERVER['PHP_AUTH_PW']) && $_SERVER['PHP_AUTH_PW'] == $pass) {
                    return true;
                }
            }
            return false;
        }
        if (empty($_SERVER['PHP_AUTH_USER']) && (!empty($_SERVER['HTTP_AUTHORIZATION']) || !empty($_SERVER['REDIRECT_HTTP_AUTHORIZATION']))) {
            $auth = !empty($_SERVER['HTTP_AUTHORIZATION']) ? $_SERVER['HTTP_AUTHORIZATION'] : $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
            if (stripos($auth, 'Basic ') === 0 && strpos($auth = base64_decode(substr($auth, 6)), ':') > 0) {
                list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', $auth, 2);
            }
            unset($auth);
        }
        if (empty($_SERVER['PHP_AUTH_USER']) || !logged_user($options['users'])) {
            header('WWW-Authenticate: Basic realm="RAPIDLEECH PLUGMOD"');
            header('HTTP/1.0 401 Unauthorized');
            include 'deny.php';
            exit;
        }
    }
}
开发者ID:sayedharounokpay,项目名称:LikesPlanet,代码行数:28,代码来源:other.php

示例8: task_list_delete_link

function task_list_delete_link()
{
    global $the_task_list;
    if ($the_task_list->canDelete(logged_user())) {
        action_link($the_task_list->getDeleteUrl(), '/icons/delete.png', 'delete');
    }
}
开发者ID:bklein01,项目名称:Project-Pier,代码行数:7,代码来源:task_list.php

示例9: wiki_select_page

/**
 * Renders select page box
 *
 * @param string $name Name to use in HTML for the select
 * @param Project $project
 * @param integer $selected Id of selected element
 * @param array $attributes Array of additional attributes
 * @return string
 */
function wiki_select_page($name, $project, $selected = null, $attributes = null)
{
    if (is_array($attributes)) {
        if (!isset($attributes['class'])) {
            $attributes['class'] = 'wiki_select_page';
        }
    } else {
        $attributes = array('class' => 'wiki_select_page');
    }
    // if
    $options = array(option_tag(lang('none'), 0));
    if (logged_user()->isAdministrator()) {
        $pages = Wiki::getAllProjectPages($project);
    } else {
        $pages = Wiki::getAllProjectPages($project);
    }
    if (is_array($pages)) {
        foreach ($pages as $page) {
            $option_attributes = $page->getId() == $selected ? array('selected' => 'selected') : null;
            $options[] = option_tag($page->getObjectName(), $page->getId(), $option_attributes);
        }
        // foreach
    }
    // if
    return select_box($name, $options, $attributes);
}
开发者ID:bklein01,项目名称:Project-Pier,代码行数:35,代码来源:wiki.php

示例10: ExecuteQuery

 function ExecuteQuery()
 {
     $this->data = array();
     $date = new DateTimeValue(Time());
     $notYet = ProjectTasks::findAll(array('conditions' => 'created_by_id = ' . logged_user()->getId() . ' AND ( due_date = \'0000-00-00 00:00:00\' OR due_date > \'' . substr($date->toMySQL(), 0, strpos($date->toMySQL(), ' ')) . "')"));
     $today = ProjectTasks::findAll(array('conditions' => 'created_by_id = ' . logged_user()->getId() . ' AND due_date = \'' . substr($date->toMySQL(), 0, strpos($date->toMySQL(), ' ')) . "'"));
     $past = ProjectTasks::findAll(array('conditions' => 'created_by_id = ' . logged_user()->getId() . ' AND due_date > \'1900-01-01 00:00:00\' AND due_date < \'' . substr($date->toMySQL(), 0, strpos($date->toMySQL(), ' ')) . "'"));
     $value = 0;
     if (isset($past)) {
         $value = count($past);
     }
     $this->data['values'][0]['labels'][] = 'Overdue';
     $this->data['values'][0]['values'][] = $value;
     $value = 0;
     if (isset($notYet)) {
         $value = count($notYet);
     }
     $this->data['values'][0]['labels'][] = 'Not yet due';
     $this->data['values'][0]['values'][] = $value;
     $value = 0;
     if (isset($today)) {
         $value = count($today);
     }
     $this->data['values'][0]['labels'][] = 'Due today';
     $this->data['values'][0]['values'][] = $value;
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:26,代码来源:TasksByDueDate.class.php

示例11: render

 /**
  * Render form control
  *
  * @param string $control_name
  * @return string
  */
 function render($control_name)
 {
     $value = $this->getValue();
     $dimensions = Dimensions::instance()->findAll();
     $permission_group_ids = ContactPermissionGroups::getPermissionGroupIdsByContactCSV(logged_user()->getId(), false);
     $out = '';
     foreach ($dimensions as $dim) {
         /* @var $dim Dimension */
         if ($dim->getOptions(1) && isset($dim->getOptions(1)->hidden) && $dim->getOptions(1)->hidden) {
             continue;
         }
         if (!$dim->getDefinesPermissions() || !$dim->deniesAllForContact($permission_group_ids)) {
             if (array_search($dim->getId(), $value) !== false) {
                 $checked = 1;
             } else {
                 $checked = 0;
             }
             $out .= '<div class="dimension" >';
             $out .= label_tag($dim->getName(), null, false, array('style' => 'display:inline;margin:10px;vertical-align:super;'));
             $out .= checkbox_field($control_name . '[' . $dim->getId() . ']', $checked);
             $out .= '</div >';
         }
     }
     $out .= '<input type="hidden" name="' . $control_name . '[0]" value=" ">';
     return $out;
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:32,代码来源:RootDimensionsConfigHandler.class.php

示例12: form_my_tasks_dropdown

function form_my_tasks_dropdown()
{
    echo '<li class="header"><a href="' . get_url('form', 'index') . '">' . lang('forms') . '</a></li>';
    if (ProjectForm::canAdd(logged_user(), active_project())) {
        echo '<li><a href="' . get_url('form', 'add') . '">' . lang('add form') . '</a></li>';
    }
    // if
}
开发者ID:469306621,项目名称:Languages,代码行数:8,代码来源:init.php

示例13: times_my_tasks_dropdown

function times_my_tasks_dropdown()
{
    echo '<li class="header"><a href="' . get_url('time', 'index') . '">' . lang('time') . '</a></li>';
    if (ProjectTime::canAdd(logged_user(), active_project())) {
        echo '<li><a href="' . get_url('time', 'add') . '">' . lang('add time') . '</a></li>';
    }
    // if
}
开发者ID:bahmany,项目名称:PythonPurePaperless,代码行数:8,代码来源:init.php

示例14: links_my_tasks_dropdown

function links_my_tasks_dropdown()
{
    echo '<li class="header"><a href="' . get_url('links', 'index') . '">' . lang('links') . '</a></li>';
    if (ProjectLink::canAdd(logged_user(), active_project())) {
        echo '<li><a href="' . get_url('links', 'add_link') . '">' . lang('add link') . '</a></li>';
    }
    // if
}
开发者ID:bahmany,项目名称:PythonPurePaperless,代码行数:8,代码来源:init.php

示例15: canGoOn

 /**
  * Determine if a user canGoOn to deny access to files in projects
  * to which the user has not been assigned.
  *
  * @access public
  * @return null
  */
 function canGoOn()
 {
     if (active_project() == null || !logged_user()->isProjectUser(active_project())) {
         flash_error(lang('no access permissions'));
         $this->redirectTo('dashboard');
     }
     // if
 }
开发者ID:469306621,项目名称:Languages,代码行数:15,代码来源:ApplicationController.class.php


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