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


PHP Tools::encrypt方法代码示例

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


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

示例1: updateCustomerPassword

 /**
  * UpdateCustomerFirstName() method update the customer
  *
  * @param int $iCustomerId
  * @param string $sFirstName
  * @return bool
  */
 public static function updateCustomerPassword($iCustomerId, $sPassword)
 {
     $sPassword = Tools::encrypt($sPassword);
     $sQuery = 'UPDATE ' . _DB_PREFIX_ . 'customer SET passwd = "' . pSQL($sPassword) . '"' . ' WHERE `active` = 1 AND `id_customer` = ' . $iCustomerId . ' AND `deleted` = 0' . (version_compare(_PS_VERSION_, '1.4', '>') ? ' AND `is_guest` =  0' : '');
     // execute
     return Db::getInstance()->Execute($sQuery);
 }
开发者ID:sho5kubota,项目名称:guidingyou2,代码行数:14,代码来源:module-dao_class.php

示例2: __construct

 public function __construct()
 {
     $this->name = 'verticalmegamenus';
     $this->arrLayout = array('default' => $this->l('Layout [default]'));
     $this->arrType = array('link' => $this->l('Link'), 'image' => $this->l('Image'), 'html' => $this->l('Custom HTML'));
     $this->arrGroupType = array('link' => $this->l('Link'), 'product' => $this->l('Product'), 'custom' => $this->l('Custom'));
     $this->arrProductType = array('saller' => $this->l('Best Seller'), 'special' => $this->l('Specials'), 'arrival' => $this->l('New Arrivals'), 'manual' => $this->l('Manual'));
     $this->arrCol = array('col-sm-1' => $this->l('1 Column'), 'col-sm-2' => $this->l('2 Columns'), 'col-sm-3' => $this->l('3 Columns'), 'col-sm-4' => $this->l('4 Columns'), 'col-sm-5' => $this->l('5 Columns'), 'col-sm-6' => $this->l('6 Columns'), 'col-sm-7' => $this->l('7 Columns'), 'col-sm-8' => $this->l('8 Columns'), 'col-sm-9' => $this->l('9 Columns'), 'col-sm-10' => $this->l('10 Columns'), 'col-sm-11' => $this->l('11 Columns'), 'col-sm-12' => $this->l('12 Columns'));
     $this->secure_key = Tools::encrypt('ovic-soft' . $this->name);
     $this->pathTemp = dirname(__FILE__) . '/images/temps/';
     $this->pathBanner = dirname(__FILE__) . '/images/banners/';
     $this->pathIcon = dirname(__FILE__) . '/images/icons/';
     if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
         $this->livePath = _PS_BASE_URL_SSL_ . __PS_BASE_URI__ . 'modules/verticalmegamenus/images/';
     } else {
         $this->livePath = _PS_BASE_URL_ . __PS_BASE_URI__ . 'modules/verticalmegamenus/images/';
     }
     $this->tab = 'front_office_features';
     $this->version = '1.0';
     $this->author = 'OvicSoft [@]';
     $this->bootstrap = true;
     parent::__construct();
     $this->displayName = $this->l('Supershop - Vertical Mega Menus Module');
     $this->description = $this->l('Vertical Mega Menus Module');
     $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
 }
开发者ID:abdoumej,项目名称:libsamy,代码行数:26,代码来源:verticalmegamenus.php

示例3: setUp

 protected function setUp()
 {
     $this->user = new User();
     $this->user->login = "jessy.lenne@stadeline.fr";
     $this->user->password = Tools::encrypt("secret");
     $this->user->save();
 }
开发者ID:jessylenne,项目名称:sf2-technical-test,代码行数:7,代码来源:CommentTest.php

示例4: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     $this->name = 'oneallsociallogin';
     $this->tab = 'administration';
     $this->version = '1.2';
     $this->author = 'OneAll LLC';
     $this->need_instance = 0;
     $this->module_key = '2571f9dab09af193a8ca375a09133873';
     $this->secure_key = Tools::encrypt($this->name);
     parent::__construct();
     $this->displayName = $this->l('OneAll Social Login');
     $this->description = $this->l('Professionally developed and free module that allows your users to register and login to PrestaShop with their Social Network account (Twitter, Facebook, LinkedIn, Google ...)');
     $this->confirmUninstall = $this->l('Are you sure you want to uninstall Social Login?');
     // This is the first time that the class is used
     if (!Configuration::get('OASL_FIRST_INSTALL')) {
         // Setup default values
         Configuration::updateValue('OASL_FIRST_INSTALL', '1');
         Configuration::updateValue('OASL_API_HANDLER', 'curl');
         Configuration::updateValue('OASL_API_PORT', '443');
         Configuration::updateValue('OASL_PROVIDERS', 'facebook,twitter,google,linkedin');
         Configuration::updateValue('OASL_LINK_ACCOUNT_DISABLE', 0);
         Configuration::updateValue('OASL_HOOK_LEFT_DISABLE', 1);
         Configuration::updateValue('OASL_HOOK_LEFT_TITLE', $this->l('Connect with:'));
         Configuration::updateValue('OASL_HOOK_RIGHT_DISABLE', 0);
         Configuration::updateValue('OASL_HOOK_RIGHT_TITLE', $this->l('Connect with:'));
         Configuration::updateValue('OASL_DATA_HANDLING', 'verify');
         Configuration::updateValue('OASL_EMAIL_CUSTOMER_DISABLE', '0');
         Configuration::updateValue('OASL_EMAIL_ADMIN_DISABLE', '0');
     }
     // Requires includes
     require_once dirname(__FILE__) . "/includes/tools.php";
     require_once dirname(__FILE__) . "/includes/providers.php";
 }
开发者ID:avataros,项目名称:social-login-prestashop,代码行数:36,代码来源:oneallsociallogin.php

示例5: createEntityCustomer

 public function createEntityCustomer($identifier, array $data, array $data_lang)
 {
     if ($identifier == 'John') {
         $data['passwd'] = Tools::encrypt('123456789');
     }
     return $this->createEntity('customer', $identifier, 'Customer', $data, $data_lang);
 }
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:7,代码来源:install.php

示例6: copyFromPost

 /**
  * @param object &$object Object
  * @param string $table Object table
  * @ DONE
  */
 protected function copyFromPost(&$object, $table, $post = array())
 {
     /* Classical fields */
     foreach ($post as $key => $value) {
         if (key_exists($key, $object) && $key != 'id_' . $table) {
             /* Do not take care of password field if empty */
             if ($key == 'passwd' && Tools::getValue('id_' . $table) && empty($value)) {
                 continue;
             }
             if ($key == 'passwd' && !empty($value)) {
                 /* Automatically encrypt password in MD5 */
                 $value = Tools::encrypt($value);
             }
             $object->{$key} = $value;
         }
     }
     /* Multilingual fields */
     $rules = call_user_func(array(get_class($object), 'getValidationRules'), get_class($object));
     if (count($rules['validateLang'])) {
         $languages = Language::getLanguages(false);
         foreach ($languages as $language) {
             foreach (array_keys($rules['validateLang']) as $field) {
                 $field_name = $field . '_' . (int) $language['id_lang'];
                 $value = Tools::getValue($field_name);
                 if (isset($value)) {
                     # validate module
                     $object->{$field}[(int) $language['id_lang']] = $value;
                 }
             }
         }
     }
 }
开发者ID:ahmedonee,项目名称:morinella,代码行数:37,代码来源:blog.php

示例7: displayMain

 public function displayMain()
 {
     global $smarty, $link, $cookie;
     if (!$cookie->logged) {
         Tools::redirect($link->getPage('LoginView'));
     }
     $user = new User((int) $cookie->id_user);
     if (Tools::isSubmit('joinCommit')) {
         if (User::checkPassword($user->id, Tools::encrypt($_POST['old_passwd']))) {
             if (Tools::getRequest('confirmation') == Tools::getRequest('passwd')) {
                 if (!empty($_POST['passwd']) && Validate::isPasswd($_POST['passwd'])) {
                     $user->copyFromPost();
                     if ($user->update()) {
                         $cookie->passwd = $user->passwd;
                         $cookie->write();
                         $smarty->assign('success', 'Your personal information has been successfully updated.');
                     }
                 } else {
                     $user->_errors[] = 'Password is invalid.';
                 }
             } else {
                 $user->_errors[] = 'Password and confirmation do not match.';
             }
         } else {
             $user->_errors[] = 'Your password is incorrect.';
         }
     }
     $smarty->assign(array('errors' => $user->_errors, 'DISPLAY_LEFT' => Module::hookBlock(array('myaccount')), 'user' => $user));
     return $smarty->fetch('my-user.tpl');
 }
开发者ID:yiuked,项目名称:tmcart,代码行数:30,代码来源:UserView.php

示例8: rev_uploader

 private function rev_uploader()
 {
     $key = Tools::getValue('security_key');
     if (empty($key) || Tools::encrypt(GlobalsRevSlider::MODULE_NAME) != $key) {
         echo json_encode(array('error_on' => 1, 'error_details' => 'Security Error'));
         die;
     }
     $targetFolder = ABSPATH . '/uploads/';
     $randnum = rand(00, 9999999);
     $sds_time = time();
     $NewFileName = $randnum . '-' . $sds_time;
     //$verifyToken = md5('unique_salt' . $_POST['timestamp']);
     if (!empty($_FILES)) {
         $tempFile = $_FILES['Filedata']['tmp_name'];
         //$targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
         $targetPath = $targetFolder;
         //$targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name'];
         // Validate the file type
         $fileTypes = array('jpg', 'jpeg', 'gif', 'png');
         // File extensions
         $fileParts = pathinfo($_FILES['Filedata']['name']);
         if (in_array($fileParts['extension'], $fileTypes)) {
             // $worked = UniteFunctionsWPRev::import_media_img($tempFile, $targetPath, $randnum.$_FILES['Filedata']['name']);
             $worked = UniteFunctionsWPRev::import_media_img($tempFile, $targetPath, $NewFileName . '.' . $fileParts['extension']);
             if (!empty($worked)) {
                 echo '1';
             }
         } else {
             echo '0';
         }
     }
 }
开发者ID:evgrishin,项目名称:se1614,代码行数:32,代码来源:revolutionslider_ajax.php

示例9: postProcess

 /**
  * Start forms process
  * @see FrontController::postProcess()
  */
 public function postProcess()
 {
     $origin_newsletter = (bool) $this->customer->newsletter;
     if (isset($_POST['years']) && isset($_POST['months']) && isset($_POST['days'])) {
         $this->customer->birthday = (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days'];
     }
     if (Tools::isSubmit('submitIdentity')) {
         if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '')) {
             $this->errors[] = Tools::displayError('Invalid date of birth.');
         } else {
             $email = trim(Tools::getValue('email'));
             $this->customer->birthday = empty($_POST['years']) ? '' : (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days'];
             if (isset($_POST['old_passwd'])) {
                 $_POST['old_passwd'] = trim($_POST['old_passwd']);
             }
             if (!Validate::isEmail($email)) {
                 $this->errors[] = Tools::displayError('This email address is not valid');
             } elseif ($this->customer->email != $email && Customer::customerExists($email, true)) {
                 $this->errors[] = Tools::displayError('An account using this email address has already been registered.');
             } elseif (!isset($_POST['old_passwd']) || empty($_POST['old_passwd']) || Tools::encrypt($_POST['old_passwd']) != $this->context->cookie->passwd) {
                 $this->errors[] = Tools::displayError('The password you entered is incorrect.');
             } elseif ($_POST['passwd'] != $_POST['confirmation']) {
                 $this->errors[] = Tools::displayError('The password and confirmation do not match.');
             } else {
                 $prev_id_default_group = $this->customer->id_default_group;
                 // Merge all errors of this file and of the Object Model
                 $this->errors = array_merge($this->errors, $this->customer->validateController());
             }
             if (!count($this->errors)) {
                 $this->customer->id_default_group = (int) $prev_id_default_group;
                 $this->customer->firstname = Tools::ucfirst(Tools::strtolower($this->customer->firstname));
                 if (!isset($_POST['newsletter'])) {
                     $this->customer->newsletter = 0;
                 } elseif (!$origin_newsletter && isset($_POST['newsletter'])) {
                     if ($module_newsletter = Module::getInstanceByName('blocknewsletter')) {
                         if ($module_newsletter->active) {
                             $module_newsletter->confirmSubscription($this->customer->email);
                         }
                     }
                 }
                 if (!isset($_POST['optin'])) {
                     $this->customer->optin = 0;
                 }
                 if (Tools::getValue('passwd')) {
                     $this->context->cookie->passwd = $this->customer->passwd;
                 }
                 if ($this->customer->update()) {
                     $this->context->cookie->customer_lastname = $this->customer->lastname;
                     $this->context->cookie->customer_firstname = $this->customer->firstname;
                     $this->context->smarty->assign('confirmation', 1);
                 } else {
                     $this->errors[] = Tools::displayError('The information cannot be updated.');
                 }
             }
         }
     } else {
         $_POST = array_map('stripslashes', $this->customer->getFields());
     }
     return $this->customer;
 }
开发者ID:rongandat,项目名称:vatfairfoot,代码行数:64,代码来源:IdentityController.php

示例10: __construct

 /**
  * Constructor 
  */
 function __construct()
 {
     global $currentIndex;
     $this->name = 'lofadvancecustom';
     parent::__construct();
     $this->tab = 'LandOfCoder';
     $this->version = '1.2';
     $this->displayName = $this->l('Lof Advance Footer Module');
     $this->description = $this->l('Lof Advance Footer Module');
     $this->secure_key = Tools::encrypt($this->name);
     if (file_exists(_PS_ROOT_DIR_ . '/modules/' . $this->name . '/libs/params.php') && !class_exists("LofFooterCustomParams", false)) {
         if (!defined("LOF_LOAD_LIB_PARAMS_FOOTER_CUSTOM")) {
             require_once _PS_ROOT_DIR_ . '/modules/' . $this->name . '/libs/params.php';
             define("LOF_LOAD_LIB_PARAMS_FOOTER_CUSTOM", true);
         }
     }
     if (file_exists(_PS_ROOT_DIR_ . '/modules/' . $this->name . '/classes/LofBlock.php') && file_exists(_PS_ROOT_DIR_ . '/modules/' . $this->name . '/classes/LofItem.php')) {
         if (!defined("LOF_LOAD_CLASSES_FOOTER_CUSTOM")) {
             require_once _PS_ROOT_DIR_ . '/modules/' . $this->name . '/classes/LofBlock.php';
             require_once _PS_ROOT_DIR_ . '/modules/' . $this->name . '/classes/LofItem.php';
             define("LOF_LOAD_CLASSES_FOOTER_CUSTOM", true);
         }
     }
     $this->Languages();
     $this->base_config_url = $currentIndex . '&configure=' . $this->name . '&token=' . Tools::getValue('token');
     $this->type = array('link', 'custom_html', 'module', 'gmap', 'addthis');
     $this->linktype = array('product', 'category', 'cms', 'link', 'manufacturer', 'supplier');
     $this->hookAssign = array('rightcolumn', 'leftcolumn', 'home', 'top', 'footer');
     $this->_params = new LofFooterCustomParams($this->name, $this->hookAssign);
 }
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:33,代码来源:lofadvancecustom.php

示例11: __construct

 public function __construct()
 {
     $this->name = 'groupcategory';
     //$this->cache = new GroupCategoryFastCache();
     $this->arrType = array('saller' => $this->l('Best Sellers'), 'view' => $this->l('Most View'), 'special' => $this->l('Specials'), 'arrival' => $this->l('New Arrivals'));
     $this->secure_key = Tools::encrypt('ovic-soft[group-category]' . $this->name);
     $this->imageHomeSize = Image::getSize(ImageType::getFormatedName('home'));
     $this->arrLayout = array('default' => $this->l('Layout [default]'));
     $this->pathTemp = dirname(__FILE__) . '/images/temps/';
     $this->pathBanner = dirname(__FILE__) . '/images/banners/';
     $this->pathIcon = dirname(__FILE__) . '/images/icons/';
     if (Configuration::get('PS_SSL_ENABLED')) {
         $this->livePath = _PS_BASE_URL_SSL_ . __PS_BASE_URI__ . 'modules/groupcategory/images/';
     } else {
         $this->livePath = _PS_BASE_URL_ . __PS_BASE_URI__ . 'modules/groupcategory/images/';
     }
     $this->tab = 'front_office_features';
     $this->version = '1.0';
     $this->author = 'OvicSoft';
     $this->bootstrap = true;
     parent::__construct();
     $this->displayName = $this->l('Supershop - Group Category Module');
     $this->description = $this->l('Group Category Module');
     $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
 }
开发者ID:abdoumej,项目名称:libsamy,代码行数:25,代码来源:groupcategory-d09415.php

示例12: __construct

 public function __construct()
 {
     $this->name = 'magicredirect';
     $this->tab = 'seo';
     $this->version = '1.1.4';
     $this->author = 'AgenceMalttt';
     $this->secure_key = Tools::encrypt($this->name);
     $this->need_instance = 0;
     $this->bootstrap = true;
     $this->module_key = 'a3e63c648fcae16db808f68e1eb18448';
     $this->ps_versions_compliancy = array('min' => '1.6.0.0', 'max' => _PS_VERSION_);
     $this->tabs_form = array('general' => $this->l('General Settings'), 'cache' => $this->l('Cache Settings'));
     $models = glob(_PS_MODULE_DIR_ . $this->name . '/models/*.php');
     if (!empty($models)) {
         foreach ($models as $file) {
             if (!strpos($file, 'index.php')) {
                 require_once $file;
             }
         }
     }
     if (Shop::isFeatureActive()) {
         Shop::addTableAssociation('redirect', array('type' => 'shop'));
     }
     $this->fields_form = array(array('name' => 'MGRT_AUTOCATCH', 'type' => 'radio', 'desc' => $this->l('Catch all 404 Url\'s and log them for future redirections'), 'label' => $this->l('Catch 404 and log them'), 'default' => '1', 'tab' => 'general', 'values' => array(array('id' => 'type_4_0', 'value' => 0, 'label' => $this->l('No')), array('id' => 'type_4_1', 'value' => 1, 'label' => $this->l('Yes')))), array('name' => 'MGRT_AUTOACTIVE', 'type' => 'radio', 'desc' => $this->l('Activate all generated rules by automatic catcher'), 'label' => $this->l('Activate all generated rules'), 'default' => '0', 'tab' => 'general', 'values' => array(array('id' => 'type_5_0', 'value' => 0, 'label' => $this->l('No')), array('id' => 'type_5_1', 'value' => 1, 'label' => $this->l('Yes')))), array('name' => 'MGRT_DELPARENTREDIR', 'type' => 'radio', 'desc' => $this->l('Redirect dead object (product, category, manufacturer, supplier, cms page, cms category) to their natural parent.'), 'label' => $this->l('Redirect to parent if deleted.'), 'default' => '1', 'tab' => 'general', 'values' => array(array('id' => 'type_6_0', 'value' => 0, 'label' => $this->l('No')), array('id' => 'type_6_1', 'value' => 1, 'label' => $this->l('Yes')))), array('name' => 'MGRT_AUTOPARENTREDIR', 'type' => 'radio', 'desc' => $this->l('Redirect disabled object (product, category, cms page, cms category, supplier, manufacturer) to their natural parent.'), 'label' => $this->l('Redirect to parent if disabled'), 'default' => '1', 'tab' => 'general', 'values' => array(array('id' => 'type_707_0', 'value' => 0, 'label' => $this->l('No')), array('id' => 'type_707_1', 'value' => 1, 'label' => $this->l('Yes')))), array('name' => 'MGRT_HOOKDISP', 'type' => 'radio', 'desc' => $this->l('Display an remember on admin dashboard when there is new 404 to take a look.'), 'label' => $this->l('Display new 404 alert on Admin Dashboard'), 'default' => '1', 'tab' => 'general', 'values' => array(array('id' => 'type_d_0', 'value' => 0, 'label' => $this->l('No')), array('id' => 'type_d_1', 'value' => 1, 'label' => $this->l('Yes')))), array('name' => 'MGRT_URLCACHE', 'type' => 'radio', 'desc' => $this->l('Enable cache for URL rules'), 'label' => $this->l('Faster redirects with cache'), 'default' => '1', 'tab' => 'cache', 'values' => array(array('id' => 'type_4_0', 'value' => 0, 'label' => $this->l('No')), array('id' => 'type_4_1', 'value' => 1, 'label' => $this->l('Yes')))), array('name' => 'MGRT_CACHETIME', 'type' => 'text', 'desc' => $this->l('Cache time (in minutes)'), 'label' => $this->l('Cache time (in minutes)'), 'default' => '60', 'validate' => 'isInt', 'tab' => 'cache'));
     $this->hooks = array('header', 'dashboardZoneOne', 'actionObjectUpdateAfter', 'actionObjectDeleteBefore');
     $this->cache_folder = _PS_CACHE_DIR_ . $this->name . '/cache/';
     $this->secure_key = Tools::encrypt($this->name);
     parent::__construct();
     $this->displayName = $this->l('Magic Redirect');
     $this->description = $this->l('Predictive and easy redirect tools (Multishop/Multilang)');
 }
开发者ID:acreno,项目名称:pm-ps,代码行数:31,代码来源:magicredirect.php

示例13: __construct

 public function __construct()
 {
     $this->name = 'flexiblebrands';
     $this->imageHomeSize = Image::getSize(ImageType::getFormatedName('home'));
     $this->orderValue = array('sales' => $this->l('Sales'), 'price' => $this->l('Price'), 'discount' => $this->l('Discount'), 'add' => $this->l('Add Date'), 'rand' => $this->l('Random'));
     $this->orderType = array('asc' => $this->l('Ascending'), 'desc' => $this->l('Descending'));
     $this->display = array('all' => $this->l('All'), 'condition-new' => $this->l('New'), 'condition-used' => $this->l('Used'), 'condition-refurbished' => $this->l('Refurbished'));
     $this->groupType = array('auto' => $this->l('Auto'), 'manual' => $this->l('Manual'));
     $this->moduleLayout = array('default' => $this->l('Layout [default]'));
     $this->tempPath = dirname(__FILE__) . '/images/temps/';
     $this->bannerPath = dirname(__FILE__) . '/images/banners/';
     $this->iconPath = dirname(__FILE__) . '/images/icons/';
     if (Configuration::get('PS_SSL_ENABLED')) {
         $this->livePath = _PS_BASE_URL_SSL_ . __PS_BASE_URI__ . 'modules/flexiblebrands/images/';
     } else {
         $this->livePath = _PS_BASE_URL_ . __PS_BASE_URI__ . 'modules/flexiblebrands/images/';
     }
     $this->secure_key = Tools::encrypt('ovic-' . $this->name);
     $this->tab = 'front_office_features';
     $this->version = '1.0';
     $this->author = 'OvicSoft [SonNC]';
     $this->bootstrap = true;
     parent::__construct();
     $this->displayName = $this->l('Ovic Flexible Brands Module');
     $this->description = $this->l('Ovic Flexible Brands Module');
     $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
     //$this->cache = new FlexibleBrandFastCache();
 }
开发者ID:habypk,项目名称:zocart,代码行数:28,代码来源:flexiblebrands.php

示例14: __construct

 public function __construct()
 {
     $this->name = 'ph_simpleblog';
     $this->tab = 'front_office_features';
     $this->version = '1.4.0';
     $this->author = 'www.PrestaHome.com';
     $this->need_instance = 1;
     $this->is_configurable = 1;
     $this->ps_versions_compliancy['min'] = '1.6';
     $this->ps_versions_compliancy['max'] = _PS_VERSION_;
     $this->secure_key = Tools::encrypt($this->name);
     $this->is_16 = version_compare(_PS_VERSION_, '1.6.0', '>=') === true ? true : false;
     $this->controllers = array('single', 'list', 'category');
     $this->bootstrap = true;
     if (Shop::isFeatureActive()) {
         Shop::addTableAssociation('simpleblog_category', array('type' => 'shop'));
         Shop::addTableAssociation('simpleblog_post', array('type' => 'shop'));
     }
     parent::__construct();
     $this->displayName = $this->l('Blog for PrestaShop');
     $this->description = $this->l('Adds a blog to your PrestaShop store');
     $this->confirmUninstall = $this->l('Are you sure you want to delete this module ?');
     if ($this->id && !$this->isRegisteredInHook('moduleRoutes')) {
         $this->registerHook('moduleRoutes');
     }
     if ($this->id && !$this->isRegisteredInHook('displayPrestaHomeBlogAfterPostContent')) {
         $this->registerHook('displayPrestaHomeBlogAfterPostContent');
     }
 }
开发者ID:evgrishin,项目名称:se1614,代码行数:29,代码来源:ph_simpleblog.php

示例15: preProcess

 public function preProcess()
 {
     parent::preProcess();
     $customer = new Customer((int) self::$cookie->id_customer);
     if (isset($_POST['years']) && isset($_POST['months']) && isset($_POST['days'])) {
         $customer->birthday = (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days'];
     }
     if (Tools::isSubmit('submitIdentity')) {
         if (Module::getInstanceByName('blocknewsletter')->active) {
             if (!isset($_POST['optin'])) {
                 $customer->optin = 0;
             }
             if (!isset($_POST['newsletter'])) {
                 $customer->newsletter = 0;
             }
         }
         if (!isset($_POST['id_gender'])) {
             $_POST['id_gender'] = 9;
         }
         if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '')) {
             $this->errors[] = Tools::displayError('Invalid date of birth');
         } else {
             $customer->birthday = empty($_POST['years']) ? '' : (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days'];
             $id_customer_exists = (int) Customer::customerExists(Tools::getValue('email'), true, false);
             if ($id_customer_exists && $id_customer_exists != (int) self::$cookie->id_customer) {
                 $this->errors[] = Tools::displayError('An account is already registered with this e-mail.');
             }
             $_POST['old_passwd'] = trim($_POST['old_passwd']);
             if (empty($_POST['old_passwd']) || Tools::encrypt($_POST['old_passwd']) != self::$cookie->passwd) {
                 $this->errors[] = Tools::displayError('Your password is incorrect.');
             } elseif ($_POST['passwd'] != $_POST['confirmation']) {
                 $this->errors[] = Tools::displayError('Password and confirmation do not match');
             } else {
                 $prev_id_default_group = $customer->id_default_group;
                 $this->errors = array_unique(array_merge($this->errors, $customer->validateController(true, true)));
             }
             if (!count($this->errors)) {
                 $customer->id_default_group = (int) $prev_id_default_group;
                 $customer->firstname = Tools::ucfirst(Tools::strtolower($customer->firstname));
                 if (Tools::getValue('passwd')) {
                     self::$cookie->passwd = $customer->passwd;
                 }
                 if ($customer->update()) {
                     self::$cookie->customer_lastname = $customer->lastname;
                     self::$cookie->customer_firstname = $customer->firstname;
                     self::$smarty->assign('confirmation', 1);
                 } else {
                     $this->errors[] = Tools::displayError('Cannot update information');
                 }
             }
         }
     } else {
         $_POST = array_map('stripslashes', $customer->getFields());
     }
     $birthday = $customer->birthday ? explode('-', $customer->birthday) : array('-', '-', '-');
     /* Generate years, months and days */
     self::$smarty->assign(array('years' => Tools::dateYears(), 'sl_year' => $birthday[0], 'months' => Tools::dateMonths(), 'sl_month' => $birthday[1], 'days' => Tools::dateDays(), 'sl_day' => $birthday[2], 'errors' => $this->errors));
     self::$smarty->assign('newsletter', (int) Module::getInstanceByName('blocknewsletter')->active);
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:59,代码来源:IdentityController.php


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