-
-/**
- * generate a guaranteed unique (for this domain) item ID for ATOM
- * safe from birthday paradox
- *
- * @param string $hostname
- * @param int $uid
- * @return string
- */
-function item_new_uri($hostname, $uid, $guid = "") {
-
- do {
- if ($guid == "") {
- $hash = get_guid(32);
- } else {
- $hash = $guid;
- $guid = "";
- }
-
- $uri = "urn:X-dfrn:" . $hostname . ':' . $uid . ':' . $hash;
-
- $dups = dba::exists('item', ['uri' => $uri]);
- } while ($dups == true);
-
- return $uri;
-}
-
-/**
- * @deprecated
- * wrapper to load a view template, checking for alternate
- * languages before falling back to the default
- *
- * @global string $lang
- * @global App $a
- * @param string $s view name
- * @return string
- */
-function load_view_file($s) {
- global $lang, $a;
- if (! isset($lang)) {
- $lang = 'en';
- }
- $b = basename($s);
- $d = dirname($s);
- if (file_exists("$d/$lang/$b")) {
- $stamp1 = microtime(true);
- $content = file_get_contents("$d/$lang/$b");
- $a->save_timestamp($stamp1, "file");
- return $content;
- }
-
- $theme = current_theme();
-
- if (file_exists("$d/theme/$theme/$b")) {
- $stamp1 = microtime(true);
- $content = file_get_contents("$d/theme/$theme/$b");
- $a->save_timestamp($stamp1, "file");
- return $content;
- }
-
- $stamp1 = microtime(true);
- $content = file_get_contents($s);
- $a->save_timestamp($stamp1, "file");
- return $content;
-}
-
-
-/**
- * load a view template, checking for alternate
- * languages before falling back to the default
- *
- * @global string $lang
- * @param string $s view path
- * @return string
- */
-function get_intltext_template($s) {
- global $lang;
-
- $a = get_app();
- $engine = '';
- if ($a->theme['template_engine'] === 'smarty3') {
- $engine = "/smarty3";
- }
-
- if (! isset($lang)) {
- $lang = 'en';
- }
-
- if (file_exists("view/lang/$lang$engine/$s")) {
- $stamp1 = microtime(true);
- $content = file_get_contents("view/lang/$lang$engine/$s");
- $a->save_timestamp($stamp1, "file");
- return $content;
- } elseif (file_exists("view/lang/en$engine/$s")) {
- $stamp1 = microtime(true);
- $content = file_get_contents("view/lang/en$engine/$s");
- $a->save_timestamp($stamp1, "file");
- return $content;
- } else {
- $stamp1 = microtime(true);
- $content = file_get_contents("view$engine/$s");
- $a->save_timestamp($stamp1, "file");
- return $content;
- }
-}
-
-