Example #1
0
 function old__construct($section = 'profile')
 {
     global $path_site;
     global $meta_desc;
     global $meta_addtl;
     global $meta_keywords;
     global $title;
     global $_REQUEST;
     global $states;
     global $ccExpMM;
     global $ccExpYY;
     global $cl;
     global $profnav;
     @($method = $_REQUEST['method']);
     @($action = $_REQUEST['action']);
     @($call = $_REQUEST['call']);
     // a call is an ajax call.
     // SETUP PAGE OUTPUT VARIABLES START \\
     $returnmsg = NULL;
     $disabled = NULL;
     $returnmsg_addAddr = NULL;
     $contentOutput = NULL;
     // PROFILE HOME \\
     if ($section == 'profile') {
         // PROF LEFT NAV ACTIVE START \\
         $profnav['acctinfo'] = 'active';
         // PROF LEFT NAV ACTIVE END \\
         if (!isset($_SESSION['user']['id'])) {
             redirect($path_site . 'profile/login.php');
         }
         // INIT OBJECTS \\
         $returnmsg_prof = NULL;
         if (isset($_REQUEST['submitupdate'])) {
             // check for errors
             if ($errors = $this->checkProfile($_REQUEST)) {
                 $returnmsg_prof = replace_output(ERROR_PROFILE2, array('errors' => $errors));
             } else {
                 // no errors, Login user and start session.
                 if ($this->submitUser($_REQUEST, 'profile')) {
                     // move user back to last
                     $returnmsg_prof = CONF_MSG_1;
                     unset($_REQUEST);
                 } else {
                     $returnmsg_prof = ERROR_MSG_CONTACT2;
                 }
             }
         }
         // Get Profile Information
         $info = get_profile($_SESSION['user']['id']);
         // check if newsletter is selected.
         @($info['agreeNewsletter'] == 1) ? $data_nl = ' checked="checked"' : ($data_nl = NULL);
         $txtStates = NULL;
         $addStates = NULL;
         foreach ($states as $key => $value) {
             $sel = NULL;
             $selAdd = NULL;
             if (stripslashes($info['state']) == $key) {
                 $sel = ' selected="selected"';
             }
             if (@$_REQUEST['addState'] == $key) {
                 $selAdd = ' selected="selected"';
             }
             $txtStates .= '<option value="' . $key . '"' . $sel . '>' . $value . '</option>';
             $addStates .= '<option value="' . $key . '"' . $selAdd . '>' . $value . '</option>';
         }
         // CALL CONTENT AND REPLACE TAGS INSIDE
         $content = $path_site . 'inc/cb/acctProfile.inc';
         $returnOutput = new main_output($content);
         // replace tags from template
         @$returnOutput->replace_tags(array('path_site' => $path_site, 'return_msg' => $returnmsg_prof, 'data_un' => stripslashes($info['username']), 'data_em' => stripslashes($info['email']), 'data_fn' => stripslashes($info['firstName']), 'data_mi' => stripslashes($info['mi']), 'data_ln' => stripslashes($info['lastName']), 'data_addr1' => stripslashes($info['addr1']), 'data_addr2' => stripslashes($info['addr2']), 'data_city' => stripslashes($info['city']), 'states' => $txtStates, 'data_zc1' => substr(stripslashes($info['zip']), 0, 5), 'data_zc2' => substr(stripslashes($info['zip']), 5, 4), 'data_phone1' => substr(stripslashes($info['mainPhone']), 0, 3), 'data_phone2' => substr(stripslashes($info['mainPhone']), 3, 3), 'data_phone3' => substr(stripslashes($info['mainPhone']), 6, 4), 'data_phone4' => substr(stripslashes($info['altPhone']), 0, 3), 'data_phone5' => substr(stripslashes($info['altPhone']), 3, 3), 'data_phone6' => substr(stripslashes($info['altPhone']), 6, 4), 'data_nl' => $data_nl, 'site_baseurl' => SITE_BASEURL_SECURE));
         // Call the output
         $contentOutput .= $returnOutput->output;
         // GET TEMP HEADER
         $temp_notif_output = get_profile_notif();
         // CALL CONTENT AND REPLACE TAGS INSIDE
         $content = $path_site . 'inc/tpl/profile_body.inc';
         $returnOutput = new main_output($content);
         // replace tags from template
         @$returnOutput->replace_tags(array('path_site' => SITE_BASEURL_SECURE, 'site_baseurl' => SITE_BASEURL_SECURE, 'return_msg' => $returnmsg, 'profile_nav' => $cl->compile_profileNav($profnav), 'box_four' => $temp_notif_output . replace_output(file_get_contents($path_site . 'inc/cb/box_four.inc'), array('path_site' => SITE_BASEURL_SECURE, 'header_style' => 'nav', 'list' => replace_output(HH_PM_PROF_NAV1, array('path_site' => SITE_BASEURL_SECURE)), 'content' => $contentOutput))));
         // Call the output
         $this->output .= $returnOutput->output;
     } else {
         if ($section == 'forgot') {
             // see if someone visits the registration page, but it already logged in, send them to thier profile homepage
             if (isset($_SESSION['user']['id'])) {
                 redirect($path_site . 'profile/');
             }
             // else, now check if they're registering or we're processing a registration.
             $returnmsg = NULL;
             if (isset($_REQUEST['submitforgot'])) {
                 // check for errors
                 if ($errors = $this->checkForgot($_REQUEST)) {
                     $returnmsg = replace_output(ERROR_PROFILE2, array('errors' => $errors));
                 } else {
                     // no errors, Login user and start session.
                     if ($this->submitUser($_REQUEST, 'forgot')) {
                         // move user back to last
                         $returnmsg = CONF_PROFILE_FORGOT1;
                         $meta_addtl .= replace_output(META_REDIRECT, array('path_site' => $path_site, 'secs' => '10'));
                         $disabled = ' disabled="disabled"';
                         unset($_REQUEST['email']);
                     } else {
                         $returnmsg = ERROR_PROFILE_FORGOT1;
                     }
                 }
             }
             // landing page for forgot
             // CALL CONTENT AND REPLACE TAGS INSIDE
             $content = $path_site . 'inc/cb/acctForgot.inc';
             $returnOutput = new main_output($content);
             // replace tags from template
             @$returnOutput->replace_tags(array('path_site' => $path_site, 'disabled' => $disabled, 'return_msg' => $returnmsg, 'data_em' => $_REQUEST['user_email']));
             // Call the output
             $this->output = $returnOutput->output;
         } else {
             if ($section == 'login') {
                 // SETUP PAGE OUTPUT VARIABLES START
                 # the response from reCAPTCHA
                 $resp = null;
                 # the error code from reCAPTCHA, if any
                 $error = null;
                 // see if someone visits the registration page, but it already logged in, send them to thier profile homepage
                 if (isset($_SESSION['user']['id'])) {
                     redirect($path_site . 'profile/');
                 }
                 // else, now check if they're registering or we're processing a registration.
                 $returnmsg = null;
                 if (isset($_REQUEST['submit_login'])) {
                     // check for errors
                     if ($errors = $this->checkLogin($_REQUEST)) {
                         $returnmsg = replace_output(ERROR_PROFILE1, array('errors' => $errors));
                     } else {
                         // no errors, Login user and start session.
                         if ($this->submitUser($_REQUEST, 'login')) {
                             // move user back to last
                             // print $last;
                             if (isset($_SESSION['last'])) {
                                 redirect($_SESSION['last']);
                             } else {
                                 redirect(SITE_BASEURL);
                             }
                             unset($_REQUEST, $_SESSION['last']);
                             exit;
                         } else {
                             $returnmsg = ERROR_EMAIL_VERIFICATION;
                         }
                     }
                 }
                 // CALL CONTENT AND REPLACE TAGS INSIDE
                 $content = $path_site . 'inc/cb/acctLogin.inc';
                 $returnOutput = new main_output($content);
                 // replace tags from template
                 @$returnOutput->replace_tags(array('path_site' => $path_site, 'return_msg' => $returnmsg, 'site_title' => SITE_TITLE, 'captcha' => recaptcha_get_html(CX_CAPTCHA_PUBLIC_KEY, $error, TRUE), 'data_un' => $_REQUEST['username']));
                 // Call the output
                 $contentOutput .= $returnOutput->output;
                 // CALL CONTENT AND REPLACE TAGS INSIDE
                 $content = $path_site . 'inc/cb/box_four.inc';
                 $returnOutput = new main_output($content);
                 // replace tags from template
                 @$returnOutput->replace_tags(array('path_site' => SITE_BASEURL_SECURE, 'site_baseurl' => SITE_BASEURL_SECURE, 'return_msg' => $returnmsg, 'header_style' => 'banner', 'list' => replace_output(HH_PM_DHDR_LOGIN_NAV1, array('path_site' => SITE_BASEURL_SECURE)), 'content' => $contentOutput));
                 // Call the output
                 $this->output .= $returnOutput->output;
                 // CALL CONTENT AND REPLACE TAGS INSIDE
                 $content = $path_site . 'inc/cb/acctLogin_tip.inc';
                 $returnOutput = new main_output($content);
                 // replace tags from template
                 @$returnOutput->replace_tags(array('path_site' => SITE_BASEURL_SECURE));
                 // Call the output
                 $this->output2 .= $returnOutput->output;
             } else {
                 if ($section == 'logout') {
                     session_destroy();
                     redirect(SITE_BASEURL);
                 } else {
                     if ($section == 'register') {
                         // VERIFICATION
                         if (isset($_REQUEST['verify'])) {
                             if ($this->submitUser($_REQUEST, 'verify')) {
                                 redirect(SITE_BASEURL_SECURE . 'profile/');
                             } else {
                                 redirect(SITE_BASEURL_);
                             }
                         }
                         //CONFIRM
                         if ($action == 'confirm') {
                             if ($_SESSION['registration']['complete'] && $_SESSION['registration']['type'] == 'regular') {
                                 // CALL CONTENT AND REPLACE TAGS INSIDE
                                 $content = $path_site . 'inc/cb/acctRegister_confirm.inc';
                                 $returnOutput = new main_output($content);
                                 // replace tags from template
                                 @$returnOutput->replace_tags(array('path_site' => SITE_BASEURL_SECURE, 'returnmsg' => $returnmsg));
                                 // Call the output
                                 $contentOutput .= $returnOutput->output;
                                 unset($_SESSION['registration']);
                             } else {
                                 redirect(SITE_BASEURL_SECURE . 'profile/');
                             }
                         } else {
                             // see if someone visits the registration page, but it already logged in, send them to thier profile homepage
                             if (isset($_SESSION['user']['id'])) {
                                 redirect($path_site . 'profile/');
                             }
                             // SETUP PAGE OUTPUT VARIABLES START
                             # the response from reCAPTCHA
                             $resp = null;
                             # the error code from reCAPTCHA, if any
                             $error = null;
                             isset($_REQUEST['agree']) && $_REQUEST['agree'] == '1' ? $data_ag = ' checked="checked"' : ($data_ag = null);
                             // (isset($_REQUEST['newsletter']) and $_REQUEST['newsletter'] == '1')? $data_nl=' checked="checked"' : $data_nl=NULL ;
                             // SETUP PAGE OUTPUT VARIABLES END
                             // Check if they're registering or we're processing a registration.
                             if (isset($_REQUEST['submit'])) {
                                 // check for errors
                                 $errors = $this->checkReg($_REQUEST);
                                 if ($errors) {
                                     $returnmsg = replace_output(ERROR_PROFILE1, array('errors' => $errors));
                                 } else {
                                     // no errors, add user to database, and start session.
                                     if ($this->submitUser($_REQUEST, 'reg')) {
                                         $_SESSION['registration']['complete'] = TRUE;
                                         $_SESSION['registration']['type'] = 'regular';
                                         unset($_REQUEST);
                                         redirect(SITE_BASEURL_SECURE . 'profile/register.php?action=confirm');
                                         exit;
                                     } else {
                                         $returnmsg = ERROR_MSG_CRITICAL1;
                                     }
                                 }
                             }
                             // CALL CONTENT AND REPLACE TAGS INSIDE
                             $content = $path_site . 'inc/cb/acctRegister.inc';
                             $returnOutput = new main_output($content);
                             // replace tags from template
                             @$returnOutput->replace_tags(array('path_site' => $path_site, 'return_msg' => $returnmsg, 'data_un' => $_REQUEST['user_name'], 'data_em' => $_REQUEST['user_email'], 'data_fn' => $_REQUEST['user_fname'], 'data_ln' => $_REQUEST['user_lname'], 'data_ag' => $data_ag, 'site_title' => SITE_TITLE, 'captcha' => recaptcha_get_html(CX_CAPTCHA_PUBLIC_KEY, $error, TRUE), 'disabled' => $disabled));
                             // Call the output
                             $contentOutput .= $returnOutput->output;
                         }
                         // CALL CONTENT AND REPLACE TAGS INSIDE
                         $content = $path_site . 'inc/cb/box_four.inc';
                         $returnOutput = new main_output($content);
                         // replace tags from template
                         @$returnOutput->replace_tags(array('path_site' => SITE_BASEURL_SECURE, 'site_baseurl' => SITE_BASEURL_SECURE, 'return_msg' => $returnmsg, 'header_style' => 'banner', 'list' => replace_output(HH_PM_DHDR_REG_NAV1, array('path_site' => SITE_BASEURL_SECURE)), 'content' => $contentOutput));
                         // Call the output
                         $this->output .= $returnOutput->output;
                         // CALL CONTENT AND REPLACE TAGS INSIDE
                         $content = $path_site . 'inc/cb/acctRegister_tip.inc';
                         $returnOutput = new main_output($content);
                         // replace tags from template
                         @$returnOutput->replace_tags(array('path_site' => SITE_BASEURL_SECURE));
                         // Call the output
                         $this->output2 .= $returnOutput->output;
                     } else {
                         if ($section == 'pubProf') {
                             // PROF LEFT NAV ACTIVE START \\
                             $profnav['pubprof'] = 'active';
                             // PROF LEFT NAV ACTIVE END \\
                             if (!isset($_SESSION['user']['id'])) {
                                 redirect($path_site . 'profile/login.php');
                             }
                             // INIT OBJECTS \\
                             $returnmsg_pp = NULL;
                             if (isset($_REQUEST['submitupdate'])) {
                                 // check for errors
                                 if ($errors = $this->check('pubProf')) {
                                     $returnmsg_pp = replace_output(ERROR_PROFILE2, array('errors' => $errors));
                                 } else {
                                     // no errors
                                     if ($this->submit('pubProf')) {
                                         $returnmsg_pp = CONF_MSG_1;
                                         unset($_REQUEST);
                                     } else {
                                         $returnmsg_pp = ERROR_MSG_CONTACT2;
                                     }
                                 }
                             }
                             // Get Profile Information
                             $info = get_public_profile($_SESSION['user']['id']);
                             $image = get_public_profile_image($info['id']);
                             $c = get_colors();
                             $colors = NULL;
                             foreach ($c as $k => $v) {
                                 if ($k == '5') {
                                     $colors .= '</div><div class="left" style="width: 70px;">';
                                 }
                                 $sel = NULL;
                                 if ($info['colorid'] == $k) {
                                     $sel = ' checked="checked"';
                                 }
                                 $colors .= replace_output(HH_PM_PUBPROF_COLOR, array('check' => $sel, 'id' => $k, 'class' => $v));
                             }
                             // CALL CONTENT AND REPLACE TAGS INSIDE
                             $content = $path_site . 'inc/cb/acctPublic_profile.inc';
                             $returnOutput = new main_output($content);
                             // replace tags from template
                             @$returnOutput->replace_tags(array('path_site' => SITE_BASEURL_SECURE, 'return_msg' => $returnmsg_pp, 'data_img' => SITE_BASEURL_SECURE . $image, 'data_blogurl' => stripslashes($info['urlBlog']), 'data_fburl' => stripslashes($info['urlFb']), 'data_liurl' => stripslashes($info['urlLi']), 'data_twtrurl' => stripslashes($info['urlTwtr']), 'data_yturl' => stripslashes($info['urlYt']), 'data_stmnt' => stripslashes($info['statement']), 'data_name' => stripslashes($info['name']), 'data_title' => stripslashes($info['title']), 'data_colors' => $colors));
                             // Call the output
                             $contentOutput .= $returnOutput->output;
                             // CALL CONTENT AND REPLACE TAGS INSIDE
                             $content = $path_site . 'inc/tpl/profile_body.inc';
                             $returnOutput = new main_output($content);
                             // replace tags from template
                             @$returnOutput->replace_tags(array('path_site' => SITE_BASEURL_SECURE, 'site_baseurl' => SITE_BASEURL_SECURE, 'return_msg' => $returnmsg, 'profile_nav' => $cl->compile_profileNav($profnav), 'box_four' => get_profile_notif() . replace_output(file_get_contents($path_site . 'inc/cb/box_four.inc'), array('path_site' => SITE_BASEURL_SECURE, 'header_style' => 'nav', 'list' => replace_output(HH_PM_DHDR_PUBPROF_NAV, array('path_site' => SITE_BASEURL_SECURE)), 'content' => $contentOutput))));
                             // Call the output
                             $this->output .= $returnOutput->output;
                         }
                     }
                 }
             }
         }
     }
 }
Example #2
0
<?php

if (empty($content)) {
    $content = '';
}
$placeholder = _('Type your message here');
if (empty($form_class)) {
    $form_class = "user_{$grid->user->id}";
}
?>
<article id="post-form" class="<?php 
echo $form_class;
?>
" data-colors="<?php 
echo get_colors();
?>
">
  <input type="hidden" id="attachment" name="attachment">
  <div class="container">
    <div id="post-preview"></div>
    <textarea name="content" rows="1" cols="40" class="content" placeholder="<?php 
echo $placeholder;
?>
"><?php 
echo esc($content);
?>
</textarea>
  </div>
  <div class="author">
    <a href="<?php 
echo "u/{$_SESSION['user_id']}";
Example #3
0
function color2hex($color)
{
    $colors = get_colors();
    return isset($colors[$color]) ? $colors[$color] : $color;
}
Example #4
0
</em></p>
  <?php 
} else {
    ?>
    <ul>
      <?php 
    foreach ($posts as $post) {
        ?>
        <li id="post_<?php 
        echo $post->id;
        ?>
" class="file user_<?php 
        echo $post->user_id;
        ?>
" data-colors="<?php 
        echo get_colors($post->user_id);
        ?>
">
          <span class="meta"><?php 
        echo elapsed_time($post->created);
        ?>
</span><br>
          <a href="<?php 
        echo "p/{$post->id}";
        ?>
" class="filename"><?php 
        echo $post->content;
        ?>
</a>
          <a href="<?php 
        echo "p/{$post->id}/edit";
Example #5
0
    ?>
    <ul>
      <?php 
    foreach ($files as $file) {
        ?>
        <?php 
        $topic = $topics[$file->message_id];
        ?>
        <li id="file_<?php 
        echo $file->id;
        ?>
" class="file user_<?php 
        echo $file->user_id;
        ?>
" data-colors="<?php 
        echo get_colors($file->user_id);
        ?>
">
          <a href="<?php 
        echo "p/{$file->message_id}";
        ?>
" class="filename"><?php 
        echo $file->name;
        ?>
</a>
          <div class="meta">
            <span class="author"><a href="u/<?php 
        echo $file->user_id;
        ?>
" class="id"><span class="color"></span><?php 
        echo get_username($file->user_id);
				<td><?php 
        echo $row['product_blouse'];
        ?>
</td>
				<td><?php 
        echo $row['product_stock_availability'];
        ?>
</td>
				<td><?php 
        //echo $row['product_color_availability'];
        //$colors=explode(", ",$row['product_color_availability']);
        //echo count($colors);
        $colors = explode(", ", $row['product_color_availability']);
        $count_colors = count($colors);
        for ($i = 0; $i < $count_colors; $i++) {
            echo get_colors($colors[$i]) . "</br>";
        }
        ?>
</td>
				<td><?php 
        echo get_work_types($row['product_work_type']);
        ?>
</td>
				<td><?php 
        //echo $row['product_print_type'];
        $print_types = explode(", ", $row['product_print_type']);
        $count_print = count($print_types);
        for ($j = 0; $j < $count_print; $j++) {
            echo get_print_types($print_types[$j]) . "</br>";
        }
        ?>
Example #7
0
function get_css()
{
    $colors = get_colors();
    //получаем набор цветов
    $min_border_thing = 0;
    $max_border_thing = 6;
    $min_font_size = 9;
    //pt
    $max_font_size = 14;
    //pt
    $min_but_font_size = 18;
    //pt
    $max_but_font_size = 24;
    //pt
    $min_h1_font_size = 14;
    //pt
    $max_h1_font_size = 22;
    //pt
    $font_familys = array('Verdana', 'Geneva', 'Arial', 'Helvetica', 'sans-serif', 'Tahoma', '"Comic Sans MS"', '"Century Gothic"', '"Courier New"', 'Garamond');
    $border_styles = array('solid', 'ridge', 'none');
    $text_decorations = array('underline', 'none');
    //Body
    $body_bg_color = $colors['body_bg_color'];
    $body_text_color = $colors['body_text_color'];
    $body_font_size = Ceil(mt_rand($min_font_size, $max_font_size));
    $font_family = $font_familys[array_rand($font_familys)];
    //links .a
    $a_link_color = $colors['a_link_color'];
    $a_visited_color = $colors['a_visited_color'];
    $a_active_color = $colors['a_active_color'];
    $a_hover_color = $colors['a_hover_color'];
    $a_text_decoration = $text_decorations[array_rand($text_decorations)];
    //header
    $h_bg_color = $colors['h_bg_color'];
    $h_border_color = $colors['h_border_color'];
    $h_border_thing = Ceil(mt_rand($min_border_thing, $max_border_thing));
    $h_border_style = $border_styles[array_rand($border_styles)];
    $h_text_color = $colors['h_text_color'];
    $h_font_size = Ceil(mt_rand($min_h1_font_size, $max_h1_font_size));
    //baner .b
    $b_bg_color = $colors['b_bg_color'];
    $b_border_color = $colors['b_border_color'];
    $b_border_thing = Ceil(mt_rand($min_border_thing, $max_border_thing));
    $b_border_style = $border_styles[array_rand($border_styles)];
    $b_text_color = $colors['b_text_color'];
    //text .t
    $t_bg_color = $colors['t_bg_color'];
    $t_border_color = $colors['t_border_color'];
    $t_border_thing = Ceil(mt_rand($min_border_thing, $max_border_thing));
    $t_border_style = $border_styles[array_rand($border_styles)];
    $t_text_color = $colors['t_text_color'];
    //map .m
    $m_bg_color = $colors['m_bg_color'];
    $m_border_color = $colors['m_border_color'];
    $m_border_thing = $t_border_thing;
    $m_border_style = $t_border_style;
    $m_text_color = $colors['m_text_color'];
    //footer .t
    $f_bg_color = $colors['f_bg_color'];
    $f_border_color = $colors['f_border_color'];
    $f_border_thing = Ceil(mt_rand($min_border_thing, $max_border_thing));
    $f_border_style = $border_styles[array_rand($border_styles)];
    $f_text_color = $colors['f_text_color'];
    //button .but
    $but_bg_color = $colors['body_bg_color'];
    $but_border_color = $colors['body_bg_color'];
    $but_border_thing = 0;
    $but_border_style = 'none';
    $but_text_color = $colors['body_text_color'];
    //link.button a.but
    $a_but_link_color = $colors['a_but_link_color'];
    $a_but_visited_color = $colors['a_but_visited_color'];
    $a_but_active_color = $colors['a_but_active_color'];
    $a_but_hover_color = $colors['a_but_hover_color'];
    $a_but_text_decoration = 'underline';
    $a_but_font_size = Ceil(mt_rand($min_but_font_size, $max_but_font_size));
    //считываем шаблон css
    $css_tpl = file_get_contents('data/tpl/style_tpl.css');
    $search_arr = array('[body_bg_color]', '[font_family]', '[body_font_size]', '[body_text_color]', '[a_text_decoration]', '[a_link_color]', '[a_visited_color]', '[a_hover_color]', '[a_active_color]', '[h_text_color]', '[h_font_size]', '[h_bg_color]', '[h_text_color]', '[h_border_style]', '[h_border_thing]', '[h_border_color]', '[h_font_size]', '[b_bg_color]', '[b_text_color]', '[b_border_style]', '[b_border_thing]', '[b_border_color]', '[t_bg_color]', '[t_text_color]', '[t_border_style]', '[t_border_thing]', '[t_border_color]', '[m_bg_color]', '[m_text_color]', '[m_border_style]', '[m_border_thing]', '[m_border_color]', '[f_bg_color]', '[f_text_color]', '[f_border_style]', '[f_border_thing]', '[f_border_color]', '[but_bg_color]', '[but_text_color]', '[but_border_style]', '[but_border_thing]', '[but_border_color]', '[a_but_text_decoration]', '[a_but_link_color]', '[a_but_visited_color]', '[a_but_hover_color]', '[a_but_active_color]', '[a_but_font_size]');
    $replace_arr = array($body_bg_color, $font_family, $body_font_size, $body_text_color, $a_text_decoration, $a_link_color, $a_visited_color, $a_hover_color, $a_active_color, $h_text_color, $h_font_size, $h_bg_color, $h_text_color, $h_border_style, $h_border_thing, $h_border_color, $h_font_size, $b_bg_color, $b_text_color, $b_border_style, $b_border_thing, $b_border_color, $t_bg_color, $t_text_color, $t_border_style, $t_border_thing, $t_border_color, $m_bg_color, $m_text_color, $m_border_style, $m_border_thing, $m_border_color, $f_bg_color, $f_text_color, $f_border_style, $f_border_thing, $f_border_color, $but_bg_color, $but_text_color, $but_border_style, $but_border_thing, $but_border_color, $a_but_text_decoration, $a_but_link_color, $a_but_visited_color, $a_but_hover_color, $a_but_active_color, $a_but_font_size);
    $css = str_replace($search_arr, $replace_arr, $css_tpl);
    return $css;
}
Example #8
0
    private function _display_text($var, $options, $post, $type = 'text')
    {
        $typeahead = isset($options['values']) && is_array($options['values']) && $options['values'] ? ' data-provide="typeahead" data-source="' . utf8_htmlentities('[' . trim_word(implode(', ', array_map(create_function('$a', 'return \'"\'.$a.\'"\';'), $options['values'])), ', ') . ']') . '"' : '';
        $classes = array();
        if (in_array($type, array('date', 'datetime', 'time'))) {
            $types = array('date' => 'L', 'datetime' => 'L LT', 'time' => 'LT');
            NeoFrag::loader()->css('bootstrap-datetimepicker.min')->js('bootstrap-datetimepicker/moment.min')->js('bootstrap-datetimepicker/bootstrap-datetimepicker.min')->js('bootstrap-datetimepicker/locales/' . $this->config->lang)->js_load('$(".input-group.' . $type . '").datetimepicker({allowInputToggle: true, locale: "' . $this->config->lang . '", format: "' . $types[$type] . '"});');
            $classes[] = $type;
            if (empty($options['icon'])) {
                $options['icon'] = $type == 'time' ? 'fa-clock-o' : 'fa-calendar';
            }
            $type = 'text';
        } else {
            if ($type == 'email') {
                $type = 'text';
                if (empty($options['icon'])) {
                    $options['icon'] = 'fa-envelope-o';
                }
            } else {
                if ($type == 'url') {
                    $type = 'text';
                    if (empty($options['icon'])) {
                        $options['icon'] = 'fa-globe';
                    }
                } else {
                    if ($type == 'colorpicker') {
                        $type = 'text';
                        $classes[] = 'color';
                        $options['icon'] = FALSE;
                        NeoFrag::loader()->css('bootstrap-colorpicker.min')->js('bootstrap-colorpicker.min')->js_load('$(".input-group.color").colorpicker({format: "hex", component: ".input-group-addon,input", colorSelectors: ' . json_encode(get_colors()) . '});');
                    }
                }
            }
        }
        $output = '';
        if (isset($options['icon'])) {
            $output .= '<div class="input-group' . (!empty($classes) ? ' ' . implode(' ', $classes) : '') . '">
				<span class="input-group-addon">' . ($options['icon'] ? icon($options['icon']) : '<i></i>') . '</span>';
        }
        if ($type != 'file') {
            $class = ' class="form-control"';
            $value = ' value="' . addcslashes($this->_display_value($var, $options), '"') . '"';
        }
        $input = '<input id="form_' . $this->id . '_' . $var . '" name="' . $this->id . '[' . $var . ']" type="' . $type . '"' . (!empty($value) ? $value : '') . $typeahead . (!empty($class) ? $class : '') . (($type == 'password' || $typeahead) && isset($options['autocomplete']) && $options['autocomplete'] === FALSE ? ' autocomplete="off"' : '') . (!empty($options['rules']) && in_array('disabled', $options['rules']) ? ' disabled="disabled"' : '') . ($this->_fast_mode && !empty($options['label']) && $type != 'file' ? ' placeholder="' . $this->load->lang($options['label'], NULL) . '"' : '') . ' />';
        if ($type == 'file') {
            $post = post();
            $input = '<div style="margin: 7px 0;"><p>' . icon('fa-download') . ' ' . NeoFrag::loader()->lang('upload_file') . (!empty($options['info']) ? $options['info'] : '') . '</p>' . $input . '</div>';
            if (!empty($options['value'])) {
                if (isset($post[$this->id][$var]) && $post[$this->id][$var] == 'delete') {
                    $input = '<input type="hidden" name="' . $this->id . '[' . $var . ']" value="delete" />' . $input;
                } else {
                    $input = '	<div class="row">
									<div class="col-md-3">
										<div class="thumbnail no-margin">
											<img src="' . url($this->db->select('path')->from('nf_files')->where('file_id', $options['value'])->row()) . '" alt="" />
											<div class="caption text-center">
												<a class="btn btn-outline btn-danger btn-xs form-file-delete" href="#" data-input="' . $this->id . '[' . $var . ']">' . icon('fa-trash-o') . ' ' . NeoFrag::loader()->lang('remove') . '</a>
											</div>
										</div>
									</div>
									<div class="col-md-9">
										' . $input . '
									</div>
								</div>';
                }
            }
        }
        $output .= $input;
        if (isset($options['icon'])) {
            if (in_array('color', $classes)) {
                $output .= '<span class="input-group-addon"><span class="fa fa-eyedropper"></span></span>';
            }
            $output .= '</div>';
        }
        return $output;
    }
function best_color($url)
{
    $colors = get_colors($url);
    foreach ($colors as $color => $value) {
        if ($value['s'] > $best_saturation) {
            $best_saturation = $value['s'];
            $the_best_s = $value;
        }
        if ($value['v'] > $best_brightness) {
            $best_brightness = $value['v'];
            $the_best_v = $value;
        }
    }
    // is brightest the same as most saturated?
    $the_best = $the_best_s['v'] >= $the_best_v['v'] - $the_best_v['v'] / 2 ? $the_best_s : $the_best_v;
    return $the_best['hex'];
}