public function executeWidgetOuter(sfWebRequest $request) { $this->fetchWidget(); $petition = $this->widget['Petition']; /* @var $petition Petition */ $petition_text = $this->widget['PetitionText']; /* @var $petition_text PetitionText */ $this->count = $petition->getCount(60); $this->target = $this->count . '-' . Petition::calcTarget($this->count, $this->widget->getPetition()->getTargetNum()); $image_prefix = ($request->isSecure() ? 'https://' : 'http://') . $request->getHost() . '/' . $request->getRelativeUrlRoot() . 'images/'; $this->kind = $this->widget->getPetition()->getKind(); $this->lang = $this->widget->getPetitionText()->getLanguageId(); $this->getUser()->setCulture($this->lang); $this->label_mode = $this->widget->getPetition()->getLabelMode(); $stylings = json_decode($this->widget->getStylings(), true); if (!is_array($stylings)) { $stylings = array(); } $widget_colors = $petition->getWidgetIndividualiseDesign(); foreach (array('title_color', 'body_color', 'button_color', 'bg_left_color', 'bg_right_color', 'form_title_color') as $style) { if (!$widget_colors || !isset($stylings[$style]) || !$stylings[$style]) { $stylings[$style] = $petition['style_' . $style]; } } $this->stylings = $stylings; $this->keyvisual = $this->widget->getPetition()->getKeyVisual() ? $image_prefix . 'keyvisual/' . $this->widget->getPetition()->getKeyVisual() : null; $this->sprite = $image_prefix . 'policat.spr.png'; $this->url = $this->getContext()->getRouting()->generate('sign', array('id' => $this->widget['id'], 'hash' => $this->widget->getLastHash(true)), true); $this->getResponse()->setContentType('text/javascript'); $this->setLayout(false); $title = $this->widget->getTitle(); if (!$petition->getWidgetIndividualiseText()) { $title = $petition_text->getTitle(); } $this->title = Util::enc($title); }
public function executeVncviewer(sfWebRequest $request) { if ($request->getParameter('sleep')) { $tsleep = $request->getParameter('sleep'); sleep($tsleep); } $etva_server = EtvaServerPeer::retrieveByPk($request->getParameter('id')); if (!$etva_server) { return sfView::NONE; } $etva_node = $etva_server->getEtvaNode(); $user = $this->getUser(); $tokens = $user->getGuardUser()->getEtvaVncTokens(); $this->username = $tokens[0]->getUsername(); $this->token = $tokens[0]->getToken(); $proxyhost1 = $request->getHost(); $proxyhost1_arr = split(':', $proxyhost1); $proxyhost1 = $proxyhost1_arr[0]; $proxyport1 = $request->isSecure() ? 443 : 80; //$proxyport1 = 80; if ($proxyhost1_arr[1]) { $proxyport1 = $proxyhost1_arr[1]; } $this->proxyhost1 = $proxyhost1; $this->proxyport1 = $proxyport1; $this->socketFactory = $request->isSecure() ? 'AuthHTTPSConnectSSLSocketFactory' : 'AuthHTTPConnectSocketFactory'; $this->host = $etva_node->getIp(); //if host is localhost address then is the same machine if ($this->host == '127.0.0.1') { $this->host = $proxyhost1; } $this->port = $etva_server->getVncPort(); $response = $this->getResponse(); $response->setTitle($etva_server->getName() . ' :: Console'); }