Ejemplo n.º 1
0
 function esiExpression($expression)
 {
     /*  Regexp now matches $(HTTP_COOKIE{stuff});
     			TODO:
     			Add matching for:
     				[v] $(HTTP_COOKIE{stuff}|default)
     				[v] $(HTTP_COOKIE{stuff}|'default blah')
     
     			Add variable replacement for:
     				[v] HTTP_ACCEPT_LANGUAGE
     				[v] HTTP_HOST
     				[v] HTTP_REFERER
     				[v] QUERY_STRING
     
     				HTTP_USER_AGENT
     			FIXME: ariadne cookies are serialized by default, which would break HTTP_COOKIE usage in other ESI processors
     		*/
     $result = preg_replace_callback('!\\$\\(([^)|{]*)(\\{(([^}]*))\\})?(\\|([^)]*))?\\)!', function ($matches) {
         // print_r($matches);
         switch ($matches[1]) {
             case 'HTTP_COOKIE':
                 $cookie = ldGetUserCookie($matches[3]);
                 $default = preg_replace("/^'(.*?)'\$/", "\$1", $matches[6]);
                 return $cookie ? $cookie : $default;
                 break;
             case 'HTTP_HOST':
                 $host = ldGetServerVar('HTTP_HOST');
                 $default = preg_replace("/^'(.*?)'\$/", "\$1", $matches[6]);
                 return $host ? $host : $default;
                 break;
             case 'HTTP_REFERER':
                 $referer = ldGetServerVar('HTTP_REFERER');
                 $default = preg_replace("/^'(.*?)'\$/", "\$1", $matches[6]);
                 return $referer ? $referer : $default;
                 break;
             case 'HTTP_ACCEPT_LANGUAGE':
                 $acceptLanguage = ldGetServerVar('HTTP_ACCEPT_LANGUAGE');
                 $acceptLanguage = strtolower(str_replace(", ", ",", $acceptLanguage));
                 $languages = explode(",", $acceptLanguage);
                 if (in_array(strtolower($matches[3]), $languages)) {
                     return 1;
                 }
                 return 0;
                 break;
             case 'QUERY_STRING':
                 $value = ar_loader::getvar($matches[3], "GET");
                 $default = preg_replace("/^'(.*?)'\$/", "\$1", $matches[6]);
                 return isset($value) ? $value : $default;
                 break;
         }
     }, $expression);
     return $result;
 }
Ejemplo n.º 2
0
function ldSetUserCookie($cookie, $cookiename = "ARUserCookie", $expire = 0, $path = "/", $domain = "", $secure = 0, $consentneeded = false)
{
    $result = false;
    if (substr($cookiename, 0, strlen('ARSessionCookie')) == 'ARSessionCookie' || $cookiename == 'ARCurrentSession') {
        return false;
    }
    $cookieconsent = ldGetUserCookie("ARCookieConsent");
    if (!$consentneeded || $cookieconsent == true) {
        // Only set cookies when consent has been given, or no consent is needed for this cookie.
        if ($cookiename != "ARSessionCookie" && $cookiename != "ARCurrentSession") {
            $ARUserCookie = json_encode($cookie);
            debug("ldSetUserCookie(" . $ARUserCookie . ")", "object");
            header('P3P: CP="NOI CUR OUR"');
            $result = setcookie($cookiename, $ARUserCookie, $expire, $path, $domain, $secure);
        }
    } else {
        debug("ldSetUserCookie: no consent. (" . $ARUserCookie . ")", "object");
    }
    return $result;
}
Ejemplo n.º 3
0
 function fixSource($var)
 {
     // replace the fixed source code span with the fixed source code (base64encoded in vd:source)
     global $ARnls;
     if (preg_match('/<(span|div)[^>]*vd:cookieconsentrequired="true"[^>]*>.*<span.*vd:endsource="true".*>.*<\\/span>.*<\\/(span|div)>/isU', $var) && ldGetUserCookie("ARCookieConsent") != true) {
         $var = preg_replace_callback('/<(span|div)[^>]*vd:source="([^"]*)"[^>]*>.*<span.*vd:endsource="true".*>.*<\\/span>.*<\\/(span|div)>/isU', function ($matches) use($ARnls) {
             return "[" . $ARnls['vd_cookie_consent_required'] . "]";
         }, $var);
     } else {
         $var = preg_replace_callback('/<(span|div)[^>]*vd:source="([^"]*)"[^>]*>.*<span.*vd:endsource="true".*>.*<\\/span>.*<\\/(span|div)>/isU', function ($matches) {
             return base64_decode($matches[2]);
         }, $var);
     }
     return $var;
 }
Ejemplo n.º 4
0
     $root = "/";
     $base_object = current($this->get($this->currentproject(), "system.get.phtml"));
 }
 // This set initializes the tree from the user object
 $path = $base_object->path;
 $name = $base_object->nlsdata->name;
 $icon = $base_object->call('system.get.icon.php', array('size' => 'medium'));
 $loader = $this->store->get_config('root');
 $wwwroot = $AR->dir->www;
 $interface = $data->interface;
 $yui_base = $wwwroot . "js/yui/";
 //	$yui_base = "http://developer.yahoo.com/yui/";
 $viewmodes = array("list" => 1, "details" => 1, "icons" => 1);
 $viewmode = $this->getvar("viewmode");
 if (!$viewmode || !$viewmodes[$viewmode]) {
     $viewmode = ldGetUserCookie("viewmode");
     if (!$viewmode || !$viewmodes[$viewmode]) {
         $viewmode = 'list';
     }
 }
 $ordering = array("name" => 1, "filename" => 1, "ctime" => 1, "mtime" => 1, "modified" => 1, "priority" => 1, "path" => 1);
 // List of allowed ordering options;
 $directions = array("asc" => 1, "desc" => 1);
 $order = strtolower($this->getvar('order'));
 if (!$order || !$ordering[$order]) {
     $order = 'name';
 }
 $direction = strtolower($this->getvar('direction'));
 if (!$direction || !$directions[$direction]) {
     $direction = 'asc';
 }
Ejemplo n.º 5
0
if ($this->CheckLogin("read") && $this->CheckConfig()) {
    include $this->store->get_config("code") . "widgets/wizard/code.php";
    $wgWizButtons = array("cancel" => array("value" => $ARnls["cancel"]), "0" => array("value" => $ARnls["search"]));
    $wgWizFlow = array();
    $wgWizFlow[] = array("current" => $this->getdata("wgWizCurrent", "none"), "cancel" => "window.close.js");
    $wgWizFlow[] = array("title" => $ARnls["contextsearch"], "image" => $AR->dir->images . 'wizard/data.png', "template" => "dialog.search.context.php");
    $wgWizFlow[] = array("title" => $ARnls["advancedsearch"], "image" => $AR->dir->images . 'wizard/data.png', "template" => "dialog.search.advanced.php");
    // spawn wizard
    $wgWizHeaderIcon = $AR->dir->images . 'icons/large/search.png';
    $wgWizTitle = $ARnls["search"];
    $wgWizHeader = $wgWizTitle;
    $spath = $AR->dir->www . "js/yui/";
    $wgWizStyleSheets = array($spath . "datatable/assets/skins/sam/datatable.css");
    $wgWizScripts = array($spath . "element/element-min.js", $spath . "datasource/datasource-min.js", $spath . "datatable/datatable-min.js");
    if (!$wgWizNextStep) {
        $searchcookie = ldGetUserCookie("ariadneDialogSearch");
        if ($searchcookie['context'] == 1) {
            $wgWizNextStep = 1;
            $this->putvar('searchname', $searchcookie['searchname']);
            $this->putvar('searchtext', $searchcookie['searchtext']);
            $this->putvar('arimplements', $searchcookie['arimplements']);
        }
        if ($searchcookie['advanced'] == 1) {
            $wgWizNextStep = 2;
            $this->putvar('query', $searchcookie['query']);
        }
    }
    $wgWizBufferOutput = true;
    // Allow sending headers
    include $this->store->get_config("code") . "widgets/wizard/yui.wizard.html";
}