Example #1
0
function install_ShareThis()
{
    $publisher_id = get_option('st_pubid');
    //pub key value
    $widget = get_option('st_widget');
    //entire script tag
    $newUser = false;
    if (get_option('st_version') == '') {
        update_option('st_version', '5x');
    }
    if (empty($publisher_id)) {
        if (!empty($widget)) {
            $newPkey = getKeyFromTag();
            if ($newPkey == false) {
                $newUser = true;
                update_option('st_pubid', trim(makePkey()));
            } else {
                update_option('st_pubid', $newPkey);
                //pkey found set old key
            }
        } else {
            $newUser = true;
            update_option('st_pubid', trim(makePkey()));
        }
    }
    if ($widget == false || !preg_match('/stLight.options/', $widget)) {
        $pkey2 = get_option('st_pubid');
        $widget = "<script charset=\"utf-8\" type=\"text/javascript\">var switchTo5x=true;</script>";
        $widget .= "<script charset=\"utf-8\" type=\"text/javascript\" src=\"http://w.sharethis.com/button/buttons.js\"></script>";
        $widget .= "<script type=\"text/javascript\">stLight.options({publisher:'{$pkey2}'});var st_type='wordpress" . trim(get_bloginfo('version')) . "';</script>";
        update_option('st_widget', $widget);
    }
    $st_sent = get_option('st_sent');
    $st_upgrade_five = get_option('st_upgrade_five');
    if (empty($st_sent)) {
        update_option('st_sent', 'true');
        update_option('st_upgrade_five', '5x');
        $st_sent = get_option('st_sent');
        //confirm if value has been set
        if (!empty($st_sent)) {
            sendWelcomeEmail($newUser);
        }
        $st_upgrade_five = get_option('st_upgrade_five');
    } else {
        if (empty($st_upgrade_five)) {
            update_option('st_upgrade_five', '5x');
            $st_upgrade_five = get_option('st_upgrade_five');
            //confirm if value has been set
            if (!empty($st_upgrade_five)) {
                sendUpgradeEmail();
            }
        }
    }
    if (get_option('st_add_to_content') == '') {
        update_option('st_add_to_content', 'yes');
    }
    if (get_option('st_add_to_page') == '') {
        update_option('st_add_to_page', 'yes');
    }
}
Example #2
0
function register($firstname, $lastname, $email, $password, $userId = 0, $send_welcome = true)
{
    global $db;
    $userId = (int) $userId;
    $email = strtolower($email);
    $res = pg_query($db, "SELECT * FROM users WHERE email = '" . pg_escape_string($email) . "'") or die("Database Error");
    if (pg_num_rows($res) > 0) {
        return false;
    }
    $apikey = generateRandomString(32);
    $activationKey = $send_welcome ? generateRandomString(40) : "";
    $res = pg_query($db, "INSERT INTO users(firstname, lastname, email, password, apikey, users_id, activationkey) VALUES('" . pg_escape_string($firstname) . "', '" . pg_escape_string($lastname) . "', '" . pg_escape_string($email) . "', '" . md5($password) . "', '" . $apikey . "', " . $userId . ", '" . pg_escape_string($activationKey) . "'); SELECT currval(pg_get_serial_sequence('users','id')) as last_insert_id;") or die("Database Error");
    if ($d = pg_fetch_assoc($res)) {
        $userId = $d['last_insert_id'];
        $layers_my_group = array();
        $layers_ssl_maps = array();
        $layers_style_maps = array();
        $layers_outdoor_maps = array();
        $layers_satellite_maps = array();
        $layers_style_maps[] = $layers_my_group[] = addLayers($userId, 'CartoDB Light', 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png', '', '', 'Map tiles by <a href="http://cartodb.com/attributions#basemaps" target="_blank">CartoDB</a>, under <a href="https://creativecommons.org/licenses/by/3.0/" target="_blank">CC BY 3.0</a>. Data by <a href="http://www.openstreetmap.org/" target="_blank">OpenStreetMap</a>, under ODbL.');
        $layers_outdoor_maps[] = $layers_my_group[] = addLayers($userId, 'Loniva Hiking', 'http://tile.waymarkedtrails.org/hiking/{z}/{x}/{y}.png', '', '', '<a href="https://openpistemap.org" target="_blank">OpenStreetMap</a>');
        $layers_style_maps[] = $layers_my_group[] = addLayers($userId, 'MapQuest Sat', 'https://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', '', '', '<a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a>');
        $layers_style_maps[] = $layers_my_group[] = addLayers($userId, 'Stamen.Watercolor', 'http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.jpg', '', '', 'Map tiles by <a href="http://stamen.com" target="_blank">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0" target="_blank">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org" target="_blank">OpenStreetMap</a>, under <a href="http://creativecommons.org/licenses/by-sa/3.0" target="_blank">CC BY SA</a>.');
        $layers_outdoor_maps[] = $layers_my_group[] = addLayers($userId, 'OpenCycleMap', 'http://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png', '', '', '<a href="http://thunderforest.com/" target="_blank">Thunderforest</a>');
        $layers_ssl_maps[] = $layers_my_group[] = addLayers($userId, 'OpenStreetMap', 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', '', '', '<a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a>');
        $layers_satellite_maps[] = $layers_my_group[] = addLayers($userId, 'Esri World Imagery', 'http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', '', '', 'Attribution: <a href="http://www.esri.com/" target="_blank">ESRI</a>');
        $layers_satellite_maps[] = $layers_my_group[] = addLayers($userId, 'Google Maps', 'http://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z}', '', '', '<a href="http://www.google.com/intl/en-GB_US/help/terms_maps.html" target="_blank">Google - Terms of Use</a>');
        $layers_my_group[] = addLayers($userId, 'MapBox', 'https://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png', 'examples.map-i875mjb7', '', '<a href="https://mapbox.com" target="_blank">MapBox</a>');
        $layers_outdoor_maps[] = $layers_my_group[] = addLayers($userId, 'Loniva Biking', 'http://tile.waymarkedtrails.org/cycling/{z}/{x}/{y}.png', '', '', '<a href="http://cycling.waymarkedtrails.org/" target="_blank">OpenStreetMap</a>');
        $layers_style_maps[] = $layers_my_group[] = addLayers($userId, 'Stamen.Toner', 'http://a.tile.stamen.com/toner/{z}/{x}/{y}.png', '', '', 'Map tiles by <a href="http://stamen.com" target="_blank">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0" target="_blank">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org" target="_blank">OpenStreetMap</a>, under <a href="http://www.openstreetmap.org/copyright" target="_blank">ODbL</a>.');
        $layers_style_maps[] = $layers_my_group[] = addLayers($userId, 'CartoDB Dark', 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png', '', '', 'Map tiles by <a href="http://cartodb.com/attributions#basemaps" target="_blank">CartoDB</a>, under <a href="https://creativecommons.org/licenses/by/3.0/" target="_blank">CC BY 3.0</a>. Data by <a href="http://www.openstreetmap.org/" target="_blank">OpenStreetMap</a>, under ODbL.');
        $layers_ssl_maps[] = $layers_my_group[] = addLayers($userId, 'MapQuest', 'https://otile3-s.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', '', '', '<a href="https://openstreetmap.org" target="_blank">OpenStreetMap. </a> Tiles Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a>');
        $layers_my_group[] = addLayers($userId, 'MapFig Greenwaters', 'https://{s}.tile.thunderforest.com/mapfig-2a6/{z}/{x}/{y}.png', '', '', '&copy; <a href="http://mapfig.org" target="_blank">MapFig </a> Greenwaters by <a href="http://thunderforest.com" target="_blank">Thunderforest,</a> Data by <a href="http://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>.');
        $layers_ssl_maps[] = $layers_my_group[] = addLayers($userId, 'MapFig Darkwaters', 'https://{s}.tile.thunderforest.com/mapfig-darkwaters/{z}/{x}/{y}.png', '', '', '&copy; <a href="http://mapfig.org" target="_blank">MapFig </a> Darkwaters by <a href="http://thunderforest.com" target="_blank">Thunderforest,</a> Data by <a href="http://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>.');
        $layers_ssl_maps[] = $layers_my_group[] = addLayers($userId, 'MapFig Bluewaters', 'https://{s}.tile.thunderforest.com/mapfig-bluewaters/{z}/{x}/{y}.png', '', '', '&copy; <a href="http://mapfig.org" target="_blank">MapFig </a> Bluewaters by <a href="http://thunderforest.com" target="_blank">Thunderforest,</a> Data by <a href="http://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>.');
        $g1 = addGroup($userId, 'My Group');
        addGroupHasLayers($userId, $g1, $layers_my_group);
        $g1 = addGroup($userId, 'SSL Maps');
        addGroupHasLayers($userId, $g1, $layers_ssl_maps);
        $g1 = addGroup($userId, 'Style Maps');
        addGroupHasLayers($userId, $g1, $layers_style_maps);
        $g1 = addGroup($userId, 'Outdoor Maps');
        addGroupHasLayers($userId, $g1, $layers_outdoor_maps);
        $g1 = addGroup($userId, 'Satellite Maps');
        addGroupHasLayers($userId, $g1, $layers_satellite_maps);
        if ($send_welcome) {
            sendWelcomeEmail($userId, $password);
        }
        return $userId;
    } else {
        return false;
    }
}
Example #3
0
function st_widget()
{
    global $post;
    $sharethis = "";
    $widget = get_option('st_widget');
    $st_sent = get_option('st_sent');
    if (empty($st_sent)) {
        update_option('st_sent', 'true');
        $st_sent = get_option('st_sent');
        //confirm if value has been set
        if (!empty($st_sent)) {
            sendWelcomeEmail(true);
        }
    }
    if (!empty($widget)) {
        $sharethis = '<script type="text/javascript">SHARETHIS.addEntry({ title: "' . str_replace('"', '\\"', strip_tags(get_the_title())) . '", url: "' . get_permalink($post->ID) . '" });</script>';
    }
    return $sharethis;
}
Example #4
0
<?php

require '../mailer.php';
$servername = "mysql.roscr.com";
$username = "******";
$password = "******";
$dbname = "roscremails";
$email = $_POST['email'];
if (!isset($email) || $email == '') {
    var_dump($email);
    http_response_code(400);
    echo 'Failure';
    exit;
}
// Create connection
$mysqli = new mysqli($servername, $username, $password, $dbname);
/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit;
}
$sql = "INSERT INTO emails (email) VALUES ('" . $mysqli->real_escape_string($email) . "')";
if (mysqli_query($mysqli, $sql)) {
    sendWelcomeEmail($email);
} else {
    http_response_code(400);
    $resp = array('error' => mysqli_error($mysqli));
    echo json_encode($resp);
}
mysqli_close($mysqli);
Example #5
0
function com_install()
{
    if (defined('JPATH_ROOT') and class_exists('JFactory')) {
        define('JNEWS_JPATH_ROOT', JPATH_ROOT);
    }
    if (!defined('DS')) {
        define('DS', DIRECTORY_SEPARATOR);
    }
    if (is_dir(JNEWS_JPATH_ROOT . DS . "administrator" . DS . "components" . DS . "com_jnews" . DS)) {
        $filename_for_del = JNEWS_JPATH_ROOT . DS . "administrator" . DS . "components" . DS . "com_jnews" . DS . "admin.jnews.php";
        if (file_exists($filename_for_del)) {
            if (is_writable($filename_for_del)) {
                unlink($filename_for_del);
            }
        }
    }
    if (!defined('DS')) {
        define('DS', DIRECTORY_SEPARATOR);
    }
    require_once JNEWS_JPATH_ROOT . DS . 'components' . DS . 'com_jnews' . DS . 'defines.php';
    require_once JNEWSPATH_ADMIN . 'classes' . DS . 'config.php';
    require_once JNEWSPATH_ADMIN . 'admin.jnews.html.php';
    require_once JNEWSPATH_CLASS . DS . 'class.jnews.php';
    @ini_set('max_execution_time', 0);
    //If memory_limit less than 128M
    $limit = jnews::convertToBytes(@ini_get('memory_limit'));
    if ($limit < jnews::convertToBytes('128M')) {
        @ini_set('memory_limit', '128M');
    }
    $xf = new jNews_Config();
    $return = '';
    //we install the jNews Menus
    installMenu();
    $database = JFactory::getDBO();
    $q = " SELECT `text` FROM `#__jnews_xonfig` WHERE `akey` = 'version' ";
    $database->setQuery($q);
    $vers = $database->loadResult();
    $err = $database->getErrorMsg();
    $version = jnews::getVersion();
    //we check if availability column exists in jnews_templates
    $q = "SHOW FIELDS FROM `#__jnews_templates`";
    $database->setQuery($q);
    $templateFields = $database->loadObjectList('Field');
    if (!empty($version) and $version < '7.3.0') {
        $query[] = "ALTER TABLE `#__jnews_listssubscribers` ADD `params` TEXT NOT NULL";
        $query[] = "ALTER TABLE `#__jnews_queue` ADD `params` TEXT NOT NULL";
    }
    if (!empty($version) and $version < '7.2.0') {
        $query[] = "UPDATE `#__jnews_xonfig` SET `text`='jNews_Newsletter' WHERE `text`='newsletter' AND `akey`='classes1' ";
        $query[] = "UPDATE `#__jnews_xonfig` SET `text`='jNews_Autoresponder' WHERE `text`='autoresponder' AND `akey`='classes2' ";
        $query[] = "UPDATE `#__jnews_xonfig` SET `text`='jNews_Autonews' WHERE `text`='autonews' AND `akey`='classes7' ";
    }
    if (!empty($version) && $version < '7.1.0') {
        $query[] = "ALTER TABLE `#__jnews_lists` ADD `subnotifysend` TINYINT(1) NOT NULL DEFAULT '1', ADD `subnotifymsg` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL";
        $query[] = "ALTER TABLE `#__jnews_templates` ADD `csstyle` TEXT NOT NULL";
        $query[] = "UPDATE `#__jnews_templates` SET `body` = REPLACE(`body`,'components/com_jnews/templates/','media/com_jnews/templates/')";
    }
    if (!empty($version) && $version < '7.0.2') {
        $xf->insert('cron_pass', 'ibHrqqFb');
        $xf->insert('nextdate', '0');
        $xf->insert('lastdate', '0');
    }
    if (!empty($version) && $version < '6.1.2') {
        $xf->insert('url_pass', 'xfr1tyh6', 0);
        $xf->insert('create_newsubsrows', '5', 0);
        $xf->insert('use_backendview', '0', 0);
        $xf->insert('terms_condition', '0', 0);
        $xf->insert('show_terms', '0', 0);
        $xf->insert('check_terms', '0', 0);
    }
    if (empty($err) and !empty($version) and $version < '6.0.2') {
        if (@(include_once JNEWSPATH_ADMIN . 'social' . DS . 'class.social.php')) {
            if (class_exists('jNews_Social')) {
                $query[] = "ALTER TABLE `#__jnews_lists` ADD `siteend` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0'";
            }
        }
        $query[] = "ALTER TABLE `#__jnews_lists` CHANGE `acc_id` `acc_id` VARCHAR( 200 ) NOT NULL DEFAULT 'all'";
        $query[] = "ALTER TABLE `#__jnews_lists` CHANGE `acc_level` `acc_level` VARCHAR( 200 ) NOT NULL DEFAULT '24,25,7,8'";
        $query[] = "UPDATE `#__jnews_lists` SET `acc_id`= 'all' WHERE `acc_id`= 29";
        $query[] = "UPDATE `#__jnews_lists` SET `acc_level`='24,25,7,8' WHERE `acc_level`=25";
        $xf->insert('use_tags', '1', 0);
        $xf->insert('allow_sn', '0', 0);
        $xf->insert('show_sub_email', '0', 0);
        $xf->insert('red_subscription', '0', 0);
        $xf->insert('module_message', '0', 0);
        $xf->update('upload_url', '/components/com_jnews/upload');
    }
    if (empty($err) && !empty($version) && $version <= '4.2.2') {
        //alter the table template with the column availabiltity
        if (is_array($templateFields) && array_key_exists('availability', $templateFields) == false) {
            $query[] = "ALTER TABLE `#__jnews_templates` ADD `availability` TINYINT( 1 ) NOT NULL DEFAULT '1' ";
        }
        $xf->insert('captcha_width', '80', 0);
        $xf->insert('captcha_height', '25', 0);
    }
    if (empty($err) and !empty($version) and $version < '5.1.0') {
        //alter the table queue, we also add the type in the unique key
        $query[] = 'ALTER TABLE `#__jnews_queue` DROP INDEX `sub_mail` ,
					ADD UNIQUE `sub_mail` ( `subscriber_id` , `mailing_id` , `type` )';
        $xf->insert('forced_html', '1', 0);
    }
    if (empty($err) and !empty($version) and $version >= '1.2.0' and $version < '2.2.2') {
        $query[] = 'ALTER TABLE `#__jnews_lists` ADD `notifyadminmsg` text NOT NULL';
        $xf->insert('j_cron', '1', 0);
    }
    if (empty($err) and !empty($version) and $version < '4.0.2') {
        //delete the params column
        $q = "SHOW FIELDS FROM `#__jnews_queue`";
        $database->setQuery($q);
        $queueFields = $database->loadObjectList('Field');
        $q = "SHOW FIELDS FROM `#__jnews_lists`";
        $database->setQuery($q);
        $listFields = $database->loadObjectList('Field');
        if (version_compare(JVERSION, '1.6.0', '<')) {
            //j15
            //for the update in the jos_components table for the menu auto-responder
            $query[] = 'UPDATE `#__components`' . ' SET admin_menu_link = \'option=' . JNEWS_OPTION . '&act=arlist&listype=2\'' . ' WHERE `option`=\'com_jnews\'' . ' AND `name`=\'Auto-responders\'';
            //delete the name import in the _components table
            $query[] = 'DELETE FROM `#__components` WHERE `name`=\'Import\' AND `option`=\'com_jnews\'';
        }
        //update max_attempts to 5
        $query[] = 'UPDATE `#__jnews_xonfig` SET `text` = 5 WHERE `akey`=\'max_attempts\'';
        //update sched_prior to 5
        $query[] = 'UPDATE `#__jnews_xonfig` SET `text` = 5 WHERE `akey`=\'sched_prior\'';
        //update ar_prior
        $query[] = 'UPDATE `#__jnews_xonfig` SET `text` = 1 WHERE `akey`=\'ar_prior\'';
        //update sm_prior
        $query[] = 'UPDATE `#__jnews_xonfig` SET `text` = 5 WHERE `akey`=\'sm_prior\'';
        $xf->insert('priord_list', '0', 0);
        $xf->insert('priord_subs', '0', 0);
        $xf->insert('show_unsubscribe', '0', 0);
        $xf->insert('show_unsubscribelink', '1', 0);
        $xf->insert('show_subscriptionlink', '1', 0);
        $xf->insert('queue_status', '1', 0);
    }
    if (empty($err) and !empty($version) and $version <= '4.1.2') {
        $xf->insert('smtp_port', '25', 0);
        $xf->insert('smart_queue', '0', 0);
        $xf->insert('sub_info_fields', '0', 0);
        $xf->insert('enable_jsub', '0', 0);
    }
    if (!empty($version) && $version <= '7.2.2') {
        //add params column if not exists
        $q = "SHOW FIELDS FROM `#__jnews_mailings`";
        $database->setQuery($q);
        $queueFields = $database->loadObjectList('Field');
        //we drop the column params in the table jnews_queue
        if (!array_key_exists('params', $queueFields)) {
            $query[] = 'ALTER TABLE `#__jnews_mailings` ADD `params` TEXT NOT NULL';
        }
        $q = "SHOW FIELDS FROM `#__jnews_lists`";
        $database->setQuery($q);
        $queueFields = $database->loadObjectList('Field');
        //we drop the column params in the table jnews_queue
        if (!array_key_exists('params', $queueFields)) {
            $query[] = 'ALTER TABLE `#__jnews_lists` ADD `params` TEXT NOT NULL';
        }
        $xf->insert('smtp_secure', '', 0);
    }
    if (!empty($version) && $version <= '7.3.9') {
        $xf->insert('lasttime_cron_triggerred', '0', 0);
        $xf->insert('show_unsubscribe_all', '1', 0);
        $xf->insert('send_log_email', '0', 0);
        $query[] = 'ALTER TABLE `#__jnews_queue` ADD `block` TINYINT NOT NULL DEFAULT 0';
        //add block column in the queue table
        //we get the values of red_subscription, module_message, enable_captcha, captcha_width, captcha_height, show_terms, check_terms, terms_condition from config table to be able to insert it the module params
        $red_subscription = $xf->getKeyValues("red_subscripition");
        $module_message = $xf->getKeyValues("module_message");
        $enable_captcha = $xf->getKeyValues("enable_captcha");
        $captcha_width = $xf->getKeyValues("captcha_width");
        $captcha_height = $xf->getKeyValues("captcha_height");
        $show_terms = $xf->getKeyValues("show_terms");
        $check_terms = $xf->getKeyValues("check_terms");
        $terms_condition = $xf->getKeyValues("terms_condition");
        $additionalParams = '';
        $additionalParams .= "use_new=0" . "\n";
        $additionalParams .= "red_subscripition=" . $red_subscription . "\n";
        $additionalParams .= "module_message=" . $module_message . "\n";
        $additionalParams .= "enable_captcha=" . $enable_captcha . "\n";
        $additionalParams .= "captcha_width=" . $captcha_width . "\n";
        $additionalParams .= "captcha_height=" . $captcha_height . "\n";
        $additionalParams .= "show_terms=" . $show_terms . "\n";
        $additionalParams .= "check_terms=" . $check_terms . "\n";
        $additionalParams .= "terms_condition=" . $terms_condition . "\n";
        //we get the module params from the modules table and append with the values we get from above
        $db = JFactory::getDBO();
        $queryParam = "SELECT `id`,`params` FROM `#__modules` WHERE `module`='mod_jnews'";
        $db->setQuery($queryParam);
        $db->query();
        $jnewsModuleParamsO = $db->loadObjectList('id');
        if (!empty($jnewsModuleParamsO)) {
            foreach ($jnewsModuleParamsO as $key => $value) {
                $params = '';
                $params .= $value->params;
                $params .= $additionalParams;
                //we update the params of the module
                $queryUpdateParam = "UPDATE `#__modules` SET `params`='" . $params . "' WHERE `id`=" . $key;
                $db->setQuery($queryUpdateParam);
                $db->query();
            }
        }
        //we insert here the simplicity template
        $templatessql = 'simplicitytemplate.sql';
        //to be changed if we packaged the superpack
        $buffer = file_get_contents(JNEWSPATH_ADMIN . DS . $templatessql);
        // Graceful exit and rollback if read not successful
        if ($buffer) {
            // Create an array of queries from the sql file
            jimport('joomla.installer.helper');
            $queries = JInstallerHelper::splitSql($buffer);
            // No queries to process
            if (count($queries) != 0) {
                // Process each query in the $queries array (split out of sql file).
                foreach ($queries as $simplicityquery) {
                    $simplicityquery = trim($simplicityquery);
                    if ($simplicityquery != '' && $simplicityquery[0] != '#') {
                        $database->setQuery($simplicityquery);
                        if (!$database->query()) {
                            JError::raiseWarning(1, 'JInstaller::install: ' . JText::_('SQL Error') . " " . $database->stderr(true));
                        }
                    }
                }
                //endfoearch
            }
        }
    }
    if (!empty($version) && $version <= '7.4.5') {
        if (version_compare(JVERSION, '1.6.0', '>=')) {
            //j16
            $query[] = 'UPDATE `#__assets` SET `rules`=\'{"core.admin":{"1":1},"core.manage":{"1":1}}\' WHERE `name`=\'com_jnews\'';
        }
    }
    // ALTER TABLE `jos_jnews_mailings` CHANGE `cat_id` `cat_id` VARCHAR( 250 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0:0'
    if (empty($version) || $version < '7.5.0') {
        $xf->update('show_unsubscribelink', '1');
        $xf->update('show_subscriptionlink', '1');
        $xf->update('upload_url', '/media/com_jnews/upload');
        $q = "SHOW FIELDS FROM `#__jnews_mailings`";
        $database->setQuery($q);
        $queueFields = $database->loadObjectList('Field');
        if (!array_key_exists('smart_date', $queueFields)) {
            $query[] = 'ALTER TABLE `#__jnews_mailings` ADD `smart_date` TINYINT UNSIGNED NOT NULL DEFAULT 0';
        }
        $q = "SHOW FIELDS FROM `#__jnews_queue`";
        $database->setQuery($q);
        $queueFields = $database->loadObjectList('Field');
        if (!array_key_exists('params', $queueFields)) {
            $query[] = 'ALTER TABLE `#__jnews_queue` ADD `params` TEXT NOT NULL';
        }
        if (!array_key_exists('block', $queueFields)) {
            $query[] = 'ALTER TABLE `#__jnews_queue` ADD `block` TINYINT NOT NULL DEFAULT 0';
        }
    }
    if (empty($version) || version_compare($version, '7.6.0', '<')) {
        $xf->insert('sntag_norequired', '1');
        $conf = JFactory::getConfig();
        $xf->insert('sendmail_email', $conf->get('config.mailfrom'));
        $xf->insert('subs_redirect_url', '');
        $xf->insert('subscribe_notification', '');
        $xf->insert('unsubscribe_notification', '');
        $xf->insert('component_theme', 'joobilist');
        $xf->insert('allow_fe_autoresponder', '0');
    }
    if (empty($version) || version_compare($version, '7.7.0', '<')) {
        $xf->insert('archive_link', 'standard');
    }
    //Query to quickly synchronise all your subscribers during the install!
    $query[] = "INSERT IGNORE INTO `#__jnews_subscribers` ( `user_id` , `name` , `email` , `receive_html` , `confirmed` , `blacklist` , `subscribe_date` )" . "SELECT U.id, U.name, U.email, '1', '1', U.block , UNIX_TIMESTAMP(U.registerDate) from `#__users` as U;";
    if (empty($vers)) {
        if (version_compare(JVERSION, '1.6.0', '<')) {
            //j15
            $query[] = "UPDATE #__components SET ordering = -2147483800 WHERE admin_menu_link='option=com_jnews'";
            //		}else{ //j16
            //			$query[] = "UPDATE #__extensions SET ordering = -2147483800 WHERE element='option=com_jnews'";
        }
    }
    //We publish back the module
    $query[] = "UPDATE `#__modules` SET `published`= 1 WHERE `module` LIKE '%jnews%' ";
    $size = sizeof($query);
    for ($index = 0; $index < $size; $index++) {
        $database->setQuery($query[$index]);
        $database->query();
    }
    if (@(include_once JNEWSPATH_ADMIN . 'social' . DS . 'class.social.php')) {
        if (class_exists('jNews_Social')) {
            if (!empty($version) && $version < '6.0.2') {
                $xf->insert('use_masterlists', '1', 0);
                $xf->insert('list_creatorfe', '24,25,7,8', 0);
            }
            jNews_Social::createMasterList(1);
            jNews_Social::createMasterList(2);
            jNews_Social::createMasterList(3);
            jNews_Social::createMasterList(4);
        }
    }
    //we call sql file for the additional templates
    if (is_array($templateFields) && array_key_exists('availability', $templateFields)) {
        //line to be removed code #7321011
        $templatessql = 'dwntemplates.sql';
        //to be changed if we packaged the superpack
        $buffer = file_get_contents(JNEWSPATH_ADMIN . DS . $templatessql);
        // Graceful exit and rollback if read not successful
        if ($buffer) {
            // Create an array of queries from the sql file
            jimport('joomla.installer.helper');
            $queries = JInstallerHelper::splitSql($buffer);
            // No queries to process
            if (count($queries) != 0) {
                // Process each query in the $queries array (split out of sql file).
                foreach ($queries as $query) {
                    $query = trim($query);
                    if ($query != '' && $query[0] != '#') {
                        $database->setQuery($query);
                        if (!$database->query()) {
                            JError::raiseWarning(1, 'JInstaller::install: ' . JText::_('SQL Error') . " " . $database->stderr(true));
                            //return false;
                        }
                    }
                }
                //endfoearch
            }
        }
    }
    if (empty($vers)) {
        $xf->filetoDatabase($confiX);
    }
    //create the upload directory
    jnews::createDirectory(JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'media' . DS . JNEWS_OPTION . DS . 'upload' . DS);
    //check if CSS file exist if not move it
    jimport('joomla.filesystem.folder');
    $cssLocation = JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'media' . DS . JNEWS_OPTION . DS . 'modules' . DS;
    if (!JFolder::exists($cssLocation)) {
        JFolder::copy(JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'components' . DS . JNEWS_OPTION . DS . 'modules' . DS, $cssLocation);
    }
    if (empty($vers)) {
        setupMaiOptions($confiX);
    }
    //we install the default templates
    installDefTemplate();
    //we install the extensions
    installExtensions();
    //we send a welcome message to the admin/logged in user of the site that jNews is successfully installed
    //we will only send email at fresh install
    if (empty($version)) {
        sendWelcomeEmail();
    }
    if (jnews::checkCB()) {
        installPlugin();
    }
    jNews_Subscribers::updateCBSubscribers(true, true);
    $xf->update('component', $confiX['component']);
    $xf->update('type', $confiX['type']);
    $xf->update('version', $confiX['version']);
    $xf->update('level', $confiX['level']);
    if (!($confiX['type'] == 'GPL' || $confiX['type'] == 'CORE')) {
        $message = jnews::M('noimage', _JNEWS_THANKYOU, false);
    }
    if (empty($message)) {
        $message = '';
    }
    backHTML::_header(_JNEWS_MENU_INSTALL, 'install.png', $message, '', '');
    $html = '';
    $link = 'index.php?option=' . JNEWS_OPTION . '&act=start';
    $docuLink = 'http://www.joobi.co/index.php?option=com_content&view=article&id=7871:installation-errors&catid=29:jnews&Itemid=72';
    $html .= '&nbsp;' . _JNEWS_INSTALL_ERRORN . ' <a href="' . $docuLink . '">' . _JNEWS_INSTALL_DOC . '</a>';
    // if acajoom component exist... means this would be an update
    // display an update button
    require_once JNEWSPATH_CLASS . 'class.update.php';
    if (jNews_Update::checkAcajoom()) {
        //check if acajoom data are already transferred to jnews tables
        if (!jNews_Update::checkAcaUpdate()) {
            $html .= '<div style="border: 5px groove #F0F8FF; padding: 10px; position: fixed; right: 1px; top: 150px; background-color: #F0F8FF;">';
            $html .= '<img border="0" align="right" alt="jNews Logo" src="components/' . JNEWS_OPTION . '/images/jnewsletter.png" width="25">';
            $html .= '<br><br><span style="font-size:15px;text-decoration:none;">' . _JNEWS_INSTALL_ACAUPDATEMSG . '</span></b>';
            $html .= '<a href="index.php?option=' . JNEWS_OPTION . '&amp;act=acaupdate">';
            $html .= '<div style="background-image: url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'btn_orange.png); background-repeat:no-repeat; height: 15px; width: 170px; border:none; padding:13px 40px 15px; position:relative; left:50px; top:10px;">';
            $html .= '<span style="color: #FFF; font-weight: bold; padding-right:30px; margin-top: 5px; text-decoration: none;"> ' . _JNEWS_INSTALL_ACAUPDATEBTN . ' </span>';
            $html .= '</div></a>';
            $html .= '<br><br>';
            $html .= '<b>' . _JNEWS_INSTALL_ACAUPDATENOTE . '</b>';
            $html .= '<br><br>';
            $html .= '</div>';
        }
    }
    $html .= '<div style="float:center;padding: 20px; width:470px; margin-right: 10px;"><center>' . '<a href="index.php?option=' . JNEWS_OPTION . '&amp;act=start">
				<div style="background-image: url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'btn_orange.png); background-repeat:no-repeat; height: 40px; width: 232px; border:none; padding:12px 0 15px 0;">
				<span style="color: #FFF; font-weight: bold; padding-right:30px; margin-top: 5px; text-decoration: none;">' . _JNEWS_INSTALL_CLICKSTART . '</span></div>
				</a></center></div><div style="clear:both;"></div>';
    if ($confiX['level'] > 2) {
        backHTML::about();
        echo '<center>' . $html;
        echo $return . '</center>';
    } elseif ($confiX['level'] > 1) {
        backHTML::installPRO($html, $return);
    } else {
        backHTML::installPlus($html, $return);
    }
    return $return;
}
<?php

$adir = '../';
include $adir . 'adminCode.php';
if ($_POST[sendEmail]) {
    switch ($_POST[type]) {
        case 'welcome':
            sendWelcomeEmail($_POST[id], $conn);
            break;
        default:
            $_POST[payer_email] = $_POST[email];
            sendDownloadEmail($_POST[id], $conn);
    }
}
if ($_POST[email]) {
    $email = $_POST[email];
} else {
    $email = $context[adminEmail];
}
$selP = 'select * from products order by id';
$resP = mysql_query($selP, $conn);
while ($p = mysql_fetch_assoc($resP)) {
    $select = '';
    if ($_POST[productID] == $p[id]) {
        $select = 'selected';
    }
    $prodDropDown .= '<option value="' . $p[id] . '" ' . $select . '>' . $p[itemName] . '</option>';
}
if ($_POST[productID]) {
    $id = $_POST[productID];
    $selE = 'select * from emails where productID="' . $id . '"';
Example #7
0
function register($email, $firstName, $lastName, $password, $street, $city, $country)
{
    global $db;
    if (assertUserDoesNotExists($email)) {
        $auth = uniqid();
        $work = createUser($auth, true, $firstName, $lastName, $password, $email, $street, $city, $country, false);
        if ($work) {
            sendWelcomeEmail($email, $firstName, $lastName);
            return $work;
        }
    }
    return false;
}
    $app->render('registrationForm.php');
});
/**
*
* Action to Register New User Account
*
**/
$app->post('/login/action/register/', function () use($app) {
    $email = $_POST['inputEmail'];
    $firstName = $_POST['FirstName'];
    $lastName = $_POST['LastName'];
    $clinicName = $_POST['ClinicName'];
    $clinicCity = $_POST['ClinicCity'];
    $clinicState = $_POST['ClinicState'];
    $password = randomPassword();
    //$passwordHash = password_hash($password, PASSWORD_DEFAULT);
    $passwordHash = password_hash('welcome1', PASSWORD_DEFAULT);
    $tempDB = new \PDO("sqlsrv:server=" . \OnlineOrders\Config::get('dbConfig')['db_host'] . ";database=" . \OnlineOrders\Config::get('dbConfig')['db_name'], \OnlineOrders\Config::get('dbConfig')['db_user'], \OnlineOrders\Config::get('dbConfig')['db_password']);
    $stmt1 = $tempDB->prepare("SELECT COUNT(*) FROM AT_WebUsers WHERE UserID = :email AND Inactive = 0");
    $stmt1->execute(array('email' => $email));
    if ($stmt1->fetchColumn() == 1) {
        $app->view->setData(array('pageTitle' => 'New Account Registration', 'bodyClass' => 'account', 'referrer' => 'userExists'));
        $app->render('registrationForm.php');
    } else {
        $stmt2 = $tempDB->prepare("INSERT INTO AT_WebUsers (UserID, FName, LName, Pword, UserRole) VALUES ( :email, :fname, :lname, :password, 0)");
        $stmt2->execute(array('email' => $email, 'password' => $passwordHash, 'fname' => $firstName, 'lname' => $lastName));
        sendWelcomeEmail($password, $email);
        $app->view->setData(array('pageTitle' => 'Advanced Tissue Login', 'bodyClass' => 'account', 'referrer' => 'newRegistration', 'persistentEmail' => $email));
        $app->render('loginForm.php');
    }
});