Example #1
0
/**
 * @return string the requested menu item URI
 */
function getCurrentURI()
{
    $menu = getResource();
    if (array_key_exists($_SERVER['REQUEST_URI'], $menu)) {
        return $_SERVER['REQUEST_URI'];
    } else {
        foreach (array_keys(getResource()) as $href) {
            if (preg_match("@^/rest{$href}@", $_SERVER['REQUEST_URI'])) {
                return $href;
            }
        }
    }
    return key($menu);
}
Example #2
0
 /**
  * Return an image tag containing a member's avatar.
  *
  * @param array $member An array of the member's details. (email is required in this implementation.)
  * @param string $avatarFormat The format of the member's avatar (as stored in the database - jpg|gif|png.)
  * @param string $className CSS class names to apply to the avatar.
  */
 function avatar($member = array(), $className = "")
 {
     $esoTalkDefault = getResource("core/skin/avatar.png", true);
     if (empty($member["email"])) {
         $url = $esoTalkDefault;
     } else {
         $default = C("plugin.Gravatar.default");
         if (!$default or empty($member)) {
             $default = $esoTalkDefault;
         }
         $protocol = C("esoTalk.https") ? "https" : "http";
         $url = "{$protocol}://www.gravatar.com/avatar/" . md5(strtolower(trim($member["email"]))) . "?d=" . urlencode($default) . "&s=64";
     }
     return "<img src='{$url}' alt='' class='avatar {$className}'/>";
 }
Example #3
0
        ?>
<a href='<?php 
        echo URL("admin/plugins/toggle/{$k}?token=" . ET::$session->token);
        ?>
' class='button toggle'><?php 
        echo $plugin["loaded"] ? "<i class='icon-check'></i> " . T("Enabled") : "<i class='icon-check-empty'></i> " . T("Enable");
        ?>
</a>
</span>
</div>

<?php 
        if (file_exists(PATH_PLUGINS . "/{$k}/icon.png")) {
            ?>
<img src='<?php 
            echo getResource("addons/plugins/{$k}/icon.png");
            ?>
' alt=''/><?php 
        }
        ?>
<strong><?php 
        echo $plugin["info"]["name"];
        ?>
</strong>
<small class='description'><?php 
        echo $plugin["info"]["description"];
        ?>
</small>

</li>
<?php 
Example #4
0
        ?>
<a href='<?php 
        echo URL("admin/plugins/toggle/{$k}?token=" . ET::$session->token);
        ?>
' class='button toggle'><?php 
        echo $plugin["loaded"] ? "<span class='icon-tick'></span> " . T("Disable") : T("Enable");
        ?>
</a>
</span>
</div>

<?php 
        if (file_exists(PATH_PLUGINS . "/{$k}/icon.png")) {
            ?>
<img src='<?php 
            echo getResource("plugins/{$k}/icon.png");
            ?>
' alt=''/><?php 
        }
        ?>
<strong><?php 
        echo $plugin["info"]["name"];
        ?>
</strong>
<small class='version'><?php 
        echo $plugin["info"]["version"];
        ?>
</small>
<small class='description'><?php 
        echo $plugin["info"]["description"];
        ?>
 function FormatBotAutoReplies($_chat, $_answers, $_alternate = true, $html = "", $single = "")
 {
     global $LZLANG, $GROUPS, $CONFIG;
     $tth = ".";
     $bind = " " . $LZLANG["client_or"] . " ";
     if (!empty($GROUPS[$_chat->DesiredChatGroup]) && $GROUPS[$_chat->DesiredChatGroup]->IsHumanAvailable()) {
         $resultpc = queryDB(false, "SELECT * FROM `" . DB_PREFIX . DATABASE_POSTS . "` WHERE `chat_id`='" . DBManager::RealEscape($_chat->ChatId) . "' AND `repost`=0 AND `receiver`='" . DBManager::RealEscape($this->SystemId) . "';");
         if ($this->WelcomeManager && DBManager::GetRowCount($resultpc) >= $this->WelcomeManagerOfferHumanChatAfter) {
             $tth = " " . $LZLANG["client_or"] . " <a class=\"lz_chat_human\" onclick=\"var _this = this;lz_chat_set_talk_to_human(true,true);this.className='';this.style.cursor='wait';setTimeout(function(){_this.style.cursor='default'; },3000);\">" . $LZLANG["client_talk_to_human"] . "</a>.";
             $bind = ", ";
         }
     }
     $lm = empty($CONFIG["gl_dtfbc"]) ? $bind . " <a class=\"lz_chat_mail\" onclick=\"lz_chat_require_leave_message();\">" . $LZLANG["client_leave_a_message"] . "</a>" : "";
     if (count($_answers) == 0) {
         return $LZLANG["client_bot_no_result_found"] . $lm . $tth;
     } else {
         if (count($_answers) > 0) {
             $html .= $LZLANG["client_your_result"] . "<br>";
             $html .= "<ul class=\"lz_chat_bot_resource\">";
             foreach ($_answers as $qa) {
                 if (!empty($qa->ResourceId)) {
                     $res = getResource($qa->ResourceId);
                     $target = $qa->NewWindow ? "target=\"_blank\" " : "";
                     $html .= "<li>";
                     if ($res["type"] == 2) {
                         $html .= "<a class=\"lz_chat_link\" href=\"" . $res["value"] . "\" " . $target . ">" . $res["title"] . "</a>";
                     } else {
                         if ($res["type"] == 3 || $res["type"] == 4) {
                             $html .= "<a class=\"lz_chat_link\" href=\"" . LIVEZILLA_URL . "getfile.php?id=" . $res["id"] . "\" " . $target . ">" . $res["title"] . "</a>";
                         } else {
                             $html .= "<b>" . $res["title"] . "</b><br><br>" . str_replace("<a ", "<a " . $target, str_replace("<A", "<a", $res["value"]));
                         }
                     }
                     $html .= "</li>";
                 } else {
                     if (!empty($qa->Answer)) {
                         $single = $qa->Answer . "<br><br>";
                         break;
                     }
                 }
             }
             $html .= "</ul>";
         }
     }
     if (!empty($single)) {
         $html = $single;
     }
     return $html . ($_alternate ? $LZLANG["client_bot_result_found"] . $lm . $tth : "");
 }
 private function SEND_PHP_MAIL($_receiver = "", $result = "")
 {
     if (strpos($_receiver, ",") !== false) {
         $emails = explode(",", $_receiver);
         foreach ($emails as $mail) {
             if (!empty($mail)) {
                 $result = $this->SEND_PHP_MAIL(trim($mail), $result);
             }
         }
         return $result;
     }
     $mailtext = $this->MailText;
     $ehash = md5(date('r', time()));
     $EOL = "\r\n";
     if (empty($this->FakeSender)) {
         $headers = "From: " . $this->Account->Email . $EOL;
     } else {
         $headers = "From: " . $this->FakeSender . $EOL;
     }
     $headers .= "Reply-To: " . $this->ReplyTo . $EOL;
     $headers .= "Date: " . date("r") . $EOL;
     $headers .= "MIME-Version: 1.0" . $EOL;
     $headers .= "X-Mailer: LiveZilla.net/" . VERSION . $EOL;
     if ($this->Attachments != null) {
         $headers .= "Content-Type: multipart/mixed; boundary=\"" . $ehash . "\"" . $EOL . $EOL;
         $headers .= "--" . $ehash . $EOL;
         $headers .= "Content-Type: text/plain; charset=UTF-8; format=flowed" . $EOL;
         $headers .= "Content-Transfer-Encoding: 8bit" . $EOL . $EOL;
         $headers .= $mailtext . $EOL . $EOL;
         $headers .= "--" . $ehash . $EOL;
         foreach ($this->Attachments as $resId) {
             $res = getResource($resId);
             if ($res == null) {
                 continue;
             }
             $content = chunk_split(base64_encode(file_get_contents("./uploads/" . $res["value"])));
             $headers .= "Content-Type: application/octet-stream; name=\"" . $res["title"] . "\"" . $EOL;
             $headers .= "Content-Transfer-Encoding: base64" . $EOL;
             $headers .= "Content-Disposition: attachment; filename=\"" . $res["title"] . "\"" . $EOL . $EOL;
             $headers .= $content . $EOL . $EOL;
             $headers .= "--" . $ehash . $EOL;
         }
         $mailtext = "";
         $headers .= "--" . $ehash . "--" . $EOL;
     } else {
         $headers .= "Content-Type: text/plain; charset=UTF-8; format=flowed" . $EOL;
         $headers .= "Content-Transfer-Encoding: 8bit" . $EOL . $EOL;
     }
     if (@mail($_receiver, $this->Subject, $mailtext, $headers)) {
         return 1;
     } else {
         return "The email could not be sent using PHP mail(). Please try another Return Email Address or use SMTP.";
     }
 }
Example #7
0
        ?>
<li><a href='<?php 
        echo URL("admin/appearance/uninstall/{$k}?token=" . ET::$session->token);
        ?>
'><i class='icon-remove'></i><?php 
        echo T("Uninstall");
        ?>
</a></li>
</ul>

<div class='preview'>
<?php 
        if (file_exists(PATH_SKINS . "/{$k}/preview.jpg")) {
            ?>
<img src='<?php 
            echo getResource("addons/skins/{$k}/preview.jpg");
            ?>
' alt='<?php 
            echo $k;
            ?>
'/>
<?php 
        } else {
            ?>
<span><?php 
            echo T("No preview");
            ?>
</span><?php 
        }
        ?>
</div>
Example #8
0
<?php

/* yadl_spaceid - Skip Stamping */
error_reporting(E_ALL);
function getResource($url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}
$url = 'http://search.yahooapis.com/NewsSearchService/V1/newsSearch?appid=YahooDemo&language=en&output=php&' . getenv('QUERY_STRING');
//$response = file_get_contents($url);
$response = getResource($url);
if ($response === false) {
    die('Request failed');
}
$resultSet = unserialize($response);
$resultSet = $resultSet['ResultSet'];
$list = '';
// HTML output
$headlines = array();
// track headlines to filter dupes
foreach ($resultSet['Result'] as $result) {
    if (!isset($headlines[$result['Title']])) {
        $headlines[$result['Title']] = true;
        $list .= <<<END_OF_HTML
        <li>
            <a href="{$result['ClickUrl']}"><q>{$result['Title']}</q></a>
Example #9
0
/****************************************************************************************
* LiveZilla getfile.php
* 
* Copyright 2014 LiveZilla GmbH
* All rights reserved.
* LiveZilla is a registered trademark.
* 
* Improper changes to this file may cause critical errors.
***************************************************************************************/
define("IN_LIVEZILLA", true);
if (!defined("LIVEZILLA_PATH")) {
    define("LIVEZILLA_PATH", "./");
}
require LIVEZILLA_PATH . "_definitions/definitions.inc.php";
require LIVEZILLA_PATH . "_definitions/definitions.protocol.inc.php";
require LIVEZILLA_PATH . "_lib/functions.global.inc.php";
require LIVEZILLA_PATH . "_lib/objects.global.users.inc.php";
require LIVEZILLA_PATH . "_definitions/definitions.dynamic.inc.php";
if (isset($_GET["id"]) && initDataProvider()) {
    $id = $_GET["id"];
    if (strpos($id, ".") === false && !isnull($res = getResource($id))) {
        if (file_exists("./uploads/" . $res["value"]) && strpos($res["value"], "..") === false) {
            header('Content-Description: File Transfer');
            header('Content-Type: application/octet-stream');
            header('Content-Length: ' . filesize("./uploads/" . $res["value"]));
            header('Content-Disposition: attachment; filename=' . urlencode($res["title"]));
            exit(file_get_contents("./uploads/" . $res["value"]));
        }
    }
}
header("HTTP/1.0 404 Not Found");
 static function GetMatches($_list, $_question, $_language)
 {
     $answers = array();
     foreach ($_list as $reply) {
         if ($reply->SearchType != 5) {
             $reply->Tags = str_replace(array("!", ".", "?", "=", ")", "(", "-", "_", ":", "#", "~", "?"), "", strtolower($reply->Tags));
         }
         if (!$reply->MatchesLanguage($_language)) {
             continue;
         }
         $tags = explode(",", $reply->Tags);
         $count = 0;
         foreach ($tags as $tag) {
             if ($reply->SearchType == 5) {
                 if (@preg_match($reply->Tags, $_question) === 1) {
                     $count++;
                 }
             } else {
                 if ($reply->SearchType < 4 && strpos($_question, $tag) !== false || jokerCompare($tag, $_question)) {
                     $count++;
                 }
             }
         }
         if ($reply->SearchType == 0 && $count == substr_count($reply->Tags, ",") + 1 || $reply->SearchType > 0 && $count >= $reply->SearchType || $reply->SearchType >= 4 && $count > 0) {
             if (empty($reply->Answer)) {
                 if (getResource($reply->ResourceId) !== null) {
                     $answers[$count . "-" . count($answers)] = $reply;
                 }
             } else {
                 $answers = array();
                 $answers[$count . "-" . count($answers)] = $reply;
                 break;
             }
         }
     }
     krsort($answers);
     return $answers;
 }
Example #11
0
 /**
  * Return an image tag containing a member's avatar.
  *
  * @param int $memberId The member's ID.
  * @param string $avatarFormat The format of the member's avatar (as stored in the database - jpg|gif|png.)
  * @param string $className CSS class names to apply to the avatar.
  */
 function avatar($memberId = 0, $avatarFormat = "", $className = "")
 {
     // Otherwise, construct the avatar path from the provided information.
     if ($memberId and $avatarFormat) {
         $file = "uploads/avatars/{$memberId}.{$avatarFormat}";
         $url = getWebPath($file);
     }
     // If the user doesn't have an avatar, return the skin's default one.
     if (!$avatarFormat) {
         $url = getResource("skins/base/avatar.png");
     }
     return "<img src='{$url}' alt='' class='avatar {$className}'/>";
 }
<title><?php 
echo sanitizeHTML($data["pageTitle"]);
?>
</title>
<?php 
echo $data["head"];
?>
<link rel="icon" type="image/png" href="<?php 
echo getResource("core/skin/favicon.png");
?>
">		+v<link rel="apple-touch-icon" href="<?php 
echo getResource("core/skin/apple-touch-icon.png");
?>
">
<link rel="apple-touch-icon" href="<?php 
echo getResource("core/skin/apple-touch-icon.png");
?>
">
</head>

<body class='<?php 
echo $data["bodyClass"];
?>
'>
<?php 
$this->trigger("pageStart");
?>

<div id='messages'>
<?php 
foreach ($data["messages"] as $message) {
Example #13
0
        ?>
<li><a href='<?php 
        echo URL("admin/appearance/uninstall/{$k}?token=" . ET::$session->token);
        ?>
'><?php 
        echo T("Uninstall");
        ?>
</a></li>
</ul>

<div class='preview'>
<?php 
        if (file_exists(PATH_SKINS . "/{$k}/preview.jpg")) {
            ?>
<img src='<?php 
            echo getResource("skins/{$k}/preview.jpg");
            ?>
' alt='<?php 
            echo $k;
            ?>
'/>
<?php 
        } else {
            ?>
<span><?php 
            echo T("No preview");
            ?>
</span><?php 
        }
        ?>
</div>
 static function GetMatches($_list, $_question, $_language, $_chat, $_internal, $lmsi = false, $lmse = false, $lpi = null, $lpe = null)
 {
     $answers = array();
     foreach ($_list as $reply) {
         if ($_chat != null) {
             $reply->Answer = $_chat->TextReplace($reply->Answer);
         }
         if ($_internal != null) {
             $reply->Answer = $_internal->TextReplace($reply->Answer);
         }
         if ($reply->SearchType != 5) {
             $reply->Tags = str_replace(array("!", ".", "?", "=", ")", "(", "-", "_", ":", "#", "~", "?"), "", strtolower($reply->Tags));
         }
         if (!$reply->MatchesLanguage($_language)) {
             continue;
         }
         if (empty($_chat->AllocatedTime) && !$reply->Waiting) {
             if (!($_internal != null && $_internal->IsBot)) {
                 continue;
             }
         }
         $tags = explode(",", $reply->Tags);
         $count = 0;
         if (!empty($_chat)) {
             if ($lmsi === false && ($reply->SendInactivityTimeInternal > -1 || $reply->SendInactivityTimeExternal > -1)) {
                 $lpi = Chat::GetLastPost($_chat->ChatId, true);
                 $lpe = Chat::GetLastPost($_chat->ChatId, false);
                 $lmsi = $lpi != null ? $lpi->Created : 0;
                 $lmse = $lpe != null ? $lpe->Created : 0;
             }
             $lm = max($lmsi, $lmse);
             $lastMessageExternal = $lmse > $lmsi && !empty($lm);
             $lastMessageInternal = $lmsi >= $lmse;
             if (empty($lm)) {
                 $lm = $_chat->AllocatedTime;
             }
             if (!empty($lm)) {
                 if ($reply->SendInactivityTimeInternal > -1 && $lastMessageExternal && $lmsi > 0) {
                     if (time() - $lm > $reply->SendInactivityTimeInternal) {
                         $answers[$count . "-" . count($answers)] = $reply;
                     }
                 }
                 if ($reply->SendInactivityTimeExternal > -1 && $lastMessageInternal) {
                     if (time() - $lm > $reply->SendInactivityTimeExternal) {
                         if (!($lpi != null && $reply->Answer == $lpi->Text)) {
                             $answers[$count . "-" . count($answers)] = $reply;
                         }
                     }
                 }
                 if ($reply->CloseChat && !empty($_chat) && !empty($_internal)) {
                     if (count($answers) > 0 && isset($answers["0-0"]) && $answers["0-0"] == $reply) {
                         $_chat->InternalClose($_internal->SystemId);
                     }
                 }
             }
         }
         if ($reply->SendInactivityTimeInternal == -1 && $reply->SendInactivityTimeExternal == -1) {
             foreach ($tags as $tag) {
                 if ($reply->SearchType == 5) {
                     if (@preg_match($reply->Tags, $_question) === 1) {
                         $count++;
                     }
                 } else {
                     if ($reply->SearchType < 4 && strpos($_question, $tag) !== false || jokerCompare($tag, $_question)) {
                         $count++;
                     }
                 }
             }
             if ($reply->SearchType == 0 && $count == substr_count($reply->Tags, ",") + 1 || $reply->SearchType > 0 && $count >= $reply->SearchType || $reply->SearchType >= 4 && $count > 0) {
                 if (empty($reply->Answer)) {
                     if (getResource($reply->ResourceId) !== null) {
                         $answers[$count . "-" . count($answers)] = $reply;
                     }
                 } else {
                     $answers = array();
                     $answers[$count . "-" . count($answers)] = $reply;
                     break;
                 }
             }
         }
     }
     return $answers;
 }
<?php

/* yadl_spaceid - Skip Stamping */
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Content-Type:text/xml");
$url = 'http://xml.weather.yahoo.com/forecastrss?' . getenv('QUERY_STRING');
function getResource($url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}
$feed = getResource($url);
echo $feed;
Example #16
0
<?php 
echo $form->open();
?>

<div class='section'>

<ul class='form'>

<li>
<label>Default imageset</label>
<div class='checkboxGroup' id='gravatarDefaults'>
	<label class='radio'><?php 
echo $form->radio("default", "");
?>
 <img src='<?php 
echo getResource("skins/base/avatar.png");
?>
' class='avatar'> esoTalk default</label>
	<label class='radio'><?php 
echo $form->radio("default", "mm");
?>
 <img src='http://www.gravatar.com/avatar/0?d=mm' class='avatar'> Mystery Man</label>
	<label class='radio'><?php 
echo $form->radio("default", "identicon");
?>
 <img src='http://www.gravatar.com/avatar/0?d=identicon' class='avatar'> Identicon</label>
	<label class='radio'><?php 
echo $form->radio("default", "monsterid");
?>
 <img src='http://www.gravatar.com/avatar/0?d=monsterid' class='avatar'> MonsterID</label>
	<label class='radio'><?php 
Example #17
0
 /**
  * Return an image tag containing a member's avatar.
  *
  * @param array $member An array of the member's details. (memberId is required in this implementation.)
  * @param string $avatarFormat The format of the member's avatar (as stored in the database - jpg|gif|png.)
  * @param string $className CSS class names to apply to the avatar.
  *
  * @package esoTalk
  */
 function avatar($member = array(), $className = "")
 {
     $url = getResource("core/skin/avatar.png");
     // Construct the avatar path from the provided information.
     if (!empty($member["memberId"]) and !empty($member["avatarFormat"])) {
         $file = "uploads/avatars/{$member["memberId"]}.{$member["avatarFormat"]}";
         $url = getWebPath($file);
     }
     return "<img src='{$url}' alt='' class='avatar {$className}'/>";
 }
Example #18
0
<html>
	<head>
		<title>Sveglie - Leila</title>
		<?php 
include "functions.php";
getResource();
?>
        <link href="res/css/sveglie.css" rel="stylesheet" type="text/css">
        <link href="bootstrap-3.3.5-dist/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
		<script src="res/js/jquery-2.2.0.min.js"></script>
        <script src="bootstrap-3.3.5-dist/js/bootstrap-datetimepicker.min.js"></script>
        
	</head>
	<body>
		<?php 
getMenu();
?>
        <div class="main">
			<div style="position:relative; height:300px; width:100%; background:#8ce196;">
						<article style="position:relative; margin:10 auto; " class="clock">
                          <div class="hours-container">
                            <div class="hours"></div>
                          </div>
                          <div class="minutes-container">
                            <div class="minutes"></div>
                          </div>
                          <div class="seconds-container">
                            <div class="seconds"></div>
                          </div>
                        </article>
          	</div>
Example #19
0
        throw new Exception('Invalid response');
    }
    return json_decode($data['content'], true);
    // echo $data['content']; exit;
    /* eval('?>' . $data['content'] . '<?'); */
    // return $LANG;
}
function fill_en($en, &$dict)
{
    foreach ($en as $k => $v) {
        if (!isset($dict[$k])) {
            $dict[$k] = $v;
        }
    }
}
$info = getResource('foodle', 'foodle');
// print_r($info); exit;
$base = dirname(dirname(__FILE__)) . '/dictionaries/';
$def_en = json_decode(file_get_contents($base . 'foodle.en.js'), true);
$langcodes = array('en');
foreach ($info['available_languages'] as $lang) {
    if ($lang['code'] === 'en') {
        continue;
    }
    echo 'Processing Language ' . $lang['name'] . "\n";
    $trans = getTranslation('foodle', 'foodle', $lang['code']);
    $transinfo = getTranslationInfo('foodle', 'foodle', $lang['code']);
    if ($transinfo['untranslated_entities'] > $transinfo['translated_entities']) {
        echo "Skipping language export, because too few translated terms.\n";
        continue;
    }
Example #20
0
 /**
  * Generate all of the HTML to be outputted inside of the <head> tag.
  *
  * @return string The HTML to go inside <head>.
  */
 public function head()
 {
     $head = "<!-- This page was generated by esoTalk (http://esotalk.org) -->\n";
     // Add the canonical URL tag.
     if (!empty($this->canonicalURL)) {
         $head .= "<link rel='canonical' href='{$this->canonicalURL}'>\n";
     }
     // Add remote stylesheets.
     if (!empty($this->cssFiles["remote"])) {
         foreach ($this->cssFiles["remote"] as $url) {
             $head .= "<link rel='stylesheet' href='{$url}'>\n";
         }
     }
     unset($this->cssFiles["remote"]);
     // Go through CSS stylesheets and aggregate them, then add appropriate tags to the header.
     // Here we loop through "groups" of CSS files (usually "global" and "local".)
     foreach ($this->cssFiles as $key => $files) {
         // If CSS aggregation is enabled, and there's more than one file in this "group", proceed with aggregation.
         if (count($files) > 1 and C("esoTalk.aggregateCSS") and !ET::$controller instanceof ETAdminController) {
             $files = $this->aggregateFiles($files, "css");
         } else {
             foreach ($files as &$file) {
                 $file = PATH_ROOT . "/" . $file;
             }
         }
         unset($file);
         // For each of the files that we need to include in the page, add a <link> tag.
         foreach ($files as $file) {
             $head .= "<link rel='stylesheet' href='" . getResource($file) . "?" . @filemtime($file) . "'>\n";
         }
     }
     // Output all necessary config variables and language definitions, as well as other variables.
     $esoTalkJS = array("webPath" => ET::$webPath . ((C("esoTalk.urls.friendly") and !C("esoTalk.urls.rewrite")) ? "/index.php" : ""), "userId" => ET::$session->user ? (int) ET::$session->userId : false, "token" => ET::$session->token, "debug" => C("esoTalk.debug"), "language" => $this->jsLanguage) + (array) $this->jsData;
     $head .= "<script>var ET=" . json_encode($esoTalkJS) . "</script>\n";
     // Add remote JavaScript.
     if (!empty($this->jsFiles["remote"])) {
         foreach ($this->jsFiles["remote"] as $url) {
             $head .= "<script src='{$url}'></script>\n";
         }
     }
     unset($this->jsFiles["remote"]);
     // Same thing as above, but with JavaScript!
     foreach ($this->jsFiles as $files) {
         // If JS aggregation is enabled, and there's more than one file in this "group", proceed with aggregation.
         if (count($files) > 1 and C("esoTalk.aggregateJS") and !ET::$controller instanceof ETAdminController) {
             $files = $this->aggregateFiles($files, "js");
         } else {
             foreach ($files as &$file) {
                 $file = PATH_ROOT . "/" . $file;
             }
         }
         unset($file);
         // For each of the files that we need to include in the page, add a <script> tag.
         foreach ($files as $file) {
             $head .= "<script src='" . getResource($file) . "?" . filemtime($file) . "'></script>\n";
         }
     }
     // Finally, append the custom HTML string constructed via $this->addToHead().
     $head .= $this->head;
     $this->trigger("head", array(&$head));
     return $head;
 }
Example #21
0
}
function getPerson($id)
{
    # implements GET method for person
    # Example: GET /staffapi/person/13
    echo "Getting person: " . $id;
}
function deletePerson($id)
{
    # implements DELETE method for person
    # Example: DELETE /staffapi/person/13
    echo "Deleting person: " . $id;
}
# Main
# ----
$resource = getResource();
$request_method = getMethod();
$parameters = getParameters();
# Redirect to appropriate handlers.
if ($resource[0] == "staffapi") {
    if ($request_method == "POST" && $resource[1] == "person") {
        postPerson($parameters);
    } else {
        if ($request_method == "GET" && $resource[1] == "persons") {
            getPersons();
        } else {
            if ($request_method == "GET" && $resource[1] == "person") {
                getPerson($resource[2]);
            } else {
                if ($request_method == "DELETE" && $resource[1] == "person") {
                    deletePerson($resource[2]);