Exemple #1
0
 /**
  * @brief 버튼을 출력함
  **/
 function printBtn()
 {
     if ($this->nextUrl) {
         $url = $this->nextUrl;
         printf('<do type="vnd.next" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
     }
     if ($this->prevUrl) {
         $url = $this->prevUrl;
         printf('<do type="vnd.prev" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
     }
     // 기타 해당사항 없는 버튼 출력 담당 (array로 전달) type??
     if ($this->etcBtn) {
         if (is_array($this->etcBtn)) {
             foreach ($this->etcBtn as $key => $val) {
                 printf('<do type="vnd.btn%s" label="%s"><go href="%s"/></do>%s', $key, $val['text'], $val['url'], "\n");
             }
         }
     }
     // 언어선택
     if (!parent::isLangChange()) {
         $url = getUrl('', 'lcm', '1', 'sel_lang', Context::getLangType(), 'return_uri', Context::get('current_url'));
         printf('<do type="vnd.lang" label="%s"><go href="%s"/></do>%s', 'Language : ' . Context::getLang('select_lang'), $url, "\n");
     } else {
         printf('<do type="vnd.lang" label="%s"><go href="%s"/></do>%s', Context::getLang('lang_return'), Context::get('return_uri'), "\n");
     }
     if ($this->homeUrl) {
         $url = $this->homeUrl;
         printf('<do type="access" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
     }
     if ($this->upperUrl) {
         $url = $this->upperUrl;
         printf('<do type="vnd.up" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
     }
 }
Exemple #2
0
 /**
  * createUrl creates the tinyUrl for requested Url
  * @params $url string, requested URL to be shorted
  * @return string
  **/
 public function createUrl($url)
 {
     try {
         $urlObj = $this->getUrl($url);
     } catch (Exception $e) {
         $response = array("status" => 'error', "message" => "An error occured, Please try again later", "error_code" => $e->getCode());
         return json_encode($response);
     }
     if ($urlObj) {
         $response = array("status" => 'success', "url" => $urlObj["url"], "tiny_url" => getUrl($urlObj["tiny"]));
         return json_encode($response);
     }
     do {
         try {
             $newTinyUrl = $this->createTinyUrl();
             $urlCheck = $this->getTinyUrl($newTinyUrl, true);
         } catch (Exception $e) {
             $response = array("status" => 'error', "message" => "An error occured, Please try again later", "error_code" => $e->getCode());
             return json_encode($response);
         }
     } while ($urlCheck == true);
     try {
         $this->registerUrl($url, $newTinyUrl);
         $response = array("status" => 'success', "url" => $url, "tiny_url" => getUrl($newTinyUrl));
         return json_encode($response);
     } catch (Exception $e) {
         $response = array("status" => 'error', "message" => $e->getMessage(), "error_code" => $e->getCode());
         return json_encode($response);
     }
 }
Exemple #3
0
 /**
  * Check whether to use RSS rss url by adding
  *
  * @return Object
  */
 function triggerRssUrlInsert()
 {
     $oModuleModel = getModel('module');
     $total_config = $oModuleModel->getModuleConfig('rss');
     $current_module_srl = Context::get('module_srl');
     $site_module_info = Context::get('site_module_info');
     if (is_array($current_module_srl)) {
         unset($current_module_srl);
     }
     if (!$current_module_srl) {
         $current_module_info = Context::get('current_module_info');
         $current_module_srl = $current_module_info->module_srl;
     }
     if (!$current_module_srl) {
         return new Object();
     }
     // Imported rss settings of the selected module
     $oRssModel = getModel('rss');
     $rss_config = $oRssModel->getRssModuleConfig($current_module_srl);
     if ($rss_config->open_rss != 'N') {
         Context::set('rss_url', $oRssModel->getModuleFeedUrl(Context::get('vid'), Context::get('mid'), 'rss'));
         Context::set('atom_url', $oRssModel->getModuleFeedUrl(Context::get('vid'), Context::get('mid'), 'atom'));
     }
     if (Context::isInstalled() && $site_module_info->mid == Context::get('mid') && $total_config->use_total_feed != 'N') {
         if (Context::isAllowRewrite() && !Context::get('vid')) {
             $request_uri = Context::getRequestUri();
             Context::set('general_rss_url', $request_uri . 'rss');
             Context::set('general_atom_url', $request_uri . 'atom');
         } else {
             Context::set('general_rss_url', getUrl('', 'module', 'rss', 'act', 'rss'));
             Context::set('general_atom_url', getUrl('', 'module', 'rss', 'act', 'atom'));
         }
     }
     return new Object();
 }
function principal()
{
    if (validarUsuarioLoggeado()) {
        if (validarAdministradorPrivado()) {
            $offset = 0;
            $numRows = 6;
            $pagina = 1;
            if (isset($_GET['p'])) {
                if (is_numeric($_GET['p'])) {
                    $pagina = intval($_GET['p']);
                    $offset = $numRows * ($pagina - 1);
                }
            }
            require_once 'modulos/grupos/modelos/grupoModelo.php';
            $res = getGrupos($offset, $numRows);
            $grupos = $res['grupos'];
            $numGrupos = $res['n'];
            $maxPagina = ceil($numGrupos / $numRows);
            if ($pagina != 1 && $pagina > $maxPagina) {
                redirect("/grupos&p=" . $maxPagina);
            }
            clearBreadCrumbs();
            pushBreadCrumb(getUrl(), "Lista de grupos", true);
            require_once 'modulos/grupos/vistas/principal.php';
        } else {
            goToIndex();
        }
    } else {
        goToIndex();
    }
}
function importShuttlePositions()
{
    $url = "http://shuttles.rpi.edu/vehicles/current.js";
    //mysql_query("TRUNCATE stops"); mysql_query("TRUNCATE stop_routes"); mysql_query("TRUNCATE routes"); mysql_query("TRUNCATE route_coords");
    $data = json_decode(getUrl($url));
    print_r($data);
    foreach ($data as $current_stat_item) {
        if ($current_stat_item->vehicle) {
            $shuttle_status = $current_stat_item->vehicle;
            /* update 'shuttle' table */
            if (Shuttle::get($shuttle_status->id)) {
                Shuttle::update($shuttle_status->id, $shuttle_status);
            } else {
                Shuttle::insert($shuttle_status);
            }
            if ($shuttle_status->latest_position) {
                /* update 'shuttle_coords' table */
                echo "inserting into shuttleCoords";
                echo ShuttleCoords::insert($shuttle_status->id, $shuttle_status->latest_position);
            }
        }
    }
    ShuttleCoords::deleteOlderThan(2);
    /* delete history over 2 days old */
}
Exemple #6
0
 /**
  * @brief Button to output
  **/
 function printBtn()
 {
     if ($this->nextUrl) {
         $url = $this->nextUrl;
         printf('<a href="%s">%s</a><br>%s', $url->url, $url->text, "\n");
     }
     if ($this->prevUrl) {
         $url = $this->prevUrl;
         printf('<a href="%s">%s</a><br>%s', $url->url, $url->text, "\n");
     }
     // Select Language
     if (!parent::isLangChange()) {
         $url = getUrl('', 'lcm', '1', 'sel_lang', Context::getLangType(), 'return_uri', Context::get('current_url'));
         printf('<a href="%s">%s</a><br>%s', $url, 'Language : ' . Context::getLang('select_lang'), "\n");
     } else {
         printf('<a href="%s">%s</a><br>%s', Context::get('return_uri'), Context::getLang('lang_return'), "\n");
     }
     if ($this->upperUrl) {
         $url = $this->upperUrl;
         printf('<btn href="%s" name="%s">%s', $url->url, $url->text, "\n");
     }
     if ($this->homeUrl) {
         $url = $this->homeUrl;
         printf('<a btn="%s" href="%s">%s</a><br>%s', $url->text, $url->url, $url->text, "\n");
     }
 }
Exemple #7
0
/**
 * 文章地址
 */
function getArticleUrl($art_id)
{
    if ($art_id <= 0) {
        return '#';
    }
    return getUrl('article/index', array('article_id' => $art_id));
}
 public function __construct($config, $order, $language, $urlBack, $url, $suffixOrder, $overrideAmount = 0, $debug = FALSE)
 {
     $paymentData = explode('|', $config);
     /*ShopID|Separator|SecretKey|PaymentUrl */
     $this->shopID = $paymentData[0];
     $this->separator = $paymentData[1];
     $this->SecretKey = $paymentData[2];
     $this->paymentUrl = $paymentData[3];
     $this->numord = sprintf('B%s%s%s%s', rand(1, 9999) . $this->separator, $order->ExternalId, $this->separator, $order->OrderId);
     $this->importo = number_format($order->DepositAmount * COM_BOOKINGFORCONNECTOR_CONVERSIONCURRENCY, 2, ',', '');
     $this->importoForMac = intval($order->DepositAmount * 100 * COM_BOOKINGFORCONNECTOR_CONVERSIONCURRENCY);
     if (isset($suffixOrder) && $suffixOrder != "" && $overrideAmount > 0) {
         $this->numord .= $this->separator . "R" . $suffixOrder;
         $this->importo = number_format($overrideAmount * COM_BOOKINGFORCONNECTOR_CONVERSIONCURRENCY, 2, ',', '');
         $this->importoForMac = intval($overrideAmount * 100 * COM_BOOKINGFORCONNECTOR_CONVERSIONCURRENCY);
     }
     $this->email = BFCHelper::getItem($order->CustomerData, 'email') . "";
     $this->languageId = $this->getLanguage($language);
     $this->url = $url;
     $this->urlBack = $urlBack;
     if ($debug) {
         $this->shopID = 'MYSHOP';
         $this->numord = 78;
         $this->importo = '17,00';
         $this->importoForMac = '1700';
         $this->SecretKey = '3DfEO2B5Jjm4VC1Q3vEh';
     }
     //$this->mac = $this->getMac();
     $this->redirectUrl = getUrl();
 }
 function _setParentUrl($menu_list)
 {
     if (!count($menu_list)) {
         return;
     }
     foreach ($menu_list as $key => $val) {
         if (!$val['text']) {
             continue;
         }
         if ($val['list'] && $this->_setParentUrl($val['list'])) {
             $href = $val['href'];
             if (preg_match('/^[a-z0-9_]+$/i', $val['url'])) {
                 $href = getUrl('', 'mid', $val['url'], 'smartphone', 'true');
             } else {
                 $href = $val['href'];
             }
             $this->setParentUrl($href);
             return false;
         }
         if ($val['url'] == Context::get('mid')) {
             return true;
         }
     }
     return false;
 }
function prepareItems(&$items)
{
    foreach ($items as &$item) {
        $url = getUrl($item);
        $item = array('id' => crc32('auto_' . $url), 'target' => getTarget($item['subdomain']), 'url' => $url, 'maker' => isset($item['maker']) ? $item['maker'] : '', 'model' => isset($item['model']) ? $item['model'] : '', 'year' => isset($item['year']) ? $item['year'] : '', 'fuel' => isset($item['fuel']) ? $item['fuel'] : '', 'color' => isset($item['color']) ? $item['color'] : '', 'type' => isset($item['type']) ? $item['type'] : '', 'min_price' => isset($item['min_price']) ? $item['min_price'] : '', 'body_type' => isset($item['body_type']) ? $item['body_type'] : '', 'city_name' => isset($item['city_name']) ? $item['city_name'] : '', 'total' => isset($item['total']) ? $item['total'] : '', 'calc' => isset($item['calc']) ? $item['calc'] : '');
    }
}
Exemple #11
0
function main_select()
{
    global $Page;
    if ($Page != 'main') {
        echo "<a href=\"" . getUrl('Page', 'main') . "\">Messages</a>\n";
    }
}
Exemple #12
0
 /**
  * @brief Button to output
  */
 function printBtn()
 {
     if ($this->nextUrl) {
         $url = $this->nextUrl;
         printf('<do type="vnd.next" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
     }
     if ($this->prevUrl) {
         $url = $this->prevUrl;
         printf('<do type="vnd.prev" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
     }
     // Others are not applicable in charge of the button output (array passed) type??
     if ($this->etcBtn) {
         if (is_array($this->etcBtn)) {
             foreach ($this->etcBtn as $key => $val) {
                 printf('<do type="vnd.btn%s" label="%s"><go href="%s"/></do>%s', $key, $val['text'], $val['url'], "\n");
             }
         }
     }
     // Select Language
     if (!parent::isLangChange()) {
         $url = getUrl('', 'lcm', '1', 'sel_lang', Context::getLangType(), 'return_uri', Context::get('current_url'));
         printf('<do type="vnd.lang" label="%s"><go href="%s"/></do>%s', 'Language : ' . lang('select_lang'), $url, "\n");
     } else {
         printf('<do type="vnd.lang" label="%s"><go href="%s"/></do>%s', lang('lang_return'), Context::get('return_uri'), "\n");
     }
     if ($this->homeUrl) {
         $url = $this->homeUrl;
         printf('<do type="access" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
     }
     if ($this->upperUrl) {
         $url = $this->upperUrl;
         printf('<do type="vnd.up" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
     }
 }
Exemple #13
0
function getImage($url)
{
    $newUrl = '';
    $imgContent = '';
    $ext = '(jpg|jpeg|gif|png)';
    $error_code = 0;
    if (substr($url, 0, 10) === 'data:image') {
        //base64编码的图片,可能出现在firefox粘贴,或者某些网站上,例如google图片等
        if (preg_match('/^data:image\\/' . $ext . '/i', $url, $match)) {
            $imgContent = base64_decode(substr($url, strpos($url, 'base64,') + 7));
        }
    } elseif (substr($url, 0, 5) === 'http:') {
        //url图片
        if (preg_match('/\\.' . $ext . '$/i', $url, $match)) {
            $imgContent = getUrl($url);
        }
    } else {
        // 上传的临时文件图片
        if (preg_match('/\\.' . $ext . '$/i', $url, $match)) {
            $imgContent = file_get_contents($url);
            unlink($url);
        }
    }
    $imageSize = strlen($imgContent);
    //文件体积不能小于1024,同时不能大于最大限制,默认5M
    if ($imageSize > 1024 && $imageSize <= 2.0E+20 * 5) {
        $newUrl = getNewUrl($match[1]);
        $newUrl = file_put_contents($newUrl, $imgContent) ? $newUrl : '';
    }
    $result = $newUrl ? array('success' => 1, 'url' => str_replace(JQE_ROOT, '', $newUrl), 'size' => $imageSize) : array('error' => $error_code, 'size' => $imageSize);
    return $result;
}
 /**
  * methodName
  *
  * @param string $url
  * @param array $paramToAdd
  * @param array $paramToRemove
  * @return string
  */
 private static function urlParamsResolver($url, $paramToAdd = [])
 {
     $getArray = $_GET;
     $currentUrl = getUrl();
     $queryString = http_build_query(array_merge(is_array($getArray) ? $getArray : [$getArray], $paramToAdd));
     return $currentUrl . ($queryString ? '?' . $queryString : '');
 }
function inscritos()
{
    if (validarAdministradorPrivado()) {
        if (isset($_GET['i']) && is_numeric($_GET['i'])) {
            $idGrupo = $_GET['i'];
            require_once 'modulos/grupos/modelos/grupoModelo.php';
            $offset = 0;
            $numRows = 16;
            $pagina = 1;
            if (isset($_GET['p'])) {
                if (is_numeric($_GET['p'])) {
                    $pagina = intval($_GET['p']);
                    $offset = $numRows * ($pagina - 1);
                }
            }
            $res = getUsuariosDelGrupo($idGrupo, $offset, $numRows);
            $usuarios = $res['usuarios'];
            $numUsuarios = $res['n'];
            $maxPagina = ceil($numUsuarios / $numRows);
            if ($pagina != 1 && $pagina > $maxPagina) {
                redirect("grupos/usuarios/inscritos/1&p=" . $maxPagina);
            } else {
                pushBreadCrumb(getUrl(), "Lista de usuarios del grupo", true, 1);
                require_once 'modulos/grupos/vistas/usuariosDelGrupo.php';
            }
        } else {
            setSessionMessage("Grupo no válido", " ¡Error! ", "error");
            redirect("/grupos");
        }
    } else {
        goToIndex();
    }
}
function printUserBox()
{
    global $userData;
    global $isLoggedIn;
    global $authUrl;
    handleNameChange();
    echo "<div class='userBox box header'>";
    if ($isLoggedIn) {
        echo "<img class='circle-image' src='" . $userData['picture'] . "' width=100px height=100px /><br/>";
        if (!isset($_GET["settings"])) {
            echo "<p class='welcome'>Welcome <a href='" . $userData['link'] . "'>" . getUsername($userData) . "</a></p>";
        } else {
            echo "<form action='" . getUrl() . "' method='post'>";
            echo "<p class='welcome'>Welcome";
            echo "<input type='text' name='displayName' value='" . getUsername($userData) . "'/>";
            echo "<input type='submit' value='Submit'>";
            echo "</p></form>";
        }
        echo "<div class='userBoxBottom'>";
        echo "<div class='settings'><a href='?settings'><img src='Settings.png' width=16px height=16px /></a></div>";
        echo "<div class='logout'><a href='?logout'>Logout</a></div></div>";
    } else {
        echo "<a href='{$authUrl}'>Sign in using Google</a>";
    }
    echo "</div>";
}
function postToSlack($text, $attachments_text = '')
{
    $slackUrl = 'https://slack.com/api/chat.postMessage?token=' . SLACK_TOKEN . '&channel=' . urlencode(SLACK_CHANNEL) . '&username='******'&icon_url=' . SLACK_BOT_AVATAR . '&unfurl_links=1&parse=full&pretty=1' . '&text=' . urlencode($text);
    if ($attachments_text) {
        $slackUrl .= '&attachments=' . urlencode('[{"text": "' . $attachments_text . '"}]');
    }
    var_dump(getUrl($slackUrl));
}
Exemple #18
0
 /**
  * Create the Feed url.
  *
  * @param string $vid Vid
  * @param string $mid mid
  * @param string $format Feed format. rss | atom
  * @param bool $absolute_url
  * @return string
  */
 function getModuleFeedUrl($vid, $mid, $format = 'rss', $absolute_url = false)
 {
     if ($absolute_url) {
         return getFullUrl('', 'vid', $vid, 'mid', $mid, 'act', $format);
     } else {
         return getUrl('', 'vid', $vid, 'mid', $mid, 'act', $format);
     }
 }
function getDirUrl()
{
    $url = getUrl();
    $path = explode('?', $url, 2)[0];
    $dirpath_end = strrpos($path, '/');
    $dirpath = substr($path, 0, $dirpath_end);
    return $dirpath;
}
Exemple #20
0
function getThisUrlFileParam()
{
    $url = '';
    $url = getUrl();
    $url = mid($url, inStrRev($url, '/') + 1, -1);
    $getThisUrlFileParam = $url;
    return @$getThisUrlFileParam;
}
Exemple #21
0
 /**
  * Returns the URL to this category
  * for the frontend product browsing (filtered by category)
  *
  * TODO Remove this function and use the CategoryTreeNode features instead
  * because custom urls are already supported
  *
  * @param bool $relative
  * @return string
  */
 public function getUrl($relative = TRUE)
 {
     if (!$this->friendly_url) {
         return getUrl('', 'act', 'dispShop', 'vid', BaseRepository::vid(), 'category_srl', $this->category_srl);
     }
     $repo = $this->repo;
     return $repo::getUrl($this->friendly_url, $relative);
 }
Exemple #22
0
 /**
  * display the pop-up menu of the post
  * Print, scrap, vote-up(recommen), vote-down(non-recommend), report features added
  * @return void
  */
 function getCommentMenu()
 {
     // get the post's id number and the current login information
     $comment_srl = Context::get('target_srl');
     $mid = Context::get('cur_mid');
     $logged_info = Context::get('logged_info');
     $act = Context::get('cur_act');
     // array values for menu_list, "comment post, target, url"
     $menu_list = array();
     // call a trigger
     ModuleHandler::triggerCall('comment.getCommentMenu', 'before', $menu_list);
     $oCommentController =& getController('comment');
     // feature that only member can do
     if ($logged_info->member_srl) {
         $oCommentModel =& getModel('comment');
         $columnList = array('comment_srl', 'module_srl', 'member_srl', 'ipaddress');
         $oComment = $oCommentModel->getComment($comment_srl, false, $columnList);
         $module_srl = $oComment->get('module_srl');
         $member_srl = $oComment->get('member_srl');
         $oModuleModel =& getModel('module');
         $comment_config = $oModuleModel->getModulePartConfig('document', $module_srl);
         if ($comment_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl) {
             // Add a vote-up button for positive feedback
             $url = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl);
             $oCommentController->addCommentPopupMenu($url, 'cmd_vote', '', 'javascript');
         }
         if ($comment_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl) {
             // Add a vote-down button for negative feedback
             $url = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl);
             $oCommentController->addCommentPopupMenu($url, 'cmd_vote_down', '', 'javascript');
         }
         // Add the report feature against abused posts
         $url = sprintf("doCallModuleAction('comment','procCommentDeclare','%s')", $comment_srl);
         $oCommentController->addCommentPopupMenu($url, 'cmd_declare', '', 'javascript');
     }
     // call a trigger (after)
     ModuleHandler::triggerCall('comment.getCommentMenu', 'after', $menu_list);
     // find a comment by IP matching if an administrator.
     if ($logged_info->is_admin == 'Y') {
         $oCommentModel =& getModel('comment');
         $oComment = $oCommentModel->getComment($comment_srl);
         if ($oComment->isExists()) {
             // Find a post of the corresponding ip address
             $url = getUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oComment->getIpAddress());
             $oCommentController->addCommentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress');
             $url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oComment->getIpAddress());
             $oCommentController->addCommentPopupMenu($url, 'cmd_add_ip_to_spamfilter', '', 'javascript');
         }
     }
     // Changing a language of pop-up menu
     $menus = Context::get('comment_popup_menu_list');
     $menus_count = count($menus);
     for ($i = 0; $i < $menus_count; $i++) {
         $menus[$i]->str = Context::getLang($menus[$i]->str);
     }
     // get a list of final organized pop-up menus
     $this->add('menus', $menus);
 }
 private function _makeCall($function, $param = "")
 {
     $params = '';
     if (is_array($param) and !empty($param)) {
         $params .= '&' . http_build_query($param);
     }
     $url = Flist::API_URL . $function . "?apikey=" . $this->getApikey() . $params;
     return (string) getUrl($url, 'get', '', 'gzip');
 }
function getLitpic($imgurl, $webid, $row)
{
    $litpic = '';
    $linkurl = getUrl($row['aid'], $row['webid'], $row['tablename'], $row['tag']);
    if (!empty($imgurl)) {
        $url = GetWebURLByWebid($webid);
        $litpic = $url . $imgurl;
        $litpic = " <li class=\"search_img_1\"><a href=\"{$linkurl}\" target=\"blank\"><img src=\"{$litpic}\" width=\"112\" height=\"84\" /></a></li>";
    }
    return $litpic;
}
Exemple #25
0
 protected function _actionPurge(Library\CommandContext $context)
 {
     //Purge the cache
     if (JFactory::getCache('')->gc()) {
         $message = JText::_('Expired items have been purged');
     } else {
         $message = JText::_('Error purging expired items');
     }
     $context->response->setRedirect($context->request - getUrl(), $message);
     return true;
 }
function getBaseUrl()
{
    $current_url = getUrl();
    $base_url = "";
    if (strpos($current_url, 'casarover/')) {
        $strs = split('casarover/', $current_url);
        $base_url = $strs[0] . 'casarover/';
    } else {
        $base_url = $current_url;
    }
    return $base_url;
}
function run()
{
    switch ($_SERVER['REQUEST_METHOD']) {
        case 'GET':
            print getUrl($_GET['url']);
            break;
        case 'POST':
            print sendPostRequest($_GET['url'], $_POST);
            break;
        default:
    }
}
function principal()
{
    //Ver una discusión en específico
    if (isset($_GET['idDiscusion']) && isset($_GET['curso'])) {
        require_once 'modulos/cursos/modelos/CursoModelo.php';
        $curso = getCursoFromUniqueUrl($_GET['curso']);
        require_once 'modulos/cursos/modelos/DiscusionModelo.php';
        $discusion = getDiscusion($_GET['idDiscusion']);
        if (isset($curso) && isset($discusion)) {
            //Hacemos los calculos de la puntuacion de esta discusión
            $votosTotales = $discusion->puntuacionMas + $discusion->puntuacionMenos;
            if ($discusion->puntuacionMas > 0) {
                if ($discusion->puntuacionMenos > 0) {
                    $porcentajePositivo = round($discusion->puntuacionMas / $votosTotales * 100);
                    $porcentajeNegativo = 100 - $porcentajePositivo;
                } else {
                    $porcentajePositivo = 100;
                    $porcentajeNegativo = 0;
                }
            } else {
                if ($discusion->puntuacionMenos > 0) {
                    $porcentajePositivo = 0;
                    $porcentajeNegativo = 100;
                } else {
                    $porcentajePositivo = 0;
                    $porcentajeNegativo = 0;
                }
            }
            $numRows = 5;
            $pagina = 1;
            $sigPagina = 2;
            $orden = "puntuacion";
            $ascendente = 0;
            $offset = $numRows * ($pagina - 1);
            require_once 'modulos/cursos/modelos/ComentarioModelo.php';
            $array = getComentarios($discusion->idDiscusion, $offset, $numRows, $orden, $ascendente);
            $comentarios = $array['comentarios'];
            $numComentarios = $array['n'];
            $maxPagina = ceil($numComentarios / $numRows);
            pushBreadCrumb("/curso/" . $curso->uniqueUrl . "#Foro", "Foro", false);
            pushBreadCrumb(getUrl(), $discusion->titulo, true);
            require_once 'modulos/cursos/vistas/vistaDiscusionForo.php';
        } else {
            //Los datos recibidos no son correctos
            require_once 'errorPages/404Page.php';
        }
    } else {
        //No hay datos
        require_once 'errorPages/404Page.php';
    }
}
Exemple #29
0
 function checkAdmin($isAjax = false)
 {
     if ($isAjax == false) {
         $_SESSION['redirect_url'] = getUrl();
     }
     if (!isset($_SESSION['account']) || $_SESSION["account"]["role"] > 1) {
         if ($isAjax == true) {
             die("ERROR_NOTLOGIN");
         } else {
             redirect(BASE_PATH . '/admin/login&reason=admin');
             die;
         }
     }
 }
 function procSmartPhone(&$oSmartPhone)
 {
     $prev_date = Context::get('prev_date');
     if ($prev_date) {
         $oSmartPhone->setPrevUrl(getUrl('date', $prev_date, 'document_srl', ''));
     }
     $next_date = Context::get('next_date');
     if ($next_date) {
         $oSmartPhone->setNextUrl(getUrl('date', $next_date, 'document_srl', ''));
     }
     $oTemplate = new TemplateHandler();
     $content = $oTemplate->compile($this->module_path . 'tpl', 'smartphone');
     $oSmartPhone->setContent($content);
 }