Changeset 3145 for trunk/admin


Ignore:
Timestamp:
Feb 14, 2009, 3:24:10 AM (15 years ago)
Author:
rvelices
Message:

Last (I hope) paranoic optims ...

  • move get_uysername and get_groupname from public to admin/functions.inc.php
  • optim in index.php
  • tags.tpl does not need smarty modifier included
  • move func get_comment_post_key from functions_comment to functions (avoid extra inclusion every time on picture page)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r3072 r3145  
    144144  {
    145145    include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
    146    
     146
    147147    // we can currently delete physically only photo with no
    148148    // storage_category_id (added via pLoader)
     
    18651865      $extents = array_merge($extents, get_extents($path));
    18661866    }
    1867     elseif ( !is_link($path) and file_exists($path) 
     1867    elseif ( !is_link($path) and file_exists($path)
    18681868            and get_extension($path) == 'tpl' )
    18691869    {
     
    20102010  $path = isset($src['path']) ? $src['path'] : '/';
    20112011  $path .= isset($src['query']) ? '?'.$src['query'] : '';
    2012  
     2012
    20132013  if (($s = @fsockopen($host,80,$errno,$errstr,5)) === false)
    20142014  {
     
    20672067}
    20682068
     2069
     2070/**
     2071 * returns the groupname corresponding to the given group identifier if
     2072 * exists
     2073 *
     2074 * @param int group_id
     2075 * @return mixed
     2076 */
     2077function get_groupname($group_id)
     2078{
     2079  $query = '
     2080SELECT name
     2081  FROM '.GROUPS_TABLE.'
     2082  WHERE id = '.intval($group_id).'
     2083;';
     2084  $result = pwg_query($query);
     2085  if (mysql_num_rows($result) > 0)
     2086  {
     2087    list($groupname) = mysql_fetch_row($result);
     2088  }
     2089  else
     2090  {
     2091    return false;
     2092  }
     2093
     2094  return $groupname;
     2095}
     2096
     2097/**
     2098 * returns the username corresponding to the given user identifier if exists
     2099 *
     2100 * @param int user_id
     2101 * @return mixed
     2102 */
     2103function get_username($user_id)
     2104{
     2105  global $conf;
     2106
     2107  $query = '
     2108SELECT '.$conf['user_fields']['username'].'
     2109  FROM '.USERS_TABLE.'
     2110  WHERE '.$conf['user_fields']['id'].' = '.intval($user_id).'
     2111;';
     2112  $result = pwg_query($query);
     2113  if (mysql_num_rows($result) > 0)
     2114  {
     2115    list($username) = mysql_fetch_row($result);
     2116  }
     2117  else
     2118  {
     2119    return false;
     2120  }
     2121
     2122  return $username;
     2123}
    20692124?>
Note: See TracChangeset for help on using the changeset viewer.