コード例 #1
0
ファイル: ets.php プロジェクト: benjohnsto/abcbooks-booktags
/**
 * Return a built template string
 */
function sprintts($datatree, $containers, $entry = 'main')
{
    return sprintt($datatree, $containers, $entry, _ETS_STRING_READ, '', '');
}
コード例 #2
0
ファイル: pushhub.php プロジェクト: Grasia/bolotweet
 /**
  * Check whether the given URL represents one of our canonical
  * user or group Atom feeds.
  *
  * @param string $feed URL
  * @return boolean true if it matches
  */
 function recognizedFeed($feed)
 {
     $matches = array();
     if (preg_match('!/(\\d+)\\.atom$!', $feed, $matches)) {
         $id = $matches[1];
         $params = array('id' => $id, 'format' => 'atom');
         $userFeed = common_local_url('ApiTimelineUser', $params);
         $groupFeed = common_local_url('ApiTimelineGroup', $params);
         if ($feed == $userFeed) {
             $user = User::staticGet('id', $id);
             if (!$user) {
                 // TRANS: Client exception. %s is a feed URL.
                 throw new ClientException(sprintt(_m('Invalid hub.topic "%s". User does not exist.'), $feed));
             } else {
                 return true;
             }
         }
         if ($feed == $groupFeed) {
             $user = User_group::staticGet('id', $id);
             if (!$user) {
                 // TRANS: Client exception. %s is a feed URL.
                 throw new ClientException(sprintf(_m('Invalid hub.topic "%s". Group does not exist.'), $feed));
             } else {
                 return true;
             }
         }
     } else {
         if (preg_match('!/(\\d+)/lists/(\\d+)/statuses\\.atom$!', $feed, $matches)) {
             $user = $matches[1];
             $id = $matches[2];
             $params = array('user' => $user, 'id' => $id, 'format' => 'atom');
             $listFeed = common_local_url('ApiTimelineList', $params);
             if ($feed == $listFeed) {
                 $list = Profile_list::staticGet('id', $id);
                 $user = User::staticGet('id', $user);
                 if (!$list || !$user || $list->tagger != $user->id) {
                     // TRANS: Client exception. %s is a feed URL.
                     throw new ClientException(sprintf(_m('Invalid hub.topic %s; list does not exist.'), $feed));
                 } else {
                     return true;
                 }
             }
             common_log(LOG_DEBUG, "Not a user, group or people tag feed? {$feed} {$userFeed} {$groupFeed} {$listFeed}");
         }
     }
     common_log(LOG_DEBUG, "LOST {$feed}");
     return false;
 }
コード例 #3
0
ファイル: pushhub.php プロジェクト: microcosmx/experiments
 /**
  * Check whether the given URL represents one of our canonical
  * user or group Atom feeds.
  *
  * @param string $feed URL
  * @return boolean true if it matches
  */
 function recognizedFeed($feed)
 {
     $matches = array();
     if (preg_match('!/(\\d+)\\.atom$!', $feed, $matches)) {
         $id = $matches[1];
         $params = array('id' => $id, 'format' => 'atom');
         $userFeed = common_local_url('ApiTimelineUser', $params);
         $groupFeed = common_local_url('ApiTimelineGroup', $params);
         if ($feed == $userFeed) {
             $user = User::staticGet('id', $id);
             if (!$user) {
                 // TRANS: Client exception.
                 throw new ClientException(sprintt(_m('Invalid hub.topic "%s". User doesn\'t exist.'), $feed));
             } else {
                 return true;
             }
         }
         if ($feed == $groupFeed) {
             $user = User_group::staticGet('id', $id);
             if (!$user) {
                 // TRANS: Client exception.
                 throw new ClientException(sprintf(_m('Invalid hub.topic "%s". Group doesn\'t exist.'), $feed));
             } else {
                 return true;
             }
         }
         common_log(LOG_DEBUG, "Not a user or group feed? {$feed} {$userFeed} {$groupFeed}");
     }
     common_log(LOG_DEBUG, "LOST {$feed}");
     return false;
 }
コード例 #4
0
ファイル: fkt_img.php プロジェクト: BackupTheBerlios/acme
function getimagebyid($id, $style, $page_tpl)
{
    global $conf, $lang;
    $getpic = "Select img_real_name, img_name, img_description from acme_bilder where img_id = '" . $id . "'";
    $result = dbquery($getpic);
    if (mysql_affected_rows() == 1) {
        $row = mysql_fetch_object($result);
        // vorsichtshalber wegen altdaten
        if (file_exists($conf["images"] . "small_" . $row->img_real_name)) {
            list($width, $height, $type, $attr) = getimagesize($conf["images"] . "small_" . $row->img_real_name);
        } else {
            list($width, $height, $type, $attr) = getimagesize($conf["images"] . $row->img_real_name);
        }
        $data->img_width = $width;
        $data->img_height = $height;
        // vorsichtshalber wegen altdaten
        if (file_exists($conf["images"] . "thumb_" . $row->img_real_name)) {
            $data->img_small_url = $conf["images"] . "thumb_" . $row->img_real_name;
        } else {
            $data->img_small_url = $conf["images"] . $row->img_real_name;
        }
        // vorsichtshalber wegen altdaten
        if (file_exists($conf["images"] . "small_" . $row->img_real_name)) {
            $data->img_small_url = $conf["images"] . "small_" . $row->img_real_name;
        } else {
            $data->img_small_url = $conf["images"] . $row->img_real_name;
        }
        $data->img_big_url = $conf["images"] . $row->img_real_name;
        $data->img_name = $row->img_name;
        $data->img_desc = $row->img_description;
    }
    if ($style == "") {
        $style = "c";
    }
    $tplfile = $conf["templates"] . gettemplatebyid($page_tpl) . ".imgtbl." . $style . ".tpl";
    return " " . sprintt($data, $tplfile) . " ";
    mysql_free_result($result);
}