3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php /* Template Name: Firma Ekle */ ?> <?php if(!is_user_logged_in()) { wp_redirect(home_url()); } if(isset($_POST['sfr_task']) && $_POST['sfr_task'] == 'addfirma' && isset( $_POST['sfr_addfirma_nonce_field'] ) && wp_verify_nonce( $_POST['sfr_addfirma_nonce_field'], 'sfr_addfirma_nonce' ) ) { $result = array(); $title = wp_strip_all_tags(sanitize_text_field($_POST['sfr_title'])); $category = sanitize_text_field($_POST['sfr_category']); $goldcategory = sanitize_text_field($_POST['sfr_goldcategory']); $content = $_POST['sfr_newscontent']; $address = wp_strip_all_tags(sanitize_text_field($_POST['sfr_address'])); $phone = wp_strip_all_tags(sanitize_text_field($_POST['sfr_phone'])); $fax = wp_strip_all_tags(sanitize_text_field($_POST['sfr_fax'])); $mail = wp_strip_all_tags(sanitize_text_field($_POST['sfr_mail'])); $website = wp_strip_all_tags(sanitize_text_field($_POST['sfr_website'])); $facebook = wp_strip_all_tags(sanitize_text_field($_POST['sfr_facebook'])); $twitter = wp_strip_all_tags(sanitize_text_field($_POST['sfr_twitter'])); $gplus = wp_strip_all_tags(sanitize_text_field($_POST['sfr_gplus'])); $tags = sanitize_text_field($_POST['sfr_tags']); $maps = sanitize_text_field($_POST['sfr_maps']); $video = ($_POST['sfr_video']); if($title == '' || $address == '' || $content == '') { $result = array('class'=>'status warning', 'message'=>'Firma ünvanı, firma adresi ve içerik alanı zorunludur.'); } else { global $current_user; get_currentuserinfo(); $authorID = $current_user->ID; $categories = array($category); if( get_user_meta($authorID, 'premium', true) && $goldcategory == 1 ) { $categories[] = xoption('firmaGoldCategory'); } if(current_user_can('administrator')) { $post_status = 'publish'; } else { $post_status = xoption('profilePostStatus'); } $postArgs = array( 'post_title' => $title, 'post_content' => $content, 'post_status' => $post_status, 'post_author' => $authorID, 'post_category' => $categories, 'tags_input' => $tags, 'comment_status'=> 'open' ); $doUpdate = false; $attachmentIDs = array(); $uploadCounter = 0; foreach( $_FILES as $file ) { if( is_array( $file ) && $file['name'] ) { $uploadCounter++; $allowed = array('gif','png','jpg'); $filename = $file['name']; $filesize = $file['size']; $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); if( $file['error'] == 0 && in_array($ext, $allowed) && $filesize < SAFIR_MAX_UPLOAD_SIZE ) { $attachmentIDs[] = upload_user_file( $file ); } } } if(count($attachmentIDs) == $uploadCounter) { $doUpdate = true; } else { $doUpdate = false; $result = array('class'=>'status warning', 'message'=>'Bazı resimler yüklenemedi. Lütfen dosya uzantısına ve boyutun en fazla 1 MB olmasına dikkat ediniz.'); foreach ($attachmentIDs as $attachmentID) { wp_delete_attachment($attachmentID, true); } } if($doUpdate) { $postID = wp_insert_post( $postArgs ); if( is_wp_error($postID) ) { $result = array('class'=>'status warning', 'message'=>$postID->get_error_message()); } else { $counter = 0; if(count($attachmentIDs) > 0) { foreach ($attachmentIDs as $attachmentID) { $counter++; if($counter == 1) { add_post_meta($postID, '_thumbnail_id', $attachmentID); } else { $image = wp_get_attachment_image_src($attachmentID, 'full'); add_post_meta($postID, constant('SAFIR_FIRMA_RESIM' . $counter), $image[0]); wp_update_post( array( 'ID' => $attachmentID, 'post_parent' => $postID ) ); } } } if($address) add_post_meta($postID, SAFIR_FIRMA_ADRES, $address); if($phone) add_post_meta($postID, SAFIR_FIRMA_PHONE, $phone); if($fax) add_post_meta($postID, SAFIR_FIRMA_FAX, $fax); if($mail) add_post_meta($postID, SAFIR_FIRMA_EMAIL, $mail); if($website) add_post_meta($postID, SAFIR_FIRMA_WEBSITE, $website); if($facebook) add_post_meta($postID, SAFIR_FIRMA_FACEBOOK, $facebook); if($twitter) add_post_meta($postID, SAFIR_FIRMA_TWITTER, $twitter); if($gplus) add_post_meta($postID, SAFIR_FIRMA_GPLUS, $gplus); if($maps) add_post_meta($postID, SAFIR_FIRMA_MAPS, $maps); if($video) add_post_meta($postID, SAFIR_FIRMA_VIDEO, $video); $message = 'Firma başarılı bir şekilde eklendi.'; if($post_status == 'draft') { $message .= ' Yönetici onayından sonra yayınlanacaktır.'; } else { $message .= ' <a rel="external" href="'. get_permalink($postID). '">Konuyu Görüntüle</a>'; } $result = array('class'=>'status success', 'message'=> $message); if(xoption('sendMailtoAdminAdd')) include('sendmailtoadmin.php'); } } } } ?> <?php get_header() ?> <h1 class="mainHeading"><?php the_title() ?></h1> <div id="profile" class="addfirma"> <?php global $current_user; get_currentuserinfo(); $authorID = $current_user->ID; if($content == '') $content = 'Firma hakkında bilgiyi buraya yazınız'; ?> <div class="sfrIconForm"> <form class="addfirma" method="post" enctype="multipart/form-data"> <?php if(!$result) { $result = array('class' => 'status', 'message' => 'Firma ile ilgili bilgileri aşağıdaki forma ekleyiniz.'); } ?> <?php if(xoption('firmaPage') != "-1") : ?><a class="safirButton list shiftbottom" href="<?php echo get_permalink(xoption('firmaPage')) ?>">Eklediğim Firmaları Listele</a><?php endif; ?> <p class="<?php echo $result['class'] ?>"><?php echo $result['message'] ?></p> <div class="container"> <div class="itemContainer"> <div class="item pen"> <div class="icon"><span></span></div> <input name="sfr_title" type="text" placeholder="Firma Ünvanı *" value="<?php echo $title ?>" /> </div> </div> <div class="itemContainer"> <div class="item address"> <div class="icon"><span></span></div> <input name="sfr_address" type="text" placeholder="Firma Adresi *" value="<?php echo $address ?>" /> </div> </div> <div class="container"> <div class="itemContainer"> <div class="item tag"> <div class="icon"><span></span></div> <input name="sfr_tags" type="text" placeholder="İlçe Adı" value="<?php echo $tags ?>" /> </div> </div></div> <?php if( get_user_meta($authorID, 'premium', true) ) : ?> <div class="itemContainer"> <div class="item category"> <div class="icon"><span></span></div> <select name="sfr_goldcategory"> <option value="1"<?php if($goldcategory == 1) echo ' selected'; ?>> Bu firma Gold Firmalar kategorisine de eklensin. </option> <option value="0"<?php if($goldcategory == 0) echo ' selected'; ?>> Bu firma Gold Firmalar kategorisine eklenmesin. </option> ?> </select> </div> </div> <?php endif; ?> </div> <div class="container half"> <div class="itemContainer"> <div class="item category"> <div class="icon"><span></span></div> <select name="sfr_category"> <?php $categories = xoption('profileFirmaCategories'); foreach ($categories as $catID) {?> <option value="<?php echo $catID ?> "<?php if($category == $catID) echo ' selected'; ?>><?php echo get_cat_name($catID) ?></option> <?php } ?> </select> </div> </div> <div class="itemContainer"> <div class="item phone"> <div class="icon"><span></span></div> <input name="sfr_phone" type="text" placeholder="Firma Telefon Numarası" value="<?php echo $phone ?>" /> </div> </div> <div class="itemContainer"> <div class="item fax"> <div class="icon"><span></span></div> <input name="sfr_fax" type="text" placeholder="Firma Faks Numarası" value="<?php echo $fax ?>" /> </div> </div> <div class="itemContainer"> <div class="item mail"> <div class="icon"><span></span></div> <input name="sfr_mail" type="text" placeholder="Firma E-posta Adresi" value="<?php echo $mail ?>" /> </div> </div> </div> <div class="container"> <div class="itemContainer"> <div class="item image"> <div class="icon"><span></span></div> <label class="fileLabel" for="file.newsImage0"><span class="text">Firma Kapak Resmi</span><span class="button">Resim Seç</span></label><input id="file.newsImage0" name="sfr_image0" type="file" accept="image/*" /> </div> </div> </div> <div class="container"> <div class="itemContainer"> <div class="item website"> <div class="icon"><span></span></div> <input name="sfr_website" type="text" placeholder="Firma Website Adresi (http://site.com formatında)" value="<?php echo $website ?>" /> </div> </div> <div class="itemContainer"> <div class="item facebook"> <div class="icon"><span></span></div> <input name="sfr_facebook" type="text" placeholder="Firma Facebook Adresi (http://site.com formatında)" value="<?php echo $facebook ?>" /> </div> </div> <div class="itemContainer"> <div class="item twitter"> <div class="icon"><span></span></div> <input name="sfr_twitter" type="text" placeholder="Firma Twitter Adresi (http://site.com formatında)" value="<?php echo $twitter ?>" /> </div> </div> <div class="itemContainer"> <div class="item gplus"> <div class="icon"><span></span></div> <input name="sfr_gplus" type="text" placeholder="Firma Google+ Adresi (http://site.com formatında)" value="<?php echo $gplus ?>" /> </div> </div> <div class="container"> <div class="itemContainer"> <div class="item maps"> <p style="margin-left:10px;">Firma Konumu</p> <div id="googleMap" style="height:350px;"></div> <input type="hidden" name="sfr_maps" id="googleMapsInput" /> </div> </div> </div> <div class="container"> <div class="itemContainer"> <div class="item video"> <textarea class="noicon" name="sfr_video" placeholder="Firma Video Embed Kodu"><?php echo $video ?></textarea> </div> </div> </div> sssss <div class="itemContainer"> <div class="item"> <?php wp_editor($content, 'sfr_newscontent', array( 'textarea_rows' => 20, 'media_buttons' => false, 'quicktags' => false, 'tinymce' => array('toolbar1'=> 'formatselect bold italic underline bullist numlist link unlink forecolorc image alignleft aligncenter alignright', 'toolbar2'=>''), )); ?> </div> </div> </div> <input type="hidden" name="sfr_task" value="addfirma"> <input type="submit" value="&#10004; FİRMAYI EKLE"> <?php wp_nonce_field( 'sfr_addfirma_nonce', 'sfr_addfirma_nonce_field' ); ?> </form> </div> </div> </div><!--content--> <?php global $activeMenu; $activeMenu = 'addfirma'; include( TEMPLATEPATH . '/profile/aside.php'); ?> </div> <!--main--> <?php get_footer(); ?> <script src="http://maps.googleapis.com/maps/api/js"></script> <script> function initialize() { var myLatlng = new google.maps.LatLng(39,36); var mapOptions = { zoom: 5, center: myLatlng, draggableCursor: "crosshair", } var map = new google.maps.Map(document.getElementById('googleMap'), mapOptions); var marker = new google.maps.Marker({ position: myLatlng, map: map, }); google.maps.event.addListener(map, 'click', function(location) { var newLatlng = location.latLng marker.setPosition(newLatlng); $('#googleMapsInput').val(newLatlng.lat() + "," + newLatlng.lng()); }); } google.maps.event.addDomListener(window, 'load', initialize); </script>
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function is_user_logged_in() in /in/Hq39F:7 Stack trace: #0 {main} thrown in /in/Hq39F on line 7
Process exited with code 255.
Output for 5.5.0 - 5.6.28
Fatal error: Call to undefined function is_user_logged_in() in /in/Hq39F on line 7
Process exited with code 255.