/** * 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); }
/** * 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); }
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_); }
/** * @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; } } } } }
protected function setUp() { $this->user = new User(); $this->user->login = "******"; $this->user->password = Tools::encrypt("secret"); $this->user->save(); }
/** * 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"; }
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'; } } }
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)'); }
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_); }
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(); }
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'); } }
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'); }
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); }
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); }
public function __construct() { if (file_exists(_PS_MODULE_DIR_ . 'leotempcp')) { $this->_leotype = 1; if (file_exists(_PS_MODULE_DIR_ . 'leotempcp/classes/widgetbase.php')) { require_once _PS_MODULE_DIR_ . 'leotempcp/classes/widgetbase.php'; } if (file_exists(_PS_MODULE_DIR_ . 'leotempcp/classes/widget.php')) { require_once _PS_MODULE_DIR_ . 'leotempcp/classes/widget.php'; } } else { $this->_leotype = 0; if (file_exists(_PS_MODULE_DIR_ . 'leomanagewidgets/classes/widgetbase.php')) { require_once _PS_MODULE_DIR_ . 'leomanagewidgets/classes/widgetbase.php'; } if (file_exists(_PS_MODULE_DIR_ . 'leomanagewidgets/classes/widget.php')) { require_once _PS_MODULE_DIR_ . 'leomanagewidgets/classes/widget.php'; } } if ($this->_leotype == 1) { $this->version = '3.0'; $this->_hooksPos = array('displayBanner', 'displayNav', 'displayTop', 'displaySlideshow', 'topNavigation', 'displayTopColumn', 'displayLeftColumn', 'displayHome', 'displayContentBottom', 'displayRightColumn', 'displayBottom', 'displayFooterTop', 'displayfooter', 'displayFooterBottom', 'displayFootNav', 'productTabContent', 'displayFooterProduct', 'displayRightColumnProduct'); $this->_hookAssign = array('rightcolumn', 'leftcolumn', 'topcolumn', 'home', 'top', 'footer', 'nav'); } else { $this->version = '3.0'; $this->_hooksPos = array('displayTop', 'displayNav', 'displayTopColumn', 'displayLeftColumn', 'displayHome', 'displayHomeTab', 'displayHomeTabContent', 'displayRightColumn', 'displayfooter', 'displayRightColumnProduct', 'displayLeftColumnProduct', 'productTab'); $this->_hookAssign = array('rightcolumn', 'leftcolumn', 'topcolumn', 'home', 'top', 'footer'); } $this->name = 'leomanagewidgets'; $this->tab = 'front_office_features'; $this->author = 'LeoTheme'; $this->need_instance = 0; $this->secure_key = Tools::encrypt($this->name); $this->bootstrap = true; $this->_themeName = Context::getContext()->shop->getTheme(); parent::__construct(); if ($this->_leotype == 1 && Module::isInstalled($this->name)) { $this_version = Configuration::get('LEO_MANAGERWIDGETS_VERSION') ? Configuration::get('LEO_MANAGERWIDGETS_VERSION') : ''; LeoManagewidgetsInstall::checkVersion($this_version); } //hook name is lower //$this->_hooksException = array('displayRightColumn'=>array("")); $langList = Language::getLanguages(false); $gParam = array("class", "active", "hook_name", "animate_offset", "delay_animate", "skin_animate", "background_style", "background_style_color", "background_style_image_url", "background_style_position", "background_style_repeat", "background_style_parallax_speed", "background_style_parallax_offsetx", "background_style_parallax_offsety", "background_style_mouseparallax_strength", "background_style_mouseparallax_axis", "background_style_mouseparallax_offsetx", "background_style_mouseparallax_offsety", "background_video_source", "background_video_vid", "background_video_mp4", "background_video_webm", "background_video_ogg", "background_style_fullwidth"); foreach ($langList as $lang) { $gParam[] = 'title_' . $lang["id_lang"]; } $this->_groupField = array("id", "active", "hook_name", "position", "params" => $gParam); $this->_columnField = array("id", "active", "id_group", "position", "params" => array("class", "lg", "md", "sm", "xs", "sp", "background", "pages", "specific", "controllerids", "skinanimate", "animateoffset", "delayanimate")); $this->_rowField = array("id", "id_column", "position", "active", "key_widget", "module_name", "hook_name", "type", "params" => array()); if (Tools::strtolower(Tools::getValue('controller')) == 'adminmodules' && Tools::getValue('configure') == $this->name) { $leoWidget = new LeoTempcpWidget(); $this->_widgets = $leoWidget->getWidgets(); } $this->displayName = $this->l('Leo Manage Widget'); $this->description = $this->l('Leo Manage Widget support Leo FrameWork Verion 3.0.'); }
/** * Set customer information * Used to create user account with PayPal account information */ function setCustomerInformation($ppec, $email) { $customer = new Customer(); $customer->email = $email; $customer->lastname = $ppec->result['LASTNAME']; $customer->firstname = $ppec->result['FIRSTNAME']; $customer->passwd = Tools::encrypt(Tools::passwdGen()); return $customer; }
public function preProcess() { parent::preProcess(); $customer = new Customer((int) self::$cookie->id_customer); if (sizeof($_POST)) { $exclusion = array('secure_key', 'old_passwd', 'passwd', 'active', 'date_add', 'date_upd', 'last_passwd_gen', 'newsletter_date_add', 'id_default_group'); $fields = $customer->getFields(); foreach ($fields as $key => $value) { if (!in_array($key, $exclusion)) { $customer->{$key} = key_exists($key, $_POST) ? trim($_POST[$key]) : 0; } } } if (isset($_POST['years']) and isset($_POST['months']) and isset($_POST['days'])) { $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')) and !(Tools::getValue('months') == '' and Tools::getValue('days') == '' and 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']; $_POST['old_passwd'] = trim($_POST['old_passwd']); if (empty($_POST['old_passwd']) or 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 = $customer->validateControler(); } if (!sizeof($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()); } if ($customer->birthday) { $birthday = explode('-', $customer->birthday); } else { $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); }
/** * Start forms process * @see FrontController::postProcess() */ public function postProcess() { if (Tools::isSubmit('email')) { if (!($email = Tools::getValue('email')) || !Validate::isEmail($email)) { $this->errors[] = Tools::displayError('Invalid e-mail address'); } else { $customer = new Customer(); $customer->getByemail($email); if (!Validate::isLoadedObject($customer)) { $this->errors[] = Tools::displayError('There is no account registered to this e-mail address.'); } elseif (!$customer->active) { $this->errors[] = Tools::displayError('You cannot regenerate the password for this account.'); } elseif (strtotime($customer->last_passwd_gen . '+' . (int) ($min_time = Configuration::get('PS_PASSWD_TIME_FRONT')) . ' minutes') - time() > 0) { $this->errors[] = sprintf(Tools::displayError('You can regenerate your password only every %d minute(s)'), (int) $min_time); } else { $mail_params = array('{email}' => $customer->email, '{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{url}' => $this->context->link->getPageLink('password', true, null, 'token=' . $customer->secure_key . '&id_customer=' . (int) $customer->id)); if (Mail::Send($this->context->language->id, 'password_query', Mail::l('Password query confirmation'), $mail_params, $customer->email, $customer->firstname . ' ' . $customer->lastname)) { $this->context->smarty->assign(array('confirmation' => 2, 'email' => $customer->email)); } else { $this->errors[] = Tools::displayError('Error occurred while sending the e-mail.'); } } } } elseif (($token = Tools::getValue('token')) && ($id_customer = (int) Tools::getValue('id_customer'))) { $email = Db::getInstance()->getValue('SELECT `email` FROM ' . _DB_PREFIX_ . 'customer c WHERE c.`secure_key` = \'' . pSQL($token) . '\' AND c.id_customer = ' . (int) $id_customer); if ($email) { $customer = new Customer(); $customer->getByemail($email); if (!Validate::isLoadedObject($customer)) { $this->errors[] = Tools::displayError('Customer account not found'); } elseif (!$customer->active) { $this->errors[] = Tools::displayError('You cannot regenerate the password for this account.'); } elseif (strtotime($customer->last_passwd_gen . '+' . (int) Configuration::get('PS_PASSWD_TIME_FRONT') . ' minutes') - time() > 0) { Tools::redirect('index.php?controller=authentication&error_regen_pwd'); } else { $customer->passwd = Tools::encrypt($password = Tools::passwdGen(MIN_PASSWD_LENGTH)); $customer->last_passwd_gen = date('Y-m-d H:i:s', time()); if ($customer->update()) { Hook::exec('actionPasswordRenew', array('customer' => $customer, 'password' => $password)); $mail_params = array('{email}' => $customer->email, '{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{passwd}' => $password); if (Mail::Send($this->context->language->id, 'password', Mail::l('Your new password'), $mail_params, $customer->email, $customer->firstname . ' ' . $customer->lastname)) { $this->context->smarty->assign(array('confirmation' => 1, 'email' => $customer->email)); } else { $this->errors[] = Tools::displayError('Error occurred while sending the e-mail.'); } } else { $this->errors[] = Tools::displayError('An error occurred with your account and your new password cannot be sent to your e-mail. Please report your problem using the contact form.'); } } } else { $this->errors[] = Tools::displayError('We cannot regenerate your password with the data you submitted'); } } elseif (Tools::getValue('token') || Tools::getValue('id_customer')) { $this->errors[] = Tools::displayError('We cannot regenerate your password with the data you submitted'); } }
function getByMd5($email, $passwd = NULL) { $customer = array(); $result = Db::getInstance()->GetRow("SELECT * FROM " . _DB_PREFIX_ . "customer WHERE active = 1\n AND email = '" . pSQL($email) . "' " . (isset($passwd) ? "AND passwd = '" . Tools::encrypt($passwd) . "'" : "") . " AND deleted = 0"); if (!$result) { return false; } else { return $result; } }
protected function init() { $cron_admin_dir = Configuration::get('CRONJOBS_ADMIN_DIR'); if (strcmp(Tools::encrypt(_PS_ADMIN_DIR_), $cron_admin_dir) !== 0) { Configuration::updateValue('CRONJOBS_ADMIN_DIR', Tools::encrypt(_PS_ADMIN_DIR_)); if (strcmp(Configuration::get('CRONJOBS_MODE'), 'webservice') !== 0) { $this->toggleWebservice(true); } } }
public function __construct() { $this->name = 'blockcms'; $this->tab = 'front_office_features'; $this->version = 1.1; $this->author = 'PrestaShop'; parent::__construct(); $this->displayName = $this->l('CMS Block'); $this->description = $this->l('Adds a block with several CMS links.'); $this->secure_key = Tools::encrypt($this->name); }
public function __construct() { $this->name = 'oviclayoutcontrol'; $this->tab = 'administration'; $this->version = '1.4.3'; $this->author = 'OVIC-SOFT'; $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Ovic - Layout control'); $this->description = $this->l('select layout option.'); $this->secure_key = Tools::encrypt($this->name); }
public function __construct() { $this->name = 'ptsmaplocator'; $this->tab = 'front_office_features'; $this->version = '1.0.0'; $this->author = 'PrestaBrain'; $this->bootstrap = true; $this->secure_key = Tools::encrypt($this->name); parent::__construct(); $this->displayName = $this->l('Pts Map Locator'); $this->description = $this->l('Pts Map Locator supported by pts Framework 3.0'); }
public function __construct() { $this->name = 'productcomments'; $this->tab = 'front_office_features'; $this->version = '2.3'; $this->author = 'PrestaShop'; $this->need_instance = 0; $this->secure_key = Tools::encrypt($this->name); parent::__construct(); $this->displayName = $this->l('Product Comments'); $this->description = $this->l('Allows users to post reviews.'); }
public function __construct() { $this->name = 'pscleaner'; $this->tab = 'administration'; $this->version = '0.9'; $this->author = 'PrestaShop'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->l('PrestaShop Cleaner'); $this->description = $this->l('Check and fix functional integrity constraints and remove default data'); $this->secure_key = Tools::encrypt($this->name); }
public function __construct() { $this->name = 'riskified'; $this->tab = 'payment_security'; $this->version = '0.3.1'; $this->author = 'Riskified.com'; $this->secure_key = Tools::encrypt($this->name); parent::__construct(); $this->displayName = 'Riskified'; $this->description = $this->l('Riskified reviews, approves & guarantees transactions you would otherwise decline'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); }
public function __construct() { $this->name = 'ph_blog_column_custom'; $this->tab = 'front_office_features'; $this->version = '1.0.0'; $this->author = 'www.PrestaHome.com'; $this->need_instance = 0; $this->is_configurable = 1; $this->secure_key = Tools::encrypt($this->name); $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Blog for PrestaShop - custom block in the column'); }
public function __construct() { $this->name = 'smartbloghomelatestnews'; $this->tab = 'front_office_features'; $this->version = '2.0.1'; $this->bootstrap = true; $this->author = 'SmartDataSoft'; $this->secure_key = Tools::encrypt($this->name); parent::__construct(); $this->displayName = $this->l('SmartBlog Home Latest'); $this->description = $this->l('The Most Powerfull Presta shop Blog Module\'s tag - by smartdatasoft'); $this->confirmUninstall = $this->l('Are you sure you want to delete your details ?'); }
protected function init() { $new_admin_dir = Tools::encrypt($this->getAdminDir()) != Configuration::get('CRONJOBS_ADMIN_DIR'); $new_module_version = version_compare($this->version, Configuration::get('CRONJOBS_MODULE_VERSION'), '!='); if ($new_admin_dir || $new_module_version) { Configuration::updateValue('CRONJOBS_MODULE_VERSION', $this->version); Configuration::updateValue('CRONJOBS_ADMIN_DIR', Tools::encrypt($this->getAdminDir())); if (Configuration::get('CRONJOBS_MODE') == 'webservice') { return $this->enableWebservice(); } return $this->disableWebservice(); } }
/** * 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; }