function rd_cta($atts, $content = null) { extract(shortcode_atts(array('style' => '', 'title' => '', 'title_color' => '', 'text_color' => '', 'bg_color' => '', 'border_color' => '', 'left_border_color' => '', 'button_text' => '', 'button_link' => '', 'button_color' => '', 'button_bg_color' => '', 'button_hover_color' => '', 'icon' => '', 'icon_color' => '', 'icon_bg_color' => '', 'icon_size' => '', 'animation' => '', 'margin_top' => '0', 'margin_bottom' => '0'), $atts)); ob_start(); $id = RandomString(20); $output = '<style>#promo_' . $id . ' {margin:' . $margin_top . 'px 0 ' . $margin_bottom . 'px 0;}</style>'; if ($style == 'rd_cta_1') { // Enqueue the CSS if (!empty($atts['icon'])) { // Don't load the CSS files to trim loading time, include the specific styles via PHP // wp_enqueue_style( '4k-icon-' . $cssFile, plugins_url( 'icons/css/' . $cssFile . '.css', __FILE__ ) ); $cssFile = substr($atts['icon'], 0, stripos($atts['icon'], '-')); wp_enqueue_style('4k-icons', RD_DIRECTORY . '/includes/4k-icons/css/icon-styles.css', null, VERSION_GAMBIT_VC_4K_ICONS); wp_enqueue_script('4k-icons', RD_DIRECTORY . '/includes/4k-icons/js/script-ck.js', array('jquery'), VERSION_GAMBIT_VC_4K_ICONS, true); } global $iconContents; include 'icon-contents.php'; // Normal styles used for everything $cssFile = substr($atts['icon'], 0, stripos($atts['icon'], '-')); $iconFile = RD_DIRECTORY . '/includes/4k-icons/icons/fonts/' . $cssFile; $iconFile = apply_filters('4k_icon_font_pack_path', $iconFile, $cssFile); // Fix ligature icons (these are icons that use more than 1 symbol e.g. mono social icons) $ligatureStyle = ''; if ($cssFile == 'mn') { $ligatureStyle = '-webkit-font-feature-settings:"liga","dlig";-moz-font-feature-settings:"liga=1, dlig=1";-moz-font-feature-settings:"liga","dlig";-ms-font-feature-settings:"liga","dlig";-o-font-feature-settings:"liga","dlig"; font-feature-settings:"liga","dlig"; text-rendering:optimizeLegibility;'; } $iconCode = ''; if (!empty($atts['icon'])) { $iconCode = $iconContents[$atts['icon']]; } $ret = "<style>\r\n @font-face {\r\n \tfont-family: '" . $cssFile . "';\r\n \tsrc:url('" . $iconFile . ".eot');\r\n \tsrc:url('" . $iconFile . ".eot?#iefix') format('embedded-opentype'),\r\n \t\turl('" . $iconFile . ".woff') format('woff'),\r\n \t\turl('" . $iconFile . ".ttf') format('truetype'),\r\n \t\turl('" . $iconFile . ".svg#oi') format('svg');\r\n \tfont-weight: normal;\r\n \tfont-style: normal;\r\n }\r\n #promo_" . $id . " ." . $atts['icon'] . ":before { font-family: '" . $cssFile . "'; font-weight: normal; font-style: normal; }\r\n #promo_" . $id . " ." . $atts['icon'] . ":before { content: \"" . $iconCode . "\"; {$ligatureStyle} }\r\n"; $ret .= "</style>"; // Compress styles a bit for readability $ret = preg_replace("/\\s?(\\{|\\})\\s?/", "\$1", preg_replace("/\\s+/", " ", str_replace("\n", "", $ret))) . "\n"; $output .= $ret; $output .= '<style>#promo_' . $id . ' {color:' . $text_color . '; background:' . $bg_color . '; border:1px solid ' . $border_color . ';}#promo_' . $id . ' .promo_title{color:' . $title_color . ';}#promo_' . $id . ' .promo_btn{color:' . $button_color . '; background:' . $button_bg_color . ';}#promo_' . $id . ' .promo_btn:hover{background:' . $button_hover_color . ';}#promo_' . $id . ' i{color:' . $icon_color . '; background:' . $icon_bg_color . '; font-size:' . $icon_size . 'px;}</style>'; $output .= '<div id="promo_' . $id . '" class="rd_promo_box ' . $style . ' ' . $animation . '">'; $output .= '<i class="' . $icon . '"></i>'; $output .= '<div class="promo_text"><h2 class="promo_title">' . $title . '</h2><p class="cta_mt">' . $content . '<p></div>'; $output .= '<a class="promo_btn" href="' . $button_link . '" target="_blank" >' . $button_text . '</a></div>'; } if ($style == 'rd_cta_2') { $output .= '<style>#promo_' . $id . ' {color:' . $text_color . '; background:' . $bg_color . '; border:1px solid ' . $border_color . ';}#promo_' . $id . ' .promo_text{border-left:10px solid ' . $left_border_color . '; }#promo_' . $id . ' .promo_title{color:' . $title_color . ';}#promo_' . $id . ' .promo_btn{color:' . $button_color . '; background:' . $button_bg_color . ';}#promo_' . $id . ' .promo_btn:hover{background:' . $button_hover_color . ';}</style>'; $output .= '<div id="promo_' . $id . '" class="rd_promo_box ' . $style . ' ' . $animation . '">'; $output .= '<div class="promo_text"><div class="promo_text_ctn"><h2 class="promo_title">' . $title . '</h2><p class="cta_mt">' . $content . '<p></div>'; $output .= '<a class="promo_btn" href="' . $button_link . '" target="_blank" >' . $button_text . '</a></div></div>'; } if ($style == 'rd_cta_3') { $output .= '<style>#promo_' . $id . ' {color:' . $text_color . '; background:' . $bg_color . ';}#promo_' . $id . ' .promo_text{border:5px solid ' . $border_color . '; }#promo_' . $id . ' .promo_title{color:' . $title_color . ';}</style>'; $output .= '<div id="promo_' . $id . '" class="rd_promo_box ' . $style . ' ' . $animation . '">'; $output .= '<div class="promo_text"><h2 class="promo_title">' . $title . '</h2><p class="cta_mt">' . $content . '<p></div>'; $output .= '</div>'; } echo !empty($output) ? $output : ''; $output_string = ob_get_contents(); ob_end_clean(); return $output_string; }
function dd($data, $name = null) { $str = RandomString(); ?> <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#<?php echo isset($name) ? $name : $str; ?> " aria-expanded="false" aria-controls="<?php echo isset($name) ? $name : $str; ?> "> <?php echo isset($name) ? $name : 'Var_Dump'; ?> </button> <div class="collapse in" id="<?php echo isset($name) ? $name : $str; ?> "> <div class="card card-block"> <?php echo "<pre>"; print_r($data); echo "</pre>"; ?> </div> </div> <?php }
public function PluginController_TimerTick_Create($Sender) { // Assume that $Sender->RequestArgs is empty. $Token = GetIncomingValue('TimerTickToken', RandomString(5)); if ($Token == C('Plugins.UsefulFunctions.TimerTick.SecretKey', RandomString(8))) { require dirname(__FILE__) . '/bin/tick.php'; } }
public function Structure() { // Get a user for operations. $UserID = Gdn::SQL()->GetWhere('User', array('Name' => 'Mollom', 'Admin' => 2))->Value('UserID'); if (!$UserID) { $UserID = Gdn::SQL()->Insert('User', array('Name' => 'Mollom', 'Password' => RandomString('20'), 'HashMethod' => 'Random', 'Email' => '*****@*****.**', 'DateInserted' => Gdn_Format::ToDateTime(), 'Admin' => '2')); } SaveToConfig('Plugins.Mollom.UserID', $UserID); }
/** * Update the configuration. * * @return void */ protected function config() { saveToConfig('Garden.Cookie.Salt', RandomString(10)); $ApplicationInfo = []; include CombinePaths([PATH_APPLICATIONS . DS . 'dashboard' . DS . 'settings' . DS . 'about.php']); // Detect Internet connection for CDNs $Disconnected = !(bool) @fsockopen('ajax.googleapis.com', 80); saveToConfig(['Garden.Version' => arrayValue('Version', val('Dashboard', $ApplicationInfo, []), 'Undefined'), 'Garden.Cdns.Disable' => $Disconnected, 'Garden.CanProcessImages' => function_exists('gd_info'), 'EnabledPlugins.HtmLawed' => 'HtmLawed']); }
function wooc_module($atts, $content = null) { extract(shortcode_atts(array('margin_top' => '0', 'margin_bottom' => '0', 'to_show' => '5', 'per_line' => '3', 'pro_type' => 'recent'), $atts)); ob_start(); $wc_rp_rs = RandomString(20); echo ' <script type="text/javascript" charset="utf-8"> var j$ = jQuery; j$.noConflict(); "use strict"; //setup up Carousel j$(window).load(function() { j$(".' . $wc_rp_rs . '.rp_sc ul").carouFredSel({ responsive: true, width: "100%", scroll: 1, prev: ".' . $wc_rp_rs . '.rp_left", next: ".' . $wc_rp_rs . '.rp_right", auto: false, items: { width: 330, height: "100%", // height: "30%", // optionally resize item-height visible: { min: 1, max: ' . $per_line . ' } } }); j$(".products").css("opacity","1"); }); </script> <div class="tf_woo_carousel"> <div class="rp_nav"> <p class="' . $wc_rp_rs . ' rp_left"></p> <p class="' . $wc_rp_rs . ' rp_right"></p> </div> <div class="' . $wc_rp_rs . ' rp_sc"> '; echo do_shortcode('[' . $pro_type . '_products per_page="' . $to_show . '" ]'); ?> </div> </div> <?php $output_string = ob_get_contents(); ob_end_clean(); return '<div class="clearfix" style="padding-top:' . $margin_top . 'px"></div>' . $output_string . '<div class="clearfix" style="padding-top:' . $margin_bottom . 'px"></div>'; }
function getNewID($rsn) { $rsnx = ""; $rs = RandomString(1, false); $rn = rand(1, 1001); $rsn = $rsn . "" . $rs . "" . $rn; if (chkDuplicateCode($rsn) == false) { $rsnx = $rsn; } else { $rsnx = getNewID($rsn); } return $rsnx; }
function double_button($atts, $content = null) { extract(shortcode_atts(array('style' => '', 'f_b_text' => '', 'f_t_color' => '', 'f_b_color' => '', 'f_t_hover_color' => '', 'f_b_hover_color' => '', 'f_url' => '#', 's_b_text' => '', 's_t_color' => '', 's_b_color' => '', 's_t_hover_color' => '', 's_b_hover_color' => '', 's_url' => '#', 'mt' => '', 'mb' => '', 'f_animation' => '', 's_animation' => ''), $atts)); $button_rand_class = RandomString(20); if ($style == 'rd_db_1' || $style == 'rd_db_2' || $style == 'rd_db_6') { $output_string = '<style>#b_' . $button_rand_class . '{margin-top:' . $mt . 'px; margin-bottom:' . $mb . 'px;}#b_' . $button_rand_class . ' .f_btn{color:' . $f_t_color . '; background: ' . $f_b_color . ';}#b_' . $button_rand_class . ' .f_btn:hover{color:' . $f_t_hover_color . ' ; background:' . $f_b_hover_color . ' ;}#b_' . $button_rand_class . ' .s_btn{color:' . $s_t_color . '; background: ' . $s_b_color . ';}#b_' . $button_rand_class . ' .s_btn:hover{color:' . $s_t_hover_color . ' ; background:' . $s_b_hover_color . ' ;}</style>'; } if ($style == 'rd_db_3' || $style == 'rd_db_5') { $output_string = '<style>#b_' . $button_rand_class . '{margin-top:' . $mt . 'px; margin-bottom:' . $mb . 'px;}#b_' . $button_rand_class . ' .f_btn{color:' . $f_t_color . '; background: ' . $f_b_color . ';}#b_' . $button_rand_class . ' .f_btn:hover{color:' . $f_t_hover_color . ' ; background:' . $f_b_hover_color . ' ;}#b_' . $button_rand_class . ' .s_btn{color:' . $s_t_color . '; background: ' . $s_b_color . '; border-color:' . $s_t_color . ';}#b_' . $button_rand_class . ' .s_btn:hover{color:' . $s_t_hover_color . ' ; background:' . $s_b_hover_color . ' ; border-color:' . $s_b_hover_color . ';}</style>'; } if ($style == 'rd_db_4') { $output_string = '<style>#b_' . $button_rand_class . '{margin-top:' . $mt . 'px; margin-bottom:' . $mb . 'px;}#b_' . $button_rand_class . ' .s_btn{color:' . $s_t_color . '; background: ' . $s_b_color . ';}#b_' . $button_rand_class . ' .s_btn:hover{color:' . $s_t_hover_color . ' ; background:' . $s_b_hover_color . ' ;}#b_' . $button_rand_class . ' .f_btn{color:' . $f_t_color . '; background: ' . $f_b_color . '; border-color:' . $f_t_color . ';}#b_' . $button_rand_class . ' .f_btn:hover{color:' . $f_t_hover_color . ' ; background:' . $f_b_hover_color . ' ; border-color:' . $f_b_hover_color . ';}</style>'; } $output_string .= '<div class="' . $style . ' clearfix" id="b_' . $button_rand_class . '" ><a class="f_btn ' . $f_animation . '" href="' . $f_url . '" target="_blank" >' . $f_b_text . '</a><a class="s_btn ' . $s_animation . '" href="' . $s_url . '" target="_blank" >' . $s_b_text . '</a></div>'; return $output_string; }
function CreateUser($username, $password, $email, $admin = false) { if (sql("SELECT * from users WHERE username=?", $username)) { return "Username already in use."; } lib("random"); $salt = RandomString(32); $password = md5($salt . $password); $access = $admin === true; $ID = sql("INSERT INTO users (username,password,salt,email,access) VALUES (?,?,?,?,?)", $username, $password, $salt, $email, $access); if (!$ID) { return "Unable to create user."; } sql("INSERT INTO profile (ID,alias) VALUES (?,?)", $ID, $username); return GenerateUserKey($ID, $admin); }
function rd_chart($atts, $content = null) { extract(shortcode_atts(array('margin_top' => '0', 'margin_bottom' => '0', 'type' => 'rd_pie_01', 'percentage' => '80', 'p_color' => '', 'p_b_color' => '', 'bar_color' => '', 'bar_alt_color' => '', 'track_color' => '', 'bg_color' => '', 'ball_color' => '', 'heading' => '', 'heading_color' => '', 'text' => '', 'text_color' => '', 'animation' => ''), $atts)); $pc_id = RandomString(20); $output = '<style>#rd_' . $pc_id . ' {margin-top:' . $margin_top . '; margin-bottom:' . $margin_bottom . ';}#rd_' . $pc_id . ' .rd_pc_status{color:' . $p_color . ';}#rd_' . $pc_id . ' .rd_pc_heading{color:' . $heading_color . ';}#rd_' . $pc_id . ' .rd_pc_text{color:' . $text_color . ';}</style>'; if ($bar_alt_color == '') { $bar_alt_color = $bar_color; } $output .= '<div class="' . $type . ' rd_pie_chart ' . $animation . '" id="rd_' . $pc_id . '"><div class="rd_count_to rd_pc_status"><span class="count_number" data-from="0" data-to="' . $percentage . '" data-speed="1000" data-refresh-interval="25">0</span><span>%</span></div>'; if ($type == 'rd_pie_01') { $output .= '<div class="rd_pc_track" style="color:' . $track_color . '"></div><div class="rd_pc_track_in"></div><canvas class="rd_pc_01" width="520" height="400" data-percentage-value="' . $percentage . '" data-bar-color="' . $bar_color . '" data-bar-alt-color="' . $bar_alt_color . '" >Your browser does not support the HTML5 canvas tag.</canvas>'; } if ($type == 'rd_pie_02') { if ($p_b_color == '') { $p_b_color = "#ecf0f1"; } if ($bg_color == '') { $bg_color = "#ffffff"; } $output .= '<canvas class="rd_pc_02" width="520" height="400" data-percentage-value="' . $percentage . '" data-percentage-color="' . $p_b_color . '" data-background-color="' . $bg_color . '" data-track-color="' . $track_color . '" data-bar-color="' . $bar_color . '" data-bar-alt-color="' . $bar_alt_color . '" >Your browser does not support the HTML5 canvas tag.</canvas>'; } if ($type == 'rd_pie_03') { if ($p_b_color == '') { $p_b_color = "#34495e"; } if ($bg_color == '') { $bg_color = "#cdd5db"; } $output .= '<canvas class="rd_pc_03" width="520" height="400" data-percentage-value="' . $percentage . '" data-percentage-color="' . $p_b_color . '" data-background-color="' . $bg_color . '" data-track-color="' . $track_color . '" data-bar-color="' . $bar_color . '" data-bar-alt-color="' . $bar_alt_color . '" >Your browser does not support the HTML5 canvas tag.</canvas>'; } if ($type == 'rd_pie_04') { $output .= '<canvas class="rd_pc_04" width="340" height="200" data-percentage-value="' . $percentage . '" data-track-color="' . $track_color . '" data-bar-color="' . $bar_color . '" data-bar-alt-color="' . $bar_alt_color . '" >Your browser does not support the HTML5 canvas tag.</canvas>'; } if ($type == 'rd_pie_05') { $output .= '<canvas class="rd_pc_05" width="520" height="400" data-percentage-value="' . $percentage . '" data-track-color="' . $track_color . '" data-bar-color="' . $bar_color . '" data-bar-alt-color="' . $bar_alt_color . '" data-ball-color="' . $ball_color . '">Your browser does not support the HTML5 canvas tag.</canvas>'; } if ($heading !== '') { $output .= '<h3 class="rd_pc_heading">' . $heading . '</h3>'; } if ($text !== '') { $output .= '<p class="rd_pc_text">' . $text . '</p>'; } $output .= '</div>'; return $output; }
public function new_shipment($key = null) { $this->load->model('SC_model'); $result = $this->SC_model->getAllCategories(); if ($key == 1) { $unset = array('shipment_key'); $this->session->unset_userdata($unset); } if ($key == null && $this->session->userdata('shipment_key') == null) { $key = RandomString(); } else { if ($this->session->userdata('shipment_key') != null) { $key = $this->session->userdata('shipment_key'); } } $this->session->set_userdata(array('shipment_key' => $key)); $result['selected_cat'] = $this->SC_model->getSelectedCategories($this->session->userdata('shipment_key')); loadView('categories', array('categories' => $result)); }
function rd_search($atts, $content) { extract(shortcode_atts(array('t_color' => '', 'bg_color' => '', 'b_color' => '', 'h_color' => '', 'placeholder' => 'Search', 'margin_top' => '0', 'margin_bottom' => '0', 'animation' => '', 'width' => '', 'radius' => '0'), $atts)); ob_start(); $id = RandomString(20); global $rd_data; if ($t_color == '') { $t_color = $rd_data['rd_content_text_color']; } if ($b_color == '') { $b_color = $rd_data['rd_content_border_color']; } if ($bg_color == '') { $bg_color = $rd_data['rd_content_bg_color']; } if ($h_color == '') { $h_color = $rd_data['rd_content_hover_color']; } if ($placeholder == '') { $placeholder = "Search"; } if ($width !== '') { echo '<style>#rd_' . $id . ' {width:' . $width . 'px;}</style>'; } echo '<style>#rd_' . $id . ' {margin-top:' . $margin_top . 'px; margin-bottom:' . $margin_bottom . 'px;}#rd_' . $id . ' #search input[type=text]{background:' . $bg_color . '; border:1px solid ' . $b_color . '; color:' . $t_color . '; border-radius:' . $radius . 'px;}#rd_' . $id . ' #search input[type=submit]{color:' . $t_color . '}#rd_' . $id . ' #search input[type=submit]:hover{color:' . $h_color . '}</style>'; echo '<div class="rd_search_sc ' . $animation . '" id="rd_' . $id . '"><div id="search">'; ?> <form method="get" action="<?php echo esc_url(home_url("")); ?> "><input type="text" name="s" placeholder="<?php echo esc_attr($placeholder); ?> " class="search" value="<?php echo the_search_query(); ?> "/><input type="submit" id="searchsubmit" value=""></form> </div></div> <?php $output_string = ob_get_contents(); ob_end_clean(); return $output_string; }
function timeline_event_ctn($atts, $content) { extract(shortcode_atts(array('bg_color' => '', 'hl_color' => '', 'alt_hl_color' => '', 'vline_color' => '', 'vline_alt_color' => '', 'h_color' => '', 't_color' => '', 'b_color' => '', 'margin_bottom' => '0', 'margin_top' => '0'), $atts)); ob_start(); $id = RandomString(20); global $rd_data; if ($bg_color == '') { $bg_color = $rd_data['rd_content_bg_color']; } if ($hl_color == '') { $hl_color = $rd_data['rd_content_hl_color']; } if ($alt_hl_color == '') { $alt_hl_color = $rd_data['rd_content_alt_hl_color']; } if ($vline_color == '') { $vline_color = $rd_data['rd_content_hl_color']; } if ($vline_alt_color == '') { $vline_alt_color = $rd_data['rd_content_alt_hl_color']; } if ($h_color == '') { $h_color = $rd_data['rd_content_heading_color']; } if ($t_color == '') { $t_color = $rd_data['rd_content_text_color']; } if ($b_color == '') { $b_color = $rd_data['rd_content_border_color']; } $output = '<style>#tle_' . $id . ' .v_line{background: ' . $vline_color . '; background: -moz-linear-gradient(top, ' . $vline_color . ' 1%, ' . $vline_alt_color . ' 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(1%,' . $vline_color . '), color-stop(100%,' . $vline_alt_color . ')); background: -webkit-linear-gradient(top, ' . $vline_color . ' 1%,' . $vline_alt_color . ' 100%); background: -o-linear-gradient(top, ' . $vline_color . ' 1%,' . $vline_alt_color . ' 100%); background: -ms-linear-gradient(top, ' . $vline_color . ' 1%,' . $vline_alt_color . ' 100%); background: linear-gradient(to bottom, ' . $vline_color . ' 1%,' . $vline_alt_color . ' 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="' . $vline_color . '", endColorstr="' . $vline_alt_color . '",GradientType=0 );}#tle_' . $id . ' .event_img{border-color:' . $b_color . ';}#tle_' . $id . ' .event_info h2{color:' . $h_color . ';}#tle_' . $id . ' .event_info p{color:' . $t_color . ';}#tle_' . $id . ' span.timeline_event_date_ctn:nth-of-type(odd) .timeline_event_date,#tle_' . $id . ' span.timeline_event_date_ctn:nth-of-type(odd) h2{background:' . $bg_color . '; color:' . $t_color . ';}#tle_' . $id . ' span.timeline_event_date_ctn:nth-of-type(even) .timeline_event_date,#tle_' . $id . ' span.timeline_event_date_ctn:nth-of-type(even) h2{background:' . $bg_color . '; color:' . $h_color . ';}#tle_' . $id . ' div.timeline_event:nth-of-type(even):after {color:' . $hl_color . ';}#tle_' . $id . ' div.timeline_event:nth-of-type(odd):before {color:' . $alt_hl_color . ';}#tle_' . $id . ' {margin-top:' . $margin_top . 'px; margin-bottom:' . $margin_bottom . 'px; }</style>'; $output .= "\n" . '<!-- Timeline Event --><div class="timeline_event_ctn clearfix" id="tle_' . $id . '"><div class="v_line"></div>' . do_shortcode($content) . '</div> <!-- Timeline Event END-->' . "\n"; echo !empty($output) ? $output : ''; $output_string = ob_get_contents(); ob_end_clean(); return $output_string; }
function user_new($user, $mail, $level) { /* * Max length of the fields in the database can't be exceeded and the level must be numeric: * - User: 20 characters * - Mail: 50 characters * The password is always a 40-characters hash (SHA1), it's automatically hashed * The mail syntax and his DNS server are checked to avoid false mails on the database * If the user or e-mail exists in the database the function returns false to avoid duplicate rows */ if (!user_level(5) || !isset($user, $mail, $level) || (!is_string($user) || empty($user) || isset($user[10])) || (!is_string($mail) || empty($mail) || isset($mail[50])) || !ereg('^[1-5]$', $level)) { echo "amsd"; return false; } else { if (!user_mail($mail)) { echo "mah"; return false; } } $pass = RandomString(); if (!@mysql_num_rows(mysql_query("SELECT `id` FROM `amsn_users` WHERE `user` = '" . mysql_real_escape_string($user) . "' LIMIT 1"))) { if (@mysql_query("INSERT INTO `amsn_users` (user, pass, email, level) VALUES ('" . mysql_real_escape_string($user) . "', '" . sha1($pass) . "', '" . mysql_real_escape_string($mail) . "', '" . (int) $level . "')")) { if (email($mail, "aMSN Web administration", "You are now a part of the aMSN webpage administration, welcome!\nYour username and password are the following:\n\n - User: {$user}\n - Password: {$pass}\n\nYou can change the password anytime you want in your control panel", "From: aMSN Admin <*****@*****.**>")) { mysql_query("DELETE FROM `amsn_users` WHERE id = '" . mysql_insert_id() . "' LIMIT 1"); echo "dude"; return false; } else { return true; } } else { echo mysql_error(); echo "insert problem"; return false; } } else { return false; } }
function rd_fq_sc($atts, $content = null) { extract(shortcode_atts(array('q_color' => '', 'a_color' => '', 'ai_color' => '', 'hl_color' => '', 'i_color' => '', 'i_b_color' => '', 'i_bg_color' => '', 'author_one' => 'First Author', 'info_one' => 'First Quote Author Info', 'quote_one' => 'This is an Awesome quote text! Replace me with your own quote text!', 'author_two' => 'Second Author', 'info_two' => 'Second Programmer', 'quote_two' => 'This is an Awesome quote text! Replace me with your own quote text!', 'author_three' => 'Third Author', 'info_three' => 'Third Programmer', 'quote_three' => 'This is an Awesome quote text! Replace me with your own quote text!', 'author_four' => 'Fourth Author', 'info_four' => 'Fourth Programmer', 'quote_four' => 'This is an Awesome quote text! Replace me with your own quote text!', 'animation' => '', 'mt' => '0', 'mb' => '0'), $atts)); ob_start(); global $rd_data; $id = RandomString(20); if ($hl_color == '') { $hl_color = $rd_data['rd_content_hl_color']; } $output = '<style>#rd_' . $id . ' {margin-top:' . $mt . 'px; margin-bottom:' . $mb . 'px;}#rd_' . $id . ' .sc-four-quote-first,#rd_' . $id . ' .sc-four-quote-last{border-color:' . $i_b_color . ' !important; }#rd_' . $id . ' p{color:' . $q_color . '; }#rd_' . $id . ' h3{color:' . $a_color . '; }#rd_' . $id . ' h4{color:' . $ai_color . '; }#rd_' . $id . ' .quote_meta h3:before{background:' . $hl_color . '; }#rd_' . $id . ' .sc-four-quote-icon:before{background:' . $i_bg_color . '; box-shadow: 0 0 0 1px ' . $i_b_color . ',0 0 0 5px ' . $i_bg_color . ',0 0 0 6px ' . $i_b_color . ';}#rd_' . $id . ' .sc-four-quote-icon:after{color:' . $i_color . ';}'; $output .= '</style>'; $output .= '<div class="sc-four-quote" id="rd_' . $id . '">'; $output .= '<div class="sc-four-quote-ctn quote-top-row"><div class="sc-four-quote-first"><p>' . $quote_one . '</p><div class="quote_meta clearfix"><h3>' . $author_one . '</h3><h4>/ ' . $info_one . '</h4></div></div>'; $output .= '<div class="sc-four-quote-last "><p>' . $quote_two . '</p><div class="quote_meta clearfix"><h3>' . $author_two . '</h3><h4>/ ' . $info_two . '</h4></div></div></div>'; $output .= '<div class="sc-four-quote-icon ' . $animation . '"></div><div class="sc-four-quote-ctn quote-bottom-row">'; $output .= '<div class="sc-four-quote-first"><p>' . $quote_three . '</p><div class="quote_meta clearfix"><h3>' . $author_three . '</h3><h4>/ ' . $info_three . '</h4></div></div>'; $output .= '<div class="sc-four-quote-last"><p>' . $quote_four . '</p><div class="quote_meta clearfix"><h3>' . $author_four . '</h3><h4>/ ' . $info_four . '</h4></div></div></div>'; $output .= '</div>'; echo !empty($output) ? $output : ''; $output_string = ob_get_contents(); ob_end_clean(); return $output_string; }
function rd_fq_sc($atts, $content = null) { extract(shortcode_atts(array('author_one' => '', 'info_one' => '', 'quote_one' => '', 'author_two' => '', 'info_two' => '', 'quote_two' => '', 'author_three' => '', 'info_three' => '', 'quote_three' => '', 'author_four' => '', 'info_four' => '', 'quote_four' => '', 'animation' => ''), $atts)); ob_start(); global $rd_data; $id = RandomString(20); if ($hover_color == '') { $hover_color = $rd_data['rd_content_text_color']; } $output = '<style>#rd_' . $id . ' {margin-top:' . $mt . 'px; margin-bottom:' . $mb . 'px;}'; $output .= '</style>'; $output .= '<div class="sc-four-quote" id="rd_' . $id . '">'; $output .= '<div class="sc-four-quote-first"><p>' . $quote_one . '</p><div class="quote_meta"><h3>' . $author_one . '</h3><h4>/ ' . $info_one . '</h4></div>'; $output .= '<div class="sc-four-quote-two"><p>' . $quote_two . '</p><div class="quote_meta"><h3>' . $author_two . '</h3><h4>/ ' . $info_two . '</h4></div>'; $output .= '<div class="sc-four-quote-icon"></div>'; $output .= '<div class="sc-four-quote-three"><p>' . $quote_three . '</p><div class="quote_meta"><h3>' . $author_three . '</h3><h4>/ ' . $info_three . '</h4></div>'; $output .= '<div class="sc-four-quote-four"><p>' . $quote_four . '</p><div class="quote_meta"><h3>' . $author_four . '</h3><h4>/ ' . $info_four . '</h4></div>'; $output .= '</div>'; echo !empty($output) ? $output : ''; $output_string = ob_get_contents(); ob_end_clean(); return $output_string; }
function profile_testimonial_sc($atts, $content = null) { extract(shortcode_atts(array('bg' => '', 'image' => '', 'author' => '', 'quote' => '', 'hl_color' => '', 'animation' => ''), $atts)); ob_start(); global $rd_data; $id = RandomString(20); if ($hl_color == '') { $hl_color = $rd_data['rd_content_hl_color']; } $img_id = preg_replace('/[^\\d]/', '', $image); $img = wpb_getImageBySize(array('attach_id' => $img_id, 'thumb_size' => '400x400')); $bg_id = preg_replace('/[^\\d]/', '', $bg); $bg_img = wp_get_attachment_image_src($bg_id, 'staff_tn'); $output = '<style>#rd_' . $id . ' {background:url(' . $bg_img[0] . ');}#rd_' . $id . ' .tm_quote:before{background:' . $hl_color . ';}</style><div id="rd_' . $id . '" class="rd_profile_testimonial ' . $animation . '"> <div class="tm_logo">' . $img['thumbnail'] . ' <div class="tm_quote">' . $quote . '</div> <div class="tm_author">' . $author . '</div></div> </div>'; echo !empty($output) ? $output : ''; $output_string = ob_get_contents(); ob_end_clean(); return $output_string; }
function table_ctn($atts, $content) { extract(shortcode_atts(array('col_nb' => 'rd_table_1_col', 'text_color' => '', 'bg_color' => '', 'border_color' => ''), $atts)); ob_start(); global $rd_data; $table_id = RandomString(20); if ($text_color == '') { $text_color = $rd_data['rd_content_text_color']; } if ($bg_color == '') { $bg_color = $rd_data['rd_content_bg_color']; } if ($border_color == '') { $border_color = $rd_data['rd_content_border_color']; } $output = '<style>#t_' . $table_id . ' .table_col {color:' . $text_color . '; background:' . $bg_color . ';}#t_' . $table_id . ' .table_col .table_line_ctn {border:1px solid ' . $border_color . ';}#t_' . $table_id . ' .table_col .table_line {border-bottom:1px solid ' . $border_color . ';} </style> '; $output .= "\n" . '<!-- Table --><div class="rd_table_ctn ' . $col_nb . '" id="t_' . $table_id . '">' . do_shortcode($content) . '</div> <!-- Table END-->' . "\n"; echo !empty($output) ? $output : ''; $output_string = ob_get_contents(); ob_end_clean(); return $output_string; }
/** * Connect the user with an external source. * * This controller method is meant to be used with plugins that set its data array to work. * Events: ConnectData * * @since 2.0.0 * @access public * * @param string $Method Used to register multiple providers on ConnectData event. */ public function Connect($Method) { $this->AddJsFile('entry.js'); $this->View = 'connect'; $IsPostBack = $this->Form->IsPostBack() && $this->Form->GetFormValue('Connect', NULL) !== NULL; if (!$IsPostBack) { // Here are the initial data array values. that can be set by a plugin. $Data = array('Provider' => '', 'ProviderName' => '', 'UniqueID' => '', 'FullName' => '', 'Name' => '', 'Email' => '', 'Photo' => '', 'Target' => $this->Target()); $this->Form->SetData($Data); $this->Form->AddHidden('Target', $this->Request->Get('Target', '/')); } // The different providers can check to see if they are being used and modify the data array accordingly. $this->EventArguments = array($Method); // Fire ConnectData event & error handling. $CurrentData = $this->Form->FormValues(); try { $this->FireEvent('ConnectData'); } catch (Gdn_UserException $Ex) { $this->Form->AddError($Ex); return $this->Render('ConnectError'); } catch (Exception $Ex) { if (Debug()) { $this->Form->AddError($Ex); } else { $this->Form->AddError('There was an error fetching the connection data.'); } return $this->Render('ConnectError'); } if (!UserModel::NoEmail()) { if (!$this->Form->GetFormValue('Email') || $this->Form->GetFormValue('EmailVisible')) { $this->Form->SetFormValue('EmailVisible', TRUE); $this->Form->AddHidden('EmailVisible', TRUE); if ($IsPostBack) { $this->Form->SetFormValue('Email', GetValue('Email', $CurrentData)); } } } $FormData = $this->Form->FormValues(); // debug // Make sure the minimum required data has been provided to the connect. if (!$this->Form->GetFormValue('Provider')) { $this->Form->AddError('ValidateRequired', T('Provider')); } if (!$this->Form->GetFormValue('UniqueID')) { $this->Form->AddError('ValidateRequired', T('UniqueID')); } if (!$this->Data('Verified')) { // Whatever event handler catches this must Set the data 'Verified' to true to prevent a random site from connecting without credentials. // This must be done EVERY postback and is VERY important. $this->Form->AddError('The connection data has not been verified.'); } if ($this->Form->ErrorCount() > 0) { return $this->Render(); } $UserModel = Gdn::UserModel(); // Check to see if there is an existing user associated with the information above. $Auth = $UserModel->GetAuthentication($this->Form->GetFormValue('UniqueID'), $this->Form->GetFormValue('Provider')); $UserID = GetValue('UserID', $Auth); // Check to synchronise roles upon connecting. if (($this->Data('Trusted') || C('Garden.SSO.SynchRoles')) && $this->Form->GetFormValue('Roles', NULL) !== NULL) { $SaveRoles = TRUE; // Translate the role names to IDs. $Roles = $this->Form->GetFormValue('Roles', NULL); $Roles = RoleModel::GetByName($Roles); $RoleIDs = array_keys($Roles); if (empty($RoleIDs)) { // The user must have at least one role. This protects that. $RoleIDs = $this->UserModel->NewUserRoleIDs(); } $this->Form->SetFormValue('RoleID', $RoleIDs); } else { $SaveRoles = FALSE; } if ($UserID) { // The user is already connected. $this->Form->SetFormValue('UserID', $UserID); if (C('Garden.Registration.ConnectSynchronize', TRUE)) { $User = Gdn::UserModel()->GetID($UserID, DATASET_TYPE_ARRAY); $Data = $this->Form->FormValues(); // Don't overwrite the user photo if the user uploaded a new one. $Photo = GetValue('Photo', $User); if (!GetValue('Photo', $Data) || $Photo && !StringBeginsWith($Photo, 'http')) { unset($Data['Photo']); } // Synchronize the user's data. $UserModel->Save($Data, array('NoConfirmEmail' => TRUE, 'FixUnique' => TRUE, 'SaveRoles' => $SaveRoles)); } // Always save the attributes because they may contain authorization information. if ($Attributes = $this->Form->GetFormValue('Attributes')) { $UserModel->SaveAttribute($UserID, $Attributes); } // Sign the user in. Gdn::Session()->Start($UserID, TRUE, TRUE); Gdn::UserModel()->FireEvent('AfterSignIn'); // $this->_SetRedirect(TRUE); $this->_SetRedirect($this->Request->Get('display') == 'popup'); } elseif ($this->Form->GetFormValue('Name') || $this->Form->GetFormValue('Email')) { $NameUnique = C('Garden.Registration.NameUnique', TRUE); $EmailUnique = C('Garden.Registration.EmailUnique', TRUE); $AutoConnect = C('Garden.Registration.AutoConnect'); // Get the existing users that match the name or email of the connection. $Search = FALSE; if ($this->Form->GetFormValue('Name') && $NameUnique) { $UserModel->SQL->OrWhere('Name', $this->Form->GetFormValue('Name')); $Search = TRUE; } if ($this->Form->GetFormValue('Email') && ($EmailUnique || $AutoConnect)) { $UserModel->SQL->OrWhere('Email', $this->Form->GetFormValue('Email')); $Search = TRUE; } if ($Search) { $ExistingUsers = $UserModel->GetWhere()->ResultArray(); } else { $ExistingUsers = array(); } // Check to automatically link the user. if ($AutoConnect && count($ExistingUsers) > 0) { foreach ($ExistingUsers as $Row) { if ($this->Form->GetFormValue('Email') == $Row['Email']) { $UserID = $Row['UserID']; $this->Form->SetFormValue('UserID', $UserID); $Data = $this->Form->FormValues(); if (C('Garden.Registration.ConnectSynchronize', TRUE)) { // Don't overwrite a photo if the user has already uploaded one. $Photo = GetValue('Photo', $Row); if (!GetValue('Photo', $Data) || $Photo && !StringBeginsWith($Photo, 'http')) { unset($Data['Photo']); } $UserModel->Save($Data, array('NoConfirmEmail' => TRUE, 'FixUnique' => TRUE, 'SaveRoles' => $SaveRoles)); } if ($Attributes = $this->Form->GetFormValue('Attributes')) { $UserModel->SaveAttribute($UserID, $Attributes); } // Save the userauthentication link. $UserModel->SaveAuthentication(array('UserID' => $UserID, 'Provider' => $this->Form->GetFormValue('Provider'), 'UniqueID' => $this->Form->GetFormValue('UniqueID'))); // Sign the user in. Gdn::Session()->Start($UserID, TRUE, TRUE); Gdn::UserModel()->FireEvent('AfterSignIn'); // $this->_SetRedirect(TRUE); $this->_SetRedirect($this->Request->Get('display') == 'popup'); $this->Render(); return; } } } $CurrentUserID = Gdn::Session()->UserID; // Massage the existing users. foreach ($ExistingUsers as $Index => $UserRow) { if ($EmailUnique && $UserRow['Email'] == $this->Form->GetFormValue('Email')) { $EmailFound = $UserRow; break; } if ($UserRow['Name'] == $this->Form->GetFormValue('Name')) { $NameFound = $UserRow; } if ($CurrentUserID > 0 && $UserRow['UserID'] == $CurrentUserID) { unset($ExistingUsers[$Index]); $CurrentUserFound = TRUE; } } if (isset($EmailFound)) { // The email address was found and can be the only user option. $ExistingUsers = array($UserRow); $this->SetData('NoConnectName', TRUE); } elseif (isset($CurrentUserFound)) { $ExistingUsers = array_merge(array('UserID' => 'current', 'Name' => sprintf(T('%s (Current)'), Gdn::Session()->User->Name)), $ExistingUsers); } if (!isset($NameFound) && !$IsPostBack) { $this->Form->SetFormValue('ConnectName', $this->Form->GetFormValue('Name')); } $this->SetData('ExistingUsers', $ExistingUsers); if (UserModel::NoEmail()) { $EmailValid = TRUE; } else { $EmailValid = ValidateRequired($this->Form->GetFormValue('Email')); } if ($this->Form->GetFormValue('Name') && $EmailValid && (!is_array($ExistingUsers) || count($ExistingUsers) == 0)) { // There is no existing user with the suggested name so we can just create the user. $User = $this->Form->FormValues(); $User['Password'] = RandomString(50); // some password is required $User['HashMethod'] = 'Random'; $User['Source'] = $this->Form->GetFormValue('Provider'); $User['SourceID'] = $this->Form->GetFormValue('UniqueID'); $User['Attributes'] = $this->Form->GetFormValue('Attributes', NULL); $User['Email'] = $this->Form->GetFormValue('ConnectEmail', $this->Form->GetFormValue('Email', NULL)); // $UserID = $UserModel->InsertForBasic($User, FALSE, array('ValidateEmail' => FALSE, 'NoConfirmEmail' => TRUE, 'SaveRoles' => $SaveRoles)); $UserID = $UserModel->Register($User, array('CheckCaptcha' => FALSE, 'ValidateEmail' => FALSE, 'NoConfirmEmail' => TRUE, 'SaveRoles' => $SaveRoles)); $User['UserID'] = $UserID; $this->Form->SetValidationResults($UserModel->ValidationResults()); if ($UserID) { $UserModel->SaveAuthentication(array('UserID' => $UserID, 'Provider' => $this->Form->GetFormValue('Provider'), 'UniqueID' => $this->Form->GetFormValue('UniqueID'))); $this->Form->SetFormValue('UserID', $UserID); Gdn::Session()->Start($UserID, TRUE, TRUE); Gdn::UserModel()->FireEvent('AfterSignIn'); // Send the welcome email. if (C('Garden.Registration.SendConnectEmail', FALSE)) { try { $UserModel->SendWelcomeEmail($UserID, '', 'Connect', array('ProviderName' => $this->Form->GetFormValue('ProviderName', $this->Form->GetFormValue('Provider', 'Unknown')))); } catch (Exception $Ex) { // Do nothing if emailing doesn't work. } } $this->_SetRedirect(TRUE); } } } // Save the user's choice. if ($IsPostBack) { // The user has made their decision. $PasswordHash = new Gdn_PasswordHash(); $UserSelect = $this->Form->GetFormValue('UserSelect'); if (!$UserSelect || $UserSelect == 'other') { // The user entered a username. $ConnectNameEntered = TRUE; if ($this->Form->ValidateRule('ConnectName', 'ValidateRequired')) { $ConnectName = $this->Form->GetFormValue('ConnectName'); $User = FALSE; if (C('Garden.Registration.NameUnique')) { // Check to see if there is already a user with the given name. $User = $UserModel->GetWhere(array('Name' => $ConnectName))->FirstRow(DATASET_TYPE_ARRAY); } if (!$User) { $this->Form->ValidateRule('ConnectName', 'ValidateUsername'); } } } else { // The user selected an existing user. $ConnectNameEntered = FALSE; if ($UserSelect == 'current') { if (Gdn::Session()->UserID == 0) { // This shouldn't happen, but a use could sign out in another browser and click submit on this form. $this->Form->AddError('@You were uexpectidly signed out.'); } else { $UserSelect = Gdn::Session()->UserID; } } $User = $UserModel->GetID($UserSelect, DATASET_TYPE_ARRAY); } if (isset($User) && $User) { // Make sure the user authenticates. if (!$User['UserID'] == Gdn::Session()->UserID) { if ($this->Form->ValidateRule('ConnectPassword', 'ValidateRequired', sprintf(T('ValidateRequired'), T('Password')))) { try { if (!$PasswordHash->CheckPassword($this->Form->GetFormValue('ConnectPassword'), $User['Password'], $User['HashMethod'], $this->Form->GetFormValue('ConnectName'))) { if ($ConnectNameEntered) { $this->Form->AddError('The username you entered has already been taken.'); } else { $this->Form->AddError('The password you entered is incorrect.'); } } } catch (Gdn_UserException $Ex) { $this->Form->AddError($Ex); } } } } elseif ($this->Form->ErrorCount() == 0) { // The user doesn't exist so we need to add another user. $User = $this->Form->FormValues(); $User['Name'] = $User['ConnectName']; $User['Password'] = RandomString(50); // some password is required $User['HashMethod'] = 'Random'; $UserID = $UserModel->Register($User, array('CheckCaptcha' => FALSE, 'NoConfirmEmail' => TRUE, 'SaveRoles' => $SaveRoles)); $User['UserID'] = $UserID; $this->Form->SetValidationResults($UserModel->ValidationResults()); if ($UserID) { // // Add the user to the default roles. // $UserModel->SaveRoles($UserID, C('Garden.Registration.DefaultRoles')); // Send the welcome email. $UserModel->SendWelcomeEmail($UserID, '', 'Connect', array('ProviderName' => $this->Form->GetFormValue('ProviderName', $this->Form->GetFormValue('Provider', 'Unknown')))); } } if ($this->Form->ErrorCount() == 0) { // Save the authentication. if (isset($User) && GetValue('UserID', $User)) { $UserModel->SaveAuthentication(array('UserID' => $User['UserID'], 'Provider' => $this->Form->GetFormValue('Provider'), 'UniqueID' => $this->Form->GetFormValue('UniqueID'))); $this->Form->SetFormValue('UserID', $User['UserID']); } // Sign the appropriate user in. Gdn::Session()->Start($this->Form->GetFormValue('UserID', TRUE, TRUE)); Gdn::UserModel()->FireEvent('AfterSignIn'); $this->_SetRedirect(TRUE); } } $this->Render(); }
/** * Allows the configuration of basic setup information in Garden. This * should not be functional after the application has been set up. * * @since 2.0.0 * @access public * @param string $RedirectUrl Where to send user afterward. */ public function Configure($RedirectUrl = '') { // Create a model to save configuration settings $Validation = new Gdn_Validation(); $ConfigurationModel = new Gdn_ConfigurationModel($Validation); $ConfigurationModel->SetField(array('Garden.Locale', 'Garden.Title', 'Garden.RewriteUrls', 'Garden.WebRoot', 'Garden.Cookie.Salt', 'Garden.Cookie.Domain', 'Database.Name', 'Database.Host', 'Database.User', 'Database.Password', 'Garden.Registration.ConfirmEmail', 'Garden.Email.SupportName')); // Set the models on the forms. $this->Form->SetModel($ConfigurationModel); // Load the locales for the locale dropdown // $Locale = Gdn::Locale(); // $AvailableLocales = $Locale->GetAvailableLocaleSources(); // $this->LocaleData = array_combine($AvailableLocales, $AvailableLocales); // If seeing the form for the first time... if (!$this->Form->IsPostback()) { // Force the webroot using our best guesstimates $ConfigurationModel->Data['Database.Host'] = 'localhost'; $this->Form->SetData($ConfigurationModel->Data); } else { // Define some validation rules for the fields being saved $ConfigurationModel->Validation->ApplyRule('Database.Name', 'Required', 'You must specify the name of the database in which you want to set up Vanilla.'); // Let's make some user-friendly custom errors for database problems $DatabaseHost = $this->Form->GetFormValue('Database.Host', '~~Invalid~~'); $DatabaseName = $this->Form->GetFormValue('Database.Name', '~~Invalid~~'); $DatabaseUser = $this->Form->GetFormValue('Database.User', '~~Invalid~~'); $DatabasePassword = $this->Form->GetFormValue('Database.Password', '~~Invalid~~'); $ConnectionString = GetConnectionString($DatabaseName, $DatabaseHost); try { $Connection = new PDO($ConnectionString, $DatabaseUser, $DatabasePassword); } catch (PDOException $Exception) { switch ($Exception->getCode()) { case 1044: $this->Form->AddError(T('The database user you specified does not have permission to access the database. Have you created the database yet? The database reported: <code>%s</code>'), strip_tags($Exception->getMessage())); break; case 1045: $this->Form->AddError(T('Failed to connect to the database with the username and password you entered. Did you mistype them? The database reported: <code>%s</code>'), strip_tags($Exception->getMessage())); break; case 1049: $this->Form->AddError(T('It appears as though the database you specified does not exist yet. Have you created it yet? Did you mistype the name? The database reported: <code>%s</code>'), strip_tags($Exception->getMessage())); break; case 2005: $this->Form->AddError(T("Are you sure you've entered the correct database host name? Maybe you mistyped it? The database reported: <code>%s</code>"), strip_tags($Exception->getMessage())); break; default: $this->Form->AddError(sprintf(T('ValidateConnection'), strip_tags($Exception->getMessage()))); break; } } $ConfigurationModel->Validation->ApplyRule('Garden.Title', 'Required'); $ConfigurationFormValues = $this->Form->FormValues(); if ($ConfigurationModel->Validate($ConfigurationFormValues) !== TRUE || $this->Form->ErrorCount() > 0) { // Apply the validation results to the form(s) $this->Form->SetValidationResults($ConfigurationModel->ValidationResults()); } else { $Host = array_shift(explode(':', Gdn::Request()->RequestHost())); $Domain = Gdn::Request()->Domain(); // Set up cookies now so that the user can be signed in. $ExistingSalt = C('Garden.Cookie.Salt', FALSE); $ConfigurationFormValues['Garden.Cookie.Salt'] = $ExistingSalt ? $ExistingSalt : RandomString(10); $ConfigurationFormValues['Garden.Cookie.Domain'] = ''; // Don't set this to anything by default. # Tim - 2010-06-23 // Additional default setup values. $ConfigurationFormValues['Garden.Registration.ConfirmEmail'] = TRUE; $ConfigurationFormValues['Garden.Email.SupportName'] = $ConfigurationFormValues['Garden.Title']; $ConfigurationModel->Save($ConfigurationFormValues, TRUE); // If changing locale, redefine locale sources: $NewLocale = 'en-CA'; // $this->Form->GetFormValue('Garden.Locale', FALSE); if ($NewLocale !== FALSE && Gdn::Config('Garden.Locale') != $NewLocale) { $ApplicationManager = new Gdn_ApplicationManager(); $Locale = Gdn::Locale(); $Locale->Set($NewLocale, $ApplicationManager->EnabledApplicationFolders(), Gdn::PluginManager()->EnabledPluginFolders(), TRUE); } // Install db structure & basic data. $Database = Gdn::Database(); $Database->Init(); $Drop = FALSE; // Gdn::Config('Garden.Version') === FALSE ? TRUE : FALSE; $Explicit = FALSE; try { include PATH_APPLICATIONS . DS . 'dashboard' . DS . 'settings' . DS . 'structure.php'; } catch (Exception $ex) { $this->Form->AddError($ex); } if ($this->Form->ErrorCount() > 0) { return FALSE; } // Create the administrative user $UserModel = Gdn::UserModel(); $UserModel->DefineSchema(); $UsernameError = T('UsernameError', 'Username can only contain letters, numbers, underscores, and must be between 3 and 20 characters long.'); $UserModel->Validation->ApplyRule('Name', 'Username', $UsernameError); $UserModel->Validation->ApplyRule('Name', 'Required', T('You must specify an admin username.')); $UserModel->Validation->ApplyRule('Password', 'Required', T('You must specify an admin password.')); $UserModel->Validation->ApplyRule('Password', 'Match'); $UserModel->Validation->ApplyRule('Email', 'Email'); if (!($AdminUserID = $UserModel->SaveAdminUser($ConfigurationFormValues))) { $this->Form->SetValidationResults($UserModel->ValidationResults()); } else { // The user has been created successfully, so sign in now. SaveToConfig('Garden.Installed', TRUE, array('Save' => FALSE)); Gdn::Session()->Start($AdminUserID, TRUE); SaveToConfig('Garden.Installed', FALSE, array('Save' => FALSE)); } if ($this->Form->ErrorCount() > 0) { return FALSE; } // Assign some extra settings to the configuration file if everything succeeded. $ApplicationInfo = array(); include CombinePaths(array(PATH_APPLICATIONS . DS . 'dashboard' . DS . 'settings' . DS . 'about.php')); // Detect rewrite abilities try { $Query = ConcatSep('/', Gdn::Request()->Domain(), Gdn::Request()->WebRoot(), 'dashboard/setup'); $Results = ProxyHead($Query, array(), 3); $CanRewrite = FALSE; if (in_array(ArrayValue('StatusCode', $Results, 404), array(200, 302)) && ArrayValue('X-Garden-Version', $Results, 'None') != 'None') { $CanRewrite = TRUE; } } catch (Exception $e) { // cURL and fsockopen arent supported... guess? $CanRewrite = function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules()) ? TRUE : FALSE; } SaveToConfig(array('Garden.Version' => ArrayValue('Version', GetValue('Dashboard', $ApplicationInfo, array()), 'Undefined'), 'Garden.RewriteUrls' => $CanRewrite, 'Garden.CanProcessImages' => function_exists('gd_info'), 'EnabledPlugins.GettingStarted' => 'GettingStarted', 'EnabledPlugins.HtmLawed' => 'HtmLawed')); } } return $this->Form->ErrorCount() == 0 ? TRUE : FALSE; }
public function PasswordRequest($Email) { $User = $this->GetWhere(array('Email' => $Email))->FirstRow(); if (!is_object($User) || $Email == '') { return FALSE; } $PasswordResetKey = RandomString(6); $this->SaveAttribute($User->UserID, 'PasswordResetKey', $PasswordResetKey); $AppTitle = Gdn::Config('Garden.Title'); $Email = new Gdn_Email(); $Email->Subject(sprintf(T('[%s] Password Reset Request'), $AppTitle)); $Email->To($User->Email); //$Email->From(Gdn::Config('Garden.Support.Email'), Gdn::Config('Garden.Support.Name')); $Email->Message(sprintf(T('PasswordRequest'), $User->Name, $AppTitle, Url('/entry/passwordreset/' . $User->UserID . '/' . $PasswordResetKey, TRUE))); $Email->Send(); return TRUE; }
public static function forgotPW($account_name, $account_email) { $account_name = mysql_real_escape_string($account_name); $account_email = mysql_real_escape_string($account_email); if (empty($account_name) || empty($account_email)) { echo '<b class="red_text">Please enter both fields.</b>'; } else { connect::selectDB('logondb'); $result = mysql_query("SELECT COUNT('id') FROM account\r\n\t\t\t\t\t\t\t\t WHERE username='******' AND email='" . $account_email . "'"); if (mysql_result($result, 0) == 0) { echo '<b class="red_text">The username or email is incorrect.</b>'; } else { //Success, lets send an email & add the forgotpw thingy. $code = RandomString(); $emailSent = website::sendEmail($account_email, $GLOBALS['default_email'], 'Forgot Password', "\r\n\t\t\t\tHello there. <br/><br/>\r\n\t\t\t\tA password reset has been requested for the account " . $account_name . " <br/>\r\n\t\t\t\tIf you wish to reset your password, click the following link: <br/>\r\n\t\t\t\t<a href='" . $GLOBALS['website_domain'] . "?p=forgotpw&code=" . $code . "&account=" . account::getAccountID($account_name) . "'>\r\n\t\t\t\t" . $GLOBALS['website_domain'] . "?p=forgotpw&code=" . $code . "&account=" . account::getAccountID($account_name) . "</a>\r\n\r\n\t\t\t\t<br/><br/>\r\n\r\n\t\t\t\tIf you did not request this, just ignore this message.<br/><br/>\r\n\t\t\t\tSincerely, The Management."); if ($emailSent) { $account_id = self::getAccountID($account_name); connect::selectDB('webdb'); mysql_query("DELETE FROM password_reset WHERE account_id='" . $account_id . "'"); mysql_query("INSERT INTO password_reset (code,account_id)\r\n\t\t\t\t VALUES ('" . $code . "','" . $account_id . "')"); echo "An email containing a link to reset your password has been sent to the Email address you specified.\r\n\t\t\t\t\t If you've tried to send other forgot password requests before this, they won't work. <br/>"; } else { echo '<h4 class="red_text">Failed to send email! (Check error logs for details)</h4>'; } } } }
<?php function RandomString() { $characters = '0123456789abcdefghijklmnopqrstuvwxyz'; $randstring = ''; for ($i = 0; $i < 32; $i++) { $randstring .= $characters[rand(0, strlen($characters))]; } return $randstring; } $target_dir = "../files/media"; if (!file_exists($target_dir)) { mkdir($target_dir, 0777, true); } $fileName = RandomString(); $originalFileName = $_FILES["photo"]["name"]; $target_dir = $target_dir . "/" . $fileName . ".jpg"; //you can use .jpg or whatever mimetype if (move_uploaded_file($_FILES["photo"]["tmp_name"], $target_dir)) { $query = $db->query("\n INSERT INTO table_names (`type`, category, description, `date`, `value`, attachment, attachment_description)\n VALUES ('{$type}', '{$category}', '{$description}', '{$date}', '{$value}', '{$fileName}', '{$originalFileName}')\n "); if ($query) { $json["status"] = "ok"; } else { $json["status"] = "uuppps somethings wrong please check the database connections"; } } else { $json["status"] = "Sorry, there was an error uploading your file"; } echo json_encode($json);
function staff_sc($atts, $content = null) { extract(shortcode_atts(array('margin_top' => '0', 'margin_bottom' => '0', 'to_show' => '100', 'type' => '', 'group' => '', 'l_target' => '', 'posts_per_line' => '4', 'bg_color' => '', 'alt_bg_color' => '', 'heading_color' => '', 'hl_color' => '', 'border_color' => '', 'scroll' => '', 'speed' => '800', 'text_color' => ''), $atts)); ob_start(); global $rd_data; if ($bg_color == '') { $bg_color = $rd_data['rd_content_bg_color']; } if ($alt_bg_color == '') { $alt_bg_color = $rd_data['rd_content_grey_color']; } if ($heading_color == '') { $heading_color = $rd_data['rd_content_heading_color']; } if ($hl_color == '') { $hl_color = $rd_data['rd_content_hl_color']; } if ($text_color == '') { $text_color = $rd_data['rd_content_text_color']; } if ($border_color == '') { $border_color = $rd_data['rd_content_border_color']; } $staff_id = RandomString(20); $s_style = '<style>'; if ($type == 'rstaff_01') { $s_style .= '.rd_' . $staff_id . '.' . $type . ' .recent_port_ctn{border-bottom:13px solid ' . $border_color . ';}.rd_' . $staff_id . '.' . $type . ' .recent_port_ctn:hover{border-bottom:13px solid ' . $hl_color . ';}.rd_' . $staff_id . '.' . $type . ' .member-info{background:' . $bg_color . '; color:' . $text_color . '; border:1px solid ' . $border_color . '; border-top:none; border-bottom:none;}.rd_' . $staff_id . '.' . $type . ' .bw-wrapper{border:1px solid ' . $border_color . '; border-bottom:none;}.rd_' . $staff_id . '.' . $type . ' .member-info h3 a{color:' . $heading_color . ';}.rd_' . $staff_id . '.' . $type . ' .member-info h3 a:hover,.rd_' . $staff_id . '.' . $type . ' .member-social-links a:hover{color:' . $hl_color . ' !important;}.rd_' . $staff_id . '.' . $type . ' .staff_nav .staff_left,.rd_' . $staff_id . '.' . $type . ' .staff_nav .staff_right{background:' . $heading_color . ' ;}.rd_' . $staff_id . '.' . $type . ' .staff_nav .staff_left:hover,.rd_' . $staff_id . '.' . $type . ' .staff_nav .staff_right:hover{background:' . $hl_color . ';}'; } if ($type == 'rstaff_02') { $s_style .= '.rd_' . $staff_id . '.' . $type . ' .team-member:nth-child(odd) .member-info{background:' . $bg_color . '; color:' . $text_color . ';}.rd_' . $staff_id . '.' . $type . ' .team-member:nth-child(even) .member-info{background:' . $alt_bg_color . '; color:' . $text_color . ';}.rd_' . $staff_id . '.' . $type . ' .team-member:nth-child(odd) .bw-wrapper:after{background:' . $bg_color . ';}.rd_' . $staff_id . '.' . $type . ' .team-member:nth-child(even) .bw-wrapper:after{background:' . $alt_bg_color . ';}.rd_' . $staff_id . '.' . $type . ' .member-info h3 a{color:' . $heading_color . ';}.rd_' . $staff_id . '.' . $type . ' .team-member:hover .bw-wrapper a:before{background:' . $hl_color . ';} .rd_' . $staff_id . '.' . $type . ' .staff_nav .staff_left,.rd_' . $staff_id . '.' . $type . ' .staff_nav .staff_right{background:' . $heading_color . ' ;}.rd_' . $staff_id . '.' . $type . ' .staff_nav .staff_left:hover,.rd_' . $staff_id . '.' . $type . ' .staff_nav .staff_right:hover{background:' . $hl_color . ';}'; } if ($type == 'rstaff_03') { $s_style .= '.rd_' . $staff_id . '.' . $type . ' .team-member:hover .bw-wrapper a:before{border:2px solid ' . $hl_color . '; transform: scale(1.03);}.rd_' . $staff_id . '.' . $type . ' .carousel_recent_post img{background:' . $bg_color . ';}.rd_' . $staff_id . '.' . $type . ' .member-info{ color:' . $text_color . ';}.rd_' . $staff_id . '.' . $type . ' .member-info h3 a{color:' . $heading_color . ';}.rd_' . $staff_id . '.' . $type . ' .member-info h3 a:hover{color:' . $hl_color . ';}.rd_' . $staff_id . '.' . $type . ' .staff_nav .staff_left,.rd_' . $staff_id . '.' . $type . ' .staff_nav .staff_right{background:' . $heading_color . ' ;}.rd_' . $staff_id . '.' . $type . ' .staff_nav .staff_left:hover,.rd_' . $staff_id . '.' . $type . ' .staff_nav .staff_right:hover{background:' . $hl_color . ';}'; } if ($type == 'rstaff_04') { $s_style .= '.rd_' . $staff_id . '.' . $type . ' .recent_port_ctn:hover .member-photo{background:' . $heading_color . '; }.rd_' . $staff_id . '.' . $type . ' .member-info,.rd_' . $staff_id . '.' . $type . ' .member_desc{ color:' . $text_color . ';}.rd_' . $staff_id . '.' . $type . ' .member-info h3 a{color:' . $heading_color . ';}.rd_' . $staff_id . '.' . $type . ' .member-info h3 a:hover{color:' . $hl_color . ';}.rd_' . $staff_id . '_pager a{background:' . $heading_color . ' ;}.rd_' . $staff_id . '_pager a.selected{background:' . $hl_color . ';}'; } $s_style .= '</style>'; echo !empty($s_style) ? $s_style : ''; if ($type == 'rstaff_04') { $pl = $posts_per_line; } echo ' <script type="text/javascript" charset="utf-8"> var j$ = jQuery; j$.noConflict(); "use strict"; //setup up Carousel j$(window).load(function() { j$(".rd_' . $staff_id . '.staff_sc ul").carouFredSel({ responsive: true, width: "100%",'; if ($scroll !== 'yes') { echo 'scroll: 1, auto: false,'; } else { echo 'scroll: { items:1,duration: ' . $speed . '}, auto: true,'; } echo 'prev: ".rd_' . $staff_id . '.staff_left", next: ".rd_' . $staff_id . '.staff_right", pagination: ".rd_' . $staff_id . '_pager", height: "variable", swipe : { onTouch : true, onMouse : false }, items: { width: 330, height: "variable", visible: { min: 1,'; if ($type == 'rstaff_04') { echo 'max:1'; } else { echo 'max: ' . $posts_per_line . ''; } echo ' } } }); }); </script> <div class="staff_sc rd_' . $staff_id . ' ' . $type . '"> <div class="staff_nav"> <p class="rd_' . $staff_id . ' staff_left"></p> <p class="rd_' . $staff_id . ' staff_right"></p> </div> <ul>'; global $post; $args = array('posts_per_page' => $to_show, 'post_type' => "Staff"); if ($group !== '' && $group !== "all") { $args['tax_query'] = array(array('taxonomy' => 'staffgroups', 'field' => 'slug', 'terms' => $group)); } $staff_query = new WP_Query($args); global $more, $post; $more = 0; $i = 1; if ($staff_query->have_posts()) { while ($staff_query->have_posts()) { $staff_query->the_post(); $facebook = get_post_meta($post->ID, 'rd_facebook', true); $twitter = get_post_meta($post->ID, 'rd_twitter', true); $linkedin = get_post_meta($post->ID, 'rd_linkedin', true); $tumblr = get_post_meta($post->ID, 'rd_tumblr', true); $gplus = get_post_meta($post->ID, 'rd_gplus', true); $mail = get_post_meta($post->ID, 'rd_mail', true); $skype = get_post_meta($post->ID, 'rd_skype', true); $Pinterest = get_post_meta($post->ID, 'rd_pinterest', true); $vimeo = get_post_meta($post->ID, 'rd_vimeo', true); $youtube = get_post_meta($post->ID, 'rd_youtube', true); $dribbble = get_post_meta($post->ID, 'rd_dribbble', true); $deviantart = get_post_meta($post->ID, 'rd_deviantart', true); $reddit = get_post_meta($post->ID, 'rd_reddit', true); $behance = get_post_meta($post->ID, 'rd_behance', true); $digg = get_post_meta($post->ID, 'rd_digg', true); $flickr = get_post_meta($post->ID, 'rd_flickr', true); $instagram = get_post_meta($post->ID, 'rd_instagram', true); $position = get_post_meta($post->ID, 'rd_position', true); $desc = get_post_meta($post->ID, 'rd_small_desc', true); if ($type !== 'rstaff_04') { echo '<li class="carousel_recent_post team-member">'; } elseif ($type == 'rstaff_04' && $i == 1) { echo '<li class="carousel_recent_post team-member ' . $pl . ' ' . $i . '">'; } ?> <div class="recent_port_ctn clearfix"> <div class="member-photo s_effect"> <div class="bw-wrapper"> <a href="<?php echo the_permalink(); ?> " target="<?php echo esc_attr($l_target); ?> "><?php if ($type == 'rstaff_02') { echo the_post_thumbnail(array(586, 440), array('title' => "")); } else { echo the_post_thumbnail('staff_tn', array('title' => "")); } ?> </a> <?php if ($type == 'rstaff_01') { ?> <div class="member-social-links"> <?php if ($facebook !== '') { ?> <div id="facebook"><a target="_blank" href="http://www.facebook.com/<?php echo esc_attr($facebook); ?> " ><i class="fa fa-facebook"></i></a></div> <?php } ?> <?php if ($twitter !== '') { ?> <div id="twitter"> <a target="_blank" href="http://twitter.com/<?php echo esc_attr($twitter); ?> " ><i class="fa fa-twitter"></i></a></div> <?php } ?> <?php if ($linkedin !== '') { ?> <div id="lin"> <a target="_blank" href="<?php echo esc_url($linkedin); ?> " ><i class="fa fa-linkedin"></i></a></div> <?php } ?> <?php if ($tumblr !== '') { ?> <div id="tumblr"> <a target="_blank" href="<?php echo esc_url($tumblr); ?> " ><i class="fa fa-tumblr"></i></a></div> <?php } ?> <?php if ($skype !== '') { ?> <div id="skype"> <a target="_blank" href="<?php echo esc_url($skype); ?> " ><i class="fa fa-skype"></i></a></div> <?php } ?> <?php if ($Pinterest !== '') { ?> <div id="Pinterest"> <a target="_blank" href="<?php echo esc_url($Pinterest); ?> " ><i class="fa fa-pinterest"></i></a></div> <?php } ?> <?php if ($vimeo !== '') { ?> <div id="vimeo"> <a target="_blank" href="<?php echo esc_url($vimeo); ?> " ><i class="fa fa-vimeo-square"></i></a></div> <?php } ?> <?php if ($youtube !== '') { ?> <div id="yt"> <a target="_blank" href="<?php echo esc_url($youtube); ?> " ><i class="fa fa-youtube"></i></a></div> <?php } ?> <?php if ($dribbble !== '') { ?> <div id="dribbble"><a target="_blank" href="<?php echo esc_url($dribbble); ?> " ><i class="fa fa-dribbble"></i></a></div> <?php } ?> <?php if ($deviantart !== '') { ?> <div id="da"> <a target="_blank" href="<?php echo esc_url($deviantart); ?> " ><i class="fa fa-deviantart"></i></a></div> <?php } ?> <?php if ($reddit !== '') { ?> <div id="reddit"> <a target="_blank" href="<?php echo esc_url($reddit); ?> " ><i class="fa fa-reddit"></i></a></div> <?php } ?> <?php if ($behance !== '') { ?> <div id="behance"> <a target="_blank" href="<?php echo esc_url($behance); ?> " ><i class="fa fa-behance"></i></a></div> <?php } ?> <?php if ($digg !== '') { ?> <div id="digg"> <a target="_blank" href="<?php echo esc_url($digg); ?> " ><i class="fa fa-digg"></i></a></div> <?php } ?> <?php if ($flickr !== '') { ?> <div id="flickr"> <a target="_blank" href="<?php echo esc_url($flickr); ?> " ><i class="fa fa-flickr"></i></a></div> <?php } ?> <?php if ($instagram !== '') { ?> <div id="instagram"> <a target="_blank" href="<?php echo esc_url($instagram); ?> " ><i class="fa fa-instagram"></i></a></div> <?php } ?> <?php if ($gplus !== '') { ?> <div id="gplus"> <a target="_blank" href="<?php echo esc_url($gplus); ?> " ><i class="fa fa-google-plus"></i></a></div> <?php } ?> <?php if ($mail !== '') { ?> <div id="member_email"> <a target="_blank" href="mailto:<?php echo esc_attr($mail); ?> " ><i class="fa fa-envelope-o"></i></a></div> <?php } ?> </div> <?php } ?> </div> </div> <div class="member-info"> <h3><a href="<?php echo the_permalink(); ?> " target="<?php echo esc_attr($l_target); ?> "><?php echo the_title(); ?> </a></h3> <span class="position" ><?php echo !empty($position) ? $position : ''; ?> </span> <?php if ($type == 'rstaff_04') { ?> <div class="member_desc"><?php $small_desc = substr($desc, 0, 130); $small_desc .= '...'; echo !empty($small_desc) ? $small_desc : ''; ?> </div> <?php } ?> </div> </div> <?php if ($type !== 'rstaff_04') { echo '</li>'; } if ($type == 'rstaff_04' && $i == $pl) { echo '</li>'; $i = 0; } $i++; } } ?> <?php wp_reset_postdata(); ?> </ul> <?php if ($type == 'rstaff_04') { echo '<div class="rd_' . $staff_id . '_pager rd_sc_pager"></div>'; } ?> </div> <?php $output_string = ob_get_contents(); ob_end_clean(); return '<div class="clearfix" style="padding-top:' . $margin_top . 'px"></div>' . $output_string . '<div class="clearfix" style="padding-top:' . $margin_bottom . 'px"></div>'; }
$charLength = strlen($chars); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $chars[rand(0, $charLength - 1)]; } return $randomString; } require_once 'class.phpmailer.php'; include "class.smtp.php"; $con = mysqli_connect("localhost", "root", "root", "Alegatori") or die("Error " . mysqli_error($link)); $query = "SELECT * FROM Date"; $result = mysqli_query($con, $query); while ($date = mysqli_fetch_array($result)) { $qer = "INSERT INTO Conturi (Nume, Parola, Email, Admin) VALUES (?,?,?,'NU')"; $stmt = mysqli_prepare($con, $qer); $pass = RandomString(); mysqli_stmt_bind_param($stmt, "sss", $date['Nume'], $pass, $date['Email']); mysqli_stmt_execute($stmt); $message = 'Numele de utilizator: ' . $date['Nume'] . ' Parola: ' . $pass; $mail = new PHPMailer(); $mail->CharSet = "UTF-8"; // telling the class to use SMTP $mail->IsSMTP(); // enables SMTP debug information (for testing) // 1 = errors and messages // 2 = messages only $mail->SMTPDebug = 0; // enable SMTP authentication $mail->SMTPAuth = true; // sets the prefix to the server $mail->SMTPSecure = "ssl";
preg_match_all('/vc_tab([^\\]]+)/i', $content, $matches, PREG_OFFSET_CAPTURE); $tab_titles = array(); /** * vc_tabs * */ if (isset($matches[1])) { $tab_titles = $matches[1]; } $tabs_nav = ''; $tabs_nav .= '<div class="tab-holder rd_tabs mc_rd_tabs ' . $element . ' ' . $type . ' ' . $color . ' ' . $pos . '" style="margin-top:' . $mt . 'px; margin-bottom:' . $mb . 'px;"><div class="tab-hold tabs-wrapper"><ul id="tabs" class="tabs">'; foreach ($tab_titles as $tab) { $tab_atts = shortcode_parse_atts($tab[0]); if (isset($tab_atts['title'])) { if (isset($tab_atts['use_icon']) && $tab_atts['use_icon'] == 'yes') { $tab_id = RandomString(20); if (!empty($atts['icon'])) { // Don't load the CSS files to trim loading time, include the specific styles via PHP // wp_enqueue_style( '4k-icon-' . $cssFile, plugins_url( 'icons/css/' . $cssFile . '.css', __FILE__ ) ); $cssFile = substr($tab_atts['icon'], 0, stripos($tab_atts['icon'], '-')); wp_enqueue_style('4k-icons', RD_DIRECTORY . '/includes/4k-icons/css/icon-styles.css', null, VERSION_GAMBIT_VC_4K_ICONS); wp_enqueue_script('4k-icons', RD_DIRECTORY . '/includes/4k-icons/js/script-ck.js', array('jquery'), VERSION_GAMBIT_VC_4K_ICONS, true); } global $iconContents; include 'icon-contents.php'; // Normal styles used for everything $cssFile = substr($tab_atts['icon'], 0, stripos($tab_atts['icon'], '-')); $iconFile = RD_DIRECTORY . '/includes/4k-icons/icons/fonts/' . $cssFile; $iconFile = apply_filters('4k_icon_font_pack_path', $iconFile, $cssFile); // Fix ligature icons (these are icons that use more than 1 symbol e.g. mono social icons) $ligatureStyle = '';
/** * Returns the transient key for the authenticated user. * * @return string * @todo check return type */ public function TransientKey($NewKey = NULL) { if (!is_null($NewKey)) { $this->_TransientKey = Gdn::Authenticator()->GetUserModel()->SetTransientKey($this->UserID, $NewKey); } if ($this->_TransientKey !== FALSE) { return $this->_TransientKey; } else { return RandomString(12); } // Postbacks will never be authenticated if transientkey is not defined. }
public function GenerateChanges($Path, $BasePath, $DestPath = NULL) { if ($DestPath == NULL) { $DestPath = $BasePath . '/changes.php'; } // Load the given locale pack. $Definitions = $this->LoadDefinitions($Path, $DestPath); $BaseDefinitions = $this->LoadDefinitions($BasePath, $DestPath); // Figure out the missing definitions. $MissingDefinitions = array_diff_key($BaseDefinitions, $Definitions); // Figure out the extraneous definitions. $ExtraDefinitions = array_diff($Definitions, $BaseDefinitions); // Generate the changes file. $TmpPath = dirname($BasePath) . '/tmp_' . RandomString(10); $fp = fopen($TmpPath, 'wb'); if (!$fp) { throw new Exception(sprintf(T('Could not open %s.'), $TmpPath)); } $Key = trim(strchr($Path, '/'), '/'); $BaseKey = trim(strchr($BasePath, '/'), '/'); fwrite($fp, $this->GetFileHeader()); fwrite($fp, "/** Changes file comparing {$Key} to {$BaseKey}. **/\n\n\n"); fwrite($fp, "/** Missing definitions that are in the {$BaseKey}, but not {$Key}. **/\n"); $this->WriteDefinitions($fp, $MissingDefinitions); fwrite($fp, "\n\n/** Extra definitions that are in the {$Key}, but not the {$BaseKey}. **/\n"); $this->WriteDefinitions($fp, $ExtraDefinitions); fclose($fp); $Result = rename($TmpPath, $DestPath); if (!$Result) { throw new Exception(sprintf(T('Could not open %s.'), $DestPath)); } return $DestPath; }
function rd_progress_bar($atts, $content = null) { $src = get_stylesheet_directory_uri(); extract(shortcode_atts(array('title' => 'Webdesign', 'percentage' => '80', 'title_color' => '', 'pb_color' => '', 'pb_alt_color' => '', 'pb_ctn_color' => '', 'border_color' => '', 'stripe' => '', 'stripe_animation' => ''), $atts)); ob_start(); $pbid = RandomString(20); global $rd_data; $mc_bg_color = $rd_data['rd_content_bg_color']; $mc_heading_color = $rd_data['rd_content_heading_color']; $mc_text_color = $rd_data['rd_content_text_color']; $mc_hl_color = $rd_data['rd_content_hl_color']; $mc_hover_color = $rd_data['rd_content_hover_color']; $mc_light_hover_color = $rd_data['rd_content_light_hover_color']; $mc_border_color = $rd_data['rd_content_border_color']; $mc_grey_color = $rd_data['rd_content_grey_color']; $percentage; if ($title_color == '') { $title_color = $mc_heading_color; } if ($pb_color == '') { $pb_color = $mc_hl_color; } if ($pb_ctn_color == '') { $pb_ctn_color = $mc_grey_color; } if ($border_color == '') { $border_color = $mc_border_color; } if ($percentage < 100) { $output = '<style>#pb_' . $pbid . ' .pb_title,#pb_' . $pbid . ' .pb_sub_title,#pb_' . $pbid . ' .pb_sub_percentage,.rd_pb_1 #pb_' . $pbid . ' .pb_percentage,.rd_pb_2 #pb_' . $pbid . ' .pb_percentage,.rd_pb_7 #pb_' . $pbid . ' .pb_percentage{color:' . $title_color . ';}'; if ($pb_alt_color !== '') { $output .= '#pb_' . $pbid . ' .pb_bg{background: ' . $pb_color . '; background: -moz-linear-gradient(left, ' . $pb_color . ' 0%, ' . $pb_alt_color . ' 100%); background: -webkit-gradient(linear, left top, right top, color-stop(0%,' . $pb_color . '), color-stop(100%,' . $pb_alt_color . ')); background: -webkit-linear-gradient(left, ' . $pb_color . ' 0%,' . $pb_alt_color . ' 100%); background: -o-linear-gradient(left, ' . $pb_color . ' 0%,' . $pb_alt_color . ' 100%); background: -ms-linear-gradient(left, ' . $pb_color . ' 0%,' . $pb_alt_color . ' 100%); background: linear-gradient(to right, ' . $pb_color . ' 0%,' . $pb_alt_color . ' 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="' . $pb_color . '", endColorstr="' . $pb_alt_color . '",GradientType=1 ); }'; } else { $output .= '#pb_' . $pbid . ' .pb_bg{background:' . $pb_color . ';}'; } $output .= '.rd_pb_3 #pb_' . $pbid . ' .pb_percentage,.rd_pb_8 #pb_' . $pbid . ' .pb_percentage,.rd_pb_9 #pb_' . $pbid . ' .pb_percentage{left:' . $percentage . '%; content:""!important; }.rd_pb_3 #pb_' . $pbid . ' .pb_percentage:before,.rd_pb_8 #pb_' . $pbid . ' .pb_percentage:before,.rd_pb_9 #pb_' . $pbid . ' .pb_percentage:before{content:"' . $percentage . '%";}'; if ($stripe == 'yes') { } $output .= '#pb_' . $pbid . ' .pb_ctn{background:' . $pb_ctn_color . '; border:1px solid ' . $border_color . ';}</style>'; $output .= '<div class="progress_bar_sc" id="pb_' . $pbid . '"> <div class="pb_title">' . $title . '</div> <div class="pb_percentage">' . $percentage . '%</div> <div class="clearfix"></div> <div class="pb_ctn"> <div class="pb_bg" data-percentage-value="' . $percentage . '"><span class="pb_sub_title">' . $title . '</span><span class="pb_sub_percentage">: ' . $percentage . '%</span></div>'; if ($stripe !== '' && $stripe_animation !== '') { $output .= '<div class="pb_stripe moving_stripe"></div>'; } elseif ($stripe !== '') { $output .= '<div class="pb_stripe"></div>'; } $output .= '</div> </div>'; echo !empty($output) ? $output : ''; } else { return ' <div class="progress_bar_sc"> <div class="pb_title">' . $title . '</div> <div class="pb_percentage" style="left:' . $percentage . '%">' . $percentage . '%</div> <div class="clearfix"></div> <div class="pb_ctn"><div class="pb_bg" style="width:' . $percentage . '%;"><span class="pb_sub_title">' . $title . '</span><span class="pb_sub_percentage">: ' . $percentage . '%</span></div></div></div>'; } $output_string = ob_get_contents(); ob_end_clean(); return $output_string; }
function profile_testimonial_sc($atts, $content = null) { extract(shortcode_atts(array('bg' => '', 'image' => '', 'author' => 'Enter Author name.', 'quote' => 'I am promo text. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'hl_color' => '', 'animation' => ''), $atts)); ob_start(); global $rd_data; $id = RandomString(20); if ($hl_color == '') { $hl_color = $rd_data['rd_content_hl_color']; } $img_id = preg_replace('/[^\\d]/', '', $image); $img = wpb_getImageBySize(array('attach_id' => $img_id, 'thumb_size' => '400x400')); $bg_id = preg_replace('/[^\\d]/', '', $bg); $bg_img = wp_get_attachment_image_src($bg_id, 'staff_tn'); $output = '<style>#rd_' . $id . ' {background:url(' . $bg_img[0] . ');}#rd_' . $id . ' .tm_quote:before{background:' . $hl_color . ';}</style><div id="rd_' . $id . '" class="rd_profile_testimonial ' . $animation . '"> <div class="tm_logo">' . $img['thumbnail'] . ' <div class="tm_quote">' . $quote . '</div> <div class="tm_author">' . $author . '</div></div> </div>'; echo !empty($output) ? $output : ''; $output_string = ob_get_contents(); ob_end_clean(); return $output_string; }