Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
beak
/
wp-content
/
themes
/
anka
/
profile
:
page-posts-add.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php if(!defined('ABSPATH')) exit; ?> <?php /* Template Name: İçerik Ekle */ ?> <?php if(!is_user_logged_in()) { wp_redirect(get_page_link(xoption("membershipPage"))); die(); } global $current_user; wp_get_current_user(); $result = array(); $tags = ""; $authorID = $current_user->ID; if($authorID == SAFIR_DEMO_USERID) { $result = array('icon'=>'warning', 'message'=> __("Demo kullanıcısı düzenleme yapamaz.", "anka") ); } else { if(isset($_POST['sfr_task']) && $_POST['sfr_task'] == 'addnews' && isset( $_POST['sfr_addnews_nonce_field'] ) && wp_verify_nonce( $_POST['sfr_addnews_nonce_field'], 'sfr_addnews_nonce' ) ) { $result = array(); $title = wp_strip_all_tags(sanitize_text_field($_POST['sfr_title'])); if(isset($_POST['sfr_category'])) { $category = $_POST['sfr_category']; } else { $category = array(); } $content = $_POST['sfr_newscontent']; $tags = wp_strip_all_tags(sanitize_text_field($_POST['sfr_tags'])); if($title == '' || $content == '') { $result = array('icon'=>'warning', 'message'=>__('Başlık ve içerik alanı zorunludur.','anka')); } else { global $current_user; wp_get_current_user(); $authorID = $current_user->ID; 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' => $category, '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','jpeg','webp'); $filename = $file['name']; $filesize = $file['size']; $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); if( $file['error'] == 0 && in_array($ext, $allowed) && $filesize < xoption("profileUpload") * 1024 * 1024 ) { $attachmentIDs[] = upload_user_file( $file ); } } } if(count($attachmentIDs) == $uploadCounter) { $doUpdate = true; } else { $doUpdate = false; $result = array('icon'=>'warning', 'message'=>'Bazı resimler yüklenemedi. Lütfen dosya uzantısına ve boyutun en fazla '.xoption("profileUpload").' 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('icon'=>'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 { wp_update_post( array( 'ID' => $attachmentID, 'post_parent' => $postID ) ); add_post_meta($postID, 'haberresim' . $counter, $attachmentID); } } endif; $message = __('Yazı başarılı bir şekilde eklendi.', 'anka'); if($post_status != 'publish') { $message .= ' ' . __('Yazı, yönetici onayından sonra yayınlanacaktır.', 'anka'); } else { $message .= ' <a rel="external" href="'. get_permalink($postID). '">'. __('Yazıyı Görüntüle', 'anka') .'</a>'; } $result = array('icon'=>'success', 'message'=> $message); if(xoption('sendMailtoAdminAdd')) include('sendmailtoadmin.php'); } } } } } ?> <?php get_header() ?> <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <div id="main"> <div class="innerContainer pad"> <div id="content"> <div class="safirBox"> <div id="profile" class="addnews"> <div class="pageHeading"> <h1 class="title"><?php the_title() ?></h1> <?php if(xoption('postsPage')) : ?> <div class="profileButtons"> <a class="list" href="<?php echo get_permalink(xoption('postsPage')) ?>"><?php themeIcon("list") ?><?php _e("Eklediklerim", "anka"); ?></a> </div> <?php endif; ?> </div> <?php if(!isset($content)) $content = __('Yazı detayını buraya yazınız', 'anka'); ?> <div class="sfrIconForm"> <form class="addnews" method="post" enctype="multipart/form-data"> <?php if(!$result) { $result = array('icon'=> 'info', 'message' => __('Yazı ile ilgili bilgileri aşağıdaki forma ekleyiniz.', 'anka')); } ?> <p class="status" data-loading="<?php _e("Lütfen bekleyiniz", "anka") ?>..."><?php themeIcon($result['icon']) ?><?php echo $result['message'] ?></p> <div class="container"> <div class="itemContainer"> <div class="item title"> <?php themeIcon("list") ?> <input name="sfr_title" type="text" placeholder="<?php _e("Yazı Başlığı", "anka"); ?> *" value="<?php echo $title ?>" /> </div> </div> <div class="itemContainer"> <div class="item category"> <div class="items"> <?php $checkbox_counter = 0; if(!isset($category)) $category = array(); if(is_array(xoption('profilePostsCategories'))) : foreach (xoption('profilePostsCategories') as $catID) { ?> <div class="checkbox"> <div class="safirCheckbox"> <input type="checkbox" name="sfr_category[]" id="sfr_category<?php echo $checkbox_counter?>" value="<?php echo $catID ?>" <?php if(in_array($catID, $category)) { echo " checked"; } ?> /> <label for="sfr_category<?php echo $checkbox_counter?>"> <span></span><?php echo get_cat_name($catID) ?></label> </div> </div> <?php $checkbox_counter++; } endif; ?> </div> </div> </div> </div> <div class="container half"> <div class="itemContainer"> <div class="item image"> <?php themeIcon("photo") ?> <label class="fileLabel" for="file.newsImage0"><span class="text"><?php _e("Yazı Kapak Resmi", "anka"); ?></span><span class="button"><?php _e("Resim Seç", "anka"); ?></span></label><input id="file.newsImage0" name="sfr_image0" type="file" accept="image/*" /> </div> </div> <div class="itemContainer"> <div class="item image"> <?php themeIcon("photo") ?> <label class="fileLabel" for="file.newsImage1"><span class="text"><?php _e("Yazı Galeri Resmi", "anka"); ?> 1</span><span class="button"><?php _e("Resim Seç", "anka"); ?></span></label><input id="file.newsImage1" name="sfr_image1" type="file" accept="image/*" /> </div> </div> <div class="itemContainer"> <div class="item image"> <?php themeIcon("photo") ?> <label class="fileLabel" for="file.newsImage2"><span class="text"><?php _e("Yazı Galeri Resmi", "anka"); ?> 2</span><span class="button"><?php _e("Resim Seç", "anka"); ?></span></label><input id="file.newsImage2" name="sfr_image2" type="file" accept="image/*" /> </div> </div> <div class="itemContainer"> <div class="item image"> <?php themeIcon("photo") ?> <label class="fileLabel" for="file.newsImage3"><span class="text"><?php _e("Yazı Galeri Resmi", "anka"); ?> 3</span><span class="button"><?php _e("Resim Seç", "anka"); ?></span></label><input id="file.newsImage3" name="sfr_image3" type="file" accept="image/*" /> </div> </div> <div class="itemContainer"> <div class="item image"> <?php themeIcon("photo") ?> <label class="fileLabel" for="file.newsImage4"><span class="text"><?php _e("Yazı Galeri Resmi", "anka"); ?> 4</span><span class="button"><?php _e("Resim Seç", "anka"); ?></span></label><input id="file.newsImage4" name="sfr_image4" type="file" accept="image/*" /> </div> </div> <div class="itemContainer"> <div class="item image"> <?php themeIcon("photo") ?> <label class="fileLabel" for="file.newsImage5"><span class="text"><?php _e("Yazı Galeri Resmi", "anka"); ?> 5</span><span class="button"><?php _e("Resim Seç", "anka"); ?></span></label><input id="file.newsImage5" name="sfr_image5" type="file" accept="image/*" /> </div> </div> </div> <div class="container"> <div class="itemContainer"> <div class="item tag"> <?php themeIcon("tag") ?> <input name="sfr_tags" type="text" placeholder="<?php _e("Yazıyla ilgili anahtar kelimeler (virgüllerle ayırınız)", "anka"); ?>" value="<?php echo $tags ?>" /> </div> </div> <div class="itemContainer"> <div class="item"> <?php wp_editor(stripslashes($content), 'sfr_newscontent', array( 'editor_height' => 220, '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="addnews"> <button class="check submit"><?php _e("Kaydet", "anka"); ?></button> <?php wp_nonce_field( 'sfr_addnews_nonce', 'sfr_addnews_nonce_field' ); ?> </form> </div> </div> </div> </div> <?php global $activeMenu; $activeMenu = 'addposts'; include( get_template_directory() . '/profile/aside.php'); ?> </div> </div> <?php endwhile; ?> <?php get_footer(); ?>