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


PHP common::RandomString方法代码示例

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


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

示例1: Example_Ajax

 function Example_Ajax()
 {
     global $page, $addonRelativeCode;
     //prepare the page
     $page->head_js[] = $addonRelativeCode . 'static/02_script.js';
     $page->admin_js = true;
     //get request parameters and execute any commands
     $string = '';
     if (isset($_REQUEST['string'])) {
         $string = $_REQUEST['string'];
     }
     $cmd = common::GetCommand();
     switch ($cmd) {
         case 'randomstring':
             $string = common::RandomString(10);
             break;
     }
     //display the form
     echo '<h2>Example Ajax Requests</h2>';
     echo '<form method="post" action="' . $page->title . '">';
     echo 'Text: <input type="text" name="string" value="' . htmlspecialchars($string) . '" size="30" />';
     echo ' <input type="submit" class="gpajax" value="Post Form Asynchronosly" /> ';
     echo common::Link($page->title, 'Get Random String', 'cmd=randomstring', 'name="gpajax"');
     echo '</form>';
     //output the $_REQUEST variable
     echo '<h3>Request</h3>';
     echo showArray($_REQUEST);
     //plugin example navigation
     gpPlugin::incl('navigation.php');
     PluginExampleNavigation();
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:31,代码来源:02_Ajax.php

示例2: NewTempFolder

 function NewTempFolder()
 {
     do {
         $folder = common::RandomString(7, false);
         $full_dest = $this->addon_folder . '/' . $folder;
     } while (is_numeric($folder) || isset($this->config[$folder]) || file_exists($full_dest));
     return $folder;
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:8,代码来源:admin_addon_install.php

示例3: SaveConfig

 /**
  * Save the gpEasy configuration
  * @return bool
  *
  */
 static function SaveConfig()
 {
     global $config, $dataDir;
     if (!is_array($config)) {
         return false;
     }
     if (!isset($config['gpuniq'])) {
         $config['gpuniq'] = common::RandomString(20);
     }
     return gpFiles::SaveData($dataDir . '/data/_site/config.php', 'config', $config);
 }
开发者ID:Bomberus,项目名称:gpEasy-CMS,代码行数:16,代码来源:admin_tools.php

示例4: Install_DataFiles_New

    static function Install_DataFiles_New($destination = false, $config = array(), $base_install = true)
    {
        global $langmessage;
        if ($destination === false) {
            $destination = $GLOBALS['dataDir'];
        }
        //set config variables
        //$config = array(); //because of ftp values
        $gpLayouts = array();
        //use bootswatch theme if server has enough memory
        $gpLayouts['default']['theme'] = 'Bootswatch_Flatly/4_Sticky_Footer';
        $gpLayouts['default']['label'] = 'Bootswatch_Flatly/4_Sticky_Footer';
        if (@ini_set('memory_limit', '96M') === false) {
            $limit = ini_get('memory_limit');
            $limit = common::getByteValue($limit);
            if ($limit < 100663296) {
                $gpLayouts['default']['theme'] = 'Three_point_5/Shore';
                $gpLayouts['default']['label'] = 'Three_point_5/Shore';
            }
        }
        $gpLayouts['default']['color'] = '#93c47d';
        $_config['toemail'] = $_POST['email'];
        $_config['gpLayout'] = 'default';
        $_config['title'] = Install_Tools::Install_Title();
        $_config['keywords'] = CMS_NAME . ' , Easy CMS, Content Management, PHP, Free CMS, Website builder, Open Source';
        $_config['desc'] = 'A new ' . CMS_NAME . ' installation. You can change your site\'s description in the configuration.';
        $_config['timeoffset'] = '0';
        $_config['langeditor'] = 'inherit';
        $_config['dateformat'] = '%m/%d/%y - %I:%M %p';
        $_config['gpversion'] = gpversion;
        $_config['passhash'] = 'sha512';
        $_config['gpuniq'] = common::RandomString(20);
        $_config['combinecss'] = Install_Tools::BooleanValue('combinecss', true);
        $_config['combinejs'] = Install_Tools::BooleanValue('combinejs', true);
        $_config['etag_headers'] = Install_Tools::BooleanValue('etag_headers', true);
        $_config['language'] = 'en';
        $config += $_config;
        //directories
        gpFiles::CheckDir($destination . '/data/_uploaded/image');
        gpFiles::CheckDir($destination . '/data/_uploaded/media');
        gpFiles::CheckDir($destination . '/data/_uploaded/file');
        gpFiles::CheckDir($destination . '/data/_uploaded/flash');
        gpFiles::CheckDir($destination . '/data/_sessions');
        // gp_index
        $new_index = array();
        $new_index['Home'] = 'a';
        $new_index['Heading_Page'] = 'b';
        $new_index['Help_Videos'] = 'c';
        $new_index['Child_Page'] = 'd';
        $new_index['More'] = 'e';
        $new_index['About'] = 'f';
        $new_index['Contact'] = 'special_contact';
        $new_index['Site_Map'] = 'special_site_map';
        $new_index['Galleries'] = 'special_galleries';
        $new_index['Missing'] = 'special_missing';
        $new_index['Search'] = 'special_gpsearch';
        //	gpmenu
        $new_menu = array();
        $new_menu['a'] = array('level' => 0);
        $new_menu['b'] = array('level' => 0);
        $new_menu['c'] = array('level' => 1);
        $new_menu['d'] = array('level' => 1);
        $new_menu['e'] = array('level' => 0);
        $new_menu['f'] = array('level' => 1);
        $new_menu['special_contact'] = array('level' => 1);
        //	links
        $new_titles = array();
        $new_titles['a']['label'] = 'Home';
        $new_titles['a']['type'] = 'text';
        $new_titles['b']['label'] = 'Heading Page';
        $new_titles['b']['type'] = 'text';
        $new_titles['c']['label'] = 'Help Videos';
        $new_titles['c']['type'] = 'text';
        $new_titles['d']['label'] = 'Child Page';
        $new_titles['d']['type'] = 'text';
        $new_titles['e']['label'] = 'More';
        $new_titles['e']['type'] = 'text';
        $new_titles['f']['label'] = 'About';
        $new_titles['f']['type'] = 'text';
        $new_titles['special_contact']['lang_index'] = 'contact';
        $new_titles['special_contact']['type'] = 'special';
        $new_titles['special_site_map']['lang_index'] = 'site_map';
        $new_titles['special_site_map']['type'] = 'special';
        $new_titles['special_galleries']['lang_index'] = 'galleries';
        $new_titles['special_galleries']['type'] = 'special';
        $new_titles['special_missing']['label'] = 'Missing';
        $new_titles['special_missing']['type'] = 'special';
        $new_titles['special_gpsearch']['label'] = 'Search';
        $new_titles['special_gpsearch']['type'] = 'special';
        $pages = array();
        $pages['gp_index'] = $new_index;
        $pages['gp_menu'] = $new_menu;
        $pages['gp_titles'] = $new_titles;
        $pages['gpLayouts'] = $gpLayouts;
        echo '<li>';
        if (!gpFiles::SaveData($destination . '/data/_site/pages.php', 'pages', $pages)) {
            echo '<span class="failed">';
            //echo 'Could not save pages.php';
            echo sprintf($langmessage['COULD_NOT_SAVE'], 'pages.php');
            echo '</span>';
//.........这里部分代码省略.........
开发者ID:stegrams,项目名称:Typesetter,代码行数:101,代码来源:install.php

示例5: gp_defined

gp_defined('gp_backup_limit', 10);
gp_defined('gp_write_lock_time', 5);
gp_defined('gp_dir_index', true);
gp_defined('gp_remote_addons', true);
//deprecated 4.0.1
gp_defined('gp_remote_plugins', gp_remote_addons);
gp_defined('gp_remote_themes', gp_remote_addons);
gp_defined('gp_remote_update', gp_remote_addons);
gp_defined('gp_unique_addons', false);
gp_defined('gp_data_type', '.php');
gp_defined('gp_default_theme', 'Three_point_5/Shore');
//Bootswatch_Flatly/4_Sticky_Footer
//gp_defined('addon_browse_path','http://gpeasy.loc/index.php');
gp_defined('addon_browse_path', 'http://gpeasy.com/index.php');
define('gpversion', '4.6b1');
define('gp_random', common::RandomString());
@ini_set('session.use_only_cookies', '1');
@ini_set('default_charset', 'utf-8');
@ini_set('html_errors', false);
if (function_exists('mb_internal_encoding')) {
    mb_internal_encoding('UTF-8');
}
//see mediawiki/languages/Names.php
$languages = array('af' => 'Afrikaans', 'ar' => 'العربية', 'bg' => 'Български', 'ca' => 'Català', 'cs' => 'Česky', 'da' => 'Dansk', 'de' => 'Deutsch', 'el' => 'Ελληνικά', 'en' => 'English', 'es' => 'Español', 'et' => 'eesti', 'fi' => 'Suomi', 'fo' => 'Føroyskt', 'fr' => 'Français', 'gl' => 'Galego', 'hr' => 'hrvatski', 'hu' => 'Magyar', 'it' => 'Italiano', 'ja' => '日本語', 'lt' => 'Lietuvių', 'nl' => 'Nederlands', 'no' => 'Norsk', 'pl' => 'Polski', 'pt' => 'Português', 'pt-br' => 'Português do Brasil', 'ru' => 'Русский', 'sk' => 'Slovenčina', 'sl' => 'Slovenščina', 'sv' => 'Svenska', 'tr' => 'Türkçe', 'uk' => 'Українська', 'zh' => '中文');
$gpversion = gpversion;
// @deprecated 3.5b2
$addonDataFolder = $addonCodeFolder = false;
//deprecated
$addonPathData = $addonPathCode = false;
$wbErrorBuffer = $gp_not_writable = $wbMessageBuffer = array();
/* from wordpress
开发者ID:Knuzen,项目名称:gpEasy-CMS,代码行数:31,代码来源:common.php

示例6: create

 function create(&$user_info, $username)
 {
     global $dataDir, $langmessage;
     //update the session files to .php files
     //changes to $userinfo will be saved by UpdateAttempts() below
     $user_info = gpsession::SetSessionFileName($user_info, $username);
     $user_file_name = $user_info['file_name'];
     $user_file = $dataDir . '/data/_sessions/' . $user_file_name;
     //use an existing session_id if the new login matches an existing session (uid and file_name)
     $sessions = gpsession::GetSessionIds();
     $uid = gpsession::auth_browseruid();
     $session_id = false;
     foreach ($sessions as $sess_temp_id => $sess_temp_info) {
         if (isset($sess_temp_info['uid']) && $sess_temp_info['uid'] == $uid && $sess_temp_info['file_name'] == $user_file_name) {
             $session_id = $sess_temp_id;
         }
     }
     //create a unique session id if needed
     if ($session_id === false) {
         do {
             $session_id = common::RandomString(40);
         } while (isset($sessions[$session_id]));
     }
     $expires = !isset($_POST['remember']);
     gpsession::cookie(gp_session_cookie, $session_id, $expires);
     //save session id
     $sessions[$session_id] = array();
     $sessions[$session_id]['file_name'] = $user_file_name;
     $sessions[$session_id]['uid'] = $uid;
     //$sessions[$session_id]['time'] = time(); //for session locking
     if (!gpsession::SaveSessionIds($sessions)) {
         return false;
     }
     //make sure the user's file exists
     $new_data = gpsession::SessionData($user_file, $checksum);
     $new_data['username'] = $username;
     $new_data['granted'] = $user_info['granted'];
     admin_tools::EditingValue($new_data);
     gpFiles::SaveArray($user_file, 'gpAdmin', $new_data);
     return $session_id;
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:41,代码来源:sessions.php

示例7: Install_DataFiles_New

    function Install_DataFiles_New($destination = false, $config, $base_install = true)
    {
        global $langmessage;
        if ($destination === false) {
            $destination = $GLOBALS['dataDir'];
        }
        //set config variables
        //$config = array(); //because of ftp values
        $gpLayouts = array();
        $gpLayouts['default']['theme'] = 'Light_Texture/Blue';
        $gpLayouts['default']['color'] = '#93c47d';
        $gpLayouts['default']['label'] = $langmessage['default'];
        $config['toemail'] = $_POST['email'];
        $config['gpLayout'] = 'default';
        $config['title'] = Install_Tools::Install_Title();
        $config['keywords'] = 'gpEasy CMS, Easy CMS, Content Management, PHP, Free CMS, Website builder, Open Source';
        $config['desc'] = 'A new gpEasy CMS installation. You can change your site\'s description in the configuration.';
        $config['timeoffset'] = '0';
        $config['langeditor'] = 'inherit';
        $config['dateformat'] = '%m/%d/%y - %I:%M %p';
        $config['gpversion'] = $GLOBALS['gpversion'];
        $config['shahash'] = function_exists('sha1');
        if (!isset($config['gpuniq'])) {
            $config['gpuniq'] = common::RandomString(20);
        }
        $config['combinecss'] = Install_Tools::BooleanValue('combinecss', true);
        $config['combinejs'] = Install_Tools::BooleanValue('combinejs', true);
        $config['etag_headers'] = Install_Tools::BooleanValue('etag_headers', true);
        //directories
        gpFiles::CheckDir($destination . '/data/_uploaded/image');
        gpFiles::CheckDir($destination . '/data/_uploaded/media');
        gpFiles::CheckDir($destination . '/data/_uploaded/file');
        gpFiles::CheckDir($destination . '/data/_uploaded/flash');
        gpFiles::CheckDir($destination . '/data/_sessions');
        $content = '<h2>Welcome!</h2>
		<p>Welcome to your new gpEasy powered website. Now that gpEasy is installed, you can start editing the content and customising your site.</p>
		<h3>Getting Started</h3>
		<p>You are currently viewing the default home page of your website. Here\'s a quick description of how to edit this page.</p>
		<ol>
		<li>First make sure you&#39;re ' . Install_Tools::Install_Link_Content('Admin_Main', 'logged in', 'file=Home') . '.</li>
		<li>Then, to edit this page, click the &quot;Edit&quot; link that appears when you move your mouse over the content.</li>
		<li>Make your edits, click &quot;Save&quot; and you&#39;re done!</li>
		</ol>
		<h3>More Options</h3>
		<ul>
		<li>Adding, renaming, deleting and organising your pages can all be done in the ' . Install_Tools::Install_Link_Content('Admin_Menu', 'Page Manager') . '.</li>
		<li>Choose from a ' . Install_Tools::Install_Link_Content('Admin_Theme_Content', 'variety of themes') . ' to give your site a custom look.</li>
		<li>Then, you can ' . Install_Tools::Install_Link_Content('Admin_Theme_Content', 'add, remove and rearrange', 'cmd=editlayout') . ' the content of your site without editing the html.</li>
		<li>Take a look at the Administrator Toolbar to access all the features of gpEasy.</li>
		</ul>
		<h3>Online Resources</h3>
		<p>gpEasy.com has a number of resources to help you do even more with gpEasy.</p>
		<ul>
		<li>Find more community developed <a href="http://gpeasy.com/Special_Addon_Themes" title="gpEasy CMS Themes">themes</a> and <a href="http://gpeasy.com/Special_Addon_Plugins" title="gpEasy CMS Plugin">plugins</a> to enhance your site.</li>
		<li>Get help in the <a href="http://gpeasy.com/Special_Forum" title="gpEasy CMS Forum">gpEasy forum</a>.</li>
		<li>Show off your <a href="http://gpeasy.com/Special_Powered_by" title="Sites Using gpEasy CMS">gpEasy powered site</a> or list your <a href="http://gpeasy.com/Special_Service_Provider" title="Businesses Using gpEasy CMS">gpEasy related business</a>.</li>
		</ul>';
        gpFiles::NewTitle('Home', $content);
        gpFiles::NewTitle('Help_Videos', "<h1>Help Videos</h1>\n\t\t<p>Video tutorials are often a fast and easy way to learn new things quickly.\n\t\tSo far, we only have one in Deutsch (German) made by <a href=\"http://gpeasy.com/Special_Service_Provider?id=57\" title=\"IT Ricther on gpEasy.com\">IT Richter</a>.\n\t\tIf you make a video tutorial for gpEasy, <a href=\"http://gpeasy.com/Contact\">let us know</a>, and we'll make sure it's included in our list.\n\t\t</p>\n\t\t<p>And as always, to edit this page, just click the \"Edit\" button while logged in.</p>\n\t\t<h2>Deutsch</h2>\n\t\t<p><iframe width=\"560\" height=\"315\" src=\"http://www.youtube.com/embed/04cNgR1EiFY\" frameborder=\"0\" allowfullscreen></iframe></p>\n\t\t");
        gpFiles::NewTitle('Child_Page', '<h1>A Child Page</h1><p>This was created as a subpage of your <em>Help Videos</em> . You can easily change the arrangement of all your pages using the ' . Install_Tools::Install_Link_Content('Admin_Menu', 'Page Manager') . '.</p>');
        gpFiles::NewTitle('About', '<h1>About gpEasy CMS</h1><p><a href="http://gpEasy.com" title="gpEasy.com">gp|Easy</a> is a complete Content Management System (CMS) that can help you create rich and flexible web sites with a simple and easy to use interface.</p>
		<h2>gpEasy CMS How To</h2>
		<p>Learn how to <a href="http://docs.gpeasy.com/Main/Admin" title="gpEasy File Management">manage your files</a>,
		<a href="http://docs.gpeasy.com/Main/Creating%20Galleries" title="Creating Galleries in gpEasy CMS">create galleries</a> and more in the
		<a href="http://docs.gpeasy.org/index.php/" title="gpEasy CMS Documentation">gpEasy Documentation</a>.
		</p>

		<h2>gpEasy CMS Features</h2>
		<ul>
		<li>True WYSIWYG (Using CKEditor)</li>
		<li>Galleries (Using ColorBox)</li>
		<li>SEO Friendly Links</li>
		<li>Free and Open Source (GPL)</li>
		<li>Runs on PHP</li>
		<li>File Upload Manager</li>
		<li>Drag \'n Drop Theme Content</li>
		<li>Deleted File Trash Can</li>
		<li>Multiple User Administration</li>
		<li>Flat File Storage</li>
		<li>Fast Page Loading</li>
		<li>Fast and Easy Installation</li>
		<li>reCaptcha for Contact Form</li>
		<li>HTML Tidy (when available)</li>
		</ul>
		<h2>If You Like gpEasy...</h2>
		<p>If you like gpEasy, then you might also like:</p>
		<ul>
		<li><a href="http://phpeasymin.com" title="Minimize JavaScript and CSS files easily">phpEasyMin.com</a> - Minimize multiple JavaScript and CSS files in one sweep.</li>
		</ul>');
        //Side_Menu
        $file = $destination . '/data/_extra/Side_Menu.php';
        $content = '<h3>Join the gpEasy Community</h3>
		<p>Visit gpEasy.com to access the many <a href="http://gpeasy.com/Special_Resources" title="gpEasy Community Resources">available resources</a> to help you get the most out of our CMS.</p>
		<ul>
		<li><a href="http://gpeasy.com/Special_Addon_Themes" title="gpEasy CMS Themes">Download Themes</a></li>
		<li><a href="http://gpeasy.com/Special_Addon_Plugins" title="gpEasy CMS Plugin">Download Plugins</a></li>
		<li><a href="http://gpeasy.com/Special_Forum" title="gpEasy CMS Forum">Get Help in the Forum</a></li>
		<li><a href="http://gpeasy.com/Special_Powered_by" title="Sites using gpEasy CMS">Show off Your Site</a></li>
		<li><a href="http://gpeasy.com/Special_Resources" title="gpEasy Community Resources">And Much More...</a></li>
		</ul>
//.........这里部分代码省略.........
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:101,代码来源:install.php

示例8: NewId

 function NewId()
 {
     do {
         $unique = common::RandomString(20);
         foreach ($this->siteData['sites'] as $array) {
             if (isset($array['unique']) && $array['unique'] == $unique) {
                 $unique = false;
                 break;
             }
         }
     } while ($unique == false);
     return $unique;
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:13,代码来源:SetupSite.php

示例9: gp_defined

gp_defined('E_USER_DEPRECATED', 16384);
@ini_set('session.use_only_cookies', '1');
@ini_set('default_charset', 'utf-8');
//see /var/www/others/mediawiki-1.15.0/languages/Names.php
$languages = array('ar' => 'العربية', 'bg' => 'Български', 'ca' => 'Català', 'cs' => 'Česky', 'da' => 'Dansk', 'de' => 'Deutsch', 'el' => 'Ελληνικά', 'en' => 'English', 'es' => 'Español', 'fi' => 'Suomi', 'fr' => 'Français', 'gl' => 'Galego', 'hu' => 'Magyar', 'it' => 'Italiano', 'ja' => '日本語', 'lt' => 'Lietuvių', 'nl' => 'Nederlands', 'no' => 'Norsk', 'pl' => 'Polski', 'pt' => 'Português', 'pt-br' => 'Português do Brasil', 'ru' => 'Русский', 'sk' => 'Slovenčina', 'sl' => 'Slovenščina', 'sv' => 'Svenska', 'tr' => 'Türkçe', 'uk' => 'Українська', 'zh' => '中文');
//$gpversion = '2.4';
$gpversion = '3.5b1';
$addonDataFolder = $addonCodeFolder = false;
//deprecated
$addonPathData = $addonPathCode = false;
$addonBrowsePath = 'http://gpeasy.com/index.php';
//$addonBrowsePath = 'http://gpeasy.loc/rocky/index.php';
//message('local browse path');
$checkFileIndex = true;
$wbErrorBuffer = $gp_not_writable = array();
$gp_random = common::RandomString();
/* from wordpress
 * wp-settings.php
 * see also classes.php
 */
// Fix for IIS, which doesn't set REQUEST_URI
if (empty($_SERVER['REQUEST_URI'])) {
    // IIS Mod-Rewrite
    if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
        $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
    } else {
        if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
            $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
        } else {
            // Use ORIG_PATH_INFO if there is no PATH_INFO
            if (!isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO'])) {
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:31,代码来源:common.php

示例10: TempFile

 /**
  * Return the path of a non-existant file
  * Make sure the name won't conflict with names of addons or layouts
  *
  */
 function TempFile($type = '')
 {
     global $config, $gpLayouts, $dataDir;
     do {
         $file = common::RandomString(7, false);
         $full_dest = $this->addon_folder . '/' . $file . $type;
         $data_dest = $dataDir . '/data/_addondata/' . $file . $type;
     } while (is_numeric($file) || array_key_exists($file, $config['addons']) || array_key_exists($file, $config['themes']) || array_key_exists($file, $gpLayouts) || file_exists($full_dest) || file_exists($data_dest));
     return $full_dest;
 }
开发者ID:barbrick,项目名称:gpEasy-CMS,代码行数:15,代码来源:admin_addon_installer.php


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