Example #1
0
        $_SESSION['OPENID_FIRSTNAME'] = $openId->getFirstName();
        $_SESSION['OPENID_LASTNAME'] = $openId->getLastName();
        header('Location: ' . getRedirectUrl('access'));
        break;
    case 'gadget_login':
        global $openId;
        $redirUrl = constructPageUrl() . '?action=' . getActionString('openid_auth');
        header('Location: ' . $openId->getUrl($redirUrl));
        break;
    case 'login':
    default:
        if (!isset($_SESSION['ACCESS_TOKEN'])) {
            renderHTML('login');
        } else {
            //renderHTML('User: '******'OPENID_FIRSTNAME'] . ' ' . $_SESSION['OPENID_LASTNAME'] . '<br/> EMail: <b>' . $_SESSION['OPENID_EMAIL'] . '</b> logged-in with access token: <br> <a href="'. getRedirectUrl().'" >Logout </a>' , false);
            renderHTML('flashDisplay');
        }
        break;
}
$dbFuncsObj->doDisconnect();
function renderHTML($command)
{
    ?>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="default.css" rel="stylesheet" type="text/css">
<title>Life Parser</title>
</head>

<body>
Example #2
0
function meta_options_shortcode($shortcode_options)
{
    ?>


<?php 
    global $shortcode_options;
    echo '<div>
			<table class="metabox_table">
				<tr>
					<th class="heading"><h4><label>Shortcode</label></h4></th>
					<td class="option"><select id="first_sc_select">
							<option value="none">select the shortcode</option>';
    foreach ($shortcode_options as $shortcode) {
        echo '<option value="' . $shortcode['id'] . '">' . $shortcode['name'] . '</option>';
    }
    echo '</select>
					</td>
				</tr>
				
			
			</table>
		</div>';
    foreach ($shortcode_options as $shortcode) {
        echo '<div class="first_sc_container first_sc_container_' . $shortcode['id'] . '">';
        if (!isset($shortcode['subtype'])) {
            echo '<table class="metabox_table">';
            foreach ($shortcode['options'] as $option) {
                echo '<tr>';
                echo '<th class="heading"><h4>' . $option['name'] . '</h4></th>';
                echo '<td class="option">';
                $option['id'] = 'sc_' . $shortcode['id'] . '_' . $option['id'];
                renderHTML($option);
                echo '</td>';
                if (!isset($option['desc'])) {
                    $option['desc'] = '';
                }
                echo '<td class="description">' . $option['desc'] . '</td>';
                echo '</tr>';
            }
            echo '</table>';
        } else {
            echo '<div>
						<table class="metabox_table">
							<tr><th class="heading"><h4><label>Type</label></h4></th>
							<td class="option"><select class="secondary_sc_select secondary_sc_select_' . $shortcode['id'] . '">
									<option value="none">...</option>';
            foreach ($shortcode['options'] as $secondary_shortcode) {
                echo '<option value="' . $secondary_shortcode['id'] . '">' . $secondary_shortcode['name'] . '</option>';
            }
            echo '</select>
								 </td>
								</tr>
							</table>
						</div>';
            foreach ($shortcode['options'] as $secondary_shortcode) {
                echo '<div class="secondary_sc_container secondary_sc_container_' . $secondary_shortcode['id'] . '">
							<table class="metabox_table">';
                foreach ($secondary_shortcode['options'] as $option) {
                    echo '<tr>';
                    echo '<th class="heading"><h4>' . $option['name'] . '</h4></th>';
                    echo '<td class="option">';
                    $option['id'] = 'sc_' . $shortcode['id'] . '_' . $secondary_shortcode['id'] . '_' . $option['id'];
                    renderHTML($option);
                    echo '</td>';
                    if (!isset($option['desc'])) {
                        $option['desc'] = '';
                    }
                    echo '<td class="description">' . $option['desc'] . '</td>';
                    echo '</tr>';
                }
                echo '</table>
						</div>';
            }
        }
        echo '</div>';
    }
    ?>
		
	<table class="metabox_table">
	
		<tr>
			<th class="heading"><h4><label></label></h4></th>
			<td class="option"><input id="generate_code" class="button-primary"  value="Generate Code"/></td>
		</tr>
	
		<tr>
			<th class="heading"><h4><label>Generated Code</label></h4></th>
			<td class="option"><textarea id="generated-code"></textarea></td>
		</tr>

	
	</table>

<?php 
}
Example #3
0
        echo 'Done Request Token';
        $consumer->authorizeRequestToken();
        break;
    case 'authorize_token':
        $consumer->authorizeRequestToken();
        break;
    case 'access_token':
        $_SESSION['ACCESS_TOKEN'] = serialize($consumer->fetchAccessToken());
        header('Location: ' . $APP_URL);
        break;
    default:
        if (isset($_SESSION['ACCESS_TOKEN'])) {
            $accessToken = unserialize($_SESSION['ACCESS_TOKEN']);
            $httpClient = $accessToken->getHttpClient($consumer->getOauthOptions());
        } else {
            renderHTML();
        }
}
/**
 * Returns a the base URL of the current running web app.
 *
 * @return string
 */
function getAppURL()
{
    $pageURL = 'http://';
    if ($_SERVER['SERVER_PORT'] != '80') {
        $pageURL .= $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['PHP_SELF'];
    } else {
        $pageURL .= $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
    }
Example #4
0
<?php

function normalize($s)
{
    return htmlspecialchars($s, ENT_QUOTES, 'utf-8');
}
if (isset($_GET['f']) && !empty($_GET['f']) && $_GET['f'] !== __FILE__) {
    $content = @file_get_contents($_GET['f']);
    if ($content === FALSE) {
        renderError('<span class="error"><strong>ERROR:</strong> Failed to open stream!</span>');
    } else {
        $sc = htmlspecialchars(file_get_contents($_GET['f']));
        if (isset($_GET['embedded'])) {
            renderHTMLEmbedded($sc, normalize($_GET['f']));
        } else {
            renderHTML($sc, normalize($_GET['f']));
        }
    }
} else {
    renderError('<span class="error"><strong>ERROR:</strong> Please specify a correct file URI.</span>');
}
?>

<?php 
function renderHTML($sc, $uri)
{
    ?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
Example #5
0
}
$lang =& JFactory::getLanguage();
$lang->load('mod_addtomenu', JPATH_ADMINISTRATOR);
$lang->load('com_menus', JPATH_ADMINISTRATOR);
$lang->load($comp_file, JPATH_ADMINISTRATOR);
$insert = JRequest::getVar('insert');
if ($insert) {
    insertMenuItem($template);
} else {
    $lang =& JFactory::getLanguage();
    $lang->load($option, JPATH_ADMINISTRATOR);
    if (isset($template->urlparams->option) && $template->urlparams->option != $option) {
        $lang->load($template->urlparams->option, JPATH_ADMINISTRATOR);
        $lang->load($template->urlparams->option . '.menu', JPATH_ADMINISTRATOR);
    }
    renderHTML($template);
}
function insertMenuItem(&$template)
{
    $db =& JFactory::getDBO();
    $item =& JTable::getInstance('menu');
    $item->name = JRequest::getVar('name', '');
    $item->alias = JRequest::getVar('alias', '');
    if (!strlen($item->alias)) {
        $item->alias = $item->name;
    }
    $item->alias = filterAlias($item->alias);
    $item->published = JRequest::getVar('published', 0);
    $menuitem = JRequest::getVar('menuitem', 'mainmenu::0');
    $menuitem = explode('::', $menuitem);
    $item->menutype = $menuitem['0'];
Example #6
0
        $_SESSION['OPENID_EMAIL'] = $openId->getEMailId();
        $_SESSION['OPENID_FIRSTNAME'] = $openId->getFirstName();
        $_SESSION['OPENID_LASTNAME'] = $openId->getLastName();
        header('Location: ' . getRedirectUrl('access'));
        break;
    case 'gadget_login':
        global $openId;
        $redirUrl = constructPageUrl() . '?action=' . getActionString('openid_auth');
        header('Location: ' . $openId->getUrl($redirUrl));
        break;
    case 'login':
    default:
        if (!isset($_SESSION['ACCESS_TOKEN'])) {
            renderHTML('Click here to sign-in', true);
        } else {
            renderHTML('User: '******'OPENID_FIRSTNAME'] . ' ' . $_SESSION['OPENID_LASTNAME'] . '<br/> EMail: <b>' . $_SESSION['OPENID_EMAIL'] . '</b> logged-in with access token: <br> <a href="' . getRedirectUrl() . '" >Logout </a>', false);
        }
        break;
}
$dbFuncsObj->doDisconnect();
function renderHTML($displayMessage, $isLink)
{
    ?>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="default.css" rel="stylesheet" type="text/css">
<title>Life Parser</title>

</head>
function insertMenuItem(&$template, &$vars, &$parameters)
{
    $db = JFactory::getDBO();
    $item = JTable::getInstance('menu');
    $item->title = JRequest::getVar('name', '');
    $item->alias = JRequest::getVar('alias', '');
    if (!strlen($item->alias)) {
        $item->alias = $item->name;
    }
    $item->alias = filterAlias($item->alias);
    $item->published = JRequest::getVar('published', 0);
    $menuitem = JRequest::getVar('menuitem', 'mainmenu::0');
    $menuitem = explode('::', $menuitem);
    $item->menutype = $menuitem['0'];
    $item->parent_id = (int) $menuitem['1'];
    $item->client_id = 0;
    $item->language = '*';
    $item->level = 1;
    $item->path = $item->alias;
    if ($item->parent_id) {
        $query = 'SELECT `path`, `level`' . ' FROM #__menu' . ' WHERE id = ' . $item->parent_id . ' LIMIT 1';
        $db->setQuery($query);
        $parent = $db->loadObject();
        $item->level = (int) $parent->level;
        $item->level++;
        $item->path = $parent->path . '/' . $item->path;
    }
    $query = 'SELECT `ordering`' . ' FROM #__menu' . ' WHERE menutype = ' . $db->quote($item->menutype) . ' AND parent_id = ' . $item->parent_id . ' ORDER BY `ordering` DESC' . ' LIMIT 1';
    $db->setQuery($query);
    $item->ordering = (int) $db->loadResult();
    $item->ordering++;
    $item->type = 'component';
    $query = 'SELECT `extension_id`' . ' FROM `#__extensions`' . ' WHERE `type` = ' . $db->quote('component') . ' AND `element` = ' . $db->quote($template->urlparams->option) . ' LIMIT 1';
    $db->setQuery($query);
    $item->component_id = $db->loadResult();
    $item->link = 'index.php?';
    $urlparams = array();
    foreach ($template->urlparams as $key => $val) {
        $val = getVar($val);
        if (strlen($val)) {
            $urlparams[] = $key . '=' . $val;
        }
    }
    $item->link .= implode('&', $urlparams);
    $menuparams = array();
    foreach ($template->menuparams as $key => $val) {
        $val = getVar($val);
        if (strlen($val)) {
            $menuparams[$key] = $val;
        }
    }
    $registry = new JRegistry();
    $registry->loadArray($menuparams);
    $item->params = $registry->toObject();
    $option = $vars['option'];
    $view = isset($vars['view']) ? $vars['view'] : (isset($vars['task']) ? $vars['task'] : '');
    // add default view settings
    $path = JPath::clean(JPATH_SITE . '/components/' . $option . '/views/' . $view . '/tmpl/default.xml');
    if (JFile::exists($path)) {
        $xml = simplexml_load_file($path);
        $xml = $xml->xpath('fields[2]/fieldset/field');
        foreach ($xml as $param) {
            $name = (string) $param->attributes()->name;
            if (!isset($item->params->{$name}) || $item->params->{$name} == '') {
                $item->params->{$name} = (string) $param->attributes()->default;
            }
        }
    } else {
        // add default component settings
        $path = JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $option . '/config.xml');
        if (JFile::exists($path)) {
            $item->params = $parameters->getParams($item->params, $path);
        }
    }
    // add default menu settings
    $path = JPath::clean(JPATH_ADMINISTRATOR . '/components/com_menus/models/forms/item_component.xml');
    if (JFile::exists($path)) {
        $item->params = $parameters->getParams($item->params, $path);
    }
    $registry->loadObject($item->params);
    $item->params = $registry->toString();
    // Set the new location in the tree for the node.
    $item->setLocation($item->parent_id, 'last-child');
    $error = '';
    if (!$item->check()) {
        $error = $item->getError();
    }
    if (!$item->store()) {
        $error = $item->getError();
    }
    if ($error) {
        $error = str_replace('<br />', ' :: ', $item->getError());
        $error = explode('SQL=', $error);
        $error = trim($error['0']);
        if (!(strpos($error, 'Duplicate entry') === false)) {
            $error = JText::_('JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS');
        }
        $error = JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $error);
        JError::raiseWarning('1', $error);
        renderHTML($template);
    } else {
        echo "<script> window.parent.addtomenu_setMessage( '" . addslashes(JText::_('COM_MENUS_MENU_ITEM_SAVE_SUCCESS')) . "', 1 ); </script>\n";
    }
}
Example #8
0
    // Render the page.
    $container = $baseHTML->find("#viewport", 0);
    $container->innertext = $html;
    $phpinfo = $baseHTML->find("#phpscript", 0);
    $phpinfo->innertext = $scriptHTML;
    echo $baseHTML;
}
function getScriptParams($nickParam)
{
    global $MAP_SIZE, $TILE_SIZE;
    $sizeParams = "var mapSize = {$MAP_SIZE}; var tileSize = {$TILE_SIZE};";
    if (!is_null($nickParam)) {
        $sizeParams .= " var targetNick = '{$nickParam}';";
    }
    return $sizeParams;
}
$gridHTML = "";
$baseHTML = file_get_html("base.html");
$nickFromURL = getNickFromURL();
$nickParam = null;
if (strlen($nickFromURL) > 0) {
    $nickParam = $nickFromURL;
}
$scriptHTML = getScriptParams($nickParam);
$nicks = getAllNicks();
foreach ($nicks as $nick) {
    $outHTML = getMapHTML($nick);
    $gridHTML .= $outHTML;
}
renderHTML($baseHTML, $gridHTML, $scriptHTML);