public function view() { $title = $this->params[0]; $curl = getCurrentUrl(); $extPath = '/app/ext/addtoany'; $html=<<<HTML <!-- AddToAny BEGIN --> <a class="a2a_dd" href="#"><img src="$extPath/img/share_save.png" width="171" height="16" border="0" alt="Share"/></a> <script type="text/javascript"> function my_addtoany_onready() { // A custom "onReady" function for AddToAny a2a_config.target = '.a2a_dd'; a2a.init('page'); } var a2a_config = { // Setup AddToAny "onReady" callback tracking_callback: ["ready", my_addtoany_onready] }; a2a_config.linkname = "$title"; a2a_config.linkurl = "$curl"; (function(){ // Load AddToAny script asynchronously var a = document.createElement('script'); a.type = 'text/javascript'; a.async = true; a.src = '$extPath/js/page.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(a, s); })(); </script> <!-- AddToAny END --> HTML; echo $html; }
function sendEmailConfirmation($db, $email) { $sql = 'SELECT * FROM users WHERE email = :email'; $stmt = $db->prepare($sql); $stmt->bindValue('email', $email); $stmt->execute(); if ($result = $stmt->fetch()) { $id = $result["id"]; $key = $result["secret"]; $url = getCurrentUrl() . "confirm.php?id=" . $id . '&key=' . $key; $subject = "Email de confirmation - mailinglist"; $message = '<html><body>'; $message .= '<h1>Veuillez cliquer sur le lien suivant pour valider votre inscription à la newsletter (mailinglist) :</h1>'; $message .= '<a href="' . $url . '">' . $url . '</a>'; $message .= '<br/><br/><br/><br/><br/>'; $message .= '<a href="' . getCurrentUrl() . "unsubscribe.php?id=" . $id . '&key=' . $key . '" style="font-size: 10px; text-align: center;">Se désinscrire</a>'; $message .= '</body></html>'; $headers = "From: no-reply@mailinglist.com\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=UTF-8\r\n"; $envoi = mail($email, $subject, $message, $headers); if ($envoi) { return true; } } }
function getAuthSubUrl() { $next = getCurrentUrl(); $scope = 'https://picasaweb.google.com/lh/myphotos?noredirect=1'; $secure = 0; $session = 1; return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session); }
function getAuthSubUrl() { $next = getCurrentUrl(); $scope = 'http://picasaweb.google.com/data'; $secure = 0; $session = 1; return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session); }
/** * Returns the AuthSub URL which the user must visit to authenticate requests * from this application. * * Uses getCurrentUrl() to get the next URL which the user will be redirected * to after successfully authenticating with the Google service. * * @return string AuthSub URL */ function getAuthSubUrl() { $next = getCurrentUrl(); $scope = 'http://www.google.com/base/feeds/'; $secure = false; $session = true; return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session); }
function getRedirectUrl() { $currUrl = getCurrentUrl(); if (!stristr($currUrl, '?')) { $currUrl .= "?"; } $currUrl = preg_replace('/&lang_code=\\w{2}$|&lang_code=\\w{2}&/i', '', $currUrl, 1, $count); return $currUrl; }
/** * Construct an abstract element with the given options * Sets the url property to the current url for convenience * @param array $options Array of key => value options to use with this element */ public function __construct(array $options = array()) { // Set the name of this button $this->name = strtolower(substr(get_called_class(), strrpos(get_called_class(), '\\') + 1)); // Most buttons take a url, add it for convenience $options = array_merge(array('url' => getCurrentUrl()), $options); foreach ($options as $name => $value) { $this->{$name} = $value; } $this->templateDir = __DIR__ . '/../../../templates/' . strtolower(getClassName($this)); }
/** * 系统主页 */ public function index() { //读取团购 $deal_model = M("Deal"); $deal = $deal_model->order("ctime")->find(); $this->assign("deal", $deal); //分享处理 $share['url'] = urlencode(getCurrentUrl()); $share['content'] = urlencode($deal['title']); $this->assign("share", $share); $this->display(); }
/** * Created by PhpStorm. * User: caipeichao * Date: 14-3-10 * Time: PM7:40 */ function getPagination($totalCount, $countPerPage = 10) { $pageKey = 'page'; //获取当前页码 $currentPage = intval($_REQUEST[$pageKey]) ? intval($_REQUEST[$pageKey]) : 1; //计算总页数 $pageCount = ceil($totalCount / $countPerPage); //如果只有1页,就没必要翻页了 if ($pageCount <= 1) { return ''; } $Page = new \Think\Page($totalCount, $countPerPage); // 实例化分页类 传入总记录数和每页显示的记录数 return $Page->show(); //定义返回结果 $html = ''; //添加头部 $html .= '<div class="pagination">'; //添加上一页的按钮 if ($currentPage > 1) { $prevUrl = addUrlParam(getCurrentUrl(), array($pageKey => $currentPage - 1)); $html .= "<li><a class=\"\" href=\"{$prevUrl}\">«</a></li>"; } else { $html .= "<li class=\"disabled\"><a>«</a></li>"; } //添加各页面按钮 for ($i = 1; $i <= $pageCount; $i++) { $pageUrl = addUrlParam(getCurrentUrl(), array($pageKey => $i)); if ($i == $currentPage) { $html .= "<li class=\"active\"><a class=\"active\" href=\"{$pageUrl}\">{$i}</a></li>"; } else { $html .= "<li><a class=\"\" href=\"{$pageUrl}\">{$i}</a></li>"; } } //添加下一页按钮 if ($currentPage < $pageCount) { $nextUrl = addUrlParam(getCurrentUrl(), array($pageKey => $currentPage + 1)); $html .= "<li><a class=\"\" href=\"{$nextUrl}\">»</a></li>"; } else { $html .= "<li class=\"disabled\"><a>»</a></li>"; } //收尾 $html .= '</div>'; return $html; }
function logged_in() { global $script_path; // If session is not found or IP has changed or the uid is not found the user is not logged in if (empty($_SESSION['uid']) || empty($_SESSION['ip']) || $_SESSION['ip'] != $_SERVER['REMOTE_ADDR'] || checkUid($_SESSION['uid']) == false) { setcookie("last_url", getCurrentUrl()); // Save last url in a cookie if (getSetting("use_redirect_notloggedin", "text") == "true") { header('Location: ' . getSetting("redirect_notloggedin", "text")); } else { if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off") { header('Location: https://www.' . getCurrentDomain() . $script_path . 'login.php?m=1'); } else { header('Location: http://www.' . getCurrentDomain() . $script_path . 'login.php?m=1'); } } exit; } }
<?php if (!defined('__URL__')) { define('__URL__', getCurrentUrl()); } if (!defined('__PUBLIC__')) { define('__PUBLIC__', setPublicUrl('/Public')); }
?> ', 'text_editor':'<?php echo CONFIG_URL_TEXT_EDITOR; ?> ', 'image_editor':'<?php echo CONFIG_URL_IMAGE_EDITOR; ?> ', 'download':'<?php echo CONFIG_URL_DOWNLOAD; ?> ', 'present':'<?php echo Tools::safeOutput(getCurrentUrl()); ?> ', 'home':'<?php echo CONFIG_URL_HOME; ?> ', 'view':'<?php echo CONFIG_URL_LIST_LISTING; ?> ' }; var permits = {'del':<?php echo CONFIG_OPTIONS_DELETE ? 1 : 0; ?> , 'cut':<?php
function authenticate($singleUseToken = null) { $sessionToken = isset($_SESSION['sessionToken']) ? $_SESSION['sessionToken'] : null; // If there is no AuthSub session or one-time token waiting for us, // redirect the user to Google Health's AuthSub handler to get one. if (!$sessionToken && !$singleUseToken) { $next = getCurrentUrl(); $secure = 1; $session = 1; $authSubHandler = 'https://www.google.com/h9/authsub'; $permission = 1; // 1 - allows reading of the profile && posting notices $authSubURL = Zend_Gdata_AuthSub::getAuthSubTokenUri($next, SCOPE, $secure, $session, $authSubHandler); $authSubURL .= '&permission=' . $permission; echo '<a href="' . $authSubURL . '">Link your Google Health Account</a>'; exit; } $client = new Zend_Gdata_HttpClient(); $client->setAuthSubPrivateKeyFile(HEALTH_PRIVATE_KEY, null, true); // Convert an AuthSub one-time token into a session token if needed if ($singleUseToken && !$sessionToken) { $sessionToken = Zend_Gdata_AuthSub::getAuthSubSessionToken($singleUseToken, $client); $_SESSION['sessionToken'] = $sessionToken; } $client->setAuthSubToken($sessionToken); return $client; }
<div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">アカウント修正</h4> </div> <div class="modal-body"> Loading... </div> </div> </div> </div> <?php $newSeminarStudentUrl = Yii::app()->createUrl('admin/student/NewStudentManagement'); $registeredStudentsUrl = $this->createUrl('admin/student/editStudentManagement'); $currentUrl = getCurrentUrl(array_merge($_GET,$searchParams?$searchParams:array(),array('page'=>$pages->currentPage+1))); $baseUrl = Yii::app()->baseUrl; $cs = Yii::app()->getClientScript(); $cs->registerScript( 'toggleModel', ' $("#new-registration").click(function() { $("#myModalLabel").text("受講者アカウント登録"); $(".modal-body").load("' . $newSeminarStudentUrl . '", function() { $("#myModal").modal("show").width(700).css("margin-left",-350); $(".datepicker").datepicker().on("changeDate", function() {$(this).datepicker("hide")}); }); }); function newStudentManager() { $("#myModalLabel").text("アカウント登録"); showLoading();
/** * Handle a block pageindex */ function pmxc_constructPageIndex($items, $pageitems, $addRestoreTop = true, $startpage = null) { // hide pageindex if only one page.. if ($items > $pageitems) { if (!is_null($startpage)) { $this->startpage = $startpage; } else { $this->startpage = 0; } $cururl = preg_replace('~pgkey[a-zA-Z0-9_\\-\\;\\=\\/]+pg[0-9\\=\\/]+~', '', getCurrentUrl(true)) . 'pgkey=' . $this->cfg['uniID'] . ';pg=%1$d;'; $this->postspage = $pageitems; $this->pageindex = constructPageIndex($cururl, $this->startpage, $items, $pageitems, true); $this->pageindex = preg_replace('/\\;start\\=([\\%\\$a-z0-9]+)/', '', $this->pageindex); if (!empty($addRestoreTop)) { $this->pageindex = str_replace('href="', 'onclick="pmxWinGetTop(\'' . $this->cfg['uniID'] . '\')" href="', $this->pageindex); } } }
<label for="admin_email" class="col-sm-2 control-label">eMail Kontaktformulare / Main contact eMail-Address:</label> <div class="col-sm-10"> <input class="form-control" type="email" name="contact_email" id="contact_email" value="" size="50" required="required" placeholder="eMail Kontaktformulare / Main contact eMail-Address"> <small><span class="helpBlock" class="help-block">Die gewünschte eMail-Adresse für Kontaktformulare. / Main contact eMail-Address for forms.</span></small> <br><br><br> </div> </div> <div class="row"> <div class="col-md-12" style="text-align:center;"> <input class="btn btn-primary btn-lg" type="submit" value="ConstructrCMS installieren / Setup ConstructrCMS"> </div> </div> </form> <br><br><br><br> <div class="row"> <div class="col-md-12" style="text-align:center;"> <p><small>ConstructrCMS | <a href="http://phaziz.com">phaziz.com</a></small></p> </div> </div> </div> <script src="<?php echo getCurrentUrl(); ?> /CONSTRUCTR-CMS/ASSETS/jquery/jquery-2.1.4.min.js"></script> <script src="<?php echo getCurrentUrl(); ?> /CONSTRUCTR-CMS/ASSETS/materialize/js/materialize.min.js"></script> </body> </html>
/** * Returns the AuthSub URL which the user must visit to authenticate requests * from this application. * * Uses getCurrentUrl() to get the next URL which the user will be redirected * to after successfully authenticating with the Google service. * * @return string AuthSub URL */ function getAuthSubUrl() { global $_authSubKeyFile; $next = getCurrentUrl(); $scope = 'http://www.google.com/calendar/feeds/'; $session = true; if ($_authSubKeyFile != null) { $secure = true; } else { $secure = false; } return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session); }
private function addEntry() { // Get parameters $acronym = isset($_POST['acronym']) ? $_POST['acronym'] : null; $name = isset($_POST['name']) ? $_POST['name'] : null; $password = isset($_POST['password']) ? $_POST['password'] : null; $confirm = isset($_POST['confim_password']) ? $_POST['confim_password'] : null; $image = isset($_POST['image']) ? $_POST['image'] : null; $type = isset($_POST['type']) ? $_POST['type'] : null; $image = CEditMovies::addFolder($image); if ($password !== $confirm) { header("Location: " . getCurrentUrl() . "&fail&error=Löseorden matchar inte."); } $sql = "SELECT acronym FROM rm_user;"; $res = $this->db->ExecuteSelectQueryAndFetchAll($sql); $users = null; foreach ($res as $val) { $users[] = $val->acronym; } if (in_array($acronym, $users)) { header("Location: " . getCurrentUrl() . "&fail&error=Användarnamnet finns redan."); } $sql = "INSERT INTO rm_user (acronym, name, type, image, since, salt) VALUES\n (?, ?, ?, ?, NOW(), unix_timestamp());"; $params = array($acronym, $name, $type, $image); $res = $this->db->ExecuteQuery($sql, $params); if ($res) { $sql = "UPDATE rm_user SET password = md5(concat(?, salt)) WHERE acronym = ?;"; $params = array($password, $acronym); $res = $this->db->ExecuteQuery($sql, $params); if ($res) { header("Location: edit_users.php"); } else { header("Location: " . getCurrentUrl() . "&fail"); } } else { header("Location: " . getCurrentUrl() . "&fail"); } }
*/ function getCurrentUrl() { if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { $protocol = 'https://'; } else { $protocol = 'http://'; } $url = $protocol . $_SERVER['HTTP_HOST']; // use port if non default $url .= isset($_SERVER['SERVER_PORT']) && ($protocol === 'http://' && $_SERVER['SERVER_PORT'] != 80 || $protocol === 'https://' && $_SERVER['SERVER_PORT'] != 443) ? ':' . $_SERVER['SERVER_PORT'] : ''; $url .= $_SERVER['PHP_SELF']; // return current url return $url; } $GLOBAL_HYBRID_AUTH_URL_BASE = getCurrentUrl(); $GLOBAL_HYBRID_AUTH_URL_BASE = str_ireplace("install.php", "", $GLOBAL_HYBRID_AUTH_URL_BASE); $GLOBAL_HYBRID_AUTH_PATH_BASE = realpath(dirname(__FILE__)) . "/"; $CONFIG_FILE_NAME = $GLOBAL_HYBRID_AUTH_PATH_BASE . "config.php"; // deault providers $PROVIDERS_CONFIG = array(array("label" => "Facebook", "provider_name" => "Facebook", "require_client_id" => TRUE, "new_app_link" => "https://www.facebook.com/developers/", "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_Facebook.html"), array("label" => "Google", "provider_name" => "Google", "callback" => TRUE, "require_client_id" => TRUE, "new_app_link" => "https://code.google.com/apis/console/", "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_Google.html"), array("label" => "Twitter", "provider_name" => "Twitter", "new_app_link" => "https://dev.twitter.com/apps", "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_Twitter.html"), array("label" => "Live", "provider_name" => "Windows Live", "require_client_id" => TRUE, "new_app_link" => "https://manage.dev.live.com/ApplicationOverview.aspx", "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_Live.html"), array("label" => "MySpace", "provider_name" => "MySpace", "new_app_link" => "http://www.developer.myspace.com/", "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_MySpace.html"), array("label" => "Foursquare", "provider_name" => "Foursquare", "require_client_id" => TRUE, "callback" => TRUE, "new_app_link" => "https://www.foursquare.com/oauth/", "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_Foursquare.html"), array("label" => "LinkedIn", "provider_name" => "LinkedIn", "new_app_link" => "https://www.linkedin.com/secure/developer", "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_LinkedIn.html"), array("label" => "OpenID", "provider_name" => "OpenID", "new_app_link" => NULL, "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_OpenID.html"), array("label" => "Yahoo", "provider_name" => "Yahoo!", "new_app_link" => NULL, "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_Yahoo.html"), array("label" => "AOL", "provider_name" => "AOL", "new_app_link" => NULL, "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_AOL.html")); if (count($_POST)) { $CONFIG_TEMPLATE = file_get_contents("Hybrid/resources/config.php.tpl"); foreach ($_POST as $k => $v) { $v = strip_tags($v); $z = "#{$k}#"; $CONFIG_TEMPLATE = str_replace($z, $v, $CONFIG_TEMPLATE); } $CONFIG_TEMPLATE = str_replace("<?php", "<?php\n\t#AUTOGENERATED BY HYBRIDAUTH {$HYBRIDAUTH_VERSION} INSTALLER - " . date("l jS \\of F Y h:i:s A") . "\n", $CONFIG_TEMPLATE); $is_installed = file_put_contents($GLOBAL_HYBRID_AUTH_PATH_BASE . "config.php", $CONFIG_TEMPLATE); if (!$is_installed) {
<nav class="mobile-menu"> <ul class="clearfix"> <?php // $this->db->order_by('position asc,added desc'); $this->db->order_by('position asc,added desc'); $menus = $this->menu_model->find_all_by(array('status' => 1, 'department_ID' => $menu_D->ID, 'parent_ID' => 0)); if ($this->menu_model->count_by(array('status' => 1, 'department_ID' => $menu_D->ID, 'parent_ID' => 0)) > 0) { $i = 0; foreach ($menus as $menu) { ?> <li class=" <?php if ($this->menu_model->count_by(array('parent_ID' => $menu->id, 'status' => 1, 'department_ID' => $menu_D->ID)) > 0) { echo 'parent '; } if ($menu->id == $this->uri->segment(4) || getCurrentUrl() == $menu->url) { echo 'active'; } $i++; ?> " ><a <?php if (!is_numeric($menu->url)) { echo "target='blank_'"; } ?> href="<?php echo is_numeric($menu->url) ? base_url() . 'index.php/department/index/' . $this->uri->segment(3) . '/' . $menu->id : $menu->url; ?> #jump-page"><?php echo $menu->name; ?>
} else { $protocol = 'http://'; } $host = $_SERVER['HTTP_HOST']; if ($_SERVER['HTTP_PORT'] != '' && ($protocol == 'http://' && $_SERVER['HTTP_PORT'] != '80' || $protocol == 'https://' && $_SERVER['HTTP_PORT'] != '443')) { $port = ':' . $_SERVER['HTTP_PORT']; } else { $port = ''; } return $protocol . $host . $port . $php_request_uri; } // if there is no AuthSub session or one-time token waiting for us, // redirect the user to the AuthSub server to get one. if (!isset($_GET['token'])) { // Parameters to give to AuthSub server $next = getCurrentUrl(); $scope = GoogleCalendarInterface::GCAL_INTEGRATION_SCOPE; $secure = false; $session = true; // Redirect the user to the AuthSub server to sign in $authSubUrl = Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session); header("HTTP/1.0 307 Temporary redirect"); header("Location: " . $authSubUrl); exit; } else { try { $client = new Zend_Gdata_HttpClient(); $pathToKey = sfConfig::get('sf_root_dir') . '/' . sfConfig::get('app_googleCalendarIntegration_privateKeyPath'); $client->setAuthSubPrivateKeyFile($pathToKey, null, true); $sessionToken = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token'], $client); } catch (Exception $e) {
/** * ShowContent */ function pmxc_ShowContent($blockcount) { global $context; echo ' <form id="' . $this->postKey . '_form" accept-charset="' . $context['character_set'] . '" method="post"> <input type="hidden" id="' . $this->postKey . '" name="' . $this->postKey . '" value="" />'; // show all articles on a page if ($this->curCat['config']['settings']['showmode'] == 'pages') { $artCount = count($this->articles[$this->curCat['name']]); if (empty($this->curCat['config']['settings']['pages'])) { $this->curCat['config']['settings']['pages'] = $artCount; } $subcats = array(); foreach ($this->categories as $name => $cat) { if ($this->firstcat == $name) { $sbCat = $cat; } if ($this->curCat['name'] == $name) { $artcat = '<a href="' . $this->GetUrl($this->postarray[$this->postKey]['cat'] == $name ? 'cat=' . $this->postarray[$this->postKey]['cat'] : 'cat=' . $this->postarray[$this->postKey]['cat'] . ';child=' . $name) . '>' . $this->categories[$this->curCat['name']]['title'] . '</a>'; } if (!empty($this->curCat['config']['settings']['addsubcats'])) { if ($this->curCat['name'] != $name) { if ($this->postarray[$this->postKey]['cat'] != $name) { $subcats[] = array('name' => $name, 'link' => '<a href="' . $this->GetUrl('child=' . $name) . '>' . $cat['title'] . '</a><br />'); } else { $subcats[] = array('name' => $name, 'link' => '<a href="' . $this->GetUrl('cat=' . $name) . '>' . $cat['title'] . '</a><br />'); } } } } // create the pageindex $this->curCat['page'] = 0; if (!empty($this->curCat['config']['settings']['pageindex']) || $artCount > $this->curCat['config']['settings']['pages']) { if (!is_null($this->postarray[$this->postKey]['pg'])) { $this->curCat['page'] = $this->postarray[$this->postKey]['pg']; } if (empty($this->postarray[$this->postKey]['cat'])) { $this->postarray[$this->postKey]['cat'] = $this->cfg['config']['settings']['category']; } $url = 'cat=' . $this->postarray[$this->postKey]['cat'] . ';' . (!empty($this->postarray[$this->postKey]['child']) ? 'child=' . $this->postarray[$this->postKey]['child'] . ';' : '') . 'pgkey=' . $this->cfg['uniID'] . ';pg=%1$d'; $url = preg_replace('~pgkey=' . $this->cfg['uniID'] . ';pg=[a-zA-Z0-0;]+~', '', getCurrentUrl(true)) . $url; $pageindex = $this->pmxc_makePageIndex($url, $this->curCat['page'], $artCount, $this->curCat['config']['settings']['pages']); $pageindex = str_replace('href="', $this->GetUrl() . ' href="', $pageindex); } // show category frame? if (in_array($this->curCat['config']['settings']['framemode'], array('both', 'category'))) { $this->curCat['config']['id'] = !empty($this->cfg) ? $this->cfg['id'] : $this->curCat['id']; Pmx_Frame_top($this->curCat, $blockcount); } // top pageindex if (!empty($pageindex)) { echo ' <div class="smalltext pmx_pgidx_top">' . $pageindex . '</div>'; } echo ' <table class="pmx_table"> <tr>'; if (!empty($this->curCat['config']['settings']['showsubcats'])) { $subcats = array(); $firstcat = false; foreach ($this->categories as $name => $cat) { if ($this->firstcat == $name && empty($firstcat)) { $firstcat = true; $sbCat = $cat; $subcats[] = array('name' => $name, 'link' => '<b>' . $cat['title'] . '</b><br />'); } else { if ($this->postarray[$this->postKey]['cat'] != $name) { $subcats[] = array('name' => $name, 'link' => '<a href="' . $this->GetUrl('child=' . $name) . '>' . $cat['title'] . '</a><br />'); } else { $subcats[] = array('name' => $name, 'link' => '<a href="' . $this->GetUrl('cat=' . $name) . '>' . $cat['title'] . '</a><br />'); } } } $sbCat['config']['visuals']['header'] = 'none'; $sbCat['config']['visuals']['bodytext'] = 'smalltext'; $sbCat['config']['visuals']['body'] = 'windowbg sidebar'; $sbCat['config']['visuals']['frame'] = 'border'; $sbCat['config']['innerpad'] = '3,5'; $sbCat['config']['collapse'] = 0; if (!empty($this->curCat['config']['settings']['sbpalign']) && !empty($subcats)) { echo ' <td style="text-align:left"> <div class="smalltext" style="width:' . $this->curCat['config']['settings']['catsbarwidth'] . 'px; margin-righ:' . $context['pmx']['settings']['panelpad'] . 'px;">'; $this->WriteSidebar($sbCat, $subcats, '', ''); echo ' </div> </td>'; } } // output the article content echo ' <td style="width:100%">'; $sumart = null; foreach ($this->articles[$this->curCat['name']] as $cnt => $article) { if ($cnt >= $this->curCat['page'] && $cnt - $this->curCat['page'] < $this->curCat['config']['settings']['pages']) { $sumart = is_null($sumart) ? $artCount - $this->curCat['page'] > $this->curCat['config']['settings']['pages'] ? $this->curCat['config']['settings']['pages'] - 1 : ($artCount < $this->curCat['config']['settings']['pages'] ? $artCount - 1 : $artCount - ($this->curCat['page'] + 1)) : $sumart; // show article frame? $article['config']['collapse'] = $this->curCat['config']['settings']['showmode'] != 'pages' ? 0 : $article['config']['collapse']; if (in_array($this->curCat['config']['settings']['framemode'], array('both', 'article'))) { Pmx_Frame_top($article, $sumart); $this->WriteContent($article); Pmx_Frame_bottom(); } else { $this->WriteContent($article); } $sumart--; if (empty($sumart)) { echo ' <div id="botcat' . $this->cfg['uniID'] . '"></div>'; } } } echo ' </td>'; // show childcats in the sidebar? if (empty($this->curCat['config']['settings']['sbpalign']) && !empty($subcats)) { echo ' <td style="text-align:right"> <div class="smalltext" style="width:' . $this->curCat['config']['settings']['catsbarwidth'] . 'px; margin-left:' . $context['pmx']['settings']['panelpad'] . 'px;">'; $this->WriteSidebar($sbCat, $subcats, '', ''); echo ' </div> </td>'; } echo ' </tr> </table>'; // bottom pageindex if (!empty($pageindex)) { echo ' <div class="smalltext pmx_pgidx_bot">' . $pageindex . '</div>'; } // show category frame? if (in_array($this->curCat['config']['settings']['framemode'], array('both', 'category'))) { Pmx_Frame_bottom(); } } else { // show category frame? if (in_array($this->curCat['config']['settings']['framemode'], array('both', 'category'))) { $this->curCat['id'] = !empty($this->cfg['static_block']) ? $this->cfg['id'] : $this->curCat['id']; Pmx_Frame_top($this->curCat, $blockcount); } $subcats = array(); foreach ($this->categories as $name => $cat) { if ($this->firstcat == $name) { $sbCat = $cat; } if ($this->curCat['name'] == $name) { $artcat = '<a href="' . $this->GetUrl($this->postarray[$this->postKey]['cat'] == $name ? 'cat=' . $this->postarray[$this->postKey]['cat'] : 'cat=' . $this->postarray[$this->postKey]['cat'] . ';child=' . $name, !empty($this->cfg['static_block'])) . '>' . $this->categories[$this->curCat['name']]['title'] . '</a>'; } if (!empty($this->curCat['config']['settings']['addsubcats'])) { if ($this->curCat['name'] != $name) { if ($this->postarray[$this->postKey]['cat'] != $name) { $subcats[] = array('name' => $name, 'link' => '<a href="' . $this->GetUrl('child=' . $name) . '>' . $cat['title'] . '</a><br />'); } else { $subcats[] = array('name' => $name, 'link' => '<a href="' . $this->GetUrl('cat=' . $name) . '>' . $cat['title'] . '</a><br />'); } } } } $curart = empty($this->postarray[$this->postKey]['art']) ? $this->articles[$this->curCat['name']][0]['name'] : $this->postarray[$this->postKey]['art']; $sbCat['config']['visuals']['header'] = 'none'; $sbCat['config']['visuals']['bodytext'] = 'smalltext'; $sbCat['config']['visuals']['body'] = 'windowbg sidebar'; $sbCat['config']['visuals']['frame'] = 'border'; $sbCat['config']['innerpad'] = '3,5'; $sbCat['config']['collapse'] = 0; echo ' <table class="pmx_table"> <tr>'; // subcategory list at left if (!empty($this->curCat['config']['settings']['sbmalign'])) { echo ' <td style="text-align:left"> <div class="smalltext" style="width:' . $this->curCat['config']['settings']['sidebarwidth'] . 'px; margin-right:' . $context['pmx']['settings']['panelpad'] . 'px;">'; $this->WriteSidebar($sbCat, $subcats, $artcat, $curart); echo ' </div> </td>'; } echo ' <td style="width:100%">'; $count = 0; foreach ($this->articles[$this->curCat['name']] as $article) { $count += intval($article['name'] == $curart); } foreach ($this->articles[$this->curCat['name']] as $article) { if ($article['name'] == $curart) { $count--; // show article frame? $article['config']['collapse'] = $this->curCat['config']['settings']['showmode'] != 'pages' ? 0 : $article['config']['collapse']; if (in_array($this->curCat['config']['settings']['framemode'], array('both', 'article'))) { Pmx_Frame_top($article, $count); $this->WriteContent($article); Pmx_Frame_bottom(); } else { $this->WriteContent($article); } break; } } echo ' </td> '; // subcategory list at right if (empty($this->curCat['config']['settings']['sbmalign'])) { echo ' <td style="text-align:right"> <div class="smalltext" style="width:' . $this->curCat['config']['settings']['sidebarwidth'] . 'px; margin-left:' . $context['pmx']['settings']['panelpad'] . 'px;">'; $this->WriteSidebar($sbCat, $subcats, $artcat, $curart); echo ' </div> </td>'; } echo ' </tr> </table>'; Pmx_Frame_bottom(); } echo ' </form>'; return 1; }
var paths = {'root':'<?php echo addTrailingSlash(backslashToSlash(CONFIG_SYS_ROOT_PATH)); ?>', 'root_title':'<?php echo LBL_FOLDER_ROOT; ?>'}; var parentFolder = {}; var urls = { 'upload':'<?php echo CONFIG_URL_UPLOAD; ?>', 'preview':'<?php echo CONFIG_URL_PREVIEW; ?>', 'cut':'<?php echo CONFIG_URL_CUT; ?>', 'copy':'<?php echo CONFIG_URL_COPY; ?>', 'paste':'<?php echo CONFIG_URL_FILE_PASTE; ?>', 'delete':'<?php echo CONFIG_URL_DELETE; ?>', 'rename':'<?php echo CONFIG_URL_SAVE_NAME; ?>', 'thumbnail':'<?php echo CONFIG_URL_IMG_THUMBNAIL; ?>', 'create_folder':'<?php echo CONFIG_URL_CREATE_FOLDER; ?>', 'text_editor':'<?php echo CONFIG_URL_TEXT_EDITOR; ?>', 'image_editor':'<?php echo CONFIG_URL_IMAGE_EDITOR; ?>', 'download':'<?php echo CONFIG_URL_DOWNLOAD; ?>', 'present':'<?php echo getCurrentUrl(); ?>', 'home':'<?php echo CONFIG_URL_HOME; ?>', 'view':'<?php echo CONFIG_URL_LIST_LISTING; ?>' }; var permits = {'del':<?php echo (CONFIG_OPTIONS_DELETE?1:0); ?>, 'cut':<?php echo (CONFIG_OPTIONS_CUT?'1':'0'); ?>, 'copy':<?php echo (CONFIG_OPTIONS_COPY?1:0); ?>, 'newfolder':<?php echo (CONFIG_OPTIONS_NEWFOLDER?1:0); ?>, 'rename':<?php echo (CONFIG_OPTIONS_RENAME?1:0); ?>, 'upload':<?php echo (CONFIG_OPTIONS_UPLOAD?1:0); ?>, 'edit':<?php echo (CONFIG_OPTIONS_EDITABLE?1:0); ?>, 'view_only':<?php echo (CONFIG_SYS_VIEW_ONLY?1:0); ?>}; var currentFolder = {}; var warningDelete = '<?php echo WARNING_DELETE; ?>'; var newFile = {'num':1, 'label':'<?php echo FILE_LABEL_SELECT; ?>', 'upload':'<?php echo FILE_LBL_UPLOAD; ?>'}; var counts = {'new_file':1}; var thickbox = {'width':'<?php echo CONFIG_THICKBOX_MAX_WIDTH; ?>', 'height':'<?php echo CONFIG_THICKBOX_MAX_HEIGHT; ?>', 'next':'<?php echo THICKBOX_NEXT; ?>', 'previous':'<?php echo THICKBOX_PREVIOUS; ?>', 'close':'<?php echo THICKBOX_CLOSE; ?>' };
private function saveEntry() { // Get parameters $id = isset($_POST['id']) ? strip_tags($_POST['id']) : (isset($_GET['id']) ? strip_tags($_GET['id']) : null); $title = isset($_POST['title']) ? $_POST['title'] : null; $slug = isset($_POST['slug']) ? $_POST['slug'] : null; $data = isset($_POST['data']) ? $_POST['data'] : array(); $published = isset($_POST['published']) ? strip_tags($_POST['published']) : array(); $updatedBy = strip_tags(CUser::GetName()); $publishedBy = isset($_POST['publishedBy']) ? $_POST['publishedBy'] : null; $category = isset($_POST['category']) ? $_POST['category'] : null; if (empty($published)) { $published = null; } $sql = ' UPDATE rm_news SET title = ?, slug = ?, data = ?, published = ?, updated = NOW(), updatedBy = ?, publishedBy = ?, category = ? WHERE id = ? '; $slug = empty($slug) ? null : $this->slugify($slug); $category = empty($category) ? null : $this->slugify($category); $params = array($title, $slug, $data, $published, $updatedBy, $publishedBy, $category, $id); $res = $this->db->ExecuteQuery($sql, $params); if ($res) { header("Location: " . getCurrentUrl() . "&success"); } else { header("Location: " . getCurrentUrl() . "&fail"); } }
function country_list($metalist) { global $lang; global $region; $postID = get_the_ID(); //echo "PID: $postID"; list($null1, $null2, $null3, $posturl) = explode("/", get_permalink()); list($null1, $null2, $null3, $null4, $posturl2) = explode("/", get_permalink()); //We are at the main page (ID==1821) if ($postID == "1821") { $posturl = ""; } if ($postID == "1821") { $posturl2 = ""; } list($posturl1, $posturl2, $posturl3, $posturl4) = explode("/", $_SERVER["REQUEST_URI"]); //echo "<br>PURL: 1: $posturl1 / 2: $posturl2 / $posturl3 / $posturl4 <br>"; if ($posturl2 != "") { $posturl = $posturl2; } //we are in a qtranslate subfolder! //check for login page //list($posturl1,$posturl2,$posturl3,$posturl4)=explode("/",$_SERVER["REQUEST_URI"]); //echo "<br>PURL: $posturl1 / $posturl2 / $posturl3 / $posturl4 <br>"; if (substr($posturl2, 0, 6) == "login?") { $posturl = $posturl2; } if (substr($posturl1, 0, 6) == "login?") { $posturl = $posturl1; } if (is_search()) { //echo "Search".$_SERVER["REQUEST_URI"]; list($posturl1, $posturl2, $posturl3, $posturl4) = explode("/", $_SERVER["REQUEST_URI"]); //list($null1,$null2,$null3,$null4,$posturl2)=explode("/",get_category_link($cid)); //echo "<br>PURL: $posturl1 / $posturl2 / $posturl3 / $posturl4 <br>"; $posturl = $posturl2; //echo "PURL: $posturl"; //if (defined($posturl2)) { // $posturl = $posturl2; //} } if (is_404()) { $posturl = ""; $posturl2 = ""; } if (is_archive() or is_tag()) { //archives need special handling, otherwise first product will be used //echo "Archiv!".get_permalink()."<br>".$postID; //echo "<br>".get_permalink($postID); //$cid=get_the_category_ID(); //echo get_the_category( $postID ); //ob_start(); //the_category_ID(); //$cid = ob_get_clean(); //echo "CID: $cid[1]"; //echo "URL: ".$_SERVER["REQUEST_URI"]; //echo "<br>CID:".the_category_ID(); //echo "link: ".get_category_link($cid); list($posturl1, $posturl2, $posturl3, $posturl4) = explode("/", $_SERVER["REQUEST_URI"]); //list($null1,$null2,$null3,$null4,$posturl2)=explode("/",get_category_link($cid)); //echo "<br>PURL: $posturl1 / $posturl2 / $posturl3 / $posturl4 <br>"; if ($posturl1 == "category" or $posturl1 == "tag") { $posturl = $posturl1; if ($posturl2 != "") { $posturl .= "/{$posturl2}"; } } if ($posturl2 == "category" or $posturl2 == "tag") { $posturl = "{$posturl2}"; } if ($posturl3 != "") { $posturl .= "/{$posturl3}"; } if ($posturl4 != "") { $posturl .= "/{$posturl4}"; } //echo "AA: $posturl1"; //echo "AA: $posturl2"; } //echo "PURL: $posturl"; $posturlde = $posturl; $posturlcom = $posturl; #echo "PU:".$posturlcom; //remove language selection for .de $posturlde = str_replace("?lang=jp", "", $posturlde); $posturlde = str_replace("?lang=it", "", $posturlde); $posturlde = str_replace("?lang=es", "", $posturlde); $posturlde = str_replace("?lang=uk", "", $posturlde); $posturlde = str_replace("?lang=ca", "", $posturlde); $posturlde = str_replace("?lang=in", "", $posturlde); $posturlde = str_replace("?lang=fr", "", $posturlde); $posturlde = str_replace("?lang=cn", "", $posturlde); $posturlde = str_replace("?lang=en", "", $posturlde); $posturlde = str_replace("?lang=nl", "", $posturlde); $posturlde = str_replace("?lang=br", "", $posturlde); $posturlcom = str_replace("?lang=jp", "", $posturlcom); $posturlcom = str_replace("?lang=it", "", $posturlcom); $posturlcom = str_replace("?lang=es", "", $posturlcom); $posturlcom = str_replace("?lang=uk", "", $posturlcom); $posturlcom = str_replace("?lang=ca", "", $posturlcom); $posturlcom = str_replace("?lang=in", "", $posturlcom); $posturlcom = str_replace("?lang=fr", "", $posturlcom); $posturlcom = str_replace("?lang=cn", "", $posturlcom); $posturlcom = str_replace("?lang=en", "", $posturlcom); $posturlcom = str_replace("?lang=nl", "", $posturlcom); $posturlcom = str_replace("?lang=br", "", $posturlcom); if ($posturlcom == "hardware-profile") { $url = getCurrentUrl(); $pieces = parse_url($url); $urlpath = $pieces['path']; $hwprofpos = strpos($urlpath, "hardware-profile/user"); $hwprofposg = strpos($urlpath, "hardware-profile/guser"); # if we have a public page this fails and we need the following value $hwprofposs = strpos($urlpath, "hardware-profile/system"); #print "$urlpath - $hwprofpos - $hwprofposs<br>"; if ($hwprofposs != "") { $rurl = substr($urlpath, $hwprofposs); } //echo "URL: $posturlcom"; //echo "<br>URL2: $rurl"; $posturlcom = "{$rurl}"; $posturlde = "{$rurl}"; if ($hwprofpos != "") { # translate public user profile links to guid links to make them available on other servers $rurl = substr($urlpath, $hwprofpos); $hwprofpos = strpos($urlpath, "/hardware-profile/user"); $uid = (int) substr($urlpath, $hwprofpos + 22); $guid = lhg_get_guid_from_uid($uid); #locally linking to standard user profile, transversally linking to guid if ($lang != "de") { $posturlde = "/hardware-profile/guser" . $guid; } if ($lang != "de") { $posturlcom = "/hardware-profile/user" . $uid; } if ($lang == "de") { $posturlcom = "/hardware-profile/guser" . $guid; } if ($lang == "de") { $posturlde = "/hardware-profile/user" . $uid; } } if ($hwprofposg != "") { # translate public user profile links to guid links to make them available on other servers $rurl = substr($urlpath, $hwprofpos); $hwprofpos = strpos($urlpath, "/hardware-profile/guser"); $guid = (int) substr($urlpath, $hwprofposg + 22); #$guid = lhg_get_guid_from_uid( $uid ); #locally linking to standard user profile, transversally linking to guid $rurl = "/hardware-profile/guser" . $guid; #if ($lang != "de") $posturlcom = "/hardware-profile/user".$uid; #if ($lang == "de") $posturlcom = "/hardware-profile/guser".$guid; #if ($lang == "de") $posturlde = "/hardware-profile/user".$uid; $posturlcom = "{$rurl}"; $posturlde = "{$rurl}"; } # private profile page remains $posturlcom = "/hardware-profile"; $posturlde = "/hardware-profile"; } //translate tags if (is_tag()) { if ($region == "de" and ($posturl1 == "tag" or $posturl2 == "tag")) { //translated tags to be corrected $posturlcom = translate_tag($posturl); } if ($region != "de" and ($posturl1 == "tag" or $posturl2 == "tag")) { //translated tags to be corrected $posturlde = translate_tag($posturl); } } //translate categories if (is_archive()) { if ($region == "de" and ($posturl1 == "category" or $posturl2 == "category")) { //translated tags to be corrected $posturlcom = translate_category($posturl); } if ($region != "de" and ($posturl1 == "category" or $posturl2 == "category")) { //translated tags to be corrected $posturlde = translate_category($posturl); } $posturlde = str_replace("/page/2", "", $posturlde); $posturlde = str_replace("/page/3", "", $posturlde); $posturlde = str_replace("/page", "", $posturlde); $posturlcom = str_replace("/page/2", "", $posturlcom); $posturlcom = str_replace("/page/3", "", $posturlcom); $posturlcom = str_replace("/page", "", $posturlcom); } //echo "PU2: $posturlcom"; if (!is_search() and !($postID == "1821") and !is_archive()) { //echo " ---------------- PU: $posturlcom ---------"; //check if postid is already in DB lhg_check_permalink($postID); if (is_single()) { //extract URL (w/o domain name) from database $comURL = lhg_URL_chomp(lhg_get_com_post_URL($postID)); $deURL = lhg_URL_chomp(lhg_get_de_post_URL($postID)); #error_log("DE URL: $deURL"); //$comURL = get_post_meta($postID,'COM_URL',true); //$deURL = get_post_meta($postID,'DE_URL',true); #echo "---------------------- CURL: $comURL"; #echo "DURL: $deURL"; } else { $comURL = get_post_meta($postID, 'COM_URL', true); $deURL = get_post_meta($postID, 'DE_URL', true); } /* if ($lang == "en") { $postid_de = lhg_get_postid_de_from_com($postID); #echo "PID_de: $postid_de"; #echo "PL: "; } */ //echo "---------------------- PURL-A: $posturlcom"; // set default if ($comURL == "") { $comURL = $posturlcom; } #if ($deURL == "") $deURL = $posturlde; if (substr($comURL, 0, 1) == "/") { $comURL = substr($comURL, 1); } if (substr($deURL, 0, 1) == "/") { $deURL = substr($deURL, 1); } #if ($comURL != "") $posturlcom = $comURL; $posturlcom = $comURL; #if ($deURL != "") $posturlde = $deURL; $posturlde = $deURL; //echo "---------------------- PURL-c: $posturlcom"; //translation still missing -> redirect to main page //if ( ($comURL == "") and ($postID > 2599) and ($region == "de")) $posturlcom = ""; //if ( ($deURL == "") and ($postID > 2599) and ($region != "de")) $posturlde = ""; } //echo "PURL: $posturlcom"; //echo "PURL: $posturlde"; //echo "LANG: $lang"; //echo "Reg: $region"; if ($region == "de") { //echo "Test $posturlcom -- "; $URLC = "http://www.linux-hardware-guide.com"; $URLD = ""; } if ($region != "de") { $URLC = ""; $URLD = "http://www.linux-hardware-guide.de"; } //$URLC="http://192.168.3.113"; //Debug if ($metalist == 1) { if ($region == "de") { echo '<meta http-equiv="Content-Language" content="de"/>'; } if ($region == "de") { $URLD = "http://www.linux-hardware-guide.de"; } # store url to be available globally (e.g. by wp-one-post-widget) global $posturlcom_glob; global $posturlde_glob; $posturlcom_glob = $posturlcom; $posturlde_glob = $posturlde; //create header meta-list //by qtranslate in "com" or here in "de" cases $URLC = "http://www.linux-hardware-guide.com"; echo ' <link hreflang="EN-GB" href="' . $URLC . '/uk/' . $posturlcom . '" rel="alternate" /> <link hreflang="ZH-Hans" href="' . $URLC . '/zh/' . $posturlcom . '" rel="alternate" /> <link hreflang="FR" href="' . $URLC . '/fr/' . $posturlcom . '" rel="alternate" /> <link hreflang="IT" href="' . $URLC . '/it/' . $posturlcom . '" rel="alternate" /> <link hreflang="JA" href="' . $URLC . '/ja/' . $posturlcom . '" rel="alternate" /> <link hreflang="ES" href="' . $URLC . '/es/' . $posturlcom . '" rel="alternate" /> <link hreflang="NL" href="' . $URLC . '/nl/' . $posturlcom . '" rel="alternate" /> <link hreflang="EN-CA" href="' . $URLC . '/ca/' . $posturlcom . '" rel="alternate" /> <link hreflang="EN-IN" href="' . $URLC . '/in/' . $posturlcom . '" rel="alternate" /> <link hreflang="EN" href="' . $URLC . '/' . $posturlcom . '" rel="alternate" /> '; if ($posturlde != "") { if ($region != "de") { echo '<link hreflang="DE" href="' . $URLD . '/' . $posturlde . '" rel="alternate" />'; } } // <link hreflang="PT-BR" href="'.$URLC.'/br/'.$posturlcom.'" rel="alternate" /> } else { echo '<span class="flaglist"> <a href="' . $URLD . '/' . $posturlde . '"> <img src="/wp-content/plugins/qtranslate/flags/de.png" title="Region: Germany Currency: €" alt="Germany" /></a>'; echo '<a href="' . $URLC . '/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/us.png" title="Region: USA Currency: $" alt="USA" /></a>'; echo '<a href="' . $URLC . '/ca/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/ca.png" title="Region: Canada Currency: CND$" alt="Canada" /></a>'; echo '<a href="' . $URLC . '/uk/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/uk.png" title="Region: United Kingdom Currency: £" alt="UK" /></a>'; echo '<a href="' . $URLC . '/fr/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/fr.png" title="Region: France Currency: €" alt="France" /></a>'; echo '<a href="' . $URLC . '/es/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/es.png" title="Region: Espana Currency: €" alt="Espana" /></a>'; echo '<a href="' . $URLC . '/it/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/it.png" title="Region: Italia Currency: €" alt="Italia" /></a>'; echo '<a href="' . $URLC . '/nl/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/nl.png" title="Region: Nederlands Currency: €" alt="Nederlands" /></a>'; /* echo '<a href="'.$URLC.'/br/'.$posturlcom.'"><img src="/wp-content/plugins/qtranslate/flags/br.png" title="Region: Brasil Currency: R$"></a>'; */ echo '<a href="' . $URLC . '/in/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/in.png" title="Region: India Currency: ₹" alt="India" /></a>'; echo '<a href="' . $URLC . '/ja/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/jp.png" title="Region: Japan Currency: ¥" alt="Japan" /></a>'; echo '<a href="' . $URLC . '/zh/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/cn.png" title="Region: China Currency: RMB" alt="China" /></a> <br clear="all"/>'; echo '</span>'; } }
function getPagination_amaze($totalCount, $countPerPage = 10) { $pageKey = 'page'; //获取当前页码 $currentPage = intval($_REQUEST[$pageKey]) ? intval($_REQUEST[$pageKey]) : 1; //计算总页数 $pageCount = ceil($totalCount / $countPerPage); //如果只有1页,就没必要翻页了 if ($pageCount <= 1) { return ''; } //定义返回结果 $html = ''; //添加头部 $html .= '<ul class="am-pagination am-pagination-center">'; //添加上一页的按钮 if ($currentPage > 1) { $prevUrl = addUrlParam(getCurrentUrl(), array($pageKey => $currentPage - 1)); $html .= "<li><a class=\"\" href=\"{$prevUrl}\">«</a></li>"; } else { $html .= "<li class=\"am-disabled\"><a>«</a></li>"; } //添加各页面按钮 for ($i = 1; $i <= $pageCount; $i++) { $pageUrl = addUrlParam(getCurrentUrl(), array($pageKey => $i)); if ($i == $currentPage) { $html .= "<li class=\"am-active\"><a href=\"{$pageUrl}\">{$i}</a></li>"; } else { $html .= "<li><a class=\"\" href=\"{$pageUrl}\">{$i}</a></li>"; } } //添加下一页按钮 if ($currentPage < $pageCount) { $nextUrl = addUrlParam(getCurrentUrl(), array($pageKey => $currentPage + 1)); $html .= "<li><a class=\"\" href=\"{$nextUrl}\">»</a></li>"; } else { $html .= "<li class=\"am-disabled\"><a>»</a></li>"; } //收尾 $html .= '</ul>'; return $html; }
private function saveEntry() { // Get parameters $id = isset($_POST['id']) ? strip_tags($_POST['id']) : (isset($_GET['id']) ? strip_tags($_GET['id']) : null); $title = isset($_POST['title']) ? $_POST['title'] : null; $director = isset($_POST['director']) ? $_POST['director'] : null; $year = isset($_POST['year']) ? $_POST['year'] : null; $length = isset($_POST['length']) ? $_POST['length'] : null; $language = isset($_POST['language']) ? $_POST['language'] : null; $price = isset($_POST['price']) ? $_POST['price'] : null; $image = isset($_POST['image']) ? $_POST['image'] : null; $imdb = isset($_POST['imdb']) ? $_POST['imdb'] : null; $youtube = isset($_POST['youtube']) ? $_POST['youtube'] : null; $plot = isset($_POST['plot']) ? $_POST['plot'] : array(); $image = $this->addFolder($image); $sql = ' UPDATE rm_movie SET title = ?, director = ?, year = ?, length = ?, language = ?, price = ?, image = ?, imdb = ?, youtube = ?, plot = ?, updated = NOW() WHERE id = ? '; $params = array($title, $director, $year, $length, $language, $price, $image, $imdb, $youtube, $plot, $id); $res = $this->db->ExecuteQuery($sql, $params); if ($res) { $this->saveGenres($_POST['genres']); header("Location: " . getCurrentUrl() . "&success"); } else { header("Location: " . getCurrentUrl() . "&fail"); } }
<?php include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/common/common_tools.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/UserDao.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/controllers/SessionController.php'; /** * 检查后台登陆情况,未登录则转到登陆页面。 */ $url = getCurrentUrl(); $sc = new SessionController(); $uis = json_decode($sc->getUserJson()); if (!$uis || $uis->type != UserDao::TYPE_ADMIN) { header('Location:' . getBaseUrl() . 'website/backstage/admin_login.php?redirect_url=' . $url); }
*/ function getCurrentUrl() { if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { $protocol = 'https://'; } else { $protocol = 'http://'; } $url = $protocol . $_SERVER['HTTP_HOST']; // use port if non default $url .= isset($_SERVER['SERVER_PORT']) && ($protocol === 'http://' && $_SERVER['SERVER_PORT'] != 80 || $protocol === 'https://' && $_SERVER['SERVER_PORT'] != 443) ? ':' . $_SERVER['SERVER_PORT'] : ''; $url .= $_SERVER['PHP_SELF']; // return current url return $url; } $GLOBAL_HYBRID_AUTH_URL_BASE = $endpoint_url ? $endpoint_url : getCurrentUrl(); $GLOBAL_HYBRID_AUTH_URL_BASE = str_ireplace("install.php", "", $GLOBAL_HYBRID_AUTH_URL_BASE); $GLOBAL_HYBRID_AUTH_PATH_BASE = realpath(dirname(__FILE__)) . "/"; $CONFIG_FILE_NAME = $config_path ? $config_path : $GLOBAL_HYBRID_AUTH_PATH_BASE . "config.php"; // deault providers $PROVIDERS_CONFIG = array(array("label" => "Facebook", "provider_name" => "Facebook", "require_client_id" => TRUE, "new_app_link" => "https://www.facebook.com/developers/", "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_Facebook.html"), array("label" => "Google", "provider_name" => "Google", "callback" => TRUE, "require_client_id" => TRUE, "new_app_link" => "https://code.google.com/apis/console/", "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_Google.html"), array("label" => "Twitter", "provider_name" => "Twitter", "new_app_link" => "https://dev.twitter.com/apps", "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_Twitter.html"), array("label" => "Yahoo", "provider_name" => "Yahoo!", "require_client_id" => TRUE, "new_app_link" => "https://developer.apps.yahoo.com/dashboard/createKey.html", "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_Yahoo.html"), array("label" => "Live", "provider_name" => "Windows Live", "require_client_id" => TRUE, "new_app_link" => "https://manage.dev.live.com/ApplicationOverview.aspx", "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_Live.html"), array("label" => "MySpace", "provider_name" => "MySpace", "new_app_link" => "http://www.developer.myspace.com/", "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_MySpace.html"), array("label" => "Foursquare", "provider_name" => "Foursquare", "require_client_id" => TRUE, "callback" => TRUE, "new_app_link" => "https://www.foursquare.com/oauth/", "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_Foursquare.html"), array("label" => "LinkedIn", "provider_name" => "LinkedIn", "new_app_link" => "https://www.linkedin.com/secure/developer", "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_LinkedIn.html"), array("label" => "OpenID", "provider_name" => "OpenID", "new_app_link" => NULL, "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_OpenID.html"), array("label" => "AOL", "provider_name" => "AOL", "new_app_link" => NULL, "userguide_section" => "http://hybridauth.sourceforge.net/userguide/IDProvider_info_AOL.html")); if (count($_POST)) { $CONFIG_TEMPLATE = file_get_contents($GLOBAL_HYBRID_AUTH_PATH_BASE . "/Hybrid/resources/config.php.tpl"); foreach ($_POST as $k => $v) { $v = strip_tags($v); $z = "#{$k}#"; $CONFIG_TEMPLATE = str_replace($z, $v, $CONFIG_TEMPLATE); } $CONFIG_TEMPLATE = str_replace("<?php", "<?php\n\t#AUTOGENERATED BY HYBRIDAUTH {$HYBRIDAUTH_VERSION} INSTALLER - " . date("l jS \\of F Y h:i:s A") . "\n", $CONFIG_TEMPLATE); $is_installed = file_put_contents($CONFIG_FILE_NAME, $CONFIG_TEMPLATE); if (!$is_installed) {
/** * Draw Pager * * @param $id * @param $visualPagesCount * @param $exclude * @param $additionalParams * @param $linkClass * @return string */ function smarty_function_draw_pager($params, Smarty_Internal_Template &$smarty) { $id = null; $visualPagesCount = null; $excludedGetsArray = array(); extract($params); if (empty($visualPagesCount)) { $visualPagesCount = ConfigManager::getConfig("Pager", "Pager")->AuxConfig->defaultVisualPagesCount; } if (empty($id)) { $id = null; } if (isset($exclude) and !empty($exclude)) { $excludedGetsArray = explode(",", str_replace(" ", "", $exclude)); } $pager = Pager::getPager($id); if ($pager instanceof Pager) { if (isset($baseLink) and !empty($baseLink)) { // Remove heading slash if present $link = ltrim($baseLink, "/"); $link = Reg::get(ConfigManager::getConfig("RewriteURL")->Objects->rewriteURL)->glink($link); } else { $link = getCurrentUrl(array_merge(array($pager->getUrlParam()), $excludedGetsArray)); } if (isset($additionalParams) and !empty($additionalParams)) { RewriteURL::ensureLastSlash($additionalParams); $urlParam = $additionalParams . $pager->getUrlParam(); } else { $urlParam = $pager->getUrlParam(); } $currentPageNumber = $pager->getCurrentPageNumber(); $pagesCount = $pager->getTotalPagesCount(); if ($pagesCount > 1) { $pageNumStart = $currentPageNumber - floor($visualPagesCount / 2); if ($pageNumStart < 1) { $pageNumStart = 1; } $pageNumEnd = $pageNumStart + $visualPagesCount - 1; if ($pageNumEnd > $pagesCount) { $pageNumEnd = $pagesCount; $pageNumStart = $pageNumEnd - $visualPagesCount + 1; if ($pageNumStart < 1) { $pageNumStart = 1; } } if ($pageNumStart > 1) { $pagerFirstPageLink = $link . $urlParam . ':1'; $smarty->assign('pagerFirstPageLink', $pagerFirstPageLink); } if ($pageNumEnd < $pagesCount) { $pagerLastPageLink = $link . $urlParam . ':' . $pagesCount; $smarty->assign('pagerLastPageLink', $pagerLastPageLink); } if ($currentPageNumber > 1) { $prevPageLink = $link . $urlParam . ':' . ($currentPageNumber - 1); $smarty->assign('pagerPreviousPageLink', $prevPageLink); } $pagerNumbersArray = array(); for ($pgNum = $pageNumStart; $pgNum <= $pageNumEnd; $pgNum++) { $isCurrent = false; if ($pgNum == $currentPageNumber) { $isCurrent = true; } $pageLink = $link . $urlParam . ':' . $pgNum; array_push($pagerNumbersArray, array("pageNum" => $pgNum, "pageLink" => $pageLink, "isCurrent" => $isCurrent)); } if ($currentPageNumber < $pagesCount) { $nextPageLink = $link . $urlParam . ':' . ($currentPageNumber + 1); $smarty->assign('pagerNextPageLink', $nextPageLink); } if (isset($linkClass) and !empty($linkClass)) { $smarty->assign("linkClass", $linkClass); } $smarty->assign("pagerPageNumStart", $pageNumStart); $smarty->assign("pagerPageNumEnd", $pageNumEnd); $smarty->assign("pagerCurrentPageNumber", $currentPageNumber); $smarty->assign("pagerTotalPagesCount", $pagesCount); $smarty->assign("pagerNumbersArray", $pagerNumbersArray); } if (isset($tplChunkFile)) { $pagerChunkFileName = $tplChunkFile; } else { $pagerChunkFileName = ConfigManager::getConfig("Pager", "Pager")->AuxConfig->pagerChunkFileName; } return $smarty->fetch($smarty->getChunkPath($pagerChunkFileName)); } }