function renderBegin()
    {
        if (isset($_GET[$this->id . '__open'])) {
            $this->open = $_GET[$this->id . '__open'] == 'true';
        }
        if ($this->open) {
            $this->options['load_on_demand'] = false;
        }
        if (!$this->options['load_on_demand']) {
            $this->setAjaxStubContext();
        }
        $w = $h = '';
        if ($this->options['has_width']) {
            $w = 'width: ' . $this->options['dimensions']['width'] . 'px';
        }
        if ($this->options['has_height']) {
            $h = 'height: ' . $this->options['dimensions']['height'] . 'px';
        }
        $style = $this->options['has_width'] || $this->options['has_height'] ? 'style="' . implode(';', array($w, $h)) . ';"' : '';
        $toret = '<div id="' . $this->id . '" class="collapsible ' . $this->getDefaultOpenClass() . '" ' . $style . '>';
        $toret .= '<h3 class="title"><a id="link__' . $this->id . '" href="' . str_replace('&', '&amp;', KT_addReplaceParam(KT_getFullUri(), $this->id . '__open', $this->open ? 'false' : 'true')) . '">' . $this->title . '</a></h3>';
        $toret .= '<div id="' . $this->id . '-body" class="collapsibleBody">
			<div class="collapsibleContent">';
        if (!$this->options['load_on_demand']) {
            $this->prevDir = getcwd();
            chdir(dirname(realpath($this->file_name)));
        }
        return $toret;
    }
 function getSortLink($column)
 {
     $sorter_reference = "sorter_" . $this->sorterName;
     $value = $this->getCurrentSort();
     $paramVal = $column;
     if ($value == $column) {
         $paramVal .= " DESC";
     }
     $url = KT_addReplaceParam(KT_getFullUri(), $sorter_reference, $paramVal);
     return $url;
 }
Exemple #3
0
 * 
 * NOTICE:  Adobe permits you to use, modify, and distribute this file in accordance with the 
 * terms of the Adobe license agreement accompanying it. If you have received this file from a 
 * source other than Adobe, then your use, modification, or distribution of it requires the prior 
 * written permission of Adobe.
 */
/*
	Copyright (c) InterAKT Online 2000-2006. All rights reserved.
*/
if (isset($_GET['KT_back'])) {
    require_once dirname(realpath(__FILE__)) . '/../common/KT_common.php';
    KT_session_start();
    $tmp = KT_addReplaceParam(KT_getFullUri(), 'KT_back');
    if (isset($_SERVER['HTTP_REFERER'])) {
        $backURL = $_SERVER['HTTP_REFERER'];
        $backURL = KT_addReplaceParam($backURL, '/^totalRows_.*$/i');
        KT_SessionKtBack($backURL);
    }
    if (isset($_POST['KT_Delete1'])) {
        echo '<html><head></head><body><form action="' . $tmp . '" method="POST" name="KT_backForm">';
        foreach ($_POST as $key => $value) {
            if ($key == 'KT_Delete1' || strpos($key, 'kt_pk_') === 0) {
                if (get_magic_quotes_gpc()) {
                    $value = stripslashes($value);
                }
                echo '<input type="hidden" name="' . $key . '" value="' . KT_escapeAttribute($value) . '" />';
            }
        }
        echo '</form><script>document.forms.KT_backForm.submit();</script></body></html>';
    } else {
        KT_redir($tmp);
    function getScripts()
    {
        $includedpath = $this->relpath;
        if (isset($GLOBALS['KT_REL_PATH'])) {
            $includedpath = $GLOBALS['KT_REL_PATH'] . $includedpath;
        }
        $url = KT_addReplaceParam(KT_getFullUri(), '/^totalRows_.*$/i');
        $flashURL = KT_addReplaceParam($url, 'isFlash');
        $flashURL = KT_addReplaceParam($flashURL, session_name(), session_id());
        $ret = '';
        $ret .= '<script src="' . $this->relpath . 'includes/tng/pub/flashembed.js" type="text/javascript" language="javascript"></script>' . "\n";
        $ret .= '<script type="text/javascript">
          //this is the unique instance of the multiple file upload object
          myupload = new tNG_FlashUpload(\'' . $includedpath . '\',\'uploadComponent\', \'progressComponent\', \'myupload\');
          myupload.setColors(\'' . $this->barColor . '\',\'' . $this->textColor . '\',\'' . $this->borderColor . '\');
          myupload.initialize(
					\'' . KT_addReplaceParam($flashURL, 'isFlash', 1) . '\',
					\'' . KT_getResource('UPLOAD', 'tNG') . '\',
					\'' . $this->maxSize . '\',
					\'' . $this->maxNumber . '\',
					\'' . $this->existentNumber . '\',
					\'' . $this->allowedExtensions . '\',
					\'' . KT_escapeJS(KT_getResource('FLASH_MAX_SIZE_REACHED', 'tNG')) . '\',
					\'' . KT_escapeJS(KT_getResource('FLASH_MAX_FILES_REACHED', 'tNG')) . '\',
					\'' . KT_escapeJS(KT_getResource('FLASH_EMPTY_FILE', 'tNG')) . '\',
					\'' . KT_escapeJS(KT_getResource('FLASH_SKIPPING', 'tNG')) . '\',
					\'' . KT_escapeJS(KT_getResource('FLASH_HTTPERROR', 'tNG')) . '\',
					\'' . KT_escapeJS(KT_getResource('FLASH_HTTPERROR_HEAD', 'tNG')) . '\',
					\'' . KT_escapeJS(KT_getResource('FLASH_IOERROR', 'tNG')) . '\',
					\'' . KT_escapeJS(KT_getResource('FLASH_IOERROR_HEAD', 'tNG')) . '\',
					\'' . KT_escapeJS(KT_getResource('FLASH_COMPLETE_MSG', 'tNG')) . '\',
					\'' . KT_escapeJS(KT_getResource('FLASH_UPLOAD_BATCH', 'tNG')) . '\',
					\'' . KT_escapeJS(KT_getResource('FLASH_UPLOAD_SINGLE', 'tNG')) . '\');          
          KT_self_url = "' . KT_addReplaceParam($url, 'isFlash') . '";
				</script>' . "\n";
        return $ret;
    }
Exemple #5
0
 function checkBoundries()
 {
     if (isset($_GET['KT_az'])) {
         $cond = KT_getRealValue("GET", "KT_az");
         $do_redirect = false;
         if ($this->linkRenderType != 2) {
             if (!in_array($cond, $this->arrLetters)) {
                 $do_redirect = true;
             }
         } else {
             $allowed = range('A', 'Z');
             if ($this->useNumbers) {
                 $allowed[] = "0_9";
             }
             $allowed[] = "other";
             $allowed[] = "all";
             if (!in_array($cond, $allowed)) {
                 $do_redirect = true;
             }
         }
         if ($do_redirect) {
             $KT_url = KT_getFullUri();
             $KT_url = KT_addReplaceParam($KT_url, 'KT_az');
             KT_redir($KT_url);
         }
     }
 }
Exemple #6
0
	Copyright (c) InterAKT Online 2000-2006. All rights reserved.
*/
require_once '../common/KT_common.php';
KT_setServerVariables();
KT_session_start();
if (!isset($_SESSION['KT_backArr'])) {
    if (isset($_SERVER['HTTP_REFERER'])) {
        $_SESSION['KT_backArr'] = array();
        array_push($_SESSION['KT_backArr'], $_SERVER['HTTP_REFERER']);
    } else {
        //TODO
        die('There is no page set to go back to. Please click the Back link to be redirected to the form. <a href="javascript: history.go(-1)">Back</a>');
    }
} else {
    if (count($_SESSION['KT_backArr']) < 1) {
        if (isset($_SESSION['KT_exBack'])) {
            array_push($_SESSION['KT_backArr'], $_SESSION['KT_exBack']);
        } else {
            //TODO
            die('Internal Error');
        }
    }
}
$KT_back = array_pop($_SESSION['KT_backArr']);
if (count($_SESSION['KT_backArr'] > 0) && isset($_GET['KT_back']) && $_GET['KT_back'] == -2) {
    $KT_back = array_pop($_SESSION['KT_backArr']);
}
$_SESSION['KT_exBack'] = $KT_back;
$KT_back = KT_addReplaceParam($KT_back, '/^totalRows_.*$/i');
KT_redir($KT_back);
exit;
Exemple #7
0
/** 
 * Add these fields/values to transaction: kt_login_user, kt_login_password, kt_login_page, kt_login_redirect;
 * Register the trigger Trigger_ForgotPassword_RemoveDynamicFields on ERROR
 * @param object tNG transaction object
 * @return nothing
 * @access public
 */
function Trigger_ForgotPassword_AddDynamicFields(&$tNG)
{
    $tNG->addColumn("kt_login_user", "STRING_TYPE", "VALUE", $tNG->kt_login_user);
    $tNG->addColumn("kt_login_password", "STRING_TYPE", "VALUE", $tNG->kt_login_password);
    $tmpRelPath = KT_makeIncludedURL($tNG->dispatcher->relPath);
    $login_page = KT_Rel2AbsUrl(KT_getUri(), $tmpRelPath, $GLOBALS['tNG_login_config']['login_page'], true);
    $tNG->addColumn("kt_login_page", "STRING_TYPE", "VALUE", $login_page);
    $redirect_page = KT_addReplaceParam($tmpRelPath . $GLOBALS['tNG_login_config']['login_page'], "info", "FORGOT");
    $tNG->addColumn("kt_login_redirect", "STRING_TYPE", "VALUE", $redirect_page);
    $tNG->registerTrigger("ERROR", "Trigger_ForgotPassword_RemoveDynamicFields", -100);
    return null;
}
    function getScripts()
    {
        $includedpath = $this->relpath;
        if (isset($GLOBALS['KT_REL_PATH'])) {
            $includedpath = $GLOBALS['KT_REL_PATH'] . $includedpath;
        }
        $url = KT_addReplaceParam(KT_getFullUri(), '/^totalRows_.*$/i');
        $ret = '';
        $ret .= '<script src="' . $this->relpath . 'includes/tng/pub/flashembed.js" type="text/javascript" language="javascript"></script>' . "\n";
        $ret .= '<script type="text/javascript">
//this is the unique instance of the multiple file upload object
myupload = new tNG_FlashUpload(\'' . $includedpath . '\',\'multiple-file-upload-container\',\'myupload\');' . 'myupload.setColors(\'' . $this->barColor . '\',\'' . $this->textColor . '\',\'' . $this->borderColor . '\');
KT_self_url = "' . KT_addReplaceParam($url, 'isFlash') . '";
				</script>' . "\n";
        return $ret;
    }
Exemple #9
0
 /**
  * getter. get the navigation link for the given element: first, next, previous, last
  * @return string;
  * @access public
  */
 function getNavLink($element)
 {
     $ret = "javascript: void(0);";
     switch (strtolower($element)) {
         case "first":
             if ($this->getPageNum() > 0) {
                 $ret = $this->url;
                 $ret = KT_addReplaceParam($ret, "show_filter_" . $this->listName);
                 $ret = KT_addReplaceParam($ret, "reset_filter_" . $this->listName);
                 $ret = KT_addReplaceParam($ret, "pageNum_" . $this->rsName, 0);
                 $ret = KT_addReplaceParam($ret, "totalRows_" . $this->rsName, $this->getTotalRows());
             }
             break;
         case "previous":
             if ($this->getPageNum() > 0) {
                 $ret = $this->url;
                 $ret = KT_addReplaceParam($ret, "show_filter_" . $this->listName);
                 $ret = KT_addReplaceParam($ret, "reset_filter_" . $this->listName);
                 $ret = KT_addReplaceParam($ret, "pageNum_" . $this->rsName, max(0, $this->getPageNum() - 1));
                 $ret = KT_addReplaceParam($ret, "totalRows_" . $this->rsName, $this->getTotalRows());
             }
             break;
         case "next":
             if ($this->getPageNum() < $this->getTotalPages()) {
                 $ret = $this->url;
                 $ret = KT_addReplaceParam($ret, "show_filter_" . $this->listName);
                 $ret = KT_addReplaceParam($ret, "reset_filter_" . $this->listName);
                 $ret = KT_addReplaceParam($ret, "pageNum_" . $this->rsName, min($this->getTotalPages(), $this->getPageNum() + 1));
                 $ret = KT_addReplaceParam($ret, "totalRows_" . $this->rsName, $this->getTotalRows());
             }
             break;
         case "last":
             if ($this->getPageNum() < $this->getTotalPages()) {
                 $ret = $this->url;
                 $ret = KT_addReplaceParam($ret, "show_filter_" . $this->listName);
                 $ret = KT_addReplaceParam($ret, "reset_filter_" . $this->listName);
                 $ret = KT_addReplaceParam($ret, "pageNum_" . $this->rsName, $this->getTotalPages());
                 $ret = KT_addReplaceParam($ret, "totalRows_" . $this->rsName, $this->getTotalRows());
             }
             break;
     }
     return $ret;
 }
Exemple #10
0
 /**
  * getter. get the url for logout
  * @return string 
  * @access public
  */
 function getLogoutLink()
 {
     return KT_addReplaceParam(KT_getFullUri(), 'KT_logout_now', 'true');
 }
Exemple #11
0
 function checkBoundries()
 {
     if (isset($_GET[$this->getVarName])) {
         $needle = KT_getRealValue("GET", $this->getVarName);
         if (!in_array($needle, $this->arrCategory)) {
             $KT_url = KT_getFullUri();
             $KT_url = KT_addReplaceParam($KT_url, $this->getVarName);
             KT_redir($KT_url);
         }
     }
 }
Exemple #12
0
 /**
  * Prepare the hash values and store it in the session; Return the calculated link.
  * @return string url for download the file
  * @access public
  */
 function getDownloadLink()
 {
     $this->preparedFolder = $this->folder;
     //security
     $fullFolderPath = KT_realpath($this->preparedFolder, true);
     $fullFilePath = KT_DynamicData($this->renameRule, null);
     $fullFilePath = KT_realpath($this->preparedFolder . $fullFilePath, true);
     if (substr($fullFilePath, 0, strlen($fullFolderPath)) != $fullFolderPath) {
         $this->setError(new tNG_error("FOLDER_DEL_SECURITY_ERROR", array(), array($fullFolderPath, $fullFilePath)));
         return $this->relPath . 'includes/tng/pub/tNG_download4.php';
     }
     $url = '';
     if (!isset($_SESSION['tng_download'])) {
         $_SESSION['tng_download'] = array();
     }
     if (!isset($_SESSION['tng_download'][$this->reference])) {
         $_SESSION['tng_download'][$this->reference] = array();
     }
     // sets the common values;
     if (!$this->isSetted) {
         $_SESSION['tng_download'][$this->reference]['properties'] = array();
         $_SESSION['tng_download'][$this->reference]['properties']['time'] = time();
         $_SESSION['tng_download'][$this->reference]['properties']['table'] = $this->table;
         if (isset($this->pk['field']) && isset($this->pk['type'])) {
             $_SESSION['tng_download'][$this->reference]['properties']['pk_c'] = array('field' => $this->pk['field'], 'type' => $this->pk['type']);
         } else {
             $_SESSION['tng_download'][$this->reference]['properties']['pk_c'] = array();
         }
         $_SESSION['tng_download'][$this->reference]['properties']['counterField'] = $this->counterField;
         $_SESSION['tng_download'][$this->reference]['properties']['tableMtm'] = $this->tableMtm;
         if (isset($this->pkMtm['field']) && isset($this->pkMtm['type'])) {
             $_SESSION['tng_download'][$this->reference]['properties']['pkMtm_c'] = array('field' => $this->pkMtm['field'], 'type' => $this->pkMtm['type']);
         } else {
             $_SESSION['tng_download'][$this->reference]['properties']['pkMtm_c'] = array();
         }
         if (isset($this->fkMtm['field']) && isset($this->fkMtm['type'])) {
             $_SESSION['tng_download'][$this->reference]['properties']['fkMtm_c'] = array('field' => $this->fkMtm['field'], 'type' => $this->fkMtm['type']);
         } else {
             $_SESSION['tng_download'][$this->reference]['properties']['fkMtm_c'] = array();
         }
         $_SESSION['tng_download'][$this->reference]['properties']['counterFieldMtm'] = $this->counterFieldMtm;
         $_SESSION['tng_download'][$this->reference]['properties']['maxCounterFieldMtm'] = $this->maxCounterFieldMtm;
         $_SESSION['tng_download'][$this->reference]['properties']['maxCounterValueMtm'] = $this->maxCounterValueMtm;
         $_SESSION['tng_download'][$this->reference]['properties']['conn'] = $this->connName;
         $_SESSION['tng_download'][$this->reference]['properties']['relPath'] = $this->relPath;
         $_SESSION['tng_download'][$this->reference]['properties']['backUri'] = KT_getFullUri();
         $_SESSION['tng_download'][$this->reference]['files'] = array();
         $this->isSetted = true;
     }
     // set the class members in hash session to use in the download page;
     $hash = md5(uniqid("", true));
     $_SESSION['tng_download'][$this->reference]['files'][$hash] = array();
     $_SESSION['tng_download'][$this->reference]['files'][$hash]['folder'] = $this->preparedFolder;
     $_SESSION['tng_download'][$this->reference]['files'][$hash]['fileName'] = KT_DynamicData($this->renameRule, null);
     if (isset($this->pk['reference']) && $this->pk['reference'] != '') {
         $_SESSION['tng_download'][$this->reference]['files'][$hash]['pk'] = KT_DynamicData($this->pk['reference'], null);
     }
     if (isset($this->pkMtm['reference']) && $this->pkMtm['reference'] != '') {
         $_SESSION['tng_download'][$this->reference]['files'][$hash]['pkMtm'] = KT_DynamicData($this->pkMtm['reference'], null);
     }
     if (isset($this->fkMtm['field']) && $this->fkMtm['field'] != '' && isset($_SESSION['kt_login_id'])) {
         $_SESSION['tng_download'][$this->reference]['files'][$hash]['fkMtm'] = $_SESSION['kt_login_id'];
     }
     $url = $this->relPath . 'includes/tng/pub/tNG_download4.php';
     $arr = array();
     foreach ($_GET as $key => $val) {
         if (!preg_match("/^KT_download/is", $key)) {
             $arr[] = $key . '=' . $val;
         }
     }
     $url .= '?' . implode('&', $arr);
     $url = KT_addReplaceParam($url, $this->reference, $hash);
     return $url;
 }
Exemple #13
0
 /**
  * Main method of the class. make the redirect
  * @return nothing
  * @access public
  */
 function Execute()
 {
     if (!isset($this->tNG)) {
         $page = KT_DynamicData($this->URL, null, 'rawurlencode');
     } else {
         $useSavedData = false;
         if ($this->tNG->getTransactionType() == '_delete' || $this->tNG->getTransactionType() == '_multipleDelete') {
             $useSavedData = true;
         }
         $page = KT_DynamicData($this->URL, $this->tNG, 'rawurlencode', $useSavedData);
     }
     if ($this->keepUrlParams) {
         foreach ($_GET as $param => $value) {
             $page = KT_addReplaceParam($page, $param, $value);
         }
     }
     KT_redir($page);
 }
Exemple #14
0
 function getShowAllLink()
 {
     $show_all_reference = "show_all_" . $this->navName;
     if (isset($_GET[$show_all_reference])) {
         $url = KT_addReplaceParam(KT_getFullUri(), $show_all_reference);
     } else {
         $url = KT_addReplaceParam(KT_getFullUri(), $show_all_reference, "1");
     }
     $url = KT_addReplaceParam($url, 'pageNum_' . $this->rsName);
     $url = KT_addReplaceParam($url, 'totalRows_' . $this->rsName);
     return $url;
 }
/**
 * Add the URL to the $_SESSION['KT_backArr'] array if this array not exist;
 * If the array $_SESSION['KT_backArr'] exist check if the last entry is identical with the argument; 
 * If this 2 url are identical the old one is replaced with the new one, if not the new one is append it.
 * @param string $newUrl the url to be add to the array; 
 * @return nothing;
 */
function KT_SessionKtBack($newUrl)
{
    KT_session_start();
    $newUrl = KT_addReplaceParam($newUrl, 'KT_ajax_request');
    if (!isset($_SESSION['KT_backArr'])) {
        $_SESSION['KT_backArr'] = array();
        array_push($_SESSION['KT_backArr'], $newUrl);
    } elseif (count($_SESSION['KT_backArr']) > 0) {
        $oldUrl = array_pop($_SESSION['KT_backArr']);
        $toldUrl = KT_addReplaceParam($oldUrl, '/^pageNum_.*$/i');
        $toldUrl = KT_addReplaceParam($toldUrl, '/^totalRows_.*$/i');
        $toldUrl = KT_addReplaceParam($toldUrl, '/^sorter_.*$/i');
        $toldUrl = KT_addReplaceParam($toldUrl, '/^show_all_.*$/i');
        $toldUrl = KT_addReplaceParam($toldUrl, '/^show_filter_.*$/i');
        $toldUrl = KT_addReplaceParam($toldUrl, '/^reset_filter_.*$/i');
        $toldUrl = KT_addReplaceParam($toldUrl, 'isFlash');
        $toldUrl = KT_addReplaceParam($toldUrl, session_name());
        $tnewUrl = KT_addReplaceParam($newUrl, '/^pageNum_.*$/i');
        $tnewUrl = KT_addReplaceParam($tnewUrl, '/^totalRows_.*$/i');
        $tnewUrl = KT_addReplaceParam($tnewUrl, '/^sorter_.*$/i');
        $tnewUrl = KT_addReplaceParam($tnewUrl, '/^show_all_.*$/i');
        $tnewUrl = KT_addReplaceParam($tnewUrl, '/^show_filter_.*$/i');
        $tnewUrl = KT_addReplaceParam($tnewUrl, '/^reset_filter_.*$/i');
        $tnewUrl = KT_addReplaceParam($tnewUrl, 'isFlash');
        $tnewUrl = KT_addReplaceParam($tnewUrl, session_name());
        if ($tnewUrl != $toldUrl) {
            array_push($_SESSION['KT_backArr'], $oldUrl);
        }
        array_push($_SESSION['KT_backArr'], $newUrl);
    } else {
        array_push($_SESSION['KT_backArr'], $newUrl);
    }
}
 /**
  * Get the logout for starting the logout transaction
  * @return string current url on which is added KT_logout_nou=1 
  * @access public
  */
 function getLogoutLink()
 {
     $ret = KT_getFullURI();
     $ret = KT_addReplaceParam($ret, "KT_logout_now", "1");
     return $ret;
 }
 /**
  * Main method of the class. grant the access to the page or make the redirect page setted in control panel
  * @return mix null or error object
  * @access public
  */
 function Execute()
 {
     tNG_cookieLogin($this->connection);
     // access denied defaults to "redirect_failed" specified in Login Config
     $grantAccess = false;
     $redirect_page = $GLOBALS['tNG_login_config']['redirect_failed'];
     tNG_clearSessionVars();
     if (isset($_SESSION['kt_login_user'])) {
         if (count($this->levels) > 0) {
             if (isset($_SESSION['kt_login_level'])) {
                 if (in_array($_SESSION['kt_login_level'], $this->levels)) {
                     $grantAccess = true;
                 } else {
                     // acceess denied. check for level default redirect pages
                     if (is_array($GLOBALS['tNG_login_config_redirect_failed']) && array_key_exists($_SESSION['kt_login_level'], $GLOBALS['tNG_login_config_redirect_failed']) and $GLOBALS['tNG_login_config_redirect_failed'][$_SESSION['kt_login_level']] != "") {
                         $redirect_page = $GLOBALS['tNG_login_config_redirect_failed'][$_SESSION['kt_login_level']];
                     } else {
                         // the failure page for the current user level is not defined.. so fall back to default
                         $redirect_page = $GLOBALS['tNG_login_config']['redirect_failed'];
                     }
                 }
             }
             // if levels are required, and the current user doesn't have one.. access is denied
         } else {
             // no levels are required for this page access
             // the user is logged in, so grant the access
             $grantAccess = true;
         }
     }
     if (!$grantAccess) {
         // save the accessed page into a session for later use
         $_SESSION['KT_denied_pageuri'] = KT_getFullUri();
         KT_setSessionVar('KT_denied_pageuri');
         $_SESSION['KT_denied_pagelevels'] = $this->levels;
         KT_setSessionVar('KT_denied_pagelevels');
         if (isset($_SESSION['KT_max_tries_error'])) {
             $redirect_page = KT_addReplaceParam($redirect_page, 'info', 'MAXTRIES');
         } else {
             if (isset($_SESSION['KT_account_expire_error'])) {
                 $redirect_page = KT_addReplaceParam($redirect_page, 'info', 'ACCOUNT_EXPIRE');
             } else {
                 $redirect_page = KT_addReplaceParam($redirect_page, 'info', 'DENIED');
             }
         }
         KT_redir($this->relPath . $redirect_page);
     } else {
         // clear the sessions used for redirect ??
     }
 }
    function renderJavascriptStubs()
    {
        $toret = '
			<script type="text/javascript">' . "\n";
        $toret .= '<!--' . "\n";
        if (!isset($GLOBALS['stub_loader'])) {
            $toret .= '
				var StubFilesLoaded = false;
				function loadStubFiles(callback, args) {
					var StubJSLoader = new Kore.JSLoader();
					StubJSLoader.addFile("includes/yui/yahoo/yahoo.js");
					StubJSLoader.addFile("includes/yui/event/event.js");
					StubJSLoader.addFile("includes/yui/connection/connection.js");
					StubJSLoader.addFile("includes/kore/js/error.js");
					StubJSLoader.addFile("includes/kore/js/dataprovider/transporter.js");
					StubJSLoader.addFile("includes/kore/js/dataprovider/dataprovider.js");
					StubJSLoader.addFile("includes/kore/js/dataprovider/jsonprovider.js");
					StubJSLoader.loadFiles(function() {
						StubFilesLoaded = true;
						callback.apply(null, args);
					});
				}';
            $GLOBALS['stub_loader'] = true;
        }
        foreach ($this->exportedMethods as $m) {
            $obj_prefix1 = '';
            $obj_prefix2 = '';
            if ($m['object']) {
                $obj_prefix1 = $m['object'] . '_';
                $obj_prefix2 = $m['object'];
            }
            $toret .= '
				' . $obj_prefix1 . $m['method'] . ' = function() {
					if(!StubFilesLoaded) { loadStubFiles(' . $obj_prefix1 . $m['method'] . ', arguments);return;};
					var params = arguments;
					var functor = params[params.length-1];
					var postOptions;
					var hash = {
						"AjaxServiceCall": "true", 
						"ServiceObject" : "' . $obj_prefix2 . '", 
						"ServiceMethod" : "' . $m['method'] . '"
					};
					for (var i = 0; i < params.length-1; i++) {
						var sPar = params[i];
						if((typeof params[i] == "string") && /^\\{[^\\}]+\\}$/.test(params[i])){
							try {
								eval("var tmpObj = " + params[i]);
								Object.extend(hash, tmpObj);
							} catch(e) {};
						} else {
							if (params[i].toString() == "POST-DATA") {
								postOptions = {method: "POST", postData: params[i+1]};
								break;	
							}
							else {
								hash["params_"+i] = params[i];	
							}
						};
					}
					var url; 
					';
            if (isset($GLOBALS["stub_context"])) {
                // this file is included as the opened region in a widget
                $toret .= 'url = "' . KT_addReplaceParam($GLOBALS["stub_context"], "KT_ajax_request", "true") . '";
					';
            } else {
                if (KT_is_ajax_request()) {
                    // this page is called from a widget to output content for a region
                    $toret .= 'url = "' . KT_getFullUri() . '";
				';
                } else {
                    $toret .= '
					var L = window.location;
					url = L.protocol + "//" + L.host + L.pathname + L.search;
					if(typeof window.$ctrl != "undefined") {
                        // on a master page
						var hashParams = window.location.hash.replace(/^#/, "");
						if(hashParams){ 
						    url = window.$app_path + "?" + hashParams;
                        }
                        
                        ';
                    if (isset($GLOBALS['me'])) {
                        $toret .= '
                            var currentPanel = "' . $GLOBALS['me']->id . '";
                            url = url.replace(/[^\\?&]*__state=[^&]*/i, "");
						    if ( !(new RegExp(currentPanel + "__state=","i").test(hashParams)) ) {
                                    url += (/\\?/.test(url)? "&" : "?");
						            url += currentPanel + "__state=' . $GLOBALS['me']->currentState . '";
						    }
                            url = url.replace(/\\?&/i, "?");
                            ';
                    }
                    $toret .= '
					}
					url += (/\\?/.test(url)? "&" : "?");
					url += "KT_ajax_request=true";
					';
                }
            }
            $toret .= '
					var _querry = $H(hash).toQueryString();
					if(_querry){
						url += (/\\?/.test(url)? "&" : "?");
					}
					url += _querry;
					var provider;
					if (typeof postOptions == "undefined") {
					   	provider = new Kore.JsonProvider(url);
					} else {
						provider = new Kore.JsonProvider(url, postOptions);
					}
					provider.updateEvent.subscribe(functor, provider, true);
					provider.getContent();
				}';
        }
        $toret .= '
            //-->
			</script>
		';
        return $toret;
    }
Exemple #19
0
    function renderBegin()
    {
        $this->setTabFromUri();
        $this->setAjaxStubContext();
        $this->w = $this->h = '';
        if ($this->options['has_width']) {
            $this->w = 'width: ' . $this->options['dimensions']['width'] . 'px';
        }
        if ($this->options['has_height']) {
            $this->h = 'height: ' . $this->options['dimensions']['height'] . 'px';
        }
        $style = $this->options['has_width'] || $this->options['has_height'] ? 'style="' . implode(';', array($this->w, $this->h)) . ';"' : '';
        $toret = '<div id="' . $this->id . '" class="tabset phprendering" ' . ($this->options['has_width'] ? 'style="' . $this->w : '') . '">';
        $toret .= '<ul class="tabset_tabs">';
        for ($i = 0; $i < count($this->tabs); $i++) {
            $toret .= '
				<li id="' . $this->id . 'tab' . $i . '-tab" class="tab ' . $this->getNavigationSelectedClass($i) . '"><a id="link__' . $this->id . 'tab' . $i . '" href="' . str_replace('&', '&amp;', KT_addReplaceParam(KT_getFullUri(), $this->id . '__tab', $i) . '">' . $this->tabs[$i]['title']) . '</a></li>';
        }
        $toret .= '</ul>';
        for ($i = 0; $i < count($this->tabs); $i++) {
            $toret .= '
				<div id="' . $this->id . 'tab' . $i . '-body" class="tabBody ' . $this->getContentSelectedClass($i) . '" ' . ($this->options['has_width'] || $this->options['has_height'] ? 'style="' . implode(';', array($this->w, $this->h)) . ';overflow: auto;"' : '') . '>
					<div class="tabContent">';
            if ($i == $this->selected) {
                break;
            }
            $toret .= '</div>
				</div>';
        }
        $this->prevDir = getcwd();
        chdir(dirname(realpath($this->tabs[$this->selected]['file'])));
        return $toret;
    }
 /**
  * Getter. Gets the link to the upload page
  * sets in session the neccesary info
  * @return string
  * @access public
  */
 function getUploadLink()
 {
     if (!$this->checkSecurity()) {
         return '';
     }
     $siteroot = KT_realpath($this->relPath, true);
     $uploadFolder = KT_realpath($this->baseFolder, true);
     $this->baseFolder = $this->relPath . substr($uploadFolder, strlen($siteroot));
     $url = '';
     if (!isset($_SESSION['tng_upload'])) {
         $_SESSION['tng_upload'] = array();
     }
     $this->noOfCalls++;
     if ($this->noOfCalls == 1) {
         $this->garbageCollector();
         if (!isset($_POST[$this->reference . '_' . $this->noOfCalls]) || !isset($_SESSION['tng_upload'][$this->reference]['files'])) {
             $_SESSION['tng_upload'][$this->reference] = array();
             $_SESSION['tng_upload'][$this->reference]['properties'] = array();
             $_SESSION['tng_upload'][$this->reference]['properties']['maxSize'] = $this->maxSize;
             $_SESSION['tng_upload'][$this->reference]['properties']['maxFiles'] = $this->maxFiles;
             $_SESSION['tng_upload'][$this->reference]['properties']['allowedExtensions'] = $this->allowedExtensions;
             $_SESSION['tng_upload'][$this->reference]['properties']['relPath'] = $this->relPath;
             $_SESSION['tng_upload'][$this->reference]['properties']['connName'] = $this->connName;
             $_SESSION['tng_upload'][$this->reference]['properties']['time'] = time();
             $_SESSION['tng_upload'][$this->reference]['files'] = array();
         }
         if (isset($_SESSION['tng_upload'][$this->reference]['files'])) {
             $tmpArr = array();
             for ($i = 1; $i <= count($_SESSION['tng_upload'][$this->reference]['files']); $i++) {
                 if ($_SESSION['tng_upload'][$this->reference]['files'][$i] !== null) {
                     $tmpArr[count($tmpArr) + 1] = $_SESSION['tng_upload'][$this->reference]['files'][$i];
                 }
             }
             $_SESSION['tng_upload'][$this->reference]['files'] = $tmpArr;
         }
     }
     $pk = KT_DynamicData($this->pkRenameRule, null);
     if ($pk == $this->pkRenameRule) {
         $pk = '';
     }
     if (!isset($_POST[$this->reference . '_' . $this->noOfCalls]) || !isset($_SESSION['tng_upload'][$this->reference]['files'][$this->noOfCalls])) {
         $_SESSION['tng_upload'][$this->reference]['files'][$this->noOfCalls] = array();
         if ($pk == '') {
             $_SESSION['tng_upload'][$this->reference]['files'][$this->noOfCalls]['pk'] = str_replace('.', '_', uniqid("", true));
             if ($this->noOfCalls == 1) {
                 $_SESSION['tng_upload'][$this->reference]['properties']['pkRule'] = $this->pk;
                 $_SESSION['tng_upload'][$this->reference]['properties']['folderRule'] = $this->baseFolder . $this->folder;
             }
         } else {
             $_SESSION['tng_upload'][$this->reference]['files'][$this->noOfCalls]['pk'] = $pk;
         }
         $_SESSION['tng_upload'][$this->reference]['files'][$this->noOfCalls]['folder'] = str_replace('{' . $this->pk . '}', $_SESSION['tng_upload'][$this->reference]['files'][$this->noOfCalls]['pk'], $this->baseFolder . $this->folder);
     }
     $url = $this->relPath . 'includes/tng/pub/multiple_upload.php';
     $url = KT_addReplaceParam($url, $this->reference, $this->noOfCalls);
     return $url;
 }
 function getResetFilterLink()
 {
     $reset_filter_reference = "reset_filter_" . $this->filterName;
     if (isset($_GET[$reset_filter_reference])) {
         $url = KT_addReplaceParam(KT_getFullUri(), $reset_filter_reference);
     } else {
         $url = KT_addReplaceParam(KT_getFullUri(), $reset_filter_reference, "1");
         $url = KT_addReplaceParam($url, '/pageNum_.*/');
         $url = KT_addReplaceParam($url, '/totalRows_.*/');
     }
     return $url;
 }