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


PHP Shineisp_Commons_Utilities::GenerateRandomString方法代码示例

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


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

示例1: create

 /**
  * Main public function that create the pdf file
  */
 public function create($data, $filename = "file.pdf", $show = true)
 {
     // Add the data
     $this->data = $data;
     // Create the pdf page
     $this->create_page();
     // Create the datagrid
     $this->create_grid();
     // Get PDF document as a string
     $contents = $this->pdf->render();
     header("Content-type: application/x-pdf");
     $tmpname = Shineisp_Commons_Utilities::GenerateRandomString();
     @mkdir(PUBLIC_PATH . "/tmp/");
     $file = fopen(PUBLIC_PATH . "/tmp/" . $tmpname . ".pdf", 'a+');
     fputs($file, $contents);
     fclose($file);
     return json_encode(array('url' => "/tmp/" . $tmpname . ".pdf"));
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:21,代码来源:PdfList.php

示例2: createNicHandle

 /**
  * Create a Nic-Handle for the client 
  * 
  * Executes the 'login' command on Ascio's servers, to retrive the session variable
  * for execute the commands.
  * 
  *   Parameters
  *   ===========
  *   string session : the session id
  *   string name : the contact name
  *   string firstname : the contact firstname
  *   string sex : the contact sex (M/F)
  *   string password : the contact password
  *   string email : the contact email
  *   string phone : the contact phone number (international format, ex: +33.899701761)
  *   string fax : the contact fax number
  *   string address : the contact address
  *   string city : the contact city
  *   string area : the contact area
  *   string zip : the contact zip code
  *   string country : the contact country (be|fr|pl|es|lu|ch|de|...)
  *   string language : the contact language (fr|en|pl|es|de)
  *   boolean isOwner : is it an owner nic ? default false
  *   string legalform : the contact legalform (corporation|individual|association|other)
  *   string organisation : organisation name
  *   string legalName : the contact legalname
  *   string legalNumber : the contact legalnumber (SIRET/SIREN/...)
  *   string vat : the contact vat
  *   string birthDay : the contact birthDay
  *   string birthCity : the contact birth city
  *   string nationalIdentificationNumber : the contact fiscal code or company vat
  *   string companyNationalIdentificationNumber : the contact vat
  *   string corporationType : the contact vat (s.a.s.|s.n.c.|s.r.l.|s.p.a.|s.a.p.a.|s.c.a.r.l.|individuale)
  * 
  * 
  * @param      integer      $customerID		Code identifier
  * @return     string       $nicHandle		the new contact handle id
  * @access     private
  */
 private function createNicHandle($customerID)
 {
     $soap = $this->Connect();
     if (!empty($this->session)) {
         $fields = "c.customer_id as customer_id, c.company as company, c.firstname as firstname, c.lastname as lastname, c.gender as gender, c.email as email, c.password as password, c.birthdate as birthdate, c.birthplace as birthplace, c.taxpayernumber as taxpayernumber, c.vat as vat, c.note as note,  a.address as address, a.code as code, a.city as city, a.area as area, ct.name as country, ct.code as countrycode, cts.type_id as type_id, cts.name as companytype, l.legalform_id as legalform_id, l.name as legalform, s.status_id as status_id, s.status as status, cn.contact as contact";
         $customer = Customers::getAllInfo($customerID, $fields);
         return $soap->nicCreateIT($this->session['id'], $customer['lastname'], $customer['firstname'], $customer['gender'], Shineisp_Commons_Utilities::GenerateRandomString(), $customer['email'], $customer['contact'], null, $customer['address'], $customer['city'], $customer['area'], $customer['code'], strtolower($customer['countrycode']), "en", true, $customer['legalform'], $customer['company'], $customer['firstname'] . " " . $customer['lastname'], null, $customer['vat'], Shineisp_Commons_Utilities::formatDateOut($customer['birthdate']), $customer['birthplace'], $customer['taxpayernumber'], $customer['vat'], $customer['companytype']);
         // Corporation Type
     }
     return false;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:50,代码来源:Main.php

示例3: createOrderWithMultiProducts

 /**
  * Create an order with many products
  *
  *
  * @param $product
  * @return integer $orderID
  */
 public static function createOrderWithMultiProducts(array $products, $customer_id, $type = "domain")
 {
     $order = new Orders();
     try {
         $customer = Customers::getAllInfo($customer_id);
         $isp_id = $customer['isp_id'];
         // Creating a new Order.
         $order->customer_id = $customer_id;
         $order->isp_id = $isp_id;
         $order->order_date = date('Y-m-d');
         $order->status_id = Statuses::id("tobepaid", "orders");
         // To pay
         $order->save();
         $id = $order->getIncremented();
         // Add a fastlink to a order
         $link_exist = Fastlinks::findlinks($id, $customer_id, 'orders');
         if (count($link_exist) == 0) {
             $link = new Fastlinks();
             $link->controller = "orders";
             $link->action = "edit";
             $link->params = json_encode(array('id' => $id));
             $link->customer_id = $customer_id;
             $link->sqltable = "orders";
             $link->id = $id;
             $link->code = Shineisp_Commons_Utilities::GenerateRandomString();
             $link->save();
         }
         foreach ($products as $product) {
             $product = Domains::getAllInfo($product, null, null, true);
             // Attaching the order item to the order previously created.
             $orderitem = new OrdersItems();
             $date_end = Shineisp_Commons_Utilities::add_date(date('d-m-Y'), null, 365);
             // Fixed Renew
             $orderitem->order_id = $id;
             $orderitem->product_id = $product[0]['Products']['product_id'];
             $orderitem->billing_cycle_id = 1;
             $orderitem->date_start = date('Y-m-d H:i:s');
             $orderitem->date_end = $date_end;
             $orderitem->autorenew = true;
             $orderitem->description = $product[0]['domain'] . "." . $product[0]['tld'];
             $orderitem->quantity = 1;
             $tax = Taxes::getTaxbyProductID($product[0]['Products']['product_id']);
             $orderitem->price = $product[0]['Products']['price_1'];
             $orderitem->cost = $product[0]['Products']['cost'];
             $orderitem->status_id = Statuses::id("processing", "orders");
             // Processing status set
             $orderitem->save();
             $detailid = $orderitem->getIncremented();
             // Set the domains status as processing
             Domains::setStatus($product[0]['domain_id'], 6);
         }
         // Update the total of the order
         self::updateTotalsOrder($id);
         return $id;
     } catch (Exception $e) {
         echo $e->getMessage();
         die;
     }
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:66,代码来源:Orders.php

示例4: createNic

 /**
  * 
  * @param integer $domainId
  * @param string $type
  */
 private function createNic($domainId, $type = 'owner')
 {
     $soap = $this->Connect();
     if (!empty($this->session)) {
         $tld = Domains::getDomainTld($domainId);
         // get the domain profile
         $profile = DomainsProfiles::getProfileByDomainId($domainId, $type);
         if ($profile) {
             // Set generic variables for parameters
             $profile['countrycode'] = strtolower(Countries::getCodebyId($profile['country_id']));
             $profile['birthdate'] = Shineisp_Commons_Utilities::formatDateOut($profile['birthdate']);
             $profile['password'] = Shineisp_Commons_Utilities::GenerateRandomString();
             $profile['fullname'] = $profile['firstname'] . " " . $profile['lastname'];
             $profile['legalform'] = strtolower($profile['Legalforms']['name']);
             $profile['corporationtype'] = strtolower($profile['CompanyTypes']['name']);
             $profile['legalnumber'] = null;
             $profile['language'] = "en";
             $profile['isowner'] = $type == "owner" ? true : false;
             if ($tld == "it") {
                 // Create a nicHandle for the Italian domain tld
                 $params[] = $this->session['id'];
                 // Session
                 $params[] = $profile['lastname'];
                 // Lastname
                 $params[] = $profile['firstname'];
                 // Firstname
                 $params[] = $profile['gender'];
                 // Gender
                 $params[] = $profile['password'];
                 // Password
                 $params[] = $profile['email'];
                 // Email
                 $params[] = $profile['phone'];
                 // Phone
                 $params[] = $profile['fax'];
                 // Fax
                 $params[] = $profile['address'];
                 // Address
                 $params[] = $profile['city'];
                 // City
                 $params[] = $profile['area'];
                 // Area
                 $params[] = $profile['zip'];
                 // Zip
                 $params[] = $profile['countrycode'];
                 // Country Code
                 $params[] = $profile['language'];
                 // Language
                 $params[] = $profile['isowner'];
                 // isOwner
                 $params[] = $profile['legalform'];
                 // Legalform
                 $params[] = $profile['company'];
                 // Organisation
                 $params[] = $profile['fullname'];
                 // Legal name
                 $params[] = $profile['legalnumber'];
                 // Legal Number
                 $params[] = $profile['vat'];
                 // VAT or IVA
                 $params[] = $profile['birthdate'];
                 // Birthday
                 $params[] = $profile['birthplace'];
                 // Birthcity
                 $params[] = $profile['taxpayernumber'];
                 // Contact fiscal code or company vat
                 $params[] = $profile['vat'];
                 // Company National Identification Number
                 $params[] = $profile['corporationtype'];
                 $nicHandle = call_user_func_array(array($soap, 'nicCreateIT'), $params);
                 Shineisp_Commons_Utilities::log('Calling profile nicCreateIT with these params: ' . json_encode($params), "registrar.ovh.log");
             } else {
                 $params[] = $this->session['id'];
                 // Session
                 $params[] = $profile['lastname'];
                 // Lastname
                 $params[] = $profile['firstname'];
                 // Firstname
                 $params[] = $profile['password'];
                 // Password
                 $params[] = $profile['email'];
                 // Email
                 $params[] = $profile['phone'];
                 // Phone
                 $params[] = $profile['fax'];
                 // Fax
                 $params[] = $profile['address'];
                 // Address
                 $params[] = $profile['city'];
                 // City
                 $params[] = $profile['area'];
                 // Area
                 $params[] = $profile['zip'];
                 // Zip
                 $params[] = $profile['countrycode'];
//.........这里部分代码省略.........
开发者ID:moay,项目名称:shineisp,代码行数:101,代码来源:Main.php

示例5: create_client

 /**
  * Create a new client
  * 
  * Executes the creation of new client in the IspConfig control panel
  * Note in order to not fail this command, it must meet the following requirements:
  * 
  * - The customer must be registered in the db.
  * - The customer has bought a hosting plan
  * 
  * @param      array      $task     Must be a valid task 
  * @return     integer    RemoteClientId
  * @access     public
  */
 public function create_client(array $task)
 {
     $clientId = "";
     if (empty($task)) {
         throw new Exception('Task empty.', '3000');
     }
     // Execute a custom event
     $this->events()->trigger('panels_create_client_before', __CLASS__, array('task' => $task));
     $server = self::getServer($task['orderitem_id'], 'web');
     // Connection to the SOAP system
     $client = $this->connect($server['server_id']);
     if (!$client) {
         throw new Exception("There is no way to connect the client with the IspConfig Panel.", "3010");
     }
     try {
         // Get all the customer information
         $customer = Customers::getAllInfo($task['customer_id']);
         // Get the client id saved previously in the customer information page
         $customAttribute = CustomAttributes::getAttribute($task['customer_id'], 'client_id');
         // Get the custom ISPConfig attribute set in the customer control panel
         if (is_numeric($customAttribute['value'])) {
             /**
              * Client_id (IspConfig Attribute Set in ShineISP database in the setup of the panel)
              * @see Shineisp_Controller_Plugin_SetupcPanelsModules
              */
             $clientId = $customAttribute['value'];
             $record = $client->client_get($this->getSession(), $clientId);
             if ($record == false) {
                 $clientId = "";
             }
         }
         // Customer Profile
         $record['company_name'] = $customer['company'];
         $record['contact_name'] = $customer['firstname'] . " " . $customer['lastname'];
         $record['customer_no'] = $customer['customer_id'];
         $record['vat_id'] = $customer['vat'];
         $record['email'] = $customer['email'];
         $record['street'] = !empty($customer['Addresses'][0]['address']) ? $customer['Addresses'][0]['address'] : "";
         $record['zip'] = !empty($customer['Addresses'][0]['code']) ? $customer['Addresses'][0]['code'] : "";
         $record['city'] = !empty($customer['Addresses'][0]['city']) ? $customer['Addresses'][0]['city'] : "";
         $record['state'] = !empty($customer['Addresses'][0]['area']) ? $customer['Addresses'][0]['area'] : "";
         $record['country'] = !empty($customer['Addresses'][0]['Countries']['code']) ? $customer['Addresses'][0]['Countries']['code'] : "";
         $record['mobile'] = Contacts::getContact($customer['customer_id'], "Mobile");
         $record['fax'] = Contacts::getContact($customer['customer_id'], "Fax");
         $record['telephone'] = Contacts::getContact($customer['customer_id']);
         // System Configuration
         $languagecode = Languages::get_code($customer['language_id']);
         $record['language'] = $languagecode;
         $record['usertheme'] = "default";
         $record['template_master'] = 0;
         $record['template_additional'] = "";
         $record['created_at'] = date('');
         $record['web_php_options'] = "no,fast-cgi,cgi,mod,suphp,php-fpm";
         $record['ssh_chroot'] = 'jailkit';
         // Get the Json encoded parameters in the task
         $parameters = json_decode($task['parameters'], true);
         // Match all the ShineISP product system attribute and IspConfig attributes (see below about info)
         $retval = self::matchFieldsValues($parameters, $record);
         if (is_array($retval)) {
             $record = array_merge($record, $retval);
         } else {
             Shineisp_Commons_Utilities::logs("No hosting attribute parameters have been set in ShineISP. Check the hosting product attributes section.", "ispconfig.log");
         }
         // Execute the SOAP action
         if (!empty($clientId) && is_numeric($clientId)) {
             $client->client_update($this->getSession(), $clientId, 1, $record);
         } else {
             $arrUsernames = array();
             $arrUsernames = self::generateUsernames($customer);
             // Check if username is available
             foreach ($arrUsernames as $username) {
                 if (!$client->client_get_by_username($this->getSession(), $username)) {
                     break;
                 }
             }
             // Create a random password string
             $password = Shineisp_Commons_Utilities::GenerateRandomString();
             $record['username'] = $username;
             $record['password'] = $password;
             // Save the setup in the service setup field
             OrdersItems::set_setup($task['orderitem_id'], array('url' => 'http://' . $server['ip'] . ':8080', 'username' => $username, 'password' => $password), "webpanel");
             // Adding the client in ISPConfig
             $clientId = $client->client_add($this->getSession(), 0, $record);
             // Update the custom customer attribute client_id
             CustomAttributes::saveElementsValues(array(array('client_id' => $clientId)), $task['customer_id'], "customers");
             // Execute a custom event
             $this->events()->trigger('panels_create_client_after', __CLASS__, array('task' => $task, 'clientid' => $clientId, 'customerdata' => $record));
//.........这里部分代码省略.........
开发者ID:moay,项目名称:shineisp,代码行数:101,代码来源:Main.php

示例6: bulk_csv_export

 /**
  * export the content in a csv file
  * @param array $items
  */
 public function bulk_csv_export($items)
 {
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     // Get the records from the order table
     $orders = self::get_invoices($items, "invoice_id, number as number, order_id as order, DATE_FORMAT(invoice_date, '" . Settings::getMySQLDateFormat('dateformat') . "') as date, \n\t\tc.company as company, CONCAT(c.firstname, ' ', c.lastname) as fullname, o.total as total, o.vat as VAT, o.grandtotal as grandtotal,", 'number, invoice_date');
     if (!empty($orders[0])) {
         $tmpname = Shineisp_Commons_Utilities::GenerateRandomString();
         @mkdir(PUBLIC_PATH . "/tmp/");
         // Create the file and open it
         $fp = fopen(PUBLIC_PATH . "/tmp/" . $tmpname . '.csv', 'w+');
         // Add the headers
         $headers = array_keys($orders[0]);
         if (!empty($headers)) {
             array_shift($headers);
             foreach ($headers as $item) {
                 $newHeaders[] = $translator->translate(ucfirst($item));
             }
             fputcsv($fp, $newHeaders);
         }
         // For each record in the recordset
         foreach ($orders as $item) {
             array_shift($item);
             fputcsv($fp, $item);
         }
         // Close the file
         fclose($fp);
         // Return the link
         die(json_encode(array('url' => "/tmp/" . $tmpname . ".csv")));
     }
     return false;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:35,代码来源:Invoices.php

示例7: bulk_csv_export

 /**
  * export the content in a csv file
  * @param array $items
  */
 public function bulk_csv_export($items)
 {
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     // Get the records from the order table
     $orders = self::get_invoices($items, "purchase_id, \r\n\t\t\t\t\t\t\t\t\t\t\t\tDATE_FORMAT(creationdate, '" . Settings::getMySQLDateFormat('dateformat') . "') as date, \r\n\t\t\t\t\t\t\t\t\t\t\t\tnumber as number, \r\n\t\t\t\t\t\t\t\t\t\t\t\tcompany as company, \r\n\t\t\t\t\t\t\t\t\t\t\t\tpm.method as payment,\r\n\t\t\t\t\t\t\t\t\t\t\t\ttotal_net as net, \r\n\t\t\t\t\t\t\t\t\t\t\t\ttotal_vat as vat, \r\n\t\t\t\t\t\t\t\t\t\t\t\ttotal as total,\r\n\t\t\t\t\t\t\t\t\t\t\t\ts.status as status", 'number, creationdate');
     if (!empty($orders[0])) {
         $tmpname = Shineisp_Commons_Utilities::GenerateRandomString();
         @mkdir(PUBLIC_PATH . "/tmp/");
         // Create the file and open it
         $fp = fopen(PUBLIC_PATH . "/tmp/" . $tmpname . '.csv', 'w+');
         // Add the headers
         $headers = array_keys($orders[0]);
         if (!empty($headers)) {
             array_shift($headers);
             foreach ($headers as $item) {
                 $newHeaders[] = $translator->translate(ucfirst($item));
             }
             fputcsv($fp, $newHeaders);
         }
         // For each record in the recordset
         foreach ($orders as $item) {
             array_shift($item);
             fputcsv($fp, $item);
         }
         // Close the file
         fclose($fp);
         // Return the link
         die(json_encode(array('url' => "/tmp/" . $tmpname . ".csv")));
     }
     return false;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:35,代码来源:PurchaseInvoices.php

示例8: resetPassword

 /**
  * Reset the user admin password
  * @param string $userId
  */
 public static function resetPassword($userId)
 {
     if (!is_numeric($userId)) {
         return false;
     }
     $newpassword = Shineisp_Commons_Utilities::GenerateRandomString();
     Doctrine_Query::create()->update('AdminUser u')->set('u.password', '?', crypt($newpassword))->where("user_id = ?", $userId)->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     return $newpassword;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:13,代码来源:AdminUser.php

示例9: CreateFastlink

 public static function CreateFastlink($controller, $action, $params, $sqltable, $id, $customerid)
 {
     $link = new Fastlinks();
     $fastlink = self::checkFastlinkCode(Shineisp_Commons_Utilities::GenerateRandomString());
     $link->controller = $controller;
     $link->action = $action;
     $link->params = $params;
     $link->customer_id = $customerid;
     $link->sqltable = $sqltable;
     $link->id = $id;
     $link->code = $fastlink;
     $link->save();
     return $fastlink;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:14,代码来源:Fastlinks.php


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