コード例 #1
0
 public function createAuthorGuest($nick, $email, $ip)
 {
     $objects = umiObjectsCollection::getInstance();
     $objectTypes = umiObjectTypesCollection::getInstance();
     $nick = trim($nick);
     $email = trim($email);
     if (!$nick) {
         $nick = getLabel('author-anonymous');
     }
     if (!$email) {
         $email = getServer('REMOTE_ADDR');
     }
     $sel = new selector('objects');
     $sel->types('object-type')->name('users', 'author');
     $sel->where('email')->equals($email);
     $sel->where('nickname')->equals($nick);
     $sel->where('ip')->equals($ip);
     $sel->limit(0, 1);
     if ($sel->first) {
         return $sel->first->id;
     } else {
         $user_name = $nick . " ({$email})";
         $object_type_id = $objectTypes->getBaseType("users", "author");
         $author_id = $objects->addObject($user_name, $object_type_id);
         $author = $objects->getObject($author_id);
         $author->name = $user_name;
         $author->is_registrated = false;
         $author->nickname = $nick;
         $author->email = $email;
         $author->ip = $ip;
         $author->commit();
         return $author_id;
     }
 }
コード例 #2
0
 /**
  * Generates an entry in the logbook an increases the hits-counter
  *
  * @param \class_module_mediamanager_file $objFile
  */
 public static function generateDlLog(class_module_mediamanager_file $objFile)
 {
     $objDB = class_carrier::getInstance()->getObjDB();
     $strQuery = "INSERT INTO " . _dbprefix_ . "mediamanager_dllog\n\t                   (downloads_log_id, downloads_log_date, downloads_log_file, downloads_log_user, downloads_log_ip) VALUES\n\t                   (?, ?, ?, ?, ?)";
     $objDB->_pQuery($strQuery, array(generateSystemid(), (int) time(), basename($objFile->getStrFilename()), class_carrier::getInstance()->getObjSession()->getUsername(), getServer("REMOTE_ADDR")));
     $objFile->increaseHits();
 }
コード例 #3
0
 public function selectCurrency()
 {
     $currencyCode = getRequest('currency-codename');
     $selectedCurrency = $this->getCurrency($currencyCode);
     if ($currencyCode && $selectedCurrency) {
         $defaultCurrency = $this->getDefaultCurrency();
         if (permissionsCollection::getInstance()->isAuth()) {
             $customer = customer::get();
             if ($customer->preffered_currency != $selectedCurrency->id) {
                 if ($selectedCurrency->id == $defaultCurrency->id) {
                     $customer->preffered_currency = null;
                 } else {
                     $customer->preffered_currency = $selectedCurrency->id;
                 }
                 $customer->commit();
             }
         } else {
             setcookie('customer_currency', $selectedCurrency->id, time() + customer::$defaultExpiration, '/');
         }
     }
     if ($redirectUri = getRequest('redirect-uri')) {
         $this->redirect($redirectUri);
     } else {
         $this->redirect(getServer('HTTP_REFERER'));
     }
 }
コード例 #4
0
ファイル: class_history.php プロジェクト: jinshana/kajonacms
 private function writeToHistoryArray($strSessionKey)
 {
     $strQueryString = getServer("QUERY_STRING");
     //Clean querystring of empty actions
     if (uniSubstr($strQueryString, -8) == "&action=") {
         $strQueryString = substr_replace($strQueryString, "", -8);
     }
     //Just do s.th., if not in the rights-mgmt
     if (uniStrpos($strQueryString, "module=right") !== false) {
         return;
     }
     $arrHistory = $this->objSession->getSession($strSessionKey);
     //And insert just, if different to last entry
     if ($strQueryString == $this->getHistoryEntry(0, $strSessionKey)) {
         return;
     }
     //If we reach up here, we can enter the current query
     if ($arrHistory !== false) {
         array_unshift($arrHistory, $strQueryString);
         while (count($arrHistory) > 10) {
             array_pop($arrHistory);
         }
     } else {
         $arrHistory = array($strQueryString);
     }
     //saving the new array to session
     $this->objSession->setSession($strSessionKey, $arrHistory);
 }
コード例 #5
0
 /**
  * Creates a small login-field
  *
  * @return string
  */
 protected function actionLogin()
 {
     if ($this->objSession->isLoggedin() && $this->objSession->isAdmin()) {
         $this->loadPostLoginSite();
         return;
     }
     //Save the requested URL
     if ($this->getParam("loginerror") == "") {
         //Store some of the last requests' data
         $this->objSession->setSession(self::SESSION_REFERER, getServer("QUERY_STRING"));
         $this->objSession->setSession(self::SESSION_PARAMS, getArrayPost());
     }
     //Loading a small login-form
     $strTemplateID = $this->objTemplate->readTemplate("/elements.tpl", "login_form");
     $arrTemplate = array();
     $strForm = "";
     $strForm .= $this->objToolkit->formHeader(class_link::getLinkAdminHref($this->getArrModule("modul"), "adminLogin"));
     $strForm .= $this->objToolkit->formInputText("name", $this->getLang("login_loginUser", "user"), "", "input-large");
     $strForm .= $this->objToolkit->formInputPassword("passwort", $this->getLang("login_loginPass", "user"), "", "input-large");
     $strForm .= $this->objToolkit->formInputSubmit($this->getLang("login_loginButton", "user"));
     $strForm .= $this->objToolkit->formClose();
     $arrTemplate["form"] = $strForm;
     $arrTemplate["loginTitle"] = $this->getLang("login_loginTitle", "user");
     $arrTemplate["loginJsInfo"] = $this->getLang("login_loginJsInfo", "user");
     $arrTemplate["loginCookiesInfo"] = $this->getLang("login_loginCookiesInfo", "user");
     //An error occurred?
     if ($this->getParam("loginerror") == 1) {
         $arrTemplate["error"] = $this->getLang("login_loginError", "user");
     }
     $strReturn = $this->objTemplate->fillTemplate($arrTemplate, $strTemplateID);
     return $strReturn;
 }
コード例 #6
0
ファイル: common.php プロジェクト: honchoman/singpolyma
function doAuth($info, $trusted = null, $fail_cancels = false)
{
    if (!$info) {
        // There is no authentication information, so bail
        return authCancel(null);
    }
    $req_url = $info->identity;
    $user = getLoggedInUser();
    setRequestInfo($info);
    if ($req_url != $user) {
        return login_render(array(), $req_url, $req_url);
    }
    $sites = getSessionSites();
    $trust_root = $info->trust_root;
    $fail_cancels = $fail_cancels || isset($sites[$trust_root]);
    $trusted = isset($trusted) ? $trusted : isTrusted($req_url, $trust_root);
    if ($trusted) {
        setRequestInfo();
        $server =& getServer();
        $response =& $info->answer(true);
        $webresponse =& $server->encodeResponse($response);
        $new_headers = array();
        foreach ($webresponse->headers as $k => $v) {
            $new_headers[] = $k . ": " . $v;
        }
        return array($new_headers, $webresponse->body);
    } elseif ($fail_cancels) {
        return authCancel($info);
    } else {
        return trust_render($info);
    }
}
コード例 #7
0
ファイル: download.php プロジェクト: jinshana/kajonacms
 /**
  * Sends the requested file to the browser
  * @return string
  */
 public function actionDownload()
 {
     //Load filedetails
     if (validateSystemid($this->getSystemid())) {
         /** @var $objFile class_module_mediamanager_file */
         $objFile = class_objectfactory::getInstance()->getObject($this->getSystemid());
         //Succeeded?
         if ($objFile instanceof class_module_mediamanager_file && $objFile->getIntRecordStatus() == "1" && $objFile->getIntType() == class_module_mediamanager_file::$INT_TYPE_FILE) {
             //Check rights
             if ($objFile->rightRight2()) {
                 //Log the download
                 class_module_mediamanager_logbook::generateDlLog($objFile);
                 //Send the data to the browser
                 $strBrowser = getServer("HTTP_USER_AGENT");
                 //Check the current browsertype
                 if (uniStrpos($strBrowser, "IE") !== false) {
                     //Internet Explorer
                     class_response_object::getInstance()->addHeader("Content-type: application/x-ms-download");
                     class_response_object::getInstance()->addHeader("Content-type: x-type/subtype\n");
                     class_response_object::getInstance()->addHeader("Content-type: application/force-download");
                     class_response_object::getInstance()->addHeader("Content-Disposition: attachment; filename=" . preg_replace('/\\./', '%2e', saveUrlEncode(trim(basename($objFile->getStrFilename()))), substr_count(basename($objFile->getStrFilename()), '.') - 1));
                 } else {
                     //Good: another browser vendor
                     class_response_object::getInstance()->addHeader("Content-Type: application/octet-stream");
                     class_response_object::getInstance()->addHeader("Content-Disposition: attachment; filename=" . saveUrlEncode(trim(basename($objFile->getStrFilename()))));
                 }
                 //Common headers
                 class_response_object::getInstance()->addHeader("Expires: Mon, 01 Jan 1995 00:00:00 GMT");
                 class_response_object::getInstance()->addHeader("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
                 class_response_object::getInstance()->addHeader("Pragma: no-cache");
                 class_response_object::getInstance()->addHeader("Content-description: JustThum-Generated Data\n");
                 class_response_object::getInstance()->addHeader("Content-Length: " . filesize(_realpath_ . $objFile->getStrFilename()));
                 //End Session
                 $this->objSession->sessionClose();
                 class_response_object::getInstance()->sendHeaders();
                 //Loop the file
                 $ptrFile = @fopen(_realpath_ . $objFile->getStrFilename(), 'rb');
                 fpassthru($ptrFile);
                 @fclose($ptrFile);
                 ob_flush();
                 flush();
                 return "";
             } else {
                 class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_FORBIDDEN);
             }
         } else {
             class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_NOT_FOUND);
         }
     } else {
         class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_NOT_FOUND);
     }
     //if we reach up here, something gone wrong :/
     class_response_object::getInstance()->setStrRedirectUrl(str_replace(array("_indexpath_", "&"), array(_indexpath_, "&"), class_link::getLinkPortalHref(class_module_system_setting::getConfigValue("_pages_errorpage_"))));
     class_response_object::getInstance()->sendHeaders();
     class_response_object::getInstance()->sendContent();
     return "";
 }
コード例 #8
0
 public function __construct()
 {
     $v793914c9c583d9d86d0f4ed8c521b0c1 = defined("SERVER_ID") ? SERVER_ID : getServer('SERVER_ADDR');
     if (defined("MEMCACHE_COMPRESSED")) {
         $this->compress = MEMCACHE_COMPRESSED;
     }
     $this->mode = md5($v793914c9c583d9d86d0f4ed8c521b0c1) . "_";
     $this->enabled = $this->connect();
 }
コード例 #9
0
ファイル: actions.php プロジェクト: akbarhossain/openid4me
/**
 * Handle a standard OpenID server request
 */
function action_default()
{
    header('X-XRDS-Location: ' . buildURL('idpXrds'));
    $server =& getServer();
    $method = $_SERVER['REQUEST_METHOD'];
    $request = null;
    if ($method == 'GET') {
        $request = $_GET;
    } else {
        $request = $_POST;
    }
    $request = $server->decodeRequest();
    if (!$request) {
        return about_render();
    }
    setRequestInfo($request);
    if (in_array($request->mode, array('checkid_immediate', 'checkid_setup'))) {
        if ($request->idSelect()) {
            // Perform IDP-driven identifier selection
            if ($request->mode == 'checkid_immediate') {
                $response =& $request->answer(false);
            } else {
                return trust_render($request);
            }
        } else {
            if (!$request->identity && !$request->idSelect()) {
                // No identifier used or desired; display a page saying
                // so.
                return noIdentifier_render();
            } else {
                if ($request->immediate) {
                    $response =& $request->answer(false, buildURL());
                } else {
                    /*
                                if (!getLoggedInUser()) {
                                    return login_render();
                                }
                    */
                    return trust_render($request);
                }
            }
        }
    } else {
        $response =& $server->handleRequest($request);
    }
    $webresponse =& $server->encodeResponse($response);
    if ($webresponse->code != AUTH_OPENID_HTTP_OK) {
        header(sprintf("HTTP/1.1 %d ", $webresponse->code), true, $webresponse->code);
    }
    foreach ($webresponse->headers as $k => $v) {
        header("{$k}: {$v}");
    }
    header(header_connection_close);
    print $webresponse->body;
    exit(0);
}
コード例 #10
0
ファイル: class_cookie.php プロジェクト: jinshana/kajonacms
 /**
  * Sends a cookie to the browser
  *
  * @param string $strName
  * @param string $strValue
  * @param int $intTime
  *
  * @return bool
  */
 public function setCookie($strName, $strValue, $intTime = 0)
 {
     //cookie is 30 days valid
     if ($intTime == 0) {
         $intTime = time() + 60 * 60 * 24 * 30;
     }
     $strPath = preg_replace('#http(s?)://' . getServer("HTTP_HOST") . '#i', '', _webpath_);
     if ($strPath == "" || $strPath[0] != "/") {
         $strPath = "/" . $strPath;
     }
     return setcookie($strName, $strValue, $intTime, $strPath);
 }
コード例 #11
0
function pushJsDomain($vad5f82e879a9c5d6b5b442eb37e50551)
{
    static $vcd69b4957f06cd818d7bf3d61980e291 = array();
    if (getServer('HTTP_HOST') == $vad5f82e879a9c5d6b5b442eb37e50551) {
        return false;
    }
    if (in_array($vad5f82e879a9c5d6b5b442eb37e50551, $vcd69b4957f06cd818d7bf3d61980e291)) {
        return false;
    } else {
        $vcd69b4957f06cd818d7bf3d61980e291[] = $vad5f82e879a9c5d6b5b442eb37e50551;
        echo "domainsList[domainsList.length] = \"", $vad5f82e879a9c5d6b5b442eb37e50551, "\";\n";
        return true;
    }
}
コード例 #12
0
ファイル: actions.php プロジェクト: lorea/Hydra-dev
/**
 * Handle a standard OpenID server request
 */
function action_default()
{
    global $store;
    $server =& getServer();
    $method = $_SERVER['REQUEST_METHOD'];
    /*$request = null;
      if ($method == 'GET') {
          $request = $_GET;
      } else {
          $request = $_POST;
      } */
    $request = $server->decodeRequest();
    if (!$request) {
        return "";
        //about_render();
    }
    setRequestInfo($request);
    if (in_array($request->mode, array('checkid_immediate', 'checkid_setup'))) {
        $identity = getLoggedInUser();
        if (isTrusted($identity, $request->trust_root, $request->return_to)) {
            if ($request->message->isOpenID1()) {
                $response =& $request->answer(true);
            } else {
                $response =& $request->answer(true, false, getServerURL(), $identity);
            }
        } else {
            if ($request->immediate) {
                $response =& $request->answer(false, getServerURL());
            } else {
                if (!getLoggedInUser()) {
                    $_SESSION['last_forward_from'] = current_page_url() . '?' . http_build_query(Auth_OpenID::getQuery());
                    system_message(elgg_echo('openid_server:not_logged_in'));
                    forward('login');
                }
                return trust_render($request);
            }
        }
        addSregFields(&$response);
    } else {
        $response =& $server->handleRequest($request);
    }
    $webresponse =& $server->encodeResponse($response);
    foreach ($webresponse->headers as $k => $v) {
        header("{$k}: {$v}");
    }
    header(header_connection_close);
    print $webresponse->body;
    exit(0);
}
コード例 #13
0
 /**
  * This generic method is called in case of dispatched events.
  * The first param is the name of the event, the second argument is an array of
  * event-specific arguments.
  * Make sure to return a matching boolean value, indicating if the event-process was successful or not. The event source may
  * depend on a valid return value.
  *
  * @param string $strEventIdentifier
  * @param array $arrArguments
  *
  * @return bool
  */
 public function handleEvent($strEventIdentifier, array $arrArguments)
 {
     /** @var class_request_entrypoint_enum $objEntrypoint */
     $objEntrypoint = $arrArguments[0];
     if ($objEntrypoint->equals(class_request_entrypoint_enum::INDEX()) && class_carrier::getInstance()->getParam("admin") == "") {
         //process stats request
         $objStats = class_module_system_module::getModuleByName("stats");
         if ($objStats != null) {
             //Collect Data
             $objLanguage = new class_module_languages_language();
             $objStats = new class_module_stats_worker();
             $objStats->createStatsEntry(getServer("REMOTE_ADDR"), time(), class_carrier::getInstance()->getParam("page"), rtrim(getServer("HTTP_REFERER"), "/"), getServer("HTTP_USER_AGENT"), $objLanguage->getPortalLanguage());
         }
     }
 }
コード例 #14
0
 /**
  * Generates a login-log-entry
  *
  * @param int $intStatus
  * @param string $strOtherUsername
  *
  * @return bool
  * @static
  */
 public static function generateLog($intStatus = 1, $strOtherUsername = "")
 {
     $arrParams = array();
     $strQuery = "INSERT INTO " . _dbprefix_ . "user_log\n\t\t\t\t\t\t(user_log_id, user_log_userid, user_log_date, user_log_status, user_log_ip, user_log_sessid) VALUES\n\t\t\t\t\t\t(?, ?, ?, ?, ?, ?)";
     $arrParams[] = generateSystemid();
     if ($strOtherUsername == "") {
         $arrParams[] = class_carrier::getInstance()->getObjSession()->getUserID() == "" ? "0" : class_carrier::getInstance()->getObjSession()->getUserID();
     } else {
         $arrParams[] = $strOtherUsername;
     }
     $arrParams[] = class_date::getCurrentTimestamp();
     $arrParams[] = (int) $intStatus;
     $arrParams[] = getServer("REMOTE_ADDR");
     $arrParams[] = class_carrier::getInstance()->getObjSession()->getInternalSessionId();
     return class_carrier::getInstance()->getObjDB()->_pQuery($strQuery, $arrParams);
 }
コード例 #15
0
ファイル: server.php プロジェクト: ahelsing/geni-portal
function action_authorize()
{
    $server =& getServer();
    $info = getRequestInfo();
    if (!$info) {
        $info = $server->decodeRequest();
    }
    // Throw away the info, we no longer need it.
    setRequestInfo();
    $trusted = isset($_POST['save']);
    if ($trusted) {
        return send_geni_user($server, $info);
    } else {
        return send_cancel($info);
    }
}
コード例 #16
0
ファイル: utilities.php プロジェクト: wangshipeng/Php-Online
function getHttpHost()
{
    $host = getServer('HTTP_HOST');
    if (!empty($host)) {
        return $host;
    }
    $scheme = getScheme();
    $name = getServer('SERVER_NAME');
    $port = getServer('SERVER_PORT');
    if (null === $name) {
        return '';
    } elseif ($scheme == 'http' && $port == 80 || $scheme == 'https' && $port == 443) {
        return $name;
    } else {
        return $name . ':' . $port;
    }
}
コード例 #17
0
 protected function translateToDTD($phrases)
 {
     $dtd = "<!ENTITY quote '&#34;'>\n";
     $dtd .= "<!ENTITY nbsp '&#160;'>\n";
     $dtd .= "<!ENTITY middot '&#183;'>\n";
     $dtd .= "<!ENTITY reg '&#174;'>\n";
     $dtd .= "<!ENTITY copy '&#169;'>\n";
     $dtd .= "<!ENTITY raquo '&#187;'>\n";
     $dtd .= "<!ENTITY laquo '&#171;'>\n";
     $request_uri = getServer('REQUEST_URI');
     $request_uri = htmlspecialchars($request_uri);
     foreach ($phrases as $ref => $phrase) {
         $phrase = $this->protectEntityValue($phrase);
         $dtd .= "<!ENTITY {$ref} \"{$phrase}\">\n";
     }
     return $dtd;
 }
コード例 #18
0
ファイル: actions.php プロジェクト: honchoman/singpolyma
/**
 * Handle a standard OpenID server request
 */
function action_default()
{
    $server =& getServer();
    $method = $_SERVER['REQUEST_METHOD'];
    $request = null;
    if ($method == 'GET') {
        $request = $_GET;
    } else {
        $request = $_POST;
    }
    $request = Auth_OpenID::fixArgs($request);
    $request = $server->decodeRequest($request);
    if (!$request) {
        return about_render();
    }
    setRequestInfo($request);
    if (in_array($request->mode, array('checkid_immediate', 'checkid_setup'))) {
        if (isTrusted($request->identity, $request->trust_root)) {
            $response =& $request->answer(true);
            $sreg = getSreg($request->identity);
            if (is_array($sreg)) {
                foreach ($sreg as $k => $v) {
                    $response->addField('sreg', $k, $v);
                }
            }
        } else {
            if ($request->immediate) {
                $response =& $request->answer(false, getServerURL());
            } else {
                if (!getLoggedInUser()) {
                    return login_render();
                }
                return trust_render($request);
            }
        }
    } else {
        $response =& $server->handleRequest($request);
    }
    $webresponse =& $server->encodeResponse($response);
    foreach ($webresponse->headers as $k => $v) {
        header("{$k}: {$v}");
    }
    header(header_connection_close);
    print $webresponse->body;
    exit(0);
}
コード例 #19
0
function doAuth($info, $trusted = null, $fail_cancels = false, $idpSelect = null)
{
    if (!$info) {
        // There is no authentication information, so bail
        return authCancel(null);
    }
    if ($info->idSelect()) {
        if ($idpSelect) {
            $req_url = idURL($idpSelect);
        } else {
            $trusted = false;
        }
    } else {
        $req_url = $info->identity;
    }
    $user = getLoggedInUser();
    setRequestInfo($info);
    if (!$info->idSelect() && $req_url != idURL($user)) {
        return login_render(array(), $req_url, $req_url);
    }
    $trust_root = $info->trust_root;
    if ($trusted) {
        setRequestInfo();
        $server =& getServer();
        $response =& $info->answer(true, null, $req_url);
        // Answer with some sample Simple Registration data.
        $sreg_data = array('fullname' => 'Example User', 'nickname' => 'example', 'dob' => '1970-01-01', 'email' => 'invalid@example.com', 'gender' => 'F', 'postcode' => '12345', 'country' => 'ES', 'language' => 'eu', 'timezone' => 'America/New_York');
        // Add the simple registration response values to the OpenID
        // response message.
        $sreg_request = Auth_OpenID_SRegRequest::fromOpenIDRequest($info);
        $sreg_response = Auth_OpenID_SRegResponse::extractResponse($sreg_request, $sreg_data);
        $sreg_response->toMessage($response->fields);
        // Generate a response to send to the user agent.
        $webresponse =& $server->encodeResponse($response);
        $new_headers = array();
        foreach ($webresponse->headers as $k => $v) {
            $new_headers[] = $k . ": " . $v;
        }
        return array($new_headers, $webresponse->body);
    } elseif ($fail_cancels) {
        return authCancel($info);
    } else {
        return trust_render($info);
    }
}
コード例 #20
0
 public function checkLogged($template = "default")
 {
     if (!$template) {
         $template = "default";
     }
     if (!$this->is_auth()) {
         list($template_reg_form) = def_module::loadTemplates("users/" . $template, "login_registration_form");
         $from_page = getRequest('from_page');
         if (!$from_page) {
             $from_page = getServer('REQUEST_URI');
         }
         $block_arr = array();
         $block_arr['from_page'] = def_module::protectStringVariable($from_page);
         return def_module::parseTemplate($template_reg_form, $block_arr, false);
     } else {
         return;
     }
 }
コード例 #21
0
 protected function prepareStoreDir()
 {
     $v183f3fe79292a8d428a6160d1d44bd90 = $this->logDir;
     $v89d2e9db6cf76746b7bebdc7f21d1646 = getServer('REMOTE_ADDR');
     $vd30057347e577d1ac6f943b16c967047 = $v183f3fe79292a8d428a6160d1d44bd90 . $v89d2e9db6cf76746b7bebdc7f21d1646;
     if (file_exists($vd30057347e577d1ac6f943b16c967047)) {
         if (is_writable($vd30057347e577d1ac6f943b16c967047)) {
             return $vd30057347e577d1ac6f943b16c967047;
         } else {
             throw new Exception("Directory \"{$vd30057347e577d1ac6f943b16c967047}\" must be writable");
         }
     }
     if (mkdir($vd30057347e577d1ac6f943b16c967047)) {
         return $vd30057347e577d1ac6f943b16c967047 . '/';
     } else {
         throw new Exception("Can't create directory \"{$vd30057347e577d1ac6f943b16c967047}\"");
     }
 }
コード例 #22
0
 public function tickets()
 {
     $mode = getRequest('param0');
     $id = getRequest('param1');
     $objects = umiObjectsCollection::getInstance();
     $buffer = outputBuffer::current();
     $buffer->contentType('text/javascript');
     $buffer->option('generation-time', false);
     $buffer->clear();
     $json = new jsonTranslator();
     if ($mode == 'create') {
         $type = selector::get('object-type')->name('content', 'ticket');
         $id = $objects->addObject(null, $type->getId());
     }
     if ($id) {
         $ticket = selector::get('object')->id($id);
         $this->validateEntityByTypes($ticket, array('module' => 'content', 'method' => 'ticket'));
     } else {
         throw new publicException("Wrong params");
     }
     if ($mode == 'delete') {
         $objects->delObject($id);
         $buffer->end();
     }
     $ticket->x = (int) getRequest('x');
     $ticket->y = (int) getRequest('y');
     $ticket->width = (int) getRequest('width');
     $ticket->height = (int) getRequest('height');
     $ticket->message = $ticket->name = getRequest('message');
     $url = getRequest('referer') ? getRequest('referer') : getServer('HTTP_REFERER');
     $url = str_replace("%", "&#37", $url);
     if ($url) {
         $ticket->url = $url;
     }
     if ($mode == 'create') {
         $permissions = permissionsCollection::getInstance();
         $ticket->user_id = $permissions->getUserId();
     }
     $ticket->commit();
     $data = array('id' => $ticket->id);
     $result = $json->translateToJson($data);
     $buffer->push($result);
     $buffer->end();
 }
コード例 #23
0
ファイル: confirm.php プロジェクト: highfidelity/love
function sendConfirmationEmail()
{
    error_log("sendConfirmationEmail");
    // Store params
    $instance = base64_encode($_REQUEST['instance']);
    $name = base64_encode($_REQUEST['name']);
    $email = base64_encode($_REQUEST['email']);
    $password = base64_encode('{crypt}' . Functions::encryptPassword($_REQUEST['password']));
    $source = base64_encode($_REQUEST['source']);
    $adword = base64_encode($_REQUEST['adword']);
    $to = $_REQUEST['email'];
    $subject = 'Confirm account creation on SendLove';
    // Create a hard verification
    $salt = "aB1cD2eF3G_&\$^%+";
    $proof = md5($email . $instance . $salt);
    $link = getServer() . getAppLocation() . 'confirm.php?action=confirm&is=' . $instance . '&n=' . $name . '&e=' . $email . '&w=' . $password . '&p=' . $proof . '&s=' . $source . "&a=" . $adword;
    $msg = '<html><body>' . '<p>Thank you for trying SendLove</p>' . '<p>Before you can continue, please confirm your account by clicking the link below.<p>' . '<p><a href="' . $link . '" >Activate Account</a></p>' . '</body></html>';
    send_email($to, $subject, $msg);
}
コード例 #24
0
 public function import_old_blogs()
 {
     // Initializing collections
     $hierarchyTypesCollection = umiHierarchyTypesCollection::getInstance();
     $typesCollection = umiObjectTypesCollection::getInstance();
     $hierarchy = umiHierarchy::getInstance();
     $objects = umiObjectsCollection::getInstance();
     // Loading types info
     $blog20HType = $hierarchyTypesCollection->getTypeByName('blogs20', 'blog');
     $blog20Type = $typesCollection->getType($typesCollection->getTypeByHierarchyTypeId($blog20HType->getId()));
     $blog20PostHType = $hierarchyTypesCollection->getTypeByName('blogs20', 'post');
     $blog20PostType = $typesCollection->getType($typesCollection->getTypeByHierarchyTypeId($blog20PostHType->getId()));
     $blog20CommentHType = $hierarchyTypesCollection->getTypeByName('blogs20', 'comment');
     $blog20CommentType = $typesCollection->getType($typesCollection->getTypeByHierarchyTypeId($blog20CommentHType->getId()));
     $blogHType = $hierarchyTypesCollection->getTypeByName('blogs', 'blog');
     $blogType = $typesCollection->getType($typesCollection->getTypeByHierarchyTypeId($blogHType->getId()));
     $blogPostHType = $hierarchyTypesCollection->getTypeByName('blogs', 'blog_message');
     $blogPostType = $typesCollection->getType($typesCollection->getTypeByHierarchyTypeId($blogHType->getId()));
     $blogCommentHType = $hierarchyTypesCollection->getTypeByName('blogs', 'blog_comment');
     $blogCommentType = $typesCollection->getType($typesCollection->getTypeByHierarchyTypeId($blogHType->getId()));
     // Collecting all blogs
     $selection = new umiSelection();
     $selection->addElementType($blogHType->getId());
     $blogList = umiSelectionsParser::runSelection($selection);
     // Processing each blog
     foreach ($blogList as $blogId) {
         $blog = $hierarchy->getElement($blogId, true, false);
         $newBlogId = $this->makeElementFromExisting($blogId, $blog->getRel(), $blog20HType->getId(), array('content' => 'description', 'prvlist_friends' => 'friendlist'));
         $selection = new umiSelection();
         $selection->addElementType($blogPostHType->getId());
         $selection->addHierarchyFilter($blogId);
         $postList = umiSelectionsParser::runSelection($selection);
         foreach ($postList as $postId) {
             $newPostId = $this->makeElementFromExisting($postId, $newBlogId, $blog20PostHType->getId());
             $this->import_comments($postId, $newPostId, $blogCommentHType->getId(), $blog20CommentHType->getId());
         }
     }
     regedit::getInstance()->setVar("//modules/blogs20/import/old", 1);
     $this->chooseRedirect(getServer('HTTP_REFERER'));
     return null;
     // Never pass into here
 }
コード例 #25
0
 public function removeDeliveryAddress($addressId = false)
 {
     if (!$addressId) {
         $addressId = getRequest("param0");
     }
     $addressId = (int) $addressId;
     $collection = umiObjectsCollection::getInstance();
     if (!$collection->isExists($addressId)) {
         throw new publicException("Wrong address id passed");
     }
     $customer = customer::get();
     $customer->delivery_addresses = array_filter($customer->delivery_addresses, create_function("\$v", "return (\$v != {$addressId});"));
     $sel = new selector("objects");
     $sel->types("object-type")->name("emarket", "order");
     $sel->where("delivery_address")->equals($addressId);
     if (!$sel->length) {
         $collection->delObject($addressId);
     }
     $this->redirect(getServer("HTTP_REFERER"));
 }
コード例 #26
0
ファイル: ch_m.php プロジェクト: BGCX261/zimmerli-svn-to-git
function ch_get_illegal_modules()
{
    $regedit = regedit::getInstance();
    $info = array();
    $info['type'] = 'get-modules-list';
    $info['revision'] = $regedit->getVal("//modules/autoupdate/system_build");
    $info['host'] = getServer('HTTP_HOST');
    $info['ip'] = getServer('SERVER_ADDR');
    $info['key'] = $regedit->getVal("//settings/keycode");
    $url = base64_decode('aHR0cDovL3Vkb2QudW1paG9zdC5ydS91cGRhdGVzZXJ2ZXIv') . "?" . http_build_query($info, '', '&');
    $result = get_file($url);
    $xml = new DOMDocument();
    $xml->loadXML($result);
    $xpath = new DOMXPath($xml);
    $illegal_modules = array();
    $no_active = $xpath->query("//module[not(@active)]");
    foreach ($no_active as $module) {
        $illegal_modules[] = $module->getAttribute("name");
    }
    unset($regedit, $info, $url, $result, $xml, $xpath, $no_active, $module);
    return $illegal_modules;
}
コード例 #27
0
 /**
  * Устанавливает режим отображения сайта
  * @internal
  *
  * @param bool $isMobile Режим
  */
 public function setMobileMode($isMobile = null)
 {
     if (is_null($isMobile)) {
         $isMobile = getRequest('param0');
     }
     if ($isMobile == 1) {
         setcookie("is_mobile", "1", null, "/");
     } elseif ($isMobile == 0) {
         setcookie("is_mobile", "0", null, "/");
     }
     parent::redirect(getServer('HTTP_REFERER'));
 }
コード例 #28
0
ファイル: ModifySession.php プロジェクト: kleopatra999/finx
        ?>
         </select> 
        </td>
        </tr>
        </table>
        <div id=result> 
        <?
         if($_POST['serverId'])
         {
         $descList  = getServer($_POST['serverId']);
         $desc  = mysql_fetch_array($descList);
          
         }
         else
         {
          $descList  = getServer($sessionDB['idServer']);
          $desc  = mysql_fetch_array($descList); 
         }
        ?>
          <table id="hostDescription"  border="0" cellpadding="2" cellspacing="0">
          <tr>  
           <td class="txtLabel" style="padding: 5px; width:84px;" align="right">Host:</td>
           <td class="txtValue" align="left" nowrap="nowrap"><?php 
echo $desc['hostName'];
?>
</td>
           <td class="txtLabel" align="left" nowrap="nowrap">Port: &nbsp; <?php 
echo $desc['port'];
?>
</td>
          </tr>
コード例 #29
0
ファイル: functions.php プロジェクト: jinshana/kajonacms
/**
 * Checks, if the browser sent the same checksum as provided. If so,
 * a http 304 is sent to the browser
 *
 * @param string $strChecksum
 *
 * @return bool
 */
function checkConditionalGetHeaders($strChecksum)
{
    if (issetServer("HTTP_IF_NONE_MATCH")) {
        if (getServer("HTTP_IF_NONE_MATCH") == $strChecksum) {
            //strike. no further actions needed.
            class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_NOT_MODIFIED);
            class_response_object::getInstance()->addHeader("ETag: " . $strChecksum);
            class_response_object::getInstance()->addHeader("Cache-Control: max-age=86400, must-revalidate");
            return true;
        }
    }
    return false;
}
コード例 #30
0
function macros_returnDomainFloated()
{
    $cmsController = cmsController::getInstance();
    if ($cmsController->getCurrentMode() == "") {
        return getServer('HTTP_HOST');
    } else {
        $arr = array();
        if (is_numeric(getRequest('param0'))) {
            $arr[] = getRequest('param0');
        }
        if (is_numeric(getRequest('param1'))) {
            $arr[] = getRequest('param1');
        }
        if (getRequest('parent')) {
            $arr[] = getRequest('parent');
        }
        foreach ($arr as $c) {
            if (is_numeric($c)) {
                try {
                    if ($element = umiHierarchy::getInstance()->getElement($c)) {
                        $domain_id = $element->getDomainId();
                        if ($domain = domainsCollection::getInstance()->getDomain($domain_id)) {
                            return $domain->getHost();
                        }
                    }
                } catch (baseException $e) {
                    //Do nothing
                }
            }
            if (is_string($c)) {
                if ($domain_id = domainsCollection::getInstance()->getDomainId($c)) {
                    if ($domain = domainsCollection::getInstance()->getDomain($domain_id)) {
                        return $domain->getHost();
                    }
                }
            }
        }
        return getServer('HTTP_HOST');
    }
}