当前位置: 首页>>代码示例>>PHP>>正文


PHP StringUtil::getRandomID方法代码示例

本文整理汇总了PHP中StringUtil::getRandomID方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtil::getRandomID方法的具体用法?PHP StringUtil::getRandomID怎么用?PHP StringUtil::getRandomID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringUtil的用法示例。


在下文中一共展示了StringUtil::getRandomID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * Creates a new source file entry.
  * 
  * @param	integer		$sourceID
  * @param	string		$location
  * @param	string		$type
  * @param	integer		$fileDate
  * @return	SourceFile
  */
 public static function create($sourceID, $location, $type, $profileName = '', $fileDate = TIME_NOW)
 {
     $fileVersion = $packageName = '';
     // get filename
     $filename = basename($location);
     // set file version based upon type
     if ($type != 'wcfsetup') {
         require_once PB_DIR . 'lib/system/package/PackageReader.class.php';
         $pr = new PackageReader($sourceID, $location, true);
         $data = $pr->getPackageData();
         $fileVersion = $data['version'];
         $packageName = $data['name'];
         $type = 'package';
     }
     $sql = "INSERT INTO\tpb" . PB_N . "_source_file\n\t\t\t\t\t(sourceID, hash, filename, fileType, fileVersion, fileDate, packageName, profileName)\n\t\t\tVALUES\t\t(" . $sourceID . ",\n\t\t\t\t\t'" . escapeString(StringUtil::getRandomID()) . "',\n\t\t\t\t\t'" . escapeString($filename) . "',\n\t\t\t\t\t'" . $type . "',\n\t\t\t\t\t'" . escapeString($fileVersion) . "',\n\t\t\t\t\t" . $fileDate . ",\n\t\t\t\t\t'" . escapeString($packageName) . "',\n\t\t\t\t\t'" . escapeString($profileName) . "')";
     WCF::getDB()->sendQuery($sql);
     $fileID = WCF::getDB()->getInsertID('pb' . PB_N . '_source_file', 'fileID');
     $sourceFile = new SourceFile($fileID);
     // move file
     if (!copy($location, PB_DIR . 'packages/' . $sourceFile->fileID . '-' . $sourceFile->hash)) {
         $sql = "DELETE FROM\tpb" . PB_N . "_source_file\n\t\t\t\tWHERE\t\tfileID = " . $sourceFile->fileID;
         WCF::getDB()->sendQuery($sql);
         throw new SystemException("Could not move source file, resource missing or insufficient permissions.");
     }
     @unlink($location);
     return $sourceFile;
 }
开发者ID:ZerGabriel,项目名称:PackageBuilder,代码行数:36,代码来源:SourceFileEditor.class.php

示例2: create

 /**
  * Creates a new account
  *
  * @param	string	$accountname
  * @param	string	$password
  * @param	string	$email
  * @return	void
  */
 public function create($accountname, $password, $email)
 {
     $salt = StringUtil::getRandomID();
     $password = sha1($salt . sha1($salt . $password));
     $sql = "INSERT INTO authserv_users (accountname, password, email, salt, time) VALUES ('" . escapeString($accountname) . "', '" . $password . "', '" . escapeString($email) . "', '" . $salt . "', " . time() . ")";
     Services::getDB()->sendQuery($sql);
 }
开发者ID:Evil-Co-Legacy,项目名称:Evil-Co.de-Services,代码行数:15,代码来源:AuthServ.class.php

示例3: updateWCF

 /**
  * Updates the wcf on an other server
  */
 protected static function updateWCF($worldID)
 {
     $randomID = StringUtil::getRandomID();
     $server = self::$servers[$worldID];
     // export data as cvs
     $sql = "SELECT HIGH_PRIORITY *\r\n\t\t\t\tINTO OUTFILE '/home/lostwdbl/game/outfile/" . $randomID . "_wcf1_user.cvs'\r\n\t   \t\t\tFIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'\r\n\t    \t\tLINES TERMINATED BY '\n'\r\n\t\t\t\tFROM wcf1_user";
     WCF::getDB()->sendQuery($sql);
     $sql = "SELECT HIGH_PRIORITY *\r\n\t\t\t\tINTO OUTFILE '/home/lostwdbl/game/outfile/" . $randomID . "_wcf1_user_option_value.cvs'\r\n\t   \t\t\tFIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'\r\n\t    \t\tLINES TERMINATED BY '\n'\r\n\t\t\t\tFROM wcf1_user_option_value";
     WCF::getDB()->sendQuery($sql);
     $sql = "SELECT HIGH_PRIORITY *\r\n\t\t\t\tINTO OUTFILE '/home/lostwdbl/game/outfile/" . $randomID . "_wcf1_user_to_groups.cvs'\r\n\t   \t\t\tFIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'\r\n\t    \t\tLINES TERMINATED BY '\n'\r\n\t\t\t\tFROM wcf1_user_to_groups";
     WCF::getDB()->sendQuery($sql);
     // connect to the other db
     $tmpConnection = mysql_connect($server['mysqlHost'], $server['mysqlUser'], $server['mysqlPassword'], true);
     $sql = "SET charset latin1";
     mysql_query($sql, $tmpConnection);
     mysql_select_db($server['mysqlUser'], $tmpConnection);
     // load data into the db
     $sql = "LOAD DATA LOCAL INFILE '/home/lostwdbl/game/outfile/" . $randomID . "_wcf1_user.cvs'\r\n\t\t\t\tREPLACE INTO TABLE wcf1_user\r\n\t\t\t\tFIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'\r\n\t    \t\tLINES TERMINATED BY '\n'";
     mysql_query($sql, $tmpConnection);
     $sql = "LOAD DATA LOCAL INFILE '/home/lostwdbl/game/outfile/" . $randomID . "_wcf1_user_option_value.cvs'\r\n\t\t\t\tREPLACE INTO TABLE wcf1_user_option_value\r\n\t\t\t\tFIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'\r\n\t    \t\tLINES TERMINATED BY '\n'";
     mysql_query($sql, $tmpConnection);
     $sql = "LOAD DATA LOCAL INFILE '/home/lostwdbl/game/outfile/" . $randomID . "_wcf1_user_to_groups.cvs'\r\n\t\t\t\tREPLACE INTO TABLE wcf1_user_to_groups\r\n\t\t\t\tFIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'\r\n\t    \t\tLINES TERMINATED BY '\n'";
     mysql_query($sql, $tmpConnection);
     //if(WCF::getUser()->userID == 143) echo $sql.';';
     // clean up
     /*unlink('/home/lostwdbl/game/outfile/'.$randomID.'_wcf1_user.cvs');
     		unlink('/home/lostwdbl/game/outfile/'.$randomID.'_wcf1_user_option_value.cvs');
     		unlink('/home/lostwdbl/game/outfile/'.$randomID.'_wcf1_user_to_groups.cvs');*/
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:32,代码来源:LWServerUtil.class.php

示例4: save

 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     //save activation token into database
     $token = StringUtil::getRandomID();
     $sql = 'INSERT INTO wcf' . WCF_N . '_' . $this->subscriberTable . "\n        \t\t(email)\n        \t\t\tVALUES\n        \t\t('" . escapeString($this->email) . "')";
     WCF::getDB()->sendQuery($sql);
     $subscriberID = WCF::getDB()->getInsertID();
     //clears cache
     WCF::getCache()->clear(WCF_DIR . 'cache/', 'cache.newsletter-subscriber-' . PACKAGE_ID . '.php', true);
     $sql = 'INSERT INTO wcf' . WCF_N . '_' . $this->activationTable . '
     		(subscriberID, token)
     			VALUES
     		(' . intval($subscriberID) . ", '" . escapeString($token) . "')";
     WCF::getDB()->sendQuery($sql);
     $url = PAGE_URL . '/index.php?action=NewsletterGuestActivate&id=' . $subscriberID . '&t=' . $token;
     $subject = WCF::getLanguage()->get('wcf.acp.newsletter.optin.subject');
     $content = WCF::getLanguage()->getDynamicVariable('wcf.acp.newsletter.optin.text', array('username' => WCF::getLanguage()->get('wcf.acp.newsletter.optin.hello'), 'url' => $url));
     WCF::getTPL()->assign(array('subject' => $subject, 'content' => $content));
     $output = WCF::getTPL()->fetch('validationEmail');
     $mail = new Mail($this->email, $subject, $output, MESSAGE_NEWSLETTERSYSTEM_GENERAL_FROM);
     $mail->setContentType('text/html');
     $mail->send();
     $this->saved();
     WCF::getTPL()->assign(array('message' => WCF::getLanguage()->get('wcf.acp.newsletter.optin.activationPending'), 'url' => PAGE_URL . '/index.php?page=Index' . SID_ARG_2ND));
     WCF::getTPL()->display('redirect');
     exit;
 }
开发者ID:CaribeSoy,项目名称:Newsletter-System,代码行数:31,代码来源:NewsletterRegisterGuestForm.class.php

示例5: getTemporaryFilename

 /** 
  * Generates a new temporary filename in TMP_DIR.
  *
  * @param 	string 		$prefix
  * @param 	string 		$extension
  * @param 	string		$dir
  * @return 	string 				temporary filename
  */
 public static function getTemporaryFilename($prefix = 'tmpFile_', $extension = '', $dir = TMP_DIR)
 {
     $dir = self::addTrailingSlash($dir);
     do {
         $tmpFile = $dir . $prefix . StringUtil::getRandomID() . $extension;
     } while (file_exists($tmpFile));
     return $tmpFile;
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:16,代码来源:FileUtil.class.php

示例6: createGroup

 /**
  *
  */
 protected function createGroup($groupOptions = array())
 {
     require_once WCF_DIR . 'lib/util/StringUtil.class.php';
     require_once WCF_DIR . 'lib/data/user/group/GroupEditor.class.php';
     $group = GroupEditor::create($groupName = StringUtil::getRandomID(), $groupOptions);
     // WCF does not clear instance caches... so rebuild
     $classFile = WCF_DIR . 'lib/system/cache/CacheBuilderGroups.class.php';
     WCF::getCache()->rebuild(array('cache' => 'groups', 'file' => WCF_DIR . 'cache/cache.groups.php', 'className' => StringUtil::getClassName($classFile), 'classFile' => $classFile));
     return $group;
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:13,代码来源:WCFTest.php

示例7: create

 /**
  * Creates a new naval formation.
  * 
  * @param	int		leader fleet
  * @return	NavalFormation
  */
 public static function create($leaderFleetID, $userID)
 {
     // create
     $formationName = WCF::getLanguage()->get('wot.fleet.navalFormation.name') . ' ' . substr(base_convert(StringUtil::getRandomID(), 16, 10), 0, 5);
     $sql = "INSERT INTO ugml_naval_formation\n\t\t\t\t(formationName, leaderFleetID,\n\t\t\t\t endPlanetID, impactTime)\n\t\t\t\tVALUES\n\t\t\t\t('" . $formationName . "', " . $leaderFleetID . ",\n\t\t\t\t (SELECT targetPlanetID\n\t\t\t\t  FROM ugml_fleet\n\t\t\t\t  WHERE fleetID = " . $leaderFleetID . "), (SELECT impactTime\n\t\t\t\t\t\t\t\t\t\t\t\t\t     FROM ugml_fleet\n\t\t\t\t\t\t\t\t\t\t\t\t\t     WHERE fleetID = " . $leaderFleetID . "))";
     WCF::getDB()->sendQuery($sql);
     $formationID = WCF::getDB()->getInsertID();
     $navalFormation = new NavalFormation($formationID);
     $navalFormation->getEditor()->addUser($userID, null, false);
     $navalFormation->getEditor()->addFleet($leaderFleetID);
     return $navalFormation;
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:18,代码来源:NavalFormationEditor.class.php

示例8: storeQuote

 /**
  * Stores a given quote.
  *
  * @param	integer		$objectID
  * @param	string		$objectType
  * @param	string		$text
  * @param	string		$author
  * @param	string		$url
  * @param	integer		$parentID
  * @param	string		$quoteID
  * @return	string		quote id
  */
 public static function storeQuote($objectID, $objectType, $text, $author = '', $url = '', $parentID = 0, $quoteID = '')
 {
     self::loadStorage();
     if ($quoteID == '') {
         $quoteID = StringUtil::getRandomID();
     }
     self::$quoteStorage[$quoteID] = array('quoteID' => $quoteID, 'objectID' => $objectID, 'objectType' => $objectType, 'author' => $author, 'url' => $url, 'text' => StringUtil::unifyNewlines($text), 'parentID' => $parentID);
     if (!isset(self::$quoteCounts[$objectType . '-' . $objectID])) {
         self::$quoteCounts[$objectType . '-' . $objectID] = 0;
     }
     self::$quoteCounts[$objectType . '-' . $objectID]++;
     return $quoteID;
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:25,代码来源:MultiQuoteManager.class.php

示例9: create

 /**
  * @see SessionFactory::create()
  */
 public function create()
 {
     // get spider information
     $spider = $this->isSpider(UserUtil::getUserAgent());
     if ($spider) {
         if (($session = $this->getExistingSpiderSession($spider['spiderID'])) !== null) {
             if (!$session->isCorrupt()) {
                 return $session;
             }
         }
     }
     // create new session hash
     $sessionID = StringUtil::getRandomID();
     // check cookies for userID & password
     require_once WCF_DIR . 'lib/system/auth/UserAuth.class.php';
     $user = UserAuth::getInstance()->loginAutomatically(true, $this->userClassName);
     if ($user === null) {
         // no valid user found
         // create guest user
         $user = new $this->guestClassName();
     }
     // update user session
     $user->update();
     if ($user->userID != 0) {
         // user is no guest
         // delete all other sessions of this user
         Session::deleteSessions($user->userID, true, false);
     }
     $requestMethod = !empty($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : '';
     // insert session into database
     $sql = "INSERT INTO \twcf" . WCF_N . "_session\n\t\t\t\t\t(sessionID, packageID, userID, ipAddress, userAgent,\n\t\t\t\t\tlastActivityTime, requestURI, requestMethod,\n\t\t\t\t\tusername" . ($spider ? ", spiderID" : "") . ")\n\t\t\tVALUES\t\t('" . $sessionID . "',\n\t\t\t\t\t" . PACKAGE_ID . ",\n\t\t\t\t\t" . $user->userID . ",\n\t\t\t\t\t'" . escapeString(UserUtil::getIpAddress()) . "',\n\t\t\t\t\t'" . escapeString(UserUtil::getUserAgent()) . "',\n\t\t\t\t\t" . TIME_NOW . ",\n\t\t\t\t\t'" . escapeString(UserUtil::getRequestURI()) . "',\n\t\t\t\t\t'" . escapeString($requestMethod) . "',\n\t\t\t\t\t'" . ($spider ? escapeString($spider['spiderName']) : escapeString($user->username)) . "'\n\t\t\t\t\t" . ($spider ? ", " . $spider['spiderID'] : "") . ")";
     WCF::getDB()->sendQuery($sql);
     // save user data
     $serializedUserData = '';
     if (ENABLE_SESSION_DATA_CACHE && get_class(WCF::getCache()->getCacheSource()) == 'MemcacheCacheSource') {
         require_once WCF_DIR . 'lib/system/cache/source/MemcacheAdapter.class.php';
         MemcacheAdapter::getInstance()->getMemcache()->set('session_userdata_-' . $sessionID, $user);
     } else {
         $serializedUserData = serialize($user);
         try {
             $sql = "INSERT INTO \twcf" . WCF_N . "_session_data\n\t\t\t\t\t\t\t(sessionID, userData)\n\t\t\t\t\tVALUES \t\t('" . $sessionID . "',\n\t\t\t\t\t\t\t'" . escapeString($serializedUserData) . "')";
             WCF::getDB()->sendQuery($sql);
         } catch (DatabaseException $e) {
             // horizon update workaround
             $sql = "UPDATE \twcf" . WCF_N . "_session\n\t\t\t\t\tSET\tuserData = '" . escapeString($serializedUserData) . "'\n\t\t\t\t\tWHERE\tsessionID = '" . $sessionID . "'";
             WCF::getDB()->sendQuery($sql);
         }
     }
     // return new session object
     return new $this->sessionClassName(null, array('sessionID' => $sessionID, 'packageID' => PACKAGE_ID, 'userID' => $user->userID, 'ipAddress' => UserUtil::getIpAddress(), 'userAgent' => UserUtil::getUserAgent(), 'lastActivityTime' => TIME_NOW, 'requestURI' => UserUtil::getRequestURI(), 'requestMethod' => $requestMethod, 'userData' => $serializedUserData, 'sessionVariables' => '', 'username' => $spider ? $spider['spiderName'] : $user->username, 'spiderID' => $spider ? $spider['spiderID'] : 0, 'isNew' => true));
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:54,代码来源:CookieSessionFactory.class.php

示例10: sendMail

 /**
  * Sends the mail to given user.
  * 
  * @param	User		$user
  */
 protected function sendMail(User $user)
 {
     // generate new password
     $password = substr(StringUtil::getRandomID(), 0, 10);
     // save
     $editor = $user->getEditor();
     $editor->update('', '', $password);
     // send mail
     if (!isset($this->languages[$user->languageID])) {
         $this->languages[$user->languageID] = new Language($user->languageID);
     }
     $mail = new Mail(array($user->username => $user->email), $this->languages[$user->languageID]->get('wcf.acp.user.newPassword.mail.subject', array('PAGE_TITLE' => $this->languages[$user->languageID]->get(PAGE_TITLE))), $this->languages[$user->languageID]->get('wcf.acp.user.newPassword.mail', array('PAGE_TITLE' => $this->languages[$user->languageID]->get(PAGE_TITLE), '$username' => $user->username, '$password' => $password, 'PAGE_URL' => PAGE_URL, 'MAIL_ADMIN_ADDRESS' => MAIL_ADMIN_ADDRESS)));
     $mail->send();
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:19,代码来源:UserNewPasswordMailAction.class.php

示例11: executeStart

 /**
  * @see TemplatePluginCompiler::executeStart()
  */
 public function executeStart($tagArgs, TemplateScriptingCompiler $compiler)
 {
     $compiler->pushTag('implode');
     if (!isset($tagArgs['from'])) {
         throw new SystemException($compiler->formatSyntaxError("missing 'from' argument in implode tag", $compiler->getCurrentIdentifier(), $compiler->getCurrentLineNo()), 12001);
     }
     if (!isset($tagArgs['item'])) {
         throw new SystemException($compiler->formatSyntaxError("missing 'item' argument in implode tag", $compiler->getCurrentIdentifier(), $compiler->getCurrentLineNo()), 12001);
     }
     $hash = StringUtil::getRandomID();
     $glue = isset($tagArgs['glue']) ? $tagArgs['glue'] : "', '";
     $this->tagStack[] = array('hash' => $hash, 'glue' => $glue);
     $phpCode = "<?php\n";
     $phpCode .= "\$_length" . $hash . " = count(" . $tagArgs['from'] . ");\n";
     $phpCode .= "\$_i" . $hash . " = 0;\n";
     $phpCode .= "foreach (" . $tagArgs['from'] . " as " . (isset($tagArgs['key']) ? (StringUtil::substring($tagArgs['key'], 0, 1) != '$' ? "\$this->v[" . $tagArgs['key'] . "]" : $tagArgs['key']) . " => " : '') . (StringUtil::substring($tagArgs['item'], 0, 1) != '$' ? "\$this->v[" . $tagArgs['item'] . "]" : $tagArgs['item']) . ") { ?>";
     return $phpCode;
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:21,代码来源:TemplatePluginCompilerImplode.class.php

示例12: createWcfSetup

 /**
  * Builds a WCFSetup.
  * 
  * @param	array	$packages
  * @param	string	$outputDirectory
  */
 public function createWcfSetup(array $packages, $outputDirectory = '')
 {
     // ensure output directory is set and exists
     if (empty($outputDirectory)) {
         $outputDirectory = $this->source->buildDirectory;
     } else {
         if (!is_dir($outputDirectory)) {
             FileUtil::makePath($outputDirectory);
         }
     }
     $outputDirectory = FileUtil::addTrailingSlash($outputDirectory);
     // create temporarily directory
     $hash = StringUtil::getRandomID();
     $buildDirectory = $outputDirectory . $hash . '/';
     // populate install directory
     $this->cloneDirectory($buildDirectory, 'install/files');
     $this->cloneDirectory($buildDirectory, 'install/lang');
     $this->cloneDirectory($buildDirectory, 'install/packages');
     // populate setup directory
     $this->cloneDirectory($buildDirectory, 'setup/db');
     $this->cloneDirectory($buildDirectory, 'setup/lang');
     $this->cloneDirectory($buildDirectory, 'setup/license');
     $this->cloneDirectory($buildDirectory, 'setup/template');
     // copy packages
     foreach ($packages as $package) {
         if (!file_exists($package)) {
             throw new SystemException("Required package '" . $package . "' not found.");
         }
         copy($package, $buildDirectory . 'install/packages/' . basename($package));
     }
     // create wcf setup
     $wcfSetup = new TarWriter($outputDirectory . 'WCFSetup.tar.gz', true);
     $wcfSetup->add(array($buildDirectory . 'install', $buildDirectory . 'setup'), '', $buildDirectory);
     $wcfSetup->create();
     // remove temoprarily directory
     $this->deleteDirectory($buildDirectory);
     @rmdir($buildDirectory);
     // set path
     $path = $outputDirectory . 'WCFSetup.tar.gz';
     require_once PB_DIR . 'lib/data/source/file/SourceFileEditor.class.php';
     $sourceFile = SourceFileEditor::create($this->source->sourceID, $path, 'wcfsetup', $this->profileName);
     $this->path = $sourceFile->getPath();
 }
开发者ID:ZerGabriel,项目名称:PackageBuilder,代码行数:49,代码来源:StandalonePackageBuilder.class.php

示例13: save

 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // generate a new lost password key
     $lostPasswordKey = StringUtil::getRandomID();
     // save key and request time in database
     $sql = "UPDATE \twcf" . WCF_N . "_user\n\t\t\tSET\tlostPasswordKey = '" . $lostPasswordKey . "',\n\t\t\t\tlastLostPasswordRequest = " . TIME_NOW . "\n\t\t\tWHERE \tuserID = " . $this->user->userID;
     WCF::getDB()->registerShutdownUpdate($sql);
     // send mail
     $subjectData = array('PAGE_TITLE' => WCF::getLanguage()->get(PAGE_TITLE));
     $messageData = array('PAGE_TITLE' => WCF::getLanguage()->get(PAGE_TITLE), '$username' => $this->user->username, '$userID' => $this->user->userID, '$key' => $lostPasswordKey, 'PAGE_URL' => PAGE_URL, 'MAIL_ADMIN_ADDRESS' => MAIL_ADMIN_ADDRESS);
     require_once WCF_DIR . 'lib/data/mail/Mail.class.php';
     $mail = new Mail(array($this->user->username => $this->user->email), WCF::getLanguage()->get('wcf.user.lostPassword.mail.subject', $subjectData), WCF::getLanguage()->get('wcf.user.lostPassword.mail', $messageData));
     $mail->send();
     $this->saved();
     // forward to index page
     WCF::getTPL()->assign(array('url' => 'index.php' . SID_ARG_1ST, 'message' => WCF::getLanguage()->get('wcf.user.lostPassword.mail.sent')));
     WCF::getTPL()->display('redirect');
     exit;
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:23,代码来源:LostPasswordForm.class.php

示例14: setBoundary

 /**
  * Creates a boundary for mutlipart/mixed Mail 
  */
 protected function setBoundary()
 {
     $this->boundary = "==Multipart_Boundary_x" . StringUtil::getRandomID() . "x";
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:7,代码来源:Mail.class.php

示例15: save

    /**
     * @see Form::save()
     */
    public function save()
    {
        parent::save();
        $content = '';
        if (count($this->uploadFile)) {
            $content = file_get_contents($this->uploadFile['tmp_name']);
        } elseif ($this->downloadFile) {
            $content = file_get_contents($this->downloadFile);
        }
        if (empty($content)) {
            return;
        }
        //add cache resource and get subscribers
        $cacheName = 'newsletter-subscriber-' . PACKAGE_ID;
        WCF::getCache()->addResource($cacheName, WCF_DIR . 'cache/cache.' . $cacheName . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderNewsletterSubscriber.class.php');
        $subscribersList = WCF::getCache()->get($cacheName, 'subscribers');
        //contains all new emails
        $emails = explode($this->delimeter, $content);
        $sql = 'INSERT INTO wcf' . WCF_N . '_' . $this->databaseTable . '
				(userID, username, email)
				VALUES ';
        $insertValues = '';
        $processImport = false;
        foreach ($emails as $email) {
            //no duplicate entries
            $checkSql = 'SELECT COUNT(subscriberID) AS count
		    			FROM wcf' . WCF_N . '_' . $this->databaseTable . "\n\t\t    \t\t\tWHERE email = '" . escapeString($email) . "'";
            $row = WCF::getDB()->getFirstRow($checkSql);
            if ($row['count']) {
                continue;
            }
            if (!empty($insertValues)) {
                $insertValues .= ', ';
            }
            $data = '(';
            $sqlInner = 'SELECT userID, COUNT(userID) AS count
		    		FROM wcf' . WCF_N . "_user\n\t\t    \t\tWHERE email = '" . escapeString($email) . "'\n\t\t    \t\tGROUP BY userID";
            $row = WCF::getDB()->getFirstRow($sqlInner);
            if ($row['count']) {
                $user = new User($row['userID']);
                $data .= $row['userID'] . ", '" . escapeString($user->username) . "', '";
            } else {
                $data .= "0, '', '";
            }
            $data .= escapeString($email) . "')";
            $insertValues .= $data;
            $processImport = true;
        }
        $sql .= $insertValues;
        //only do this if there is an email to work with
        if ($processImport) {
            WCF::getDB()->sendQuery($sql);
        }
        //get all subscribers
        $sql = 'SELECT subscriberID, userID
		        FROM wcf' . WCF_N . '_' . $this->databaseTable;
        $result = WCF::getDB()->sendQuery($sql);
        //prepare for new unsubscription tokens
        $sqlUnsubscribe = 'INSERT INTO wcf' . WCF_N . '_' . $this->unsubscriptionTable . '
		            (subscriberID, token)
		        VALUES ';
        $unsubscribeInsertValues = '';
        //prepare for activation
        $sqlActivation = 'INSERT INTO wcf' . WCF_N . '_' . $this->activationTable . '
		            (userID, datetime, activated)
		        VALUES ';
        $activateInsertValues = '';
        //prepare for guest activation
        $sqlGuestActivation = 'INSERT INTO wcf' . WCF_N . '_' . $this->guestActivationTable . '
		            (subscriberID, datetime, activated)
		        VALUES ';
        $guestActivateInsertValues = '';
        //getting the new subscribers
        $newSubscribers = array();
        while ($row = WCF::getDB()->fetchArray($result)) {
            if (array_key_exists($row['subscriberID'], $subscribersList)) {
                continue;
            }
            $newSubscribers[$row['subscriberID']] = $row['userID'];
        }
        //add unsubscribe tokens for each new subscriber
        //and prove validation
        foreach ($newSubscribers as $subscriberID => $userID) {
            if (!empty($unsubscribeInsertValues)) {
                $unsubscribeInsertValues .= ', ';
            }
            $data = '(' . $subscriberID . ", '" . escapeString(StringUtil::getRandomID()) . "')";
            $unsubscribeInsertValues .= $data;
            if ($userID) {
                if (!empty($activateInsertValues)) {
                    $activateInsertValues .= ', ';
                }
                $data = '(' . $userID . ', ' . TIME_NOW . ', 1)';
                $activateInsertValues .= $data;
            } else {
                if (!empty($guestActivateInsertValues)) {
                    $guestActivateInsertValues .= ', ';
//.........这里部分代码省略.........
开发者ID:CaribeSoy,项目名称:Newsletter-System,代码行数:101,代码来源:ImportSubscriberForm.class.php


注:本文中的StringUtil::getRandomID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。