Esempio n. 1
0
function client_report($cid, $bid)
{
    global $prefix, $db, $module_name, $client, $sitename;
    if (!is_client($client)) {
        Header("Location: modules.php?name={$module_name}&op=client");
        die;
    } else {
        $client = base64_decode($client);
        $client = addslashes($client);
        $client = explode(":", $client);
        $client_id = $client[0];
        if ($cid != $client_id) {
            include "header.php";
            title("{$sitename}: " . _ADSYSTEM . "");
            OpenTable();
            echo "<center>" . _FUNCTIONSNOTALLOWED . "<br><br>" . _GOBACK . "</center>";
            CloseTable();
            themenu();
            include "footer.php";
            die;
        } else {
            include "header.php";
            title("{$sitename}: " . _ADSYSTEM . "");
            OpenTable();
            $bid = intval($bid);
            $cid = intval($cid);
            $sql = "SELECT name, email FROM " . $prefix . "_banner_clients WHERE cid='{$cid}'";
            $result = $db->sql_query($sql);
            $row = $db->sql_fetchrow($result);
            $name = htmlentities($row['name']);
            $email = $row['email'];
            if ($email == "") {
                echo "<center><br><br>" . "<b>" . _STATSNOTSEND . "</b><br><br>" . "<a href=\"javascript:history.go(-1)\">" . _GOBACK . "</a>";
                CloseTable();
                themenu();
                include "footer.php";
                die;
            } else {
                $sql2 = "SELECT bid, name, imptotal, impmade, clicks, imageurl, clickurl, date, ad_class FROM " . $prefix . "_banner WHERE bid='{$bid}' AND cid='{$cid}'";
                $result2 = $db->sql_query($sql2);
                $row2 = $db->sql_fetchrow($result2);
                $bid = $row2['bid'];
                $bid = intval($bid);
                $imptotal = $row2['imptotal'];
                $imptotal = intval($imptotal);
                $impmade = $row2['impmade'];
                $impmade = intval($impmade);
                $clicks = $row2['clicks'];
                $clicks = intval($clicks);
                $imageurl = $row2['imageurl'];
                $clickurl = $row2['clickurl'];
                $date = $row2['date'];
                if ($impmade == 0) {
                    $percent = 0;
                } else {
                    $percent = substr(100 * $clicks / $impmade, 0, 5);
                }
                if ($imptotal == 0) {
                    $left = _UNLIMITED;
                    $imptotal = _UNLIMITED;
                } else {
                    $left = $imptotal - $impmade;
                }
                $fecha = date("F jS Y, h:iA.");
                $subject = "" . _YOURSTATS . " {$sitename}";
                if (empty($row2['ad_class']) || $row2['ad_class'] == "image") {
                    $message = "" . _FOLLOWINGSTATS . " {$sitename}:\n\n\n" . _CLIENTNAME . ": {$name}\n" . _BANNERID . ": {$bid}\n" . _BANNERNAME . ": " . $row['name'] . "\n" . _BANNERIMAGE . ": {$imageurl}\n" . _BANNERURL . ": {$clickurl}\n\n" . _IMPPURCHASED . ": {$imptotal}\n" . _IMPREMADE . ": {$impmade}\n" . _IMPRELEFT . ": {$left}\n" . _RECEIVEDCLICKS . ": {$clicks}\n" . _CLICKSPERCENT . ": {$percent}%\n\n\n" . _GENERATEDON . ": {$fecha}";
                } elseif ($row2['ad_class'] == "flash") {
                    $message = "" . _FOLLOWINGSTATS . " {$sitename}:\n\n\n" . _CLIENTNAME . ": {$name}\n" . _BANNERID . ": {$bid}\n" . _BANNERNAME . ": " . $row['name'] . "\n" . _FLASHMOVIE . ": {$imageurl}\n\n" . _IMPPURCHASED . ": {$imptotal}\n" . _IMPREMADE . ": {$impmade}\n" . _IMPRELEFT . ": {$left}\n" . _RECEIVEDCLICKS . ": N/A\n" . _CLICKSPERCENT . ": N/A\n\n\n" . _GENERATEDON . ": {$fecha}";
                } elseif ($row2['ad_class'] == "code") {
                    $message = "" . _FOLLOWINGSTATS . " {$sitename}:\n\n\n" . _CLIENTNAME . ": {$name}\n" . _BANNERID . ": {$bid}\n" . _BANNERNAME . ": " . $row['name'] . "\n\n" . _IMPPURCHASED . ": {$imptotal}\n" . _IMPREMADE . ": {$impmade}\n" . _IMPRELEFT . ": {$left}\n" . _RECEIVEDCLICKS . ": N/A\n" . _CLICKSPERCENT . ": N/A\n\n\n" . _GENERATEDON . ": {$fecha}";
                }
                $from = "{$sitename}";
                mail($email, $subject, $message, "From: {$from}\nX-Mailer: PHP/" . phpversion());
                echo "<center><br><br><br>" . "<b>" . _STATSSENT . " {$email}</b><br><br>" . "[ <a href=\"javascript:history.go(-1)\">" . _GOBACK . "</a> ]";
                CloseTable();
                themenu();
                include "footer.php";
            }
        }
    }
}
Esempio n. 2
0
     $session_info .= is_user_logged_in() ? 'Li.' : '';
     $session_info .= nebula_is_bot() ? 'Bt.' : '';
     echo 'clientinfo.sessionid = new Date().getTime() + ".' . $session_info . '" + Math.random().toString(36).substring(5);';
     echo 'ga("set", gaCustomDimensions["sessionID"], clientinfo.sessionid);';
 }
 //WordPress User ID
 $current_user = wp_get_current_user();
 if ($current_user && nebula_option('nebula_cd_userid')) {
     echo 'ga("set", gaCustomDimensions["userID"], "' . $current_user->ID . '");';
 }
 //Staff
 if (nebula_option('nebula_cd_staff')) {
     $skip = false;
     if (is_dev()) {
         $usertype = 'Developer';
     } elseif (is_client()) {
         $usertype = 'Client';
     } elseif (is_user_logged_in()) {
         $user_info = get_userdata(get_current_user_id());
         switch ($user_info->roles[0]) {
             case 'administrator':
                 $usertype = 'Administrator';
                 break;
             case 'editor':
                 $usertype = 'Editor';
                 break;
             case 'author':
                 $usertype = 'Author';
                 break;
             case 'contributor':
                 $usertype = 'Contributor';
Esempio n. 3
0
function nebula_sass_manual_trigger()
{
    if (nebula_option('nebula_scss', 'enabled') && (isset($_GET['sass']) || isset($_GET['scss']) || $_GET['settings-updated'] == 'true') && (is_dev() || is_client())) {
        nebula_render_scss('all');
        //Re-render all SCSS files.
        return true;
    } else {
        return false;
    }
}
Esempio n. 4
0
function nebula_render_scss($specific_scss = null, $child = false)
{
    $override = apply_filters('pre_nebula_render_scss', false, $specific_scss, $child);
    if ($override !== false) {
        return $override;
    }
    if (nebula_option('nebula_scss', 'enabled') && (isset($_GET['sass']) || isset($_GET['scss']) || $_GET['settings-updated'] == 'true') && (is_dev() || is_client())) {
        $specific_scss = 'all';
    }
    $theme_directory = get_template_directory();
    $theme_directory_uri = get_template_directory_uri();
    if ($child) {
        $theme_directory = get_stylesheet_directory();
        $theme_directory_uri = get_stylesheet_directory_uri();
    }
    $stylesheets_directory = $theme_directory . '/stylesheets';
    $stylesheets_directory_uri = $theme_directory_uri . '/stylesheets';
    require_once get_template_directory() . '/includes/libs/scssphp/scss.inc.php';
    //SCSSPHP is a compiler for SCSS 3.x
    $scss = new \Leafo\ScssPhp\Compiler();
    $scss->addImportPath($stylesheets_directory . '/scss/partials/');
    if (nebula_option('nebula_minify_css', 'enabled') && !is_debug()) {
        $scss->setFormatter('Leafo\\ScssPhp\\Formatter\\Compressed');
        //Minify CSS (while leaving "/*!" comments for WordPress).
    } else {
        $scss->setFormatter('Leafo\\ScssPhp\\Formatter\\Compact');
        //Compact, but readable, CSS lines
        if (is_debug()) {
            $scss->setLineNumberStyle(\Leafo\ScssPhp\Compiler::LINE_COMMENTS);
            //Adds line number reference comments in the rendered CSS file for debugging.
        }
    }
    if (empty($specific_scss) || $specific_scss == 'all') {
        //Partials
        $latest_partial = 0;
        foreach (glob($stylesheets_directory . '/scss/partials/*') as $partial_file) {
            if (filemtime($partial_file) > $latest_partial) {
                $latest_partial = filemtime($partial_file);
            }
        }
        //Combine Developer Stylesheets
        if (nebula_option('nebula_dev_stylesheets')) {
            nebula_combine_dev_stylesheets($stylesheets_directory, $stylesheets_directory_uri);
        }
        //Compile each SCSS file
        foreach (glob($stylesheets_directory . '/scss/*.scss') as $file) {
            //@TODO "Nebula" 0: Change to glob_r() but will need to create subdirectories if they don't exist.
            $file_path_info = pathinfo($file);
            if (is_file($file) && $file_path_info['extension'] == 'scss' && $file_path_info['filename'][0] != '_') {
                //If file exists, and has .scss extension, and doesn't begin with "_".
                $file_counter++;
                $css_filepath = $file_path_info['filename'] == 'style' ? $theme_directory . '/style.css' : $stylesheets_directory . '/css/' . $file_path_info['filename'] . '.css';
                if (!file_exists($css_filepath) || filemtime($file) > filemtime($css_filepath) || $latest_partial > filemtime($css_filepath) || is_debug() || $specific_scss == 'all') {
                    //If .css file doesn't exist, or is older than .scss file (or any partial), or is debug mode, or forced
                    ini_set('memory_limit', '512M');
                    //Increase memory limit for this script. //@TODO "Nebula" 0: Is this the best thing to do here? Other options?
                    WP_Filesystem();
                    global $wp_filesystem;
                    $existing_css_contents = file_exists($css_filepath) ? $wp_filesystem->get_contents($css_filepath) : '';
                    if (!strpos(strtolower($existing_css_contents), 'scss disabled')) {
                        //If the correlating .css file doesn't contain a comment to prevent overwriting
                        $this_scss_contents = $wp_filesystem->get_contents($file);
                        //Copy SCSS file contents
                        $compiled_css = $scss->compile($this_scss_contents);
                        //Compile the SCSS
                        $enhanced_css = nebula_scss_variables($compiled_css);
                        //Compile server-side variables into SCSS
                        $wp_filesystem->put_contents($css_filepath, $enhanced_css);
                        //Save the rendered CSS.
                    }
                }
            }
        }
        if (!$child && is_child_theme()) {
            //If not in the second (child) pass, and is a child theme.
            nebula_render_scss($specific_scss, true);
            //Re-run on child theme stylesheets
        }
    } else {
        if (file_exists($specific_scss)) {
            //If $specific_scss is a filepath
            WP_Filesystem();
            global $wp_filesystem;
            $scss_contents = $wp_filesystem->get_contents($specific_scss);
            $compiled_css = $scss->compile($scss_contents);
            //Compile the SCSS
            $enhanced_css = nebula_scss_variables($compiled_css);
            //Compile server-side variables into SCSS
            $wp_filesystem->put_contents(str_replace('.scss', '.css', $specific_scss), $enhanced_css);
            //Save the rendered CSS in the same directory.
        } else {
            //If $scss_file is raw SCSS string
            $compiled_css = $scss->compile($specific_scss);
            return nebula_scss_variables($compiled_css);
            //Return the rendered CSS
        }
    }
}
Esempio n. 5
0
 function nebula_admin_notices()
 {
     if (current_user_can('manage_options') || is_dev()) {
         //Check PHP version
         $php_version_lifecycle = nebula_php_version_support();
         if ($php_version_lifecycle['lifecycle'] == 'security') {
             echo '<div class="nebula-admin-notice notice notice-info"><p>PHP <strong>' . PHP_VERSION . '</strong> is nearing end of life. Security updates end on <strong>' . date('F j, Y', $php_version_lifecycle['security']) . '</strong>. <a href="http://php.net/supported-versions.php" target="_blank">PHP Version Support &raquo;</a></p></div>';
         } elseif ($php_version_lifecycle['lifecycle'] == 'end') {
             echo '<div class="nebula-admin-notice error"><p>PHP <strong>' . PHP_VERSION . '</strong> no longer receives security updates! End of life occurred on <strong>' . date('F j, Y', $php_version_lifecycle['end']) . '</strong>. <a href="http://php.net/supported-versions.php" target="_blank">PHP Version Support &raquo;</a></p></div>';
         }
         //Check for Google Analytics Tracking ID
         if (get_option('nebula_ga_tracking_id') == '' && $GLOBALS['ga'] == '') {
             echo '<div class="nebula-admin-notice error"><p><a href="themes.php?page=nebula_options">Google Analytics tracking ID</a> is currently not set!</p></div>';
         }
         //Check for "Discourage searching engines..." setting
         if (get_option('blog_public') == 0) {
             echo '<div class="nebula-admin-notice error"><p><a href="options-reading.php">Search Engine Visibility</a> is currently disabled!</p></div>';
         }
         //Check for "Just Another WordPress Blog" tagline
         if (strtolower(get_bloginfo('description')) == 'just another wordpress site') {
             echo '<div class="nebula-admin-notice error"><p><a href="options-general.php">Site Tagline</a> is still "Just Another WordPress Site"!</p></div>';
         }
         //Check if all SCSS files were processed manually.
         if (nebula_option('nebula_scss', 'enabled') && (isset($_GET['sass']) || isset($_GET['scss']))) {
             //SCSS notice when Nebula Options is updated is in nebula_options.php
             if (is_dev() || is_client()) {
                 echo '<div class="nebula-admin-notice notice notice-success"><p>All SCSS files have been manually processed.</p></div>';
             } else {
                 echo '<div class="nebula-admin-notice error"><p>You do not have permissions to manually process all SCSS files.</p></div>';
             }
         }
         //Check if the parent theme template is correctly referenced
         if (is_child_theme()) {
             $active_theme = wp_get_theme();
             if (!file_exists(dirname(get_stylesheet_directory()) . '/' . $active_theme->get('Template'))) {
                 echo '<div class="nebula-admin-notice error"><p>A child theme is active, but its parent theme directory <strong>' . $active_theme->get('Template') . '</strong> does not exist!<br/><em>The "Template:" setting in the <a href="' . get_stylesheet_uri() . '" target="_blank">style.css</a> file of the child theme must match the directory name (above) of the parent theme.</em></p></div>';
             }
         }
     }
 }